diff --git a/frontend/README.md b/frontend/README.md index bae28f033..236edc1f5 100644 --- a/frontend/README.md +++ b/frontend/README.md @@ -1490,6 +1490,9 @@ DatePicker 在基础组件中展示日期与日期时间选择;IndexLayout 在 ### 智能构建首页与任务找回 +从创建入口重新进入智能构建时,返回首页并清除上次部署页的导航状态;仍可从已保存项目 +选择版本再次部署。 + 首页将新建构建与进行中的任务并列展示,已保存项目位于下方。窄窗口优先展示进行中的 任务。列表通过已有后台任务监控读取当前登录用户的任务,显示需求摘要、状态和开始 时间;刷新或重新打开网页后仍可找到尚在运行、重连中或等待回复的任务。 diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index bec119857..1d5655d6f 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -7456,6 +7456,7 @@ export default function App() { title: t("addAgent.intelligent.title"), desc: t("addAgent.intelligent.description"), onClick: () => { + setIntelligentDeployment(null); setAddMenu(false); setImportedDraft(null); setRuntimeUpdateTarget(null); diff --git a/frontend/tests/intelligentCreateNavigation.test.mjs b/frontend/tests/intelligentCreateNavigation.test.mjs new file mode 100644 index 000000000..8e7512ba8 --- /dev/null +++ b/frontend/tests/intelligentCreateNavigation.test.mjs @@ -0,0 +1,84 @@ +import assert from "node:assert/strict"; +import { readFileSync } from "node:fs"; +import test from "node:test"; +import { JSDOM } from "jsdom"; +import ts from "typescript"; + +const source = ts.createSourceFile( + "App.tsx", + readFileSync(new URL("../src/App.tsx", import.meta.url), "utf8"), + ts.ScriptTarget.Latest, + true, + ts.ScriptKind.TSX, +); + +function findNode(predicate, node = source) { + return predicate(node) ? node : ts.forEachChild(node, (child) => findNode(predicate, child)); +} + +function bindCallback(node, bindings) { + assert.ok(node, "App navigation callback must exist"); + const { outputText } = ts.transpileModule(`return (${node.getText(source)});`, { + compilerOptions: { target: ts.ScriptTarget.ES2022 }, + }); + return Function(...Object.keys(bindings), outputText)(...Object.values(bindings)); +} + +const deploymentSetter = findNode((node) => + ts.isVariableDeclaration(node) && node.name.getText(source) === "setIntelligentDeployment", +).initializer.arguments[0]; +const intelligentCard = findNode((node) => ts.isObjectLiteralExpression(node) + && node.properties.some((property) => ts.isPropertyAssignment(property) + && property.name.getText(source) === "key" + && ts.isStringLiteral(property.initializer) + && property.initializer.text === "intelligent")); +const enterIntelligentCreate = intelligentCard.properties.find((property) => + ts.isPropertyAssignment(property) && property.name.getText(source) === "onClick", +).initializer; + +test("entering intelligent build clears the previous deployment and its reload URL", () => { + const dom = new JSDOM("", { url: "https://studio.example.test/?unrelated=keep#workspace" }); + const state = { createView: null, addMenu: true, intelligentDeployment: null }; + const setIntelligentDeployment = bindCallback(deploymentSetter, { + window: dom.window, + setIntelligentDeploymentState: (value) => { state.intelligentDeployment = value; }, + }); + const enterHome = bindCallback(enterIntelligentCreate, { + setIntelligentDeployment, + ...Object.fromEntries([ + "AddMenu", "ImportedDraft", "RuntimeUpdateTarget", "FocusedDeploymentTaskId", + "FocusedWorkspaceAgentId", "EditingDraftId", "MigrationProjectReturn", "CreateView", + ].map((name) => [`set${name}`, (value) => { + state[name[0].toLowerCase() + name.slice(1)] = value; + }])), + editingDraftBaselineRef: { current: null }, + }); + + try { + // Both current-session and saved-project deliveries share this navigation. + for (const project of [{}, { projectId: "project-1", versionId: "version-1" }]) { + const delivery = { + sessionId: "build-session", + artifactSha256: "a".repeat(64), + validationReportSha256: "b".repeat(64), + ...project, + }; + setIntelligentDeployment(delivery); + assert.equal(state.intelligentDeployment, delivery); + assert.equal(new URL(dom.window.location.href).searchParams.get("view"), "runtime-deploy"); + + enterHome(); + + assert.equal(state.createView, "intelligent"); + assert.equal(state.addMenu, false); + assert.equal(state.intelligentDeployment, null, "A previous deployment must not cover the home page"); + assert.equal(dom.window.location.search, "?unrelated=keep", "Reload must not restore the previous deployment"); + assert.equal(dom.window.location.hash, "#workspace"); + + enterHome(); + assert.equal(state.intelligentDeployment, null, "Repeated entry remains on the home page"); + } + } finally { + dom.window.close(); + } +}); diff --git a/veadk/webui/assets/app/index-Lu5VNfHM.js b/veadk/webui/assets/app/index--Hgqzodn.js similarity index 99% rename from veadk/webui/assets/app/index-Lu5VNfHM.js rename to veadk/webui/assets/app/index--Hgqzodn.js index c7229cdea..732c31610 100644 --- a/veadk/webui/assets/app/index-Lu5VNfHM.js +++ b/veadk/webui/assets/app/index--Hgqzodn.js @@ -1,4 +1,4 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/visualizations/mermaid/mermaid.core-D4lqlGFD.js","assets/chunks/purify.es-BnINGy_Y.js","assets/chunks/MarkdownPromptEditor-CdrKT5NM.js","assets/styles/MarkdownPromptEditor-ZH9qtki0.css","assets/chunks/QuickAgentCreateDialog-D9P_guDo.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-D2fLiU9C.js","assets/chunks/purify.es-BnINGy_Y.js","assets/chunks/MarkdownPromptEditor-DzOPzsW3.js","assets/styles/MarkdownPromptEditor-ZH9qtki0.css","assets/chunks/QuickAgentCreateDialog-B3suviqp.js","assets/styles/QuickAgentCreateDialog-DGsLIlOX.css"])))=>i.map(i=>d[i]); var lUe=Object.defineProperty;var HW=e=>{throw TypeError(e)};var cUe=(e,t,n)=>t in e?lUe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var tn=(e,t,n)=>cUe(e,typeof t!="symbol"?t+"":t,n),qW=(e,t,n)=>t.has(e)||HW("Cannot "+n);var tl=(e,t,n)=>(qW(e,t,"read from private field"),n?n.call(e):t.get(e)),WW=(e,t,n)=>t.has(e)?HW("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),LM=(e,t,n,i)=>(qW(e,t,"write to private field"),i?i.call(e,n):t.set(e,n),n);function uUe(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 a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&i(a)}).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 xm=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Aw(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var xle={exports:{}},dI={};/** * @license React * react-jsx-runtime.production.js @@ -107,7 +107,7 @@ Error generating stack: `+i.message+` top: ${c}px !important; left: ${u}px !important; } - `),()=>{document.head.removeChild(d)}},[t]),o.jsx(Rqe,{isPresent:t,childRef:i,sizeRef:r,children:p.cloneElement(e,{ref:i})})}const Pqe=({children:e,initial:t,isPresent:n,onExitComplete:i,custom:r,presenceAffectsLayout:s,mode:a})=>{const l=RI(Dqe),c=p.useId(),u=p.useCallback(f=>{l.set(f,!0);for(const h of l.values())if(!h)return;i&&i()},[l,i]),d=p.useMemo(()=>({id:c,initial:t,isPresent:n,custom:r,onExitComplete:u,register:f=>(l.set(f,!1),()=>l.delete(f))}),s?[Math.random(),u]:[n,u]);return p.useMemo(()=>{l.forEach((f,h)=>l.set(h,!1))},[n]),p.useEffect(()=>{!n&&!l.size&&i&&i()},[n]),a==="popLayout"&&(e=o.jsx(Iqe,{isPresent:n,children:e})),o.jsx(II.Provider,{value:d,children:e})};function Dqe(){return new Map}function Qke(e=!0){const t=p.useContext(II);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:i,register:r}=t,s=p.useId();p.useEffect(()=>{e&&r(s)},[e]);const a=p.useCallback(()=>e&&i&&i(s),[s,i,e]);return!n&&i?[!1,a]:[!0]}const v2=e=>e.key||"";function LG(e){const t=[];return p.Children.forEach(e,n=>{p.isValidElement(n)&&t.push(n)}),t}const B7=typeof window<"u",zke=B7?p.useLayoutEffect:p.useEffect,Td=({children:e,custom:t,initial:n=!0,onExitComplete:i,presenceAffectsLayout:r=!0,mode:s="sync",propagate:a=!1})=>{const[l,c]=Qke(a),u=p.useMemo(()=>LG(e),[e]),d=a&&!l?[]:u.map(v2),f=p.useRef(!0),h=p.useRef(u),m=RI(()=>new Map),[g,b]=p.useState(u),[v,y]=p.useState(u);zke(()=>{f.current=!1,h.current=u;for(let O=0;O{const S=v2(O),k=a&&!l?!1:u===v||d.includes(S),C=()=>{if(m.has(S))m.set(S,!0);else return;let E=!0;m.forEach(N=>{N||(E=!1)}),E&&(w==null||w(),y(h.current),a&&(c==null||c()),i&&i())};return o.jsx(Pqe,{isPresent:k,initial:!f.current||n?void 0:!1,custom:k?void 0:t,presenceAffectsLayout:r,mode:s,onExitComplete:k?void 0:C,children:O},S)})})},tu=e=>e;let Vke=tu;const Mqe={useManualTiming:!1};function Lqe(e){let t=new Set,n=new Set,i=!1,r=!1;const s=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function l(u){s.has(u)&&(c.schedule(u),e()),u(a)}const c={schedule:(u,d=!1,f=!1)=>{const m=f&&i?t:n;return d&&s.add(u),m.has(u)||m.add(u),u},cancel:u=>{n.delete(u),s.delete(u)},process:u=>{if(a=u,i){r=!0;return}i=!0,[t,n]=[n,t],t.forEach(l),t.clear(),i=!1,r&&(r=!1,c.process(u))}};return c}const x2=["read","resolveKeyframes","update","preRender","render","postRender"],$qe=40;function Hke(e,t){let n=!1,i=!0;const r={delta:0,timestamp:0,isProcessing:!1},s=()=>n=!0,a=x2.reduce((y,x)=>(y[x]=Lqe(s),y),{}),{read:l,resolveKeyframes:c,update:u,preRender:d,render:f,postRender:h}=a,m=()=>{const y=performance.now();n=!1,r.delta=i?1e3/60:Math.max(Math.min(y-r.timestamp,$qe),1),r.timestamp=y,r.isProcessing=!0,l.process(r),c.process(r),u.process(r),d.process(r),f.process(r),h.process(r),r.isProcessing=!1,n&&t&&(i=!1,e(m))},g=()=>{n=!0,i=!0,r.isProcessing||e(m)};return{schedule:x2.reduce((y,x)=>{const w=a[x];return y[x]=(O,S=!1,k=!1)=>(n||g(),w.schedule(O,S,k)),y},{}),cancel:y=>{for(let x=0;x$G[e].some(n=>!!t[n])};function Fqe(e){for(const t in e)Vx[t]={...Vx[t],...e[t]}}const Bqe=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function dN(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||Bqe.has(e)}let Wke=e=>!dN(e);function Kke(e){e&&(Wke=t=>t.startsWith("on")?!dN(t):e(t))}try{Kke(require("@emotion/is-prop-valid").default)}catch{}function Uqe(e,t,n){const i={};for(const r in e)r==="values"&&typeof e.values=="object"||(Wke(r)||n===!0&&dN(r)||!t&&!dN(r)||e.draggable&&r.startsWith("onDrag"))&&(i[r]=e[r]);return i}function Qqe({children:e,isValidProp:t,...n}){t&&Kke(t),n={...p.useContext(LS),...n},n.isStatic=RI(()=>n.isStatic);const i=p.useMemo(()=>n,[JSON.stringify(n.transition),n.transformPagePoint,n.reducedMotion]);return o.jsx(LS.Provider,{value:i,children:e})}function zqe(e){if(typeof Proxy>"u")return e;const t=new Map,n=(...i)=>e(...i);return new Proxy(n,{get:(i,r)=>r==="create"?e:(t.has(r)||t.set(r,e(r)),t.get(r))})}const PI=p.createContext({});function $S(e){return typeof e=="string"||Array.isArray(e)}function DI(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}const U7=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Q7=["initial",...U7];function MI(e){return DI(e.animate)||Q7.some(t=>$S(e[t]))}function Gke(e){return!!(MI(e)||e.variants)}function Vqe(e,t){if(MI(e)){const{initial:n,animate:i}=e;return{initial:n===!1||$S(n)?n:void 0,animate:$S(i)?i:void 0}}return e.inherit!==!1?t:{}}function Hqe(e){const{initial:t,animate:n}=Vqe(e,p.useContext(PI));return p.useMemo(()=>({initial:t,animate:n}),[FG(t),FG(n)])}function FG(e){return Array.isArray(e)?e.join(" "):e}const qqe=Symbol.for("motionComponentSymbol");function Nv(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function Wqe(e,t,n){return p.useCallback(i=>{i&&e.onMount&&e.onMount(i),t&&(i?t.mount(i):t.unmount()),n&&(typeof n=="function"?n(i):Nv(n)&&(n.current=i))},[t])}const z7=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),Kqe="framerAppearId",Xke="data-"+z7(Kqe),{schedule:V7}=Hke(queueMicrotask,!1),Yke=p.createContext({});function Gqe(e,t,n,i,r){var s,a;const{visualElement:l}=p.useContext(PI),c=p.useContext(qke),u=p.useContext(II),d=p.useContext(LS).reducedMotion,f=p.useRef(null);i=i||c.renderer,!f.current&&i&&(f.current=i(e,{visualState:t,parent:l,props:n,presenceContext:u,blockInitialAnimation:u?u.initial===!1:!1,reducedMotionConfig:d}));const h=f.current,m=p.useContext(Yke);h&&!h.projection&&r&&(h.type==="html"||h.type==="svg")&&Xqe(f.current,n,r,m);const g=p.useRef(!1);p.useInsertionEffect(()=>{h&&g.current&&h.update(n,u)});const b=n[Xke],v=p.useRef(!!b&&!(!((s=window.MotionHandoffIsComplete)===null||s===void 0)&&s.call(window,b))&&((a=window.MotionHasOptimisedAnimation)===null||a===void 0?void 0:a.call(window,b)));return zke(()=>{h&&(g.current=!0,window.MotionIsMounted=!0,h.updateFeatures(),V7.render(h.render),v.current&&h.animationState&&h.animationState.animateChanges())}),p.useEffect(()=>{h&&(!v.current&&h.animationState&&h.animationState.animateChanges(),v.current&&(queueMicrotask(()=>{var y;(y=window.MotionHandoffMarkAsComplete)===null||y===void 0||y.call(window,b)}),v.current=!1))}),h}function Xqe(e,t,n,i){const{layoutId:r,layout:s,drag:a,dragConstraints:l,layoutScroll:c,layoutRoot:u}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:Zke(e.parent)),e.projection.setOptions({layoutId:r,layout:s,alwaysMeasureLayout:!!a||l&&Nv(l),visualElement:e,animationType:typeof s=="string"?s:"both",initialPromotionConfig:i,layoutScroll:c,layoutRoot:u})}function Zke(e){if(e)return e.options.allowProjection!==!1?e.projection:Zke(e.parent)}function Yqe({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:i,Component:r}){var s,a;e&&Fqe(e);function l(u,d){let f;const h={...p.useContext(LS),...u,layoutId:Zqe(u)},{isStatic:m}=h,g=Hqe(u),b=i(u,m);if(!m&&B7){Jqe();const v=eWe(h);f=v.MeasureLayout,g.visualElement=Gqe(r,b,h,t,v.ProjectionNode)}return o.jsxs(PI.Provider,{value:g,children:[f&&g.visualElement?o.jsx(f,{visualElement:g.visualElement,...h}):null,n(r,u,Wqe(b,g.visualElement,d),b,m,g.visualElement)]})}l.displayName=`motion.${typeof r=="string"?r:`create(${(a=(s=r.displayName)!==null&&s!==void 0?s:r.name)!==null&&a!==void 0?a:""})`}`;const c=p.forwardRef(l);return c[qqe]=r,c}function Zqe({layoutId:e}){const t=p.useContext(F7).id;return t&&e!==void 0?t+"-"+e:e}function Jqe(e,t){p.useContext(qke).strict}function eWe(e){const{drag:t,layout:n}=Vx;if(!t&&!n)return{};const i={...t,...n};return{MeasureLayout:t!=null&&t.isEnabled(e)||n!=null&&n.isEnabled(e)?i.MeasureLayout:void 0,ProjectionNode:i.ProjectionNode}}const tWe=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function H7(e){return typeof e!="string"||e.includes("-")?!1:!!(tWe.indexOf(e)>-1||/[A-Z]/u.test(e))}function BG(e){const t=[{},{}];return e==null||e.values.forEach((n,i)=>{t[0][i]=n.get(),t[1][i]=n.getVelocity()}),t}function q7(e,t,n,i){if(typeof t=="function"){const[r,s]=BG(i);t=t(n!==void 0?n:e.custom,r,s)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[r,s]=BG(i);t=t(n!==void 0?n:e.custom,r,s)}return t}const v$=e=>Array.isArray(e),nWe=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),iWe=e=>v$(e)?e[e.length-1]||0:e,sl=e=>!!(e&&e.getVelocity);function j_(e){const t=sl(e)?e.get():e;return nWe(t)?t.toValue():t}function rWe({scrapeMotionValuesFromProps:e,createRenderState:t,onUpdate:n},i,r,s){const a={latestValues:sWe(i,r,s,e),renderState:t()};return n&&(a.onMount=l=>n({props:i,current:l,...a}),a.onUpdate=l=>n(l)),a}const Jke=e=>(t,n)=>{const i=p.useContext(PI),r=p.useContext(II),s=()=>rWe(e,t,i,r);return n?s():RI(s)};function sWe(e,t,n,i){const r={},s=i(e,{});for(const h in s)r[h]=j_(s[h]);let{initial:a,animate:l}=e;const c=MI(e),u=Gke(e);t&&u&&!c&&e.inherit!==!1&&(a===void 0&&(a=t.initial),l===void 0&&(l=t.animate));let d=n?n.initial===!1:!1;d=d||a===!1;const f=d?l:a;if(f&&typeof f!="boolean"&&!DI(f)){const h=Array.isArray(f)?f:[f];for(let m=0;mt=>typeof t=="string"&&t.startsWith(e),tSe=eSe("--"),oWe=eSe("var(--"),W7=e=>oWe(e)?aWe.test(e.split("/*")[0].trim()):!1,aWe=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,nSe=(e,t)=>t&&typeof e=="number"?t.transform(e):e,lp=(e,t,n)=>n>t?t:ntypeof e=="number",parse:parseFloat,transform:e=>e},FS={...$w,transform:e=>lp(0,1,e)},w2={...$w,default:1},yC=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),tm=yC("deg"),jf=yC("%"),Ln=yC("px"),lWe=yC("vh"),cWe=yC("vw"),UG={...jf,parse:e=>jf.parse(e)/100,transform:e=>jf.transform(e*100)},uWe={borderWidth:Ln,borderTopWidth:Ln,borderRightWidth:Ln,borderBottomWidth:Ln,borderLeftWidth:Ln,borderRadius:Ln,radius:Ln,borderTopLeftRadius:Ln,borderTopRightRadius:Ln,borderBottomRightRadius:Ln,borderBottomLeftRadius:Ln,width:Ln,maxWidth:Ln,height:Ln,maxHeight:Ln,top:Ln,right:Ln,bottom:Ln,left:Ln,padding:Ln,paddingTop:Ln,paddingRight:Ln,paddingBottom:Ln,paddingLeft:Ln,margin:Ln,marginTop:Ln,marginRight:Ln,marginBottom:Ln,marginLeft:Ln,backgroundPositionX:Ln,backgroundPositionY:Ln},dWe={rotate:tm,rotateX:tm,rotateY:tm,rotateZ:tm,scale:w2,scaleX:w2,scaleY:w2,scaleZ:w2,skew:tm,skewX:tm,skewY:tm,distance:Ln,translateX:Ln,translateY:Ln,translateZ:Ln,x:Ln,y:Ln,z:Ln,perspective:Ln,transformPerspective:Ln,opacity:FS,originX:UG,originY:UG,originZ:Ln},QG={...$w,transform:Math.round},K7={...uWe,...dWe,zIndex:QG,size:Ln,fillOpacity:FS,strokeOpacity:FS,numOctaves:QG},fWe={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},hWe=Lw.length;function pWe(e,t,n){let i="",r=!0;for(let s=0;s({style:{},transform:{},transformOrigin:{},vars:{}}),iSe=()=>({...Y7(),attrs:{}}),Z7=e=>typeof e=="string"&&e.toLowerCase()==="svg";function rSe(e,{style:t,vars:n},i,r){Object.assign(e.style,t,r&&r.getProjectionStyles(i));for(const s in n)e.style.setProperty(s,n[s])}const sSe=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function oSe(e,t,n,i){rSe(e,t,void 0,i);for(const r in t.attrs)e.setAttribute(sSe.has(r)?r:z7(r),t.attrs[r])}const fN={};function vWe(e){Object.assign(fN,e)}function aSe(e,{layout:t,layoutId:n}){return Hy.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!fN[e]||e==="opacity")}function J7(e,t,n){var i;const{style:r}=e,s={};for(const a in r)(sl(r[a])||t.style&&sl(t.style[a])||aSe(a,e)||((i=n==null?void 0:n.getValue(a))===null||i===void 0?void 0:i.liveStyle)!==void 0)&&(s[a]=r[a]);return s}function lSe(e,t,n){const i=J7(e,t,n);for(const r in e)if(sl(e[r])||sl(t[r])){const s=Lw.indexOf(r)!==-1?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r;i[s]=e[r]}return i}function xWe(e,t){try{t.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{t.dimensions={x:0,y:0,width:0,height:0}}}const VG=["x","y","width","height","cx","cy","r"],wWe={useVisualState:Jke({scrapeMotionValuesFromProps:lSe,createRenderState:iSe,onUpdate:({props:e,prevProps:t,current:n,renderState:i,latestValues:r})=>{if(!n)return;let s=!!e.drag;if(!s){for(const l in r)if(Hy.has(l)){s=!0;break}}if(!s)return;let a=!t;if(t)for(let l=0;l{xWe(n,i),bs.render(()=>{X7(i,r,Z7(n.tagName),e.transformTemplate),oSe(n,i)})})}})},OWe={useVisualState:Jke({scrapeMotionValuesFromProps:J7,createRenderState:Y7})};function cSe(e,t,n){for(const i in t)!sl(t[i])&&!aSe(i,n)&&(e[i]=t[i])}function kWe({transformTemplate:e},t){return p.useMemo(()=>{const n=Y7();return G7(n,t,e),Object.assign({},n.vars,n.style)},[t])}function SWe(e,t){const n=e.style||{},i={};return cSe(i,n,e),Object.assign(i,kWe(e,t)),i}function EWe(e,t){const n={},i=SWe(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=i,n}function CWe(e,t,n,i){const r=p.useMemo(()=>{const s=iSe();return X7(s,t,Z7(i),e.transformTemplate),{...s.attrs,style:{...s.style}}},[t]);if(e.style){const s={};cSe(s,e.style,e),r.style={...s,...r.style}}return r}function TWe(e=!1){return(n,i,r,{latestValues:s},a)=>{const c=(H7(n)?CWe:EWe)(i,s,a,n),u=Uqe(i,typeof n=="string",e),d=n!==p.Fragment?{...u,...c,ref:r}:{},{children:f}=i,h=p.useMemo(()=>sl(f)?f.get():f,[f]);return p.createElement(n,{...d,children:h})}}function AWe(e,t){return function(i,{forwardMotionProps:r}={forwardMotionProps:!1}){const a={...H7(i)?wWe:OWe,preloadedFeatures:e,useRender:TWe(r),createVisualElement:t,Component:i};return Yqe(a)}}function uSe(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let i=0;i(N_===void 0&&Nf.set(ja.isProcessing||Mqe.useManualTiming?ja.timestamp:performance.now()),N_),set:e=>{N_=e,queueMicrotask(_We)}};function tU(e,t){e.indexOf(t)===-1&&e.push(t)}function nU(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class iU{constructor(){this.subscriptions=[]}add(t){return tU(this.subscriptions,t),()=>nU(this.subscriptions,t)}notify(t,n,i){const r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](t,n,i);else for(let s=0;s!isNaN(parseFloat(e));class NWe{constructor(t,n={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(i,r=!0)=>{const s=Nf.now();this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(i),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),r&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=Nf.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=jWe(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new iU);const i=this.events[t].add(n);return t==="change"?()=>{i(),bs.read(()=>{this.events.change.getSize()||this.stop()})}:i}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t,n=!0){!n||!this.passiveEffect?this.updateAndNotify(t,n):this.passiveEffect(t,this.updateAndNotify)}setWithVelocity(t,n,i){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-i}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=Nf.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>HG)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,HG);return fSe(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function BS(e,t){return new NWe(e,t)}function RWe(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,BS(n))}function IWe(e,t){const n=LI(e,t);let{transitionEnd:i={},transition:r={},...s}=n||{};s={...s,...i};for(const a in s){const l=iWe(s[a]);RWe(e,a,l)}}function PWe(e){return!!(sl(e)&&e.add)}function x$(e,t){const n=e.getValue("willChange");if(PWe(n))return n.add(t)}function hSe(e){return e.props[Xke]}function rU(e){let t;return()=>(t===void 0&&(t=e()),t)}const DWe=rU(()=>window.ScrollTimeline!==void 0);class MWe{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map(t=>"finished"in t?t.finished:t))}getAll(t){return this.animations[0][t]}setAll(t,n){for(let i=0;i{if(DWe()&&r.attachTimeline)return r.attachTimeline(t);if(typeof n=="function")return n(r)});return()=>{i.forEach((r,s)=>{r&&r(),this.animations[s].stop()})}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let n=0;nn[t]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class LWe extends MWe{then(t,n){return Promise.all(this.animations).then(t).catch(n)}}const Hh=e=>e*1e3,qh=e=>e/1e3;function sU(e){return typeof e=="function"}function qG(e,t){e.timeline=t,e.onfinish=null}const oU=e=>Array.isArray(e)&&typeof e[0]=="number",$We={linearEasing:void 0};function FWe(e,t){const n=rU(e);return()=>{var i;return(i=$We[t])!==null&&i!==void 0?i:n()}}const hN=FWe(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Hx=(e,t,n)=>{const i=t-e;return i===0?1:(n-e)/i},pSe=(e,t,n=10)=>{let i="";const r=Math.max(Math.round(t/n),2);for(let s=0;s`cubic-bezier(${e}, ${t}, ${n}, ${i})`,w$={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:GO([0,.65,.55,1]),circOut:GO([.55,0,1,.45]),backIn:GO([.31,.01,.66,-.59]),backOut:GO([.33,1.53,.69,.99])};function gSe(e,t){if(e)return typeof e=="function"&&hN()?pSe(e,t):oU(e)?GO(e):Array.isArray(e)?e.map(n=>gSe(n,t)||w$.easeOut):w$[e]}const bSe=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,BWe=1e-7,UWe=12;function QWe(e,t,n,i,r){let s,a,l=0;do a=t+(n-t)/2,s=bSe(a,i,r)-e,s>0?n=a:t=a;while(Math.abs(s)>BWe&&++lQWe(s,0,1,e,n);return s=>s===0||s===1?s:bSe(r(s),t,i)}const ySe=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,vSe=e=>t=>1-e(1-t),xSe=vC(.33,1.53,.69,.99),aU=vSe(xSe),wSe=ySe(aU),OSe=e=>(e*=2)<1?.5*aU(e):.5*(2-Math.pow(2,-10*(e-1))),lU=e=>1-Math.sin(Math.acos(e)),kSe=vSe(lU),SSe=ySe(lU),ESe=e=>/^0[^.\s]+$/u.test(e);function zWe(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||ESe(e):!0}const Mk=e=>Math.round(e*1e5)/1e5,cU=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function VWe(e){return e==null}const HWe=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,uU=(e,t)=>n=>!!(typeof n=="string"&&HWe.test(n)&&n.startsWith(e)||t&&!VWe(n)&&Object.prototype.hasOwnProperty.call(n,t)),CSe=(e,t,n)=>i=>{if(typeof i!="string")return i;const[r,s,a,l]=i.match(cU);return{[e]:parseFloat(r),[t]:parseFloat(s),[n]:parseFloat(a),alpha:l!==void 0?parseFloat(l):1}},qWe=e=>lp(0,255,e),C5={...$w,transform:e=>Math.round(qWe(e))},Pb={test:uU("rgb","red"),parse:CSe("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:i=1})=>"rgba("+C5.transform(e)+", "+C5.transform(t)+", "+C5.transform(n)+", "+Mk(FS.transform(i))+")"};function WWe(e){let t="",n="",i="",r="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),i=e.substring(5,7),r=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),i=e.substring(3,4),r=e.substring(4,5),t+=t,n+=n,i+=i,r+=r),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(i,16),alpha:r?parseInt(r,16)/255:1}}const O$={test:uU("#"),parse:WWe,transform:Pb.transform},Rv={test:uU("hsl","hue"),parse:CSe("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:i=1})=>"hsla("+Math.round(e)+", "+jf.transform(Mk(t))+", "+jf.transform(Mk(n))+", "+Mk(FS.transform(i))+")"},nl={test:e=>Pb.test(e)||O$.test(e)||Rv.test(e),parse:e=>Pb.test(e)?Pb.parse(e):Rv.test(e)?Rv.parse(e):O$.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Pb.transform(e):Rv.transform(e)},KWe=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function GWe(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(cU))===null||t===void 0?void 0:t.length)||0)+(((n=e.match(KWe))===null||n===void 0?void 0:n.length)||0)>0}const TSe="number",ASe="color",XWe="var",YWe="var(",WG="${}",ZWe=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function US(e){const t=e.toString(),n=[],i={color:[],number:[],var:[]},r=[];let s=0;const l=t.replace(ZWe,c=>(nl.test(c)?(i.color.push(s),r.push(ASe),n.push(nl.parse(c))):c.startsWith(YWe)?(i.var.push(s),r.push(XWe),n.push(c)):(i.number.push(s),r.push(TSe),n.push(parseFloat(c))),++s,WG)).split(WG);return{values:n,split:l,indexes:i,types:r}}function _Se(e){return US(e).values}function jSe(e){const{split:t,types:n}=US(e),i=t.length;return r=>{let s="";for(let a=0;atypeof e=="number"?0:e;function eKe(e){const t=_Se(e);return jSe(e)(t.map(JWe))}const ig={test:GWe,parse:_Se,createTransformer:jSe,getAnimatableNone:eKe},tKe=new Set(["brightness","contrast","saturate","opacity"]);function nKe(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[i]=n.match(cU)||[];if(!i)return e;const r=n.replace(i,"");let s=tKe.has(t)?1:0;return i!==n&&(s*=100),t+"("+s+r+")"}const iKe=/\b([a-z-]*)\(.*?\)/gu,k$={...ig,getAnimatableNone:e=>{const t=e.match(iKe);return t?t.map(nKe).join(" "):e}},rKe={...K7,color:nl,backgroundColor:nl,outlineColor:nl,fill:nl,stroke:nl,borderColor:nl,borderTopColor:nl,borderRightColor:nl,borderBottomColor:nl,borderLeftColor:nl,filter:k$,WebkitFilter:k$},dU=e=>rKe[e];function NSe(e,t){let n=dU(e);return n!==k$&&(n=ig),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const sKe=new Set(["auto","none","0"]);function oKe(e,t,n){let i=0,r;for(;ie===$w||e===Ln,GG=(e,t)=>parseFloat(e.split(", ")[t]),XG=(e,t)=>(n,{transform:i})=>{if(i==="none"||!i)return 0;const r=i.match(/^matrix3d\((.+)\)$/u);if(r)return GG(r[1],t);{const s=i.match(/^matrix\((.+)\)$/u);return s?GG(s[1],e):0}},aKe=new Set(["x","y","z"]),lKe=Lw.filter(e=>!aKe.has(e));function cKe(e){const t=[];return lKe.forEach(n=>{const i=e.getValue(n);i!==void 0&&(t.push([n,i.get()]),i.set(n.startsWith("scale")?1:0))}),t}const qx={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:XG(4,13),y:XG(5,14)};qx.translateX=qx.x;qx.translateY=qx.y;const ey=new Set;let S$=!1,E$=!1;function RSe(){if(E$){const e=Array.from(ey).filter(i=>i.needsMeasurement),t=new Set(e.map(i=>i.element)),n=new Map;t.forEach(i=>{const r=cKe(i);r.length&&(n.set(i,r),i.render())}),e.forEach(i=>i.measureInitialState()),t.forEach(i=>{i.render();const r=n.get(i);r&&r.forEach(([s,a])=>{var l;(l=i.getValue(s))===null||l===void 0||l.set(a)})}),e.forEach(i=>i.measureEndState()),e.forEach(i=>{i.suspendedScrollY!==void 0&&window.scrollTo(0,i.suspendedScrollY)})}E$=!1,S$=!1,ey.forEach(e=>e.complete()),ey.clear()}function ISe(){ey.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(E$=!0)})}function uKe(){ISe(),RSe()}class fU{constructor(t,n,i,r,s,a=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=i,this.motionValue=r,this.element=s,this.isAsync=a}scheduleResolve(){this.isScheduled=!0,this.isAsync?(ey.add(this),S$||(S$=!0,bs.read(ISe),bs.resolveKeyframes(RSe))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:i,motionValue:r}=this;for(let s=0;s/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),dKe=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function fKe(e){const t=dKe.exec(e);if(!t)return[,];const[,n,i,r]=t;return[`--${n??i}`,r]}function DSe(e,t,n=1){const[i,r]=fKe(e);if(!i)return;const s=window.getComputedStyle(t).getPropertyValue(i);if(s){const a=s.trim();return PSe(a)?parseFloat(a):a}return W7(r)?DSe(r,t,n+1):r}const MSe=e=>t=>t.test(e),hKe={test:e=>e==="auto",parse:e=>e},LSe=[$w,Ln,jf,tm,cWe,lWe,hKe],YG=e=>LSe.find(MSe(e));class $Se extends fU{constructor(t,n,i,r,s){super(t,n,i,r,s,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:i}=this;if(!n||!n.current)return;super.readKeyframes();for(let c=0;c{n.getValue(c).set(u)}),this.resolveNoneKeyframes()}}const ZG=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(ig.test(e)||e==="0")&&!e.startsWith("url("));function pKe(e){const t=e[0];if(e.length===1)return!0;for(let n=0;ne!==null;function $I(e,{repeat:t,repeatType:n="loop"},i){const r=e.filter(gKe),s=t&&n!=="loop"&&t%2===1?0:r.length-1;return!s||i===void 0?r[s]:i}const bKe=40;class FSe{constructor({autoplay:t=!0,delay:n=0,type:i="keyframes",repeat:r=0,repeatDelay:s=0,repeatType:a="loop",...l}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=Nf.now(),this.options={autoplay:t,delay:n,type:i,repeat:r,repeatDelay:s,repeatType:a,...l},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>bKe?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&uKe(),this._resolved}onKeyframesResolved(t,n){this.resolvedAt=Nf.now(),this.hasAttemptedResolve=!0;const{name:i,type:r,velocity:s,delay:a,onComplete:l,onUpdate:c,isGenerator:u}=this.options;if(!u&&!mKe(t,i,r,s))if(a)this.options.duration=0;else{c&&c($I(t,this.options,n)),l&&l(),this.resolveFinishedPromise();return}const d=this.initPlayback(t,n);d!==!1&&(this._resolved={keyframes:t,finalKeyframe:n,...d},this.onPostResolved())}onPostResolved(){}then(t,n){return this.currentFinishedPromise.then(t,n)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(t=>{this.resolveFinishedPromise=t})}}const C$=2e4;function BSe(e){let t=0;const n=50;let i=e.next(t);for(;!i.done&&t=C$?1/0:t}const Fs=(e,t,n)=>e+(t-e)*n;function T5(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function yKe({hue:e,saturation:t,lightness:n,alpha:i}){e/=360,t/=100,n/=100;let r=0,s=0,a=0;if(!t)r=s=a=n;else{const l=n<.5?n*(1+t):n+t-n*t,c=2*n-l;r=T5(c,l,e+1/3),s=T5(c,l,e),a=T5(c,l,e-1/3)}return{red:Math.round(r*255),green:Math.round(s*255),blue:Math.round(a*255),alpha:i}}function pN(e,t){return n=>n>0?t:e}const A5=(e,t,n)=>{const i=e*e,r=n*(t*t-i)+i;return r<0?0:Math.sqrt(r)},vKe=[O$,Pb,Rv],xKe=e=>vKe.find(t=>t.test(e));function JG(e){const t=xKe(e);if(!t)return!1;let n=t.parse(e);return t===Rv&&(n=yKe(n)),n}const eX=(e,t)=>{const n=JG(e),i=JG(t);if(!n||!i)return pN(e,t);const r={...n};return s=>(r.red=A5(n.red,i.red,s),r.green=A5(n.green,i.green,s),r.blue=A5(n.blue,i.blue,s),r.alpha=Fs(n.alpha,i.alpha,s),Pb.transform(r))},wKe=(e,t)=>n=>t(e(n)),xC=(...e)=>e.reduce(wKe),T$=new Set(["none","hidden"]);function OKe(e,t){return T$.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function kKe(e,t){return n=>Fs(e,t,n)}function hU(e){return typeof e=="number"?kKe:typeof e=="string"?W7(e)?pN:nl.test(e)?eX:CKe:Array.isArray(e)?USe:typeof e=="object"?nl.test(e)?eX:SKe:pN}function USe(e,t){const n=[...e],i=n.length,r=e.map((s,a)=>hU(s)(s,t[a]));return s=>{for(let a=0;a{for(const s in i)n[s]=i[s](r);return n}}function EKe(e,t){var n;const i=[],r={color:0,var:0,number:0};for(let s=0;s{const n=ig.createTransformer(t),i=US(e),r=US(t);return i.indexes.var.length===r.indexes.var.length&&i.indexes.color.length===r.indexes.color.length&&i.indexes.number.length>=r.indexes.number.length?T$.has(e)&&!r.values.length||T$.has(t)&&!i.values.length?OKe(e,t):xC(USe(EKe(i,r),r.values),n):pN(e,t)};function QSe(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?Fs(e,t,n):hU(e)(e,t)}const TKe=5;function zSe(e,t,n){const i=Math.max(t-TKe,0);return fSe(n-e(i),t-i)}const Ws={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},_5=.001;function AKe({duration:e=Ws.duration,bounce:t=Ws.bounce,velocity:n=Ws.velocity,mass:i=Ws.mass}){let r,s,a=1-t;a=lp(Ws.minDamping,Ws.maxDamping,a),e=lp(Ws.minDuration,Ws.maxDuration,qh(e)),a<1?(r=u=>{const d=u*a,f=d*e,h=d-n,m=A$(u,a),g=Math.exp(-f);return _5-h/m*g},s=u=>{const f=u*a*e,h=f*n+n,m=Math.pow(a,2)*Math.pow(u,2)*e,g=Math.exp(-f),b=A$(Math.pow(u,2),a);return(-r(u)+_5>0?-1:1)*((h-m)*g)/b}):(r=u=>{const d=Math.exp(-u*e),f=(u-n)*e+1;return-_5+d*f},s=u=>{const d=Math.exp(-u*e),f=(n-u)*(e*e);return d*f});const l=5/e,c=jKe(r,s,l);if(e=Hh(e),isNaN(c))return{stiffness:Ws.stiffness,damping:Ws.damping,duration:e};{const u=Math.pow(c,2)*i;return{stiffness:u,damping:a*2*Math.sqrt(i*u),duration:e}}}const _Ke=12;function jKe(e,t,n){let i=n;for(let r=1;r<_Ke;r++)i=i-e(i)/t(i);return i}function A$(e,t){return e*Math.sqrt(1-t*t)}const NKe=["duration","bounce"],RKe=["stiffness","damping","mass"];function tX(e,t){return t.some(n=>e[n]!==void 0)}function IKe(e){let t={velocity:Ws.velocity,stiffness:Ws.stiffness,damping:Ws.damping,mass:Ws.mass,isResolvedFromDuration:!1,...e};if(!tX(e,RKe)&&tX(e,NKe))if(e.visualDuration){const n=e.visualDuration,i=2*Math.PI/(n*1.2),r=i*i,s=2*lp(.05,1,1-(e.bounce||0))*Math.sqrt(r);t={...t,mass:Ws.mass,stiffness:r,damping:s}}else{const n=AKe(e);t={...t,...n,mass:Ws.mass},t.isResolvedFromDuration=!0}return t}function VSe(e=Ws.visualDuration,t=Ws.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:i,restDelta:r}=n;const s=n.keyframes[0],a=n.keyframes[n.keyframes.length-1],l={done:!1,value:s},{stiffness:c,damping:u,mass:d,duration:f,velocity:h,isResolvedFromDuration:m}=IKe({...n,velocity:-qh(n.velocity||0)}),g=h||0,b=u/(2*Math.sqrt(c*d)),v=a-s,y=qh(Math.sqrt(c/d)),x=Math.abs(v)<5;i||(i=x?Ws.restSpeed.granular:Ws.restSpeed.default),r||(r=x?Ws.restDelta.granular:Ws.restDelta.default);let w;if(b<1){const S=A$(y,b);w=k=>{const C=Math.exp(-b*y*k);return a-C*((g+b*y*v)/S*Math.sin(S*k)+v*Math.cos(S*k))}}else if(b===1)w=S=>a-Math.exp(-y*S)*(v+(g+y*v)*S);else{const S=y*Math.sqrt(b*b-1);w=k=>{const C=Math.exp(-b*y*k),E=Math.min(S*k,300);return a-C*((g+b*y*v)*Math.sinh(E)+S*v*Math.cosh(E))/S}}const O={calculatedDuration:m&&f||null,next:S=>{const k=w(S);if(m)l.done=S>=f;else{let C=0;b<1&&(C=S===0?Hh(g):zSe(w,S,k));const E=Math.abs(C)<=i,N=Math.abs(a-k)<=r;l.done=E&&N}return l.value=l.done?a:k,l},toString:()=>{const S=Math.min(BSe(O),C$),k=pSe(C=>O.next(S*C).value,S,30);return S+"ms "+k}};return O}function nX({keyframes:e,velocity:t=0,power:n=.8,timeConstant:i=325,bounceDamping:r=10,bounceStiffness:s=500,modifyTarget:a,min:l,max:c,restDelta:u=.5,restSpeed:d}){const f=e[0],h={done:!1,value:f},m=E=>l!==void 0&&Ec,g=E=>l===void 0?c:c===void 0||Math.abs(l-E)-b*Math.exp(-E/i),w=E=>y+x(E),O=E=>{const N=x(E),A=w(E);h.done=Math.abs(N)<=u,h.value=h.done?y:A};let S,k;const C=E=>{m(h.value)&&(S=E,k=VSe({keyframes:[h.value,g(h.value)],velocity:zSe(w,E,h.value),damping:r,stiffness:s,restDelta:u,restSpeed:d}))};return C(0),{calculatedDuration:null,next:E=>{let N=!1;return!k&&S===void 0&&(N=!0,O(E),C(E)),S!==void 0&&E>=S?k.next(E-S):(!N&&O(E),h)}}}const PKe=vC(.42,0,1,1),DKe=vC(0,0,.58,1),HSe=vC(.42,0,.58,1),MKe=e=>Array.isArray(e)&&typeof e[0]!="number",LKe={linear:tu,easeIn:PKe,easeInOut:HSe,easeOut:DKe,circIn:lU,circInOut:SSe,circOut:kSe,backIn:aU,backInOut:wSe,backOut:xSe,anticipate:OSe},iX=e=>{if(oU(e)){Vke(e.length===4);const[t,n,i,r]=e;return vC(t,n,i,r)}else if(typeof e=="string")return LKe[e];return e};function $Ke(e,t,n){const i=[],r=n||QSe,s=e.length-1;for(let a=0;at[0];if(s===2&&t[0]===t[1])return()=>t[1];const a=e[0]===e[1];e[0]>e[s-1]&&(e=[...e].reverse(),t=[...t].reverse());const l=$Ke(t,i,r),c=l.length,u=d=>{if(a&&d1)for(;fu(lp(e[0],e[s-1],d)):u}function BKe(e,t){const n=e[e.length-1];for(let i=1;i<=t;i++){const r=Hx(0,t,i);e.push(Fs(n,1,r))}}function UKe(e){const t=[0];return BKe(t,e.length-1),t}function QKe(e,t){return e.map(n=>n*t)}function zKe(e,t){return e.map(()=>t||HSe).splice(0,e.length-1)}function mN({duration:e=300,keyframes:t,times:n,ease:i="easeInOut"}){const r=MKe(i)?i.map(iX):iX(i),s={done:!1,value:t[0]},a=QKe(n&&n.length===t.length?n:UKe(t),e),l=FKe(a,t,{ease:Array.isArray(r)?r:zKe(t,r)});return{calculatedDuration:e,next:c=>(s.value=l(c),s.done=c>=e,s)}}const VKe=e=>{const t=({timestamp:n})=>e(n);return{start:()=>bs.update(t,!0),stop:()=>ng(t),now:()=>ja.isProcessing?ja.timestamp:Nf.now()}},HKe={decay:nX,inertia:nX,tween:mN,keyframes:mN,spring:VSe},qKe=e=>e/100;class pU extends FSe{constructor(t){super(t),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:c}=this.options;c&&c()};const{name:n,motionValue:i,element:r,keyframes:s}=this.options,a=(r==null?void 0:r.KeyframeResolver)||fU,l=(c,u)=>this.onKeyframesResolved(c,u);this.resolver=new a(s,l,n,i,r),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(t){const{type:n="keyframes",repeat:i=0,repeatDelay:r=0,repeatType:s,velocity:a=0}=this.options,l=sU(n)?n:HKe[n]||mN;let c,u;l!==mN&&typeof t[0]!="number"&&(c=xC(qKe,QSe(t[0],t[1])),t=[0,100]);const d=l({...this.options,keyframes:t});s==="mirror"&&(u=l({...this.options,keyframes:[...t].reverse(),velocity:-a})),d.calculatedDuration===null&&(d.calculatedDuration=BSe(d));const{calculatedDuration:f}=d,h=f+r,m=h*(i+1)-r;return{generator:d,mirroredGenerator:u,mapPercentToKeyframes:c,calculatedDuration:f,resolvedDuration:h,totalDuration:m}}onPostResolved(){const{autoplay:t=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!t?this.pause():this.state=this.pendingPlayState}tick(t,n=!1){const{resolved:i}=this;if(!i){const{keyframes:E}=this.options;return{done:!0,value:E[E.length-1]}}const{finalKeyframe:r,generator:s,mirroredGenerator:a,mapPercentToKeyframes:l,keyframes:c,calculatedDuration:u,totalDuration:d,resolvedDuration:f}=i;if(this.startTime===null)return s.next(0);const{delay:h,repeat:m,repeatType:g,repeatDelay:b,onUpdate:v}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-d/this.speed,this.startTime)),n?this.currentTime=t:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(t-this.startTime)*this.speed;const y=this.currentTime-h*(this.speed>=0?1:-1),x=this.speed>=0?y<0:y>d;this.currentTime=Math.max(y,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=d);let w=this.currentTime,O=s;if(m){const E=Math.min(this.currentTime,d)/f;let N=Math.floor(E),A=E%1;!A&&E>=1&&(A=1),A===1&&N--,N=Math.min(N,m+1),!!(N%2)&&(g==="reverse"?(A=1-A,b&&(A-=b/f)):g==="mirror"&&(O=a)),w=lp(0,1,A)*f}const S=x?{done:!1,value:c[0]}:O.next(w);l&&(S.value=l(S.value));let{done:k}=S;!x&&u!==null&&(k=this.speed>=0?this.currentTime>=d:this.currentTime<=0);const C=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&k);return C&&r!==void 0&&(S.value=$I(c,this.options,r)),v&&v(S.value),C&&this.finish(),S}get duration(){const{resolved:t}=this;return t?qh(t.calculatedDuration):0}get time(){return qh(this.currentTime)}set time(t){t=Hh(t),this.currentTime=t,this.holdTime!==null||this.speed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.speed)}get speed(){return this.playbackSpeed}set speed(t){const n=this.playbackSpeed!==t;this.playbackSpeed=t,n&&(this.time=qh(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:t=VKe,onPlay:n,startTime:i}=this.options;this.driver||(this.driver=t(s=>this.tick(s))),n&&n();const r=this.driver.now();this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=r):this.startTime=i??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var t;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(t=this.currentTime)!==null&&t!==void 0?t:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:t}=this.options;t&&t()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}}const WKe=new Set(["opacity","clipPath","filter","transform"]);function KKe(e,t,n,{delay:i=0,duration:r=300,repeat:s=0,repeatType:a="loop",ease:l="easeInOut",times:c}={}){const u={[t]:n};c&&(u.offset=c);const d=gSe(l,r);return Array.isArray(d)&&(u.easing=d),e.animate(u,{delay:i,duration:r,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:s+1,direction:a==="reverse"?"alternate":"normal"})}const GKe=rU(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),gN=10,XKe=2e4;function YKe(e){return sU(e.type)||e.type==="spring"||!mSe(e.ease)}function ZKe(e,t){const n=new pU({...t,keyframes:e,repeat:0,delay:0,isGenerator:!0});let i={done:!1,value:e[0]};const r=[];let s=0;for(;!i.done&&sthis.onKeyframesResolved(a,l),n,i,r),this.resolver.scheduleResolve()}initPlayback(t,n){let{duration:i=300,times:r,ease:s,type:a,motionValue:l,name:c,startTime:u}=this.options;if(!l.owner||!l.owner.current)return!1;if(typeof s=="string"&&hN()&&JKe(s)&&(s=qSe[s]),YKe(this.options)){const{onComplete:f,onUpdate:h,motionValue:m,element:g,...b}=this.options,v=ZKe(t,b);t=v.keyframes,t.length===1&&(t[1]=t[0]),i=v.duration,r=v.times,s=v.ease,a="keyframes"}const d=KKe(l.owner.current,c,t,{...this.options,duration:i,times:r,ease:s});return d.startTime=u??this.calcStartTime(),this.pendingTimeline?(qG(d,this.pendingTimeline),this.pendingTimeline=void 0):d.onfinish=()=>{const{onComplete:f}=this.options;l.set($I(t,this.options,n)),f&&f(),this.cancel(),this.resolveFinishedPromise()},{animation:d,duration:i,times:r,type:a,ease:s,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:n}=t;return qh(n)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:n}=t;return qh(n.currentTime||0)}set time(t){const{resolved:n}=this;if(!n)return;const{animation:i}=n;i.currentTime=Hh(t)}get speed(){const{resolved:t}=this;if(!t)return 1;const{animation:n}=t;return n.playbackRate}set speed(t){const{resolved:n}=this;if(!n)return;const{animation:i}=n;i.playbackRate=t}get state(){const{resolved:t}=this;if(!t)return"idle";const{animation:n}=t;return n.playState}get startTime(){const{resolved:t}=this;if(!t)return null;const{animation:n}=t;return n.startTime}attachTimeline(t){if(!this._resolved)this.pendingTimeline=t;else{const{resolved:n}=this;if(!n)return tu;const{animation:i}=n;qG(i,t)}return tu}play(){if(this.isStopped)return;const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.playState==="finished"&&this.updateFinishedPromise(),n.play()}pause(){const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:t}=this;if(!t)return;const{animation:n,keyframes:i,duration:r,type:s,ease:a,times:l}=t;if(n.playState==="idle"||n.playState==="finished")return;if(this.time){const{motionValue:u,onUpdate:d,onComplete:f,element:h,...m}=this.options,g=new pU({...m,keyframes:i,duration:r,type:s,ease:a,times:l,isGenerator:!0}),b=Hh(this.time);u.setWithVelocity(g.sample(b-gN).value,g.sample(b).value,gN)}const{onStop:c}=this.options;c&&c(),this.cancel()}complete(){const{resolved:t}=this;t&&t.animation.finish()}cancel(){const{resolved:t}=this;t&&t.animation.cancel()}static supports(t){const{motionValue:n,name:i,repeatDelay:r,repeatType:s,damping:a,type:l}=t;if(!n||!n.owner||!(n.owner.current instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:u}=n.owner.getProps();return GKe()&&i&&WKe.has(i)&&!c&&!u&&!r&&s!=="mirror"&&a!==0&&l!=="inertia"}}const eGe={type:"spring",stiffness:500,damping:25,restSpeed:10},tGe=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),nGe={type:"keyframes",duration:.8},iGe={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},rGe=(e,{keyframes:t})=>t.length>2?nGe:Hy.has(e)?e.startsWith("scale")?tGe(t[1]):eGe:iGe;function sGe({when:e,delay:t,delayChildren:n,staggerChildren:i,staggerDirection:r,repeat:s,repeatType:a,repeatDelay:l,from:c,elapsed:u,...d}){return!!Object.keys(d).length}const mU=(e,t,n,i={},r,s)=>a=>{const l=eU(i,e)||{},c=l.delay||i.delay||0;let{elapsed:u=0}=i;u=u-Hh(c);let d={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...l,delay:-u,onUpdate:h=>{t.set(h),l.onUpdate&&l.onUpdate(h)},onComplete:()=>{a(),l.onComplete&&l.onComplete()},name:e,motionValue:t,element:s?void 0:r};sGe(l)||(d={...d,...rGe(e,d)}),d.duration&&(d.duration=Hh(d.duration)),d.repeatDelay&&(d.repeatDelay=Hh(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let f=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(d.duration=0,d.delay===0&&(f=!0)),f&&!s&&t.get()!==void 0){const h=$I(d.keyframes,l);if(h!==void 0)return bs.update(()=>{d.onUpdate(h),d.onComplete()}),new LWe([])}return!s&&rX.supports(d)?new rX(d):new pU(d)};function oGe({protectedKeys:e,needsAnimating:t},n){const i=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,i}function WSe(e,t,{delay:n=0,transitionOverride:i,type:r}={}){var s;let{transition:a=e.getDefaultTransition(),transitionEnd:l,...c}=t;i&&(a=i);const u=[],d=r&&e.animationState&&e.animationState.getState()[r];for(const f in c){const h=e.getValue(f,(s=e.latestValues[f])!==null&&s!==void 0?s:null),m=c[f];if(m===void 0||d&&oGe(d,f))continue;const g={delay:n,...eU(a||{},f)};let b=!1;if(window.MotionHandoffAnimation){const y=hSe(e);if(y){const x=window.MotionHandoffAnimation(y,f,bs);x!==null&&(g.startTime=x,b=!0)}}x$(e,f),h.start(mU(f,h,m,e.shouldReduceMotion&&dSe.has(f)?{type:!1}:g,e,b));const v=h.animation;v&&u.push(v)}return l&&Promise.all(u).then(()=>{bs.update(()=>{l&&IWe(e,l)})}),u}function _$(e,t,n={}){var i;const r=LI(e,t,n.type==="exit"?(i=e.presenceContext)===null||i===void 0?void 0:i.custom:void 0);let{transition:s=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(s=n.transitionOverride);const a=r?()=>Promise.all(WSe(e,r,n)):()=>Promise.resolve(),l=e.variantChildren&&e.variantChildren.size?(u=0)=>{const{delayChildren:d=0,staggerChildren:f,staggerDirection:h}=s;return aGe(e,t,d+u,f,h,n)}:()=>Promise.resolve(),{when:c}=s;if(c){const[u,d]=c==="beforeChildren"?[a,l]:[l,a];return u().then(()=>d())}else return Promise.all([a(),l(n.delay)])}function aGe(e,t,n=0,i=0,r=1,s){const a=[],l=(e.variantChildren.size-1)*i,c=r===1?(u=0)=>u*i:(u=0)=>l-u*i;return Array.from(e.variantChildren).sort(lGe).forEach((u,d)=>{u.notify("AnimationStart",t),a.push(_$(u,t,{...s,delay:n+c(d)}).then(()=>u.notify("AnimationComplete",t)))}),Promise.all(a)}function lGe(e,t){return e.sortNodePosition(t)}function cGe(e,t,n={}){e.notify("AnimationStart",t);let i;if(Array.isArray(t)){const r=t.map(s=>_$(e,s,n));i=Promise.all(r)}else if(typeof t=="string")i=_$(e,t,n);else{const r=typeof t=="function"?LI(e,t,n.custom):t;i=Promise.all(WSe(e,r,n))}return i.then(()=>{e.notify("AnimationComplete",t)})}const uGe=Q7.length;function KSe(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?KSe(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;nPromise.all(t.map(({animation:n,options:i})=>cGe(e,n,i)))}function pGe(e){let t=hGe(e),n=sX(),i=!0;const r=c=>(u,d)=>{var f;const h=LI(e,d,c==="exit"?(f=e.presenceContext)===null||f===void 0?void 0:f.custom:void 0);if(h){const{transition:m,transitionEnd:g,...b}=h;u={...u,...b,...g}}return u};function s(c){t=c(e)}function a(c){const{props:u}=e,d=KSe(e.parent)||{},f=[],h=new Set;let m={},g=1/0;for(let v=0;vg&&O,N=!1;const A=Array.isArray(w)?w:[w];let j=A.reduce(r(y),{});S===!1&&(j={});const{prevResolvedValues:T={}}=x,R={...T,...j},_=P=>{E=!0,h.has(P)&&(N=!0,h.delete(P)),x.needsAnimating[P]=!0;const L=e.getValue(P);L&&(L.liveStyle=!1)};for(const P in R){const L=j[P],F=T[P];if(m.hasOwnProperty(P))continue;let I=!1;v$(L)&&v$(F)?I=!uSe(L,F):I=L!==F,I?L!=null?_(P):h.add(P):L!==void 0&&h.has(P)?_(P):x.protectedKeys[P]=!0}x.prevProp=w,x.prevResolvedValues=j,x.isActive&&(m={...m,...j}),i&&e.blockInitialAnimation&&(E=!1),E&&(!(k&&C)||N)&&f.push(...A.map(P=>({animation:P,options:{type:y}})))}if(h.size){const v={};h.forEach(y=>{const x=e.getBaseTarget(y),w=e.getValue(y);w&&(w.liveStyle=!0),v[y]=x??null}),f.push({animation:v})}let b=!!f.length;return i&&(u.initial===!1||u.initial===u.animate)&&!e.manuallyAnimateOnMount&&(b=!1),i=!1,b?t(f):Promise.resolve()}function l(c,u){var d;if(n[c].isActive===u)return Promise.resolve();(d=e.variantChildren)===null||d===void 0||d.forEach(h=>{var m;return(m=h.animationState)===null||m===void 0?void 0:m.setActive(c,u)}),n[c].isActive=u;const f=a(c);for(const h in n)n[h].protectedKeys={};return f}return{animateChanges:a,setActive:l,setAnimateFunction:s,getState:()=>n,reset:()=>{n=sX(),i=!0}}}function mGe(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!uSe(t,e):!1}function Jg(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function sX(){return{animate:Jg(!0),whileInView:Jg(),whileHover:Jg(),whileTap:Jg(),whileDrag:Jg(),whileFocus:Jg(),exit:Jg()}}class Ag{constructor(t){this.isMounted=!1,this.node=t}update(){}}class gGe extends Ag{constructor(t){super(t),t.animationState||(t.animationState=pGe(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();DI(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)===null||t===void 0||t.call(this)}}let bGe=0;class yGe extends Ag{constructor(){super(...arguments),this.id=bGe++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===i)return;const r=this.node.animationState.setActive("exit",!t);n&&!t&&r.then(()=>n(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}const vGe={animation:{Feature:gGe},exit:{Feature:yGe}},pd={x:!1,y:!1};function GSe(){return pd.x||pd.y}function xGe(e){return e==="x"||e==="y"?pd[e]?null:(pd[e]=!0,()=>{pd[e]=!1}):pd.x||pd.y?null:(pd.x=pd.y=!0,()=>{pd.x=pd.y=!1})}const gU=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1;function QS(e,t,n,i={passive:!0}){return e.addEventListener(t,n,i),()=>e.removeEventListener(t,n)}function wC(e){return{point:{x:e.pageX,y:e.pageY}}}const wGe=e=>t=>gU(t)&&e(t,wC(t));function Lk(e,t,n,i){return QS(e,t,wGe(n),i)}const oX=(e,t)=>Math.abs(e-t);function OGe(e,t){const n=oX(e.x,t.x),i=oX(e.y,t.y);return Math.sqrt(n**2+i**2)}class XSe{constructor(t,n,{transformPagePoint:i,contextWindow:r,dragSnapToOrigin:s=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const f=N5(this.lastMoveEventInfo,this.history),h=this.startEvent!==null,m=OGe(f.offset,{x:0,y:0})>=3;if(!h&&!m)return;const{point:g}=f,{timestamp:b}=ja;this.history.push({...g,timestamp:b});const{onStart:v,onMove:y}=this.handlers;h||(v&&v(this.lastMoveEvent,f),this.startEvent=this.lastMoveEvent),y&&y(this.lastMoveEvent,f)},this.handlePointerMove=(f,h)=>{this.lastMoveEvent=f,this.lastMoveEventInfo=j5(h,this.transformPagePoint),bs.update(this.updatePoint,!0)},this.handlePointerUp=(f,h)=>{this.end();const{onEnd:m,onSessionEnd:g,resumeAnimation:b}=this.handlers;if(this.dragSnapToOrigin&&b&&b(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const v=N5(f.type==="pointercancel"?this.lastMoveEventInfo:j5(h,this.transformPagePoint),this.history);this.startEvent&&m&&m(f,v),g&&g(f,v)},!gU(t))return;this.dragSnapToOrigin=s,this.handlers=n,this.transformPagePoint=i,this.contextWindow=r||window;const a=wC(t),l=j5(a,this.transformPagePoint),{point:c}=l,{timestamp:u}=ja;this.history=[{...c,timestamp:u}];const{onSessionStart:d}=n;d&&d(t,N5(l,this.history)),this.removeListeners=xC(Lk(this.contextWindow,"pointermove",this.handlePointerMove),Lk(this.contextWindow,"pointerup",this.handlePointerUp),Lk(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),ng(this.updatePoint)}}function j5(e,t){return t?{point:t(e.point)}:e}function aX(e,t){return{x:e.x-t.x,y:e.y-t.y}}function N5({point:e},t){return{point:e,delta:aX(e,YSe(t)),offset:aX(e,kGe(t)),velocity:SGe(t,.1)}}function kGe(e){return e[0]}function YSe(e){return e[e.length-1]}function SGe(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,i=null;const r=YSe(e);for(;n>=0&&(i=e[n],!(r.timestamp-i.timestamp>Hh(t)));)n--;if(!i)return{x:0,y:0};const s=qh(r.timestamp-i.timestamp);if(s===0)return{x:0,y:0};const a={x:(r.x-i.x)/s,y:(r.y-i.y)/s};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}const ZSe=1e-4,EGe=1-ZSe,CGe=1+ZSe,JSe=.01,TGe=0-JSe,AGe=0+JSe;function cu(e){return e.max-e.min}function _Ge(e,t,n){return Math.abs(e-t)<=n}function lX(e,t,n,i=.5){e.origin=i,e.originPoint=Fs(t.min,t.max,e.origin),e.scale=cu(n)/cu(t),e.translate=Fs(n.min,n.max,e.origin)-e.originPoint,(e.scale>=EGe&&e.scale<=CGe||isNaN(e.scale))&&(e.scale=1),(e.translate>=TGe&&e.translate<=AGe||isNaN(e.translate))&&(e.translate=0)}function $k(e,t,n,i){lX(e.x,t.x,n.x,i?i.originX:void 0),lX(e.y,t.y,n.y,i?i.originY:void 0)}function cX(e,t,n){e.min=n.min+t.min,e.max=e.min+cu(t)}function jGe(e,t,n){cX(e.x,t.x,n.x),cX(e.y,t.y,n.y)}function uX(e,t,n){e.min=t.min-n.min,e.max=e.min+cu(t)}function Fk(e,t,n){uX(e.x,t.x,n.x),uX(e.y,t.y,n.y)}function NGe(e,{min:t,max:n},i){return t!==void 0&&en&&(e=i?Fs(n,e,i.max):Math.min(e,n)),e}function dX(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function RGe(e,{top:t,left:n,bottom:i,right:r}){return{x:dX(e.x,n,r),y:dX(e.y,t,i)}}function fX(e,t){let n=t.min-e.min,i=t.max-e.max;return t.max-t.mini?n=Hx(t.min,t.max-i,e.min):i>r&&(n=Hx(e.min,e.max-r,t.min)),lp(0,1,n)}function DGe(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const j$=.35;function MGe(e=j$){return e===!1?e=0:e===!0&&(e=j$),{x:hX(e,"left","right"),y:hX(e,"top","bottom")}}function hX(e,t,n){return{min:pX(e,t),max:pX(e,n)}}function pX(e,t){return typeof e=="number"?e:e[t]||0}const mX=()=>({translate:0,scale:1,origin:0,originPoint:0}),Iv=()=>({x:mX(),y:mX()}),gX=()=>({min:0,max:0}),ao=()=>({x:gX(),y:gX()});function wu(e){return[e("x"),e("y")]}function eEe({top:e,left:t,right:n,bottom:i}){return{x:{min:t,max:n},y:{min:e,max:i}}}function LGe({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function $Ge(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),i=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:i.y,right:i.x}}function R5(e){return e===void 0||e===1}function N$({scale:e,scaleX:t,scaleY:n}){return!R5(e)||!R5(t)||!R5(n)}function gb(e){return N$(e)||tEe(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function tEe(e){return bX(e.x)||bX(e.y)}function bX(e){return e&&e!=="0%"}function bN(e,t,n){const i=e-n,r=t*i;return n+r}function yX(e,t,n,i,r){return r!==void 0&&(e=bN(e,r,i)),bN(e,n,i)+t}function R$(e,t=0,n=1,i,r){e.min=yX(e.min,t,n,i,r),e.max=yX(e.max,t,n,i,r)}function nEe(e,{x:t,y:n}){R$(e.x,t.translate,t.scale,t.originPoint),R$(e.y,n.translate,n.scale,n.originPoint)}const vX=.999999999999,xX=1.0000000000001;function FGe(e,t,n,i=!1){const r=n.length;if(!r)return;t.x=t.y=1;let s,a;for(let l=0;lvX&&(t.x=1),t.yvX&&(t.y=1)}function Pv(e,t){e.min=e.min+t,e.max=e.max+t}function wX(e,t,n,i,r=.5){const s=Fs(e.min,e.max,r);R$(e,t,n,s,i)}function Dv(e,t){wX(e.x,t.x,t.scaleX,t.scale,t.originX),wX(e.y,t.y,t.scaleY,t.scale,t.originY)}function iEe(e,t){return eEe($Ge(e.getBoundingClientRect(),t))}function BGe(e,t,n){const i=iEe(e,n),{scroll:r}=t;return r&&(Pv(i.x,r.offset.x),Pv(i.y,r.offset.y)),i}const rEe=({current:e})=>e?e.ownerDocument.defaultView:null,UGe=new WeakMap;class QGe{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=ao(),this.visualElement=t}start(t,{snapToCursor:n=!1}={}){const{presenceContext:i}=this.visualElement;if(i&&i.isPresent===!1)return;const r=d=>{const{dragSnapToOrigin:f}=this.getProps();f?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(wC(d).point)},s=(d,f)=>{const{drag:h,dragPropagation:m,onDragStart:g}=this.getProps();if(h&&!m&&(this.openDragLock&&this.openDragLock(),this.openDragLock=xGe(h),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),wu(v=>{let y=this.getAxisMotionValue(v).get()||0;if(jf.test(y)){const{projection:x}=this.visualElement;if(x&&x.layout){const w=x.layout.layoutBox[v];w&&(y=cu(w)*(parseFloat(y)/100))}}this.originPoint[v]=y}),g&&bs.postRender(()=>g(d,f)),x$(this.visualElement,"transform");const{animationState:b}=this.visualElement;b&&b.setActive("whileDrag",!0)},a=(d,f)=>{const{dragPropagation:h,dragDirectionLock:m,onDirectionLock:g,onDrag:b}=this.getProps();if(!h&&!this.openDragLock)return;const{offset:v}=f;if(m&&this.currentDirection===null){this.currentDirection=zGe(v),this.currentDirection!==null&&g&&g(this.currentDirection);return}this.updateAxis("x",f.point,v),this.updateAxis("y",f.point,v),this.visualElement.render(),b&&b(d,f)},l=(d,f)=>this.stop(d,f),c=()=>wu(d=>{var f;return this.getAnimationState(d)==="paused"&&((f=this.getAxisMotionValue(d).animation)===null||f===void 0?void 0:f.play())}),{dragSnapToOrigin:u}=this.getProps();this.panSession=new XSe(t,{onSessionStart:r,onStart:s,onMove:a,onSessionEnd:l,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,contextWindow:rEe(this.visualElement)})}stop(t,n){const i=this.isDragging;if(this.cancel(),!i)return;const{velocity:r}=n;this.startAnimation(r);const{onDragEnd:s}=this.getProps();s&&bs.postRender(()=>s(t,n))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:i}=this.getProps();!i&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,i){const{drag:r}=this.getProps();if(!i||!O2(t,r,this.currentDirection))return;const s=this.getAxisMotionValue(t);let a=this.originPoint[t]+i[t];this.constraints&&this.constraints[t]&&(a=NGe(a,this.constraints[t],this.elastic[t])),s.set(a)}resolveConstraints(){var t;const{dragConstraints:n,dragElastic:i}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(t=this.visualElement.projection)===null||t===void 0?void 0:t.layout,s=this.constraints;n&&Nv(n)?this.constraints||(this.constraints=this.resolveRefConstraints()):n&&r?this.constraints=RGe(r.layoutBox,n):this.constraints=!1,this.elastic=MGe(i),s!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&wu(a=>{this.constraints!==!1&&this.getAxisMotionValue(a)&&(this.constraints[a]=DGe(r.layoutBox[a],this.constraints[a]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!Nv(t))return!1;const i=t.current,{projection:r}=this.visualElement;if(!r||!r.layout)return!1;const s=BGe(i,r.root,this.visualElement.getTransformPagePoint());let a=IGe(r.layout.layoutBox,s);if(n){const l=n(LGe(a));this.hasMutatedConstraints=!!l,l&&(a=eEe(l))}return a}startAnimation(t){const{drag:n,dragMomentum:i,dragElastic:r,dragTransition:s,dragSnapToOrigin:a,onDragTransitionEnd:l}=this.getProps(),c=this.constraints||{},u=wu(d=>{if(!O2(d,n,this.currentDirection))return;let f=c&&c[d]||{};a&&(f={min:0,max:0});const h=r?200:1e6,m=r?40:1e7,g={type:"inertia",velocity:i?t[d]:0,bounceStiffness:h,bounceDamping:m,timeConstant:750,restDelta:1,restSpeed:10,...s,...f};return this.startAxisValueAnimation(d,g)});return Promise.all(u).then(l)}startAxisValueAnimation(t,n){const i=this.getAxisMotionValue(t);return x$(this.visualElement,t),i.start(mU(t,i,0,n,this.visualElement,!1))}stopAnimation(){wu(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){wu(t=>{var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.pause()})}getAnimationState(t){var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.state}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,i=this.visualElement.getProps(),r=i[n];return r||this.visualElement.getValue(t,(i.initial?i.initial[t]:void 0)||0)}snapToCursor(t){wu(n=>{const{drag:i}=this.getProps();if(!O2(n,i,this.currentDirection))return;const{projection:r}=this.visualElement,s=this.getAxisMotionValue(n);if(r&&r.layout){const{min:a,max:l}=r.layout.layoutBox[n];s.set(t[n]-Fs(a,l,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:i}=this.visualElement;if(!Nv(n)||!i||!this.constraints)return;this.stopAnimation();const r={x:0,y:0};wu(a=>{const l=this.getAxisMotionValue(a);if(l&&this.constraints!==!1){const c=l.get();r[a]=PGe({min:c,max:c},this.constraints[a])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",i.root&&i.root.updateScroll(),i.updateLayout(),this.resolveConstraints(),wu(a=>{if(!O2(a,t,null))return;const l=this.getAxisMotionValue(a),{min:c,max:u}=this.constraints[a];l.set(Fs(c,u,r[a]))})}addListeners(){if(!this.visualElement.current)return;UGe.set(this.visualElement,this);const t=this.visualElement.current,n=Lk(t,"pointerdown",c=>{const{drag:u,dragListener:d=!0}=this.getProps();u&&d&&this.start(c)}),i=()=>{const{dragConstraints:c}=this.getProps();Nv(c)&&c.current&&(this.constraints=this.resolveRefConstraints())},{projection:r}=this.visualElement,s=r.addEventListener("measure",i);r&&!r.layout&&(r.root&&r.root.updateScroll(),r.updateLayout()),bs.read(i);const a=QS(window,"resize",()=>this.scalePositionWithinConstraints()),l=r.addEventListener("didUpdate",({delta:c,hasLayoutChanged:u})=>{this.isDragging&&u&&(wu(d=>{const f=this.getAxisMotionValue(d);f&&(this.originPoint[d]+=c[d].translate,f.set(f.get()+c[d].translate))}),this.visualElement.render())});return()=>{a(),n(),s(),l&&l()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:i=!1,dragPropagation:r=!1,dragConstraints:s=!1,dragElastic:a=j$,dragMomentum:l=!0}=t;return{...t,drag:n,dragDirectionLock:i,dragPropagation:r,dragConstraints:s,dragElastic:a,dragMomentum:l}}}function O2(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function zGe(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class VGe extends Ag{constructor(t){super(t),this.removeGroupControls=tu,this.removeListeners=tu,this.controls=new QGe(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||tu}unmount(){this.removeGroupControls(),this.removeListeners()}}const OX=e=>(t,n)=>{e&&bs.postRender(()=>e(t,n))};class HGe extends Ag{constructor(){super(...arguments),this.removePointerDownListener=tu}onPointerDown(t){this.session=new XSe(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:rEe(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:i,onPanEnd:r}=this.node.getProps();return{onSessionStart:OX(t),onStart:OX(n),onMove:i,onEnd:(s,a)=>{delete this.session,r&&bs.postRender(()=>r(s,a))}}}mount(){this.removePointerDownListener=Lk(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const R_={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function kX(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const tO={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(Ln.test(e))e=parseFloat(e);else return e;const n=kX(e,t.target.x),i=kX(e,t.target.y);return`${n}% ${i}%`}},qGe={correct:(e,{treeScale:t,projectionDelta:n})=>{const i=e,r=ig.parse(e);if(r.length>5)return i;const s=ig.createTransformer(e),a=typeof r[0]!="number"?1:0,l=n.x.scale*t.x,c=n.y.scale*t.y;r[0+a]/=l,r[1+a]/=c;const u=Fs(l,c,.5);return typeof r[2+a]=="number"&&(r[2+a]/=u),typeof r[3+a]=="number"&&(r[3+a]/=u),s(r)}};class WGe extends p.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:i,layoutId:r}=this.props,{projection:s}=t;vWe(KGe),s&&(n.group&&n.group.add(s),i&&i.register&&r&&i.register(s),s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,onExitComplete:()=>this.safeToRemove()})),R_.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:i,drag:r,isPresent:s}=this.props,a=i.projection;return a&&(a.isPresent=s,r||t.layoutDependency!==n||n===void 0?a.willUpdate():this.safeToRemove(),t.isPresent!==s&&(s?a.promote():a.relegate()||bs.postRender(()=>{const l=a.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),V7.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:i}=this.props,{projection:r}=t;r&&(r.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(r),i&&i.deregister&&i.deregister(r))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function sEe(e){const[t,n]=Qke(),i=p.useContext(F7);return o.jsx(WGe,{...e,layoutGroup:i,switchLayoutGroup:p.useContext(Yke),isPresent:t,safeToRemove:n})}const KGe={borderRadius:{...tO,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:tO,borderTopRightRadius:tO,borderBottomLeftRadius:tO,borderBottomRightRadius:tO,boxShadow:qGe};function GGe(e,t,n){const i=sl(e)?e:BS(e);return i.start(mU("",i,t,n)),i.animation}function XGe(e){return e instanceof SVGElement&&e.tagName!=="svg"}const YGe=(e,t)=>e.depth-t.depth;class ZGe{constructor(){this.children=[],this.isDirty=!1}add(t){tU(this.children,t),this.isDirty=!0}remove(t){nU(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(YGe),this.isDirty=!1,this.children.forEach(t)}}function JGe(e,t){const n=Nf.now(),i=({timestamp:r})=>{const s=r-n;s>=t&&(ng(i),e(s-t))};return bs.read(i,!0),()=>ng(i)}const oEe=["TopLeft","TopRight","BottomLeft","BottomRight"],eXe=oEe.length,SX=e=>typeof e=="string"?parseFloat(e):e,EX=e=>typeof e=="number"||Ln.test(e);function tXe(e,t,n,i,r,s){r?(e.opacity=Fs(0,n.opacity!==void 0?n.opacity:1,nXe(i)),e.opacityExit=Fs(t.opacity!==void 0?t.opacity:1,0,iXe(i))):s&&(e.opacity=Fs(t.opacity!==void 0?t.opacity:1,n.opacity!==void 0?n.opacity:1,i));for(let a=0;ait?1:n(Hx(e,t,i))}function TX(e,t){e.min=t.min,e.max=t.max}function xu(e,t){TX(e.x,t.x),TX(e.y,t.y)}function AX(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function _X(e,t,n,i,r){return e-=t,e=bN(e,1/n,i),r!==void 0&&(e=bN(e,1/r,i)),e}function rXe(e,t=0,n=1,i=.5,r,s=e,a=e){if(jf.test(t)&&(t=parseFloat(t),t=Fs(a.min,a.max,t/100)-a.min),typeof t!="number")return;let l=Fs(s.min,s.max,i);e===s&&(l-=t),e.min=_X(e.min,t,n,l,r),e.max=_X(e.max,t,n,l,r)}function jX(e,t,[n,i,r],s,a){rXe(e,t[n],t[i],t[r],t.scale,s,a)}const sXe=["x","scaleX","originX"],oXe=["y","scaleY","originY"];function NX(e,t,n,i){jX(e.x,t,sXe,n?n.x:void 0,i?i.x:void 0),jX(e.y,t,oXe,n?n.y:void 0,i?i.y:void 0)}function RX(e){return e.translate===0&&e.scale===1}function lEe(e){return RX(e.x)&&RX(e.y)}function IX(e,t){return e.min===t.min&&e.max===t.max}function aXe(e,t){return IX(e.x,t.x)&&IX(e.y,t.y)}function PX(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function cEe(e,t){return PX(e.x,t.x)&&PX(e.y,t.y)}function DX(e){return cu(e.x)/cu(e.y)}function MX(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class lXe{constructor(){this.members=[]}add(t){tU(this.members,t),t.scheduleRender()}remove(t){if(nU(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(r=>t===r);if(n===0)return!1;let i;for(let r=n;r>=0;r--){const s=this.members[r];if(s.isPresent!==!1){i=s;break}}return i?(this.promote(i),!0):!1}promote(t,n){const i=this.lead;if(t!==i&&(this.prevLead=i,this.lead=t,t.show(),i)){i.instance&&i.scheduleRender(),t.scheduleRender(),t.resumeFrom=i,n&&(t.resumeFrom.preserveOpacity=!0),i.snapshot&&(t.snapshot=i.snapshot,t.snapshot.latestValues=i.animationValues||i.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:r}=t.options;r===!1&&i.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:i}=t;n.onExitComplete&&n.onExitComplete(),i&&i.options.onExitComplete&&i.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function cXe(e,t,n){let i="";const r=e.x.translate/t.x,s=e.y.translate/t.y,a=(n==null?void 0:n.z)||0;if((r||s||a)&&(i=`translate3d(${r}px, ${s}px, ${a}px) `),(t.x!==1||t.y!==1)&&(i+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:u,rotate:d,rotateX:f,rotateY:h,skewX:m,skewY:g}=n;u&&(i=`perspective(${u}px) ${i}`),d&&(i+=`rotate(${d}deg) `),f&&(i+=`rotateX(${f}deg) `),h&&(i+=`rotateY(${h}deg) `),m&&(i+=`skewX(${m}deg) `),g&&(i+=`skewY(${g}deg) `)}const l=e.x.scale*t.x,c=e.y.scale*t.y;return(l!==1||c!==1)&&(i+=`scale(${l}, ${c})`),i||"none"}const bb={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},XO=typeof window<"u"&&window.MotionDebug!==void 0,I5=["","X","Y","Z"],uXe={visibility:"hidden"},LX=1e3;let dXe=0;function P5(e,t,n,i){const{latestValues:r}=t;r[e]&&(n[e]=r[e],t.setStaticValue(e,0),i&&(i[e]=0))}function uEe(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=hSe(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:r,layoutId:s}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",bs,!(r||s))}const{parent:i}=e;i&&!i.hasCheckedOptimisedAppear&&uEe(i)}function dEe({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:i,resetTransform:r}){return class{constructor(a={},l=t==null?void 0:t()){this.id=dXe++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,XO&&(bb.totalNodes=bb.resolvedTargetDeltas=bb.recalculatedProjection=0),this.nodes.forEach(pXe),this.nodes.forEach(vXe),this.nodes.forEach(xXe),this.nodes.forEach(mXe),XO&&window.MotionDebug.record(bb)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=a,this.root=l?l.root||l:this,this.path=l?[...l.path,l]:[],this.parent=l,this.depth=l?l.depth+1:0;for(let c=0;cthis.root.updateBlockedByResize=!1;e(a,()=>{this.root.updateBlockedByResize=!0,f&&f(),f=JGe(h,250),R_.hasAnimatedSinceResize&&(R_.hasAnimatedSinceResize=!1,this.nodes.forEach(FX))})}c&&this.root.registerSharedNode(c,this),this.options.animate!==!1&&d&&(c||u)&&this.addEventListener("didUpdate",({delta:f,hasLayoutChanged:h,hasRelativeTargetChanged:m,layout:g})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const b=this.options.transition||d.getDefaultTransition()||EXe,{onLayoutAnimationStart:v,onLayoutAnimationComplete:y}=d.getProps(),x=!this.targetLayout||!cEe(this.targetLayout,g)||m,w=!h&&m;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||w||h&&(x||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(f,w);const O={...eU(b,"layout"),onPlay:v,onComplete:y};(d.shouldReduceMotion||this.options.layoutRoot)&&(O.delay=0,O.type=!1),this.startAnimation(O)}else h||FX(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=g})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const a=this.getStack();a&&a.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,ng(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(wXe),this.animationId++)}getTransformTemplate(){const{visualElement:a}=this.options;return a&&a.getProps().transformTemplate}willUpdate(a=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&uEe(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let c=0;c{const S=O/1e3;BX(f.x,a.x,S),BX(f.y,a.y,S),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Fk(h,this.layout.layoutBox,this.relativeParent.layout.layoutBox),kXe(this.relativeTarget,this.relativeTargetOrigin,h,S),w&&aXe(this.relativeTarget,w)&&(this.isProjectionDirty=!1),w||(w=ao()),xu(w,this.relativeTarget)),b&&(this.animationValues=d,tXe(d,u,this.latestValues,S,x,y)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=S},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(a){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(ng(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=bs.update(()=>{R_.hasAnimatedSinceResize=!0,this.currentAnimation=GGe(0,LX,{...a,onUpdate:l=>{this.mixTargetDelta(l),a.onUpdate&&a.onUpdate(l)},onComplete:()=>{a.onComplete&&a.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const a=this.getStack();a&&a.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(LX),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const a=this.getLead();let{targetWithTransforms:l,target:c,layout:u,latestValues:d}=a;if(!(!l||!c||!u)){if(this!==a&&this.layout&&u&&fEe(this.options.animationType,this.layout.layoutBox,u.layoutBox)){c=this.target||ao();const f=cu(this.layout.layoutBox.x);c.x.min=a.target.x.min,c.x.max=c.x.min+f;const h=cu(this.layout.layoutBox.y);c.y.min=a.target.y.min,c.y.max=c.y.min+h}xu(l,c),Dv(l,d),$k(this.projectionDeltaWithTransform,this.layoutCorrected,l,d)}}registerSharedNode(a,l){this.sharedNodes.has(a)||this.sharedNodes.set(a,new lXe),this.sharedNodes.get(a).add(l);const u=l.options.initialPromotionConfig;l.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(l):void 0})}isLead(){const a=this.getStack();return a?a.lead===this:!0}getLead(){var a;const{layoutId:l}=this.options;return l?((a=this.getStack())===null||a===void 0?void 0:a.lead)||this:this}getPrevLead(){var a;const{layoutId:l}=this.options;return l?(a=this.getStack())===null||a===void 0?void 0:a.prevLead:void 0}getStack(){const{layoutId:a}=this.options;if(a)return this.root.sharedNodes.get(a)}promote({needsReset:a,transition:l,preserveFollowOpacity:c}={}){const u=this.getStack();u&&u.promote(this,c),a&&(this.projectionDelta=void 0,this.needsReset=!0),l&&this.setOptions({transition:l})}relegate(){const a=this.getStack();return a?a.relegate(this):!1}resetSkewAndRotation(){const{visualElement:a}=this.options;if(!a)return;let l=!1;const{latestValues:c}=a;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(l=!0),!l)return;const u={};c.z&&P5("z",a,u,this.animationValues);for(let d=0;d{var l;return(l=a.currentAnimation)===null||l===void 0?void 0:l.stop()}),this.root.nodes.forEach($X),this.root.sharedNodes.clear()}}}function fXe(e){e.updateLayout()}function hXe(e){var t;const n=((t=e.resumeFrom)===null||t===void 0?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&n&&e.hasListeners("didUpdate")){const{layoutBox:i,measuredBox:r}=e.layout,{animationType:s}=e.options,a=n.source!==e.layout.source;s==="size"?wu(f=>{const h=a?n.measuredBox[f]:n.layoutBox[f],m=cu(h);h.min=i[f].min,h.max=h.min+m}):fEe(s,n.layoutBox,i)&&wu(f=>{const h=a?n.measuredBox[f]:n.layoutBox[f],m=cu(i[f]);h.max=h.min+m,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[f].max=e.relativeTarget[f].min+m)});const l=Iv();$k(l,i,n.layoutBox);const c=Iv();a?$k(c,e.applyTransform(r,!0),n.measuredBox):$k(c,i,n.layoutBox);const u=!lEe(l);let d=!1;if(!e.resumeFrom){const f=e.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:h,layout:m}=f;if(h&&m){const g=ao();Fk(g,n.layoutBox,h.layoutBox);const b=ao();Fk(b,i,m.layoutBox),cEe(g,b)||(d=!0),f.options.layoutRoot&&(e.relativeTarget=b,e.relativeTargetOrigin=g,e.relativeParent=f)}}}e.notifyListeners("didUpdate",{layout:i,snapshot:n,delta:c,layoutDelta:l,hasLayoutChanged:u,hasRelativeTargetChanged:d})}else if(e.isLead()){const{onExitComplete:i}=e.options;i&&i()}e.options.transition=void 0}function pXe(e){XO&&bb.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function mXe(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function gXe(e){e.clearSnapshot()}function $X(e){e.clearMeasurements()}function bXe(e){e.isLayoutDirty=!1}function yXe(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function FX(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function vXe(e){e.resolveTargetDelta()}function xXe(e){e.calcProjection()}function wXe(e){e.resetSkewAndRotation()}function OXe(e){e.removeLeadSnapshot()}function BX(e,t,n){e.translate=Fs(t.translate,0,n),e.scale=Fs(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function UX(e,t,n,i){e.min=Fs(t.min,n.min,i),e.max=Fs(t.max,n.max,i)}function kXe(e,t,n,i){UX(e.x,t.x,n.x,i),UX(e.y,t.y,n.y,i)}function SXe(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const EXe={duration:.45,ease:[.4,0,.1,1]},QX=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),zX=QX("applewebkit/")&&!QX("chrome/")?Math.round:tu;function VX(e){e.min=zX(e.min),e.max=zX(e.max)}function CXe(e){VX(e.x),VX(e.y)}function fEe(e,t,n){return e==="position"||e==="preserve-aspect"&&!_Ge(DX(t),DX(n),.2)}function TXe(e){var t;return e!==e.root&&((t=e.scroll)===null||t===void 0?void 0:t.wasRoot)}const AXe=dEe({attachResizeListener:(e,t)=>QS(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),D5={current:void 0},hEe=dEe({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!D5.current){const e=new AXe({});e.mount(window),e.setOptions({layoutScroll:!0}),D5.current=e}return D5.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),_Xe={pan:{Feature:HGe},drag:{Feature:VGe,ProjectionNode:hEe,MeasureLayout:sEe}};function jXe(e,t,n){var i;if(e instanceof Element)return[e];if(typeof e=="string"){let r=document;const s=(i=void 0)!==null&&i!==void 0?i:r.querySelectorAll(e);return s?Array.from(s):[]}return Array.from(e)}function pEe(e,t){const n=jXe(e),i=new AbortController,r={passive:!0,...t,signal:i.signal};return[n,r,()=>i.abort()]}function HX(e){return t=>{t.pointerType==="touch"||GSe()||e(t)}}function NXe(e,t,n={}){const[i,r,s]=pEe(e,n),a=HX(l=>{const{target:c}=l,u=t(l);if(typeof u!="function"||!c)return;const d=HX(f=>{u(f),c.removeEventListener("pointerleave",d)});c.addEventListener("pointerleave",d,r)});return i.forEach(l=>{l.addEventListener("pointerenter",a,r)}),s}function qX(e,t,n){const{props:i}=e;e.animationState&&i.whileHover&&e.animationState.setActive("whileHover",n==="Start");const r="onHover"+n,s=i[r];s&&bs.postRender(()=>s(t,wC(t)))}class RXe extends Ag{mount(){const{current:t}=this.node;t&&(this.unmount=NXe(t,n=>(qX(this.node,n,"Start"),i=>qX(this.node,i,"End"))))}unmount(){}}class IXe extends Ag{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=xC(QS(this.node.current,"focus",()=>this.onFocus()),QS(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const mEe=(e,t)=>t?e===t?!0:mEe(e,t.parentElement):!1,PXe=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function DXe(e){return PXe.has(e.tagName)||e.tabIndex!==-1}const YO=new WeakSet;function WX(e){return t=>{t.key==="Enter"&&e(t)}}function M5(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const MXe=(e,t)=>{const n=e.currentTarget;if(!n)return;const i=WX(()=>{if(YO.has(n))return;M5(n,"down");const r=WX(()=>{M5(n,"up")}),s=()=>M5(n,"cancel");n.addEventListener("keyup",r,t),n.addEventListener("blur",s,t)});n.addEventListener("keydown",i,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",i),t)};function KX(e){return gU(e)&&!GSe()}function LXe(e,t,n={}){const[i,r,s]=pEe(e,n),a=l=>{const c=l.currentTarget;if(!KX(l)||YO.has(c))return;YO.add(c);const u=t(l),d=(m,g)=>{window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",h),!(!KX(m)||!YO.has(c))&&(YO.delete(c),typeof u=="function"&&u(m,{success:g}))},f=m=>{d(m,n.useGlobalTarget||mEe(c,m.target))},h=m=>{d(m,!1)};window.addEventListener("pointerup",f,r),window.addEventListener("pointercancel",h,r)};return i.forEach(l=>{!DXe(l)&&l.getAttribute("tabindex")===null&&(l.tabIndex=0),(n.useGlobalTarget?window:l).addEventListener("pointerdown",a,r),l.addEventListener("focus",u=>MXe(u,r),r)}),s}function GX(e,t,n){const{props:i}=e;e.animationState&&i.whileTap&&e.animationState.setActive("whileTap",n==="Start");const r="onTap"+(n==="End"?"":n),s=i[r];s&&bs.postRender(()=>s(t,wC(t)))}class $Xe extends Ag{mount(){const{current:t}=this.node;t&&(this.unmount=LXe(t,n=>(GX(this.node,n,"Start"),(i,{success:r})=>GX(this.node,i,r?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const I$=new WeakMap,L5=new WeakMap,FXe=e=>{const t=I$.get(e.target);t&&t(e)},BXe=e=>{e.forEach(FXe)};function UXe({root:e,...t}){const n=e||document;L5.has(n)||L5.set(n,{});const i=L5.get(n),r=JSON.stringify(t);return i[r]||(i[r]=new IntersectionObserver(BXe,{root:e,...t})),i[r]}function QXe(e,t,n){const i=UXe(t);return I$.set(e,n),i.observe(e),()=>{I$.delete(e),i.unobserve(e)}}const zXe={some:0,all:1};class VXe extends Ag{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:i,amount:r="some",once:s}=t,a={root:n?n.current:void 0,rootMargin:i,threshold:typeof r=="number"?r:zXe[r]},l=c=>{const{isIntersecting:u}=c;if(this.isInView===u||(this.isInView=u,s&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:d,onViewportLeave:f}=this.node.getProps(),h=u?d:f;h&&h(c)};return QXe(this.node.current,a,l)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(HXe(t,n))&&this.startObserver()}unmount(){}}function HXe({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const qXe={inView:{Feature:VXe},tap:{Feature:$Xe},focus:{Feature:IXe},hover:{Feature:RXe}},WXe={layout:{ProjectionNode:hEe,MeasureLayout:sEe}},yN={current:null},bU={current:!1};function gEe(){if(bU.current=!0,!!B7)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>yN.current=e.matches;e.addListener(t),t()}else yN.current=!1}const KXe=[...LSe,nl,ig],GXe=e=>KXe.find(MSe(e)),XX=new WeakMap;function XXe(e,t,n){for(const i in t){const r=t[i],s=n[i];if(sl(r))e.addValue(i,r);else if(sl(s))e.addValue(i,BS(r,{owner:e}));else if(s!==r)if(e.hasValue(i)){const a=e.getValue(i);a.liveStyle===!0?a.jump(r):a.hasAnimated||a.set(r)}else{const a=e.getStaticValue(i);e.addValue(i,BS(a!==void 0?a:r,{owner:e}))}}for(const i in n)t[i]===void 0&&e.removeValue(i);return t}const YX=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class YXe{scrapeMotionValuesFromProps(t,n,i){return{}}constructor({parent:t,props:n,presenceContext:i,reducedMotionConfig:r,blockInitialAnimation:s,visualState:a},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=fU,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const m=Nf.now();this.renderScheduledAtthis.bindToMotionValue(i,n)),bU.current||gEe(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:yN.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){XX.delete(this.current),this.projection&&this.projection.unmount(),ng(this.notifyUpdate),ng(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const n=this.features[t];n&&(n.unmount(),n.isMounted=!1)}this.current=null}bindToMotionValue(t,n){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const i=Hy.has(t),r=n.on("change",l=>{this.latestValues[t]=l,this.props.onUpdate&&bs.preRender(this.notifyUpdate),i&&this.projection&&(this.projection.isTransformDirty=!0)}),s=n.on("renderRequest",this.scheduleRender);let a;window.MotionCheckAppearSync&&(a=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{r(),s(),a&&a(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in Vx){const n=Vx[t];if(!n)continue;const{isEnabled:i,Feature:r}=n;if(!this.features[t]&&r&&i(this.props)&&(this.features[t]=new r(this)),this.features[t]){const s=this.features[t];s.isMounted?s.update():(s.mount(),s.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):ao()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let i=0;in.variantChildren.delete(t)}addValue(t,n){const i=this.values.get(t);n!==i&&(i&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let i=this.values.get(t);return i===void 0&&n!==void 0&&(i=BS(n===null?void 0:n,{owner:this}),this.addValue(t,i)),i}readValue(t,n){var i;let r=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:(i=this.getBaseTargetFromProps(this.props,t))!==null&&i!==void 0?i:this.readValueFromInstance(this.current,t,this.options);return r!=null&&(typeof r=="string"&&(PSe(r)||ESe(r))?r=parseFloat(r):!GXe(r)&&ig.test(n)&&(r=NSe(t,n)),this.setBaseTarget(t,sl(r)?r.get():r)),sl(r)?r.get():r}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var n;const{initial:i}=this.props;let r;if(typeof i=="string"||typeof i=="object"){const a=q7(this.props,i,(n=this.presenceContext)===null||n===void 0?void 0:n.custom);a&&(r=a[t])}if(i&&r!==void 0)return r;const s=this.getBaseTargetFromProps(this.props,t);return s!==void 0&&!sl(s)?s:this.initialValues[t]!==void 0&&r===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new iU),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}class bEe extends YXe{constructor(){super(...arguments),this.KeyframeResolver=$Se}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){return t.style?t.style[n]:void 0}removeValueFromRenderState(t,{vars:n,style:i}){delete n[t],delete i[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;sl(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function ZXe(e){return window.getComputedStyle(e)}class JXe extends bEe{constructor(){super(...arguments),this.type="html",this.renderInstance=rSe}readValueFromInstance(t,n){if(Hy.has(n)){const i=dU(n);return i&&i.default||0}else{const i=ZXe(t),r=(tSe(n)?i.getPropertyValue(n):i[n])||0;return typeof r=="string"?r.trim():r}}measureInstanceViewportBox(t,{transformPagePoint:n}){return iEe(t,n)}build(t,n,i){G7(t,n,i.transformTemplate)}scrapeMotionValuesFromProps(t,n,i){return J7(t,n,i)}}class eYe extends bEe{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=ao}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(Hy.has(n)){const i=dU(n);return i&&i.default||0}return n=sSe.has(n)?n:z7(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,i){return lSe(t,n,i)}build(t,n,i){X7(t,n,this.isSVGTag,i.transformTemplate)}renderInstance(t,n,i,r){oSe(t,n,i,r)}mount(t){this.isSVGTag=Z7(t.tagName),super.mount(t)}}const tYe=(e,t)=>H7(e)?new eYe(t):new JXe(t,{allowProjection:e!==p.Fragment}),nYe=AWe({...vGe,...qXe,..._Xe,...WXe},tYe),dr=zqe(nYe);function FI(){!bU.current&&gEe();const[e]=p.useState(yN.current);return e}function Yo(){return Yo=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u"||/ServerSideRendering/.test(navigator&&navigator.userAgent)?p.useEffect:p.useLayoutEffect;function ov(e,t,n){var i=p.useRef(t);i.current=t,p.useEffect(function(){function r(s){i.current(s)}return e&&window.addEventListener(e,r,n),function(){e&&window.removeEventListener(e,r)}},[e])}var iYe=["container"];function rYe(e){var t=e.container,n=t===void 0?document.body:t,i=BI(e,iYe);return Jn.createPortal(pi.createElement("div",Yo({},i)),n)}function sYe(e){return pi.createElement("svg",Yo({width:"44",height:"44",viewBox:"0 0 768 768"},e),pi.createElement("path",{d:"M607.5 205.5l-178.5 178.5 178.5 178.5-45 45-178.5-178.5-178.5 178.5-45-45 178.5-178.5-178.5-178.5 45-45 178.5 178.5 178.5-178.5z"}))}function oYe(e){return pi.createElement("svg",Yo({width:"44",height:"44",viewBox:"0 0 768 768"},e),pi.createElement("path",{d:"M640.5 352.5v63h-390l178.5 180-45 45-256.5-256.5 256.5-256.5 45 45-178.5 180h390z"}))}function aYe(e){return pi.createElement("svg",Yo({width:"44",height:"44",viewBox:"0 0 768 768"},e),pi.createElement("path",{d:"M384 127.5l256.5 256.5-256.5 256.5-45-45 178.5-180h-390v-63h390l-178.5-180z"}))}function lYe(){return p.useEffect(function(){var e=document.body.style,t=e.overflow;return e.overflow="hidden",function(){e.overflow=t}},[]),null}function JX(e){var t=e.touches[0],n=t.clientX,i=t.clientY;if(e.touches.length>=2){var r=e.touches[1],s=r.clientX,a=r.clientY;return[(n+s)/2,(i+a)/2,Math.sqrt(Math.pow(s-n,2)+Math.pow(a-i,2))]}return[n,i,0]}var am=function(e,t,n,i){var r,s=n*t,a=(s-i)/2,l=e;return s<=i?(r=1,l=0):e>0&&a-e<=0?(r=2,l=a):e<0&&a+e<=0&&(r=3,l=-a),[r,l]};function $5(e,t,n,i,r,s,a,l,c,u){a===void 0&&(a=innerWidth/2),l===void 0&&(l=innerHeight/2),c===void 0&&(c=0),u===void 0&&(u=0);var d=am(e,s,n,innerWidth)[0],f=am(t,s,i,innerHeight),h=innerWidth/2,m=innerHeight/2;return{x:a-s/r*(a-(h+e))-h+(i/n>=3&&n*s===innerWidth?0:d?c/2:c),y:l-s/r*(l-(m+t))-m+(f[0]?u/2:u),lastCX:a,lastCY:l}}function M$(e,t,n){var i=e%180!=0;return i?[n,t,i]:[t,n,i]}function F5(e,t,n){var i=M$(n,innerWidth,innerHeight),r=i[0],s=i[1],a=0,l=r,c=s,u=e/t*s,d=t/e*r;return e=s?l=u:e>=r&&tr/s?c=d:t/e>=3&&!i[2]?a=((c=d)-s)/2:l=u,{width:l,height:c,x:0,y:a,pause:!0}}function S2(e,t){var n=t.leading,i=n!==void 0&&n,r=t.maxWait,s=t.wait,a=s===void 0?r||0:s,l=p.useRef(e);l.current=e;var c=p.useRef(0),u=p.useRef(),d=function(){return u.current&&clearTimeout(u.current)},f=p.useCallback(function(){var h=[].slice.call(arguments),m=Date.now();function g(){c.current=m,d(),l.current.apply(null,h)}var b=c.current,v=m-b;if(b===0&&(i&&g(),c.current=m),r!==void 0){if(v>r)return void g()}else v=1&&s&&s())};d()}function d(){c=requestAnimationFrame(u)}}var uYe={T:0,L:0,W:0,H:0,FIT:void 0},vEe=function(){var e=p.useRef(!1);return p.useEffect(function(){return e.current=!0,function(){e.current=!1}},[]),e},dYe=["className"];function fYe(e){var t=e.className,n=t===void 0?"":t,i=BI(e,dYe);return pi.createElement("div",Yo({className:"PhotoView__Spinner "+n},i),pi.createElement("svg",{viewBox:"0 0 32 32",width:"36",height:"36",fill:"white"},pi.createElement("path",{opacity:".25",d:"M16 0 A16 16 0 0 0 16 32 A16 16 0 0 0 16 0 M16 4 A12 12 0 0 1 16 28 A12 12 0 0 1 16 4"}),pi.createElement("path",{d:"M16 0 A16 16 0 0 1 32 16 L28 16 A12 12 0 0 0 16 4z"})))}var hYe=["src","loaded","broken","className","onPhotoLoad","loadingElement","brokenElement"];function pYe(e){var t=e.src,n=e.loaded,i=e.broken,r=e.className,s=e.onPhotoLoad,a=e.loadingElement,l=e.brokenElement,c=BI(e,hYe),u=vEe();return t&&!i?pi.createElement(pi.Fragment,null,pi.createElement("img",Yo({className:"PhotoView__Photo"+(r?" "+r:""),src:t,onLoad:function(d){var f=d.target;u.current&&s({loaded:!0,naturalWidth:f.naturalWidth,naturalHeight:f.naturalHeight})},onError:function(){u.current&&s({broken:!0})},draggable:!1,alt:""},c)),!n&&(a?pi.createElement("span",{className:"PhotoView__icon"},a):pi.createElement(fYe,{className:"PhotoView__icon"}))):l?pi.createElement("span",{className:"PhotoView__icon"},typeof l=="function"?l({src:t}):l):null}var mYe={naturalWidth:void 0,naturalHeight:void 0,width:void 0,height:void 0,loaded:void 0,broken:!1,x:0,y:0,touched:!1,maskTouched:!1,rotate:0,scale:1,CX:0,CY:0,lastX:0,lastY:0,lastCX:0,lastCY:0,lastScale:1,touchTime:0,touchLength:0,pause:!0,stopRaf:!0,reach:void 0};function gYe(e){var t=e.item,n=t.src,i=t.render,r=t.width,s=r===void 0?0:r,a=t.height,l=a===void 0?0:a,c=t.originRef,u=e.visible,d=e.speed,f=e.easing,h=e.wrapClassName,m=e.className,g=e.style,b=e.loadingElement,v=e.brokenElement,y=e.onPhotoTap,x=e.onMaskTap,w=e.onReachMove,O=e.onReachUp,S=e.onPhotoResize,k=e.isActive,C=e.expose,E=vN(mYe),N=E[0],A=E[1],j=p.useRef(0),T=vEe(),R=N.naturalWidth,_=R===void 0?s:R,D=N.naturalHeight,M=D===void 0?l:D,P=N.width,L=P===void 0?s:P,F=N.height,I=F===void 0?l:F,z=N.loaded,K=z===void 0?!n:z,B=N.broken,W=N.x,H=N.y,X=N.touched,ie=N.stopRaf,Q=N.maskTouched,Z=N.rotate,ue=N.scale,Ee=N.CX,Y=N.CY,G=N.lastX,te=N.lastY,de=N.lastCX,Ce=N.lastCY,le=N.lastScale,fe=N.touchTime,re=N.touchLength,Oe=N.pause,Pe=N.reach,be=ty({onScale:function(Ie){return Qe(k2(Ie))},onRotate:function(Ie){Z!==Ie&&(C({rotate:Ie}),A(Yo({rotate:Ie},F5(_,M,Ie))))}});function Qe(Ie,vt,jt){ue!==Ie&&(C({scale:Ie}),A(Yo({scale:Ie},$5(W,H,L,I,ue,Ie,vt,jt),Ie<=1&&{x:0,y:0})))}var ve=S2(function(Ie,vt,jt){if(jt===void 0&&(jt=0),(X||Q)&&k){var Nt=M$(Z,L,I),ln=Nt[0],He=Nt[1];if(jt===0&&j.current===0){var Le=Math.abs(Ie-Ee)<=20,We=Math.abs(vt-Y)<=20;if(Le&&We)return void A({lastCX:Ie,lastCY:vt});j.current=Le?vt>Y?3:2:1}var gt,st=Ie-de,xt=vt-Ce;if(jt===0){var ft=am(st+G,ue,ln,innerWidth)[0],Ht=am(xt+te,ue,He,innerHeight);gt=function(hn,Ge,bt,St){return Ge&&hn===1||St==="x"?"x":bt&&hn>1||St==="y"?"y":void 0}(j.current,ft,Ht[0],Pe),gt!==void 0&&w(gt,Ie,vt,ue)}if(gt==="x"||Q)return void A({reach:"x"});var cn=k2(ue+(jt-re)/100/2*ue,_/L,.2);C({scale:cn}),A(Yo({touchLength:jt,reach:gt,scale:cn},$5(W,H,L,I,ue,cn,Ie,vt,st,xt)))}},{maxWait:8});function Ne(Ie){return!ie&&!X&&(T.current&&A(Yo({},Ie,{pause:u})),T.current)}var ne,ye,Te,Se,Ke,it,he,xe,Ae=(Ke=function(Ie){return Ne({x:Ie})},it=function(Ie){return Ne({y:Ie})},he=function(Ie){return T.current&&(C({scale:Ie}),A({scale:Ie})),!X&&T.current},xe=ty({X:function(Ie){return Ke(Ie)},Y:function(Ie){return it(Ie)},S:function(Ie){return he(Ie)}}),function(Ie,vt,jt,Nt,ln,He,Le,We,gt,st,xt){var ft=M$(st,ln,He),Ht=ft[0],cn=ft[1],hn=am(Ie,We,Ht,innerWidth),Ge=hn[0],bt=hn[1],St=am(vt,We,cn,innerHeight),dn=St[0],Rt=St[1],$e=Date.now()-xt;if($e>=200||We!==Le||Math.abs(gt-Le)>1){var ot=$5(Ie,vt,ln,He,Le,We),vn=ot.x,Ye=ot.y,mt=Ge?bt:vn!==Ie?vn:null,_n=dn?Rt:Ye!==vt?Ye:null;return mt!==null&&Cb(Ie,mt,xe.X),_n!==null&&Cb(vt,_n,xe.Y),void(We!==Le&&Cb(Le,We,xe.S))}var Vt=(Ie-jt)/$e,Ti=(vt-Nt)/$e,jn=Math.sqrt(Math.pow(Vt,2)+Math.pow(Ti,2)),Hn=!1,En=!1;(function(vi,Fn){var di,wr=vi,gr=0,ir=0,Ve=function(Nn){di||(di=Nn);var se=Nn-di,xi=Math.sign(vi),is=-.001*xi,$r=Math.sign(-wr)*Math.pow(wr,2)*2e-4,qn=wr*se+(is+$r)*Math.pow(se,2)/2;gr+=qn,di=Nn,xi*(wr+=(is+$r)*se)<=0?rn():Fn(gr)?kt():rn()};function kt(){ir=requestAnimationFrame(Ve)}function rn(){cancelAnimationFrame(ir)}kt()})(jn,function(vi){var Fn=Ie+vi*(Vt/jn),di=vt+vi*(Ti/jn),wr=am(Fn,Le,Ht,innerWidth),gr=wr[0],ir=wr[1],Ve=am(di,Le,cn,innerHeight),kt=Ve[0],rn=Ve[1];if(gr&&!Hn&&(Hn=!0,Ge?Cb(Fn,ir,xe.X):eY(ir,Fn+(Fn-ir),xe.X)),kt&&!En&&(En=!0,dn?Cb(di,rn,xe.Y):eY(rn,di+(di-rn),xe.Y)),Hn&&En)return!1;var Nn=Hn||xe.X(ir),se=En||xe.Y(rn);return Nn&&se})}),qe=(ne=y,ye=function(Ie,vt){Pe||Qe(ue!==1?1:Math.max(2,_/L),Ie,vt)},Te=p.useRef(0),Se=S2(function(){Te.current=0,ne.apply(void 0,[].slice.call(arguments))},{wait:300}),function(){var Ie=[].slice.call(arguments);Te.current+=1,Se.apply(void 0,Ie),Te.current>=2&&(Se.cancel(),Te.current=0,ye.apply(void 0,Ie))});function Me(Ie,vt){if(j.current=0,(X||Q)&&k){A({touched:!1,maskTouched:!1,pause:!1,stopRaf:!1,reach:void 0});var jt=k2(ue,_/L);if(Ae(W,H,G,te,L,I,ue,jt,le,Z,fe),O(Ie,vt),Ee===Ie&&Y===vt){if(X)return void qe(Ie,vt);Q&&x(Ie,vt)}}}function At(Ie,vt,jt){jt===void 0&&(jt=0),A({touched:!0,CX:Ie,CY:vt,lastCX:Ie,lastCY:vt,lastX:W,lastY:H,lastScale:ue,touchLength:jt,touchTime:Date.now()})}function It(Ie){A({maskTouched:!0,CX:Ie.clientX,CY:Ie.clientY,lastX:W,lastY:H})}ov(gh?void 0:"mousemove",function(Ie){Ie.preventDefault(),ve(Ie.clientX,Ie.clientY)}),ov(gh?void 0:"mouseup",function(Ie){Me(Ie.clientX,Ie.clientY)}),ov(gh?"touchmove":void 0,function(Ie){Ie.preventDefault();var vt=JX(Ie);ve.apply(void 0,vt)},{passive:!1}),ov(gh?"touchend":void 0,function(Ie){var vt=Ie.changedTouches[0];Me(vt.clientX,vt.clientY)},{passive:!1}),ov("resize",S2(function(){K&&!X&&(A(F5(_,M,Z)),S())},{maxWait:8})),D$(function(){k&&C(Yo({scale:ue,rotate:Z},be))},[k]);var lt=function(Ie,vt,jt,Nt,ln,He,Le,We,gt,st){var xt=function(vn,Ye,mt,_n,Vt){var Ti=p.useRef(!1),jn=vN({lead:!0,scale:mt}),Hn=jn[0],En=Hn.lead,vi=Hn.scale,Fn=jn[1],di=S2(function(wr){try{return Vt(!0),Fn({lead:!1,scale:wr}),Promise.resolve()}catch(gr){return Promise.reject(gr)}},{wait:_n});return D$(function(){Ti.current?(Vt(!1),Fn({lead:!0}),di(mt)):Ti.current=!0},[mt]),En?[vn*vi,Ye*vi,mt/vi]:[vn*mt,Ye*mt,1]}(He,Le,We,gt,st),ft=xt[0],Ht=xt[1],cn=xt[2],hn=function(vn,Ye,mt,_n,Vt){var Ti=p.useState(uYe),jn=Ti[0],Hn=Ti[1],En=p.useState(0),vi=En[0],Fn=En[1],di=p.useRef(),wr=ty({OK:function(){return vn&&Fn(4)}});function gr(ir){Vt(!1),Fn(ir)}return p.useEffect(function(){if(di.current||(di.current=Date.now()),mt){if(function(ir,Ve){var kt=ir&&ir.current;if(kt&&kt.nodeType===1){var rn=kt.getBoundingClientRect();Ve({T:rn.top,L:rn.left,W:rn.width,H:rn.height,FIT:kt.tagName==="IMG"?getComputedStyle(kt).objectFit:void 0})}}(Ye,Hn),vn)return Date.now()-di.current<250?(Fn(1),requestAnimationFrame(function(){Fn(2),requestAnimationFrame(function(){return gr(3)})}),void setTimeout(wr.OK,_n)):void Fn(4);gr(5)}},[vn,mt]),[vi,jn]}(Ie,vt,jt,gt,st),Ge=hn[0],bt=hn[1],St=bt.W,dn=bt.FIT,Rt=innerWidth/2,$e=innerHeight/2,ot=Ge<3||Ge>4;return[ot?St?bt.L:Rt:Nt+(Rt-He*We/2),ot?St?bt.T:$e:ln+($e-Le*We/2),ft,ot&&dn?ft*(bt.H/St):Ht,Ge===0?cn:ot?St/(He*We)||.01:cn,ot?dn?1:0:1,Ge,dn]}(u,c,K,W,H,L,I,ue,d,function(Ie){return A({pause:Ie})}),Ot=lt[4],Ct=lt[6],dt="transform "+d+"ms "+f,yt={className:m,onMouseDown:gh?void 0:function(Ie){Ie.stopPropagation(),Ie.button===0&&At(Ie.clientX,Ie.clientY,0)},onTouchStart:gh?function(Ie){Ie.stopPropagation(),At.apply(void 0,JX(Ie))}:void 0,onWheel:function(Ie){if(!Pe){var vt=k2(ue-Ie.deltaY/100/2,_/L);A({stopRaf:!0}),Qe(vt,Ie.clientX,Ie.clientY)}},style:{width:lt[2]+"px",height:lt[3]+"px",opacity:lt[5],objectFit:Ct===4?void 0:lt[7],transform:Z?"rotate("+Z+"deg)":void 0,transition:Ct>2?dt+", opacity "+d+"ms ease, height "+(Ct<4?d/2:Ct>4?d:0)+"ms "+f:void 0}};return pi.createElement("div",{className:"PhotoView__PhotoWrap"+(h?" "+h:""),style:g,onMouseDown:!gh&&k?It:void 0,onTouchStart:gh&&k?function(Ie){return It(Ie.touches[0])}:void 0},pi.createElement("div",{className:"PhotoView__PhotoBox",style:{transform:"matrix("+Ot+", 0, 0, "+Ot+", "+lt[0]+", "+lt[1]+")",transition:X||Oe?void 0:dt,willChange:k?"transform":void 0}},n?pi.createElement(pYe,Yo({src:n,loaded:K,broken:B},yt,{onPhotoLoad:function(Ie){A(Yo({},Ie,Ie.loaded&&F5(Ie.naturalWidth||0,Ie.naturalHeight||0,Z)))},loadingElement:b,brokenElement:v})):i&&i({attrs:yt,scale:Ot,rotate:Z})))}var tY={x:0,touched:!1,pause:!1,lastCX:void 0,lastCY:void 0,bg:void 0,lastBg:void 0,overlay:!0,minimal:!0,scale:1,rotate:0};function bYe(e){var t=e.loop,n=t===void 0?3:t,i=e.speed,r=e.easing,s=e.photoClosable,a=e.maskClosable,l=a===void 0||a,c=e.maskOpacity,u=c===void 0?1:c,d=e.pullClosable,f=d===void 0||d,h=e.bannerVisible,m=h===void 0||h,g=e.overlayRender,b=e.toolbarRender,v=e.className,y=e.maskClassName,x=e.photoClassName,w=e.photoWrapClassName,O=e.loadingElement,S=e.brokenElement,k=e.images,C=e.index,E=C===void 0?0:C,N=e.onIndexChange,A=e.visible,j=e.onClose,T=e.afterClose,R=e.portalContainer,_=vN(tY),D=_[0],M=_[1],P=p.useState(0),L=P[0],F=P[1],I=D.x,z=D.touched,K=D.pause,B=D.lastCX,W=D.lastCY,H=D.bg,X=H===void 0?u:H,ie=D.lastBg,Q=D.overlay,Z=D.minimal,ue=D.scale,Ee=D.rotate,Y=D.onScale,G=D.onRotate,te=e.hasOwnProperty("index"),de=te?E:L,Ce=te?N:F,le=p.useRef(de),fe=k.length,re=k[de],Oe=typeof n=="boolean"?n:fe>n,Pe=function(Ot,Ct){var dt=p.useReducer(function(jt){return!jt},!1)[1],yt=p.useRef(0),Ie=function(jt){var Nt=p.useRef(jt);function ln(He){Nt.current=He}return p.useMemo(function(){(function(He){Ot?(He(Ot),yt.current=1):yt.current=2})(ln)},[jt]),[Nt.current,ln]}(Ot),vt=Ie[1];return[Ie[0],yt.current,function(){dt(),yt.current===2&&(vt(!1),Ct&&Ct()),yt.current=0}]}(A,T),be=Pe[0],Qe=Pe[1],ve=Pe[2];D$(function(){if(be)return M({pause:!0,x:de*-(innerWidth+P0)}),void(le.current=de);M(tY)},[be]);var Ne=ty({close:function(Ot){G&&G(0),M({overlay:!0,lastBg:X}),j(Ot)},changeIndex:function(Ot,Ct){Ct===void 0&&(Ct=!1);var dt=Oe?le.current+(Ot-de):Ot,yt=fe-1,Ie=P$(dt,0,yt),vt=Oe?dt:Ie,jt=innerWidth+P0;M({touched:!1,lastCX:void 0,lastCY:void 0,x:-jt*vt,pause:Ct}),le.current=vt,Ce&&Ce(Oe?Ot<0?yt:Ot>yt?0:Ot:Ie)}}),ne=Ne.close,ye=Ne.changeIndex;function Te(Ot){return Ot?ne():M({overlay:!Q})}function Se(){M({x:-(innerWidth+P0)*de,lastCX:void 0,lastCY:void 0,pause:!0}),le.current=de}function Ke(Ot,Ct,dt,yt){Ot==="x"?function(Ie){if(B!==void 0){var vt=Ie-B,jt=vt;!Oe&&(de===0&&vt>0||de===fe-1&&vt<0)&&(jt=vt/2),M({touched:!0,lastCX:B,x:-(innerWidth+P0)*le.current+jt,pause:!1})}else M({touched:!0,lastCX:Ie,x:I,pause:!1})}(Ct):Ot==="y"&&function(Ie,vt){if(W!==void 0){var jt=u===null?null:P$(u,.01,u-Math.abs(Ie-W)/100/4);M({touched:!0,lastCY:W,bg:vt===1?jt:u,minimal:vt===1})}else M({touched:!0,lastCY:Ie,bg:X,minimal:!0})}(dt,yt)}function it(Ot,Ct){var dt=Ot-(B??Ot),yt=Ct-(W??Ct),Ie=!1;if(dt<-40)ye(de+1);else if(dt>40)ye(de-1);else{var vt=-(innerWidth+P0)*le.current;Math.abs(yt)>100&&Z&&f&&(Ie=!0,ne()),M({touched:!1,x:vt,lastCX:void 0,lastCY:void 0,bg:u,overlay:!!Ie||Q})}}ov("keydown",function(Ot){if(A)switch(Ot.key){case"ArrowLeft":ye(de-1,!0);break;case"ArrowRight":ye(de+1,!0);break;case"Escape":ne()}});var he=function(Ot,Ct,dt){return p.useMemo(function(){var yt=Ot.length;return dt?Ot.concat(Ot).concat(Ot).slice(yt+Ct-1,yt+Ct+2):Ot.slice(Math.max(Ct-1,0),Math.min(Ct+2,yt+1))},[Ot,Ct,dt])}(k,de,Oe);if(!be)return null;var xe=Q&&!Qe,Ae=A?X:ie,qe=Y&&G&&{images:k,index:de,visible:A,onClose:ne,onIndexChange:ye,overlayVisible:xe,overlay:re&&re.overlay,scale:ue,rotate:Ee,onScale:Y,onRotate:G},Me=i?i(Qe):400,At=r?r(Qe):ZX,It=i?i(3):600,lt=r?r(3):ZX;return pi.createElement(rYe,{className:"PhotoView-Portal"+(xe?"":" PhotoView-Slider__clean")+(A?"":" PhotoView-Slider__willClose")+(v?" "+v:""),role:"dialog",onClick:function(Ot){return Ot.stopPropagation()},container:R},A&&pi.createElement(lYe,null),pi.createElement("div",{className:"PhotoView-Slider__Backdrop"+(y?" "+y:"")+(Qe===1?" PhotoView-Slider__fadeIn":Qe===2?" PhotoView-Slider__fadeOut":""),style:{background:Ae?"rgba(0, 0, 0, "+Ae+")":void 0,transitionTimingFunction:At,transitionDuration:(z?0:Me)+"ms",animationDuration:Me+"ms"},onAnimationEnd:ve}),m&&pi.createElement("div",{className:"PhotoView-Slider__BannerWrap"},pi.createElement("div",{className:"PhotoView-Slider__Counter"},de+1," / ",fe),pi.createElement("div",{className:"PhotoView-Slider__BannerRight"},b&&qe&&b(qe),pi.createElement(sYe,{className:"PhotoView-Slider__toolbarIcon",onClick:ne}))),he.map(function(Ot,Ct){var dt=Oe||de!==0?le.current-1+Ct:de+Ct;return pi.createElement(gYe,{key:Oe?Ot.key+"/"+Ot.src+"/"+dt:Ot.key,item:Ot,speed:Me,easing:At,visible:A,onReachMove:Ke,onReachUp:it,onPhotoTap:function(){return Te(s)},onMaskTap:function(){return Te(l)},wrapClassName:w,className:x,style:{left:(innerWidth+P0)*dt+"px",transform:"translate3d("+I+"px, 0px, 0)",transition:z||K?void 0:"transform "+It+"ms "+lt},loadingElement:O,brokenElement:S,onPhotoResize:Se,isActive:le.current===dt,expose:M})}),!gh&&m&&pi.createElement(pi.Fragment,null,(Oe||de!==0)&&pi.createElement("div",{className:"PhotoView-Slider__ArrowLeft",onClick:function(){return ye(de-1,!0)}},pi.createElement(oYe,null)),(Oe||de+1-1){var y=u.slice();return y.splice(v,1,b),void l({images:y})}l(function(x){return{images:x.images.concat(b)}})},remove:function(b){l(function(v){var y=v.images.filter(function(x){return x.key!==b});return{images:y,index:Math.min(y.length-1,f)}})},show:function(b){var v=u.findIndex(function(y){return y.key===b});l({visible:!0,index:v}),i&&i(!0,v,a)}}),m=ty({close:function(){l({visible:!1}),i&&i(!1,f,a)},changeIndex:function(b){l({index:b}),n&&n(b,a)}}),g=p.useMemo(function(){return Yo({},a,h)},[a,h]);return pi.createElement(yEe.Provider,{value:g},t,pi.createElement(bYe,Yo({images:u,visible:d,index:f,onIndexChange:m.changeIndex,onClose:m.close},r)))}var xEe=function(e){var t,n,i=e.src,r=e.render,s=e.overlay,a=e.width,l=e.height,c=e.triggers,u=c===void 0?["onClick"]:c,d=e.children,f=p.useContext(yEe),h=(t=function(){return f.nextId()},(n=p.useRef({sign:!1,fn:void 0}).current).sign||(n.sign=!0,n.fn=t()),n.fn),m=p.useRef(null);p.useImperativeHandle(d==null?void 0:d.ref,function(){return m.current}),p.useEffect(function(){return function(){f.remove(h)}},[]);var g=ty({render:function(v){return r&&r(v)},show:function(v,y){f.show(h),function(x,w){if(d){var O=d.props[x];O&&O(w)}}(v,y)}}),b=p.useMemo(function(){var v={};return u.forEach(function(y){v[y]=g.show.bind(null,y)}),v},[]);return p.useEffect(function(){f.update({key:h,src:i,originRef:m,render:g.render,overlay:s,width:a,height:l})},[i]),d?p.Children.only(p.cloneElement(d,Yo({},b,{ref:m}))):null};function my(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2.5"}),o.jsx("path",{d:"m7.5 9 2.7 2.5L7.5 14M12.7 14h3.8"}),o.jsx("path",{d:"M3.8 7.5h16.4",opacity:".55"})]})}function wEe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2.5"}),o.jsx("path",{d:"M3.8 8h16.4"}),o.jsx("circle",{cx:"6.5",cy:"6.3",r:".65",fill:"currentColor",stroke:"none"}),o.jsx("circle",{cx:"8.8",cy:"6.3",r:".65",fill:"currentColor",stroke:"none"}),o.jsx("path",{d:"m9 15 2.2-4 1.6 2.4 1.1-1.2L16 15H9Z"})]})}function yU(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M12 3.4 19 6v5.3c0 4.3-2.7 7.6-7 9.3-4.3-1.7-7-5-7-9.3V6l7-2.6Z"}),o.jsx("path",{d:"m8.8 12 2 2 4.4-4.4"})]})}function I_(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M3.5 7.7h6.1l1.7 2h9.2v7.5a2.3 2.3 0 0 1-2.3 2.3H5.8a2.3 2.3 0 0 1-2.3-2.3V7.7Z"}),o.jsx("path",{d:"M3.8 7.7V6.8a2.3 2.3 0 0 1 2.3-2.3h3l1.8 2h6.9a2.3 2.3 0 0 1 2.3 2.3v.9"}),o.jsx("path",{d:"M12 13v3M10.5 14.5h3"})]})}function wYe(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"M12 5v14M5 12h14"})})}function nY(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m6.5 11.5 5.5-5.5 5.5 5.5M12 6v12"})})}function iY(e){return o.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",...e,children:o.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1.75",fill:"currentColor"})})}function OYe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2.5"}),o.jsx("circle",{cx:"8.5",cy:"9",r:"1.4"}),o.jsx("path",{d:"m5.5 17 4.2-4.2 2.6 2.4 2.1-2.1 4.1 3.9"})]})}function kYe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M6 3.5h7l5 5v12H6z"}),o.jsx("path",{d:"M13 3.5v5h5M9 13h6M9 16h5"})]})}function SYe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.5",y:"5",width:"13.5",height:"14",rx:"2.5"}),o.jsx("path",{d:"m17 10 3.5-2v8L17 14zM7 8.5h4.5"})]})}function EYe(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m12 3 1.5 4.5L18 9l-4.5 1.5L12 15l-1.5-4.5L6 9l4.5-1.5zM18.5 15.5l.7 2.1 2.1.7-2.1.7-.7 2.1-.7-2.1-2.1-.7 2.1-.7z"})})}function OEe(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m6.5 6.5 11 11M17.5 6.5l-11 11"})})}function L$(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m9 6 6 6-6 6"})})}function CYe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M4.8 8.2A8 8 0 1 1 4 12M4.8 8.2V4.5M4.8 8.2h3.7"}),o.jsx("path",{d:"M12 8v4.5l3 1.8"})]})}function nc(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"M20 12a8 8 0 1 1-2.35-5.65"})})}function TYe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"8",y:"8",width:"11",height:"11",rx:"2"}),o.jsx("path",{d:"M16 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2"})]})}function kEe(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m5 12.5 4.2 4.2L19 7"})})}function V(e,t={}){return mn.t(e,{...t,ns:"adk"})}function Ml(e){const t=new Headers(e);return t.has("Accept-Language")||t.set("Accept-Language",mn.resolvedLanguage||mn.language),t}function $$(){return mn.resolvedLanguage||mn.language}const rY="veadk_auth_qs",AYe=new Set(["view","source","sessionId","artifactSha256","validationReportSha256","projectId","versionId"]);let nO=null;function _Ye(){if(nO!==null)return nO;const e=new URLSearchParams(window.location.search),t=new URLSearchParams,n=new URLSearchParams,i=e.get("view")==="runtime-deploy"&&e.get("source")==="intelligent-development";e.forEach((s,a)=>{(i&&AYe.has(a)?n:t).append(a,s)});const r=t.toString();if(r?(sessionStorage.setItem(rY,r),nO=r):nO=sessionStorage.getItem(rY)??"",r){const s=n.toString();window.history.replaceState(null,"",window.location.pathname+(s?`?${s}`:"")+window.location.hash)}return nO}function ta(e){const t=_Ye();if(!t)return e;const n=new URL(e,window.location.origin);return new URLSearchParams(t).forEach((i,r)=>{n.searchParams.has(r)||n.searchParams.set(r,i)}),/^https?:\/\//i.test(e)?n.toString():n.pathname+n.search+n.hash}const Va=3e4,mr=12e4,vU=1e4;function Ha(e,t=Va){if(t<=0)return e??void 0;const n=AbortSignal.timeout(t);return e?AbortSignal.any([e,n]):n}const xN="veadk_local_user",wN="veadk_local_user_tab",jYe="X-VeADK-OAuth-Refresh-Retry",NYe=[50,250],RYe=/^[A-Za-z0-9]{1,16}$/;function SEe(){try{const e=sessionStorage.getItem(wN);if(e)return e;const t=localStorage.getItem(xN);return t&&sessionStorage.setItem(wN,t),t}catch{try{return localStorage.getItem(xN)}catch{return null}}}function sY(e){try{sessionStorage.setItem(wN,e)}catch{}try{localStorage.setItem(xN,e)}catch{}}function IYe(){try{sessionStorage.removeItem(wN)}catch{}try{localStorage.removeItem(xN)}catch{}}function hu(e){const t=new Headers(e),n=SEe();return n&&t.set("X-VeADK-Local-User",n),t}async function EEe(){let e;try{e=await fetch("/web/auth-config",{headers:Ml({Accept:"application/json"}),signal:Ha(void 0,vU)})}catch(t){throw console.warn("[identity] /web/auth-config is unreachable:",t),new Error(V("identity.loadConfigNetworkFailed"))}if(!e.ok)throw new Error(V("identity.configServiceFailed",{status:e.status}));try{const t=await e.json();if(!Array.isArray(t.providers))throw new TypeError("providers is not an array");return t.providers}catch(t){throw console.warn("[identity] /web/auth-config returned an invalid response:",t),new Error(V("identity.invalidConfigResponse"))}}function PYe(e){const t=window.location.pathname+window.location.search+window.location.hash,n=e.includes("?")?"&":"?";window.location.assign(`${e}${n}redirect=${encodeURIComponent(t)}`)}function DYe(){const e=window.location.pathname+window.location.search+window.location.hash,t=window.open("about:blank","_blank","popup,width=520,height=720");if(!t)return null;try{t.opener=null,t.location.replace(`/oauth2/login?redirect=${encodeURIComponent(e)}`)}catch{return t.close(),null}return t}async function MYe(){const[e,t]=await Promise.all([F$(),EEe()]);return e.status==="unauthenticated"&&t.length>0}function LYe(){window.location.assign("/oauth2/logout")}async function $Ye(){for(let e=0;;e+=1){let t;try{t=await fetch("/oauth2/userinfo",{headers:Ml({Accept:"application/json"}),signal:Ha(void 0,vU)})}catch(i){throw console.warn("[identity] /oauth2/userinfo is unreachable:",i),new Error(V("identity.serviceNetworkFailed"))}const n=NYe[e];if(t.status!==401||t.headers.get(jYe)!=="1"||n===void 0)return t;await new Promise(i=>window.setTimeout(i,n))}}async function F$(){const e=await $Ye();if(e.ok){let n;try{n=await e.json()}catch(r){throw console.warn("[identity] /oauth2/userinfo returned a non-JSON response:",r),new Error(V("identity.invalidServiceResponse"))}return{status:"authenticated",userId:String(n.sub??n.user_id??n.email??""),info:n}}if(e.status===401)return{status:"unauthenticated",userId:"",local:!1};if(e.status!==404)throw new Error(V("identity.serviceFailed",{status:e.status}));const t=SEe();return t?{status:"authenticated",userId:t,info:{name:t},local:!0}:{status:"unauthenticated",userId:"",local:!0}}function FYe(e){if(!e)return"";for(const t of[e.name,e.preferred_username,e.username,e.email])if(typeof t=="string"&&t.trim())return t.trim();return""}function BYe(e){const t=e==null?void 0:e.picture;return typeof t=="string"?t.trim():""}const B$="veadk:authentication-required";let Bk=null,ZO=null;function UYe(e){if(!e.redirected||!e.url)return!1;try{const t=new URL(e.url);return t.pathname.includes("/authorize")||t.pathname.includes("/oauth2/login")||t.hostname.includes(".userpool.auth.")}catch{return!1}}function QYe(e){Bk||(Bk=new Promise(n=>{ZO=n}),window.dispatchEvent(new Event(B$)));const t=Bk;return e?e.aborted?Promise.reject(e.reason??new Error("Request aborted")):new Promise((n,i)=>{const r=()=>i(e.reason??new Error("Request aborted"));e.addEventListener("abort",r,{once:!0}),t.then(()=>{e.removeEventListener("abort",r),n()},s=>{e.removeEventListener("abort",r),i(s)})}):t}function zYe(){return Bk!==null}function VYe(){ZO==null||ZO(),ZO=null,Bk=null}async function UI(e,t){var i;const n=await e.text().catch(()=>"");try{return JSON.parse(n)}catch{const r=((i=e.headers.get("content-type"))==null?void 0:i.split(";",1)[0])||V("common.contentTypeMissing"),s=n.trim().slice(0,2e3),a=s?` + `),()=>{document.head.removeChild(d)}},[t]),o.jsx(Rqe,{isPresent:t,childRef:i,sizeRef:r,children:p.cloneElement(e,{ref:i})})}const Pqe=({children:e,initial:t,isPresent:n,onExitComplete:i,custom:r,presenceAffectsLayout:s,mode:a})=>{const l=RI(Dqe),c=p.useId(),u=p.useCallback(f=>{l.set(f,!0);for(const h of l.values())if(!h)return;i&&i()},[l,i]),d=p.useMemo(()=>({id:c,initial:t,isPresent:n,custom:r,onExitComplete:u,register:f=>(l.set(f,!1),()=>l.delete(f))}),s?[Math.random(),u]:[n,u]);return p.useMemo(()=>{l.forEach((f,h)=>l.set(h,!1))},[n]),p.useEffect(()=>{!n&&!l.size&&i&&i()},[n]),a==="popLayout"&&(e=o.jsx(Iqe,{isPresent:n,children:e})),o.jsx(II.Provider,{value:d,children:e})};function Dqe(){return new Map}function Qke(e=!0){const t=p.useContext(II);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:i,register:r}=t,s=p.useId();p.useEffect(()=>{e&&r(s)},[e]);const a=p.useCallback(()=>e&&i&&i(s),[s,i,e]);return!n&&i?[!1,a]:[!0]}const v2=e=>e.key||"";function LG(e){const t=[];return p.Children.forEach(e,n=>{p.isValidElement(n)&&t.push(n)}),t}const B7=typeof window<"u",zke=B7?p.useLayoutEffect:p.useEffect,Td=({children:e,custom:t,initial:n=!0,onExitComplete:i,presenceAffectsLayout:r=!0,mode:s="sync",propagate:a=!1})=>{const[l,c]=Qke(a),u=p.useMemo(()=>LG(e),[e]),d=a&&!l?[]:u.map(v2),f=p.useRef(!0),h=p.useRef(u),m=RI(()=>new Map),[g,b]=p.useState(u),[v,y]=p.useState(u);zke(()=>{f.current=!1,h.current=u;for(let O=0;O{const S=v2(O),k=a&&!l?!1:u===v||d.includes(S),C=()=>{if(m.has(S))m.set(S,!0);else return;let E=!0;m.forEach(N=>{N||(E=!1)}),E&&(w==null||w(),y(h.current),a&&(c==null||c()),i&&i())};return o.jsx(Pqe,{isPresent:k,initial:!f.current||n?void 0:!1,custom:k?void 0:t,presenceAffectsLayout:r,mode:s,onExitComplete:k?void 0:C,children:O},S)})})},tu=e=>e;let Vke=tu;const Mqe={useManualTiming:!1};function Lqe(e){let t=new Set,n=new Set,i=!1,r=!1;const s=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function l(u){s.has(u)&&(c.schedule(u),e()),u(a)}const c={schedule:(u,d=!1,f=!1)=>{const m=f&&i?t:n;return d&&s.add(u),m.has(u)||m.add(u),u},cancel:u=>{n.delete(u),s.delete(u)},process:u=>{if(a=u,i){r=!0;return}i=!0,[t,n]=[n,t],t.forEach(l),t.clear(),i=!1,r&&(r=!1,c.process(u))}};return c}const x2=["read","resolveKeyframes","update","preRender","render","postRender"],$qe=40;function Hke(e,t){let n=!1,i=!0;const r={delta:0,timestamp:0,isProcessing:!1},s=()=>n=!0,a=x2.reduce((y,x)=>(y[x]=Lqe(s),y),{}),{read:l,resolveKeyframes:c,update:u,preRender:d,render:f,postRender:h}=a,m=()=>{const y=performance.now();n=!1,r.delta=i?1e3/60:Math.max(Math.min(y-r.timestamp,$qe),1),r.timestamp=y,r.isProcessing=!0,l.process(r),c.process(r),u.process(r),d.process(r),f.process(r),h.process(r),r.isProcessing=!1,n&&t&&(i=!1,e(m))},g=()=>{n=!0,i=!0,r.isProcessing||e(m)};return{schedule:x2.reduce((y,x)=>{const w=a[x];return y[x]=(O,S=!1,k=!1)=>(n||g(),w.schedule(O,S,k)),y},{}),cancel:y=>{for(let x=0;x$G[e].some(n=>!!t[n])};function Fqe(e){for(const t in e)Vx[t]={...Vx[t],...e[t]}}const Bqe=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function dN(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||Bqe.has(e)}let Wke=e=>!dN(e);function Kke(e){e&&(Wke=t=>t.startsWith("on")?!dN(t):e(t))}try{Kke(require("@emotion/is-prop-valid").default)}catch{}function Uqe(e,t,n){const i={};for(const r in e)r==="values"&&typeof e.values=="object"||(Wke(r)||n===!0&&dN(r)||!t&&!dN(r)||e.draggable&&r.startsWith("onDrag"))&&(i[r]=e[r]);return i}function Qqe({children:e,isValidProp:t,...n}){t&&Kke(t),n={...p.useContext(LS),...n},n.isStatic=RI(()=>n.isStatic);const i=p.useMemo(()=>n,[JSON.stringify(n.transition),n.transformPagePoint,n.reducedMotion]);return o.jsx(LS.Provider,{value:i,children:e})}function zqe(e){if(typeof Proxy>"u")return e;const t=new Map,n=(...i)=>e(...i);return new Proxy(n,{get:(i,r)=>r==="create"?e:(t.has(r)||t.set(r,e(r)),t.get(r))})}const PI=p.createContext({});function $S(e){return typeof e=="string"||Array.isArray(e)}function DI(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}const U7=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Q7=["initial",...U7];function MI(e){return DI(e.animate)||Q7.some(t=>$S(e[t]))}function Gke(e){return!!(MI(e)||e.variants)}function Vqe(e,t){if(MI(e)){const{initial:n,animate:i}=e;return{initial:n===!1||$S(n)?n:void 0,animate:$S(i)?i:void 0}}return e.inherit!==!1?t:{}}function Hqe(e){const{initial:t,animate:n}=Vqe(e,p.useContext(PI));return p.useMemo(()=>({initial:t,animate:n}),[FG(t),FG(n)])}function FG(e){return Array.isArray(e)?e.join(" "):e}const qqe=Symbol.for("motionComponentSymbol");function Nv(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function Wqe(e,t,n){return p.useCallback(i=>{i&&e.onMount&&e.onMount(i),t&&(i?t.mount(i):t.unmount()),n&&(typeof n=="function"?n(i):Nv(n)&&(n.current=i))},[t])}const z7=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),Kqe="framerAppearId",Xke="data-"+z7(Kqe),{schedule:V7}=Hke(queueMicrotask,!1),Yke=p.createContext({});function Gqe(e,t,n,i,r){var s,a;const{visualElement:l}=p.useContext(PI),c=p.useContext(qke),u=p.useContext(II),d=p.useContext(LS).reducedMotion,f=p.useRef(null);i=i||c.renderer,!f.current&&i&&(f.current=i(e,{visualState:t,parent:l,props:n,presenceContext:u,blockInitialAnimation:u?u.initial===!1:!1,reducedMotionConfig:d}));const h=f.current,m=p.useContext(Yke);h&&!h.projection&&r&&(h.type==="html"||h.type==="svg")&&Xqe(f.current,n,r,m);const g=p.useRef(!1);p.useInsertionEffect(()=>{h&&g.current&&h.update(n,u)});const b=n[Xke],v=p.useRef(!!b&&!(!((s=window.MotionHandoffIsComplete)===null||s===void 0)&&s.call(window,b))&&((a=window.MotionHasOptimisedAnimation)===null||a===void 0?void 0:a.call(window,b)));return zke(()=>{h&&(g.current=!0,window.MotionIsMounted=!0,h.updateFeatures(),V7.render(h.render),v.current&&h.animationState&&h.animationState.animateChanges())}),p.useEffect(()=>{h&&(!v.current&&h.animationState&&h.animationState.animateChanges(),v.current&&(queueMicrotask(()=>{var y;(y=window.MotionHandoffMarkAsComplete)===null||y===void 0||y.call(window,b)}),v.current=!1))}),h}function Xqe(e,t,n,i){const{layoutId:r,layout:s,drag:a,dragConstraints:l,layoutScroll:c,layoutRoot:u}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:Zke(e.parent)),e.projection.setOptions({layoutId:r,layout:s,alwaysMeasureLayout:!!a||l&&Nv(l),visualElement:e,animationType:typeof s=="string"?s:"both",initialPromotionConfig:i,layoutScroll:c,layoutRoot:u})}function Zke(e){if(e)return e.options.allowProjection!==!1?e.projection:Zke(e.parent)}function Yqe({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:i,Component:r}){var s,a;e&&Fqe(e);function l(u,d){let f;const h={...p.useContext(LS),...u,layoutId:Zqe(u)},{isStatic:m}=h,g=Hqe(u),b=i(u,m);if(!m&&B7){Jqe();const v=eWe(h);f=v.MeasureLayout,g.visualElement=Gqe(r,b,h,t,v.ProjectionNode)}return o.jsxs(PI.Provider,{value:g,children:[f&&g.visualElement?o.jsx(f,{visualElement:g.visualElement,...h}):null,n(r,u,Wqe(b,g.visualElement,d),b,m,g.visualElement)]})}l.displayName=`motion.${typeof r=="string"?r:`create(${(a=(s=r.displayName)!==null&&s!==void 0?s:r.name)!==null&&a!==void 0?a:""})`}`;const c=p.forwardRef(l);return c[qqe]=r,c}function Zqe({layoutId:e}){const t=p.useContext(F7).id;return t&&e!==void 0?t+"-"+e:e}function Jqe(e,t){p.useContext(qke).strict}function eWe(e){const{drag:t,layout:n}=Vx;if(!t&&!n)return{};const i={...t,...n};return{MeasureLayout:t!=null&&t.isEnabled(e)||n!=null&&n.isEnabled(e)?i.MeasureLayout:void 0,ProjectionNode:i.ProjectionNode}}const tWe=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function H7(e){return typeof e!="string"||e.includes("-")?!1:!!(tWe.indexOf(e)>-1||/[A-Z]/u.test(e))}function BG(e){const t=[{},{}];return e==null||e.values.forEach((n,i)=>{t[0][i]=n.get(),t[1][i]=n.getVelocity()}),t}function q7(e,t,n,i){if(typeof t=="function"){const[r,s]=BG(i);t=t(n!==void 0?n:e.custom,r,s)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[r,s]=BG(i);t=t(n!==void 0?n:e.custom,r,s)}return t}const v$=e=>Array.isArray(e),nWe=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),iWe=e=>v$(e)?e[e.length-1]||0:e,sl=e=>!!(e&&e.getVelocity);function j_(e){const t=sl(e)?e.get():e;return nWe(t)?t.toValue():t}function rWe({scrapeMotionValuesFromProps:e,createRenderState:t,onUpdate:n},i,r,s){const a={latestValues:sWe(i,r,s,e),renderState:t()};return n&&(a.onMount=l=>n({props:i,current:l,...a}),a.onUpdate=l=>n(l)),a}const Jke=e=>(t,n)=>{const i=p.useContext(PI),r=p.useContext(II),s=()=>rWe(e,t,i,r);return n?s():RI(s)};function sWe(e,t,n,i){const r={},s=i(e,{});for(const h in s)r[h]=j_(s[h]);let{initial:a,animate:l}=e;const c=MI(e),u=Gke(e);t&&u&&!c&&e.inherit!==!1&&(a===void 0&&(a=t.initial),l===void 0&&(l=t.animate));let d=n?n.initial===!1:!1;d=d||a===!1;const f=d?l:a;if(f&&typeof f!="boolean"&&!DI(f)){const h=Array.isArray(f)?f:[f];for(let m=0;mt=>typeof t=="string"&&t.startsWith(e),tSe=eSe("--"),oWe=eSe("var(--"),W7=e=>oWe(e)?aWe.test(e.split("/*")[0].trim()):!1,aWe=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,nSe=(e,t)=>t&&typeof e=="number"?t.transform(e):e,lp=(e,t,n)=>n>t?t:ntypeof e=="number",parse:parseFloat,transform:e=>e},FS={...$w,transform:e=>lp(0,1,e)},w2={...$w,default:1},yC=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),tm=yC("deg"),jf=yC("%"),Ln=yC("px"),lWe=yC("vh"),cWe=yC("vw"),UG={...jf,parse:e=>jf.parse(e)/100,transform:e=>jf.transform(e*100)},uWe={borderWidth:Ln,borderTopWidth:Ln,borderRightWidth:Ln,borderBottomWidth:Ln,borderLeftWidth:Ln,borderRadius:Ln,radius:Ln,borderTopLeftRadius:Ln,borderTopRightRadius:Ln,borderBottomRightRadius:Ln,borderBottomLeftRadius:Ln,width:Ln,maxWidth:Ln,height:Ln,maxHeight:Ln,top:Ln,right:Ln,bottom:Ln,left:Ln,padding:Ln,paddingTop:Ln,paddingRight:Ln,paddingBottom:Ln,paddingLeft:Ln,margin:Ln,marginTop:Ln,marginRight:Ln,marginBottom:Ln,marginLeft:Ln,backgroundPositionX:Ln,backgroundPositionY:Ln},dWe={rotate:tm,rotateX:tm,rotateY:tm,rotateZ:tm,scale:w2,scaleX:w2,scaleY:w2,scaleZ:w2,skew:tm,skewX:tm,skewY:tm,distance:Ln,translateX:Ln,translateY:Ln,translateZ:Ln,x:Ln,y:Ln,z:Ln,perspective:Ln,transformPerspective:Ln,opacity:FS,originX:UG,originY:UG,originZ:Ln},QG={...$w,transform:Math.round},K7={...uWe,...dWe,zIndex:QG,size:Ln,fillOpacity:FS,strokeOpacity:FS,numOctaves:QG},fWe={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},hWe=Lw.length;function pWe(e,t,n){let i="",r=!0;for(let s=0;s({style:{},transform:{},transformOrigin:{},vars:{}}),iSe=()=>({...Y7(),attrs:{}}),Z7=e=>typeof e=="string"&&e.toLowerCase()==="svg";function rSe(e,{style:t,vars:n},i,r){Object.assign(e.style,t,r&&r.getProjectionStyles(i));for(const s in n)e.style.setProperty(s,n[s])}const sSe=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function oSe(e,t,n,i){rSe(e,t,void 0,i);for(const r in t.attrs)e.setAttribute(sSe.has(r)?r:z7(r),t.attrs[r])}const fN={};function vWe(e){Object.assign(fN,e)}function aSe(e,{layout:t,layoutId:n}){return Hy.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!fN[e]||e==="opacity")}function J7(e,t,n){var i;const{style:r}=e,s={};for(const a in r)(sl(r[a])||t.style&&sl(t.style[a])||aSe(a,e)||((i=n==null?void 0:n.getValue(a))===null||i===void 0?void 0:i.liveStyle)!==void 0)&&(s[a]=r[a]);return s}function lSe(e,t,n){const i=J7(e,t,n);for(const r in e)if(sl(e[r])||sl(t[r])){const s=Lw.indexOf(r)!==-1?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r;i[s]=e[r]}return i}function xWe(e,t){try{t.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{t.dimensions={x:0,y:0,width:0,height:0}}}const VG=["x","y","width","height","cx","cy","r"],wWe={useVisualState:Jke({scrapeMotionValuesFromProps:lSe,createRenderState:iSe,onUpdate:({props:e,prevProps:t,current:n,renderState:i,latestValues:r})=>{if(!n)return;let s=!!e.drag;if(!s){for(const l in r)if(Hy.has(l)){s=!0;break}}if(!s)return;let a=!t;if(t)for(let l=0;l{xWe(n,i),bs.render(()=>{X7(i,r,Z7(n.tagName),e.transformTemplate),oSe(n,i)})})}})},OWe={useVisualState:Jke({scrapeMotionValuesFromProps:J7,createRenderState:Y7})};function cSe(e,t,n){for(const i in t)!sl(t[i])&&!aSe(i,n)&&(e[i]=t[i])}function kWe({transformTemplate:e},t){return p.useMemo(()=>{const n=Y7();return G7(n,t,e),Object.assign({},n.vars,n.style)},[t])}function SWe(e,t){const n=e.style||{},i={};return cSe(i,n,e),Object.assign(i,kWe(e,t)),i}function EWe(e,t){const n={},i=SWe(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=i,n}function CWe(e,t,n,i){const r=p.useMemo(()=>{const s=iSe();return X7(s,t,Z7(i),e.transformTemplate),{...s.attrs,style:{...s.style}}},[t]);if(e.style){const s={};cSe(s,e.style,e),r.style={...s,...r.style}}return r}function TWe(e=!1){return(n,i,r,{latestValues:s},a)=>{const c=(H7(n)?CWe:EWe)(i,s,a,n),u=Uqe(i,typeof n=="string",e),d=n!==p.Fragment?{...u,...c,ref:r}:{},{children:f}=i,h=p.useMemo(()=>sl(f)?f.get():f,[f]);return p.createElement(n,{...d,children:h})}}function AWe(e,t){return function(i,{forwardMotionProps:r}={forwardMotionProps:!1}){const a={...H7(i)?wWe:OWe,preloadedFeatures:e,useRender:TWe(r),createVisualElement:t,Component:i};return Yqe(a)}}function uSe(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let i=0;i(N_===void 0&&Nf.set(ja.isProcessing||Mqe.useManualTiming?ja.timestamp:performance.now()),N_),set:e=>{N_=e,queueMicrotask(_We)}};function tU(e,t){e.indexOf(t)===-1&&e.push(t)}function nU(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class iU{constructor(){this.subscriptions=[]}add(t){return tU(this.subscriptions,t),()=>nU(this.subscriptions,t)}notify(t,n,i){const r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](t,n,i);else for(let s=0;s!isNaN(parseFloat(e));class NWe{constructor(t,n={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(i,r=!0)=>{const s=Nf.now();this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(i),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),r&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=Nf.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=jWe(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new iU);const i=this.events[t].add(n);return t==="change"?()=>{i(),bs.read(()=>{this.events.change.getSize()||this.stop()})}:i}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t,n=!0){!n||!this.passiveEffect?this.updateAndNotify(t,n):this.passiveEffect(t,this.updateAndNotify)}setWithVelocity(t,n,i){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-i}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=Nf.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>HG)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,HG);return fSe(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function BS(e,t){return new NWe(e,t)}function RWe(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,BS(n))}function IWe(e,t){const n=LI(e,t);let{transitionEnd:i={},transition:r={},...s}=n||{};s={...s,...i};for(const a in s){const l=iWe(s[a]);RWe(e,a,l)}}function PWe(e){return!!(sl(e)&&e.add)}function x$(e,t){const n=e.getValue("willChange");if(PWe(n))return n.add(t)}function hSe(e){return e.props[Xke]}function rU(e){let t;return()=>(t===void 0&&(t=e()),t)}const DWe=rU(()=>window.ScrollTimeline!==void 0);class MWe{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map(t=>"finished"in t?t.finished:t))}getAll(t){return this.animations[0][t]}setAll(t,n){for(let i=0;i{if(DWe()&&r.attachTimeline)return r.attachTimeline(t);if(typeof n=="function")return n(r)});return()=>{i.forEach((r,s)=>{r&&r(),this.animations[s].stop()})}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let n=0;nn[t]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class LWe extends MWe{then(t,n){return Promise.all(this.animations).then(t).catch(n)}}const Hh=e=>e*1e3,qh=e=>e/1e3;function sU(e){return typeof e=="function"}function qG(e,t){e.timeline=t,e.onfinish=null}const oU=e=>Array.isArray(e)&&typeof e[0]=="number",$We={linearEasing:void 0};function FWe(e,t){const n=rU(e);return()=>{var i;return(i=$We[t])!==null&&i!==void 0?i:n()}}const hN=FWe(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Hx=(e,t,n)=>{const i=t-e;return i===0?1:(n-e)/i},pSe=(e,t,n=10)=>{let i="";const r=Math.max(Math.round(t/n),2);for(let s=0;s`cubic-bezier(${e}, ${t}, ${n}, ${i})`,w$={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:GO([0,.65,.55,1]),circOut:GO([.55,0,1,.45]),backIn:GO([.31,.01,.66,-.59]),backOut:GO([.33,1.53,.69,.99])};function gSe(e,t){if(e)return typeof e=="function"&&hN()?pSe(e,t):oU(e)?GO(e):Array.isArray(e)?e.map(n=>gSe(n,t)||w$.easeOut):w$[e]}const bSe=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,BWe=1e-7,UWe=12;function QWe(e,t,n,i,r){let s,a,l=0;do a=t+(n-t)/2,s=bSe(a,i,r)-e,s>0?n=a:t=a;while(Math.abs(s)>BWe&&++lQWe(s,0,1,e,n);return s=>s===0||s===1?s:bSe(r(s),t,i)}const ySe=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,vSe=e=>t=>1-e(1-t),xSe=vC(.33,1.53,.69,.99),aU=vSe(xSe),wSe=ySe(aU),OSe=e=>(e*=2)<1?.5*aU(e):.5*(2-Math.pow(2,-10*(e-1))),lU=e=>1-Math.sin(Math.acos(e)),kSe=vSe(lU),SSe=ySe(lU),ESe=e=>/^0[^.\s]+$/u.test(e);function zWe(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||ESe(e):!0}const Mk=e=>Math.round(e*1e5)/1e5,cU=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function VWe(e){return e==null}const HWe=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,uU=(e,t)=>n=>!!(typeof n=="string"&&HWe.test(n)&&n.startsWith(e)||t&&!VWe(n)&&Object.prototype.hasOwnProperty.call(n,t)),CSe=(e,t,n)=>i=>{if(typeof i!="string")return i;const[r,s,a,l]=i.match(cU);return{[e]:parseFloat(r),[t]:parseFloat(s),[n]:parseFloat(a),alpha:l!==void 0?parseFloat(l):1}},qWe=e=>lp(0,255,e),C5={...$w,transform:e=>Math.round(qWe(e))},Pb={test:uU("rgb","red"),parse:CSe("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:i=1})=>"rgba("+C5.transform(e)+", "+C5.transform(t)+", "+C5.transform(n)+", "+Mk(FS.transform(i))+")"};function WWe(e){let t="",n="",i="",r="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),i=e.substring(5,7),r=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),i=e.substring(3,4),r=e.substring(4,5),t+=t,n+=n,i+=i,r+=r),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(i,16),alpha:r?parseInt(r,16)/255:1}}const O$={test:uU("#"),parse:WWe,transform:Pb.transform},Rv={test:uU("hsl","hue"),parse:CSe("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:i=1})=>"hsla("+Math.round(e)+", "+jf.transform(Mk(t))+", "+jf.transform(Mk(n))+", "+Mk(FS.transform(i))+")"},nl={test:e=>Pb.test(e)||O$.test(e)||Rv.test(e),parse:e=>Pb.test(e)?Pb.parse(e):Rv.test(e)?Rv.parse(e):O$.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Pb.transform(e):Rv.transform(e)},KWe=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function GWe(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(cU))===null||t===void 0?void 0:t.length)||0)+(((n=e.match(KWe))===null||n===void 0?void 0:n.length)||0)>0}const TSe="number",ASe="color",XWe="var",YWe="var(",WG="${}",ZWe=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function US(e){const t=e.toString(),n=[],i={color:[],number:[],var:[]},r=[];let s=0;const l=t.replace(ZWe,c=>(nl.test(c)?(i.color.push(s),r.push(ASe),n.push(nl.parse(c))):c.startsWith(YWe)?(i.var.push(s),r.push(XWe),n.push(c)):(i.number.push(s),r.push(TSe),n.push(parseFloat(c))),++s,WG)).split(WG);return{values:n,split:l,indexes:i,types:r}}function _Se(e){return US(e).values}function jSe(e){const{split:t,types:n}=US(e),i=t.length;return r=>{let s="";for(let a=0;atypeof e=="number"?0:e;function eKe(e){const t=_Se(e);return jSe(e)(t.map(JWe))}const ig={test:GWe,parse:_Se,createTransformer:jSe,getAnimatableNone:eKe},tKe=new Set(["brightness","contrast","saturate","opacity"]);function nKe(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[i]=n.match(cU)||[];if(!i)return e;const r=n.replace(i,"");let s=tKe.has(t)?1:0;return i!==n&&(s*=100),t+"("+s+r+")"}const iKe=/\b([a-z-]*)\(.*?\)/gu,k$={...ig,getAnimatableNone:e=>{const t=e.match(iKe);return t?t.map(nKe).join(" "):e}},rKe={...K7,color:nl,backgroundColor:nl,outlineColor:nl,fill:nl,stroke:nl,borderColor:nl,borderTopColor:nl,borderRightColor:nl,borderBottomColor:nl,borderLeftColor:nl,filter:k$,WebkitFilter:k$},dU=e=>rKe[e];function NSe(e,t){let n=dU(e);return n!==k$&&(n=ig),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const sKe=new Set(["auto","none","0"]);function oKe(e,t,n){let i=0,r;for(;ie===$w||e===Ln,GG=(e,t)=>parseFloat(e.split(", ")[t]),XG=(e,t)=>(n,{transform:i})=>{if(i==="none"||!i)return 0;const r=i.match(/^matrix3d\((.+)\)$/u);if(r)return GG(r[1],t);{const s=i.match(/^matrix\((.+)\)$/u);return s?GG(s[1],e):0}},aKe=new Set(["x","y","z"]),lKe=Lw.filter(e=>!aKe.has(e));function cKe(e){const t=[];return lKe.forEach(n=>{const i=e.getValue(n);i!==void 0&&(t.push([n,i.get()]),i.set(n.startsWith("scale")?1:0))}),t}const qx={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:XG(4,13),y:XG(5,14)};qx.translateX=qx.x;qx.translateY=qx.y;const ey=new Set;let S$=!1,E$=!1;function RSe(){if(E$){const e=Array.from(ey).filter(i=>i.needsMeasurement),t=new Set(e.map(i=>i.element)),n=new Map;t.forEach(i=>{const r=cKe(i);r.length&&(n.set(i,r),i.render())}),e.forEach(i=>i.measureInitialState()),t.forEach(i=>{i.render();const r=n.get(i);r&&r.forEach(([s,a])=>{var l;(l=i.getValue(s))===null||l===void 0||l.set(a)})}),e.forEach(i=>i.measureEndState()),e.forEach(i=>{i.suspendedScrollY!==void 0&&window.scrollTo(0,i.suspendedScrollY)})}E$=!1,S$=!1,ey.forEach(e=>e.complete()),ey.clear()}function ISe(){ey.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(E$=!0)})}function uKe(){ISe(),RSe()}class fU{constructor(t,n,i,r,s,a=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=i,this.motionValue=r,this.element=s,this.isAsync=a}scheduleResolve(){this.isScheduled=!0,this.isAsync?(ey.add(this),S$||(S$=!0,bs.read(ISe),bs.resolveKeyframes(RSe))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:i,motionValue:r}=this;for(let s=0;s/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),dKe=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function fKe(e){const t=dKe.exec(e);if(!t)return[,];const[,n,i,r]=t;return[`--${n??i}`,r]}function DSe(e,t,n=1){const[i,r]=fKe(e);if(!i)return;const s=window.getComputedStyle(t).getPropertyValue(i);if(s){const a=s.trim();return PSe(a)?parseFloat(a):a}return W7(r)?DSe(r,t,n+1):r}const MSe=e=>t=>t.test(e),hKe={test:e=>e==="auto",parse:e=>e},LSe=[$w,Ln,jf,tm,cWe,lWe,hKe],YG=e=>LSe.find(MSe(e));class $Se extends fU{constructor(t,n,i,r,s){super(t,n,i,r,s,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:i}=this;if(!n||!n.current)return;super.readKeyframes();for(let c=0;c{n.getValue(c).set(u)}),this.resolveNoneKeyframes()}}const ZG=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(ig.test(e)||e==="0")&&!e.startsWith("url("));function pKe(e){const t=e[0];if(e.length===1)return!0;for(let n=0;ne!==null;function $I(e,{repeat:t,repeatType:n="loop"},i){const r=e.filter(gKe),s=t&&n!=="loop"&&t%2===1?0:r.length-1;return!s||i===void 0?r[s]:i}const bKe=40;class FSe{constructor({autoplay:t=!0,delay:n=0,type:i="keyframes",repeat:r=0,repeatDelay:s=0,repeatType:a="loop",...l}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=Nf.now(),this.options={autoplay:t,delay:n,type:i,repeat:r,repeatDelay:s,repeatType:a,...l},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>bKe?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&uKe(),this._resolved}onKeyframesResolved(t,n){this.resolvedAt=Nf.now(),this.hasAttemptedResolve=!0;const{name:i,type:r,velocity:s,delay:a,onComplete:l,onUpdate:c,isGenerator:u}=this.options;if(!u&&!mKe(t,i,r,s))if(a)this.options.duration=0;else{c&&c($I(t,this.options,n)),l&&l(),this.resolveFinishedPromise();return}const d=this.initPlayback(t,n);d!==!1&&(this._resolved={keyframes:t,finalKeyframe:n,...d},this.onPostResolved())}onPostResolved(){}then(t,n){return this.currentFinishedPromise.then(t,n)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(t=>{this.resolveFinishedPromise=t})}}const C$=2e4;function BSe(e){let t=0;const n=50;let i=e.next(t);for(;!i.done&&t=C$?1/0:t}const Fs=(e,t,n)=>e+(t-e)*n;function T5(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function yKe({hue:e,saturation:t,lightness:n,alpha:i}){e/=360,t/=100,n/=100;let r=0,s=0,a=0;if(!t)r=s=a=n;else{const l=n<.5?n*(1+t):n+t-n*t,c=2*n-l;r=T5(c,l,e+1/3),s=T5(c,l,e),a=T5(c,l,e-1/3)}return{red:Math.round(r*255),green:Math.round(s*255),blue:Math.round(a*255),alpha:i}}function pN(e,t){return n=>n>0?t:e}const A5=(e,t,n)=>{const i=e*e,r=n*(t*t-i)+i;return r<0?0:Math.sqrt(r)},vKe=[O$,Pb,Rv],xKe=e=>vKe.find(t=>t.test(e));function JG(e){const t=xKe(e);if(!t)return!1;let n=t.parse(e);return t===Rv&&(n=yKe(n)),n}const eX=(e,t)=>{const n=JG(e),i=JG(t);if(!n||!i)return pN(e,t);const r={...n};return s=>(r.red=A5(n.red,i.red,s),r.green=A5(n.green,i.green,s),r.blue=A5(n.blue,i.blue,s),r.alpha=Fs(n.alpha,i.alpha,s),Pb.transform(r))},wKe=(e,t)=>n=>t(e(n)),xC=(...e)=>e.reduce(wKe),T$=new Set(["none","hidden"]);function OKe(e,t){return T$.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function kKe(e,t){return n=>Fs(e,t,n)}function hU(e){return typeof e=="number"?kKe:typeof e=="string"?W7(e)?pN:nl.test(e)?eX:CKe:Array.isArray(e)?USe:typeof e=="object"?nl.test(e)?eX:SKe:pN}function USe(e,t){const n=[...e],i=n.length,r=e.map((s,a)=>hU(s)(s,t[a]));return s=>{for(let a=0;a{for(const s in i)n[s]=i[s](r);return n}}function EKe(e,t){var n;const i=[],r={color:0,var:0,number:0};for(let s=0;s{const n=ig.createTransformer(t),i=US(e),r=US(t);return i.indexes.var.length===r.indexes.var.length&&i.indexes.color.length===r.indexes.color.length&&i.indexes.number.length>=r.indexes.number.length?T$.has(e)&&!r.values.length||T$.has(t)&&!i.values.length?OKe(e,t):xC(USe(EKe(i,r),r.values),n):pN(e,t)};function QSe(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?Fs(e,t,n):hU(e)(e,t)}const TKe=5;function zSe(e,t,n){const i=Math.max(t-TKe,0);return fSe(n-e(i),t-i)}const Ws={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},_5=.001;function AKe({duration:e=Ws.duration,bounce:t=Ws.bounce,velocity:n=Ws.velocity,mass:i=Ws.mass}){let r,s,a=1-t;a=lp(Ws.minDamping,Ws.maxDamping,a),e=lp(Ws.minDuration,Ws.maxDuration,qh(e)),a<1?(r=u=>{const d=u*a,f=d*e,h=d-n,m=A$(u,a),g=Math.exp(-f);return _5-h/m*g},s=u=>{const f=u*a*e,h=f*n+n,m=Math.pow(a,2)*Math.pow(u,2)*e,g=Math.exp(-f),b=A$(Math.pow(u,2),a);return(-r(u)+_5>0?-1:1)*((h-m)*g)/b}):(r=u=>{const d=Math.exp(-u*e),f=(u-n)*e+1;return-_5+d*f},s=u=>{const d=Math.exp(-u*e),f=(n-u)*(e*e);return d*f});const l=5/e,c=jKe(r,s,l);if(e=Hh(e),isNaN(c))return{stiffness:Ws.stiffness,damping:Ws.damping,duration:e};{const u=Math.pow(c,2)*i;return{stiffness:u,damping:a*2*Math.sqrt(i*u),duration:e}}}const _Ke=12;function jKe(e,t,n){let i=n;for(let r=1;r<_Ke;r++)i=i-e(i)/t(i);return i}function A$(e,t){return e*Math.sqrt(1-t*t)}const NKe=["duration","bounce"],RKe=["stiffness","damping","mass"];function tX(e,t){return t.some(n=>e[n]!==void 0)}function IKe(e){let t={velocity:Ws.velocity,stiffness:Ws.stiffness,damping:Ws.damping,mass:Ws.mass,isResolvedFromDuration:!1,...e};if(!tX(e,RKe)&&tX(e,NKe))if(e.visualDuration){const n=e.visualDuration,i=2*Math.PI/(n*1.2),r=i*i,s=2*lp(.05,1,1-(e.bounce||0))*Math.sqrt(r);t={...t,mass:Ws.mass,stiffness:r,damping:s}}else{const n=AKe(e);t={...t,...n,mass:Ws.mass},t.isResolvedFromDuration=!0}return t}function VSe(e=Ws.visualDuration,t=Ws.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:i,restDelta:r}=n;const s=n.keyframes[0],a=n.keyframes[n.keyframes.length-1],l={done:!1,value:s},{stiffness:c,damping:u,mass:d,duration:f,velocity:h,isResolvedFromDuration:m}=IKe({...n,velocity:-qh(n.velocity||0)}),g=h||0,b=u/(2*Math.sqrt(c*d)),v=a-s,y=qh(Math.sqrt(c/d)),x=Math.abs(v)<5;i||(i=x?Ws.restSpeed.granular:Ws.restSpeed.default),r||(r=x?Ws.restDelta.granular:Ws.restDelta.default);let w;if(b<1){const S=A$(y,b);w=k=>{const C=Math.exp(-b*y*k);return a-C*((g+b*y*v)/S*Math.sin(S*k)+v*Math.cos(S*k))}}else if(b===1)w=S=>a-Math.exp(-y*S)*(v+(g+y*v)*S);else{const S=y*Math.sqrt(b*b-1);w=k=>{const C=Math.exp(-b*y*k),E=Math.min(S*k,300);return a-C*((g+b*y*v)*Math.sinh(E)+S*v*Math.cosh(E))/S}}const O={calculatedDuration:m&&f||null,next:S=>{const k=w(S);if(m)l.done=S>=f;else{let C=0;b<1&&(C=S===0?Hh(g):zSe(w,S,k));const E=Math.abs(C)<=i,N=Math.abs(a-k)<=r;l.done=E&&N}return l.value=l.done?a:k,l},toString:()=>{const S=Math.min(BSe(O),C$),k=pSe(C=>O.next(S*C).value,S,30);return S+"ms "+k}};return O}function nX({keyframes:e,velocity:t=0,power:n=.8,timeConstant:i=325,bounceDamping:r=10,bounceStiffness:s=500,modifyTarget:a,min:l,max:c,restDelta:u=.5,restSpeed:d}){const f=e[0],h={done:!1,value:f},m=E=>l!==void 0&&Ec,g=E=>l===void 0?c:c===void 0||Math.abs(l-E)-b*Math.exp(-E/i),w=E=>y+x(E),O=E=>{const N=x(E),A=w(E);h.done=Math.abs(N)<=u,h.value=h.done?y:A};let S,k;const C=E=>{m(h.value)&&(S=E,k=VSe({keyframes:[h.value,g(h.value)],velocity:zSe(w,E,h.value),damping:r,stiffness:s,restDelta:u,restSpeed:d}))};return C(0),{calculatedDuration:null,next:E=>{let N=!1;return!k&&S===void 0&&(N=!0,O(E),C(E)),S!==void 0&&E>=S?k.next(E-S):(!N&&O(E),h)}}}const PKe=vC(.42,0,1,1),DKe=vC(0,0,.58,1),HSe=vC(.42,0,.58,1),MKe=e=>Array.isArray(e)&&typeof e[0]!="number",LKe={linear:tu,easeIn:PKe,easeInOut:HSe,easeOut:DKe,circIn:lU,circInOut:SSe,circOut:kSe,backIn:aU,backInOut:wSe,backOut:xSe,anticipate:OSe},iX=e=>{if(oU(e)){Vke(e.length===4);const[t,n,i,r]=e;return vC(t,n,i,r)}else if(typeof e=="string")return LKe[e];return e};function $Ke(e,t,n){const i=[],r=n||QSe,s=e.length-1;for(let a=0;at[0];if(s===2&&t[0]===t[1])return()=>t[1];const a=e[0]===e[1];e[0]>e[s-1]&&(e=[...e].reverse(),t=[...t].reverse());const l=$Ke(t,i,r),c=l.length,u=d=>{if(a&&d1)for(;fu(lp(e[0],e[s-1],d)):u}function BKe(e,t){const n=e[e.length-1];for(let i=1;i<=t;i++){const r=Hx(0,t,i);e.push(Fs(n,1,r))}}function UKe(e){const t=[0];return BKe(t,e.length-1),t}function QKe(e,t){return e.map(n=>n*t)}function zKe(e,t){return e.map(()=>t||HSe).splice(0,e.length-1)}function mN({duration:e=300,keyframes:t,times:n,ease:i="easeInOut"}){const r=MKe(i)?i.map(iX):iX(i),s={done:!1,value:t[0]},a=QKe(n&&n.length===t.length?n:UKe(t),e),l=FKe(a,t,{ease:Array.isArray(r)?r:zKe(t,r)});return{calculatedDuration:e,next:c=>(s.value=l(c),s.done=c>=e,s)}}const VKe=e=>{const t=({timestamp:n})=>e(n);return{start:()=>bs.update(t,!0),stop:()=>ng(t),now:()=>ja.isProcessing?ja.timestamp:Nf.now()}},HKe={decay:nX,inertia:nX,tween:mN,keyframes:mN,spring:VSe},qKe=e=>e/100;class pU extends FSe{constructor(t){super(t),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:c}=this.options;c&&c()};const{name:n,motionValue:i,element:r,keyframes:s}=this.options,a=(r==null?void 0:r.KeyframeResolver)||fU,l=(c,u)=>this.onKeyframesResolved(c,u);this.resolver=new a(s,l,n,i,r),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(t){const{type:n="keyframes",repeat:i=0,repeatDelay:r=0,repeatType:s,velocity:a=0}=this.options,l=sU(n)?n:HKe[n]||mN;let c,u;l!==mN&&typeof t[0]!="number"&&(c=xC(qKe,QSe(t[0],t[1])),t=[0,100]);const d=l({...this.options,keyframes:t});s==="mirror"&&(u=l({...this.options,keyframes:[...t].reverse(),velocity:-a})),d.calculatedDuration===null&&(d.calculatedDuration=BSe(d));const{calculatedDuration:f}=d,h=f+r,m=h*(i+1)-r;return{generator:d,mirroredGenerator:u,mapPercentToKeyframes:c,calculatedDuration:f,resolvedDuration:h,totalDuration:m}}onPostResolved(){const{autoplay:t=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!t?this.pause():this.state=this.pendingPlayState}tick(t,n=!1){const{resolved:i}=this;if(!i){const{keyframes:E}=this.options;return{done:!0,value:E[E.length-1]}}const{finalKeyframe:r,generator:s,mirroredGenerator:a,mapPercentToKeyframes:l,keyframes:c,calculatedDuration:u,totalDuration:d,resolvedDuration:f}=i;if(this.startTime===null)return s.next(0);const{delay:h,repeat:m,repeatType:g,repeatDelay:b,onUpdate:v}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-d/this.speed,this.startTime)),n?this.currentTime=t:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(t-this.startTime)*this.speed;const y=this.currentTime-h*(this.speed>=0?1:-1),x=this.speed>=0?y<0:y>d;this.currentTime=Math.max(y,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=d);let w=this.currentTime,O=s;if(m){const E=Math.min(this.currentTime,d)/f;let N=Math.floor(E),A=E%1;!A&&E>=1&&(A=1),A===1&&N--,N=Math.min(N,m+1),!!(N%2)&&(g==="reverse"?(A=1-A,b&&(A-=b/f)):g==="mirror"&&(O=a)),w=lp(0,1,A)*f}const S=x?{done:!1,value:c[0]}:O.next(w);l&&(S.value=l(S.value));let{done:k}=S;!x&&u!==null&&(k=this.speed>=0?this.currentTime>=d:this.currentTime<=0);const C=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&k);return C&&r!==void 0&&(S.value=$I(c,this.options,r)),v&&v(S.value),C&&this.finish(),S}get duration(){const{resolved:t}=this;return t?qh(t.calculatedDuration):0}get time(){return qh(this.currentTime)}set time(t){t=Hh(t),this.currentTime=t,this.holdTime!==null||this.speed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.speed)}get speed(){return this.playbackSpeed}set speed(t){const n=this.playbackSpeed!==t;this.playbackSpeed=t,n&&(this.time=qh(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:t=VKe,onPlay:n,startTime:i}=this.options;this.driver||(this.driver=t(s=>this.tick(s))),n&&n();const r=this.driver.now();this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=r):this.startTime=i??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var t;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(t=this.currentTime)!==null&&t!==void 0?t:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:t}=this.options;t&&t()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}}const WKe=new Set(["opacity","clipPath","filter","transform"]);function KKe(e,t,n,{delay:i=0,duration:r=300,repeat:s=0,repeatType:a="loop",ease:l="easeInOut",times:c}={}){const u={[t]:n};c&&(u.offset=c);const d=gSe(l,r);return Array.isArray(d)&&(u.easing=d),e.animate(u,{delay:i,duration:r,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:s+1,direction:a==="reverse"?"alternate":"normal"})}const GKe=rU(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),gN=10,XKe=2e4;function YKe(e){return sU(e.type)||e.type==="spring"||!mSe(e.ease)}function ZKe(e,t){const n=new pU({...t,keyframes:e,repeat:0,delay:0,isGenerator:!0});let i={done:!1,value:e[0]};const r=[];let s=0;for(;!i.done&&sthis.onKeyframesResolved(a,l),n,i,r),this.resolver.scheduleResolve()}initPlayback(t,n){let{duration:i=300,times:r,ease:s,type:a,motionValue:l,name:c,startTime:u}=this.options;if(!l.owner||!l.owner.current)return!1;if(typeof s=="string"&&hN()&&JKe(s)&&(s=qSe[s]),YKe(this.options)){const{onComplete:f,onUpdate:h,motionValue:m,element:g,...b}=this.options,v=ZKe(t,b);t=v.keyframes,t.length===1&&(t[1]=t[0]),i=v.duration,r=v.times,s=v.ease,a="keyframes"}const d=KKe(l.owner.current,c,t,{...this.options,duration:i,times:r,ease:s});return d.startTime=u??this.calcStartTime(),this.pendingTimeline?(qG(d,this.pendingTimeline),this.pendingTimeline=void 0):d.onfinish=()=>{const{onComplete:f}=this.options;l.set($I(t,this.options,n)),f&&f(),this.cancel(),this.resolveFinishedPromise()},{animation:d,duration:i,times:r,type:a,ease:s,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:n}=t;return qh(n)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:n}=t;return qh(n.currentTime||0)}set time(t){const{resolved:n}=this;if(!n)return;const{animation:i}=n;i.currentTime=Hh(t)}get speed(){const{resolved:t}=this;if(!t)return 1;const{animation:n}=t;return n.playbackRate}set speed(t){const{resolved:n}=this;if(!n)return;const{animation:i}=n;i.playbackRate=t}get state(){const{resolved:t}=this;if(!t)return"idle";const{animation:n}=t;return n.playState}get startTime(){const{resolved:t}=this;if(!t)return null;const{animation:n}=t;return n.startTime}attachTimeline(t){if(!this._resolved)this.pendingTimeline=t;else{const{resolved:n}=this;if(!n)return tu;const{animation:i}=n;qG(i,t)}return tu}play(){if(this.isStopped)return;const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.playState==="finished"&&this.updateFinishedPromise(),n.play()}pause(){const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:t}=this;if(!t)return;const{animation:n,keyframes:i,duration:r,type:s,ease:a,times:l}=t;if(n.playState==="idle"||n.playState==="finished")return;if(this.time){const{motionValue:u,onUpdate:d,onComplete:f,element:h,...m}=this.options,g=new pU({...m,keyframes:i,duration:r,type:s,ease:a,times:l,isGenerator:!0}),b=Hh(this.time);u.setWithVelocity(g.sample(b-gN).value,g.sample(b).value,gN)}const{onStop:c}=this.options;c&&c(),this.cancel()}complete(){const{resolved:t}=this;t&&t.animation.finish()}cancel(){const{resolved:t}=this;t&&t.animation.cancel()}static supports(t){const{motionValue:n,name:i,repeatDelay:r,repeatType:s,damping:a,type:l}=t;if(!n||!n.owner||!(n.owner.current instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:u}=n.owner.getProps();return GKe()&&i&&WKe.has(i)&&!c&&!u&&!r&&s!=="mirror"&&a!==0&&l!=="inertia"}}const eGe={type:"spring",stiffness:500,damping:25,restSpeed:10},tGe=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),nGe={type:"keyframes",duration:.8},iGe={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},rGe=(e,{keyframes:t})=>t.length>2?nGe:Hy.has(e)?e.startsWith("scale")?tGe(t[1]):eGe:iGe;function sGe({when:e,delay:t,delayChildren:n,staggerChildren:i,staggerDirection:r,repeat:s,repeatType:a,repeatDelay:l,from:c,elapsed:u,...d}){return!!Object.keys(d).length}const mU=(e,t,n,i={},r,s)=>a=>{const l=eU(i,e)||{},c=l.delay||i.delay||0;let{elapsed:u=0}=i;u=u-Hh(c);let d={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...l,delay:-u,onUpdate:h=>{t.set(h),l.onUpdate&&l.onUpdate(h)},onComplete:()=>{a(),l.onComplete&&l.onComplete()},name:e,motionValue:t,element:s?void 0:r};sGe(l)||(d={...d,...rGe(e,d)}),d.duration&&(d.duration=Hh(d.duration)),d.repeatDelay&&(d.repeatDelay=Hh(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let f=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(d.duration=0,d.delay===0&&(f=!0)),f&&!s&&t.get()!==void 0){const h=$I(d.keyframes,l);if(h!==void 0)return bs.update(()=>{d.onUpdate(h),d.onComplete()}),new LWe([])}return!s&&rX.supports(d)?new rX(d):new pU(d)};function oGe({protectedKeys:e,needsAnimating:t},n){const i=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,i}function WSe(e,t,{delay:n=0,transitionOverride:i,type:r}={}){var s;let{transition:a=e.getDefaultTransition(),transitionEnd:l,...c}=t;i&&(a=i);const u=[],d=r&&e.animationState&&e.animationState.getState()[r];for(const f in c){const h=e.getValue(f,(s=e.latestValues[f])!==null&&s!==void 0?s:null),m=c[f];if(m===void 0||d&&oGe(d,f))continue;const g={delay:n,...eU(a||{},f)};let b=!1;if(window.MotionHandoffAnimation){const y=hSe(e);if(y){const x=window.MotionHandoffAnimation(y,f,bs);x!==null&&(g.startTime=x,b=!0)}}x$(e,f),h.start(mU(f,h,m,e.shouldReduceMotion&&dSe.has(f)?{type:!1}:g,e,b));const v=h.animation;v&&u.push(v)}return l&&Promise.all(u).then(()=>{bs.update(()=>{l&&IWe(e,l)})}),u}function _$(e,t,n={}){var i;const r=LI(e,t,n.type==="exit"?(i=e.presenceContext)===null||i===void 0?void 0:i.custom:void 0);let{transition:s=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(s=n.transitionOverride);const a=r?()=>Promise.all(WSe(e,r,n)):()=>Promise.resolve(),l=e.variantChildren&&e.variantChildren.size?(u=0)=>{const{delayChildren:d=0,staggerChildren:f,staggerDirection:h}=s;return aGe(e,t,d+u,f,h,n)}:()=>Promise.resolve(),{when:c}=s;if(c){const[u,d]=c==="beforeChildren"?[a,l]:[l,a];return u().then(()=>d())}else return Promise.all([a(),l(n.delay)])}function aGe(e,t,n=0,i=0,r=1,s){const a=[],l=(e.variantChildren.size-1)*i,c=r===1?(u=0)=>u*i:(u=0)=>l-u*i;return Array.from(e.variantChildren).sort(lGe).forEach((u,d)=>{u.notify("AnimationStart",t),a.push(_$(u,t,{...s,delay:n+c(d)}).then(()=>u.notify("AnimationComplete",t)))}),Promise.all(a)}function lGe(e,t){return e.sortNodePosition(t)}function cGe(e,t,n={}){e.notify("AnimationStart",t);let i;if(Array.isArray(t)){const r=t.map(s=>_$(e,s,n));i=Promise.all(r)}else if(typeof t=="string")i=_$(e,t,n);else{const r=typeof t=="function"?LI(e,t,n.custom):t;i=Promise.all(WSe(e,r,n))}return i.then(()=>{e.notify("AnimationComplete",t)})}const uGe=Q7.length;function KSe(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?KSe(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;nPromise.all(t.map(({animation:n,options:i})=>cGe(e,n,i)))}function pGe(e){let t=hGe(e),n=sX(),i=!0;const r=c=>(u,d)=>{var f;const h=LI(e,d,c==="exit"?(f=e.presenceContext)===null||f===void 0?void 0:f.custom:void 0);if(h){const{transition:m,transitionEnd:g,...b}=h;u={...u,...b,...g}}return u};function s(c){t=c(e)}function a(c){const{props:u}=e,d=KSe(e.parent)||{},f=[],h=new Set;let m={},g=1/0;for(let v=0;vg&&O,N=!1;const A=Array.isArray(w)?w:[w];let j=A.reduce(r(y),{});S===!1&&(j={});const{prevResolvedValues:T={}}=x,R={...T,...j},_=P=>{E=!0,h.has(P)&&(N=!0,h.delete(P)),x.needsAnimating[P]=!0;const L=e.getValue(P);L&&(L.liveStyle=!1)};for(const P in R){const L=j[P],F=T[P];if(m.hasOwnProperty(P))continue;let I=!1;v$(L)&&v$(F)?I=!uSe(L,F):I=L!==F,I?L!=null?_(P):h.add(P):L!==void 0&&h.has(P)?_(P):x.protectedKeys[P]=!0}x.prevProp=w,x.prevResolvedValues=j,x.isActive&&(m={...m,...j}),i&&e.blockInitialAnimation&&(E=!1),E&&(!(k&&C)||N)&&f.push(...A.map(P=>({animation:P,options:{type:y}})))}if(h.size){const v={};h.forEach(y=>{const x=e.getBaseTarget(y),w=e.getValue(y);w&&(w.liveStyle=!0),v[y]=x??null}),f.push({animation:v})}let b=!!f.length;return i&&(u.initial===!1||u.initial===u.animate)&&!e.manuallyAnimateOnMount&&(b=!1),i=!1,b?t(f):Promise.resolve()}function l(c,u){var d;if(n[c].isActive===u)return Promise.resolve();(d=e.variantChildren)===null||d===void 0||d.forEach(h=>{var m;return(m=h.animationState)===null||m===void 0?void 0:m.setActive(c,u)}),n[c].isActive=u;const f=a(c);for(const h in n)n[h].protectedKeys={};return f}return{animateChanges:a,setActive:l,setAnimateFunction:s,getState:()=>n,reset:()=>{n=sX(),i=!0}}}function mGe(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!uSe(t,e):!1}function Jg(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function sX(){return{animate:Jg(!0),whileInView:Jg(),whileHover:Jg(),whileTap:Jg(),whileDrag:Jg(),whileFocus:Jg(),exit:Jg()}}class Ag{constructor(t){this.isMounted=!1,this.node=t}update(){}}class gGe extends Ag{constructor(t){super(t),t.animationState||(t.animationState=pGe(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();DI(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)===null||t===void 0||t.call(this)}}let bGe=0;class yGe extends Ag{constructor(){super(...arguments),this.id=bGe++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===i)return;const r=this.node.animationState.setActive("exit",!t);n&&!t&&r.then(()=>n(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}const vGe={animation:{Feature:gGe},exit:{Feature:yGe}},pd={x:!1,y:!1};function GSe(){return pd.x||pd.y}function xGe(e){return e==="x"||e==="y"?pd[e]?null:(pd[e]=!0,()=>{pd[e]=!1}):pd.x||pd.y?null:(pd.x=pd.y=!0,()=>{pd.x=pd.y=!1})}const gU=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1;function QS(e,t,n,i={passive:!0}){return e.addEventListener(t,n,i),()=>e.removeEventListener(t,n)}function wC(e){return{point:{x:e.pageX,y:e.pageY}}}const wGe=e=>t=>gU(t)&&e(t,wC(t));function Lk(e,t,n,i){return QS(e,t,wGe(n),i)}const oX=(e,t)=>Math.abs(e-t);function OGe(e,t){const n=oX(e.x,t.x),i=oX(e.y,t.y);return Math.sqrt(n**2+i**2)}class XSe{constructor(t,n,{transformPagePoint:i,contextWindow:r,dragSnapToOrigin:s=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const f=N5(this.lastMoveEventInfo,this.history),h=this.startEvent!==null,m=OGe(f.offset,{x:0,y:0})>=3;if(!h&&!m)return;const{point:g}=f,{timestamp:b}=ja;this.history.push({...g,timestamp:b});const{onStart:v,onMove:y}=this.handlers;h||(v&&v(this.lastMoveEvent,f),this.startEvent=this.lastMoveEvent),y&&y(this.lastMoveEvent,f)},this.handlePointerMove=(f,h)=>{this.lastMoveEvent=f,this.lastMoveEventInfo=j5(h,this.transformPagePoint),bs.update(this.updatePoint,!0)},this.handlePointerUp=(f,h)=>{this.end();const{onEnd:m,onSessionEnd:g,resumeAnimation:b}=this.handlers;if(this.dragSnapToOrigin&&b&&b(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const v=N5(f.type==="pointercancel"?this.lastMoveEventInfo:j5(h,this.transformPagePoint),this.history);this.startEvent&&m&&m(f,v),g&&g(f,v)},!gU(t))return;this.dragSnapToOrigin=s,this.handlers=n,this.transformPagePoint=i,this.contextWindow=r||window;const a=wC(t),l=j5(a,this.transformPagePoint),{point:c}=l,{timestamp:u}=ja;this.history=[{...c,timestamp:u}];const{onSessionStart:d}=n;d&&d(t,N5(l,this.history)),this.removeListeners=xC(Lk(this.contextWindow,"pointermove",this.handlePointerMove),Lk(this.contextWindow,"pointerup",this.handlePointerUp),Lk(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),ng(this.updatePoint)}}function j5(e,t){return t?{point:t(e.point)}:e}function aX(e,t){return{x:e.x-t.x,y:e.y-t.y}}function N5({point:e},t){return{point:e,delta:aX(e,YSe(t)),offset:aX(e,kGe(t)),velocity:SGe(t,.1)}}function kGe(e){return e[0]}function YSe(e){return e[e.length-1]}function SGe(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,i=null;const r=YSe(e);for(;n>=0&&(i=e[n],!(r.timestamp-i.timestamp>Hh(t)));)n--;if(!i)return{x:0,y:0};const s=qh(r.timestamp-i.timestamp);if(s===0)return{x:0,y:0};const a={x:(r.x-i.x)/s,y:(r.y-i.y)/s};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}const ZSe=1e-4,EGe=1-ZSe,CGe=1+ZSe,JSe=.01,TGe=0-JSe,AGe=0+JSe;function cu(e){return e.max-e.min}function _Ge(e,t,n){return Math.abs(e-t)<=n}function lX(e,t,n,i=.5){e.origin=i,e.originPoint=Fs(t.min,t.max,e.origin),e.scale=cu(n)/cu(t),e.translate=Fs(n.min,n.max,e.origin)-e.originPoint,(e.scale>=EGe&&e.scale<=CGe||isNaN(e.scale))&&(e.scale=1),(e.translate>=TGe&&e.translate<=AGe||isNaN(e.translate))&&(e.translate=0)}function $k(e,t,n,i){lX(e.x,t.x,n.x,i?i.originX:void 0),lX(e.y,t.y,n.y,i?i.originY:void 0)}function cX(e,t,n){e.min=n.min+t.min,e.max=e.min+cu(t)}function jGe(e,t,n){cX(e.x,t.x,n.x),cX(e.y,t.y,n.y)}function uX(e,t,n){e.min=t.min-n.min,e.max=e.min+cu(t)}function Fk(e,t,n){uX(e.x,t.x,n.x),uX(e.y,t.y,n.y)}function NGe(e,{min:t,max:n},i){return t!==void 0&&en&&(e=i?Fs(n,e,i.max):Math.min(e,n)),e}function dX(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function RGe(e,{top:t,left:n,bottom:i,right:r}){return{x:dX(e.x,n,r),y:dX(e.y,t,i)}}function fX(e,t){let n=t.min-e.min,i=t.max-e.max;return t.max-t.mini?n=Hx(t.min,t.max-i,e.min):i>r&&(n=Hx(e.min,e.max-r,t.min)),lp(0,1,n)}function DGe(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const j$=.35;function MGe(e=j$){return e===!1?e=0:e===!0&&(e=j$),{x:hX(e,"left","right"),y:hX(e,"top","bottom")}}function hX(e,t,n){return{min:pX(e,t),max:pX(e,n)}}function pX(e,t){return typeof e=="number"?e:e[t]||0}const mX=()=>({translate:0,scale:1,origin:0,originPoint:0}),Iv=()=>({x:mX(),y:mX()}),gX=()=>({min:0,max:0}),ao=()=>({x:gX(),y:gX()});function wu(e){return[e("x"),e("y")]}function eEe({top:e,left:t,right:n,bottom:i}){return{x:{min:t,max:n},y:{min:e,max:i}}}function LGe({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function $Ge(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),i=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:i.y,right:i.x}}function R5(e){return e===void 0||e===1}function N$({scale:e,scaleX:t,scaleY:n}){return!R5(e)||!R5(t)||!R5(n)}function gb(e){return N$(e)||tEe(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function tEe(e){return bX(e.x)||bX(e.y)}function bX(e){return e&&e!=="0%"}function bN(e,t,n){const i=e-n,r=t*i;return n+r}function yX(e,t,n,i,r){return r!==void 0&&(e=bN(e,r,i)),bN(e,n,i)+t}function R$(e,t=0,n=1,i,r){e.min=yX(e.min,t,n,i,r),e.max=yX(e.max,t,n,i,r)}function nEe(e,{x:t,y:n}){R$(e.x,t.translate,t.scale,t.originPoint),R$(e.y,n.translate,n.scale,n.originPoint)}const vX=.999999999999,xX=1.0000000000001;function FGe(e,t,n,i=!1){const r=n.length;if(!r)return;t.x=t.y=1;let s,a;for(let l=0;lvX&&(t.x=1),t.yvX&&(t.y=1)}function Pv(e,t){e.min=e.min+t,e.max=e.max+t}function wX(e,t,n,i,r=.5){const s=Fs(e.min,e.max,r);R$(e,t,n,s,i)}function Dv(e,t){wX(e.x,t.x,t.scaleX,t.scale,t.originX),wX(e.y,t.y,t.scaleY,t.scale,t.originY)}function iEe(e,t){return eEe($Ge(e.getBoundingClientRect(),t))}function BGe(e,t,n){const i=iEe(e,n),{scroll:r}=t;return r&&(Pv(i.x,r.offset.x),Pv(i.y,r.offset.y)),i}const rEe=({current:e})=>e?e.ownerDocument.defaultView:null,UGe=new WeakMap;class QGe{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=ao(),this.visualElement=t}start(t,{snapToCursor:n=!1}={}){const{presenceContext:i}=this.visualElement;if(i&&i.isPresent===!1)return;const r=d=>{const{dragSnapToOrigin:f}=this.getProps();f?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(wC(d).point)},s=(d,f)=>{const{drag:h,dragPropagation:m,onDragStart:g}=this.getProps();if(h&&!m&&(this.openDragLock&&this.openDragLock(),this.openDragLock=xGe(h),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),wu(v=>{let y=this.getAxisMotionValue(v).get()||0;if(jf.test(y)){const{projection:x}=this.visualElement;if(x&&x.layout){const w=x.layout.layoutBox[v];w&&(y=cu(w)*(parseFloat(y)/100))}}this.originPoint[v]=y}),g&&bs.postRender(()=>g(d,f)),x$(this.visualElement,"transform");const{animationState:b}=this.visualElement;b&&b.setActive("whileDrag",!0)},a=(d,f)=>{const{dragPropagation:h,dragDirectionLock:m,onDirectionLock:g,onDrag:b}=this.getProps();if(!h&&!this.openDragLock)return;const{offset:v}=f;if(m&&this.currentDirection===null){this.currentDirection=zGe(v),this.currentDirection!==null&&g&&g(this.currentDirection);return}this.updateAxis("x",f.point,v),this.updateAxis("y",f.point,v),this.visualElement.render(),b&&b(d,f)},l=(d,f)=>this.stop(d,f),c=()=>wu(d=>{var f;return this.getAnimationState(d)==="paused"&&((f=this.getAxisMotionValue(d).animation)===null||f===void 0?void 0:f.play())}),{dragSnapToOrigin:u}=this.getProps();this.panSession=new XSe(t,{onSessionStart:r,onStart:s,onMove:a,onSessionEnd:l,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,contextWindow:rEe(this.visualElement)})}stop(t,n){const i=this.isDragging;if(this.cancel(),!i)return;const{velocity:r}=n;this.startAnimation(r);const{onDragEnd:s}=this.getProps();s&&bs.postRender(()=>s(t,n))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:i}=this.getProps();!i&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,i){const{drag:r}=this.getProps();if(!i||!O2(t,r,this.currentDirection))return;const s=this.getAxisMotionValue(t);let a=this.originPoint[t]+i[t];this.constraints&&this.constraints[t]&&(a=NGe(a,this.constraints[t],this.elastic[t])),s.set(a)}resolveConstraints(){var t;const{dragConstraints:n,dragElastic:i}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(t=this.visualElement.projection)===null||t===void 0?void 0:t.layout,s=this.constraints;n&&Nv(n)?this.constraints||(this.constraints=this.resolveRefConstraints()):n&&r?this.constraints=RGe(r.layoutBox,n):this.constraints=!1,this.elastic=MGe(i),s!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&wu(a=>{this.constraints!==!1&&this.getAxisMotionValue(a)&&(this.constraints[a]=DGe(r.layoutBox[a],this.constraints[a]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!Nv(t))return!1;const i=t.current,{projection:r}=this.visualElement;if(!r||!r.layout)return!1;const s=BGe(i,r.root,this.visualElement.getTransformPagePoint());let a=IGe(r.layout.layoutBox,s);if(n){const l=n(LGe(a));this.hasMutatedConstraints=!!l,l&&(a=eEe(l))}return a}startAnimation(t){const{drag:n,dragMomentum:i,dragElastic:r,dragTransition:s,dragSnapToOrigin:a,onDragTransitionEnd:l}=this.getProps(),c=this.constraints||{},u=wu(d=>{if(!O2(d,n,this.currentDirection))return;let f=c&&c[d]||{};a&&(f={min:0,max:0});const h=r?200:1e6,m=r?40:1e7,g={type:"inertia",velocity:i?t[d]:0,bounceStiffness:h,bounceDamping:m,timeConstant:750,restDelta:1,restSpeed:10,...s,...f};return this.startAxisValueAnimation(d,g)});return Promise.all(u).then(l)}startAxisValueAnimation(t,n){const i=this.getAxisMotionValue(t);return x$(this.visualElement,t),i.start(mU(t,i,0,n,this.visualElement,!1))}stopAnimation(){wu(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){wu(t=>{var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.pause()})}getAnimationState(t){var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.state}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,i=this.visualElement.getProps(),r=i[n];return r||this.visualElement.getValue(t,(i.initial?i.initial[t]:void 0)||0)}snapToCursor(t){wu(n=>{const{drag:i}=this.getProps();if(!O2(n,i,this.currentDirection))return;const{projection:r}=this.visualElement,s=this.getAxisMotionValue(n);if(r&&r.layout){const{min:a,max:l}=r.layout.layoutBox[n];s.set(t[n]-Fs(a,l,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:i}=this.visualElement;if(!Nv(n)||!i||!this.constraints)return;this.stopAnimation();const r={x:0,y:0};wu(a=>{const l=this.getAxisMotionValue(a);if(l&&this.constraints!==!1){const c=l.get();r[a]=PGe({min:c,max:c},this.constraints[a])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",i.root&&i.root.updateScroll(),i.updateLayout(),this.resolveConstraints(),wu(a=>{if(!O2(a,t,null))return;const l=this.getAxisMotionValue(a),{min:c,max:u}=this.constraints[a];l.set(Fs(c,u,r[a]))})}addListeners(){if(!this.visualElement.current)return;UGe.set(this.visualElement,this);const t=this.visualElement.current,n=Lk(t,"pointerdown",c=>{const{drag:u,dragListener:d=!0}=this.getProps();u&&d&&this.start(c)}),i=()=>{const{dragConstraints:c}=this.getProps();Nv(c)&&c.current&&(this.constraints=this.resolveRefConstraints())},{projection:r}=this.visualElement,s=r.addEventListener("measure",i);r&&!r.layout&&(r.root&&r.root.updateScroll(),r.updateLayout()),bs.read(i);const a=QS(window,"resize",()=>this.scalePositionWithinConstraints()),l=r.addEventListener("didUpdate",({delta:c,hasLayoutChanged:u})=>{this.isDragging&&u&&(wu(d=>{const f=this.getAxisMotionValue(d);f&&(this.originPoint[d]+=c[d].translate,f.set(f.get()+c[d].translate))}),this.visualElement.render())});return()=>{a(),n(),s(),l&&l()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:i=!1,dragPropagation:r=!1,dragConstraints:s=!1,dragElastic:a=j$,dragMomentum:l=!0}=t;return{...t,drag:n,dragDirectionLock:i,dragPropagation:r,dragConstraints:s,dragElastic:a,dragMomentum:l}}}function O2(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function zGe(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class VGe extends Ag{constructor(t){super(t),this.removeGroupControls=tu,this.removeListeners=tu,this.controls=new QGe(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||tu}unmount(){this.removeGroupControls(),this.removeListeners()}}const OX=e=>(t,n)=>{e&&bs.postRender(()=>e(t,n))};class HGe extends Ag{constructor(){super(...arguments),this.removePointerDownListener=tu}onPointerDown(t){this.session=new XSe(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:rEe(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:i,onPanEnd:r}=this.node.getProps();return{onSessionStart:OX(t),onStart:OX(n),onMove:i,onEnd:(s,a)=>{delete this.session,r&&bs.postRender(()=>r(s,a))}}}mount(){this.removePointerDownListener=Lk(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const R_={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function kX(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const tO={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(Ln.test(e))e=parseFloat(e);else return e;const n=kX(e,t.target.x),i=kX(e,t.target.y);return`${n}% ${i}%`}},qGe={correct:(e,{treeScale:t,projectionDelta:n})=>{const i=e,r=ig.parse(e);if(r.length>5)return i;const s=ig.createTransformer(e),a=typeof r[0]!="number"?1:0,l=n.x.scale*t.x,c=n.y.scale*t.y;r[0+a]/=l,r[1+a]/=c;const u=Fs(l,c,.5);return typeof r[2+a]=="number"&&(r[2+a]/=u),typeof r[3+a]=="number"&&(r[3+a]/=u),s(r)}};class WGe extends p.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:i,layoutId:r}=this.props,{projection:s}=t;vWe(KGe),s&&(n.group&&n.group.add(s),i&&i.register&&r&&i.register(s),s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,onExitComplete:()=>this.safeToRemove()})),R_.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:i,drag:r,isPresent:s}=this.props,a=i.projection;return a&&(a.isPresent=s,r||t.layoutDependency!==n||n===void 0?a.willUpdate():this.safeToRemove(),t.isPresent!==s&&(s?a.promote():a.relegate()||bs.postRender(()=>{const l=a.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),V7.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:i}=this.props,{projection:r}=t;r&&(r.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(r),i&&i.deregister&&i.deregister(r))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function sEe(e){const[t,n]=Qke(),i=p.useContext(F7);return o.jsx(WGe,{...e,layoutGroup:i,switchLayoutGroup:p.useContext(Yke),isPresent:t,safeToRemove:n})}const KGe={borderRadius:{...tO,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:tO,borderTopRightRadius:tO,borderBottomLeftRadius:tO,borderBottomRightRadius:tO,boxShadow:qGe};function GGe(e,t,n){const i=sl(e)?e:BS(e);return i.start(mU("",i,t,n)),i.animation}function XGe(e){return e instanceof SVGElement&&e.tagName!=="svg"}const YGe=(e,t)=>e.depth-t.depth;class ZGe{constructor(){this.children=[],this.isDirty=!1}add(t){tU(this.children,t),this.isDirty=!0}remove(t){nU(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(YGe),this.isDirty=!1,this.children.forEach(t)}}function JGe(e,t){const n=Nf.now(),i=({timestamp:r})=>{const s=r-n;s>=t&&(ng(i),e(s-t))};return bs.read(i,!0),()=>ng(i)}const oEe=["TopLeft","TopRight","BottomLeft","BottomRight"],eXe=oEe.length,SX=e=>typeof e=="string"?parseFloat(e):e,EX=e=>typeof e=="number"||Ln.test(e);function tXe(e,t,n,i,r,s){r?(e.opacity=Fs(0,n.opacity!==void 0?n.opacity:1,nXe(i)),e.opacityExit=Fs(t.opacity!==void 0?t.opacity:1,0,iXe(i))):s&&(e.opacity=Fs(t.opacity!==void 0?t.opacity:1,n.opacity!==void 0?n.opacity:1,i));for(let a=0;ait?1:n(Hx(e,t,i))}function TX(e,t){e.min=t.min,e.max=t.max}function xu(e,t){TX(e.x,t.x),TX(e.y,t.y)}function AX(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function _X(e,t,n,i,r){return e-=t,e=bN(e,1/n,i),r!==void 0&&(e=bN(e,1/r,i)),e}function rXe(e,t=0,n=1,i=.5,r,s=e,a=e){if(jf.test(t)&&(t=parseFloat(t),t=Fs(a.min,a.max,t/100)-a.min),typeof t!="number")return;let l=Fs(s.min,s.max,i);e===s&&(l-=t),e.min=_X(e.min,t,n,l,r),e.max=_X(e.max,t,n,l,r)}function jX(e,t,[n,i,r],s,a){rXe(e,t[n],t[i],t[r],t.scale,s,a)}const sXe=["x","scaleX","originX"],oXe=["y","scaleY","originY"];function NX(e,t,n,i){jX(e.x,t,sXe,n?n.x:void 0,i?i.x:void 0),jX(e.y,t,oXe,n?n.y:void 0,i?i.y:void 0)}function RX(e){return e.translate===0&&e.scale===1}function lEe(e){return RX(e.x)&&RX(e.y)}function IX(e,t){return e.min===t.min&&e.max===t.max}function aXe(e,t){return IX(e.x,t.x)&&IX(e.y,t.y)}function PX(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function cEe(e,t){return PX(e.x,t.x)&&PX(e.y,t.y)}function DX(e){return cu(e.x)/cu(e.y)}function MX(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class lXe{constructor(){this.members=[]}add(t){tU(this.members,t),t.scheduleRender()}remove(t){if(nU(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(r=>t===r);if(n===0)return!1;let i;for(let r=n;r>=0;r--){const s=this.members[r];if(s.isPresent!==!1){i=s;break}}return i?(this.promote(i),!0):!1}promote(t,n){const i=this.lead;if(t!==i&&(this.prevLead=i,this.lead=t,t.show(),i)){i.instance&&i.scheduleRender(),t.scheduleRender(),t.resumeFrom=i,n&&(t.resumeFrom.preserveOpacity=!0),i.snapshot&&(t.snapshot=i.snapshot,t.snapshot.latestValues=i.animationValues||i.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:r}=t.options;r===!1&&i.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:i}=t;n.onExitComplete&&n.onExitComplete(),i&&i.options.onExitComplete&&i.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function cXe(e,t,n){let i="";const r=e.x.translate/t.x,s=e.y.translate/t.y,a=(n==null?void 0:n.z)||0;if((r||s||a)&&(i=`translate3d(${r}px, ${s}px, ${a}px) `),(t.x!==1||t.y!==1)&&(i+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:u,rotate:d,rotateX:f,rotateY:h,skewX:m,skewY:g}=n;u&&(i=`perspective(${u}px) ${i}`),d&&(i+=`rotate(${d}deg) `),f&&(i+=`rotateX(${f}deg) `),h&&(i+=`rotateY(${h}deg) `),m&&(i+=`skewX(${m}deg) `),g&&(i+=`skewY(${g}deg) `)}const l=e.x.scale*t.x,c=e.y.scale*t.y;return(l!==1||c!==1)&&(i+=`scale(${l}, ${c})`),i||"none"}const bb={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},XO=typeof window<"u"&&window.MotionDebug!==void 0,I5=["","X","Y","Z"],uXe={visibility:"hidden"},LX=1e3;let dXe=0;function P5(e,t,n,i){const{latestValues:r}=t;r[e]&&(n[e]=r[e],t.setStaticValue(e,0),i&&(i[e]=0))}function uEe(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=hSe(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:r,layoutId:s}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",bs,!(r||s))}const{parent:i}=e;i&&!i.hasCheckedOptimisedAppear&&uEe(i)}function dEe({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:i,resetTransform:r}){return class{constructor(a={},l=t==null?void 0:t()){this.id=dXe++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,XO&&(bb.totalNodes=bb.resolvedTargetDeltas=bb.recalculatedProjection=0),this.nodes.forEach(pXe),this.nodes.forEach(vXe),this.nodes.forEach(xXe),this.nodes.forEach(mXe),XO&&window.MotionDebug.record(bb)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=a,this.root=l?l.root||l:this,this.path=l?[...l.path,l]:[],this.parent=l,this.depth=l?l.depth+1:0;for(let c=0;cthis.root.updateBlockedByResize=!1;e(a,()=>{this.root.updateBlockedByResize=!0,f&&f(),f=JGe(h,250),R_.hasAnimatedSinceResize&&(R_.hasAnimatedSinceResize=!1,this.nodes.forEach(FX))})}c&&this.root.registerSharedNode(c,this),this.options.animate!==!1&&d&&(c||u)&&this.addEventListener("didUpdate",({delta:f,hasLayoutChanged:h,hasRelativeTargetChanged:m,layout:g})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const b=this.options.transition||d.getDefaultTransition()||EXe,{onLayoutAnimationStart:v,onLayoutAnimationComplete:y}=d.getProps(),x=!this.targetLayout||!cEe(this.targetLayout,g)||m,w=!h&&m;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||w||h&&(x||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(f,w);const O={...eU(b,"layout"),onPlay:v,onComplete:y};(d.shouldReduceMotion||this.options.layoutRoot)&&(O.delay=0,O.type=!1),this.startAnimation(O)}else h||FX(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=g})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const a=this.getStack();a&&a.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,ng(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(wXe),this.animationId++)}getTransformTemplate(){const{visualElement:a}=this.options;return a&&a.getProps().transformTemplate}willUpdate(a=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&uEe(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let c=0;c{const S=O/1e3;BX(f.x,a.x,S),BX(f.y,a.y,S),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Fk(h,this.layout.layoutBox,this.relativeParent.layout.layoutBox),kXe(this.relativeTarget,this.relativeTargetOrigin,h,S),w&&aXe(this.relativeTarget,w)&&(this.isProjectionDirty=!1),w||(w=ao()),xu(w,this.relativeTarget)),b&&(this.animationValues=d,tXe(d,u,this.latestValues,S,x,y)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=S},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(a){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(ng(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=bs.update(()=>{R_.hasAnimatedSinceResize=!0,this.currentAnimation=GGe(0,LX,{...a,onUpdate:l=>{this.mixTargetDelta(l),a.onUpdate&&a.onUpdate(l)},onComplete:()=>{a.onComplete&&a.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const a=this.getStack();a&&a.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(LX),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const a=this.getLead();let{targetWithTransforms:l,target:c,layout:u,latestValues:d}=a;if(!(!l||!c||!u)){if(this!==a&&this.layout&&u&&fEe(this.options.animationType,this.layout.layoutBox,u.layoutBox)){c=this.target||ao();const f=cu(this.layout.layoutBox.x);c.x.min=a.target.x.min,c.x.max=c.x.min+f;const h=cu(this.layout.layoutBox.y);c.y.min=a.target.y.min,c.y.max=c.y.min+h}xu(l,c),Dv(l,d),$k(this.projectionDeltaWithTransform,this.layoutCorrected,l,d)}}registerSharedNode(a,l){this.sharedNodes.has(a)||this.sharedNodes.set(a,new lXe),this.sharedNodes.get(a).add(l);const u=l.options.initialPromotionConfig;l.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(l):void 0})}isLead(){const a=this.getStack();return a?a.lead===this:!0}getLead(){var a;const{layoutId:l}=this.options;return l?((a=this.getStack())===null||a===void 0?void 0:a.lead)||this:this}getPrevLead(){var a;const{layoutId:l}=this.options;return l?(a=this.getStack())===null||a===void 0?void 0:a.prevLead:void 0}getStack(){const{layoutId:a}=this.options;if(a)return this.root.sharedNodes.get(a)}promote({needsReset:a,transition:l,preserveFollowOpacity:c}={}){const u=this.getStack();u&&u.promote(this,c),a&&(this.projectionDelta=void 0,this.needsReset=!0),l&&this.setOptions({transition:l})}relegate(){const a=this.getStack();return a?a.relegate(this):!1}resetSkewAndRotation(){const{visualElement:a}=this.options;if(!a)return;let l=!1;const{latestValues:c}=a;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(l=!0),!l)return;const u={};c.z&&P5("z",a,u,this.animationValues);for(let d=0;d{var l;return(l=a.currentAnimation)===null||l===void 0?void 0:l.stop()}),this.root.nodes.forEach($X),this.root.sharedNodes.clear()}}}function fXe(e){e.updateLayout()}function hXe(e){var t;const n=((t=e.resumeFrom)===null||t===void 0?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&n&&e.hasListeners("didUpdate")){const{layoutBox:i,measuredBox:r}=e.layout,{animationType:s}=e.options,a=n.source!==e.layout.source;s==="size"?wu(f=>{const h=a?n.measuredBox[f]:n.layoutBox[f],m=cu(h);h.min=i[f].min,h.max=h.min+m}):fEe(s,n.layoutBox,i)&&wu(f=>{const h=a?n.measuredBox[f]:n.layoutBox[f],m=cu(i[f]);h.max=h.min+m,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[f].max=e.relativeTarget[f].min+m)});const l=Iv();$k(l,i,n.layoutBox);const c=Iv();a?$k(c,e.applyTransform(r,!0),n.measuredBox):$k(c,i,n.layoutBox);const u=!lEe(l);let d=!1;if(!e.resumeFrom){const f=e.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:h,layout:m}=f;if(h&&m){const g=ao();Fk(g,n.layoutBox,h.layoutBox);const b=ao();Fk(b,i,m.layoutBox),cEe(g,b)||(d=!0),f.options.layoutRoot&&(e.relativeTarget=b,e.relativeTargetOrigin=g,e.relativeParent=f)}}}e.notifyListeners("didUpdate",{layout:i,snapshot:n,delta:c,layoutDelta:l,hasLayoutChanged:u,hasRelativeTargetChanged:d})}else if(e.isLead()){const{onExitComplete:i}=e.options;i&&i()}e.options.transition=void 0}function pXe(e){XO&&bb.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function mXe(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function gXe(e){e.clearSnapshot()}function $X(e){e.clearMeasurements()}function bXe(e){e.isLayoutDirty=!1}function yXe(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function FX(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function vXe(e){e.resolveTargetDelta()}function xXe(e){e.calcProjection()}function wXe(e){e.resetSkewAndRotation()}function OXe(e){e.removeLeadSnapshot()}function BX(e,t,n){e.translate=Fs(t.translate,0,n),e.scale=Fs(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function UX(e,t,n,i){e.min=Fs(t.min,n.min,i),e.max=Fs(t.max,n.max,i)}function kXe(e,t,n,i){UX(e.x,t.x,n.x,i),UX(e.y,t.y,n.y,i)}function SXe(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const EXe={duration:.45,ease:[.4,0,.1,1]},QX=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),zX=QX("applewebkit/")&&!QX("chrome/")?Math.round:tu;function VX(e){e.min=zX(e.min),e.max=zX(e.max)}function CXe(e){VX(e.x),VX(e.y)}function fEe(e,t,n){return e==="position"||e==="preserve-aspect"&&!_Ge(DX(t),DX(n),.2)}function TXe(e){var t;return e!==e.root&&((t=e.scroll)===null||t===void 0?void 0:t.wasRoot)}const AXe=dEe({attachResizeListener:(e,t)=>QS(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),D5={current:void 0},hEe=dEe({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!D5.current){const e=new AXe({});e.mount(window),e.setOptions({layoutScroll:!0}),D5.current=e}return D5.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),_Xe={pan:{Feature:HGe},drag:{Feature:VGe,ProjectionNode:hEe,MeasureLayout:sEe}};function jXe(e,t,n){var i;if(e instanceof Element)return[e];if(typeof e=="string"){let r=document;const s=(i=void 0)!==null&&i!==void 0?i:r.querySelectorAll(e);return s?Array.from(s):[]}return Array.from(e)}function pEe(e,t){const n=jXe(e),i=new AbortController,r={passive:!0,...t,signal:i.signal};return[n,r,()=>i.abort()]}function HX(e){return t=>{t.pointerType==="touch"||GSe()||e(t)}}function NXe(e,t,n={}){const[i,r,s]=pEe(e,n),a=HX(l=>{const{target:c}=l,u=t(l);if(typeof u!="function"||!c)return;const d=HX(f=>{u(f),c.removeEventListener("pointerleave",d)});c.addEventListener("pointerleave",d,r)});return i.forEach(l=>{l.addEventListener("pointerenter",a,r)}),s}function qX(e,t,n){const{props:i}=e;e.animationState&&i.whileHover&&e.animationState.setActive("whileHover",n==="Start");const r="onHover"+n,s=i[r];s&&bs.postRender(()=>s(t,wC(t)))}class RXe extends Ag{mount(){const{current:t}=this.node;t&&(this.unmount=NXe(t,n=>(qX(this.node,n,"Start"),i=>qX(this.node,i,"End"))))}unmount(){}}class IXe extends Ag{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=xC(QS(this.node.current,"focus",()=>this.onFocus()),QS(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const mEe=(e,t)=>t?e===t?!0:mEe(e,t.parentElement):!1,PXe=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function DXe(e){return PXe.has(e.tagName)||e.tabIndex!==-1}const YO=new WeakSet;function WX(e){return t=>{t.key==="Enter"&&e(t)}}function M5(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const MXe=(e,t)=>{const n=e.currentTarget;if(!n)return;const i=WX(()=>{if(YO.has(n))return;M5(n,"down");const r=WX(()=>{M5(n,"up")}),s=()=>M5(n,"cancel");n.addEventListener("keyup",r,t),n.addEventListener("blur",s,t)});n.addEventListener("keydown",i,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",i),t)};function KX(e){return gU(e)&&!GSe()}function LXe(e,t,n={}){const[i,r,s]=pEe(e,n),a=l=>{const c=l.currentTarget;if(!KX(l)||YO.has(c))return;YO.add(c);const u=t(l),d=(m,g)=>{window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",h),!(!KX(m)||!YO.has(c))&&(YO.delete(c),typeof u=="function"&&u(m,{success:g}))},f=m=>{d(m,n.useGlobalTarget||mEe(c,m.target))},h=m=>{d(m,!1)};window.addEventListener("pointerup",f,r),window.addEventListener("pointercancel",h,r)};return i.forEach(l=>{!DXe(l)&&l.getAttribute("tabindex")===null&&(l.tabIndex=0),(n.useGlobalTarget?window:l).addEventListener("pointerdown",a,r),l.addEventListener("focus",u=>MXe(u,r),r)}),s}function GX(e,t,n){const{props:i}=e;e.animationState&&i.whileTap&&e.animationState.setActive("whileTap",n==="Start");const r="onTap"+(n==="End"?"":n),s=i[r];s&&bs.postRender(()=>s(t,wC(t)))}class $Xe extends Ag{mount(){const{current:t}=this.node;t&&(this.unmount=LXe(t,n=>(GX(this.node,n,"Start"),(i,{success:r})=>GX(this.node,i,r?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const I$=new WeakMap,L5=new WeakMap,FXe=e=>{const t=I$.get(e.target);t&&t(e)},BXe=e=>{e.forEach(FXe)};function UXe({root:e,...t}){const n=e||document;L5.has(n)||L5.set(n,{});const i=L5.get(n),r=JSON.stringify(t);return i[r]||(i[r]=new IntersectionObserver(BXe,{root:e,...t})),i[r]}function QXe(e,t,n){const i=UXe(t);return I$.set(e,n),i.observe(e),()=>{I$.delete(e),i.unobserve(e)}}const zXe={some:0,all:1};class VXe extends Ag{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:i,amount:r="some",once:s}=t,a={root:n?n.current:void 0,rootMargin:i,threshold:typeof r=="number"?r:zXe[r]},l=c=>{const{isIntersecting:u}=c;if(this.isInView===u||(this.isInView=u,s&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:d,onViewportLeave:f}=this.node.getProps(),h=u?d:f;h&&h(c)};return QXe(this.node.current,a,l)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(HXe(t,n))&&this.startObserver()}unmount(){}}function HXe({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const qXe={inView:{Feature:VXe},tap:{Feature:$Xe},focus:{Feature:IXe},hover:{Feature:RXe}},WXe={layout:{ProjectionNode:hEe,MeasureLayout:sEe}},yN={current:null},bU={current:!1};function gEe(){if(bU.current=!0,!!B7)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>yN.current=e.matches;e.addListener(t),t()}else yN.current=!1}const KXe=[...LSe,nl,ig],GXe=e=>KXe.find(MSe(e)),XX=new WeakMap;function XXe(e,t,n){for(const i in t){const r=t[i],s=n[i];if(sl(r))e.addValue(i,r);else if(sl(s))e.addValue(i,BS(r,{owner:e}));else if(s!==r)if(e.hasValue(i)){const a=e.getValue(i);a.liveStyle===!0?a.jump(r):a.hasAnimated||a.set(r)}else{const a=e.getStaticValue(i);e.addValue(i,BS(a!==void 0?a:r,{owner:e}))}}for(const i in n)t[i]===void 0&&e.removeValue(i);return t}const YX=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class YXe{scrapeMotionValuesFromProps(t,n,i){return{}}constructor({parent:t,props:n,presenceContext:i,reducedMotionConfig:r,blockInitialAnimation:s,visualState:a},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=fU,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const m=Nf.now();this.renderScheduledAtthis.bindToMotionValue(i,n)),bU.current||gEe(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:yN.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){XX.delete(this.current),this.projection&&this.projection.unmount(),ng(this.notifyUpdate),ng(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const n=this.features[t];n&&(n.unmount(),n.isMounted=!1)}this.current=null}bindToMotionValue(t,n){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const i=Hy.has(t),r=n.on("change",l=>{this.latestValues[t]=l,this.props.onUpdate&&bs.preRender(this.notifyUpdate),i&&this.projection&&(this.projection.isTransformDirty=!0)}),s=n.on("renderRequest",this.scheduleRender);let a;window.MotionCheckAppearSync&&(a=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{r(),s(),a&&a(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in Vx){const n=Vx[t];if(!n)continue;const{isEnabled:i,Feature:r}=n;if(!this.features[t]&&r&&i(this.props)&&(this.features[t]=new r(this)),this.features[t]){const s=this.features[t];s.isMounted?s.update():(s.mount(),s.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):ao()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let i=0;in.variantChildren.delete(t)}addValue(t,n){const i=this.values.get(t);n!==i&&(i&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let i=this.values.get(t);return i===void 0&&n!==void 0&&(i=BS(n===null?void 0:n,{owner:this}),this.addValue(t,i)),i}readValue(t,n){var i;let r=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:(i=this.getBaseTargetFromProps(this.props,t))!==null&&i!==void 0?i:this.readValueFromInstance(this.current,t,this.options);return r!=null&&(typeof r=="string"&&(PSe(r)||ESe(r))?r=parseFloat(r):!GXe(r)&&ig.test(n)&&(r=NSe(t,n)),this.setBaseTarget(t,sl(r)?r.get():r)),sl(r)?r.get():r}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var n;const{initial:i}=this.props;let r;if(typeof i=="string"||typeof i=="object"){const a=q7(this.props,i,(n=this.presenceContext)===null||n===void 0?void 0:n.custom);a&&(r=a[t])}if(i&&r!==void 0)return r;const s=this.getBaseTargetFromProps(this.props,t);return s!==void 0&&!sl(s)?s:this.initialValues[t]!==void 0&&r===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new iU),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}class bEe extends YXe{constructor(){super(...arguments),this.KeyframeResolver=$Se}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){return t.style?t.style[n]:void 0}removeValueFromRenderState(t,{vars:n,style:i}){delete n[t],delete i[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;sl(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function ZXe(e){return window.getComputedStyle(e)}class JXe extends bEe{constructor(){super(...arguments),this.type="html",this.renderInstance=rSe}readValueFromInstance(t,n){if(Hy.has(n)){const i=dU(n);return i&&i.default||0}else{const i=ZXe(t),r=(tSe(n)?i.getPropertyValue(n):i[n])||0;return typeof r=="string"?r.trim():r}}measureInstanceViewportBox(t,{transformPagePoint:n}){return iEe(t,n)}build(t,n,i){G7(t,n,i.transformTemplate)}scrapeMotionValuesFromProps(t,n,i){return J7(t,n,i)}}class eYe extends bEe{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=ao}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(Hy.has(n)){const i=dU(n);return i&&i.default||0}return n=sSe.has(n)?n:z7(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,i){return lSe(t,n,i)}build(t,n,i){X7(t,n,this.isSVGTag,i.transformTemplate)}renderInstance(t,n,i,r){oSe(t,n,i,r)}mount(t){this.isSVGTag=Z7(t.tagName),super.mount(t)}}const tYe=(e,t)=>H7(e)?new eYe(t):new JXe(t,{allowProjection:e!==p.Fragment}),nYe=AWe({...vGe,...qXe,..._Xe,...WXe},tYe),dr=zqe(nYe);function FI(){!bU.current&&gEe();const[e]=p.useState(yN.current);return e}function Yo(){return Yo=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u"||/ServerSideRendering/.test(navigator&&navigator.userAgent)?p.useEffect:p.useLayoutEffect;function ov(e,t,n){var i=p.useRef(t);i.current=t,p.useEffect(function(){function r(s){i.current(s)}return e&&window.addEventListener(e,r,n),function(){e&&window.removeEventListener(e,r)}},[e])}var iYe=["container"];function rYe(e){var t=e.container,n=t===void 0?document.body:t,i=BI(e,iYe);return Jn.createPortal(pi.createElement("div",Yo({},i)),n)}function sYe(e){return pi.createElement("svg",Yo({width:"44",height:"44",viewBox:"0 0 768 768"},e),pi.createElement("path",{d:"M607.5 205.5l-178.5 178.5 178.5 178.5-45 45-178.5-178.5-178.5 178.5-45-45 178.5-178.5-178.5-178.5 45-45 178.5 178.5 178.5-178.5z"}))}function oYe(e){return pi.createElement("svg",Yo({width:"44",height:"44",viewBox:"0 0 768 768"},e),pi.createElement("path",{d:"M640.5 352.5v63h-390l178.5 180-45 45-256.5-256.5 256.5-256.5 45 45-178.5 180h390z"}))}function aYe(e){return pi.createElement("svg",Yo({width:"44",height:"44",viewBox:"0 0 768 768"},e),pi.createElement("path",{d:"M384 127.5l256.5 256.5-256.5 256.5-45-45 178.5-180h-390v-63h390l-178.5-180z"}))}function lYe(){return p.useEffect(function(){var e=document.body.style,t=e.overflow;return e.overflow="hidden",function(){e.overflow=t}},[]),null}function JX(e){var t=e.touches[0],n=t.clientX,i=t.clientY;if(e.touches.length>=2){var r=e.touches[1],s=r.clientX,a=r.clientY;return[(n+s)/2,(i+a)/2,Math.sqrt(Math.pow(s-n,2)+Math.pow(a-i,2))]}return[n,i,0]}var am=function(e,t,n,i){var r,s=n*t,a=(s-i)/2,l=e;return s<=i?(r=1,l=0):e>0&&a-e<=0?(r=2,l=a):e<0&&a+e<=0&&(r=3,l=-a),[r,l]};function $5(e,t,n,i,r,s,a,l,c,u){a===void 0&&(a=innerWidth/2),l===void 0&&(l=innerHeight/2),c===void 0&&(c=0),u===void 0&&(u=0);var d=am(e,s,n,innerWidth)[0],f=am(t,s,i,innerHeight),h=innerWidth/2,m=innerHeight/2;return{x:a-s/r*(a-(h+e))-h+(i/n>=3&&n*s===innerWidth?0:d?c/2:c),y:l-s/r*(l-(m+t))-m+(f[0]?u/2:u),lastCX:a,lastCY:l}}function M$(e,t,n){var i=e%180!=0;return i?[n,t,i]:[t,n,i]}function F5(e,t,n){var i=M$(n,innerWidth,innerHeight),r=i[0],s=i[1],a=0,l=r,c=s,u=e/t*s,d=t/e*r;return e=s?l=u:e>=r&&tr/s?c=d:t/e>=3&&!i[2]?a=((c=d)-s)/2:l=u,{width:l,height:c,x:0,y:a,pause:!0}}function S2(e,t){var n=t.leading,i=n!==void 0&&n,r=t.maxWait,s=t.wait,a=s===void 0?r||0:s,l=p.useRef(e);l.current=e;var c=p.useRef(0),u=p.useRef(),d=function(){return u.current&&clearTimeout(u.current)},f=p.useCallback(function(){var h=[].slice.call(arguments),m=Date.now();function g(){c.current=m,d(),l.current.apply(null,h)}var b=c.current,v=m-b;if(b===0&&(i&&g(),c.current=m),r!==void 0){if(v>r)return void g()}else v=1&&s&&s())};d()}function d(){c=requestAnimationFrame(u)}}var uYe={T:0,L:0,W:0,H:0,FIT:void 0},vEe=function(){var e=p.useRef(!1);return p.useEffect(function(){return e.current=!0,function(){e.current=!1}},[]),e},dYe=["className"];function fYe(e){var t=e.className,n=t===void 0?"":t,i=BI(e,dYe);return pi.createElement("div",Yo({className:"PhotoView__Spinner "+n},i),pi.createElement("svg",{viewBox:"0 0 32 32",width:"36",height:"36",fill:"white"},pi.createElement("path",{opacity:".25",d:"M16 0 A16 16 0 0 0 16 32 A16 16 0 0 0 16 0 M16 4 A12 12 0 0 1 16 28 A12 12 0 0 1 16 4"}),pi.createElement("path",{d:"M16 0 A16 16 0 0 1 32 16 L28 16 A12 12 0 0 0 16 4z"})))}var hYe=["src","loaded","broken","className","onPhotoLoad","loadingElement","brokenElement"];function pYe(e){var t=e.src,n=e.loaded,i=e.broken,r=e.className,s=e.onPhotoLoad,a=e.loadingElement,l=e.brokenElement,c=BI(e,hYe),u=vEe();return t&&!i?pi.createElement(pi.Fragment,null,pi.createElement("img",Yo({className:"PhotoView__Photo"+(r?" "+r:""),src:t,onLoad:function(d){var f=d.target;u.current&&s({loaded:!0,naturalWidth:f.naturalWidth,naturalHeight:f.naturalHeight})},onError:function(){u.current&&s({broken:!0})},draggable:!1,alt:""},c)),!n&&(a?pi.createElement("span",{className:"PhotoView__icon"},a):pi.createElement(fYe,{className:"PhotoView__icon"}))):l?pi.createElement("span",{className:"PhotoView__icon"},typeof l=="function"?l({src:t}):l):null}var mYe={naturalWidth:void 0,naturalHeight:void 0,width:void 0,height:void 0,loaded:void 0,broken:!1,x:0,y:0,touched:!1,maskTouched:!1,rotate:0,scale:1,CX:0,CY:0,lastX:0,lastY:0,lastCX:0,lastCY:0,lastScale:1,touchTime:0,touchLength:0,pause:!0,stopRaf:!0,reach:void 0};function gYe(e){var t=e.item,n=t.src,i=t.render,r=t.width,s=r===void 0?0:r,a=t.height,l=a===void 0?0:a,c=t.originRef,u=e.visible,d=e.speed,f=e.easing,h=e.wrapClassName,m=e.className,g=e.style,b=e.loadingElement,v=e.brokenElement,y=e.onPhotoTap,x=e.onMaskTap,w=e.onReachMove,O=e.onReachUp,S=e.onPhotoResize,k=e.isActive,C=e.expose,E=vN(mYe),N=E[0],A=E[1],j=p.useRef(0),T=vEe(),R=N.naturalWidth,_=R===void 0?s:R,D=N.naturalHeight,M=D===void 0?l:D,P=N.width,L=P===void 0?s:P,F=N.height,I=F===void 0?l:F,z=N.loaded,K=z===void 0?!n:z,B=N.broken,W=N.x,H=N.y,X=N.touched,ie=N.stopRaf,Q=N.maskTouched,Z=N.rotate,ue=N.scale,Ee=N.CX,Y=N.CY,G=N.lastX,te=N.lastY,de=N.lastCX,Ce=N.lastCY,le=N.lastScale,fe=N.touchTime,re=N.touchLength,Oe=N.pause,Pe=N.reach,be=ty({onScale:function(Ie){return Qe(k2(Ie))},onRotate:function(Ie){Z!==Ie&&(C({rotate:Ie}),A(Yo({rotate:Ie},F5(_,M,Ie))))}});function Qe(Ie,vt,jt){ue!==Ie&&(C({scale:Ie}),A(Yo({scale:Ie},$5(W,H,L,I,ue,Ie,vt,jt),Ie<=1&&{x:0,y:0})))}var ve=S2(function(Ie,vt,jt){if(jt===void 0&&(jt=0),(X||Q)&&k){var Nt=M$(Z,L,I),ln=Nt[0],He=Nt[1];if(jt===0&&j.current===0){var Le=Math.abs(Ie-Ee)<=20,We=Math.abs(vt-Y)<=20;if(Le&&We)return void A({lastCX:Ie,lastCY:vt});j.current=Le?vt>Y?3:2:1}var gt,st=Ie-de,xt=vt-Ce;if(jt===0){var ft=am(st+G,ue,ln,innerWidth)[0],Ht=am(xt+te,ue,He,innerHeight);gt=function(hn,Ge,bt,St){return Ge&&hn===1||St==="x"?"x":bt&&hn>1||St==="y"?"y":void 0}(j.current,ft,Ht[0],Pe),gt!==void 0&&w(gt,Ie,vt,ue)}if(gt==="x"||Q)return void A({reach:"x"});var cn=k2(ue+(jt-re)/100/2*ue,_/L,.2);C({scale:cn}),A(Yo({touchLength:jt,reach:gt,scale:cn},$5(W,H,L,I,ue,cn,Ie,vt,st,xt)))}},{maxWait:8});function Ne(Ie){return!ie&&!X&&(T.current&&A(Yo({},Ie,{pause:u})),T.current)}var ne,ye,Te,Se,Ke,it,he,xe,Ae=(Ke=function(Ie){return Ne({x:Ie})},it=function(Ie){return Ne({y:Ie})},he=function(Ie){return T.current&&(C({scale:Ie}),A({scale:Ie})),!X&&T.current},xe=ty({X:function(Ie){return Ke(Ie)},Y:function(Ie){return it(Ie)},S:function(Ie){return he(Ie)}}),function(Ie,vt,jt,Nt,ln,He,Le,We,gt,st,xt){var ft=M$(st,ln,He),Ht=ft[0],cn=ft[1],hn=am(Ie,We,Ht,innerWidth),Ge=hn[0],bt=hn[1],St=am(vt,We,cn,innerHeight),dn=St[0],Rt=St[1],$e=Date.now()-xt;if($e>=200||We!==Le||Math.abs(gt-Le)>1){var ot=$5(Ie,vt,ln,He,Le,We),vn=ot.x,Ye=ot.y,mt=Ge?bt:vn!==Ie?vn:null,_n=dn?Rt:Ye!==vt?Ye:null;return mt!==null&&Cb(Ie,mt,xe.X),_n!==null&&Cb(vt,_n,xe.Y),void(We!==Le&&Cb(Le,We,xe.S))}var Vt=(Ie-jt)/$e,Ai=(vt-Nt)/$e,jn=Math.sqrt(Math.pow(Vt,2)+Math.pow(Ai,2)),Hn=!1,En=!1;(function(vi,Fn){var di,wr=vi,gr=0,ir=0,Ve=function(Nn){di||(di=Nn);var se=Nn-di,xi=Math.sign(vi),is=-.001*xi,$r=Math.sign(-wr)*Math.pow(wr,2)*2e-4,qn=wr*se+(is+$r)*Math.pow(se,2)/2;gr+=qn,di=Nn,xi*(wr+=(is+$r)*se)<=0?rn():Fn(gr)?kt():rn()};function kt(){ir=requestAnimationFrame(Ve)}function rn(){cancelAnimationFrame(ir)}kt()})(jn,function(vi){var Fn=Ie+vi*(Vt/jn),di=vt+vi*(Ai/jn),wr=am(Fn,Le,Ht,innerWidth),gr=wr[0],ir=wr[1],Ve=am(di,Le,cn,innerHeight),kt=Ve[0],rn=Ve[1];if(gr&&!Hn&&(Hn=!0,Ge?Cb(Fn,ir,xe.X):eY(ir,Fn+(Fn-ir),xe.X)),kt&&!En&&(En=!0,dn?Cb(di,rn,xe.Y):eY(rn,di+(di-rn),xe.Y)),Hn&&En)return!1;var Nn=Hn||xe.X(ir),se=En||xe.Y(rn);return Nn&&se})}),qe=(ne=y,ye=function(Ie,vt){Pe||Qe(ue!==1?1:Math.max(2,_/L),Ie,vt)},Te=p.useRef(0),Se=S2(function(){Te.current=0,ne.apply(void 0,[].slice.call(arguments))},{wait:300}),function(){var Ie=[].slice.call(arguments);Te.current+=1,Se.apply(void 0,Ie),Te.current>=2&&(Se.cancel(),Te.current=0,ye.apply(void 0,Ie))});function Me(Ie,vt){if(j.current=0,(X||Q)&&k){A({touched:!1,maskTouched:!1,pause:!1,stopRaf:!1,reach:void 0});var jt=k2(ue,_/L);if(Ae(W,H,G,te,L,I,ue,jt,le,Z,fe),O(Ie,vt),Ee===Ie&&Y===vt){if(X)return void qe(Ie,vt);Q&&x(Ie,vt)}}}function At(Ie,vt,jt){jt===void 0&&(jt=0),A({touched:!0,CX:Ie,CY:vt,lastCX:Ie,lastCY:vt,lastX:W,lastY:H,lastScale:ue,touchLength:jt,touchTime:Date.now()})}function It(Ie){A({maskTouched:!0,CX:Ie.clientX,CY:Ie.clientY,lastX:W,lastY:H})}ov(gh?void 0:"mousemove",function(Ie){Ie.preventDefault(),ve(Ie.clientX,Ie.clientY)}),ov(gh?void 0:"mouseup",function(Ie){Me(Ie.clientX,Ie.clientY)}),ov(gh?"touchmove":void 0,function(Ie){Ie.preventDefault();var vt=JX(Ie);ve.apply(void 0,vt)},{passive:!1}),ov(gh?"touchend":void 0,function(Ie){var vt=Ie.changedTouches[0];Me(vt.clientX,vt.clientY)},{passive:!1}),ov("resize",S2(function(){K&&!X&&(A(F5(_,M,Z)),S())},{maxWait:8})),D$(function(){k&&C(Yo({scale:ue,rotate:Z},be))},[k]);var lt=function(Ie,vt,jt,Nt,ln,He,Le,We,gt,st){var xt=function(vn,Ye,mt,_n,Vt){var Ai=p.useRef(!1),jn=vN({lead:!0,scale:mt}),Hn=jn[0],En=Hn.lead,vi=Hn.scale,Fn=jn[1],di=S2(function(wr){try{return Vt(!0),Fn({lead:!1,scale:wr}),Promise.resolve()}catch(gr){return Promise.reject(gr)}},{wait:_n});return D$(function(){Ai.current?(Vt(!1),Fn({lead:!0}),di(mt)):Ai.current=!0},[mt]),En?[vn*vi,Ye*vi,mt/vi]:[vn*mt,Ye*mt,1]}(He,Le,We,gt,st),ft=xt[0],Ht=xt[1],cn=xt[2],hn=function(vn,Ye,mt,_n,Vt){var Ai=p.useState(uYe),jn=Ai[0],Hn=Ai[1],En=p.useState(0),vi=En[0],Fn=En[1],di=p.useRef(),wr=ty({OK:function(){return vn&&Fn(4)}});function gr(ir){Vt(!1),Fn(ir)}return p.useEffect(function(){if(di.current||(di.current=Date.now()),mt){if(function(ir,Ve){var kt=ir&&ir.current;if(kt&&kt.nodeType===1){var rn=kt.getBoundingClientRect();Ve({T:rn.top,L:rn.left,W:rn.width,H:rn.height,FIT:kt.tagName==="IMG"?getComputedStyle(kt).objectFit:void 0})}}(Ye,Hn),vn)return Date.now()-di.current<250?(Fn(1),requestAnimationFrame(function(){Fn(2),requestAnimationFrame(function(){return gr(3)})}),void setTimeout(wr.OK,_n)):void Fn(4);gr(5)}},[vn,mt]),[vi,jn]}(Ie,vt,jt,gt,st),Ge=hn[0],bt=hn[1],St=bt.W,dn=bt.FIT,Rt=innerWidth/2,$e=innerHeight/2,ot=Ge<3||Ge>4;return[ot?St?bt.L:Rt:Nt+(Rt-He*We/2),ot?St?bt.T:$e:ln+($e-Le*We/2),ft,ot&&dn?ft*(bt.H/St):Ht,Ge===0?cn:ot?St/(He*We)||.01:cn,ot?dn?1:0:1,Ge,dn]}(u,c,K,W,H,L,I,ue,d,function(Ie){return A({pause:Ie})}),Ot=lt[4],Ct=lt[6],dt="transform "+d+"ms "+f,yt={className:m,onMouseDown:gh?void 0:function(Ie){Ie.stopPropagation(),Ie.button===0&&At(Ie.clientX,Ie.clientY,0)},onTouchStart:gh?function(Ie){Ie.stopPropagation(),At.apply(void 0,JX(Ie))}:void 0,onWheel:function(Ie){if(!Pe){var vt=k2(ue-Ie.deltaY/100/2,_/L);A({stopRaf:!0}),Qe(vt,Ie.clientX,Ie.clientY)}},style:{width:lt[2]+"px",height:lt[3]+"px",opacity:lt[5],objectFit:Ct===4?void 0:lt[7],transform:Z?"rotate("+Z+"deg)":void 0,transition:Ct>2?dt+", opacity "+d+"ms ease, height "+(Ct<4?d/2:Ct>4?d:0)+"ms "+f:void 0}};return pi.createElement("div",{className:"PhotoView__PhotoWrap"+(h?" "+h:""),style:g,onMouseDown:!gh&&k?It:void 0,onTouchStart:gh&&k?function(Ie){return It(Ie.touches[0])}:void 0},pi.createElement("div",{className:"PhotoView__PhotoBox",style:{transform:"matrix("+Ot+", 0, 0, "+Ot+", "+lt[0]+", "+lt[1]+")",transition:X||Oe?void 0:dt,willChange:k?"transform":void 0}},n?pi.createElement(pYe,Yo({src:n,loaded:K,broken:B},yt,{onPhotoLoad:function(Ie){A(Yo({},Ie,Ie.loaded&&F5(Ie.naturalWidth||0,Ie.naturalHeight||0,Z)))},loadingElement:b,brokenElement:v})):i&&i({attrs:yt,scale:Ot,rotate:Z})))}var tY={x:0,touched:!1,pause:!1,lastCX:void 0,lastCY:void 0,bg:void 0,lastBg:void 0,overlay:!0,minimal:!0,scale:1,rotate:0};function bYe(e){var t=e.loop,n=t===void 0?3:t,i=e.speed,r=e.easing,s=e.photoClosable,a=e.maskClosable,l=a===void 0||a,c=e.maskOpacity,u=c===void 0?1:c,d=e.pullClosable,f=d===void 0||d,h=e.bannerVisible,m=h===void 0||h,g=e.overlayRender,b=e.toolbarRender,v=e.className,y=e.maskClassName,x=e.photoClassName,w=e.photoWrapClassName,O=e.loadingElement,S=e.brokenElement,k=e.images,C=e.index,E=C===void 0?0:C,N=e.onIndexChange,A=e.visible,j=e.onClose,T=e.afterClose,R=e.portalContainer,_=vN(tY),D=_[0],M=_[1],P=p.useState(0),L=P[0],F=P[1],I=D.x,z=D.touched,K=D.pause,B=D.lastCX,W=D.lastCY,H=D.bg,X=H===void 0?u:H,ie=D.lastBg,Q=D.overlay,Z=D.minimal,ue=D.scale,Ee=D.rotate,Y=D.onScale,G=D.onRotate,te=e.hasOwnProperty("index"),de=te?E:L,Ce=te?N:F,le=p.useRef(de),fe=k.length,re=k[de],Oe=typeof n=="boolean"?n:fe>n,Pe=function(Ot,Ct){var dt=p.useReducer(function(jt){return!jt},!1)[1],yt=p.useRef(0),Ie=function(jt){var Nt=p.useRef(jt);function ln(He){Nt.current=He}return p.useMemo(function(){(function(He){Ot?(He(Ot),yt.current=1):yt.current=2})(ln)},[jt]),[Nt.current,ln]}(Ot),vt=Ie[1];return[Ie[0],yt.current,function(){dt(),yt.current===2&&(vt(!1),Ct&&Ct()),yt.current=0}]}(A,T),be=Pe[0],Qe=Pe[1],ve=Pe[2];D$(function(){if(be)return M({pause:!0,x:de*-(innerWidth+P0)}),void(le.current=de);M(tY)},[be]);var Ne=ty({close:function(Ot){G&&G(0),M({overlay:!0,lastBg:X}),j(Ot)},changeIndex:function(Ot,Ct){Ct===void 0&&(Ct=!1);var dt=Oe?le.current+(Ot-de):Ot,yt=fe-1,Ie=P$(dt,0,yt),vt=Oe?dt:Ie,jt=innerWidth+P0;M({touched:!1,lastCX:void 0,lastCY:void 0,x:-jt*vt,pause:Ct}),le.current=vt,Ce&&Ce(Oe?Ot<0?yt:Ot>yt?0:Ot:Ie)}}),ne=Ne.close,ye=Ne.changeIndex;function Te(Ot){return Ot?ne():M({overlay:!Q})}function Se(){M({x:-(innerWidth+P0)*de,lastCX:void 0,lastCY:void 0,pause:!0}),le.current=de}function Ke(Ot,Ct,dt,yt){Ot==="x"?function(Ie){if(B!==void 0){var vt=Ie-B,jt=vt;!Oe&&(de===0&&vt>0||de===fe-1&&vt<0)&&(jt=vt/2),M({touched:!0,lastCX:B,x:-(innerWidth+P0)*le.current+jt,pause:!1})}else M({touched:!0,lastCX:Ie,x:I,pause:!1})}(Ct):Ot==="y"&&function(Ie,vt){if(W!==void 0){var jt=u===null?null:P$(u,.01,u-Math.abs(Ie-W)/100/4);M({touched:!0,lastCY:W,bg:vt===1?jt:u,minimal:vt===1})}else M({touched:!0,lastCY:Ie,bg:X,minimal:!0})}(dt,yt)}function it(Ot,Ct){var dt=Ot-(B??Ot),yt=Ct-(W??Ct),Ie=!1;if(dt<-40)ye(de+1);else if(dt>40)ye(de-1);else{var vt=-(innerWidth+P0)*le.current;Math.abs(yt)>100&&Z&&f&&(Ie=!0,ne()),M({touched:!1,x:vt,lastCX:void 0,lastCY:void 0,bg:u,overlay:!!Ie||Q})}}ov("keydown",function(Ot){if(A)switch(Ot.key){case"ArrowLeft":ye(de-1,!0);break;case"ArrowRight":ye(de+1,!0);break;case"Escape":ne()}});var he=function(Ot,Ct,dt){return p.useMemo(function(){var yt=Ot.length;return dt?Ot.concat(Ot).concat(Ot).slice(yt+Ct-1,yt+Ct+2):Ot.slice(Math.max(Ct-1,0),Math.min(Ct+2,yt+1))},[Ot,Ct,dt])}(k,de,Oe);if(!be)return null;var xe=Q&&!Qe,Ae=A?X:ie,qe=Y&&G&&{images:k,index:de,visible:A,onClose:ne,onIndexChange:ye,overlayVisible:xe,overlay:re&&re.overlay,scale:ue,rotate:Ee,onScale:Y,onRotate:G},Me=i?i(Qe):400,At=r?r(Qe):ZX,It=i?i(3):600,lt=r?r(3):ZX;return pi.createElement(rYe,{className:"PhotoView-Portal"+(xe?"":" PhotoView-Slider__clean")+(A?"":" PhotoView-Slider__willClose")+(v?" "+v:""),role:"dialog",onClick:function(Ot){return Ot.stopPropagation()},container:R},A&&pi.createElement(lYe,null),pi.createElement("div",{className:"PhotoView-Slider__Backdrop"+(y?" "+y:"")+(Qe===1?" PhotoView-Slider__fadeIn":Qe===2?" PhotoView-Slider__fadeOut":""),style:{background:Ae?"rgba(0, 0, 0, "+Ae+")":void 0,transitionTimingFunction:At,transitionDuration:(z?0:Me)+"ms",animationDuration:Me+"ms"},onAnimationEnd:ve}),m&&pi.createElement("div",{className:"PhotoView-Slider__BannerWrap"},pi.createElement("div",{className:"PhotoView-Slider__Counter"},de+1," / ",fe),pi.createElement("div",{className:"PhotoView-Slider__BannerRight"},b&&qe&&b(qe),pi.createElement(sYe,{className:"PhotoView-Slider__toolbarIcon",onClick:ne}))),he.map(function(Ot,Ct){var dt=Oe||de!==0?le.current-1+Ct:de+Ct;return pi.createElement(gYe,{key:Oe?Ot.key+"/"+Ot.src+"/"+dt:Ot.key,item:Ot,speed:Me,easing:At,visible:A,onReachMove:Ke,onReachUp:it,onPhotoTap:function(){return Te(s)},onMaskTap:function(){return Te(l)},wrapClassName:w,className:x,style:{left:(innerWidth+P0)*dt+"px",transform:"translate3d("+I+"px, 0px, 0)",transition:z||K?void 0:"transform "+It+"ms "+lt},loadingElement:O,brokenElement:S,onPhotoResize:Se,isActive:le.current===dt,expose:M})}),!gh&&m&&pi.createElement(pi.Fragment,null,(Oe||de!==0)&&pi.createElement("div",{className:"PhotoView-Slider__ArrowLeft",onClick:function(){return ye(de-1,!0)}},pi.createElement(oYe,null)),(Oe||de+1-1){var y=u.slice();return y.splice(v,1,b),void l({images:y})}l(function(x){return{images:x.images.concat(b)}})},remove:function(b){l(function(v){var y=v.images.filter(function(x){return x.key!==b});return{images:y,index:Math.min(y.length-1,f)}})},show:function(b){var v=u.findIndex(function(y){return y.key===b});l({visible:!0,index:v}),i&&i(!0,v,a)}}),m=ty({close:function(){l({visible:!1}),i&&i(!1,f,a)},changeIndex:function(b){l({index:b}),n&&n(b,a)}}),g=p.useMemo(function(){return Yo({},a,h)},[a,h]);return pi.createElement(yEe.Provider,{value:g},t,pi.createElement(bYe,Yo({images:u,visible:d,index:f,onIndexChange:m.changeIndex,onClose:m.close},r)))}var xEe=function(e){var t,n,i=e.src,r=e.render,s=e.overlay,a=e.width,l=e.height,c=e.triggers,u=c===void 0?["onClick"]:c,d=e.children,f=p.useContext(yEe),h=(t=function(){return f.nextId()},(n=p.useRef({sign:!1,fn:void 0}).current).sign||(n.sign=!0,n.fn=t()),n.fn),m=p.useRef(null);p.useImperativeHandle(d==null?void 0:d.ref,function(){return m.current}),p.useEffect(function(){return function(){f.remove(h)}},[]);var g=ty({render:function(v){return r&&r(v)},show:function(v,y){f.show(h),function(x,w){if(d){var O=d.props[x];O&&O(w)}}(v,y)}}),b=p.useMemo(function(){var v={};return u.forEach(function(y){v[y]=g.show.bind(null,y)}),v},[]);return p.useEffect(function(){f.update({key:h,src:i,originRef:m,render:g.render,overlay:s,width:a,height:l})},[i]),d?p.Children.only(p.cloneElement(d,Yo({},b,{ref:m}))):null};function my(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2.5"}),o.jsx("path",{d:"m7.5 9 2.7 2.5L7.5 14M12.7 14h3.8"}),o.jsx("path",{d:"M3.8 7.5h16.4",opacity:".55"})]})}function wEe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2.5"}),o.jsx("path",{d:"M3.8 8h16.4"}),o.jsx("circle",{cx:"6.5",cy:"6.3",r:".65",fill:"currentColor",stroke:"none"}),o.jsx("circle",{cx:"8.8",cy:"6.3",r:".65",fill:"currentColor",stroke:"none"}),o.jsx("path",{d:"m9 15 2.2-4 1.6 2.4 1.1-1.2L16 15H9Z"})]})}function yU(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M12 3.4 19 6v5.3c0 4.3-2.7 7.6-7 9.3-4.3-1.7-7-5-7-9.3V6l7-2.6Z"}),o.jsx("path",{d:"m8.8 12 2 2 4.4-4.4"})]})}function I_(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M3.5 7.7h6.1l1.7 2h9.2v7.5a2.3 2.3 0 0 1-2.3 2.3H5.8a2.3 2.3 0 0 1-2.3-2.3V7.7Z"}),o.jsx("path",{d:"M3.8 7.7V6.8a2.3 2.3 0 0 1 2.3-2.3h3l1.8 2h6.9a2.3 2.3 0 0 1 2.3 2.3v.9"}),o.jsx("path",{d:"M12 13v3M10.5 14.5h3"})]})}function wYe(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"M12 5v14M5 12h14"})})}function nY(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m6.5 11.5 5.5-5.5 5.5 5.5M12 6v12"})})}function iY(e){return o.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",...e,children:o.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1.75",fill:"currentColor"})})}function OYe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2.5"}),o.jsx("circle",{cx:"8.5",cy:"9",r:"1.4"}),o.jsx("path",{d:"m5.5 17 4.2-4.2 2.6 2.4 2.1-2.1 4.1 3.9"})]})}function kYe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M6 3.5h7l5 5v12H6z"}),o.jsx("path",{d:"M13 3.5v5h5M9 13h6M9 16h5"})]})}function SYe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.5",y:"5",width:"13.5",height:"14",rx:"2.5"}),o.jsx("path",{d:"m17 10 3.5-2v8L17 14zM7 8.5h4.5"})]})}function EYe(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m12 3 1.5 4.5L18 9l-4.5 1.5L12 15l-1.5-4.5L6 9l4.5-1.5zM18.5 15.5l.7 2.1 2.1.7-2.1.7-.7 2.1-.7-2.1-2.1-.7 2.1-.7z"})})}function OEe(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m6.5 6.5 11 11M17.5 6.5l-11 11"})})}function L$(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m9 6 6 6-6 6"})})}function CYe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M4.8 8.2A8 8 0 1 1 4 12M4.8 8.2V4.5M4.8 8.2h3.7"}),o.jsx("path",{d:"M12 8v4.5l3 1.8"})]})}function nc(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"M20 12a8 8 0 1 1-2.35-5.65"})})}function TYe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"8",y:"8",width:"11",height:"11",rx:"2"}),o.jsx("path",{d:"M16 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2"})]})}function kEe(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m5 12.5 4.2 4.2L19 7"})})}function V(e,t={}){return mn.t(e,{...t,ns:"adk"})}function Ml(e){const t=new Headers(e);return t.has("Accept-Language")||t.set("Accept-Language",mn.resolvedLanguage||mn.language),t}function $$(){return mn.resolvedLanguage||mn.language}const rY="veadk_auth_qs",AYe=new Set(["view","source","sessionId","artifactSha256","validationReportSha256","projectId","versionId"]);let nO=null;function _Ye(){if(nO!==null)return nO;const e=new URLSearchParams(window.location.search),t=new URLSearchParams,n=new URLSearchParams,i=e.get("view")==="runtime-deploy"&&e.get("source")==="intelligent-development";e.forEach((s,a)=>{(i&&AYe.has(a)?n:t).append(a,s)});const r=t.toString();if(r?(sessionStorage.setItem(rY,r),nO=r):nO=sessionStorage.getItem(rY)??"",r){const s=n.toString();window.history.replaceState(null,"",window.location.pathname+(s?`?${s}`:"")+window.location.hash)}return nO}function ta(e){const t=_Ye();if(!t)return e;const n=new URL(e,window.location.origin);return new URLSearchParams(t).forEach((i,r)=>{n.searchParams.has(r)||n.searchParams.set(r,i)}),/^https?:\/\//i.test(e)?n.toString():n.pathname+n.search+n.hash}const Va=3e4,mr=12e4,vU=1e4;function Ha(e,t=Va){if(t<=0)return e??void 0;const n=AbortSignal.timeout(t);return e?AbortSignal.any([e,n]):n}const xN="veadk_local_user",wN="veadk_local_user_tab",jYe="X-VeADK-OAuth-Refresh-Retry",NYe=[50,250],RYe=/^[A-Za-z0-9]{1,16}$/;function SEe(){try{const e=sessionStorage.getItem(wN);if(e)return e;const t=localStorage.getItem(xN);return t&&sessionStorage.setItem(wN,t),t}catch{try{return localStorage.getItem(xN)}catch{return null}}}function sY(e){try{sessionStorage.setItem(wN,e)}catch{}try{localStorage.setItem(xN,e)}catch{}}function IYe(){try{sessionStorage.removeItem(wN)}catch{}try{localStorage.removeItem(xN)}catch{}}function hu(e){const t=new Headers(e),n=SEe();return n&&t.set("X-VeADK-Local-User",n),t}async function EEe(){let e;try{e=await fetch("/web/auth-config",{headers:Ml({Accept:"application/json"}),signal:Ha(void 0,vU)})}catch(t){throw console.warn("[identity] /web/auth-config is unreachable:",t),new Error(V("identity.loadConfigNetworkFailed"))}if(!e.ok)throw new Error(V("identity.configServiceFailed",{status:e.status}));try{const t=await e.json();if(!Array.isArray(t.providers))throw new TypeError("providers is not an array");return t.providers}catch(t){throw console.warn("[identity] /web/auth-config returned an invalid response:",t),new Error(V("identity.invalidConfigResponse"))}}function PYe(e){const t=window.location.pathname+window.location.search+window.location.hash,n=e.includes("?")?"&":"?";window.location.assign(`${e}${n}redirect=${encodeURIComponent(t)}`)}function DYe(){const e=window.location.pathname+window.location.search+window.location.hash,t=window.open("about:blank","_blank","popup,width=520,height=720");if(!t)return null;try{t.opener=null,t.location.replace(`/oauth2/login?redirect=${encodeURIComponent(e)}`)}catch{return t.close(),null}return t}async function MYe(){const[e,t]=await Promise.all([F$(),EEe()]);return e.status==="unauthenticated"&&t.length>0}function LYe(){window.location.assign("/oauth2/logout")}async function $Ye(){for(let e=0;;e+=1){let t;try{t=await fetch("/oauth2/userinfo",{headers:Ml({Accept:"application/json"}),signal:Ha(void 0,vU)})}catch(i){throw console.warn("[identity] /oauth2/userinfo is unreachable:",i),new Error(V("identity.serviceNetworkFailed"))}const n=NYe[e];if(t.status!==401||t.headers.get(jYe)!=="1"||n===void 0)return t;await new Promise(i=>window.setTimeout(i,n))}}async function F$(){const e=await $Ye();if(e.ok){let n;try{n=await e.json()}catch(r){throw console.warn("[identity] /oauth2/userinfo returned a non-JSON response:",r),new Error(V("identity.invalidServiceResponse"))}return{status:"authenticated",userId:String(n.sub??n.user_id??n.email??""),info:n}}if(e.status===401)return{status:"unauthenticated",userId:"",local:!1};if(e.status!==404)throw new Error(V("identity.serviceFailed",{status:e.status}));const t=SEe();return t?{status:"authenticated",userId:t,info:{name:t},local:!0}:{status:"unauthenticated",userId:"",local:!0}}function FYe(e){if(!e)return"";for(const t of[e.name,e.preferred_username,e.username,e.email])if(typeof t=="string"&&t.trim())return t.trim();return""}function BYe(e){const t=e==null?void 0:e.picture;return typeof t=="string"?t.trim():""}const B$="veadk:authentication-required";let Bk=null,ZO=null;function UYe(e){if(!e.redirected||!e.url)return!1;try{const t=new URL(e.url);return t.pathname.includes("/authorize")||t.pathname.includes("/oauth2/login")||t.hostname.includes(".userpool.auth.")}catch{return!1}}function QYe(e){Bk||(Bk=new Promise(n=>{ZO=n}),window.dispatchEvent(new Event(B$)));const t=Bk;return e?e.aborted?Promise.reject(e.reason??new Error("Request aborted")):new Promise((n,i)=>{const r=()=>i(e.reason??new Error("Request aborted"));e.addEventListener("abort",r,{once:!0}),t.then(()=>{e.removeEventListener("abort",r),n()},s=>{e.removeEventListener("abort",r),i(s)})}):t}function zYe(){return Bk!==null}function VYe(){ZO==null||ZO(),ZO=null,Bk=null}async function UI(e,t){var i;const n=await e.text().catch(()=>"");try{return JSON.parse(n)}catch{const r=((i=e.headers.get("content-type"))==null?void 0:i.split(";",1)[0])||V("common.contentTypeMissing"),s=n.trim().slice(0,2e3),a=s?` ${V("common.response",{response:s})}`:"";throw new Error(V("jsonResponse.nonJson",{fallback:t,status:e.status,contentType:r,detail:a}))}}const HYe=/\brun_sse\s*failed\s*:\s*404\b/i,qYe=/session not found/i,WYe=/(?:^|[::\s])not found\s*$/i,KYe=/Expecting (?:'[^']+'|\w+)(?: delimiter)?: line \d+ column \d+ \(char \d+\)/i,GYe=/Unknown or expired collection_id\s+'[^']+'\.\s*Call collect_resources first\./i,XYe=/(?:RateLimitError|\bTPM\b|\bRPM\b|tokens? per minute|requests? per minute)[\s\S]*(?:\b429\b|limit|quota)|\b429\b[\s\S]*(?:model|RateLimitError|\bTPM\b|\bRPM\b)/i;function D0(e,t){return e.includes(t)?e:`${e} ${t}`}function lm(e){const t=String(e),n=V("runSse.rawResponseLabel");let i=t.includes(n)?t:`${n}${t}`;if(KYe.test(t))i=D0(i,V("runSse.toolArgumentHint"));else{if(GYe.test(t))return D0(i,V("runSse.resourceCollectionExpiredHint"));if(XYe.test(t))return D0(i,V("runSse.modelQuotaHint"));HYe.test(t)&&(qYe.test(t)?i=D0(i,V("runSse.persistentMemoryHint")):WYe.test(t)&&(i=D0(i,V("runSse.unsupportedRouteHint"))))}return D0(i,V("runSse.networkConfigurationHint"))}async function*QI(e){if(!e.body)throw new Error("Response has no body");const t=e.body.getReader(),n=new TextDecoder;let i="";const r=a=>a.length>500?V("sse.truncatedData",{data:a.slice(0,500),count:a.length}):a,s=(a,l=!1)=>{const c=a.split(/\r?\n/).filter(u=>u.startsWith("data:")).map(u=>u.slice(5).trimStart()).join(` @@ -470,7 +470,7 @@ data: ${JSON.stringify({...n,...r?{id:r}:{},...a?{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 ka=wn("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),lZ=Object.freeze({totalTokenCount:0,promptTokenCount:0,candidatesTokenCount:0,thoughtsTokenCount:0,cachedContentTokenCount:0}),q_=Object.freeze({modelName:"",current:lZ,cumulative:lZ}),prt={totalTokenCount:"total_token_count",promptTokenCount:"prompt_token_count",candidatesTokenCount:"candidates_token_count",thoughtsTokenCount:"thoughts_token_count",cachedContentTokenCount:"cached_content_token_count"},mrt=24,grt=64,brt=16;function P2(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),a=((c=r.match(/[^\sA-Za-z0-9_]/g))==null?void 0:c.length)??0;return i+s+a}function yrt(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=P2(t),s=n.reduce((d,f)=>d+grt+P2(f),0),a=i.reduce((d,f)=>d+brt+P2(f.name)+P2(f.description??""),0);return mrt+r+s+a}function vrt({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),a=Math.min(i,r>0?Math.min(r,Math.max(0,n??0)):Math.max(0,n??0)),l=Math.max(0,r-a),c=r>0?Math.max(0,s-r):Math.max(0,s),u=r>0?s:a+c;return{systemTokens:a,inputTokens:l,outputTokens:c,remainingTokens:Math.max(0,i-u),usedTokens:u,contextWindow:i}}function xrt(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 a=i;return i+=s.tokens,{...s,start:a,end:i}});return Array.from({length:100},(s,a)=>{const l=a*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:a,slices:u}})}function aO(e,t){const n=e,i=n[t]??n[prt[t]];return typeof i=="number"&&Number.isFinite(i)&&i>0?Math.round(i):0}function wrt(e){const t=aO(e,"promptTokenCount"),n=aO(e,"candidatesTokenCount"),i=aO(e,"thoughtsTokenCount");return{totalTokenCount:aO(e,"totalTokenCount")||t+n+i,promptTokenCount:t,candidatesTokenCount:n,thoughtsTokenCount:i,cachedContentTokenCount:aO(e,"cachedContentTokenCount")}}function Ort(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 fAe(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 a=wrt(s);return a.totalTokenCount===0?r===e.modelName?e:{...e,modelName:r}:{modelName:r,current:a,cumulative:Ort(e.cumulative,a)}}function cZ(e){return e.reduce((t,n)=>fAe(t,n),q_)}function uZ(e){return e.blocks.flatMap(t=>t.kind==="tool"?[{name:t.name,args:t.args,response:t.response,done:t.done}]:[])}function krt(e){const t=e.attributes;return String(t["invocation.id"]??t["gen_ai.invocation.id"]??t["gcp.vertex.agent.invocation_id"]??"")}function Srt(e,t){if(!t)return e;const n=new Set(e.filter(r=>krt(r)===t).map(r=>r.trace_id)),i=e.filter(r=>n.has(r.trace_id));return i.length>0?i:e}function wy(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function Tm(e){return typeof e=="string"?e:""}function hAe(e,t){return e==="pending"||e==="running"||e==="completed"||e==="failed"?e:t}function Ert(e){let t=e;if(typeof t=="string")try{t=JSON.parse(t)}catch{return{}}const n=wy(t)??{};return wy(n.result)??n}function Crt(e){var n;const t=(n=wy(e))==null?void 0:n.branches;return Array.isArray(t)?t.map(i=>{var r;return Tm((r=wy(i))==null?void 0:r.label)}):[]}function pAe(e,t,n){const i=Crt(e),r=Ert(t),s=Array.isArray(r.branches)?r.branches:[],a=n==="running"?"running":"pending";return{branches:[0,1].map(c=>{const u=wy(s[c])??{};return{label:Tm(u.label)||i[c]||`方向 ${c+1}`,content:Tm(u.content),status:hAe(u.status,a),error:Tm(u.error)}})}}function Trt(e){const t=wy(e),n=wy(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:Tm(n.requestId),branchIndex:n.branchIndex,label:Tm(n.label),delta:Tm(n.delta),status:hAe(n.status,"running"),error:Tm(n.error)||void 0}}function Art(e,t,n){return{branches:pAe(e,t,"running").branches.map((s,a)=>a===n.branchIndex?{...s,label:n.label||s.label,content:s.content+n.delta,status:n.status,error:n.error??s.error}:s)}}function _a(e,t){return mn.t(`blocks.codexProgress.${e}`,{ns:"conversation",...t})}const mAe=28e4;function dZ(e){try{return JSON.stringify(e).length}catch{return mAe}}function _rt(e){const t=e.slice(-200);let n=t.reduce((i,r)=>i+dZ(r),0);for(;t.length>1&&n>mAe;)n-=dZ(t.shift());return t}function Kc(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function Bi(e){return typeof e=="string"?e:""}function vQ(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 gAe(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 bAe(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 wb(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 yAe(e){const t=Bi(e.id||e.itemId||e.item_id),n=Bi(e.kind);if(!t||!n)return null;const i=vQ(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 a=Array.isArray(e.plan)?e.plan:[];return{id:t,block:{kind:"plan",title:Bi(e.title)||_a("planTitle"),summary:r||void 0,items:a.flatMap(l=>{const c=Kc(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 a=_a(n==="file_change"||n==="fileChange"?"fallback.fileChange":n==="approval"?"fallback.approval":n==="status"?"fallback.status":"fallback.command"),l=bAe(e),c=gAe(e)??(n==="status"&&r||void 0);return{id:t,block:wb(Bi(e.name||e.title)||a,t,i,l,c)}}return null}function vAe(e){const t=Bi(e.type),n=Kc(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=vQ(n==null?void 0:n.status,t);if(i==="reasoning"||i==="agent_message"){const a=Bi(n==null?void 0:n.text);return a?{id:r,block:i==="reasoning"?{kind:"thinking",text:a,done:s!=="running"}:{kind:"text",text:a},...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=Kc(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:_a("planTitle"),summary:_a("planSummary",{completed:l.filter(c=>c.status==="completed").length,total:l.length}),items:l,done:s!=="running"}}:null}if(i==="command_execution"){const a=_a(`command.${s}`);return{id:r,block:wb(a,r,s,bAe(n??{}),gAe(n??{}))}}if(i==="file_change"){const a=Array.isArray(n==null?void 0:n.changes)?n.changes:[],l=a.length?_a("projectFiles",{count:a.length}):_a("projectFile"),c=_a(`fileChange.${s}`,{subject:l});return{id:r,block:wb(c,r,s,a.length?{changes:a}:void 0)}}if(i==="mcp_tool_call"){const a=[Bi(n==null?void 0:n.server),Bi(n==null?void 0:n.tool)].filter(Boolean).join("/")||_a("externalTool"),l=_a(`mcp.${s}`,{tool:a}),c=Kc(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:wb(l,r,s,n==null?void 0:n.arguments,u)}}if(i==="collab_tool_call"){const a=Bi(n==null?void 0:n.tool),l=["spawn_agent","send_input","wait","close_agent"].includes(a)?a:"default",c=_a(`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:wb(c,r,s,Object.keys(u).length?u:void 0,n==null?void 0:n.agents_states)}}if(i==="web_search"){const a=_a(`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:wb(a,r,s,Object.keys(l).length?l:void 0)}}if(i==="error"||t==="error"||t==="turn.failed"){const a=Kc(e.error),l=Bi((n==null?void 0:n.message)||e.message||(a==null?void 0:a.message))||_a("errorDetail");return{id:r,block:wb(_a("errorTitle"),r,"failed",void 0,l)}}return null}function jrt(e){const t=Kc(e),n=Kc(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=Kc(n.event??n.activity);if(!s)return null;const a=Kc(s.item)||Bi(s.type)?vAe(s):yAe(s);if(!a)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=vQ(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:a}}function Nrt(e,t){const n=Kc(t),i=Kc((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),a=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}:{},...a?{sandboxSessionId:a}:{},...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=Kc(d);if(!f)continue;const h=Kc(f.item)||Bi(f.type)?vAe(f):yAe(f);h&&(h.finalAnswer||(c=pF(c,{title:r,...s?{agentSessionId:s}:{},...a?{sandboxSessionId:a}:{},...l?{threadId:l}:{},event:h})))}return c}function pF(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:_rt(n)}}const xAe="send_a2ui_json_to_client",mF="validated_a2ui_json",gF="adk_request_credential",fZ="transfer_to_agent";function Rrt(e){var i,r,s,a;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)??((a=t==null?void 0:t.raw_auth_credential)==null?void 0:a.oauth2);return(n==null?void 0:n.authUri)??(n==null?void 0:n.auth_uri)}function bF(){return{blocks:[],liveStart:0,pendingCodexProgress:[]}}function hZ(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=pF(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=pF(i.codexActivity,t),i.status=t.terminalStatus??"running",t.terminalStatus&&(i.done=!0),"applied")}return"unmatched"}function Irt(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 pZ(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 yF=e=>e.functionCall??e.function_call,ZS=e=>e.functionResponse??e.function_response;function Prt(e){if(!e||typeof e!="object")return"";const t=e,n=t.agentName??t.agent_name;return typeof n=="string"?n:""}function Drt(e){return e.replace(/-/g,"+").replace(/_/g,"/")}function bP(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 a=r==null?void 0:r.veadkMedia;if(typeof(a==null?void 0:a.uri)=="string"){t.push({id:String(a.id??a.uri),mimeType:typeof a.mimeType=="string"?a.mimeType:void 0,uri:a.uri,name:typeof a.name=="string"?a.name:void 0,sizeBytes:typeof a.sizeBytes=="number"?a.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:Drt(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 JS(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 Mrt=new Set(["llm","sequential","parallel","loop","a2a"]);function Lrt(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 a;const l=r.targetAgent;if(l&&typeof l=="object"){const c=l,u=c.type;typeof c.name=="string"&&typeof u=="string"&&Mrt.has(u)&&Array.isArray(c.path)&&(a={name:c.name,description:typeof c.description=="string"?c.description:"",type:u,path:c.path.filter(d=>typeof d=="string")})}if(s.length>0||a)return{skills:s,targetAgent:a}}}function $rt(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 Frt(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 rL(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 D2(e){for(const t of e)t.kind==="thinking"&&(t.done=!0)}function wAe(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)??[],a=s.flatMap(v=>{const y=Trt(v.partMetadata??v.part_metadata);return y?[y]:[]}),l=s.flatMap(v=>{const y=jrt(v.partMetadata??v.part_metadata);return y?[y]:[]});if(a.length>0||l.length>0){for(const v of a)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=Art(x.args,x.response,v),x.status="running";break}}for(const v of l)hZ(n,v)==="unmatched"&&(r=[...r,v].slice(-64));return{blocks:n,liveStart:i,pendingCodexProgress:r}}const c=s.some(v=>yF(v)||ZS(v));if(t.partial&&!c){for(const v of s){const y=JS(v);typeof y=="string"&&y&&rL(n,v.thought?"thinking":"text",y)}return{blocks:n,liveStart:i,pendingCodexProgress:r}}n.length=i;for(const v of s){const y=yF(v),x=ZS(v),w=bP([v]),O=JS(v);if(typeof O=="string"&&O)rL(n,v.thought?"thinking":"text",O);else if(w.length)D2(n),$rt(n,w);else if(y)if(D2(n),y.name===fZ){const S=Prt(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===gF){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:Rrt(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?hZ(n,C):k.push(C);r=k}}else if(x){if(D2(n),x.name===fZ)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===gF)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?pZ(k.response):"";if(k.done=!0,k.response=x.response,C){k.codexActivity=Nrt(k.codexActivity,x.response),k.status=Irt(x.response);const N=pZ(x.response);N&&N!==E&&rL(n,"text",N)}break}}if(x.name===xAe){const S=((m=x.response)==null?void 0:m[mF])??[];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&&Frt(n,Object.entries(u).map(([v,y])=>({filename:v,version:y}))),D2(n),i=n.length,{blocks:n,liveStart:i,pendingCodexProgress:r}}function Brt(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=JS(b);return!b.thought&&typeof v=="string"&&v.trim().length>0||bP([b]).length>0}),r=n.some(b=>{var y;const v=ZS(b);return(v==null?void 0:v.name)===xAe&&Array.isArray((y=v.response)==null?void 0:y[mF])&&v.response[mF].length>0}),s=((d=e.actions)==null?void 0:d.artifactDelta)??((f=e.actions)==null?void 0:f.artifact_delta),a=!!(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||a||l&&c}function Urt(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=>!!(JS(s)||bP([s]).length>0||yF(s)||ZS(s)))}function vF(e="adk-stream",t){var a,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=((a=t.meta)==null?void 0:a.author)??"",d=((l=t.meta)==null?void 0:l.invocationId)??"",f=((c=t.meta)==null?void 0:c.localId)??`${e}-${n++}`,h=bF();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&&!Urt(u))return{turn:{role:"assistant",blocks:[]},completed:!1,ignored:!0};if(!m){const y=`${e}-${n++}`;m={acc:bF(),localId:y,meta:{author:d||void 0,invocationId:f||void 0}}}m.acc=wAe(m.acc,u);const g=u.usageMetadata??u.usage_metadata,b=Brt(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 Db(e,t){var s;const n=(s=t.meta)==null?void 0:s.localId;if(!n)return[...e,t];const i=e.findIndex(a=>{var l;return((l=a.meta)==null?void 0:l.localId)===n});if(i<0)return[...e,t];const r=e.slice();return r[i]=t,r}function Qrt(e,t={}){var r;let n=[],i=vF("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=ZS(h))==null?void 0:m.name)===gF})){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(JS).filter(h=>!!h).join(""),u=bP(l),d=Lrt(l);if(!c&&!u.length&&!d)continue;for(const h of i.finish())n=Db(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=Db(n,l.turn))}for(const s of i.finish())n=Db(n,s);for(const s of n){const a=s.meta,l=a==null?void 0:a.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"||(a.feedback=c)}return n}function yP(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(a=>a.text).find(Boolean);if(s)return s}return t}function OAe(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=OAe(i,t,e);if(r)return r}}function zrt(e,t){var a,l;if(e.role!=="assistant"||!t)return;const n=(a=e.meta)==null?void 0:a.author;if(!n)return;const i=OAe(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 Vrt(e,t){const n=[];return e.forEach((i,r)=>{const s=zrt(i,t),a=n[n.length-1];if(s&&(a==null?void 0:a.groupKey)===s.key){a.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 Hrt(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("circle",{cx:"9",cy:"8",r:"3.25"}),o.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 kAe(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},xQ=e=>{const t=qrt(e),n=p.Children.count(t);return p.Children.map(t,i=>{if(typeof i=="string"&&i.trim())return n<=1?i:o.jsx("span",{children:i});if(p.isValidElement(i)){const r=i,{children:s,...a}=r.props;return s!=null?p.cloneElement(r,a,xQ(s)):r}return i})},Wrt="_Badge_1viyg_1",Krt={Badge:Wrt},Lo=({children:e,className:t,variant:n="soft",color:i="secondary",size:r="sm",pill:s,...a})=>o.jsx("div",{className:Ci(Krt.Badge,t),"data-color":i,"data-size":r,"data-pill":s?"":void 0,"data-variant":n,...a,children:xQ(e)});var Grt=typeof xm=="object"&&xm&&xm.Object===Object&&xm,Xrt=typeof self=="object"&&self&&self.Object===Object&&self;Grt||Xrt||Function("return this")();var Yrt=typeof window<"u"?p.useLayoutEffect:p.useEffect;function Zrt(){const e=p.useRef(!1);return p.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]),p.useCallback(()=>e.current,[])}var mZ={width:void 0,height:void 0};function SAe(e){const{ref:t,box:n="content-box"}=e,[{width:i,height:r},s]=p.useState(mZ),a=Zrt(),l=p.useRef({...mZ}),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=gZ(d,f,"inlineSize"),m=gZ(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):a()&&s(b)}});return u.observe(t.current,{box:n}),()=>{u.disconnect()}},[n,t,a]),{width:i,height:r}}function gZ(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 wQ(e,t){const n=p.useRef(e);Yrt(()=>{n.current=e},[e]),p.useEffect(()=>{if(!t&&t!==0)return;const i=setTimeout(()=>{n.current()},t);return()=>{clearTimeout(i)}},[t])}const Jrt={DEV:!1,MODE:"production"},ax=typeof import.meta<"u"?Jrt:void 0,est=!!(ax!=null&&ax.DEV),tst=typeof navigator<"u"&&/(jsdom|happy-dom)/i.test(navigator.userAgent)||typeof globalThis.happyDOM=="object",EAe=(ax==null?void 0:ax.MODE)==="test"||tst,nst=typeof window<"u",CAe=typeof document<"u",ist=nst&&CAe,OQ=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())},PN=(e,t)=>{const n=()=>{const a=setTimeout(e);return()=>{clearTimeout(a)}};if(!ist||typeof window.requestAnimationFrame!="function"||CAe&&document.visibilityState==="hidden")return n();let r=2,s=window.requestAnimationFrame(function a(){r-=1,r===0?e():s=window.requestAnimationFrame(a)});return()=>{typeof window.cancelAnimationFrame=="function"&&window.cancelAnimationFrame(s)}},Ky=e=>Object.keys(e).reduce((n,i)=>{const r=e[i];if(r||r===0){const s=i.startsWith("--")?"":"--",a=typeof r=="number"?`${r}px`:r;n[`${s}${i}`]=a}return n},{}),sL=e=>typeof e=="number"?`${e}deg`:e,oL=e=>String(e),M2=e=>`${e}ms`,aL=({x:e,y:t,scale:n,rotate:i,skewX:r,skewY:s}={})=>{const a=[e==null?null:`translateX(${e}px)`,t==null?null:`translateY(${t}px)`,n==null?null:`scale(${n})`,i==null?null:`rotate(${sL(i)})`,r==null?null:`skewX(${sL(r)})`,s==null?null:`skewY(${sL(s)})`].filter(Boolean);return a.length?a.join(" "):"none"},lL=({blur:e}={})=>{const t=[e==null?null:`blur(${e}px)`].filter(Boolean);return t.length?t.join(" "):"none"},Gh=e=>{e.preventDefault()},TAe=e=>e.querySelectorAll('a[href], input:not([disabled]):not([type="hidden"]), textarea:not([disabled]), button:not([disabled]), [tabindex]:not([tabindex^="-"]), [contenteditable]'),rst="_LoadingIndicator_7yl6f_1",sst={LoadingIndicator:rst},jC=({className:e,size:t,strokeWidth:n,style:i,...r})=>o.jsx("div",{...r,className:Ci(sst.LoadingIndicator,e),style:i||Ky({"indicator-size":t,"indicator-stroke":n})});var ost=Object.defineProperty,kQ=(e,t)=>ost(e,"name",{value:t,configurable:!0});function xF(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}kQ(xF,"setRef");function AAe(...e){return t=>{let n=!1;const i=e.map(r=>{const s=xF(r,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let r=0;rast(e,"name",{value:t,configurable:!0});function up(e){const t=p.forwardRef((n,i)=>{let{children:r,...s}=n,a=null,l=!1;const c=[];wF(r)&&typeof L2=="function"&&(r=L2(r._payload)),p.Children.forEach(r,h=>{var m;if(PAe(h)){l=!0;const g=h;let b="child"in g.props?g.props.child:g.props.children;wF(b)&&typeof L2=="function"&&(b=L2(b._payload)),a=lst(g,b),c.push((m=a==null?void 0:a.props)==null?void 0:m.children)}else c.push(h)}),a?a=p.cloneElement(a,void 0,c):!l&&p.Children.count(r)===1&&p.isValidElement(r)&&(a=r);const u=a?IAe(a):void 0,d=pr(i,u);if(!a){if(r||r===0)throw new Error(l?dst(e):ust(e));return r}const f=RAe(s,a.props??{});return a.type!==p.Fragment&&(f.ref=i?d:u),p.cloneElement(a,f)});return t.displayName=`${e}.Slot`,t}Bd(up,"createSlot");var _Ae=up("Slot"),jAe=Symbol.for("radix.slottable");function NAe(e){const t=Bd(n=>"child"in n?n.children(n.child):n.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=jAe,t}Bd(NAe,"createSlottable");var lst=Bd((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 RAe(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}}Bd(RAe,"mergeProps");function IAe(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)}Bd(IAe,"getElementRef");function PAe(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===jAe}Bd(PAe,"isSlottable");var cst=Symbol.for("react.lazy");function wF(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===cst&&"_payload"in e&&DAe(e._payload)}Bd(wF,"isLazyComponent");function DAe(e){return typeof e=="object"&&e!==null&&"then"in e}Bd(DAe,"isPromiseLike");var ust=Bd(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),dst=Bd(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),L2=Fy[" use ".trim().toString()],fst=Object.defineProperty,hst=(e,t)=>fst(e,"name",{value:t,configurable:!0}),pst=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Mr=pst.reduce((e,t)=>{const n=up(`Primitive.${t}`),i=p.forwardRef((r,s)=>{const{asChild:a,...l}=r,c=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:s})});return i.displayName=`Primitive.${t}`,{...e,[t]:i}},{});function SQ(e,t){e&&Jn.flushSync(()=>e.dispatchEvent(t))}hst(SQ,"dispatchDiscreteCustomEvent");var mst=Object.defineProperty,gst=(e,t)=>mst(e,"name",{value:t,configurable:!0}),bst=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"}),yst=p.forwardRef(gst(function(t,n){return o.jsx(Mr.span,{...t,ref:n,style:{...bst,...t.style}})},"VisuallyHidden")),vst=yst,xst=Object.defineProperty,Nu=(e,t)=>xst(e,"name",{value:t,configurable:!0});function wst(e,t){const n=p.createContext(t);n.displayName=e+"Context";const i=Nu(s=>{const{children:a,...l}=s,c=p.useMemo(()=>l,Object.values(l));return o.jsx(n.Provider,{value:c,children:a})},"Provider");i.displayName=e+"Provider";function r(s,a={}){const{optional:l=!1}=a,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 Nu(r,"useContext"),[i,r]}Nu(wst,"createContext");function gc(e,t=[]){let n=[];function i(s,a){const l=p.createContext(a);l.displayName=s+"Context";const c=n.length;n=[...n,a];const u=Nu(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 o.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(a!==void 0)return a;if(!g)throw new Error(`\`${f}\` must be used within \`${s}\``)}return Nu(d,"useContext"),[u,d]}Nu(i,"createContext");const r=Nu(()=>{const s=n.map(a=>p.createContext(a));return Nu(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,MAe(r,...t)]}Nu(gc,"createContextScope");function MAe(...e){const t=e[0];if(e.length===1)return t;const n=Nu(()=>{const i=e.map(r=>({useScope:r(),scopeName:r.scopeName}));return Nu(function(s){const a=i.reduce((l,{useScope:c,scopeName:u})=>{const f=c(s)[`__scope${u}`];return{...l,...f}},{});return p.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])},"useComposedScopes")},"createScope");return n.scopeName=t.scopeName,n}Nu(MAe,"composeContextScopes");var Ost=Object.defineProperty,ga=(e,t)=>Ost(e,"name",{value:t,configurable:!0});function EQ(e){const t=e+"CollectionProvider",[n,i]=gc(t),[r,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=ga(b=>{const{scope:v,children:y}=b,x=p.useRef(null),w=p.useRef(new Map).current;return o.jsx(r,{scope:v,itemMap:w,collectionRef:x,children:y})},"CollectionProvider");a.displayName=t;const l=e+"CollectionSlot",c=up(l),u=p.forwardRef((b,v)=>{const{scope:y,children:x}=b,w=s(l,y),O=pr(v,w.collectionRef);return o.jsx(c,{ref:O,children:x})});u.displayName=l;const d=e+"CollectionItemSlot",f="data-radix-collection-item",h=up(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))),o.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 ga(g,"useCollection"),[{Provider:a,Slot:u,ItemSlot:m},g,i]}ga(EQ,"createCollection");var bZ=new WeakMap,jo,Uc,cL=(Uc=class extends Map{constructor(n){super(n);WW(this,jo);LM(this,jo,[...super.keys()]),bZ.set(this,!0)}set(n,i){return bZ.get(this)&&(this.has(n)?tl(this,jo)[tl(this,jo).indexOf(n)]=n:tl(this,jo).push(n)),super.set(n,i),this}insert(n,i,r){const s=this.has(i),a=tl(this,jo).length,l=CQ(n);let c=l>=0?l:a+l;const u=c<0||c>=a?-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=[...tl(this,jo)];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 a of this)Reflect.apply(n,i,[a,s,this])&&r.push(a),s++;return new Uc(r)}map(n,i){const r=[];let s=0;for(const a of this)r.push([a[0],Reflect.apply(n,i,[a,s,this])]),s++;return new Uc(r)}reduce(...n){const[i,r]=n;let s=0,a=r??this.at(0);for(const l of this)s===0&&n.length===1?a=l:a=Reflect.apply(i,this,[a,l,s,this]),s++;return a}reduceRight(...n){const[i,r]=n;let s=r??this.at(-1);for(let a=this.size-1;a>=0;a--){const l=this.at(a);a===this.size-1&&n.length===1?s=l:s=Reflect.apply(i,this,[s,l,a,this])}return s}toSorted(n){const i=[...this.entries()].sort(n);return new Uc(i)}toReversed(){const n=new Uc;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 Uc(i)}slice(n,i){const r=new Uc;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 a=n;a<=s;a++){const l=this.keyAt(a),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}},jo=new WeakMap,ga(Uc,"OrderedDict"),Uc);function W_(e,t){if("at"in Array.prototype)return Array.prototype.at.call(e,t);const n=LAe(e,t);return n===-1?void 0:e[n]}ga(W_,"at");function LAe(e,t){const n=e.length,i=CQ(t),r=i>=0?i:n+i;return r<0||r>=n?-1:r}ga(LAe,"toSafeIndex");function CQ(e){return e!==e||e===0?0:Math.trunc(e)}ga(CQ,"toSafeInteger");function kst(e){const t=e+"CollectionProvider",[n,i]=gc(t),[r,s]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new cL,setItemMap:ga(()=>{},"setItemMap")}),a=ga(({state:w,...O})=>w?o.jsx(c,{...O,state:w}):o.jsx(l,{...O}),"CollectionProvider");a.displayName=t;const l=ga(w=>{const O=v();return o.jsx(c,{...w,state:O})},"CollectionInit");l.displayName=t+"Init";const c=ga(w=>{const{scope:O,children:S,state:k}=w,C=p.useRef(null),[E,N]=p.useState(null),A=pr(C,N),[j,T]=k;return p.useEffect(()=>{if(!E)return;const R=BAe(()=>{});return R.observe(E,{childList:!0,subtree:!0}),()=>{R.disconnect()}},[E]),o.jsx(r,{scope:O,itemMap:j,setItemMap:T,collectionRef:A,collectionRefObject:C,collectionElement:E,children:S})},"CollectionProviderImpl");c.displayName=t+"Impl";const u=e+"CollectionSlot",d=up(u),f=p.forwardRef((w,O)=>{const{scope:S,children:k}=w,C=s(u,S),E=pr(O,C.collectionRef);return o.jsx(d,{ref:E,children:k})});f.displayName=u;const h=e+"CollectionItemSlot",m="data-radix-collection-item",g=up(h),b=p.forwardRef((w,O)=>{const{scope:S,children:k,...C}=w,E=p.useRef(null),[N,A]=p.useState(null),j=pr(O,E,A),T=s(h,S),{setItemMap:R}=T,_=p.useRef(C);$Ae(_.current,C)||(_.current=C);const D=_.current;return p.useEffect(()=>{const M=D;return R(P=>N?P.has(N)?P.set(N,{...M,element:N}).toSorted(OF):(P.set(N,{...M,element:N}),P.toSorted(OF)):P),()=>{R(P=>!N||!P.has(N)?P:(P.delete(N),new cL(P)))}},[N,D,R]),o.jsx(g,{[m]:"",ref:j,children:k})});b.displayName=h;function v(){return p.useState(new cL)}ga(v,"useInitCollection");function y(w){const{itemMap:O}=s(e+"CollectionConsumer",w);return O}return ga(y,"useCollection"),[{Provider:a,Slot:f,ItemSlot:b},{createCollectionScope:i,useCollection:y,useInitCollection:v}]}ga(kst,"createCollection");function $Ae(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}ga($Ae,"shallowEqual");function FAe(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}ga(FAe,"isElementPreceding");function OF(e,t){return!e[1].element||!t[1].element?0:FAe(e[1].element,t[1].element)?-1:1}ga(OF,"sortByDocumentPosition");function BAe(e){return new MutationObserver(n=>{for(const i of n)if(i.type==="childList"){e();return}})}ga(BAe,"getChildListObserver");var Sst=Object.defineProperty,Hw=(e,t)=>Sst(e,"name",{value:t,configurable:!0}),UAe=!!(typeof window<"u"&&window.document&&window.document.createElement);function An(e,t,{checkForDefaultPrevented:n=!0}={}){return Hw(function(r){if(e==null||e(r),n===!1||!r||!r.defaultPrevented)return t==null?void 0:t(r)},"handleEvent")}Hw(An,"composeEventHandlers");function Est(e){var t;if(!UAe)throw new Error("Cannot access window outside of the DOM");return((t=e==null?void 0:e.ownerDocument)==null?void 0:t.defaultView)??window}Hw(Est,"getOwnerWindow");function kF(e){if(!UAe)throw new Error("Cannot access document outside of the DOM");return(e==null?void 0:e.ownerDocument)??document}Hw(kF,"getOwnerDocument");function QAe(e,t=!1){const{activeElement:n}=kF(e);if(!(n!=null&&n.nodeName))return null;if(zAe(n)&&n.contentDocument)return QAe(n.contentDocument.body,t);if(t){const i=n.getAttribute("aria-activedescendant");if(i){const r=kF(n).getElementById(i);if(r)return r}}return n}Hw(QAe,"getActiveElement");function zAe(e){return e.tagName==="IFRAME"}Hw(zAe,"isFrame");var Hu=globalThis!=null&&globalThis.document?p.useLayoutEffect:()=>{},Cst=Object.defineProperty,Tst=(e,t)=>Cst(e,"name",{value:t,configurable:!0}),yZ=Fy[" useEffectEvent ".trim().toString()],vZ=Fy[" useInsertionEffect ".trim().toString()];function VAe(e){if(typeof yZ=="function")return yZ(e);const t=p.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof vZ=="function"?vZ(()=>{t.current=e}):Hu(()=>{t.current=e}),p.useMemo(()=>(...n)=>{var i;return(i=t.current)==null?void 0:i.call(t,...n)},[])}Tst(VAe,"useEffectEvent");var Ast=Object.defineProperty,NC=(e,t)=>Ast(e,"name",{value:t,configurable:!0}),_st=Fy[" useInsertionEffect ".trim().toString()]||Hu;function ed({prop:e,defaultProp:t,onChange:n=NC(()=>{},"onChange"),caller:i}){const[r,s,a]=HAe({defaultProp:t,onChange:n}),l=e!==void 0,c=l?e:r,u=p.useCallback(d=>{var f;if(l){const h=qAe(d)?d(e):d;h!==e&&((f=a.current)==null||f.call(a,h))}else s(d)},[l,e,s,a]);return[c,u]}NC(ed,"useControllableState");function HAe({defaultProp:e,onChange:t}){const[n,i]=p.useState(e),r=p.useRef(n),s=p.useRef(t);return _st(()=>{s.current=t},[t]),p.useEffect(()=>{var a;r.current!==n&&((a=s.current)==null||a.call(s,n),r.current=n)},[n,r]),[n,i,s]}NC(HAe,"useUncontrolledState");function qAe(e){return typeof e=="function"}NC(qAe,"isFunction");var xZ=Symbol("RADIX:SYNC_STATE");function jst(e,t,n,i){const{prop:r,defaultProp:s,onChange:a,caller:l}=t,c=r!==void 0,u=VAe(a),d=[{...n,state:s}];i&&d.push(i);const[f,h]=p.useReducer((v,y)=>{if(y.type===xZ)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:xZ,state:r})},[r,f.state,c]),[b,h]}NC(jst,"useControllableStateReducer");var Nst=Object.defineProperty,dp=(e,t)=>Nst(e,"name",{value:t,configurable:!0});function WAe(e,t){return p.useReducer((n,i)=>t[n][i]??n,e)}dp(WAe,"useStateMachine");var Hf=dp(e=>{const{present:t,children:n}=e,i=KAe(t),r=typeof n=="function"?n({present:i.isPresent}):p.Children.only(n),s=GAe(i.ref,XAe(r));return typeof n=="function"||i.isPresent?p.cloneElement(r,{ref:s}):null},"Presence");function KAe(e){const[t,n]=p.useState(),i=p.useRef(null),r=p.useRef(e),s=p.useRef("none"),a=p.useRef(void 0),l=e?"mounted":"unmounted",[c,u]=WAe(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return p.useEffect(()=>{c==="mounted"?(s.current=a.current??lv(i.current),a.current=void 0):s.current="none"},[c]),Hu(()=>{const d=i.current,f=r.current;if(f!==e){const m=s.current,g=lv(d);e?(a.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]),Hu(()=>{if(t){let d;const f=t.ownerDocument.defaultView??window,h=dp(g=>{const v=lv(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=dp(g=>{g.target===t&&(s.current=lv(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,a.current=lv(f)}else i.current=null;n(d)},[])}}dp(KAe,"usePresence");function SF(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}dp(SF,"setRef");function GAe(...e){const t=p.useRef(e);return t.current=e,p.useCallback(n=>{const i=t.current;let r=!1;const s=i.map(a=>{const l=SF(a,n);return!r&&typeof l=="function"&&(r=!0),l});if(r)return()=>{for(let a=0;aRst(e,"name",{value:t,configurable:!0}),Pst=Fy[" useId ".trim().toString()]||(()=>{}),Dst=0;function lg(e){const[t,n]=p.useState(Pst());return Hu(()=>{e||n(i=>i??String(Dst++))},[e]),e||(t?`radix-${t}`:"")}Ist(lg,"useId");var Mst=Object.defineProperty,Lst=(e,t)=>Mst(e,"name",{value:t,configurable:!0}),$st=p.createContext(void 0);function RC(e){const t=p.useContext($st);return e||t||"ltr"}Lst(RC,"useDirection");var Fst=Object.defineProperty,Bst=(e,t)=>Fst(e,"name",{value:t,configurable:!0});function Pd(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)},[])}Bst(Pd,"useCallbackRef");var Ust=Object.defineProperty,pa=(e,t)=>Ust(e,"name",{value:t,configurable:!0}),EF="dismissableLayer.update",Qst="dismissableLayer.pointerDownOutside",zst="dismissableLayer.focusOutside",wZ,YAe=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),TQ=p.forwardRef(pa(function(t,n){const{disableOutsidePointerEvents:i=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:l,onInteractOutside:c,onDismiss:u,...d}=t,f=p.useContext(YAe),[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=ZAe(T=>{a==null||a(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 R=[...f.branches].some(_=>_.contains(T));return k&&!R},[f.branches,k])}),N=JAe(T=>{if(r&&C.current)return;const R=T.target;[...f.branches].some(D=>D.contains(R))||(l==null||l(T),c==null||c(T),T.defaultPrevented||u==null||u())},g),A=h?O===y.length-1:!1,j=Pd(T=>{T.key==="Escape"&&(s==null||s(T),!T.defaultPrevented&&u&&(T.preventDefault(),u()))});return p.useEffect(()=>{if(A)return g.addEventListener("keydown",j,{capture:!0}),()=>g.removeEventListener("keydown",j,{capture:!0})},[g,A,j]),p.useEffect(()=>{if(h)return i&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(wZ=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(h)),f.layers.add(h),CF(),()=>{i&&(f.layersWithOutsidePointerEventsDisabled.delete(h),f.layersWithOutsidePointerEventsDisabled.size===0&&(g.body.style.pointerEvents=wZ))}},[h,g,i,f]),p.useEffect(()=>()=>{h&&(f.layers.delete(h),f.layersWithOutsidePointerEventsDisabled.delete(h),CF())},[h,f]),p.useEffect(()=>{const T=pa(()=>b({}),"handleUpdate");return document.addEventListener(EF,T),()=>document.removeEventListener(EF,T)},[]),o.jsx(Mr.div,{...d,ref:v,style:{pointerEvents:S?k?"auto":"none":void 0,...t.style},onFocusCapture:An(t.onFocusCapture,N.onFocusCapture),onBlurCapture:An(t.onBlurCapture,N.onBlurCapture),onPointerDownCapture:An(t.onPointerDownCapture,E.onPointerDownCapture)})},"DismissableLayer"));function Vst(){const e=p.useContext(YAe),[t,n]=p.useState(null);return p.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}pa(Vst,"useDismissableLayerSurface");var Hst=pa(()=>!0,"IS_TRUE");function ZAe(e,t){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:i=!1,isDeferredPointerDownOutsideRef:r,dismissableSurfaces:s,shouldHandlePointerDownOutside:a=Hst}=t,l=Pd(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()}pa(h,"resetOutsideInteraction");function m(){return Array.from(d.current.values()).some(Boolean)}pa(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)}pa(g,"handleInteractionCapture");function b(w){u.current&&d.current.set(w.type,!1)}pa(b,"handleInteractionBubble");const v=pa(w=>{if(w.target&&!c.current){let O=function(){n.removeEventListener("click",f.current);const k=m();h(),k||AQ(Qst,l,S,{discrete:!0})};if(pa(O,"handleAndDispatchPointerDownOutsideEvent"),!a(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,a]),{onPointerDownCapture:pa(()=>c.current=!0,"onPointerDownCapture")}}pa(ZAe,"usePointerDownOutside");function JAe(e,t=globalThis==null?void 0:globalThis.document){const n=Pd(e),i=p.useRef(!1);return p.useEffect(()=>{const r=pa(s=>{s.target&&!i.current&&AQ(zst,n,{originalEvent:s},{discrete:!1})},"handleFocus");return t.addEventListener("focusin",r),()=>t.removeEventListener("focusin",r)},[t,n]),{onFocusCapture:pa(()=>i.current=!0,"onFocusCapture"),onBlurCapture:pa(()=>i.current=!1,"onBlurCapture")}}pa(JAe,"useFocusOutside");function CF(){const e=new CustomEvent(EF);document.dispatchEvent(e)}pa(CF,"dispatchUpdate");function AQ(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?SQ(r,s):r.dispatchEvent(s)}pa(AQ,"handleAndDispatchCustomEvent");var qst=Object.defineProperty,jl=(e,t)=>qst(e,"name",{value:t,configurable:!0}),uL="focusScope.autoFocusOnMount",dL="focusScope.autoFocusOnUnmount",OZ={bubbles:!1,cancelable:!0},e_e=p.forwardRef(jl(function(t,n){const{loop:i=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:a,...l}=t,[c,u]=p.useState(null),d=Pd(s),f=Pd(a),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:Sh(h.current,{select:!0})},y=function(O){if(g.paused||!c)return;const S=O.relatedTarget;S!==null&&(c.contains(S)||Sh(h.current,{select:!0}))},x=function(O){if(document.activeElement===document.body)for(const k of O)k.removedNodes.length>0&&Sh(c)};jl(v,"handleFocusIn"),jl(y,"handleFocusOut"),jl(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){kZ.add(g);const v=document.activeElement;if(!c.contains(v)){const x=new CustomEvent(uL,OZ);c.addEventListener(uL,d),c.dispatchEvent(x),x.defaultPrevented||(t_e(o_e(_Q(c)),{select:!0}),document.activeElement===v&&Sh(c))}return()=>{c.removeEventListener(uL,d),setTimeout(()=>{const x=new CustomEvent(dL,OZ);c.addEventListener(dL,f),c.dispatchEvent(x),x.defaultPrevented||Sh(v??document.body,{select:!0}),c.removeEventListener(dL,f),kZ.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]=n_e(w);O&&S?!v.shiftKey&&x===S?(v.preventDefault(),i&&Sh(O,{select:!0})):v.shiftKey&&x===O&&(v.preventDefault(),i&&Sh(S,{select:!0})):x===w&&v.preventDefault()}},[i,r,g.paused]);return o.jsx(Mr.div,{tabIndex:-1,...l,ref:m,onKeyDown:b})},"FocusScope"));function t_e(e,{select:t=!1}={}){const n=document.activeElement;for(const i of e)if(Sh(i,{select:t}),document.activeElement!==n)return}jl(t_e,"focusFirst");function n_e(e){const t=_Q(e),n=TF(t,e),i=TF(t.reverse(),e);return[n,i]}jl(n_e,"getTabbableEdges");function _Q(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:jl(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}jl(_Q,"getTabbableCandidates");function TF(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const i of e)if(!(n?!i.checkVisibility({checkVisibilityCSS:!0}):i_e(i,{upTo:t})))return i}jl(TF,"findVisible");function i_e(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}jl(i_e,"isHidden");function r_e(e){return e instanceof HTMLInputElement&&"select"in e}jl(r_e,"isSelectableInput");function Sh(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&r_e(e)&&t&&e.select()}}jl(Sh,"focus");var kZ=s_e();function s_e(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=AF(e,t),e.unshift(t)},remove(t){var n;e=AF(e,t),(n=e[0])==null||n.resume()}}}jl(s_e,"createFocusScopesStack");function AF(e,t){const n=[...e],i=n.indexOf(t);return i!==-1&&n.splice(i,1),n}jl(AF,"arrayRemove");function o_e(e){return e.filter(t=>t.tagName!=="A")}jl(o_e,"removeLinks");var Wst=Object.defineProperty,Kst=(e,t)=>Wst(e,"name",{value:t,configurable:!0}),jQ=p.forwardRef(Kst(function(t,n){var c;const{container:i,...r}=t,[s,a]=p.useState(!1);Hu(()=>a(!0),[]);const l=i||s&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return l?Jn.createPortal(o.jsx(Mr.div,{...r,ref:n}),l):null},"Portal")),Gst=Object.defineProperty,NQ=(e,t)=>Gst(e,"name",{value:t,configurable:!0}),$2=0,tf=null;function Xst(e){return vP(),e.children}NQ(Xst,"FocusGuards");function vP(){p.useEffect(()=>{tf||(tf={start:_F(),end:_F()});const{start:e,end:t}=tf;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),$2++,()=>{$2===1&&(tf==null||tf.start.remove(),tf==null||tf.end.remove(),tf=null),$2=Math.max(0,$2-1)}},[])}NQ(vP,"useFocusGuards");function _F(){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}NQ(_F,"createFocusGuard");var pf=function(){return pf=Object.assign||function(t){for(var n,i=1,r=arguments.length;i"u")return hot;var t=pot(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])}},got=u_e(),lx="data-scroll-locked",bot=function(e,t,n,i){var r=e.left,s=e.top,a=e.right,l=e.gap;return n===void 0&&(n="margin"),` + */const ka=wn("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),lZ=Object.freeze({totalTokenCount:0,promptTokenCount:0,candidatesTokenCount:0,thoughtsTokenCount:0,cachedContentTokenCount:0}),q_=Object.freeze({modelName:"",current:lZ,cumulative:lZ}),prt={totalTokenCount:"total_token_count",promptTokenCount:"prompt_token_count",candidatesTokenCount:"candidates_token_count",thoughtsTokenCount:"thoughts_token_count",cachedContentTokenCount:"cached_content_token_count"},mrt=24,grt=64,brt=16;function P2(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),a=((c=r.match(/[^\sA-Za-z0-9_]/g))==null?void 0:c.length)??0;return i+s+a}function yrt(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=P2(t),s=n.reduce((d,f)=>d+grt+P2(f),0),a=i.reduce((d,f)=>d+brt+P2(f.name)+P2(f.description??""),0);return mrt+r+s+a}function vrt({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),a=Math.min(i,r>0?Math.min(r,Math.max(0,n??0)):Math.max(0,n??0)),l=Math.max(0,r-a),c=r>0?Math.max(0,s-r):Math.max(0,s),u=r>0?s:a+c;return{systemTokens:a,inputTokens:l,outputTokens:c,remainingTokens:Math.max(0,i-u),usedTokens:u,contextWindow:i}}function xrt(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 a=i;return i+=s.tokens,{...s,start:a,end:i}});return Array.from({length:100},(s,a)=>{const l=a*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:a,slices:u}})}function aO(e,t){const n=e,i=n[t]??n[prt[t]];return typeof i=="number"&&Number.isFinite(i)&&i>0?Math.round(i):0}function wrt(e){const t=aO(e,"promptTokenCount"),n=aO(e,"candidatesTokenCount"),i=aO(e,"thoughtsTokenCount");return{totalTokenCount:aO(e,"totalTokenCount")||t+n+i,promptTokenCount:t,candidatesTokenCount:n,thoughtsTokenCount:i,cachedContentTokenCount:aO(e,"cachedContentTokenCount")}}function Ort(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 fAe(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 a=wrt(s);return a.totalTokenCount===0?r===e.modelName?e:{...e,modelName:r}:{modelName:r,current:a,cumulative:Ort(e.cumulative,a)}}function cZ(e){return e.reduce((t,n)=>fAe(t,n),q_)}function uZ(e){return e.blocks.flatMap(t=>t.kind==="tool"?[{name:t.name,args:t.args,response:t.response,done:t.done}]:[])}function krt(e){const t=e.attributes;return String(t["invocation.id"]??t["gen_ai.invocation.id"]??t["gcp.vertex.agent.invocation_id"]??"")}function Srt(e,t){if(!t)return e;const n=new Set(e.filter(r=>krt(r)===t).map(r=>r.trace_id)),i=e.filter(r=>n.has(r.trace_id));return i.length>0?i:e}function wy(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function Tm(e){return typeof e=="string"?e:""}function hAe(e,t){return e==="pending"||e==="running"||e==="completed"||e==="failed"?e:t}function Ert(e){let t=e;if(typeof t=="string")try{t=JSON.parse(t)}catch{return{}}const n=wy(t)??{};return wy(n.result)??n}function Crt(e){var n;const t=(n=wy(e))==null?void 0:n.branches;return Array.isArray(t)?t.map(i=>{var r;return Tm((r=wy(i))==null?void 0:r.label)}):[]}function pAe(e,t,n){const i=Crt(e),r=Ert(t),s=Array.isArray(r.branches)?r.branches:[],a=n==="running"?"running":"pending";return{branches:[0,1].map(c=>{const u=wy(s[c])??{};return{label:Tm(u.label)||i[c]||`方向 ${c+1}`,content:Tm(u.content),status:hAe(u.status,a),error:Tm(u.error)}})}}function Trt(e){const t=wy(e),n=wy(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:Tm(n.requestId),branchIndex:n.branchIndex,label:Tm(n.label),delta:Tm(n.delta),status:hAe(n.status,"running"),error:Tm(n.error)||void 0}}function Art(e,t,n){return{branches:pAe(e,t,"running").branches.map((s,a)=>a===n.branchIndex?{...s,label:n.label||s.label,content:s.content+n.delta,status:n.status,error:n.error??s.error}:s)}}function _a(e,t){return mn.t(`blocks.codexProgress.${e}`,{ns:"conversation",...t})}const mAe=28e4;function dZ(e){try{return JSON.stringify(e).length}catch{return mAe}}function _rt(e){const t=e.slice(-200);let n=t.reduce((i,r)=>i+dZ(r),0);for(;t.length>1&&n>mAe;)n-=dZ(t.shift());return t}function Kc(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function Bi(e){return typeof e=="string"?e:""}function vQ(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 gAe(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 bAe(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 wb(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 yAe(e){const t=Bi(e.id||e.itemId||e.item_id),n=Bi(e.kind);if(!t||!n)return null;const i=vQ(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 a=Array.isArray(e.plan)?e.plan:[];return{id:t,block:{kind:"plan",title:Bi(e.title)||_a("planTitle"),summary:r||void 0,items:a.flatMap(l=>{const c=Kc(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 a=_a(n==="file_change"||n==="fileChange"?"fallback.fileChange":n==="approval"?"fallback.approval":n==="status"?"fallback.status":"fallback.command"),l=bAe(e),c=gAe(e)??(n==="status"&&r||void 0);return{id:t,block:wb(Bi(e.name||e.title)||a,t,i,l,c)}}return null}function vAe(e){const t=Bi(e.type),n=Kc(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=vQ(n==null?void 0:n.status,t);if(i==="reasoning"||i==="agent_message"){const a=Bi(n==null?void 0:n.text);return a?{id:r,block:i==="reasoning"?{kind:"thinking",text:a,done:s!=="running"}:{kind:"text",text:a},...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=Kc(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:_a("planTitle"),summary:_a("planSummary",{completed:l.filter(c=>c.status==="completed").length,total:l.length}),items:l,done:s!=="running"}}:null}if(i==="command_execution"){const a=_a(`command.${s}`);return{id:r,block:wb(a,r,s,bAe(n??{}),gAe(n??{}))}}if(i==="file_change"){const a=Array.isArray(n==null?void 0:n.changes)?n.changes:[],l=a.length?_a("projectFiles",{count:a.length}):_a("projectFile"),c=_a(`fileChange.${s}`,{subject:l});return{id:r,block:wb(c,r,s,a.length?{changes:a}:void 0)}}if(i==="mcp_tool_call"){const a=[Bi(n==null?void 0:n.server),Bi(n==null?void 0:n.tool)].filter(Boolean).join("/")||_a("externalTool"),l=_a(`mcp.${s}`,{tool:a}),c=Kc(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:wb(l,r,s,n==null?void 0:n.arguments,u)}}if(i==="collab_tool_call"){const a=Bi(n==null?void 0:n.tool),l=["spawn_agent","send_input","wait","close_agent"].includes(a)?a:"default",c=_a(`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:wb(c,r,s,Object.keys(u).length?u:void 0,n==null?void 0:n.agents_states)}}if(i==="web_search"){const a=_a(`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:wb(a,r,s,Object.keys(l).length?l:void 0)}}if(i==="error"||t==="error"||t==="turn.failed"){const a=Kc(e.error),l=Bi((n==null?void 0:n.message)||e.message||(a==null?void 0:a.message))||_a("errorDetail");return{id:r,block:wb(_a("errorTitle"),r,"failed",void 0,l)}}return null}function jrt(e){const t=Kc(e),n=Kc(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=Kc(n.event??n.activity);if(!s)return null;const a=Kc(s.item)||Bi(s.type)?vAe(s):yAe(s);if(!a)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=vQ(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:a}}function Nrt(e,t){const n=Kc(t),i=Kc((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),a=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}:{},...a?{sandboxSessionId:a}:{},...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=Kc(d);if(!f)continue;const h=Kc(f.item)||Bi(f.type)?vAe(f):yAe(f);h&&(h.finalAnswer||(c=pF(c,{title:r,...s?{agentSessionId:s}:{},...a?{sandboxSessionId:a}:{},...l?{threadId:l}:{},event:h})))}return c}function pF(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:_rt(n)}}const xAe="send_a2ui_json_to_client",mF="validated_a2ui_json",gF="adk_request_credential",fZ="transfer_to_agent";function Rrt(e){var i,r,s,a;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)??((a=t==null?void 0:t.raw_auth_credential)==null?void 0:a.oauth2);return(n==null?void 0:n.authUri)??(n==null?void 0:n.auth_uri)}function bF(){return{blocks:[],liveStart:0,pendingCodexProgress:[]}}function hZ(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=pF(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=pF(i.codexActivity,t),i.status=t.terminalStatus??"running",t.terminalStatus&&(i.done=!0),"applied")}return"unmatched"}function Irt(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 pZ(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 yF=e=>e.functionCall??e.function_call,ZS=e=>e.functionResponse??e.function_response;function Prt(e){if(!e||typeof e!="object")return"";const t=e,n=t.agentName??t.agent_name;return typeof n=="string"?n:""}function Drt(e){return e.replace(/-/g,"+").replace(/_/g,"/")}function bP(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 a=r==null?void 0:r.veadkMedia;if(typeof(a==null?void 0:a.uri)=="string"){t.push({id:String(a.id??a.uri),mimeType:typeof a.mimeType=="string"?a.mimeType:void 0,uri:a.uri,name:typeof a.name=="string"?a.name:void 0,sizeBytes:typeof a.sizeBytes=="number"?a.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:Drt(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 JS(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 Mrt=new Set(["llm","sequential","parallel","loop","a2a"]);function Lrt(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 a;const l=r.targetAgent;if(l&&typeof l=="object"){const c=l,u=c.type;typeof c.name=="string"&&typeof u=="string"&&Mrt.has(u)&&Array.isArray(c.path)&&(a={name:c.name,description:typeof c.description=="string"?c.description:"",type:u,path:c.path.filter(d=>typeof d=="string")})}if(s.length>0||a)return{skills:s,targetAgent:a}}}function $rt(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 Frt(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 rL(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 D2(e){for(const t of e)t.kind==="thinking"&&(t.done=!0)}function wAe(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)??[],a=s.flatMap(v=>{const y=Trt(v.partMetadata??v.part_metadata);return y?[y]:[]}),l=s.flatMap(v=>{const y=jrt(v.partMetadata??v.part_metadata);return y?[y]:[]});if(a.length>0||l.length>0){for(const v of a)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=Art(x.args,x.response,v),x.status="running";break}}for(const v of l)hZ(n,v)==="unmatched"&&(r=[...r,v].slice(-64));return{blocks:n,liveStart:i,pendingCodexProgress:r}}const c=s.some(v=>yF(v)||ZS(v));if(t.partial&&!c){for(const v of s){const y=JS(v);typeof y=="string"&&y&&rL(n,v.thought?"thinking":"text",y)}return{blocks:n,liveStart:i,pendingCodexProgress:r}}n.length=i;for(const v of s){const y=yF(v),x=ZS(v),w=bP([v]),O=JS(v);if(typeof O=="string"&&O)rL(n,v.thought?"thinking":"text",O);else if(w.length)D2(n),$rt(n,w);else if(y)if(D2(n),y.name===fZ){const S=Prt(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===gF){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:Rrt(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?hZ(n,C):k.push(C);r=k}}else if(x){if(D2(n),x.name===fZ)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===gF)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?pZ(k.response):"";if(k.done=!0,k.response=x.response,C){k.codexActivity=Nrt(k.codexActivity,x.response),k.status=Irt(x.response);const N=pZ(x.response);N&&N!==E&&rL(n,"text",N)}break}}if(x.name===xAe){const S=((m=x.response)==null?void 0:m[mF])??[];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&&Frt(n,Object.entries(u).map(([v,y])=>({filename:v,version:y}))),D2(n),i=n.length,{blocks:n,liveStart:i,pendingCodexProgress:r}}function Brt(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=JS(b);return!b.thought&&typeof v=="string"&&v.trim().length>0||bP([b]).length>0}),r=n.some(b=>{var y;const v=ZS(b);return(v==null?void 0:v.name)===xAe&&Array.isArray((y=v.response)==null?void 0:y[mF])&&v.response[mF].length>0}),s=((d=e.actions)==null?void 0:d.artifactDelta)??((f=e.actions)==null?void 0:f.artifact_delta),a=!!(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||a||l&&c}function Urt(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=>!!(JS(s)||bP([s]).length>0||yF(s)||ZS(s)))}function vF(e="adk-stream",t){var a,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=((a=t.meta)==null?void 0:a.author)??"",d=((l=t.meta)==null?void 0:l.invocationId)??"",f=((c=t.meta)==null?void 0:c.localId)??`${e}-${n++}`,h=bF();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&&!Urt(u))return{turn:{role:"assistant",blocks:[]},completed:!1,ignored:!0};if(!m){const y=`${e}-${n++}`;m={acc:bF(),localId:y,meta:{author:d||void 0,invocationId:f||void 0}}}m.acc=wAe(m.acc,u);const g=u.usageMetadata??u.usage_metadata,b=Brt(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 Db(e,t){var s;const n=(s=t.meta)==null?void 0:s.localId;if(!n)return[...e,t];const i=e.findIndex(a=>{var l;return((l=a.meta)==null?void 0:l.localId)===n});if(i<0)return[...e,t];const r=e.slice();return r[i]=t,r}function Qrt(e,t={}){var r;let n=[],i=vF("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=ZS(h))==null?void 0:m.name)===gF})){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(JS).filter(h=>!!h).join(""),u=bP(l),d=Lrt(l);if(!c&&!u.length&&!d)continue;for(const h of i.finish())n=Db(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=Db(n,l.turn))}for(const s of i.finish())n=Db(n,s);for(const s of n){const a=s.meta,l=a==null?void 0:a.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"||(a.feedback=c)}return n}function yP(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(a=>a.text).find(Boolean);if(s)return s}return t}function OAe(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=OAe(i,t,e);if(r)return r}}function zrt(e,t){var a,l;if(e.role!=="assistant"||!t)return;const n=(a=e.meta)==null?void 0:a.author;if(!n)return;const i=OAe(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 Vrt(e,t){const n=[];return e.forEach((i,r)=>{const s=zrt(i,t),a=n[n.length-1];if(s&&(a==null?void 0:a.groupKey)===s.key){a.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 Hrt(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("circle",{cx:"9",cy:"8",r:"3.25"}),o.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 kAe(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},xQ=e=>{const t=qrt(e),n=p.Children.count(t);return p.Children.map(t,i=>{if(typeof i=="string"&&i.trim())return n<=1?i:o.jsx("span",{children:i});if(p.isValidElement(i)){const r=i,{children:s,...a}=r.props;return s!=null?p.cloneElement(r,a,xQ(s)):r}return i})},Wrt="_Badge_1viyg_1",Krt={Badge:Wrt},Lo=({children:e,className:t,variant:n="soft",color:i="secondary",size:r="sm",pill:s,...a})=>o.jsx("div",{className:Ti(Krt.Badge,t),"data-color":i,"data-size":r,"data-pill":s?"":void 0,"data-variant":n,...a,children:xQ(e)});var Grt=typeof xm=="object"&&xm&&xm.Object===Object&&xm,Xrt=typeof self=="object"&&self&&self.Object===Object&&self;Grt||Xrt||Function("return this")();var Yrt=typeof window<"u"?p.useLayoutEffect:p.useEffect;function Zrt(){const e=p.useRef(!1);return p.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]),p.useCallback(()=>e.current,[])}var mZ={width:void 0,height:void 0};function SAe(e){const{ref:t,box:n="content-box"}=e,[{width:i,height:r},s]=p.useState(mZ),a=Zrt(),l=p.useRef({...mZ}),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=gZ(d,f,"inlineSize"),m=gZ(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):a()&&s(b)}});return u.observe(t.current,{box:n}),()=>{u.disconnect()}},[n,t,a]),{width:i,height:r}}function gZ(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 wQ(e,t){const n=p.useRef(e);Yrt(()=>{n.current=e},[e]),p.useEffect(()=>{if(!t&&t!==0)return;const i=setTimeout(()=>{n.current()},t);return()=>{clearTimeout(i)}},[t])}const Jrt={DEV:!1,MODE:"production"},ax=typeof import.meta<"u"?Jrt:void 0,est=!!(ax!=null&&ax.DEV),tst=typeof navigator<"u"&&/(jsdom|happy-dom)/i.test(navigator.userAgent)||typeof globalThis.happyDOM=="object",EAe=(ax==null?void 0:ax.MODE)==="test"||tst,nst=typeof window<"u",CAe=typeof document<"u",ist=nst&&CAe,OQ=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())},PN=(e,t)=>{const n=()=>{const a=setTimeout(e);return()=>{clearTimeout(a)}};if(!ist||typeof window.requestAnimationFrame!="function"||CAe&&document.visibilityState==="hidden")return n();let r=2,s=window.requestAnimationFrame(function a(){r-=1,r===0?e():s=window.requestAnimationFrame(a)});return()=>{typeof window.cancelAnimationFrame=="function"&&window.cancelAnimationFrame(s)}},Ky=e=>Object.keys(e).reduce((n,i)=>{const r=e[i];if(r||r===0){const s=i.startsWith("--")?"":"--",a=typeof r=="number"?`${r}px`:r;n[`${s}${i}`]=a}return n},{}),sL=e=>typeof e=="number"?`${e}deg`:e,oL=e=>String(e),M2=e=>`${e}ms`,aL=({x:e,y:t,scale:n,rotate:i,skewX:r,skewY:s}={})=>{const a=[e==null?null:`translateX(${e}px)`,t==null?null:`translateY(${t}px)`,n==null?null:`scale(${n})`,i==null?null:`rotate(${sL(i)})`,r==null?null:`skewX(${sL(r)})`,s==null?null:`skewY(${sL(s)})`].filter(Boolean);return a.length?a.join(" "):"none"},lL=({blur:e}={})=>{const t=[e==null?null:`blur(${e}px)`].filter(Boolean);return t.length?t.join(" "):"none"},Gh=e=>{e.preventDefault()},TAe=e=>e.querySelectorAll('a[href], input:not([disabled]):not([type="hidden"]), textarea:not([disabled]), button:not([disabled]), [tabindex]:not([tabindex^="-"]), [contenteditable]'),rst="_LoadingIndicator_7yl6f_1",sst={LoadingIndicator:rst},jC=({className:e,size:t,strokeWidth:n,style:i,...r})=>o.jsx("div",{...r,className:Ti(sst.LoadingIndicator,e),style:i||Ky({"indicator-size":t,"indicator-stroke":n})});var ost=Object.defineProperty,kQ=(e,t)=>ost(e,"name",{value:t,configurable:!0});function xF(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}kQ(xF,"setRef");function AAe(...e){return t=>{let n=!1;const i=e.map(r=>{const s=xF(r,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let r=0;rast(e,"name",{value:t,configurable:!0});function up(e){const t=p.forwardRef((n,i)=>{let{children:r,...s}=n,a=null,l=!1;const c=[];wF(r)&&typeof L2=="function"&&(r=L2(r._payload)),p.Children.forEach(r,h=>{var m;if(PAe(h)){l=!0;const g=h;let b="child"in g.props?g.props.child:g.props.children;wF(b)&&typeof L2=="function"&&(b=L2(b._payload)),a=lst(g,b),c.push((m=a==null?void 0:a.props)==null?void 0:m.children)}else c.push(h)}),a?a=p.cloneElement(a,void 0,c):!l&&p.Children.count(r)===1&&p.isValidElement(r)&&(a=r);const u=a?IAe(a):void 0,d=pr(i,u);if(!a){if(r||r===0)throw new Error(l?dst(e):ust(e));return r}const f=RAe(s,a.props??{});return a.type!==p.Fragment&&(f.ref=i?d:u),p.cloneElement(a,f)});return t.displayName=`${e}.Slot`,t}Bd(up,"createSlot");var _Ae=up("Slot"),jAe=Symbol.for("radix.slottable");function NAe(e){const t=Bd(n=>"child"in n?n.children(n.child):n.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=jAe,t}Bd(NAe,"createSlottable");var lst=Bd((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 RAe(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}}Bd(RAe,"mergeProps");function IAe(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)}Bd(IAe,"getElementRef");function PAe(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===jAe}Bd(PAe,"isSlottable");var cst=Symbol.for("react.lazy");function wF(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===cst&&"_payload"in e&&DAe(e._payload)}Bd(wF,"isLazyComponent");function DAe(e){return typeof e=="object"&&e!==null&&"then"in e}Bd(DAe,"isPromiseLike");var ust=Bd(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),dst=Bd(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),L2=Fy[" use ".trim().toString()],fst=Object.defineProperty,hst=(e,t)=>fst(e,"name",{value:t,configurable:!0}),pst=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Mr=pst.reduce((e,t)=>{const n=up(`Primitive.${t}`),i=p.forwardRef((r,s)=>{const{asChild:a,...l}=r,c=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:s})});return i.displayName=`Primitive.${t}`,{...e,[t]:i}},{});function SQ(e,t){e&&Jn.flushSync(()=>e.dispatchEvent(t))}hst(SQ,"dispatchDiscreteCustomEvent");var mst=Object.defineProperty,gst=(e,t)=>mst(e,"name",{value:t,configurable:!0}),bst=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"}),yst=p.forwardRef(gst(function(t,n){return o.jsx(Mr.span,{...t,ref:n,style:{...bst,...t.style}})},"VisuallyHidden")),vst=yst,xst=Object.defineProperty,Nu=(e,t)=>xst(e,"name",{value:t,configurable:!0});function wst(e,t){const n=p.createContext(t);n.displayName=e+"Context";const i=Nu(s=>{const{children:a,...l}=s,c=p.useMemo(()=>l,Object.values(l));return o.jsx(n.Provider,{value:c,children:a})},"Provider");i.displayName=e+"Provider";function r(s,a={}){const{optional:l=!1}=a,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 Nu(r,"useContext"),[i,r]}Nu(wst,"createContext");function gc(e,t=[]){let n=[];function i(s,a){const l=p.createContext(a);l.displayName=s+"Context";const c=n.length;n=[...n,a];const u=Nu(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 o.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(a!==void 0)return a;if(!g)throw new Error(`\`${f}\` must be used within \`${s}\``)}return Nu(d,"useContext"),[u,d]}Nu(i,"createContext");const r=Nu(()=>{const s=n.map(a=>p.createContext(a));return Nu(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,MAe(r,...t)]}Nu(gc,"createContextScope");function MAe(...e){const t=e[0];if(e.length===1)return t;const n=Nu(()=>{const i=e.map(r=>({useScope:r(),scopeName:r.scopeName}));return Nu(function(s){const a=i.reduce((l,{useScope:c,scopeName:u})=>{const f=c(s)[`__scope${u}`];return{...l,...f}},{});return p.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])},"useComposedScopes")},"createScope");return n.scopeName=t.scopeName,n}Nu(MAe,"composeContextScopes");var Ost=Object.defineProperty,ga=(e,t)=>Ost(e,"name",{value:t,configurable:!0});function EQ(e){const t=e+"CollectionProvider",[n,i]=gc(t),[r,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=ga(b=>{const{scope:v,children:y}=b,x=p.useRef(null),w=p.useRef(new Map).current;return o.jsx(r,{scope:v,itemMap:w,collectionRef:x,children:y})},"CollectionProvider");a.displayName=t;const l=e+"CollectionSlot",c=up(l),u=p.forwardRef((b,v)=>{const{scope:y,children:x}=b,w=s(l,y),O=pr(v,w.collectionRef);return o.jsx(c,{ref:O,children:x})});u.displayName=l;const d=e+"CollectionItemSlot",f="data-radix-collection-item",h=up(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))),o.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 ga(g,"useCollection"),[{Provider:a,Slot:u,ItemSlot:m},g,i]}ga(EQ,"createCollection");var bZ=new WeakMap,jo,Uc,cL=(Uc=class extends Map{constructor(n){super(n);WW(this,jo);LM(this,jo,[...super.keys()]),bZ.set(this,!0)}set(n,i){return bZ.get(this)&&(this.has(n)?tl(this,jo)[tl(this,jo).indexOf(n)]=n:tl(this,jo).push(n)),super.set(n,i),this}insert(n,i,r){const s=this.has(i),a=tl(this,jo).length,l=CQ(n);let c=l>=0?l:a+l;const u=c<0||c>=a?-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=[...tl(this,jo)];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 a of this)Reflect.apply(n,i,[a,s,this])&&r.push(a),s++;return new Uc(r)}map(n,i){const r=[];let s=0;for(const a of this)r.push([a[0],Reflect.apply(n,i,[a,s,this])]),s++;return new Uc(r)}reduce(...n){const[i,r]=n;let s=0,a=r??this.at(0);for(const l of this)s===0&&n.length===1?a=l:a=Reflect.apply(i,this,[a,l,s,this]),s++;return a}reduceRight(...n){const[i,r]=n;let s=r??this.at(-1);for(let a=this.size-1;a>=0;a--){const l=this.at(a);a===this.size-1&&n.length===1?s=l:s=Reflect.apply(i,this,[s,l,a,this])}return s}toSorted(n){const i=[...this.entries()].sort(n);return new Uc(i)}toReversed(){const n=new Uc;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 Uc(i)}slice(n,i){const r=new Uc;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 a=n;a<=s;a++){const l=this.keyAt(a),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}},jo=new WeakMap,ga(Uc,"OrderedDict"),Uc);function W_(e,t){if("at"in Array.prototype)return Array.prototype.at.call(e,t);const n=LAe(e,t);return n===-1?void 0:e[n]}ga(W_,"at");function LAe(e,t){const n=e.length,i=CQ(t),r=i>=0?i:n+i;return r<0||r>=n?-1:r}ga(LAe,"toSafeIndex");function CQ(e){return e!==e||e===0?0:Math.trunc(e)}ga(CQ,"toSafeInteger");function kst(e){const t=e+"CollectionProvider",[n,i]=gc(t),[r,s]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new cL,setItemMap:ga(()=>{},"setItemMap")}),a=ga(({state:w,...O})=>w?o.jsx(c,{...O,state:w}):o.jsx(l,{...O}),"CollectionProvider");a.displayName=t;const l=ga(w=>{const O=v();return o.jsx(c,{...w,state:O})},"CollectionInit");l.displayName=t+"Init";const c=ga(w=>{const{scope:O,children:S,state:k}=w,C=p.useRef(null),[E,N]=p.useState(null),A=pr(C,N),[j,T]=k;return p.useEffect(()=>{if(!E)return;const R=BAe(()=>{});return R.observe(E,{childList:!0,subtree:!0}),()=>{R.disconnect()}},[E]),o.jsx(r,{scope:O,itemMap:j,setItemMap:T,collectionRef:A,collectionRefObject:C,collectionElement:E,children:S})},"CollectionProviderImpl");c.displayName=t+"Impl";const u=e+"CollectionSlot",d=up(u),f=p.forwardRef((w,O)=>{const{scope:S,children:k}=w,C=s(u,S),E=pr(O,C.collectionRef);return o.jsx(d,{ref:E,children:k})});f.displayName=u;const h=e+"CollectionItemSlot",m="data-radix-collection-item",g=up(h),b=p.forwardRef((w,O)=>{const{scope:S,children:k,...C}=w,E=p.useRef(null),[N,A]=p.useState(null),j=pr(O,E,A),T=s(h,S),{setItemMap:R}=T,_=p.useRef(C);$Ae(_.current,C)||(_.current=C);const D=_.current;return p.useEffect(()=>{const M=D;return R(P=>N?P.has(N)?P.set(N,{...M,element:N}).toSorted(OF):(P.set(N,{...M,element:N}),P.toSorted(OF)):P),()=>{R(P=>!N||!P.has(N)?P:(P.delete(N),new cL(P)))}},[N,D,R]),o.jsx(g,{[m]:"",ref:j,children:k})});b.displayName=h;function v(){return p.useState(new cL)}ga(v,"useInitCollection");function y(w){const{itemMap:O}=s(e+"CollectionConsumer",w);return O}return ga(y,"useCollection"),[{Provider:a,Slot:f,ItemSlot:b},{createCollectionScope:i,useCollection:y,useInitCollection:v}]}ga(kst,"createCollection");function $Ae(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}ga($Ae,"shallowEqual");function FAe(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}ga(FAe,"isElementPreceding");function OF(e,t){return!e[1].element||!t[1].element?0:FAe(e[1].element,t[1].element)?-1:1}ga(OF,"sortByDocumentPosition");function BAe(e){return new MutationObserver(n=>{for(const i of n)if(i.type==="childList"){e();return}})}ga(BAe,"getChildListObserver");var Sst=Object.defineProperty,Hw=(e,t)=>Sst(e,"name",{value:t,configurable:!0}),UAe=!!(typeof window<"u"&&window.document&&window.document.createElement);function An(e,t,{checkForDefaultPrevented:n=!0}={}){return Hw(function(r){if(e==null||e(r),n===!1||!r||!r.defaultPrevented)return t==null?void 0:t(r)},"handleEvent")}Hw(An,"composeEventHandlers");function Est(e){var t;if(!UAe)throw new Error("Cannot access window outside of the DOM");return((t=e==null?void 0:e.ownerDocument)==null?void 0:t.defaultView)??window}Hw(Est,"getOwnerWindow");function kF(e){if(!UAe)throw new Error("Cannot access document outside of the DOM");return(e==null?void 0:e.ownerDocument)??document}Hw(kF,"getOwnerDocument");function QAe(e,t=!1){const{activeElement:n}=kF(e);if(!(n!=null&&n.nodeName))return null;if(zAe(n)&&n.contentDocument)return QAe(n.contentDocument.body,t);if(t){const i=n.getAttribute("aria-activedescendant");if(i){const r=kF(n).getElementById(i);if(r)return r}}return n}Hw(QAe,"getActiveElement");function zAe(e){return e.tagName==="IFRAME"}Hw(zAe,"isFrame");var Hu=globalThis!=null&&globalThis.document?p.useLayoutEffect:()=>{},Cst=Object.defineProperty,Tst=(e,t)=>Cst(e,"name",{value:t,configurable:!0}),yZ=Fy[" useEffectEvent ".trim().toString()],vZ=Fy[" useInsertionEffect ".trim().toString()];function VAe(e){if(typeof yZ=="function")return yZ(e);const t=p.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof vZ=="function"?vZ(()=>{t.current=e}):Hu(()=>{t.current=e}),p.useMemo(()=>(...n)=>{var i;return(i=t.current)==null?void 0:i.call(t,...n)},[])}Tst(VAe,"useEffectEvent");var Ast=Object.defineProperty,NC=(e,t)=>Ast(e,"name",{value:t,configurable:!0}),_st=Fy[" useInsertionEffect ".trim().toString()]||Hu;function ed({prop:e,defaultProp:t,onChange:n=NC(()=>{},"onChange"),caller:i}){const[r,s,a]=HAe({defaultProp:t,onChange:n}),l=e!==void 0,c=l?e:r,u=p.useCallback(d=>{var f;if(l){const h=qAe(d)?d(e):d;h!==e&&((f=a.current)==null||f.call(a,h))}else s(d)},[l,e,s,a]);return[c,u]}NC(ed,"useControllableState");function HAe({defaultProp:e,onChange:t}){const[n,i]=p.useState(e),r=p.useRef(n),s=p.useRef(t);return _st(()=>{s.current=t},[t]),p.useEffect(()=>{var a;r.current!==n&&((a=s.current)==null||a.call(s,n),r.current=n)},[n,r]),[n,i,s]}NC(HAe,"useUncontrolledState");function qAe(e){return typeof e=="function"}NC(qAe,"isFunction");var xZ=Symbol("RADIX:SYNC_STATE");function jst(e,t,n,i){const{prop:r,defaultProp:s,onChange:a,caller:l}=t,c=r!==void 0,u=VAe(a),d=[{...n,state:s}];i&&d.push(i);const[f,h]=p.useReducer((v,y)=>{if(y.type===xZ)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:xZ,state:r})},[r,f.state,c]),[b,h]}NC(jst,"useControllableStateReducer");var Nst=Object.defineProperty,dp=(e,t)=>Nst(e,"name",{value:t,configurable:!0});function WAe(e,t){return p.useReducer((n,i)=>t[n][i]??n,e)}dp(WAe,"useStateMachine");var Hf=dp(e=>{const{present:t,children:n}=e,i=KAe(t),r=typeof n=="function"?n({present:i.isPresent}):p.Children.only(n),s=GAe(i.ref,XAe(r));return typeof n=="function"||i.isPresent?p.cloneElement(r,{ref:s}):null},"Presence");function KAe(e){const[t,n]=p.useState(),i=p.useRef(null),r=p.useRef(e),s=p.useRef("none"),a=p.useRef(void 0),l=e?"mounted":"unmounted",[c,u]=WAe(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return p.useEffect(()=>{c==="mounted"?(s.current=a.current??lv(i.current),a.current=void 0):s.current="none"},[c]),Hu(()=>{const d=i.current,f=r.current;if(f!==e){const m=s.current,g=lv(d);e?(a.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]),Hu(()=>{if(t){let d;const f=t.ownerDocument.defaultView??window,h=dp(g=>{const v=lv(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=dp(g=>{g.target===t&&(s.current=lv(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,a.current=lv(f)}else i.current=null;n(d)},[])}}dp(KAe,"usePresence");function SF(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}dp(SF,"setRef");function GAe(...e){const t=p.useRef(e);return t.current=e,p.useCallback(n=>{const i=t.current;let r=!1;const s=i.map(a=>{const l=SF(a,n);return!r&&typeof l=="function"&&(r=!0),l});if(r)return()=>{for(let a=0;aRst(e,"name",{value:t,configurable:!0}),Pst=Fy[" useId ".trim().toString()]||(()=>{}),Dst=0;function lg(e){const[t,n]=p.useState(Pst());return Hu(()=>{e||n(i=>i??String(Dst++))},[e]),e||(t?`radix-${t}`:"")}Ist(lg,"useId");var Mst=Object.defineProperty,Lst=(e,t)=>Mst(e,"name",{value:t,configurable:!0}),$st=p.createContext(void 0);function RC(e){const t=p.useContext($st);return e||t||"ltr"}Lst(RC,"useDirection");var Fst=Object.defineProperty,Bst=(e,t)=>Fst(e,"name",{value:t,configurable:!0});function Pd(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)},[])}Bst(Pd,"useCallbackRef");var Ust=Object.defineProperty,pa=(e,t)=>Ust(e,"name",{value:t,configurable:!0}),EF="dismissableLayer.update",Qst="dismissableLayer.pointerDownOutside",zst="dismissableLayer.focusOutside",wZ,YAe=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),TQ=p.forwardRef(pa(function(t,n){const{disableOutsidePointerEvents:i=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:l,onInteractOutside:c,onDismiss:u,...d}=t,f=p.useContext(YAe),[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=ZAe(T=>{a==null||a(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 R=[...f.branches].some(_=>_.contains(T));return k&&!R},[f.branches,k])}),N=JAe(T=>{if(r&&C.current)return;const R=T.target;[...f.branches].some(D=>D.contains(R))||(l==null||l(T),c==null||c(T),T.defaultPrevented||u==null||u())},g),A=h?O===y.length-1:!1,j=Pd(T=>{T.key==="Escape"&&(s==null||s(T),!T.defaultPrevented&&u&&(T.preventDefault(),u()))});return p.useEffect(()=>{if(A)return g.addEventListener("keydown",j,{capture:!0}),()=>g.removeEventListener("keydown",j,{capture:!0})},[g,A,j]),p.useEffect(()=>{if(h)return i&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(wZ=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(h)),f.layers.add(h),CF(),()=>{i&&(f.layersWithOutsidePointerEventsDisabled.delete(h),f.layersWithOutsidePointerEventsDisabled.size===0&&(g.body.style.pointerEvents=wZ))}},[h,g,i,f]),p.useEffect(()=>()=>{h&&(f.layers.delete(h),f.layersWithOutsidePointerEventsDisabled.delete(h),CF())},[h,f]),p.useEffect(()=>{const T=pa(()=>b({}),"handleUpdate");return document.addEventListener(EF,T),()=>document.removeEventListener(EF,T)},[]),o.jsx(Mr.div,{...d,ref:v,style:{pointerEvents:S?k?"auto":"none":void 0,...t.style},onFocusCapture:An(t.onFocusCapture,N.onFocusCapture),onBlurCapture:An(t.onBlurCapture,N.onBlurCapture),onPointerDownCapture:An(t.onPointerDownCapture,E.onPointerDownCapture)})},"DismissableLayer"));function Vst(){const e=p.useContext(YAe),[t,n]=p.useState(null);return p.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}pa(Vst,"useDismissableLayerSurface");var Hst=pa(()=>!0,"IS_TRUE");function ZAe(e,t){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:i=!1,isDeferredPointerDownOutsideRef:r,dismissableSurfaces:s,shouldHandlePointerDownOutside:a=Hst}=t,l=Pd(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()}pa(h,"resetOutsideInteraction");function m(){return Array.from(d.current.values()).some(Boolean)}pa(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)}pa(g,"handleInteractionCapture");function b(w){u.current&&d.current.set(w.type,!1)}pa(b,"handleInteractionBubble");const v=pa(w=>{if(w.target&&!c.current){let O=function(){n.removeEventListener("click",f.current);const k=m();h(),k||AQ(Qst,l,S,{discrete:!0})};if(pa(O,"handleAndDispatchPointerDownOutsideEvent"),!a(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,a]),{onPointerDownCapture:pa(()=>c.current=!0,"onPointerDownCapture")}}pa(ZAe,"usePointerDownOutside");function JAe(e,t=globalThis==null?void 0:globalThis.document){const n=Pd(e),i=p.useRef(!1);return p.useEffect(()=>{const r=pa(s=>{s.target&&!i.current&&AQ(zst,n,{originalEvent:s},{discrete:!1})},"handleFocus");return t.addEventListener("focusin",r),()=>t.removeEventListener("focusin",r)},[t,n]),{onFocusCapture:pa(()=>i.current=!0,"onFocusCapture"),onBlurCapture:pa(()=>i.current=!1,"onBlurCapture")}}pa(JAe,"useFocusOutside");function CF(){const e=new CustomEvent(EF);document.dispatchEvent(e)}pa(CF,"dispatchUpdate");function AQ(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?SQ(r,s):r.dispatchEvent(s)}pa(AQ,"handleAndDispatchCustomEvent");var qst=Object.defineProperty,jl=(e,t)=>qst(e,"name",{value:t,configurable:!0}),uL="focusScope.autoFocusOnMount",dL="focusScope.autoFocusOnUnmount",OZ={bubbles:!1,cancelable:!0},e_e=p.forwardRef(jl(function(t,n){const{loop:i=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:a,...l}=t,[c,u]=p.useState(null),d=Pd(s),f=Pd(a),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:Sh(h.current,{select:!0})},y=function(O){if(g.paused||!c)return;const S=O.relatedTarget;S!==null&&(c.contains(S)||Sh(h.current,{select:!0}))},x=function(O){if(document.activeElement===document.body)for(const k of O)k.removedNodes.length>0&&Sh(c)};jl(v,"handleFocusIn"),jl(y,"handleFocusOut"),jl(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){kZ.add(g);const v=document.activeElement;if(!c.contains(v)){const x=new CustomEvent(uL,OZ);c.addEventListener(uL,d),c.dispatchEvent(x),x.defaultPrevented||(t_e(o_e(_Q(c)),{select:!0}),document.activeElement===v&&Sh(c))}return()=>{c.removeEventListener(uL,d),setTimeout(()=>{const x=new CustomEvent(dL,OZ);c.addEventListener(dL,f),c.dispatchEvent(x),x.defaultPrevented||Sh(v??document.body,{select:!0}),c.removeEventListener(dL,f),kZ.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]=n_e(w);O&&S?!v.shiftKey&&x===S?(v.preventDefault(),i&&Sh(O,{select:!0})):v.shiftKey&&x===O&&(v.preventDefault(),i&&Sh(S,{select:!0})):x===w&&v.preventDefault()}},[i,r,g.paused]);return o.jsx(Mr.div,{tabIndex:-1,...l,ref:m,onKeyDown:b})},"FocusScope"));function t_e(e,{select:t=!1}={}){const n=document.activeElement;for(const i of e)if(Sh(i,{select:t}),document.activeElement!==n)return}jl(t_e,"focusFirst");function n_e(e){const t=_Q(e),n=TF(t,e),i=TF(t.reverse(),e);return[n,i]}jl(n_e,"getTabbableEdges");function _Q(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:jl(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}jl(_Q,"getTabbableCandidates");function TF(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const i of e)if(!(n?!i.checkVisibility({checkVisibilityCSS:!0}):i_e(i,{upTo:t})))return i}jl(TF,"findVisible");function i_e(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}jl(i_e,"isHidden");function r_e(e){return e instanceof HTMLInputElement&&"select"in e}jl(r_e,"isSelectableInput");function Sh(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&r_e(e)&&t&&e.select()}}jl(Sh,"focus");var kZ=s_e();function s_e(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=AF(e,t),e.unshift(t)},remove(t){var n;e=AF(e,t),(n=e[0])==null||n.resume()}}}jl(s_e,"createFocusScopesStack");function AF(e,t){const n=[...e],i=n.indexOf(t);return i!==-1&&n.splice(i,1),n}jl(AF,"arrayRemove");function o_e(e){return e.filter(t=>t.tagName!=="A")}jl(o_e,"removeLinks");var Wst=Object.defineProperty,Kst=(e,t)=>Wst(e,"name",{value:t,configurable:!0}),jQ=p.forwardRef(Kst(function(t,n){var c;const{container:i,...r}=t,[s,a]=p.useState(!1);Hu(()=>a(!0),[]);const l=i||s&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return l?Jn.createPortal(o.jsx(Mr.div,{...r,ref:n}),l):null},"Portal")),Gst=Object.defineProperty,NQ=(e,t)=>Gst(e,"name",{value:t,configurable:!0}),$2=0,tf=null;function Xst(e){return vP(),e.children}NQ(Xst,"FocusGuards");function vP(){p.useEffect(()=>{tf||(tf={start:_F(),end:_F()});const{start:e,end:t}=tf;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),$2++,()=>{$2===1&&(tf==null||tf.start.remove(),tf==null||tf.end.remove(),tf=null),$2=Math.max(0,$2-1)}},[])}NQ(vP,"useFocusGuards");function _F(){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}NQ(_F,"createFocusGuard");var pf=function(){return pf=Object.assign||function(t){for(var n,i=1,r=arguments.length;i"u")return hot;var t=pot(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])}},got=u_e(),lx="data-scroll-locked",bot=function(e,t,n,i){var r=e.left,s=e.top,a=e.right,l=e.gap;return n===void 0&&(n="margin"),` .`.concat(Zst,` { overflow: hidden `).concat(i,`; padding-right: `).concat(l,"px ").concat(i,`; @@ -510,19 +510,19 @@ data: ${JSON.stringify({...n,...r?{id:r}:{},...a?{snapshot:!0}:{}})}`)}(t.type== `)},EZ=function(){var e=parseInt(document.body.getAttribute(lx)||"0",10);return isFinite(e)?e:0},yot=function(){p.useEffect(function(){return document.body.setAttribute(lx,(EZ()+1).toString()),function(){var e=EZ()-1;e<=0?document.body.removeAttribute(lx):document.body.setAttribute(lx,e.toString())}},[])},vot=function(e){var t=e.noRelative,n=e.noImportant,i=e.gapMode,r=i===void 0?"margin":i;yot();var s=p.useMemo(function(){return mot(r)},[r]);return p.createElement(got,{styles:bot(s,!t,r,n?"":"!important")})},jF=!1;if(typeof window<"u")try{var F2=Object.defineProperty({},"passive",{get:function(){return jF=!0,!0}});window.addEventListener("test",F2,F2),window.removeEventListener("test",F2,F2)}catch{jF=!1}var $0=jF?{passive:!1}:!1,xot=function(e){return e.tagName==="TEXTAREA"},d_e=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!xot(e)&&n[t]==="visible")},wot=function(e){return d_e(e,"overflowY")},Oot=function(e){return d_e(e,"overflowX")},CZ=function(e,t){var n=t.ownerDocument,i=t;do{typeof ShadowRoot<"u"&&i instanceof ShadowRoot&&(i=i.host);var r=f_e(e,i);if(r){var s=h_e(e,i),a=s[1],l=s[2];if(a>l)return!0}i=i.parentNode}while(i&&i!==n.body);return!1},kot=function(e){var t=e.scrollTop,n=e.scrollHeight,i=e.clientHeight;return[t,n,i]},Sot=function(e){var t=e.scrollLeft,n=e.scrollWidth,i=e.clientWidth;return[t,n,i]},f_e=function(e,t){return e==="v"?wot(t):Oot(t)},h_e=function(e,t){return e==="v"?kot(t):Sot(t)},Eot=function(e,t){return e==="h"&&t==="rtl"?-1:1},Cot=function(e,t,n,i,r){var s=Eot(e,window.getComputedStyle(t).direction),a=s*i,l=n.target,c=t.contains(l),u=!1,d=a>0,f=0,h=0;do{if(!l)break;var m=h_e(e,l),g=m[0],b=m[1],v=m[2],y=b-v-s*g;(g||y)&&f_e(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},B2=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},TZ=function(e){return[e.deltaX,e.deltaY]},AZ=function(e){return e&&"current"in e?e.current:e},Tot=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Aot=function(e){return` .block-interactivity-`.concat(e,` {pointer-events: none;} .allow-interactivity-`).concat(e,` {pointer-events: all;} -`)},_ot=0,F0=[];function jot(e){var t=p.useRef([]),n=p.useRef([0,0]),i=p.useRef(),r=p.useState(_ot++)[0],s=p.useState(u_e)[0],a=p.useRef(e);p.useEffect(function(){a.current=e},[e]),p.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(r));var b=Yst([e.lockRef.current],(e.shards||[]).map(AZ),!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!a.current.allowPinchZoom;var y=B2(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(),N=E&&E.anchorNode,A=N?N===k||N.contains(k):!1;if(A)return!1;var j=CZ(C,k);if(!j)return!0;if(j?S=C:(S=C==="v"?"h":"v",j=CZ(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 Cot(T,v,b,T==="h"?w:O)},[]),c=p.useCallback(function(b){var v=b;if(!(!F0.length||F0[F0.length-1]!==s)){var y="deltaY"in v?TZ(v):B2(v),x=t.current.filter(function(S){return S.name===v.type&&(S.target===v.target||v.target===S.shadowParent)&&Tot(S.delta,y)})[0];if(x&&x.should){v.cancelable&&v.preventDefault();return}if(!x){var w=(a.current.shards||[]).map(AZ).filter(Boolean).filter(function(S){return S.contains(v.target)}),O=w.length>0?l(v,w[0]):!a.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:Not(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=B2(b),i.current=void 0},[]),f=p.useCallback(function(b){u(b.type,TZ(b),b.target,l(b,e.lockRef.current))},[]),h=p.useCallback(function(b){u(b.type,B2(b),b.target,l(b,e.lockRef.current))},[]);p.useEffect(function(){return F0.push(s),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",c,$0),document.addEventListener("touchmove",c,$0),document.addEventListener("touchstart",d,$0),function(){F0=F0.filter(function(b){return b!==s}),document.removeEventListener("wheel",c,$0),document.removeEventListener("touchmove",c,$0),document.removeEventListener("touchstart",d,$0)}},[]);var m=e.removeScrollBar,g=e.inert;return p.createElement(p.Fragment,null,g?p.createElement(s,{styles:Aot(r)}):null,m?p.createElement(vot,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Not(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Rot=oot(c_e,jot);var RQ=p.forwardRef(function(e,t){return p.createElement(xP,pf({},e,{ref:t,sideCar:Rot}))});RQ.classNames=xP.classNames;var Iot=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},B0=new WeakMap,U2=new WeakMap,Q2={},mL=0,p_e=function(e){return e&&(e.host||p_e(e.parentNode))},Pot=function(e,t){return t.map(function(n){if(e.contains(n))return n;var i=p_e(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})},Dot=function(e,t,n,i){var r=Pot(t,Array.isArray(e)?e:[e]);Q2[n]||(Q2[n]=new WeakMap);var s=Q2[n],a=[],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=(B0.get(h)||0)+1,v=(s.get(h)||0)+1;B0.set(h,b),s.set(h,v),a.push(h),b===1&&g&&U2.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(),mL++,function(){a.forEach(function(f){var h=B0.get(f)-1,m=s.get(f)-1;B0.set(f,h),s.set(f,m),h||(U2.has(f)||f.removeAttribute(i),U2.delete(f)),m||f.removeAttribute(n)}),mL--,mL||(B0=new WeakMap,B0=new WeakMap,U2=new WeakMap,Q2={})}},m_e=function(e,t,n){n===void 0&&(n="data-aria-hidden");var i=Array.from(Array.isArray(e)?e:[e]),r=Iot(e);return r?(i.push.apply(i,Array.from(r.querySelectorAll("[aria-live], script"))),Dot(i,r,n,"aria-hidden")):function(){return null}},Mot=Object.defineProperty,Lot=(e,t)=>Mot(e,"name",{value:t,configurable:!0});function IC(e){const[t,n]=p.useState(void 0);return Hu(()=>{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 a,l;if("borderBoxSize"in s){const c=s.borderBoxSize,u=Array.isArray(c)?c[0]:c;a=u.inlineSize,l=u.blockSize}else a=e.offsetWidth,l=e.offsetHeight;n({width:a,height:l})});return i.observe(e,{box:"border-box"}),()=>i.unobserve(e)}else n(void 0)},[e]),t}Lot(IC,"useSize");var $ot=Object.defineProperty,fp=(e,t)=>$ot(e,"name",{value:t,configurable:!0}),IQ="Checkbox",[Fot,tcn]=gc(IQ),[Bot,PQ]=Fot(IQ);function g_e(e){const{__scopeCheckbox:t,checked:n,children:i,defaultChecked:r,disabled:s,form:a,name:l,onCheckedChange:c,required:u,value:d="on",internal_do_not_use_render:f}=e,[h,m]=ed({prop:n,defaultProp:r??!1,onChange:c,caller:IQ}),[g,b]=p.useState(null),[v,y]=p.useState(null),x=p.useRef(!1),[w,O]=p.useReducer(C=>C+1,0),S=g?!!a||!!g.closest("form"):!0,k={checked:h,disabled:s,setChecked:m,control:g,setControl:b,name:l,form:a,value:d,hasConsumerStoppedPropagationRef:x,userInteractionCount:w,onUserInteraction:O,required:u,defaultChecked:Xh(r)?!1:r,isFormControl:S,bubbleInput:v,setBubbleInput:y};return o.jsx(Bot,{scope:t,...k,children:b_e(f)?f(k):i})}fp(g_e,"CheckboxProvider");var Uot="CheckboxTrigger",Qot=p.forwardRef(fp(function({__scopeCheckbox:t,onKeyDown:n,onClick:i,...r},s){const{control:a,value:l,disabled:c,checked:u,required:d,setControl:f,setChecked:h,hasConsumerStoppedPropagationRef:m,onUserInteraction:g,isFormControl:b,bubbleInput:v}=PQ(Uot,t),y=pr(s,f),x=p.useRef(u);return p.useEffect(()=>{const w=a==null?void 0:a.form;if(w){const O=fp(()=>h(x.current),"reset");return w.addEventListener("reset",O),()=>w.removeEventListener("reset",O)}},[a,h]),o.jsx(Mr.button,{type:"button",role:"checkbox","aria-checked":Xh(u)?"mixed":u,"aria-required":d,"data-state":DQ(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=>Xh(O)?!0:!O),v&&b&&(m.current=w.isPropagationStopped(),m.current||w.stopPropagation())})})},"CheckboxTrigger")),zot=p.forwardRef(fp(function(t,n){const{__scopeCheckbox:i,name:r,checked:s,defaultChecked:a,required:l,disabled:c,value:u,onCheckedChange:d,form:f,...h}=t;return o.jsx(g_e,{__scopeCheckbox:i,checked:s,defaultChecked:a,disabled:c,required:l,onCheckedChange:d,name:r,form:f,value:u,internal_do_not_use_render:({isFormControl:m})=>o.jsxs(o.Fragment,{children:[o.jsx(Qot,{...h,ref:n,__scopeCheckbox:i}),m&&o.jsx(Wot,{__scopeCheckbox:i})]})})},"Checkbox")),Vot="CheckboxIndicator",Hot=p.forwardRef(fp(function(t,n){const{__scopeCheckbox:i,forceMount:r,...s}=t,a=PQ(Vot,i);return o.jsx(Hf,{present:r||Xh(a.checked)||a.checked===!0,children:o.jsx(Mr.span,{"data-state":DQ(a.checked),"data-disabled":a.disabled?"":void 0,...s,ref:n,style:{pointerEvents:"none",...t.style}})})},"CheckboxIndicator")),qot="CheckboxBubbleInput",Wot=p.forwardRef(fp(function({__scopeCheckbox:t,onClick:n,...i},r){const{control:s,hasConsumerStoppedPropagationRef:a,userInteractionCount:l,checked:c,defaultChecked:u,required:d,disabled:f,name:h,value:m,form:g,bubbleInput:b,setBubbleInput:v}=PQ(qot,t),y=pr(r,v),x=IC(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,A=Object.getOwnPropertyDescriptor(E,"checked").set,j=l!==S.current;S.current=l;const T=O.current!==c;O.current=c;const R=!(j&&a.current);if(T&&A){w.current=!j;const _=new Event("click",{bubbles:R});C.indeterminate=Xh(c),A.call(C,Xh(c)?!1:c),C.dispatchEvent(_),w.current=!1}},[b,c,a,l]);const k=p.useRef(Xh(c)?!1:c);return o.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 b_e(e){return typeof e=="function"}fp(b_e,"isFunction");function Xh(e){return e==="indeterminate"}fp(Xh,"isIndeterminate");function DQ(e){return Xh(e)?"indeterminate":e?"checked":"unchecked"}fp(DQ,"getState");var Kot=Object.defineProperty,Vm=(e,t)=>Kot(e,"name",{value:t,configurable:!0}),y_e="Popper",[v_e,qw]=gc(y_e),[Got,x_e]=v_e(y_e),Xot=Vm(e=>{const{__scopePopper:t,children:n}=e,[i,r]=p.useState(null),[s,a]=p.useState(void 0);return o.jsx(Got,{scope:t,anchor:i,onAnchorChange:r,placementState:s,setPlacementState:a,children:n})},"Popper"),Yot="PopperAnchor",Zot=p.forwardRef(Vm(function(t,n){const{__scopePopper:i,virtualRef:r,...s}=t,a=x_e(Yot,i),l=p.useRef(null),c=a.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=a.placementState&&wP(a.placementState),m=h==null?void 0:h[0],g=h==null?void 0:h[1];return r?null:o.jsx(Mr.div,{"data-radix-popper-side":m,"data-radix-popper-align":g,...s,ref:d})},"PopperAnchor")),w_e="PopperContent",[Jot,ncn]=v_e(w_e),eat=p.forwardRef(Vm(function(t,n){var Z,ue,Ee,Y,G,te,de;const{__scopePopper:i,side:r="bottom",sideOffset:s=0,align:a="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=x_e(w_e,i),[x,w]=p.useState(null),O=pr(n,w),[S,k]=p.useState(null),C=IC(S),E=(C==null?void 0:C.width)??0,N=(C==null?void 0:C.height)??0,A=r+(a!=="center"?"-"+a:""),j=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},T=Array.isArray(d)?d:[d],R=T.length>0,_={padding:j,boundary:T.filter(O_e),altBoundary:R},{refs:D,floatingStyles:M,placement:P,isPositioned:L,middlewareData:F}=x2e({strategy:"fixed",placement:A,whileElementsMounted:Vm((...Ce)=>fF(...Ce,{animationFrame:g==="always"}),"whileElementsMounted"),elements:{reference:y.anchor},middleware:[w2e({mainAxis:s+N,alignmentAxis:l}),u&&O2e({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?k2e():void 0,..._}),u&&S2e({..._}),E2e({..._,apply:Vm(({elements:Ce,rects:le,availableWidth:fe,availableHeight:re})=>{const{width:Oe,height:Pe}=le.reference,be=Ce.floating.style;be.setProperty("--radix-popper-available-width",`${fe}px`),be.setProperty("--radix-popper-available-height",`${re}px`),be.setProperty("--radix-popper-anchor-width",`${Oe}px`),be.setProperty("--radix-popper-anchor-height",`${Pe}px`)},"apply")}),S&&ynt({element:S,padding:c}),tat({arrowWidth:E,arrowHeight:N}),m&&bnt({strategy:"referenceHidden",..._,boundary:R?_.boundary:void 0})]}),I=y.setPlacementState;Hu(()=>(I(P),()=>{I(void 0)}),[P,I]);const[z,K]=wP(P),B=Pd(b);Hu(()=>{L&&(B==null||B())},[L,B]);const W=(Z=F.arrow)==null?void 0:Z.x,H=(ue=F.arrow)==null?void 0:ue.y,X=((Ee=F.arrow)==null?void 0:Ee.centerOffset)!==0,[ie,Q]=p.useState();return Hu(()=>{x&&Q(window.getComputedStyle(x).zIndex)},[x]),o.jsx("div",{ref:D.setFloating,"data-radix-popper-content-wrapper":"",style:{...M,transform:L?M.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ie,"--radix-popper-transform-origin":[(Y=F.transformOrigin)==null?void 0:Y.x,(G=F.transformOrigin)==null?void 0:G.y].join(" "),...((te=F.hide)==null?void 0:te.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:o.jsx(Jot,{scope:i,placedSide:z,placedAlign:K,onArrowChange:k,arrowX:W,arrowY:H,shouldHideArrow:X,children:o.jsx(Mr.div,{"data-side":z,"data-align":K,...v,ref:O,style:{...v.style,animation:L?(de=v.style)==null?void 0:de.animation:"none"}})})})},"PopperContent"));function O_e(e){return e!==null}Vm(O_e,"isNotNull");var tat=Vm(e=>({name:"transformOrigin",options:e,fn(t){var v,y,x;const{placement:n,rects:i,middlewareData:r}=t,a=((v=r.arrow)==null?void 0:v.centerOffset)!==0,l=a?0:e.arrowWidth,c=a?0:e.arrowHeight,[u,d]=wP(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=a?f:`${h}px`,b=`${-c}px`):u==="top"?(g=a?f:`${h}px`,b=`${i.floating.height+c}px`):u==="right"?(g=`${-c}px`,b=a?f:`${m}px`):u==="left"&&(g=`${i.floating.width+c}px`,b=a?f:`${m}px`),{data:{x:g,y:b}}}}),"transformOrigin");function wP(e){const[t,n="center"]=e.split("-");return[t,n]}Vm(wP,"getSideAndAlignFromPlacement");var OP=Xot,MQ=Zot,LQ=eat,nat=Object.defineProperty,$Q=(e,t)=>nat(e,"name",{value:t,configurable:!0}),gL=!1;function k_e(){const[e,t]=p.useState(gL);return p.useEffect(()=>{gL||(gL=!0,t(!0))},[]),e}$Q(k_e,"useIsHydrated");var S_e=Fy[" useSyncExternalStore ".trim().toString()];function E_e(){return()=>{}}$Q(E_e,"subscribe");function C_e(){return S_e(E_e,()=>!0,()=>!1)}$Q(C_e,"useIsHydratedModern");var iat=typeof S_e=="function"?C_e:k_e,rat=Object.defineProperty,Gy=(e,t)=>rat(e,"name",{value:t,configurable:!0}),bL="rovingFocusGroup.onEntryFocus",sat={bubbles:!1,cancelable:!0},kP="RovingFocusGroup",[NF,T_e,oat]=EQ(kP),[aat,Ww]=gc(kP,[oat]),[lat,cat]=aat(kP),uat=p.forwardRef(Gy(function(t,n){return o.jsx(NF.Provider,{scope:t.__scopeRovingFocusGroup,children:o.jsx(NF.Slot,{scope:t.__scopeRovingFocusGroup,children:o.jsx(dat,{...t,ref:n})})})},"RovingFocusGroup")),dat=p.forwardRef(Gy(function(t,n){const{__scopeRovingFocusGroup:i,orientation:r,loop:s=!1,dir:a,currentTabStopId:l,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:u,onEntryFocus:d,preventScrollOnEntryFocus:f=!1,...h}=t,m=p.useRef(null),g=pr(n,m),b=RC(a),[v,y]=ed({prop:l,defaultProp:c??null,onChange:u,caller:kP}),[x,w]=p.useState(!1),O=Pd(d),S=T_e(i),k=p.useRef(!1),[C,E]=p.useState(0);return p.useEffect(()=>{const N=m.current;if(N)return N.addEventListener(bL,O),()=>N.removeEventListener(bL,O)},[O]),o.jsx(lat,{scope:i,orientation:r,dir:b,loop:s,currentTabStopId:v,onItemFocus:p.useCallback(N=>y(N),[y]),onItemShiftTab:p.useCallback(()=>w(!0),[]),onFocusableItemAdd:p.useCallback(()=>E(N=>N+1),[]),onFocusableItemRemove:p.useCallback(()=>E(N=>N-1),[]),children:o.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,N=>{const A=!k.current;if(N.target===N.currentTarget&&A&&!x){const j=new CustomEvent(bL,sat);if(N.currentTarget.dispatchEvent(j),!j.defaultPrevented){const T=S().filter(P=>P.focusable),R=T.find(P=>P.active),_=T.find(P=>P.id===v),M=[R,_,...T].filter(Boolean).map(P=>P.ref.current);FQ(M,f)}}k.current=!1}),onBlur:An(t.onBlur,()=>w(!1))})})},"RovingFocusGroupImpl")),fat="RovingFocusGroupItem",hat=p.forwardRef(Gy(function(t,n){const{__scopeRovingFocusGroup:i,focusable:r=!0,active:s=!1,tabStopId:a,children:l,...c}=t,u=lg(),d=a||u,f=cat(fat,i),h=f.currentTabStopId===d,m=T_e(i),{onFocusableItemAdd:g,onFocusableItemRemove:b,currentTabStopId:v}=f,y=iat();return Hu(()=>{if(!(!y||!r))return g(),()=>b()},[y,r,g,b]),p.useEffect(()=>{if(!(y||!r))return g(),()=>b()},[y,r,g,b]),o.jsx(NF.ItemSlot,{scope:i,id:d,focusable:r,active:s,children:o.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=__e(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?j_e(S,k+1):S.slice(k+1)}setTimeout(()=>FQ(S))}}),children:typeof l=="function"?l({isCurrentTabStop:h,hasTabStop:v!=null}):l})})},"RovingFocusGroupItem")),pat={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function A_e(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}Gy(A_e,"getDirectionAwareKey");function __e(e,t,n){const i=A_e(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(i))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(i)))return pat[i]}Gy(__e,"getFocusIntent");function FQ(e,t=!1){const n=document.activeElement;for(const i of e)if(i===n||(i.focus({preventScroll:t}),document.activeElement!==n))return}Gy(FQ,"focusFirst");function j_e(e,t){return e.map((n,i)=>e[(t+i)%e.length])}Gy(j_e,"wrapArray");var BQ=uat,UQ=hat,mat=Object.defineProperty,nr=(e,t)=>mat(e,"name",{value:t,configurable:!0}),RF=["Enter"," "],gat=["ArrowDown","PageUp","Home"],N_e=["ArrowUp","PageDown","End"],bat=[...gat,...N_e],yat={ltr:[...RF,"ArrowRight"],rtl:[...RF,"ArrowLeft"]},vat={ltr:["ArrowLeft"],rtl:["ArrowRight"]},SP="Menu",[eE,xat,wat]=EQ(SP),[Xy,R_e]=gc(SP,[wat,qw,Ww]),EP=qw(),I_e=Ww(),[P_e,Ng]=Xy(SP),[Oat,PC]=Xy(SP),kat=nr(e=>{const{__scopeMenu:t,open:n=!1,children:i,dir:r,onOpenChange:s,modal:a=!0}=e,l=EP(t),[c,u]=p.useState(null),d=p.useRef(!1),f=Pd(s),h=RC(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]),o.jsx(OP,{...l,children:o.jsx(P_e,{scope:t,open:n,onOpenChange:f,content:c,onContentChange:u,children:o.jsx(Oat,{scope:t,onClose:p.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:d,dir:h,modal:a,children:i})})})},"Menu"),D_e=p.forwardRef(nr(function(t,n){const{__scopeMenu:i,...r}=t,s=EP(i);return o.jsx(MQ,{...s,...r,ref:n})},"MenuAnchor")),M_e="MenuPortal",[Sat,L_e]=Xy(M_e,{forceMount:void 0}),Eat=nr(e=>{const{__scopeMenu:t,forceMount:n,children:i,container:r}=e,s=Ng(M_e,t);return o.jsx(Sat,{scope:t,forceMount:n,children:o.jsx(Hf,{present:n||s.open,children:o.jsx(jQ,{asChild:!0,container:r,children:i})})})},"MenuPortal"),Ad="MenuContent",[Cat,QQ]=Xy(Ad),Tat=p.forwardRef(nr(function(t,n){const i=L_e(Ad,t.__scopeMenu),{forceMount:r=i.forceMount,...s}=t,a=Ng(Ad,t.__scopeMenu),l=PC(Ad,t.__scopeMenu);return o.jsx(eE.Provider,{scope:t.__scopeMenu,children:o.jsx(Hf,{present:r||a.open,children:o.jsx(eE.Slot,{scope:t.__scopeMenu,children:l.modal?o.jsx(Aat,{...s,ref:n}):o.jsx(_at,{...s,ref:n})})})})},"MenuContent")),Aat=p.forwardRef(nr(function(t,n){const i=Ng(Ad,t.__scopeMenu),r=p.useRef(null),s=pr(n,r);return p.useEffect(()=>{const a=r.current;if(a)return m_e(a)},[]),o.jsx(zQ,{...t,ref:s,trapFocus:i.open,disableOutsidePointerEvents:i.open,disableOutsideScroll:!0,onFocusOutside:An(t.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>i.onOpenChange(!1)})},"MenuRootContentModal")),_at=p.forwardRef(nr(function(t,n){const i=Ng(Ad,t.__scopeMenu);return o.jsx(zQ,{...t,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>i.onOpenChange(!1)})},"MenuRootContentNonModal")),jat=up("MenuContent.ScrollLock"),zQ=p.forwardRef(nr(function(t,n){const{__scopeMenu:i,loop:r=!1,trapFocus:s,onOpenAutoFocus:a,onCloseAutoFocus:l,disableOutsidePointerEvents:c,onEntryFocus:u,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:m,onDismiss:g,disableOutsideScroll:b,...v}=t,y=Ng(Ad,i),x=PC(Ad,i),w=EP(i),O=I_e(i),S=xat(i),[k,C]=p.useState(null),E=p.useRef(null),N=pr(n,E,y.onContentChange),A=p.useRef(0),j=p.useRef(""),T=p.useRef(0),R=p.useRef(null),_=p.useRef("right"),D=p.useRef(0),M=b?RQ:p.Fragment,P=b?{as:jat,allowPinchZoom:!0}:void 0,L=nr(I=>{var Q,Z;const z=j.current+I,K=S().filter(ue=>!ue.disabled),B=document.activeElement,W=(Q=K.find(ue=>ue.ref.current===B))==null?void 0:Q.textValue,H=K.map(ue=>ue.textValue),X=H_e(H,z,W),ie=(Z=K.find(ue=>ue.textValue===X))==null?void 0:Z.ref.current;nr(function ue(Ee){j.current=Ee,window.clearTimeout(A.current),Ee!==""&&(A.current=window.setTimeout(()=>ue(""),1e3))},"updateSearch")(z),ie&&setTimeout(()=>ie.focus())},"handleTypeaheadSearch");p.useEffect(()=>()=>window.clearTimeout(A.current),[]),vP();const F=p.useCallback(I=>{var K,B;return _.current===((K=R.current)==null?void 0:K.side)&&W_e(I,(B=R.current)==null?void 0:B.area)},[]);return o.jsx(Cat,{scope:i,searchRef:j,onItemEnter:p.useCallback(I=>{F(I)&&I.preventDefault()},[F]),onItemLeave:p.useCallback(I=>{var z;F(I)||((z=E.current)==null||z.focus(),C(null))},[F]),onTriggerLeave:p.useCallback(I=>{F(I)&&I.preventDefault()},[F]),pointerGraceTimerRef:T,onPointerGraceIntentChange:p.useCallback(I=>{R.current=I},[]),children:o.jsx(M,{...P,children:o.jsx(e_e,{asChild:!0,trapped:s,onMountAutoFocus:An(a,I=>{var z;I.preventDefault(),(z=E.current)==null||z.focus({preventScroll:!0})}),onUnmountAutoFocus:l,children:o.jsx(TQ,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:m,onDismiss:g,children:o.jsx(BQ,{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:o.jsx(LQ,{role:"menu","aria-orientation":"vertical","data-state":HQ(y.open),"data-radix-menu-content":"",dir:x.dir,...w,...v,ref:N,style:{outline:"none",...v.style},onKeyDown:An(v.onKeyDown,I=>{const K=I.target.closest("[data-radix-menu-content]")===I.currentTarget,B=I.ctrlKey||I.altKey||I.metaKey,W=I.key.length===1;K&&(I.key==="Tab"&&I.preventDefault(),!B&&W&&L(I.key));const H=E.current;if(I.target!==H||!bat.includes(I.key))return;I.preventDefault();const ie=S().filter(Q=>!Q.disabled).map(Q=>Q.ref.current);N_e.includes(I.key)&&ie.reverse(),z_e(ie)}),onBlur:An(t.onBlur,I=>{I.currentTarget.contains(I.target)||(window.clearTimeout(A.current),j.current="")}),onPointerMove:An(t.onPointerMove,Jx(I=>{const z=I.target,K=D.current!==I.clientX;if(I.currentTarget.contains(z)&&K){const B=I.clientX>D.current?"right":"left";_.current=B,D.current=I.clientX}}))})})})})})})},"MenuContentImpl")),Nat=p.forwardRef(nr(function(t,n){const{__scopeMenu:i,...r}=t;return o.jsx(Mr.div,{role:"group",...r,ref:n})},"MenuGroup")),IF="MenuItem",_Z="menu.itemSelect",VQ=p.forwardRef(nr(function(t,n){const{disabled:i=!1,onSelect:r,...s}=t,a=p.useRef(null),l=PC(IF,t.__scopeMenu),c=QQ(IF,t.__scopeMenu),u=pr(n,a),d=p.useRef(!1),f=nr(()=>{const h=a.current;if(!i&&h){const m=new CustomEvent(_Z,{bubbles:!0,cancelable:!0});h.addEventListener(_Z,g=>r==null?void 0:r(g),{once:!0}),SQ(h,m),m.defaultPrevented?d.current=!1:l.onClose()}},"handleSelect");return o.jsx($_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===" "||RF.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})},"MenuItem")),$_e=p.forwardRef(nr(function(t,n){const{__scopeMenu:i,disabled:r=!1,textValue:s,...a}=t,l=QQ(IF,i),c=I_e(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())},[a.children]),o.jsx(eE.ItemSlot,{scope:i,disabled:r,textValue:s??m,children:o.jsx(UQ,{asChild:!0,...c,focusable:!r,children:o.jsx(Mr.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...a,ref:d,onPointerMove:An(t.onPointerMove,Jx(b=>{r?l.onItemLeave(b):(l.onItemEnter(b),b.defaultPrevented||b.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:An(t.onPointerLeave,Jx(b=>l.onItemLeave(b))),onFocus:An(t.onFocus,()=>h(!0)),onBlur:An(t.onBlur,()=>h(!1))})})})},"MenuItemImpl")),Rat=p.forwardRef(nr(function(t,n){const{checked:i=!1,onCheckedChange:r,...s}=t;return o.jsx(B_e,{scope:t.__scopeMenu,checked:i,children:o.jsx(VQ,{role:"menuitemcheckbox","aria-checked":tE(i)?"mixed":i,...s,ref:n,"data-state":CP(i),onSelect:An(s.onSelect,()=>r==null?void 0:r(tE(i)?!0:!i),{checkForDefaultPrevented:!1})})})},"MenuCheckboxItem")),Iat="MenuRadioGroup",[Pat,Dat]=Xy(Iat,{value:void 0,onValueChange:nr(()=>{},"onValueChange")}),Mat=p.forwardRef(nr(function(t,n){const{value:i,onValueChange:r,...s}=t,a=Pd(r);return o.jsx(Pat,{scope:t.__scopeMenu,value:i,onValueChange:a,children:o.jsx(Nat,{...s,ref:n})})},"MenuRadioGroup")),Lat="MenuRadioItem",$at=p.forwardRef(nr(function(t,n){const{value:i,...r}=t,s=Dat(Lat,t.__scopeMenu),a=i===s.value;return o.jsx(B_e,{scope:t.__scopeMenu,checked:a,children:o.jsx(VQ,{role:"menuitemradio","aria-checked":a,...r,ref:n,"data-state":CP(a),onSelect:An(r.onSelect,()=>{var l;return(l=s.onValueChange)==null?void 0:l.call(s,i)},{checkForDefaultPrevented:!1})})})},"MenuRadioItem")),F_e="MenuItemIndicator",[B_e,Fat]=Xy(F_e,{checked:!1}),Bat=p.forwardRef(nr(function(t,n){const{__scopeMenu:i,forceMount:r,...s}=t,a=Fat(F_e,i);return o.jsx(Hf,{present:r||tE(a.checked)||a.checked===!0,children:o.jsx(Mr.span,{...s,ref:n,"data-state":CP(a.checked)})})},"MenuItemIndicator")),Uat=p.forwardRef(nr(function(t,n){const{__scopeMenu:i,...r}=t;return o.jsx(Mr.div,{role:"separator","aria-orientation":"horizontal",...r,ref:n})},"MenuSeparator")),U_e="MenuSub",[Qat,Q_e]=Xy(U_e),zat=nr(e=>{const{__scopeMenu:t,children:n,open:i=!1,onOpenChange:r}=e,s=Ng(U_e,t),a=EP(t),[l,c]=p.useState(null),[u,d]=p.useState(null),f=Pd(r);return p.useEffect(()=>(s.open===!1&&f(!1),()=>f(!1)),[s.open,f]),o.jsx(OP,{...a,children:o.jsx(P_e,{scope:t,open:i,onOpenChange:f,content:u,onContentChange:d,children:o.jsx(Qat,{scope:t,contentId:lg(),triggerId:lg(),trigger:l,onTriggerChange:c,children:n})})})},"MenuSub"),z2="MenuSubTrigger",Vat=p.forwardRef(nr(function(t,n){const i=Ng(z2,t.__scopeMenu),r=PC(z2,t.__scopeMenu),s=Q_e(z2,t.__scopeMenu),a=QQ(z2,t.__scopeMenu),l=p.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:u}=a,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 o.jsx(D_e,{asChild:!0,...d,children:o.jsx($_e,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?s.contentId:void 0,"data-state":HQ(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,Jx(m=>{a.onItemEnter(m),!m.defaultPrevented&&!t.disabled&&!i.open&&!l.current&&(a.onPointerGraceIntentChange(null),l.current=window.setTimeout(()=>{i.onOpenChange(!0),f()},100))})),onPointerLeave:An(t.onPointerLeave,Jx(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"];a.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(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(m),m.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:An(t.onKeyDown,m=>{var b;t.disabled||m.target!==m.currentTarget||a.searchRef.current!==""&&m.key===" "||yat[r.dir].includes(m.key)&&(i.onOpenChange(!0),(b=i.content)==null||b.focus(),m.preventDefault())})})})},"MenuSubTrigger")),Hat="MenuSubContent",qat=p.forwardRef(nr(function(t,n){const i=L_e(Ad,t.__scopeMenu),{forceMount:r=i.forceMount,align:s="start",...a}=t,l=Ng(Ad,t.__scopeMenu),c=PC(Ad,t.__scopeMenu),u=Q_e(Hat,t.__scopeMenu),d=p.useRef(null),f=pr(n,d);return o.jsx(eE.Provider,{scope:t.__scopeMenu,children:o.jsx(Hf,{present:r||l.open,children:o.jsx(eE.Slot,{scope:t.__scopeMenu,children:o.jsx(zQ,{id:u.contentId,"aria-labelledby":u.triggerId,...a,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=vat[c.dir].includes(h.key);m&&g&&(l.onOpenChange(!1),(b=u.trigger)==null||b.focus(),h.preventDefault())})})})})})},"MenuSubContent"));function HQ(e){return e?"open":"closed"}nr(HQ,"getOpenState");function tE(e){return e==="indeterminate"}nr(tE,"isIndeterminate");function CP(e){return tE(e)?"indeterminate":e?"checked":"unchecked"}nr(CP,"getCheckedState");function z_e(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}nr(z_e,"focusFirst");function V_e(e,t){return e.map((n,i)=>e[(t+i)%e.length])}nr(V_e,"wrapArray");function H_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 a=V_e(e,Math.max(s,0));r.length===1&&(a=a.filter(u=>u!==n));const c=a.find(u=>u.toLowerCase().startsWith(r.toLowerCase()));return c!==n?c:void 0}nr(H_e,"getNextMatch");function q_e(e,t){const{x:n,y:i}=e;let r=!1;for(let s=0,a=t.length-1;si!=h>i&&n<(f-u)*(i-d)/(h-d)+u&&(r=!r)}return r}nr(q_e,"isPointInPolygon");function W_e(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return q_e(n,t)}nr(W_e,"isPointerInGraceArea");function Jx(e){return t=>t.pointerType==="mouse"?e(t):void 0}nr(Jx,"whenMouse");var Wat=kat,Kat=D_e,Gat=Eat,Xat=Tat,Yat=VQ,Zat=Rat,Jat=Mat,elt=$at,tlt=Bat,nlt=Uat,ilt=zat,rlt=Vat,slt=qat,olt=Object.defineProperty,pu=(e,t)=>olt(e,"name",{value:t,configurable:!0}),qQ="DropdownMenu",[alt,icn]=gc(qQ,[R_e]),mu=R_e(),[llt,K_e]=alt(qQ),clt=pu(e=>{const{__scopeDropdownMenu:t,children:n,dir:i,open:r,defaultOpen:s,onOpenChange:a,modal:l=!0}=e,c=mu(t),u=p.useRef(null),[d,f]=ed({prop:r,defaultProp:s??!1,onChange:a,caller:qQ});return o.jsx(llt,{scope:t,triggerId:lg(),triggerRef:u,contentId:lg(),open:d,onOpenChange:f,onOpenToggle:p.useCallback(()=>f(h=>!h),[f]),modal:l,children:o.jsx(Wat,{...c,open:d,onOpenChange:f,dir:i,modal:l,children:n})})},"DropdownMenu"),ult="DropdownMenuTrigger",dlt=p.forwardRef(pu(function(t,n){const{__scopeDropdownMenu:i,disabled:r=!1,...s}=t,a=K_e(ult,i),l=mu(i),c=pr(n,a.triggerRef);return o.jsx(Kat,{asChild:!0,...l,children:o.jsx(Mr.button,{type:"button",id:a.triggerId,"aria-haspopup":"menu","aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.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&&(a.onOpenToggle(),a.open||u.preventDefault())}),onKeyDown:An(t.onKeyDown,u=>{r||(["Enter"," "].includes(u.key)&&a.onOpenToggle(),u.key==="ArrowDown"&&a.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(u.key)&&u.preventDefault())})})})},"DropdownMenuTrigger")),flt=pu(e=>{const{__scopeDropdownMenu:t,...n}=e,i=mu(t);return o.jsx(Gat,{...i,...n})},"DropdownMenuPortal"),hlt="DropdownMenuContent",plt=p.forwardRef(pu(function(t,n){const{__scopeDropdownMenu:i,...r}=t,s=K_e(hlt,i),a=mu(i),l=p.useRef(!1);return o.jsx(Xat,{id:s.contentId,"aria-labelledby":s.triggerId,...a,...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")),mlt=p.forwardRef(pu(function(t,n){const{__scopeDropdownMenu:i,...r}=t,s=mu(i);return o.jsx(Yat,{...s,...r,ref:n})},"DropdownMenuItem")),glt=p.forwardRef(pu(function(t,n){const{__scopeDropdownMenu:i,...r}=t,s=mu(i);return o.jsx(Zat,{...s,...r,ref:n})},"DropdownMenuCheckboxItem")),blt=p.forwardRef(pu(function(t,n){const{__scopeDropdownMenu:i,...r}=t,s=mu(i);return o.jsx(Jat,{...s,...r,ref:n})},"DropdownMenuRadioGroup")),ylt=p.forwardRef(pu(function(t,n){const{__scopeDropdownMenu:i,...r}=t,s=mu(i);return o.jsx(elt,{...s,...r,ref:n})},"DropdownMenuRadioItem")),vlt=p.forwardRef(pu(function(t,n){const{__scopeDropdownMenu:i,...r}=t,s=mu(i);return o.jsx(tlt,{...s,...r,ref:n})},"DropdownMenuItemIndicator")),xlt=p.forwardRef(pu(function(t,n){const{__scopeDropdownMenu:i,...r}=t,s=mu(i);return o.jsx(nlt,{...s,...r,ref:n})},"DropdownMenuSeparator")),wlt=pu(e=>{const{__scopeDropdownMenu:t,children:n,open:i,onOpenChange:r,defaultOpen:s}=e,a=mu(t),[l,c]=ed({prop:i,defaultProp:s??!1,onChange:r,caller:"DropdownMenuSub"});return o.jsx(ilt,{...a,open:l,onOpenChange:c,children:n})},"DropdownMenuSub"),Olt=p.forwardRef(pu(function(t,n){const{__scopeDropdownMenu:i,...r}=t,s=mu(i);return o.jsx(rlt,{...s,...r,ref:n})},"DropdownMenuSubTrigger")),klt=p.forwardRef(pu(function(t,n){const{__scopeDropdownMenu:i,...r}=t,s=mu(i);return o.jsx(slt,{...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")),Slt=clt,Elt=dlt,G_e=flt,Clt=plt,X_e=mlt,Tlt=glt,Alt=blt,_lt=ylt,Y_e=vlt,jlt=xlt,Nlt=wlt,Rlt=Olt,Ilt=klt,Plt=Object.defineProperty,Rg=(e,t)=>Plt(e,"name",{value:t,configurable:!0}),WQ="Popover",[Z_e,rcn]=gc(WQ,[qw]),KQ=qw(),[Dlt,Kw]=Z_e(WQ),Mlt=Rg(e=>{const{__scopePopover:t,children:n,open:i,defaultOpen:r,onOpenChange:s,modal:a=!1}=e,l=KQ(t),c=p.useRef(null),[u,d]=p.useState(!1),[f,h]=ed({prop:i,defaultProp:r??!1,onChange:s,caller:WQ});return o.jsx(OP,{...l,children:o.jsx(Dlt,{scope:t,contentId:lg(),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:a,children:n})})},"Popover"),Llt="PopoverTrigger",$lt=p.forwardRef(Rg(function(t,n){const{__scopePopover:i,...r}=t,s=Kw(Llt,i),a=KQ(i),l=pr(n,s.triggerRef),c=o.jsx(Mr.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":GQ(s.open),...r,ref:l,onClick:An(t.onClick,s.onOpenToggle)});return s.hasCustomAnchor?c:o.jsx(MQ,{asChild:!0,...a,children:c})},"PopoverTrigger")),J_e="PopoverPortal",[Flt,Blt]=Z_e(J_e,{forceMount:void 0}),Ult=Rg(e=>{const{__scopePopover:t,forceMount:n,children:i,container:r}=e,s=Kw(J_e,t);return o.jsx(Flt,{scope:t,forceMount:n,children:o.jsx(Hf,{present:n||s.open,children:o.jsx(jQ,{asChild:!0,container:r,children:i})})})},"PopoverPortal"),nE="PopoverContent",Qlt=p.forwardRef(Rg(function(t,n){const i=Blt(nE,t.__scopePopover),{forceMount:r=i.forceMount,...s}=t,a=Kw(nE,t.__scopePopover);return o.jsx(Hf,{present:r||a.open,children:a.modal?o.jsx(Vlt,{...s,ref:n}):o.jsx(Hlt,{...s,ref:n})})},"PopoverContent")),zlt=up("PopoverContent.RemoveScroll"),Vlt=p.forwardRef(Rg(function(t,n){const i=Kw(nE,t.__scopePopover),r=p.useRef(null),s=pr(n,r),a=p.useRef(!1);return p.useEffect(()=>{const l=r.current;if(l)return m_e(l)},[]),o.jsx(RQ,{as:zlt,allowPinchZoom:!0,children:o.jsx(eje,{...t,ref:s,trapFocus:i.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:An(t.onCloseAutoFocus,l=>{var c;l.preventDefault(),a.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;a.current=d},{checkForDefaultPrevented:!1}),onFocusOutside:An(t.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1})})})},"PopoverContentModal")),Hlt=p.forwardRef(Rg(function(t,n){const i=Kw(nE,t.__scopePopover),r=p.useRef(!1),s=p.useRef(!1);return o.jsx(eje,{...t,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var l,c;(l=t.onCloseAutoFocus)==null||l.call(t,a),a.defaultPrevented||(r.current||(c=i.triggerRef.current)==null||c.focus(),a.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:a=>{var u,d;(u=t.onInteractOutside)==null||u.call(t,a),a.defaultPrevented||(r.current=!0,a.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const l=a.target;((d=i.triggerRef.current)==null?void 0:d.contains(l))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&s.current&&a.preventDefault()}})},"PopoverContentNonModal")),eje=p.forwardRef(Rg(function(t,n){const{__scopePopover:i,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:a,disableOutsidePointerEvents:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,...h}=t,m=Kw(nE,i),g=KQ(i);return vP(),o.jsx(e_e,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:a,children:o.jsx(TQ,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:f,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onDismiss:()=>m.onOpenChange(!1),deferPointerDownOutside:!0,children:o.jsx(LQ,{"data-state":GQ(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 GQ(e){return e?"open":"closed"}Rg(GQ,"getState");var tje=Mlt,nje=$lt,ije=Ult,rje=Qlt,qlt=Object.defineProperty,al=(e,t)=>qlt(e,"name",{value:t,configurable:!0}),sje="Radio",[Wlt,oje]=gc(sje),[Klt,TP]=Wlt(sje);function aje(e){const{__scopeRadio:t,checked:n=!1,children:i,disabled:r,form:s,name:a,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:a,form:s,value:u,control:f,setControl:h,hasConsumerStoppedPropagationRef:b,userInteractionCount:v,onUserInteraction:y,isFormControl:x,bubbleInput:m,setBubbleInput:g,onCheck:al(()=>l==null?void 0:l(),"onCheck")};return o.jsx(Klt,{scope:t,...w,children:lje(d)?d(w):i})}al(aje,"RadioProvider");var Glt="RadioTrigger",Xlt=p.forwardRef(al(function({__scopeRadio:t,onClick:n,...i},r){const{checked:s,disabled:a,value:l,setControl:c,onCheck:u,hasConsumerStoppedPropagationRef:d,onUserInteraction:f,isFormControl:h,bubbleInput:m}=TP(Glt,t),g=pr(r,c);return o.jsx(Mr.button,{type:"button",role:"radio","aria-checked":s,"data-state":XQ(s),"data-disabled":a?"":void 0,disabled:a,value:l,...i,ref:g,onClick:An(n,b=>{s||(f(),u()),m&&h&&(d.current=b.isPropagationStopped(),d.current||b.stopPropagation())})})},"RadioTrigger")),Ylt="RadioIndicator",Zlt=p.forwardRef(al(function(t,n){const{__scopeRadio:i,forceMount:r,...s}=t,a=TP(Ylt,i);return o.jsx(Hf,{present:r||a.checked,children:o.jsx(Mr.span,{"data-state":XQ(a.checked),"data-disabled":a.disabled?"":void 0,...s,ref:n})})},"RadioIndicator")),Jlt="RadioBubbleInput",ect=p.forwardRef(al(function({__scopeRadio:t,onClick:n,...i},r){const{control:s,checked:a,required:l,disabled:c,name:u,value:d,form:f,bubbleInput:h,setBubbleInput:m,hasConsumerStoppedPropagationRef:g,userInteractionCount:b}=TP(Jlt,t),v=pr(r,m),y=IC(s),x=p.useRef(!1),w=p.useRef(a),O=p.useRef(b);p.useEffect(()=>{const k=h;if(!k)return;const C=window.HTMLInputElement.prototype,N=Object.getOwnPropertyDescriptor(C,"checked").set,A=b!==O.current;O.current=b;const j=w.current!==a;w.current=a;const T=!(A&&g.current);if(j&&N){x.current=!A;const R=new Event("click",{bubbles:T});N.call(k,a),k.dispatchEvent(R),x.current=!1}},[h,a,g,b]);const S=p.useRef(a);return o.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 lje(e){return typeof e=="function"}al(lje,"isFunction");function XQ(e){return e?"checked":"unchecked"}al(XQ,"getState");var tct=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],YQ="RadioGroup",[nct,scn]=gc(YQ,[Ww,oje]),cje=Ww(),AP=oje(),[ict,rct]=nct(YQ),sct=p.forwardRef(al(function(t,n){const{__scopeRadioGroup:i,name:r,form:s,defaultValue:a,value:l,required:c=!1,disabled:u=!1,orientation:d,dir:f,loop:h=!0,onValueChange:m,...g}=t,b=cje(i),v=RC(f),[y,x]=ed({prop:l,defaultProp:a??null,onChange:m,caller:YQ}),[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=al(()=>x(k.current),"reset");return C.addEventListener("reset",E),()=>C.removeEventListener("reset",E)}},[w,s,x]),o.jsx(ict,{scope:i,name:r,form:s,required:c,disabled:u,value:y,onValueChange:x,children:o.jsx(BQ,{asChild:!0,...b,orientation:d,dir:v,loop:h,children:o.jsx(Mr.div,{role:"radiogroup","aria-required":c,"aria-orientation":d,"data-disabled":u?"":void 0,dir:v,...g,ref:S})})})},"RadioGroup")),oct="RadioGroupItemProvider",act="RadioGroupItemTrigger";function uje(e){const{__scopeRadioGroup:t,value:n,disabled:i,children:r,internal_do_not_use_render:s}=e,a=rct(oct,t),l=AP(t),c=a.disabled||i;return o.jsx(aje,{...l,checked:a.value===n,disabled:c,required:a.required,name:a.name,form:a.form,value:n,onCheck:()=>a.onValueChange(n),internal_do_not_use_render:s,children:r})}al(uje,"RadioGroupItemProvider");var lct=p.forwardRef(al(function(t,n){const{__scopeRadioGroup:i,...r}=t,s=cje(i),a=AP(i),{checked:l,disabled:c}=TP(act,a.__scopeRadio),u=p.useRef(null),d=pr(n,u),f=p.useRef(!1);return p.useEffect(()=>{const h=al(g=>{tct.includes(g.key)&&(f.current=!0)},"handleKeyDown"),m=al(()=>f.current=!1,"handleKeyUp");return document.addEventListener("keydown",h),document.addEventListener("keyup",m),()=>{document.removeEventListener("keydown",h),document.removeEventListener("keyup",m)}},[]),o.jsx(UQ,{asChild:!0,...s,focusable:!c,active:l,children:o.jsx(Xlt,{...a,...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")),cct=p.forwardRef(al(function(t,n){const{__scopeRadioGroup:i,value:r,disabled:s,...a}=t;return o.jsx(uje,{__scopeRadioGroup:i,value:r,disabled:s,internal_do_not_use_render:({isFormControl:l})=>o.jsxs(o.Fragment,{children:[o.jsx(lct,{...a,ref:n,__scopeRadioGroup:i}),l&&o.jsx(uct,{__scopeRadioGroup:i})]})})},"RadioGroupItem")),uct=p.forwardRef(al(function(t,n){const{__scopeRadioGroup:i,...r}=t,s=AP(i);return o.jsx(ect,{...s,...r,ref:n})},"RadioGroupItemBubbleInput")),dct=p.forwardRef(al(function(t,n){const{__scopeRadioGroup:i,...r}=t,s=AP(i);return o.jsx(Zlt,{...s,...r,ref:n})},"RadioGroupIndicator")),fct=Object.defineProperty,cg=(e,t)=>fct(e,"name",{value:t,configurable:!0}),ZQ="Switch",[hct,ocn]=gc(ZQ),[pct,JQ]=hct(ZQ);function dje(e){const{__scopeSwitch:t,checked:n,children:i,defaultChecked:r,disabled:s,form:a,name:l,onCheckedChange:c,required:u,value:d="on",internal_do_not_use_render:f}=e,[h,m]=ed({prop:n,defaultProp:r??!1,onChange:c,caller:ZQ}),[g,b]=p.useState(null),[v,y]=p.useState(null),x=p.useRef(!1),[w,O]=p.useReducer(C=>C+1,0),S=g?!!a||!!g.closest("form"):!0,k={checked:h,setChecked:m,disabled:s,control:g,setControl:b,name:l,form:a,value:d,hasConsumerStoppedPropagationRef:x,userInteractionCount:w,onUserInteraction:O,required:u,defaultChecked:r,isFormControl:S,bubbleInput:v,setBubbleInput:y};return o.jsx(pct,{scope:t,...k,children:fje(f)?f(k):i})}cg(dje,"SwitchProvider");var mct="SwitchTrigger",gct=p.forwardRef(cg(function({__scopeSwitch:t,onClick:n,...i},r){const{control:s,form:a,value:l,disabled:c,checked:u,required:d,setControl:f,setChecked:h,hasConsumerStoppedPropagationRef:m,onUserInteraction:g,isFormControl:b,bubbleInput:v}=JQ(mct,t),y=pr(r,f),x=p.useRef(u);return p.useEffect(()=>{const w=a?s==null?void 0:s.ownerDocument.getElementById(a):s==null?void 0:s.form;if(w instanceof HTMLFormElement){const O=cg(()=>h(x.current),"reset");return w.addEventListener("reset",O),()=>w.removeEventListener("reset",O)}},[s,a,h]),o.jsx(Mr.button,{type:"button",role:"switch","aria-checked":u,"aria-required":d,"data-state":ez(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")),bct=p.forwardRef(cg(function(t,n){const{__scopeSwitch:i,name:r,checked:s,defaultChecked:a,required:l,disabled:c,value:u,onCheckedChange:d,form:f,...h}=t;return o.jsx(dje,{__scopeSwitch:i,checked:s,defaultChecked:a,disabled:c,required:l,onCheckedChange:d,name:r,form:f,value:u,internal_do_not_use_render:({isFormControl:m})=>o.jsxs(o.Fragment,{children:[o.jsx(gct,{...h,ref:n,__scopeSwitch:i}),m&&o.jsx(wct,{__scopeSwitch:i})]})})},"Switch")),yct="SwitchThumb",vct=p.forwardRef(cg(function(t,n){const{__scopeSwitch:i,...r}=t,s=JQ(yct,i);return o.jsx(Mr.span,{"data-state":ez(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:n})},"SwitchThumb")),xct="SwitchBubbleInput",wct=p.forwardRef(cg(function({__scopeSwitch:t,onClick:n,...i},r){const{control:s,hasConsumerStoppedPropagationRef:a,userInteractionCount:l,checked:c,defaultChecked:u,required:d,disabled:f,name:h,value:m,form:g,bubbleInput:b,setBubbleInput:v}=JQ(xct,t),y=pr(r,v),x=IC(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,A=Object.getOwnPropertyDescriptor(E,"checked").set,j=l!==S.current;S.current=l;const T=O.current!==c;O.current=c;const R=!(j&&a.current);if(T&&A){w.current=!j;const _=new Event("click",{bubbles:R});A.call(C,c),C.dispatchEvent(_),w.current=!1}},[b,c,a,l]);const k=p.useRef(c);return o.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 fje(e){return typeof e=="function"}cg(fje,"isFunction");function ez(e){return e?"checked":"unchecked"}cg(ez,"getState");var Oct=Object.defineProperty,kct=(e,t)=>Oct(e,"name",{value:t,configurable:!0}),Sct="Toggle",Ect=p.forwardRef(kct(function(t,n){const{pressed:i,defaultPressed:r,onPressedChange:s,...a}=t,[l,c]=ed({prop:i,onChange:s,defaultProp:r??!1,caller:Sct});return o.jsx(Mr.button,{type:"button","aria-pressed":l,"data-state":l?"on":"off","data-disabled":t.disabled?"":void 0,...a,ref:n,onClick:An(t.onClick,()=>{t.disabled||c(!l)})})},"Toggle")),Cct=Object.defineProperty,ug=(e,t)=>Cct(e,"name",{value:t,configurable:!0}),Gw="ToggleGroup",[hje,acn]=gc(Gw,[Ww]),pje=Ww(),Tct=p.forwardRef(ug(function(t,n){const{type:i,...r}=t;if(i==="single"){const s=r;return o.jsx(Act,{role:"radiogroup",...s,ref:n})}if(i==="multiple"){const s=r;return o.jsx(_ct,{role:"toolbar",...s,ref:n})}throw new Error(`Missing prop \`type\` expected on \`${Gw}\``)},"ToggleGroup")),[mje,gje]=hje(Gw),Act=p.forwardRef(ug(function(t,n){const{value:i,defaultValue:r,onValueChange:s=ug(()=>{},"onValueChange"),...a}=t,[l,c]=ed({prop:i,defaultProp:r??"",onChange:s,caller:Gw});return o.jsx(mje,{scope:t.__scopeToggleGroup,type:"single",value:p.useMemo(()=>l?[l]:[],[l]),onItemActivate:c,onItemDeactivate:p.useCallback(()=>c(""),[c]),children:o.jsx(bje,{...a,ref:n})})},"ToggleGroupImplSingle")),_ct=p.forwardRef(ug(function(t,n){const{value:i,defaultValue:r,onValueChange:s=ug(()=>{},"onValueChange"),...a}=t,[l,c]=ed({prop:i,defaultProp:r??[],onChange:s,caller:Gw}),u=p.useCallback(f=>c((h=[])=>[...h,f]),[c]),d=p.useCallback(f=>c((h=[])=>h.filter(m=>m!==f)),[c]);return o.jsx(mje,{scope:t.__scopeToggleGroup,type:"multiple",value:l,onItemActivate:u,onItemDeactivate:d,children:o.jsx(bje,{...a,ref:n})})},"ToggleGroupImplMultiple")),[jct,Nct]=hje(Gw),bje=p.forwardRef(ug(function(t,n){const{__scopeToggleGroup:i,disabled:r=!1,rovingFocus:s=!0,orientation:a,dir:l,loop:c=!0,...u}=t,d=pje(i),f=RC(l),h={dir:f,...u};return o.jsx(jct,{scope:i,rovingFocus:s,disabled:r,children:s?o.jsx(BQ,{asChild:!0,...d,orientation:a,dir:f,loop:c,children:o.jsx(Mr.div,{...h,ref:n})}):o.jsx(Mr.div,{...h,ref:n})})},"ToggleGroupImpl")),PF="ToggleGroupItem",Rct=p.forwardRef(ug(function(t,n){const i=gje(PF,t.__scopeToggleGroup),r=Nct(PF,t.__scopeToggleGroup),s=pje(t.__scopeToggleGroup),a=i.value.includes(t.value),l=r.disabled||t.disabled,c={...t,pressed:a,disabled:l},u=p.useRef(null);return r.rovingFocus?o.jsx(UQ,{asChild:!0,...s,focusable:!l,active:a,ref:u,children:o.jsx(jZ,{...c,ref:n})}):o.jsx(jZ,{...c,ref:n})},"ToggleGroupItem")),jZ=p.forwardRef(ug(function(t,n){const{__scopeToggleGroup:i,value:r,...s}=t,a=gje(PF,i),l={role:"radio","aria-checked":t.pressed,"aria-pressed":void 0},c=a.type==="single"?l:void 0;return o.jsx(Ect,{...c,...s,ref:n,onPressedChange:u=>{u?a.onItemActivate(r):a.onItemDeactivate(r)}})},"ToggleGroupItemImpl")),Ict=Object.defineProperty,va=(e,t)=>Ict(e,"name",{value:t,configurable:!0}),[tz,lcn]=gc("Tooltip",[qw]),nz=qw(),Pct="TooltipProvider",Dct=700,DF="tooltip.open",[Mct,iz]=tz(Pct),Lct=va(e=>{const{__scopeTooltip:t,delayDuration:n=Dct,skipDelayDuration:i=300,disableHoverableContent:r=!1,children:s}=e,a=p.useRef(!0),l=p.useRef(!1),c=p.useRef(0);return p.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),o.jsx(Mct,{scope:t,isOpenDelayedRef:a,delayDuration:n,onOpen:p.useCallback(()=>{i<=0||(window.clearTimeout(c.current),a.current=!1)},[i]),onClose:p.useCallback(()=>{i<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>a.current=!0,i))},[i]),isPointerInTransitRef:l,onPointerInTransitChange:p.useCallback(u=>{l.current=u},[]),disableHoverableContent:r,children:s})},"TooltipProvider"),MF="Tooltip",[$ct,DC]=tz(MF),Fct=va(e=>{const{__scopeTooltip:t,children:n,open:i,defaultOpen:r,onOpenChange:s,disableHoverableContent:a,delayDuration:l}=e,c=iz(MF,e.__scopeTooltip),u=nz(t),[d,f]=p.useState(null),[h,m]=p.useState(void 0),g=lg(),b=p.useRef(0),v=a??c.disableHoverableContent,y=l??c.delayDuration,x=p.useRef(!1),[w,O]=ed({prop:i,defaultProp:r??!1,onChange:va(A=>{A?(c.onOpen(),document.dispatchEvent(new CustomEvent(DF))):c.onClose(),s==null||s(A)},"onChange"),caller:MF}),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 N=h??g;return o.jsx(OP,{...u,children:o.jsx($ct,{scope:t,contentId:N,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"),NZ="TooltipTrigger",Bct=p.forwardRef(va(function(t,n){const{__scopeTooltip:i,...r}=t,s=DC(NZ,i),a=iz(NZ,i),l=nz(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]),o.jsx(MQ,{asChild:!0,...l,children:o.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&&!a.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")),yje="TooltipPortal",[Uct,Qct]=tz(yje,{forceMount:void 0}),zct=va(e=>{const{__scopeTooltip:t,forceMount:n,children:i,container:r}=e,s=DC(yje,t);return o.jsx(Uct,{scope:t,forceMount:n,children:o.jsx(Hf,{present:n||s.open,children:o.jsx(jQ,{asChild:!0,container:r,children:i})})})},"TooltipPortal"),iE="TooltipContent",Vct=p.forwardRef(va(function(t,n){const i=Qct(iE,t.__scopeTooltip),{forceMount:r=i.forceMount,side:s="top",...a}=t,l=DC(iE,t.__scopeTooltip);return o.jsx(Hf,{present:r||l.open,children:l.disableHoverableContent?o.jsx(vje,{side:s,...a,ref:n}):o.jsx(Hct,{side:s,...a,ref:n})})},"TooltipContent")),Hct=p.forwardRef(va(function(t,n){const i=DC(iE,t.__scopeTooltip),r=iz(iE,t.__scopeTooltip),s=p.useRef(null),a=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=xje(x,y.getBoundingClientRect()),O=wje(x,w),S=Oje(v.getBoundingClientRect()),k=Sje([...O,...S]);c(k),h(!0)},[h]);return p.useEffect(()=>()=>m(),[m]),p.useEffect(()=>{if(u&&f){const b=va(y=>g(y,f),"handleTriggerLeave"),v=va(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=va(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=!kje(x,l);w?m():O&&(m(),d())},"handleTrackPointerGrace");return document.addEventListener("pointermove",b),()=>document.removeEventListener("pointermove",b)}},[u,f,l,d,m]),o.jsx(vje,{...t,ref:a})},"TooltipContentHoverable")),qct=NAe("TooltipContent"),vje=p.forwardRef(va(function(t,n){const{__scopeTooltip:i,children:r,"aria-label":s,id:a,onEscapeKeyDown:l,onPointerDownOutside:c,...u}=t,d=DC(iE,i),f=nz(i),{onClose:h}=d;p.useEffect(()=>(document.addEventListener(DF,h),()=>document.removeEventListener(DF,h)),[h]),p.useEffect(()=>{if(d.trigger){const g=va(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 Hu(()=>(m(a),()=>{m(void 0)}),[a,m]),o.jsx(TQ,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:g=>g.preventDefault(),onDismiss:h,children:o.jsxs(LQ,{"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:[o.jsx(qct,{children:r}),s?o.jsx(vst,{id:d.contentId,role:"tooltip",children:s}):null]})})},"TooltipContentImpl"));function xje(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")}}va(xje,"getExitSideFromRect");function wje(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}va(wje,"getPaddedExitPoints");function Oje(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}]}va(Oje,"getPointsFromRect");function kje(e,t){const{x:n,y:i}=e;let r=!1;for(let s=0,a=t.length-1;si!=h>i&&n<(f-u)*(i-d)/(h-d)+u&&(r=!r)}return r}va(kje,"isPointInPolygon");function Sje(e){const t=e.slice();return t.sort((n,i)=>n.xi.x?1:n.yi.y?1:0),Eje(t)}va(Sje,"getHull");function Eje(e){if(e.length<=1)return e.slice();const t=[];for(let i=0;i=2;){const s=t[t.length-1],a=t[t.length-2];if((s.x-a.x)*(r.y-a.y)>=(s.y-a.y)*(r.x-a.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],a=n[n.length-2];if((s.x-a.x)*(r.y-a.y)>=(s.y-a.y)*(r.x-a.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)}va(Eje,"getHullPresorted");var Wct=Lct,Kct=Fct,Cje=Bct,Gct=zct,Xct=Vct;function dg(e){const t=p.useRef(e);return t.current=e,t}let ew=[],V2=!1;const RZ=e=>{var t,n;if(e.key==="Escape"){const[i]=ew;i&&(e.preventDefault(),(n=(t=i.callback).current)==null||n.call(t))}},Tje=()=>{ew.length>0&&!V2?(document.body.addEventListener("keydown",RZ),V2=!0):ew.length===0&&V2&&(document.body.removeEventListener("keydown",RZ),V2=!1)},Yct=e=>{ew.unshift(e),Tje()},Zct=({id:e})=>{ew=ew.filter(t=>t.id!==e),Tje()},MC=(e,t)=>{const n=p.useId(),i=dg(t);p.useEffect(()=>{if(!e)return;const r={id:n,callback:i};return Yct(r),()=>Zct(r)},[n,e,i])},Jct=p.createContext(null);function Aje(){const e=p.useContext(Jct);return(e==null?void 0:e.linkComponent)??"a"}function LC(e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}const eut=()=>EAe,IZ=(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},U0=()=>{},Q0=e=>{const t=p.useRef(e);return t.current=e,p.useCallback(n=>t.current(n),[])};function tut(e,t,n,i){const r=e.reduce((c,u)=>({...c,[u.key]:1}),{}),s=t.reduce((c,u)=>({...c,[u.component.key]:1}),{}),a=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(a):a.concat(l)}function nut(e,t,n){if((EAe||est)&&t&&n>1)throw new Error(`Cannot use forwardRef with multiple children in <${e} />`)}const iut="_TransitionGroupChild_1hv1z_1",rut={TransitionGroupChild:iut},_je={enter:!1,enterActive:!1,exit:!1,exitActive:!1,interrupted:!1},sut=e=>({..._je,enter:!e}),out=(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 _je}},aut=({ref:e,as:t,children:n,className:i,transitionId:r,style:s,preventMountTransition:a,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(out,sut(a||!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(N=>{const A=O.current;if(!(!A||N===C.current))switch(C.current=N,N){case"enter":f(A);break;case"enter-active":h(A);break;case"enter-complete":m(A);break;case"exit":g(A);break;case"exit-active":b(A);break;case"exit-complete":v(A);break}},[f,h,m,g,b,v]);return pi.useLayoutEffect(()=>{if(!l){let j;x({type:"exit-before"}),E("exit");const T=PN(()=>{x({type:"exit-active"}),E("exit-active"),j=window.setTimeout(()=>{E("exit-complete"),d()},k.current)});return()=>{T(),j!==void 0&&clearTimeout(j)}}if(a&&!w.current){w.current=!0;return}let N;x({type:"enter-before"}),E("enter");const A=PN(()=>{x({type:"enter-active"}),E("enter-active"),N=window.setTimeout(()=>{x({type:"done"}),E("enter-complete")},S.current)});return()=>{A(),N!==void 0&&clearTimeout(N)}},[l,a,d,E]),p.useEffect(()=>()=>{w.current=!1},[]),o.jsx(t,{ref:LC([O,e]),className:Ci(i,rut.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})},lut=e=>{const{enterMountDelay:t,preventMountTransition:n}=e,i=!n&&t!=null?t:null,[r,s]=p.useState(i==null);return wQ(()=>s(!0),r?null:i),r?o.jsx(aut,{...e}):null},Xw=e=>{const{ref:t,as:n="span",children:i,className:r,transitionId:s,style:a,enterDuration:l=0,exitDuration:c=0,preventInitialTransition:u=!0,enterMountDelay:d,insertMethod:f="append",disableAnimations:h=eut()}=e,m=Q0(e.onEnter??U0),g=Q0(e.onEnterActive??U0),b=Q0(e.onEnterComplete??U0),v=Q0(e.onExit??U0),y=Q0(e.onExitActive??U0),x=Q0(e.onExitComplete??U0);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(()=>IZ(i).map(k=>({...w(k),preventMountTransition:u})));return p.useLayoutEffect(()=>{S(k=>{const C=IZ(i);return tut(C,k,w,f)})},[i,f,w]),nut("TransitionGroup",t,p.Children.count(i)),h?o.jsx(o.Fragment,{children:p.Children.map(i,k=>o.jsx(n,{ref:t,className:r,style:a,"data-transition-id":s,children:k}))}):o.jsx(o.Fragment,{children:O.map(({component:k,...C})=>o.jsx(lut,{...C,as:n,className:r,transitionId:s,enterDuration:l,exitDuration:c,enterMountDelay:d,style:a,ref:t,children:k},k.key))})},cut="_Button_1864l_1",uut="_ButtonInner_1864l_4",dut="_ButtonLoader_1864l_749",yL={Button:cut,ButtonInner:uut,ButtonLoader:dut},Dt=e=>{const{type:t="button",color:n="primary",variant:i="solid",pill:r=!0,uniform:s=!1,size:a="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 o.jsxs("button",{type:t,className:Ci(yL.Button,g),"data-color":n,"data-variant":i,"data-pill":r?"":void 0,"data-uniform":s?"":void 0,"data-size":a,"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:OQ,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:[o.jsx(Xw,{className:yL.ButtonLoader,enterDuration:250,exitDuration:150,children:u&&o.jsx(jC,{},"loader")}),o.jsx("span",{className:yL.ButtonInner,children:xQ(m)})]})},fut=()=>{var e;return typeof ClipboardItem<"u"&&!!((e=navigator.clipboard)!=null&&e.write)};function hut(e){const{"text/plain":t,...n}=e;return new ClipboardItem({...n,...t?{"text/plain":new Blob([t],{type:"text/plain"})}:null})}async function put(e,t=document.body){if(typeof e=="string")return PZ(e,t);try{return fut()?(await navigator.clipboard.write([hut(e)]),!0):e["text/plain"]?PZ(e["text/plain"],t):!1}catch{return!1}}async function PZ(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 mut="_TransitionItem_1o7b1_1",gut={TransitionItem:mut},but=e=>{const{as:t="span",className:n,children:i,preventInitialTransition:r,insertMethod:s,transitionClassName:a,transitionPosition:l="absolute"}=e,{enterTotalDuration:c,exitTotalDuration:u,variables:d}=Out(e);return o.jsx(t,{className:Ci("block",l==="absolute"&&"relative",n),"data-transition-position":l,style:d,children:o.jsx(Xw,{as:t,className:Ci(gut.TransitionItem,a),enterDuration:c,exitDuration:u,insertMethod:s,preventInitialTransition:r,children:i})})},yut=400,vut=500,xut=200,wut=300;function Out({initial:e,enter:t,exit:n,forceCompositeLayer:i}){const r=aL(e),s=aL(t),a=aL(n),l=[r,a,s].some(b=>b!=="none"),c=(t==null?void 0:t.duration)??(l?vut:yut),u=(t==null?void 0:t.timingFunction)??(l?"var(--cubic-enter)":"ease"),d=(n==null?void 0:n.duration)??(l?wut:xut),f=(n==null?void 0:n.timingFunction)??(l?"var(--cubic-exit)":"ease"),h=Ky({"tg-will-change":i?"transform, opacity":"auto","tg-enter-opacity":oL((t==null?void 0:t.opacity)??1),"tg-enter-transform":s,"tg-enter-filter":lL(t),"tg-enter-duration":M2(c),"tg-enter-delay":M2((t==null?void 0:t.delay)??0),"tg-enter-timing-function":u,"tg-exit-opacity":oL((n==null?void 0:n.opacity)??0),"tg-exit-transform":a,"tg-exit-filter":lL(n),"tg-exit-duration":M2(d),"tg-exit-delay":M2((n==null?void 0:n.delay)??0),"tg-exit-timing-function":f,"tg-initial-opacity":oL((e==null?void 0:e.opacity)??(n==null?void 0:n.opacity)??0),"tg-initial-transform":r==="none"?a:r,"tg-initial-filter":lL(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 rz=({children:e,copyValue:t,onClick:n,...i})=>{const[r,s]=p.useState(!1),a=p.useRef(null),l=c=>{r||(s(!0),n==null||n(c),put(typeof t=="function"?t():t),a.current=window.setTimeout(()=>{s(!1)},1300))};return p.useEffect(()=>()=>{a.current&&clearTimeout(a.current)},[]),o.jsxs(Dt,{...i,onClick:l,children:[o.jsx(but,{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?o.jsx(XS,{},"copied-icon"):o.jsx(J2e,{},"copy-icon")}),typeof e=="function"?e({copied:r}):e]})},kut="_Menu_1t4b0_1",Sut="_MenuList_1t4b0_3",Eut="_MenuItemContent_1t4b0_53",Cut="_MenuItem_1t4b0_53",Tut="_ItemActions_1t4b0_98",Aut="_PressableInner_1t4b0_117",_ut="_Separator_1t4b0_135",jut="_SubMenuItem_1t4b0_139",Nut="_SubTriggerIcon_1t4b0_141",Rut="_RadioItem_1t4b0_151",Iut="_RadioIndicatorActive_1t4b0_158",Put="_RadioIndicator_1t4b0_158",Dut="_CheckboxItem_1t4b0_249",Mut="_CheckboxIndicator_1t4b0_256",Lut="_CheckboxCircle_1t4b0_269",ps={Menu:kut,MenuList:Sut,MenuItemContent:Eut,MenuItem:Cut,ItemActions:Tut,PressableInner:Aut,Separator:_ut,SubMenuItem:jut,SubTriggerIcon:Nut,RadioItem:Rut,RadioIndicatorActive:Iut,RadioIndicator:Put,CheckboxItem:Dut,CheckboxIndicator:Mut,CheckboxCircle:Lut},jje=p.createContext(null),$C=()=>{const e=p.useContext(jje);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,a]=p.useState(!1),l=t??s,c=dg(n),u=dg(i),d=p.useCallback(h=>{var m,g;a(h),h?(m=c.current)==null||m.call(c):(g=u.current)==null||g.call(u)},[c,u]);MC(s,()=>{d(!1)});const f=p.useMemo(()=>({open:l,setOpen:d}),[l,d]);return o.jsx(jje.Provider,{value:f,children:o.jsx(Slt,{open:l,onOpenChange:d,modal:r,children:e})})},$ut=({className:e,children:t,disabled:n,onSelect:i,onClick:r})=>{const{open:s}=$C(),a=l=>{s||l.preventDefault()};return i?o.jsx(X_e,{className:Ci(ps.MenuItem,e),onSelect:i,onClick:r,disabled:n,onPointerMove:a,onPointerLeave:a,children:o.jsx("div",{className:ps.PressableInner,children:t})}):o.jsx("div",{className:Ci(ps.MenuItemContent,e),children:t})},Fut=({className:e,children:t})=>o.jsx("div",{className:Ci(ps.ItemActions,e),children:t}),But=({children:e,onClick:t})=>{const{setOpen:n}=$C();return o.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})},Uut=e=>{const{className:t,children:n,href:i,to:r,disabled:s,as:a,...l}=e,{open:c}=$C(),u=i||r,d=u?/^https?:\/\//.test(u):!0,f=Aje(),h=a||(d?"a":f),m=b=>{c||b.preventDefault()},g=d?{target:"_blank",rel:"noopener noreferrer",href:i??r}:{href:i,to:r};return o.jsx(X_e,{asChild:!0,className:Ci(ps.MenuItem,t),disabled:s,onPointerMove:d?void 0:m,onPointerLeave:d?void 0:m,children:o.jsx(h,{...g,...l,children:o.jsx("span",{className:ps.PressableInner,children:n})})})},Qut=({className:e})=>o.jsx(jlt,{className:Ci(ps.Separator,e),role:"separator"}),zut=({children:e,side:t,sideOffset:n=5,align:i,alignOffset:r,width:s,minWidth:a,maxHeight:l})=>{const{open:c}=$C();return o.jsx(G_e,{forceMount:!0,children:o.jsx(Xw,{className:ps.Menu,enterDuration:350,exitDuration:200,disableAnimations:!0,children:c&&o.jsx(Clt,{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:Gh,style:Ky({"menu-width":s,"menu-min-width":a,"menu-max-height":l}),children:e},"dropdown")})})},Vut=({children:e,disabled:t})=>o.jsx(Elt,{asChild:!0,disabled:t,children:e}),Nje=p.createContext(null),Rje=()=>{const e=p.useContext(Nje);if(!e)throw new Error("Submenu components must be wrapped in ");return e},Hut=({children:e,forceOpen:t,onOpen:n,onClose:i})=>{const[r,s]=p.useState(!1),a=p.useRef(null),l=t??r,c=dg(n),u=dg(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]);MC(r,()=>{var h;d(!1),(h=a.current)==null||h.focus()});const f=p.useMemo(()=>({open:l,setOpen:d,triggerRef:a}),[l,d]);return o.jsx(Nje.Provider,{value:f,children:o.jsx(Nlt,{open:l,onOpenChange:d,children:e})})},qut=({className:e,children:t,disabled:n})=>{const{open:i}=$C(),{triggerRef:r}=Rje(),s=a=>{i||a.preventDefault()};return o.jsx(Rlt,{ref:r,className:Ci(ps.MenuItem,ps.SubMenuItem,e),disabled:n,onPointerMove:s,onPointerLeave:s,children:o.jsxs("div",{className:ps.PressableInner,children:[t,o.jsx(fit,{width:"16",height:"16",className:ps.SubTriggerIcon})]})})},Wut=({children:e,sideOffset:t=4,alignOffset:n=-6,width:i="auto",minWidth:r="auto",maxHeight:s})=>{const{open:a}=Rje();return o.jsx(G_e,{forceMount:!0,children:o.jsx(Xw,{className:ps.Menu,enterDuration:350,exitDuration:200,disableAnimations:!0,children:a&&o.jsx(Ilt,{className:ps.MenuList,sideOffset:t,alignOffset:n,avoidCollisions:!0,collisionPadding:{bottom:30,top:30,left:12,right:12},onEscapeKeyDown:Gh,style:Ky({"menu-width":i,"menu-min-width":r,"menu-max-height":s}),children:e},"submenu")})})},Kut=({children:e,value:t,onChange:n,indicatorPosition:i="end",...r})=>o.jsx(Alt,{...r,value:t,onValueChange:s=>n(s),"data-indicator-position":i,children:e}),Gut=({className:e,children:t,...n})=>o.jsx(_lt,{className:Ci(ps.MenuItem,ps.RadioItem,e),...n,children:o.jsxs("div",{className:ps.PressableInner,children:[o.jsx("div",{className:ps.RadioIndicator,children:o.jsx(Y_e,{className:ps.RadioIndicatorActive})}),t]})}),Xut=({className:e,children:t,indicatorPosition:n="end",indicatorVariant:i="solid",...r})=>o.jsx(Tlt,{className:Ci(ps.MenuItem,ps.CheckboxItem,e),...r,"data-indicator-position":n,"data-indicator-variant":i,children:o.jsxs("div",{className:ps.PressableInner,children:[o.jsx("div",{className:ps.CheckboxIndicator,children:o.jsx(Y_e,{children:i==="ghost"?o.jsx(XS,{className:"size-4"}):o.jsx("div",{className:ps.CheckboxCircle,children:o.jsx(XS,{className:"size-4"})})})}),t]})});Pr.Content=zut;Pr.Item=$ut;Pr.ItemActions=Fut;Pr.ItemAction=But;Pr.Link=Uut;Pr.Separator=Qut;Pr.Trigger=Vut;Pr.Sub=Hut;Pr.SubTrigger=qut;Pr.SubContent=Wut;Pr.CheckboxItem=Xut;Pr.RadioGroup=Kut;Pr.RadioItem=Gut;const Yut="_Tooltip_16g2y_1",Zut="_TriggerDecorator_16g2y_73",Ije={Tooltip:Yut,TriggerDecorator:Zut},po=e=>{const{ref:t,children:n,content:i,forceOpen:r=i===null?!1:void 0,maxWidth:s=300,openDelay:a=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);wQ(()=>k(!1),S?400:null);const C=r??w,E=A=>{typeof r!="boolean"&&(O(A),u&&k(A))},N=A=>{u&&S&&(A.preventDefault(),A.stopPropagation())};return o.jsxs(Pje,{open:C,delayDuration:a,onOpenChange:E,disableHoverableContent:!l,children:[o.jsx(Cje,{asChild:!0,children:o.jsx(_Ae,{...x,ref:t,onPointerDown:A=>{N(A),v==null||v(A)},onClick:A=>{N(A),y==null||y(A)},children:n})}),o.jsx(Dje,{maxWidth:s,compact:c,align:d,alignOffset:f,side:h,sideOffset:m,gutterSize:g,className:b,children:i})]})},Pje=({children:e,open:t,onOpenChange:n,...i})=>(MC(t,()=>{n(!1)}),o.jsx(Wct,{children:o.jsx(Kct,{open:t,onOpenChange:n,...i,children:e})})),Dje=({children:e,maxWidth:t=300,compact:n=!1,clickable:i=void 0,alignOffset:r=0,sideOffset:s=5,gutterSize:a="md",className:l,style:c,...u})=>o.jsx(Gct,{children:o.jsx(Xct,{...u,className:Ci(Ije.Tooltip,l),"data-compact":n,"data-clickable":i,"data-gutter-size":a,alignOffset:r,sideOffset:s,collisionPadding:15,hideWhenDetached:!0,style:{...c,maxWidth:t},onEscapeKeyDown:Gh,children:e})}),Jut=({children:e,asChild:t=!0,...n})=>o.jsx(Cje,{asChild:t,...n,children:e}),edt=e=>{const{children:t,className:n,focusable:i=!0,ref:r,...s}=e,a=typeof t=="string";return o.jsx(_Ae,{ref:r,...s,className:Ci(Ije.TriggerDecorator,n),tabIndex:i?0:void 0,children:a?o.jsx("span",{children:t}):t})};po.Root=Pje;po.Content=Dje;po.Trigger=Jut;po.TriggerDecorator=edt;const tdt=50,DZ=48;function ndt(e){return(e.events??[]).flatMap(t=>{var r,s;const i=(((r=t.content)==null?void 0:r.parts)??[]).map(a=>typeof a.text=="string"?a.text:"").filter(Boolean).join("");return i?[{text:i,role:t.author??((s=t.content)==null?void 0:s.role)??"",ts:t.timestamp}]:[]})}function idt(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 V("search.untitledSession")}function rdt(e,t,n){const i=Math.max(0,t-DZ),r=Math.min(e.length,t+n+DZ);return(i>0?"…":"")+e.slice(i,r).trim()+(r{var c;if((c=l.events)!=null&&c.length)return l;try{return await HI(t,e,l.id)}catch{return l}})),a=[];for(const l of s)for(const{text:c,role:u,ts:d}of ndt(l)){const f=c.toLowerCase().indexOf(i);if(f!==-1){a.push({type:"session",appId:t,sessionId:l.id,title:idt(l),snippet:rdt(c,f,i.length),role:u,ts:d??l.lastUpdateTime});break}}return a.sort((l,c)=>(c.ts??0)-(l.ts??0)),a.slice(0,tdt)}async function odt(e,t){if(!e||!t.trim())return{results:[]};let n;try{n=await eCe(e,t.trim())}catch(a){const l=String(a);return{results:[],note:l.includes("404")?V("search.webUnavailable"):V("search.webFailed",{message:l})}}const{mounted:i,results:r,error:s}=n;return i?s?{results:[],note:s}:{results:r.map((a,l)=>({type:"web",index:l,title:a.title,url:a.url,siteName:a.siteName,summary:a.summary}))}:{results:[],note:V("search.webNotMounted")}}async function adt(e,t,n,i){if(!t||!i.trim())return{results:[]};const r=await JEe(t,e,i.trim(),n);if(!r.mounted)return{results:[],note:V(e==="knowledge"?"search.knowledgeNotMounted":"search.memoryNotMounted")};if(r.error)return{results:[],note:r.error};const s=r.sourceName??V(e==="knowledge"?"search.knowledge":"search.longTermMemory");return{results:r.results.map((a,l)=>e==="knowledge"?{type:"knowledge",index:l,content:a.content,sourceName:s,sourceType:r.sourceType}:{type:"memory",index:l,content:a.content,sourceName:s,sourceType:r.sourceType,author:a.author,ts:a.timestamp})}}async function ldt(e,t,n){return e==="session"?{results:await sdt(n.userId,n.appId,t)}:e==="web"?odt(n.appId,t):adt(e,n.appId,n.userId,t)}function Mje({mirrored:e=!1}){return o.jsxs("g",{opacity:"0.5",transform:e?"translate(20 0) scale(-1 1)":void 0,children:[o.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"}),o.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 cdt(e){return o.jsx("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",...e,children:o.jsx(Mje,{})})}function udt(e){return o.jsx("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",...e,children:o.jsx(Mje,{mirrored:!0})})}function ddt(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.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 fdt(e){return o.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.333",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("circle",{cx:"7.333",cy:"7.333",r:"5.333"}),o.jsx("path",{d:"m11.133 11.133 2.867 2.867"})]})}function hdt(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.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 Lje(e){return o.jsxs("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:[o.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"}),o.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"}),o.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 $je(e){return o.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M3.25 2.25h6l3.5 3.5v8H3.25v-11Z"}),o.jsx("path",{d:"M9.25 2.25v3.5h3.5M5.5 8.25h5M5.5 10.75h4"})]})}function pdt({className:e="icon"}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[o.jsx("path",{d:"M16.4 10.7a5.7 5.7 0 1 1-1.67-4.03"}),o.jsx("path",{d:"M15.25 15.25 19.6 19.6"})]})}function mdt({open:e}){return o.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:o.jsx("path",{d:"m3.25 4.75 2.75 2.5 2.75-2.5"})})}function gdt({active:e=!1,onClick:t}){const{t:n}=_e("workspaceTools");return o.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:[o.jsx(fdt,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:n("search.nav")})]})}function bdt(e,t,n,i){const r=!!e,s=new Set((t==null?void 0:t.searchSources)??[]),a=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:a(" web_search")},{id:"knowledge",label:i("search.sources.knowledge"),ready:r&&s.has("knowledge"),unavailableLabel:a(i("search.sources.knowledge"))},{id:"memory",label:i("search.sources.memory"),ready:r&&s.has("memory"),unavailableLabel:a(i("search.sources.memory"))}]}function DN(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 MZ(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 ydt({userId:e,appId:t,agentInfo:n,capabilitiesLoading:i,agentLabel:r,onOpenSession:s}){var L,F;const{t:a,i18n:l}=_e("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),N=bdt(t,n,i,a),A=N.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"?(F=n==null?void 0:n.components)==null?void 0:F.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(z){var K;(K=E.current)!=null&&K.contains(z.target)||k(!1)}return document.addEventListener("pointerdown",I),()=>document.removeEventListener("pointerdown",I)},[S]);async function T(I,z){var H;const K=I.trim();if(!K||!((H=N.find(X=>X.id===z))!=null&&H.ready))return;const B=++C.current;x(!0),O(!0);let W;try{W=await ldt(z,K,{userId:e,appId:t})}catch(X){const ie=X instanceof Error?X.message:String(X);W={results:[],note:a("search.failed",{message:ie})}}B===C.current&&(g(W.results),v(W.note),x(!1))}function R(I){C.current+=1,h(I),g([]),v(void 0),O(!1),x(!1)}function _(I){C.current+=1,d(I),k(!1),g([]),v(void 0),O(!1),x(!1)}const D=!!(A!=null&&A.ready),M=t?u==="web"?a("search.placeholder.web"):u==="knowledge"?a("search.placeholder.knowledge",{name:(j==null?void 0:j.name)??a("search.placeholder.knowledgeFallback")}):u==="memory"?a("search.placeholder.memory",{name:(j==null?void 0:j.name)??a("search.placeholder.memoryFallback")}):a("search.placeholder.session"):a("search.placeholder.selectAgent"),P=j!=null&&j.backend?DN(j.backend,a):"";return o.jsxs("div",{className:"search",children:[o.jsxs("div",{className:"search-box",children:[o.jsxs("div",{className:"search-source-picker-wrap",ref:E,children:[o.jsxs("button",{className:"search-source-picker",type:"button","aria-label":a("search.sourceTypeAria",{label:(A==null?void 0:A.label)??a("search.notSelected")}),"aria-haspopup":"listbox","aria-expanded":S,onClick:()=>k(I=>!I),children:[o.jsx("span",{children:(A==null?void 0:A.label)??a("search.sourceType")}),P&&o.jsx("small",{children:P}),o.jsx(mdt,{open:S})]}),S&&o.jsx("div",{className:"search-source-menu",role:"listbox","aria-label":a("search.selectSource"),children:N.map(I=>{var B,W;const z=I.id==="knowledge"?(B=n==null?void 0:n.components)==null?void 0:B.find(H=>H.source==="knowledgebase"||H.kind==="knowledgebase"):I.id==="memory"?(W=n==null?void 0:n.components)==null?void 0:W.find(H=>H.source==="long_term_memory"||H.kind==="memory"):void 0,K=z?[z.name,z.backend?DN(z.backend,a):""].filter(Boolean).join(" · "):I.ready?I.description:I.unavailableLabel;return o.jsxs("button",{type:"button",role:"option","aria-selected":u===I.id,disabled:!I.ready,onClick:()=>_(I.id),children:[o.jsx("span",{children:I.label}),K&&o.jsx("small",{children:K})]},I.id)})})]}),o.jsx("span",{className:"search-box-divider","aria-hidden":!0}),o.jsx("input",{className:"search-input",value:f,onChange:I=>R(I.target.value),onKeyDown:I=>{I.key==="Enter"&&(I.preventDefault(),T(f,u))},placeholder:M,disabled:!D,autoFocus:!0}),o.jsx("button",{className:"search-go",onClick:()=>void T(f,u),disabled:!f.trim()||y,"aria-label":a("search.nav"),children:y?o.jsx(Mi,{className:"icon spin"}):o.jsx(pdt,{className:"icon"})})]}),o.jsx("div",{className:"search-results",children:D?w?y?null:b?o.jsx("div",{className:"search-empty",children:b}):m.length===0&&w?o.jsx("div",{className:"search-empty",children:a("search.noResults",{query:f.trim()})}):m.map((I,z)=>o.jsx(vdt,{result:I,agentLabel:r,onOpen:s,locale:c},z)):o.jsx("div",{className:"search-empty",children:a(u==="web"?"search.instructions.web":u==="knowledge"?"search.instructions.knowledge":u==="memory"?"search.instructions.memory":"search.instructions.session")}):o.jsx("div",{className:"search-empty",children:t?i?a("search.loadingCapabilities"):(A==null?void 0:A.unavailableLabel)??a("search.sourceUnavailable"):a("search.noAgentHint")})})]})}function vdt({result:e,agentLabel:t,onOpen:n,locale:i}){const{t:r}=_e("workspaceTools");switch(e.type){case"session":return o.jsxs("button",{className:"search-result",onClick:()=>n(e.appId,e.sessionId),children:[o.jsx(uAe,{className:"search-result-icon"}),o.jsxs("div",{className:"search-result-body",children:[o.jsxs("div",{className:"search-result-head",children:[o.jsx("span",{className:"search-result-title",children:e.title}),o.jsxs("span",{className:"search-result-meta",children:[t(e.appId),e.ts?` · ${MZ(e.ts,i)}`:""]})]}),o.jsx("div",{className:"search-result-snippet",children:e.snippet})]})]});case"web":return o.jsxs("a",{className:"search-result",href:e.url||void 0,target:"_blank",rel:"noreferrer noopener",children:[o.jsx(gP,{className:"search-result-icon"}),o.jsxs("div",{className:"search-result-body",children:[o.jsxs("div",{className:"search-result-head",children:[o.jsx("span",{className:"search-result-title",children:e.title||e.url}),o.jsxs("span",{className:"search-result-meta",children:[e.siteName,e.url&&o.jsx(xy,{className:"search-result-ext"})]})]}),e.summary&&o.jsx("div",{className:"search-result-snippet",children:e.summary})]})]});case"knowledge":return o.jsxs("div",{className:"search-result search-result-static",children:[o.jsx(LZ,{source:"knowledge"}),o.jsxs("div",{className:"search-result-body",children:[o.jsxs("div",{className:"search-result-head",children:[o.jsx("span",{className:"search-result-title",children:r("search.knowledgeFragment",{index:e.index+1})}),o.jsxs("span",{className:"search-result-meta",children:[e.sourceName,e.sourceType?` · ${DN(e.sourceType,r)}`:""]})]}),o.jsx("div",{className:"search-result-snippet search-result-snippet-expanded",children:e.content})]})]});case"memory":return o.jsxs("div",{className:"search-result search-result-static",children:[o.jsx(LZ,{source:"memory"}),o.jsxs("div",{className:"search-result-body",children:[o.jsxs("div",{className:"search-result-head",children:[o.jsx("span",{className:"search-result-title",children:r("search.memoryFragment",{index:e.index+1})}),o.jsxs("span",{className:"search-result-meta",children:[e.sourceName,e.sourceType?` · ${DN(e.sourceType,r)}`:"",e.ts?` · ${MZ(e.ts,i)}`:""]})]}),o.jsx("div",{className:"search-result-snippet search-result-snippet-expanded",children:e.content})]})]});default:return null}}function LZ({source:e,className:t="search-result-icon"}){return e==="knowledge"?o.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[o.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"}),o.jsx("path",{d:"M8.25 9h7.5M8.25 12.25h6"})]}):o.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[o.jsx("path",{d:"M12 4.5a7.5 7.5 0 1 0 7.5 7.5"}),o.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 xdt({filled:e=!1,...t}){return o.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:[o.jsx("rect",{x:"3.5",y:"9.3",width:"4.5",height:"10.2",rx:"1.5"}),o.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 wdt({filled:e=!1,...t}){return o.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:[o.jsx("rect",{x:"3.5",y:"4.5",width:"4.5",height:"10.2",rx:"1.5"}),o.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 Fje(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M5.25 4.25h9.5a2.5 2.5 0 0 1 2.5 2.5v3.5"}),o.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"}),o.jsx("path",{d:"M7 8.25h5.5M7 11.75h3.25"}),o.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"}),o.jsx("path",{d:"m17.65 10.6 1.9 1.9"})]})}const _P="/assets/media/logo-DCsNZy-k.svg",sz="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 Odt(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.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"}),o.jsx("rect",{x:"8.5",y:"2.5",width:"7",height:"4",rx:"1.5"}),o.jsx("path",{d:"m8 13 2.5 2.5L16 10"})]})}const $Z="(max-width: 860px)";function FZ({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)),a={"--history-title-translate":`-${i}px`,"--history-title-duration":`${s.toFixed(2)}s`};return o.jsx("span",{ref:t,className:`history-title${i>0?" is-overflowing":""}`,style:a,children:o.jsx("span",{ref:n,className:"history-title-text",children:e})})}function kdt(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75","aria-hidden":"true",...e,children:[o.jsx("circle",{cx:"7",cy:"7",r:"2.25"}),o.jsx("circle",{cx:"17",cy:"7",r:"2.25"}),o.jsx("circle",{cx:"7",cy:"17",r:"2.25"}),o.jsx("circle",{cx:"17",cy:"17",r:"2.25"})]})}function Sdt(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("circle",{cx:"12",cy:"12",r:"8.25"}),o.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 Edt(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 Cdt={super_admin:"account.roles.super_admin",admin:"account.roles.admin",developer:"account.roles.developer",user:"account.roles.user"};function Tdt({activePage:e,access:t,userInfo:n,onAgentKitCli:i,onDeveloperResources:r,onSystemInfo:s,onIssueFeedback:a,onLogout:l}){const{t:c,i18n:u}=_e(["sidebar","common"]),[d,f]=p.useState("");if(!n)return null;const h=FYe(n)||c("sidebar:account.defaultUser"),m=typeof n.email=="string"?n.email.trim():"",g=Edt(h),b=BYe(n),v=b===d?"":b,y=sC(u.resolvedLanguage??u.language)??rC;return o.jsx("div",{className:"sidebar-user",children:o.jsxs("div",{className:"sidebar-user-row",children:[o.jsxs(Pr,{modal:!0,children:[o.jsx(Pr.Trigger,{children:o.jsxs("button",{type:"button",className:"sidebar-user-btn",title:h,children:[o.jsx("span",{className:`account-avatar${v?" has-image":""}`,style:g,"aria-hidden":"true",children:v?o.jsx("img",{className:"account-avatar-image",src:v,alt:"","aria-hidden":"true",referrerPolicy:"no-referrer",onError:()=>f(v)}):null}),o.jsx("span",{className:"sidebar-user-identity",children:o.jsx("span",{className:"sidebar-user-name",children:h})})]})}),o.jsxs(Pr.Content,{side:"top",align:"start",sideOffset:4,minWidth:216,children:[o.jsxs("div",{className:"account-menu-head",children:[o.jsx("span",{className:`account-avatar account-avatar--lg${v?" has-image":""}`,style:g,"aria-hidden":"true",children:v?o.jsx("img",{className:"account-avatar-image",src:v,alt:"","aria-hidden":"true",referrerPolicy:"no-referrer",onError:()=>f(v)}):null}),o.jsxs("div",{className:"account-id",children:[o.jsxs("div",{className:"account-name-row",children:[o.jsx("div",{className:"account-name",children:h}),o.jsx(Lo,{color:"secondary",size:"sm",variant:"soft",pill:!0,children:c(`sidebar:${Cdt[t.role]}`)})]}),m&&m!==h&&o.jsx("div",{className:"account-sub",children:m})]})]}),o.jsxs(Pr.Item,{className:"account-menu-action",onSelect:s,children:[o.jsx(Vf,{className:"icon","aria-hidden":"true"}),c("sidebar:account.systemInfo")]}),o.jsxs(Pr.Sub,{children:[o.jsx(Pr.SubTrigger,{className:"account-menu-action",children:o.jsxs("span",{className:"account-menu-action__label",children:[o.jsx(Sdt,{className:"icon"}),c("sidebar:account.language")]})}),o.jsx(Pr.SubContent,{sideOffset:6,minWidth:136,children:o.jsx(Pr.RadioGroup,{value:y,onChange:x=>{Zze(x)},indicatorPosition:"end",children:D9.map(x=>o.jsx(Pr.RadioItem,{value:x,children:c(`common:languageNames.${x}`)},x))})})]}),o.jsxs(Pr.Item,{className:"account-menu-action",onSelect:a,children:[o.jsx(Fje,{className:"icon"}),c("sidebar:account.issueFeedback")]}),o.jsxs(Pr.Item,{className:"account-menu-action",onSelect:l,children:[o.jsx(irt,{className:"icon","aria-hidden":"true"}),c("sidebar:account.logout")]})]})]}),o.jsxs("div",{className:"sidebar-user-shortcuts","aria-label":c("sidebar:account.shortcuts"),children:[o.jsx(po,{compact:!0,content:c("sidebar:account.tryCli"),children:o.jsx("button",{type:"button",className:"sidebar-user-shortcut",onClick:i,"aria-label":c("sidebar:account.tryCli"),children:o.jsx(wit,{className:"icon"})})}),o.jsx(po,{compact:!0,content:c("sidebar:account.developerResources"),children:o.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:o.jsx(cit,{className:"icon"})})})]})]})})}function Adt({branding:e,cloudProvider:t,sessions:n,currentSessionId:i,activePage:r,features:s,access:a,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:N,onDeleteSession:A,userInfo:j,onLogout:T}){const{t:R}=_e("sidebar"),_=H=>(s==null?void 0:s[H])!==!1,D=a.role==="admin"||a.role==="super_admin",M=a.capabilities.manageUsers&&!!C,[P,L]=p.useState(null),F=p.useRef(typeof window<"u"&&window.matchMedia($Z).matches),[I,z]=p.useState(F.current),K=n.map(H=>({id:H.id,title:yP(H.events,R("history.newConversation")),createdAt:(H.lastUpdateTime??0)*1e3})).sort((H,X)=>X.createdAt-H.createdAt),B=()=>{F.current=!1,z(H=>!H),L(null)};p.useEffect(()=>{const H=window.matchMedia($Z),X=ie=>{ie.matches?z(Q=>Q||(F.current=!0,!0)):F.current&&(F.current=!1,z(!1))};return H.addEventListener("change",X),()=>H.removeEventListener("change",X)},[]);const W=t==="byteplus"?sz:_P;return o.jsxs("aside",{className:`sidebar ${I?"is-collapsed":""}`,children:[o.jsxs("div",{className:"sidebar-top",children:[o.jsxs("div",{className:"sidebar-brand-row",children:[o.jsxs("button",{type:"button",className:"brand",onClick:d,"aria-label":R("navigation.home"),title:R("navigation.home"),children:[o.jsx("img",{className:"brand-logo",src:e.logoUrl||W,width:20,height:20,alt:"","aria-hidden":!0}),o.jsx("span",{className:"brand-title",children:e.title})]}),o.jsx("button",{type:"button",className:"sidebar-collapse-toggle",onClick:B,"aria-label":R(I?"navigation.expand":"navigation.collapse"),title:R(I?"navigation.expand":"navigation.collapse"),children:I?o.jsx(udt,{className:"icon"}):o.jsx(cdt,{className:"icon"})})]}),o.jsxs("nav",{className:"sidebar-nav","aria-label":R("navigation.label"),children:[_("newChat")&&o.jsxs("button",{className:`new-chat new-chat--conversation${r==="new-chat"?" is-active":""}`,onClick:d,"aria-label":R("navigation.newChat"),"aria-current":r==="new-chat"?"page":void 0,title:R("navigation.newChat"),children:[o.jsx(ddt,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:R("navigation.newChat")})]}),_("search")&&o.jsx(gdt,{active:r==="search",onClick:f}),o.jsxs("button",{className:`new-chat new-chat--agents${r==="agents"?" is-active":""}`,onClick:v,"aria-label":R("navigation.agents"),"aria-current":r==="agents"?"page":void 0,title:R("navigation.agents"),children:[o.jsx(hdt,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:R("navigation.agents")})]}),o.jsxs("button",{className:`new-chat new-chat--workspaces${r==="workspaces"?" is-active":""}`,onClick:y,"aria-label":R("navigation.workspaces"),"aria-current":r==="workspaces"?"page":void 0,title:R("navigation.workspaces"),children:[o.jsx(Lit,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:R("navigation.workspaces")})]}),o.jsxs("button",{className:`new-chat new-chat--library${r==="library"?" is-active":""}`,onClick:m,"aria-label":R("navigation.library"),"aria-current":r==="library"?"page":void 0,title:R("navigation.library"),children:[o.jsx(Lje,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:R("navigation.library")})]}),o.jsxs("button",{className:`new-chat new-chat--cronjobs${r==="cronjobs"?" is-active":""}`,onClick:w,"aria-label":R("navigation.cronjobs"),"aria-current":r==="cronjobs"?"page":void 0,title:R("navigation.cronjobs"),children:[o.jsx(pQ,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:R("navigation.cronjobs")})]}),o.jsxs("button",{className:`new-chat new-chat--applications${r==="applications"?" is-active":""}`,onClick:x,"aria-label":R("navigation.automations"),"aria-current":r==="applications"?"page":void 0,title:R("navigation.automations"),children:[o.jsx(kdt,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:R("navigation.automations")})]})]}),D||M?o.jsxs("nav",{className:"sidebar-nav sidebar-nav--administration","aria-label":R("navigation.administration"),children:[o.jsx("div",{className:"sidebar-nav-group-title","aria-hidden":"true",children:R("navigation.administration")}),D?o.jsxs("button",{type:"button",className:`new-chat new-chat--review-center${r==="review-center"?" is-active":""}`,onClick:g,"aria-label":R("navigation.reviewCenter"),"aria-current":r==="review-center"?"page":void 0,title:R("navigation.reviewCenter"),children:[o.jsx(Odt,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:R("navigation.reviewCenter")})]}):null,M?o.jsxs("button",{type:"button",className:`new-chat${r==="users"?" is-active":""}`,onClick:C,"aria-label":R("navigation.users"),"aria-current":r==="users"?"page":void 0,title:R("navigation.users"),children:[o.jsx(Hrt,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:R("navigation.users")})]}):null]}):null]}),_("history")&&o.jsxs("div",{className:"sidebar-history",children:[o.jsxs("div",{className:"history-head",children:[o.jsx("span",{children:R("history.title")}),_("newChat")&&o.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":R("history.create"),title:R("history.create"),children:o.jsx(_l,{className:"icon"})})]}),o.jsx("div",{className:"history-list",children:u?o.jsxs(o.Fragment,{children:[u.loading&&u.threads.length===0?o.jsx("div",{className:"history-empty",role:"status",children:R("history.loading")}):null,u.error?o.jsx("div",{className:"history-error",role:"alert",children:u.error}):null,!u.loading&&!u.error&&u.threads.length===0?o.jsx("div",{className:"history-empty",children:R("history.empty")}):null,u.threads.map(H=>{const X=H.id===u.currentThreadId,ie=H.name||H.preview||`Thread ${H.id.slice(0,8)}`,Q=H.id===u.busyThreadId;return o.jsxs("div",{className:`history-item ${X?"active":""}`,children:[o.jsxs("button",{type:"button",className:"history-item-btn",onClick:()=>u.onSelect(H.id),"aria-current":X?"page":void 0,title:ie,disabled:Q,children:[o.jsx(FZ,{title:ie}),X?o.jsx("span",{className:"history-current-badge",children:R("history.current")}):null]}),o.jsx("button",{type:"button",className:"history-more","aria-label":R("history.manage",{title:ie}),title:R("history.more"),disabled:Q,onClick:()=>L(Z=>Z===H.id?null:H.id),children:o.jsx(oZ,{className:"icon"})}),P===H.id?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"menu-scrim",onClick:()=>L(null)}),o.jsx("div",{className:"history-menu",children:o.jsxs("button",{type:"button",className:"menu-item menu-item--danger",onClick:()=>{L(null),u.onDelete(H)},children:[o.jsx(ag,{className:"icon"})," ",R("history.delete")]})})]}):null]},H.id)}),u.hasMore?o.jsx("button",{type:"button",className:"history-load-more",disabled:u.loading,onClick:u.onLoadMore,children:u.loading?R("history.loadingMore"):R("history.loadMore")}):null]}):o.jsxs(o.Fragment,{children:[K.length===0?o.jsx("div",{className:"history-empty",children:R("history.empty")}):null,K.map(H=>{const X=H.id===i,ie=(l==null?void 0:l.has(H.id))===!0,Q=!ie&&(c==null?void 0:c.has(H.id))===!0;return o.jsxs("div",{className:`history-item ${X?"active":""}`,children:[o.jsxs("button",{className:"history-item-btn",onClick:()=>N(H.id),"aria-current":X?"page":void 0,title:H.title,children:[o.jsx(FZ,{title:H.title}),Q&&o.jsxs("span",{className:"history-evaluating-status",title:R("history.evaluatingTitle"),children:[o.jsx("span",{className:"history-evaluating","aria-hidden":"true"}),R("history.evaluating")]})]}),o.jsxs("div",{className:"history-action-slot",children:[ie?o.jsx(jC,{className:"history-streaming-indicator",size:12,role:"status","aria-label":R("history.generating")}):null,o.jsx("button",{type:"button",className:"history-more","aria-label":R("history.manage",{title:H.title}),title:R("history.more"),onClick:()=>L(Z=>Z===H.id?null:H.id),children:o.jsx(oZ,{className:"icon"})})]}),P===H.id&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"menu-scrim",onClick:()=>L(null)}),o.jsx("div",{className:"history-menu",children:o.jsxs("button",{type:"button",className:"menu-item menu-item--danger",onClick:()=>{L(null),A(H.id)},children:[o.jsx(ag,{className:"icon"})," ",R("history.delete")]})})]})]},H.id)})]})})]}),o.jsx("div",{className:"sidebar-footer",children:o.jsx(Tdt,{activePage:r,access:a,userInfo:j,onAgentKitCli:O,onDeveloperResources:S,onSystemInfo:k,onIssueFeedback:E,onLogout:T})})]})}function Fo(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,i;n{}};function jP(){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}})}X_.prototype=jP.prototype={constructor:X_,on:function(e,t){var n=this._,i=jdt(e+"",n),r,s=-1,a=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)),UZ.hasOwnProperty(t)?{space:UZ[t],local:e}:e}function Rdt(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===LF&&t.documentElement.namespaceURI===LF?t.createElement(e):t.createElementNS(n,e)}}function Idt(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Bje(e){var t=NP(e);return(t.local?Idt:Rdt)(t)}function Pdt(){}function oz(e){return e==null?Pdt:function(){return this.querySelector(e)}}function Ddt(e){typeof e!="function"&&(e=oz(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;)(a=i[r])&&(s&&a.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(a,s),s=a);return this}function oft(e){e||(e=aft);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 lft(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function cft(){return Array.from(this)}function uft(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?wft:typeof t=="function"?kft:Oft)(e,t,n??"")):tw(this.node(),e)}function tw(e,t){return e.style.getPropertyValue(t)||Hje(e).getComputedStyle(e,null).getPropertyValue(t)}function Eft(e){return function(){delete this[e]}}function Cft(e,t){return function(){this[e]=t}}function Tft(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Aft(e,t){return arguments.length>1?this.each((t==null?Eft:typeof t=="function"?Tft:Cft)(e,t)):this.node()[e]}function qje(e){return e.trim().split(/^|\s+/)}function az(e){return e.classList||new Wje(e)}function Wje(e){this._node=e,this._names=qje(e.getAttribute("class")||"")}Wje.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 Kje(e,t){for(var n=az(e),i=-1,r=t.length;++i=0&&(n=t.slice(i+1),t=t.slice(0,i)),{type:t,name:n}})}function nht(e){return function(){var t=this.__on;if(t){for(var n=0,i=-1,r=t.length,s;n()=>e;function $F(e,{sourceEvent:t,subject:n,target:i,identifier:r,active:s,x:a,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:a,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}})}$F.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function fht(e){return!e.ctrlKey&&!e.button}function hht(){return this.parentNode}function pht(e,t){return t??{x:e.x,y:e.y}}function mht(){return navigator.maxTouchPoints||"ontouchstart"in this}function eNe(){var e=fht,t=hht,n=pht,i=mht,r={},s=jP("start","drag","end"),a=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,dht).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&&(qc(O.view).on("mousemove.drag",g,rE).on("mouseup.drag",b,rE),Zje(O.view),vL(O),u=!1,l=O.clientX,c=O.clientY,k("start",O))}}function g(O){if(cx(O),!u){var S=O.clientX-l,k=O.clientY-c;u=S*S+k*k>f}r.mouse("drag",O)}function b(O){qc(O.view).on("mousemove.drag mouseup.drag",null),Jje(O.view,u),cx(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,N,A;for(N=0;N>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?q2(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?q2(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=bht.exec(e))?new rc(t[1],t[2],t[3],1):(t=yht.exec(e))?new rc(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=vht.exec(e))?q2(t[1],t[2],t[3],t[4]):(t=xht.exec(e))?q2(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=wht.exec(e))?KZ(t[1],t[2]/100,t[3]/100,1):(t=Oht.exec(e))?KZ(t[1],t[2]/100,t[3]/100,t[4]):QZ.hasOwnProperty(e)?HZ(QZ[e]):e==="transparent"?new rc(NaN,NaN,NaN,0):null}function HZ(e){return new rc(e>>16&255,e>>8&255,e&255,1)}function q2(e,t,n,i){return i<=0&&(e=t=n=NaN),new rc(e,t,n,i)}function Eht(e){return e instanceof BC||(e=Oy(e)),e?(e=e.rgb(),new rc(e.r,e.g,e.b,e.opacity)):new rc}function FF(e,t,n,i){return arguments.length===1?Eht(e):new rc(e,t,n,i??1)}function rc(e,t,n,i){this.r=+e,this.g=+t,this.b=+n,this.opacity=+i}lz(rc,FF,tNe(BC,{brighter(e){return e=e==null?LN:Math.pow(LN,e),new rc(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?sE:Math.pow(sE,e),new rc(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new rc(ny(this.r),ny(this.g),ny(this.b),$N(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:qZ,formatHex:qZ,formatHex8:Cht,formatRgb:WZ,toString:WZ}));function qZ(){return`#${Mb(this.r)}${Mb(this.g)}${Mb(this.b)}`}function Cht(){return`#${Mb(this.r)}${Mb(this.g)}${Mb(this.b)}${Mb((isNaN(this.opacity)?1:this.opacity)*255)}`}function WZ(){const e=$N(this.opacity);return`${e===1?"rgb(":"rgba("}${ny(this.r)}, ${ny(this.g)}, ${ny(this.b)}${e===1?")":`, ${e})`}`}function $N(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ny(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Mb(e){return e=ny(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 Od(e,t,n,i)}function nNe(e){if(e instanceof Od)return new Od(e.h,e.s,e.l,e.opacity);if(e instanceof BC||(e=Oy(e)),!e)return new Od;if(e instanceof Od)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),a=NaN,l=s-r,c=(s+r)/2;return l?(t===s?a=(n-i)/l+(n0&&c<1?0:a,new Od(a,l,c,e.opacity)}function Tht(e,t,n,i){return arguments.length===1?nNe(e):new Od(e,t,n,i??1)}function Od(e,t,n,i){this.h=+e,this.s=+t,this.l=+n,this.opacity=+i}lz(Od,Tht,tNe(BC,{brighter(e){return e=e==null?LN:Math.pow(LN,e),new Od(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?sE:Math.pow(sE,e),new Od(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 rc(xL(e>=240?e-240:e+120,r,i),xL(e,r,i),xL(e<120?e+240:e-120,r,i),this.opacity)},clamp(){return new Od(GZ(this.h),W2(this.s),W2(this.l),$N(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=$N(this.opacity);return`${e===1?"hsl(":"hsla("}${GZ(this.h)}, ${W2(this.s)*100}%, ${W2(this.l)*100}%${e===1?")":`, ${e})`}`}}));function GZ(e){return e=(e||0)%360,e<0?e+360:e}function W2(e){return Math.max(0,Math.min(1,e||0))}function xL(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 RP=e=>()=>e;function iNe(e,t){return function(n){return e+n*t}}function Aht(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 ccn(e,t){var n=t-e;return n?iNe(e,n>180||n<-180?n-360*Math.round(n/360):n):RP(isNaN(e)?t:e)}function _ht(e){return(e=+e)==1?rNe:function(t,n){return n-t?Aht(t,n,e):RP(isNaN(t)?n:t)}}function rNe(e,t){var n=t-e;return n?iNe(e,n):RP(isNaN(e)?t:e)}const FN=function e(t){var n=_ht(t);function i(r,s){var a=n((r=FF(r)).r,(s=FF(s)).r),l=n(r.g,s.g),c=n(r.b,s.b),u=rNe(r.opacity,s.opacity);return function(d){return r.r=a(d),r.g=l(d),r.b=c(d),r.opacity=u(d),r+""}}return i.gamma=e,i}(1);function jht(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[a]?l[a]+=s:l[++a]=s),(i=i[0])===(r=r[0])?l[a]?l[a]+=r:l[++a]=r:(l[++a]=null,c.push({i:a,x:df(i,r)})),n=wL.lastIndex;return n180?d+=360:d-u>180&&(u+=360),h.push({i:f.push(r(f)+"rotate(",null,i)-2,x:df(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:df(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:df(u,f)},{i:b-2,x:df(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),a(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;--nw}function ZZ(){ky=(UN=aE.now())+IP,nw=JO=0;try{Hht()}finally{nw=0,Wht(),ky=0}}function qht(){var e=aE.now(),t=e-UN;t>lNe&&(IP-=t,UN=e)}function Wht(){for(var e,t=BN,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:BN=n);ek=e,QF(i)}function QF(e){if(!nw){JO&&(JO=clearTimeout(JO));var t=e-ky;t>24?(e<1/0&&(JO=setTimeout(ZZ,e-aE.now()-IP)),lO&&(lO=clearInterval(lO))):(lO||(UN=aE.now(),lO=setInterval(qht,lNe)),nw=1,cNe(ZZ))}}function JZ(e,t,n){var i=new QN;return t=t==null?0:+t,i.restart(r=>{i.stop(),e(r+t)},t,n),i}var Kht=jP("start","end","cancel","interrupt"),Ght=[],dNe=0,eJ=1,zF=2,Z_=3,tJ=4,VF=5,J_=6;function PP(e,t,n,i,r,s){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;Xht(e,n,{name:t,index:i,group:r,on:Kht,tween:Ght,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:dNe})}function uz(e,t){var n=Ud(e,t);if(n.state>dNe)throw new Error("too late; already scheduled");return n}function qf(e,t){var n=Ud(e,t);if(n.state>Z_)throw new Error("too late; already running");return n}function Ud(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Xht(e,t,n){var i=e.__transition,r;i[t]=n,n.timer=uNe(s,0,n.time);function s(u){n.state=eJ,n.timer.restart(a,n.delay,n.time),n.delay<=u&&a(u-n.delay)}function a(u){var d,f,h,m;if(n.state!==eJ)return c();for(d in i)if(m=i[d],m.name===n.name){if(m.state===Z_)return JZ(a);m.state===tJ?(m.state=J_,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete i[d]):+dzF&&i.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function Cpt(e,t,n){var i,r,s=Ept(t)?uz:qf;return function(){var a=s(this,e),l=a.on;l!==i&&(r=(i=l).copy()).on(t,n),a.on=r}}function Tpt(e,t){var n=this._id;return arguments.length<2?Ud(this.node(),n).on.on(e):this.each(Cpt(n,e,t))}function Apt(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function _pt(){return this.on("end.remove",Apt(this._id))}function jpt(e){var t=this._name,n=this._id;typeof e!="function"&&(e=oz(e));for(var i=this._groups,r=i.length,s=new Array(r),a=0;a()=>e;function tmt(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 Fh(e,t,n){this.k=e,this.x=t,this.y=n}Fh.prototype={constructor:Fh,scale:function(e){return e===1?this:new Fh(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Fh(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 DP=new Fh(1,0,0);mNe.prototype=Fh.prototype;function mNe(e){for(;!e.__zoom;)if(!(e=e.parentNode))return DP;return e.__zoom}function OL(e){e.stopImmediatePropagation()}function cO(e){e.preventDefault(),e.stopImmediatePropagation()}function nmt(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function imt(){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 nJ(){return this.__zoom||DP}function rmt(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function smt(){return navigator.maxTouchPoints||"ontouchstart"in this}function omt(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],a=e.invertY(t[1][1])-n[1][1];return e.translate(r>i?(i+r)/2:Math.min(0,i)||Math.max(0,r),a>s?(s+a)/2:Math.min(0,s)||Math.max(0,a))}function gNe(){var e=nmt,t=imt,n=omt,i=rmt,r=smt,s=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],l=250,c=Y_,u=jP("start","zoom","end"),d,f,h,m=500,g=150,b=0,v=10;function y(_){_.property("__zoom",nJ).on("wheel.zoom",E,{passive:!1}).on("mousedown.zoom",N).on("dblclick.zoom",A).filter(r).on("touchstart.zoom",j).on("touchmove.zoom",T).on("touchend.zoom touchcancel.zoom",R).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}y.transform=function(_,D,M,P){var L=_.selection?_.selection():_;L.property("__zoom",nJ),_!==L?S(_,D,M,P):L.interrupt().each(function(){k(this,arguments).event(P).start().zoom(null,typeof D=="function"?D.apply(this,arguments):D).end()})},y.scaleBy=function(_,D,M,P){y.scaleTo(_,function(){var L=this.__zoom.k,F=typeof D=="function"?D.apply(this,arguments):D;return L*F},M,P)},y.scaleTo=function(_,D,M,P){y.transform(_,function(){var L=t.apply(this,arguments),F=this.__zoom,I=M==null?O(L):typeof M=="function"?M.apply(this,arguments):M,z=F.invert(I),K=typeof D=="function"?D.apply(this,arguments):D;return n(w(x(F,K),I,z),L,a)},M,P)},y.translateBy=function(_,D,M,P){y.transform(_,function(){return n(this.__zoom.translate(typeof D=="function"?D.apply(this,arguments):D,typeof M=="function"?M.apply(this,arguments):M),t.apply(this,arguments),a)},null,P)},y.translateTo=function(_,D,M,P,L){y.transform(_,function(){var F=t.apply(this,arguments),I=this.__zoom,z=P==null?O(F):typeof P=="function"?P.apply(this,arguments):P;return n(DP.translate(z[0],z[1]).scale(I.k).translate(typeof D=="function"?-D.apply(this,arguments):-D,typeof M=="function"?-M.apply(this,arguments):-M),F,a)},P,L)};function x(_,D){return D=Math.max(s[0],Math.min(s[1],D)),D===_.k?_:new Fh(D,_.x,_.y)}function w(_,D,M){var P=D[0]-M[0]*_.k,L=D[1]-M[1]*_.k;return P===_.x&&L===_.y?_:new Fh(_.k,P,L)}function O(_){return[(+_[0][0]+ +_[1][0])/2,(+_[0][1]+ +_[1][1])/2]}function S(_,D,M,P){_.on("start.zoom",function(){k(this,arguments).event(P).start()}).on("interrupt.zoom end.zoom",function(){k(this,arguments).event(P).end()}).tween("zoom",function(){var L=this,F=arguments,I=k(L,F).event(P),z=t.apply(L,F),K=M==null?O(z):typeof M=="function"?M.apply(L,F):M,B=Math.max(z[1][0]-z[0][0],z[1][1]-z[0][1]),W=L.__zoom,H=typeof D=="function"?D.apply(L,F):D,X=c(W.invert(K).concat(B/W.k),H.invert(K).concat(B/H.k));return function(ie){if(ie===1)ie=H;else{var Q=X(ie),Z=B/Q[2];ie=new Fh(Z,K[0]-Q[0]*Z,K[1]-Q[1]*Z)}I.zoom(null,ie)}})}function k(_,D,M){return!M&&_.__zooming||new C(_,D)}function C(_,D){this.that=_,this.args=D,this.active=0,this.sourceEvent=null,this.extent=t.apply(_,D),this.taps=0}C.prototype={event:function(_){return _&&(this.sourceEvent=_),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(_,D){return this.mouse&&_!=="mouse"&&(this.mouse[1]=D.invert(this.mouse[0])),this.touch0&&_!=="touch"&&(this.touch0[1]=D.invert(this.touch0[0])),this.touch1&&_!=="touch"&&(this.touch1[1]=D.invert(this.touch1[0])),this.that.__zoom=D,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(_){var D=qc(this.that).datum();u.call(_,this.that,new tmt(_,{sourceEvent:this.sourceEvent,target:y,transform:this.that.__zoom,dispatch:u}),D)}};function E(_,...D){if(!e.apply(this,arguments))return;var M=k(this,D).event(_),P=this.__zoom,L=Math.max(s[0],Math.min(s[1],P.k*Math.pow(2,i.apply(this,arguments)))),F=yd(_);if(M.wheel)(M.mouse[0][0]!==F[0]||M.mouse[0][1]!==F[1])&&(M.mouse[1]=P.invert(M.mouse[0]=F)),clearTimeout(M.wheel);else{if(P.k===L)return;M.mouse=[F,P.invert(F)],ej(this),M.start()}cO(_),M.wheel=setTimeout(I,g),M.zoom("mouse",n(w(x(P,L),M.mouse[0],M.mouse[1]),M.extent,a));function I(){M.wheel=null,M.end()}}function N(_,...D){if(h||!e.apply(this,arguments))return;var M=_.currentTarget,P=k(this,D,!0).event(_),L=qc(_.view).on("mousemove.zoom",K,!0).on("mouseup.zoom",B,!0),F=yd(_,M),I=_.clientX,z=_.clientY;Zje(_.view),OL(_),P.mouse=[F,this.__zoom.invert(F)],ej(this),P.start();function K(W){if(cO(W),!P.moved){var H=W.clientX-I,X=W.clientY-z;P.moved=H*H+X*X>b}P.event(W).zoom("mouse",n(w(P.that.__zoom,P.mouse[0]=yd(W,M),P.mouse[1]),P.extent,a))}function B(W){L.on("mousemove.zoom mouseup.zoom",null),Jje(W.view,P.moved),cO(W),P.event(W).end()}}function A(_,...D){if(e.apply(this,arguments)){var M=this.__zoom,P=yd(_.changedTouches?_.changedTouches[0]:_,this),L=M.invert(P),F=M.k*(_.shiftKey?.5:2),I=n(w(x(M,F),P,L),t.apply(this,D),a);cO(_),l>0?qc(this).transition().duration(l).call(S,I,P,_):qc(this).call(y.transform,I,P,_)}}function j(_,...D){if(e.apply(this,arguments)){var M=_.touches,P=M.length,L=k(this,D,_.changedTouches.length===P).event(_),F,I,z,K;for(OL(_),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.`},lE=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],bNe=["Enter"," ","Escape"],yNe={"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 iw;(function(e){e.Strict="strict",e.Loose="loose"})(iw||(iw={}));var iy;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(iy||(iy={}));var cE;(function(e){e.Partial="partial",e.Full="full"})(cE||(cE={}));const vNe={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var bm;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(bm||(bm={}));var uE;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(uE||(uE={}));var pn;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(pn||(pn={}));const iJ={[pn.Left]:pn.Right,[pn.Right]:pn.Left,[pn.Top]:pn.Bottom,[pn.Bottom]:pn.Top};function xNe(e){return e===null?null:e?"valid":"invalid"}const wNe=e=>"id"in e&&"source"in e&&"target"in e,amt=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),fz=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),UC=(e,t=[0,0])=>{const{width:n,height:i}=Ap(e),r=e.origin??t,s=n*r[0],a=i*r[1];return{x:e.position.x-s,y:e.position.y-a}},lmt=(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 a=!t.nodeLookup&&!s?r:void 0;t.nodeLookup&&(a=s?t.nodeLookup.get(r):fz(r)?r:t.nodeLookup.get(r.id));const l=a?zN(a,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return MP(i,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return LP(n)},QC=(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=MP(n,zN(r)),i=!0)}),i?LP(n):{x:0,y:0,width:0,height:0}},hz=(e,t,[n,i,r]=[0,0,1],s=!1,a=!1)=>{const l={...Yw(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(a&&!f||h)continue;const m=d.width??u.width??u.initialWidth??null,g=d.height??u.height??u.initialHeight??null,b=dE(l,sw(u)),v=(m??0)*(g??0),y=s&&b>0;(!u.internals.handleBounds||y||b>=v||u.dragging)&&c.push(u)}return c},cmt=(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 umt(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 dmt({nodes:e,width:t,height:n,panZoom:i,minZoom:r,maxZoom:s},a){if(e.size===0)return!0;const l=umt(e,a),c=QC(l),u=mz(c,t,n,(a==null?void 0:a.minZoom)??r,(a==null?void 0:a.maxZoom)??s,(a==null?void 0:a.padding)??.1);return await i.setViewport(u,{duration:a==null?void 0:a.duration,ease:a==null?void 0:a.ease,interpolate:a==null?void 0:a.interpolate}),!0}function ONe({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:i=[0,0],nodeExtent:r,onError:s}){const a=n.get(e),l=a.parentId?n.get(a.parentId):void 0,{x:c,y:u}=l?l.internals.positionAbsolute:{x:0,y:0},d=a.origin??i;let f=a.extent||r;if(a.extent==="parent"&&!a.expandParent)if(!l)s==null||s("005",Dd.error005());else{const m=l.measured.width,g=l.measured.height;m&&g&&(f=[[c,u],[c+m,u+g]])}else l&&Ey(a.extent)&&(f=[[a.extent[0][0]+c,a.extent[0][1]+u],[a.extent[1][0]+c,a.extent[1][1]+u]]);const h=Ey(f)?Sy(t,f,a.measured):t;return(a.measured.width===void 0||a.measured.height===void 0)&&(s==null||s("015",Dd.error015())),{position:{x:h.x-c+(a.measured.width??0)*d[0],y:h.y-u+(a.measured.height??0)*d[1]},positionAbsolute:h}}async function fmt({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:i,onBeforeDelete:r}){const s=new Set(e.map(h=>h.id)),a=[];for(const h of n){if(h.deletable===!1)continue;const m=s.has(h.id),g=!m&&h.parentId&&a.find(b=>b.id===h.parentId);(m||g)&&a.push(h)}const l=new Set(t.map(h=>h.id)),c=i.filter(h=>h.deletable!==!1),d=cmt(a,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:a};const f=await r({nodes:a,edges:d});return typeof f=="boolean"?f?{edges:d,nodes:a}:{edges:[],nodes:[]}:f}const rw=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Sy=(e={x:0,y:0},t,n)=>({x:rw(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:rw(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function kNe(e,t,n){const{width:i,height:r}=Ap(n),{x:s,y:a}=n.internals.positionAbsolute;return Sy(e,[[s,a],[s+i,a+r]],t)}const rJ=(e,t,n)=>en?-rw(Math.abs(e-n),1,t)/t:0,pz=(e,t,n=15,i=40)=>{const r=rJ(e.x,i,t.width-i)*n,s=rJ(e.y,i,t.height-i)*n;return[r,s]},MP=(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)}),HF=({x:e,y:t,width:n,height:i})=>({x:e,y:t,x2:e+n,y2:t+i}),LP=({x:e,y:t,x2:n,y2:i})=>({x:e,y:t,width:n-e,height:i-t}),sw=(e,t=[0,0])=>{var r,s;const{x:n,y:i}=fz(e)?e.internals.positionAbsolute:UC(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}},zN=(e,t=[0,0])=>{var r,s;const{x:n,y:i}=fz(e)?e.internals.positionAbsolute:UC(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)}},SNe=(e,t)=>LP(MP(HF(e),HF(t))),dE=(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)},sJ=e=>Sd(e.width)&&Sd(e.height)&&Sd(e.x)&&Sd(e.y),Sd=e=>!isNaN(e)&&isFinite(e),ENe=(e,t)=>(n,i)=>{},zC=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Yw=({x:e,y:t},[n,i,r],s=!1,a=[1,1])=>{const l={x:(e-n)/r,y:(t-i)/r};return s?zC(l,a):l},ow=({x:e,y:t},[n,i,r])=>({x:e*r+n,y:t*r+i});function z0(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 hmt(e,t,n){if(typeof e=="string"||typeof e=="number"){const i=z0(e,n),r=z0(e,t);return{top:i,right:r,bottom:i,left:r,x:r*2,y:i*2}}if(typeof e=="object"){const i=z0(e.top??e.y??0,n),r=z0(e.bottom??e.y??0,n),s=z0(e.left??e.x??0,t),a=z0(e.right??e.x??0,t);return{top:i,right:a,bottom:r,left:s,x:s+a,y:i+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function pmt(e,t,n,i,r,s){const{x:a,y:l}=ow(e,[t,n,i]),{x:c,y:u}=ow({x:e.x+e.width,y:e.y+e.height},[t,n,i]),d=r-c,f=s-u;return{left:Math.floor(a),top:Math.floor(l),right:Math.floor(d),bottom:Math.floor(f)}}const mz=(e,t,n,i,r,s)=>{const a=hmt(s,t,n),l=(t-a.x)/e.width,c=(n-a.y)/e.height,u=Math.min(l,c),d=rw(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=pmt(e,m,g,d,t,n),v={left:Math.min(b.left-a.left,0),top:Math.min(b.top-a.top,0),right:Math.min(b.right-a.right,0),bottom:Math.min(b.bottom-a.bottom,0)};return{x:m-v.left+v.right,y:g-v.top+v.bottom,zoom:d}},fE=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Ey(e){return e!=null&&e!=="parent"}function Ap(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 gz(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 CNe(e,t={width:0,height:0},n,i,r){const s={...e},a=i.get(n);if(a){const l=a.origin||r;s.x+=a.internals.positionAbsolute.x-(t.width??0)*l[0],s.y+=a.internals.positionAbsolute.y-(t.height??0)*l[1]}return s}function oJ(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function mmt(){let e,t;return{promise:new Promise((i,r)=>{e=i,t=r}),resolve:e,reject:t}}function gmt(e){return{...yNe,...e||{}}}function Wk(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:i,containerBounds:r}){const{x:s,y:a}=Ed(e),l=Yw({x:s-((r==null?void 0:r.left)??0),y:a-((r==null?void 0:r.top)??0)},i),{x:c,y:u}=n?zC(l,t):l;return{xSnapped:c,ySnapped:u,...l}}const bz=e=>({width:e.offsetWidth,height:e.offsetHeight}),TNe=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},bmt=["INPUT","SELECT","TEXTAREA"];function ANe(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:bmt.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const _Ne=e=>"clientX"in e,Ed=(e,t)=>{var s,a;const n=_Ne(e),i=n?e.clientX:(s=e.touches)==null?void 0:s[0].clientX,r=n?e.clientY:(a=e.touches)==null?void 0:a[0].clientY;return{x:i-((t==null?void 0:t.left)??0),y:r-((t==null?void 0:t.top)??0)}},aJ=(e,t,n,i,r)=>{const s=t.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(a=>{const l=a.getBoundingClientRect();return{id:a.getAttribute("data-handleid"),type:e,nodeId:r,position:a.getAttribute("data-handlepos"),x:(l.left-n.left)/i,y:(l.top-n.top)/i,...bz(a)}})};function jNe({sourceX:e,sourceY:t,targetX:n,targetY:i,sourceControlX:r,sourceControlY:s,targetControlX:a,targetControlY:l}){const c=e*.125+r*.375+a*.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 X2(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function lJ({pos:e,x1:t,y1:n,x2:i,y2:r,c:s}){switch(e){case pn.Left:return[t-X2(t-i,s),n];case pn.Right:return[t+X2(i-t,s),n];case pn.Top:return[t,n-X2(n-r,s)];case pn.Bottom:return[t,n+X2(r-n,s)]}}function NNe({sourceX:e,sourceY:t,sourcePosition:n=pn.Bottom,targetX:i,targetY:r,targetPosition:s=pn.Top,curvature:a=.25}){const[l,c]=lJ({pos:n,x1:e,y1:t,x2:i,y2:r,c:a}),[u,d]=lJ({pos:s,x1:i,y1:r,x2:e,y2:t,c:a}),[f,h,m,g]=jNe({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 RNe({sourceX:e,sourceY:t,targetX:n,targetY:i}){const r=Math.abs(n-e)/2,s=n0}const xmt=({source:e,sourceHandle:t,target:n,targetHandle:i})=>`xy-edge__${e}${t||""}-${n}${i||""}`,wmt=(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)),Omt=(e,t,n={})=>{var s;if(!e.source||!e.target)return(s=n.onError)==null||s.call(n,"006",Dd.error006()),t;const i=n.getEdgeId||xmt;let r;return wNe(e)?r={...e}:r={...e,id:i(e)},wmt(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function INe({sourceX:e,sourceY:t,targetX:n,targetY:i}){const[r,s,a,l]=RNe({sourceX:e,sourceY:t,targetX:n,targetY:i});return[`M ${e},${t}L ${n},${i}`,r,s,a,l]}const cJ={[pn.Left]:{x:-1,y:0},[pn.Right]:{x:1,y:0},[pn.Top]:{x:0,y:-1},[pn.Bottom]:{x:0,y:1}},kmt=({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 Smt({source:e,sourcePosition:t=pn.Bottom,target:n,targetPosition:i=pn.Top,center:r,offset:s,stepPosition:a}){const l=cJ[t],c=cJ[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=kmt({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]=RNe({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)*a,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)*a);const E=[{x:b,y:u.y},{x:b,y:d.y}],N=[{x:u.x,y:v},{x:d.x,y:v}];l[h]===m?g=h==="x"?E:N:g=h==="x"?N:E}else{const E=[{x:u.x,y:d.y}],N=[{x:d.x,y:u.y}];if(h==="x"?g=l.x===m?N:E:g=l.y===m?E:N,t===i){const _=Math.abs(e[h]-n[h]);if(_<=s){const D=Math.min(s-1,s-_);l[h]===m?y[h]=(u[h]>e[h]?-1:1)*D:x[h]=(d[h]>n[h]?-1:1)*D}}if(t!==i){const _=h==="x"?"y":"x",D=l[h]===c[_],M=u[_]>d[_],P=u[_]=R?(b=(A.x+j.x)/2,v=g[0].y):(b=g[0].x,v=(A.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 Emt(e,t,n,i){const r=Math.min(uJ(e,t)/2,uJ(t,n)/2,i),{x:s,y:a}=t;if(e.x===s&&s===n.x||e.y===a&&a===n.y)return`L${s} ${a}`;if(e.y===a){const u=e.xn.id===t):e[0])||null}function qF(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(i=>`${i}=${e[i]}`).join("&")}`:""}function Tmt(e,{id:t,defaultColor:n,defaultMarkerStart:i,defaultMarkerEnd:r}){const s=new Set;return e.reduce((a,l)=>([l.markerStart||i,l.markerEnd||r].forEach(c=>{if(c&&typeof c=="object"){const u=qF(c,t);s.has(u)||(a.push({id:u,color:c.color||n,...c}),s.add(u))}}),a),[]).sort((a,l)=>a.id.localeCompare(l.id))}const PNe=1e3,Amt=10,yz={nodeOrigin:[0,0],nodeExtent:lE,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},_mt={...yz,checkEquality:!0};function vz(e,t){const n={...e};for(const i in t)t[i]!==void 0&&(n[i]=t[i]);return n}function jmt(e,t,n){const i=vz(yz,n);for(const r of e.values())if(r.parentId)wz(r,e,t,i);else{const s=UC(r,i.nodeOrigin),a=Ey(r.extent)?r.extent:i.nodeExtent,l=Sy(s,a,Ap(r));r.internals.positionAbsolute=l}}function Nmt(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 xz(e){return e==="manual"}function WF(e,t,n,i={}){var d,f;const r=vz(_mt,i),s={i:0},a=new Map(t),l=r!=null&&r.elevateNodesOnSelect&&!xz(r.zIndexMode)?PNe:0;let c=e.length>0,u=!1;t.clear(),n.clear();for(const h of e){let m=a.get(h.id);if(r.checkEquality&&h===(m==null?void 0:m.internals.userNode))t.set(h.id,m);else{const g=UC(h,r.nodeOrigin),b=Ey(h.extent)?h.extent:r.nodeExtent,v=Sy(g,b,Ap(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:Nmt(h,m),z:DNe(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&&wz(m,t,n,i,s),u||(u=h.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:u}}function Rmt(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 wz(e,t,n,i,r){const{elevateNodesOnSelect:s,nodeOrigin:a,nodeExtent:l,zIndexMode:c}=vz(yz,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}Rmt(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*Amt),r&&d.internals.rootParentIndex!==void 0&&(r.i=d.internals.rootParentIndex);const f=s&&!xz(c)?PNe:0,{x:h,y:m,z:g}=Imt(e,d,a,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 DNe(e,t,n){const i=Sd(e.zIndex)?e.zIndex:0;return xz(n)?i:i+(e.selected?t:0)}function Imt(e,t,n,i,r,s){const{x:a,y:l}=t.internals.positionAbsolute,c=Ap(e),u=UC(e,n),d=Ey(e.extent)?Sy(u,e.extent,c):u;let f=Sy({x:a+d.x,y:l+d.y},i,c);e.extent==="parent"&&(f=kNe(f,c,t));const h=DNe(e,r,s),m=t.internals.z??0;return{x:f.x,y:f.y,z:m>=h?m+1:h}}function Oz(e,t,n,i=[0,0]){var a;const r=[],s=new Map;for(const l of e){const c=t.get(l.parentId);if(!c)continue;const u=((a=s.get(l.parentId))==null?void 0:a.expandedRect)??sw(c),d=SNe(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=Ap(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=Oz(h,t,n,r);u.push(...m)}return{changes:u,updatedInternals:c}}async function Dmt({delta:e,panZoom:t,transform:n,translateExtent:i,width:r,height:s}){if(!t||!e.x&&!e.y)return!1;const a=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,s]],i);return!!a&&(a.x!==n[0]||a.y!==n[1]||a.k!==n[2])}function pJ(e,t,n,i,r,s){let a=r;const l=i.get(a)||new Map;i.set(a,l.set(n,t)),a=`${r}-${e}`;const c=i.get(a)||new Map;if(i.set(a,c.set(n,t)),s){a=`${r}-${e}-${s}`;const u=i.get(a)||new Map;i.set(a,u.set(n,t))}}function MNe(e,t,n){e.clear(),t.clear();for(const i of n){const{source:r,target:s,sourceHandle:a=null,targetHandle:l=null}=i,c={edgeId:i.id,source:r,target:s,sourceHandle:a,targetHandle:l},u=`${r}-${a}--${s}-${l}`,d=`${s}-${l}--${r}-${a}`;pJ("source",c,d,e,r,a),pJ("target",c,u,e,s,l),t.set(i.id,i)}}function LNe(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:LNe(n,t):!1}function mJ(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 Mmt(e,t,n,i){const r=new Map;for(const[s,a]of e)if((a.selected||a.id===i)&&(!a.parentId||!LNe(a,e))&&(a.draggable||t&&typeof a.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 kL({nodeId:e,dragItems:t,nodeLookup:n,dragging:i=!0}){var a,l,c;const r=[];for(const[u,d]of t){const f=(a=n.get(u))==null?void 0:a.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 Lmt({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},a=zC(s,t);return{x:a.x-s.x,y:a.y-s.y}}function $mt({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:i,onDragStop:r}){let s={x:null,y:null},a=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=qc(O);function E({x:T,y:R}){const{nodeLookup:_,nodeExtent:D,snapGrid:M,snapToGrid:P,nodeOrigin:L,onNodeDrag:F,onSelectionDrag:I,onError:z,updateNodePositions:K}=t();s={x:T,y:R};let B=!1;const W=l.size>1,H=W&&D?HF(QC(l)):null,X=W&&P?Lmt({dragItems:l,snapGrid:M,x:T,y:R}):null;for(const[ie,Q]of l){if(!_.has(ie))continue;let Z={x:T-Q.distance.x,y:R-Q.distance.y};P&&(Z=X?{x:Math.round(Z.x+X.x),y:Math.round(Z.y+X.y)}:zC(Z,M));let ue=null;if(W&&D&&!Q.extent&&H){const{positionAbsolute:G}=Q.internals,te=G.x-H.x+D[0][0],de=G.x+Q.measured.width-H.x2+D[1][0],Ce=G.y-H.y+D[0][1],le=G.y+Q.measured.height-H.y2+D[1][1];ue=[[te,Ce],[de,le]]}const{position:Ee,positionAbsolute:Y}=ONe({nodeId:ie,nextPosition:Z,nodeLookup:_,nodeExtent:ue||D,nodeOrigin:L,onError:z});B=B||Q.position.x!==Ee.x||Q.position.y!==Ee.y,Q.position=Ee,Q.internals.positionAbsolute=Y}if(g=g||B,!!B&&(K(l,!0),b&&(i||F||!k&&I))){const[ie,Q]=kL({nodeId:k,dragItems:l,nodeLookup:_});i==null||i(b,l,ie,Q),F==null||F(b,ie,Q),k||I==null||I(b,Q)}}async function N(){if(!d)return;const{transform:T,panBy:R,autoPanSpeed:_,autoPanOnNodeDrag:D}=t();if(!D){c=!1,cancelAnimationFrame(a);return}const[M,P]=pz(u,d,_);(M!==0||P!==0)&&(s.x=(s.x??0)-M/T[2],s.y=(s.y??0)-P/T[2],await R({x:M,y:P})&&E(s)),a=requestAnimationFrame(N)}function A(T){var W;const{nodeLookup:R,multiSelectionActive:_,nodesDraggable:D,transform:M,snapGrid:P,snapToGrid:L,selectNodesOnDrag:F,onNodeDragStart:I,onSelectionDragStart:z,unselectNodesAndEdges:K}=t();f=!0,(!F||!S)&&!_&&k&&((W=R.get(k))!=null&&W.selected||K()),S&&F&&k&&(e==null||e(k));const B=Wk(T.sourceEvent,{transform:M,snapGrid:P,snapToGrid:L,containerBounds:d});if(s=B,l=Mmt(R,D,B,k),l.size>0&&(n||I||!k&&z)){const[H,X]=kL({nodeId:k,dragItems:l,nodeLookup:R});n==null||n(T.sourceEvent,l,H,X),I==null||I(T.sourceEvent,H,X),k||z==null||z(T.sourceEvent,X)}}const j=eNe().clickDistance(C).on("start",T=>{const{domNode:R,nodeDragThreshold:_,transform:D,snapGrid:M,snapToGrid:P}=t();d=(R==null?void 0:R.getBoundingClientRect())||null,m=!1,g=!1,b=T.sourceEvent,_===0&&A(T),s=Wk(T.sourceEvent,{transform:D,snapGrid:M,snapToGrid:P,containerBounds:d}),u=Ed(T.sourceEvent,d)}).on("drag",T=>{const{autoPanOnNodeDrag:R,transform:_,snapGrid:D,snapToGrid:M,nodeDragThreshold:P,nodeLookup:L}=t(),F=Wk(T.sourceEvent,{transform:_,snapGrid:D,snapToGrid:M,containerBounds:d});if(b=T.sourceEvent,(T.sourceEvent.type==="touchmove"&&T.sourceEvent.touches.length>1||k&&!L.has(k))&&(m=!0),!m){if(!c&&R&&f&&(c=!0,N()),!f){const I=Ed(T.sourceEvent,d),z=I.x-u.x,K=I.y-u.y;Math.sqrt(z*z+K*K)>P&&A(T)}(s.x!==F.xSnapped||s.y!==F.ySnapped)&&l&&f&&(u=Ed(T.sourceEvent,d),E(F))}}).on("end",T=>{if(!f||m){m&&l.size>0&&t().updateNodePositions(l,!1);return}if(c=!1,f=!1,cancelAnimationFrame(a),l.size>0){const{nodeLookup:R,updateNodePositions:_,onNodeDragStop:D,onSelectionDragStop:M}=t();if(g&&(_(l,!1),g=!1),r||D||!k&&M){const[P,L]=kL({nodeId:k,dragItems:l,nodeLookup:R,dragging:!1});r==null||r(T.sourceEvent,l,P,L),D==null||D(T.sourceEvent,P,L),k||M==null||M(T.sourceEvent,L)}}}).filter(T=>{const R=T.target;return!T.button&&(!x||!mJ(R,`.${x}`,O))&&(!w||mJ(R,w,O))});h.call(j)}function y(){h==null||h.on(".drag",null)}return{update:v,destroy:y}}function Fmt(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())dE(r,sw(s))>0&&i.push(s);return i}const Bmt=250;function Umt(e,t,n,i){var l,c;let r=[],s=1/0;const a=Fmt(e,n,t+Bmt);for(const u of a){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}=Cy(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 $Ne(e,t,n,i,r,s=!1){var u,d,f;const a=i.get(e);if(!a)return null;const l=r==="strict"?(u=a.internals.handleBounds)==null?void 0:u[t]:[...((d=a.internals.handleBounds)==null?void 0:d.source)??[],...((f=a.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,...Cy(a,c,c.position,!0)}:c}function FNe(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Qmt(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const BNe=()=>!0;function zmt(e,{connectionMode:t,connectionRadius:n,handleId:i,nodeId:r,edgeUpdaterType:s,isTarget:a,domNode:l,nodeLookup:c,lib:u,autoPanOnConnect:d,flowId:f,panBy:h,cancelConnection:m,onConnectStart:g,onConnect:b,onConnectEnd:v,isValidConnection:y=BNe,onReconnectEnd:x,updateConnection:w,getTransform:O,getFromHandle:S,autoPanSpeed:k,dragThreshold:C=1,handleDomNode:E}){const N=TNe(e.target);let A=0,j;const{x:T,y:R}=Ed(e),_=FNe(s,E),D=l==null?void 0:l.getBoundingClientRect();let M=!1;if(!D||!_)return;const P=$Ne(r,_,i,c,t);if(!P)return;let L=Ed(e,D),F=!1,I=null,z=!1,K=null;function B(){if(!d||!D)return;const[Ee,Y]=pz(L,D,k);h({x:Ee,y:Y}),A=requestAnimationFrame(B)}const W={...P,nodeId:r,type:_,position:P.position},H=c.get(r);let ie={inProgress:!0,isValid:null,from:Cy(H,W,pn.Left,!0),fromHandle:W,fromPosition:W.position,fromNode:H,to:L,toHandle:null,toPosition:iJ[W.position],toNode:null,pointer:L};function Q(){M=!0,w(ie),g==null||g(e,{nodeId:r,handleId:i,handleType:_})}C===0&&Q();function Z(Ee){if(!M){const{x:le,y:fe}=Ed(Ee),re=le-T,Oe=fe-R;if(!(re*re+Oe*Oe>C*C))return;Q()}if(!S()||!W){ue(Ee);return}const Y=O();L=Ed(Ee,D),j=Umt(Yw(L,Y,!1,[1,1]),n,c,W),F||(B(),F=!0);const G=UNe(Ee,{handle:j,connectionMode:t,fromNodeId:r,fromHandleId:i,fromType:a?"target":"source",isValidConnection:y,doc:N,lib:u,flowId:f,nodeLookup:c});K=G.handleDomNode,I=G.connection,z=Qmt(!!j,G.isValid);const te=c.get(r),de=te?Cy(te,W,pn.Left,!0):ie.from,Ce={...ie,from:de,isValid:z,to:G.toHandle&&z?ow({x:G.toHandle.x,y:G.toHandle.y},Y):L,toHandle:G.toHandle,toPosition:z&&G.toHandle?G.toHandle.position:iJ[W.position],toNode:G.toHandle?c.get(G.toHandle.nodeId):null,pointer:L};w(Ce),ie=Ce}function ue(Ee){if(!("touches"in Ee&&Ee.touches.length>0)){if(M){(j||K)&&I&&z&&(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(A),F=!1,z=!1,I=null,K=null,N.removeEventListener("mousemove",Z),N.removeEventListener("mouseup",ue),N.removeEventListener("touchmove",Z),N.removeEventListener("touchend",ue)}}N.addEventListener("mousemove",Z),N.addEventListener("mouseup",ue),N.addEventListener("touchmove",Z),N.addEventListener("touchend",ue)}function UNe(e,{handle:t,connectionMode:n,fromNodeId:i,fromHandleId:r,fromType:s,doc:a,lib:l,flowId:c,isValidConnection:u=BNe,nodeLookup:d}){const f=s==="target",h=t?a.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}=Ed(e),b=a.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=FNe(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 N=S&&k&&(n===iw.Strict?f&&x==="source"||!f&&x==="target":w!==i||O!==r);y.isValid=N&&u(C),y.toHandle=$Ne(w,x,O,d,n,!0)}return y}const KF={onPointerDown:zmt,isValid:UNe};function Vmt({domNode:e,panZoom:t,getTransform:n,getViewScale:i}){const r=qc(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&&fE()?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},N=[[0,0],[c,u]];t.setViewportConstrained({x:E.x,y:E.y,zoom:O[2]},N,l)},x=gNe().on("start",v).on("zoom",f?y:null).on("zoom.wheel",h?g:null);r.call(x,{})}function a(){r.on("zoom",null)}return{update:s,destroy:a,pointer:yd}}const $P=e=>({x:e.x,y:e.y,zoom:e.k}),SL=({x:e,y:t,zoom:n})=>DP.translate(e,t).scale(n),Mv=(e,t)=>e.target.closest(`.${t}`),QNe=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Hmt=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,EL=(e,t=0,n=Hmt,i=()=>{})=>{const r=typeof t=="number"&&t>0;return r||i(),r?e.transition().duration(t).ease(n).on("end",i):e},zNe=e=>{const t=e.ctrlKey&&fE()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function qmt({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:i,panOnScrollMode:r,panOnScrollSpeed:s,zoomOnPinch:a,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:u}){return d=>{if(Mv(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(d.ctrlKey&&a){const v=yd(d),y=zNe(d),x=f*Math.pow(2,y);i.scaleTo(n,x,v,d);return}const h=d.deltaMode===1?20:1;let m=r===iy.Vertical?0:d.deltaX*h,g=r===iy.Horizontal?0:d.deltaY*h;!fE()&&d.shiftKey&&r!==iy.Vertical&&(m=d.deltaY*h,g=0),i.translateBy(n,-(m/f)*s,-(g/f)*s,{internal:!0});const b=$P(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 Wmt({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(i,r){const s=i.type==="wheel",a=!t&&s&&!i.ctrlKey,l=Mv(i,e);if(i.ctrlKey&&s&&l&&i.preventDefault(),a||l)return null;i.preventDefault(),n.call(this,i,r)}}function Kmt({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return i=>{var s,a,l;if((s=i.sourceEvent)!=null&&s.internal)return;const r=$P(i.transform);e.mouseButton=((a=i.sourceEvent)==null?void 0:a.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 Gmt({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:i,onPanZoom:r}){return s=>{var a,l;e.usedRightMouseButton=!!(n&&QNe(t,e.mouseButton??0)),(a=s.sourceEvent)!=null&&a.sync||i([s.transform.x,s.transform.y,s.transform.k]),r&&!((l=s.sourceEvent)!=null&&l.internal)&&(r==null||r(s.sourceEvent,$P(s.transform)))}}function Xmt({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:i,onPanZoomEnd:r,onPaneContextMenu:s}){return a=>{var l;if(!((l=a.sourceEvent)!=null&&l.internal)&&(e.isZoomingOrPanning=!1,s&&QNe(t,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&s(a.sourceEvent),e.usedRightMouseButton=!1,i(!1),r)){const c=$P(a.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r==null||r(a.sourceEvent,c)},n?150:0)}}}function Ymt({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:i,panOnScroll:r,zoomOnDoubleClick:s,userSelectionActive:a,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"&&(Mv(f,`${u}-flow__node`)||Mv(f,`${u}-flow__edge`)))return!0;if(!i&&!h&&!r&&!s&&!n||a||d&&!g||Mv(f,l)&&g||Mv(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 Zmt({domNode:e,minZoom:t,maxZoom:n,translateExtent:i,viewport:r,onPanZoom:s,onPanZoomStart:a,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=gNe().scaleExtent([t,n]).translateExtent(i),h=qc(e).call(f);x({x:r.x,y:r.y,zoom:rw(r.zoom,t,n)},[[0,0],[d.width,d.height]],i);const m=h.on("wheel.zoom"),g=h.on("dblclick.zoom");f.wheelDelta(zNe);async function b(j,T){return h?new Promise(R=>{f==null||f.interpolate((T==null?void 0:T.interpolate)==="linear"?qk:Y_).transform(EL(h,T==null?void 0:T.duration,T==null?void 0:T.ease,()=>R(!0)),j)}):!1}function v({noWheelClassName:j,noPanClassName:T,onPaneContextMenu:R,userSelectionActive:_,panOnScroll:D,panOnDrag:M,panOnScrollMode:P,panOnScrollSpeed:L,preventScrolling:F,zoomOnPinch:I,zoomOnScroll:z,zoomOnDoubleClick:K,zoomActivationKeyPressed:B,lib:W,onTransformChange:H,connectionInProgress:X,paneClickDistance:ie,selectionOnDrag:Q}){_&&!u.isZoomingOrPanning&&y();const Z=D&&!B&&!_;f.clickDistance(Q?1/0:!Sd(ie)||ie<0?0:ie);const ue=Z?qmt({zoomPanValues:u,noWheelClassName:j,d3Selection:h,d3Zoom:f,panOnScrollMode:P,panOnScrollSpeed:L,zoomOnPinch:I,onPanZoomStart:a,onPanZoom:s,onPanZoomEnd:l}):Wmt({noWheelClassName:j,preventScrolling:F,d3ZoomHandler:m});h.on("wheel.zoom",ue,{passive:!1});const Ee=Kmt({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:a});f.on("start",Ee);const Y=Gmt({zoomPanValues:u,panOnDrag:M,onPaneContextMenu:!!R,onPanZoom:s,onTransformChange:H});f.on("zoom",Y);const G=Xmt({zoomPanValues:u,panOnDrag:M,panOnScroll:D,onPaneContextMenu:R,onPanZoomEnd:l,onDraggingChange:c});f.on("end",G);const te=Ymt({zoomActivationKeyPressed:B,panOnDrag:M,zoomOnScroll:z,panOnScroll:D,zoomOnDoubleClick:K,zoomOnPinch:I,userSelectionActive:_,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,R){const _=SL(j),D=f==null?void 0:f.constrain()(_,T,R);return D&&await b(D),D}async function w(j,T){const R=SL(j);return await b(R,T),R}function O(j){if(h){const T=SL(j),R=h.property("__zoom");(R.k!==j.zoom||R.x!==j.x||R.y!==j.y)&&(f==null||f.transform(h,T,null,{sync:!0}))}}function S(){const j=h?mNe(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(R=>{f==null||f.interpolate((T==null?void 0:T.interpolate)==="linear"?qk:Y_).scaleTo(EL(h,T==null?void 0:T.duration,T==null?void 0:T.ease,()=>R(!0)),j)}):!1}async function C(j,T){return h?new Promise(R=>{f==null||f.interpolate((T==null?void 0:T.interpolate)==="linear"?qk:Y_).scaleBy(EL(h,T==null?void 0:T.duration,T==null?void 0:T.ease,()=>R(!0)),j)}):!1}function E(j){f==null||f.scaleExtent(j)}function N(j){f==null||f.translateExtent(j)}function A(j){const T=!Sd(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:N,syncViewport:O,setClickDistance:A}}var aw;(function(e){e.Line="line",e.Handle="handle"})(aw||(aw={}));function Jmt({width:e,prevWidth:t,height:n,prevHeight:i,affectsX:r,affectsY:s}){const a=e-t,l=n-i,c=[a>0?1:a<0?-1:0,l>0?1:l<0?-1:0];return a&&r&&(c[0]=c[0]*-1),l&&s&&(c[1]=c[1]*-1),c}function gJ(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 Gp(e,t){return Math.max(0,t-e)}function Xp(e,t){return Math.max(0,e-t)}function Y2(e,t,n){return Math.max(0,t-e,e-n)}function bJ(e,t){return e?!t:t}function egt(e,t,n,i,r,s,a,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),N=Math.floor(f?g-e.pointerY:0);const A=S+(c?-E:E),j=k+(u?-N:N),T=-s[0]*S,R=-s[1]*k;let _=Y2(A,b,v),D=Y2(j,y,x);if(a){let L=0,F=0;c&&E<0?L=Gp(w+E+T,a[0][0]):!c&&E>0&&(L=Xp(w+A+T,a[1][0])),u&&N<0?F=Gp(O+N+R,a[0][1]):!u&&N>0&&(F=Xp(O+j+R,a[1][1])),_=Math.max(_,L),D=Math.max(D,F)}if(l){let L=0,F=0;c&&E>0?L=Xp(w+E,l[0][0]):!c&&E<0&&(L=Gp(w+A,l[1][0])),u&&N>0?F=Xp(O+N,l[0][1]):!u&&N<0&&(F=Gp(O+j,l[1][1])),_=Math.max(_,L),D=Math.max(D,F)}if(r){if(d){const L=Y2(A/C,y,x)*C;if(_=Math.max(_,L),a){let F=0;!c&&!u||c&&!u&&h?F=Xp(O+R+A/C,a[1][1])*C:F=Gp(O+R+(c?E:-E)/C,a[0][1])*C,_=Math.max(_,F)}if(l){let F=0;!c&&!u||c&&!u&&h?F=Gp(O+A/C,l[1][1])*C:F=Xp(O+(c?E:-E)/C,l[0][1])*C,_=Math.max(_,F)}}if(f){const L=Y2(j*C,b,v)/C;if(D=Math.max(D,L),a){let F=0;!c&&!u||u&&!c&&h?F=Xp(w+j*C+T,a[1][0])/C:F=Gp(w+(u?N:-N)*C+T,a[0][0])/C,D=Math.max(D,F)}if(l){let F=0;!c&&!u||u&&!c&&h?F=Gp(w+j*C,l[1][0])/C:F=Xp(w+(u?N:-N)*C,l[0][0])/C,D=Math.max(D,F)}}}N=N+(N<0?D:-D),E=E+(E<0?_:-_),r&&(h?A>j*C?N=(bJ(c,u)?-E:E)/C:E=(bJ(c,u)?-N:N)*C:d?(N=E/C,u=c):(E=N*C,c=u));const M=c?w+E:w,P=u?O+N:O;return{width:S+(c?-E:E),height:k+(u?-N:N),x:s[0]*E*(c?-1:1)+M,y:s[1]*N*(u?-1:1)+P}}const VNe={width:0,height:0,x:0,y:0},tgt={...VNe,pointerX:0,pointerY:0,aspectRatio:1};function ngt(e,t,n){const i=t.position.x+e.position.x,r=t.position.y+e.position.y,s=e.measured.width??0,a=e.measured.height??0,l=n[0]*s,c=n[1]*a;return[[i-l,r-c],[i+s-l,r+a-c]]}function igt({domNode:e,nodeId:t,getStoreItems:n,onChange:i,onEnd:r}){const s=qc(e);let a={controlDirection:gJ("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={...VNe},x={...tgt};a={boundaries:d,resizeDirection:h,keepAspectRatio:f,controlDirection:gJ(u)};let w,O=null,S=[],k,C,E,N=!1;const A=eNe().on("start",j=>{const{nodeLookup:T,transform:R,snapGrid:_,snapToGrid:D,nodeOrigin:M,paneDomNode:P}=n();if(w=T.get(t),!w)return;O=(P==null?void 0:P.getBoundingClientRect())??null;const{xSnapped:L,ySnapped:F}=Wk(j.sourceEvent,{transform:R,snapGrid:_,snapToGrid:D,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:F,aspectRatio:y.width/y.height},k=void 0,C=Ey(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,z]of T)if(z.parentId===t&&(S.push({id:I,position:{...z.position},extent:z.extent}),z.extent==="parent"||z.expandParent)){const K=ngt(z,w,z.origin??M);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:R,snapToGrid:_,nodeOrigin:D}=n(),M=Wk(j.sourceEvent,{transform:T,snapGrid:R,snapToGrid:_,containerBounds:O}),P=[];if(!w)return;const{x:L,y:F,width:I,height:z}=y,K={},B=w.origin??D,{width:W,height:H,x:X,y:ie}=egt(x,a.controlDirection,M,a.boundaries,a.keepAspectRatio,B,C,E),Q=W!==I,Z=H!==z,ue=X!==L&&Q,Ee=ie!==F&&Z;if(!ue&&!Ee&&!Q&&!Z)return;if((ue||Ee||B[0]===1||B[1]===1)&&(K.x=ue?X:y.x,K.y=Ee?ie:y.y,y.x=K.x,y.y=K.y,S.length>0)){const de=X-L,Ce=ie-F;for(const le of S)le.position={x:le.position.x-de+B[0]*(W-I),y:le.position.y-Ce+B[1]*(H-z)},P.push(le)}if((Q||Z)&&(K.width=Q&&(!a.resizeDirection||a.resizeDirection==="horizontal")?W:y.width,K.height=Z&&(!a.resizeDirection||a.resizeDirection==="vertical")?H:y.height,y.width=K.width,y.height=K.height),k&&w.expandParent){const de=B[0]*(K.width??0);K.x&&K.x{N&&(b==null||b(j,{...y}),r==null||r({...y}),N=!1)});s.call(A)}function c(){s.on(".drag",null)}return{update:l,destroy:c}}const rgt={},yJ=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:()=>{(rgt?"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},sgt=e=>e?yJ(e):yJ,{useDebugValue:ogt}=pi,{useSyncExternalStoreWithSelector:agt}=RJe,lgt=e=>e;function HNe(e,t=lgt,n){const i=agt(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return ogt(i),i}const vJ=(e,t)=>{const n=sgt(e),i=(r,s=t)=>HNe(n,r,s);return Object.assign(i,n),i},cgt=(e,t)=>e?vJ(e,t):vJ;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 FP=p.createContext(null),ugt=FP.Provider,qNe=Dd.error001("react");function zi(e,t){const n=p.useContext(FP);if(n===null)throw new Error(qNe);return HNe(n,e,t)}function _s(){const e=p.useContext(FP);if(e===null)throw new Error(qNe);return p.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const xJ={display:"none"},dgt={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},WNe="react-flow__node-desc",KNe="react-flow__edge-desc",fgt="react-flow__aria-live",hgt=e=>e.ariaLiveMessage,pgt=e=>e.ariaLabelConfig;function mgt({rfId:e}){const t=zi(hgt);return o.jsx("div",{id:`${fgt}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:dgt,children:t})}function ggt({rfId:e,disableKeyboardA11y:t}){const n=zi(pgt);return o.jsxs(o.Fragment,{children:[o.jsx("div",{id:`${WNe}-${e}`,style:xJ,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),o.jsx("div",{id:`${KNe}-${e}`,style:xJ,children:n["edge.a11yDescription.default"]}),!t&&o.jsx(mgt,{rfId:e})]})}const BP=p.forwardRef(({position:e="top-left",children:t,className:n,style:i,...r},s)=>{const a=`${e}`.split("-");return o.jsx("div",{className:Fo(["react-flow__panel",n,...a]),style:i,ref:s,...r,children:t})});BP.displayName="Panel";function bgt({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:o.jsx(BP,{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:o.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const ygt=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}},Z2=e=>e.id;function vgt(e,t){return As(e.selectedNodes.map(Z2),t.selectedNodes.map(Z2))&&As(e.selectedEdges.map(Z2),t.selectedEdges.map(Z2))}function xgt({onSelectionChange:e}){const t=_s(),{selectedNodes:n,selectedEdges:i}=zi(ygt,vgt);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 wgt=e=>!!e.onSelectionChangeHandlers;function Ogt({onSelectionChange:e}){const t=zi(wgt);return e||t?o.jsx(xgt,{onSelectionChange:e}):null}const GNe=[0,0],kgt={x:0,y:0,zoom:1},Sgt=["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"],wJ=[...Sgt,"rfId"],Egt=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}),OJ={translateExtent:lE,nodeOrigin:GNe,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Cgt(e){const{setNodes:t,setEdges:n,setMinZoom:i,setMaxZoom:r,setTranslateExtent:s,setNodeExtent:a,reset:l,setDefaultNodesAndEdges:c}=zi(Egt,As),u=_s();p.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{d.current=OJ,l()}),[]);const d=p.useRef(OJ);return p.useEffect(()=>{for(const f of wJ){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"?a(h):f==="ariaLabelConfig"?u.setState({ariaLabelConfig:gmt(h)}):f==="fitView"?u.setState({fitViewQueued:h}):f==="fitViewOptions"?u.setState({fitViewOptions:h}):u.setState({[f]:h})))}d.current=e},wJ.map(f=>e[f])),null}function kJ(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Tgt(e){var i;const[t,n]=p.useState(e==="system"?null:e);return p.useEffect(()=>{if(e!=="system"){n(e);return}const r=kJ(),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=kJ())!=null&&i.matches?"dark":"light"}const SJ=typeof document<"u"?document:null;function hE(e=null,t={target:SJ,actInsideInputWithModifier:!0}){const[n,i]=p.useState(!1),r=p.useRef(!1),s=p.useRef(new Set([])),[a,l]=p.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace("+",` +`)},_ot=0,F0=[];function jot(e){var t=p.useRef([]),n=p.useRef([0,0]),i=p.useRef(),r=p.useState(_ot++)[0],s=p.useState(u_e)[0],a=p.useRef(e);p.useEffect(function(){a.current=e},[e]),p.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(r));var b=Yst([e.lockRef.current],(e.shards||[]).map(AZ),!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!a.current.allowPinchZoom;var y=B2(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(),N=E&&E.anchorNode,A=N?N===k||N.contains(k):!1;if(A)return!1;var j=CZ(C,k);if(!j)return!0;if(j?S=C:(S=C==="v"?"h":"v",j=CZ(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 Cot(T,v,b,T==="h"?w:O)},[]),c=p.useCallback(function(b){var v=b;if(!(!F0.length||F0[F0.length-1]!==s)){var y="deltaY"in v?TZ(v):B2(v),x=t.current.filter(function(S){return S.name===v.type&&(S.target===v.target||v.target===S.shadowParent)&&Tot(S.delta,y)})[0];if(x&&x.should){v.cancelable&&v.preventDefault();return}if(!x){var w=(a.current.shards||[]).map(AZ).filter(Boolean).filter(function(S){return S.contains(v.target)}),O=w.length>0?l(v,w[0]):!a.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:Not(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=B2(b),i.current=void 0},[]),f=p.useCallback(function(b){u(b.type,TZ(b),b.target,l(b,e.lockRef.current))},[]),h=p.useCallback(function(b){u(b.type,B2(b),b.target,l(b,e.lockRef.current))},[]);p.useEffect(function(){return F0.push(s),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",c,$0),document.addEventListener("touchmove",c,$0),document.addEventListener("touchstart",d,$0),function(){F0=F0.filter(function(b){return b!==s}),document.removeEventListener("wheel",c,$0),document.removeEventListener("touchmove",c,$0),document.removeEventListener("touchstart",d,$0)}},[]);var m=e.removeScrollBar,g=e.inert;return p.createElement(p.Fragment,null,g?p.createElement(s,{styles:Aot(r)}):null,m?p.createElement(vot,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Not(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Rot=oot(c_e,jot);var RQ=p.forwardRef(function(e,t){return p.createElement(xP,pf({},e,{ref:t,sideCar:Rot}))});RQ.classNames=xP.classNames;var Iot=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},B0=new WeakMap,U2=new WeakMap,Q2={},mL=0,p_e=function(e){return e&&(e.host||p_e(e.parentNode))},Pot=function(e,t){return t.map(function(n){if(e.contains(n))return n;var i=p_e(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})},Dot=function(e,t,n,i){var r=Pot(t,Array.isArray(e)?e:[e]);Q2[n]||(Q2[n]=new WeakMap);var s=Q2[n],a=[],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=(B0.get(h)||0)+1,v=(s.get(h)||0)+1;B0.set(h,b),s.set(h,v),a.push(h),b===1&&g&&U2.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(),mL++,function(){a.forEach(function(f){var h=B0.get(f)-1,m=s.get(f)-1;B0.set(f,h),s.set(f,m),h||(U2.has(f)||f.removeAttribute(i),U2.delete(f)),m||f.removeAttribute(n)}),mL--,mL||(B0=new WeakMap,B0=new WeakMap,U2=new WeakMap,Q2={})}},m_e=function(e,t,n){n===void 0&&(n="data-aria-hidden");var i=Array.from(Array.isArray(e)?e:[e]),r=Iot(e);return r?(i.push.apply(i,Array.from(r.querySelectorAll("[aria-live], script"))),Dot(i,r,n,"aria-hidden")):function(){return null}},Mot=Object.defineProperty,Lot=(e,t)=>Mot(e,"name",{value:t,configurable:!0});function IC(e){const[t,n]=p.useState(void 0);return Hu(()=>{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 a,l;if("borderBoxSize"in s){const c=s.borderBoxSize,u=Array.isArray(c)?c[0]:c;a=u.inlineSize,l=u.blockSize}else a=e.offsetWidth,l=e.offsetHeight;n({width:a,height:l})});return i.observe(e,{box:"border-box"}),()=>i.unobserve(e)}else n(void 0)},[e]),t}Lot(IC,"useSize");var $ot=Object.defineProperty,fp=(e,t)=>$ot(e,"name",{value:t,configurable:!0}),IQ="Checkbox",[Fot,tcn]=gc(IQ),[Bot,PQ]=Fot(IQ);function g_e(e){const{__scopeCheckbox:t,checked:n,children:i,defaultChecked:r,disabled:s,form:a,name:l,onCheckedChange:c,required:u,value:d="on",internal_do_not_use_render:f}=e,[h,m]=ed({prop:n,defaultProp:r??!1,onChange:c,caller:IQ}),[g,b]=p.useState(null),[v,y]=p.useState(null),x=p.useRef(!1),[w,O]=p.useReducer(C=>C+1,0),S=g?!!a||!!g.closest("form"):!0,k={checked:h,disabled:s,setChecked:m,control:g,setControl:b,name:l,form:a,value:d,hasConsumerStoppedPropagationRef:x,userInteractionCount:w,onUserInteraction:O,required:u,defaultChecked:Xh(r)?!1:r,isFormControl:S,bubbleInput:v,setBubbleInput:y};return o.jsx(Bot,{scope:t,...k,children:b_e(f)?f(k):i})}fp(g_e,"CheckboxProvider");var Uot="CheckboxTrigger",Qot=p.forwardRef(fp(function({__scopeCheckbox:t,onKeyDown:n,onClick:i,...r},s){const{control:a,value:l,disabled:c,checked:u,required:d,setControl:f,setChecked:h,hasConsumerStoppedPropagationRef:m,onUserInteraction:g,isFormControl:b,bubbleInput:v}=PQ(Uot,t),y=pr(s,f),x=p.useRef(u);return p.useEffect(()=>{const w=a==null?void 0:a.form;if(w){const O=fp(()=>h(x.current),"reset");return w.addEventListener("reset",O),()=>w.removeEventListener("reset",O)}},[a,h]),o.jsx(Mr.button,{type:"button",role:"checkbox","aria-checked":Xh(u)?"mixed":u,"aria-required":d,"data-state":DQ(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=>Xh(O)?!0:!O),v&&b&&(m.current=w.isPropagationStopped(),m.current||w.stopPropagation())})})},"CheckboxTrigger")),zot=p.forwardRef(fp(function(t,n){const{__scopeCheckbox:i,name:r,checked:s,defaultChecked:a,required:l,disabled:c,value:u,onCheckedChange:d,form:f,...h}=t;return o.jsx(g_e,{__scopeCheckbox:i,checked:s,defaultChecked:a,disabled:c,required:l,onCheckedChange:d,name:r,form:f,value:u,internal_do_not_use_render:({isFormControl:m})=>o.jsxs(o.Fragment,{children:[o.jsx(Qot,{...h,ref:n,__scopeCheckbox:i}),m&&o.jsx(Wot,{__scopeCheckbox:i})]})})},"Checkbox")),Vot="CheckboxIndicator",Hot=p.forwardRef(fp(function(t,n){const{__scopeCheckbox:i,forceMount:r,...s}=t,a=PQ(Vot,i);return o.jsx(Hf,{present:r||Xh(a.checked)||a.checked===!0,children:o.jsx(Mr.span,{"data-state":DQ(a.checked),"data-disabled":a.disabled?"":void 0,...s,ref:n,style:{pointerEvents:"none",...t.style}})})},"CheckboxIndicator")),qot="CheckboxBubbleInput",Wot=p.forwardRef(fp(function({__scopeCheckbox:t,onClick:n,...i},r){const{control:s,hasConsumerStoppedPropagationRef:a,userInteractionCount:l,checked:c,defaultChecked:u,required:d,disabled:f,name:h,value:m,form:g,bubbleInput:b,setBubbleInput:v}=PQ(qot,t),y=pr(r,v),x=IC(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,A=Object.getOwnPropertyDescriptor(E,"checked").set,j=l!==S.current;S.current=l;const T=O.current!==c;O.current=c;const R=!(j&&a.current);if(T&&A){w.current=!j;const _=new Event("click",{bubbles:R});C.indeterminate=Xh(c),A.call(C,Xh(c)?!1:c),C.dispatchEvent(_),w.current=!1}},[b,c,a,l]);const k=p.useRef(Xh(c)?!1:c);return o.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 b_e(e){return typeof e=="function"}fp(b_e,"isFunction");function Xh(e){return e==="indeterminate"}fp(Xh,"isIndeterminate");function DQ(e){return Xh(e)?"indeterminate":e?"checked":"unchecked"}fp(DQ,"getState");var Kot=Object.defineProperty,Vm=(e,t)=>Kot(e,"name",{value:t,configurable:!0}),y_e="Popper",[v_e,qw]=gc(y_e),[Got,x_e]=v_e(y_e),Xot=Vm(e=>{const{__scopePopper:t,children:n}=e,[i,r]=p.useState(null),[s,a]=p.useState(void 0);return o.jsx(Got,{scope:t,anchor:i,onAnchorChange:r,placementState:s,setPlacementState:a,children:n})},"Popper"),Yot="PopperAnchor",Zot=p.forwardRef(Vm(function(t,n){const{__scopePopper:i,virtualRef:r,...s}=t,a=x_e(Yot,i),l=p.useRef(null),c=a.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=a.placementState&&wP(a.placementState),m=h==null?void 0:h[0],g=h==null?void 0:h[1];return r?null:o.jsx(Mr.div,{"data-radix-popper-side":m,"data-radix-popper-align":g,...s,ref:d})},"PopperAnchor")),w_e="PopperContent",[Jot,ncn]=v_e(w_e),eat=p.forwardRef(Vm(function(t,n){var Z,ue,Ee,Y,G,te,de;const{__scopePopper:i,side:r="bottom",sideOffset:s=0,align:a="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=x_e(w_e,i),[x,w]=p.useState(null),O=pr(n,w),[S,k]=p.useState(null),C=IC(S),E=(C==null?void 0:C.width)??0,N=(C==null?void 0:C.height)??0,A=r+(a!=="center"?"-"+a:""),j=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},T=Array.isArray(d)?d:[d],R=T.length>0,_={padding:j,boundary:T.filter(O_e),altBoundary:R},{refs:D,floatingStyles:M,placement:P,isPositioned:L,middlewareData:F}=x2e({strategy:"fixed",placement:A,whileElementsMounted:Vm((...Ce)=>fF(...Ce,{animationFrame:g==="always"}),"whileElementsMounted"),elements:{reference:y.anchor},middleware:[w2e({mainAxis:s+N,alignmentAxis:l}),u&&O2e({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?k2e():void 0,..._}),u&&S2e({..._}),E2e({..._,apply:Vm(({elements:Ce,rects:le,availableWidth:fe,availableHeight:re})=>{const{width:Oe,height:Pe}=le.reference,be=Ce.floating.style;be.setProperty("--radix-popper-available-width",`${fe}px`),be.setProperty("--radix-popper-available-height",`${re}px`),be.setProperty("--radix-popper-anchor-width",`${Oe}px`),be.setProperty("--radix-popper-anchor-height",`${Pe}px`)},"apply")}),S&&ynt({element:S,padding:c}),tat({arrowWidth:E,arrowHeight:N}),m&&bnt({strategy:"referenceHidden",..._,boundary:R?_.boundary:void 0})]}),I=y.setPlacementState;Hu(()=>(I(P),()=>{I(void 0)}),[P,I]);const[z,K]=wP(P),B=Pd(b);Hu(()=>{L&&(B==null||B())},[L,B]);const W=(Z=F.arrow)==null?void 0:Z.x,H=(ue=F.arrow)==null?void 0:ue.y,X=((Ee=F.arrow)==null?void 0:Ee.centerOffset)!==0,[ie,Q]=p.useState();return Hu(()=>{x&&Q(window.getComputedStyle(x).zIndex)},[x]),o.jsx("div",{ref:D.setFloating,"data-radix-popper-content-wrapper":"",style:{...M,transform:L?M.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ie,"--radix-popper-transform-origin":[(Y=F.transformOrigin)==null?void 0:Y.x,(G=F.transformOrigin)==null?void 0:G.y].join(" "),...((te=F.hide)==null?void 0:te.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:o.jsx(Jot,{scope:i,placedSide:z,placedAlign:K,onArrowChange:k,arrowX:W,arrowY:H,shouldHideArrow:X,children:o.jsx(Mr.div,{"data-side":z,"data-align":K,...v,ref:O,style:{...v.style,animation:L?(de=v.style)==null?void 0:de.animation:"none"}})})})},"PopperContent"));function O_e(e){return e!==null}Vm(O_e,"isNotNull");var tat=Vm(e=>({name:"transformOrigin",options:e,fn(t){var v,y,x;const{placement:n,rects:i,middlewareData:r}=t,a=((v=r.arrow)==null?void 0:v.centerOffset)!==0,l=a?0:e.arrowWidth,c=a?0:e.arrowHeight,[u,d]=wP(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=a?f:`${h}px`,b=`${-c}px`):u==="top"?(g=a?f:`${h}px`,b=`${i.floating.height+c}px`):u==="right"?(g=`${-c}px`,b=a?f:`${m}px`):u==="left"&&(g=`${i.floating.width+c}px`,b=a?f:`${m}px`),{data:{x:g,y:b}}}}),"transformOrigin");function wP(e){const[t,n="center"]=e.split("-");return[t,n]}Vm(wP,"getSideAndAlignFromPlacement");var OP=Xot,MQ=Zot,LQ=eat,nat=Object.defineProperty,$Q=(e,t)=>nat(e,"name",{value:t,configurable:!0}),gL=!1;function k_e(){const[e,t]=p.useState(gL);return p.useEffect(()=>{gL||(gL=!0,t(!0))},[]),e}$Q(k_e,"useIsHydrated");var S_e=Fy[" useSyncExternalStore ".trim().toString()];function E_e(){return()=>{}}$Q(E_e,"subscribe");function C_e(){return S_e(E_e,()=>!0,()=>!1)}$Q(C_e,"useIsHydratedModern");var iat=typeof S_e=="function"?C_e:k_e,rat=Object.defineProperty,Gy=(e,t)=>rat(e,"name",{value:t,configurable:!0}),bL="rovingFocusGroup.onEntryFocus",sat={bubbles:!1,cancelable:!0},kP="RovingFocusGroup",[NF,T_e,oat]=EQ(kP),[aat,Ww]=gc(kP,[oat]),[lat,cat]=aat(kP),uat=p.forwardRef(Gy(function(t,n){return o.jsx(NF.Provider,{scope:t.__scopeRovingFocusGroup,children:o.jsx(NF.Slot,{scope:t.__scopeRovingFocusGroup,children:o.jsx(dat,{...t,ref:n})})})},"RovingFocusGroup")),dat=p.forwardRef(Gy(function(t,n){const{__scopeRovingFocusGroup:i,orientation:r,loop:s=!1,dir:a,currentTabStopId:l,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:u,onEntryFocus:d,preventScrollOnEntryFocus:f=!1,...h}=t,m=p.useRef(null),g=pr(n,m),b=RC(a),[v,y]=ed({prop:l,defaultProp:c??null,onChange:u,caller:kP}),[x,w]=p.useState(!1),O=Pd(d),S=T_e(i),k=p.useRef(!1),[C,E]=p.useState(0);return p.useEffect(()=>{const N=m.current;if(N)return N.addEventListener(bL,O),()=>N.removeEventListener(bL,O)},[O]),o.jsx(lat,{scope:i,orientation:r,dir:b,loop:s,currentTabStopId:v,onItemFocus:p.useCallback(N=>y(N),[y]),onItemShiftTab:p.useCallback(()=>w(!0),[]),onFocusableItemAdd:p.useCallback(()=>E(N=>N+1),[]),onFocusableItemRemove:p.useCallback(()=>E(N=>N-1),[]),children:o.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,N=>{const A=!k.current;if(N.target===N.currentTarget&&A&&!x){const j=new CustomEvent(bL,sat);if(N.currentTarget.dispatchEvent(j),!j.defaultPrevented){const T=S().filter(P=>P.focusable),R=T.find(P=>P.active),_=T.find(P=>P.id===v),M=[R,_,...T].filter(Boolean).map(P=>P.ref.current);FQ(M,f)}}k.current=!1}),onBlur:An(t.onBlur,()=>w(!1))})})},"RovingFocusGroupImpl")),fat="RovingFocusGroupItem",hat=p.forwardRef(Gy(function(t,n){const{__scopeRovingFocusGroup:i,focusable:r=!0,active:s=!1,tabStopId:a,children:l,...c}=t,u=lg(),d=a||u,f=cat(fat,i),h=f.currentTabStopId===d,m=T_e(i),{onFocusableItemAdd:g,onFocusableItemRemove:b,currentTabStopId:v}=f,y=iat();return Hu(()=>{if(!(!y||!r))return g(),()=>b()},[y,r,g,b]),p.useEffect(()=>{if(!(y||!r))return g(),()=>b()},[y,r,g,b]),o.jsx(NF.ItemSlot,{scope:i,id:d,focusable:r,active:s,children:o.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=__e(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?j_e(S,k+1):S.slice(k+1)}setTimeout(()=>FQ(S))}}),children:typeof l=="function"?l({isCurrentTabStop:h,hasTabStop:v!=null}):l})})},"RovingFocusGroupItem")),pat={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function A_e(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}Gy(A_e,"getDirectionAwareKey");function __e(e,t,n){const i=A_e(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(i))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(i)))return pat[i]}Gy(__e,"getFocusIntent");function FQ(e,t=!1){const n=document.activeElement;for(const i of e)if(i===n||(i.focus({preventScroll:t}),document.activeElement!==n))return}Gy(FQ,"focusFirst");function j_e(e,t){return e.map((n,i)=>e[(t+i)%e.length])}Gy(j_e,"wrapArray");var BQ=uat,UQ=hat,mat=Object.defineProperty,nr=(e,t)=>mat(e,"name",{value:t,configurable:!0}),RF=["Enter"," "],gat=["ArrowDown","PageUp","Home"],N_e=["ArrowUp","PageDown","End"],bat=[...gat,...N_e],yat={ltr:[...RF,"ArrowRight"],rtl:[...RF,"ArrowLeft"]},vat={ltr:["ArrowLeft"],rtl:["ArrowRight"]},SP="Menu",[eE,xat,wat]=EQ(SP),[Xy,R_e]=gc(SP,[wat,qw,Ww]),EP=qw(),I_e=Ww(),[P_e,Ng]=Xy(SP),[Oat,PC]=Xy(SP),kat=nr(e=>{const{__scopeMenu:t,open:n=!1,children:i,dir:r,onOpenChange:s,modal:a=!0}=e,l=EP(t),[c,u]=p.useState(null),d=p.useRef(!1),f=Pd(s),h=RC(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]),o.jsx(OP,{...l,children:o.jsx(P_e,{scope:t,open:n,onOpenChange:f,content:c,onContentChange:u,children:o.jsx(Oat,{scope:t,onClose:p.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:d,dir:h,modal:a,children:i})})})},"Menu"),D_e=p.forwardRef(nr(function(t,n){const{__scopeMenu:i,...r}=t,s=EP(i);return o.jsx(MQ,{...s,...r,ref:n})},"MenuAnchor")),M_e="MenuPortal",[Sat,L_e]=Xy(M_e,{forceMount:void 0}),Eat=nr(e=>{const{__scopeMenu:t,forceMount:n,children:i,container:r}=e,s=Ng(M_e,t);return o.jsx(Sat,{scope:t,forceMount:n,children:o.jsx(Hf,{present:n||s.open,children:o.jsx(jQ,{asChild:!0,container:r,children:i})})})},"MenuPortal"),Ad="MenuContent",[Cat,QQ]=Xy(Ad),Tat=p.forwardRef(nr(function(t,n){const i=L_e(Ad,t.__scopeMenu),{forceMount:r=i.forceMount,...s}=t,a=Ng(Ad,t.__scopeMenu),l=PC(Ad,t.__scopeMenu);return o.jsx(eE.Provider,{scope:t.__scopeMenu,children:o.jsx(Hf,{present:r||a.open,children:o.jsx(eE.Slot,{scope:t.__scopeMenu,children:l.modal?o.jsx(Aat,{...s,ref:n}):o.jsx(_at,{...s,ref:n})})})})},"MenuContent")),Aat=p.forwardRef(nr(function(t,n){const i=Ng(Ad,t.__scopeMenu),r=p.useRef(null),s=pr(n,r);return p.useEffect(()=>{const a=r.current;if(a)return m_e(a)},[]),o.jsx(zQ,{...t,ref:s,trapFocus:i.open,disableOutsidePointerEvents:i.open,disableOutsideScroll:!0,onFocusOutside:An(t.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>i.onOpenChange(!1)})},"MenuRootContentModal")),_at=p.forwardRef(nr(function(t,n){const i=Ng(Ad,t.__scopeMenu);return o.jsx(zQ,{...t,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>i.onOpenChange(!1)})},"MenuRootContentNonModal")),jat=up("MenuContent.ScrollLock"),zQ=p.forwardRef(nr(function(t,n){const{__scopeMenu:i,loop:r=!1,trapFocus:s,onOpenAutoFocus:a,onCloseAutoFocus:l,disableOutsidePointerEvents:c,onEntryFocus:u,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:m,onDismiss:g,disableOutsideScroll:b,...v}=t,y=Ng(Ad,i),x=PC(Ad,i),w=EP(i),O=I_e(i),S=xat(i),[k,C]=p.useState(null),E=p.useRef(null),N=pr(n,E,y.onContentChange),A=p.useRef(0),j=p.useRef(""),T=p.useRef(0),R=p.useRef(null),_=p.useRef("right"),D=p.useRef(0),M=b?RQ:p.Fragment,P=b?{as:jat,allowPinchZoom:!0}:void 0,L=nr(I=>{var Q,Z;const z=j.current+I,K=S().filter(ue=>!ue.disabled),B=document.activeElement,W=(Q=K.find(ue=>ue.ref.current===B))==null?void 0:Q.textValue,H=K.map(ue=>ue.textValue),X=H_e(H,z,W),ie=(Z=K.find(ue=>ue.textValue===X))==null?void 0:Z.ref.current;nr(function ue(Ee){j.current=Ee,window.clearTimeout(A.current),Ee!==""&&(A.current=window.setTimeout(()=>ue(""),1e3))},"updateSearch")(z),ie&&setTimeout(()=>ie.focus())},"handleTypeaheadSearch");p.useEffect(()=>()=>window.clearTimeout(A.current),[]),vP();const F=p.useCallback(I=>{var K,B;return _.current===((K=R.current)==null?void 0:K.side)&&W_e(I,(B=R.current)==null?void 0:B.area)},[]);return o.jsx(Cat,{scope:i,searchRef:j,onItemEnter:p.useCallback(I=>{F(I)&&I.preventDefault()},[F]),onItemLeave:p.useCallback(I=>{var z;F(I)||((z=E.current)==null||z.focus(),C(null))},[F]),onTriggerLeave:p.useCallback(I=>{F(I)&&I.preventDefault()},[F]),pointerGraceTimerRef:T,onPointerGraceIntentChange:p.useCallback(I=>{R.current=I},[]),children:o.jsx(M,{...P,children:o.jsx(e_e,{asChild:!0,trapped:s,onMountAutoFocus:An(a,I=>{var z;I.preventDefault(),(z=E.current)==null||z.focus({preventScroll:!0})}),onUnmountAutoFocus:l,children:o.jsx(TQ,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:m,onDismiss:g,children:o.jsx(BQ,{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:o.jsx(LQ,{role:"menu","aria-orientation":"vertical","data-state":HQ(y.open),"data-radix-menu-content":"",dir:x.dir,...w,...v,ref:N,style:{outline:"none",...v.style},onKeyDown:An(v.onKeyDown,I=>{const K=I.target.closest("[data-radix-menu-content]")===I.currentTarget,B=I.ctrlKey||I.altKey||I.metaKey,W=I.key.length===1;K&&(I.key==="Tab"&&I.preventDefault(),!B&&W&&L(I.key));const H=E.current;if(I.target!==H||!bat.includes(I.key))return;I.preventDefault();const ie=S().filter(Q=>!Q.disabled).map(Q=>Q.ref.current);N_e.includes(I.key)&&ie.reverse(),z_e(ie)}),onBlur:An(t.onBlur,I=>{I.currentTarget.contains(I.target)||(window.clearTimeout(A.current),j.current="")}),onPointerMove:An(t.onPointerMove,Jx(I=>{const z=I.target,K=D.current!==I.clientX;if(I.currentTarget.contains(z)&&K){const B=I.clientX>D.current?"right":"left";_.current=B,D.current=I.clientX}}))})})})})})})},"MenuContentImpl")),Nat=p.forwardRef(nr(function(t,n){const{__scopeMenu:i,...r}=t;return o.jsx(Mr.div,{role:"group",...r,ref:n})},"MenuGroup")),IF="MenuItem",_Z="menu.itemSelect",VQ=p.forwardRef(nr(function(t,n){const{disabled:i=!1,onSelect:r,...s}=t,a=p.useRef(null),l=PC(IF,t.__scopeMenu),c=QQ(IF,t.__scopeMenu),u=pr(n,a),d=p.useRef(!1),f=nr(()=>{const h=a.current;if(!i&&h){const m=new CustomEvent(_Z,{bubbles:!0,cancelable:!0});h.addEventListener(_Z,g=>r==null?void 0:r(g),{once:!0}),SQ(h,m),m.defaultPrevented?d.current=!1:l.onClose()}},"handleSelect");return o.jsx($_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===" "||RF.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})},"MenuItem")),$_e=p.forwardRef(nr(function(t,n){const{__scopeMenu:i,disabled:r=!1,textValue:s,...a}=t,l=QQ(IF,i),c=I_e(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())},[a.children]),o.jsx(eE.ItemSlot,{scope:i,disabled:r,textValue:s??m,children:o.jsx(UQ,{asChild:!0,...c,focusable:!r,children:o.jsx(Mr.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...a,ref:d,onPointerMove:An(t.onPointerMove,Jx(b=>{r?l.onItemLeave(b):(l.onItemEnter(b),b.defaultPrevented||b.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:An(t.onPointerLeave,Jx(b=>l.onItemLeave(b))),onFocus:An(t.onFocus,()=>h(!0)),onBlur:An(t.onBlur,()=>h(!1))})})})},"MenuItemImpl")),Rat=p.forwardRef(nr(function(t,n){const{checked:i=!1,onCheckedChange:r,...s}=t;return o.jsx(B_e,{scope:t.__scopeMenu,checked:i,children:o.jsx(VQ,{role:"menuitemcheckbox","aria-checked":tE(i)?"mixed":i,...s,ref:n,"data-state":CP(i),onSelect:An(s.onSelect,()=>r==null?void 0:r(tE(i)?!0:!i),{checkForDefaultPrevented:!1})})})},"MenuCheckboxItem")),Iat="MenuRadioGroup",[Pat,Dat]=Xy(Iat,{value:void 0,onValueChange:nr(()=>{},"onValueChange")}),Mat=p.forwardRef(nr(function(t,n){const{value:i,onValueChange:r,...s}=t,a=Pd(r);return o.jsx(Pat,{scope:t.__scopeMenu,value:i,onValueChange:a,children:o.jsx(Nat,{...s,ref:n})})},"MenuRadioGroup")),Lat="MenuRadioItem",$at=p.forwardRef(nr(function(t,n){const{value:i,...r}=t,s=Dat(Lat,t.__scopeMenu),a=i===s.value;return o.jsx(B_e,{scope:t.__scopeMenu,checked:a,children:o.jsx(VQ,{role:"menuitemradio","aria-checked":a,...r,ref:n,"data-state":CP(a),onSelect:An(r.onSelect,()=>{var l;return(l=s.onValueChange)==null?void 0:l.call(s,i)},{checkForDefaultPrevented:!1})})})},"MenuRadioItem")),F_e="MenuItemIndicator",[B_e,Fat]=Xy(F_e,{checked:!1}),Bat=p.forwardRef(nr(function(t,n){const{__scopeMenu:i,forceMount:r,...s}=t,a=Fat(F_e,i);return o.jsx(Hf,{present:r||tE(a.checked)||a.checked===!0,children:o.jsx(Mr.span,{...s,ref:n,"data-state":CP(a.checked)})})},"MenuItemIndicator")),Uat=p.forwardRef(nr(function(t,n){const{__scopeMenu:i,...r}=t;return o.jsx(Mr.div,{role:"separator","aria-orientation":"horizontal",...r,ref:n})},"MenuSeparator")),U_e="MenuSub",[Qat,Q_e]=Xy(U_e),zat=nr(e=>{const{__scopeMenu:t,children:n,open:i=!1,onOpenChange:r}=e,s=Ng(U_e,t),a=EP(t),[l,c]=p.useState(null),[u,d]=p.useState(null),f=Pd(r);return p.useEffect(()=>(s.open===!1&&f(!1),()=>f(!1)),[s.open,f]),o.jsx(OP,{...a,children:o.jsx(P_e,{scope:t,open:i,onOpenChange:f,content:u,onContentChange:d,children:o.jsx(Qat,{scope:t,contentId:lg(),triggerId:lg(),trigger:l,onTriggerChange:c,children:n})})})},"MenuSub"),z2="MenuSubTrigger",Vat=p.forwardRef(nr(function(t,n){const i=Ng(z2,t.__scopeMenu),r=PC(z2,t.__scopeMenu),s=Q_e(z2,t.__scopeMenu),a=QQ(z2,t.__scopeMenu),l=p.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:u}=a,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 o.jsx(D_e,{asChild:!0,...d,children:o.jsx($_e,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?s.contentId:void 0,"data-state":HQ(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,Jx(m=>{a.onItemEnter(m),!m.defaultPrevented&&!t.disabled&&!i.open&&!l.current&&(a.onPointerGraceIntentChange(null),l.current=window.setTimeout(()=>{i.onOpenChange(!0),f()},100))})),onPointerLeave:An(t.onPointerLeave,Jx(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"];a.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(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(m),m.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:An(t.onKeyDown,m=>{var b;t.disabled||m.target!==m.currentTarget||a.searchRef.current!==""&&m.key===" "||yat[r.dir].includes(m.key)&&(i.onOpenChange(!0),(b=i.content)==null||b.focus(),m.preventDefault())})})})},"MenuSubTrigger")),Hat="MenuSubContent",qat=p.forwardRef(nr(function(t,n){const i=L_e(Ad,t.__scopeMenu),{forceMount:r=i.forceMount,align:s="start",...a}=t,l=Ng(Ad,t.__scopeMenu),c=PC(Ad,t.__scopeMenu),u=Q_e(Hat,t.__scopeMenu),d=p.useRef(null),f=pr(n,d);return o.jsx(eE.Provider,{scope:t.__scopeMenu,children:o.jsx(Hf,{present:r||l.open,children:o.jsx(eE.Slot,{scope:t.__scopeMenu,children:o.jsx(zQ,{id:u.contentId,"aria-labelledby":u.triggerId,...a,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=vat[c.dir].includes(h.key);m&&g&&(l.onOpenChange(!1),(b=u.trigger)==null||b.focus(),h.preventDefault())})})})})})},"MenuSubContent"));function HQ(e){return e?"open":"closed"}nr(HQ,"getOpenState");function tE(e){return e==="indeterminate"}nr(tE,"isIndeterminate");function CP(e){return tE(e)?"indeterminate":e?"checked":"unchecked"}nr(CP,"getCheckedState");function z_e(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}nr(z_e,"focusFirst");function V_e(e,t){return e.map((n,i)=>e[(t+i)%e.length])}nr(V_e,"wrapArray");function H_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 a=V_e(e,Math.max(s,0));r.length===1&&(a=a.filter(u=>u!==n));const c=a.find(u=>u.toLowerCase().startsWith(r.toLowerCase()));return c!==n?c:void 0}nr(H_e,"getNextMatch");function q_e(e,t){const{x:n,y:i}=e;let r=!1;for(let s=0,a=t.length-1;si!=h>i&&n<(f-u)*(i-d)/(h-d)+u&&(r=!r)}return r}nr(q_e,"isPointInPolygon");function W_e(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return q_e(n,t)}nr(W_e,"isPointerInGraceArea");function Jx(e){return t=>t.pointerType==="mouse"?e(t):void 0}nr(Jx,"whenMouse");var Wat=kat,Kat=D_e,Gat=Eat,Xat=Tat,Yat=VQ,Zat=Rat,Jat=Mat,elt=$at,tlt=Bat,nlt=Uat,ilt=zat,rlt=Vat,slt=qat,olt=Object.defineProperty,pu=(e,t)=>olt(e,"name",{value:t,configurable:!0}),qQ="DropdownMenu",[alt,icn]=gc(qQ,[R_e]),mu=R_e(),[llt,K_e]=alt(qQ),clt=pu(e=>{const{__scopeDropdownMenu:t,children:n,dir:i,open:r,defaultOpen:s,onOpenChange:a,modal:l=!0}=e,c=mu(t),u=p.useRef(null),[d,f]=ed({prop:r,defaultProp:s??!1,onChange:a,caller:qQ});return o.jsx(llt,{scope:t,triggerId:lg(),triggerRef:u,contentId:lg(),open:d,onOpenChange:f,onOpenToggle:p.useCallback(()=>f(h=>!h),[f]),modal:l,children:o.jsx(Wat,{...c,open:d,onOpenChange:f,dir:i,modal:l,children:n})})},"DropdownMenu"),ult="DropdownMenuTrigger",dlt=p.forwardRef(pu(function(t,n){const{__scopeDropdownMenu:i,disabled:r=!1,...s}=t,a=K_e(ult,i),l=mu(i),c=pr(n,a.triggerRef);return o.jsx(Kat,{asChild:!0,...l,children:o.jsx(Mr.button,{type:"button",id:a.triggerId,"aria-haspopup":"menu","aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.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&&(a.onOpenToggle(),a.open||u.preventDefault())}),onKeyDown:An(t.onKeyDown,u=>{r||(["Enter"," "].includes(u.key)&&a.onOpenToggle(),u.key==="ArrowDown"&&a.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(u.key)&&u.preventDefault())})})})},"DropdownMenuTrigger")),flt=pu(e=>{const{__scopeDropdownMenu:t,...n}=e,i=mu(t);return o.jsx(Gat,{...i,...n})},"DropdownMenuPortal"),hlt="DropdownMenuContent",plt=p.forwardRef(pu(function(t,n){const{__scopeDropdownMenu:i,...r}=t,s=K_e(hlt,i),a=mu(i),l=p.useRef(!1);return o.jsx(Xat,{id:s.contentId,"aria-labelledby":s.triggerId,...a,...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")),mlt=p.forwardRef(pu(function(t,n){const{__scopeDropdownMenu:i,...r}=t,s=mu(i);return o.jsx(Yat,{...s,...r,ref:n})},"DropdownMenuItem")),glt=p.forwardRef(pu(function(t,n){const{__scopeDropdownMenu:i,...r}=t,s=mu(i);return o.jsx(Zat,{...s,...r,ref:n})},"DropdownMenuCheckboxItem")),blt=p.forwardRef(pu(function(t,n){const{__scopeDropdownMenu:i,...r}=t,s=mu(i);return o.jsx(Jat,{...s,...r,ref:n})},"DropdownMenuRadioGroup")),ylt=p.forwardRef(pu(function(t,n){const{__scopeDropdownMenu:i,...r}=t,s=mu(i);return o.jsx(elt,{...s,...r,ref:n})},"DropdownMenuRadioItem")),vlt=p.forwardRef(pu(function(t,n){const{__scopeDropdownMenu:i,...r}=t,s=mu(i);return o.jsx(tlt,{...s,...r,ref:n})},"DropdownMenuItemIndicator")),xlt=p.forwardRef(pu(function(t,n){const{__scopeDropdownMenu:i,...r}=t,s=mu(i);return o.jsx(nlt,{...s,...r,ref:n})},"DropdownMenuSeparator")),wlt=pu(e=>{const{__scopeDropdownMenu:t,children:n,open:i,onOpenChange:r,defaultOpen:s}=e,a=mu(t),[l,c]=ed({prop:i,defaultProp:s??!1,onChange:r,caller:"DropdownMenuSub"});return o.jsx(ilt,{...a,open:l,onOpenChange:c,children:n})},"DropdownMenuSub"),Olt=p.forwardRef(pu(function(t,n){const{__scopeDropdownMenu:i,...r}=t,s=mu(i);return o.jsx(rlt,{...s,...r,ref:n})},"DropdownMenuSubTrigger")),klt=p.forwardRef(pu(function(t,n){const{__scopeDropdownMenu:i,...r}=t,s=mu(i);return o.jsx(slt,{...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")),Slt=clt,Elt=dlt,G_e=flt,Clt=plt,X_e=mlt,Tlt=glt,Alt=blt,_lt=ylt,Y_e=vlt,jlt=xlt,Nlt=wlt,Rlt=Olt,Ilt=klt,Plt=Object.defineProperty,Rg=(e,t)=>Plt(e,"name",{value:t,configurable:!0}),WQ="Popover",[Z_e,rcn]=gc(WQ,[qw]),KQ=qw(),[Dlt,Kw]=Z_e(WQ),Mlt=Rg(e=>{const{__scopePopover:t,children:n,open:i,defaultOpen:r,onOpenChange:s,modal:a=!1}=e,l=KQ(t),c=p.useRef(null),[u,d]=p.useState(!1),[f,h]=ed({prop:i,defaultProp:r??!1,onChange:s,caller:WQ});return o.jsx(OP,{...l,children:o.jsx(Dlt,{scope:t,contentId:lg(),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:a,children:n})})},"Popover"),Llt="PopoverTrigger",$lt=p.forwardRef(Rg(function(t,n){const{__scopePopover:i,...r}=t,s=Kw(Llt,i),a=KQ(i),l=pr(n,s.triggerRef),c=o.jsx(Mr.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":GQ(s.open),...r,ref:l,onClick:An(t.onClick,s.onOpenToggle)});return s.hasCustomAnchor?c:o.jsx(MQ,{asChild:!0,...a,children:c})},"PopoverTrigger")),J_e="PopoverPortal",[Flt,Blt]=Z_e(J_e,{forceMount:void 0}),Ult=Rg(e=>{const{__scopePopover:t,forceMount:n,children:i,container:r}=e,s=Kw(J_e,t);return o.jsx(Flt,{scope:t,forceMount:n,children:o.jsx(Hf,{present:n||s.open,children:o.jsx(jQ,{asChild:!0,container:r,children:i})})})},"PopoverPortal"),nE="PopoverContent",Qlt=p.forwardRef(Rg(function(t,n){const i=Blt(nE,t.__scopePopover),{forceMount:r=i.forceMount,...s}=t,a=Kw(nE,t.__scopePopover);return o.jsx(Hf,{present:r||a.open,children:a.modal?o.jsx(Vlt,{...s,ref:n}):o.jsx(Hlt,{...s,ref:n})})},"PopoverContent")),zlt=up("PopoverContent.RemoveScroll"),Vlt=p.forwardRef(Rg(function(t,n){const i=Kw(nE,t.__scopePopover),r=p.useRef(null),s=pr(n,r),a=p.useRef(!1);return p.useEffect(()=>{const l=r.current;if(l)return m_e(l)},[]),o.jsx(RQ,{as:zlt,allowPinchZoom:!0,children:o.jsx(eje,{...t,ref:s,trapFocus:i.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:An(t.onCloseAutoFocus,l=>{var c;l.preventDefault(),a.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;a.current=d},{checkForDefaultPrevented:!1}),onFocusOutside:An(t.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1})})})},"PopoverContentModal")),Hlt=p.forwardRef(Rg(function(t,n){const i=Kw(nE,t.__scopePopover),r=p.useRef(!1),s=p.useRef(!1);return o.jsx(eje,{...t,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var l,c;(l=t.onCloseAutoFocus)==null||l.call(t,a),a.defaultPrevented||(r.current||(c=i.triggerRef.current)==null||c.focus(),a.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:a=>{var u,d;(u=t.onInteractOutside)==null||u.call(t,a),a.defaultPrevented||(r.current=!0,a.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const l=a.target;((d=i.triggerRef.current)==null?void 0:d.contains(l))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&s.current&&a.preventDefault()}})},"PopoverContentNonModal")),eje=p.forwardRef(Rg(function(t,n){const{__scopePopover:i,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:a,disableOutsidePointerEvents:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,...h}=t,m=Kw(nE,i),g=KQ(i);return vP(),o.jsx(e_e,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:a,children:o.jsx(TQ,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:f,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onDismiss:()=>m.onOpenChange(!1),deferPointerDownOutside:!0,children:o.jsx(LQ,{"data-state":GQ(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 GQ(e){return e?"open":"closed"}Rg(GQ,"getState");var tje=Mlt,nje=$lt,ije=Ult,rje=Qlt,qlt=Object.defineProperty,al=(e,t)=>qlt(e,"name",{value:t,configurable:!0}),sje="Radio",[Wlt,oje]=gc(sje),[Klt,TP]=Wlt(sje);function aje(e){const{__scopeRadio:t,checked:n=!1,children:i,disabled:r,form:s,name:a,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:a,form:s,value:u,control:f,setControl:h,hasConsumerStoppedPropagationRef:b,userInteractionCount:v,onUserInteraction:y,isFormControl:x,bubbleInput:m,setBubbleInput:g,onCheck:al(()=>l==null?void 0:l(),"onCheck")};return o.jsx(Klt,{scope:t,...w,children:lje(d)?d(w):i})}al(aje,"RadioProvider");var Glt="RadioTrigger",Xlt=p.forwardRef(al(function({__scopeRadio:t,onClick:n,...i},r){const{checked:s,disabled:a,value:l,setControl:c,onCheck:u,hasConsumerStoppedPropagationRef:d,onUserInteraction:f,isFormControl:h,bubbleInput:m}=TP(Glt,t),g=pr(r,c);return o.jsx(Mr.button,{type:"button",role:"radio","aria-checked":s,"data-state":XQ(s),"data-disabled":a?"":void 0,disabled:a,value:l,...i,ref:g,onClick:An(n,b=>{s||(f(),u()),m&&h&&(d.current=b.isPropagationStopped(),d.current||b.stopPropagation())})})},"RadioTrigger")),Ylt="RadioIndicator",Zlt=p.forwardRef(al(function(t,n){const{__scopeRadio:i,forceMount:r,...s}=t,a=TP(Ylt,i);return o.jsx(Hf,{present:r||a.checked,children:o.jsx(Mr.span,{"data-state":XQ(a.checked),"data-disabled":a.disabled?"":void 0,...s,ref:n})})},"RadioIndicator")),Jlt="RadioBubbleInput",ect=p.forwardRef(al(function({__scopeRadio:t,onClick:n,...i},r){const{control:s,checked:a,required:l,disabled:c,name:u,value:d,form:f,bubbleInput:h,setBubbleInput:m,hasConsumerStoppedPropagationRef:g,userInteractionCount:b}=TP(Jlt,t),v=pr(r,m),y=IC(s),x=p.useRef(!1),w=p.useRef(a),O=p.useRef(b);p.useEffect(()=>{const k=h;if(!k)return;const C=window.HTMLInputElement.prototype,N=Object.getOwnPropertyDescriptor(C,"checked").set,A=b!==O.current;O.current=b;const j=w.current!==a;w.current=a;const T=!(A&&g.current);if(j&&N){x.current=!A;const R=new Event("click",{bubbles:T});N.call(k,a),k.dispatchEvent(R),x.current=!1}},[h,a,g,b]);const S=p.useRef(a);return o.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 lje(e){return typeof e=="function"}al(lje,"isFunction");function XQ(e){return e?"checked":"unchecked"}al(XQ,"getState");var tct=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],YQ="RadioGroup",[nct,scn]=gc(YQ,[Ww,oje]),cje=Ww(),AP=oje(),[ict,rct]=nct(YQ),sct=p.forwardRef(al(function(t,n){const{__scopeRadioGroup:i,name:r,form:s,defaultValue:a,value:l,required:c=!1,disabled:u=!1,orientation:d,dir:f,loop:h=!0,onValueChange:m,...g}=t,b=cje(i),v=RC(f),[y,x]=ed({prop:l,defaultProp:a??null,onChange:m,caller:YQ}),[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=al(()=>x(k.current),"reset");return C.addEventListener("reset",E),()=>C.removeEventListener("reset",E)}},[w,s,x]),o.jsx(ict,{scope:i,name:r,form:s,required:c,disabled:u,value:y,onValueChange:x,children:o.jsx(BQ,{asChild:!0,...b,orientation:d,dir:v,loop:h,children:o.jsx(Mr.div,{role:"radiogroup","aria-required":c,"aria-orientation":d,"data-disabled":u?"":void 0,dir:v,...g,ref:S})})})},"RadioGroup")),oct="RadioGroupItemProvider",act="RadioGroupItemTrigger";function uje(e){const{__scopeRadioGroup:t,value:n,disabled:i,children:r,internal_do_not_use_render:s}=e,a=rct(oct,t),l=AP(t),c=a.disabled||i;return o.jsx(aje,{...l,checked:a.value===n,disabled:c,required:a.required,name:a.name,form:a.form,value:n,onCheck:()=>a.onValueChange(n),internal_do_not_use_render:s,children:r})}al(uje,"RadioGroupItemProvider");var lct=p.forwardRef(al(function(t,n){const{__scopeRadioGroup:i,...r}=t,s=cje(i),a=AP(i),{checked:l,disabled:c}=TP(act,a.__scopeRadio),u=p.useRef(null),d=pr(n,u),f=p.useRef(!1);return p.useEffect(()=>{const h=al(g=>{tct.includes(g.key)&&(f.current=!0)},"handleKeyDown"),m=al(()=>f.current=!1,"handleKeyUp");return document.addEventListener("keydown",h),document.addEventListener("keyup",m),()=>{document.removeEventListener("keydown",h),document.removeEventListener("keyup",m)}},[]),o.jsx(UQ,{asChild:!0,...s,focusable:!c,active:l,children:o.jsx(Xlt,{...a,...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")),cct=p.forwardRef(al(function(t,n){const{__scopeRadioGroup:i,value:r,disabled:s,...a}=t;return o.jsx(uje,{__scopeRadioGroup:i,value:r,disabled:s,internal_do_not_use_render:({isFormControl:l})=>o.jsxs(o.Fragment,{children:[o.jsx(lct,{...a,ref:n,__scopeRadioGroup:i}),l&&o.jsx(uct,{__scopeRadioGroup:i})]})})},"RadioGroupItem")),uct=p.forwardRef(al(function(t,n){const{__scopeRadioGroup:i,...r}=t,s=AP(i);return o.jsx(ect,{...s,...r,ref:n})},"RadioGroupItemBubbleInput")),dct=p.forwardRef(al(function(t,n){const{__scopeRadioGroup:i,...r}=t,s=AP(i);return o.jsx(Zlt,{...s,...r,ref:n})},"RadioGroupIndicator")),fct=Object.defineProperty,cg=(e,t)=>fct(e,"name",{value:t,configurable:!0}),ZQ="Switch",[hct,ocn]=gc(ZQ),[pct,JQ]=hct(ZQ);function dje(e){const{__scopeSwitch:t,checked:n,children:i,defaultChecked:r,disabled:s,form:a,name:l,onCheckedChange:c,required:u,value:d="on",internal_do_not_use_render:f}=e,[h,m]=ed({prop:n,defaultProp:r??!1,onChange:c,caller:ZQ}),[g,b]=p.useState(null),[v,y]=p.useState(null),x=p.useRef(!1),[w,O]=p.useReducer(C=>C+1,0),S=g?!!a||!!g.closest("form"):!0,k={checked:h,setChecked:m,disabled:s,control:g,setControl:b,name:l,form:a,value:d,hasConsumerStoppedPropagationRef:x,userInteractionCount:w,onUserInteraction:O,required:u,defaultChecked:r,isFormControl:S,bubbleInput:v,setBubbleInput:y};return o.jsx(pct,{scope:t,...k,children:fje(f)?f(k):i})}cg(dje,"SwitchProvider");var mct="SwitchTrigger",gct=p.forwardRef(cg(function({__scopeSwitch:t,onClick:n,...i},r){const{control:s,form:a,value:l,disabled:c,checked:u,required:d,setControl:f,setChecked:h,hasConsumerStoppedPropagationRef:m,onUserInteraction:g,isFormControl:b,bubbleInput:v}=JQ(mct,t),y=pr(r,f),x=p.useRef(u);return p.useEffect(()=>{const w=a?s==null?void 0:s.ownerDocument.getElementById(a):s==null?void 0:s.form;if(w instanceof HTMLFormElement){const O=cg(()=>h(x.current),"reset");return w.addEventListener("reset",O),()=>w.removeEventListener("reset",O)}},[s,a,h]),o.jsx(Mr.button,{type:"button",role:"switch","aria-checked":u,"aria-required":d,"data-state":ez(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")),bct=p.forwardRef(cg(function(t,n){const{__scopeSwitch:i,name:r,checked:s,defaultChecked:a,required:l,disabled:c,value:u,onCheckedChange:d,form:f,...h}=t;return o.jsx(dje,{__scopeSwitch:i,checked:s,defaultChecked:a,disabled:c,required:l,onCheckedChange:d,name:r,form:f,value:u,internal_do_not_use_render:({isFormControl:m})=>o.jsxs(o.Fragment,{children:[o.jsx(gct,{...h,ref:n,__scopeSwitch:i}),m&&o.jsx(wct,{__scopeSwitch:i})]})})},"Switch")),yct="SwitchThumb",vct=p.forwardRef(cg(function(t,n){const{__scopeSwitch:i,...r}=t,s=JQ(yct,i);return o.jsx(Mr.span,{"data-state":ez(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:n})},"SwitchThumb")),xct="SwitchBubbleInput",wct=p.forwardRef(cg(function({__scopeSwitch:t,onClick:n,...i},r){const{control:s,hasConsumerStoppedPropagationRef:a,userInteractionCount:l,checked:c,defaultChecked:u,required:d,disabled:f,name:h,value:m,form:g,bubbleInput:b,setBubbleInput:v}=JQ(xct,t),y=pr(r,v),x=IC(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,A=Object.getOwnPropertyDescriptor(E,"checked").set,j=l!==S.current;S.current=l;const T=O.current!==c;O.current=c;const R=!(j&&a.current);if(T&&A){w.current=!j;const _=new Event("click",{bubbles:R});A.call(C,c),C.dispatchEvent(_),w.current=!1}},[b,c,a,l]);const k=p.useRef(c);return o.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 fje(e){return typeof e=="function"}cg(fje,"isFunction");function ez(e){return e?"checked":"unchecked"}cg(ez,"getState");var Oct=Object.defineProperty,kct=(e,t)=>Oct(e,"name",{value:t,configurable:!0}),Sct="Toggle",Ect=p.forwardRef(kct(function(t,n){const{pressed:i,defaultPressed:r,onPressedChange:s,...a}=t,[l,c]=ed({prop:i,onChange:s,defaultProp:r??!1,caller:Sct});return o.jsx(Mr.button,{type:"button","aria-pressed":l,"data-state":l?"on":"off","data-disabled":t.disabled?"":void 0,...a,ref:n,onClick:An(t.onClick,()=>{t.disabled||c(!l)})})},"Toggle")),Cct=Object.defineProperty,ug=(e,t)=>Cct(e,"name",{value:t,configurable:!0}),Gw="ToggleGroup",[hje,acn]=gc(Gw,[Ww]),pje=Ww(),Tct=p.forwardRef(ug(function(t,n){const{type:i,...r}=t;if(i==="single"){const s=r;return o.jsx(Act,{role:"radiogroup",...s,ref:n})}if(i==="multiple"){const s=r;return o.jsx(_ct,{role:"toolbar",...s,ref:n})}throw new Error(`Missing prop \`type\` expected on \`${Gw}\``)},"ToggleGroup")),[mje,gje]=hje(Gw),Act=p.forwardRef(ug(function(t,n){const{value:i,defaultValue:r,onValueChange:s=ug(()=>{},"onValueChange"),...a}=t,[l,c]=ed({prop:i,defaultProp:r??"",onChange:s,caller:Gw});return o.jsx(mje,{scope:t.__scopeToggleGroup,type:"single",value:p.useMemo(()=>l?[l]:[],[l]),onItemActivate:c,onItemDeactivate:p.useCallback(()=>c(""),[c]),children:o.jsx(bje,{...a,ref:n})})},"ToggleGroupImplSingle")),_ct=p.forwardRef(ug(function(t,n){const{value:i,defaultValue:r,onValueChange:s=ug(()=>{},"onValueChange"),...a}=t,[l,c]=ed({prop:i,defaultProp:r??[],onChange:s,caller:Gw}),u=p.useCallback(f=>c((h=[])=>[...h,f]),[c]),d=p.useCallback(f=>c((h=[])=>h.filter(m=>m!==f)),[c]);return o.jsx(mje,{scope:t.__scopeToggleGroup,type:"multiple",value:l,onItemActivate:u,onItemDeactivate:d,children:o.jsx(bje,{...a,ref:n})})},"ToggleGroupImplMultiple")),[jct,Nct]=hje(Gw),bje=p.forwardRef(ug(function(t,n){const{__scopeToggleGroup:i,disabled:r=!1,rovingFocus:s=!0,orientation:a,dir:l,loop:c=!0,...u}=t,d=pje(i),f=RC(l),h={dir:f,...u};return o.jsx(jct,{scope:i,rovingFocus:s,disabled:r,children:s?o.jsx(BQ,{asChild:!0,...d,orientation:a,dir:f,loop:c,children:o.jsx(Mr.div,{...h,ref:n})}):o.jsx(Mr.div,{...h,ref:n})})},"ToggleGroupImpl")),PF="ToggleGroupItem",Rct=p.forwardRef(ug(function(t,n){const i=gje(PF,t.__scopeToggleGroup),r=Nct(PF,t.__scopeToggleGroup),s=pje(t.__scopeToggleGroup),a=i.value.includes(t.value),l=r.disabled||t.disabled,c={...t,pressed:a,disabled:l},u=p.useRef(null);return r.rovingFocus?o.jsx(UQ,{asChild:!0,...s,focusable:!l,active:a,ref:u,children:o.jsx(jZ,{...c,ref:n})}):o.jsx(jZ,{...c,ref:n})},"ToggleGroupItem")),jZ=p.forwardRef(ug(function(t,n){const{__scopeToggleGroup:i,value:r,...s}=t,a=gje(PF,i),l={role:"radio","aria-checked":t.pressed,"aria-pressed":void 0},c=a.type==="single"?l:void 0;return o.jsx(Ect,{...c,...s,ref:n,onPressedChange:u=>{u?a.onItemActivate(r):a.onItemDeactivate(r)}})},"ToggleGroupItemImpl")),Ict=Object.defineProperty,va=(e,t)=>Ict(e,"name",{value:t,configurable:!0}),[tz,lcn]=gc("Tooltip",[qw]),nz=qw(),Pct="TooltipProvider",Dct=700,DF="tooltip.open",[Mct,iz]=tz(Pct),Lct=va(e=>{const{__scopeTooltip:t,delayDuration:n=Dct,skipDelayDuration:i=300,disableHoverableContent:r=!1,children:s}=e,a=p.useRef(!0),l=p.useRef(!1),c=p.useRef(0);return p.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),o.jsx(Mct,{scope:t,isOpenDelayedRef:a,delayDuration:n,onOpen:p.useCallback(()=>{i<=0||(window.clearTimeout(c.current),a.current=!1)},[i]),onClose:p.useCallback(()=>{i<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>a.current=!0,i))},[i]),isPointerInTransitRef:l,onPointerInTransitChange:p.useCallback(u=>{l.current=u},[]),disableHoverableContent:r,children:s})},"TooltipProvider"),MF="Tooltip",[$ct,DC]=tz(MF),Fct=va(e=>{const{__scopeTooltip:t,children:n,open:i,defaultOpen:r,onOpenChange:s,disableHoverableContent:a,delayDuration:l}=e,c=iz(MF,e.__scopeTooltip),u=nz(t),[d,f]=p.useState(null),[h,m]=p.useState(void 0),g=lg(),b=p.useRef(0),v=a??c.disableHoverableContent,y=l??c.delayDuration,x=p.useRef(!1),[w,O]=ed({prop:i,defaultProp:r??!1,onChange:va(A=>{A?(c.onOpen(),document.dispatchEvent(new CustomEvent(DF))):c.onClose(),s==null||s(A)},"onChange"),caller:MF}),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 N=h??g;return o.jsx(OP,{...u,children:o.jsx($ct,{scope:t,contentId:N,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"),NZ="TooltipTrigger",Bct=p.forwardRef(va(function(t,n){const{__scopeTooltip:i,...r}=t,s=DC(NZ,i),a=iz(NZ,i),l=nz(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]),o.jsx(MQ,{asChild:!0,...l,children:o.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&&!a.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")),yje="TooltipPortal",[Uct,Qct]=tz(yje,{forceMount:void 0}),zct=va(e=>{const{__scopeTooltip:t,forceMount:n,children:i,container:r}=e,s=DC(yje,t);return o.jsx(Uct,{scope:t,forceMount:n,children:o.jsx(Hf,{present:n||s.open,children:o.jsx(jQ,{asChild:!0,container:r,children:i})})})},"TooltipPortal"),iE="TooltipContent",Vct=p.forwardRef(va(function(t,n){const i=Qct(iE,t.__scopeTooltip),{forceMount:r=i.forceMount,side:s="top",...a}=t,l=DC(iE,t.__scopeTooltip);return o.jsx(Hf,{present:r||l.open,children:l.disableHoverableContent?o.jsx(vje,{side:s,...a,ref:n}):o.jsx(Hct,{side:s,...a,ref:n})})},"TooltipContent")),Hct=p.forwardRef(va(function(t,n){const i=DC(iE,t.__scopeTooltip),r=iz(iE,t.__scopeTooltip),s=p.useRef(null),a=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=xje(x,y.getBoundingClientRect()),O=wje(x,w),S=Oje(v.getBoundingClientRect()),k=Sje([...O,...S]);c(k),h(!0)},[h]);return p.useEffect(()=>()=>m(),[m]),p.useEffect(()=>{if(u&&f){const b=va(y=>g(y,f),"handleTriggerLeave"),v=va(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=va(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=!kje(x,l);w?m():O&&(m(),d())},"handleTrackPointerGrace");return document.addEventListener("pointermove",b),()=>document.removeEventListener("pointermove",b)}},[u,f,l,d,m]),o.jsx(vje,{...t,ref:a})},"TooltipContentHoverable")),qct=NAe("TooltipContent"),vje=p.forwardRef(va(function(t,n){const{__scopeTooltip:i,children:r,"aria-label":s,id:a,onEscapeKeyDown:l,onPointerDownOutside:c,...u}=t,d=DC(iE,i),f=nz(i),{onClose:h}=d;p.useEffect(()=>(document.addEventListener(DF,h),()=>document.removeEventListener(DF,h)),[h]),p.useEffect(()=>{if(d.trigger){const g=va(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 Hu(()=>(m(a),()=>{m(void 0)}),[a,m]),o.jsx(TQ,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:g=>g.preventDefault(),onDismiss:h,children:o.jsxs(LQ,{"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:[o.jsx(qct,{children:r}),s?o.jsx(vst,{id:d.contentId,role:"tooltip",children:s}):null]})})},"TooltipContentImpl"));function xje(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")}}va(xje,"getExitSideFromRect");function wje(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}va(wje,"getPaddedExitPoints");function Oje(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}]}va(Oje,"getPointsFromRect");function kje(e,t){const{x:n,y:i}=e;let r=!1;for(let s=0,a=t.length-1;si!=h>i&&n<(f-u)*(i-d)/(h-d)+u&&(r=!r)}return r}va(kje,"isPointInPolygon");function Sje(e){const t=e.slice();return t.sort((n,i)=>n.xi.x?1:n.yi.y?1:0),Eje(t)}va(Sje,"getHull");function Eje(e){if(e.length<=1)return e.slice();const t=[];for(let i=0;i=2;){const s=t[t.length-1],a=t[t.length-2];if((s.x-a.x)*(r.y-a.y)>=(s.y-a.y)*(r.x-a.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],a=n[n.length-2];if((s.x-a.x)*(r.y-a.y)>=(s.y-a.y)*(r.x-a.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)}va(Eje,"getHullPresorted");var Wct=Lct,Kct=Fct,Cje=Bct,Gct=zct,Xct=Vct;function dg(e){const t=p.useRef(e);return t.current=e,t}let ew=[],V2=!1;const RZ=e=>{var t,n;if(e.key==="Escape"){const[i]=ew;i&&(e.preventDefault(),(n=(t=i.callback).current)==null||n.call(t))}},Tje=()=>{ew.length>0&&!V2?(document.body.addEventListener("keydown",RZ),V2=!0):ew.length===0&&V2&&(document.body.removeEventListener("keydown",RZ),V2=!1)},Yct=e=>{ew.unshift(e),Tje()},Zct=({id:e})=>{ew=ew.filter(t=>t.id!==e),Tje()},MC=(e,t)=>{const n=p.useId(),i=dg(t);p.useEffect(()=>{if(!e)return;const r={id:n,callback:i};return Yct(r),()=>Zct(r)},[n,e,i])},Jct=p.createContext(null);function Aje(){const e=p.useContext(Jct);return(e==null?void 0:e.linkComponent)??"a"}function LC(e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}const eut=()=>EAe,IZ=(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},U0=()=>{},Q0=e=>{const t=p.useRef(e);return t.current=e,p.useCallback(n=>t.current(n),[])};function tut(e,t,n,i){const r=e.reduce((c,u)=>({...c,[u.key]:1}),{}),s=t.reduce((c,u)=>({...c,[u.component.key]:1}),{}),a=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(a):a.concat(l)}function nut(e,t,n){if((EAe||est)&&t&&n>1)throw new Error(`Cannot use forwardRef with multiple children in <${e} />`)}const iut="_TransitionGroupChild_1hv1z_1",rut={TransitionGroupChild:iut},_je={enter:!1,enterActive:!1,exit:!1,exitActive:!1,interrupted:!1},sut=e=>({..._je,enter:!e}),out=(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 _je}},aut=({ref:e,as:t,children:n,className:i,transitionId:r,style:s,preventMountTransition:a,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(out,sut(a||!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(N=>{const A=O.current;if(!(!A||N===C.current))switch(C.current=N,N){case"enter":f(A);break;case"enter-active":h(A);break;case"enter-complete":m(A);break;case"exit":g(A);break;case"exit-active":b(A);break;case"exit-complete":v(A);break}},[f,h,m,g,b,v]);return pi.useLayoutEffect(()=>{if(!l){let j;x({type:"exit-before"}),E("exit");const T=PN(()=>{x({type:"exit-active"}),E("exit-active"),j=window.setTimeout(()=>{E("exit-complete"),d()},k.current)});return()=>{T(),j!==void 0&&clearTimeout(j)}}if(a&&!w.current){w.current=!0;return}let N;x({type:"enter-before"}),E("enter");const A=PN(()=>{x({type:"enter-active"}),E("enter-active"),N=window.setTimeout(()=>{x({type:"done"}),E("enter-complete")},S.current)});return()=>{A(),N!==void 0&&clearTimeout(N)}},[l,a,d,E]),p.useEffect(()=>()=>{w.current=!1},[]),o.jsx(t,{ref:LC([O,e]),className:Ti(i,rut.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})},lut=e=>{const{enterMountDelay:t,preventMountTransition:n}=e,i=!n&&t!=null?t:null,[r,s]=p.useState(i==null);return wQ(()=>s(!0),r?null:i),r?o.jsx(aut,{...e}):null},Xw=e=>{const{ref:t,as:n="span",children:i,className:r,transitionId:s,style:a,enterDuration:l=0,exitDuration:c=0,preventInitialTransition:u=!0,enterMountDelay:d,insertMethod:f="append",disableAnimations:h=eut()}=e,m=Q0(e.onEnter??U0),g=Q0(e.onEnterActive??U0),b=Q0(e.onEnterComplete??U0),v=Q0(e.onExit??U0),y=Q0(e.onExitActive??U0),x=Q0(e.onExitComplete??U0);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(()=>IZ(i).map(k=>({...w(k),preventMountTransition:u})));return p.useLayoutEffect(()=>{S(k=>{const C=IZ(i);return tut(C,k,w,f)})},[i,f,w]),nut("TransitionGroup",t,p.Children.count(i)),h?o.jsx(o.Fragment,{children:p.Children.map(i,k=>o.jsx(n,{ref:t,className:r,style:a,"data-transition-id":s,children:k}))}):o.jsx(o.Fragment,{children:O.map(({component:k,...C})=>o.jsx(lut,{...C,as:n,className:r,transitionId:s,enterDuration:l,exitDuration:c,enterMountDelay:d,style:a,ref:t,children:k},k.key))})},cut="_Button_1864l_1",uut="_ButtonInner_1864l_4",dut="_ButtonLoader_1864l_749",yL={Button:cut,ButtonInner:uut,ButtonLoader:dut},Dt=e=>{const{type:t="button",color:n="primary",variant:i="solid",pill:r=!0,uniform:s=!1,size:a="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 o.jsxs("button",{type:t,className:Ti(yL.Button,g),"data-color":n,"data-variant":i,"data-pill":r?"":void 0,"data-uniform":s?"":void 0,"data-size":a,"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:OQ,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:[o.jsx(Xw,{className:yL.ButtonLoader,enterDuration:250,exitDuration:150,children:u&&o.jsx(jC,{},"loader")}),o.jsx("span",{className:yL.ButtonInner,children:xQ(m)})]})},fut=()=>{var e;return typeof ClipboardItem<"u"&&!!((e=navigator.clipboard)!=null&&e.write)};function hut(e){const{"text/plain":t,...n}=e;return new ClipboardItem({...n,...t?{"text/plain":new Blob([t],{type:"text/plain"})}:null})}async function put(e,t=document.body){if(typeof e=="string")return PZ(e,t);try{return fut()?(await navigator.clipboard.write([hut(e)]),!0):e["text/plain"]?PZ(e["text/plain"],t):!1}catch{return!1}}async function PZ(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 mut="_TransitionItem_1o7b1_1",gut={TransitionItem:mut},but=e=>{const{as:t="span",className:n,children:i,preventInitialTransition:r,insertMethod:s,transitionClassName:a,transitionPosition:l="absolute"}=e,{enterTotalDuration:c,exitTotalDuration:u,variables:d}=Out(e);return o.jsx(t,{className:Ti("block",l==="absolute"&&"relative",n),"data-transition-position":l,style:d,children:o.jsx(Xw,{as:t,className:Ti(gut.TransitionItem,a),enterDuration:c,exitDuration:u,insertMethod:s,preventInitialTransition:r,children:i})})},yut=400,vut=500,xut=200,wut=300;function Out({initial:e,enter:t,exit:n,forceCompositeLayer:i}){const r=aL(e),s=aL(t),a=aL(n),l=[r,a,s].some(b=>b!=="none"),c=(t==null?void 0:t.duration)??(l?vut:yut),u=(t==null?void 0:t.timingFunction)??(l?"var(--cubic-enter)":"ease"),d=(n==null?void 0:n.duration)??(l?wut:xut),f=(n==null?void 0:n.timingFunction)??(l?"var(--cubic-exit)":"ease"),h=Ky({"tg-will-change":i?"transform, opacity":"auto","tg-enter-opacity":oL((t==null?void 0:t.opacity)??1),"tg-enter-transform":s,"tg-enter-filter":lL(t),"tg-enter-duration":M2(c),"tg-enter-delay":M2((t==null?void 0:t.delay)??0),"tg-enter-timing-function":u,"tg-exit-opacity":oL((n==null?void 0:n.opacity)??0),"tg-exit-transform":a,"tg-exit-filter":lL(n),"tg-exit-duration":M2(d),"tg-exit-delay":M2((n==null?void 0:n.delay)??0),"tg-exit-timing-function":f,"tg-initial-opacity":oL((e==null?void 0:e.opacity)??(n==null?void 0:n.opacity)??0),"tg-initial-transform":r==="none"?a:r,"tg-initial-filter":lL(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 rz=({children:e,copyValue:t,onClick:n,...i})=>{const[r,s]=p.useState(!1),a=p.useRef(null),l=c=>{r||(s(!0),n==null||n(c),put(typeof t=="function"?t():t),a.current=window.setTimeout(()=>{s(!1)},1300))};return p.useEffect(()=>()=>{a.current&&clearTimeout(a.current)},[]),o.jsxs(Dt,{...i,onClick:l,children:[o.jsx(but,{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?o.jsx(XS,{},"copied-icon"):o.jsx(J2e,{},"copy-icon")}),typeof e=="function"?e({copied:r}):e]})},kut="_Menu_1t4b0_1",Sut="_MenuList_1t4b0_3",Eut="_MenuItemContent_1t4b0_53",Cut="_MenuItem_1t4b0_53",Tut="_ItemActions_1t4b0_98",Aut="_PressableInner_1t4b0_117",_ut="_Separator_1t4b0_135",jut="_SubMenuItem_1t4b0_139",Nut="_SubTriggerIcon_1t4b0_141",Rut="_RadioItem_1t4b0_151",Iut="_RadioIndicatorActive_1t4b0_158",Put="_RadioIndicator_1t4b0_158",Dut="_CheckboxItem_1t4b0_249",Mut="_CheckboxIndicator_1t4b0_256",Lut="_CheckboxCircle_1t4b0_269",ps={Menu:kut,MenuList:Sut,MenuItemContent:Eut,MenuItem:Cut,ItemActions:Tut,PressableInner:Aut,Separator:_ut,SubMenuItem:jut,SubTriggerIcon:Nut,RadioItem:Rut,RadioIndicatorActive:Iut,RadioIndicator:Put,CheckboxItem:Dut,CheckboxIndicator:Mut,CheckboxCircle:Lut},jje=p.createContext(null),$C=()=>{const e=p.useContext(jje);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,a]=p.useState(!1),l=t??s,c=dg(n),u=dg(i),d=p.useCallback(h=>{var m,g;a(h),h?(m=c.current)==null||m.call(c):(g=u.current)==null||g.call(u)},[c,u]);MC(s,()=>{d(!1)});const f=p.useMemo(()=>({open:l,setOpen:d}),[l,d]);return o.jsx(jje.Provider,{value:f,children:o.jsx(Slt,{open:l,onOpenChange:d,modal:r,children:e})})},$ut=({className:e,children:t,disabled:n,onSelect:i,onClick:r})=>{const{open:s}=$C(),a=l=>{s||l.preventDefault()};return i?o.jsx(X_e,{className:Ti(ps.MenuItem,e),onSelect:i,onClick:r,disabled:n,onPointerMove:a,onPointerLeave:a,children:o.jsx("div",{className:ps.PressableInner,children:t})}):o.jsx("div",{className:Ti(ps.MenuItemContent,e),children:t})},Fut=({className:e,children:t})=>o.jsx("div",{className:Ti(ps.ItemActions,e),children:t}),But=({children:e,onClick:t})=>{const{setOpen:n}=$C();return o.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})},Uut=e=>{const{className:t,children:n,href:i,to:r,disabled:s,as:a,...l}=e,{open:c}=$C(),u=i||r,d=u?/^https?:\/\//.test(u):!0,f=Aje(),h=a||(d?"a":f),m=b=>{c||b.preventDefault()},g=d?{target:"_blank",rel:"noopener noreferrer",href:i??r}:{href:i,to:r};return o.jsx(X_e,{asChild:!0,className:Ti(ps.MenuItem,t),disabled:s,onPointerMove:d?void 0:m,onPointerLeave:d?void 0:m,children:o.jsx(h,{...g,...l,children:o.jsx("span",{className:ps.PressableInner,children:n})})})},Qut=({className:e})=>o.jsx(jlt,{className:Ti(ps.Separator,e),role:"separator"}),zut=({children:e,side:t,sideOffset:n=5,align:i,alignOffset:r,width:s,minWidth:a,maxHeight:l})=>{const{open:c}=$C();return o.jsx(G_e,{forceMount:!0,children:o.jsx(Xw,{className:ps.Menu,enterDuration:350,exitDuration:200,disableAnimations:!0,children:c&&o.jsx(Clt,{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:Gh,style:Ky({"menu-width":s,"menu-min-width":a,"menu-max-height":l}),children:e},"dropdown")})})},Vut=({children:e,disabled:t})=>o.jsx(Elt,{asChild:!0,disabled:t,children:e}),Nje=p.createContext(null),Rje=()=>{const e=p.useContext(Nje);if(!e)throw new Error("Submenu components must be wrapped in ");return e},Hut=({children:e,forceOpen:t,onOpen:n,onClose:i})=>{const[r,s]=p.useState(!1),a=p.useRef(null),l=t??r,c=dg(n),u=dg(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]);MC(r,()=>{var h;d(!1),(h=a.current)==null||h.focus()});const f=p.useMemo(()=>({open:l,setOpen:d,triggerRef:a}),[l,d]);return o.jsx(Nje.Provider,{value:f,children:o.jsx(Nlt,{open:l,onOpenChange:d,children:e})})},qut=({className:e,children:t,disabled:n})=>{const{open:i}=$C(),{triggerRef:r}=Rje(),s=a=>{i||a.preventDefault()};return o.jsx(Rlt,{ref:r,className:Ti(ps.MenuItem,ps.SubMenuItem,e),disabled:n,onPointerMove:s,onPointerLeave:s,children:o.jsxs("div",{className:ps.PressableInner,children:[t,o.jsx(fit,{width:"16",height:"16",className:ps.SubTriggerIcon})]})})},Wut=({children:e,sideOffset:t=4,alignOffset:n=-6,width:i="auto",minWidth:r="auto",maxHeight:s})=>{const{open:a}=Rje();return o.jsx(G_e,{forceMount:!0,children:o.jsx(Xw,{className:ps.Menu,enterDuration:350,exitDuration:200,disableAnimations:!0,children:a&&o.jsx(Ilt,{className:ps.MenuList,sideOffset:t,alignOffset:n,avoidCollisions:!0,collisionPadding:{bottom:30,top:30,left:12,right:12},onEscapeKeyDown:Gh,style:Ky({"menu-width":i,"menu-min-width":r,"menu-max-height":s}),children:e},"submenu")})})},Kut=({children:e,value:t,onChange:n,indicatorPosition:i="end",...r})=>o.jsx(Alt,{...r,value:t,onValueChange:s=>n(s),"data-indicator-position":i,children:e}),Gut=({className:e,children:t,...n})=>o.jsx(_lt,{className:Ti(ps.MenuItem,ps.RadioItem,e),...n,children:o.jsxs("div",{className:ps.PressableInner,children:[o.jsx("div",{className:ps.RadioIndicator,children:o.jsx(Y_e,{className:ps.RadioIndicatorActive})}),t]})}),Xut=({className:e,children:t,indicatorPosition:n="end",indicatorVariant:i="solid",...r})=>o.jsx(Tlt,{className:Ti(ps.MenuItem,ps.CheckboxItem,e),...r,"data-indicator-position":n,"data-indicator-variant":i,children:o.jsxs("div",{className:ps.PressableInner,children:[o.jsx("div",{className:ps.CheckboxIndicator,children:o.jsx(Y_e,{children:i==="ghost"?o.jsx(XS,{className:"size-4"}):o.jsx("div",{className:ps.CheckboxCircle,children:o.jsx(XS,{className:"size-4"})})})}),t]})});Pr.Content=zut;Pr.Item=$ut;Pr.ItemActions=Fut;Pr.ItemAction=But;Pr.Link=Uut;Pr.Separator=Qut;Pr.Trigger=Vut;Pr.Sub=Hut;Pr.SubTrigger=qut;Pr.SubContent=Wut;Pr.CheckboxItem=Xut;Pr.RadioGroup=Kut;Pr.RadioItem=Gut;const Yut="_Tooltip_16g2y_1",Zut="_TriggerDecorator_16g2y_73",Ije={Tooltip:Yut,TriggerDecorator:Zut},po=e=>{const{ref:t,children:n,content:i,forceOpen:r=i===null?!1:void 0,maxWidth:s=300,openDelay:a=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);wQ(()=>k(!1),S?400:null);const C=r??w,E=A=>{typeof r!="boolean"&&(O(A),u&&k(A))},N=A=>{u&&S&&(A.preventDefault(),A.stopPropagation())};return o.jsxs(Pje,{open:C,delayDuration:a,onOpenChange:E,disableHoverableContent:!l,children:[o.jsx(Cje,{asChild:!0,children:o.jsx(_Ae,{...x,ref:t,onPointerDown:A=>{N(A),v==null||v(A)},onClick:A=>{N(A),y==null||y(A)},children:n})}),o.jsx(Dje,{maxWidth:s,compact:c,align:d,alignOffset:f,side:h,sideOffset:m,gutterSize:g,className:b,children:i})]})},Pje=({children:e,open:t,onOpenChange:n,...i})=>(MC(t,()=>{n(!1)}),o.jsx(Wct,{children:o.jsx(Kct,{open:t,onOpenChange:n,...i,children:e})})),Dje=({children:e,maxWidth:t=300,compact:n=!1,clickable:i=void 0,alignOffset:r=0,sideOffset:s=5,gutterSize:a="md",className:l,style:c,...u})=>o.jsx(Gct,{children:o.jsx(Xct,{...u,className:Ti(Ije.Tooltip,l),"data-compact":n,"data-clickable":i,"data-gutter-size":a,alignOffset:r,sideOffset:s,collisionPadding:15,hideWhenDetached:!0,style:{...c,maxWidth:t},onEscapeKeyDown:Gh,children:e})}),Jut=({children:e,asChild:t=!0,...n})=>o.jsx(Cje,{asChild:t,...n,children:e}),edt=e=>{const{children:t,className:n,focusable:i=!0,ref:r,...s}=e,a=typeof t=="string";return o.jsx(_Ae,{ref:r,...s,className:Ti(Ije.TriggerDecorator,n),tabIndex:i?0:void 0,children:a?o.jsx("span",{children:t}):t})};po.Root=Pje;po.Content=Dje;po.Trigger=Jut;po.TriggerDecorator=edt;const tdt=50,DZ=48;function ndt(e){return(e.events??[]).flatMap(t=>{var r,s;const i=(((r=t.content)==null?void 0:r.parts)??[]).map(a=>typeof a.text=="string"?a.text:"").filter(Boolean).join("");return i?[{text:i,role:t.author??((s=t.content)==null?void 0:s.role)??"",ts:t.timestamp}]:[]})}function idt(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 V("search.untitledSession")}function rdt(e,t,n){const i=Math.max(0,t-DZ),r=Math.min(e.length,t+n+DZ);return(i>0?"…":"")+e.slice(i,r).trim()+(r{var c;if((c=l.events)!=null&&c.length)return l;try{return await HI(t,e,l.id)}catch{return l}})),a=[];for(const l of s)for(const{text:c,role:u,ts:d}of ndt(l)){const f=c.toLowerCase().indexOf(i);if(f!==-1){a.push({type:"session",appId:t,sessionId:l.id,title:idt(l),snippet:rdt(c,f,i.length),role:u,ts:d??l.lastUpdateTime});break}}return a.sort((l,c)=>(c.ts??0)-(l.ts??0)),a.slice(0,tdt)}async function odt(e,t){if(!e||!t.trim())return{results:[]};let n;try{n=await eCe(e,t.trim())}catch(a){const l=String(a);return{results:[],note:l.includes("404")?V("search.webUnavailable"):V("search.webFailed",{message:l})}}const{mounted:i,results:r,error:s}=n;return i?s?{results:[],note:s}:{results:r.map((a,l)=>({type:"web",index:l,title:a.title,url:a.url,siteName:a.siteName,summary:a.summary}))}:{results:[],note:V("search.webNotMounted")}}async function adt(e,t,n,i){if(!t||!i.trim())return{results:[]};const r=await JEe(t,e,i.trim(),n);if(!r.mounted)return{results:[],note:V(e==="knowledge"?"search.knowledgeNotMounted":"search.memoryNotMounted")};if(r.error)return{results:[],note:r.error};const s=r.sourceName??V(e==="knowledge"?"search.knowledge":"search.longTermMemory");return{results:r.results.map((a,l)=>e==="knowledge"?{type:"knowledge",index:l,content:a.content,sourceName:s,sourceType:r.sourceType}:{type:"memory",index:l,content:a.content,sourceName:s,sourceType:r.sourceType,author:a.author,ts:a.timestamp})}}async function ldt(e,t,n){return e==="session"?{results:await sdt(n.userId,n.appId,t)}:e==="web"?odt(n.appId,t):adt(e,n.appId,n.userId,t)}function Mje({mirrored:e=!1}){return o.jsxs("g",{opacity:"0.5",transform:e?"translate(20 0) scale(-1 1)":void 0,children:[o.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"}),o.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 cdt(e){return o.jsx("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",...e,children:o.jsx(Mje,{})})}function udt(e){return o.jsx("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",...e,children:o.jsx(Mje,{mirrored:!0})})}function ddt(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.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 fdt(e){return o.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.333",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("circle",{cx:"7.333",cy:"7.333",r:"5.333"}),o.jsx("path",{d:"m11.133 11.133 2.867 2.867"})]})}function hdt(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.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 Lje(e){return o.jsxs("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:[o.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"}),o.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"}),o.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 $je(e){return o.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M3.25 2.25h6l3.5 3.5v8H3.25v-11Z"}),o.jsx("path",{d:"M9.25 2.25v3.5h3.5M5.5 8.25h5M5.5 10.75h4"})]})}function pdt({className:e="icon"}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[o.jsx("path",{d:"M16.4 10.7a5.7 5.7 0 1 1-1.67-4.03"}),o.jsx("path",{d:"M15.25 15.25 19.6 19.6"})]})}function mdt({open:e}){return o.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:o.jsx("path",{d:"m3.25 4.75 2.75 2.5 2.75-2.5"})})}function gdt({active:e=!1,onClick:t}){const{t:n}=_e("workspaceTools");return o.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:[o.jsx(fdt,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:n("search.nav")})]})}function bdt(e,t,n,i){const r=!!e,s=new Set((t==null?void 0:t.searchSources)??[]),a=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:a(" web_search")},{id:"knowledge",label:i("search.sources.knowledge"),ready:r&&s.has("knowledge"),unavailableLabel:a(i("search.sources.knowledge"))},{id:"memory",label:i("search.sources.memory"),ready:r&&s.has("memory"),unavailableLabel:a(i("search.sources.memory"))}]}function DN(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 MZ(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 ydt({userId:e,appId:t,agentInfo:n,capabilitiesLoading:i,agentLabel:r,onOpenSession:s}){var L,F;const{t:a,i18n:l}=_e("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),N=bdt(t,n,i,a),A=N.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"?(F=n==null?void 0:n.components)==null?void 0:F.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(z){var K;(K=E.current)!=null&&K.contains(z.target)||k(!1)}return document.addEventListener("pointerdown",I),()=>document.removeEventListener("pointerdown",I)},[S]);async function T(I,z){var H;const K=I.trim();if(!K||!((H=N.find(X=>X.id===z))!=null&&H.ready))return;const B=++C.current;x(!0),O(!0);let W;try{W=await ldt(z,K,{userId:e,appId:t})}catch(X){const ie=X instanceof Error?X.message:String(X);W={results:[],note:a("search.failed",{message:ie})}}B===C.current&&(g(W.results),v(W.note),x(!1))}function R(I){C.current+=1,h(I),g([]),v(void 0),O(!1),x(!1)}function _(I){C.current+=1,d(I),k(!1),g([]),v(void 0),O(!1),x(!1)}const D=!!(A!=null&&A.ready),M=t?u==="web"?a("search.placeholder.web"):u==="knowledge"?a("search.placeholder.knowledge",{name:(j==null?void 0:j.name)??a("search.placeholder.knowledgeFallback")}):u==="memory"?a("search.placeholder.memory",{name:(j==null?void 0:j.name)??a("search.placeholder.memoryFallback")}):a("search.placeholder.session"):a("search.placeholder.selectAgent"),P=j!=null&&j.backend?DN(j.backend,a):"";return o.jsxs("div",{className:"search",children:[o.jsxs("div",{className:"search-box",children:[o.jsxs("div",{className:"search-source-picker-wrap",ref:E,children:[o.jsxs("button",{className:"search-source-picker",type:"button","aria-label":a("search.sourceTypeAria",{label:(A==null?void 0:A.label)??a("search.notSelected")}),"aria-haspopup":"listbox","aria-expanded":S,onClick:()=>k(I=>!I),children:[o.jsx("span",{children:(A==null?void 0:A.label)??a("search.sourceType")}),P&&o.jsx("small",{children:P}),o.jsx(mdt,{open:S})]}),S&&o.jsx("div",{className:"search-source-menu",role:"listbox","aria-label":a("search.selectSource"),children:N.map(I=>{var B,W;const z=I.id==="knowledge"?(B=n==null?void 0:n.components)==null?void 0:B.find(H=>H.source==="knowledgebase"||H.kind==="knowledgebase"):I.id==="memory"?(W=n==null?void 0:n.components)==null?void 0:W.find(H=>H.source==="long_term_memory"||H.kind==="memory"):void 0,K=z?[z.name,z.backend?DN(z.backend,a):""].filter(Boolean).join(" · "):I.ready?I.description:I.unavailableLabel;return o.jsxs("button",{type:"button",role:"option","aria-selected":u===I.id,disabled:!I.ready,onClick:()=>_(I.id),children:[o.jsx("span",{children:I.label}),K&&o.jsx("small",{children:K})]},I.id)})})]}),o.jsx("span",{className:"search-box-divider","aria-hidden":!0}),o.jsx("input",{className:"search-input",value:f,onChange:I=>R(I.target.value),onKeyDown:I=>{I.key==="Enter"&&(I.preventDefault(),T(f,u))},placeholder:M,disabled:!D,autoFocus:!0}),o.jsx("button",{className:"search-go",onClick:()=>void T(f,u),disabled:!f.trim()||y,"aria-label":a("search.nav"),children:y?o.jsx(Mi,{className:"icon spin"}):o.jsx(pdt,{className:"icon"})})]}),o.jsx("div",{className:"search-results",children:D?w?y?null:b?o.jsx("div",{className:"search-empty",children:b}):m.length===0&&w?o.jsx("div",{className:"search-empty",children:a("search.noResults",{query:f.trim()})}):m.map((I,z)=>o.jsx(vdt,{result:I,agentLabel:r,onOpen:s,locale:c},z)):o.jsx("div",{className:"search-empty",children:a(u==="web"?"search.instructions.web":u==="knowledge"?"search.instructions.knowledge":u==="memory"?"search.instructions.memory":"search.instructions.session")}):o.jsx("div",{className:"search-empty",children:t?i?a("search.loadingCapabilities"):(A==null?void 0:A.unavailableLabel)??a("search.sourceUnavailable"):a("search.noAgentHint")})})]})}function vdt({result:e,agentLabel:t,onOpen:n,locale:i}){const{t:r}=_e("workspaceTools");switch(e.type){case"session":return o.jsxs("button",{className:"search-result",onClick:()=>n(e.appId,e.sessionId),children:[o.jsx(uAe,{className:"search-result-icon"}),o.jsxs("div",{className:"search-result-body",children:[o.jsxs("div",{className:"search-result-head",children:[o.jsx("span",{className:"search-result-title",children:e.title}),o.jsxs("span",{className:"search-result-meta",children:[t(e.appId),e.ts?` · ${MZ(e.ts,i)}`:""]})]}),o.jsx("div",{className:"search-result-snippet",children:e.snippet})]})]});case"web":return o.jsxs("a",{className:"search-result",href:e.url||void 0,target:"_blank",rel:"noreferrer noopener",children:[o.jsx(gP,{className:"search-result-icon"}),o.jsxs("div",{className:"search-result-body",children:[o.jsxs("div",{className:"search-result-head",children:[o.jsx("span",{className:"search-result-title",children:e.title||e.url}),o.jsxs("span",{className:"search-result-meta",children:[e.siteName,e.url&&o.jsx(xy,{className:"search-result-ext"})]})]}),e.summary&&o.jsx("div",{className:"search-result-snippet",children:e.summary})]})]});case"knowledge":return o.jsxs("div",{className:"search-result search-result-static",children:[o.jsx(LZ,{source:"knowledge"}),o.jsxs("div",{className:"search-result-body",children:[o.jsxs("div",{className:"search-result-head",children:[o.jsx("span",{className:"search-result-title",children:r("search.knowledgeFragment",{index:e.index+1})}),o.jsxs("span",{className:"search-result-meta",children:[e.sourceName,e.sourceType?` · ${DN(e.sourceType,r)}`:""]})]}),o.jsx("div",{className:"search-result-snippet search-result-snippet-expanded",children:e.content})]})]});case"memory":return o.jsxs("div",{className:"search-result search-result-static",children:[o.jsx(LZ,{source:"memory"}),o.jsxs("div",{className:"search-result-body",children:[o.jsxs("div",{className:"search-result-head",children:[o.jsx("span",{className:"search-result-title",children:r("search.memoryFragment",{index:e.index+1})}),o.jsxs("span",{className:"search-result-meta",children:[e.sourceName,e.sourceType?` · ${DN(e.sourceType,r)}`:"",e.ts?` · ${MZ(e.ts,i)}`:""]})]}),o.jsx("div",{className:"search-result-snippet search-result-snippet-expanded",children:e.content})]})]});default:return null}}function LZ({source:e,className:t="search-result-icon"}){return e==="knowledge"?o.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[o.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"}),o.jsx("path",{d:"M8.25 9h7.5M8.25 12.25h6"})]}):o.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[o.jsx("path",{d:"M12 4.5a7.5 7.5 0 1 0 7.5 7.5"}),o.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 xdt({filled:e=!1,...t}){return o.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:[o.jsx("rect",{x:"3.5",y:"9.3",width:"4.5",height:"10.2",rx:"1.5"}),o.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 wdt({filled:e=!1,...t}){return o.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:[o.jsx("rect",{x:"3.5",y:"4.5",width:"4.5",height:"10.2",rx:"1.5"}),o.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 Fje(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M5.25 4.25h9.5a2.5 2.5 0 0 1 2.5 2.5v3.5"}),o.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"}),o.jsx("path",{d:"M7 8.25h5.5M7 11.75h3.25"}),o.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"}),o.jsx("path",{d:"m17.65 10.6 1.9 1.9"})]})}const _P="/assets/media/logo-DCsNZy-k.svg",sz="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 Odt(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.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"}),o.jsx("rect",{x:"8.5",y:"2.5",width:"7",height:"4",rx:"1.5"}),o.jsx("path",{d:"m8 13 2.5 2.5L16 10"})]})}const $Z="(max-width: 860px)";function FZ({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)),a={"--history-title-translate":`-${i}px`,"--history-title-duration":`${s.toFixed(2)}s`};return o.jsx("span",{ref:t,className:`history-title${i>0?" is-overflowing":""}`,style:a,children:o.jsx("span",{ref:n,className:"history-title-text",children:e})})}function kdt(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75","aria-hidden":"true",...e,children:[o.jsx("circle",{cx:"7",cy:"7",r:"2.25"}),o.jsx("circle",{cx:"17",cy:"7",r:"2.25"}),o.jsx("circle",{cx:"7",cy:"17",r:"2.25"}),o.jsx("circle",{cx:"17",cy:"17",r:"2.25"})]})}function Sdt(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("circle",{cx:"12",cy:"12",r:"8.25"}),o.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 Edt(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 Cdt={super_admin:"account.roles.super_admin",admin:"account.roles.admin",developer:"account.roles.developer",user:"account.roles.user"};function Tdt({activePage:e,access:t,userInfo:n,onAgentKitCli:i,onDeveloperResources:r,onSystemInfo:s,onIssueFeedback:a,onLogout:l}){const{t:c,i18n:u}=_e(["sidebar","common"]),[d,f]=p.useState("");if(!n)return null;const h=FYe(n)||c("sidebar:account.defaultUser"),m=typeof n.email=="string"?n.email.trim():"",g=Edt(h),b=BYe(n),v=b===d?"":b,y=sC(u.resolvedLanguage??u.language)??rC;return o.jsx("div",{className:"sidebar-user",children:o.jsxs("div",{className:"sidebar-user-row",children:[o.jsxs(Pr,{modal:!0,children:[o.jsx(Pr.Trigger,{children:o.jsxs("button",{type:"button",className:"sidebar-user-btn",title:h,children:[o.jsx("span",{className:`account-avatar${v?" has-image":""}`,style:g,"aria-hidden":"true",children:v?o.jsx("img",{className:"account-avatar-image",src:v,alt:"","aria-hidden":"true",referrerPolicy:"no-referrer",onError:()=>f(v)}):null}),o.jsx("span",{className:"sidebar-user-identity",children:o.jsx("span",{className:"sidebar-user-name",children:h})})]})}),o.jsxs(Pr.Content,{side:"top",align:"start",sideOffset:4,minWidth:216,children:[o.jsxs("div",{className:"account-menu-head",children:[o.jsx("span",{className:`account-avatar account-avatar--lg${v?" has-image":""}`,style:g,"aria-hidden":"true",children:v?o.jsx("img",{className:"account-avatar-image",src:v,alt:"","aria-hidden":"true",referrerPolicy:"no-referrer",onError:()=>f(v)}):null}),o.jsxs("div",{className:"account-id",children:[o.jsxs("div",{className:"account-name-row",children:[o.jsx("div",{className:"account-name",children:h}),o.jsx(Lo,{color:"secondary",size:"sm",variant:"soft",pill:!0,children:c(`sidebar:${Cdt[t.role]}`)})]}),m&&m!==h&&o.jsx("div",{className:"account-sub",children:m})]})]}),o.jsxs(Pr.Item,{className:"account-menu-action",onSelect:s,children:[o.jsx(Vf,{className:"icon","aria-hidden":"true"}),c("sidebar:account.systemInfo")]}),o.jsxs(Pr.Sub,{children:[o.jsx(Pr.SubTrigger,{className:"account-menu-action",children:o.jsxs("span",{className:"account-menu-action__label",children:[o.jsx(Sdt,{className:"icon"}),c("sidebar:account.language")]})}),o.jsx(Pr.SubContent,{sideOffset:6,minWidth:136,children:o.jsx(Pr.RadioGroup,{value:y,onChange:x=>{Zze(x)},indicatorPosition:"end",children:D9.map(x=>o.jsx(Pr.RadioItem,{value:x,children:c(`common:languageNames.${x}`)},x))})})]}),o.jsxs(Pr.Item,{className:"account-menu-action",onSelect:a,children:[o.jsx(Fje,{className:"icon"}),c("sidebar:account.issueFeedback")]}),o.jsxs(Pr.Item,{className:"account-menu-action",onSelect:l,children:[o.jsx(irt,{className:"icon","aria-hidden":"true"}),c("sidebar:account.logout")]})]})]}),o.jsxs("div",{className:"sidebar-user-shortcuts","aria-label":c("sidebar:account.shortcuts"),children:[o.jsx(po,{compact:!0,content:c("sidebar:account.tryCli"),children:o.jsx("button",{type:"button",className:"sidebar-user-shortcut",onClick:i,"aria-label":c("sidebar:account.tryCli"),children:o.jsx(wit,{className:"icon"})})}),o.jsx(po,{compact:!0,content:c("sidebar:account.developerResources"),children:o.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:o.jsx(cit,{className:"icon"})})})]})]})})}function Adt({branding:e,cloudProvider:t,sessions:n,currentSessionId:i,activePage:r,features:s,access:a,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:N,onDeleteSession:A,userInfo:j,onLogout:T}){const{t:R}=_e("sidebar"),_=H=>(s==null?void 0:s[H])!==!1,D=a.role==="admin"||a.role==="super_admin",M=a.capabilities.manageUsers&&!!C,[P,L]=p.useState(null),F=p.useRef(typeof window<"u"&&window.matchMedia($Z).matches),[I,z]=p.useState(F.current),K=n.map(H=>({id:H.id,title:yP(H.events,R("history.newConversation")),createdAt:(H.lastUpdateTime??0)*1e3})).sort((H,X)=>X.createdAt-H.createdAt),B=()=>{F.current=!1,z(H=>!H),L(null)};p.useEffect(()=>{const H=window.matchMedia($Z),X=ie=>{ie.matches?z(Q=>Q||(F.current=!0,!0)):F.current&&(F.current=!1,z(!1))};return H.addEventListener("change",X),()=>H.removeEventListener("change",X)},[]);const W=t==="byteplus"?sz:_P;return o.jsxs("aside",{className:`sidebar ${I?"is-collapsed":""}`,children:[o.jsxs("div",{className:"sidebar-top",children:[o.jsxs("div",{className:"sidebar-brand-row",children:[o.jsxs("button",{type:"button",className:"brand",onClick:d,"aria-label":R("navigation.home"),title:R("navigation.home"),children:[o.jsx("img",{className:"brand-logo",src:e.logoUrl||W,width:20,height:20,alt:"","aria-hidden":!0}),o.jsx("span",{className:"brand-title",children:e.title})]}),o.jsx("button",{type:"button",className:"sidebar-collapse-toggle",onClick:B,"aria-label":R(I?"navigation.expand":"navigation.collapse"),title:R(I?"navigation.expand":"navigation.collapse"),children:I?o.jsx(udt,{className:"icon"}):o.jsx(cdt,{className:"icon"})})]}),o.jsxs("nav",{className:"sidebar-nav","aria-label":R("navigation.label"),children:[_("newChat")&&o.jsxs("button",{className:`new-chat new-chat--conversation${r==="new-chat"?" is-active":""}`,onClick:d,"aria-label":R("navigation.newChat"),"aria-current":r==="new-chat"?"page":void 0,title:R("navigation.newChat"),children:[o.jsx(ddt,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:R("navigation.newChat")})]}),_("search")&&o.jsx(gdt,{active:r==="search",onClick:f}),o.jsxs("button",{className:`new-chat new-chat--agents${r==="agents"?" is-active":""}`,onClick:v,"aria-label":R("navigation.agents"),"aria-current":r==="agents"?"page":void 0,title:R("navigation.agents"),children:[o.jsx(hdt,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:R("navigation.agents")})]}),o.jsxs("button",{className:`new-chat new-chat--workspaces${r==="workspaces"?" is-active":""}`,onClick:y,"aria-label":R("navigation.workspaces"),"aria-current":r==="workspaces"?"page":void 0,title:R("navigation.workspaces"),children:[o.jsx(Lit,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:R("navigation.workspaces")})]}),o.jsxs("button",{className:`new-chat new-chat--library${r==="library"?" is-active":""}`,onClick:m,"aria-label":R("navigation.library"),"aria-current":r==="library"?"page":void 0,title:R("navigation.library"),children:[o.jsx(Lje,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:R("navigation.library")})]}),o.jsxs("button",{className:`new-chat new-chat--cronjobs${r==="cronjobs"?" is-active":""}`,onClick:w,"aria-label":R("navigation.cronjobs"),"aria-current":r==="cronjobs"?"page":void 0,title:R("navigation.cronjobs"),children:[o.jsx(pQ,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:R("navigation.cronjobs")})]}),o.jsxs("button",{className:`new-chat new-chat--applications${r==="applications"?" is-active":""}`,onClick:x,"aria-label":R("navigation.automations"),"aria-current":r==="applications"?"page":void 0,title:R("navigation.automations"),children:[o.jsx(kdt,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:R("navigation.automations")})]})]}),D||M?o.jsxs("nav",{className:"sidebar-nav sidebar-nav--administration","aria-label":R("navigation.administration"),children:[o.jsx("div",{className:"sidebar-nav-group-title","aria-hidden":"true",children:R("navigation.administration")}),D?o.jsxs("button",{type:"button",className:`new-chat new-chat--review-center${r==="review-center"?" is-active":""}`,onClick:g,"aria-label":R("navigation.reviewCenter"),"aria-current":r==="review-center"?"page":void 0,title:R("navigation.reviewCenter"),children:[o.jsx(Odt,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:R("navigation.reviewCenter")})]}):null,M?o.jsxs("button",{type:"button",className:`new-chat${r==="users"?" is-active":""}`,onClick:C,"aria-label":R("navigation.users"),"aria-current":r==="users"?"page":void 0,title:R("navigation.users"),children:[o.jsx(Hrt,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:R("navigation.users")})]}):null]}):null]}),_("history")&&o.jsxs("div",{className:"sidebar-history",children:[o.jsxs("div",{className:"history-head",children:[o.jsx("span",{children:R("history.title")}),_("newChat")&&o.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":R("history.create"),title:R("history.create"),children:o.jsx(_l,{className:"icon"})})]}),o.jsx("div",{className:"history-list",children:u?o.jsxs(o.Fragment,{children:[u.loading&&u.threads.length===0?o.jsx("div",{className:"history-empty",role:"status",children:R("history.loading")}):null,u.error?o.jsx("div",{className:"history-error",role:"alert",children:u.error}):null,!u.loading&&!u.error&&u.threads.length===0?o.jsx("div",{className:"history-empty",children:R("history.empty")}):null,u.threads.map(H=>{const X=H.id===u.currentThreadId,ie=H.name||H.preview||`Thread ${H.id.slice(0,8)}`,Q=H.id===u.busyThreadId;return o.jsxs("div",{className:`history-item ${X?"active":""}`,children:[o.jsxs("button",{type:"button",className:"history-item-btn",onClick:()=>u.onSelect(H.id),"aria-current":X?"page":void 0,title:ie,disabled:Q,children:[o.jsx(FZ,{title:ie}),X?o.jsx("span",{className:"history-current-badge",children:R("history.current")}):null]}),o.jsx("button",{type:"button",className:"history-more","aria-label":R("history.manage",{title:ie}),title:R("history.more"),disabled:Q,onClick:()=>L(Z=>Z===H.id?null:H.id),children:o.jsx(oZ,{className:"icon"})}),P===H.id?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"menu-scrim",onClick:()=>L(null)}),o.jsx("div",{className:"history-menu",children:o.jsxs("button",{type:"button",className:"menu-item menu-item--danger",onClick:()=>{L(null),u.onDelete(H)},children:[o.jsx(ag,{className:"icon"})," ",R("history.delete")]})})]}):null]},H.id)}),u.hasMore?o.jsx("button",{type:"button",className:"history-load-more",disabled:u.loading,onClick:u.onLoadMore,children:u.loading?R("history.loadingMore"):R("history.loadMore")}):null]}):o.jsxs(o.Fragment,{children:[K.length===0?o.jsx("div",{className:"history-empty",children:R("history.empty")}):null,K.map(H=>{const X=H.id===i,ie=(l==null?void 0:l.has(H.id))===!0,Q=!ie&&(c==null?void 0:c.has(H.id))===!0;return o.jsxs("div",{className:`history-item ${X?"active":""}`,children:[o.jsxs("button",{className:"history-item-btn",onClick:()=>N(H.id),"aria-current":X?"page":void 0,title:H.title,children:[o.jsx(FZ,{title:H.title}),Q&&o.jsxs("span",{className:"history-evaluating-status",title:R("history.evaluatingTitle"),children:[o.jsx("span",{className:"history-evaluating","aria-hidden":"true"}),R("history.evaluating")]})]}),o.jsxs("div",{className:"history-action-slot",children:[ie?o.jsx(jC,{className:"history-streaming-indicator",size:12,role:"status","aria-label":R("history.generating")}):null,o.jsx("button",{type:"button",className:"history-more","aria-label":R("history.manage",{title:H.title}),title:R("history.more"),onClick:()=>L(Z=>Z===H.id?null:H.id),children:o.jsx(oZ,{className:"icon"})})]}),P===H.id&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"menu-scrim",onClick:()=>L(null)}),o.jsx("div",{className:"history-menu",children:o.jsxs("button",{type:"button",className:"menu-item menu-item--danger",onClick:()=>{L(null),A(H.id)},children:[o.jsx(ag,{className:"icon"})," ",R("history.delete")]})})]})]},H.id)})]})})]}),o.jsx("div",{className:"sidebar-footer",children:o.jsx(Tdt,{activePage:r,access:a,userInfo:j,onAgentKitCli:O,onDeveloperResources:S,onSystemInfo:k,onIssueFeedback:E,onLogout:T})})]})}function Fo(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,i;n{}};function jP(){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}})}X_.prototype=jP.prototype={constructor:X_,on:function(e,t){var n=this._,i=jdt(e+"",n),r,s=-1,a=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)),UZ.hasOwnProperty(t)?{space:UZ[t],local:e}:e}function Rdt(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===LF&&t.documentElement.namespaceURI===LF?t.createElement(e):t.createElementNS(n,e)}}function Idt(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Bje(e){var t=NP(e);return(t.local?Idt:Rdt)(t)}function Pdt(){}function oz(e){return e==null?Pdt:function(){return this.querySelector(e)}}function Ddt(e){typeof e!="function"&&(e=oz(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;)(a=i[r])&&(s&&a.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(a,s),s=a);return this}function oft(e){e||(e=aft);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 lft(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function cft(){return Array.from(this)}function uft(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?wft:typeof t=="function"?kft:Oft)(e,t,n??"")):tw(this.node(),e)}function tw(e,t){return e.style.getPropertyValue(t)||Hje(e).getComputedStyle(e,null).getPropertyValue(t)}function Eft(e){return function(){delete this[e]}}function Cft(e,t){return function(){this[e]=t}}function Tft(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Aft(e,t){return arguments.length>1?this.each((t==null?Eft:typeof t=="function"?Tft:Cft)(e,t)):this.node()[e]}function qje(e){return e.trim().split(/^|\s+/)}function az(e){return e.classList||new Wje(e)}function Wje(e){this._node=e,this._names=qje(e.getAttribute("class")||"")}Wje.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 Kje(e,t){for(var n=az(e),i=-1,r=t.length;++i=0&&(n=t.slice(i+1),t=t.slice(0,i)),{type:t,name:n}})}function nht(e){return function(){var t=this.__on;if(t){for(var n=0,i=-1,r=t.length,s;n()=>e;function $F(e,{sourceEvent:t,subject:n,target:i,identifier:r,active:s,x:a,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:a,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}})}$F.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function fht(e){return!e.ctrlKey&&!e.button}function hht(){return this.parentNode}function pht(e,t){return t??{x:e.x,y:e.y}}function mht(){return navigator.maxTouchPoints||"ontouchstart"in this}function eNe(){var e=fht,t=hht,n=pht,i=mht,r={},s=jP("start","drag","end"),a=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,dht).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&&(qc(O.view).on("mousemove.drag",g,rE).on("mouseup.drag",b,rE),Zje(O.view),vL(O),u=!1,l=O.clientX,c=O.clientY,k("start",O))}}function g(O){if(cx(O),!u){var S=O.clientX-l,k=O.clientY-c;u=S*S+k*k>f}r.mouse("drag",O)}function b(O){qc(O.view).on("mousemove.drag mouseup.drag",null),Jje(O.view,u),cx(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,N,A;for(N=0;N>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?q2(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?q2(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=bht.exec(e))?new rc(t[1],t[2],t[3],1):(t=yht.exec(e))?new rc(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=vht.exec(e))?q2(t[1],t[2],t[3],t[4]):(t=xht.exec(e))?q2(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=wht.exec(e))?KZ(t[1],t[2]/100,t[3]/100,1):(t=Oht.exec(e))?KZ(t[1],t[2]/100,t[3]/100,t[4]):QZ.hasOwnProperty(e)?HZ(QZ[e]):e==="transparent"?new rc(NaN,NaN,NaN,0):null}function HZ(e){return new rc(e>>16&255,e>>8&255,e&255,1)}function q2(e,t,n,i){return i<=0&&(e=t=n=NaN),new rc(e,t,n,i)}function Eht(e){return e instanceof BC||(e=Oy(e)),e?(e=e.rgb(),new rc(e.r,e.g,e.b,e.opacity)):new rc}function FF(e,t,n,i){return arguments.length===1?Eht(e):new rc(e,t,n,i??1)}function rc(e,t,n,i){this.r=+e,this.g=+t,this.b=+n,this.opacity=+i}lz(rc,FF,tNe(BC,{brighter(e){return e=e==null?LN:Math.pow(LN,e),new rc(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?sE:Math.pow(sE,e),new rc(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new rc(ny(this.r),ny(this.g),ny(this.b),$N(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:qZ,formatHex:qZ,formatHex8:Cht,formatRgb:WZ,toString:WZ}));function qZ(){return`#${Mb(this.r)}${Mb(this.g)}${Mb(this.b)}`}function Cht(){return`#${Mb(this.r)}${Mb(this.g)}${Mb(this.b)}${Mb((isNaN(this.opacity)?1:this.opacity)*255)}`}function WZ(){const e=$N(this.opacity);return`${e===1?"rgb(":"rgba("}${ny(this.r)}, ${ny(this.g)}, ${ny(this.b)}${e===1?")":`, ${e})`}`}function $N(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ny(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Mb(e){return e=ny(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 Od(e,t,n,i)}function nNe(e){if(e instanceof Od)return new Od(e.h,e.s,e.l,e.opacity);if(e instanceof BC||(e=Oy(e)),!e)return new Od;if(e instanceof Od)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),a=NaN,l=s-r,c=(s+r)/2;return l?(t===s?a=(n-i)/l+(n0&&c<1?0:a,new Od(a,l,c,e.opacity)}function Tht(e,t,n,i){return arguments.length===1?nNe(e):new Od(e,t,n,i??1)}function Od(e,t,n,i){this.h=+e,this.s=+t,this.l=+n,this.opacity=+i}lz(Od,Tht,tNe(BC,{brighter(e){return e=e==null?LN:Math.pow(LN,e),new Od(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?sE:Math.pow(sE,e),new Od(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 rc(xL(e>=240?e-240:e+120,r,i),xL(e,r,i),xL(e<120?e+240:e-120,r,i),this.opacity)},clamp(){return new Od(GZ(this.h),W2(this.s),W2(this.l),$N(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=$N(this.opacity);return`${e===1?"hsl(":"hsla("}${GZ(this.h)}, ${W2(this.s)*100}%, ${W2(this.l)*100}%${e===1?")":`, ${e})`}`}}));function GZ(e){return e=(e||0)%360,e<0?e+360:e}function W2(e){return Math.max(0,Math.min(1,e||0))}function xL(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 RP=e=>()=>e;function iNe(e,t){return function(n){return e+n*t}}function Aht(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 ccn(e,t){var n=t-e;return n?iNe(e,n>180||n<-180?n-360*Math.round(n/360):n):RP(isNaN(e)?t:e)}function _ht(e){return(e=+e)==1?rNe:function(t,n){return n-t?Aht(t,n,e):RP(isNaN(t)?n:t)}}function rNe(e,t){var n=t-e;return n?iNe(e,n):RP(isNaN(e)?t:e)}const FN=function e(t){var n=_ht(t);function i(r,s){var a=n((r=FF(r)).r,(s=FF(s)).r),l=n(r.g,s.g),c=n(r.b,s.b),u=rNe(r.opacity,s.opacity);return function(d){return r.r=a(d),r.g=l(d),r.b=c(d),r.opacity=u(d),r+""}}return i.gamma=e,i}(1);function jht(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[a]?l[a]+=s:l[++a]=s),(i=i[0])===(r=r[0])?l[a]?l[a]+=r:l[++a]=r:(l[++a]=null,c.push({i:a,x:df(i,r)})),n=wL.lastIndex;return n180?d+=360:d-u>180&&(u+=360),h.push({i:f.push(r(f)+"rotate(",null,i)-2,x:df(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:df(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:df(u,f)},{i:b-2,x:df(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),a(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;--nw}function ZZ(){ky=(UN=aE.now())+IP,nw=JO=0;try{Hht()}finally{nw=0,Wht(),ky=0}}function qht(){var e=aE.now(),t=e-UN;t>lNe&&(IP-=t,UN=e)}function Wht(){for(var e,t=BN,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:BN=n);ek=e,QF(i)}function QF(e){if(!nw){JO&&(JO=clearTimeout(JO));var t=e-ky;t>24?(e<1/0&&(JO=setTimeout(ZZ,e-aE.now()-IP)),lO&&(lO=clearInterval(lO))):(lO||(UN=aE.now(),lO=setInterval(qht,lNe)),nw=1,cNe(ZZ))}}function JZ(e,t,n){var i=new QN;return t=t==null?0:+t,i.restart(r=>{i.stop(),e(r+t)},t,n),i}var Kht=jP("start","end","cancel","interrupt"),Ght=[],dNe=0,eJ=1,zF=2,Z_=3,tJ=4,VF=5,J_=6;function PP(e,t,n,i,r,s){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;Xht(e,n,{name:t,index:i,group:r,on:Kht,tween:Ght,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:dNe})}function uz(e,t){var n=Ud(e,t);if(n.state>dNe)throw new Error("too late; already scheduled");return n}function qf(e,t){var n=Ud(e,t);if(n.state>Z_)throw new Error("too late; already running");return n}function Ud(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Xht(e,t,n){var i=e.__transition,r;i[t]=n,n.timer=uNe(s,0,n.time);function s(u){n.state=eJ,n.timer.restart(a,n.delay,n.time),n.delay<=u&&a(u-n.delay)}function a(u){var d,f,h,m;if(n.state!==eJ)return c();for(d in i)if(m=i[d],m.name===n.name){if(m.state===Z_)return JZ(a);m.state===tJ?(m.state=J_,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete i[d]):+dzF&&i.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function Cpt(e,t,n){var i,r,s=Ept(t)?uz:qf;return function(){var a=s(this,e),l=a.on;l!==i&&(r=(i=l).copy()).on(t,n),a.on=r}}function Tpt(e,t){var n=this._id;return arguments.length<2?Ud(this.node(),n).on.on(e):this.each(Cpt(n,e,t))}function Apt(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function _pt(){return this.on("end.remove",Apt(this._id))}function jpt(e){var t=this._name,n=this._id;typeof e!="function"&&(e=oz(e));for(var i=this._groups,r=i.length,s=new Array(r),a=0;a()=>e;function tmt(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 Fh(e,t,n){this.k=e,this.x=t,this.y=n}Fh.prototype={constructor:Fh,scale:function(e){return e===1?this:new Fh(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Fh(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 DP=new Fh(1,0,0);mNe.prototype=Fh.prototype;function mNe(e){for(;!e.__zoom;)if(!(e=e.parentNode))return DP;return e.__zoom}function OL(e){e.stopImmediatePropagation()}function cO(e){e.preventDefault(),e.stopImmediatePropagation()}function nmt(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function imt(){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 nJ(){return this.__zoom||DP}function rmt(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function smt(){return navigator.maxTouchPoints||"ontouchstart"in this}function omt(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],a=e.invertY(t[1][1])-n[1][1];return e.translate(r>i?(i+r)/2:Math.min(0,i)||Math.max(0,r),a>s?(s+a)/2:Math.min(0,s)||Math.max(0,a))}function gNe(){var e=nmt,t=imt,n=omt,i=rmt,r=smt,s=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],l=250,c=Y_,u=jP("start","zoom","end"),d,f,h,m=500,g=150,b=0,v=10;function y(_){_.property("__zoom",nJ).on("wheel.zoom",E,{passive:!1}).on("mousedown.zoom",N).on("dblclick.zoom",A).filter(r).on("touchstart.zoom",j).on("touchmove.zoom",T).on("touchend.zoom touchcancel.zoom",R).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}y.transform=function(_,D,M,P){var L=_.selection?_.selection():_;L.property("__zoom",nJ),_!==L?S(_,D,M,P):L.interrupt().each(function(){k(this,arguments).event(P).start().zoom(null,typeof D=="function"?D.apply(this,arguments):D).end()})},y.scaleBy=function(_,D,M,P){y.scaleTo(_,function(){var L=this.__zoom.k,F=typeof D=="function"?D.apply(this,arguments):D;return L*F},M,P)},y.scaleTo=function(_,D,M,P){y.transform(_,function(){var L=t.apply(this,arguments),F=this.__zoom,I=M==null?O(L):typeof M=="function"?M.apply(this,arguments):M,z=F.invert(I),K=typeof D=="function"?D.apply(this,arguments):D;return n(w(x(F,K),I,z),L,a)},M,P)},y.translateBy=function(_,D,M,P){y.transform(_,function(){return n(this.__zoom.translate(typeof D=="function"?D.apply(this,arguments):D,typeof M=="function"?M.apply(this,arguments):M),t.apply(this,arguments),a)},null,P)},y.translateTo=function(_,D,M,P,L){y.transform(_,function(){var F=t.apply(this,arguments),I=this.__zoom,z=P==null?O(F):typeof P=="function"?P.apply(this,arguments):P;return n(DP.translate(z[0],z[1]).scale(I.k).translate(typeof D=="function"?-D.apply(this,arguments):-D,typeof M=="function"?-M.apply(this,arguments):-M),F,a)},P,L)};function x(_,D){return D=Math.max(s[0],Math.min(s[1],D)),D===_.k?_:new Fh(D,_.x,_.y)}function w(_,D,M){var P=D[0]-M[0]*_.k,L=D[1]-M[1]*_.k;return P===_.x&&L===_.y?_:new Fh(_.k,P,L)}function O(_){return[(+_[0][0]+ +_[1][0])/2,(+_[0][1]+ +_[1][1])/2]}function S(_,D,M,P){_.on("start.zoom",function(){k(this,arguments).event(P).start()}).on("interrupt.zoom end.zoom",function(){k(this,arguments).event(P).end()}).tween("zoom",function(){var L=this,F=arguments,I=k(L,F).event(P),z=t.apply(L,F),K=M==null?O(z):typeof M=="function"?M.apply(L,F):M,B=Math.max(z[1][0]-z[0][0],z[1][1]-z[0][1]),W=L.__zoom,H=typeof D=="function"?D.apply(L,F):D,X=c(W.invert(K).concat(B/W.k),H.invert(K).concat(B/H.k));return function(ie){if(ie===1)ie=H;else{var Q=X(ie),Z=B/Q[2];ie=new Fh(Z,K[0]-Q[0]*Z,K[1]-Q[1]*Z)}I.zoom(null,ie)}})}function k(_,D,M){return!M&&_.__zooming||new C(_,D)}function C(_,D){this.that=_,this.args=D,this.active=0,this.sourceEvent=null,this.extent=t.apply(_,D),this.taps=0}C.prototype={event:function(_){return _&&(this.sourceEvent=_),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(_,D){return this.mouse&&_!=="mouse"&&(this.mouse[1]=D.invert(this.mouse[0])),this.touch0&&_!=="touch"&&(this.touch0[1]=D.invert(this.touch0[0])),this.touch1&&_!=="touch"&&(this.touch1[1]=D.invert(this.touch1[0])),this.that.__zoom=D,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(_){var D=qc(this.that).datum();u.call(_,this.that,new tmt(_,{sourceEvent:this.sourceEvent,target:y,transform:this.that.__zoom,dispatch:u}),D)}};function E(_,...D){if(!e.apply(this,arguments))return;var M=k(this,D).event(_),P=this.__zoom,L=Math.max(s[0],Math.min(s[1],P.k*Math.pow(2,i.apply(this,arguments)))),F=yd(_);if(M.wheel)(M.mouse[0][0]!==F[0]||M.mouse[0][1]!==F[1])&&(M.mouse[1]=P.invert(M.mouse[0]=F)),clearTimeout(M.wheel);else{if(P.k===L)return;M.mouse=[F,P.invert(F)],ej(this),M.start()}cO(_),M.wheel=setTimeout(I,g),M.zoom("mouse",n(w(x(P,L),M.mouse[0],M.mouse[1]),M.extent,a));function I(){M.wheel=null,M.end()}}function N(_,...D){if(h||!e.apply(this,arguments))return;var M=_.currentTarget,P=k(this,D,!0).event(_),L=qc(_.view).on("mousemove.zoom",K,!0).on("mouseup.zoom",B,!0),F=yd(_,M),I=_.clientX,z=_.clientY;Zje(_.view),OL(_),P.mouse=[F,this.__zoom.invert(F)],ej(this),P.start();function K(W){if(cO(W),!P.moved){var H=W.clientX-I,X=W.clientY-z;P.moved=H*H+X*X>b}P.event(W).zoom("mouse",n(w(P.that.__zoom,P.mouse[0]=yd(W,M),P.mouse[1]),P.extent,a))}function B(W){L.on("mousemove.zoom mouseup.zoom",null),Jje(W.view,P.moved),cO(W),P.event(W).end()}}function A(_,...D){if(e.apply(this,arguments)){var M=this.__zoom,P=yd(_.changedTouches?_.changedTouches[0]:_,this),L=M.invert(P),F=M.k*(_.shiftKey?.5:2),I=n(w(x(M,F),P,L),t.apply(this,D),a);cO(_),l>0?qc(this).transition().duration(l).call(S,I,P,_):qc(this).call(y.transform,I,P,_)}}function j(_,...D){if(e.apply(this,arguments)){var M=_.touches,P=M.length,L=k(this,D,_.changedTouches.length===P).event(_),F,I,z,K;for(OL(_),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.`},lE=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],bNe=["Enter"," ","Escape"],yNe={"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 iw;(function(e){e.Strict="strict",e.Loose="loose"})(iw||(iw={}));var iy;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(iy||(iy={}));var cE;(function(e){e.Partial="partial",e.Full="full"})(cE||(cE={}));const vNe={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var bm;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(bm||(bm={}));var uE;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(uE||(uE={}));var pn;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(pn||(pn={}));const iJ={[pn.Left]:pn.Right,[pn.Right]:pn.Left,[pn.Top]:pn.Bottom,[pn.Bottom]:pn.Top};function xNe(e){return e===null?null:e?"valid":"invalid"}const wNe=e=>"id"in e&&"source"in e&&"target"in e,amt=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),fz=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),UC=(e,t=[0,0])=>{const{width:n,height:i}=Ap(e),r=e.origin??t,s=n*r[0],a=i*r[1];return{x:e.position.x-s,y:e.position.y-a}},lmt=(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 a=!t.nodeLookup&&!s?r:void 0;t.nodeLookup&&(a=s?t.nodeLookup.get(r):fz(r)?r:t.nodeLookup.get(r.id));const l=a?zN(a,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return MP(i,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return LP(n)},QC=(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=MP(n,zN(r)),i=!0)}),i?LP(n):{x:0,y:0,width:0,height:0}},hz=(e,t,[n,i,r]=[0,0,1],s=!1,a=!1)=>{const l={...Yw(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(a&&!f||h)continue;const m=d.width??u.width??u.initialWidth??null,g=d.height??u.height??u.initialHeight??null,b=dE(l,sw(u)),v=(m??0)*(g??0),y=s&&b>0;(!u.internals.handleBounds||y||b>=v||u.dragging)&&c.push(u)}return c},cmt=(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 umt(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 dmt({nodes:e,width:t,height:n,panZoom:i,minZoom:r,maxZoom:s},a){if(e.size===0)return!0;const l=umt(e,a),c=QC(l),u=mz(c,t,n,(a==null?void 0:a.minZoom)??r,(a==null?void 0:a.maxZoom)??s,(a==null?void 0:a.padding)??.1);return await i.setViewport(u,{duration:a==null?void 0:a.duration,ease:a==null?void 0:a.ease,interpolate:a==null?void 0:a.interpolate}),!0}function ONe({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:i=[0,0],nodeExtent:r,onError:s}){const a=n.get(e),l=a.parentId?n.get(a.parentId):void 0,{x:c,y:u}=l?l.internals.positionAbsolute:{x:0,y:0},d=a.origin??i;let f=a.extent||r;if(a.extent==="parent"&&!a.expandParent)if(!l)s==null||s("005",Dd.error005());else{const m=l.measured.width,g=l.measured.height;m&&g&&(f=[[c,u],[c+m,u+g]])}else l&&Ey(a.extent)&&(f=[[a.extent[0][0]+c,a.extent[0][1]+u],[a.extent[1][0]+c,a.extent[1][1]+u]]);const h=Ey(f)?Sy(t,f,a.measured):t;return(a.measured.width===void 0||a.measured.height===void 0)&&(s==null||s("015",Dd.error015())),{position:{x:h.x-c+(a.measured.width??0)*d[0],y:h.y-u+(a.measured.height??0)*d[1]},positionAbsolute:h}}async function fmt({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:i,onBeforeDelete:r}){const s=new Set(e.map(h=>h.id)),a=[];for(const h of n){if(h.deletable===!1)continue;const m=s.has(h.id),g=!m&&h.parentId&&a.find(b=>b.id===h.parentId);(m||g)&&a.push(h)}const l=new Set(t.map(h=>h.id)),c=i.filter(h=>h.deletable!==!1),d=cmt(a,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:a};const f=await r({nodes:a,edges:d});return typeof f=="boolean"?f?{edges:d,nodes:a}:{edges:[],nodes:[]}:f}const rw=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Sy=(e={x:0,y:0},t,n)=>({x:rw(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:rw(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function kNe(e,t,n){const{width:i,height:r}=Ap(n),{x:s,y:a}=n.internals.positionAbsolute;return Sy(e,[[s,a],[s+i,a+r]],t)}const rJ=(e,t,n)=>en?-rw(Math.abs(e-n),1,t)/t:0,pz=(e,t,n=15,i=40)=>{const r=rJ(e.x,i,t.width-i)*n,s=rJ(e.y,i,t.height-i)*n;return[r,s]},MP=(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)}),HF=({x:e,y:t,width:n,height:i})=>({x:e,y:t,x2:e+n,y2:t+i}),LP=({x:e,y:t,x2:n,y2:i})=>({x:e,y:t,width:n-e,height:i-t}),sw=(e,t=[0,0])=>{var r,s;const{x:n,y:i}=fz(e)?e.internals.positionAbsolute:UC(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}},zN=(e,t=[0,0])=>{var r,s;const{x:n,y:i}=fz(e)?e.internals.positionAbsolute:UC(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)}},SNe=(e,t)=>LP(MP(HF(e),HF(t))),dE=(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)},sJ=e=>Sd(e.width)&&Sd(e.height)&&Sd(e.x)&&Sd(e.y),Sd=e=>!isNaN(e)&&isFinite(e),ENe=(e,t)=>(n,i)=>{},zC=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Yw=({x:e,y:t},[n,i,r],s=!1,a=[1,1])=>{const l={x:(e-n)/r,y:(t-i)/r};return s?zC(l,a):l},ow=({x:e,y:t},[n,i,r])=>({x:e*r+n,y:t*r+i});function z0(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 hmt(e,t,n){if(typeof e=="string"||typeof e=="number"){const i=z0(e,n),r=z0(e,t);return{top:i,right:r,bottom:i,left:r,x:r*2,y:i*2}}if(typeof e=="object"){const i=z0(e.top??e.y??0,n),r=z0(e.bottom??e.y??0,n),s=z0(e.left??e.x??0,t),a=z0(e.right??e.x??0,t);return{top:i,right:a,bottom:r,left:s,x:s+a,y:i+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function pmt(e,t,n,i,r,s){const{x:a,y:l}=ow(e,[t,n,i]),{x:c,y:u}=ow({x:e.x+e.width,y:e.y+e.height},[t,n,i]),d=r-c,f=s-u;return{left:Math.floor(a),top:Math.floor(l),right:Math.floor(d),bottom:Math.floor(f)}}const mz=(e,t,n,i,r,s)=>{const a=hmt(s,t,n),l=(t-a.x)/e.width,c=(n-a.y)/e.height,u=Math.min(l,c),d=rw(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=pmt(e,m,g,d,t,n),v={left:Math.min(b.left-a.left,0),top:Math.min(b.top-a.top,0),right:Math.min(b.right-a.right,0),bottom:Math.min(b.bottom-a.bottom,0)};return{x:m-v.left+v.right,y:g-v.top+v.bottom,zoom:d}},fE=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Ey(e){return e!=null&&e!=="parent"}function Ap(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 gz(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 CNe(e,t={width:0,height:0},n,i,r){const s={...e},a=i.get(n);if(a){const l=a.origin||r;s.x+=a.internals.positionAbsolute.x-(t.width??0)*l[0],s.y+=a.internals.positionAbsolute.y-(t.height??0)*l[1]}return s}function oJ(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function mmt(){let e,t;return{promise:new Promise((i,r)=>{e=i,t=r}),resolve:e,reject:t}}function gmt(e){return{...yNe,...e||{}}}function Wk(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:i,containerBounds:r}){const{x:s,y:a}=Ed(e),l=Yw({x:s-((r==null?void 0:r.left)??0),y:a-((r==null?void 0:r.top)??0)},i),{x:c,y:u}=n?zC(l,t):l;return{xSnapped:c,ySnapped:u,...l}}const bz=e=>({width:e.offsetWidth,height:e.offsetHeight}),TNe=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},bmt=["INPUT","SELECT","TEXTAREA"];function ANe(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:bmt.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const _Ne=e=>"clientX"in e,Ed=(e,t)=>{var s,a;const n=_Ne(e),i=n?e.clientX:(s=e.touches)==null?void 0:s[0].clientX,r=n?e.clientY:(a=e.touches)==null?void 0:a[0].clientY;return{x:i-((t==null?void 0:t.left)??0),y:r-((t==null?void 0:t.top)??0)}},aJ=(e,t,n,i,r)=>{const s=t.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(a=>{const l=a.getBoundingClientRect();return{id:a.getAttribute("data-handleid"),type:e,nodeId:r,position:a.getAttribute("data-handlepos"),x:(l.left-n.left)/i,y:(l.top-n.top)/i,...bz(a)}})};function jNe({sourceX:e,sourceY:t,targetX:n,targetY:i,sourceControlX:r,sourceControlY:s,targetControlX:a,targetControlY:l}){const c=e*.125+r*.375+a*.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 X2(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function lJ({pos:e,x1:t,y1:n,x2:i,y2:r,c:s}){switch(e){case pn.Left:return[t-X2(t-i,s),n];case pn.Right:return[t+X2(i-t,s),n];case pn.Top:return[t,n-X2(n-r,s)];case pn.Bottom:return[t,n+X2(r-n,s)]}}function NNe({sourceX:e,sourceY:t,sourcePosition:n=pn.Bottom,targetX:i,targetY:r,targetPosition:s=pn.Top,curvature:a=.25}){const[l,c]=lJ({pos:n,x1:e,y1:t,x2:i,y2:r,c:a}),[u,d]=lJ({pos:s,x1:i,y1:r,x2:e,y2:t,c:a}),[f,h,m,g]=jNe({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 RNe({sourceX:e,sourceY:t,targetX:n,targetY:i}){const r=Math.abs(n-e)/2,s=n0}const xmt=({source:e,sourceHandle:t,target:n,targetHandle:i})=>`xy-edge__${e}${t||""}-${n}${i||""}`,wmt=(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)),Omt=(e,t,n={})=>{var s;if(!e.source||!e.target)return(s=n.onError)==null||s.call(n,"006",Dd.error006()),t;const i=n.getEdgeId||xmt;let r;return wNe(e)?r={...e}:r={...e,id:i(e)},wmt(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function INe({sourceX:e,sourceY:t,targetX:n,targetY:i}){const[r,s,a,l]=RNe({sourceX:e,sourceY:t,targetX:n,targetY:i});return[`M ${e},${t}L ${n},${i}`,r,s,a,l]}const cJ={[pn.Left]:{x:-1,y:0},[pn.Right]:{x:1,y:0},[pn.Top]:{x:0,y:-1},[pn.Bottom]:{x:0,y:1}},kmt=({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 Smt({source:e,sourcePosition:t=pn.Bottom,target:n,targetPosition:i=pn.Top,center:r,offset:s,stepPosition:a}){const l=cJ[t],c=cJ[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=kmt({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]=RNe({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)*a,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)*a);const E=[{x:b,y:u.y},{x:b,y:d.y}],N=[{x:u.x,y:v},{x:d.x,y:v}];l[h]===m?g=h==="x"?E:N:g=h==="x"?N:E}else{const E=[{x:u.x,y:d.y}],N=[{x:d.x,y:u.y}];if(h==="x"?g=l.x===m?N:E:g=l.y===m?E:N,t===i){const _=Math.abs(e[h]-n[h]);if(_<=s){const D=Math.min(s-1,s-_);l[h]===m?y[h]=(u[h]>e[h]?-1:1)*D:x[h]=(d[h]>n[h]?-1:1)*D}}if(t!==i){const _=h==="x"?"y":"x",D=l[h]===c[_],M=u[_]>d[_],P=u[_]=R?(b=(A.x+j.x)/2,v=g[0].y):(b=g[0].x,v=(A.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 Emt(e,t,n,i){const r=Math.min(uJ(e,t)/2,uJ(t,n)/2,i),{x:s,y:a}=t;if(e.x===s&&s===n.x||e.y===a&&a===n.y)return`L${s} ${a}`;if(e.y===a){const u=e.xn.id===t):e[0])||null}function qF(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(i=>`${i}=${e[i]}`).join("&")}`:""}function Tmt(e,{id:t,defaultColor:n,defaultMarkerStart:i,defaultMarkerEnd:r}){const s=new Set;return e.reduce((a,l)=>([l.markerStart||i,l.markerEnd||r].forEach(c=>{if(c&&typeof c=="object"){const u=qF(c,t);s.has(u)||(a.push({id:u,color:c.color||n,...c}),s.add(u))}}),a),[]).sort((a,l)=>a.id.localeCompare(l.id))}const PNe=1e3,Amt=10,yz={nodeOrigin:[0,0],nodeExtent:lE,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},_mt={...yz,checkEquality:!0};function vz(e,t){const n={...e};for(const i in t)t[i]!==void 0&&(n[i]=t[i]);return n}function jmt(e,t,n){const i=vz(yz,n);for(const r of e.values())if(r.parentId)wz(r,e,t,i);else{const s=UC(r,i.nodeOrigin),a=Ey(r.extent)?r.extent:i.nodeExtent,l=Sy(s,a,Ap(r));r.internals.positionAbsolute=l}}function Nmt(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 xz(e){return e==="manual"}function WF(e,t,n,i={}){var d,f;const r=vz(_mt,i),s={i:0},a=new Map(t),l=r!=null&&r.elevateNodesOnSelect&&!xz(r.zIndexMode)?PNe:0;let c=e.length>0,u=!1;t.clear(),n.clear();for(const h of e){let m=a.get(h.id);if(r.checkEquality&&h===(m==null?void 0:m.internals.userNode))t.set(h.id,m);else{const g=UC(h,r.nodeOrigin),b=Ey(h.extent)?h.extent:r.nodeExtent,v=Sy(g,b,Ap(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:Nmt(h,m),z:DNe(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&&wz(m,t,n,i,s),u||(u=h.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:u}}function Rmt(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 wz(e,t,n,i,r){const{elevateNodesOnSelect:s,nodeOrigin:a,nodeExtent:l,zIndexMode:c}=vz(yz,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}Rmt(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*Amt),r&&d.internals.rootParentIndex!==void 0&&(r.i=d.internals.rootParentIndex);const f=s&&!xz(c)?PNe:0,{x:h,y:m,z:g}=Imt(e,d,a,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 DNe(e,t,n){const i=Sd(e.zIndex)?e.zIndex:0;return xz(n)?i:i+(e.selected?t:0)}function Imt(e,t,n,i,r,s){const{x:a,y:l}=t.internals.positionAbsolute,c=Ap(e),u=UC(e,n),d=Ey(e.extent)?Sy(u,e.extent,c):u;let f=Sy({x:a+d.x,y:l+d.y},i,c);e.extent==="parent"&&(f=kNe(f,c,t));const h=DNe(e,r,s),m=t.internals.z??0;return{x:f.x,y:f.y,z:m>=h?m+1:h}}function Oz(e,t,n,i=[0,0]){var a;const r=[],s=new Map;for(const l of e){const c=t.get(l.parentId);if(!c)continue;const u=((a=s.get(l.parentId))==null?void 0:a.expandedRect)??sw(c),d=SNe(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=Ap(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=Oz(h,t,n,r);u.push(...m)}return{changes:u,updatedInternals:c}}async function Dmt({delta:e,panZoom:t,transform:n,translateExtent:i,width:r,height:s}){if(!t||!e.x&&!e.y)return!1;const a=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,s]],i);return!!a&&(a.x!==n[0]||a.y!==n[1]||a.k!==n[2])}function pJ(e,t,n,i,r,s){let a=r;const l=i.get(a)||new Map;i.set(a,l.set(n,t)),a=`${r}-${e}`;const c=i.get(a)||new Map;if(i.set(a,c.set(n,t)),s){a=`${r}-${e}-${s}`;const u=i.get(a)||new Map;i.set(a,u.set(n,t))}}function MNe(e,t,n){e.clear(),t.clear();for(const i of n){const{source:r,target:s,sourceHandle:a=null,targetHandle:l=null}=i,c={edgeId:i.id,source:r,target:s,sourceHandle:a,targetHandle:l},u=`${r}-${a}--${s}-${l}`,d=`${s}-${l}--${r}-${a}`;pJ("source",c,d,e,r,a),pJ("target",c,u,e,s,l),t.set(i.id,i)}}function LNe(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:LNe(n,t):!1}function mJ(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 Mmt(e,t,n,i){const r=new Map;for(const[s,a]of e)if((a.selected||a.id===i)&&(!a.parentId||!LNe(a,e))&&(a.draggable||t&&typeof a.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 kL({nodeId:e,dragItems:t,nodeLookup:n,dragging:i=!0}){var a,l,c;const r=[];for(const[u,d]of t){const f=(a=n.get(u))==null?void 0:a.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 Lmt({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},a=zC(s,t);return{x:a.x-s.x,y:a.y-s.y}}function $mt({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:i,onDragStop:r}){let s={x:null,y:null},a=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=qc(O);function E({x:T,y:R}){const{nodeLookup:_,nodeExtent:D,snapGrid:M,snapToGrid:P,nodeOrigin:L,onNodeDrag:F,onSelectionDrag:I,onError:z,updateNodePositions:K}=t();s={x:T,y:R};let B=!1;const W=l.size>1,H=W&&D?HF(QC(l)):null,X=W&&P?Lmt({dragItems:l,snapGrid:M,x:T,y:R}):null;for(const[ie,Q]of l){if(!_.has(ie))continue;let Z={x:T-Q.distance.x,y:R-Q.distance.y};P&&(Z=X?{x:Math.round(Z.x+X.x),y:Math.round(Z.y+X.y)}:zC(Z,M));let ue=null;if(W&&D&&!Q.extent&&H){const{positionAbsolute:G}=Q.internals,te=G.x-H.x+D[0][0],de=G.x+Q.measured.width-H.x2+D[1][0],Ce=G.y-H.y+D[0][1],le=G.y+Q.measured.height-H.y2+D[1][1];ue=[[te,Ce],[de,le]]}const{position:Ee,positionAbsolute:Y}=ONe({nodeId:ie,nextPosition:Z,nodeLookup:_,nodeExtent:ue||D,nodeOrigin:L,onError:z});B=B||Q.position.x!==Ee.x||Q.position.y!==Ee.y,Q.position=Ee,Q.internals.positionAbsolute=Y}if(g=g||B,!!B&&(K(l,!0),b&&(i||F||!k&&I))){const[ie,Q]=kL({nodeId:k,dragItems:l,nodeLookup:_});i==null||i(b,l,ie,Q),F==null||F(b,ie,Q),k||I==null||I(b,Q)}}async function N(){if(!d)return;const{transform:T,panBy:R,autoPanSpeed:_,autoPanOnNodeDrag:D}=t();if(!D){c=!1,cancelAnimationFrame(a);return}const[M,P]=pz(u,d,_);(M!==0||P!==0)&&(s.x=(s.x??0)-M/T[2],s.y=(s.y??0)-P/T[2],await R({x:M,y:P})&&E(s)),a=requestAnimationFrame(N)}function A(T){var W;const{nodeLookup:R,multiSelectionActive:_,nodesDraggable:D,transform:M,snapGrid:P,snapToGrid:L,selectNodesOnDrag:F,onNodeDragStart:I,onSelectionDragStart:z,unselectNodesAndEdges:K}=t();f=!0,(!F||!S)&&!_&&k&&((W=R.get(k))!=null&&W.selected||K()),S&&F&&k&&(e==null||e(k));const B=Wk(T.sourceEvent,{transform:M,snapGrid:P,snapToGrid:L,containerBounds:d});if(s=B,l=Mmt(R,D,B,k),l.size>0&&(n||I||!k&&z)){const[H,X]=kL({nodeId:k,dragItems:l,nodeLookup:R});n==null||n(T.sourceEvent,l,H,X),I==null||I(T.sourceEvent,H,X),k||z==null||z(T.sourceEvent,X)}}const j=eNe().clickDistance(C).on("start",T=>{const{domNode:R,nodeDragThreshold:_,transform:D,snapGrid:M,snapToGrid:P}=t();d=(R==null?void 0:R.getBoundingClientRect())||null,m=!1,g=!1,b=T.sourceEvent,_===0&&A(T),s=Wk(T.sourceEvent,{transform:D,snapGrid:M,snapToGrid:P,containerBounds:d}),u=Ed(T.sourceEvent,d)}).on("drag",T=>{const{autoPanOnNodeDrag:R,transform:_,snapGrid:D,snapToGrid:M,nodeDragThreshold:P,nodeLookup:L}=t(),F=Wk(T.sourceEvent,{transform:_,snapGrid:D,snapToGrid:M,containerBounds:d});if(b=T.sourceEvent,(T.sourceEvent.type==="touchmove"&&T.sourceEvent.touches.length>1||k&&!L.has(k))&&(m=!0),!m){if(!c&&R&&f&&(c=!0,N()),!f){const I=Ed(T.sourceEvent,d),z=I.x-u.x,K=I.y-u.y;Math.sqrt(z*z+K*K)>P&&A(T)}(s.x!==F.xSnapped||s.y!==F.ySnapped)&&l&&f&&(u=Ed(T.sourceEvent,d),E(F))}}).on("end",T=>{if(!f||m){m&&l.size>0&&t().updateNodePositions(l,!1);return}if(c=!1,f=!1,cancelAnimationFrame(a),l.size>0){const{nodeLookup:R,updateNodePositions:_,onNodeDragStop:D,onSelectionDragStop:M}=t();if(g&&(_(l,!1),g=!1),r||D||!k&&M){const[P,L]=kL({nodeId:k,dragItems:l,nodeLookup:R,dragging:!1});r==null||r(T.sourceEvent,l,P,L),D==null||D(T.sourceEvent,P,L),k||M==null||M(T.sourceEvent,L)}}}).filter(T=>{const R=T.target;return!T.button&&(!x||!mJ(R,`.${x}`,O))&&(!w||mJ(R,w,O))});h.call(j)}function y(){h==null||h.on(".drag",null)}return{update:v,destroy:y}}function Fmt(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())dE(r,sw(s))>0&&i.push(s);return i}const Bmt=250;function Umt(e,t,n,i){var l,c;let r=[],s=1/0;const a=Fmt(e,n,t+Bmt);for(const u of a){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}=Cy(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 $Ne(e,t,n,i,r,s=!1){var u,d,f;const a=i.get(e);if(!a)return null;const l=r==="strict"?(u=a.internals.handleBounds)==null?void 0:u[t]:[...((d=a.internals.handleBounds)==null?void 0:d.source)??[],...((f=a.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,...Cy(a,c,c.position,!0)}:c}function FNe(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Qmt(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const BNe=()=>!0;function zmt(e,{connectionMode:t,connectionRadius:n,handleId:i,nodeId:r,edgeUpdaterType:s,isTarget:a,domNode:l,nodeLookup:c,lib:u,autoPanOnConnect:d,flowId:f,panBy:h,cancelConnection:m,onConnectStart:g,onConnect:b,onConnectEnd:v,isValidConnection:y=BNe,onReconnectEnd:x,updateConnection:w,getTransform:O,getFromHandle:S,autoPanSpeed:k,dragThreshold:C=1,handleDomNode:E}){const N=TNe(e.target);let A=0,j;const{x:T,y:R}=Ed(e),_=FNe(s,E),D=l==null?void 0:l.getBoundingClientRect();let M=!1;if(!D||!_)return;const P=$Ne(r,_,i,c,t);if(!P)return;let L=Ed(e,D),F=!1,I=null,z=!1,K=null;function B(){if(!d||!D)return;const[Ee,Y]=pz(L,D,k);h({x:Ee,y:Y}),A=requestAnimationFrame(B)}const W={...P,nodeId:r,type:_,position:P.position},H=c.get(r);let ie={inProgress:!0,isValid:null,from:Cy(H,W,pn.Left,!0),fromHandle:W,fromPosition:W.position,fromNode:H,to:L,toHandle:null,toPosition:iJ[W.position],toNode:null,pointer:L};function Q(){M=!0,w(ie),g==null||g(e,{nodeId:r,handleId:i,handleType:_})}C===0&&Q();function Z(Ee){if(!M){const{x:le,y:fe}=Ed(Ee),re=le-T,Oe=fe-R;if(!(re*re+Oe*Oe>C*C))return;Q()}if(!S()||!W){ue(Ee);return}const Y=O();L=Ed(Ee,D),j=Umt(Yw(L,Y,!1,[1,1]),n,c,W),F||(B(),F=!0);const G=UNe(Ee,{handle:j,connectionMode:t,fromNodeId:r,fromHandleId:i,fromType:a?"target":"source",isValidConnection:y,doc:N,lib:u,flowId:f,nodeLookup:c});K=G.handleDomNode,I=G.connection,z=Qmt(!!j,G.isValid);const te=c.get(r),de=te?Cy(te,W,pn.Left,!0):ie.from,Ce={...ie,from:de,isValid:z,to:G.toHandle&&z?ow({x:G.toHandle.x,y:G.toHandle.y},Y):L,toHandle:G.toHandle,toPosition:z&&G.toHandle?G.toHandle.position:iJ[W.position],toNode:G.toHandle?c.get(G.toHandle.nodeId):null,pointer:L};w(Ce),ie=Ce}function ue(Ee){if(!("touches"in Ee&&Ee.touches.length>0)){if(M){(j||K)&&I&&z&&(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(A),F=!1,z=!1,I=null,K=null,N.removeEventListener("mousemove",Z),N.removeEventListener("mouseup",ue),N.removeEventListener("touchmove",Z),N.removeEventListener("touchend",ue)}}N.addEventListener("mousemove",Z),N.addEventListener("mouseup",ue),N.addEventListener("touchmove",Z),N.addEventListener("touchend",ue)}function UNe(e,{handle:t,connectionMode:n,fromNodeId:i,fromHandleId:r,fromType:s,doc:a,lib:l,flowId:c,isValidConnection:u=BNe,nodeLookup:d}){const f=s==="target",h=t?a.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}=Ed(e),b=a.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=FNe(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 N=S&&k&&(n===iw.Strict?f&&x==="source"||!f&&x==="target":w!==i||O!==r);y.isValid=N&&u(C),y.toHandle=$Ne(w,x,O,d,n,!0)}return y}const KF={onPointerDown:zmt,isValid:UNe};function Vmt({domNode:e,panZoom:t,getTransform:n,getViewScale:i}){const r=qc(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&&fE()?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},N=[[0,0],[c,u]];t.setViewportConstrained({x:E.x,y:E.y,zoom:O[2]},N,l)},x=gNe().on("start",v).on("zoom",f?y:null).on("zoom.wheel",h?g:null);r.call(x,{})}function a(){r.on("zoom",null)}return{update:s,destroy:a,pointer:yd}}const $P=e=>({x:e.x,y:e.y,zoom:e.k}),SL=({x:e,y:t,zoom:n})=>DP.translate(e,t).scale(n),Mv=(e,t)=>e.target.closest(`.${t}`),QNe=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Hmt=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,EL=(e,t=0,n=Hmt,i=()=>{})=>{const r=typeof t=="number"&&t>0;return r||i(),r?e.transition().duration(t).ease(n).on("end",i):e},zNe=e=>{const t=e.ctrlKey&&fE()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function qmt({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:i,panOnScrollMode:r,panOnScrollSpeed:s,zoomOnPinch:a,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:u}){return d=>{if(Mv(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(d.ctrlKey&&a){const v=yd(d),y=zNe(d),x=f*Math.pow(2,y);i.scaleTo(n,x,v,d);return}const h=d.deltaMode===1?20:1;let m=r===iy.Vertical?0:d.deltaX*h,g=r===iy.Horizontal?0:d.deltaY*h;!fE()&&d.shiftKey&&r!==iy.Vertical&&(m=d.deltaY*h,g=0),i.translateBy(n,-(m/f)*s,-(g/f)*s,{internal:!0});const b=$P(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 Wmt({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(i,r){const s=i.type==="wheel",a=!t&&s&&!i.ctrlKey,l=Mv(i,e);if(i.ctrlKey&&s&&l&&i.preventDefault(),a||l)return null;i.preventDefault(),n.call(this,i,r)}}function Kmt({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return i=>{var s,a,l;if((s=i.sourceEvent)!=null&&s.internal)return;const r=$P(i.transform);e.mouseButton=((a=i.sourceEvent)==null?void 0:a.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 Gmt({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:i,onPanZoom:r}){return s=>{var a,l;e.usedRightMouseButton=!!(n&&QNe(t,e.mouseButton??0)),(a=s.sourceEvent)!=null&&a.sync||i([s.transform.x,s.transform.y,s.transform.k]),r&&!((l=s.sourceEvent)!=null&&l.internal)&&(r==null||r(s.sourceEvent,$P(s.transform)))}}function Xmt({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:i,onPanZoomEnd:r,onPaneContextMenu:s}){return a=>{var l;if(!((l=a.sourceEvent)!=null&&l.internal)&&(e.isZoomingOrPanning=!1,s&&QNe(t,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&s(a.sourceEvent),e.usedRightMouseButton=!1,i(!1),r)){const c=$P(a.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r==null||r(a.sourceEvent,c)},n?150:0)}}}function Ymt({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:i,panOnScroll:r,zoomOnDoubleClick:s,userSelectionActive:a,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"&&(Mv(f,`${u}-flow__node`)||Mv(f,`${u}-flow__edge`)))return!0;if(!i&&!h&&!r&&!s&&!n||a||d&&!g||Mv(f,l)&&g||Mv(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 Zmt({domNode:e,minZoom:t,maxZoom:n,translateExtent:i,viewport:r,onPanZoom:s,onPanZoomStart:a,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=gNe().scaleExtent([t,n]).translateExtent(i),h=qc(e).call(f);x({x:r.x,y:r.y,zoom:rw(r.zoom,t,n)},[[0,0],[d.width,d.height]],i);const m=h.on("wheel.zoom"),g=h.on("dblclick.zoom");f.wheelDelta(zNe);async function b(j,T){return h?new Promise(R=>{f==null||f.interpolate((T==null?void 0:T.interpolate)==="linear"?qk:Y_).transform(EL(h,T==null?void 0:T.duration,T==null?void 0:T.ease,()=>R(!0)),j)}):!1}function v({noWheelClassName:j,noPanClassName:T,onPaneContextMenu:R,userSelectionActive:_,panOnScroll:D,panOnDrag:M,panOnScrollMode:P,panOnScrollSpeed:L,preventScrolling:F,zoomOnPinch:I,zoomOnScroll:z,zoomOnDoubleClick:K,zoomActivationKeyPressed:B,lib:W,onTransformChange:H,connectionInProgress:X,paneClickDistance:ie,selectionOnDrag:Q}){_&&!u.isZoomingOrPanning&&y();const Z=D&&!B&&!_;f.clickDistance(Q?1/0:!Sd(ie)||ie<0?0:ie);const ue=Z?qmt({zoomPanValues:u,noWheelClassName:j,d3Selection:h,d3Zoom:f,panOnScrollMode:P,panOnScrollSpeed:L,zoomOnPinch:I,onPanZoomStart:a,onPanZoom:s,onPanZoomEnd:l}):Wmt({noWheelClassName:j,preventScrolling:F,d3ZoomHandler:m});h.on("wheel.zoom",ue,{passive:!1});const Ee=Kmt({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:a});f.on("start",Ee);const Y=Gmt({zoomPanValues:u,panOnDrag:M,onPaneContextMenu:!!R,onPanZoom:s,onTransformChange:H});f.on("zoom",Y);const G=Xmt({zoomPanValues:u,panOnDrag:M,panOnScroll:D,onPaneContextMenu:R,onPanZoomEnd:l,onDraggingChange:c});f.on("end",G);const te=Ymt({zoomActivationKeyPressed:B,panOnDrag:M,zoomOnScroll:z,panOnScroll:D,zoomOnDoubleClick:K,zoomOnPinch:I,userSelectionActive:_,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,R){const _=SL(j),D=f==null?void 0:f.constrain()(_,T,R);return D&&await b(D),D}async function w(j,T){const R=SL(j);return await b(R,T),R}function O(j){if(h){const T=SL(j),R=h.property("__zoom");(R.k!==j.zoom||R.x!==j.x||R.y!==j.y)&&(f==null||f.transform(h,T,null,{sync:!0}))}}function S(){const j=h?mNe(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(R=>{f==null||f.interpolate((T==null?void 0:T.interpolate)==="linear"?qk:Y_).scaleTo(EL(h,T==null?void 0:T.duration,T==null?void 0:T.ease,()=>R(!0)),j)}):!1}async function C(j,T){return h?new Promise(R=>{f==null||f.interpolate((T==null?void 0:T.interpolate)==="linear"?qk:Y_).scaleBy(EL(h,T==null?void 0:T.duration,T==null?void 0:T.ease,()=>R(!0)),j)}):!1}function E(j){f==null||f.scaleExtent(j)}function N(j){f==null||f.translateExtent(j)}function A(j){const T=!Sd(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:N,syncViewport:O,setClickDistance:A}}var aw;(function(e){e.Line="line",e.Handle="handle"})(aw||(aw={}));function Jmt({width:e,prevWidth:t,height:n,prevHeight:i,affectsX:r,affectsY:s}){const a=e-t,l=n-i,c=[a>0?1:a<0?-1:0,l>0?1:l<0?-1:0];return a&&r&&(c[0]=c[0]*-1),l&&s&&(c[1]=c[1]*-1),c}function gJ(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 Gp(e,t){return Math.max(0,t-e)}function Xp(e,t){return Math.max(0,e-t)}function Y2(e,t,n){return Math.max(0,t-e,e-n)}function bJ(e,t){return e?!t:t}function egt(e,t,n,i,r,s,a,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),N=Math.floor(f?g-e.pointerY:0);const A=S+(c?-E:E),j=k+(u?-N:N),T=-s[0]*S,R=-s[1]*k;let _=Y2(A,b,v),D=Y2(j,y,x);if(a){let L=0,F=0;c&&E<0?L=Gp(w+E+T,a[0][0]):!c&&E>0&&(L=Xp(w+A+T,a[1][0])),u&&N<0?F=Gp(O+N+R,a[0][1]):!u&&N>0&&(F=Xp(O+j+R,a[1][1])),_=Math.max(_,L),D=Math.max(D,F)}if(l){let L=0,F=0;c&&E>0?L=Xp(w+E,l[0][0]):!c&&E<0&&(L=Gp(w+A,l[1][0])),u&&N>0?F=Xp(O+N,l[0][1]):!u&&N<0&&(F=Gp(O+j,l[1][1])),_=Math.max(_,L),D=Math.max(D,F)}if(r){if(d){const L=Y2(A/C,y,x)*C;if(_=Math.max(_,L),a){let F=0;!c&&!u||c&&!u&&h?F=Xp(O+R+A/C,a[1][1])*C:F=Gp(O+R+(c?E:-E)/C,a[0][1])*C,_=Math.max(_,F)}if(l){let F=0;!c&&!u||c&&!u&&h?F=Gp(O+A/C,l[1][1])*C:F=Xp(O+(c?E:-E)/C,l[0][1])*C,_=Math.max(_,F)}}if(f){const L=Y2(j*C,b,v)/C;if(D=Math.max(D,L),a){let F=0;!c&&!u||u&&!c&&h?F=Xp(w+j*C+T,a[1][0])/C:F=Gp(w+(u?N:-N)*C+T,a[0][0])/C,D=Math.max(D,F)}if(l){let F=0;!c&&!u||u&&!c&&h?F=Gp(w+j*C,l[1][0])/C:F=Xp(w+(u?N:-N)*C,l[0][0])/C,D=Math.max(D,F)}}}N=N+(N<0?D:-D),E=E+(E<0?_:-_),r&&(h?A>j*C?N=(bJ(c,u)?-E:E)/C:E=(bJ(c,u)?-N:N)*C:d?(N=E/C,u=c):(E=N*C,c=u));const M=c?w+E:w,P=u?O+N:O;return{width:S+(c?-E:E),height:k+(u?-N:N),x:s[0]*E*(c?-1:1)+M,y:s[1]*N*(u?-1:1)+P}}const VNe={width:0,height:0,x:0,y:0},tgt={...VNe,pointerX:0,pointerY:0,aspectRatio:1};function ngt(e,t,n){const i=t.position.x+e.position.x,r=t.position.y+e.position.y,s=e.measured.width??0,a=e.measured.height??0,l=n[0]*s,c=n[1]*a;return[[i-l,r-c],[i+s-l,r+a-c]]}function igt({domNode:e,nodeId:t,getStoreItems:n,onChange:i,onEnd:r}){const s=qc(e);let a={controlDirection:gJ("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={...VNe},x={...tgt};a={boundaries:d,resizeDirection:h,keepAspectRatio:f,controlDirection:gJ(u)};let w,O=null,S=[],k,C,E,N=!1;const A=eNe().on("start",j=>{const{nodeLookup:T,transform:R,snapGrid:_,snapToGrid:D,nodeOrigin:M,paneDomNode:P}=n();if(w=T.get(t),!w)return;O=(P==null?void 0:P.getBoundingClientRect())??null;const{xSnapped:L,ySnapped:F}=Wk(j.sourceEvent,{transform:R,snapGrid:_,snapToGrid:D,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:F,aspectRatio:y.width/y.height},k=void 0,C=Ey(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,z]of T)if(z.parentId===t&&(S.push({id:I,position:{...z.position},extent:z.extent}),z.extent==="parent"||z.expandParent)){const K=ngt(z,w,z.origin??M);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:R,snapToGrid:_,nodeOrigin:D}=n(),M=Wk(j.sourceEvent,{transform:T,snapGrid:R,snapToGrid:_,containerBounds:O}),P=[];if(!w)return;const{x:L,y:F,width:I,height:z}=y,K={},B=w.origin??D,{width:W,height:H,x:X,y:ie}=egt(x,a.controlDirection,M,a.boundaries,a.keepAspectRatio,B,C,E),Q=W!==I,Z=H!==z,ue=X!==L&&Q,Ee=ie!==F&&Z;if(!ue&&!Ee&&!Q&&!Z)return;if((ue||Ee||B[0]===1||B[1]===1)&&(K.x=ue?X:y.x,K.y=Ee?ie:y.y,y.x=K.x,y.y=K.y,S.length>0)){const de=X-L,Ce=ie-F;for(const le of S)le.position={x:le.position.x-de+B[0]*(W-I),y:le.position.y-Ce+B[1]*(H-z)},P.push(le)}if((Q||Z)&&(K.width=Q&&(!a.resizeDirection||a.resizeDirection==="horizontal")?W:y.width,K.height=Z&&(!a.resizeDirection||a.resizeDirection==="vertical")?H:y.height,y.width=K.width,y.height=K.height),k&&w.expandParent){const de=B[0]*(K.width??0);K.x&&K.x{N&&(b==null||b(j,{...y}),r==null||r({...y}),N=!1)});s.call(A)}function c(){s.on(".drag",null)}return{update:l,destroy:c}}const rgt={},yJ=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:()=>{(rgt?"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},sgt=e=>e?yJ(e):yJ,{useDebugValue:ogt}=pi,{useSyncExternalStoreWithSelector:agt}=RJe,lgt=e=>e;function HNe(e,t=lgt,n){const i=agt(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return ogt(i),i}const vJ=(e,t)=>{const n=sgt(e),i=(r,s=t)=>HNe(n,r,s);return Object.assign(i,n),i},cgt=(e,t)=>e?vJ(e,t):vJ;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 FP=p.createContext(null),ugt=FP.Provider,qNe=Dd.error001("react");function zi(e,t){const n=p.useContext(FP);if(n===null)throw new Error(qNe);return HNe(n,e,t)}function _s(){const e=p.useContext(FP);if(e===null)throw new Error(qNe);return p.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const xJ={display:"none"},dgt={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},WNe="react-flow__node-desc",KNe="react-flow__edge-desc",fgt="react-flow__aria-live",hgt=e=>e.ariaLiveMessage,pgt=e=>e.ariaLabelConfig;function mgt({rfId:e}){const t=zi(hgt);return o.jsx("div",{id:`${fgt}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:dgt,children:t})}function ggt({rfId:e,disableKeyboardA11y:t}){const n=zi(pgt);return o.jsxs(o.Fragment,{children:[o.jsx("div",{id:`${WNe}-${e}`,style:xJ,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),o.jsx("div",{id:`${KNe}-${e}`,style:xJ,children:n["edge.a11yDescription.default"]}),!t&&o.jsx(mgt,{rfId:e})]})}const BP=p.forwardRef(({position:e="top-left",children:t,className:n,style:i,...r},s)=>{const a=`${e}`.split("-");return o.jsx("div",{className:Fo(["react-flow__panel",n,...a]),style:i,ref:s,...r,children:t})});BP.displayName="Panel";function bgt({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:o.jsx(BP,{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:o.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const ygt=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}},Z2=e=>e.id;function vgt(e,t){return As(e.selectedNodes.map(Z2),t.selectedNodes.map(Z2))&&As(e.selectedEdges.map(Z2),t.selectedEdges.map(Z2))}function xgt({onSelectionChange:e}){const t=_s(),{selectedNodes:n,selectedEdges:i}=zi(ygt,vgt);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 wgt=e=>!!e.onSelectionChangeHandlers;function Ogt({onSelectionChange:e}){const t=zi(wgt);return e||t?o.jsx(xgt,{onSelectionChange:e}):null}const GNe=[0,0],kgt={x:0,y:0,zoom:1},Sgt=["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"],wJ=[...Sgt,"rfId"],Egt=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}),OJ={translateExtent:lE,nodeOrigin:GNe,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Cgt(e){const{setNodes:t,setEdges:n,setMinZoom:i,setMaxZoom:r,setTranslateExtent:s,setNodeExtent:a,reset:l,setDefaultNodesAndEdges:c}=zi(Egt,As),u=_s();p.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{d.current=OJ,l()}),[]);const d=p.useRef(OJ);return p.useEffect(()=>{for(const f of wJ){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"?a(h):f==="ariaLabelConfig"?u.setState({ariaLabelConfig:gmt(h)}):f==="fitView"?u.setState({fitViewQueued:h}):f==="fitViewOptions"?u.setState({fitViewOptions:h}):u.setState({[f]:h})))}d.current=e},wJ.map(f=>e[f])),null}function kJ(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Tgt(e){var i;const[t,n]=p.useState(e==="system"?null:e);return p.useEffect(()=>{if(e!=="system"){n(e);return}const r=kJ(),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=kJ())!=null&&i.matches?"dark":"light"}const SJ=typeof document<"u"?document:null;function hE(e=null,t={target:SJ,actInsideInputWithModifier:!0}){const[n,i]=p.useState(!1),r=p.useRef(!1),s=p.useRef(new Set([])),[a,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)??SJ,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)&&ANe(m))return!1;const b=CJ(m.code,l);if(s.current.add(m[b]),EJ(a,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=CJ(m.code,l);EJ(a,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 CJ(e,t){return t.includes(e)?"code":"key"}const Agt=()=>{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:a}=e.getState();return a?(await a.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:a,panZoom:l}=e.getState(),c=mz(t,i,r,s,a,(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:a}=e.getState();if(!a)return t;const{x:l,y:c}=a.getBoundingClientRect(),u={x:t.x-l,y:t.y-c},d=n.snapGrid??r,f=n.snapToGrid??s;return Yw(u,i,f,d)},flowToScreenPosition:t=>{const{transform:n,domNode:i}=e.getState();if(!i)return t;const{x:r,y:s}=i.getBoundingClientRect(),a=ow(t,n);return{x:a.x+r,y:a.y+s}}}),[])};function XNe(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 a=i.get(s.id);a?a.push(s):i.set(s.id,[s])}for(const s of t){const a=i.get(s.id);if(!a){n.push(s);continue}if(a[0].type==="remove")continue;if(a[0].type==="replace"){n.push({...a[0].item});continue}const l={...s};for(const c of a)_gt(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 _gt(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 YNe(e,t){return XNe(e,t)}function ZNe(e,t){return XNe(e,t)}function Ob(e,t){return{id:e,type:"select",selected:t}}function Lv(e,t=new Set,n=!1){const i=[];for(const[r,s]of e){const a=t.has(r);!(s.selected===void 0&&!a)&&s.selected!==a&&(n&&(s.selected=a),i.push(Ob(s.id,a)))}return i}function TJ({items:e=[],lookup:t}){var r;const n=[],i=new Map(e.map(s=>[s.id,s]));for(const[s,a]of e.entries()){const l=t.get(a.id),c=((r=l==null?void 0:l.internals)==null?void 0:r.userNode)??l;c!==void 0&&c!==a&&n.push({id:a.id,item:a,type:"replace"}),c===void 0&&n.push({item:a,type:"add",index:s})}for(const[s]of t)i.get(s)===void 0&&n.push({id:s,type:"remove"});return n}function AJ(e){return{id:e.id,type:"remove"}}const jgt=ENe();function Ngt(e,t,n={}){return Omt(e,t,{...n,onError:n.onError??jgt})}const _J=e=>amt(e),Rgt=e=>wNe(e);function JNe(e){return p.forwardRef(e)}const Igt=typeof window<"u"?p.useLayoutEffect:p.useEffect;function jJ(e){const[t,n]=p.useState(BigInt(0)),[i]=p.useState(()=>Pgt(()=>n(r=>r+BigInt(1))));return Igt(()=>{const r=i.get();r.length&&(e(r),i.reset())},[t]),i}function Pgt(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const eRe=p.createContext(null);function Dgt({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=TJ({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=jJ(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(TJ({items:m,lookup:h}))},[]),s=jJ(r),a=p.useMemo(()=>({nodeQueue:i,edgeQueue:s}),[]);return o.jsx(eRe.Provider,{value:a,children:e})}function Mgt(){const e=p.useContext(eRe);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const Lgt=e=>!!e.panZoom;function UP(){const e=Agt(),t=_s(),n=Mgt(),i=zi(Lgt),r=p.useMemo(()=>{const s=f=>t.getState().nodeLookup.get(f),a=f=>{n.nodeQueue.push(f)},l=f=>{n.edgeQueue.push(f)},c=f=>{var y,x;const{nodeLookup:h,nodeOrigin:m}=t.getState(),g=_J(f)?f:h.get(f.id),b=g.parentId?CNe(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 sw(v)},u=(f,h,m={replace:!1})=>{a(g=>g.map(b=>{if(b.id===f){const v=typeof h=="function"?h(b):h;return m.replace&&_J(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&&Rgt(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:a,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 fmt({nodesToRemove:f,edgesToRemove:h,nodes:m,edges:g,onBeforeDelete:O}),C=k.length>0,E=S.length>0;if(C){const N=k.map(AJ);v==null||v(k),x(N)}if(E){const N=S.map(AJ);b==null||b(S),y(N)}return(E||C)&&(w==null||w({nodes:S,edges:k})),{deletedNodes:S,deletedEdges:k}},getIntersectingNodes:(f,h=!0,m)=>{const g=sJ(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=sw(v?y:x),O=dE(w,b);return h&&O>0||O>=w.width*w.height||O>=b.width*b.height}):[]},isNodeIntersecting:(f,h,m=!0)=>{const b=sJ(f)?f:c(f);if(!b)return!1;const v=dE(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 lmt(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??mmt();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 NJ=e=>e.selected,$gt=typeof window<"u"?window:void 0;function Fgt({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=_s(),{deleteElements:i}=UP(),r=hE(e,{actInsideInputWithModifier:!1}),s=hE(t,{target:$gt});p.useEffect(()=>{if(r){const{edges:a,nodes:l}=n.getState();i({nodes:l.filter(NJ),edges:a.filter(NJ)}),n.setState({nodesSelectionActive:!1})}},[r]),p.useEffect(()=>{n.setState({multiSelectionActive:s})},[s])}function Bgt(e){const t=_s();p.useEffect(()=>{const n=()=>{var r,s,a,l;if(!e.current||!(((s=(r=e.current).checkVisibility)==null?void 0:s.call(r))??!0))return!1;const i=bz(e.current);(i.height===0||i.width===0)&&((l=(a=t.getState()).onError)==null||l.call(a,"004",Dd.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 QP={position:"absolute",width:"100%",height:"100%",top:0,left:0},Ugt=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Qgt({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:i=!1,panOnScrollSpeed:r=.5,panOnScrollMode:s=iy.Free,zoomOnDoubleClick:a=!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:N}=zi(Ugt,As),A=hE(h),j=p.useRef();Bgt(k);const T=p.useCallback(R=>{y==null||y({x:R[0],y:R[1],zoom:R[2]}),x||S.setState({transform:R})},[y,x]);return p.useEffect(()=>{if(k.current){j.current=Zmt({domNode:k.current,minZoom:d,maxZoom:f,translateExtent:u,viewport:c,onDraggingChange:M=>S.setState(P=>P.paneDragging===M?P:{paneDragging:M}),onPanZoomStart:(M,P)=>{const{onViewportChangeStart:L,onMoveStart:F}=S.getState();F==null||F(M,P),L==null||L(P)},onPanZoom:(M,P)=>{const{onViewportChange:L,onMove:F}=S.getState();F==null||F(M,P),L==null||L(P)},onPanZoomEnd:(M,P)=>{const{onViewportChangeEnd:L,onMoveEnd:F}=S.getState();F==null||F(M,P),L==null||L(P)}});const{x:R,y:_,zoom:D}=j.current.getViewport();return S.setState({panZoom:j.current,transform:[R,_,D],domNode:k.current.closest(".react-flow")}),()=>{var M;(M=j.current)==null||M.destroy()}}},[]),p.useEffect(()=>{var R;(R=j.current)==null||R.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:i,panOnScrollSpeed:r,panOnScrollMode:s,zoomOnDoubleClick:a,panOnDrag:l,zoomActivationKeyPressed:A,preventScrolling:m,noPanClassName:v,userSelectionActive:C,noWheelClassName:b,lib:E,onTransformChange:T,connectionInProgress:N,selectionOnDrag:O,paneClickDistance:w})},[e,t,n,i,r,s,a,l,A,m,v,C,b,E,T,N,O,w]),o.jsx("div",{className:"react-flow__renderer",ref:k,style:QP,children:g})}const zgt=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Vgt(){const{userSelectionActive:e,userSelectionRect:t}=zi(zgt,As);return e&&t?o.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 CL=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},Hgt=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function qgt({isSelecting:e,selectionKeyPressed:t,selectionMode:n=cE.Full,panOnDrag:i,autoPanOnSelection:r,paneClickDistance:s,selectionOnDrag:a,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(Hgt,As),E=w&&(e||x),N=p.useRef(null),A=p.useRef(),j=p.useRef(new Set),T=p.useRef(new Set),R=p.useRef(!1),_=p.useRef({x:0,y:0}),D=p.useRef(!1),M=Q=>{if(R.current||S){R.current=!1;return}u==null||u(Q),y.getState().resetSelectedElements(),y.setState({nodesSelectionActive:!1})},P=Q=>{if(Array.isArray(i)&&(i!=null&&i.includes(2))){Q.preventDefault();return}d==null||d(Q)},L=f?Q=>f(Q):void 0,F=Q=>{R.current&&(Q.stopPropagation(),R.current=!1)},I=Q=>{var le,fe;const{domNode:Z,transform:ue}=y.getState();if(A.current=Z==null?void 0:Z.getBoundingClientRect(),!A.current)return;const Ee=Q.target===N.current;if(!Ee&&!!Q.target.closest(".nokey")||!e||!(a&&Ee||t)||Q.button!==0||!Q.isPrimary)return;(fe=(le=Q.target)==null?void 0:le.setPointerCapture)==null||fe.call(le,Q.pointerId),R.current=!1;const{x:te,y:de}=Ed(Q.nativeEvent,A.current),Ce=Yw({x:te,y:de},ue);y.setState({userSelectionRect:{width:0,height:0,startX:Ce.x,startY:Ce.y,x:te,y:de}}),Ee||(Q.stopPropagation(),Q.preventDefault())};function z(Q,Z){const{userSelectionRect:ue}=y.getState();if(!ue)return;const{transform:Ee,nodeLookup:Y,edgeLookup:G,connectionLookup:te,triggerNodeChanges:de,triggerEdgeChanges:Ce,defaultEdgeOptions:le}=y.getState(),fe={x:ue.startX,y:ue.startY},{x:re,y:Oe}=ow(fe,Ee),Pe={startX:fe.x,startY:fe.y,x:QNe.id)),T.current=new Set;const ve=(le==null?void 0:le.selectable)??!0;for(const Ne of j.current){const ne=te.get(Ne);if(ne)for(const{edgeId:ye}of ne.values()){const Te=G.get(ye);Te&&(Te.selectable??ve)&&T.current.add(ye)}}if(!oJ(be,j.current)){const Ne=Lv(Y,j.current,!0);de(Ne)}if(!oJ(Qe,T.current)){const Ne=Lv(G,T.current);Ce(Ne)}y.setState({userSelectionRect:Pe,userSelectionActive:!0,nodesSelectionActive:!1})}function K(){if(!r||!A.current)return;const[Q,Z]=pz(_.current,A.current,C);k({x:Q,y:Z}).then(ue=>{if(!R.current||!ue){v.current=requestAnimationFrame(K);return}const{x:Ee,y:Y}=_.current;z(Ee,Y),v.current=requestAnimationFrame(K)})}const B=()=>{cancelAnimationFrame(v.current),v.current=0,D.current=!1};p.useEffect(()=>()=>B(),[]);const W=Q=>{const{userSelectionRect:Z,transform:ue,resetSelectedElements:Ee}=y.getState();if(!A.current||!Z)return;const{x:Y,y:G}=Ed(Q.nativeEvent,A.current);_.current={x:Y,y:G};const te=ow({x:Z.startX,y:Z.startY},ue);if(!R.current){const de=t?0:s;if(Math.hypot(Y-te.x,G-te.y)<=de)return;Ee(),l==null||l(Q)}R.current=!0,D.current||(K(),D.current=!0),z(Y,G)},H=Q=>{var Z,ue;Q.button===0&&((ue=(Z=Q.target)==null?void 0:Z.releasePointerCapture)==null||ue.call(Z,Q.pointerId),!x&&Q.target===N.current&&y.getState().userSelectionRect&&(M==null||M(Q)),y.setState({userSelectionActive:!1,userSelectionRect:null}),R.current&&(c==null||c(Q),y.setState({nodesSelectionActive:j.current.size>0})),B())},X=Q=>{var Z,ue;(ue=(Z=Q.target)==null?void 0:Z.releasePointerCapture)==null||ue.call(Z,Q.pointerId),B()},ie=i===!0||Array.isArray(i)&&i.includes(0);return o.jsxs("div",{className:Fo(["react-flow__pane",{draggable:ie,dragging:O,selection:e}]),onClick:E?void 0:CL(M,N),onContextMenu:CL(P,N),onWheel:CL(L,N),onPointerEnter:E?void 0:h,onPointerMove:E?W:m,onPointerUp:E?H:void 0,onPointerCancel:E?X:void 0,onPointerDownCapture:E?I:void 0,onClickCapture:E?F:void 0,onPointerLeave:g,ref:N,style:QP,children:[b,o.jsx(Vgt,{})]})}function GF({id:e,store:t,unselect:n=!1,nodeRef:i}){const{addSelectedNodes:r,unselectNodesAndEdges:s,multiSelectionActive:a,nodeLookup:l,onError:c}=t.getState(),u=l.get(e);if(!u){c==null||c("012",Dd.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&a)&&(s({nodes:[u],edges:[]}),requestAnimationFrame(()=>{var d;return(d=i==null?void 0:i.current)==null?void 0:d.blur()})):r([e])}function tRe({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:i,nodeId:r,isSelectable:s,nodeClickDistance:a}){const l=_s(),[c,u]=p.useState(!1),d=p.useRef();return p.useEffect(()=>{d.current=$mt({getStoreItems:()=>l.getState(),onNodeMouseDown:f=>{GF({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:a}),()=>{var f;(f=d.current)==null||f.destroy()}},[n,i,t,s,e,r,a]),c}const Wgt=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function nRe(){const e=_s();return p.useCallback(n=>{const{nodeExtent:i,snapToGrid:r,snapGrid:s,nodesDraggable:a,onError:l,updateNodePositions:c,nodeLookup:u,nodeOrigin:d}=e.getState(),f=new Map,h=Wgt(a),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=zC(x,s));const{position:w,positionAbsolute:O}=ONe({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 kz=p.createContext(null),Kgt=kz.Provider;kz.Consumer;const iRe=()=>p.useContext(kz),Ggt=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),Xgt=(e,t,n)=>i=>{const{connectionClickStartHandle:r,connectionMode:s,connection:a}=i,{fromHandle:l,toHandle:c,isValid:u}=a,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===iw.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 Ygt({type:e="source",position:t=pn.Top,isValidConnection:n,isConnectable:i=!0,isConnectableStart:r=!0,isConnectableEnd:s=!0,id:a,onConnect:l,children:c,className:u,onMouseDown:d,onTouchStart:f,...h},m){var D,M;const g=a||null,b=e==="target",v=_s(),y=iRe(),{connectOnClick:x,noPanClassName:w,rfId:O}=zi(Ggt,As),{connectingFrom:S,connectingTo:k,clickConnecting:C,isPossibleEndHandle:E,connectionInProcess:N,clickConnectionInProcess:A,valid:j}=zi(Xgt(y,g,e),As);y||(M=(D=v.getState()).onError)==null||M.call(D,"010",Dd.error010());const T=P=>{const{defaultEdgeOptions:L,onConnect:F,hasDefaultEdges:I}=v.getState(),z={...L,...P};if(I){const{edges:K,setEdges:B,onError:W}=v.getState();B(Ngt(z,K,{onError:W}))}F==null||F(z),l==null||l(z)},R=P=>{if(!y)return;const L=_Ne(P.nativeEvent);if(r&&(L&&P.button===0||!L)){const F=v.getState();KF.onPointerDown(P.nativeEvent,{handleDomNode:P.currentTarget,autoPanOnConnect:F.autoPanOnConnect,connectionMode:F.connectionMode,connectionRadius:F.connectionRadius,domNode:F.domNode,nodeLookup:F.nodeLookup,lib:F.lib,isTarget:b,handleId:g,nodeId:y,flowId:F.rfId,panBy:F.panBy,cancelConnection:F.cancelConnection,onConnectStart:F.onConnectStart,onConnectEnd:(...I)=>{var z,K;return(K=(z=v.getState()).onConnectEnd)==null?void 0:K.call(z,...I)},updateConnection:F.updateConnection,onConnect:T,isValidConnection:n||((...I)=>{var z,K;return((K=(z=v.getState()).isValidConnection)==null?void 0:K.call(z,...I))??!0}),getTransform:()=>v.getState().transform,getFromHandle:()=>v.getState().connection.fromHandle,autoPanSpeed:F.autoPanSpeed,dragThreshold:F.connectionDragThreshold})}L?d==null||d(P):f==null||f(P)},_=P=>{const{onClickConnectStart:L,onClickConnectEnd:F,connectionClickStartHandle:I,connectionMode:z,isValidConnection:K,lib:B,rfId:W,nodeLookup:H,connection:X}=v.getState();if(!y||!I&&!r)return;if(!I){L==null||L(P.nativeEvent,{nodeId:y,handleId:g,handleType:e}),v.setState({connectionClickStartHandle:{nodeId:y,type:e,id:g}});return}const ie=TNe(P.target),Q=n||K,{connection:Z,isValid:ue}=KF.isValid(P.nativeEvent,{handle:{nodeId:y,id:g,type:e},connectionMode:z,fromNodeId:I.nodeId,fromHandleId:I.id||null,fromType:I.type,isValidConnection:Q,flowId:W,doc:ie,lib:B,nodeLookup:H});ue&&Z&&T(Z);const Ee=structuredClone(X);delete Ee.inProgress,Ee.toPosition=Ee.toHandle?Ee.toHandle.position:null,F==null||F(P,Ee),v.setState({connectionClickStartHandle:null})};return o.jsx("div",{"data-handleid":g,"data-nodeid":y,"data-handlepos":t,"data-id":`${O}-${y}-${g}-${e}`,className:Fo(["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&&(!N||E)&&(N||A?s:r)}]),onMouseDown:R,onTouchStart:R,onClick:x?_:void 0,ref:m,...h,children:c})}const sc=p.memo(JNe(Ygt));function Zgt({data:e,isConnectable:t,sourcePosition:n=pn.Bottom}){return o.jsxs(o.Fragment,{children:[e==null?void 0:e.label,o.jsx(sc,{type:"source",position:n,isConnectable:t})]})}function Jgt({data:e,isConnectable:t,targetPosition:n=pn.Top,sourcePosition:i=pn.Bottom}){return o.jsxs(o.Fragment,{children:[o.jsx(sc,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,o.jsx(sc,{type:"source",position:i,isConnectable:t})]})}function ebt(){return null}function tbt({data:e,isConnectable:t,targetPosition:n=pn.Top}){return o.jsxs(o.Fragment,{children:[o.jsx(sc,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const HN={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},RJ={input:Zgt,default:Jgt,output:tbt,group:ebt};function nbt(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 ibt=e=>{const{width:t,height:n,x:i,y:r}=QC(e.nodeLookup,{filter:s=>!!s.selected});return{width:Sd(t)?t:null,height:Sd(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 rbt({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const i=_s(),{width:r,height:s,transformString:a,userSelectionActive:l}=zi(ibt,As),c=nRe(),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(tRe({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(HN,m.key)&&(m.preventDefault(),c({direction:HN[m.key],factor:m.shiftKey?4:1}))};return o.jsx("div",{className:Fo(["react-flow__nodesselection","react-flow__container",t]),style:{transform:a},children:o.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 IJ=typeof window<"u"?window:void 0,sbt=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function rRe({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:i,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:a,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:N,defaultViewport:A,translateExtent:j,minZoom:T,maxZoom:R,preventScrolling:_,onSelectionContextMenu:D,noWheelClassName:M,noPanClassName:P,disableKeyboardA11y:L,onViewportChange:F,isControlledViewport:I}){const{nodesSelectionActive:z,userSelectionActive:K}=zi(sbt,As),B=hE(u,{target:IJ}),W=hE(b,{target:IJ}),H=W||E,X=W||O,ie=d&&H!==!0,Q=B||K||ie;return Fgt({deleteKeyCode:c,multiSelectionKeyCode:g}),o.jsx(Qgt,{onPaneContextMenu:s,elementsSelectable:y,zoomOnScroll:x,zoomOnPinch:w,panOnScroll:X,panOnScrollSpeed:S,panOnScrollMode:k,zoomOnDoubleClick:C,panOnDrag:!B&&H,defaultViewport:A,translateExtent:j,minZoom:T,maxZoom:R,zoomActivationKeyCode:v,preventScrolling:_,noWheelClassName:M,noPanClassName:P,onViewportChange:F,isControlledViewport:I,paneClickDistance:l,selectionOnDrag:ie,children:o.jsxs(qgt,{onSelectionStart:h,onSelectionEnd:m,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:i,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:a,panOnDrag:H,autoPanOnSelection:N,isSelecting:!!Q,selectionMode:f,selectionKeyPressed:B,paneClickDistance:l,selectionOnDrag:ie,children:[e,z&&o.jsx(rbt,{onSelectionContextMenu:D,noPanClassName:P,disableKeyboardA11y:L})]})})}rRe.displayName="FlowRenderer";const obt=p.memo(rRe),abt=e=>t=>e?hz(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 lbt(e){return zi(p.useCallback(abt(e),[e]),As)}const cbt=e=>e.updateNodeInternals;function ubt(){const e=zi(cbt),[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 dbt({node:e,nodeType:t,hasDimensions:n,resizeObserver:i}){const r=_s(),s=p.useRef(null),a=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||a.current!==s.current)&&(a.current&&(i==null||i.unobserve(a.current)),i==null||i.observe(s.current),a.current=s.current)},[d,e.hidden]),p.useEffect(()=>()=>{a.current&&(i==null||i.unobserve(a.current),a.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 fbt({id:e,onClick:t,onMouseEnter:n,onMouseMove:i,onMouseLeave:r,onContextMenu:s,onDoubleClick:a,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),ue=Q.parentLookup.has(e);return{node:Z,internals:Z.internals,isParent:ue}},As);let k=w.type||"default",C=(v==null?void 0:v[k])||RJ[k];C===void 0&&(x==null||x("003",Dd.error003(k)),k="default",C=(v==null?void 0:v.default)||RJ.default);const E=!!(w.draggable||l&&typeof w.draggable>"u"),N=!!(w.selectable||c&&typeof w.selectable>"u"),A=!!(w.connectable||u&&typeof w.connectable>"u"),j=!!(w.focusable||d&&typeof w.focusable>"u"),T=_s(),R=gz(w),_=dbt({node:w,nodeType:k,hasDimensions:R,resizeObserver:f}),D=tRe({nodeRef:_,disabled:w.hidden||!E,noDragClassName:h,handleSelector:w.dragHandle,nodeId:e,isSelectable:N,nodeClickDistance:y}),M=nRe();if(w.hidden)return null;const P=Ap(w),L=nbt(w),F=N||E||t||n||i||r,I=n?Q=>n(Q,{...O.userNode}):void 0,z=i?Q=>i(Q,{...O.userNode}):void 0,K=r?Q=>r(Q,{...O.userNode}):void 0,B=s?Q=>s(Q,{...O.userNode}):void 0,W=a?Q=>a(Q,{...O.userNode}):void 0,H=Q=>{const{selectNodesOnDrag:Z,nodeDragThreshold:ue}=T.getState();N&&(!Z||!E||ue>0)&&GF({id:e,store:T,nodeRef:_}),t&&t(Q,{...O.userNode})},X=Q=>{if(!(ANe(Q.nativeEvent)||g)){if(bNe.includes(Q.key)&&N){const Z=Q.key==="Escape";GF({id:e,store:T,unselect:Z,nodeRef:_})}else if(E&&w.selected&&Object.prototype.hasOwnProperty.call(HN,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})}),M({direction:HN[Q.key],factor:Q.shiftKey?4:1})}}},ie=()=>{var te;if(g||!((te=_.current)!=null&&te.matches(":focus-visible")))return;const{transform:Q,width:Z,height:ue,autoPanOnNodeFocus:Ee,setCenter:Y}=T.getState();if(!Ee)return;hz(new Map([[e,w]]),{x:0,y:0,width:Z,height:ue},Q,!0).length>0||Y(w.position.x+P.width/2,w.position.y+P.height/2,{zoom:Q[2]})};return o.jsx("div",{className:Fo(["react-flow__node",`react-flow__node-${k}`,{[m]:E},w.className,{selected:w.selected,selectable:N,parent:S,draggable:E,dragging:D}]),ref:_,style:{zIndex:O.z,transform:`translate(${O.positionAbsolute.x}px,${O.positionAbsolute.y}px)`,pointerEvents:F?"all":"none",visibility:R?"visible":"hidden",...w.style,...L},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:I,onMouseMove:z,onMouseLeave:K,onContextMenu:B,onClick:H,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:`${WNe}-${b}`,"aria-label":w.ariaLabel,...w.domAttributes,children:o.jsx(Kgt,{value:e,children:o.jsx(C,{id:e,data:w.data,type:k,positionAbsoluteX:O.positionAbsolute.x,positionAbsoluteY:O.positionAbsolute.y,selected:w.selected??!1,selectable:N,draggable:E,deletable:w.deletable??!0,isConnectable:A,sourcePosition:w.sourcePosition,targetPosition:w.targetPosition,dragging:D,dragHandle:w.dragHandle,zIndex:O.z,parentId:w.parentId,...P})})})}var hbt=p.memo(fbt);const pbt=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function sRe(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:i,elementsSelectable:r,onError:s}=zi(pbt,As),a=lbt(e.onlyRenderVisibleElements),l=ubt();return o.jsx("div",{className:"react-flow__nodes",style:QP,children:a.map(c=>o.jsx(hbt,{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))})}sRe.displayName="NodeRenderer";const mbt=p.memo(sRe);function gbt(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),a=n.nodeLookup.get(r.target);s&&a&&vmt({sourceNode:s,targetNode:a,width:n.width,height:n.height,transform:n.transform})&&i.push(r.id)}return i},[e]),As)}const bbt=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return o.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},ybt=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return o.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},PJ={[uE.Arrow]:bbt,[uE.ArrowClosed]:ybt};function vbt(e){const t=_s();return p.useMemo(()=>{var r,s;return Object.prototype.hasOwnProperty.call(PJ,e)?PJ[e]:((s=(r=t.getState()).onError)==null||s.call(r,"009",Dd.error009(e)),null)},[e])}const xbt=({id:e,type:t,color:n,width:i=12.5,height:r=12.5,markerUnits:s="strokeWidth",strokeWidth:a,orient:l="auto-start-reverse"})=>{const c=vbt(t);return c?o.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:o.jsx(c,{color:n,strokeWidth:a})}):null},oRe=({defaultColor:e,rfId:t})=>{const n=zi(s=>s.edges),i=zi(s=>s.defaultEdgeOptions),r=p.useMemo(()=>Tmt(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?o.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:o.jsx("defs",{children:r.map(s=>o.jsx(xbt,{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};oRe.displayName="MarkerDefinitions";var wbt=p.memo(oRe);function aRe({x:e,y:t,label:n,labelStyle:i,labelShowBg:r=!0,labelBgStyle:s,labelBgPadding:a=[2,4],labelBgBorderRadius:l=2,children:c,className:u,...d}){const[f,h]=p.useState({x:1,y:0,width:0,height:0}),m=Fo(["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?o.jsxs("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:m,visibility:f.width?"visible":"hidden",...d,children:[r&&o.jsx("rect",{width:f.width+2*a[0],x:-a[0],y:-a[1],height:f.height+2*a[1],className:"react-flow__edge-textbg",style:s,rx:l,ry:l}),o.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:g,style:i,children:n}),c]}):null}aRe.displayName="EdgeText";const Obt=p.memo(aRe);function VC({path:e,labelX:t,labelY:n,label:i,labelStyle:r,labelShowBg:s,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,interactionWidth:u=20,...d}){return o.jsxs(o.Fragment,{children:[o.jsx("path",{...d,d:e,fill:"none",className:Fo(["react-flow__edge-path",d.className])}),u?o.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}):null,i&&Sd(t)&&Sd(n)?o.jsx(Obt,{x:t,y:n,label:i,labelStyle:r,labelShowBg:s,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c}):null]})}function DJ({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 lRe({sourceX:e,sourceY:t,sourcePosition:n=pn.Bottom,targetX:i,targetY:r,targetPosition:s=pn.Top}){const[a,l]=DJ({pos:n,x1:e,y1:t,x2:i,y2:r}),[c,u]=DJ({pos:s,x1:i,y1:r,x2:e,y2:t}),[d,f,h,m]=jNe({sourceX:e,sourceY:t,targetX:i,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${e},${t} C${a},${l} ${c},${u} ${i},${r}`,d,f,h,m]}function cRe(e){return p.memo(({id:t,sourceX:n,sourceY:i,targetX:r,targetY:s,sourcePosition:a,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]=lRe({sourceX:n,sourceY:i,sourcePosition:a,targetX:r,targetY:s,targetPosition:l}),S=e.isInternal?void 0:t;return o.jsx(VC,{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 kbt=cRe({isInternal:!1}),uRe=cRe({isInternal:!0});kbt.displayName="SimpleBezierEdge";uRe.displayName="SimpleBezierEdgeInternal";function dRe(e){return p.memo(({id:t,sourceX:n,sourceY:i,targetX:r,targetY:s,label:a,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]=VN({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 o.jsx(VC,{id:k,path:w,labelX:O,labelY:S,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:b,markerStart:v,interactionWidth:x})})}const fRe=dRe({isInternal:!1}),hRe=dRe({isInternal:!0});fRe.displayName="SmoothStepEdge";hRe.displayName="SmoothStepEdgeInternal";function pRe(e){return p.memo(({id:t,...n})=>{var r;const i=e.isInternal?void 0:t;return o.jsx(fRe,{...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 Sbt=pRe({isInternal:!1}),mRe=pRe({isInternal:!0});Sbt.displayName="StepEdge";mRe.displayName="StepEdgeInternal";function gRe(e){return p.memo(({id:t,sourceX:n,sourceY:i,targetX:r,targetY:s,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:m,markerStart:g,interactionWidth:b})=>{const[v,y,x]=INe({sourceX:n,sourceY:i,targetX:r,targetY:s}),w=e.isInternal?void 0:t;return o.jsx(VC,{id:w,path:v,labelX:y,labelY:x,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:m,markerStart:g,interactionWidth:b})})}const Ebt=gRe({isInternal:!1}),bRe=gRe({isInternal:!0});Ebt.displayName="StraightEdge";bRe.displayName="StraightEdgeInternal";function yRe(e){return p.memo(({id:t,sourceX:n,sourceY:i,targetX:r,targetY:s,sourcePosition:a=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]=NNe({sourceX:n,sourceY:i,sourcePosition:a,targetX:r,targetY:s,targetPosition:l,curvature:y==null?void 0:y.curvature}),k=e.isInternal?void 0:t;return o.jsx(VC,{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 Cbt=yRe({isInternal:!1}),vRe=yRe({isInternal:!0});Cbt.displayName="BezierEdge";vRe.displayName="BezierEdgeInternal";const MJ={default:vRe,straight:bRe,step:mRe,smoothstep:hRe,simplebezier:uRe},LJ={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},Tbt=(e,t,n)=>n===pn.Left?e-t:n===pn.Right?e+t:e,Abt=(e,t,n)=>n===pn.Top?e-t:n===pn.Bottom?e+t:e,$J="react-flow__edgeupdater";function FJ({position:e,centerX:t,centerY:n,radius:i=10,onMouseDown:r,onMouseEnter:s,onMouseOut:a,type:l}){return o.jsx("circle",{onMouseDown:r,onMouseEnter:s,onMouseOut:a,className:Fo([$J,`${$J}-${l}`]),cx:Tbt(t,i,e),cy:Abt(n,i,e),r:i,stroke:"transparent",fill:"transparent"})}function _bt({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:i,sourceY:r,targetX:s,targetY:a,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:N,lib:A,onConnectStart:j,cancelConnection:T,nodeLookup:R,rfId:_,panBy:D,updateConnection:M}=g.getState(),P=S.type==="target",L=(z,K)=>{h(!1),f==null||f(z,n,S.type,K)},F=z=>u==null?void 0:u(n,z),I=(z,K)=>{h(!0),d==null||d(O,n,S.type),j==null||j(z,K)};KF.onPointerDown(O.nativeEvent,{autoPanOnConnect:k,connectionMode:E,connectionRadius:N,domNode:C,handleId:S.id,nodeId:S.nodeId,nodeLookup:R,isTarget:P,edgeUpdaterType:S.type,lib:A,flowId:_,cancelConnection:T,panBy:D,isValidConnection:(...z)=>{var K,B;return((B=(K=g.getState()).isValidConnection)==null?void 0:B.call(K,...z))??!0},onConnect:F,onConnectStart:I,onConnectEnd:(...z)=>{var K,B;return(B=(K=g.getState()).onConnectEnd)==null?void 0:B.call(K,...z)},onReconnectEnd:L,updateConnection:M,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 o.jsxs(o.Fragment,{children:[(e===!0||e==="source")&&o.jsx(FJ,{position:l,centerX:i,centerY:r,radius:t,onMouseDown:v,onMouseEnter:x,onMouseOut:w,type:"source"}),(e===!0||e==="target")&&o.jsx(FJ,{position:c,centerX:s,centerY:a,radius:t,onMouseDown:y,onMouseEnter:x,onMouseOut:w,type:"target"})]})}function jbt({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:i,onClick:r,onDoubleClick:s,onContextMenu:a,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])||MJ[S];k===void 0&&(y==null||y("011",Dd.error011(S)),S="default",k=(b==null?void 0:b.default)||MJ.default);const C=!!(w.focusable||t&&typeof w.focusable>"u"),E=typeof f<"u"&&(w.reconnectable||n&&typeof w.reconnectable>"u"),N=!!(w.selectable||i&&typeof w.selectable>"u"),A=p.useRef(null),[j,T]=p.useState(!1),[R,_]=p.useState(!1),D=_s(),{zIndex:M,sourceX:P,sourceY:L,targetX:F,targetY:I,sourcePosition:z,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,...LJ};const de=Cmt({id:e,sourceNode:G,targetNode:te,sourceHandle:w.sourceHandle||null,targetHandle:w.targetHandle||null,connectionMode:Y.connectionMode,onError:y});return{zIndex:ymt({selected:w.selected,zIndex:w.zIndex,sourceNode:G,targetNode:te,elevateOnSelect:Y.elevateEdgesOnSelect,zIndexMode:Y.zIndexMode}),...de||LJ}},[w.source,w.target,w.sourceHandle,w.targetHandle,w.selected,w.zIndex]),As),B=p.useMemo(()=>w.markerStart?`url('#${qF(w.markerStart,g)}')`:void 0,[w.markerStart,g]),W=p.useMemo(()=>w.markerEnd?`url('#${qF(w.markerEnd,g)}')`:void 0,[w.markerEnd,g]);if(w.hidden||P===null||L===null||F===null||I===null)return null;const H=Y=>{var Ce;const{addSelectedEdges:G,unselectNodesAndEdges:te,multiSelectionActive:de}=D.getState();N&&(D.setState({nodesSelectionActive:!1}),w.selected&&de?(te({nodes:[],edges:[w]}),(Ce=A.current)==null||Ce.blur()):G([e])),r&&r(Y,w)},X=s?Y=>{s(Y,{...w})}:void 0,ie=a?Y=>{a(Y,{...w})}:void 0,Q=l?Y=>{l(Y,{...w})}:void 0,Z=c?Y=>{c(Y,{...w})}:void 0,ue=u?Y=>{u(Y,{...w})}:void 0,Ee=Y=>{var G;if(!x&&bNe.includes(Y.key)&&N){const{unselectNodesAndEdges:te,addSelectedEdges:de}=D.getState();Y.key==="Escape"?((G=A.current)==null||G.blur(),te({edges:[w]})):de([e])}};return o.jsx("svg",{style:{zIndex:M},children:o.jsxs("g",{className:Fo(["react-flow__edge",`react-flow__edge-${S}`,w.className,v,{selected:w.selected,animated:w.animated,inactive:!N&&!r,updating:j,selectable:N}]),onClick:H,onDoubleClick:X,onContextMenu:ie,onMouseEnter:Q,onMouseMove:Z,onMouseLeave:ue,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?`${KNe}-${g}`:void 0,ref:A,...w.domAttributes,children:[!R&&o.jsx(k,{id:e,source:w.source,target:w.target,type:w.type,selected:w.selected,animated:w.animated,selectable:N,deletable:w.deletable??!0,label:w.label,labelStyle:w.labelStyle,labelShowBg:w.labelShowBg,labelBgStyle:w.labelBgStyle,labelBgPadding:w.labelBgPadding,labelBgBorderRadius:w.labelBgBorderRadius,sourceX:P,sourceY:L,targetX:F,targetY:I,sourcePosition:z,targetPosition:K,data:w.data,style:w.style,sourceHandleId:w.sourceHandle,targetHandleId:w.targetHandle,markerStart:B,markerEnd:W,pathOptions:"pathOptions"in w?w.pathOptions:void 0,interactionWidth:w.interactionWidth}),E&&o.jsx(_bt,{edge:w,isReconnectable:E,reconnectRadius:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:m,sourceX:P,sourceY:L,targetX:F,targetY:I,sourcePosition:z,targetPosition:K,setUpdateHover:T,setReconnecting:_})]})})}var Nbt=p.memo(jbt);const Rbt=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function xRe({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:i,noPanClassName:r,onReconnect:s,onEdgeContextMenu:a,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(Rbt,As),O=gbt(t);return o.jsxs("div",{className:"react-flow__edges",children:[o.jsx(wbt,{defaultColor:e,rfId:n}),O.map(S=>o.jsx(Nbt,{id:S,edgesFocusable:v,edgesReconnectable:y,elementsSelectable:x,noPanClassName:r,onReconnect:s,onContextMenu:a,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))]})}xRe.displayName="EdgeRenderer";const Ibt=p.memo(xRe),Pbt=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function Dbt({children:e}){const t=zi(Pbt);return o.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function Mbt(e){const t=UP(),n=p.useRef(!1);p.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const Lbt=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function $bt(e){const t=zi(Lbt),n=_s();return p.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function Fbt(e){return e.connection.inProgress?{...e.connection,to:Yw(e.connection.to,e.transform)}:{...e.connection}}function Bbt(e){return Fbt}function Ubt(e){const t=Bbt();return zi(t,As)}const Qbt=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function zbt({containerStyle:e,style:t,type:n,component:i}){const{nodesConnectable:r,width:s,height:a,isValid:l,inProgress:c}=zi(Qbt,As);return!(s&&r&&c)?null:o.jsx("svg",{style:e,width:s,height:a,className:"react-flow__connectionline react-flow__container",children:o.jsx("g",{className:Fo(["react-flow__connection",xNe(l)]),children:o.jsx(wRe,{style:t,type:n,CustomComponent:i,isValid:l})})})}const wRe=({style:e,type:t=bm.Bezier,CustomComponent:n,isValid:i})=>{const{inProgress:r,from:s,fromNode:a,fromHandle:l,fromPosition:c,to:u,toNode:d,toHandle:f,toPosition:h,pointer:m}=Ubt();if(!r)return;if(n)return o.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:a,fromHandle:l,fromX:s.x,fromY:s.y,toX:u.x,toY:u.y,fromPosition:c,toPosition:h,connectionStatus:xNe(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 bm.Bezier:[g]=NNe(b);break;case bm.SimpleBezier:[g]=lRe(b);break;case bm.Step:[g]=VN({...b,borderRadius:0});break;case bm.SmoothStep:[g]=VN(b);break;default:[g]=INe(b)}return o.jsx("path",{d:g,fill:"none",className:"react-flow__connection-path",style:e})};wRe.displayName="ConnectionLine";const Vbt={};function BJ(e=Vbt){p.useRef(e),_s(),p.useEffect(()=>{},[e])}function Hbt(){_s(),p.useRef(!1),p.useEffect(()=>{},[])}function ORe({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:i,onEdgeClick:r,onNodeDoubleClick:s,onEdgeDoubleClick:a,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:N,elementsSelectable:A,defaultViewport:j,translateExtent:T,minZoom:R,maxZoom:_,preventScrolling:D,defaultMarkerColor:M,zoomOnScroll:P,zoomOnPinch:L,panOnScroll:F,panOnScrollSpeed:I,panOnScrollMode:z,zoomOnDoubleClick:K,panOnDrag:B,autoPanOnSelection:W,onPaneClick:H,onPaneMouseEnter:X,onPaneMouseMove:ie,onPaneMouseLeave:Q,onPaneScroll:Z,onPaneContextMenu:ue,paneClickDistance:Ee,nodeClickDistance:Y,onEdgeContextMenu:G,onEdgeMouseEnter:te,onEdgeMouseMove:de,onEdgeMouseLeave:Ce,reconnectRadius:le,onReconnect:fe,onReconnectStart:re,onReconnectEnd:Oe,noDragClassName:Pe,noWheelClassName:be,noPanClassName:Qe,disableKeyboardA11y:ve,nodeExtent:Ne,rfId:ne,viewport:ye,onViewportChange:Te}){return BJ(e),BJ(t),Hbt(),Mbt(n),$bt(ye),o.jsx(obt,{onPaneClick:H,onPaneMouseEnter:X,onPaneMouseMove:ie,onPaneMouseLeave:Q,onPaneContextMenu:ue,onPaneScroll:Z,paneClickDistance:Ee,deleteKeyCode:E,selectionKeyCode:x,selectionOnDrag:w,selectionMode:O,onSelectionStart:h,onSelectionEnd:m,multiSelectionKeyCode:S,panActivationKeyCode:k,zoomActivationKeyCode:C,elementsSelectable:A,zoomOnScroll:P,zoomOnPinch:L,zoomOnDoubleClick:K,panOnScroll:F,panOnScrollSpeed:I,panOnScrollMode:z,panOnDrag:B,autoPanOnSelection:W,defaultViewport:j,translateExtent:T,minZoom:R,maxZoom:_,onSelectionContextMenu:f,preventScrolling:D,noDragClassName:Pe,noWheelClassName:be,noPanClassName:Qe,disableKeyboardA11y:ve,onViewportChange:Te,isControlledViewport:!!ye,children:o.jsxs(Dbt,{children:[o.jsx(Ibt,{edgeTypes:t,onEdgeClick:r,onEdgeDoubleClick:a,onReconnect:fe,onReconnectStart:re,onReconnectEnd:Oe,onlyRenderVisibleElements:N,onEdgeContextMenu:G,onEdgeMouseEnter:te,onEdgeMouseMove:de,onEdgeMouseLeave:Ce,reconnectRadius:le,defaultMarkerColor:M,noPanClassName:Qe,disableKeyboardA11y:ve,rfId:ne}),o.jsx(zbt,{style:b,type:g,component:v,containerStyle:y}),o.jsx("div",{className:"react-flow__edgelabel-renderer"}),o.jsx(mbt,{nodeTypes:e,onNodeClick:i,onNodeDoubleClick:s,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:d,nodeClickDistance:Y,onlyRenderVisibleElements:N,noPanClassName:Qe,noDragClassName:Pe,disableKeyboardA11y:ve,nodeExtent:Ne,rfId:ne}),o.jsx("div",{className:"react-flow__viewport-portal"})]})})}ORe.displayName="GraphView";const qbt=p.memo(ORe),Wbt=ENe(),UJ=({nodes:e,edges:t,defaultNodes:n,defaultEdges:i,width:r,height:s,fitView:a,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??lE;MNe(b,v,y);const{nodesInitialized:S}=WF(x,m,g,{nodeOrigin:w,nodeExtent:O,zIndexMode:h});let k=[0,0,1];if(a&&r&&s){const C=QC(m,{filter:j=>!!((j.width||j.initialWidth)&&(j.height||j.initialHeight))}),{x:E,y:N,zoom:A}=mz(C,r,s,c,u,(l==null?void 0:l.padding)??.1);k=[E,N,A]}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:lE,nodeExtent:O,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:iw.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:a??!1,fitViewOptions:l,fitViewResolver:null,connection:{...vNe},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:Wbt,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:yNe,zIndexMode:h,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},Kbt=({nodes:e,edges:t,defaultNodes:n,defaultEdges:i,width:r,height:s,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h})=>cgt((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 dmt({nodes:v,width:O,height:S,panZoom:y,minZoom:k,maxZoom:C},x),w==null||w.resolve(!0),m({fitViewResolver:null}))}return{...UJ({nodes:e,edges:t,width:r,height:s,fitView:a,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:N}=WF(v,y,x,{nodeOrigin:w,nodeExtent:f,elevateNodesOnSelect:O,checkEquality:!0,zIndexMode:k}),A=C&&N;S&&E?(b(),m({nodes:v,nodesInitialized:E,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:A})):m({nodes:v,nodesInitialized:E,nodesSelectionActive:A})},setEdges:v=>{const{connectionLookup:y,edgeLookup:x}=g();MNe(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:N}=g(),{changes:A,updatedInternals:j}=Pmt(v,x,w,O,S,k,N);j&&(jmt(x,w,{nodeOrigin:S,nodeExtent:k,zIndexMode:N}),E?(b(),m({fitViewQueued:!1,fitViewOptions:void 0})):m({}),(A==null?void 0:A.length)>0&&(C&&console.log("React Flow: trigger node changes",A),y==null||y(A)))},updateNodePositions:(v,y=!1)=>{const x=[];let w=[];const{nodeLookup:O,triggerNodeChanges:S,connection:k,updateConnection:C,onNodesChangeMiddlewareMap:E}=g();for(const[N,A]of v){const j=O.get(N),T=!!(j!=null&&j.expandParent&&(j!=null&&j.parentId)&&(A!=null&&A.position)),R={id:N,type:"position",position:T?{x:Math.max(0,A.position.x),y:Math.max(0,A.position.y)}:A.position,dragging:y};if(j&&k.inProgress&&k.fromNode.id===j.id){const _=Cy(j,k.fromHandle,pn.Left,!0);C({...k,from:_})}T&&j.parentId&&x.push({id:N,parentId:j.parentId,rect:{...A.internals.positionAbsolute,width:A.measured.width??0,height:A.measured.height??0}}),w.push(R)}if(x.length>0){const{parentLookup:N,nodeOrigin:A}=g(),j=Oz(x,O,N,A);w.push(...j)}for(const N of E.values())w=N(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=YNe(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=ZNe(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=>Ob(C,!0));O(k);return}O(Lv(w,new Set([...v]),!0)),S(Lv(x))},addSelectedEdges:v=>{const{multiSelectionActive:y,edgeLookup:x,nodeLookup:w,triggerNodeChanges:O,triggerEdgeChanges:S}=g();if(y){const k=v.map(C=>Ob(C,!0));S(k);return}S(Lv(x,new Set([...v]))),O(Lv(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,N=[];for(const j of C){if(!j.selected)continue;const T=O.get(j.id);T&&(T.selected=!1),N.push(Ob(j.id,!1))}const A=[];for(const j of E)j.selected&&A.push(Ob(j.id,!1));S(N),k(A)},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,Ob(E.id,!1)]:C,[]),k=v.reduce((C,E)=>E.selected?[...C,Ob(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]||(WF(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 Dmt({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:{...vNe}})},updateConnection:v=>{m({connection:v})},reset:()=>m({...UJ()})}},Object.is);function kRe({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:i,initialWidth:r,initialHeight:s,initialMinZoom:a,initialMaxZoom:l,initialFitViewOptions:c,fitView:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h,children:m}){const[g]=p.useState(()=>Kbt({nodes:e,edges:t,defaultNodes:n,defaultEdges:i,width:r,height:s,fitView:u,minZoom:a,maxZoom:l,fitViewOptions:c,nodeOrigin:d,nodeExtent:f,zIndexMode:h}));return o.jsx(ugt,{value:g,children:o.jsx(Dgt,{children:m})})}function Gbt({children:e,nodes:t,edges:n,defaultNodes:i,defaultEdges:r,width:s,height:a,fitView:l,fitViewOptions:c,minZoom:u,maxZoom:d,nodeOrigin:f,nodeExtent:h,zIndexMode:m}){return p.useContext(FP)?o.jsx(o.Fragment,{children:e}):o.jsx(kRe,{initialNodes:t,initialEdges:n,defaultNodes:i,defaultEdges:r,initialWidth:s,initialHeight:a,fitView:l,initialFitViewOptions:c,initialMinZoom:u,initialMaxZoom:d,nodeOrigin:f,nodeExtent:h,zIndexMode:m,children:e})}const Xbt={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function Ybt({nodes:e,edges:t,defaultNodes:n,defaultEdges:i,className:r,nodeTypes:s,edgeTypes:a,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:N,onNodesDelete:A,onEdgesDelete:j,onDelete:T,onSelectionChange:R,onSelectionDragStart:_,onSelectionDrag:D,onSelectionDragStop:M,onSelectionContextMenu:P,onSelectionStart:L,onSelectionEnd:F,onBeforeDelete:I,connectionMode:z,connectionLineType:K=bm.Bezier,connectionLineStyle:B,connectionLineComponent:W,connectionLineContainerStyle:H,deleteKeyCode:X="Backspace",selectionKeyCode:ie="Shift",selectionOnDrag:Q=!1,selectionMode:Z=cE.Full,panActivationKeyCode:ue="Space",multiSelectionKeyCode:Ee=fE()?"Meta":"Control",zoomActivationKeyCode:Y=fE()?"Meta":"Control",snapToGrid:G,snapGrid:te,onlyRenderVisibleElements:de=!1,selectNodesOnDrag:Ce,nodesDraggable:le,autoPanOnNodeFocus:fe,nodesConnectable:re,nodesFocusable:Oe,nodeOrigin:Pe=GNe,edgesFocusable:be,edgesReconnectable:Qe,elementsSelectable:ve=!0,defaultViewport:Ne=kgt,minZoom:ne=.5,maxZoom:ye=2,translateExtent:Te=lE,preventScrolling:Se=!0,nodeExtent:Ke,defaultMarkerColor:it="#b1b1b7",zoomOnScroll:he=!0,zoomOnPinch:xe=!0,panOnScroll:Ae=!1,panOnScrollSpeed:qe=.5,panOnScrollMode:Me=iy.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:Le,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:Ti,autoPanOnNodeDrag:jn,autoPanOnSelection:Hn=!0,autoPanSpeed:En,connectionRadius:vi,isValidConnection:Fn,onError:di,style:wr,id:gr,nodeDragThreshold:ir,connectionDragThreshold:Ve,viewport:kt,onViewportChange:rn,width:Nn,height:se,colorMode:xi="light",debug:is,onScroll:$r,ariaLabelConfig:qn,zIndexMode:oi="basic",...Vi},Fr){const ia=gr||"1",Wa=Tgt(xi),Hr=p.useCallback(ko=>{ko.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),$r==null||$r(ko)},[$r]);return o.jsx("div",{"data-testid":"rf__wrapper",...Vi,onScroll:Hr,style:{...wr,...Xbt},ref:Fr,className:Fo(["react-flow",r,Wa]),id:gr,role:"application",children:o.jsxs(Gbt,{nodes:e,edges:t,width:Nn,height:se,fitView:dn,fitViewOptions:Rt,minZoom:ne,maxZoom:ye,nodeOrigin:Pe,nodeExtent:Ke,zIndexMode:oi,children:[o.jsx(Cgt,{nodes:e,edges:t,defaultNodes:n,defaultEdges:i,onConnect:m,onConnectStart:g,onConnectEnd:b,onClickConnectStart:v,onClickConnectEnd:y,nodesDraggable:le,autoPanOnNodeFocus:fe,nodesConnectable:re,nodesFocusable:Oe,edgesFocusable:be,edgesReconnectable:Qe,elementsSelectable:ve,elevateNodesOnSelect:mt,elevateEdgesOnSelect:_n,minZoom:ne,maxZoom:ye,nodeExtent:Ke,onNodesChange:cn,onEdgesChange:hn,snapToGrid:G,snapGrid:te,connectionMode:z,translateExtent:Te,connectOnClick:$e,defaultEdgeOptions:Ye,fitView:dn,fitViewOptions:Rt,onNodesDelete:A,onEdgesDelete:j,onDelete:T,onNodeDragStart:C,onNodeDrag:E,onNodeDragStop:N,onSelectionDrag:D,onSelectionDragStart:_,onSelectionDragStop:M,onMove:d,onMoveStart:f,onMoveEnd:h,noPanClassName:St,nodeOrigin:Pe,rfId:ia,autoPanOnConnect:Ti,autoPanOnNodeDrag:jn,autoPanSpeed:En,onError:di,connectionRadius:vi,isValidConnection:Fn,selectNodesOnDrag:Ce,nodeDragThreshold:ir,connectionDragThreshold:Ve,onBeforeDelete:I,debug:is,ariaLabelConfig:qn,zIndexMode:oi}),o.jsx(qbt,{onInit:u,onNodeClick:l,onEdgeClick:c,onNodeMouseEnter:x,onNodeMouseMove:w,onNodeMouseLeave:O,onNodeContextMenu:S,onNodeDoubleClick:k,nodeTypes:s,edgeTypes:a,connectionLineType:K,connectionLineStyle:B,connectionLineComponent:W,connectionLineContainerStyle:H,selectionKeyCode:ie,selectionOnDrag:Q,selectionMode:Z,deleteKeyCode:X,multiSelectionKeyCode:Ee,panActivationKeyCode:ue,zoomActivationKeyCode:Y,onlyRenderVisibleElements:de,defaultViewport:Ne,translateExtent:Te,minZoom:ne,maxZoom:ye,preventScrolling:Se,zoomOnScroll:he,zoomOnPinch:xe,zoomOnDoubleClick:At,panOnScroll:Ae,panOnScrollSpeed:qe,panOnScrollMode:Me,panOnDrag:It,autoPanOnSelection:Hn,onPaneClick:lt,onPaneMouseEnter:Ot,onPaneMouseMove:Ct,onPaneMouseLeave:dt,onPaneScroll:yt,onPaneContextMenu:Ie,paneClickDistance:vt,nodeClickDistance:jt,onSelectionContextMenu:P,onSelectionStart:L,onSelectionEnd:F,onReconnect:ln,onReconnectStart:He,onReconnectEnd:Le,onEdgeContextMenu:We,onEdgeDoubleClick:gt,onEdgeMouseEnter:st,onEdgeMouseMove:xt,onEdgeMouseLeave:ft,reconnectRadius:Ht,defaultMarkerColor:it,noDragClassName:Ge,noWheelClassName:bt,noPanClassName:St,rfId:ia,disableKeyboardA11y:Vt,nodeExtent:Ke,viewport:kt,onViewportChange:rn}),o.jsx(Ogt,{onSelectionChange:R}),Nt,o.jsx(bgt,{proOptions:vn,position:ot}),o.jsx(ggt,{rfId:ia,disableKeyboardA11y:Vt})]})})}var Zbt=JNe(Ybt);const Jbt=e=>{var t;return(t=e.domNode)==null?void 0:t.querySelector(".react-flow__edgelabel-renderer")};function eyt({children:e}){const t=zi(Jbt);return t?Jn.createPortal(e,t):null}function tyt(e){const[t,n]=p.useState(e),i=p.useCallback(r=>n(s=>YNe(r,s)),[]);return[t,n,i]}function nyt(e){const[t,n]=p.useState(e),i=p.useCallback(r=>n(s=>ZNe(r,s)),[]);return[t,n,i]}const iyt=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||!gz(n.userNode))return!1;return!0};function ryt(e={includeHiddenNodes:!1}){return zi(iyt(e))}function syt({dimensions:e,lineWidth:t,variant:n,className:i}){return o.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Fo(["react-flow__background-pattern",n,i])})}function oyt({radius:e,className:t}){return o.jsx("circle",{cx:e,cy:e,r:e,className:Fo(["react-flow__background-pattern","dots",t])})}var Hm;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Hm||(Hm={}));const ayt={[Hm.Dots]:1,[Hm.Lines]:1,[Hm.Cross]:6},lyt=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function SRe({id:e,variant:t=Hm.Dots,gap:n=20,size:i,lineWidth:r=1,offset:s=0,color:a,bgColor:l,style:c,className:u,patternClassName:d}){const f=p.useRef(null),{transform:h,patternId:m}=zi(lyt,As),g=i||ayt[t],b=t===Hm.Dots,v=t===Hm.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 o.jsxs("svg",{className:Fo(["react-flow__background",u]),style:{...c,...QP,"--xy-background-color-props":l,"--xy-background-pattern-color-props":a},ref:f,"data-testid":"rf__background",children:[o.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?o.jsx(oyt,{radius:w/2,className:d}):o.jsx(syt,{dimensions:S,lineWidth:r,variant:t,className:d})}),o.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${C})`})]})}SRe.displayName="Background";const cyt=p.memo(SRe);function uyt(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:o.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function dyt(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:o.jsx("path",{d:"M0 0h32v4.2H0z"})})}function fyt(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:o.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 hyt(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:o.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 pyt(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:o.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 J2({children:e,className:t,...n}){return o.jsx("button",{type:"button",className:Fo(["react-flow__controls-button",t]),...n,children:e})}const myt=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function ERe({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:i=!0,fitViewOptions:r,onZoomIn:s,onZoomOut:a,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(myt,As),{zoomIn:w,zoomOut:O,fitView:S}=UP(),k=()=>{w(),s==null||s()},C=()=>{O(),a==null||a()},E=()=>{S(r),l==null||l()},N=()=>{g.setState({nodesDraggable:!b,nodesConnectable:!b,elementsSelectable:!b}),c==null||c(!b)},A=h==="horizontal"?"horizontal":"vertical";return o.jsxs(BP,{className:Fo(["react-flow__controls",A,u]),position:f,style:e,"data-testid":"rf__controls","aria-label":m??x["controls.ariaLabel"],children:[t&&o.jsxs(o.Fragment,{children:[o.jsx(J2,{onClick:k,className:"react-flow__controls-zoomin",title:x["controls.zoomIn.ariaLabel"],"aria-label":x["controls.zoomIn.ariaLabel"],disabled:y,children:o.jsx(uyt,{})}),o.jsx(J2,{onClick:C,className:"react-flow__controls-zoomout",title:x["controls.zoomOut.ariaLabel"],"aria-label":x["controls.zoomOut.ariaLabel"],disabled:v,children:o.jsx(dyt,{})})]}),n&&o.jsx(J2,{className:"react-flow__controls-fitview",onClick:E,title:x["controls.fitView.ariaLabel"],"aria-label":x["controls.fitView.ariaLabel"],children:o.jsx(fyt,{})}),i&&o.jsx(J2,{className:"react-flow__controls-interactive",onClick:N,title:x["controls.interactive.ariaLabel"],"aria-label":x["controls.interactive.ariaLabel"],children:b?o.jsx(pyt,{}):o.jsx(hyt,{})}),d]})}ERe.displayName="Controls";const gyt=p.memo(ERe);function byt({id:e,x:t,y:n,width:i,height:r,style:s,color:a,strokeColor:l,strokeWidth:c,className:u,borderRadius:d,shapeRendering:f,selected:h,onClick:m}){const{background:g,backgroundColor:b}=s||{},v=a||g||b;return o.jsx("rect",{className:Fo(["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 yyt=p.memo(byt),vyt=e=>e.nodes.map(t=>t.id),TL=e=>e instanceof Function?e:()=>e;function xyt({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:i=5,nodeStrokeWidth:r,nodeComponent:s=yyt,onClick:a}){const l=zi(vyt,As),c=TL(t),u=TL(e),d=TL(n),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return o.jsx(o.Fragment,{children:l.map(h=>o.jsx(Oyt,{id:h,nodeColorFunc:c,nodeStrokeColorFunc:u,nodeClassNameFunc:d,nodeBorderRadius:i,nodeStrokeWidth:r,NodeComponent:s,onClick:a,shapeRendering:f},h))})}function wyt({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:i,nodeBorderRadius:r,nodeStrokeWidth:s,shapeRendering:a,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}=Ap(v);return{node:v,x:y,y:x,width:w,height:O}},As);return!u||u.hidden||!gz(u)?null:o.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:a,onClick:c,id:u.id})}const Oyt=p.memo(wyt);var kyt=p.memo(xyt);const Syt=200,Eyt=150,Cyt=e=>!e.hidden,Tyt=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?SNe(QC(e.nodeLookup,{filter:Cyt}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},Ayt="react-flow__minimap-desc";function CRe({style:e,className:t,nodeStrokeColor:n,nodeColor:i,nodeClassName:r="",nodeBorderRadius:s=5,nodeStrokeWidth:a,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:N,panZoom:A,translateExtent:j,flowWidth:T,flowHeight:R,ariaLabelConfig:_}=zi(Tyt,As),D=(e==null?void 0:e.width)??Syt,M=(e==null?void 0:e.height)??Eyt,P=C.width/D,L=C.height/M,F=Math.max(P,L),I=F*D,z=F*M,K=O*F,B=C.x-(I-C.width)/2-K,W=C.y-(z-C.height)/2-K,H=I+K*2,X=z+K*2,ie=`${Ayt}-${N}`,Q=p.useRef(0),Z=p.useRef();Q.current=F,p.useEffect(()=>{if(k.current&&A)return Z.current=Vmt({domNode:k.current,panZoom:A,getTransform:()=>S.getState().transform,getViewScale:()=>Q.current}),()=>{var G;(G=Z.current)==null||G.destroy()}},[A]),p.useEffect(()=>{var G;(G=Z.current)==null||G.update({translateExtent:j,width:T,height:R,inversePan:x,pannable:b,zoomStep:w,zoomable:v})},[b,v,x,w,j,T,R]);const ue=m?G=>{var Ce;const[te,de]=((Ce=Z.current)==null?void 0:Ce.pointer(G))||[0,0];m(G,{x:te,y:de})}:void 0,Ee=g?p.useCallback((G,te)=>{const de=S.getState().nodeLookup.get(te).internals.userNode;g(G,de)},[]):void 0,Y=y??_["minimap.ariaLabel"];return o.jsx(BP,{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*F: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 a=="number"?a:void 0},className:Fo(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:o.jsxs("svg",{width:D,height:M,viewBox:`${B} ${W} ${H} ${X}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":ie,ref:k,onClick:ue,children:[Y&&o.jsx("title",{id:ie,children:Y}),o.jsx(kyt,{onClick:Ee,nodeColor:i,nodeStrokeColor:n,nodeBorderRadius:s,nodeClassName:r,nodeStrokeWidth:a,nodeComponent:l}),o.jsx("path",{className:"react-flow__minimap-mask",d:`M${B-K},${W-K}h${H+K*2}v${X+K*2}h${-H-K*2}z +`)),d=u.reduce((f,h)=>f.concat(...h),[]);return[u,d]}return[[],[]]},[e]);return p.useEffect(()=>{const c=(t==null?void 0:t.target)??SJ,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)&&ANe(m))return!1;const b=CJ(m.code,l);if(s.current.add(m[b]),EJ(a,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=CJ(m.code,l);EJ(a,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 CJ(e,t){return t.includes(e)?"code":"key"}const Agt=()=>{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:a}=e.getState();return a?(await a.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:a,panZoom:l}=e.getState(),c=mz(t,i,r,s,a,(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:a}=e.getState();if(!a)return t;const{x:l,y:c}=a.getBoundingClientRect(),u={x:t.x-l,y:t.y-c},d=n.snapGrid??r,f=n.snapToGrid??s;return Yw(u,i,f,d)},flowToScreenPosition:t=>{const{transform:n,domNode:i}=e.getState();if(!i)return t;const{x:r,y:s}=i.getBoundingClientRect(),a=ow(t,n);return{x:a.x+r,y:a.y+s}}}),[])};function XNe(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 a=i.get(s.id);a?a.push(s):i.set(s.id,[s])}for(const s of t){const a=i.get(s.id);if(!a){n.push(s);continue}if(a[0].type==="remove")continue;if(a[0].type==="replace"){n.push({...a[0].item});continue}const l={...s};for(const c of a)_gt(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 _gt(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 YNe(e,t){return XNe(e,t)}function ZNe(e,t){return XNe(e,t)}function Ob(e,t){return{id:e,type:"select",selected:t}}function Lv(e,t=new Set,n=!1){const i=[];for(const[r,s]of e){const a=t.has(r);!(s.selected===void 0&&!a)&&s.selected!==a&&(n&&(s.selected=a),i.push(Ob(s.id,a)))}return i}function TJ({items:e=[],lookup:t}){var r;const n=[],i=new Map(e.map(s=>[s.id,s]));for(const[s,a]of e.entries()){const l=t.get(a.id),c=((r=l==null?void 0:l.internals)==null?void 0:r.userNode)??l;c!==void 0&&c!==a&&n.push({id:a.id,item:a,type:"replace"}),c===void 0&&n.push({item:a,type:"add",index:s})}for(const[s]of t)i.get(s)===void 0&&n.push({id:s,type:"remove"});return n}function AJ(e){return{id:e.id,type:"remove"}}const jgt=ENe();function Ngt(e,t,n={}){return Omt(e,t,{...n,onError:n.onError??jgt})}const _J=e=>amt(e),Rgt=e=>wNe(e);function JNe(e){return p.forwardRef(e)}const Igt=typeof window<"u"?p.useLayoutEffect:p.useEffect;function jJ(e){const[t,n]=p.useState(BigInt(0)),[i]=p.useState(()=>Pgt(()=>n(r=>r+BigInt(1))));return Igt(()=>{const r=i.get();r.length&&(e(r),i.reset())},[t]),i}function Pgt(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const eRe=p.createContext(null);function Dgt({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=TJ({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=jJ(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(TJ({items:m,lookup:h}))},[]),s=jJ(r),a=p.useMemo(()=>({nodeQueue:i,edgeQueue:s}),[]);return o.jsx(eRe.Provider,{value:a,children:e})}function Mgt(){const e=p.useContext(eRe);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const Lgt=e=>!!e.panZoom;function UP(){const e=Agt(),t=_s(),n=Mgt(),i=zi(Lgt),r=p.useMemo(()=>{const s=f=>t.getState().nodeLookup.get(f),a=f=>{n.nodeQueue.push(f)},l=f=>{n.edgeQueue.push(f)},c=f=>{var y,x;const{nodeLookup:h,nodeOrigin:m}=t.getState(),g=_J(f)?f:h.get(f.id),b=g.parentId?CNe(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 sw(v)},u=(f,h,m={replace:!1})=>{a(g=>g.map(b=>{if(b.id===f){const v=typeof h=="function"?h(b):h;return m.replace&&_J(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&&Rgt(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:a,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 fmt({nodesToRemove:f,edgesToRemove:h,nodes:m,edges:g,onBeforeDelete:O}),C=k.length>0,E=S.length>0;if(C){const N=k.map(AJ);v==null||v(k),x(N)}if(E){const N=S.map(AJ);b==null||b(S),y(N)}return(E||C)&&(w==null||w({nodes:S,edges:k})),{deletedNodes:S,deletedEdges:k}},getIntersectingNodes:(f,h=!0,m)=>{const g=sJ(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=sw(v?y:x),O=dE(w,b);return h&&O>0||O>=w.width*w.height||O>=b.width*b.height}):[]},isNodeIntersecting:(f,h,m=!0)=>{const b=sJ(f)?f:c(f);if(!b)return!1;const v=dE(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 lmt(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??mmt();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 NJ=e=>e.selected,$gt=typeof window<"u"?window:void 0;function Fgt({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=_s(),{deleteElements:i}=UP(),r=hE(e,{actInsideInputWithModifier:!1}),s=hE(t,{target:$gt});p.useEffect(()=>{if(r){const{edges:a,nodes:l}=n.getState();i({nodes:l.filter(NJ),edges:a.filter(NJ)}),n.setState({nodesSelectionActive:!1})}},[r]),p.useEffect(()=>{n.setState({multiSelectionActive:s})},[s])}function Bgt(e){const t=_s();p.useEffect(()=>{const n=()=>{var r,s,a,l;if(!e.current||!(((s=(r=e.current).checkVisibility)==null?void 0:s.call(r))??!0))return!1;const i=bz(e.current);(i.height===0||i.width===0)&&((l=(a=t.getState()).onError)==null||l.call(a,"004",Dd.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 QP={position:"absolute",width:"100%",height:"100%",top:0,left:0},Ugt=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Qgt({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:i=!1,panOnScrollSpeed:r=.5,panOnScrollMode:s=iy.Free,zoomOnDoubleClick:a=!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:N}=zi(Ugt,As),A=hE(h),j=p.useRef();Bgt(k);const T=p.useCallback(R=>{y==null||y({x:R[0],y:R[1],zoom:R[2]}),x||S.setState({transform:R})},[y,x]);return p.useEffect(()=>{if(k.current){j.current=Zmt({domNode:k.current,minZoom:d,maxZoom:f,translateExtent:u,viewport:c,onDraggingChange:M=>S.setState(P=>P.paneDragging===M?P:{paneDragging:M}),onPanZoomStart:(M,P)=>{const{onViewportChangeStart:L,onMoveStart:F}=S.getState();F==null||F(M,P),L==null||L(P)},onPanZoom:(M,P)=>{const{onViewportChange:L,onMove:F}=S.getState();F==null||F(M,P),L==null||L(P)},onPanZoomEnd:(M,P)=>{const{onViewportChangeEnd:L,onMoveEnd:F}=S.getState();F==null||F(M,P),L==null||L(P)}});const{x:R,y:_,zoom:D}=j.current.getViewport();return S.setState({panZoom:j.current,transform:[R,_,D],domNode:k.current.closest(".react-flow")}),()=>{var M;(M=j.current)==null||M.destroy()}}},[]),p.useEffect(()=>{var R;(R=j.current)==null||R.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:i,panOnScrollSpeed:r,panOnScrollMode:s,zoomOnDoubleClick:a,panOnDrag:l,zoomActivationKeyPressed:A,preventScrolling:m,noPanClassName:v,userSelectionActive:C,noWheelClassName:b,lib:E,onTransformChange:T,connectionInProgress:N,selectionOnDrag:O,paneClickDistance:w})},[e,t,n,i,r,s,a,l,A,m,v,C,b,E,T,N,O,w]),o.jsx("div",{className:"react-flow__renderer",ref:k,style:QP,children:g})}const zgt=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Vgt(){const{userSelectionActive:e,userSelectionRect:t}=zi(zgt,As);return e&&t?o.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 CL=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},Hgt=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function qgt({isSelecting:e,selectionKeyPressed:t,selectionMode:n=cE.Full,panOnDrag:i,autoPanOnSelection:r,paneClickDistance:s,selectionOnDrag:a,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(Hgt,As),E=w&&(e||x),N=p.useRef(null),A=p.useRef(),j=p.useRef(new Set),T=p.useRef(new Set),R=p.useRef(!1),_=p.useRef({x:0,y:0}),D=p.useRef(!1),M=Q=>{if(R.current||S){R.current=!1;return}u==null||u(Q),y.getState().resetSelectedElements(),y.setState({nodesSelectionActive:!1})},P=Q=>{if(Array.isArray(i)&&(i!=null&&i.includes(2))){Q.preventDefault();return}d==null||d(Q)},L=f?Q=>f(Q):void 0,F=Q=>{R.current&&(Q.stopPropagation(),R.current=!1)},I=Q=>{var le,fe;const{domNode:Z,transform:ue}=y.getState();if(A.current=Z==null?void 0:Z.getBoundingClientRect(),!A.current)return;const Ee=Q.target===N.current;if(!Ee&&!!Q.target.closest(".nokey")||!e||!(a&&Ee||t)||Q.button!==0||!Q.isPrimary)return;(fe=(le=Q.target)==null?void 0:le.setPointerCapture)==null||fe.call(le,Q.pointerId),R.current=!1;const{x:te,y:de}=Ed(Q.nativeEvent,A.current),Ce=Yw({x:te,y:de},ue);y.setState({userSelectionRect:{width:0,height:0,startX:Ce.x,startY:Ce.y,x:te,y:de}}),Ee||(Q.stopPropagation(),Q.preventDefault())};function z(Q,Z){const{userSelectionRect:ue}=y.getState();if(!ue)return;const{transform:Ee,nodeLookup:Y,edgeLookup:G,connectionLookup:te,triggerNodeChanges:de,triggerEdgeChanges:Ce,defaultEdgeOptions:le}=y.getState(),fe={x:ue.startX,y:ue.startY},{x:re,y:Oe}=ow(fe,Ee),Pe={startX:fe.x,startY:fe.y,x:QNe.id)),T.current=new Set;const ve=(le==null?void 0:le.selectable)??!0;for(const Ne of j.current){const ne=te.get(Ne);if(ne)for(const{edgeId:ye}of ne.values()){const Te=G.get(ye);Te&&(Te.selectable??ve)&&T.current.add(ye)}}if(!oJ(be,j.current)){const Ne=Lv(Y,j.current,!0);de(Ne)}if(!oJ(Qe,T.current)){const Ne=Lv(G,T.current);Ce(Ne)}y.setState({userSelectionRect:Pe,userSelectionActive:!0,nodesSelectionActive:!1})}function K(){if(!r||!A.current)return;const[Q,Z]=pz(_.current,A.current,C);k({x:Q,y:Z}).then(ue=>{if(!R.current||!ue){v.current=requestAnimationFrame(K);return}const{x:Ee,y:Y}=_.current;z(Ee,Y),v.current=requestAnimationFrame(K)})}const B=()=>{cancelAnimationFrame(v.current),v.current=0,D.current=!1};p.useEffect(()=>()=>B(),[]);const W=Q=>{const{userSelectionRect:Z,transform:ue,resetSelectedElements:Ee}=y.getState();if(!A.current||!Z)return;const{x:Y,y:G}=Ed(Q.nativeEvent,A.current);_.current={x:Y,y:G};const te=ow({x:Z.startX,y:Z.startY},ue);if(!R.current){const de=t?0:s;if(Math.hypot(Y-te.x,G-te.y)<=de)return;Ee(),l==null||l(Q)}R.current=!0,D.current||(K(),D.current=!0),z(Y,G)},H=Q=>{var Z,ue;Q.button===0&&((ue=(Z=Q.target)==null?void 0:Z.releasePointerCapture)==null||ue.call(Z,Q.pointerId),!x&&Q.target===N.current&&y.getState().userSelectionRect&&(M==null||M(Q)),y.setState({userSelectionActive:!1,userSelectionRect:null}),R.current&&(c==null||c(Q),y.setState({nodesSelectionActive:j.current.size>0})),B())},X=Q=>{var Z,ue;(ue=(Z=Q.target)==null?void 0:Z.releasePointerCapture)==null||ue.call(Z,Q.pointerId),B()},ie=i===!0||Array.isArray(i)&&i.includes(0);return o.jsxs("div",{className:Fo(["react-flow__pane",{draggable:ie,dragging:O,selection:e}]),onClick:E?void 0:CL(M,N),onContextMenu:CL(P,N),onWheel:CL(L,N),onPointerEnter:E?void 0:h,onPointerMove:E?W:m,onPointerUp:E?H:void 0,onPointerCancel:E?X:void 0,onPointerDownCapture:E?I:void 0,onClickCapture:E?F:void 0,onPointerLeave:g,ref:N,style:QP,children:[b,o.jsx(Vgt,{})]})}function GF({id:e,store:t,unselect:n=!1,nodeRef:i}){const{addSelectedNodes:r,unselectNodesAndEdges:s,multiSelectionActive:a,nodeLookup:l,onError:c}=t.getState(),u=l.get(e);if(!u){c==null||c("012",Dd.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&a)&&(s({nodes:[u],edges:[]}),requestAnimationFrame(()=>{var d;return(d=i==null?void 0:i.current)==null?void 0:d.blur()})):r([e])}function tRe({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:i,nodeId:r,isSelectable:s,nodeClickDistance:a}){const l=_s(),[c,u]=p.useState(!1),d=p.useRef();return p.useEffect(()=>{d.current=$mt({getStoreItems:()=>l.getState(),onNodeMouseDown:f=>{GF({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:a}),()=>{var f;(f=d.current)==null||f.destroy()}},[n,i,t,s,e,r,a]),c}const Wgt=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function nRe(){const e=_s();return p.useCallback(n=>{const{nodeExtent:i,snapToGrid:r,snapGrid:s,nodesDraggable:a,onError:l,updateNodePositions:c,nodeLookup:u,nodeOrigin:d}=e.getState(),f=new Map,h=Wgt(a),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=zC(x,s));const{position:w,positionAbsolute:O}=ONe({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 kz=p.createContext(null),Kgt=kz.Provider;kz.Consumer;const iRe=()=>p.useContext(kz),Ggt=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),Xgt=(e,t,n)=>i=>{const{connectionClickStartHandle:r,connectionMode:s,connection:a}=i,{fromHandle:l,toHandle:c,isValid:u}=a,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===iw.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 Ygt({type:e="source",position:t=pn.Top,isValidConnection:n,isConnectable:i=!0,isConnectableStart:r=!0,isConnectableEnd:s=!0,id:a,onConnect:l,children:c,className:u,onMouseDown:d,onTouchStart:f,...h},m){var D,M;const g=a||null,b=e==="target",v=_s(),y=iRe(),{connectOnClick:x,noPanClassName:w,rfId:O}=zi(Ggt,As),{connectingFrom:S,connectingTo:k,clickConnecting:C,isPossibleEndHandle:E,connectionInProcess:N,clickConnectionInProcess:A,valid:j}=zi(Xgt(y,g,e),As);y||(M=(D=v.getState()).onError)==null||M.call(D,"010",Dd.error010());const T=P=>{const{defaultEdgeOptions:L,onConnect:F,hasDefaultEdges:I}=v.getState(),z={...L,...P};if(I){const{edges:K,setEdges:B,onError:W}=v.getState();B(Ngt(z,K,{onError:W}))}F==null||F(z),l==null||l(z)},R=P=>{if(!y)return;const L=_Ne(P.nativeEvent);if(r&&(L&&P.button===0||!L)){const F=v.getState();KF.onPointerDown(P.nativeEvent,{handleDomNode:P.currentTarget,autoPanOnConnect:F.autoPanOnConnect,connectionMode:F.connectionMode,connectionRadius:F.connectionRadius,domNode:F.domNode,nodeLookup:F.nodeLookup,lib:F.lib,isTarget:b,handleId:g,nodeId:y,flowId:F.rfId,panBy:F.panBy,cancelConnection:F.cancelConnection,onConnectStart:F.onConnectStart,onConnectEnd:(...I)=>{var z,K;return(K=(z=v.getState()).onConnectEnd)==null?void 0:K.call(z,...I)},updateConnection:F.updateConnection,onConnect:T,isValidConnection:n||((...I)=>{var z,K;return((K=(z=v.getState()).isValidConnection)==null?void 0:K.call(z,...I))??!0}),getTransform:()=>v.getState().transform,getFromHandle:()=>v.getState().connection.fromHandle,autoPanSpeed:F.autoPanSpeed,dragThreshold:F.connectionDragThreshold})}L?d==null||d(P):f==null||f(P)},_=P=>{const{onClickConnectStart:L,onClickConnectEnd:F,connectionClickStartHandle:I,connectionMode:z,isValidConnection:K,lib:B,rfId:W,nodeLookup:H,connection:X}=v.getState();if(!y||!I&&!r)return;if(!I){L==null||L(P.nativeEvent,{nodeId:y,handleId:g,handleType:e}),v.setState({connectionClickStartHandle:{nodeId:y,type:e,id:g}});return}const ie=TNe(P.target),Q=n||K,{connection:Z,isValid:ue}=KF.isValid(P.nativeEvent,{handle:{nodeId:y,id:g,type:e},connectionMode:z,fromNodeId:I.nodeId,fromHandleId:I.id||null,fromType:I.type,isValidConnection:Q,flowId:W,doc:ie,lib:B,nodeLookup:H});ue&&Z&&T(Z);const Ee=structuredClone(X);delete Ee.inProgress,Ee.toPosition=Ee.toHandle?Ee.toHandle.position:null,F==null||F(P,Ee),v.setState({connectionClickStartHandle:null})};return o.jsx("div",{"data-handleid":g,"data-nodeid":y,"data-handlepos":t,"data-id":`${O}-${y}-${g}-${e}`,className:Fo(["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&&(!N||E)&&(N||A?s:r)}]),onMouseDown:R,onTouchStart:R,onClick:x?_:void 0,ref:m,...h,children:c})}const sc=p.memo(JNe(Ygt));function Zgt({data:e,isConnectable:t,sourcePosition:n=pn.Bottom}){return o.jsxs(o.Fragment,{children:[e==null?void 0:e.label,o.jsx(sc,{type:"source",position:n,isConnectable:t})]})}function Jgt({data:e,isConnectable:t,targetPosition:n=pn.Top,sourcePosition:i=pn.Bottom}){return o.jsxs(o.Fragment,{children:[o.jsx(sc,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,o.jsx(sc,{type:"source",position:i,isConnectable:t})]})}function ebt(){return null}function tbt({data:e,isConnectable:t,targetPosition:n=pn.Top}){return o.jsxs(o.Fragment,{children:[o.jsx(sc,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const HN={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},RJ={input:Zgt,default:Jgt,output:tbt,group:ebt};function nbt(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 ibt=e=>{const{width:t,height:n,x:i,y:r}=QC(e.nodeLookup,{filter:s=>!!s.selected});return{width:Sd(t)?t:null,height:Sd(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 rbt({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const i=_s(),{width:r,height:s,transformString:a,userSelectionActive:l}=zi(ibt,As),c=nRe(),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(tRe({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(HN,m.key)&&(m.preventDefault(),c({direction:HN[m.key],factor:m.shiftKey?4:1}))};return o.jsx("div",{className:Fo(["react-flow__nodesselection","react-flow__container",t]),style:{transform:a},children:o.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 IJ=typeof window<"u"?window:void 0,sbt=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function rRe({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:i,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:a,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:N,defaultViewport:A,translateExtent:j,minZoom:T,maxZoom:R,preventScrolling:_,onSelectionContextMenu:D,noWheelClassName:M,noPanClassName:P,disableKeyboardA11y:L,onViewportChange:F,isControlledViewport:I}){const{nodesSelectionActive:z,userSelectionActive:K}=zi(sbt,As),B=hE(u,{target:IJ}),W=hE(b,{target:IJ}),H=W||E,X=W||O,ie=d&&H!==!0,Q=B||K||ie;return Fgt({deleteKeyCode:c,multiSelectionKeyCode:g}),o.jsx(Qgt,{onPaneContextMenu:s,elementsSelectable:y,zoomOnScroll:x,zoomOnPinch:w,panOnScroll:X,panOnScrollSpeed:S,panOnScrollMode:k,zoomOnDoubleClick:C,panOnDrag:!B&&H,defaultViewport:A,translateExtent:j,minZoom:T,maxZoom:R,zoomActivationKeyCode:v,preventScrolling:_,noWheelClassName:M,noPanClassName:P,onViewportChange:F,isControlledViewport:I,paneClickDistance:l,selectionOnDrag:ie,children:o.jsxs(qgt,{onSelectionStart:h,onSelectionEnd:m,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:i,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:a,panOnDrag:H,autoPanOnSelection:N,isSelecting:!!Q,selectionMode:f,selectionKeyPressed:B,paneClickDistance:l,selectionOnDrag:ie,children:[e,z&&o.jsx(rbt,{onSelectionContextMenu:D,noPanClassName:P,disableKeyboardA11y:L})]})})}rRe.displayName="FlowRenderer";const obt=p.memo(rRe),abt=e=>t=>e?hz(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 lbt(e){return zi(p.useCallback(abt(e),[e]),As)}const cbt=e=>e.updateNodeInternals;function ubt(){const e=zi(cbt),[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 dbt({node:e,nodeType:t,hasDimensions:n,resizeObserver:i}){const r=_s(),s=p.useRef(null),a=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||a.current!==s.current)&&(a.current&&(i==null||i.unobserve(a.current)),i==null||i.observe(s.current),a.current=s.current)},[d,e.hidden]),p.useEffect(()=>()=>{a.current&&(i==null||i.unobserve(a.current),a.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 fbt({id:e,onClick:t,onMouseEnter:n,onMouseMove:i,onMouseLeave:r,onContextMenu:s,onDoubleClick:a,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),ue=Q.parentLookup.has(e);return{node:Z,internals:Z.internals,isParent:ue}},As);let k=w.type||"default",C=(v==null?void 0:v[k])||RJ[k];C===void 0&&(x==null||x("003",Dd.error003(k)),k="default",C=(v==null?void 0:v.default)||RJ.default);const E=!!(w.draggable||l&&typeof w.draggable>"u"),N=!!(w.selectable||c&&typeof w.selectable>"u"),A=!!(w.connectable||u&&typeof w.connectable>"u"),j=!!(w.focusable||d&&typeof w.focusable>"u"),T=_s(),R=gz(w),_=dbt({node:w,nodeType:k,hasDimensions:R,resizeObserver:f}),D=tRe({nodeRef:_,disabled:w.hidden||!E,noDragClassName:h,handleSelector:w.dragHandle,nodeId:e,isSelectable:N,nodeClickDistance:y}),M=nRe();if(w.hidden)return null;const P=Ap(w),L=nbt(w),F=N||E||t||n||i||r,I=n?Q=>n(Q,{...O.userNode}):void 0,z=i?Q=>i(Q,{...O.userNode}):void 0,K=r?Q=>r(Q,{...O.userNode}):void 0,B=s?Q=>s(Q,{...O.userNode}):void 0,W=a?Q=>a(Q,{...O.userNode}):void 0,H=Q=>{const{selectNodesOnDrag:Z,nodeDragThreshold:ue}=T.getState();N&&(!Z||!E||ue>0)&&GF({id:e,store:T,nodeRef:_}),t&&t(Q,{...O.userNode})},X=Q=>{if(!(ANe(Q.nativeEvent)||g)){if(bNe.includes(Q.key)&&N){const Z=Q.key==="Escape";GF({id:e,store:T,unselect:Z,nodeRef:_})}else if(E&&w.selected&&Object.prototype.hasOwnProperty.call(HN,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})}),M({direction:HN[Q.key],factor:Q.shiftKey?4:1})}}},ie=()=>{var te;if(g||!((te=_.current)!=null&&te.matches(":focus-visible")))return;const{transform:Q,width:Z,height:ue,autoPanOnNodeFocus:Ee,setCenter:Y}=T.getState();if(!Ee)return;hz(new Map([[e,w]]),{x:0,y:0,width:Z,height:ue},Q,!0).length>0||Y(w.position.x+P.width/2,w.position.y+P.height/2,{zoom:Q[2]})};return o.jsx("div",{className:Fo(["react-flow__node",`react-flow__node-${k}`,{[m]:E},w.className,{selected:w.selected,selectable:N,parent:S,draggable:E,dragging:D}]),ref:_,style:{zIndex:O.z,transform:`translate(${O.positionAbsolute.x}px,${O.positionAbsolute.y}px)`,pointerEvents:F?"all":"none",visibility:R?"visible":"hidden",...w.style,...L},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:I,onMouseMove:z,onMouseLeave:K,onContextMenu:B,onClick:H,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:`${WNe}-${b}`,"aria-label":w.ariaLabel,...w.domAttributes,children:o.jsx(Kgt,{value:e,children:o.jsx(C,{id:e,data:w.data,type:k,positionAbsoluteX:O.positionAbsolute.x,positionAbsoluteY:O.positionAbsolute.y,selected:w.selected??!1,selectable:N,draggable:E,deletable:w.deletable??!0,isConnectable:A,sourcePosition:w.sourcePosition,targetPosition:w.targetPosition,dragging:D,dragHandle:w.dragHandle,zIndex:O.z,parentId:w.parentId,...P})})})}var hbt=p.memo(fbt);const pbt=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function sRe(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:i,elementsSelectable:r,onError:s}=zi(pbt,As),a=lbt(e.onlyRenderVisibleElements),l=ubt();return o.jsx("div",{className:"react-flow__nodes",style:QP,children:a.map(c=>o.jsx(hbt,{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))})}sRe.displayName="NodeRenderer";const mbt=p.memo(sRe);function gbt(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),a=n.nodeLookup.get(r.target);s&&a&&vmt({sourceNode:s,targetNode:a,width:n.width,height:n.height,transform:n.transform})&&i.push(r.id)}return i},[e]),As)}const bbt=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return o.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},ybt=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return o.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},PJ={[uE.Arrow]:bbt,[uE.ArrowClosed]:ybt};function vbt(e){const t=_s();return p.useMemo(()=>{var r,s;return Object.prototype.hasOwnProperty.call(PJ,e)?PJ[e]:((s=(r=t.getState()).onError)==null||s.call(r,"009",Dd.error009(e)),null)},[e])}const xbt=({id:e,type:t,color:n,width:i=12.5,height:r=12.5,markerUnits:s="strokeWidth",strokeWidth:a,orient:l="auto-start-reverse"})=>{const c=vbt(t);return c?o.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:o.jsx(c,{color:n,strokeWidth:a})}):null},oRe=({defaultColor:e,rfId:t})=>{const n=zi(s=>s.edges),i=zi(s=>s.defaultEdgeOptions),r=p.useMemo(()=>Tmt(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?o.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:o.jsx("defs",{children:r.map(s=>o.jsx(xbt,{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};oRe.displayName="MarkerDefinitions";var wbt=p.memo(oRe);function aRe({x:e,y:t,label:n,labelStyle:i,labelShowBg:r=!0,labelBgStyle:s,labelBgPadding:a=[2,4],labelBgBorderRadius:l=2,children:c,className:u,...d}){const[f,h]=p.useState({x:1,y:0,width:0,height:0}),m=Fo(["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?o.jsxs("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:m,visibility:f.width?"visible":"hidden",...d,children:[r&&o.jsx("rect",{width:f.width+2*a[0],x:-a[0],y:-a[1],height:f.height+2*a[1],className:"react-flow__edge-textbg",style:s,rx:l,ry:l}),o.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:g,style:i,children:n}),c]}):null}aRe.displayName="EdgeText";const Obt=p.memo(aRe);function VC({path:e,labelX:t,labelY:n,label:i,labelStyle:r,labelShowBg:s,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,interactionWidth:u=20,...d}){return o.jsxs(o.Fragment,{children:[o.jsx("path",{...d,d:e,fill:"none",className:Fo(["react-flow__edge-path",d.className])}),u?o.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}):null,i&&Sd(t)&&Sd(n)?o.jsx(Obt,{x:t,y:n,label:i,labelStyle:r,labelShowBg:s,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c}):null]})}function DJ({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 lRe({sourceX:e,sourceY:t,sourcePosition:n=pn.Bottom,targetX:i,targetY:r,targetPosition:s=pn.Top}){const[a,l]=DJ({pos:n,x1:e,y1:t,x2:i,y2:r}),[c,u]=DJ({pos:s,x1:i,y1:r,x2:e,y2:t}),[d,f,h,m]=jNe({sourceX:e,sourceY:t,targetX:i,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${e},${t} C${a},${l} ${c},${u} ${i},${r}`,d,f,h,m]}function cRe(e){return p.memo(({id:t,sourceX:n,sourceY:i,targetX:r,targetY:s,sourcePosition:a,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]=lRe({sourceX:n,sourceY:i,sourcePosition:a,targetX:r,targetY:s,targetPosition:l}),S=e.isInternal?void 0:t;return o.jsx(VC,{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 kbt=cRe({isInternal:!1}),uRe=cRe({isInternal:!0});kbt.displayName="SimpleBezierEdge";uRe.displayName="SimpleBezierEdgeInternal";function dRe(e){return p.memo(({id:t,sourceX:n,sourceY:i,targetX:r,targetY:s,label:a,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]=VN({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 o.jsx(VC,{id:k,path:w,labelX:O,labelY:S,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:b,markerStart:v,interactionWidth:x})})}const fRe=dRe({isInternal:!1}),hRe=dRe({isInternal:!0});fRe.displayName="SmoothStepEdge";hRe.displayName="SmoothStepEdgeInternal";function pRe(e){return p.memo(({id:t,...n})=>{var r;const i=e.isInternal?void 0:t;return o.jsx(fRe,{...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 Sbt=pRe({isInternal:!1}),mRe=pRe({isInternal:!0});Sbt.displayName="StepEdge";mRe.displayName="StepEdgeInternal";function gRe(e){return p.memo(({id:t,sourceX:n,sourceY:i,targetX:r,targetY:s,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:m,markerStart:g,interactionWidth:b})=>{const[v,y,x]=INe({sourceX:n,sourceY:i,targetX:r,targetY:s}),w=e.isInternal?void 0:t;return o.jsx(VC,{id:w,path:v,labelX:y,labelY:x,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:m,markerStart:g,interactionWidth:b})})}const Ebt=gRe({isInternal:!1}),bRe=gRe({isInternal:!0});Ebt.displayName="StraightEdge";bRe.displayName="StraightEdgeInternal";function yRe(e){return p.memo(({id:t,sourceX:n,sourceY:i,targetX:r,targetY:s,sourcePosition:a=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]=NNe({sourceX:n,sourceY:i,sourcePosition:a,targetX:r,targetY:s,targetPosition:l,curvature:y==null?void 0:y.curvature}),k=e.isInternal?void 0:t;return o.jsx(VC,{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 Cbt=yRe({isInternal:!1}),vRe=yRe({isInternal:!0});Cbt.displayName="BezierEdge";vRe.displayName="BezierEdgeInternal";const MJ={default:vRe,straight:bRe,step:mRe,smoothstep:hRe,simplebezier:uRe},LJ={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},Tbt=(e,t,n)=>n===pn.Left?e-t:n===pn.Right?e+t:e,Abt=(e,t,n)=>n===pn.Top?e-t:n===pn.Bottom?e+t:e,$J="react-flow__edgeupdater";function FJ({position:e,centerX:t,centerY:n,radius:i=10,onMouseDown:r,onMouseEnter:s,onMouseOut:a,type:l}){return o.jsx("circle",{onMouseDown:r,onMouseEnter:s,onMouseOut:a,className:Fo([$J,`${$J}-${l}`]),cx:Tbt(t,i,e),cy:Abt(n,i,e),r:i,stroke:"transparent",fill:"transparent"})}function _bt({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:i,sourceY:r,targetX:s,targetY:a,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:N,lib:A,onConnectStart:j,cancelConnection:T,nodeLookup:R,rfId:_,panBy:D,updateConnection:M}=g.getState(),P=S.type==="target",L=(z,K)=>{h(!1),f==null||f(z,n,S.type,K)},F=z=>u==null?void 0:u(n,z),I=(z,K)=>{h(!0),d==null||d(O,n,S.type),j==null||j(z,K)};KF.onPointerDown(O.nativeEvent,{autoPanOnConnect:k,connectionMode:E,connectionRadius:N,domNode:C,handleId:S.id,nodeId:S.nodeId,nodeLookup:R,isTarget:P,edgeUpdaterType:S.type,lib:A,flowId:_,cancelConnection:T,panBy:D,isValidConnection:(...z)=>{var K,B;return((B=(K=g.getState()).isValidConnection)==null?void 0:B.call(K,...z))??!0},onConnect:F,onConnectStart:I,onConnectEnd:(...z)=>{var K,B;return(B=(K=g.getState()).onConnectEnd)==null?void 0:B.call(K,...z)},onReconnectEnd:L,updateConnection:M,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 o.jsxs(o.Fragment,{children:[(e===!0||e==="source")&&o.jsx(FJ,{position:l,centerX:i,centerY:r,radius:t,onMouseDown:v,onMouseEnter:x,onMouseOut:w,type:"source"}),(e===!0||e==="target")&&o.jsx(FJ,{position:c,centerX:s,centerY:a,radius:t,onMouseDown:y,onMouseEnter:x,onMouseOut:w,type:"target"})]})}function jbt({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:i,onClick:r,onDoubleClick:s,onContextMenu:a,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])||MJ[S];k===void 0&&(y==null||y("011",Dd.error011(S)),S="default",k=(b==null?void 0:b.default)||MJ.default);const C=!!(w.focusable||t&&typeof w.focusable>"u"),E=typeof f<"u"&&(w.reconnectable||n&&typeof w.reconnectable>"u"),N=!!(w.selectable||i&&typeof w.selectable>"u"),A=p.useRef(null),[j,T]=p.useState(!1),[R,_]=p.useState(!1),D=_s(),{zIndex:M,sourceX:P,sourceY:L,targetX:F,targetY:I,sourcePosition:z,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,...LJ};const de=Cmt({id:e,sourceNode:G,targetNode:te,sourceHandle:w.sourceHandle||null,targetHandle:w.targetHandle||null,connectionMode:Y.connectionMode,onError:y});return{zIndex:ymt({selected:w.selected,zIndex:w.zIndex,sourceNode:G,targetNode:te,elevateOnSelect:Y.elevateEdgesOnSelect,zIndexMode:Y.zIndexMode}),...de||LJ}},[w.source,w.target,w.sourceHandle,w.targetHandle,w.selected,w.zIndex]),As),B=p.useMemo(()=>w.markerStart?`url('#${qF(w.markerStart,g)}')`:void 0,[w.markerStart,g]),W=p.useMemo(()=>w.markerEnd?`url('#${qF(w.markerEnd,g)}')`:void 0,[w.markerEnd,g]);if(w.hidden||P===null||L===null||F===null||I===null)return null;const H=Y=>{var Ce;const{addSelectedEdges:G,unselectNodesAndEdges:te,multiSelectionActive:de}=D.getState();N&&(D.setState({nodesSelectionActive:!1}),w.selected&&de?(te({nodes:[],edges:[w]}),(Ce=A.current)==null||Ce.blur()):G([e])),r&&r(Y,w)},X=s?Y=>{s(Y,{...w})}:void 0,ie=a?Y=>{a(Y,{...w})}:void 0,Q=l?Y=>{l(Y,{...w})}:void 0,Z=c?Y=>{c(Y,{...w})}:void 0,ue=u?Y=>{u(Y,{...w})}:void 0,Ee=Y=>{var G;if(!x&&bNe.includes(Y.key)&&N){const{unselectNodesAndEdges:te,addSelectedEdges:de}=D.getState();Y.key==="Escape"?((G=A.current)==null||G.blur(),te({edges:[w]})):de([e])}};return o.jsx("svg",{style:{zIndex:M},children:o.jsxs("g",{className:Fo(["react-flow__edge",`react-flow__edge-${S}`,w.className,v,{selected:w.selected,animated:w.animated,inactive:!N&&!r,updating:j,selectable:N}]),onClick:H,onDoubleClick:X,onContextMenu:ie,onMouseEnter:Q,onMouseMove:Z,onMouseLeave:ue,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?`${KNe}-${g}`:void 0,ref:A,...w.domAttributes,children:[!R&&o.jsx(k,{id:e,source:w.source,target:w.target,type:w.type,selected:w.selected,animated:w.animated,selectable:N,deletable:w.deletable??!0,label:w.label,labelStyle:w.labelStyle,labelShowBg:w.labelShowBg,labelBgStyle:w.labelBgStyle,labelBgPadding:w.labelBgPadding,labelBgBorderRadius:w.labelBgBorderRadius,sourceX:P,sourceY:L,targetX:F,targetY:I,sourcePosition:z,targetPosition:K,data:w.data,style:w.style,sourceHandleId:w.sourceHandle,targetHandleId:w.targetHandle,markerStart:B,markerEnd:W,pathOptions:"pathOptions"in w?w.pathOptions:void 0,interactionWidth:w.interactionWidth}),E&&o.jsx(_bt,{edge:w,isReconnectable:E,reconnectRadius:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:m,sourceX:P,sourceY:L,targetX:F,targetY:I,sourcePosition:z,targetPosition:K,setUpdateHover:T,setReconnecting:_})]})})}var Nbt=p.memo(jbt);const Rbt=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function xRe({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:i,noPanClassName:r,onReconnect:s,onEdgeContextMenu:a,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(Rbt,As),O=gbt(t);return o.jsxs("div",{className:"react-flow__edges",children:[o.jsx(wbt,{defaultColor:e,rfId:n}),O.map(S=>o.jsx(Nbt,{id:S,edgesFocusable:v,edgesReconnectable:y,elementsSelectable:x,noPanClassName:r,onReconnect:s,onContextMenu:a,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))]})}xRe.displayName="EdgeRenderer";const Ibt=p.memo(xRe),Pbt=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function Dbt({children:e}){const t=zi(Pbt);return o.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function Mbt(e){const t=UP(),n=p.useRef(!1);p.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const Lbt=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function $bt(e){const t=zi(Lbt),n=_s();return p.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function Fbt(e){return e.connection.inProgress?{...e.connection,to:Yw(e.connection.to,e.transform)}:{...e.connection}}function Bbt(e){return Fbt}function Ubt(e){const t=Bbt();return zi(t,As)}const Qbt=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function zbt({containerStyle:e,style:t,type:n,component:i}){const{nodesConnectable:r,width:s,height:a,isValid:l,inProgress:c}=zi(Qbt,As);return!(s&&r&&c)?null:o.jsx("svg",{style:e,width:s,height:a,className:"react-flow__connectionline react-flow__container",children:o.jsx("g",{className:Fo(["react-flow__connection",xNe(l)]),children:o.jsx(wRe,{style:t,type:n,CustomComponent:i,isValid:l})})})}const wRe=({style:e,type:t=bm.Bezier,CustomComponent:n,isValid:i})=>{const{inProgress:r,from:s,fromNode:a,fromHandle:l,fromPosition:c,to:u,toNode:d,toHandle:f,toPosition:h,pointer:m}=Ubt();if(!r)return;if(n)return o.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:a,fromHandle:l,fromX:s.x,fromY:s.y,toX:u.x,toY:u.y,fromPosition:c,toPosition:h,connectionStatus:xNe(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 bm.Bezier:[g]=NNe(b);break;case bm.SimpleBezier:[g]=lRe(b);break;case bm.Step:[g]=VN({...b,borderRadius:0});break;case bm.SmoothStep:[g]=VN(b);break;default:[g]=INe(b)}return o.jsx("path",{d:g,fill:"none",className:"react-flow__connection-path",style:e})};wRe.displayName="ConnectionLine";const Vbt={};function BJ(e=Vbt){p.useRef(e),_s(),p.useEffect(()=>{},[e])}function Hbt(){_s(),p.useRef(!1),p.useEffect(()=>{},[])}function ORe({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:i,onEdgeClick:r,onNodeDoubleClick:s,onEdgeDoubleClick:a,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:N,elementsSelectable:A,defaultViewport:j,translateExtent:T,minZoom:R,maxZoom:_,preventScrolling:D,defaultMarkerColor:M,zoomOnScroll:P,zoomOnPinch:L,panOnScroll:F,panOnScrollSpeed:I,panOnScrollMode:z,zoomOnDoubleClick:K,panOnDrag:B,autoPanOnSelection:W,onPaneClick:H,onPaneMouseEnter:X,onPaneMouseMove:ie,onPaneMouseLeave:Q,onPaneScroll:Z,onPaneContextMenu:ue,paneClickDistance:Ee,nodeClickDistance:Y,onEdgeContextMenu:G,onEdgeMouseEnter:te,onEdgeMouseMove:de,onEdgeMouseLeave:Ce,reconnectRadius:le,onReconnect:fe,onReconnectStart:re,onReconnectEnd:Oe,noDragClassName:Pe,noWheelClassName:be,noPanClassName:Qe,disableKeyboardA11y:ve,nodeExtent:Ne,rfId:ne,viewport:ye,onViewportChange:Te}){return BJ(e),BJ(t),Hbt(),Mbt(n),$bt(ye),o.jsx(obt,{onPaneClick:H,onPaneMouseEnter:X,onPaneMouseMove:ie,onPaneMouseLeave:Q,onPaneContextMenu:ue,onPaneScroll:Z,paneClickDistance:Ee,deleteKeyCode:E,selectionKeyCode:x,selectionOnDrag:w,selectionMode:O,onSelectionStart:h,onSelectionEnd:m,multiSelectionKeyCode:S,panActivationKeyCode:k,zoomActivationKeyCode:C,elementsSelectable:A,zoomOnScroll:P,zoomOnPinch:L,zoomOnDoubleClick:K,panOnScroll:F,panOnScrollSpeed:I,panOnScrollMode:z,panOnDrag:B,autoPanOnSelection:W,defaultViewport:j,translateExtent:T,minZoom:R,maxZoom:_,onSelectionContextMenu:f,preventScrolling:D,noDragClassName:Pe,noWheelClassName:be,noPanClassName:Qe,disableKeyboardA11y:ve,onViewportChange:Te,isControlledViewport:!!ye,children:o.jsxs(Dbt,{children:[o.jsx(Ibt,{edgeTypes:t,onEdgeClick:r,onEdgeDoubleClick:a,onReconnect:fe,onReconnectStart:re,onReconnectEnd:Oe,onlyRenderVisibleElements:N,onEdgeContextMenu:G,onEdgeMouseEnter:te,onEdgeMouseMove:de,onEdgeMouseLeave:Ce,reconnectRadius:le,defaultMarkerColor:M,noPanClassName:Qe,disableKeyboardA11y:ve,rfId:ne}),o.jsx(zbt,{style:b,type:g,component:v,containerStyle:y}),o.jsx("div",{className:"react-flow__edgelabel-renderer"}),o.jsx(mbt,{nodeTypes:e,onNodeClick:i,onNodeDoubleClick:s,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:d,nodeClickDistance:Y,onlyRenderVisibleElements:N,noPanClassName:Qe,noDragClassName:Pe,disableKeyboardA11y:ve,nodeExtent:Ne,rfId:ne}),o.jsx("div",{className:"react-flow__viewport-portal"})]})})}ORe.displayName="GraphView";const qbt=p.memo(ORe),Wbt=ENe(),UJ=({nodes:e,edges:t,defaultNodes:n,defaultEdges:i,width:r,height:s,fitView:a,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??lE;MNe(b,v,y);const{nodesInitialized:S}=WF(x,m,g,{nodeOrigin:w,nodeExtent:O,zIndexMode:h});let k=[0,0,1];if(a&&r&&s){const C=QC(m,{filter:j=>!!((j.width||j.initialWidth)&&(j.height||j.initialHeight))}),{x:E,y:N,zoom:A}=mz(C,r,s,c,u,(l==null?void 0:l.padding)??.1);k=[E,N,A]}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:lE,nodeExtent:O,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:iw.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:a??!1,fitViewOptions:l,fitViewResolver:null,connection:{...vNe},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:Wbt,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:yNe,zIndexMode:h,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},Kbt=({nodes:e,edges:t,defaultNodes:n,defaultEdges:i,width:r,height:s,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h})=>cgt((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 dmt({nodes:v,width:O,height:S,panZoom:y,minZoom:k,maxZoom:C},x),w==null||w.resolve(!0),m({fitViewResolver:null}))}return{...UJ({nodes:e,edges:t,width:r,height:s,fitView:a,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:N}=WF(v,y,x,{nodeOrigin:w,nodeExtent:f,elevateNodesOnSelect:O,checkEquality:!0,zIndexMode:k}),A=C&&N;S&&E?(b(),m({nodes:v,nodesInitialized:E,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:A})):m({nodes:v,nodesInitialized:E,nodesSelectionActive:A})},setEdges:v=>{const{connectionLookup:y,edgeLookup:x}=g();MNe(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:N}=g(),{changes:A,updatedInternals:j}=Pmt(v,x,w,O,S,k,N);j&&(jmt(x,w,{nodeOrigin:S,nodeExtent:k,zIndexMode:N}),E?(b(),m({fitViewQueued:!1,fitViewOptions:void 0})):m({}),(A==null?void 0:A.length)>0&&(C&&console.log("React Flow: trigger node changes",A),y==null||y(A)))},updateNodePositions:(v,y=!1)=>{const x=[];let w=[];const{nodeLookup:O,triggerNodeChanges:S,connection:k,updateConnection:C,onNodesChangeMiddlewareMap:E}=g();for(const[N,A]of v){const j=O.get(N),T=!!(j!=null&&j.expandParent&&(j!=null&&j.parentId)&&(A!=null&&A.position)),R={id:N,type:"position",position:T?{x:Math.max(0,A.position.x),y:Math.max(0,A.position.y)}:A.position,dragging:y};if(j&&k.inProgress&&k.fromNode.id===j.id){const _=Cy(j,k.fromHandle,pn.Left,!0);C({...k,from:_})}T&&j.parentId&&x.push({id:N,parentId:j.parentId,rect:{...A.internals.positionAbsolute,width:A.measured.width??0,height:A.measured.height??0}}),w.push(R)}if(x.length>0){const{parentLookup:N,nodeOrigin:A}=g(),j=Oz(x,O,N,A);w.push(...j)}for(const N of E.values())w=N(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=YNe(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=ZNe(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=>Ob(C,!0));O(k);return}O(Lv(w,new Set([...v]),!0)),S(Lv(x))},addSelectedEdges:v=>{const{multiSelectionActive:y,edgeLookup:x,nodeLookup:w,triggerNodeChanges:O,triggerEdgeChanges:S}=g();if(y){const k=v.map(C=>Ob(C,!0));S(k);return}S(Lv(x,new Set([...v]))),O(Lv(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,N=[];for(const j of C){if(!j.selected)continue;const T=O.get(j.id);T&&(T.selected=!1),N.push(Ob(j.id,!1))}const A=[];for(const j of E)j.selected&&A.push(Ob(j.id,!1));S(N),k(A)},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,Ob(E.id,!1)]:C,[]),k=v.reduce((C,E)=>E.selected?[...C,Ob(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]||(WF(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 Dmt({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:{...vNe}})},updateConnection:v=>{m({connection:v})},reset:()=>m({...UJ()})}},Object.is);function kRe({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:i,initialWidth:r,initialHeight:s,initialMinZoom:a,initialMaxZoom:l,initialFitViewOptions:c,fitView:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h,children:m}){const[g]=p.useState(()=>Kbt({nodes:e,edges:t,defaultNodes:n,defaultEdges:i,width:r,height:s,fitView:u,minZoom:a,maxZoom:l,fitViewOptions:c,nodeOrigin:d,nodeExtent:f,zIndexMode:h}));return o.jsx(ugt,{value:g,children:o.jsx(Dgt,{children:m})})}function Gbt({children:e,nodes:t,edges:n,defaultNodes:i,defaultEdges:r,width:s,height:a,fitView:l,fitViewOptions:c,minZoom:u,maxZoom:d,nodeOrigin:f,nodeExtent:h,zIndexMode:m}){return p.useContext(FP)?o.jsx(o.Fragment,{children:e}):o.jsx(kRe,{initialNodes:t,initialEdges:n,defaultNodes:i,defaultEdges:r,initialWidth:s,initialHeight:a,fitView:l,initialFitViewOptions:c,initialMinZoom:u,initialMaxZoom:d,nodeOrigin:f,nodeExtent:h,zIndexMode:m,children:e})}const Xbt={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function Ybt({nodes:e,edges:t,defaultNodes:n,defaultEdges:i,className:r,nodeTypes:s,edgeTypes:a,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:N,onNodesDelete:A,onEdgesDelete:j,onDelete:T,onSelectionChange:R,onSelectionDragStart:_,onSelectionDrag:D,onSelectionDragStop:M,onSelectionContextMenu:P,onSelectionStart:L,onSelectionEnd:F,onBeforeDelete:I,connectionMode:z,connectionLineType:K=bm.Bezier,connectionLineStyle:B,connectionLineComponent:W,connectionLineContainerStyle:H,deleteKeyCode:X="Backspace",selectionKeyCode:ie="Shift",selectionOnDrag:Q=!1,selectionMode:Z=cE.Full,panActivationKeyCode:ue="Space",multiSelectionKeyCode:Ee=fE()?"Meta":"Control",zoomActivationKeyCode:Y=fE()?"Meta":"Control",snapToGrid:G,snapGrid:te,onlyRenderVisibleElements:de=!1,selectNodesOnDrag:Ce,nodesDraggable:le,autoPanOnNodeFocus:fe,nodesConnectable:re,nodesFocusable:Oe,nodeOrigin:Pe=GNe,edgesFocusable:be,edgesReconnectable:Qe,elementsSelectable:ve=!0,defaultViewport:Ne=kgt,minZoom:ne=.5,maxZoom:ye=2,translateExtent:Te=lE,preventScrolling:Se=!0,nodeExtent:Ke,defaultMarkerColor:it="#b1b1b7",zoomOnScroll:he=!0,zoomOnPinch:xe=!0,panOnScroll:Ae=!1,panOnScrollSpeed:qe=.5,panOnScrollMode:Me=iy.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:Le,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:gr,nodeDragThreshold:ir,connectionDragThreshold:Ve,viewport:kt,onViewportChange:rn,width:Nn,height:se,colorMode:xi="light",debug:is,onScroll:$r,ariaLabelConfig:qn,zIndexMode:oi="basic",...Vi},Fr){const ia=gr||"1",Wa=Tgt(xi),Hr=p.useCallback(ko=>{ko.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),$r==null||$r(ko)},[$r]);return o.jsx("div",{"data-testid":"rf__wrapper",...Vi,onScroll:Hr,style:{...wr,...Xbt},ref:Fr,className:Fo(["react-flow",r,Wa]),id:gr,role:"application",children:o.jsxs(Gbt,{nodes:e,edges:t,width:Nn,height:se,fitView:dn,fitViewOptions:Rt,minZoom:ne,maxZoom:ye,nodeOrigin:Pe,nodeExtent:Ke,zIndexMode:oi,children:[o.jsx(Cgt,{nodes:e,edges:t,defaultNodes:n,defaultEdges:i,onConnect:m,onConnectStart:g,onConnectEnd:b,onClickConnectStart:v,onClickConnectEnd:y,nodesDraggable:le,autoPanOnNodeFocus:fe,nodesConnectable:re,nodesFocusable:Oe,edgesFocusable:be,edgesReconnectable:Qe,elementsSelectable:ve,elevateNodesOnSelect:mt,elevateEdgesOnSelect:_n,minZoom:ne,maxZoom:ye,nodeExtent:Ke,onNodesChange:cn,onEdgesChange:hn,snapToGrid:G,snapGrid:te,connectionMode:z,translateExtent:Te,connectOnClick:$e,defaultEdgeOptions:Ye,fitView:dn,fitViewOptions:Rt,onNodesDelete:A,onEdgesDelete:j,onDelete:T,onNodeDragStart:C,onNodeDrag:E,onNodeDragStop:N,onSelectionDrag:D,onSelectionDragStart:_,onSelectionDragStop:M,onMove:d,onMoveStart:f,onMoveEnd:h,noPanClassName:St,nodeOrigin:Pe,rfId:ia,autoPanOnConnect:Ai,autoPanOnNodeDrag:jn,autoPanSpeed:En,onError:di,connectionRadius:vi,isValidConnection:Fn,selectNodesOnDrag:Ce,nodeDragThreshold:ir,connectionDragThreshold:Ve,onBeforeDelete:I,debug:is,ariaLabelConfig:qn,zIndexMode:oi}),o.jsx(qbt,{onInit:u,onNodeClick:l,onEdgeClick:c,onNodeMouseEnter:x,onNodeMouseMove:w,onNodeMouseLeave:O,onNodeContextMenu:S,onNodeDoubleClick:k,nodeTypes:s,edgeTypes:a,connectionLineType:K,connectionLineStyle:B,connectionLineComponent:W,connectionLineContainerStyle:H,selectionKeyCode:ie,selectionOnDrag:Q,selectionMode:Z,deleteKeyCode:X,multiSelectionKeyCode:Ee,panActivationKeyCode:ue,zoomActivationKeyCode:Y,onlyRenderVisibleElements:de,defaultViewport:Ne,translateExtent:Te,minZoom:ne,maxZoom:ye,preventScrolling:Se,zoomOnScroll:he,zoomOnPinch:xe,zoomOnDoubleClick:At,panOnScroll:Ae,panOnScrollSpeed:qe,panOnScrollMode:Me,panOnDrag:It,autoPanOnSelection:Hn,onPaneClick:lt,onPaneMouseEnter:Ot,onPaneMouseMove:Ct,onPaneMouseLeave:dt,onPaneScroll:yt,onPaneContextMenu:Ie,paneClickDistance:vt,nodeClickDistance:jt,onSelectionContextMenu:P,onSelectionStart:L,onSelectionEnd:F,onReconnect:ln,onReconnectStart:He,onReconnectEnd:Le,onEdgeContextMenu:We,onEdgeDoubleClick:gt,onEdgeMouseEnter:st,onEdgeMouseMove:xt,onEdgeMouseLeave:ft,reconnectRadius:Ht,defaultMarkerColor:it,noDragClassName:Ge,noWheelClassName:bt,noPanClassName:St,rfId:ia,disableKeyboardA11y:Vt,nodeExtent:Ke,viewport:kt,onViewportChange:rn}),o.jsx(Ogt,{onSelectionChange:R}),Nt,o.jsx(bgt,{proOptions:vn,position:ot}),o.jsx(ggt,{rfId:ia,disableKeyboardA11y:Vt})]})})}var Zbt=JNe(Ybt);const Jbt=e=>{var t;return(t=e.domNode)==null?void 0:t.querySelector(".react-flow__edgelabel-renderer")};function eyt({children:e}){const t=zi(Jbt);return t?Jn.createPortal(e,t):null}function tyt(e){const[t,n]=p.useState(e),i=p.useCallback(r=>n(s=>YNe(r,s)),[]);return[t,n,i]}function nyt(e){const[t,n]=p.useState(e),i=p.useCallback(r=>n(s=>ZNe(r,s)),[]);return[t,n,i]}const iyt=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||!gz(n.userNode))return!1;return!0};function ryt(e={includeHiddenNodes:!1}){return zi(iyt(e))}function syt({dimensions:e,lineWidth:t,variant:n,className:i}){return o.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Fo(["react-flow__background-pattern",n,i])})}function oyt({radius:e,className:t}){return o.jsx("circle",{cx:e,cy:e,r:e,className:Fo(["react-flow__background-pattern","dots",t])})}var Hm;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Hm||(Hm={}));const ayt={[Hm.Dots]:1,[Hm.Lines]:1,[Hm.Cross]:6},lyt=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function SRe({id:e,variant:t=Hm.Dots,gap:n=20,size:i,lineWidth:r=1,offset:s=0,color:a,bgColor:l,style:c,className:u,patternClassName:d}){const f=p.useRef(null),{transform:h,patternId:m}=zi(lyt,As),g=i||ayt[t],b=t===Hm.Dots,v=t===Hm.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 o.jsxs("svg",{className:Fo(["react-flow__background",u]),style:{...c,...QP,"--xy-background-color-props":l,"--xy-background-pattern-color-props":a},ref:f,"data-testid":"rf__background",children:[o.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?o.jsx(oyt,{radius:w/2,className:d}):o.jsx(syt,{dimensions:S,lineWidth:r,variant:t,className:d})}),o.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${C})`})]})}SRe.displayName="Background";const cyt=p.memo(SRe);function uyt(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:o.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function dyt(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:o.jsx("path",{d:"M0 0h32v4.2H0z"})})}function fyt(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:o.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 hyt(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:o.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 pyt(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:o.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 J2({children:e,className:t,...n}){return o.jsx("button",{type:"button",className:Fo(["react-flow__controls-button",t]),...n,children:e})}const myt=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function ERe({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:i=!0,fitViewOptions:r,onZoomIn:s,onZoomOut:a,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(myt,As),{zoomIn:w,zoomOut:O,fitView:S}=UP(),k=()=>{w(),s==null||s()},C=()=>{O(),a==null||a()},E=()=>{S(r),l==null||l()},N=()=>{g.setState({nodesDraggable:!b,nodesConnectable:!b,elementsSelectable:!b}),c==null||c(!b)},A=h==="horizontal"?"horizontal":"vertical";return o.jsxs(BP,{className:Fo(["react-flow__controls",A,u]),position:f,style:e,"data-testid":"rf__controls","aria-label":m??x["controls.ariaLabel"],children:[t&&o.jsxs(o.Fragment,{children:[o.jsx(J2,{onClick:k,className:"react-flow__controls-zoomin",title:x["controls.zoomIn.ariaLabel"],"aria-label":x["controls.zoomIn.ariaLabel"],disabled:y,children:o.jsx(uyt,{})}),o.jsx(J2,{onClick:C,className:"react-flow__controls-zoomout",title:x["controls.zoomOut.ariaLabel"],"aria-label":x["controls.zoomOut.ariaLabel"],disabled:v,children:o.jsx(dyt,{})})]}),n&&o.jsx(J2,{className:"react-flow__controls-fitview",onClick:E,title:x["controls.fitView.ariaLabel"],"aria-label":x["controls.fitView.ariaLabel"],children:o.jsx(fyt,{})}),i&&o.jsx(J2,{className:"react-flow__controls-interactive",onClick:N,title:x["controls.interactive.ariaLabel"],"aria-label":x["controls.interactive.ariaLabel"],children:b?o.jsx(pyt,{}):o.jsx(hyt,{})}),d]})}ERe.displayName="Controls";const gyt=p.memo(ERe);function byt({id:e,x:t,y:n,width:i,height:r,style:s,color:a,strokeColor:l,strokeWidth:c,className:u,borderRadius:d,shapeRendering:f,selected:h,onClick:m}){const{background:g,backgroundColor:b}=s||{},v=a||g||b;return o.jsx("rect",{className:Fo(["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 yyt=p.memo(byt),vyt=e=>e.nodes.map(t=>t.id),TL=e=>e instanceof Function?e:()=>e;function xyt({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:i=5,nodeStrokeWidth:r,nodeComponent:s=yyt,onClick:a}){const l=zi(vyt,As),c=TL(t),u=TL(e),d=TL(n),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return o.jsx(o.Fragment,{children:l.map(h=>o.jsx(Oyt,{id:h,nodeColorFunc:c,nodeStrokeColorFunc:u,nodeClassNameFunc:d,nodeBorderRadius:i,nodeStrokeWidth:r,NodeComponent:s,onClick:a,shapeRendering:f},h))})}function wyt({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:i,nodeBorderRadius:r,nodeStrokeWidth:s,shapeRendering:a,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}=Ap(v);return{node:v,x:y,y:x,width:w,height:O}},As);return!u||u.hidden||!gz(u)?null:o.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:a,onClick:c,id:u.id})}const Oyt=p.memo(wyt);var kyt=p.memo(xyt);const Syt=200,Eyt=150,Cyt=e=>!e.hidden,Tyt=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?SNe(QC(e.nodeLookup,{filter:Cyt}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},Ayt="react-flow__minimap-desc";function CRe({style:e,className:t,nodeStrokeColor:n,nodeColor:i,nodeClassName:r="",nodeBorderRadius:s=5,nodeStrokeWidth:a,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:N,panZoom:A,translateExtent:j,flowWidth:T,flowHeight:R,ariaLabelConfig:_}=zi(Tyt,As),D=(e==null?void 0:e.width)??Syt,M=(e==null?void 0:e.height)??Eyt,P=C.width/D,L=C.height/M,F=Math.max(P,L),I=F*D,z=F*M,K=O*F,B=C.x-(I-C.width)/2-K,W=C.y-(z-C.height)/2-K,H=I+K*2,X=z+K*2,ie=`${Ayt}-${N}`,Q=p.useRef(0),Z=p.useRef();Q.current=F,p.useEffect(()=>{if(k.current&&A)return Z.current=Vmt({domNode:k.current,panZoom:A,getTransform:()=>S.getState().transform,getViewScale:()=>Q.current}),()=>{var G;(G=Z.current)==null||G.destroy()}},[A]),p.useEffect(()=>{var G;(G=Z.current)==null||G.update({translateExtent:j,width:T,height:R,inversePan:x,pannable:b,zoomStep:w,zoomable:v})},[b,v,x,w,j,T,R]);const ue=m?G=>{var Ce;const[te,de]=((Ce=Z.current)==null?void 0:Ce.pointer(G))||[0,0];m(G,{x:te,y:de})}:void 0,Ee=g?p.useCallback((G,te)=>{const de=S.getState().nodeLookup.get(te).internals.userNode;g(G,de)},[]):void 0,Y=y??_["minimap.ariaLabel"];return o.jsx(BP,{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*F: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 a=="number"?a:void 0},className:Fo(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:o.jsxs("svg",{width:D,height:M,viewBox:`${B} ${W} ${H} ${X}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":ie,ref:k,onClick:ue,children:[Y&&o.jsx("title",{id:ie,children:Y}),o.jsx(kyt,{onClick:Ee,nodeColor:i,nodeStrokeColor:n,nodeBorderRadius:s,nodeClassName:r,nodeStrokeWidth:a,nodeComponent:l}),o.jsx("path",{className:"react-flow__minimap-mask",d:`M${B-K},${W-K}h${H+K*2}v${X+K*2}h${-H-K*2}z M${E.x},${E.y}h${E.width}v${E.height}h${-E.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}CRe.displayName="MiniMap";p.memo(CRe);const _yt=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,jyt={[aw.Line]:"right",[aw.Handle]:"bottom-right"};function Nyt({nodeId:e,position:t,variant:n=aw.Handle,className:i,style:r=void 0,children:s,color:a,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=iRe(),w=typeof e=="string"?e:x,O=_s(),S=p.useRef(null),k=n===aw.Handle,C=zi(p.useCallback(_yt(k&&m),[k,m]),As),E=p.useRef(null),N=t??jyt[n];p.useEffect(()=>{if(!(!S.current||!w))return E.current||(E.current=igt({domNode:S.current,nodeId:w,getStoreItems:()=>{const{nodeLookup:j,transform:T,snapGrid:R,snapToGrid:_,nodeOrigin:D,domNode:M}=O.getState();return{nodeLookup:j,transform:T,snapGrid:R,snapToGrid:_,nodeOrigin:D,paneDomNode:M}},onChange:(j,T)=>{const{triggerNodeChanges:R,nodeLookup:_,parentLookup:D,nodeOrigin:M}=O.getState(),P=[],L={x:j.x,y:j.y},F=_.get(w);if(F&&F.expandParent&&F.parentId){const I=F.origin??M,z=j.width??F.measured.width??0,K=j.height??F.measured.height??0,B={id:F.id,parentId:F.parentId,rect:{width:z,height:K,...CNe({x:j.x??F.position.x,y:j.y??F.position.y},{width:z,height:K},F.parentId,_,I)}},W=Oz([B],_,D,M);P.push(...W),L.x=j.x?Math.max(I[0]*z,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}};P.push(I)}if(j.width!==void 0&&j.height!==void 0){const z={id:w,type:"dimensions",resizing:!0,setAttributes:h?h==="horizontal"?"width":"height":!0,dimensions:{width:j.width,height:j.height}};P.push(z)}for(const I of T){const z={...I,type:"position"};P.push(z)}R(P)},onEnd:({width:j,height:T})=>{const R={id:w,type:"dimensions",resizing:!1,dimensions:{width:j,height:T}};O.getState().triggerNodeChanges([R])}})),E.current.update({controlPosition:N,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()}},[N,l,c,u,d,f,b,v,y,g]);const A=N.split("-");return o.jsx("div",{className:Fo(["react-flow__resize-control","nodrag",...A,n,i]),ref:S,style:{...r,scale:C,...a&&{[k?"backgroundColor":"borderColor"]:a}},children:s})}p.memo(Nyt);var TRe=Object.defineProperty,Ryt=(e,t,n)=>t in e?TRe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Iyt=(e,t)=>{for(var n in t)TRe(e,n,{get:t[n],enumerable:!0})},Pyt=(e,t,n)=>Ryt(e,t+"",n),ARe={};Iyt(ARe,{Graph:()=>td,alg:()=>Sz,json:()=>jRe,version:()=>Lyt});var Dyt=Object.defineProperty,_Re=(e,t)=>{for(var n in t)Dyt(e,n,{get:t[n],enumerable:!0})},td=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,a])=>{t(s)&&n.setNode(s,a)}),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 a=this.parent(s);return!a||n.hasNode(a)?(i[s]=a??void 0,a??void 0):a in i?i[a]:r(a)};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,a,l,c,u=!1;typeof t=="object"&&t!==null&&"v"in t?(s=t.v,a=t.w,l=t.name,arguments.length===2&&(c=n,u=!0)):(s=t,a=n,l=r,arguments.length>2&&(c=i,u=!0)),s=""+s,a=""+a,l!==void 0&&(l=""+l);let d=tk(this._isDirected,s,a,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(a),this._edgeLabels[d]=u?c:this._defaultEdgeLabelFn(s,a,l);let f=Myt(this._isDirected,s,a,l);return s=f.v,a=f.w,Object.freeze(f),this._edgeObjs[d]=f,QJ(this._preds[a],s),QJ(this._sucs[s],a),this._in[a][d]=f,this._out[s][d]=f,this._edgeCount++,this}edge(t,n,i){let r=arguments.length===1?AL(this._isDirected,t):tk(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?AL(this._isDirected,t):tk(this._isDirected,t,n,i))in this._edgeLabels}removeEdge(t,n,i){let r=arguments.length===1?AL(this._isDirected,t):tk(this._isDirected,t,n,i),s=this._edgeObjs[r];if(s){let a=s.v,l=s.w;delete this._edgeLabels[r],delete this._edgeObjs[r],zJ(this._preds[l],a),zJ(this._sucs[a],l),delete this._in[l][r],delete this._out[a][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 QJ(e,t){e[t]?e[t]++:e[t]=1}function zJ(e,t){e[t]!==void 0&&!--e[t]&&delete e[t]}function tk(e,t,n,i){let r=""+t,s=""+n;if(!e&&r>s){let a=r;r=s,s=a}return r+""+s+""+(i===void 0?"\0":i)}function Myt(e,t,n,i){let r=""+t,s=""+n;if(!e&&r>s){let l=r;r=s,s=l}let a={v:r,w:s};return i&&(a.name=i),a}function AL(e,t){return tk(e,t.v,t.w,t.name)}var Lyt="4.0.1",jRe={};_Re(jRe,{read:()=>Uyt,write:()=>$yt});function $yt(e){let t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:Fyt(e),edges:Byt(e)},n=e.graph();return n!==void 0&&(t.value=structuredClone(n)),t}function Fyt(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 Byt(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 Uyt(e){let t=new td(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 Sz={};_Re(Sz,{CycleException:()=>WN,bellmanFord:()=>NRe,components:()=>Vyt,dijkstra:()=>qN,dijkstraAll:()=>Wyt,findCycles:()=>Kyt,floydWarshall:()=>Xyt,isAcyclic:()=>Zyt,postorder:()=>e0t,preorder:()=>t0t,prim:()=>n0t,shortestPaths:()=>i0t,tarjan:()=>IRe,topsort:()=>PRe});var Qyt=()=>1;function NRe(e,t,n,i){return zyt(e,String(t),n||Qyt,i||function(r){return e.outEdges(r)})}function zyt(e,t,n,i){let r={},s,a=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 qN(e,t,n,i){let r=function(s){return e.outEdges(s)};return qyt(e,String(t),n||Hyt,i||r)}function qyt(e,t,n,i){let r={},s=new RRe,a,l,c=function(u){let d=u.v!==a?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&&(a=s.removeMin(),l=r[a],l.distance!==Number.POSITIVE_INFINITY);)i(a).forEach(c);return r}function Wyt(e,t,n){return e.nodes().reduce(function(i,r){return i[r]=qN(e,r,t,n),i},{})}function IRe(e){let t=0,n=[],i={},r=[];function s(a){let l=i[a]={onStack:!0,lowlink:t,index:t++};if(n.push(a),e.successors(a).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(a!==u);r.push(c)}}return e.nodes().forEach(function(a){a in i||s(a)}),r}function Kyt(e){return IRe(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})}var Gyt=()=>1;function Xyt(e,t,n){return Yyt(e,t||Gyt,n||function(i){return e.outEdges(i)})}function Yyt(e,t,n){let i={},r=e.nodes();return r.forEach(function(s){i[s]={},i[s][s]={distance:0,predecessor:""},r.forEach(function(a){s!==a&&(i[s][a]={distance:Number.POSITIVE_INFINITY,predecessor:""})}),n(s).forEach(function(a){let l=a.v===s?a.w:a.v,c=t(a);i[s][l]={distance:c,predecessor:s}})}),r.forEach(function(s){let a=i[s];r.forEach(function(l){let c=i[l];r.forEach(function(u){let d=c[s],f=a[u],h=c[u],m=d.distance+f.distance;m{var c;return(c=e.isDirected()?e.successors(l):e.neighbors(l))!=null?c:[]},a={};return t.forEach(function(l){if(!e.hasNode(l))throw new Error("Graph does not have node: "+l);r=DRe(e,l,n==="post",a,s,i,r)}),r}function DRe(e,t,n,i,r,s,a){return t in i||(i[t]=!0,n||(a=s(a,t)),r(t).forEach(function(l){a=DRe(e,l,n,i,r,s,a)}),n&&(a=s(a,t))),a}function MRe(e,t,n){return Jyt(e,t,n,function(i,r){return i.push(r),i},[])}function e0t(e,t){return MRe(e,t,"post")}function t0t(e,t){return MRe(e,t,"pre")}function n0t(e,t){let n=new td,i={},r=new RRe,s;function a(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(a)}return n}function i0t(e,t,n,i){return r0t(e,t,n,i??(r=>{let s=e.outEdges(r);return s??[]}))}function r0t(e,t,n,i){if(n===void 0)return qN(e,t,n,i);let r=!1,s=e.nodes();for(let a=0;at.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 LRe(e){let t=new td({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,a=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)*a>Math.abs(r)*l?(s<0&&(l=-l),c=l*r/s,u=l):(r<0&&(a=-a),c=a,u=a*s/r),{x:n+c,y:i+u}}function HC(e){let t=pE(FRe(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 o0t(e){let t=e.nodes().map(i=>{let r=e.node(i).rank;return r===void 0?Number.MAX_VALUE:r}),n=kf(Math.min,t);e.nodes().forEach(i=>{let r=e.node(i);Object.hasOwn(r,"rank")&&(r.rank-=n)})}function a0t(e){let t=e.nodes().map(a=>e.node(a).rank).filter(a=>a!==void 0),n=kf(Math.min,t),i=[];e.nodes().forEach(a=>{let l=e.node(a).rank-n;i[l]||(i[l]=[]),i[l].push(a)});let r=0,s=e.graph().nodeRankFactor;Array.from(i).forEach((a,l)=>{a===void 0&&l%s!==0?--r:a!==void 0&&r&&a.forEach(c=>e.node(c).rank+=r)})}function HJ(e,t,n,i){let r={width:0,height:0};return arguments.length>=4&&(r.rank=n,r.order=i),Zw(e,"border",r,t)}function l0t(e,t=$Re){let n=[];for(let i=0;i$Re){let n=l0t(t);return e(...n.map(i=>e(...i)))}else return e(...t)}function FRe(e){let t=e.nodes().map(n=>{let i=e.node(n).rank;return i===void 0?Number.MIN_VALUE:i});return kf(Math.max,t)}function c0t(e,t){let n={lhs:[],rhs:[]};return e.forEach(i=>{t(i)?n.lhs.push(i):n.rhs.push(i)}),n}function BRe(e,t){let n=Date.now();try{return t()}finally{console.log(e+" time: "+(Date.now()-n)+"ms")}}function URe(e,t){return t()}var u0t=0;function Ez(e){let t=++u0t;return e+(""+t)}function pE(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 d0t(e,t){return e.reduce((n,i,r)=>(n[i]=t[r],n),{})}var VP="\0",f0t="3.0.0",h0t=class{constructor(){Pyt(this,"_sentinel");let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return qJ(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&qJ(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,p0t)),n=n._prev;return"["+e.join(", ")+"]"}};function qJ(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function p0t(e,t){if(e!=="_next"&&e!=="_prev")return t}var m0t=h0t,g0t=()=>1;function b0t(e,t){if(e.nodeCount()<=1)return[];let n=v0t(e,t||g0t);return y0t(n.graph,n.buckets,n.zeroIdx).flatMap(i=>e.outEdges(i.v,i.w)||[])}function y0t(e,t,n){var i;let r=[],s=t[t.length-1],a=t[0],l;for(;e.nodeCount();){for(;l=a.dequeue();)_L(e,t,n,l);for(;l=s.dequeue();)_L(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(_L(e,t,n,l,!0)||[]);break}}}return r}function _L(e,t,n,i,r){let s=[],a=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,XF(t,n,u)}),(e.outEdges(i.v)||[]).forEach(l=>{let c=e.edge(l),u=l.w,d=e.node(u);d.in-=c,XF(t,n,d)}),e.removeNode(i.v),a}function v0t(e,t){let n=new td,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=x0t(r+i+3).map(()=>new m0t),a=i+1;return n.nodes().forEach(l=>{XF(s,a,n.node(l))}),{graph:n,buckets:s,zeroIdx:a}}function XF(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 x0t(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,Ez("rev"))});function t(n){return i=>n.edge(i).weight}}function O0t(e){let t=[],n={},i={};function r(s){Object.hasOwn(i,s)||(i[s]=!0,n[s]=!0,e.outEdges(s).forEach(a=>{Object.hasOwn(n,a.w)?t.push(a):r(a.w)}),delete n[s])}return e.nodes().forEach(r),t}function k0t(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 S0t(e){e.graph().dummyChains=[],e.edges().forEach(t=>E0t(e,t))}function E0t(e,t){let n=t.v,i=e.node(n).rank,r=t.w,s=e.node(r).rank,a=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),a=s?s.map(c=>c==null?Number.POSITIVE_INFINITY:n(c.w)-e.edge(c).minlen):[],l=kf(Math.min,a);return l===Number.POSITIVE_INFINITY&&(l=0),r.rank=l}e.sources().forEach(n)}function lw(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var QRe=T0t;function T0t(e){let t=new td({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,a;for(;A0t(t,e){let a=s.v,l=i===a?s.w:a;!e.hasNode(l)&&!lw(t,s)&&(e.setNode(l,{}),e.setEdge(i,l,{}),n(l))})}return e.nodes().forEach(n),e.nodeCount()}function _0t(e,t){return t.edges().reduce((n,i)=>{let r=Number.POSITIVE_INFINITY;return e.hasNode(i.v)!==e.hasNode(i.w)&&(r=lw(t,i)),rt.node(i).rank+=n)}var{preorder:N0t,postorder:R0t}=Sz,I0t=Yy;Yy.initLowLimValues=Az;Yy.initCutValues=Tz;Yy.calcCutValue=zRe;Yy.leaveEdge=HRe;Yy.enterEdge=qRe;Yy.exchangeEdges=WRe;function Yy(e){e=s0t(e),Cz(e);let t=QRe(e);Az(t),Tz(t,e);let n,i;for(;n=HRe(t);)i=qRe(t,e,n),WRe(t,e,n,i)}function Tz(e,t){let n=R0t(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(i=>P0t(e,t,i))}function P0t(e,t,n){let i=e.node(n).parent,r=e.edge(n,i);r.cutvalue=zRe(e,t,n)}function zRe(e,t,n){let i=e.node(n).parent,r=!0,s=t.edge(n,i),a=0;s||(r=!1,s=t.edge(i,n)),a=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(a+=f?h:-h,M0t(e,n,d)){let m=e.edge(n,d).cutvalue;a+=f?-m:m}}}),a}function Az(e,t){arguments.length<2&&(t=e.nodes()[0]),VRe(e,{},1,t)}function VRe(e,t,n,i,r){let s=n,a=e.node(i);t[i]=!0;let l=e.neighbors(i);return l&&l.forEach(c=>{Object.hasOwn(t,c)||(n=VRe(e,t,n,c,i))}),a.low=s,a.lim=n++,r?a.parent=r:delete a.parent,n}function HRe(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function qRe(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),a=e.node(r),l=s,c=!1;return s.lim>a.lim&&(l=a,c=!0),t.edges().filter(u=>c===WJ(e,e.node(u.v),l)&&c!==WJ(e,e.node(u.w),l)).reduce((u,d)=>lw(t,d)!e.node(r).parent);if(!n)return;let i=N0t(e,[n]);i=i.slice(1),i.forEach(r=>{let s=e.node(r).parent,a=t.edge(r,s),l=!1;a||(a=t.edge(s,r),l=!0),t.node(r).rank=t.node(s).rank+(l?a.minlen:-a.minlen)})}function M0t(e,t,n){return e.hasEdge(t,n)}function WJ(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}var L0t=$0t;function $0t(e){let t=e.graph().ranker;if(typeof t=="function")return t(e);switch(t){case"network-simplex":KJ(e);break;case"tight-tree":B0t(e);break;case"longest-path":F0t(e);break;case"none":break;default:KJ(e)}}var F0t=Cz;function B0t(e){Cz(e),QRe(e)}function KJ(e){I0t(e)}var U0t=Q0t;function Q0t(e){let t=V0t(e);e.graph().dummyChains.forEach(n=>{let i=e.node(n),r=i.edgeObj,s=z0t(e,t,r.v,r.w),a=s.path,l=s.lca,c=0,u=a[c],d=!0;for(;n!==r.w;){if(i=e.node(n),d){for(;(u=a[c])!==l&&e.node(u).maxRanka||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 V0t(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(VP).forEach(i),t}function H0t(e){let t=Zw(e,"root",{},"_root"),n=q0t(e),i=Object.values(n),r=kf(Math.max,i)-1,s=2*r+1;e.graph().nestingRoot=t,e.edges().forEach(l=>e.edge(l).minlen*=s);let a=W0t(e)+1;e.children(VP).forEach(l=>KRe(e,t,s,a,r,n,l)),e.graph().nodeRankFactor=s}function KRe(e,t,n,i,r,s,a){var l;let c=e.children(a);if(!c.length){a!==t&&e.setEdge(t,a,{weight:0,minlen:n});return}let u=HJ(e,"_bt"),d=HJ(e,"_bb"),f=e.node(a);e.setParent(u,a),f.borderTop=u,e.setParent(d,a),f.borderBottom=d,c.forEach(h=>{var m;KRe(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[a])!=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(a)||e.setEdge(t,u,{weight:0,minlen:r+((l=s[a])!=null?l:0)})}function q0t(e){let t={};function n(i,r){let s=e.children(i);s&&s.length&&s.forEach(a=>n(a,r+1)),t[i]=r}return e.children(VP).forEach(i=>n(i,1)),t}function W0t(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function K0t(e){let t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(n=>{e.edge(n).nestingEdge&&e.removeEdge(n)})}var G0t=X0t;function X0t(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,a=r.maxRank+1;sXJ(e.node(t))),e.edges().forEach(t=>XJ(e.edge(t)))}function XJ(e){let t=e.width;e.width=e.height,e.height=t}function J0t(e){e.nodes().forEach(t=>jL(e.node(t))),e.edges().forEach(t=>{var n;let i=e.edge(t);(n=i.points)==null||n.forEach(jL),Object.hasOwn(i,"y")&&jL(i)})}function jL(e){e.y=-e.y}function evt(e){e.nodes().forEach(t=>NL(e.node(t))),e.edges().forEach(t=>{var n;let i=e.edge(t);(n=i.points)==null||n.forEach(NL),Object.hasOwn(i,"x")&&NL(i)})}function NL(e){let t=e.x;e.x=e.y,e.y=t}function tvt(e){let t={},n=e.nodes().filter(l=>!e.children(l).length),i=n.map(l=>e.node(l).rank),r=kf(Math.max,i),s=pE(r+1).map(()=>[]);function a(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(a)}return n.sort((l,c)=>e.node(l).rank-e.node(c).rank).forEach(a),s}function nvt(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 rvt(e,t=[]){return t.map(n=>{let i=e.inEdges(n);if(!i||!i.length)return{v:n};{let r=i.reduce((s,a)=>{let l=e.edge(a),c=e.node(a.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 svt(e,t){let n={};e.forEach((r,s)=>{let a={indegree:0,in:[],out:[],vs:[r.v],i:s};r.barycenter!==void 0&&(a.barycenter=r.barycenter,a.weight=r.weight),n[r.v]=a}),t.edges().forEach(r=>{let s=n[r.v],a=n[r.w];s!==void 0&&a!==void 0&&(a.indegree++,s.out.push(a))});let i=Object.values(n).filter(r=>!r.indegree);return ovt(i)}function ovt(e){let t=[];function n(r){return s=>{s.merged||(s.barycenter===void 0||r.barycenter===void 0||s.barycenter>=r.barycenter)&&avt(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=>KN(r,["vs","i","barycenter","weight"]))}function avt(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 lvt(e,t){let n=c0t(e,d=>Object.hasOwn(d,"barycenter")),i=n.lhs,r=n.rhs.sort((d,f)=>f.i-d.i),s=[],a=0,l=0,c=0;i.sort(cvt(!!t)),c=YJ(s,r,c),i.forEach(d=>{c+=d.vs.length,s.push(d.vs),a+=d.barycenter*d.weight,l+=d.weight,c=YJ(s,r,c)});let u={vs:s.flat(1)};return l&&(u.barycenter=a/l,u.weight=l),u}function YJ(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 cvt(e){return(t,n)=>t.barycentern.barycenter?1:e?n.i-t.i:t.i-n.i}function XRe(e,t,n,i){let r=e.children(t),s=e.node(t),a=s?s.borderLeft:void 0,l=s?s.borderRight:void 0,c={};a&&(r=r.filter(h=>h!==a&&h!==l));let u=rvt(e,r);u.forEach(h=>{if(e.children(h.v).length){let m=XRe(e,h.v,n,i);c[h.v]=m,Object.hasOwn(m,"barycenter")&&dvt(h,m)}});let d=svt(u,n);uvt(d,c);let f=lvt(d,i);if(a&&l){f.vs=[a,f.vs,l].flat(1);let h=e.predecessors(a);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 uvt(e,t){e.forEach(n=>{n.vs=n.vs.flatMap(i=>t[i]?t[i].vs:i)})}function dvt(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 fvt(e,t,n,i){i||(i=e.nodes());let r=hvt(e),s=new td({compound:!0}).setGraph({root:r}).setDefaultNodeLabel(a=>e.node(a));return i.forEach(a=>{let l=e.node(a),c=e.parent(a);if(l.rank===t||l.minRank<=t&&t<=l.maxRank){s.setNode(a),s.setParent(a,c||r);let u=e[n](a);u&&u.forEach(d=>{let f=d.v===a?d.w:d.v,h=s.edge(f,a),m=h!==void 0?h.weight:0;s.setEdge(f,a,{weight:e.edge(d).weight+m})}),Object.hasOwn(l,"minRank")&&s.setNode(a,{borderLeft:l.borderLeft[t],borderRight:l.borderRight[t]})}}),s}function hvt(e){let t;for(;e.hasNode(t=Ez("_root")););return t}function pvt(e,t,n){let i={},r;n.forEach(s=>{let a=e.parent(s),l,c;for(;a;){if(l=e.parent(a),l?(c=i[l],i[l]=a):(c=r,r=a),c&&c!==a){t.setEdge(c,a);return}a=l}})}function YRe(e,t={}){if(typeof t.customOrder=="function"){t.customOrder(e,YRe);return}let n=FRe(e),i=ZJ(e,pE(1,n+1),"inEdges"),r=ZJ(e,pE(n-1,-1,-1),"outEdges"),s=tvt(e);if(JJ(e,s),t.disableOptimalOrderHeuristic)return;let a=Number.POSITIVE_INFINITY,l,c=t.constraints||[];for(let u=0,d=0;d<4;++u,++d){mvt(u%2?i:r,u%4>=2,c),s=HC(e);let f=nvt(e,s);f{i.has(s)||i.set(s,[]),i.get(s).push(a)};for(let s of e.nodes()){let a=e.node(s);if(typeof a.rank=="number"&&r(a.rank,s),typeof a.minRank=="number"&&typeof a.maxRank=="number")for(let l=a.minRank;l<=a.maxRank;l++)l!==a.rank&&r(l,s)}return t.map(function(s){return fvt(e,s,n,i.get(s)||[])})}function mvt(e,t,n){let i=new td;e.forEach(function(r){n.forEach(l=>i.setEdge(l.left,l.right));let s=r.graph().root,a=XRe(r,s,i,t);a.vs.forEach((l,c)=>r.node(l).order=c),pvt(r,i,a.vs)})}function JJ(e,t){Object.values(t).forEach(n=>n.forEach((i,r)=>e.node(i).order=r))}function gvt(e,t){let n={};function i(r,s){let a=0,l=0,c=r.length,u=s[s.length-1];return s.forEach((d,f)=>{let h=yvt(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)&&ZRe(n,m,f)})}})}function r(s,a){let l=-1,c=-1,u=0;return a.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(a,u,f,l,c),u=f,l=c}}i(a,u,a.length,c,s.length)}),a}return t.length&&t.reduce(r),n}function yvt(e,t){if(e.node(t).dummy){let n=e.predecessors(t);if(n)return n.find(i=>e.node(i).dummy)}}function ZRe(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 vvt(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 xvt(e,t,n,i){let r={},s={},a={};return t.forEach(l=>{l.forEach((c,u)=>{r[c]=c,s[c]=c,a[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=a[m],v=a[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=a[b];if(v!==void 0&&s[u]===u&&c{var y;let x=(y=s[v.v])!=null?y:0,w=a.edge(v);return Math.max(b,x+(w!==void 0?w:0))},0):s[m]=0}function d(m){let g=a.outEdges(m),b=Number.POSITIVE_INFINITY;g&&(b=g.reduce((y,x)=>{let w=s[x.w],O=a.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 a.predecessors(m)||[]}function h(m){return a.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 Ovt(e,t,n,i){let r=new td,s=e.graph(),a=Tvt(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(a(e,u,c),h||0))}}c=u}})}),r}function kvt(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=Avt(e,l)/2;r=Math.max(c+u,r),s=Math.min(c-u,s)});let a=r-s;return a{["l","r"].forEach(a=>{let l=s+a,c=e[l];if(!c||c===t)return;let u=Object.values(c),d=i-kf(Math.min,u);a!=="l"&&(d=r-kf(Math.max,u)),d&&(e[l]=zP(c,f=>f+d))})})}function Evt(e,t=void 0){let n=e.ul;return n?zP(n,(i,r)=>{var s,a;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)+((a=l[2])!=null?a:0))/2}):{}}function Cvt(e){let t=HC(e),n=Object.assign(gvt(e,t),bvt(e,t)),i={},r;["u","d"].forEach(a=>{r=a==="u"?t:Object.values(t).reverse(),["l","r"].forEach(l=>{l==="r"&&(r=r.map(d=>Object.values(d).reverse()));let c=xvt(e,r,n,d=>(a==="u"?e.predecessors(d):e.successors(d))||[]),u=wvt(e,r,c.root,c.align,l==="r");l==="r"&&(u=zP(u,d=>-d)),i[a+l]=u})});let s=kvt(e,i);return Svt(i,s),Evt(i,e.graph().align)}function Tvt(e,t,n){return(i,r,s)=>{let a=i.node(r),l=i.node(s),c=0,u;if(c+=a.width/2,Object.hasOwn(a,"labelpos"))switch(a.labelpos.toLowerCase()){case"l":u=-a.width/2;break;case"r":u=a.width/2;break}if(u&&(c+=n?u:-u),u=void 0,c+=(a.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 Avt(e,t){return e.node(t).width}function _vt(e){e=LRe(e),jvt(e),Object.entries(Cvt(e)).forEach(([t,n])=>e.node(t).x=n)}function jvt(e){let t=HC(e),n=e.graph(),i=n.ranksep,r=n.rankalign,s=0;t.forEach(a=>{let l=a.reduce((c,u)=>{var d;let f=(d=e.node(u).height)!=null?d:0;return c>f?c:f},0);a.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 Nvt(e,t={}){let n=t.debugTiming?BRe:URe;return n("layout",()=>{let i=n(" buildLayoutGraph",()=>Uvt(e));return n(" runLayout",()=>Rvt(i,n,t)),n(" updateInputGraph",()=>Ivt(e,i)),i})}function Rvt(e,t,n){t(" makeSpaceForEdgeLabels",()=>Qvt(e)),t(" removeSelfEdges",()=>Yvt(e)),t(" acyclic",()=>w0t(e)),t(" nestingGraph.run",()=>H0t(e)),t(" rank",()=>L0t(LRe(e))),t(" injectEdgeLabelProxies",()=>zvt(e)),t(" removeEmptyRanks",()=>a0t(e)),t(" nestingGraph.cleanup",()=>K0t(e)),t(" normalizeRanks",()=>o0t(e)),t(" assignRankMinMax",()=>Vvt(e)),t(" removeEdgeLabelProxies",()=>Hvt(e)),t(" normalize.run",()=>S0t(e)),t(" parentDummyChains",()=>U0t(e)),t(" addBorderSegments",()=>G0t(e)),t(" order",()=>YRe(e,n)),t(" insertSelfEdges",()=>Zvt(e)),t(" adjustCoordinateSystem",()=>Y0t(e)),t(" position",()=>_vt(e)),t(" positionSelfEdges",()=>Jvt(e)),t(" removeBorderNodes",()=>Xvt(e)),t(" normalize.undo",()=>C0t(e)),t(" fixupEdgeLabelCoords",()=>Kvt(e)),t(" undoCoordinateSystem",()=>Z0t(e)),t(" translateGraph",()=>qvt(e)),t(" assignNodeIntersects",()=>Wvt(e)),t(" reversePoints",()=>Gvt(e)),t(" acyclic.undo",()=>k0t(e))}function Ivt(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 Pvt=["nodesep","edgesep","ranksep","marginx","marginy"],Dvt={ranksep:50,edgesep:20,nodesep:50,rankdir:"TB",rankalign:"center"},Mvt=["acyclicer","ranker","rankdir","align","rankalign"],Lvt=["width","height","rank"],eee={width:0,height:0},$vt=["minlen","weight","width","height","labeloffset"],Fvt={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Bvt=["labelpos"];function Uvt(e){let t=new td({multigraph:!0,compound:!0}),n=IL(e.graph());return t.setGraph(Object.assign({},Dvt,RL(n,Pvt),KN(n,Mvt))),e.nodes().forEach(i=>{let r=IL(e.node(i)),s=RL(r,Lvt);Object.keys(eee).forEach(l=>{s[l]===void 0&&(s[l]=eee[l])}),t.setNode(i,s);let a=e.parent(i);a!==void 0&&t.setParent(i,a)}),e.edges().forEach(i=>{let r=IL(e.edge(i));t.setEdge(i,Object.assign({},Fvt,RL(r,$vt),KN(r,Bvt)))}),t}function Qvt(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 zvt(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};Zw(e,"edge-proxy",r,"_ep")}})}function Vvt(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 Hvt(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 qvt(e){let t=Number.POSITIVE_INFINITY,n=0,i=Number.POSITIVE_INFINITY,r=0,s=e.graph(),a=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-=a,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+a,s.height=r-i+l}function Wvt(e){e.edges().forEach(t=>{let n=e.edge(t),i=e.node(t.v),r=e.node(t.w),s,a;n.points?(s=n.points[0],a=n.points[n.points.length-1]):(n.points=[],s=r,a=i),n.points.unshift(VJ(i,s)),n.points.push(VJ(r,a))})}function Kvt(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 Gvt(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function Xvt(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]),a=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(a.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 Yvt(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 Zvt(e){HC(e).forEach(t=>{let n=0;t.forEach((i,r)=>{let s=e.node(i);s.order=r+n,(s.selfEdges||[]).forEach(a=>{Zw(e,"selfedge",{width:a.label.width,height:a.label.height,rank:s.rank,order:r+ ++n,e:a.e,label:a.label},"_se")}),delete s.selfEdges})})}function Jvt(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,a=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:a-c},{x:s+5*l/6,y:a-c},{x:s+l,y:a},{x:s+5*l/6,y:a+c},{x:s+2*l/3,y:a+c}],i.label.x=n.x,i.label.y=n.y}})}function RL(e,t){return zP(KN(e,t),Number)}function IL(e){let t={};return e&&Object.entries(e).forEach(([n,i])=>{typeof n=="string"&&(n=n.toLowerCase()),t[n]=i}),t}function ext(e){let t=HC(e),n=new td({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((a,l)=>(n.setEdge(a,l,{style:"invis"}),l))}),n}var txt={graphlib:ARe,version:f0t,layout:Nvt,debug:ext,util:{time:BRe,notime:URe}},tee=txt;/*! For license information please see dagre.esm.js.LEGAL.txt */const nk={llm:{labelKey:"buildCanvas.patterns.llm.label",descriptionKey:"buildCanvas.patterns.llm.description",icon:aAe},sequential:{labelKey:"buildCanvas.patterns.sequential.label",descriptionKey:"buildCanvas.patterns.sequential.description",icon:trt},parallel:{labelKey:"buildCanvas.patterns.parallel.label",descriptionKey:"buildCanvas.patterns.parallel.description",icon:Dit},loop:{labelKey:"buildCanvas.patterns.loop.label",descriptionKey:"buildCanvas.patterns.loop.description",icon:dAe},a2a:{labelKey:"buildCanvas.patterns.a2a.label",descriptionKey:"buildCanvas.patterns.a2a.description",icon:gP}},YF=220,ZF=88,nee=96,iee=34,Kk=64,PL=310,$v=24,JRe=56,JF=40,ree=40,nxt=18,ixt=58,rxt=!1,sxt=e=>e==="sequential"||e==="parallel"||e==="loop";function e8(e,t){const n=e.agentType??"llm";return sxt(n)||n==="llm"&&(t.length===0||e.subAgents.length>0)}function t8(e,t=[],n="horizontal",i=!1){const r=e.agentType??"llm";if(!e8(e,t))return{width:YF,height:ZF};if(i&&e.subAgents.length===0)return{width:PL,height:Kk};const s=e.subAgents.map((f,h)=>t8(f,[...t,h],n,i)),a=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"?JRe:$v,u=n==="horizontal"?r!=="parallel":r==="parallel",d=s.length?r==="parallel"?nxt+ree:r==="loop"?ixt:0:ree;return u?{width:Math.max(PL,s.reduce((f,h)=>f+h.width,0)+JF*Math.max(0,s.length-1)+c*2),height:Kk+$v+l+d+$v}:{width:Math.max(PL,a+$v*2),height:Kk+c+s.reduce((f,h)=>f+h.height,0)+JF*Math.max(0,s.length-1)+d+c}}function uO(e){return e.length===0?"agent-root":`agent-${e.join("-")}`}function oxt(e,t){return e.length===t.length&&e.every((n,i)=>n===t[i])}function see(e){const t=n=>[n.agentType??"llm",n.subAgents.map(t)];return JSON.stringify(t(e))}function dO(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:uE.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 oee(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 a(f,h,m,g,b){const v=f.agentType??"llm",y=uO(h);return e8(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(nk[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=uO(h),x=t8(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(nk[v].labelKey)),pattern:v,description:f.description.trim()||i(nk[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,N)=>t8(E,[...h,N],t,n)),O=w.length&&v!=="parallel"?JRe:$v,S=t==="horizontal"?v!=="parallel":v==="parallel";let k=O;const C=f.subAgents.map((E,N)=>{const A=w[N],j=S?{x:k,y:Kk+$v}:{x:(x.width-A.width)/2,y:Kk+k};return k+=(S?A.width:A.height)+JF,a(E,[...h,N],y,j,v)});if(v==="sequential"||v==="loop"){for(let E=0;E1&&s.push(dO(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=uO(h);if(e8(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(nk[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=uO(x);s.push(dO(g,w,i("buildCanvas.edges.call"),{insert:{parentPath:h,index:y}})),b.push(...c(v,x))}),b},u=uO([]),d=c(e,[]);return s.push(dO("terminal-input",u)),d.forEach(f=>s.push(dO(f,"terminal-output"))),axt(r,s,t)}function axt(e,t,n){const i=new tee.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 a=s.data.kind==="terminal";i.setNode(s.id,{width:a?nee:s.data.layoutWidth??YF,height:a?iee:s.data.layoutHeight??ZF})}),t.filter(s=>r.has(s.source)&&r.has(s.target)).forEach(s=>i.setEdge(s.source,s.target)),tee.layout(i),{nodes:e.map(s=>{if(s.parentId)return s;const a=i.node(s.id),l=s.data.kind==="terminal",c=l?nee:s.data.layoutWidth??YF,u=l?iee:s.data.layoutHeight??ZF;return{...s,position:{x:a.x-c/2,y:a.y-u/2}}}),edges:t}}const HP=p.createContext(null),qP=p.createContext("horizontal");function lxt({id:e,sourceX:t,sourceY:n,targetX:i,targetY:r,sourcePosition:s,targetPosition:a,markerEnd:l,style:c,label:u,data:d}){const{t:f}=_e("create"),h=p.useContext(HP),[m,g]=p.useState(!1),[b,v,y]=VN({sourceX:t,sourceY:n,targetX:i,targetY:r,sourcePosition:s,targetPosition:a,offset:d!=null&&d.loop?28:20});return o.jsxs(o.Fragment,{children:[o.jsx(VC,{id:e,path:b,markerEnd:l,style:c}),h&&(d==null?void 0:d.insert)&&o.jsx("path",{d:b,className:"abc-edge-hover-path",onPointerEnter:()=>g(!0),onPointerLeave:()=>g(!1)}),(u||h&&(d==null?void 0:d.insert))&&o.jsx(eyt,{children:o.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&&o.jsx("span",{className:"abc-edge-label",children:u}),h&&(d==null?void 0:d.insert)&&o.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:o.jsx(_l,{})})]})})]})}function cxt({data:e,selected:t}){const{t:n}=_e("create"),i=p.useContext(HP),r=p.useContext(qP),s=r==="vertical"?pn.Top:pn.Left,a=r==="vertical"?pn.Bottom:pn.Right,l=r==="vertical"?pn.Right:pn.Bottom,c=e.pattern??"llm",u=nk[c],d=u.icon;return o.jsxs("div",{className:`abc-node is-${c}${e.containedIn?` is-contained-in-${e.containedIn}`:""}${t?" is-selected":""}`,children:[o.jsx(sc,{type:"target",position:s,className:"abc-handle"}),c!=="llm"&&o.jsx("span",{className:"abc-node-icon",children:o.jsx(d,{})}),o.jsxs("span",{className:"abc-node-copy",children:[o.jsx("span",{className:"abc-node-meta",children:o.jsx("span",{children:n(u.labelKey)})}),o.jsx("strong",{children:e.title}),o.jsx("small",{children:e.description})]}),i&&e.path!==void 0&&e.path.length>0&&o.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:o.jsx(ag,{})}),o.jsx(sc,{type:"source",position:a,className:"abc-handle"}),e.containedIn==="loop"&&o.jsxs(o.Fragment,{children:[o.jsx(sc,{id:"loop-target",type:"target",position:l,className:"abc-handle abc-loop-handle"}),o.jsx(sc,{id:"loop-source",type:"source",position:l,className:"abc-handle abc-loop-handle"})]})]})}function uxt({data:e,selected:t}){const{t:n}=_e("create"),i=p.useContext(HP),r=p.useContext(qP),s=r==="vertical"?pn.Top:pn.Left,a=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 o.jsxs("div",{className:`abc-group is-${c}${e.compactEmptyGroup?" is-compact-empty":""}${t?" is-selected":""}`,children:[o.jsx(sc,{type:"target",position:s,className:"abc-handle"}),o.jsx("header",{className:"abc-group-head",children:o.jsxs("span",{children:[o.jsx("strong",{title:e.title,children:e.title}),o.jsx("small",{children:e.description})]})}),i&&e.path!==void 0&&u>0&&c!=="parallel"&&o.jsxs("div",{className:"abc-group-boundary-actions",children:[o.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:o.jsx(_l,{})}),o.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:o.jsx(_l,{})})]}),i&&e.path!==void 0&&u>0&&c==="parallel"&&o.jsxs("button",{type:"button",className:"abc-group-add abc-group-add-bottom nodrag nopan",onClick:f=>{f.stopPropagation(),i.onAdd(e.path)},children:[o.jsx(_l,{}),o.jsx("span",{children:d})]}),i&&e.path!==void 0&&u===0&&o.jsxs("button",{type:"button",className:"abc-group-add abc-group-add-empty nodrag nopan",onClick:f=>{f.stopPropagation(),i.onAdd(e.path)},children:[o.jsx(_l,{}),o.jsx("span",{children:d})]}),i&&e.path!==void 0&&e.path.length>0&&o.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:o.jsx(ag,{})}),o.jsx(sc,{type:"source",position:a,className:"abc-handle"}),e.containedIn==="loop"&&o.jsxs(o.Fragment,{children:[o.jsx(sc,{id:"loop-target",type:"target",position:l,className:"abc-handle abc-loop-handle"}),o.jsx(sc,{id:"loop-source",type:"source",position:l,className:"abc-handle abc-loop-handle"})]})]})}function dxt({data:e}){const t=p.useContext(qP);return o.jsxs("div",{className:"abc-terminal",children:[o.jsx(sc,{type:"target",position:t==="vertical"?pn.Top:pn.Left,className:"abc-handle"}),o.jsx("span",{children:e.title}),o.jsx(sc,{type:"source",position:t==="vertical"?pn.Bottom:pn.Right,className:"abc-handle"})]})}const fxt={agent:cxt,group:uxt,terminal:dxt},hxt={insertStep:lxt};function pxt({draft:e,selectedPath:t,onSelect:n,onAdd:i,onInsert:r,onDelete:s,readOnly:a=!1,interactivePreview:l=!1,direction:c="horizontal"}){const{t:u}=_e("create"),d=p.useMemo(()=>oee(e,c,a,u),[]),[f,h,m]=tyt(d.nodes),[g,b,v]=nyt(d.edges),y=ryt(),x=p.useRef(`${c}:${a?"readonly":"editable"}:${see(e)}`),w=p.useRef(null),{fitView:O}=UP(),S=p.useMemo(()=>oee(e,c,a,u),[c,e,a,u]),[k,C]=p.useState(()=>window.matchMedia("(max-width: 860px)").matches),E=p.useMemo(()=>a?{padding:.16,minZoom:.05,maxZoom:.9}:k?{padding:.08,minZoom:.35,maxZoom:.9}:{padding:.14,minZoom:.42,maxZoom:1.1},[k,a]),N=p.useCallback((j=0)=>{window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>{const T=w.current;if(T&&(T.clientWidth===0||T.clientHeight===0)&&j<8){N(j+1);return}O(E)})})},[E,O]);p.useEffect(()=>{const j=window.matchMedia("(max-width: 860px)"),T=R=>C(R.matches);return j.addEventListener("change",T),()=>j.removeEventListener("change",T)},[]),p.useEffect(()=>{const j=`${c}:${a?"readonly":"editable"}:${see(e)}`,T=j!==x.current;x.current=j,b(S.edges),h(R=>{const _=new Map(R.map(D=>[D.id,D]));return S.nodes.map(D=>{const M=_.get(D.id);return{...D,measured:!T&&M&&M.type===D.type?M.measured:void 0,position:!T&&M?M.position:D.position,selected:D.data.kind==="agent"&&!!D.data.path&&oxt(D.data.path,t)}})}),T&&N()},[S,e,N,t,b,h]),p.useEffect(()=>{N()},[k,N]),p.useEffect(()=>{y&&N()},[S,N,y]),p.useEffect(()=>{if(!a||!w.current)return;const j=new ResizeObserver(()=>N());return j.observe(w.current),N(),()=>j.disconnect()},[N,a]);const A=p.useMemo(()=>a?null:{onAdd:i,onInsert:r,onDelete:s},[i,s,r,a]);return o.jsx(qP.Provider,{value:c,children:o.jsx(HP.Provider,{value:A,children:o.jsx("section",{className:`abc-root is-${c}${a?" is-readonly":""}`,"aria-label":u(a?"buildCanvas.readOnlyLabel":"buildCanvas.label"),children:o.jsx("div",{ref:w,className:"abc-canvas",children:o.jsxs(Zbt,{nodes:f,edges:g,nodeTypes:fxt,edgeTypes:hxt,onNodesChange:m,onEdgesChange:v,onNodeClick:(j,T)=>{!a&&T.data.kind==="agent"&&T.data.path&&n(T.data.path)},nodesDraggable:!a,nodesConnectable:!1,nodesFocusable:!a,elementsSelectable:!a,edgesFocusable:!1,edgesReconnectable:!1,panOnDrag:!a||l,zoomOnDoubleClick:l,zoomOnPinch:!a||l,zoomOnScroll:!a||l,fitView:!0,fitViewOptions:E,onInit:()=>N(),minZoom:a?.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:[o.jsx(cyt,{gap:20,size:1.2,color:"hsl(34 20% 82%)"}),(!a||l)&&o.jsx(gyt,{showInteractive:!1}),rxt]})})})})})}function mE(e){return o.jsx(kRe,{children:o.jsx(pxt,{...e})})}mn.hasResourceBundle("en-US","create")||mn.addResourceBundle("en-US","create",Hue,!0,!0);mn.hasResourceBundle("zh-CN","create")||mn.addResourceBundle("zh-CN","create",Wbe,!0,!0);function Kt(e,t={}){return mn.t(e,{...t,ns:"create"})}function qC(e,t){return e.map(n=>({...n,get label(){return Kt(`${t}.${n.id}.label`)},get desc(){return Kt(`${t}.${n.id}.description`)}}))}function Mu(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 eIe="https://ark.cn-beijing.volces.com/api/v3/";Mu({key:"MODEL_AGENT_NAME",required:!1,placeholder:"doubao-seed-1-6-250615"},{comment:"traditional.catalog.env.modelAgentName.comment"});const tj=[Mu({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:eIe}],GN=[],XN={get label(){return Kt("traditional.catalog.links.console")},url:"https://console.volcengine.com/vikingdb/openviking"},mxt={get label(){return Kt("traditional.catalog.links.documentation")},url:"https://github.com/volcengine/OpenViking/blob/main/docs/zh/api/05-sessions.md"},tIe="https://api.vikingdb.cn-beijing.volces.com/openviking",gxt=`{ "self": {"enabled": true}, "peer": {"enabled": true}, "working_memory": {"enabled": true}, "memory_types": null }`,bxt=[{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}],yxt=[Mu({key:"DATABASE_VIKINGMEM_PROJECT",required:!1,placeholder:"default",hidden:!0},{comment:"traditional.catalog.env.vikingMemoryProject.comment"}),Mu({key:"DATABASE_VIKING_REGION",required:!1,hidden:!0},{comment:"traditional.catalog.env.vikingMemoryRegion.comment"}),Mu({key:"DATABASE_VIKINGMEM_MEMORY_TYPE",required:!1,placeholder:"sys_event_v1,sys_profile_v1",hidden:!0},{comment:"traditional.catalog.env.vikingMemoryType.comment"})],ik=[Mu({key:"FEISHU_APP_ID",required:!0,placeholder:"cli_xxx"},{comment:"traditional.catalog.env.feishuAppId.comment"}),Mu({key:"FEISHU_APP_SECRET",required:!0,secret:!0},{placeholder:"traditional.catalog.env.feishuAppSecret.placeholder",comment:"traditional.catalog.env.feishuAppSecret.comment"})],dx={topK:"3",region:"cn-beijing",endpoint:"https://open.volcengineapi.com/"};function WP(e){if(e==="byteplus"){const t="ap-southeast-1";return{topK:dx.topK,region:t,endpoint:`https://agentkit.${t}.byteplusapi.com/`}}return dx}const nIe=[Mu({key:"REGISTRY_SPACE_ID",required:!0},{placeholder:"traditional.catalog.env.registrySpaceId.placeholder",comment:"traditional.catalog.env.registrySpaceId.comment"}),Mu({key:"REGISTRY_TOP_K",required:!1,placeholder:dx.topK},{comment:"traditional.catalog.env.registryTopK.comment"}),Mu({key:"REGISTRY_REGION",required:!1,placeholder:dx.region},{comment:"traditional.catalog.env.registryRegion.comment"}),Mu({key:"REGISTRY_ENDPOINT",required:!1,placeholder:dx.endpoint},{comment:"traditional.catalog.env.registryEndpoint.comment"})],Jw=qC([{id:"web_search",importLine:"from veadk.tools.builtin_tools.web_search import web_search",toolNames:["web_search"],env:GN},{id:"parallel_web_search",importLine:"from veadk.tools.builtin_tools.parallel_web_search import parallel_web_search",toolNames:["parallel_web_search"],env:GN},{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"),vxt=new Set(["web_scraper","text_to_speech","vesearch"]),xxt=new Set(["web_search","parallel_web_search"]),wxt=Jw.filter(e=>!vxt.has(e.id));function iIe(e="volcengine"){const t=e==="byteplus"?xxt:new Set;return wxt.filter(n=>!t.has(n.id))}const fx=qC([{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"),n8=qC([{id:"local",env:tj,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},...tj],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},...tj],pipExtra:"extensions",needsEmbedding:!0},{id:"viking",env:yxt},{id:"openviking",env:[{key:"DATABASE_OPENVIKING_URL",required:!0,placeholder:tIe,get comment(){return Kt("traditional.catalog.env.openVikingUrl.comment")},link:XN},{key:"DATABASE_OPENVIKING_API_KEY",required:!0,comment:"OpenViking API Key",link:XN},{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:gxt,get comment(){return Kt("traditional.catalog.env.openVikingMemoryPolicy.comment")},multiline:!0,format:"json",get help(){return Kt("traditional.catalog.env.openVikingMemoryPolicy.help")},link:mxt}]},{id:"mem0",env:[{key:"DATABASE_MEM0_API_KEY",required:!0},{key:"DATABASE_MEM0_BASE_URL",required:!1}],pipExtra:"database"}],"traditional.backends.longTerm"),qm="viking",i8=qC([{id:"viking",env:bxt},{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},...tj],pipExtra:"extensions",needsEmbedding:!0},{id:"context_search",env:[...GN,{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:tIe,get comment(){return Kt("traditional.catalog.env.openVikingUrl.comment")},link:XN},{key:"DATABASE_OPENVIKING_API_KEY",required:!0,comment:"OpenViking API Key",link:XN},{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"),Oxt=qC([{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:[...GN,Mu({key:"OBSERVABILITY_OPENTELEMETRY_TLS_SERVICE_NAME",required:!1},{comment:"traditional.catalog.env.tlsServiceName.comment"})]}],"traditional.exporters");function iu(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:cp(e),modelFallbacks:[],modelSource:"ark",modelProvider:"",modelApiBase:"",shortTermBackend:"local",longTermBackend:"local",longTermMemoryIndex:"",autoSaveSession:!1,knowledgebaseBackend:qm,knowledgebaseIndex:"",tracingExporters:[],selectedSkills:[],cloudEnvironment:{environmentId:"",environmentVersionId:""},deployment:{feishuEnabled:!1,modelApiKeyId:"",modelApiKeyName:""}}}function fO(e){return{id:e,get displayName(){return Kt(`traditional.optimization.options.${e}.label`)},get description(){return Kt(`traditional.optimization.options.${e}.description`)}}}const _z=[fO("context_engine"),fO("compressor"),fO("verifier"),fO("long_run_control"),fO("mcp_resilience")],kxt=[{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"]}],e1=_z.map(e=>e.id);function Sxt(e){return e==="byteplus"?Kt("traditional.optimization.bytePlusUnavailable"):null}const rIe=["context_engine","compressor","verifier","long_run_control"],Ext=new Set(["1","true","yes","on"]),jz=[{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 nj(e){var t;return((t=_z.find(n=>n.id===e))==null?void 0:t.displayName)??e}function Cxt(e){var t;return((t=jz.find(n=>n.id===e))==null?void 0:t.displayName)??e}function Nz(e){const t=jz.find(n=>n.id===e);return t?[...t.defaultComponents]:[]}function Lb(e,t="default"){const n=new Set(e);return{enabled:n.size>0,profile:t,componentOverrides:Object.fromEntries(e1.map(r=>[r,n.has(r)]))}}function Rz(e){if(!e)return;const t=e.profile==="ops"?"ops":"default",n=t==="ops"?Nz(t):e1.filter(i=>{var r;return((r=e.componentOverrides)==null?void 0:r[i])===!0});return{...Lb(n,t),...e.catalogVersion?{catalogVersion:e.catalogVersion}:{},...e.planHash?{planHash:e.planHash}:{}}}function DL(e){return Ext.has((e==null?void 0:e.trim().toLowerCase())??"")}function Txt(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 Axt(e){var a;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=((a=t.get("HARNESS_PROFILE"))==null?void 0:a.trim())==="ops"?"ops":"default";if(!DL(n))return Lb([],i);const r=Txt(t.get("HARNESS_SIDECAR_COMPONENT_OVERRIDES"));if(r){const l={...Lb(e1.filter(c=>r[c]===!0),i),enabled:!0};return i==="ops"?Rz(l)??l:l}if(i==="ops")return Lb(Nz(i),i);const s=[...DL(t.get("HARNESS_MODEL_PROXY_ENABLED"))?rIe:[],...DL(t.get("HARNESS_MCP_GATEWAY_ENABLED"))?["mcp_resilience"]:[]];return{...Lb(s,i),enabled:!0}}function _xt(e,t){return{...e,modelName:t.modelName||e.modelName,description:t.description,instruction:t.instruction}}function jxt(e){var t;return((t=e.harnessSidecar)==null?void 0:t.profile)??"default"}function YN(e){var n;const t=(n=e.harnessSidecar)==null?void 0:n.componentOverrides;return t?e1.filter(i=>t[i]):[]}function Nxt(e){const t=new Set(YN(e));return rIe.filter(n=>t.has(n))}function Rxt(e,t){const n=i=>({...i,mcpTools:(i.mcpTools??[]).map(r=>{var a,l;const s=!!(r.authTokenEnv&&(t.has(r.authTokenEnv)||r.authToken));return{...r,credentialConfigured:s,...s?{credentialSourceUrl:((a=r.url)==null?void 0:a.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 Zy(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 Iz(e){return Zy(e).modelName}function sIe(e,t,n,i=!1){var c,u,d,f;const r=Zy((t==null?void 0:t.model)||(n==null?void 0:n.model)),s=(t==null?void 0:t.children)??[],a=t==null?void 0:t.type,l=e.agentType==="a2a"&&((c=e.a2aRegistry)!=null&&c.enabled)&&a==="llm"?"a2a":a??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)=>sIe(h,s[m],void 0,i))}}function Ixt(e,t){const n=new Map(t.map(({key:a,value:l})=>[a,l]));if(!["REGISTRY_SPACE_ID","REGISTRY_TOP_K","REGISTRY_REGION","REGISTRY_ENDPOINT"].some(a=>n.has(a)))return e;const r=(a,l)=>n.has(a)?n.get(a)??"":l??"",s=a=>{var l;return{...a,...(l=a.a2aRegistry)!=null&&l.enabled?{a2aRegistry:{...a.a2aRegistry,registrySpaceId:r("REGISTRY_SPACE_ID",a.a2aRegistry.registrySpaceId),registryTopK:r("REGISTRY_TOP_K",a.a2aRegistry.registryTopK),registryRegion:r("REGISTRY_REGION",a.a2aRegistry.registryRegion),registryEndpoint:r("REGISTRY_ENDPOINT",a.a2aRegistry.registryEndpoint)}}:{},subAgents:a.subAgents.map(s)}};return s(e)}function r8(e,t){var c,u,d;const n=e.cloudProvider??t,i=iu(n),r=e.deployment,s=r==null?void 0:r.network,a=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:Rz(e.harnessSidecar),subAgents:(e.subAgents??[]).map(f=>r8(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,...a??{},cliTools:[...(a==null?void 0:a.cliTools)??[]],dockerfile:typeof(a==null?void 0:a.dockerfile)=="string"?a.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:r8(f.agent,n)}))}}:{}}}const Pxt=["动态子智能体协作规则:","Dynamic sub-agent collaboration rules:"],Dxt=["collect_resources","create_agents","handoff_to"];function Mxt(e){return e.replace(/\\([\\`*_[\]{}()<>#+\-.!|])/g,"$1")}function Lxt(e){const t=Pxt.flatMap(i=>{const r=[];let s=0;for(;si-r),n=t.find((i,r)=>{const s=t[r+1]??e.length,a=Mxt(e.slice(i,s));return Dxt.every(l=>a.includes(l))});return n===void 0?e:e.slice(0,n).trimEnd()}function $xt(e){const t=n=>({...n,instruction:n.dynamicAgentDelegation===!0?Lxt(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 oIe(e,t){var l,c;const n=iu(t),i=[...e.tools??[]],r=Jw.filter(u=>u.toolNames.some(d=>i.includes(d))),s=new Set(r.flatMap(u=>u.toolNames)),a=Zy(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:a.modelName,modelProvider:a.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=>oIe(u,t))}}function Pz(e,t,n=[]){var l,c,u,d;const i=((l=e.draft)==null?void 0:l.cloudProvider)??t,r=Zy(e.model),s=e.draft?r8(e.draft,i):e.graph?oIe(e.graph,i):{...iu(i),modelSource:void 0,name:((c=e.name)==null?void 0:c.trim())||e.appName.trim(),description:e.description??"",instruction:e.instruction||iu(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))??[]},a=e.draft&&s.dynamicAgentDelegation===!0?$xt(s):s;return Rxt(sIe(a,e.graph,{name:((d=e.name)==null?void 0:d.trim())||e.appName.trim(),model:e.model},!!e.draft),new Set(n))}function Fxt(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(a=>({...a,agent:n(a.agent)}))}}:{}}};return n(e)}function aee({className:e="icon"}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[o.jsx("path",{d:"M4.5 6.7h4.2M12.3 6.7h7.2"}),o.jsx("path",{d:"M4.5 12h8.2M16.3 12h3.2"}),o.jsx("path",{d:"M4.5 17.3h2.7M10.8 17.3h8.7"}),o.jsx("circle",{cx:"10.5",cy:"6.7",r:"1.8",fill:"currentColor",stroke:"none"}),o.jsx("circle",{cx:"14.5",cy:"12",r:"1.8",fill:"currentColor",stroke:"none"}),o.jsx("circle",{cx:"9",cy:"17.3",r:"1.8",fill:"currentColor",stroke:"none"})]})}const Bxt={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",studio_write_artifact:"studioTools.labels.studio_write_artifact"};function s8(e,t,n){const i=Jw.find(s=>s.id===e||s.toolNames.includes(e)),r=Bxt[e];return r?t(r):n||(i==null?void 0:i.label)||e}function Uxt(){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:o.jsx("path",{d:"m7 7 10 10M17 7 7 17",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function Qxt(){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[o.jsx("circle",{cx:"10.8",cy:"10.8",r:"5.8",stroke:"currentColor",strokeWidth:"1.7"}),o.jsx("path",{d:"m15.2 15.2 4 4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})]})}function zxt({agentName:e,tools:t,selectedIds:n,loading:i,disabled:r,unavailableReason:s,onChange:a,onClose:l}){const{t:c}=_e("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),a([...v])};return Jn.createPortal(o.jsxs("div",{className:"studio-tool-dialog-layer",children:[o.jsx("button",{type:"button",className:"studio-tool-dialog-scrim","aria-label":c("studioTools.closeDialog"),onClick:l}),o.jsxs("section",{className:"studio-tool-dialog",role:"dialog","aria-modal":"true","aria-labelledby":h.current,children:[o.jsxs("header",{className:"studio-tool-dialog-head",children:[o.jsx("span",{className:"studio-tool-dialog-mark",children:o.jsx(aee,{})}),o.jsxs("div",{children:[o.jsx("h2",{id:h.current,children:c("studioTools.title")}),o.jsx("p",{children:c("studioTools.description",{agentName:e})})]}),o.jsx("button",{type:"button",className:"studio-tool-dialog-close","aria-label":c("studioTools.close"),onClick:l,children:o.jsx(Uxt,{})})]}),o.jsxs("div",{className:"studio-tool-dialog-body",children:[o.jsxs("label",{className:"studio-tool-search",children:[o.jsx(Qxt,{}),o.jsx("input",{value:u,"aria-label":c("studioTools.searchAria"),placeholder:c("studioTools.searchPlaceholder"),autoFocus:!0,onChange:b=>d(b.target.value)})]}),o.jsx("div",{className:"studio-tool-picker",role:"list","aria-label":c("studioTools.availableAria"),children:i?o.jsx("div",{className:"studio-tool-empty",children:c("studioTools.loading")}):s?o.jsx("div",{className:"studio-tool-empty",children:s}):m.length===0?o.jsx("div",{className:"studio-tool-empty",children:c("studioTools.noMatch")}):m.map(b=>{const v=f.has(b.id);return o.jsxs("article",{className:"studio-tool-option",role:"listitem",children:[o.jsx("span",{className:"studio-tool-option-icon",children:o.jsx(aee,{})}),o.jsxs("span",{className:"studio-tool-option-copy",children:[o.jsx("strong",{children:s8(b.id,c,b.name)}),o.jsx("code",{children:b.id}),o.jsx("span",{children:b.description})]}),o.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 ZN=[{id:"ubuntu-22.04",label:"Ubuntu 22.04",image:"ubuntu:22.04"},{id:"ubuntu-24.04",label:"Ubuntu 24.04",image:"ubuntu:24.04"}],aIe=[{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 基础镜像"}],Dz="agentkit-cli-2107625663-cn-beijing.cr.volces.com/agentkit/agent-native-requirements-aio:0.2.1-20260831",lIe={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"},cIe=[{id:"python-3.10",label:"Python 3.10"},{id:"python-3.12",label:"Python 3.12"}],Vxt={"python-3.10":"3.10.18","python-3.12":"3.12.11"},Mz=[{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"}]}],Hxt=Mz.flatMap(e=>e.options),qxt=["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"],Wxt=["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"],Kxt={"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 hO(e,t){for(const n of t)e.includes(n)||e.push(n)}function Gxt(e,t,n,i,r){const s=["ca-certificates"];r||hO(s,i?[`python${n}`,`python${n}-venv`]:qxt);for(const a of t)a.id==="playwright"||a.id==="chromium"||(a.installer==="apt"&&hO(s,[a.packageName]),a.id==="opencli"&&hO(s,["curl","xz-utils"]));return e.optionIds.some(a=>a==="playwright"||a==="chromium")&&(hO(s,Wxt),hO(s,Kxt[e.operatingSystem])),s}const ML={name:"",description:"",baseEnvironment:"aio-sandbox",operatingSystem:"ubuntu-22.04",language:"python-3.12",optionIds:[],selectedSkills:[]};function Yh(e){var t;return((t=cIe.find(n=>n.id===e))==null?void 0:t.label)??e}function o8(e){var t;return((t=ZN.find(n=>n.id===e))==null?void 0:t.label)??e}function a8(e){var t;return((t=aIe.find(n=>n.id===e))==null?void 0:t.label)??e}function Xxt(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 Lz(e,t="volcengine"){const n=Hxt.filter(b=>e.optionIds.includes(b.id)),i=e.baseEnvironment==="aio-sandbox",r=e.baseEnvironment==="codex-sandbox",s=i||r,a=s?"python-3.12":e.language,l=a.replace("python-",""),c=Vxt[a],u=ZN.find(b=>b.id===e.operatingSystem)??ZN[0],d=e.operatingSystem==="ubuntu-22.04"&&l==="3.10"||e.operatingSystem==="ubuntu-24.04"&&l==="3.12",f=Gxt(e,n,l,d,s),h=i?[`ARG AIO_BASE_IMAGE=${Dz}`,"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=${lIe[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 Yxt(){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:o.jsx("path",{d:"m7 7 10 10M17 7 7 17",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function Zxt(){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[o.jsx("circle",{cx:"10.8",cy:"10.8",r:"5.8",stroke:"currentColor",strokeWidth:"1.7"}),o.jsx("path",{d:"m15.2 15.2 4 4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})]})}function l8(){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[o.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"}),o.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 uIe(){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[o.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"}),o.jsx("path",{d:"M8 11.25h8M8 14.75h5.5",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"})]})}function Jxt(){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:o.jsx("path",{d:"M12 6.5v11M6.5 12h11",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function lee(){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:o.jsx("path",{d:"m7 7 10 10M17 7 7 17",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function cee(){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:o.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 Gl(e){return`${e.environment_id}\0${e.environment_version_id}`}function Gk(e){return e.latestVersion?{environment_id:e.id,environment_version_id:e.latestVersion.versionId}:null}function ij(e,t){return e.environmentIds.flatMap(n=>{const i=t.get(n),r=i?Gk(i):null;return r?[r]:[]})}function ewt({environments:e,workspaces:t,value:n,selectedWorkspaceIds:i,loading:r,error:s,onConfirm:a,onClose:l}){const{t:c}=_e("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(R=>i.includes(R.id)).flatMap(R=>R.environmentIds));return new Set(n.filter(R=>!T.has(R.environment_id)).map(Gl))}),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 R of t)if(y.has(R.id))for(const _ of ij(R,v))T.add(Gl(_));return T},[w,y,v,t]),C=p.useMemo(()=>{const T=u.trim().toLocaleLowerCase();return T?e.filter(R=>`${R.name} ${R.description} ${Yh(R.language)}`.toLocaleLowerCase().includes(T)):e},[e,u]),E=p.useMemo(()=>{const T=u.trim().toLocaleLowerCase();return T?t.filter(R=>{const _=R.environmentIds.map(D=>{var M;return((M=v.get(D))==null?void 0:M.name)??""}).join(" ");return`${R.name} ${R.description} ${_}`.toLocaleLowerCase().includes(T)}):t},[v,u,t]);p.useEffect(()=>{const T=document.body.style.overflow,R=_=>{_.key==="Escape"&&!f&&l()};return document.body.style.overflow="hidden",document.addEventListener("keydown",R),()=>{document.body.style.overflow=T,document.removeEventListener("keydown",R)}},[l,f]);const N=T=>{const R=Gk(T);if(!R)return;const _=Gl(R);S.has(T.id)||O(D=>{const M=new Set(D);return M.has(_)?M.delete(_):M.add(_),M})},A=T=>{const R=ij(T,v);R.length!==0&&(x(_=>{const D=new Set(_);return D.has(T.id)?D.delete(T.id):D.add(T.id),D}),O(_=>{const D=new Set(_);for(const M of R)D.delete(Gl(M));return D}))},j=async()=>{const T=new Map(n.map(_=>[Gl(_),_])),R=e.flatMap(_=>{const D=Gk(_);if(!D||!k.has(Gl(D)))return[];const M=T.get(Gl(D));return[{...D,mount_instance_id:(M==null?void 0:M.mount_instance_id)||crypto.randomUUID()}]});h(!0),g("");try{await a(R,[...y]),l()}catch(_){g(_ instanceof Error?_.message:c("sessionEnvironment.mountFailed"))}finally{h(!1)}};return Jn.createPortal(o.jsxs("div",{className:"studio-tool-dialog-layer",children:[o.jsx("button",{type:"button",className:"studio-tool-dialog-scrim","aria-label":c("sessionEnvironment.closeDialog"),disabled:f,onClick:l}),o.jsxs("section",{className:"studio-tool-dialog session-environment-dialog",role:"dialog","aria-modal":"true","aria-labelledby":b,children:[o.jsxs("header",{className:"studio-tool-dialog-head",children:[o.jsx("span",{className:"studio-tool-dialog-mark",children:o.jsx(l8,{})}),o.jsxs("div",{children:[o.jsx("h2",{id:b,children:c("sessionEnvironment.addTitle")}),o.jsx("p",{children:c("sessionEnvironment.description")})]}),o.jsx("button",{type:"button",className:"studio-tool-dialog-close","aria-label":c("sessionEnvironment.closeAdd"),disabled:f,onClick:l,children:o.jsx(Yxt,{})})]}),o.jsxs("div",{className:"studio-tool-dialog-body",children:[o.jsxs("label",{className:"studio-tool-search",children:[o.jsx(Zxt,{}),o.jsx("input",{value:u,"aria-label":c("sessionEnvironment.searchAria"),placeholder:c("sessionEnvironment.searchPlaceholder"),autoFocus:!0,onChange:T=>d(T.target.value)})]}),o.jsx("div",{className:"studio-tool-picker session-environment-picker",role:"group","aria-label":c("sessionEnvironment.availableAria"),children:r?o.jsx("div",{className:"studio-tool-empty",children:c("sessionEnvironment.loading")}):s?o.jsx("div",{className:"studio-tool-empty",children:s}):C.length===0&&E.length===0?o.jsx("div",{className:"studio-tool-empty",children:c("sessionEnvironment.noMatch")}):o.jsxs(o.Fragment,{children:[E.length>0&&o.jsxs("section",{className:"session-environment-picker__group","aria-labelledby":`${b}-workspaces`,children:[o.jsx("h3",{id:`${b}-workspaces`,children:c("sessionEnvironment.workspaces")}),E.map(T=>{const R=ij(T,v),_=y.has(T.id),D=R.length===0;return o.jsxs("label",{className:`studio-tool-option session-environment-option is-workspace${_?" is-selected":""}${D?" is-disabled":""}`,children:[o.jsx("span",{className:"studio-tool-option-icon",children:o.jsx(uIe,{})}),o.jsxs("span",{className:"studio-tool-option-copy",children:[o.jsx("strong",{children:T.name}),o.jsx("span",{children:T.description||c("sessionEnvironment.reuseAll")}),o.jsx("small",{children:c("sessionEnvironment.availableEnvironmentCount",{count:R.length})})]}),o.jsx("input",{type:"checkbox",checked:_,disabled:D,"aria-label":c("sessionEnvironment.selectWorkspace",{name:T.name}),onChange:()=>A(T)}),o.jsx("span",{className:"session-environment-check","aria-hidden":"true",children:o.jsx(cee,{})})]},T.id)})]}),C.length>0&&o.jsxs("section",{className:"session-environment-picker__group","aria-labelledby":`${b}-environments`,children:[o.jsx("h3",{id:`${b}-environments`,children:c("sessionEnvironment.environments")}),C.map(T=>{const R=Gk(T);if(!R)return null;const _=t.filter(P=>y.has(P.id)&&P.environmentIds.includes(T.id)),D=_.length>0,M=k.has(Gl(R));return o.jsxs("label",{className:`studio-tool-option session-environment-option${M?" is-selected":""}${D?" is-covered":""}`,children:[o.jsx("span",{className:"studio-tool-option-icon",children:o.jsx(l8,{})}),o.jsxs("span",{className:"studio-tool-option-copy",children:[o.jsx("strong",{children:T.name}),o.jsx("span",{children:D?c("sessionEnvironment.includedByWorkspaces",{names:_.map(P=>P.name).join(c("sessionEnvironment.nameSeparator"))}):T.description||Yh(T.language)}),o.jsxs("small",{children:[Yh(T.language)," · ",R.environment_version_id]})]}),o.jsx("input",{type:"checkbox",checked:M,disabled:D,"aria-label":c("sessionEnvironment.selectEnvironment",{name:T.name}),onChange:()=>N(T)}),o.jsx("span",{className:"session-environment-check","aria-hidden":"true",children:o.jsx(cee,{})})]},Gl(R))})]})]})})]}),o.jsxs("footer",{className:"session-environment-dialog__footer",children:[o.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})})}),o.jsxs("div",{children:[o.jsx("button",{type:"button",disabled:f,onClick:l,children:c("sessionEnvironment.cancel")}),o.jsx("button",{type:"button",className:"is-primary",disabled:r||f||!!s,onClick:()=>void j(),children:c(f?"sessionEnvironment.mounting":"sessionEnvironment.confirm")})]})]})]})]}),document.body)}function twt({environments:e,workspaces:t,value:n,selectedWorkspaceIds:i,loading:r,disabled:s=!1,error:a="",onChange:l,onRefresh:c}){const{t:u}=_e("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 N=Gk(E);return N?[[Gl(N),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,N)=>{if(l){m(!0),b("");try{await l(E,N)}catch(A){b(A instanceof Error?A.message:u("sessionEnvironment.mountFailed"))}finally{m(!1)}}};return o.jsxs("div",{className:"session-environment-select",children:[n.length>0&&o.jsxs("div",{className:"session-environment-list",role:"list","aria-label":u("sessionEnvironment.mountedAria"),children:[w.map(E=>{const N=new Set(ij(E,x).map(A=>A.environment_id));return o.jsxs("div",{className:"session-environment-item is-workspace",role:"listitem",children:[o.jsx("span",{className:"session-environment-item__icon",children:o.jsx(uIe,{})}),o.jsxs("span",{className:"session-environment-item__copy",children:[o.jsx("strong",{children:E.name}),o.jsx("small",{children:u("sessionEnvironment.environmentCount",{count:N.size})})]}),l&&o.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 A=i.filter(T=>T!==E.id),j=new Set(t.filter(T=>A.includes(T.id)).flatMap(T=>T.environmentIds));C(n.filter(T=>!N.has(T.environment_id)||j.has(T.environment_id)),A)},children:o.jsx(lee,{})})]},`workspace:${E.id}`)}),S.map(E=>{const N=y.get(Gl(E));return o.jsxs("div",{className:"session-environment-item",role:"listitem",children:[o.jsx("span",{className:"session-environment-item__icon",children:o.jsx(l8,{})}),o.jsxs("span",{className:"session-environment-item__copy",children:[o.jsx("strong",{children:(N==null?void 0:N.name)??E.environment_id}),o.jsx("small",{children:N?Yh(N.language):E.environment_version_id})]}),l&&o.jsx("button",{type:"button",className:"topo-remove-capability","aria-label":u("sessionEnvironment.removeEnvironment",{name:(N==null?void 0:N.name)??E.environment_id}),title:u("sessionEnvironment.remove"),disabled:s||h,onClick:()=>void C(n.filter(A=>Gl(A)!==Gl(E)),[...i]),children:o.jsx(lee,{})})]},Gl(E))})]}),l&&o.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:[o.jsx(Jxt,{}),o.jsx("span",{children:n.length>0?u("sessionEnvironment.addMore"):u("sessionEnvironment.addForSession")})]}),g&&o.jsx("p",{className:"is-error",role:"alert",children:g}),(r||a||e.length===0)&&o.jsx("p",{className:a?"is-error":void 0,role:a?"alert":void 0,children:r?u("sessionEnvironment.loadingAvailable"):a||u("sessionEnvironment.empty")}),d&&o.jsx(ewt,{environments:e,workspaces:t,value:n,selectedWorkspaceIds:i,loading:r,error:a,onConfirm:(E,N)=>l==null?void 0:l(E,N),onClose:k})]})}function dIe(e){return 1+e.children.reduce((t,n)=>t+dIe(n),0)}function fIe(e){return e.id||e.name}function nwt(e,t,n){const i=fIe(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 hIe(e,t,n=!0){return{...e,id:fIe(e),name:nwt(e,n,t),children:e.children.map(i=>hIe(i,t,!1))}}function pIe(e){const t=iu(),n=Zy(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(pIe)}}function iwt(e){return[...new Set(e.map(t=>t.trim()).filter(Boolean))]}const rwt=new Set(["StudioExternalToolset"]);function swt(e){return[...new Map(e.filter(t=>t.name.trim()).map(t=>[t.name.trim(),{...t,name:t.name.trim()}])).values()]}function eA({title:e,count:t}){const{t:n}=_e("workspaceTools");return o.jsxs("div",{className:"topo-module-title",children:[o.jsx("span",{className:"topo-module-label",title:e,children:e}),t!==void 0&&o.jsx("span",{className:"topo-section-count","aria-label":n("agentTopology.itemCount",{count:t}),children:t})]})}function owt({appName:e,info:t,loading:n,variant:i="rail",studioTools:r=[],selectedStudioToolIds:s=[],managedStudioToolIds:a=[],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}=_e("workspaceTools"),[S,k]=p.useState(null),[C,E]=p.useState(!1),N=p.useRef(null),A=()=>{E(!1),window.requestAnimationFrame(()=>{var B;return(B=N.current)==null?void 0:B.focus()})};if(p.useEffect(()=>{if(!C)return;const B=document.body.style.overflow,W=H=>{H.key==="Escape"&&A()};return document.body.style.overflow="hidden",document.addEventListener("keydown",W),()=>{document.body.style.overflow=B,document.removeEventListener("keydown",W)}},[C]),n&&!t)return o.jsx("aside",{className:`topo is-loading${i==="drawer"?" is-drawer":""}`,"aria-label":O("agentTopology.info"),"aria-live":"polite",children:o.jsx(bn,{as:"span",className:"topo-loading-label",duration:2.2,children:O("agentTopology.loadingInfo")})});if(!t)return null;const j=Iz(t.model),T=hIe(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),R=iwt(t.tools).filter(B=>!rwt.has(B)).map(B=>({id:`base:tool:${B}`,name:B,label:s8(B,O),custom:!1,removable:!1})),_=new Set(R.map(B=>B.name)),D=new Set(s),M=new Set(a),P=r.filter(B=>D.has(B.id)&&!_.has(B.id)).map(B=>({id:`studio:tool:${B.id}`,name:B.id,label:s8(B.id,O,B.name),custom:!0,removable:!M.has(B.id)})),L=[...R,...P],F=swt(t.skills),I=!!d,z=pIe(T),K=B=>o.jsx(mE,{draft:z,direction:"horizontal",selectedPath:[],onSelect:()=>{},onAdd:()=>{},onInsert:()=>{},onDelete:()=>{},readOnly:!0,interactivePreview:!0},B);return o.jsxs(o.Fragment,{children:[o.jsxs("aside",{className:`topo${i==="drawer"?" is-drawer":""}`,"aria-label":O("agentTopology.infoAndTopology"),children:[o.jsxs("section",{className:"topo-agent-card","aria-label":O("agentTopology.info"),children:[o.jsxs("div",{className:"topo-agent-heading",children:[o.jsx("h2",{title:t.name,children:t.name||O("agentTopology.unnamedAgent")}),j&&o.jsx("span",{title:j,children:j})]}),t.description&&o.jsx("p",{className:"topo-description",title:t.description,children:t.description})]}),o.jsxs("div",{className:"topo-module-stack",children:[o.jsxs("section",{className:"topo-module-card topo-tools-card","aria-label":O("agentTopology.tools"),children:[o.jsx(eA,{title:O("agentTopology.tools"),count:L.length}),o.jsx("div",{className:"topo-module-scroll topo-tools-scroll",role:"region","aria-label":O("agentTopology.toolList"),tabIndex:0,children:L.length>0?o.jsx("div",{className:"topo-tool-list",children:L.map(B=>o.jsxs("div",{className:"topo-tool",title:B.name,children:[o.jsxs("span",{className:"topo-capability-title",children:[o.jsxs("span",{className:"topo-capability-copy",children:[o.jsx("span",{className:"topo-capability-name",children:B.label}),o.jsx("code",{children:B.name})]}),B.custom&&o.jsx("span",{className:"topo-custom-badge",children:O("agentTopology.studioTool")})]}),B.custom&&B.removable&&o.jsx("button",{type:"button",className:"topo-remove-capability","aria-label":O("agentTopology.removeTool",{name:B.name}),title:O("agentTopology.remove"),disabled:c,onClick:()=>d==null?void 0:d(s.filter(W=>W!==B.name)),children:"×"})]},B.id))}):o.jsx("div",{className:"topo-empty",children:O("agentTopology.notConfigured")})}),I&&o.jsx("div",{className:"topo-capability-add-dock",children:o.jsxs("button",{type:"button",className:"topo-capability-add-slot","aria-label":O("agentTopology.addStudioTool"),disabled:c,onClick:()=>k("tool"),children:[o.jsx("span",{"aria-hidden":"true",children:"+"}),o.jsx("span",{children:O("agentTopology.addStudioToolHere")})]})})]}),o.jsxs("section",{className:"topo-module-card topo-skills-card","aria-label":O("agentTopology.skills"),children:[o.jsx(eA,{title:O("agentTopology.skills"),count:t.skillsPreviewSupported?F.length:void 0}),o.jsx("div",{className:"topo-module-scroll topo-skills-scroll",role:"region","aria-label":O("agentTopology.skillList"),tabIndex:0,children:t.skillsPreviewSupported?F.length>0?o.jsx("div",{className:"topo-skill-list",children:F.map(B=>o.jsxs("div",{className:"topo-skill",title:B.description||B.name,children:[o.jsx("div",{className:"topo-skill-title",children:o.jsx("span",{className:"topo-skill-name",children:B.name})}),B.description&&o.jsx("span",{className:"topo-skill-description",children:B.description})]},`${B.name}:${B.description}`))}):o.jsx("div",{className:"topo-empty",children:O("agentTopology.notConfigured")}):o.jsx("div",{className:"topo-empty",children:O("agentTopology.previewUnsupported")})})]}),(x||m.length>0)&&o.jsxs("section",{className:"topo-module-card topo-environment-card","aria-label":O("agentTopology.sessionEnvironment"),children:[o.jsx(eA,{title:O("agentTopology.environment"),count:m.length}),o.jsx(twt,{environments:f,workspaces:h,value:m,selectedWorkspaceIds:g,loading:b,disabled:v,error:y,onChange:x,onRefresh:w})]}),o.jsxs("section",{className:"topo-module-card topo-topology","aria-label":O("agentTopology.agentCanvas"),children:[o.jsxs("div",{className:"topo-canvas-heading",children:[o.jsx(eA,{title:O("agentTopology.topology"),count:dIe(T)}),o.jsx("button",{ref:N,type:"button",className:"topo-canvas-expand","aria-label":O("agentTopology.viewCanvasFullscreen"),title:O("agentTopology.viewFullscreen"),onClick:()=>E(!0),children:o.jsx(ox,{"aria-hidden":"true"})})]}),o.jsx("div",{className:"topo-canvas-preview",role:"region","aria-label":O("agentTopology.executionCanvas"),children:K(`conversation-canvas:${e}`)})]})]}),S==="tool"&&d&&o.jsx(zxt,{agentName:t.name,tools:r.filter(B=>!_.has(B.id)&&!M.has(B.id)),selectedIds:s,loading:l,disabled:c,unavailableReason:u,onChange:d,onClose:()=>k(null)})]}),C&&Jn.createPortal(o.jsxs("section",{className:"topo-canvas-dialog",role:"dialog","aria-modal":"true","aria-label":O("agentTopology.fullscreenExecutionCanvas"),children:[o.jsxs("header",{className:"topo-canvas-dialog-header",children:[o.jsxs("div",{children:[o.jsx("strong",{children:O("agentTopology.executionCanvas")}),o.jsx("span",{children:t.name})]}),o.jsx("button",{type:"button","aria-label":O("agentTopology.closeFullscreenCanvas"),title:O("agentTopology.close"),onClick:A,autoFocus:!0,children:o.jsx(ka,{"aria-hidden":"true"})})]}),o.jsx("div",{className:"topo-canvas-dialog-body",children:K(`conversation-canvas-fullscreen:${e}`)})]}),document.body)]})}const WC={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.75,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0};function uee(e){return o.jsxs("svg",{...WC,...e,children:[o.jsx("rect",{x:"3.75",y:"5.25",width:"16.5",height:"13.5",rx:"2"}),o.jsx("path",{d:"m10.25 9 4.8 3-4.8 3V9Z"})]})}function awt(e){return o.jsxs("svg",{...WC,...e,children:[o.jsx("path",{d:"M12 3.75v10.5M8.4 10.8 12 14.4l3.6-3.6"}),o.jsx("path",{d:"M5 17.25v2h14v-2"})]})}function lwt(e){return o.jsxs("svg",{...WC,...e,children:[o.jsx("path",{d:"M8.75 8.75 6.9 10.6a3.4 3.4 0 0 0 4.8 4.8l1.85-1.85"}),o.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"}),o.jsx("path",{d:"m9.4 14.6 5.2-5.2"})]})}function JN(e){return o.jsxs("svg",{...WC,...e,children:[o.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"}),o.jsx("path",{d:"m13.9 6.9 3.2 3.2M5 15.8 8.2 19"})]})}function mIe(e){return o.jsx("svg",{...WC,...e,children:o.jsx("path",{d:"m6.5 6.5 11 11M17.5 6.5l-11 11"})})}const cwt=180,dee=500,LL=10,fee=32;function uwt(e){return Array.from(new Set(e.split(/[,,]/).map(t=>t.trim()).filter(Boolean)))}function dwt({artifact:e,busy:t,error:n,onClose:i,onSave:r}){const{t:s}=_e("workspaceTools"),[a,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 N,A;const k=document.body.style.overflow,C=document.activeElement instanceof HTMLElement?document.activeElement:null;document.body.style.overflow="hidden",(N=y.current)==null||N.focus(),(A=y.current)==null||A.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 R=Array.from(T.querySelectorAll('button:not([disabled]), input:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')).filter(M=>M.getClientRects().length>0);if(R.length===0){j.preventDefault();return}const _=R[0],D=R[R.length-1];j.shiftKey&&document.activeElement===_?(j.preventDefault(),D.focus()):!j.shiftKey&&document.activeElement===D&&(j.preventDefault(),_.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 N;k.preventDefault();const C=a.trim(),E=uwt(d);if(!C){m(s("artifactEdit.nameRequired")),(N=y.current)==null||N.focus();return}if(E.length>LL){m(s("artifactEdit.tooManyTags",{max:LL}));return}if(E.some(A=>A.length>fee)){m(s("artifactEdit.tagTooLong",{max:fee}));return}m(""),r({name:C,description:c.trim(),tags:E})},S=h||n;return Jn.createPortal(o.jsx("div",{className:"artifact-edit-backdrop",onMouseDown:k=>{k.target===k.currentTarget&&!t&&i()},children:o.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:[o.jsxs("header",{className:"artifact-edit-dialog__header",children:[o.jsxs("div",{children:[o.jsx("h2",{id:g,children:s("artifactEdit.title")}),o.jsx("p",{id:b,children:s("artifactEdit.subtitle")})]}),o.jsx("button",{type:"button",onClick:i,disabled:t,"aria-label":s("artifactEdit.close"),children:o.jsx(mIe,{})})]}),o.jsxs("form",{onSubmit:O,children:[o.jsxs("div",{className:"artifact-edit-dialog__body",children:[o.jsxs("label",{className:"artifact-edit-field",children:[o.jsx("span",{children:s("artifactEdit.name")}),o.jsx("input",{ref:y,value:a,maxLength:cwt,disabled:t,"aria-invalid":!!S||void 0,onChange:k=>{l(k.target.value),m("")}})]}),o.jsxs("label",{className:"artifact-edit-field",children:[o.jsx("span",{children:s("artifactEdit.description")}),o.jsx("textarea",{value:c,maxLength:dee,disabled:t,rows:4,placeholder:s("artifactEdit.descriptionPlaceholder"),onChange:k=>u(k.target.value)}),o.jsxs("small",{children:[c.length,"/",dee]})]}),o.jsxs("label",{className:"artifact-edit-field",children:[o.jsx("span",{children:s("artifactEdit.tags")}),o.jsx("input",{value:d,disabled:t,placeholder:s("artifactEdit.tagsPlaceholder",{max:LL}),onChange:k=>{f(k.target.value),m("")}})]}),S?o.jsx("div",{className:"artifact-edit-error",role:"alert",children:S}):null]}),o.jsxs("footer",{className:"artifact-edit-dialog__actions",children:[o.jsx("button",{type:"button",onClick:i,disabled:t,children:s("artifactEdit.cancel")}),o.jsx("button",{type:"submit",className:"is-primary",disabled:t,children:s(t?"artifactEdit.saving":"artifactEdit.save")})]})]})]})}),document.body)}function gIe({label:e,menuLabel:t,items:n,placement:i="bottom-end"}){return o.jsxs(Pr,{children:[o.jsx(Pr.Trigger,{children:o.jsx(Dt,{type:"button",color:"secondary",variant:"ghost",size:"md",iconSize:"sm",uniform:!0,"aria-label":e,title:e,disabled:n.length===0,children:o.jsx(mit,{"aria-hidden":"true"})})}),o.jsxs(Pr.Content,{side:i==="top-end"?"top":"bottom",align:"end",minWidth:148,children:[o.jsx("span",{className:"sr-only",children:t}),n.map(r=>o.jsx(Pr.Item,{disabled:r.disabled,onSelect:r.onSelect,children:o.jsx("span",{title:r.title,children:r.label})},r.label))]})]})}const fwt="_Alert_1tr02_1",hwt="_Content_1tr02_145",pwt="_Indicator_1tr02_156",mwt="_Message_1tr02_159",gwt="_Title_1tr02_162",bwt="_Description_1tr02_168",ywt="_Actions_1tr02_173",ib={Alert:fwt,Content:hwt,Indicator:pwt,Message:mwt,Title:gwt,Description:bwt,Actions:ywt},Ty=({color:e="primary",variant:t="outline",title:n,description:i,actions:r,actionsPlacement:s,indicator:a,className:l,actionsClassName:c,ref:u,...d})=>{const f=p.useRef(null),h=p.useRef(null),[m,g]=p.useState("end"),{width:b}=SAe({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]),o.jsxs("div",{ref:LC([u,f]),className:Ci(ib.Alert,l),"data-variant":t,"data-color":e,role:e==="danger"?"alert":void 0,"data-actions-placement":s??m,...d,children:[a===!1?null:o.jsx("div",{className:ib.Indicator,children:a??o.jsx(vwt,{color:e})}),o.jsxs("div",{className:ib.Content,children:[o.jsxs("div",{className:ib.Message,children:[n&&o.jsx("div",{className:ib.Title,children:n}),i&&o.jsx("div",{className:ib.Description,children:i})]}),r&&o.jsx("div",{className:Ci(ib.Actions,c),ref:h,children:r})]})]})},vwt=({color:e})=>{switch(e){case"warning":case"caution":case"danger":return o.jsx(iAe,{});case"success":return o.jsx(Z2e,{});default:return o.jsx(eAe,{})}};function Xu({title:e,description:t,error:n,confirmLabel:i,cancelLabel:r,closeLabel:s,variant:a="warning",busy:l=!1,onCancel:c,onConfirm:u}){const{t:d}=_e("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()}},[]),Jn.createPortal(o.jsx("div",{className:"studio-confirm-backdrop",onMouseDown:x=>{x.target===x.currentTarget&&!l&&c()},children:o.jsxs("section",{className:`studio-confirm-dialog studio-confirm-dialog--${a}`,role:"alertdialog","aria-modal":"true","aria-labelledby":m,"aria-describedby":g,"aria-busy":l||void 0,children:[o.jsxs("header",{className:"studio-confirm-head",children:[o.jsxs("div",{className:"studio-confirm-title-wrap",children:[o.jsx("span",{className:"studio-confirm-title-icon","aria-hidden":"true",children:o.jsx(iAe,{})}),o.jsx("h2",{id:m,children:e})]}),o.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:o.jsx(mQ,{})})]}),o.jsxs("div",{className:"studio-confirm-body",children:[o.jsx("p",{id:g,children:t}),n?o.jsx(Ty,{className:"studio-confirm-error",color:"danger",variant:"soft",description:n}):null]}),o.jsxs("footer",{className:"studio-confirm-actions",children:[o.jsx(Dt,{ref:b,type:"button",color:"secondary",variant:"ghost",size:"lg",pill:!1,onClick:c,disabled:l,children:f}),o.jsx(Dt,{type:"button",className:"studio-confirm-primary",color:a==="danger"?"danger":"primary",size:"lg",pill:!1,loading:l,onClick:u,disabled:l,children:i})]})]})}),document.body)}const xwt="_Container_1a6nz_1",wwt="_Input_1a6nz_229",hee={Container:xwt,Input:wwt},hs=e=>{const t=p.useRef(null),i=`search-ui-input-${p.useId()}`,{id:r,name:s,type:a="text",variant:l="outline",size:c="md",gutterSize:u,className:d,autoComplete:f,disabled:h=!1,readOnly:m=!1,invalid:g=!1,allowAutofillExtensions:b=a==="password"||!!s||!!f&&f!=="off",onFocus:v,onBlur:y,onAnimationStart:x,onAutofill:w,autoSelect:O,startAdornment:S,endAdornment:k,pill:C,opticallyAlign:E,ref:N,...A}=e,j=D=>{const M=t.current;if(!D.target||!(D.target instanceof Element)||!M||M.contains(D.target)||D.target.closest("button, [type='button'], [role='button'], [role='menuitem']"))return;D.preventDefault(),document.activeElement!==M&&M.focus();const{left:P,top:L}=M.getBoundingClientRect(),{clientX:F,clientY:I}=D,z=I{var D;O&&((D=t.current)==null||D.select())},[O]);const _=D=>{x==null||x(D),D.animationName==="native-autofill-in"&&(w==null||w())};return o.jsxs("div",{className:Ci(hee.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,o.jsx("input",{...A,ref:LC([N,t]),id:r||(b?void 0:i),className:hee.Input,type:a,name:s,autoComplete:f,readOnly:m,disabled:h,onFocus:D=>{R(!0),v==null||v(D)},onBlur:D=>{R(!1),y==null||y(D)},onAnimationStart:_,"data-lpignore":b?void 0:!0,"data-1p-ignore":b?void 0:!0}),k]})},Owt="_SelectControl_1tyi7_1",kwt="_Clear_1tyi7_436",Swt="_DropdownIcon_1tyi7_437",Ewt="_TriggerText_1tyi7_468",Cwt="_IndicatorWrapper_1tyi7_476",Twt="_StartIcon_1tyi7_482",Awt="_DropdownIconChevron_1tyi7_534",_wt="_LoadingIndicator_1tyi7_537",Th={SelectControl:Owt,Clear:kwt,DropdownIcon:Swt,TriggerText:Ewt,IndicatorWrapper:Cwt,StartIcon:Twt,DropdownIconChevron:Awt,LoadingIndicator:_wt},jwt=({ref:e,onPointerDown:t,onKeyDown:n,onPointerEnter:i,onInteract:r,invalid:s,disabled:a,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&&!a,C=x&&x!=="none"&&!g,E=k||g||C,N=!g&&!a,A=T=>{var R;switch(T.key){case"ArrowDown":case"ArrowUp":case" ":T.stopPropagation(),T.preventDefault(),r?r():(R=O.current)==null||R.dispatchEvent(new PointerEvent("pointerdown",{bubbles:!0,cancelable:!0,pointerType:"mouse"}));break;case"Enter":break;default:n==null||n(T)}},j=T=>{var R;T.button!==2&&(T.stopPropagation(),r?(T.preventDefault(),r()):(t==null||t(T),(R=w.onClick)==null||R.call(w,T)))};return o.jsxs("span",{ref:LC([O,e]),className:Ci(Th.SelectControl,c),role:"button",tabIndex:a?-1:0,onPointerEnter:T=>{OQ(T),i==null||i(T)},onPointerDown:N?j:void 0,onKeyDown:N?A: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":a?"":void 0,"aria-disabled":a,...w,onClick:void 0,children:[y&&o.jsx(y,{className:Th.StartIcon}),o.jsx("span",{className:Th.TriggerText,children:l}),E&&o.jsxs("div",{className:Th.IndicatorWrapper,children:[k&&o.jsx(Dt,{"aria-label":"Clear current value",className:Th.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:o.jsx(mQ,{})}),g&&o.jsx(jC,{className:Th.LoadingIndicator}),C&&o.jsx(Nwt,{iconType:x})]})]})},Nwt=({iconType:e})=>e==="chevronDown"?o.jsx(uit,{className:Ci(Th.DropdownIcon,Th.DropdownIconChevron)}):o.jsx(git,{className:Th.DropdownIcon}),Rwt="_Menu_n4tw6_3",Iwt="_MenuList_n4tw6_5",Pwt="_MenuInner_n4tw6_50",Dwt="_OptionsList_n4tw6_64",Mwt="_Option_n4tw6_64",Lwt="_PressableInner_n4tw6_111",$wt="_OptionInner_n4tw6_113",Fwt="_OptionCheck_n4tw6_118",Bwt="_OptionIndicatorSlot_n4tw6_123",Uwt="_OptionGroupHeading_n4tw6_128",Qwt="_OptionHardLimitHeading_n4tw6_140",zwt="_OptionsLimit_n4tw6_147",Vwt="_Action_n4tw6_152",Hwt="_ActionInner_n4tw6_218",qwt="_ActionsContainer_n4tw6_224",Wwt="_Search_n4tw6_244",Kwt="_SearchEmpty_n4tw6_247",es={Menu:Rwt,MenuList:Iwt,MenuInner:Pwt,OptionsList:Dwt,Option:Mwt,PressableInner:Lwt,OptionInner:$wt,OptionCheck:Fwt,OptionIndicatorSlot:Bwt,OptionGroupHeading:Uwt,OptionHardLimitHeading:Qwt,OptionsLimit:zwt,Action:Vwt,ActionInner:Hwt,ActionsContainer:qwt,Search:Wwt,SearchEmpty:Kwt},bIe=p.createContext(null),Ig=()=>{const e=p.use(bIe);if(!e)throw new Error("Select components must be wrapped in ");return e},Gwt=({label:e})=>o.jsx(o.Fragment,{children:e}),Xwt=({label:e})=>o.jsx(o.Fragment,{children:e}),Ywt=({values:e,selectedAll:t})=>{const n=t?"All selected":e.length===0?"Select...":e.length===1?e[0].label:`${e.length} selected`;return o.jsx(o.Fragment,{children:n})},Zs=e=>{const{id:t,required:n,value:i,name:r,multiple:s,variant:a="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=Gwt,TriggerStartIcon:C,triggerClassName:E,opticallyAlign:N,TriggerView:A,searchPlaceholder:j="",searchPredicate:T=c1t,searchEmptyMessage:R="No results found.",listMaxWidth:_="auto"}=e,D=e.block??a!=="ghost",M=e.align??(D?"center":"start"),P=e.alignOffset??(M==="center"?0:-5),L=e.listMinWidth??(D?"auto":300),F=dg((ue,Ee)=>{if(s){if(!ue.value){O([]);return}if(Ee){const Y=i.filter(te=>te!==ue.value),G=c8(v,Y);O(G)}else{const Y=c8(v,i);O(Y.concat(ue))}}else O(ue)}),I=p.useRef(T);I.current=T;const z=p.useMemo(()=>y,[y.length]),K=p.useRef(y);K.current=y;const B=p.useCallback(ue=>{var Ee;(Ee=K.current.find(Y=>Y.id===ue))==null||Ee.onSelect(ue)},[]),W=p.useMemo(()=>$z(v)?v.reduce((ue,Ee)=>ue+Ee.options.length,0):v.length,[v]),X=`select-trigger-${p.useId()}`,ie=W>15,Q=p.useMemo(()=>s?{multiple:!0,value:i,TriggerView:A??Ywt}:{multiple:!1,value:i,TriggerView:A??Xwt},[s,i,A]),Z=p.useMemo(()=>({...Q,triggerId:X,id:t,name:r,required:n,options:v,placeholder:h,loadingPlaceholder:m,loading:u,clearable:d,variant:a,pill:g,size:l,dropdownIconType:c,block:D,align:M,alignOffset:P,side:x,avoidCollisions:w,listWidth:b,listMinWidth:L,listMaxWidth:_,searchPlaceholder:j,searchEmptyMessage:R,TriggerStartIcon:C,triggerClassName:E,opticallyAlign:N,optionClassName:S,OptionView:k,actions:z,onActionSelect:B,onSelectRef:F,searchPredicateRef:I,searchable:ie,disabled:f}),[Q,X,t,n,r,v,h,m,u,d,a,g,l,c,D,M,P,x,w,b,L,_,j,R,C,E,N,S,k,z,B,F,ie,f]);return o.jsx(bIe.Provider,{value:Z,children:o.jsx(Jwt,{})})},Zwt=e=>{const{triggerId:t,id:n,required:i,value:r,multiple:s,options:a,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}=Ig(),{onOpenChange:C,...E}=e,N=s?r[0]:r,A=l?v:b,j=p.useMemo(()=>d1t(a,N)||{value:"",label:A},[N,a,A]),T=s?r.length>0:!!r,R=l||!T,_=p.useMemo(()=>kIe(),[]),D=p.useMemo(()=>{if(!s)return{values:[],selectedAll:!1};const L=c8(a,r),F=a.flatMap(I=>"options"in I?I.options:I);return{values:L.length?L:[{value:"",label:A}],selectedAll:F.length<=r.length}},[s,a,r,A]),M=L=>{const F=L.key;if(!s&&SIe(F)){const I=_(F);L.stopPropagation();const z=EIe(a,I,N);z&&k.current(z)}},P=()=>{k.current({value:"",label:""}),C==null||C(!1)};return o.jsxs(jwt,{id:t,className:w,selected:!R,variant:f,pill:h,block:y,size:m,disabled:c,loading:l,StartIcon:O,opticallyAlign:x,dropdownIconType:g,onClearClick:u?P:void 0,onInteract:C,onKeyDown:M,...E,children:[s?o.jsx(S,{...D}):o.jsx(S,{...j}),(d||n)&&o.jsx("input",{id:n,name:d,value:N,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"})]})},Jwt=()=>{const{triggerId:e,loading:t,side:n,align:i,alignOffset:r,avoidCollisions:s,listWidth:a,listMinWidth:l,listMaxWidth:c}=Ig(),[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 MC(u,()=>{h(!1)}),o.jsxs(tje,{open:u,onOpenChange:m=>{t&&m||h(m)},modal:!1,children:[o.jsx(nje,{asChild:!0,children:o.jsx(Zwt,{onOpenChange:h})}),o.jsx(ije,{forceMount:!0,children:o.jsx(Xw,{className:es.Menu,enterDuration:350,exitDuration:200,disableAnimations:!0,children:u&&o.jsx(rje,{ref:f,forceMount:!0,className:es.MenuList,side:n,sideOffset:5,align:i,alignOffset:r,avoidCollisions:s,collisionPadding:{bottom:30,top:30},onOpenAutoFocus:Gh,onCloseAutoFocus:Gh,onEscapeKeyDown:Gh,style:Ky({"select-list-width":a,"select-list-min-width":l,"select-list-max-width":c}),children:o.jsx(e1t,{onOpenChange:h})},"dropdown")})})]})},yIe=p.createContext(null),t1=()=>{const e=p.use(yIe);if(!e)throw new Error("CustomSelectMenu components must be wrapped in ");return e},e1t=({onOpenChange:e})=>{const{multiple:t,value:n,options:i,searchable:r,searchPredicateRef:s}=Ig(),a=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 N;return((t?n[0]:n)||((N=tA(i))==null?void 0:N.value))??""}),g=p.useMemo(()=>kIe(),[]),v=`select-list-${p.useId()}`,y=p.useRef(t?"":n),x=p.useMemo(()=>d.trim().toLocaleLowerCase(),[d]),w=p.useMemo(()=>u1t(i,x,s.current),[i,x,s]),O=p.useMemo(()=>tA(w),[w]),S=p.useRef(!1),k=E=>{const N=E.key,A=t?n[0]:n,j=h||(O==null?void 0:O.value)||A,T=document.activeElement===u.current,R=l.current;if(!R)return;const _=()=>{const P=new PointerEvent("pointerup",{bubbles:!0,cancelable:!0,pointerType:"mouse"}),L=Eh(h,R);L==null||L.dispatchEvent(P)},D=(P,L)=>{m(P),L.scrollIntoView({block:"nearest"})},M=()=>{const P=t?n[0]:n;if(P){const F=Eh(P,R);if(F){D(P,F);return}}const L=tA(i);if(L){const F=Eh(L.value,R);F&&D(L.value,F)}};switch(N){case"ArrowDown":{if(E.preventDefault(),!h||!Eh(h,R)){M();return}const P=f1t(h,R),L=P==null?void 0:P.getAttribute("data-option-id");P&&L&&D(L,P);return}case"ArrowUp":{if(E.preventDefault(),!h||!Eh(h,R)){M();return}const P=h1t(j,R),L=P==null?void 0:P.getAttribute("data-option-id");P&&L&&D(L,P);return}case"Enter":E.preventDefault(),_();return;case" ":if(x&&T)return;E.preventDefault(),_();return}if(SIe(N)){if(T)return;const P=g(N);E.stopPropagation();const L=EIe(i,P,h);if(L){const F=Eh(L.value,R);F&&(m(L.value),F.scrollIntoView({block:"nearest"}))}}},C=p.useMemo(()=>({valueRef:y,listId:v,highlightedValue:h,setHighlightedValue:m,requestCloseRef:a,searchTerm:d,setSearchTerm:f,searchInputRef:u,listRef:c}),[v,h,m,d,f]);return p.useEffect(()=>{PN(()=>{if(!l.current)return;const N=Eh(h,l.current);N==null||N.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=tA(w);E&&m(E.value)},[w]),o.jsx(yIe,{value:C,children:o.jsxs("div",{id:v,className:es.MenuInner,onKeyDown:k,ref:l,tabIndex:0,children:[r&&o.jsx(t1t,{value:d,onChange:f}),o.jsx(n1t,{filteredOptions:w}),o.jsx(a1t,{})]})})},t1t=({value:e,onChange:t})=>{const{searchPlaceholder:n}=Ig(),{listId:i,searchInputRef:r}=t1(),s=a=>{t(a.target.value)};return o.jsx("div",{className:es.Search,children:o.jsx(hs,{startAdornment:o.jsx(Cit,{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})})},KC=e=>"options"in e,$z=e=>e[0]&&KC(e[0]),hx=300,n1t=({filteredOptions:e})=>{const{searchEmptyMessage:t}=Ig(),{listRef:n}=t1();if(!e.length)return typeof t=="string"?o.jsx("p",{className:es.SearchEmpty,"data-text-only":!0,children:t}):o.jsx("div",{className:es.SearchEmpty,children:t});const i=$z(e),r=!i&&e.length>hx,s=i?e.map(a=>o.jsx(r1t,{...a},a.label)):e.slice(0,hx).map(a=>o.jsx(xIe,{...a},a.value));return o.jsxs("div",{className:es.OptionsList,ref:n,children:[s,r&&o.jsx(vIe,{numHidden:e.length-hx})]})},i1t={limit:100,label:"Show all"},r1t=({label:e,options:t,optionsLimit:n=i1t})=>{const i=p.useId(),{searchTerm:r,setHighlightedValue:s}=t1(),[a,l]=p.useState(!1),c=n.limit{l(!0),s(t[n.limit].value)};return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:es.OptionGroupHeading,children:[o.jsx("div",{className:es.OptionIndicatorSlot}),e]}),d.map(h=>o.jsx(xIe,{...h},h.value)),c&&o.jsx(s1t,{value:`group-limit-${i}`,label:n.label,onPointerUp:f}),u&&o.jsx(vIe,{numHidden:t.length-hx})]})},vIe=({numHidden:e})=>o.jsxs("div",{className:es.OptionHardLimitHeading,children:[o.jsx("div",{className:es.OptionIndicatorSlot}),`…and ${e.toLocaleString()} more options. Use search to refine results further.`]}),s1t=({value:e,label:t,onPointerUp:n})=>{const{highlightedValue:i,setHighlightedValue:r}=t1(),s=e===i,a=()=>{s||r(e)},l=()=>{r(c=>c!==e?c:"")};return o.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:a,onPointerLeave:l,children:o.jsxs("div",{className:Ti(es.PressableInner,es.OptionInner),children:[o.jsx("div",{className:es.OptionIndicatorSlot}),t]})})},o1t="data-option-id",xIe=e=>{const{optionClassName:t,OptionView:n,value:i,multiple:r,onSelectRef:s}=Ig(),{valueRef:a,requestCloseRef:l,highlightedValue:c,setHighlightedValue:u}=t1(),{value:d,disabled:f,tooltip:h}=e,m=a.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 o.jsx("div",{className:Ti(es.Option,t),"data-highlight":b?"":void 0,role:"option","aria-selected":b,"data-selected":g?"":void 0,[o1t]: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:o.jsxs("div",{className:es.PressableInner,children:[o.jsxs("div",{className:es.OptionInner,children:[o.jsx("div",{className:es.OptionIndicatorSlot,children:g&&o.jsx(XS,{className:es.OptionCheck})}),o.jsx(n,{...e}),h&&o.jsx(po,{content:h.content,maxWidth:h.maxWidth,side:"right",children:o.jsx(eAe,{})})]}),e.description&&o.jsxs("div",{className:es.OptionInner,children:[o.jsx("div",{className:es.OptionIndicatorSlot}),e.description]})]})})},a1t=()=>{const{actions:e}=Ig();return e.length===0?null:o.jsx("div",{className:es.ActionsContainer,children:e.map(t=>o.jsx(l1t,{...t},t.id))})},l1t=({id:e,label:t,Icon:n,className:i})=>{const{onActionSelect:r}=Ig(),{requestCloseRef:s}=t1(),a=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 o.jsx("div",{className:es.Action,onPointerUp:l,onKeyDown:a,tabIndex:0,children:o.jsxs("div",{className:Ti(es.ActionInner,i),children:[n&&o.jsx(n,{role:"presentation"}),t]})})},c1t=(e,t)=>e.label.toLowerCase().includes(t),u1t=(e,t,n)=>{const i=t.trim().toLocaleLowerCase();if(!i)return e;const r=s=>n(s,i);return $z(e)?e.reduce((s,a)=>{const l=a.options.filter(r);return l.length&&s.push({...a,options:l}),s},[]):e.reduce((s,a)=>(r(a)&&s.push(a),s),[])},tA=e=>{if(!e.length)return;let t;for(const n of e)if(KC(n)){const i=n.options.find(r=>!r.disabled);if(i){t=i;break}}else if(!n.disabled){t=n;break}return t},d1t=(e,t)=>{let n;for(const i of e)if(KC(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},c8=(e,t)=>{let n=[];const i=new Set(t);for(const r of e)if(KC(r)){const s=r.options.filter(a=>i.has(a.value));n=n.concat(s)}else i.has(r.value)&&n.push(r);return n},wIe=40,Eh=(e,t)=>t.querySelector(`[data-option-id="${e}"]`),OIe=e=>e.matches("[data-option-id]:not([data-disabled])"),f1t=(e,t)=>{const n=Eh(e,t);let i=n==null?void 0:n.nextElementSibling,r=0;for(;i&&r{const n=Eh(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)},SIe=e=>/^[a-zA-Z0-9]$/.test(e),EIe=(e,t,n)=>{if(!e.length)return;let i,r,s=!n;const a=({disabled:l,label:c,value:u})=>u===n?(s=!0,!1):!l&&c.toLowerCase().startsWith(t);for(const l of e)if(KC(l)){for(const c of l.options)if(a(c))if(s){r=c;break}else i=i||c}else if(a(l))if(s){r=l;break}else i=i||l;return r||i};function Bo(...e){return e.filter(Boolean).join(" ")}const pee=[["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 p1t(e){let t=2166136261;for(const a of e)t^=a.charCodeAt(0),t=Math.imul(t,16777619);const n=t>>>0,[i,r,s]=pee[n%pee.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 cw({seed:e,className:t}){return o.jsx("span",{className:Bo("resource-card__identity-mark",t),style:p1t(e),"aria-hidden":"true"})}function m1t(e){return o.jsx("svg",{viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",...e,children:o.jsxs("g",{transform:"translate(0.875 0.875)",children:[o.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"}),o.jsx("path",{d:"m11.229 11.229-1.021-1.021",stroke:"currentColor",strokeWidth:"0.984375",strokeLinecap:"round",strokeLinejoin:"round"})]})})}function $f({className:e,...t}){return o.jsx("section",{className:Bo("resource-page",e),...t})}function Jy({title:e,description:t,className:n}){return o.jsxs("header",{className:Bo("resource-page__header",n),children:[o.jsx("h1",{children:e}),t?o.jsx("p",{children:t}):null]})}function g1t({className:e,...t}){return o.jsx("div",{className:Bo("resource-detail",e),...t})}function b1t({className:e,...t}){return o.jsx("header",{className:Bo("resource-detail__header",e),...t})}function y1t({title:e,description:t,identitySeed:n,meta:i,backLabel:r,onBack:s}){const{t:a}=_e("ui"),l=r??a("resourceCollection.back");return o.jsxs("div",{className:"resource-detail__heading",children:[s?o.jsx("button",{type:"button",className:"resource-detail__back",onClick:s,"aria-label":l,title:l,children:o.jsx(Bit,{"aria-hidden":"true"})}):null,o.jsxs("div",{className:"resource-detail__heading-copy",children:[o.jsxs("div",{className:"resource-detail__title-row",children:[o.jsx("span",{className:"resource-detail__identity",children:o.jsx(cw,{seed:n})}),o.jsx("h1",{children:e}),i?o.jsx("div",{className:"resource-detail__meta",children:i}):null]}),t?o.jsx("p",{children:t}):null]})]})}function v1t({className:e,...t}){return o.jsx("div",{className:Bo("resource-detail__actions",e),...t})}function x1t({className:e,...t}){return o.jsx("div",{className:Bo("resource-detail__body",e),...t})}function GC({title:e,description:t,identitySeed:n,meta:i,backLabel:r,onBack:s,actions:a,className:l,actionsClassName:c,bodyClassName:u,sections:d,activeSectionKey:f,navigationLabel:h,onSectionChange:m,children:g}){var w;const{t:b}=_e("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 o.jsxs(g1t,{className:l,children:[o.jsxs(b1t,{children:[o.jsx(y1t,{title:e,description:t,identitySeed:n,meta:i,backLabel:r,onBack:s}),a?o.jsx(v1t,{className:c,children:a}):null]}),o.jsx(x1t,{className:Bo(v&&"is-split",u),children:v?o.jsxs(o.Fragment,{children:[o.jsx("nav",{className:"resource-detail__navigation","aria-label":x,children:d==null?void 0:d.map(O=>o.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:o.jsx("span",{className:"resource-detail__navigation-label",children:O.label})},O.key))}),o.jsx("div",{className:"resource-detail__content",children:y})]}):g})]})}function Fz({className:e,...t}){return o.jsx("dl",{className:Bo("resource-detail__summary",e),...t})}function CIe({title:e,description:t,actions:n,className:i}){return o.jsxs("header",{className:Bo("resource-detail__section-header",i),children:[o.jsxs("div",{children:[o.jsx("h2",{children:e}),t?o.jsx("p",{children:t}):null]}),n]})}function Bz({rows:e,rowKey:t,rowLabel:n,columns:i,searchValue:r,onSearchChange:s,searchPlaceholder:a,searchLabel:l,toolbarActions:c,primaryAction:u,rowActions:d,scrollRef:f,onScroll:h,busy:m,footer:g,emptyLabel:b}){const{t:v}=_e("ui"),y=!!d,x=b??v("resourceCollection.noData");return o.jsxs("div",{className:"resource-data-table",children:[o.jsxs("div",{className:"resource-data-table__toolbar",children:[o.jsx("div",{className:"resource-data-table__search",children:o.jsx(hs,{type:"search",value:r,onChange:w=>s(w.target.value),placeholder:a,"aria-label":l})}),c,u?o.jsx(Dt,{type:"button",color:"primary",disabled:u.disabled,title:u.title,onClick:u.onClick,children:u.label}):null]}),o.jsxs("div",{ref:f,className:"resource-data-table__frame","aria-busy":m||void 0,onScroll:h,children:[o.jsxs("table",{className:"resource-data-table__table",children:[o.jsx("thead",{children:o.jsxs("tr",{children:[i.map(w=>o.jsx("th",{scope:"col",className:w.className,children:w.header},w.key)),y?o.jsx("th",{scope:"col",className:"resource-data-table__actions-heading",children:o.jsx("span",{className:"sr-only",children:v("resourceCollection.actions")})}):null]})}),o.jsx("tbody",{children:e.length===0?o.jsx("tr",{children:o.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 o.jsxs("tr",{children:[i.map(k=>o.jsx("td",{className:k.className,children:k.render(w)},k.key)),d?o.jsx("td",{className:"resource-data-table__actions",children:o.jsx(gIe,{label:v("resourceCollection.moreActions",{label:S}),menuLabel:v("resourceCollection.actionsFor",{label:S}),items:d(w)})}):null]},O)})})]}),g]})]})}function e0({className:e,...t}){return o.jsx("div",{className:Bo("resource-toolbar",e),...t})}function t0({items:e,value:t,onChange:n,ariaLabel:i,idPrefix:r,className:s}){const a=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 o.jsx("nav",{className:Bo("resource-tabs",s),"aria-label":i,role:"tablist",children:e.map(c=>o.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:()=>a(c),onKeyDown:u=>l(u,c),children:c.label},c.id))})}function pp({className:e,...t}){return o.jsxs("label",{className:Bo("resource-search",e),children:[o.jsx(m1t,{}),o.jsx("input",{type:"search",...t})]})}const w1t=150,O1t=200;function mee(e){e.dispatchEvent(new PointerEvent("pointerdown",{bubbles:!0,cancelable:!0,pointerType:"mouse",button:0}))}function fg({id:e,ariaLabel:t,value:n,options:i,onChange:r,className:s,disabled:a=!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"&&mee(y),d.current=!1},[h,m]),b=p.useCallback(()=>{d.current&&(h(),u.current=window.setTimeout(g,O1t))},[h,g]),v=p.useCallback(y=>{var O;if(a||!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,mee(S))},w1t))},[h,f,a,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]),o.jsxs("div",{ref:l,className:Bo("resource-filter-select",s),onMouseEnter:v,onMouseLeave:()=>{f(),b()},children:[o.jsx("label",{className:"sr-only",htmlFor:e,children:t}),o.jsx(Zs,{id:e,value:n,options:i,size:"md",variant:"ghost",pill:!1,block:!1,align:"end",listMinWidth:160,disabled:a,triggerClassName:"resource-filter-select__trigger",onChange:y=>r(y.value)})]})}const Pg=p.forwardRef(function({className:t,...n},i){return o.jsx("section",{ref:i,className:Bo("resource-results",t),...n})});function za(){const{t:e}=_e("ui");return o.jsxs("div",{className:"resource-loading-state",role:"status","aria-live":"polite","aria-busy":"true",children:[o.jsx(jC,{size:16}),o.jsx(bn,{as:"span",duration:2.4,children:e("resourceCollection.loading")})]})}function n0({className:e,...t}){return o.jsx("div",{className:Bo("resource-grid",e),...t})}function Uz({className:e,footer:t,actions:n,activateLabel:i,onActivate:r,children:s,...a}){return o.jsxs("article",{className:Bo("resource-card",r&&"is-interactive",e),...a,children:[r&&i?o.jsx("button",{type:"button",className:"resource-card__target","aria-label":i,title:i,onClick:r}):null,o.jsx("div",{className:"resource-card__content",children:s}),t||n?o.jsxs("footer",{className:"resource-card__footer",children:[t,n?o.jsx("div",{className:"resource-card__actions",children:n}):null]}):null]})}function rj({className:e,iconOnly:t=!1,tone:n="secondary",...i}){return o.jsx("button",{type:"button",className:Bo("resource-card__action",`is-${n}`,t&&"is-icon-only",e),...i})}function u8({label:e,icon:t="arrow",tone:n="primary",className:i,children:r,title:s,...a}){const l=t==="play"?o.jsx(Sit,{}):t==="plus"?o.jsx(nAe,{}):o.jsx(ait,{});return o.jsx(rj,{className:i,iconOnly:!0,tone:n,"aria-label":e,title:s??e,...a,children:r??l})}function Qz({leading:e,title:t,titleText:n,subtitle:i,status:r}){return o.jsxs("div",{className:"resource-card__header",children:[o.jsxs("div",{className:"resource-card__identity",children:[e,o.jsxs("div",{className:"resource-card__title-copy",children:[o.jsx("h3",{title:n,children:t}),i]})]}),r]})}function zz({children:e,title:t}){return o.jsx("p",{className:"resource-card__description",title:t,children:e})}function TIe({items:e,className:t}){return o.jsx("dl",{className:Bo("resource-card__metadata",t),children:e.map((n,i)=>o.jsxs("div",{className:n.className,children:[o.jsx("dt",{className:n.hideLabel?"sr-only":void 0,children:n.label}),o.jsx("dd",{title:n.title,children:n.value})]},`${String(n.label)}:${i}`))})}function hg({className:e,icon:t,children:n,...i}){return o.jsxs("button",{type:"button",className:Bo("resource-create-card",e),...i,children:[o.jsx("span",{className:"resource-create-card__icon","aria-hidden":"true",children:t}),o.jsx("span",{children:n})]})}const k1t=new Set(["avif","bmp","gif","heic","jpeg","jpg","png","svg","tif","tiff","webp"]),S1t=new Set(["avi","m4v","mkv","mov","mp4","mpeg","mpg","webm"]),E1t=new Set(["csv","htm","html","json","md","pdf","svg","txt","xml","yaml","yml"]);function AIe(e){const t=e.lastIndexOf(".");return t<0?"":e.slice(t+1).toLocaleLowerCase()}function eR(e,t){if(!Number.isFinite(e))return t;const n=e;return n>1e10?n:n*1e3}function C1t(e){var t,n;return((t=e.actions)==null?void 0:t.artifactDelta)??((n=e.actions)==null?void 0:n.artifact_delta)}function T1t(e){return`${e.replace(/\.pptx$/i,"")}.preview.webp`}function A1t(e){var t;return(((t=e.content)==null?void 0:t.parts)??[]).map(n=>n.functionResponse??n.function_response).filter(n=>!!n)}function _1t(e){if(!e)return{};const t=e.result;return t&&typeof t=="object"&&!Array.isArray(t)?t:e}function gee(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),a=((i=(r[r.length-1]??"").match(/\.[A-Za-z0-9]{2,8}$/))==null?void 0:i[0])??"";if(a)return`${e}${a}`}catch{}return`${e}.${n==="image"?"png":"mp4"}`}function j1t(e,t){const n=_1t(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",a=[],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://")&&a.push({name:gee(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;a.push({name:gee(u||"generated-video",c,s),url:c,type:s,taskId:u})}return a}function bee(e,t){return new Date(eR(e,t)||Date.now()).toISOString()}function N1t(e,t){var r;const n=[],i=new Set;for(const s of e)for(const a of s.sessions){const l=eR(a.lastUpdateTime,Date.now()),c=yP(a.events,t);for(const u of a.events??[])for(const d of A1t(u)){const f=(d==null?void 0:d.name)??"";for(const h of j1t(f,d==null?void 0:d.response)){const m=`${a.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:a.id,sessionTitle:c,sessionUpdatedAt:bee(a.lastUpdateTime,l),createdAt:bee(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 _Ie(e){const t=AIe(e);return k1t.has(t)?"image":S1t.has(t)?"video":"document"}function R1t(e){const t=_Ie(e);return t==="image"?"image":t==="video"?"video":E1t.has(AIe(e))?"frame":"unavailable"}function I1t(e,t,n="en-US"){var r;const i=[];for(const s of e)for(const a of s.sessions){const l=eR(a.lastUpdateTime,0),c=new Map;for(const u of a.events??[]){const d=C1t(u);if(!d)continue;const f=eR(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(T1t(u.filename)),f=d??u,h=d?"image":R1t(u.filename);i.push({id:`${s.appName}:${a.id}:${u.filename}:${u.version}`,appName:s.appName,agentId:s.agentId,sessionId:a.id,sessionTitle:yP(a.events,t),agentName:((r=s.agentName)==null?void 0:r.trim())||s.appName,sessionUpdatedAt:l,name:u.filename,version:u.version,type:_Ie(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,a)=>a.createdAt-s.createdAt||s.name.localeCompare(a.name,n))}function jIe(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 NIe(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 $L=40;function P1t(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 D1t(e,t){return e(`artifactLibrary.types.${t}`)}function nA(e){return e instanceof Error?e.message:String(e)}function RIe({artifact:e,large:t=!1}){return o.jsx("div",{className:`library-artifact-preview library-artifact-preview--${e.type}${t?" is-large":""}`,children:e.thumbnailUrl?o.jsxs(o.Fragment,{children:[o.jsx("img",{className:"library-artifact-preview-media",src:e.thumbnailUrl,alt:"",loading:"lazy"}),e.type==="video"?o.jsx("span",{className:"artifact-video-play is-overlay","aria-hidden":"true",children:o.jsx(uee,{})}):null]}):e.type==="document"?o.jsxs("div",{className:"artifact-document-sheet","aria-hidden":"true",children:[o.jsx("span",{className:"is-title"}),o.jsx("span",{}),o.jsx("span",{}),o.jsx("span",{className:"is-short"})]}):e.type==="image"?o.jsxs("div",{className:"artifact-image-scene","aria-hidden":"true",children:[o.jsx("span",{className:"artifact-image-sun"}),o.jsx("span",{className:"artifact-image-plane artifact-image-plane--back"}),o.jsx("span",{className:"artifact-image-plane artifact-image-plane--front"})]}):o.jsxs("div",{className:"artifact-video-frame","aria-hidden":"true",children:[o.jsx("span",{className:"artifact-video-orbit"}),o.jsx("span",{className:"artifact-video-node artifact-video-node--one"}),o.jsx("span",{className:"artifact-video-node artifact-video-node--two"}),o.jsx("span",{className:"artifact-video-play",children:o.jsx(uee,{})})]})})}function M1t({artifact:e,pendingAction:t,disabled:n,onPreview:i,onDownload:r,onEdit:s,onDelete:a,onOpenSource:l,t:c,locale:u}){const d=t===`download:${e.id}`;return o.jsxs("tr",{className:"library-artifact-row",children:[o.jsx("td",{className:"library-artifact-file",children:o.jsxs("button",{type:"button",className:"library-artifact-preview-trigger","aria-label":c("artifactLibrary.previewArtifact",{name:e.name}),disabled:n||!!t,onClick:()=>i(e),children:[o.jsx("div",{className:"library-artifact-thumbnail",children:o.jsx(RIe,{artifact:e})}),o.jsxs("div",{className:"library-artifact-row-title",children:[o.jsx("span",{className:"library-artifact-row-name",title:e.name,children:e.name}),o.jsx("span",{className:"library-artifact-row-size",children:NIe(e.sizeBytes)||"—"})]})]})}),o.jsx("td",{className:"library-artifact-source-cell",children:l?o.jsxs("button",{type:"button",className:"library-artifact-source-link",title:`${e.agentName} / ${e.sessionTitle}`,onClick:()=>l(e),children:[o.jsx("span",{children:e.agentName}),o.jsx("span",{"aria-hidden":"true",children:"/"}),o.jsx("span",{children:e.sessionTitle})]}):o.jsxs("span",{title:`${e.agentName} / ${e.sessionTitle}`,children:[e.agentName," / ",e.sessionTitle]})}),o.jsx("td",{className:"library-artifact-time",children:jIe(e.updatedAt??e.createdAt,u,c("artifactLibrary.unknownTime"))}),o.jsx("td",{className:"library-artifact-actions-cell",children:o.jsx("div",{className:"library-artifact-actions",children:o.jsx(gIe,{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}]:[],...a?[{label:c("artifactLibrary.delete"),onSelect:()=>a(e),disabled:n||!!t||e.canManage===!1,danger:!0}]:[]]})})})]})}function L1t({sources:e=[],items:t,userId:n="",active:i=!0,activationRevision:r=0,loading:s=!1,error:a="",onRetry:l,onEdit:c,onDelete:u,onDownload:d,onOpenSource:f,region:h,toolbarLeading:m,toolbarFilters:g}){var it,he;const{t:b,i18n:v}=_e("workspaceTools"),y=v.resolvedLanguage||v.language,[x,w]=p.useState("all"),[O,S]=p.useState(""),[k,C]=p.useState(null),[E,N]=p.useState(""),[A,j]=p.useState(""),[T,R]=p.useState(""),[_,D]=p.useState(""),[M,P]=p.useState({}),[L,F]=p.useState(()=>new Set),[I,z]=p.useState(null),[K,B]=p.useState(!1),[W,H]=p.useState(""),[X,ie]=p.useState(null),[Q,Z]=p.useState(!1),[ue,Ee]=p.useState($L),Y=p.useRef(null),G=p.useRef(null),te=p.useRef(0),de=p.useRef(null),Ce=p.useRef(null),le=p.useRef(!1),fe=p.useCallback(()=>{te.current+=1,C(null),N(""),j("")},[]),re=p.useMemo(()=>t?[...t]:I1t(e,b("library.untitledSession"),y),[t,y,e,b]),Oe=p.useMemo(()=>re.filter(xe=>!L.has(xe.id)).map(xe=>M[xe.id]??xe),[re,M,L]);p.useEffect(()=>()=>{te.current+=1},[]),p.useEffect(()=>()=>{E&&URL.revokeObjectURL(E)},[E]),p.useEffect(()=>{var Me;if(!k)return;const xe=document.activeElement,Ae=document.body.style.overflow;document.body.style.overflow="hidden",(Me=Y.current)==null||Me.focus();const qe=At=>{if(At.key==="Escape"){At.preventDefault(),fe();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=Ae,xe!=null&&xe.isConnected&&xe.focus()}},[fe,k]);const Pe=async xe=>{const Ae=te.current+1;if(te.current=Ae,R(""),N(""),C(xe),xe.preview.mode!=="unavailable"){if(xe.contentUrl){N(xe.contentUrl);return}j(`preview:${xe.id}`);try{const qe=await jU(xe.appName,n,xe.sessionId,xe.preview.filename,xe.preview.version);if(te.current!==Ae){URL.revokeObjectURL(qe);return}N(qe)}catch(qe){te.current===Ae&&R(b("artifactLibrary.previewFailed",{name:xe.name,message:nA(qe)}))}finally{te.current===Ae&&j("")}}},be=async xe=>{R(""),j(`download:${xe.id}`);try{d?await d(xe):await _U(xe.appName,n,xe.sessionId,xe.name,xe.version),D(b("artifactLibrary.downloadStarted",{name:xe.name}))}catch(Ae){R(b("artifactLibrary.downloadFailed",{name:xe.name,message:nA(Ae)}))}finally{j("")}},Qe=async xe=>{if(!(!I||!c)){B(!0),H("");try{const qe=await c(I,xe)??{...I,...xe,updatedAt:Date.now()};P(Me=>({...Me,[I.id]:qe})),D(b("artifactLibrary.updated",{name:qe.name})),z(null)}catch(Ae){H(nA(Ae))}finally{B(!1)}}},ve=async()=>{if(!(!X||!u)){Z(!0),R("");try{await u(X),F(xe=>new Set([...xe,X.id])),D(b("artifactLibrary.deleted",{name:X.name})),(k==null?void 0:k.id)===X.id&&fe(),ie(null)}catch(xe){R(b("artifactLibrary.deleteFailed",{name:X.name,message:nA(xe)})),ie(null)}finally{Z(!1)}}},Ne=p.useMemo(()=>{const xe=O.trim().toLocaleLowerCase();return Oe.filter(Ae=>{var qe;return(qe=Ae.origin)!=null&&qe.region&&Ae.origin.region!==h||x!=="all"&&Ae.type!==x?!1:xe?[Ae.name,Ae.sessionTitle,Ae.agentName].some(Me=>Me.toLocaleLowerCase().includes(xe)):!0})},[x,Oe,O,h]),ne=p.useMemo(()=>Ne.slice(0,ue),[Ne,ue]),ye=ue{le.current||(le.current=!0,Ee(xe=>xe+$L))},[]);p.useEffect(()=>{Ee($L)},[r,x,O,Ne.length]),p.useEffect(()=>{le.current=!1},[ue]),p.useEffect(()=>{const xe=Ce.current,Ae=de.current;if(!i||!xe||!Ae||!ye)return;const qe=new IntersectionObserver(([Me])=>{Me.isIntersecting&&Te()},{root:Ae,rootMargin:"240px 0px",threshold:.01});return qe.observe(xe),()=>qe.disconnect()},[i,ye,Te,ue]);const Se=()=>{const xe=de.current;!i||!xe||!ye||xe.scrollHeight-xe.scrollTop-xe.clientHeight<=240&&Te()},Ke=!!O.trim()||x!=="all"||Oe.some(xe=>{var Ae;return((Ae=xe.origin)==null?void 0:Ae.region)&&xe.origin.region!==h});return o.jsxs("div",{className:"artifact-library-page resource-collection",children:[o.jsxs(e0,{className:"artifact-library-toolbar library-resource-toolbar",children:[m,o.jsxs("div",{className:"resource-toolbar__actions",children:[o.jsx(fg,{id:"artifact-type-filter",ariaLabel:b("artifactLibrary.typeFilter"),value:x,options:P1t(b),onChange:w}),g,o.jsx(pp,{"aria-label":b("artifactLibrary.searchAria"),value:O,onChange:xe=>S(xe.target.value),placeholder:b("artifactLibrary.searchPlaceholder")})]})]}),a&&Oe.length>0?o.jsxs("div",{className:"artifact-library-banner",role:"alert",children:[o.jsx("span",{children:a}),l?o.jsx("button",{type:"button",onClick:l,children:b("artifactLibrary.retry")}):null]}):null,T?o.jsxs("div",{className:"artifact-library-banner",role:"alert",children:[o.jsx("span",{children:T}),o.jsx("button",{type:"button",onClick:()=>R(""),children:b("artifactLibrary.close")})]}):null,o.jsx(Pg,{ref:de,className:"artifact-library-results","aria-label":b("artifactLibrary.listAria"),onScroll:Se,children:o.jsxs("div",{className:"artifact-library-panel",children:[s&&Oe.length===0?o.jsx(za,{}):a&&Oe.length===0?o.jsxs("div",{className:"artifact-library-empty is-error",role:"alert",children:[o.jsx("p",{children:b("artifactLibrary.loadFailed")}),o.jsx("span",{children:a}),l?o.jsx("button",{type:"button",onClick:l,children:b("artifactLibrary.reload")}):null]}):Ne.length===0?o.jsxs("div",{className:"artifact-library-empty",children:[o.jsx("p",{children:b(Ke?"artifactLibrary.noMatch":"artifactLibrary.noArtifacts")}),o.jsx("span",{children:b(Ke?"artifactLibrary.searchHint":"artifactLibrary.emptyHint")})]}):o.jsx("div",{className:"artifact-library-list",children:o.jsxs("table",{className:"artifact-library-table",children:[o.jsxs("colgroup",{children:[o.jsx("col",{className:"artifact-library-table__file-column"}),o.jsx("col",{className:"artifact-library-table__source-column"}),o.jsx("col",{className:"artifact-library-table__time-column"}),o.jsx("col",{className:"artifact-library-table__actions-column"})]}),o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{scope:"col",children:b("artifactLibrary.columns.name")}),o.jsx("th",{scope:"col",children:b("artifactLibrary.columns.source")}),o.jsx("th",{scope:"col",children:b("artifactLibrary.columns.updatedAt")}),o.jsx("th",{scope:"col",className:"artifact-library-table__actions-heading",children:b("artifactLibrary.columns.actions")})]})}),o.jsx("tbody",{children:ne.map(xe=>o.jsx(M1t,{artifact:xe,pendingAction:A,disabled:!n&&!t,onPreview:Ae=>void Pe(Ae),onDownload:Ae=>void be(Ae),onEdit:c?Ae=>{H(""),z(Ae)}:void 0,onDelete:u?ie:void 0,onOpenSource:f,t:b,locale:y},xe.id))})]})}),ye?o.jsx("div",{ref:Ce,className:"artifact-library-load-more",role:"status","aria-live":"polite",children:o.jsx(bn,{as:"span",duration:2.4,children:b("artifactLibrary.loadingMore")})}):null]})}),o.jsx("p",{className:"artifact-library-status","aria-live":"polite",children:_}),k?o.jsxs("div",{className:"artifact-library-preview-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"artifact-library-preview-title",children:[o.jsx("button",{type:"button",className:"artifact-library-preview-backdrop","aria-label":b("artifactLibrary.preview.close"),onClick:fe}),o.jsxs("div",{ref:G,className:"artifact-library-preview-panel",children:[o.jsxs("header",{children:[o.jsxs("div",{children:[o.jsx("h2",{id:"artifact-library-preview-title",children:k.name}),o.jsx("p",{children:b("artifactLibrary.preview.meta",{type:D1t(b,k.type),version:k.version})})]}),o.jsx("button",{ref:Y,type:"button","aria-label":b("artifactLibrary.preview.close"),onClick:fe,children:o.jsx(mIe,{})})]}),o.jsxs("div",{className:"artifact-library-preview-content",children:[o.jsx("div",{className:"artifact-library-preview-canvas",children:A===`preview:${k.id}`?o.jsx(bn,{as:"span",duration:2.4,children:b("artifactLibrary.preview.loading")}):E&&k.preview.mode==="image"?o.jsx("img",{src:E,alt:b("artifactLibrary.preview.alt",{name:k.name})}):E&&k.preview.mode==="video"?o.jsx("video",{src:E,controls:!0,"aria-label":b("artifactLibrary.preview.alt",{name:k.name})}):E&&k.preview.mode==="frame"?o.jsx("iframe",{src:E,title:b("artifactLibrary.preview.alt",{name:k.name})}):o.jsxs("div",{className:"artifact-library-preview-unavailable",children:[o.jsx(RIe,{artifact:k,large:!0}),o.jsx("p",{children:b(T?"artifactLibrary.preview.loadFailed":"artifactLibrary.preview.unsupported")})]})}),o.jsxs("aside",{className:"artifact-library-preview-details","aria-label":b("artifactLibrary.preview.sourceAria"),children:[k.description?o.jsx("p",{className:"artifact-library-preview-description",children:k.description}):null,o.jsxs("dl",{children:[o.jsxs("div",{children:[o.jsx("dt",{children:b("artifactLibrary.preview.agent")}),o.jsx("dd",{title:k.agentName,children:k.agentName})]}),o.jsxs("div",{children:[o.jsx("dt",{children:b("artifactLibrary.preview.session")}),o.jsx("dd",{title:k.sessionTitle,children:k.sessionTitle})]}),(it=k.origin)!=null&&it.toolName?o.jsxs("div",{children:[o.jsx("dt",{children:b("artifactLibrary.preview.tool")}),o.jsx("dd",{children:k.origin.toolName})]}):null,o.jsxs("div",{children:[o.jsx("dt",{children:b("artifactLibrary.preview.createdAt")}),o.jsx("dd",{children:jIe(k.createdAt,y,b("artifactLibrary.unknownTime"))})]}),k.sizeBytes?o.jsxs("div",{children:[o.jsx("dt",{children:b("artifactLibrary.preview.fileSize")}),o.jsx("dd",{children:NIe(k.sizeBytes)})]}):null]}),(he=k.tags)!=null&&he.length?o.jsx("div",{className:"artifact-library-preview-tags","aria-label":b("artifactLibrary.preview.tags"),children:k.tags.map(xe=>o.jsx("span",{children:xe},xe))}):null]})]}),o.jsxs("footer",{children:[o.jsxs("div",{className:"artifact-library-preview-footer-start",children:[f?o.jsxs("button",{type:"button",className:"is-secondary",onClick:()=>{const xe=k;fe(),f(xe)},children:[o.jsx(lwt,{}),b("artifactLibrary.preview.viewSession")]}):null,c?o.jsxs("button",{type:"button",className:"is-secondary",disabled:k.canManage===!1,onClick:()=>{const xe=k;fe(),H(""),z(xe)},children:[o.jsx(JN,{}),b("artifactLibrary.edit")]}):null]}),o.jsxs("button",{type:"button",disabled:A.startsWith("download:")||!n&&!t,onClick:()=>void be(k),children:[o.jsx(awt,{}),b("artifactLibrary.download")]})]})]})]}):null,I?o.jsx(dwt,{artifact:I,busy:K,error:W,onClose:()=>{K||z(null)},onSave:xe=>void Qe(xe)}):null,X?o.jsx(Xu,{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",Sme,!0,!0);mn.hasResourceBundle("zh-CN","workspaceTools")||mn.addResourceBundle("zh-CN","workspaceTools",Cwe,!0,!0);function Dg(e,t={}){return mn.t(e,{...t,ns:"workspaceTools"})}function $1t(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 XC(e,t){if(e.ok)return e;let n;try{n=await e.json()}catch{n=void 0}throw new Error($1t(n,Dg("artifactLibrary.api.withStatus",{message:t,status:e.status})))}function FL(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 IIe(e){const t=e;return{...t,createdAt:FL(t.createdAt),updatedAt:FL(t.updatedAt),sessionUpdatedAt:FL(t.sessionUpdatedAt)}}async function PIe(e){const t=await e.json();return Array.isArray(t.items)?t.items.map(IIe):[]}async function F1t(){const e=await XC(await gn("/web/artifacts"),Dg("artifactLibrary.api.listFailed"));return PIe(e)}async function B1t(e){if(e.length===0)return F1t();const t=await XC(await gn("/web/artifacts/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({candidates:e})},24e4),Dg("artifactLibrary.api.syncFailed"));return PIe(t)}async function U1t(e,t){const n=await XC(await gn(`/web/artifacts/${encodeURIComponent(e.id)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),Dg("artifactLibrary.api.updateFailed"));return IIe(await n.json())}async function Q1t(e){await XC(await gn(`/web/artifacts/${encodeURIComponent(e.id)}`,{method:"DELETE"}),Dg("artifactLibrary.api.deleteFailed"))}async function z1t(e){const n=await(await XC(await gn(`/web/artifacts/${encodeURIComponent(e.id)}/content?download=true`,{},24e4),Dg("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 DIe="KNOWLEDGE_PROVIDER_ASSOCIATION_INVALID";class KP extends Error{constructor(n,i,r={}){super(n);tn(this,"status");tn(this,"errorCode");tn(this,"requestId");tn(this,"diagnostics");tn(this,"detail");tn(this,"payload");tn(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 MIe extends Error{constructor(n){super(n.map(({region:i,error:r})=>`${i}: ${r.message||V("knowledge.loadFailed")}`).join(` `));tn(this,"failures");this.name="KnowledgeRegionAggregateError",this.failures=n}}const V1t=new Set(["ak","apikey","sk","accesskey","accesskeyid","authorization","authkey","clientsecret","cookie","credential","credentials","password","passwd","privatekey","secret","secretaccesskey","secretkey","securitytoken","sessiontoken","setcookie","token"]),H1t=6,yee=50,LIe=4e3;function q1t(e){return e.toLowerCase().replace(/[^a-z0-9]/g,"")}function W1t(e){const t=q1t(e);return V1t.has(t)||t.endsWith("password")||t.endsWith("secret")||t.endsWith("token")||t.endsWith("credential")}function K1t(e){return/<\s*(?:!doctype|html|head|body|script|style)\b/i.test(e)}function rk(e){if(K1t(e))return V("knowledge.htmlHidden");const t=V("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 d8(e,t=0,n=new WeakSet){if(e===null||typeof e=="number"||typeof e=="boolean")return e;if(typeof e=="string")return rk(e).slice(0,LIe);if(typeof e!="object")return;if(t>=H1t)return V("knowledge.depthTruncated");if(n.has(e))return V("knowledge.circularReference");if(n.add(e),Array.isArray(e))return e.slice(0,yee).map(r=>d8(r,t+1,n));const i={};return Object.entries(e).slice(0,yee).forEach(([r,s])=>{i[r]=W1t(r)?V("knowledge.redacted"):d8(s,t+1,n)}),i}function vee(e){if(e===void 0)return"";const t=d8(e);if(typeof t=="string")return t;if(t===void 0)return"";try{return JSON.stringify(t).slice(0,LIe)}catch{return V("knowledge.diagnosticsUnavailable")}}function il(e,t){if(e instanceof MIe)return e.failures.map(({region:a,error:l})=>`${a} ${il(l,t)}`).join(` @@ -562,7 +562,7 @@ ${il(l,t)}`).join(` ]`,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:(_=>{const D=[];return _.forEach(M=>{D.push(M),M.toLowerCase()===M?D.push(M.toUpperCase()):D.push(M.toLowerCase())}),D})(v),built_in:x},S=_=>_.map(D=>D.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"}}]},N={scope:"attr",match:t.concat(i,t.lookahead(":"),t.lookahead(/(?!::)/))},A={relevance:0,begin:/\(/,end:/\)/,keywords:O,contains:[N,a,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:[A]};A.contains.push(j);const T=[N,E,e.C_BLOCK_COMMENT_MODE,g,b,k],R={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:[R,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/},a,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",R,a,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 VAt(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 cDe(e){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function hV(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 HAt(e){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function qAt(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 WAt(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+)*/),a={"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:a},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:a}]},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:a},{match:[/(include|extend)\s+/,r],scope:{2:"title.class"},keywords:a},{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:a},{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 A=[{begin:/^\s*=>/,starts:{end:"$",contains:k}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:a,contains:k}}];return u.unshift(c),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:a,illegal:/\/\*/,contains:[e.SHEBANG({binary:"ruby"})].concat(A).concat(u).concat(k)}}function uDe(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*\(/))},a="([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 KAt=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_-]*/}}),GAt=["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"],XAt=["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"],YAt=[...GAt,...XAt],ZAt=["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(),e_t=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),t_t=["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 dDe(e){const t=KAt(e),n=e_t,i=JAt,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("+YAt.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("+t_t.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:ZAt.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 n_t(e){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function fDe(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"],a=["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(N=>N.match(/\|\d+$/)||k.includes(N)?N:E(N)?`${N}|0`:N)}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(a)},w,y,b,i,r,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,v]}}function hDe(e){return e?typeof e=="string"?e:e.source:null}function gO(e){return Nr("(?=",e,")")}function Nr(...e){return e.map(n=>hDe(n)).join("")}function i_t(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function wl(...e){return"("+(i_t(e).capture?"":"?:")+e.map(i=>hDe(i)).join("|")+")"}const pV=e=>Nr(/\b/,e,/\w$/.test(e)?/\b/:/\B/),r_t=["Protocol","Type"].map(pV),Ete=["init","self"].map(pV),s_t=["Any","Self"],t3=["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"],Cte=["false","nil","true"],o_t=["assignment","associativity","higherThan","left","lowerThan","none","right"],a_t=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],Tte=["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"],pDe=wl(/[/=\-+!*%<>&|^~?]/,/[\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]/),mDe=wl(pDe,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),n3=Nr(pDe,mDe,"*"),gDe=wl(/[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]/),rR=wl(gDe,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),lf=Nr(gDe,rR,"*"),dA=Nr(/[A-Z]/,rR,"*"),l_t=["attached","autoclosure",Nr(/convention\(/,wl("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",Nr(/objc\(/,lf,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],c_t=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function u_t(e){const t={match:/\s+/,relevance:0},n=e.COMMENT("/\\*","\\*/",{contains:["self"]}),i=[e.C_LINE_COMMENT_MODE,n],r={match:[/\./,wl(...r_t,...Ete)],className:{2:"keyword"}},s={match:Nr(/\./,wl(...t3)),relevance:0},a=t3.filter(Ce=>typeof Ce=="string").concat(["_|0"]),l=t3.filter(Ce=>typeof Ce!="string").concat(s_t).map(pV),c={variants:[{className:"keyword",match:wl(...l,...Ete)}]},u={$pattern:wl(/\b\w+/,/#\w+/),keyword:a.concat(a_t),literal:Cte},d=[r,s,c],f={match:Nr(/\./,wl(...Tte)),relevance:0},h={className:"built_in",match:Nr(/\b/,wl(...Tte),/(?=\()/)},m=[f,h],g={match:/->/,relevance:0},b={className:"operator",relevance:0,variants:[{match:n3},{match:`\\.(\\.|${mDe})+`}]},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=(Ce="")=>({className:"subst",variants:[{match:Nr(/\\/,Ce,/[0\\tnr"']/)},{match:Nr(/\\/,Ce,/u\{[0-9a-fA-F]{1,8}\}/)}]}),S=(Ce="")=>({className:"subst",match:Nr(/\\/,Ce,/[\t ]*(?:[\r\n]|\r\n)/)}),k=(Ce="")=>({className:"subst",label:"interpol",begin:Nr(/\\/,Ce,/\(/),end:/\)/}),C=(Ce="")=>({begin:Nr(Ce,/"""/),end:Nr(/"""/,Ce),contains:[O(Ce),S(Ce),k(Ce)]}),E=(Ce="")=>({begin:Nr(Ce,/"/),end:Nr(/"/,Ce),contains:[O(Ce),k(Ce)]}),N={className:"string",variants:[C(),C("#"),C("##"),C("###"),E(),E("#"),E("##"),E("###")]},A=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],j={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:A},T=Ce=>{const le=Nr(Ce,/\//),fe=Nr(/\//,Ce);return{begin:le,end:fe,contains:[...A,{scope:"comment",begin:`#(?!.*${fe})`,end:/$/}]}},R={scope:"regexp",variants:[T("###"),T("##"),T("#"),j]},_={match:Nr(/`/,lf,/`/)},D={className:"variable",match:/\$\d+/},M={className:"variable",match:`\\$${rR}+`},P=[_,D,M],L={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:c_t,contains:[...v,w,N]}]}},F={scope:"keyword",match:Nr(/@/,wl(...l_t),gO(wl(/\(/,/\s+/)))},I={scope:"meta",match:Nr(/@/,lf)},z=[L,F,I],K={match:gO(/\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)/,rR,"+")},{className:"type",match:dA,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:Nr(/\s+&\s+/,gO(dA)),relevance:0}]},B={begin://,keywords:u,contains:[...i,...d,...z,g,K]};K.contains.push(B);const W={match:Nr(lf,/\s*:/),keywords:"_|0",relevance:0},H={begin:/\(/,end:/\)/,relevance:0,keywords:u,contains:["self",W,...i,R,...d,...m,...v,w,N,...P,...z,K]},X={begin://,keywords:"repeat each",contains:[...i,K]},ie={begin:wl(gO(Nr(lf,/\s*:/)),gO(Nr(lf,/\s+/,lf,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:lf}]},Q={begin:/\(/,end:/\)/,keywords:u,contains:[ie,...i,...d,...v,w,N,...z,K,H],endsParent:!0,illegal:/["']/},Z={match:[/(func|macro)/,/\s+/,wl(_.match,lf,n3)],className:{1:"keyword",3:"title.function"},contains:[X,Q,t],illegal:[/\[/,/%/]},ue={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[X,Q,t],illegal:/\[|%/},Ee={match:[/operator/,/\s+/,n3],className:{1:"keyword",3:"title"}},Y={begin:[/precedencegroup/,/\s+/,dA],className:{1:"keyword",3:"title"},contains:[K],keywords:[...o_t,...Cte],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"}},de={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,lf,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:u,contains:[X,...d,{begin:/:/,end:/\{/,keywords:u,contains:[{scope:"title.class.inherited",match:dA},...d],relevance:0}]};for(const Ce of N.variants){const le=Ce.contains.find(re=>re.label==="interpol");le.keywords=u;const fe=[...d,...m,...v,w,N,...P];le.contains=[...fe,{begin:/\(/,end:/\)/,contains:["self",...fe]}]}return{name:"Swift",keywords:u,contains:[...i,Z,ue,G,te,de,Ee,Y,{beginKeywords:"import",end:/$/,contains:[...i],relevance:0},R,...d,...m,...v,w,N,...P,...z,K,H]}}const sR="[A-Za-z$_][0-9A-Za-z$_]*",bDe=["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"],yDe=["true","false","null","undefined","NaN","Infinity"],vDe=["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"],xDe=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],wDe=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],ODe=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],kDe=[].concat(wDe,vDe,xDe);function d_t(e){const t=e.regex,n=(L,{after:F})=>{const I="",end:""},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,a={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(L,F)=>{const I=L[0].length+L.index,z=L.input[I];if(z==="<"||z===","){F.ignoreMatch();return}z===">"&&(n(L,{after:I})||F.ignoreMatch());let K;const B=L.input.substring(I);if(K=B.match(/^\s*=/)){F.ignoreMatch();return}if((K=B.match(/^\s+extends\s+/))&&K.index===0){F.ignoreMatch();return}}},l={$pattern:sR,keyword:bDe,literal:yDe,built_in:kDe,"variable.language":ODe},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:{_:[...vDe,...xDe]}},N={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},A={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 R={match:t.concat(/\b/,T([...wDe,"super","import"].map(L=>`${L}\\s*\\(`)),i,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},_={begin:t.concat(/\./,t.lookahead(t.concat(i,/(?![0-9A-Za-z$_(])/))),end:i,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},D={match:[/get|set/,/\s+/,i,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},k]},M="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",P={match:[/const|var|let/,/\s+/,i,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(M)],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}),N,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},P,{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:M,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:a.begin,"on:begin":a.isTrulyOpeningTag,end:a.end}],subLanguage:"xml",contains:[{begin:a.begin,end:a.end,skip:!0,contains:["self"]}]}]},A,{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},_,{match:"\\$"+i,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[k]},R,j,C,D,{match:/\$[(.]/}]}}function mV(e){const t=e.regex,n=d_t(e),i=sR,r=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],s={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},a={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:sR,keyword:bDe.concat(c),literal:yDe,built_in:kDe.concat(r),"variable.language":ODe},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,a,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 f_t(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}/,a=/(\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(/# */,a,/ *#/)},{begin:t.concat(/# */,t.either(s,r),/ +/,t.either(a,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 h_t(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_]+/},a={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,a,r,e.QUOTE_STRING_MODE,c,u,l]}}function SDe(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/}]},a=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,a,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin://,contains:[s,a,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 gV(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}]},a={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,r]},l=e.inherit(a,{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,a],y=[...v];return y.pop(),y.push(l),m.contains=y,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:v}}const p_t={arduino:hAt,bash:nD,c:pAt,cpp:mAt,csharp:gAt,css:JPe,diff:eDe,go:tDe,graphql:EAt,ini:lV,java:iDe,javascript:cV,json:uV,kotlin:NAt,less:FAt,lua:BAt,makefile:dV,markdown:fV,objectivec:UAt,perl:QAt,php:zAt,"php-template":VAt,plaintext:cDe,python:hV,"python-repl":HAt,r:qAt,ruby:WAt,rust:uDe,scss:dDe,shell:n_t,sql:fDe,swift:u_t,typescript:mV,vbnet:f_t,wasm:h_t,xml:SDe,yaml:gV};function EDe(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)&&EDe(n)}),e}let Ate=class{constructor(t){t.data===void 0&&(t.data={}),this.data=t.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function CDe(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function Am(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 m_t="",_te=e=>!!e.scope,g_t=(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 b_t{constructor(t,n){this.buffer="",this.classPrefix=n.classPrefix,t.walk(this)}addText(t){this.buffer+=CDe(t)}openNode(t){if(!_te(t))return;const n=g_t(t.scope,{prefix:this.classPrefix});this.span(n)}closeNode(t){_te(t)&&(this.buffer+=m_t)}value(){return this.buffer}span(t){this.buffer+=``}}const jte=(e={})=>{const t={children:[]};return Object.assign(t,e),t};class bV{constructor(){this.rootNode=jte(),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=jte({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=>{bV._collapse(n)}))}}class y_t extends bV{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 b_t(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function xE(e){return e?typeof e=="string"?e:e.source:null}function TDe(e){return a0("(?=",e,")")}function v_t(e){return a0("(?:",e,")*")}function x_t(e){return a0("(?:",e,")?")}function a0(...e){return e.map(n=>xE(n)).join("")}function w_t(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function yV(...e){return"("+(w_t(e).capture?"":"?:")+e.map(i=>xE(i)).join("|")+")"}function ADe(e){return new RegExp(e.toString()+"|").exec("").length-1}function O_t(e,t){const n=e&&e.exec(t);return n&&n.index===0}const k_t=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function vV(e,{joinWith:t}){let n=0;return e.map(i=>{n+=1;const r=n;let s=xE(i),a="";for(;s.length>0;){const l=k_t.exec(s);if(!l){a+=s;break}a+=s.substring(0,l.index),s=s.substring(l.index+l[0].length),l[0][0]==="\\"&&l[1]?a+="\\"+String(Number(l[1])+r):(a+=l[0],l[0]==="("&&n++)}return a}).map(i=>`(${i})`).join(t)}const S_t=/\b\B/,_De="[a-zA-Z]\\w*",xV="[a-zA-Z_]\\w*",jDe="\\b\\d+(\\.\\d+)?",NDe="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",RDe="\\b(0b[01]+)",E_t="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",C_t=(e={})=>{const t=/^#![ ]*\//;return e.binary&&(e.begin=a0(t,/.*\b/,e.binary,/\b.*/)),Am({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(n,i)=>{n.index!==0&&i.ignoreMatch()}},e)},wE={begin:"\\\\[\\s\\S]",relevance:0},T_t={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[wE]},A_t={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[wE]},__t={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/},iD=function(e,t,n={}){const i=Am({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=yV("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:a0(/[ ]+/,"(",r,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),i},j_t=iD("//","$"),N_t=iD("/\\*","\\*/"),R_t=iD("#","$"),I_t={scope:"number",begin:jDe,relevance:0},P_t={scope:"number",begin:NDe,relevance:0},D_t={scope:"number",begin:RDe,relevance:0},M_t={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[wE,{begin:/\[/,end:/\]/,relevance:0,contains:[wE]}]},L_t={scope:"title",begin:_De,relevance:0},$_t={scope:"title",begin:xV,relevance:0},F_t={begin:"\\.\\s*"+xV,relevance:0},B_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 fA=Object.freeze({__proto__:null,APOS_STRING_MODE:T_t,BACKSLASH_ESCAPE:wE,BINARY_NUMBER_MODE:D_t,BINARY_NUMBER_RE:RDe,COMMENT:iD,C_BLOCK_COMMENT_MODE:N_t,C_LINE_COMMENT_MODE:j_t,C_NUMBER_MODE:P_t,C_NUMBER_RE:NDe,END_SAME_AS_BEGIN:B_t,HASH_COMMENT_MODE:R_t,IDENT_RE:_De,MATCH_NOTHING_RE:S_t,METHOD_GUARD:F_t,NUMBER_MODE:I_t,NUMBER_RE:jDe,PHRASAL_WORDS_MODE:__t,QUOTE_STRING_MODE:A_t,REGEXP_MODE:M_t,RE_STARTERS_RE:E_t,SHEBANG:C_t,TITLE_MODE:L_t,UNDERSCORE_IDENT_RE:xV,UNDERSCORE_TITLE_MODE:$_t});function U_t(e,t){e.input[e.index-1]==="."&&t.ignoreMatch()}function Q_t(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function z_t(e,t){t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=U_t,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function V_t(e,t){Array.isArray(e.illegal)&&(e.illegal=yV(...e.illegal))}function H_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 q_t(e,t){e.relevance===void 0&&(e.relevance=1)}const W_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=a0(n.beforeMatch,TDe(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},K_t=["of","and","for","in","not","or","if","then","parent","list","value"],G_t="keyword";function IDe(e,t,n=G_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,IDe(e[s],t,s))}),i;function r(s,a){t&&(a=a.map(l=>l.toLowerCase())),a.forEach(function(l){const c=l.split("|");i[c[0]]=[s,X_t(c[0],c[1])]})}}function X_t(e,t){return t?Number(t):Y_t(e)?0:1}function Y_t(e){return K_t.includes(e.toLowerCase())}const Nte={},ry=e=>{console.error(e)},Rte=(e,...t)=>{console.log(`WARN: ${e}`,...t)},H0=(e,t)=>{Nte[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),Nte[`${e}/${t}`]=!0)},oR=new Error;function PDe(e,t,{key:n}){let i=0;const r=e[n],s={},a={};for(let l=1;l<=t.length;l++)a[l+i]=r[l],s[l+i]=!0,i+=ADe(t[l-1]);e[n]=a,e[n]._emit=s,e[n]._multi=!0}function Z_t(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw ry("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),oR;if(typeof e.beginScope!="object"||e.beginScope===null)throw ry("beginScope must be object"),oR;PDe(e,e.begin,{key:"beginScope"}),e.begin=vV(e.begin,{joinWith:""})}}function J_t(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw ry("skip, excludeEnd, returnEnd not compatible with endScope: {}"),oR;if(typeof e.endScope!="object"||e.endScope===null)throw ry("endScope must be object"),oR;PDe(e,e.end,{key:"endScope"}),e.end=vV(e.end,{joinWith:""})}}function ejt(e){e.scope&&typeof e.scope=="object"&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function tjt(e){ejt(e),typeof e.beginScope=="string"&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope=="string"&&(e.endScope={_wrap:e.endScope}),Z_t(e),J_t(e)}function njt(e){function t(a,l){return new RegExp(xE(a),"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+=ADe(l)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const l=this.regexes.map(c=>c[1]);this.matcherRe=t(vV(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(a){const l=new i;return a.contains.forEach(c=>l.addRule(c.begin,{rule:c,type:"begin"})),a.terminatorEnd&&l.addRule(a.terminatorEnd,{type:"end"}),a.illegal&&l.addRule(a.illegal,{type:"illegal"}),l}function s(a,l){const c=a;if(a.isCompiled)return c;[Q_t,H_t,tjt,W_t].forEach(d=>d(a,l)),e.compilerExtensions.forEach(d=>d(a,l)),a.__beforeBegin=null,[z_t,V_t,q_t].forEach(d=>d(a,l)),a.isCompiled=!0;let u=null;return typeof a.keywords=="object"&&a.keywords.$pattern&&(a.keywords=Object.assign({},a.keywords),u=a.keywords.$pattern,delete a.keywords.$pattern),u=u||/\w+/,a.keywords&&(a.keywords=IDe(a.keywords,e.case_insensitive)),c.keywordPatternRe=t(u,!0),l&&(a.begin||(a.begin=/\B|\b/),c.beginRe=t(c.begin),!a.end&&!a.endsWithParent&&(a.end=/\B|\b/),a.end&&(c.endRe=t(c.end)),c.terminatorEnd=xE(c.end)||"",a.endsWithParent&&l.terminatorEnd&&(c.terminatorEnd+=(a.end?"|":"")+l.terminatorEnd)),a.illegal&&(c.illegalRe=t(a.illegal)),a.contains||(a.contains=[]),a.contains=[].concat(...a.contains.map(function(d){return ijt(d==="self"?a:d)})),a.contains.forEach(function(d){s(d,c)}),a.starts&&s(a.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=Am(e.classNameAliases||{}),s(e)}function DDe(e){return e?e.endsWithParent||DDe(e.starts):!1}function ijt(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return Am(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:DDe(e)?Am(e,{starts:e.starts?Am(e.starts):null}):Object.isFrozen(e)?Am(e):e}var rjt="11.11.1";class sjt extends Error{constructor(t,n){super(t),this.name="HTMLInjectionError",this.html=n}}const i3=CDe,Ite=Am,Pte=Symbol("nomatch"),ojt=7,MDe=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?",a={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:y_t};function c(M){return l.noHighlightRe.test(M)}function u(M){let P=M.className+" ";P+=M.parentNode?M.parentNode.className:"";const L=l.languageDetectRe.exec(P);if(L){const F=E(L[1]);return F||(Rte(s.replace("{}",L[1])),Rte("Falling back to no-highlight mode for this block.",M)),F?L[1]:"no-highlight"}return P.split(/\s+/).find(F=>c(F)||E(F))}function d(M,P,L){let F="",I="";typeof P=="object"?(F=M,L=P.ignoreIllegals,I=P.language):(H0("10.7.0","highlight(lang, code, ...args) has been deprecated."),H0("10.7.0",`Please use highlight(code, options) instead. https://github.com/highlightjs/highlight.js/issues/2277`),I=M,F=P),L===void 0&&(L=!0);const z={code:F,language:I};_("before:highlight",z);const K=z.result?z.result:f(z.language,z.code,L);return K.code=z.code,_("after:highlight",K),K}function f(M,P,L,F){const I=Object.create(null);function z(ne,ye){return ne.keywords[ye]}function K(){if(!fe.keywords){Oe.addText(Pe);return}let ne=0;fe.keywordPatternRe.lastIndex=0;let ye=fe.keywordPatternRe.exec(Pe),Te="";for(;ye;){Te+=Pe.substring(ne,ye.index);const Se=de.case_insensitive?ye[0].toLowerCase():ye[0],Ke=z(fe,Se);if(Ke){const[it,he]=Ke;if(Oe.addText(Te),Te="",I[Se]=(I[Se]||0)+1,I[Se]<=ojt&&(be+=he),it.startsWith("_"))Te+=ye[0];else{const xe=de.classNameAliases[it]||it;H(ye[0],xe)}}else Te+=ye[0];ne=fe.keywordPatternRe.lastIndex,ye=fe.keywordPatternRe.exec(Pe)}Te+=Pe.substring(ne),Oe.addText(Te)}function B(){if(Pe==="")return;let ne=null;if(typeof fe.subLanguage=="string"){if(!t[fe.subLanguage]){Oe.addText(Pe);return}ne=f(fe.subLanguage,Pe,!0,re[fe.subLanguage]),re[fe.subLanguage]=ne._top}else ne=m(Pe,fe.subLanguage.length?fe.subLanguage:null);fe.relevance>0&&(be+=ne.relevance),Oe.__addSublanguage(ne._emitter,ne.language)}function W(){fe.subLanguage!=null?B():K(),Pe=""}function H(ne,ye){ne!==""&&(Oe.startScope(ye),Oe.addText(ne),Oe.endScope())}function X(ne,ye){let Te=1;const Se=ye.length-1;for(;Te<=Se;){if(!ne._emit[Te]){Te++;continue}const Ke=de.classNameAliases[ne[Te]]||ne[Te],it=ye[Te];Ke?H(it,Ke):(Pe=it,K(),Pe=""),Te++}}function ie(ne,ye){return ne.scope&&typeof ne.scope=="string"&&Oe.openNode(de.classNameAliases[ne.scope]||ne.scope),ne.beginScope&&(ne.beginScope._wrap?(H(Pe,de.classNameAliases[ne.beginScope._wrap]||ne.beginScope._wrap),Pe=""):ne.beginScope._multi&&(X(ne.beginScope,ye),Pe="")),fe=Object.create(ne,{parent:{value:fe}}),fe}function Q(ne,ye,Te){let Se=O_t(ne.endRe,Te);if(Se){if(ne["on:end"]){const Ke=new Ate(ne);ne["on:end"](ye,Ke),Ke.isMatchIgnored&&(Se=!1)}if(Se){for(;ne.endsParent&&ne.parent;)ne=ne.parent;return ne}}if(ne.endsWithParent)return Q(ne.parent,ye,Te)}function Z(ne){return fe.matcher.regexIndex===0?(Pe+=ne[0],1):(Ne=!0,0)}function ue(ne){const ye=ne[0],Te=ne.rule,Se=new Ate(Te),Ke=[Te.__beforeBegin,Te["on:begin"]];for(const it of Ke)if(it&&(it(ne,Se),Se.isMatchIgnored))return Z(ye);return Te.skip?Pe+=ye:(Te.excludeBegin&&(Pe+=ye),W(),!Te.returnBegin&&!Te.excludeBegin&&(Pe=ye)),ie(Te,ne),Te.returnBegin?0:ye.length}function Ee(ne){const ye=ne[0],Te=P.substring(ne.index),Se=Q(fe,ne,Te);if(!Se)return Pte;const Ke=fe;fe.endScope&&fe.endScope._wrap?(W(),H(ye,fe.endScope._wrap)):fe.endScope&&fe.endScope._multi?(W(),X(fe.endScope,ne)):Ke.skip?Pe+=ye:(Ke.returnEnd||Ke.excludeEnd||(Pe+=ye),W(),Ke.excludeEnd&&(Pe=ye));do fe.scope&&Oe.closeNode(),!fe.skip&&!fe.subLanguage&&(be+=fe.relevance),fe=fe.parent;while(fe!==Se.parent);return Se.starts&&ie(Se.starts,ne),Ke.returnEnd?0:ye.length}function Y(){const ne=[];for(let ye=fe;ye!==de;ye=ye.parent)ye.scope&&ne.unshift(ye.scope);ne.forEach(ye=>Oe.openNode(ye))}let G={};function te(ne,ye){const Te=ye&&ye[0];if(Pe+=ne,Te==null)return W(),0;if(G.type==="begin"&&ye.type==="end"&&G.index===ye.index&&Te===""){if(Pe+=P.slice(ye.index,ye.index+1),!r){const Se=new Error(`0 width match regex (${M})`);throw Se.languageName=M,Se.badRule=G.rule,Se}return 1}if(G=ye,ye.type==="begin")return ue(ye);if(ye.type==="illegal"&&!L){const Se=new Error('Illegal lexeme "'+Te+'" for mode "'+(fe.scope||"")+'"');throw Se.mode=fe,Se}else if(ye.type==="end"){const Se=Ee(ye);if(Se!==Pte)return Se}if(ye.type==="illegal"&&Te==="")return Pe+=` `,1;if(ve>1e5&&ve>ye.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Pe+=Te,Te.length}const de=E(M);if(!de)throw ry(s.replace("{}",M)),new Error('Unknown language: "'+M+'"');const Ce=njt(de);let le="",fe=F||Ce;const re={},Oe=new l.__emitter(l);Y();let Pe="",be=0,Qe=0,ve=0,Ne=!1;try{if(de.__emitTokens)de.__emitTokens(P,Oe);else{for(fe.matcher.considerAll();;){ve++,Ne?Ne=!1:fe.matcher.considerAll(),fe.matcher.lastIndex=Qe;const ne=fe.matcher.exec(P);if(!ne)break;const ye=P.substring(Qe,ne.index),Te=te(ye,ne);Qe=ne.index+Te}te(P.substring(Qe))}return Oe.finalize(),le=Oe.toHTML(),{language:M,value:le,relevance:be,illegal:!1,_emitter:Oe,_top:fe}}catch(ne){if(ne.message&&ne.message.includes("Illegal"))return{language:M,value:i3(P),illegal:!0,relevance:0,_illegalBy:{message:ne.message,index:Qe,context:P.slice(Qe-100,Qe+100),mode:ne.mode,resultSoFar:le},_emitter:Oe};if(r)return{language:M,value:i3(P),illegal:!1,relevance:0,errorRaised:ne,_emitter:Oe,_top:fe};throw ne}}function h(M){const P={value:i3(M),illegal:!1,relevance:0,_top:a,_emitter:new l.__emitter(l)};return P._emitter.addText(M),P}function m(M,P){P=P||l.languages||Object.keys(t);const L=h(M),F=P.filter(E).filter(A).map(W=>f(W,M,!1));F.unshift(L);const I=F.sort((W,H)=>{if(W.relevance!==H.relevance)return H.relevance-W.relevance;if(W.language&&H.language){if(E(W.language).supersetOf===H.language)return 1;if(E(H.language).supersetOf===W.language)return-1}return 0}),[z,K]=I,B=z;return B.secondBest=K,B}function g(M,P,L){const F=P&&n[P]||L;M.classList.add("hljs"),M.classList.add(`language-${F}`)}function b(M){let P=null;const L=u(M);if(c(L))return;if(_("before:highlightElement",{el:M,language:L}),M.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",M);return}if(M.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(M)),l.throwUnescapedHTML))throw new sjt("One of your code blocks includes unescaped HTML.",M.innerHTML);P=M;const F=P.textContent,I=L?d(F,{language:L,ignoreIllegals:!0}):m(F);M.innerHTML=I.value,M.dataset.highlighted="yes",g(M,L,I.language),M.result={language:I.language,re:I.relevance,relevance:I.relevance},I.secondBest&&(M.secondBest={language:I.secondBest.language,relevance:I.secondBest.relevance}),_("after:highlightElement",{el:M,result:I,text:F})}function v(M){l=Ite(l,M)}const y=()=>{O(),H0("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function x(){O(),H0("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let w=!1;function O(){function M(){O()}if(document.readyState==="loading"){w||window.addEventListener("DOMContentLoaded",M,!1),w=!0;return}document.querySelectorAll(l.cssSelector).forEach(b)}function S(M,P){let L=null;try{L=P(e)}catch(F){if(ry("Language definition for '{}' could not be registered.".replace("{}",M)),r)ry(F);else throw F;L=a}L.name||(L.name=M),t[M]=L,L.rawDefinition=P.bind(null,e),L.aliases&&N(L.aliases,{languageName:M})}function k(M){delete t[M];for(const P of Object.keys(n))n[P]===M&&delete n[P]}function C(){return Object.keys(t)}function E(M){return M=(M||"").toLowerCase(),t[M]||t[n[M]]}function N(M,{languageName:P}){typeof M=="string"&&(M=[M]),M.forEach(L=>{n[L.toLowerCase()]=P})}function A(M){const P=E(M);return P&&!P.disableAutodetect}function j(M){M["before:highlightBlock"]&&!M["before:highlightElement"]&&(M["before:highlightElement"]=P=>{M["before:highlightBlock"](Object.assign({block:P.el},P))}),M["after:highlightBlock"]&&!M["after:highlightElement"]&&(M["after:highlightElement"]=P=>{M["after:highlightBlock"](Object.assign({block:P.el},P))})}function T(M){j(M),i.push(M)}function R(M){const P=i.indexOf(M);P!==-1&&i.splice(P,1)}function _(M,P){const L=M;i.forEach(function(F){F[L]&&F[L](P)})}function D(M){return H0("10.7.0","highlightBlock will be removed entirely in v12.0"),H0("10.7.0","Please use highlightElement now."),b(M)}Object.assign(e,{highlight:d,highlightAuto:m,highlightAll:O,highlightElement:b,highlightBlock:D,configure:v,initHighlighting:y,initHighlightingOnLoad:x,registerLanguage:S,unregisterLanguage:k,listLanguages:C,getLanguage:E,registerAliases:N,autoDetection:A,inherit:Ite,addPlugin:T,removePlugin:R}),e.debugMode=function(){r=!1},e.safeMode=function(){r=!0},e.versionString=rjt,e.regex={concat:a0,lookahead:TDe,either:yV,optional:x_t,anyNumberOfTimes:v_t};for(const M in fA)typeof fA[M]=="object"&&EDe(fA[M]);return Object.assign(e,fA),e},fw=MDe({});fw.newInstance=()=>MDe({});var ajt=fw;fw.HighlightJS=fw;fw.default=fw;const Ba=Aw(ajt),Dte={},ljt="hljs-";function cjt(e){const t=Ba.newInstance();return e&&s(e),{highlight:n,highlightAuto:i,listLanguages:r,register:s,registerAlias:a,registered:l};function n(c,u,d){const f=d||Dte,h=typeof f.prefix=="string"?f.prefix:ljt;if(!t.getLanguage(c))throw new Error("Unknown language: `"+c+"` is not registered");t.configure({__emitter:ujt,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||Dte).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 a(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 ujt{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(a,l){return l?a+"_".repeat(l):n.options.classPrefix+a}),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 djt={};function Mte(e){const t=e||djt,n=t.aliases,i=t.detect||!1,r=t.languages||p_t,s=t.plainText,a=t.prefix,l=t.subset;let c="hljs";const u=cjt(r);if(n&&u.registerAlias(n),a){const d=a.indexOf("-");c=d===-1?a:a.slice(0,d)}return function(d,f){nT(d,"element",function(h,m,g){if(h.tagName!=="code"||!g||g.type!=="element"||g.tagName!=="pre")return;const b=fjt(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=sAt(h,{whitespace:"pre"});let y;try{y=b?u.highlight(b,v,{prefix:a}):u.highlightAuto(v,{prefix:a,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 fjt(e){const t=e.properties.className;let n=-1;if(!Array.isArray(t))return;let i;for(;++n-1&&s<=t.length){let a=0;for(;;){let l=n[a];if(l===void 0){const c=Fte(t,n[a-1]);l=c===-1?t.length+1:c+1,n[a]=l}if(l>s)return{line:a+1,column:s-(a>0?n[a-1]:0)+1,offset:s};a++}}}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(a=55296&&e<=57343}function $jt(e){return e>=56320&&e<=57343}function Fjt(e,t){return(e-55296)*1024+9216+t}function QDe(e){return e!==32&&e!==10&&e!==13&&e!==9&&e!==12&&e>=1&&e<=31||e>=127&&e<=159}function zDe(e){return e>=64976&&e<=65007||Ljt.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 Bjt=65536;class Ujt{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=Bjt,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,a=r+n,l=s+n;return{code:t,startLine:i,endLine:i,startCol:a,endCol:a,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($jt(n))return this.pos++,this._addGap(),Fjt(t,n)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,me.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,me.EOF;const i=this.html.charCodeAt(n);return i===me.CARRIAGE_RETURN?me.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,me.EOF;let t=this.html.charCodeAt(this.pos);return t===me.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,me.LINE_FEED):t===me.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,UDe(t)&&(t=this._processSurrogate(t)),this.handler.onParseError===null||t>31&&t<127||t===me.LINE_FEED||t===me.CARRIAGE_RETURN||t>159&&t<64976||this._checkForProblematicCharacters(t),t)}_checkForProblematicCharacters(t){QDe(t)?this._err(at.controlCharacterInInputStream):zDe(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 Qjt=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))),zjt=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 Vjt(e){var t;return e>=55296&&e<=57343||e>1114111?65533:(t=zjt.get(e))!==null&&t!==void 0?t:e}var ba;(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"})(ba||(ba={}));const Hjt=32;var _m;(function(e){e[e.VALUE_LENGTH=49152]="VALUE_LENGTH",e[e.BRANCH_LENGTH=16256]="BRANCH_LENGTH",e[e.JUMP_TABLE=127]="JUMP_TABLE"})(_m||(_m={}));function E8(e){return e>=ba.ZERO&&e<=ba.NINE}function qjt(e){return e>=ba.UPPER_A&&e<=ba.UPPER_F||e>=ba.LOWER_A&&e<=ba.LOWER_F}function Wjt(e){return e>=ba.UPPER_A&&e<=ba.UPPER_Z||e>=ba.LOWER_A&&e<=ba.LOWER_Z||E8(e)}function Kjt(e){return e===ba.EQUALS||Wjt(e)}var da;(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"})(da||(da={}));var Rh;(function(e){e[e.Legacy=0]="Legacy",e[e.Strict=1]="Strict",e[e.Attribute=2]="Attribute"})(Rh||(Rh={}));class Gjt{constructor(t,n,i){this.decodeTree=t,this.emitCodePoint=n,this.errors=i,this.state=da.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=Rh.Strict}startEntity(t){this.decodeMode=t,this.state=da.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(t,n){switch(this.state){case da.EntityStart:return t.charCodeAt(n)===ba.NUM?(this.state=da.NumericStart,this.consumed+=1,this.stateNumericStart(t,n+1)):(this.state=da.NamedEntity,this.stateNamedEntity(t,n));case da.NumericStart:return this.stateNumericStart(t,n);case da.NumericDecimal:return this.stateNumericDecimal(t,n);case da.NumericHex:return this.stateNumericHex(t,n);case da.NamedEntity:return this.stateNamedEntity(t,n)}}stateNumericStart(t,n){return n>=t.length?-1:(t.charCodeAt(n)|Hjt)===ba.LOWER_X?(this.state=da.NumericHex,this.consumed+=1,this.stateNumericHex(t,n+1)):(this.state=da.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(a===ba.SEMI)return this.emitNamedEntityData(this.treeIndex,s,this.consumed+this.excess);this.decodeMode!==Rh.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]&_m.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]&~_m.VALUE_LENGTH:r[t+1],i),n===3&&this.emitCodePoint(r[t+2],i),i}end(){var t;switch(this.state){case da.NamedEntity:return this.result!==0&&(this.decodeMode!==Rh.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case da.NumericDecimal:return this.emitNumericEntity(0,2);case da.NumericHex:return this.emitNumericEntity(0,3);case da.NumericStart:return(t=this.errors)===null||t===void 0||t.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case da.EntityStart:return 0}}}function Xjt(e,t,n,i){const r=(t&_m.BRANCH_LENGTH)>>7,s=t&_m.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 a=n,l=a+r-1;for(;a<=l;){const c=a+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 sy;(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"})(sy||(sy={}));var Tu;(function(e){e.NO_QUIRKS="no-quirks",e.QUIRKS="quirks",e.LIMITED_QUIRKS="limited-quirks"})(Tu||(Tu={}));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 Yjt=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 s1(e){var t;return(t=Yjt.get(e))!==null&&t!==void 0?t:$.UNKNOWN}const Pt=$,Zjt={[_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},C8=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 ke;(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"})(ke||(ke={}));const go={DATA:ke.DATA,RCDATA:ke.RCDATA,RAWTEXT:ke.RAWTEXT,SCRIPT_DATA:ke.SCRIPT_DATA,PLAINTEXT:ke.PLAINTEXT,CDATA_SECTION:ke.CDATA_SECTION};function Jjt(e){return e>=me.DIGIT_0&&e<=me.DIGIT_9}function sk(e){return e>=me.LATIN_CAPITAL_A&&e<=me.LATIN_CAPITAL_Z}function eNt(e){return e>=me.LATIN_SMALL_A&&e<=me.LATIN_SMALL_Z}function nm(e){return eNt(e)||sk(e)}function Ute(e){return nm(e)||Jjt(e)}function hA(e){return e+32}function HDe(e){return e===me.SPACE||e===me.LINE_FEED||e===me.TABULATION||e===me.FORM_FEED}function Qte(e){return HDe(e)||e===me.SOLIDUS||e===me.GREATER_THAN_SIGN}function tNt(e){return e===me.NULL?at.nullCharacterReference:e>1114111?at.characterReferenceOutsideUnicodeRange:UDe(e)?at.surrogateCharacterReference:zDe(e)?at.noncharacterCharacterReference:QDe(e)||e===me.CARRIAGE_RETURN?at.controlCharacterReference:null}class nNt{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=ke.DATA,this.returnState=ke.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:"",value:""},this.preprocessor=new Ujt(n),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new Gjt(Qjt,(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=tNt(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=HDe(t)?Si.WHITESPACE_CHARACTER:t===me.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=ke.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?Rh.Attribute:Rh.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===ke.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===ke.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===ke.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(t){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(t):this._emitCodePoint(t)}_callState(t){switch(this.state){case ke.DATA:{this._stateData(t);break}case ke.RCDATA:{this._stateRcdata(t);break}case ke.RAWTEXT:{this._stateRawtext(t);break}case ke.SCRIPT_DATA:{this._stateScriptData(t);break}case ke.PLAINTEXT:{this._statePlaintext(t);break}case ke.TAG_OPEN:{this._stateTagOpen(t);break}case ke.END_TAG_OPEN:{this._stateEndTagOpen(t);break}case ke.TAG_NAME:{this._stateTagName(t);break}case ke.RCDATA_LESS_THAN_SIGN:{this._stateRcdataLessThanSign(t);break}case ke.RCDATA_END_TAG_OPEN:{this._stateRcdataEndTagOpen(t);break}case ke.RCDATA_END_TAG_NAME:{this._stateRcdataEndTagName(t);break}case ke.RAWTEXT_LESS_THAN_SIGN:{this._stateRawtextLessThanSign(t);break}case ke.RAWTEXT_END_TAG_OPEN:{this._stateRawtextEndTagOpen(t);break}case ke.RAWTEXT_END_TAG_NAME:{this._stateRawtextEndTagName(t);break}case ke.SCRIPT_DATA_LESS_THAN_SIGN:{this._stateScriptDataLessThanSign(t);break}case ke.SCRIPT_DATA_END_TAG_OPEN:{this._stateScriptDataEndTagOpen(t);break}case ke.SCRIPT_DATA_END_TAG_NAME:{this._stateScriptDataEndTagName(t);break}case ke.SCRIPT_DATA_ESCAPE_START:{this._stateScriptDataEscapeStart(t);break}case ke.SCRIPT_DATA_ESCAPE_START_DASH:{this._stateScriptDataEscapeStartDash(t);break}case ke.SCRIPT_DATA_ESCAPED:{this._stateScriptDataEscaped(t);break}case ke.SCRIPT_DATA_ESCAPED_DASH:{this._stateScriptDataEscapedDash(t);break}case ke.SCRIPT_DATA_ESCAPED_DASH_DASH:{this._stateScriptDataEscapedDashDash(t);break}case ke.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataEscapedLessThanSign(t);break}case ke.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:{this._stateScriptDataEscapedEndTagOpen(t);break}case ke.SCRIPT_DATA_ESCAPED_END_TAG_NAME:{this._stateScriptDataEscapedEndTagName(t);break}case ke.SCRIPT_DATA_DOUBLE_ESCAPE_START:{this._stateScriptDataDoubleEscapeStart(t);break}case ke.SCRIPT_DATA_DOUBLE_ESCAPED:{this._stateScriptDataDoubleEscaped(t);break}case ke.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:{this._stateScriptDataDoubleEscapedDash(t);break}case ke.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:{this._stateScriptDataDoubleEscapedDashDash(t);break}case ke.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataDoubleEscapedLessThanSign(t);break}case ke.SCRIPT_DATA_DOUBLE_ESCAPE_END:{this._stateScriptDataDoubleEscapeEnd(t);break}case ke.BEFORE_ATTRIBUTE_NAME:{this._stateBeforeAttributeName(t);break}case ke.ATTRIBUTE_NAME:{this._stateAttributeName(t);break}case ke.AFTER_ATTRIBUTE_NAME:{this._stateAfterAttributeName(t);break}case ke.BEFORE_ATTRIBUTE_VALUE:{this._stateBeforeAttributeValue(t);break}case ke.ATTRIBUTE_VALUE_DOUBLE_QUOTED:{this._stateAttributeValueDoubleQuoted(t);break}case ke.ATTRIBUTE_VALUE_SINGLE_QUOTED:{this._stateAttributeValueSingleQuoted(t);break}case ke.ATTRIBUTE_VALUE_UNQUOTED:{this._stateAttributeValueUnquoted(t);break}case ke.AFTER_ATTRIBUTE_VALUE_QUOTED:{this._stateAfterAttributeValueQuoted(t);break}case ke.SELF_CLOSING_START_TAG:{this._stateSelfClosingStartTag(t);break}case ke.BOGUS_COMMENT:{this._stateBogusComment(t);break}case ke.MARKUP_DECLARATION_OPEN:{this._stateMarkupDeclarationOpen(t);break}case ke.COMMENT_START:{this._stateCommentStart(t);break}case ke.COMMENT_START_DASH:{this._stateCommentStartDash(t);break}case ke.COMMENT:{this._stateComment(t);break}case ke.COMMENT_LESS_THAN_SIGN:{this._stateCommentLessThanSign(t);break}case ke.COMMENT_LESS_THAN_SIGN_BANG:{this._stateCommentLessThanSignBang(t);break}case ke.COMMENT_LESS_THAN_SIGN_BANG_DASH:{this._stateCommentLessThanSignBangDash(t);break}case ke.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:{this._stateCommentLessThanSignBangDashDash(t);break}case ke.COMMENT_END_DASH:{this._stateCommentEndDash(t);break}case ke.COMMENT_END:{this._stateCommentEnd(t);break}case ke.COMMENT_END_BANG:{this._stateCommentEndBang(t);break}case ke.DOCTYPE:{this._stateDoctype(t);break}case ke.BEFORE_DOCTYPE_NAME:{this._stateBeforeDoctypeName(t);break}case ke.DOCTYPE_NAME:{this._stateDoctypeName(t);break}case ke.AFTER_DOCTYPE_NAME:{this._stateAfterDoctypeName(t);break}case ke.AFTER_DOCTYPE_PUBLIC_KEYWORD:{this._stateAfterDoctypePublicKeyword(t);break}case ke.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateBeforeDoctypePublicIdentifier(t);break}case ke.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypePublicIdentifierDoubleQuoted(t);break}case ke.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypePublicIdentifierSingleQuoted(t);break}case ke.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateAfterDoctypePublicIdentifier(t);break}case ke.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:{this._stateBetweenDoctypePublicAndSystemIdentifiers(t);break}case ke.AFTER_DOCTYPE_SYSTEM_KEYWORD:{this._stateAfterDoctypeSystemKeyword(t);break}case ke.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateBeforeDoctypeSystemIdentifier(t);break}case ke.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypeSystemIdentifierDoubleQuoted(t);break}case ke.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypeSystemIdentifierSingleQuoted(t);break}case ke.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateAfterDoctypeSystemIdentifier(t);break}case ke.BOGUS_DOCTYPE:{this._stateBogusDoctype(t);break}case ke.CDATA_SECTION:{this._stateCdataSection(t);break}case ke.CDATA_SECTION_BRACKET:{this._stateCdataSectionBracket(t);break}case ke.CDATA_SECTION_END:{this._stateCdataSectionEnd(t);break}case ke.CHARACTER_REFERENCE:{this._stateCharacterReference();break}case ke.AMBIGUOUS_AMPERSAND:{this._stateAmbiguousAmpersand(t);break}default:throw new Error("Unknown state")}}_stateData(t){switch(t){case me.LESS_THAN_SIGN:{this.state=ke.TAG_OPEN;break}case me.AMPERSAND:{this._startCharacterReference();break}case me.NULL:{this._err(at.unexpectedNullCharacter),this._emitCodePoint(t);break}case me.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRcdata(t){switch(t){case me.AMPERSAND:{this._startCharacterReference();break}case me.LESS_THAN_SIGN:{this.state=ke.RCDATA_LESS_THAN_SIGN;break}case me.NULL:{this._err(at.unexpectedNullCharacter),this._emitChars(Ss);break}case me.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRawtext(t){switch(t){case me.LESS_THAN_SIGN:{this.state=ke.RAWTEXT_LESS_THAN_SIGN;break}case me.NULL:{this._err(at.unexpectedNullCharacter),this._emitChars(Ss);break}case me.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptData(t){switch(t){case me.LESS_THAN_SIGN:{this.state=ke.SCRIPT_DATA_LESS_THAN_SIGN;break}case me.NULL:{this._err(at.unexpectedNullCharacter),this._emitChars(Ss);break}case me.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_statePlaintext(t){switch(t){case me.NULL:{this._err(at.unexpectedNullCharacter),this._emitChars(Ss);break}case me.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateTagOpen(t){if(nm(t))this._createStartTagToken(),this.state=ke.TAG_NAME,this._stateTagName(t);else switch(t){case me.EXCLAMATION_MARK:{this.state=ke.MARKUP_DECLARATION_OPEN;break}case me.SOLIDUS:{this.state=ke.END_TAG_OPEN;break}case me.QUESTION_MARK:{this._err(at.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=ke.BOGUS_COMMENT,this._stateBogusComment(t);break}case me.EOF:{this._err(at.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken();break}default:this._err(at.invalidFirstCharacterOfTagName),this._emitChars("<"),this.state=ke.DATA,this._stateData(t)}}_stateEndTagOpen(t){if(nm(t))this._createEndTagToken(),this.state=ke.TAG_NAME,this._stateTagName(t);else switch(t){case me.GREATER_THAN_SIGN:{this._err(at.missingEndTagName),this.state=ke.DATA;break}case me.EOF:{this._err(at.eofBeforeTagName),this._emitChars("");break}case me.NULL:{this._err(at.unexpectedNullCharacter),this.state=ke.SCRIPT_DATA_ESCAPED,this._emitChars(Ss);break}case me.EOF:{this._err(at.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=ke.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedLessThanSign(t){t===me.SOLIDUS?this.state=ke.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:nm(t)?(this._emitChars("<"),this.state=ke.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(t)):(this._emitChars("<"),this.state=ke.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataEscapedEndTagOpen(t){nm(t)?(this.state=ke.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(t)):(this._emitChars("");break}case me.NULL:{this._err(at.unexpectedNullCharacter),this.state=ke.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(Ss);break}case me.EOF:{this._err(at.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=ke.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedLessThanSign(t){t===me.SOLIDUS?(this.state=ke.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars("/")):(this.state=ke.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(t))}_stateScriptDataDoubleEscapeEnd(t){if(this.preprocessor.startsWith(Hl.SCRIPT,!1)&&Qte(this.preprocessor.peek(Hl.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(aNt,_t.HTML)}clearBackToTableBodyContext(){this.clearBackTo(oNt,_t.HTML)}clearBackToTableRowContext(){this.clearBackTo(sNt,_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(Hte.has(r))return!1;break}case _t.MATHML:{if(Vte.has(r))return!1;break}}}return!0}hasInScope(t){return this.hasInDynamicScope(t,aR)}hasInListItemScope(t){return this.hasInDynamicScope(t,iNt)}hasInButtonScope(t){return this.hasInDynamicScope(t,rNt)}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(C8.has(n))return!0;if(aR.has(n))return!1;break}case _t.SVG:{if(Hte.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&&qDe.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&zte.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(t){for(;this.currentTagId!==void 0&&this.currentTagId!==t&&zte.has(this.currentTagId);)this.pop()}}const r3=3;var ff;(function(e){e[e.Marker=0]="Marker",e[e.Element=1]="Element"})(ff||(ff={}));const qte={type:ff.Marker};class uNt{constructor(t){this.treeAdapter=t,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(t,n){const i=[],r=n.length,s=this.treeAdapter.getTagName(t),a=this.treeAdapter.getNamespaceURI(t);for(let l=0;l[a.name,a.value]));let s=0;for(let a=0;ar.get(c.name)===c.value)&&(s+=1,s>=r3&&this.entries.splice(l.idx,1))}}insertMarker(){this.entries.unshift(qte)}pushElement(t,n){this._ensureNoahArkCondition(t),this.entries.unshift({type:ff.Element,element:t,token:n})}insertElementAfterBookmark(t,n){const i=this.entries.indexOf(this.bookmark);this.entries.splice(i,0,{type:ff.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(qte);t===-1?this.entries.length=0:this.entries.splice(0,t+1)}getElementEntryInScopeWithTagName(t){const n=this.entries.find(i=>i.type===ff.Marker||this.treeAdapter.getTagName(i.element)===t);return n&&n.type===ff.Element?n:null}getElementEntry(t){return this.entries.find(n=>n.type===ff.Element&&n.element===t)}}const im={createDocument(){return{nodeName:"#document",mode:Tu.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};im.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(im.isTextNode(n)){n.value+=t;return}}im.appendChild(e,im.createTextNode(t))},insertTextBefore(e,t,n){const i=e.childNodes[e.childNodes.indexOf(n)-1];i&&im.isTextNode(i)?i.value+=t:im.insertBefore(e,im.createTextNode(t),n)},adoptAttributes(e,t){const n=new Set(e.attrs.map(i=>i.name));for(let i=0;ie.startsWith(n))}function gNt(e){return e.name===WDe&&e.publicId===null&&(e.systemId===null||e.systemId===dNt)}function bNt(e){if(e.name!==WDe)return Tu.QUIRKS;const{systemId:t}=e;if(t&&t.toLowerCase()===fNt)return Tu.QUIRKS;let{publicId:n}=e;if(n!==null){if(n=n.toLowerCase(),pNt.has(n))return Tu.QUIRKS;let i=t===null?hNt:KDe;if(Wte(n,i))return Tu.QUIRKS;if(i=t===null?GDe:mNt,Wte(n,i))return Tu.LIMITED_QUIRKS}return Tu.NO_QUIRKS}const Kte={TEXT_HTML:"text/html",APPLICATION_XML:"application/xhtml+xml"},yNt="definitionurl",vNt="definitionURL",xNt=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])),wNt=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}]]),ONt=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])),kNt=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 SNt(e){const t=e.tagID;return t===$.FONT&&e.attrs.some(({name:i})=>i===sy.COLOR||i===sy.SIZE||i===sy.FACE)||kNt.has(t)}function XDe(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,a;this.openElements.stackTop===0&&this.fragmentContext?(s=this.fragmentContext,a=this.fragmentContextID):{current:s,currentTagId:a}=this.openElements,this._setContextModes(s,a)}}_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=Re.TEXT}switchToPlaintextParsing(){this.insertionMode=Re.TEXT,this.originalInsertionMode=Re.IN_BODY,this.tokenizer.state=go.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=go.RCDATA;break}case $.STYLE:case $.XMP:case $.IFRAME:case $.NOEMBED:case $.NOFRAMES:case $.NOSCRIPT:{this.tokenizer.state=go.RAWTEXT;break}case $.SCRIPT:{this.tokenizer.state=go.SCRIPT_DATA;break}case $.PLAINTEXT:{this.tokenizer.state=go.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 a=this.treeAdapter.getChildNodes(this.document).find(l=>this.treeAdapter.isDocumentTypeNode(l));a&&this.treeAdapter.setNodeSourceCodeLocation(a,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,a=r[s-1];if(this.treeAdapter.getNodeSourceCodeLocation(a)){const{endLine:c,endCol:u,endOffset:d}=t.location;this.treeAdapter.updateNodeSourceCodeLocation(a,{endLine:c,endCol:u,endOffset:d})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(a,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 ANt(t,r,s,i)}_reconstructActiveFormattingElements(){const t=this.activeFormattingElements.entries.length;if(t){const n=this.activeFormattingElements.entries.findIndex(r=>r.type===ff.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=Re.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=Re.IN_ROW;return}case $.TBODY:case $.THEAD:case $.TFOOT:{this.insertionMode=Re.IN_TABLE_BODY;return}case $.CAPTION:{this.insertionMode=Re.IN_CAPTION;return}case $.COLGROUP:{this.insertionMode=Re.IN_COLUMN_GROUP;return}case $.TABLE:{this.insertionMode=Re.IN_TABLE;return}case $.BODY:{this.insertionMode=Re.IN_BODY;return}case $.FRAMESET:{this.insertionMode=Re.IN_FRAMESET;return}case $.SELECT:{this._resetInsertionModeForSelect(t);return}case $.TEMPLATE:{this.insertionMode=this.tmplInsertionModeStack[0];return}case $.HTML:{this.insertionMode=this.headElement?Re.AFTER_HEAD:Re.BEFORE_HEAD;return}case $.TD:case $.TH:{if(t>0){this.insertionMode=Re.IN_CELL;return}break}case $.HEAD:{if(t>0){this.insertionMode=Re.IN_HEAD;return}break}}this.insertionMode=Re.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=Re.IN_SELECT_IN_TABLE;return}}this.insertionMode=Re.IN_SELECT}_isElementCausesFosterParenting(t){return ZDe.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 Zjt[i].has(n)}onCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){lIt(this,t);return}switch(this.insertionMode){case Re.INITIAL:{bO(this,t);break}case Re.BEFORE_HTML:{Jk(this,t);break}case Re.BEFORE_HEAD:{eS(this,t);break}case Re.IN_HEAD:{tS(this,t);break}case Re.IN_HEAD_NO_SCRIPT:{nS(this,t);break}case Re.AFTER_HEAD:{iS(this,t);break}case Re.IN_BODY:case Re.IN_CAPTION:case Re.IN_CELL:case Re.IN_TEMPLATE:{eMe(this,t);break}case Re.TEXT:case Re.IN_SELECT:case Re.IN_SELECT_IN_TABLE:{this._insertCharacters(t);break}case Re.IN_TABLE:case Re.IN_TABLE_BODY:case Re.IN_ROW:{s3(this,t);break}case Re.IN_TABLE_TEXT:{oMe(this,t);break}case Re.IN_COLUMN_GROUP:{lR(this,t);break}case Re.AFTER_BODY:{cR(this,t);break}case Re.AFTER_AFTER_BODY:{cj(this,t);break}}}onNullCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){aIt(this,t);return}switch(this.insertionMode){case Re.INITIAL:{bO(this,t);break}case Re.BEFORE_HTML:{Jk(this,t);break}case Re.BEFORE_HEAD:{eS(this,t);break}case Re.IN_HEAD:{tS(this,t);break}case Re.IN_HEAD_NO_SCRIPT:{nS(this,t);break}case Re.AFTER_HEAD:{iS(this,t);break}case Re.TEXT:{this._insertCharacters(t);break}case Re.IN_TABLE:case Re.IN_TABLE_BODY:case Re.IN_ROW:{s3(this,t);break}case Re.IN_COLUMN_GROUP:{lR(this,t);break}case Re.AFTER_BODY:{cR(this,t);break}case Re.AFTER_AFTER_BODY:{cj(this,t);break}}}onComment(t){if(this.skipNextNewLine=!1,this.currentNotInHTML){T8(this,t);return}switch(this.insertionMode){case Re.INITIAL:case Re.BEFORE_HTML:case Re.BEFORE_HEAD:case Re.IN_HEAD:case Re.IN_HEAD_NO_SCRIPT:case Re.AFTER_HEAD:case Re.IN_BODY:case Re.IN_TABLE:case Re.IN_CAPTION:case Re.IN_COLUMN_GROUP:case Re.IN_TABLE_BODY:case Re.IN_ROW:case Re.IN_CELL:case Re.IN_SELECT:case Re.IN_SELECT_IN_TABLE:case Re.IN_TEMPLATE:case Re.IN_FRAMESET:case Re.AFTER_FRAMESET:{T8(this,t);break}case Re.IN_TABLE_TEXT:{yO(this,t);break}case Re.AFTER_BODY:{FNt(this,t);break}case Re.AFTER_AFTER_BODY:case Re.AFTER_AFTER_FRAMESET:{BNt(this,t);break}}}onDoctype(t){switch(this.skipNextNewLine=!1,this.insertionMode){case Re.INITIAL:{UNt(this,t);break}case Re.BEFORE_HEAD:case Re.IN_HEAD:case Re.IN_HEAD_NO_SCRIPT:case Re.AFTER_HEAD:{this._err(t,at.misplacedDoctype);break}case Re.IN_TABLE_TEXT:{yO(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)?cIt(this,t):this._startTagOutsideForeignContent(t)}_startTagOutsideForeignContent(t){switch(this.insertionMode){case Re.INITIAL:{bO(this,t);break}case Re.BEFORE_HTML:{QNt(this,t);break}case Re.BEFORE_HEAD:{VNt(this,t);break}case Re.IN_HEAD:{zd(this,t);break}case Re.IN_HEAD_NO_SCRIPT:{WNt(this,t);break}case Re.AFTER_HEAD:{GNt(this,t);break}case Re.IN_BODY:{ul(this,t);break}case Re.IN_TABLE:{hw(this,t);break}case Re.IN_TABLE_TEXT:{yO(this,t);break}case Re.IN_CAPTION:{HRt(this,t);break}case Re.IN_COLUMN_GROUP:{CV(this,t);break}case Re.IN_TABLE_BODY:{oD(this,t);break}case Re.IN_ROW:{aD(this,t);break}case Re.IN_CELL:{KRt(this,t);break}case Re.IN_SELECT:{cMe(this,t);break}case Re.IN_SELECT_IN_TABLE:{XRt(this,t);break}case Re.IN_TEMPLATE:{ZRt(this,t);break}case Re.AFTER_BODY:{eIt(this,t);break}case Re.IN_FRAMESET:{tIt(this,t);break}case Re.AFTER_FRAMESET:{iIt(this,t);break}case Re.AFTER_AFTER_BODY:{sIt(this,t);break}case Re.AFTER_AFTER_FRAMESET:{oIt(this,t);break}}}onEndTag(t){this.skipNextNewLine=!1,this.currentToken=t,this.currentNotInHTML?uIt(this,t):this._endTagOutsideForeignContent(t)}_endTagOutsideForeignContent(t){switch(this.insertionMode){case Re.INITIAL:{bO(this,t);break}case Re.BEFORE_HTML:{zNt(this,t);break}case Re.BEFORE_HEAD:{HNt(this,t);break}case Re.IN_HEAD:{qNt(this,t);break}case Re.IN_HEAD_NO_SCRIPT:{KNt(this,t);break}case Re.AFTER_HEAD:{XNt(this,t);break}case Re.IN_BODY:{sD(this,t);break}case Re.TEXT:{DRt(this,t);break}case Re.IN_TABLE:{OE(this,t);break}case Re.IN_TABLE_TEXT:{yO(this,t);break}case Re.IN_CAPTION:{qRt(this,t);break}case Re.IN_COLUMN_GROUP:{WRt(this,t);break}case Re.IN_TABLE_BODY:{A8(this,t);break}case Re.IN_ROW:{lMe(this,t);break}case Re.IN_CELL:{GRt(this,t);break}case Re.IN_SELECT:{uMe(this,t);break}case Re.IN_SELECT_IN_TABLE:{YRt(this,t);break}case Re.IN_TEMPLATE:{JRt(this,t);break}case Re.AFTER_BODY:{fMe(this,t);break}case Re.IN_FRAMESET:{nIt(this,t);break}case Re.AFTER_FRAMESET:{rIt(this,t);break}case Re.AFTER_AFTER_BODY:{cj(this,t);break}}}onEof(t){switch(this.insertionMode){case Re.INITIAL:{bO(this,t);break}case Re.BEFORE_HTML:{Jk(this,t);break}case Re.BEFORE_HEAD:{eS(this,t);break}case Re.IN_HEAD:{tS(this,t);break}case Re.IN_HEAD_NO_SCRIPT:{nS(this,t);break}case Re.AFTER_HEAD:{iS(this,t);break}case Re.IN_BODY:case Re.IN_TABLE:case Re.IN_CAPTION:case Re.IN_COLUMN_GROUP:case Re.IN_TABLE_BODY:case Re.IN_ROW:case Re.IN_CELL:case Re.IN_SELECT:case Re.IN_SELECT_IN_TABLE:{rMe(this,t);break}case Re.TEXT:{MRt(this,t);break}case Re.IN_TABLE_TEXT:{yO(this,t);break}case Re.IN_TEMPLATE:{dMe(this,t);break}case Re.AFTER_BODY:case Re.IN_FRAMESET:case Re.AFTER_FRAMESET:case Re.AFTER_AFTER_BODY:case Re.AFTER_AFTER_FRAMESET:{EV(this,t);break}}}onWhitespaceCharacter(t){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,t.chars.charCodeAt(0)===me.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 Re.IN_HEAD:case Re.IN_HEAD_NO_SCRIPT:case Re.AFTER_HEAD:case Re.TEXT:case Re.IN_COLUMN_GROUP:case Re.IN_SELECT:case Re.IN_SELECT_IN_TABLE:case Re.IN_FRAMESET:case Re.AFTER_FRAMESET:{this._insertCharacters(t);break}case Re.IN_BODY:case Re.IN_CAPTION:case Re.IN_CELL:case Re.IN_TEMPLATE:case Re.AFTER_BODY:case Re.AFTER_AFTER_BODY:case Re.AFTER_AFTER_FRAMESET:{JDe(this,t);break}case Re.IN_TABLE:case Re.IN_TABLE_BODY:case Re.IN_ROW:{s3(this,t);break}case Re.IN_TABLE_TEXT:{sMe(this,t);break}}}};function INt(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):iMe(e,t),n}function PNt(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 DNt(e,t,n){let i=t,r=e.openElements.getCommonAncestor(t);for(let s=0,a=r;a!==n;s++,a=r){r=e.openElements.getCommonAncestor(a);const l=e.activeFormattingElements.getElementEntry(a),c=l&&s>=NNt;!l||c?(c&&e.activeFormattingElements.removeEntry(l),e.openElements.remove(a)):(a=MNt(e,l),i===t&&(e.activeFormattingElements.bookmark=l),e.treeAdapter.detachNode(i),e.treeAdapter.appendChild(a,i),i=a)}return i}function MNt(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 LNt(e,t,n){const i=e.treeAdapter.getTagName(t),r=s1(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 $Nt(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 SV(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],a=e.treeAdapter.getNodeSourceCodeLocation(s);a&&!a.endTag&&e._setEndLocation(s,t)}}}}function UNt(e,t){e._setDocumentType(t);const n=t.forceQuirks?Tu.QUIRKS:bNt(t);gNt(t)||e._err(t,at.nonConformingDoctype),e.treeAdapter.setDocumentMode(e.document,n),e.insertionMode=Re.BEFORE_HTML}function bO(e,t){e._err(t,at.missingDoctype,!0),e.treeAdapter.setDocumentMode(e.document,Tu.QUIRKS),e.insertionMode=Re.BEFORE_HTML,e._processToken(t)}function QNt(e,t){t.tagID===$.HTML?(e._insertElement(t,_t.HTML),e.insertionMode=Re.BEFORE_HEAD):Jk(e,t)}function zNt(e,t){const n=t.tagID;(n===$.HTML||n===$.HEAD||n===$.BODY||n===$.BR)&&Jk(e,t)}function Jk(e,t){e._insertFakeRootElement(),e.insertionMode=Re.BEFORE_HEAD,e._processToken(t)}function VNt(e,t){switch(t.tagID){case $.HTML:{ul(e,t);break}case $.HEAD:{e._insertElement(t,_t.HTML),e.headElement=e.openElements.current,e.insertionMode=Re.IN_HEAD;break}default:eS(e,t)}}function HNt(e,t){const n=t.tagID;n===$.HEAD||n===$.BODY||n===$.HTML||n===$.BR?eS(e,t):e._err(t,at.endTagWithoutMatchingOpenElement)}function eS(e,t){e._insertFakeElement(Xe.HEAD,$.HEAD),e.headElement=e.openElements.current,e.insertionMode=Re.IN_HEAD,e._processToken(t)}function zd(e,t){switch(t.tagID){case $.HTML:{ul(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,go.RCDATA);break}case $.NOSCRIPT:{e.options.scriptingEnabled?e._switchToTextParsing(t,go.RAWTEXT):(e._insertElement(t,_t.HTML),e.insertionMode=Re.IN_HEAD_NO_SCRIPT);break}case $.NOFRAMES:case $.STYLE:{e._switchToTextParsing(t,go.RAWTEXT);break}case $.SCRIPT:{e._switchToTextParsing(t,go.SCRIPT_DATA);break}case $.TEMPLATE:{e._insertTemplate(t),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=Re.IN_TEMPLATE,e.tmplInsertionModeStack.unshift(Re.IN_TEMPLATE);break}case $.HEAD:{e._err(t,at.misplacedStartTagForHeadElement);break}default:tS(e,t)}}function qNt(e,t){switch(t.tagID){case $.HEAD:{e.openElements.pop(),e.insertionMode=Re.AFTER_HEAD;break}case $.BODY:case $.BR:case $.HTML:{tS(e,t);break}case $.TEMPLATE:{l0(e,t);break}default:e._err(t,at.endTagWithoutMatchingOpenElement)}}function l0(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 tS(e,t){e.openElements.pop(),e.insertionMode=Re.AFTER_HEAD,e._processToken(t)}function WNt(e,t){switch(t.tagID){case $.HTML:{ul(e,t);break}case $.BASEFONT:case $.BGSOUND:case $.HEAD:case $.LINK:case $.META:case $.NOFRAMES:case $.STYLE:{zd(e,t);break}case $.NOSCRIPT:{e._err(t,at.nestedNoscriptInHead);break}default:nS(e,t)}}function KNt(e,t){switch(t.tagID){case $.NOSCRIPT:{e.openElements.pop(),e.insertionMode=Re.IN_HEAD;break}case $.BR:{nS(e,t);break}default:e._err(t,at.endTagWithoutMatchingOpenElement)}}function nS(e,t){const n=t.type===Si.EOF?at.openElementsLeftAfterEof:at.disallowedContentInNoscriptInHead;e._err(t,n),e.openElements.pop(),e.insertionMode=Re.IN_HEAD,e._processToken(t)}function GNt(e,t){switch(t.tagID){case $.HTML:{ul(e,t);break}case $.BODY:{e._insertElement(t,_t.HTML),e.framesetOk=!1,e.insertionMode=Re.IN_BODY;break}case $.FRAMESET:{e._insertElement(t,_t.HTML),e.insertionMode=Re.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),zd(e,t),e.openElements.remove(e.headElement);break}case $.HEAD:{e._err(t,at.misplacedStartTagForHeadElement);break}default:iS(e,t)}}function XNt(e,t){switch(t.tagID){case $.BODY:case $.HTML:case $.BR:{iS(e,t);break}case $.TEMPLATE:{l0(e,t);break}default:e._err(t,at.endTagWithoutMatchingOpenElement)}}function iS(e,t){e._insertFakeElement(Xe.BODY,$.BODY),e.insertionMode=Re.IN_BODY,rD(e,t)}function rD(e,t){switch(t.type){case Si.CHARACTER:{eMe(e,t);break}case Si.WHITESPACE_CHARACTER:{JDe(e,t);break}case Si.COMMENT:{T8(e,t);break}case Si.START_TAG:{ul(e,t);break}case Si.END_TAG:{sD(e,t);break}case Si.EOF:{rMe(e,t);break}}}function JDe(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t)}function eMe(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1}function YNt(e,t){e.openElements.tmplCount===0&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs)}function ZNt(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e.openElements.tmplCount===0&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(n,t.attrs))}function JNt(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();e.framesetOk&&n&&(e.treeAdapter.detachNode(n),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,_t.HTML),e.insertionMode=Re.IN_FRAMESET)}function eRt(e,t){e.openElements.hasInButtonScope($.P)&&e._closePElement(),e._insertElement(t,_t.HTML)}function tRt(e,t){e.openElements.hasInButtonScope($.P)&&e._closePElement(),e.openElements.currentTagId!==void 0&&C8.has(e.openElements.currentTagId)&&e.openElements.pop(),e._insertElement(t,_t.HTML)}function nRt(e,t){e.openElements.hasInButtonScope($.P)&&e._closePElement(),e._insertElement(t,_t.HTML),e.skipNextNewLine=!0,e.framesetOk=!1}function iRt(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 rRt(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 sRt(e,t){e.openElements.hasInButtonScope($.P)&&e._closePElement(),e._insertElement(t,_t.HTML),e.tokenizer.state=go.PLAINTEXT}function oRt(e,t){e.openElements.hasInScope($.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped($.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,_t.HTML),e.framesetOk=!1}function aRt(e,t){const n=e.activeFormattingElements.getElementEntryInScopeWithTagName(Xe.A);n&&(SV(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 lRt(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,_t.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function cRt(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope($.NOBR)&&(SV(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,_t.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function uRt(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,_t.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1}function dRt(e,t){e.treeAdapter.getDocumentMode(e.document)!==Tu.QUIRKS&&e.openElements.hasInButtonScope($.P)&&e._closePElement(),e._insertElement(t,_t.HTML),e.framesetOk=!1,e.insertionMode=Re.IN_TABLE}function tMe(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,_t.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function nMe(e){const t=VDe(e,sy.TYPE);return t!=null&&t.toLowerCase()===_Nt}function fRt(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,_t.HTML),nMe(t)||(e.framesetOk=!1),t.ackSelfClosing=!0}function hRt(e,t){e._appendElement(t,_t.HTML),t.ackSelfClosing=!0}function pRt(e,t){e.openElements.hasInButtonScope($.P)&&e._closePElement(),e._appendElement(t,_t.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function mRt(e,t){t.tagName=Xe.IMG,t.tagID=$.IMG,tMe(e,t)}function gRt(e,t){e._insertElement(t,_t.HTML),e.skipNextNewLine=!0,e.tokenizer.state=go.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=Re.TEXT}function bRt(e,t){e.openElements.hasInButtonScope($.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,go.RAWTEXT)}function yRt(e,t){e.framesetOk=!1,e._switchToTextParsing(t,go.RAWTEXT)}function Yte(e,t){e._switchToTextParsing(t,go.RAWTEXT)}function vRt(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,_t.HTML),e.framesetOk=!1,e.insertionMode=e.insertionMode===Re.IN_TABLE||e.insertionMode===Re.IN_CAPTION||e.insertionMode===Re.IN_TABLE_BODY||e.insertionMode===Re.IN_ROW||e.insertionMode===Re.IN_CELL?Re.IN_SELECT_IN_TABLE:Re.IN_SELECT}function xRt(e,t){e.openElements.currentTagId===$.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,_t.HTML)}function wRt(e,t){e.openElements.hasInScope($.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,_t.HTML)}function ORt(e,t){e.openElements.hasInScope($.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion($.RTC),e._insertElement(t,_t.HTML)}function kRt(e,t){e._reconstructActiveFormattingElements(),XDe(t),kV(t),t.selfClosing?e._appendElement(t,_t.MATHML):e._insertElement(t,_t.MATHML),t.ackSelfClosing=!0}function SRt(e,t){e._reconstructActiveFormattingElements(),YDe(t),kV(t),t.selfClosing?e._appendElement(t,_t.SVG):e._insertElement(t,_t.SVG),t.ackSelfClosing=!0}function Zte(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,_t.HTML)}function ul(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:{lRt(e,t);break}case $.A:{aRt(e,t);break}case $.H1:case $.H2:case $.H3:case $.H4:case $.H5:case $.H6:{tRt(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:{eRt(e,t);break}case $.LI:case $.DD:case $.DT:{rRt(e,t);break}case $.BR:case $.IMG:case $.WBR:case $.AREA:case $.EMBED:case $.KEYGEN:{tMe(e,t);break}case $.HR:{pRt(e,t);break}case $.RB:case $.RTC:{wRt(e,t);break}case $.RT:case $.RP:{ORt(e,t);break}case $.PRE:case $.LISTING:{nRt(e,t);break}case $.XMP:{bRt(e,t);break}case $.SVG:{SRt(e,t);break}case $.HTML:{YNt(e,t);break}case $.BASE:case $.LINK:case $.META:case $.STYLE:case $.TITLE:case $.SCRIPT:case $.BGSOUND:case $.BASEFONT:case $.TEMPLATE:{zd(e,t);break}case $.BODY:{ZNt(e,t);break}case $.FORM:{iRt(e,t);break}case $.NOBR:{cRt(e,t);break}case $.MATH:{kRt(e,t);break}case $.TABLE:{dRt(e,t);break}case $.INPUT:{fRt(e,t);break}case $.PARAM:case $.TRACK:case $.SOURCE:{hRt(e,t);break}case $.IMAGE:{mRt(e,t);break}case $.BUTTON:{oRt(e,t);break}case $.APPLET:case $.OBJECT:case $.MARQUEE:{uRt(e,t);break}case $.IFRAME:{yRt(e,t);break}case $.SELECT:{vRt(e,t);break}case $.OPTION:case $.OPTGROUP:{xRt(e,t);break}case $.NOEMBED:case $.NOFRAMES:{Yte(e,t);break}case $.FRAMESET:{JNt(e,t);break}case $.TEXTAREA:{gRt(e,t);break}case $.NOSCRIPT:{e.options.scriptingEnabled?Yte(e,t):Zte(e,t);break}case $.PLAINTEXT:{sRt(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:Zte(e,t)}}function ERt(e,t){if(e.openElements.hasInScope($.BODY)&&(e.insertionMode=Re.AFTER_BODY,e.options.sourceCodeLocationInfo)){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e._setEndLocation(n,t)}}function CRt(e,t){e.openElements.hasInScope($.BODY)&&(e.insertionMode=Re.AFTER_BODY,fMe(e,t))}function TRt(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n))}function ARt(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 _Rt(e){e.openElements.hasInButtonScope($.P)||e._insertFakeElement(Xe.P,$.P),e._closePElement()}function jRt(e){e.openElements.hasInListItemScope($.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion($.LI),e.openElements.popUntilTagNamePopped($.LI))}function NRt(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.popUntilTagNamePopped(n))}function RRt(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped())}function IRt(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker())}function PRt(e){e._reconstructActiveFormattingElements(),e._insertFakeElement(Xe.BR,$.BR),e.openElements.pop(),e.framesetOk=!1}function iMe(e,t){const n=t.tagName,i=t.tagID;for(let r=e.openElements.stackTop;r>0;r--){const s=e.openElements.items[r],a=e.openElements.tagIDs[r];if(i===a&&(i!==$.UNKNOWN||e.treeAdapter.getTagName(s)===n)){e.openElements.generateImpliedEndTagsWithExclusion(i),e.openElements.stackTop>=r&&e.openElements.shortenToLength(r);break}if(e._isSpecialElement(s,a))break}}function sD(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:{SV(e,t);break}case $.P:{_Rt(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:{TRt(e,t);break}case $.LI:{jRt(e);break}case $.DD:case $.DT:{NRt(e,t);break}case $.H1:case $.H2:case $.H3:case $.H4:case $.H5:case $.H6:{RRt(e);break}case $.BR:{PRt(e);break}case $.BODY:{ERt(e,t);break}case $.HTML:{CRt(e,t);break}case $.FORM:{ARt(e);break}case $.APPLET:case $.OBJECT:case $.MARQUEE:{IRt(e,t);break}case $.TEMPLATE:{l0(e,t);break}default:iMe(e,t)}}function rMe(e,t){e.tmplInsertionModeStack.length>0?dMe(e,t):EV(e,t)}function DRt(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 MRt(e,t){e._err(t,at.eofInElementThatCanContainOnlyText),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e.onEof(t)}function s3(e,t){if(e.openElements.currentTagId!==void 0&&ZDe.has(e.openElements.currentTagId))switch(e.pendingCharacterTokens.length=0,e.hasNonWhitespacePendingCharacterToken=!1,e.originalInsertionMode=e.insertionMode,e.insertionMode=Re.IN_TABLE_TEXT,t.type){case Si.CHARACTER:{oMe(e,t);break}case Si.WHITESPACE_CHARACTER:{sMe(e,t);break}}else rT(e,t)}function LRt(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,_t.HTML),e.insertionMode=Re.IN_CAPTION}function $Rt(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,_t.HTML),e.insertionMode=Re.IN_COLUMN_GROUP}function FRt(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(Xe.COLGROUP,$.COLGROUP),e.insertionMode=Re.IN_COLUMN_GROUP,CV(e,t)}function BRt(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,_t.HTML),e.insertionMode=Re.IN_TABLE_BODY}function URt(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(Xe.TBODY,$.TBODY),e.insertionMode=Re.IN_TABLE_BODY,oD(e,t)}function QRt(e,t){e.openElements.hasInTableScope($.TABLE)&&(e.openElements.popUntilTagNamePopped($.TABLE),e._resetInsertionMode(),e._processStartTag(t))}function zRt(e,t){nMe(t)?e._appendElement(t,_t.HTML):rT(e,t),t.ackSelfClosing=!0}function VRt(e,t){!e.formElement&&e.openElements.tmplCount===0&&(e._insertElement(t,_t.HTML),e.formElement=e.openElements.current,e.openElements.pop())}function hw(e,t){switch(t.tagID){case $.TD:case $.TH:case $.TR:{URt(e,t);break}case $.STYLE:case $.SCRIPT:case $.TEMPLATE:{zd(e,t);break}case $.COL:{FRt(e,t);break}case $.FORM:{VRt(e,t);break}case $.TABLE:{QRt(e,t);break}case $.TBODY:case $.TFOOT:case $.THEAD:{BRt(e,t);break}case $.INPUT:{zRt(e,t);break}case $.CAPTION:{LRt(e,t);break}case $.COLGROUP:{$Rt(e,t);break}default:rT(e,t)}}function OE(e,t){switch(t.tagID){case $.TABLE:{e.openElements.hasInTableScope($.TABLE)&&(e.openElements.popUntilTagNamePopped($.TABLE),e._resetInsertionMode());break}case $.TEMPLATE:{l0(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:rT(e,t)}}function rT(e,t){const n=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,rD(e,t),e.fosterParentingEnabled=n}function sMe(e,t){e.pendingCharacterTokens.push(t)}function oMe(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0}function yO(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:{l0(e,t);break}}}function XRt(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)):cMe(e,t)}function YRt(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)):uMe(e,t)}function ZRt(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:{zd(e,t);break}case $.CAPTION:case $.COLGROUP:case $.TBODY:case $.TFOOT:case $.THEAD:{e.tmplInsertionModeStack[0]=Re.IN_TABLE,e.insertionMode=Re.IN_TABLE,hw(e,t);break}case $.COL:{e.tmplInsertionModeStack[0]=Re.IN_COLUMN_GROUP,e.insertionMode=Re.IN_COLUMN_GROUP,CV(e,t);break}case $.TR:{e.tmplInsertionModeStack[0]=Re.IN_TABLE_BODY,e.insertionMode=Re.IN_TABLE_BODY,oD(e,t);break}case $.TD:case $.TH:{e.tmplInsertionModeStack[0]=Re.IN_ROW,e.insertionMode=Re.IN_ROW,aD(e,t);break}default:e.tmplInsertionModeStack[0]=Re.IN_BODY,e.insertionMode=Re.IN_BODY,ul(e,t)}}function JRt(e,t){t.tagID===$.TEMPLATE&&l0(e,t)}function dMe(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped($.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode(),e.onEof(t)):EV(e,t)}function eIt(e,t){t.tagID===$.HTML?ul(e,t):cR(e,t)}function fMe(e,t){var n;if(t.tagID===$.HTML){if(e.fragmentContext||(e.insertionMode=Re.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 cR(e,t)}function cR(e,t){e.insertionMode=Re.IN_BODY,rD(e,t)}function tIt(e,t){switch(t.tagID){case $.HTML:{ul(e,t);break}case $.FRAMESET:{e._insertElement(t,_t.HTML);break}case $.FRAME:{e._appendElement(t,_t.HTML),t.ackSelfClosing=!0;break}case $.NOFRAMES:{zd(e,t);break}}}function nIt(e,t){t.tagID===$.FRAMESET&&!e.openElements.isRootHtmlElementCurrent()&&(e.openElements.pop(),!e.fragmentContext&&e.openElements.currentTagId!==$.FRAMESET&&(e.insertionMode=Re.AFTER_FRAMESET))}function iIt(e,t){switch(t.tagID){case $.HTML:{ul(e,t);break}case $.NOFRAMES:{zd(e,t);break}}}function rIt(e,t){t.tagID===$.HTML&&(e.insertionMode=Re.AFTER_AFTER_FRAMESET)}function sIt(e,t){t.tagID===$.HTML?ul(e,t):cj(e,t)}function cj(e,t){e.insertionMode=Re.IN_BODY,rD(e,t)}function oIt(e,t){switch(t.tagID){case $.HTML:{ul(e,t);break}case $.NOFRAMES:{zd(e,t);break}}}function aIt(e,t){t.chars=Ss,e._insertCharacters(t)}function lIt(e,t){e._insertCharacters(t),e.framesetOk=!1}function hMe(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 cIt(e,t){if(SNt(t))hMe(e),e._startTagOutsideForeignContent(t);else{const n=e._getAdjustedCurrentElement(),i=e.treeAdapter.getNamespaceURI(n);i===_t.MATHML?XDe(t):i===_t.SVG&&(ENt(t),YDe(t)),kV(t),t.selfClosing?e._appendElement(t,i):e._insertElement(t,i),t.ackSelfClosing=!0}}function uIt(e,t){if(t.tagID===$.P||t.tagID===$.BR){hMe(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 dIt=/<(\/?)(iframe|noembed|noframes|plaintext|script|style|textarea|title|xmp)(?=[\t\n\f\r />])/gi,fIt=new Set(["mdxFlowExpression","mdxJsxFlowElement","mdxJsxTextElement","mdxTextExpression","mdxjsEsm"]),Jte={sourceCodeLocationInfo:!0,scriptingEnabled:!1};function pMe(e,t){const n=OIt(e),i=TPe("type",{handlers:{root:hIt,element:pIt,text:mIt,comment:gMe,doctype:gIt,raw:yIt},unknown:vIt}),r={parser:n?new Xte(Jte):Xte.getFragmentParser(void 0,Jte),handle(l){i(l,r)},stitches:!1,options:t||{}};i(e,r),o1(r,Wf());const s=n?r.parser.document:r.parser.getFragment(),a=kjt(s,{file:r.options.file});return r.stitches&&nT(a,"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}}),a.type==="root"&&a.children.length===1&&a.children[0].type===e.type?a.children[0]:a}function mMe(e,t){let n=-1;if(e)for(;++n4&&(t.parser.tokenizer.state=0);const n={type:Si.CHARACTER,chars:e.value,location:sT(e)};o1(t,Wf(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function gIt(e,t){const n={type:Si.DOCTYPE,name:"html",forceQuirks:!1,publicId:"",systemId:"",location:sT(e)};o1(t,Wf(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function bIt(e,t){t.stitches=!0;const n=kIt(e);if("children"in e&&"children"in n){const i=pMe({type:"root",children:e.children},t.options);n.children=i.children}gMe({type:"comment",value:{stitch:n}},t)}function gMe(e,t){const n=e.value,i={type:Si.COMMENT,data:n,location:sT(e)};o1(t,Wf(e)),t.parser.currentToken=i,t.parser._processToken(t.parser.currentToken)}function yIt(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,bMe(t,Wf(e)),t.parser.tokenizer.write(t.options.tagfilter?e.value.replace(dIt,"<$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 vIt(e,t){const n=e;if(t.options.passThrough&&t.options.passThrough.includes(n.type))bIt(n,t);else{let i="";throw fIt.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 o1(e,t){bMe(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=go.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 bMe(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 xIt(e,t){const n=e.tagName.toLowerCase();if(t.parser.tokenizer.state===go.PLAINTEXT)return;o1(t,Wf(e));const i=t.parser.openElements.current;let r="namespaceURI"in i?i.namespaceURI:$b.html;r===$b.html&&n==="svg"&&(r=$b.svg);const s=Ajt({...e,children:[]},{space:r===$b.svg?"svg":"html"}),a={type:Si.START_TAG,tagName:n,tagID:s1(n),selfClosing:!1,ackSelfClosing:!1,attrs:"attrs"in s?s.attrs:[],location:sT(e)};t.parser.currentToken=a,t.parser._processToken(t.parser.currentToken),t.parser.tokenizer.lastStartTagName=n}function wIt(e,t){const n=e.tagName.toLowerCase();if(!t.parser.tokenizer.inForeignNode&&Mjt.includes(n)||t.parser.tokenizer.state===go.PLAINTEXT)return;o1(t,YP(e));const i={type:Si.END_TAG,tagName:n,tagID:s1(n),selfClosing:!1,ackSelfClosing:!1,attrs:[],location:sT(e)};t.parser.currentToken=i,t.parser._processToken(t.parser.currentToken),n===t.parser.tokenizer.lastStartTagName&&(t.parser.tokenizer.state===go.RCDATA||t.parser.tokenizer.state===go.RAWTEXT||t.parser.tokenizer.state===go.SCRIPT_DATA)&&(t.parser.tokenizer.state=go.DATA)}function OIt(e){const t=e.type==="root"?e.children[0]:e;return!!(t&&(t.type==="doctype"||t.type==="element"&&t.tagName.toLowerCase()==="html"))}function sT(e){const t=Wf(e)||{line:void 0,column:void 0,offset:void 0},n=YP(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 kIt(e){return"children"in e?dw({...e,children:[]}):dw(e)}function SIt(e){return function(t,n){return pMe(t,{...e,file:n})}}const EIt="modulepreload",CIt=function(e){return"/"+e},ene={},Ls=function(t,n,i){let r=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));r=Promise.allSettled(n.map(c=>{if(c=CIt(c),c in ene)return;ene[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":EIt,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(a){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=a,window.dispatchEvent(l),!l.defaultPrevented)throw a}return r.then(a=>{for(const l of a||[])l.status==="rejected"&&s(l.reason);return t().catch(s)})};var TIt=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,AIt=/[\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]/,_It=/[\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]/,o3={Space_Separator:TIt,ID_Start:AIt,ID_Continue:_It},lo={isSpaceSeparator(e){return typeof e=="string"&&o3.Space_Separator.test(e)},isIdStartChar(e){return typeof e=="string"&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="$"||e==="_"||o3.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==="‍"||o3.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 _8,Cl,Ih,uR,pg,jd,fa,TV,rS;var jIt=function(t,n){_8=String(t),Cl="start",Ih=[],uR=0,pg=1,jd=0,fa=void 0,TV=void 0,rS=void 0;do fa=NIt(),PIt[Cl]();while(fa.type!=="eof");return typeof n=="function"?j8({"":rS},"",n):rS};function j8(e,t,n){const i=e[t];if(i!=null&&typeof i=="object")if(Array.isArray(i))for(let r=0;r=55296&&e<=57343}function $jt(e){return e>=56320&&e<=57343}function Fjt(e,t){return(e-55296)*1024+9216+t}function QDe(e){return e!==32&&e!==10&&e!==13&&e!==9&&e!==12&&e>=1&&e<=31||e>=127&&e<=159}function zDe(e){return e>=64976&&e<=65007||Ljt.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 Bjt=65536;class Ujt{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=Bjt,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,a=r+n,l=s+n;return{code:t,startLine:i,endLine:i,startCol:a,endCol:a,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($jt(n))return this.pos++,this._addGap(),Fjt(t,n)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,me.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,me.EOF;const i=this.html.charCodeAt(n);return i===me.CARRIAGE_RETURN?me.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,me.EOF;let t=this.html.charCodeAt(this.pos);return t===me.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,me.LINE_FEED):t===me.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,UDe(t)&&(t=this._processSurrogate(t)),this.handler.onParseError===null||t>31&&t<127||t===me.LINE_FEED||t===me.CARRIAGE_RETURN||t>159&&t<64976||this._checkForProblematicCharacters(t),t)}_checkForProblematicCharacters(t){QDe(t)?this._err(at.controlCharacterInInputStream):zDe(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 Qjt=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))),zjt=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 Vjt(e){var t;return e>=55296&&e<=57343||e>1114111?65533:(t=zjt.get(e))!==null&&t!==void 0?t:e}var ba;(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"})(ba||(ba={}));const Hjt=32;var _m;(function(e){e[e.VALUE_LENGTH=49152]="VALUE_LENGTH",e[e.BRANCH_LENGTH=16256]="BRANCH_LENGTH",e[e.JUMP_TABLE=127]="JUMP_TABLE"})(_m||(_m={}));function E8(e){return e>=ba.ZERO&&e<=ba.NINE}function qjt(e){return e>=ba.UPPER_A&&e<=ba.UPPER_F||e>=ba.LOWER_A&&e<=ba.LOWER_F}function Wjt(e){return e>=ba.UPPER_A&&e<=ba.UPPER_Z||e>=ba.LOWER_A&&e<=ba.LOWER_Z||E8(e)}function Kjt(e){return e===ba.EQUALS||Wjt(e)}var da;(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"})(da||(da={}));var Rh;(function(e){e[e.Legacy=0]="Legacy",e[e.Strict=1]="Strict",e[e.Attribute=2]="Attribute"})(Rh||(Rh={}));class Gjt{constructor(t,n,i){this.decodeTree=t,this.emitCodePoint=n,this.errors=i,this.state=da.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=Rh.Strict}startEntity(t){this.decodeMode=t,this.state=da.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(t,n){switch(this.state){case da.EntityStart:return t.charCodeAt(n)===ba.NUM?(this.state=da.NumericStart,this.consumed+=1,this.stateNumericStart(t,n+1)):(this.state=da.NamedEntity,this.stateNamedEntity(t,n));case da.NumericStart:return this.stateNumericStart(t,n);case da.NumericDecimal:return this.stateNumericDecimal(t,n);case da.NumericHex:return this.stateNumericHex(t,n);case da.NamedEntity:return this.stateNamedEntity(t,n)}}stateNumericStart(t,n){return n>=t.length?-1:(t.charCodeAt(n)|Hjt)===ba.LOWER_X?(this.state=da.NumericHex,this.consumed+=1,this.stateNumericHex(t,n+1)):(this.state=da.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(a===ba.SEMI)return this.emitNamedEntityData(this.treeIndex,s,this.consumed+this.excess);this.decodeMode!==Rh.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]&_m.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]&~_m.VALUE_LENGTH:r[t+1],i),n===3&&this.emitCodePoint(r[t+2],i),i}end(){var t;switch(this.state){case da.NamedEntity:return this.result!==0&&(this.decodeMode!==Rh.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case da.NumericDecimal:return this.emitNumericEntity(0,2);case da.NumericHex:return this.emitNumericEntity(0,3);case da.NumericStart:return(t=this.errors)===null||t===void 0||t.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case da.EntityStart:return 0}}}function Xjt(e,t,n,i){const r=(t&_m.BRANCH_LENGTH)>>7,s=t&_m.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 a=n,l=a+r-1;for(;a<=l;){const c=a+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 sy;(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"})(sy||(sy={}));var Tu;(function(e){e.NO_QUIRKS="no-quirks",e.QUIRKS="quirks",e.LIMITED_QUIRKS="limited-quirks"})(Tu||(Tu={}));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 Yjt=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 s1(e){var t;return(t=Yjt.get(e))!==null&&t!==void 0?t:$.UNKNOWN}const Pt=$,Zjt={[_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},C8=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 ke;(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"})(ke||(ke={}));const go={DATA:ke.DATA,RCDATA:ke.RCDATA,RAWTEXT:ke.RAWTEXT,SCRIPT_DATA:ke.SCRIPT_DATA,PLAINTEXT:ke.PLAINTEXT,CDATA_SECTION:ke.CDATA_SECTION};function Jjt(e){return e>=me.DIGIT_0&&e<=me.DIGIT_9}function sk(e){return e>=me.LATIN_CAPITAL_A&&e<=me.LATIN_CAPITAL_Z}function eNt(e){return e>=me.LATIN_SMALL_A&&e<=me.LATIN_SMALL_Z}function nm(e){return eNt(e)||sk(e)}function Ute(e){return nm(e)||Jjt(e)}function hA(e){return e+32}function HDe(e){return e===me.SPACE||e===me.LINE_FEED||e===me.TABULATION||e===me.FORM_FEED}function Qte(e){return HDe(e)||e===me.SOLIDUS||e===me.GREATER_THAN_SIGN}function tNt(e){return e===me.NULL?at.nullCharacterReference:e>1114111?at.characterReferenceOutsideUnicodeRange:UDe(e)?at.surrogateCharacterReference:zDe(e)?at.noncharacterCharacterReference:QDe(e)||e===me.CARRIAGE_RETURN?at.controlCharacterReference:null}class nNt{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=ke.DATA,this.returnState=ke.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:"",value:""},this.preprocessor=new Ujt(n),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new Gjt(Qjt,(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=tNt(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 Ei.CHARACTER:{this.handler.onCharacter(this.currentCharacterToken);break}case Ei.NULL_CHARACTER:{this.handler.onNullCharacter(this.currentCharacterToken);break}case Ei.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:Ei.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=HDe(t)?Ei.WHITESPACE_CHARACTER:t===me.NULL?Ei.NULL_CHARACTER:Ei.CHARACTER;this._appendCharToCurrentCharacterToken(n,String.fromCodePoint(t))}_emitChars(t){this._appendCharToCurrentCharacterToken(Ei.CHARACTER,t)}_startCharacterReference(){this.returnState=this.state,this.state=ke.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?Rh.Attribute:Rh.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===ke.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===ke.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===ke.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(t){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(t):this._emitCodePoint(t)}_callState(t){switch(this.state){case ke.DATA:{this._stateData(t);break}case ke.RCDATA:{this._stateRcdata(t);break}case ke.RAWTEXT:{this._stateRawtext(t);break}case ke.SCRIPT_DATA:{this._stateScriptData(t);break}case ke.PLAINTEXT:{this._statePlaintext(t);break}case ke.TAG_OPEN:{this._stateTagOpen(t);break}case ke.END_TAG_OPEN:{this._stateEndTagOpen(t);break}case ke.TAG_NAME:{this._stateTagName(t);break}case ke.RCDATA_LESS_THAN_SIGN:{this._stateRcdataLessThanSign(t);break}case ke.RCDATA_END_TAG_OPEN:{this._stateRcdataEndTagOpen(t);break}case ke.RCDATA_END_TAG_NAME:{this._stateRcdataEndTagName(t);break}case ke.RAWTEXT_LESS_THAN_SIGN:{this._stateRawtextLessThanSign(t);break}case ke.RAWTEXT_END_TAG_OPEN:{this._stateRawtextEndTagOpen(t);break}case ke.RAWTEXT_END_TAG_NAME:{this._stateRawtextEndTagName(t);break}case ke.SCRIPT_DATA_LESS_THAN_SIGN:{this._stateScriptDataLessThanSign(t);break}case ke.SCRIPT_DATA_END_TAG_OPEN:{this._stateScriptDataEndTagOpen(t);break}case ke.SCRIPT_DATA_END_TAG_NAME:{this._stateScriptDataEndTagName(t);break}case ke.SCRIPT_DATA_ESCAPE_START:{this._stateScriptDataEscapeStart(t);break}case ke.SCRIPT_DATA_ESCAPE_START_DASH:{this._stateScriptDataEscapeStartDash(t);break}case ke.SCRIPT_DATA_ESCAPED:{this._stateScriptDataEscaped(t);break}case ke.SCRIPT_DATA_ESCAPED_DASH:{this._stateScriptDataEscapedDash(t);break}case ke.SCRIPT_DATA_ESCAPED_DASH_DASH:{this._stateScriptDataEscapedDashDash(t);break}case ke.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataEscapedLessThanSign(t);break}case ke.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:{this._stateScriptDataEscapedEndTagOpen(t);break}case ke.SCRIPT_DATA_ESCAPED_END_TAG_NAME:{this._stateScriptDataEscapedEndTagName(t);break}case ke.SCRIPT_DATA_DOUBLE_ESCAPE_START:{this._stateScriptDataDoubleEscapeStart(t);break}case ke.SCRIPT_DATA_DOUBLE_ESCAPED:{this._stateScriptDataDoubleEscaped(t);break}case ke.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:{this._stateScriptDataDoubleEscapedDash(t);break}case ke.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:{this._stateScriptDataDoubleEscapedDashDash(t);break}case ke.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataDoubleEscapedLessThanSign(t);break}case ke.SCRIPT_DATA_DOUBLE_ESCAPE_END:{this._stateScriptDataDoubleEscapeEnd(t);break}case ke.BEFORE_ATTRIBUTE_NAME:{this._stateBeforeAttributeName(t);break}case ke.ATTRIBUTE_NAME:{this._stateAttributeName(t);break}case ke.AFTER_ATTRIBUTE_NAME:{this._stateAfterAttributeName(t);break}case ke.BEFORE_ATTRIBUTE_VALUE:{this._stateBeforeAttributeValue(t);break}case ke.ATTRIBUTE_VALUE_DOUBLE_QUOTED:{this._stateAttributeValueDoubleQuoted(t);break}case ke.ATTRIBUTE_VALUE_SINGLE_QUOTED:{this._stateAttributeValueSingleQuoted(t);break}case ke.ATTRIBUTE_VALUE_UNQUOTED:{this._stateAttributeValueUnquoted(t);break}case ke.AFTER_ATTRIBUTE_VALUE_QUOTED:{this._stateAfterAttributeValueQuoted(t);break}case ke.SELF_CLOSING_START_TAG:{this._stateSelfClosingStartTag(t);break}case ke.BOGUS_COMMENT:{this._stateBogusComment(t);break}case ke.MARKUP_DECLARATION_OPEN:{this._stateMarkupDeclarationOpen(t);break}case ke.COMMENT_START:{this._stateCommentStart(t);break}case ke.COMMENT_START_DASH:{this._stateCommentStartDash(t);break}case ke.COMMENT:{this._stateComment(t);break}case ke.COMMENT_LESS_THAN_SIGN:{this._stateCommentLessThanSign(t);break}case ke.COMMENT_LESS_THAN_SIGN_BANG:{this._stateCommentLessThanSignBang(t);break}case ke.COMMENT_LESS_THAN_SIGN_BANG_DASH:{this._stateCommentLessThanSignBangDash(t);break}case ke.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:{this._stateCommentLessThanSignBangDashDash(t);break}case ke.COMMENT_END_DASH:{this._stateCommentEndDash(t);break}case ke.COMMENT_END:{this._stateCommentEnd(t);break}case ke.COMMENT_END_BANG:{this._stateCommentEndBang(t);break}case ke.DOCTYPE:{this._stateDoctype(t);break}case ke.BEFORE_DOCTYPE_NAME:{this._stateBeforeDoctypeName(t);break}case ke.DOCTYPE_NAME:{this._stateDoctypeName(t);break}case ke.AFTER_DOCTYPE_NAME:{this._stateAfterDoctypeName(t);break}case ke.AFTER_DOCTYPE_PUBLIC_KEYWORD:{this._stateAfterDoctypePublicKeyword(t);break}case ke.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateBeforeDoctypePublicIdentifier(t);break}case ke.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypePublicIdentifierDoubleQuoted(t);break}case ke.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypePublicIdentifierSingleQuoted(t);break}case ke.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateAfterDoctypePublicIdentifier(t);break}case ke.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:{this._stateBetweenDoctypePublicAndSystemIdentifiers(t);break}case ke.AFTER_DOCTYPE_SYSTEM_KEYWORD:{this._stateAfterDoctypeSystemKeyword(t);break}case ke.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateBeforeDoctypeSystemIdentifier(t);break}case ke.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypeSystemIdentifierDoubleQuoted(t);break}case ke.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypeSystemIdentifierSingleQuoted(t);break}case ke.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateAfterDoctypeSystemIdentifier(t);break}case ke.BOGUS_DOCTYPE:{this._stateBogusDoctype(t);break}case ke.CDATA_SECTION:{this._stateCdataSection(t);break}case ke.CDATA_SECTION_BRACKET:{this._stateCdataSectionBracket(t);break}case ke.CDATA_SECTION_END:{this._stateCdataSectionEnd(t);break}case ke.CHARACTER_REFERENCE:{this._stateCharacterReference();break}case ke.AMBIGUOUS_AMPERSAND:{this._stateAmbiguousAmpersand(t);break}default:throw new Error("Unknown state")}}_stateData(t){switch(t){case me.LESS_THAN_SIGN:{this.state=ke.TAG_OPEN;break}case me.AMPERSAND:{this._startCharacterReference();break}case me.NULL:{this._err(at.unexpectedNullCharacter),this._emitCodePoint(t);break}case me.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRcdata(t){switch(t){case me.AMPERSAND:{this._startCharacterReference();break}case me.LESS_THAN_SIGN:{this.state=ke.RCDATA_LESS_THAN_SIGN;break}case me.NULL:{this._err(at.unexpectedNullCharacter),this._emitChars(Ss);break}case me.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRawtext(t){switch(t){case me.LESS_THAN_SIGN:{this.state=ke.RAWTEXT_LESS_THAN_SIGN;break}case me.NULL:{this._err(at.unexpectedNullCharacter),this._emitChars(Ss);break}case me.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptData(t){switch(t){case me.LESS_THAN_SIGN:{this.state=ke.SCRIPT_DATA_LESS_THAN_SIGN;break}case me.NULL:{this._err(at.unexpectedNullCharacter),this._emitChars(Ss);break}case me.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_statePlaintext(t){switch(t){case me.NULL:{this._err(at.unexpectedNullCharacter),this._emitChars(Ss);break}case me.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateTagOpen(t){if(nm(t))this._createStartTagToken(),this.state=ke.TAG_NAME,this._stateTagName(t);else switch(t){case me.EXCLAMATION_MARK:{this.state=ke.MARKUP_DECLARATION_OPEN;break}case me.SOLIDUS:{this.state=ke.END_TAG_OPEN;break}case me.QUESTION_MARK:{this._err(at.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=ke.BOGUS_COMMENT,this._stateBogusComment(t);break}case me.EOF:{this._err(at.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken();break}default:this._err(at.invalidFirstCharacterOfTagName),this._emitChars("<"),this.state=ke.DATA,this._stateData(t)}}_stateEndTagOpen(t){if(nm(t))this._createEndTagToken(),this.state=ke.TAG_NAME,this._stateTagName(t);else switch(t){case me.GREATER_THAN_SIGN:{this._err(at.missingEndTagName),this.state=ke.DATA;break}case me.EOF:{this._err(at.eofBeforeTagName),this._emitChars("");break}case me.NULL:{this._err(at.unexpectedNullCharacter),this.state=ke.SCRIPT_DATA_ESCAPED,this._emitChars(Ss);break}case me.EOF:{this._err(at.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=ke.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedLessThanSign(t){t===me.SOLIDUS?this.state=ke.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:nm(t)?(this._emitChars("<"),this.state=ke.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(t)):(this._emitChars("<"),this.state=ke.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataEscapedEndTagOpen(t){nm(t)?(this.state=ke.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(t)):(this._emitChars("");break}case me.NULL:{this._err(at.unexpectedNullCharacter),this.state=ke.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(Ss);break}case me.EOF:{this._err(at.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=ke.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedLessThanSign(t){t===me.SOLIDUS?(this.state=ke.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars("/")):(this.state=ke.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(t))}_stateScriptDataDoubleEscapeEnd(t){if(this.preprocessor.startsWith(Hl.SCRIPT,!1)&&Qte(this.preprocessor.peek(Hl.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(aNt,_t.HTML)}clearBackToTableBodyContext(){this.clearBackTo(oNt,_t.HTML)}clearBackToTableRowContext(){this.clearBackTo(sNt,_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(Hte.has(r))return!1;break}case _t.MATHML:{if(Vte.has(r))return!1;break}}}return!0}hasInScope(t){return this.hasInDynamicScope(t,aR)}hasInListItemScope(t){return this.hasInDynamicScope(t,iNt)}hasInButtonScope(t){return this.hasInDynamicScope(t,rNt)}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(C8.has(n))return!0;if(aR.has(n))return!1;break}case _t.SVG:{if(Hte.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&&qDe.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&zte.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(t){for(;this.currentTagId!==void 0&&this.currentTagId!==t&&zte.has(this.currentTagId);)this.pop()}}const r3=3;var ff;(function(e){e[e.Marker=0]="Marker",e[e.Element=1]="Element"})(ff||(ff={}));const qte={type:ff.Marker};class uNt{constructor(t){this.treeAdapter=t,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(t,n){const i=[],r=n.length,s=this.treeAdapter.getTagName(t),a=this.treeAdapter.getNamespaceURI(t);for(let l=0;l[a.name,a.value]));let s=0;for(let a=0;ar.get(c.name)===c.value)&&(s+=1,s>=r3&&this.entries.splice(l.idx,1))}}insertMarker(){this.entries.unshift(qte)}pushElement(t,n){this._ensureNoahArkCondition(t),this.entries.unshift({type:ff.Element,element:t,token:n})}insertElementAfterBookmark(t,n){const i=this.entries.indexOf(this.bookmark);this.entries.splice(i,0,{type:ff.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(qte);t===-1?this.entries.length=0:this.entries.splice(0,t+1)}getElementEntryInScopeWithTagName(t){const n=this.entries.find(i=>i.type===ff.Marker||this.treeAdapter.getTagName(i.element)===t);return n&&n.type===ff.Element?n:null}getElementEntry(t){return this.entries.find(n=>n.type===ff.Element&&n.element===t)}}const im={createDocument(){return{nodeName:"#document",mode:Tu.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};im.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(im.isTextNode(n)){n.value+=t;return}}im.appendChild(e,im.createTextNode(t))},insertTextBefore(e,t,n){const i=e.childNodes[e.childNodes.indexOf(n)-1];i&&im.isTextNode(i)?i.value+=t:im.insertBefore(e,im.createTextNode(t),n)},adoptAttributes(e,t){const n=new Set(e.attrs.map(i=>i.name));for(let i=0;ie.startsWith(n))}function gNt(e){return e.name===WDe&&e.publicId===null&&(e.systemId===null||e.systemId===dNt)}function bNt(e){if(e.name!==WDe)return Tu.QUIRKS;const{systemId:t}=e;if(t&&t.toLowerCase()===fNt)return Tu.QUIRKS;let{publicId:n}=e;if(n!==null){if(n=n.toLowerCase(),pNt.has(n))return Tu.QUIRKS;let i=t===null?hNt:KDe;if(Wte(n,i))return Tu.QUIRKS;if(i=t===null?GDe:mNt,Wte(n,i))return Tu.LIMITED_QUIRKS}return Tu.NO_QUIRKS}const Kte={TEXT_HTML:"text/html",APPLICATION_XML:"application/xhtml+xml"},yNt="definitionurl",vNt="definitionURL",xNt=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])),wNt=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}]]),ONt=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])),kNt=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 SNt(e){const t=e.tagID;return t===$.FONT&&e.attrs.some(({name:i})=>i===sy.COLOR||i===sy.SIZE||i===sy.FACE)||kNt.has(t)}function XDe(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,a;this.openElements.stackTop===0&&this.fragmentContext?(s=this.fragmentContext,a=this.fragmentContextID):{current:s,currentTagId:a}=this.openElements,this._setContextModes(s,a)}}_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=Re.TEXT}switchToPlaintextParsing(){this.insertionMode=Re.TEXT,this.originalInsertionMode=Re.IN_BODY,this.tokenizer.state=go.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=go.RCDATA;break}case $.STYLE:case $.XMP:case $.IFRAME:case $.NOEMBED:case $.NOFRAMES:case $.NOSCRIPT:{this.tokenizer.state=go.RAWTEXT;break}case $.SCRIPT:{this.tokenizer.state=go.SCRIPT_DATA;break}case $.PLAINTEXT:{this.tokenizer.state=go.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 a=this.treeAdapter.getChildNodes(this.document).find(l=>this.treeAdapter.isDocumentTypeNode(l));a&&this.treeAdapter.setNodeSourceCodeLocation(a,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,a=r[s-1];if(this.treeAdapter.getNodeSourceCodeLocation(a)){const{endLine:c,endCol:u,endOffset:d}=t.location;this.treeAdapter.updateNodeSourceCodeLocation(a,{endLine:c,endCol:u,endOffset:d})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(a,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===Ei.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 Ei.CHARACTER:{this.onCharacter(t);break}case Ei.NULL_CHARACTER:{this.onNullCharacter(t);break}case Ei.COMMENT:{this.onComment(t);break}case Ei.DOCTYPE:{this.onDoctype(t);break}case Ei.START_TAG:{this._processStartTag(t);break}case Ei.END_TAG:{this.onEndTag(t);break}case Ei.EOF:{this.onEof(t);break}case Ei.WHITESPACE_CHARACTER:{this.onWhitespaceCharacter(t);break}}}_isIntegrationPoint(t,n,i){const r=this.treeAdapter.getNamespaceURI(n),s=this.treeAdapter.getAttrList(n);return ANt(t,r,s,i)}_reconstructActiveFormattingElements(){const t=this.activeFormattingElements.entries.length;if(t){const n=this.activeFormattingElements.entries.findIndex(r=>r.type===ff.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=Re.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=Re.IN_ROW;return}case $.TBODY:case $.THEAD:case $.TFOOT:{this.insertionMode=Re.IN_TABLE_BODY;return}case $.CAPTION:{this.insertionMode=Re.IN_CAPTION;return}case $.COLGROUP:{this.insertionMode=Re.IN_COLUMN_GROUP;return}case $.TABLE:{this.insertionMode=Re.IN_TABLE;return}case $.BODY:{this.insertionMode=Re.IN_BODY;return}case $.FRAMESET:{this.insertionMode=Re.IN_FRAMESET;return}case $.SELECT:{this._resetInsertionModeForSelect(t);return}case $.TEMPLATE:{this.insertionMode=this.tmplInsertionModeStack[0];return}case $.HTML:{this.insertionMode=this.headElement?Re.AFTER_HEAD:Re.BEFORE_HEAD;return}case $.TD:case $.TH:{if(t>0){this.insertionMode=Re.IN_CELL;return}break}case $.HEAD:{if(t>0){this.insertionMode=Re.IN_HEAD;return}break}}this.insertionMode=Re.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=Re.IN_SELECT_IN_TABLE;return}}this.insertionMode=Re.IN_SELECT}_isElementCausesFosterParenting(t){return ZDe.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 Zjt[i].has(n)}onCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){lIt(this,t);return}switch(this.insertionMode){case Re.INITIAL:{bO(this,t);break}case Re.BEFORE_HTML:{Jk(this,t);break}case Re.BEFORE_HEAD:{eS(this,t);break}case Re.IN_HEAD:{tS(this,t);break}case Re.IN_HEAD_NO_SCRIPT:{nS(this,t);break}case Re.AFTER_HEAD:{iS(this,t);break}case Re.IN_BODY:case Re.IN_CAPTION:case Re.IN_CELL:case Re.IN_TEMPLATE:{eMe(this,t);break}case Re.TEXT:case Re.IN_SELECT:case Re.IN_SELECT_IN_TABLE:{this._insertCharacters(t);break}case Re.IN_TABLE:case Re.IN_TABLE_BODY:case Re.IN_ROW:{s3(this,t);break}case Re.IN_TABLE_TEXT:{oMe(this,t);break}case Re.IN_COLUMN_GROUP:{lR(this,t);break}case Re.AFTER_BODY:{cR(this,t);break}case Re.AFTER_AFTER_BODY:{cj(this,t);break}}}onNullCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){aIt(this,t);return}switch(this.insertionMode){case Re.INITIAL:{bO(this,t);break}case Re.BEFORE_HTML:{Jk(this,t);break}case Re.BEFORE_HEAD:{eS(this,t);break}case Re.IN_HEAD:{tS(this,t);break}case Re.IN_HEAD_NO_SCRIPT:{nS(this,t);break}case Re.AFTER_HEAD:{iS(this,t);break}case Re.TEXT:{this._insertCharacters(t);break}case Re.IN_TABLE:case Re.IN_TABLE_BODY:case Re.IN_ROW:{s3(this,t);break}case Re.IN_COLUMN_GROUP:{lR(this,t);break}case Re.AFTER_BODY:{cR(this,t);break}case Re.AFTER_AFTER_BODY:{cj(this,t);break}}}onComment(t){if(this.skipNextNewLine=!1,this.currentNotInHTML){T8(this,t);return}switch(this.insertionMode){case Re.INITIAL:case Re.BEFORE_HTML:case Re.BEFORE_HEAD:case Re.IN_HEAD:case Re.IN_HEAD_NO_SCRIPT:case Re.AFTER_HEAD:case Re.IN_BODY:case Re.IN_TABLE:case Re.IN_CAPTION:case Re.IN_COLUMN_GROUP:case Re.IN_TABLE_BODY:case Re.IN_ROW:case Re.IN_CELL:case Re.IN_SELECT:case Re.IN_SELECT_IN_TABLE:case Re.IN_TEMPLATE:case Re.IN_FRAMESET:case Re.AFTER_FRAMESET:{T8(this,t);break}case Re.IN_TABLE_TEXT:{yO(this,t);break}case Re.AFTER_BODY:{FNt(this,t);break}case Re.AFTER_AFTER_BODY:case Re.AFTER_AFTER_FRAMESET:{BNt(this,t);break}}}onDoctype(t){switch(this.skipNextNewLine=!1,this.insertionMode){case Re.INITIAL:{UNt(this,t);break}case Re.BEFORE_HEAD:case Re.IN_HEAD:case Re.IN_HEAD_NO_SCRIPT:case Re.AFTER_HEAD:{this._err(t,at.misplacedDoctype);break}case Re.IN_TABLE_TEXT:{yO(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)?cIt(this,t):this._startTagOutsideForeignContent(t)}_startTagOutsideForeignContent(t){switch(this.insertionMode){case Re.INITIAL:{bO(this,t);break}case Re.BEFORE_HTML:{QNt(this,t);break}case Re.BEFORE_HEAD:{VNt(this,t);break}case Re.IN_HEAD:{zd(this,t);break}case Re.IN_HEAD_NO_SCRIPT:{WNt(this,t);break}case Re.AFTER_HEAD:{GNt(this,t);break}case Re.IN_BODY:{ul(this,t);break}case Re.IN_TABLE:{hw(this,t);break}case Re.IN_TABLE_TEXT:{yO(this,t);break}case Re.IN_CAPTION:{HRt(this,t);break}case Re.IN_COLUMN_GROUP:{CV(this,t);break}case Re.IN_TABLE_BODY:{oD(this,t);break}case Re.IN_ROW:{aD(this,t);break}case Re.IN_CELL:{KRt(this,t);break}case Re.IN_SELECT:{cMe(this,t);break}case Re.IN_SELECT_IN_TABLE:{XRt(this,t);break}case Re.IN_TEMPLATE:{ZRt(this,t);break}case Re.AFTER_BODY:{eIt(this,t);break}case Re.IN_FRAMESET:{tIt(this,t);break}case Re.AFTER_FRAMESET:{iIt(this,t);break}case Re.AFTER_AFTER_BODY:{sIt(this,t);break}case Re.AFTER_AFTER_FRAMESET:{oIt(this,t);break}}}onEndTag(t){this.skipNextNewLine=!1,this.currentToken=t,this.currentNotInHTML?uIt(this,t):this._endTagOutsideForeignContent(t)}_endTagOutsideForeignContent(t){switch(this.insertionMode){case Re.INITIAL:{bO(this,t);break}case Re.BEFORE_HTML:{zNt(this,t);break}case Re.BEFORE_HEAD:{HNt(this,t);break}case Re.IN_HEAD:{qNt(this,t);break}case Re.IN_HEAD_NO_SCRIPT:{KNt(this,t);break}case Re.AFTER_HEAD:{XNt(this,t);break}case Re.IN_BODY:{sD(this,t);break}case Re.TEXT:{DRt(this,t);break}case Re.IN_TABLE:{OE(this,t);break}case Re.IN_TABLE_TEXT:{yO(this,t);break}case Re.IN_CAPTION:{qRt(this,t);break}case Re.IN_COLUMN_GROUP:{WRt(this,t);break}case Re.IN_TABLE_BODY:{A8(this,t);break}case Re.IN_ROW:{lMe(this,t);break}case Re.IN_CELL:{GRt(this,t);break}case Re.IN_SELECT:{uMe(this,t);break}case Re.IN_SELECT_IN_TABLE:{YRt(this,t);break}case Re.IN_TEMPLATE:{JRt(this,t);break}case Re.AFTER_BODY:{fMe(this,t);break}case Re.IN_FRAMESET:{nIt(this,t);break}case Re.AFTER_FRAMESET:{rIt(this,t);break}case Re.AFTER_AFTER_BODY:{cj(this,t);break}}}onEof(t){switch(this.insertionMode){case Re.INITIAL:{bO(this,t);break}case Re.BEFORE_HTML:{Jk(this,t);break}case Re.BEFORE_HEAD:{eS(this,t);break}case Re.IN_HEAD:{tS(this,t);break}case Re.IN_HEAD_NO_SCRIPT:{nS(this,t);break}case Re.AFTER_HEAD:{iS(this,t);break}case Re.IN_BODY:case Re.IN_TABLE:case Re.IN_CAPTION:case Re.IN_COLUMN_GROUP:case Re.IN_TABLE_BODY:case Re.IN_ROW:case Re.IN_CELL:case Re.IN_SELECT:case Re.IN_SELECT_IN_TABLE:{rMe(this,t);break}case Re.TEXT:{MRt(this,t);break}case Re.IN_TABLE_TEXT:{yO(this,t);break}case Re.IN_TEMPLATE:{dMe(this,t);break}case Re.AFTER_BODY:case Re.IN_FRAMESET:case Re.AFTER_FRAMESET:case Re.AFTER_AFTER_BODY:case Re.AFTER_AFTER_FRAMESET:{EV(this,t);break}}}onWhitespaceCharacter(t){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,t.chars.charCodeAt(0)===me.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 Re.IN_HEAD:case Re.IN_HEAD_NO_SCRIPT:case Re.AFTER_HEAD:case Re.TEXT:case Re.IN_COLUMN_GROUP:case Re.IN_SELECT:case Re.IN_SELECT_IN_TABLE:case Re.IN_FRAMESET:case Re.AFTER_FRAMESET:{this._insertCharacters(t);break}case Re.IN_BODY:case Re.IN_CAPTION:case Re.IN_CELL:case Re.IN_TEMPLATE:case Re.AFTER_BODY:case Re.AFTER_AFTER_BODY:case Re.AFTER_AFTER_FRAMESET:{JDe(this,t);break}case Re.IN_TABLE:case Re.IN_TABLE_BODY:case Re.IN_ROW:{s3(this,t);break}case Re.IN_TABLE_TEXT:{sMe(this,t);break}}}};function INt(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):iMe(e,t),n}function PNt(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 DNt(e,t,n){let i=t,r=e.openElements.getCommonAncestor(t);for(let s=0,a=r;a!==n;s++,a=r){r=e.openElements.getCommonAncestor(a);const l=e.activeFormattingElements.getElementEntry(a),c=l&&s>=NNt;!l||c?(c&&e.activeFormattingElements.removeEntry(l),e.openElements.remove(a)):(a=MNt(e,l),i===t&&(e.activeFormattingElements.bookmark=l),e.treeAdapter.detachNode(i),e.treeAdapter.appendChild(a,i),i=a)}return i}function MNt(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 LNt(e,t,n){const i=e.treeAdapter.getTagName(t),r=s1(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 $Nt(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 SV(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],a=e.treeAdapter.getNodeSourceCodeLocation(s);a&&!a.endTag&&e._setEndLocation(s,t)}}}}function UNt(e,t){e._setDocumentType(t);const n=t.forceQuirks?Tu.QUIRKS:bNt(t);gNt(t)||e._err(t,at.nonConformingDoctype),e.treeAdapter.setDocumentMode(e.document,n),e.insertionMode=Re.BEFORE_HTML}function bO(e,t){e._err(t,at.missingDoctype,!0),e.treeAdapter.setDocumentMode(e.document,Tu.QUIRKS),e.insertionMode=Re.BEFORE_HTML,e._processToken(t)}function QNt(e,t){t.tagID===$.HTML?(e._insertElement(t,_t.HTML),e.insertionMode=Re.BEFORE_HEAD):Jk(e,t)}function zNt(e,t){const n=t.tagID;(n===$.HTML||n===$.HEAD||n===$.BODY||n===$.BR)&&Jk(e,t)}function Jk(e,t){e._insertFakeRootElement(),e.insertionMode=Re.BEFORE_HEAD,e._processToken(t)}function VNt(e,t){switch(t.tagID){case $.HTML:{ul(e,t);break}case $.HEAD:{e._insertElement(t,_t.HTML),e.headElement=e.openElements.current,e.insertionMode=Re.IN_HEAD;break}default:eS(e,t)}}function HNt(e,t){const n=t.tagID;n===$.HEAD||n===$.BODY||n===$.HTML||n===$.BR?eS(e,t):e._err(t,at.endTagWithoutMatchingOpenElement)}function eS(e,t){e._insertFakeElement(Xe.HEAD,$.HEAD),e.headElement=e.openElements.current,e.insertionMode=Re.IN_HEAD,e._processToken(t)}function zd(e,t){switch(t.tagID){case $.HTML:{ul(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,go.RCDATA);break}case $.NOSCRIPT:{e.options.scriptingEnabled?e._switchToTextParsing(t,go.RAWTEXT):(e._insertElement(t,_t.HTML),e.insertionMode=Re.IN_HEAD_NO_SCRIPT);break}case $.NOFRAMES:case $.STYLE:{e._switchToTextParsing(t,go.RAWTEXT);break}case $.SCRIPT:{e._switchToTextParsing(t,go.SCRIPT_DATA);break}case $.TEMPLATE:{e._insertTemplate(t),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=Re.IN_TEMPLATE,e.tmplInsertionModeStack.unshift(Re.IN_TEMPLATE);break}case $.HEAD:{e._err(t,at.misplacedStartTagForHeadElement);break}default:tS(e,t)}}function qNt(e,t){switch(t.tagID){case $.HEAD:{e.openElements.pop(),e.insertionMode=Re.AFTER_HEAD;break}case $.BODY:case $.BR:case $.HTML:{tS(e,t);break}case $.TEMPLATE:{l0(e,t);break}default:e._err(t,at.endTagWithoutMatchingOpenElement)}}function l0(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 tS(e,t){e.openElements.pop(),e.insertionMode=Re.AFTER_HEAD,e._processToken(t)}function WNt(e,t){switch(t.tagID){case $.HTML:{ul(e,t);break}case $.BASEFONT:case $.BGSOUND:case $.HEAD:case $.LINK:case $.META:case $.NOFRAMES:case $.STYLE:{zd(e,t);break}case $.NOSCRIPT:{e._err(t,at.nestedNoscriptInHead);break}default:nS(e,t)}}function KNt(e,t){switch(t.tagID){case $.NOSCRIPT:{e.openElements.pop(),e.insertionMode=Re.IN_HEAD;break}case $.BR:{nS(e,t);break}default:e._err(t,at.endTagWithoutMatchingOpenElement)}}function nS(e,t){const n=t.type===Ei.EOF?at.openElementsLeftAfterEof:at.disallowedContentInNoscriptInHead;e._err(t,n),e.openElements.pop(),e.insertionMode=Re.IN_HEAD,e._processToken(t)}function GNt(e,t){switch(t.tagID){case $.HTML:{ul(e,t);break}case $.BODY:{e._insertElement(t,_t.HTML),e.framesetOk=!1,e.insertionMode=Re.IN_BODY;break}case $.FRAMESET:{e._insertElement(t,_t.HTML),e.insertionMode=Re.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),zd(e,t),e.openElements.remove(e.headElement);break}case $.HEAD:{e._err(t,at.misplacedStartTagForHeadElement);break}default:iS(e,t)}}function XNt(e,t){switch(t.tagID){case $.BODY:case $.HTML:case $.BR:{iS(e,t);break}case $.TEMPLATE:{l0(e,t);break}default:e._err(t,at.endTagWithoutMatchingOpenElement)}}function iS(e,t){e._insertFakeElement(Xe.BODY,$.BODY),e.insertionMode=Re.IN_BODY,rD(e,t)}function rD(e,t){switch(t.type){case Ei.CHARACTER:{eMe(e,t);break}case Ei.WHITESPACE_CHARACTER:{JDe(e,t);break}case Ei.COMMENT:{T8(e,t);break}case Ei.START_TAG:{ul(e,t);break}case Ei.END_TAG:{sD(e,t);break}case Ei.EOF:{rMe(e,t);break}}}function JDe(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t)}function eMe(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1}function YNt(e,t){e.openElements.tmplCount===0&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs)}function ZNt(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e.openElements.tmplCount===0&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(n,t.attrs))}function JNt(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();e.framesetOk&&n&&(e.treeAdapter.detachNode(n),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,_t.HTML),e.insertionMode=Re.IN_FRAMESET)}function eRt(e,t){e.openElements.hasInButtonScope($.P)&&e._closePElement(),e._insertElement(t,_t.HTML)}function tRt(e,t){e.openElements.hasInButtonScope($.P)&&e._closePElement(),e.openElements.currentTagId!==void 0&&C8.has(e.openElements.currentTagId)&&e.openElements.pop(),e._insertElement(t,_t.HTML)}function nRt(e,t){e.openElements.hasInButtonScope($.P)&&e._closePElement(),e._insertElement(t,_t.HTML),e.skipNextNewLine=!0,e.framesetOk=!1}function iRt(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 rRt(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 sRt(e,t){e.openElements.hasInButtonScope($.P)&&e._closePElement(),e._insertElement(t,_t.HTML),e.tokenizer.state=go.PLAINTEXT}function oRt(e,t){e.openElements.hasInScope($.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped($.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,_t.HTML),e.framesetOk=!1}function aRt(e,t){const n=e.activeFormattingElements.getElementEntryInScopeWithTagName(Xe.A);n&&(SV(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 lRt(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,_t.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function cRt(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope($.NOBR)&&(SV(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,_t.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function uRt(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,_t.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1}function dRt(e,t){e.treeAdapter.getDocumentMode(e.document)!==Tu.QUIRKS&&e.openElements.hasInButtonScope($.P)&&e._closePElement(),e._insertElement(t,_t.HTML),e.framesetOk=!1,e.insertionMode=Re.IN_TABLE}function tMe(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,_t.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function nMe(e){const t=VDe(e,sy.TYPE);return t!=null&&t.toLowerCase()===_Nt}function fRt(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,_t.HTML),nMe(t)||(e.framesetOk=!1),t.ackSelfClosing=!0}function hRt(e,t){e._appendElement(t,_t.HTML),t.ackSelfClosing=!0}function pRt(e,t){e.openElements.hasInButtonScope($.P)&&e._closePElement(),e._appendElement(t,_t.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function mRt(e,t){t.tagName=Xe.IMG,t.tagID=$.IMG,tMe(e,t)}function gRt(e,t){e._insertElement(t,_t.HTML),e.skipNextNewLine=!0,e.tokenizer.state=go.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=Re.TEXT}function bRt(e,t){e.openElements.hasInButtonScope($.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,go.RAWTEXT)}function yRt(e,t){e.framesetOk=!1,e._switchToTextParsing(t,go.RAWTEXT)}function Yte(e,t){e._switchToTextParsing(t,go.RAWTEXT)}function vRt(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,_t.HTML),e.framesetOk=!1,e.insertionMode=e.insertionMode===Re.IN_TABLE||e.insertionMode===Re.IN_CAPTION||e.insertionMode===Re.IN_TABLE_BODY||e.insertionMode===Re.IN_ROW||e.insertionMode===Re.IN_CELL?Re.IN_SELECT_IN_TABLE:Re.IN_SELECT}function xRt(e,t){e.openElements.currentTagId===$.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,_t.HTML)}function wRt(e,t){e.openElements.hasInScope($.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,_t.HTML)}function ORt(e,t){e.openElements.hasInScope($.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion($.RTC),e._insertElement(t,_t.HTML)}function kRt(e,t){e._reconstructActiveFormattingElements(),XDe(t),kV(t),t.selfClosing?e._appendElement(t,_t.MATHML):e._insertElement(t,_t.MATHML),t.ackSelfClosing=!0}function SRt(e,t){e._reconstructActiveFormattingElements(),YDe(t),kV(t),t.selfClosing?e._appendElement(t,_t.SVG):e._insertElement(t,_t.SVG),t.ackSelfClosing=!0}function Zte(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,_t.HTML)}function ul(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:{lRt(e,t);break}case $.A:{aRt(e,t);break}case $.H1:case $.H2:case $.H3:case $.H4:case $.H5:case $.H6:{tRt(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:{eRt(e,t);break}case $.LI:case $.DD:case $.DT:{rRt(e,t);break}case $.BR:case $.IMG:case $.WBR:case $.AREA:case $.EMBED:case $.KEYGEN:{tMe(e,t);break}case $.HR:{pRt(e,t);break}case $.RB:case $.RTC:{wRt(e,t);break}case $.RT:case $.RP:{ORt(e,t);break}case $.PRE:case $.LISTING:{nRt(e,t);break}case $.XMP:{bRt(e,t);break}case $.SVG:{SRt(e,t);break}case $.HTML:{YNt(e,t);break}case $.BASE:case $.LINK:case $.META:case $.STYLE:case $.TITLE:case $.SCRIPT:case $.BGSOUND:case $.BASEFONT:case $.TEMPLATE:{zd(e,t);break}case $.BODY:{ZNt(e,t);break}case $.FORM:{iRt(e,t);break}case $.NOBR:{cRt(e,t);break}case $.MATH:{kRt(e,t);break}case $.TABLE:{dRt(e,t);break}case $.INPUT:{fRt(e,t);break}case $.PARAM:case $.TRACK:case $.SOURCE:{hRt(e,t);break}case $.IMAGE:{mRt(e,t);break}case $.BUTTON:{oRt(e,t);break}case $.APPLET:case $.OBJECT:case $.MARQUEE:{uRt(e,t);break}case $.IFRAME:{yRt(e,t);break}case $.SELECT:{vRt(e,t);break}case $.OPTION:case $.OPTGROUP:{xRt(e,t);break}case $.NOEMBED:case $.NOFRAMES:{Yte(e,t);break}case $.FRAMESET:{JNt(e,t);break}case $.TEXTAREA:{gRt(e,t);break}case $.NOSCRIPT:{e.options.scriptingEnabled?Yte(e,t):Zte(e,t);break}case $.PLAINTEXT:{sRt(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:Zte(e,t)}}function ERt(e,t){if(e.openElements.hasInScope($.BODY)&&(e.insertionMode=Re.AFTER_BODY,e.options.sourceCodeLocationInfo)){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e._setEndLocation(n,t)}}function CRt(e,t){e.openElements.hasInScope($.BODY)&&(e.insertionMode=Re.AFTER_BODY,fMe(e,t))}function TRt(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n))}function ARt(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 _Rt(e){e.openElements.hasInButtonScope($.P)||e._insertFakeElement(Xe.P,$.P),e._closePElement()}function jRt(e){e.openElements.hasInListItemScope($.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion($.LI),e.openElements.popUntilTagNamePopped($.LI))}function NRt(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.popUntilTagNamePopped(n))}function RRt(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped())}function IRt(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker())}function PRt(e){e._reconstructActiveFormattingElements(),e._insertFakeElement(Xe.BR,$.BR),e.openElements.pop(),e.framesetOk=!1}function iMe(e,t){const n=t.tagName,i=t.tagID;for(let r=e.openElements.stackTop;r>0;r--){const s=e.openElements.items[r],a=e.openElements.tagIDs[r];if(i===a&&(i!==$.UNKNOWN||e.treeAdapter.getTagName(s)===n)){e.openElements.generateImpliedEndTagsWithExclusion(i),e.openElements.stackTop>=r&&e.openElements.shortenToLength(r);break}if(e._isSpecialElement(s,a))break}}function sD(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:{SV(e,t);break}case $.P:{_Rt(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:{TRt(e,t);break}case $.LI:{jRt(e);break}case $.DD:case $.DT:{NRt(e,t);break}case $.H1:case $.H2:case $.H3:case $.H4:case $.H5:case $.H6:{RRt(e);break}case $.BR:{PRt(e);break}case $.BODY:{ERt(e,t);break}case $.HTML:{CRt(e,t);break}case $.FORM:{ARt(e);break}case $.APPLET:case $.OBJECT:case $.MARQUEE:{IRt(e,t);break}case $.TEMPLATE:{l0(e,t);break}default:iMe(e,t)}}function rMe(e,t){e.tmplInsertionModeStack.length>0?dMe(e,t):EV(e,t)}function DRt(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 MRt(e,t){e._err(t,at.eofInElementThatCanContainOnlyText),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e.onEof(t)}function s3(e,t){if(e.openElements.currentTagId!==void 0&&ZDe.has(e.openElements.currentTagId))switch(e.pendingCharacterTokens.length=0,e.hasNonWhitespacePendingCharacterToken=!1,e.originalInsertionMode=e.insertionMode,e.insertionMode=Re.IN_TABLE_TEXT,t.type){case Ei.CHARACTER:{oMe(e,t);break}case Ei.WHITESPACE_CHARACTER:{sMe(e,t);break}}else rT(e,t)}function LRt(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,_t.HTML),e.insertionMode=Re.IN_CAPTION}function $Rt(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,_t.HTML),e.insertionMode=Re.IN_COLUMN_GROUP}function FRt(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(Xe.COLGROUP,$.COLGROUP),e.insertionMode=Re.IN_COLUMN_GROUP,CV(e,t)}function BRt(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,_t.HTML),e.insertionMode=Re.IN_TABLE_BODY}function URt(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(Xe.TBODY,$.TBODY),e.insertionMode=Re.IN_TABLE_BODY,oD(e,t)}function QRt(e,t){e.openElements.hasInTableScope($.TABLE)&&(e.openElements.popUntilTagNamePopped($.TABLE),e._resetInsertionMode(),e._processStartTag(t))}function zRt(e,t){nMe(t)?e._appendElement(t,_t.HTML):rT(e,t),t.ackSelfClosing=!0}function VRt(e,t){!e.formElement&&e.openElements.tmplCount===0&&(e._insertElement(t,_t.HTML),e.formElement=e.openElements.current,e.openElements.pop())}function hw(e,t){switch(t.tagID){case $.TD:case $.TH:case $.TR:{URt(e,t);break}case $.STYLE:case $.SCRIPT:case $.TEMPLATE:{zd(e,t);break}case $.COL:{FRt(e,t);break}case $.FORM:{VRt(e,t);break}case $.TABLE:{QRt(e,t);break}case $.TBODY:case $.TFOOT:case $.THEAD:{BRt(e,t);break}case $.INPUT:{zRt(e,t);break}case $.CAPTION:{LRt(e,t);break}case $.COLGROUP:{$Rt(e,t);break}default:rT(e,t)}}function OE(e,t){switch(t.tagID){case $.TABLE:{e.openElements.hasInTableScope($.TABLE)&&(e.openElements.popUntilTagNamePopped($.TABLE),e._resetInsertionMode());break}case $.TEMPLATE:{l0(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:rT(e,t)}}function rT(e,t){const n=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,rD(e,t),e.fosterParentingEnabled=n}function sMe(e,t){e.pendingCharacterTokens.push(t)}function oMe(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0}function yO(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:{l0(e,t);break}}}function XRt(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)):cMe(e,t)}function YRt(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)):uMe(e,t)}function ZRt(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:{zd(e,t);break}case $.CAPTION:case $.COLGROUP:case $.TBODY:case $.TFOOT:case $.THEAD:{e.tmplInsertionModeStack[0]=Re.IN_TABLE,e.insertionMode=Re.IN_TABLE,hw(e,t);break}case $.COL:{e.tmplInsertionModeStack[0]=Re.IN_COLUMN_GROUP,e.insertionMode=Re.IN_COLUMN_GROUP,CV(e,t);break}case $.TR:{e.tmplInsertionModeStack[0]=Re.IN_TABLE_BODY,e.insertionMode=Re.IN_TABLE_BODY,oD(e,t);break}case $.TD:case $.TH:{e.tmplInsertionModeStack[0]=Re.IN_ROW,e.insertionMode=Re.IN_ROW,aD(e,t);break}default:e.tmplInsertionModeStack[0]=Re.IN_BODY,e.insertionMode=Re.IN_BODY,ul(e,t)}}function JRt(e,t){t.tagID===$.TEMPLATE&&l0(e,t)}function dMe(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped($.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode(),e.onEof(t)):EV(e,t)}function eIt(e,t){t.tagID===$.HTML?ul(e,t):cR(e,t)}function fMe(e,t){var n;if(t.tagID===$.HTML){if(e.fragmentContext||(e.insertionMode=Re.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 cR(e,t)}function cR(e,t){e.insertionMode=Re.IN_BODY,rD(e,t)}function tIt(e,t){switch(t.tagID){case $.HTML:{ul(e,t);break}case $.FRAMESET:{e._insertElement(t,_t.HTML);break}case $.FRAME:{e._appendElement(t,_t.HTML),t.ackSelfClosing=!0;break}case $.NOFRAMES:{zd(e,t);break}}}function nIt(e,t){t.tagID===$.FRAMESET&&!e.openElements.isRootHtmlElementCurrent()&&(e.openElements.pop(),!e.fragmentContext&&e.openElements.currentTagId!==$.FRAMESET&&(e.insertionMode=Re.AFTER_FRAMESET))}function iIt(e,t){switch(t.tagID){case $.HTML:{ul(e,t);break}case $.NOFRAMES:{zd(e,t);break}}}function rIt(e,t){t.tagID===$.HTML&&(e.insertionMode=Re.AFTER_AFTER_FRAMESET)}function sIt(e,t){t.tagID===$.HTML?ul(e,t):cj(e,t)}function cj(e,t){e.insertionMode=Re.IN_BODY,rD(e,t)}function oIt(e,t){switch(t.tagID){case $.HTML:{ul(e,t);break}case $.NOFRAMES:{zd(e,t);break}}}function aIt(e,t){t.chars=Ss,e._insertCharacters(t)}function lIt(e,t){e._insertCharacters(t),e.framesetOk=!1}function hMe(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 cIt(e,t){if(SNt(t))hMe(e),e._startTagOutsideForeignContent(t);else{const n=e._getAdjustedCurrentElement(),i=e.treeAdapter.getNamespaceURI(n);i===_t.MATHML?XDe(t):i===_t.SVG&&(ENt(t),YDe(t)),kV(t),t.selfClosing?e._appendElement(t,i):e._insertElement(t,i),t.ackSelfClosing=!0}}function uIt(e,t){if(t.tagID===$.P||t.tagID===$.BR){hMe(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 dIt=/<(\/?)(iframe|noembed|noframes|plaintext|script|style|textarea|title|xmp)(?=[\t\n\f\r />])/gi,fIt=new Set(["mdxFlowExpression","mdxJsxFlowElement","mdxJsxTextElement","mdxTextExpression","mdxjsEsm"]),Jte={sourceCodeLocationInfo:!0,scriptingEnabled:!1};function pMe(e,t){const n=OIt(e),i=TPe("type",{handlers:{root:hIt,element:pIt,text:mIt,comment:gMe,doctype:gIt,raw:yIt},unknown:vIt}),r={parser:n?new Xte(Jte):Xte.getFragmentParser(void 0,Jte),handle(l){i(l,r)},stitches:!1,options:t||{}};i(e,r),o1(r,Wf());const s=n?r.parser.document:r.parser.getFragment(),a=kjt(s,{file:r.options.file});return r.stitches&&nT(a,"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}}),a.type==="root"&&a.children.length===1&&a.children[0].type===e.type?a.children[0]:a}function mMe(e,t){let n=-1;if(e)for(;++n4&&(t.parser.tokenizer.state=0);const n={type:Ei.CHARACTER,chars:e.value,location:sT(e)};o1(t,Wf(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function gIt(e,t){const n={type:Ei.DOCTYPE,name:"html",forceQuirks:!1,publicId:"",systemId:"",location:sT(e)};o1(t,Wf(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function bIt(e,t){t.stitches=!0;const n=kIt(e);if("children"in e&&"children"in n){const i=pMe({type:"root",children:e.children},t.options);n.children=i.children}gMe({type:"comment",value:{stitch:n}},t)}function gMe(e,t){const n=e.value,i={type:Ei.COMMENT,data:n,location:sT(e)};o1(t,Wf(e)),t.parser.currentToken=i,t.parser._processToken(t.parser.currentToken)}function yIt(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,bMe(t,Wf(e)),t.parser.tokenizer.write(t.options.tagfilter?e.value.replace(dIt,"<$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 vIt(e,t){const n=e;if(t.options.passThrough&&t.options.passThrough.includes(n.type))bIt(n,t);else{let i="";throw fIt.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 o1(e,t){bMe(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=go.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 bMe(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 xIt(e,t){const n=e.tagName.toLowerCase();if(t.parser.tokenizer.state===go.PLAINTEXT)return;o1(t,Wf(e));const i=t.parser.openElements.current;let r="namespaceURI"in i?i.namespaceURI:$b.html;r===$b.html&&n==="svg"&&(r=$b.svg);const s=Ajt({...e,children:[]},{space:r===$b.svg?"svg":"html"}),a={type:Ei.START_TAG,tagName:n,tagID:s1(n),selfClosing:!1,ackSelfClosing:!1,attrs:"attrs"in s?s.attrs:[],location:sT(e)};t.parser.currentToken=a,t.parser._processToken(t.parser.currentToken),t.parser.tokenizer.lastStartTagName=n}function wIt(e,t){const n=e.tagName.toLowerCase();if(!t.parser.tokenizer.inForeignNode&&Mjt.includes(n)||t.parser.tokenizer.state===go.PLAINTEXT)return;o1(t,YP(e));const i={type:Ei.END_TAG,tagName:n,tagID:s1(n),selfClosing:!1,ackSelfClosing:!1,attrs:[],location:sT(e)};t.parser.currentToken=i,t.parser._processToken(t.parser.currentToken),n===t.parser.tokenizer.lastStartTagName&&(t.parser.tokenizer.state===go.RCDATA||t.parser.tokenizer.state===go.RAWTEXT||t.parser.tokenizer.state===go.SCRIPT_DATA)&&(t.parser.tokenizer.state=go.DATA)}function OIt(e){const t=e.type==="root"?e.children[0]:e;return!!(t&&(t.type==="doctype"||t.type==="element"&&t.tagName.toLowerCase()==="html"))}function sT(e){const t=Wf(e)||{line:void 0,column:void 0,offset:void 0},n=YP(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 kIt(e){return"children"in e?dw({...e,children:[]}):dw(e)}function SIt(e){return function(t,n){return pMe(t,{...e,file:n})}}const EIt="modulepreload",CIt=function(e){return"/"+e},ene={},Ls=function(t,n,i){let r=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));r=Promise.allSettled(n.map(c=>{if(c=CIt(c),c in ene)return;ene[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":EIt,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(a){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=a,window.dispatchEvent(l),!l.defaultPrevented)throw a}return r.then(a=>{for(const l of a||[])l.status==="rejected"&&s(l.reason);return t().catch(s)})};var TIt=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,AIt=/[\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]/,_It=/[\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]/,o3={Space_Separator:TIt,ID_Start:AIt,ID_Continue:_It},lo={isSpaceSeparator(e){return typeof e=="string"&&o3.Space_Separator.test(e)},isIdStartChar(e){return typeof e=="string"&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="$"||e==="_"||o3.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==="‍"||o3.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 _8,Cl,Ih,uR,pg,jd,fa,TV,rS;var jIt=function(t,n){_8=String(t),Cl="start",Ih=[],uR=0,pg=1,jd=0,fa=void 0,TV=void 0,rS=void 0;do fa=NIt(),PIt[Cl]();while(fa.type!=="eof");return typeof n=="function"?j8({"":rS},"",n):rS};function j8(e,t,n){const i=e[t];if(i!=null&&typeof i=="object")if(Array.isArray(i))for(let r=0;r30)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"&&BIt.test(e.trim()))throw new Error("ECharts option contains an external resource");if(Array.isArray(e)){for(const n of e)fR(n,t+1);return}if(ak(e))for(const[n,i]of Object.entries(e)){if(FIt.has(n))throw new Error("ECharts option contains an unsafe key");fR(i,t+1)}}function UIt(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 QIt(e,t){let n=1,i="",r=!1,s=!1,a=!1;for(let l=t+1;li+2)throw new Error("Invalid ECharts gradient argument count");const r=n.slice(0,i).map(zIt),s=n[i],a=n[i+1]??!1;if(!Array.isArray(s)||typeof a!="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:a}:{type:e,x:r[0],y:r[1],r:r[2],colorStops:s,global:a}}function HIt(e,t){const n=/^(?:new\s+)?echarts\.graphic\.(LinearGradient|RadialGradient)\s*\(/;let i="",r=!1,s=!1,a=!1;for(let l=t;l$It)throw new Error("ECharts option is too large");const n=qIt(UIt(e));let i;try{i=xMe.parse(n)}catch(a){throw/\bfunction\s*\(|=>/.test(n)?new Error("ECharts function callbacks are not supported"):a}if(!ak(i))throw new Error("ECharts option must be a data object");fR(i);const r={...i};r.aria={...ak(r.aria)?r.aria:{},enabled:!0};const s=r.tooltip;return ak(s)?r.tooltip={...s,renderMode:"richText"}:Array.isArray(s)&&(r.tooltip=s.map(a=>ak(a)?{...a,renderMode:"richText"}:a)),t&&(r.animation=!1),r}let l3;function WIt(){return l3??(l3=Ls(()=>import("../visualizations/echarts/index-CGT341lL.js"),[]).catch(e=>{throw l3=void 0,e})),l3}function KIt({source:e}){const{t}=_e("conversation"),n=p.useRef(null),[i,r]=p.useState(!1),[s,a]=p.useState("");return p.useEffect(()=>{let l=!1,c,u,d;r(!1);try{d=wMe(e,window.matchMedia("(prefers-reduced-motion: reduce)").matches),a("")}catch{a("invalid");return}return WIt().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||a("render")}),()=>{l=!0,u==null||u.disconnect(),c==null||c.dispose()}},[e]),o.jsxs("div",{className:`echarts-diagram${s?" echarts-diagram--error":""}`,role:"img","aria-label":t("visualization.echartsAria"),"aria-busy":!i&&!s,children:[o.jsx("div",{ref:n,className:"echarts-diagram__canvas",hidden:!!s}),!i&&!s?o.jsx("div",{className:"echarts-diagram__state","aria-live":"polite",children:o.jsx(bn,{duration:2.2,spread:15,children:t("visualization.rendering")})}):null,s?o.jsx("p",{className:"echarts-diagram__error",role:"alert",children:t(s==="invalid"?"visualization.invalidEcharts":"visualization.renderFailed")}):null]})}const GIt=p.memo(KIt);let nne,ine=Promise.resolve(),XIt=0;function YIt(){return nne??(nne=Ls(async()=>{const{default:e}=await import("../visualizations/mermaid/mermaid.core-D4lqlGFD.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))),nne}function ZIt(e){const t=ine.then(async()=>{const n=await YIt(),i=`mermaid-diagram-${XIt+=1}`;return n.render(i,e)});return ine=t.then(()=>{},()=>{}),t}function JIt({source:e}){const{t}=_e("conversation"),n=p.useRef(null),[i,r]=p.useState(null),[s,a]=p.useState(!1);return p.useEffect(()=>{let l=!1;return r(null),a(!1),ZIt(e).then(c=>{l||r(c)}).catch(()=>{l||a(!0)}),()=>{l=!0}},[e]),p.useEffect(()=>{!(i!=null&&i.bindFunctions)||!n.current||i.bindFunctions(n.current)},[i]),s?o.jsx("div",{className:"mermaid-diagram mermaid-diagram--error",children:o.jsx("p",{className:"mermaid-diagram__error",role:"alert",children:t("visualization.mermaidFailed")})}):i?o.jsx("div",{ref:n,className:"mermaid-diagram",role:"img","aria-label":t("visualization.mermaidAria"),dangerouslySetInnerHTML:{__html:i.svg}}):o.jsx("div",{className:"mermaid-diagram mermaid-diagram--loading","aria-live":"polite",children:o.jsx(bn,{duration:2.2,spread:15,children:t("visualization.rendering")})})}const ePt=p.memo(JIt),tPt="_SegmentedControl_1sl7d_1",nPt="_SegmentedControlOption_1sl7d_140",iPt="_SegmentedControlThumb_1sl7d_219",R8={SegmentedControl:tPt,SegmentedControlOption:nPt,SegmentedControlThumb:iPt},Ru=({value:e,onChange:t,children:n,block:i,pill:r=!0,size:s="md",gutterSize:a,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"})}},[]);SAe({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||PN(()=>{b.style.transition="width 300ms var(--cubic-enter), transform 300ms var(--cubic-enter)"}))},[h,e,s,a,r]);const m=g=>{g&&t&&t(g)};return o.jsxs(Tct,{ref:d,className:Ci(R8.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":a,...u,children:[o.jsx("div",{className:R8.SegmentedControlThumb,ref:f}),n]})},rPt=({children:e,...t})=>o.jsx(Rct,{className:R8.SegmentedControlOption,...t,onPointerEnter:OQ,children:o.jsx("span",{className:"relative",children:e})});Ru.Option=rPt;function sPt({children:e,label:t,language:n,source:i,streaming:r=!1}){const{t:s}=_e("conversation"),[a,l]=p.useState("preview"),c=r?"code":a;return o.jsxs("section",{className:"visualization-card","aria-label":s("visualization.cardAria",{label:t}),children:[o.jsx("div",{className:"visualization-card__toolbar",children:o.jsxs(Ru,{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:[o.jsx(Ru.Option,{value:"preview",disabled:r,children:s("visualization.preview")}),o.jsx(Ru.Option,{value:"code",children:s("visualization.code")})]})}),o.jsx("div",{className:"visualization-card__body",children:c==="code"?o.jsx("pre",{className:"visualization-card__code",children:o.jsx("code",{className:`language-${n}`,children:i})}):e})]})}const oPt=p.memo(sPt);function OMe(e){const t=e==null?void 0:e.trim().toLowerCase();if(t==="mermaid")return"mermaid";if(t==="echart"||t==="echarts")return"echarts"}const kMe=[".mp4",".webm",".mov",".m4v",".ogg",".avi"];function I8(e){return typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(I8).join(""):p.isValidElement(e)?I8(e.props.children):""}function aPt(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 OMe(n==null?void 0:n.slice(9))}function SMe(e){if(!e)return!1;try{const t=e.toLowerCase();return kMe.some(n=>t.includes(n))}catch{return!1}}function lPt(e){var i;const t=(i=e==null?void 0:e.properties)==null?void 0:i.href;if(!t)return!1;if(SMe(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 kMe.some(s=>r.includes(s))}return!1}function cPt({text:e,className:t,allowRawHtml:n=!0,streaming:i=!1}){const{t:r}=_e("conversation"),[s,a]=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 o.jsxs("div",{className:t?`md ${t}`:"md",children:[o.jsx(OPe,{remarkPlugins:[WPe],rehypePlugins:n?[SIt,Mte]:[Mte],components:{pre:({node:d,children:f,...h})=>{const m=aPt(f);if(m==="mermaid"||m==="echarts"){const g=I8(f).replace(/\n$/,"");return o.jsx(oPt,{label:m==="mermaid"?"Mermaid":"ECharts",language:m,source:g,streaming:i,children:m==="mermaid"?o.jsx(ePt,{source:g}):o.jsx(GIt,{source:g})})}return o.jsx("pre",{...h,children:f})},a:({node:d,...f})=>{const h=f.href;if(h&&(SMe(h)||lPt(d))){const m=h,g=u(d==null?void 0:d.children);return o.jsxs("div",{className:"video-container",children:[o.jsxs("button",{type:"button",className:"video-preview-trigger","aria-label":r("markdown.playVideo",{name:g}),onClick:()=>a({src:m,title:g}),children:[o.jsx("video",{src:m,playsInline:!0,className:"video-thumbnail",preload:"metadata"}),o.jsx("span",{className:"video-preview-hint","aria-hidden":"true",children:o.jsx(ox,{})})]}),o.jsx("div",{className:"video-caption",children:o.jsx("a",{href:m,target:"_blank",rel:"noopener noreferrer",className:"video-link-text",children:g})})]})}return o.jsx("a",{...f,target:"_blank",rel:"noopener noreferrer"})},img:({node:d,src:f,alt:h,...m})=>{const g=o.jsx("img",{...m,src:f,alt:h??"",loading:"lazy"});return f?o.jsx(xEe,{src:f,children:o.jsxs("button",{type:"button",className:"image-preview-trigger","aria-label":r("markdown.enlargeImage",{name:h||r("markdown.image")}),children:[g,o.jsx("span",{className:"image-preview-hint","aria-hidden":"true",children:o.jsx(ox,{})})]})}):g},video:({node:d,src:f,children:h,...m})=>{const g=l({src:f},h);return g?o.jsx("div",{className:"video-container",children:o.jsxs("button",{type:"button",className:"video-preview-trigger","aria-label":r("markdown.enlargeVideo"),onClick:()=>a({src:g}),children:[o.jsx("video",{src:g,...m,playsInline:!0,className:"video-thumbnail",children:h}),o.jsx("span",{className:"video-preview-hint","aria-hidden":"true",children:o.jsx(ox,{})})]})}):o.jsx("video",{src:f,controls:!0,playsInline:!0,className:"video-inline",...m,children:h})}},children:e}),s&&o.jsx("div",{className:"video-viewer-backdrop",role:"dialog","aria-modal":"true","aria-label":r("markdown.videoPreview"),onClick:()=>a(null),children:o.jsxs("div",{className:"video-viewer",onClick:d=>d.stopPropagation(),children:[o.jsxs("div",{className:"video-viewer-header",children:[o.jsx("div",{className:"video-viewer-title",children:s.title||c(s.src)}),o.jsxs("nav",{className:"video-viewer-nav",children:[o.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:o.jsx(mP,{})}),o.jsx("button",{type:"button",className:"video-viewer-close","aria-label":r("markdown.close"),onClick:()=>a(null),children:o.jsx(ka,{})})]})]}),o.jsx("div",{className:"video-viewer-body",children:o.jsx("video",{src:s.src,controls:!0,autoPlay:!0,playsInline:!0,className:"video-fullscreen"})})]})})]})}const Zu=p.memo(cPt);function c3(e){return(e==null?void 0:e.trim())||Dg("resourceMetadata.unknownSource")}function EMe(e){return(e==null?void 0:e.trim())||Dg("resourceMetadata.unknownCreator")}function uPt(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.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"}),o.jsx("path",{d:"M5 18.5A2.5 2.5 0 0 1 7.5 16H19"}),o.jsx("path",{d:"M9 7h6M9 10h4"})]})}function dPt(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M6 3h8l4 4v14H6V3Z"}),o.jsx("path",{d:"M14 3v5h5M9 12h6M9 16h6"})]})}function fPt(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m7 7 10 10M17 7 7 17"})})}function hPt(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"M12 5v14M5 12h14"})})}function oT({title:e,children:t,onClose:n,busy:i=!1,className:r=""}){const{t:s}=_e("ui"),a=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()}},[]),Jn.createPortal(o.jsx("div",{className:"knowledge-dialog-backdrop",onMouseDown:f=>{f.target===f.currentTarget&&!i&&n()},children:o.jsxs("section",{ref:c,className:`knowledge-dialog${r?` ${r}`:""}`,role:"dialog","aria-modal":"true","aria-labelledby":a,"aria-busy":i||void 0,children:[o.jsxs("header",{className:"knowledge-dialog__header",children:[o.jsx("h2",{id:a,children:e}),o.jsx("button",{ref:l,type:"button",onClick:n,disabled:i,"aria-label":s("common.close"),children:o.jsx(fPt,{})})]}),t]})}),document.body)}function kE({message:e}){return e?o.jsx("div",{className:"knowledge-form-error",role:"alert",children:e}):null}function P8(e){return e instanceof DOMException&&e.name==="AbortError"}function pPt(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 CMe=[".jpg",".jpeg",".png"].join(","),mPt=new Set(CMe.split(",")),TMe=[".pdf",".pptx",".docx",".xlsx",".txt"].join(","),gPt=new Set(TMe.split(",")),bPt=200*1024*1024;function D8(e){const t=e.lastIndexOf(".");return t<0?"":e.slice(t).toLocaleLowerCase()}function yPt(e,t,n){return e.size>bPt?n("knowledge.errors.fileTooLarge"):t==="image"?mPt.has(D8(e.name))?"":n("knowledge.errors.invalidImageType"):gPt.has(D8(e.name))?"":n("knowledge.errors.invalidDocumentType")}function AV(e){return e<=0?"-":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function M8(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 vPt({region:e,onClose:t,onCreated:n}){const{t:i}=_e("ui"),[r,s]=p.useState(""),[a,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:a.trim()||void 0,region:e};try{n(await tOt(x))}catch(w){m(il(w,i("knowledge.errors.createBase")))}finally{f(!1)}};return o.jsx(oT,{title:i("knowledge.createBase"),onClose:t,busy:d,children:o.jsxs("form",{onSubmit:y=>void v(y),children:[o.jsxs("div",{className:"knowledge-dialog__body",children:[o.jsxs("label",{children:[o.jsx("span",{children:i("common.name")}),o.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)})]}),o.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")}),o.jsxs("label",{children:[o.jsx("span",{children:i("knowledge.optionalDescription")}),o.jsx("textarea",{value:a,maxLength:80,onChange:y=>l(y.target.value)})]}),o.jsx(kE,{message:h})]}),o.jsxs("footer",{className:"knowledge-dialog__actions",children:[o.jsx("button",{type:"button",onClick:t,disabled:d,children:i("common.cancel")}),o.jsx("button",{type:"submit",className:"is-primary",disabled:d||!g||b,children:i(d?"common.creating":"common.create")})]})]})})}function xPt({item:e,onClose:t,onUpdated:n}){const{t:i}=_e("ui"),[r,s]=p.useState(e.description),[a,l]=p.useState(!1),[c,u]=p.useState(""),d=async f=>{f.preventDefault(),l(!0),u("");try{n(await nOt(e.id,e.region,{description:r.trim()}))}catch(h){u(il(h,i("knowledge.errors.updateBase")))}finally{l(!1)}};return o.jsx(oT,{title:i("knowledge.editBase"),onClose:t,busy:a,children:o.jsxs("form",{onSubmit:f=>void d(f),children:[o.jsxs("div",{className:"knowledge-dialog__body",children:[o.jsxs("label",{children:[o.jsx("span",{children:i("common.name")}),o.jsx("input",{value:e.name,disabled:!0})]}),o.jsxs("label",{children:[o.jsx("span",{children:i("common.description")}),o.jsx("textarea",{autoFocus:!0,value:r,maxLength:80,onChange:f=>s(f.target.value)})]}),o.jsx("p",{className:"knowledge-dialog__note",children:i("knowledge.descriptionOnly")}),o.jsx(kE,{message:c})]}),o.jsxs("footer",{className:"knowledge-dialog__actions",children:[o.jsx("button",{type:"button",onClick:t,disabled:a,children:i("common.cancel")}),o.jsx("button",{type:"submit",className:"is-primary",disabled:a,children:i(a?"common.saving":"common.save")})]})]})})}function AMe(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 wPt({base:e,onClose:t,onCreated:n,onAssociationInvalid:i}){const{t:r}=_e("ui"),[s,a]=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),N=p.useRef(null),A=p.useRef(null),j=p.useRef(null),T=p.useRef(0),R=!!w;p.useEffect(()=>{var L;C&&!R&&((L=j.current)==null||L.focus())},[R,C]);const _=L=>{R||L===s||(a(L),g(null),h(""),c(""),d(""),k(""),E(null),v(!1),T.current=0,N.current&&(N.current.value=""))},D=L=>{if(!L||s==="web")return;const F=yPt(L,s,r);if(F){g(null),c(""),d(""),k(F);return}g(L),k(""),c(L.name.replace(/\.[^.]+$/,"")),d(D8(L.name).slice(1))},M=async L=>{if(L.preventDefault(),s==="web"?!f.trim():!m)return;let F;try{F=AMe(y,r("knowledge.errors.metadataObject"))}catch(I){k(il(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 oOt(e.id,e.region,I),n()}else{const I=await aOt(e.id,e.region,{url:f.trim()});if(!I.sourceMarkdown.trim())throw new Error(r("knowledge.errors.noWebPreview"));E({preview:I,metadata:F})}else m&&(await lOt(e.id,e.region,{file:m,name:l.trim()||void 0,documentType:u.trim()||void 0,metadata:F}),n())}catch(I){I instanceof KP&&I.errorCode===DIe?i(I):k(il(I,r(s==="web"?C?"knowledge.errors.addWeb":"knowledge.errors.previewWeb":"knowledge.errors.uploadFile")))}finally{O("")}},P=()=>{R||(E(null),k(""),requestAnimationFrame(()=>{var L;return(L=A.current)==null?void 0:L.focus()}))};return o.jsx(oT,{title:r(C?"knowledge.previewWeb":"knowledge.addData"),onClose:t,busy:R,className:C?"knowledge-dialog--preview knowledge-dialog--web-confirm":"",children:o.jsx("form",{onSubmit:L=>void M(L),children:C?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"knowledge-preview knowledge-web-preview",children:[o.jsxs("div",{className:"knowledge-preview__meta",children:[o.jsx("strong",{title:C.preview.name,children:C.preview.name}),o.jsx("a",{href:C.preview.url,target:"_blank",rel:"noopener noreferrer",children:r("knowledge.openOriginalWeb")})]}),o.jsx("div",{className:"knowledge-preview__body","aria-live":"polite",children:o.jsx("div",{className:"knowledge-preview__markdown-shell",children:o.jsx(Zu,{text:C.preview.sourceMarkdown,allowRawHtml:!1,className:"knowledge-preview__markdown"})})}),S?o.jsx("div",{className:"knowledge-web-preview__error",children:o.jsx(kE,{message:S})}):null]}),o.jsxs("footer",{className:"knowledge-dialog__actions",children:[o.jsx("button",{type:"button",className:"is-back",onClick:P,disabled:R,children:r("knowledge.backToEdit")}),o.jsx("button",{type:"button",onClick:t,disabled:R,children:r("common.cancel")}),o.jsx("button",{ref:j,type:"submit",className:"is-primary",disabled:R,children:r(w==="save"?"common.adding":"knowledge.confirmAdd")})]})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"knowledge-dialog__body",children:[o.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,F])=>o.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:R,onClick:()=>_(L),onKeyDown:I=>{const z=["image","document","web"];if(!["ArrowLeft","ArrowRight","Home","End"].includes(I.key))return;I.preventDefault();const K=z.indexOf(L),B=I.key==="Home"?z[0]:I.key==="End"?z[z.length-1]:z[(K+(I.key==="ArrowRight"?1:-1)+z.length)%z.length];_(B),requestAnimationFrame(()=>{var W;return(W=document.getElementById(`knowledge-source-${B}-tab`))==null?void 0:W.focus()})},children:F},L))}),o.jsx("div",{id:`knowledge-source-${s}-panel`,className:"knowledge-source-panel",role:"tabpanel","aria-labelledby":`knowledge-source-${s}-tab`,children:s==="web"?o.jsxs(o.Fragment,{children:[o.jsxs("label",{children:[o.jsx("span",{children:r("knowledge.webUrl")}),o.jsx("input",{ref:A,autoFocus:!0,type:"url",value:f,disabled:R,onChange:L=>{h(L.target.value),k("")},placeholder:"https://example.com/article"})]}),o.jsx("div",{className:"knowledge-upload-status",role:"status","aria-live":"polite",children:w==="preview"?o.jsx(bn,{children:r("knowledge.generatingWebPreview")}):null})]}):o.jsxs(o.Fragment,{children:[o.jsx("input",{ref:N,className:"knowledge-upload-input",type:"file","aria-label":r("knowledge.selectFile"),accept:s==="image"?CMe:TMe,disabled:R,onChange:L=>{var F;D(((F=L.currentTarget.files)==null?void 0:F[0])??null),L.currentTarget.value=""}}),o.jsxs("button",{type:"button",className:`knowledge-upload-dropzone${b?" is-dragging":""}${m?" is-ready":""}`,disabled:R,onClick:()=>{var L;return(L=N.current)==null?void 0:L.click()},onDragEnter:L=>{L.preventDefault(),!R&&(T.current+=1,v(!0))},onDragOver:L=>{L.preventDefault(),R||(L.dataTransfer.dropEffect="copy")},onDragLeave:L=>{L.preventDefault(),T.current=Math.max(0,T.current-1),T.current===0&&v(!1)},onDrop:L=>{var F;L.preventDefault(),T.current=0,v(!1),R||D(((F=L.dataTransfer.files)==null?void 0:F[0])??null)},children:[o.jsx("strong",{children:m?m.name:r("knowledge.selectOrDropFile")}),o.jsx("span",{children:m?r("knowledge.selectedFile",{size:AV(m.size)}):r(s==="image"?"knowledge.imageFileHelp":"knowledge.documentFileHelp")})]}),o.jsx("div",{className:"knowledge-upload-status",role:"status","aria-live":"polite",children:R?o.jsx(bn,{children:r("knowledge.uploadingFile")}):null})]})}),s!=="web"?o.jsxs("div",{className:"knowledge-dialog__fields",children:[o.jsxs("label",{children:[o.jsx("span",{children:r("knowledge.optionalName")}),o.jsx("input",{value:l,disabled:R,maxLength:256,onChange:L=>c(L.target.value)})]}),o.jsxs("label",{children:[o.jsx("span",{children:r("knowledge.optionalType")}),o.jsx("input",{value:u,disabled:R,maxLength:64,onChange:L=>d(L.target.value),placeholder:"pdf, docx, png"})]})]}):null,o.jsxs("label",{children:[o.jsx("span",{children:r("knowledge.metadataJson")}),o.jsx("textarea",{className:"is-code",value:y,disabled:R,onChange:L=>x(L.target.value),spellCheck:!1})]}),o.jsx(kE,{message:S})]}),o.jsxs("footer",{className:"knowledge-dialog__actions",children:[o.jsx("button",{type:"button",onClick:t,disabled:R,children:r("common.cancel")}),o.jsx("button",{type:"submit",className:"is-primary",disabled:R||(s==="web"?!f.trim():!m),children:r(R?s==="web"?"common.generating":"common.uploading":s==="web"?"knowledge.generatePreview":"knowledge.uploadFile")})]})]})})})}function OPt({base:e,item:t,onClose:n,onUpdated:i}){const{t:r}=_e("ui"),[s,a]=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=AMe(s,r("knowledge.errors.metadataObject"))}catch(g){d(il(g,r("knowledge.errors.metadataFormat")));return}c(!0),d("");try{i(await cOt(e.id,t.id,e.region,{metadata:m}))}catch(g){d(il(g,r("knowledge.errors.updateDocument")))}finally{c(!1)}};return o.jsx(oT,{title:r("knowledge.editMetadata"),onClose:n,busy:l,children:o.jsxs("form",{onSubmit:h=>void f(h),children:[o.jsxs("div",{className:"knowledge-dialog__body",children:[o.jsxs("label",{children:[o.jsx("span",{children:r("knowledge.knowledge")}),o.jsx("input",{value:t.name||t.id,disabled:!0})]}),o.jsxs("label",{children:[o.jsx("span",{children:r("knowledge.metadataJson")}),o.jsx("textarea",{autoFocus:!0,className:"is-code knowledge-metadata-editor",value:s,onChange:h=>a(h.target.value),spellCheck:!1})]}),o.jsx(kE,{message:u})]}),o.jsxs("footer",{className:"knowledge-dialog__actions",children:[o.jsx("button",{type:"button",onClick:n,disabled:l,children:r("common.cancel")}),o.jsx("button",{type:"submit",className:"is-primary",disabled:l,children:r(l?"common.saving":"common.save")})]})]})})}const _Me=new Set(["avif","bmp","gif","jpeg","jpg","png","svg","webp"]),jMe=new Set(["aac","flac","m4a","mp3","ogg","wav","webm"]),NMe=new Set(["m4v","mov","mp4","mpeg","mpg","ogg","webm"]),kPt=new Set(["pdf"]),SPt=new Set(["doc","docx","ppt","pptx","xls","xlsx"]),EPt=new Set(["creating","indexing","pending","processing","queued","submitted"]),CPt=new Set(["error","failed","unavailable"]);function rne(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:{}}function mA(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 TPt(e,t){if(Array.isArray(e)){if(e.length===0)return null;const r=e.map(rne);if(r.some(s=>Object.keys(s).length>0)){const s=[...new Set(r.flatMap(a=>Object.keys(a)))];return{columns:s,rows:r.map(a=>s.map(l=>mA(a[l])))}}return{columns:[t("knowledge.value")],rows:e.map(s=>[mA(s)])}}const n=rne(e),i=Object.entries(n);if(i.length===0)return null;if(i.every(([,r])=>Array.isArray(r))){const r=i.map(([a])=>a),s=Math.max(...i.map(([,a])=>a.length));return{columns:r,rows:Array.from({length:s},(a,l)=>i.map(([,c])=>mA(c[l])))}}return{columns:[t("knowledge.field"),t("knowledge.value")],rows:i.map(([r,s])=>[r,mA(s)])}}function RMe(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 APt(e){const t=RMe(e);return t.startsWith("http://")||t.startsWith("https://")?t:""}function _Pt(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 _Me.has(i)?"image":jMe.has(i)?"audio":NMe.has(i)?"video":kPt.has(i)?"pdf":t||i?"file":"none"}function jPt(e,t){const n=e.status.trim().toLocaleLowerCase();if(EPt.has(n))return{title:t("knowledge.preview.processingTitle"),detail:t("knowledge.preview.processingDetail")};if(CPt.has(n))return{title:t("knowledge.preview.failedTitle"),detail:t("knowledge.preview.failedDetail")};const i=M8(e).toLocaleLowerCase();return i==="pdf"||SPt.has(i)?{title:t("knowledge.preview.noParsedTitle"),detail:t("knowledge.preview.noParsedDetail")}:_Me.has(i)||jMe.has(i)||NMe.has(i)?{title:t("knowledge.preview.noMediaTitle"),detail:t("knowledge.preview.noMediaDetail")}:{title:t("knowledge.preview.noDataTitle"),detail:t("knowledge.preview.noDataDetail")}}function NPt({chunk:e}){const{t}=_e("ui"),[n,i]=p.useState(!1),r=RMe(e.attachmentUrl),s=_Pt(e);return!r||s==="none"?null:n?o.jsx("div",{className:"knowledge-preview__attachment-error",children:t("knowledge.preview.attachmentError")}):s==="image"?o.jsx("img",{className:"knowledge-preview__image",src:r,alt:e.title||t("knowledge.preview.imageAlt"),loading:"lazy",onError:()=>i(!0)}):s==="audio"?o.jsx("audio",{className:"knowledge-preview__audio",src:r,controls:!0,preload:"metadata",onError:()=>i(!0),children:t("knowledge.preview.audioUnsupported")}):s==="video"?o.jsx("video",{className:"knowledge-preview__video",src:r,controls:!0,playsInline:!0,preload:"metadata",onError:()=>i(!0),children:t("knowledge.preview.videoUnsupported")}):s==="pdf"?o.jsxs("div",{className:"knowledge-preview__pdf",children:[o.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)}),o.jsx("a",{href:r,target:"_blank",rel:"noopener noreferrer",children:t("knowledge.preview.openPdf")})]}):o.jsxs("div",{className:"knowledge-preview__file-fallback",children:[o.jsx("p",{children:t("knowledge.preview.fileUnsupported")}),o.jsx("a",{href:r,target:"_blank",rel:"noopener noreferrer",children:t("knowledge.preview.openOriginalFile")})]})}function RPt({base:e,item:t,onClose:n}){const{t:i}=_e("ui"),[r,s]=p.useState([]),[a,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 N=new AbortController;w.current=N;const A=x.current+1;x.current=A,E>0?m(!0):f(!0),y(""),E===0&&(s([]),b(!1));try{const T=await sOt(e.id,t.id,{region:e.region,offset:E,signal:N.signal});if(x.current!==A)return;l(T.document.id?T.document:t),u(T.sourceMarkdown||T.document.sourceMarkdown),s(R=>E>0?[...R,...T.chunks]:T.chunks),b(T.hasMore)}catch(T){!P8(T)&&x.current===A&&y(il(T,i("knowledge.errors.loadPreview")))}finally{x.current===A&&(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=APt(a.url||t.url),k=jPt(a,i),C=a.metadata._veadk_content_format==="markdown";return o.jsx(oT,{title:a.name||t.name||t.id,onClose:n,className:"knowledge-dialog--preview",children:o.jsxs("div",{className:"knowledge-preview",children:[a.sizeBytes>0||S?o.jsxs("div",{className:"knowledge-preview__meta",children:[a.sizeBytes>0?o.jsx("span",{children:AV(a.sizeBytes)}):null,S?o.jsx("a",{href:S,target:"_blank",rel:"noopener noreferrer",children:i("knowledge.openOriginalWeb")}):null]}):null,o.jsx("div",{className:"knowledge-preview__body","aria-live":"polite",children:c?o.jsx("div",{className:"knowledge-preview__markdown-shell",children:o.jsx(Zu,{text:c,allowRawHtml:!1,className:"knowledge-preview__markdown"})}):d?o.jsx("div",{className:"knowledge-preview__state",role:"status",children:o.jsx(bn,{as:"span",duration:2.4,children:i("knowledge.preview.loading")})}):v&&r.length===0?o.jsxs("div",{className:"knowledge-preview__state is-error",role:"alert",children:[o.jsx("p",{children:v}),o.jsx("button",{type:"button",onClick:()=>void O(),children:i("common.retry")})]}):r.length===0?o.jsxs("div",{className:"knowledge-preview__state",children:[o.jsx("p",{children:k.title}),o.jsx("span",{children:S?i("knowledge.preview.openOriginalHint"):k.detail}),o.jsx("button",{type:"button",onClick:()=>void O(),children:i("common.reload")})]}):o.jsxs("div",{className:"knowledge-preview__chunks",children:[r.map((E,N)=>{const A=TPt(E.tableFields,i),j=E.id||`${N}:${E.title}`;return o.jsxs("article",{className:"knowledge-preview__chunk",children:[o.jsx("header",{children:o.jsx("h3",{children:E.title||i("knowledge.preview.chunk",{index:N+1})})}),E.content?C?o.jsx(Zu,{text:E.content,allowRawHtml:!1,className:"knowledge-preview__markdown"}):o.jsx("p",{className:"knowledge-preview__content",children:E.content}):null,A?o.jsx("div",{className:"knowledge-preview__table-wrap",children:o.jsxs("table",{children:[o.jsx("thead",{children:o.jsx("tr",{children:A.columns.map((T,R)=>o.jsx("th",{scope:"col",children:T},`${T}:${R}`))})}),o.jsx("tbody",{children:A.rows.map((T,R)=>o.jsx("tr",{children:T.map((_,D)=>o.jsx("td",{children:_},D))},R))})]})}):null,o.jsx(NPt,{chunk:E})]},j)}),v?o.jsx("div",{className:"knowledge-preview__more-error",role:"alert",children:v}):null,g?o.jsx("button",{type:"button",className:"knowledge-preview__load-more",disabled:h,onClick:()=>void O(r.length),children:h?o.jsx(bn,{as:"span",duration:2.4,children:i("knowledge.preview.loadingMore")}):i("knowledge.preview.loadMore")}):null]})})]})})}function IPt({cloudProvider:e,region:t,active:n=!0,activationRevision:i=0,onDetailChange:r,toolbarLeading:s,toolbarFilters:a}){const{t:l,i18n:c}=_e("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),[N,A]=p.useState(!1),[j,T]=p.useState(""),[R,_]=p.useState([]),[D,M]=p.useState(!1),[P,L]=p.useState(""),[F,I]=p.useState(""),[z,K]=p.useState(""),[B,W]=p.useState(!1),[H,X]=p.useState(!1),[ie,Q]=p.useState(!1),[Z,ue]=p.useState(null),[Ee,Y]=p.useState(null),[G,te]=p.useState(null),[de,Ce]=p.useState(null),[le,fe]=p.useState(null),[re,Oe]=p.useState(!1),Pe=p.useRef(0),be=p.useRef(0),Qe=p.useRef([]),ve=p.useRef(!1),Ne=p.useRef(!1),ne=p.useRef(null),ye=p.useRef(null),Te=p.useRef({}),Se=p.useRef(!1),Ke=p.useRef(null),it=p.useRef(null),he=p.useRef(null),xe=p.useRef(null),Ae=p.useMemo(()=>[t],[t]),qe=p.useCallback(He=>`${He.region}\0${He.id}`,[]),Me=u.find(He=>qe(He)===b)??null,At=!!(Me&&z===qe(Me));p.useEffect(()=>{r==null||r(!!Me)},[r,Me]),p.useEffect(()=>{x("overview"),k("")},[b]);const It=p.useMemo(()=>{const He=w.trim().toLocaleLowerCase();return He?u.filter(Le=>[Le.name,Le.description,Le.ownerLabel,Le.providerKnowledgeId].some(We=>We.toLocaleLowerCase().includes(He))):u},[u,w]),lt=p.useMemo(()=>{const He=S.trim().toLocaleLowerCase();return He?R.filter(Le=>[Le.name,Le.id,M8(Le)].some(We=>We.toLocaleLowerCase().includes(He))):R},[S,R]);p.useEffect(()=>{Y(null)},[Me==null?void 0:Me.id,Me==null?void 0:Me.region]);const Ot=p.useCallback(async(He=!1)=>{var gt;if(He&&(Se.current||Object.keys(Te.current).length===0))return;(gt=ne.current)==null||gt.abort();const Le=new AbortController;ne.current=Le;const We=Pe.current+1;Pe.current=We,Se.current=!0,He?A(!0):E(!0),T(""),He||g([]);try{const st=await eOt({regions:Ae,nextTokens:He?Te.current:void 0,signal:Le.signal});if(Pe.current!==We)return;d(ft=>He?[...ft,...st.items.filter(Ht=>!ft.some(cn=>qe(cn)===qe(Ht)))]:st.items),Te.current=st.nextTokens,h(st.nextTokens);const xt=st.failures.map(({region:ft,error:Ht})=>`${Mf(ft,e)}: ${il(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(P8(st))return;Pe.current===We&&(He?g(xt=>[...new Set([...xt,il(st,l("knowledge.errors.loadMoreBases"))])]):T(il(st,l("knowledge.errors.loadBases"))))}finally{Pe.current===We&&(Se.current=!1,E(!1),A(!1))}},[qe,e,Ae,l]),Ct=p.useCallback(async(He,Le=!1)=>{var st;if(Le&&ve.current)return;(st=ye.current)==null||st.abort();const We=new AbortController;ye.current=We;const gt=be.current+1;be.current=gt,Le||(Qe.current=[],Ne.current=!1,_([]),W(!1),I("")),ve.current=!0,M(!0),Le?I(""):L("");try{const xt=await rOt(He.id,{region:He.region,offset:Le?Qe.current.length:0,signal:We.signal});if(be.current!==gt)return;K(hn=>hn===qe(He)?"":hn);const ft=Qe.current,Ht=Le?[...ft,...xt.items.filter(hn=>!hn.id||!ft.some(Ge=>Ge.id===hn.id))]:xt.items,cn=xt.hasMore&&(!Le||Ht.length>ft.length);Qe.current=Ht,Ne.current=cn,_(Ht),W(cn)}catch(xt){if(P8(xt))return;be.current===gt&&(xt instanceof KP&&xt.errorCode===DIe&&(K(qe(He)),ue(Ht=>Ht&&qe(Ht)===qe(He)?null:Ht)),Le?I(il(xt,l("knowledge.errors.loadMoreData"))):L(il(xt,l("knowledge.errors.loadData"))))}finally{be.current===gt&&(ve.current=!1,M(!1))}},[qe,l]);p.useEffect(()=>{var He;(He=ne.current)==null||He.abort(),Pe.current+=1,Se.current=!1,Te.current={},d([]),h({}),g([]),v(""),K(""),T(""),E(!0)},[e]),p.useEffect(()=>{if(n)return Ot(),()=>{var He;(He=ne.current)==null||He.abort(),Pe.current+=1,Se.current=!1}},[n,i,Ot]),p.useEffect(()=>{var He,Le;if(!n){(He=ye.current)==null||He.abort(),be.current+=1,ve.current=!1;return}if(!Me){(Le=ye.current)==null||Le.abort(),be.current+=1,Qe.current=[],ve.current=!1,Ne.current=!1,_([]),W(!1),I("");return}return Ct(Me),()=>{var We;(We=ye.current)==null||We.abort(),be.current+=1,ve.current=!1}},[n,i,Me==null?void 0:Me.id,Me==null?void 0:Me.region]);const dt=n&&!Me&&!w.trim()&&!C&&!N&&!j&&Object.keys(f).length>0;p.useEffect(()=>{const He=it.current,Le=Ke.current;if(!He||!Le||!dt)return;const We=new IntersectionObserver(([gt])=>{gt.isIntersecting&&Ot(!0)},{root:Le,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=!!(Me&&R.length>0&&B&&!D&&!F);p.useEffect(()=>{const He=xe.current,Le=he.current;if(!Me||!He||!Le||!Ie)return;const We=new IntersectionObserver(([gt])=>{gt.isIntersecting&&Ct(Me,!0)},{root:he.current,rootMargin:"240px 0px",threshold:.01});return We.observe(He),()=>We.disconnect()},[Ie,Ct,Me==null?void 0:Me.id,Me==null?void 0:Me.region]);const vt=()=>{const He=he.current;if(!Me||!He||!Ne.current||ve.current||F)return;const{scrollHeight:Le,scrollTop:We,clientHeight:gt}=He;Le-We-gt<=240&&Ct(Me,!0)},jt=He=>{d(Le=>Le.map(We=>qe(We)===qe(He)?He:We))},Nt=async()=>{if(de){Oe(!0);try{await iOt(de.id,de.region),d(He=>He.filter(Le=>qe(Le)!==qe(de))),K(He=>He===qe(de)?"":He),b===qe(de)&&v(""),Ce(null)}catch(He){T(il(He,l("knowledge.errors.deleteBase"))),Ce(null)}finally{Oe(!1)}}},ln=async()=>{if(!(!Me||!le)){Oe(!0);try{await uOt(Me.id,le.id,Me.region);const He=Qe.current.filter(Le=>Le.id!==le.id);Qe.current=He,_(He),fe(null)}catch(He){L(il(He,l("knowledge.errors.deleteDocument"))),fe(null)}finally{Oe(!1)}}};return o.jsxs("section",{className:`knowledge-library${Me?" is-detail":" resource-collection"}`,"aria-label":l("knowledge.library"),children:[Me?o.jsx(GC,{className:"knowledge-library__detail",title:Me.name,description:Me.description||l("common.noDescription"),identitySeed:Me.name,backLabel:l("knowledge.backToList"),onBack:()=>v(""),sections:[{key:"overview",label:l("skillCenter.overview"),content:o.jsx("section",{className:"knowledge-overview",children:o.jsxs(Fz,{className:"knowledge-overview__summary",children:[o.jsxs("div",{children:[o.jsx("dt",{children:l("knowledge.provider")}),o.jsx("dd",{children:Me.providerType||"-"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:l("knowledge.knowledgeId")}),o.jsx("dd",{className:"knowledge-keyboard-reveal",tabIndex:0,title:Me.providerKnowledgeId,children:Me.providerKnowledgeId||"-"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:l("knowledge.project")}),o.jsx("dd",{children:Me.projectName||"default"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:l("knowledge.creator")}),o.jsx("dd",{children:c3(Me.ownerLabel)})]}),o.jsxs("div",{children:[o.jsx("dt",{children:l("skillCenter.updatedAt")}),o.jsx("dd",{children:pPt(Me.updatedAt,c.resolvedLanguage??c.language)||"-"})]})]})})},{key:"data",label:l("knowledge.data"),content:o.jsx("section",{className:"knowledge-documents",children:o.jsx("div",{className:`knowledge-documents__body${R.length>0?" is-table":""}`,"aria-live":"polite",children:D&&R.length===0?o.jsx(za,{}):P&&R.length===0?o.jsxs("div",{className:"knowledge-library__state is-error",role:"alert",children:[o.jsx("p",{children:P}),At&&Me.canManage?o.jsx("button",{type:"button",onClick:()=>Ce(Me),children:l("knowledge.deleteInvalidAssociation")}):o.jsx("button",{type:"button",onClick:()=>void Ct(Me),children:l("common.retry")})]}):R.length===0?o.jsxs("div",{className:"knowledge-library__state",children:[o.jsx(dPt,{}),o.jsx("p",{children:l("knowledge.noData")}),Me.canManage&&o.jsx("button",{type:"button",onClick:()=>ue(Me),children:l("knowledge.addFirstData")})]}):o.jsx(Bz,{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=>o.jsx("span",{title:He.name||He.id,children:He.name||He.id})},{key:"format",header:l("knowledge.format"),className:"is-compact-column",render:He=>M8(He)},{key:"size",header:l("knowledge.size"),className:"is-compact-column",render:He=>AV(He.sizeBytes)}],searchValue:S,onSearchChange:k,searchPlaceholder:l("knowledge.searchData"),searchLabel:l("knowledge.searchLibraryData"),primaryAction:Me.canManage?{label:l(At?"knowledge.associationInvalid":"knowledge.addData"),disabled:At,title:At?l("knowledge.providerMissing"):void 0,onClick:()=>ue(Me)}:void 0,rowActions:He=>[{label:l("common.preview"),onSelect:()=>Y(He)},...Me.canManage?[{label:l("common.edit"),onSelect:()=>te(He)},{label:l("common.delete"),onSelect:()=>fe(He),danger:!0}]:[]],scrollRef:he,onScroll:vt,busy:D,emptyLabel:l("knowledge.noMatchingData"),footer:D?o.jsxs("div",{className:"knowledge-document-pagination",role:"status","aria-live":"polite",children:[o.jsx("span",{className:"my-agent-loading-mark","aria-hidden":"true"}),o.jsx("span",{children:l("knowledge.loadingMoreData")})]}):F?o.jsxs("div",{className:"knowledge-document-pagination is-error",role:"alert",children:[o.jsx("span",{children:F}),o.jsx("button",{type:"button",onClick:()=>void Ct(Me,!0),children:l("knowledge.retryLoading")})]}):B?o.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:Me.canManage?o.jsxs(o.Fragment,{children:[o.jsx(Dt,{type:"button",color:"danger",variant:"soft",size:"lg",pill:!1,onClick:()=>Ce(Me),children:l("common.delete")}),o.jsx(Dt,{type:"button",color:"primary",size:"lg",pill:!1,onClick:()=>Q(!0),children:l("common.edit")})]}):void 0}):o.jsxs(o.Fragment,{children:[o.jsxs(e0,{className:"knowledge-library__toolbar library-resource-toolbar",children:[s,o.jsxs("div",{className:"resource-toolbar__actions",children:[a,o.jsx(pp,{value:w,onChange:He=>O(He.target.value),placeholder:l("knowledge.searchBases"),"aria-label":l("knowledge.searchBases")})]})]}),o.jsxs(Pg,{ref:Ke,"aria-live":"polite",onScroll:yt,children:[m.length>0&&!C&&o.jsxs("div",{className:"knowledge-region-warning",role:"status",children:[o.jsx("span",{children:l("knowledge.someBasesFailed")}),o.jsx("button",{type:"button",onClick:()=>void Ot(),children:l("common.retry")})]}),C&&u.length===0?o.jsx(za,{}):j?o.jsxs("div",{className:"knowledge-library__state is-error",role:"alert",children:[o.jsx("p",{children:j}),o.jsx("button",{type:"button",onClick:()=>void Ot(),children:l("common.retry")})]}):It.length===0&&w.trim()?o.jsxs("div",{className:"knowledge-library__state",children:[o.jsx(uPt,{}),o.jsx("p",{children:l("knowledge.noMatchingBases")})]}):o.jsxs(n0,{children:[w.trim()?null:o.jsx(hg,{"aria-label":l("knowledge.createBase"),icon:o.jsx(hPt,{}),onClick:()=>X(!0),children:l("knowledge.createBase")}),It.map(He=>o.jsx(r0,{className:"knowledge-card",title:He.name,description:He.description||l("common.noDescription"),metadata:[{label:l("knowledge.creator"),value:c3(He.ownerLabel),title:c3(He.ownerLabel)},{label:l("knowledge.project"),value:He.projectName||"default",title:He.projectName||"default"}],action:{label:z===qe(He)?l("knowledge.associationInvalid"):l("knowledge.addData"),icon:"plus",disabled:!He.canManage||z===qe(He),title:He.canManage?z===qe(He)?l("knowledge.providerMissing"):void 0:l("knowledge.noManagePermission"),onClick:()=>ue(He)},detailAction:{label:l("common.viewDetails"),onClick:()=>v(qe(He))}},qe(He)))]}),dt||N?o.jsx("div",{ref:it,className:"my-agent-load-more",role:"status","aria-live":"polite",children:N?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"my-agent-loading-mark","aria-hidden":"true"}),o.jsx("span",{children:l("knowledge.loadingMoreBases")})]}):dt?o.jsx("span",{children:l("skillCenter.scrollForMore")}):null}):null]})]}),H&&o.jsx(vPt,{region:t,onClose:()=>X(!1),onCreated:He=>{d(Le=>[He,...Le]),v(qe(He)),X(!1)}}),Me&&ie&&o.jsx(xPt,{item:Me,onClose:()=>Q(!1),onUpdated:He=>{jt(He),Q(!1)}}),Me&&Ee&&o.jsx(RPt,{base:Me,item:Ee,onClose:()=>Y(null)}),Z&&o.jsx(wPt,{base:Z,onClose:()=>ue(null),onAssociationInvalid:He=>{K(qe(Z)),Me&&qe(Me)===qe(Z)&&L(il(He,l("knowledge.associationInvalid"))),ue(null)},onCreated:()=>{Me&&qe(Me)===qe(Z)&&Ct(Me),ue(null)}}),Me&&G&&o.jsx(OPt,{base:Me,item:G,onClose:()=>te(null),onUpdated:He=>{const Le=Qe.current.map(We=>We.id===He.id?He:We);Qe.current=Le,_(Le),te(null)}}),de&&o.jsx(Xu,{title:l("knowledge.deleteBaseTitle"),description:l("knowledge.deleteBaseDescription",{name:de.name}),confirmLabel:l(re?"common.deleting":"common.delete"),variant:"danger",busy:re,onCancel:()=>Ce(null),onConfirm:()=>void Nt()}),le&&o.jsx(Xu,{title:l("knowledge.deleteDocumentTitle"),description:l("knowledge.deleteDocumentDescription",{name:le.name||le.id}),confirmLabel:l(re?"common.deleting":"common.delete"),variant:"danger",busy:re,onCancel:()=>fe(null),onConfirm:()=>void ln()})]})}const PPt="_EmptyMessage_1r5gu_1",DPt="_IconBadge_1r5gu_16",MPt="_Title_1r5gu_54",LPt="_Description_1r5gu_69",$Pt="_ActionRow_1r5gu_77",aT={EmptyMessage:PPt,IconBadge:DPt,Title:MPt,Description:LPt,ActionRow:$Pt},Pn=({children:e,className:t,fill:n="static"})=>o.jsx("div",{className:Ci(aT.EmptyMessage,t),"data-fill":n,children:e}),FPt=({size:e="md",color:t="secondary",children:n,className:i})=>o.jsx("div",{className:Ci(aT.IconBadge,i),"data-size":e,"data-color":t,children:n}),BPt=({children:e,className:t,color:n="secondary"})=>o.jsx("div",{className:Ci(aT.Title,t),"data-color":n,children:e}),UPt=({children:e,className:t})=>o.jsx("div",{className:Ci(aT.Description,t),children:e}),QPt=({children:e,className:t})=>o.jsx("div",{className:Ci(aT.ActionRow,t),children:e});Pn.Icon=FPt;Pn.Title=BPt;Pn.Description=UPt;Pn.ActionRow=QPt;const zPt={name:"studio_share_space"},VPt={name:"studio_review_space"},IMe={share:zPt,review:VPt},HPt=IMe.share.name,PMe=IMe.review.name,qPt=[HPt,PMe];function DMe(e){return qPt.includes(e.trim().toLowerCase())}function WPt(e){return e.name===PMe}const KPt="/web/skill-management";class _V extends Error{constructor(t,n,i="SKILL_MANAGEMENT_ERROR",r="",s,a=""){super(t),this.status=n,this.code=i,this.statusText=r,this.originalError=s,this.rawResponse=a,this.name="SkillManagementApiError"}}async function Ll(e,t={},n=Va){return fetch(ta(`${KPt}${e}`),{...t,headers:Ml(hu(t.headers)),signal:Ha(t.signal,n)})}async function lD(e,t){let n=t,i="SKILL_MANAGEMENT_ERROR",r;const s=await e.text().catch(()=>"");try{const a=JSON.parse(s);typeof a.detail=="string"?n=a.detail:a.detail&&(n=a.detail.message||t,i=a.detail.code||i,r=a.detail.originalError)}catch{s.trim()&&(n=V("common.fallbackWithDetail",{fallback:t,detail:s.trim()}))}return new _V(n,e.status,i,e.statusText,r,s)}async function $l(e,t){if(!e.ok)throw await lD(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),$l(await Ll(`/spaces?${t}`,{signal:e.signal}),V("skills.listSpacesFailed"))}async function XPt(e){if(DMe(e.name))throw new _V(V("skills.reservedSpaceName"),409,"SKILL_SPACE_RESERVED_IDENTITY");return $l(await Ll("/spaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),V("skills.createSpaceFailed"))}async function YPt(e){const t=new URLSearchParams({region:e.region});return $l(await Ll(`/shared-space/ensure?${t}`,{method:"POST",signal:e.signal}),V("skills.sharedSpaceFailed"))}async function ZPt(e){return $l(await Ll(`/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})},mr),V("skills.submitReviewFailed"))}async function JPt(e){const t=new URLSearchParams({region:e.region});return $l(await Ll(`/reviews?${t}`,{signal:e.signal}),V("skills.listReviewsFailed"))}async function eDt(e){const t=new URLSearchParams({region:e.region});return $l(await Ll(`/reviews/${encodeURIComponent(e.id)}/files?${t}`,{signal:e.signal},mr),V("skills.reviewFilesFailed"))}async function tDt(e){return $l(await Ll(`/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||""})},mr),V("skills.decideReviewFailed"))}async function nDt(e){const t=new URLSearchParams({region:e.region});return $l(await Ll(`/spaces/${encodeURIComponent(e.spaceId)}/reviews?${t}`,{signal:e.signal}),V("skills.listReviewsFailed"))}async function iDt(e){if(DMe(e.name))throw new _V(V("skills.reservedSpaceName"),409,"SKILL_SPACE_RESERVED_IDENTITY");return $l(await Ll(`/spaces/${encodeURIComponent(e.spaceId)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e.name,description:e.description,region:e.region})}),V("skills.updateSpaceFailed"))}async function rDt(e){const t=new URLSearchParams({region:e.region});await $l(await Ll(`/spaces/${encodeURIComponent(e.spaceId)}?${t}`,{method:"DELETE"}),V("skills.deleteSpaceFailed"))}async function sDt(e){const t=new URLSearchParams({region:e.region});return e.project&&t.set("project",e.project),$l(await Ll(`/spaces/${encodeURIComponent(e.spaceId)}/skills?${t}`,{method:"POST",headers:{"Content-Type":"application/zip"},body:e.file},mr),V("skills.uploadFailed"))}async function oDt(e){return $l(await Ll("/validate",{method:"POST",headers:{"Content-Type":"application/zip"},body:e},mr),V("skills.validateFailed"))}async function aDt(e){const t=new URLSearchParams({region:e.region});await $l(await Ll(`/spaces/${encodeURIComponent(e.spaceId)}/skills/${encodeURIComponent(e.skillId)}?${t}`,{method:"DELETE"}),V("skills.deleteFailed"))}async function MMe(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 $l(await Ll(`/spaces/${encodeURIComponent(e.spaceId)}/skills/${encodeURIComponent(e.skillId)}/files?${t}`),V("skills.listFilesFailed"));return Array.isArray(n.files)?n.files:[]}async function lDt(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 Ll(`/spaces/${encodeURIComponent(e.spaceId)}/skills/${encodeURIComponent(e.skillId)}/archive?${t}`,{},mr);n.ok||await $l(n,V("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()),a=document.createElement("a");a.href=s,a.download=r,a.click(),URL.revokeObjectURL(s)}function oc(e){var t;return((t=e==null?void 0:e.displayName)==null?void 0:t.trim())||(e==null?void 0:e.name)||""}async function cD(e){const t=await fetch(ta(e),{headers:Ml(hu({accept:"application/json"})),signal:Ha(void 0,Va)});if(!t.ok)throw await lD(t,Kt("helpers.skills.agentKitRequestFailed"));return t.json()}async function LMe(){return((await cD("/web/skill-spaces")).items||[]).filter(t=>!WPt(t))}async function $Me(e,t){const n=t?`?region=${encodeURIComponent(t)}`:"";return(await cD(`/web/skill-spaces/${encodeURIComponent(e)}/skills${n}`)).items||[]}async function cDt(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),cD(`/web/skill-spaces/${encodeURIComponent(e)}/skills?${n.toString()}`)}async function uDt(e,t,n,i,r,s,a){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)}`),a&&l.push(`skill_space_name=${encodeURIComponent(a)}`);const c=l.length>0?`?${l.join("&")}`:"";return cD(`/web/skill-spaces/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}${c}`)}function dDt(e,t){const n=Fb(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 Fb(e){return e.skillId||e.skillName}function fDt(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",Rhe,!0,!0);mn.hasResourceBundle("zh-CN","skills")||mn.addResourceBundle("zh-CN","skills",Pve,!0,!0);function Jt(e,t={}){return mn.t(e,{...t,ns:"skills"})}const hDt="/web/skill-workbench";class L8 extends Error{constructor(t,n,i="SKILL_WORKBENCH_ERROR",r=!1,s="",a,l=""){super(t),this.status=n,this.code=i,this.retryable=r,this.statusText=s,this.originalError=a,this.rawResponse=l,this.name="SkillWorkbenchApiError"}}function qu(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(Jt("api.invalidFormat",{label:t}));return e}function sne(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 pDt(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 Ff(e,t={},n=Va){return fetch(ta(`${hDt}${e}`),{...t,headers:hu(t.headers),signal:Ha(t.signal,n)})}async function jV(e,t){var i;const n=await e.text().catch(()=>"");try{const r=qu(JSON.parse(n),Jt("api.errorResponse")),s=r.detail&&typeof r.detail=="object"?qu(r.detail,Jt("api.errorDetails")):r;return new L8(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 L8(Jt("api.gatewayError",{fallback:t,status:e.status,contentType:r}),e.status,"SKILL_WORKBENCH_ERROR",!1,e.statusText,void 0,n)}}async function mg(e,t){if(!e.ok)throw await jV(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 mDt(e){return Array.isArray(e)?e.map(t=>{const n=qu(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 gDt(e){if(e==null)return;const t=qu(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"||!zI(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 SE(e){const t=qu(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=qu(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=sne(t.toolId,"Tool ID"),s=sne(t.sessionId,"Session ID"),a=pDt(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}:{},...a?{recoveryStatus:a}:{},...typeof t.recoveredFromSnapshot=="boolean"?{recoveredFromSnapshot:t.recoveredFromSnapshot}:{},state:t.state,stage:typeof t.stage=="string"?t.stage:"generating",activities:mDt(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:gDt(t.publication)}:{}}}async function uD(e){const t=qu(await mg(await Ff("/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 bDt(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 Ff(`/tasks/from-upload?${n}`,{method:"POST",body:e.file,headers:{"Content-Type":"application/zip"},signal:e.signal},mr);return SE(await mg(i,Jt("api.startOptimization")))}const t=await Ff("/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},mr);return SE(await mg(t,Jt("api.startTask")))}async function yDt(e,t){return SE(await mg(await Ff(`/tasks/${encodeURIComponent(e)}`,{signal:t}),Jt("api.loadTask")))}async function u3(e,t,n){const i=new URLSearchParams;i.set("expected_revision",String(t));const r=qu(await mg(await Ff(`/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(a=>{const l=qu(a,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 d3(e){const t=await Ff(`/tasks/${encodeURIComponent(e.jobId)}/refinements`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({intent:e.intent,expectedRevision:e.expectedRevision})},mr);return SE(await mg(t,Jt("api.refine")))}async function vDt(e){const t=await Ff(`/tasks/${encodeURIComponent(e.jobId)}/stop`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({expectedRevision:e.expectedRevision})});return SE(await mg(t,Jt("api.stop")))}async function xDt(e){const t=await Ff(`/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 jV(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 a=new TextDecoder,l=t.body.getReader(),c=u=>{var h;if(!u.trim())return;const d=qu(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=qu(d.error,Jt("api.publishError"));throw new L8(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=qu(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"||!zI(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+=a.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 wDt(e){await mg(await Ff(`/tasks/${encodeURIComponent(e)}`,{method:"DELETE"}),Jt("api.deleteTask"))}async function ODt(e,t,n){var c;const i=new URLSearchParams;i.set("expected_revision",String(t)),i.set("expected_sha256",n);const r=await Ff(`/tasks/${encodeURIComponent(e)}/download?${i.toString()}`,{},mr);if(!r.ok)throw await jV(r,Jt("api.download"));const a=((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=a,u.click()}finally{URL.revokeObjectURL(l)}}const FMe=p.createContext(void 0);function c0(e){const t=p.useContext(FMe);if(t===void 0&&!e)throw new Error(mc(47));return t}const kDt={...B2e,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 SDt extends eP{constructor(n,i,r){const s=new uQ;super(EDt(n,s,i,r),CDt(s),kDt);tn(this,"setOpen",(n,i)=>{var f,h;const r=i.reason===zc,s=i.reason===Zx&&i.event.detail===0,a=!n&&(i.reason===JTe||i.reason==null),l=Ont(i),c=this.select("activeTriggerId");if(!n&&i.reason===ZTe&&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};N2e(m,n,i.trigger,l()),this.update(m)};r?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(Xet,()=>{this.set("stickIfOpen",!1)}),Jn.flushSync(u)):u();let d;s?d="click":a?d="dismiss":i.reason===WS&&(d="focus"),this.set("instantType",d)})}}function EDt(e,t,n,i=!1){const r={...L2e(),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=$2e(t,n,i),r}function CDt(e){return{popupRef:p.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:p.createRef(),beforeContentFocusGuardRef:p.createRef(),stickIfOpenTimeout:new du,triggerElements:e}}function one({props:e}){const{children:t,open:n,defaultOpen:i=!1,onOpenChange:r,onOpenChangeComplete:s,modal:a=!1,handle:l,triggerId:c,defaultTriggerId:u=null}=e,d=ADt(l,{modal:a,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),M2e(d,f),I2e(d);const{forceUnmount:g}=P2e(f,d,()=>{d.update({stickIfOpen:!0,openChangeReason:null})});d.useSyncedValues({modal:a}),p.useEffect(()=>{f||d.context.stickIfOpenTimeout.clear()},[d,f]),p.useImperativeHandle(e.actionsRef,()=>({unmount:g,close:()=>d.setOpen(!1,Ys(e2e))}),[g,d]);const b=f||h;return o.jsxs(FMe.Provider,{value:d,children:[l&&o.jsx(j2e,{handle:l,store:d}),b&&o.jsx(_Dt,{store:d,modal:a}),typeof t=="function"?t({payload:m}):t]})}function TDt(e){return c0(!0)?o.jsx(one,{props:e}):o.jsx(_tt,{children:o.jsx(one,{props:e})})}function ADt(e,t){const n=_2e((i,r)=>new SDt(t,i,r));return p.useEffect(()=>n.context.stickIfOpenTimeout.disposeEffect(),[n]),n}function _Dt({store:e,modal:t}){const n=e.useState("floatingRootContext"),i=f2e(n,{outsidePressEvent:{mouse:t==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),r=i.reference,s=i.floating;return D2e(e,{activeTriggerProps:r,inactiveTriggerProps:r,popupProps:s}),null}const jDt=300;function mp(e){return AC(e,"base-ui")}function NDt(e,t){const n=p.useRef(null);function i(s){Jn.flushSync(()=>{e.setOpen(!1,Ys(WS,s.nativeEvent,s.currentTarget))});const a=Cet(n.current);a==null||a.focus()}function r(s){var l;const a=e.select("positionerElement");if(a&&rx(s,a))(l=e.context.beforeContentFocusGuardRef.current)==null||l.focus();else{Jn.flushSync(()=>{e.setOpen(!1,Ys(WS,s.nativeEvent,s.currentTarget))});let c=Eet(e.context.triggerFocusTargetRef.current||t.current);for(;c!==null&&zn(a,c);){const u=c;if(c=eQ(c),c===u)break}c==null||c.focus()}}return{preFocusGuardRef:n,handlePreFocusGuardFocus:i,handleFocusTargetFocus:r}}function RDt(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 BMe(e,t){const n=Wn((s,a)=>{(typeof e=="function"?e():e)||t(a||(sP?"touch":""))}),{onClick:i,onPointerDown:r}=RDt(n);return p.useMemo(()=>({onClick:i,onPointerDown:r}),[i,r])}const IDt=p.forwardRef(function(t,n){const{render:i,className:r,style:s,disabled:a=!1,nativeButton:l=!0,handle:c,payload:u,openOnHover:d=!1,delay:f=jDt,closeDelay:h=0,id:m,...g}=t,b=c0(!0),y=U2e(c)??b;if(!y)throw new Error(mc(74));const x=mp(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:N}=R2e(x,C,y,{payload:u,disabled:a,openOnHover:d,closeDelay:h}),A=y.useState("openChangeReason"),j=y.useState("stickIfOpen"),T=y.useState("openMethod"),R=y.useState("focusManagerModal"),_=_nt(O,{enabled:!a&&d&&(T!=="touch"||A!==Zx),mouseOnly:!0,move:!1,handleClose:Rnt(),restMs:f,delay:{close:h},triggerElementRef:C,isActiveTrigger:w,isClosing:()=>y.select("transitionStatus")==="ending"}),D=d2e(O,{stickIfOpen:j}),M=BMe(()=>y.select("open"),ie=>{y.set("openMethod",ie)}),P=y.useState("triggerProps",N),{getButtonProps:L,buttonRef:F}=cP({disabled:a,native:l}),I={open(ie){return ie&&A===Zx?qnt.open(ie):H2e.open(ie)}},{preFocusGuardRef:z,handlePreFocusGuardFocus:K,handleFocusTargetFocus:B}=NDt(y,C),H=wo("button",t,{state:{disabled:a,open:S},ref:[F,n,E,C],props:[D.reference,_,P,M,{[oQ]:"",id:x,"aria-haspopup":"dialog","aria-expanded":S,"aria-controls":k},g,L],stateAttributesMapping:I}),X=o.jsx(p.Fragment,{children:H},x);return N&&!R?o.jsxs(p.Fragment,{children:[o.jsx(yy,{ref:z,onFocus:K}),X,o.jsx(yy,{ref:y.context.triggerFocusTargetRef,onFocus:B})]}):X}),UMe=p.createContext(void 0);function PDt(){const e=p.useContext(UMe);if(e===void 0)throw new Error(mc(45));return e}const DDt=p.forwardRef(function(t,n){const{keepMounted:i=!1,...r}=t;return c0().useState("mounted")||i?o.jsx(UMe.Provider,{value:i,children:o.jsx(r2e,{ref:n,...r})}):null}),QMe=p.createContext(void 0);function MDt(){const e=p.useContext(QMe);if(!e)throw new Error(mc(46));return e}const zMe=p.forwardRef(function(t,n){const{cutout:i,...r}=t;let s;if(i){const a=i.getBoundingClientRect();s=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${a.left}px ${a.top}px,${a.left}px ${a.bottom}px,${a.right}px ${a.bottom}px,${a.right}px ${a.top}px,${a.left}px ${a.top}px)`}return o.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...r,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:s}})});let ane={},lne={},cne="";function dD(e,t){return EC(e)?e:t}function une(e,t,n){return/hidden|clip/.test(e.getComputedStyle(dD(t,n)).overflowY)}function LDt(e){if(typeof document>"u")return!1;const t=lr(e);return Bs(t).innerWidth-t.documentElement.clientWidth>0}function $Dt(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=dD(i,r),a=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=a,i.style.scrollbarGutter=l,c===u}function FDt(e){const t=lr(e),n=t.documentElement,i=t.body,r=dD(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 BDt(e){var m;const t=lr(e),n=t.documentElement,i=t.body,r=Bs(n);let s=0,a=0,l=!1;const c=Jl.create();if(zw&&(((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,a=n.scrollLeft,ane={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},cne=n.style.scrollBehavior,lne={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),N=parseFloat(b.marginTop)+parseFloat(b.marginBottom),A=parseFloat(b.marginLeft)+parseFloat(b.marginRight),j=dD(n,i);if(l=$Dt(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:N||E?`calc(100dvh - ${N+E}px)`:"100dvh",width:A||C?`calc(100vw - ${A+C}px)`:"100vw",boxSizing:"border-box",overflowY:"hidden",overflowX:"hidden",scrollBehavior:"unset"}),i.scrollTop=s,i.scrollLeft=a,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function d(){Object.assign(n.style,ane),Object.assign(i.style,lne),l||(n.scrollTop=s,n.scrollLeft=a,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=cne)}function f(){d(),c.request(u)}u();const h=mi(r,"resize",f);return()=>{c.cancel(),d(),typeof r.removeEventListener=="function"&&h()}}class UDt{constructor(){tn(this,"lockCount",0);tn(this,"restore",null);tn(this,"timeoutLock",du.create());tn(this,"timeoutUnlock",du.create());tn(this,"release",()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)});tn(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=Bs(i);if(une(s,i,r)){const l=new s.MutationObserver(()=>{une(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 a=sP||!LDt(t);this.restore=a?FDt(t):BDt(t)}}const QDt=new UDt;function VMe(e=!0,t=null){Un(()=>{if(e)return QDt.acquire(t)},[e,t])}const zDt=20;function VDt(e,t,n,i){const[r,s]=p.useState(!1);Un(()=>{if(!e||!t||n==null){s(!1);return}const a=lr(n).documentElement.clientWidth,l=n.offsetWidth;s(a>0&&l>0&&l>=a-zDt)},[e,t,n]),VMe(e&&(!t||r),i)}const HDt=p.forwardRef(function(t,n){const{render:i,className:r,style:s,anchor:a,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=ntt,...x}=t,w=c0(),O=PDt(),S=Ttt(),k=w.useState("floatingRootContext"),C=w.useState("mounted"),E=w.useState("open"),N=w.useState("openChangeReason"),A=w.useState("activeTriggerElement"),j=w.useState("modal"),T=w.useState("openMethod"),R=w.useState("positionerElement"),_=w.useState("instantType"),D=w.useState("transitionStatus"),M=w.useState("adaptiveOrigin"),P=p.useRef(null),L=sQ(R),F=Fnt({anchor:a,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:M}),I=k.useState("domReferenceElement");Un(()=>{const H=I,X=P.current;if(H&&(P.current=H),X&&H&&H!==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 z=j===!0&&N!==zc;VDt(E&&z,T==="touch",R,A);const K=w.useStateSetter("positionerElement"),B={open:E,side:F.side,align:F.align,anchorHidden:F.anchorHidden,instant:_},W=Wnt(t,B,{styles:F.positionerStyles,transitionStatus:D,props:x,refs:[n,K],hidden:!C,inert:!E});return o.jsxs(QMe.Provider,{value:F,children:[C&&z&&o.jsx(zMe,{inert:rQ(!E),cutout:A}),o.jsx(Att,{id:S,children:W})]})}),qDt="ArrowUp",WDt="ArrowDown",KDt="ArrowLeft",GDt="ArrowRight",XDt="Home",YDt="End",HMe=new Set([qDt,WDt,KDt,GDt,XDt,YDt]),ZDt=p.createContext(void 0);function JDt(e){return p.useContext(ZDt)}const eMt=p.createContext(void 0);function tMt(){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 nMt=p.forwardRef(function(t,n){const{render:i,className:r,style:s,initialFocus:a,finalFocus:l,...c}=t,u=c0(),d=MDt(),f=JDt()!=null,{context:h,hasClosePart:m}=tMt(),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"),N=u.useState("floatingRootContext"),A=N.useState("floatingId"),j=u.useState("disabled"),T=u.useState("openOnHover"),R=u.useState("closeDelay");TC({open:g,ref:u.context.popupRef,onComplete(){var F,I;g&&((I=(F=u.context).onOpenChangeComplete)==null||I.call(F,!0))}}),Tnt(N,{enabled:T&&!j,closeDelay:R});const _=a===void 0?A2e(u.context.popupRef):a,D=S!==!1&&m;u.useSyncedValue("focusManagerModal",D);const M=u.useStateSetter("popupElement"),P={open:g,side:d.side,align:d.align,instant:v,transitionStatus:y},L=wo("div",t,{state:P,ref:[n,u.context.popupRef,M],props:[x,{id:A,role:"dialog",...T2e,"aria-labelledby":w,"aria-describedby":O,onKeyDown(F){f&&HMe.has(F.key)&&F.stopPropagation()}},W2e(y),c],stateAttributesMapping:q2e});return o.jsx(u2e,{context:N,openInteractionType:b,modal:D,disabled:!k||C===zc,initialFocus:_,returnFocus:l,restoreFocus:"popup",previousFocusableElement:$s(E)?E:void 0,nextFocusableElement:u.context.triggerFocusTargetRef,beforeContentFocusGuardRef:u.context.beforeContentFocusGuardRef,children:o.jsx(eMt.Provider,{value:h,children:L})})}),iMt=p.forwardRef(function(t,n){const{render:i,className:r,style:s,...a}=t,l=c0(),c=mp(a.id);return l.useSyncedValueWithCleanup("titleElementId",c),wo("h2",t,{ref:n,props:[{id:c},a]})}),rMt=p.forwardRef(function(t,n){const{render:i,className:r,style:s,...a}=t,l=c0(),c=mp(a.id);return l.useSyncedValueWithCleanup("descriptionElementId",c),wo("p",t,{ref:n,props:[{id:c},a]})});function dne(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("circle",{cx:"10.25",cy:"10.25",r:"6.25"}),o.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 sMt(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.25",y:"5.25",width:"15.5",height:"13.5",rx:"2.25"}),o.jsx("circle",{cx:"8.1",cy:"9.3",r:"1.35"}),o.jsx("path",{d:"m4.7 16.5 3.65-3.7 2.45 2.25 2.2-2.2 4.35 4.1"}),o.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 NV(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.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"}),o.jsxs("g",{className:"video-generate-icon__clapper",children:[o.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"}),o.jsx("path",{d:"M6.75 5.25 9.3 9M12 5.25 14.55 9M17.25 5.25 19.8 9"})]}),o.jsx("path",{d:"m10.25 11.45 4 2.55-4 2.55v-5.1Z"})]})}function oMt(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M4.25 5.25h15.5v10.5H4.25zM8.25 19.75h7.5M12 15.75v4"}),o.jsx("path",{d:"m7.25 12.75 2.35-2.4 2.15 1.65 3.4-3.6 1.6 1.55"}),o.jsx("circle",{cx:"7.25",cy:"8.4",r:".7",fill:"currentColor",stroke:"none"})]})}function aMt(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.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"}),o.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"}),o.jsx("path",{d:"M8.2 12.25h.01M8.2 16.8h.01"})]})}function lMt(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M4.25 4.25h4.5v15.5h-4.5zM8.75 5.75h5v14h-5zM13.75 4.25h4.1v10.25h-4.1z"}),o.jsx("path",{d:"M5.75 7h1.5M10.25 8.25h2M10.25 11h2M15.15 7h1.3"}),o.jsx("circle",{cx:"17.45",cy:"17.35",r:"2.45"}),o.jsx("path",{d:"m19.25 19.15 1.55 1.55"})]})}function cMt(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.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"}),o.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"}),o.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 uMt(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"m4.2 8.4 1.15 10.2h13.3L19.8 8.4"}),o.jsx("path",{d:"M4.2 8.4h15.6L17.9 5H6.1L4.2 8.4Z"}),o.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"}),o.jsx("path",{d:"m8.2 15.1 1.45 1.35 1.45-1.35M13.55 16.45h2.35"})]})}function dMt(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("circle",{cx:"6",cy:"6.25",r:"2.25"}),o.jsx("circle",{cx:"18",cy:"6.25",r:"2.25"}),o.jsx("circle",{cx:"12",cy:"17.75",r:"2.25"}),o.jsx("path",{d:"m7.7 7.75 2.7 7.55M16.3 7.75l-2.7 7.55M8.25 6.25h7.5"})]})}function fne(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("circle",{cx:"9",cy:"8",r:"3"}),o.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"}),o.jsx("path",{d:"M17.75 4.25v5.5M15 7h5.5M16 13.25h4.25M18.125 11.125v4.25"})]})}function fMt(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"4",y:"4.25",width:"16",height:"5",rx:"1.5"}),o.jsx("rect",{x:"4",y:"14.75",width:"16",height:"5",rx:"1.5"}),o.jsx("path",{d:"M7.25 6.75h.01M7.25 17.25h.01M10 6.75h6.5M10 17.25h6.5"})]})}function hMt(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M6 3.75h8l4 4v12.5H6V3.75Z"}),o.jsx("path",{d:"M14 3.75v4h4M8.75 11h6.5M8.75 14.25h6.5M8.75 17.5h4"})]})}function hne(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.75",y:"4.5",width:"16.5",height:"15",rx:"2.5"}),o.jsx("path",{d:"m7.5 9 2.75 2.5L7.5 14M12.5 14h4"}),o.jsx("path",{d:"M3.75 7.5h16.5",opacity:".62"})]})}function a1(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m6 3.25 4.5 4.75L6 12.75"})})}function pMt({value:e}){const{t,i18n:n}=_e("adk"),[i,r]=p.useState(!1),s=f=>f==null?t("developmentRuns.notReported"):f.toLocaleString(n.resolvedLanguage||n.language),a=pTe,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 o.jsxs("div",{className:"development-turn-summary","data-turn-id":e.turnId,children:[o.jsx("span",{children:t(`developmentRuns.turnStatus.${e.status}`)}),o.jsx("span",{children:t("developmentRuns.toolCalls",{count:e.toolCalls})}),o.jsx("span",{children:t("developmentRuns.turnDuration",{duration:a(e.durationMs)})}),o.jsx("span",{title:t("developmentRuns.toolDurationHelp"),children:t(e.toolDurationComplete?"developmentRuns.toolDuration":"developmentRuns.toolDurationPartial",{duration:a(e.toolDurationMs)})}),o.jsxs(TDt,{open:i,onOpenChange:r,children:[o.jsxs(IDt,{className:"development-token-trigger",openOnHover:!0,delay:150,closeDelay:150,onFocus:f=>{f.currentTarget.matches(":focus-visible")&&r(!0)},children:[o.jsx("span",{children:"Tokens"}),o.jsx("span",{className:"development-token-value",children:s(l==null?void 0:l.totalTokens)}),e.usageIncomplete&&o.jsxs("span",{children:["· ",t("developmentRuns.partial")]}),o.jsx(a1,{className:"development-token-chevron"})]}),o.jsx(DDt,{children:o.jsx(HDt,{side:"top",align:"end",sideOffset:8,className:"development-token-positioner",children:o.jsxs(nMt,{className:"development-token-popup",initialFocus:!1,finalFocus:!1,children:[o.jsx(iMt,{className:"development-token-title",children:t("developmentRuns.tokenDetails")}),o.jsxs("dl",{children:[o.jsxs("div",{children:[o.jsx("dt",{children:t("developmentRuns.model")}),o.jsx("dd",{children:e.model||t("developmentRuns.notReported")})]}),o.jsxs("div",{children:[o.jsx("dt",{children:t("developmentRuns.totalTokens")}),o.jsx("dd",{children:s(l==null?void 0:l.totalTokens)})]}),d.map(([f,h])=>o.jsxs("div",{children:[o.jsx("dt",{children:t(`developmentRuns.${f}`)}),o.jsx("dd",{children:s(h)})]},f)),o.jsxs("div",{children:[o.jsx("dt",{children:t("developmentRuns.cacheHitRate")}),o.jsx("dd",{children:u||t("developmentRuns.notReported")})]})]}),o.jsxs(rMt,{className:"development-token-note",children:[t("developmentRuns.tokenHelp"),e.usageIncomplete?` ${t("developmentRuns.partialHelp")}`:""]})]})})})]})]})}function RV(e){return o.jsx("svg",{viewBox:"0 0 111 117",fill:"none","aria-hidden":"true",...e,children:o.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 fD({kind:e,...t}){return e==="thinking"?o.jsx(RV,{...t}):o.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"?o.jsxs(o.Fragment,{children:[o.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"3"}),o.jsx("path",{d:"m7 9 3 3-3 3m6 0h4"})]}):e==="plan"?o.jsxs(o.Fragment,{children:[o.jsx("path",{d:"m4 7 1.5 1.5L8 6m-4 7 1.5 1.5L8 12M11 7h9m-9 6h9m-9 6h9"}),o.jsx("circle",{cx:"6",cy:"19",r:"1"})]}):o.jsx(o.Fragment,{children:o.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 mMt({blocks:e,active:t,status:n,render:i}){const{t:r}=_e("adk"),[s,a]=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"?mTe(l):(l==null?void 0:l.kind)==="plan"?r("developmentRuns.plan"):(l==null?void 0:l.kind)==="diff"?r("developmentRuns.diff"):r("developmentRuns.processing"))),o.jsxs("section",{className:"development-process",children:[o.jsxs("button",{type:"button",className:"development-process__toggle","aria-expanded":s,onClick:()=>a(!s),children:[o.jsx(a1,{className:`tool-chevron${s?" is-open":""}`}),o.jsx("span",{className:"tool-icon",children:o.jsx(fD,{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?o.jsx(bn,{className:"development-process__title","aria-live":"polite",children:f}):o.jsx("span",{className:"development-process__title",children:f}),!t&&c.length>0&&o.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:pTe(d)})}`:""]})]}),o.jsx("div",{className:"development-process__items",hidden:!s,children:i(e)})]})}function gMt({blocks:e,active:t,status:n="",render:i}){const{t:r}=_e("adk"),s=bJe(e),a=s[s.length-1],l=[...e].reverse().find(u=>u.kind==="progress"),c=n||((l==null?void 0:l.kind)==="progress"?l.text:"");return o.jsxs(o.Fragment,{children:[s.map(u=>u.process?o.jsx(mMt,{blocks:u.blocks,active:t&&u===a,status:c,render:i},u.id):o.jsx("div",{"data-assistant-phase":u.blocks[0].phase,children:i(u.blocks)},u.id)),t&&!(a!=null&&a.process)&&o.jsxs("div",{className:"development-process__status",role:"status",children:[o.jsx("span",{className:"tool-icon",children:o.jsx(fD,{kind:"thinking"})}),o.jsx(bn,{children:c||r("developmentRuns.processing")})]})]})}const bMt={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 yMt(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 vMt(e){return typeof e=="object"&&e!==null&&typeof e.path=="string"}function xMt(e){return typeof e=="object"&&e!==null&&typeof e.call=="string"}function IV(e,t){if(vMt(e))return yMt(t,e.path);if(xMt(e)){const n=bMt[e.call],i={};for(const[r,s]of Object.entries(e.args??{}))i[r]=IV(s,t);return n?n(i):`[unknown fn: ${e.call}]`}return e}function wMt(e,t){const n=IV(e,t);return n==null?"":typeof n=="string"?n:String(n)}const qMe=new Map;function u0(e,t){qMe.set(e,t)}function OMt(e){return qMe.get(e)}function kMt(e,t,n){const i=t.replace(/^\//,"").split("/").map(s=>s.replace(/~1/g,"/").replace(/~0/g,"~"));let r=e;for(let s=0;sIV(i,e.dataModel),resolveString:i=>wMt(i,e.dataModel),dispatchAction:t,render:i=>{if(!i)return null;const r=e.components[i];if(!r)return null;const s=OMt(r.component)??SMt;return o.jsx(s,{node:r,ctx:n},i)}};return o.jsx("div",{className:"a2ui-surface","data-a2ui-surface":e.surfaceId,children:n.render(e.rootId)})}function KMe(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 hD({value:e,skillPrefix:t="/",onRemoveSkill:n,onRemoveAgent:i}){const{t:r}=_e("conversation");return e.skills.length===0&&!e.targetAgent?null:o.jsxs("div",{className:"invocation-chips","aria-label":r("invocation.ariaLabel"),children:[e.skills.map(s=>o.jsxs("span",{className:"invocation-chip invocation-chip--skill",title:s.description,children:[o.jsx(YS,{"aria-hidden":!0}),o.jsxs("span",{children:[t,s.name]}),n?o.jsx("button",{type:"button",onClick:()=>n(s.name),"aria-label":r("invocation.removeSkill",{name:s.name}),children:o.jsx(ka,{})}):null]},s.name)),e.targetAgent?o.jsxs("span",{className:"invocation-chip invocation-chip--agent",title:e.targetAgent.description,children:[o.jsx(oAe,{"aria-hidden":!0}),o.jsx("span",{children:e.targetAgent.name}),i?o.jsx("button",{type:"button",onClick:i,"aria-label":r("invocation.removeAgent",{name:e.targetAgent.name}),children:o.jsx(ka,{})}):null]}):null]})}function PV(e=""){return e.startsWith("image/")?"image":e.startsWith("video/")?"video":e==="application/pdf"?"pdf":e==="text/markdown"?"markdown":"text"}function GMe(e){var n,i,r,s;const t=PV(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 XMe(e){return e?e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`:""}function YMe(e,t){return e.previewUrl?e.previewUrl:e.data?`data:${e.mimeType??"application/octet-stream"};base64,${e.data}`:e.uri?GEe(t,e.uri):""}function CMt({kind:e}){return e==="image"?o.jsx(yQ,{}):e==="video"?o.jsx(lAe,{}):e==="pdf"?o.jsx(Git,{}):o.jsx(gQ,{})}function pD({appName:e,items:t,compact:n=!1,onRemove:i}){const{t:r}=_e("conversation"),[s,a]=p.useState(null);return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:`media-grid${n?" media-grid--compact":""}`,children:t.map(l=>{const c=PV(l.mimeType),u=YMe(l,e),d=l.status==="uploading"||l.status==="error"||!u,f=o.jsxs("button",{type:"button",className:"media-card-main",disabled:d,onClick:c==="image"?void 0:()=>a(l),"aria-label":r("media.preview",{name:l.name??r("media.attachment")}),children:[c==="image"&&u?o.jsx("img",{className:"media-card-image",src:u,alt:l.name??r("media.image"),loading:"lazy"}):c==="video"&&u?o.jsxs("div",{className:"media-card-video-container",children:[o.jsx("video",{className:"media-card-video",src:u,muted:!0,playsInline:!0,preload:"metadata","aria-hidden":"true"}),o.jsx("span",{className:"media-card-video-play",children:o.jsx(art,{})})]}):o.jsx("span",{className:"media-card-icon",children:o.jsx(CMt,{kind:c})}),o.jsxs("span",{className:"media-card-copy",children:[o.jsx("span",{className:"media-card-name",children:l.name??r("media.attachment")}),o.jsxs("span",{className:"media-card-meta",children:[o.jsx("span",{className:"media-card-type",children:GMe(l)}),l.status==="uploading"?o.jsxs(o.Fragment,{children:[o.jsx(Mi,{className:"media-card-spinner"})," ",r("media.uploading")]}):l.status==="error"?l.error??r("media.uploadFailed"):XMe(l.sizeBytes)]})]}),!n&&l.status!=="uploading"&&l.status!=="error"?o.jsx(ox,{className:"media-card-open"}):null]});return o.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?o.jsx(xEe,{src:u,children:f}):f,i?o.jsx("button",{type:"button",className:"media-card-remove","aria-label":r("media.remove",{name:l.name??r("media.attachment")}),onClick:()=>i(l.id),children:o.jsx(ka,{})}):null]},l.id)})}),o.jsx(Td,{children:s?o.jsx(TMt,{appName:e,item:s,onClose:()=>a(null)}):null})]})}function TMt({appName:e,item:t,onClose:n}){const{t:i}=_e("conversation"),r=p.useMemo(()=>YMe(t,e),[e,t]),s=PV(t.mimeType),[a,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]),o.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:o.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:[o.jsxs("header",{className:"media-viewer-header",children:[o.jsxs("div",{children:[o.jsx("strong",{children:t.name??i("media.attachment")}),o.jsxs("span",{children:[GMe(t),t.sizeBytes?` · ${XMe(t.sizeBytes)}`:""]})]}),o.jsxs("nav",{children:[o.jsx("a",{href:r,download:t.name,"aria-label":i("media.download"),children:o.jsx(mP,{})}),o.jsx("button",{type:"button",onClick:n,"aria-label":i("media.close"),children:o.jsx(ka,{})})]})]}),o.jsxs("div",{className:`media-viewer-body media-viewer-body--${s}`,children:[s==="image"?o.jsx("img",{src:r,alt:t.name??i("media.image")}):null,s==="video"?o.jsx("div",{className:"media-viewer-video-wrapper",children:o.jsx("video",{src:r,controls:!0,autoPlay:!0,playsInline:!0,preload:"auto",className:"media-viewer-video"})}):null,s==="pdf"?o.jsx("iframe",{src:r,title:t.name??"PDF"}):null,c?o.jsxs("div",{className:"media-viewer-loading",children:[o.jsx(Mi,{})," ",i("media.reading")]}):null,!c&&d?o.jsx("div",{className:"media-viewer-loading",children:i("media.loadFailed",{error:d})}):null,!c&&s==="markdown"?o.jsx("div",{className:"media-document",children:o.jsx(Zu,{text:a})}):null,!c&&s==="text"?o.jsx("pre",{className:"media-document media-document--plain",children:a}):null]})]})})}function AMt({definition:e,label:t,done:n,open:i,onToggle:r}){const{t:s}=_e("conversation"),a=e.icon,l=n?e.doneLabel:e.runningLabel,c=t??s(`blocks.tools.${e.name}.${n?"done":"running"}`,{defaultValue:l});return o.jsxs("button",{type:"button",className:`builtin-tool-head${n?" is-done":" is-running"}`,"data-tool-tone":e.tone,onClick:r,"aria-expanded":i,children:[o.jsx("span",{className:"builtin-tool-icon","aria-hidden":"true",children:o.jsx(a,{})}),n?o.jsx("span",{className:"builtin-tool-label",children:c}):o.jsx(bn,{className:"builtin-tool-label",duration:2.4,spread:18,"aria-live":"polite",children:c}),o.jsx(a1,{className:`builtin-tool-chevron${i?" is-open":""}`})]})}function su(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function In(e){return typeof e=="string"?e:""}function pne(e){return typeof e=="number"&&Number.isFinite(e)?e:0}function Iu(e){return Array.isArray(e)?e:[]}function $8(e){let t=e;if(typeof t=="string")try{t=JSON.parse(t)}catch{return{}}const n=su(t)??{};return su(n.result)??n}function mD(e){if(typeof e=="string")try{return mD(JSON.parse(e))}catch{return e}const t=su(e);if(!t)return"";const n=su(t.result);return In(t.error)||In(t.message)||In(n==null?void 0:n.error)||In(n==null?void 0:n.message)}function _Mt(e){if(e.kind==="tool")return"tool";if(e.kind==="knowledge_base")return"knowledge_base";const t=su(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 ZMe={tool:"Tools",knowledge:"AgentKit Knowledge Base",skillCenter:"AgentKit Skill Center",unknownSource:"Unknown source",unnamedResource:"Unnamed resource",unnamedAgent:"Unnamed agent"};function jMt(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 NMt(e){return e==="veadk_builtin_tools"?"tool":e==="agentkit_knowledge"?"knowledge_base":e.startsWith("skill_hub:")?"skill_hub":"skill_space"}function RMt(e,t=ZMe){const n=$8(e),i=su(n.capabilities)??{},r=Iu(n.resources).flatMap(a=>{const l=su(a);if(!l)return[];const c=l.kind==="tool"?"tool":l.kind==="knowledge_base"?"knowledge_base":"skill";return[{ref:In(l.ref),kind:c,category:_Mt(l),name:In(l.name)||In(l.ref)||t.unnamedResource,description:In(l.description),source:In(l.source),version:In(l.version)}]}),s=Iu(n.sources).flatMap(a=>{const l=su(a);if(!l)return[];const c=In(l.source),u=In(l.status),d=u==="error"?"error":u==="skipped"?"skipped":"ok";return[{source:c,category:NMt(c),label:jMt(c,t),status:d,count:pne(l.count),message:In(l.message),searchKeywords:Iu(l.search_keywords).map(In).filter(Boolean)}]});return{collectionId:In(n.collection_id),capabilities:{googleAdkVersion:In(i.google_adk_version),agentTypes:Iu(i.agent_types).map(In).filter(Boolean),maxOrchestrationDepth:pne(i.max_orchestration_depth)},resources:r,sources:s,counts:{all:r.length,skill_hub:r.filter(a=>a.category==="skill_hub").length,skill_space:r.filter(a=>a.category==="skill_space").length,knowledge_base:r.filter(a=>a.category==="knowledge_base").length,tool:r.filter(a=>a.category==="tool").length}}}function IMt(e,t){return{resources:e.resources.filter(n=>n.category===t),sources:e.sources.filter(n=>n.category===t)}}function JMe(e,t,n=ZMe){const i=$8(e),r=$8(t),s=new Map(Iu(r.results).flatMap(d=>{const f=su(d),h=In(f==null?void 0:f.name);return f&&h?[[h,f]]:[]})),a=Iu(i.agents).flatMap(d=>{const f=su(d),h=In(f==null?void 0:f.name);return f&&h?[f]:[]}),l=new Set(a.map(d=>In(d.name))),c=[...s.entries()].filter(([d])=>!l.has(d)).map(([d])=>({name:d})),u=[...a,...c].map(d=>{const f=In(d.name),h=Iu(d.nodes).flatMap(C=>{const E=su(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=mne(v==null?void 0:v.resources),O=w.length>0?w:mne(h.flatMap(C=>Iu(C.resources))),S=gne(v==null?void 0:v.python_tools),k=S.length>0?S:gne(h.flatMap(C=>Iu(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 PMt(e,t){return!!mD(t)||JMe(e,t).failedCount>0}function mne(e){const t=new Set;return Iu(e).flatMap(n=>{const i=su(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),a=s==="tool"||r.startsWith("veadk_tool:")?"tool":s==="knowledge_base"||r.startsWith("agentkit_kb:")?"knowledge_base":"skill",l=r.split(":");return[{ref:r,kind:a,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 gne(e){const t=new Set;return Iu(e).flatMap(n=>{const i=su(n),r=In(i==null?void 0:i.name),s=In(i==null?void 0:i.code),a=`${r}\0${s}`;return!i||!r||t.has(a)?[]:(t.add(a),[{name:r,description:In(i.description),code:s,entrypoint:In(i.entrypoint)||r,dependencies:Iu(i.dependencies).map(In).filter(Boolean)}])})}function DMt({branch:e}){return o.jsxs("div",{className:`branch-compare__body${e.status==="running"?" is-streaming":""}`,"aria-live":"polite",children:[e.content?o.jsx(Zu,{text:e.content,streaming:e.status==="running"}):null,e.status==="running"?o.jsx("span",{className:"branch-compare__caret","aria-hidden":"true"}):null,e.error?o.jsx("p",{className:"branch-compare__error",children:e.error}):null]})}function MMt({args:e,response:t,status:n,onBranchSelect:i}){const{t:r}=_e("conversation"),s=p.useMemo(()=>pAe(e,t,n),[e,t,n]),[a,l]=p.useState(0);return o.jsxs("section",{className:"branch-compare","aria-label":r("blocks.branchCompare.ariaLabel"),children:[o.jsx("div",{className:"branch-compare__tabs",role:"tablist","aria-label":r("blocks.branchCompare.selectDirection"),children:s.branches.map((c,u)=>o.jsx("button",{className:`branch-compare__tab${a===u?" is-active":""}`,type:"button",role:"tab","aria-selected":a===u,"aria-controls":`branch-compare-panel-${u}`,onClick:()=>l(u),children:o.jsx(Lo,{color:"info",size:"sm",variant:"soft",children:c.label})},`${c.label}:${u}`))}),o.jsx("div",{className:"branch-compare__branches",children:s.branches.map((c,u)=>o.jsxs("article",{className:`branch-compare__branch${a===u?" is-active":""}`,id:`branch-compare-panel-${u}`,role:"tabpanel",children:[o.jsx("header",{className:"branch-compare__head",children:o.jsx(Lo,{color:"info",size:"sm",variant:"soft",children:c.label})}),o.jsx(DMt,{branch:c}),o.jsx("footer",{className:"branch-compare__footer",children:o.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 e5e({controlled:e,default:t,name:n,state:i="value"}){const{current:r}=p.useRef(e!==void 0),[s,a]=p.useState(t),l=r?e:s,c=p.useCallback(u=>{r||a(u)},[]);return[l,c]}const t5e=p.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function LMt(){return p.useContext(t5e)}function $Mt(e){const{children:t,elementsRef:n,labelsRef:i,onMapChange:r}=e,s=Wn(r),[,a]=p.useState(!1),l=Gu(BMt).current,c=Gu(FMt).current,u=p.useRef(0),d=p.useRef(!0),f=p.useRef([]),h=p.useRef(null),m=Wn(()=>{d.current||(d.current=!0,a(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,N;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:((N=(E=C.registration.textRef)==null?void 0:E.current)==null?void 0:N.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(N=>{if(!zMt(N))return;let A=null;for(const j of S)if(j.isConnected){if(A&&n5e(A,j)>0){k.disconnect(),m();return}A=j}});h.current=k;const C=new Set;for(let N=1;Nk.observe(N,{childList:!0}))}const x=Wn(()=>{const[S,k]=UMt(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 o.jsx(t5e.Provider,{value:O,children:t})}function FMt(){return new Map}function BMt(){return new Set}function UMt(e){const t=new Set,n=[],i=[];e.forEach((s,a)=>{if(!a.isConnected)return;const l=s.index,c={index:l??-1,element:a,registration:s};l===null?i.push(c):l>=0&&(t.add(l),n.push(c))});let r=0;return i.sort((s,a)=>n5e(s.element,a.element)),i.forEach(s=>{for(;t.has(r);)r+=1;s.index=r,n.push(s),r+=1}),t.size>0&&n.sort((s,a)=>s.index-a.index),[n,i.map(s=>s.element)]}function QMt(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function zMt(e){for(const t of e)for(let n=0;nnull},s5e=p.forwardRef(function(t,n){const{render:i,className:r,disabled:s=!1,hiddenUntilFound:a,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]=e5e({controlled:h,default:v,name:"Accordion",state:"value"}),O=Wn((E,N,A)=>{if(d)if(N){const j=x.slice();if(j.push(E),u==null||u(j,A),A.isCanceled)return;w(j)}else{const j=x.filter(T=>T!==E);if(u==null||u(j,A),A.isCanceled)return;w(j)}else{const j=x[0]===E?[]:[E];if(u==null||u(j,A),A.isCanceled)return;w(j)}}),S=p.useMemo(()=>({value:x,disabled:s,orientation:f}),[x,s,f]),k=p.useMemo(()=>({disabled:s,handleValueChange:O,hiddenUntilFound:a??!1,keepMounted:l??!1,state:S,value:x}),[s,O,a,l,S,x]),C=wo("div",t,{state:S,ref:n,props:b,stateAttributesMapping:VMt});return o.jsx(i5e.Provider,{value:k,children:o.jsx($Mt,{elementsRef:y,children:C})})});function HMt(e){const{open:t,defaultOpen:n,onOpenChange:i,disabled:r}=e,[s,a]=e5e({controlled:t,default:n,name:"Collapsible",state:"open"}),{mounted:l,setMounted:c,transitionStatus:u}=C2e(s,!0,!0),d=mp(),[f,h]=p.useState(),m=f===null?void 0:f??d,g=Wn(b=>{const v=!s,y=Ys(Zx,b.nativeEvent);i(v,y),!y.isCanceled&&a(v)});return p.useMemo(()=>({defaultPanelId:d,disabled:r,handleTrigger:g,mounted:l,open:s,panelId:m,setMounted:c,setOpen:a,setPanelIdState:h,transitionStatus:u}),[d,r,g,l,s,m,c,a,h,u])}const o5e=p.createContext(void 0);function a5e(){const e=p.useContext(o5e);if(e===void 0)throw new Error(mc(15));return e}function qMt(e={}){const{guess:t,label:n,metadata:i,textRef:r,index:s}=e,{register:a,unregister:l,subscribeMapChange:c,nextIndexRef:u}=LMt(),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&&a(v,{metadata:i??null,index:s??null,label:n,textRef:r})},[s,a,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 l5e=p.createContext(void 0);function DV(){const e=p.useContext(l5e);if(e===void 0)throw new Error(mc(9));return e}let MV=function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=AN.startingStyle]="startingStyle",e[e.endingStyle=AN.endingStyle]="endingStyle",e}({}),WMt=function(e){return e.panelOpen="data-panel-open",e}({});const KMt={[MV.open]:""},GMt={[MV.closed]:""},XMt={open(e){return e?{[WMt.panelOpen]:""}:null}},YMt={open(e){return e?KMt:GMt}};let ZMt=function(e){return e.index="data-index",e.disabled="data-disabled",e.open="data-open",e}({});const LV={...YMt,index:e=>({[ZMt.index]:String(e)}),...lP,value:()=>null},c5e=p.forwardRef(function(t,n){const{className:i,disabled:r=!1,onOpenChange:s,render:a,value:l,style:c,...u}=t,{ref:d,index:f}=qMt(),h=Yx(n,d),{disabled:m,handleValueChange:g,state:b,value:v}=r5e(),y=mp(),x=l??y,w=r||m,O=v.indexOf(x)!==-1,S=Wn((M,P)=>{s==null||s(M,P),!P.isCanceled&&g(x,M,P)}),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]),N=p.useMemo(()=>({...b,hidden:!O&&!k.mounted,index:f,disabled:w,open:O}),[k.mounted,w,f,O,b]),A=mp(),[j,T]=p.useState(),R=j===null?void 0:j??A,_=p.useMemo(()=>({defaultTriggerId:A,open:O,state:N,setTriggerId:T,triggerId:R}),[A,O,N,T,R]),D=wo("div",t,{state:N,ref:h,props:u,stateAttributesMapping:LV});return o.jsx(o5e.Provider,{value:E,children:o.jsx(l5e.Provider,{value:_,children:D})})}),u5e=p.forwardRef(function(t,n){const{render:i,className:r,style:s,...a}=t,{state:l}=DV();return wo("h3",t,{state:l,ref:n,props:a,stateAttributesMapping:LV})}),d5e=p.forwardRef(function(t,n){const{disabled:i,className:r,id:s,render:a,nativeButton:l=!0,style:c,...u}=t,{panelId:d,open:f,handleTrigger:h,disabled:m}=a5e(),g=i||m,{getButtonProps:b,buttonRef:v}=cP({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]),wo("button",t,{state:x,ref:[n,v],props:[{"aria-controls":f?d:void 0,"aria-expanded":f,id:S,onClick:h},u,b],stateAttributesMapping:XMt})}),vO={height:void 0,width:void 0};function JMt(e){const{externalRef:t,hiddenUntilFound:n,id:i,keepMounted:r,mounted:s,onOpenChange:a,open:l,setMounted:c,setOpen:u,transitionStatus:d}=e,f=p.useRef(null),h=p.useRef(null),[m,g]=p.useState(vO),b=p.useRef(vO),v=p.useRef(!1),y=p.useRef(l),x=p.useRef(!1),[w,O]=p.useState(!1),S=p.useRef(null),k=Yx(t,f),C=Sl(l),E=sQ(f),N=!l&&!s,A=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,R=n&&N&&h.current!=="css-animation",_=Wn((F,I=!0)=>{I&&(b.current=F),g(F)}),D=Wn(()=>{var F;(F=S.current)==null||F.call(S),S.current=null}),M=Wn(F=>{D(),S.current=()=>{S.current=null,F()}}),P=Wn(()=>{l&&s&&h.current==="css-animation"&&(x.current=!0)});Un(()=>{!w||d==="starting"||O(!1)},[w,d]),p.useEffect(()=>()=>{P(),D()},[P,D]),Un(()=>{const F=f.current;if(!F)return;!l&&S.current&&D();const I=e5t(F,j);if(h.current=I,l&&d==="idle"&&y.current&&I==="css-animation"){b.current=q0(F);return}if(l&&d==="starting"){const B=v.current;if(v.current=!1,I==="none"){_(q0(F)),O(!0);return}if(I==="css-transition"){const X=t5t(F);if(_(q0(F)),!B)return X;const ie=gA(F,"transition-duration","0s");return M(ie),O(!0),X}_(q0(F));const W=gA(F,"animation-name","none");if(!B){W();return}const H=gA(F,"animation-duration","0s");W(),M(H),O(!0);return}if(!l&&s&&(d==="idle"||d==="starting")){if(y.current=!1,x.current=!1,I==="none"){_(vO,!1),c(!1);return}_(q0(F));return}if(d!=="ending")return;if(I==="none"){c(!1);return}const z=q0(F);if(!(z.height>0||z.width>0)){c(!1);return}_(z),I==="css-animation"&&gA(F,"animation-name","none")()},[s,l,D,_,c,M,j,d]),TC({enabled:l&&s&&A==="idle",open:!0,ref:f,onComplete(){l&&_(vO,!1)}}),p.useEffect(()=>{if(l||!s||A!=="ending"||!f.current)return;const I=new AbortController;let z=-1;function K(){C.current||(c(!1),_(vO,!1))}return z=Jl.request(()=>{E(K,I.signal)}),()=>{Jl.cancel(z),I.abort()}},[C,s,l,A,E,_,c]),Un(()=>{const F=f.current;!F||!n||!N||F.setAttribute("hidden","until-found")},[N,n]),p.useEffect(function(){const I=f.current;if(!I)return;function z(K){const B=Ys(XTe,K);a(!0,B),!B.isCanceled&&(v.current=!0,u(!0))}return mi(I,"beforematch",z)},[a,u]);const L=r||n||s||l;return{height:T.height,props:{...R?{[MV.startingStyle]:""}:void 0,hidden:N,id:i},ref:k,shouldPreventOpenAnimation:j,shouldRender:L,transitionStatus:A,width:T.width}}function q0(e){return{height:e.scrollHeight,width:e.scrollWidth}}function e5t(e,t){const n=Bs(e).getComputedStyle(e),i=(n.animationName.split(",").map(s=>s.trim()).some(s=>s!==""&&s!=="none")||t)&&bne(n.animationDuration),r=bne(n.transitionDuration);return i&&r||r?"css-transition":i?"css-animation":"none"}function bne(e){return e.split(",").map(t=>t.trim()).some(t=>t!==""&&Number.parseFloat(t)>0)}function gA(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 t5t(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=Jl.request(n);return()=>{Jl.cancel(i),n()}}let yne=function(e){return e.accordionPanelHeight="--accordion-panel-height",e.accordionPanelWidth="--accordion-panel-width",e}({});const f5e=p.forwardRef(function(t,n){const{className:i,hiddenUntilFound:r,keepMounted:s,id:a,render:l,style:c,...u}=t,{hiddenUntilFound:d,keepMounted:f}=r5e(),{defaultPanelId:h,mounted:m,onOpenChange:g,open:b,setMounted:v,setOpen:y,setPanelIdState:x,transitionStatus:w}=a5e(),O=r??d,S=s??f,k=a||void 0,C=a??h;Un(()=>(x(I=>k??(I===null?void 0:I)),()=>{x(I=>I===k?null:I)}),[k,x]);const{height:E,props:N,ref:A,shouldPreventOpenAnimation:j,shouldRender:T,transitionStatus:R,width:_}=JMt({externalRef:n,hiddenUntilFound:O,id:C,keepMounted:S,mounted:m,onOpenChange:g,open:b,setMounted:v,setOpen:y,transitionStatus:w}),{state:D,triggerId:M}=DV(),P={...D,transitionStatus:R},L=BTe(c,P),F=wo("div",{...t,style:void 0},{state:P,ref:A,props:[N,{"aria-labelledby":M,role:"region",style:{[yne.accordionPanelHeight]:E===void 0?"auto":`${E}px`,[yne.accordionPanelWidth]:_===void 0?"auto":`${_}px`}},u,L?{style:L}:void 0,j?{style:{animationName:"none"}}:void 0],stateAttributesMapping:LV});return T?F:null}),n5t=(e,t)=>{const n=e.currentTarget,i={x:e.clientX,y:e.clientY},r=i5t(i,n.getBoundingClientRect()),s=r5t(i,r),a=s5t(t.getBoundingClientRect());return a5t([...s,...a])};function i5t(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 r5t(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 s5t(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 o5t(e,t){const{x:n,y:i}=e;let r=!1;for(let s=0,a=t.length-1;si!=h>i&&n<(f-u)*(i-d)/(h-d)+u&&(r=!r)}return r}function a5t(e){const t=e.slice();return t.sort((n,i)=>n.xi.x?1:n.yi.y?1:0),l5t(t)}function l5t(e){if(e.length<=1)return e.slice();const t=[];for(let i=0;i=2;){const s=t[t.length-1],a=t[t.length-2];if((s.x-a.x)*(r.y-a.y)>=(s.y-a.y)*(r.x-a.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],a=n[n.length-2];if((s.x-a.x)*(r.y-a.y)>=(s.y-a.y)*(r.x-a.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 c5t="_Transition_1wdpp_1",u5t="_Popover_1wdpp_3",h5e={Transition:c5t,Popover:u5t},p5e=p.createContext(null),gD=()=>{const e=p.use(p5e);if(!e)throw new Error("Popover components must be wrapped in ");return e},Wm=({open:e,onOpenChange:t,showOnHover:n=!1,hoverOpenDelay:i=150,children:r})=>{const[s,a]=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);wQ(()=>v(!1),b?500:null);const y=dg(t),x=dg(C=>{var E,N;clearTimeout(f.current),g!==C&&(C||(c(!1),n&&h.current&&((E=u.current)==null||E.focus()),h.current=!1),(N=y.current)==null||N.call(y,C),a(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 o.jsx(p5e,{value:k,children:o.jsx(tje,{open:g,onOpenChange:w,modal:!1,children:r})})},d5t=({children:e,onPointerDown:t,onClick:n})=>{const{setOpen:i,showOnHover:r,temporarilyPreventClickToClose:s,onTriggerEnter:a,onTriggerLeave:l,isPointerInTransitRef:c,triggerRef:u,contentRef:d}=gD(),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&&(a(),f.current=!0)},g=()=>{f.current&&(l(),f.current=!1)};return o.jsx(nje,{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})},m5e=({children:e,avoidCollisions:t,width:n,minWidth:i,maxWidth:r,side:s,sideOffset:a=8,align:l,alignOffset:c,translucent:u,className:d,autoFocus:f=!0})=>{const{showOnHover:h,shake:m,contentRef:g}=gD(),b=v=>{const y=g.current;if(y&&v.target===y&&v.key==="Tab"&&v.shiftKey){v.preventDefault(),v.stopPropagation();const x=TAe(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]),o.jsx(rje,{forceMount:!0,ref:g,className:Ci(h5e.Popover,d),style:Ky({"popover-width":n,"popover-min-width":i,"popover-max-width":r}),onCloseAutoFocus:h?Gh:void 0,"data-animate":m?"shake":void 0,"data-translucent":u?"true":void 0,side:s,sideOffset:a,align:l,alignOffset:c??(l==="center"?0:-5),avoidCollisions:t??!0,hideWhenDetached:!0,collisionPadding:20,onOpenAutoFocus:Gh,onEscapeKeyDown:Gh,onKeyDown:b,children:e})},f5t=e=>{const{setOpen:t,triggerRef:n,contentRef:i,isPointerInTransitRef:r,hoverOpenFocusedWithTab:s}=gD(),[a,l]=p.useState(null),c=p.useCallback(()=>{l(null),r.current=!1},[r]),u=p.useCallback((d,f)=>{const h=n5t(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(!a)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=!o5t(b,a),x=g.hasAttribute("aria-haspopup");v?c():(y||x)&&(c(),t(!1))};return document.addEventListener("pointermove",d),()=>document.removeEventListener("pointermove",d)},[a,t,c,n,i]),p.useEffect(()=>{const d=f=>{if(i.current&&f.key==="Tab"&&!f.shiftKey){const[h]=TAe(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]),o.jsx(m5e,{...e})},h5t=e=>{const{open:t,showOnHover:n,setOpen:i}=gD();return MC(t,()=>{i(!1)}),o.jsx(ije,{forceMount:!0,children:o.jsx(Xw,{enterDuration:600,exitDuration:300,className:h5e.Transition,disableAnimations:!0,children:t&&(n?o.jsx(f5t,{...e},"popover-hover"):o.jsx(m5e,{...e},"popover"))})})};Wm.Trigger=d5t;Wm.Content=h5t;const p5t=["skill_hub","skill_space","knowledge_base","tool"];function g5e(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m4 6 4 4 4-4"})})}function b5e({label:e}){return o.jsx("div",{className:"create-agent-card__loading",role:"status","aria-label":e,children:[0,1,2].map(t=>o.jsxs("div",{className:"create-agent-card__skeleton-row","aria-hidden":"true",children:[o.jsx("span",{}),o.jsx("span",{})]},t))})}function m5t(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 f3({label:e,resources:t}){const{t:n}=_e("conversation");return t.length===0?null:o.jsxs("section",{className:"create-agent-card__popover-section",children:[o.jsx("h4",{children:e}),o.jsx("div",{className:"create-agent-card__popover-list",children:t.map(i=>o.jsxs("div",{className:"create-agent-card__popover-item",children:[o.jsxs("div",{className:"create-agent-card__popover-item-heading",children:[o.jsx("strong",{children:i.name}),o.jsx(Lo,{color:"secondary",size:"sm",variant:"soft",children:m5t(i,n)})]}),i.description?o.jsx("p",{children:i.description}):null]},i.ref))})]})}function g5t({tools:e}){const{t}=_e("conversation");return e.length===0?null:o.jsxs("section",{className:"create-agent-card__popover-section",children:[o.jsx("h4",{children:t("blocks.createAgents.selfAuthoredTools")}),o.jsx(s5e,{children:e.map((n,i)=>o.jsxs(c5e,{className:"create-agent-card__python-tool",value:`${n.name}:${i}`,children:[o.jsx(u5e,{className:"create-agent-card__python-tool-header",children:o.jsxs(d5e,{className:"create-agent-card__python-tool-trigger",children:[o.jsxs("span",{children:[o.jsx("strong",{children:n.name}),n.description?o.jsx("small",{children:n.description}):null]}),o.jsxs("span",{className:"create-agent-card__python-tool-meta",children:[o.jsx(Lo,{color:"secondary",size:"sm",variant:"soft",children:t("blocks.createAgents.selfAuthoredTools")}),o.jsx(g5e,{className:"create-agent-card__python-tool-chevron"})]})]})}),o.jsxs(f5e,{className:"create-agent-card__python-tool-panel",children:[n.dependencies.length>0?o.jsx("div",{className:"create-agent-card__python-tool-dependencies",children:t("blocks.createAgents.dependencies",{items:n.dependencies.join(", ")})}):null,o.jsx("pre",{tabIndex:0,"aria-label":t("blocks.createAgents.fullCode",{name:n.name}),children:o.jsx("code",{children:n.code})})]})]},`${n.name}:${i}`))})]})}function b5t({agents:e}){const{t}=_e("conversation");return e.length===0?null:o.jsxs("section",{className:"create-agent-card__popover-section",children:[o.jsx("h4",{children:t("blocks.createAgents.subAgents")}),o.jsx("div",{className:"create-agent-card__popover-list",children:e.map(n=>o.jsxs("div",{className:"create-agent-card__popover-item",children:[o.jsxs("div",{className:"create-agent-card__popover-item-heading",children:[o.jsx("strong",{children:n.id}),o.jsx(Lo,{color:"secondary",size:"sm",variant:"soft",children:t(`blocks.createAgents.agentTypes.${n.type}`,{defaultValue:n.type})})]}),n.description?o.jsx("p",{children:n.description}):null]},n.id))})]})}function bA({label:e,count:t,icon:n,children:i}){const{t:r}=_e("conversation"),s=o.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,o.jsx("span",{children:t})]});return t===0?s:o.jsxs(Wm,{showOnHover:!0,hoverOpenDelay:120,children:[o.jsx(Wm.Trigger,{children:s}),o.jsx(Wm.Content,{side:"top",align:"start",minWidth:"auto",maxWidth:360,className:"create-agent-card__resource-popover",children:i})]})}function y5t({response:e,status:t}){const{t:n}=_e("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(()=>RMt(e,i),[i,e]),s=p.useMemo(()=>p5t.map(c=>{const u=IMt(r,c);return{value:c,label:n(`blocks.createAgents.categories.${c}`),...u,searchKeywords:[...new Set(u.sources.flatMap(d=>d.searchKeywords))]}}),[r,n]),a=t==="failed",l=a?mD(e):"";return o.jsx("section",{className:"create-agent-tool-card","aria-label":n("blocks.createAgents.collectionAria"),children:t==="running"?o.jsx(b5e,{label:n("blocks.createAgents.retrieving")}):a?o.jsxs("div",{className:"create-agent-card__message is-error",role:"alert",children:[o.jsx("span",{className:"create-agent-card__message-title",children:n("blocks.createAgents.retrievalFailed")}),o.jsx("span",{children:l||n("blocks.createAgents.checkConfig")})]}):o.jsx(s5e,{className:"create-agent-card__accordion",children:s.map(c=>o.jsxs(c5e,{className:"create-agent-card__accordion-item",value:c.value,children:[o.jsx(u5e,{className:"create-agent-card__accordion-header",children:o.jsxs(d5e,{className:"create-agent-card__accordion-trigger",children:[o.jsx("span",{children:c.label}),o.jsxs("span",{className:"create-agent-card__accordion-meta",children:[o.jsx(Lo,{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}),o.jsx(g5e,{className:"create-agent-card__accordion-chevron"})]})]})}),o.jsx(f5e,{className:"create-agent-card__accordion-content",children:o.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?o.jsxs("div",{className:"create-agent-card__search-keywords",children:[o.jsx("span",{children:n("blocks.createAgents.searchKeywords")}),o.jsx("span",{children:c.searchKeywords.join("、")})]}):null,c.resources.length>0?o.jsx("div",{className:"create-agent-card__resource-list",children:c.resources.map(u=>o.jsx("div",{className:"create-agent-card__resource",children:o.jsxs("div",{className:"create-agent-card__resource-main",children:[o.jsxs("div",{className:"create-agent-card__resource-title",children:[o.jsx("span",{className:"create-agent-card__resource-name",children:u.name}),u.version?o.jsx(Lo,{className:"create-agent-card__resource-version",color:"secondary",size:"sm",variant:"soft",children:u.version}):null]}),u.description?o.jsx("p",{children:u.description}):null]})},u.ref))}):o.jsxs("div",{className:"create-agent-card__empty-category",children:[o.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=>o.jsx("p",{className:"create-agent-card__raw-source-error",children:u.message},u.source))]})]})})]},c.value))},r.collectionId||"collected-resources")})}function v5t({args:e,response:t,status:n}){const{t:i}=_e("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(()=>JMe(e,t,r),[e,r,t]),a=n==="failed"?mD(t):"";return o.jsxs("section",{className:"create-agent-tool-card is-agent-results","aria-label":i("blocks.createAgents.resultAria"),children:[a?o.jsxs("div",{className:"create-agent-card__message is-error",role:"alert",children:[o.jsx("span",{className:"create-agent-card__message-title",children:i("blocks.createAgents.creationFailed")}),o.jsx("span",{children:a})]}):null,s.agents.length>0?o.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"&&a,d=l.builtinTools.length+l.pythonTools.length;return o.jsxs(Uz,{className:`create-agent-card__agent-card${u?" is-error":""}`,children:[o.jsx(Qz,{leading:o.jsx(cw,{seed:l.name}),title:l.name,titleText:l.name,status:o.jsx(Lo,{color:"secondary",size:"sm",variant:"soft",children:i(`blocks.createAgents.agentTypes.${l.rootType}`,{defaultValue:l.rootType})})}),l.description?o.jsx(zz,{children:l.description}):null,u?o.jsx("div",{className:"create-agent-card__agent-result is-error",role:"alert",children:u}):null,o.jsxs("div",{className:"create-agent-card__agent-resources","aria-label":i("blocks.createAgents.agentResources",{name:l.name}),children:[o.jsx(bA,{label:i("blocks.createAgents.skill"),count:l.skills.length,icon:o.jsx(z_,{"aria-hidden":"true"}),children:o.jsx(f3,{label:i("blocks.createAgents.skill"),resources:l.skills})}),o.jsx(bA,{label:i("blocks.createAgents.knowledgeBase"),count:l.knowledgeBases.length,icon:o.jsx(Lje,{"aria-hidden":"true"}),children:o.jsx(f3,{label:i("blocks.createAgents.knowledgeBase"),resources:l.knowledgeBases})}),o.jsxs(bA,{label:i("blocks.createAgents.toolsLabel"),count:d,icon:o.jsx(_it,{"aria-hidden":"true"}),children:[o.jsx(f3,{label:i("blocks.createAgents.builtinTool"),resources:l.builtinTools}),o.jsx(g5t,{tools:l.pythonTools})]}),o.jsx(bA,{label:i("blocks.createAgents.subAgents"),count:l.subAgentCount,icon:o.jsx(Nit,{"aria-hidden":"true"}),children:o.jsx(b5t,{agents:l.subAgents})})]})]},l.name)})}):n==="running"?o.jsx(b5e,{label:i("blocks.createAgents.creating")}):o.jsxs("div",{className:"create-agent-card__message",children:[o.jsx("span",{className:"create-agent-card__message-title",children:i("blocks.createAgents.noAgents")}),o.jsx("span",{children:i("blocks.createAgents.noAgentResult")})]})]})}const x5t={web_search:{name:"web_search",runningLabel:"Searching the web",doneLabel:"Web search complete",tone:"search",icon:dne},link_reader:{name:"link_reader",runningLabel:"Reading webpage",doneLabel:"Webpage read complete",tone:"search",icon:dne},run_code:{name:"run_code",runningLabel:"Running code in the AgentKit sandbox",doneLabel:"Code execution completed in the AgentKit sandbox",tone:"sandbox",icon:uMt},list_envs:{name:"list_envs",runningLabel:"Checking available environments",doneLabel:"Available environments loaded",tone:"resources",icon:fMt},get_env_manifest:{name:"get_env_manifest",runningLabel:"Loading the environment manifest",doneLabel:"Environment manifest loaded",tone:"knowledge",icon:hMt},execute_in_sandbox:{name:"execute_in_sandbox",runningLabel:"Running a command in the environment",doneLabel:"Command completed in the environment",tone:"sandbox",icon:hne},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:hne},image_generate:{name:"image_generate",runningLabel:"Generating image",doneLabel:"Image generated",tone:"image",icon:sMt},video_generate:{name:"video_generate",runningLabel:"Generating video",doneLabel:"Video generated",tone:"video",icon:NV},ppt_generate:{name:"ppt_generate",runningLabel:"Generating presentation",doneLabel:"Presentation generated",tone:"presentation",icon:oMt},load_memory:{name:"load_memory",runningLabel:"Searching long-term memory",doneLabel:"Memory search complete",tone:"memory",icon:aMt},load_knowledgebase:{name:"load_knowledgebase",runningLabel:"Searching the knowledge base",doneLabel:"Knowledge base search complete",tone:"knowledge",icon:lMt},load_skill:{name:"load_skill",runningLabel:"Loading skill",doneLabel:"Skill loaded",tone:"skill",icon:cMt},collect_resources:{name:"collect_resources",runningLabel:"Collecting available resources",doneLabel:"Resource collection complete",failedLabel:"Resource collection failed",tone:"resources",icon:dMt,detailRenderer:y5t},create_agents:{name:"create_agents",runningLabel:"Creating and running agents",doneLabel:"Agent creation complete",failedLabel:"Agent creation failed",tone:"agent",icon:fne,detailRenderer:v5t},branch_compare:{name:"branch_compare",runningLabel:"",doneLabel:"",failedLabel:"",tone:"search",icon:fne,detailRenderer:MMt,hideHeader:!0}};function w5t(e){return x5t[e]}function O5t(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M6 3h8l4 4v14H6Z"}),o.jsx("path",{d:"M14 3v5h5"}),o.jsx("path",{d:"m10 12-2 2 2 2M14 12l2 2-2 2"})]})}function k5t(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.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"}),o.jsx("path",{d:"m9 12 2 2 4-4"})]})}function S5t(e,t){const n=new Map(e.map(a=>[a.path,a.content])),i=new Map(t.map(a=>[a.path,a.content])),r=new Set([...n.keys(),...i.keys()]),s=[];for(const a of[...r].sort((l,c)=>l.localeCompare(c))){const l=n.get(a),c=i.get(a);l!==c&&s.push({path:a,status:l===void 0?"added":c===void 0?"deleted":"modified",before:l??"",after:c??""})}return s}function $g(e){return{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.75,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,...e}}function y5e(e){return o.jsx("svg",{...$g(e),children:o.jsx("path",{d:"m9 7-5 5 5 5M15 7l5 5-5 5M13.5 4l-3 16"})})}function h3(e){return o.jsx("svg",{...$g(e),children:o.jsx("path",{d:"M6.5 3.75h7l4 4V20.25h-11zM13.5 3.75v4h4M9 12h6M9 15.5h4.5"})})}function E5t(e){return o.jsx("svg",{...$g(e),children:o.jsx("path",{d:"M3.75 7.25h6l1.75 2h8.75v9.25H3.75zM3.75 7.25V5.5h5l1.5 1.75"})})}function C5t(e){return o.jsx("svg",{...$g(e),children:o.jsx("path",{d:"m9 5 7 7-7 7"})})}function bD(e){return o.jsx("svg",{...$g(e),children:o.jsx("path",{d:"m6.5 6.5 11 11M17.5 6.5l-11 11"})})}function T5t(e){return o.jsxs("svg",{...$g(e),children:[o.jsx("circle",{cx:"12",cy:"12",r:"3.25"}),o.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 A5t(e){return o.jsx("svg",{...$g(e),children:o.jsx("path",{d:"M19.25 15.25A8 8 0 0 1 8.75 4.75a8 8 0 1 0 10.5 10.5Z"})})}function v5e(e){return o.jsxs("svg",{...$g(e),children:[o.jsx("path",{d:"M19.25 8.25V4.5l-1.8 1.8a7.5 7.5 0 1 0 1.8 7.65"}),o.jsx("path",{d:"M19.25 4.5H15.5"})]})}const _5t=p.lazy(()=>Ls(()=>Promise.resolve().then(()=>G$e),void 0)),j5t=p.lazy(()=>Ls(()=>import("../chunks/CodeDiffEditor-CY8AAarl.js"),[])),x5e="veadk-code-workspace-theme";function N5t(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,a)=>{let l=r.children.get(s);l||(l={name:s,children:new Map},r.children.set(s,l)),a===i.length-1&&(l.path=n.path),r=l})}return t}function R5t(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 I5t(){if(typeof window>"u")return"light";try{return window.localStorage.getItem(x5e)==="dark"?"dark":"light"}catch{return"light"}}function P5t(e){return e===""?0:e.split(` +`||c==="\r")&&(s=!1);continue}if(a){c==="*"&&u==="/"&&(a=!1,l+=1);continue}if(i){r?r=!1:c==="\\"?r=!0:c===i&&(i="");continue}if(c==="/"&&u==="/"){s=!0,l+=1;continue}if(c==="/"&&u==="*"){a=!0,l+=1;continue}if(c==="'"||c==='"'){i=c;continue}const d=e.slice(l).match(n);if(d)return{index:l,openingIndex:l+d[0].lastIndexOf("("),type:d[1]==="LinearGradient"?"linear":"radial"}}}function qIt(e){let t=e,n=0;for(;;){const i=HIt(t,n);if(!i)return t;const r=QIt(t,i.openingIndex),s=t.slice(i.openingIndex+1,r),a=JSON.stringify(VIt(i.type,s));t=`${t.slice(0,i.index)}${a}${t.slice(r+1)}`,n=i.index+a.length}}function wMe(e,t=!1){if(e.length>$It)throw new Error("ECharts option is too large");const n=qIt(UIt(e));let i;try{i=xMe.parse(n)}catch(a){throw/\bfunction\s*\(|=>/.test(n)?new Error("ECharts function callbacks are not supported"):a}if(!ak(i))throw new Error("ECharts option must be a data object");fR(i);const r={...i};r.aria={...ak(r.aria)?r.aria:{},enabled:!0};const s=r.tooltip;return ak(s)?r.tooltip={...s,renderMode:"richText"}:Array.isArray(s)&&(r.tooltip=s.map(a=>ak(a)?{...a,renderMode:"richText"}:a)),t&&(r.animation=!1),r}let l3;function WIt(){return l3??(l3=Ls(()=>import("../visualizations/echarts/index-CGT341lL.js"),[]).catch(e=>{throw l3=void 0,e})),l3}function KIt({source:e}){const{t}=_e("conversation"),n=p.useRef(null),[i,r]=p.useState(!1),[s,a]=p.useState("");return p.useEffect(()=>{let l=!1,c,u,d;r(!1);try{d=wMe(e,window.matchMedia("(prefers-reduced-motion: reduce)").matches),a("")}catch{a("invalid");return}return WIt().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||a("render")}),()=>{l=!0,u==null||u.disconnect(),c==null||c.dispose()}},[e]),o.jsxs("div",{className:`echarts-diagram${s?" echarts-diagram--error":""}`,role:"img","aria-label":t("visualization.echartsAria"),"aria-busy":!i&&!s,children:[o.jsx("div",{ref:n,className:"echarts-diagram__canvas",hidden:!!s}),!i&&!s?o.jsx("div",{className:"echarts-diagram__state","aria-live":"polite",children:o.jsx(bn,{duration:2.2,spread:15,children:t("visualization.rendering")})}):null,s?o.jsx("p",{className:"echarts-diagram__error",role:"alert",children:t(s==="invalid"?"visualization.invalidEcharts":"visualization.renderFailed")}):null]})}const GIt=p.memo(KIt);let nne,ine=Promise.resolve(),XIt=0;function YIt(){return nne??(nne=Ls(async()=>{const{default:e}=await import("../visualizations/mermaid/mermaid.core-D2fLiU9C.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))),nne}function ZIt(e){const t=ine.then(async()=>{const n=await YIt(),i=`mermaid-diagram-${XIt+=1}`;return n.render(i,e)});return ine=t.then(()=>{},()=>{}),t}function JIt({source:e}){const{t}=_e("conversation"),n=p.useRef(null),[i,r]=p.useState(null),[s,a]=p.useState(!1);return p.useEffect(()=>{let l=!1;return r(null),a(!1),ZIt(e).then(c=>{l||r(c)}).catch(()=>{l||a(!0)}),()=>{l=!0}},[e]),p.useEffect(()=>{!(i!=null&&i.bindFunctions)||!n.current||i.bindFunctions(n.current)},[i]),s?o.jsx("div",{className:"mermaid-diagram mermaid-diagram--error",children:o.jsx("p",{className:"mermaid-diagram__error",role:"alert",children:t("visualization.mermaidFailed")})}):i?o.jsx("div",{ref:n,className:"mermaid-diagram",role:"img","aria-label":t("visualization.mermaidAria"),dangerouslySetInnerHTML:{__html:i.svg}}):o.jsx("div",{className:"mermaid-diagram mermaid-diagram--loading","aria-live":"polite",children:o.jsx(bn,{duration:2.2,spread:15,children:t("visualization.rendering")})})}const ePt=p.memo(JIt),tPt="_SegmentedControl_1sl7d_1",nPt="_SegmentedControlOption_1sl7d_140",iPt="_SegmentedControlThumb_1sl7d_219",R8={SegmentedControl:tPt,SegmentedControlOption:nPt,SegmentedControlThumb:iPt},Ru=({value:e,onChange:t,children:n,block:i,pill:r=!0,size:s="md",gutterSize:a,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"})}},[]);SAe({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||PN(()=>{b.style.transition="width 300ms var(--cubic-enter), transform 300ms var(--cubic-enter)"}))},[h,e,s,a,r]);const m=g=>{g&&t&&t(g)};return o.jsxs(Tct,{ref:d,className:Ti(R8.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":a,...u,children:[o.jsx("div",{className:R8.SegmentedControlThumb,ref:f}),n]})},rPt=({children:e,...t})=>o.jsx(Rct,{className:R8.SegmentedControlOption,...t,onPointerEnter:OQ,children:o.jsx("span",{className:"relative",children:e})});Ru.Option=rPt;function sPt({children:e,label:t,language:n,source:i,streaming:r=!1}){const{t:s}=_e("conversation"),[a,l]=p.useState("preview"),c=r?"code":a;return o.jsxs("section",{className:"visualization-card","aria-label":s("visualization.cardAria",{label:t}),children:[o.jsx("div",{className:"visualization-card__toolbar",children:o.jsxs(Ru,{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:[o.jsx(Ru.Option,{value:"preview",disabled:r,children:s("visualization.preview")}),o.jsx(Ru.Option,{value:"code",children:s("visualization.code")})]})}),o.jsx("div",{className:"visualization-card__body",children:c==="code"?o.jsx("pre",{className:"visualization-card__code",children:o.jsx("code",{className:`language-${n}`,children:i})}):e})]})}const oPt=p.memo(sPt);function OMe(e){const t=e==null?void 0:e.trim().toLowerCase();if(t==="mermaid")return"mermaid";if(t==="echart"||t==="echarts")return"echarts"}const kMe=[".mp4",".webm",".mov",".m4v",".ogg",".avi"];function I8(e){return typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(I8).join(""):p.isValidElement(e)?I8(e.props.children):""}function aPt(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 OMe(n==null?void 0:n.slice(9))}function SMe(e){if(!e)return!1;try{const t=e.toLowerCase();return kMe.some(n=>t.includes(n))}catch{return!1}}function lPt(e){var i;const t=(i=e==null?void 0:e.properties)==null?void 0:i.href;if(!t)return!1;if(SMe(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 kMe.some(s=>r.includes(s))}return!1}function cPt({text:e,className:t,allowRawHtml:n=!0,streaming:i=!1}){const{t:r}=_e("conversation"),[s,a]=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 o.jsxs("div",{className:t?`md ${t}`:"md",children:[o.jsx(OPe,{remarkPlugins:[WPe],rehypePlugins:n?[SIt,Mte]:[Mte],components:{pre:({node:d,children:f,...h})=>{const m=aPt(f);if(m==="mermaid"||m==="echarts"){const g=I8(f).replace(/\n$/,"");return o.jsx(oPt,{label:m==="mermaid"?"Mermaid":"ECharts",language:m,source:g,streaming:i,children:m==="mermaid"?o.jsx(ePt,{source:g}):o.jsx(GIt,{source:g})})}return o.jsx("pre",{...h,children:f})},a:({node:d,...f})=>{const h=f.href;if(h&&(SMe(h)||lPt(d))){const m=h,g=u(d==null?void 0:d.children);return o.jsxs("div",{className:"video-container",children:[o.jsxs("button",{type:"button",className:"video-preview-trigger","aria-label":r("markdown.playVideo",{name:g}),onClick:()=>a({src:m,title:g}),children:[o.jsx("video",{src:m,playsInline:!0,className:"video-thumbnail",preload:"metadata"}),o.jsx("span",{className:"video-preview-hint","aria-hidden":"true",children:o.jsx(ox,{})})]}),o.jsx("div",{className:"video-caption",children:o.jsx("a",{href:m,target:"_blank",rel:"noopener noreferrer",className:"video-link-text",children:g})})]})}return o.jsx("a",{...f,target:"_blank",rel:"noopener noreferrer"})},img:({node:d,src:f,alt:h,...m})=>{const g=o.jsx("img",{...m,src:f,alt:h??"",loading:"lazy"});return f?o.jsx(xEe,{src:f,children:o.jsxs("button",{type:"button",className:"image-preview-trigger","aria-label":r("markdown.enlargeImage",{name:h||r("markdown.image")}),children:[g,o.jsx("span",{className:"image-preview-hint","aria-hidden":"true",children:o.jsx(ox,{})})]})}):g},video:({node:d,src:f,children:h,...m})=>{const g=l({src:f},h);return g?o.jsx("div",{className:"video-container",children:o.jsxs("button",{type:"button",className:"video-preview-trigger","aria-label":r("markdown.enlargeVideo"),onClick:()=>a({src:g}),children:[o.jsx("video",{src:g,...m,playsInline:!0,className:"video-thumbnail",children:h}),o.jsx("span",{className:"video-preview-hint","aria-hidden":"true",children:o.jsx(ox,{})})]})}):o.jsx("video",{src:f,controls:!0,playsInline:!0,className:"video-inline",...m,children:h})}},children:e}),s&&o.jsx("div",{className:"video-viewer-backdrop",role:"dialog","aria-modal":"true","aria-label":r("markdown.videoPreview"),onClick:()=>a(null),children:o.jsxs("div",{className:"video-viewer",onClick:d=>d.stopPropagation(),children:[o.jsxs("div",{className:"video-viewer-header",children:[o.jsx("div",{className:"video-viewer-title",children:s.title||c(s.src)}),o.jsxs("nav",{className:"video-viewer-nav",children:[o.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:o.jsx(mP,{})}),o.jsx("button",{type:"button",className:"video-viewer-close","aria-label":r("markdown.close"),onClick:()=>a(null),children:o.jsx(ka,{})})]})]}),o.jsx("div",{className:"video-viewer-body",children:o.jsx("video",{src:s.src,controls:!0,autoPlay:!0,playsInline:!0,className:"video-fullscreen"})})]})})]})}const Zu=p.memo(cPt);function c3(e){return(e==null?void 0:e.trim())||Dg("resourceMetadata.unknownSource")}function EMe(e){return(e==null?void 0:e.trim())||Dg("resourceMetadata.unknownCreator")}function uPt(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.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"}),o.jsx("path",{d:"M5 18.5A2.5 2.5 0 0 1 7.5 16H19"}),o.jsx("path",{d:"M9 7h6M9 10h4"})]})}function dPt(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M6 3h8l4 4v14H6V3Z"}),o.jsx("path",{d:"M14 3v5h5M9 12h6M9 16h6"})]})}function fPt(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m7 7 10 10M17 7 7 17"})})}function hPt(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"M12 5v14M5 12h14"})})}function oT({title:e,children:t,onClose:n,busy:i=!1,className:r=""}){const{t:s}=_e("ui"),a=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()}},[]),Jn.createPortal(o.jsx("div",{className:"knowledge-dialog-backdrop",onMouseDown:f=>{f.target===f.currentTarget&&!i&&n()},children:o.jsxs("section",{ref:c,className:`knowledge-dialog${r?` ${r}`:""}`,role:"dialog","aria-modal":"true","aria-labelledby":a,"aria-busy":i||void 0,children:[o.jsxs("header",{className:"knowledge-dialog__header",children:[o.jsx("h2",{id:a,children:e}),o.jsx("button",{ref:l,type:"button",onClick:n,disabled:i,"aria-label":s("common.close"),children:o.jsx(fPt,{})})]}),t]})}),document.body)}function kE({message:e}){return e?o.jsx("div",{className:"knowledge-form-error",role:"alert",children:e}):null}function P8(e){return e instanceof DOMException&&e.name==="AbortError"}function pPt(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 CMe=[".jpg",".jpeg",".png"].join(","),mPt=new Set(CMe.split(",")),TMe=[".pdf",".pptx",".docx",".xlsx",".txt"].join(","),gPt=new Set(TMe.split(",")),bPt=200*1024*1024;function D8(e){const t=e.lastIndexOf(".");return t<0?"":e.slice(t).toLocaleLowerCase()}function yPt(e,t,n){return e.size>bPt?n("knowledge.errors.fileTooLarge"):t==="image"?mPt.has(D8(e.name))?"":n("knowledge.errors.invalidImageType"):gPt.has(D8(e.name))?"":n("knowledge.errors.invalidDocumentType")}function AV(e){return e<=0?"-":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function M8(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 vPt({region:e,onClose:t,onCreated:n}){const{t:i}=_e("ui"),[r,s]=p.useState(""),[a,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:a.trim()||void 0,region:e};try{n(await tOt(x))}catch(w){m(il(w,i("knowledge.errors.createBase")))}finally{f(!1)}};return o.jsx(oT,{title:i("knowledge.createBase"),onClose:t,busy:d,children:o.jsxs("form",{onSubmit:y=>void v(y),children:[o.jsxs("div",{className:"knowledge-dialog__body",children:[o.jsxs("label",{children:[o.jsx("span",{children:i("common.name")}),o.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)})]}),o.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")}),o.jsxs("label",{children:[o.jsx("span",{children:i("knowledge.optionalDescription")}),o.jsx("textarea",{value:a,maxLength:80,onChange:y=>l(y.target.value)})]}),o.jsx(kE,{message:h})]}),o.jsxs("footer",{className:"knowledge-dialog__actions",children:[o.jsx("button",{type:"button",onClick:t,disabled:d,children:i("common.cancel")}),o.jsx("button",{type:"submit",className:"is-primary",disabled:d||!g||b,children:i(d?"common.creating":"common.create")})]})]})})}function xPt({item:e,onClose:t,onUpdated:n}){const{t:i}=_e("ui"),[r,s]=p.useState(e.description),[a,l]=p.useState(!1),[c,u]=p.useState(""),d=async f=>{f.preventDefault(),l(!0),u("");try{n(await nOt(e.id,e.region,{description:r.trim()}))}catch(h){u(il(h,i("knowledge.errors.updateBase")))}finally{l(!1)}};return o.jsx(oT,{title:i("knowledge.editBase"),onClose:t,busy:a,children:o.jsxs("form",{onSubmit:f=>void d(f),children:[o.jsxs("div",{className:"knowledge-dialog__body",children:[o.jsxs("label",{children:[o.jsx("span",{children:i("common.name")}),o.jsx("input",{value:e.name,disabled:!0})]}),o.jsxs("label",{children:[o.jsx("span",{children:i("common.description")}),o.jsx("textarea",{autoFocus:!0,value:r,maxLength:80,onChange:f=>s(f.target.value)})]}),o.jsx("p",{className:"knowledge-dialog__note",children:i("knowledge.descriptionOnly")}),o.jsx(kE,{message:c})]}),o.jsxs("footer",{className:"knowledge-dialog__actions",children:[o.jsx("button",{type:"button",onClick:t,disabled:a,children:i("common.cancel")}),o.jsx("button",{type:"submit",className:"is-primary",disabled:a,children:i(a?"common.saving":"common.save")})]})]})})}function AMe(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 wPt({base:e,onClose:t,onCreated:n,onAssociationInvalid:i}){const{t:r}=_e("ui"),[s,a]=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),N=p.useRef(null),A=p.useRef(null),j=p.useRef(null),T=p.useRef(0),R=!!w;p.useEffect(()=>{var L;C&&!R&&((L=j.current)==null||L.focus())},[R,C]);const _=L=>{R||L===s||(a(L),g(null),h(""),c(""),d(""),k(""),E(null),v(!1),T.current=0,N.current&&(N.current.value=""))},D=L=>{if(!L||s==="web")return;const F=yPt(L,s,r);if(F){g(null),c(""),d(""),k(F);return}g(L),k(""),c(L.name.replace(/\.[^.]+$/,"")),d(D8(L.name).slice(1))},M=async L=>{if(L.preventDefault(),s==="web"?!f.trim():!m)return;let F;try{F=AMe(y,r("knowledge.errors.metadataObject"))}catch(I){k(il(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 oOt(e.id,e.region,I),n()}else{const I=await aOt(e.id,e.region,{url:f.trim()});if(!I.sourceMarkdown.trim())throw new Error(r("knowledge.errors.noWebPreview"));E({preview:I,metadata:F})}else m&&(await lOt(e.id,e.region,{file:m,name:l.trim()||void 0,documentType:u.trim()||void 0,metadata:F}),n())}catch(I){I instanceof KP&&I.errorCode===DIe?i(I):k(il(I,r(s==="web"?C?"knowledge.errors.addWeb":"knowledge.errors.previewWeb":"knowledge.errors.uploadFile")))}finally{O("")}},P=()=>{R||(E(null),k(""),requestAnimationFrame(()=>{var L;return(L=A.current)==null?void 0:L.focus()}))};return o.jsx(oT,{title:r(C?"knowledge.previewWeb":"knowledge.addData"),onClose:t,busy:R,className:C?"knowledge-dialog--preview knowledge-dialog--web-confirm":"",children:o.jsx("form",{onSubmit:L=>void M(L),children:C?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"knowledge-preview knowledge-web-preview",children:[o.jsxs("div",{className:"knowledge-preview__meta",children:[o.jsx("strong",{title:C.preview.name,children:C.preview.name}),o.jsx("a",{href:C.preview.url,target:"_blank",rel:"noopener noreferrer",children:r("knowledge.openOriginalWeb")})]}),o.jsx("div",{className:"knowledge-preview__body","aria-live":"polite",children:o.jsx("div",{className:"knowledge-preview__markdown-shell",children:o.jsx(Zu,{text:C.preview.sourceMarkdown,allowRawHtml:!1,className:"knowledge-preview__markdown"})})}),S?o.jsx("div",{className:"knowledge-web-preview__error",children:o.jsx(kE,{message:S})}):null]}),o.jsxs("footer",{className:"knowledge-dialog__actions",children:[o.jsx("button",{type:"button",className:"is-back",onClick:P,disabled:R,children:r("knowledge.backToEdit")}),o.jsx("button",{type:"button",onClick:t,disabled:R,children:r("common.cancel")}),o.jsx("button",{ref:j,type:"submit",className:"is-primary",disabled:R,children:r(w==="save"?"common.adding":"knowledge.confirmAdd")})]})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"knowledge-dialog__body",children:[o.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,F])=>o.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:R,onClick:()=>_(L),onKeyDown:I=>{const z=["image","document","web"];if(!["ArrowLeft","ArrowRight","Home","End"].includes(I.key))return;I.preventDefault();const K=z.indexOf(L),B=I.key==="Home"?z[0]:I.key==="End"?z[z.length-1]:z[(K+(I.key==="ArrowRight"?1:-1)+z.length)%z.length];_(B),requestAnimationFrame(()=>{var W;return(W=document.getElementById(`knowledge-source-${B}-tab`))==null?void 0:W.focus()})},children:F},L))}),o.jsx("div",{id:`knowledge-source-${s}-panel`,className:"knowledge-source-panel",role:"tabpanel","aria-labelledby":`knowledge-source-${s}-tab`,children:s==="web"?o.jsxs(o.Fragment,{children:[o.jsxs("label",{children:[o.jsx("span",{children:r("knowledge.webUrl")}),o.jsx("input",{ref:A,autoFocus:!0,type:"url",value:f,disabled:R,onChange:L=>{h(L.target.value),k("")},placeholder:"https://example.com/article"})]}),o.jsx("div",{className:"knowledge-upload-status",role:"status","aria-live":"polite",children:w==="preview"?o.jsx(bn,{children:r("knowledge.generatingWebPreview")}):null})]}):o.jsxs(o.Fragment,{children:[o.jsx("input",{ref:N,className:"knowledge-upload-input",type:"file","aria-label":r("knowledge.selectFile"),accept:s==="image"?CMe:TMe,disabled:R,onChange:L=>{var F;D(((F=L.currentTarget.files)==null?void 0:F[0])??null),L.currentTarget.value=""}}),o.jsxs("button",{type:"button",className:`knowledge-upload-dropzone${b?" is-dragging":""}${m?" is-ready":""}`,disabled:R,onClick:()=>{var L;return(L=N.current)==null?void 0:L.click()},onDragEnter:L=>{L.preventDefault(),!R&&(T.current+=1,v(!0))},onDragOver:L=>{L.preventDefault(),R||(L.dataTransfer.dropEffect="copy")},onDragLeave:L=>{L.preventDefault(),T.current=Math.max(0,T.current-1),T.current===0&&v(!1)},onDrop:L=>{var F;L.preventDefault(),T.current=0,v(!1),R||D(((F=L.dataTransfer.files)==null?void 0:F[0])??null)},children:[o.jsx("strong",{children:m?m.name:r("knowledge.selectOrDropFile")}),o.jsx("span",{children:m?r("knowledge.selectedFile",{size:AV(m.size)}):r(s==="image"?"knowledge.imageFileHelp":"knowledge.documentFileHelp")})]}),o.jsx("div",{className:"knowledge-upload-status",role:"status","aria-live":"polite",children:R?o.jsx(bn,{children:r("knowledge.uploadingFile")}):null})]})}),s!=="web"?o.jsxs("div",{className:"knowledge-dialog__fields",children:[o.jsxs("label",{children:[o.jsx("span",{children:r("knowledge.optionalName")}),o.jsx("input",{value:l,disabled:R,maxLength:256,onChange:L=>c(L.target.value)})]}),o.jsxs("label",{children:[o.jsx("span",{children:r("knowledge.optionalType")}),o.jsx("input",{value:u,disabled:R,maxLength:64,onChange:L=>d(L.target.value),placeholder:"pdf, docx, png"})]})]}):null,o.jsxs("label",{children:[o.jsx("span",{children:r("knowledge.metadataJson")}),o.jsx("textarea",{className:"is-code",value:y,disabled:R,onChange:L=>x(L.target.value),spellCheck:!1})]}),o.jsx(kE,{message:S})]}),o.jsxs("footer",{className:"knowledge-dialog__actions",children:[o.jsx("button",{type:"button",onClick:t,disabled:R,children:r("common.cancel")}),o.jsx("button",{type:"submit",className:"is-primary",disabled:R||(s==="web"?!f.trim():!m),children:r(R?s==="web"?"common.generating":"common.uploading":s==="web"?"knowledge.generatePreview":"knowledge.uploadFile")})]})]})})})}function OPt({base:e,item:t,onClose:n,onUpdated:i}){const{t:r}=_e("ui"),[s,a]=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=AMe(s,r("knowledge.errors.metadataObject"))}catch(g){d(il(g,r("knowledge.errors.metadataFormat")));return}c(!0),d("");try{i(await cOt(e.id,t.id,e.region,{metadata:m}))}catch(g){d(il(g,r("knowledge.errors.updateDocument")))}finally{c(!1)}};return o.jsx(oT,{title:r("knowledge.editMetadata"),onClose:n,busy:l,children:o.jsxs("form",{onSubmit:h=>void f(h),children:[o.jsxs("div",{className:"knowledge-dialog__body",children:[o.jsxs("label",{children:[o.jsx("span",{children:r("knowledge.knowledge")}),o.jsx("input",{value:t.name||t.id,disabled:!0})]}),o.jsxs("label",{children:[o.jsx("span",{children:r("knowledge.metadataJson")}),o.jsx("textarea",{autoFocus:!0,className:"is-code knowledge-metadata-editor",value:s,onChange:h=>a(h.target.value),spellCheck:!1})]}),o.jsx(kE,{message:u})]}),o.jsxs("footer",{className:"knowledge-dialog__actions",children:[o.jsx("button",{type:"button",onClick:n,disabled:l,children:r("common.cancel")}),o.jsx("button",{type:"submit",className:"is-primary",disabled:l,children:r(l?"common.saving":"common.save")})]})]})})}const _Me=new Set(["avif","bmp","gif","jpeg","jpg","png","svg","webp"]),jMe=new Set(["aac","flac","m4a","mp3","ogg","wav","webm"]),NMe=new Set(["m4v","mov","mp4","mpeg","mpg","ogg","webm"]),kPt=new Set(["pdf"]),SPt=new Set(["doc","docx","ppt","pptx","xls","xlsx"]),EPt=new Set(["creating","indexing","pending","processing","queued","submitted"]),CPt=new Set(["error","failed","unavailable"]);function rne(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:{}}function mA(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 TPt(e,t){if(Array.isArray(e)){if(e.length===0)return null;const r=e.map(rne);if(r.some(s=>Object.keys(s).length>0)){const s=[...new Set(r.flatMap(a=>Object.keys(a)))];return{columns:s,rows:r.map(a=>s.map(l=>mA(a[l])))}}return{columns:[t("knowledge.value")],rows:e.map(s=>[mA(s)])}}const n=rne(e),i=Object.entries(n);if(i.length===0)return null;if(i.every(([,r])=>Array.isArray(r))){const r=i.map(([a])=>a),s=Math.max(...i.map(([,a])=>a.length));return{columns:r,rows:Array.from({length:s},(a,l)=>i.map(([,c])=>mA(c[l])))}}return{columns:[t("knowledge.field"),t("knowledge.value")],rows:i.map(([r,s])=>[r,mA(s)])}}function RMe(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 APt(e){const t=RMe(e);return t.startsWith("http://")||t.startsWith("https://")?t:""}function _Pt(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 _Me.has(i)?"image":jMe.has(i)?"audio":NMe.has(i)?"video":kPt.has(i)?"pdf":t||i?"file":"none"}function jPt(e,t){const n=e.status.trim().toLocaleLowerCase();if(EPt.has(n))return{title:t("knowledge.preview.processingTitle"),detail:t("knowledge.preview.processingDetail")};if(CPt.has(n))return{title:t("knowledge.preview.failedTitle"),detail:t("knowledge.preview.failedDetail")};const i=M8(e).toLocaleLowerCase();return i==="pdf"||SPt.has(i)?{title:t("knowledge.preview.noParsedTitle"),detail:t("knowledge.preview.noParsedDetail")}:_Me.has(i)||jMe.has(i)||NMe.has(i)?{title:t("knowledge.preview.noMediaTitle"),detail:t("knowledge.preview.noMediaDetail")}:{title:t("knowledge.preview.noDataTitle"),detail:t("knowledge.preview.noDataDetail")}}function NPt({chunk:e}){const{t}=_e("ui"),[n,i]=p.useState(!1),r=RMe(e.attachmentUrl),s=_Pt(e);return!r||s==="none"?null:n?o.jsx("div",{className:"knowledge-preview__attachment-error",children:t("knowledge.preview.attachmentError")}):s==="image"?o.jsx("img",{className:"knowledge-preview__image",src:r,alt:e.title||t("knowledge.preview.imageAlt"),loading:"lazy",onError:()=>i(!0)}):s==="audio"?o.jsx("audio",{className:"knowledge-preview__audio",src:r,controls:!0,preload:"metadata",onError:()=>i(!0),children:t("knowledge.preview.audioUnsupported")}):s==="video"?o.jsx("video",{className:"knowledge-preview__video",src:r,controls:!0,playsInline:!0,preload:"metadata",onError:()=>i(!0),children:t("knowledge.preview.videoUnsupported")}):s==="pdf"?o.jsxs("div",{className:"knowledge-preview__pdf",children:[o.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)}),o.jsx("a",{href:r,target:"_blank",rel:"noopener noreferrer",children:t("knowledge.preview.openPdf")})]}):o.jsxs("div",{className:"knowledge-preview__file-fallback",children:[o.jsx("p",{children:t("knowledge.preview.fileUnsupported")}),o.jsx("a",{href:r,target:"_blank",rel:"noopener noreferrer",children:t("knowledge.preview.openOriginalFile")})]})}function RPt({base:e,item:t,onClose:n}){const{t:i}=_e("ui"),[r,s]=p.useState([]),[a,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 N=new AbortController;w.current=N;const A=x.current+1;x.current=A,E>0?m(!0):f(!0),y(""),E===0&&(s([]),b(!1));try{const T=await sOt(e.id,t.id,{region:e.region,offset:E,signal:N.signal});if(x.current!==A)return;l(T.document.id?T.document:t),u(T.sourceMarkdown||T.document.sourceMarkdown),s(R=>E>0?[...R,...T.chunks]:T.chunks),b(T.hasMore)}catch(T){!P8(T)&&x.current===A&&y(il(T,i("knowledge.errors.loadPreview")))}finally{x.current===A&&(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=APt(a.url||t.url),k=jPt(a,i),C=a.metadata._veadk_content_format==="markdown";return o.jsx(oT,{title:a.name||t.name||t.id,onClose:n,className:"knowledge-dialog--preview",children:o.jsxs("div",{className:"knowledge-preview",children:[a.sizeBytes>0||S?o.jsxs("div",{className:"knowledge-preview__meta",children:[a.sizeBytes>0?o.jsx("span",{children:AV(a.sizeBytes)}):null,S?o.jsx("a",{href:S,target:"_blank",rel:"noopener noreferrer",children:i("knowledge.openOriginalWeb")}):null]}):null,o.jsx("div",{className:"knowledge-preview__body","aria-live":"polite",children:c?o.jsx("div",{className:"knowledge-preview__markdown-shell",children:o.jsx(Zu,{text:c,allowRawHtml:!1,className:"knowledge-preview__markdown"})}):d?o.jsx("div",{className:"knowledge-preview__state",role:"status",children:o.jsx(bn,{as:"span",duration:2.4,children:i("knowledge.preview.loading")})}):v&&r.length===0?o.jsxs("div",{className:"knowledge-preview__state is-error",role:"alert",children:[o.jsx("p",{children:v}),o.jsx("button",{type:"button",onClick:()=>void O(),children:i("common.retry")})]}):r.length===0?o.jsxs("div",{className:"knowledge-preview__state",children:[o.jsx("p",{children:k.title}),o.jsx("span",{children:S?i("knowledge.preview.openOriginalHint"):k.detail}),o.jsx("button",{type:"button",onClick:()=>void O(),children:i("common.reload")})]}):o.jsxs("div",{className:"knowledge-preview__chunks",children:[r.map((E,N)=>{const A=TPt(E.tableFields,i),j=E.id||`${N}:${E.title}`;return o.jsxs("article",{className:"knowledge-preview__chunk",children:[o.jsx("header",{children:o.jsx("h3",{children:E.title||i("knowledge.preview.chunk",{index:N+1})})}),E.content?C?o.jsx(Zu,{text:E.content,allowRawHtml:!1,className:"knowledge-preview__markdown"}):o.jsx("p",{className:"knowledge-preview__content",children:E.content}):null,A?o.jsx("div",{className:"knowledge-preview__table-wrap",children:o.jsxs("table",{children:[o.jsx("thead",{children:o.jsx("tr",{children:A.columns.map((T,R)=>o.jsx("th",{scope:"col",children:T},`${T}:${R}`))})}),o.jsx("tbody",{children:A.rows.map((T,R)=>o.jsx("tr",{children:T.map((_,D)=>o.jsx("td",{children:_},D))},R))})]})}):null,o.jsx(NPt,{chunk:E})]},j)}),v?o.jsx("div",{className:"knowledge-preview__more-error",role:"alert",children:v}):null,g?o.jsx("button",{type:"button",className:"knowledge-preview__load-more",disabled:h,onClick:()=>void O(r.length),children:h?o.jsx(bn,{as:"span",duration:2.4,children:i("knowledge.preview.loadingMore")}):i("knowledge.preview.loadMore")}):null]})})]})})}function IPt({cloudProvider:e,region:t,active:n=!0,activationRevision:i=0,onDetailChange:r,toolbarLeading:s,toolbarFilters:a}){const{t:l,i18n:c}=_e("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),[N,A]=p.useState(!1),[j,T]=p.useState(""),[R,_]=p.useState([]),[D,M]=p.useState(!1),[P,L]=p.useState(""),[F,I]=p.useState(""),[z,K]=p.useState(""),[B,W]=p.useState(!1),[H,X]=p.useState(!1),[ie,Q]=p.useState(!1),[Z,ue]=p.useState(null),[Ee,Y]=p.useState(null),[G,te]=p.useState(null),[de,Ce]=p.useState(null),[le,fe]=p.useState(null),[re,Oe]=p.useState(!1),Pe=p.useRef(0),be=p.useRef(0),Qe=p.useRef([]),ve=p.useRef(!1),Ne=p.useRef(!1),ne=p.useRef(null),ye=p.useRef(null),Te=p.useRef({}),Se=p.useRef(!1),Ke=p.useRef(null),it=p.useRef(null),he=p.useRef(null),xe=p.useRef(null),Ae=p.useMemo(()=>[t],[t]),qe=p.useCallback(He=>`${He.region}\0${He.id}`,[]),Me=u.find(He=>qe(He)===b)??null,At=!!(Me&&z===qe(Me));p.useEffect(()=>{r==null||r(!!Me)},[r,Me]),p.useEffect(()=>{x("overview"),k("")},[b]);const It=p.useMemo(()=>{const He=w.trim().toLocaleLowerCase();return He?u.filter(Le=>[Le.name,Le.description,Le.ownerLabel,Le.providerKnowledgeId].some(We=>We.toLocaleLowerCase().includes(He))):u},[u,w]),lt=p.useMemo(()=>{const He=S.trim().toLocaleLowerCase();return He?R.filter(Le=>[Le.name,Le.id,M8(Le)].some(We=>We.toLocaleLowerCase().includes(He))):R},[S,R]);p.useEffect(()=>{Y(null)},[Me==null?void 0:Me.id,Me==null?void 0:Me.region]);const Ot=p.useCallback(async(He=!1)=>{var gt;if(He&&(Se.current||Object.keys(Te.current).length===0))return;(gt=ne.current)==null||gt.abort();const Le=new AbortController;ne.current=Le;const We=Pe.current+1;Pe.current=We,Se.current=!0,He?A(!0):E(!0),T(""),He||g([]);try{const st=await eOt({regions:Ae,nextTokens:He?Te.current:void 0,signal:Le.signal});if(Pe.current!==We)return;d(ft=>He?[...ft,...st.items.filter(Ht=>!ft.some(cn=>qe(cn)===qe(Ht)))]:st.items),Te.current=st.nextTokens,h(st.nextTokens);const xt=st.failures.map(({region:ft,error:Ht})=>`${Mf(ft,e)}: ${il(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(P8(st))return;Pe.current===We&&(He?g(xt=>[...new Set([...xt,il(st,l("knowledge.errors.loadMoreBases"))])]):T(il(st,l("knowledge.errors.loadBases"))))}finally{Pe.current===We&&(Se.current=!1,E(!1),A(!1))}},[qe,e,Ae,l]),Ct=p.useCallback(async(He,Le=!1)=>{var st;if(Le&&ve.current)return;(st=ye.current)==null||st.abort();const We=new AbortController;ye.current=We;const gt=be.current+1;be.current=gt,Le||(Qe.current=[],Ne.current=!1,_([]),W(!1),I("")),ve.current=!0,M(!0),Le?I(""):L("");try{const xt=await rOt(He.id,{region:He.region,offset:Le?Qe.current.length:0,signal:We.signal});if(be.current!==gt)return;K(hn=>hn===qe(He)?"":hn);const ft=Qe.current,Ht=Le?[...ft,...xt.items.filter(hn=>!hn.id||!ft.some(Ge=>Ge.id===hn.id))]:xt.items,cn=xt.hasMore&&(!Le||Ht.length>ft.length);Qe.current=Ht,Ne.current=cn,_(Ht),W(cn)}catch(xt){if(P8(xt))return;be.current===gt&&(xt instanceof KP&&xt.errorCode===DIe&&(K(qe(He)),ue(Ht=>Ht&&qe(Ht)===qe(He)?null:Ht)),Le?I(il(xt,l("knowledge.errors.loadMoreData"))):L(il(xt,l("knowledge.errors.loadData"))))}finally{be.current===gt&&(ve.current=!1,M(!1))}},[qe,l]);p.useEffect(()=>{var He;(He=ne.current)==null||He.abort(),Pe.current+=1,Se.current=!1,Te.current={},d([]),h({}),g([]),v(""),K(""),T(""),E(!0)},[e]),p.useEffect(()=>{if(n)return Ot(),()=>{var He;(He=ne.current)==null||He.abort(),Pe.current+=1,Se.current=!1}},[n,i,Ot]),p.useEffect(()=>{var He,Le;if(!n){(He=ye.current)==null||He.abort(),be.current+=1,ve.current=!1;return}if(!Me){(Le=ye.current)==null||Le.abort(),be.current+=1,Qe.current=[],ve.current=!1,Ne.current=!1,_([]),W(!1),I("");return}return Ct(Me),()=>{var We;(We=ye.current)==null||We.abort(),be.current+=1,ve.current=!1}},[n,i,Me==null?void 0:Me.id,Me==null?void 0:Me.region]);const dt=n&&!Me&&!w.trim()&&!C&&!N&&!j&&Object.keys(f).length>0;p.useEffect(()=>{const He=it.current,Le=Ke.current;if(!He||!Le||!dt)return;const We=new IntersectionObserver(([gt])=>{gt.isIntersecting&&Ot(!0)},{root:Le,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=!!(Me&&R.length>0&&B&&!D&&!F);p.useEffect(()=>{const He=xe.current,Le=he.current;if(!Me||!He||!Le||!Ie)return;const We=new IntersectionObserver(([gt])=>{gt.isIntersecting&&Ct(Me,!0)},{root:he.current,rootMargin:"240px 0px",threshold:.01});return We.observe(He),()=>We.disconnect()},[Ie,Ct,Me==null?void 0:Me.id,Me==null?void 0:Me.region]);const vt=()=>{const He=he.current;if(!Me||!He||!Ne.current||ve.current||F)return;const{scrollHeight:Le,scrollTop:We,clientHeight:gt}=He;Le-We-gt<=240&&Ct(Me,!0)},jt=He=>{d(Le=>Le.map(We=>qe(We)===qe(He)?He:We))},Nt=async()=>{if(de){Oe(!0);try{await iOt(de.id,de.region),d(He=>He.filter(Le=>qe(Le)!==qe(de))),K(He=>He===qe(de)?"":He),b===qe(de)&&v(""),Ce(null)}catch(He){T(il(He,l("knowledge.errors.deleteBase"))),Ce(null)}finally{Oe(!1)}}},ln=async()=>{if(!(!Me||!le)){Oe(!0);try{await uOt(Me.id,le.id,Me.region);const He=Qe.current.filter(Le=>Le.id!==le.id);Qe.current=He,_(He),fe(null)}catch(He){L(il(He,l("knowledge.errors.deleteDocument"))),fe(null)}finally{Oe(!1)}}};return o.jsxs("section",{className:`knowledge-library${Me?" is-detail":" resource-collection"}`,"aria-label":l("knowledge.library"),children:[Me?o.jsx(GC,{className:"knowledge-library__detail",title:Me.name,description:Me.description||l("common.noDescription"),identitySeed:Me.name,backLabel:l("knowledge.backToList"),onBack:()=>v(""),sections:[{key:"overview",label:l("skillCenter.overview"),content:o.jsx("section",{className:"knowledge-overview",children:o.jsxs(Fz,{className:"knowledge-overview__summary",children:[o.jsxs("div",{children:[o.jsx("dt",{children:l("knowledge.provider")}),o.jsx("dd",{children:Me.providerType||"-"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:l("knowledge.knowledgeId")}),o.jsx("dd",{className:"knowledge-keyboard-reveal",tabIndex:0,title:Me.providerKnowledgeId,children:Me.providerKnowledgeId||"-"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:l("knowledge.project")}),o.jsx("dd",{children:Me.projectName||"default"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:l("knowledge.creator")}),o.jsx("dd",{children:c3(Me.ownerLabel)})]}),o.jsxs("div",{children:[o.jsx("dt",{children:l("skillCenter.updatedAt")}),o.jsx("dd",{children:pPt(Me.updatedAt,c.resolvedLanguage??c.language)||"-"})]})]})})},{key:"data",label:l("knowledge.data"),content:o.jsx("section",{className:"knowledge-documents",children:o.jsx("div",{className:`knowledge-documents__body${R.length>0?" is-table":""}`,"aria-live":"polite",children:D&&R.length===0?o.jsx(za,{}):P&&R.length===0?o.jsxs("div",{className:"knowledge-library__state is-error",role:"alert",children:[o.jsx("p",{children:P}),At&&Me.canManage?o.jsx("button",{type:"button",onClick:()=>Ce(Me),children:l("knowledge.deleteInvalidAssociation")}):o.jsx("button",{type:"button",onClick:()=>void Ct(Me),children:l("common.retry")})]}):R.length===0?o.jsxs("div",{className:"knowledge-library__state",children:[o.jsx(dPt,{}),o.jsx("p",{children:l("knowledge.noData")}),Me.canManage&&o.jsx("button",{type:"button",onClick:()=>ue(Me),children:l("knowledge.addFirstData")})]}):o.jsx(Bz,{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=>o.jsx("span",{title:He.name||He.id,children:He.name||He.id})},{key:"format",header:l("knowledge.format"),className:"is-compact-column",render:He=>M8(He)},{key:"size",header:l("knowledge.size"),className:"is-compact-column",render:He=>AV(He.sizeBytes)}],searchValue:S,onSearchChange:k,searchPlaceholder:l("knowledge.searchData"),searchLabel:l("knowledge.searchLibraryData"),primaryAction:Me.canManage?{label:l(At?"knowledge.associationInvalid":"knowledge.addData"),disabled:At,title:At?l("knowledge.providerMissing"):void 0,onClick:()=>ue(Me)}:void 0,rowActions:He=>[{label:l("common.preview"),onSelect:()=>Y(He)},...Me.canManage?[{label:l("common.edit"),onSelect:()=>te(He)},{label:l("common.delete"),onSelect:()=>fe(He),danger:!0}]:[]],scrollRef:he,onScroll:vt,busy:D,emptyLabel:l("knowledge.noMatchingData"),footer:D?o.jsxs("div",{className:"knowledge-document-pagination",role:"status","aria-live":"polite",children:[o.jsx("span",{className:"my-agent-loading-mark","aria-hidden":"true"}),o.jsx("span",{children:l("knowledge.loadingMoreData")})]}):F?o.jsxs("div",{className:"knowledge-document-pagination is-error",role:"alert",children:[o.jsx("span",{children:F}),o.jsx("button",{type:"button",onClick:()=>void Ct(Me,!0),children:l("knowledge.retryLoading")})]}):B?o.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:Me.canManage?o.jsxs(o.Fragment,{children:[o.jsx(Dt,{type:"button",color:"danger",variant:"soft",size:"lg",pill:!1,onClick:()=>Ce(Me),children:l("common.delete")}),o.jsx(Dt,{type:"button",color:"primary",size:"lg",pill:!1,onClick:()=>Q(!0),children:l("common.edit")})]}):void 0}):o.jsxs(o.Fragment,{children:[o.jsxs(e0,{className:"knowledge-library__toolbar library-resource-toolbar",children:[s,o.jsxs("div",{className:"resource-toolbar__actions",children:[a,o.jsx(pp,{value:w,onChange:He=>O(He.target.value),placeholder:l("knowledge.searchBases"),"aria-label":l("knowledge.searchBases")})]})]}),o.jsxs(Pg,{ref:Ke,"aria-live":"polite",onScroll:yt,children:[m.length>0&&!C&&o.jsxs("div",{className:"knowledge-region-warning",role:"status",children:[o.jsx("span",{children:l("knowledge.someBasesFailed")}),o.jsx("button",{type:"button",onClick:()=>void Ot(),children:l("common.retry")})]}),C&&u.length===0?o.jsx(za,{}):j?o.jsxs("div",{className:"knowledge-library__state is-error",role:"alert",children:[o.jsx("p",{children:j}),o.jsx("button",{type:"button",onClick:()=>void Ot(),children:l("common.retry")})]}):It.length===0&&w.trim()?o.jsxs("div",{className:"knowledge-library__state",children:[o.jsx(uPt,{}),o.jsx("p",{children:l("knowledge.noMatchingBases")})]}):o.jsxs(n0,{children:[w.trim()?null:o.jsx(hg,{"aria-label":l("knowledge.createBase"),icon:o.jsx(hPt,{}),onClick:()=>X(!0),children:l("knowledge.createBase")}),It.map(He=>o.jsx(r0,{className:"knowledge-card",title:He.name,description:He.description||l("common.noDescription"),metadata:[{label:l("knowledge.creator"),value:c3(He.ownerLabel),title:c3(He.ownerLabel)},{label:l("knowledge.project"),value:He.projectName||"default",title:He.projectName||"default"}],action:{label:z===qe(He)?l("knowledge.associationInvalid"):l("knowledge.addData"),icon:"plus",disabled:!He.canManage||z===qe(He),title:He.canManage?z===qe(He)?l("knowledge.providerMissing"):void 0:l("knowledge.noManagePermission"),onClick:()=>ue(He)},detailAction:{label:l("common.viewDetails"),onClick:()=>v(qe(He))}},qe(He)))]}),dt||N?o.jsx("div",{ref:it,className:"my-agent-load-more",role:"status","aria-live":"polite",children:N?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"my-agent-loading-mark","aria-hidden":"true"}),o.jsx("span",{children:l("knowledge.loadingMoreBases")})]}):dt?o.jsx("span",{children:l("skillCenter.scrollForMore")}):null}):null]})]}),H&&o.jsx(vPt,{region:t,onClose:()=>X(!1),onCreated:He=>{d(Le=>[He,...Le]),v(qe(He)),X(!1)}}),Me&&ie&&o.jsx(xPt,{item:Me,onClose:()=>Q(!1),onUpdated:He=>{jt(He),Q(!1)}}),Me&&Ee&&o.jsx(RPt,{base:Me,item:Ee,onClose:()=>Y(null)}),Z&&o.jsx(wPt,{base:Z,onClose:()=>ue(null),onAssociationInvalid:He=>{K(qe(Z)),Me&&qe(Me)===qe(Z)&&L(il(He,l("knowledge.associationInvalid"))),ue(null)},onCreated:()=>{Me&&qe(Me)===qe(Z)&&Ct(Me),ue(null)}}),Me&&G&&o.jsx(OPt,{base:Me,item:G,onClose:()=>te(null),onUpdated:He=>{const Le=Qe.current.map(We=>We.id===He.id?He:We);Qe.current=Le,_(Le),te(null)}}),de&&o.jsx(Xu,{title:l("knowledge.deleteBaseTitle"),description:l("knowledge.deleteBaseDescription",{name:de.name}),confirmLabel:l(re?"common.deleting":"common.delete"),variant:"danger",busy:re,onCancel:()=>Ce(null),onConfirm:()=>void Nt()}),le&&o.jsx(Xu,{title:l("knowledge.deleteDocumentTitle"),description:l("knowledge.deleteDocumentDescription",{name:le.name||le.id}),confirmLabel:l(re?"common.deleting":"common.delete"),variant:"danger",busy:re,onCancel:()=>fe(null),onConfirm:()=>void ln()})]})}const PPt="_EmptyMessage_1r5gu_1",DPt="_IconBadge_1r5gu_16",MPt="_Title_1r5gu_54",LPt="_Description_1r5gu_69",$Pt="_ActionRow_1r5gu_77",aT={EmptyMessage:PPt,IconBadge:DPt,Title:MPt,Description:LPt,ActionRow:$Pt},Pn=({children:e,className:t,fill:n="static"})=>o.jsx("div",{className:Ti(aT.EmptyMessage,t),"data-fill":n,children:e}),FPt=({size:e="md",color:t="secondary",children:n,className:i})=>o.jsx("div",{className:Ti(aT.IconBadge,i),"data-size":e,"data-color":t,children:n}),BPt=({children:e,className:t,color:n="secondary"})=>o.jsx("div",{className:Ti(aT.Title,t),"data-color":n,children:e}),UPt=({children:e,className:t})=>o.jsx("div",{className:Ti(aT.Description,t),children:e}),QPt=({children:e,className:t})=>o.jsx("div",{className:Ti(aT.ActionRow,t),children:e});Pn.Icon=FPt;Pn.Title=BPt;Pn.Description=UPt;Pn.ActionRow=QPt;const zPt={name:"studio_share_space"},VPt={name:"studio_review_space"},IMe={share:zPt,review:VPt},HPt=IMe.share.name,PMe=IMe.review.name,qPt=[HPt,PMe];function DMe(e){return qPt.includes(e.trim().toLowerCase())}function WPt(e){return e.name===PMe}const KPt="/web/skill-management";class _V extends Error{constructor(t,n,i="SKILL_MANAGEMENT_ERROR",r="",s,a=""){super(t),this.status=n,this.code=i,this.statusText=r,this.originalError=s,this.rawResponse=a,this.name="SkillManagementApiError"}}async function Ll(e,t={},n=Va){return fetch(ta(`${KPt}${e}`),{...t,headers:Ml(hu(t.headers)),signal:Ha(t.signal,n)})}async function lD(e,t){let n=t,i="SKILL_MANAGEMENT_ERROR",r;const s=await e.text().catch(()=>"");try{const a=JSON.parse(s);typeof a.detail=="string"?n=a.detail:a.detail&&(n=a.detail.message||t,i=a.detail.code||i,r=a.detail.originalError)}catch{s.trim()&&(n=V("common.fallbackWithDetail",{fallback:t,detail:s.trim()}))}return new _V(n,e.status,i,e.statusText,r,s)}async function $l(e,t){if(!e.ok)throw await lD(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),$l(await Ll(`/spaces?${t}`,{signal:e.signal}),V("skills.listSpacesFailed"))}async function XPt(e){if(DMe(e.name))throw new _V(V("skills.reservedSpaceName"),409,"SKILL_SPACE_RESERVED_IDENTITY");return $l(await Ll("/spaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),V("skills.createSpaceFailed"))}async function YPt(e){const t=new URLSearchParams({region:e.region});return $l(await Ll(`/shared-space/ensure?${t}`,{method:"POST",signal:e.signal}),V("skills.sharedSpaceFailed"))}async function ZPt(e){return $l(await Ll(`/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})},mr),V("skills.submitReviewFailed"))}async function JPt(e){const t=new URLSearchParams({region:e.region});return $l(await Ll(`/reviews?${t}`,{signal:e.signal}),V("skills.listReviewsFailed"))}async function eDt(e){const t=new URLSearchParams({region:e.region});return $l(await Ll(`/reviews/${encodeURIComponent(e.id)}/files?${t}`,{signal:e.signal},mr),V("skills.reviewFilesFailed"))}async function tDt(e){return $l(await Ll(`/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||""})},mr),V("skills.decideReviewFailed"))}async function nDt(e){const t=new URLSearchParams({region:e.region});return $l(await Ll(`/spaces/${encodeURIComponent(e.spaceId)}/reviews?${t}`,{signal:e.signal}),V("skills.listReviewsFailed"))}async function iDt(e){if(DMe(e.name))throw new _V(V("skills.reservedSpaceName"),409,"SKILL_SPACE_RESERVED_IDENTITY");return $l(await Ll(`/spaces/${encodeURIComponent(e.spaceId)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e.name,description:e.description,region:e.region})}),V("skills.updateSpaceFailed"))}async function rDt(e){const t=new URLSearchParams({region:e.region});await $l(await Ll(`/spaces/${encodeURIComponent(e.spaceId)}?${t}`,{method:"DELETE"}),V("skills.deleteSpaceFailed"))}async function sDt(e){const t=new URLSearchParams({region:e.region});return e.project&&t.set("project",e.project),$l(await Ll(`/spaces/${encodeURIComponent(e.spaceId)}/skills?${t}`,{method:"POST",headers:{"Content-Type":"application/zip"},body:e.file},mr),V("skills.uploadFailed"))}async function oDt(e){return $l(await Ll("/validate",{method:"POST",headers:{"Content-Type":"application/zip"},body:e},mr),V("skills.validateFailed"))}async function aDt(e){const t=new URLSearchParams({region:e.region});await $l(await Ll(`/spaces/${encodeURIComponent(e.spaceId)}/skills/${encodeURIComponent(e.skillId)}?${t}`,{method:"DELETE"}),V("skills.deleteFailed"))}async function MMe(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 $l(await Ll(`/spaces/${encodeURIComponent(e.spaceId)}/skills/${encodeURIComponent(e.skillId)}/files?${t}`),V("skills.listFilesFailed"));return Array.isArray(n.files)?n.files:[]}async function lDt(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 Ll(`/spaces/${encodeURIComponent(e.spaceId)}/skills/${encodeURIComponent(e.skillId)}/archive?${t}`,{},mr);n.ok||await $l(n,V("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()),a=document.createElement("a");a.href=s,a.download=r,a.click(),URL.revokeObjectURL(s)}function oc(e){var t;return((t=e==null?void 0:e.displayName)==null?void 0:t.trim())||(e==null?void 0:e.name)||""}async function cD(e){const t=await fetch(ta(e),{headers:Ml(hu({accept:"application/json"})),signal:Ha(void 0,Va)});if(!t.ok)throw await lD(t,Kt("helpers.skills.agentKitRequestFailed"));return t.json()}async function LMe(){return((await cD("/web/skill-spaces")).items||[]).filter(t=>!WPt(t))}async function $Me(e,t){const n=t?`?region=${encodeURIComponent(t)}`:"";return(await cD(`/web/skill-spaces/${encodeURIComponent(e)}/skills${n}`)).items||[]}async function cDt(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),cD(`/web/skill-spaces/${encodeURIComponent(e)}/skills?${n.toString()}`)}async function uDt(e,t,n,i,r,s,a){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)}`),a&&l.push(`skill_space_name=${encodeURIComponent(a)}`);const c=l.length>0?`?${l.join("&")}`:"";return cD(`/web/skill-spaces/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}${c}`)}function dDt(e,t){const n=Fb(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 Fb(e){return e.skillId||e.skillName}function fDt(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",Rhe,!0,!0);mn.hasResourceBundle("zh-CN","skills")||mn.addResourceBundle("zh-CN","skills",Pve,!0,!0);function Jt(e,t={}){return mn.t(e,{...t,ns:"skills"})}const hDt="/web/skill-workbench";class L8 extends Error{constructor(t,n,i="SKILL_WORKBENCH_ERROR",r=!1,s="",a,l=""){super(t),this.status=n,this.code=i,this.retryable=r,this.statusText=s,this.originalError=a,this.rawResponse=l,this.name="SkillWorkbenchApiError"}}function qu(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(Jt("api.invalidFormat",{label:t}));return e}function sne(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 pDt(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 Ff(e,t={},n=Va){return fetch(ta(`${hDt}${e}`),{...t,headers:hu(t.headers),signal:Ha(t.signal,n)})}async function jV(e,t){var i;const n=await e.text().catch(()=>"");try{const r=qu(JSON.parse(n),Jt("api.errorResponse")),s=r.detail&&typeof r.detail=="object"?qu(r.detail,Jt("api.errorDetails")):r;return new L8(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 L8(Jt("api.gatewayError",{fallback:t,status:e.status,contentType:r}),e.status,"SKILL_WORKBENCH_ERROR",!1,e.statusText,void 0,n)}}async function mg(e,t){if(!e.ok)throw await jV(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 mDt(e){return Array.isArray(e)?e.map(t=>{const n=qu(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 gDt(e){if(e==null)return;const t=qu(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"||!zI(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 SE(e){const t=qu(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=qu(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=sne(t.toolId,"Tool ID"),s=sne(t.sessionId,"Session ID"),a=pDt(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}:{},...a?{recoveryStatus:a}:{},...typeof t.recoveredFromSnapshot=="boolean"?{recoveredFromSnapshot:t.recoveredFromSnapshot}:{},state:t.state,stage:typeof t.stage=="string"?t.stage:"generating",activities:mDt(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:gDt(t.publication)}:{}}}async function uD(e){const t=qu(await mg(await Ff("/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 bDt(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 Ff(`/tasks/from-upload?${n}`,{method:"POST",body:e.file,headers:{"Content-Type":"application/zip"},signal:e.signal},mr);return SE(await mg(i,Jt("api.startOptimization")))}const t=await Ff("/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},mr);return SE(await mg(t,Jt("api.startTask")))}async function yDt(e,t){return SE(await mg(await Ff(`/tasks/${encodeURIComponent(e)}`,{signal:t}),Jt("api.loadTask")))}async function u3(e,t,n){const i=new URLSearchParams;i.set("expected_revision",String(t));const r=qu(await mg(await Ff(`/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(a=>{const l=qu(a,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 d3(e){const t=await Ff(`/tasks/${encodeURIComponent(e.jobId)}/refinements`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({intent:e.intent,expectedRevision:e.expectedRevision})},mr);return SE(await mg(t,Jt("api.refine")))}async function vDt(e){const t=await Ff(`/tasks/${encodeURIComponent(e.jobId)}/stop`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({expectedRevision:e.expectedRevision})});return SE(await mg(t,Jt("api.stop")))}async function xDt(e){const t=await Ff(`/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 jV(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 a=new TextDecoder,l=t.body.getReader(),c=u=>{var h;if(!u.trim())return;const d=qu(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=qu(d.error,Jt("api.publishError"));throw new L8(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=qu(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"||!zI(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+=a.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 wDt(e){await mg(await Ff(`/tasks/${encodeURIComponent(e)}`,{method:"DELETE"}),Jt("api.deleteTask"))}async function ODt(e,t,n){var c;const i=new URLSearchParams;i.set("expected_revision",String(t)),i.set("expected_sha256",n);const r=await Ff(`/tasks/${encodeURIComponent(e)}/download?${i.toString()}`,{},mr);if(!r.ok)throw await jV(r,Jt("api.download"));const a=((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=a,u.click()}finally{URL.revokeObjectURL(l)}}const FMe=p.createContext(void 0);function c0(e){const t=p.useContext(FMe);if(t===void 0&&!e)throw new Error(mc(47));return t}const kDt={...B2e,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 SDt extends eP{constructor(n,i,r){const s=new uQ;super(EDt(n,s,i,r),CDt(s),kDt);tn(this,"setOpen",(n,i)=>{var f,h;const r=i.reason===zc,s=i.reason===Zx&&i.event.detail===0,a=!n&&(i.reason===JTe||i.reason==null),l=Ont(i),c=this.select("activeTriggerId");if(!n&&i.reason===ZTe&&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};N2e(m,n,i.trigger,l()),this.update(m)};r?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(Xet,()=>{this.set("stickIfOpen",!1)}),Jn.flushSync(u)):u();let d;s?d="click":a?d="dismiss":i.reason===WS&&(d="focus"),this.set("instantType",d)})}}function EDt(e,t,n,i=!1){const r={...L2e(),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=$2e(t,n,i),r}function CDt(e){return{popupRef:p.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:p.createRef(),beforeContentFocusGuardRef:p.createRef(),stickIfOpenTimeout:new du,triggerElements:e}}function one({props:e}){const{children:t,open:n,defaultOpen:i=!1,onOpenChange:r,onOpenChangeComplete:s,modal:a=!1,handle:l,triggerId:c,defaultTriggerId:u=null}=e,d=ADt(l,{modal:a,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),M2e(d,f),I2e(d);const{forceUnmount:g}=P2e(f,d,()=>{d.update({stickIfOpen:!0,openChangeReason:null})});d.useSyncedValues({modal:a}),p.useEffect(()=>{f||d.context.stickIfOpenTimeout.clear()},[d,f]),p.useImperativeHandle(e.actionsRef,()=>({unmount:g,close:()=>d.setOpen(!1,Ys(e2e))}),[g,d]);const b=f||h;return o.jsxs(FMe.Provider,{value:d,children:[l&&o.jsx(j2e,{handle:l,store:d}),b&&o.jsx(_Dt,{store:d,modal:a}),typeof t=="function"?t({payload:m}):t]})}function TDt(e){return c0(!0)?o.jsx(one,{props:e}):o.jsx(_tt,{children:o.jsx(one,{props:e})})}function ADt(e,t){const n=_2e((i,r)=>new SDt(t,i,r));return p.useEffect(()=>n.context.stickIfOpenTimeout.disposeEffect(),[n]),n}function _Dt({store:e,modal:t}){const n=e.useState("floatingRootContext"),i=f2e(n,{outsidePressEvent:{mouse:t==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),r=i.reference,s=i.floating;return D2e(e,{activeTriggerProps:r,inactiveTriggerProps:r,popupProps:s}),null}const jDt=300;function mp(e){return AC(e,"base-ui")}function NDt(e,t){const n=p.useRef(null);function i(s){Jn.flushSync(()=>{e.setOpen(!1,Ys(WS,s.nativeEvent,s.currentTarget))});const a=Cet(n.current);a==null||a.focus()}function r(s){var l;const a=e.select("positionerElement");if(a&&rx(s,a))(l=e.context.beforeContentFocusGuardRef.current)==null||l.focus();else{Jn.flushSync(()=>{e.setOpen(!1,Ys(WS,s.nativeEvent,s.currentTarget))});let c=Eet(e.context.triggerFocusTargetRef.current||t.current);for(;c!==null&&zn(a,c);){const u=c;if(c=eQ(c),c===u)break}c==null||c.focus()}}return{preFocusGuardRef:n,handlePreFocusGuardFocus:i,handleFocusTargetFocus:r}}function RDt(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 BMe(e,t){const n=Wn((s,a)=>{(typeof e=="function"?e():e)||t(a||(sP?"touch":""))}),{onClick:i,onPointerDown:r}=RDt(n);return p.useMemo(()=>({onClick:i,onPointerDown:r}),[i,r])}const IDt=p.forwardRef(function(t,n){const{render:i,className:r,style:s,disabled:a=!1,nativeButton:l=!0,handle:c,payload:u,openOnHover:d=!1,delay:f=jDt,closeDelay:h=0,id:m,...g}=t,b=c0(!0),y=U2e(c)??b;if(!y)throw new Error(mc(74));const x=mp(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:N}=R2e(x,C,y,{payload:u,disabled:a,openOnHover:d,closeDelay:h}),A=y.useState("openChangeReason"),j=y.useState("stickIfOpen"),T=y.useState("openMethod"),R=y.useState("focusManagerModal"),_=_nt(O,{enabled:!a&&d&&(T!=="touch"||A!==Zx),mouseOnly:!0,move:!1,handleClose:Rnt(),restMs:f,delay:{close:h},triggerElementRef:C,isActiveTrigger:w,isClosing:()=>y.select("transitionStatus")==="ending"}),D=d2e(O,{stickIfOpen:j}),M=BMe(()=>y.select("open"),ie=>{y.set("openMethod",ie)}),P=y.useState("triggerProps",N),{getButtonProps:L,buttonRef:F}=cP({disabled:a,native:l}),I={open(ie){return ie&&A===Zx?qnt.open(ie):H2e.open(ie)}},{preFocusGuardRef:z,handlePreFocusGuardFocus:K,handleFocusTargetFocus:B}=NDt(y,C),H=wo("button",t,{state:{disabled:a,open:S},ref:[F,n,E,C],props:[D.reference,_,P,M,{[oQ]:"",id:x,"aria-haspopup":"dialog","aria-expanded":S,"aria-controls":k},g,L],stateAttributesMapping:I}),X=o.jsx(p.Fragment,{children:H},x);return N&&!R?o.jsxs(p.Fragment,{children:[o.jsx(yy,{ref:z,onFocus:K}),X,o.jsx(yy,{ref:y.context.triggerFocusTargetRef,onFocus:B})]}):X}),UMe=p.createContext(void 0);function PDt(){const e=p.useContext(UMe);if(e===void 0)throw new Error(mc(45));return e}const DDt=p.forwardRef(function(t,n){const{keepMounted:i=!1,...r}=t;return c0().useState("mounted")||i?o.jsx(UMe.Provider,{value:i,children:o.jsx(r2e,{ref:n,...r})}):null}),QMe=p.createContext(void 0);function MDt(){const e=p.useContext(QMe);if(!e)throw new Error(mc(46));return e}const zMe=p.forwardRef(function(t,n){const{cutout:i,...r}=t;let s;if(i){const a=i.getBoundingClientRect();s=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${a.left}px ${a.top}px,${a.left}px ${a.bottom}px,${a.right}px ${a.bottom}px,${a.right}px ${a.top}px,${a.left}px ${a.top}px)`}return o.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...r,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:s}})});let ane={},lne={},cne="";function dD(e,t){return EC(e)?e:t}function une(e,t,n){return/hidden|clip/.test(e.getComputedStyle(dD(t,n)).overflowY)}function LDt(e){if(typeof document>"u")return!1;const t=lr(e);return Bs(t).innerWidth-t.documentElement.clientWidth>0}function $Dt(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=dD(i,r),a=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=a,i.style.scrollbarGutter=l,c===u}function FDt(e){const t=lr(e),n=t.documentElement,i=t.body,r=dD(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 BDt(e){var m;const t=lr(e),n=t.documentElement,i=t.body,r=Bs(n);let s=0,a=0,l=!1;const c=Jl.create();if(zw&&(((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,a=n.scrollLeft,ane={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},cne=n.style.scrollBehavior,lne={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),N=parseFloat(b.marginTop)+parseFloat(b.marginBottom),A=parseFloat(b.marginLeft)+parseFloat(b.marginRight),j=dD(n,i);if(l=$Dt(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:N||E?`calc(100dvh - ${N+E}px)`:"100dvh",width:A||C?`calc(100vw - ${A+C}px)`:"100vw",boxSizing:"border-box",overflowY:"hidden",overflowX:"hidden",scrollBehavior:"unset"}),i.scrollTop=s,i.scrollLeft=a,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function d(){Object.assign(n.style,ane),Object.assign(i.style,lne),l||(n.scrollTop=s,n.scrollLeft=a,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=cne)}function f(){d(),c.request(u)}u();const h=mi(r,"resize",f);return()=>{c.cancel(),d(),typeof r.removeEventListener=="function"&&h()}}class UDt{constructor(){tn(this,"lockCount",0);tn(this,"restore",null);tn(this,"timeoutLock",du.create());tn(this,"timeoutUnlock",du.create());tn(this,"release",()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)});tn(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=Bs(i);if(une(s,i,r)){const l=new s.MutationObserver(()=>{une(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 a=sP||!LDt(t);this.restore=a?FDt(t):BDt(t)}}const QDt=new UDt;function VMe(e=!0,t=null){Un(()=>{if(e)return QDt.acquire(t)},[e,t])}const zDt=20;function VDt(e,t,n,i){const[r,s]=p.useState(!1);Un(()=>{if(!e||!t||n==null){s(!1);return}const a=lr(n).documentElement.clientWidth,l=n.offsetWidth;s(a>0&&l>0&&l>=a-zDt)},[e,t,n]),VMe(e&&(!t||r),i)}const HDt=p.forwardRef(function(t,n){const{render:i,className:r,style:s,anchor:a,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=ntt,...x}=t,w=c0(),O=PDt(),S=Ttt(),k=w.useState("floatingRootContext"),C=w.useState("mounted"),E=w.useState("open"),N=w.useState("openChangeReason"),A=w.useState("activeTriggerElement"),j=w.useState("modal"),T=w.useState("openMethod"),R=w.useState("positionerElement"),_=w.useState("instantType"),D=w.useState("transitionStatus"),M=w.useState("adaptiveOrigin"),P=p.useRef(null),L=sQ(R),F=Fnt({anchor:a,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:M}),I=k.useState("domReferenceElement");Un(()=>{const H=I,X=P.current;if(H&&(P.current=H),X&&H&&H!==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 z=j===!0&&N!==zc;VDt(E&&z,T==="touch",R,A);const K=w.useStateSetter("positionerElement"),B={open:E,side:F.side,align:F.align,anchorHidden:F.anchorHidden,instant:_},W=Wnt(t,B,{styles:F.positionerStyles,transitionStatus:D,props:x,refs:[n,K],hidden:!C,inert:!E});return o.jsxs(QMe.Provider,{value:F,children:[C&&z&&o.jsx(zMe,{inert:rQ(!E),cutout:A}),o.jsx(Att,{id:S,children:W})]})}),qDt="ArrowUp",WDt="ArrowDown",KDt="ArrowLeft",GDt="ArrowRight",XDt="Home",YDt="End",HMe=new Set([qDt,WDt,KDt,GDt,XDt,YDt]),ZDt=p.createContext(void 0);function JDt(e){return p.useContext(ZDt)}const eMt=p.createContext(void 0);function tMt(){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 nMt=p.forwardRef(function(t,n){const{render:i,className:r,style:s,initialFocus:a,finalFocus:l,...c}=t,u=c0(),d=MDt(),f=JDt()!=null,{context:h,hasClosePart:m}=tMt(),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"),N=u.useState("floatingRootContext"),A=N.useState("floatingId"),j=u.useState("disabled"),T=u.useState("openOnHover"),R=u.useState("closeDelay");TC({open:g,ref:u.context.popupRef,onComplete(){var F,I;g&&((I=(F=u.context).onOpenChangeComplete)==null||I.call(F,!0))}}),Tnt(N,{enabled:T&&!j,closeDelay:R});const _=a===void 0?A2e(u.context.popupRef):a,D=S!==!1&&m;u.useSyncedValue("focusManagerModal",D);const M=u.useStateSetter("popupElement"),P={open:g,side:d.side,align:d.align,instant:v,transitionStatus:y},L=wo("div",t,{state:P,ref:[n,u.context.popupRef,M],props:[x,{id:A,role:"dialog",...T2e,"aria-labelledby":w,"aria-describedby":O,onKeyDown(F){f&&HMe.has(F.key)&&F.stopPropagation()}},W2e(y),c],stateAttributesMapping:q2e});return o.jsx(u2e,{context:N,openInteractionType:b,modal:D,disabled:!k||C===zc,initialFocus:_,returnFocus:l,restoreFocus:"popup",previousFocusableElement:$s(E)?E:void 0,nextFocusableElement:u.context.triggerFocusTargetRef,beforeContentFocusGuardRef:u.context.beforeContentFocusGuardRef,children:o.jsx(eMt.Provider,{value:h,children:L})})}),iMt=p.forwardRef(function(t,n){const{render:i,className:r,style:s,...a}=t,l=c0(),c=mp(a.id);return l.useSyncedValueWithCleanup("titleElementId",c),wo("h2",t,{ref:n,props:[{id:c},a]})}),rMt=p.forwardRef(function(t,n){const{render:i,className:r,style:s,...a}=t,l=c0(),c=mp(a.id);return l.useSyncedValueWithCleanup("descriptionElementId",c),wo("p",t,{ref:n,props:[{id:c},a]})});function dne(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("circle",{cx:"10.25",cy:"10.25",r:"6.25"}),o.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 sMt(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.25",y:"5.25",width:"15.5",height:"13.5",rx:"2.25"}),o.jsx("circle",{cx:"8.1",cy:"9.3",r:"1.35"}),o.jsx("path",{d:"m4.7 16.5 3.65-3.7 2.45 2.25 2.2-2.2 4.35 4.1"}),o.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 NV(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.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"}),o.jsxs("g",{className:"video-generate-icon__clapper",children:[o.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"}),o.jsx("path",{d:"M6.75 5.25 9.3 9M12 5.25 14.55 9M17.25 5.25 19.8 9"})]}),o.jsx("path",{d:"m10.25 11.45 4 2.55-4 2.55v-5.1Z"})]})}function oMt(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M4.25 5.25h15.5v10.5H4.25zM8.25 19.75h7.5M12 15.75v4"}),o.jsx("path",{d:"m7.25 12.75 2.35-2.4 2.15 1.65 3.4-3.6 1.6 1.55"}),o.jsx("circle",{cx:"7.25",cy:"8.4",r:".7",fill:"currentColor",stroke:"none"})]})}function aMt(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.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"}),o.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"}),o.jsx("path",{d:"M8.2 12.25h.01M8.2 16.8h.01"})]})}function lMt(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M4.25 4.25h4.5v15.5h-4.5zM8.75 5.75h5v14h-5zM13.75 4.25h4.1v10.25h-4.1z"}),o.jsx("path",{d:"M5.75 7h1.5M10.25 8.25h2M10.25 11h2M15.15 7h1.3"}),o.jsx("circle",{cx:"17.45",cy:"17.35",r:"2.45"}),o.jsx("path",{d:"m19.25 19.15 1.55 1.55"})]})}function cMt(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.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"}),o.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"}),o.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 uMt(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"m4.2 8.4 1.15 10.2h13.3L19.8 8.4"}),o.jsx("path",{d:"M4.2 8.4h15.6L17.9 5H6.1L4.2 8.4Z"}),o.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"}),o.jsx("path",{d:"m8.2 15.1 1.45 1.35 1.45-1.35M13.55 16.45h2.35"})]})}function dMt(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("circle",{cx:"6",cy:"6.25",r:"2.25"}),o.jsx("circle",{cx:"18",cy:"6.25",r:"2.25"}),o.jsx("circle",{cx:"12",cy:"17.75",r:"2.25"}),o.jsx("path",{d:"m7.7 7.75 2.7 7.55M16.3 7.75l-2.7 7.55M8.25 6.25h7.5"})]})}function fne(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("circle",{cx:"9",cy:"8",r:"3"}),o.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"}),o.jsx("path",{d:"M17.75 4.25v5.5M15 7h5.5M16 13.25h4.25M18.125 11.125v4.25"})]})}function fMt(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"4",y:"4.25",width:"16",height:"5",rx:"1.5"}),o.jsx("rect",{x:"4",y:"14.75",width:"16",height:"5",rx:"1.5"}),o.jsx("path",{d:"M7.25 6.75h.01M7.25 17.25h.01M10 6.75h6.5M10 17.25h6.5"})]})}function hMt(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M6 3.75h8l4 4v12.5H6V3.75Z"}),o.jsx("path",{d:"M14 3.75v4h4M8.75 11h6.5M8.75 14.25h6.5M8.75 17.5h4"})]})}function hne(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.75",y:"4.5",width:"16.5",height:"15",rx:"2.5"}),o.jsx("path",{d:"m7.5 9 2.75 2.5L7.5 14M12.5 14h4"}),o.jsx("path",{d:"M3.75 7.5h16.5",opacity:".62"})]})}function a1(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m6 3.25 4.5 4.75L6 12.75"})})}function pMt({value:e}){const{t,i18n:n}=_e("adk"),[i,r]=p.useState(!1),s=f=>f==null?t("developmentRuns.notReported"):f.toLocaleString(n.resolvedLanguage||n.language),a=pTe,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 o.jsxs("div",{className:"development-turn-summary","data-turn-id":e.turnId,children:[o.jsx("span",{children:t(`developmentRuns.turnStatus.${e.status}`)}),o.jsx("span",{children:t("developmentRuns.toolCalls",{count:e.toolCalls})}),o.jsx("span",{children:t("developmentRuns.turnDuration",{duration:a(e.durationMs)})}),o.jsx("span",{title:t("developmentRuns.toolDurationHelp"),children:t(e.toolDurationComplete?"developmentRuns.toolDuration":"developmentRuns.toolDurationPartial",{duration:a(e.toolDurationMs)})}),o.jsxs(TDt,{open:i,onOpenChange:r,children:[o.jsxs(IDt,{className:"development-token-trigger",openOnHover:!0,delay:150,closeDelay:150,onFocus:f=>{f.currentTarget.matches(":focus-visible")&&r(!0)},children:[o.jsx("span",{children:"Tokens"}),o.jsx("span",{className:"development-token-value",children:s(l==null?void 0:l.totalTokens)}),e.usageIncomplete&&o.jsxs("span",{children:["· ",t("developmentRuns.partial")]}),o.jsx(a1,{className:"development-token-chevron"})]}),o.jsx(DDt,{children:o.jsx(HDt,{side:"top",align:"end",sideOffset:8,className:"development-token-positioner",children:o.jsxs(nMt,{className:"development-token-popup",initialFocus:!1,finalFocus:!1,children:[o.jsx(iMt,{className:"development-token-title",children:t("developmentRuns.tokenDetails")}),o.jsxs("dl",{children:[o.jsxs("div",{children:[o.jsx("dt",{children:t("developmentRuns.model")}),o.jsx("dd",{children:e.model||t("developmentRuns.notReported")})]}),o.jsxs("div",{children:[o.jsx("dt",{children:t("developmentRuns.totalTokens")}),o.jsx("dd",{children:s(l==null?void 0:l.totalTokens)})]}),d.map(([f,h])=>o.jsxs("div",{children:[o.jsx("dt",{children:t(`developmentRuns.${f}`)}),o.jsx("dd",{children:s(h)})]},f)),o.jsxs("div",{children:[o.jsx("dt",{children:t("developmentRuns.cacheHitRate")}),o.jsx("dd",{children:u||t("developmentRuns.notReported")})]})]}),o.jsxs(rMt,{className:"development-token-note",children:[t("developmentRuns.tokenHelp"),e.usageIncomplete?` ${t("developmentRuns.partialHelp")}`:""]})]})})})]})]})}function RV(e){return o.jsx("svg",{viewBox:"0 0 111 117",fill:"none","aria-hidden":"true",...e,children:o.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 fD({kind:e,...t}){return e==="thinking"?o.jsx(RV,{...t}):o.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"?o.jsxs(o.Fragment,{children:[o.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"3"}),o.jsx("path",{d:"m7 9 3 3-3 3m6 0h4"})]}):e==="plan"?o.jsxs(o.Fragment,{children:[o.jsx("path",{d:"m4 7 1.5 1.5L8 6m-4 7 1.5 1.5L8 12M11 7h9m-9 6h9m-9 6h9"}),o.jsx("circle",{cx:"6",cy:"19",r:"1"})]}):o.jsx(o.Fragment,{children:o.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 mMt({blocks:e,active:t,status:n,render:i}){const{t:r}=_e("adk"),[s,a]=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"?mTe(l):(l==null?void 0:l.kind)==="plan"?r("developmentRuns.plan"):(l==null?void 0:l.kind)==="diff"?r("developmentRuns.diff"):r("developmentRuns.processing"))),o.jsxs("section",{className:"development-process",children:[o.jsxs("button",{type:"button",className:"development-process__toggle","aria-expanded":s,onClick:()=>a(!s),children:[o.jsx(a1,{className:`tool-chevron${s?" is-open":""}`}),o.jsx("span",{className:"tool-icon",children:o.jsx(fD,{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?o.jsx(bn,{className:"development-process__title","aria-live":"polite",children:f}):o.jsx("span",{className:"development-process__title",children:f}),!t&&c.length>0&&o.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:pTe(d)})}`:""]})]}),o.jsx("div",{className:"development-process__items",hidden:!s,children:i(e)})]})}function gMt({blocks:e,active:t,status:n="",render:i}){const{t:r}=_e("adk"),s=bJe(e),a=s[s.length-1],l=[...e].reverse().find(u=>u.kind==="progress"),c=n||((l==null?void 0:l.kind)==="progress"?l.text:"");return o.jsxs(o.Fragment,{children:[s.map(u=>u.process?o.jsx(mMt,{blocks:u.blocks,active:t&&u===a,status:c,render:i},u.id):o.jsx("div",{"data-assistant-phase":u.blocks[0].phase,children:i(u.blocks)},u.id)),t&&!(a!=null&&a.process)&&o.jsxs("div",{className:"development-process__status",role:"status",children:[o.jsx("span",{className:"tool-icon",children:o.jsx(fD,{kind:"thinking"})}),o.jsx(bn,{children:c||r("developmentRuns.processing")})]})]})}const bMt={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 yMt(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 vMt(e){return typeof e=="object"&&e!==null&&typeof e.path=="string"}function xMt(e){return typeof e=="object"&&e!==null&&typeof e.call=="string"}function IV(e,t){if(vMt(e))return yMt(t,e.path);if(xMt(e)){const n=bMt[e.call],i={};for(const[r,s]of Object.entries(e.args??{}))i[r]=IV(s,t);return n?n(i):`[unknown fn: ${e.call}]`}return e}function wMt(e,t){const n=IV(e,t);return n==null?"":typeof n=="string"?n:String(n)}const qMe=new Map;function u0(e,t){qMe.set(e,t)}function OMt(e){return qMe.get(e)}function kMt(e,t,n){const i=t.replace(/^\//,"").split("/").map(s=>s.replace(/~1/g,"/").replace(/~0/g,"~"));let r=e;for(let s=0;sIV(i,e.dataModel),resolveString:i=>wMt(i,e.dataModel),dispatchAction:t,render:i=>{if(!i)return null;const r=e.components[i];if(!r)return null;const s=OMt(r.component)??SMt;return o.jsx(s,{node:r,ctx:n},i)}};return o.jsx("div",{className:"a2ui-surface","data-a2ui-surface":e.surfaceId,children:n.render(e.rootId)})}function KMe(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 hD({value:e,skillPrefix:t="/",onRemoveSkill:n,onRemoveAgent:i}){const{t:r}=_e("conversation");return e.skills.length===0&&!e.targetAgent?null:o.jsxs("div",{className:"invocation-chips","aria-label":r("invocation.ariaLabel"),children:[e.skills.map(s=>o.jsxs("span",{className:"invocation-chip invocation-chip--skill",title:s.description,children:[o.jsx(YS,{"aria-hidden":!0}),o.jsxs("span",{children:[t,s.name]}),n?o.jsx("button",{type:"button",onClick:()=>n(s.name),"aria-label":r("invocation.removeSkill",{name:s.name}),children:o.jsx(ka,{})}):null]},s.name)),e.targetAgent?o.jsxs("span",{className:"invocation-chip invocation-chip--agent",title:e.targetAgent.description,children:[o.jsx(oAe,{"aria-hidden":!0}),o.jsx("span",{children:e.targetAgent.name}),i?o.jsx("button",{type:"button",onClick:i,"aria-label":r("invocation.removeAgent",{name:e.targetAgent.name}),children:o.jsx(ka,{})}):null]}):null]})}function PV(e=""){return e.startsWith("image/")?"image":e.startsWith("video/")?"video":e==="application/pdf"?"pdf":e==="text/markdown"?"markdown":"text"}function GMe(e){var n,i,r,s;const t=PV(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 XMe(e){return e?e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`:""}function YMe(e,t){return e.previewUrl?e.previewUrl:e.data?`data:${e.mimeType??"application/octet-stream"};base64,${e.data}`:e.uri?GEe(t,e.uri):""}function CMt({kind:e}){return e==="image"?o.jsx(yQ,{}):e==="video"?o.jsx(lAe,{}):e==="pdf"?o.jsx(Git,{}):o.jsx(gQ,{})}function pD({appName:e,items:t,compact:n=!1,onRemove:i}){const{t:r}=_e("conversation"),[s,a]=p.useState(null);return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:`media-grid${n?" media-grid--compact":""}`,children:t.map(l=>{const c=PV(l.mimeType),u=YMe(l,e),d=l.status==="uploading"||l.status==="error"||!u,f=o.jsxs("button",{type:"button",className:"media-card-main",disabled:d,onClick:c==="image"?void 0:()=>a(l),"aria-label":r("media.preview",{name:l.name??r("media.attachment")}),children:[c==="image"&&u?o.jsx("img",{className:"media-card-image",src:u,alt:l.name??r("media.image"),loading:"lazy"}):c==="video"&&u?o.jsxs("div",{className:"media-card-video-container",children:[o.jsx("video",{className:"media-card-video",src:u,muted:!0,playsInline:!0,preload:"metadata","aria-hidden":"true"}),o.jsx("span",{className:"media-card-video-play",children:o.jsx(art,{})})]}):o.jsx("span",{className:"media-card-icon",children:o.jsx(CMt,{kind:c})}),o.jsxs("span",{className:"media-card-copy",children:[o.jsx("span",{className:"media-card-name",children:l.name??r("media.attachment")}),o.jsxs("span",{className:"media-card-meta",children:[o.jsx("span",{className:"media-card-type",children:GMe(l)}),l.status==="uploading"?o.jsxs(o.Fragment,{children:[o.jsx(Mi,{className:"media-card-spinner"})," ",r("media.uploading")]}):l.status==="error"?l.error??r("media.uploadFailed"):XMe(l.sizeBytes)]})]}),!n&&l.status!=="uploading"&&l.status!=="error"?o.jsx(ox,{className:"media-card-open"}):null]});return o.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?o.jsx(xEe,{src:u,children:f}):f,i?o.jsx("button",{type:"button",className:"media-card-remove","aria-label":r("media.remove",{name:l.name??r("media.attachment")}),onClick:()=>i(l.id),children:o.jsx(ka,{})}):null]},l.id)})}),o.jsx(Td,{children:s?o.jsx(TMt,{appName:e,item:s,onClose:()=>a(null)}):null})]})}function TMt({appName:e,item:t,onClose:n}){const{t:i}=_e("conversation"),r=p.useMemo(()=>YMe(t,e),[e,t]),s=PV(t.mimeType),[a,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]),o.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:o.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:[o.jsxs("header",{className:"media-viewer-header",children:[o.jsxs("div",{children:[o.jsx("strong",{children:t.name??i("media.attachment")}),o.jsxs("span",{children:[GMe(t),t.sizeBytes?` · ${XMe(t.sizeBytes)}`:""]})]}),o.jsxs("nav",{children:[o.jsx("a",{href:r,download:t.name,"aria-label":i("media.download"),children:o.jsx(mP,{})}),o.jsx("button",{type:"button",onClick:n,"aria-label":i("media.close"),children:o.jsx(ka,{})})]})]}),o.jsxs("div",{className:`media-viewer-body media-viewer-body--${s}`,children:[s==="image"?o.jsx("img",{src:r,alt:t.name??i("media.image")}):null,s==="video"?o.jsx("div",{className:"media-viewer-video-wrapper",children:o.jsx("video",{src:r,controls:!0,autoPlay:!0,playsInline:!0,preload:"auto",className:"media-viewer-video"})}):null,s==="pdf"?o.jsx("iframe",{src:r,title:t.name??"PDF"}):null,c?o.jsxs("div",{className:"media-viewer-loading",children:[o.jsx(Mi,{})," ",i("media.reading")]}):null,!c&&d?o.jsx("div",{className:"media-viewer-loading",children:i("media.loadFailed",{error:d})}):null,!c&&s==="markdown"?o.jsx("div",{className:"media-document",children:o.jsx(Zu,{text:a})}):null,!c&&s==="text"?o.jsx("pre",{className:"media-document media-document--plain",children:a}):null]})]})})}function AMt({definition:e,label:t,done:n,open:i,onToggle:r}){const{t:s}=_e("conversation"),a=e.icon,l=n?e.doneLabel:e.runningLabel,c=t??s(`blocks.tools.${e.name}.${n?"done":"running"}`,{defaultValue:l});return o.jsxs("button",{type:"button",className:`builtin-tool-head${n?" is-done":" is-running"}`,"data-tool-tone":e.tone,onClick:r,"aria-expanded":i,children:[o.jsx("span",{className:"builtin-tool-icon","aria-hidden":"true",children:o.jsx(a,{})}),n?o.jsx("span",{className:"builtin-tool-label",children:c}):o.jsx(bn,{className:"builtin-tool-label",duration:2.4,spread:18,"aria-live":"polite",children:c}),o.jsx(a1,{className:`builtin-tool-chevron${i?" is-open":""}`})]})}function su(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function In(e){return typeof e=="string"?e:""}function pne(e){return typeof e=="number"&&Number.isFinite(e)?e:0}function Iu(e){return Array.isArray(e)?e:[]}function $8(e){let t=e;if(typeof t=="string")try{t=JSON.parse(t)}catch{return{}}const n=su(t)??{};return su(n.result)??n}function mD(e){if(typeof e=="string")try{return mD(JSON.parse(e))}catch{return e}const t=su(e);if(!t)return"";const n=su(t.result);return In(t.error)||In(t.message)||In(n==null?void 0:n.error)||In(n==null?void 0:n.message)}function _Mt(e){if(e.kind==="tool")return"tool";if(e.kind==="knowledge_base")return"knowledge_base";const t=su(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 ZMe={tool:"Tools",knowledge:"AgentKit Knowledge Base",skillCenter:"AgentKit Skill Center",unknownSource:"Unknown source",unnamedResource:"Unnamed resource",unnamedAgent:"Unnamed agent"};function jMt(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 NMt(e){return e==="veadk_builtin_tools"?"tool":e==="agentkit_knowledge"?"knowledge_base":e.startsWith("skill_hub:")?"skill_hub":"skill_space"}function RMt(e,t=ZMe){const n=$8(e),i=su(n.capabilities)??{},r=Iu(n.resources).flatMap(a=>{const l=su(a);if(!l)return[];const c=l.kind==="tool"?"tool":l.kind==="knowledge_base"?"knowledge_base":"skill";return[{ref:In(l.ref),kind:c,category:_Mt(l),name:In(l.name)||In(l.ref)||t.unnamedResource,description:In(l.description),source:In(l.source),version:In(l.version)}]}),s=Iu(n.sources).flatMap(a=>{const l=su(a);if(!l)return[];const c=In(l.source),u=In(l.status),d=u==="error"?"error":u==="skipped"?"skipped":"ok";return[{source:c,category:NMt(c),label:jMt(c,t),status:d,count:pne(l.count),message:In(l.message),searchKeywords:Iu(l.search_keywords).map(In).filter(Boolean)}]});return{collectionId:In(n.collection_id),capabilities:{googleAdkVersion:In(i.google_adk_version),agentTypes:Iu(i.agent_types).map(In).filter(Boolean),maxOrchestrationDepth:pne(i.max_orchestration_depth)},resources:r,sources:s,counts:{all:r.length,skill_hub:r.filter(a=>a.category==="skill_hub").length,skill_space:r.filter(a=>a.category==="skill_space").length,knowledge_base:r.filter(a=>a.category==="knowledge_base").length,tool:r.filter(a=>a.category==="tool").length}}}function IMt(e,t){return{resources:e.resources.filter(n=>n.category===t),sources:e.sources.filter(n=>n.category===t)}}function JMe(e,t,n=ZMe){const i=$8(e),r=$8(t),s=new Map(Iu(r.results).flatMap(d=>{const f=su(d),h=In(f==null?void 0:f.name);return f&&h?[[h,f]]:[]})),a=Iu(i.agents).flatMap(d=>{const f=su(d),h=In(f==null?void 0:f.name);return f&&h?[f]:[]}),l=new Set(a.map(d=>In(d.name))),c=[...s.entries()].filter(([d])=>!l.has(d)).map(([d])=>({name:d})),u=[...a,...c].map(d=>{const f=In(d.name),h=Iu(d.nodes).flatMap(C=>{const E=su(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=mne(v==null?void 0:v.resources),O=w.length>0?w:mne(h.flatMap(C=>Iu(C.resources))),S=gne(v==null?void 0:v.python_tools),k=S.length>0?S:gne(h.flatMap(C=>Iu(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 PMt(e,t){return!!mD(t)||JMe(e,t).failedCount>0}function mne(e){const t=new Set;return Iu(e).flatMap(n=>{const i=su(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),a=s==="tool"||r.startsWith("veadk_tool:")?"tool":s==="knowledge_base"||r.startsWith("agentkit_kb:")?"knowledge_base":"skill",l=r.split(":");return[{ref:r,kind:a,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 gne(e){const t=new Set;return Iu(e).flatMap(n=>{const i=su(n),r=In(i==null?void 0:i.name),s=In(i==null?void 0:i.code),a=`${r}\0${s}`;return!i||!r||t.has(a)?[]:(t.add(a),[{name:r,description:In(i.description),code:s,entrypoint:In(i.entrypoint)||r,dependencies:Iu(i.dependencies).map(In).filter(Boolean)}])})}function DMt({branch:e}){return o.jsxs("div",{className:`branch-compare__body${e.status==="running"?" is-streaming":""}`,"aria-live":"polite",children:[e.content?o.jsx(Zu,{text:e.content,streaming:e.status==="running"}):null,e.status==="running"?o.jsx("span",{className:"branch-compare__caret","aria-hidden":"true"}):null,e.error?o.jsx("p",{className:"branch-compare__error",children:e.error}):null]})}function MMt({args:e,response:t,status:n,onBranchSelect:i}){const{t:r}=_e("conversation"),s=p.useMemo(()=>pAe(e,t,n),[e,t,n]),[a,l]=p.useState(0);return o.jsxs("section",{className:"branch-compare","aria-label":r("blocks.branchCompare.ariaLabel"),children:[o.jsx("div",{className:"branch-compare__tabs",role:"tablist","aria-label":r("blocks.branchCompare.selectDirection"),children:s.branches.map((c,u)=>o.jsx("button",{className:`branch-compare__tab${a===u?" is-active":""}`,type:"button",role:"tab","aria-selected":a===u,"aria-controls":`branch-compare-panel-${u}`,onClick:()=>l(u),children:o.jsx(Lo,{color:"info",size:"sm",variant:"soft",children:c.label})},`${c.label}:${u}`))}),o.jsx("div",{className:"branch-compare__branches",children:s.branches.map((c,u)=>o.jsxs("article",{className:`branch-compare__branch${a===u?" is-active":""}`,id:`branch-compare-panel-${u}`,role:"tabpanel",children:[o.jsx("header",{className:"branch-compare__head",children:o.jsx(Lo,{color:"info",size:"sm",variant:"soft",children:c.label})}),o.jsx(DMt,{branch:c}),o.jsx("footer",{className:"branch-compare__footer",children:o.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 e5e({controlled:e,default:t,name:n,state:i="value"}){const{current:r}=p.useRef(e!==void 0),[s,a]=p.useState(t),l=r?e:s,c=p.useCallback(u=>{r||a(u)},[]);return[l,c]}const t5e=p.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function LMt(){return p.useContext(t5e)}function $Mt(e){const{children:t,elementsRef:n,labelsRef:i,onMapChange:r}=e,s=Wn(r),[,a]=p.useState(!1),l=Gu(BMt).current,c=Gu(FMt).current,u=p.useRef(0),d=p.useRef(!0),f=p.useRef([]),h=p.useRef(null),m=Wn(()=>{d.current||(d.current=!0,a(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,N;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:((N=(E=C.registration.textRef)==null?void 0:E.current)==null?void 0:N.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(N=>{if(!zMt(N))return;let A=null;for(const j of S)if(j.isConnected){if(A&&n5e(A,j)>0){k.disconnect(),m();return}A=j}});h.current=k;const C=new Set;for(let N=1;Nk.observe(N,{childList:!0}))}const x=Wn(()=>{const[S,k]=UMt(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 o.jsx(t5e.Provider,{value:O,children:t})}function FMt(){return new Map}function BMt(){return new Set}function UMt(e){const t=new Set,n=[],i=[];e.forEach((s,a)=>{if(!a.isConnected)return;const l=s.index,c={index:l??-1,element:a,registration:s};l===null?i.push(c):l>=0&&(t.add(l),n.push(c))});let r=0;return i.sort((s,a)=>n5e(s.element,a.element)),i.forEach(s=>{for(;t.has(r);)r+=1;s.index=r,n.push(s),r+=1}),t.size>0&&n.sort((s,a)=>s.index-a.index),[n,i.map(s=>s.element)]}function QMt(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function zMt(e){for(const t of e)for(let n=0;nnull},s5e=p.forwardRef(function(t,n){const{render:i,className:r,disabled:s=!1,hiddenUntilFound:a,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]=e5e({controlled:h,default:v,name:"Accordion",state:"value"}),O=Wn((E,N,A)=>{if(d)if(N){const j=x.slice();if(j.push(E),u==null||u(j,A),A.isCanceled)return;w(j)}else{const j=x.filter(T=>T!==E);if(u==null||u(j,A),A.isCanceled)return;w(j)}else{const j=x[0]===E?[]:[E];if(u==null||u(j,A),A.isCanceled)return;w(j)}}),S=p.useMemo(()=>({value:x,disabled:s,orientation:f}),[x,s,f]),k=p.useMemo(()=>({disabled:s,handleValueChange:O,hiddenUntilFound:a??!1,keepMounted:l??!1,state:S,value:x}),[s,O,a,l,S,x]),C=wo("div",t,{state:S,ref:n,props:b,stateAttributesMapping:VMt});return o.jsx(i5e.Provider,{value:k,children:o.jsx($Mt,{elementsRef:y,children:C})})});function HMt(e){const{open:t,defaultOpen:n,onOpenChange:i,disabled:r}=e,[s,a]=e5e({controlled:t,default:n,name:"Collapsible",state:"open"}),{mounted:l,setMounted:c,transitionStatus:u}=C2e(s,!0,!0),d=mp(),[f,h]=p.useState(),m=f===null?void 0:f??d,g=Wn(b=>{const v=!s,y=Ys(Zx,b.nativeEvent);i(v,y),!y.isCanceled&&a(v)});return p.useMemo(()=>({defaultPanelId:d,disabled:r,handleTrigger:g,mounted:l,open:s,panelId:m,setMounted:c,setOpen:a,setPanelIdState:h,transitionStatus:u}),[d,r,g,l,s,m,c,a,h,u])}const o5e=p.createContext(void 0);function a5e(){const e=p.useContext(o5e);if(e===void 0)throw new Error(mc(15));return e}function qMt(e={}){const{guess:t,label:n,metadata:i,textRef:r,index:s}=e,{register:a,unregister:l,subscribeMapChange:c,nextIndexRef:u}=LMt(),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&&a(v,{metadata:i??null,index:s??null,label:n,textRef:r})},[s,a,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 l5e=p.createContext(void 0);function DV(){const e=p.useContext(l5e);if(e===void 0)throw new Error(mc(9));return e}let MV=function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=AN.startingStyle]="startingStyle",e[e.endingStyle=AN.endingStyle]="endingStyle",e}({}),WMt=function(e){return e.panelOpen="data-panel-open",e}({});const KMt={[MV.open]:""},GMt={[MV.closed]:""},XMt={open(e){return e?{[WMt.panelOpen]:""}:null}},YMt={open(e){return e?KMt:GMt}};let ZMt=function(e){return e.index="data-index",e.disabled="data-disabled",e.open="data-open",e}({});const LV={...YMt,index:e=>({[ZMt.index]:String(e)}),...lP,value:()=>null},c5e=p.forwardRef(function(t,n){const{className:i,disabled:r=!1,onOpenChange:s,render:a,value:l,style:c,...u}=t,{ref:d,index:f}=qMt(),h=Yx(n,d),{disabled:m,handleValueChange:g,state:b,value:v}=r5e(),y=mp(),x=l??y,w=r||m,O=v.indexOf(x)!==-1,S=Wn((M,P)=>{s==null||s(M,P),!P.isCanceled&&g(x,M,P)}),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]),N=p.useMemo(()=>({...b,hidden:!O&&!k.mounted,index:f,disabled:w,open:O}),[k.mounted,w,f,O,b]),A=mp(),[j,T]=p.useState(),R=j===null?void 0:j??A,_=p.useMemo(()=>({defaultTriggerId:A,open:O,state:N,setTriggerId:T,triggerId:R}),[A,O,N,T,R]),D=wo("div",t,{state:N,ref:h,props:u,stateAttributesMapping:LV});return o.jsx(o5e.Provider,{value:E,children:o.jsx(l5e.Provider,{value:_,children:D})})}),u5e=p.forwardRef(function(t,n){const{render:i,className:r,style:s,...a}=t,{state:l}=DV();return wo("h3",t,{state:l,ref:n,props:a,stateAttributesMapping:LV})}),d5e=p.forwardRef(function(t,n){const{disabled:i,className:r,id:s,render:a,nativeButton:l=!0,style:c,...u}=t,{panelId:d,open:f,handleTrigger:h,disabled:m}=a5e(),g=i||m,{getButtonProps:b,buttonRef:v}=cP({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]),wo("button",t,{state:x,ref:[n,v],props:[{"aria-controls":f?d:void 0,"aria-expanded":f,id:S,onClick:h},u,b],stateAttributesMapping:XMt})}),vO={height:void 0,width:void 0};function JMt(e){const{externalRef:t,hiddenUntilFound:n,id:i,keepMounted:r,mounted:s,onOpenChange:a,open:l,setMounted:c,setOpen:u,transitionStatus:d}=e,f=p.useRef(null),h=p.useRef(null),[m,g]=p.useState(vO),b=p.useRef(vO),v=p.useRef(!1),y=p.useRef(l),x=p.useRef(!1),[w,O]=p.useState(!1),S=p.useRef(null),k=Yx(t,f),C=Sl(l),E=sQ(f),N=!l&&!s,A=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,R=n&&N&&h.current!=="css-animation",_=Wn((F,I=!0)=>{I&&(b.current=F),g(F)}),D=Wn(()=>{var F;(F=S.current)==null||F.call(S),S.current=null}),M=Wn(F=>{D(),S.current=()=>{S.current=null,F()}}),P=Wn(()=>{l&&s&&h.current==="css-animation"&&(x.current=!0)});Un(()=>{!w||d==="starting"||O(!1)},[w,d]),p.useEffect(()=>()=>{P(),D()},[P,D]),Un(()=>{const F=f.current;if(!F)return;!l&&S.current&&D();const I=e5t(F,j);if(h.current=I,l&&d==="idle"&&y.current&&I==="css-animation"){b.current=q0(F);return}if(l&&d==="starting"){const B=v.current;if(v.current=!1,I==="none"){_(q0(F)),O(!0);return}if(I==="css-transition"){const X=t5t(F);if(_(q0(F)),!B)return X;const ie=gA(F,"transition-duration","0s");return M(ie),O(!0),X}_(q0(F));const W=gA(F,"animation-name","none");if(!B){W();return}const H=gA(F,"animation-duration","0s");W(),M(H),O(!0);return}if(!l&&s&&(d==="idle"||d==="starting")){if(y.current=!1,x.current=!1,I==="none"){_(vO,!1),c(!1);return}_(q0(F));return}if(d!=="ending")return;if(I==="none"){c(!1);return}const z=q0(F);if(!(z.height>0||z.width>0)){c(!1);return}_(z),I==="css-animation"&&gA(F,"animation-name","none")()},[s,l,D,_,c,M,j,d]),TC({enabled:l&&s&&A==="idle",open:!0,ref:f,onComplete(){l&&_(vO,!1)}}),p.useEffect(()=>{if(l||!s||A!=="ending"||!f.current)return;const I=new AbortController;let z=-1;function K(){C.current||(c(!1),_(vO,!1))}return z=Jl.request(()=>{E(K,I.signal)}),()=>{Jl.cancel(z),I.abort()}},[C,s,l,A,E,_,c]),Un(()=>{const F=f.current;!F||!n||!N||F.setAttribute("hidden","until-found")},[N,n]),p.useEffect(function(){const I=f.current;if(!I)return;function z(K){const B=Ys(XTe,K);a(!0,B),!B.isCanceled&&(v.current=!0,u(!0))}return mi(I,"beforematch",z)},[a,u]);const L=r||n||s||l;return{height:T.height,props:{...R?{[MV.startingStyle]:""}:void 0,hidden:N,id:i},ref:k,shouldPreventOpenAnimation:j,shouldRender:L,transitionStatus:A,width:T.width}}function q0(e){return{height:e.scrollHeight,width:e.scrollWidth}}function e5t(e,t){const n=Bs(e).getComputedStyle(e),i=(n.animationName.split(",").map(s=>s.trim()).some(s=>s!==""&&s!=="none")||t)&&bne(n.animationDuration),r=bne(n.transitionDuration);return i&&r||r?"css-transition":i?"css-animation":"none"}function bne(e){return e.split(",").map(t=>t.trim()).some(t=>t!==""&&Number.parseFloat(t)>0)}function gA(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 t5t(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=Jl.request(n);return()=>{Jl.cancel(i),n()}}let yne=function(e){return e.accordionPanelHeight="--accordion-panel-height",e.accordionPanelWidth="--accordion-panel-width",e}({});const f5e=p.forwardRef(function(t,n){const{className:i,hiddenUntilFound:r,keepMounted:s,id:a,render:l,style:c,...u}=t,{hiddenUntilFound:d,keepMounted:f}=r5e(),{defaultPanelId:h,mounted:m,onOpenChange:g,open:b,setMounted:v,setOpen:y,setPanelIdState:x,transitionStatus:w}=a5e(),O=r??d,S=s??f,k=a||void 0,C=a??h;Un(()=>(x(I=>k??(I===null?void 0:I)),()=>{x(I=>I===k?null:I)}),[k,x]);const{height:E,props:N,ref:A,shouldPreventOpenAnimation:j,shouldRender:T,transitionStatus:R,width:_}=JMt({externalRef:n,hiddenUntilFound:O,id:C,keepMounted:S,mounted:m,onOpenChange:g,open:b,setMounted:v,setOpen:y,transitionStatus:w}),{state:D,triggerId:M}=DV(),P={...D,transitionStatus:R},L=BTe(c,P),F=wo("div",{...t,style:void 0},{state:P,ref:A,props:[N,{"aria-labelledby":M,role:"region",style:{[yne.accordionPanelHeight]:E===void 0?"auto":`${E}px`,[yne.accordionPanelWidth]:_===void 0?"auto":`${_}px`}},u,L?{style:L}:void 0,j?{style:{animationName:"none"}}:void 0],stateAttributesMapping:LV});return T?F:null}),n5t=(e,t)=>{const n=e.currentTarget,i={x:e.clientX,y:e.clientY},r=i5t(i,n.getBoundingClientRect()),s=r5t(i,r),a=s5t(t.getBoundingClientRect());return a5t([...s,...a])};function i5t(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 r5t(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 s5t(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 o5t(e,t){const{x:n,y:i}=e;let r=!1;for(let s=0,a=t.length-1;si!=h>i&&n<(f-u)*(i-d)/(h-d)+u&&(r=!r)}return r}function a5t(e){const t=e.slice();return t.sort((n,i)=>n.xi.x?1:n.yi.y?1:0),l5t(t)}function l5t(e){if(e.length<=1)return e.slice();const t=[];for(let i=0;i=2;){const s=t[t.length-1],a=t[t.length-2];if((s.x-a.x)*(r.y-a.y)>=(s.y-a.y)*(r.x-a.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],a=n[n.length-2];if((s.x-a.x)*(r.y-a.y)>=(s.y-a.y)*(r.x-a.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 c5t="_Transition_1wdpp_1",u5t="_Popover_1wdpp_3",h5e={Transition:c5t,Popover:u5t},p5e=p.createContext(null),gD=()=>{const e=p.use(p5e);if(!e)throw new Error("Popover components must be wrapped in ");return e},Wm=({open:e,onOpenChange:t,showOnHover:n=!1,hoverOpenDelay:i=150,children:r})=>{const[s,a]=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);wQ(()=>v(!1),b?500:null);const y=dg(t),x=dg(C=>{var E,N;clearTimeout(f.current),g!==C&&(C||(c(!1),n&&h.current&&((E=u.current)==null||E.focus()),h.current=!1),(N=y.current)==null||N.call(y,C),a(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 o.jsx(p5e,{value:k,children:o.jsx(tje,{open:g,onOpenChange:w,modal:!1,children:r})})},d5t=({children:e,onPointerDown:t,onClick:n})=>{const{setOpen:i,showOnHover:r,temporarilyPreventClickToClose:s,onTriggerEnter:a,onTriggerLeave:l,isPointerInTransitRef:c,triggerRef:u,contentRef:d}=gD(),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&&(a(),f.current=!0)},g=()=>{f.current&&(l(),f.current=!1)};return o.jsx(nje,{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})},m5e=({children:e,avoidCollisions:t,width:n,minWidth:i,maxWidth:r,side:s,sideOffset:a=8,align:l,alignOffset:c,translucent:u,className:d,autoFocus:f=!0})=>{const{showOnHover:h,shake:m,contentRef:g}=gD(),b=v=>{const y=g.current;if(y&&v.target===y&&v.key==="Tab"&&v.shiftKey){v.preventDefault(),v.stopPropagation();const x=TAe(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]),o.jsx(rje,{forceMount:!0,ref:g,className:Ti(h5e.Popover,d),style:Ky({"popover-width":n,"popover-min-width":i,"popover-max-width":r}),onCloseAutoFocus:h?Gh:void 0,"data-animate":m?"shake":void 0,"data-translucent":u?"true":void 0,side:s,sideOffset:a,align:l,alignOffset:c??(l==="center"?0:-5),avoidCollisions:t??!0,hideWhenDetached:!0,collisionPadding:20,onOpenAutoFocus:Gh,onEscapeKeyDown:Gh,onKeyDown:b,children:e})},f5t=e=>{const{setOpen:t,triggerRef:n,contentRef:i,isPointerInTransitRef:r,hoverOpenFocusedWithTab:s}=gD(),[a,l]=p.useState(null),c=p.useCallback(()=>{l(null),r.current=!1},[r]),u=p.useCallback((d,f)=>{const h=n5t(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(!a)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=!o5t(b,a),x=g.hasAttribute("aria-haspopup");v?c():(y||x)&&(c(),t(!1))};return document.addEventListener("pointermove",d),()=>document.removeEventListener("pointermove",d)},[a,t,c,n,i]),p.useEffect(()=>{const d=f=>{if(i.current&&f.key==="Tab"&&!f.shiftKey){const[h]=TAe(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]),o.jsx(m5e,{...e})},h5t=e=>{const{open:t,showOnHover:n,setOpen:i}=gD();return MC(t,()=>{i(!1)}),o.jsx(ije,{forceMount:!0,children:o.jsx(Xw,{enterDuration:600,exitDuration:300,className:h5e.Transition,disableAnimations:!0,children:t&&(n?o.jsx(f5t,{...e},"popover-hover"):o.jsx(m5e,{...e},"popover"))})})};Wm.Trigger=d5t;Wm.Content=h5t;const p5t=["skill_hub","skill_space","knowledge_base","tool"];function g5e(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m4 6 4 4 4-4"})})}function b5e({label:e}){return o.jsx("div",{className:"create-agent-card__loading",role:"status","aria-label":e,children:[0,1,2].map(t=>o.jsxs("div",{className:"create-agent-card__skeleton-row","aria-hidden":"true",children:[o.jsx("span",{}),o.jsx("span",{})]},t))})}function m5t(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 f3({label:e,resources:t}){const{t:n}=_e("conversation");return t.length===0?null:o.jsxs("section",{className:"create-agent-card__popover-section",children:[o.jsx("h4",{children:e}),o.jsx("div",{className:"create-agent-card__popover-list",children:t.map(i=>o.jsxs("div",{className:"create-agent-card__popover-item",children:[o.jsxs("div",{className:"create-agent-card__popover-item-heading",children:[o.jsx("strong",{children:i.name}),o.jsx(Lo,{color:"secondary",size:"sm",variant:"soft",children:m5t(i,n)})]}),i.description?o.jsx("p",{children:i.description}):null]},i.ref))})]})}function g5t({tools:e}){const{t}=_e("conversation");return e.length===0?null:o.jsxs("section",{className:"create-agent-card__popover-section",children:[o.jsx("h4",{children:t("blocks.createAgents.selfAuthoredTools")}),o.jsx(s5e,{children:e.map((n,i)=>o.jsxs(c5e,{className:"create-agent-card__python-tool",value:`${n.name}:${i}`,children:[o.jsx(u5e,{className:"create-agent-card__python-tool-header",children:o.jsxs(d5e,{className:"create-agent-card__python-tool-trigger",children:[o.jsxs("span",{children:[o.jsx("strong",{children:n.name}),n.description?o.jsx("small",{children:n.description}):null]}),o.jsxs("span",{className:"create-agent-card__python-tool-meta",children:[o.jsx(Lo,{color:"secondary",size:"sm",variant:"soft",children:t("blocks.createAgents.selfAuthoredTools")}),o.jsx(g5e,{className:"create-agent-card__python-tool-chevron"})]})]})}),o.jsxs(f5e,{className:"create-agent-card__python-tool-panel",children:[n.dependencies.length>0?o.jsx("div",{className:"create-agent-card__python-tool-dependencies",children:t("blocks.createAgents.dependencies",{items:n.dependencies.join(", ")})}):null,o.jsx("pre",{tabIndex:0,"aria-label":t("blocks.createAgents.fullCode",{name:n.name}),children:o.jsx("code",{children:n.code})})]})]},`${n.name}:${i}`))})]})}function b5t({agents:e}){const{t}=_e("conversation");return e.length===0?null:o.jsxs("section",{className:"create-agent-card__popover-section",children:[o.jsx("h4",{children:t("blocks.createAgents.subAgents")}),o.jsx("div",{className:"create-agent-card__popover-list",children:e.map(n=>o.jsxs("div",{className:"create-agent-card__popover-item",children:[o.jsxs("div",{className:"create-agent-card__popover-item-heading",children:[o.jsx("strong",{children:n.id}),o.jsx(Lo,{color:"secondary",size:"sm",variant:"soft",children:t(`blocks.createAgents.agentTypes.${n.type}`,{defaultValue:n.type})})]}),n.description?o.jsx("p",{children:n.description}):null]},n.id))})]})}function bA({label:e,count:t,icon:n,children:i}){const{t:r}=_e("conversation"),s=o.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,o.jsx("span",{children:t})]});return t===0?s:o.jsxs(Wm,{showOnHover:!0,hoverOpenDelay:120,children:[o.jsx(Wm.Trigger,{children:s}),o.jsx(Wm.Content,{side:"top",align:"start",minWidth:"auto",maxWidth:360,className:"create-agent-card__resource-popover",children:i})]})}function y5t({response:e,status:t}){const{t:n}=_e("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(()=>RMt(e,i),[i,e]),s=p.useMemo(()=>p5t.map(c=>{const u=IMt(r,c);return{value:c,label:n(`blocks.createAgents.categories.${c}`),...u,searchKeywords:[...new Set(u.sources.flatMap(d=>d.searchKeywords))]}}),[r,n]),a=t==="failed",l=a?mD(e):"";return o.jsx("section",{className:"create-agent-tool-card","aria-label":n("blocks.createAgents.collectionAria"),children:t==="running"?o.jsx(b5e,{label:n("blocks.createAgents.retrieving")}):a?o.jsxs("div",{className:"create-agent-card__message is-error",role:"alert",children:[o.jsx("span",{className:"create-agent-card__message-title",children:n("blocks.createAgents.retrievalFailed")}),o.jsx("span",{children:l||n("blocks.createAgents.checkConfig")})]}):o.jsx(s5e,{className:"create-agent-card__accordion",children:s.map(c=>o.jsxs(c5e,{className:"create-agent-card__accordion-item",value:c.value,children:[o.jsx(u5e,{className:"create-agent-card__accordion-header",children:o.jsxs(d5e,{className:"create-agent-card__accordion-trigger",children:[o.jsx("span",{children:c.label}),o.jsxs("span",{className:"create-agent-card__accordion-meta",children:[o.jsx(Lo,{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}),o.jsx(g5e,{className:"create-agent-card__accordion-chevron"})]})]})}),o.jsx(f5e,{className:"create-agent-card__accordion-content",children:o.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?o.jsxs("div",{className:"create-agent-card__search-keywords",children:[o.jsx("span",{children:n("blocks.createAgents.searchKeywords")}),o.jsx("span",{children:c.searchKeywords.join("、")})]}):null,c.resources.length>0?o.jsx("div",{className:"create-agent-card__resource-list",children:c.resources.map(u=>o.jsx("div",{className:"create-agent-card__resource",children:o.jsxs("div",{className:"create-agent-card__resource-main",children:[o.jsxs("div",{className:"create-agent-card__resource-title",children:[o.jsx("span",{className:"create-agent-card__resource-name",children:u.name}),u.version?o.jsx(Lo,{className:"create-agent-card__resource-version",color:"secondary",size:"sm",variant:"soft",children:u.version}):null]}),u.description?o.jsx("p",{children:u.description}):null]})},u.ref))}):o.jsxs("div",{className:"create-agent-card__empty-category",children:[o.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=>o.jsx("p",{className:"create-agent-card__raw-source-error",children:u.message},u.source))]})]})})]},c.value))},r.collectionId||"collected-resources")})}function v5t({args:e,response:t,status:n}){const{t:i}=_e("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(()=>JMe(e,t,r),[e,r,t]),a=n==="failed"?mD(t):"";return o.jsxs("section",{className:"create-agent-tool-card is-agent-results","aria-label":i("blocks.createAgents.resultAria"),children:[a?o.jsxs("div",{className:"create-agent-card__message is-error",role:"alert",children:[o.jsx("span",{className:"create-agent-card__message-title",children:i("blocks.createAgents.creationFailed")}),o.jsx("span",{children:a})]}):null,s.agents.length>0?o.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"&&a,d=l.builtinTools.length+l.pythonTools.length;return o.jsxs(Uz,{className:`create-agent-card__agent-card${u?" is-error":""}`,children:[o.jsx(Qz,{leading:o.jsx(cw,{seed:l.name}),title:l.name,titleText:l.name,status:o.jsx(Lo,{color:"secondary",size:"sm",variant:"soft",children:i(`blocks.createAgents.agentTypes.${l.rootType}`,{defaultValue:l.rootType})})}),l.description?o.jsx(zz,{children:l.description}):null,u?o.jsx("div",{className:"create-agent-card__agent-result is-error",role:"alert",children:u}):null,o.jsxs("div",{className:"create-agent-card__agent-resources","aria-label":i("blocks.createAgents.agentResources",{name:l.name}),children:[o.jsx(bA,{label:i("blocks.createAgents.skill"),count:l.skills.length,icon:o.jsx(z_,{"aria-hidden":"true"}),children:o.jsx(f3,{label:i("blocks.createAgents.skill"),resources:l.skills})}),o.jsx(bA,{label:i("blocks.createAgents.knowledgeBase"),count:l.knowledgeBases.length,icon:o.jsx(Lje,{"aria-hidden":"true"}),children:o.jsx(f3,{label:i("blocks.createAgents.knowledgeBase"),resources:l.knowledgeBases})}),o.jsxs(bA,{label:i("blocks.createAgents.toolsLabel"),count:d,icon:o.jsx(_it,{"aria-hidden":"true"}),children:[o.jsx(f3,{label:i("blocks.createAgents.builtinTool"),resources:l.builtinTools}),o.jsx(g5t,{tools:l.pythonTools})]}),o.jsx(bA,{label:i("blocks.createAgents.subAgents"),count:l.subAgentCount,icon:o.jsx(Nit,{"aria-hidden":"true"}),children:o.jsx(b5t,{agents:l.subAgents})})]})]},l.name)})}):n==="running"?o.jsx(b5e,{label:i("blocks.createAgents.creating")}):o.jsxs("div",{className:"create-agent-card__message",children:[o.jsx("span",{className:"create-agent-card__message-title",children:i("blocks.createAgents.noAgents")}),o.jsx("span",{children:i("blocks.createAgents.noAgentResult")})]})]})}const x5t={web_search:{name:"web_search",runningLabel:"Searching the web",doneLabel:"Web search complete",tone:"search",icon:dne},link_reader:{name:"link_reader",runningLabel:"Reading webpage",doneLabel:"Webpage read complete",tone:"search",icon:dne},run_code:{name:"run_code",runningLabel:"Running code in the AgentKit sandbox",doneLabel:"Code execution completed in the AgentKit sandbox",tone:"sandbox",icon:uMt},list_envs:{name:"list_envs",runningLabel:"Checking available environments",doneLabel:"Available environments loaded",tone:"resources",icon:fMt},get_env_manifest:{name:"get_env_manifest",runningLabel:"Loading the environment manifest",doneLabel:"Environment manifest loaded",tone:"knowledge",icon:hMt},execute_in_sandbox:{name:"execute_in_sandbox",runningLabel:"Running a command in the environment",doneLabel:"Command completed in the environment",tone:"sandbox",icon:hne},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:hne},image_generate:{name:"image_generate",runningLabel:"Generating image",doneLabel:"Image generated",tone:"image",icon:sMt},video_generate:{name:"video_generate",runningLabel:"Generating video",doneLabel:"Video generated",tone:"video",icon:NV},ppt_generate:{name:"ppt_generate",runningLabel:"Generating presentation",doneLabel:"Presentation generated",tone:"presentation",icon:oMt},load_memory:{name:"load_memory",runningLabel:"Searching long-term memory",doneLabel:"Memory search complete",tone:"memory",icon:aMt},load_knowledgebase:{name:"load_knowledgebase",runningLabel:"Searching the knowledge base",doneLabel:"Knowledge base search complete",tone:"knowledge",icon:lMt},load_skill:{name:"load_skill",runningLabel:"Loading skill",doneLabel:"Skill loaded",tone:"skill",icon:cMt},collect_resources:{name:"collect_resources",runningLabel:"Collecting available resources",doneLabel:"Resource collection complete",failedLabel:"Resource collection failed",tone:"resources",icon:dMt,detailRenderer:y5t},create_agents:{name:"create_agents",runningLabel:"Creating and running agents",doneLabel:"Agent creation complete",failedLabel:"Agent creation failed",tone:"agent",icon:fne,detailRenderer:v5t},branch_compare:{name:"branch_compare",runningLabel:"",doneLabel:"",failedLabel:"",tone:"search",icon:fne,detailRenderer:MMt,hideHeader:!0}};function w5t(e){return x5t[e]}function O5t(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M6 3h8l4 4v14H6Z"}),o.jsx("path",{d:"M14 3v5h5"}),o.jsx("path",{d:"m10 12-2 2 2 2M14 12l2 2-2 2"})]})}function k5t(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.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"}),o.jsx("path",{d:"m9 12 2 2 4-4"})]})}function S5t(e,t){const n=new Map(e.map(a=>[a.path,a.content])),i=new Map(t.map(a=>[a.path,a.content])),r=new Set([...n.keys(),...i.keys()]),s=[];for(const a of[...r].sort((l,c)=>l.localeCompare(c))){const l=n.get(a),c=i.get(a);l!==c&&s.push({path:a,status:l===void 0?"added":c===void 0?"deleted":"modified",before:l??"",after:c??""})}return s}function $g(e){return{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.75,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,...e}}function y5e(e){return o.jsx("svg",{...$g(e),children:o.jsx("path",{d:"m9 7-5 5 5 5M15 7l5 5-5 5M13.5 4l-3 16"})})}function h3(e){return o.jsx("svg",{...$g(e),children:o.jsx("path",{d:"M6.5 3.75h7l4 4V20.25h-11zM13.5 3.75v4h4M9 12h6M9 15.5h4.5"})})}function E5t(e){return o.jsx("svg",{...$g(e),children:o.jsx("path",{d:"M3.75 7.25h6l1.75 2h8.75v9.25H3.75zM3.75 7.25V5.5h5l1.5 1.75"})})}function C5t(e){return o.jsx("svg",{...$g(e),children:o.jsx("path",{d:"m9 5 7 7-7 7"})})}function bD(e){return o.jsx("svg",{...$g(e),children:o.jsx("path",{d:"m6.5 6.5 11 11M17.5 6.5l-11 11"})})}function T5t(e){return o.jsxs("svg",{...$g(e),children:[o.jsx("circle",{cx:"12",cy:"12",r:"3.25"}),o.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 A5t(e){return o.jsx("svg",{...$g(e),children:o.jsx("path",{d:"M19.25 15.25A8 8 0 0 1 8.75 4.75a8 8 0 1 0 10.5 10.5Z"})})}function v5e(e){return o.jsxs("svg",{...$g(e),children:[o.jsx("path",{d:"M19.25 8.25V4.5l-1.8 1.8a7.5 7.5 0 1 0 1.8 7.65"}),o.jsx("path",{d:"M19.25 4.5H15.5"})]})}const _5t=p.lazy(()=>Ls(()=>Promise.resolve().then(()=>G$e),void 0)),j5t=p.lazy(()=>Ls(()=>import("../chunks/CodeDiffEditor-st4ujEZ9.js"),[])),x5e="veadk-code-workspace-theme";function N5t(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,a)=>{let l=r.children.get(s);l||(l={name:s,children:new Map},r.children.set(s,l)),a===i.length-1&&(l.path=n.path),r=l})}return t}function R5t(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 I5t(){if(typeof window>"u")return"light";try{return window.localStorage.getItem(x5e)==="dark"?"dark":"light"}catch{return"light"}}function P5t(e){return e===""?0:e.split(` `).length}function pw({project:e,open:t,onClose:n,onChange:i,readOnly:r=!1,comparison:s}){var R;const{t:a}=_e("workspaceTools"),l=p.useId(),c=p.useRef(null),u=p.useRef(null),d=p.useRef(n),[f,h]=p.useState(I5t),m=p.useMemo(()=>s?S5t(s.baseProject.files,e.files):[],[s,e.files]),g=p.useMemo(()=>s?m.map(_=>({path:_.path,content:_.status==="deleted"?_.before:_.after})):e.files,[m,s,e.files]),b=p.useMemo(()=>new Map(m.map(_=>[_.path,_.status])),[m]),[v,y]=p.useState(((R=g[0])==null?void 0:R.path)??null),[x,w]=p.useState(new Set),O=p.useMemo(()=>N5t(g),[g]),S=g.find(_=>_.path===v)??null,k=m.find(_=>_.path===v)??null;if(d.current=n,p.useEffect(()=>{try{window.localStorage.setItem(x5e,f)}catch{}},[f]),p.useEffect(()=>{var P;if(!t)return;const _=document.body.style.overflow,D=document.activeElement instanceof HTMLElement?document.activeElement:null;document.body.style.overflow="hidden",(P=u.current)==null||P.focus();const M=L=>{if(L.key==="Escape"){L.preventDefault(),d.current();return}if(L.key!=="Tab"||!c.current)return;const F=[...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(F.length===0)return;const I=F[0],z=F[F.length-1];L.shiftKey&&document.activeElement===I?(L.preventDefault(),z.focus()):!L.shiftKey&&document.activeElement===z&&(L.preventDefault(),I.focus())};return window.addEventListener("keydown",M),()=>{document.body.style.overflow=_,window.removeEventListener("keydown",M),D!=null&&D.isConnected&&D.focus()}},[t]),p.useEffect(()=>{S||g.length===0||y(g[0].path)},[g,S]),!t)return null;function C(_){w(D=>{const M=new Set(D);return M.has(_)?M.delete(_):M.add(_),M})}function E(_){return _?o.jsx("span",{className:`code-browser-change is-${_}`,children:a(`codeBrowser.change.${_}`)}):null}function N(_,D,M){return R5t(_,D===0).map(P=>{const L=M?`${M}/${P.name}`:P.name;if(!(P.children.size>0&&P.path===void 0)&&P.path){const z=b.get(P.path);return o.jsxs("button",{type:"button",className:`code-browser-file${v===P.path?" is-active":""}`,style:{paddingLeft:`${12+D*16}px`},onClick:()=>y(P.path??null),title:P.path,"aria-pressed":v===P.path,children:[o.jsx(h3,{}),o.jsx("span",{children:P.name}),E(z)]},L)}const I=x.has(L);return o.jsxs("div",{children:[o.jsxs("button",{type:"button",className:"code-browser-folder",style:{paddingLeft:`${10+D*16}px`},onClick:()=>C(L),"aria-expanded":!I,children:[o.jsx(C5t,{className:I?"":"is-open"}),o.jsx(E5t,{}),o.jsx("span",{children:P.name})]}),!I&&N(P,D+1,L)]},L)})}function A(_){!S||s||i({...e,files:e.files.map(D=>D.path===S.path?{...D,content:_}:D)})}const j=f==="light"?"dark":"light",T=a(s?"codeBrowser.noChanges":"codeBrowser.chooseFile");return Jn.createPortal(o.jsx("div",{className:"code-browser-backdrop",onMouseDown:_=>{_.target===_.currentTarget&&n()},children:o.jsxs("section",{ref:c,className:`code-browser-dialog is-${f}`,role:"dialog","aria-modal":"true","aria-labelledby":l,children:[o.jsxs("header",{className:"code-browser-head",children:[o.jsxs("div",{className:"code-browser-title-wrap",children:[o.jsx("span",{className:"code-browser-title-icon",children:o.jsx(y5e,{})}),o.jsxs("div",{children:[o.jsx("h2",{id:l,children:a(s?"codeBrowser.compareTitle":"codeBrowser.workspaceTitle")}),o.jsx("p",{title:e.name,children:e.name||a("codeBrowser.projectFallback")})]})]}),o.jsxs("div",{className:"code-browser-head-actions",children:[o.jsx("button",{type:"button",className:"code-browser-icon-button",onClick:()=>h(j),"aria-label":a("codeBrowser.switchTheme"),title:a("codeBrowser.switchThemeTitle",{theme:a(`codeBrowser.themes.${j}`)}),children:f==="light"?o.jsx(A5t,{}):o.jsx(T5t,{})}),o.jsx("button",{ref:u,type:"button",className:"code-browser-icon-button",onClick:n,"aria-label":a("codeBrowser.closeWorkspace"),title:a("codeBrowser.close"),children:o.jsx(bD,{})})]})]}),o.jsxs("div",{className:"code-browser-workspace",children:[o.jsxs("aside",{className:"code-browser-sidebar","aria-label":a(s?"codeBrowser.changedFiles":"codeBrowser.projectFiles"),children:[o.jsxs("div",{className:"code-browser-sidebar-head",children:[o.jsx("span",{children:a(s?"codeBrowser.changes":"codeBrowser.files")}),o.jsx("span",{children:g.length})]}),o.jsx("div",{className:"code-browser-tree",children:g.length>0?N(O,0,""):o.jsx("div",{className:"code-browser-empty",children:T})})]}),o.jsxs("main",{className:"code-browser-main",children:[o.jsx("div",{className:"code-browser-tabs",role:"tablist","aria-label":a("codeBrowser.openFiles"),children:S?o.jsxs("div",{className:"code-browser-tab",role:"tab","aria-selected":"true",children:[o.jsx(h3,{}),o.jsx("span",{children:S.path.split("/").pop()}),E(k==null?void 0:k.status)]}):null}),o.jsxs("div",{className:"code-browser-path",children:[o.jsx(h3,{}),o.jsx("span",{children:(S==null?void 0:S.path)??a("codeBrowser.noFileSelected")})]}),s?o.jsxs("div",{className:"code-browser-diff-labels","aria-label":a("codeBrowser.comparisonDirection"),children:[o.jsx("span",{children:s.baseLabel??a("codeBrowser.before")}),o.jsx("span",{children:s.targetLabel??a("codeBrowser.after")})]}):null,o.jsx("div",{className:"code-browser-editor",children:S?o.jsx(p.Suspense,{fallback:o.jsx("div",{className:"code-browser-empty",children:a("codeBrowser.loadingEditor")}),children:k?o.jsx(j5t,{before:k.before,after:k.after,path:k.path,theme:f}):o.jsx(_5t,{value:S.content,path:S.path,onChange:A,readOnly:r,theme:f})}):o.jsx("div",{className:"code-browser-empty",children:T})}),o.jsxs("footer",{className:"code-browser-statusbar",children:[o.jsx("span",{children:s?a("codeBrowser.changedFileCount",{count:m.length}):a("codeBrowser.fileCount",{count:e.files.length})}),o.jsx("span",{children:S?a("codeBrowser.lineCount",{count:P5t(S.content)}):"UTF-8"})]})]})]})]})}),document.body)}function D5t({project:e,onChange:t,className:n="",label:i}){const{t:r}=_e("workspaceTools"),[s,a]=p.useState(!1),l=i??r("codeBrowser.viewSource");return o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",className:`code-browser-trigger ${n}`.trim(),onClick:()=>a(!0),"aria-label":r("codeBrowser.viewSourceAria"),title:l,children:[o.jsx(y5e,{}),o.jsx("span",{children:l})]}),o.jsx(pw,{project:e,open:s,onClose:()=>a(!1),onChange:t})]})}const w5e="send_a2ui_json_to_client",M5t=28,L5t=3e3;function $5t(e,t,n){let i=t;for(let r=0;r65535?2:1}return i}function F5t(e){return e<=4?1:Math.min(18,Math.max(2,Math.ceil(e/6)))}function O5e(e,t,n,i){const[r,s]=p.useState(()=>t?"":e),a=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=a.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&&(a.current=e,s(e));return}if(f===e||c.current!==null)return;const m=g=>{const b=l.current,v=a.current;if(!b.startsWith(v)){a.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 B5t(){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:o.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 U5t(){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("path",{d:"m4.5 7 1.8 1.8L9.5 5.5"}),o.jsx("path",{d:"M12 7h7.5"}),o.jsx("path",{d:"m4.5 13 1.8 1.8 3.2-3.3"}),o.jsx("path",{d:"M12 13h7.5"}),o.jsx("path",{d:"M5 19h4"}),o.jsx("path",{d:"M12 19h7.5"})]})}function Q5t(){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("path",{d:"M5 5v7.25A3.75 3.75 0 0 0 8.75 16H19"}),o.jsx("path",{d:"m15.5 12.5 3.5 3.5-3.5 3.5"})]})}function z5t({activity:e}){const{t}=_e("conversation"),n=[["Agent Session",e.agentSessionId],["Sandbox Session",e.sandboxSessionId],["Codex Thread",e.threadId]].filter(i=>!!i[1]);return n.length?o.jsx("dl",{className:"codex-sandbox-run__identity","aria-label":t("blocks.sandboxIdentity"),children:n.map(([i,r])=>o.jsxs("div",{children:[o.jsx("dt",{children:i}),o.jsx("dd",{title:r,children:r})]},i))}):null}function V5t(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 k5e({text:e,done:t,answerStarted:n=!1,streaming:i=!1,onStreamFrame:r}){const{t:s}=_e("conversation"),[a,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(` @@ -714,7 +714,7 @@ ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.pus `)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(` `,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(t){var i;const n=t.items[t.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,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.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)t.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(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)){mR(s,n.start),s.push(this.sourceToken),t.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=t.indent){const r=!this.onKeyLine&&this.indent===t.indent,s=r&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind";let a=[];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&&(a=n.sep.splice(l[1]))}switch(this.type){case"anchor":case"tag":s||n.value?(a.push(this.sourceToken),t.items.push({start:a}),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?(a.push(this.sourceToken),t.items.push({start:a,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(cm(n.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:null,sep:[this.sourceToken]}]});else if(cLe(n.key)&&!cm(n.sep,"newline")){const l=K0(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 a.length>0?n.sep=n.sep.concat(a,this.sourceToken):n.sep.push(this.sourceToken);else if(cm(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{const l=K0(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:a,key:null,sep:[this.sourceToken]}):cm(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:a,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&&!cm(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:a});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)){mR(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||cm(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=OA(i),s=K0(r);jne(t);const a=t.end.splice(1,t.end.length);a.push(this.sourceToken);const l={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:s,key:t,sep:a}]};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=OA(t),i=K0(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=OA(t),i=K0(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 u3t(e){const t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new l3t||null,prettyErrors:t}}function uLe(e,t={}){const{lineCounter:n,prettyErrors:i}=u3t(t),r=new c3t(n==null?void 0:n.addNewLine),s=new i3t(t);let a=null;for(const l of s.compose(r.parse(e),!0,e.length))if(!a)a=l;else if(a.options.logLevel!=="silent"){a.errors.push(new ck(l.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return i&&n&&(a.errors.forEach(Ene(e,n)),a.warnings.forEach(Ene(e,n))),a}function d3t(e,t,n){let i;const r=uLe(e,n);if(!r)return null;if(r.warnings.forEach(s=>P5e(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 CD(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 lT(e)&&!i?e.toString(n):new fT(e,i,n).toString(n)}const dLe=1024;let f3t=0,Lu=class{constructor(t,n){this.from=t,this.to=n}};class Kn{constructor(t={}){this.id=f3t++,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=$o.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 bx{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 h3t=Object.create(null);class $o{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):h3t,i=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),r=new $o(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 a=n[s<0?i.name:r[s]];if(a)return a}}}}$o.none=new $o("",Object.create(null),0,8);class h1{constructor(t){this.types=t;for(let n=0;n0;for(let c=this.cursor(a|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:eH($o.none,this.children,this.positions,0,this.children.length,0,this.length,(n,i,r)=>new Ei(this.type,n,i,r,this.propValues),t.makeTree||((n,i,r)=>new Ei($o.none,n,i,r)))}static build(t){return b3t(t)}}Ei.empty=new Ei($o.none,[],[],0);class ZV{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 ZV(this.buffer,this.index)}}class gg{constructor(t,n,i){this.buffer=t,this.length=n,this.set=i}get type(){return $o.none}toString(){let t=[];for(let n=0;n0));c=a[c+3]);return l}slice(t,n,i){let r=this.buffer,s=new Uint16Array(n-t),a=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 TE(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]+a.from,h;if(!(!(s&cr.EnterBracketed&&d instanceof Ei&&(h=bx.get(d))&&!h.overlay&&h.bracketed&&i>=f&&i<=f+d.length)&&!fLe(r,i,f,f+d.length))){if(d instanceof gg){if(s&cr.ExcludeBuffers)continue;let m=d.findChild(0,d.buffer.length,n,i-f,r);if(m>-1)return new Sf(new p3t(a,d,t,f),null,m)}else if(s&cr.IncludeAnonymous||!d.type.isAnonymous||JV(d)){let m;if(!(s&cr.IgnoreMounts)&&(m=bx.get(d))&&!m.overlay)return new ll(m.tree,f,t,a);let g=new ll(d,f,t,a);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||!a.type.isAnonymous||(a.index>=0?t=a.index+n:t=n<0?-1:a._parent._tree.children.length,a=a._parent,!a))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=bx.get(this._tree))&&r.overlay){let s=t-this.from,a=i&cr.EnterBracketed&&r.bracketed;for(let{from:l,to:c}of r.overlay)if((n>0||a?l<=s:l=s:c>s))return new ll(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 Rne(e,t,n,i){let r=e.cursor(),s=[];if(!r.firstChild())return s;if(n!=null){for(let a=!1;!a;)if(a=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 H8(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 p3t{constructor(t,n,i,r){this.parent=t,this.buffer=n,this.index=i,this.start=r}}class Sf extends hLe{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 Sf(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 Sf(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 Sf(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 Sf(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 a=i.buffer[this.index+1];t.push(i.slice(r,s,a)),n.push(0)}return new Ei(this.type,t,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function pLe(e){if(!e.length)return null;let t=0,n=e[0];for(let s=1;sn.from||a.to=t){let l=new ll(a.tree,a.overlay[0].from+s.from,-1,s);(r||(r=[i])).push(TE(l,t,n,!1))}}return r?pLe(r):i}class gR{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 ll)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 ll?(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,a=t<0?-1:i._tree.children.length;s!=a;s+=t){let l=i._tree.children[s];if(this.mode&cr.IncludeAnonymous||l instanceof gg||!l.type.isAnonymous||JV(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 a=t;a;a=a._parent)if(a.index==r){if(r==this.index)return a;n=a,i=s+1;break e}r=this.stack[--s]}for(let r=i;r=0;s--){if(s<0)return H8(this._tree,t,r);let a=i[n.buffer[this.stack[s]]];if(!a.isAnonymous){if(t[r]&&t[r]!=a.name)return!1;r--}}return!0}}function JV(e){return e.children.some(t=>t instanceof gg||!t.type.isAnonymous||JV(t))}function b3t(e){var t;let{buffer:n,nodeSet:i,maxBufferLength:r=dLe,reused:s=[],minRepeatType:a=i.types.length}=e,l=Array.isArray(n)?new ZV(n,n.length):n,c=i.types,u=0,d=0;function f(S,k,C,E,N,A){let{id:j,start:T,end:R,size:_}=l,D=d,M=u;if(_<0)if(l.next(),_==-1){let z=s[j];C.push(z),E.push(T-S);return}else if(_==-3){u=j;return}else if(_==-4){d=j;return}else throw new RangeError(`Unrecognized record size: ${_}`);let P=c[j],L,F,I=T-S;if(R-T<=r&&(F=v(l.pos-k,N))){let z=new Uint16Array(F.size-F.skip),K=l.pos-F.size,B=z.length;for(;l.pos>K;)B=y(F.start,z,B);L=new gg(z,R-F.start,i),I=F.start-S}else{let z=l.pos-_;l.next();let K=[],B=[],W=j>=a?j:-1,H=0,X=R;for(;l.pos>z;)W>=0&&l.id==W&&l.size>=0?(l.end<=X-r&&(g(K,B,T,H,l.end,X,W,D,M),H=K.length,X=l.end),l.next()):A>2500?h(T,z,K,B):f(T,z,K,B,W,A+1);if(W>=0&&H>0&&H-1&&H>0){let ie=m(P,M);L=eH(P,K,B,0,K.length,0,R-T,ie,ie)}else L=b(P,K,B,R-T,D-R,M)}C.push(L),E.push(I)}function h(S,k,C,E){let N=[],A=0,j=-1;for(;l.pos>k;){let{id:T,start:R,end:_,size:D}=l;if(D>4)l.next();else{if(j>-1&&R=0;_-=3)T[D++]=N[_],T[D++]=N[_+1]-R,T[D++]=N[_+2]-R,T[D++]=D;C.push(new gg(T,N[2]-R,i)),E.push(R-S)}}function m(S,k){return(C,E,N)=>{let A=0,j=C.length-1,T,R;if(j>=0&&(T=C[j])instanceof Ei){if(!j&&T.type==S&&T.length==N)return T;(R=T.prop(Kn.lookAhead))&&(A=E[j]+T.length+R)}return b(S,C,E,N,A,k)}}function g(S,k,C,E,N,A,j,T,R){let _=[],D=[];for(;S.length>E;)_.push(S.pop()),D.push(k.pop()+C-N);S.push(b(i.types[j],_,D,A-N,T-A,R)),k.push(N-C)}function b(S,k,C,E,N,A,j){if(A){let T=[Kn.contextHash,A];j=j?[T].concat(j):[T]}if(N>25){let T=[Kn.lookAhead,N];j=j?[T].concat(j):[T]}return new Ei(S,k,C,E,j)}function v(S,k){let C=l.fork(),E=0,N=0,A=0,j=C.end-r,T={size:0,start:0,skip:0};e:for(let R=C.pos-S;C.pos>R;){let _=C.size;if(C.id==k&&_>=0){T.size=E,T.start=N,T.skip=A,A+=4,E+=4,C.next();continue}let D=C.pos-_;if(_<0||D=a?4:0,P=C.start;for(C.next();C.pos>D;){if(C.size<0)if(C.size==-3||C.size==-4)M+=4;else break e;else C.id>=a&&(M+=4);C.next()}N=P,E+=_,A+=M}return(k<0||E==S)&&(T.size=E,T.start=N,T.skip=A),T.size>4?T:void 0}function y(S,k,C){let{id:E,start:N,end:A,size:j}=l;if(l.next(),j>=0&&E4){let R=l.pos-(j-4);for(;l.pos>R;)C=y(S,k,C)}k[--C]=T,k[--C]=A-S,k[--C]=N-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 Ei(c[e.topID],x.reverse(),w.reverse(),O)}const Ine=new WeakMap;function pj(e,t){if(!e.isAnonymous||t instanceof gg||t.type!=e)return 1;let n=Ine.get(t);if(n==null){n=1;for(let i of t.children){if(i.type!=e||!(i instanceof Ei)){n=1;break}n+=pj(e,i)}Ine.set(t,n)}return n}function eH(e,t,n,i,r,s,a,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(eH(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,a)}class tH{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 Sf?this.setBuffer(t.context.buffer,t.index,n):t instanceof ll&&this.map.set(t.tree,n)}get(t){return t instanceof Sf?this.getBuffer(t.context.buffer,t.index):t instanceof ll?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 ep{constructor(t,n,i,r,s=!1,a=!1){this.from=t,this.to=n,this.tree=i,this.offset=r,this.open=(s?1:0)|(a?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 ep(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,a=t.length?t[0]:null;for(let l=0,c=0,u=0;;l++){let d=l=i)for(;a&&a.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 ep(m,g,h.tree,h.offset+u,l>0,!!d)}if(h&&r.push(h),a.to>f)break;a=snew Lu(r.from,r.to)):[new Lu(0,0)]:[new Lu(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 y3t{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 mLe(e){return(t,n,i,r)=>new x3t(t,e,n,i,r)}class Pne{constructor(t,n,i,r,s,a){this.parser=t,this.parse=n,this.overlay=i,this.bracketed=r,this.target=s,this.from=a}}function Dne(e){if(!e.length||e.some(t=>t.from>=t.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(e))}class v3t{constructor(t,n,i,r,s,a,l,c){this.parser=t,this.predicate=n,this.mounts=i,this.index=r,this.start=s,this.bracketed=a,this.target=l,this.prev=c,this.depth=0,this.ranges=[]}}const q8=new Kn({perNode:!0});class x3t{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 Ei(i.type,i.children,i.positions,i.length,i.propValues.concat([[q8,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 bx(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&&(a=w3t(i.ranges,r.from,r.to)))l=a!=2;else if(!r.type.isAnonymous&&(s=this.nest(r,this.input))&&(r.fromnew Lu(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 Lu(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=$ne(this.ranges,n.ranges);u.length&&(Dne(u),this.inner.splice(n.index,0,new Pne(n.parser,n.parser.startParse(this.input,Fne(n.mounts,u),u),n.ranges.map(d=>new Lu(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 w3t(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 Mne(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 Ei)n=n.children[0];else break}return!1}}let k3t=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(q8))!==null&&n!==void 0?n:i.to,this.inner=new Lne(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(q8))!==null&&t!==void 0?t:n.to,this.inner=new Lne(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 a=(i=s.tree)===null||i===void 0?void 0:i.prop(Kn.mounted);if(a&&a.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:a})}}}return r}};function $ne(e,t){let n=null,i=t;for(let r=1,s=0;r=l)break;c.to<=a||(n||(i=n=t.slice()),c.froml&&n.splice(s+1,0,new Lu(l,c.to))):c.to>l?n[s--]=new Lu(l,c.to):n.splice(s--,1))}}return i}function S3t(e,t,n,i){let r=0,s=0,a=!1,l=!1,c=-1e9,u=[];for(;;){let d=r==e.length?1e9:a?e[r].to:e[r].from,f=s==t.length?1e9:l?t[s].to:t[s].from;if(a!=l){let h=Math.max(c,n),m=Math.min(d,f,i);hnew Lu(h.from+i,h.to+i)),f=S3t(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 ep(m,b,r.tree,-a,s.from>=m||s.openStart,s.to<=b||s.openEnd)),g)break;m=f[h].to}}else n.push(new ep(c,u,r.tree,-a,s.from>=a||s.openStart,s.to<=l||s.openEnd))}return n}let W8=[],gLe=[];(()=>{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=gLe[i])t=i+1;else return!0;if(t==n)return!1}}function Bne(e){return e>=127462&&e<=127487}const Une=8205;function C3t(e,t,n=!0,i=!0){return(n?bLe:T3t)(e,t,i)}function bLe(e,t,n){if(t==e.length)return t;t&&yLe(e.charCodeAt(t))&&vLe(e.charCodeAt(t-1))&&t--;let i=x3(e,t);for(t+=Qne(i);t=0&&Bne(x3(e,a));)s++,a-=2;if(s%2==0)break;t+=2}else break}return t}function T3t(e,t,n){for(;t>1;){let i=bLe(e,t-2,n);if(i=56320&&e<57344}function vLe(e){return e>=55296&&e<56320}function Qne(e){return e<65536?1:2}let sr=class xLe{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]=bw(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),mf.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]=bw(this,t,n);let i=[];return this.decompose(t,n,i,0),mf.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 aS(this),s=new aS(t);for(let a=n,l=n;;){if(r.next(a),s.next(a),a=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 aS(this,t)}iterRange(t,n=this.length){return new wLe(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 OLe(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]?xLe.empty:t.length<=32?new uo(t):mf.from(uo.split(t,[]))}};class uo extends sr{constructor(t,n=A3t(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 a=this.text[s],l=r+a.length;if((n?i:l)>=t)return new _3t(r,l,i,a);r=l+1,i++}}decompose(t,n,i,r){let s=t<=0&&n>=this.length?this:new uo(zne(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(r&1){let a=i.pop(),l=mj(s.text,a.text.slice(),0,s.length);if(l.length<=32)i.push(new uo(l,a.length+s.length));else{let c=l.length>>1;i.push(new uo(l.slice(0,c)),new uo(l.slice(c)))}}else i.push(s)}replace(t,n,i){if(!(i instanceof uo))return super.replace(t,n,i);[t,n]=bw(this,t,n);let r=mj(this.text,mj(i.text,zne(this.text,0,t)),n),s=this.length+i.length-(n-t);return r.length<=32?new uo(r,s):mf.from(uo.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=OA(t),i=K0(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=OA(t),i=K0(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 u3t(e){const t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new l3t||null,prettyErrors:t}}function uLe(e,t={}){const{lineCounter:n,prettyErrors:i}=u3t(t),r=new c3t(n==null?void 0:n.addNewLine),s=new i3t(t);let a=null;for(const l of s.compose(r.parse(e),!0,e.length))if(!a)a=l;else if(a.options.logLevel!=="silent"){a.errors.push(new ck(l.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return i&&n&&(a.errors.forEach(Ene(e,n)),a.warnings.forEach(Ene(e,n))),a}function d3t(e,t,n){let i;const r=uLe(e,n);if(!r)return null;if(r.warnings.forEach(s=>P5e(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 CD(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 lT(e)&&!i?e.toString(n):new fT(e,i,n).toString(n)}const dLe=1024;let f3t=0,Lu=class{constructor(t,n){this.from=t,this.to=n}};class Kn{constructor(t={}){this.id=f3t++,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=$o.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 bx{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 h3t=Object.create(null);class $o{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):h3t,i=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),r=new $o(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 a=n[s<0?i.name:r[s]];if(a)return a}}}}$o.none=new $o("",Object.create(null),0,8);class h1{constructor(t){this.types=t;for(let n=0;n0;for(let c=this.cursor(a|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:eH($o.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($o.none,n,i,r)))}static build(t){return b3t(t)}}Ci.empty=new Ci($o.none,[],[],0);class ZV{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 ZV(this.buffer,this.index)}}class gg{constructor(t,n,i){this.buffer=t,this.length=n,this.set=i}get type(){return $o.none}toString(){let t=[];for(let n=0;n0));c=a[c+3]);return l}slice(t,n,i){let r=this.buffer,s=new Uint16Array(n-t),a=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 TE(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]+a.from,h;if(!(!(s&cr.EnterBracketed&&d instanceof Ci&&(h=bx.get(d))&&!h.overlay&&h.bracketed&&i>=f&&i<=f+d.length)&&!fLe(r,i,f,f+d.length))){if(d instanceof gg){if(s&cr.ExcludeBuffers)continue;let m=d.findChild(0,d.buffer.length,n,i-f,r);if(m>-1)return new Sf(new p3t(a,d,t,f),null,m)}else if(s&cr.IncludeAnonymous||!d.type.isAnonymous||JV(d)){let m;if(!(s&cr.IgnoreMounts)&&(m=bx.get(d))&&!m.overlay)return new ll(m.tree,f,t,a);let g=new ll(d,f,t,a);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||!a.type.isAnonymous||(a.index>=0?t=a.index+n:t=n<0?-1:a._parent._tree.children.length,a=a._parent,!a))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=bx.get(this._tree))&&r.overlay){let s=t-this.from,a=i&cr.EnterBracketed&&r.bracketed;for(let{from:l,to:c}of r.overlay)if((n>0||a?l<=s:l=s:c>s))return new ll(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 Rne(e,t,n,i){let r=e.cursor(),s=[];if(!r.firstChild())return s;if(n!=null){for(let a=!1;!a;)if(a=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 H8(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 p3t{constructor(t,n,i,r){this.parent=t,this.buffer=n,this.index=i,this.start=r}}class Sf extends hLe{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 Sf(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 Sf(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 Sf(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 Sf(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 a=i.buffer[this.index+1];t.push(i.slice(r,s,a)),n.push(0)}return new Ci(this.type,t,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function pLe(e){if(!e.length)return null;let t=0,n=e[0];for(let s=1;sn.from||a.to=t){let l=new ll(a.tree,a.overlay[0].from+s.from,-1,s);(r||(r=[i])).push(TE(l,t,n,!1))}}return r?pLe(r):i}class gR{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 ll)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 ll?(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,a=t<0?-1:i._tree.children.length;s!=a;s+=t){let l=i._tree.children[s];if(this.mode&cr.IncludeAnonymous||l instanceof gg||!l.type.isAnonymous||JV(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 a=t;a;a=a._parent)if(a.index==r){if(r==this.index)return a;n=a,i=s+1;break e}r=this.stack[--s]}for(let r=i;r=0;s--){if(s<0)return H8(this._tree,t,r);let a=i[n.buffer[this.stack[s]]];if(!a.isAnonymous){if(t[r]&&t[r]!=a.name)return!1;r--}}return!0}}function JV(e){return e.children.some(t=>t instanceof gg||!t.type.isAnonymous||JV(t))}function b3t(e){var t;let{buffer:n,nodeSet:i,maxBufferLength:r=dLe,reused:s=[],minRepeatType:a=i.types.length}=e,l=Array.isArray(n)?new ZV(n,n.length):n,c=i.types,u=0,d=0;function f(S,k,C,E,N,A){let{id:j,start:T,end:R,size:_}=l,D=d,M=u;if(_<0)if(l.next(),_==-1){let z=s[j];C.push(z),E.push(T-S);return}else if(_==-3){u=j;return}else if(_==-4){d=j;return}else throw new RangeError(`Unrecognized record size: ${_}`);let P=c[j],L,F,I=T-S;if(R-T<=r&&(F=v(l.pos-k,N))){let z=new Uint16Array(F.size-F.skip),K=l.pos-F.size,B=z.length;for(;l.pos>K;)B=y(F.start,z,B);L=new gg(z,R-F.start,i),I=F.start-S}else{let z=l.pos-_;l.next();let K=[],B=[],W=j>=a?j:-1,H=0,X=R;for(;l.pos>z;)W>=0&&l.id==W&&l.size>=0?(l.end<=X-r&&(g(K,B,T,H,l.end,X,W,D,M),H=K.length,X=l.end),l.next()):A>2500?h(T,z,K,B):f(T,z,K,B,W,A+1);if(W>=0&&H>0&&H-1&&H>0){let ie=m(P,M);L=eH(P,K,B,0,K.length,0,R-T,ie,ie)}else L=b(P,K,B,R-T,D-R,M)}C.push(L),E.push(I)}function h(S,k,C,E){let N=[],A=0,j=-1;for(;l.pos>k;){let{id:T,start:R,end:_,size:D}=l;if(D>4)l.next();else{if(j>-1&&R=0;_-=3)T[D++]=N[_],T[D++]=N[_+1]-R,T[D++]=N[_+2]-R,T[D++]=D;C.push(new gg(T,N[2]-R,i)),E.push(R-S)}}function m(S,k){return(C,E,N)=>{let A=0,j=C.length-1,T,R;if(j>=0&&(T=C[j])instanceof Ci){if(!j&&T.type==S&&T.length==N)return T;(R=T.prop(Kn.lookAhead))&&(A=E[j]+T.length+R)}return b(S,C,E,N,A,k)}}function g(S,k,C,E,N,A,j,T,R){let _=[],D=[];for(;S.length>E;)_.push(S.pop()),D.push(k.pop()+C-N);S.push(b(i.types[j],_,D,A-N,T-A,R)),k.push(N-C)}function b(S,k,C,E,N,A,j){if(A){let T=[Kn.contextHash,A];j=j?[T].concat(j):[T]}if(N>25){let T=[Kn.lookAhead,N];j=j?[T].concat(j):[T]}return new Ci(S,k,C,E,j)}function v(S,k){let C=l.fork(),E=0,N=0,A=0,j=C.end-r,T={size:0,start:0,skip:0};e:for(let R=C.pos-S;C.pos>R;){let _=C.size;if(C.id==k&&_>=0){T.size=E,T.start=N,T.skip=A,A+=4,E+=4,C.next();continue}let D=C.pos-_;if(_<0||D=a?4:0,P=C.start;for(C.next();C.pos>D;){if(C.size<0)if(C.size==-3||C.size==-4)M+=4;else break e;else C.id>=a&&(M+=4);C.next()}N=P,E+=_,A+=M}return(k<0||E==S)&&(T.size=E,T.start=N,T.skip=A),T.size>4?T:void 0}function y(S,k,C){let{id:E,start:N,end:A,size:j}=l;if(l.next(),j>=0&&E4){let R=l.pos-(j-4);for(;l.pos>R;)C=y(S,k,C)}k[--C]=T,k[--C]=A-S,k[--C]=N-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 Ine=new WeakMap;function pj(e,t){if(!e.isAnonymous||t instanceof gg||t.type!=e)return 1;let n=Ine.get(t);if(n==null){n=1;for(let i of t.children){if(i.type!=e||!(i instanceof Ci)){n=1;break}n+=pj(e,i)}Ine.set(t,n)}return n}function eH(e,t,n,i,r,s,a,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(eH(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,a)}class tH{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 Sf?this.setBuffer(t.context.buffer,t.index,n):t instanceof ll&&this.map.set(t.tree,n)}get(t){return t instanceof Sf?this.getBuffer(t.context.buffer,t.index):t instanceof ll?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 ep{constructor(t,n,i,r,s=!1,a=!1){this.from=t,this.to=n,this.tree=i,this.offset=r,this.open=(s?1:0)|(a?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 ep(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,a=t.length?t[0]:null;for(let l=0,c=0,u=0;;l++){let d=l=i)for(;a&&a.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 ep(m,g,h.tree,h.offset+u,l>0,!!d)}if(h&&r.push(h),a.to>f)break;a=snew Lu(r.from,r.to)):[new Lu(0,0)]:[new Lu(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 y3t{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 mLe(e){return(t,n,i,r)=>new x3t(t,e,n,i,r)}class Pne{constructor(t,n,i,r,s,a){this.parser=t,this.parse=n,this.overlay=i,this.bracketed=r,this.target=s,this.from=a}}function Dne(e){if(!e.length||e.some(t=>t.from>=t.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(e))}class v3t{constructor(t,n,i,r,s,a,l,c){this.parser=t,this.predicate=n,this.mounts=i,this.index=r,this.start=s,this.bracketed=a,this.target=l,this.prev=c,this.depth=0,this.ranges=[]}}const q8=new Kn({perNode:!0});class x3t{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([[q8,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 bx(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&&(a=w3t(i.ranges,r.from,r.to)))l=a!=2;else if(!r.type.isAnonymous&&(s=this.nest(r,this.input))&&(r.fromnew Lu(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 Lu(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=$ne(this.ranges,n.ranges);u.length&&(Dne(u),this.inner.splice(n.index,0,new Pne(n.parser,n.parser.startParse(this.input,Fne(n.mounts,u),u),n.ranges.map(d=>new Lu(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 w3t(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 Mne(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 k3t=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(q8))!==null&&n!==void 0?n:i.to,this.inner=new Lne(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(q8))!==null&&t!==void 0?t:n.to,this.inner=new Lne(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 a=(i=s.tree)===null||i===void 0?void 0:i.prop(Kn.mounted);if(a&&a.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:a})}}}return r}};function $ne(e,t){let n=null,i=t;for(let r=1,s=0;r=l)break;c.to<=a||(n||(i=n=t.slice()),c.froml&&n.splice(s+1,0,new Lu(l,c.to))):c.to>l?n[s--]=new Lu(l,c.to):n.splice(s--,1))}}return i}function S3t(e,t,n,i){let r=0,s=0,a=!1,l=!1,c=-1e9,u=[];for(;;){let d=r==e.length?1e9:a?e[r].to:e[r].from,f=s==t.length?1e9:l?t[s].to:t[s].from;if(a!=l){let h=Math.max(c,n),m=Math.min(d,f,i);hnew Lu(h.from+i,h.to+i)),f=S3t(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 ep(m,b,r.tree,-a,s.from>=m||s.openStart,s.to<=b||s.openEnd)),g)break;m=f[h].to}}else n.push(new ep(c,u,r.tree,-a,s.from>=a||s.openStart,s.to<=l||s.openEnd))}return n}let W8=[],gLe=[];(()=>{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=gLe[i])t=i+1;else return!0;if(t==n)return!1}}function Bne(e){return e>=127462&&e<=127487}const Une=8205;function C3t(e,t,n=!0,i=!0){return(n?bLe:T3t)(e,t,i)}function bLe(e,t,n){if(t==e.length)return t;t&&yLe(e.charCodeAt(t))&&vLe(e.charCodeAt(t-1))&&t--;let i=x3(e,t);for(t+=Qne(i);t=0&&Bne(x3(e,a));)s++,a-=2;if(s%2==0)break;t+=2}else break}return t}function T3t(e,t,n){for(;t>1;){let i=bLe(e,t-2,n);if(i=56320&&e<57344}function vLe(e){return e>=55296&&e<56320}function Qne(e){return e<65536?1:2}let sr=class xLe{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]=bw(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),mf.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]=bw(this,t,n);let i=[];return this.decompose(t,n,i,0),mf.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 aS(this),s=new aS(t);for(let a=n,l=n;;){if(r.next(a),s.next(a),a=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 aS(this,t)}iterRange(t,n=this.length){return new wLe(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 OLe(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]?xLe.empty:t.length<=32?new uo(t):mf.from(uo.split(t,[]))}};class uo extends sr{constructor(t,n=A3t(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 a=this.text[s],l=r+a.length;if((n?i:l)>=t)return new _3t(r,l,i,a);r=l+1,i++}}decompose(t,n,i,r){let s=t<=0&&n>=this.length?this:new uo(zne(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(r&1){let a=i.pop(),l=mj(s.text,a.text.slice(),0,s.length);if(l.length<=32)i.push(new uo(l,a.length+s.length));else{let c=l.length>>1;i.push(new uo(l.slice(0,c)),new uo(l.slice(c)))}}else i.push(s)}replace(t,n,i){if(!(i instanceof uo))return super.replace(t,n,i);[t,n]=bw(this,t,n);let r=mj(this.text,mj(i.text,zne(this.text,0,t)),n),s=this.length+i.length-(n-t);return r.length<=32?new uo(r,s):mf.from(uo.split(r,[]),s)}sliceString(t,n=this.length,i=` `){[t,n]=bw(this,t,n);let r="";for(let s=0,a=0;s<=n&&at&&a&&(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 uo(i,r)),i=[],r=-1);return r>-1&&n.push(new uo(i,r)),n}}class mf 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 a=this.children[s],l=r+a.length,c=i+a.lines-1;if((n?c:l)>=t)return a.lineInner(t,n,i,r);r=l+1,i=c+1}}decompose(t,n,i,r){for(let s=0,a=0;a<=n&&s=a){let u=r&((a<=t?1:0)|(c>=n?2:0));a>=t&&c<=n&&!u?i.push(l):l.decompose(t-a,n-a,i,u)}a=c+1}}replace(t,n,i){if([t,n]=bw(this,t,n),i.lines=s&&n<=l){let c=a.replace(t-s,n-s,i),u=this.lines-a.lines+c.lines;if(c.lines>4&&c.lines>u>>6){let d=this.children.slice();return d[r]=c,new mf(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]=bw(this,t,n);let r="";for(let s=0,a=0;st&&s&&(r+=i),ta&&(r+=l.sliceString(t-a,n-a,i)),a=c+1}return r}flatten(t){for(let n of this.children)n.flatten(t)}scanIdentical(t,n){if(!(t instanceof mf))return 0;let i=0,[r,s,a,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==a||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 uo(m,n)}let r=Math.max(32,i>>5),s=r<<1,a=r>>1,l=[],c=0,u=-1,d=[];function f(m){let g;if(m.lines>s&&m instanceof mf)for(let b of m.children)f(b);else m.lines>a&&(c>a||!c)?(h(),l.push(m)):m instanceof uo&&c&&(g=d[d.length-1])instanceof uo&&m.lines+g.lines<=32?(c+=m.lines,u+=m.length+1,d[d.length-1]=new uo(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]:mf.from(d,u)),u=-1,c=d.length=0)}for(let m of t)f(m);return h(),l.length==1?l[0]:new mf(l,n)}}sr.empty=new uo([""],0);function A3t(e){let t=-1;for(let n of e)t+=n.length+1;return t}function mj(e,t,n=0,i=1e9){for(let r=0,s=0,a=!0;s=n&&(c>i&&(l=l.slice(0,i-r)),r0?1:(t instanceof uo?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],a=s>>1,l=r instanceof uo?r.text.length:r.children.length;if(a==(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 uo){let c=r.text[a+(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[a+(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 uo?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 wLe{constructor(t,n,i){this.value="",this.done=!1,this.cursor=new aS(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 OLe{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()},aS.prototype[Symbol.iterator]=wLe.prototype[Symbol.iterator]=OLe.prototype[Symbol.iterator]=function(){return this});let _3t=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 bw(e,t,n){return t=Math.max(0,Math.min(e.length,t)),[t,Math.max(t,Math.min(e.length,n))]}function xa(e,t,n=!0,i=!0){return C3t(e,t,n,i)}function j3t(e){return e>=56320&&e<57344}function N3t(e){return e>=55296&&e<56320}function ec(e,t){let n=e.charCodeAt(t);if(!N3t(n)||t+1==e.length)return n;let i=e.charCodeAt(t+1);return j3t(i)?(n-55296<<10)+(i-56320)+65536:n}function nH(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}function gf(e){return e<65536?1:2}const K8=/\r\n?|\n/;var La=function(e){return e[e.Simple=0]="Simple",e[e.TrackDel=1]="TrackDel",e[e.TrackBefore=2]="TrackBefore",e[e.TrackAfter=3]="TrackAfter",e}(La||(La={}));class Pf{constructor(t){this.sections=t}get length(){let t=0;for(let n=0;nt)return s+(t-r);s+=l}else{if(i!=La.Simple&&u>=t&&(i==La.TrackDel&&rt||i==La.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 Pf(t)}static create(t){return new Pf(t)}}class Zo extends Pf{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 G8(this,(n,i,r,s,a)=>t=t.replace(r,r+(i-n),a),!1),t}mapDesc(t,n=!1){return X8(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]=a;let c=r>>1;for(;i.length0&&jm(i,n,s.text),s.forward(d),l+=d}let u=t[a++];for(;l>1].toJSON()))}return t}static of(t,n,i){let r=[],s=[],a=0,l=null;function c(d=!1){if(!d&&!r.length)return;ah||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||K8)):m:sr.empty,b=g.length;if(f==h&&b==0)return;fa&&rl(r,f-a,-1),rl(r,h-f,b),jm(s,r,g),a=h}}return u(t),c(!l),l}static empty(t){return new Zo(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 a!="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 jm(e,t,n){if(n.length==0)return;let i=t.length-2>>1;if(i>1])),!(n||a==e.sections.length||e.sections[a+1]<0);)l=e.sections[a++],c=e.sections[a++];t(r,u,s,d,f),r=u,s=d}}}function X8(e,t,n,i=!1){let r=[],s=i?[]:null,a=new AE(e),l=new AE(t);for(let c=-1;;){if(a.done&&l.len||l.done&&a.len)throw new Error("Mismatched change set lengths");if(a.ins==-1&&l.ins==-1){let u=Math.min(a.len,l.len);rl(r,u,-1),a.forward(u),l.forward(u)}else if(l.ins>=0&&(a.ins<0||c==a.i||a.off==0&&(l.len=0&&c=0){let u=0,d=a.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||a.ins>=0&&a.len>c)&&(l||i.length>u),s.forward2(c),a.forward(c)}}}}class AE{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 ym{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 ym(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 ym(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=>ym.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 SLe(e,t){for(let n of e.ranges)if(n.to>t)throw new RangeError("Selection points outside of document")}let iH=0;class an{constructor(t,n,i,r,s){this.combine=t,this.compareInput=n,this.compare=i,this.isStatic=r,this.id=iH++,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:rH),!!t.static,t.enables)}of(t){return new gj([],this,0,t)}compute(t,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new gj(t,this,1,n)}computeN(t,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new gj(t,this,2,n)}from(t,n){return n||(n=i=>i),this.compute([t],i=>n(i.field(t)))}}function rH(e,t){return e==t||e.length==t.length&&e.every((n,i)=>n===t[i])}class gj{constructor(t,n,i,r){this.dependencies=t,this.facet=n,this.type=i,this.value=r,this.id=iH++}dynamicSlot(t){var n;let i=this.value,r=this.facet.compareInput,s=this.id,a=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[a]=i(f),1},update(f,h){if(c&&h.docChanged||u&&(h.docChanged||h.selection)||Y8(f,d)){let m=i(f);if(l?!Vne(m,f.values[a],r):!r(m,f.values[a]))return f.values[a]=m,1}return 0},reconfigure:(f,h)=>{let m,g=h.config.address[s];if(g!=null){let b=yR(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[a]=b,0}else m=i(f);return f.values[a]=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)),a=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(SA).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],a=this.updateF(s,r);return this.compareF(s,a)?0:(i.values[n]=a,1)},reconfigure:(i,r)=>{let s=i.facet(SA),a=r.facet(SA),l;return(l=s.find(c=>c.field==this))&&l!=a.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,SA.of({field:this,create:t})]}get extension(){return this}}const Ab={lowest:4,low:3,default:2,high:1,highest:0};function wO(e){return t=>new ELe(t,e)}const jp={highest:wO(Ab.highest),high:wO(Ab.high),default:wO(Ab.default),low:wO(Ab.low),lowest:wO(Ab.lowest)};class ELe{constructor(t,n){this.inner=t,this.prec=n}get extension(){return this}}class AD{of(t){return new Z8(this,t)}reconfigure(t){return AD.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class Z8{constructor(t,n){this.compartment=t,this.inner=n}get extension(){return this}}class bR{constructor(t,n,i,r,s,a){for(this.base=t,this.compartments=n,this.dynamicSlots=i,this.address=r,this.staticValues=s,this.facets=a,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(t,n,i){let r=[],s=Object.create(null),a=new Map;for(let h of I3t(t,n,a))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,rH(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=>R3t(v,g,m))}}let f=u.map(h=>h(l));return new bR(t,a,f,l,c,s)}}function I3t(e,t,n){let i=[[],[],[],[],[]],r=new Map;function s(a,l){let c=r.get(a);if(c!=null){if(c<=l)return;let u=i[c].indexOf(a);u>-1&&i[c].splice(u,1),a instanceof Z8&&n.delete(a.compartment)}if(r.set(a,l),Array.isArray(a))for(let u of a)s(u,l);else if(a instanceof Z8){if(n.has(a.compartment))throw new RangeError("Duplicate use of compartment in extensions");let u=t.get(a.compartment)||a.inner;n.set(a.compartment,u),s(u,l)}else if(a instanceof ELe)s(a.inner,a.prec);else if(a instanceof qa)i[l].push(a),a.provides&&s(a.provides,l);else if(a instanceof gj)i[l].push(a),a.facet.extensions&&s(a.facet.extensions,Ab.default);else{let u=a.extension;if(!u)throw new Error(`Unrecognized extension value in extension set (${a}).`);if(u==a)throw new Error(`Unrecognized extension value in extension set (${a}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(u,l)}}return s(e,Ab.default),i.reduce((a,l)=>a.concat(l))}function lS(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 yR(e,t){return t&1?e.config.staticValues[t>>1]:e.values[t>>1]}const CLe=an.define(),J8=an.define({combine:e=>e.some(t=>t),static:!0}),TLe=an.define({combine:e=>e.length?e[0]:void 0,static:!0}),ALe=an.define(),_Le=an.define(),jLe=an.define(),NLe=an.define({combine:e=>e.length?e[0]:!1});class Gf{constructor(t,n){this.type=t,this.value=n}static define(){return new P3t}}class P3t{of(t){return new Gf(this,t)}}class D3t{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 D3t(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 Mo{constructor(t,n,i,r,s,a){this.startState=t,this.changes=n,this.selection=i,this.effects=r,this.annotations=s,this.scrollIntoView=a,this._doc=null,this._state=null,i&&SLe(i,n.newLength),s.some(l=>l.type==Mo.time)||(this.annotations=s.concat(Mo.time.of(Date.now())))}static create(t,n,i,r,s,a){return new Mo(t,n,i,r,s,a)}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(Mo.userEvent);return!!(n&&(n==t||n.length>t.length&&n.slice(0,t.length)==t&&n[t.length]=="."))}}Mo.time=Gf.define();Mo.userEvent=Gf.define();Mo.addToHistory=Gf.define();Mo.remote=Gf.define();function M3t(e,t){let n=[];for(let i=0,r=0;;){let s,a;if(i=e[i]))s=e[i++],a=e[i++];else if(r=0;r--){let s=i[r](e);s instanceof Mo?e=s:Array.isArray(s)&&s.length==1&&s[0]instanceof Mo?e=s[0]:e=ILe(t,yx(s),!1)}return e}function $3t(e){let t=e.startState,n=t.facet(jLe),i=e;for(let r=n.length-1;r>=0;r--){let s=n[r](e);s&&Object.keys(s).length&&(i=RLe(i,eB(t,s,e.changes.newLength),!0))}return i==e?e:Mo.create(t,e.changes,e.selection,i.effects,i.annotations,i.scrollIntoView)}const F3t=[];function yx(e){return e==null?F3t: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 B3t=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let tB;try{tB=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function U3t(e){if(tB)return tB.test(e);for(let t=0;t"€"&&(n.toUpperCase()!=n.toLowerCase()||B3t.test(n)))return!0}return!1}function Q3t(e){return t=>{if(!/\S/.test(t))return Ts.Space;if(U3t(t))return Ts.Word;for(let n=0;n-1)return Ts.Word;return Ts.Other}}class Ui{constructor(t,n,i,r,s,a){this.config=t,this.doc=n,this.selection=i,this.values=r,this.status=t.statusTemplate.slice(),this.computeSlot=s,a&&(a._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=yx(i).concat(l.value));let s;n?s=t.startState.values.slice():(n=bR.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 a=t.startState.facet(J8)?t.newSelection:t.newSelection.asSingle();new Ui(n,t.newDoc,a,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],a=yx(i.effects);for(let l=1;la.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=bR.resolve(t.extensions||[],new Map),i=t.doc instanceof sr?t.doc:sr.of((t.doc||"").split(n.staticFacet(Ui.lineSeparator)||K8)),r=t.selection?t.selection instanceof ut?t.selection:ut.single(t.selection.anchor,t.selection.head):ut.single(0);return SLe(r,i.length),n.staticFacet(J8)||(r=r.asSingle()),new Ui(n,i,r,n.dynamicSlots.map(()=>null),(s,a)=>a.create(s),null)}get tabSize(){return this.facet(Ui.tabSize)}get lineBreak(){return this.facet(Ui.lineSeparator)||` @@ -724,9 +724,9 @@ ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.pus `,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 M4t(e,t,n){let i=e.state.charCategorizer(t),r=i(n);return s=>{let a=i(s);return r==Ts.Space&&(r=a),r==a}}function L4t(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 a=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)a==null&&(a=u.left-c.left),l=s<0?u.top:u.bottom;else{let g=e.viewState.lineBlockAt(r);a==null&&(a=Math.min(c.right-c.left,e.defaultCharacterWidth*(r-g.from))),l=(s<0?g.top:g.bottom)+d}let f=c.left+a,h=e.viewState.heightOracle.textHeight>>1,m=i??h;for(let g=0;;g+=h){let b=l+(m+g)*s,v=yB(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 bf(e.state.doc.length,-1);if(u=e.elementAtHeight(c),i==null)break;if(u.type==Ua.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==Ua.Text){let f=P4t(e,r,u,a,l);return new bf(f,f==u.from?1:-1)}}if(u.type!=Ua.Text)return c<(u.top+u.bottom)/2?new bf(u.from,1):new bf(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 $4t(e,a,l,e.textDirectionAt(u.from)).scanTile(d,u.from)}class $4t{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(a.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 a=i[s]-n,l=i[s+1]-n;return DE(t.dom,a,l).getClientRects()});return r.after?new bf(i[r.i+1],-1):new bf(i[r.i],1)}scanTile(t,n){if(!t.length)return new bf(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:DE(c.dom,0,c.length)).getClientRects()}),s=t.children[r.i],a=i[r.i];return s.isText()?this.scanText(s,a):s.isComposite()?this.scanTile(s,a):r.after?new bf(i[r.i+1],-1):new bf(a,1)}}const fv="￿";class F4t{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+=fv}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 a=Js.get(r),l=r.nextSibling;if(l==n){a!=null&&a.breakAfter&&!l&&i!=this.view.contentDOM&&this.lineBreak();break}let c=Js.get(l);(a&&c?a.breakAfter:(a?a.breakAfter:xR(r))||xR(l)&&(r.nodeName!="BR"||a!=null&&a.isWidget())&&this.text.length>s)&&!U4t(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,a=1,l;if(this.lineSeparator?(s=n.indexOf(this.lineSeparator,i),a=this.lineSeparator.length):(l=r.exec(n))&&(s=l.index,a=l[0].length),this.append(n.slice(i,s<0?n.length:s)),s<0)break;if(this.lineBreak(),a>1)for(let c of this.points)c.node==t&&c.pos>this.text.length&&(c.pos-=a-1);i=s+a}}readNode(t){let n=Js.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+(B4t(t,i.node,i.offset)?n:0))}}function B4t(e,t,n){for(;;){if(!t||n-1;let{impreciseHead:s,impreciseAnchor:a}=t.docView,l=t.state.selection;if(t.state.readOnly&&n>-1)this.newSel=null;else if(n>-1&&(this.bounds=f3e(t.docView.tile,n,i,0))){let c=s||a?[]:V4t(t),u=new F4t(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||!dB(t.contentDOM,c.focusNode)?l.main.head:t.docView.posFromDOM(c.focusNode,c.focusOffset),d=a&&a.node==c.anchorNode&&a.offset==c.anchorOffset||!dB(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 f3e(e,t,n,i){if(e.isComposite()){let r=-1,s=-1,a=-1,l=-1;for(let c=0,u=i,d=i;cn)return f3e(f,t,n,u);if(h>=t&&r==-1&&(r=c,s=u),u>n&&f.dom.parentNode==e.dom){a=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:a=0?e.children[a].dom:null}}else return e.isText()?{from:i,to:i+e.length,startDOM:e.dom,endDOM:e.dom.nextSibling}:null}function h3e(e,t){let n,{newSel:i}=t,{state:r}=e,s=r.selection.main,a=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;(a===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(fv))}:(m=p3e(f,t.text,u-l,d))&&(sn.chrome&&a==13&&m.toB==m.from+2&&t.text.slice(m.from,m.toB)==fv+fv&&m.toB--,n={from:l+m.from,to:l+m.toA,insert:sr.of(t.text.slice(m.from,m.toB).split(fv))})}else i&&(!e.hasFocus&&r.facet(Ph)||SR(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 mH(e,n,i,a);if(i&&!SR(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=d3e(r.facet(gT).map(u=>u(e)),i))),e.dispatch({selection:i,scrollIntoView:l,userEvent:c}),!0}else return!1}function mH(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&&xx(e.contentDOM,"Enter",13)||(t.from==r.from-1&&t.to==r.to&&t.insert.length==0||i==8&&t.insert.lengthr.head)&&xx(e.contentDOM,"Backspace",8)||t.from==r.from&&t.to==r.to+1&&t.insert.length==0&&xx(e.contentDOM,"Delete",46)))return!0;let s=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let a,l=()=>a||(a=z4t(e,t,n));return e.state.facet(JLe).some(c=>c(e,t.from,t.to,s,l))||e.dispatch(l()),!0}function z4t(e,t,n){let i,r=e.state,s=r.selection.main,a=-1;if(t.from==t.to&&t.froms.to){let c=t.fromf(e)),u,c);t.from==d&&(a=d)}if(a>-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&&u3e(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 p3e(e,t,n,i){let r=Math.min(e.length,t.length),s=0;for(;s0&&l>0&&e.charCodeAt(a-1)==t.charCodeAt(l-1);)a--,l--;if(i=="end"){let c=Math.max(0,s-Math.min(a,l));n-=a+c-s}if(a=a?s-n:0;s-=c,l=s+(l-a),a=s}else if(l=l?s-n:0;s-=c,a=s+(a-l),l=s}return{from:s,toA:a,toB:l}}function V4t(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 lie(n,i)),(r!=n||s!=i)&&t.push(new lie(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 SR(e,t){return t.head==e.main.head&&t.anchor==e.main.anchor}class q4t{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&&l6t(t.contentDOM.ownerDocument)}handleEvent(t){!t6t(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=K4t(t),i=this.handlers,r=this.view.contentDOM;for(let s in n)if(s!="scroll"){let a=!n[s].handlers.length,l=i[s];l&&a!=!l.handlers.length&&(r.removeEventListener(s,this.handleEvent),l=null),l||r.addEventListener(s,this.handleEvent,{passive:a})}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&&g3e.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&&(m3e.some(n=>n.keyCode==t.keyCode)&&!t.ctrlKey||G4t.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)&&W4t(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 W4t(e){return e.visualViewport?e.visualViewport.height*e.visualViewport.scale/e.document.documentElement.clientHeight<.85:!1}function cie(e,t){return(n,i)=>{try{return t.call(e,i,n)}catch(r){ac(n.state,r)}}}function K4t(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,a=r&&r.plugin.domEventObservers;if(s)for(let l in s){let c=s[l];c&&n(l).handlers.push(cie(i.value,c))}if(a)for(let l in a){let c=a[l];c&&n(l).observers.push(cie(i.value,c))}}for(let i in Ld)n(i).handlers.push(Ld[i]);for(let i in Il)n(i).observers.push(Il[i]);return t}const m3e=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],G4t="dthko",g3e=[16,17,18,20,91,92,224,225],AA=6;function _A(e){return Math.max(0,e)*.7+8}function X4t(e,t){return Math.max(Math.abs(e.clientX-t.clientX),Math.abs(e.clientY-t.clientY))}class Y4t{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=FLe(t.contentDOM),this.atoms=t.state.facet(gT).map(a=>a(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)&&Z4t(t,n),this.dragging=e6t(t,n)&&v3e(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&&X4t(this.startEvent,t)<10)return;this.select(this.lastEvent=t);let n=0,i=0,r=0,s=0,a=this.view.win.innerWidth,l=this.view.win.innerHeight;this.scrollParents.x&&({left:r,right:a}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:s,bottom:l}=this.scrollParents.y.getBoundingClientRect());let c=pH(this.view);t.clientX-c.left<=r+AA?n=-_A(r-t.clientX):t.clientX+c.right>=a-AA&&(n=_A(t.clientX-a)),t.clientY-c.top<=s+AA?i=-_A(s-t.clientY):t.clientY+c.bottom>=l-AA&&(i=_A(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=d3e(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 Z4t(e,t){let n=e.state.facet(GLe);return n.length?n[0](t):sn.mac?t.metaKey:t.ctrlKey}function J4t(e,t){let n=e.state.facet(XLe);return n.length?n[0](t):sn.mac?!t.altKey:!t.ctrlKey}function e6t(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let i=IE(e.root);if(!i||i.rangeCount==0)return!0;let r=i.getRangeAt(0).getClientRects();for(let s=0;s=t.clientX&&a.top<=t.clientY&&a.bottom>=t.clientY)return!0}return!1}function t6t(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=Js.get(n))&&i.isWidget()&&!i.isHidden&&i.widget.ignoreEvent(t))return!1;return!0}const Ld=Object.create(null),Il=Object.create(null),b3e=sn.ie&&sn.ie_version<15||sn.ios&&sn.webkit_version<604;function n6t(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(),y3e(e,n.value)},50)}function ID(e,t,n){for(let i of e.facet(t))n=i(n,e);return n}function y3e(e,t){t=ID(e.state,uH,t);let{state:n}=e,i,r=1,s=n.toText(t),a=s.lines==n.selection.ranges.length;if(vB!=null&&n.selection.ranges.every(c=>c.empty)&&vB==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((a?s.line(r++).text:t)+n.lineBreak);return{changes:{from:d.from,insert:f},range:ut.cursor(u.from+f.length)}})}else a?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})}Il.scroll=e=>{let t=e.inputState;t.lastScrollTop=e.scrollDOM.scrollTop,t.lastScrollLeft=e.scrollDOM.scrollLeft,sn.ios&&!t.touchActive&&(t.lastIOSMomentumScroll=Date.now())};Il.wheel=Il.mousewheel=e=>{e.inputState.lastWheelEvent=Date.now()};Ld.keydown=(e,t)=>(e.inputState.setSelectionOrigin("select"),t.keyCode==27&&e.inputState.tabFocusMode!=0&&(e.inputState.tabFocusMode=Date.now()+2e3),!1);Il.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")};Il.touchmove=e=>{e.inputState.setSelectionOrigin("select.pointer")};Il.touchend=(e,t)=>{e.inputState.touchActive=!1};Ld.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(YLe))if(n=i(e,t),n)break;if(!n&&t.button==0&&(n=r6t(e,t)),n){let i=!e.hasFocus;e.inputState.startMouseSelection(new Y4t(e,t,n,i)),i&&e.observer.ignore(()=>{BLe(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 uie(e,t,n,i){if(i==1)return ut.cursor(t,n);if(i==2)return I4t(e.state,t,n);{let r=e.docView.lineAt(t,n),s=e.state.doc.lineAt(r?r.posAtEnd:t),a=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?(fie+1)%3:1}function r6t(e,t){let n=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),i=v3e(t),r=e.state.selection;return{update(s){s.docChanged&&(n.pos=s.changes.mapPos(n.pos),r=r.map(s.changes))},get(s,a,l){let c=e.posAndSideAtCoords({x:s.clientX,y:s.clientY},!1),u,d=uie(e,c.pos,c.assoc,i);if(n.pos!=c.pos&&!a){let f=uie(e,n.pos,n.assoc,i),h=Math.min(f.from,d.from),m=Math.max(f.to,d.to);d=h1&&(u=s6t(r,c.pos))?u:l?r.addRange(d):ut.create([d])}}}function s6t(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}Ld.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,a=s+r.length;(s>=n.to||a<=n.from)&&(n=ut.undirectionalRange(s,a))}}let{inputState:i}=e;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData("Text",ID(e.state,dH,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed="copyMove"),!1};Ld.dragend=e=>(e.inputState.draggedContent=null,!1);function pie(e,t,n,i){if(n=ID(e.state,uH,n),!n)return;let r=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:s}=e.inputState,a=i&&s&&J4t(e,t)?{from:s.from,to:s.to}:null,l={from:r,insert:n},c=e.state.changes(a?[a,l]:l);e.focus(),e.dispatch({changes:c,selection:{anchor:c.mapPos(r,-1),head:c.mapPos(r,1)},userEvent:a?"move.drop":"input.drop"}),e.inputState.draggedContent=null}Ld.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&&pie(e,t,i.filter(a=>a!=null).join(e.state.lineBreak),!1)};for(let a=0;a{/[\x00-\x08\x0e-\x1f]{2}/.test(l.result)||(i[a]=l.result),s()},l.readAsText(n[a])}return!0}else{let i=t.dataTransfer.getData("Text");if(i)return pie(e,t,i,!0),!0}return!1};Ld.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=b3e?null:t.clipboardData;return n?(y3e(e,n.getData("text/plain")||n.getData("text/uri-list")),!0):(n6t(e),!1)};function o6t(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 a6t(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 a=e.doc.lineAt(s);a.number>r&&(t.push(a.text),n.push({from:a.from,to:Math.min(e.doc.length,a.to+1)})),r=a.number}i=!0}return{text:ID(e,dH,t.join(e.lineBreak)),ranges:n,linewise:i}}let vB=null;Ld.copy=Ld.cut=(e,t)=>{if(!cS(e.contentDOM,e.observer.selectionRange))return!1;let{text:n,ranges:i,linewise:r}=a6t(e.state);if(!n&&!r)return!1;vB=r?n:null,t.type=="cut"&&!e.state.readOnly&&e.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let s=b3e?null:t.clipboardData;return s?(s.clearData(),s.setData("text/plain",n),!0):(o6t(e,n),!1)};const x3e=Gf.define();function w3e(e,t){let n=[];for(let i of e.facet(e3e)){let r=i(e,t);r&&n.push(r)}return n.length?e.update({effects:n,annotations:x3e.of(!0)}):null}function O3e(e){setTimeout(()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=w3e(e.state,t);n?e.dispatch(n):e.update([])}},10)}Il.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),O3e(e)};Il.blur=e=>{e.observer.clearSelectionRange(),O3e(e)};Il.compositionstart=Il.compositionupdate=e=>{e.observer.editContext||(e.inputState.compositionFirstChange==null&&(e.inputState.compositionFirstChange=!0),e.inputState.composing<0&&(e.inputState.composing=0))};Il.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))};Il.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()};Ld.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"),a=t.getTargetRanges();if(s&&a.length){let l=a[0],c=e.posAtDOM(l.startContainer,l.startOffset),u=e.posAtDOM(l.endContainer,l.endOffset);return mH(e,{from:c,to:u,insert:e.state.toText(s)},null),!0}}let r;if(sn.chrome&&sn.android&&(r=m3e.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 a;(((a=window.visualViewport)===null||a===void 0?void 0:a.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(()=>Il.compositionend(e,t),20),!1};const mie=new Set;function l6t(e){mie.has(e)||(mie.add(e),e.addEventListener("copy",()=>{}),e.addEventListener("cut",()=>{}))}const gie=["pre-wrap","normal","pre-line","break-spaces"];let xw=!1;function bie(){xw=!1}class c6t{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 gie.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)>bj&&(xw=!0),this.height=t)}replace(t,n,i){return Rl.of(i)}decomposeLeft(t,n){n.push(this)}decomposeRight(t,n){n.push(this)}applyChanges(t,n,i,r){let s=this,a=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&&a(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 Fc extends k3e{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 kd(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 Fc||r instanceof Ia&&r.flags&4)&&Math.abs(this.length-r.length)<10?(r instanceof Ia?r=new Fc(r.length,this.height,this.spaceAbove):r.height=this.height,this.outdated||(r.outdated=!1),r):Rl.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 Ia extends Rl{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,a,l=0;if(t.lineWrapping){let c=Math.min(this.height,t.lineHeight*s);a=c/s,this.length>s+1&&(l=(this.height-c)/(this.length-s-1))}else a=this.height/s;return{firstLine:i,lastLine:r,perLine:a,perChar:l}}blockAt(t,n,i,r){let{firstLine:s,lastLine:a,perLine:l,perChar:c}=this.heightMetrics(n,r);if(n.lineWrapping){let u=r+(t0){let s=i[i.length-1];s instanceof Ia?i[i.length-1]=new Ia(s.length+r):i.push(null,new Ia(r-1))}if(t>0){let s=i[0];s instanceof Ia?i[0]=new Ia(t+s.length):i.unshift(new Ia(t-1),null)}return Rl.of(i)}decomposeLeft(t,n){n.push(new Ia(t-1),null)}decomposeRight(t,n){n.push(null,new Ia(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 a=[],l=Math.max(n,r.from),c=-1;for(r.from>n&&a.push(new Ia(r.from-n-1).updateHeight(t,n));l<=s&&r.more;){let d=t.doc.lineAt(l).length;a.length&&a.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)>=bj&&(c=-2);let m=new Fc(d,f,h);m.outdated=!1,a.push(m),l+=d+1}l<=s&&a.push(null,new Ia(s-l).updateHeight(t,l));let u=Rl.of(a);return(c<0||Math.abs(u.height-this.height)>=bj||Math.abs(c-this.heightMetrics(t,n).perLine)>=bj)&&(xw=!0),ER(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 f6t extends Rl{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,a,l)):this.left.lineAt(l,d,i,r,s).join(u)}forEachLine(t,n,i,r,s,a){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,a);else{let u=this.lineAt(c,Jr.ByPos,i,r,s);t=t&&u.from<=n&&a(u),n>u.to&&this.right.forEachLine(u.to+1,n,i,l,c,a)}}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 a=s.length;for(let l of i)s.push(l);if(t>0&&yie(s,a-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?Rl.of(this.break?[t,null,n]:[t,n]):(this.left=ER(this.left,t),this.right=ER(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:a}=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+a.length&&r.more?c=a=a.updateHeight(t,l,i,r):a.updateHeight(t,l,i),c?this.balanced(s,a):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function yie(e,t){let n,i;e[t]==null&&(n=e[t-1])instanceof Ia&&(i=e[t+1])instanceof Ia&&e.splice(t-1,3,new Ia(n.length+1+i.length))}const h6t=5;class gH{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 Fc?r.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new Fc(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=h6t)&&this.addLineDeco(r,s,a)}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 Fc(this.pos-t,-1,0)),this.writtenTo=this.pos}blankContent(t,n){let i=new Ia(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 Fc)return t;let n=new Fc(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 Fc)&&!this.isCovered?this.nodes.push(new Fc(0,-1,0)):(this.writtenTod.clientHeight||d.scrollWidth>d.clientWidth)&&f.overflow!="visible"){let h=d.getBoundingClientRect();s=Math.max(s,h.left),a=Math.min(a,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,a)-n.left,top:l-(n.top+t),bottom:Math.max(l,c)-(n.top+t)}}function b6t(e){let t=e.getBoundingClientRect(),n=e.ownerDocument.defaultView||window;return t.left0&&t.top0}function y6t(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}class _3{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 c6t(i),this.stateDeco=wie(n),this.heightMap=Rl.empty().applyChanges(this.stateDeco,sr.empty,this.heightOracle.setDoc(n.doc),[new $u(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:a})=>r>=s&&r<=a)){let{from:s,to:a}=this.lineBlockAt(r);t.push(new jA(s,a))}}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?xie:new bH(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(dk(t,this.scaler))})}update(t,n=null){this.state=t.state;let i=this.stateDeco;this.stateDeco=wie(this.state);let r=t.changedRanges,s=$u.extendWithRanges(r,p6t(i,this.stateDeco,t?t.changes:Zo.empty(this.state.doc.length))),a=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);bie(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),s),(this.heightMap.height!=a||xw)&&(t.flags|=2),l?(this.scrollAnchorPos=t.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=a);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(n3e)&&(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 a=this.heightOracle.mustRefreshForWrapping(s)||this.mustMeasureContent==="refresh",l=n.getBoundingClientRect(),c=a||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}=$Le(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,a=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=FLe(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=ULe(this.scrollParent||t.win);let b=(this.printing?y6t:g6t)(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&&!b6t(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)&&(a=!0),a||r.lineWrapping&&Math.abs(w-this.contentDOMWidth)>r.charWidth){let{lineHeight:k,charWidth:C,textHeight:E}=t.docView.measureTextSize();a=k>0&&r.refresh(s,k,C,E,Math.max(5,w/C),S),a&&(t.docView.minWidth=0,u|=16)}v>0&&y>0?d=Math.max(v,y):v<0&&y<0&&(d=Math.min(v,y)),bie();for(let k of this.viewports){let C=k.from==this.viewport.from?S:t.docView.measureVisibleLineHeights(k);this.heightMap=(a?Rl.empty().applyChanges(this.stateDeco,sr.empty,this.heightOracle,[new $u(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(r,0,a,new u6t(k.from,C))}xw&&(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(a?[]: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:a,visibleBottom:l}=this,c=new jA(r.lineAt(a-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>a-2*1e3&&s>1,a=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 _3(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=[];Pi.spans(n,this.viewport.from,this.viewport.to,{span(s,a){i.push({from:s,to:a})},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)||dk(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)||dk(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 dk(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 jA{constructor(t,n){this.from=t,this.to=n}}function x6t(e,t,n){let i=[],r=e,s=0;return Pi.spans(n,e,t,{span(){},point(a,l){a>r&&(i.push({from:r,to:a}),s+=a-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:a}=t[r],l=a-s;if(i<=l)return s+i;i-=l}}function RA(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 w6t(e,t){for(let n of e)if(t(n))return n}const xie={toDOM(e){return e},fromDOM(e){return e},scale:1,eq(e){return e==this}};function wie(e){let t=e.facet(jD).filter(i=>typeof i!="function"),n=e.facet(hH).filter(i=>typeof i!="function");return n.length&&t.push(Pi.join(n)),t}class bH{constructor(t,n,i){let r=0,s=0,a=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=a+(l.top-s)*this.scale,a=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 dk(e,t){if(t.scale==1)return e;let n=t.toDOM(e.top),i=t.toDOM(e.bottom);return new kd(e.from,e.length,n,i-n,Array.isArray(e._content)?e._content.map(r=>dk(r,t)):e._content)}const IA=an.define({combine:e=>e.join(" ")}),xB=an.define({combine:e=>e.indexOf(!0)>-1}),wB=yg.newName(),S3e=yg.newName(),E3e=yg.newName(),C3e={"&light":"."+S3e,"&dark":"."+E3e};function OB(e,t,n){return new yg(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 O6t=OB("."+wB,{"&":{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"}},C3e),k6t={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},j3=sn.ie&&sn.ie_version<=11;class S6t{constructor(t){this.view=t,this.active=!1,this.editContext=null,this.selectionRange=new J3t,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 C6t(t),t.state.facet(Ph)&&(t.contentDOM.editContext=this.editContext.editContext)),j3&&(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(Ph)?i.root.activeElement!=this.dom:!cS(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&&dS(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,n=IE(t.root);if(!n)return!1;let i=sn.safari&&t.root.nodeType==11&&t.root.activeElement==this.dom&&E6t(this.view,n)||n;if(!i||this.selectionRange.eq(i))return!1;let r=cS(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&&xx(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 a=this.readMutation(s);a&&(a.typeOver&&(r=!0),n==-1?{from:n,to:i}=a:(n=Math.min(a.from,n),i=Math.max(a.to,i)))}return{from:n,to:i,typeOver:r}}readChange(){let{from:t,to:n,typeOver:i}=this.processRecords(),r=this.selectionChanged&&cS(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 Q4t(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=h3e(this.view,n);return this.view.state==i&&(n.domChanged||n.newSel&&!SR(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=Oie(n,t.previousSibling||t.target.previousSibling,-1),r=Oie(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(Ph)!=t.state.facet(Ph)&&(t.view.contentDOM.editContext=t.state.facet(Ph)?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 Oie(e,t,n){for(;t;){let i=Js.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 kie(e,t){let n=t.startContainer,i=t.startOffset,r=t.endContainer,s=t.endOffset,a=e.docView.domAtPos(e.state.selection.main.anchor,1);return dS(a.node,a.offset,r,s)&&([n,i,r,s]=[r,s,n,i]),{anchorNode:n,anchorOffset:i,focusNode:r,focusOffset:s}}function E6t(e,t){if(t.getComposedRanges){let r=t.getComposedRanges(e.root)[0];if(r)return kie(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?kie(e,n):null}class C6t{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:a}=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=p3e(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));SR(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==a-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);mH(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 a=this.toEditorPos(i.rangeStart),l=this.toEditorPos(i.rangeEnd);a{let r=[];for(let s of i.getTextFormats()){let a=s.underlineStyle,l=s.underlineThickness;if(!/none/i.test(a)&&!/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=IE(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,a,l,c,u)=>{if(i)return;let d=u.length-(a-s);if(r&&a>=r.to)if(r.from==s&&r.to==a&&r.insert.eq(u)){r=this.pendingContextChange=null,n+=d,this.to+=d;return}else r=null,this.revertPending(t.state);if(s+=n,a+=n,a<=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(a),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||e4t(t.parent)||document,this.viewState=new vie(this,t.state||Ui.create(t)),t.scrollTo&&t.scrollTo.is(TA)&&(this.viewState.scrollTarget=t.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(zv).map(r=>new S3(r));for(let r of this.plugins)r.update(this);this.observer=new S6t(this),this.inputState=new q4t(this),this.inputState.ensureHandlers(this.plugins),this.docView=new oie(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 Mo?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 a=this.hasFocus,l=0,c=null;t.some(h=>h.annotation(x3e))?(this.inputState.notifiedFocused=a,l=1):a!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=a,c=w3e(s,a),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=wR.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 wx(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(TA)&&(f=m.value.clip(this.state))}this.viewState.update(r,f),this.bidiCache=CR.update(this.bidiCache,r.changes),r.empty||(this.updatePlugins(r),this.inputState.update(r)),n=this.docView.update(r),this.state.facet(uk)!=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(IA)!=r.state.facet(IA)&&(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(mB))try{h(r)}catch(m){ac(this.state,m,"update listener")}(c||d)&&Promise.resolve().then(()=>{c&&this.state==c.startState&&this.dispatch(c),d&&!h3e(this,d)&&u.force&&xx(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 vie(this,t),this.plugins=t.facet(zv).map(i=>new S3(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView.destroy(),this.docView=new oie(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(zv),i=t.state.facet(zv);if(n!=i){let r=[];for(let s of i){let a=n.indexOf(s);if(a<0)r.push(new S3(s));else{let l=this.plugins[a];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:a}=this.viewState;Math.abs(r-this.viewState.scrollOffset)>1&&(a=-1),this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(a<0)if(ULe(i||this.win))s=-1,a=this.viewState.heightMap.height;else{let m=this.viewState.scrollAnchorAt(r);s=m.from,a=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 ac(this.state,g),Sie}}),f=wR.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),a=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let l of this.state.facet(mB))l(n)}get themeClasses(){return wB+" "+(this.state.facet(xB)?E3e:S3e)+" "+this.state.facet(IA)}updateAttrs(){let t=Eie(this,s3e,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Ph)?"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,fH,n);let i=this.observer.ignore(()=>{let r=eie(this.contentDOM,this.contentAttrs,n),s=eie(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(uk);let t=this.state.facet(Xt.cspNonce);yg.mount(this.root,this.styleModules.concat(O6t).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 A3(this,t,aie(this,t,n,i))}moveByGroup(t,n){return A3(this,t,aie(this,t,n,i=>M4t(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 D4t(this,t,n,i)}moveVertically(t,n,i){return A3(this,t,L4t(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=yB(this,t,n);return i&&i.pos}posAndSideAtCoords(t,n=!0){return this.readMeasured(),yB(this,t,n)}coordsAtPos(t,n=1){this.readMeasured();let i=this.state.doc.lineAt(t),r=this.bidiSpans(i),s=r[Ef.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(t3e)||tthis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>T6t)return WLe(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||qLe(s.isolates,i=iie(this,t))))return s.order;i||(i=iie(this,t));let r=l4t(t.text,n,i);return this.bidiCache.push(new CR(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(()=>{BLe(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,a;return TA.of(new wx(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,(a=n.xMargin)!==null&&a!==void 0?a:5))}scrollSnapshot(){let{scrollTop:t,scrollLeft:n}=this.scrollDOM,i=this.viewState.scrollAnchorAt(t);return TA.of(new wx(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 eo.define(()=>({}),{eventHandlers:t})}static domEventObservers(t){return eo.define(()=>({}),{eventObservers:t})}static theme(t,n){let i=yg.newName(),r=[IA.of(i),uk.of(OB(`.${i}`,t))];return n&&n.dark&&r.push(xB.of(!0)),r}static baseTheme(t){return jp.lowest(uk.of(OB("."+wB,t,C3e)))}static findFromDOM(t){var n;let i=t.querySelector(".cm-content"),r=i&&Js.get(i)||Js.get(t);return((n=r==null?void 0:r.root)===null||n===void 0?void 0:n.view)||null}}Xt.styleModule=uk;Xt.inputHandler=JLe;Xt.clipboardInputFilter=uH;Xt.clipboardOutputFilter=dH;Xt.scrollHandler=i3e;Xt.focusChangeEffect=e3e;Xt.perLineTextDirection=t3e;Xt.exceptionSink=ZLe;Xt.updateListener=mB;Xt.editable=Ph;Xt.mouseSelectionStyle=YLe;Xt.dragMovesSelection=XLe;Xt.clickAddsSelectionRange=GLe;Xt.decorations=jD;Xt.blockWrappers=o3e;Xt.outerDecorations=hH;Xt.atomicRanges=gT;Xt.bidiIsolatedRanges=a3e;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=l3e;Xt.darkTheme=xB;Xt.cspNonce=an.define({combine:e=>e.length?e[0]:""});Xt.contentAttributes=fH;Xt.editorAttributes=s3e;Xt.lineWrapping=Xt.contentAttributes.of({class:"cm-lineWrapping"});Xt.announce=Gn.define();const T6t=4096,Sie={};class CR{constructor(t,n,i,r,s,a){this.from=t,this.to=n,this.dir=i,this.isolates=r,this.fresh=s,this.order=a}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],a=typeof s=="function"?s(e):s;a&&aH(a,n)}return n}const A6t=sn.mac?"mac":sn.windows?"win":sn.linux?"linux":"key";function _6t(e,t){const n=e.split(/-(?!$)/);let i=n[n.length-1];i=="Space"&&(i=" ");let r,s,a,l;for(let c=0;ci.concat(r),[]))),n}function N6t(e,t,n){return A3e(T3e(e.state),t,e,n)}let vm=null;const R6t=4e3;function I6t(e,t=A6t){let n=Object.create(null),i=Object.create(null),r=(a,l)=>{let c=i[a];if(c==null)i[a]=l;else if(c!=l)throw new Error("Key binding "+a+" is used both as a regular binding and as a multi-stroke prefix")},s=(a,l,c,u,d)=>{var f,h;let m=n[a]||(n[a]=Object.create(null)),g=l.split(/ (?!$)/).map(y=>_6t(y,t));for(let y=1;y{let O=vm={view:w,prefix:x,scope:a};return setTimeout(()=>{vm==O&&(vm=null)},R6t),!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 a of e){let l=a.scope?a.scope.split(" "):["editor"];if(a.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}=a;for(let h in d)d[h].run.push(m=>f(m,kB))}let c=a[t]||a.key;if(c)for(let u of l)s(u,c,a.run,a.preventDefault,a.stopPropagation),a.shift&&s(u,"Shift-"+c,a.shift,a.preventDefault,a.stopPropagation)}return n}let kB=null;function A3e(e,t,n,i){kB=t;let r=W3t(t),s=ec(r,0),a=gf(s)==r.length&&r!=" ",l="",c=!1,u=!1,d=!1;vm&&vm.view==n&&vm.scope==i&&(l=vm.prefix+" ",g3e.indexOf(t.keyCode)<0&&(u=!0,vm=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+PA(r,t,!a)])?c=!0:a&&(t.altKey||t.metaKey||t.ctrlKey)&&!(sn.windows&&t.ctrlKey&&t.altKey)&&!(sn.mac&&t.altKey&&!(t.ctrlKey||t.metaKey))&&(g=vg[t.keyCode])&&g!=r?(h(m[l+PA(g,t,!0)])||t.shiftKey&&(b=NE[t.keyCode])!=r&&b!=g&&h(m[l+PA(b,t,!1)]))&&(c=!0):a&&t.shiftKey&&h(m[l+PA(r,t,!0)])&&(c=!0),!c&&h(m._any)&&(c=!0)),u&&(c=!0),c&&d&&t.stopPropagation(),kB=null,c}class oy{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=_3e(t);return[new oy(n,r.left-s.left,r.top-s.top,null,r.bottom-r.top)]}else return P6t(t,n,i)}}function _3e(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 Tie(e,t,n,i){let r=e.coordsAtPos(t,n*2);if(!r)return i;let s=e.dom.getBoundingClientRect(),a=(r.top+r.bottom)/2,l=e.posAtCoords({x:s.left+1,y:a}),c=e.posAtCoords({x:s.right-1,y:a});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 P6t(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,a=e.contentDOM,l=a.getBoundingClientRect(),c=_3e(e),u=a.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=bB(e,i,1),g=bB(e,r,-1),b=m.type==Ua.Text?m:null,v=g.type==Ua.Text?g:null;if(b&&(e.lineWrapping||m.widgetLineBreaks)&&(b=Tie(e,i,1,b)),v&&(e.lineWrapping||g.widgetLineBreaks)&&(v=Tie(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&&_.from=M)break;I>D&&j(Math.max(F,D),S==null&&F<=T,Math.min(I,M),k==null&&I>=R,L.dir)}if(D=P.to+1,D>=M)break}return A.length==0&&j(T,S==null,R,k==null,e.textDirection),{top:E,bottom:N,horizontal:A}}function O(S,k){let C=l.top+(k?S.top:S.bottom);return{top:C,bottom:C,horizontal:[]}}}function D6t(e,t){return e.constructor==t.constructor&&e.eq(t)}class M6t{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(yj)!=t.state.facet(yj)&&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(yj);for(;n!D6t(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 yj=an.define();function j3e(e){return[eo.define(t=>new M6t(t,e)),yj.of(e)]}const ww=an.define({combine(e){return Xf(e,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(t,n)=>Math.min(t,n),drawRangeCursor:(t,n)=>t||n})}});function L6t(e={}){return[ww.of(e),$6t,F6t,B6t,n3e.of(!0)]}function N3e(e){return e.startState.facet(ww)!=e.state.facet(ww)}const $6t=j3e({above:!0,markers(e){let{state:t}=e,n=t.facet(ww),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 a=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 oy.forRange(e,a,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=N3e(e);return n&&Aie(e.state,t),e.docChanged||e.selectionSet||n},mount(e,t){Aie(t.state,e)},class:"cm-cursorLayer"});function Aie(e,t){t.style.animationDuration=e.facet(ww).cursorBlinkRate+"ms"}const F6t=j3e({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 oy.forRange(e,"cm-selectionBackground",r))t.push(s);if(sn.ios&&!n.empty&&e.state.facet(ww).iosSelectionHandles){for(let r of oy.forRange(e,"cm-selectionHandle cm-selectionHandle-start",ut.cursor(n.from,1)))t.push(r);for(let r of oy.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||N3e(e)},class:"cm-selectionLayer"}),B6t=jp.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"}}}})),R3e=Gn.define({map(e,t){return e==null?null:t.mapPos(e)}}),fk=qa.define({create(){return null},update(e,t){return e!=null&&(e=t.changes.mapPos(e)),t.effects.reduce((n,i)=>i.is(R3e)?i.value:n,e)}}),U6t=eo.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(fk);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(fk)!=n||e.docChanged||e.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:e}=this,t=e.state.field(fk),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(fk)!=e&&this.view.dispatch({effects:R3e.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 Q6t(){return[fk,U6t]}function _ie(e,t,n,i,r){t.lastIndex=0;for(let s=e.iterRange(n,i),a=n,l;!s.next().done;a+=s.value.length)if(!s.lineBreak)for(;l=t.exec(s.value);)r(a+l.index,l)}function z6t(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 V6t{constructor(t){const{regexp:n,decoration:i,decorate:r,boundary:s,maxLength:a=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=a}createDeco(t){let n=new gp,i=n.add.bind(n);for(let{from:r,to:s}of z6t(t,this.maxLength))_ie(t.state.doc,this.regexp,r,s,(a,l)=>this.addMatch(l,t,a,i));return n.finish()}updateDeco(t,n){let i=1e9,r=-1;return t.docChanged&&t.changes.iterChanges((s,a,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 a=Math.max(s.from,i),l=Math.min(s.to,r);if(l>=a){let c=t.state.doc.lineAt(a),u=c.toc.from;a--)if(this.boundary.test(c.text[a-1-c.from])){d=a;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 SB=/x/.unicode!=null?"gu":"g",H6t=new RegExp(`[\0-\b ---Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,SB),q6t={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 N3=null;function W6t(){var e;if(N3==null&&typeof document<"u"&&document.body){let t=document.body.style;N3=((e=t.tabSize)!==null&&e!==void 0?e:t.MozTabSize)!=null}return N3||!1}const vj=an.define({combine(e){let t=Xf(e,{render:null,specialChars:H6t,addSpecialChars:null});return(t.replaceTabs=!W6t())&&(t.specialChars=new RegExp(" |"+t.specialChars.source,SB)),t.addSpecialChars&&(t.specialChars=new RegExp(t.specialChars.source+"|"+t.addSpecialChars.source,SB)),t}});function K6t(e={}){return[vj.of(e),G6t()]}let jie=null;function G6t(){return jie||(jie=eo.fromClass(class{constructor(e){this.view=e,this.decorations=Cn.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(e.state.facet(vj)),this.decorations=this.decorator.createDeco(e)}makeDecorator(e){return new V6t({regexp:e.specialChars,decoration:(t,n,i)=>{let{doc:r}=n.state,s=ec(t[0],0);if(s==9){let a=r.lineAt(i),l=n.state.tabSize,c=Md(a.text,l,i-a.from);return Cn.replace({widget:new J6t((l-c%l)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=Cn.replace({widget:new Z6t(e,s)}))},boundary:e.replaceTabs?void 0:/[^]/})}update(e){let t=e.state.facet(vj);e.startState.facet(vj)!=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 X6t="•";function Y6t(e){return e>=32?X6t:e==10?"␤":String.fromCharCode(9216+e)}class Z6t extends Hd{constructor(t,n){super(),this.options=t,this.code=n}eq(t){return t.code==this.code}toDOM(t){let n=Y6t(this.code),i=t.state.phrase("Control character")+" "+(q6t[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 J6t extends Hd{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 e$t(){return n$t}const t$t=Cn.line({class:"cm-activeLine"}),n$t=eo.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(t$t.range(r.from)),t=r.from)}return Cn.set(n)}},{decorations:e=>e.decorations});class i$t extends Hd{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?uS(t.firstChild):[];if(!n.length)return null;let i=window.getComputedStyle(t.parentNode),r=PE(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 r$t(e){let t=eo.fromClass(class{constructor(n){this.view=n,this.placeholder=e?Cn.set([Cn.widget({widget:new i$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 EB=2e3;function s$t(e,t,n){let i=Math.min(t.line,n.line),r=Math.max(t.line,n.line),s=[];if(t.off>EB||n.off>EB||t.col<0||n.col<0){let a=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+a,u.to+l))}}else{let a=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=rB(u.text,a,e.tabSize,!0);if(d<0)s.push(ut.cursor(u.to));else{let f=rB(u.text,l,e.tabSize);s.push(ut.range(u.from+d,u.from+f))}}}return s}function o$t(e,t){let n=e.coordsAtPos(e.viewport.from);return n?Math.round(Math.abs((n.left-t)/e.defaultCharacterWidth)):-1}function Nie(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>EB?-1:r==i.length?o$t(e,t.clientX):Md(i.text,e.state.tabSize,n-i.from);return{line:i.number,col:s,off:r}}function a$t(e,t){let n=Nie(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),a=r.state.doc.lineAt(s);n={line:a.number,col:n.col,off:Math.min(n.off,a.length)},i=i.map(r.changes)}},get(r,s,a){let l=Nie(e,r);if(!l)return i;let c=s$t(e.state,n,l);return c.length?a?ut.create(c.concat(i.ranges)):ut.create(c):i}}:null}function l$t(e){let t=n=>n.altKey&&n.button==0;return Xt.mouseSelectionStyle.of((n,i)=>t(i)?a$t(n,i):null)}const c$t={Alt:[18,e=>!!e.altKey],Control:[17,e=>!!e.ctrlKey],Shift:[16,e=>!!e.shiftKey],Meta:[91,e=>!!e.metaKey]},u$t={style:"cursor: crosshair"};function d$t(e={}){let[t,n]=c$t[e.key||"Alt"],i=eo.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?u$t:null})]}const DA="-10000px";class I3e{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(a=>a);let s=null;this.tooltipViews=this.tooltips.map(a=>s=i(a,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 a=[],l=n?[]:null;for(let c=0;cn[u]=c),n.length=l.length),this.input=r,this.tooltips=s,this.tooltipViews=a,!0}}function f$t(e){let t=e.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:t.clientHeight,right:t.clientWidth}}const R3=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)||f$t}}}),Rie=new WeakMap,yH=eo.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(R3);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 I3e(e,vH,(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(R3);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=DA,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 a=s.getBoundingClientRect();n=Math.abs(a.top+1e4)>1||Math.abs(a.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=pH(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,a)=>{let l=this.manager.tooltipViews[a];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(R3).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,a=[];for(let l=0;l=Math.min(n.bottom,i.bottom)||f.rightMath.min(n.right,i.right)+.1)){d.style.top=DA;continue}let m=c.arrow?u.dom.querySelector(".cm-tooltip-arrow"):null,g=m?7:0,b=h.right-h.left,v=(t=Rie.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",Iie(d,(w-e.parent.left)/r)):(d.style.top=k/s+"px",Iie(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&&a.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=DA}},{eventObservers:{scroll(){this.maybeMeasure()}}});function Iie(e,t){let n=parseInt(e.style.left,10);(isNaN(n)||Math.abs(t-n)>1)&&(e.style.left=t+"px")}const h$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},vH=an.define({enables:[yH,h$t]}),TR=an.define({combine:e=>e.reduce((t,n)=>t.concat(n),[])});class PD{static create(t){return new PD(t)}constructor(t){this.view=t,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new I3e(t,TR,(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 m$t=vH.compute([TR],e=>{let t=e.facet(TR);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:PD.create,above:t[0].above,arrow:t.some(n=>n.arrow)}}),P3e=an.define();class g$t{constructor(t,n,i,r,s,a){this.view=t,this.source=n,this.field=i,this.locked=r,this.setHover=s,this.hoverTime=a,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;ta.bottom||n.xa.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,a(c))},c=>ac(t.state,c,"hover tooltip"))}else a(s)}get tooltip(){let t=this.view.plugin(yH),n=t?t.manager.tooltips.findIndex(i=>i.create==PD.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&&!b$t(s.dom,t)||this.pending){let{pos:a}=r[0]||this.pending,l=(i=(n=r[0])===null||n===void 0?void 0:n.end)!==null&&i!==void 0?i:a;(a==l?this.view.posAtCoords(this.lastMove)!=a:!y$t(this.view,a,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 MA=4;function b$t(e,t){let{left:n,right:i,top:r,bottom:s}=e.getBoundingClientRect(),a;if(a=e.querySelector(".cm-tooltip-arrow")){let l=a.getBoundingClientRect();r=Math.min(l.top,r),s=Math.max(l.bottom,s)}return t.clientX>=n-MA&&t.clientX<=i+MA&&t.clientY>=r-MA&&t.clientY<=s+MA}function y$t(e,t,n,i,r,s){let a=e.scrollDOM.getBoundingClientRect(),l=e.documentTop+e.documentPadding.top+e.contentHeight;if(a.left>i||a.rightr||Math.min(a.bottom,l)=t&&c<=n}function v$t(e,t={}){let n=Gn.define(),i=new WeakMap,r=qa.define({create(){return[]},update(a,l){let c=i.get(a);if(a.length&&(t.hideOnChange&&(l.docChanged||l.selection)?a=[]:c&&c(l)?a=[]:t.hideOn&&(a=a.filter(u=>!t.hideOn(l,u)))),l.docChanged&&a.length){let u=[];for(let d of a){let f=l.changes.mapPos(d.pos,-1,La.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)}}a=u}for(let u of l.effects)u.is(n)&&(a=u.value,c=void 0),(u.is(w$t)&&!u.value||u.value==r)&&(a=[]);return a.length&&c&&i.set(a,c),a},provide:a=>TR.from(a)});const s=eo.define(a=>new g$t(a,e,r,i,n,t.hoverTime||300));return{active:r,extension:[r,s,P3e.of(s),m$t]}}function x$t(e,t,n,i={}){var r;let s=e.state.facet(P3e).map(a=>e.plugin(a)).filter(a=>!!a);if(i.tooltip&&i.tooltip.active){let a=s.find(l=>l.field==i.tooltip.active);a&&(s=[a])}for(let a of s)a.activateHover(e,t,n,(r=i.until)!==null&&r!==void 0?r:()=>!1)}function D3e(e,t){let n=e.plugin(yH);if(!n)return null;let i=n.manager.tooltips.indexOf(t);return i<0?null:n.manager.tooltipViews[i]}const w$t=Gn.define(),Pie=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 xH(e,t){let n=e.plugin(M3e),i=n?n.specs.indexOf(t):-1;return i>-1?n.panels[i]:null}const M3e=eo.fromClass(class{constructor(e){this.input=e.state.facet(ME),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(e));let t=e.state.facet(Pie);this.top=new LA(e,!0,t.topContainer),this.bottom=new LA(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(Pie);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new LA(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new LA(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=e.state.facet(ME);if(n!=this.input){let i=n.filter(c=>c),r=[],s=[],a=[],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:a).push(d)}this.specs=i,this.panels=r,this.top.sync(s),this.bottom.sync(a);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 LA{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=Die(t);t=t.nextSibling}else this.dom.insertBefore(n.dom,t);for(;t;)t=Die(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 Die(e){let t=e.nextSibling;return e.remove(),t}const ME=an.define({enables:M3e});function O$t(e,t){let n,i=new Promise(a=>n=a),r=a=>k$t(a,t,n);e.state.field(I3,!1)?e.dispatch({effects:L3e.of(r)}):e.dispatch({effects:Gn.appendConfig.of(I3.init(()=>[r]))});let s=$3e.of(r);return{close:s,result:i.then(a=>((e.win.queueMicrotask||(c=>e.win.setTimeout(c,10)))(()=>{e.state.field(I3).indexOf(r)>-1&&e.dispatch({effects:s})}),a))}}const I3=qa.define({create(){return[]},update(e,t){for(let n of t.effects)n.is(L3e)?e=[n.value].concat(e):n.is($3e)&&(e=e.filter(i=>i!=n.value));return e},provide:e=>ME.computeN([e],t=>t.field(e))}),L3e=Gn.define(),$3e=Gn.define();function k$t(e,t,n){let i=t.content?t.content(e,()=>a(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(),a(null)):u.keyCode==13&&(u.preventDefault(),a(c))}),c.addEventListener("submit",u=>{u.preventDefault(),a(c)})}let s=Ir("div",i,Ir("button",{onclick:()=>a(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 a(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 yp extends bg{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}yp.prototype.elementClass="";yp.prototype.toDOM=void 0;yp.prototype.mapMode=La.TrackBefore;yp.prototype.startSide=yp.prototype.endSide=-1;yp.prototype.point=!0;const xj=an.define(),S$t=an.define(),E$t={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Pi.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},hS=an.define();function C$t(e){return[F3e(),hS.of({...E$t,...e})]}const Mie=an.define({combine:e=>e.some(t=>t)});function F3e(e){return[T$t]}const T$t=eo.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(hS).map(t=>new $ie(e,t)),this.fixed=!e.state.facet(Mie);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(Mie)!=!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=Pi.iter(this.view.state.facet(xj),this.view.viewport.from),i=[],r=this.gutters.map(s=>new A$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 a=!0;for(let l of s.type)if(l.type==Ua.Text&&a){CB(n,i,l.from);for(let c of r)c.line(this.view,l,i);a=!1}else if(l.widget)for(let c of r)c.widget(this.view,l)}else if(s.type==Ua.Text){CB(n,i,s.from);for(let a of r)a.line(this.view,s,i)}else if(s.widget)for(let a of r)a.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(hS),n=e.state.facet(hS),i=e.docChanged||e.heightChanged||e.viewportChanged||!Pi.eq(e.startState.facet(xj),e.state.facet(xj),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 a=t.indexOf(s);a<0?r.push(new $ie(this.view,s)):(this.gutters[a].update(e),r.push(this.gutters[a]))}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 Lie(e){return Array.isArray(e)?e:[e]}function CB(e,t,n){for(;e.value&&e.from<=n;)e.from==n&&t.push(e.value),e.next()}class A$t{constructor(t,n,i){this.gutter=t,this.height=i,this.i=0,this.cursor=Pi.iter(t.markers,n.from)}addElement(t,n,i){let{gutter:r}=this,s=(n.top-this.height)/t.scaleY,a=n.height/t.scaleY;if(this.i==r.elements.length){let l=new B3e(t,a,s,i);r.elements.push(l),r.dom.appendChild(l.dom)}else r.elements[this.i].update(t,a,s,i);this.height=n.bottom,this.i++}line(t,n,i){let r=[];CB(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 a=this.gutter;r.length==0&&!a.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(S$t)){let a=s(t,n.widget,n);a&&(r||(r=[])).push(a)}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 $ie{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,a;if(s!=this.dom&&this.dom.contains(s)){for(;s.parentNode!=this.dom;)s=s.parentNode;let c=s.getBoundingClientRect();a=(c.top+c.bottom)/2}else a=r.clientY;let l=t.lineBlockAtHeight(a-t.documentTop);n.domEventHandlers[i](t,l,r)&&r.preventDefault()});this.markers=Lie(n.markers(t)),n.initialSpacer&&(this.spacer=new B3e(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=Lie(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!Pi.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 B3e{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":""),_$t(this.markers,r)||this.setMarkers(t,r)}setMarkers(t,n){let i="cm-gutterElement",r=this.dom.firstChild;for(let s=0,a=0;;){let l=a,c=ss(l,c,u)||a(l,c,u):a}return i}})}});class P3 extends yp{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}}function D3(e,t){return e.state.facet(Vv).formatNumber(t,e.state)}const R$t=hS.compute([Vv],e=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(t){return t.state.facet(j$t)},lineMarker(t,n,i){return i.some(r=>r.toDOM)?null:new P3(D3(t,t.state.doc.lineAt(n.from).number))},widgetMarker:(t,n,i)=>{for(let r of t.state.facet(N$t)){let s=r(t,n,i);if(s)return s}return null},lineMarkerChange:t=>t.startState.facet(Vv)!=t.state.facet(Vv),initialSpacer(t){return new P3(D3(t,Fie(t.state.doc.lines)))},updateSpacer(t,n){let i=D3(n.view,Fie(n.view.state.doc.lines));return i==t.number?t:new P3(i)},domEventHandlers:e.facet(Vv).domEventHandlers,side:"before"}));function U3e(e={}){return[Vv.of(e),F3e(),R$t]}function Fie(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(I$t.range(r)))}return Pi.of(t)});function D$t(){return P$t}let M$t=0,hf=class TB{constructor(t,n,i,r){this.name=t,this.set=n,this.base=i,this.modified=r,this.id=M$t++}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 TB&&(n=t),n!=null&&n.base)throw new Error("Can not derive from a modified tag");let r=new TB(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 AR(t);return i=>i.modified.indexOf(n)>-1?i:AR.get(i.base||i,i.modified.concat(n).sort((r,s)=>r.id-s.id))}},L$t=0;class AR{constructor(t){this.name=t,this.instances=[],this.id=L$t++}static get(t,n){if(!n.length)return t;let i=n[0].instances.find(l=>l.base==t&&$$t(n,l.modified));if(i)return i;let r=[],s=new hf(t.name,r,t,n);for(let l of n)l.instances.push(s);let a=F$t(n);for(let l of t.set)if(!l.modified.length)for(let c of a)r.push(AR.get(l,c));return s}}function $$t(e,t){return e.length==t.length&&e.every((n,i)=>n==t[i])}function F$t(e){let t=[[]];for(let n=0;ni.length-n.length)}function Np(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=[],a=2,l=r;for(let f=0;;){if(l=="..."&&f>0&&f+3==r.length){a=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=="!"){a=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 LE(i,a,c>0?s.slice(0,c):null);t[u]=d.sort(t[u])}}return Q3e.add(t)}const Q3e=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 LE(r.tags,r.mode,r.context);n?n.next=s:i=s,n=s}return i}});let LE=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 a=r;for(let l of s)for(let c of l.set){let u=n[c.id];if(u){a=a?a+" "+u:u;break}}return a},scope:i}}function B$t(e,t){let n=null;for(let i of e){let r=i.style(t);r&&(n=n?n+" "+r:r)}return n}function U$t(e,t,n,i=0,r=e.length){let s=new Q$t(i,Array.isArray(t)?t:[t],n);s.highlightRange(e.cursor(),i,r,"",s.highlighters),s.flush(r)}class Q$t{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:a,from:l,to:c}=t;if(l>=i||c<=n)return;a.isTop&&(s=this.highlighters.filter(m=>!m.scope||m.scope(a)));let u=r,d=z$t(t)||LE.empty,f=B$t(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 z$t(e){let t=e.type.prop(Q3e);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}const nn=hf.define,$A=nn(),um=nn(),Bie=nn(um),Uie=nn(um),dm=nn(),FA=nn(dm),M3=nn(dm),cf=nn(),ab=nn(cf),rf=nn(),sf=nn(),AB=nn(),kO=nn(AB),BA=nn(),oe={comment:$A,lineComment:nn($A),blockComment:nn($A),docComment:nn($A),name:um,variableName:nn(um),typeName:Bie,tagName:nn(Bie),propertyName:Uie,attributeName:nn(Uie),className:nn(um),labelName:nn(um),namespace:nn(um),macroName:nn(um),literal:dm,string:FA,docString:nn(FA),character:nn(FA),attributeValue:nn(FA),number:M3,integer:nn(M3),float:nn(M3),bool:nn(dm),regexp:nn(dm),escape:nn(dm),color:nn(dm),url:nn(dm),keyword:rf,self:nn(rf),null:nn(rf),atom:nn(rf),unit:nn(rf),modifier:nn(rf),operatorKeyword:nn(rf),controlKeyword:nn(rf),definitionKeyword:nn(rf),moduleKeyword:nn(rf),operator:sf,derefOperator:nn(sf),arithmeticOperator:nn(sf),logicOperator:nn(sf),bitwiseOperator:nn(sf),compareOperator:nn(sf),updateOperator:nn(sf),definitionOperator:nn(sf),typeOperator:nn(sf),controlOperator:nn(sf),punctuation:AB,separator:nn(AB),bracket:kO,angleBracket:nn(kO),squareBracket:nn(kO),paren:nn(kO),brace:nn(kO),content:cf,heading:ab,heading1:nn(ab),heading2:nn(ab),heading3:nn(ab),heading4:nn(ab),heading5:nn(ab),heading6:nn(ab),contentSeparator:nn(cf),list:nn(cf),quote:nn(cf),emphasis:nn(cf),strong:nn(cf),link:nn(cf),monospace:nn(cf),strikethrough:nn(cf),inserted:nn(),deleted:nn(),changed:nn(),invalid:nn(),meta:BA,documentMeta:nn(BA),annotation:nn(BA),processingInstruction:nn(BA),definition:hf.defineModifier("definition"),constant:hf.defineModifier("constant"),function:hf.defineModifier("function"),standard:hf.defineModifier("standard"),local:hf.defineModifier("local"),special:hf.defineModifier("special")};for(let e in oe){let t=oe[e];t instanceof hf&&(t.name=e)}z3e([{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 L3;const Nm=new Kn;function DD(e){return an.define({combine:e?t=>t.concat(e):void 0})}const wH=new Kn;class Gc{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=[wg.of(this),Ui.languageData.of((s,a,l)=>{let c=Qie(s,a,l),u=c.type.prop(Nm);if(!u)return[];let d=s.facet(u),f=c.type.prop(wH);if(f){let h=c.resolve(a-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 Qie(t,n,i).type.prop(Nm)==this.data}findRegions(t){let n=t.facet(wg);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,a)=>{if(s.prop(Nm)==this.data){i.push({from:a,to:a+s.length});return}let l=s.prop(Kn.mounted);if(l){if(l.tree.prop(Nm)==this.data){if(l.overlay)for(let c of l.overlay)i.push({from:c.from+a,to:c.to+a});else i.push({from:a,to:a+s.length});return}else if(l.overlay){let c=i.length;if(r(l.tree,l.overlay[0].from+a),i.length>c)return}}for(let c=0;ci.isTop?n:void 0)]}),t.name)}configure(t,n){return new vp(this.data,this.parser.configure(t),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Lr(e){let t=e.field(Gc.state,!1);return t?t.tree:Ei.empty}class V$t{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 SO=null;class Py{constructor(t,n,i=[],r,s,a,l,c){this.parser=t,this.state=n,this.fragments=i,this.tree=r,this.treeLen=s,this.viewport=a,this.skipped=l,this.scheduleOn=c,this.parse=null,this.tempSkipped=[]}static create(t,n,i){return new Py(t,n,[],Ei.empty,0,i,[],null)}startParse(){return this.parser.startParse(new V$t(this.state.doc),this.fragments)}work(t,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=Ei.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(ep.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let n=SO;SO=this;try{return t()}finally{SO=n}}withoutTempSkipped(t){for(let n;n=this.tempSkipped.pop();)t=zie(t,n.from,n.to);return t}changes(t,n){let{fragments:i,tree:r,treeLen:s,viewport:a,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=ep.applyChanges(i,c),r=Ei.empty,s=0,a={from:t.mapPos(a.from,-1),to:t.mapPos(a.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=zie(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 TD{createParse(n,i,r){let s=r[0].from,a=r[r.length-1].to;return{parsedPos:s,advance(){let c=SO;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=a,new Ei($o.none,[],[],a-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 SO}}function zie(e,t,n){return ep.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}class Ow{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 Ow(n)}static init(t){let n=Math.min(3e3,t.doc.length),i=Py.create(t.facet(wg).parser,t,{from:0,to:n});return i.work(20,n)||i.takeTree(),new Ow(i)}}Gc.state=qa.define({create:Ow.init,update(e,t){for(let n of t.effects)if(n.is(Gc.setState))return n.value;return t.startState.facet(wg)!=t.state.facet(wg)?Ow.init(t.state):e.apply(t)}});let V3e=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<"u"&&(V3e=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});const $3=typeof navigator<"u"&&(!((L3=navigator.scheduling)===null||L3===void 0)&&L3.isInputPending)?()=>navigator.scheduling.isInputPending():null,H$t=eo.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(Gc.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(Gc.state);(n.tree!=n.context.tree||!n.context.isDone(t.doc.length))&&(this.working=V3e(this.work))}work(t){this.working=null;let n=Date.now();if(this.chunkEndr+1e3,c=s.context.work(()=>$3&&$3()||Date.now()>a,r+(l?0:1e5));this.chunkBudget-=Date.now()-n,(c||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Gc.setState.of(new Ow(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=>ac(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()}}}),wg=an.define({combine(e){return e.length?e[0]:null},enables:e=>[Gc.state,H$t,Xt.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]});class Og{constructor(t,n=[]){this.language=t,this.support=n,this.extension=[t,n]}}class _R{constructor(t,n,i,r,s,a=void 0){this.name=t,this.alias=n,this.extensions=i,this.filename=r,this.loadFunc=s,this.support=a,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 _R(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 a=n.indexOf(s);if(a>-1&&(s.length>2||!/\w/.test(n[a-1])&&!/\w/.test(n[a+s.length])))return r}return null}}const q$t=an.define(),m1=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 Dy(e){let t=e.facet(m1);return t.charCodeAt(0)==9?e.tabSize*t.length:t.length}function $E(e,t){let n="",i=e.tabSize,r=e.facet(m1)[0];if(r==" "){for(;t>=i;)n+=" ",t-=i;r=" "}for(let s=0;s=t?W$t(e,n,t):null}class MD{constructor(t,n={}){this.state=t,this.options=n,this.unit=Dy(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+=a-this.countColumn(i,i.search(/\S|$/))),s}countColumn(t,n=t.length){return Md(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 a=s(r);if(a>-1)return a}return this.countColumn(i,i.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const Rp=new Kn;function W$t(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 a=r;a&&!(a.fromi.node.to||a.from==i.node.from&&a.type==i.node.type);a=a.parent)s.push(a);for(let a=s.length-1;a>=0;a--)i={node:s[a],next:i}}return H3e(i,e,n)}function H3e(e,t,n){for(let i=e;i;i=i.next){let r=G$t(i.node);if(r)return r(kH.create(t,n,i))}return 0}function K$t(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}function G$t(e){let t=e.type.prop(Rp);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 a=>q3e(a,!0,1,void 0,s&&!K$t(a)?r.from:void 0)}return e.parent==null?X$t:null}function X$t(){return 0}class kH extends MD{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 kH(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(Y$t(i,t))break;n=this.state.doc.lineAt(i.from)}return this.lineIndent(n.from)}continue(){return H3e(this.context.next,this.base,this.pos)}}function Y$t(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function Z$t(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),a=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>=a)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 Ox({closing:e,align:t=!0,units:n=1}){return i=>q3e(i,t,n,e)}function q3e(e,t,n,i,r){let s=e.textAfter,a=s.match(/^\s*/)[0].length,l=i&&s.slice(a,a+i.length)==i||r==e.pos+a,c=t?Z$t(e):null;return c?l?e.column(c.from):e.column(c.to):e.baseIndent+(l?0:e.unit*n)}const J$t=e=>e.baseIndent;function kx({except:e,units:t=1}={}){return n=>{let i=e&&e.test(n.textAfter);return n.baseIndent+(i?0:t*n.unit)}}const eFt=200;function tFt(){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+eFt)return e;let s=n.sliceString(r.from,i);if(!t.some(u=>u.test(s)))return e;let{state:a}=e,l=-1,c=[];for(let{head:u}of a.selection.ranges){let d=a.doc.lineAt(u);if(d.from==l)continue;l=d.from;let f=OH(a,d.from);if(f==null)continue;let h=/^\s*/.exec(d.text)[0],m=$E(a,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 W3e=an.define(),Ip=new Kn;function bT(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 iFt(e){let t=e.lastChild;return t&&t.to==e.to&&t.type.isError}function jR(e,t,n){for(let i of e.facet(W3e)){let r=i(e,t,n);if(r)return r}return nFt(e,t,n)}function K3e(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 LD=Gn.define({map:K3e}),yT=Gn.define({map:K3e});function G3e(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 My=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(LD)&&!rFt(e,i.value.from,i.value.to)?n.push(i.value):i.is(yT)&&(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(Z3e),r=n.map(s=>(i?Cn.replace({widget:new dFt(i(t.state,s))}):Hie).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 NR(e,t,n){var i;let r=null;return(i=e.field(My,!1))===null||i===void 0||i.between(t,n,(s,a)=>{(!r||r.from>s)&&(r={from:s,to:a})}),r}function rFt(e,t,n){let i=!1;return e.between(t,t,(r,s)=>{r==t&&s==n&&(i=!0)}),i}function X3e(e,t){return e.field(My,!1)?t:t.concat(Gn.appendConfig.of(J3e()))}const sFt=e=>{for(let t of G3e(e)){let n=jR(e.state,t.from,t.to);if(n)return e.dispatch({effects:X3e(e.state,[LD.of(n),Y3e(e,n)])}),!0}return!1},oFt=e=>{if(!e.state.field(My,!1))return!1;let t=[];for(let n of G3e(e)){let i=NR(e.state,n.from,n.to);i&&t.push(yT.of(i),Y3e(e,i,!1))}return t.length&&e.dispatch({effects:t}),t.length>0};function Y3e(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 aFt=e=>{let{state:t}=e,n=[];for(let i=0;i{let t=e.state.field(My,!1);if(!t||!t.size)return!1;let n=[];return t.between(0,e.state.doc.length,(i,r)=>{n.push(yT.of({from:i,to:r}))}),e.dispatch({effects:n}),!0},cFt=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:sFt},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:oFt},{key:"Ctrl-Alt-[",run:aFt},{key:"Ctrl-Alt-]",run:lFt}],uFt={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},Z3e=an.define({combine(e){return Xf(e,uFt)}});function J3e(e){return[My,pFt]}function e4e(e,t){let{state:n}=e,i=n.facet(Z3e),r=a=>{let l=e.lineBlockAt(e.posAtDOM(a.target)),c=NR(e.state,l.from,l.to);c&&e.dispatch({effects:yT.of(c)}),a.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 Hie=Cn.replace({widget:new class extends Hd{toDOM(e){return e4e(e,null)}}});class dFt extends Hd{constructor(t){super(),this.value=t}eq(t){return this.value==t.value}toDOM(t){return e4e(t,this.value)}}const fFt={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class F3 extends yp{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 hFt(e={}){let t={...fFt,...e},n=new F3(t,!0),i=new F3(t,!1),r=eo.fromClass(class{constructor(a){this.from=a.viewport.from,this.markers=this.buildMarkers(a)}update(a){(a.docChanged||a.viewportChanged||a.startState.facet(wg)!=a.state.facet(wg)||a.startState.field(My,!1)!=a.state.field(My,!1)||Lr(a.startState)!=Lr(a.state)||t.foldingChanged(a))&&(this.markers=this.buildMarkers(a.view))}buildMarkers(a){let l=new gp;for(let c of a.viewportLineBlocks){let u=NR(a.state,c.from,c.to)?i:jR(a.state,c.from,c.to)?n:null;u&&l.add(c.from,c.from,u)}return l.finish()}}),{domEventHandlers:s}=t;return[r,C$t({class:"cm-foldGutter",markers(a){var l;return((l=a.plugin(r))===null||l===void 0?void 0:l.markers)||Pi.empty},initialSpacer(){return new F3(t,!1)},domEventHandlers:{...s,click:(a,l,c)=>{if(s.click&&s.click(a,l,c))return!0;let u=NR(a.state,l.from,l.to);if(u)return a.dispatch({effects:yT.of(u)}),!0;let d=jR(a.state,l.from,l.to);return d?(a.dispatch({effects:LD.of(d)}),!0):!1}}}),J3e()]}const pFt=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 vT{constructor(t,n){this.specs=t;let i;function r(l){let c=yg.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,a=n.scope;this.scope=a instanceof Gc?l=>l.prop(Nm)==a.data:a?l=>l==a:void 0,this.style=z3e(t.map(l=>({tag:l.tag,class:l.class||r(Object.assign({},l,{tag:null}))})),{all:s}).style,this.module=i?new yg(i):null,this.themeType=n.themeType}static define(t,n){return new vT(t,n||{})}}const _B=an.define(),t4e=an.define({combine(e){return e.length?[e[0]]:null}});function wj(e){let t=e.facet(_B);return t.length?t:e.facet(t4e)}function n4e(e,t){let n=[gFt],i;return e instanceof vT&&(e.module&&n.push(Xt.styleModule.of(e.module)),i=e.themeType),t!=null&&t.fallback?n.push(t4e.of(e)):i?n.push(_B.computeN([Xt.darkTheme],r=>r.facet(Xt.darkTheme)==(i=="dark")?[e]:[])):n.push(_B.of(e)),n}function Ccn(e,t,n){let i=wj(e),r=null;if(i){for(let s of i)if(!s.scope||n){let a=s.style(t);a&&(r=r?r+" "+a:a)}}return r}class mFt{constructor(t){this.markCache=Object.create(null),this.tree=Lr(t.state),this.decorations=this.buildDeco(t,wj(t.state)),this.decoratedTo=t.viewport.to}update(t){let n=Lr(t.state),i=wj(t.state),r=i!=wj(t.startState),{viewport:s}=t.view,a=t.changes.mapPos(this.decoratedTo,1);n.length=s.to?(this.decorations=this.decorations.map(t.changes),this.decoratedTo=a):(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 gp;for(let{from:r,to:s}of t.visibleRanges)U$t(this.tree,n,(a,l,c)=>{i.add(a,l,this.markCache[c]||(this.markCache[c]=Cn.mark({class:c})))},r,s);return i.finish()}}const gFt=jp.high(eo.fromClass(mFt,{decorations:e=>e.decorations})),bFt=vT.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"}]),yFt=Xt.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),i4e=1e4,r4e="()[]{}",s4e=an.define({combine(e){return Xf(e,{afterCursor:!0,brackets:r4e,maxScanDistance:i4e,renderMatch:wFt})}}),vFt=Cn.mark({class:"cm-matchingBracket"}),xFt=Cn.mark({class:"cm-nonmatchingBracket"});function wFt(e){let t=[],n=e.matched?vFt:xFt;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 qie(e){let t=[],n=e.facet(s4e);for(let i of e.selection.ranges){if(!i.empty)continue;let r=Cf(e,i.head,-1,n)||i.head>0&&Cf(e,i.head-1,1,n)||n.afterCursor&&(Cf(e,i.head,1,n)||i.heade.decorations}),kFt=[OFt,yFt];function SFt(e={}){return[s4e.of(e),kFt]}const o4e=new Kn;function jB(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 NB(e){let t=e.type.prop(o4e);return t?t(e.node):e}function Cf(e,t,n,i={}){let r=i.maxScanDistance||i4e,s=i.brackets||r4e,a=Lr(e),l=a.resolveInner(t,n);for(let c=l;c;c=c.parent){let u=jB(c.type,n,s);if(u&&c.from0?t>=d.from&&td.from&&t<=d.to))return EFt(e,t,n,c,d,u,s)}}return CFt(e,t,n,a,l.type,r,s)}function EFt(e,t,n,i,r,s,a){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=a.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 Wie(e,t,n,i=0,r=0){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));let s=r;for(let a=i;a=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?a.toLowerCase():a,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 TFt(e){return{name:e.name||"",token:e.token,blankLine:e.blankLine||(()=>{}),startState:e.startState||(()=>!0),copyState:e.copyState||AFt,indent:e.indent||(()=>null),languageData:e.languageData||{},tokenTable:e.tokenTable||CH,mergeTokens:e.mergeTokens!==!1}}function AFt(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 SH extends Gc{constructor(t){let n=DD(t.languageData),i=TFt(t),r,s=new class extends TD{createParse(a,l,c){return new jFt(r,a,l,c)}};super(n,s,[],t.name),this.topNode=IFt(n,this),r=this,this.streamParser=i,this.stateAfter=new Kn({perNode:!0}),this.tokenTable=t.tokenTable?new d4e(i.tokenTable):RFt}static define(t){return new SH(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 a=t.children.length-1;a>=0;a--){let l=t.children[a],c=n+t.positions[a],u=l instanceof Ei&&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 a=t.positions[s],l=t.children[s],c;if(an&&EH(e,s.tree,0-s.offset,n,l),u;if(c&&c.pos<=i&&(u=l4e(e,s.tree,n+s.offset,c.pos+s.offset,!1)))return{state:c.state,tree:u}}return{state:e.streamParser.startState(r?Dy(r):4),tree:Ei.empty}}let jFt=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=Py.get(),a=r[0].from,{state:l,tree:c}=_Ft(t,i,a,this.to,s==null?void 0:s.state);this.state=l,this.parsedPos=this.chunkStart=a+c.length;for(let u=0;uu.from<=s.viewport.from&&u.to>=s.viewport.from)&&(this.state=this.lang.streamParser.startState(Dy(s.state)),s.skipUntilInView(this.parsedPos,s.viewport.from),this.parsedPos=s.viewport.from),this.moveRangeIndex()}advance(){let t=Py.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==` +--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,SB),q6t={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 N3=null;function W6t(){var e;if(N3==null&&typeof document<"u"&&document.body){let t=document.body.style;N3=((e=t.tabSize)!==null&&e!==void 0?e:t.MozTabSize)!=null}return N3||!1}const vj=an.define({combine(e){let t=Xf(e,{render:null,specialChars:H6t,addSpecialChars:null});return(t.replaceTabs=!W6t())&&(t.specialChars=new RegExp(" |"+t.specialChars.source,SB)),t.addSpecialChars&&(t.specialChars=new RegExp(t.specialChars.source+"|"+t.addSpecialChars.source,SB)),t}});function K6t(e={}){return[vj.of(e),G6t()]}let jie=null;function G6t(){return jie||(jie=eo.fromClass(class{constructor(e){this.view=e,this.decorations=Cn.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(e.state.facet(vj)),this.decorations=this.decorator.createDeco(e)}makeDecorator(e){return new V6t({regexp:e.specialChars,decoration:(t,n,i)=>{let{doc:r}=n.state,s=ec(t[0],0);if(s==9){let a=r.lineAt(i),l=n.state.tabSize,c=Md(a.text,l,i-a.from);return Cn.replace({widget:new J6t((l-c%l)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=Cn.replace({widget:new Z6t(e,s)}))},boundary:e.replaceTabs?void 0:/[^]/})}update(e){let t=e.state.facet(vj);e.startState.facet(vj)!=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 X6t="•";function Y6t(e){return e>=32?X6t:e==10?"␤":String.fromCharCode(9216+e)}class Z6t extends Hd{constructor(t,n){super(),this.options=t,this.code=n}eq(t){return t.code==this.code}toDOM(t){let n=Y6t(this.code),i=t.state.phrase("Control character")+" "+(q6t[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 J6t extends Hd{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 e$t(){return n$t}const t$t=Cn.line({class:"cm-activeLine"}),n$t=eo.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(t$t.range(r.from)),t=r.from)}return Cn.set(n)}},{decorations:e=>e.decorations});class i$t extends Hd{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?uS(t.firstChild):[];if(!n.length)return null;let i=window.getComputedStyle(t.parentNode),r=PE(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 r$t(e){let t=eo.fromClass(class{constructor(n){this.view=n,this.placeholder=e?Cn.set([Cn.widget({widget:new i$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 EB=2e3;function s$t(e,t,n){let i=Math.min(t.line,n.line),r=Math.max(t.line,n.line),s=[];if(t.off>EB||n.off>EB||t.col<0||n.col<0){let a=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+a,u.to+l))}}else{let a=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=rB(u.text,a,e.tabSize,!0);if(d<0)s.push(ut.cursor(u.to));else{let f=rB(u.text,l,e.tabSize);s.push(ut.range(u.from+d,u.from+f))}}}return s}function o$t(e,t){let n=e.coordsAtPos(e.viewport.from);return n?Math.round(Math.abs((n.left-t)/e.defaultCharacterWidth)):-1}function Nie(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>EB?-1:r==i.length?o$t(e,t.clientX):Md(i.text,e.state.tabSize,n-i.from);return{line:i.number,col:s,off:r}}function a$t(e,t){let n=Nie(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),a=r.state.doc.lineAt(s);n={line:a.number,col:n.col,off:Math.min(n.off,a.length)},i=i.map(r.changes)}},get(r,s,a){let l=Nie(e,r);if(!l)return i;let c=s$t(e.state,n,l);return c.length?a?ut.create(c.concat(i.ranges)):ut.create(c):i}}:null}function l$t(e){let t=n=>n.altKey&&n.button==0;return Xt.mouseSelectionStyle.of((n,i)=>t(i)?a$t(n,i):null)}const c$t={Alt:[18,e=>!!e.altKey],Control:[17,e=>!!e.ctrlKey],Shift:[16,e=>!!e.shiftKey],Meta:[91,e=>!!e.metaKey]},u$t={style:"cursor: crosshair"};function d$t(e={}){let[t,n]=c$t[e.key||"Alt"],i=eo.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?u$t:null})]}const DA="-10000px";class I3e{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(a=>a);let s=null;this.tooltipViews=this.tooltips.map(a=>s=i(a,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 a=[],l=n?[]:null;for(let c=0;cn[u]=c),n.length=l.length),this.input=r,this.tooltips=s,this.tooltipViews=a,!0}}function f$t(e){let t=e.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:t.clientHeight,right:t.clientWidth}}const R3=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)||f$t}}}),Rie=new WeakMap,yH=eo.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(R3);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 I3e(e,vH,(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(R3);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=DA,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 a=s.getBoundingClientRect();n=Math.abs(a.top+1e4)>1||Math.abs(a.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=pH(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,a)=>{let l=this.manager.tooltipViews[a];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(R3).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,a=[];for(let l=0;l=Math.min(n.bottom,i.bottom)||f.rightMath.min(n.right,i.right)+.1)){d.style.top=DA;continue}let m=c.arrow?u.dom.querySelector(".cm-tooltip-arrow"):null,g=m?7:0,b=h.right-h.left,v=(t=Rie.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",Iie(d,(w-e.parent.left)/r)):(d.style.top=k/s+"px",Iie(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&&a.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=DA}},{eventObservers:{scroll(){this.maybeMeasure()}}});function Iie(e,t){let n=parseInt(e.style.left,10);(isNaN(n)||Math.abs(t-n)>1)&&(e.style.left=t+"px")}const h$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},vH=an.define({enables:[yH,h$t]}),TR=an.define({combine:e=>e.reduce((t,n)=>t.concat(n),[])});class PD{static create(t){return new PD(t)}constructor(t){this.view=t,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new I3e(t,TR,(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 m$t=vH.compute([TR],e=>{let t=e.facet(TR);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:PD.create,above:t[0].above,arrow:t.some(n=>n.arrow)}}),P3e=an.define();class g$t{constructor(t,n,i,r,s,a){this.view=t,this.source=n,this.field=i,this.locked=r,this.setHover=s,this.hoverTime=a,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;ta.bottom||n.xa.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,a(c))},c=>ac(t.state,c,"hover tooltip"))}else a(s)}get tooltip(){let t=this.view.plugin(yH),n=t?t.manager.tooltips.findIndex(i=>i.create==PD.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&&!b$t(s.dom,t)||this.pending){let{pos:a}=r[0]||this.pending,l=(i=(n=r[0])===null||n===void 0?void 0:n.end)!==null&&i!==void 0?i:a;(a==l?this.view.posAtCoords(this.lastMove)!=a:!y$t(this.view,a,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 MA=4;function b$t(e,t){let{left:n,right:i,top:r,bottom:s}=e.getBoundingClientRect(),a;if(a=e.querySelector(".cm-tooltip-arrow")){let l=a.getBoundingClientRect();r=Math.min(l.top,r),s=Math.max(l.bottom,s)}return t.clientX>=n-MA&&t.clientX<=i+MA&&t.clientY>=r-MA&&t.clientY<=s+MA}function y$t(e,t,n,i,r,s){let a=e.scrollDOM.getBoundingClientRect(),l=e.documentTop+e.documentPadding.top+e.contentHeight;if(a.left>i||a.rightr||Math.min(a.bottom,l)=t&&c<=n}function v$t(e,t={}){let n=Gn.define(),i=new WeakMap,r=qa.define({create(){return[]},update(a,l){let c=i.get(a);if(a.length&&(t.hideOnChange&&(l.docChanged||l.selection)?a=[]:c&&c(l)?a=[]:t.hideOn&&(a=a.filter(u=>!t.hideOn(l,u)))),l.docChanged&&a.length){let u=[];for(let d of a){let f=l.changes.mapPos(d.pos,-1,La.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)}}a=u}for(let u of l.effects)u.is(n)&&(a=u.value,c=void 0),(u.is(w$t)&&!u.value||u.value==r)&&(a=[]);return a.length&&c&&i.set(a,c),a},provide:a=>TR.from(a)});const s=eo.define(a=>new g$t(a,e,r,i,n,t.hoverTime||300));return{active:r,extension:[r,s,P3e.of(s),m$t]}}function x$t(e,t,n,i={}){var r;let s=e.state.facet(P3e).map(a=>e.plugin(a)).filter(a=>!!a);if(i.tooltip&&i.tooltip.active){let a=s.find(l=>l.field==i.tooltip.active);a&&(s=[a])}for(let a of s)a.activateHover(e,t,n,(r=i.until)!==null&&r!==void 0?r:()=>!1)}function D3e(e,t){let n=e.plugin(yH);if(!n)return null;let i=n.manager.tooltips.indexOf(t);return i<0?null:n.manager.tooltipViews[i]}const w$t=Gn.define(),Pie=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 xH(e,t){let n=e.plugin(M3e),i=n?n.specs.indexOf(t):-1;return i>-1?n.panels[i]:null}const M3e=eo.fromClass(class{constructor(e){this.input=e.state.facet(ME),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(e));let t=e.state.facet(Pie);this.top=new LA(e,!0,t.topContainer),this.bottom=new LA(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(Pie);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new LA(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new LA(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=e.state.facet(ME);if(n!=this.input){let i=n.filter(c=>c),r=[],s=[],a=[],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:a).push(d)}this.specs=i,this.panels=r,this.top.sync(s),this.bottom.sync(a);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 LA{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=Die(t);t=t.nextSibling}else this.dom.insertBefore(n.dom,t);for(;t;)t=Die(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 Die(e){let t=e.nextSibling;return e.remove(),t}const ME=an.define({enables:M3e});function O$t(e,t){let n,i=new Promise(a=>n=a),r=a=>k$t(a,t,n);e.state.field(I3,!1)?e.dispatch({effects:L3e.of(r)}):e.dispatch({effects:Gn.appendConfig.of(I3.init(()=>[r]))});let s=$3e.of(r);return{close:s,result:i.then(a=>((e.win.queueMicrotask||(c=>e.win.setTimeout(c,10)))(()=>{e.state.field(I3).indexOf(r)>-1&&e.dispatch({effects:s})}),a))}}const I3=qa.define({create(){return[]},update(e,t){for(let n of t.effects)n.is(L3e)?e=[n.value].concat(e):n.is($3e)&&(e=e.filter(i=>i!=n.value));return e},provide:e=>ME.computeN([e],t=>t.field(e))}),L3e=Gn.define(),$3e=Gn.define();function k$t(e,t,n){let i=t.content?t.content(e,()=>a(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(),a(null)):u.keyCode==13&&(u.preventDefault(),a(c))}),c.addEventListener("submit",u=>{u.preventDefault(),a(c)})}let s=Ir("div",i,Ir("button",{onclick:()=>a(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 a(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 yp extends bg{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}yp.prototype.elementClass="";yp.prototype.toDOM=void 0;yp.prototype.mapMode=La.TrackBefore;yp.prototype.startSide=yp.prototype.endSide=-1;yp.prototype.point=!0;const xj=an.define(),S$t=an.define(),E$t={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Pi.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},hS=an.define();function C$t(e){return[F3e(),hS.of({...E$t,...e})]}const Mie=an.define({combine:e=>e.some(t=>t)});function F3e(e){return[T$t]}const T$t=eo.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(hS).map(t=>new $ie(e,t)),this.fixed=!e.state.facet(Mie);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(Mie)!=!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=Pi.iter(this.view.state.facet(xj),this.view.viewport.from),i=[],r=this.gutters.map(s=>new A$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 a=!0;for(let l of s.type)if(l.type==Ua.Text&&a){CB(n,i,l.from);for(let c of r)c.line(this.view,l,i);a=!1}else if(l.widget)for(let c of r)c.widget(this.view,l)}else if(s.type==Ua.Text){CB(n,i,s.from);for(let a of r)a.line(this.view,s,i)}else if(s.widget)for(let a of r)a.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(hS),n=e.state.facet(hS),i=e.docChanged||e.heightChanged||e.viewportChanged||!Pi.eq(e.startState.facet(xj),e.state.facet(xj),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 a=t.indexOf(s);a<0?r.push(new $ie(this.view,s)):(this.gutters[a].update(e),r.push(this.gutters[a]))}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 Lie(e){return Array.isArray(e)?e:[e]}function CB(e,t,n){for(;e.value&&e.from<=n;)e.from==n&&t.push(e.value),e.next()}class A$t{constructor(t,n,i){this.gutter=t,this.height=i,this.i=0,this.cursor=Pi.iter(t.markers,n.from)}addElement(t,n,i){let{gutter:r}=this,s=(n.top-this.height)/t.scaleY,a=n.height/t.scaleY;if(this.i==r.elements.length){let l=new B3e(t,a,s,i);r.elements.push(l),r.dom.appendChild(l.dom)}else r.elements[this.i].update(t,a,s,i);this.height=n.bottom,this.i++}line(t,n,i){let r=[];CB(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 a=this.gutter;r.length==0&&!a.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(S$t)){let a=s(t,n.widget,n);a&&(r||(r=[])).push(a)}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 $ie{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,a;if(s!=this.dom&&this.dom.contains(s)){for(;s.parentNode!=this.dom;)s=s.parentNode;let c=s.getBoundingClientRect();a=(c.top+c.bottom)/2}else a=r.clientY;let l=t.lineBlockAtHeight(a-t.documentTop);n.domEventHandlers[i](t,l,r)&&r.preventDefault()});this.markers=Lie(n.markers(t)),n.initialSpacer&&(this.spacer=new B3e(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=Lie(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!Pi.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 B3e{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":""),_$t(this.markers,r)||this.setMarkers(t,r)}setMarkers(t,n){let i="cm-gutterElement",r=this.dom.firstChild;for(let s=0,a=0;;){let l=a,c=ss(l,c,u)||a(l,c,u):a}return i}})}});class P3 extends yp{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}}function D3(e,t){return e.state.facet(Vv).formatNumber(t,e.state)}const R$t=hS.compute([Vv],e=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(t){return t.state.facet(j$t)},lineMarker(t,n,i){return i.some(r=>r.toDOM)?null:new P3(D3(t,t.state.doc.lineAt(n.from).number))},widgetMarker:(t,n,i)=>{for(let r of t.state.facet(N$t)){let s=r(t,n,i);if(s)return s}return null},lineMarkerChange:t=>t.startState.facet(Vv)!=t.state.facet(Vv),initialSpacer(t){return new P3(D3(t,Fie(t.state.doc.lines)))},updateSpacer(t,n){let i=D3(n.view,Fie(n.view.state.doc.lines));return i==t.number?t:new P3(i)},domEventHandlers:e.facet(Vv).domEventHandlers,side:"before"}));function U3e(e={}){return[Vv.of(e),F3e(),R$t]}function Fie(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(I$t.range(r)))}return Pi.of(t)});function D$t(){return P$t}let M$t=0,hf=class TB{constructor(t,n,i,r){this.name=t,this.set=n,this.base=i,this.modified=r,this.id=M$t++}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 TB&&(n=t),n!=null&&n.base)throw new Error("Can not derive from a modified tag");let r=new TB(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 AR(t);return i=>i.modified.indexOf(n)>-1?i:AR.get(i.base||i,i.modified.concat(n).sort((r,s)=>r.id-s.id))}},L$t=0;class AR{constructor(t){this.name=t,this.instances=[],this.id=L$t++}static get(t,n){if(!n.length)return t;let i=n[0].instances.find(l=>l.base==t&&$$t(n,l.modified));if(i)return i;let r=[],s=new hf(t.name,r,t,n);for(let l of n)l.instances.push(s);let a=F$t(n);for(let l of t.set)if(!l.modified.length)for(let c of a)r.push(AR.get(l,c));return s}}function $$t(e,t){return e.length==t.length&&e.every((n,i)=>n==t[i])}function F$t(e){let t=[[]];for(let n=0;ni.length-n.length)}function Np(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=[],a=2,l=r;for(let f=0;;){if(l=="..."&&f>0&&f+3==r.length){a=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=="!"){a=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 LE(i,a,c>0?s.slice(0,c):null);t[u]=d.sort(t[u])}}return Q3e.add(t)}const Q3e=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 LE(r.tags,r.mode,r.context);n?n.next=s:i=s,n=s}return i}});let LE=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 a=r;for(let l of s)for(let c of l.set){let u=n[c.id];if(u){a=a?a+" "+u:u;break}}return a},scope:i}}function B$t(e,t){let n=null;for(let i of e){let r=i.style(t);r&&(n=n?n+" "+r:r)}return n}function U$t(e,t,n,i=0,r=e.length){let s=new Q$t(i,Array.isArray(t)?t:[t],n);s.highlightRange(e.cursor(),i,r,"",s.highlighters),s.flush(r)}class Q$t{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:a,from:l,to:c}=t;if(l>=i||c<=n)return;a.isTop&&(s=this.highlighters.filter(m=>!m.scope||m.scope(a)));let u=r,d=z$t(t)||LE.empty,f=B$t(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 z$t(e){let t=e.type.prop(Q3e);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}const nn=hf.define,$A=nn(),um=nn(),Bie=nn(um),Uie=nn(um),dm=nn(),FA=nn(dm),M3=nn(dm),cf=nn(),ab=nn(cf),rf=nn(),sf=nn(),AB=nn(),kO=nn(AB),BA=nn(),oe={comment:$A,lineComment:nn($A),blockComment:nn($A),docComment:nn($A),name:um,variableName:nn(um),typeName:Bie,tagName:nn(Bie),propertyName:Uie,attributeName:nn(Uie),className:nn(um),labelName:nn(um),namespace:nn(um),macroName:nn(um),literal:dm,string:FA,docString:nn(FA),character:nn(FA),attributeValue:nn(FA),number:M3,integer:nn(M3),float:nn(M3),bool:nn(dm),regexp:nn(dm),escape:nn(dm),color:nn(dm),url:nn(dm),keyword:rf,self:nn(rf),null:nn(rf),atom:nn(rf),unit:nn(rf),modifier:nn(rf),operatorKeyword:nn(rf),controlKeyword:nn(rf),definitionKeyword:nn(rf),moduleKeyword:nn(rf),operator:sf,derefOperator:nn(sf),arithmeticOperator:nn(sf),logicOperator:nn(sf),bitwiseOperator:nn(sf),compareOperator:nn(sf),updateOperator:nn(sf),definitionOperator:nn(sf),typeOperator:nn(sf),controlOperator:nn(sf),punctuation:AB,separator:nn(AB),bracket:kO,angleBracket:nn(kO),squareBracket:nn(kO),paren:nn(kO),brace:nn(kO),content:cf,heading:ab,heading1:nn(ab),heading2:nn(ab),heading3:nn(ab),heading4:nn(ab),heading5:nn(ab),heading6:nn(ab),contentSeparator:nn(cf),list:nn(cf),quote:nn(cf),emphasis:nn(cf),strong:nn(cf),link:nn(cf),monospace:nn(cf),strikethrough:nn(cf),inserted:nn(),deleted:nn(),changed:nn(),invalid:nn(),meta:BA,documentMeta:nn(BA),annotation:nn(BA),processingInstruction:nn(BA),definition:hf.defineModifier("definition"),constant:hf.defineModifier("constant"),function:hf.defineModifier("function"),standard:hf.defineModifier("standard"),local:hf.defineModifier("local"),special:hf.defineModifier("special")};for(let e in oe){let t=oe[e];t instanceof hf&&(t.name=e)}z3e([{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 L3;const Nm=new Kn;function DD(e){return an.define({combine:e?t=>t.concat(e):void 0})}const wH=new Kn;class Gc{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=[wg.of(this),Ui.languageData.of((s,a,l)=>{let c=Qie(s,a,l),u=c.type.prop(Nm);if(!u)return[];let d=s.facet(u),f=c.type.prop(wH);if(f){let h=c.resolve(a-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 Qie(t,n,i).type.prop(Nm)==this.data}findRegions(t){let n=t.facet(wg);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,a)=>{if(s.prop(Nm)==this.data){i.push({from:a,to:a+s.length});return}let l=s.prop(Kn.mounted);if(l){if(l.tree.prop(Nm)==this.data){if(l.overlay)for(let c of l.overlay)i.push({from:c.from+a,to:c.to+a});else i.push({from:a,to:a+s.length});return}else if(l.overlay){let c=i.length;if(r(l.tree,l.overlay[0].from+a),i.length>c)return}}for(let c=0;ci.isTop?n:void 0)]}),t.name)}configure(t,n){return new vp(this.data,this.parser.configure(t),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Lr(e){let t=e.field(Gc.state,!1);return t?t.tree:Ci.empty}class V$t{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 SO=null;class Py{constructor(t,n,i=[],r,s,a,l,c){this.parser=t,this.state=n,this.fragments=i,this.tree=r,this.treeLen=s,this.viewport=a,this.skipped=l,this.scheduleOn=c,this.parse=null,this.tempSkipped=[]}static create(t,n,i){return new Py(t,n,[],Ci.empty,0,i,[],null)}startParse(){return this.parser.startParse(new V$t(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(ep.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let n=SO;SO=this;try{return t()}finally{SO=n}}withoutTempSkipped(t){for(let n;n=this.tempSkipped.pop();)t=zie(t,n.from,n.to);return t}changes(t,n){let{fragments:i,tree:r,treeLen:s,viewport:a,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=ep.applyChanges(i,c),r=Ci.empty,s=0,a={from:t.mapPos(a.from,-1),to:t.mapPos(a.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=zie(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 TD{createParse(n,i,r){let s=r[0].from,a=r[r.length-1].to;return{parsedPos:s,advance(){let c=SO;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=a,new Ci($o.none,[],[],a-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 SO}}function zie(e,t,n){return ep.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}class Ow{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 Ow(n)}static init(t){let n=Math.min(3e3,t.doc.length),i=Py.create(t.facet(wg).parser,t,{from:0,to:n});return i.work(20,n)||i.takeTree(),new Ow(i)}}Gc.state=qa.define({create:Ow.init,update(e,t){for(let n of t.effects)if(n.is(Gc.setState))return n.value;return t.startState.facet(wg)!=t.state.facet(wg)?Ow.init(t.state):e.apply(t)}});let V3e=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<"u"&&(V3e=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});const $3=typeof navigator<"u"&&(!((L3=navigator.scheduling)===null||L3===void 0)&&L3.isInputPending)?()=>navigator.scheduling.isInputPending():null,H$t=eo.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(Gc.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(Gc.state);(n.tree!=n.context.tree||!n.context.isDone(t.doc.length))&&(this.working=V3e(this.work))}work(t){this.working=null;let n=Date.now();if(this.chunkEndr+1e3,c=s.context.work(()=>$3&&$3()||Date.now()>a,r+(l?0:1e5));this.chunkBudget-=Date.now()-n,(c||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Gc.setState.of(new Ow(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=>ac(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()}}}),wg=an.define({combine(e){return e.length?e[0]:null},enables:e=>[Gc.state,H$t,Xt.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]});class Og{constructor(t,n=[]){this.language=t,this.support=n,this.extension=[t,n]}}class _R{constructor(t,n,i,r,s,a=void 0){this.name=t,this.alias=n,this.extensions=i,this.filename=r,this.loadFunc=s,this.support=a,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 _R(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 a=n.indexOf(s);if(a>-1&&(s.length>2||!/\w/.test(n[a-1])&&!/\w/.test(n[a+s.length])))return r}return null}}const q$t=an.define(),m1=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 Dy(e){let t=e.facet(m1);return t.charCodeAt(0)==9?e.tabSize*t.length:t.length}function $E(e,t){let n="",i=e.tabSize,r=e.facet(m1)[0];if(r==" "){for(;t>=i;)n+=" ",t-=i;r=" "}for(let s=0;s=t?W$t(e,n,t):null}class MD{constructor(t,n={}){this.state=t,this.options=n,this.unit=Dy(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+=a-this.countColumn(i,i.search(/\S|$/))),s}countColumn(t,n=t.length){return Md(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 a=s(r);if(a>-1)return a}return this.countColumn(i,i.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const Rp=new Kn;function W$t(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 a=r;a&&!(a.fromi.node.to||a.from==i.node.from&&a.type==i.node.type);a=a.parent)s.push(a);for(let a=s.length-1;a>=0;a--)i={node:s[a],next:i}}return H3e(i,e,n)}function H3e(e,t,n){for(let i=e;i;i=i.next){let r=G$t(i.node);if(r)return r(kH.create(t,n,i))}return 0}function K$t(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}function G$t(e){let t=e.type.prop(Rp);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 a=>q3e(a,!0,1,void 0,s&&!K$t(a)?r.from:void 0)}return e.parent==null?X$t:null}function X$t(){return 0}class kH extends MD{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 kH(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(Y$t(i,t))break;n=this.state.doc.lineAt(i.from)}return this.lineIndent(n.from)}continue(){return H3e(this.context.next,this.base,this.pos)}}function Y$t(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function Z$t(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),a=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>=a)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 Ox({closing:e,align:t=!0,units:n=1}){return i=>q3e(i,t,n,e)}function q3e(e,t,n,i,r){let s=e.textAfter,a=s.match(/^\s*/)[0].length,l=i&&s.slice(a,a+i.length)==i||r==e.pos+a,c=t?Z$t(e):null;return c?l?e.column(c.from):e.column(c.to):e.baseIndent+(l?0:e.unit*n)}const J$t=e=>e.baseIndent;function kx({except:e,units:t=1}={}){return n=>{let i=e&&e.test(n.textAfter);return n.baseIndent+(i?0:t*n.unit)}}const eFt=200;function tFt(){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+eFt)return e;let s=n.sliceString(r.from,i);if(!t.some(u=>u.test(s)))return e;let{state:a}=e,l=-1,c=[];for(let{head:u}of a.selection.ranges){let d=a.doc.lineAt(u);if(d.from==l)continue;l=d.from;let f=OH(a,d.from);if(f==null)continue;let h=/^\s*/.exec(d.text)[0],m=$E(a,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 W3e=an.define(),Ip=new Kn;function bT(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 iFt(e){let t=e.lastChild;return t&&t.to==e.to&&t.type.isError}function jR(e,t,n){for(let i of e.facet(W3e)){let r=i(e,t,n);if(r)return r}return nFt(e,t,n)}function K3e(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 LD=Gn.define({map:K3e}),yT=Gn.define({map:K3e});function G3e(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 My=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(LD)&&!rFt(e,i.value.from,i.value.to)?n.push(i.value):i.is(yT)&&(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(Z3e),r=n.map(s=>(i?Cn.replace({widget:new dFt(i(t.state,s))}):Hie).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 NR(e,t,n){var i;let r=null;return(i=e.field(My,!1))===null||i===void 0||i.between(t,n,(s,a)=>{(!r||r.from>s)&&(r={from:s,to:a})}),r}function rFt(e,t,n){let i=!1;return e.between(t,t,(r,s)=>{r==t&&s==n&&(i=!0)}),i}function X3e(e,t){return e.field(My,!1)?t:t.concat(Gn.appendConfig.of(J3e()))}const sFt=e=>{for(let t of G3e(e)){let n=jR(e.state,t.from,t.to);if(n)return e.dispatch({effects:X3e(e.state,[LD.of(n),Y3e(e,n)])}),!0}return!1},oFt=e=>{if(!e.state.field(My,!1))return!1;let t=[];for(let n of G3e(e)){let i=NR(e.state,n.from,n.to);i&&t.push(yT.of(i),Y3e(e,i,!1))}return t.length&&e.dispatch({effects:t}),t.length>0};function Y3e(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 aFt=e=>{let{state:t}=e,n=[];for(let i=0;i{let t=e.state.field(My,!1);if(!t||!t.size)return!1;let n=[];return t.between(0,e.state.doc.length,(i,r)=>{n.push(yT.of({from:i,to:r}))}),e.dispatch({effects:n}),!0},cFt=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:sFt},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:oFt},{key:"Ctrl-Alt-[",run:aFt},{key:"Ctrl-Alt-]",run:lFt}],uFt={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},Z3e=an.define({combine(e){return Xf(e,uFt)}});function J3e(e){return[My,pFt]}function e4e(e,t){let{state:n}=e,i=n.facet(Z3e),r=a=>{let l=e.lineBlockAt(e.posAtDOM(a.target)),c=NR(e.state,l.from,l.to);c&&e.dispatch({effects:yT.of(c)}),a.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 Hie=Cn.replace({widget:new class extends Hd{toDOM(e){return e4e(e,null)}}});class dFt extends Hd{constructor(t){super(),this.value=t}eq(t){return this.value==t.value}toDOM(t){return e4e(t,this.value)}}const fFt={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class F3 extends yp{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 hFt(e={}){let t={...fFt,...e},n=new F3(t,!0),i=new F3(t,!1),r=eo.fromClass(class{constructor(a){this.from=a.viewport.from,this.markers=this.buildMarkers(a)}update(a){(a.docChanged||a.viewportChanged||a.startState.facet(wg)!=a.state.facet(wg)||a.startState.field(My,!1)!=a.state.field(My,!1)||Lr(a.startState)!=Lr(a.state)||t.foldingChanged(a))&&(this.markers=this.buildMarkers(a.view))}buildMarkers(a){let l=new gp;for(let c of a.viewportLineBlocks){let u=NR(a.state,c.from,c.to)?i:jR(a.state,c.from,c.to)?n:null;u&&l.add(c.from,c.from,u)}return l.finish()}}),{domEventHandlers:s}=t;return[r,C$t({class:"cm-foldGutter",markers(a){var l;return((l=a.plugin(r))===null||l===void 0?void 0:l.markers)||Pi.empty},initialSpacer(){return new F3(t,!1)},domEventHandlers:{...s,click:(a,l,c)=>{if(s.click&&s.click(a,l,c))return!0;let u=NR(a.state,l.from,l.to);if(u)return a.dispatch({effects:yT.of(u)}),!0;let d=jR(a.state,l.from,l.to);return d?(a.dispatch({effects:LD.of(d)}),!0):!1}}}),J3e()]}const pFt=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 vT{constructor(t,n){this.specs=t;let i;function r(l){let c=yg.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,a=n.scope;this.scope=a instanceof Gc?l=>l.prop(Nm)==a.data:a?l=>l==a:void 0,this.style=z3e(t.map(l=>({tag:l.tag,class:l.class||r(Object.assign({},l,{tag:null}))})),{all:s}).style,this.module=i?new yg(i):null,this.themeType=n.themeType}static define(t,n){return new vT(t,n||{})}}const _B=an.define(),t4e=an.define({combine(e){return e.length?[e[0]]:null}});function wj(e){let t=e.facet(_B);return t.length?t:e.facet(t4e)}function n4e(e,t){let n=[gFt],i;return e instanceof vT&&(e.module&&n.push(Xt.styleModule.of(e.module)),i=e.themeType),t!=null&&t.fallback?n.push(t4e.of(e)):i?n.push(_B.computeN([Xt.darkTheme],r=>r.facet(Xt.darkTheme)==(i=="dark")?[e]:[])):n.push(_B.of(e)),n}function Ccn(e,t,n){let i=wj(e),r=null;if(i){for(let s of i)if(!s.scope||n){let a=s.style(t);a&&(r=r?r+" "+a:a)}}return r}class mFt{constructor(t){this.markCache=Object.create(null),this.tree=Lr(t.state),this.decorations=this.buildDeco(t,wj(t.state)),this.decoratedTo=t.viewport.to}update(t){let n=Lr(t.state),i=wj(t.state),r=i!=wj(t.startState),{viewport:s}=t.view,a=t.changes.mapPos(this.decoratedTo,1);n.length=s.to?(this.decorations=this.decorations.map(t.changes),this.decoratedTo=a):(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 gp;for(let{from:r,to:s}of t.visibleRanges)U$t(this.tree,n,(a,l,c)=>{i.add(a,l,this.markCache[c]||(this.markCache[c]=Cn.mark({class:c})))},r,s);return i.finish()}}const gFt=jp.high(eo.fromClass(mFt,{decorations:e=>e.decorations})),bFt=vT.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"}]),yFt=Xt.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),i4e=1e4,r4e="()[]{}",s4e=an.define({combine(e){return Xf(e,{afterCursor:!0,brackets:r4e,maxScanDistance:i4e,renderMatch:wFt})}}),vFt=Cn.mark({class:"cm-matchingBracket"}),xFt=Cn.mark({class:"cm-nonmatchingBracket"});function wFt(e){let t=[],n=e.matched?vFt:xFt;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 qie(e){let t=[],n=e.facet(s4e);for(let i of e.selection.ranges){if(!i.empty)continue;let r=Cf(e,i.head,-1,n)||i.head>0&&Cf(e,i.head-1,1,n)||n.afterCursor&&(Cf(e,i.head,1,n)||i.heade.decorations}),kFt=[OFt,yFt];function SFt(e={}){return[s4e.of(e),kFt]}const o4e=new Kn;function jB(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 NB(e){let t=e.type.prop(o4e);return t?t(e.node):e}function Cf(e,t,n,i={}){let r=i.maxScanDistance||i4e,s=i.brackets||r4e,a=Lr(e),l=a.resolveInner(t,n);for(let c=l;c;c=c.parent){let u=jB(c.type,n,s);if(u&&c.from0?t>=d.from&&td.from&&t<=d.to))return EFt(e,t,n,c,d,u,s)}}return CFt(e,t,n,a,l.type,r,s)}function EFt(e,t,n,i,r,s,a){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=a.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 Wie(e,t,n,i=0,r=0){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));let s=r;for(let a=i;a=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?a.toLowerCase():a,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 TFt(e){return{name:e.name||"",token:e.token,blankLine:e.blankLine||(()=>{}),startState:e.startState||(()=>!0),copyState:e.copyState||AFt,indent:e.indent||(()=>null),languageData:e.languageData||{},tokenTable:e.tokenTable||CH,mergeTokens:e.mergeTokens!==!1}}function AFt(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 SH extends Gc{constructor(t){let n=DD(t.languageData),i=TFt(t),r,s=new class extends TD{createParse(a,l,c){return new jFt(r,a,l,c)}};super(n,s,[],t.name),this.topNode=IFt(n,this),r=this,this.streamParser=i,this.stateAfter=new Kn({perNode:!0}),this.tokenTable=t.tokenTable?new d4e(i.tokenTable):RFt}static define(t){return new SH(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 a=t.children.length-1;a>=0;a--){let l=t.children[a],c=n+t.positions[a],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 a=t.positions[s],l=t.children[s],c;if(an&&EH(e,s.tree,0-s.offset,n,l),u;if(c&&c.pos<=i&&(u=l4e(e,s.tree,n+s.offset,c.pos+s.offset,!1)))return{state:c.state,tree:u}}return{state:e.streamParser.startState(r?Dy(r):4),tree:Ci.empty}}let jFt=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=Py.get(),a=r[0].from,{state:l,tree:c}=_Ft(t,i,a,this.to,s==null?void 0:s.state);this.state=l,this.parsedPos=this.chunkStart=a+c.length;for(let u=0;uu.from<=s.viewport.from&&u.to>=s.viewport.from)&&(this.state=this.lang.streamParser.startState(Dy(s.state)),s.skipUntilInView(this.parsedPos,s.viewport.from),this.parsedPos=s.viewport.from),this.moveRangeIndex()}advance(){let t=Py.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 a=this.ranges[r].from,l=this.lineAfter(a);n+=l,i=a+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 a=this.ranges[++this.rangeIndex].from;n+=a-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 a=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&s==4&&a>=0&&this.chunk[a]==t&&this.chunk[a+2]==n?this.chunk[a+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,a=new a4e(n,t?t.state.tabSize:4,t?Dy(t.state):2);if(a.eol())s.blankLine(this.state,a.indentUnit);else for(;!a.eol();){let l=c4e(s.token,a,this.state);if(l&&(r=this.emitToken(this.lang.tokenTable.resolve(l),this.parsedPos+a.start,this.parsedPos+a.pos,r)),a.start>1e4)break}this.parsedPos=i,this.moveRangeIndex(),this.parsedPost.start)return r}throw new Error("Stream parser failed to advance stream.")}const CH=Object.create(null),FE=[$o.none],NFt=new h1(FE),Gie=[],Xie=Object.create(null),u4e=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"]])u4e[e]=f4e(CH,t);class d4e{constructor(t){this.extra=t,this.table=Object.assign(Object.create(null),u4e)}resolve(t){return t?this.table[t]||(this.table[t]=f4e(this.extra,t)):0}}const RFt=new d4e(CH);function B3(e,t){Gie.indexOf(e)>-1||(Gie.push(e),console.warn(t))}function f4e(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):B3(u,`Modifier ${u} used at start of tag`):c.length?B3(u,`Tag ${u} used as modifier`):c=Array.isArray(d)?d:[d]:B3(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=Xie[r];if(s)return s.id;let a=Xie[r]=$o.define({id:FE.length,name:i,props:[Np({[i]:n})]});return FE.push(a),a.id}function IFt(e,t){let n=$o.define({id:FE.length,name:"Document",props:[Nm.add(()=>e),Rp.add(()=>i=>t.getIndent(i))],top:!0});return FE.push(n),n}Qr.RTL,Qr.LTR;var Yie={};class RR{constructor(t,n,i,r,s,a,l,c,u,d=0,f){this.p=t,this.stack=n,this.state=i,this.reducePos=r,this.pos=s,this.score=a,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 RR(t,[],n,i,i,0,[],0,r?new Zie(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,a=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[a-4]==0&&this.buffer[a-1]>-1){if(n==i)return;if(this.buffer[a-2]>=n){this.buffer[a-2]=i;return}}}if(!s||this.pos==i)this.buffer.push(t,n,i,r);else{let a=this.buffer.length;if(a>0&&(this.buffer[a-4]!=0||this.buffer[a-1]<0)){let l=!1;for(let c=a;c>0&&this.buffer[c-2]>i;c-=4)if(this.buffer[c-1]>=0){l=!0;break}if(l)for(;a>0&&this.buffer[a-2]>i;)this.buffer[a]=this.buffer[a-4],this.buffer[a+1]=this.buffer[a-3],this.buffer[a+2]=this.buffer[a-2],this.buffer[a+3]=this.buffer[a-1],a-=4,r>4&&(r-=4)}this.buffer[a]=t,this.buffer[a+1]=n,this.buffer[a+2]=i,this.buffer[a+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:a}=this.p;this.pos=r;let l=a.stateFlag(s,1);!l&&(r>i||n<=a.maxNode)&&(this.reducePos=r),this.pushState(s,l?i:Math.min(i,this.reducePos)),this.shiftContext(n,i),n<=a.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 RR(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 PFt(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,a;sc&1&&l==a)||r.push(n[s],a)}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 a=this.findForcedReduction();if(a==null)return!1;n=a}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,a=>{if(!(a&393216))if(a&65536){let l=(a>>19)-s;if(l>1){let c=a&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(a,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 Zie{constructor(t,n){this.tracker=t,this.context=n,this.hash=t.strict?t.hash(n):0}}class PFt{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 IR{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 IR(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 IR(this.stack,this.pos,this.index)}}function hk(e,t=Uint16Array){if(typeof e!="string")return e;let n=null;for(let i=0,r=0;i=92&&a--,a>=34&&a--;let c=a-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 Oj{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Jie=new Oj;class DFt{constructor(t,n){this.input=t,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Jie,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 a=this.ranges[++r];s+=a.from-i.to,i=a}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=Jie,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 Sx{constructor(t,n){this.data=t,this.id=n}token(t,n){let{parser:i}=n.p;h4e(this.data,t,n,this.id,i.data,i.tokenPrecTable)}}Sx.prototype.contextual=Sx.prototype.fallback=Sx.prototype.extend=!1;class PR{constructor(t,n,i){this.precTable=n,this.elseToken=i,this.data=typeof t=="string"?hk(t):t}token(t,n){let i=t.pos,r=0;for(;;){let s=t.next<0,a=t.resolveOffset(1,1);if(h4e(this.data,t,n,0,this.data,this.precTable),t.token.value>-1)break;if(this.elseToken==null)return;if(s||r++,a==null)break;t.reset(a,t.token)}r&&(t.reset(i,t.token),t.acceptToken(this.elseToken,r))}}PR.prototype.contextual=Sx.prototype.fallback=Sx.prototype.extend=!1;class Oo{constructor(t,n={}){this.token=t,this.contextual=!!n.contextual,this.fallback=!!n.fallback,this.extend=!!n.extend}}function h4e(e,t,n,i,r,s){let a=0,l=1<0){let g=e[m];if(c.allows(g)&&(t.token.value==-1||t.token.value==g||MFt(g,t.token.value,r,s))){t.acceptToken(g);break}}let d=t.next,f=0,h=e[a+2];if(t.next<0&&h>f&&e[u+h*3-3]==65535){a=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{a=e[g+2],t.advance();continue e}}break}}function ere(e,t,n){for(let i=t,r;(r=e[i])!=65535;i++)if(r==n)return i-t;return-1}function MFt(e,t,n,i){let r=ere(n,i,t);return r<0||ere(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 LFt=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?tre(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?tre(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=a,null;if(s instanceof Ei){if(a==t){if(a=Math.max(this.safeFrom,t)&&(this.trees.push(s),this.start.push(a),this.index.push(0))}else this.index[n]++,this.nextStart=a+s.length}}};class $Ft{constructor(t,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map(i=>new Oj)}getActions(t){let n=0,i=null,{parser:r}=t.p,{tokenizers:s}=r,a=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 Oj,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 Oj,{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 a=0;a=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 LFt(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[a]=t;for(;a.forceReduce()&&a.stack.length&&a.stack[a.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let a=0;an)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 a=r&&UFt(r);if(a)return jc&&console.log("Finish with "+this.stackID(a)),this.stackToTree(a);if(this.parser.strict)throw jc&&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 a=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,s,i);if(a)return jc&&console.log("Force-finish "+this.stackID(a)),this.stackToTree(a.forceAll())}if(this.recovering){let a=this.recovering==1?1:this.recovering*3;if(i.length>a)for(i.sort((l,c)=>c.score-l.score);i.length>a;)i.pop();i.some(l=>l.reducePos>n)&&this.recovering--}else if(i.length>1){e:for(let a=0;a500&&u.buffer.length>500)if((l.score-u.score||l.buffer.length-u.buffer.length)>0)i.splice(c--,1);else{i.splice(a--,1);continue e}}}i.length>12&&(i.sort((a,l)=>l.score-a.score),i.splice(12,i.length-12))}this.minStackPos=i[0].pos;for(let a=1;a ":"";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),jc&&console.log(a+this.stackID(t)+` (via reuse of ${s.getName(f.type.id)})`),!0;if(!(f instanceof Ei)||f.children.length==0||f.positions[0]>0)break;let m=f.children[0];if(m instanceof Ei&&f.positions[0]==0)f=m;else break}}let l=s.stateSlot(t.state,4);if(l>0)return t.reduce(l),jc&&console.log(a+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 nre(t,n),!0}}runRecovery(t,n,i){let r=null,s=!1;for(let a=0;a ":"";if(l.deadEnd&&(s||(s=!0,l.restart(),jc&&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()&&(jc&&console.log(h+this.stackID(f)+" (via force-reduce)"),!this.advanceFully(f,i));m++)jc&&(h=this.stackID(f)+" -> ");for(let m of l.recoverByInsert(c))jc&&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),jc&&console.log(d+this.stackID(l)+` (via recover-delete ${this.parser.getName(c)})`),nre(l,i)):(!r||r.scoree;class $D{constructor(t){this.start=t.start,this.shift=t.shift||Q3,this.reduce=t.reduce||Q3,this.reuse=t.reuse||Q3,this.hash=t.hash||(()=>0),this.strict=t.strict!==!1}}class xp extends TD{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 h1(n.map((l,c)=>$o.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=dLe;let a=hk(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 Sx(a,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 FFt(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 a=r[s++],l=a&1,c=r[s++];if(l&&i)return c;for(let u=s+(a>>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=Ah(this.data,s+2);else break;r=n(Ah(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=Ah(this.data,i+2);else break;if(!(this.data[i+2]&1)){let r=this.data[i+1];n.some((s,a)=>a&1&&s==r)||n.push(this.data[i],r)}}return n}configure(t){let n=Object.assign(Object.create(xp.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 a=Object.assign(Object.assign({},i),{external:s.to});return n.specializers[r]=ire(a),a})),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 a=n.indexOf(s);a>=0&&(i[a]=!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 QFt=316,zFt=317,rre=1,VFt=2,HFt=3,qFt=4,WFt=318,KFt=320,GFt=321,XFt=5,YFt=6,ZFt=0,RB=[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],p4e=125,JFt=59,IB=47,e8t=42,t8t=43,n8t=45,i8t=60,r8t=44,s8t=63,o8t=46,a8t=91,l8t=new $D({start:!1,shift(e,t){return t==XFt||t==YFt||t==KFt?e:t==GFt},strict:!1}),c8t=new Oo((e,t)=>{let{next:n}=e;(n==p4e||n==-1||t.context)&&e.acceptToken(WFt)},{contextual:!0,fallback:!0}),u8t=new Oo((e,t)=>{let{next:n}=e,i;RB.indexOf(n)>-1||n==IB&&((i=e.peek(1))==IB||i==e8t)||n!=p4e&&n!=JFt&&n!=-1&&!t.context&&e.acceptToken(QFt)},{contextual:!0}),d8t=new Oo((e,t)=>{e.next==a8t&&!t.context&&e.acceptToken(zFt)},{contextual:!0}),f8t=new Oo((e,t)=>{let{next:n}=e;if(n==t8t||n==n8t){if(e.advance(),n==e.next){e.advance();let i=!t.context&&t.canShift(rre);e.acceptToken(i?rre:VFt)}}else n==s8t&&e.peek(1)==o8t&&(e.advance(),e.advance(),(e.next<48||e.next>57)&&e.acceptToken(HFt))},{contextual:!0});function z3(e,t){return e>=65&&e<=90||e>=97&&e<=122||e==95||e>=192||!t&&e>=48&&e<=57}const h8t=new Oo((e,t)=>{if(e.next!=i8t||!t.dialectEnabled(ZFt)||(e.advance(),e.next==IB))return;let n=0;for(;RB.indexOf(e.next)>-1;)e.advance(),n++;if(z3(e.next,!0)){for(e.advance(),n++;z3(e.next,!1);)e.advance(),n++;for(;RB.indexOf(e.next)>-1;)e.advance(),n++;if(e.next==r8t)return;for(let i=0;;i++){if(i==7){if(!z3(e.next,!0))return;break}if(e.next!="extends".charCodeAt(i))break;e.advance(),n++}}e.acceptToken(qFt,-n)}),p8t=Np({"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)}),m8t={__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},g8t={__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},b8t={__proto__:null,"<":193},y8t=xp.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:l8t,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:[p8t],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:[u8t,d8t,f8t,h8t,2,3,4,5,6,7,8,9,10,11,12,13,14,c8t,new PR("$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 PR("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=>m8t[e]||-1},{term:343,get:e=>g8t[e]||-1},{term:95,get:e=>b8t[e]||-1}],tokenPrec:15201});class TH{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(g4e(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 sre(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 v8t(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+$/]:v8t(t);return r=>{let s=r.matchBefore(i);return s||r.explicit?{from:s?s.from:r.pos,options:t,validFor:n}:null}}function m4e(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 ore{constructor(t,n,i,r){this.completion=t,this.source=n,this.match=i,this.score=r}}function ay(e){return e.selection.main.from}function g4e(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 _H=Gf.define();function x8t(e,t,n,i){let{main:r}=e.selection,s=n-r.from,a=i-r.from;return{...e.changeByRange(l=>{if(l!=r&&n!=i&&e.sliceDoc(l.from+s,l.from+a)!=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+a,insert:c},range:ut.cursor(l.from+s+c.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const are=new WeakMap;function w8t(e){if(!Array.isArray(e))return e;let t=are.get(e);return t||are.set(e,t=AH(e)),t}const DR=Gn.define(),BE=Gn.define();class O8t{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=nH(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)?a[f++]=x:a.length&&(y=!1)),O=C,x+=gf(S)}return f==c&&a[0]==0&&y?this.result(-100+(h?-200:0),a,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),a,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 a of n){let l=a+(this.astral?gf(ec(i,a)):1);s&&r[s-1]==a?r[s-1]=l:(r[s++]=a,r[s++]=l)}return this.ret(t-i.length,r)}}class k8t{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:S8t,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=>lre(t(i),n(i)),optionClass:(t,n)=>i=>lre(t(i),n(i)),addToOptions:(t,n)=>t.concat(n),filterStrict:(t,n)=>t||n})}});function lre(e,t){return e?t?e+" "+t:e:t}function S8t(e,t,n,i,r,s){let a=e.textDirection==Qr.RTL,l=a,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?a?"left-narrow":"right-narrow":l?"left":"right")}}const jH=Gn.define();function E8t(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 a=document.createElement("span");a.className="cm-completionLabel";let l=n.displayLabel||n.label,c=0;for(let u=0;uc&&a.appendChild(document.createTextNode(l.slice(c,d)));let h=a.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 V3(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 C8t{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:a}=r.open,l=t.state.facet(ya);this.optionContent=E8t(l),this.optionClass=l.optionClass,this.tooltipClass=l.tooltipClass,this.range=V3(s.length,a,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:jH.of(d)}),c.preventDefault())}}),this.dom.addEventListener("focusout",c=>{let u=t.state.field(this.stateField,!1);u&&u.tooltip&&t.state.facet(ya).closeOnBlur&&c.relatedTarget!=t.contentDOM&&t.dispatch({effects:BE.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:a,disabled:l}=i.open;(!r.open||r.open.options!=s)&&(this.range=V3(s.length,a,t.state.facet(ya).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=V3(n.options.length,n.selected,this.view.state.facet(ya).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 a=typeof s=="string"?document.createTextNode(s):s(r);if(!a)return;"then"in a?a.then(l=>{l&&this.view.state.field(this.stateField,!1)==t&&this.addInfoPane(l,r)}).catch(l=>ac(this.view.state,l,"completion info")):(this.addInfoPane(a,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&&A8t(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 a=this.dom.ownerDocument.documentElement;s={left:0,top:0,right:a.clientWidth,bottom:a.clientHeight}}return r.top>Math.min(s.bottom,n.bottom)-10||r.bottom{a.target==r&&a.preventDefault()});let s=null;for(let a=i.from;ai.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+"-"+a,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 C8t(n,e,t)}function A8t(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 cre(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}function _8t(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)}},a=t.facet(ya);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 ore(h,d.source,f?f(h):[],1e9-n.length));else{let h=t.sliceDoc(d.from,d.to),m,g=a.filterStrict?new k8t(h):new O8t(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 ore(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):cre(d.completion)>cre(c)&&(l[l.length-1]=d),c=d.completion}return l}class Hv{constructor(t,n,i,r,s,a){this.options=t,this.attrs=n,this.tooltip=i,this.timestamp=r,this.selected=s,this.disabled=a}setSelected(t,n){return t==this.selected||t>=this.options.length?this:new Hv(this.options,ure(n,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,n,i,r,s,a){if(r&&!a&&t.some(u=>u.isPending))return r.setDisabled();let l=_8t(t,n);if(!l.length)return r&&t.some(u=>u.isPending)?r.setDisabled():null;let c=n.facet(ya).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:D8t,above:s.aboveCursor},r?r.timestamp:Date.now(),c,!1)}map(t){return new Hv(this.options,this.attrs,{...this.tooltip,pos:t.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new Hv(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class MR{constructor(t,n,i){this.active=t,this.id=n,this.open=i}static start(){return new MR(I8t,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:n}=t,i=n.facet(ya),s=(i.override||n.languageDataAt("autocomplete",ay(n)).map(w8t)).map(c=>(this.active.find(d=>d.source==c)||new Fu(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 a=this.open,l=t.effects.some(c=>c.is(NH));a&&t.docChanged&&(a=a.map(t.changes)),t.selection||s.some(c=>c.hasResult()&&t.changes.touchesRange(c.from,c.to))||!j8t(s,this.active)||l?a=Hv.build(s,n,this.id,a,i,l):a&&a.disabled&&!s.some(c=>c.isPending)&&(a=null),!a&&s.every(c=>!c.isPending)&&s.some(c=>c.hasResult())&&(s=s.map(c=>c.hasResult()?new Fu(c.source,0):c));for(let c of t.effects)c.is(jH)&&(a=a&&a.setSelected(c.value,this.id));return s==this.active&&a==this.open?this:new MR(s,this.id,a)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?N8t:R8t}}function j8t(e,t){if(e==t)return!0;for(let n=0,i=0;;){for(;n-1&&(n["aria-activedescendant"]=e+"-"+t),n}const I8t=[];function b4e(e,t){if(e.isUserEvent("input.complete")){let i=e.annotation(_H);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 Fu{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=b4e(t,n),r=this;(i&8||i&16&&this.touches(t))&&(r=new Fu(r.source,0)),i&4&&r.state==0&&(r=new Fu(this.source,1)),r=r.updateFor(t,i);for(let s of t.effects)if(s.is(DR))r=new Fu(r.source,1,s.value);else if(s.is(BE))r=new Fu(r.source,0);else if(s.is(NH))for(let a of s.value)a.source==r.source&&(r=a);return r}updateFor(t,n){return this.map(t.changes)}map(t){return this}touches(t){return t.changes.touchesRange(ay(t.state))}}class Ex extends Fu{constructor(t,n,i,r,s,a){super(t,3,n),this.limit=i,this.result=r,this.from=s,this.to=a}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),a=t.changes.mapPos(this.to,1),l=ay(t.state);if(l>a||!r||n&2&&(ay(t.startState)==this.from||ln.map(t))}}),tc=qa.define({create(){return MR.start()},update(e,t){return e.update(t)},provide:e=>[vH.from(e,t=>t.tooltip),Xt.contentAttributes.from(e,t=>t.attrs)]});function RH(e,t){const n=t.completion.apply||t.completion.label;let i=e.state.field(tc).active.find(r=>r.source==t.source);return i instanceof Ex?(typeof n=="string"?e.dispatch({...x8t(e.state,n,i.from,i.to),annotations:_H.of(t.completion)}):n(e,t.completion,i.from,i.to),!0):!1}const D8t=T8t(tc,RH);function UA(e,t="option"){return n=>{let i=n.state.field(tc,!1);if(!i||!i.open||i.open.disabled||Date.now()-i.open.timestamp-1?i.open.selected+r*(e?1:-1):e?0:a-1;return l<0?l=t=="page"?0:a-1:l>=a&&(l=t=="page"?a-1:0),n.dispatch({effects:jH.of(l)}),!0}}const M8t=e=>{let t=e.state.field(tc,!1);return e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestampe.state.field(tc,!1)?(e.dispatch({effects:DR.of(!0)}),!0):!1,L8t=e=>{let t=e.state.field(tc,!1);return!t||!t.active.some(n=>n.state!=0)?!1:(e.dispatch({effects:BE.of(null)}),!0)};class $8t{constructor(t,n){this.active=t,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const F8t=50,B8t=1e3,U8t=eo.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(tc).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(tc),n=e.state.facet(ya);if(!e.selectionSet&&!e.docChanged&&e.startState.field(tc)==t)return;let i=e.transactions.some(s=>{let a=b4e(s,n);return a&8||(s.selection||s.docChanged)&&!(a&3)});for(let s=0;sF8t&&Date.now()-a.time>B8t){for(let l of a.context.abortListeners)try{l()}catch(c){ac(this.view.state,c)}a.context.abortListeners=null,this.running.splice(s--,1)}else a.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),e.transactions.some(s=>s.effects.some(a=>a.is(DR)))&&(this.pendingStart=!0);let r=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=t.active.some(s=>s.isPending&&!this.running.some(a=>a.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(tc);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(ya).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=ay(t),i=new TH(t,n,e.explicit,this.view),r=new $8t(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:BE.of(null)}),ac(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(ya).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],n=this.view.state.facet(ya),i=this.view.state.field(tc);for(let r=0;rl.source==s.active.source);if(a&&a.isPending)if(s.done==null){let l=new Fu(s.active.source,0);for(let c of s.updates)l=l.update(c,n);l.isPending||t.push(l)}else this.startQuery(a)}(t.length||i.open&&i.open.disabled)&&this.view.dispatch({effects:NH.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field(tc,!1);if(t&&t.tooltip&&this.view.state.facet(ya).closeOnBlur){let n=t.open&&D3e(this.view,t.open.tooltip);(!n||!n.dom.contains(e.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:BE.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:DR.of(!1)}),20),this.composing=0}}}),Q8t=typeof navigator=="object"&&/Win/.test(navigator.platform),z8t=jp.highest(Xt.domEventHandlers({keydown(e,t){let n=t.state.field(tc,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&!(Q8t&&e.altKey)||e.metaKey)return!1;let i=n.open.options[n.open.selected],r=n.active.find(a=>a.source==i.source),s=i.completion.commitCharacters||r.result.commitCharacters;return s&&s.indexOf(e.key)>-1&&RH(t,i),!1}})),y4e=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 V8t{constructor(t,n,i,r){this.field=t,this.line=n,this.from=i,this.to=r}}class IH{constructor(t,n,i){this.field=t,this.from=n,this.to=i}map(t){let n=t.mapPos(this.from,-1,La.TrackDel),i=t.mapPos(this.to,1,La.TrackDel);return n==null||i==null?null:new IH(this.field,n,i)}}class PH{constructor(t,n){this.lines=t,this.fieldPositions=n}instantiate(t,n){let i=[],r=[n],s=t.doc.lineAt(n),a=/^\s*/.exec(s.text)[0];for(let c of this.lines){if(i.length){let u=a,d=/^\t*/.exec(c)[0].length;for(let f=0;fnew IH(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 a of t.split(/\r\n?|\n/)){for(;s=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(a);){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 V8t(u,i.length,s.index,s.index+d.length)),a=a.slice(0,s.index)+c+a.slice(s.index+s[0].length)}a=a.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(a)}return new PH(i,r)}}let H8t=Cn.widget({widget:new class extends Hd{toDOM(){let e=document.createElement("span");return e.className="cm-snippetFieldPosition",e}ignoreEvent(){return!1}}}),q8t=Cn.mark({class:"cm-snippetField"});class g1{constructor(t,n){this.ranges=t,this.active=n,this.deco=Cn.set(t.map(i=>(i.from==i.to?H8t:q8t).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 g1(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 xT=Gn.define({map(e,t){return e&&e.map(t)}}),W8t=Gn.define(),UE=qa.define({create(){return null},update(e,t){for(let n of t.effects){if(n.is(xT))return n.value;if(n.is(W8t)&&e)return new g1(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 K8t(e){let t=PH.parse(e);return(n,i,r,s)=>{let{text:a,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(a)},scrollIntoView:!0,annotations:i?[_H.of(i),Mo.userEvent.of("input.complete")]:void 0};if(l.length&&(u.selection=DH(l,0)),l.some(d=>d.field>0)){let d=new g1(l,0),f=u.effects=[xT.of(d)];n.state.field(UE,!1)===void 0&&f.push(Gn.appendConfig.of([UE,J8t,eBt,y4e]))}n.dispatch(n.state.update(u))}}function v4e(e){return({state:t,dispatch:n})=>{let i=t.field(UE,!1);if(!i||e<0&&i.active==0)return!1;let r=i.active+e,s=e>0&&!i.ranges.some(a=>a.field==r+e);return n(t.update({selection:DH(i.ranges,r),effects:xT.of(s?null:new g1(i.ranges,r)),scrollIntoView:!0})),!0}}const G8t=({state:e,dispatch:t})=>e.field(UE,!1)?(t(e.update({effects:xT.of(null)})),!0):!1,X8t=v4e(1),Y8t=v4e(-1),Z8t=[{key:"Tab",run:X8t,shift:Y8t},{key:"Escape",run:G8t}],dre=an.define({combine(e){return e.length?e[0]:Z8t}}),J8t=jp.highest(p1.compute([dre],e=>e.facet(dre)));function Ms(e,t){return{...t,apply:K8t(e)}}const eBt=Xt.domEventHandlers({mousedown(e,t){let n=t.state.field(UE,!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:xT.of(n.ranges.some(s=>s.field>r.field)?new g1(n.ranges,r.field):null),scrollIntoView:!0}),!0)}}),QE={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},zb=Gn.define({map(e,t){let n=t.mapPos(e,-1,La.TrackAfter);return n??void 0}}),MH=new class extends bg{};MH.startSide=1;MH.endSide=-1;const x4e=qa.define({create(){return Pi.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(zb)&&(e=e.update({add:[MH.range(n.value,n.value+1)]}));return e}});function tBt(){return[iBt,x4e]}const q3="()[]{}<>«»»«[]{}";function w4e(e){for(let t=0;t{if((nBt?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let r=e.state.selection.main;if(i.length>2||i.length==2&&gf(ec(i,0))==1||t!=r.from||n!=r.to)return!1;let s=oBt(e.state,i);return s?(e.dispatch(s),!0):!1}),rBt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let i=O4e(e,e.selection.main.head).brackets||QE.brackets,r=null,s=e.changeByRange(a=>{if(a.empty){let l=aBt(e.doc,a.head);for(let c of i)if(c==l&&FD(e.doc,a.head)==w4e(ec(c,0)))return{changes:{from:a.head-c.length,to:a.head+c.length},range:ut.cursor(a.head-c.length)}}return{range:r=a}});return r||t(e.update(s,{scrollIntoView:!0,userEvent:"delete.backward"})),!r},sBt=[{key:"Backspace",run:rBt}];function oBt(e,t){let n=O4e(e,e.selection.main.head),i=n.brackets||QE.brackets;for(let r of i){let s=w4e(ec(r,0));if(t==r)return s==r?uBt(e,r,i.indexOf(r+r+r)>-1,n):lBt(e,r,s,n.before||QE.before);if(t==s&&k4e(e,e.selection.main.from))return cBt(e,r,s)}return null}function k4e(e,t){let n=!1;return e.field(x4e).between(0,e.doc.length,i=>{i==t&&(n=!0)}),n}function FD(e,t){let n=e.sliceString(t,t+2);return n.slice(0,gf(ec(n,0)))}function aBt(e,t){let n=e.sliceString(t-2,t);return gf(ec(n,0))==n.length?n:n.slice(1)}function lBt(e,t,n,i){let r=null,s=e.changeByRange(a=>{if(!a.empty)return{changes:[{insert:t,from:a.from},{insert:n,from:a.to}],effects:zb.of(a.to+t.length),range:ut.range(a.anchor+t.length,a.head+t.length)};let l=FD(e.doc,a.head);return!l||/\s/.test(l)||i.indexOf(l)>-1?{changes:{insert:t+n,from:a.head},effects:zb.of(a.head+t.length),range:ut.cursor(a.head+t.length)}:{range:r=a}});return r?null:e.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function cBt(e,t,n){let i=null,r=e.changeByRange(s=>s.empty&&FD(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 uBt(e,t,n,i){let r=i.stringPrefixes||QE.stringPrefixes,s=null,a=e.changeByRange(l=>{if(!l.empty)return{changes:[{insert:t,from:l.from},{insert:t,from:l.to}],effects:zb.of(l.to+t.length),range:ut.range(l.anchor+t.length,l.head+t.length)};let c=l.head,u=FD(e.doc,c),d;if(u==t){if(fre(e,c))return{changes:{insert:t+t,from:c},effects:zb.of(c+t.length),range:ut.cursor(c+t.length)};if(k4e(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=hre(e,c-2*t.length,r))>-1&&fre(e,d))return{changes:{insert:t+t+t+t,from:c},effects:zb.of(c+t.length),range:ut.cursor(c+t.length)};if(e.charCategorizer(c)(u)!=Ts.Word&&hre(e,c,r)>-1&&!dBt(e,c,t,r))return{changes:{insert:t+t,from:c},effects:zb.of(c+t.length),range:ut.cursor(c+t.length)}}return{range:s=l}});return s?null:e.update(a,{scrollIntoView:!0,userEvent:"input.type"})}function fre(e,t){let n=Lr(e).resolveInner(t+1);return n.parent&&n.from==t}function dBt(e,t,n,i){let r=Lr(e).resolveInner(t,-1),s=i.reduce((a,l)=>Math.max(a,l.length),0);for(let a=0;a<5;a++){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 hre(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 fBt(e={}){return[z8t,tc,ya.of(e),U8t,hBt,y4e]}const S4e=[{key:"Ctrl-Space",run:H3},{mac:"Alt-`",run:H3},{mac:"Alt-i",run:H3},{key:"Escape",run:L8t},{key:"ArrowDown",run:UA(!0)},{key:"ArrowUp",run:UA(!1)},{key:"PageDown",run:UA(!0,"page")},{key:"PageUp",run:UA(!1,"page")},{key:"Enter",run:M8t}],hBt=jp.highest(p1.computeN([ya],e=>e.facet(ya).defaultKeymap?[S4e]:[])),E4e=[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 a=this.ranges[r].from,l=this.lineAfter(a);n+=l,i=a+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 a=this.ranges[++this.rangeIndex].from;n+=a-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 a=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&s==4&&a>=0&&this.chunk[a]==t&&this.chunk[a+2]==n?this.chunk[a+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,a=new a4e(n,t?t.state.tabSize:4,t?Dy(t.state):2);if(a.eol())s.blankLine(this.state,a.indentUnit);else for(;!a.eol();){let l=c4e(s.token,a,this.state);if(l&&(r=this.emitToken(this.lang.tokenTable.resolve(l),this.parsedPos+a.start,this.parsedPos+a.pos,r)),a.start>1e4)break}this.parsedPos=i,this.moveRangeIndex(),this.parsedPost.start)return r}throw new Error("Stream parser failed to advance stream.")}const CH=Object.create(null),FE=[$o.none],NFt=new h1(FE),Gie=[],Xie=Object.create(null),u4e=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"]])u4e[e]=f4e(CH,t);class d4e{constructor(t){this.extra=t,this.table=Object.assign(Object.create(null),u4e)}resolve(t){return t?this.table[t]||(this.table[t]=f4e(this.extra,t)):0}}const RFt=new d4e(CH);function B3(e,t){Gie.indexOf(e)>-1||(Gie.push(e),console.warn(t))}function f4e(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):B3(u,`Modifier ${u} used at start of tag`):c.length?B3(u,`Tag ${u} used as modifier`):c=Array.isArray(d)?d:[d]:B3(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=Xie[r];if(s)return s.id;let a=Xie[r]=$o.define({id:FE.length,name:i,props:[Np({[i]:n})]});return FE.push(a),a.id}function IFt(e,t){let n=$o.define({id:FE.length,name:"Document",props:[Nm.add(()=>e),Rp.add(()=>i=>t.getIndent(i))],top:!0});return FE.push(n),n}Qr.RTL,Qr.LTR;var Yie={};class RR{constructor(t,n,i,r,s,a,l,c,u,d=0,f){this.p=t,this.stack=n,this.state=i,this.reducePos=r,this.pos=s,this.score=a,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 RR(t,[],n,i,i,0,[],0,r?new Zie(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,a=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[a-4]==0&&this.buffer[a-1]>-1){if(n==i)return;if(this.buffer[a-2]>=n){this.buffer[a-2]=i;return}}}if(!s||this.pos==i)this.buffer.push(t,n,i,r);else{let a=this.buffer.length;if(a>0&&(this.buffer[a-4]!=0||this.buffer[a-1]<0)){let l=!1;for(let c=a;c>0&&this.buffer[c-2]>i;c-=4)if(this.buffer[c-1]>=0){l=!0;break}if(l)for(;a>0&&this.buffer[a-2]>i;)this.buffer[a]=this.buffer[a-4],this.buffer[a+1]=this.buffer[a-3],this.buffer[a+2]=this.buffer[a-2],this.buffer[a+3]=this.buffer[a-1],a-=4,r>4&&(r-=4)}this.buffer[a]=t,this.buffer[a+1]=n,this.buffer[a+2]=i,this.buffer[a+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:a}=this.p;this.pos=r;let l=a.stateFlag(s,1);!l&&(r>i||n<=a.maxNode)&&(this.reducePos=r),this.pushState(s,l?i:Math.min(i,this.reducePos)),this.shiftContext(n,i),n<=a.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 RR(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 PFt(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,a;sc&1&&l==a)||r.push(n[s],a)}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 a=this.findForcedReduction();if(a==null)return!1;n=a}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,a=>{if(!(a&393216))if(a&65536){let l=(a>>19)-s;if(l>1){let c=a&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(a,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 Zie{constructor(t,n){this.tracker=t,this.context=n,this.hash=t.strict?t.hash(n):0}}class PFt{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 IR{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 IR(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 IR(this.stack,this.pos,this.index)}}function hk(e,t=Uint16Array){if(typeof e!="string")return e;let n=null;for(let i=0,r=0;i=92&&a--,a>=34&&a--;let c=a-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 Oj{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Jie=new Oj;class DFt{constructor(t,n){this.input=t,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Jie,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 a=this.ranges[++r];s+=a.from-i.to,i=a}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=Jie,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 Sx{constructor(t,n){this.data=t,this.id=n}token(t,n){let{parser:i}=n.p;h4e(this.data,t,n,this.id,i.data,i.tokenPrecTable)}}Sx.prototype.contextual=Sx.prototype.fallback=Sx.prototype.extend=!1;class PR{constructor(t,n,i){this.precTable=n,this.elseToken=i,this.data=typeof t=="string"?hk(t):t}token(t,n){let i=t.pos,r=0;for(;;){let s=t.next<0,a=t.resolveOffset(1,1);if(h4e(this.data,t,n,0,this.data,this.precTable),t.token.value>-1)break;if(this.elseToken==null)return;if(s||r++,a==null)break;t.reset(a,t.token)}r&&(t.reset(i,t.token),t.acceptToken(this.elseToken,r))}}PR.prototype.contextual=Sx.prototype.fallback=Sx.prototype.extend=!1;class Oo{constructor(t,n={}){this.token=t,this.contextual=!!n.contextual,this.fallback=!!n.fallback,this.extend=!!n.extend}}function h4e(e,t,n,i,r,s){let a=0,l=1<0){let g=e[m];if(c.allows(g)&&(t.token.value==-1||t.token.value==g||MFt(g,t.token.value,r,s))){t.acceptToken(g);break}}let d=t.next,f=0,h=e[a+2];if(t.next<0&&h>f&&e[u+h*3-3]==65535){a=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{a=e[g+2],t.advance();continue e}}break}}function ere(e,t,n){for(let i=t,r;(r=e[i])!=65535;i++)if(r==n)return i-t;return-1}function MFt(e,t,n,i){let r=ere(n,i,t);return r<0||ere(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 LFt=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?tre(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?tre(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=a,null;if(s instanceof Ci){if(a==t){if(a=Math.max(this.safeFrom,t)&&(this.trees.push(s),this.start.push(a),this.index.push(0))}else this.index[n]++,this.nextStart=a+s.length}}};class $Ft{constructor(t,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map(i=>new Oj)}getActions(t){let n=0,i=null,{parser:r}=t.p,{tokenizers:s}=r,a=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 Oj,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 Oj,{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 a=0;a=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 LFt(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[a]=t;for(;a.forceReduce()&&a.stack.length&&a.stack[a.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let a=0;an)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 a=r&&UFt(r);if(a)return jc&&console.log("Finish with "+this.stackID(a)),this.stackToTree(a);if(this.parser.strict)throw jc&&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 a=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,s,i);if(a)return jc&&console.log("Force-finish "+this.stackID(a)),this.stackToTree(a.forceAll())}if(this.recovering){let a=this.recovering==1?1:this.recovering*3;if(i.length>a)for(i.sort((l,c)=>c.score-l.score);i.length>a;)i.pop();i.some(l=>l.reducePos>n)&&this.recovering--}else if(i.length>1){e:for(let a=0;a500&&u.buffer.length>500)if((l.score-u.score||l.buffer.length-u.buffer.length)>0)i.splice(c--,1);else{i.splice(a--,1);continue e}}}i.length>12&&(i.sort((a,l)=>l.score-a.score),i.splice(12,i.length-12))}this.minStackPos=i[0].pos;for(let a=1;a ":"";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),jc&&console.log(a+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),jc&&console.log(a+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 nre(t,n),!0}}runRecovery(t,n,i){let r=null,s=!1;for(let a=0;a ":"";if(l.deadEnd&&(s||(s=!0,l.restart(),jc&&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()&&(jc&&console.log(h+this.stackID(f)+" (via force-reduce)"),!this.advanceFully(f,i));m++)jc&&(h=this.stackID(f)+" -> ");for(let m of l.recoverByInsert(c))jc&&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),jc&&console.log(d+this.stackID(l)+` (via recover-delete ${this.parser.getName(c)})`),nre(l,i)):(!r||r.scoree;class $D{constructor(t){this.start=t.start,this.shift=t.shift||Q3,this.reduce=t.reduce||Q3,this.reuse=t.reuse||Q3,this.hash=t.hash||(()=>0),this.strict=t.strict!==!1}}class xp extends TD{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 h1(n.map((l,c)=>$o.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=dLe;let a=hk(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 Sx(a,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 FFt(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 a=r[s++],l=a&1,c=r[s++];if(l&&i)return c;for(let u=s+(a>>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=Ah(this.data,s+2);else break;r=n(Ah(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=Ah(this.data,i+2);else break;if(!(this.data[i+2]&1)){let r=this.data[i+1];n.some((s,a)=>a&1&&s==r)||n.push(this.data[i],r)}}return n}configure(t){let n=Object.assign(Object.create(xp.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 a=Object.assign(Object.assign({},i),{external:s.to});return n.specializers[r]=ire(a),a})),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 a=n.indexOf(s);a>=0&&(i[a]=!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 QFt=316,zFt=317,rre=1,VFt=2,HFt=3,qFt=4,WFt=318,KFt=320,GFt=321,XFt=5,YFt=6,ZFt=0,RB=[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],p4e=125,JFt=59,IB=47,e8t=42,t8t=43,n8t=45,i8t=60,r8t=44,s8t=63,o8t=46,a8t=91,l8t=new $D({start:!1,shift(e,t){return t==XFt||t==YFt||t==KFt?e:t==GFt},strict:!1}),c8t=new Oo((e,t)=>{let{next:n}=e;(n==p4e||n==-1||t.context)&&e.acceptToken(WFt)},{contextual:!0,fallback:!0}),u8t=new Oo((e,t)=>{let{next:n}=e,i;RB.indexOf(n)>-1||n==IB&&((i=e.peek(1))==IB||i==e8t)||n!=p4e&&n!=JFt&&n!=-1&&!t.context&&e.acceptToken(QFt)},{contextual:!0}),d8t=new Oo((e,t)=>{e.next==a8t&&!t.context&&e.acceptToken(zFt)},{contextual:!0}),f8t=new Oo((e,t)=>{let{next:n}=e;if(n==t8t||n==n8t){if(e.advance(),n==e.next){e.advance();let i=!t.context&&t.canShift(rre);e.acceptToken(i?rre:VFt)}}else n==s8t&&e.peek(1)==o8t&&(e.advance(),e.advance(),(e.next<48||e.next>57)&&e.acceptToken(HFt))},{contextual:!0});function z3(e,t){return e>=65&&e<=90||e>=97&&e<=122||e==95||e>=192||!t&&e>=48&&e<=57}const h8t=new Oo((e,t)=>{if(e.next!=i8t||!t.dialectEnabled(ZFt)||(e.advance(),e.next==IB))return;let n=0;for(;RB.indexOf(e.next)>-1;)e.advance(),n++;if(z3(e.next,!0)){for(e.advance(),n++;z3(e.next,!1);)e.advance(),n++;for(;RB.indexOf(e.next)>-1;)e.advance(),n++;if(e.next==r8t)return;for(let i=0;;i++){if(i==7){if(!z3(e.next,!0))return;break}if(e.next!="extends".charCodeAt(i))break;e.advance(),n++}}e.acceptToken(qFt,-n)}),p8t=Np({"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)}),m8t={__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},g8t={__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},b8t={__proto__:null,"<":193},y8t=xp.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:l8t,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:[p8t],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:[u8t,d8t,f8t,h8t,2,3,4,5,6,7,8,9,10,11,12,13,14,c8t,new PR("$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 PR("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=>m8t[e]||-1},{term:343,get:e=>g8t[e]||-1},{term:95,get:e=>b8t[e]||-1}],tokenPrec:15201});class TH{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(g4e(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 sre(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 v8t(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+$/]:v8t(t);return r=>{let s=r.matchBefore(i);return s||r.explicit?{from:s?s.from:r.pos,options:t,validFor:n}:null}}function m4e(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 ore{constructor(t,n,i,r){this.completion=t,this.source=n,this.match=i,this.score=r}}function ay(e){return e.selection.main.from}function g4e(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 _H=Gf.define();function x8t(e,t,n,i){let{main:r}=e.selection,s=n-r.from,a=i-r.from;return{...e.changeByRange(l=>{if(l!=r&&n!=i&&e.sliceDoc(l.from+s,l.from+a)!=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+a,insert:c},range:ut.cursor(l.from+s+c.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const are=new WeakMap;function w8t(e){if(!Array.isArray(e))return e;let t=are.get(e);return t||are.set(e,t=AH(e)),t}const DR=Gn.define(),BE=Gn.define();class O8t{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=nH(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)?a[f++]=x:a.length&&(y=!1)),O=C,x+=gf(S)}return f==c&&a[0]==0&&y?this.result(-100+(h?-200:0),a,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),a,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 a of n){let l=a+(this.astral?gf(ec(i,a)):1);s&&r[s-1]==a?r[s-1]=l:(r[s++]=a,r[s++]=l)}return this.ret(t-i.length,r)}}class k8t{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:S8t,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=>lre(t(i),n(i)),optionClass:(t,n)=>i=>lre(t(i),n(i)),addToOptions:(t,n)=>t.concat(n),filterStrict:(t,n)=>t||n})}});function lre(e,t){return e?t?e+" "+t:e:t}function S8t(e,t,n,i,r,s){let a=e.textDirection==Qr.RTL,l=a,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?a?"left-narrow":"right-narrow":l?"left":"right")}}const jH=Gn.define();function E8t(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 a=document.createElement("span");a.className="cm-completionLabel";let l=n.displayLabel||n.label,c=0;for(let u=0;uc&&a.appendChild(document.createTextNode(l.slice(c,d)));let h=a.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 V3(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 C8t{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:a}=r.open,l=t.state.facet(ya);this.optionContent=E8t(l),this.optionClass=l.optionClass,this.tooltipClass=l.tooltipClass,this.range=V3(s.length,a,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:jH.of(d)}),c.preventDefault())}}),this.dom.addEventListener("focusout",c=>{let u=t.state.field(this.stateField,!1);u&&u.tooltip&&t.state.facet(ya).closeOnBlur&&c.relatedTarget!=t.contentDOM&&t.dispatch({effects:BE.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:a,disabled:l}=i.open;(!r.open||r.open.options!=s)&&(this.range=V3(s.length,a,t.state.facet(ya).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=V3(n.options.length,n.selected,this.view.state.facet(ya).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 a=typeof s=="string"?document.createTextNode(s):s(r);if(!a)return;"then"in a?a.then(l=>{l&&this.view.state.field(this.stateField,!1)==t&&this.addInfoPane(l,r)}).catch(l=>ac(this.view.state,l,"completion info")):(this.addInfoPane(a,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&&A8t(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 a=this.dom.ownerDocument.documentElement;s={left:0,top:0,right:a.clientWidth,bottom:a.clientHeight}}return r.top>Math.min(s.bottom,n.bottom)-10||r.bottom{a.target==r&&a.preventDefault()});let s=null;for(let a=i.from;ai.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+"-"+a,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 C8t(n,e,t)}function A8t(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 cre(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}function _8t(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)}},a=t.facet(ya);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 ore(h,d.source,f?f(h):[],1e9-n.length));else{let h=t.sliceDoc(d.from,d.to),m,g=a.filterStrict?new k8t(h):new O8t(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 ore(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):cre(d.completion)>cre(c)&&(l[l.length-1]=d),c=d.completion}return l}class Hv{constructor(t,n,i,r,s,a){this.options=t,this.attrs=n,this.tooltip=i,this.timestamp=r,this.selected=s,this.disabled=a}setSelected(t,n){return t==this.selected||t>=this.options.length?this:new Hv(this.options,ure(n,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,n,i,r,s,a){if(r&&!a&&t.some(u=>u.isPending))return r.setDisabled();let l=_8t(t,n);if(!l.length)return r&&t.some(u=>u.isPending)?r.setDisabled():null;let c=n.facet(ya).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:D8t,above:s.aboveCursor},r?r.timestamp:Date.now(),c,!1)}map(t){return new Hv(this.options,this.attrs,{...this.tooltip,pos:t.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new Hv(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class MR{constructor(t,n,i){this.active=t,this.id=n,this.open=i}static start(){return new MR(I8t,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:n}=t,i=n.facet(ya),s=(i.override||n.languageDataAt("autocomplete",ay(n)).map(w8t)).map(c=>(this.active.find(d=>d.source==c)||new Fu(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 a=this.open,l=t.effects.some(c=>c.is(NH));a&&t.docChanged&&(a=a.map(t.changes)),t.selection||s.some(c=>c.hasResult()&&t.changes.touchesRange(c.from,c.to))||!j8t(s,this.active)||l?a=Hv.build(s,n,this.id,a,i,l):a&&a.disabled&&!s.some(c=>c.isPending)&&(a=null),!a&&s.every(c=>!c.isPending)&&s.some(c=>c.hasResult())&&(s=s.map(c=>c.hasResult()?new Fu(c.source,0):c));for(let c of t.effects)c.is(jH)&&(a=a&&a.setSelected(c.value,this.id));return s==this.active&&a==this.open?this:new MR(s,this.id,a)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?N8t:R8t}}function j8t(e,t){if(e==t)return!0;for(let n=0,i=0;;){for(;n-1&&(n["aria-activedescendant"]=e+"-"+t),n}const I8t=[];function b4e(e,t){if(e.isUserEvent("input.complete")){let i=e.annotation(_H);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 Fu{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=b4e(t,n),r=this;(i&8||i&16&&this.touches(t))&&(r=new Fu(r.source,0)),i&4&&r.state==0&&(r=new Fu(this.source,1)),r=r.updateFor(t,i);for(let s of t.effects)if(s.is(DR))r=new Fu(r.source,1,s.value);else if(s.is(BE))r=new Fu(r.source,0);else if(s.is(NH))for(let a of s.value)a.source==r.source&&(r=a);return r}updateFor(t,n){return this.map(t.changes)}map(t){return this}touches(t){return t.changes.touchesRange(ay(t.state))}}class Ex extends Fu{constructor(t,n,i,r,s,a){super(t,3,n),this.limit=i,this.result=r,this.from=s,this.to=a}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),a=t.changes.mapPos(this.to,1),l=ay(t.state);if(l>a||!r||n&2&&(ay(t.startState)==this.from||ln.map(t))}}),tc=qa.define({create(){return MR.start()},update(e,t){return e.update(t)},provide:e=>[vH.from(e,t=>t.tooltip),Xt.contentAttributes.from(e,t=>t.attrs)]});function RH(e,t){const n=t.completion.apply||t.completion.label;let i=e.state.field(tc).active.find(r=>r.source==t.source);return i instanceof Ex?(typeof n=="string"?e.dispatch({...x8t(e.state,n,i.from,i.to),annotations:_H.of(t.completion)}):n(e,t.completion,i.from,i.to),!0):!1}const D8t=T8t(tc,RH);function UA(e,t="option"){return n=>{let i=n.state.field(tc,!1);if(!i||!i.open||i.open.disabled||Date.now()-i.open.timestamp-1?i.open.selected+r*(e?1:-1):e?0:a-1;return l<0?l=t=="page"?0:a-1:l>=a&&(l=t=="page"?a-1:0),n.dispatch({effects:jH.of(l)}),!0}}const M8t=e=>{let t=e.state.field(tc,!1);return e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestampe.state.field(tc,!1)?(e.dispatch({effects:DR.of(!0)}),!0):!1,L8t=e=>{let t=e.state.field(tc,!1);return!t||!t.active.some(n=>n.state!=0)?!1:(e.dispatch({effects:BE.of(null)}),!0)};class $8t{constructor(t,n){this.active=t,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const F8t=50,B8t=1e3,U8t=eo.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(tc).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(tc),n=e.state.facet(ya);if(!e.selectionSet&&!e.docChanged&&e.startState.field(tc)==t)return;let i=e.transactions.some(s=>{let a=b4e(s,n);return a&8||(s.selection||s.docChanged)&&!(a&3)});for(let s=0;sF8t&&Date.now()-a.time>B8t){for(let l of a.context.abortListeners)try{l()}catch(c){ac(this.view.state,c)}a.context.abortListeners=null,this.running.splice(s--,1)}else a.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),e.transactions.some(s=>s.effects.some(a=>a.is(DR)))&&(this.pendingStart=!0);let r=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=t.active.some(s=>s.isPending&&!this.running.some(a=>a.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(tc);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(ya).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=ay(t),i=new TH(t,n,e.explicit,this.view),r=new $8t(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:BE.of(null)}),ac(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(ya).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],n=this.view.state.facet(ya),i=this.view.state.field(tc);for(let r=0;rl.source==s.active.source);if(a&&a.isPending)if(s.done==null){let l=new Fu(s.active.source,0);for(let c of s.updates)l=l.update(c,n);l.isPending||t.push(l)}else this.startQuery(a)}(t.length||i.open&&i.open.disabled)&&this.view.dispatch({effects:NH.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field(tc,!1);if(t&&t.tooltip&&this.view.state.facet(ya).closeOnBlur){let n=t.open&&D3e(this.view,t.open.tooltip);(!n||!n.dom.contains(e.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:BE.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:DR.of(!1)}),20),this.composing=0}}}),Q8t=typeof navigator=="object"&&/Win/.test(navigator.platform),z8t=jp.highest(Xt.domEventHandlers({keydown(e,t){let n=t.state.field(tc,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&!(Q8t&&e.altKey)||e.metaKey)return!1;let i=n.open.options[n.open.selected],r=n.active.find(a=>a.source==i.source),s=i.completion.commitCharacters||r.result.commitCharacters;return s&&s.indexOf(e.key)>-1&&RH(t,i),!1}})),y4e=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 V8t{constructor(t,n,i,r){this.field=t,this.line=n,this.from=i,this.to=r}}class IH{constructor(t,n,i){this.field=t,this.from=n,this.to=i}map(t){let n=t.mapPos(this.from,-1,La.TrackDel),i=t.mapPos(this.to,1,La.TrackDel);return n==null||i==null?null:new IH(this.field,n,i)}}class PH{constructor(t,n){this.lines=t,this.fieldPositions=n}instantiate(t,n){let i=[],r=[n],s=t.doc.lineAt(n),a=/^\s*/.exec(s.text)[0];for(let c of this.lines){if(i.length){let u=a,d=/^\t*/.exec(c)[0].length;for(let f=0;fnew IH(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 a of t.split(/\r\n?|\n/)){for(;s=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(a);){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 V8t(u,i.length,s.index,s.index+d.length)),a=a.slice(0,s.index)+c+a.slice(s.index+s[0].length)}a=a.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(a)}return new PH(i,r)}}let H8t=Cn.widget({widget:new class extends Hd{toDOM(){let e=document.createElement("span");return e.className="cm-snippetFieldPosition",e}ignoreEvent(){return!1}}}),q8t=Cn.mark({class:"cm-snippetField"});class g1{constructor(t,n){this.ranges=t,this.active=n,this.deco=Cn.set(t.map(i=>(i.from==i.to?H8t:q8t).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 g1(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 xT=Gn.define({map(e,t){return e&&e.map(t)}}),W8t=Gn.define(),UE=qa.define({create(){return null},update(e,t){for(let n of t.effects){if(n.is(xT))return n.value;if(n.is(W8t)&&e)return new g1(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 K8t(e){let t=PH.parse(e);return(n,i,r,s)=>{let{text:a,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(a)},scrollIntoView:!0,annotations:i?[_H.of(i),Mo.userEvent.of("input.complete")]:void 0};if(l.length&&(u.selection=DH(l,0)),l.some(d=>d.field>0)){let d=new g1(l,0),f=u.effects=[xT.of(d)];n.state.field(UE,!1)===void 0&&f.push(Gn.appendConfig.of([UE,J8t,eBt,y4e]))}n.dispatch(n.state.update(u))}}function v4e(e){return({state:t,dispatch:n})=>{let i=t.field(UE,!1);if(!i||e<0&&i.active==0)return!1;let r=i.active+e,s=e>0&&!i.ranges.some(a=>a.field==r+e);return n(t.update({selection:DH(i.ranges,r),effects:xT.of(s?null:new g1(i.ranges,r)),scrollIntoView:!0})),!0}}const G8t=({state:e,dispatch:t})=>e.field(UE,!1)?(t(e.update({effects:xT.of(null)})),!0):!1,X8t=v4e(1),Y8t=v4e(-1),Z8t=[{key:"Tab",run:X8t,shift:Y8t},{key:"Escape",run:G8t}],dre=an.define({combine(e){return e.length?e[0]:Z8t}}),J8t=jp.highest(p1.compute([dre],e=>e.facet(dre)));function Ms(e,t){return{...t,apply:K8t(e)}}const eBt=Xt.domEventHandlers({mousedown(e,t){let n=t.state.field(UE,!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:xT.of(n.ranges.some(s=>s.field>r.field)?new g1(n.ranges,r.field):null),scrollIntoView:!0}),!0)}}),QE={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},zb=Gn.define({map(e,t){let n=t.mapPos(e,-1,La.TrackAfter);return n??void 0}}),MH=new class extends bg{};MH.startSide=1;MH.endSide=-1;const x4e=qa.define({create(){return Pi.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(zb)&&(e=e.update({add:[MH.range(n.value,n.value+1)]}));return e}});function tBt(){return[iBt,x4e]}const q3="()[]{}<>«»»«[]{}";function w4e(e){for(let t=0;t{if((nBt?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let r=e.state.selection.main;if(i.length>2||i.length==2&&gf(ec(i,0))==1||t!=r.from||n!=r.to)return!1;let s=oBt(e.state,i);return s?(e.dispatch(s),!0):!1}),rBt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let i=O4e(e,e.selection.main.head).brackets||QE.brackets,r=null,s=e.changeByRange(a=>{if(a.empty){let l=aBt(e.doc,a.head);for(let c of i)if(c==l&&FD(e.doc,a.head)==w4e(ec(c,0)))return{changes:{from:a.head-c.length,to:a.head+c.length},range:ut.cursor(a.head-c.length)}}return{range:r=a}});return r||t(e.update(s,{scrollIntoView:!0,userEvent:"delete.backward"})),!r},sBt=[{key:"Backspace",run:rBt}];function oBt(e,t){let n=O4e(e,e.selection.main.head),i=n.brackets||QE.brackets;for(let r of i){let s=w4e(ec(r,0));if(t==r)return s==r?uBt(e,r,i.indexOf(r+r+r)>-1,n):lBt(e,r,s,n.before||QE.before);if(t==s&&k4e(e,e.selection.main.from))return cBt(e,r,s)}return null}function k4e(e,t){let n=!1;return e.field(x4e).between(0,e.doc.length,i=>{i==t&&(n=!0)}),n}function FD(e,t){let n=e.sliceString(t,t+2);return n.slice(0,gf(ec(n,0)))}function aBt(e,t){let n=e.sliceString(t-2,t);return gf(ec(n,0))==n.length?n:n.slice(1)}function lBt(e,t,n,i){let r=null,s=e.changeByRange(a=>{if(!a.empty)return{changes:[{insert:t,from:a.from},{insert:n,from:a.to}],effects:zb.of(a.to+t.length),range:ut.range(a.anchor+t.length,a.head+t.length)};let l=FD(e.doc,a.head);return!l||/\s/.test(l)||i.indexOf(l)>-1?{changes:{insert:t+n,from:a.head},effects:zb.of(a.head+t.length),range:ut.cursor(a.head+t.length)}:{range:r=a}});return r?null:e.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function cBt(e,t,n){let i=null,r=e.changeByRange(s=>s.empty&&FD(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 uBt(e,t,n,i){let r=i.stringPrefixes||QE.stringPrefixes,s=null,a=e.changeByRange(l=>{if(!l.empty)return{changes:[{insert:t,from:l.from},{insert:t,from:l.to}],effects:zb.of(l.to+t.length),range:ut.range(l.anchor+t.length,l.head+t.length)};let c=l.head,u=FD(e.doc,c),d;if(u==t){if(fre(e,c))return{changes:{insert:t+t,from:c},effects:zb.of(c+t.length),range:ut.cursor(c+t.length)};if(k4e(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=hre(e,c-2*t.length,r))>-1&&fre(e,d))return{changes:{insert:t+t+t+t,from:c},effects:zb.of(c+t.length),range:ut.cursor(c+t.length)};if(e.charCategorizer(c)(u)!=Ts.Word&&hre(e,c,r)>-1&&!dBt(e,c,t,r))return{changes:{insert:t+t,from:c},effects:zb.of(c+t.length),range:ut.cursor(c+t.length)}}return{range:s=l}});return s?null:e.update(a,{scrollIntoView:!0,userEvent:"input.type"})}function fre(e,t){let n=Lr(e).resolveInner(t+1);return n.parent&&n.from==t}function dBt(e,t,n,i){let r=Lr(e).resolveInner(t,-1),s=i.reduce((a,l)=>Math.max(a,l.length),0);for(let a=0;a<5;a++){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 hre(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 fBt(e={}){return[z8t,tc,ya.of(e),U8t,hBt,y4e]}const S4e=[{key:"Ctrl-Space",run:H3},{mac:"Alt-`",run:H3},{mac:"Alt-i",run:H3},{key:"Escape",run:L8t},{key:"ArrowDown",run:UA(!0)},{key:"ArrowUp",run:UA(!1)},{key:"PageDown",run:UA(!0,"page")},{key:"PageUp",run:UA(!1,"page")},{key:"Enter",run:M8t}],hBt=jp.highest(p1.computeN([ya],e=>e.facet(ya).defaultKeymap?[S4e]:[])),E4e=[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}) { \${} @@ -738,12 +738,12 @@ ${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"})],pBt=E4e.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"})]),pre=new tH,C4e=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function EO(e){return(t,n)=>{let i=t.node.getChild("VariableDefinition");return i&&n(i,e),!0}}const mBt=["FunctionDeclaration"],gBt={FunctionDeclaration:EO("function"),ClassDeclaration:EO("class"),ClassExpression:()=>!0,EnumDeclaration:EO("constant"),TypeAliasDeclaration:EO("type"),NamespaceDeclaration:EO("namespace"),VariableDefinition(e,t){e.matchContext(mBt)||t(e,"variable")},TypeDefinition(e,t){t(e,"type")},__proto__:null};function T4e(e,t){let n=pre.get(t);if(n)return n;let i=[],r=!0;function s(a,l){let c=e.sliceString(a.from,a.to);i.push({label:c,type:l})}return t.cursor(cr.IncludeAnonymous).iterate(a=>{if(r)r=!1;else if(a.name){let l=gBt[a.name];if(l&&l(a,s)||C4e.has(a.name))return!1}else if(a.to-a.from>8192){for(let l of T4e(e,a.node))i.push(l);return!1}}),pre.set(t,i),i}const mre=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,A4e=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function bBt(e){let t=Lr(e.state).resolveInner(e.pos,-1);if(A4e.indexOf(t.name)>-1)return null;let n=t.name=="VariableName"||t.to-t.from<20&&mre.test(e.state.sliceDoc(t.from,t.to));if(!n&&!e.explicit)return null;let i=[];for(let r=t;r;r=r.parent)C4e.has(r.name)&&(i=i.concat(T4e(e.state.doc,r)));return{options:i,from:n?t.from:e.pos,validFor:mre}}const Df=vp.define({name:"javascript",parser:y8t.configure({props:[Rp.add({IfStatement:kx({except:/^\s*({|else\b)/}),TryStatement:kx({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:J$t,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:Ox({closing:"}"}),ArrowFunction:e=>e.baseIndent+e.unit,"TemplateString BlockComment":()=>null,"Statement Property":kx({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}}),Ip.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":bT,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:"$"}}),_4e={test:e=>/^JSX/.test(e.name),facet:DD({commentTokens:{block:{open:"{/*",close:"*/}"}}})},j4e=Df.configure({dialect:"ts"},"typescript"),N4e=Df.configure({dialect:"jsx",props:[wH.add(e=>e.isTop?[_4e]:void 0)]}),R4e=Df.configure({dialect:"jsx ts",props:[wH.add(e=>e.isTop?[_4e]:void 0)]},"typescript");let I4e=e=>({label:e,type:"keyword"});const P4e="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(I4e),yBt=P4e.concat(["declare","implements","private","protected","public"].map(I4e));function PB(e={}){let t=e.jsx?e.typescript?R4e:N4e:e.typescript?j4e:Df,n=e.typescript?pBt.concat(yBt):E4e.concat(P4e);return new Og(t,[Df.data.of({autocomplete:m4e(A4e,AH(n))}),Df.data.of({autocomplete:bBt}),e.jsx?wBt:[]])}function vBt(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 gre(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 xBt=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),wBt=Xt.inputHandler.of((e,t,n,i,r)=>{if((xBt?e.composing:e.compositionStarted)||e.state.readOnly||t!=n||i!=">"&&i!="/"||!Df.isActiveAt(e.state,t,-1))return!1;let s=r(),{state:a}=s,l=a.changeByRange(c=>{var u;let{head:d}=c,f=Lr(a).resolveInner(d-1,-1),h;if(f.name=="JSXStartTag"&&(f=f.parent),!(a.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=gre(a.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=vBt(f);if(m&&m.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(a.doc.sliceString(d,d+2))&&(h=gre(a.doc,m,d)))return{range:c,changes:{from:d,insert:``}}}}return{range:c}});return l.changes.empty?!1:(e.dispatch([s,a.update(l,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),OBt=Np({String:oe.string,Number:oe.number,"True False":oe.bool,PropertyName:oe.propertyName,Null:oe.null,", :":oe.separator,"[ ]":oe.squareBracket,"{ }":oe.brace}),kBt=xp.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:[OBt],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}),SBt=vp.define({name:"json",parser:kBt.configure({props:[Rp.add({Object:kx({except:/^\s*\}/}),Array:kx({except:/^\s*\]/})}),Ip.add({"Object Array":bT})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function EBt(){return new Og(SBt)}class LR{static create(t,n,i,r,s){let a=r+(r<<8)+t+(n<<4)|0;return new LR(t,n,i,a,s,[],[])}constructor(t,n,i,r,s,a,l){this.type=t,this.value=n,this.from=i,this.hash=r,this.end=s,this.children=a,this.positions=l,this.hashProp=[[Kn.contextHash,r]]}addChild(t,n){t.prop(Kn.contextHash)!=this.hash&&(t=new Ei(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 Ei(t.types[this.type],this.children,this.positions,n-this.from).balance({makeTree:(r,s,a)=>new Ei($o.none,r,s,a,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 CBt{constructor(t,n){this.start=t,this.content=n,this.marks=[],this.parsers=[]}}class TBt{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 pS(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?FH:$H)(n,t,!1);return i>0&&(e.type!=zt.BulletList||LH(n,t,!1)<0)&&n.text.charCodeAt(n.pos+i-1)==e.value}const D4e={[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+(nd(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]:bre,[zt.BulletList]:bre,[zt.Document](){return!0}};function nd(e){return e==32||e==9||e==10||e==13}function pS(e,t=0){for(;tn&&nd(e.charCodeAt(t-1));)t--;return t}function M4e(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(V4e.SetextHeading)>-1||i<3?-1:1}function $4e(e,t){for(let n=e.stack.length-1;n>=0;n--)if(e.stack[n].type==t)return!0;return!1}function $H(e,t,n){return(e.next==45||e.next==43||e.next==42)&&(e.pos==e.text.length-1||nd(e.text.charCodeAt(e.pos+1)))&&(!n||$4e(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 F4e(e){if(e.next!=35)return-1;let t=e.pos+1;for(;t6?-1:n}function B4e(e){if(e.next!=45&&e.next!=61||e.indent>=e.baseIndent+4)return-1;let t=e.pos+1;for(;t/,Q4e=/\?>/,MB=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*/,Q4e=/\?>/,MB=[[/^<(?: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 a=/^\?[^]*?\?>/.exec(i);if(a)return e.append(er(zt.ProcessingInstruction,n,n+1+a[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),a=VE.test(r),l=VE.test(s),c=/\s|^$/.test(r),u=/\s|^$/.test(s),d=!u&&(!l||c||a),f=!c&&(!a||u||l),h=d&&(t==42||!f||a),m=f&&(t==42||!d||l);return e.append(new Bc(t==95?G4e:X4e,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 Bc(_b,n,n+1,1)):-1},Image(e,t,n){return t==33&&e.char(n+1)==91?e.append(new Bc($R,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 Bc&&(r.type==_b||r.type==$R)){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),a=e.parts[i]=IBt(e,s,r.type==_b?zt.Link:zt.Image,r.from,n+1);if(r.type==_b)for(let l=0;lt?er(zt.URL,t+n,s+n):s==e.length?null:!1}}function Z4e(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,a=!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 Bc(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 Bc&&(n.type==_b||n.type==$R))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 Bc&&b.side&1&&b.type==r.type&&!(s&&(r.side&1||b.side&2)&&(b.to-b.from+a)%3==0&&((b.to-b.from)%3||a%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,a);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 Bc&&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 Bc?n:null}skipSpace(t){return pS(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 K4e(t,n)}}BH.linkStart=_b;BH.imageStart=$R;function $B(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,a=s,l=t.block.children.length,c=a,u=l;for(;;){if(n.to-i>r){if(n.type.isAnonymous&&n.firstChild())continue;break}let d=e6e(n.from-i,t.ranges);if(n.to-i<=t.ranges[t.rangeI].to)t.addNode(n.tree,d);else{let f=new Ei(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")&&(PBt.indexOf(n.type.id)<0?(a=n.to-i,l=t.block.children.length):(a=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 a-s}}function e6e(e,t){let n=e;for(let i=1;iQA[e]),Object.keys(QA).map(e=>V4e[e]),Object.keys(QA),jBt,D4e,Object.keys(K3).map(e=>K3[e]),Object.keys(K3),[]);function $Bt(e,t,n){let i=[];for(let r=e.firstChild,s=t;;r=r.nextSibling){let a=r?r.from:n;if(a>s&&i.push({from:s,to:a}),!r)break;s=r.to}return i}function FBt(e){let{codeParser:t,htmlParser:n}=e;return{wrap:mLe((r,s)=>{let a=r.type.id;if(t&&(a==zt.CodeBlock||a==zt.FencedCode)){let l="";if(a==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:a==zt.FencedCode}}else if(n&&(a==zt.HTMLBlock||a==zt.HTMLTag||a==zt.CommentBlock))return{parser:n,overlay:$Bt(r.node,r.from,r.to)};return null})}}const BBt={resolve:"Strikethrough",mark:"StrikethroughMark"},UBt={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),a=/\s|^$/.test(r),l=VE.test(i),c=VE.test(r);return e.addDelimiter(BBt,n,n+2,!a&&(!c||s||l),!s&&(!l||a||c))},after:"Emphasis"}]};function mS(e,t,n=0,i,r=0){let s=0,a=!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++,a=!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 wre(e,t){for(let n=t;n\s]*\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/;class Ore{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)&&t6e.test(r=n.text.slice(n.pos))){let s=[];mS(t,i.content,0,s,i.start)==mS(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=[];mS(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 QBt={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 wre(t.content,0)?new Ore:null},endLeaf(e,t,n){if(n.parsers.some(r=>r instanceof Ore)||!wre(t.text,t.basePos))return!1;let i=e.peekLine();return t6e.test(i)&&mS(e,t.text,t.basePos)==mS(e,i,t.basePos)},before:"SetextHeading"}]};class zBt{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 VBt={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 zBt:null},after:"SetextHeading"}]},kre=/(www\.)|(https?:\/\/)|([\w.+-]{1,100}@)|(mailto:|xmpp:)/gy,Sre=/[\w-]+(\.[\w-]+)+(:\d+)?(\/[^\s<]*)?/gy,HBt=/[\w-]+\.[\w-]+($|[/:])/,Ere=/[\w.+-]+@[\w-]+(\.[\w.-]+)+/gy,Cre=/\/[a-zA-Z\d@.]+/gy;function Tre(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==")"&&Tre(e,t,i,")")>Tre(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 Are(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 WBt={parseInline:[{name:"Autolink",parse(e,t,n){let i=n-e.offset;if(i&&/\w/.test(e.text[i-1]))return-1;kre.lastIndex=i;let r=kre.exec(e.text),s=-1;if(!r)return-1;if(r[1]||r[2]){if(s=qBt(e.text,i+r[0].length),s>-1&&e.hasOpenLink){let a=/([^\[\]]|\[[^\]]*\])*/.exec(e.text.slice(i,s));s=i+a[0].length}}else r[3]?s=Are(e.text,i):(s=Are(e.text,i+r[0].length),s>-1&&r[0]=="xmpp:"&&(Cre.lastIndex=s,r=Cre.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)}}]},KBt=[QBt,VBt,UBt,WBt];function n6e(e,t,n){return(i,r,s)=>{if(r!=e||i.char(s+1)==e)return-1;let a=[i.elt(n,s,s+1)];for(let l=s+1;l=65&&e<=90||e==95||e>=97&&e<=122||e>=161}let Rre=null,Ire=null,Pre=0;function BB(e,t){let n=e.pos+t;if(Pre==n&&Ire==e)return Rre;let i=e.peek(t),r="";for(;w9t(i);)r+=String.fromCharCode(i),i=e.peek(++t);return Ire=e,Pre=n,Rre=r?r.toLowerCase():i==O9t||i==k9t?void 0:null}const u6e=60,FR=62,QH=47,O9t=63,k9t=33,S9t=45;function Dre(e,t){this.name=e,this.parent=t}const E9t=[UH,o6e,i6e,r6e,s6e],C9t=new $D({start:null,shift(e,t,n,i){return E9t.indexOf(t)>-1?new Dre(BB(i,1)||"",e):e},reduce(e,t){return t==a6e&&e?e.parent:e},reuse(e,t,n,i){let r=t.type.id;return r==UH||r==m9t?new Dre(BB(i,1)||"",e):e},strict:!1}),T9t=new Oo((e,t)=>{if(e.next!=u6e){e.next<0&&t.context&&e.acceptToken(G3);return}e.advance();let n=e.next==QH;n&&e.advance();let i=BB(e,0);if(i===void 0)return;if(!i)return e.acceptToken(n?c9t:l9t);let r=t.context?t.context.name:null;if(n){if(i==r)return e.acceptToken(s9t);if(r&&x9t[r])return e.acceptToken(G3,-2);if(t.dialectEnabled(b9t))return e.acceptToken(o9t);for(let s=t.context;s;s=s.parent)if(s.name==i)return;e.acceptToken(a9t)}else{if(i=="script")return e.acceptToken(i6e);if(i=="style")return e.acceptToken(r6e);if(i=="textarea")return e.acceptToken(s6e);if(v9t.hasOwnProperty(i))return e.acceptToken(o6e);r&&Nre[r]&&Nre[r][i]?e.acceptToken(G3,-1):e.acceptToken(UH)}},{contextual:!0}),A9t=new Oo(e=>{for(let t=0,n=0;;n++){if(e.next<0){n&&e.acceptToken(jre);break}if(e.next==S9t)t++;else if(e.next==FR&&t>=2){n>=3&&e.acceptToken(jre,-2);break}else t=0;e.advance()}});function _9t(e){for(;e;e=e.parent)if(e.name=="svg"||e.name=="math")return!0;return!1}const j9t=new Oo((e,t)=>{if(e.next==QH&&e.peek(1)==FR){let n=t.dialectEnabled(y9t)||_9t(t.context);e.acceptToken(n?r9t:_re,2)}else e.next==FR&&e.acceptToken(_re,1)});function zH(e,t,n){let i=2+e.length;return new Oo(r=>{for(let s=0,a=0,l=0;;l++){if(r.next<0){l&&r.acceptToken(t);break}if(s==0&&r.next==u6e||s==1&&r.next==QH||s>=2&&sa?r.acceptToken(t,-a):r.acceptToken(n,-(a-2));break}else if((r.next==10||r.next==13)&&l){r.acceptToken(t,1);break}else s=a=0;r.advance()}})}const N9t=zH("script",ZBt,JBt),R9t=zH("style",e9t,t9t),I9t=zH("textarea",n9t,i9t),P9t=Np({"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}),D9t=xp.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:C9t,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:[P9t],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==f9t)return X3(l,c,n);if(u==h9t)return X3(l,c,i);if(u==p9t)return X3(l,c,r);if(u==a6e&&s.length){let d=l.node,f=d.firstChild,h=f&&Mre(f,c),m;if(h){for(let g of s)if(g.tag==h&&(!g.attrs||g.attrs(m||(m=d6e(f,c))))){let b=d.lastChild,v=b.type.id==g9t?b.from:d.to;if(v>f.to)return{parser:g.parser,overlay:[{from:f.to,to:v}]}}}}if(a&&u==l6e){let d=l.node,f;if(f=d.firstChild){let h=a[c.read(f.from,f.to)];if(h)for(let m of h){if(m.tagName&&m.tagName!=Mre(d.parent,c))continue;let g=d.lastChild;if(g.type.id==FB){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==c6e)return{parser:m.parser,overlay:[{from:g.from,to:g.to}]}}}}return null})}const M9t=145,Lre=1,L9t=146,$9t=147,h6e=2,F9t=148,B9t=3,U9t=4,p6e=[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],Q9t=58,z9t=40,m6e=95,V9t=91,kj=45,H9t=46,q9t=35,W9t=37,K9t=38,G9t=92,X9t=10,Y9t=42;function HE(e){return e>=65&&e<=90||e>=97&&e<=122||e>=161}function VH(e){return e>=48&&e<=57}function $re(e){return VH(e)||e>=97&&e<=102||e>=65&&e<=70}const g6e=(e,t,n)=>(i,r)=>{for(let s=!1,a=0,l=0;;l++){let{next:c}=i;if(HE(c)||c==kj||c==m6e||s&&VH(c))!s&&(c!=kj||l>0)&&(s=!0),a===l&&c==kj&&a++,i.advance();else if(c==G9t&&i.peek(1)!=X9t){if(i.advance(),$re(i.next)){do i.advance();while($re(i.next));i.next==32&&i.advance()}else i.next>-1&&i.advance();s=!0}else{s&&i.acceptToken(a==2&&r.canShift(h6e)?t:c==z9t?n:e);break}}},Z9t=new Oo(g6e(L9t,h6e,$9t),{contextual:!0}),J9t=new Oo(g6e(F9t,B9t,U9t),{contextual:!0}),e7t=new Oo(e=>{if(p6e.includes(e.peek(-1))){let{next:t}=e;(HE(t)||t==m6e||t==q9t||t==H9t||t==Y9t||t==V9t||t==Q9t&&HE(e.peek(1))||t==kj||t==K9t)&&e.acceptToken(M9t)}}),t7t=new Oo(e=>{if(!p6e.includes(e.peek(-1))){let{next:t}=e;if(t==W9t&&(e.advance(),e.acceptToken(Lre)),HE(t)){do e.advance();while(HE(e.next)||VH(e.next));e.acceptToken(Lre)}}}),n7t=Np({"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}),i7t={__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},r7t={__proto__:null,or:104,and:104,not:112,only:112,layer:206},s7t={__proto__:null,selector:118,style:124,layer:202},o7t={__proto__:null,"@import":198,"@media":210,"@charset":214,"@namespace":218,"@keyframes":224,"@supports":236,"@scope":240,"@font-feature-values":246},a7t={__proto__:null,to:243},l7t=xp.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:[e7t,t7t,Z9t,J9t,1,2,3,4,new PR("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=>i7t[e]||-1},{term:148,get:e=>r7t[e]||-1},{term:4,get:e=>s7t[e]||-1},{term:28,get:e=>o7t[e]||-1},{term:146,get:e=>a7t[e]||-1}],tokenPrec:2405});let Y3=null;function Z3(){if(!Y3&&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)));Y3=t.sort().map(i=>({type:"property",label:i,apply:i+": "}))}return Y3||[]}const Fre=["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})),Bre=["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}))),c7t=["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})),u7t=["@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})),fh=/^(\w[\w-]*|-\w[\w-]*|)$/,d7t=/^-(-[\w-]*)?$/;function f7t(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 Ure=new tH,h7t=["Declaration"];function p7t(e){for(let t=e;;){if(t.type.isTop)return t;if(!(t=t.parent))return e}}function b6e(e,t,n){if(t.to-t.from>4096){let i=Ure.get(t);if(i)return i;let r=[],s=new Set,a=t.cursor(cr.IncludeAnonymous);if(a.firstChild())do for(let l of b6e(e,a.node,n))s.has(l.label)||(s.add(l.label),r.push(l));while(a.nextSibling());return Ure.set(t,r),r}else{let i=[],r=new Set;return t.cursor().iterate(s=>{var a;if(n(s)&&s.matchContext(h7t)&&((a=s.node.nextSibling)===null||a===void 0?void 0:a.name)==":"){let l=e.sliceString(s.from,s.to);r.has(l)||(r.add(l),i.push({label:l,type:"variable"}))}}),i}}const m7t=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:Z3(),validFor:fh};if(r.name=="ValueName")return{from:r.from,options:Bre,validFor:fh};if(r.name=="PseudoClassName")return{from:r.from,options:Fre,validFor:fh};if(e(r)||(t.explicit||s)&&f7t(r,n.doc))return{from:e(r)||s?r.from:i,options:b6e(n.doc,p7t(r),e),validFor:d7t};if(r.name=="TagName"){for(let{parent:c}=r;c;c=c.parent)if(c.name=="Block")return{from:r.from,options:Z3(),validFor:fh};return{from:r.from,options:c7t,validFor:fh}}if(r.name=="AtKeyword")return{from:r.from,options:u7t,validFor:fh};if(!t.explicit)return null;let a=r.resolve(i),l=a.childBefore(i);return l&&l.name==":"&&a.name=="PseudoClassSelector"?{from:i,options:Fre,validFor:fh}:l&&l.name==":"&&a.name=="Declaration"||a.name=="ArgList"?{from:i,options:Bre,validFor:fh}:a.name=="Block"||a.name=="Styles"?{from:i,options:Z3(),validFor:fh}:null},g7t=m7t(e=>e.name=="VariableName"),BR=vp.define({name:"css",parser:l7t.configure({props:[Rp.add({Declaration:kx()}),Ip.add({"Block KeyframeList":bT})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function b7t(){return new Og(BR,BR.data.of({autocomplete:g7t}))}const TO=["_blank","_self","_top","_parent"],J3=["ascii","utf-8","utf-16","latin1","latin1"],e4=["get","post","put","delete"],t4=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],Nc=["true","false"],Sn={},y7t={a:{attrs:{href:null,ping:null,type:null,media:null,target:TO,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:TO}},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:t4,formmethod:e4,formnovalidate:["novalidate"],formtarget:TO,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":J3,autocomplete:["on","off"],enctype:t4,method:e4,novalidate:["novalidate"],target:TO}},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:t4,formmethod:e4,formnovalidate:["novalidate"],formtarget:TO,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:J3,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:J3}},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},y6e={accesskey:null,class:null,contenteditable:Nc,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:Nc,autocorrect:Nc,autocapitalize:Nc,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":Nc,"aria-autocomplete":["inline","list","both","none"],"aria-busy":Nc,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":Nc,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":Nc,"aria-hidden":Nc,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":Nc,"aria-multiselectable":Nc,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":Nc,"aria-relevant":null,"aria-required":Nc,"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},v6e="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 v6e)y6e[e]=null;class qE{constructor(t,n){this.tags={...y7t,...t},this.globalAttrs={...y6e,...n},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}}qE.default=new qE;function Sw(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 Ew(e,t=!1){for(;e;e=e.parent)if(e.name=="Element")if(t)t=!1;else return e;return null}function x6e(e,t,n){let i=n.tags[Sw(e,Ew(t))];return(i==null?void 0:i.children)||n.allTags}function HH(e,t){let n=[];for(let i=Ew(t);i&&!i.type.isTop;i=Ew(i.parent)){let r=Sw(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 w6e=/^[:\-\.\w\u00b7-\uffff]*$/;function Qre(e,t,n,i,r){let s=/\s*>/.test(e.sliceDoc(r,r+5))?"":">",a=Ew(n,n.name=="StartTag"||n.name=="TagName");return{from:i,to:r,options:x6e(e.doc,a,t).map(l=>({label:l,type:"type"})).concat(HH(e.doc,n).map((l,c)=>({label:"/"+l,apply:"/"+l+s,type:"type",boost:99-c}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function zre(e,t,n,i){let r=/\s*>/.test(e.sliceDoc(i,i+5))?"":">";return{from:n,to:i,options:HH(e.doc,t).map((s,a)=>({label:s,apply:s+r,type:"type",boost:99-a})),validFor:w6e}}function v7t(e,t,n,i){let r=[],s=0;for(let a of x6e(e.doc,n,t))r.push({label:"<"+a,type:"type"});for(let a of HH(e.doc,n))r.push({label:"",type:"type",boost:99-s++});return{from:i,to:i,options:r,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function x7t(e,t,n,i,r){let s=Ew(n),a=s?t.tags[Sw(e.doc,s)]:null,l=a&&a.attrs?Object.keys(a.attrs):[],c=a&&a.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:w6e}}function w7t(e,t,n,i,r){var s;let a=(s=n.parent)===null||s===void 0?void 0:s.getChild("AttributeName"),l=[],c;if(a){let u=e.sliceDoc(a.from,a.to),d=t.globalAttrs[u];if(!d){let f=Ew(n),h=f?t.tags[Sw(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 O6e(e,t){let{state:n,pos:i}=t,r=Lr(n).resolveInner(i,-1),s=r.resolve(i);for(let a=i,l;s==r&&(l=r.childBefore(a));){let c=l.lastChild;if(!c||!c.type.isError||c.fromO6e(i,r)}const S7t=Df.parser.configure({top:"SingleExpression"}),k6e=[{tag:"script",attrs:e=>e.type=="text/typescript"||e.lang=="ts",parser:j4e.parser},{tag:"script",attrs:e=>e.type=="text/babel"||e.type=="text/jsx",parser:N4e.parser},{tag:"script",attrs:e=>e.type=="text/typescript-jsx",parser:R4e.parser},{tag:"script",attrs(e){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(e.type)},parser:S7t},{tag:"script",attrs(e){return!e.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(e.type)},parser:Df.parser},{tag:"style",attrs(e){return(!e.lang||e.lang=="css")&&(!e.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(e.type))},parser:BR.parser}],S6e=[{name:"style",parser:BR.parser.configure({top:"Styles"})}].concat(v6e.map(e=>({name:e,parser:Df.parser}))),E6e=vp.define({name:"html",parser:D9t.configure({props:[Rp.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:"-_"}}),Sj=E6e.configure({wrap:f6e(k6e,S6e)});function E7t(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=f6e((e.nestedLanguages||[]).concat(k6e),(e.nestedAttributes||[]).concat(S6e)));let i=n?E6e.configure({wrap:n,dialect:t}):t?Sj.configure({dialect:t}):Sj;return new Og(i,[Sj.data.of({autocomplete:k7t(e)}),e.autoCloseTags!==!1?C7t:[],PB().support,b7t().support])}const Vre=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),C7t=Xt.inputHandler.of((e,t,n,i,r)=>{if(e.composing||e.state.readOnly||t!=n||i!=">"&&i!="/"||!Sj.isActiveAt(e.state,t,-1))return!1;let s=r(),{state:a}=s,l=a.changeByRange(c=>{var u,d,f;let h=a.doc.sliceString(c.from-1,c.to)==i,{head:m}=c,g=Lr(a).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=Sw(a.doc,v.parent,m))&&!Vre.has(b)){let y=m+(a.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=Sw(a.doc,v,m))&&!Vre.has(b)){let y=m+(a.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,a.update(l,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),C6e=DD({commentTokens:{block:{open:""}}}),T6e=new Kn,A6e=LBt.configure({props:[Ip.add(e=>!e.is("Block")||e.is("Document")||UB(e)!=null||T7t(e)?void 0:(t,n)=>({from:n.doc.lineAt(t.from).to,to:t.to})),T6e.add(UB),Rp.add({Document:()=>null}),Nm.add({Document:C6e})]});function UB(e){let t=/^(?:ATX|Setext)Heading(\d)$/.exec(e.name);return t?+t[1]:void 0}function T7t(e){return e.name=="OrderedList"||e.name=="BulletList"}function A7t(e,t){let n=e;for(;;){let i=n.nextSibling,r;if(!i||(r=UB(i.type))!=null&&r<=t)break;n=i}return n.to}const _7t=W3e.of((e,t,n)=>{for(let i=Lr(e).resolveInner(n,-1);i&&!(i.fromn)return{from:n,to:s}}return null});function qH(e){return new Gc(C6e,e,[],"markdown")}const j7t=qH(A6e),N7t=A6e.configure([KBt,XBt,GBt,YBt,{props:[Ip.add({Table:(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})})]}]),UR=qH(N7t);function R7t(e,t){return n=>{if(n&&e){let i=null;if(n=/\S*/.exec(n)[0],typeof e=="function"?i=e(n):i=_R.matchLanguageName(e,n,!0),i instanceof _R)return i.support?i.support.language.parser:Py.getSkippingParser(i.load());if(i)return i.parser}return t?t.parser:null}}let n4=class{constructor(t,n,i,r,s,a,l){this.node=t,this.from=n,this.to=i,this.spaceBefore=r,this.spaceAfter=s,this.type=a,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(+j6e(this.item,t)[2]+n):"";return this.spaceBefore+i+this.type+this.spaceAfter}};function _6e(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],a,l=t.lineAt(s.from),c=s.from-l.from;if(s.name=="Blockquote"&&(a=/^ *>( ?)/.exec(l.text.slice(c))))i.push(new n4(s,c,c+a[0].length,"",a[1],">",null));else if(s.name=="ListItem"&&s.parent.name=="OrderedList"&&(a=/^( *)\d+([.)])( *)/.exec(l.text.slice(c)))){let u=a[3],d=a[0].length;u.length>=4&&(u=u.slice(0,u.length-4),d-=4),i.push(new n4(s.parent,c,c+d,a[1],u,a[2],s))}else if(s.name=="ListItem"&&s.parent.name=="BulletList"&&(a=/^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(l.text.slice(c)))){let u=a[4],d=a[0].length;u.length>4&&(u=u.slice(0,u.length-4),d-=4);let f=a[2];a[3]&&(f+=a[3].replace(/[xX]/," ")),i.push(new n4(s.parent,c,c+d,a[1],u,f,s))}}return i}function j6e(e,t){return/^(\s*)(\d+)(?=[.)])/.exec(t.sliceString(e.from,e.from+10))}function i4(e,t,n,i=0){for(let r=-1,s=e;;){if(s.name=="ListItem"){let l=j6e(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 a=s.nextSibling;if(!a)break;s=a}}function WH(e,t){let n=/^[ \t]*/.exec(e)[0].length;if(!n||t.facet(m1)!=" ")return e;let i=Md(e,4,n),r="";for(let s=i;s>0;)s>=4?(r+=" ",s-=4):(r+=" ",s--);return r+e.slice(n)}const I7t=(e={})=>({state:t,dispatch:n})=>{let i=Lr(t),{doc:r}=t,s=null,a=t.changeByRange(l=>{if(!l.empty||!UR.isActiveAt(t,l.from,-1)&&!UR.isActiveAt(t,l.from,1))return s={range:l};let c=l.from,u=r.lineAt(c),d=_6e(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"&&i4(f.item,r,k,-2),w&&w.node.name=="OrderedList"&&i4(w.item,r,k),{range:ut.cursor(O+S.length),changes:k}}else{let w=qre(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"&&i4(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=WH(b,t),D7t(f.node,t.doc)&&(b=qre(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(a,{scrollIntoView:!0,userEvent:"input"})),!0)},P7t=I7t();function Hre(e){return e.name=="QuoteMark"||e.name=="ListMark"}function D7t(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),a=/^[\s>]*$/.test(r.text);return r.number+(a?0:1){let n=Lr(e),i=null,r=e.changeByRange(s=>{let a=s.from,{doc:l}=e;if(s.empty&&UR.isActiveAt(e,s.from)){let c=l.lineAt(a),u=_6e(M7t(n,a),l);if(u.length){let d=u[u.length-1],f=d.to-d.spaceAfter.length+(d.spaceAfter?1:0);if(a-c.from>f&&!/\S/.test(c.text.slice(f,a-c.from)))return{range:ut.cursor(c.from+f),changes:{from:c.from+f,to:a}};if(a-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),!UR.isActiveAt(t.state,i.from,1)))return!1;let s=Lr(t.state),a=!1;return s.iterate({from:i.from,to:i.to,enter:l=>{(l.from>i.from||Q7t.test(l.name))&&(a=!0)},leave:l=>{l.to=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}const zUt=new Oo((e,t)=>{let n;if(e.next<0)e.acceptToken(W7t);else if(t.context.flags&Ej)s4(e.next)&&e.acceptToken(q7t,1);else if(((n=e.peek(-1))<0||s4(n))&&t.canShift(Wre)){let i=0;for(;e.next==KH||e.next==UD;)e.advance(),i++;(e.next==Ly||e.next==WE||e.next==GH)&&e.acceptToken(Wre,-i)}else s4(e.next)&&e.acceptToken(H7t,1)},{contextual:!0}),VUt=new Oo((e,t)=>{let n=t.context;if(n.flags)return;let i=e.peek(-1);if(i==Ly||i==WE){let r=0,s=0;for(;;){if(e.next==KH)r++;else if(e.next==UD)r+=8-r%8;else break;e.advance(),s++}r!=n.indent&&e.next!=Ly&&e.next!=WE&&e.next!=GH&&(r[e,t|$6e])),WUt=new $D({start:HUt,reduce(e,t,n,i){return e.flags&Ej&&QUt.has(t)||(t==uUt||t==D6e)&&e.flags&$6e?e.parent:e},shift(e,t,n,i){return t==R6e?new Cj(e,qUt(i.read(i.pos,n.pos)),0):t==I6e?e.parent:t==X7t||t==eUt||t==iUt||t==P6e?new Cj(e,0,Ej):Yre.has(t)?new Cj(e,0,Yre.get(t)|e.flags&Ej):e},hash(e){return e.hash}}),KUt=new Oo(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==KH||n==UD)){n!=DUt&&n!=MUt&&n!=Ly&&n!=WE&&n!=GH&&e.acceptToken(V7t);return}}}),GUt=new Oo((e,t)=>{let{flags:n}=t.context,i=n&vh?L6e:M6e,r=(n&xh)>0,s=!(n&wh),a=(n&Oh)>0,l=e.pos;for(;!(e.next<0);)if(a&&e.next==QB)if(e.peek(1)==QB)e.advance(2);else{if(e.pos==l){e.acceptToken(P6e,1);return}break}else if(s&&e.next==Xre){if(e.pos==l){e.advance();let c=e.next;c>=0&&(e.advance(),XUt(e,c)),e.acceptToken(G7t);return}break}else if(e.next==Xre&&!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==Ly){if(r)e.advance();else if(e.pos==l){e.acceptToken(Kre);return}break}else e.advance();e.pos>l&&e.acceptToken(K7t)});function XUt(e,t){if(t==LUt)for(let n=0;n<2&&e.next>=48&&e.next<=55;n++)e.advance();else if(t==$Ut)for(let n=0;n<2&&o4(e.next);n++)e.advance();else if(t==BUt)for(let n=0;n<4&&o4(e.next);n++)e.advance();else if(t==UUt)for(let n=0;n<8&&o4(e.next);n++)e.advance();else if(t==FUt&&e.next==QB){for(e.advance();e.next>=0&&e.next!=Gre&&e.next!=M6e&&e.next!=L6e&&e.next!=Ly;)e.advance();e.next==Gre&&e.advance()}}const YUt=Np({'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}),ZUt={__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},JUt=xp.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:[KUt,VUt,zUt,GUt,0,1,2,3,4],topRules:{Script:[0,5]},specialized:[{term:221,get:e=>ZUt[e]||-1}],tokenPrec:7668}),Zre=new tH,F6e=new Set(["Script","Body","FunctionDefinition","ClassDefinition","LambdaExpression","ForStatement","MatchClause"]);function VA(e){return(t,n,i)=>{if(i)return!1;let r=t.node.getChild("VariableName");return r&&n(r,e),!0}}const eQt={FunctionDefinition:VA("function"),ClassDefinition:VA("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 a=r.getChild("import");a;a=a.nextSibling)a.name=="VariableName"&&((i=a.nextSibling)===null||i===void 0?void 0:i.name)!="as"&&t(a,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:VA("variable"),AsPattern:VA("variable"),__proto__:null};function B6e(e,t){let n=Zre.get(t);if(n)return n;let i=[],r=!0;function s(a,l){let c=e.sliceString(a.from,a.to);i.push({label:c,type:l})}return t.cursor(cr.IncludeAnonymous).iterate(a=>{if(a.name){let l=eQt[a.name];if(l&&l(a,s,r)||!r&&F6e.has(a.name))return!1;r=!1}else if(a.to-a.from>8192){for(let l of B6e(e,a.node))i.push(l);return!1}}),Zre.set(t,i),i}const Jre=/^[\w\xa1-\uffff][\w\d\xa1-\uffff]*$/,U6e=["String","FormatString","Comment","PropertyName"];function tQt(e){let t=Lr(e.state).resolveInner(e.pos,-1);if(U6e.indexOf(t.name)>-1)return null;let n=t.name=="VariableName"||t.to-t.from<20&&Jre.test(e.state.sliceDoc(t.from,t.to));if(!n&&!e.explicit)return null;let i=[];for(let r=t;r;r=r.parent)F6e.has(r.name)&&(i=i.concat(B6e(e.state.doc,r)));return{options:i,from:n?t.from:e.pos,validFor:Jre}}const nQt=["__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"}))),iQt=[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=LR.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],kw,kw,(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($B(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?H4e(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=$B(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 K4e(t,n)}get buffer(){return new W4e(this.parser.nodeSet)}}function H4e(e,t,n,i,r){let s=e[t].to,a=[],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=H4e(e,t,d,i,r),u(d.to+i,!1)):h=d.toTree(),a.push(h),l.push(f-c)}return u(n.to+i,!1),new Ci(n.type,a,l,n.to+i-c,n.tree?n.tree.propValues:void 0)}class BD extends TD{constructor(t,n,i,r,s,a,l,c,u){super(),this.nodeSet=t,this.blockParsers=n,this.leafBlockParsers=i,this.blockNames=r,this.endLeafBlock=s,this.skipContextMarkup=a,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 RBt(this,t,n,i);for(let s of this.wrappers)r=s(r,t,n,i);return r}configure(t){let n=LB(t);if(!n)return this;let{nodeSet:i,skipContextMarkup:r}=this,s=this.blockParsers.slice(),a=this.leafBlockParsers.slice(),l=this.blockNames.slice(),c=this.inlineParsers.slice(),u=this.inlineNames.slice(),d=this.endLeafBlock.slice(),f=this.wrappers;if(CO(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($o.define({id:w,name:b,props:O&&[[Kn.group,O]]})),x&&(m||(m={}),Array.isArray(x)||x instanceof hf?m[b]=x:Object.assign(m,x))}i=new h1(h),m&&(i=i.extend(Np(m)))}if(CO(n.props)&&(i=i.extend(...n.props)),CO(n.remove))for(let h of n.remove){let m=this.blockNames.indexOf(h),g=this.inlineNames.indexOf(h);m>-1&&(s[m]=a[m]=void 0),g>-1&&(c[g]=void 0)}if(CO(n.parseBlock))for(let h of n.parseBlock){let m=l.indexOf(h.name);if(m>-1)s[m]=h.parse,a[m]=h.leaf;else{let g=h.before?zA(l,h.before):h.after?zA(l,h.after)+1:l.length-1;s.splice(g,0,h.parse),a.splice(g,0,h.leaf),l.splice(g,0,h.name)}h.endLeaf&&d.push(h.endLeaf)}if(CO(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?zA(u,h.before):h.after?zA(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 BD(i,s,a,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 BH(this,t,n);e:for(let r=n;r=0){r=l;continue e}}r++}return i.resolveMarkers(0)}}function CO(e){return e!=null&&e.length>0}function LB(e){if(!Array.isArray(e))return e;if(e.length==0)return null;let t=LB(e[0]);if(e.length==1)return t;let n=LB(e.slice(1));if(!n||!t)return t||n;let i=(a,l)=>(a||kw).concat(l||kw),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?(a,l,c,u)=>r(s(a,l,c,u),l,c,u):r:s}}function zA(e,t){let n=e.indexOf(t);if(n<0)throw new RangeError(`Position specified relative to unknown parser ${t}`);return n}let q4e=[$o.none];for(let e=1,t;t=zt[e];e++)q4e[e]=$o.define({id:e,name:t,props:e>=zt.Escape?[]:[[Kn.group,e in D4e?["Block","BlockContext"]:["Block","LeafBlock"]]],top:t=="Document"});const kw=[];class W4e{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 zE=class{constructor(t,n,i,r=kw){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 W4e(t).writeElements(this.children,-this.from).finish(this.type,this.to-this.from)}};class K4e{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 kw}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 zE(e,t,n,i)}const G4e={resolve:"Emphasis",mark:"EmphasisMark"},X4e={resolve:"Emphasis",mark:"EmphasisMark"},_b={},$R={};class Bc{constructor(t,n,i,r){this.type=t,this.from=n,this.to=i,this.side=r}}const xre="!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~";let VE=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\u2010-\u2027]/;try{VE=new RegExp("[\\p{S}|\\p{P}]","u")}catch{}const K3={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 a=/^\?[^]*?\?>/.exec(i);if(a)return e.append(er(zt.ProcessingInstruction,n,n+1+a[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),a=VE.test(r),l=VE.test(s),c=/\s|^$/.test(r),u=/\s|^$/.test(s),d=!u&&(!l||c||a),f=!c&&(!a||u||l),h=d&&(t==42||!f||a),m=f&&(t==42||!d||l);return e.append(new Bc(t==95?G4e:X4e,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 Bc(_b,n,n+1,1)):-1},Image(e,t,n){return t==33&&e.char(n+1)==91?e.append(new Bc($R,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 Bc&&(r.type==_b||r.type==$R)){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),a=e.parts[i]=IBt(e,s,r.type==_b?zt.Link:zt.Image,r.from,n+1);if(r.type==_b)for(let l=0;lt?er(zt.URL,t+n,s+n):s==e.length?null:!1}}function Z4e(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,a=!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 Bc(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 Bc&&(n.type==_b||n.type==$R))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 Bc&&b.side&1&&b.type==r.type&&!(s&&(r.side&1||b.side&2)&&(b.to-b.from+a)%3==0&&((b.to-b.from)%3||a%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,a);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 Bc&&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 Bc?n:null}skipSpace(t){return pS(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 K4e(t,n)}}BH.linkStart=_b;BH.imageStart=$R;function $B(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,a=s,l=t.block.children.length,c=a,u=l;for(;;){if(n.to-i>r){if(n.type.isAnonymous&&n.firstChild())continue;break}let d=e6e(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")&&(PBt.indexOf(n.type.id)<0?(a=n.to-i,l=t.block.children.length):(a=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 a-s}}function e6e(e,t){let n=e;for(let i=1;iQA[e]),Object.keys(QA).map(e=>V4e[e]),Object.keys(QA),jBt,D4e,Object.keys(K3).map(e=>K3[e]),Object.keys(K3),[]);function $Bt(e,t,n){let i=[];for(let r=e.firstChild,s=t;;r=r.nextSibling){let a=r?r.from:n;if(a>s&&i.push({from:s,to:a}),!r)break;s=r.to}return i}function FBt(e){let{codeParser:t,htmlParser:n}=e;return{wrap:mLe((r,s)=>{let a=r.type.id;if(t&&(a==zt.CodeBlock||a==zt.FencedCode)){let l="";if(a==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:a==zt.FencedCode}}else if(n&&(a==zt.HTMLBlock||a==zt.HTMLTag||a==zt.CommentBlock))return{parser:n,overlay:$Bt(r.node,r.from,r.to)};return null})}}const BBt={resolve:"Strikethrough",mark:"StrikethroughMark"},UBt={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),a=/\s|^$/.test(r),l=VE.test(i),c=VE.test(r);return e.addDelimiter(BBt,n,n+2,!a&&(!c||s||l),!s&&(!l||a||c))},after:"Emphasis"}]};function mS(e,t,n=0,i,r=0){let s=0,a=!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++,a=!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 wre(e,t){for(let n=t;n\s]*\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/;class Ore{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)&&t6e.test(r=n.text.slice(n.pos))){let s=[];mS(t,i.content,0,s,i.start)==mS(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=[];mS(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 QBt={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 wre(t.content,0)?new Ore:null},endLeaf(e,t,n){if(n.parsers.some(r=>r instanceof Ore)||!wre(t.text,t.basePos))return!1;let i=e.peekLine();return t6e.test(i)&&mS(e,t.text,t.basePos)==mS(e,i,t.basePos)},before:"SetextHeading"}]};class zBt{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 VBt={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 zBt:null},after:"SetextHeading"}]},kre=/(www\.)|(https?:\/\/)|([\w.+-]{1,100}@)|(mailto:|xmpp:)/gy,Sre=/[\w-]+(\.[\w-]+)+(:\d+)?(\/[^\s<]*)?/gy,HBt=/[\w-]+\.[\w-]+($|[/:])/,Ere=/[\w.+-]+@[\w-]+(\.[\w.-]+)+/gy,Cre=/\/[a-zA-Z\d@.]+/gy;function Tre(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==")"&&Tre(e,t,i,")")>Tre(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 Are(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 WBt={parseInline:[{name:"Autolink",parse(e,t,n){let i=n-e.offset;if(i&&/\w/.test(e.text[i-1]))return-1;kre.lastIndex=i;let r=kre.exec(e.text),s=-1;if(!r)return-1;if(r[1]||r[2]){if(s=qBt(e.text,i+r[0].length),s>-1&&e.hasOpenLink){let a=/([^\[\]]|\[[^\]]*\])*/.exec(e.text.slice(i,s));s=i+a[0].length}}else r[3]?s=Are(e.text,i):(s=Are(e.text,i+r[0].length),s>-1&&r[0]=="xmpp:"&&(Cre.lastIndex=s,r=Cre.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)}}]},KBt=[QBt,VBt,UBt,WBt];function n6e(e,t,n){return(i,r,s)=>{if(r!=e||i.char(s+1)==e)return-1;let a=[i.elt(n,s,s+1)];for(let l=s+1;l=65&&e<=90||e==95||e>=97&&e<=122||e>=161}let Rre=null,Ire=null,Pre=0;function BB(e,t){let n=e.pos+t;if(Pre==n&&Ire==e)return Rre;let i=e.peek(t),r="";for(;w9t(i);)r+=String.fromCharCode(i),i=e.peek(++t);return Ire=e,Pre=n,Rre=r?r.toLowerCase():i==O9t||i==k9t?void 0:null}const u6e=60,FR=62,QH=47,O9t=63,k9t=33,S9t=45;function Dre(e,t){this.name=e,this.parent=t}const E9t=[UH,o6e,i6e,r6e,s6e],C9t=new $D({start:null,shift(e,t,n,i){return E9t.indexOf(t)>-1?new Dre(BB(i,1)||"",e):e},reduce(e,t){return t==a6e&&e?e.parent:e},reuse(e,t,n,i){let r=t.type.id;return r==UH||r==m9t?new Dre(BB(i,1)||"",e):e},strict:!1}),T9t=new Oo((e,t)=>{if(e.next!=u6e){e.next<0&&t.context&&e.acceptToken(G3);return}e.advance();let n=e.next==QH;n&&e.advance();let i=BB(e,0);if(i===void 0)return;if(!i)return e.acceptToken(n?c9t:l9t);let r=t.context?t.context.name:null;if(n){if(i==r)return e.acceptToken(s9t);if(r&&x9t[r])return e.acceptToken(G3,-2);if(t.dialectEnabled(b9t))return e.acceptToken(o9t);for(let s=t.context;s;s=s.parent)if(s.name==i)return;e.acceptToken(a9t)}else{if(i=="script")return e.acceptToken(i6e);if(i=="style")return e.acceptToken(r6e);if(i=="textarea")return e.acceptToken(s6e);if(v9t.hasOwnProperty(i))return e.acceptToken(o6e);r&&Nre[r]&&Nre[r][i]?e.acceptToken(G3,-1):e.acceptToken(UH)}},{contextual:!0}),A9t=new Oo(e=>{for(let t=0,n=0;;n++){if(e.next<0){n&&e.acceptToken(jre);break}if(e.next==S9t)t++;else if(e.next==FR&&t>=2){n>=3&&e.acceptToken(jre,-2);break}else t=0;e.advance()}});function _9t(e){for(;e;e=e.parent)if(e.name=="svg"||e.name=="math")return!0;return!1}const j9t=new Oo((e,t)=>{if(e.next==QH&&e.peek(1)==FR){let n=t.dialectEnabled(y9t)||_9t(t.context);e.acceptToken(n?r9t:_re,2)}else e.next==FR&&e.acceptToken(_re,1)});function zH(e,t,n){let i=2+e.length;return new Oo(r=>{for(let s=0,a=0,l=0;;l++){if(r.next<0){l&&r.acceptToken(t);break}if(s==0&&r.next==u6e||s==1&&r.next==QH||s>=2&&sa?r.acceptToken(t,-a):r.acceptToken(n,-(a-2));break}else if((r.next==10||r.next==13)&&l){r.acceptToken(t,1);break}else s=a=0;r.advance()}})}const N9t=zH("script",ZBt,JBt),R9t=zH("style",e9t,t9t),I9t=zH("textarea",n9t,i9t),P9t=Np({"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}),D9t=xp.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:C9t,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:[P9t],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==f9t)return X3(l,c,n);if(u==h9t)return X3(l,c,i);if(u==p9t)return X3(l,c,r);if(u==a6e&&s.length){let d=l.node,f=d.firstChild,h=f&&Mre(f,c),m;if(h){for(let g of s)if(g.tag==h&&(!g.attrs||g.attrs(m||(m=d6e(f,c))))){let b=d.lastChild,v=b.type.id==g9t?b.from:d.to;if(v>f.to)return{parser:g.parser,overlay:[{from:f.to,to:v}]}}}}if(a&&u==l6e){let d=l.node,f;if(f=d.firstChild){let h=a[c.read(f.from,f.to)];if(h)for(let m of h){if(m.tagName&&m.tagName!=Mre(d.parent,c))continue;let g=d.lastChild;if(g.type.id==FB){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==c6e)return{parser:m.parser,overlay:[{from:g.from,to:g.to}]}}}}return null})}const M9t=145,Lre=1,L9t=146,$9t=147,h6e=2,F9t=148,B9t=3,U9t=4,p6e=[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],Q9t=58,z9t=40,m6e=95,V9t=91,kj=45,H9t=46,q9t=35,W9t=37,K9t=38,G9t=92,X9t=10,Y9t=42;function HE(e){return e>=65&&e<=90||e>=97&&e<=122||e>=161}function VH(e){return e>=48&&e<=57}function $re(e){return VH(e)||e>=97&&e<=102||e>=65&&e<=70}const g6e=(e,t,n)=>(i,r)=>{for(let s=!1,a=0,l=0;;l++){let{next:c}=i;if(HE(c)||c==kj||c==m6e||s&&VH(c))!s&&(c!=kj||l>0)&&(s=!0),a===l&&c==kj&&a++,i.advance();else if(c==G9t&&i.peek(1)!=X9t){if(i.advance(),$re(i.next)){do i.advance();while($re(i.next));i.next==32&&i.advance()}else i.next>-1&&i.advance();s=!0}else{s&&i.acceptToken(a==2&&r.canShift(h6e)?t:c==z9t?n:e);break}}},Z9t=new Oo(g6e(L9t,h6e,$9t),{contextual:!0}),J9t=new Oo(g6e(F9t,B9t,U9t),{contextual:!0}),e7t=new Oo(e=>{if(p6e.includes(e.peek(-1))){let{next:t}=e;(HE(t)||t==m6e||t==q9t||t==H9t||t==Y9t||t==V9t||t==Q9t&&HE(e.peek(1))||t==kj||t==K9t)&&e.acceptToken(M9t)}}),t7t=new Oo(e=>{if(!p6e.includes(e.peek(-1))){let{next:t}=e;if(t==W9t&&(e.advance(),e.acceptToken(Lre)),HE(t)){do e.advance();while(HE(e.next)||VH(e.next));e.acceptToken(Lre)}}}),n7t=Np({"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}),i7t={__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},r7t={__proto__:null,or:104,and:104,not:112,only:112,layer:206},s7t={__proto__:null,selector:118,style:124,layer:202},o7t={__proto__:null,"@import":198,"@media":210,"@charset":214,"@namespace":218,"@keyframes":224,"@supports":236,"@scope":240,"@font-feature-values":246},a7t={__proto__:null,to:243},l7t=xp.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:[e7t,t7t,Z9t,J9t,1,2,3,4,new PR("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=>i7t[e]||-1},{term:148,get:e=>r7t[e]||-1},{term:4,get:e=>s7t[e]||-1},{term:28,get:e=>o7t[e]||-1},{term:146,get:e=>a7t[e]||-1}],tokenPrec:2405});let Y3=null;function Z3(){if(!Y3&&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)));Y3=t.sort().map(i=>({type:"property",label:i,apply:i+": "}))}return Y3||[]}const Fre=["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})),Bre=["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}))),c7t=["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})),u7t=["@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})),fh=/^(\w[\w-]*|-\w[\w-]*|)$/,d7t=/^-(-[\w-]*)?$/;function f7t(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 Ure=new tH,h7t=["Declaration"];function p7t(e){for(let t=e;;){if(t.type.isTop)return t;if(!(t=t.parent))return e}}function b6e(e,t,n){if(t.to-t.from>4096){let i=Ure.get(t);if(i)return i;let r=[],s=new Set,a=t.cursor(cr.IncludeAnonymous);if(a.firstChild())do for(let l of b6e(e,a.node,n))s.has(l.label)||(s.add(l.label),r.push(l));while(a.nextSibling());return Ure.set(t,r),r}else{let i=[],r=new Set;return t.cursor().iterate(s=>{var a;if(n(s)&&s.matchContext(h7t)&&((a=s.node.nextSibling)===null||a===void 0?void 0:a.name)==":"){let l=e.sliceString(s.from,s.to);r.has(l)||(r.add(l),i.push({label:l,type:"variable"}))}}),i}}const m7t=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:Z3(),validFor:fh};if(r.name=="ValueName")return{from:r.from,options:Bre,validFor:fh};if(r.name=="PseudoClassName")return{from:r.from,options:Fre,validFor:fh};if(e(r)||(t.explicit||s)&&f7t(r,n.doc))return{from:e(r)||s?r.from:i,options:b6e(n.doc,p7t(r),e),validFor:d7t};if(r.name=="TagName"){for(let{parent:c}=r;c;c=c.parent)if(c.name=="Block")return{from:r.from,options:Z3(),validFor:fh};return{from:r.from,options:c7t,validFor:fh}}if(r.name=="AtKeyword")return{from:r.from,options:u7t,validFor:fh};if(!t.explicit)return null;let a=r.resolve(i),l=a.childBefore(i);return l&&l.name==":"&&a.name=="PseudoClassSelector"?{from:i,options:Fre,validFor:fh}:l&&l.name==":"&&a.name=="Declaration"||a.name=="ArgList"?{from:i,options:Bre,validFor:fh}:a.name=="Block"||a.name=="Styles"?{from:i,options:Z3(),validFor:fh}:null},g7t=m7t(e=>e.name=="VariableName"),BR=vp.define({name:"css",parser:l7t.configure({props:[Rp.add({Declaration:kx()}),Ip.add({"Block KeyframeList":bT})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function b7t(){return new Og(BR,BR.data.of({autocomplete:g7t}))}const TO=["_blank","_self","_top","_parent"],J3=["ascii","utf-8","utf-16","latin1","latin1"],e4=["get","post","put","delete"],t4=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],Nc=["true","false"],Sn={},y7t={a:{attrs:{href:null,ping:null,type:null,media:null,target:TO,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:TO}},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:t4,formmethod:e4,formnovalidate:["novalidate"],formtarget:TO,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":J3,autocomplete:["on","off"],enctype:t4,method:e4,novalidate:["novalidate"],target:TO}},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:t4,formmethod:e4,formnovalidate:["novalidate"],formtarget:TO,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:J3,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:J3}},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},y6e={accesskey:null,class:null,contenteditable:Nc,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:Nc,autocorrect:Nc,autocapitalize:Nc,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":Nc,"aria-autocomplete":["inline","list","both","none"],"aria-busy":Nc,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":Nc,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":Nc,"aria-hidden":Nc,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":Nc,"aria-multiselectable":Nc,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":Nc,"aria-relevant":null,"aria-required":Nc,"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},v6e="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 v6e)y6e[e]=null;class qE{constructor(t,n){this.tags={...y7t,...t},this.globalAttrs={...y6e,...n},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}}qE.default=new qE;function Sw(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 Ew(e,t=!1){for(;e;e=e.parent)if(e.name=="Element")if(t)t=!1;else return e;return null}function x6e(e,t,n){let i=n.tags[Sw(e,Ew(t))];return(i==null?void 0:i.children)||n.allTags}function HH(e,t){let n=[];for(let i=Ew(t);i&&!i.type.isTop;i=Ew(i.parent)){let r=Sw(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 w6e=/^[:\-\.\w\u00b7-\uffff]*$/;function Qre(e,t,n,i,r){let s=/\s*>/.test(e.sliceDoc(r,r+5))?"":">",a=Ew(n,n.name=="StartTag"||n.name=="TagName");return{from:i,to:r,options:x6e(e.doc,a,t).map(l=>({label:l,type:"type"})).concat(HH(e.doc,n).map((l,c)=>({label:"/"+l,apply:"/"+l+s,type:"type",boost:99-c}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function zre(e,t,n,i){let r=/\s*>/.test(e.sliceDoc(i,i+5))?"":">";return{from:n,to:i,options:HH(e.doc,t).map((s,a)=>({label:s,apply:s+r,type:"type",boost:99-a})),validFor:w6e}}function v7t(e,t,n,i){let r=[],s=0;for(let a of x6e(e.doc,n,t))r.push({label:"<"+a,type:"type"});for(let a of HH(e.doc,n))r.push({label:"",type:"type",boost:99-s++});return{from:i,to:i,options:r,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function x7t(e,t,n,i,r){let s=Ew(n),a=s?t.tags[Sw(e.doc,s)]:null,l=a&&a.attrs?Object.keys(a.attrs):[],c=a&&a.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:w6e}}function w7t(e,t,n,i,r){var s;let a=(s=n.parent)===null||s===void 0?void 0:s.getChild("AttributeName"),l=[],c;if(a){let u=e.sliceDoc(a.from,a.to),d=t.globalAttrs[u];if(!d){let f=Ew(n),h=f?t.tags[Sw(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 O6e(e,t){let{state:n,pos:i}=t,r=Lr(n).resolveInner(i,-1),s=r.resolve(i);for(let a=i,l;s==r&&(l=r.childBefore(a));){let c=l.lastChild;if(!c||!c.type.isError||c.fromO6e(i,r)}const S7t=Df.parser.configure({top:"SingleExpression"}),k6e=[{tag:"script",attrs:e=>e.type=="text/typescript"||e.lang=="ts",parser:j4e.parser},{tag:"script",attrs:e=>e.type=="text/babel"||e.type=="text/jsx",parser:N4e.parser},{tag:"script",attrs:e=>e.type=="text/typescript-jsx",parser:R4e.parser},{tag:"script",attrs(e){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(e.type)},parser:S7t},{tag:"script",attrs(e){return!e.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(e.type)},parser:Df.parser},{tag:"style",attrs(e){return(!e.lang||e.lang=="css")&&(!e.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(e.type))},parser:BR.parser}],S6e=[{name:"style",parser:BR.parser.configure({top:"Styles"})}].concat(v6e.map(e=>({name:e,parser:Df.parser}))),E6e=vp.define({name:"html",parser:D9t.configure({props:[Rp.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:"-_"}}),Sj=E6e.configure({wrap:f6e(k6e,S6e)});function E7t(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=f6e((e.nestedLanguages||[]).concat(k6e),(e.nestedAttributes||[]).concat(S6e)));let i=n?E6e.configure({wrap:n,dialect:t}):t?Sj.configure({dialect:t}):Sj;return new Og(i,[Sj.data.of({autocomplete:k7t(e)}),e.autoCloseTags!==!1?C7t:[],PB().support,b7t().support])}const Vre=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),C7t=Xt.inputHandler.of((e,t,n,i,r)=>{if(e.composing||e.state.readOnly||t!=n||i!=">"&&i!="/"||!Sj.isActiveAt(e.state,t,-1))return!1;let s=r(),{state:a}=s,l=a.changeByRange(c=>{var u,d,f;let h=a.doc.sliceString(c.from-1,c.to)==i,{head:m}=c,g=Lr(a).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=Sw(a.doc,v.parent,m))&&!Vre.has(b)){let y=m+(a.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=Sw(a.doc,v,m))&&!Vre.has(b)){let y=m+(a.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,a.update(l,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),C6e=DD({commentTokens:{block:{open:""}}}),T6e=new Kn,A6e=LBt.configure({props:[Ip.add(e=>!e.is("Block")||e.is("Document")||UB(e)!=null||T7t(e)?void 0:(t,n)=>({from:n.doc.lineAt(t.from).to,to:t.to})),T6e.add(UB),Rp.add({Document:()=>null}),Nm.add({Document:C6e})]});function UB(e){let t=/^(?:ATX|Setext)Heading(\d)$/.exec(e.name);return t?+t[1]:void 0}function T7t(e){return e.name=="OrderedList"||e.name=="BulletList"}function A7t(e,t){let n=e;for(;;){let i=n.nextSibling,r;if(!i||(r=UB(i.type))!=null&&r<=t)break;n=i}return n.to}const _7t=W3e.of((e,t,n)=>{for(let i=Lr(e).resolveInner(n,-1);i&&!(i.fromn)return{from:n,to:s}}return null});function qH(e){return new Gc(C6e,e,[],"markdown")}const j7t=qH(A6e),N7t=A6e.configure([KBt,XBt,GBt,YBt,{props:[Ip.add({Table:(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})})]}]),UR=qH(N7t);function R7t(e,t){return n=>{if(n&&e){let i=null;if(n=/\S*/.exec(n)[0],typeof e=="function"?i=e(n):i=_R.matchLanguageName(e,n,!0),i instanceof _R)return i.support?i.support.language.parser:Py.getSkippingParser(i.load());if(i)return i.parser}return t?t.parser:null}}let n4=class{constructor(t,n,i,r,s,a,l){this.node=t,this.from=n,this.to=i,this.spaceBefore=r,this.spaceAfter=s,this.type=a,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(+j6e(this.item,t)[2]+n):"";return this.spaceBefore+i+this.type+this.spaceAfter}};function _6e(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],a,l=t.lineAt(s.from),c=s.from-l.from;if(s.name=="Blockquote"&&(a=/^ *>( ?)/.exec(l.text.slice(c))))i.push(new n4(s,c,c+a[0].length,"",a[1],">",null));else if(s.name=="ListItem"&&s.parent.name=="OrderedList"&&(a=/^( *)\d+([.)])( *)/.exec(l.text.slice(c)))){let u=a[3],d=a[0].length;u.length>=4&&(u=u.slice(0,u.length-4),d-=4),i.push(new n4(s.parent,c,c+d,a[1],u,a[2],s))}else if(s.name=="ListItem"&&s.parent.name=="BulletList"&&(a=/^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(l.text.slice(c)))){let u=a[4],d=a[0].length;u.length>4&&(u=u.slice(0,u.length-4),d-=4);let f=a[2];a[3]&&(f+=a[3].replace(/[xX]/," ")),i.push(new n4(s.parent,c,c+d,a[1],u,f,s))}}return i}function j6e(e,t){return/^(\s*)(\d+)(?=[.)])/.exec(t.sliceString(e.from,e.from+10))}function i4(e,t,n,i=0){for(let r=-1,s=e;;){if(s.name=="ListItem"){let l=j6e(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 a=s.nextSibling;if(!a)break;s=a}}function WH(e,t){let n=/^[ \t]*/.exec(e)[0].length;if(!n||t.facet(m1)!=" ")return e;let i=Md(e,4,n),r="";for(let s=i;s>0;)s>=4?(r+=" ",s-=4):(r+=" ",s--);return r+e.slice(n)}const I7t=(e={})=>({state:t,dispatch:n})=>{let i=Lr(t),{doc:r}=t,s=null,a=t.changeByRange(l=>{if(!l.empty||!UR.isActiveAt(t,l.from,-1)&&!UR.isActiveAt(t,l.from,1))return s={range:l};let c=l.from,u=r.lineAt(c),d=_6e(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"&&i4(f.item,r,k,-2),w&&w.node.name=="OrderedList"&&i4(w.item,r,k),{range:ut.cursor(O+S.length),changes:k}}else{let w=qre(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"&&i4(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=WH(b,t),D7t(f.node,t.doc)&&(b=qre(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(a,{scrollIntoView:!0,userEvent:"input"})),!0)},P7t=I7t();function Hre(e){return e.name=="QuoteMark"||e.name=="ListMark"}function D7t(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),a=/^[\s>]*$/.test(r.text);return r.number+(a?0:1){let n=Lr(e),i=null,r=e.changeByRange(s=>{let a=s.from,{doc:l}=e;if(s.empty&&UR.isActiveAt(e,s.from)){let c=l.lineAt(a),u=_6e(M7t(n,a),l);if(u.length){let d=u[u.length-1],f=d.to-d.spaceAfter.length+(d.spaceAfter?1:0);if(a-c.from>f&&!/\S/.test(c.text.slice(f,a-c.from)))return{range:ut.cursor(c.from+f),changes:{from:c.from+f,to:a}};if(a-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),!UR.isActiveAt(t.state,i.from,1)))return!1;let s=Lr(t.state),a=!1;return s.iterate({from:i.from,to:i.to,enter:l=>{(l.from>i.from||Q7t.test(l.name))&&(a=!0)},leave:l=>{l.to=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}const zUt=new Oo((e,t)=>{let n;if(e.next<0)e.acceptToken(W7t);else if(t.context.flags&Ej)s4(e.next)&&e.acceptToken(q7t,1);else if(((n=e.peek(-1))<0||s4(n))&&t.canShift(Wre)){let i=0;for(;e.next==KH||e.next==UD;)e.advance(),i++;(e.next==Ly||e.next==WE||e.next==GH)&&e.acceptToken(Wre,-i)}else s4(e.next)&&e.acceptToken(H7t,1)},{contextual:!0}),VUt=new Oo((e,t)=>{let n=t.context;if(n.flags)return;let i=e.peek(-1);if(i==Ly||i==WE){let r=0,s=0;for(;;){if(e.next==KH)r++;else if(e.next==UD)r+=8-r%8;else break;e.advance(),s++}r!=n.indent&&e.next!=Ly&&e.next!=WE&&e.next!=GH&&(r[e,t|$6e])),WUt=new $D({start:HUt,reduce(e,t,n,i){return e.flags&Ej&&QUt.has(t)||(t==uUt||t==D6e)&&e.flags&$6e?e.parent:e},shift(e,t,n,i){return t==R6e?new Cj(e,qUt(i.read(i.pos,n.pos)),0):t==I6e?e.parent:t==X7t||t==eUt||t==iUt||t==P6e?new Cj(e,0,Ej):Yre.has(t)?new Cj(e,0,Yre.get(t)|e.flags&Ej):e},hash(e){return e.hash}}),KUt=new Oo(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==KH||n==UD)){n!=DUt&&n!=MUt&&n!=Ly&&n!=WE&&n!=GH&&e.acceptToken(V7t);return}}}),GUt=new Oo((e,t)=>{let{flags:n}=t.context,i=n&vh?L6e:M6e,r=(n&xh)>0,s=!(n&wh),a=(n&Oh)>0,l=e.pos;for(;!(e.next<0);)if(a&&e.next==QB)if(e.peek(1)==QB)e.advance(2);else{if(e.pos==l){e.acceptToken(P6e,1);return}break}else if(s&&e.next==Xre){if(e.pos==l){e.advance();let c=e.next;c>=0&&(e.advance(),XUt(e,c)),e.acceptToken(G7t);return}break}else if(e.next==Xre&&!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==Ly){if(r)e.advance();else if(e.pos==l){e.acceptToken(Kre);return}break}else e.advance();e.pos>l&&e.acceptToken(K7t)});function XUt(e,t){if(t==LUt)for(let n=0;n<2&&e.next>=48&&e.next<=55;n++)e.advance();else if(t==$Ut)for(let n=0;n<2&&o4(e.next);n++)e.advance();else if(t==BUt)for(let n=0;n<4&&o4(e.next);n++)e.advance();else if(t==UUt)for(let n=0;n<8&&o4(e.next);n++)e.advance();else if(t==FUt&&e.next==QB){for(e.advance();e.next>=0&&e.next!=Gre&&e.next!=M6e&&e.next!=L6e&&e.next!=Ly;)e.advance();e.next==Gre&&e.advance()}}const YUt=Np({'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}),ZUt={__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},JUt=xp.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:[KUt,VUt,zUt,GUt,0,1,2,3,4],topRules:{Script:[0,5]},specialized:[{term:221,get:e=>ZUt[e]||-1}],tokenPrec:7668}),Zre=new tH,F6e=new Set(["Script","Body","FunctionDefinition","ClassDefinition","LambdaExpression","ForStatement","MatchClause"]);function VA(e){return(t,n,i)=>{if(i)return!1;let r=t.node.getChild("VariableName");return r&&n(r,e),!0}}const eQt={FunctionDefinition:VA("function"),ClassDefinition:VA("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 a=r.getChild("import");a;a=a.nextSibling)a.name=="VariableName"&&((i=a.nextSibling)===null||i===void 0?void 0:i.name)!="as"&&t(a,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:VA("variable"),AsPattern:VA("variable"),__proto__:null};function B6e(e,t){let n=Zre.get(t);if(n)return n;let i=[],r=!0;function s(a,l){let c=e.sliceString(a.from,a.to);i.push({label:c,type:l})}return t.cursor(cr.IncludeAnonymous).iterate(a=>{if(a.name){let l=eQt[a.name];if(l&&l(a,s,r)||!r&&F6e.has(a.name))return!1;r=!1}else if(a.to-a.from>8192){for(let l of B6e(e,a.node))i.push(l);return!1}}),Zre.set(t,i),i}const Jre=/^[\w\xa1-\uffff][\w\d\xa1-\uffff]*$/,U6e=["String","FormatString","Comment","PropertyName"];function tQt(e){let t=Lr(e.state).resolveInner(e.pos,-1);if(U6e.indexOf(t.name)>-1)return null;let n=t.name=="VariableName"||t.to-t.from<20&&Jre.test(e.state.sliceDoc(t.from,t.to));if(!n&&!e.explicit)return null;let i=[];for(let r=t;r;r=r.parent)F6e.has(r.name)&&(i=i.concat(B6e(e.state.doc,r)));return{options:i,from:n?t.from:e.pos,validFor:Jre}}const nQt=["__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"}))),iQt=[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"})],rQt=m4e(U6e,AH(nQt.concat(iQt)));function a4(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 l4(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 c4=vp.define({name:"python",parser:JUt.configure({props:[Rp.add({Body:e=>{var t;let n=/^\s*(#|$)/.test(e.textAfter)&&a4(e)||e.node;return(t=l4(e,n))!==null&&t!==void 0?t:e.continue()},MatchBody:e=>{var t;let n=a4(e);return(t=l4(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":Ox({closing:")"}),"DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression":Ox({closing:"}"}),"ArrayExpression ArrayComprehensionExpression":Ox({closing:"]"}),MemberExpression:e=>e.baseIndent+e.unit,"String FormatString":()=>null,Script:e=>{var t;let n=a4(e);return(t=n&&l4(e,n))!==null&&t!==void 0?t:e.continue()}}),Ip.add({"ArrayExpression DictionaryExpression SetExpression TupleExpression":bT,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 sQt(){return new Og(c4,[c4.data.of({autocomplete:tQt}),c4.data.of({autocomplete:rQt})])}const hv=63,ese=64,oQt=1,aQt=2,Q6e=3,lQt=4,z6e=5,cQt=6,uQt=7,V6e=65,dQt=66,fQt=8,hQt=9,pQt=10,mQt=11,gQt=12,H6e=13,bQt=19,yQt=20,vQt=29,xQt=33,wQt=34,OQt=47,kQt=0,XH=1,zB=2,KE=3,VB=4;class jb{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}}jb.top=new jb(null,-1,kQt);function gS(e,t){for(let n=0,i=t-e.pos-1;;i--,n++){let r=e.peek(i);if(wp(r)||r==-1)return n}}function HB(e){return e==32||e==9}function wp(e){return e==10||e==13}function q6e(e){return HB(e)||wp(e)}function Vb(e){return e<0||q6e(e)}const SQt=new $D({start:jb.top,reduce(e,t){return e.type==KE&&(t==yQt||t==wQt)?e.parent:e},shift(e,t,n,i){if(t==Q6e)return new jb(e,gS(i,i.pos),XH);if(t==V6e||t==z6e)return new jb(e,gS(i,i.pos),zB);if(t==hv)return e.parent;if(t==bQt||t==xQt)return new jb(e,0,KE);if(t==H6e&&e.type==VB)return e.parent;if(t==OQt){let r=/[1-9]/.exec(i.read(i.pos,n.pos));if(r)return new jb(e,e.depth+ +r[0],VB)}return e},hash(e){return e.hash}});function Cw(e,t,n=0){return e.peek(n)==t&&e.peek(n+1)==t&&e.peek(n+2)==t&&Vb(e.peek(n+3))}const EQt=new Oo((e,t)=>{if(e.next==-1&&t.canShift(ese))return e.acceptToken(ese);let n=e.peek(-1);if((wp(n)||n<0)&&t.context.type!=KE){if(Cw(e,45))if(t.canShift(hv))e.acceptToken(hv);else return e.acceptToken(oQt,3);if(Cw(e,46))if(t.canShift(hv))e.acceptToken(hv);else return e.acceptToken(aQt,3);let i=0;for(;e.next==32;)i++,e.advance();(i{if(t.context.type==KE){e.next==63&&(e.advance(),Vb(e.next)&&e.acceptToken(uQt));return}if(e.next==45)e.advance(),Vb(e.next)&&e.acceptToken(t.context.type==XH&&t.context.depth==gS(e,e.pos-1)?lQt:Q6e);else if(e.next==63)e.advance(),Vb(e.next)&&e.acceptToken(t.context.type==zB&&t.context.depth==gS(e,e.pos-1)?cQt:z6e);else{let n=e.pos;for(;;)if(HB(e.next)){if(e.pos==n)return;e.advance()}else if(e.next==33)W6e(e);else if(e.next==38)qB(e);else if(e.next==42){qB(e);break}else if(e.next==39||e.next==34){if(YH(e,!0))break;return}else if(e.next==91||e.next==123){if(!AQt(e))return;break}else{K6e(e,!0,!1,0);break}for(;HB(e.next);)e.advance();if(e.next==58){if(e.pos==n&&t.canShift(vQt))return;let i=e.peek(1);Vb(i)&&e.acceptTokenTo(t.context.type==zB&&t.context.depth==gS(e,n)?dQt:V6e,n)}}},{contextual:!0});function TQt(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 tse(e){return e>=48&&e<=57||e>=97&&e<=102||e>=65&&e<=70}function nse(e,t){return e.next==37?(e.advance(),tse(e.next)&&e.advance(),tse(e.next)&&e.advance(),!0):TQt(e.next)||t&&e.next==44?(e.advance(),!0):!1}function W6e(e){if(e.advance(),e.next==60){for(e.advance();;)if(!nse(e,!0)){e.next==62&&e.advance();break}}else for(;nse(e,!1););}function qB(e){for(e.advance();!Vb(e.next)&&QR(e.next)!="f";)e.advance()}function YH(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(wp(s)){if(t)return!1;i=!0}else if(t&&e.pos>=r+1024)return!1}return!i}function AQt(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(!YH(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||wp(e.next))return!1;e.advance()}}const _Qt="iiisiiissisfissssssssssssisssiiissssssssssssssssssssssssssfsfssissssssssssssssssssssssssssfif";function QR(e){return e<33?"u":e>125?"s":_Qt[e-33]}function u4(e,t){let n=QR(e);return n!="u"&&!(t&&n=="f")}function K6e(e,t,n,i){if(QR(e.next)=="s"||(e.next==63||e.next==58||e.next==45)&&u4(e.peek(1),n))e.advance();else return!1;let r=e.pos;for(;;){let s=e.next,a=0,l=i+1;for(;q6e(s);){if(wp(s)){if(t)return!1;l=0}else l++;s=e.peek(++a)}if(!(s>=0&&(s==58?u4(e.peek(a+1),n):s==35?e.peek(a-1)!=32:u4(s,n)))||!n&&l<=i||l==0&&!n&&(Cw(e,45,a)||Cw(e,46,a)))break;if(t&&QR(s)=="f")return!1;for(let u=a;u>=0;u--)e.advance();if(t&&e.pos>r+1024)return!1}return!0}const jQt=new Oo((e,t)=>{if(e.next==33)W6e(e),e.acceptToken(gQt);else if(e.next==38||e.next==42){let n=e.next==38?pQt:mQt;qB(e),e.acceptToken(n)}else e.next==39||e.next==34?(YH(e,!1),e.acceptToken(hQt)):K6e(e,!1,t.context.type==KE,t.context.depth)&&e.acceptToken(fQt)}),NQt=new Oo((e,t)=>{let n=t.context.type==VB?t.context.depth:-1,i=e.pos;e:for(;;){let r=0,s=e.next;for(;s==32;)s=e.peek(++r);if(!r&&(Cw(e,45,r)||Cw(e,46,r))||!wp(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:SQt,nodeProps:[["isolate",-3,8,9,14,""],["openedBy",18,"[",32,"{"],["closedBy",19,"]",33,"}"]],propSources:[RQt],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:[EQt,CQt,jQt,NQt,0,1],topRules:{Stream:[0,15]},tokenPrec:0}),PQt=vp.define({name:"yaml",parser:IQt.configure({props:[Rp.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:Ox({closing:"}"}),FlowSequence:Ox({closing:"]"})}),Ip.add({"FlowMapping FlowSequence":bT,"Item Pair BlockLiteral":(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})})]}),languageData:{commentTokens:{line:"#"},indentOnInput:/^\s*[\]\}]$/}});function DQt(){return new Og(PQt)}function MQt(e){G6e(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]=[],a=e[r],l=0;l2&&a.token&&typeof a.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 a=0;a{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),i=JH(e.state,n.from);return i.line?ZQt(e):i.block?ezt(e):!1};function ZH(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 ZQt=ZH(izt,0),JQt=ZH(e$e,0),ezt=ZH((e,t)=>e$e(e,t,nzt(t)),0);function JH(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}const AO=50;function tzt(e,{open:t,close:n},i,r){let s=e.sliceDoc(i-AO,i),a=e.sliceDoc(r,r+AO),l=/\s*$/.exec(s)[0].length,c=/^\s*/.exec(a)[0].length,u=s.length-l;if(s.slice(u-t.length,u)==t&&a.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*AO?d=f=e.sliceDoc(i,r):(d=e.sliceDoc(i,i+AO),f=e.sliceDoc(r-AO,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 nzt(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 e$e(e,t,n=t.selection.ranges){let i=n.map(s=>JH(t,s.from).block);if(!i.every(s=>s))return null;let r=n.map((s,a)=>tzt(t,i[a],s.from,s.to));if(e!=2&&!r.every(s=>s))return{changes:t.changes(n.map((s,a)=>r[a]?[]:[{from:s.from,insert:i[a].open+" "},{from:s.to,insert:" "+i[a].close}]))};if(e!=1&&r.some(s=>s)){let s=[];for(let a=0,l;ar&&(s==a||a>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 a=t.changes(s);return{changes:a,selection:t.selection.map(a,1)}}else if(e!=1&&i.some(s=>s.comment>=0)){let s=[];for(let{line:a,comment:l,token:c}of i)if(l>=0){let u=a.from+l,d=u+c.length;a.text[d-a.from]==" "&&d++,s.push({from:u,to:d})}return{changes:s}}return null}const KB=Gf.define(),rzt=Gf.define(),szt=an.define(),t$e=an.define({combine(e){return Xf(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)})}}),n$e=qa.define({create(){return Tf.empty},update(e,t){let n=t.state.facet(t$e),i=t.annotation(KB);if(i){let c=lc.fromTransaction(t,i.selection),u=i.side,d=u==0?e.undone:e.done;return c?d=zR(d,d.length,n.minDepth,c):d=s$e(d,t.startState.selection),new Tf(u==0?i.rest:d,u==0?d:i.rest)}let r=t.annotation(rzt);if((r=="full"||r=="before")&&(e=e.isolate()),t.annotation(Mo.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let s=lc.fromTransaction(t),a=t.annotation(Mo.time),l=t.annotation(Mo.userEvent);return s?e=e.addChanges(s,a,l,n,t):t.selection&&(e=e.addSelection(t.startState.selection,a,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 Tf(e.done.map(lc.fromJSON),e.undone.map(lc.fromJSON))}});function ozt(e={}){return[n$e,t$e.of(e),Xt.domEventHandlers({beforeinput(t,n){let i=t.inputType=="historyUndo"?i$e:t.inputType=="historyRedo"?GB:null;return i?(t.preventDefault(),i(n)):!1}})]}function QD(e,t){return function({state:n,dispatch:i}){if(!t&&n.readOnly)return!1;let r=n.field(n$e,!1);if(!r)return!1;let s=r.pop(e,n,t);return s?(i(s),!0):!1}}const i$e=QD(0,!1),GB=QD(1,!1),azt=QD(0,!0),lzt=QD(1,!0);class lc{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 lc(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 lc(t.changes&&Zo.fromJSON(t.changes),[],t.mapped&&Pf.fromJSON(t.mapped),t.startSelection&&ut.fromJSON(t.startSelection),t.selectionsAfter.map(ut.fromJSON))}static fromTransaction(t,n){let i=Bu;for(let r of t.startState.facet(szt)){let s=r(t);s.length&&(i=i.concat(s))}return!i.length&&t.changes.empty?null:new lc(t.changes.invert(t.startState.doc),i,void 0,n||t.startState.selection,Bu)}static selection(t){return new lc(void 0,Bu,void 0,void 0,t)}}function zR(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 czt(e,t){let n=[],i=!1;return e.iterChangedRanges((r,s)=>n.push(r,s)),t.iterChangedRanges((r,s,a,l)=>{for(let c=0;c=u&&a<=d&&(i=!0)}}),i}function uzt(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((n,i)=>n.empty!=t.ranges[i].empty).length===0}function r$e(e,t){return e.length?t.length?e.concat(t):e:t}const Bu=[],dzt=200;function s$e(e,t){if(e.length){let n=e[e.length-1],i=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-dzt));return i.length&&i[i.length-1].eq(t)?e:(i.push(t),zR(e,e.length-1,1e9,n.setSelAfter(i)))}else return[lc.selection([t])]}function fzt(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 d4(e,t){if(!e.length)return e;let n=e.length,i=Bu;for(;n;){let r=hzt(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?[lc.selection(i)]:Bu}function hzt(e,t,n){let i=r$e(e.selectionsAfter.length?e.selectionsAfter.map(l=>l.map(t)):Bu,n);if(!e.changes)return lc.selection(i);let r=e.changes.map(t),s=t.mapDesc(e.changes,!0),a=e.mapped?e.mapped.composeDesc(s):s;return new lc(r,Gn.mapEffects(e.effects,t),a,e.startSelection.map(s),i)}const pzt=/^(input\.type|delete)($|\.)/;class Tf{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 Tf(this.done,this.undone):this}addChanges(t,n,i,r,s){let a=this.done,l=a[a.length-1];return l&&l.changes&&!l.changes.empty&&t.changes&&(!i||pzt.test(i))&&(!l.selectionsAfter.length&&n-this.prevTime0&&n-this.prevTimen.empty?e.moveByChar(n,t):zD(n,t))}function dl(e){return e.textDirectionAt(e.state.selection.main.head)==Qr.LTR}const a$e=e=>o$e(e,!dl(e)),l$e=e=>o$e(e,dl(e));function c$e(e,t){return Wd(e,n=>n.empty?e.moveByGroup(n,t):zD(n,t))}const gzt=e=>c$e(e,!dl(e)),bzt=e=>c$e(e,dl(e));function yzt(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 VD(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;yzt(e,u,r)?i=u:c=n?u.to:u.from}let s=i.type.prop(r),a,l;return s&&(a=n?Cf(e,i.from,1):Cf(e,i.to,-1))&&a.matched?l=n?a.end.to:a.end.from:l=n?i.to:i.from,ut.cursor(l,n?-1:1)}const vzt=e=>Wd(e,t=>VD(e.state,t,!dl(e))),xzt=e=>Wd(e,t=>VD(e.state,t,dl(e)));function u$e(e,t){return Wd(e,n=>{if(!n.empty)return zD(n,t);let i=e.moveVertically(n,t);return i.head!=n.head?i:e.moveToLineBoundary(n,t)})}const d$e=e=>u$e(e,!1),f$e=e=>u$e(e,!0);function h$e(e){let t=e.scrollDOM.clientHeighta.empty?e.moveVertically(a,t,n.height):zD(a,t));if(r.eq(i.selection))return!1;let s;if(n.selfScroll){let a=e.coordsAtPos(i.selection.main.head),l=e.scrollDOM.getBoundingClientRect(),c=l.top+n.marginTop,u=l.bottom-n.marginBottom;a&&a.top>c&&a.bottomp$e(e,!1),XB=e=>p$e(e,!0);function Fg(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 wzt=e=>Wd(e,t=>Fg(e,t,!0)),Ozt=e=>Wd(e,t=>Fg(e,t,!1)),kzt=e=>Wd(e,t=>Fg(e,t,!dl(e))),Szt=e=>Wd(e,t=>Fg(e,t,dl(e))),Ezt=e=>Wd(e,t=>ut.cursor(e.lineBlockAt(t.head).from,1)),Czt=e=>Wd(e,t=>ut.cursor(e.lineBlockAt(t.head).to,-1));function Tzt(e,t,n){let i=!1,r=b1(e.selection,s=>{let a=Cf(e,s.head,-1)||Cf(e,s.head,1)||s.head>0&&Cf(e,s.head-1,1)||s.headTzt(e,t);function id(e,t,n){let i=b1(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(qd(e.state,i)),!0)}function m$e(e,t){return id(e,t,n=>e.moveByChar(n,t))}const g$e=e=>m$e(e,!dl(e)),b$e=e=>m$e(e,dl(e));function y$e(e,t){return id(e,t,n=>e.moveByGroup(n,t))}const _zt=e=>y$e(e,!dl(e)),jzt=e=>y$e(e,dl(e)),Nzt=e=>{let t=!dl(e);return id(e,t,n=>VD(e.state,n,t))},Rzt=e=>{let t=dl(e);return id(e,t,n=>VD(e.state,n,t))};function v$e(e,t){return id(e,t,n=>e.moveVertically(n,t))}const x$e=e=>v$e(e,!1),w$e=e=>v$e(e,!0);function O$e(e,t){return id(e,t,n=>e.moveVertically(n,t,h$e(e).height))}const rse=e=>O$e(e,!1),sse=e=>O$e(e,!0),Izt=e=>id(e,!0,t=>Fg(e,t,!0)),Pzt=e=>id(e,!1,t=>Fg(e,t,!1)),Dzt=e=>{let t=!dl(e);return id(e,t,n=>Fg(e,n,t))},Mzt=e=>{let t=dl(e);return id(e,t,n=>Fg(e,n,t))},Lzt=e=>id(e,!1,t=>ut.cursor(e.lineBlockAt(t.head).from)),$zt=e=>id(e,!0,t=>ut.cursor(e.lineBlockAt(t.head).to)),ose=({state:e,dispatch:t})=>(t(qd(e,{anchor:0})),!0),ase=({state:e,dispatch:t})=>(t(qd(e,{anchor:e.doc.length})),!0),lse=({state:e,dispatch:t})=>(t(qd(e,{anchor:e.selection.main.anchor,head:0})),!0),cse=({state:e,dispatch:t})=>(t(qd(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),Fzt=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),Bzt=({state:e,dispatch:t})=>{let n=HD(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},Uzt=({state:e,dispatch:t})=>{let n=b1(e.selection,i=>{let r=Lr(e),s=r.resolveStack(i.from,1);if(i.empty){let a=r.resolveStack(i.from,-1);a.node.from>=s.node.from&&a.node.to<=s.node.to&&(s=a)}for(let a=s;a;a=a.next){let{node:l}=a;if((l.from=i.to||l.to>i.to&&l.from<=i.from)&&a.next)return ut.range(l.to,l.from)}return i});return n.eq(e.selection)?!1:(t(qd(e,n)),!0)};function k$e(e,t){let{state:n}=e,i=n.selection,r=n.selection.ranges.slice();for(let s of n.selection.ranges){let a=n.doc.lineAt(s.head);if(t?a.to0)for(let l=s;;){let c=e.moveVertically(l,t);if(c.heada.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(qd(n,ut.create(r,r.length-1))),!0)}const Qzt=e=>k$e(e,!1),zzt=e=>k$e(e,!0),Vzt=({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(qd(e,i)),!0):!1};function wT(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:i}=e,r=i.changeByRange(s=>{let{from:a,to:l}=s;if(a==l){let c=t(s);ca&&(n="delete.forward",c=HA(e,c,!0)),a=Math.min(a,c),l=Math.max(l,c)}else a=HA(e,a,!1),l=HA(e,l,!0);return a==l?{range:s}:{changes:{from:a,to:l},range:ut.cursor(a,ar(e)))i.between(t,t,(r,s)=>{rt&&(t=n?s:r)});return t}const S$e=(e,t,n)=>wT(e,i=>{let r=i.from,{state:s}=e,a=s.doc.lineAt(r),l,c;if(n&&!t&&r>a.from&&rS$e(e,!1,!0),E$e=e=>S$e(e,!0,!1),C$e=(e,t)=>wT(e,n=>{let i=n.head,{state:r}=e,s=r.doc.lineAt(i),a=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=xa(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=a(u);if(l!=null&&d!=l)break;(u!=" "||i!=n.head)&&(l=d),i=c}return i}),T$e=e=>C$e(e,!1),Hzt=e=>C$e(e,!0),qzt=e=>wT(e,t=>{let n=e.lineBlockAt(t.head).to;return t.headwT(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),Kzt=e=>wT(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},Xzt=({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),a=r==s.from?r-1:xa(s.text,r-s.from,!1)+s.from,l=r==s.to?r+1:xa(s.text,r-s.from,!0)+s.from;return{changes:{from:a,to:l,insert:e.doc.slice(r,l).append(e.doc.slice(a,r))},range:ut.cursor(l)}});return n.changes.empty?!1:(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function HD(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 a=t[t.length-1];a.to=s.to,a.ranges.push(i)}else t.push({from:r.from,to:s.to,ranges:[i]});n=s.number+1}return t}function A$e(e,t,n){if(e.readOnly)return!1;let i=[],r=[];for(let s of HD(e)){if(n?s.to==e.doc.length:s.from==0)continue;let a=e.doc.lineAt(n?s.to+1:s.from-1),l=a.length+1;if(n){i.push({from:s.to,to:a.to},{from:s.from,insert:a.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:a.from,to:s.from},{from:s.to,insert:e.lineBreak+a.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 Yzt=({state:e,dispatch:t})=>A$e(e,t,!1),Zzt=({state:e,dispatch:t})=>A$e(e,t,!0);function _$e(e,t,n){if(e.readOnly)return!1;let i=[];for(let s of HD(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 Jzt=({state:e,dispatch:t})=>_$e(e,t,!1),eVt=({state:e,dispatch:t})=>_$e(e,t,!0),tVt=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(HD(t).map(({from:r,to:s})=>(r>0?r--:s{let s;if(e.lineWrapping){let a=e.lineBlockAt(r.head),l=e.coordsAtPos(r.head,r.assoc||1);l&&(s=a.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 nVt(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 use=j$e(!1),iVt=j$e(!0);function j$e(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let i=t.changeByRange(r=>{let{from:s,to:a}=r,l=t.doc.lineAt(s),c=!e&&s==a&&nVt(t,s);e&&(s=a=(a<=l.to?l:t.doc.lineAt(a)).to);let u=new MD(t,{simulateBreak:s,simulateDoubleBreak:!!c}),d=OH(u,s);for(d==null&&(d=Md(/^\s*/.exec(t.doc.lineAt(s).text)[0],t.tabSize));al.from&&s{let r=[];for(let a=i.from;a<=i.to;){let l=e.doc.lineAt(a);l.number>n&&(i.empty||i.to>l.from)&&(t(l,r,i),n=l.number),a=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 rVt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),i=new MD(e,{overrideIndentation:s=>{let a=n[s];return a??-1}}),r=eq(e,(s,a,l)=>{let c=OH(i,s.from);if(c==null)return;/\S/.test(s.text)||(c=0);let u=/^\s*/.exec(s.text)[0],d=$E(e,c);(u!=d||l.frome.readOnly?!1:(t(e.update(eq(e,(n,i)=>{i.push({from:n.from,insert:e.facet(m1)})}),{userEvent:"input.indent"})),!0),R$e=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(eq(e,(n,i)=>{let r=/^\s*/.exec(n.text)[0];if(!r)return;let s=Md(r,e.tabSize),a=0,l=$E(e,Math.max(0,s-Dy(e)));for(;a(e.setTabFocusMode(),!0),oVt=[{key:"Ctrl-b",run:a$e,shift:g$e,preventDefault:!0},{key:"Ctrl-f",run:l$e,shift:b$e},{key:"Ctrl-p",run:d$e,shift:x$e},{key:"Ctrl-n",run:f$e,shift:w$e},{key:"Ctrl-a",run:Ezt,shift:Lzt},{key:"Ctrl-e",run:Czt,shift:$zt},{key:"Ctrl-d",run:E$e},{key:"Ctrl-h",run:YB},{key:"Ctrl-k",run:qzt},{key:"Ctrl-Alt-h",run:T$e},{key:"Ctrl-o",run:Gzt},{key:"Ctrl-t",run:Xzt},{key:"Ctrl-v",run:XB}],aVt=[{key:"ArrowLeft",run:a$e,shift:g$e,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:gzt,shift:_zt,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:kzt,shift:Dzt,preventDefault:!0},{key:"ArrowRight",run:l$e,shift:b$e,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:bzt,shift:jzt,preventDefault:!0},{mac:"Cmd-ArrowRight",run:Szt,shift:Mzt,preventDefault:!0},{key:"ArrowUp",run:d$e,shift:x$e,preventDefault:!0},{mac:"Cmd-ArrowUp",run:ose,shift:lse},{mac:"Ctrl-ArrowUp",run:ise,shift:rse},{key:"ArrowDown",run:f$e,shift:w$e,preventDefault:!0},{mac:"Cmd-ArrowDown",run:ase,shift:cse},{mac:"Ctrl-ArrowDown",run:XB,shift:sse},{key:"PageUp",run:ise,shift:rse},{key:"PageDown",run:XB,shift:sse},{key:"Home",run:Ozt,shift:Pzt,preventDefault:!0},{key:"Mod-Home",run:ose,shift:lse},{key:"End",run:wzt,shift:Izt,preventDefault:!0},{key:"Mod-End",run:ase,shift:cse},{key:"Enter",run:use,shift:use},{key:"Mod-a",run:Fzt},{key:"Backspace",run:YB,shift:YB,preventDefault:!0},{key:"Delete",run:E$e,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:T$e,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:Hzt,preventDefault:!0},{mac:"Mod-Backspace",run:Wzt,preventDefault:!0},{mac:"Mod-Delete",run:Kzt,preventDefault:!0}].concat(oVt.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),lVt=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:vzt,shift:Nzt},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:xzt,shift:Rzt},{key:"Alt-ArrowUp",run:Yzt},{key:"Shift-Alt-ArrowUp",run:Jzt},{key:"Alt-ArrowDown",run:Zzt},{key:"Shift-Alt-ArrowDown",run:eVt},{key:"Mod-Alt-ArrowUp",run:Qzt},{key:"Mod-Alt-ArrowDown",run:zzt},{key:"Escape",run:Vzt},{key:"Mod-Enter",run:iVt},{key:"Alt-l",mac:"Ctrl-l",run:Bzt},{key:"Mod-i",run:Uzt,preventDefault:!0},{key:"Mod-[",run:R$e},{key:"Mod-]",run:N$e},{key:"Mod-Alt-\\",run:rVt},{key:"Shift-Mod-k",run:tVt},{key:"Shift-Mod-\\",run:Azt},{key:"Mod-/",run:YQt},{key:"Alt-A",run:JQt},{key:"Ctrl-m",mac:"Shift-Alt-m",run:sVt}].concat(aVt),cVt={key:"Tab",run:N$e,shift:R$e},dse=typeof String.prototype.normalize=="function"?e=>e.normalize("NFKD"):e=>e;class Tw{constructor(t,n,i=0,r=t.length,s,a){this.test=a,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(dse(l)):dse,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 ec(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=nH(t),i=this.bufferStart+this.bufferPos;this.bufferPos+=gf(t);let r=this.normalize(n);if(r.length)for(let s=0,a=i,l=!0;;s++){let c=r.charCodeAt(s),u=this.match(c,a,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=VR(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 Cx(n,t.sliceString(n,i));return f4.set(t,l),l}if(r.from==n&&r.to==i)return r;let{text:s,from:a}=r;return a>n&&(s=t.sliceString(n,a)+s,a=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=VR(this.text,r+(i==r?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Cx.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(P$e.prototype[Symbol.iterator]=D$e.prototype[Symbol.iterator]=function(){return this});function uVt(e){try{return new RegExp(e,tq),!0}catch{return!1}}function VR(e,t){if(t>=e.length)return t;let n=e.lineAt(t),i;for(;t=56320&&i<57344;)t++;return t}const dVt=e=>{let{state:t}=e,n=String(t.doc.lineAt(e.state.selection.main.head).number),{close:i,result:r}=O$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 a=s&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(s.elements.line.value);if(!a){e.dispatch({effects:i});return}let l=t.doc.lineAt(t.selection.main.head),[,c,u,d,f]=a,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},fVt={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},hVt=an.define({combine(e){return Xf(e,fVt,{highlightWordAroundCursor:(t,n)=>t||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function pVt(e){return[vVt,yVt]}const mVt=Cn.mark({class:"cm-selectionMatch"}),gVt=Cn.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function fse(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 bVt(e,t,n,i){return e(t.sliceDoc(n,n+1))==Ts.Word&&e(t.sliceDoc(i-1,i))==Ts.Word}const yVt=eo.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(hVt),{state:n}=e,i=n.selection;if(i.ranges.length>1)return Cn.none;let r=i.main,s,a=null;if(r.empty){if(!t.highlightWordAroundCursor)return Cn.none;let c=n.wordAt(r.head);if(!c)return Cn.none;a=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),a=n.charCategorizer(r.head),!(fse(a,n,r.from,r.to)&&bVt(a,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 Tw(n.doc,s,c.from,c.to);for(;!u.next().done;){let{from:d,to:f}=u.value;if((!a||fse(a,n,d,f))&&(r.empty&&d<=r.from&&f>=r.to?l.push(gVt.range(d,f)):(d>=r.to||f<=r.from)&&l.push(mVt.range(d,f)),l.length>t.maxMatches))return Cn.none}}return Cn.set(l)}},{decorations:e=>e.decorations}),vVt=Xt.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),xVt=({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 wVt(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 a=!1,l=new Tw(e.doc,t,i[i.length-1].to);;)if(l.next(),l.done){if(a)return null;l=new Tw(e.doc,t,0,Math.max(0,i[i.length-1].from-1)),a=!0}else{if(a&&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 OVt=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(s=>s.from===s.to))return xVt({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=wVt(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},y1=an.define({combine(e){return Xf(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:t=>new MVt(t),scrollToMatch:t=>Xt.scrollIntoView(t)})}});class M$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||uVt(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 AVt(this):new EVt(this)}getCursor(t,n=0,i){let r=t.doc?t:Ui.create({doc:t});return i==null&&(i=r.doc.length),this.regexp?mv(this,r,n,i):pv(this,r,n,i)}}class L$e{constructor(t){this.spec=t}}function kVt(e,t,n){return(i,r,s,a)=>{if(n&&!n(i,r,s,a))return!1;let l=i>=a&&r<=a+s.length?s.slice(i-a,r-a):t.doc.sliceString(i,r);return e(l,t,i,r)}}function pv(e,t,n,i){let r;return e.wholeWord&&(r=SVt(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(r=kVt(e.test,t,r)),new Tw(t.doc,e.unquoted,n,i,e.caseSensitive?void 0:s=>s.toLowerCase(),r)}function SVt(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=pv(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 CVt(e,t,n){return(i,r,s)=>(!n||n(i,r,s))&&e(s[0],t,i,r)}function mv(e,t,n,i){let r;return e.wholeWord&&(r=TVt(t.charCategorizer(t.selection.main.head))),e.test&&(r=CVt(e.test,t,r)),new P$e(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:r},n,i)}function HR(e,t){return e.slice(xa(e,t,!1),t)}function qR(e,t){return e.slice(t,xa(e,t))}function TVt(e){return(t,n,i)=>!i[0].length||(e(HR(i.input,i.index))!=Ts.Word||e(qR(i.input,i.index))!=Ts.Word)&&(e(qR(i.input,i.index+i[0].length))!=Ts.Word||e(HR(i.input,i.index+i[0].length))!=Ts.Word)}class AVt extends L$e{nextMatch(t,n,i){let r=mv(this.spec,t,i,t.doc.length).next();return r.done&&(r=mv(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),a=mv(this.spec,t,s,i),l=null;for(;!a.next().done;)l=a.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=mv(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 GE=Gn.define(),nq=Gn.define(),Gm=qa.define({create(e){return new h4(ZB(e).create(),null)},update(e,t){for(let n of t.effects)n.is(GE)?e=new h4(n.value.create(),e.panel):n.is(nq)&&(e=new h4(e.query,n.value?iq:null));return e},provide:e=>ME.from(e,t=>t.panel)});class h4{constructor(t,n){this.query=t,this.panel=n}}const _Vt=Cn.mark({class:"cm-searchMatch"}),jVt=Cn.mark({class:"cm-searchMatch cm-searchMatch-selected"}),NVt=eo.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(Gm))}update(e){let t=e.state.field(Gm);(t!=e.startState.field(Gm)||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 gp;for(let r=0,s=n.visibleRanges,a=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?jVt:_Vt)})}return i.finish()}},{decorations:e=>e.decorations});function OT(e){return t=>{let n=t.state.field(Gm,!1);return n&&n.query.spec.valid?e(t,n):B$e(t)}}const WR=OT((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(y1);return e.dispatch({selection:r,effects:[rq(e,i),s.scrollToMatch(r.main,e)],userEvent:"select.search"}),F$e(e),!0}),KR=OT((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),a=e.state.facet(y1);return e.dispatch({selection:s,effects:[rq(e,r),a.scrollToMatch(s.main,e)],userEvent:"select.search"}),F$e(e),!0}),RVt=OT((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)}),IVt=({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=[],a=0;for(let l=new Tw(e.doc,e.sliceDoc(i,r));!l.next().done;){if(s.length>1e3)return!1;l.value.from==i&&(a=s.length),s.push(ut.range(l.value.from,l.value.to))}return t(e.update({selection:ut.create(s,a),userEvent:"select.search.matches"})),!0},hse=OT((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 a=s,l=[],c,u,d=[];a.precise?a.from==i&&a.to==r&&(u=n.toText(t.getReplacement(a)),l.push({from:a.from,to:a.to,insert:u}),a=t.nextMatch(n,a.from,a.to),d.push(Xt.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(i).number)+"."))):a=t.nextMatch(n,a.from,a.to);let f=e.state.changes(l);return a&&(c=ut.single(a.from,a.to).map(f),d.push(rq(e,a)),d.push(n.facet(y1).scrollToMatch(c.main,e))),e.dispatch({changes:f,selection:c,effects:d,userEvent:"input.replace"}),!0}),PVt=OT((e,{query:t})=>{if(e.state.readOnly)return!1;let n=[];for(let r of t.matchAll(e.state,1e9)){let{from:s,to:a,precise:l}=r;l&&n.push({from:s,to:a,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 iq(e){return e.state.facet(y1).createPanel(e)}function ZB(e,t){var n,i,r,s,a;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(y1);return new M$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:(a=t==null?void 0:t.wholeWord)!==null&&a!==void 0?a:u.wholeWord})}function $$e(e){let t=xH(e,iq);return t&&t.dom.querySelector("[main-field]")}function F$e(e){let t=$$e(e);t&&t==e.root.activeElement&&t.select()}const B$e=e=>{let t=e.state.field(Gm,!1);if(t&&t.panel){let n=$$e(e);if(n&&n!=e.root.activeElement){let i=ZB(e.state,t.query.spec);i.valid&&e.dispatch({effects:GE.of(i)}),n.focus(),n.select()}}else e.dispatch({effects:[nq.of(!0),t?GE.of(ZB(e.state,t.query.spec)):Gn.appendConfig.of($Vt)]});return!0},U$e=e=>{let t=e.state.field(Gm,!1);if(!t||!t.panel)return!1;let n=xH(e,iq);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:nq.of(!1)}),!0},DVt=[{key:"Mod-f",run:B$e,scope:"editor search-panel"},{key:"F3",run:WR,shift:KR,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:WR,shift:KR,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:U$e,scope:"editor search-panel"},{key:"Mod-Shift-l",run:IVt},{key:"Mod-Alt-g",run:dVt},{key:"Mod-d",run:OVt,preventDefault:!0}];class MVt{constructor(t){this.view=t;let n=this.query=t.state.field(Gm).query.spec;this.commit=this.commit.bind(this),this.searchField=Ir("input",{value:n.search,placeholder:Rc(t,"Find"),"aria-label":Rc(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:Rc(t,"Replace"),"aria-label":Rc(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,a){return Ir("button",{class:"cm-button",name:r,onclick:s,type:"button"},a)}this.dom=Ir("div",{onkeydown:r=>this.keydown(r),class:"cm-search"},[this.searchField,i("next",()=>WR(t),[Rc(t,"next")]),i("prev",()=>KR(t),[Rc(t,"previous")]),i("select",()=>RVt(t),[Rc(t,"all")]),Ir("label",null,[this.caseField,Rc(t,"match case")]),Ir("label",null,[this.reField,Rc(t,"regexp")]),Ir("label",null,[this.wordField,Rc(t,"by word")]),...t.state.readOnly?[]:[Ir("br"),this.replaceField,i("replace",()=>hse(t),[Rc(t,"replace")]),i("replaceAll",()=>PVt(t),[Rc(t,"replace all")])],Ir("button",{name:"close",onclick:()=>U$e(t),"aria-label":Rc(t,"close"),type:"button"},["×"])])}commit(){let t=new M$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:GE.of(t)}))}keydown(t){N6t(this.view,t,"search-panel")?t.preventDefault():t.keyCode==13&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?KR:WR)(this.view)):t.keyCode==13&&t.target==this.replaceField&&(t.preventDefault(),hse(this.view))}update(t){for(let n of t.transactions)for(let i of n.effects)i.is(GE)&&!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(y1).top}}function Rc(e,t){return e.state.phrase(t)}const qA=30,WA=/[\s\.,:;?!]/;function rq(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-qA),a=Math.min(r,n+qA),l=e.state.sliceDoc(s,a);if(s!=i.from){for(let c=0;cl.length-qA;c--)if(!WA.test(l[c-1])&&WA.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 LVt=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"}}),$Vt=[Gm,jp.low(NVt),LVt];class pse{constructor(t,n,i){this.from=t,this.to=n,this.diagnostic=i}}class Nb{constructor(t,n,i){this.diagnostics=t,this.panel=n,this.selected=i}static init(t,n,i){let r=i.facet(XE).markerFilter;r&&(t=r(t,i));let s=t.slice().sort((m,g)=>m.from-g.from||m.to-g.to),a=new gp,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=YVt(l);if(y)a.add(b,b,Cn.widget({widget:new WVt(x),diagnostics:l.slice()}));else{let w=l.reduce((O,S)=>S.markClass?O+" "+S.markClass:O,"");a.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&&a.diagnostics.indexOf(t)<0))if(!i)i=new pse(r,s,t||a.diagnostics[0]);else{if(a.diagnostics.indexOf(i.diagnostic)<0)return!1;i=new pse(i.from,s,i.diagnostic)}}),i}function FVt(e,t){let n=t.pos,i=t.end||n,r=e.state.facet(XE).hideOn(e,n,i);if(r!=null)return r;let s=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(a=>a.is(Q$e))||e.changes.touchesRange(s.from,Math.max(s.to,i)))}function BVt(e,t){return e.field(Xc,!1)?t:t.concat(Gn.appendConfig.of(ZVt))}const Q$e=Gn.define(),sq=Gn.define(),z$e=Gn.define(),Xc=qa.define({create(){return new Nb(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=kg(n,e.selected.diagnostic,s)||kg(n,null,s)}!n.size&&r&&t.state.facet(XE).autoPanel&&(r=null),e=new Nb(n,r,i)}for(let n of t.effects)if(n.is(Q$e)){let i=t.state.facet(XE).autoPanel?n.value.length?YE.open:null:e.panel;e=Nb.init(n.value,i,t.state)}else n.is(sq)?e=new Nb(e.diagnostics,n.value?YE.open:null,e.selected):n.is(z$e)&&(e=new Nb(e.diagnostics,e.panel,n.value));return e},provide:e=>[ME.from(e,t=>t.panel),Xt.decorations.from(e,t=>t.diagnostics)]}),UVt=Cn.mark({class:"cm-lintRange cm-lintRange-active"});function QVt(e,t,n){let{diagnostics:i}=e.state.field(Xc),r,s=-1,a=-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)&&(tH$e(e,n,!1)))}const VVt=e=>{let t=e.state.field(Xc,!1);(!t||!t.panel)&&e.dispatch({effects:BVt(e.state,[sq.of(!0)])});let n=xH(e,YE.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},mse=e=>{let t=e.state.field(Xc,!1);return!t||!t.panel?!1:(e.dispatch({effects:sq.of(!1)}),!0)},HVt=e=>{let t=e.state.field(Xc,!1);if(!t)return!1;let n=e.state.selection.main,i=kg(t.diagnostics,null,n.to+1);return!i&&(i=kg(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}),x$t(e,i.from,1,{tooltip:q$e,until:r=>r.docChanged||r.newSelection.main.headi.to}),!0)},qVt=[{key:"Mod-Shift-m",run:VVt,preventDefault:!0},{key:"F8",run:HVt}],XE=an.define({combine(e){return{sources:e.map(t=>t.source).filter(t=>t!=null),...Xf(e.map(t=>t.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:gse,tooltipFilter:gse,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 gse(e,t){return e?t?(n,i)=>t(e(n,i),i):e:t}function V$e(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 H$e(e,t,n){var i;let r=n?V$e(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,a)=>{let l=!1,c=m=>{if(m.preventDefault(),l)return;l=!0;let g=kg(e.state.field(Xc).diagnostics,t);g&&s.apply(e,g.from,g.to)},{name:u}=s,d=r[a]?u.indexOf(r[a]):-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[a]})"`}.`},f)}),t.source&&Ir("div",{class:"cm-diagnosticSource"},t.source))}class WVt extends Hd{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 bse{constructor(t,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=H$e(t,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class YE{constructor(t){this.view=t,this.items=[];let n=r=>{if(!(r.ctrlKey||r.altKey||r.metaKey)){if(r.keyCode==27)mse(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],a=V$e(s.actions);for(let l=0;l{for(let s=0;smse(this.view)},"×")),this.update()}get selectedIndex(){let t=this.view.state.field(Xc).selected;if(!t)return-1;for(let n=0;n{for(let d of u.diagnostics){if(a.has(d))continue;a.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(Xc),i=kg(n.diagnostics,this.items[t].diagnostic);i&&this.view.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0,effects:z$e.of(i)})}static open(t){return new YE(t)}}function KVt(e,t='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(e)}')`}function KA(e){return KVt(``,'width="6" height="3"')}const GVt=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:KA("#f11")},".cm-lintRange-warning":{backgroundImage:KA("orange")},".cm-lintRange-info":{backgroundImage:KA("#999")},".cm-lintRange-hint":{backgroundImage:KA("#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 XVt(e){return e=="error"?4:e=="warning"?3:e=="info"?2:1}function YVt(e){let t="hint",n=1;for(let i of e){let r=XVt(i.severity);r>n&&(n=r,t=i.severity)}return t}const q$e=v$t(QVt,{hideOn:FVt}),ZVt=[Xc,Xt.decorations.compute([Xc],e=>{let{selected:t,panel:n}=e.field(Xc);return!t||!n||t.from==t.to?Cn.none:Cn.set([UVt.range(t.from,t.to)])}),q$e,GVt];var yse=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(sBt)),t.defaultKeymap!==!1&&(s=s.concat(lVt)),t.searchKeymap!==!1&&(s=s.concat(DVt)),t.historyKeymap!==!1&&(s=s.concat(mzt)),t.foldKeymap!==!1&&(s=s.concat(cFt)),t.completionKeymap!==!1&&(s=s.concat(S4e)),t.lintKeymap!==!1&&(s=s.concat(qVt));var a=[];return t.lineNumbers!==!1&&a.push(U3e()),t.highlightActiveLineGutter!==!1&&a.push(D$t()),t.highlightSpecialChars!==!1&&a.push(K6t()),t.history!==!1&&a.push(ozt()),t.foldGutter!==!1&&a.push(hFt()),t.drawSelection!==!1&&a.push(L6t()),t.dropCursor!==!1&&a.push(Q6t()),t.allowMultipleSelections!==!1&&a.push(Ui.allowMultipleSelections.of(!0)),t.indentOnInput!==!1&&a.push(tFt()),t.syntaxHighlighting!==!1&&a.push(n4e(bFt,{fallback:!0})),t.bracketMatching!==!1&&a.push(SFt()),t.closeBrackets!==!1&&a.push(tBt()),t.autocompletion!==!1&&a.push(fBt()),t.rectangularSelection!==!1&&a.push(l$t()),r!==!1&&a.push(d$t()),t.highlightActiveLine!==!1&&a.push(e$t()),t.highlightSelectionMatches!==!1&&a.push(pVt()),t.tabSize&&typeof t.tabSize=="number"&&a.push(m1.of(" ".repeat(t.tabSize))),a.concat([p1.of(s.flat())]).filter(Boolean)};const JVt="#e5c07b",vse="#e06c75",eHt="#56b6c2",tHt="#ffffff",Tj="#abb2bf",JB="#7d8799",nHt="#61afef",iHt="#98c379",xse="#d19a66",rHt="#c678dd",sHt="#21252b",wse="#2c313a",Ose="#282c34",p4="#353a42",oHt="#3E4451",kse="#528bff",aHt=Xt.theme({"&":{color:Tj,backgroundColor:Ose},".cm-content":{caretColor:kse},".cm-cursor, .cm-dropCursor":{borderLeftColor:kse},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:oHt},".cm-panels":{backgroundColor:sHt,color:Tj},".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:Ose,color:JB,border:"none"},".cm-activeLineGutter":{backgroundColor:wse},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:p4},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:p4,borderBottomColor:p4},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:wse,color:Tj}}},{dark:!0}),lHt=vT.define([{tag:oe.keyword,color:rHt},{tag:[oe.name,oe.deleted,oe.character,oe.propertyName,oe.macroName],color:vse},{tag:[oe.function(oe.variableName),oe.labelName],color:nHt},{tag:[oe.color,oe.constant(oe.name),oe.standard(oe.name)],color:xse},{tag:[oe.definition(oe.name),oe.separator],color:Tj},{tag:[oe.typeName,oe.className,oe.number,oe.changed,oe.annotation,oe.modifier,oe.self,oe.namespace],color:JVt},{tag:[oe.operator,oe.operatorKeyword,oe.url,oe.escape,oe.regexp,oe.link,oe.special(oe.string)],color:eHt},{tag:[oe.meta,oe.comment],color:JB},{tag:oe.strong,fontWeight:"bold"},{tag:oe.emphasis,fontStyle:"italic"},{tag:oe.strikethrough,textDecoration:"line-through"},{tag:oe.link,color:JB,textDecoration:"underline"},{tag:oe.heading,fontWeight:"bold",color:vse},{tag:[oe.atom,oe.bool,oe.special(oe.variableName)],color:xse},{tag:[oe.processingInstruction,oe.string,oe.inserted],color:iHt},{tag:oe.invalid,color:tHt}]),cHt=[aHt,n4e(lHt)];var uHt=Xt.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),dHt=function(t){t===void 0&&(t={});var n=t,i=n.indentWithTab,r=i===void 0?!0:i,s=n.editable,a=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(p1.of([cVt])),g&&(typeof g=="boolean"?b.unshift(yse()):b.unshift(yse(g))),h&&b.unshift(r$t(h)),d){case"light":b.push(uHt);break;case"dark":b.push(cHt);break;case"none":break;default:b.push(d);break}return a===!1&&b.push(Xt.editable.of(!1)),c&&b.push(Ui.readOnly.of(!0)),[...b]},fHt=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 hHt{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 Sse{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 m4=null,pHt=()=>typeof window>"u"?new Sse:(m4||(m4=new Sse),m4),mHt=Xt.theme({"& .cm-scroller":{height:"100% !important"}}),Ese=null,g4=null;function gHt(e,t,n,i,r,s){if(!e&&!t&&!n&&!i&&!r&&!s)return null;var a=JSON.stringify({height:e,minHeight:t,maxHeight:n,width:i,minWidth:r,maxWidth:s});return a===Ese||(Ese=a,g4=Xt.theme({"&":{height:e,minHeight:t,maxHeight:n,width:i,minWidth:r,maxWidth:s}})),g4}var Cse=Gf.define(),bHt=200,yHt=[];function vHt(e){var t=e.value,n=e.selection,i=e.onChange,r=e.onStatistics,s=e.onCreateEditor,a=e.onUpdate,l=e.extensions,c=l===void 0?yHt: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,N=E===void 0?"":E,A=e.editable,j=A===void 0?!0:A,T=e.readOnly,R=T===void 0?!1:T,_=e.indentWithTab,D=_===void 0?!0:_,M=e.basicSetup,P=M===void 0?!0:M,L=e.root,F=e.initialState,I=p.useState(),z=I[0],K=I[1],B=p.useState(),W=B[0],H=B[1],X=p.useState(),ie=X[0],Q=X[1],Z=p.useState(()=>({current:null}))[0],ue=p.useState(()=>({current:null}))[0],Ee=gHt(m,b,y,w,S,C),Y=Xt.updateListener.of(de=>{if(de.docChanged&&typeof i=="function"&&!de.transactions.some(fe=>fe.annotation(Cse))){Z.current?Z.current.reset():(Z.current=new hHt(()=>{if(ue.current){var fe=ue.current;ue.current=null,fe()}Z.current=null},bHt),pHt().add(Z.current));var Ce=de.state.doc,le=Ce.toString();i(le,de)}r&&r(fHt(de))}),G=dHt({theme:f,editable:j,readOnly:R,placeholder:N,indentWithTab:D,basicSetup:P}),te=[Y,...Ee?[Ee]:[],mHt,...G];return a&&typeof a=="function"&&te.push(Xt.updateListener.of(a)),te=te.concat(c),p.useLayoutEffect(()=>{if(z&&!ie){var de={doc:t,selection:n,extensions:te},Ce=F?Ui.fromJSON(F.json,de,F.fields):Ui.create(de);if(Q(Ce),!W){var le=new Xt({state:Ce,parent:z,root:L});H(le),s&&s(le,Ce)}}return()=>{W&&(Q(void 0),H(void 0))}},[z,ie]),p.useEffect(()=>{e.container&&K(e.container)},[e.container]),p.useEffect(()=>()=>{W&&(W.destroy(),H(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,N,j,R,D,P,i,a]),p.useEffect(()=>{if(t!==void 0){var de=W?W.state.doc.toString():"";if(W&&t!==de){var Ce=Z.current&&!Z.current.isDone,le=()=>{W&&t!==W.state.doc.toString()&&W.dispatch({changes:{from:0,to:W.state.doc.toString().length,insert:t||""},annotations:[Cse.of(!0)]})};Ce?ue.current=le:le()}}},[t,W]),{state:ie,setState:Q,view:W,setView:H,container:z,setContainer:K}}var xHt=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],W$e=p.forwardRef((e,t)=>{var n=e.className,i=e.value,r=i===void 0?"":i,s=e.selection,a=e.extensions,l=a===void 0?[]:a,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,N=e.readOnly,A=e.root,j=e.initialState,T=XQt(e,xHt),R=p.useRef(null),_=vHt({root:A,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:N,selection:s,onChange:c,onStatistics:u,onCreateEditor:d,onUpdate:f,extensions:l,initialState:j}),D=_.state,M=_.view,P=_.container,L=_.setContainer;p.useImperativeHandle(t,()=>({editor:R.current,state:D,view:M}),[R,P,D,M]);var F=p.useCallback(z=>{R.current=z,L(z)},[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 o.jsx("div",WB({ref:F,className:""+I+(n?" "+n:"")},T))});W$e.displayName="CodeMirror";function K$e(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")?[SH.define(GQt)]:i==="py"||i==="pyi"?[sQt()]:["ts","tsx","mts","cts"].includes(i??"")?[PB({typescript:!0,jsx:i==="tsx"})]:["js","jsx","mjs","cjs"].includes(i??"")?[PB({jsx:i==="jsx"})]:i==="json"||i==="jsonc"?[EBt()]:i==="yaml"||i==="yml"?[DQt()]:["md","markdown"].includes(i??"")?[F7t()]:[]}function kT({value:e,path:t,onChange:n,readOnly:i=!1,theme:r="light",lineNumberStart:s=1,height:a="100%",minHeight:l,maxHeight:c,extensions:u}){const d=p.useMemo(()=>[...K$e(t),...s===1?[]:[U3e({formatNumber:f=>String(f+s-1)})],...u??[]],[s,t,u]);return o.jsx(W$e,{value:e,height:a,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 G$e=Object.freeze(Object.defineProperty({__proto__:null,default:kT,languageFor:K$e},Symbol.toStringTag,{value:"Module"}));function wHt(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((a,l)=>l>0&&a.trim()==="---");if(n<0)return{body:e,frontmatter:[]};const i=uLe(t.slice(1,n).join(` @@ -755,7 +755,7 @@ ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.pus `);if(!t.startsWith(`--- `))return e;const n=t.indexOf(` --- -`,4);return n>=0?t.slice(n+5).trimStart():e}function aFe(e,t){const n=(e||"").trim();return!n||[">",">-","|","|-"].includes(n)?t("common.noDescription"):n}function dqt(){return o.jsx("svg",{className:"icon",viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:o.jsx("path",{d:"m7.5 7.5 9 9m0-9-9 9",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function fqt(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"M12 5.5v13M5.5 12h13",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round"})})}function Pse({direction:e}){return o.jsx("svg",{className:"icon",viewBox:"0 0 20 20",fill:"none","aria-hidden":!0,children:o.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 hqt(){return o.jsx("span",{className:"skillcenter-loading-mark","aria-hidden":!0})}function pqt({page:e,total:t,pageSize:n,onPage:i}){const{t:r}=_e("ui"),s=Math.max(1,Math.ceil(t/n));return o.jsxs("footer",{className:"skillcenter-pager",children:[o.jsx("span",{children:r("skillCenter.totalItems",{count:t})}),o.jsxs("div",{className:"skillcenter-pager-actions",children:[o.jsx("button",{type:"button",onClick:()=>i(e-1),disabled:e<=1,"aria-label":r("common.previousPage"),children:o.jsx(Pse,{direction:"left"})}),o.jsxs("span",{children:[e," / ",s]}),o.jsx("button",{type:"button",onClick:()=>i(e+1),disabled:e>=s,"aria-label":r("common.nextPage"),children:o.jsx(Pse,{direction:"right"})})]})]})}function mqt({children:e}){return o.jsx("div",{className:"skillcenter-empty",children:e})}function v4({kind:e,title:t,description:n,error:i,action:r}){return o.jsx("div",{className:`skillcenter-page-state is-${e}`,role:e==="error"?"alert":"status",children:o.jsxs(Pn,{fill:"none",children:[o.jsx(Pn.Title,{children:t}),n?o.jsx(Pn.Description,{children:n}):null,i?o.jsx(ms,{error:i}):null,r?o.jsx(Pn.ActionRow,{children:o.jsx(Dt,{color:"secondary",size:"lg",onClick:r.onClick,children:r.label})}):null]})})}function Dse({errors:e,cloudProvider:t,fullPage:n=!1,onRetry:i}){const{t:r}=_e("ui");return o.jsxs("div",{className:`skillcenter-space-errors${n?" is-full-page":""}`,role:"alert",children:[o.jsxs("div",{className:"skillcenter-space-errors__content",children:[o.jsx("strong",{children:r(n?"skillCenter.cannotLoadSpaces":"skillCenter.someSpacesFailed")}),e.map(({region:s,error:a})=>o.jsxs("section",{children:[o.jsx("span",{children:Mf(s,t)}),o.jsx(ms,{error:a})]},s))]}),o.jsx("button",{type:"button",onClick:i,children:r("common.reload")})]})}function gqt({skill:e,space:t,region:n,cloudProvider:i,detail:r,files:s,loading:a,error:l,canOptimize:c,reviews:u,reviewsLoading:d,reviewsError:f,onOptimize:h,onDownload:m,onClose:g}){const{t:b}=_e("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]),o.jsx("div",{className:"skill-detail-backdrop",role:"presentation",onMouseDown:g,children:o.jsxs("section",{className:"skill-detail-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"skill-detail-title",onMouseDown:x=>x.stopPropagation(),children:[o.jsxs("header",{className:"skill-detail-head",children:[o.jsx("div",{className:"skill-detail-heading",children:o.jsxs("div",{children:[o.jsx("h2",{id:"skill-detail-title",children:(r==null?void 0:r.name)||e.skillName}),o.jsx("p",{children:aFe((r==null?void 0:r.description)||e.skillDescription,b)})]})}),o.jsxs("div",{className:"skill-detail-actions",children:[o.jsx("button",{type:"button",onClick:m,disabled:s.length===0,children:b("skillCenter.downloadZip")}),t.isShared?null:o.jsx(GR,{disabled:!c,placement:"bottom",children:o.jsx("button",{type:"button",onClick:h,disabled:!c,children:b("skillCenter.optimize")})}),o.jsx("button",{type:"button",className:"skill-detail-close",onClick:g,"aria-label":b("skillCenter.closeSkillDetails"),children:o.jsx(dqt,{})})]})]}),o.jsxs("dl",{className:"skill-detail-meta",children:[o.jsxs("div",{children:[o.jsx("dt",{children:b("skillCenter.skillId")}),o.jsx("dd",{title:e.skillId,children:e.skillId})]}),o.jsxs("div",{children:[o.jsx("dt",{children:b("agentSelector.version")}),o.jsx("dd",{children:e.sourceVersion||(r==null?void 0:r.version)||e.version||"—"})]}),e.author?o.jsxs("div",{children:[o.jsx("dt",{children:b("skillCenter.author")}),o.jsx("dd",{children:e.author})]}):null,o.jsxs("div",{children:[o.jsx("dt",{children:b("agentSelector.status")}),o.jsx("dd",{children:oFe(e.skillStatus,b)})]}),o.jsxs("div",{children:[o.jsx("dt",{children:b("skillCenter.skillSpace")}),o.jsx("dd",{title:oc(t),children:t.isShared?b("skillCenter.sharedSpace"):oc(t)})]}),o.jsxs("div",{children:[o.jsx("dt",{children:b("myAgents.region")}),o.jsx("dd",{children:Mf(n,i)})]})]}),o.jsx(t0,{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}),o.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?o.jsx(za,{}):f?o.jsx("div",{role:"alert",children:o.jsx(ms,{error:f})}):o.jsx(cq,{applications:u}):a?o.jsxs("div",{className:"skillcenter-loading",children:[o.jsx(hqt,{}),b("skillCenter.loadingSkillContent")]}):l?o.jsx("div",{className:"skillcenter-error",children:o.jsx(ms,{error:l})}):s.length>0?o.jsx(qD,{files:s.map(x=>x.path.endsWith("SKILL.md")&&x.content?{...x,content:uqt(x.content)}:x)}):o.jsx(mqt,{children:b("skillCenter.noSkillContent")})})]})})}function bqt({space:e,canUseSandbox:t,onUpload:n,onSandbox:i,onClose:r}){const{t:s}=_e("ui");return p.useEffect(()=>{const a=l=>{l.key==="Escape"&&r()};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[r]),o.jsx("div",{className:"skill-dialog-backdrop",role:"presentation",onMouseDown:r,children:o.jsxs("section",{className:"skill-dialog skill-add-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"skill-add-dialog-title",onMouseDown:a=>a.stopPropagation(),children:[o.jsxs("header",{children:[o.jsxs("div",{children:[o.jsx("h2",{id:"skill-add-dialog-title",children:s("skillCenter.addSkill")}),o.jsx("p",{title:oc(e),children:oc(e)})]}),o.jsx("button",{type:"button",onClick:r,children:s("common.cancel")})]}),o.jsxs("div",{className:"skill-add-dialog__options",children:[o.jsxs("button",{type:"button",onClick:n,children:[o.jsx("strong",{children:s("skillCenter.localUpload")}),o.jsx("span",{children:s("skillCenter.localUploadDescription")})]}),o.jsx(GR,{disabled:!t,placement:"inside",children:o.jsxs("button",{type:"button",disabled:!t,onClick:i,children:[o.jsx("strong",{children:s("skillCenter.autoCreate")}),o.jsx("span",{children:s("skillCenter.autoCreateDescription")})]})})]})]})})}function yqt({cloudProvider:e="volcengine",region:t,active:n=!0,activationRevision:i=0,initialWorkspace:r=null,onInitialWorkspaceConsumed:s,onPageTitleChange:a,toolbarLeading:l,toolbarFilters:c}){var ir;const{t:u,i18n:d}=_e("ui"),f=p.useMemo(()=>[t],[t]),[h,m]=p.useState([]),[g,b]=p.useState(null),[v,y]=p.useState([]),x=p.useMemo(()=>J$e(v),[v]),[w,O]=p.useState(null),[S,k]=p.useState(null),[C,E]=p.useState(!1),N=p.useRef(""),A=p.useRef(!1),[j,T]=p.useState({}),[R,_]=p.useState(!1),[D,M]=p.useState(""),[P,L]=p.useState((r==null?void 0:r.space)??null),F=p.useRef(P);F.current=P;const[I,z]=p.useState([]),[K,B]=p.useState(1),[W,H]=p.useState(0),[X,ie]=p.useState(!1),[Q,Z]=p.useState(null),[ue,Ee]=p.useState(!1),[Y,G]=p.useState(""),[te,de]=p.useState("overview"),[Ce,le]=p.useState(null),[fe,re]=p.useState(null),[Oe,Pe]=p.useState(null),[be,Qe]=p.useState([]),[ve,Ne]=p.useState(!1),[ne,ye]=p.useState(null),[Te,Se]=p.useState(null),[Ke,it]=p.useState(!1),[he,xe]=p.useState(null),[Ae,qe]=p.useState(null),[Me,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),Le=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(D),cn=p.useDeferredValue(Y),hn=ln&&(P||ln.selectPublishSpace)?ln.operation==="create"?u("skillCenter.createSkill"):u("skillCenter.optimizeNamed",{name:((ir=ln.source)==null?void 0:ir.name)||u("skillCenter.skill")}):"",Ge=P!=null&&P.isShared?u("skillCenter.sharedSpace"):oc(P),bt=!(P!=null&&P.isShared)||P.canWrite===!0,St=hn||Ge||u("skillCenter.library");p.useEffect(()=>{n&&(a==null||a(St))},[n,a,St]),p.useEffect(()=>{r&&(s==null||s())},[r,s]);const dn=p.useMemo(()=>{const Ve=Ht.trim().toLocaleLowerCase(),kt=h.filter(rn=>!rn.isShared);return Ve?kt.filter(rn=>`${oc(rn)} ${rn.name} ${rn.description||""} ${rn.projectName||""}`.toLocaleLowerCase().includes(Ve)):kt},[Ht,h]),Rt=p.useMemo(()=>{const Ve=cn.trim().toLocaleLowerCase();return Ve?I.filter(kt=>`${kt.skillName} ${kt.skillDescription||""}`.toLocaleLowerCase().includes(Ve)):I},[cn,I]),$e=(P==null?void 0:P.region)||Ki(e);p.useEffect(()=>{if(!n||!P)return;const Ve=()=>Ct(rn=>rn+1),kt=()=>{document.visibilityState==="visible"&&Ve()};return window.addEventListener("focus",Ve),document.addEventListener("visibilitychange",kt),()=>{window.removeEventListener("focus",Ve),document.removeEventListener("visibilitychange",kt)}},[n,P==null?void 0:P.id]),p.useEffect(()=>{const Ve=P?`${$e}:${P.id}`:"";if(N.current!==Ve&&(N.current=Ve,y([]),O(null),re(null)),k(null),E(!1),!n||!P||P.isShared)return;const kt=new AbortController;return E(!0),nDt({spaceId:P.id,region:$e,signal:kt.signal}).then(rn=>{kt.signal.aborted||y(rn.items)}).catch(rn=>{kt.signal.aborted||k(xr(rn,u("skillCenter.reviewStatusFailed")))}).finally(()=>{kt.signal.aborted||E(!1)}),()=>kt.abort()},[P==null?void 0:P.id,P==null?void 0:P.isShared,$e,Ot,n,i,u]);const ot=p.useMemo(()=>f.flatMap(Ve=>{var rn;const kt=(rn=j[Ve])==null?void 0:rn.error;return kt?[{region:Ve,error:kt}]:[]}),[j,f]),vn=f.some(Ve=>{const kt=j[Ve];return!!(kt&&!kt.done&&!kt.error)}),Ye=ot.length===f.length;p.useEffect(()=>{const Ve=new AbortController;return uD(Ve.signal).then(Se).catch(()=>Se({enabled:!1,reason:u("skillCenter.adminNotConfigured"),operations:["create","optimize"],models:[],styles:{}})),()=>Ve.abort()},[u]);const mt=p.useCallback(async(Ve,kt)=>{var $r;if(gt.current||Ve.length===0)return;gt.current=!0,_(!0),kt&&(($r=st.current)==null||$r.abort(),m([]),T(Object.fromEntries(Ve.map(({region:qn})=>[qn,{nextPage:1,loadedCount:0,done:!1,error:null}]))));const rn=new AbortController;st.current=rn;const Nn=++We.current,se=await Promise.allSettled(Ve.map(async({region:qn,page:oi})=>({region:qn,page:oi,result:await GPt({region:qn,page:oi,pageSize:sqt,signal:rn.signal})})));if(We.current!==Nn)return;const xi=se.map((qn,oi)=>{const Vi=Ve[oi];return qn.status==="rejected"?{request:Vi,error:xr(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:ia,totalCount:Wa})=>{const Hr=oi[Vi.region]||{nextPage:Vi.page,loadedCount:0,done:!1,error:null};if(Fr){oi[Vi.region]={...Hr,error:Fr};return}const ko=Hr.loadedCount+ia;oi[Vi.region]={nextPage:Vi.page+1,loadedCount:ko,done:ia===0||ko>=Wa,error:null}}),oi}),m(qn=>cqt(kt?[]:qn,is)),L(qn=>qn&&(is.find(oi=>Lc(oi)===Lc(qn))||qn)),gt.current=!1,_(!1)},[]),_n=p.useCallback(()=>{if(gt.current)return;const Ve=f.flatMap(kt=>{const rn=j[kt];return rn&&!rn.done&&!rn.error?[{region:kt,page:rn.nextPage}]:[]});mt(Ve,!1)},[mt,j,f]);p.useEffect(()=>{Hn(),L(null),z([]),B(1)},[e]),p.useEffect(()=>{if(n)return mt(f.map(Ve=>({region:Ve,page:1})),!0),()=>{var Ve;We.current+=1,(Ve=st.current)==null||Ve.abort(),gt.current=!1}},[n,i,mt,f,It]),p.useEffect(()=>{const Ve=ft.current,kt=xt.current;if(!Ve||!kt||!vn||R)return;const rn=new IntersectionObserver(([Nn])=>{Nn.isIntersecting&&_n()},{root:kt,rootMargin:"240px 0px",threshold:.01});return rn.observe(Ve),()=>rn.disconnect()},[vn,_n,R]);const Vt=()=>{const Ve=xt.current;!Ve||!vn||R||Ve.scrollHeight-Ve.scrollTop-Ve.clientHeight<=240&&_n()};p.useEffect(()=>{if(!P){z([]),H(0),Ee(!1);return}let Ve=!0;return ie(!0),Z(null),cDt(P.id,{region:$e,page:K,pageSize:Rse,project:P.projectName}).then(kt=>{Ve&&(z(kt.items||[]),H(kt.totalCount||0),Ee(kt.degraded===!0))}).catch(kt=>{Ve&&(z([]),H(0),Ee(!1),Z(xr(kt,u("skillCenter.errors.loadSkills"))))}).finally(()=>{Ve&&ie(!1)}),()=>{Ve=!1}},[$e,P,K,Ot,u]);const Ti=Ve=>{Hn(),L(Ve),de("overview"),B(1),G("")},jn=()=>{Hn(),L(null),z([]),H(0),Ee(!1),de("overview"),B(1),G(""),Nt(null)},Hn=()=>{Le.current+=1,le(null),Pe(null),Qe([]),ye(null),Ne(!1)},En=async Ve=>{if(!P)return;const kt=Fb(Ve),rn=Le.current+1;Le.current=rn,le(Ve),Pe(null),ye(null),Ne(!0);try{const[Nn,se]=await Promise.all([uDt(P.id,kt,Ve.version,$e,P.projectName,Ve.skillName,P.name),MMe({spaceId:P.id,skillId:kt,version:Ve.version,region:$e,skillSpaceName:P.name,skillName:Ve.skillName})]);Le.current===rn&&(Pe(Nn),Qe(se))}catch(Nn){Le.current===rn&&ye(xr(Nn,u("skillCenter.errors.loadSkillDetails")))}finally{Le.current===rn&&Ne(!1)}},vi=Ve=>{if(P)return{kind:"skill-center",skillId:Fb(Ve),version:Ve.version,region:$e,projectName:P.projectName,skillSpaceId:P.id,skillSpaceName:P.name,name:Ve.skillName,description:Ve.skillDescription}},Fn=Ve=>{const kt=vi(Ve);!kt||!(Te!=null&&Te.enabled)||(Hn(),He({operation:"optimize",source:kt}))},di=async Ve=>{if(!(!P||!window.confirm(u("skillCenter.deleteSkillConfirm",{name:Ve.skillName})))){yt(Ve.skillId),Nt(null);try{await aDt({spaceId:P.id,skillId:Ve.skillId,region:$e}),Ct(kt=>kt+1),lt(kt=>kt+1)}catch(kt){Nt(xr(kt,u("skillCenter.errors.deleteSkill")))}finally{yt("")}}},wr=async Ve=>{if(!window.confirm(u("skillCenter.deleteSpaceConfirm",{name:oc(Ve)})))return;const kt=Lc(Ve);vt(kt),Nt(null);try{await rDt({spaceId:Ve.id,region:Ve.region||Ki(e)}),P&&Lc(P)===kt&&jn(),lt(rn=>rn+1)}catch(rn){Nt(xr(rn,u("skillCenter.errors.deleteSpace")))}finally{vt("")}},gr=async(Ve,kt=Ve.version,rn=!1)=>{var xi,is,$r,qn;if(!P||A.current)return;const Nn=P,se=`${Nn.region}:${Nn.id}:${Ve.skillId}:${kt}`;A.current=!0,b(se),Nt(null);try{const oi=await ZPt({spaceId:Nn.id,skillId:Ve.skillId,version:kt,region:Nn.region||$e});((xi=F.current)==null?void 0:xi.id)===Nn.id&&((is=F.current)==null?void 0:is.region)===Nn.region&&y(Vi=>[...Vi.filter(Fr=>Fr.id!==oi.id),oi])}catch(oi){if(rn)throw xr(oi,u("skillCenter.reviewFailed"));(($r=F.current)==null?void 0:$r.id)===Nn.id&&((qn=F.current)==null?void 0:qn.region)===Nn.region&&Nt(xr(oi,u("skillCenter.reviewFailed")))}finally{A.current=!1,b(null)}};return ln&&(P||ln.selectPublishSpace)?o.jsx(DHt,{operation:ln.operation,cloudProvider:e,space:P??void 0,availableSpaces:h.filter(Ve=>!Ve.isShared),spacesLoading:R,initialIntent:ln.initialIntent,source:ln.source,onBack:()=>He(null),onPublished:()=>{Ct(Ve=>Ve+1),lt(Ve=>Ve+1)}}):o.jsxs("section",{className:`skillcenter${P?" is-space":" resource-collection"}`,children:[P?o.jsx(GC,{className:"skillcenter-detail",title:Ge||P.name,description:P.isShared?u("skillCenter.sharedDescription"):P.description||u("skillCenter.manageSpaceDescription"),identitySeed:P.name,backLabel:u("skillCenter.backToSpaces"),onBack:jn,sections:[{key:"overview",label:u("skillCenter.overview"),content:o.jsxs(o.Fragment,{children:[jt?o.jsx("div",{className:"skillcenter-inline-error",role:"alert",children:o.jsx(ms,{error:jt})}):null,S?o.jsxs("div",{className:"skillcenter-inline-error",role:"alert",children:[o.jsx(ms,{error:S}),o.jsx("button",{type:"button",onClick:()=>Ct(Ve=>Ve+1),children:u("common.reload")})]}):null,o.jsx("section",{className:"skillcenter-overview",children:o.jsxs(Fz,{className:"skillcenter-detail-facts",children:[o.jsxs("div",{children:[o.jsx("dt",{children:u("skillCenter.skillCount")}),o.jsx("dd",{children:W})]}),o.jsxs("div",{children:[o.jsx("dt",{children:u("skillCenter.updatedAt")}),o.jsx("dd",{children:P.updatedAt?lqt(P.updatedAt,d.resolvedLanguage??d.language):"—"})]})]})})]})},{key:"skills",label:u("skillCenter.skills"),content:o.jsxs(o.Fragment,{children:[jt?o.jsx("div",{className:"skillcenter-inline-error",role:"alert",children:o.jsx(ms,{error:jt})}):null,S?o.jsxs("div",{className:"skillcenter-inline-error",role:"alert",children:[o.jsx(ms,{error:S}),o.jsx("button",{type:"button",onClick:()=>Ct(Ve=>Ve+1),children:u("common.reload")})]}):null,o.jsxs("section",{className:"skillcenter-results","aria-label":u("skillCenter.skillsInSpace",{name:Ge||P.name}),children:[o.jsx(CIe,{title:u("skillCenter.skills"),description:u("skillCenter.totalItems",{count:W}),actions:o.jsxs(o.Fragment,{children:[o.jsx(pp,{"aria-label":u("skillCenter.searchSkills"),value:Y,onChange:Ve=>G(Ve.target.value),placeholder:u("skillCenter.searchSkills")}),o.jsx(Dt,{color:"secondary",variant:"outline",size:"sm",pill:!1,disabled:X||C,onClick:()=>Ct(Ve=>Ve+1),children:u("common.refresh")})]})}),ue?o.jsx("div",{className:"skillcenter-inline-warning",role:"status",children:u("skillCenter.degradedRelationWarning")}):null,X&&I.length===0?o.jsx(za,{}):Q&&I.length===0?o.jsx(v4,{kind:"error",title:u("skillCenter.cannotLoadSkills"),error:Q,action:{label:u("common.reload"),onClick:()=>Ct(Ve=>Ve+1)}}):Rt.length===0?o.jsx(v4,{kind:"empty",title:Y.trim()?u("skillCenter.noMatchingSkills"):u("skillCenter.noSkills"),description:Y.trim()?u("skillCenter.tryAnotherName"):u(P.isShared?"skillCenter.sharedEmpty":"skillCenter.emptySkillsDescription"),action:!Y.trim()&&bt?{label:u("skillCenter.localUpload"),onClick:()=>At(P)}:void 0}):o.jsx("div",{className:"skillcenter-table-wrap",children:o.jsxs("table",{className:"skillcenter-table",children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{scope:"col",children:u("skillCenter.skills")}),o.jsx("th",{scope:"col",children:u("agentSelector.status")}),o.jsx("th",{scope:"col",className:"skillcenter-table__actions-heading",children:u("skillCenter.actions")})]})}),o.jsx("tbody",{children:Rt.map(Ve=>{const kt=x.get(`${Ve.skillId}:${Ve.version}`);return o.jsxs("tr",{children:[o.jsx("td",{className:"skillcenter-table__skill",children:o.jsxs("button",{type:"button",onClick:()=>void En(Ve),children:[o.jsxs("span",{className:"skillcenter-table__title-row",children:[o.jsx("strong",{title:Ve.skillName,children:Ve.skillName}),Ve.version?o.jsx("span",{className:"skillcenter-table__version-badge",children:Ve.sourceVersion||Ve.version}):null]}),o.jsx("span",{className:"skillcenter-table__description",children:aFe(Ve.skillDescription,u)}),P.isShared&&Ve.author?o.jsx("span",{className:"skillcenter-table__author",children:u("skillCenter.authorName",{name:Ve.author})}):null]})}),o.jsx("td",{children:o.jsxs("div",{className:"skillcenter-review-status",children:[o.jsx("span",{className:`skillcenter-status ${aqt(Ve.skillStatus)}`,children:oFe(Ve.skillStatus,u)}),kt?o.jsx(ET,{status:kt.status}):null,kt!=null&&kt.reviewer||kt!=null&&kt.reviewedBy?o.jsx(aq,{compact:!0,person:kt.reviewer,fallback:kt.reviewedBy}):null]})}),o.jsx("td",{children:o.jsxs("div",{className:"skillcenter-table__actions",children:[o.jsx("button",{type:"button",onClick:()=>void En(Ve),children:u("common.view")}),!Ve.lookupByName&&Ve.skillId?o.jsx("button",{type:"button",onClick:()=>re(Ve),children:u("skillCenter.versions.title")}):null,!P.isShared&&!Ve.lookupByName&&Ve.skillId?o.jsx("button",{type:"button",disabled:C||S!==null||g!==null||kt!==void 0&&kt.status!=="returned",onClick:()=>void gr(Ve),children:g===`${P.region}:${P.id}:${Ve.skillId}:${Ve.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(rn=>rn.sourceSkillId===Ve.skillId)?o.jsx("button",{type:"button",onClick:()=>O(Ve),children:u("skillCenter.reviewHistory")}):null,P.isShared?null:o.jsx(GR,{disabled:!(Te!=null&&Te.enabled),children:o.jsx("button",{type:"button",disabled:!(Te!=null&&Te.enabled),onClick:()=>Fn(Ve),children:u("skillCenter.optimize")})}),!Ve.lookupByName&&bt?o.jsx("button",{type:"button",className:"is-danger",disabled:dt===Ve.skillId,onClick:()=>void di(Ve),children:dt===Ve.skillId?u("common.deleting"):u("common.delete")}):null]})})]},`${Fb(Ve)}:${Ve.version}`)})})]})}),!Y.trim()&&!X&&!Q&&W>0?o.jsx(pqt,{page:K,total:W,pageSize:Rse,onPage:B}):null]})]})}],activeSectionKey:te,navigationLabel:u("skillCenter.spaceDetails"),onSectionChange:Ve=>de(Ve),actionsClassName:"skillcenter-toolbar-actions",actions:o.jsxs(o.Fragment,{children:[P.isShared?null:o.jsxs(o.Fragment,{children:[o.jsx(Dt,{type:"button",color:"secondary",variant:"outline",size:"lg",pill:!1,onClick:()=>xe(P),children:u("skillCenter.editSpace")}),o.jsx(Dt,{type:"button",color:"danger",variant:"soft",size:"lg",pill:!1,disabled:Ie===Lc(P),onClick:()=>void wr(P),children:Ie===Lc(P)?u("common.deleting"):u("skillCenter.deleteSpace")})]}),bt?o.jsx(Dt,{type:"button",color:"secondary",variant:"outline",size:"lg",pill:!1,onClick:()=>At(P),children:u("skillCenter.localUpload")}):null,P.isShared?null:o.jsx(GR,{disabled:!(Te!=null&&Te.enabled),children:o.jsxs(Dt,{type:"button",color:"primary",size:"lg",pill:!1,disabled:!(Te!=null&&Te.enabled),onClick:()=>He({operation:"create"}),children:[o.jsx(nAe,{"aria-hidden":"true"}),o.jsx("span",{children:u("skillCenter.createSkill")})]})})]})}):o.jsxs(o.Fragment,{children:[o.jsxs(e0,{className:"skillcenter-list-toolbar library-resource-toolbar",children:[l,o.jsxs("div",{className:"resource-toolbar__actions",children:[c,o.jsx(pp,{"aria-label":u("skillCenter.searchSpaces"),value:D,onChange:Ve=>M(Ve.target.value),placeholder:u("skillCenter.searchSpaces")})]})]}),jt?o.jsx("div",{className:"skillcenter-inline-error",role:"alert",children:o.jsx(ms,{error:jt})}):null,o.jsxs(Pg,{className:"skillcenter-list-results",ref:xt,"aria-label":u("skillCenter.spaceList"),onScroll:Vt,children:[ot.length>0&&!Ye?o.jsx(Dse,{errors:ot,cloudProvider:e,onRetry:()=>lt(Ve=>Ve+1)}):null,o.jsxs(n0,{children:[o.jsx(eqt,{region:t,active:n,revision:It+i,onOpen:Ti},`${e}:${t}`),D.trim()?null:o.jsx(hg,{"aria-label":u("skillCenter.createSpace"),icon:o.jsx(fqt,{}),onClick:()=>it(!0),children:u("skillCenter.newSpace")}),dn.map(Ve=>{const kt=Lc(Ve);return o.jsx(r0,{className:"skillcenter-space-card",title:oc(Ve),description:Ve.description||u("common.noDescription"),metadata:[{label:u("skillCenter.skillCount"),value:u("skillCenter.skillCountValue",{count:Ve.skillCount??0})},{label:u("skillCenter.updatedAt"),value:KD(Ve.updatedAt,Date.now(),d.resolvedLanguage??d.language)}],action:{label:u("skillCenter.addSkill"),icon:"plus",onClick:()=>qe(Ve)},detailAction:{label:u("common.viewDetails"),onClick:()=>Ti(Ve)}},kt)})]}),R&&h.length===0?o.jsx(za,{}):Ye&&h.length===0?o.jsx(Dse,{errors:ot,cloudProvider:e,fullPage:!0,onRetry:()=>lt(Ve=>Ve+1)}):dn.length===0&&D.trim()?o.jsx(v4,{kind:"empty",title:u("skillCenter.noMatchingSpaces"),description:u("skillCenter.tryAnotherName")}):null,!Ye&&h.length>0?o.jsx("div",{className:"my-agent-load-more",ref:ft,"aria-live":"polite",children:R?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"my-agent-loading-mark","aria-hidden":"true"}),o.jsx("span",{children:u("skillCenter.loadingMoreSpaces")})]}):vn?o.jsx("span",{children:u("skillCenter.scrollForMore")}):ot.length>0?o.jsx("span",{children:u("skillCenter.someSpacesFailed")}):o.jsx("span",{children:u("skillCenter.allSpacesLoaded")})}):null]})]}),fe&&P?o.jsx(JHt,{skill:fe,space:P,region:$e,reviews:v.filter(Ve=>Ve.sourceSkillId===fe.skillId),onClose:()=>re(null),onChanged:()=>Ct(Ve=>Ve+1),onSubmitReview:!P.isShared&&!C&&!S?Ve=>gr(fe,Ve,!0):void 0},`${$e}:${P.id}:${fe.skillId}`):null,w?o.jsx(ZHt,{name:w.skillName,applications:v.filter(Ve=>Ve.sourceSkillId===w.skillId),onClose:()=>O(null)}):null,Ce&&P&&o.jsx(gqt,{skill:Ce,space:P,region:$e,cloudProvider:e,detail:Oe,files:be,loading:ve,error:ne,reviews:v.filter(Ve=>Ve.sourceSkillId===Ce.skillId),reviewsLoading:C,reviewsError:S,canOptimize:!P.isShared&&(Te==null?void 0:Te.enabled)===!0,onOptimize:()=>Fn(Ce),onDownload:()=>void lDt({spaceId:P.id,skillId:Fb(Ce),version:Ce.version,region:$e,fallbackName:Ce.skillName,skillSpaceName:P.name,skillName:Ce.skillName}).catch(Ve=>ye(xr(Ve,u("skillCenter.errors.downloadSkill")))),onClose:Hn}),Ke?o.jsx(tqt,{region:t,regionOptions:nu(e),onClose:()=>it(!1),onCreated:Ve=>{it(!1),lt(kt=>kt+1),L({...Ve,region:Ve.region||t})}}):null,he?o.jsx(nqt,{space:he,region:he.region||Ki(e),onClose:()=>xe(null),onUpdated:Ve=>{const kt={...Ve,region:Ve.region||he.region||Ki(e)};xe(null),L(rn=>rn&&Lc(rn)===Lc(kt)?kt:rn),m(rn=>rn.map(Nn=>Lc(Nn)===Lc(kt)?kt:Nn)),lt(rn=>rn+1)}}):null,Ae?o.jsx(bqt,{space:Ae,canUseSandbox:(Te==null?void 0:Te.enabled)===!0,onClose:()=>qe(null),onUpload:()=>{At(Ae),qe(null)},onSandbox:()=>{const Ve=Ae;qe(null),Ti(Ve),He({operation:"create"})}}):null,Me?o.jsx(iqt,{space:Me,region:Me.region||Ki(e),onClose:()=>At(null),onUploaded:()=>{At(null),Ct(Ve=>Ve+1),lt(Ve=>Ve+1)}}):null]})}function vqt(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 xqt({cloudProvider:e,studioRegion:t="",activeTab:n,onTabChange:i,onPageTitleChange:r,skillInitialWorkspace:s=null,onSkillInitialWorkspaceConsumed:a,artifactSources:l=[],artifactUserId:c="",onArtifactActivate:u,onArtifactSourceOpen:d}){const{t:f,i18n:h}=_e("workspaceTools"),m=p.useMemo(()=>vqt(f),[f]),g=f("library.tabs.skills"),b=zI(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])),[N,A]=p.useState({skills:0,knowledge:0,artifacts:0}),j=p.useRef(u),[T,R]=p.useState([]),[_,D]=p.useState(!1),[M,P]=p.useState(""),L=p.useMemo(()=>{const ie=N1t(l,f("library.untitledSession"));return{key:JSON.stringify(ie),candidates:ie}},[l,f]),F=p.useRef(L);F.current.key!==L.key&&(F.current=L);const I=F.current.candidates,z=p.useMemo(()=>nu(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,N.artifacts]);const K=p.useCallback(async()=>{D(!0),P("");try{R(await B1t(I))}catch(ie){P(ie instanceof Error?ie.message:String(ie))}finally{D(!1)}},[I]);p.useEffect(()=>{n==="artifacts"&&K()},[n,N.artifacts,K]);const B=ie=>{E(Q=>{if(Q.has(ie))return Q;const Z=new Set(Q);return Z.add(ie),Z}),A(Q=>({...Q,[ie]:Q[ie]+1})),i(ie)},W=o.jsx(t0,{idPrefix:"library",ariaLabel:f("library.categoryAria"),value:n,items:m,onChange:B}),H=ie=>o.jsx(fg,{id:ie,ariaLabel:f("library.regionAria"),value:v,options:z,onChange:y}),X=n==="skills"?x!==g:n==="knowledge"&&S;return o.jsxs($f,{className:`library-view${X?" is-detail":""}`,"aria-label":f("library.title"),children:[X?null:o.jsx(Jy,{className:"library-view__header",title:f("library.title")}),o.jsxs("div",{className:"library-panels",children:[C.has("skills")?o.jsx("div",{id:"library-skills-panel",className:"library-panel",role:"tabpanel","aria-labelledby":"library-skills-tab",hidden:n!=="skills",children:o.jsx(yqt,{cloudProvider:e,region:v,active:n==="skills",activationRevision:N.skills,onPageTitleChange:w,initialWorkspace:s,onInitialWorkspaceConsumed:a,toolbarLeading:W,toolbarFilters:H("library-skills-region-filter")})}):null,C.has("knowledge")?o.jsx("div",{id:"library-knowledge-panel",className:"library-panel",role:"tabpanel","aria-labelledby":"library-knowledge-tab",hidden:n!=="knowledge",children:o.jsx(IPt,{cloudProvider:e,region:v,active:n==="knowledge",activationRevision:N.knowledge,onDetailChange:k,toolbarLeading:W,toolbarFilters:H("library-knowledge-region-filter")})}):null,C.has("artifacts")?o.jsx("div",{id:"library-artifacts-panel",className:"library-panel",role:"tabpanel","aria-labelledby":"library-artifacts-tab",hidden:n!=="artifacts",children:o.jsx(L1t,{items:T,region:v,userId:c,active:n==="artifacts",activationRevision:N.artifacts,loading:_,error:M?Uu(M,h.resolvedLanguage||h.language)||f("artifactLibrary.loadDetailFallback"):"",onRetry:()=>void K(),onEdit:U1t,onDelete:Q1t,onDownload:z1t,onOpenSource:d?ie=>d(ie.appName,ie.sessionId):void 0,toolbarLeading:W,toolbarFilters:H("library-artifacts-region-filter")})}):null]})]})}const lFe="veadk_agentkit_connections",wqt=3e3,Mse=6e4;function xd(){try{const e=localStorage.getItem(lFe);return(e?JSON.parse(e):[]).filter(n=>!n.runtimeId||!!n.region)}catch{return[]}}function GD(e){try{localStorage.setItem(lFe,JSON.stringify(e))}catch{}}function Nd(e,t){return`agentkit:${e}:${t}`}function cFe(e){try{return new URL(e).host}catch{return e}}function S1(e){NEe();for(const t of e)if(!(t.runtimeId&&!t.region))for(const n of t.apps)jEe(Nd(t.id,n),t.runtimeId?{app:n,runtimeId:t.runtimeId,region:t.region}:{app:n,base:t.base,apiKey:t.apiKey})}function uFe(e,t,n,i,r,s){const a={id:`rt_${e}`,name:t||e,runtimeId:e,region:n,apps:i,appLabels:r,currentVersion:s},l=xd(),c=l.findIndex(u=>u.runtimeId===e);return c===-1?l.push(a):l[c]=a,GD(l),S1(l),a}async function Oqt(e,t,n,i,r){let s=null,a=n||"cn-beijing",l=null;for(const f of OC(n))try{const h=await Kx(e,f,{retryProbe:!0,preferCached:!0,currentVersion:i});if(h&&h.length>0){await KCe(e,f),s=h,a=f;break}}catch(h){if(h instanceof Bw)throw XR(e),h;if(h instanceof ho&&h.unsupported){l=h;continue}throw h}if(!s||s.length===0)throw XR(e),l||new ho(V("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=uFe(e,t,a,s,u,i);return Nd(d.id,s[0])}function kqt(e){return new Promise(t=>window.setTimeout(t,e))}async function Aj(e,t,n,i,r={}){const s=Date.now();for(;;)try{return await Oqt(e,t,n,i,r.agentName)}catch(a){const l=Date.now()-s;if(!r.waitForReady||!(a instanceof ho)||!a.retryable||l>=Mse)throw a;const c=Math.min(wqt,Mse-l);await kqt(c)}}async function dFe(e,t,n,i){const r=t.trim().replace(/\/+$/,""),s=await kC(r,n.trim()),a={id:Date.now().toString(36),name:e.trim()||cFe(r),base:r,apiKey:n.trim(),apps:s,appLabels:i&&s.length>0?{[s[0]]:i}:void 0},l=[...xd().filter(c=>c.base!==r),a];return GD(l),S1(l),a}function Sqt(e){const t=xd().filter(n=>n.id!==e);return GD(t),S1(t),t}function XR(e){const t=xd().filter(n=>n.runtimeId!==e);return GD(t),S1(t),t}function fFe(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 a=((l=r.appLabels)==null?void 0:l[s])??s;return{id:Nd(r.id,s),label:a,app:s,remote:!0,host:r.runtimeId?r.name:cFe(r.base??""),runtimeId:r.runtimeId,region:r.region,currentVersion:r.currentVersion}}));return[...n,...i]}const Lse=Object.freeze(Object.defineProperty({__proto__:null,addConnection:dFe,addRuntimeConnection:uFe,buildAgentEntries:fFe,connectRuntime:Aj,loadConnections:xd,registerConnections:S1,remoteAppId:Nd,removeConnection:Sqt,removeRuntimeConnection:XR},Symbol.toStringTag,{value:"Module"}));function Eqt({onAdded:e,onCancel:t}){const{t:n}=_e("conversation"),[i,r]=p.useState(""),[s,a]=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 dFe(l,i,s,l);if(b.apps.length===0){h(n("addAgentKit.noAgents")),d(!1);return}e(Nd(b.id,b.apps[0]))}catch(b){h(n("addAgentKit.connectionFailed",{error:String(b)})),d(!1)}}}return o.jsx("div",{className:"addagent",children:o.jsxs("div",{className:"addagent-card",children:[o.jsx("h2",{className:"addagent-title",children:n("addAgentKit.title")}),o.jsx("p",{className:"addagent-sub",children:n("addAgentKit.description")}),o.jsxs("label",{className:"addagent-field",children:[o.jsx("span",{className:"addagent-label",children:n("addAgentKit.url")}),o.jsx("input",{className:"addagent-input",value:i,onChange:b=>r(b.target.value),placeholder:"https://xxxxx.apigateway-cn-beijing.volceapi.com",autoFocus:!0})]}),o.jsxs("label",{className:"addagent-field",children:[o.jsx("span",{className:"addagent-label",children:"API Key"}),o.jsx("input",{className:"addagent-input",type:"password",value:s,onChange:b=>a(b.target.value),placeholder:n("addAgentKit.apiKeyHint")})]}),o.jsxs("label",{className:"addagent-field",children:[o.jsx("span",{className:"addagent-label",children:n("addAgentKit.displayName")}),o.jsx("input",{className:"addagent-input",value:l,onChange:b=>c(b.target.value),placeholder:n("addAgentKit.displayNameHint")})]}),f&&o.jsx("div",{className:"addagent-error",children:f}),o.jsxs("div",{className:"addagent-actions",children:[o.jsx("button",{className:"addagent-btn addagent-btn--ghost",onClick:t,disabled:u,children:n("addAgentKit.cancel")}),o.jsxs("button",{className:"addagent-btn addagent-btn--primary",onClick:g,disabled:!m,children:[u?o.jsx(Mi,{className:"icon spin"}):null,n(u?"addAgentKit.connecting":"addAgentKit.connect")]})]})]})})}const Cqt=/[\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff]/u,Tqt={"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"},Aqt={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 XD(e){var r,s;const t=((r=e.message)==null?void 0:r.trim())??"",n=e.messageCode?Tqt[e.messageCode]:void 0;if(n)return V(n);if(t&&($$().toLowerCase()==="zh-cn"||!Cqt.test(t)))return t;if(e.phase==="build"&&((s=e.buildLog)!=null&&s.status)){const a={running:"client.deploymentProgress.buildLogsSyncing",complete:"client.deploymentProgress.buildLogsComplete",error:"client.deploymentProgress.buildLogsUnavailable"}[e.buildLog.status];if(a)return V(a)}const i=e.phase?Aqt[e.phase]:void 0;return i?V(i):t||V("client.deploymentProgress.inProgress")}function _qt(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 jqt=[{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"}]}],Nqt={核心能力回归:"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 pk(e,t){const n=Nqt[e];return n?t(n):e}const $se=["basic","usage","evaluations","optimizations","integrations","versions"],Rqt=20;function Iqt(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 _O=[{id:"api-server",label:"API Server"},{id:"a2a",label:"A2A"}];function x4(e,t){return e?`${e.replace(/\/+$/,"")}${t}`:""}function Pqt(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 Fse(e,t){return e==="key_auth"?"API Key":e==="custom_jwt"?"OAuth / JWT":t(e==="none"?"agentWorkspace.noAuthentication":"agentWorkspace.notAvailable")}function Bse(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 Dqt(e,t){return e.changeType==="rollback"?t("agentWorkspace.rollbackEvent"):e.version}function e9(e){return JSON.stringify(e)}function hFe(e){return e==="key_auth"?`API_KEY = "" +`,4);return n>=0?t.slice(n+5).trimStart():e}function aFe(e,t){const n=(e||"").trim();return!n||[">",">-","|","|-"].includes(n)?t("common.noDescription"):n}function dqt(){return o.jsx("svg",{className:"icon",viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:o.jsx("path",{d:"m7.5 7.5 9 9m0-9-9 9",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function fqt(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"M12 5.5v13M5.5 12h13",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round"})})}function Pse({direction:e}){return o.jsx("svg",{className:"icon",viewBox:"0 0 20 20",fill:"none","aria-hidden":!0,children:o.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 hqt(){return o.jsx("span",{className:"skillcenter-loading-mark","aria-hidden":!0})}function pqt({page:e,total:t,pageSize:n,onPage:i}){const{t:r}=_e("ui"),s=Math.max(1,Math.ceil(t/n));return o.jsxs("footer",{className:"skillcenter-pager",children:[o.jsx("span",{children:r("skillCenter.totalItems",{count:t})}),o.jsxs("div",{className:"skillcenter-pager-actions",children:[o.jsx("button",{type:"button",onClick:()=>i(e-1),disabled:e<=1,"aria-label":r("common.previousPage"),children:o.jsx(Pse,{direction:"left"})}),o.jsxs("span",{children:[e," / ",s]}),o.jsx("button",{type:"button",onClick:()=>i(e+1),disabled:e>=s,"aria-label":r("common.nextPage"),children:o.jsx(Pse,{direction:"right"})})]})]})}function mqt({children:e}){return o.jsx("div",{className:"skillcenter-empty",children:e})}function v4({kind:e,title:t,description:n,error:i,action:r}){return o.jsx("div",{className:`skillcenter-page-state is-${e}`,role:e==="error"?"alert":"status",children:o.jsxs(Pn,{fill:"none",children:[o.jsx(Pn.Title,{children:t}),n?o.jsx(Pn.Description,{children:n}):null,i?o.jsx(ms,{error:i}):null,r?o.jsx(Pn.ActionRow,{children:o.jsx(Dt,{color:"secondary",size:"lg",onClick:r.onClick,children:r.label})}):null]})})}function Dse({errors:e,cloudProvider:t,fullPage:n=!1,onRetry:i}){const{t:r}=_e("ui");return o.jsxs("div",{className:`skillcenter-space-errors${n?" is-full-page":""}`,role:"alert",children:[o.jsxs("div",{className:"skillcenter-space-errors__content",children:[o.jsx("strong",{children:r(n?"skillCenter.cannotLoadSpaces":"skillCenter.someSpacesFailed")}),e.map(({region:s,error:a})=>o.jsxs("section",{children:[o.jsx("span",{children:Mf(s,t)}),o.jsx(ms,{error:a})]},s))]}),o.jsx("button",{type:"button",onClick:i,children:r("common.reload")})]})}function gqt({skill:e,space:t,region:n,cloudProvider:i,detail:r,files:s,loading:a,error:l,canOptimize:c,reviews:u,reviewsLoading:d,reviewsError:f,onOptimize:h,onDownload:m,onClose:g}){const{t:b}=_e("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]),o.jsx("div",{className:"skill-detail-backdrop",role:"presentation",onMouseDown:g,children:o.jsxs("section",{className:"skill-detail-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"skill-detail-title",onMouseDown:x=>x.stopPropagation(),children:[o.jsxs("header",{className:"skill-detail-head",children:[o.jsx("div",{className:"skill-detail-heading",children:o.jsxs("div",{children:[o.jsx("h2",{id:"skill-detail-title",children:(r==null?void 0:r.name)||e.skillName}),o.jsx("p",{children:aFe((r==null?void 0:r.description)||e.skillDescription,b)})]})}),o.jsxs("div",{className:"skill-detail-actions",children:[o.jsx("button",{type:"button",onClick:m,disabled:s.length===0,children:b("skillCenter.downloadZip")}),t.isShared?null:o.jsx(GR,{disabled:!c,placement:"bottom",children:o.jsx("button",{type:"button",onClick:h,disabled:!c,children:b("skillCenter.optimize")})}),o.jsx("button",{type:"button",className:"skill-detail-close",onClick:g,"aria-label":b("skillCenter.closeSkillDetails"),children:o.jsx(dqt,{})})]})]}),o.jsxs("dl",{className:"skill-detail-meta",children:[o.jsxs("div",{children:[o.jsx("dt",{children:b("skillCenter.skillId")}),o.jsx("dd",{title:e.skillId,children:e.skillId})]}),o.jsxs("div",{children:[o.jsx("dt",{children:b("agentSelector.version")}),o.jsx("dd",{children:e.sourceVersion||(r==null?void 0:r.version)||e.version||"—"})]}),e.author?o.jsxs("div",{children:[o.jsx("dt",{children:b("skillCenter.author")}),o.jsx("dd",{children:e.author})]}):null,o.jsxs("div",{children:[o.jsx("dt",{children:b("agentSelector.status")}),o.jsx("dd",{children:oFe(e.skillStatus,b)})]}),o.jsxs("div",{children:[o.jsx("dt",{children:b("skillCenter.skillSpace")}),o.jsx("dd",{title:oc(t),children:t.isShared?b("skillCenter.sharedSpace"):oc(t)})]}),o.jsxs("div",{children:[o.jsx("dt",{children:b("myAgents.region")}),o.jsx("dd",{children:Mf(n,i)})]})]}),o.jsx(t0,{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}),o.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?o.jsx(za,{}):f?o.jsx("div",{role:"alert",children:o.jsx(ms,{error:f})}):o.jsx(cq,{applications:u}):a?o.jsxs("div",{className:"skillcenter-loading",children:[o.jsx(hqt,{}),b("skillCenter.loadingSkillContent")]}):l?o.jsx("div",{className:"skillcenter-error",children:o.jsx(ms,{error:l})}):s.length>0?o.jsx(qD,{files:s.map(x=>x.path.endsWith("SKILL.md")&&x.content?{...x,content:uqt(x.content)}:x)}):o.jsx(mqt,{children:b("skillCenter.noSkillContent")})})]})})}function bqt({space:e,canUseSandbox:t,onUpload:n,onSandbox:i,onClose:r}){const{t:s}=_e("ui");return p.useEffect(()=>{const a=l=>{l.key==="Escape"&&r()};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[r]),o.jsx("div",{className:"skill-dialog-backdrop",role:"presentation",onMouseDown:r,children:o.jsxs("section",{className:"skill-dialog skill-add-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"skill-add-dialog-title",onMouseDown:a=>a.stopPropagation(),children:[o.jsxs("header",{children:[o.jsxs("div",{children:[o.jsx("h2",{id:"skill-add-dialog-title",children:s("skillCenter.addSkill")}),o.jsx("p",{title:oc(e),children:oc(e)})]}),o.jsx("button",{type:"button",onClick:r,children:s("common.cancel")})]}),o.jsxs("div",{className:"skill-add-dialog__options",children:[o.jsxs("button",{type:"button",onClick:n,children:[o.jsx("strong",{children:s("skillCenter.localUpload")}),o.jsx("span",{children:s("skillCenter.localUploadDescription")})]}),o.jsx(GR,{disabled:!t,placement:"inside",children:o.jsxs("button",{type:"button",disabled:!t,onClick:i,children:[o.jsx("strong",{children:s("skillCenter.autoCreate")}),o.jsx("span",{children:s("skillCenter.autoCreateDescription")})]})})]})]})})}function yqt({cloudProvider:e="volcengine",region:t,active:n=!0,activationRevision:i=0,initialWorkspace:r=null,onInitialWorkspaceConsumed:s,onPageTitleChange:a,toolbarLeading:l,toolbarFilters:c}){var ir;const{t:u,i18n:d}=_e("ui"),f=p.useMemo(()=>[t],[t]),[h,m]=p.useState([]),[g,b]=p.useState(null),[v,y]=p.useState([]),x=p.useMemo(()=>J$e(v),[v]),[w,O]=p.useState(null),[S,k]=p.useState(null),[C,E]=p.useState(!1),N=p.useRef(""),A=p.useRef(!1),[j,T]=p.useState({}),[R,_]=p.useState(!1),[D,M]=p.useState(""),[P,L]=p.useState((r==null?void 0:r.space)??null),F=p.useRef(P);F.current=P;const[I,z]=p.useState([]),[K,B]=p.useState(1),[W,H]=p.useState(0),[X,ie]=p.useState(!1),[Q,Z]=p.useState(null),[ue,Ee]=p.useState(!1),[Y,G]=p.useState(""),[te,de]=p.useState("overview"),[Ce,le]=p.useState(null),[fe,re]=p.useState(null),[Oe,Pe]=p.useState(null),[be,Qe]=p.useState([]),[ve,Ne]=p.useState(!1),[ne,ye]=p.useState(null),[Te,Se]=p.useState(null),[Ke,it]=p.useState(!1),[he,xe]=p.useState(null),[Ae,qe]=p.useState(null),[Me,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),Le=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(D),cn=p.useDeferredValue(Y),hn=ln&&(P||ln.selectPublishSpace)?ln.operation==="create"?u("skillCenter.createSkill"):u("skillCenter.optimizeNamed",{name:((ir=ln.source)==null?void 0:ir.name)||u("skillCenter.skill")}):"",Ge=P!=null&&P.isShared?u("skillCenter.sharedSpace"):oc(P),bt=!(P!=null&&P.isShared)||P.canWrite===!0,St=hn||Ge||u("skillCenter.library");p.useEffect(()=>{n&&(a==null||a(St))},[n,a,St]),p.useEffect(()=>{r&&(s==null||s())},[r,s]);const dn=p.useMemo(()=>{const Ve=Ht.trim().toLocaleLowerCase(),kt=h.filter(rn=>!rn.isShared);return Ve?kt.filter(rn=>`${oc(rn)} ${rn.name} ${rn.description||""} ${rn.projectName||""}`.toLocaleLowerCase().includes(Ve)):kt},[Ht,h]),Rt=p.useMemo(()=>{const Ve=cn.trim().toLocaleLowerCase();return Ve?I.filter(kt=>`${kt.skillName} ${kt.skillDescription||""}`.toLocaleLowerCase().includes(Ve)):I},[cn,I]),$e=(P==null?void 0:P.region)||Ki(e);p.useEffect(()=>{if(!n||!P)return;const Ve=()=>Ct(rn=>rn+1),kt=()=>{document.visibilityState==="visible"&&Ve()};return window.addEventListener("focus",Ve),document.addEventListener("visibilitychange",kt),()=>{window.removeEventListener("focus",Ve),document.removeEventListener("visibilitychange",kt)}},[n,P==null?void 0:P.id]),p.useEffect(()=>{const Ve=P?`${$e}:${P.id}`:"";if(N.current!==Ve&&(N.current=Ve,y([]),O(null),re(null)),k(null),E(!1),!n||!P||P.isShared)return;const kt=new AbortController;return E(!0),nDt({spaceId:P.id,region:$e,signal:kt.signal}).then(rn=>{kt.signal.aborted||y(rn.items)}).catch(rn=>{kt.signal.aborted||k(xr(rn,u("skillCenter.reviewStatusFailed")))}).finally(()=>{kt.signal.aborted||E(!1)}),()=>kt.abort()},[P==null?void 0:P.id,P==null?void 0:P.isShared,$e,Ot,n,i,u]);const ot=p.useMemo(()=>f.flatMap(Ve=>{var rn;const kt=(rn=j[Ve])==null?void 0:rn.error;return kt?[{region:Ve,error:kt}]:[]}),[j,f]),vn=f.some(Ve=>{const kt=j[Ve];return!!(kt&&!kt.done&&!kt.error)}),Ye=ot.length===f.length;p.useEffect(()=>{const Ve=new AbortController;return uD(Ve.signal).then(Se).catch(()=>Se({enabled:!1,reason:u("skillCenter.adminNotConfigured"),operations:["create","optimize"],models:[],styles:{}})),()=>Ve.abort()},[u]);const mt=p.useCallback(async(Ve,kt)=>{var $r;if(gt.current||Ve.length===0)return;gt.current=!0,_(!0),kt&&(($r=st.current)==null||$r.abort(),m([]),T(Object.fromEntries(Ve.map(({region:qn})=>[qn,{nextPage:1,loadedCount:0,done:!1,error:null}]))));const rn=new AbortController;st.current=rn;const Nn=++We.current,se=await Promise.allSettled(Ve.map(async({region:qn,page:oi})=>({region:qn,page:oi,result:await GPt({region:qn,page:oi,pageSize:sqt,signal:rn.signal})})));if(We.current!==Nn)return;const xi=se.map((qn,oi)=>{const Vi=Ve[oi];return qn.status==="rejected"?{request:Vi,error:xr(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:ia,totalCount:Wa})=>{const Hr=oi[Vi.region]||{nextPage:Vi.page,loadedCount:0,done:!1,error:null};if(Fr){oi[Vi.region]={...Hr,error:Fr};return}const ko=Hr.loadedCount+ia;oi[Vi.region]={nextPage:Vi.page+1,loadedCount:ko,done:ia===0||ko>=Wa,error:null}}),oi}),m(qn=>cqt(kt?[]:qn,is)),L(qn=>qn&&(is.find(oi=>Lc(oi)===Lc(qn))||qn)),gt.current=!1,_(!1)},[]),_n=p.useCallback(()=>{if(gt.current)return;const Ve=f.flatMap(kt=>{const rn=j[kt];return rn&&!rn.done&&!rn.error?[{region:kt,page:rn.nextPage}]:[]});mt(Ve,!1)},[mt,j,f]);p.useEffect(()=>{Hn(),L(null),z([]),B(1)},[e]),p.useEffect(()=>{if(n)return mt(f.map(Ve=>({region:Ve,page:1})),!0),()=>{var Ve;We.current+=1,(Ve=st.current)==null||Ve.abort(),gt.current=!1}},[n,i,mt,f,It]),p.useEffect(()=>{const Ve=ft.current,kt=xt.current;if(!Ve||!kt||!vn||R)return;const rn=new IntersectionObserver(([Nn])=>{Nn.isIntersecting&&_n()},{root:kt,rootMargin:"240px 0px",threshold:.01});return rn.observe(Ve),()=>rn.disconnect()},[vn,_n,R]);const Vt=()=>{const Ve=xt.current;!Ve||!vn||R||Ve.scrollHeight-Ve.scrollTop-Ve.clientHeight<=240&&_n()};p.useEffect(()=>{if(!P){z([]),H(0),Ee(!1);return}let Ve=!0;return ie(!0),Z(null),cDt(P.id,{region:$e,page:K,pageSize:Rse,project:P.projectName}).then(kt=>{Ve&&(z(kt.items||[]),H(kt.totalCount||0),Ee(kt.degraded===!0))}).catch(kt=>{Ve&&(z([]),H(0),Ee(!1),Z(xr(kt,u("skillCenter.errors.loadSkills"))))}).finally(()=>{Ve&&ie(!1)}),()=>{Ve=!1}},[$e,P,K,Ot,u]);const Ai=Ve=>{Hn(),L(Ve),de("overview"),B(1),G("")},jn=()=>{Hn(),L(null),z([]),H(0),Ee(!1),de("overview"),B(1),G(""),Nt(null)},Hn=()=>{Le.current+=1,le(null),Pe(null),Qe([]),ye(null),Ne(!1)},En=async Ve=>{if(!P)return;const kt=Fb(Ve),rn=Le.current+1;Le.current=rn,le(Ve),Pe(null),ye(null),Ne(!0);try{const[Nn,se]=await Promise.all([uDt(P.id,kt,Ve.version,$e,P.projectName,Ve.skillName,P.name),MMe({spaceId:P.id,skillId:kt,version:Ve.version,region:$e,skillSpaceName:P.name,skillName:Ve.skillName})]);Le.current===rn&&(Pe(Nn),Qe(se))}catch(Nn){Le.current===rn&&ye(xr(Nn,u("skillCenter.errors.loadSkillDetails")))}finally{Le.current===rn&&Ne(!1)}},vi=Ve=>{if(P)return{kind:"skill-center",skillId:Fb(Ve),version:Ve.version,region:$e,projectName:P.projectName,skillSpaceId:P.id,skillSpaceName:P.name,name:Ve.skillName,description:Ve.skillDescription}},Fn=Ve=>{const kt=vi(Ve);!kt||!(Te!=null&&Te.enabled)||(Hn(),He({operation:"optimize",source:kt}))},di=async Ve=>{if(!(!P||!window.confirm(u("skillCenter.deleteSkillConfirm",{name:Ve.skillName})))){yt(Ve.skillId),Nt(null);try{await aDt({spaceId:P.id,skillId:Ve.skillId,region:$e}),Ct(kt=>kt+1),lt(kt=>kt+1)}catch(kt){Nt(xr(kt,u("skillCenter.errors.deleteSkill")))}finally{yt("")}}},wr=async Ve=>{if(!window.confirm(u("skillCenter.deleteSpaceConfirm",{name:oc(Ve)})))return;const kt=Lc(Ve);vt(kt),Nt(null);try{await rDt({spaceId:Ve.id,region:Ve.region||Ki(e)}),P&&Lc(P)===kt&&jn(),lt(rn=>rn+1)}catch(rn){Nt(xr(rn,u("skillCenter.errors.deleteSpace")))}finally{vt("")}},gr=async(Ve,kt=Ve.version,rn=!1)=>{var xi,is,$r,qn;if(!P||A.current)return;const Nn=P,se=`${Nn.region}:${Nn.id}:${Ve.skillId}:${kt}`;A.current=!0,b(se),Nt(null);try{const oi=await ZPt({spaceId:Nn.id,skillId:Ve.skillId,version:kt,region:Nn.region||$e});((xi=F.current)==null?void 0:xi.id)===Nn.id&&((is=F.current)==null?void 0:is.region)===Nn.region&&y(Vi=>[...Vi.filter(Fr=>Fr.id!==oi.id),oi])}catch(oi){if(rn)throw xr(oi,u("skillCenter.reviewFailed"));(($r=F.current)==null?void 0:$r.id)===Nn.id&&((qn=F.current)==null?void 0:qn.region)===Nn.region&&Nt(xr(oi,u("skillCenter.reviewFailed")))}finally{A.current=!1,b(null)}};return ln&&(P||ln.selectPublishSpace)?o.jsx(DHt,{operation:ln.operation,cloudProvider:e,space:P??void 0,availableSpaces:h.filter(Ve=>!Ve.isShared),spacesLoading:R,initialIntent:ln.initialIntent,source:ln.source,onBack:()=>He(null),onPublished:()=>{Ct(Ve=>Ve+1),lt(Ve=>Ve+1)}}):o.jsxs("section",{className:`skillcenter${P?" is-space":" resource-collection"}`,children:[P?o.jsx(GC,{className:"skillcenter-detail",title:Ge||P.name,description:P.isShared?u("skillCenter.sharedDescription"):P.description||u("skillCenter.manageSpaceDescription"),identitySeed:P.name,backLabel:u("skillCenter.backToSpaces"),onBack:jn,sections:[{key:"overview",label:u("skillCenter.overview"),content:o.jsxs(o.Fragment,{children:[jt?o.jsx("div",{className:"skillcenter-inline-error",role:"alert",children:o.jsx(ms,{error:jt})}):null,S?o.jsxs("div",{className:"skillcenter-inline-error",role:"alert",children:[o.jsx(ms,{error:S}),o.jsx("button",{type:"button",onClick:()=>Ct(Ve=>Ve+1),children:u("common.reload")})]}):null,o.jsx("section",{className:"skillcenter-overview",children:o.jsxs(Fz,{className:"skillcenter-detail-facts",children:[o.jsxs("div",{children:[o.jsx("dt",{children:u("skillCenter.skillCount")}),o.jsx("dd",{children:W})]}),o.jsxs("div",{children:[o.jsx("dt",{children:u("skillCenter.updatedAt")}),o.jsx("dd",{children:P.updatedAt?lqt(P.updatedAt,d.resolvedLanguage??d.language):"—"})]})]})})]})},{key:"skills",label:u("skillCenter.skills"),content:o.jsxs(o.Fragment,{children:[jt?o.jsx("div",{className:"skillcenter-inline-error",role:"alert",children:o.jsx(ms,{error:jt})}):null,S?o.jsxs("div",{className:"skillcenter-inline-error",role:"alert",children:[o.jsx(ms,{error:S}),o.jsx("button",{type:"button",onClick:()=>Ct(Ve=>Ve+1),children:u("common.reload")})]}):null,o.jsxs("section",{className:"skillcenter-results","aria-label":u("skillCenter.skillsInSpace",{name:Ge||P.name}),children:[o.jsx(CIe,{title:u("skillCenter.skills"),description:u("skillCenter.totalItems",{count:W}),actions:o.jsxs(o.Fragment,{children:[o.jsx(pp,{"aria-label":u("skillCenter.searchSkills"),value:Y,onChange:Ve=>G(Ve.target.value),placeholder:u("skillCenter.searchSkills")}),o.jsx(Dt,{color:"secondary",variant:"outline",size:"sm",pill:!1,disabled:X||C,onClick:()=>Ct(Ve=>Ve+1),children:u("common.refresh")})]})}),ue?o.jsx("div",{className:"skillcenter-inline-warning",role:"status",children:u("skillCenter.degradedRelationWarning")}):null,X&&I.length===0?o.jsx(za,{}):Q&&I.length===0?o.jsx(v4,{kind:"error",title:u("skillCenter.cannotLoadSkills"),error:Q,action:{label:u("common.reload"),onClick:()=>Ct(Ve=>Ve+1)}}):Rt.length===0?o.jsx(v4,{kind:"empty",title:Y.trim()?u("skillCenter.noMatchingSkills"):u("skillCenter.noSkills"),description:Y.trim()?u("skillCenter.tryAnotherName"):u(P.isShared?"skillCenter.sharedEmpty":"skillCenter.emptySkillsDescription"),action:!Y.trim()&&bt?{label:u("skillCenter.localUpload"),onClick:()=>At(P)}:void 0}):o.jsx("div",{className:"skillcenter-table-wrap",children:o.jsxs("table",{className:"skillcenter-table",children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{scope:"col",children:u("skillCenter.skills")}),o.jsx("th",{scope:"col",children:u("agentSelector.status")}),o.jsx("th",{scope:"col",className:"skillcenter-table__actions-heading",children:u("skillCenter.actions")})]})}),o.jsx("tbody",{children:Rt.map(Ve=>{const kt=x.get(`${Ve.skillId}:${Ve.version}`);return o.jsxs("tr",{children:[o.jsx("td",{className:"skillcenter-table__skill",children:o.jsxs("button",{type:"button",onClick:()=>void En(Ve),children:[o.jsxs("span",{className:"skillcenter-table__title-row",children:[o.jsx("strong",{title:Ve.skillName,children:Ve.skillName}),Ve.version?o.jsx("span",{className:"skillcenter-table__version-badge",children:Ve.sourceVersion||Ve.version}):null]}),o.jsx("span",{className:"skillcenter-table__description",children:aFe(Ve.skillDescription,u)}),P.isShared&&Ve.author?o.jsx("span",{className:"skillcenter-table__author",children:u("skillCenter.authorName",{name:Ve.author})}):null]})}),o.jsx("td",{children:o.jsxs("div",{className:"skillcenter-review-status",children:[o.jsx("span",{className:`skillcenter-status ${aqt(Ve.skillStatus)}`,children:oFe(Ve.skillStatus,u)}),kt?o.jsx(ET,{status:kt.status}):null,kt!=null&&kt.reviewer||kt!=null&&kt.reviewedBy?o.jsx(aq,{compact:!0,person:kt.reviewer,fallback:kt.reviewedBy}):null]})}),o.jsx("td",{children:o.jsxs("div",{className:"skillcenter-table__actions",children:[o.jsx("button",{type:"button",onClick:()=>void En(Ve),children:u("common.view")}),!Ve.lookupByName&&Ve.skillId?o.jsx("button",{type:"button",onClick:()=>re(Ve),children:u("skillCenter.versions.title")}):null,!P.isShared&&!Ve.lookupByName&&Ve.skillId?o.jsx("button",{type:"button",disabled:C||S!==null||g!==null||kt!==void 0&&kt.status!=="returned",onClick:()=>void gr(Ve),children:g===`${P.region}:${P.id}:${Ve.skillId}:${Ve.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(rn=>rn.sourceSkillId===Ve.skillId)?o.jsx("button",{type:"button",onClick:()=>O(Ve),children:u("skillCenter.reviewHistory")}):null,P.isShared?null:o.jsx(GR,{disabled:!(Te!=null&&Te.enabled),children:o.jsx("button",{type:"button",disabled:!(Te!=null&&Te.enabled),onClick:()=>Fn(Ve),children:u("skillCenter.optimize")})}),!Ve.lookupByName&&bt?o.jsx("button",{type:"button",className:"is-danger",disabled:dt===Ve.skillId,onClick:()=>void di(Ve),children:dt===Ve.skillId?u("common.deleting"):u("common.delete")}):null]})})]},`${Fb(Ve)}:${Ve.version}`)})})]})}),!Y.trim()&&!X&&!Q&&W>0?o.jsx(pqt,{page:K,total:W,pageSize:Rse,onPage:B}):null]})]})}],activeSectionKey:te,navigationLabel:u("skillCenter.spaceDetails"),onSectionChange:Ve=>de(Ve),actionsClassName:"skillcenter-toolbar-actions",actions:o.jsxs(o.Fragment,{children:[P.isShared?null:o.jsxs(o.Fragment,{children:[o.jsx(Dt,{type:"button",color:"secondary",variant:"outline",size:"lg",pill:!1,onClick:()=>xe(P),children:u("skillCenter.editSpace")}),o.jsx(Dt,{type:"button",color:"danger",variant:"soft",size:"lg",pill:!1,disabled:Ie===Lc(P),onClick:()=>void wr(P),children:Ie===Lc(P)?u("common.deleting"):u("skillCenter.deleteSpace")})]}),bt?o.jsx(Dt,{type:"button",color:"secondary",variant:"outline",size:"lg",pill:!1,onClick:()=>At(P),children:u("skillCenter.localUpload")}):null,P.isShared?null:o.jsx(GR,{disabled:!(Te!=null&&Te.enabled),children:o.jsxs(Dt,{type:"button",color:"primary",size:"lg",pill:!1,disabled:!(Te!=null&&Te.enabled),onClick:()=>He({operation:"create"}),children:[o.jsx(nAe,{"aria-hidden":"true"}),o.jsx("span",{children:u("skillCenter.createSkill")})]})})]})}):o.jsxs(o.Fragment,{children:[o.jsxs(e0,{className:"skillcenter-list-toolbar library-resource-toolbar",children:[l,o.jsxs("div",{className:"resource-toolbar__actions",children:[c,o.jsx(pp,{"aria-label":u("skillCenter.searchSpaces"),value:D,onChange:Ve=>M(Ve.target.value),placeholder:u("skillCenter.searchSpaces")})]})]}),jt?o.jsx("div",{className:"skillcenter-inline-error",role:"alert",children:o.jsx(ms,{error:jt})}):null,o.jsxs(Pg,{className:"skillcenter-list-results",ref:xt,"aria-label":u("skillCenter.spaceList"),onScroll:Vt,children:[ot.length>0&&!Ye?o.jsx(Dse,{errors:ot,cloudProvider:e,onRetry:()=>lt(Ve=>Ve+1)}):null,o.jsxs(n0,{children:[o.jsx(eqt,{region:t,active:n,revision:It+i,onOpen:Ai},`${e}:${t}`),D.trim()?null:o.jsx(hg,{"aria-label":u("skillCenter.createSpace"),icon:o.jsx(fqt,{}),onClick:()=>it(!0),children:u("skillCenter.newSpace")}),dn.map(Ve=>{const kt=Lc(Ve);return o.jsx(r0,{className:"skillcenter-space-card",title:oc(Ve),description:Ve.description||u("common.noDescription"),metadata:[{label:u("skillCenter.skillCount"),value:u("skillCenter.skillCountValue",{count:Ve.skillCount??0})},{label:u("skillCenter.updatedAt"),value:KD(Ve.updatedAt,Date.now(),d.resolvedLanguage??d.language)}],action:{label:u("skillCenter.addSkill"),icon:"plus",onClick:()=>qe(Ve)},detailAction:{label:u("common.viewDetails"),onClick:()=>Ai(Ve)}},kt)})]}),R&&h.length===0?o.jsx(za,{}):Ye&&h.length===0?o.jsx(Dse,{errors:ot,cloudProvider:e,fullPage:!0,onRetry:()=>lt(Ve=>Ve+1)}):dn.length===0&&D.trim()?o.jsx(v4,{kind:"empty",title:u("skillCenter.noMatchingSpaces"),description:u("skillCenter.tryAnotherName")}):null,!Ye&&h.length>0?o.jsx("div",{className:"my-agent-load-more",ref:ft,"aria-live":"polite",children:R?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"my-agent-loading-mark","aria-hidden":"true"}),o.jsx("span",{children:u("skillCenter.loadingMoreSpaces")})]}):vn?o.jsx("span",{children:u("skillCenter.scrollForMore")}):ot.length>0?o.jsx("span",{children:u("skillCenter.someSpacesFailed")}):o.jsx("span",{children:u("skillCenter.allSpacesLoaded")})}):null]})]}),fe&&P?o.jsx(JHt,{skill:fe,space:P,region:$e,reviews:v.filter(Ve=>Ve.sourceSkillId===fe.skillId),onClose:()=>re(null),onChanged:()=>Ct(Ve=>Ve+1),onSubmitReview:!P.isShared&&!C&&!S?Ve=>gr(fe,Ve,!0):void 0},`${$e}:${P.id}:${fe.skillId}`):null,w?o.jsx(ZHt,{name:w.skillName,applications:v.filter(Ve=>Ve.sourceSkillId===w.skillId),onClose:()=>O(null)}):null,Ce&&P&&o.jsx(gqt,{skill:Ce,space:P,region:$e,cloudProvider:e,detail:Oe,files:be,loading:ve,error:ne,reviews:v.filter(Ve=>Ve.sourceSkillId===Ce.skillId),reviewsLoading:C,reviewsError:S,canOptimize:!P.isShared&&(Te==null?void 0:Te.enabled)===!0,onOptimize:()=>Fn(Ce),onDownload:()=>void lDt({spaceId:P.id,skillId:Fb(Ce),version:Ce.version,region:$e,fallbackName:Ce.skillName,skillSpaceName:P.name,skillName:Ce.skillName}).catch(Ve=>ye(xr(Ve,u("skillCenter.errors.downloadSkill")))),onClose:Hn}),Ke?o.jsx(tqt,{region:t,regionOptions:nu(e),onClose:()=>it(!1),onCreated:Ve=>{it(!1),lt(kt=>kt+1),L({...Ve,region:Ve.region||t})}}):null,he?o.jsx(nqt,{space:he,region:he.region||Ki(e),onClose:()=>xe(null),onUpdated:Ve=>{const kt={...Ve,region:Ve.region||he.region||Ki(e)};xe(null),L(rn=>rn&&Lc(rn)===Lc(kt)?kt:rn),m(rn=>rn.map(Nn=>Lc(Nn)===Lc(kt)?kt:Nn)),lt(rn=>rn+1)}}):null,Ae?o.jsx(bqt,{space:Ae,canUseSandbox:(Te==null?void 0:Te.enabled)===!0,onClose:()=>qe(null),onUpload:()=>{At(Ae),qe(null)},onSandbox:()=>{const Ve=Ae;qe(null),Ai(Ve),He({operation:"create"})}}):null,Me?o.jsx(iqt,{space:Me,region:Me.region||Ki(e),onClose:()=>At(null),onUploaded:()=>{At(null),Ct(Ve=>Ve+1),lt(Ve=>Ve+1)}}):null]})}function vqt(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 xqt({cloudProvider:e,studioRegion:t="",activeTab:n,onTabChange:i,onPageTitleChange:r,skillInitialWorkspace:s=null,onSkillInitialWorkspaceConsumed:a,artifactSources:l=[],artifactUserId:c="",onArtifactActivate:u,onArtifactSourceOpen:d}){const{t:f,i18n:h}=_e("workspaceTools"),m=p.useMemo(()=>vqt(f),[f]),g=f("library.tabs.skills"),b=zI(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])),[N,A]=p.useState({skills:0,knowledge:0,artifacts:0}),j=p.useRef(u),[T,R]=p.useState([]),[_,D]=p.useState(!1),[M,P]=p.useState(""),L=p.useMemo(()=>{const ie=N1t(l,f("library.untitledSession"));return{key:JSON.stringify(ie),candidates:ie}},[l,f]),F=p.useRef(L);F.current.key!==L.key&&(F.current=L);const I=F.current.candidates,z=p.useMemo(()=>nu(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,N.artifacts]);const K=p.useCallback(async()=>{D(!0),P("");try{R(await B1t(I))}catch(ie){P(ie instanceof Error?ie.message:String(ie))}finally{D(!1)}},[I]);p.useEffect(()=>{n==="artifacts"&&K()},[n,N.artifacts,K]);const B=ie=>{E(Q=>{if(Q.has(ie))return Q;const Z=new Set(Q);return Z.add(ie),Z}),A(Q=>({...Q,[ie]:Q[ie]+1})),i(ie)},W=o.jsx(t0,{idPrefix:"library",ariaLabel:f("library.categoryAria"),value:n,items:m,onChange:B}),H=ie=>o.jsx(fg,{id:ie,ariaLabel:f("library.regionAria"),value:v,options:z,onChange:y}),X=n==="skills"?x!==g:n==="knowledge"&&S;return o.jsxs($f,{className:`library-view${X?" is-detail":""}`,"aria-label":f("library.title"),children:[X?null:o.jsx(Jy,{className:"library-view__header",title:f("library.title")}),o.jsxs("div",{className:"library-panels",children:[C.has("skills")?o.jsx("div",{id:"library-skills-panel",className:"library-panel",role:"tabpanel","aria-labelledby":"library-skills-tab",hidden:n!=="skills",children:o.jsx(yqt,{cloudProvider:e,region:v,active:n==="skills",activationRevision:N.skills,onPageTitleChange:w,initialWorkspace:s,onInitialWorkspaceConsumed:a,toolbarLeading:W,toolbarFilters:H("library-skills-region-filter")})}):null,C.has("knowledge")?o.jsx("div",{id:"library-knowledge-panel",className:"library-panel",role:"tabpanel","aria-labelledby":"library-knowledge-tab",hidden:n!=="knowledge",children:o.jsx(IPt,{cloudProvider:e,region:v,active:n==="knowledge",activationRevision:N.knowledge,onDetailChange:k,toolbarLeading:W,toolbarFilters:H("library-knowledge-region-filter")})}):null,C.has("artifacts")?o.jsx("div",{id:"library-artifacts-panel",className:"library-panel",role:"tabpanel","aria-labelledby":"library-artifacts-tab",hidden:n!=="artifacts",children:o.jsx(L1t,{items:T,region:v,userId:c,active:n==="artifacts",activationRevision:N.artifacts,loading:_,error:M?Uu(M,h.resolvedLanguage||h.language)||f("artifactLibrary.loadDetailFallback"):"",onRetry:()=>void K(),onEdit:U1t,onDelete:Q1t,onDownload:z1t,onOpenSource:d?ie=>d(ie.appName,ie.sessionId):void 0,toolbarLeading:W,toolbarFilters:H("library-artifacts-region-filter")})}):null]})]})}const lFe="veadk_agentkit_connections",wqt=3e3,Mse=6e4;function xd(){try{const e=localStorage.getItem(lFe);return(e?JSON.parse(e):[]).filter(n=>!n.runtimeId||!!n.region)}catch{return[]}}function GD(e){try{localStorage.setItem(lFe,JSON.stringify(e))}catch{}}function Nd(e,t){return`agentkit:${e}:${t}`}function cFe(e){try{return new URL(e).host}catch{return e}}function S1(e){NEe();for(const t of e)if(!(t.runtimeId&&!t.region))for(const n of t.apps)jEe(Nd(t.id,n),t.runtimeId?{app:n,runtimeId:t.runtimeId,region:t.region}:{app:n,base:t.base,apiKey:t.apiKey})}function uFe(e,t,n,i,r,s){const a={id:`rt_${e}`,name:t||e,runtimeId:e,region:n,apps:i,appLabels:r,currentVersion:s},l=xd(),c=l.findIndex(u=>u.runtimeId===e);return c===-1?l.push(a):l[c]=a,GD(l),S1(l),a}async function Oqt(e,t,n,i,r){let s=null,a=n||"cn-beijing",l=null;for(const f of OC(n))try{const h=await Kx(e,f,{retryProbe:!0,preferCached:!0,currentVersion:i});if(h&&h.length>0){await KCe(e,f),s=h,a=f;break}}catch(h){if(h instanceof Bw)throw XR(e),h;if(h instanceof ho&&h.unsupported){l=h;continue}throw h}if(!s||s.length===0)throw XR(e),l||new ho(V("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=uFe(e,t,a,s,u,i);return Nd(d.id,s[0])}function kqt(e){return new Promise(t=>window.setTimeout(t,e))}async function Aj(e,t,n,i,r={}){const s=Date.now();for(;;)try{return await Oqt(e,t,n,i,r.agentName)}catch(a){const l=Date.now()-s;if(!r.waitForReady||!(a instanceof ho)||!a.retryable||l>=Mse)throw a;const c=Math.min(wqt,Mse-l);await kqt(c)}}async function dFe(e,t,n,i){const r=t.trim().replace(/\/+$/,""),s=await kC(r,n.trim()),a={id:Date.now().toString(36),name:e.trim()||cFe(r),base:r,apiKey:n.trim(),apps:s,appLabels:i&&s.length>0?{[s[0]]:i}:void 0},l=[...xd().filter(c=>c.base!==r),a];return GD(l),S1(l),a}function Sqt(e){const t=xd().filter(n=>n.id!==e);return GD(t),S1(t),t}function XR(e){const t=xd().filter(n=>n.runtimeId!==e);return GD(t),S1(t),t}function fFe(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 a=((l=r.appLabels)==null?void 0:l[s])??s;return{id:Nd(r.id,s),label:a,app:s,remote:!0,host:r.runtimeId?r.name:cFe(r.base??""),runtimeId:r.runtimeId,region:r.region,currentVersion:r.currentVersion}}));return[...n,...i]}const Lse=Object.freeze(Object.defineProperty({__proto__:null,addConnection:dFe,addRuntimeConnection:uFe,buildAgentEntries:fFe,connectRuntime:Aj,loadConnections:xd,registerConnections:S1,remoteAppId:Nd,removeConnection:Sqt,removeRuntimeConnection:XR},Symbol.toStringTag,{value:"Module"}));function Eqt({onAdded:e,onCancel:t}){const{t:n}=_e("conversation"),[i,r]=p.useState(""),[s,a]=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 dFe(l,i,s,l);if(b.apps.length===0){h(n("addAgentKit.noAgents")),d(!1);return}e(Nd(b.id,b.apps[0]))}catch(b){h(n("addAgentKit.connectionFailed",{error:String(b)})),d(!1)}}}return o.jsx("div",{className:"addagent",children:o.jsxs("div",{className:"addagent-card",children:[o.jsx("h2",{className:"addagent-title",children:n("addAgentKit.title")}),o.jsx("p",{className:"addagent-sub",children:n("addAgentKit.description")}),o.jsxs("label",{className:"addagent-field",children:[o.jsx("span",{className:"addagent-label",children:n("addAgentKit.url")}),o.jsx("input",{className:"addagent-input",value:i,onChange:b=>r(b.target.value),placeholder:"https://xxxxx.apigateway-cn-beijing.volceapi.com",autoFocus:!0})]}),o.jsxs("label",{className:"addagent-field",children:[o.jsx("span",{className:"addagent-label",children:"API Key"}),o.jsx("input",{className:"addagent-input",type:"password",value:s,onChange:b=>a(b.target.value),placeholder:n("addAgentKit.apiKeyHint")})]}),o.jsxs("label",{className:"addagent-field",children:[o.jsx("span",{className:"addagent-label",children:n("addAgentKit.displayName")}),o.jsx("input",{className:"addagent-input",value:l,onChange:b=>c(b.target.value),placeholder:n("addAgentKit.displayNameHint")})]}),f&&o.jsx("div",{className:"addagent-error",children:f}),o.jsxs("div",{className:"addagent-actions",children:[o.jsx("button",{className:"addagent-btn addagent-btn--ghost",onClick:t,disabled:u,children:n("addAgentKit.cancel")}),o.jsxs("button",{className:"addagent-btn addagent-btn--primary",onClick:g,disabled:!m,children:[u?o.jsx(Mi,{className:"icon spin"}):null,n(u?"addAgentKit.connecting":"addAgentKit.connect")]})]})]})})}const Cqt=/[\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff]/u,Tqt={"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"},Aqt={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 XD(e){var r,s;const t=((r=e.message)==null?void 0:r.trim())??"",n=e.messageCode?Tqt[e.messageCode]:void 0;if(n)return V(n);if(t&&($$().toLowerCase()==="zh-cn"||!Cqt.test(t)))return t;if(e.phase==="build"&&((s=e.buildLog)!=null&&s.status)){const a={running:"client.deploymentProgress.buildLogsSyncing",complete:"client.deploymentProgress.buildLogsComplete",error:"client.deploymentProgress.buildLogsUnavailable"}[e.buildLog.status];if(a)return V(a)}const i=e.phase?Aqt[e.phase]:void 0;return i?V(i):t||V("client.deploymentProgress.inProgress")}function _qt(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 jqt=[{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"}]}],Nqt={核心能力回归:"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 pk(e,t){const n=Nqt[e];return n?t(n):e}const $se=["basic","usage","evaluations","optimizations","integrations","versions"],Rqt=20;function Iqt(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 _O=[{id:"api-server",label:"API Server"},{id:"a2a",label:"A2A"}];function x4(e,t){return e?`${e.replace(/\/+$/,"")}${t}`:""}function Pqt(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 Fse(e,t){return e==="key_auth"?"API Key":e==="custom_jwt"?"OAuth / JWT":t(e==="none"?"agentWorkspace.noAuthentication":"agentWorkspace.notAvailable")}function Bse(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 Dqt(e,t){return e.changeType==="rollback"?t("agentWorkspace.rollbackEvent"):e.version}function e9(e){return JSON.stringify(e)}function hFe(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 Mqt(e,t,n){const i=e.replace(/\/+$/,"");return`\`\`\`python @@ -826,8 +826,8 @@ response.raise_for_status() print(response.json()) \`\`\``}function $qt({visible:e}){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.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"}),o.jsx("circle",{cx:"12",cy:"12",r:"2.4"}),!e&&o.jsx("path",{d:"m4.2 4.2 15.6 15.6"})]})}function Use({available:e,authType:t,value:n,visible:i,loading:r,error:s,onToggle:a}){const{t:l}=_e("ui");return e?t==="none"?l("agentWorkspace.noApiKeyRequired"):t==="custom_jwt"?l("agentWorkspace.usesOauthJwt"):t!=="key_auth"?l("agentWorkspace.notAvailable"):o.jsxs("span",{className:"aw-integration-secret",children:[o.jsx("span",{className:"aw-integration-secret-value","aria-live":"polite",children:i&&n?n:"****"}),o.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:a,children:r?o.jsx("span",{className:"loading-gap-spinner","aria-hidden":"true"}):o.jsx($qt,{visible:i})}),s&&o.jsx("span",{className:"aw-integration-secret-error",role:"alert",children:s})]}):l("agentWorkspace.notAvailable")}function Qse({protocol:e,title:t,available:n,fields:i,example:r}){const{t:s}=_e("ui");return o.jsxs("section",{className:`aw-integration-panel${n&&r?" has-example":""}`,id:`integration-${e}-panel`,role:"tabpanel","aria-labelledby":`integration-${e}-tab`,children:[o.jsx("header",{children:o.jsx("h3",{children:t})}),o.jsx("dl",{children:i.map(a=>o.jsxs("div",{children:[o.jsx("dt",{children:a.label}),o.jsx("dd",{children:a.value||s("agentWorkspace.notAvailable")})]},a.label))}),n&&r&&o.jsxs("section",{className:"aw-integration-example",children:[o.jsx("h4",{children:s("agentWorkspace.pythonExample")}),o.jsx(Zu,{text:r,className:"aw-integration-example-code",allowRawHtml:!1})]})]})}function Fqt(e,t,n){var i;return Pz({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 pFe(e){return e?1+e.children.reduce((t,n)=>t+pFe(n),0):1}function mFe(e){return 1+e.subAgents.reduce((t,n)=>t+mFe(n),0)}function t9(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 Bqt(e,t,n){const i=t9(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 Uqt(e,t){return typeof e.score!="number"||!Number.isFinite(e.score)?"—":t("agentWorkspace.scoreValue",{score:Math.round(e.score*100)})}function Qqt(e,t){return t(`agentWorkspace.priority.${e}`)}const zqt={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 Vqt(e,t){var n;return e.module==="other"?((n=e.customModule)==null?void 0:n.trim())||t("agentWorkspace.modules.other"):t(zqt[e.module])}function Hqt(e,t){return e.find(n=>n.kind===t)}function zse(e,t){return e.items.map(n=>({...n,tag:t(n.kind==="good"?"agentWorkspace.goodCase":"agentWorkspace.badCase")})).sort((n,i)=>t9(i.createdAt)-t9(n.createdAt))}function qqt(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 Wqt(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 Kqt(e,t){return{phase:"update",label:t("agentWorkspace.deploymentSteps.update.label"),description:t("agentWorkspace.deploymentSteps.update.description",e)}}function gFe(e,t){const n=Wqt(t),i=[...n.slice(0,-1)];return e.instanceRange&&i.push(Kqt(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 bFe(e,t){const n=gFe(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 Gqt(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 yFe({log:e,autoExpand:t,title:n,ariaLabel:i,copyLabel:r,defaultPendingMessage:s}){const{t:a,i18n:l}=_e("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=Gqt(e.updatedAt,l.resolvedLanguage??l.language),O=e.status==="complete"?a("agentWorkspace.logStatus.synced"):e.status==="error"?a("agentWorkspace.logStatus.failed"):a("agentWorkspace.logStatus.syncing"),S=e.omittedEarly?a("agentWorkspace.logStatus.earlyOmitted"):e.snapshotTruncated?a("agentWorkspace.logStatus.recentOnly"):e.truncated?a("agentWorkspace.logStatus.partiallyOmitted"):"",k=[O,e.lineCount?a("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 o.jsxs("section",{className:`aw-deploy-log is-${e.status}${d?"":" is-collapsed"}`,"aria-label":i,children:[o.jsxs("header",{children:[o.jsxs("div",{children:[o.jsx("strong",{children:n}),o.jsx("span",{children:k})]}),o.jsxs("div",{className:"aw-deploy-log-actions",children:[g&&o.jsx("button",{type:"button",onClick:()=>f(E=>!E),children:a(d?"common.collapse":"common.expand")}),g&&o.jsxs("button",{type:"button",onClick:()=>void C(),"aria-label":h?a("agentWorkspace.copiedLabel",{label:r}):a("agentWorkspace.copyLabel",{label:r}),title:h?a("agentWorkspace.copied"):a("agentWorkspace.copyLabel",{label:r}),children:[h?o.jsx(Fd,{"aria-hidden":!0}):o.jsx(pP,{"aria-hidden":!0}),o.jsx("span",{children:a(h?"agentWorkspace.copied":"agentWorkspace.copy")})]})]})]}),d&&(g?o.jsx("pre",{ref:c,children:y}):o.jsx("div",{className:"aw-deploy-log-empty",children:x}))]})}function Xqt({task:e}){var n;const{t}=_e("ui");return o.jsx(yFe,{log:e.buildLog,autoExpand:((n=e.buildLog)==null?void 0:n.status)!=="complete"&&(e.status==="running"||e.status==="error")&&bFe(e,t)===1,title:t("agentWorkspace.buildLog"),ariaLabel:t("agentWorkspace.buildLog"),copyLabel:t("agentWorkspace.buildLog"),defaultPendingMessage:t("agentWorkspace.waitingBuildLog")})}function Yqt({task:e}){var n;const{t}=_e("ui");return o.jsx(yFe,{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 Zqt({task:e,onReturnToEdit:t}){const{t:n}=_e("ui"),i=gFe(e,n),r=bFe(e,n),s=e.status==="success"?100:Math.max(6,Math.min(100,e.pct??6)),a=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 o.jsxs("section",{className:`aw-deploy-progress-card is-${e.status}`,"aria-live":"polite",children:[o.jsxs("div",{className:"aw-deploy-progress-head",children:[o.jsxs("div",{children:[o.jsx("span",{className:"aw-deploy-progress-icon","aria-hidden":!0,children:e.status==="running"&&e.statusUnconfirmed?o.jsx(V_,{}):e.status==="running"?o.jsx(Mi,{className:"spin"}):e.status==="success"?o.jsx(Uit,{}):e.status==="error"?o.jsx(V_,{}):o.jsx(hF,{})}),o.jsxs("div",{children:[o.jsx("h3",{children:a}),o.jsx("p",{children:e.runtimeName})]})]}),o.jsx("strong",{children:e.status==="running"&&!e.statusUnconfirmed?`${Math.round(s)}%`:e.label})]}),o.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:o.jsx("span",{style:{width:`${s}%`}})}),o.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,Ti]=p.useState(!1),[jn,Hn]=p.useState(""),[En,vi]=p.useState(null),[Fn,di]=p.useState([]),[wr,gr]=p.useState([]),[ir,Ve]=p.useState(!1),[kt,rn]=p.useState(""),[Nn,se]=p.useState(""),[xi,is]=p.useState(0),[$r,qn]=p.useState([]),[oi,Vi]=p.useState(!1),[Fr,ia]=p.useState(""),[Wa,Hr]=p.useState(0),[ko,Us]=p.useState(null),[to,js]=p.useState(1),[Qs,So]=p.useState(!1),[Ea,Ai]=p.useState(""),[yi,Fl]=p.useState(0),[Eo,Li]=p.useState(!1),[fl,Uo]=p.useState(()=>new Set),[Ns,vc]=p.useState(!1),[ra,or]=p.useState(""),[Co,rs]=p.useState(""),[Ka,Qn]=p.useState(()=>new Set),zs=p.useRef(!1),vs=p.useRef(""),ss=p.useRef(null),Vs=p.useRef(0),qr=p.useRef(0),_i=p.useRef(0),[Qo,no]=p.useState(jqt),[gu,hl]=p.useState("");p.useEffect(()=>{e.length!==0&&no(pe=>pe.map((Ue,tt)=>tt===0&&Ue.agentIds.length===0?{...Ue,agentIds:e.slice(0,2).map(nt=>nt.id)}:Ue))},[e]);const Ca=p.useMemo(()=>{const pe=new Map;for(const Ue of e)Ue.runtimeId&&pe.set(Ue.runtimeId,Ue);return pe},[e]),zo=p.useMemo(()=>{var Ue;const pe=new Map;for(const tt of t){const nt=(Ue=tt.deploymentTarget)==null?void 0:Ue.runtimeId;if(!nt||!Ca.has(nt))continue;const kn=pe.get(nt);(!kn||tt.updatedAt>kn.updatedAt)&&pe.set(nt,tt)}return pe},[Ca,t]),Wr=p.useMemo(()=>{const pe=new Map;for(const Ue of f){if(!Ue.runtimeId)continue;const tt=pe.get(Ue.runtimeId);(!tt||Ue.startedAt>tt.startedAt)&&pe.set(Ue.runtimeId,Ue)}return pe},[f]),rd=p.useMemo(()=>{const pe=Le.trim().toLowerCase();return pe?e.filter(Ue=>{const tt=Ue.runtimeId?zo.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(pe)}):e},[e,Wr,Le,zo]),xs=p.useMemo(()=>{const pe=Le.trim().toLowerCase();return t.filter(Ue=>{var nt;const tt=(nt=Ue.deploymentTarget)==null?void 0:nt.runtimeId;return tt&&Ca.has(tt)?!1:pe?`${Ue.draft.name} ${Ue.draft.description}`.toLowerCase().includes(pe):!0})},[Ca,t,Le]),xc=p.useMemo(()=>t.filter(pe=>{var tt;const Ue=(tt=pe.deploymentTarget)==null?void 0:tt.runtimeId;return!Ue||!Ca.has(Ue)}).length,[Ca,t]),bu=p.useMemo(()=>{const pe=Le.trim().toLowerCase();return pe?Qo.filter(Ue=>Ue.name.toLowerCase().includes(pe)):Qo},[Qo,Le]),we=e.find(pe=>pe.id===I),ai=t.find(pe=>pe.id===K),Yi=h?f.find(pe=>pe.id===h):void 0,sa=we!=null&&we.runtimeId?zo.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)||"",Ga=(c&&(we!=null&&we.runtimeId)?$se:$se.filter(pe=>pe!=="usage")).map(pe=>({id:pe,label:_(`agentWorkspace.sections.${pe}`)})),Vo=JSON.stringify([(we==null?void 0:we.runtimeId)??"",(we==null?void 0:we.region)??"cn-beijing",Zi,to]),os=(ko==null?void 0:ko.requestKey)===Vo?ko.value:null,oa=`${(we==null?void 0:we.region)??"cn-beijing"}:${(we==null?void 0:we.runtimeId)??""}`,Bl=(Ce==null?void 0:Ce.requestKey)===oa?Ce.value:"",br=(X==null?void 0:X.requestKey)===oa?X:null,Ho=!!((ei=br==null?void 0:br.apiApps)!=null&&ei.length),Xa=!!(br!=null&&br.a2a),aa=((nh=br==null?void 0:br.apiApps)==null?void 0:nh[0])??Zi,Mn=(W==null?void 0:W.endpoint)??"",Ya=Pqt(((R1=br==null?void 0:br.a2a)==null?void 0:R1.endpoint)??"",Mn),la=(we==null?void 0:we.runtimeApp)||"",Za=JSON.stringify([(we==null?void 0:we.runtimeId)??"",(we==null?void 0:we.region)??"",(we==null?void 0:we.currentVersion)??null,la]),je=l&&(we!=null&&we.runtimeId)&&we.region&&ln===0?Z$({runtimeId:we.runtimeId,region:we.region,appName:la,currentVersion:we.currentVersion}):null,Je=(he==null?void 0:he.requestKey)===Za?he.value:je,Mt=Je!=null&&Je.reason?Uu(Je.reason,D.resolvedLanguage||D.language):"",Tn=(Je==null?void 0:Je.warnings.filter(pe=>Uu(pe,D.resolvedLanguage||D.language)))??[];p.useEffect(()=>{const pe=Vs.current+1;Vs.current=pe,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?Z$({runtimeId:Ue,region:tt,appName:la,currentVersion:we==null?void 0:we.currentVersion}):null;if(nt){xe({requestKey:Za,value:nt}),qe(!1);return}const kn=new AbortController;let ct,wi=0;const so=60;qe(!0);const Oi=Hs=>{GI({runtimeId:Ue,region:tt,appName:la,currentVersion:we==null?void 0:we.currentVersion,signal:kn.signal,force:Hs&&ln>0}).then(bl=>{var w0,IT;if(pe!==Vs.current)return;const Mp=bl.recoveryStatus==="preparing";if(bl.runtime.runtimeId!==Ue||bl.runtime.region!==tt||!Mp&&la&&((w0=bl.agent)==null?void 0:w0.appName)!==la||bl.canUpdate&&!((IT=bl.agent)!=null&&IT.appName)){At(_("agentWorkspace.errors.updateCapabilityMismatch"));return}if(xe({requestKey:Za,value:bl}),qe(!1),!!Mp){if(wi+=1,wi>=so){At(_("agentWorkspace.errors.updateConfigRestoring"));return}ct=window.setTimeout(()=>Oi(!1),1e3)}}).catch(()=>{pe!==Vs.current||kn.signal.aborted||At(_("agentWorkspace.errors.checkUpdateCapability"))}).finally(()=>{pe===Vs.current&&!kn.signal.aborted&&qe(!1)})};return Oi(!0),()=>{kn.abort(),ct!=null&&window.clearTimeout(ct)}},[l,la,ln,we==null?void 0:we.currentVersion,we==null?void 0:we.region,we==null?void 0:we.runtimeId,Za]);const on=p.useMemo(()=>{const pe=new Map(e.map((tt,nt)=>[tt.id,nt])),Ue=new Map(n.map((tt,nt)=>[tt,nt]));return[...rd].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,so=(ct==null?void 0:ct.status)==="running"?ct.startedAt:0;if(wi!==so)return so-wi;const Oi=Ue.get(tt.id),Hs=Ue.get(nt.id);return Oi!=null&&Hs!=null?Oi-Hs:Oi!=null?-1:Hs!=null?1:(pe.get(tt.id)??0)-(pe.get(nt.id)??0)})},[n,e,rd,Wr]),yn=(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)||((x0=Yi==null?void 0:Yi.agentDraft)==null?void 0:x0.name)||_("agentWorkspace.noAgentSelected"),On=Qo.find(pe=>pe.id===gu),ae=on.filter(pe=>pe.canDelete===!0),De=on.filter(pe=>vn.has(pe.id)&&pe.canDelete===!0),et=xs.filter(pe=>mt.has(pe.id)),ht=ae.length+xs.length,Yt=De.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 pe=(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")?Pz(Je.agent,pe,Je.runtime.configuredEnvKeys):Fqt(gi,Zi||(we==null?void 0:we.label)||"agent",pe)},[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=((RT=gi==null?void 0:gi.draft)==null?void 0:RT.harnessSidecar)??Axt(W==null?void 0:W.envs),qo=Kr?e1.filter(pe=>Kr.componentOverrides[pe]):[],pl=ai?a?"":_("agentWorkspace.errors.noCreatePermission"):l?we!=null&&we.runtimeId?we.region?Ae?_("agentWorkspace.errors.checkingUpdateConfig"):Me||(Je?Je.recoveryStatus!=="complete"&&Je.recoveryStatus!=="draft-only"?Mt||_("agentWorkspace.errors.originalConfigUnavailable"):Je.canUpdate?(yu=Je.agent)!=null&&yu.appName?"":_("agentWorkspace.errors.agentInfoMissing"):Mt||_("agentWorkspace.errors.updateUnsupported"):_("agentWorkspace.errors.updateCapabilityPending")):_("agentWorkspace.errors.runtimeRegionMissing"):_("agentWorkspace.errors.cloudOnlyUpdate"):_("agentWorkspace.errors.noManagePermission"),ml="aw-update-disabled-reason",Jf=p.useMemo(()=>{if(gi)return gi.tools;const pe=(un.builtinTools??[]).map(Ue=>{var tt;return((tt=Jw.find(nt=>nt.id===Ue))==null?void 0:tt.label)??Ue});return Array.from(new Set([...un.tools,...pe,...(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(pe=>pe.name):null:Array.from(new Set([...(un.selectedSkills??[]).map(pe=>pe.name),...un.skills].filter(Boolean))),[un,gi]),qi=p.useMemo(()=>{if(Yi)return Yi;if(ai){const pe=f.filter(Ue=>Ue.draftId===ai.id).sort((Ue,tt)=>tt.startedAt-Ue.startedAt)[0];return pe||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(pe=>!!we.runtimeId&&pe.runtimeId===we.runtimeId||pe.agentName===we.label).sort((pe,Ue)=>Ue.startedAt-pe.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(pe=>pe.id===qi.draftId)??(qi.agentDraft?{id:qi.draftId,draft:qi.agentDraft,updatedAt:qi.startedAt}:void 0):void 0,pt=p.useMemo(()=>qqt(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)??yn}:${pt}`;p.useEffect(()=>{L==="usage"&&!c&&F("basic")},[c,L]),p.useEffect(()=>{if(!h)return;const pe=f.find(tt=>tt.id===h),Ue=pe!=null&&pe.runtimeId?Ca.get(pe.runtimeId):void 0;if(Ue){B(""),z(Ue.id),F("basic");return}z(""),B(""),F("basic")},[Ca,f,h]),p.useEffect(()=>{if(!m){vs.current="";return}const pe=`${m}:${g}:${b}:${c}`;vs.current!==pe&&e.some(Ue=>Ue.id===m)&&(vs.current=pe,B(""),z(m),F(g==="usage"&&!c?"basic":g),g==="evaluations"&&(st(b),ft("")))},[e,c,m,g,b]),p.useEffect(()=>{for(const pe of on.slice(0,8)){if(!pe.runtimeId)continue;const Ue=pe.region??"cn-beijing";eTe(pe.runtimeId,Ue),ZEe(pe.runtimeId,Ue,pe.runtimeApp??"")}},[on]),p.useEffect(()=>{let pe=!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?YEe(Ue,tt,nt):null;if(lt(kn),yt(""),vt(!1),Ct(!!kn||!y||!Ue),!(!y||!Ue))return NU(Ue,tt,nt,{force:!0}).then(ct=>{pe||lt(ct)}).catch(ct=>{!pe&&!kn&<(null),pe||(vt(ct instanceof ho&&ct.unsupported),yt(_("agentWorkspace.errors.loadAgentInfo")))}).finally(()=>{pe||Ct(!0)}),()=>{pe=!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 pe=!1;const Ue=(we==null?void 0:we.runtimeId)??"",tt=(we==null?void 0:we.region)??"cn-beijing";if(qn([]),ia(""),L!=="optimizations"||!Ue){Vi(!1);return}if(y&&!Zi){Vi(!Ot);return}return Vi(!0),UEe({runtimeId:Ue,region:tt,appName:Zi}).then(nt=>{pe||qn(nt.groups)}).catch(()=>{pe||ia(_("agentWorkspace.errors.loadOptimizations"))}).finally(()=>{pe||Vi(!1)}),()=>{pe=!0}},[Ot,y,Wa,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 pe=_i.current+1;_i.current=pe;const Ue=(we==null?void 0:we.runtimeId)??"",tt=(we==null?void 0:we.region)??"cn-beijing",nt=Zi;if(Ai(""),L!=="usage"||!Ue){So(!1);return}if(!nt){So(y&&!Ot);return}const kn=new AbortController;return So(!0),BCe({runtimeId:Ue,region:tt,appName:nt,page:to,pageSize:Rqt,signal:kn.signal}).then(ct=>{if(pe===_i.current){if(ct.runtimeId!==Ue||ct.appName!==nt||ct.page!==to){Ai(_("agentWorkspace.errors.usageMismatch"));return}Us({requestKey:Vo,value:ct})}}).catch(()=>{pe!==_i.current||kn.signal.aborted||Ai(_("agentWorkspace.errors.loadUsage"))}).finally(()=>{pe===_i.current&&So(!1)}),()=>{kn.abort()}},[to,yi,Vo,Ot,y,L,Zi,we==null?void 0:we.region,we==null?void 0:we.runtimeId]),p.useEffect(()=>{qr.current+=1,le(null),re(!1),Pe(!1),Qe(""),de("api-server")},[oa,L]);function Gr(){qr.current+=1,le(null),re(!1),Pe(!1),Qe("")}function Or(pe){pe!==te&&(Gr(),de(pe))}async function Tr(){if(fe){Gr();return}const pe=(we==null?void 0:we.runtimeId)??"",Ue=(we==null?void 0:we.region)??"cn-beijing";if(!pe)return;const tt=qr.current+1;qr.current=tt,Pe(!0),Qe("");try{const nt=await XCe(pe,Ue);if(tt!==qr.current)return;le({requestKey:oa,value:nt}),re(!0)}catch(nt){if(tt!==qr.current)return;le(null),re(!1),Qe(nt instanceof Error?nt.message:_("agentWorkspace.errors.loadApiKey"))}finally{tt===qr.current&&Pe(!1)}}p.useEffect(()=>{let pe=!1;const Ue=(we==null?void 0:we.runtimeId)??"",tt=(we==null?void 0:we.region)??"cn-beijing",nt=Ue?JCe(Ue,tt):null;if(H(nt),Nt(""),!!Ue)return $U(Ue,tt,{force:!0}).then(kn=>{pe||H(kn)}).catch(()=>{!pe&&!nt&&H(null),pe||Nt(_("agentWorkspace.errors.loadRuntimeDetails"))}),()=>{pe=!0}},[ln,we==null?void 0:we.currentVersion,we==null?void 0:we.region,we==null?void 0:we.runtimeId]),p.useEffect(()=>{let pe=!1;const Ue=(we==null?void 0:we.runtimeId)??"";if(Se(""),L!=="versions"||!Ue){ye(!1),Ue||Ne(null);return}return ye(!0),F_(Ue).then(tt=>{pe||Ne(tt)}).catch(()=>{pe||(Ne(null),Se(_("agentWorkspace.errors.loadGithubVersions")))}).finally(()=>{pe||ye(!1)}),()=>{pe=!0}},[L,we==null?void 0:we.currentVersion,we==null?void 0:we.runtimeId]),p.useEffect(()=>{let pe=!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=Kx(Ue,tt,{retryProbe:!0}).catch(ct=>{if(ct instanceof ho&&ct.unsupported)return null;throw ct});return Promise.all([kn,GCe(Ue,tt,{retryProbe:!0})]).then(([ct,wi])=>{pe||ie({requestKey:nt,apiApps:ct,a2a:wi})}).catch(()=>{pe||(ie(null),Ee(_("agentWorkspace.errors.probeIntegration")))}).finally(()=>{pe||Z(!1)}),()=>{pe=!0}},[Y,L,we==null?void 0:we.currentVersion,we==null?void 0:we.region,we==null?void 0:we.runtimeId]),p.useEffect(()=>{let pe=!1;const Ue=(we==null?void 0:we.runtimeId)??"",tt=(we==null?void 0:we.region)??"cn-beijing",nt=Ue&&Zi?QEe({runtimeId:Ue,region:tt,appName:Zi,pageSize:100}):null;if(di(nt?zse(nt,_):[]),gr((nt==null?void 0:nt.sets)??[]),rn(""),se((nt==null?void 0:nt.unsupportedMessage)??""),L!=="evaluations"||!Ue){Ve(!1);return}if(y&&!Zi){Ve(!Ot);return}return Ve(!nt),qI({runtimeId:Ue,region:tt,appName:Zi,pageSize:100},{force:!0}).then(kn=>{pe||(gr(kn.sets),di(zse(kn,_)),se(kn.unsupportedMessage??""))}).catch(()=>{pe||(rn(_("agentWorkspace.errors.loadEvaluations")),se(""))}).finally(()=>{pe||Ve(!1)}),()=>{pe=!0}},[Ot,y,xi,L,Zi,gi==null?void 0:gi.appName,we==null?void 0:we.region,we==null?void 0:we.runtimeId,_]);async function kr(pe){const Ue=(we==null?void 0:we.runtimeId)??"",tt=pe.commitSha??"";if(!(!Ue||!tt||Ke)){it(tt),Se("");try{await NCe({runtimeId:Ue,targetCommitSha:tt});const nt=await F_(Ue);Ne(nt)}catch(nt){Se(nt instanceof Error?nt.message:_("agentWorkspace.errors.rollbackVersion"))}finally{it("")}}}p.useEffect(()=>{const pe=new Set(Fn.map(Ue=>Ue.id));Uo(Ue=>{const tt=new Set([...Ue].filter(nt=>pe.has(nt)));return tt.size===Ue.size?Ue:tt}),Qn(Ue=>{const tt=new Set([...Ue].filter(nt=>pe.has(nt)));return tt.size===Ue.size?Ue:tt}),Co&&!pe.has(Co)&&rs("")},[Fn,Co]),p.useEffect(()=>{Li(!1),Uo(new Set),Qn(new Set),or(""),rs("")},[we==null?void 0:we.runtimeId]),p.useEffect(()=>{const pe=new Set(on.filter(Ue=>Ue.canDelete===!0).map(Ue=>Ue.id));Ye(Ue=>{const tt=new Set([...Ue].filter(nt=>pe.has(nt)));return tt.size===Ue.size?Ue:tt})},[on]),p.useEffect(()=>{const pe=new Set(xs.map(Ue=>Ue.id));_n(Ue=>{const tt=new Set([...Ue].filter(nt=>pe.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:_(v.kind==="good"?"agentWorkspace.goodCase":"agentWorkspace.badCase")},[v,we==null?void 0:we.runtimeId,Zi,_]),gl=p.useMemo(()=>_qt(_),[_]),io=p.useMemo(()=>we!=null&&we.runtimeId?Xr?[Xr,...Fn.filter(pe=>pe.id!==Xr.id&&(!pe.messageId||pe.messageId!==Xr.messageId))]:Fn:gl,[gl,Fn,Xr,we==null?void 0:we.runtimeId]),Ar=io.filter(pe=>{if(pe.kind!==gt||(pe.source==="auto"?"auto":"user")!==Ht)return!1;const tt=xt.trim().toLowerCase();return tt?[pe.input,pe.output,pe.referenceOutput,pe.comment,pe.tag??"",pe.sessionId,pe.messageId,pe.userId,pe.evaluationSetName].join(" ").toLowerCase().includes(tt):!0}),ws=Ar.filter(pe=>fl.has(pe.id)),ro=!!(we!=null&&we.runtimeId),Kd=pe=>{st(pe),ft(""),or("");const Ue=io.find(tt=>tt.kind===pe);rs((Ue==null?void 0:Ue.id)??""),window.setTimeout(()=>{var tt;(tt=ss.current)==null||tt.scrollIntoView({behavior:"smooth",block:"start"})},0)},Qg=pe=>{or(""),Uo(Ue=>{const tt=new Set(Ue);return tt.has(pe.id)?tt.delete(pe.id):tt.add(pe.id),tt})},m0=()=>{or(""),Uo(new Set(Ar.map(pe=>pe.id)))},g0=()=>{or(""),Uo(new Set),Li(!1)},b0=pe=>{Qn(Ue=>{const tt=new Set(Ue);return tt.has(pe)?tt.delete(pe):tt.add(pe),tt})},y0=pe=>{rs(pe.id),or(""),!(!pe.sessionId||!pe.messageId)&&(N==null||N(pe))},zg=async pe=>{if(!(we!=null&&we.runtimeId)||!Zi||Ns||pe.length===0)return;const Ue=pe.length===1?_("agentWorkspace.deleteOneCaseConfirm"):_("agentWorkspace.deleteCasesConfirm",{count:pe.length});if(!window.confirm(Ue))return;const tt=pe.map(kn=>kn.id),nt=new Set(tt);vc(!0),or("");try{await HEe({runtimeId:we.runtimeId,region:we.region??"cn-beijing",appName:Zi,itemIds:tt});const kn=new Map;for(const ct of pe)kn.set(ct.kind,(kn.get(ct.kind)??0)+1);di(ct=>ct.filter(wi=>!nt.has(wi.id))),gr(ct=>ct.map(wi=>({...wi,itemCount:Math.max(0,wi.itemCount-(kn.get(wi.kind)??0))}))),Uo(ct=>new Set([...ct].filter(wi=>!nt.has(wi)))),Qn(ct=>new Set([...ct].filter(wi=>!nt.has(wi)))),Co&&nt.has(Co)&&rs(""),pe.length>1&&Li(!1),A==null||A(pe)}catch(kn){or(kn instanceof Error?kn.message:String(kn))}finally{vc(!1)}},$i=pe=>{no(Ue=>Ue.map(tt=>tt.id===pe.id?pe:tt))},wc=()=>{const pe=new Set(e.map(nt=>nt.id)),Ue=n.filter(nt=>pe.has(nt)),tt=new Set(Ue);return[...Ue,...e.filter(nt=>!tt.has(nt.id)).map(nt=>nt.id)]},Vg=(pe,Ue,tt)=>{if(!O||pe===Ue)return;const nt=wc().filter(wi=>wi!==pe),kn=nt.indexOf(Ue),ct=kn<0?nt.length:tt==="after"?kn+1:kn;nt.splice(ct,0,pe),O(nt)},eh=(pe,Ue)=>{if(!hn||hn===Ue)return;const tt=pe.currentTarget.getBoundingClientRect();St(Ue),Rt(pe.clientY>tt.top+tt.height/2?"after":"before")},Pp=(pe,Ue)=>{if(!O)return;const tt=wc(),nt=tt.indexOf(pe),kn=Math.max(0,Math.min(tt.length-1,nt+Ue));nt<0||nt===kn||(tt.splice(nt,1),tt.splice(kn,0,pe),O(tt))},Dp=pe=>{pe.canDelete===!0&&(Hn(""),Ye(Ue=>{const tt=new Set(Ue);return tt.has(pe.id)?tt.delete(pe.id):tt.add(pe.id),tt}))},th=pe=>{Hn(""),_n(Ue=>{const tt=new Set(Ue);return tt.has(pe.id)?tt.delete(pe.id):tt.add(pe.id),tt})},Gd=()=>{Hn(""),Ye(new Set(ae.map(pe=>pe.id))),_n(new Set(xs.map(pe=>pe.id)))},sd=()=>{Hn(""),Ye(new Set),_n(new Set),ot(!1)},Hg=()=>{if(Yt===0||Vt)return;const pe=De.length,Ue=et.length;Hn(""),vi({kind:"selection",title:_(pe===1&&Ue===0?"agentWorkspace.deleteAgentTitle":pe===0&&Ue===1?"myAgents.deleteDraftTitle":"agentWorkspace.deleteSelectedTitle"),description:pe===1&&Ue===0?_("agentWorkspace.deleteAgentDescription",{name:De[0].label}):pe===0&&Ue===1?_("agentWorkspace.deleteDraftDescription",{name:et[0].draft.name||_("agentSelector.unnamedAgent")}):_("agentWorkspace.deleteSelectionDescription",{count:Yt,warning:pe>0?_("agentWorkspace.runtimeDeletionWarning",{count:pe}):_("agentWorkspace.draftDeletionWarning")}),confirmLabel:_(pe===0&&Ue===1?"myAgents.deleteDraft":"agentWorkspace.deleteSelected"),agents:De,drafts:et})},qg=async()=>{if(!(!En||Vt)){Ti(!0),Hn("");try{if(En.kind==="selection"){const{agents:pe,drafts:Ue}=En;if(pe.length>0){if(!S)throw new Error(_("agentWorkspace.errors.deleteDeployedUnsupported"));await S(pe)}Ue.length>0&&(k==null||k(Ue)),Ye(new Set),_n(new Set),ot(!1),pe.some(tt=>tt.id===I)&&z(""),Ue.some(tt=>tt.id===K)&&B("")}else if(En.kind==="agent"){if(!S)throw new Error(_("agentWorkspace.errors.deleteDeployedUnsupported"));await S([En.agent]),I===En.agent.id&&z("")}else{if(!k)throw new Error(_("agentWorkspace.errors.deleteDraftUnsupported"));k([En.draft]),K===En.draft.id&&B("")}vi(null)}catch(pe){Hn(pe instanceof Error?pe.message:String(pe))}finally{Ti(!1)}}},Lt=pe=>{!S||pe.canDelete!==!0||Vt||(Hn(""),vi({kind:"agent",title:_("agentWorkspace.deleteAgentTitle"),description:_("agentWorkspace.deleteAgentDescription",{name:pe.label}),confirmLabel:_("agentWorkspace.deleteAgent"),agent:pe}))},_r=pe=>{if(!k||Vt)return;const Ue=pe.draft.name||_("agentSelector.unnamedAgent");Hn(""),vi({kind:"draft",title:_("myAgents.deleteDraftTitle"),description:_("agentWorkspace.deleteDraftDescription",{name:Ue}),confirmLabel:_("myAgents.deleteDraft"),draft:pe})},od=()=>{const pe=`eval-${Date.now()}`,Ue={id:pe,name:_("agentWorkspace.newEvaluationGroupName",{count:Qo.length+1}),agentIds:[],caseSet:"核心回归集",evaluator:"综合质量评估器",metrics:["回答质量"],concurrency:"4",history:[]};no(tt=>[Ue,...tt]),hl(pe)},v0=pe=>{$i({...pe,history:[{id:`run-${Date.now()}`,createdAt:_("agentWorkspace.evaluationDefaults.justNow"),score:86+pe.history.length%7,status:"completed"},...pe.history]})};return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:`aw-root${y?" is-detail-only":""}`,children:[o.jsxs("nav",{className:"aw-view-tabs","aria-label":_("agentWorkspace.workspace"),children:[o.jsx("button",{type:"button",className:M==="library"?"is-active":"","aria-pressed":M==="library",onClick:()=>{P("library"),We("")},children:_("agentWorkspace.library")}),o.jsx("button",{type:"button",className:M==="evaluation"?"is-active":"","aria-pressed":M==="evaluation",onClick:()=>{P("evaluation"),We("")},children:_("agentWorkspace.evaluation")})]}),o.jsxs("div",{className:"aw-workspace-frame",children:[o.jsxs("div",{className:"aw-workspace","aria-hidden":M==="evaluation"||void 0,ref:pe=>{pe==null||pe.toggleAttribute("inert",M==="evaluation")},children:[o.jsxs("aside",{className:"aw-sidebar","aria-label":_(M==="library"?"agentWorkspace.agentList":"agentWorkspace.evaluationGroupList"),children:[o.jsxs("label",{className:"aw-search",children:[o.jsx(IN,{"aria-hidden":!0}),o.jsx("input",{value:Le,onChange:pe=>We(pe.currentTarget.value),placeholder:_(M==="library"?"myAgents.searchAgents":"agentWorkspace.searchEvaluationGroups"),"aria-label":_(M==="library"?"myAgents.searchAgents":"agentWorkspace.searchEvaluationGroups")})]}),o.jsxs("button",{type:"button",className:"aw-create-card",onClick:M==="library"?j:od,disabled:M==="library"&&!a,children:[o.jsx(_l,{"aria-hidden":!0}),o.jsx("span",{children:_(M==="library"?"agentWorkspace.newAgent":"agentWorkspace.newEvaluationGroup")})]}),M==="library"&&(S||k)&&o.jsx("div",{className:`aw-selection-toolbar${$e?" is-active":""}`,children:$e?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"aw-selection-count",children:_("agentWorkspace.selectedCount",{count:Yt})}),o.jsx("button",{type:"button",onClick:Gd,disabled:ht===0||Vt,children:_("agentWorkspace.selectAll")}),o.jsx("button",{type:"button",className:"aw-selection-danger",onClick:()=>void Hg(),disabled:Yt===0||Vt,children:_(Vt?"common.deleting":"agentWorkspace.deleteSelected")}),o.jsx("button",{type:"button",onClick:sd,disabled:Vt,children:_("common.cancel")})]}):o.jsx("button",{type:"button",onClick:()=>{Hn(""),ot(!0)},disabled:ht===0,children:_("common.select")})}),M==="library"&&jn&&o.jsx("div",{className:"aw-delete-error",role:"alert",children:jn}),o.jsx("div",{className:"aw-agent-list",children:M==="evaluation"?bu.length===0?o.jsx("div",{className:"aw-list-empty",children:_("agentWorkspace.noMatchingEvaluationGroups")}):bu.map(pe=>o.jsxs("button",{type:"button",className:`aw-agent-item${pe.id===gu?" is-active":""}`,onClick:()=>hl(pe.id),children:[o.jsxs("span",{className:"aw-agent-copy aw-eval-group-copy",children:[o.jsx("strong",{children:pk(pe.name,_)}),o.jsx("small",{children:_("agentWorkspace.groupStats",{agents:pe.agentIds.length,runs:pe.history.length})})]}),o.jsx(Hk,{"aria-hidden":!0})]},pe.id)):u&&on.length===0&&xs.length===0?o.jsx("div",{className:"aw-list-empty",children:_("agentWorkspace.loadingCloudAgents")}):d&&on.length===0&&xs.length===0?o.jsxs("div",{className:"aw-list-empty aw-list-error",children:[o.jsx("span",{children:d}),w&&o.jsx("button",{type:"button",onClick:w,children:_("common.retry")})]}):on.length===0&&xs.length===0?o.jsx("div",{className:"aw-list-empty",children:_("myAgents.noMatchingAgents")}):o.jsxs(o.Fragment,{children:[xs.map(pe=>{const tt=f.filter(kn=>kn.draftId===pe.id).sort((kn,ct)=>ct.startedAt-kn.startedAt)[0]??f.filter(kn=>{var ct,wi;return((ct=kn.agentDraft)==null?void 0:ct.name)===pe.draft.name||kn.agentName===pe.draft.name||!!((wi=pe.deploymentTarget)!=null&&wi.runtimeId)&&kn.runtimeId===pe.deploymentTarget.runtimeId}).sort((kn,ct)=>ct.startedAt-kn.startedAt)[0],nt=mt.has(pe.id);return o.jsxs("button",{type:"button",className:["aw-agent-item",$e?"is-selecting":"",nt?"is-selected-for-delete":"",pe.id===K?"is-active":""].filter(Boolean).join(" "),"aria-pressed":$e?nt:void 0,onClick:()=>{if($e){th(pe);return}z(""),B(pe.id),F("basic")},children:[$e&&o.jsx("span",{className:`aw-select-marker${nt?" is-checked":""}`,"aria-hidden":"true"}),o.jsxs("span",{className:"aw-agent-copy",children:[o.jsxs("span",{className:"aw-agent-name-row",children:[o.jsx("strong",{children:pe.draft.name||_("agentSelector.unnamedAgent")}),o.jsx("span",{className:`aw-draft-badge${(tt==null?void 0:tt.status)==="running"?" is-deploying":""}`,children:(tt==null?void 0:tt.status)==="running"?_("myAgents.deploying"):_("myAgents.draft")})]}),o.jsx("small",{children:pe.deploymentTarget?_("agentWorkspace.updatePending"):_("agentWorkspace.notPublished")})]}),o.jsx(Hk,{"aria-hidden":!0})]},pe.id)}),on.map(pe=>{const Ue=pe.runtimeId?Wr.get(pe.runtimeId):void 0,tt=pe.runtimeId?zo.get(pe.runtimeId):void 0,nt=vn.has(pe.id),kn=pe.canDelete===!0,ct=(Ue==null?void 0:Ue.status)==="running"?{label:_("myAgents.deploying"),className:" is-deploying"}:(Ue==null?void 0:Ue.status)==="error"?{label:_("agentWorkspace.failed"),className:" is-error"}:(Ue==null?void 0:Ue.status)==="cancelled"?{label:_("agentWorkspace.cancelled"),className:" is-muted"}:tt?{label:_("agentWorkspace.updatePending"),className:""}:null,wi=(Ue==null?void 0:Ue.status)==="running"?_("agentWorkspace.updatingDeployment"):tt?_("agentWorkspace.updatePending"):pe.remote?pe.host||_("agentWorkspace.remoteAgent"):_("agentWorkspace.localAgent"),so=["aw-agent-item","aw-agent-item--sortable",pe.id===I?"is-active":"",$e?"is-selecting":"",nt?"is-selected-for-delete":"",$e&&!kn?"is-selection-disabled":"",pe.id===hn?"is-dragging":"",pe.id===bt&&pe.id!==hn?`is-drop-target is-drop-${dn}`:""].filter(Boolean).join(" ");return o.jsxs("button",{type:"button",draggable:!!O&&!$e,className:so,"aria-pressed":$e?nt:void 0,"aria-keyshortcuts":O?"Alt+ArrowUp Alt+ArrowDown":void 0,onDragStart:Oi=>{O&&(zs.current=!0,Ge(pe.id),Oi.dataTransfer.effectAllowed="move",Oi.dataTransfer.setData("text/plain",pe.id))},onDragEnter:Oi=>{eh(Oi,pe.id)},onDragOver:Oi=>{!hn||hn===pe.id||(Oi.preventDefault(),Oi.dataTransfer.dropEffect="move",eh(Oi,pe.id))},onDragLeave:Oi=>{const Hs=Oi.relatedTarget;Hs instanceof Node&&Oi.currentTarget.contains(Hs)||bt===pe.id&&St("")},onDrop:Oi=>{Oi.preventDefault();const Hs=Oi.dataTransfer.getData("text/plain")||hn;Vg(Hs,pe.id,dn),Ge(""),St(""),Rt("before")},onDragEnd:()=>{Ge(""),St(""),Rt("before"),window.setTimeout(()=>{zs.current=!1},0)},onKeyDown:Oi=>{Oi.altKey&&(Oi.key==="ArrowUp"?(Oi.preventDefault(),Pp(pe.id,-1)):Oi.key==="ArrowDown"&&(Oi.preventDefault(),Pp(pe.id,1)))},onClick:Oi=>{if($e){Oi.preventDefault(),Dp(pe);return}if(zs.current){Oi.preventDefault(),zs.current=!1;return}B(""),z(pe.id),F("basic"),C(pe.id)},children:[$e&&o.jsx("span",{className:`aw-select-marker${nt?" is-checked":""}`,"aria-hidden":"true"}),o.jsxs("span",{className:"aw-agent-copy",children:[o.jsxs("span",{className:"aw-agent-name-row",children:[o.jsx("strong",{children:pe.label}),pe.currentVersion!=null&&o.jsxs("span",{className:"aw-version-badge",children:["v",pe.currentVersion]}),ct&&o.jsx("span",{className:`aw-draft-badge${ct.className}`,children:ct.label})]}),o.jsx("small",{children:wi})]}),o.jsx(Hk,{"aria-hidden":!0})]},pe.id)})]})}),o.jsx("div",{className:"aw-list-count",children:_("agentWorkspace.totalCount",{count:M==="library"?e.length+xc:Qo.length})})]}),M==="evaluation"&&On?o.jsx(iWt,{group:On,agents:e,cases:io,onChange:$i,onRun:v0}):M==="evaluation"?o.jsx("main",{className:"aw-main aw-empty-selection",children:o.jsx("p",{children:_("agentWorkspace.noEvaluationGroupSelected")})}):!we&&!ai&&!Yi?o.jsx("main",{className:"aw-main aw-empty-selection",children:o.jsx("p",{children:_("agentWorkspace.noAgentSelected")})}):o.jsxs("main",{className:`aw-main${ee?" is-deploying":""}${y?" resource-page":""}`,children:[we&&!gi&&s&&o.jsx("div",{className:"aw-detail-loading",role:"status","aria-live":"polite",children:o.jsxs("div",{className:"aw-detail-loading-card",children:[o.jsx("span",{className:"loading-gap-spinner","aria-hidden":"true"}),o.jsxs("span",{children:[o.jsx("strong",{children:_("agentWorkspace.loadingAgent")}),o.jsx("small",{children:_("agentWorkspace.loadingAgentDescription")})]})]})}),L==="integrations"&&Q&&o.jsx("div",{className:"aw-detail-loading",role:"status","aria-live":"polite",children:o.jsxs("div",{className:"aw-detail-loading-card",children:[o.jsx("span",{className:"loading-gap-spinner","aria-hidden":"true"}),o.jsxs("span",{children:[o.jsx("strong",{children:_("agentWorkspace.probingIntegration")}),o.jsx("small",{children:_("agentWorkspace.probingIntegrationDescription")})]})]})}),o.jsx(GC,{className:"aw-agent-detail",title:yn,description:un.description||_(s||y&&!Ot?"agentWorkspace.loadingAgentInfo":"common.noDescription"),identitySeed:yn,backLabel:_("agentWorkspace.backToAgentList"),onBack:y?x:void 0,meta:o.jsxs(o.Fragment,{children:[qt!=null&&o.jsxs("span",{className:"aw-agent-meta",children:["v",qt]}),ai&&o.jsx("span",{className:"aw-agent-meta",children:_("myAgents.draft")}),sa&&o.jsx("span",{className:"aw-agent-meta",children:_("agentWorkspace.updatePending")}),!we&&!ai&&Yi&&o.jsx("span",{className:"aw-agent-meta",children:Yi.label})]}),actionsClassName:"aw-head-actions",bodyClassName:"aw-agent-detail__body",actions:ai||sa||we!=null&&we.canDelete?o.jsxs(o.Fragment,{children:[(ai||sa)&&o.jsxs(Dt,{type:"button",color:"danger",variant:"soft",size:"lg",pill:!1,onClick:()=>{const pe=ai??sa;pe&&_r(pe)},disabled:Vt,"aria-label":_("myAgents.deleteDraft"),title:_("myAgents.deleteDraft"),children:[o.jsx(ag,{"aria-hidden":!0}),o.jsx("span",{children:_("myAgents.deleteDraft")})]}),(we==null?void 0:we.canDelete)&&o.jsxs(Dt,{type:"button",color:"danger",variant:"soft",size:"lg",pill:!1,onClick:()=>void Lt(we),disabled:Vt,"aria-label":_("agentWorkspace.deleteAgent"),title:_("agentWorkspace.deleteAgent"),children:[o.jsx(ag,{"aria-hidden":!0}),o.jsx("span",{children:_(Vt?"common.deleting":"agentWorkspace.deleteAgent")})]})]}):void 0,sections:Ga.map(pe=>{var Ue,tt,nt,kn;return{key:pe.id,label:pe.label,disabled:ee,content:pe.id===L?o.jsxs(o.Fragment,{children:[qi&&fi&&o.jsx("div",{className:`aw-detail-deployment${ee?" is-running":""}`,children:o.jsx(Zqt,{task:qi,onReturnToEdit:Fe&&R?()=>R(Fe):void 0})}),o.jsxs("div",{className:"aw-content",children:[L==="basic"&&o.jsxs("div",{className:"aw-basic-stack",children:[Ie&&o.jsx(Ty,{className:"aw-detail-fetch-alert",color:"warning",variant:"soft",title:_("agentWorkspace.partialInfoUnavailable"),description:_("agentWorkspace.upgradeRuntimeForDetails")}),(dt&&!Ie||jt)&&o.jsx(Ty,{className:"aw-detail-fetch-alert",color:"danger",variant:"soft",title:_("agentWorkspace.detailLoadFailed"),description:_("agentWorkspace.detailLoadFailedDescription"),actions:o.jsx(Dt,{type:"button",color:"danger",variant:"soft",size:"sm",pill:!1,onClick:()=>He(ct=>ct+1),children:_("common.retry")})}),we&&Je&&!Je.canUpdate&&o.jsxs("div",{className:"aw-update-recovery-notice",role:Je.recoveryStatus==="preparing"?"status":"alert",children:[o.jsx("strong",{children:Je.recoveryStatus==="preparing"?_("agentWorkspace.restoringUpdateConfig"):_("agentWorkspace.updateConfigUnavailable")}),Mt&&o.jsx("span",{children:Mt}),Tn.map(ct=>o.jsx("span",{children:ct},ct))]}),o.jsxs("section",{className:"aw-deployment-panel aw-settings-card",children:[o.jsx("div",{className:"aw-section-head",children:o.jsxs("div",{children:[o.jsx("h3",{children:_("agentWorkspace.deploymentConfig")}),o.jsx("p",{children:_("agentWorkspace.deploymentConfigDescription")})]})}),o.jsxs("dl",{className:"aw-readonly-config",children:[o.jsxs("div",{children:[o.jsx("dt",{children:_("agentWorkspace.runtimeStatus")}),o.jsxs("dd",{className:(W==null?void 0:W.status.toLowerCase())==="ready"?"is-ready":void 0,children:[(W==null?void 0:W.status.toLowerCase())==="ready"&&o.jsx("span",{className:"aw-status-dot"}),(W==null?void 0:W.status)||_("agentWorkspace.loading")]})]}),o.jsxs("div",{children:[o.jsx("dt",{children:_("agentWorkspace.deploymentRegion")}),o.jsx("dd",{children:(W==null?void 0:W.region)||(we==null?void 0:we.region)||(qi==null?void 0:qi.region)||_("agentWorkspace.notAvailable")})]}),o.jsxs("div",{children:[o.jsx("dt",{children:_("agentWorkspace.networkAccess")}),o.jsx("dd",{children:W!=null&&W.networkTypes.length?W.networkTypes.join(" / "):_("agentWorkspace.notAvailable")})]})]})]}),o.jsxs("section",{className:"aw-canvas-card",children:[o.jsx("div",{className:"aw-card-head",children:o.jsx("strong",{children:_("agentWorkspace.executionFlow")})}),o.jsx("div",{className:"aw-canvas",children:o.jsx(mE,{draft:un,direction:"horizontal",selectedPath:[],onSelect:()=>{},onAdd:()=>{},onInsert:()=>{},onDelete:()=>{},readOnly:!0,interactivePreview:!0},Zn)})]}),o.jsxs("section",{className:"aw-details-card",children:[o.jsx("div",{className:"aw-card-head",children:o.jsx("strong",{children:_("agentWorkspace.details")})}),o.jsxs("dl",{className:"aw-facts",children:[o.jsxs("div",{children:[o.jsx("dt",{children:_("agentSelector.model")}),o.jsx("dd",{children:Iz(gi==null?void 0:gi.model)||un.modelName||_("agentWorkspace.notAvailable")})]}),o.jsxs("div",{children:[o.jsx("dt",{children:_("agentWorkspace.agentCountLabel")}),o.jsx("dd",{children:gi!=null&&gi.graph?pFe(gi.graph):mFe(un)})]}),o.jsxs("div",{children:[o.jsx("dt",{children:_("agentSelector.tools")}),o.jsx("dd",{className:"aw-fact-badges",children:Jf.length?Jf.map(ct=>o.jsx("span",{children:ct},ct)):_("agentWorkspace.none")})]}),o.jsxs("div",{children:[o.jsx("dt",{children:_("agentSelector.skills")}),o.jsx("dd",{className:"aw-fact-badges",children:Hi===null?_("agentSelector.previewUnsupported"):Hi.length?Hi.map(ct=>o.jsx("span",{children:ct},ct)):_("agentWorkspace.none")})]}),o.jsxs("div",{children:[o.jsx("dt",{children:_("systemInfo.currentVersion")}),o.jsx("dd",{children:qt!=null?`v${qt}`:_("agentWorkspace.notAvailable")})]}),o.jsxs("div",{children:[o.jsx("dt",{children:_("agentSelector.status")}),o.jsx("dd",{children:ai?_("myAgents.draft"):(qi==null?void 0:qi.status)==="error"?_("agentWorkspace.deploymentFailed"):(qi==null?void 0:qi.status)==="cancelled"?_("agentWorkspace.cancelled"):sa?_("agentWorkspace.updatePending"):o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"aw-status-dot"}),_("skillCenter.status.available")]})})]})]})]}),o.jsxs("section",{className:"aw-sidecar-panel aw-settings-card","aria-label":_("agentWorkspace.selectedOptimizations"),children:[o.jsx("div",{className:"aw-section-head",children:o.jsxs("div",{children:[o.jsx("h3",{children:_("agentWorkspace.selectedOptimizations")}),o.jsx("p",{children:_("agentWorkspace.selectedOptimizationsDescription")})]})}),o.jsxs("dl",{className:"aw-readonly-config",children:[o.jsxs("div",{children:[o.jsx("dt",{children:_("agentWorkspace.configurationStatus")}),o.jsx("dd",{className:Kr!=null&&Kr.enabled?"is-ready":void 0,children:Kr?Kr.enabled?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"aw-status-dot"}),_("skillCenter.status.enabled")]}):_("skillCenter.status.inactive"):_("agentWorkspace.notRecorded")})]}),o.jsxs("div",{children:[o.jsx("dt",{children:_("agentWorkspace.optimizationProfile")}),o.jsx("dd",{children:Kr?Cxt(Kr.profile):_("agentWorkspace.legacyConfigMissing")})]}),o.jsxs("div",{children:[o.jsx("dt",{children:_("agentWorkspace.selectedOptimizations")}),o.jsx("dd",{className:"aw-fact-badges",children:Kr?qo.length?qo.map(ct=>o.jsx("span",{children:nj(ct)},ct)):_("agentWorkspace.noneSelected"):_("agentWorkspace.legacyConfigMissing")})]})]})]})]}),L==="usage"&&(we==null?void 0:we.runtimeId)&&o.jsxs("section",{className:"aw-usage","aria-busy":Qs,children:[o.jsx("div",{className:"aw-usage-intro",children:o.jsx("h3",{children:_("agentWorkspace.usageOverview")})}),Qs&&!os&&o.jsx("div",{className:"aw-usage-state",role:"status","aria-live":"polite",children:o.jsx(bn,{as:"span",children:_("agentWorkspace.loadingUsage")})}),Ea&&o.jsxs("div",{className:"aw-usage-state is-error",role:"alert",children:[o.jsx("span",{children:Ea}),o.jsx("button",{type:"button",onClick:()=>Fl(ct=>ct+1),children:_("common.retry")})]}),!Qs&&!Ea&&!os&&!Zi&&o.jsx("div",{className:"aw-usage-state",children:_("agentWorkspace.usageUnavailable")}),os&&o.jsxs(o.Fragment,{children:[o.jsxs("dl",{className:"aw-usage-summary","aria-label":_("agentWorkspace.usageSummary"),children:[o.jsxs("div",{children:[o.jsx("dt",{children:_("agentWorkspace.totalCalls")}),o.jsx("dd",{children:os.totalInvocations.toLocaleString(D.resolvedLanguage??D.language)})]}),o.jsxs("div",{children:[o.jsx("dt",{children:_("agentWorkspace.userCount")}),o.jsx("dd",{children:os.totalUsers.toLocaleString(D.resolvedLanguage??D.language)})]})]}),o.jsxs("div",{className:"aw-usage-users-head",children:[o.jsx("h3",{children:_("agentWorkspace.userDetails")}),Qs&&o.jsx(bn,{as:"span",role:"status","aria-live":"polite",children:_("agentWorkspace.refreshing")})]}),os.users.length===0?o.jsx("div",{className:"aw-usage-state",children:_("agentWorkspace.noUsage")}):o.jsx("div",{className:"aw-usage-table-wrap",children:o.jsxs("table",{className:"aw-usage-table",children:[o.jsx("caption",{children:_("agentWorkspace.usageUserList")}),o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{scope:"col",children:_("agentWorkspace.user")}),o.jsx("th",{scope:"col",children:_("agentWorkspace.callCount")}),o.jsx("th",{scope:"col",children:_("agentWorkspace.lastUsed")})]})}),o.jsx("tbody",{children:os.users.map(ct=>o.jsxs("tr",{children:[o.jsxs("td",{children:[o.jsx("strong",{children:ct.displayName||ct.userId||_("agentWorkspace.unknownUser")}),ct.displayName&&ct.userId&&o.jsx("small",{title:ct.userId,children:ct.userId})]}),o.jsx("td",{children:ct.invocationCount.toLocaleString(D.resolvedLanguage??D.language)}),o.jsx("td",{children:o.jsx("time",{dateTime:ct.lastUsedAt,children:Iqt(ct.lastUsedAt,D.resolvedLanguage??D.language,_)})})]},ct.userId))})]})}),os.totalPages>1&&o.jsxs("nav",{className:"aw-usage-pagination","aria-label":_("agentWorkspace.usagePagination"),children:[o.jsx("button",{type:"button",disabled:Qs||os.page<=1,onClick:()=>js(ct=>Math.max(1,ct-1)),children:_("common.previousPage")}),o.jsx("span",{"aria-live":"polite",children:_("agentWorkspace.pageOf",{page:os.page,total:os.totalPages})}),o.jsx("button",{type:"button",disabled:Qs||os.page>=os.totalPages,onClick:()=>js(ct=>ct+1),children:_("common.nextPage")})]})]})]}),L==="versions"&&o.jsxs("section",{className:"aw-version-stack",children:[o.jsxs("div",{className:"aw-integration-intro",children:[o.jsx("h3",{children:_("agentWorkspace.githubVersions")}),o.jsx("p",{children:(Ue=ve==null?void 0:ve.cicd)!=null&&Ue.enabled?_("agentWorkspace.githubVersionsDescription"):_("agentWorkspace.currentVersionOnly")})]}),ne&&o.jsx("div",{className:"aw-case-empty",children:_("agentWorkspace.loadingVersions")}),Te&&o.jsxs("div",{className:"aw-integration-error",role:"alert",children:[o.jsx("span",{children:Te}),(we==null?void 0:we.runtimeId)&&o.jsx("button",{type:"button",onClick:()=>void F_(we.runtimeId??"").then(Ne),children:_("common.retry")})]}),!ne&&!Te&&o.jsxs("div",{className:"aw-version-list",children:[(ve==null?void 0:ve.githubSyncError)&&o.jsx("div",{className:"aw-integration-error",role:"alert",children:o.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&&o.jsx("div",{className:"aw-integration-notice",role:"status",children:o.jsxs("span",{children:[_("agentWorkspace.sourceMergedRuntimeStill"),Bse(ve.latestSourceRuntimeStatus,_),_("agentWorkspace.currentProductionVersionHint")]})}),ve!=null&&ve.versions.length?ve.versions.map(ct=>{var bl;const wi=ct.commitSha??"",so=ct.runtimeStatus??ct.status,Oi=ct.changeType==="rollback",Hs=!!((bl=ve.cicd)!=null&&bl.enabled)&&!!wi&&!Oi&&wi!==ve.currentCommitSha;return o.jsxs("article",{className:"aw-version-row",children:[o.jsxs("div",{children:[o.jsx("strong",{children:Dqt(ct,_)}),o.jsx("small",{children:ct.createdAt||_("agentWorkspace.noTime")})]}),o.jsxs("div",{children:[o.jsx("span",{children:_("agentWorkspace.prLink")}),ct.pullRequestUrl?o.jsx("a",{href:ct.pullRequestUrl,target:"_blank",rel:"noopener noreferrer",children:_("agentWorkspace.viewPr")}):o.jsx("em",{children:_("agentWorkspace.noPr")})]}),o.jsxs("div",{children:[o.jsx("span",{children:_("agentWorkspace.author")}),o.jsx("em",{children:ct.author||"Studio"})]}),o.jsxs("div",{children:[o.jsx("span",{children:_("agentWorkspace.publishStatus")}),o.jsx("em",{children:Bse(so,_)})]}),o.jsxs("div",{className:"aw-version-actions",children:[o.jsx("button",{type:"button",disabled:!Hs||Ke===wi,onClick:()=>void kr(ct),children:_(Ke===wi?"agentWorkspace.rollingBack":"agentWorkspace.rollbackToVersion")}),ct.workflowRunUrl&&o.jsx("a",{href:ct.workflowRunUrl,target:"_blank",rel:"noopener noreferrer",children:_("agentWorkspace.viewRelease")})]})]},`${ct.version}-${wi||ct.createdAt}`)}):o.jsxs("article",{className:"aw-version-row",children:[o.jsxs("div",{children:[o.jsx("strong",{children:qt!=null?`v${qt}`:_("agentWorkspace.noVersion")}),o.jsx("small",{children:(W==null?void 0:W.updatedAt)||_("agentWorkspace.noTime")})]}),o.jsx("p",{children:_("agentWorkspace.currentVersionOnly")})]})]})]}),L==="integrations"&&o.jsxs("div",{className:"aw-integration-stack",children:[o.jsxs("div",{className:"aw-integration-intro",children:[o.jsx("h3",{children:_("agentWorkspace.integrationMethods")}),o.jsx("p",{children:_("agentWorkspace.integrationDescription")})]}),ue&&o.jsxs("div",{className:"aw-integration-error",role:"alert",children:[o.jsx("span",{children:ue}),o.jsx("button",{type:"button",onClick:()=>G(ct=>ct+1),children:_("common.retry")})]}),!ue&&o.jsxs("div",{className:"aw-integration-body",children:[o.jsxs("div",{className:`aw-integration-protocol-tabs${te==="a2a"?" is-a2a":""}`,role:"tablist","aria-label":_("agentWorkspace.integrationProtocol"),children:[o.jsx("span",{className:"aw-integration-protocol-slider","aria-hidden":"true"}),_O.map((ct,wi)=>o.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:so=>{var bl;if(!["ArrowLeft","ArrowRight","Home","End"].includes(so.key))return;so.preventDefault();const Oi=so.key==="Home"?0:so.key==="End"?_O.length-1:(wi+(so.key==="ArrowRight"?1:-1)+_O.length)%_O.length,Hs=_O[Oi];Or(Hs.id),(bl=document.getElementById(`integration-${Hs.id}-tab`))==null||bl.focus()},children:ct.label},ct.id))]}),te==="api-server"?o.jsx(Qse,{protocol:"api-server",title:"API Server",available:Ho,fields:[{label:"Agent",value:Ho?((nt=br==null?void 0:br.apiApps)==null?void 0:nt.join("、"))??"":""},{label:_("agentWorkspace.discoveryEndpoint"),value:Ho?x4(Mn,"/list-apps"):""},{label:_("agentWorkspace.invocationEndpoint"),value:Ho?x4(Mn,"/run_sse"):""},{label:_("agentWorkspace.authentication"),value:Ho?Fse(W==null?void 0:W.authType,_):""},{label:"API Key",value:o.jsx(Use,{available:Ho,authType:W==null?void 0:W.authType,value:Bl,visible:fe&&!!Bl,loading:Oe,error:be,onToggle:()=>void Tr()})}],example:Ho?Mqt(Mn,aa,W==null?void 0:W.authType):""}):o.jsx(Qse,{protocol:"a2a",title:"A2A",available:Xa,fields:[{label:"Agent",value:((kn=br==null?void 0:br.a2a)==null?void 0:kn.name)??""},{label:"Agent Card",value:Xa?x4(Mn,"/.well-known/agent-card.json"):""},{label:_("agentWorkspace.invocationUrl"),value:Ya},{label:_("agentWorkspace.authentication"),value:Xa?Fse(W==null?void 0:W.authType,_):""},{label:"API Key",value:o.jsx(Use,{available:Xa,authType:W==null?void 0:W.authType,value:Bl,visible:fe&&!!Bl,loading:Oe,error:be,onToggle:()=>void Tr()})}],example:Xa?Lqt(Ya,W==null?void 0:W.authType):""})]})]}),L==="evaluations"&&o.jsxs("section",{className:"aw-cases",children:[(we==null?void 0:we.runtimeId)&&o.jsx("div",{className:"aw-case-summary",children:["good","bad"].map(ct=>{const wi=Hqt(wr,ct),so=io.filter(Hs=>Hs.kind===ct).length,Oi=Xr?so:(wi==null?void 0:wi.itemCount)??so;return o.jsxs("button",{type:"button",onClick:()=>Kd(ct),children:[o.jsx("strong",{children:Oi}),o.jsx("span",{children:_(ct==="good"?"agentWorkspace.goodCases":"agentWorkspace.badCases")})]},ct)})}),o.jsxs("div",{className:"aw-case-filter-bar",children:[o.jsxs("div",{className:"aw-case-filter-stack",children:[o.jsx("div",{className:"aw-case-filters","aria-label":_("agentWorkspace.caseResultFilter"),children:["good","bad"].map(ct=>o.jsx("button",{type:"button",className:gt===ct?"is-active":"","aria-pressed":gt===ct,onClick:()=>st(ct),children:_(ct==="good"?"agentWorkspace.goodCase":"agentWorkspace.badCase")},ct))}),o.jsx("div",{className:"aw-case-source-filters","aria-label":_("agentWorkspace.feedbackSourceFilter"),children:["auto","user"].map(ct=>o.jsx("button",{type:"button",className:Ht===ct?"is-active":"","aria-pressed":Ht===ct,onClick:()=>cn(ct),children:_(ct==="auto"?"agentWorkspace.automaticFeedback":"agentWorkspace.manualFeedback")},ct))})]}),o.jsxs("label",{className:"aw-case-search",children:[o.jsx(IN,{"aria-hidden":!0}),o.jsx("input",{type:"search",value:xt,onChange:ct=>ft(ct.currentTarget.value),placeholder:_("agentWorkspace.searchCasesPlaceholder"),"aria-label":_("agentWorkspace.searchCases")})]})]}),ro&&o.jsx("div",{className:`aw-case-toolbar${Eo?" is-active":""}`,children:Eo?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"aw-selection-count",children:_("agentWorkspace.selectedCaseCount",{count:ws.length})}),o.jsx("button",{type:"button",onClick:m0,disabled:Ar.length===0||Ns,children:_("agentWorkspace.selectAllVisible")}),o.jsx("button",{type:"button",className:"aw-selection-danger",onClick:()=>void zg(ws),disabled:ws.length===0||Ns,children:_(Ns?"common.deleting":"agentWorkspace.deleteSelected")}),o.jsx("button",{type:"button",onClick:g0,disabled:Ns,children:_("common.cancel")})]}):o.jsx("button",{type:"button",onClick:()=>{or(""),Li(!0)},disabled:Ar.length===0||Ns,children:_("agentWorkspace.selectCases")})}),ra&&o.jsx("div",{className:"aw-delete-error",role:"alert",children:ra}),o.jsx("div",{ref:ss,children:o.jsx(nWt,{cases:Ar,loading:ir&&Ar.length===0,error:kt,notice:Nn,runtimeBacked:!!(we!=null&&we.runtimeId),selectionMode:Eo,selectedCaseIds:fl,focusedCaseId:Co,expandedCaseIds:Ka,deleting:Ns,canDelete:ro,onOpenCase:y0,onToggleCase:Qg,onToggleExpanded:b0,onDeleteCase:ct=>void zg([ct]),onRetry:()=>is(ct=>ct+1)})})]}),L==="optimizations"&&o.jsxs("section",{className:"aw-optimizations",children:[o.jsxs("div",{className:"aw-optimization-intro",children:[o.jsx("h3",{children:_("agentWorkspace.optimizations")}),o.jsx("p",{children:_("agentWorkspace.optimizationsDescription")})]}),oi?o.jsxs("div",{className:"aw-optimization-state",role:"status",children:[o.jsx("span",{className:"loading-gap-spinner","aria-hidden":"true"}),o.jsx("span",{children:_("agentWorkspace.loadingOptimizations")})]}):Fr?o.jsxs("div",{className:"aw-optimization-state is-error",role:"alert",children:[o.jsx("span",{children:Fr}),o.jsx("button",{type:"button",onClick:()=>Hr(ct=>ct+1),children:_("common.retry")})]}):$r.length>0?o.jsx(eWt,{groups:$r}):o.jsx("div",{className:"aw-optimization-state",children:_("agentWorkspace.noOptimizations")})]})]}),L==="basic"&&(we||ai)&&o.jsxs("div",{className:"aw-basic-actions",children:[we&&o.jsxs("button",{type:"button",className:"aw-talk studio-update-action",onClick:()=>E==null?void 0:E(we),children:[o.jsx(rrt,{"aria-hidden":!0}),o.jsx("span",{children:_("agentWorkspace.chat")})]}),o.jsxs("span",{className:`aw-update-wrap${pl?" is-disabled":""}`,tabIndex:pl?0:void 0,"aria-describedby":pl?ml:void 0,children:[o.jsx("button",{type:"button",className:"aw-update studio-update-action",disabled:!!pl,"aria-busy":Ae||void 0,"aria-describedby":pl?ml:void 0,onClick:()=>ai?R==null?void 0:R(ai):Je?T(Je):void 0,children:Ae?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"loading-gap-spinner aw-update-spinner","aria-hidden":"true"}),o.jsx("span",{children:_("agentWorkspace.preparing")})]}):_(ai||sa?"agentWorkspace.continueEditing":"agentWorkspace.update")}),pl&&o.jsx("span",{id:ml,className:"aw-update-disabled-reason",role:"tooltip",children:pl})]})]})]}):null}}),activeSectionKey:L,navigationLabel:_("agentWorkspace.agentDetails"),onSectionChange:F})]})]}),M==="evaluation"&&o.jsx("div",{className:"aw-evaluation-glass",role:"status",children:o.jsx("span",{children:_("agentWorkspace.comingSoon")})})]})]}),En&&o.jsx(Xu,{variant:"danger",title:En.title,description:En.description,confirmLabel:Vt?_("common.deleting"):En.confirmLabel,closeLabel:_("agentWorkspace.closeDeleteConfirmation"),busy:Vt,onCancel:()=>vi(null),onConfirm:()=>void qg()})]})}function eWt({groups:e}){const{t}=_e("ui");return o.jsx("div",{className:"aw-optimization-table-wrap",children:o.jsxs("table",{className:"aw-optimization-table",children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{scope:"col",children:t("agentWorkspace.fixPriority")}),o.jsx("th",{scope:"col",children:t("agentWorkspace.suggestedModule")}),o.jsx("th",{scope:"col",children:t("agentWorkspace.suggestionAndReason")})]})}),o.jsx("tbody",{children:e.map(n=>o.jsxs("tr",{children:[o.jsx("td",{children:o.jsx("span",{className:`aw-priority is-${n.priority}`,children:Qqt(n.priority,t)})}),o.jsx("td",{children:o.jsx("span",{className:"aw-optimization-module",children:Vqt(n,t)})}),o.jsx("td",{children:o.jsx("ul",{className:"aw-optimization-list",children:n.items.map(i=>o.jsxs("li",{children:[o.jsx("strong",{children:i.suggestion}),o.jsx("p",{children:i.reason})]},`${i.suggestion}:${i.reason}`))})})]},`${n.priority}:${n.module}:${n.customModule??""}`))})]})})}function tWt(){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("path",{d:"M4.5 7h15"}),o.jsx("path",{d:"M9 7V4.8h6V7"}),o.jsx("path",{d:"m6.5 7 .8 12h9.4l.8-12"}),o.jsx("path",{d:"M10 10.5v5M14 10.5v5"})]})}function nWt({cases:e,loading:t=!1,error:n="",notice:i="",runtimeBacked:r=!1,selectionMode:s=!1,selectedCaseIds:a,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}=_e("ui");return o.jsxs("div",{className:"aw-case-table",children:[o.jsxs("div",{className:"aw-case-row aw-case-row-head",children:[o.jsx("span",{children:v("agentWorkspace.userInput")}),o.jsx("span",{children:v("agentWorkspace.agentOutput")}),o.jsx("span",{children:v("agentWorkspace.score")}),o.jsx("span",{children:v("agentWorkspace.scoreReason")}),o.jsx("span",{className:"aw-case-action-head",children:v("skillCenter.actions")})]}),t?o.jsx("div",{className:"aw-case-empty",children:v("agentWorkspace.loadingEvaluationSet")}):n?o.jsxs("div",{className:"aw-case-empty aw-case-error",children:[o.jsx("span",{children:n}),b&&o.jsx("button",{type:"button",onClick:b,children:v("common.retry")})]}):i?o.jsx("div",{className:"aw-case-empty",children:i}):e.length===0?o.jsx("div",{className:"aw-case-empty",children:v(r?"agentWorkspace.noFeedbackCases":"agentWorkspace.noMatchingCases")}):e.map(x=>{var A,j;const w=x.id.startsWith("local:"),O=(a==null?void 0:a.has(x.id))??!1,S=(c==null?void 0:c.has(x.id))??!1,C=x.output.length+x.referenceOutput.length>220||(((A=x.reason)==null?void 0:A.length)??0)>120,E=d&&!w,N=!!(x.comment&&x.comment.trim()!==((j=x.reason)==null?void 0:j.trim()));return o.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:[o.jsxs("div",{className:"aw-case-text aw-case-cell","data-label":v("agentWorkspace.userInput"),children:[o.jsxs("span",{className:"aw-case-title-line",children:[s&&E&&o.jsx("span",{className:`aw-select-marker${O?" is-checked":""}`,"aria-hidden":"true"}),o.jsx("strong",{title:x.input,children:x.input||v("agentWorkspace.noUserInput")})]}),N&&o.jsxs("small",{title:x.comment,children:[v("agentWorkspace.note"),x.comment]}),o.jsx("small",{className:"aw-case-time",children:Bqt(x.createdAt,y.resolvedLanguage??y.language,v)}),(x.userId||x.sessionId)&&o.jsx("small",{title:[x.userId,x.sessionId].filter(Boolean).join(" · "),children:[x.userId,x.sessionId].filter(Boolean).join(" · ")})]}),o.jsxs("div",{className:`aw-case-output aw-case-cell${S?" is-expanded":""}`,"data-label":v("agentWorkspace.agentOutput"),children:[o.jsx("p",{className:"aw-case-output-preview",title:x.output,children:x.output||v("agentWorkspace.noVisibleResponse")}),x.referenceOutput&&o.jsxs("small",{className:"aw-case-output-preview",title:x.referenceOutput,children:[v("agentWorkspace.reference"),": ",x.referenceOutput]}),C&&o.jsx("button",{type:"button",className:"aw-case-expand",onClick:T=>{T.stopPropagation(),m==null||m(x.id)},children:v(S?"common.collapse":"common.expand")})]}),o.jsx("div",{className:"aw-case-score aw-case-cell","data-label":v("agentWorkspace.score"),children:Uqt(x,v)}),o.jsx("div",{className:`aw-case-reason aw-case-cell${S?" is-expanded":""}`,"data-label":v("agentWorkspace.scoreReason"),children:o.jsx("p",{title:x.reason||void 0,children:x.reason||"—"})}),o.jsx("div",{className:"aw-case-actions aw-case-cell","data-label":v("skillCenter.actions"),children:E&&o.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:o.jsx(tWt,{})})})]},x.id)})]})}function iWt({group:e,agents:t,cases:n,onChange:i,onRun:r}){const{t:s}=_e("ui"),[a,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 o.jsxs("main",{className:"aw-main",children:[o.jsxs("div",{className:"aw-eval-head",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"aw-agent-title-row",children:[o.jsx("h2",{children:pk(e.name,s)}),o.jsx("span",{children:s("agentWorkspace.evaluationGroup")})]}),o.jsx("p",{children:s("agentWorkspace.evaluationGroupStats",{agents:c.length,caseSet:pk(e.caseSet,s),runs:e.history.length})})]}),o.jsxs("button",{type:"button",className:"aw-run",onClick:()=>r(e),disabled:!0,children:[o.jsx(Yit,{"aria-hidden":!0}),s("agentWorkspace.startEvaluation")]})]}),o.jsxs("nav",{className:"aw-agent-tabs","aria-label":s("agentWorkspace.evaluationGroupDetails"),children:[o.jsx("button",{type:"button",className:a==="config"?"is-active":"","aria-pressed":a==="config",onClick:()=>l("config"),disabled:!0,children:s("agentWorkspace.evaluationConfig")}),o.jsx("button",{type:"button",className:a==="history"?"is-active":"","aria-pressed":a==="history",onClick:()=>l("history"),disabled:!0,children:s("agentWorkspace.historyResults")})]}),o.jsx("div",{className:"aw-content",children:a==="config"?o.jsxs("div",{className:"aw-eval-setup",children:[o.jsxs("section",{className:"aw-eval-block",children:[o.jsxs("div",{className:"aw-card-head",children:[o.jsx("strong",{children:s("agentWorkspace.participatingAgents")}),o.jsx("span",{children:s("agentWorkspace.selectedCount",{count:c.length})})]}),o.jsx("div",{className:"aw-eval-agent-grid",children:t.map(h=>o.jsxs("label",{children:[o.jsx("input",{type:"checkbox",checked:e.agentIds.includes(h.id),onChange:()=>d(h.id)}),o.jsxs("span",{children:[o.jsx("strong",{children:h.label}),o.jsx("small",{children:h.remote?s("agentWorkspace.remote"):s("agentWorkspace.local")})]})]},h.id))})]}),o.jsxs("div",{className:"aw-eval-setting-grid",children:[o.jsxs("section",{className:"aw-eval-block",children:[o.jsx("div",{className:"aw-card-head",children:o.jsx("strong",{children:s("agentWorkspace.evaluationResources")})}),o.jsxs("div",{className:"aw-eval-fields",children:[o.jsxs("label",{children:[o.jsx("span",{children:s("agentWorkspace.evaluationSet")}),o.jsxs("select",{value:e.caseSet,onChange:h=>i({...e,caseSet:h.currentTarget.value}),children:[o.jsx("option",{value:"核心回归集",children:s("agentWorkspace.evaluationDefaults.coreSet")}),o.jsx("option",{value:"安全边界集",children:s("agentWorkspace.evaluationDefaults.safetySet")}),o.jsx("option",{value:"工具调用集",children:s("agentWorkspace.evaluationDefaults.toolSet")})]}),o.jsx("small",{children:s("agentWorkspace.caseCount",{count:n.length})})]}),o.jsxs("label",{children:[o.jsx("span",{children:s("agentWorkspace.evaluator")}),o.jsxs("select",{value:e.evaluator,onChange:h=>i({...e,evaluator:h.currentTarget.value}),children:[o.jsx("option",{value:"综合质量评估器",children:s("agentWorkspace.evaluationDefaults.qualityEvaluator")}),o.jsx("option",{value:"事实一致性评估器",children:s("agentWorkspace.evaluationDefaults.factualEvaluator")}),o.jsx("option",{value:"工具调用评估器",children:s("agentWorkspace.evaluationDefaults.toolEvaluator")})]})]}),o.jsxs("label",{children:[o.jsx("span",{children:s("agentWorkspace.concurrency")}),o.jsxs("select",{value:e.concurrency,onChange:h=>i({...e,concurrency:h.currentTarget.value}),children:[o.jsx("option",{value:"2",children:"2"}),o.jsx("option",{value:"4",children:"4"}),o.jsx("option",{value:"8",children:"8"})]})]})]})]}),o.jsxs("section",{className:"aw-eval-block",children:[o.jsxs("div",{className:"aw-card-head",children:[o.jsx("strong",{children:s("agentWorkspace.evaluationMetrics")}),o.jsx("span",{children:s("agentWorkspace.selectedMetricCount",{count:e.metrics.length})})]}),o.jsx("div",{className:"aw-metric-list",children:u.map(h=>o.jsxs("label",{children:[o.jsx("input",{type:"checkbox",checked:e.metrics.includes(h),onChange:()=>f(h)}),o.jsx("span",{children:pk(h,s)})]},h))})]})]})]}):o.jsxs("section",{className:"aw-eval-history",children:[o.jsx("div",{className:"aw-section-head",children:o.jsxs("div",{children:[o.jsx("h3",{children:s("agentWorkspace.historyResults")}),o.jsx("p",{children:s("agentWorkspace.historyDescription")})]})}),e.history.length===0?o.jsxs("div",{className:"aw-results-empty",children:[o.jsx("strong",{children:s("agentWorkspace.noHistory")}),o.jsx("span",{children:s("agentWorkspace.noHistoryDescription")})]}):o.jsx("div",{className:"aw-history-list",children:e.history.map((h,m)=>o.jsxs("button",{type:"button",children:[o.jsxs("span",{children:[o.jsx("strong",{children:s("agentWorkspace.evaluationRun",{index:e.history.length-m})}),o.jsx("small",{children:s("agentWorkspace.evaluationRunMeta",{time:pk(h.createdAt,s),agents:c.length})})]}),o.jsxs("span",{className:"aw-history-score",children:[o.jsx("strong",{children:h.score}),o.jsx("small",{children:s("agentWorkspace.overallScore")})]}),o.jsxs("span",{className:"aw-complete",children:[o.jsx(Fd,{}),s("agentWorkspace.completed")]}),o.jsx(Hk,{"aria-hidden":!0})]},h.id))})]})})]})}async function dq(e,t={}){const n=await fetch(ta(`/web/agent-reviews${e}`),{...t,headers:Ml(hu({"Content-Type":"application/json"})),signal:Ha(t.signal??void 0,6e4)});if(!n.ok)throw new Error(await n.text());return n.json()}function rWt(e,t){return dq(`?${new URLSearchParams({region:e})}`,{signal:t})}function sWt(e,t,n){return dq(`/${encodeURIComponent(e)}?${new URLSearchParams({region:t})}`,{signal:n})}function oWt(e,t,n){return dq(`/${encodeURIComponent(e)}/${t}`,{method:"POST",body:JSON.stringify(n)})}const aWt=20,Vse=256;function w4({label:e,value:t,onChange:n,limit:i,disabled:r,required:s=!1}){const{t:a}=_e("agentReviews");return o.jsxs("label",{children:[e,o.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}),o.jsx("span",{className:"agent-review-text-count",children:a("textCount",{count:Array.from(t).length,limit:i})})]})}function YR({person:e}){return o.jsxs("span",{className:"agent-review-person",title:e.email||e.name,children:[e.avatarUrl?o.jsx("img",{src:e.avatarUrl,alt:"",referrerPolicy:"no-referrer",onError:t=>{t.currentTarget.hidden=!0}}):null,o.jsx("span",{children:e.name||e.id})]})}function vFe({runtimeId:e,region:t,name:n,canPublish:i,onClose:r,onChanged:s}){const{t:a,i18n:l}=_e("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,N]=p.useState(!1),[A,j]=p.useState(null);p.useEffect(()=>{const P=new AbortController;return f(!0),b(""),sWt(e,t,P.signal).then(L=>{P.signal.aborted||u(L.application)}).catch(L=>{P.signal.aborted||b(L instanceof Error?L.message:String(L))}).finally(()=>{P.signal.aborted||f(!1)}),()=>P.abort()},[e,t,k]);async function T(P,L){if(!h){m(!0),b("");try{const F=await oWt(e,P,{region:t,...P==="submit"?{message:v}:{},...P==="publish"||P==="decision"?{comment:x}:{},...P==="decision"?{applicationId:c==null?void 0:c.id,decision:L,reason:O}:{}});u(F),w(""),S(""),N(!1),j(null),s()}catch(F){b(F instanceof Error?F.message:String(F))}finally{m(!1)}}}const R=(c==null?void 0:c.status)==="pending",_=!!(c!=null&&c.published),D=!R&&!_,M=P=>new Date(P).toLocaleString(l.language);return o.jsx(O1,{open:!0,onOpenChange:P=>{!P&&!h&&r()},children:o.jsxs(w1,{children:[o.jsx(v1,{className:"agent-review-backdrop"}),o.jsxs(x1,{className:"agent-review-dialog",children:[o.jsxs("header",{className:"agent-review-dialog-header",children:[o.jsxs("div",{children:[o.jsx(k1,{children:n}),o.jsx(ST,{children:a("dialogDescription")})]}),o.jsx(WD,{className:"agent-review-close",disabled:h,"aria-label":a("close"),children:o.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:o.jsx("path",{d:"m6 6 12 12M6 18 18 6",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round"})})})]}),o.jsxs("div",{className:"agent-review-dialog-body",children:[d?o.jsx(za,{}):null,g?o.jsxs("div",{className:"agent-review-error",role:"alert",children:[o.jsx("p",{children:g}),o.jsx("button",{type:"button",disabled:h||d,onClick:()=>C(P=>P+1),children:a("refresh")})]}):null,!d&&c?o.jsxs(o.Fragment,{children:[o.jsxs("dl",{className:"agent-review-facts",children:[o.jsxs("div",{children:[o.jsx("dt",{children:a("statusTitle")}),o.jsxs("dd",{children:[a(`status.${c.status}`),c.status==="approved"&&!_?` · ${a("private")}`:""]})]}),o.jsxs("div",{children:[o.jsx("dt",{children:a("submitter")}),o.jsx("dd",{children:o.jsx(YR,{person:c.submitter})})]}),o.jsxs("div",{children:[o.jsx("dt",{children:a("submittedAt")}),o.jsx("dd",{children:M(c.submittedAt)})]}),o.jsxs("div",{children:[o.jsx("dt",{children:a("version")}),o.jsx("dd",{children:c.agent.version??"—"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:a("model")}),o.jsx("dd",{children:c.agent.model||"—"})]}),c.reviewer?o.jsxs("div",{children:[o.jsx("dt",{children:a(c.status==="returned"?"returnedBy":"approvedBy")}),o.jsx("dd",{children:o.jsx(YR,{person:c.reviewer})})]}):null,c.reviewedAt?o.jsxs("div",{children:[o.jsx("dt",{children:a("reviewedAt")}),o.jsx("dd",{children:M(c.reviewedAt)})]}):null]}),o.jsxs("section",{children:[o.jsx("h3",{children:a("description")}),o.jsx("p",{children:c.agent.description||"—"})]}),c.message?o.jsxs("section",{children:[o.jsx("h3",{children:a("message")}),o.jsx("p",{children:c.message})]}):null,c.reason?o.jsxs("section",{children:[o.jsx("h3",{children:a("reason")}),o.jsx("p",{children:c.reason})]}):null,c.comment?o.jsxs("section",{children:[o.jsx("h3",{children:a("comment")}),o.jsx("p",{children:c.comment})]}):null,c.contentChanged?o.jsx("p",{role:"alert",className:"agent-review-warning",children:a("contentChanged")}):null]}):null,!d&&!g&&D&&!i?o.jsx(w4,{label:a("message"),value:v,onChange:y,limit:aWt,disabled:h}):null,!d&&!g&&i&&(R||D)?o.jsx(w4,{label:a("comment"),value:x,onChange:w,limit:Vse,disabled:h}):null,E?o.jsx(w4,{label:a("reasonRequired"),value:O,onChange:S,limit:Vse,disabled:h,required:!0}):null,A?o.jsx("p",{role:"status",children:a(`${A}Confirm`)}):null]}),o.jsxs("footer",{className:"agent-review-dialog-footer",children:[h?o.jsx("span",{role:"status",children:a("saving")}):null,!d&&(!g||c)?A?o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",disabled:h,onClick:()=>j(null),children:a("cancel")}),o.jsx("button",{type:"button",disabled:h,onClick:()=>void T(A),children:a("confirm")})]}):E?o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",disabled:h,onClick:()=>N(!1),children:a("cancel")}),o.jsx("button",{type:"button",disabled:h||!O.trim(),onClick:()=>void T("decision","returned"),children:a("return")})]}):o.jsxs(o.Fragment,{children:[_?o.jsx("button",{type:"button",disabled:h,onClick:()=>j("unpublish"),children:a("unpublish")}):null,R?o.jsx("button",{type:"button",disabled:h,onClick:()=>j("withdraw"),children:a("withdraw")}):null,R&&i?o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",disabled:h,onClick:()=>N(!0),children:a("return")}),o.jsx("button",{type:"button",className:"is-primary",disabled:h||(c==null?void 0:c.contentChanged),onClick:()=>void T("decision","approved"),children:a("approve")})]}):null,D?o.jsx("button",{type:"button",className:"is-primary",disabled:h,onClick:()=>void T(i?"publish":"submit"),children:a(i?"publish":"submit")}):null]}):null]})]})]})})}const lWt=5e3,cWt=4;let O4=0;const Hse=[];function qse(e){return e instanceof Error&&e.name==="AbortError"}function uWt(e){return e instanceof Error&&e.name==="TimeoutError"}function dWt(e){return uWt(e)||e instanceof LU&&[500,502,503,504].includes(e.status)}function fWt(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 hWt(e={},t={}){const n=t.request??Qw,i=t.wait??fWt;try{return await n(e)}catch(r){if(!dWt(r))throw r;return await i(lWt,e.signal),n(e)}}async function xFe(e){var t;O4>=cWt&&await new Promise(n=>Hse.push(n)),O4+=1;try{return await e()}finally{O4-=1,(t=Hse.shift())==null||t()}}async function pWt(e,t){await Promise.allSettled(e.map(n=>xFe(()=>t(n))))}function Rb(e,t,n){const i=e instanceof Error?`${e.name}: ${e.message}`:String(e||V("common.unknownError"));return[V("requestError.actionFailed",{action:t}),V("requestError.detail",{detail:i}),n?V("requestError.request",{request:n}):""].filter(Boolean).join(` -`)}function Uh({className:e="icon"}){return o.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:[o.jsx("rect",{x:"4.25",y:"5.25",width:"15.5",height:"13.5",rx:"4.75"}),o.jsx("path",{className:"sidebar-agent-face__eye",d:"M8.5 10.7v2"}),o.jsx("path",{className:"sidebar-agent-face__eye",d:"M15.5 10.7v2"})]})}function mWt(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.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"}),o.jsx("path",{d:"m7.8 12.3 2 2-2 2M12.2 16.3h3.2"})]})}function gWt(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M18.9 6.25A8.4 8.4 0 1 0 19.6 16"}),o.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"}),o.jsx("circle",{cx:"10.6",cy:"12.8",r:"2.45"}),o.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 bWt(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.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"}),o.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"}),o.jsx("path",{d:"M9.3 12.65h.01M14.9 12.65h.01M10.8 15.55c.8.5 1.65.5 2.45 0"}),o.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 yWt(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M5.2 17.2V8.1a3 3 0 0 1 3-3h7.6a3 3 0 0 1 3 3v9.1"}),o.jsx("path",{d:"M7.4 17.2h9.2M9 19.9h6"}),o.jsx("path",{d:"M9.1 9.25h5.8M9.1 12h3.1"}),o.jsx("path",{d:"m14.1 12.4 2 2.1M16.2 12.4l-2.1 2.1"})]})}function ZE({kind:e,...t}){return e==="codex"?o.jsx(mWt,{...t}):e==="deepseek-harness"?o.jsx(yWt,{...t}):e==="openclaw"?o.jsx(gWt,{...t}):o.jsx(bWt,{...t})}const vWt=["general","codex","deepseek-harness","openclaw","hermes"],xWt=24,wWt=3e4,OWt=7e3,kWt=2e4,SWt=6,EWt=2,CWt=250,Rm=new Map,Tx=new Map,TWt=new Set;function lb(e){const t=e.runtime;return t?`${t.region}:${t.runtimeId}:${t.currentVersion??""}`:""}function Wse(e,t){const n=e instanceof Error&&e.message.trim()?e.message.trim():t("myAgents.compatibility.unknownError");return{status:e instanceof ho&&e.unsupported?"unsupported":"error",message:n}}function Eb(e){if(!e){Rm.clear(),Tx.clear(),eF();return}const t=new Set(e);if(t.size!==0){for(const[n,i]of Tx)i.page.runtimes.some(r=>t.has(r.runtimeId))&&Tx.delete(n);for(const n of t)eF(n);Rm.clear()}}function AWt(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"M8 3.25v9.5M3.25 8h9.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}function _Wt(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.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 jWt(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.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 NWt({type:e}){return e==="general"?o.jsx(Uh,{}):o.jsx(ZE,{kind:e})}function RWt(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),a=r%60;return n("myAgents.sandboxRemaining",{hours:s,minutes:a})}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:EMe(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 IWt(e,t){const n=XI(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:EMe(e.createdBy),isMine:e.isMine,region:e.region,sandbox:e}}function PWt(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 DWt(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 MWt(e,t){return e.trim()||Ki(t)}async function LWt(e,t,n,i,r,s){const a=`${e}:${t}:${n}`,l=Tx.get(a);if(l&&l.expiresAt>Date.now())return i(l.page.runtimes.map(d=>Kse(d,r))),l.page.nextToken;l&&Tx.delete(a);let c=Rm.get(a);c||(c=hWt({scope:e,region:t,pageSize:xWt,nextToken:n,signal:s}),Rm.set(a,c),c.then(()=>Rm.delete(a),()=>Rm.delete(a)));const u=await c;return Tx.set(a,{page:u,expiresAt:Date.now()+wWt}),i(u.runtimes.map(d=>Kse(d,r))),u.nextToken}function $Wt({agent:e,onReview:t,onUse:n,onViewDetails:i,onPrepareUpdate:r,compatibility:s,onRetryCompatibility:a,connecting:l,connectError:c,connected:u,deploymentTask:d,nowMs:f,onViewDeploymentTask:h,onEditDraft:m,onDeleteDraft:g}){var j,T,R,_;const{t:b,i18n:v}=_e("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=((R=e.sandbox)==null?void 0:R.resourceType)==="snapshot"?e.sandbox.sourceSessionId||e.sandbox.snapshotId:(_=e.sandbox)==null?void 0:_.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))},N=(e.draft||w||!!e.sandbox)&&!!(d?h:i),A=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 o.jsxs(Uz,{className:`my-agent-card${l?" is-connecting":""}${e.runtime?" has-review":""}`,activateLabel:N?A:void 0,onActivate:N?E:void 0,onPointerEnter:()=>r==null?void 0:r(e),onFocusCapture:()=>r==null?void 0:r(e),footer:o.jsxs("div",{className:"my-agent-card-footer",children:[o.jsx(TIe,{className:"my-agent-meta",items:[{label:e.specificationLabel,value:e.specification,hideLabel:!0,className:"my-agent-region"},{label:b("myAgents.time"),value:KD(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"):RWt(e.sandbox.expireAt,f,b),className:`my-agent-expiry${e.sandbox.resourceType==="snapshot"||e.sandbox.persistent?"":" is-expiring"}`}]:[]]}),e.runtime?o.jsxs("div",{className:"agent-review-card-controls",children:[o.jsx("span",{className:"agent-review-card-status",children:b(e.runtime.visibility==="enterprise"?"enterprise":"private",{ns:"agentReviews"})}),e.runtime.canManage?o.jsxs(rj,{className:"agent-review-card-action",onClick:D=>{D.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?o.jsxs(o.Fragment,{children:[o.jsx(rj,{"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")}),o.jsx(rj,{tone:"danger","aria-label":b("myAgents.deleteDraftNamed",{name:e.name}),onClick:()=>g==null?void 0:g(e.draft),children:b("common.delete")})]}):k||S?o.jsxs(Dt,{type:"button",color:"primary",size:"sm",pill:!1,"aria-label":b("myAgents.recheckCompatibility",{name:e.name}),onClick:()=>a==null?void 0:a(e),children:[o.jsx(hP,{}),b("common.retry")]}):o.jsx(u8,{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?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"my-agent-use-spinner","aria-hidden":"true"}),o.jsx("span",{className:"sr-only",children:b(x?"myAgents.waking":"agentSelector.connecting")})]}):o.jsx(_Wt,{})}),children:[o.jsx(Qz,{leading:o.jsx(cw,{seed:e.name}),title:e.name,subtitle:e.sandbox?o.jsx("span",{className:"my-agent-session-id",title:C,children:C}):void 0,status:e.draft?d?o.jsx("span",{className:"my-agent-deploying-badge",children:b("myAgents.deploying")}):o.jsx("span",{className:"my-agent-draft-badge",children:b("myAgents.draft")}):e.sandbox?o.jsx("span",{className:"my-agent-status-label","data-ready":XI(e.sandbox.status)==="ready"||void 0,children:e.description}):e.runtime&&d?o.jsx("span",{className:"my-agent-deploying-badge",children:b("myAgents.deploying")}):O?o.jsx(po,{content:s==null?void 0:s.message,contentClassName:"my-agent-compatibility-tooltip",maxWidth:360,align:"end",interactive:!0,preventUnintentionalClickToClose:!0,children:o.jsx("span",{className:"my-agent-compatibility-trigger",tabIndex:0,children:o.jsxs(Lo,{className:"my-agent-compatibility-status",color:"secondary",variant:"soft",size:"sm",pill:!0,children:[o.jsx("span",{className:"my-agent-compatibility-spinner","aria-hidden":"true"}),o.jsx("span",{children:b("myAgents.checking")})]})})}):S?o.jsx(po,{content:s==null?void 0:s.message,contentClassName:"my-agent-compatibility-tooltip",maxWidth:360,align:"end",interactive:!0,preventUnintentionalClickToClose:!0,children:o.jsx("span",{className:"my-agent-compatibility-trigger",tabIndex:0,children:o.jsx(Lo,{className:"my-agent-compatibility-status",color:"warning",variant:"soft",size:"sm",pill:!0,children:b("myAgents.chatUnsupported")})})}):k?o.jsx(po,{content:s==null?void 0:s.message,contentClassName:"my-agent-compatibility-tooltip",maxWidth:360,align:"end",interactive:!0,preventUnintentionalClickToClose:!0,children:o.jsx("span",{className:"my-agent-compatibility-trigger",tabIndex:0,children:o.jsx(Lo,{className:"my-agent-compatibility-status",color:"danger",variant:"soft",size:"sm",pill:!0,children:b("myAgents.checkFailed")})})}):null}),c?o.jsx(po,{content:c,contentClassName:"my-agent-error-tooltip",maxWidth:360,interactive:!0,children:o.jsx("p",{className:"my-agent-wake-note",role:"alert",tabIndex:0,children:c})}):null,x&&l?o.jsx("p",{className:"my-agent-wake-note",role:"status",children:o.jsx(bn,{children:b("myAgents.wakingHint")})}):null,e.sandbox?null:o.jsx(zz,{children:e.description})]})}function FWt({cloudProvider:e,studioRegion:t,canCreateRuntimeAgents:n,canCreatePersonalAgents:i,canUpdate:r,runtimeScope:s,onCreateAgent:a,onOpenCodexProjectUpload:l,onUseAgent:c,onViewAgentDetails:u,onCreateSandboxAgent:d,onUseSandboxAgent:f,onViewSandboxAgentDetails:h,activeType:m,onActiveTypeChange:g,sandboxRefreshKey:b=0,connectedRuntimeId:v="",hiddenRuntimeIds:y=TWt,drafts:x=[],deploymentTasks:w=[],draftDeploymentTaskIds:O={},onViewDeploymentTask:S,onEditDraft:k,onDeleteDraft:C}){const{t:E}=_e("ui"),N=p.useRef(null),A=p.useRef(null),j=p.useRef(0),T=p.useRef(null),R=p.useRef(0),_=p.useRef(null),D=p.useRef(new Map),M=MWt(t,e),[P,L]=p.useState(null),[F,I]=p.useState(""),[z,K]=p.useState(s==="mine"?"mine":"all"),[B,W]=p.useState(M),[H,X]=p.useState([]),[ie,Q]=p.useState(""),[Z,ue]=p.useState(!0),[Ee,Y]=p.useState(""),[G,te]=p.useState([]),[de,Ce]=p.useState(!1),[le,fe]=p.useState(""),[re,Oe]=p.useState(""),[Pe,be]=p.useState({}),[Qe,ve]=p.useState({}),[Ne,ne]=p.useState(null),[ye,Te]=p.useState(()=>Date.now()),Se=p.useMemo(()=>vWt.map(Le=>({value:Le,label:E(`myAgents.agentTypes.${Le}`)})),[E]),Ke=p.useMemo(()=>{const Le=nu(e);return Le.some(We=>We.value===M)?Le:[{value:M,label:M},...Le]},[e,M]);p.useEffect(()=>{s==="mine"&&K("mine")},[s]),p.useEffect(()=>{W(M)},[M]),p.useEffect(()=>{Te(Date.now());const Le=window.setInterval(()=>Te(Date.now()),1e3);return()=>window.clearInterval(Le)},[]);const it=p.useMemo(()=>x.map(Le=>PWt(Le,E)),[x,E]),he=p.useMemo(()=>{const Le=new Map,We=new Map,gt=new Map;for(const st of w){if(st.status!=="running")continue;if(Le.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:Le,byDraftId:We,byRuntimeId:gt}},[w]),xe=p.useCallback(Le=>{var gt;if(Le.draft){const st=O[Le.draft.id];return he.byDraftId.get(Le.draft.id)??(st?he.byId.get(st):void 0)}const We=(gt=Le.runtime)==null?void 0:gt.runtimeId;return We?he.byRuntimeId.get(We):void 0},[he,O]),Ae=p.useCallback((Le,We)=>{var xt;(xt=T.current)==null||xt.abort(),Rm.clear();const gt=new AbortController;T.current=gt;const st=++j.current;return ue(!0),Y(""),LWt(z,B,Le,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&&(qse(ft)||Y(Rb(ft,E("myAgents.loadGeneralAgents"),"GET /web/runtimes")))}).finally(()=>{j.current===st&&ue(!1),T.current===gt&&(T.current=null)})},[z,B,E]);p.useEffect(()=>{if(m==="general")return X([]),Q(""),Ae("",!0),()=>{var Le;(Le=T.current)==null||Le.abort(),T.current=null,Rm.clear(),j.current+=1}},[m,Ae]),p.useEffect(()=>{if(m!=="general"){for(const gt of D.current.values())gt.abort();D.current.clear();return}const Le=new Set(H.filter(gt=>{var st,xt;return((st=gt.runtime)==null?void 0:st.runtimeId)!==v&&((xt=gt.runtime)==null?void 0:xt.region)===B}).map(lb).filter(Boolean));for(const[gt,st]of D.current)Le.has(gt)||(st.abort(),D.current.delete(gt));const We=H.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)!==B)return!1;const xt=lb(gt),ft=(hn=Qe[xt])==null?void 0:hn.status;return!D.current.has(xt)&&(!ft||ft==="checking")});for(const gt of We)D.current.set(lb(gt),new AbortController);ve(gt=>{var ft,Ht;let st=!1;const xt={...gt};for(const cn of H){const hn=lb(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}),pWt(We,async gt=>{const st=gt.runtime;if(!st)return;const xt=lb(gt),ft=D.current.get(xt);if(ft)try{const Ht=await Kx(st.runtimeId,st.region,{signal:ft.signal,preferCached:!0,timeoutMs:OWt,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]:Wse(Ht,E)}))}finally{D.current.get(xt)===ft&&D.current.delete(xt)}})},[m,v,B,H,E]),p.useEffect(()=>()=>{var Le;(Le=T.current)==null||Le.abort();for(const We of D.current.values())We.abort();D.current.clear()},[]);const qe=p.useCallback(async Le=>{var st;(st=_.current)==null||st.abort();const We=new AbortController;_.current=We;const gt=++R.current;Ce(!0),fe(""),te([]);try{const xt=Le==="codex"?await Sr.listSessions({signal:We.signal,autoResumeSnapshots:!1}):await Sr.listAgentSessions(Le,{signal:We.signal,autoResumeSnapshots:!1});if(R.current!==gt)return;te(xt.map(ft=>IWt(ft,E)))}catch(xt){if((xt==null?void 0:xt.name)==="AbortError"||R.current!==gt)return;fe(Rb(xt,E("myAgents.loadAgentType",{type:E(`myAgents.agentTypes.${Le}`)}),`GET /web/${Le==="codex"?"sandbox":Le}/sessions`))}finally{_.current===We&&(_.current=null),R.current===gt&&Ce(!1)}},[E]);function Me(Le){var We;Le!==m&&(Le==="general"?(j.current+=1,X([]),Q(""),Y(""),ue(!0)):((We=_.current)==null||We.abort(),_.current=null,R.current+=1,te([]),fe(""),Ce(!0)),g(Le))}function At(){m==="general"&&(j.current+=1,X([]),Q(""),Y(""),ue(!0))}function It(Le){Le!==z&&(At(),K(Le))}function lt(Le){Le!==B&&(At(),W(Le))}p.useEffect(()=>{var Le;if(m==="general"){(Le=_.current)==null||Le.abort(),_.current=null,R.current+=1;return}return qe(m),()=>{var We;(We=_.current)==null||We.abort(),_.current=null,R.current+=1}},[m,qe,b]),p.useEffect(()=>{const Le=A.current,We=N.current;if(!Le||!We||m!=="general"||!ie||Z)return;const gt=new IntersectionObserver(([st])=>{st.isIntersecting&&Ae(ie,!1)},{root:We,rootMargin:"240px 0px",threshold:.01});return gt.observe(Le),()=>gt.disconnect()},[m,Ae,Z,ie]);const Ot=p.useCallback(async Le=>{if(!re){Oe(Le.id),be(We=>({...We,[Le.id]:""}));try{await new Promise(We=>requestAnimationFrame(()=>We())),Le.sandbox?await f(Le.sandbox):await c(Le)}catch(We){be(gt=>({...gt,[Le.id]:We instanceof Error?We.message:String(We)}))}finally{Oe("")}}},[re,c,f]),Ct=p.useCallback(async Le=>{var xt;const We=Le.runtime;if(!We)return;const gt=lb(Le);ve(ft=>({...ft,[gt]:{status:"checking",message:E("myAgents.compatibility.checking")}})),(xt=D.current.get(gt))==null||xt.abort();const st=new AbortController;D.current.set(gt,st);try{const ft=await xFe(()=>Kx(We.runtimeId,We.region,{retryProbe:!0,signal:st.signal,timeoutMs:kWt,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||qse(ft))return;ve(Ht=>({...Ht,[gt]:Wse(ft,E)}))}finally{D.current.get(gt)===st&&D.current.delete(gt)}},[E]),dt=p.useCallback(Le=>{const We=Le.runtime;!r||!We||xe(Le)||J$({runtimeId:We.runtimeId,region:We.region,appName:Le.appName,currentVersion:We.currentVersion})},[r,xe]),yt=p.useMemo(()=>{const Le=F.trim().toLocaleLowerCase(),We=m==="general"?[...it,...H]:G,st=(z==="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===B}),xt=Le?st.filter(cn=>cn.name.toLocaleLowerCase().includes(Le)):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,F,z,B,H,G]);p.useEffect(()=>{if(!r||m!=="general")return;const Le=yt.filter(ft=>!!ft.runtime).filter(ft=>!xe(ft)).slice(0,SWt);if(Le.length===0)return;let We=!1,gt=0;const st=async()=>{for(;!We;){const ft=Le[gt];if(gt+=1,!(ft!=null&&ft.runtime)||(await J$({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&&H.length===0&&it.length===0:de&&G.length===0,jt=!vt&&yt.length===0,ln=(m==="general"?n:i)?m==="general"?()=>a(B):()=>d(m):void 0,He=m==="codex"&&i&&!!l;return o.jsxs($f,{className:"my-agents-page","aria-label":E("myAgents.agent"),children:[o.jsx(Jy,{title:E("myAgents.agent"),className:"my-agents-header"}),o.jsxs(e0,{className:"my-agent-toolbar",children:[o.jsx(t0,{idPrefix:"my-agent-ownership",ariaLabel:E("myAgents.creatorFilter"),value:z,items:[{id:"all",label:E("common.all"),disabled:s==="mine"},{id:"mine",label:E("agentSelector.createdByMe")}],onChange:It}),o.jsxs("div",{className:"resource-toolbar__actions",children:[o.jsx(fg,{id:"my-agent-type-filter",ariaLabel:E("myAgents.agentType"),value:m,options:Se,onChange:Me}),o.jsx(fg,{id:"my-agent-region-filter",ariaLabel:E("myAgents.region"),value:B,options:Ke,onChange:lt}),o.jsx(pp,{className:"my-agent-search","aria-label":E("myAgents.searchAgents"),value:F,onChange:Le=>I(Le.target.value),placeholder:E("common.search")}),He?o.jsxs("button",{type:"button",className:"my-agent-create-secondary",onClick:l,children:[o.jsx(jWt,{}),o.jsx("span",{children:E("myAgents.handoff")})]}):null]})]}),o.jsxs(Pg,{className:"my-agent-results",ref:N,"aria-label":E("myAgents.agentList",{type:Ie}),children:[vt?o.jsx(za,{}):(m==="general"?Ee:le)&&yt.length===0?o.jsxs("div",{className:"my-agent-empty",role:"alert",children:[o.jsx("p",{children:m==="general"?Ee:le}),o.jsx("button",{type:"button",onClick:()=>{m==="general"?Ae("",!0):qe(m)},children:E("common.reload")})]}):jt&&!ln?F.trim()||z==="mine"||B!==M?o.jsx("div",{className:"my-agent-empty-message",children:o.jsxs(Pn,{fill:"none",children:[o.jsx(Pn.Icon,{children:o.jsx(vit,{})}),o.jsx(Pn.Title,{children:E("myAgents.noMatchingAgents")}),o.jsx(Pn.Description,{children:E("myAgents.adjustSearch")})]})}):m!=="general"?o.jsx("div",{className:"my-agent-empty-message",children:o.jsxs(Pn,{fill:"none",children:[o.jsx(Pn.Icon,{children:o.jsx(NWt,{type:m})}),o.jsx(Pn.Title,{className:"my-agent-sandbox-empty-title",children:E("myAgents.noAgentType",{type:Ie})})]})}):o.jsx("div",{className:"my-agent-empty-message",children:o.jsxs(Pn,{fill:"none",children:[o.jsx(Pn.Icon,{children:o.jsx(Uh,{})}),o.jsx(Pn.Title,{children:E("myAgents.noGeneralAgents")}),o.jsx(Pn.Description,{children:E("myAgents.createGeneralAgentDescription")})]})}):o.jsxs(o.Fragment,{children:[m==="general"&&Ee?o.jsxs("div",{className:"my-agent-inline-error",role:"alert",children:[o.jsx("span",{children:Ee}),o.jsx("button",{type:"button",onClick:()=>void Ae("",!0),children:E("common.reload")})]}):null,o.jsxs(n0,{className:"my-agent-grid",children:[ln?o.jsx(hg,{className:"my-agent-create-card","aria-label":E("myAgents.createAgentType",{type:Ie}),onClick:ln,icon:o.jsx(AWt,{}),children:E("myAgents.createAgent")}):null,yt.map(Le=>{var gt,st,xt,ft,Ht;const We=DWt(Le,H,E);return o.jsx($Wt,{agent:Le,onReview:L,deploymentTask:xe(Le),nowMs:ye,onViewDeploymentTask:S,onUse:Ot,compatibility:Le.runtime?Qe[lb(Le)]??{status:"checking",message:E("myAgents.compatibility.checking")}:void 0,onRetryCompatibility:Ct,onPrepareUpdate:((gt=Le.runtime)==null?void 0:gt.canManage)===!1||((st=Le.runtime)==null?void 0:st.visibility)==="enterprise"||((xt=Le.runtime)==null?void 0:xt.reviewStatus)==="pending"?void 0:dt,onViewDetails:We&&((ft=Le.runtime)==null?void 0:ft.canManage)!==!1?()=>{We.sandbox?h(We.sandbox):u(We)}:void 0,connecting:Le.id===re,connectError:Pe[Le.id],connected:((Ht=Le.runtime)==null?void 0:Ht.runtimeId)===v,onEditDraft:k,onDeleteDraft:ne},Le.id)})]})]}),m==="general"&&!Ee&&!vt&&(yt.length>0||!!ie)&&o.jsx("div",{className:"my-agent-load-more",ref:A,"aria-live":"polite",children:Z?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"my-agent-loading-mark","aria-hidden":"true"}),o.jsx("span",{children:E("myAgents.loadingMore")})]}):ie?o.jsx("span",{children:E("myAgents.scrollForMore")}):o.jsx("span",{children:E("myAgents.allLoaded")})})]}),P!=null&&P.runtime?o.jsx(vFe,{runtimeId:P.runtime.runtimeId,region:P.runtime.region,name:P.name,canPublish:P.runtime.canPublish===!0,onClose:()=>L(null),onChanged:()=>{Eb(),Ae("",!0)}},`${P.runtime.region}:${P.runtime.runtimeId}`):null,Ne?o.jsx(Xu,{title:E("myAgents.deleteDraftTitle"),description:E("myAgents.deleteDraftDescription",{name:Ne.draft.name||E("agentSelector.unnamedAgent")}),confirmLabel:E("myAgents.deleteDraft"),variant:"danger",onCancel:()=>ne(null),onConfirm:()=>{C==null||C(Ne),ne(null)}}):null]})}function fq({section:e,onWorkspace:t,onEnvironment:n,onProjects:i,actions:r,children:s,className:a=""}){const{t:l}=_e("ui"),c=l(e==="workspaces"?"workspace.title":e==="environments"?"common.environment":"workspace.codeProjects");return o.jsxs($f,{className:`workspace-center ${a}`,"aria-label":c,children:[o.jsx(Jy,{title:c}),o.jsxs(e0,{children:[(t||n)&&o.jsx(t0,{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"}),o.jsx("div",{className:"resource-toolbar__actions",children:r})]}),s]})}const BWt="_Container_13560_1",UWt="_Textarea_13560_174",Gse={Container:BWt,Textarea:UWt},Sg=e=>{const t=p.useRef(null),i=`search-ui-input-${p.useId()}`,{id:r,name:s,variant:a="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,...N}=e,[A,j]=p.useState(!1),T=k?Math.max(S??10,O):O;p.useEffect(()=>{var D;w&&((D=t.current)==null||D.select())},[w]);const R=D=>{y==null||y(D),D.animationName==="native-autofill-in"&&(x==null||x())},_=p.useCallback(()=>{if(!k||!t.current||T===void 0)return;t.current.style.height="0px";const D=t.current.scrollHeight;t.current.style.height=D+"px"},[k,T]);return p.useEffect(()=>{_()},[e.value,O,_]),o.jsx("div",{className:Ci(Gse.Container,u),"data-variant":a,"data-size":l,"data-gutter-size":c,"data-focused":A,"data-disabled":f?"":void 0,"data-readonly":h?"":void 0,"data-invalid":m?"":void 0,style:Ky({"textarea-min-rows":`${O}`,"textarea-max-rows":`${T}`}),children:o.jsx("textarea",{...N,onChange:D=>{E==null||E(D),_()},ref:LC([t,C]),id:r||(g?void 0:i),className:Gse.Textarea,name:s,readOnly:h,disabled:f,rows:O,onFocus:D=>{j(!0),b==null||b(D)},onBlur:D=>{j(!1),v==null||v(D)},onAnimationStart:R,"data-lpignore":g?void 0:!0,"data-1p-ignore":g?void 0:!0})})},YD="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",QWt="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",zWt="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",VWt="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",qWt="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",WWt="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",KWt="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",GWt="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",XWt="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 hq(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",...e,children:o.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"})})}Ba.registerLanguage("bash",nD);const YWt=48;function ZWt(e,t=YWt){return e.scrollHeight-e.scrollTop-e.clientHeight<=t}function JWt(e){return Ba.highlight(e,{language:"bash",ignoreIllegals:!0}).value}function eKt({status:e}){return e==="succeeded"?o.jsx(Fd,{"aria-hidden":!0}):e==="failed"?o.jsx(hF,{"aria-hidden":!0}):e==="running"?o.jsx(Mi,{className:"studio-build-progress__spinner","aria-hidden":!0}):o.jsx(Qit,{"aria-hidden":!0})}function Xse(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 tKt({steps:e,log:t,logError:n="",logTruncated:i=!1,logUpdatedAt:r,loading:s=!1}){const{t:a,i18n:l}=_e("ui"),c=p.useRef(null),u=p.useRef(!0),[d,f]=p.useState(!1),h=p.useMemo(()=>JWt(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 o.jsxs("div",{className:"studio-build-progress",children:[o.jsx("ol",{className:"studio-build-progress__steps","aria-label":a("studioBuildProgress.steps"),children:e.map(g=>o.jsxs("li",{className:`is-${g.status}`,children:[o.jsx("span",{className:"studio-build-progress__step-icon",children:o.jsx(eKt,{status:g.status})}),o.jsx("span",{children:g.label})]},g.key))}),o.jsxs("section",{className:"studio-build-progress__log","aria-label":a("studioBuildProgress.log"),children:[o.jsxs("header",{children:[o.jsxs("div",{children:[o.jsx("strong",{children:a("studioBuildProgress.log")}),o.jsxs("span",{children:[a(s?"studioBuildProgress.syncing":n?"studioBuildProgress.loadFailed":"studioBuildProgress.synced"),i?a("studioBuildProgress.recentOnly"):"",Xse(r,l.resolvedLanguage??l.language)?` · ${Xse(r,l.resolvedLanguage??l.language)}`:""]})]}),o.jsxs(Dt,{type:"button",color:"secondary",variant:"ghost",size:"sm",disabled:!t,onClick:()=>void m(),"aria-label":a(d?"studioBuildProgress.copiedLog":"studioBuildProgress.copyLog"),children:[d?o.jsx(Fd,{"aria-hidden":!0}):o.jsx(pP,{"aria-hidden":!0}),a(d?"studioBuildProgress.copied":"studioBuildProgress.copy")]})]}),t?o.jsx("pre",{ref:c,tabIndex:0,"aria-label":a("studioBuildProgress.logContent"),onScroll:g=>{u.current=ZWt(g.currentTarget)},children:o.jsx("code",{className:"hljs language-bash",dangerouslySetInnerHTML:{__html:h}})}):o.jsx("div",{className:`studio-build-progress__log-empty${n?" is-error":""}`,children:n||a(s?"studioBuildProgress.waiting":"studioBuildProgress.empty")})]})]})}function Yse({name:e,description:t,icon:n,selected:i,disabled:r=!1,onChange:s,className:a=""}){return o.jsxs("button",{type:"button",className:`studio-package-option${i?" is-selected":""}${a?` ${a}`:""}`,"aria-pressed":i,disabled:r,onClick:()=>s(!i),children:[o.jsx("span",{className:"studio-package-option__icon","aria-hidden":"true",children:n}),o.jsxs("span",{className:"studio-package-option__content",children:[o.jsx("strong",{children:e}),t?o.jsx("span",{children:t}):null]}),o.jsx("span",{className:"studio-package-option__action","aria-hidden":"true",children:i?o.jsx(Oit,{}):o.jsx(Eit,{})})]})}function cb(e,t){return e[t]|e[t+1]<<8}function G0(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}async function nKt(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 wFe(e,t={}){let i=-1;for(let u=e.length-22;u>=0&&u>e.length-65557;u--)if(G0(e,u)===101010256){i=u;break}if(i<0)throw new Error(Kt("helpers.zip.invalid"));const r=cb(e,i+10);if(t.maxEntries!==void 0&&r>t.maxEntries)throw new Error(Kt("helpers.zip.tooManyFiles",{count:t.maxEntries}));let s=G0(e,i+16);const a=new TextDecoder("utf-8"),l=[];let c=0;for(let u=0;ut.maxUncompressedBytes)throw new Error(Kt("helpers.zip.tooLarge"));const x=cb(e,v+26),w=cb(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 nKt(S);else{s+=46+m+g+b;continue}l.push({name:y,text:a.decode(k)}),s+=46+m+g+b}return l}const n9=/(^|\/)skill\.md$/i;function iKt(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=Gqt(e.updatedAt,l.resolvedLanguage??l.language),O=e.status==="complete"?a("agentWorkspace.logStatus.synced"):e.status==="error"?a("agentWorkspace.logStatus.failed"):a("agentWorkspace.logStatus.syncing"),S=e.omittedEarly?a("agentWorkspace.logStatus.earlyOmitted"):e.snapshotTruncated?a("agentWorkspace.logStatus.recentOnly"):e.truncated?a("agentWorkspace.logStatus.partiallyOmitted"):"",k=[O,e.lineCount?a("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 o.jsxs("section",{className:`aw-deploy-log is-${e.status}${d?"":" is-collapsed"}`,"aria-label":i,children:[o.jsxs("header",{children:[o.jsxs("div",{children:[o.jsx("strong",{children:n}),o.jsx("span",{children:k})]}),o.jsxs("div",{className:"aw-deploy-log-actions",children:[g&&o.jsx("button",{type:"button",onClick:()=>f(E=>!E),children:a(d?"common.collapse":"common.expand")}),g&&o.jsxs("button",{type:"button",onClick:()=>void C(),"aria-label":h?a("agentWorkspace.copiedLabel",{label:r}):a("agentWorkspace.copyLabel",{label:r}),title:h?a("agentWorkspace.copied"):a("agentWorkspace.copyLabel",{label:r}),children:[h?o.jsx(Fd,{"aria-hidden":!0}):o.jsx(pP,{"aria-hidden":!0}),o.jsx("span",{children:a(h?"agentWorkspace.copied":"agentWorkspace.copy")})]})]})]}),d&&(g?o.jsx("pre",{ref:c,children:y}):o.jsx("div",{className:"aw-deploy-log-empty",children:x}))]})}function Xqt({task:e}){var n;const{t}=_e("ui");return o.jsx(yFe,{log:e.buildLog,autoExpand:((n=e.buildLog)==null?void 0:n.status)!=="complete"&&(e.status==="running"||e.status==="error")&&bFe(e,t)===1,title:t("agentWorkspace.buildLog"),ariaLabel:t("agentWorkspace.buildLog"),copyLabel:t("agentWorkspace.buildLog"),defaultPendingMessage:t("agentWorkspace.waitingBuildLog")})}function Yqt({task:e}){var n;const{t}=_e("ui");return o.jsx(yFe,{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 Zqt({task:e,onReturnToEdit:t}){const{t:n}=_e("ui"),i=gFe(e,n),r=bFe(e,n),s=e.status==="success"?100:Math.max(6,Math.min(100,e.pct??6)),a=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 o.jsxs("section",{className:`aw-deploy-progress-card is-${e.status}`,"aria-live":"polite",children:[o.jsxs("div",{className:"aw-deploy-progress-head",children:[o.jsxs("div",{children:[o.jsx("span",{className:"aw-deploy-progress-icon","aria-hidden":!0,children:e.status==="running"&&e.statusUnconfirmed?o.jsx(V_,{}):e.status==="running"?o.jsx(Mi,{className:"spin"}):e.status==="success"?o.jsx(Uit,{}):e.status==="error"?o.jsx(V_,{}):o.jsx(hF,{})}),o.jsxs("div",{children:[o.jsx("h3",{children:a}),o.jsx("p",{children:e.runtimeName})]})]}),o.jsx("strong",{children:e.status==="running"&&!e.statusUnconfirmed?`${Math.round(s)}%`:e.label})]}),o.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:o.jsx("span",{style:{width:`${s}%`}})}),o.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,gr]=p.useState([]),[ir,Ve]=p.useState(!1),[kt,rn]=p.useState(""),[Nn,se]=p.useState(""),[xi,is]=p.useState(0),[$r,qn]=p.useState([]),[oi,Vi]=p.useState(!1),[Fr,ia]=p.useState(""),[Wa,Hr]=p.useState(0),[ko,Us]=p.useState(null),[to,js]=p.useState(1),[Qs,So]=p.useState(!1),[Ea,wi]=p.useState(""),[yi,Fl]=p.useState(0),[Eo,Li]=p.useState(!1),[fl,Uo]=p.useState(()=>new Set),[Ns,vc]=p.useState(!1),[ra,or]=p.useState(""),[Co,rs]=p.useState(""),[Ka,Qn]=p.useState(()=>new Set),zs=p.useRef(!1),vs=p.useRef(""),ss=p.useRef(null),Vs=p.useRef(0),qr=p.useRef(0),_i=p.useRef(0),[Qo,no]=p.useState(jqt),[gu,hl]=p.useState("");p.useEffect(()=>{e.length!==0&&no(pe=>pe.map((Ue,tt)=>tt===0&&Ue.agentIds.length===0?{...Ue,agentIds:e.slice(0,2).map(nt=>nt.id)}:Ue))},[e]);const Ca=p.useMemo(()=>{const pe=new Map;for(const Ue of e)Ue.runtimeId&&pe.set(Ue.runtimeId,Ue);return pe},[e]),zo=p.useMemo(()=>{var Ue;const pe=new Map;for(const tt of t){const nt=(Ue=tt.deploymentTarget)==null?void 0:Ue.runtimeId;if(!nt||!Ca.has(nt))continue;const kn=pe.get(nt);(!kn||tt.updatedAt>kn.updatedAt)&&pe.set(nt,tt)}return pe},[Ca,t]),Wr=p.useMemo(()=>{const pe=new Map;for(const Ue of f){if(!Ue.runtimeId)continue;const tt=pe.get(Ue.runtimeId);(!tt||Ue.startedAt>tt.startedAt)&&pe.set(Ue.runtimeId,Ue)}return pe},[f]),rd=p.useMemo(()=>{const pe=Le.trim().toLowerCase();return pe?e.filter(Ue=>{const tt=Ue.runtimeId?zo.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(pe)}):e},[e,Wr,Le,zo]),xs=p.useMemo(()=>{const pe=Le.trim().toLowerCase();return t.filter(Ue=>{var nt;const tt=(nt=Ue.deploymentTarget)==null?void 0:nt.runtimeId;return tt&&Ca.has(tt)?!1:pe?`${Ue.draft.name} ${Ue.draft.description}`.toLowerCase().includes(pe):!0})},[Ca,t,Le]),xc=p.useMemo(()=>t.filter(pe=>{var tt;const Ue=(tt=pe.deploymentTarget)==null?void 0:tt.runtimeId;return!Ue||!Ca.has(Ue)}).length,[Ca,t]),bu=p.useMemo(()=>{const pe=Le.trim().toLowerCase();return pe?Qo.filter(Ue=>Ue.name.toLowerCase().includes(pe)):Qo},[Qo,Le]),we=e.find(pe=>pe.id===I),ai=t.find(pe=>pe.id===K),Yi=h?f.find(pe=>pe.id===h):void 0,sa=we!=null&&we.runtimeId?zo.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)||"",Ga=(c&&(we!=null&&we.runtimeId)?$se:$se.filter(pe=>pe!=="usage")).map(pe=>({id:pe,label:_(`agentWorkspace.sections.${pe}`)})),Vo=JSON.stringify([(we==null?void 0:we.runtimeId)??"",(we==null?void 0:we.region)??"cn-beijing",Zi,to]),os=(ko==null?void 0:ko.requestKey)===Vo?ko.value:null,oa=`${(we==null?void 0:we.region)??"cn-beijing"}:${(we==null?void 0:we.runtimeId)??""}`,Bl=(Ce==null?void 0:Ce.requestKey)===oa?Ce.value:"",br=(X==null?void 0:X.requestKey)===oa?X:null,Ho=!!((ei=br==null?void 0:br.apiApps)!=null&&ei.length),Xa=!!(br!=null&&br.a2a),aa=((nh=br==null?void 0:br.apiApps)==null?void 0:nh[0])??Zi,Mn=(W==null?void 0:W.endpoint)??"",Ya=Pqt(((R1=br==null?void 0:br.a2a)==null?void 0:R1.endpoint)??"",Mn),la=(we==null?void 0:we.runtimeApp)||"",Za=JSON.stringify([(we==null?void 0:we.runtimeId)??"",(we==null?void 0:we.region)??"",(we==null?void 0:we.currentVersion)??null,la]),je=l&&(we!=null&&we.runtimeId)&&we.region&&ln===0?Z$({runtimeId:we.runtimeId,region:we.region,appName:la,currentVersion:we.currentVersion}):null,Je=(he==null?void 0:he.requestKey)===Za?he.value:je,Mt=Je!=null&&Je.reason?Uu(Je.reason,D.resolvedLanguage||D.language):"",Tn=(Je==null?void 0:Je.warnings.filter(pe=>Uu(pe,D.resolvedLanguage||D.language)))??[];p.useEffect(()=>{const pe=Vs.current+1;Vs.current=pe,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?Z$({runtimeId:Ue,region:tt,appName:la,currentVersion:we==null?void 0:we.currentVersion}):null;if(nt){xe({requestKey:Za,value:nt}),qe(!1);return}const kn=new AbortController;let ct,Oi=0;const so=60;qe(!0);const ki=Hs=>{GI({runtimeId:Ue,region:tt,appName:la,currentVersion:we==null?void 0:we.currentVersion,signal:kn.signal,force:Hs&&ln>0}).then(bl=>{var w0,IT;if(pe!==Vs.current)return;const Mp=bl.recoveryStatus==="preparing";if(bl.runtime.runtimeId!==Ue||bl.runtime.region!==tt||!Mp&&la&&((w0=bl.agent)==null?void 0:w0.appName)!==la||bl.canUpdate&&!((IT=bl.agent)!=null&&IT.appName)){At(_("agentWorkspace.errors.updateCapabilityMismatch"));return}if(xe({requestKey:Za,value:bl}),qe(!1),!!Mp){if(Oi+=1,Oi>=so){At(_("agentWorkspace.errors.updateConfigRestoring"));return}ct=window.setTimeout(()=>ki(!1),1e3)}}).catch(()=>{pe!==Vs.current||kn.signal.aborted||At(_("agentWorkspace.errors.checkUpdateCapability"))}).finally(()=>{pe===Vs.current&&!kn.signal.aborted&&qe(!1)})};return ki(!0),()=>{kn.abort(),ct!=null&&window.clearTimeout(ct)}},[l,la,ln,we==null?void 0:we.currentVersion,we==null?void 0:we.region,we==null?void 0:we.runtimeId,Za]);const on=p.useMemo(()=>{const pe=new Map(e.map((tt,nt)=>[tt.id,nt])),Ue=new Map(n.map((tt,nt)=>[tt,nt]));return[...rd].sort((tt,nt)=>{const kn=tt.runtimeId?Wr.get(tt.runtimeId):void 0,ct=nt.runtimeId?Wr.get(nt.runtimeId):void 0,Oi=(kn==null?void 0:kn.status)==="running"?kn.startedAt:0,so=(ct==null?void 0:ct.status)==="running"?ct.startedAt:0;if(Oi!==so)return so-Oi;const ki=Ue.get(tt.id),Hs=Ue.get(nt.id);return ki!=null&&Hs!=null?ki-Hs:ki!=null?-1:Hs!=null?1:(pe.get(tt.id)??0)-(pe.get(nt.id)??0)})},[n,e,rd,Wr]),yn=(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)||((x0=Yi==null?void 0:Yi.agentDraft)==null?void 0:x0.name)||_("agentWorkspace.noAgentSelected"),On=Qo.find(pe=>pe.id===gu),ae=on.filter(pe=>pe.canDelete===!0),De=on.filter(pe=>vn.has(pe.id)&&pe.canDelete===!0),et=xs.filter(pe=>mt.has(pe.id)),ht=ae.length+xs.length,Yt=De.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 pe=(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")?Pz(Je.agent,pe,Je.runtime.configuredEnvKeys):Fqt(gi,Zi||(we==null?void 0:we.label)||"agent",pe)},[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=((RT=gi==null?void 0:gi.draft)==null?void 0:RT.harnessSidecar)??Axt(W==null?void 0:W.envs),qo=Kr?e1.filter(pe=>Kr.componentOverrides[pe]):[],pl=ai?a?"":_("agentWorkspace.errors.noCreatePermission"):l?we!=null&&we.runtimeId?we.region?Ae?_("agentWorkspace.errors.checkingUpdateConfig"):Me||(Je?Je.recoveryStatus!=="complete"&&Je.recoveryStatus!=="draft-only"?Mt||_("agentWorkspace.errors.originalConfigUnavailable"):Je.canUpdate?(yu=Je.agent)!=null&&yu.appName?"":_("agentWorkspace.errors.agentInfoMissing"):Mt||_("agentWorkspace.errors.updateUnsupported"):_("agentWorkspace.errors.updateCapabilityPending")):_("agentWorkspace.errors.runtimeRegionMissing"):_("agentWorkspace.errors.cloudOnlyUpdate"):_("agentWorkspace.errors.noManagePermission"),ml="aw-update-disabled-reason",Jf=p.useMemo(()=>{if(gi)return gi.tools;const pe=(un.builtinTools??[]).map(Ue=>{var tt;return((tt=Jw.find(nt=>nt.id===Ue))==null?void 0:tt.label)??Ue});return Array.from(new Set([...un.tools,...pe,...(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(pe=>pe.name):null:Array.from(new Set([...(un.selectedSkills??[]).map(pe=>pe.name),...un.skills].filter(Boolean))),[un,gi]),qi=p.useMemo(()=>{if(Yi)return Yi;if(ai){const pe=f.filter(Ue=>Ue.draftId===ai.id).sort((Ue,tt)=>tt.startedAt-Ue.startedAt)[0];return pe||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(pe=>!!we.runtimeId&&pe.runtimeId===we.runtimeId||pe.agentName===we.label).sort((pe,Ue)=>Ue.startedAt-pe.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(pe=>pe.id===qi.draftId)??(qi.agentDraft?{id:qi.draftId,draft:qi.agentDraft,updatedAt:qi.startedAt}:void 0):void 0,pt=p.useMemo(()=>qqt(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)??yn}:${pt}`;p.useEffect(()=>{L==="usage"&&!c&&F("basic")},[c,L]),p.useEffect(()=>{if(!h)return;const pe=f.find(tt=>tt.id===h),Ue=pe!=null&&pe.runtimeId?Ca.get(pe.runtimeId):void 0;if(Ue){B(""),z(Ue.id),F("basic");return}z(""),B(""),F("basic")},[Ca,f,h]),p.useEffect(()=>{if(!m){vs.current="";return}const pe=`${m}:${g}:${b}:${c}`;vs.current!==pe&&e.some(Ue=>Ue.id===m)&&(vs.current=pe,B(""),z(m),F(g==="usage"&&!c?"basic":g),g==="evaluations"&&(st(b),ft("")))},[e,c,m,g,b]),p.useEffect(()=>{for(const pe of on.slice(0,8)){if(!pe.runtimeId)continue;const Ue=pe.region??"cn-beijing";eTe(pe.runtimeId,Ue),ZEe(pe.runtimeId,Ue,pe.runtimeApp??"")}},[on]),p.useEffect(()=>{let pe=!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?YEe(Ue,tt,nt):null;if(lt(kn),yt(""),vt(!1),Ct(!!kn||!y||!Ue),!(!y||!Ue))return NU(Ue,tt,nt,{force:!0}).then(ct=>{pe||lt(ct)}).catch(ct=>{!pe&&!kn&<(null),pe||(vt(ct instanceof ho&&ct.unsupported),yt(_("agentWorkspace.errors.loadAgentInfo")))}).finally(()=>{pe||Ct(!0)}),()=>{pe=!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 pe=!1;const Ue=(we==null?void 0:we.runtimeId)??"",tt=(we==null?void 0:we.region)??"cn-beijing";if(qn([]),ia(""),L!=="optimizations"||!Ue){Vi(!1);return}if(y&&!Zi){Vi(!Ot);return}return Vi(!0),UEe({runtimeId:Ue,region:tt,appName:Zi}).then(nt=>{pe||qn(nt.groups)}).catch(()=>{pe||ia(_("agentWorkspace.errors.loadOptimizations"))}).finally(()=>{pe||Vi(!1)}),()=>{pe=!0}},[Ot,y,Wa,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 pe=_i.current+1;_i.current=pe;const Ue=(we==null?void 0:we.runtimeId)??"",tt=(we==null?void 0:we.region)??"cn-beijing",nt=Zi;if(wi(""),L!=="usage"||!Ue){So(!1);return}if(!nt){So(y&&!Ot);return}const kn=new AbortController;return So(!0),BCe({runtimeId:Ue,region:tt,appName:nt,page:to,pageSize:Rqt,signal:kn.signal}).then(ct=>{if(pe===_i.current){if(ct.runtimeId!==Ue||ct.appName!==nt||ct.page!==to){wi(_("agentWorkspace.errors.usageMismatch"));return}Us({requestKey:Vo,value:ct})}}).catch(()=>{pe!==_i.current||kn.signal.aborted||wi(_("agentWorkspace.errors.loadUsage"))}).finally(()=>{pe===_i.current&&So(!1)}),()=>{kn.abort()}},[to,yi,Vo,Ot,y,L,Zi,we==null?void 0:we.region,we==null?void 0:we.runtimeId]),p.useEffect(()=>{qr.current+=1,le(null),re(!1),Pe(!1),Qe(""),de("api-server")},[oa,L]);function Gr(){qr.current+=1,le(null),re(!1),Pe(!1),Qe("")}function Or(pe){pe!==te&&(Gr(),de(pe))}async function Tr(){if(fe){Gr();return}const pe=(we==null?void 0:we.runtimeId)??"",Ue=(we==null?void 0:we.region)??"cn-beijing";if(!pe)return;const tt=qr.current+1;qr.current=tt,Pe(!0),Qe("");try{const nt=await XCe(pe,Ue);if(tt!==qr.current)return;le({requestKey:oa,value:nt}),re(!0)}catch(nt){if(tt!==qr.current)return;le(null),re(!1),Qe(nt instanceof Error?nt.message:_("agentWorkspace.errors.loadApiKey"))}finally{tt===qr.current&&Pe(!1)}}p.useEffect(()=>{let pe=!1;const Ue=(we==null?void 0:we.runtimeId)??"",tt=(we==null?void 0:we.region)??"cn-beijing",nt=Ue?JCe(Ue,tt):null;if(H(nt),Nt(""),!!Ue)return $U(Ue,tt,{force:!0}).then(kn=>{pe||H(kn)}).catch(()=>{!pe&&!nt&&H(null),pe||Nt(_("agentWorkspace.errors.loadRuntimeDetails"))}),()=>{pe=!0}},[ln,we==null?void 0:we.currentVersion,we==null?void 0:we.region,we==null?void 0:we.runtimeId]),p.useEffect(()=>{let pe=!1;const Ue=(we==null?void 0:we.runtimeId)??"";if(Se(""),L!=="versions"||!Ue){ye(!1),Ue||Ne(null);return}return ye(!0),F_(Ue).then(tt=>{pe||Ne(tt)}).catch(()=>{pe||(Ne(null),Se(_("agentWorkspace.errors.loadGithubVersions")))}).finally(()=>{pe||ye(!1)}),()=>{pe=!0}},[L,we==null?void 0:we.currentVersion,we==null?void 0:we.runtimeId]),p.useEffect(()=>{let pe=!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=Kx(Ue,tt,{retryProbe:!0}).catch(ct=>{if(ct instanceof ho&&ct.unsupported)return null;throw ct});return Promise.all([kn,GCe(Ue,tt,{retryProbe:!0})]).then(([ct,Oi])=>{pe||ie({requestKey:nt,apiApps:ct,a2a:Oi})}).catch(()=>{pe||(ie(null),Ee(_("agentWorkspace.errors.probeIntegration")))}).finally(()=>{pe||Z(!1)}),()=>{pe=!0}},[Y,L,we==null?void 0:we.currentVersion,we==null?void 0:we.region,we==null?void 0:we.runtimeId]),p.useEffect(()=>{let pe=!1;const Ue=(we==null?void 0:we.runtimeId)??"",tt=(we==null?void 0:we.region)??"cn-beijing",nt=Ue&&Zi?QEe({runtimeId:Ue,region:tt,appName:Zi,pageSize:100}):null;if(di(nt?zse(nt,_):[]),gr((nt==null?void 0:nt.sets)??[]),rn(""),se((nt==null?void 0:nt.unsupportedMessage)??""),L!=="evaluations"||!Ue){Ve(!1);return}if(y&&!Zi){Ve(!Ot);return}return Ve(!nt),qI({runtimeId:Ue,region:tt,appName:Zi,pageSize:100},{force:!0}).then(kn=>{pe||(gr(kn.sets),di(zse(kn,_)),se(kn.unsupportedMessage??""))}).catch(()=>{pe||(rn(_("agentWorkspace.errors.loadEvaluations")),se(""))}).finally(()=>{pe||Ve(!1)}),()=>{pe=!0}},[Ot,y,xi,L,Zi,gi==null?void 0:gi.appName,we==null?void 0:we.region,we==null?void 0:we.runtimeId,_]);async function kr(pe){const Ue=(we==null?void 0:we.runtimeId)??"",tt=pe.commitSha??"";if(!(!Ue||!tt||Ke)){it(tt),Se("");try{await NCe({runtimeId:Ue,targetCommitSha:tt});const nt=await F_(Ue);Ne(nt)}catch(nt){Se(nt instanceof Error?nt.message:_("agentWorkspace.errors.rollbackVersion"))}finally{it("")}}}p.useEffect(()=>{const pe=new Set(Fn.map(Ue=>Ue.id));Uo(Ue=>{const tt=new Set([...Ue].filter(nt=>pe.has(nt)));return tt.size===Ue.size?Ue:tt}),Qn(Ue=>{const tt=new Set([...Ue].filter(nt=>pe.has(nt)));return tt.size===Ue.size?Ue:tt}),Co&&!pe.has(Co)&&rs("")},[Fn,Co]),p.useEffect(()=>{Li(!1),Uo(new Set),Qn(new Set),or(""),rs("")},[we==null?void 0:we.runtimeId]),p.useEffect(()=>{const pe=new Set(on.filter(Ue=>Ue.canDelete===!0).map(Ue=>Ue.id));Ye(Ue=>{const tt=new Set([...Ue].filter(nt=>pe.has(nt)));return tt.size===Ue.size?Ue:tt})},[on]),p.useEffect(()=>{const pe=new Set(xs.map(Ue=>Ue.id));_n(Ue=>{const tt=new Set([...Ue].filter(nt=>pe.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:_(v.kind==="good"?"agentWorkspace.goodCase":"agentWorkspace.badCase")},[v,we==null?void 0:we.runtimeId,Zi,_]),gl=p.useMemo(()=>_qt(_),[_]),io=p.useMemo(()=>we!=null&&we.runtimeId?Xr?[Xr,...Fn.filter(pe=>pe.id!==Xr.id&&(!pe.messageId||pe.messageId!==Xr.messageId))]:Fn:gl,[gl,Fn,Xr,we==null?void 0:we.runtimeId]),Ar=io.filter(pe=>{if(pe.kind!==gt||(pe.source==="auto"?"auto":"user")!==Ht)return!1;const tt=xt.trim().toLowerCase();return tt?[pe.input,pe.output,pe.referenceOutput,pe.comment,pe.tag??"",pe.sessionId,pe.messageId,pe.userId,pe.evaluationSetName].join(" ").toLowerCase().includes(tt):!0}),ws=Ar.filter(pe=>fl.has(pe.id)),ro=!!(we!=null&&we.runtimeId),Kd=pe=>{st(pe),ft(""),or("");const Ue=io.find(tt=>tt.kind===pe);rs((Ue==null?void 0:Ue.id)??""),window.setTimeout(()=>{var tt;(tt=ss.current)==null||tt.scrollIntoView({behavior:"smooth",block:"start"})},0)},Qg=pe=>{or(""),Uo(Ue=>{const tt=new Set(Ue);return tt.has(pe.id)?tt.delete(pe.id):tt.add(pe.id),tt})},m0=()=>{or(""),Uo(new Set(Ar.map(pe=>pe.id)))},g0=()=>{or(""),Uo(new Set),Li(!1)},b0=pe=>{Qn(Ue=>{const tt=new Set(Ue);return tt.has(pe)?tt.delete(pe):tt.add(pe),tt})},y0=pe=>{rs(pe.id),or(""),!(!pe.sessionId||!pe.messageId)&&(N==null||N(pe))},zg=async pe=>{if(!(we!=null&&we.runtimeId)||!Zi||Ns||pe.length===0)return;const Ue=pe.length===1?_("agentWorkspace.deleteOneCaseConfirm"):_("agentWorkspace.deleteCasesConfirm",{count:pe.length});if(!window.confirm(Ue))return;const tt=pe.map(kn=>kn.id),nt=new Set(tt);vc(!0),or("");try{await HEe({runtimeId:we.runtimeId,region:we.region??"cn-beijing",appName:Zi,itemIds:tt});const kn=new Map;for(const ct of pe)kn.set(ct.kind,(kn.get(ct.kind)??0)+1);di(ct=>ct.filter(Oi=>!nt.has(Oi.id))),gr(ct=>ct.map(Oi=>({...Oi,itemCount:Math.max(0,Oi.itemCount-(kn.get(Oi.kind)??0))}))),Uo(ct=>new Set([...ct].filter(Oi=>!nt.has(Oi)))),Qn(ct=>new Set([...ct].filter(Oi=>!nt.has(Oi)))),Co&&nt.has(Co)&&rs(""),pe.length>1&&Li(!1),A==null||A(pe)}catch(kn){or(kn instanceof Error?kn.message:String(kn))}finally{vc(!1)}},$i=pe=>{no(Ue=>Ue.map(tt=>tt.id===pe.id?pe:tt))},wc=()=>{const pe=new Set(e.map(nt=>nt.id)),Ue=n.filter(nt=>pe.has(nt)),tt=new Set(Ue);return[...Ue,...e.filter(nt=>!tt.has(nt.id)).map(nt=>nt.id)]},Vg=(pe,Ue,tt)=>{if(!O||pe===Ue)return;const nt=wc().filter(Oi=>Oi!==pe),kn=nt.indexOf(Ue),ct=kn<0?nt.length:tt==="after"?kn+1:kn;nt.splice(ct,0,pe),O(nt)},eh=(pe,Ue)=>{if(!hn||hn===Ue)return;const tt=pe.currentTarget.getBoundingClientRect();St(Ue),Rt(pe.clientY>tt.top+tt.height/2?"after":"before")},Pp=(pe,Ue)=>{if(!O)return;const tt=wc(),nt=tt.indexOf(pe),kn=Math.max(0,Math.min(tt.length-1,nt+Ue));nt<0||nt===kn||(tt.splice(nt,1),tt.splice(kn,0,pe),O(tt))},Dp=pe=>{pe.canDelete===!0&&(Hn(""),Ye(Ue=>{const tt=new Set(Ue);return tt.has(pe.id)?tt.delete(pe.id):tt.add(pe.id),tt}))},th=pe=>{Hn(""),_n(Ue=>{const tt=new Set(Ue);return tt.has(pe.id)?tt.delete(pe.id):tt.add(pe.id),tt})},Gd=()=>{Hn(""),Ye(new Set(ae.map(pe=>pe.id))),_n(new Set(xs.map(pe=>pe.id)))},sd=()=>{Hn(""),Ye(new Set),_n(new Set),ot(!1)},Hg=()=>{if(Yt===0||Vt)return;const pe=De.length,Ue=et.length;Hn(""),vi({kind:"selection",title:_(pe===1&&Ue===0?"agentWorkspace.deleteAgentTitle":pe===0&&Ue===1?"myAgents.deleteDraftTitle":"agentWorkspace.deleteSelectedTitle"),description:pe===1&&Ue===0?_("agentWorkspace.deleteAgentDescription",{name:De[0].label}):pe===0&&Ue===1?_("agentWorkspace.deleteDraftDescription",{name:et[0].draft.name||_("agentSelector.unnamedAgent")}):_("agentWorkspace.deleteSelectionDescription",{count:Yt,warning:pe>0?_("agentWorkspace.runtimeDeletionWarning",{count:pe}):_("agentWorkspace.draftDeletionWarning")}),confirmLabel:_(pe===0&&Ue===1?"myAgents.deleteDraft":"agentWorkspace.deleteSelected"),agents:De,drafts:et})},qg=async()=>{if(!(!En||Vt)){Ai(!0),Hn("");try{if(En.kind==="selection"){const{agents:pe,drafts:Ue}=En;if(pe.length>0){if(!S)throw new Error(_("agentWorkspace.errors.deleteDeployedUnsupported"));await S(pe)}Ue.length>0&&(k==null||k(Ue)),Ye(new Set),_n(new Set),ot(!1),pe.some(tt=>tt.id===I)&&z(""),Ue.some(tt=>tt.id===K)&&B("")}else if(En.kind==="agent"){if(!S)throw new Error(_("agentWorkspace.errors.deleteDeployedUnsupported"));await S([En.agent]),I===En.agent.id&&z("")}else{if(!k)throw new Error(_("agentWorkspace.errors.deleteDraftUnsupported"));k([En.draft]),K===En.draft.id&&B("")}vi(null)}catch(pe){Hn(pe instanceof Error?pe.message:String(pe))}finally{Ai(!1)}}},Lt=pe=>{!S||pe.canDelete!==!0||Vt||(Hn(""),vi({kind:"agent",title:_("agentWorkspace.deleteAgentTitle"),description:_("agentWorkspace.deleteAgentDescription",{name:pe.label}),confirmLabel:_("agentWorkspace.deleteAgent"),agent:pe}))},_r=pe=>{if(!k||Vt)return;const Ue=pe.draft.name||_("agentSelector.unnamedAgent");Hn(""),vi({kind:"draft",title:_("myAgents.deleteDraftTitle"),description:_("agentWorkspace.deleteDraftDescription",{name:Ue}),confirmLabel:_("myAgents.deleteDraft"),draft:pe})},od=()=>{const pe=`eval-${Date.now()}`,Ue={id:pe,name:_("agentWorkspace.newEvaluationGroupName",{count:Qo.length+1}),agentIds:[],caseSet:"核心回归集",evaluator:"综合质量评估器",metrics:["回答质量"],concurrency:"4",history:[]};no(tt=>[Ue,...tt]),hl(pe)},v0=pe=>{$i({...pe,history:[{id:`run-${Date.now()}`,createdAt:_("agentWorkspace.evaluationDefaults.justNow"),score:86+pe.history.length%7,status:"completed"},...pe.history]})};return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:`aw-root${y?" is-detail-only":""}`,children:[o.jsxs("nav",{className:"aw-view-tabs","aria-label":_("agentWorkspace.workspace"),children:[o.jsx("button",{type:"button",className:M==="library"?"is-active":"","aria-pressed":M==="library",onClick:()=>{P("library"),We("")},children:_("agentWorkspace.library")}),o.jsx("button",{type:"button",className:M==="evaluation"?"is-active":"","aria-pressed":M==="evaluation",onClick:()=>{P("evaluation"),We("")},children:_("agentWorkspace.evaluation")})]}),o.jsxs("div",{className:"aw-workspace-frame",children:[o.jsxs("div",{className:"aw-workspace","aria-hidden":M==="evaluation"||void 0,ref:pe=>{pe==null||pe.toggleAttribute("inert",M==="evaluation")},children:[o.jsxs("aside",{className:"aw-sidebar","aria-label":_(M==="library"?"agentWorkspace.agentList":"agentWorkspace.evaluationGroupList"),children:[o.jsxs("label",{className:"aw-search",children:[o.jsx(IN,{"aria-hidden":!0}),o.jsx("input",{value:Le,onChange:pe=>We(pe.currentTarget.value),placeholder:_(M==="library"?"myAgents.searchAgents":"agentWorkspace.searchEvaluationGroups"),"aria-label":_(M==="library"?"myAgents.searchAgents":"agentWorkspace.searchEvaluationGroups")})]}),o.jsxs("button",{type:"button",className:"aw-create-card",onClick:M==="library"?j:od,disabled:M==="library"&&!a,children:[o.jsx(_l,{"aria-hidden":!0}),o.jsx("span",{children:_(M==="library"?"agentWorkspace.newAgent":"agentWorkspace.newEvaluationGroup")})]}),M==="library"&&(S||k)&&o.jsx("div",{className:`aw-selection-toolbar${$e?" is-active":""}`,children:$e?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"aw-selection-count",children:_("agentWorkspace.selectedCount",{count:Yt})}),o.jsx("button",{type:"button",onClick:Gd,disabled:ht===0||Vt,children:_("agentWorkspace.selectAll")}),o.jsx("button",{type:"button",className:"aw-selection-danger",onClick:()=>void Hg(),disabled:Yt===0||Vt,children:_(Vt?"common.deleting":"agentWorkspace.deleteSelected")}),o.jsx("button",{type:"button",onClick:sd,disabled:Vt,children:_("common.cancel")})]}):o.jsx("button",{type:"button",onClick:()=>{Hn(""),ot(!0)},disabled:ht===0,children:_("common.select")})}),M==="library"&&jn&&o.jsx("div",{className:"aw-delete-error",role:"alert",children:jn}),o.jsx("div",{className:"aw-agent-list",children:M==="evaluation"?bu.length===0?o.jsx("div",{className:"aw-list-empty",children:_("agentWorkspace.noMatchingEvaluationGroups")}):bu.map(pe=>o.jsxs("button",{type:"button",className:`aw-agent-item${pe.id===gu?" is-active":""}`,onClick:()=>hl(pe.id),children:[o.jsxs("span",{className:"aw-agent-copy aw-eval-group-copy",children:[o.jsx("strong",{children:pk(pe.name,_)}),o.jsx("small",{children:_("agentWorkspace.groupStats",{agents:pe.agentIds.length,runs:pe.history.length})})]}),o.jsx(Hk,{"aria-hidden":!0})]},pe.id)):u&&on.length===0&&xs.length===0?o.jsx("div",{className:"aw-list-empty",children:_("agentWorkspace.loadingCloudAgents")}):d&&on.length===0&&xs.length===0?o.jsxs("div",{className:"aw-list-empty aw-list-error",children:[o.jsx("span",{children:d}),w&&o.jsx("button",{type:"button",onClick:w,children:_("common.retry")})]}):on.length===0&&xs.length===0?o.jsx("div",{className:"aw-list-empty",children:_("myAgents.noMatchingAgents")}):o.jsxs(o.Fragment,{children:[xs.map(pe=>{const tt=f.filter(kn=>kn.draftId===pe.id).sort((kn,ct)=>ct.startedAt-kn.startedAt)[0]??f.filter(kn=>{var ct,Oi;return((ct=kn.agentDraft)==null?void 0:ct.name)===pe.draft.name||kn.agentName===pe.draft.name||!!((Oi=pe.deploymentTarget)!=null&&Oi.runtimeId)&&kn.runtimeId===pe.deploymentTarget.runtimeId}).sort((kn,ct)=>ct.startedAt-kn.startedAt)[0],nt=mt.has(pe.id);return o.jsxs("button",{type:"button",className:["aw-agent-item",$e?"is-selecting":"",nt?"is-selected-for-delete":"",pe.id===K?"is-active":""].filter(Boolean).join(" "),"aria-pressed":$e?nt:void 0,onClick:()=>{if($e){th(pe);return}z(""),B(pe.id),F("basic")},children:[$e&&o.jsx("span",{className:`aw-select-marker${nt?" is-checked":""}`,"aria-hidden":"true"}),o.jsxs("span",{className:"aw-agent-copy",children:[o.jsxs("span",{className:"aw-agent-name-row",children:[o.jsx("strong",{children:pe.draft.name||_("agentSelector.unnamedAgent")}),o.jsx("span",{className:`aw-draft-badge${(tt==null?void 0:tt.status)==="running"?" is-deploying":""}`,children:(tt==null?void 0:tt.status)==="running"?_("myAgents.deploying"):_("myAgents.draft")})]}),o.jsx("small",{children:pe.deploymentTarget?_("agentWorkspace.updatePending"):_("agentWorkspace.notPublished")})]}),o.jsx(Hk,{"aria-hidden":!0})]},pe.id)}),on.map(pe=>{const Ue=pe.runtimeId?Wr.get(pe.runtimeId):void 0,tt=pe.runtimeId?zo.get(pe.runtimeId):void 0,nt=vn.has(pe.id),kn=pe.canDelete===!0,ct=(Ue==null?void 0:Ue.status)==="running"?{label:_("myAgents.deploying"),className:" is-deploying"}:(Ue==null?void 0:Ue.status)==="error"?{label:_("agentWorkspace.failed"),className:" is-error"}:(Ue==null?void 0:Ue.status)==="cancelled"?{label:_("agentWorkspace.cancelled"),className:" is-muted"}:tt?{label:_("agentWorkspace.updatePending"),className:""}:null,Oi=(Ue==null?void 0:Ue.status)==="running"?_("agentWorkspace.updatingDeployment"):tt?_("agentWorkspace.updatePending"):pe.remote?pe.host||_("agentWorkspace.remoteAgent"):_("agentWorkspace.localAgent"),so=["aw-agent-item","aw-agent-item--sortable",pe.id===I?"is-active":"",$e?"is-selecting":"",nt?"is-selected-for-delete":"",$e&&!kn?"is-selection-disabled":"",pe.id===hn?"is-dragging":"",pe.id===bt&&pe.id!==hn?`is-drop-target is-drop-${dn}`:""].filter(Boolean).join(" ");return o.jsxs("button",{type:"button",draggable:!!O&&!$e,className:so,"aria-pressed":$e?nt:void 0,"aria-keyshortcuts":O?"Alt+ArrowUp Alt+ArrowDown":void 0,onDragStart:ki=>{O&&(zs.current=!0,Ge(pe.id),ki.dataTransfer.effectAllowed="move",ki.dataTransfer.setData("text/plain",pe.id))},onDragEnter:ki=>{eh(ki,pe.id)},onDragOver:ki=>{!hn||hn===pe.id||(ki.preventDefault(),ki.dataTransfer.dropEffect="move",eh(ki,pe.id))},onDragLeave:ki=>{const Hs=ki.relatedTarget;Hs instanceof Node&&ki.currentTarget.contains(Hs)||bt===pe.id&&St("")},onDrop:ki=>{ki.preventDefault();const Hs=ki.dataTransfer.getData("text/plain")||hn;Vg(Hs,pe.id,dn),Ge(""),St(""),Rt("before")},onDragEnd:()=>{Ge(""),St(""),Rt("before"),window.setTimeout(()=>{zs.current=!1},0)},onKeyDown:ki=>{ki.altKey&&(ki.key==="ArrowUp"?(ki.preventDefault(),Pp(pe.id,-1)):ki.key==="ArrowDown"&&(ki.preventDefault(),Pp(pe.id,1)))},onClick:ki=>{if($e){ki.preventDefault(),Dp(pe);return}if(zs.current){ki.preventDefault(),zs.current=!1;return}B(""),z(pe.id),F("basic"),C(pe.id)},children:[$e&&o.jsx("span",{className:`aw-select-marker${nt?" is-checked":""}`,"aria-hidden":"true"}),o.jsxs("span",{className:"aw-agent-copy",children:[o.jsxs("span",{className:"aw-agent-name-row",children:[o.jsx("strong",{children:pe.label}),pe.currentVersion!=null&&o.jsxs("span",{className:"aw-version-badge",children:["v",pe.currentVersion]}),ct&&o.jsx("span",{className:`aw-draft-badge${ct.className}`,children:ct.label})]}),o.jsx("small",{children:Oi})]}),o.jsx(Hk,{"aria-hidden":!0})]},pe.id)})]})}),o.jsx("div",{className:"aw-list-count",children:_("agentWorkspace.totalCount",{count:M==="library"?e.length+xc:Qo.length})})]}),M==="evaluation"&&On?o.jsx(iWt,{group:On,agents:e,cases:io,onChange:$i,onRun:v0}):M==="evaluation"?o.jsx("main",{className:"aw-main aw-empty-selection",children:o.jsx("p",{children:_("agentWorkspace.noEvaluationGroupSelected")})}):!we&&!ai&&!Yi?o.jsx("main",{className:"aw-main aw-empty-selection",children:o.jsx("p",{children:_("agentWorkspace.noAgentSelected")})}):o.jsxs("main",{className:`aw-main${ee?" is-deploying":""}${y?" resource-page":""}`,children:[we&&!gi&&s&&o.jsx("div",{className:"aw-detail-loading",role:"status","aria-live":"polite",children:o.jsxs("div",{className:"aw-detail-loading-card",children:[o.jsx("span",{className:"loading-gap-spinner","aria-hidden":"true"}),o.jsxs("span",{children:[o.jsx("strong",{children:_("agentWorkspace.loadingAgent")}),o.jsx("small",{children:_("agentWorkspace.loadingAgentDescription")})]})]})}),L==="integrations"&&Q&&o.jsx("div",{className:"aw-detail-loading",role:"status","aria-live":"polite",children:o.jsxs("div",{className:"aw-detail-loading-card",children:[o.jsx("span",{className:"loading-gap-spinner","aria-hidden":"true"}),o.jsxs("span",{children:[o.jsx("strong",{children:_("agentWorkspace.probingIntegration")}),o.jsx("small",{children:_("agentWorkspace.probingIntegrationDescription")})]})]})}),o.jsx(GC,{className:"aw-agent-detail",title:yn,description:un.description||_(s||y&&!Ot?"agentWorkspace.loadingAgentInfo":"common.noDescription"),identitySeed:yn,backLabel:_("agentWorkspace.backToAgentList"),onBack:y?x:void 0,meta:o.jsxs(o.Fragment,{children:[qt!=null&&o.jsxs("span",{className:"aw-agent-meta",children:["v",qt]}),ai&&o.jsx("span",{className:"aw-agent-meta",children:_("myAgents.draft")}),sa&&o.jsx("span",{className:"aw-agent-meta",children:_("agentWorkspace.updatePending")}),!we&&!ai&&Yi&&o.jsx("span",{className:"aw-agent-meta",children:Yi.label})]}),actionsClassName:"aw-head-actions",bodyClassName:"aw-agent-detail__body",actions:ai||sa||we!=null&&we.canDelete?o.jsxs(o.Fragment,{children:[(ai||sa)&&o.jsxs(Dt,{type:"button",color:"danger",variant:"soft",size:"lg",pill:!1,onClick:()=>{const pe=ai??sa;pe&&_r(pe)},disabled:Vt,"aria-label":_("myAgents.deleteDraft"),title:_("myAgents.deleteDraft"),children:[o.jsx(ag,{"aria-hidden":!0}),o.jsx("span",{children:_("myAgents.deleteDraft")})]}),(we==null?void 0:we.canDelete)&&o.jsxs(Dt,{type:"button",color:"danger",variant:"soft",size:"lg",pill:!1,onClick:()=>void Lt(we),disabled:Vt,"aria-label":_("agentWorkspace.deleteAgent"),title:_("agentWorkspace.deleteAgent"),children:[o.jsx(ag,{"aria-hidden":!0}),o.jsx("span",{children:_(Vt?"common.deleting":"agentWorkspace.deleteAgent")})]})]}):void 0,sections:Ga.map(pe=>{var Ue,tt,nt,kn;return{key:pe.id,label:pe.label,disabled:ee,content:pe.id===L?o.jsxs(o.Fragment,{children:[qi&&fi&&o.jsx("div",{className:`aw-detail-deployment${ee?" is-running":""}`,children:o.jsx(Zqt,{task:qi,onReturnToEdit:Fe&&R?()=>R(Fe):void 0})}),o.jsxs("div",{className:"aw-content",children:[L==="basic"&&o.jsxs("div",{className:"aw-basic-stack",children:[Ie&&o.jsx(Ty,{className:"aw-detail-fetch-alert",color:"warning",variant:"soft",title:_("agentWorkspace.partialInfoUnavailable"),description:_("agentWorkspace.upgradeRuntimeForDetails")}),(dt&&!Ie||jt)&&o.jsx(Ty,{className:"aw-detail-fetch-alert",color:"danger",variant:"soft",title:_("agentWorkspace.detailLoadFailed"),description:_("agentWorkspace.detailLoadFailedDescription"),actions:o.jsx(Dt,{type:"button",color:"danger",variant:"soft",size:"sm",pill:!1,onClick:()=>He(ct=>ct+1),children:_("common.retry")})}),we&&Je&&!Je.canUpdate&&o.jsxs("div",{className:"aw-update-recovery-notice",role:Je.recoveryStatus==="preparing"?"status":"alert",children:[o.jsx("strong",{children:Je.recoveryStatus==="preparing"?_("agentWorkspace.restoringUpdateConfig"):_("agentWorkspace.updateConfigUnavailable")}),Mt&&o.jsx("span",{children:Mt}),Tn.map(ct=>o.jsx("span",{children:ct},ct))]}),o.jsxs("section",{className:"aw-deployment-panel aw-settings-card",children:[o.jsx("div",{className:"aw-section-head",children:o.jsxs("div",{children:[o.jsx("h3",{children:_("agentWorkspace.deploymentConfig")}),o.jsx("p",{children:_("agentWorkspace.deploymentConfigDescription")})]})}),o.jsxs("dl",{className:"aw-readonly-config",children:[o.jsxs("div",{children:[o.jsx("dt",{children:_("agentWorkspace.runtimeStatus")}),o.jsxs("dd",{className:(W==null?void 0:W.status.toLowerCase())==="ready"?"is-ready":void 0,children:[(W==null?void 0:W.status.toLowerCase())==="ready"&&o.jsx("span",{className:"aw-status-dot"}),(W==null?void 0:W.status)||_("agentWorkspace.loading")]})]}),o.jsxs("div",{children:[o.jsx("dt",{children:_("agentWorkspace.deploymentRegion")}),o.jsx("dd",{children:(W==null?void 0:W.region)||(we==null?void 0:we.region)||(qi==null?void 0:qi.region)||_("agentWorkspace.notAvailable")})]}),o.jsxs("div",{children:[o.jsx("dt",{children:_("agentWorkspace.networkAccess")}),o.jsx("dd",{children:W!=null&&W.networkTypes.length?W.networkTypes.join(" / "):_("agentWorkspace.notAvailable")})]})]})]}),o.jsxs("section",{className:"aw-canvas-card",children:[o.jsx("div",{className:"aw-card-head",children:o.jsx("strong",{children:_("agentWorkspace.executionFlow")})}),o.jsx("div",{className:"aw-canvas",children:o.jsx(mE,{draft:un,direction:"horizontal",selectedPath:[],onSelect:()=>{},onAdd:()=>{},onInsert:()=>{},onDelete:()=>{},readOnly:!0,interactivePreview:!0},Zn)})]}),o.jsxs("section",{className:"aw-details-card",children:[o.jsx("div",{className:"aw-card-head",children:o.jsx("strong",{children:_("agentWorkspace.details")})}),o.jsxs("dl",{className:"aw-facts",children:[o.jsxs("div",{children:[o.jsx("dt",{children:_("agentSelector.model")}),o.jsx("dd",{children:Iz(gi==null?void 0:gi.model)||un.modelName||_("agentWorkspace.notAvailable")})]}),o.jsxs("div",{children:[o.jsx("dt",{children:_("agentWorkspace.agentCountLabel")}),o.jsx("dd",{children:gi!=null&&gi.graph?pFe(gi.graph):mFe(un)})]}),o.jsxs("div",{children:[o.jsx("dt",{children:_("agentSelector.tools")}),o.jsx("dd",{className:"aw-fact-badges",children:Jf.length?Jf.map(ct=>o.jsx("span",{children:ct},ct)):_("agentWorkspace.none")})]}),o.jsxs("div",{children:[o.jsx("dt",{children:_("agentSelector.skills")}),o.jsx("dd",{className:"aw-fact-badges",children:Hi===null?_("agentSelector.previewUnsupported"):Hi.length?Hi.map(ct=>o.jsx("span",{children:ct},ct)):_("agentWorkspace.none")})]}),o.jsxs("div",{children:[o.jsx("dt",{children:_("systemInfo.currentVersion")}),o.jsx("dd",{children:qt!=null?`v${qt}`:_("agentWorkspace.notAvailable")})]}),o.jsxs("div",{children:[o.jsx("dt",{children:_("agentSelector.status")}),o.jsx("dd",{children:ai?_("myAgents.draft"):(qi==null?void 0:qi.status)==="error"?_("agentWorkspace.deploymentFailed"):(qi==null?void 0:qi.status)==="cancelled"?_("agentWorkspace.cancelled"):sa?_("agentWorkspace.updatePending"):o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"aw-status-dot"}),_("skillCenter.status.available")]})})]})]})]}),o.jsxs("section",{className:"aw-sidecar-panel aw-settings-card","aria-label":_("agentWorkspace.selectedOptimizations"),children:[o.jsx("div",{className:"aw-section-head",children:o.jsxs("div",{children:[o.jsx("h3",{children:_("agentWorkspace.selectedOptimizations")}),o.jsx("p",{children:_("agentWorkspace.selectedOptimizationsDescription")})]})}),o.jsxs("dl",{className:"aw-readonly-config",children:[o.jsxs("div",{children:[o.jsx("dt",{children:_("agentWorkspace.configurationStatus")}),o.jsx("dd",{className:Kr!=null&&Kr.enabled?"is-ready":void 0,children:Kr?Kr.enabled?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"aw-status-dot"}),_("skillCenter.status.enabled")]}):_("skillCenter.status.inactive"):_("agentWorkspace.notRecorded")})]}),o.jsxs("div",{children:[o.jsx("dt",{children:_("agentWorkspace.optimizationProfile")}),o.jsx("dd",{children:Kr?Cxt(Kr.profile):_("agentWorkspace.legacyConfigMissing")})]}),o.jsxs("div",{children:[o.jsx("dt",{children:_("agentWorkspace.selectedOptimizations")}),o.jsx("dd",{className:"aw-fact-badges",children:Kr?qo.length?qo.map(ct=>o.jsx("span",{children:nj(ct)},ct)):_("agentWorkspace.noneSelected"):_("agentWorkspace.legacyConfigMissing")})]})]})]})]}),L==="usage"&&(we==null?void 0:we.runtimeId)&&o.jsxs("section",{className:"aw-usage","aria-busy":Qs,children:[o.jsx("div",{className:"aw-usage-intro",children:o.jsx("h3",{children:_("agentWorkspace.usageOverview")})}),Qs&&!os&&o.jsx("div",{className:"aw-usage-state",role:"status","aria-live":"polite",children:o.jsx(bn,{as:"span",children:_("agentWorkspace.loadingUsage")})}),Ea&&o.jsxs("div",{className:"aw-usage-state is-error",role:"alert",children:[o.jsx("span",{children:Ea}),o.jsx("button",{type:"button",onClick:()=>Fl(ct=>ct+1),children:_("common.retry")})]}),!Qs&&!Ea&&!os&&!Zi&&o.jsx("div",{className:"aw-usage-state",children:_("agentWorkspace.usageUnavailable")}),os&&o.jsxs(o.Fragment,{children:[o.jsxs("dl",{className:"aw-usage-summary","aria-label":_("agentWorkspace.usageSummary"),children:[o.jsxs("div",{children:[o.jsx("dt",{children:_("agentWorkspace.totalCalls")}),o.jsx("dd",{children:os.totalInvocations.toLocaleString(D.resolvedLanguage??D.language)})]}),o.jsxs("div",{children:[o.jsx("dt",{children:_("agentWorkspace.userCount")}),o.jsx("dd",{children:os.totalUsers.toLocaleString(D.resolvedLanguage??D.language)})]})]}),o.jsxs("div",{className:"aw-usage-users-head",children:[o.jsx("h3",{children:_("agentWorkspace.userDetails")}),Qs&&o.jsx(bn,{as:"span",role:"status","aria-live":"polite",children:_("agentWorkspace.refreshing")})]}),os.users.length===0?o.jsx("div",{className:"aw-usage-state",children:_("agentWorkspace.noUsage")}):o.jsx("div",{className:"aw-usage-table-wrap",children:o.jsxs("table",{className:"aw-usage-table",children:[o.jsx("caption",{children:_("agentWorkspace.usageUserList")}),o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{scope:"col",children:_("agentWorkspace.user")}),o.jsx("th",{scope:"col",children:_("agentWorkspace.callCount")}),o.jsx("th",{scope:"col",children:_("agentWorkspace.lastUsed")})]})}),o.jsx("tbody",{children:os.users.map(ct=>o.jsxs("tr",{children:[o.jsxs("td",{children:[o.jsx("strong",{children:ct.displayName||ct.userId||_("agentWorkspace.unknownUser")}),ct.displayName&&ct.userId&&o.jsx("small",{title:ct.userId,children:ct.userId})]}),o.jsx("td",{children:ct.invocationCount.toLocaleString(D.resolvedLanguage??D.language)}),o.jsx("td",{children:o.jsx("time",{dateTime:ct.lastUsedAt,children:Iqt(ct.lastUsedAt,D.resolvedLanguage??D.language,_)})})]},ct.userId))})]})}),os.totalPages>1&&o.jsxs("nav",{className:"aw-usage-pagination","aria-label":_("agentWorkspace.usagePagination"),children:[o.jsx("button",{type:"button",disabled:Qs||os.page<=1,onClick:()=>js(ct=>Math.max(1,ct-1)),children:_("common.previousPage")}),o.jsx("span",{"aria-live":"polite",children:_("agentWorkspace.pageOf",{page:os.page,total:os.totalPages})}),o.jsx("button",{type:"button",disabled:Qs||os.page>=os.totalPages,onClick:()=>js(ct=>ct+1),children:_("common.nextPage")})]})]})]}),L==="versions"&&o.jsxs("section",{className:"aw-version-stack",children:[o.jsxs("div",{className:"aw-integration-intro",children:[o.jsx("h3",{children:_("agentWorkspace.githubVersions")}),o.jsx("p",{children:(Ue=ve==null?void 0:ve.cicd)!=null&&Ue.enabled?_("agentWorkspace.githubVersionsDescription"):_("agentWorkspace.currentVersionOnly")})]}),ne&&o.jsx("div",{className:"aw-case-empty",children:_("agentWorkspace.loadingVersions")}),Te&&o.jsxs("div",{className:"aw-integration-error",role:"alert",children:[o.jsx("span",{children:Te}),(we==null?void 0:we.runtimeId)&&o.jsx("button",{type:"button",onClick:()=>void F_(we.runtimeId??"").then(Ne),children:_("common.retry")})]}),!ne&&!Te&&o.jsxs("div",{className:"aw-version-list",children:[(ve==null?void 0:ve.githubSyncError)&&o.jsx("div",{className:"aw-integration-error",role:"alert",children:o.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&&o.jsx("div",{className:"aw-integration-notice",role:"status",children:o.jsxs("span",{children:[_("agentWorkspace.sourceMergedRuntimeStill"),Bse(ve.latestSourceRuntimeStatus,_),_("agentWorkspace.currentProductionVersionHint")]})}),ve!=null&&ve.versions.length?ve.versions.map(ct=>{var bl;const Oi=ct.commitSha??"",so=ct.runtimeStatus??ct.status,ki=ct.changeType==="rollback",Hs=!!((bl=ve.cicd)!=null&&bl.enabled)&&!!Oi&&!ki&&Oi!==ve.currentCommitSha;return o.jsxs("article",{className:"aw-version-row",children:[o.jsxs("div",{children:[o.jsx("strong",{children:Dqt(ct,_)}),o.jsx("small",{children:ct.createdAt||_("agentWorkspace.noTime")})]}),o.jsxs("div",{children:[o.jsx("span",{children:_("agentWorkspace.prLink")}),ct.pullRequestUrl?o.jsx("a",{href:ct.pullRequestUrl,target:"_blank",rel:"noopener noreferrer",children:_("agentWorkspace.viewPr")}):o.jsx("em",{children:_("agentWorkspace.noPr")})]}),o.jsxs("div",{children:[o.jsx("span",{children:_("agentWorkspace.author")}),o.jsx("em",{children:ct.author||"Studio"})]}),o.jsxs("div",{children:[o.jsx("span",{children:_("agentWorkspace.publishStatus")}),o.jsx("em",{children:Bse(so,_)})]}),o.jsxs("div",{className:"aw-version-actions",children:[o.jsx("button",{type:"button",disabled:!Hs||Ke===Oi,onClick:()=>void kr(ct),children:_(Ke===Oi?"agentWorkspace.rollingBack":"agentWorkspace.rollbackToVersion")}),ct.workflowRunUrl&&o.jsx("a",{href:ct.workflowRunUrl,target:"_blank",rel:"noopener noreferrer",children:_("agentWorkspace.viewRelease")})]})]},`${ct.version}-${Oi||ct.createdAt}`)}):o.jsxs("article",{className:"aw-version-row",children:[o.jsxs("div",{children:[o.jsx("strong",{children:qt!=null?`v${qt}`:_("agentWorkspace.noVersion")}),o.jsx("small",{children:(W==null?void 0:W.updatedAt)||_("agentWorkspace.noTime")})]}),o.jsx("p",{children:_("agentWorkspace.currentVersionOnly")})]})]})]}),L==="integrations"&&o.jsxs("div",{className:"aw-integration-stack",children:[o.jsxs("div",{className:"aw-integration-intro",children:[o.jsx("h3",{children:_("agentWorkspace.integrationMethods")}),o.jsx("p",{children:_("agentWorkspace.integrationDescription")})]}),ue&&o.jsxs("div",{className:"aw-integration-error",role:"alert",children:[o.jsx("span",{children:ue}),o.jsx("button",{type:"button",onClick:()=>G(ct=>ct+1),children:_("common.retry")})]}),!ue&&o.jsxs("div",{className:"aw-integration-body",children:[o.jsxs("div",{className:`aw-integration-protocol-tabs${te==="a2a"?" is-a2a":""}`,role:"tablist","aria-label":_("agentWorkspace.integrationProtocol"),children:[o.jsx("span",{className:"aw-integration-protocol-slider","aria-hidden":"true"}),_O.map((ct,Oi)=>o.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:so=>{var bl;if(!["ArrowLeft","ArrowRight","Home","End"].includes(so.key))return;so.preventDefault();const ki=so.key==="Home"?0:so.key==="End"?_O.length-1:(Oi+(so.key==="ArrowRight"?1:-1)+_O.length)%_O.length,Hs=_O[ki];Or(Hs.id),(bl=document.getElementById(`integration-${Hs.id}-tab`))==null||bl.focus()},children:ct.label},ct.id))]}),te==="api-server"?o.jsx(Qse,{protocol:"api-server",title:"API Server",available:Ho,fields:[{label:"Agent",value:Ho?((nt=br==null?void 0:br.apiApps)==null?void 0:nt.join("、"))??"":""},{label:_("agentWorkspace.discoveryEndpoint"),value:Ho?x4(Mn,"/list-apps"):""},{label:_("agentWorkspace.invocationEndpoint"),value:Ho?x4(Mn,"/run_sse"):""},{label:_("agentWorkspace.authentication"),value:Ho?Fse(W==null?void 0:W.authType,_):""},{label:"API Key",value:o.jsx(Use,{available:Ho,authType:W==null?void 0:W.authType,value:Bl,visible:fe&&!!Bl,loading:Oe,error:be,onToggle:()=>void Tr()})}],example:Ho?Mqt(Mn,aa,W==null?void 0:W.authType):""}):o.jsx(Qse,{protocol:"a2a",title:"A2A",available:Xa,fields:[{label:"Agent",value:((kn=br==null?void 0:br.a2a)==null?void 0:kn.name)??""},{label:"Agent Card",value:Xa?x4(Mn,"/.well-known/agent-card.json"):""},{label:_("agentWorkspace.invocationUrl"),value:Ya},{label:_("agentWorkspace.authentication"),value:Xa?Fse(W==null?void 0:W.authType,_):""},{label:"API Key",value:o.jsx(Use,{available:Xa,authType:W==null?void 0:W.authType,value:Bl,visible:fe&&!!Bl,loading:Oe,error:be,onToggle:()=>void Tr()})}],example:Xa?Lqt(Ya,W==null?void 0:W.authType):""})]})]}),L==="evaluations"&&o.jsxs("section",{className:"aw-cases",children:[(we==null?void 0:we.runtimeId)&&o.jsx("div",{className:"aw-case-summary",children:["good","bad"].map(ct=>{const Oi=Hqt(wr,ct),so=io.filter(Hs=>Hs.kind===ct).length,ki=Xr?so:(Oi==null?void 0:Oi.itemCount)??so;return o.jsxs("button",{type:"button",onClick:()=>Kd(ct),children:[o.jsx("strong",{children:ki}),o.jsx("span",{children:_(ct==="good"?"agentWorkspace.goodCases":"agentWorkspace.badCases")})]},ct)})}),o.jsxs("div",{className:"aw-case-filter-bar",children:[o.jsxs("div",{className:"aw-case-filter-stack",children:[o.jsx("div",{className:"aw-case-filters","aria-label":_("agentWorkspace.caseResultFilter"),children:["good","bad"].map(ct=>o.jsx("button",{type:"button",className:gt===ct?"is-active":"","aria-pressed":gt===ct,onClick:()=>st(ct),children:_(ct==="good"?"agentWorkspace.goodCase":"agentWorkspace.badCase")},ct))}),o.jsx("div",{className:"aw-case-source-filters","aria-label":_("agentWorkspace.feedbackSourceFilter"),children:["auto","user"].map(ct=>o.jsx("button",{type:"button",className:Ht===ct?"is-active":"","aria-pressed":Ht===ct,onClick:()=>cn(ct),children:_(ct==="auto"?"agentWorkspace.automaticFeedback":"agentWorkspace.manualFeedback")},ct))})]}),o.jsxs("label",{className:"aw-case-search",children:[o.jsx(IN,{"aria-hidden":!0}),o.jsx("input",{type:"search",value:xt,onChange:ct=>ft(ct.currentTarget.value),placeholder:_("agentWorkspace.searchCasesPlaceholder"),"aria-label":_("agentWorkspace.searchCases")})]})]}),ro&&o.jsx("div",{className:`aw-case-toolbar${Eo?" is-active":""}`,children:Eo?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"aw-selection-count",children:_("agentWorkspace.selectedCaseCount",{count:ws.length})}),o.jsx("button",{type:"button",onClick:m0,disabled:Ar.length===0||Ns,children:_("agentWorkspace.selectAllVisible")}),o.jsx("button",{type:"button",className:"aw-selection-danger",onClick:()=>void zg(ws),disabled:ws.length===0||Ns,children:_(Ns?"common.deleting":"agentWorkspace.deleteSelected")}),o.jsx("button",{type:"button",onClick:g0,disabled:Ns,children:_("common.cancel")})]}):o.jsx("button",{type:"button",onClick:()=>{or(""),Li(!0)},disabled:Ar.length===0||Ns,children:_("agentWorkspace.selectCases")})}),ra&&o.jsx("div",{className:"aw-delete-error",role:"alert",children:ra}),o.jsx("div",{ref:ss,children:o.jsx(nWt,{cases:Ar,loading:ir&&Ar.length===0,error:kt,notice:Nn,runtimeBacked:!!(we!=null&&we.runtimeId),selectionMode:Eo,selectedCaseIds:fl,focusedCaseId:Co,expandedCaseIds:Ka,deleting:Ns,canDelete:ro,onOpenCase:y0,onToggleCase:Qg,onToggleExpanded:b0,onDeleteCase:ct=>void zg([ct]),onRetry:()=>is(ct=>ct+1)})})]}),L==="optimizations"&&o.jsxs("section",{className:"aw-optimizations",children:[o.jsxs("div",{className:"aw-optimization-intro",children:[o.jsx("h3",{children:_("agentWorkspace.optimizations")}),o.jsx("p",{children:_("agentWorkspace.optimizationsDescription")})]}),oi?o.jsxs("div",{className:"aw-optimization-state",role:"status",children:[o.jsx("span",{className:"loading-gap-spinner","aria-hidden":"true"}),o.jsx("span",{children:_("agentWorkspace.loadingOptimizations")})]}):Fr?o.jsxs("div",{className:"aw-optimization-state is-error",role:"alert",children:[o.jsx("span",{children:Fr}),o.jsx("button",{type:"button",onClick:()=>Hr(ct=>ct+1),children:_("common.retry")})]}):$r.length>0?o.jsx(eWt,{groups:$r}):o.jsx("div",{className:"aw-optimization-state",children:_("agentWorkspace.noOptimizations")})]})]}),L==="basic"&&(we||ai)&&o.jsxs("div",{className:"aw-basic-actions",children:[we&&o.jsxs("button",{type:"button",className:"aw-talk studio-update-action",onClick:()=>E==null?void 0:E(we),children:[o.jsx(rrt,{"aria-hidden":!0}),o.jsx("span",{children:_("agentWorkspace.chat")})]}),o.jsxs("span",{className:`aw-update-wrap${pl?" is-disabled":""}`,tabIndex:pl?0:void 0,"aria-describedby":pl?ml:void 0,children:[o.jsx("button",{type:"button",className:"aw-update studio-update-action",disabled:!!pl,"aria-busy":Ae||void 0,"aria-describedby":pl?ml:void 0,onClick:()=>ai?R==null?void 0:R(ai):Je?T(Je):void 0,children:Ae?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"loading-gap-spinner aw-update-spinner","aria-hidden":"true"}),o.jsx("span",{children:_("agentWorkspace.preparing")})]}):_(ai||sa?"agentWorkspace.continueEditing":"agentWorkspace.update")}),pl&&o.jsx("span",{id:ml,className:"aw-update-disabled-reason",role:"tooltip",children:pl})]})]})]}):null}}),activeSectionKey:L,navigationLabel:_("agentWorkspace.agentDetails"),onSectionChange:F})]})]}),M==="evaluation"&&o.jsx("div",{className:"aw-evaluation-glass",role:"status",children:o.jsx("span",{children:_("agentWorkspace.comingSoon")})})]})]}),En&&o.jsx(Xu,{variant:"danger",title:En.title,description:En.description,confirmLabel:Vt?_("common.deleting"):En.confirmLabel,closeLabel:_("agentWorkspace.closeDeleteConfirmation"),busy:Vt,onCancel:()=>vi(null),onConfirm:()=>void qg()})]})}function eWt({groups:e}){const{t}=_e("ui");return o.jsx("div",{className:"aw-optimization-table-wrap",children:o.jsxs("table",{className:"aw-optimization-table",children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{scope:"col",children:t("agentWorkspace.fixPriority")}),o.jsx("th",{scope:"col",children:t("agentWorkspace.suggestedModule")}),o.jsx("th",{scope:"col",children:t("agentWorkspace.suggestionAndReason")})]})}),o.jsx("tbody",{children:e.map(n=>o.jsxs("tr",{children:[o.jsx("td",{children:o.jsx("span",{className:`aw-priority is-${n.priority}`,children:Qqt(n.priority,t)})}),o.jsx("td",{children:o.jsx("span",{className:"aw-optimization-module",children:Vqt(n,t)})}),o.jsx("td",{children:o.jsx("ul",{className:"aw-optimization-list",children:n.items.map(i=>o.jsxs("li",{children:[o.jsx("strong",{children:i.suggestion}),o.jsx("p",{children:i.reason})]},`${i.suggestion}:${i.reason}`))})})]},`${n.priority}:${n.module}:${n.customModule??""}`))})]})})}function tWt(){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("path",{d:"M4.5 7h15"}),o.jsx("path",{d:"M9 7V4.8h6V7"}),o.jsx("path",{d:"m6.5 7 .8 12h9.4l.8-12"}),o.jsx("path",{d:"M10 10.5v5M14 10.5v5"})]})}function nWt({cases:e,loading:t=!1,error:n="",notice:i="",runtimeBacked:r=!1,selectionMode:s=!1,selectedCaseIds:a,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}=_e("ui");return o.jsxs("div",{className:"aw-case-table",children:[o.jsxs("div",{className:"aw-case-row aw-case-row-head",children:[o.jsx("span",{children:v("agentWorkspace.userInput")}),o.jsx("span",{children:v("agentWorkspace.agentOutput")}),o.jsx("span",{children:v("agentWorkspace.score")}),o.jsx("span",{children:v("agentWorkspace.scoreReason")}),o.jsx("span",{className:"aw-case-action-head",children:v("skillCenter.actions")})]}),t?o.jsx("div",{className:"aw-case-empty",children:v("agentWorkspace.loadingEvaluationSet")}):n?o.jsxs("div",{className:"aw-case-empty aw-case-error",children:[o.jsx("span",{children:n}),b&&o.jsx("button",{type:"button",onClick:b,children:v("common.retry")})]}):i?o.jsx("div",{className:"aw-case-empty",children:i}):e.length===0?o.jsx("div",{className:"aw-case-empty",children:v(r?"agentWorkspace.noFeedbackCases":"agentWorkspace.noMatchingCases")}):e.map(x=>{var A,j;const w=x.id.startsWith("local:"),O=(a==null?void 0:a.has(x.id))??!1,S=(c==null?void 0:c.has(x.id))??!1,C=x.output.length+x.referenceOutput.length>220||(((A=x.reason)==null?void 0:A.length)??0)>120,E=d&&!w,N=!!(x.comment&&x.comment.trim()!==((j=x.reason)==null?void 0:j.trim()));return o.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:[o.jsxs("div",{className:"aw-case-text aw-case-cell","data-label":v("agentWorkspace.userInput"),children:[o.jsxs("span",{className:"aw-case-title-line",children:[s&&E&&o.jsx("span",{className:`aw-select-marker${O?" is-checked":""}`,"aria-hidden":"true"}),o.jsx("strong",{title:x.input,children:x.input||v("agentWorkspace.noUserInput")})]}),N&&o.jsxs("small",{title:x.comment,children:[v("agentWorkspace.note"),x.comment]}),o.jsx("small",{className:"aw-case-time",children:Bqt(x.createdAt,y.resolvedLanguage??y.language,v)}),(x.userId||x.sessionId)&&o.jsx("small",{title:[x.userId,x.sessionId].filter(Boolean).join(" · "),children:[x.userId,x.sessionId].filter(Boolean).join(" · ")})]}),o.jsxs("div",{className:`aw-case-output aw-case-cell${S?" is-expanded":""}`,"data-label":v("agentWorkspace.agentOutput"),children:[o.jsx("p",{className:"aw-case-output-preview",title:x.output,children:x.output||v("agentWorkspace.noVisibleResponse")}),x.referenceOutput&&o.jsxs("small",{className:"aw-case-output-preview",title:x.referenceOutput,children:[v("agentWorkspace.reference"),": ",x.referenceOutput]}),C&&o.jsx("button",{type:"button",className:"aw-case-expand",onClick:T=>{T.stopPropagation(),m==null||m(x.id)},children:v(S?"common.collapse":"common.expand")})]}),o.jsx("div",{className:"aw-case-score aw-case-cell","data-label":v("agentWorkspace.score"),children:Uqt(x,v)}),o.jsx("div",{className:`aw-case-reason aw-case-cell${S?" is-expanded":""}`,"data-label":v("agentWorkspace.scoreReason"),children:o.jsx("p",{title:x.reason||void 0,children:x.reason||"—"})}),o.jsx("div",{className:"aw-case-actions aw-case-cell","data-label":v("skillCenter.actions"),children:E&&o.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:o.jsx(tWt,{})})})]},x.id)})]})}function iWt({group:e,agents:t,cases:n,onChange:i,onRun:r}){const{t:s}=_e("ui"),[a,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 o.jsxs("main",{className:"aw-main",children:[o.jsxs("div",{className:"aw-eval-head",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"aw-agent-title-row",children:[o.jsx("h2",{children:pk(e.name,s)}),o.jsx("span",{children:s("agentWorkspace.evaluationGroup")})]}),o.jsx("p",{children:s("agentWorkspace.evaluationGroupStats",{agents:c.length,caseSet:pk(e.caseSet,s),runs:e.history.length})})]}),o.jsxs("button",{type:"button",className:"aw-run",onClick:()=>r(e),disabled:!0,children:[o.jsx(Yit,{"aria-hidden":!0}),s("agentWorkspace.startEvaluation")]})]}),o.jsxs("nav",{className:"aw-agent-tabs","aria-label":s("agentWorkspace.evaluationGroupDetails"),children:[o.jsx("button",{type:"button",className:a==="config"?"is-active":"","aria-pressed":a==="config",onClick:()=>l("config"),disabled:!0,children:s("agentWorkspace.evaluationConfig")}),o.jsx("button",{type:"button",className:a==="history"?"is-active":"","aria-pressed":a==="history",onClick:()=>l("history"),disabled:!0,children:s("agentWorkspace.historyResults")})]}),o.jsx("div",{className:"aw-content",children:a==="config"?o.jsxs("div",{className:"aw-eval-setup",children:[o.jsxs("section",{className:"aw-eval-block",children:[o.jsxs("div",{className:"aw-card-head",children:[o.jsx("strong",{children:s("agentWorkspace.participatingAgents")}),o.jsx("span",{children:s("agentWorkspace.selectedCount",{count:c.length})})]}),o.jsx("div",{className:"aw-eval-agent-grid",children:t.map(h=>o.jsxs("label",{children:[o.jsx("input",{type:"checkbox",checked:e.agentIds.includes(h.id),onChange:()=>d(h.id)}),o.jsxs("span",{children:[o.jsx("strong",{children:h.label}),o.jsx("small",{children:h.remote?s("agentWorkspace.remote"):s("agentWorkspace.local")})]})]},h.id))})]}),o.jsxs("div",{className:"aw-eval-setting-grid",children:[o.jsxs("section",{className:"aw-eval-block",children:[o.jsx("div",{className:"aw-card-head",children:o.jsx("strong",{children:s("agentWorkspace.evaluationResources")})}),o.jsxs("div",{className:"aw-eval-fields",children:[o.jsxs("label",{children:[o.jsx("span",{children:s("agentWorkspace.evaluationSet")}),o.jsxs("select",{value:e.caseSet,onChange:h=>i({...e,caseSet:h.currentTarget.value}),children:[o.jsx("option",{value:"核心回归集",children:s("agentWorkspace.evaluationDefaults.coreSet")}),o.jsx("option",{value:"安全边界集",children:s("agentWorkspace.evaluationDefaults.safetySet")}),o.jsx("option",{value:"工具调用集",children:s("agentWorkspace.evaluationDefaults.toolSet")})]}),o.jsx("small",{children:s("agentWorkspace.caseCount",{count:n.length})})]}),o.jsxs("label",{children:[o.jsx("span",{children:s("agentWorkspace.evaluator")}),o.jsxs("select",{value:e.evaluator,onChange:h=>i({...e,evaluator:h.currentTarget.value}),children:[o.jsx("option",{value:"综合质量评估器",children:s("agentWorkspace.evaluationDefaults.qualityEvaluator")}),o.jsx("option",{value:"事实一致性评估器",children:s("agentWorkspace.evaluationDefaults.factualEvaluator")}),o.jsx("option",{value:"工具调用评估器",children:s("agentWorkspace.evaluationDefaults.toolEvaluator")})]})]}),o.jsxs("label",{children:[o.jsx("span",{children:s("agentWorkspace.concurrency")}),o.jsxs("select",{value:e.concurrency,onChange:h=>i({...e,concurrency:h.currentTarget.value}),children:[o.jsx("option",{value:"2",children:"2"}),o.jsx("option",{value:"4",children:"4"}),o.jsx("option",{value:"8",children:"8"})]})]})]})]}),o.jsxs("section",{className:"aw-eval-block",children:[o.jsxs("div",{className:"aw-card-head",children:[o.jsx("strong",{children:s("agentWorkspace.evaluationMetrics")}),o.jsx("span",{children:s("agentWorkspace.selectedMetricCount",{count:e.metrics.length})})]}),o.jsx("div",{className:"aw-metric-list",children:u.map(h=>o.jsxs("label",{children:[o.jsx("input",{type:"checkbox",checked:e.metrics.includes(h),onChange:()=>f(h)}),o.jsx("span",{children:pk(h,s)})]},h))})]})]})]}):o.jsxs("section",{className:"aw-eval-history",children:[o.jsx("div",{className:"aw-section-head",children:o.jsxs("div",{children:[o.jsx("h3",{children:s("agentWorkspace.historyResults")}),o.jsx("p",{children:s("agentWorkspace.historyDescription")})]})}),e.history.length===0?o.jsxs("div",{className:"aw-results-empty",children:[o.jsx("strong",{children:s("agentWorkspace.noHistory")}),o.jsx("span",{children:s("agentWorkspace.noHistoryDescription")})]}):o.jsx("div",{className:"aw-history-list",children:e.history.map((h,m)=>o.jsxs("button",{type:"button",children:[o.jsxs("span",{children:[o.jsx("strong",{children:s("agentWorkspace.evaluationRun",{index:e.history.length-m})}),o.jsx("small",{children:s("agentWorkspace.evaluationRunMeta",{time:pk(h.createdAt,s),agents:c.length})})]}),o.jsxs("span",{className:"aw-history-score",children:[o.jsx("strong",{children:h.score}),o.jsx("small",{children:s("agentWorkspace.overallScore")})]}),o.jsxs("span",{className:"aw-complete",children:[o.jsx(Fd,{}),s("agentWorkspace.completed")]}),o.jsx(Hk,{"aria-hidden":!0})]},h.id))})]})})]})}async function dq(e,t={}){const n=await fetch(ta(`/web/agent-reviews${e}`),{...t,headers:Ml(hu({"Content-Type":"application/json"})),signal:Ha(t.signal??void 0,6e4)});if(!n.ok)throw new Error(await n.text());return n.json()}function rWt(e,t){return dq(`?${new URLSearchParams({region:e})}`,{signal:t})}function sWt(e,t,n){return dq(`/${encodeURIComponent(e)}?${new URLSearchParams({region:t})}`,{signal:n})}function oWt(e,t,n){return dq(`/${encodeURIComponent(e)}/${t}`,{method:"POST",body:JSON.stringify(n)})}const aWt=20,Vse=256;function w4({label:e,value:t,onChange:n,limit:i,disabled:r,required:s=!1}){const{t:a}=_e("agentReviews");return o.jsxs("label",{children:[e,o.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}),o.jsx("span",{className:"agent-review-text-count",children:a("textCount",{count:Array.from(t).length,limit:i})})]})}function YR({person:e}){return o.jsxs("span",{className:"agent-review-person",title:e.email||e.name,children:[e.avatarUrl?o.jsx("img",{src:e.avatarUrl,alt:"",referrerPolicy:"no-referrer",onError:t=>{t.currentTarget.hidden=!0}}):null,o.jsx("span",{children:e.name||e.id})]})}function vFe({runtimeId:e,region:t,name:n,canPublish:i,onClose:r,onChanged:s}){const{t:a,i18n:l}=_e("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,N]=p.useState(!1),[A,j]=p.useState(null);p.useEffect(()=>{const P=new AbortController;return f(!0),b(""),sWt(e,t,P.signal).then(L=>{P.signal.aborted||u(L.application)}).catch(L=>{P.signal.aborted||b(L instanceof Error?L.message:String(L))}).finally(()=>{P.signal.aborted||f(!1)}),()=>P.abort()},[e,t,k]);async function T(P,L){if(!h){m(!0),b("");try{const F=await oWt(e,P,{region:t,...P==="submit"?{message:v}:{},...P==="publish"||P==="decision"?{comment:x}:{},...P==="decision"?{applicationId:c==null?void 0:c.id,decision:L,reason:O}:{}});u(F),w(""),S(""),N(!1),j(null),s()}catch(F){b(F instanceof Error?F.message:String(F))}finally{m(!1)}}}const R=(c==null?void 0:c.status)==="pending",_=!!(c!=null&&c.published),D=!R&&!_,M=P=>new Date(P).toLocaleString(l.language);return o.jsx(O1,{open:!0,onOpenChange:P=>{!P&&!h&&r()},children:o.jsxs(w1,{children:[o.jsx(v1,{className:"agent-review-backdrop"}),o.jsxs(x1,{className:"agent-review-dialog",children:[o.jsxs("header",{className:"agent-review-dialog-header",children:[o.jsxs("div",{children:[o.jsx(k1,{children:n}),o.jsx(ST,{children:a("dialogDescription")})]}),o.jsx(WD,{className:"agent-review-close",disabled:h,"aria-label":a("close"),children:o.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:o.jsx("path",{d:"m6 6 12 12M6 18 18 6",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round"})})})]}),o.jsxs("div",{className:"agent-review-dialog-body",children:[d?o.jsx(za,{}):null,g?o.jsxs("div",{className:"agent-review-error",role:"alert",children:[o.jsx("p",{children:g}),o.jsx("button",{type:"button",disabled:h||d,onClick:()=>C(P=>P+1),children:a("refresh")})]}):null,!d&&c?o.jsxs(o.Fragment,{children:[o.jsxs("dl",{className:"agent-review-facts",children:[o.jsxs("div",{children:[o.jsx("dt",{children:a("statusTitle")}),o.jsxs("dd",{children:[a(`status.${c.status}`),c.status==="approved"&&!_?` · ${a("private")}`:""]})]}),o.jsxs("div",{children:[o.jsx("dt",{children:a("submitter")}),o.jsx("dd",{children:o.jsx(YR,{person:c.submitter})})]}),o.jsxs("div",{children:[o.jsx("dt",{children:a("submittedAt")}),o.jsx("dd",{children:M(c.submittedAt)})]}),o.jsxs("div",{children:[o.jsx("dt",{children:a("version")}),o.jsx("dd",{children:c.agent.version??"—"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:a("model")}),o.jsx("dd",{children:c.agent.model||"—"})]}),c.reviewer?o.jsxs("div",{children:[o.jsx("dt",{children:a(c.status==="returned"?"returnedBy":"approvedBy")}),o.jsx("dd",{children:o.jsx(YR,{person:c.reviewer})})]}):null,c.reviewedAt?o.jsxs("div",{children:[o.jsx("dt",{children:a("reviewedAt")}),o.jsx("dd",{children:M(c.reviewedAt)})]}):null]}),o.jsxs("section",{children:[o.jsx("h3",{children:a("description")}),o.jsx("p",{children:c.agent.description||"—"})]}),c.message?o.jsxs("section",{children:[o.jsx("h3",{children:a("message")}),o.jsx("p",{children:c.message})]}):null,c.reason?o.jsxs("section",{children:[o.jsx("h3",{children:a("reason")}),o.jsx("p",{children:c.reason})]}):null,c.comment?o.jsxs("section",{children:[o.jsx("h3",{children:a("comment")}),o.jsx("p",{children:c.comment})]}):null,c.contentChanged?o.jsx("p",{role:"alert",className:"agent-review-warning",children:a("contentChanged")}):null]}):null,!d&&!g&&D&&!i?o.jsx(w4,{label:a("message"),value:v,onChange:y,limit:aWt,disabled:h}):null,!d&&!g&&i&&(R||D)?o.jsx(w4,{label:a("comment"),value:x,onChange:w,limit:Vse,disabled:h}):null,E?o.jsx(w4,{label:a("reasonRequired"),value:O,onChange:S,limit:Vse,disabled:h,required:!0}):null,A?o.jsx("p",{role:"status",children:a(`${A}Confirm`)}):null]}),o.jsxs("footer",{className:"agent-review-dialog-footer",children:[h?o.jsx("span",{role:"status",children:a("saving")}):null,!d&&(!g||c)?A?o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",disabled:h,onClick:()=>j(null),children:a("cancel")}),o.jsx("button",{type:"button",disabled:h,onClick:()=>void T(A),children:a("confirm")})]}):E?o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",disabled:h,onClick:()=>N(!1),children:a("cancel")}),o.jsx("button",{type:"button",disabled:h||!O.trim(),onClick:()=>void T("decision","returned"),children:a("return")})]}):o.jsxs(o.Fragment,{children:[_?o.jsx("button",{type:"button",disabled:h,onClick:()=>j("unpublish"),children:a("unpublish")}):null,R?o.jsx("button",{type:"button",disabled:h,onClick:()=>j("withdraw"),children:a("withdraw")}):null,R&&i?o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",disabled:h,onClick:()=>N(!0),children:a("return")}),o.jsx("button",{type:"button",className:"is-primary",disabled:h||(c==null?void 0:c.contentChanged),onClick:()=>void T("decision","approved"),children:a("approve")})]}):null,D?o.jsx("button",{type:"button",className:"is-primary",disabled:h,onClick:()=>void T(i?"publish":"submit"),children:a(i?"publish":"submit")}):null]}):null]})]})]})})}const lWt=5e3,cWt=4;let O4=0;const Hse=[];function qse(e){return e instanceof Error&&e.name==="AbortError"}function uWt(e){return e instanceof Error&&e.name==="TimeoutError"}function dWt(e){return uWt(e)||e instanceof LU&&[500,502,503,504].includes(e.status)}function fWt(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 hWt(e={},t={}){const n=t.request??Qw,i=t.wait??fWt;try{return await n(e)}catch(r){if(!dWt(r))throw r;return await i(lWt,e.signal),n(e)}}async function xFe(e){var t;O4>=cWt&&await new Promise(n=>Hse.push(n)),O4+=1;try{return await e()}finally{O4-=1,(t=Hse.shift())==null||t()}}async function pWt(e,t){await Promise.allSettled(e.map(n=>xFe(()=>t(n))))}function Rb(e,t,n){const i=e instanceof Error?`${e.name}: ${e.message}`:String(e||V("common.unknownError"));return[V("requestError.actionFailed",{action:t}),V("requestError.detail",{detail:i}),n?V("requestError.request",{request:n}):""].filter(Boolean).join(` +`)}function Uh({className:e="icon"}){return o.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:[o.jsx("rect",{x:"4.25",y:"5.25",width:"15.5",height:"13.5",rx:"4.75"}),o.jsx("path",{className:"sidebar-agent-face__eye",d:"M8.5 10.7v2"}),o.jsx("path",{className:"sidebar-agent-face__eye",d:"M15.5 10.7v2"})]})}function mWt(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.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"}),o.jsx("path",{d:"m7.8 12.3 2 2-2 2M12.2 16.3h3.2"})]})}function gWt(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M18.9 6.25A8.4 8.4 0 1 0 19.6 16"}),o.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"}),o.jsx("circle",{cx:"10.6",cy:"12.8",r:"2.45"}),o.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 bWt(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.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"}),o.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"}),o.jsx("path",{d:"M9.3 12.65h.01M14.9 12.65h.01M10.8 15.55c.8.5 1.65.5 2.45 0"}),o.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 yWt(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M5.2 17.2V8.1a3 3 0 0 1 3-3h7.6a3 3 0 0 1 3 3v9.1"}),o.jsx("path",{d:"M7.4 17.2h9.2M9 19.9h6"}),o.jsx("path",{d:"M9.1 9.25h5.8M9.1 12h3.1"}),o.jsx("path",{d:"m14.1 12.4 2 2.1M16.2 12.4l-2.1 2.1"})]})}function ZE({kind:e,...t}){return e==="codex"?o.jsx(mWt,{...t}):e==="deepseek-harness"?o.jsx(yWt,{...t}):e==="openclaw"?o.jsx(gWt,{...t}):o.jsx(bWt,{...t})}const vWt=["general","codex","deepseek-harness","openclaw","hermes"],xWt=24,wWt=3e4,OWt=7e3,kWt=2e4,SWt=6,EWt=2,CWt=250,Rm=new Map,Tx=new Map,TWt=new Set;function lb(e){const t=e.runtime;return t?`${t.region}:${t.runtimeId}:${t.currentVersion??""}`:""}function Wse(e,t){const n=e instanceof Error&&e.message.trim()?e.message.trim():t("myAgents.compatibility.unknownError");return{status:e instanceof ho&&e.unsupported?"unsupported":"error",message:n}}function Eb(e){if(!e){Rm.clear(),Tx.clear(),eF();return}const t=new Set(e);if(t.size!==0){for(const[n,i]of Tx)i.page.runtimes.some(r=>t.has(r.runtimeId))&&Tx.delete(n);for(const n of t)eF(n);Rm.clear()}}function AWt(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"M8 3.25v9.5M3.25 8h9.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}function _Wt(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.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 jWt(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.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 NWt({type:e}){return e==="general"?o.jsx(Uh,{}):o.jsx(ZE,{kind:e})}function RWt(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),a=r%60;return n("myAgents.sandboxRemaining",{hours:s,minutes:a})}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:EMe(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 IWt(e,t){const n=XI(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:EMe(e.createdBy),isMine:e.isMine,region:e.region,sandbox:e}}function PWt(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 DWt(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 MWt(e,t){return e.trim()||Ki(t)}async function LWt(e,t,n,i,r,s){const a=`${e}:${t}:${n}`,l=Tx.get(a);if(l&&l.expiresAt>Date.now())return i(l.page.runtimes.map(d=>Kse(d,r))),l.page.nextToken;l&&Tx.delete(a);let c=Rm.get(a);c||(c=hWt({scope:e,region:t,pageSize:xWt,nextToken:n,signal:s}),Rm.set(a,c),c.then(()=>Rm.delete(a),()=>Rm.delete(a)));const u=await c;return Tx.set(a,{page:u,expiresAt:Date.now()+wWt}),i(u.runtimes.map(d=>Kse(d,r))),u.nextToken}function $Wt({agent:e,onReview:t,onUse:n,onViewDetails:i,onPrepareUpdate:r,compatibility:s,onRetryCompatibility:a,connecting:l,connectError:c,connected:u,deploymentTask:d,nowMs:f,onViewDeploymentTask:h,onEditDraft:m,onDeleteDraft:g}){var j,T,R,_;const{t:b,i18n:v}=_e("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=((R=e.sandbox)==null?void 0:R.resourceType)==="snapshot"?e.sandbox.sourceSessionId||e.sandbox.snapshotId:(_=e.sandbox)==null?void 0:_.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))},N=(e.draft||w||!!e.sandbox)&&!!(d?h:i),A=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 o.jsxs(Uz,{className:`my-agent-card${l?" is-connecting":""}${e.runtime?" has-review":""}`,activateLabel:N?A:void 0,onActivate:N?E:void 0,onPointerEnter:()=>r==null?void 0:r(e),onFocusCapture:()=>r==null?void 0:r(e),footer:o.jsxs("div",{className:"my-agent-card-footer",children:[o.jsx(TIe,{className:"my-agent-meta",items:[{label:e.specificationLabel,value:e.specification,hideLabel:!0,className:"my-agent-region"},{label:b("myAgents.time"),value:KD(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"):RWt(e.sandbox.expireAt,f,b),className:`my-agent-expiry${e.sandbox.resourceType==="snapshot"||e.sandbox.persistent?"":" is-expiring"}`}]:[]]}),e.runtime?o.jsxs("div",{className:"agent-review-card-controls",children:[o.jsx("span",{className:"agent-review-card-status",children:b(e.runtime.visibility==="enterprise"?"enterprise":"private",{ns:"agentReviews"})}),e.runtime.canManage?o.jsxs(rj,{className:"agent-review-card-action",onClick:D=>{D.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?o.jsxs(o.Fragment,{children:[o.jsx(rj,{"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")}),o.jsx(rj,{tone:"danger","aria-label":b("myAgents.deleteDraftNamed",{name:e.name}),onClick:()=>g==null?void 0:g(e.draft),children:b("common.delete")})]}):k||S?o.jsxs(Dt,{type:"button",color:"primary",size:"sm",pill:!1,"aria-label":b("myAgents.recheckCompatibility",{name:e.name}),onClick:()=>a==null?void 0:a(e),children:[o.jsx(hP,{}),b("common.retry")]}):o.jsx(u8,{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?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"my-agent-use-spinner","aria-hidden":"true"}),o.jsx("span",{className:"sr-only",children:b(x?"myAgents.waking":"agentSelector.connecting")})]}):o.jsx(_Wt,{})}),children:[o.jsx(Qz,{leading:o.jsx(cw,{seed:e.name}),title:e.name,subtitle:e.sandbox?o.jsx("span",{className:"my-agent-session-id",title:C,children:C}):void 0,status:e.draft?d?o.jsx("span",{className:"my-agent-deploying-badge",children:b("myAgents.deploying")}):o.jsx("span",{className:"my-agent-draft-badge",children:b("myAgents.draft")}):e.sandbox?o.jsx("span",{className:"my-agent-status-label","data-ready":XI(e.sandbox.status)==="ready"||void 0,children:e.description}):e.runtime&&d?o.jsx("span",{className:"my-agent-deploying-badge",children:b("myAgents.deploying")}):O?o.jsx(po,{content:s==null?void 0:s.message,contentClassName:"my-agent-compatibility-tooltip",maxWidth:360,align:"end",interactive:!0,preventUnintentionalClickToClose:!0,children:o.jsx("span",{className:"my-agent-compatibility-trigger",tabIndex:0,children:o.jsxs(Lo,{className:"my-agent-compatibility-status",color:"secondary",variant:"soft",size:"sm",pill:!0,children:[o.jsx("span",{className:"my-agent-compatibility-spinner","aria-hidden":"true"}),o.jsx("span",{children:b("myAgents.checking")})]})})}):S?o.jsx(po,{content:s==null?void 0:s.message,contentClassName:"my-agent-compatibility-tooltip",maxWidth:360,align:"end",interactive:!0,preventUnintentionalClickToClose:!0,children:o.jsx("span",{className:"my-agent-compatibility-trigger",tabIndex:0,children:o.jsx(Lo,{className:"my-agent-compatibility-status",color:"warning",variant:"soft",size:"sm",pill:!0,children:b("myAgents.chatUnsupported")})})}):k?o.jsx(po,{content:s==null?void 0:s.message,contentClassName:"my-agent-compatibility-tooltip",maxWidth:360,align:"end",interactive:!0,preventUnintentionalClickToClose:!0,children:o.jsx("span",{className:"my-agent-compatibility-trigger",tabIndex:0,children:o.jsx(Lo,{className:"my-agent-compatibility-status",color:"danger",variant:"soft",size:"sm",pill:!0,children:b("myAgents.checkFailed")})})}):null}),c?o.jsx(po,{content:c,contentClassName:"my-agent-error-tooltip",maxWidth:360,interactive:!0,children:o.jsx("p",{className:"my-agent-wake-note",role:"alert",tabIndex:0,children:c})}):null,x&&l?o.jsx("p",{className:"my-agent-wake-note",role:"status",children:o.jsx(bn,{children:b("myAgents.wakingHint")})}):null,e.sandbox?null:o.jsx(zz,{children:e.description})]})}function FWt({cloudProvider:e,studioRegion:t,canCreateRuntimeAgents:n,canCreatePersonalAgents:i,canUpdate:r,runtimeScope:s,onCreateAgent:a,onOpenCodexProjectUpload:l,onUseAgent:c,onViewAgentDetails:u,onCreateSandboxAgent:d,onUseSandboxAgent:f,onViewSandboxAgentDetails:h,activeType:m,onActiveTypeChange:g,sandboxRefreshKey:b=0,connectedRuntimeId:v="",hiddenRuntimeIds:y=TWt,drafts:x=[],deploymentTasks:w=[],draftDeploymentTaskIds:O={},onViewDeploymentTask:S,onEditDraft:k,onDeleteDraft:C}){const{t:E}=_e("ui"),N=p.useRef(null),A=p.useRef(null),j=p.useRef(0),T=p.useRef(null),R=p.useRef(0),_=p.useRef(null),D=p.useRef(new Map),M=MWt(t,e),[P,L]=p.useState(null),[F,I]=p.useState(""),[z,K]=p.useState(s==="mine"?"mine":"all"),[B,W]=p.useState(M),[H,X]=p.useState([]),[ie,Q]=p.useState(""),[Z,ue]=p.useState(!0),[Ee,Y]=p.useState(""),[G,te]=p.useState([]),[de,Ce]=p.useState(!1),[le,fe]=p.useState(""),[re,Oe]=p.useState(""),[Pe,be]=p.useState({}),[Qe,ve]=p.useState({}),[Ne,ne]=p.useState(null),[ye,Te]=p.useState(()=>Date.now()),Se=p.useMemo(()=>vWt.map(Le=>({value:Le,label:E(`myAgents.agentTypes.${Le}`)})),[E]),Ke=p.useMemo(()=>{const Le=nu(e);return Le.some(We=>We.value===M)?Le:[{value:M,label:M},...Le]},[e,M]);p.useEffect(()=>{s==="mine"&&K("mine")},[s]),p.useEffect(()=>{W(M)},[M]),p.useEffect(()=>{Te(Date.now());const Le=window.setInterval(()=>Te(Date.now()),1e3);return()=>window.clearInterval(Le)},[]);const it=p.useMemo(()=>x.map(Le=>PWt(Le,E)),[x,E]),he=p.useMemo(()=>{const Le=new Map,We=new Map,gt=new Map;for(const st of w){if(st.status!=="running")continue;if(Le.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:Le,byDraftId:We,byRuntimeId:gt}},[w]),xe=p.useCallback(Le=>{var gt;if(Le.draft){const st=O[Le.draft.id];return he.byDraftId.get(Le.draft.id)??(st?he.byId.get(st):void 0)}const We=(gt=Le.runtime)==null?void 0:gt.runtimeId;return We?he.byRuntimeId.get(We):void 0},[he,O]),Ae=p.useCallback((Le,We)=>{var xt;(xt=T.current)==null||xt.abort(),Rm.clear();const gt=new AbortController;T.current=gt;const st=++j.current;return ue(!0),Y(""),LWt(z,B,Le,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&&(qse(ft)||Y(Rb(ft,E("myAgents.loadGeneralAgents"),"GET /web/runtimes")))}).finally(()=>{j.current===st&&ue(!1),T.current===gt&&(T.current=null)})},[z,B,E]);p.useEffect(()=>{if(m==="general")return X([]),Q(""),Ae("",!0),()=>{var Le;(Le=T.current)==null||Le.abort(),T.current=null,Rm.clear(),j.current+=1}},[m,Ae]),p.useEffect(()=>{if(m!=="general"){for(const gt of D.current.values())gt.abort();D.current.clear();return}const Le=new Set(H.filter(gt=>{var st,xt;return((st=gt.runtime)==null?void 0:st.runtimeId)!==v&&((xt=gt.runtime)==null?void 0:xt.region)===B}).map(lb).filter(Boolean));for(const[gt,st]of D.current)Le.has(gt)||(st.abort(),D.current.delete(gt));const We=H.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)!==B)return!1;const xt=lb(gt),ft=(hn=Qe[xt])==null?void 0:hn.status;return!D.current.has(xt)&&(!ft||ft==="checking")});for(const gt of We)D.current.set(lb(gt),new AbortController);ve(gt=>{var ft,Ht;let st=!1;const xt={...gt};for(const cn of H){const hn=lb(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}),pWt(We,async gt=>{const st=gt.runtime;if(!st)return;const xt=lb(gt),ft=D.current.get(xt);if(ft)try{const Ht=await Kx(st.runtimeId,st.region,{signal:ft.signal,preferCached:!0,timeoutMs:OWt,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]:Wse(Ht,E)}))}finally{D.current.get(xt)===ft&&D.current.delete(xt)}})},[m,v,B,H,E]),p.useEffect(()=>()=>{var Le;(Le=T.current)==null||Le.abort();for(const We of D.current.values())We.abort();D.current.clear()},[]);const qe=p.useCallback(async Le=>{var st;(st=_.current)==null||st.abort();const We=new AbortController;_.current=We;const gt=++R.current;Ce(!0),fe(""),te([]);try{const xt=Le==="codex"?await Sr.listSessions({signal:We.signal,autoResumeSnapshots:!1}):await Sr.listAgentSessions(Le,{signal:We.signal,autoResumeSnapshots:!1});if(R.current!==gt)return;te(xt.map(ft=>IWt(ft,E)))}catch(xt){if((xt==null?void 0:xt.name)==="AbortError"||R.current!==gt)return;fe(Rb(xt,E("myAgents.loadAgentType",{type:E(`myAgents.agentTypes.${Le}`)}),`GET /web/${Le==="codex"?"sandbox":Le}/sessions`))}finally{_.current===We&&(_.current=null),R.current===gt&&Ce(!1)}},[E]);function Me(Le){var We;Le!==m&&(Le==="general"?(j.current+=1,X([]),Q(""),Y(""),ue(!0)):((We=_.current)==null||We.abort(),_.current=null,R.current+=1,te([]),fe(""),Ce(!0)),g(Le))}function At(){m==="general"&&(j.current+=1,X([]),Q(""),Y(""),ue(!0))}function It(Le){Le!==z&&(At(),K(Le))}function lt(Le){Le!==B&&(At(),W(Le))}p.useEffect(()=>{var Le;if(m==="general"){(Le=_.current)==null||Le.abort(),_.current=null,R.current+=1;return}return qe(m),()=>{var We;(We=_.current)==null||We.abort(),_.current=null,R.current+=1}},[m,qe,b]),p.useEffect(()=>{const Le=A.current,We=N.current;if(!Le||!We||m!=="general"||!ie||Z)return;const gt=new IntersectionObserver(([st])=>{st.isIntersecting&&Ae(ie,!1)},{root:We,rootMargin:"240px 0px",threshold:.01});return gt.observe(Le),()=>gt.disconnect()},[m,Ae,Z,ie]);const Ot=p.useCallback(async Le=>{if(!re){Oe(Le.id),be(We=>({...We,[Le.id]:""}));try{await new Promise(We=>requestAnimationFrame(()=>We())),Le.sandbox?await f(Le.sandbox):await c(Le)}catch(We){be(gt=>({...gt,[Le.id]:We instanceof Error?We.message:String(We)}))}finally{Oe("")}}},[re,c,f]),Ct=p.useCallback(async Le=>{var xt;const We=Le.runtime;if(!We)return;const gt=lb(Le);ve(ft=>({...ft,[gt]:{status:"checking",message:E("myAgents.compatibility.checking")}})),(xt=D.current.get(gt))==null||xt.abort();const st=new AbortController;D.current.set(gt,st);try{const ft=await xFe(()=>Kx(We.runtimeId,We.region,{retryProbe:!0,signal:st.signal,timeoutMs:kWt,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||qse(ft))return;ve(Ht=>({...Ht,[gt]:Wse(ft,E)}))}finally{D.current.get(gt)===st&&D.current.delete(gt)}},[E]),dt=p.useCallback(Le=>{const We=Le.runtime;!r||!We||xe(Le)||J$({runtimeId:We.runtimeId,region:We.region,appName:Le.appName,currentVersion:We.currentVersion})},[r,xe]),yt=p.useMemo(()=>{const Le=F.trim().toLocaleLowerCase(),We=m==="general"?[...it,...H]:G,st=(z==="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===B}),xt=Le?st.filter(cn=>cn.name.toLocaleLowerCase().includes(Le)):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,F,z,B,H,G]);p.useEffect(()=>{if(!r||m!=="general")return;const Le=yt.filter(ft=>!!ft.runtime).filter(ft=>!xe(ft)).slice(0,SWt);if(Le.length===0)return;let We=!1,gt=0;const st=async()=>{for(;!We;){const ft=Le[gt];if(gt+=1,!(ft!=null&&ft.runtime)||(await J$({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&&H.length===0&&it.length===0:de&&G.length===0,jt=!vt&&yt.length===0,ln=(m==="general"?n:i)?m==="general"?()=>a(B):()=>d(m):void 0,He=m==="codex"&&i&&!!l;return o.jsxs($f,{className:"my-agents-page","aria-label":E("myAgents.agent"),children:[o.jsx(Jy,{title:E("myAgents.agent"),className:"my-agents-header"}),o.jsxs(e0,{className:"my-agent-toolbar",children:[o.jsx(t0,{idPrefix:"my-agent-ownership",ariaLabel:E("myAgents.creatorFilter"),value:z,items:[{id:"all",label:E("common.all"),disabled:s==="mine"},{id:"mine",label:E("agentSelector.createdByMe")}],onChange:It}),o.jsxs("div",{className:"resource-toolbar__actions",children:[o.jsx(fg,{id:"my-agent-type-filter",ariaLabel:E("myAgents.agentType"),value:m,options:Se,onChange:Me}),o.jsx(fg,{id:"my-agent-region-filter",ariaLabel:E("myAgents.region"),value:B,options:Ke,onChange:lt}),o.jsx(pp,{className:"my-agent-search","aria-label":E("myAgents.searchAgents"),value:F,onChange:Le=>I(Le.target.value),placeholder:E("common.search")}),He?o.jsxs("button",{type:"button",className:"my-agent-create-secondary",onClick:l,children:[o.jsx(jWt,{}),o.jsx("span",{children:E("myAgents.handoff")})]}):null]})]}),o.jsxs(Pg,{className:"my-agent-results",ref:N,"aria-label":E("myAgents.agentList",{type:Ie}),children:[vt?o.jsx(za,{}):(m==="general"?Ee:le)&&yt.length===0?o.jsxs("div",{className:"my-agent-empty",role:"alert",children:[o.jsx("p",{children:m==="general"?Ee:le}),o.jsx("button",{type:"button",onClick:()=>{m==="general"?Ae("",!0):qe(m)},children:E("common.reload")})]}):jt&&!ln?F.trim()||z==="mine"||B!==M?o.jsx("div",{className:"my-agent-empty-message",children:o.jsxs(Pn,{fill:"none",children:[o.jsx(Pn.Icon,{children:o.jsx(vit,{})}),o.jsx(Pn.Title,{children:E("myAgents.noMatchingAgents")}),o.jsx(Pn.Description,{children:E("myAgents.adjustSearch")})]})}):m!=="general"?o.jsx("div",{className:"my-agent-empty-message",children:o.jsxs(Pn,{fill:"none",children:[o.jsx(Pn.Icon,{children:o.jsx(NWt,{type:m})}),o.jsx(Pn.Title,{className:"my-agent-sandbox-empty-title",children:E("myAgents.noAgentType",{type:Ie})})]})}):o.jsx("div",{className:"my-agent-empty-message",children:o.jsxs(Pn,{fill:"none",children:[o.jsx(Pn.Icon,{children:o.jsx(Uh,{})}),o.jsx(Pn.Title,{children:E("myAgents.noGeneralAgents")}),o.jsx(Pn.Description,{children:E("myAgents.createGeneralAgentDescription")})]})}):o.jsxs(o.Fragment,{children:[m==="general"&&Ee?o.jsxs("div",{className:"my-agent-inline-error",role:"alert",children:[o.jsx("span",{children:Ee}),o.jsx("button",{type:"button",onClick:()=>void Ae("",!0),children:E("common.reload")})]}):null,o.jsxs(n0,{className:"my-agent-grid",children:[ln?o.jsx(hg,{className:"my-agent-create-card","aria-label":E("myAgents.createAgentType",{type:Ie}),onClick:ln,icon:o.jsx(AWt,{}),children:E("myAgents.createAgent")}):null,yt.map(Le=>{var gt,st,xt,ft,Ht;const We=DWt(Le,H,E);return o.jsx($Wt,{agent:Le,onReview:L,deploymentTask:xe(Le),nowMs:ye,onViewDeploymentTask:S,onUse:Ot,compatibility:Le.runtime?Qe[lb(Le)]??{status:"checking",message:E("myAgents.compatibility.checking")}:void 0,onRetryCompatibility:Ct,onPrepareUpdate:((gt=Le.runtime)==null?void 0:gt.canManage)===!1||((st=Le.runtime)==null?void 0:st.visibility)==="enterprise"||((xt=Le.runtime)==null?void 0:xt.reviewStatus)==="pending"?void 0:dt,onViewDetails:We&&((ft=Le.runtime)==null?void 0:ft.canManage)!==!1?()=>{We.sandbox?h(We.sandbox):u(We)}:void 0,connecting:Le.id===re,connectError:Pe[Le.id],connected:((Ht=Le.runtime)==null?void 0:Ht.runtimeId)===v,onEditDraft:k,onDeleteDraft:ne},Le.id)})]})]}),m==="general"&&!Ee&&!vt&&(yt.length>0||!!ie)&&o.jsx("div",{className:"my-agent-load-more",ref:A,"aria-live":"polite",children:Z?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"my-agent-loading-mark","aria-hidden":"true"}),o.jsx("span",{children:E("myAgents.loadingMore")})]}):ie?o.jsx("span",{children:E("myAgents.scrollForMore")}):o.jsx("span",{children:E("myAgents.allLoaded")})})]}),P!=null&&P.runtime?o.jsx(vFe,{runtimeId:P.runtime.runtimeId,region:P.runtime.region,name:P.name,canPublish:P.runtime.canPublish===!0,onClose:()=>L(null),onChanged:()=>{Eb(),Ae("",!0)}},`${P.runtime.region}:${P.runtime.runtimeId}`):null,Ne?o.jsx(Xu,{title:E("myAgents.deleteDraftTitle"),description:E("myAgents.deleteDraftDescription",{name:Ne.draft.name||E("agentSelector.unnamedAgent")}),confirmLabel:E("myAgents.deleteDraft"),variant:"danger",onCancel:()=>ne(null),onConfirm:()=>{C==null||C(Ne),ne(null)}}):null]})}function fq({section:e,onWorkspace:t,onEnvironment:n,onProjects:i,actions:r,children:s,className:a=""}){const{t:l}=_e("ui"),c=l(e==="workspaces"?"workspace.title":e==="environments"?"common.environment":"workspace.codeProjects");return o.jsxs($f,{className:`workspace-center ${a}`,"aria-label":c,children:[o.jsx(Jy,{title:c}),o.jsxs(e0,{children:[(t||n)&&o.jsx(t0,{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"}),o.jsx("div",{className:"resource-toolbar__actions",children:r})]}),s]})}const BWt="_Container_13560_1",UWt="_Textarea_13560_174",Gse={Container:BWt,Textarea:UWt},Sg=e=>{const t=p.useRef(null),i=`search-ui-input-${p.useId()}`,{id:r,name:s,variant:a="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,...N}=e,[A,j]=p.useState(!1),T=k?Math.max(S??10,O):O;p.useEffect(()=>{var D;w&&((D=t.current)==null||D.select())},[w]);const R=D=>{y==null||y(D),D.animationName==="native-autofill-in"&&(x==null||x())},_=p.useCallback(()=>{if(!k||!t.current||T===void 0)return;t.current.style.height="0px";const D=t.current.scrollHeight;t.current.style.height=D+"px"},[k,T]);return p.useEffect(()=>{_()},[e.value,O,_]),o.jsx("div",{className:Ti(Gse.Container,u),"data-variant":a,"data-size":l,"data-gutter-size":c,"data-focused":A,"data-disabled":f?"":void 0,"data-readonly":h?"":void 0,"data-invalid":m?"":void 0,style:Ky({"textarea-min-rows":`${O}`,"textarea-max-rows":`${T}`}),children:o.jsx("textarea",{...N,onChange:D=>{E==null||E(D),_()},ref:LC([t,C]),id:r||(g?void 0:i),className:Gse.Textarea,name:s,readOnly:h,disabled:f,rows:O,onFocus:D=>{j(!0),b==null||b(D)},onBlur:D=>{j(!1),v==null||v(D)},onAnimationStart:R,"data-lpignore":g?void 0:!0,"data-1p-ignore":g?void 0:!0})})},YD="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",QWt="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",zWt="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",VWt="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",qWt="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",WWt="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",KWt="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",GWt="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",XWt="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 hq(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",...e,children:o.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"})})}Ba.registerLanguage("bash",nD);const YWt=48;function ZWt(e,t=YWt){return e.scrollHeight-e.scrollTop-e.clientHeight<=t}function JWt(e){return Ba.highlight(e,{language:"bash",ignoreIllegals:!0}).value}function eKt({status:e}){return e==="succeeded"?o.jsx(Fd,{"aria-hidden":!0}):e==="failed"?o.jsx(hF,{"aria-hidden":!0}):e==="running"?o.jsx(Mi,{className:"studio-build-progress__spinner","aria-hidden":!0}):o.jsx(Qit,{"aria-hidden":!0})}function Xse(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 tKt({steps:e,log:t,logError:n="",logTruncated:i=!1,logUpdatedAt:r,loading:s=!1}){const{t:a,i18n:l}=_e("ui"),c=p.useRef(null),u=p.useRef(!0),[d,f]=p.useState(!1),h=p.useMemo(()=>JWt(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 o.jsxs("div",{className:"studio-build-progress",children:[o.jsx("ol",{className:"studio-build-progress__steps","aria-label":a("studioBuildProgress.steps"),children:e.map(g=>o.jsxs("li",{className:`is-${g.status}`,children:[o.jsx("span",{className:"studio-build-progress__step-icon",children:o.jsx(eKt,{status:g.status})}),o.jsx("span",{children:g.label})]},g.key))}),o.jsxs("section",{className:"studio-build-progress__log","aria-label":a("studioBuildProgress.log"),children:[o.jsxs("header",{children:[o.jsxs("div",{children:[o.jsx("strong",{children:a("studioBuildProgress.log")}),o.jsxs("span",{children:[a(s?"studioBuildProgress.syncing":n?"studioBuildProgress.loadFailed":"studioBuildProgress.synced"),i?a("studioBuildProgress.recentOnly"):"",Xse(r,l.resolvedLanguage??l.language)?` · ${Xse(r,l.resolvedLanguage??l.language)}`:""]})]}),o.jsxs(Dt,{type:"button",color:"secondary",variant:"ghost",size:"sm",disabled:!t,onClick:()=>void m(),"aria-label":a(d?"studioBuildProgress.copiedLog":"studioBuildProgress.copyLog"),children:[d?o.jsx(Fd,{"aria-hidden":!0}):o.jsx(pP,{"aria-hidden":!0}),a(d?"studioBuildProgress.copied":"studioBuildProgress.copy")]})]}),t?o.jsx("pre",{ref:c,tabIndex:0,"aria-label":a("studioBuildProgress.logContent"),onScroll:g=>{u.current=ZWt(g.currentTarget)},children:o.jsx("code",{className:"hljs language-bash",dangerouslySetInnerHTML:{__html:h}})}):o.jsx("div",{className:`studio-build-progress__log-empty${n?" is-error":""}`,children:n||a(s?"studioBuildProgress.waiting":"studioBuildProgress.empty")})]})]})}function Yse({name:e,description:t,icon:n,selected:i,disabled:r=!1,onChange:s,className:a=""}){return o.jsxs("button",{type:"button",className:`studio-package-option${i?" is-selected":""}${a?` ${a}`:""}`,"aria-pressed":i,disabled:r,onClick:()=>s(!i),children:[o.jsx("span",{className:"studio-package-option__icon","aria-hidden":"true",children:n}),o.jsxs("span",{className:"studio-package-option__content",children:[o.jsx("strong",{children:e}),t?o.jsx("span",{children:t}):null]}),o.jsx("span",{className:"studio-package-option__action","aria-hidden":"true",children:i?o.jsx(Oit,{}):o.jsx(Eit,{})})]})}function cb(e,t){return e[t]|e[t+1]<<8}function G0(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}async function nKt(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 wFe(e,t={}){let i=-1;for(let u=e.length-22;u>=0&&u>e.length-65557;u--)if(G0(e,u)===101010256){i=u;break}if(i<0)throw new Error(Kt("helpers.zip.invalid"));const r=cb(e,i+10);if(t.maxEntries!==void 0&&r>t.maxEntries)throw new Error(Kt("helpers.zip.tooManyFiles",{count:t.maxEntries}));let s=G0(e,i+16);const a=new TextDecoder("utf-8"),l=[];let c=0;for(let u=0;ut.maxUncompressedBytes)throw new Error(Kt("helpers.zip.tooLarge"));const x=cb(e,v+26),w=cb(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 nKt(S);else{s+=46+m+g+b;continue}l.push({name:y,text:a.decode(k)}),s+=46+m+g+b}return l}const n9=/(^|\/)skill\.md$/i;function iKt(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 sKt(...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 oKt(e,t){return t.trim()||e}function OFe(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 aKt(e){const t=new Map,n=new Set;for(const i of e)if(n9.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 a=n9.test("/"+i.path);if(!s&&!a&&!n.has("")||!n.has(s)&&!a)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 lKt(e,t,n){const i=`${n}${e?"/"+e:""}`,r=t.find(c=>n9.test("/"+c.path));if(!r)return{hit:null,error:Kt("helpers.skills.missingManifest",{location:i})};const s=iKt(r.text),a=sKt(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/${a}/${c.path}`;if(!d.startsWith(`skills/${a}/`))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:${a}:${t.length}`,name:oKt(a,s.name),description:s.description||Kt("helpers.skills.localDescription"),folder:a,localFiles:l},error:null}}async function cKt(e){const t=new Uint8Array(await e.arrayBuffer()),i=(await wFe(t)).map(r=>({path:r.name,text:r.text}));return kFe(OFe(i),e.name)}async function uKt(e,t=new Map){const n=[];for(let i=0;ie.file(t,n))}async function fKt(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 SFe(e,t=""){const n=t?`${t}/${e.name}`:e.name;if(e.isFile)return[{file:await dKt(e),path:n}];if(!e.isDirectory)return[];const i=await fKt(e);return(await Promise.all(i.map(r=>SFe(r,n)))).flat()}function hKt({selected:e,onChange:t}){const{t:n}=_e("create"),[i,r]=p.useState([]),[s,a]=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(N=>N.folder||N.name),...b.current.filter(N=>N.source==="local").map(N=>N.folder)]),k=[],C=[];for(const N of O.hits){const A=N.folder||N.name;if(S.has(A)){k.push(N.name);continue}S.add(A),C.push(N)}a(N=>[...N,...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 N=C[0];N.localFiles&&t([...b.current,{source:"local",folder:N.folder||N.name,name:N.name,description:N.description,localFiles:N.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(N=>SFe(N)))).flat(),C=S.some(N=>N.isDirectory);if(!C&&k.length===1&&k[0].file.name.toLowerCase().endsWith(".zip")){v(await cKt(k[0].file));return}if(!C){r([n("skills.local.invalidDrop")]);return}const E=new Map(k.map(({file:N,path:A})=>[N,A]));v(await uKt(k.map(({file:N})=>N),E))}catch(k){r([n("skills.local.readError",{detail:k instanceof Error?k.message:String(k)})])}finally{c(!1)}};return o.jsxs("div",{className:"cw-local",children:[o.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:[o.jsx(bQ,{className:"cw-local-drop-icon","aria-hidden":!0}),o.jsx("p",{className:"cw-local-drop-hint",children:n("skills.local.dropLabel")})]}),o.jsx("p",{className:"cw-local-hint",children:n("skills.local.hint")}),l&&o.jsx("p",{className:"cw-empty-line",children:n("skills.local.reading")}),i.length>0&&o.jsxs("div",{className:"cw-banner",children:[o.jsx(Vf,{className:"cw-i"}),o.jsx("span",{children:i.join(";")})]}),s.length>0&&o.jsx("div",{className:"cw-skill-results",children:s.map(O=>{var k;const S=h(O.folder||O.name);return o.jsxs("button",{type:"button",className:`cw-skill-result ${S?"is-on":""}`,onClick:()=>m(O),"aria-pressed":S,children:[o.jsx("span",{className:"cw-skill-result-icon","aria-hidden":!0,children:S?o.jsx(Fd,{className:"cw-i cw-i-sm"}):o.jsx(_l,{className:"cw-i cw-i-sm"})}),o.jsxs("span",{className:"cw-skill-result-meta",children:[o.jsx("span",{className:"cw-skill-result-name",children:O.name}),O.description&&o.jsx("span",{className:"cw-skill-result-desc",children:JE(O.description)}),o.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 pKt="/harness/skills/findskill";async function mKt(e,t="public"){const n=e.trim(),i=new URLSearchParams({query:n,page_number:"1",page_size:"20"}),r=`${pKt}?${i.toString()}`,s=await fetch(r,{headers:{accept:"application/json"},signal:Ha(void 0,Va)});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 gKt({selected:e,onChange:t}){const{t:n}=_e("create"),[i,r]=p.useState(""),[s,a]=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 mKt(v);a(y)}catch(y){d(y instanceof Error?y.message:n("skills.hub.searchError")),a([])}finally{c(!1)}};return p.useEffect(()=>{const v=i.trim();if(!v){a([]),h(!1),d(null);return}const y=setTimeout(()=>b(v),300);return()=>clearTimeout(y)},[i,n]),o.jsxs("div",{className:"cw-skillhub",children:[o.jsxs("div",{className:"cw-skill-searchrow",children:[o.jsxs("div",{className:"cw-skill-searchbox",children:[o.jsx(IN,{className:"cw-i cw-skill-searchicon","aria-hidden":!0}),o.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))}})]}),o.jsxs("button",{type:"button",className:"cw-btn cw-btn-soft",onClick:()=>i.trim()&&b(i),disabled:!i.trim()||l,children:[l?o.jsx(Mi,{className:"cw-i cw-spin"}):o.jsx(IN,{className:"cw-i"}),n("skills.hub.search")]})]}),u&&o.jsxs("div",{className:"cw-banner",children:[o.jsx(Vf,{className:"cw-i"}),o.jsx("span",{children:u})]}),l&&s.length===0?o.jsxs("p",{className:"cw-empty-line cw-skill-loading",role:"status",children:[o.jsx(Mi,{className:"cw-i cw-spin"})," ",n("skills.hub.searching")]}):s.length>0?o.jsx("div",{className:"cw-skill-results",children:s.map(v=>{const y=m(v.slug||"");return o.jsxs("button",{type:"button",className:`cw-skill-result ${y?"is-on":""}`,onClick:()=>g(v),"aria-pressed":y,children:[o.jsx("span",{className:"cw-skill-result-icon","aria-hidden":!0,children:y?o.jsx(Fd,{className:"cw-i cw-i-sm"}):o.jsx(_l,{className:"cw-i cw-i-sm"})}),o.jsxs("span",{className:"cw-skill-result-meta",children:[o.jsx("span",{className:"cw-skill-result-name",children:v.name}),v.description&&o.jsx("span",{className:"cw-skill-result-desc",children:JE(v.description)}),v.sourceRepo&&o.jsx("span",{className:"cw-skill-result-repo",children:v.sourceRepo})]})]},v.id||v.slug)})}):f&&!u?o.jsx("p",{className:"cw-empty-line",children:n("skills.hub.noResults")}):!f&&o.jsx("p",{className:"cw-empty-line",children:n("skills.hub.hint")})]})}function bKt({selected:e,onChange:t,cloudProvider:n="volcengine"}){const{t:i}=_e("create"),[r,s]=p.useState([]),[a,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 LMe();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 $Me(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?fDt(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=Fb(O);if(x(S,O.version))t(e.filter(k=>!(k.source==="skillspace"&&k.skillId===S&&(k.version||"")===O.version)));else{const k=dDt(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 o.jsx("div",{className:"cw-skillspace",children:d?o.jsxs("p",{className:"cw-empty-line cw-skill-loading",role:"status",children:[o.jsx(Mi,{className:"cw-i cw-spin"})," ",i("skills.space.loadingSpaces")]}):g?o.jsxs("div",{className:"cw-banner",children:[o.jsx(Vf,{className:"cw-i"}),o.jsx("span",{children:g})]}):r.length===0?o.jsx("p",{className:"cw-empty-line",children:i("skills.space.noSpaces")}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"cw-skillspace-header",children:[o.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=>o.jsxs("option",{value:O.id,children:[oc(O)||O.id,O.description?` — ${JE(O.description)}`:""]},O.id))}),v&&o.jsxs(o.Fragment,{children:[v.region&&o.jsx("span",{className:"cw-skillspace-region-label",title:v.region,children:Mf(v.region,n)}),y&&o.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:o.jsx(xy,{className:"cw-i cw-i-sm"})})]})]}),h?o.jsxs("p",{className:"cw-empty-line cw-skill-loading",role:"status",children:[o.jsx(Mi,{className:"cw-i cw-spin"})," ",i("skills.space.loadingSkills")]}):a.length===0?o.jsx("p",{className:"cw-empty-line",children:i("skills.space.noSkills")}):o.jsx("div",{className:"cw-skill-results",children:a.map(O=>{const S=Fb(O),k=x(S,O.version);return o.jsxs("button",{type:"button",className:`cw-skill-result ${k?"is-on":""}`,onClick:()=>w(O),"aria-pressed":k,children:[o.jsx("span",{className:"cw-skill-result-icon","aria-hidden":!0,children:k?o.jsx(Fd,{className:"cw-i cw-i-sm"}):o.jsx(_l,{className:"cw-i cw-i-sm"})}),o.jsxs("span",{className:"cw-skill-result-meta",children:[o.jsxs("span",{className:"cw-skill-result-name",children:[O.skillName,O.version&&o.jsxs("span",{className:"cw-skill-result-version",children:[" ","v",O.version]})]}),O.skillDescription&&o.jsx("span",{className:"cw-skill-result-desc",children:JE(O.skillDescription)}),o.jsxs("span",{className:"cw-skill-result-repo",children:[o.jsx(zit,{className:"cw-i cw-i-sm"})," ",oc(v)||c]})]})]},`${S}/${O.version}`)})})]})})}function EFe({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.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"}),o.jsx("path",{d:"M7 4.75h9.5a2 2 0 0 1 2 2",opacity:".58"}),o.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"}),o.jsx("path",{d:"M19.25 11.25h1.5M20 10.5V12",opacity:".72"})]})}function k4(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 yKt(e){return e.source==="runtime"?"skillSourcePicker.sources.runtime":e.source==="local"?"skillSourcePicker.sources.local":e.source==="skillspace"?"skillSourcePicker.sources.skillspace":"skillSourcePicker.sources.skillhub"}function vKt({skill:e,onRemove:t,disabled:n}){const{t:i}=_e("ui");let r=YS;e.source==="local"||e.source==="runtime"?r=bQ:e.source==="skillspace"&&(r=EFe);const s=`${i(yKt(e))}${e.description?` · ${JE(e.description)}`:""}`;return o.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:[o.jsx("span",{className:"cw-selected-skill-icon","aria-hidden":"true",children:o.jsx(r,{className:"cw-i cw-i-sm"})}),o.jsxs("span",{className:"cw-selected-skill-meta",children:[o.jsx("span",{className:"cw-selected-skill-name",children:e.name}),o.jsx("span",{className:"cw-selected-skill-detail",tabIndex:0,title:s,children:s})]}),o.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:o.jsx(ka,{className:"cw-i cw-i-sm"})})]})}const S4=[{id:"local",labelKey:"skillSourcePicker.tabs.local",shortLabelKey:"skillSourcePicker.tabs.localShort",icon:bQ},{id:"skillspace",labelKey:"skillSourcePicker.tabs.skillspace",shortLabelKey:"skillSourcePicker.tabs.skillspaceShort",icon:EFe},{id:"skillhub",labelKey:"skillSourcePicker.tabs.skillhub",shortLabelKey:"skillSourcePicker.tabs.skillhubShort",icon:gP}];function pq({selected:e,onChange:t,cloudProvider:n,disabled:i=!1,addLabel:r,showSelectedCount:s=!0}){const{t:a}=_e("ui"),[l,c]=p.useState("local"),[u,d]=p.useState(!1),f=p.useId(),h=p.useId(),m=p.useRef(null),g=S4.findIndex(x=>x.id===l),b=r??a("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(a("skillSourcePicker.confirmRemoveRuntime",{name:w.name}))||t(e.filter(O=>k4(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 o.jsxs("div",{className:"cw-skillspane",children:[o.jsxs("button",{type:"button",className:"cw-skill-add","aria-haspopup":"dialog",disabled:i,onClick:()=>d(!0),children:[o.jsx("span",{className:"cw-skill-add-icon","aria-hidden":"true",children:o.jsx(_l,{className:"cw-i"})}),o.jsx("span",{children:b})]}),e.length>0&&o.jsxs("div",{className:"cw-skill-selected",children:[s?o.jsx("span",{className:"cw-skill-selected-label",children:a("skillSourcePicker.selectedCount",{count:e.length})}):null,o.jsx("div",{className:"cw-selected-skill-list",children:o.jsx(Td,{initial:!1,children:e.map(x=>o.jsx(vKt,{skill:x,disabled:i,onRemove:()=>v(k4(x),x)},k4(x)))})})]}),Jn.createPortal(o.jsx(Td,{children:u&&o.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:o.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:[o.jsxs("header",{className:"cw-skill-dialog-head",children:[o.jsx("h3",{id:f,children:b}),o.jsx("button",{ref:m,type:"button",className:"cw-skill-dialog-close","aria-label":a("skillSourcePicker.close",{label:b}),onClick:()=>d(!1),children:o.jsx(ka,{className:"cw-i"})})]}),o.jsxs("div",{className:"cw-skill-dialog-body",children:[o.jsxs("div",{className:"cw-skill-sourcetabs",role:"tablist",style:{"--cw-skill-tab-slider-width":`calc((100% - 16px) / ${S4.length})`,"--cw-active-skill-tab-offset":`calc(${g*100}% + ${g*4}px)`},children:[o.jsx("span",{className:"cw-skill-tab-slider","aria-hidden":"true"}),S4.map(({id:x,labelKey:w,shortLabelKey:O,icon:S})=>o.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:[o.jsx(S,{className:"cw-i cw-i-sm"}),o.jsx("span",{className:"cw-skill-tab-label-full",children:a(w)}),o.jsx("span",{className:"cw-skill-tab-label-short",children:a(O)})]},x))]}),o.jsxs("div",{id:h,className:"cw-skill-tabbody",role:"tabpanel","aria-labelledby":`${h}-${l}`,children:[l==="skillhub"&&o.jsx(gKt,{selected:e,onChange:y}),l==="local"&&o.jsx(hKt,{selected:e,onChange:y}),l==="skillspace"&&o.jsx(bKt,{selected:e,onChange:y,cloudProvider:n})]})]})]})})}),document.body)]})}const CFe=128*1024,xKt={baseImageRequired:"请填写基础镜像。",duplicateFrom:"基础镜像已固定在第一行,请删除 Dockerfile 正文中的 FROM 指令。",tooLarge:"Dockerfile 不能超过 128 KiB。",empty:"Dockerfile 内容不能为空。",missingFrom:"Dockerfile 缺少 FROM 指令。"};function Ax(e,t){return(t==null?void 0:t(`environmentCenter.dockerfileValidation.${e}`))??xKt[e]}function ZD(e){return e.replace(/^\uFEFF/,"").replace(/\r\n?/g,` `)}function TFe(e){return new TextEncoder().encode(e).byteLength}function wKt(e,t="ubuntu:22.04"){const n=ZD(e).match(/^\s*FROM(?:\s+--platform=\S+)?\s+(\S+)/im);return(n==null?void 0:n[1])??t}function OKt(e){const t=ZD(e).split(` @@ -1060,18 +1060,18 @@ __pycache__/ Dockerfile .dockerignore README.md -`};return Object.fromEntries(Object.entries(n).map(([i,r])=>[i,r.split("__PROJECT_NAME__").join(e)]))}const FGt={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:[LFe,$Fe,{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},FFe,BFe],initialValues:({cloudProvider:e})=>yq(e,{projectPath:"agentkit-basic-agent"}),regionHelp:"Must match the target Runtime region",secrets:({cloudProvider:e})=>UFe(e),submit(e,t,n){const i=QFe(e),r=vq(i.repository),s=xq(e.projectPath,"agentkit-basic-agent"),a=s==="."?r.split("/").slice(-1)[0]||"agentkit-basic-agent":s.split("/").slice(-1)[0]||"agentkit-basic-agent",l=Object.entries($Gt(a,t.cloudProvider)).map(([c,u])=>({path:NGt(s,c),content:u,commitMessage:"feat: import AgentKit basic template",mustBeNew:!0}));return l.push({path:RGt(s),content:qFe({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}),zFe({...i,repository:r,files:l,branchPrefix:"feat/agentkit-basic-template",title:Uf("cards.template.pullRequest.title"),description:Uf("cards.template.pullRequest.description",{provider:bq(t.cloudProvider)})},n)}},BGt={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."},soe=[{id:"development",label:"Development"},{id:"channels",label:"Messaging channels"}],WFe=[aGt,FGt,jGt,fGt,cGt,lGt,BGt],UGt=new Map(WFe.map(e=>[e.id,e]));function QGt(e){const t=UGt.get(e);if(!t)throw new Error(`Unknown automation: ${e}`);return t}function zGt(e){const t=QGt(e);if(t.kind!=="github")throw new Error(`Automation is not backed by GitHub: ${e}`);return t}function ooe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",...e,children:[o.jsx("circle",{cx:"10.8",cy:"10.8",r:"6.2",stroke:"currentColor",strokeWidth:"1.7"}),o.jsx("path",{d:"m15.4 15.4 4 4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})]})}function VGt(e){return o.jsxs("svg",{viewBox:"0 0 36 36",fill:"none","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.5",y:"5",width:"18",height:"18",rx:"5",fill:"currentColor",opacity:"0.1"}),o.jsx("rect",{x:"3.5",y:"5",width:"18",height:"18",rx:"5",stroke:"currentColor",strokeWidth:"1.6"}),o.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"}),o.jsx("circle",{cx:"26.5",cy:"12",r:"3",fill:"hsl(var(--background))",stroke:"currentColor",strokeWidth:"1.6"}),o.jsx("circle",{cx:"27",cy:"26.5",r:"3",fill:"hsl(var(--background))",stroke:"currentColor",strokeWidth:"1.6"}),o.jsx("path",{d:"M21.5 12h2M19.3 21l5.6 3.8M27 15v8.5",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"})]})}function HGt(e){return o.jsxs("svg",{viewBox:"0 0 36 36",fill:"none","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.5",y:"5",width:"22",height:"18",rx:"4",stroke:"currentColor",strokeWidth:"1.6"}),o.jsx("path",{d:"M4.5 10h20M9 7.5h.1M12 7.5h.1",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"}),o.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"}),o.jsx("path",{d:"M22 19.5h6M22 23h4",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"})]})}function qGt(e){return o.jsxs("svg",{viewBox:"0 0 36 36",fill:"none","aria-hidden":"true",...e,children:[o.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"}),o.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"}),o.jsx("path",{d:"m14 17.1 4 13.9 4-13.9M5.5 21.8h25",stroke:"currentColor",strokeWidth:"1.6",strokeLinejoin:"round"})]})}function WGt({onOpen:e}){var d;const{t}=_e("automations"),[n,i]=p.useState("development"),[r,s]=p.useState(""),a=p.useDeferredValue(r),l=p.useMemo(()=>{const f=a.trim().toLocaleLowerCase();return WFe.filter(h=>h.category===n).filter(h=>!f||`${t(`cards.${h.id}.name`)} ${t(`cards.${h.id}.description`)}`.toLocaleLowerCase().includes(f))},[n,a,t]),c=(d=soe.find(f=>f.id===n))==null?void 0:d.id,u=oGt(window.location.hostname);return o.jsxs("div",{className:"applications-page",children:[o.jsxs("header",{className:"applications-header",children:[o.jsxs("div",{children:[o.jsx("h1",{children:t("title")}),o.jsx("p",{children:t("description")})]}),o.jsxs("label",{className:"applications-search",children:[o.jsx(ooe,{}),o.jsx("input",{type:"search","aria-label":t("search"),value:r,onChange:f=>s(f.target.value),placeholder:t("search")})]})]}),o.jsx("nav",{className:"applications-categories","aria-label":t("categoriesLabel"),children:soe.map(f=>o.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))}),o.jsx("section",{className:"applications-results","aria-label":t("resultsLabel",{category:t(`categories.${c}`)}),children:l.length?o.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 o.jsxs("div",{className:`application-card-wrap${h?" is-disabled":""}`,tabIndex:h?0:void 0,"aria-describedby":m,children:[o.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"?o.jsx("img",{className:"application-card-icon application-card-brand-icon",src:YD,alt:"","aria-hidden":"true"}):f.icon==="coding-agents"?o.jsx(VGt,{className:"application-card-icon"}):f.icon==="website-integration"?o.jsx(HGt,{className:"application-card-icon"}):f.icon==="gitlab"?o.jsx(qGt,{className:"application-card-icon"}):o.jsx(hq,{className:"application-card-icon"}),o.jsxs("div",{className:"application-card-copy",children:[o.jsxs("div",{className:"application-card-title",children:[o.jsx("h2",{children:t(`cards.${f.id}.name`)}),f.badge?o.jsx("span",{className:`application-card-badge is-${f.badgeTone||"default"}`,children:t(`cards.${f.id}.badge`,{defaultValue:f.badge})}):null]}),o.jsx("p",{children:t(`cards.${f.id}.description`)})]})]}),h?o.jsx("span",{id:m,className:"application-card-tooltip",role:"tooltip",children:t("localOnly")}):null]},f.id)})}):o.jsxs("div",{className:"applications-empty",role:"status",children:[o.jsx(ooe,{}),o.jsx("h2",{children:t("emptyTitle")}),o.jsx("p",{children:t("emptyDescription")})]})})]})}const KGt="_Container_1bl61_1",GGt="_Track_1bl61_16",XGt="_Thumb_1bl61_56",YGt="_Label_1bl61_78",GA={Container:KGt,Track:GGt,Thumb:XGt,Label:YGt},o9=({className:e,label:t,id:n,disabled:i,labelPosition:r="end",...s})=>{const a=p.useId(),l=n??a;return o.jsxs("div",{className:Ci(GA.Container,e),"data-disabled":i?"":void 0,"data-has-label":t?"":void 0,"data-label-position":r,children:[o.jsx(bct,{id:l,className:GA.Track,disabled:i,...s,children:o.jsx(vct,{className:GA.Thumb})}),t&&o.jsx("label",{htmlFor:l,className:GA.Label,children:t})]})};function Eg({message:e,className:t="",onRetry:n,retryLabel:i,defaultExpanded:r=!0}){const{t:s}=_e("ui"),a=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 o.jsxs("div",{className:`deploy-error-message${l?" is-expanded":""}${t?` ${t}`:""}`,role:"alert",children:[o.jsx("p",{className:"deploy-error-message-text",children:e}),o.jsxs("div",{className:"deploy-error-message-actions",children:[n&&o.jsxs(Dt,{type:"button",className:"deploy-error-retry",color:"danger",variant:"soft",size:"sm",pill:!1,loading:u,onClick:()=>void f(),children:[!u&&o.jsx(lit,{}),u?s("deploymentError.retrying"):a]}),o.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?o.jsx(hit,{}):o.jsx(yit,{})}),o.jsx(rz,{copyValue:e,color:"secondary",variant:"ghost",size:"sm",uniform:!0,pill:!1,title:s("deploymentError.copy"),"aria-label":s("deploymentError.copy")})]})]})}const ZGt={queued:"status.queued",pending:"status.pending",running:"status.running",retrying:"status.retrying",success:"status.success",failed:"status.failed",cancelled:"status.cancelled",skipped:"status.skipped"},KFe=["weekdays.sunday","weekdays.monday","weekdays.tuesday","weekdays.wednesday","weekdays.thursday","weekdays.friday","weekdays.saturday"];function a9(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 JGt(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]),o.jsxs("div",{className:`cronjobs-run-output-body${s?" is-expanded":""}`,children:[o.jsx("p",{id:n,ref:i,children:e}),l?o.jsx(Dt,{type:"button",className:"cronjobs-run-output-toggle",color:"secondary",variant:"ghost",size:"sm",pill:!1,"aria-expanded":s,"aria-controls":n,onClick:()=>a(d=>!d),children:t(s?"actions.collapse":"actions.expand")}):null]})}const c9="Asia/Shanghai",tXt=3e3,nXt=["Asia/Shanghai","Asia/Singapore","Asia/Tokyo","Europe/London","America/Los_Angeles","America/New_York","UTC"];function $t(e,t){return mn.t(e,{ns:"cronjobs",...t})}function iXt(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||c9}catch{return c9}}function rXt(){const e=iXt(),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 sXt(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||c9,enabled:e.enabled}}function oXt({run:e}){const t=e?e.status==="success"?"success":e.status==="failed"?"danger":["queued","pending","running","retrying"].includes(e.status)?"info":"secondary":"secondary";return o.jsx(Lo,{className:"cronjobs-status",color:t,variant:"soft",size:"sm",pill:!0,children:$t(e?ZGt[e.status]:"status.notRun")})}function aoe({job:e,runtimes:t,cloudProvider:n,busy:i,onClose:r,onSubmit:s}){const[a,l]=p.useState(()=>e?sXt(e):rXt()),[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([a.timezone,...nXt])),[a.timezone]),w=p.useMemo(()=>t.map(C=>({value:C.runtimeId,label:C.name,description:Mf(C.region,n)})),[n,t]),O=p.useMemo(()=>KFe.map((C,E)=>({value:String(E),label:$t(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 A;const C=document.body.style.overflow,E=document.activeElement instanceof HTMLElement?document.activeElement:null;document.body.style.overflow="hidden",(A=m.current)==null||A.focus();const N=j=>{var M,P;if(j.key==="Escape"&&!v.current){y.current();return}if(j.key!=="Tab")return;const T=Array.from(((M=h.current)==null?void 0:M.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 R=T[0],_=T[T.length-1],D=document.activeElement;j.shiftKey&&(D===R||!((P=h.current)!=null&&P.contains(D)))?(j.preventDefault(),_.focus()):!j.shiftKey&&D===_&&(j.preventDefault(),R.focus())};return window.addEventListener("keydown",N),()=>{document.body.style.overflow=C,window.removeEventListener("keydown",N),E!=null&&E.isConnected&&E.focus()}},[]);const k=async C=>{C.preventDefault();const E=a.name.trim(),N=a.prompt.trim(),A=t.find(T=>T.runtimeId===a.runtimeId);if(!E)return u($t("validation.nameRequired"));if(!A)return u($t("validation.runtimeRequired"));if(!N)return u($t("validation.promptRequired"));if(a.scheduleType==="once"&&!a.onceAt||(a.scheduleType==="daily"||a.scheduleType==="weekly")&&!a.time)return u($t("validation.timeRequired"));const j=a.cron.trim().split(/\s+/);if(a.scheduleType==="cron"&&j.length!==5)return u($t("validation.cronFields"));u(""),f(!0);try{let T=(e==null?void 0:e.runtimeId)===A.runtimeId?e.agentName.trim():"";if(!T){const[R]=await kC("","",{runtimeId:A.runtimeId,region:A.region});T=(R==null?void 0:R.trim())??""}if(!T)throw new Error($t("validation.runtimeAppMissing"));await s({name:E,runtimeId:A.runtimeId,runtimeName:A.name,agentName:T,region:A.region,prompt:N,enabled:a.enabled,schedule:{type:a.scheduleType,timezone:a.timezone,...a.scheduleType==="once"?{onceAt:a.onceAt}:{},...a.scheduleType==="daily"?{time:a.time}:{},...a.scheduleType==="weekly"?{time:a.time,weekday:a.weekday}:{},...a.scheduleType==="cron"?{cron:a.cron.trim()}:{}}})}catch(T){u(T instanceof Error?T.message:String(T)),window.requestAnimationFrame(()=>{var R;return(R=g.current)==null?void 0:R.focus()})}finally{f(!1)}};return o.jsx("div",{className:"cronjobs-drawer-backdrop",onMouseDown:C=>{C.target===C.currentTarget&&!b&&r()},children:o.jsxs("aside",{ref:h,className:"cronjobs-drawer",role:"dialog","aria-modal":"true","aria-labelledby":"cronjobs-drawer-title",children:[o.jsxs("header",{className:"cronjobs-drawer-head",children:[o.jsxs("div",{children:[o.jsx("h2",{id:"cronjobs-drawer-title",children:$t(e?"drawer.editTitle":"drawer.createTitle")}),o.jsx("p",{children:$t("drawer.description")})]}),o.jsx(Dt,{type:"button",color:"secondary",variant:"ghost",size:"lg",uniform:!0,pill:!1,onClick:r,disabled:b,"aria-label":$t("actions.closeDrawer"),children:o.jsx(mQ,{})})]}),o.jsxs("form",{className:"cronjobs-form",onSubmit:C=>void k(C),children:[o.jsxs("div",{className:"cronjobs-form-scroll",children:[o.jsxs("label",{className:"cronjobs-field",children:[o.jsx("span",{children:$t("fields.name")}),o.jsx(hs,{ref:m,size:"lg",value:a.name,maxLength:80,invalid:!!c&&!a.name.trim(),onChange:C=>l({...a,name:C.target.value}),placeholder:$t("fields.namePlaceholder")})]}),o.jsxs("label",{className:"cronjobs-field",children:[o.jsx("span",{children:$t("fields.runtimeAgent")}),o.jsx(Zs,{value:a.runtimeId,options:w,size:"lg",disabled:t.length===0,placeholder:$t(t.length?"fields.runtimePlaceholder":"fields.noRuntime"),onChange:C=>l({...a,runtimeId:C.value})}),o.jsx("small",{children:$t("fields.runtimeHelp")})]}),o.jsxs("label",{className:"cronjobs-field",children:[o.jsx("span",{children:$t("fields.prompt")}),o.jsx(Sg,{value:a.prompt,rows:5,maxRows:10,autoResize:!0,maxLength:2e4,invalid:!!c&&!a.prompt.trim(),onChange:C=>l({...a,prompt:C.target.value}),placeholder:$t("fields.promptPlaceholder")}),o.jsxs("small",{className:"cronjobs-character-count",children:[a.prompt.length.toLocaleString()," / 20,000"]})]}),o.jsxs("fieldset",{className:"cronjobs-fieldset",children:[o.jsx("legend",{children:$t("fields.schedule")}),o.jsxs(Ru,{className:"cronjobs-schedule-types",value:a.scheduleType,size:"lg",block:!0,"aria-label":$t("fields.scheduleType"),onChange:C=>l({...a,scheduleType:C}),children:[o.jsx(Ru.Option,{value:"once",children:$t("scheduleTypes.once")}),o.jsx(Ru.Option,{value:"daily",children:$t("scheduleTypes.daily")}),o.jsx(Ru.Option,{value:"weekly",children:$t("scheduleTypes.weekly")}),o.jsx(Ru.Option,{value:"cron",children:"Cron"})]}),a.scheduleType==="once"?o.jsxs("label",{className:"cronjobs-field",children:[o.jsx("span",{children:$t("fields.runAt")}),o.jsx(hs,{size:"lg",type:"datetime-local",value:a.onceAt,onChange:C=>l({...a,onceAt:C.target.value})})]}):null,a.scheduleType==="daily"?o.jsxs("label",{className:"cronjobs-field",children:[o.jsx("span",{children:$t("fields.dailyTime")}),o.jsx(hs,{size:"lg",type:"time",value:a.time,onChange:C=>l({...a,time:C.target.value})})]}):null,a.scheduleType==="weekly"?o.jsxs("div",{className:"cronjobs-inline-fields",children:[o.jsxs("label",{className:"cronjobs-field",children:[o.jsx("span",{children:$t("fields.weekday")}),o.jsx(Zs,{value:String(a.weekday),options:O,size:"lg",onChange:C=>l({...a,weekday:Number(C.value)})})]}),o.jsxs("label",{className:"cronjobs-field",children:[o.jsx("span",{children:$t("fields.runAt")}),o.jsx(hs,{size:"lg",type:"time",value:a.time,onChange:C=>l({...a,time:C.target.value})})]})]}):null,a.scheduleType==="cron"?o.jsxs("label",{className:"cronjobs-field",children:[o.jsx("span",{children:$t("fields.cronExpression")}),o.jsx(hs,{size:"lg",value:a.cron,onChange:C=>l({...a,cron:C.target.value}),placeholder:"0 9 * * *"}),o.jsx("small",{children:$t("fields.cronHelp")})]}):null,o.jsxs("label",{className:"cronjobs-field",children:[o.jsx("span",{children:$t("fields.timezone")}),o.jsx(Zs,{value:a.timezone,options:S,size:"lg",onChange:C=>l({...a,timezone:C.value})})]})]}),o.jsxs("div",{className:"cronjobs-switch-row",children:[o.jsxs("span",{children:[o.jsx("strong",{children:$t("fields.enableAfterCreate")}),o.jsx("small",{children:$t("fields.enableHelp")})]}),o.jsx(o9,{checked:a.enabled,onCheckedChange:C=>l({...a,enabled:C}),"aria-label":$t("fields.enableAfterCreate")})]}),c?o.jsx("div",{ref:g,className:"cronjobs-inline-error",tabIndex:-1,children:o.jsx(Ty,{color:"danger",variant:"soft",description:c})}):null]}),o.jsxs("footer",{className:"cronjobs-drawer-actions",children:[o.jsx(Dt,{type:"button",color:"secondary",variant:"ghost",size:"lg",pill:!1,onClick:r,disabled:b,children:$t("actions.cancel")}),o.jsx(Dt,{type:"submit",color:"primary",size:"lg",pill:!1,loading:b,disabled:t.length===0,"aria-busy":b||void 0,children:$t(d?"actions.connectingRuntime":i?"actions.saving":e?"actions.saveChanges":"actions.createTask")})]})]})]})})}function aXt({jobs:e,canCreate:t,onCreate:n,onSelect:i}){return o.jsxs(n0,{children:[o.jsx(hg,{icon:o.jsx(tAe,{}),onClick:n,disabled:!t,title:$t(t?"actions.createScheduledTask":"fields.noRuntime"),children:$t("actions.createScheduledTask")}),e.map(r=>{const s=GFe(r.schedule);return o.jsx(r0,{className:"cronjobs-card",title:r.name,status:o.jsx(Lo,{color:r.enabled?"success":"secondary",variant:"soft",size:"sm",pill:!0,children:$t(r.enabled?"status.enabled":"status.paused")}),description:r.prompt,metadata:[{label:$t("fields.schedule"),value:s,title:s}],detailAction:{label:$t("actions.viewDetails"),onClick:()=>i(r)}},r.jobId)})]})}function lXt({job:e,runs:t,runsLoading:n,runsError:i,busyAction:r,onBack:s,onEdit:a,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")??(l9(e)?e.latestRun:void 0),g=r.includes(e.jobId);return o.jsxs("div",{className:"cronjobs-detail",children:[o.jsxs("header",{className:"cronjobs-detail-head",children:[o.jsxs("div",{className:"cronjobs-detail-title",children:[o.jsx(Dt,{type:"button",color:"secondary",variant:"ghost",size:"lg",uniform:!0,pill:!1,onClick:s,"aria-label":$t("actions.backToList"),children:o.jsx(oit,{})}),o.jsxs("div",{children:[o.jsx("h1",{children:e.name}),o.jsxs("p",{children:[e.runtimeName||e.agentName," · ",GFe(e.schedule)]})]})]}),o.jsxs("div",{className:"cronjobs-detail-actions",children:[o.jsxs(Dt,{type:"button",color:"secondary",variant:"outline",size:"lg",pill:!1,onClick:a,disabled:g,children:[o.jsx(bit,{}),$t("actions.edit")]}),o.jsxs(Dt,{type:"button",color:"secondary",variant:"outline",size:"lg",pill:!1,onClick:l,disabled:g,children:[e.enabled?o.jsx(kit,{}):o.jsx(sZ,{}),$t(e.enabled?"actions.pause":"actions.enable")]}),m?o.jsxs(Dt,{type:"button",color:"danger",variant:"soft",size:"lg",pill:!1,onClick:()=>d(m),disabled:g||!!m.cancellationRequestedAt,children:[o.jsx(Ait,{}),$t(m.cancellationRequestedAt?m.status==="queued"?"actions.cancelling":"actions.stopping":m.status==="queued"?"actions.cancelQueue":"actions.stopRun")]}):o.jsxs(Dt,{type:"button",color:"primary",size:"lg",pill:!1,onClick:c,disabled:g||!e.enabled,children:[o.jsx(sZ,{}),$t("actions.runNow")]}),o.jsx(po,{compact:!0,content:$t(m?m.status==="queued"?"actions.cancelQueueFirst":"actions.stopRunFirst":"actions.deleteTask"),children:o.jsxs(Dt,{type:"button",color:"danger",variant:"ghost",size:"lg",pill:!1,onClick:u,disabled:g||!!m,"aria-label":$t("actions.deleteTask"),children:[o.jsx(pit,{}),$t("actions.delete")]})})]})]}),o.jsxs("div",{className:"cronjobs-detail-scroll",children:[o.jsxs("section",{className:"cronjobs-summary-grid","aria-label":$t("detail.configuration"),children:[o.jsxs("dl",{children:[o.jsxs("div",{children:[o.jsx("dt",{children:$t("detail.status")}),o.jsx("dd",{children:$t(e.enabled?"status.enabled":"status.paused")})]}),o.jsxs("div",{children:[o.jsx("dt",{children:$t("detail.nextRun")}),o.jsx("dd",{children:e.enabled?a9(e.nextRunAt):"-"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:$t("detail.runtime")}),o.jsx("dd",{title:e.runtimeName,children:e.runtimeName})]}),o.jsxs("div",{children:[o.jsx("dt",{children:$t("detail.region")}),o.jsx("dd",{children:e.region})]})]}),o.jsxs("div",{className:"cronjobs-prompt",children:[o.jsx("span",{children:$t("fields.prompt")}),o.jsx("p",{children:e.prompt})]})]}),o.jsxs("section",{className:"cronjobs-history",children:[o.jsxs("header",{children:[o.jsxs("div",{children:[o.jsx("h2",{children:$t("history.title")}),o.jsx("p",{children:$t("history.description")})]}),o.jsx(po,{compact:!0,content:$t("actions.refresh"),children:o.jsx(Dt,{type:"button",color:"secondary",variant:"ghost",size:"lg",uniform:!0,pill:!1,onClick:h,disabled:n,"aria-label":$t("actions.refreshHistory"),children:o.jsx(hP,{})})})]}),n&&t.length===0?o.jsx(za,{}):i?o.jsx(Ty,{className:"cronjobs-history-alert",color:"danger",variant:"soft",title:$t("history.loadFailed"),description:i,actions:o.jsx(Dt,{type:"button",color:"danger",variant:"soft",size:"sm",pill:!1,onClick:h,children:$t("actions.retry")})}):t.length===0?o.jsxs(Pn,{className:"cronjobs-history-state",fill:"none",children:[o.jsx(Pn.Icon,{children:o.jsx(pQ,{})}),o.jsx(Pn.Title,{children:$t("history.emptyTitle")}),o.jsx(Pn.Description,{children:$t("history.emptyDescription")})]}):o.jsx("div",{className:"cronjobs-runs",children:t.map(b=>o.jsxs("article",{className:"cronjobs-run",children:[o.jsxs("div",{className:"cronjobs-run-main",children:[o.jsx(oXt,{run:b}),o.jsxs("div",{children:[o.jsx("strong",{children:a9(b.startedAt||b.scheduledAt)}),o.jsxs("span",{children:[$t("history.duration",{duration:JGt(b)}),b.runtimeVersion?` · Runtime v${b.runtimeVersion}`:""]})]})]}),b.sessionId?o.jsxs("div",{className:"cronjobs-run-meta",children:[o.jsx("span",{children:$t("history.session")}),o.jsx("strong",{title:b.sessionId,children:b.sessionId})]}):null,b.output?o.jsxs("div",{className:"cronjobs-run-output",children:[o.jsx("span",{children:$t("history.finalAnswer")}),o.jsx(eXt,{output:b.output})]}):null,b.error?o.jsxs("div",{className:"cronjobs-run-output is-error",children:[o.jsx("span",{children:$t("history.errorDetails")}),o.jsx(Eg,{message:b.error,className:"cronjobs-run-error-detail",defaultExpanded:!1,onRetry:b.status==="failed"?f:void 0,retryLabel:$t("actions.rerun")})]}):null,b.status==="queued"||b.status==="running"||b.status==="retrying"||b.status==="pending"?o.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:$t(b.cancellationRequestedAt?"actions.stopping":b.status==="queued"?"actions.cancelQueue":"actions.stop")}):null]},b.runId))})]})]})]})}function cXt({cloudProvider:e}){_e("cronjobs");const[t,n]=p.useState([]),[i,r]=p.useState([]),[s,a]=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(""),[N,A]=p.useState(null),[j,T]=p.useState(""),R=t.find(H=>H.jobId===u),_=S==="all"?t:t.filter(H=>S==="enabled"?H.enabled:!H.enabled),D=p.useCallback(async H=>{a(!0),c("");try{const[X,ie]=await Promise.all([X$(H),Qw({scope:"all",region:"all",pageSize:100})]);if(H!=null&&H.aborted)return;n(X),r(ie.runtimes.filter(Q=>Q.status.toLowerCase()==="ready"))}catch(X){if(H!=null&&H.aborted)return;console.warn("Unable to load scheduled tasks",X),c($t("page.loadFailedDescription"))}finally{H!=null&&H.aborted||a(!1)}},[]);p.useEffect(()=>{const H=new AbortController;return D(H.signal),()=>H.abort()},[D]);const M=p.useCallback(async(H,X)=>{v(!0),x("");try{const ie=await Y$(H,X);X!=null&&X.aborted||g(ie)}catch(ie){X!=null&&X.aborted||(console.warn("Unable to load scheduled-task history",ie),x($t("history.loadFailedDescription")))}finally{X!=null&&X.aborted||v(!1)}},[]);p.useEffect(()=>{if(!u){g([]),x("");return}const H=new AbortController;return M(u,H.signal),()=>H.abort()},[M,u]);const P=t.some(l9);p.useEffect(()=>{!P&&C===$t("notices.queued")&&E("")},[P,C]),p.useEffect(()=>{if(!P)return;const H=new AbortController,X=async()=>{try{const[Q,Z]=await Promise.all([X$(H.signal),u?Y$(u,H.signal):Promise.resolve(null)]);if(H.signal.aborted)return;n(Q),Z&&g(Z),Q.some(l9)||E("")}catch(Q){H.signal.aborted||E(Q instanceof Error?Q.message:String(Q))}},ie=window.setInterval(()=>void X(),tXt);return()=>{window.clearInterval(ie),H.abort()}},[P,u]);const L=H=>n(X=>X.some(ie=>ie.jobId===H.jobId)?X.map(ie=>ie.jobId===H.jobId?H:ie):[H,...X]),F=async(H,X,ie,Q=!1)=>{O(H),E("");try{await X(),E(ie)}catch(Z){const ue=Z instanceof Error?Z.message:String(Z);if(Q)throw new Error(ue);E(ue)}finally{O("")}},I=async H=>{const X=f??null;await F(`${(X==null?void 0:X.jobId)??"new"}:save`,async()=>{const ie=X?await QCe(X.jobId,H):await UCe(H);L(ie),h(void 0),X&&d(ie.jobId)},$t(X?"notices.updated":"notices.created"),!0)},z=H=>void F(`${H.jobId}:toggle`,async()=>L(await zCe(H.jobId,!H.enabled)),$t(H.enabled?"notices.paused":"notices.enabled")),K=(H,X)=>F(`${H.jobId}:run`,async()=>{const ie=await VCe(H.jobId);L({...H,latestRun:ie}),u===H.jobId&&g(Q=>[ie,...Q.filter(Z=>Z.runId!==ie.runId)])},X),B=H=>void K(H,$t("notices.queued")),W=()=>{if(!N)return;T("");const H=N;H.kind==="delete"?F(`${H.job.jobId}:delete`,async()=>{await qCe(H.job.jobId),n(X=>X.filter(ie=>ie.jobId!==H.job.jobId)),d(""),A(null)},$t("notices.deleted"),!0).catch(X=>{T(X instanceof Error?X.message:String(X))}):F(`${H.job.jobId}:cancel`,async()=>{var ie;const X=await HCe(H.job.jobId,H.run.runId);g(Q=>Q.map(Z=>Z.runId===X.runId?X:Z)),L({...H.job,latestRun:((ie=H.job.latestRun)==null?void 0:ie.runId)===X.runId?X:H.job.latestRun}),A(null)},$t("notices.cancelRequested"),!0).catch(X=>{T(X instanceof Error?X.message:String(X))})};return R?o.jsxs($f,{className:"cronjobs-page","aria-label":$t("detail.pageLabel"),children:[o.jsx(lXt,{job:R,runs:m,runsLoading:b,runsError:y,busyAction:w,onBack:()=>d(""),onEdit:()=>h(R),onToggle:()=>z(R),onRun:()=>B(R),onDelete:()=>{T(""),A({kind:"delete",job:R})},onCancel:H=>{T(""),A({kind:"cancel",job:R,run:H})},onRetryRun:()=>K(R,$t("notices.requeued")),onRetryRuns:()=>void M(R.jobId)}),C?o.jsx("div",{className:"cronjobs-notice",role:"status",children:o.jsx(Ty,{color:"info",variant:"soft",description:C})}):null,f!==void 0?o.jsx(aoe,{job:f,runtimes:i,cloudProvider:e,busy:w.endsWith(":save"),onClose:()=>h(void 0),onSubmit:I}):null,N?o.jsx(Xu,{title:$t(N.kind==="delete"?"confirm.deleteTitle":"confirm.cancelTitle"),description:N.kind==="delete"?$t("confirm.deleteDescription",{name:N.job.name}):$t("confirm.cancelDescription"),error:j,confirmLabel:$t(N.kind==="delete"?"actions.deleteTask":"actions.stop"),variant:"danger",busy:w.endsWith(N.kind),onCancel:()=>{T(""),A(null)},onConfirm:W}):null]}):o.jsxs($f,{className:"cronjobs-page","aria-label":$t("page.title"),children:[o.jsx(Jy,{className:"cronjobs-page-head",title:$t("page.title")}),o.jsx(e0,{children:o.jsx(t0,{idPrefix:"cronjobs-filter",ariaLabel:$t("page.filterLabel"),value:S,items:[{id:"all",label:$t("filters.all")},{id:"enabled",label:$t("status.enabled")},{id:"paused",label:$t("status.paused")}],onChange:k})}),C?o.jsx("div",{className:"cronjobs-banner",role:"status",children:o.jsx(Ty,{color:"info",variant:"soft",description:C})}):null,o.jsx(Pg,{"aria-label":$t("page.listLabel"),children:s&&t.length===0?o.jsx(za,{}):l?o.jsxs(Pn,{className:"cronjobs-state",fill:"none",children:[o.jsx(Pn.Icon,{color:"danger",children:o.jsx(pQ,{})}),o.jsx(Pn.Title,{color:"danger",children:$t("page.loadFailed")}),o.jsx(Pn.Description,{children:l}),o.jsx(Pn.ActionRow,{children:o.jsxs(Dt,{type:"button",color:"secondary",variant:"outline",size:"lg",pill:!1,onClick:()=>void D(),children:[o.jsx(hP,{}),$t("actions.retry")]})})]}):o.jsx(aXt,{jobs:_,canCreate:!s&&i.length>0,onCreate:()=>h(null),onSelect:H=>d(H.jobId)})}),f!==void 0?o.jsx(aoe,{job:f,runtimes:i,cloudProvider:e,busy:w.endsWith(":save"),onClose:()=>h(void 0),onSubmit:I}):null]})}const uXt={volcengine:"https://console.volcengine.com",byteplus:"https://console.byteplus.com"};function eC(e){return e.trim()}function Oq(e){return uXt[e]}function dXt(e){const t=eC(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 fXt(e,t){const n=dXt(t);if(!n)return null;const i=new URLSearchParams({id:n.bucket,region:n.region,type:"objects"});return`${Oq(e)}/tos/bucket/setting?${i.toString()}`}function hXt(e,t,n){const i=eC(t),r=eC(n);return!i||!r?null:`${Oq(e)}/agentkit/region:agentkit+${encodeURIComponent(i)}/builtintools/${encodeURIComponent(r)}/detail`}function pXt(e,t,n){const i=eC(t),r=eC(n);return!i||!r?null:`${Oq(e)}/identity/region:identity+${encodeURIComponent(i)}/user-pools/${encodeURIComponent(r)}/info`}function jO({href:e,label:t,children:n}){return e?o.jsxs("a",{className:"system-info-resource-link",href:e,target:"_blank",rel:"noreferrer","aria-label":t,title:t,children:[o.jsx("span",{children:n}),o.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[o.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"}),o.jsx("path",{d:"M10.25 3.75h6v6M16 4 9 11"})]})]}):o.jsx("span",{children:n})}function mXt(e){return e instanceof Error&&e.message.includes("Volcengine credentials not found")}function gXt({spinning:e}){return o.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:o.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 bXt(){return{busy:!1,error:"",message:""}}function yXt({version:e,localMode:t,role:n,provider:i,region:r,onBack:s}){const{t:a}=_e("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,N]=p.useState(!0),[A,j]=p.useState(""),[T,R]=p.useState(0),[_,D]=p.useState(0),[M,P]=p.useState(0),L=p.useRef(!1),[F,I]=p.useState({}),[z,K]=p.useState({}),[B,W]=p.useState(""),[H,X]=p.useState(!0),ie=p.useRef(new Set),Q=p.useRef(0),Z=`${i}:${r}`,ue=p.useRef(Z);ue.current=Z,p.useEffect(()=>{K({}),I({})},[Z]),p.useEffect(()=>(L.current=!0,()=>{L.current=!1}),[]);function Ee(G,te){I(de=>({...de,[G]:{...bXt(),...de[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 de=await lTe(G.kind);if(!L.current||ue.current!==te)return;Q.current+=1,K(Ce=>({...Ce,[G.toolId]:de.state})),Ee(G.toolId,{busy:!1,error:"",message:de.updated?a("systemInfo.modelEnvUpdated"):a("systemInfo.modelEnvAlreadyCurrent")})}catch{if(!L.current||ue.current!==te)return;Q.current+=1,Ee(G.toolId,{busy:!1,error:a("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),aTe(G.signal).then(de=>{G.signal.aborted||te!==Q.current||K(Object.fromEntries(de.map(Ce=>[Ce.toolId,Ce])))}).catch(()=>{!G.signal.aborted&&te===Q.current&&W(a("systemInfo.versionCheckError"))}).finally(()=>{G.signal.aborted||X(!1)}),()=>G.abort()},[l,i,r,T]),p.useEffect(()=>{if(!Object.values(z).some(te=>te.status==="Updating"||te.status==="Creating"))return;const G=window.setTimeout(()=>R(te=>te+1),5e3);return()=>window.clearTimeout(G)},[z]),p.useEffect(()=>{if(!l){u(""),f([]),y(!1),w("");return}const G=new AbortController;return y(!0),w(""),aCe(G.signal).then(te=>{G.signal.aborted||(u(te.storage.tosAddress),f(te.sandboxTools))}).catch(te=>{(te==null?void 0:te.name)!=="AbortError"&&w(a("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(""),KI(G.signal).then(te=>{m(te.filter(de=>de.isCurrent))}).catch(te=>{if((te==null?void 0:te.name)!=="AbortError"){if(t&&mXt(te)){m([]);return}C(a("systemInfo.userPoolError"))}}).finally(()=>{G.signal.aborted||S(!1)}),()=>G.abort()},[l,t,_]),p.useEffect(()=>{if(!l){b(null),N(!1),j("");return}const G=new AbortController;return N(!0),j(""),CCe(G.signal).then(b).catch(te=>{(te==null?void 0:te.name)!=="AbortError"&&j(a("systemInfo.environmentResourcesError"))}).finally(()=>{G.signal.aborted||N(!1)}),()=>G.abort()},[l,M]),o.jsxs("div",{className:"system-info-page",children:[o.jsxs("header",{className:"system-info-page-header",children:[o.jsx(fP,{label:a("common.back"),onClick:s}),o.jsxs("div",{children:[o.jsx("h1",{children:a("systemInfo.title")}),o.jsx("p",{children:a("systemInfo.description")})]})]}),o.jsxs("div",{className:"system-info-scroll",children:[o.jsxs("section",{className:"system-info-section","aria-labelledby":"studio-info-title",children:[o.jsx("h2",{id:"studio-info-title",children:a("systemInfo.general")}),o.jsx("dl",{className:"system-info-summary",children:o.jsxs("div",{children:[o.jsx("dt",{children:a("systemInfo.currentVersion")}),o.jsx("dd",{children:e||"—"})]})})]}),l?o.jsxs(o.Fragment,{children:[o.jsxs("section",{className:"system-info-section","aria-labelledby":"storage-info-title",children:[o.jsx("h2",{id:"storage-info-title",children:a("systemInfo.storage")}),v?o.jsx("div",{className:"system-info-loading",role:"status","aria-live":"polite",children:o.jsx(bn,{as:"span",children:a("systemInfo.loadingStorage")})}):x?o.jsxs("div",{className:"system-info-error",role:"alert",children:[o.jsx("p",{children:x}),o.jsx("button",{type:"button",onClick:()=>R(G=>G+1),children:a("common.reload")})]}):o.jsx("dl",{className:"system-info-summary",children:o.jsxs("div",{className:"system-info-resource-row",children:[o.jsx("dt",{children:a("systemInfo.tosAddress")}),o.jsx("dd",{className:`system-info-resource-value${c?"":" is-empty"}`,children:o.jsx(jO,{href:fXt(i,c),label:a("systemInfo.openTosConsole"),children:c||a("common.notConfigured")})})]})})]}),o.jsxs("section",{className:"system-info-section","aria-labelledby":"environment-build-info-title",children:[o.jsx("h2",{id:"environment-build-info-title",children:a("systemInfo.environmentBuild")}),E?o.jsx("div",{className:"system-info-loading",role:"status","aria-live":"polite",children:o.jsx(bn,{as:"span",children:a("systemInfo.loadingEnvironmentResources")})}):A?o.jsxs("div",{className:"system-info-error",role:"alert",children:[o.jsx("p",{children:A}),o.jsx("button",{type:"button",onClick:()=>P(G=>G+1),children:a("common.reload")})]}):g?o.jsxs("dl",{className:"system-info-summary",children:[o.jsxs("div",{className:"system-info-resource-row",children:[o.jsx("dt",{children:a("systemInfo.codePipelineWorkspace")}),o.jsx("dd",{className:"system-info-resource-value",children:o.jsx(jO,{href:g.codePipeline.consoleUrl||null,label:a("systemInfo.openCodePipelineWorkspace"),children:g.codePipeline.workspaceName||g.codePipeline.workspaceId||a("systemInfo.createdOnFirstBuild")})})]}),o.jsxs("div",{className:"system-info-resource-row",children:[o.jsx("dt",{children:a("systemInfo.codePipelinePipeline")}),o.jsx("dd",{className:"system-info-resource-value",children:g.codePipeline.pipelineName||g.codePipeline.pipelineId||a("systemInfo.createdOnFirstBuild")})]}),o.jsxs("div",{className:"system-info-resource-row",children:[o.jsx("dt",{children:a("systemInfo.containerRegistryRepository")}),o.jsx("dd",{className:"system-info-resource-value",children:o.jsx(jO,{href:g.containerRegistry.consoleUrl||null,label:a("systemInfo.openContainerRegistryRepository"),children:g.containerRegistry.imageRepository||[g.containerRegistry.registry,g.containerRegistry.namespace,g.containerRegistry.repository].filter(Boolean).join("/")||a("systemInfo.createdOnFirstBuild")})})]})]}):null]}),o.jsxs("section",{className:"system-info-section","aria-labelledby":"sandbox-tool-title",children:[o.jsx("h2",{id:"sandbox-tool-title",children:a("systemInfo.sandboxInfo")}),o.jsx("button",{type:"button",className:"system-info-refresh",disabled:H,onClick:()=>R(G=>G+1),children:a(H?"systemInfo.checkingVersions":"systemInfo.checkUpdates")}),v?o.jsx("div",{className:"system-info-loading",role:"status","aria-live":"polite",children:o.jsx(bn,{as:"span",children:a("systemInfo.loadingSandboxInfo")})}):x?o.jsxs("div",{className:"system-info-error",role:"alert",children:[o.jsx("p",{children:x}),o.jsx("button",{type:"button",onClick:()=>R(G=>G+1),children:a("common.reload")})]}):o.jsxs("div",{className:"system-info-tool-list",children:[B?o.jsx("span",{className:"system-info-inline-error",role:"alert",children:B}):null,d.map(G=>{var fe;const te=z[G.toolId],de=F[G.toolId],Ce=!!G.toolId&&!!(te!=null&&te.canUpdate),le=(de==null?void 0:de.error)||(te!=null&&te.error?a("systemInfo.versionCheckError"):te!=null&&te.modelEnvError?a("systemInfo.modelEnvRepairUnavailable"):"");return o.jsx("dl",{className:"system-info-tool",children:o.jsxs("div",{className:"system-info-resource-row",children:[o.jsxs("dt",{className:"system-info-tool-label",children:[o.jsx("span",{children:G.label}),G.snapshot?o.jsx("span",{className:"system-info-tool-badge",children:a("systemInfo.snapshot")}):null]}),o.jsxs("dd",{className:`system-info-resource-value${G.toolId?"":" is-empty"}`,children:[o.jsx(jO,{href:hXt(i,(te==null?void 0:te.region)||r,G.toolId),label:a("systemInfo.openToolConsole",{name:G.label}),children:G.toolId||a("common.notConfigured")}),Ce?o.jsx("button",{type:"button",className:"system-info-resource-update",disabled:de==null?void 0:de.busy,"aria-busy":(de==null?void 0:de.busy)||void 0,"aria-label":a("systemInfo.updateSandbox",{name:G.label,variant:G.snapshot?a("systemInfo.snapshotWithSpace"):""}),title:a("systemInfo.updateSandbox",{name:G.label,variant:G.snapshot?a("systemInfo.snapshotWithSpace"):""}),onClick:()=>void Y(G),children:o.jsx(gXt,{spinning:(de==null?void 0:de.busy)||!1})}):null,te!=null&&te.currentImage?o.jsxs("span",{className:"system-info-inline-status",title:`${te.currentImage} → ${te.latestImage}`,children:[te.currentImage.split(":").pop(),te.needsImageUpdate?` → ${(fe=te.latestImage)==null?void 0:fe.split(":").pop()}`:"",te.status==="Updating"?` · ${a("systemInfo.updatingSandbox")}`:""]}):null,de!=null&&de.message?o.jsx("span",{className:"system-info-inline-status",role:"status",children:de.message}):null,le?o.jsx("span",{className:"system-info-inline-error",role:"alert",children:le}):null]})]})},G.kind)})]})]}),o.jsxs("section",{className:"system-info-section","aria-labelledby":"user-pool-title",children:[o.jsx("h2",{id:"user-pool-title",children:a("systemInfo.userPool")}),O?o.jsx("div",{className:"system-info-loading",role:"status","aria-live":"polite",children:o.jsx(bn,{as:"span",children:a("systemInfo.loadingUserPool")})}):k?o.jsxs("div",{className:"system-info-error",role:"alert",children:[o.jsx("p",{children:k}),o.jsx("button",{type:"button",onClick:()=>D(G=>G+1),children:a("common.reload")})]}):h.length>0?o.jsx("div",{className:"system-info-pool-list",children:h.map(G=>o.jsxs("dl",{className:"system-info-pool",children:[o.jsxs("div",{children:[o.jsx("dt",{children:a("common.name")}),o.jsx("dd",{className:"system-info-resource-value",children:o.jsx(jO,{href:pXt(i,G.region||r,G.uid),label:a("systemInfo.openUserPoolConsole",{name:G.name||""}),children:G.name||a("systemInfo.unnamedUserPool")})})]}),o.jsxs("div",{children:[o.jsx("dt",{children:a("systemInfo.id")}),o.jsx("dd",{children:G.uid||"—"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:a("systemInfo.domain")}),o.jsx("dd",{children:G.domain||"—"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:a("systemInfo.region")}),o.jsx("dd",{children:G.region||"—"})]})]},G.uid))}):o.jsx("p",{className:"system-info-empty",children:a(t?"systemInfo.noLocalUserPool":"systemInfo.noUserPool")})]})]}):null]})]})}const vXt="_TextLink_16uec_1",xXt={TextLink:vXt},XA=e=>{const{children:t,primary:n=!1,underline:i=!n,className:r,target:s,forceExternal:a,as:l,href:c,to:u,...d}=e,f=a??/^https?:\/\//.test(c??u??""),h=Aje(),m=l||(f?"a":h),g={...d,className:Ci(xXt.TextLink,r),"data-primary":n?"":void 0,"data-underline":i?"":void 0};if(!c&&!u)return o.jsx("span",{...g,role:"button",children:t});const b={...f?{target:"_blank",rel:"noopener noreferrer",href:c??u}:{href:c,to:u},...g};return o.jsx(m,{...b,children:t})},wXt="/assets/media/article-agent-workflow-GXPkXUjV.webp",OXt="/assets/media/article-tool-debugging-BxiMDz_8.webp",kXt="/assets/media/showcase-a2ui-BgBnE9RT.webp",SXt="/assets/media/showcase-customer-service-DNw0mUH1.webp",EXt="/assets/media/showcase-multimodal-BRTl8NLI.webp",CXt="/assets/media/showcase-research-assistant-CbfMFfhS.webp",TXt="/assets/media/showcase-web-search-D2kl1imN.webp",AXt={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 _Xt(e){return AXt[e]}const jXt=[{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"}],NXt="https://volcengine.github.io/veadk-python/",RXt="https://volcengine.github.io/agentkit-sdk-python/content/2.agentkit-cli/1.overview.html",IXt=[{id:"veadk-development",titleKey:"developerResources.articles.veadkDevelopment.title",descriptionKey:"developerResources.articles.veadkDevelopment.description",meta:"AgentKit · VeADK",image:wXt,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:OXt,href:"https://docs.volcengine.com/docs/86681/1844871?lang=zh"}],PXt=[{id:"research-assistant",titleKey:"developerResources.showcases.researchAssistant.title",descriptionKey:"developerResources.showcases.researchAssistant.description",image:CXt,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:EXt,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:SXt,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:TXt,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:kXt,href:"https://github.com/volcengine/veadk-python/tree/main/examples/a2ui_agent"}];function DXt({cloudProvider:e}){const{t}=_e("workspaceTools"),n=_Xt(e);return o.jsxs($f,{className:"developer-resources","aria-label":t("developerResources.title"),children:[o.jsx(Jy,{title:t("developerResources.title")}),o.jsx("div",{className:"developer-resources__content",children:jXt.map(i=>o.jsxs("section",{className:"developer-resources__section","aria-labelledby":`developer-resources-${i.id}`,children:[o.jsxs("header",{className:"developer-resources__section-header",children:[o.jsx("h2",{id:`developer-resources-${i.id}`,children:t(i.titleKey)}),o.jsx("p",{children:t(i.descriptionKey)})]}),i.id==="documentation"?o.jsxs("ul",{className:"developer-resources__links",children:[o.jsx("li",{children:o.jsxs(XA,{className:"developer-resources__link",primary:!0,underline:!0,href:NXt,target:"_blank",rel:"noreferrer",children:[t("developerResources.links.veadkDocs"),o.jsx(I2,{"aria-hidden":"true"})]})}),o.jsx("li",{children:o.jsxs(XA,{className:"developer-resources__link",primary:!0,underline:!0,href:RXt,target:"_blank",rel:"noreferrer",children:[t("developerResources.links.cliDocs"),o.jsx(I2,{"aria-hidden":"true"})]})}),o.jsx("li",{children:o.jsxs(XA,{className:"developer-resources__link",primary:!0,underline:!0,href:n.docs,target:"_blank",rel:"noreferrer",children:[t("developerResources.links.platformDocs"),o.jsx(I2,{"aria-hidden":"true"})]})}),o.jsx("li",{children:o.jsxs(XA,{className:"developer-resources__link",primary:!0,underline:!0,href:n.console,target:"_blank",rel:"noreferrer",children:[t("developerResources.links.console"),o.jsx(I2,{"aria-hidden":"true"})]})})]}):i.id==="best-practices"?o.jsx("div",{className:"developer-resources__articles",children:IXt.map(r=>o.jsxs("a",{className:"developer-resources__article",href:r.href,target:"_blank",rel:"noreferrer",children:[o.jsx("img",{src:r.image,alt:t("developerResources.articles.coverAlt",{title:t(r.titleKey)}),loading:"lazy"}),o.jsxs("span",{className:"developer-resources__article-copy",children:[o.jsx("strong",{children:t(r.titleKey)}),o.jsx("span",{children:t(r.descriptionKey)}),o.jsx("small",{children:r.meta})]})]},r.id))}):i.id==="showcases"?o.jsx("div",{className:"developer-resources__showcases",children:PXt.map(r=>o.jsxs("a",{className:"developer-resources__showcase",href:r.href,target:"_blank",rel:"noreferrer",children:[o.jsx("span",{className:"developer-resources__showcase-media",children:o.jsx("img",{src:r.image,alt:t("developerResources.showcases.previewAlt",{title:t(r.titleKey)}),loading:"lazy"})}),o.jsx("strong",{children:t(r.titleKey)}),o.jsx("span",{children:t(r.descriptionKey)})]},r.id))}):null]},i.id))})]})}function MXt({cloudProvider:e,onPendingCountChange:t,onChanged:n}){const{t:i,i18n:r}=_e("agentReviews"),[s,a]=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(()=>{a(Ki(e))},[e]),p.useEffect(()=>{const C=new AbortController;return d(!0),h(""),rWt(s,C.signal).then(E=>{C.signal.aborted||(c(E.items),t(E.items.filter(N=>N.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=>o.jsx("button",{type:"button",className:"agent-review-name",onClick:()=>O(C),children:C.agent.name})},{key:"submitter",header:i("submitter"),render:C=>o.jsx(YR,{person:C.submitter})},{key:"version",header:i("version"),render:C=>C.agent.version??"—"},{key:"submittedAt",header:i("submittedAt"),render:C=>o.jsx("time",{dateTime:C.submittedAt,children:new Date(C.submittedAt).toLocaleString(r.language)})},{key:"status",header:i("statusTitle"),render:C=>o.jsxs("div",{children:[i(`status.${C.status}`),C.reviewer?o.jsx(YR,{person:C.reviewer}):null]})},{key:"actions",header:i("actions"),render:C=>o.jsx("button",{type:"button",onClick:()=>O(C),children:i(C.status==="pending"?"review":"details")})}];return o.jsxs("div",{className:"agent-review-center","aria-label":i("title"),children:[f?o.jsxs("div",{className:"agent-review-error",role:"alert",children:[o.jsx("p",{children:f}),o.jsx("button",{type:"button",onClick:()=>x(C=>C+1),children:i("refresh")})]}):null,o.jsx(Bz,{rows:S,rowKey:C=>`${C.region}:${C.id}`,columns:k,searchValue:m,onSearchChange:g,searchPlaceholder:i("search"),searchLabel:i("search"),toolbarActions:o.jsxs(o.Fragment,{children:[o.jsx(fg,{id:"agent-review-region",ariaLabel:i("region"),value:s,options:nu(e),onChange:C=>{a(C),c([]),O(null)}}),o.jsx(fg,{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}),o.jsx("button",{type:"button",disabled:u,onClick:()=>x(C=>C+1),children:i("refresh")})]}),emptyLabel:u?o.jsx(za,{}):f?null:o.jsx("p",{className:"agent-review-empty",children:i(m||b!=="all"?"noMatches":"empty")})}),w?o.jsx(vFe,{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 LXt({application:e,decision:t,onClose:n,onDecided:i}){const{t:r}=_e("reviews"),[s,a]=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 tDt({id:e.id,region:e.region,decision:t,reason:s.trim(),comment:l.trim()});i(O)}catch(O){b(xr(O,r("decision.failed")))}finally{m.current=!1,h(!1)}}};return o.jsx(O1,{open:!0,onOpenChange:O=>{!O&&!m.current&&n()},children:o.jsxs(w1,{children:[o.jsx(v1,{className:"review-backdrop"}),o.jsxs(x1,{className:"confirm-box review-decision",finalFocus:()=>{var O;return(O=x.current)!=null&&O.isConnected?x.current:document.getElementById("review-skill-tab")},children:[o.jsx(k1,{className:"confirm-title",children:r(v?"decision.returnTitle":"decision.approveTitle")}),o.jsx(ST,{className:"confirm-text",children:r(v?"decision.returnDescription":"decision.approveDescription",{name:e.name,version:e.version})}),v?o.jsxs("div",{className:"review-decision__field",children:[o.jsx("label",{className:"cw-label",htmlFor:"review-return-reason",children:r("decision.reason")}),o.jsx("textarea",{id:"review-return-reason",className:"cw-input",rows:4,maxLength:256,required:!0,disabled:f,value:s,onChange:O=>a(O.target.value),onBlur:()=>d(!0),"aria-invalid":u&&y,"aria-describedby":"review-return-help"}),o.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,o.jsxs("div",{className:"review-decision__field",children:[o.jsx("label",{className:"cw-label",htmlFor:"review-decision-comment",children:r("decision.comment")}),o.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"}),o.jsx("span",{id:"review-comment-help",className:"cw-help",children:r("decision.commentHelp")})]}),g?o.jsx("div",{role:"alert",className:"review-decision__error",children:o.jsx(ms,{error:g})}):null,o.jsxs("div",{className:"confirm-actions",children:[o.jsx(Dt,{color:"secondary",variant:"outline",size:"md",pill:!1,disabled:f,onClick:n,children:r("actions.cancel")}),o.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 $Xt=p.lazy(()=>Ls(()=>Promise.resolve().then(()=>CHt),void 0).then(e=>({default:e.SkillFileTree})));function FXt({application:e,cloudProvider:t,onClose:n,onDecision:i,onScoreChanged:r}){var O;const{t:s,i18n:a}=_e("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),eDt({id:e.id,region:e.region,signal:S.signal}).then(k=>{S.signal.aborted||d(k.files)}).catch(k=>{S.signal.aborted||g(xr(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(a.language,{hour12:!1}):"—",w=e.submittedAt?new Date(e.submittedAt).toLocaleString(a.language,{hour12:!1}):"—";return o.jsx(O1,{open:!0,onOpenChange:S=>{S||n()},children:o.jsxs(w1,{children:[o.jsx(v1,{className:"review-backdrop"}),o.jsxs(x1,{className:"review-drawer",finalFocus:()=>{var S;return(S=y.current)!=null&&S.isConnected?y.current:document.getElementById("review-skill-tab")},children:[o.jsxs("header",{className:"review-drawer__header",children:[o.jsxs("div",{children:[o.jsx(k1,{children:s("detail.title")}),o.jsx(ST,{children:s("detail.versionFixed")})]}),o.jsx(WD,{className:"review-icon-button","aria-label":s("actions.close"),children:o.jsx(bD,{})})]}),o.jsxs("div",{className:"review-drawer__identity",children:[o.jsx("span",{className:"review-resource-icon",children:o.jsx($je,{})}),o.jsxs("div",{children:[o.jsx("h2",{children:e.name}),o.jsxs("span",{children:[s("kind.skill")," · ",e.version]})]}),o.jsx(ET,{status:e.status})]}),o.jsx(t0,{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}),o.jsx("div",{className:"review-drawer__body",id:"review-detail-panel",role:"tabpanel","aria-labelledby":`review-detail-${l}-tab`,children:l==="score"?o.jsx(sFe,{application:e,canRetry:!0,onScoreChanged:r},`${e.region}:${e.id}`):l==="files"?f?o.jsx(za,{}):m?o.jsxs("div",{role:"alert",children:[o.jsx(ms,{error:m}),o.jsx("button",{type:"button",onClick:()=>v(S=>S+1),children:s("space.retry")})]}):o.jsx("div",{className:"review-files",children:o.jsx(p.Suspense,{fallback:o.jsx(za,{}),children:o.jsx($Xt,{files:u})})}):o.jsxs(o.Fragment,{children:[o.jsxs("dl",{className:"review-facts",children:[o.jsxs("div",{children:[o.jsx("dt",{children:s("columns.submitter")}),o.jsx("dd",{children:e.author||s("detail.unknownAuthor")})]}),o.jsxs("div",{children:[o.jsx("dt",{children:s("columns.submittedAt")}),o.jsx("dd",{children:w})]}),o.jsxs("div",{children:[o.jsx("dt",{children:s("columns.version")}),o.jsx("dd",{children:e.version})]}),o.jsxs("div",{children:[o.jsx("dt",{children:s("detail.source")}),o.jsx("dd",{children:s("detail.source_skill",{name:e.author})})]}),o.jsxs("div",{children:[o.jsx("dt",{children:s("detail.destination")}),o.jsx("dd",{children:s("detail.destination_skill")})]}),o.jsxs("div",{children:[o.jsx("dt",{children:s("detail.region")}),o.jsx("dd",{children:Mf(e.region,t)})]}),o.jsxs("div",{children:[o.jsx("dt",{children:s("detail.visibility")}),o.jsx("dd",{children:s("detail.shared")})]})]}),o.jsxs("section",{className:"review-detail-section",children:[o.jsx("h3",{children:s("detail.description")}),o.jsx("p",{children:e.description||"—"})]}),o.jsxs("section",{className:"review-detail-section",children:[o.jsx("h3",{children:s("detail.result")}),o.jsx(lq,{application:e})]}),o.jsxs("section",{className:"review-detail-section review-history",children:[o.jsx("h3",{children:s("detail.history")}),o.jsxs("div",{children:[o.jsx("span",{className:"review-history__dot","aria-hidden":"true"}),o.jsxs("p",{children:[o.jsx("strong",{children:s("detail.submitted",{name:e.author})}),o.jsx("span",{children:w})]})]}),e.reviewedAt?o.jsxs("div",{children:[o.jsx("span",{className:"review-history__dot","aria-hidden":"true"}),o.jsxs("p",{children:[o.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")})}),o.jsx("span",{children:x})]})]}):null]})]})}),o.jsxs("footer",{className:"review-drawer__footer",children:[e.status==="pending"?o.jsx(Dt,{color:"secondary",variant:"outline",size:"md",pill:!1,onClick:()=>i("returned"),children:s("actions.return")}):null,e.status==="pending"||e.status==="approving"?o.jsx(Dt,{color:"primary",size:"md",pill:!1,onClick:()=>i("approved"),children:s(e.status==="approving"?"actions.resumeApproval":"actions.approve")}):o.jsx("span",{children:s(`status.${e.status}`)})]})]})]})})}function BXt({cloudProvider:e,onAgentChanged:t}){const{t:n,i18n:i}=_e("reviews"),[r,s]=p.useState([]),[a,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,N]=p.useState(null),[A,j]=p.useState(""),T=(M,P,L=!1)=>{C(null),j(""),N({application:M,value:P,fromDetails:L})};p.useEffect(()=>{if(c!=="skill")return;const M=new AbortController;let P,L=!1,F=!1;m(!0),b(null);const I=async()=>{if(!(L||M.signal.aborted)){L=!0;try{const K=await JPt({region:d,signal:M.signal});if(M.signal.aborted)return;s(K.items),C(B=>B&&K.items.find(W=>W.id===B.id)||null),F=K.items.some(B=>rFe(B.aiReview)),F&&document.visibilityState!=="hidden"&&(P=setTimeout(()=>void I(),5e3))}catch(K){M.signal.aborted||b(xr(K,n("space.failed"))),F=!1}finally{L=!1,M.signal.aborted||m(!1)}}},z=()=>{clearTimeout(P),F&&document.visibilityState!=="hidden"&&I()};return I(),document.addEventListener("visibilitychange",z),()=>{M.abort(),clearTimeout(P),document.removeEventListener("visibilitychange",z)}},[d,c,v,n]);const R=$Ht(r,c,x,O),_=!!O.trim()||x!=="all",D=[{key:"name",header:n("columns.application"),className:"review-column-name",render:M=>o.jsxs("div",{className:"review-name",children:[o.jsx("span",{className:"review-resource-icon",children:o.jsx($je,{})}),o.jsx("div",{children:o.jsx("button",{type:"button",title:M.name,onClick:()=>C(M),children:M.name})})]})},{key:"submitter",header:n("columns.submitter"),className:"review-column-submitter",render:M=>M.author||n("detail.unknownAuthor")},{key:"version",header:n("columns.version"),className:"review-column-version",render:M=>M.version},{key:"submitted",header:n("columns.submittedAt"),className:"review-column-time",render:M=>M.submittedAt?o.jsx("time",{dateTime:M.submittedAt,title:new Date(M.submittedAt).toLocaleString(i.language),children:new Date(M.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:M=>o.jsxs("div",{className:"review-table-outcome",children:[o.jsx(ET,{status:M.status}),M.reviewer||M.reviewedBy?o.jsx(aq,{compact:!0,person:M.reviewer,fallback:M.reviewedBy}):null]})},{key:"score",header:n("score.title"),className:"review-column-score",render:M=>o.jsx(oq,{score:M.aiReview})},{key:"actions",header:n("columns.actions"),className:"review-column-actions",render:M=>o.jsxs("div",{className:"review-row-actions",children:[o.jsx("button",{type:"button",onClick:()=>C(M),"aria-label":n("actions.detailsFor",{name:M.name}),children:n("actions.details")}),M.status==="pending"||M.status==="approving"?o.jsx("button",{type:"button",onClick:()=>T(M,"approved"),children:n(M.status==="approving"?"actions.resumeApproval":"actions.approve")}):null,M.status==="pending"?o.jsx("button",{type:"button",onClick:()=>T(M,"returned"),children:n("actions.return")}):null]})}];return o.jsxs($f,{className:"review-center","aria-label":n("title"),children:[o.jsx(Jy,{title:n("title")}),o.jsx(e0,{children:o.jsx(t0,{idPrefix:"review",ariaLabel:n("category"),value:c,items:["skill","agent"].map(M=>({id:M,label:o.jsxs(o.Fragment,{children:[n(`kind.${M}`),M==="agent"?a===null?null:o.jsx("span",{className:"review-tab-count",children:a}):o.jsx("span",{className:"review-tab-count",children:r.filter(P=>P.kind===M&&(P.status==="pending"||P.status==="approving")).length})]}),panelId:"review-requests-panel"})),onChange:M=>{u(M),w("all"),S(""),C(null)}})}),o.jsx("div",{className:"review-center__panel",id:"review-requests-panel",role:"tabpanel","aria-labelledby":`review-${c}-tab`,children:c==="agent"?o.jsx(MXt,{cloudProvider:e,onPendingCountChange:l,onChanged:t}):o.jsxs(o.Fragment,{children:[c==="skill"&&g?o.jsxs("div",{role:"alert",children:[o.jsx(ms,{error:g}),o.jsx("button",{type:"button",onClick:()=>y(M=>M+1),children:n("space.retry")})]}):null,A?o.jsx("p",{role:"status",className:"review-notice",children:A}):null,o.jsx(Bz,{rows:R,rowKey:M=>M.id,columns:D,searchValue:O,onSearchChange:S,searchPlaceholder:n("search"),searchLabel:n("search"),toolbarActions:o.jsxs(o.Fragment,{children:[c==="skill"?o.jsxs(o.Fragment,{children:[o.jsx(fg,{id:"review-region",ariaLabel:n("detail.region"),value:d,options:nu(e),onChange:M=>{s([]),C(null),f(M)}}),o.jsx("button",{type:"button",disabled:h,onClick:()=>y(M=>M+1),children:n("actions.refresh")})]}):null,o.jsx(fg,{id:"review-status",ariaLabel:n("filterStatus"),value:x,options:["all","pending","approving","approved","returned"].map(M=>({value:M,label:n(`status.${M}`)})),onChange:w})]}),emptyLabel:c==="skill"&&h?o.jsx(za,{}):c==="skill"&&g?null:o.jsxs("div",{className:"review-empty",children:[o.jsx("strong",{children:n(_?"empty.filteredTitle":"empty.title")}),o.jsx("span",{children:n(_?"empty.filteredDescription":"empty.description")}),_?o.jsx("button",{type:"button",onClick:()=>{S(""),w("all")},children:n("actions.clearFilters")}):null]})}),o.jsx("div",{className:"review-center__count",children:n("total",{count:R.length})})]})}),k?o.jsx(FXt,{application:k,cloudProvider:e,onClose:()=>C(null),onDecision:M=>T(k,M,!0),onScoreChanged:(M,P)=>{const L=XHt(M);s(F=>F.map(I=>I.id===k.id?{...I,aiReview:L}:I)),P&&y(F=>F+1)}},k.id):null,E?o.jsx(LXt,{application:E.application,decision:E.value,onClose:()=>{E.fromDetails&&C(E.application),N(null),y(M=>M+1)},onDecided:M=>{s(P=>P.map(L=>L.id===M.id?M:L)),E.fromDetails&&C(M),j(n(M.status==="approved"?"decision.approved":"decision.returned",{name:M.name})),N(null)}},`${E.application.id}:${E.value}`):null]})}function UXt({role:e,cloudProvider:t,onAgentChanged:n}){const{t:i}=_e("reviews");return e!=="admin"&&e!=="super_admin"?o.jsxs($f,{className:"review-center",children:[o.jsx(Jy,{title:i("title")}),o.jsx("p",{role:"status",children:i("adminOnly")})]}):o.jsx(BXt,{cloudProvider:t,onAgentChanged:n},t)}const YA=10;function QXt(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.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 zXt({hidden:e,...t}){return o.jsxs("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t,children:[o.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"}),o.jsx("circle",{cx:"10",cy:"10",r:"1.8"}),e?o.jsx("path",{d:"m4 4 12 12"}):null]})}function db(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.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 VXt(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m4 6 4 4 4-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function HXt(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.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 NO(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 E1(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 qXt(e){try{return`https://github.com/${vq(e)}`}catch{return""}}function WXt(e){return e==="started"?"评审中":e==="completed"?"已完成":e==="ignored"?"已忽略":"失败"}function KXt(e){return e==="webhook"?"自动触发":"手动发起"}function GXt(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 XXt(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 loe(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 YXt({automation:e,cloudProvider:t,onBack:n,onOpenSandboxSession:i}){const{t:r}=_e("automations"),s=zGt(e),a=e==="review",l=nu(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,N]=p.useState(""),[A,j]=p.useState(null),[T,R]=p.useState(""),[_,D]=p.useState(!1),[M,P]=p.useState(null),[L,F]=p.useState(""),[I,z]=p.useState(a),[K,B]=p.useState([]),[W,H]=p.useState(a),[X,ie]=p.useState(""),[Q,Z]=p.useState(null),[ue,Ee]=p.useState(1),[Y,G]=p.useState(!1),[te,de]=p.useState(""),[Ce,le]=p.useState(""),[fe,re]=p.useState(""),[Oe,Pe]=p.useState([]),[be,Qe]=p.useState(a),[ve,Ne]=p.useState(""),[ne,ye]=p.useState(null),[Te,Se]=p.useState(1),[Ke,it]=p.useState(!1),he=p.useRef(null),xe=p.useRef(null),Ae=p.useRef(null),qe=p.useRef(null),Me=p.useRef(null),At=qXt(u.repository),It=At.replace("https://github.com/",""),lt=At?`${At}/settings/secrets/actions`:"",Ot=(M==null?void 0:M.appSlug)||"agentkit-veadk-studio",Ct=(M==null?void 0:M.installUrl)||`https://github.com/apps/${Ot}/installations/new`,dt=ioe(E),yt=K.filter(Ge=>Ge.reviewEnabled),Ie=dt?K.find(Ge=>Ge.fullName.toLowerCase()===dt.toLowerCase()):void 0,vt=ue>1||Y,jt=Te>1||Ke;p.useEffect(()=>()=>{var Ge,bt,St,dn,Rt;(Ge=he.current)==null||Ge.abort(),(bt=xe.current)==null||bt.abort(),(St=Ae.current)==null||St.abort(),(dn=qe.current)==null||dn.abort(),(Rt=Me.current)==null||Rt.abort()},[]),p.useEffect(()=>{var Ge,bt,St;d({...s.initialValues({cloudProvider:t})}),m({}),b(""),C(null),S(!1),(Ge=he.current)==null||Ge.abort(),(bt=xe.current)==null||bt.abort(),(St=Me.current)==null||St.abort(),j(null),R(""),Pe([]),Ne(""),ye(null),Ee(1),G(!1),de(""),le(""),Se(1),it(!1)},[e,t,s]),p.useEffect(()=>{var bt;if(!a)return;(bt=Ae.current)==null||bt.abort();const Ge=new AbortController;Ae.current=Ge,z(!0),F(""),xGt(Ge.signal).then(St=>{Ae.current===Ge&&(P(St),St.configured||(H(!1),Qe(!1)))}).catch(St=>{Ge.signal.aborted||Ae.current!==Ge||(F(St instanceof Error?St.message:String(St)),H(!1),Qe(!1))}).finally(()=>{Ae.current===Ge&&(Ae.current=null,z(!1))})},[a]);const Nt=(Ge=ue,bt=Ce)=>{var dn;(dn=qe.current)==null||dn.abort();const St=new AbortController;qe.current=St,H(!0),ie(""),wGt(St.signal,{page:Ge,pageSize:YA,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}B(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,H(!1))})},ln=(Ge=Te)=>{var St;(St=Me.current)==null||St.abort();const bt=new AbortController;Me.current=bt,Qe(!0),Ne(""),OGt(bt.signal,{page:Ge,pageSize:YA}).then(dn=>{if(Me.current===bt){if(dn.records.length===0&&dn.page>1){Se(dn.page-1),ln(dn.page-1);return}Pe(dn.records),Se(dn.page),it(dn.hasNextPage),ye({reviewSettingsConfigured:dn.reviewSettingsConfigured,reviewSettingsReason:dn.reviewSettingsReason})}}).catch(dn=>{bt.signal.aborted||Me.current!==bt||Ne(dn instanceof Error?dn.message:String(dn))}).finally(()=>{Me.current===bt&&(Me.current=null,Qe(!1))})};p.useEffect(()=>{!a||(M==null?void 0:M.configured)!==!0||(Nt(1),ln(1))},[M==null?void 0:M.configured,a]);const He=()=>{const Ge=te.trim();le(Ge),Ee(1),Nt(1,Ge)},Le=()=>{de(""),le(""),Ee(1),Nt(1,"")},We=(Ge,bt)=>{if(!(bt<1)){if(Ge==="repositories"){Ee(bt),Nt(bt,Ce);return}Se(bt),ln(bt)}},gt=async Ge=>{if((Q==null?void 0:Q.reviewSettingsConfigured)!==!0||fe)return;const bt=new AbortController;re(Ge.fullName),ie("");try{const St=await kGt({repository:Ge.fullName,reviewEnabled:!Ge.reviewEnabled},bt.signal),dn=new Set(St.map(Rt=>Rt.toLowerCase()));B(Rt=>Rt.map($e=>({...$e,reviewEnabled:dn.has($e.fullName.toLowerCase())})))}catch(St){ie(St instanceof Error?St.message:String(St))}finally{re("")}},st=(Ge,bt)=>{d(St=>({...St,[Ge]:bt})),h[Ge]&&m(St=>({...St,[Ge]:""}))},xt=Ge=>{var Rt;const bt=!a&&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=NO(Ge,St,bt);m($e=>({...$e,[Ge]:dn}))},ft=async Ge=>{var dn;if(Ge.preventDefault(),a)return;const bt={};for(const Rt of s.fields){const $e=NO(Rt.name,u[Rt.name],Rt.required);$e&&(bt[Rt.name]=$e)}if(!a){const Rt=NO("token",u.token,!0);Rt&&(bt.token=Rt)}if(m(bt),Object.keys(bt).length)return;(dn=he.current)==null||dn.abort();const St=new AbortController;he.current=St,y(!0),b(""),C(null);try{const Rt=await s.submit(u,{cloudProvider:t},St.signal);if(he.current!==St)return;C(Rt),d($e=>({...$e,token:""}))}catch(Rt){if(St.signal.aborted||he.current!==St)return;b(Rt instanceof Error?Rt.message:String(Rt))}finally{he.current===St&&(he.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=NO("pullRequestUrl",E,!0);if(bt&&(Ge.pullRequestUrl=bt),!bt){const Rt=ioe(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,D(!0),R(""),j(null);try{const Rt=await vGt({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;R(Rt instanceof Error?Rt.message:String(Rt))}finally{xe.current===St&&(xe.current=null,D(!1))}},hn=Ge=>{const{name:bt,placeholder:St,required:dn}=Ge,Rt=bt==="repository",$e=`cards.${e}.fields.${bt}`;return o.jsxs("div",{className:"github-field",children:[o.jsxs("div",{className:"github-field-label-row",children:[o.jsxs("label",{htmlFor:`github-${bt}`,children:[o.jsx("span",{children:r(`${$e}.label`)}),o.jsx("span",{className:`github-field-requirement${dn?" is-required":""}`,children:r(dn?"github.required":"github.optional")})]}),Rt?o.jsxs("a",{className:"github-field-action",href:"https://github.com/",target:"_blank",rel:"noreferrer",children:["https://github.com/",o.jsx(db,{})]}):null]}),o.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`:""}`}),o.jsx("span",{id:`github-${bt}-help`,className:"github-field-help",children:Rt&&It?a?r("github.repositoryReviewHelp",{repository:It}):r("github.repositoryConfigHelp",{repository:It}):r(`${$e}.help`)}),h[bt]?o.jsx("span",{id:`github-${bt}-error`,className:"github-field-error",role:"alert",children:r(h[bt])}):null]},bt)};return o.jsxs("div",{className:"github-integration-page",children:[o.jsxs("header",{className:"github-integration-header",children:[o.jsx("button",{type:"button",className:"github-back",onClick:n,"aria-label":r("backToAutomations"),children:o.jsx(QXt,{})}),o.jsx(hq,{className:"github-integration-logo"}),o.jsxs("div",{children:[o.jsx("h1",{children:r(`cards.${e}.title`)}),o.jsx("p",{children:r(`cards.${e}.subtitle`)})]})]}),o.jsx("div",{className:"github-integration-layout",children:o.jsxs("section",{id:`github-panel-${e}`,className:"github-section-panel",children:[o.jsx("div",{className:"github-panel-heading",children:o.jsx("p",{children:r(`cards.${e}.panel`)})}),o.jsxs("form",{className:"github-release-form",onSubmit:ft,onKeyDown:Ht,noValidate:!0,children:[a?null:o.jsxs("div",{className:"github-field-grid",children:[s.fields.map(hn),o.jsxs("div",{className:"github-field",children:[o.jsxs("label",{id:"github-region-label",children:[o.jsx("span",{children:r("github.region")}),o.jsx("span",{className:"github-field-requirement is-required",children:r("github.required")})]}),o.jsxs("div",{className:"pp-network-region github-region-picker",onKeyDown:Ge=>{Ge.key==="Escape"&&S(!1)},children:[o.jsxs("button",{type:"button",className:"pp-region-trigger","aria-labelledby":"github-region-label","aria-haspopup":"listbox","aria-expanded":O,onClick:()=>S(Ge=>!Ge),children:[o.jsx("span",{children:(f==null?void 0:f.label)??u.region}),o.jsx(VXt,{className:`pp-region-chevron${O?" is-open":""}`})]}),O?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"menu-scrim",onClick:()=>S(!1)}),o.jsx("div",{className:"pp-region-menu",role:"listbox","aria-label":r("github.region"),children:l.map(Ge=>{const bt=Ge.value===u.region;return o.jsxs("button",{type:"button",role:"option","aria-selected":bt,className:`pp-region-option${bt?" is-selected":""}`,onClick:()=>{st("region",Ge.value),S(!1)},children:[o.jsx("span",{children:Ge.label}),bt?o.jsx(HXt,{}):null]},Ge.value)})})]}):null]}),o.jsx("span",{className:"github-field-help",children:r(`cards.${e}.regionHelp`)})]})]}),a?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:`github-app-card${M!=null&&M.configured?" is-ready":""}`,children:[o.jsxs("div",{children:[o.jsx("strong",{children:"GitHub App 授权"}),o.jsx("span",{children:I?"正在检查中心服务配置...":M!=null&&M.configured?`安装 ${Ot} 到目标仓库后,可在下方开启自动评审。`:L||(M==null?void 0:M.reason)||"管理员未配置 GitHub App。"})]}),o.jsxs("a",{className:"github-app-install-link",href:Ct,target:"_blank",rel:"noreferrer",children:["安装 GitHub App",o.jsx(db,{})]})]}),o.jsxs("section",{className:"github-review-section github-app-repositories","aria-labelledby":"github-app-repositories-title",children:[o.jsxs("div",{className:"github-review-section-header",children:[o.jsxs("div",{children:[o.jsx("h2",{id:"github-app-repositories-title",children:"已安装仓库"}),o.jsx("p",{children:"只有开启评审的仓库会响应 GitHub webhook 自动触发。"})]}),o.jsx("button",{type:"button",onClick:()=>Nt(),disabled:!(M!=null&&M.configured)||W,children:W?"刷新中...":"刷新"})]}),X?o.jsx("div",{className:"github-submit-message is-error",role:"alert",children:X}):null,(Q==null?void 0:Q.reviewSettingsConfigured)===!1&&!X?o.jsx("div",{className:"github-submit-message is-error",role:"alert",children:Q.reviewSettingsReason||"管理员未配置 Studio 持久化存储,无法保存启用评审设置。"}):null,o.jsxs("div",{className:"github-app-repository-search",children:[o.jsx("input",{type:"search",value:te,onChange:Ge=>de(Ge.target.value),onKeyDown:Ge=>{Ge.key==="Enter"&&(Ge.preventDefault(),He())},placeholder:"搜索 owner 或仓库名","aria-label":"搜索已安装仓库"}),o.jsx("button",{type:"button",onClick:He,disabled:!(M!=null&&M.configured)||W,children:"搜索"}),Ce?o.jsx("button",{type:"button",onClick:Le,disabled:W,children:"清除"}):null]}),W&&K.length===0?o.jsx("div",{className:"github-app-repository-empty",children:"正在读取 GitHub App 安装仓库..."}):null,!W&&K.length===0&&!X?o.jsx("div",{className:"github-app-repository-empty",children:Ce?`没有匹配 “${Ce}” 的已安装仓库。`:"GitHub App 尚未安装到任何仓库。"}):null,K.length>0?o.jsx("div",{className:"github-app-repository-list",children:K.map(Ge=>{const bt=fe===Ge.fullName,St=(Q==null?void 0:Q.reviewSettingsConfigured)!==!0||!!fe;return o.jsxs("div",{className:"github-app-repository-row",children:[o.jsxs("div",{className:"github-app-repository-main",children:[o.jsxs("a",{href:Ge.htmlUrl,target:"_blank",rel:"noreferrer",title:Ge.fullName,children:[Ge.fullName,o.jsx(db,{})]}),o.jsxs("span",{children:[Ge.private?"Private":"Public"," · Installation ",Ge.installationId]})]}),o.jsx("button",{type:"button",className:`github-review-switch${Ge.reviewEnabled?" is-on":""}`,role:"switch","aria-checked":Ge.reviewEnabled,disabled:St,onClick:()=>{gt(Ge)},children:o.jsx("span",{children:bt?"保存中":Ge.reviewEnabled?"已启用":"未启用"})})]},Ge.fullName)})}):null,vt?o.jsxs("div",{className:"github-list-pagination","aria-label":"已安装仓库分页",children:[o.jsx("span",{children:loe(ue,YA,K.length,Y)}),o.jsxs("div",{children:[o.jsx("button",{type:"button",onClick:()=>We("repositories",ue-1),disabled:ue<=1||W,children:"上一页"}),o.jsx("button",{type:"button",onClick:()=>We("repositories",ue+1),disabled:!Y||W,children:"下一页"})]})]}):null]})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"github-field github-token-field",children:[o.jsxs("div",{className:"github-token-label-row",children:[o.jsxs("label",{htmlFor:"github-token",children:[o.jsx("span",{children:r("github.tokenLabel")}),o.jsx("span",{className:"github-field-requirement is-required",children:r("github.required")})]}),o.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"),o.jsx(db,{})]})]}),o.jsxs("div",{className:"github-token-input",children:[o.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":""}`}),o.jsx("button",{type:"button",onClick:()=>w(Ge=>!Ge),"aria-label":r(x?"github.hideToken":"github.showToken"),title:r(x?"github.hideToken":"github.showToken"),children:o.jsx(zXt,{hidden:x})})]}),o.jsx("span",{id:"github-token-help",className:"github-field-help",children:r("github.tokenWorkflowHelp")}),h.token?o.jsx("span",{id:"github-token-error",className:"github-field-error",role:"alert",children:r(h.token)}):null]}),g?o.jsx("div",{className:"github-submit-message is-error",role:"alert",children:g}):null,k?o.jsxs("div",{className:"github-submit-message is-success github-result-message",role:"status",children:[o.jsxs("div",{children:[o.jsx("strong",{children:r("github.configPrCreated",{number:k.number})}),o.jsx("span",{children:r("github.configPrNextStep")})]}),o.jsxs("a",{className:"github-result-link",href:k.url,target:"_blank",rel:"noreferrer",children:[r("github.viewConfigPr"),o.jsx(db,{})]})]}):null,o.jsxs("div",{className:"github-form-actions",children:[o.jsxs("div",{className:"github-secrets-note",children:[o.jsxs("div",{className:"github-secrets-header",children:[o.jsx("strong",{children:r("github.secretsConfigHeading")}),lt?o.jsxs("a",{className:"github-secrets-link",href:lt,target:"_blank",rel:"noreferrer",children:[r("github.openSecrets"),o.jsx(db,{})]}):null]}),o.jsx("span",{className:"github-secrets-path",children:r("github.secretsPath")}),o.jsx("ul",{children:c.map(Ge=>{const[bt,...St]=Ge.split(":");return o.jsxs("li",{children:[o.jsx("code",{children:bt}),St.length?o.jsx("span",{children:St.join(":")}):null]},Ge)})})]}),o.jsx("button",{type:"submit",disabled:v,children:r(v?"github.submitting":`cards.${e}.submitLabel`)})]})]})]}),a?o.jsxs("div",{className:"github-pr-review-sections",children:[o.jsxs("section",{className:"github-review-section github-review-now","aria-labelledby":"github-review-now-title",children:[o.jsx("div",{className:"github-review-section-header",children:o.jsxs("div",{children:[o.jsx("h2",{id:"github-review-now-title",children:"立刻评审"}),o.jsx("p",{children:"输入已安装且已启用仓库的 PR URL,立即创建 Sandbox 评审任务。"})]})}),o.jsxs("div",{className:"github-review-section-body",children:[o.jsxs("div",{className:"github-field",children:[o.jsx("input",{id:"github-pull-request-url","aria-label":"Pull Request URL",value:E,onChange:Ge=>{N(Ge.target.value),h.pullRequestUrl&&m(bt=>({...bt,pullRequestUrl:""}))},onBlur:()=>m(Ge=>({...Ge,pullRequestUrl:NO("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?o.jsx("span",{id:"github-pull-request-url-error",className:"github-field-error",role:"alert",children:h.pullRequestUrl}):null,!h.pullRequestUrl&&dt?o.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?o.jsxs("span",{className:"github-field-help",children:["已启用仓库:",yt.map(Ge=>Ge.fullName).join("、")]}):null]}),T?o.jsx("div",{className:"github-submit-message is-error",role:"alert",children:T}):null,A?o.jsx("div",{className:"github-submit-message is-success",role:"status",children:o.jsxs("span",{children:["已发起评审,Session ",A.sessionId," 正在运行。"]})}):null,o.jsx("div",{className:"github-review-section-actions",children:o.jsx("button",{type:"button",onClick:cn,disabled:_,children:_?"发起评审中…":"立即发起评审"})})]})]}),o.jsxs("section",{className:"github-review-section github-review-records","aria-labelledby":"github-review-records-title",children:[o.jsxs("div",{className:"github-review-section-header",children:[o.jsxs("div",{children:[o.jsx("h2",{id:"github-review-records-title",children:"评审记录"}),o.jsx("p",{children:"展示最近自动触发和手动发起的评审任务。"})]}),o.jsx("button",{type:"button",onClick:()=>ln(),disabled:!(M!=null&&M.configured)||be,children:be?"刷新中...":"刷新"})]}),ve?o.jsx("div",{className:"github-submit-message is-error",role:"alert",children:ve}):null,(ne==null?void 0:ne.reviewSettingsConfigured)===!1&&!ve?o.jsx("div",{className:"github-submit-message is-error",role:"alert",children:ne.reviewSettingsReason||"管理员未配置 Studio 持久化存储,无法读取评审记录。"}):null,be&&Oe.length===0?o.jsx("div",{className:"github-app-repository-empty",children:"正在读取 PR 评审记录..."}):null,!be&&Oe.length===0&&!ve?o.jsx("div",{className:"github-app-repository-empty",children:"暂无 PR 评审记录。"}):null,Oe.length>0?o.jsx("div",{className:"github-review-record-list",children:Oe.map(Ge=>{const bt=GXt(Ge),St=Ge.status==="completed"?"":Ge.sessionId;return o.jsxs("div",{className:"github-review-record-row",children:[o.jsxs("div",{className:"github-review-record-main",children:[o.jsxs("div",{className:"github-review-record-title",children:[o.jsxs("a",{href:Ge.pullRequestUrl,target:"_blank",rel:"noreferrer",children:[Ge.repository,"#",Ge.pullRequestNumber,o.jsx(db,{})]}),o.jsx("span",{className:`github-review-record-status is-${Ge.status}`,children:WXt(Ge.status)})]}),o.jsxs("span",{children:[KXt(Ge.trigger),Ge.action?` · ${Ge.action}`:""," · ",XXt(Ge.createdAt),bt?` · ${bt}`:""]})]}),o.jsx("div",{className:"github-review-record-actions",children:St&&i?o.jsx("button",{type:"button",onClick:()=>i(St),children:"打开 Session"}):null})]},Ge.id)})}):null,jt?o.jsxs("div",{className:"github-list-pagination","aria-label":"评审记录分页",children:[o.jsx("span",{children:loe(Te,YA,Oe.length,Ke)}),o.jsxs("div",{children:[o.jsx("button",{type:"button",onClick:()=>We("records",Te-1),disabled:Te<=1||be,children:"上一页"}),o.jsx("button",{type:"button",onClick:()=>We("records",Te+1),disabled:!Ke||be,children:"下一页"})]})]}):null]})]}):null]})})]})}async function d0(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 coe(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(/\/+$/,""),a="/-/merge_requests/",l=s.indexOf(a);if(l<=0)return"";const c=s.slice(l+a.length);return/^[1-9][0-9]*$/.test(c)?s.slice(0,l):""}async function uoe(e){const t=await gn("/web/gitlab/app/config",{method:"GET",headers:{Accept:"application/json"},signal:e});if(!t.ok)throw await d0(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 ZXt(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 d0(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(a=>typeof a!="object"||a===null||typeof a.instanceId!="string"||typeof a.baseUrl!="string"||typeof a.projectId!="number"||typeof a.pathWithNamespace!="string"||typeof a.name!="string"||typeof a.namespace!="string"||typeof a.webUrl!="string"||typeof a.private!="boolean"||typeof a.reviewEnabled!="boolean"||typeof a.permissionsNote!="string"||typeof a.accessLevel!="number"||typeof a.canManageWebhooks!="boolean"||typeof a.reviewBindingStatus!="string"||typeof a.reviewBindingReason!="string"||typeof a.reviewCredentialOwner!="string"||typeof a.reviewCredentialType!="string"))throw new Error("GitLab 集成项目列表响应格式无效。");return r}async function JXt(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 d0(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 eYt(e){const t=await gn("/web/gitlab/oauth/disconnect",{method:"POST",headers:{Accept:"application/json"},signal:e});if(!t.ok)throw await d0(t)}async function tYt(e){const t=await gn("/web/gitlab/oauth/start-url",{method:"GET",headers:{Accept:"application/json"},signal:e});if(!t.ok)throw await d0(t);const n=await t.json();if(typeof n.authorizationUrl!="string"||!n.authorizationUrl)throw new Error("GitLab OAuth 授权地址响应格式无效。");return n.authorizationUrl}async function nYt(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 d0(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 iYt(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 d0(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 ZA=10;function JA(){return o.jsxs("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[o.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"}),o.jsx("path",{d:"M9 3h4v4M8.5 7.5 13 3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}function rYt(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.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 sYt(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",...e,children:o.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 oYt(e){return e==="started"?"进行中":e==="completed"?"已完成":e==="ignored"?"已忽略":"失败"}function aYt(e){return e==="webhook"?"自动触发":"手动发起"}function lYt(e){const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function cYt(e){return e.reason==="project-review-disabled"?"项目未启用":e.reason==="merge-request-not-reviewable"?"MR 不满足评审条件":e.reason}function doe(e,t,n,i){const r=(e-1)*t+1,s=(e-1)*t+n;return i?`${r}-${s}`:`${r}-${s} / ${s}`}function uYt({onBack:e,onOpenSandboxSession:t}){const[n,i]=p.useState(null),[r,s]=p.useState(""),[a,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,N]=p.useState(null),[A,j]=p.useState(""),[T,R]=p.useState(!1),[_,D]=p.useState(""),[M,P]=p.useState(null),[L,F]=p.useState([]),[I,z]=p.useState(!0),[K,B]=p.useState(""),[W,H]=p.useState(1),[X,ie]=p.useState(!1),[Q,Z]=p.useState(null),[ue,Ee]=p.useState(!1),[Y,G]=p.useState(!1),te=p.useRef(null),de=p.useRef(null),Ce=p.useRef(null),le=n?coe(n.baseUrl,A):"",fe=le?c.find(Se=>Se.pathWithNamespace.toLowerCase()===le.toLowerCase()):void 0,re=v>1||x,Oe=W>1||X,Pe=(n==null?void 0:n.configured)===!0&&n.oauthConnected,be=(Se=v,Ke=k)=>{var he;(he=de.current)==null||he.abort();const it=new AbortController;de.current=it,f(!0),m(""),ZXt(it.signal,{page:Se,pageSize:ZA,query:Ke}).then(xe=>{if(de.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||de.current!==it||m(xe instanceof Error?xe.message:String(xe))}).finally(()=>{de.current===it&&(de.current=null,f(!1))})},Qe=(Se=W)=>{var it;(it=Ce.current)==null||it.abort();const Ke=new AbortController;Ce.current=Ke,z(!0),B(""),nYt(Ke.signal,{page:Se,pageSize:ZA}).then(he=>{if(Ce.current===Ke){if(he.records.length===0&&he.page>1){H(he.page-1),Qe(he.page-1);return}F(he.records),H(he.page),ie(he.hasNextPage),Z({reviewSettingsConfigured:he.reviewSettingsConfigured,reviewSettingsReason:he.reviewSettingsReason})}}).catch(he=>{Ke.signal.aborted||Ce.current!==Ke||B(he instanceof Error?he.message:String(he))}).finally(()=>{Ce.current===Ke&&(Ce.current=null,z(!1))})};p.useEffect(()=>{var Ke;(Ke=te.current)==null||Ke.abort();const Se=new AbortController;return te.current=Se,l(!0),s(""),uoe(Se.signal).then(it=>{te.current===Se&&(i(it),(!it.configured||it.oauthConfigured&&!it.oauthConnected)&&(f(!1),z(!1)))}).catch(it=>{Se.signal.aborted||te.current!==Se||(s(it instanceof Error?it.message:String(it)),f(!1),z(!1))}).finally(()=>{te.current===Se&&(te.current=null,l(!1))}),()=>{var it,he;Se.abort(),(it=de.current)==null||it.abort(),(he=Ce.current)==null||he.abort()}},[]),p.useEffect(()=>{Pe&&(be(1,""),Qe(1))},[Pe]);const ve=()=>{const Se=O.trim();C(Se),y(1),be(1,Se)},Ne=async Se=>{if((g==null?void 0:g.reviewSettingsConfigured)!==!0||E!==null)return;if(!Se.reviewEnabled&&!Pe){m("请先连接 GitLab 后再启用自动评审。");return}const Ke=new AbortController;N(Se.projectId),m("");try{await JXt({projectId:Se.projectId,reviewEnabled:!Se.reviewEnabled},Ke.signal),u(it=>it.map(he=>he.projectId===Se.projectId?{...he,reviewEnabled:!Se.reviewEnabled}:he))}catch(it){m(it instanceof Error?it.message:String(it))}finally{N(null)}},ne=async()=>{const Se=new AbortController;G(!0),s("");try{await eYt(Se.signal);const Ke=await uoe(Se.signal);i(Ke),u([]),b(null)}catch(Ke){s(Ke instanceof Error?Ke.message:String(Ke))}finally{G(!1)}},ye=async()=>{const Se=new AbortController;Ee(!0),s("");try{window.location.href=await tYt(Se.signal)}catch(Ke){s(Ke instanceof Error?Ke.message:String(Ke)),Ee(!1)}},Te=async()=>{const Se=A.trim();if(!Se){D("请输入 GitLab Merge Request URL。");return}if(!(n!=null&&n.configured)){D("管理员未配置 GitLab OAuth。");return}if(!Pe){D("请先连接 GitLab 后再发起评审。");return}if(!coe(n.baseUrl,Se)){D("请输入当前 GitLab 实例下的完整 Merge Request URL。");return}R(!0),D(""),P(null);const Ke=new AbortController;try{const it=await iYt({mergeRequestUrl:Se},Ke.signal);P(it),Qe(1)}catch(it){D(it instanceof Error?it.message:String(it))}finally{R(!1)}};return o.jsxs("div",{className:"github-integration-page",children:[o.jsxs("header",{className:"github-integration-header",children:[o.jsx("button",{type:"button",className:"github-back",onClick:e,"aria-label":"返回自动化",children:o.jsx(rYt,{})}),o.jsx(sYt,{className:"github-integration-logo"}),o.jsxs("div",{children:[o.jsx("h1",{children:"GitLab MR Review"}),o.jsx("p",{children:"通过 GitLab webhook 触发 Sandbox 评审,并将结果写回 Merge Request。"})]})]}),o.jsx("div",{className:"github-integration-layout",children:o.jsxs("section",{className:"github-section-panel",children:[o.jsx("div",{className:"github-panel-heading",children:o.jsx("p",{children:"请先为目标项目开启自动评审,再通过 webhook 或手动 URL 发起 MR 评审。"})}),o.jsxs("div",{className:"github-release-form",children:[o.jsxs("div",{className:`github-app-card${n!=null&&n.configured?" is-ready":""}`,children:[o.jsxs("div",{children:[o.jsx("strong",{children:"GitLab 集成配置"}),o.jsx("span",{children:a?"正在检查中心服务配置...":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?o.jsxs("button",{type:"button",className:"github-app-install-link",onClick:()=>{ye()},disabled:ue,children:[ue?"连接中...":"连接 GitLab",o.jsx(JA,{})]}):n!=null&&n.oauthConnected?o.jsx("button",{type:"button",className:"github-app-install-link",onClick:()=>{ne()},disabled:Y,children:Y?"断开中...":"断开授权"}):n!=null&&n.webhookUrl?o.jsxs("a",{className:"github-app-install-link",href:n.webhookUrl,target:"_blank",rel:"noreferrer",children:["Webhook",o.jsx(JA,{})]}):null]}),o.jsxs("section",{className:"github-review-section github-app-repositories","aria-labelledby":"gitlab-projects-title",children:[o.jsxs("div",{className:"github-review-section-header",children:[o.jsxs("div",{children:[o.jsx("h2",{id:"gitlab-projects-title",children:"可访问项目"}),o.jsx("p",{children:"只有开启评审的项目会响应 GitLab webhook 自动触发。"})]}),o.jsx("button",{type:"button",onClick:()=>be(),disabled:!Pe||d,children:d?"刷新中...":"刷新"})]}),h?o.jsx("div",{className:"github-submit-message is-error",role:"alert",children:h}):null,(g==null?void 0:g.reviewSettingsConfigured)===!1&&!h?o.jsx("div",{className:"github-submit-message is-error",role:"alert",children:g.reviewSettingsReason||"管理员未配置 Studio 持久化存储,无法保存启用评审设置。"}):null,o.jsxs("div",{className:"github-app-repository-search",children:[o.jsx("input",{type:"search",value:O,onChange:Se=>S(Se.target.value),onKeyDown:Se=>{Se.key==="Enter"&&(Se.preventDefault(),ve())},placeholder:"搜索 group 或项目名","aria-label":"搜索 GitLab 项目"}),o.jsx("button",{type:"button",onClick:ve,disabled:!Pe||d,children:"搜索"}),k?o.jsx("button",{type:"button",onClick:()=>{S(""),C(""),y(1),be(1,"")},disabled:d||!Pe,children:"清除"}):null]}),!Pe&&!a?o.jsx("div",{className:"github-app-repository-empty",children:"请先连接 GitLab。"}):null,d&&c.length===0&&Pe?o.jsx("div",{className:"github-app-repository-empty",children:"正在读取 GitLab 项目..."}):null,!d&&c.length===0&&!h&&Pe?o.jsx("div",{className:"github-app-repository-empty",children:k?`没有匹配 “${k}” 的 GitLab 项目。`:"GitLab 集成暂无可访问项目。"}):null,c.length>0?o.jsx("div",{className:"github-app-repository-list",children:c.map(Se=>{const Ke=E===Se.projectId,it=(g==null?void 0:g.reviewSettingsConfigured)!==!0||E!==null||!Se.reviewEnabled&&!Pe;return o.jsxs("div",{className:"github-app-repository-row",children:[o.jsxs("div",{className:"github-app-repository-main",children:[o.jsxs("a",{href:Se.webUrl,target:"_blank",rel:"noreferrer",title:Se.pathWithNamespace,children:[Se.pathWithNamespace,o.jsx(JA,{})]}),o.jsxs("span",{children:[Se.private?"Private":"Public"," · Project ",Se.projectId,Se.permissionsNote?` · ${Se.permissionsNote}`:"",Se.reviewBindingStatus&&Se.reviewBindingStatus!=="active"&&Se.reviewBindingStatus!=="disabled"?` · ${Se.reviewBindingReason||"授权失效"}`:""]})]}),o.jsx("button",{type:"button",className:`github-review-switch${Se.reviewEnabled?" is-on":""}`,role:"switch","aria-checked":Se.reviewEnabled,disabled:it,onClick:()=>{Ne(Se)},children:o.jsx("span",{children:Ke?"保存中":Se.reviewEnabled?"已启用":"未启用"})})]},`${Se.instanceId}:${Se.projectId}`)})}):null,re?o.jsxs("div",{className:"github-list-pagination","aria-label":"GitLab 项目分页",children:[o.jsx("span",{children:doe(v,ZA,c.length,x)}),o.jsxs("div",{children:[o.jsx("button",{type:"button",onClick:()=>{y(v-1),be(v-1,k)},disabled:v<=1||d,children:"上一页"}),o.jsx("button",{type:"button",onClick:()=>{y(v+1),be(v+1,k)},disabled:!x||d,children:"下一页"})]})]}):null]})]}),o.jsxs("div",{className:"github-pr-review-sections",children:[o.jsxs("section",{className:"github-review-section github-review-now","aria-labelledby":"gitlab-review-now-title",children:[o.jsx("div",{className:"github-review-section-header",children:o.jsxs("div",{children:[o.jsx("h2",{id:"gitlab-review-now-title",children:"立刻评审"}),o.jsx("p",{children:"输入当前 GitLab 实例下的 MR URL,立即创建 Sandbox 评审任务。"})]})}),o.jsxs("div",{className:"github-review-section-body",children:[o.jsxs("div",{className:"github-field",children:[o.jsx("input",{"aria-label":"Merge Request URL",value:A,onChange:Se=>j(Se.target.value),placeholder:`${(n==null?void 0:n.baseUrl)||"https://gitlab.example.com"}/group/project/-/merge_requests/123`}),le?o.jsx("span",{className:"github-field-help",children:fe?`将使用 GitLab 授权评审 ${fe.pathWithNamespace}`:`MR URL 所属项目 ${le} 不在当前项目列表中`}):null]}),_?o.jsx("div",{className:"github-submit-message is-error",role:"alert",children:_}):null,M?o.jsx("div",{className:"github-submit-message is-success",role:"status",children:o.jsxs("span",{children:["已发起评审,Session ",M.sessionId," 正在运行。"]})}):null,o.jsx("div",{className:"github-review-section-actions",children:o.jsx("button",{type:"button",onClick:Te,disabled:T||!Pe,children:T?"发起评审中...":"立即发起评审"})})]})]}),o.jsxs("section",{className:"github-review-section github-review-records","aria-labelledby":"gitlab-review-records-title",children:[o.jsxs("div",{className:"github-review-section-header",children:[o.jsxs("div",{children:[o.jsx("h2",{id:"gitlab-review-records-title",children:"评审记录"}),o.jsx("p",{children:"展示最近自动触发和手动发起的评审任务。"})]}),o.jsx("button",{type:"button",onClick:()=>Qe(),disabled:!Pe||I,children:I?"刷新中...":"刷新"})]}),K?o.jsx("div",{className:"github-submit-message is-error",role:"alert",children:K}):null,(Q==null?void 0:Q.reviewSettingsConfigured)===!1&&!K?o.jsx("div",{className:"github-submit-message is-error",role:"alert",children:Q.reviewSettingsReason||"管理员未配置 Studio 持久化存储,无法读取评审记录。"}):null,I&&L.length===0?o.jsx("div",{className:"github-app-repository-empty",children:"正在读取 MR 评审记录..."}):null,!I&&L.length===0&&!K?o.jsx("div",{className:"github-app-repository-empty",children:"暂无 MR 评审记录。"}):null,L.length>0?o.jsx("div",{className:"github-review-record-list",children:L.map(Se=>{const Ke=cYt(Se),it=Se.status==="completed"?"":Se.sessionId;return o.jsxs("div",{className:"github-review-record-row",children:[o.jsxs("div",{className:"github-review-record-main",children:[o.jsxs("div",{className:"github-review-record-title",children:[o.jsxs("a",{href:Se.mergeRequestUrl,target:"_blank",rel:"noreferrer",children:[Se.pathWithNamespace,"!",Se.mergeRequestIid,o.jsx(JA,{})]}),o.jsx("span",{className:`github-review-record-status is-${Se.status}`,children:oYt(Se.status)})]}),o.jsxs("span",{children:[aYt(Se.trigger),Se.action?` · ${Se.action}`:""," · ",lYt(Se.createdAt),Ke?` · ${Ke}`:""]})]}),o.jsx("div",{className:"github-review-record-actions",children:it&&t?o.jsx("button",{type:"button",onClick:()=>t(it),children:"打开 Session"}):null})]},Se.id)})}):null,Oe?o.jsxs("div",{className:"github-list-pagination","aria-label":"GitLab 评审记录分页",children:[o.jsx("span",{children:doe(W,ZA,L.length,X)}),o.jsxs("div",{children:[o.jsx("button",{type:"button",onClick:()=>{H(W-1),Qe(W-1)},disabled:W<=1||I,children:"上一页"}),o.jsx("button",{type:"button",onClick:()=>{H(W+1),Qe(W+1)},disabled:!X||I,children:"下一页"})]})]}):null]})]})]})})]})}const dYt=1050062,foe="1.0",fYt="https://lf-static.applogcdn.com/obj/applog-sdk-static/log-sdk/collect/5/collect.js";class hYt{constructor(){tn(this,"enabled",!1);tn(this,"initialized",!1);tn(this,"pending",[]);tn(this,"userUniqueId","");tn(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:dYt,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=fYt,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 pYt=256,XFe=1024,_4="[REDACTED]";function mYt(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 hh(e,t){return t===void 0?{errorKind:e}:{errorKind:e,errorCode:t}}function YFe(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 gYt(e){return e.replace(/\b(Authorization\s*[:=]\s*)(Bearer\s+)?[^\s"',;&]+/gi,(t,n,i)=>`${n}${i??""}${_4}`).replace(/\bBearer\s+[A-Za-z0-9._~+/=-]+/gi,`Bearer ${_4}`).replace(/\b([\w.-]*(?:token|password|passwd|secret|api[_-]?key|access[_-]?key|secret[_-]?key|cookie)[\w.-]*\s*[:=]\s*)(["']?)[^\s"',;&]+/gi,(t,n,i)=>`${n}${i}${_4}`)}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 YFe(gYt(r),XFe,t)}function Na(e,t={}){const n=e!==null&&typeof e=="object"?e:{},i=mYt(n.code),r=typeof n.name=="string"?n.name:"";if(r==="RuntimeProbeError")return hh("runtime_probe_error",i);if(r==="AbortError")return hh("abort",i);if(r==="RuntimeAccessDeniedError"||r==="AuthError")return hh("auth",i);if(t.phase==="build")return hh("build_failed",i);if(r==="TimeoutError")return hh("timeout",i);if(r==="NetworkError"||r==="TypeError")return hh("network",i);if(r==="ValidationError")return hh("validation",i);if(r==="ServerError")return hh("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 hh("unknown",i);const a=String(s);return s===401||s===403?{errorKind:"auth",errorCode:a}:s===400||s===409||s===422?{errorKind:"validation",errorCode:a}:s>=500?{errorKind:"server",errorCode:a}:{errorKind:"unknown",errorCode:a}}const bYt=["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"],yYt={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 vYt(e){return typeof e=="string"||typeof e=="number"&&Number.isFinite(e)}function hoe(e,t){const n=new Set([...bYt,...yYt[e]]),i={};for(const[r,s]of Object.entries(t))!n.has(r)||!vYt(s)||(typeof s=="string"?i[r]=YFe(s,r==="error_message"?XFe:pYt):i[r]=s);return i}function xYt(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).slice(2)}`}function wYt(){return typeof performance<"u"?performance.now():Date.now()}function Y0(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}class OYt{constructor(t){tn(this,"sink");tn(this,"createId");tn(this,"now");tn(this,"pageInstanceId");tn(this,"context");tn(this,"identity");tn(this,"entryViewed",!1);tn(this,"sessionStarted",!1);this.sink=t.sink,this.createId=t.createId??xYt,this.now=t.now??wYt,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=hoe("studio_entry_viewed",Y0({schema_version:foe,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=>Y0({runtime_region:n.runtimeRegion,runtime_is_mine:n.runtimeIsMine,sandbox_status:n.sandboxStatus}),n=>Y0({error_kind:n.errorKind,error_code:n.errorCode}))}beginAgentMessage(t){return this.beginOperation("studio_agent_message",Y0({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=>Y0({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(),a=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()-a)},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=hoe(t,Y0({schema_version:foe,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 ZFe=new hYt,Yf=new OYt({sink:ZFe});function kYt(e){return ZFe.init(e)}function SYt(e){Yf.setContext(e)}function EYt(e){Yf.identify(e)}function CYt(e){Yf.trackStudioEntryViewed(e)}function TYt(e){Yf.trackStudioSessionStarted(e)}function JFe(e){return Yf.beginAgentDeploy(e)}function AYt(e){return Yf.beginSandboxCreate(e)}function _Yt(e){return Yf.beginAgentDebug(e)}function e_(e){return Yf.beginAgentConnect(e)}function poe(e){return Yf.beginAgentMessage(e)}function e8e(e){return Yf.beginAgentSourceDownload(e)}const jYt=/^[A-Za-z_][A-Za-z0-9_]*$/;function TT(e,t=n=>Kt(`validation.agentName.${n}`)){return e.trim().length===0?t("required"):e==="user"?t("reserved"):jYt.test(e)?null:t("characters")}function NYt(e){const t=new Set,n=new Set,i=r=>{TT(r.name)===null&&(t.has(r.name)?n.add(r.name):t.add(r.name)),r.subAgents.forEach(i)};return i(e),n}function RYt(e){return{...iu(),name:e,description:Uf("feishu.generatedAgent.description"),instruction:Uf("feishu.generatedAgent.instruction"),deployment:{feishuEnabled:!0}}}async function IYt(e){const t=RYt(e.agentName),n=await zk(t);return Wy(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 of=["cn-beijing","cn-shanghai"],t8e=["prepare","build","deploy","publish"];function PYt(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.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 DYt(e){return o.jsx("svg",{viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m5 7 4 4 4-4",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function moe(e){return o.jsx("svg",{viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m4 9.2 3.1 3.1L14 5.8",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}function MYt(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.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 LYt(e){if(!e||e==="upload")return 0;const t=t8e.findIndex(n=>n===e);return t<0?0:t}function j4(e){switch(e){case"prepare":case"upload":case"build":case"deploy":case"publish":case"update":case"evaluation":return e;default:return"unknown"}}function goe(e){const t=TT(e,n=>n);return t?`feishu.validation.agentName.${t}`:""}function $Yt({onBack:e}){const{t}=_e("automations"),[n,i]=p.useState("feishu_assistant"),[r,s]=p.useState(""),[a,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,N]=p.useState(""),[A,j]=p.useState(null),T=p.useRef(null),R=p.useRef(null),_=p.useRef([]),D=p.useRef(0),M=p.useRef(null),P=p.useRef(null),L=p.useRef("prepare"),F=p.useRef(!1),I=p.useRef(!0),z=["preparing","running","cancelling"].includes(O);p.useEffect(()=>(I.current=!0,()=>{I.current=!1}),[]),p.useEffect(()=>{var Ee;if(!h)return;(Ee=_.current[D.current])==null||Ee.focus();const Z=Y=>{Y.target instanceof Node&&T.current&&!T.current.contains(Y.target)&&m(!1)},ue=Y=>{var G;Y.key==="Escape"&&(m(!1),(G=R.current)==null||G.focus())};return window.addEventListener("pointerdown",Z),window.addEventListener("keydown",ue),()=>{window.removeEventListener("pointerdown",Z),window.removeEventListener("keydown",ue)}},[h]);const K=Z=>{Z.key==="Enter"&&(Z.nativeEvent.isComposing||Z.nativeEvent.keyCode===229)&&Z.preventDefault()},B=()=>{const Z=goe(n.trim()),ue=r.trim()?"":"feishu.validation.appId",Ee=a.trim()?"":"feishu.validation.appSecret";return b(Z),y(ue),w(Ee),!Z&&!ue&&!Ee},W=async Z=>{if(Z.preventDefault(),!B()||z)return;const ue=crypto.randomUUID();M.current=ue,L.current="prepare",F.current=!1,S("preparing"),C(null),N(""),j(null);const Ee=JFe({agentId:String(n.trim()),deployAction:"create",deploySource:"feishu_automation",createMode:"feishu_template",aiAssisted:0,deployRegion:String(d),runtimeNetworkType:"public",feishuEnabled:1});P.current=Ee;try{const Y=await IYt({agentName:n.trim(),appId:r.trim(),appSecret:a.trim(),region:d,taskId:ue,onStage:G=>{L.current=G.phase||"deploy",!(!I.current||F.current)&&(S("running"),C(G))}});if(F.current){Ee.fail({failedPhase:j4(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:j4(L.current),...F.current?{errorKind:"abort"}:Na(Y,{phase:L.current}),errorMessage:qb(Y)}),!I.current||F.current)return;S("failed"),N(Y instanceof Error?Y.message:String(Y))}finally{M.current===ue&&(M.current=null),P.current===Ee&&(P.current=null)}},H=async()=>{var ue;const Z=M.current;if(!(!Z||O!=="running")&&window.confirm(t("feishu.confirmCancel"))){F.current=!0,S("cancelling"),N("");try{await ICe(Z),(ue=P.current)==null||ue.fail({failedPhase:j4(L.current),errorKind:"abort",errorMessage:qb("User cancelled deployment")}),I.current&&S("cancelled")}catch(Ee){if(F.current=!1,!I.current)return;S("failed"),N(Ee instanceof Error?Ee.message:String(Ee))}}},X=LYt((k==null?void 0:k.phase)??null),ie=!!(n.trim()&&r.trim()&&a.trim()&&!z),Q=t(`feishu.regions.${d}`);return o.jsxs("div",{className:"feishu-integration-page",children:[o.jsxs("header",{className:"feishu-integration-header",children:[o.jsx("button",{type:"button",className:"feishu-back",onClick:e,"aria-label":t("backToAutomations"),disabled:z,children:o.jsx(PYt,{})}),o.jsx("img",{className:"feishu-integration-logo",src:YD,alt:"","aria-hidden":"true"}),o.jsxs("div",{children:[o.jsx("h1",{children:t("feishu.title")}),o.jsx("p",{children:t("feishu.description")})]})]}),o.jsx("div",{className:"feishu-integration-layout",children:o.jsxs("section",{className:"feishu-section-panel",children:[o.jsx("p",{className:"feishu-panel-description",children:t("feishu.panel")}),o.jsxs("form",{className:"feishu-form",onSubmit:W,onKeyDown:K,noValidate:!0,children:[o.jsxs("div",{className:"feishu-field-grid",children:[o.jsxs("div",{className:"feishu-field",children:[o.jsx("label",{htmlFor:"feishu-agent-name",children:t("feishu.agentName")}),o.jsx("input",{id:"feishu-agent-name",value:n,maxLength:64,disabled:z,onChange:Z=>{i(Z.target.value),g&&b("")},onBlur:()=>b(goe(n.trim())),"aria-invalid":!!g,"aria-describedby":`feishu-agent-name-help${g?" feishu-agent-name-error":""}`}),o.jsx("span",{id:"feishu-agent-name-help",className:"feishu-field-help",children:t("feishu.agentNameHelp")}),g?o.jsx("span",{id:"feishu-agent-name-error",className:"feishu-field-error",role:"alert",children:t(g)}):null]}),o.jsxs("div",{className:"feishu-field",children:[o.jsx("label",{id:"feishu-region-label",children:t("feishu.region")}),o.jsxs("div",{className:"feishu-region-picker",ref:T,children:[o.jsxs("button",{ref:R,type:"button",className:"feishu-region-trigger",disabled:z,"aria-haspopup":"listbox","aria-expanded":h,"aria-labelledby":"feishu-region-label feishu-region-value",onClick:()=>{D.current=of.findIndex(Z=>Z===d),m(Z=>!Z)},onKeyDown:Z=>{Z.key!=="ArrowDown"&&Z.key!=="ArrowUp"||(Z.preventDefault(),D.current=Z.key==="ArrowUp"?of.length-1:of.findIndex(ue=>ue===d),m(!0))},children:[o.jsx("span",{id:"feishu-region-value",children:Q}),o.jsx(DYt,{})]}),h?o.jsx("div",{className:"feishu-region-menu",role:"listbox","aria-label":t("feishu.region"),onKeyDown:Z=>{var Y;const ue=_.current.findIndex(G=>G===document.activeElement);let Ee=null;Z.key==="ArrowDown"?Ee=(ue+1)%of.length:Z.key==="ArrowUp"?Ee=(ue-1+of.length)%of.length:Z.key==="Home"?Ee=0:Z.key==="End"?Ee=of.length-1:Z.key==="Tab"&&m(!1),Ee!==null&&(Z.preventDefault(),(Y=_.current[Ee])==null||Y.focus())},children:of.map(Z=>o.jsx("button",{ref:ue=>{const Ee=of.findIndex(Y=>Y===Z);_.current[Ee]=ue},type:"button",role:"option","aria-selected":d===Z,className:`feishu-region-option${d===Z?" is-selected":""}`,onClick:()=>{var ue;f(Z),m(!1),(ue=R.current)==null||ue.focus()},children:t(`feishu.regions.${Z}`)},Z))}):null]}),o.jsx("span",{className:"feishu-field-help",children:t("feishu.regionHelp")})]}),o.jsxs("div",{className:"feishu-field",children:[o.jsx("label",{htmlFor:"feishu-app-id",children:t("feishu.appId")}),o.jsx("input",{id:"feishu-app-id",value:r,maxLength:128,autoComplete:"off",disabled:z,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":""}`}),o.jsx("span",{id:"feishu-app-id-help",className:"feishu-field-help",children:t("feishu.appIdHelp")}),v?o.jsx("span",{id:"feishu-app-id-error",className:"feishu-field-error",role:"alert",children:t(v)}):null]}),o.jsxs("div",{className:"feishu-field",children:[o.jsx("label",{htmlFor:"feishu-app-secret",children:t("feishu.appSecret")}),o.jsxs("div",{className:"feishu-secret-input",children:[o.jsx("input",{id:"feishu-app-secret",type:c?"text":"password",value:a,maxLength:256,autoComplete:"off",disabled:z,placeholder:t("feishu.appSecretPlaceholder"),onChange:Z=>{l(Z.target.value),x&&w("")},onBlur:()=>w(a.trim()?"":"feishu.validation.appSecret"),"aria-invalid":!!x,"aria-describedby":`feishu-app-secret-help${x?" feishu-app-secret-error":""}`}),o.jsx("button",{type:"button",disabled:z,onClick:()=>u(Z=>!Z),"aria-label":t(c?"feishu.hideSecret":"feishu.showSecret"),children:t(c?"feishu.hide":"feishu.show")})]}),o.jsx("span",{id:"feishu-app-secret-help",className:"feishu-field-help",children:t("feishu.appSecretHelp")}),x?o.jsx("span",{id:"feishu-app-secret-error",className:"feishu-field-error",role:"alert",children:t(x)}):null]})]}),O!=="idle"?o.jsxs("div",{className:`feishu-deployment-status is-${O}`,role:O==="failed"?"alert":"status",children:[o.jsxs("div",{className:"feishu-deployment-heading",children:[O==="preparing"?o.jsx(bn,{as:"strong",children:t("feishu.status.preparing")}):null,O==="running"?o.jsx(bn,{as:"strong",children:k?XD(k):t("feishu.status.running")}):null,O==="cancelling"?o.jsx(bn,{as:"strong",children:t("feishu.status.cancelling")}):null,O==="succeeded"?o.jsxs("strong",{children:[o.jsx(moe,{}),t("feishu.status.succeeded")]}):null,O==="cancelled"?o.jsx("strong",{children:t("feishu.status.cancelled")}):null,O==="failed"?o.jsx("strong",{children:t("feishu.status.failed")}):null]}),O==="preparing"||O==="running"||O==="cancelling"?o.jsx("ol",{className:"feishu-deployment-steps",children:t8e.map((Z,ue)=>{const Ee=O==="running"&&uevoid H(),children:t("feishu.cancelDeployment")}):null,o.jsx("button",{type:"submit",className:"feishu-submit",disabled:!ie,children:t(z?"feishu.creating":"feishu.create")})]})]})]})]})})]})}async function kq(e,t,n,i=Va){var s;const r=await gn(e,{...t,headers:{accept:"application/json",...t.headers},signal:n},i);if(!r.ok){let a="";try{a=((s=(await r.json()).detail)==null?void 0:s.trim())||""}catch{}throw new Error(a||V("common.requestFailed",{status:r.status}))}return r.json()}function FYt(e){return kq("/web/coding-agents/capabilities",{method:"GET"},e,vU)}function BYt(e,t){return kq(`/web/coding-agents/skills/${encodeURIComponent(e)}/preview`,{method:"GET"},t)}function UYt(e,t){return kq("/web/coding-agents/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)},t)}const QYt="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 zYt(){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:o.jsx("path",{d:"m4 4 8 8m0-8-8 8",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})})}function boe(){return o.jsxs("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[o.jsx("path",{d:"M4 1.8h5l3 3V14H4z",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"}),o.jsx("path",{d:"M9 1.8V5h3M6 8h4M6 10.5h4",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]})}function yoe(){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:o.jsx("path",{d:"M1.8 4.5h4l1.2-1.3h2.2l1.2 1.3h3.8v8H1.8z",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"})})}function VYt(e){return e instanceof DOMException&&e.name==="AbortError"}function HYt(e){return e instanceof Error&&e.message?e.message:""}function qYt(e){return e<1024?`${e} B`:`${(e/1024).toFixed(e<10*1024?1:0)} KB`}function WYt(e){const t=e.split("/");return t[t.length-1]??e}function KYt(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 GYt({skill:e,onClose:t}){const{t:n}=_e("automations"),i=p.useRef(null),r=p.useRef(null),s=p.useId(),a=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(""),BYt(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&&!VYt(S)&&g(HYt(S))}).finally(()=>{O.signal.aborted||h(!1)}),()=>O.abort()},[b,e.id]);const y=p.useMemo(()=>KYt((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 o.jsxs("dialog",{ref:i,className:"coding-agents-preview-dialog","aria-labelledby":s,"aria-describedby":a,onCancel:O=>{O.preventDefault(),t()},onMouseDown:O=>{const S=O.currentTarget.getBoundingClientRect();(O.clientXS.right||O.clientYS.bottom)&&t()},children:[o.jsxs("header",{className:"coding-agents-preview-header",children:[o.jsx("span",{className:"coding-agents-preview-mark",children:o.jsx(yoe,{})}),o.jsxs("div",{children:[o.jsx("h2",{id:s,children:w}),o.jsx("p",{id:a,children:n("codingAgents.preview.description")})]}),o.jsx("button",{type:"button",autoFocus:!0,"aria-label":n("codingAgents.preview.close"),onClick:t,children:o.jsx(zYt,{})})]}),f?o.jsxs("div",{className:"coding-agents-preview-state",children:[o.jsx("i",{}),n("codingAgents.preview.loading")]}):m?o.jsxs("div",{className:"coding-agents-preview-state is-error",role:"alert",children:[o.jsx("span",{children:m||n("codingAgents.preview.error")}),o.jsx("button",{type:"button",onClick:()=>v(O=>O+1),children:n("codingAgents.retry")})]}):o.jsxs("div",{className:"coding-agents-preview-layout",children:[o.jsxs("nav",{className:"coding-agents-preview-tree","aria-label":n("codingAgents.preview.skillFiles",{name:w}),children:[o.jsxs("div",{className:"coding-agents-preview-tree-title",children:[o.jsx("span",{children:n("codingAgents.preview.files")}),o.jsx("small",{children:(l==null?void 0:l.files.length)??0})]}),o.jsx("div",{className:"coding-agents-preview-tree-scroll",children:y.map(O=>O.directory?o.jsxs("details",{open:!0,children:[o.jsxs("summary",{children:[o.jsx(yoe,{}),o.jsx("span",{children:O.directory})]}),o.jsx("div",{children:O.files.map(S=>o.jsxs("button",{type:"button",className:u===S.path?"is-selected":"","aria-current":u===S.path?"true":void 0,onClick:()=>d(S.path),children:[o.jsx(boe,{}),o.jsx("span",{children:WYt(S.path)})]},S.path))})]},O.directory):O.files.map(S=>o.jsxs("button",{type:"button",className:u===S.path?"is-selected":"","aria-current":u===S.path?"true":void 0,onClick:()=>d(S.path),children:[o.jsx(boe,{}),o.jsx("span",{children:S.path})]},S.path)))})]}),o.jsx("section",{className:"coding-agents-preview-file","aria-label":n("codingAgents.preview.fileContent"),children:x?o.jsxs(o.Fragment,{children:[o.jsxs("header",{children:[o.jsx("strong",{children:x.path}),o.jsx("span",{children:qYt(x.size)})]}),x.previewable&&x.content!==null?o.jsx("pre",{tabIndex:0,children:o.jsx("code",{children:x.content})}):o.jsx("div",{className:"coding-agents-preview-unavailable",children:n("codingAgents.preview.notPreviewable")})]}):o.jsx("div",{className:"coding-agents-preview-unavailable",children:n("codingAgents.preview.noFiles")})})]})]})}function XYt(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.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 YYt(e){return o.jsxs("svg",{viewBox:"0 0 32 32",fill:"none","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.5",y:"5",width:"16",height:"16",rx:"4.5",stroke:"currentColor",strokeWidth:"1.5"}),o.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"}),o.jsx("circle",{cx:"24.5",cy:"10.5",r:"2.5",stroke:"currentColor",strokeWidth:"1.5"}),o.jsx("circle",{cx:"24.5",cy:"24.5",r:"2.5",stroke:"currentColor",strokeWidth:"1.5"}),o.jsx("path",{d:"M19.5 10.5H22M18.2 19l4.3 3.7M24.5 13v9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}function ZYt(e){return o.jsx("svg",{viewBox:"0 0 32 32",fill:"none","aria-hidden":"true",...e,children:o.jsxs("g",{stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",children:[o.jsx("path",{d:"M16 4.5v7M16 20.5v7"}),o.jsx("path",{d:"m9.3 6.3 3.5 6.1M19.2 19.6l3.5 6.1"}),o.jsx("path",{d:"m5.9 11.1 6.2 3.5M19.9 17.4l6.2 3.5"}),o.jsx("path",{d:"M4.7 16h7M20.3 16h7"}),o.jsx("path",{d:"m5.9 20.9 6.2-3.5M19.9 14.6l6.2-3.5"}),o.jsx("path",{d:"m9.3 25.7 3.5-6.1M19.2 12.4l3.5-6.1"})]})})}function JYt(e){return o.jsxs("svg",{viewBox:"0 0 32 32",fill:"none","aria-hidden":"true",...e,children:[o.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"}),o.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 voe(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m3.4 8.2 3 3L12.8 5",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function eZt(e){return o.jsxs("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",...e,children:[o.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"}),o.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 tZt({agentId:e}){return e==="trae"?o.jsx("img",{src:QYt,alt:"","aria-hidden":"true"}):e==="claude-code"?o.jsx(ZYt,{}):o.jsx(JYt,{})}function xoe(e){return e instanceof DOMException&&e.name==="AbortError"}function woe(e,t){return e instanceof Error&&e.message?e.message:t}function nZt({onBack:e}){var j;const{t}=_e("automations"),[n,i]=p.useState(null),[r,s]=p.useState(!0),[a,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),FYt(T.signal).then(R=>{if(T.signal.aborted)return;i(R);const _=R.agents.filter(D=>D.available);f(D=>{const M=_.filter(P=>D.has(P.id));return new Set((M.length?M:_.slice(0,1)).map(P=>P.id))}),m(D=>{const M=R.skills.filter(P=>D.has(P.id));return new Set((M.length?M:R.skills).map(P=>P.id))})}).catch(R=>{!xoe(R)&&!T.signal.aborted&&(i(null),l(woe(R,"")))}).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,R)=>{!R||v||(w(null),f(_=>{const D=new Set(_);return D.has(T)?D.delete(T):D.add(T),D}))},N=T=>{v||(w(null),m(R=>{const _=new Set(R);return _.has(T)?_.delete(T):_.add(T),_}))},A=async()=>{var R;if(!C)return;(R=O.current)==null||R.abort();const T=new AbortController;O.current=T,y(!0),w(null);try{const _=await UYt({agents:S.map(M=>M.id),skills:k.map(M=>M.id)},T.signal);if(T.signal.aborted)return;const D=_.installations;w({tone:"success",agentCount:S.length,skillCount:k.length,installations:D})}catch(_){!xoe(_)&&!T.signal.aborted&&w({tone:"error",message:woe(_,"")})}finally{O.current===T&&(O.current=null),T.signal.aborted||y(!1)}};return o.jsxs("section",{className:"coding-agents-page",children:[o.jsxs("header",{className:"coding-agents-header",children:[o.jsx("button",{type:"button",className:"coding-agents-back",onClick:e,disabled:v,"aria-label":t("backToAutomations"),children:o.jsx(XYt,{})}),o.jsx(YYt,{className:"coding-agents-logo"}),o.jsxs("div",{children:[o.jsx("h1",{children:t("codingAgents.title")}),o.jsx("p",{children:t("codingAgents.description")})]})]}),o.jsx("div",{className:"coding-agents-scroll",children:o.jsxs("div",{className:"coding-agents-content",children:[o.jsxs("section",{className:"coding-agents-section","aria-label":t("codingAgents.clients.ariaLabel"),children:[o.jsxs("div",{className:"coding-agents-section-heading",children:[o.jsxs("div",{children:[o.jsx("span",{children:"1"}),o.jsx("h2",{children:t("codingAgents.clients.title")})]}),o.jsx("button",{type:"button",onClick:()=>u(T=>T+1),disabled:r||v,children:t("codingAgents.clients.detectAgain")})]}),r?o.jsxs("div",{className:"coding-agents-inline-state",children:[o.jsx("i",{}),t("codingAgents.clients.detecting")]}):a!==null?o.jsxs("div",{className:"coding-agents-error-row",role:"alert",children:[o.jsx("span",{children:a||t("codingAgents.errors.detect")}),o.jsx("button",{type:"button",onClick:()=>u(T=>T+1),children:t("codingAgents.retry")})]}):o.jsx("div",{className:"coding-agents-agent-grid",children:n==null?void 0:n.agents.map(T=>o.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:[o.jsx("span",{className:`coding-agents-agent-mark is-${T.id}`,children:o.jsx(tZt,{agentId:T.id})}),o.jsxs("span",{className:"coding-agents-agent-copy",children:[o.jsx("strong",{children:T.name}),o.jsx("small",{children:T.available?T.version||t("codingAgents.clients.detected"):T.reason})]}),o.jsx("span",{className:`coding-agents-status ${T.available?"is-ready":""}`,children:T.available?t("codingAgents.clients.available"):t("codingAgents.clients.unavailable")}),o.jsx("span",{className:"coding-agents-check",children:o.jsx(voe,{})})]},T.id))})]}),o.jsxs("section",{className:"coding-agents-section","aria-label":t("codingAgents.skills.ariaLabel"),children:[o.jsx("div",{className:"coding-agents-section-heading",children:o.jsxs("div",{children:[o.jsx("span",{children:"2"}),o.jsx("h2",{children:t("codingAgents.skills.title")})]})}),o.jsx("div",{className:"coding-agents-skill-list",children:n==null?void 0:n.skills.map(T=>o.jsxs("div",{className:`coding-agents-skill ${h.has(T.id)?"is-selected":""}`,children:[o.jsxs("label",{children:[o.jsx("input",{type:"checkbox",checked:h.has(T.id),onChange:()=>N(T.id),disabled:v}),o.jsx("span",{className:"coding-agents-skill-check","aria-hidden":"true",children:o.jsx(voe,{})}),o.jsxs("span",{children:[o.jsx("strong",{children:t(`codingAgents.skills.items.${T.id}.name`,{defaultValue:T.name})}),o.jsx("small",{children:t(`codingAgents.skills.items.${T.id}.description`,{defaultValue:T.description})})]})]}),o.jsx("button",{type:"button",onClick:()=>b(T),children:t("codingAgents.skills.viewFiles")})]},T.id))}),o.jsxs("div",{className:"coding-agents-global","aria-label":t("codingAgents.global.ariaLabel"),children:[o.jsxs("div",{className:"coding-agents-global-heading",children:[o.jsx(eZt,{}),o.jsxs("div",{children:[o.jsx("strong",{children:t("codingAgents.global.title")}),o.jsx("span",{children:t("codingAgents.global.description")})]})]}),S.length?o.jsx("dl",{children:S.map(T=>o.jsxs("div",{children:[o.jsx("dt",{children:T.name}),o.jsx("dd",{children:T.globalSkillsPath})]},T.id))}):o.jsx("p",{children:t("codingAgents.global.empty")})]})]}),x?o.jsxs("div",{className:`coding-agents-result is-${x.tone}`,role:x.tone==="error"?"alert":"status",children:[o.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?o.jsx("ul",{children:x.installations.map(T=>o.jsxs("li",{children:[T.agentName," · ",t(`codingAgents.skills.items.${T.skillId}.name`,{defaultValue:T.skill})," → ",T.displayPath]},`${T.agent}:${T.skillId}`))}):null]}):null,o.jsxs("div",{className:"coding-agents-actions",children:[o.jsx("span",{children:S.length?t("codingAgents.selection",{agentCount:S.length,skillCount:k.length}):t("codingAgents.selectClient")}),o.jsx("button",{type:"button",onClick:()=>void A(),disabled:!C,children:t(v?"codingAgents.configuring":"codingAgents.configure")})]})]})}),g?o.jsx(GYt,{skill:g,onClose:()=>b(null)}):null]})}async function Sq(e,t){const n=await e.json().catch(()=>null),i=typeof(n==null?void 0:n.detail)=="string"?n.detail:"";return new Error(i||V("common.fallbackWithHttpStatus",{fallback:t,status:e.status}))}async function iZt(e){const t=await gn("/web/website-integrations",{cache:"no-store",signal:e});if(!t.ok)throw await Sq(t,V("websiteIntegration.listFailed"));return(await t.json()).integrations??[]}async function rZt(e){const t=await gn("/web/website-integrations",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw await Sq(t,V("websiteIntegration.createFailed"));return t.json()}async function sZt(e){const t=await gn(`/web/website-integrations/${encodeURIComponent(e)}`,{method:"DELETE"});if(!t.ok)throw await Sq(t,V("websiteIntegration.deleteFailed"))}function oZt(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.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 Ooe(e){return o.jsxs("svg",{viewBox:"0 0 32 32",fill:"none","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.5",y:"5",width:"20",height:"17",rx:"3.5",stroke:"currentColor",strokeWidth:"1.5"}),o.jsx("path",{d:"M4.5 10h18M8.5 7.5h.1M11.5 7.5h.1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),o.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"}),o.jsx("path",{d:"M21 19h4M21 22.5h3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}function aZt(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 lZt(e){const t=[];let n="";for(let i=0;i<10;i+=1){const r=await Qw({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 cZt({onBack:e}){const{t,i18n:n}=_e("websiteIntegration"),[i,r]=p.useState([]),[s,a]=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([iZt(j.signal),lZt(j.signal)]).then(([T,R])=>{var D;if(j.signal.aborted)return;r(T),a(R),d(((D=T[0])==null?void 0:D.id)??"");const _=R[0];_&&c(`${_.region}::${_.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?` +