const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PersonalizationDrawer.js","assets/index.js","assets/CloseButton.js","assets/_plugin-vue_export-helper.js","assets/CloseButton.css","assets/useMarkdownRenderer.js","assets/PersonalizationDrawer.css","assets/ImagePicker.js","assets/ImagePicker.css","assets/ConversationReviewDialog.js","assets/ConversationReviewDialog.css","assets/SubAgentActivityDialog.js","assets/SubAgentActivityDialog.css","assets/BackgroundCommandDialog.js","assets/VersioningDialog.js","assets/VersioningDialog.css","assets/UserQuestionDialog.js","assets/UserQuestionDialog.css","assets/PlanApprovalDialog.js","assets/PlanApprovalDialog.css","assets/SandboxSetupDialog.js","assets/SandboxSetupDialog.css","assets/TutorialOverlay.js","assets/NewUserTutorialPrompt.js","assets/NewUserTutorialPrompt.css","assets/GoalProgressDialog.js","assets/GoalProgressDialog.css","assets/WorkflowDemoShell.js","assets/WorkflowDemoShell.css","assets/VirtualMonitorSurface.js","assets/PathAuthorizationDialog.js","assets/PathAuthorizationDialog.css"])))=>i.map(i=>d[i]); var VB=Object.defineProperty;var qM=s=>{throw TypeError(s)};var GB=(s,e,t)=>e in s?VB(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var Se=(s,e,t)=>GB(s,typeof e!="symbol"?e+"":e,t),Qk=(s,e,t)=>e.has(s)||qM("Cannot "+t);var f=(s,e,t)=>(Qk(s,e,"read from private field"),t?t.call(s):e.get(s)),B=(s,e,t)=>e.has(s)?qM("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(s):e.set(s,t),R=(s,e,t,n)=>(Qk(s,e,"write to private field"),n?n.call(s,t):e.set(s,t),t),H=(s,e,t)=>(Qk(s,e,"access private method"),t);var Ls=(s,e,t,n)=>({set _(i){R(s,e,i,t)},get _(){return f(s,e,n)}});import{k as be,E as ry,G as kE,H as KB,I as UP,j as ge,J as CE,K as WP,L as zP,M as qB,N as QB,O as XB,y as oy,P as ft,Q as YB,w as Ke,l as S,D as lt,R as JB,S as jP,a as Rn,d as ct,o as dn,U as QM,s as We,V as VP,W as ZB,m as F,c as U,n as Ce,f as M,z as qe,t as Q,e as me,x as Gt,F as Ie,r as Ze,X as ay,Y as Mi,Z as PT,b as Ft,h as cn,_ as eF,B as De,$ as Tf,u as Ne,a0 as tF,T as gs,g as Ov,A as Dv,i as yw,a1 as sF,a2 as nF,a3 as iF,a4 as rF,a5 as oF,a6 as aF,a7 as rr,p as GP,a8 as lF,a9 as Hs,aa as cF,q as uF}from"./index.js";import{_ as qt}from"./_plugin-vue_export-helper.js";import{P as PS,p as dF,a as hF,b as fF,r as KP,k as pF}from"./useMarkdownRenderer.js";import{C as ml,F as mF,T as gF,I as vF,a as yF}from"./CloseButton.js";/*! * pinia v3.0.4 * (c) 2025 Eduardo San Martin Morote * @license MIT */let qP;const ak=s=>qP=s,QP=Symbol();function LT(s){return s&&typeof s=="object"&&Object.prototype.toString.call(s)==="[object Object]"&&typeof s.toJSON!="function"}var Nv;(function(s){s.direct="direct",s.patchObject="patch object",s.patchFunction="patch function"})(Nv||(Nv={}));function bF(){const s=UP(!0),e=s.run(()=>ge({}));let t=[],n=[];const i=CE({install(r){ak(i),i._a=r,r.provide(QP,i),r.config.globalProperties.$pinia=i,n.forEach(o=>t.push(o)),n=[]},use(r){return this._a?t.push(r):n.push(r),this},_p:t,_a:null,_e:s,_s:new Map,state:e});return i}const XP=()=>{};function XM(s,e,t,n=XP){s.add(e);const i=()=>{s.delete(e)&&n()};return!t&&QB()&&XB(i),i}function Qf(s,...e){s.forEach(t=>{t(...e)})}const _F=s=>s(),YM=Symbol(),Xk=Symbol();function OT(s,e){s instanceof Map&&e instanceof Map?e.forEach((t,n)=>s.set(n,t)):s instanceof Set&&e instanceof Set&&e.forEach(s.add,s);for(const t in e){if(!e.hasOwnProperty(t))continue;const n=e[t],i=s[t];LT(i)&<(n)&&s.hasOwnProperty(t)&&!ry(n)&&!kE(n)?s[t]=OT(i,n):s[t]=n}return s}const wF=Symbol();function SF(s){return!LT(s)||!Object.prototype.hasOwnProperty.call(s,wF)}const{assign:qc}=Object;function kF(s){return!!(ry(s)&&s.effect)}function CF(s,e,t,n){const{state:i,actions:r,getters:o}=e,a=t.state.value[s];let c;function l(){a||(t.state.value[s]=i?i():{});const u=YB(t.state.value[s]);return qc(u,r,Object.keys(o||{}).reduce((d,h)=>(d[h]=CE(be(()=>{ak(t);const p=t._s.get(s);return o[h].call(p,p)})),d),{}))}return c=YP(s,l,e,t,n,!0),c}function YP(s,e,t={},n,i,r){let o;const a=qc({actions:{}},t),c={deep:!0};let l,u,d=new Set,h=new Set,p;const g=n.state.value[s];!r&&!g&&(n.state.value[s]={});let v;function m(C){let E;l=u=!1,typeof C=="function"?(C(n.state.value[s]),E={type:Nv.patchFunction,storeId:s,events:p}):(OT(n.state.value[s],C),E={type:Nv.patchObject,payload:C,storeId:s,events:p});const x=v=Symbol();ft().then(()=>{v===x&&(l=!0)}),u=!0,Qf(d,E,n.state.value[s])}const y=r?function(){const{state:E}=t,x=E?E():{};this.$patch(D=>{qc(D,x)})}:XP;function _(){o.stop(),d.clear(),h.clear(),n._s.delete(s)}const b=(C,E="")=>{if(YM in C)return C[Xk]=E,C;const x=function(){ak(n);const D=Array.from(arguments),N=new Set,O=new Set;function G(V){N.add(V)}function Z(V){O.add(V)}Qf(h,{args:D,name:x[Xk],store:w,after:G,onError:Z});let q;try{q=C.apply(this&&this.$id===s?this:w,D)}catch(V){throw Qf(O,V),V}return q instanceof Promise?q.then(V=>(Qf(N,V),V)).catch(V=>(Qf(O,V),Promise.reject(V))):(Qf(N,q),q)};return x[YM]=!0,x[Xk]=E,x},k={_p:n,$id:s,$onAction:XM.bind(null,h),$patch:m,$reset:y,$subscribe(C,E={}){const x=XM(d,C,E.detached,()=>D()),D=o.run(()=>Ke(()=>n.state.value[s],N=>{(E.flush==="sync"?u:l)&&C({storeId:s,type:Nv.direct,events:p},N)},qc({},c,E)));return x},$dispose:_},w=oy(k);n._s.set(s,w);const A=(n._a&&n._a.runWithContext||_F)(()=>n._e.run(()=>(o=UP()).run(()=>e({action:b}))));for(const C in A){const E=A[C];if(ry(E)&&!kF(E)||kE(E))r||(g&&SF(E)&&(ry(E)?E.value=g[C]:OT(E,g[C])),n.state.value[s][C]=E);else if(typeof E=="function"){const x=b(E,C);A[C]=x,a.actions[C]=E}}return qc(w,A),qc(WP(w),A),Object.defineProperty(w,"$state",{get:()=>n.state.value[s],set:C=>{m(E=>{qc(E,C)})}}),n._p.forEach(C=>{qc(w,o.run(()=>C({store:w,app:n._a,pinia:n,options:a})))}),g&&r&&t.hydrate&&t.hydrate(w.$state,g),l=!0,u=!0,w}/*! #__NO_SIDE_EFFECTS__ */function hn(s,e,t){let n;const i=typeof e=="function";n=i?t:e;function r(o,a){const c=qB();return o=o||(c?zP(QP,null):null),o&&ak(o),o=qP,o._s.has(s)||(i?YP(s,e,n,o):CF(s,n,o)),o._s.get(s)}return r.$id=s,r}function O_(s,e){return Array.isArray(e)?e.reduce((t,n)=>(t[n]=function(){return s(this.$pinia)[n]},t),{}):Object.keys(e).reduce((t,n)=>(t[n]=function(){const i=s(this.$pinia),r=e[n];return typeof r=="function"?r.call(this,i):i[r]},t),{})}function Pr(s,e){return Array.isArray(e)?e.reduce((t,n)=>(t[n]=function(...i){return s(this.$pinia)[n](...i)},t),{}):Object.keys(e).reduce((t,n)=>(t[n]=function(...i){return s(this.$pinia)[e[n]](...i)},t),{})}function Zo(s,e){return Array.isArray(e)?e.reduce((t,n)=>(t[n]={get(){return s(this.$pinia)[n]},set(i){return s(this.$pinia)[n]=i}},t),{}):Object.keys(e).reduce((t,n)=>(t[n]={get(){return s(this.$pinia)[e[n]]},set(i){return s(this.$pinia)[e[n]]=i}},t),{})}function xi(s){const e=WP(s),t={};for(const n in e){const i=e[n];i.effect?t[n]=be({get:()=>s[n],set(r){s[n]=r}}):(ry(i)||kE(i))&&(t[n]=KB(s,n))}return t}const TF="modulepreload",AF=function(s){return"/static/dist/"+s},JM={},St=function(e,t,n){let i=Promise.resolve();if(t&&t.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),a=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));i=Promise.allSettled(t.map(c=>{if(c=AF(c),c in JM)return;JM[c]=!0;const l=c.endsWith(".css"),u=l?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${u}`))return;const d=document.createElement("link");if(d.rel=l?"stylesheet":TF,l||(d.as="script"),d.crossOrigin="",d.href=c,a&&d.setAttribute("nonce",a),document.head.appendChild(d),l)return new Promise((h,p)=>{d.addEventListener("load",h),d.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${c}`)))})}))}function r(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return i.then(o=>{for(const a of o||[])a.status==="rejected"&&r(a.reason);return e().catch(r)})},EF=typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(max-width: 768px)").matches:!1,Is=hn("ui",{state:()=>({sidebarCollapsed:!0,chatDisplayMode:"chat",rightWidth:420,rightCollapsed:!0,rightSplitRatio:.5,isResizing:!1,resizingPanel:null,minPanelWidth:350,maxPanelWidth:600,quotaToast:null,quotaToastTimer:null,toastQueue:[],nextToastId:1,confirmDialog:null,pendingConfirmResolver:null,easterEgg:{active:!1,effect:null,payload:null,instance:null,cleanupTimer:null,destroying:!1,destroyPromise:null},isMobileViewport:EF,mobileOverlayMenuOpen:!1,activeMobileOverlay:null,imagePreview:null}),actions:{openImagePreview(s){const e=String((s==null?void 0:s.url)||"");e&&(this.imagePreview={url:e,name:String((s==null?void 0:s.name)||"")})},closeImagePreview(){this.imagePreview=null},setSidebarCollapsed(s){this.sidebarCollapsed=s},toggleSidebar(){this.sidebarCollapsed=!this.sidebarCollapsed},setChatDisplayMode(s){this.chatDisplayMode=s},toggleChatDisplayMode(){this.chatDisplayMode=this.chatDisplayMode==="chat"?"monitor":"chat"},setRightWidth(s){this.rightWidth=s},setRightCollapsed(s){this.rightCollapsed=s},setRightSplitRatio(s){this.rightSplitRatio=Math.max(.15,Math.min(.85,s))},setResizing(s,e=null){this.isResizing=s,this.resizingPanel=s?e:null},setPanelBounds(s,e){this.minPanelWidth=s,this.maxPanelWidth=e},setIsMobileViewport(s){this.isMobileViewport=s,s||(this.mobileOverlayMenuOpen=!1,this.activeMobileOverlay=null)},setMobileOverlayMenuOpen(s){this.mobileOverlayMenuOpen=s},toggleMobileOverlayMenu(){this.mobileOverlayMenuOpen=!this.mobileOverlayMenuOpen},setActiveMobileOverlay(s){this.activeMobileOverlay=s},closeMobileOverlay(){this.activeMobileOverlay=null},showQuotaToastMessage(s,e="fast",t=5e3){this.quotaToast={message:s,type:e},this.quotaToastTimer&&clearTimeout(this.quotaToastTimer),this.quotaToastTimer=setTimeout(()=>{this.dismissQuotaToast()},t)},dismissQuotaToast(){this.quotaToastTimer&&(clearTimeout(this.quotaToastTimer),this.quotaToastTimer=null),this.quotaToast=null},pushToast(s={}){const e=s.title||"",t=s.message||"";if(!e&&!t)return 0;const n=this.nextToastId++,i={id:n,title:e,message:t,type:s.type||"info",closable:s.closable!==!1,timeoutId:null},r=Object.prototype.hasOwnProperty.call(s,"duration")?s.duration:4e3;return r!==null&&(i.timeoutId=setTimeout(()=>this.dismissToast(n),r)),this.toastQueue.push(i),n},updateToast(s,e={}){const t=this.toastQueue.find(n=>n.id===s);t&&(e.title!==void 0&&(t.title=e.title),e.message!==void 0&&(t.message=e.message),e.type!==void 0&&(t.type=e.type),e.closable!==void 0&&(t.closable=e.closable),Object.prototype.hasOwnProperty.call(e,"duration")&&(t.timeoutId&&(clearTimeout(t.timeoutId),t.timeoutId=null),e.duration!==null&&typeof e.duration=="number"&&(t.timeoutId=setTimeout(()=>this.dismissToast(s),e.duration))))},dismissToast(s){const e=this.toastQueue.findIndex(n=>n.id===s);if(e===-1)return;const[t]=this.toastQueue.splice(e,1);t&&t.timeoutId&&clearTimeout(t.timeoutId)},requestConfirm(s={}){return new Promise(e=>{if(this.pendingConfirmResolver){const t=this.pendingConfirmResolver;this.pendingConfirmResolver=null,t(!1)}this.confirmDialog={visible:!0,title:s.title||S("stores.confirmAction"),message:s.message||S("stores.confirmOperation"),confirmText:s.confirmText||S("common.confirm"),cancelText:s.cancelText||S("common.cancel"),warningText:s.warningText||"",closeOnBackdrop:s.closeOnBackdrop!==!1,confirmVariant:s.confirmVariant==="danger"?"danger":"primary",confirmOnLeft:s.confirmOnLeft===!0},this.pendingConfirmResolver=e})},resolveConfirm(s){this.confirmDialog&&(this.confirmDialog.visible=!1);const e=this.pendingConfirmResolver;this.pendingConfirmResolver=null,this.confirmDialog=null,e&&e(!!s)},setEasterEggState(s){this.easterEgg={...this.easterEgg,...s}},clearEasterEgg(){this.easterEgg={active:!1,effect:null,payload:null,instance:null,cleanupTimer:null,destroying:!1,destroyPromise:null}}}}),MF=Object.freeze(Object.defineProperty({__proto__:null,useUiStore:Is},Symbol.toStringTag,{value:"Module"})),xF=new Set(["chat","compact","hidden"]),RF=new Set(["user","presend"]),IF=new Set(["guidance","goal_review","compression","compression_handoff","sub_agent","background_command","workflow"]);function DT(s){return String(s||"").trim().toLowerCase()}function JP(s){return String((s==null?void 0:s.content)||(s==null?void 0:s.message)||"").trim()}function PF(s){const e=JP(s);return e.includes("【目标模式已开启】")||e.includes(`[系统通知|goal] 【目标模式已开启】`)}function ZP(s){return JP(s).includes("审核智能体对于你的工作结束给出了以下内容")}function Fd(s){var i;const e=(s==null?void 0:s.metadata)||{},t=DT(e.visibility||((i=e.ui)==null?void 0:i.visibility)||(s==null?void 0:s.visibility));if(xF.has(t))return t;if(e.hidden===!0||e.system_injected_image||e.system_injected_video)return"hidden";const n=DT(e.message_source||e.source||(s==null?void 0:s.message_source)||(s==null?void 0:s.source));return n==="skill"||n==="goal_prompt"||PF(s)||n==="notify"&&(e.runtime_mode_notice||s!=null&&s.runtime_mode_notice)?"hidden":IF.has(n)||ZP(s)?"compact":"chat"}function $v(s){var n;const e=(s==null?void 0:s.metadata)||{};if(typeof e.starts_work=="boolean")return e.starts_work;if(typeof((n=e.ui)==null?void 0:n.starts_work)=="boolean")return e.ui.starts_work;if(typeof(s==null?void 0:s.starts_work)=="boolean")return s.starts_work;if(Fd(s)==="hidden")return!1;const t=DT(e.message_source||e.source||(s==null?void 0:s.message_source)||(s==null?void 0:s.source));return t==="guidance"||t==="goal_prompt"||t==="skill"?!1:t==="goal_review"||ZP(s)?!0:t==="compression"||t==="compression_handoff"?!1:RF.has(t||"user")}const Yk=["stores.generatingBrainstorming","stores.generatingPreparing","stores.generatingPreparingTools","stores.generatingThink","stores.generatingAnswerSoon","stores.generatingLoadingInspiration","stores.generatingAssemblingIdeas","stores.generatingBestApproach","stores.generatingBrainMeeting","stores.generatingOrganizing","stores.generatingPolishing","stores.generatingContext","stores.generatingMemorySearch","stores.generatingAlmostDone","stores.generatingDomainExpand","stores.generatingToolchain","stores.generatingSentence","stores.generatingRethinking","stores.generatingKnowledgeSearch"],LF=//i;function OF(s){return s?LF.test(s):!1}function DF(){if(!Yk.length)return"";const s=Math.floor(Math.random()*Yk.length);return S(Yk[s])}function Jk(){return{role:"assistant",actions:[],streamingThinking:"",streamingText:"",currentStreamingType:null,activeThinkingId:null,awaitingFirstContent:!1,generatingLabel:DF()}}function D_(s){return`${s}-${Date.now()}-${Math.random().toString(36).slice(2)}`}function Zk(s){return new Set(Array.from(s))}function NF(s){return new Map(Array.from(s.entries()))}function eC(s){s&&s.awaitingFirstContent&&(s.awaitingFirstContent=!1)}const tC=(...s)=>{},TE=hn("chat",{state:()=>({messages:[],currentMessageIndex:-1,streamingMessage:!1,expandedBlocks:new Set,autoScrollEnabled:!0,userScrolling:!1,thinkingScrollLocks:new Map}),getters:{isScrollLocked:s=>s.autoScrollEnabled&&!s.userScrolling},actions:{setStreamingMessage(s){this.streamingMessage=!!s},setCurrentMessageIndex(s){this.currentMessageIndex=s},setMessages(s){this.messages=s},clearMessages(){this.messages=[],this.currentMessageIndex=-1},updateEditSummaryByMessageId(s,e){var n;const t=i=>{i.metadata={...i.metadata||{},edit_summary:e}};if(s)for(let i=this.messages.length-1;i>=0;i-=1){const r=this.messages[i];if((r==null?void 0:r.role)==="user"&&(r==null?void 0:r.message_id)===s){t(r);return}}for(let i=this.messages.length-1;i>=0;i-=1){const r=this.messages[i];if((r==null?void 0:r.role)==="user"&&((n=r==null?void 0:r.metadata)==null?void 0:n.starts_work)===!0){t(r);return}}},toggleBlock(s){const e=Zk(this.expandedBlocks);e.has(s)?e.delete(s):e.add(s),this.expandedBlocks=e},expandBlock(s){const e=Zk(this.expandedBlocks);e.add(s),this.expandedBlocks=e},collapseBlock(s){const e=Zk(this.expandedBlocks);e.delete(s),this.expandedBlocks=e},clearExpandedBlocks(){this.expandedBlocks=new Set},setThinkingLock(s,e){const t=NF(this.thinkingScrollLocks);e?t.set(s,!0):t.delete(s),this.thinkingScrollLocks=t},clearThinkingLocks(){this.thinkingScrollLocks=new Map},setScrollState(s){typeof s.autoScrollEnabled<"u"&&(this.autoScrollEnabled=!!s.autoScrollEnabled),typeof s.userScrolling<"u"&&(this.userScrolling=!!s.userScrolling)},enableAutoScroll(){this.setScrollState({autoScrollEnabled:!0,userScrolling:!1})},disableAutoScroll(){this.setScrollState({autoScrollEnabled:!1,userScrolling:!1})},toggleScrollLockState(){return this.isScrollLocked?(this.disableAutoScroll(),!1):(this.enableAutoScroll(),!0)},ensureAssistantMessage(){if(this.currentMessageIndex>=0)return this.messages[this.currentMessageIndex];const s=Jk();return this.messages.push(s),this.currentMessageIndex=this.messages.length-1,s},addUserMessage(s,e=[],t=[],n=[],i="user",r={}){const o=new Date().toISOString(),a=String(i||"user").trim().toLowerCase(),c={media_refs:Array.isArray(n)?n:[],message_source:a,...r};c.visibility=Fd({content:s,metadata:c}),c.starts_work=$v({content:s,metadata:c}),c.starts_work===!0&&(c.work_timer={status:"working",started_at:o}),this.messages.push({role:"user",content:s,images:e,videos:t,media_refs:Array.isArray(n)?n:[],metadata:c,created_at:o}),this.currentMessageIndex=-1},startAssistantMessage(){const s=Jk();return this.messages.push(s),this.currentMessageIndex=this.messages.length-1,this.streamingMessage=!0,s.awaitingFirstContent=!0,s},startThinkingAction(){const s=this.ensureAssistantMessage();eC(s);const e=this.getActiveThinkingAction(s);if(e&&e.streaming===!0)return{action:e,blockId:e.blockId||e.id};s.streamingThinking="",s.currentStreamingType="thinking";const t=D_("thinking"),n=t,i={id:t,type:"thinking",content:"",streaming:!0,timestamp:Date.now(),blockId:n};return s.actions.push(i),s.activeThinkingId=t,{action:i,blockId:n}},appendThinkingChunk(s){if(this.currentMessageIndex<0)return null;const e=this.messages[this.currentMessageIndex];e.streamingThinking+=s;const t=this.getActiveThinkingAction(e);return t?(t.content+=s,t):null},completeThinking(s){if(this.currentMessageIndex<0)return null;const e=this.messages[this.currentMessageIndex],t=this.getActiveThinkingAction(e);return t?(t.streaming=!1,t.content=s,e.streamingThinking="",e.currentStreamingType=null,e.activeThinkingId=null,t.blockId||t.id):null},startTextAction(){const s=this.ensureAssistantMessage();if(!s)return null;eC(s);const e=s.actions[s.actions.length-1];if(e&&e.type==="text"&&e.streaming===!0)return e;s.streamingText="",s.currentStreamingType="text",s.__splitByShowHtml=!1;const t={id:D_("text"),type:"text",content:"",streaming:!0,timestamp:Date.now()};return s.actions.push(t),t},appendTextChunk(s){if(this.currentMessageIndex<0)return null;const e=this.messages[this.currentMessageIndex];if(!e)return null;typeof e.streamingText!="string"&&(e.streamingText=""),e.streamingText+=s;let t=e.actions[e.actions.length-1];return t&&t.type==="text"&&t.streaming||(t={id:D_("text"),type:"text",content:"",streaming:!0,timestamp:Date.now(),continuation:!0},e.actions.push(t)),t.content+=s,t.streaming&&OF(t.content)&&(t.streaming=!1,t.frozenByShowHtml=!0,e.__splitByShowHtml=!0),t},completeText(s){if(this.currentMessageIndex<0)return;const e=this.messages[this.currentMessageIndex],t=!!e.__splitByShowHtml;let n=!1;for(let i=e.actions.length-1;i>=0;i--){const r=e.actions[i];if(r.type==="text"&&r.streaming){r.streaming=!1,n=!0,!t&&typeof s=="string"&&s.length&&(r.content=s);break}}if(!n&&!t&&typeof s=="string")for(let i=e.actions.length-1;i>=0;i--){const r=e.actions[i];if(r.type==="text"){r.content=s;break}}e.streamingText="",e.currentStreamingType=null,delete e.__splitByShowHtml},clearStreamingResidualState(){for(const s of this.messages)if(!(!s||s.role!=="assistant")&&(s.currentStreamingType=null,s.activeThinkingId=null,s.streamingThinking="",s.streamingText="",s.awaitingFirstContent=!1,s.generatingLabel="",Array.isArray(s.actions)))for(const e of s.actions)e&&(e.type==="thinking"||e.type==="text")&&e.streaming===!0&&(e.streaming=!1)},resetStreamingAttemptActions(s=""){var n,i,r;const e=[];let t=null;if(this.currentMessageIndex>=0&&((n=this.messages[this.currentMessageIndex])==null?void 0:n.role)==="assistant")t=this.messages[this.currentMessageIndex];else for(let o=this.messages.length-1;o>=0;o--)if(((i=this.messages[o])==null?void 0:i.role)==="assistant"){t=this.messages[o];break}if(!t||!Array.isArray(t.actions))return e;for(;t.actions.length;){const o=t.actions[t.actions.length-1],a=(o==null?void 0:o.type)==="thinking",c=(o==null?void 0:o.type)==="text",l=(o==null?void 0:o.type)==="tool"&&String(((r=o==null?void 0:o.tool)==null?void 0:r.status)||"").toLowerCase()==="preparing";if(!a&&!c&&!l)break;e.push(o),t.actions.pop()}return t.currentStreamingType=null,t.activeThinkingId=null,t.streamingThinking="",t.streamingText="",t.actions.length===0?(t.awaitingFirstContent=!0,t.generatingLabel=s):(t.awaitingFirstContent=!1,t.generatingLabel=""),e},addSystemMessage(s,e=null){const t=(e==null?void 0:e.variant)==="sub_agent_done";if(t&&Array.isArray(this.messages)&&this.messages.length>0){const r=this.messages[this.messages.length-1],o=Array.isArray(r==null?void 0:r.actions)?r.actions:[];(r==null?void 0:r.role)==="assistant"&&o.length===0&&!!(r!=null&&r.awaitingFirstContent)&&(tC("chat.addSystemMessage:cleanup-empty-assistant-placeholder",{currentMessageIndex:this.currentMessageIndex,messagesLengthBeforeCleanup:this.messages.length}),this.messages.pop(),this.currentMessageIndex=this.messages.length-1)}const n=t?Jk():this.ensureAssistantMessage();eC(n),tC("chat.addSystemMessage:before",{content:s,meta:e,useStandaloneMessage:t,messagesLengthBefore:this.messages.length,currentMessageIndex:this.currentMessageIndex,actionsBefore:Array.isArray(n==null?void 0:n.actions)?n.actions.length:-1});const i={id:D_("system"),type:"system",content:s,variant:(e==null?void 0:e.variant)||null,timestamp:Date.now()};n.actions.push(i),t&&(this.messages.push(n),this.currentMessageIndex=this.messages.length-1),tC("chat.addSystemMessage:after",{messagesLengthAfter:this.messages.length,currentMessageIndex:this.currentMessageIndex,actionsAfter:Array.isArray(n==null?void 0:n.actions)?n.actions.length:-1})},getActiveThinkingAction(s){if(!s||!Array.isArray(s.actions))return null;if(s.activeThinkingId){const e=s.actions.find(t=>t&&t.id===s.activeThinkingId&&t.type==="thinking");if(e)return e}for(let e=s.actions.length-1;e>=0;e--){const t=s.actions[e];if(t&&t.type==="thinking"&&t.streaming!==!1)return t}return null},resetChatState(){this.messages=[],this.currentMessageIndex=-1,this.streamingMessage=!1,this.clearExpandedBlocks(),this.clearThinkingLocks()}}}),lk=hn("input",{state:()=>({inputMessage:"",inputLineCount:1,inputIsMultiline:!1,inputIsFocused:!1,quickMenuOpen:!1,toolMenuOpen:!1,settingsOpen:!1,imagePickerOpen:!1,selectedImages:[],videoPickerOpen:!1,selectedVideos:[],selectedFiles:[],goalModeArmed:!1,goalRunning:!1,goalProgress:null,goalDialogOpen:!1}),actions:{setInputMessage(s){this.inputMessage=s},clearInputMessage(){this.inputMessage=""},setInputLineCount(s){this.inputLineCount=s},setInputMultiline(s){this.inputIsMultiline=s},setInputFocused(s){this.inputIsFocused=s},openQuickMenu(){this.quickMenuOpen=!0},setQuickMenuOpen(s){this.quickMenuOpen=s,s||(this.toolMenuOpen=!1,this.settingsOpen=!1)},toggleQuickMenu(){const s=!this.quickMenuOpen;return this.setQuickMenuOpen(s),s},closeMenus(){this.quickMenuOpen=!1,this.toolMenuOpen=!1,this.settingsOpen=!1},toggleToolMenu(){return this.toolMenuOpen=!this.toolMenuOpen,this.toolMenuOpen},setToolMenuOpen(s){this.toolMenuOpen=s},toggleSettingsMenu(){return this.settingsOpen=!this.settingsOpen,this.settingsOpen},setSettingsOpen(s){this.settingsOpen=s},setImagePickerOpen(s){this.imagePickerOpen=s},setVideoPickerOpen(s){this.videoPickerOpen=s},setSelectedImages(s){this.selectedImages=s.slice(0,9)},addSelectedImage(s){if(!s)return;const e=Array.from(new Set([...this.selectedImages,s]));this.selectedImages=e.slice(0,9)},removeSelectedImage(s){this.selectedImages=this.selectedImages.filter(e=>e!==s)},clearSelectedImages(){this.selectedImages=[]},setSelectedVideos(s){this.selectedVideos=s.slice(0,1)},addSelectedVideo(s){s&&(this.selectedVideos=[s])},removeSelectedVideo(s){this.selectedVideos=this.selectedVideos.filter(e=>e!==s)},clearSelectedVideos(){this.selectedVideos=[]},addSelectedFile(s){if(!s)return;const e=Array.from(new Set([...this.selectedFiles,s]));this.selectedFiles=e.slice(0,9)},removeSelectedFile(s){this.selectedFiles=this.selectedFiles.filter(e=>e!==s)},clearSelectedFiles(){this.selectedFiles=[]},toggleGoalArmed(){return this.goalRunning?this.goalModeArmed:(this.goalModeArmed=!this.goalModeArmed,this.goalModeArmed)},setGoalArmed(s){this.goalModeArmed=s},setGoalRunning(s){this.goalRunning=s,s&&(this.goalModeArmed=!1)},setGoalProgress(s){this.goalProgress=s},setGoalDialogOpen(s){this.goalDialogOpen=s}}}),eL=hn("tool",{state:()=>({preparingTools:new Map,activeTools:new Map,toolActionIndex:new Map,toolStacks:new Map,toolSettings:[],toolSettingsLoading:!1}),actions:{setToolSettings(s){this.toolSettings=s},setToolSettingsLoading(s){this.toolSettingsLoading=s},registerToolAction(s,e=null){if(!s||s.type!=="tool")return;const t=new Set;s.id&&t.add(s.id),s.tool&&s.tool.id&&t.add(s.tool.id),e&&t.add(e),s.tool&&s.tool.executionId&&t.add(s.tool.executionId),t.forEach(n=>{n!=null&&this.toolActionIndex.set(String(n),s)})},unregisterToolAction(s){if(!s||s.type!=="tool")return;const e=[];for(const[t,n]of this.toolActionIndex.entries())n===s&&e.push(t);e.forEach(t=>this.toolActionIndex.delete(t)),s.tool&&s.tool.name&&this.releaseToolAction(s.tool.name,s)},findToolAction(s,e,t){const n=[t,s,e];for(const i of n){if(i==null)continue;const r=String(i);if(this.toolActionIndex.has(r))return this.toolActionIndex.get(r)}return null},trackToolAction(s,e){if(!s||!e)return;this.toolStacks.has(s)||this.toolStacks.set(s,[]);const t=this.toolStacks.get(s);t.includes(e)||t.push(e)},releaseToolAction(s,e){if(!s||!this.toolStacks.has(s))return;const t=this.toolStacks.get(s),n=t.indexOf(e);n!==-1&&t.splice(n,1),t.length===0&&this.toolStacks.delete(s)},getLatestActiveToolAction(s){if(!s||!this.toolStacks.has(s))return null;const e=this.toolStacks.get(s);for(let t=e.length-1;t>=0;t--){const n=e[t];if(!(!n||n.type!=="tool"||!n.tool)&&["preparing","running","stale"].includes(n.tool.status))return n}return e[e.length-1]||null},resetToolTracking(){this.preparingTools.clear(),this.activeTools.clear(),this.toolActionIndex.clear(),this.toolStacks.clear()}}}),sC=()=>({count:0,limit:0,reset_at:null,window_start:null}),ZM=()=>({fast:sC(),thinking:sC(),search:sC(),role:"user"}),N_=6e4,$F=3e5,Ig=5e3,BF=3e4,tL=hn("resource",{state:()=>({tokenPanelCollapsed:!0,currentContextTokens:0,currentConversationTokens:{cumulative_input_tokens:0,cumulative_output_tokens:0,cumulative_total_tokens:0,cumulative_cached_input_tokens:0,cache_exempt_input_tokens:0},projectStorage:{used_bytes:0,limit_bytes:null,limit_label:"",usage_percent:null},containerStatus:null,containerNetRate:{down_bps:null,up_bps:null},containerVisibilityBound:!1,lastContainerSample:null,containerStatsInFlight:!1,containerStatsFailCount:0,containerStatsIntervalMs:Ig,containerStatsTimer:null,projectStorageTimer:null,projectStorageInFlight:!1,projectStorageFailCount:0,projectStorageIntervalMs:N_,usageQuota:ZM(),usageQuotaTimer:null}),actions:{resetTokenStatistics(){this.currentContextTokens=0,this.currentConversationTokens={cumulative_input_tokens:0,cumulative_output_tokens:0,cumulative_total_tokens:0,cumulative_cached_input_tokens:0,cache_exempt_input_tokens:0}},setCurrentContextTokens(s){this.currentContextTokens=s||0},toggleTokenPanel(){this.tokenPanelCollapsed=!this.tokenPanelCollapsed,this.tokenPanelCollapsed?this.stopContainerStatsPolling():this.startContainerStatsPolling()},async updateCurrentContextTokens(s){if(!s){this.currentContextTokens=0;return}try{const t=await(await fetch(`/api/conversations/${s}/tokens`)).json();t.success&&t.data?this.currentContextTokens=t.data.total_tokens||0:this.currentContextTokens=0}catch(e){console.warn("获取当前上下文Token异常:",e),this.currentContextTokens=0}},async fetchConversationTokenStatistics(s){if(!s){this.resetTokenStatistics();return}try{const t=await(await fetch(`/api/conversations/${s}/token-statistics`)).json();t.success&&t.data&&(this.currentConversationTokens.cumulative_input_tokens=t.data.total_input_tokens||0,this.currentConversationTokens.cumulative_output_tokens=t.data.total_output_tokens||0,this.currentConversationTokens.cumulative_total_tokens=t.data.total_tokens||0,this.currentConversationTokens.cumulative_cached_input_tokens=t.data.total_cached_input_tokens||0,this.currentConversationTokens.cache_exempt_input_tokens=t.data.cache_exempt_input_tokens||0,typeof t.data.current_context_tokens=="number"&&(this.currentContextTokens=t.data.current_context_tokens))}catch(e){console.warn("获取Token统计异常:",e)}},applyStatusSnapshot(s){if(!(!s||typeof s!="object")){if(s.project){const e=s.project;if(this.projectStorage.used_bytes=e.total_size||0,this.projectStorage.limit_bytes=e.limit_bytes??null,this.projectStorage.limit_label=e.limit_label||(e.limit_bytes?`${(e.limit_bytes/(1024*1024)).toFixed(0)} MB`:S("stores.unlimited")),e.limit_bytes){const t=typeof e.usage_percent=="number"?e.usage_percent:e.total_size/e.limit_bytes*100;this.projectStorage.usage_percent=t}else this.projectStorage.usage_percent=null}Object.prototype.hasOwnProperty.call(s,"container")&&this.updateContainerStatus(s.container)}},updateContainerStatus(s){if(!s||s.mode!=="docker"){this.containerStatus=s||null,this.containerNetRate={down_bps:null,up_bps:null},this.lastContainerSample=null;return}const e=s.stats;if(e&&typeof e.timestamp=="number"){const t={timestamp:e.timestamp,rx_bytes:e.net_io&&typeof e.net_io.rx_bytes=="number"?e.net_io.rx_bytes:null,tx_bytes:e.net_io&&typeof e.net_io.tx_bytes=="number"?e.net_io.tx_bytes:null},n=this.lastContainerSample;if(n&&t.rx_bytes!==null&&t.tx_bytes!==null&&n.rx_bytes!==null&&n.tx_bytes!==null){const i=Math.max(.001,t.timestamp-n.timestamp),r=Math.max(0,(t.rx_bytes-n.rx_bytes)/i),o=Math.max(0,(t.tx_bytes-n.tx_bytes)/i);this.containerNetRate={down_bps:r,up_bps:o}}else this.containerNetRate={down_bps:null,up_bps:null};this.lastContainerSample=t}else this.containerNetRate={down_bps:null,up_bps:null},this.lastContainerSample=null;this.containerStatus=s},async pollContainerStats(){if(typeof document<"u"&&document.hidden||this.containerStatsInFlight)return;this.containerStatsInFlight=!0;const s=typeof AbortController<"u"?new AbortController:null,e=s?window.setTimeout(()=>s.abort(),4e3):null;try{const t=await fetch("/api/container-status",{signal:s==null?void 0:s.signal});if(!t.ok)throw new Error(`http-${t.status}`);const n=await t.json();n.success&&this.updateContainerStatus(n.data||null),this.containerStatsFailCount=0,this.containerStatsIntervalMs>Ig&&this._restartContainerStatsTimer(Ig)}catch(t){if(console.warn("获取容器状态异常:",t),this.containerStatsFailCount+=1,this.containerStatsFailCount>=3){const n=Math.min(this.containerStatsIntervalMs*2,BF);this._restartContainerStatsTimer(n)}}finally{this.containerStatsInFlight=!1,e&&clearTimeout(e)}},startContainerStatsPolling(){this.containerStatsTimer||this.tokenPanelCollapsed||(this.containerStatsFailCount=0,this.containerStatsIntervalMs=Ig,this.pollContainerStats(),this.containerStatsTimer=setInterval(()=>{this.pollContainerStats()},this.containerStatsIntervalMs))},stopContainerStatsPolling(){this.containerStatsTimer&&(clearInterval(this.containerStatsTimer),this.containerStatsTimer=null),this.containerStatsInFlight=!1},_restartContainerStatsTimer(s){this.containerStatsTimer&&(clearInterval(this.containerStatsTimer),this.containerStatsTimer=null),this.containerStatsIntervalMs=s,this.containerStatsTimer=setInterval(()=>{this.pollContainerStats()},this.containerStatsIntervalMs)},bindContainerVisibilityWatcher(){if(this.containerVisibilityBound||typeof document>"u")return;const s=()=>{document.hidden?this.stopContainerStatsPolling():(this.containerStatsFailCount=0,this.containerStatsIntervalMs=Ig,this.startContainerStatsPolling())};document.addEventListener("visibilitychange",s),this.containerVisibilityBound=!0},async pollProjectStorage(){if(!this.projectStorageInFlight){this.projectStorageInFlight=!0;try{const s=await fetch("/api/project-storage");if(!s.ok)throw new Error(s.statusText||S("stores.requestFailed"));const e=await s.json();e&&e.success&&e.data&&(this.projectStorage.used_bytes=e.data.used_bytes||0,this.projectStorage.limit_bytes=e.data.limit_bytes??null,this.projectStorage.limit_label=e.data.limit_label||"",this.projectStorage.usage_percent=e.data.usage_percent??null,this.projectStorageFailCount=0,this.projectStorageIntervalMs>N_&&this._restartProjectStorageTimer(N_))}catch(s){if(this.projectStorageFailCount+=1,console.warn("获取存储信息失败:",s),this.projectStorageFailCount>=3){const e=Math.min(this.projectStorageIntervalMs*2,$F);e!==this.projectStorageIntervalMs&&(console.warn(`连续获取失败,存储轮询间隔调整为 ${Math.round(e/1e3)} 秒`),this._restartProjectStorageTimer(e))}}finally{this.projectStorageInFlight=!1}}},startProjectStoragePolling(){this.projectStorageTimer||(this.pollProjectStorage(),this.projectStorageTimer=setInterval(()=>{this.pollProjectStorage()},this.projectStorageIntervalMs))},stopProjectStoragePolling(){this.projectStorageTimer&&(clearInterval(this.projectStorageTimer),this.projectStorageTimer=null),this.projectStorageInFlight=!1,this.projectStorageFailCount=0,this.projectStorageIntervalMs=N_},_restartProjectStorageTimer(s){this.projectStorageTimer&&clearInterval(this.projectStorageTimer),this.projectStorageIntervalMs=Math.max(s,1e4),this.projectStorageTimer=setInterval(()=>{this.pollProjectStorage()},this.projectStorageIntervalMs)},normalizeUsageQuota(s){const e=ZM(),t=s&&s.quotas||{},n=t.role||s&&s.role||"user";return{fast:{...e.fast,...t.fast||{}},thinking:{...e.thinking,...t.thinking||{}},search:{...e.search,...t.search||{}},role:n}},setUsageQuota(s){this.usageQuota=this.normalizeUsageQuota(s)},async fetchUsageQuota(){try{const s=await fetch("/api/usage");if(!s.ok)throw new Error(s.statusText||S("stores.requestFailed"));const e=await s.json();e&&e.success&&e.data&&this.setUsageQuota(e.data)}catch(s){console.warn("获取用量配额失败:",s)}},startUsageQuotaPolling(){this.usageQuotaTimer||(this.fetchUsageQuota(),this.usageQuotaTimer=setInterval(()=>{this.fetchUsageQuota()},6e4))},stopUsageQuotaPolling(){this.usageQuotaTimer&&(clearInterval(this.usageQuotaTimer),this.usageQuotaTimer=null)}}}),sL="agents_sidebar_conversation_type",FF=()=>{try{return window.localStorage.getItem(sL)==="multi_agent"?"multi_agent":"normal"}catch{return"normal"}},HF=s=>{try{window.localStorage.setItem(sL,s)}catch{}},nL=()=>({conversationsByType:{normal:[],multi_agent:[]},pagingByType:{normal:{offset:0,hasMore:!1,loaded:!1},multi_agent:{offset:0,hasMore:!1,loaded:!1}}}),kr=hn("conversation",{state:()=>({conversations:[],searchResults:[],searchGroups:[],conversationInsertAnimations:{},conversationListAnimationMode:"idle",pendingDeletingConversationIds:[],conversationsLoading:!1,hasMoreConversations:!1,loadingMoreConversations:!1,currentConversationId:null,currentConversationTitle:"",searchQuery:"",searchTimer:null,searchActive:!1,searchInProgress:!1,searchMoreAvailable:!1,searchOffset:0,searchTotal:0,conversationsOffset:0,conversationsLimit:20,runningWorkspaceTasks:[],acknowledgedCompletedTaskIds:[],workspaceGroups:[],multiAgentMode:!1,sidebarConversationType:FF(),conversationsCache:{normal:{list:[],offset:0,hasMore:!1,loaded:!1},multi_agent:{list:[],offset:0,hasMore:!1,loaded:!1}}}),actions:{setCurrentConversationId(s){this.currentConversationId=s},setSidebarConversationType(s){const e=s==="multi_agent"?"multi_agent":"normal";if(this.sidebarConversationType===e)return;const t=this.sidebarConversationType,n=this.conversationsCache[t];n.offset=this.conversationsOffset,n.hasMore=this.hasMoreConversations,this.sidebarConversationType=e,HF(e);const i=this.conversationsCache[e];this.conversations=i.list,this.conversationsOffset=i.offset,this.hasMoreConversations=i.hasMore,this.loadingMoreConversations=!1;for(const r of this.workspaceGroups){if(!r||!r.conversationsByType)continue;const o=r.pagingByType[t];o.offset=r.offset,o.hasMore=r.hasMore,r.conversations=r.conversationsByType[e],r.offset=r.pagingByType[e].offset,r.hasMore=r.pagingByType[e].hasMore,r.loadingMore=!1}},resetConversations(){this.resetConversationsCacheOnly(),this.searchResults=[],this.searchGroups=[],this.conversationInsertAnimations={},this.conversationListAnimationMode="idle",this.pendingDeletingConversationIds=[],this.searchActive=!1,this.searchInProgress=!1,this.searchMoreAvailable=!1,this.searchOffset=0,this.searchTotal=0,this.hasMoreConversations=!1,this.loadingMoreConversations=!1,this.conversationsOffset=0,this.runningWorkspaceTasks=[],this.acknowledgedCompletedTaskIds=[]},resetConversationsTypeCache(){this.resetConversationsCacheOnly()},resetConversationsCacheOnly(){this.conversationsCache={normal:{list:[],offset:0,hasMore:!1,loaded:!1},multi_agent:{list:[],offset:0,hasMore:!1,loaded:!1}},this.conversations=this.conversationsCache[this.sidebarConversationType].list},cancelSearchTimer(){this.searchTimer&&(clearTimeout(this.searchTimer),this.searchTimer=null)},setWorkspaceGroups(s){this.workspaceGroups=s},setWorkspaceGroupExpanded(s,e){const t=this.workspaceGroups.find(n=>n.workspaceId===s);t&&(t.expanded=e)},setWorkspaceGroupConversations(s,e){const t=this.workspaceGroups.find(n=>n.workspaceId===s);t&&t.conversations.splice(0,t.conversations.length,...e)},appendWorkspaceGroupConversations(s,e){const t=this.workspaceGroups.find(n=>n.workspaceId===s);t&&t.conversations.push(...e)},setWorkspaceGroupLoading(s,e){const t=this.workspaceGroups.find(n=>n.workspaceId===s);t&&(t.loading=e)},setWorkspaceGroupLoadingMore(s,e){const t=this.workspaceGroups.find(n=>n.workspaceId===s);t&&(t.loadingMore=e)},setWorkspaceGroupHasMore(s,e){const t=this.workspaceGroups.find(n=>n.workspaceId===s);t&&(t.hasMore=e)},setWorkspaceGroupOffset(s,e){const t=this.workspaceGroups.find(n=>n.workspaceId===s);t&&(t.offset=e)},setWorkspaceGroupVisibleOffset(s,e){const t=this.workspaceGroups.find(n=>n.workspaceId===s);t&&(t.visibleOffset=Math.max(0,e))},ensureWorkspaceGroup(s){if(!s)return;if(!this.workspaceGroups.some(t=>t.workspaceId===s)){const t=nL();this.workspaceGroups.push({workspaceId:s,conversations:t.conversationsByType[this.sidebarConversationType],...t,loading:!1,hasMore:!1,loadingMore:!1,offset:0,visibleOffset:0,visibleLimit:5,bufferLimit:20,fetchLimit:25,expanded:!0})}},async loadWorkspaceConversations(s,{reset:e=!1,refresh:t=!1}={}){var l,u;if(!s)return;let n=this.workspaceGroups.findIndex(d=>d.workspaceId===s);n===-1&&(this.ensureWorkspaceGroup(s),n=this.workspaceGroups.length-1);const i=this.workspaceGroups[n],r=this.sidebarConversationType,o=i.conversationsByType[r],a=i.pagingByType[r];if(e&&(o.length=0,a.offset=0,a.hasMore=!1,a.loaded=!1,i.visibleOffset=0,r===this.sidebarConversationType&&(i.offset=0,i.hasMore=!1)),i.loading||i.loadingMore)return;const c=t?0:a.offset;i.loading=!0;try{const d=r==="multi_agent"?"&multi_agent_mode=1":"&multi_agent_mode=0",p=await(await fetch(`/api/conversations?workspace_id=${encodeURIComponent(s)}&limit=${i.fetchLimit}&offset=${c}${d}`)).json();if(p.success){const g=(((l=p.data)==null?void 0:l.conversations)||[]).map(m=>({id:m.id,title:m.title,updated_at:m.updated_at,total_messages:m.total_messages,total_tools:m.total_tools}));if(t){const m=o.slice(g.length);o.splice(0,o.length,...g,...m)}else c===0?o.splice(0,o.length,...g):o.push(...g);a.hasMore=!!((u=p.data)!=null&&u.has_more),a.loaded=!0,t||(a.offset=c+g.length),r===this.sidebarConversationType&&(i.hasMore=a.hasMore,i.offset=a.offset);const v=r==="multi_agent"?"normal":"multi_agent";c===0&&!i.pagingByType[v].loaded&&this.loadWorkspaceConversationTypeCache(s,v).catch(()=>{})}else console.error("加载工作区对话失败:",p.error)}catch(d){console.error("加载工作区对话异常:",d)}finally{i.loading=!1}},async loadWorkspaceConversationTypeCache(s,e){var i,r;const t=this.workspaceGroups.find(o=>o.workspaceId===s);if(!t||t.pagingByType[e].loaded)return;const n=e==="multi_agent"?"&multi_agent_mode=1":"&multi_agent_mode=0";try{const a=await(await fetch(`/api/conversations?workspace_id=${encodeURIComponent(s)}&limit=${t.fetchLimit}&offset=0${n}`)).json();if(!(a!=null&&a.success)||t.pagingByType[e].loaded)return;const c=(((i=a.data)==null?void 0:i.conversations)||[]).map(l=>({id:l.id,title:l.title,updated_at:l.updated_at,total_messages:l.total_messages,total_tools:l.total_tools}));t.conversationsByType[e].push(...c),t.pagingByType[e].offset=c.length,t.pagingByType[e].hasMore=!!((r=a.data)!=null&&r.has_more),t.pagingByType[e].loaded=!0}catch(o){console.error("补载工作区对话缓存异常:",o)}},async loadMoreWorkspaceConversations(s){var i,r,o;const e=this.workspaceGroups.findIndex(a=>a.workspaceId===s);if(e===-1)return;const t=this.workspaceGroups[e];if(!(t.loadingMore||!(t.conversations.length>t.visibleLimit)&&!t.hasMore)){if(t.loadingMore=!0,t.hasMore){const a=this.sidebarConversationType;try{const c=t.conversations.length,l=a==="multi_agent"?"&multi_agent_mode=1":"&multi_agent_mode=0",d=await(await fetch(`/api/conversations?workspace_id=${encodeURIComponent(s)}&limit=${t.bufferLimit}&offset=${c}${l}`)).json();if(d.success){const h=(((i=d.data)==null?void 0:i.conversations)||[]).map(g=>({id:g.id,title:g.title,updated_at:g.updated_at,total_messages:g.total_messages,total_tools:g.total_tools}));t.conversations.push(...h),t.hasMore=!!((r=d.data)!=null&&r.has_more);const p=(o=t.pagingByType)==null?void 0:o[a];p&&(p.offset=t.conversations.length,p.hasMore=t.hasMore)}}catch(c){console.error("加载更多工作区对话异常:",c)}}t.visibleLimit+=t.bufferLimit,t.loadingMore=!1}}}}),Ti=Object.freeze(Object.defineProperty({__proto__:null,createEmptyGroupTypeCache:nL,useConversationStore:kr},Symbol.toStringTag,{value:"Module"}));function UF(...s){}function iL(s){if(!s)return[];const e=Object.keys(s).map(t=>{const n=s[t]||{};return n.type==="folder"?{type:"folder",name:t,path:n.path||t,children:iL(n.children)}:{type:"file",name:t,path:n.path||t,annotation:n.annotation||""}});return e.sort((t,n)=>t.type!==n.type?t.type==="folder"?-1:1:t.name.localeCompare(n.name,"zh-CN")),e}const Pc=hn("file",{state:()=>({fileTree:[],expandedFolders:{},todoList:null,todoListLive:!1,todoSyncSeq:0,fileTreeUnavailable:!1,fileTreeMessage:"",contextMenu:{visible:!1,x:0,y:0,node:null}}),actions:{async fetchFileTree(){try{const e=await(await fetch("/api/files")).json();UF("[FileTree] fetch result",e),this.setFileTreeFromResponse(e)}catch(s){console.error("获取文件树失败:",s)}},markFileTreeUnavailable(s){this.fileTreeUnavailable=!0,this.fileTreeMessage=s||S("stores.fileTreeUnavailableHostMode"),this.fileTree=[],this.expandedFolders={}},setFileTreeFromResponse(s){if(!s){console.warn("[FileTree] 空 payload");return}if(s.unavailable){this.markFileTreeUnavailable(s.message||s.error);return}const e=s.structure||s;if(e&&e.unavailable){this.markFileTreeUnavailable(e.message||e.error);return}if(!e||!e.tree){console.warn("[FileTree] 缺少 structure.tree",e);return}this.fileTreeUnavailable=!1,this.fileTreeMessage="";const t=iL(e.tree),n={...this.expandedFolders},i=new Set,r=o=>{o.forEach(a=>{a.type==="folder"&&(i.add(a.path),n[a.path]===void 0&&(n[a.path]=!1),r(a.children||[]))})};r(t),Object.keys(n).forEach(o=>{i.has(o)||delete n[o]}),this.expandedFolders=n,this.fileTree=t},toggleFolder(s){if(!s)return;const e=!!this.expandedFolders[s];this.expandedFolders={...this.expandedFolders,[s]:!e}},async fetchTodoList(){const s=kr().currentConversationId;if(!s){this.setTodoList(null);return}try{const e=`/api/todo-list?conversation_id=${encodeURIComponent(s)}`,n=await(await fetch(e)).json();n&&n.success&&(this.todoListLive=!1,this.todoList=n.data||null,this.todoSyncSeq+=1)}catch(e){console.error("获取待办列表失败:",e)}},setTodoList(s,e=!1){this.todoListLive=e,this.todoList=s,this.todoSyncSeq+=1},showContextMenu(s){if(!s||!s.node)return;const{node:e,event:t}=s;if(!e.path&&e.path!==""){this.hideContextMenu();return}if(e.type!=="file"&&e.type!=="folder"){this.hideContextMenu();return}t&&typeof t.preventDefault=="function"&&t.preventDefault(),t&&typeof t.stopPropagation=="function"&&t.stopPropagation();const n=200,i=50,r=window.innerWidth,o=window.innerHeight;let a=t&&t.clientX||0,c=t&&t.clientY||0;a+n>r&&(a=r-n-8),c+i>o&&(c=o-i-8),this.contextMenu={visible:!0,x:Math.max(8,a),y:Math.max(8,c),node:e}},hideContextMenu(){this.contextMenu.visible&&(this.contextMenu={visible:!1,x:0,y:0,node:null})}}}),WF={categories:{},forced_category_states:{},disabled_models:[],ui_blocks:{}},zo=hn("policy",{state:()=>({loaded:!1,loading:!1,error:"",policy:null}),getters:{disabledModelSet(s){var e;return new Set(((e=s.policy)==null?void 0:e.disabled_models)||[])},forcedCategoryStates(s){var e;return((e=s.policy)==null?void 0:e.forced_category_states)||{}},uiBlocks(s){var e;return((e=s.policy)==null?void 0:e.ui_blocks)||{}}},actions:{async fetchPolicy(){if(!this.loading){this.loading=!0,this.error="";try{const s=await fetch("/api/effective-policy"),e=await s.json();if(!s.ok||!e.success)throw new Error(e.error||S("stores.loadPolicyFailed"));this.policy=e.data||WF,this.loaded=!0}catch(s){this.error=(s==null?void 0:s.message)||S("stores.loadPolicyFailed")}finally{this.loading=!1}}},isModelDisabled(s){return this.disabledModelSet.has(s)},isCategoryLocked(s){return typeof this.forcedCategoryStates[s]=="boolean"},categoryLockedState(s){const e=this.forcedCategoryStates;return typeof e[s]=="boolean"?e[s]:null},isBlocked(s){return!!this.uiBlocks[s]}}});function zF(s){if(!s)return null;const e={"image/jpeg":"image.jpg","image/jpg":"image.jpg","image/png":"image.png","image/gif":"image.gif","image/webp":"image.webp","image/bmp":"image.bmp","image/svg+xml":"image.svg","video/mp4":"video.mp4","video/quicktime":"video.mov","video/x-matroska":"video.mkv","video/avi":"video.avi","video/webm":"video.webm","application/pdf":"document.pdf","text/plain":"document.txt","text/markdown":"document.md"},t=s.split(";")[0].trim().toLowerCase();return e[t]||null}const rL=hn("upload",{state:()=>({uploading:!1,mediaUploading:!1}),actions:{setUploading(s){this.uploading=s},setMediaUploading(s){this.mediaUploading=s},async handleSelectedFiles(s){if(!s)return;const e=Array.isArray(s)?s:Array.from(s),[t]=e;t&&await this.uploadFile(t)},async uploadFiles(s,e={}){var c;if(!s)return[];const t=Array.isArray(s)?s:Array.from(s);if(!t.length)return[];const{markUploading:n=!0,markMediaUploading:i=!1}=e;if((c=zo().uiBlocks)!=null&&c.block_upload)return Is().pushToast({title:S("stores.uploadDisabled"),message:S("stores.uploadDisabledByAdmin"),type:"warning"}),[];const o=Pc(),a=[];n&&this.setUploading(!0),i&&this.setMediaUploading(!0);try{for(const l of t){const u=await this.uploadFile(l,{manageUploading:!1,refreshFileTree:!1,skipPolicyCheck:!0});u!=null&&u.path&&a.push(u)}a.length&&await o.fetchFileTree()}finally{i&&this.setMediaUploading(!1),n&&this.setUploading(!1)}return a},async uploadFile(s,e={}){var u;const{manageUploading:t=!0,refreshFileTree:n=!0,skipPolicyCheck:i=!1}=e;if(!s||t&&this.uploading)return null;const r=zo();if(!i&&((u=r.uiBlocks)!=null&&u.block_upload))return Is().pushToast({title:S("stores.uploadDisabled"),message:S("stores.uploadDisabledByAdmin"),type:"warning"}),null;const o=Is(),a=Pc();(s.type&&s.type.startsWith("video/")||/\.(mp4|mov|m4v|webm|avi|mkv|flv|mpg|mpeg)$/i.test(s.name||""))&&o.pushToast({title:S("stores.videoProcessing"),message:S("stores.videoProcessingSlow"),type:"info",duration:5e3}),t&&this.setUploading(!0);const l=o.pushToast({title:S("stores.uploadingFileTitle"),message:S("stores.uploadingFile",{name:s.name}),type:"info",duration:null});try{const d=s.name||zF(s.type)||`upload_${Date.now()}`,h=new FormData;h.append("file",s),h.append("filename",d);const p=await fetch("/api/upload",{method:"POST",body:h});l&&o.updateToast(l,{message:S("stores.uploadingScanning"),type:"info"});let g={};try{g=await p.json()}catch{throw new Error(S("stores.serverResponseUnparseable"))}if(!p.ok||!g.success){const m=g.error||g.message||S("stores.uploadFailed");throw new Error(m)}n&&await a.fetchFileTree();const v=S("stores.uploadSuccess",{name:g.path||s.name});return l?o.updateToast(l,{title:S("stores.uploadComplete"),message:v,type:"success",duration:4500}):o.pushToast({title:S("stores.uploadComplete"),message:v,type:"success"}),g!=null&&g.path?{path:g.path,filename:g.filename||s.name||g.path}:null}catch(d){const h=d&&d.message?String(d.message):"",p=s&&s.name?s.name:S("stores.genericFile");let g=h||S("common.retryLater");/(?:\u5b89\u5168\u5ba1\u6838\u672a\u901a\u8fc7|Security check failed)/.test(h)||/Eicar/i.test(h)?g=S("stores.uploadSecurityRejected",{name:p}):/(?:\u6587\u4ef6\u7c7b\u578b\u4e0d\u5728\u5141\u8bb8\u5217\u8868\u4e2d|File type is not in the allowed list)/.test(h)?g=S("stores.uploadTypeNotAllowed",{name:p}):g?g=S("stores.uploadFailedWithReason",{name:p,reason:g}):g=S("stores.uploadFailedRetryLater",{name:p});const v=Is();return l?v.updateToast(l,{title:S("stores.uploadFailed"),message:g,type:"error",duration:5e3}):v.pushToast({title:S("stores.uploadFailed"),message:g,type:"error"}),null}finally{t&&this.setUploading(!1)}}}}),jF=new Set(["completed","failed","timeout","terminated"]),dd=hn("subAgent",{state:()=>({subAgents:[],activityTimer:null,activeAgent:null,silentActivityTaskId:null,stoppingTaskIds:{},activityEntries:[],activityLoading:!1,activityError:null}),actions:{async fetchSubAgents(){var s;try{const e=kr(),t=e.currentConversationId;if(!t){this.subAgents=[];return}this.subAgents=this.subAgents.filter(r=>!r.conversation_id||r.conversation_id===t);let n;if(e.multiAgentMode?n=await fetch(`/api/multiagent/active_sub_agents?conversation_id=${encodeURIComponent(t)}`):n=await fetch(`/api/sub_agents?conversation_id=${encodeURIComponent(t)}`),!n.ok)throw new Error(await n.text());const i=await n.json();if(i.success){const r=e.multiAgentMode?Array.isArray(i.agents)?i.agents:[]:Array.isArray(i.data)?i.data:[];r.sort((a,c)=>(Number(a==null?void 0:a.created_at)||0)-(Number(c==null?void 0:c.created_at)||0)),this.subAgents=r;const o=(s=this.activeAgent)==null?void 0:s.task_id;if(o){const a=this.subAgents.find(c=>c.task_id===o);a&&(this.activeAgent={...a})}}}catch(e){console.error("获取子智能体列表失败:",e)}},openSubAgent(s,e){!s||!s.task_id||(e!=null&&e.silent?this.silentActivityTaskId=s.task_id:(this.activeAgent=s,this.silentActivityTaskId=null),this.activityEntries=[],this.activityError=null,this.fetchSubAgentActivity(s.task_id),this.startActivityPolling())},closeSubAgent(){this.stopActivityPolling(),this.activeAgent=null,this.silentActivityTaskId=null,this.activityEntries=[],this.activityError=null,this.activityLoading=!1},startActivityPolling(){this.activityTimer||(this.activityTimer=setInterval(()=>{var e;const s=((e=this.activeAgent)==null?void 0:e.task_id)||this.silentActivityTaskId;s&&this.fetchSubAgentActivity(s)},2e3))},stopActivityPolling(){this.activityTimer&&(clearInterval(this.activityTimer),this.activityTimer=null)},async fetchSubAgentActivity(s){if(s){this.activityLoading=!0;try{const e=kr().currentConversationId,t=e?`&conversation_id=${encodeURIComponent(e)}`:"",n=await fetch(`/api/sub_agents/${s}/activity?limit=100000${t}`);if(!n.ok)throw new Error(await n.text());const i=await n.json();if(i&&i.success&&i.data){const r=Array.isArray(i.data.entries)?i.data.entries:[];this.activityEntries=r,this.activeAgent&&this.activeAgent.task_id===s&&(this.activeAgent={...this.activeAgent,status:i.data.status||this.activeAgent.status});const o=this.subAgents.find(c=>c.task_id===s);o&&i.data.status&&(o.status=i.data.status);const a=(i.data.status||"").toString();jF.has(a)&&this.stopActivityPolling()}}catch(e){this.activityError=(e==null?void 0:e.message)||String(e),console.error("获取子智能体活动失败:",e)}finally{this.activityLoading=!1}}},async terminateSubAgent(s){var t;const e=(s||"").toString().trim();if(!e)return{success:!1,error:S("stores.taskIdRequired")};this.stoppingTaskIds={...this.stoppingTaskIds,[e]:!0};try{const i=kr().currentConversationId,r=i?`?conversation_id=${encodeURIComponent(i)}`:"",o=await fetch(`/api/sub_agents/${encodeURIComponent(e)}/terminate${r}`,{method:"POST"}),a=await o.json().catch(()=>({}));if(!o.ok||!(a!=null&&a.success))throw new Error((a==null?void 0:a.error)||`HTTP ${o.status}`);return await this.fetchSubAgents(),((t=this.activeAgent)==null?void 0:t.task_id)===e&&(await this.fetchSubAgentActivity(e),this.activeAgent={...this.activeAgent,status:"terminated"}),{success:!0,data:(a==null?void 0:a.data)||null}}catch(n){return{success:!1,error:(n==null?void 0:n.message)||String(n)}}finally{const n={...this.stoppingTaskIds};delete n[e],this.stoppingTaskIds=n}},async stopAllAgents(s){var e;try{const n=kr().currentConversationId,i=n?`?conversation_id=${encodeURIComponent(n)}`:"",r=await fetch(`/api/sub_agents/stop_all${i}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:s})}),o=await r.json().catch(()=>({}));if(!r.ok||!(o!=null&&o.success))throw new Error((o==null?void 0:o.error)||`HTTP ${r.status}`);return await this.fetchSubAgents(),{success:!0,stoppedCount:((e=o==null?void 0:o.data)==null?void 0:e.stopped_count)||0}}catch(t){return{success:!1,error:(t==null?void 0:t.message)||String(t)}}},stripConversationPrefix(s){return s?s.startsWith("conv_")?s.slice(5):s:""},getBaseUrl(){const s=window.SUB_AGENT_BASE_URL||window.__SUB_AGENT_BASE_URL__;if(s&&typeof s=="string")return s.replace(/\/$/,"");const{protocol:e,hostname:t}=window.location;if(t&&t.includes("agent.")){const n=t.replace("agent.","subagent.");return`${e}//${n}`}return`${e}//${t}:8092`}}}),VF=Object.freeze(Object.defineProperty({__proto__:null,useSubAgentStore:dd},Symbol.toStringTag,{value:"Module"}));function nC(){const s=kr().currentConversationId;return s?`conversation_id=${encodeURIComponent(s)}`:""}const GF=new Set(["completed","failed","timeout","cancelled"]),vg=hn("backgroundCommand",{state:()=>({commands:[],detailPollTimer:null,activeCommand:null,silentDetailCommandId:null,stoppingCommandIds:{},activeDetail:null,detailLoading:!1,detailError:null}),actions:{async fetchCommands(){var s;try{const e=kr().currentConversationId;if(!e){this.commands=[];return}const t=nC();this.commands=this.commands.filter(r=>!r.conversation_id||r.conversation_id===e);const n=await fetch(`/api/background_commands?limit=200${t?`&${t}`:""}`);if(!n.ok)throw new Error(await n.text());const i=await n.json();if(i.success){const r=Array.isArray(i.data)?i.data:[];r.sort((a,c)=>(Number(a==null?void 0:a.created_at)||0)-(Number(c==null?void 0:c.created_at)||0)),this.commands=r;const o=(s=this.activeCommand)==null?void 0:s.command_id;if(o){const a=this.commands.find(c=>c.command_id===o);a&&(this.activeCommand={...a})}}}catch(e){console.error("获取后台指令列表失败:",e)}},openCommand(s,e){!s||!s.command_id||(e!=null&&e.silent?this.silentDetailCommandId=s.command_id:(this.activeCommand=s,this.silentDetailCommandId=null),this.activeDetail=null,this.detailError=null,this.fetchCommandDetail(s.command_id),this.startDetailPolling())},closeCommand(){this.stopDetailPolling(),this.activeCommand=null,this.silentDetailCommandId=null,this.activeDetail=null,this.detailError=null,this.detailLoading=!1},startDetailPolling(){this.detailPollTimer||(this.detailPollTimer=setInterval(()=>{var e;const s=((e=this.activeCommand)==null?void 0:e.command_id)||this.silentDetailCommandId;s&&this.fetchCommandDetail(s)},2e3))},stopDetailPolling(){this.detailPollTimer&&(clearInterval(this.detailPollTimer),this.detailPollTimer=null)},async fetchCommandDetail(s){if(s){this.detailLoading=!0;try{const e=nC(),t=await fetch(`/api/background_commands/${encodeURIComponent(s)}${e?`?${e}`:""}`);if(!t.ok)throw new Error(await t.text());const n=await t.json();if(n&&n.success&&n.data){this.activeDetail=n.data;const i=this.commands.find(o=>o.command_id===s);i&&Object.assign(i,n.data),this.activeCommand&&this.activeCommand.command_id===s&&(this.activeCommand={...this.activeCommand,...n.data});const r=(n.data.status||"").toString();GF.has(r)&&this.stopDetailPolling()}}catch(e){this.detailError=(e==null?void 0:e.message)||String(e),console.error("获取后台指令详情失败:",e)}finally{this.detailLoading=!1}}},async cancelCommand(s){var t;const e=(s||"").toString().trim();if(!e)return{success:!1,error:S("stores.commandIdRequired")};this.stoppingCommandIds={...this.stoppingCommandIds,[e]:!0};try{const n=nC(),i=await fetch(`/api/background_commands/${encodeURIComponent(e)}/cancel${n?`?${n}`:""}`,{method:"POST"}),r=await i.json().catch(()=>({}));if(!i.ok||!(r!=null&&r.success))throw new Error((r==null?void 0:r.error)||`HTTP ${i.status}`);return await this.fetchCommands(),((t=this.activeCommand)==null?void 0:t.command_id)===e&&await this.fetchCommandDetail(e),{success:!0,data:(r==null?void 0:r.data)||null}}catch(n){return{success:!1,error:(n==null?void 0:n.message)||String(n)}}finally{const n={...this.stoppingCommandIds};delete n[e],this.stoppingCommandIds=n}},async stopAllCommands(s){var e;try{const t=await fetch("/api/background_commands/stop_all",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s?{conversation_id:s}:{})}),n=await t.json().catch(()=>({}));if(!t.ok||!(n!=null&&n.success))throw new Error((n==null?void 0:n.error)||`HTTP ${t.status}`);return await this.fetchCommands(),{success:!0,stoppedCount:((e=n==null?void 0:n.data)==null?void 0:e.stopped_count)||0}}catch(t){return{success:!1,error:(t==null?void 0:t.message)||String(t)}}}}}),oL=hn("focus",{state:()=>({focusedFiles:{}}),actions:{async fetchFocusedFiles(){try{const s=await fetch("/api/focused");if(!s.ok)throw new Error(s.statusText||S("stores.requestFailed"));const e=await s.json();this.focusedFiles=e||{}}catch(s){console.error("获取聚焦文件失败:",s)}},setFocusedFiles(s){this.focusedFiles=s||{}},clearFocusedFiles(){this.focusedFiles={}}}}),er=hn("model",{state:()=>({currentModelKey:"",models:[]}),getters:{currentModel(s){return s.models.find(e=>e.key===s.currentModelKey)||s.models[0]||null}},actions:{setModels(s){var t;if(!Array.isArray(s))return;this.models=s,this.currentModelKey&&this.models.some(n=>n.key===this.currentModelKey)||(this.currentModelKey=((t=this.models[0])==null?void 0:t.key)||"")},setModel(s){if(this.currentModelKey===s)return;if(this.models.some(t=>t.key===s)){this.currentModelKey=s;return}s&&(this.models=[...this.models,{key:s,label:s,description:"",fastOnly:!1,supportsThinking:!0}],this.currentModelKey=s)},async fetchModels(){const s=await fetch("/api/v1/models",{cache:"no-store"}),e=await s.json();if(!s.ok||!(e!=null&&e.success)||!Array.isArray(e.items))throw new Error((e==null?void 0:e.error)||S("stores.loadModelListFailed"));const t=e.items.filter(n=>n&&n.model_key).map(n=>{const i=String(n.multimodal||"none"),r=i==="image"||i==="image,video",o=i==="video"||i==="image,video";return{key:String(n.model_key),label:String(n.name||n.model_key),description:String(n.description||""),visible:n.visible!==!1,multimodal:i,supportsImage:r,supportsVideo:o,contextWindow:typeof n.context_window=="number"?n.context_window:null,maxOutputTokens:typeof n.max_output_tokens=="number"?n.max_output_tokens:null,fastOnly:!!n.fast_only,supportsThinking:!!n.supports_thinking,thinkingOnly:!!n.thinking_only,supportsReasoningEffort:!!n.supports_reasoning_effort}});this.setModels(t)}}}),KF=["stores.toneChatty","stores.toneHumorous","stores.toneBlunt","stores.toneEncouraging","stores.tonePoetic","stores.toneCorporate","stores.toneUnconventional","stores.toneEmpathetic"],aL=()=>({auto_approval:{model:"",thinking:!1,timeout_seconds:60,max_rounds:3,max_command_timeout:20},goal_review:{model:"",thinking:!1,timeout_seconds:60,max_rounds:3,max_command_timeout:60},workflow_review:{model:"",thinking:!1,timeout_seconds:120,max_rounds:6,max_command_timeout:60}}),qF=s=>{const e=aL(),t=s&&typeof s=="object"?s:{},n=(o,a,c,l)=>{const u=typeof o=="number"?o:parseInt(o,10);return Number.isFinite(u)?Math.max(c,Math.min(Math.trunc(u),l)):a},i=["auto_approval","goal_review","workflow_review"],r={};for(const o of i){const a=e[o],c=t[o]&&typeof t[o]=="object"?t[o]:{};r[o]={model:typeof c.model=="string"?c.model:"",thinking:typeof c.thinking=="boolean"?c.thinking:a.thinking,timeout_seconds:n(c.timeout_seconds,a.timeout_seconds,5,3600),max_rounds:n(c.max_rounds,a.max_rounds,1,50),max_command_timeout:n(c.max_command_timeout,a.max_command_timeout,1,600)}}return r},NT=10,Xf={min:1,max:30},bw=20,$_=5,QF=8e4,XF=15e4,ex=["fast","thinking"],tx=["low","medium","high","xhigh","max"],AE="agents_personalization_experiments",$T="agents_ui_theme",lL="agents_stacked_hide_borders",cL="agents_minimal_expand_height_limited",EE="agents_quick_dock_auto_expand",uL=()=>{if(typeof window>"u"||!window.localStorage)return"classic";const s=window.localStorage.getItem($T);return s==="light"||s==="dark"||s==="classic"?s:"classic"},YF=()=>typeof window>"u"||!window.localStorage?!1:window.localStorage.getItem(lL)==="true",JF=()=>{if(typeof window>"u"||!window.localStorage)return"minimal";try{const s=window.localStorage.getItem(AE);if(!s)return"minimal";const e=JSON.parse(s);if(typeof(e==null?void 0:e.blockDisplayMode)=="string"&&["traditional","stacked","minimal"].includes(e.blockDisplayMode))return e.blockDisplayMode}catch(s){console.warn("读取堆叠块显示模式缓存失败:",s)}return"minimal"},sx=s=>{if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(lL,s?"true":"false")}catch(e){console.warn("写入堆叠块边线设置失败:",e)}},dL=()=>{if(typeof window>"u"||!window.localStorage)return!0;const s=window.localStorage.getItem(EE);return s===null?!0:s==="true"},hL=()=>typeof window>"u"||!window.localStorage?!1:window.localStorage.getItem(EE)!==null,ZF=s=>{if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(EE,s?"true":"false")}catch(e){console.warn("写入快捷窗口自动展开设置缓存失败:",e)}},e3=()=>{if(typeof window>"u"||!window.localStorage)return!0;const s=window.localStorage.getItem(cL);return s===null?!0:s==="true"},nx=s=>{if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(cL,s?"true":"false")}catch(e){console.warn("写入极简展开高度限制设置失败:",e)}},t3=()=>({enabled:!1,communication_style:"default",conversation_continuity:"medium",auto_generate_title:!0,title_model:"",recent_conversations_prompt_enabled:!1,recent_conversations_prompt_limit:NT,project_memory_inject_limit:bw,tool_intent_enabled:!0,skill_hints_enabled:!1,skill_strict_terminal_enabled:!1,skill_strict_sub_agent_enabled:!1,skill_strict_run_command_foreground_enabled:!1,skill_strict_run_command_background_enabled:!1,silent_tool_disable:!1,hide_tool_approval_panel:!0,enhanced_tool_display:!0,compact_message_display:"full",block_display_mode:JF(),show_status_avatar:!0,show_git_status_bar:!0,auto_open_terminal_panel:!0,quick_dock_auto_expand:dL(),file_preview_auto_wrap:!1,edit_summary_live_display:!1,modify_history_enabled:!0,stacked_hide_borders:YF(),minimal_expand_height_limited:e3(),enhanced_tool_display_categories:[],enabled_skills:[],self_identify:"",user_name:"",use_custom_names:!1,profession:"",tone:"",considerations:"",disabled_tool_categories:[],default_run_mode:null,default_reasoning_effort:null,default_permission_mode:"approval",default_work_mode:"plan",versioning_enabled_by_default:!0,versioning_backup_mode:"shallow",versioning_restore_mode:"overwrite",default_model:null,image_compression:"original",auto_shallow_compress_enabled:!1,auto_deep_compress_enabled:!0,shallow_compress_trigger_tokens:null,shallow_compress_keep_recent_tools:null,shallow_compress_keep_user_turn_tools:null,shallow_compress_max_replace_per_round:null,shallow_compress_trigger_tool_calls_interval:null,deep_compress_trigger_tokens:null,deep_compress_form:"file",agents_md_auto_inject:!1,claude_md_auto_inject:!1,agents_skills_scan_enabled:!0,new_chat_button_behavior:"route",group_sidebar_by_workspace:!1,sidebar_pinned_workspaces:[],sidebar_workspace_order:[],theme:uL(),ui_locale:"zh-CN",goal_review_mode:"readonly",goal_end_conditions:["max_turns"],goal_max_turns:5,goal_max_tokens:null,review_agents:aL()}),Pg=()=>({blockDisplayMode:"minimal",compactMessageDisplay:"full"}),s3=()=>{if(typeof window>"u"||!window.localStorage)return Pg();try{const s=window.localStorage.getItem(AE);if(!s)return Pg();const e=JSON.parse(s);let t=Pg().blockDisplayMode;typeof(e==null?void 0:e.blockDisplayMode)=="string"&&["traditional","stacked","minimal"].includes(e.blockDisplayMode)?t=e.blockDisplayMode:typeof(e==null?void 0:e.stackedBlocksEnabled)=="boolean"&&(t=e.stackedBlocksEnabled?"stacked":"traditional");let n=Pg().compactMessageDisplay;return typeof(e==null?void 0:e.compactMessageDisplay)=="string"&&["full","brief"].includes(e.compactMessageDisplay)&&(n=e.compactMessageDisplay),{blockDisplayMode:t,compactMessageDisplay:n}}catch(s){return console.warn("无法读取实验功能设置:",s),Pg()}};let B_=null;const Js=hn("personalization",{state:()=>({visible:!1,loading:!1,saving:!1,loaded:!1,status:"",error:"",toggleUpdating:!1,overlayPressActive:!1,form:t3(),toolCategories:[],skillsCatalog:[],recentConversationsPromptLimitRange:{...Xf},projectMemoryInjectLimitMin:$_,experiments:s3()}),getters:{tonePresets:()=>(lt.value,KF.map(s=>S(s)))},actions:{async openDrawer(){this.visible=!0,this.loading||await this.fetchPersonalization()},closeDrawer(){this.visible=!1,this.overlayPressActive=!1},handleOverlayPressStart(s){if(s.target!==s.currentTarget){this.overlayPressActive=!1;return}s.type==="mousedown"&&s.button!==0||(this.overlayPressActive=!0)},handleOverlayPressEnd(s){const e=this.overlayPressActive&&s.target===s.currentTarget;this.overlayPressActive=!1,e&&(s.cancelable&&s.preventDefault(),this.closeDrawer())},handleOverlayPressCancel(){this.overlayPressActive=!1},async fetchPersonalization(){this.loading=!0,this.error="";try{const s=await fetch("/api/personalization"),e=await s.json();if(!s.ok||!e.success)throw new Error(e.error||S("common.loadFailed"));this.applyPersonalizationData(e.data||{}),this.applyPersonalizationMeta(e),this.loaded=!0}catch(s){this.error=(s==null?void 0:s.message)||S("common.loadFailed")}finally{this.loading=!1}},applyPersonalizationData(s){var o,a;const e=this.form&&typeof this.form.default_model=="string"?this.form.default_model:null,t=((o=this.form)==null?void 0:o.theme)||uL();this.form={enabled:!!s.enabled,communication_style:s.communication_style==="human_like"||s.communication_style==="auto"?s.communication_style:"default",conversation_continuity:s.conversation_continuity==="low"||s.conversation_continuity==="high"?s.conversation_continuity:"medium",auto_generate_title:s.auto_generate_title!==!1,title_model:typeof s.title_model=="string"?s.title_model:"",recent_conversations_prompt_enabled:!!s.recent_conversations_prompt_enabled,recent_conversations_prompt_limit:this.normalizeRecentConversationsPromptLimit(s.recent_conversations_prompt_limit),project_memory_inject_limit:this.normalizeProjectMemoryInjectLimit(s.project_memory_inject_limit),tool_intent_enabled:!!s.tool_intent_enabled,skill_hints_enabled:!!s.skill_hints_enabled,skill_strict_terminal_enabled:!!s.skill_strict_terminal_enabled,skill_strict_sub_agent_enabled:!!s.skill_strict_sub_agent_enabled,skill_strict_run_command_foreground_enabled:!!s.skill_strict_run_command_foreground_enabled,skill_strict_run_command_background_enabled:!!s.skill_strict_run_command_background_enabled,silent_tool_disable:!!s.silent_tool_disable,hide_tool_approval_panel:s.hide_tool_approval_panel!==!1,enhanced_tool_display:s.enhanced_tool_display!==!1,compact_message_display:s.compact_message_display==="brief"?"brief":"full",block_display_mode:s.block_display_mode==="traditional"||s.block_display_mode==="stacked"||s.block_display_mode==="minimal"?s.block_display_mode:"minimal",show_status_avatar:s.show_status_avatar!==!1,show_git_status_bar:s.show_git_status_bar!==!1,auto_open_terminal_panel:s.auto_open_terminal_panel!==!1,quick_dock_auto_expand:s.quick_dock_auto_expand!==!1,file_preview_auto_wrap:!!s.file_preview_auto_wrap,edit_summary_live_display:!!s.edit_summary_live_display,modify_history_enabled:s.modify_history_enabled!==!1,stacked_hide_borders:!!s.stacked_hide_borders,minimal_expand_height_limited:s.minimal_expand_height_limited!==!1,enhanced_tool_display_categories:Array.isArray(s.enhanced_tool_display_categories)?s.enhanced_tool_display_categories.filter(c=>typeof c=="string"):[],enabled_skills:Array.isArray(s.enabled_skills)?s.enabled_skills.filter(c=>typeof c=="string"):[],self_identify:s.self_identify||"",user_name:s.user_name||"",use_custom_names:!!s.use_custom_names,profession:s.profession||"",tone:s.tone||"",considerations:typeof s.considerations=="string"?s.considerations:Array.isArray(s.considerations)?s.considerations.filter(c=>typeof c=="string").join(` `):"",disabled_tool_categories:Array.isArray(s.disabled_tool_categories)?s.disabled_tool_categories.filter(c=>typeof c=="string"):[],default_run_mode:(()=>{const c=s.default_run_mode==="deep"?"thinking":s.default_run_mode;return typeof c=="string"&&ex.includes(c)?c:null})(),default_reasoning_effort:typeof s.default_reasoning_effort=="string"&&tx.includes(s.default_reasoning_effort)?s.default_reasoning_effort:null,default_permission_mode:s.default_permission_mode==="readonly"||s.default_permission_mode==="approval"||s.default_permission_mode==="auto_approval"||s.default_permission_mode==="unrestricted"?s.default_permission_mode:"approval",default_work_mode:s.default_work_mode==="plan"||s.default_work_mode==="ask"||s.default_work_mode==="execute"?s.default_work_mode:"plan",versioning_enabled_by_default:s.versioning_enabled_by_default!==!1,versioning_backup_mode:s.versioning_backup_mode==="full"?"full":"shallow",versioning_restore_mode:"overwrite",default_model:typeof s.default_model=="string"?s.default_model:e,image_compression:typeof s.image_compression=="string"?s.image_compression:"original",auto_shallow_compress_enabled:!!s.auto_shallow_compress_enabled,auto_deep_compress_enabled:!!s.auto_deep_compress_enabled,shallow_compress_trigger_tokens:this.normalizeCompressionNumber(s.shallow_compress_trigger_tokens),shallow_compress_keep_recent_tools:this.normalizeCompressionNumber(s.shallow_compress_keep_recent_tools),shallow_compress_keep_user_turn_tools:this.normalizeCompressionNumber(s.shallow_compress_keep_user_turn_tools),shallow_compress_max_replace_per_round:this.normalizeCompressionNumber(s.shallow_compress_max_replace_per_round),shallow_compress_trigger_tool_calls_interval:this.normalizeCompressionNumber(s.shallow_compress_trigger_tool_calls_interval),deep_compress_trigger_tokens:this.normalizeCompressionNumber(s.deep_compress_trigger_tokens),deep_compress_form:s.deep_compress_form==="inject"?"inject":"file",agents_md_auto_inject:!!s.agents_md_auto_inject,claude_md_auto_inject:!!s.claude_md_auto_inject,agents_skills_scan_enabled:s.agents_skills_scan_enabled===void 0?!0:!!s.agents_skills_scan_enabled,new_chat_button_behavior:s.new_chat_button_behavior==="blank"?"blank":"route",group_sidebar_by_workspace:!!s.group_sidebar_by_workspace,sidebar_pinned_workspaces:Array.isArray(s.sidebar_pinned_workspaces)?s.sidebar_pinned_workspaces.filter(c=>typeof c=="string"):[],sidebar_workspace_order:Array.isArray(s.sidebar_workspace_order)?s.sidebar_workspace_order.filter(c=>typeof c=="string"):[],theme:["classic","light","dark"].includes(s.theme)?s.theme:t,ui_locale:["zh-CN","en-US"].includes(s.ui_locale)?s.ui_locale:((a=this.form)==null?void 0:a.ui_locale)||"zh-CN",goal_review_mode:s.goal_review_mode==="active"?"active":"readonly",goal_end_conditions:Array.isArray(s.goal_end_conditions)?s.goal_end_conditions.filter(c=>c==="max_turns"||c==="max_tokens"):["max_turns"],goal_max_turns:typeof s.goal_max_turns=="number"&&s.goal_max_turns>0?s.goal_max_turns:5,goal_max_tokens:typeof s.goal_max_tokens=="number"&&s.goal_max_tokens>0?s.goal_max_tokens:null,review_agents:qF(s.review_agents)};const n=typeof window<"u"&&window.localStorage?window.localStorage.getItem($T):null;this.form.theme!==n&&this.applyTheme(this.form.theme),this.form.ui_locale&&this.form.ui_locale!==lt.value&&JB(this.form.ui_locale),sx(this.form.stacked_hide_borders),nx(this.form.minimal_expand_height_limited),ZF(this.form.quick_dock_auto_expand);const i=this.experiments.compactMessageDisplay;this.form.compact_message_display==="full"&&i==="brief"&&(this.form={...this.form,compact_message_display:"brief"},this.persistCompactMessageDisplay("brief"));const r=this.experiments.blockDisplayMode;this.form.block_display_mode==="minimal"&&r!=="minimal"&&(this.form={...this.form,block_display_mode:r}),this.experiments={...this.experiments,compactMessageDisplay:this.form.compact_message_display,blockDisplayMode:this.form.block_display_mode},this.persistExperiments(),this.clearFeedback()},applyTheme(s){if(typeof window>"u")return;window.localStorage.setItem($T,s),document.documentElement.setAttribute("data-theme",s),document.body.setAttribute("data-theme",s)},normalizeCompressionNumber(s){if(s===null||typeof s>"u"||s==="")return null;const e=Number(s);if(!Number.isFinite(e))return null;const t=Math.round(e);return t<=0?null:t},normalizeRecentConversationsPromptLimit(s){const e=Number(s),t=this.recentConversationsPromptLimitRange.min??Xf.min,n=this.recentConversationsPromptLimitRange.max??Xf.max;return Number.isFinite(e)?Math.max(t,Math.min(n,Math.round(e))):NT},normalizeProjectMemoryInjectLimit(s){if(typeof s>"u")return bw;if(s===null||s==="")return null;const e=Number(s);if(!Number.isFinite(e))return bw;const t=Math.round(e);if(t<=0)return null;const n=this.projectMemoryInjectLimitMin??$_;return Math.max(n,t)},applyPersonalizationMeta(s){if(s&&s.recent_conversations_prompt_limit_range){const{min:e,max:t}=s.recent_conversations_prompt_limit_range;this.recentConversationsPromptLimitRange={min:typeof e=="number"?e:Xf.min,max:typeof t=="number"?t:Xf.max}}else this.recentConversationsPromptLimitRange={...Xf};if(s&&s.project_memory_inject_limit_range){const{min:e}=s.project_memory_inject_limit_range;this.projectMemoryInjectLimitMin=typeof e=="number"?e:$_}else this.projectMemoryInjectLimitMin=$_;s&&Array.isArray(s.tool_categories)?this.toolCategories=s.tool_categories.map((e={})=>({id:typeof e.id=="string"?e.id:String(e.id??""),label:e.label&&String(e.label)||(typeof e.id=="string"?e.id:String(e.id??""))})).filter(e=>!!e.id):this.toolCategories=[],s&&Array.isArray(s.skills_catalog)?this.skillsCatalog=s.skills_catalog.map((e={})=>({id:typeof e.id=="string"?e.id:String(e.id??""),label:e.label&&String(e.label)||(typeof e.id=="string"?e.id:String(e.id??"")),description:typeof e.description=="string"?e.description:void 0})).filter(e=>!!e.id):this.skillsCatalog=[]},clearFeedback(){this.status="",this.error=""},async toggleEnabled(){if(this.toggleUpdating)return;const s=!this.form.enabled,e=this.form.enabled;this.toggleUpdating=!0,this.status="",this.error="",this.form.enabled=s;try{const t=await fetch("/api/personalization",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enabled:s})}),n=await t.json();if(!t.ok||!n.success)throw new Error(n.error||S("stores.updateFailed"));n.data&&this.applyPersonalizationData(n.data),this.applyPersonalizationMeta(n);const i=s?S("stores.enabled"):S("stores.disabled");this.status=i,setTimeout(()=>{this.status===i&&(this.status="")},2e3)}catch(t){this.form.enabled=e,this.error=(t==null?void 0:t.message)||S("stores.updateFailed")}finally{this.toggleUpdating=!1}},async save(){if(!this.saving){this.saving=!0,this.status="",this.error="";try{const s=this.normalizeCompressionNumber(this.form.shallow_compress_trigger_tokens)??QF;if((this.normalizeCompressionNumber(this.form.deep_compress_trigger_tokens)??XF)<=s)throw new Error(S("stores.deepCompressMustExceedShallow"));const t=await fetch("/api/personalization",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(this.form)}),n=await t.json();if(!t.ok||!n.success)throw new Error(n.error||S("stores.saveFailed"));this.applyPersonalizationData(n.data||{}),this.applyPersonalizationMeta(n);const i=S("stores.saved");this.status=i,setTimeout(()=>{this.status===i&&(this.status="")},3e3)}catch(s){this.error=(s==null?void 0:s.message)||S("stores.saveFailed")}finally{this.saving=!1}}},updateField(s){!s||!s.key||(this.form={...this.form,[s.key]:s.value},s.key==="stacked_hide_borders"&&sx(!!s.value),s.key==="minimal_expand_height_limited"&&nx(!!s.value),this.clearFeedback(),this.scheduleAutoSave())},scheduleAutoSave(){B_&&clearTimeout(B_),B_=setTimeout(()=>{B_=null,this.autoSave()},500)},async autoSave(){if(!this.saving){this.saving=!0;try{const s=await fetch("/api/personalization",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(this.form)}),e=await s.json();if(!s.ok||!e.success)throw new Error(e.error||S("stores.autoSaveFailed"))}catch(s){this.error=(s==null?void 0:s.message)||S("stores.autoSaveFailed")}finally{this.saving=!1}}},setRecentConversationsPromptLimit(s){const e=s===null||typeof s>"u"?NT:this.normalizeRecentConversationsPromptLimit(s);this.form={...this.form,recent_conversations_prompt_limit:e},this.clearFeedback(),this.scheduleAutoSave()},setProjectMemoryInjectLimit(s){const e=s===null||typeof s>"u"?null:this.normalizeProjectMemoryInjectLimit(s);this.form={...this.form,project_memory_inject_limit:e},this.clearFeedback(),this.scheduleAutoSave()},restoreProjectMemoryInjectLimit(){this.form={...this.form,project_memory_inject_limit:bw},this.clearFeedback(),this.scheduleAutoSave()},toggleDefaultToolCategory(s){if(!s)return;const e=new Set(this.form.disabled_tool_categories||[]);e.has(s)?e.delete(s):e.add(s),this.form={...this.form,disabled_tool_categories:Array.from(e)},this.clearFeedback(),this.scheduleAutoSave()},toggleSkill(s){if(!s)return;const e=new Set(this.form.enabled_skills||[]);e.has(s)?e.delete(s):e.add(s),this.form={...this.form,enabled_skills:Array.from(e)},this.clearFeedback(),this.scheduleAutoSave()},setDefaultRunMode(s){let e=null;typeof s=="string"&&ex.includes(s)&&(e=s),this.form={...this.form,default_run_mode:e},this.clearFeedback(),this.scheduleAutoSave()},setDefaultReasoningEffort(s){let e=null;typeof s=="string"&&tx.includes(s)&&(e=s),this.form={...this.form,default_reasoning_effort:e},this.clearFeedback(),this.scheduleAutoSave()},setDefaultPermissionMode(s){const t=["readonly","approval","auto_approval","unrestricted"].includes(s)?s:"unrestricted";this.form={...this.form,default_permission_mode:t},this.clearFeedback(),this.scheduleAutoSave()},setDefaultWorkMode(s){const t=["plan","ask","execute"].includes(s)?s:"plan";this.form={...this.form,default_work_mode:t},this.clearFeedback(),this.scheduleAutoSave()},setVersioningRestoreMode(s){const e="overwrite";this.form={...this.form,versioning_restore_mode:e},this.clearFeedback(),this.scheduleAutoSave()},setVersioningBackupMode(s){const e=s==="full"?"full":"shallow";this.form={...this.form,versioning_backup_mode:e},this.clearFeedback(),this.scheduleAutoSave()},setDefaultModel(s){const e=er(),t=new Set((e.models||[]).map(i=>i.key)),n=typeof s=="string"&&t.has(s)?s:null;this.form={...this.form,default_model:n},this.clearFeedback(),this.scheduleAutoSave()},setImageCompression(s){["original","1080p","720p","540p"].includes(s)&&(this.form={...this.form,image_compression:s},this.clearFeedback(),this.scheduleAutoSave())},applyTonePreset(s){s&&(this.form={...this.form,tone:s},this.clearFeedback(),this.scheduleAutoSave())},updateConsiderations(s){this.form={...this.form,considerations:s},this.clearFeedback(),this.scheduleAutoSave()},async logout(){try{const s=await fetch("/logout",{method:"POST",credentials:"same-origin",cache:"no-store"});let e=null;try{e=await s.json()}catch{e=null}if(s.ok&&(!e||e.success!==!1)){window.location.replace(`/login?logged_out=1&ts=${Date.now()}`);return}window.location.replace(`/logout?ts=${Date.now()}`)}catch(s){console.error("退出登录失败:",s),this.error=(s==null?void 0:s.message)||S("stores.logoutFailedRetry"),window.location.replace(`/logout?ts=${Date.now()}`)}},persistExperiments(){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(AE,JSON.stringify(this.experiments))}catch(s){console.warn("写入实验功能设置失败:",s)}},setBlockDisplayMode(s){this.experiments={...this.experiments,blockDisplayMode:s},this.persistExperiments(),this.form={...this.form,block_display_mode:s},this.scheduleAutoSave()},setCompactMessageDisplay(s){const e=s==="brief"?"brief":"full";this.form={...this.form,compact_message_display:e},this.experiments={...this.experiments,compactMessageDisplay:e},this.persistExperiments(),this.clearFeedback(),this.persistCompactMessageDisplay(e)},async persistCompactMessageDisplay(s){try{const e=await fetch("/api/personalization",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({compact_message_display:s})}),t=await e.json();(!e.ok||!t.success)&&console.warn("保存简略消息显示失败:",t==null?void 0:t.error)}catch(e){console.warn("保存简略消息显示失败:",e)}},setCommunicationStyle(s){this.form={...this.form,communication_style:s},this.clearFeedback(),this.scheduleAutoSave()},setConversationContinuity(s){this.form={...this.form,conversation_continuity:s},this.clearFeedback(),this.scheduleAutoSave()}}}),n3=Object.freeze(Object.defineProperty({__proto__:null,hasCachedQuickDockAutoExpand:hL,loadCachedQuickDockAutoExpand:dL,usePersonalizationStore:Js},Symbol.toStringTag,{value:"Module"})),i3={browserSearch:"chat.progressBrowserSearch",webExtract:"chat.progressWebExtract",webSave:"chat.progressWebSave",appendFile:"chat.progressAppendFile",modifyFile:"chat.progressModifyFile",createFile:"chat.progressCreateFile",deleteFile:"chat.progressDeleteFile",readFile:"chat.progressReadFile",reader:"chat.progressReader",focus:"chat.progressFocus",unfocus:"chat.progressUnfocus",runCommand:"chat.progressRunCommand",terminalSession:"chat.progressTerminalSession",terminalInput:"chat.progressTerminalInput",terminalSnapshot:"chat.progressTerminalSnapshot",memoryUpdate:"chat.progressMemoryUpdate",todoCreate:"chat.progressTodoCreate",todoUpdate:"chat.progressTodoUpdate",todoFinish:"chat.progressTodoFinish",todoFinishConfirm:"chat.progressTodoFinishConfirm",todoDelete:"chat.progressTodoDelete",wait:"chat.progressWait",sleep:"chat.progressSleep",createFolder:"chat.progressCreateFolder",renameFile:"chat.progressRenameFile",terminalReset:"chat.progressTerminalReset",terminalSleep:"chat.progressTerminalSleep",terminalRun:"chat.progressTerminalRun",ocr:"chat.progressOcr",memory:"chat.progressMemory",todo:"chat.progressTodo",genericTool:"chat.progressGenericTool"};function ix(s){const e=i3[s];return e?S(e):null}const fL=hn("connection",{state:()=>({isConnected:!1,socket:null,stopRequested:!1,projectPath:"",agentVersion:"",thinkingMode:!0,runMode:"thinking",reasoningEffort:null}),actions:{setSocket(s){this.socket=s},setConnected(s){this.isConnected=s},setStopRequested(s){this.stopRequested=s},requestStop(){this.stopRequested=!0},clearStopRequest(){this.stopRequested=!1},setProjectPath(s){this.projectPath=s},setAgentVersion(s){this.agentVersion=s},setThinkingMode(s){this.thinkingMode=!!s},toggleThinkingMode(){this.thinkingMode=!this.thinkingMode},setRunMode(s){this.runMode=s,this.thinkingMode=s!=="fast"},setReasoningEffort(s){this.reasoningEffort=s}}}),iC=(...s)=>{},Yf=(...s)=>{},Td=(...s)=>{},rC=["__pycache__","config","core","data","doc","docker","logs","modules","node_modules","project","prompts","scratch_test","scripts","static","sub_agent","test","users","utils"],r3=32,rx={web_search:"browserSearch",extract_webpage:"webExtract",save_webpage:"webSave",read_file:"reader",view_video:"reader",vlm_analyze:"ocr",ocr_image:"ocr",create_folder:"createFolder",create_file:"createFile",rename_file:"renameFile",delete_file:"deleteFile",write_file:"modifyFile",edit_file:"modifyFile",run_command:"runCommand",terminal_session:"terminalSession",terminal_input:"terminalInput",terminal_snapshot:"terminalSnapshot",sleep:"terminalSleep",update_memory:"memoryUpdate",recall_project_memory:"reader",search_project_memory:"reader",update_project_memory:"memoryUpdate",todo_create:"todoCreate",todo_update_task:"todoUpdate",todo_delete_task:"todoDelete",terminal_run:"runCommand"},o3=(s="evt")=>`${s}-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,pL=hn("monitor",{state:()=>({statusLabel:S("stores.idle"),queue:[],playing:!1,awaitingTools:{},lastTreeSnapshot:[...rC],lastSpeechAt:0,thinkingActive:!1,pendingResults:{},completedResults:{},driver:null,speechBuffer:"",bubbleActive:!1,pendingProgressScene:null,progressIndicator:{id:null,label:"",scene:null}}),getters:{isLocked:s=>s.playing||s.queue.length>0},actions:{registerDriver(s){this.driver=s,this.driver.resetScene({desktopRoots:this.lastTreeSnapshot,preserveBubble:this.bubbleActive,preservePointer:!1,preserveWindows:!1}),this.speechBuffer&&(this.driver.showSpeechBubble(this.speechBuffer,{variant:"info",duration:0}),this.bubbleActive=!0),this.driver.setManualInteractionEnabled(!this.isLocked),this.pendingProgressScene&&(Yf("registerDriver:apply-pending",{scene:this.pendingProgressScene}),this.driver.previewSceneProgress(this.pendingProgressScene),this.pendingProgressScene=null),this.queue.length&&this.processQueue()},unregisterDriver(){this.driver&&(this.driver.setManualInteractionEnabled(!1),this.driver.hideBubble()),this.driver=null,this.playing=!1},syncDesktopFromTree(s){var t,n;if(!Array.isArray(s)||!s.length){this.lastTreeSnapshot=[...rC],(t=this.driver)==null||t.setDesktopRoots(this.lastTreeSnapshot,{immediate:!0});return}const e=s.filter(i=>i&&i.type==="folder").map(i=>i.name).filter(Boolean);this.lastTreeSnapshot=e.length?e:[...rC],(n=this.driver)==null||n.setDesktopRoots(this.lastTreeSnapshot)},resetVisualState(s){var a,c;const e=!!(s!=null&&s.preserveBubble),t=(s==null?void 0:s.preservePointer)!==!1,n=!!(s!=null&&s.preserveWindows),i=!!(s!=null&&s.preserveQueue),r=!!(s!=null&&s.preservePendingResults),o=!!(s!=null&&s.preserveAwaitingTools);this.statusLabel=S("stores.idle"),i||(this.queue=[],this.playing=!1),this.lastSpeechAt=0,o||(this.awaitingTools={}),r||(Object.values(this.pendingResults).forEach(l=>{l!=null&&l.timeout&&clearTimeout(l.timeout)}),this.pendingResults={},this.completedResults={}),e||(this.speechBuffer="",this.bubbleActive=!1),this.thinkingActive=!1,this.pendingProgressScene=null,this.progressIndicator={id:null,label:"",scene:null},(a=this.driver)==null||a.resetScene({desktopRoots:this.lastTreeSnapshot,preserveBubble:e,preservePointer:t,preserveWindows:n}),(c=this.driver)==null||c.setManualInteractionEnabled(!this.isLocked)},setProgressIndicator(s){this.progressIndicator={id:s.id,label:s.label,scene:s.scene},Yf("progress-indicator:set",this.progressIndicator)},previewToolIntent(s){this.bubbleActive&&this.hideBubble(`tool-intent:${(s==null?void 0:s.name)||"unknown"}`),this.speechBuffer="";const e=rx[s.name]||"genericTool",t=ix(e);t&&(this.setStatus(t),this.progressIndicator={id:null,label:t,scene:e},Yf("preview-tool-intent",{tool:s.name,script:e,label:t}),this.driver?this.driver.previewSceneProgress(e):this.pendingProgressScene=e)},clearProgressIndicator(s){s&&this.progressIndicator.id&&s!==this.progressIndicator.id||(Yf("progress-indicator:clear",{id:this.progressIndicator.id,label:this.progressIndicator.label}),this.progressIndicator={id:null,label:"",scene:null})},setStatus(s){this.statusLabel=s},showBubble(s,e={}){var t;s&&(iC("showBubble",{text:s,variant:e==null?void 0:e.variant,duration:e==null?void 0:e.duration}),(t=this.driver)==null||t.showSpeechBubble(s,e),this.bubbleActive=!0)},hideBubble(s){var e;(e=this.driver)==null||e.hideBubble(),this.bubbleActive=!1,this.thinkingActive=!1},resetSpeechBuffer(){this.speechBuffer=""},showPendingReply(){var s;if(this.setStatus(S("stores.idle")),this.driver&&typeof this.driver.showWaitingBubble=="function"){this.driver.showWaitingBubble(S("stores.waitingReply")),this.bubbleActive=!0;return}(s=this.driver)==null||s.showSpeechBubble(S("stores.waitingReplyEllipsis"),{variant:"info",duration:0}),this.bubbleActive=!0},enqueueModelSpeech(s){if(s){if(this.setStatus(S("stores.planning")),this.speechBuffer=`${this.speechBuffer}${s}`,this.lastSpeechAt=Date.now(),iC("enqueueModelSpeech",{incoming:s,combined:this.speechBuffer}),this.playing||!this.driver){this.bubbleActive=!1;return}this.driver.showSpeechBubble(this.speechBuffer,{variant:"info",duration:0}),this.bubbleActive=!0}},enqueueModelThinking(){var t;const s=fL();s.runMode==="fast"||s.thinkingMode===!1||this.playing||!this.driver||this.thinkingActive||(this.setStatus(S("stores.thinking")),(t=this.driver)==null||t.showThinkingBubble(),this.bubbleActive=!0,this.thinkingActive=!0)},endModelOutput(){this.setStatus(S("stores.idle")),this.thinkingActive=!1},enqueueToolEvent(s){var c,l,u,d,h;const t=Date.now()-this.lastSpeechAt,n=480,i=rx[s.name]||"genericTool",r=ix(i);r&&this.setStatus(r);const o=s.executionId||s.id||o3("tool");if(this.ensurePendingResult(o),this.queue.push({id:o,script:i,payload:{...s,executionId:o}}),this.awaitingTools[o]=s.name,this.driver&&typeof this.driver.preparePendingCreation=="function"&&(s.name==="create_folder"||s.name==="create_file")){const p=((c=s==null?void 0:s.arguments)==null?void 0:c.path)||((l=s==null?void 0:s.arguments)==null?void 0:l.target_path)||((u=s==null?void 0:s.arguments)==null?void 0:u.targetPath)||((d=s==null?void 0:s.argumentSnapshot)==null?void 0:d.path)||((h=s==null?void 0:s.argumentSnapshot)==null?void 0:h.target_path);this.driver.preparePendingCreation(p)}Td("enqueue",{id:o,tool:s.name,script:i,queueSize:this.queue.length,awaiting:Object.keys(this.awaitingTools).length,status:this.statusLabel}),r?this.setProgressIndicator({id:o,label:r,scene:i}):this.clearProgressIndicator();const a=()=>{this.driver?(Yf("enqueueToolEvent:preview-now",{tool:s.name,script:i,id:o}),this.driver.previewSceneProgress(i)):(Yf("enqueueToolEvent:pending-preview",{tool:s.name,script:i,id:o}),this.pendingProgressScene=i),this.bubbleActive&&this.hideBubble(`tool-enqueue:${(s==null?void 0:s.name)||"unknown"}`)};if(this.bubbleActive&&t>=0&&tthis.hideBubble(),2600)}e&&this.fulfillPendingResult(e,s)},ensurePendingResult(s){if(!s)return;const e=Object.prototype.hasOwnProperty.call(this.completedResults,s);if(this.pendingResults[s]){if(e){const r=this.completedResults[s];delete this.completedResults[s],this.pendingResults[s].resolve(r)}return}let t=()=>{};const i={promise:new Promise(r=>{t=r}),resolve:r=>{i.settled||(i.settled=!0,i.timeout&&(clearTimeout(i.timeout),i.timeout=null)),t(r)},timeout:null,settled:!1};if(i.timeout=setTimeout(()=>{i.settled||(i.resolve(null),this.cleanupPendingResult(s,i))},12e3),this.pendingResults[s]=i,e){const r=this.completedResults[s];delete this.completedResults[s],i.resolve(r)}},waitForResult(s){if(!s)return Promise.resolve(null);const e=String(s);if(Object.prototype.hasOwnProperty.call(this.completedResults,e)){const n=this.completedResults[e];return delete this.completedResults[e],Promise.resolve(n)}this.ensurePendingResult(e);const t=this.pendingResults[e];return t?t.promise.finally(()=>{this.cleanupPendingResult(e,t)}):Promise.resolve(null)},fulfillPendingResult(s,e){if(!s)return;const t=this.pendingResults[s];if(t){t.resolve(e);return}this.completedResults[s]=e;const n=Object.keys(this.completedResults);if(n.length>r3){const i=n[0];delete this.completedResults[i]}},cleanupPendingResult(s,e){if(!s)return;const t=e||this.pendingResults[s];t&&(t.timeout&&(clearTimeout(t.timeout),t.timeout=null),this.pendingResults[s]===t&&delete this.pendingResults[s])},async processQueue(){if(!(this.playing||!this.queue.length)&&this.driver){for(this.playing=!0,this.driver.setManualInteractionEnabled(!1),Td("queue-start",{size:this.queue.length});this.queue.length&&this.driver;){const s=this.queue.shift();s&&(iC("processQueue start",{script:s.script,bubbleActive:this.bubbleActive,speechBufferLength:this.speechBuffer.length}),this.bubbleActive&&this.hideBubble(`queue-start:${s.script}`),this.speechBuffer="",await this.runScript(s))}this.playing=!1,this.driver&&this.driver.setManualInteractionEnabled(!0),this.speechBuffer&&this.driver&&(this.driver.showSpeechBubble(this.speechBuffer,{variant:"info",duration:0}),this.bubbleActive=!0),this.setStatus(S("stores.idle"))}},async runScript(s){var a,c,l,u,d;if(!this.driver){this.queue.unshift(s);return}const e=((a=s.payload)==null?void 0:a.executionId)||((c=s.payload)==null?void 0:c.execution_id)||s.id||((l=s.payload)==null?void 0:l.id)||null;Td("runScript:start",{script:s.script,waitKey:e,payloadTool:(u=s.payload)==null?void 0:u.name,payloadId:(d=s.payload)==null?void 0:d.id});let t,n=!1;const i=async()=>{if(!e)return n=!0,t===void 0&&(t=null),t;if(n)return t;try{t=await this.waitForResult(e)}catch(h){console.warn("monitor waitForResult error",h),t=null}finally{n=!0}return t},r=h=>{const p=typeof h=="string"&&h.trim().length?h.trim():S("stores.inProgress");return p.startsWith("正在")?S("stores.playbackStatus",{label:p.slice(2)}):p},o={waitForResult:()=>i(),setStatus:h=>this.setStatus(r(h)),statusPhase:"playback"};this.setStatus(S("stores.toolPlayback")),Td("runScript:playback",{script:s.script,waitKey:e,status:this.statusLabel});try{await this.driver.playScene(s.script,s.payload||{},o)}catch(h){console.warn("Monitor scene error",h)}finally{Td("runScript:end",{script:s.script,waitKey:e})}}}}),oC={damping:.7,stiffness:.05,mass:1.25},a3=70,l3=1e3/60,c3=350;let _w=!1,ox=!1;function u3(){ox||typeof document>"u"||(document.addEventListener("mousedown",()=>{_w=!0}),document.addEventListener("mouseup",()=>{_w=!1}),document.addEventListener("click",()=>{_w=!1}),ox=!0)}const aC=new Map;function lC(...s){const e={damping:oC.damping,stiffness:oC.stiffness,mass:oC.mass};let t=!1;for(const i of s){if(i==="instant"){t=!0;continue}typeof i!="object"||!i||(t=!1,e.damping=i.damping??e.damping,e.stiffness=i.stiffness??e.stiffness,e.mass=i.mass??e.mass)}const n=JSON.stringify(e);return aC.has(n)||aC.set(n,Object.freeze({...e})),t?"instant":aC.get(n)}function d3(s={}){u3();let e={...s};const t=new Set,n={isAtBottom:e.initial!==!1,isNearBottom:!1,escapedFromLock:!1,velocity:0,accumulated:0,resizeDifference:0};function i(){const x=r();for(const D of t)D(x)}function r(){return{isAtBottom:n.isAtBottom||n.isNearBottom,isNearBottom:n.isNearBottom,escapedFromLock:n.escapedFromLock}}function o(){var x;return((x=n.scrollElement)==null?void 0:x.scrollTop)??0}function a(x){n.scrollElement&&(n.scrollElement.scrollTop=x,n.ignoreScrollToTop=n.scrollElement.scrollTop)}function c(){const x=n.scrollElement,D=n.contentElement;return!x||!D?0:x.scrollHeight-1-x.clientHeight}let l;function u(){const x=n.scrollElement,D=n.contentElement;if(!x||!D)return 0;const N=c();if(!e.targetScrollTop)return N;if((l==null?void 0:l.targetScrollTop)===N)return l.calculatedScrollTop;const O=Math.max(Math.min(e.targetScrollTop(N,{scrollElement:x,contentElement:D}),N),0);return l={targetScrollTop:N,calculatedScrollTop:O},typeof requestAnimationFrame<"u"&&requestAnimationFrame(()=>{l=void 0}),O}function d(){return u()-o()}function h(){return d()<=a3}function p(x){n.isAtBottom=x,i()}function g(x){n.escapedFromLock=x,i()}function v(x){n.isNearBottom=x,i()}function m(){var G;if(!_w||typeof window>"u")return!1;const x=(G=window.getSelection)==null?void 0:G.call(window);if(!x||!x.rangeCount)return!1;const D=x.getRangeAt(0),N=n.scrollElement;if(!N)return!1;const O=D.commonAncestorContainer;return!!(O&&(N.contains(O)||O.contains(N)))}const y=x=>{if(x.target!==n.scrollElement)return;const D=o(),N=n.ignoreScrollToTop;let O=n.lastScrollTop??D;n.lastScrollTop=D,n.ignoreScrollToTop=void 0,N&&N>D&&(O=N),v(h()),setTimeout(()=>{var q;if(n.resizeDifference||D===N)return;if(m()){g(!0),p(!1);return}const G=D>O,Z=D{var O;const D=n.scrollElement;if(!D)return;let N=x.target;for(;N&&!["scroll","auto"].includes(getComputedStyle(N).overflow);){if(!N.parentElement)return;N=N.parentElement}N===D&&x.deltaY<0&&D.scrollHeight>D.clientHeight&&!((O=n.animation)!=null&&O.ignoreEscapes)&&(g(!0),p(!1))};function b(x,D){k(),n.scrollElement=x,n.contentElement=D,getComputedStyle(x).overflow==="visible"&&(x.style.overflow="auto"),x.addEventListener("scroll",y,{passive:!0}),x.addEventListener("wheel",_,{passive:!0});let N;n.resizeObserver=new ResizeObserver(O=>{const G=O[0];if(!G)return;const{height:Z}=G.contentRect,q=Z-(N??Z);if(n.resizeDifference=q,o()>c()&&a(c()),v(h()),q>=0){const V=lC(e,N?e.resize:e.initial);A({animation:V,wait:!0,preserveScrollPosition:!0,duration:V==="instant"?void 0:c3})}else h()&&(g(!1),p(!0));N=Z,typeof requestAnimationFrame<"u"&&requestAnimationFrame(()=>{setTimeout(()=>{n.resizeDifference===q&&(n.resizeDifference=0)},1)})}),n.resizeObserver.observe(D)}function k(){var x;n.scrollElement&&(n.scrollElement.removeEventListener("scroll",y),n.scrollElement.removeEventListener("wheel",_)),(x=n.resizeObserver)==null||x.disconnect(),n.resizeObserver=void 0,n.scrollElement=void 0,n.contentElement=void 0}function w(){k(),t.clear()}function T(x){e={...e,...x}}function A(x={}){var I;const D=typeof x=="string"?{animation:x}:x;D.preserveScrollPosition||p(!0);const N=Date.now()+(Number(D.wait)||0),O=lC(e,D.animation),{ignoreEscapes:G=!1}=D;let Z,q=u();D.duration instanceof Promise?D.duration.finally(()=>{Z=Date.now()}):Z=N+(D.duration??0);const V=async()=>{const $=new Promise(L=>{if(typeof requestAnimationFrame>"u"){L(!1);return}requestAnimationFrame(()=>L(!0))}).then(()=>{var oe;if(!n.isAtBottom)return n.animation=void 0,!1;const L=o(),K=typeof performance<"u"?performance.now():Date.now(),se=(K-(n.lastTick??K))/l3;if(n.animation||(n.animation={behavior:O,promise:$,ignoreEscapes:G}),n.animation.behavior===O&&(n.lastTick=K),m()||N>Date.now())return V();if(LDate.now()?(q=u(),V()):(n.animation=void 0,o()(typeof requestAnimationFrame<"u"&&requestAnimationFrame(()=>{n.animation||(n.lastTick=void 0,n.velocity=0)}),L))};return D.wait!==!0&&(n.animation=void 0),((I=n.animation)==null?void 0:I.behavior)===O?n.animation.promise:V()}const C=()=>{g(!0),p(!1)};function E(x){return t.add(x),()=>t.delete(x)}return{attach:b,detach:k,destroy:w,setOptions:T,getState:r,onChange:E,scrollToBottom:A,stopScroll:C}}function h3(s={}){const e=ge(null),t=ge(null),n=ge(s.initial!==!1),i=ge(!1),r=ge(!1),o=d3(s);let a=null;return jP(c=>{!e.value||!t.value||(o.attach(e.value,t.value),a=o.onChange(l=>{n.value=l.isAtBottom,i.value=l.isNearBottom,r.value=l.escapedFromLock}),c(()=>{a==null||a(),a=null,o.detach()}))}),Rn(()=>{o.destroy()}),{scrollRef:e,contentRef:t,isAtBottom:n,isNearBottom:i,escapedFromLock:r,scrollToBottom:c=>o.scrollToBottom(c),stopScroll:()=>o.stopScroll(),setOptions:c=>o.setOptions(c)}}const ly=null,{min:Hd,max:sa,abs:ax,floor:f3}=Math,mL=(s,e,t)=>Hd(t,sa(e,s)),gL=s=>[...s].sort((e,t)=>e-t),p3=typeof queueMicrotask=="function"?queueMicrotask:s=>{Promise.resolve().then(s)},BT=()=>{let s;return[new Promise(e=>{s=e}),s]},vL=s=>{let e;return()=>(s&&(e=s(),s=void 0),e)},Bv=(s,e,t)=>{const n=t?"unshift":"push";for(let i=0;i{const t=s.t[e];return t===-1?s.o:t},m3=(s,e,t)=>{const n=s.t[e]===-1;return s.t[e]=t,s.i=Hd(e,s.i),n},ww=(s,e)=>{if(!s.l)return 0;if(s.i>=e)return s.u[e];s.i<0&&(s.u[0]=0,s.i=0);let t=s.i,n=s.u[t];for(;t{let i=t;for(;t<=n;){const r=f3((t+n)/2);ww(s,r)<=e?(i=r,t=r+1):n=r-1}return mL(i,0,s.l-1)},lx=(s,e,t)=>{const n=e-s.l;return s.i=t?-1:Hd(e-1,s.i),s.l=e,n>0?(Bv(s.u,n),Bv(s.t,n,t),s.o*n):(s.u.splice(n),(t?s.t.splice(0,-n):s.t.splice(n)).reduce((i,r)=>i-(r===-1?s.o:r),0))},g3=s=>s.documentElement,v3=s=>s.ownerDocument,y3=s=>s.defaultView,bL=vL(()=>!!/iP(hone|od|ad)/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>0),b3=vL(()=>"scrollBehavior"in g3(document).style),_3=(s,e=40,t=0,n,i=!1)=>{let r=!!t,o=1,a=0,c=0,l=0,u=0,d=0,h=0,p=0,g=0,v=ly,m=[0,r?sa(t-1,0):-1],y=0,_=!1;const b=((O,G,Z)=>({o:G,t:Z?Bv(Z.slice(0,Hd(O,Z.length)),sa(0,O-Z.length)):Bv([],O),l:O,i:-1,u:Bv([],O+1)}))(s,n?n[1]:e,n&&n[0]),k=new Set,w=()=>l-c,T=()=>w()+d+u,A=(O,G)=>((Z,q,V,I)=>{if(I=Hd(I,Z.l-1),ww(Z,I)<=q){const $=Jf(Z,V,I);return[Jf(Z,q,I,$),$]}{const $=Jf(Z,q,void 0,I);return[$,Jf(Z,V,$)]}})(b,O,G,m[0]),C=()=>ww(b,b.l),E=(O,G)=>{const Z=ww(b,O)-d;return G?C()-Z-x(O):Z},x=O=>yL(b,O),D=(O,G=-1)=>b.t[O]===G,N=O=>{O&&(bL()&&p!==0||v&&g===1?d+=O:u+=O)};return{p:()=>{k.clear()},m:()=>o,h:()=>(O=>[O.t.slice(),O.o])(b),v:(O=200)=>{if(!_||r)return m;let G,Z;if(h)[G,Z]=m;else{let q=sa(0,T()),V=q+a;i||(O=sa(0,O),p!==1&&(q-=O),p!==2&&(V+=O)),[G,Z]=m=A(sa(0,q),sa(0,V)),v&&(G=Hd(G,v[0]),Z=sa(Z,v[1]))}return[sa(G,0),Hd(Z,b.l-1)]},S:O=>Jf(b,O-c),I:D,O:E,k:x,j:()=>b.l,N:()=>l,B:()=>p!==0,T:()=>a,q:()=>c,M:C,P:()=>(h=u,u=0,[h,g===2]),R:(O,G)=>{const Z=[O,G];return k.add(Z),()=>{k.delete(Z)}},A:(O,G)=>{let Z,q,V=0;switch(O){case 1:{if(G===l&&g===0)break;const I=h;h=0;const $=G-l,L=ax($);I&&L=-a&&K<=C()&&(V+=1,q=L>a);break}case 2:V=8,p!==0&&(Z=!0,V+=1),p=0,g=0,v=ly;break;case 3:{const I=G.filter(([$,L])=>!D($,L));if(!I.length)break;N(I.reduce(($,[L,K])=>{let se;if(g===2)se=!0;else if(v&&g===1)se=La&&(N((($,L)=>{let K=0;const se=[];$.t.forEach((X,J)=>{X!==-1&&(se.push(X),J{V&I&&$(q)}))}}},ME=setTimeout,cC=(s,e)=>e?-s:s,w3=(s,e,t,n,i,r)=>{const o=Date.now;let a=0,c=!1,l=!1,u=!1,d=!1;const h=(()=>{let y;const _=()=>{y!=ly&&clearTimeout(y)},b=()=>{_(),y=ME(()=>{y=ly,(()=>{if(c||l)return c=!1,void h();u=!1,s.A(2)})()},150)};return b.C=_,b})(),p=()=>{a=o(),u&&(d=!0),s.A(1,n()),h()},g=y=>{if(c||!s.B()||y.ctrlKey)return;const _=o()-a;150>_&&50<_&&(t?y.deltaX:y.deltaY)&&(c=!0)},v=()=>{l=!0,u=d=!1},m=()=>{l=!1,bL()&&(u=!0)};return e.addEventListener("scroll",p),e.addEventListener("wheel",g,{passive:!0}),e.addEventListener("touchstart",v,{passive:!0}),e.addEventListener("touchend",m,{passive:!0}),{H:()=>{e.removeEventListener("scroll",p),e.removeEventListener("wheel",g),e.removeEventListener("touchstart",v),e.removeEventListener("touchend",m),h.C()},V:()=>{const[y,_]=s.P();y&&(i(y,_,d),d=!1,_&&s.T()>s.M()&&s.A(1,n()))}}},S3=(s,e,t)=>{let n;return[async(i,r)=>{if(!await e())return;n&&n();const o=()=>{const[a,c]=BT();return n=()=>{c(!1)},s.T()&&ME(n,150),[a,s.R(2,()=>{c(!0)})]};if(r&&b3())s.A(8,i()),p3(async()=>{for(;;){let a=!0;for(let[u,d]=s.v();u<=d;u++)if(s.I(u)){a=!1;break}if(a)break;const[c,l]=o();try{if(!await c)return}finally{l()}}s.A(7),t(i(),r)});else for(;;){const[a,c]=o();try{if(s.A(7),t(i()),!await a)return}finally{c()}}},()=>{n&&n()}]},k3=s=>{let e;return{F(t){(e||(e=new(y3(v3(t))).ResizeObserver(s))).observe(t)},J(t){e.unobserve(t)},H(){e&&e.disconnect()}}},C3=ct({props:{L:{type:Object,required:!0},W:{type:Object,required:!0},X:{type:Object,required:!0},Y:{type:Function,required:!0},D:{type:Number,required:!0},U:{type:Boolean},G:{type:Boolean},K:{type:Boolean},Z:{type:String,required:!0},ee:Object},setup(s){const e=ge(),t=be(()=>s.L.value&&s.W.O(s.D,s.K)),n=be(()=>s.L.value&&s.W.I(s.D));return Ke(()=>e.value&&s.D,(i,r,o)=>{o(s.Y(e.value,s.D))},{flush:"post"}),()=>{const{X:i,U:r,G:o,Z:a}=s,c=n.value,{style:l,...u}=s.ee??{},d={contain:"layout style",position:c&&o?void 0:"absolute",[r?"height":"width"]:"100%",[r?"top":"left"]:"0px",[r?"left":"top"]:t.value+"px",visibility:!c||o?void 0:"hidden",...l};return r&&(d.display="inline-flex"),We(a,ZB({ref:e,style:d},u),typeof(h=i)=="function"||Object.prototype.toString.call(h)==="[object Object]"&&!VP(h)?i:{default:()=>[i],_:2},16,["style"]);var h}}}),T3=(s,e)=>{if(s.length===1){const t=s[0].key;if(t!=null)return t}return"_"+e},A3=(s,e)=>s[0]===e[0]&&s[1]===e[1],E3=ct({props:{data:{type:Array,required:!0},bufferSize:Number,itemSize:Number,shift:Boolean,horizontal:Boolean,startMargin:{type:Number,default:0},ssrCount:Number,scrollRef:Object,as:{type:String,default:"div"},item:{type:String,default:"div"},itemProps:Function,keepMounted:Array,cache:Object},emits:["scroll","scrollEnd"],setup(s,{emit:e,expose:t,slots:n}){let i=!!s.ssrCount;const r=s.horizontal,o=ge(),a=_3(s.data.length,s.itemSize,s.ssrCount,s.cache,!s.itemSize),c=((g,v)=>{let m;const y=v?"width":"height",_=new WeakMap,b=k3(k=>{const w=[];for(const{target:T,contentRect:A}of k)if(T.offsetParent)if(T===m)g.A(4,A[y]);else{const C=_.get(T);C!=ly&&w.push([C,A[y]])}w.length&&g.A(3,w)});return{te(k){b.F(m=k)},re:(k,w)=>(_.set(k,w),b.F(k),()=>{_.delete(k),b.J(k)}),p:b.H}})(a,r),l=((g,v)=>{let m,y,_=BT(),b=!1;const k=v?"scrollLeft":"scrollTop",w=v?"overflowX":"overflowY",[T,A]=S3(g,()=>_[0],(C,E)=>{C=cC(C,b),E?m.scrollTo({[v?"left":"top"]:C,behavior:"smooth"}):m[k]=C});return{oe(C,E){m=E,v&&(b=getComputedStyle(E).direction==="rtl"),y=w3(g,E,v,()=>cC(E[k],b),(x,D,N)=>{if(N){const O=E.style,G=O[w];O[w]="hidden",ME(()=>{O[w]=G})}E[k]=cC(g.N()+x,b),D&&A()}),_[1](!0)},p(){y&&y.H(),_[1](!1),_=BT()},ne:()=>b,se(C){T(()=>C)},ie(C){C+=g.N(),T(()=>C)},le(C,{align:E,smooth:x,offset:D=0}={}){if(C=mL(C,0,g.j()-1),E==="nearest"){const N=g.O(C),O=g.N();if(NO+g.T()))return;E="end"}}T(()=>D+g.q()+g.O(C)+(E==="end"?g.k(C)-g.T():E==="center"?(g.k(C)-g.T())/2:0),x)},ce:()=>{y&&y.V()}}})(a,r),u=ge(a.m());a.R(1,()=>{u.value=a.m()}),a.R(4,()=>{e("scroll",a.N())}),a.R(8,()=>{e("scrollEnd")});const d=be(g=>{u.value;const v=a.v(s.bufferSize);return g&&A3(g,v)?g:v}),h=be(()=>u.value&&a.B()),p=be(()=>u.value&&a.M());return dn(()=>{i=!1;const g=o.value,v=requestAnimationFrame(()=>{const m=y=>{c.te(y),l.oe(g,y)};s.scrollRef?m(s.scrollRef):m(g.parentElement)});QM(()=>{cancelAnimationFrame(v)})}),QM(()=>{a.p(),c.p(),l.p()}),Ke(()=>s.data.length,g=>{a.A(5,[g,s.shift])}),Ke(()=>s.startMargin,g=>{a.A(6,g)},{immediate:!0}),Ke([u],()=>{l.ce()},{flush:"post"}),t({get cache(){return a.h()},get scrollOffset(){return a.N()},get scrollSize(){return(g=>sa(g.M(),g.T()))(a)},get viewportSize(){return a.T()},findItemIndex:a.S,getItemOffset:a.O,getItemSize:a.k,scrollToIndex:l.le,scrollTo:l.se,scrollBy:l.ie}),()=>{const g=s.as,v=s.item,m=p.value,y=l.ne(),_=[],b=w=>{var A;const T=n.default({item:s.data[w],index:w});return We(C3,{key:T3(T,w),L:u,W:a,Y:c.re,D:w,X:T,U:r,K:y,G:i,Z:v,ee:(A=s.itemProps)==null?void 0:A.call(s,{item:s.data[w],index:w})},null,8,["L","W","Y","D","X","U","K","G","Z","ee"])};if(s.keepMounted){const w=new Set(s.keepMounted);for(let[T,A]=d.value;T<=A;T++)w.add(T);gL([...w]).forEach(T=>{_.push(b(T))})}else for(let[w,T]=d.value;w<=T;w++)_.push(b(w));return We(g,{ref:o,style:{contain:"size style",overflowAnchor:"none",flex:"none",position:"relative",width:r?m+"px":"100%",height:r?"100%":m+"px",pointerEvents:h.value?"none":void 0}},typeof(k=_)=="function"||Object.prototype.toString.call(k)==="[object Object]"&&!VP(k)?_:{default:()=>[_],_:2},8,["style"]);var k}}});function M3(s,e){const{stopScroll:t,duration:n=300,defaultDirection:i="auto"}=e,r=new Map,o=new Map;let a=null;function c(h,p,g){const v=h.top-p.top,m=p.height/2;return v>m?"up":"down"}function l(){const h=s.value;if(!h){a=null;return}const p=h.getBoundingClientRect(),g=performance.now();let v=!1;for(const[m,y]of r){const _=g-y.startTime;if(!(document.body.contains(h)&&h.contains(y.element))){r.delete(m);continue}const k=y.element.getBoundingClientRect(),w=k.top-p.top,T=k.bottom-p.top;let A=0;y.mode==="up"?A=T-y.initialBottom:A=-(w-y.initialTop);const C=Math.abs(A)>1,E=y.extendOnGrowth&&C&&_>y.duration*.6;if(E&&(y.startTime=g-y.duration*.3),_>=y.duration&&!E){y.phase==="collapse"&&o.delete(m),r.delete(m);continue}v=!0,Math.abs(A)>.5&&(h.scrollTop+=A)}v?a=requestAnimationFrame(l):a=null}function u(h,p,g){const v=s.value;if(!v)return;const m=v.getBoundingClientRect(),y=h.getBoundingClientRect(),_=y.top-m.top,b=y.bottom-m.top;if(b<-50||_>m.height+50)return;const k=(g==null?void 0:g.phase)??"expand",w=(g==null?void 0:g.direction)??i;let T;w!=="auto"?T=w:k==="collapse"&&o.has(p)||k==="expand"&&o.has(p)?T=o.get(p):(T=c(y,m),o.set(p,T));const A=(g==null?void 0:g.extendOnGrowth)??!1;t();const C=r.get(p);r.set(p,{element:h,startTime:performance.now(),duration:(g==null?void 0:g.duration)??n,mode:T,initialTop:_,initialBottom:b,extendOnGrowth:A||(C==null?void 0:C.extendOnGrowth)||!1,phase:k}),a===null&&(a=requestAnimationFrame(l))}function d(){a!==null&&(cancelAnimationFrame(a),a=null),r.clear(),o.clear()}return{anchorBlockElement:u,stopAll:d}}function Y(s){const e=document.createElement("div");return e.textContent=s,e.innerHTML}function xE(s){if(s===0)return"0 B";const e=1024,t=["B","KB","MB","GB"],n=Math.floor(Math.log(s)/Math.log(e));return Math.round(s/Math.pow(e,n)*100)/100+" "+t[n]}function x3(s){if(s<=0)return S("toolResults.duration.zero");if(s<60)return S("toolResults.duration.seconds",{seconds:s});const e=Math.floor(s/60),t=s%60;if(e<60)return t>0?S("toolResults.duration.minutesSeconds",{minutes:e,seconds:t}):S("toolResults.duration.minutes",{minutes:e});const n=Math.floor(e/60),i=e%60;return i===0&&t===0?S("toolResults.duration.hours",{hours:n}):S("toolResults.duration.hoursMinutesSeconds",{hours:n,minutes:i,seconds:t})}function ds(s,e,t=S("toolResults.status.failedMark")){const n=String((s==null?void 0:s.status)||"").toLowerCase();return n==="awaiting_user_answer"?S("toolResults.status.awaitingUserAnswer"):n==="awaiting_approval"||n==="pending_approval"||n==="pending"?S("toolResults.status.awaitingApproval"):n==="rejected"?S("toolResults.status.rejected"):n==="cancelled"?S("toolResults.status.cancelled"):s!=null&&s.success?e:t}function RE(s,e,t,n){const i=s.tool,r=i==null?void 0:i.result,o=(i==null?void 0:i.arguments)||{},a=i==null?void 0:i.name;return r?typeof r=="string"?`
${Y(r)}
`:a==="web_search"?I3(r,o,e,t,n):a==="extract_webpage"?P3(r,o):a==="save_webpage"?L3(r,o):a==="create_file"||a==="create_folder"?O3(r,o):a==="write_file"?D3(r,o):a==="edit_file"?N3(r,o):a==="delete_file"?$3(r,o):a==="rename_file"?B3(r,o):a==="read_file"||a==="read_skill"?F3(r,o):a==="create_skill"?e5(r):a==="list_workflows"?t5(r,o):a==="save_workflow"?s5(r,o):a==="vlm_analyze"?H3(r,o):a==="ocr_image"?U3(r,o):a==="view_image"?W3(r,o):a==="terminal_session"?z3(r,o):a==="terminal_input"?j3(r,o):a==="terminal_snapshot"?V3(r,o):a==="sleep"?G3(r,o):a==="run_command"?K3(r,o):a==="update_memory"?q3(r,o):a==="recall_project_memory"?Q3(r,o):a==="search_project_memory"?X3(r,o):a==="update_project_memory"?Y3(r,o):a==="conversation_search"?J3(r,o):a==="conversation_review"?Z3(r,o):a==="ask_user"?o5(r,o):a==="manage_personalization"?a5(r,o):a==="todo_create"?l5(r,o):a==="todo_update_task"?c5(r):a==="trigger_easter_egg"?u5(r,o):a==="create_sub_agent"?d5(r,o):a==="terminate_sub_agent"?h5(r,o):a==="send_message_to_sub_agent"?p5(r,o):a==="answer_sub_agent_question"?m5(r,o):a==="create_custom_agent"?g5(r,o):a==="list_agents"?v5(r):a==="list_active_sub_agents"?y5(r):a==="get_sub_agent_status"?f5(r):R3(r,o,a):""}function R3(s,e,t){const n=ds(s,S("toolResults.status.completed"),S("toolResults.status.failedMark"));let i='
';i+=`
${Y(S("toolResults.labels.tool"))}${Y(t)}
`,i+=`
${Y(S("toolResults.labels.status"))}${Y(n)}
`,["path","file_path","agent_id","target_agent_id","display_name","target_display_name","question","role_id","url"].forEach(a=>{const c=(e==null?void 0:e[a])??(s==null?void 0:s[a]);if(c!==void 0&&c!==""&&c!==null){const l={path:"toolResults.fields.path",file_path:"toolResults.fields.filePath",agent_id:"toolResults.fields.agentId",target_agent_id:"toolResults.fields.targetAgentId",display_name:"toolResults.fields.displayName",target_display_name:"toolResults.fields.targetDisplayName",question:"toolResults.fields.question",role_id:"toolResults.fields.roleId",url:"toolResults.fields.url"},u=typeof c=="string"?c:JSON.stringify(c),d=String(u).slice(0,200),h=String(u).length>200?"…":"",p=S("toolResults.values.colon"),g=l[a]?S(l[a])+p:a+p;i+=`
${Y(g)}${Y(d+h)}
`}}),!(s!=null&&s.success)&&(s!=null&&s.error)&&(i+=`
${Y(S("toolResults.labels.error"))}${Y(String(s.error))}
`),i+="
";const o=(s==null?void 0:s.message)??(s==null?void 0:s.summary)??(s==null?void 0:s.answer)??(s==null?void 0:s.output)??(s==null?void 0:s.content)??(s==null?void 0:s.data)??"";return o&&typeof o=="string"&&o.trim()?(i+='
',i+=`
${Y(o.trim())}
`,i+="
"):s!=null&&s.success&&(i+='
',i+=`
${Y(S("toolResults.sentences.emptyResult"))}
`,i+="
"),i}function I3(s,e,t,n,i){const r=s.query||e.query||"",o=s.filters||{},a=s.total_results||0,c=s.results||[];let l='
';return l+=`
${Y(S("toolResults.labels.query"))}${Y(r)}
`,l+=`
${Y(S("toolResults.labels.topic"))}${Y(t(o))}
`,l+=`
${Y(S("toolResults.labels.timeRange"))}${Y(n(o))}
`,l+=`
${Y(S("toolResults.labels.domains"))}${Y(i(o))}
`,l+=`
${Y(S("toolResults.labels.resultCount"))}${a}
`,l+="
",c.length>0?(l+='
',c.forEach(u=>{l+='
',l+=`
${Y(u.title||S("toolResults.values.noTitle"))}
`,l+='
',u.url?l+=`${Y(u.url)}`:l+=`${Y(S("toolResults.values.noLink"))}`,l+="
"}),l+="
"):l+=`
${Y(S("toolResults.sentences.noSearchResults"))}
`,l}function P3(s,e){const t=e.url||s.url||"",n=ds(s,S("toolResults.status.successMark")),i=s.content||s.text||"";let r='
';return r+=`
${Y(S("toolResults.labels.url"))}${Y(t)}
`,r+=`
${Y(S("toolResults.labels.status"))}${n}
`,r+="
",i&&(r+='
',r+=`
${Y(i)}
`,r+="
"),r}function L3(s,e){const t=e.url||s.url||"",n=s.path||e.save_path||"",i=ds(s,S("toolResults.status.saved"));let r='
';return r+=`
${Y(S("toolResults.labels.url"))}${Y(t)}
`,r+=`
${Y(S("toolResults.labels.savePath"))}${Y(n)}
`,r+=`
${Y(S("toolResults.labels.status"))}${i}
`,r+="
",r}function O3(s,e){const t=e.path||s.path||"",n=ds(s,S("toolResults.status.created"));let i='
';return i+=`
${Y(S("toolResults.labels.path"))}${Y(t)}
`,i+=`
${Y(S("toolResults.labels.status"))}${n}
`,i+="
",i}function D3(s,e){const t=e.file_path||e.path||s.path||"",n=ds(s,S("toolResults.status.written")),i=typeof e.append=="boolean"?e.append:null,r=String(s.mode||"").toLowerCase(),o=i===!0||r==="a"?S("toolResults.values.append"):i===!1||r==="w"?S("toolResults.values.overwrite"):S("toolResults.values.none"),a=i===!0||r==="a"?e.content||"":s.new_file??e.content??"";let c='
';return c+=`
${Y(S("toolResults.labels.path"))}${Y(t)}
`,c+=`
${Y(S("toolResults.labels.status"))}${n}
`,c+=`
${Y(S("toolResults.labels.mode"))}${o}
`,!s.success&&s.error&&(c+=`
${Y(S("toolResults.labels.error"))}${Y(String(s.error))}
`),c+="
",s.success&&a&&(c+='
',a.split(` `).forEach((u,d)=>{c+=`
${d+1}+${Y(u)}
`}),c+="
"),c}function N3(s,e){const t=e.file_path||e.path||s.path||"",n=ds(s,S("toolResults.status.edited")),i=typeof s.found_matches=="number"?s.found_matches:typeof s.replacements=="number"?s.replacements:null,r=typeof s.replacements=="number"?s.replacements:null,o=Array.isArray(s.details)?s.details.filter(c=>c&&c.status==="success"):[];let a='
';if(a+=`
${Y(S("toolResults.labels.path"))}${Y(t)}
`,a+=`
${Y(S("toolResults.labels.status"))}${n}
`,a+=`
${Y(S("toolResults.labels.replacementGroups"))}${Y((s.replacement_groups??o.length)||S("toolResults.values.none"))}
`,a+=`
${Y(S("toolResults.labels.found"))}${Y(S("toolResults.counts.foundValue",{n:i??S("toolResults.values.none")}))}
`,a+=`
${Y(S("toolResults.labels.replaced"))}${Y(S("toolResults.counts.replacedValue",{n:r??S("toolResults.values.none")}))}
`,!s.success&&s.error&&(a+=`
${Y(S("toolResults.labels.error"))}${Y(String(s.error))}
`),a+="
",!s.success)return a;if(o.length>0){a+='
';const c=(p,g,v,m="")=>{const y=typeof p=="number"&&Number.isFinite(p)?String(p):"";a+=`
${Y(y)}${Y(g)}${Y(v)}
`},l=[];o.forEach(p=>{const g=p.old_string||"",v=p.new_string||"",m=Array.isArray(p.contexts)?p.contexts:[],y=g?g.split(` `):[],_=v?v.split(` `):[],b=k=>{var C;const w=[],T=Number((k==null?void 0:k.old_start_line)??((C=p.matched_lines)==null?void 0:C[0])),A=Number.isFinite(T)?T:null;return g&&y.forEach((E,x)=>{w.push({lineNo:A===null?null:A+x,marker:"-",text:E,className:"diff-remove"})}),v&&_.forEach((E,x)=>{w.push({lineNo:A===null?null:A+x,marker:"+",text:E,className:"diff-add"})}),w};if(m.length>0)m.forEach(k=>{var q,V,I;const w=[],T=Array.isArray(k.before_lines)?k.before_lines:[],A=Array.isArray(k.after_lines)?k.after_lines:[],C=T.length>=2&&T.every($=>String(($==null?void 0:$.text)??"")==="")?[]:T.length>=2&&String(((q=T[0])==null?void 0:q.text)??"")===""?T.slice(1):T,E=A.length>=2&&A.every($=>String(($==null?void 0:$.text)??"")==="")?[]:A.length>=2&&String(((V=A[A.length-1])==null?void 0:V.text)??"")===""?A.slice(0,-1):A,x=Number((k==null?void 0:k.old_start_line)??((I=p.matched_lines)==null?void 0:I[0])),D=Number((k==null?void 0:k.old_end_line)??x),N=Number.isFinite(x)&&Number.isFinite(D)?Math.max(1,D-x+1):Math.max(1,g?g.split(` `).length:1),G=(v===""?0:v.split(` `).length)-N;C.forEach($=>{w.push({lineNo:Number($.line),marker:" ",text:String($.text??""),className:""})}),w.push(...b(k)),E.forEach($=>{const L=Number($.line),K=Number.isFinite(L)?L+G:L;w.push({lineNo:K,marker:" ",text:String($.text??""),className:""})});const Z=w.filter($=>typeof $.lineNo=="number"&&Number.isFinite($.lineNo));l.push({rows:w,minLine:Z.length?Math.min(...Z.map($=>$.lineNo)):null,maxLine:Z.length?Math.max(...Z.map($=>$.lineNo)):null})});else{const k=b(),w=k.filter(T=>typeof T.lineNo=="number"&&Number.isFinite(T.lineNo));l.push({rows:k,minLine:w.length?Math.min(...w.map(T=>T.lineNo)):null,maxLine:w.length?Math.max(...w.map(T=>T.lineNo)):null})}});const u=l.sort((p,g)=>(p.minLine??Number.MAX_SAFE_INTEGER)-(g.minLine??Number.MAX_SAFE_INTEGER)),d=[];u.forEach(p=>{const g=d[d.length-1];g&&p.minLine!==null&&g.maxLine!==null&&p.minLine<=g.maxLine+1?(g.rows.push(...p.rows),g.maxLine=Math.max(g.maxLine,p.maxLine??g.maxLine)):d.push({...p,rows:[...p.rows]})});const h={" ":0,"-":1,"+":2};d.forEach((p,g)=>{g>0&&c(null," ","⋮","diff-separator");const v=new Set;p.rows.filter(y=>y.marker!==" "||typeof y.lineNo!="number"?!0:v.has(y.lineNo)?!1:(v.add(y.lineNo),!0)).sort((y,_)=>{const b=y.marker==="-"||y.marker==="+",k=_.marker==="-"||_.marker==="+";return b&&k?(h[y.marker]??9)-(h[_.marker]??9)||(y.lineNo??Number.MAX_SAFE_INTEGER)-(_.lineNo??Number.MAX_SAFE_INTEGER):(y.lineNo??Number.MAX_SAFE_INTEGER)-(_.lineNo??Number.MAX_SAFE_INTEGER)||(h[y.marker]??9)-(h[_.marker]??9)}).forEach(y=>c(y.lineNo,y.marker,y.text,y.className))}),a+="
"}return a}function $3(s,e){const t=e.path||s.path||"",n=ds(s,S("toolResults.status.deleted"));let i='
';return i+=`
${Y(S("toolResults.labels.path"))}${Y(t)}
`,i+=`
${Y(S("toolResults.labels.status"))}${n}
`,i+="
",i}function B3(s,e){const t=e.old_path||e.source||s.old_path||"",n=e.new_path||e.destination||s.new_path||"",i=ds(s,S("toolResults.status.renamed"));let r='
';return r+=`
${Y(S("toolResults.labels.path"))}${Y(t)}
`,r+=`
${Y(S("toolResults.labels.status"))}${i}
`,r+=`
${Y(S("toolResults.labels.rename"))}${Y(t)} → ${Y(n)}
`,r+="
",r}function F3(s,e){const t=e.path||s.path||"",n=ds(s,S("toolResults.status.successMark")),i=s.size||s.file_size||0,r=s.type||"read";let o='
';if(o+=`
${Y(S("toolResults.labels.path"))}${Y(t)}
`,o+=`
${Y(S("toolResults.labels.status"))}${n}
`,i>0&&(o+=`
${Y(S("toolResults.labels.size"))}${xE(i)}
`),r!=="read"&&(o+=`
${Y(S("toolResults.labels.mode"))}${Y(r)}
`),o+="
",r==="read"){const a=s.content||s.text||"";a&&(o+='
',o+=`
${Y(a)}
`,o+="
")}else if(r==="search"){const a=s.matches||[],c=s.query||e.query||"";c&&(o+='
',o+=`
${Y(S("toolResults.labels.searchKeyword"))}${Y(c)}
`,o+=`
${Y(S("toolResults.labels.matchCount"))}${a.length}
`,o+="
"),a.length>0?(o+='
',a.forEach((l,u)=>{u>0&&(o+='
'),o+='
';const d=l.line_start===l.line_end?`${l.line_start}`:`${l.line_start}-${l.line_end}`;o+=`
${Y(S("toolResults.values.line",{line:d}))}
`,o+=`
${Y(l.snippet||l.content||"")}
`,o+="
"}),o+="
"):o+=`
${Y(S("toolResults.sentences.noMatches"))}
`}else if(r==="extract"){const a=s.segments||[];a.length>0?(o+='
',o+=`
${Y(S("toolResults.labels.segmentCount"))}${a.length}
`,o+="
",o+='
',a.forEach((c,l)=>{l>0&&(o+='
'),o+='
';const u=c.start_line||c.line_start||"?",d=c.end_line||c.line_end||"?";o+=`
${Y(S("toolResults.values.line",{line:`${u}-${d}`}))}
`,o+=`
${Y(c.content||c.text||"")}
`,o+="
"}),o+="
"):o+=`
${Y(S("toolResults.sentences.noExtractedContent"))}
`}return o}function H3(s,e){const t=e.image_path||e.path||s.path||"",n=ds(s,S("toolResults.status.successMark")),i=s.analysis||s.result||"";let r='
';return r+=`
${Y(S("toolResults.labels.path"))}${Y(t)}
`,r+=`
${Y(S("toolResults.labels.status"))}${n}
`,r+="
",i&&(r+='
',r+=``,r+=`
${Y(i)}
`,r+="
"),r}function U3(s,e){const t=e.image_path||e.path||s.path||"",n=ds(s,S("toolResults.status.successMark")),i=s.size||s.file_size||0,r=s.text||s.ocr_text||"",o=s.image_url||s.url||"";let a='
';return a+=`
${Y(S("toolResults.labels.path"))}${Y(t)}
`,a+=`
${Y(S("toolResults.labels.status"))}${n}
`,i>0&&(a+=`
${Y(S("toolResults.labels.size"))}${xE(i)}
`),a+="
",o&&(a+=`
${Y(S(
`),r&&(a+='
',a+=``,a+=`
${Y(r)}
`,a+="
"),a}function W3(s,e){const t=e.image_path||e.path||s.path||"",n=ds(s,S("toolResults.status.successMark")),i=s.size||s.file_size||0;let r=s.image_url||s.url||"";!r&&t&&s.success!==!1&&(r=`/api/file/content?path=${encodeURIComponent(t)}`);let o='
';if(o+=`
${Y(S("toolResults.labels.path"))}${Y(t)}
`,o+=`
${Y(S("toolResults.labels.status"))}${n}
`,i>0&&(o+=`
${Y(S("toolResults.labels.size"))}${xE(i)}
`),o+="
",r){const a=Y(r);o+=`
${Y(S(
`}return o}function z3(s,e){const t=e.operation||e.action||"start",n=e.session_name||e.name||s.session_name||"",i=ds(s,S("toolResults.status.successMark"));let r='
';return r+=`
${Y(S("toolResults.labels.operation"))}${Y(t)}
`,r+=`
${Y(S("toolResults.labels.terminalName"))}${Y(n)}
`,r+=`
${Y(S("toolResults.labels.status"))}${i}
`,r+="
",r}function j3(s,e){const t=e.command||e.input||"",n=e.output_wait||30,i=s.output||s.result||"";let r='
';return r+=`
${Y(S("toolResults.labels.command"))}${Y(t)}
`,r+=`
${Y(S("toolResults.labels.waitTime"))}${Y(S("toolResults.duration.seconds",{seconds:n}))}
`,r+="
",i&&(r+='
',r+=``,r+=`
${Y(i)}
`,r+="
"),r}function V3(s,e){const t=e.session_name||e.name||s.session_name||"",n=ds(s,S("toolResults.status.successMark")),i=e.start_line||0,r=e.end_line||0,o=s.content||s.output||"";let a='
';return a+=`
${Y(S("toolResults.labels.status"))}${n}
`,a+=`
${Y(S("toolResults.labels.terminalName"))}${Y(t)}
`,(i||r)&&(a+=`
${Y(S("toolResults.labels.lineRange"))}${i} - ${r}
`),a+="
",o&&(a+='
',a+=``,a+=`
${Y(o)}
`,a+="
"),a}function G3(s,e){const t=ds(s,S("toolResults.status.completed")),n=(s==null?void 0:s.mode)||"seconds";let i='
';if(i+=`
${Y(S("toolResults.labels.status"))}${t}
`,i+=`
${Y(S("toolResults.labels.mode"))}${Y(n)}
`,n==="seconds"||n===""||n===null){const r=e.seconds||e.duration||0;i+=`
${Y(S("toolResults.labels.waitTime"))}${Y(S("toolResults.duration.seconds",{seconds:r}))}
`,e.reason&&(i+=`
${Y(S("toolResults.labels.reason"))}${Y(String(e.reason))}
`)}else if(n==="wait_sub_agent_output"){const r=(s==null?void 0:s.display_name)??(e==null?void 0:e.wait_sub_agent_output)??"";r!==""&&(i+=`
${Y(S("toolResults.labels.waitSubAgent"))}${Y(String(r))}
`)}else if(n==="wait_sub_agent_ids"){const r=Array.isArray(s==null?void 0:s.agent_ids)?s.agent_ids:[];r.length>0&&(i+=`
${Y(S("toolResults.labels.waitSubAgent"))}${r.map(String).join(", ")}
`);const o=Array.isArray(s==null?void 0:s.waited_task_ids)?s.waited_task_ids:[];o.length>0&&(i+=`
${Y(S("toolResults.labels.taskId"))}${o.map(String).join(", ")}
`)}else if(n==="wait_runcommand_id"){const r=(s==null?void 0:s.command_id)??(e==null?void 0:e.wait_runcommand_id)??"";r!==""&&(i+=`
${Y(S("toolResults.labels.backgroundCommandId"))}${Y(String(r))}
`)}if(!(s!=null&&s.success)&&(s!=null&&s.error)&&(i+=`
${Y(S("toolResults.labels.error"))}${Y(String(s.error))}
`),i+="
",n==="seconds"||n===""||n===null){const r=(s==null?void 0:s.message)||"";r&&(i+='
',i+=``,i+=`
${Y(String(r))}
`,i+="
")}else if(n==="wait_sub_agent_output"){const r=(s==null?void 0:s.message)||"";r&&(i+='
',i+=``,i+=`
${Y(String(r))}
`,i+="
")}else if(n==="wait_sub_agent_ids"){const r=Array.isArray(s==null?void 0:s.results)?s.results:[];r.length>0&&(i+='
',i+=``,r.forEach(o=>{if(!o||typeof o!="object")return;const a=o.agent_id??"?",c=o.task_id??"?",l=o.status??"unknown",u=o.success===!0;i+='
';const d=u?S("toolResults.status.successMark"):S("toolResults.status.failedMark");i+=`
${Y(S("toolResults.sentences.subAgentResultName",{agentId:String(a)}))}${Y(S("toolResults.sentences.subAgentResultMeta",{taskId:String(c),status:String(l),outcome:d}))}
`;const h=o.message||o.error||"";if(h){const p=o.runtime_seconds??o.elapsed_seconds??null,g=p!==null?S("toolResults.duration.runtimeNote",{n:Math.round(Number(p))}):"",v=o.stats;if(g||v){if(i+='
',g&&(i+=`${Y(g)}`),v&&typeof v=="object"){const m=[];v.api_calls!=null&&m.push(S("toolResults.counts.statApiCalls",{n:v.api_calls})),v.files_read!=null&&m.push(S("toolResults.counts.statFilesRead",{n:v.files_read})),v.edit_files!=null&&m.push(S("toolResults.counts.statEditFiles",{n:v.edit_files})),v.searches!=null&&m.push(S("toolResults.counts.statSearches",{n:v.searches})),v.web_pages!=null&&m.push(S("toolResults.counts.statWebPages",{n:v.web_pages})),v.commands!=null&&m.push(S("toolResults.counts.statCommands",{n:v.commands})),m.length>0&&(i+=`${Y(m.join(" | "))}`)}i+="
"}i+=`
${Y(String(h))}
`}i+="
"}),i+="
")}else if(n==="wait_runcommand_id"){const r=s==null?void 0:s.result;if(r&&typeof r=="object"){const o=r.output||r.stdout||"",a=r.exit_code!==void 0?r.exit_code:r.returncode;i+='
',i+=``,a!==void 0&&(i+=`
${Y(S("toolResults.labels.exitCode"))}${Y(String(a))}
`),o?i+=`
${Y(String(o))}
`:i+=`
${Y(S("toolResults.sentences.noOutput"))}
`,i+="
"}}return i}function K3(s,e){const t=e.command||"",n=e.timeout||30,i=s.output||s.stdout||"",r=s.exit_code!==void 0?s.exit_code:s.returncode;let o='
';return o+=`
${Y(S("toolResults.labels.command"))}${Y(t)}
`,o+=`
${Y(S("toolResults.labels.timeout"))}${Y(S("toolResults.duration.seconds",{seconds:n}))}
`,r!==void 0&&(o+=`
${Y(S("toolResults.labels.exitCode"))}${r}
`),o+="
",i&&(o+='
',o+=``,o+=`
${Y(i)}
`,o+="
"),o}function q3(s,e){const t=e.operation||s.operation||"",n=e.content||"",i=e.index||s.index,r=s.count||0;let o='
';return t==="append"?(o+=`
${Y(S("toolResults.sentences.memoryAdd"))}
`,o+=`
${r}. ${Y(n)}
`):t==="replace"?(o+=`
${Y(S("toolResults.sentences.memoryUpdate"))}
`,o+=`
${i}. ${Y(n)}
`):t==="delete"&&(o+=`
${Y(S("toolResults.sentences.memoryDelete"))}
`,o+=`
${i}. ${Y(n||S("toolResults.values.deleted"))}
`),o+="
",o}function Q3(s,e){const t=e.name||s.memory_name||"",n=ds(s,S("toolResults.status.read")),i=s.content||s.text||"";let r='
';return r+=`
${Y(S("toolResults.labels.status"))}${n}
`,r+=`
${Y(S("toolResults.labels.memory"))}${Y(t)}
`,r+="
",s.success&&i?(r+='
',r+=`
${Y(i)}
`,r+="
"):!s.success&&s.error&&(r+=`
${Y(String(s.error))}
`),r}function X3(s,e){const t=Array.isArray(s==null?void 0:s.keywords)?s.keywords:Array.isArray(e==null?void 0:e.keywords)?e.keywords:[],n=Array.isArray(s==null?void 0:s.results)?s.results:[],i=ds(s,S("toolResults.status.completed"));let r='
';return r+=`
${Y(S("toolResults.labels.keywords"))}${Y(t.join(" / ")||S("toolResults.values.notSpecified"))}
`,r+=`
${Y(S("toolResults.labels.status"))}${i}
`,r+=`
${Y(S("toolResults.counts.memoryHits",{n:n.length}))}
`,!(s!=null&&s.success)&&(s!=null&&s.error)&&(r+=`
${Y(S("toolResults.labels.error"))}${Y(String(s.error))}
`),r+="
",n.length?(r+='
',n.forEach(o=>{r+='
',r+=`
${Y(o.name||o.file||"")}
`,o.description&&(r+=`
${Y(S("toolResults.labels.description"))}${Y(o.description)}
`);const a=Array.isArray(o.snippets)?o.snippets:[];a.length>0&&(r+='
',a.forEach(c=>{const l=`L${c.line??"?"}: ${c.text||""}`,u=Y(l);r+=`
${u}
`}),r+="
"),r+="
"}),r+="
",r):(s!=null&&s.success&&(r+=`
${Y(S("toolResults.sentences.noMatchesMemory"))}
`),r)}function Y3(s,e){const t=e.name||s.memory_name||"",n=e.description||"",i=e.content||"",r=ds(s,S("toolResults.status.updated"));let o='
';return o+=`
${Y(S("toolResults.labels.status"))}${r}
`,o+=`
${Y(S("toolResults.labels.memory"))}${Y(t)}
`,n&&(o+=`
${Y(S("toolResults.labels.description"))}${Y(n)}
`),!s.success&&s.error&&(o+=`
${Y(S("toolResults.labels.error"))}${Y(String(s.error))}
`),o+="
",s.success&&i&&(o+='
',o+=``,o+=`
${Y(i)}
`,o+="
"),o}function J3(s,e){const t=Array.isArray(s==null?void 0:s.results)?s.results:[],n=Array.isArray(s==null?void 0:s.keywords)?s.keywords:Array.isArray(e==null?void 0:e.keywords)?e.keywords:[],i=n.length?n.join(" / "):(s==null?void 0:s.query)||(e==null?void 0:e.query)||S("toolResults.values.notSpecified");let r='
';return r+=`
${Y(S("toolResults.labels.keywords"))}${Y(i)}
`,r+=`
${Y(S("toolResults.labels.dateRange"))}${Y((s==null?void 0:s.start_date)||(e==null?void 0:e.start_date)||S("toolResults.values.unlimited"))} ~ ${Y((s==null?void 0:s.end_date)||(e==null?void 0:e.end_date)||S("toolResults.values.unlimited"))}
`,r+=`
${Y(S("toolResults.labels.scope"))}${Y(S("toolResults.sentences.conversationScope"))}
`,r+=`
${Y(S("toolResults.labels.resultCount"))}${t.length}
`,r+="
",t.length?(r+='
',t.forEach(o=>{r+='
',r+=`
${Y(o.title||S("toolResults.values.unnamedConversation"))}
`,r+=`
${Y(S("toolResults.labels.id"))}${Y(o.id||"")}
`,r+=`
${Y(S("toolResults.counts.conversationScale",{n:String(o.total_messages||0),m:String(o.total_tools||0)}))}
`,o.first_user_message&&(r+=`
${Y(S("toolResults.labels.firstUserMessage"))}${Y(o.first_user_message)}
`),o.updated_at&&(r+=`
${Y(S("toolResults.labels.updatedAt"))}${Y(o.updated_at)}
`),r+="
"}),r+="
",r):(r+=`
${Y(S("toolResults.sentences.noMatchesConversation"))}
`,r)}function Z3(s,e){const t=ds(s,(s==null?void 0:s.mode)==="read"?S("toolResults.status.returned"):S("toolResults.status.generated"));let n='
';return n+=`
${Y(S("toolResults.labels.conversationId"))}${Y((s==null?void 0:s.conversation_id)||(e==null?void 0:e.conversation_id)||"")}
`,n+=`
${Y(S("toolResults.labels.status"))}${t}
`,n+=`
${Y(S("toolResults.labels.mode"))}${Y((s==null?void 0:s.mode)||(e==null?void 0:e.mode)||"")}
`,s!=null&&s.title&&(n+=`
${Y(S("toolResults.labels.title"))}${Y(s.title)}
`),s!=null&&s.path&&(n+=`
${Y(S("toolResults.labels.reviewFile"))}${Y(s.path)}
`),(s==null?void 0:s.char_count)!==void 0&&(n+=`
${Y(S("toolResults.labels.charCount"))}${Y(String(s.char_count))}
`),n+="
",!(s!=null&&s.success)&&(s!=null&&s.error)&&(n+=`
${Y(s.error)}
`),s!=null&&s.too_long&&(s!=null&&s.path)&&(n+=`
${Y(S("toolResults.sentences.tooLongSaved"))}
`),s!=null&&s.content&&(n+='
',n+=``,n+=`
${Y(s.content)}
`,n+="
"),n}function e5(s){const e=ds(s,S("toolResults.status.archived"));let t='
';return t+=`
${Y(S("toolResults.labels.status"))}${e}
`,s!=null&&s.skill_name&&(t+=`
${Y(S("toolResults.labels.skill"))}${Y(s.skill_name)}
`),t+="
",!(s!=null&&s.success)&&(s!=null&&s.error)&&(t+=`
${Y(s.error)}
`),s!=null&&s.sync_warning&&(t+=`
${Y(s.sync_warning)}
`),t}function t5(s,e){if(!(s!=null&&s.success)){const r=(s==null?void 0:s.error)??S("toolResults.sentences.queryFailed");return`
⚠️ ${Y(String(r))}
`}const t=String((e==null?void 0:e.name)||(s==null?void 0:s.workflow_name)||"");if(t){let r='
';r+=`
${Y(S("toolResults.labels.workflow"))}${Y(t)}
`,r+="
";const o=String((s==null?void 0:s.message)||"");return o&&(r+='
',r+=`
${Y(o)}
`,r+="
"),r}const n=Array.isArray(s==null?void 0:s.workflows)?s.workflows:[];if(n.length===0)return`
${Y(S("toolResults.sentences.noWorkflows"))}
`;let i='
';return i+=`
${Y(S("toolResults.labels.workflowCount"))}${n.length}
`,i+="
",i+='
',n.forEach(r=>{const o=Y(String((r==null?void 0:r.name)||S("toolResults.values.unnamed"))),a=Y(String((r==null?void 0:r.description)||S("toolResults.values.noDescription"))),c=(r==null?void 0:r.source)==="builtin"?S("toolResults.values.builtin"):S("toolResults.values.user"),l=Number((r==null?void 0:r.nodeCount)||0);i+='
',i+=`
${o}
`,i+=`
${a}
`,i+=`
${Y(S("toolResults.labels.source"))}${c} | ${Y(S("toolResults.labels.nodeCount"))}${l}
`,i+="
"}),i+="
",i}function s5(s,e){const t=ds(s,S("toolResults.status.archived"));let n='
';n+=`
${Y(S("toolResults.labels.status"))}${t}
`;const i=String((e==null?void 0:e.source_dir)||"");return i&&(n+=`
${Y(S("toolResults.labels.sourceDir"))}${Y(i)}
`),s!=null&&s.workflow_name&&(n+=`
${Y(S("toolResults.labels.workflow"))}${Y(String(s.workflow_name))}
`),s!=null&&s.success&&typeof(s==null?void 0:s.node_count)=="number"&&(n+=`
${Y(S("toolResults.labels.nodeCountTotal"))}${s.node_count}
`),s!=null&&s.success&&(s!=null&&s.overwritten)?n+=`
${Y(S("toolResults.labels.mode"))}${Y(S("toolResults.sentences.overwrittenVersion"))}
`:s!=null&&s.success&&(s!=null&&s.shadows_builtin)&&(n+=`
${Y(S("toolResults.labels.mode"))}${Y(S("toolResults.sentences.userCopyShadow"))}
`),n+="
",!(s!=null&&s.success)&&(s!=null&&s.error)&&(n+=`
${Y(String(s.error))}
`),s!=null&&s.success&&(s!=null&&s.summary)&&(n+='
',n+=Y(String(s.summary)),n+="
"),n}const n5={self_identify:"toolResults.personalization.fieldLabels.selfIdentify",user_name:"toolResults.personalization.fieldLabels.userName",profession:"toolResults.personalization.fieldLabels.profession",tone:"toolResults.personalization.fieldLabels.tone",considerations:"toolResults.personalization.fieldLabels.considerations",theme:"toolResults.personalization.fieldLabels.theme",communication_style:"toolResults.personalization.fieldLabels.communicationStyle",conversation_continuity:"toolResults.personalization.fieldLabels.conversationContinuity",enabled:"toolResults.personalization.fieldLabels.enabled"};function i5(s){const e=n5[s];return e?S(e):s}function r5(s,e){return e==null||e===""?S("common.unset"):s==="enabled"?e?S("toolResults.personalization.values.enabled"):S("toolResults.personalization.values.disabled"):s==="considerations"?typeof e!="string"||e.trim()===""?S("common.unset"):e.trim():s==="communication_style"?{default:S("toolResults.personalization.values.styleDefault"),human_like:S("toolResults.personalization.values.styleHumanLike"),auto:S("toolResults.personalization.values.styleAuto")}[String(e)]||String(e):s==="conversation_continuity"&&{low:S("toolResults.personalization.values.independenceLow"),medium:S("toolResults.personalization.values.independenceMedium"),high:S("toolResults.personalization.values.independenceHigh")}[String(e)]||String(e)}function o5(s,e){const t=e.question||s.question||"",n=e.context||s.context||"",i=ds(s,S("toolResults.status.answered")),r=s.status==="answered"?String(s.answer_text||s.message||"").trim():"";let o='
';o+=`
${Y(S("toolResults.labels.status"))}${Y(i)}
`,t&&(o+=`
${Y(S("toolResults.labels.question"))}${Y(String(t))}
`),n&&(o+=`
${Y(S("toolResults.labels.context"))}${Y(String(n))}
`),o+="
";const a=Array.isArray(e.options)?e.options:[];return a.length>0&&(o+='
',o+='
',o+=`
${Y(S("toolResults.labels.providedOptions"))}
`,a.forEach((c,l)=>{const u=String((c==null?void 0:c.label)||(c==null?void 0:c.id)||S("toolResults.values.optionLabel",{n:l+1})),d=String((c==null?void 0:c.description)||"").trim();o+=`
${l+1}. ${Y(u)}${d?` — ${Y(d)}`:""}
`}),o+="
"),r&&(o+='
',o+='
',r.split(` `).map(c=>c.trim()).filter(Boolean).forEach(c=>{const l=c.indexOf(":");if(l>0){const u=c.slice(0,l+1),d=c.slice(l+1);o+=`
${Y(u)}${Y(d)}
`}else o+=`
${Y(S("toolResults.labels.userAnswer"))}${Y(c)}
`}),o+="
"),o}function a5(s,e){const t=String(e.action||s.action||"read"),n=ds(s,t==="update"?S("toolResults.status.updated"):S("toolResults.status.read")),i=String(s.updated_field||e.field||""),r=s.updated_value??e.value;let o='
';return o+=`
${Y(S("toolResults.labels.operation"))}${Y(t==="update"?S("toolResults.personalization.actionUpdate"):S("toolResults.personalization.actionRead"))}
`,o+=`
${Y(S("toolResults.labels.status"))}${n}
`,s!=null&&s.success?(t==="update"&&i&&(o+=`
${Y(S("toolResults.labels.updatedField"))}${Y(i5(i))}
`,o+=`
${Y(S("toolResults.labels.updatedValue"))}${Y(r5(i,r))}
`),o+="
",o):(s!=null&&s.error&&(o+=`
${Y(S("toolResults.labels.error"))}${Y(String(s.error))}
`),Array.isArray(s==null?void 0:s.validation_errors)&&s.validation_errors.length>0&&(o+=`
${Y(S("toolResults.labels.validation"))}${Y(s.validation_errors.join(";"))}
`),o+="",o)}function l5(s,e){const t=ds(s,S("toolResults.status.created")),n=s.todo_list||{},i=n.title||e.title||"",r=n.tasks||e.tasks||[];let o='
';return o+=`
${Y(S("toolResults.labels.status"))}${t}
`,o+=`
${Y(S("toolResults.labels.title"))}${Y(i)}
`,o+="
",r.length>0&&(o+='
',o+='
',r.forEach(a=>{const c=typeof a=="string"?a:a.text||a.title||a.content||"";o+=`
${Y(c)}
`}),o+="
",o+="
"),o}function c5(s){const e=ds(s,S("toolResults.status.updated")),t=s.todo_list||{},n=t.title||"",i=t.tasks||[];let r='
';return r+=`
${Y(S("toolResults.labels.status"))}${e}
`,r+=`
${Y(S("toolResults.labels.title"))}${Y(n)}
`,r+="
",i.length>0&&(r+='
',r+='
',i.forEach(o=>{const a=typeof o=="string"?o:o.text||o.title||o.content||"",c=typeof o=="object"&&(o.status==="done"||o.completed||o.done||o.checked);r+=`
${Y(a)}
`}),r+="
",r+="
"),r}function u5(s,e){const t=ds(s,S("toolResults.status.triggered")),n=s.type||e.type||"",i=s.content||s.message||"";let r='
';return r+=`
${Y(S("toolResults.labels.status"))}${t}
`,r+=`
${Y(S("toolResults.labels.type"))}${Y(n)}
`,r+="
",i&&(r+='
',r+=`
${Y(i)}
`,r+="
"),r}function d5(s,e){const t=ds(s,S("toolResults.status.created"),S("toolResults.status.createFailed")),n=s.agent_id??e.agent_id??"",i=s.display_name??"",r=s.task_id??"",o=s.deliverables_dir??"",a=e.task??"",c=s.message??s.summary??"",l=s.stats||{},u=s.runtime_seconds??s.elapsed_seconds??l.runtime_seconds??0,d=l.api_calls??l.turn_count??0,h=(l.files_read||0)+(l.write_files||0)+(l.edit_files||0)+(l.searches||0)+(l.web_pages||0)+(l.commands||0),p=u>0||d>0||h>0;let g='
';if(g+=`
${Y(S("toolResults.labels.status"))}${t}
`,i?g+=`
${Y(S("toolResults.labels.subAgent"))}${Y(String(i))}
`:n!==""&&(g+=`
${Y(S("toolResults.labels.subAgentId"))}${Y(String(n))}
`),r!==""&&!i&&(g+=`
${Y(S("toolResults.labels.taskId"))}${Y(String(r))}
`),o!==""&&!i&&(g+=`
${Y(S("toolResults.labels.deliverablesDir"))}${Y(String(o))}
`),a){const v=String(a).slice(0,200),m=String(a).length>200?"…":"";g+=`
${Y(S("toolResults.labels.task"))}${Y(v+m)}
`}return g+="
",(c||p)&&(g+='
',p&&(g+=``,u>0&&(g+=`
${Y(S("toolResults.labels.workTime"))}${x3(u)}
`),d>0&&(g+=`
${Y(S("toolResults.counts.apiCalls",{n:d}))}
`),h>0&&(g+=`
${Y(S("toolResults.counts.toolCalls",{n:h}))}
`)),c&&(p&&(g+=``),g+=`
${Y(String(c))}
`),g+="
"),g}function h5(s,e){const t=ds(s,S("toolResults.status.closed"),S("toolResults.status.closeFailed")),n=s.display_name??e.display_name??"",i=s.agent_id??e.agent_id??"",r=s.task_id??"",o=s.message??s.system_message??"";let a='
';return a+=`
${Y(S("toolResults.labels.status"))}${t}
`,n?a+=`
${Y(S("toolResults.labels.subAgent"))}${Y(String(n))}
`:i!==""&&(a+=`
${Y(S("toolResults.labels.subAgentId"))}${Y(String(i))}
`),r!==""&&!n&&(a+=`
${Y(S("toolResults.labels.taskId"))}${Y(String(r))}
`),a+="
",o&&(a+='
',a+=`
${Y(String(o))}
`,a+="
"),a}function f5(s){if(!s.success){const n=s.error??S("toolResults.sentences.queryFailed");return`
⚠️ ${Y(String(n))}
`}const e=Array.isArray(s.results)?s.results:[];if(e.length===0)return`
${Y(S("toolResults.sentences.noSubAgentStatus"))}
`;let t='
';return e.forEach(n=>{var d,h;const i=n.agent_id??"",r=n.found!==!1,o=String(n.status||""),a=n.task_id??"",c=n.summary??((d=n.final_result)==null?void 0:d.message)??((h=n.final_result)==null?void 0:h.summary)??"";t+='
';const l=n.display_name||"",u=l||S("toolResults.sentences.subAgentResultName",{agentId:String(i)});t+=`
${Y(String(u))}
`,r?(t+='
',o==="completed"?t+=`
${Y(S("toolResults.labels.status"))}${Y(S("toolResults.status.done"))}
`:o==="terminated"?t+=`
${Y(S("toolResults.labels.status"))}${Y(S("toolResults.status.terminated"))}
`:o==="running"?t+=`
${Y(S("toolResults.labels.status"))}${Y(S("common.running"))}
`:o==="pending"?t+=`
${Y(S("toolResults.labels.status"))}${Y(S("toolResults.status.waiting"))}
`:t+=`
${Y(S("toolResults.labels.status"))}${Y(o||S("toolResults.values.unknown"))}
`,a!==""&&!l&&(t+=`
${Y(S("toolResults.labels.taskId"))}${Y(String(a))}
`),t+="
",c&&(t+='
',t+=`
${Y(String(c))}
`,t+="
")):(t+='
',t+=`
${Y(S("toolResults.labels.status"))}${Y(S("toolResults.status.notFound"))}
`,t+="
"),t+="
"}),t+="
",t}function p5(s,e){const t=ds(s,S("toolResults.status.sent"),S("toolResults.status.sendFailed")),n=e.display_name??s.display_name??"",i=e.agent_id??s.agent_id??"";let r='
';return r+=`
${Y(S("toolResults.labels.status"))}${t}
`,n?r+=`
${Y(S("toolResults.labels.subAgent"))}${Y(String(n))}
`:i!==""&&(r+=`
${Y(S("toolResults.labels.subAgentId"))}${Y(String(i))}
`),!(s!=null&&s.success)&&(s!=null&&s.error)&&(r+=`
${Y(S("toolResults.labels.error"))}${Y(String(s.error))}
`),r+="
",r}function m5(s,e){const t=ds(s,S("toolResults.status.replied"),S("toolResults.status.replyFailed")),n=e.question_id??s.question_id??"",i=e.answer??"";let r='
';if(r+=`
${Y(S("toolResults.labels.status"))}${t}
`,n&&(r+=`
${Y(S("toolResults.labels.questionId"))}${Y(String(n))}
`),!(s!=null&&s.success)&&(s!=null&&s.error)&&(r+=`
${Y(S("toolResults.labels.error"))}${Y(String(s.error))}
`),r+="
",i&&typeof i=="string"){r+='
',r+=``;const o=String(i).slice(0,500),a=String(i).length>500?"…":"";r+=`
${Y(o+a)}
`,r+="
"}return r}function g5(s,e){const t=!!(s!=null&&s.overwritten),n=s!=null&&s.success?t?S("toolResults.status.overwrittenUpdated"):S("toolResults.status.created"):S("toolResults.status.createFailed"),i=e.role_id??s.role_id??"",r=e.name??s.name??i;let o='
';return o+=`
${Y(S("toolResults.labels.status"))}${n}
`,i!==""&&(o+=`
${Y(S("toolResults.labels.roleId"))}${Y(String(i))}
`),r&&r!==i&&(o+=`
${Y(S("toolResults.labels.roleName"))}${Y(String(r))}
`),!(s!=null&&s.success)&&(s!=null&&s.error)&&(o+=`
${Y(S("toolResults.labels.error"))}${Y(String(s.error))}
`),o+="
",o}function v5(s){if(!(s!=null&&s.success)){const n=(s==null?void 0:s.error)??S("toolResults.sentences.queryFailed");return`
⚠️ ${Y(String(n))}
`}const e=Array.isArray(s.roles)?s.roles:[];if(e.length===0)return`
${Y(S("toolResults.sentences.noRoles"))}
`;let t='
';return t+=`
${Y(S("toolResults.labels.roleCount"))}${e.length}
`,t+="
",t+='
',e.forEach(n=>{const i=n.role_id||S("toolResults.values.unknown"),r=n.name||i,o=n.description||"",a=n.thinking_mode||"fast",c=n.is_custom?S("toolResults.values.yes"):S("toolResults.values.no");t+='
',t+=`
${Y(i)} — ${Y(r)}
`,o&&(t+=`
${Y(o)}
`),t+=`
${Y(S("toolResults.labels.thinkingMode"))}${Y(a)} | ${Y(S("toolResults.labels.custom"))}${Y(c)}
`,t+="
"}),t+="
",t}function y5(s){if(!(s!=null&&s.success)){const n=(s==null?void 0:s.error)??S("toolResults.sentences.queryFailed");return`
⚠️ ${Y(String(n))}
`}const e=Array.isArray(s.agents)?s.agents:[];if(e.length===0)return`
${Y(S("toolResults.sentences.noActiveSubAgents"))}
`;let t='
';return t+=`
${Y(S("toolResults.labels.activeCount"))}${e.length}
`,t+="
",t+='
',e.forEach(n=>{const i=n.agent_id??"?",r=n.display_name||`Agent_${i}`,o=n.status||"unknown",a=n.summary||"",c=n.last_output||"";if(t+='
',t+=`
${Y(r)} [${Y(o)}]
`,t+='
',a&&(t+=`
${Y(S("toolResults.labels.task"))}${Y(String(a))}
`),c){const l=String(c).slice(0,120),u=String(c).length>120?"…":"";t+=`
${Y(S("toolResults.labels.lastOutput"))}${Y(l+u)}
`}t+="
",t+="
"}),t+="
",t}const b5=["data-block-id"],_5={class:"status-icon"},w5={class:"status-text"},S5={class:"tool-desc"},k5={class:"content-inner"},C5=["innerHTML"],T5={key:0,class:"progress-indicator"},cx=ct({name:"ToolAction",__name:"ToolAction",props:{action:{},expanded:{type:Boolean},blockId:{},iconStyle:{type:Function},getToolAnimationClass:{type:Function},getToolIcon:{type:Function},getToolStatusText:{type:Function},getToolDescription:{type:Function},formatSearchTopic:{type:Function},formatSearchTime:{type:Function},formatSearchDomains:{type:Function},streamingMessage:{type:Boolean},registerCollapseContent:{type:Function},collapseKey:{}},emits:["toggle"],setup(s){const e=s;function t(){return RE(e.action,e.formatSearchTopic,e.formatSearchTime,e.formatSearchDomains)}return(n,i)=>(F(),U("div",{class:Ce(["collapsible-block tool-block",{expanded:s.expanded,processing:s.action.tool.status==="preparing"||s.action.tool.status==="running",completed:s.action.tool.status==="completed"}]),"data-block-id":s.blockId||s.collapseKey||s.action.tool.id||s.action.id||"tool"},[M("div",{class:"collapsible-header",onClick:i[0]||(i[0]=r=>n.$emit("toggle"))},[i[1]||(i[1]=M("div",{class:"arrow"},null,-1)),M("div",_5,[M("span",{class:Ce(["tool-icon icon icon-md",s.getToolAnimationClass(s.action.tool)]),style:qe(s.iconStyle(s.getToolIcon(s.action.tool))),"aria-hidden":"true"},null,6)]),M("span",w5,Q(s.getToolStatusText(s.action.tool)),1),M("span",S5,Q(s.getToolDescription(s.action.tool)),1)]),M("div",{class:"collapsible-content",ref:r=>s.registerCollapseContent&&s.registerCollapseContent(s.collapseKey||s.action.tool.id||s.action.id||"tool",r)},[M("div",k5,[M("div",{innerHTML:t()},null,8,C5)])],512),s.action.tool.status==="preparing"||s.action.tool.status==="running"?(F(),U("div",T5)):me("",!0)],10,b5))}}),A5="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='currentColor'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3e%3cpath%20d='M15%2012H3m14%206H3M21%206H3'%20/%3e%3c/svg%3e",E5=["alt"],M5={class:"more-copy"},x5={class:"more-title"},R5={class:"more-desc"},I5=["data-block-id"],P5=["onClick"],L5={class:"status-icon"},O5={class:"status-text"},D5=["onScroll"],N5=["data-block-id"],$5=["onClick"],B5={class:"status-icon"},F5={class:"status-text"},H5={class:"tool-desc"},U5={class:"content-inner"},W5=["innerHTML"],z5={key:0,class:"progress-indicator"},uC=6,j5=600,V5=36,G5=ct({name:"StackedBlocks",__name:"StackedBlocks",props:{actions:{},expandedBlocks:{},conversationRunning:{type:Boolean},isLatestMessage:{type:Boolean},iconStyle:{type:Function},toggleBlock:{type:Function},registerThinkingRef:{type:Function},handleThinkingScroll:{type:Function},getToolAnimationClass:{type:Function},getToolIcon:{type:Function},getToolStatusText:{type:Function},getToolDescription:{type:Function},formatSearchTopic:{type:Function},formatSearchTime:{type:Function},formatSearchDomains:{type:Function}},emits:["more-toggle"],setup(s,{emit:e}){const t=s,n=e;let i=0;const r=`stacked-${++i}`,o=Js(),a=be(()=>o.form.stacked_hide_borders),c=J=>RE(J,t.formatSearchTopic,t.formatSearchTime,t.formatSearchDomains),l=ge(null),u=ge(null),d=ge(null),h=ge(!1),p=ge(0),g=ge(0),v=ge(0),m=ge(0),y=ge(!1),_=ge({}),b=new Map,k=be(()=>(t.actions||[]).filter(J=>J&&(J.type==="thinking"||J.type==="tool"))),w=be(()=>Math.max(0,k.value.length-uC)),T=be(()=>w.value>0||h.value),A=be(()=>k.value.length===1),C=be(()=>!!t.conversationRunning&&!!t.isLatestMessage),E=be(()=>k.value.length),x=be(()=>(lt.value,h.value?S("chat.allExpanded"):S("chat.more"))),D=be(()=>(lt.value,h.value?S("chat.stepsTotal",{n:E.value}):S("chat.stepsHidden",{n:w.value}))),N=(J,ne)=>(J==null?void 0:J.blockId)||(J==null?void 0:J.id)||`stacked-${ne}`,O=(J,ne)=>{var ce;return(ce=t.expandedBlocks)==null?void 0:ce.has(N(J,ne))},G=J=>{var ne;return(ne=t.expandedBlocks)==null?void 0:ne.has(J)},Z=J=>{const ne=Math.max(0,_.value[J]||0);return{maxHeight:G(J)?`${ne}px`:"0px"}},q=J=>{var ce;const ne=(ce=J==null?void 0:J.tool)==null?void 0:ce.status;return ne==="preparing"||ne==="running"},V=J=>{var ne;return((ne=J==null?void 0:J.tool)==null?void 0:ne.status)==="completed"},I=()=>{h.value=!h.value,le();const J=d.value;J instanceof HTMLElement&&n("more-toggle",{element:J,expanded:h.value,stackKey:r})},$=J=>{typeof t.toggleBlock=="function"&&(t.toggleBlock(J),le())},L=(J,ne)=>{ne instanceof HTMLElement?b.set(J,ne):b.delete(J),typeof t.registerThinkingRef=="function"&&t.registerThinkingRef(J,ne)},K=(J,ne)=>{typeof t.handleThinkingScroll=="function"&&t.handleThinkingScroll(J,ne)},se=J=>J?J instanceof HTMLElement?J:J.$el&&J.$el instanceof HTMLElement?J.$el:null:null,oe=()=>{const J=se(d.value);if(!J)return 56;const ne=J.querySelector(".more-title");return Math.max(48,Math.ceil((ne==null?void 0:ne.getBoundingClientRect().height)||56))},ve=()=>{const J=se(u.value);if(!se(l.value)||!J)return;const ce=Array.from(J.children),_e=k.value,Pe=[],it={};ce.forEach((he,ye)=>{const ke=_e[ye],Le=N(ke,ye),st=he.querySelector(".collapsible-header"),gt=he.querySelector(".content-inner"),Wt=st?Math.ceil(st.offsetHeight):V5,jt=gt?Math.min(Math.ceil(gt.offsetHeight),j5):0;it[Le]=jt;const ht=G(Le),Qt=a.value||ye===ce.length-1?0:1;Pe.push(Wt+(ht?jt:0)+Qt)}),_.value=it;const at=he=>he.length?he.reduce((ye,ke)=>ye+ke,0):0,rt=at(Pe),Oe=at(Pe.slice(0,Math.max(0,Pe.length-uC))),xe=at(Pe.slice(-uC));g.value=T.value?oe():0;const pe=g.value+(h.value||!T.value?rt:xe);p.value=pe+2,v.value=h.value||!T.value?0:-Oe,m.value=Math.max(0,pe-g.value)},le=()=>{ft(()=>{requestAnimationFrame(()=>{ve(),y.value||requestAnimationFrame(()=>{y.value=!0})})})};let ue=null,P=null;const X=()=>{ue&&(ue.disconnect(),b.forEach(J=>ue.observe(J)))};return dn(()=>{le(),typeof ResizeObserver<"u"&&(ue=new ResizeObserver(()=>{P&&cancelAnimationFrame(P),P=requestAnimationFrame(()=>ve())}),ft(()=>X()))}),Rn(()=>{ue&&(ue.disconnect(),ue=null),P&&(cancelAnimationFrame(P),P=null)}),Ke(()=>{var Pe,it,at,rt;const J=k.value,ne=((Pe=J[0])==null?void 0:Pe.blockId)||((it=J[0])==null?void 0:it.id)||"",ce=((at=J[J.length-1])==null?void 0:at.blockId)||((rt=J[J.length-1])==null?void 0:rt.id)||"",_e=J.map(Oe=>{var xe,pe,he;return(Oe==null?void 0:Oe.type)==="tool"?`T:${((xe=Oe==null?void 0:Oe.tool)==null?void 0:xe.status)||"?"}${(pe=Oe==null?void 0:Oe.tool)!=null&&pe.result?"R":"-"}`:(Oe==null?void 0:Oe.type)==="thinking"?`H:${Oe!=null&&Oe.streaming?"S":"-"}${Math.floor((((he=Oe==null?void 0:Oe.content)==null?void 0:he.length)||0)/48)}`:"?"}).join(",");return`${J.length}|${ne}|${ce}|${T.value}|${_e}`},()=>{ft(()=>{X(),le()})}),Ke(()=>t.expandedBlocks?t.expandedBlocks.size:0,()=>le()),Ke(a,()=>le()),(J,ne)=>(F(),U("div",{class:Ce(["stacked-shell",{"stacked-shell--single":A.value,"stacked-shell--not-ready":!y.value,"stacked-shell--no-borders":a.value}]),ref_key:"shell",ref:l,style:qe({height:`${p.value}px`,paddingTop:T.value?`${g.value}px`:"0px"})},[M("div",{class:Ce(["stacked-more-block",{visible:T.value}]),ref_key:"moreBlock",ref:d,style:qe({height:`${T.value?g.value:0}px`}),onClick:I},[M("img",{class:"more-icon",src:A5,alt:J.$t("chat.expand")},null,8,E5),M("div",M5,[M("span",x5,Q(x.value),1),M("span",R5,Q(D.value),1)])],6),M("div",{class:"stacked-viewport",style:qe({height:`${m.value}px`})},[We(ay,{name:"stacked",tag:"div",class:"stacked-inner",ref_key:"inner",ref:u,style:qe({transform:`translateY(${v.value}px)`}),appear:C.value,css:C.value},{default:Gt(()=>[(F(!0),U(Ie,null,Ze(k.value,(ce,_e)=>(F(),U("div",{key:N(ce,_e),class:"stacked-item"},[ce.type==="thinking"?(F(),U("div",{key:0,class:Ce(["collapsible-block thinking-block stacked-block",{expanded:O(ce,_e),processing:ce.streaming}]),"data-block-id":N(ce,_e)},[M("div",{class:"collapsible-header",onClick:Pe=>$(N(ce,_e))},[ne[0]||(ne[0]=M("div",{class:"arrow"},null,-1)),M("div",L5,[M("span",{class:Ce(["thinking-icon",{"thinking-animation":ce.streaming}])},[M("span",{class:"icon icon-sm",style:qe(s.iconStyle("brain")),"aria-hidden":"true"},null,4)],2)]),M("span",O5,Q(ce.streaming?J.$t("chat.thinkingRunning"):J.$t("chat.thinking")),1)],8,P5),M("div",{class:"collapsible-content",style:qe(Z(N(ce,_e)))},[M("div",{class:"content-inner thinking-content",ref_for:!0,ref:Pe=>L(N(ce,_e),Pe),onScroll:Pe=>K(N(ce,_e),Pe),style:{"max-height":"240px","overflow-y":"auto"}},Q(ce.content),41,D5)],4)],10,I5)):ce.type==="tool"?(F(),U("div",{key:1,class:Ce(["collapsible-block tool-block stacked-block",{expanded:O(ce,_e),processing:q(ce),completed:V(ce)}]),"data-block-id":N(ce,_e)},[M("div",{class:"collapsible-header",onClick:Pe=>$(N(ce,_e))},[ne[1]||(ne[1]=M("div",{class:"arrow"},null,-1)),M("div",B5,[M("span",{class:Ce(["tool-icon icon icon-md",s.getToolAnimationClass(ce.tool)]),style:qe(s.iconStyle(s.getToolIcon(ce.tool))),"aria-hidden":"true"},null,6)]),M("span",F5,Q(s.getToolStatusText(ce.tool)),1),M("span",H5,Q(s.getToolDescription(ce.tool)),1)],8,$5),M("div",{class:"collapsible-content",style:qe(Z(N(ce,_e)))},[M("div",U5,[M("div",{innerHTML:c(ce)},null,8,W5)])],4),q(ce)?(F(),U("div",z5)):me("",!0)],10,N5)):me("",!0)]))),128))]),_:1},8,["style","appear","css"])],4)],6))}}),K5=qt(G5,[["__scopeId","data-v-3241f026"]]),q5={class:"square-grid-loader"},Q5=ct({__name:"SquareGridLoader",setup(s){return(e,t)=>(F(),U("div",q5,[...t[0]||(t[0]=[Mi('
',9)])]))}}),X5=qt(Q5,[["__scopeId","data-v-afc6b5c3"]]),Y5={class:"rotating-squares-loader"},J5=ct({__name:"RotatingSquaresLoader",setup(s){return(e,t)=>(F(),U("div",Y5,[...t[0]||(t[0]=[Mi('
',7)])]))}}),Z5=qt(J5,[["__scopeId","data-v-db47acef"]]),e4={class:"dual-chase-loader"},t4=ct({__name:"DualChaseLoader",setup(s){return(e,t)=>(F(),U("div",e4))}}),s4=qt(t4,[["__scopeId","data-v-337256ff"]]),n4={class:"bouncing-squares-loader"},i4=ct({__name:"BouncingSquaresLoader",setup(s){return(e,t)=>(F(),U("div",n4,[...t[0]||(t[0]=[M("div",{class:"square"},null,-1),M("div",{class:"square"},null,-1),M("div",{class:"square"},null,-1)])]))}}),r4=qt(i4,[["__scopeId","data-v-502bc545"]]),o4={class:"five-squares-loader"},a4=ct({__name:"FiveSquaresLoader",setup(s){return(e,t)=>(F(),U("div",o4,[...t[0]||(t[0]=[Mi('
',5)])]))}}),l4=qt(a4,[["__scopeId","data-v-4ffc5a36"]]),c4={class:"nine-grid-loader"},u4=ct({__name:"NineGridLoader",setup(s){return(e,t)=>(F(),U("div",c4,[...t[0]||(t[0]=[Mi('
',9)])]))}}),d4=qt(u4,[["__scopeId","data-v-62be6033"]]),h4={class:"ripple-loader"},f4=ct({__name:"RippleLoader",setup(s){return(e,t)=>(F(),U("div",h4,[...t[0]||(t[0]=[Mi('
',9)])]))}}),p4=qt(f4,[["__scopeId","data-v-e8d9f3ef"]]),m4={class:"newton-loader"},g4=ct({__name:"NewtonCradleSquaresLoader",setup(s){return(e,t)=>(F(),U("div",m4,[...t[0]||(t[0]=[M("div",{class:"dot"},null,-1),M("div",{class:"dot"},null,-1),M("div",{class:"dot"},null,-1),M("div",{class:"dot"},null,-1)])]))}}),v4=qt(g4,[["__scopeId","data-v-4316d9b8"]]),y4={class:"dot-spinner-loader"},b4=ct({__name:"DotSpinnerSquaresLoader",setup(s){return(e,t)=>(F(),U("div",y4,[...t[0]||(t[0]=[Mi('
',8)])]))}}),_4=qt(b4,[["__scopeId","data-v-89be96b5"]]),w4={class:"orbit-loader"},S4=ct({__name:"OrbitBlurSquaresLoader",setup(s){return(e,t)=>(F(),U("div",w4,[...t[0]||(t[0]=[Mi('
',5)])]))}}),k4=qt(S4,[["__scopeId","data-v-19a87dd3"]]),C4={class:"shadow-rolling-loader"},T4=ct({__name:"ShadowRollingSquaresLoader",setup(s){return(e,t)=>(F(),U("div",C4))}}),A4=qt(T4,[["__scopeId","data-v-0934be8f"]]),E4={class:"jumping-seq-loader"},M4=ct({__name:"JumpingSequenceSquaresLoader",setup(s){return(e,t)=>(F(),U("div",E4,[...t[0]||(t[0]=[Mi('
',5)])]))}}),x4=qt(M4,[["__scopeId","data-v-bb2c052b"]]),R4={class:"chaotic-orbit-loader"},I4=ct({__name:"ChaoticOrbitSquaresLoader",setup(s){return(e,t)=>(F(),U("div",R4))}}),P4=qt(I4,[["__scopeId","data-v-c29a198e"]]),L4={class:"leap-frog-loader"},O4=ct({__name:"LeapFrogSquaresLoader",setup(s){return(e,t)=>(F(),U("div",L4,[...t[0]||(t[0]=[M("div",{class:"dot"},null,-1),M("div",{class:"dot"},null,-1),M("div",{class:"dot"},null,-1)])]))}}),D4=qt(O4,[["__scopeId","data-v-2e407c57"]]),N4={class:"wave-matrix-loader"},$4=ct({__name:"WaveMatrixSquaresLoader",setup(s){return(e,t)=>(F(),U("div",N4,[...t[0]||(t[0]=[M("div",{class:"sq"},null,-1),M("div",{class:"sq"},null,-1),M("div",{class:"sq"},null,-1),M("div",{class:"sq"},null,-1)])]))}}),B4=qt($4,[["__scopeId","data-v-c583d74c"]]),F4={class:"follow-track-loader"},H4=ct({__name:"FollowTrackSquaresLoader",setup(s){return(e,t)=>(F(),U("div",F4,[...t[0]||(t[0]=[Mi('
',5)])]))}}),U4=qt(H4,[["__scopeId","data-v-091a0000"]]),W4={class:"four-corner-loader"},z4=ct({__name:"FourCornerCycleSquaresLoader",setup(s){return(e,t)=>(F(),U("div",W4,[...t[0]||(t[0]=[M("div",{class:"sq"},null,-1),M("div",{class:"sq"},null,-1),M("div",{class:"sq"},null,-1),M("div",{class:"sq"},null,-1)])]))}}),j4=qt(z4,[["__scopeId","data-v-3a59d23d"]]),ux=[X5,Z5,s4,r4,l4,d4,p4,v4,_4,k4,A4,x4,P4,D4,B4,U4,j4],V4=4,Zf=[],G4=s=>{const e=Math.floor(Math.random()*s.length);return s[e]};function dC(){const s=ux.length;if(s===0)throw new Error(S("chatActions.loaderPoolEmpty"));const e=Math.max(0,Math.min(V4,s-1));let t=Array.from({length:s},(r,o)=>o);if(e>0&&Zf.length>0){const r=new Set(Zf.slice(-e)),o=t.filter(a=>!r.has(a));o.length>0&&(t=o)}const n=G4(t);Zf.push(n);const i=Math.max(s*2,e+1);return Zf.length>i&&Zf.splice(0,Zf.length-i),ux[n]}const K4=["data-streaming"],q4={class:"code-block-header"},Q4={class:"code-language"},X4=["title","aria-label"],Y4=ct({name:"CodeBlock",__name:"CodeBlock",props:{content:{},language:{},isStreaming:{type:Boolean}},setup(s){const e=s,t=ge(null),n=ge(!1),i=be(()=>e.language||"text"),r=be(()=>!e.language||e.language==="text"?"language-plain":`language-${e.language}`);function o(){ft(()=>{if(!(!t.value||typeof PS>"u"))try{PS.highlightElement(t.value)}catch(c){console.warn("代码高亮失败:",c)}})}Ke(()=>e.content,o,{immediate:!0}),dn(o);async function a(c){if(c.stopPropagation(),!(n.value||!e.content))try{await navigator.clipboard.writeText(e.content),n.value=!0,window.setTimeout(()=>{n.value=!1},5e3)}catch(l){console.warn("复制失败:",l)}}return(c,l)=>(F(),U("div",{class:"code-block-wrapper","data-streaming":s.isStreaming?"1":void 0,"data-md-code-block":"1"},[M("div",q4,[M("span",Q4,Q(i.value),1),M("button",{class:Ce(["copy-code-btn",{copied:n.value}]),title:c.$t("chat.copyCode"),"aria-label":c.$t("chat.copyCode"),onClick:a},null,10,X4)]),M("pre",null,[M("code",{ref_key:"codeEl",ref:t,class:Ce(r.value)},Q(s.content),3)])],8,K4))}});function J4(s){if(!s)return[];if(typeof document>"u")return[{key:"c0",html:s}];const e=document.createElement("template");e.innerHTML=s;const t=[];for(const n of Array.from(e.content.childNodes)){if(n.nodeType===Node.TEXT_NODE){const i=n.textContent||"";if(!i.trim())continue;t.push({key:`c${t.length}`,html:i.replace(/&/g,"&").replace(//g,">")});continue}n.nodeType===Node.ELEMENT_NODE&&t.push({key:`c${t.length}`,html:n.outerHTML})}return t}const Z4=2e3,F_=[{trusted:!0,build:s=>`https://www.google.com/s2/favicons?domain=${encodeURIComponent(s)}&sz=64`},{trusted:!0,minSize:2,build:s=>`https://favicon.yandex.net/favicon/${encodeURIComponent(s)}`},{trusted:!1,build:s=>`https://icon.horse/icon/${encodeURIComponent(s)}`}],dx=new Map;function hx(s){return s.replace(/&/g,"&").replace(//g,">").replace(/"/g,""")}function _L(s){const e=(s||"").replace(/^www\./,""),t=hx((e[0]||"?").toUpperCase());return`${t}`}function eH(s){const e=dx.get(s);if(e)return e;const t=new Promise(n=>{const i=F_.map(()=>({status:"pending"})),r=new Set;let o=!1;const a=()=>{if(o)return;o=!0,clearTimeout(c),r.forEach(d=>{d.onload=null,d.onerror=null,d.src=""}),r.clear();const l=F_.findIndex((d,h)=>d.trusted&&i[h].status==="ok"),u=F_.findIndex((d,h)=>!d.trusted&&i[h].status==="ok");l>=0&&u>=0?n(i[u].url):l>=0?n(i[l].url):n(null)},c=setTimeout(a,Z4);F_.forEach((l,u)=>{const d=l.build(s),h=new Image;r.add(h),h.onload=()=>{r.delete(h);const p=l.minSize??1;i[u]=h.naturalWidth>=p&&h.naturalHeight>=p?{status:"ok",url:d}:{status:"fail"},r.size||a()},h.onerror=()=>{r.delete(h),i[u]={status:"fail"},r.size||a()},h.src=d})});return dx.set(s,t),t}function FT(s){s.querySelectorAll(".chip-letter[data-favicon-domain]:not([data-favicon-racing])").forEach(t=>{const n=t.dataset.faviconDomain||"";n&&(t.dataset.faviconRacing="1",eH(n).then(i=>{if(!i||!t.isConnected)return;const r=document.createElement("img");r.className="chip-favicon",r.alt="",r.src=i,t.replaceWith(r)}))})}const ts=oy({visible:!1,pinned:!1,anchor:null,annotations:[]}),tH=250,sH=300;let Fv,rg;function wL(){clearTimeout(Fv),clearTimeout(rg),Fv=void 0,rg=void 0}function fx(s,e,t){Nl(),ts.anchor=s,ts.annotations=e,ts.pinned=t,ts.visible=!0,s.classList.add("is-open")}function Nl(){wL(),ts.anchor&&ts.anchor.classList.remove("is-open"),ts.visible=!1,ts.pinned=!1,ts.anchor=null,ts.annotations=[]}function SL(){clearTimeout(rg),rg=setTimeout(()=>{ts.pinned||Nl()},sH)}function px(){clearTimeout(rg)}function mx(){ts.pinned||SL()}function nH(s){const e=()=>s._citationAnnotations||[];s.addEventListener("mouseenter",()=>{clearTimeout(rg),!(ts.anchor===s&&ts.visible)&&(clearTimeout(Fv),Fv=setTimeout(()=>fx(s,e(),!1),tH))}),s.addEventListener("mouseleave",()=>{clearTimeout(Fv),ts.visible&&ts.anchor===s&&!ts.pinned&&SL()}),s.addEventListener("click",t=>{t.stopPropagation(),wL(),ts.anchor===s&&ts.visible&&ts.pinned?Nl():fx(s,e(),!0)})}function iH(s){const e=(s||"").trim();if(!e||/^src_/i.test(e))return null;const t=e.match(/^(.*?)#(?:L(\d+)(?:-L?(\d+))?|p(\d+))$/i);let n=(t?t[1]:e).trim();if(n.startsWith("./")&&(n=n.slice(2)),!n)return null;const i={id:s,type:"file_citation",file_path:n,file_name:n.split("/").pop()||n};return t&&(t[4]&&(i.page=parseInt(t[4],10)),t[2]&&(i.line_start=parseInt(t[2],10),t[3]&&(i.line_end=parseInt(t[3],10)))),i}function rH(s){var t,n;const e=new Map;for(const i of s||[])for(const r of(i==null?void 0:i.actions)||[]){const o=(n=(t=r==null?void 0:r.tool)==null?void 0:t.result)==null?void 0:n.citations;if(Array.isArray(o))for(const a of o)a&&typeof a.id=="string"&&!e.has(a.id)&&e.set(a.id,a)}return[...e.values()]}function oH(s){return(s||"").replace(/^www\./,"")}function aH(s){return s.type==="file_citation"?s.file_name||s.file_path||"":oH(s.domain)}const lH='';function cH(s){return s.type==="file_citation"?lH:_L(s.domain||"")}function uH(s,e,t={}){const n=s.querySelectorAll(".md-citation-chip");if(!n.length)return;const i=!!t.final,r=new Map((e||[]).map(o=>[o.id,o]));n.forEach(o=>{const a=(o.dataset.citationIds||"").split(",").map(d=>d.trim()).filter(Boolean);if(o.dataset.citeEnhanced==="1"&&o.dataset.citeLoaded==="1"){if(i){const d=a.map(h=>r.get(h)).filter(h=>!!h);d.length&&(o._citationAnnotations=d)}return}let c=a.map(d=>r.get(d)).filter(d=>!!d);if(!c.length&&!i){const d=a.map(h=>iH(h)).filter(h=>!!h);d.length&&(c=d)}if(!c.length){if(i){o.remove();return}o.dataset.citeEnhanced!=="1"&&(o.dataset.citeEnhanced="1",o.classList.add("is-pending"),o.innerHTML='');return}const l=c.slice(0,2).map(cH).join(""),u=c.length>1?`+${c.length-1}`:"";o.innerHTML=`${l}${dH(aH(c[0]))}`+u,o.classList.remove("is-pending"),o.classList.add(c[0].type==="file_citation"?"is-file":"is-url"),o.dataset.citeEnhanced="1",o.dataset.citeLoaded="1",o._citationAnnotations=c,nH(o)}),FT(s)}function dH(s){return s.replace(/&/g,"&").replace(//g,">").replace(/"/g,""")}const hH={key:0,class:"markdown-text-segment"},fH=["innerHTML"],pH=40,mH=ct({name:"MarkdownRenderer",__name:"MarkdownRenderer",props:{content:{},isStreaming:{type:Boolean},citations:{},citationsFinal:{type:Boolean},enableCitations:{type:Boolean}},setup(s){const e=s,t=ge(null),n=zP("mathRenderedCallback",()=>{}),i=be(()=>dF(e.content||"",e.isStreaming));function r(u){return fF(u,e.isStreaming,e.enableCitations)}const o=new Map;function a(u){const d=o.get(u.key);if(d&&d.content===u.content)return d.chunks;const h=J4(r(u.content));if(o.set(u.key,{content:u.content,chunks:h}),o.size>pH){const p=o.keys().next().value;p!==void 0&&o.delete(p)}return h}function c(){ft(()=>{t.value&&(hF(t.value),n())})}dn(c),PT(c),Ke(()=>e.content,c,{immediate:!0});function l(){e.enableCitations&&ft(()=>{t.value&&uH(t.value,e.citations,{final:e.citationsFinal})})}return dn(l),PT(l),Ke(()=>[e.citations,e.citationsFinal],l),(u,d)=>(F(),U("div",{ref_key:"containerRef",ref:t,class:"markdown-renderer"},[(F(!0),U(Ie,null,Ze(i.value,h=>(F(),U(Ie,{key:h.key},[h.type==="text"?(F(),U("div",hH,[(F(!0),U(Ie,null,Ze(a(h),p=>(F(),U("div",{key:p.key,class:"md-html-chunk",innerHTML:p.html},null,8,fH))),128))])):(F(),Ft(Y4,{key:1,content:h.content,language:h.language,"is-streaming":!h.closed},null,8,["content","language","is-streaming"]))],64))),128))],512))}}),zg=qt(mH,[["__scopeId","data-v-733b1a98"]]),gH={class:"minimal-blocks-container"},vH={key:0,class:"summary-group"},yH=["data-group-id","onClick"],bH={class:"summary-content-wrapper"},_H={class:"summary-preview"},wH={key:0,class:"summary-tool-reel-window"},SH={class:"summary-status-icon"},kH={key:0,class:"summary-icon-inner"},CH={key:1,class:"check-icon",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},TH={class:"step-timeline"},AH={class:"step-content"},EH={key:0,class:"step-body"},MH=["onScroll","innerHTML"],xH={key:1,class:"step-body"},RH={class:"step-header"},IH={key:0,class:"tool-intent"},PH={key:1,class:"tool-result"},LH=["innerHTML"],OH={key:2,class:"tool-result"},DH={class:"result-item"},NH={key:2,class:"summary-group sub-agent-system-group"},$H={class:"summary-line-text sub-agent-system-summary-line"},BH={class:"summary-content-wrapper"},FH={class:"summary-preview"},HH=20,hC=26,UH=1450,fC=520,gx=170,vx=2,WH=ct({__name:"MinimalBlocks",props:{actions:{},citations:{},citationsFinal:{type:Boolean},enableCitations:{type:Boolean},conversationRunning:{type:Boolean},isLatestMessage:{type:Boolean},iconStyle:{type:Function},getToolIcon:{type:Function},getToolStatusText:{type:Function},getToolDescription:{type:Function},formatSearchTopic:{type:Function},formatSearchTime:{type:Function},formatSearchDomains:{type:Function},registerThinkingRef:{type:Function},handleThinkingScroll:{type:Function}},emits:["group-toggle"],setup(s,{emit:e}){const t=Js(),n=be(()=>t.form.minimal_expand_height_limited),i=s,r=e,o=ge(new Set),a=new Map,c=new Map,l=new Map,u=new Map,d=oy({}),h=new Map,p=new Map,g=pe=>Array.from(pe||""),v=pe=>{const he=typeof pe=="string"?pe:"",ye=he.indexOf(` `);return ye>0?he.substring(0,ye):he},m=pe=>{lt.value;const he=pe.tool;if(!he)return"";const ye=t.form.tool_intent_enabled,ke=he.intent_rendered||he.intent_full||"";return ye&&ke?v(ke):he.status==="preparing"?S("toolResults.sentences.preparing",{name:he.name||S("common.tool")}):he.status==="running"?S("chat.callingTool",{name:he.name||S("common.tool")}):he.status==="completed"?he.display_name||he.name||S("chat.toolCompleted"):pe.streaming?S("chat.executingTool"):he.display_name||he.name||S("chat.runTool")},y=pe=>{var ye;if(pe.type!=="tool")return!1;if(pe.streaming)return!0;const he=String(((ye=pe.tool)==null?void 0:ye.status)||"").toLowerCase();return["hinted","preparing","running","pending","pending_approval","awaiting_approval","awaiting_user_answer"].includes(he)},_=pe=>{let he=-1;for(let ke=pe.length-1;ke>=0;ke--){if(pe[ke].type==="tool"){he=ke;break}if(pe[ke].type==="thinking")break}if(he<0)return[];let ye=he;for(;ye>0&&pe[ye-1].type==="tool";)ye--;return pe.slice(ye,he+1)},b=pe=>{const he=_(pe);return he.some(y)?he:[]},k=pe=>b(pe).map(m).filter(he=>he.trim().length>0),w=(pe,he)=>{var Le;const ye=(Le=d[he])!=null&&Le.completing?d[he].items:null;if(ye!=null&&ye.length)return ye;const ke=k(pe);return ke.length>0?[...ke,ke[0]]:[]},T=(pe,he)=>{var ye;return!!((ye=d[he])!=null&&ye.completing)||ve(pe,he)&&k(pe).length>1},A=(pe,he)=>{var ye;return ve(pe,he)||!!((ye=d[he])!=null&&ye.completing)},C=pe=>{var he;return((he=d[pe])==null?void 0:he.phase)||"idle"},E=pe=>{var he;return{transform:`translateY(${((he=d[pe])==null?void 0:he.offsetPx)||0}px)`}},x=pe=>{const he=h.get(pe);he&&(window.clearInterval(he),h.delete(pe)),(p.get(pe)||[]).forEach(ke=>window.clearTimeout(ke)),p.delete(pe)},D=(pe,he)=>{const ye=p.get(pe)||[];ye.push(he),p.set(pe,ye)},N=(pe,he)=>{const ye=d[pe];if(!ye||ye.completing||he<2)return;const ke=(ye.index+1)%he,st=-(ke===0?he:ke)*hC;ye.phase="rolling",ye.offsetPx=st-vx;const gt=window.setTimeout(()=>{if(ye.phase="settle",ye.offsetPx=st,ye.index=ke,ke===0){const Wt=window.setTimeout(()=>{ye.phase="idle",ye.offsetPx=0},gx);D(pe,Wt)}},fC);D(pe,gt)},O=(pe,he)=>{const ye=d[pe];if(!ye||ye.completing)return;const ke=ye.items.length>1?ye.items:_(he).map(m).filter(Wt=>Wt.trim().length>0);if(ke.length<2){x(pe),delete d[pe];return}x(pe),ye.items=ke,ye.signature=ke.join(""),ye.completing=!0;const Le=ke.length-1,st=-ye.index*hC,gt=-Le*hC;ye.phase="idle",ye.offsetPx=st,window.requestAnimationFrame(()=>{ye.phase="rolling",ye.offsetPx=gt-vx;const Wt=window.setTimeout(()=>{ye.phase="settle",ye.offsetPx=gt,ye.index=Le},fC);D(pe,Wt);const jt=window.setTimeout(()=>{x(pe),delete d[pe]},fC+gx+260);D(pe,jt)})},G=()=>{const pe=new Set;q.value.forEach(he=>{if(he.type!=="summary"||!he.actions||!T(he.actions,he.id))return;const ye=k(he.actions),ke=ye.join("");if(pe.add(he.id),!d[he.id]||d[he.id].signature!==ke?(x(he.id),d[he.id]={index:0,offsetPx:0,phase:"idle",signature:ke,items:ye}):d[he.id].items=ye,!h.has(he.id)){const Le=window.setInterval(()=>N(he.id,ye.length),UH);h.set(he.id,Le)}}),Object.keys(d).forEach(he=>{if(!pe.has(he)){const ye=q.value.find(ke=>ke.id===he);if((ye==null?void 0:ye.type)==="summary"&&ye.actions&&!d[he].completing){pe.add(he),O(he,ye.actions);return}d[he].completing||(x(he),delete d[he])}})},Z=pe=>{const he=q.value.find(jt=>jt.id===pe);if(!he||!he.actions)return dC();const ke=he.actions.find(jt=>jt.streaming)||he.actions[he.actions.length-1];if(!ke)return dC();const Le=he.actions.indexOf(ke);let st=-1;for(let jt=Le-1;jt>=0;jt--)if(he.actions[jt].type!==ke.type){st=jt;break}const gt=st>=0?`${he.actions[st].id}-${ke.type}`:`start-${ke.type}`,Wt=`${pe}-${gt}`;return u.has(Wt)||u.set(Wt,dC()),u.get(Wt)},q=be(()=>{const pe=[];let he=[],ye=0;if(i.actions.forEach((ke,Le)=>{if(ke.type==="thinking"||ke.type==="tool")he.push(ke);else if(ke.type==="text"||ke.type==="system"){if(he.length>0){const st=he[0].id||he[0].blockId||`summary-${ye}`;pe.push({type:"summary",id:`summary-${st}`,actions:he}),ye++,he=[]}if(ke.type==="text"){const st=typeof ke.content=="string"?ke.content:"";if(!st.trim())return;pe.push({type:"text",id:`text-${Le}`,content:st,streaming:ke.streaming})}else pe.push({type:"system",id:`system-${Le}`,content:ke.content})}}),he.length>0){const ke=he[0].id||he[0].blockId||`summary-${ye}`;pe.push({type:"summary",id:`summary-${ke}`,actions:he})}return pe}),V={read_file:"read",read_skill:"read",vlm_analyze:"read",view_image:"read",view_video:"read",run_command:"command",terminal_session:"command",terminal_input:"command",terminal_snapshot:"command",create_file:"edit",write_file:"edit",edit_file:"edit",delete_file:"edit",rename_file:"edit",create_folder:"edit",web_search:"search",extract_webpage:"webpage",save_webpage:"webpage",list_mcp_servers:"mcp",activate_workflow:"workflow_activate",report_workflow_stage:"workflow_advance",choose_workflow_branch:"workflow_advance",get_workflow_status:"workflow",deactivate_workflow:"workflow",list_workflows:"workflow",save_workflow:"workflow",todo_create:"todo_create",todo_update_task:"todo_update",update_memory:"memory_update",update_project_memory:"memory_update",recall_project_memory:"memory_read",search_project_memory:"memory_read",conversation_search:"conversation",conversation_review:"conversation",create_sub_agent:"sub_agent",close_sub_agent:"sub_agent_manage",terminate_sub_agent:"sub_agent_manage",get_sub_agent_status:"sub_agent_manage",sleep:"wait",ask_user:"ask",submit_plan:"plan",create_skill:"skill",manage_personalization:"settings",trigger_easter_egg:"easter_egg"},I={read:"chat.summaryRead",command:"chat.summaryCommand",edit:"chat.summaryEdit",search:"chat.summarySearch",webpage:"chat.summaryWebpage",mcp:"chat.summaryMcp",workflow_activate:"chat.summaryWorkflowActivate",workflow_advance:"chat.summaryWorkflowAdvance",workflow:"chat.summaryWorkflow",todo_create:"chat.summaryTodoCreate",todo_update:"chat.summaryTodoUpdate",memory_update:"chat.summaryMemoryUpdate",memory_read:"chat.summaryMemoryRead",conversation:"chat.summaryConversation",sub_agent:"chat.summarySubAgent",sub_agent_manage:"chat.summarySubAgentManage",wait:"chat.summaryWait",ask:"chat.summaryAsk",plan:"chat.summaryPlan",skill:"chat.summarySkill",settings:"chat.summarySettings",easter_egg:"chat.summaryEasterEgg",other:"chat.summaryOther"},$=["read","command","edit","search","webpage","mcp","workflow_activate","workflow_advance","workflow","todo_create","todo_update","memory_update","memory_read","conversation","sub_agent","sub_agent_manage","wait","ask","plan","skill","settings","easter_egg","other"],L=pe=>{var ye;const he=(ye=pe.tool)==null?void 0:ye.name;return typeof he!="string"?"other":he.startsWith("mcp__")?"mcp":V[he]||"other"},K=pe=>{lt.value;const he=pe.filter(ke=>ke.streaming);let ye;if(he.length>0)ye=he[he.length-1];else{const ke=pe.filter(Le=>Le.type==="tool");ke.length>0?ye=ke[ke.length-1]:ye=pe[pe.length-1]}if(!ye)return"";if(ye.type==="thinking"){const ke=ye.content||"";return v(ke)}if(ye.type==="tool"){const ke=ye.tool;if(!ke)return"";const Le=t.form.tool_intent_enabled,st=ke.intent_rendered||ke.intent_full||"";return Le&&st?v(st):ke.status==="preparing"?S("toolResults.sentences.preparing",{name:ke.name||S("common.tool")}):ke.status==="running"?S("chat.callingTool",{name:ke.name||S("common.tool")}):ke.status==="completed"?ke.display_name||ke.name||S("chat.toolCompleted"):ye.streaming?S("chat.executingTool"):ke.display_name||ke.name||S("chat.runTool")}return""},se=pe=>{lt.value;const he=pe.filter(Le=>Le.type==="tool");if(he.length===0){const Le=pe.filter(st=>st.type==="thinking").pop();return Le?v(Le.content||""):""}if(he.length===1)return m(he[0]);const ye=Object.fromEntries($.map(Le=>[Le,0]));he.forEach(Le=>{ye[L(Le)]++});const ke=[];return $.forEach(Le=>{const st=ye[Le];st>0&&ke.push(S(I[Le],{n:st}))}),ke.join(",")},oe=(pe,he)=>ve(pe,he)?K(pe):se(pe),ve=(pe,he)=>{if(!i.conversationRunning||!i.isLatestMessage)return!1;const ye=q.value.findIndex(Le=>Le.id===he);return ye===-1?!1:!q.value.slice(ye+1).some(Le=>Le.type==="text")},le=pe=>pe.map((he,ye)=>({id:he.id||he.blockId||`step-${ye}`,type:he.type,content:he.content||"",streaming:he.streaming||!1,action:he})),ue=pe=>pe.scrollHeight-pe.scrollTop-pe.clientHeight<=HH,P=(pe,he)=>{const ye=he.target;if(!ye)return;const ke=!ue(ye);l.set(pe,ke)},X=(pe,he)=>{const ye=c.get(pe);ye&&ye.removeEventListener("scroll",P),he instanceof HTMLElement?(c.set(pe,he),he.addEventListener("scroll",ke=>P(pe,ke))):(c.delete(pe),l.delete(pe))},J=pe=>{const he=c.get(pe);he&&!l.get(pe)&&(he.scrollTop=he.scrollHeight)},ne=pe=>{o.value.has(pe)?(o.value.delete(pe),r("group-toggle",{groupId:pe,expanded:!1}),ft(()=>{const he=q.value.find(ye=>ye.id===pe);he&&he.actions&&he.actions.forEach(ye=>{if(ye.type==="thinking"){const ke=ye.id||ye.blockId;ke&&typeof i.registerThinkingRef=="function"&&i.registerThinkingRef(ke,null)}})})):(o.value.add(pe),r("group-toggle",{groupId:pe,expanded:!0}),ft(()=>{const he=q.value.find(ye=>ye.id===pe);he&&he.actions&&(l.set(pe,!1),ve(he.actions,pe)&&J(pe),he.actions.forEach(ye=>{if(ye.type==="thinking"){const ke=ye.id||ye.blockId;if(ke){const Le=a.get(ke);Le&&typeof i.registerThinkingRef=="function"&&(i.registerThinkingRef(ke,Le),ye.streaming&&(Le.scrollTop=Le.scrollHeight))}}}))}))},ce=pe=>{if(pe.type==="thinking")return i.iconStyle?i.iconStyle("brain"):{};if(pe.type==="tool"&&pe.action.tool){const he=i.getToolIcon?i.getToolIcon(pe.action.tool):"terminal";return i.iconStyle?i.iconStyle(he):{}}return i.iconStyle?i.iconStyle("terminal"):{}},_e=pe=>{lt.value;const he=pe.tool;if(!he)return S("chat.runTool");const ye=t.form.tool_intent_enabled,ke=he.intent_rendered||he.intent_full||"";return ye&&ke?ke:he.status==="preparing"?S("toolResults.sentences.preparing",{name:he.name||S("common.tool")}):he.status==="running"?S("chat.callingTool",{name:he.name||S("common.tool")}):he.status==="completed"?S("chat.toolCompleted"):he.name||S("chat.runTool")},Pe=pe=>{var he;return((he=pe.tool)==null?void 0:he.intent)||""},it=pe=>{var ke;lt.value;const he=RE(pe,i.formatSearchTopic||(()=>""),i.formatSearchTime||(()=>""),i.formatSearchDomains||(()=>""));if(he)return he;const ye=(ke=pe.tool)==null?void 0:ke.result;return ye?typeof ye=="string"?`
${rt(ye)}
`:`
${rt(JSON.stringify(ye,null,2))}
`:`
${rt(S("chat.executing"))}
`},at=pe=>pe?rt(pe).replace(/\n/g,"
"):"",rt=pe=>{const he=document.createElement("div");return he.textContent=pe,he.innerHTML},Oe=(pe,he)=>{he instanceof HTMLElement?a.set(pe,he):a.delete(pe);const ye=q.value.find(ke=>ke.type==="summary"&&ke.actions&&ke.actions.some(Le=>Le.id===pe||Le.blockId===pe));ye&&o.value.has(ye.id)&&typeof i.registerThinkingRef=="function"&&i.registerThinkingRef(pe,he)},xe=(pe,he)=>{typeof i.handleThinkingScroll=="function"&&i.handleThinkingScroll(pe,he)};return Ke(()=>i.actions,()=>{G(),ft(()=>{q.value.forEach(pe=>{pe.type==="summary"&&pe.actions&&o.value.has(pe.id)&&ve(pe.actions,pe.id)&&J(pe.id)})})},{deep:!0,immediate:!0}),Ke(()=>[i.conversationRunning,i.isLatestMessage],()=>{G()}),Rn(()=>{Object.keys(d).forEach(x),c.forEach(pe=>{pe.removeEventListener("scroll",P)}),c.clear(),l.clear()}),(pe,he)=>(F(),U("div",gH,[(F(!0),U(Ie,null,Ze(q.value,ye=>(F(),U(Ie,{key:ye.id},[ye.type==="summary"&&ye.actions?(F(),U("div",vH,[M("div",{class:Ce(["summary-line-text",{running:ve(ye.actions,ye.id)}]),"data-group-id":ye.id,onClick:ke=>ne(ye.id)},[M("div",bH,[M("span",_H,[A(ye.actions,ye.id)?(F(),U(Ie,{key:0},[T(ye.actions,ye.id)?(F(),U("span",wH,[M("span",{class:Ce(["summary-tool-reel-track",C(ye.id)]),style:qe(E(ye.id))},[(F(!0),U(Ie,null,Ze(w(ye.actions,ye.id),(ke,Le)=>(F(),U("span",{key:`${ye.id}-tool-reel-${Le}-${ke}`,class:"summary-tool-reel-item"},Q(ke),1))),128))],6)])):(F(!0),U(Ie,{key:1},Ze(g(oe(ye.actions,ye.id)),(ke,Le)=>(F(),U("span",{key:`${ye.id}-${Le}`,class:"summary-char",style:qe({animationDelay:`${(Le+1)*.12}s`})},Q(ke===" "?" ":ke),5))),128))],64)):(F(),U(Ie,{key:1},[cn(Q(oe(ye.actions,ye.id)),1)],64))])]),M("div",SH,[ve(ye.actions,ye.id)?(F(),U("div",kH,[(F(),Ft(eF(Z(ye.id))))])):(F(),U("svg",CH,[...he[0]||(he[0]=[M("circle",{cx:"12",cy:"12",r:"10"},null,-1),M("polyline",{points:"7.5 12 10.5 15 16.5 9"},null,-1)])]))])],10,yH),M("div",{class:Ce(["steps-container",{show:o.value.has(ye.id)}])},[M("div",{class:Ce(["steps-wrapper",{"height-limited":n.value}]),ref_for:!0,ref:ke=>X(ye.id,ke)},[(F(!0),U(Ie,null,Ze(le(ye.actions),ke=>{var Le;return F(),U("div",{key:ke.id,class:"step-item"},[M("div",TH,[M("span",{class:"step-icon icon icon-sm",style:qe(ce(ke)),"aria-hidden":"true"},null,4),he[1]||(he[1]=M("div",{class:"step-line"},null,-1))]),M("div",AH,[ke.type==="thinking"?(F(),U("div",EH,[M("div",{class:"thinking-content",ref_for:!0,ref:st=>Oe(ke.id,st),onScroll:st=>xe(ke.id,st),innerHTML:at(ke.content)},null,40,MH)])):ke.type==="tool"?(F(),U("div",xH,[M("div",RH,Q(_e(ke.action)),1),Pe(ke.action)?(F(),U("div",IH,Q(Pe(ke.action)),1)):me("",!0),(Le=ke.action.tool)!=null&&Le.result?(F(),U("div",PH,[M("div",{innerHTML:it(ke.action)},null,8,LH)])):(F(),U("div",OH,[M("div",DH,Q(pe.$t("chat.executing")),1)]))])):me("",!0)])])}),128))],2)],2)])):ye.type==="text"?(F(),U("div",{key:1,class:Ce(["text-output",{"streaming-text":ye.streaming}])},[M("div",{class:Ce(["text-content",{"streaming-text":ye.streaming}])},[We(zg,{content:ye.content||"","is-streaming":ye.streaming,citations:s.citations,"citations-final":s.citationsFinal,"enable-citations":s.enableCitations},null,8,["content","is-streaming","citations","citations-final","enable-citations"])],2)],2)):ye.type==="system"?(F(),U("div",NH,[M("div",$H,[M("div",BH,[M("span",FH,Q(ye.content||""),1)]),he[2]||(he[2]=M("div",{class:"summary-status-icon"},[M("svg",{class:"check-icon",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[M("circle",{cx:"12",cy:"12",r:"10"}),M("polyline",{points:"7.5 12 10.5 15 16.5 9"})])],-1))])])):me("",!0)],64))),128))]))}}),zH=qt(WH,[["__scopeId","data-v-ba476c38"]]),jH={class:"edit-summary-card__header"},VH={class:"edit-summary-card__title"},GH={class:"edit-summary-card__totals"},KH={class:"edit-summary-plus"},qH={class:"edit-summary-minus"},QH={class:"edit-summary-card__list"},XH=["onMouseenter","onClick"],YH=["title"],JH={class:"edit-summary-card__delta"},ZH={class:"edit-summary-plus"},e6={class:"edit-summary-minus"},t6={key:0,class:"es-modal"},s6=["aria-label"],n6={class:"es-modal__header"},i6=["title"],r6={class:"es-modal__delta"},o6={class:"edit-summary-plus"},a6={class:"edit-summary-minus"},l6={class:"es-modal__body"},c6={key:0,class:"es-diff-sep","aria-hidden":"true"},u6={class:"es-diff-line-number"},d6={class:"es-diff-marker"},h6={class:"es-diff-content"},f6={key:0,class:"es-diff-note"},p6={key:1,class:"es-diff-empty"},m6=720,ea=16,yx=140,g6=.7,v6=640,y6=260,b6=600,_6=ct({__name:"EditSummaryCard",props:{summary:{},iconStyle:{type:Function}},setup(s){const e=s,t=Is(),n=be(()=>!!t.isMobileViewport),i=be(()=>{var I;const V=(I=e.summary)==null?void 0:I.files;return Array.isArray(V)?V.filter($=>$&&$.path):[]}),r=be(()=>{let V=0,I=0;for(const $ of i.value)V+=Number($.added)||0,I+=Number($.removed)||0;return{added:V,removed:I}}),o=ge(null),a=ge(!1),c=ge(null),l=ge(null),u=ge({});let d=null,h=null;const p=be(()=>o.value&&i.value.find(V=>V.path===o.value)||null);function g(){if(n.value||!c.value||!l.value){u.value={};return}const V=window.innerWidth,I=window.innerHeight,$=Math.min(m6,V-ea*2),L=c.value.getBoundingClientRect(),K=L.left+L.width/2,se=Math.min(Math.max(K-$/2,ea),V-$-ea),oe=Math.min(I*g6,v6),ve=l.value.getBoundingClientRect(),le=ve.top-ve.height/2,ue=ve.bottom+ve.height/2,P=le-ea,X=I-ea-ue,J=P>=y6||P>=X,ne={left:`${Math.round(se)}px`,width:`${Math.round($)}px`,transform:"none"};if(J){const ce=Math.min(Math.max(le,ea+yx),I-ea);u.value={...ne,top:"auto",bottom:`${Math.round(I-ce)}px`,maxHeight:`${Math.round(Math.min(ce-ea,oe))}px`}}else{const ce=Math.min(Math.max(ue,ea),I-ea-yx);u.value={...ne,top:`${Math.round(ce)}px`,bottom:"auto",maxHeight:`${Math.round(Math.min(I-ea-ce,oe))}px`}}}let v=0;function m(V){if(!o.value)return;const I=V.target;I instanceof Element&&I.closest(".es-modal")&&a.value||(v=Date.now()+250,N())}function y(){o.value&&(v=Date.now()+250,N())}function _(){d&&(clearTimeout(d),d=null)}function b(){h&&(clearTimeout(h),h=null)}function k(V,I,$=null){_(),b(),o.value=V,a.value=I,l.value=$,g()}function w(V,I){if(_(),!(Date.now()k(V,!1,I),b6)}}function T(){a.value||(b(),h=setTimeout(()=>{o.value=null},200))}function A(V,I){n.value||(b(),w(V,I.currentTarget||null))}function C(){n.value||(_(),T())}function E(){n.value||b()}function x(){n.value||T()}function D(V,I){k(V,!0,I.currentTarget||null)}function N(){_(),b(),a.value=!1,o.value=null,l.value=null}function O(V){V.key==="Escape"&&o.value&&N()}Ke(o,V=>{V?(window.addEventListener("keydown",O),window.addEventListener("resize",y),window.addEventListener("scroll",m,!0)):(window.removeEventListener("keydown",O),window.removeEventListener("resize",y),window.removeEventListener("scroll",m,!0))}),Rn(()=>{_(),b(),window.removeEventListener("keydown",O),window.removeEventListener("resize",y),window.removeEventListener("scroll",m,!0)});function G(V){return V.type==="add"?"es-diff-add":V.type==="remove"?"es-diff-remove":"es-diff-context"}function Z(V){return V.type==="add"?"+":V.type==="remove"?"-":""}function q(V){const I=V.type==="remove"?V.old_no:V.new_no;return typeof I=="number"&&Number.isFinite(I)?String(I):""}return(V,I)=>i.value.length?(F(),U("div",{key:0,class:"edit-summary-card",ref_key:"cardRef",ref:c},[M("div",jH,[M("span",{class:"icon icon-sm edit-summary-card__icon",style:qe(e.iconStyle("filePen")),"aria-hidden":"true"},null,4),M("span",VH,Q(V.$t("chat.filesEdited",{n:i.value.length})),1),M("span",GH,[M("span",KH,"+"+Q(r.value.added),1),M("span",qH,"-"+Q(r.value.removed),1)])]),M("div",QH,[(F(!0),U(Ie,null,Ze(i.value,$=>(F(),U("div",{key:$.path,class:Ce(["edit-summary-card__row",{"is-active":a.value&&o.value===$.path}]),onMouseenter:L=>A($.path,L),onMouseleave:C,onClick:De(L=>D($.path,L),["stop"])},[M("span",{class:"edit-summary-card__path",title:$.path},Q($.path),9,YH),M("span",JH,[M("span",ZH,"+"+Q($.added||0),1),M("span",e6,"-"+Q($.removed||0),1)])],42,XH))),128))]),(F(),Ft(Tf,{to:"body"},[p.value?(F(),U("div",t6,[a.value||n.value?(F(),U("div",{key:0,class:"es-modal__overlay","aria-hidden":"true",onClick:N})):me("",!0),M("div",{class:"es-modal__panel",style:qe(u.value),role:"dialog","aria-label":V.$t("chat.fileChanges",{path:p.value.path}),onMouseenter:E,onMouseleave:x},[M("div",n6,[M("span",{class:"icon icon-sm es-modal__header-icon",style:qe(e.iconStyle("filePen")),"aria-hidden":"true"},null,4),M("span",{class:"es-modal__path",title:p.value.path},Q(p.value.path),9,i6),M("span",r6,[M("span",o6,"+"+Q(p.value.added||0),1),M("span",a6,"-"+Q(p.value.removed||0),1)]),a.value||n.value?(F(),Ft(ml,{key:0,label:V.$t("common.close"),size:"sm",onClick:De(N,["stop"])},null,8,["label"])):me("",!0)]),M("div",l6,[(p.value.lines||[]).length?(F(),U(Ie,{key:0},[(F(!0),U(Ie,null,Ze(p.value.lines,($,L)=>(F(),U(Ie,{key:L},[$.type==="sep"?(F(),U("div",c6,"⋮")):(F(),U("div",{key:1,class:Ce(["es-diff-line",G($)])},[M("span",u6,Q(q($)),1),M("span",d6,Q(Z($)),1),M("span",h6,Q($.content),1)],2))],64))),128)),p.value.truncated?(F(),U("div",f6,Q(V.$t("chat.diffTruncated")),1)):me("",!0)],64)):(F(),U("div",p6,Q(V.$t("chat.diffEmpty")),1))])],44,s6)])):me("",!0)]))],512)):me("",!0)}}),ep=()=>({active:!1,name:"",status:null,history:[],current:null,next:null,reviewing:!1,footnote:null}),yg=hn("workflow",{state:()=>({snapshot:ep(),live:!1,exiting:!1}),getters:{isActive(s){return s.snapshot.active}},actions:{setWorkflow(s,e=!1){if(this.live=e,!s||s.active!==!0){if(this.exiting){e||(this.exiting=!1,this.snapshot=ep());return}if(e&&this.snapshot.active){this.exiting=!0;return}this.snapshot=ep();return}this.exiting=!1,this.snapshot={...ep(),...s,active:!0}},finishExit(){this.exiting=!1,this.live=!1,this.snapshot=ep()},reset(){this.snapshot=ep(),this.live=!1,this.exiting=!1},async fetchStatus(s){var e;try{const t=await fetch(`/api/workflow/status?conversation_id=${encodeURIComponent(s)}`,{credentials:"same-origin"}),n=await t.json().catch(()=>({}));t.ok&&(n!=null&&n.success)&&((e=n==null?void 0:n.snapshot)==null?void 0:e.active)===!0?this.setWorkflow(n.snapshot,!1):this.reset()}catch{this.reset()}}}}),kL="agents_quick_dock_had_content",w6=()=>{if(typeof window>"u"||!window.localStorage)return!1;try{return window.localStorage.getItem(kL)==="1"}catch{return!1}},S6=s=>{if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(kL,s?"1":"0")}catch(e){console.warn("写入快捷窗口内容状态缓存失败:",e)}},CL="agents_quick_dock_conv_content",bx=50,TL=()=>{if(typeof window>"u"||!window.localStorage)return{};try{const s=window.localStorage.getItem(CL),e=s?JSON.parse(s):{};return e&&typeof e=="object"?e:{}}catch{return{}}},k6=s=>TL()[s]===!0,C6=(s,e)=>{if(!(typeof window>"u"||!window.localStorage||!s))try{const t=TL();delete t[s],t[s]=e;const n=Object.keys(t);if(n.length>bx)for(const i of n.slice(0,n.length-bx))delete t[i];window.localStorage.setItem(CL,JSON.stringify(t))}catch(t){console.warn("写入快捷窗口对话内容缓存失败:",t)}},_x=()=>{if(typeof window<"u"){const s=window.location.pathname.replace(/\/+$/,"")||"/";if(s==="/"||s==="/new")return!1}return w6()},oo=hn("quickDock",{state:()=>({editedFiles:[],editedFilesLive:!1,detail:null,previewPath:null,menu:null,userCollapsed:!1,assumedContent:_x(),assumedActive:_x(),filesSyncSeq:0}),getters:{hasContent(s){var a,c;const e=Pc(),t=dd(),n=vg(),i=yg(),o=(((c=(a=e.todoList)==null?void 0:a.tasks)==null?void 0:c.length)||0)>0||t.subAgents.length>0||n.commands.length>0||s.editedFiles.length>0;return i.isActive||i.exiting||(s.assumedActive?s.assumedContent:o)},expanded(s){return this.hasContent&&!s.userCollapsed}},actions:{setEditedFiles(s,e=!1){if(this.filesSyncSeq+=1,this.editedFilesLive=e,!Array.isArray(s)){this.editedFiles=[];return}const t=new Set,n=[];for(const i of s)!i||typeof i.path!="string"||!i.path||t.has(i.path)||(t.add(i.path),n.push({path:i.path,op:i.op,ts:i.ts}));this.editedFiles=n,this.previewPath&&!t.has(this.previewPath)&&(this.previewPath=null)},openDetail(s,e){if(e){if(this.detail&&this.detail.kind===s&&this.detail.id===e){this.detail=null;return}this.detail={kind:s,id:e}}},closeDetail(){this.detail=null},openPreview(s){if(s){if(this.previewPath===s){this.previewPath=null;return}this.previewPath=s}},closePreview(){this.previewPath=null},openMenu(s){if(this.menu&&this.menu.type===s.type&&this.menu.key===s.key){this.menu=null;return}this.menu=s},closeMenu(){this.menu=null},resetTransient(){this.detail=null,this.previewPath=null,this.menu=null},settleInitialContent(){this.assumedActive=!1,this.assumedContent=!1},assumeContentForConversation(s){this.assumedContent=s?k6(s):!1,this.assumedActive=!0}}}),T6={class:"file-chip-row",role:"list"},A6=["title","onClick"],E6={width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},M6={class:"file-chip-meta"},x6={class:"file-chip-name"},R6={class:"file-chip-type"},I6=["aria-label","onClick"],P6="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",L6=ct({__name:"FileChips",props:{files:{default:()=>[]},removable:{type:Boolean,default:!1}},emits:["remove"],setup(s){const e={doc:{kind:"word",labelKey:"chat.fileTypeDoc"},docx:{kind:"word",labelKey:"chat.fileTypeDoc"},xls:{kind:"excel",labelKey:"chat.fileTypeSheet"},xlsx:{kind:"excel",labelKey:"chat.fileTypeSheet"},csv:{kind:"excel",labelKey:"chat.fileTypeSheet"},ppt:{kind:"ppt",labelKey:"chat.fileTypeSlides"},pptx:{kind:"ppt",labelKey:"chat.fileTypeSlides"},pdf:{kind:"pdf",labelKey:"chat.fileTypePdf"},txt:{kind:"text",labelKey:"chat.fileTypeText"},md:{kind:"text",labelKey:"chat.fileTypeText"},log:{kind:"text",labelKey:"chat.fileTypeText"},zip:{kind:"archive",labelKey:"chat.fileTypeArchive"},tar:{kind:"archive",labelKey:"chat.fileTypeArchive"},gz:{kind:"archive",labelKey:"chat.fileTypeArchive"},tgz:{kind:"archive",labelKey:"chat.fileTypeArchive"},bz2:{kind:"archive",labelKey:"chat.fileTypeArchive"},xz:{kind:"archive",labelKey:"chat.fileTypeArchive"},"7z":{kind:"archive",labelKey:"chat.fileTypeArchive"},rar:{kind:"archive",labelKey:"chat.fileTypeArchive"}},t=new Set(["js","mjs","cjs","ts","jsx","tsx","vue","py","java","c","h","cpp","cc","hpp","go","rs","rb","php","html","htm","css","scss","less","json","xml","yml","yaml","toml","ini","cfg","sh","bash","zsh","sql","swift","kt","kts","lua","r","dart"]),n=s,i=d=>{const h=String(d||"").split(/[/\\]/).filter(Boolean);return h.length?h[h.length-1]:String(d||"")},r=d=>{const h=(d.includes(".")&&d.split(".").pop()||"").trim().toLowerCase();return h&&e[h]?e[h]:h&&t.has(h)?{kind:"code",labelKey:"chat.fileTypeCode"}:{kind:"generic",labelKey:"chat.fileTypeGeneric"}},o=be(()=>(n.files||[]).map(d=>{const h=typeof d=="string"?d:String((d==null?void 0:d.path)||"");if(!h)return null;const p=typeof d=="object"&&d&&typeof d.name=="string"&&d.name||i(h),{kind:g,labelKey:v}=r(p);return{path:h,name:p,kind:g,labelKey:v}}).filter(d=>!!d)),a=oo(),c=Is(),l=be(()=>!c.isMobileViewport),u=d=>{l.value&&a.previewPath!==d.path&&a.openPreview(d.path)};return(d,h)=>(F(),U("div",T6,[(F(!0),U(Ie,null,Ze(o.value,p=>(F(),U("div",{key:p.path,class:Ce(["file-chip",{"is-clickable":l.value,"is-previewing":l.value&&Ne(a).previewPath===p.path}]),role:"listitem",title:p.name,onClick:g=>u(p)},[M("span",{class:"file-chip-icon",style:qe({background:`var(--file-kind-${p.kind})`})},[(F(),U("svg",E6,[M("path",{d:P6}),h[16]||(h[16]=M("path",{d:"M14 2v5a1 1 0 0 0 1 1h5"},null,-1)),p.kind==="word"?(F(),U(Ie,{key:0},[h[0]||(h[0]=M("path",{d:"M9 13h6"},null,-1)),h[1]||(h[1]=M("path",{d:"M9 16.5h6"},null,-1))],64)):p.kind==="excel"?(F(),U(Ie,{key:1},[h[2]||(h[2]=M("path",{d:"M9 12h6v5H9z"},null,-1)),h[3]||(h[3]=M("path",{d:"M9 14.5h6"},null,-1)),h[4]||(h[4]=M("path",{d:"M12 12v5"},null,-1))],64)):p.kind==="ppt"?(F(),U(Ie,{key:2},[h[5]||(h[5]=M("path",{d:"M9.5 17v-3.5"},null,-1)),h[6]||(h[6]=M("path",{d:"M12.5 17V12"},null,-1)),h[7]||(h[7]=M("path",{d:"M15.5 17v-2"},null,-1))],64)):p.kind==="pdf"?(F(),U(Ie,{key:3},[h[8]||(h[8]=M("path",{d:"M12 11.5v6"},null,-1)),h[9]||(h[9]=M("path",{d:"m9.5 15 2.5 2.5 2.5-2.5"},null,-1))],64)):p.kind==="text"?(F(),U(Ie,{key:4},[h[10]||(h[10]=M("path",{d:"M9 13h6"},null,-1)),h[11]||(h[11]=M("path",{d:"M9 16.5h4"},null,-1))],64)):p.kind==="code"?(F(),U(Ie,{key:5},[h[12]||(h[12]=M("path",{d:"m10 12.5-2 2 2 2"},null,-1)),h[13]||(h[13]=M("path",{d:"m14 12.5 2 2-2 2"},null,-1))],64)):p.kind==="archive"?(F(),U(Ie,{key:6},[h[14]||(h[14]=M("path",{d:"M9 12.5h6v4.5H9z"},null,-1)),h[15]||(h[15]=M("path",{d:"M11 12.5V11h2v1.5"},null,-1))],64)):me("",!0)]))],4),M("span",M6,[M("span",x6,Q(p.name),1),M("span",R6,Q(d.$t(p.labelKey)),1)]),s.removable?(F(),U("button",{key:0,type:"button",class:"file-chip-remove","aria-label":d.$t("chat.removeFile",{name:p.name}),onClick:De(g=>d.$emit("remove",p.path),["stop"])},[...h[17]||(h[17]=[M("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none","aria-hidden":"true"},[M("path",{d:"M2.5 2.5l5 5M7.5 2.5l-5 5",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"})],-1)])],8,I6)):me("",!0)],10,A6))),128))]))}}),AL=qt(L6,[["__scopeId","data-v-0e1473ca"]]),O6={key:0,class:"compact-brief-line",role:"separator"},D6={class:"compact-brief-text"},N6={key:0},$6=["innerHTML"],B6={key:1,class:"image-inline-row"},F6=["onClick"],H6=["src","alt"],U6={key:2,class:"image-inline-row video-inline-row"},W6=["src","alt"],z6={key:3,class:"user-bubble-expand-row"},j6=["title","aria-label","onClick"],V6={key:0,class:"user-bubble-actions"},G6=["title","aria-label","onClick"],K6=["title","aria-label","onClick"],q6={class:"user-bubble-time"},Q6={key:1,class:"assistant-message"},X6={key:0,class:"message-header icon-label"},Y6={key:0,class:"assistant-work-status"},J6={key:1,class:"action-item streaming-content immediate-show assistant-generating-block"},Z6={class:"text-output"},eU={class:"text-content assistant-generating-placeholder",role:"status","aria-live":"polite"},tU=["data-block-id"],sU=["onClick"],nU={class:"status-icon"},iU={class:"status-text"},rU=["onScroll"],oU={key:1,class:"text-output"},aU={key:2,class:"sub-agent-system-summary-line"},lU={class:"append-placeholder-content"},cU={key:0,class:"icon-label append-status"},uU={key:1,class:"icon-label append-status append-error-text"},dU={key:2,class:"append-meta"},hU={key:0},fU={key:1},pU={key:3,class:"append-warning icon-label"},mU={class:"append-placeholder-content"},gU={class:"icon-label append-status"},vU={key:0,class:"append-meta"},yU={key:0},bU={key:1},_U={key:1,class:"append-warning icon-label"},wU=["data-block-id"],SU=["onClick"],kU={class:"status-icon"},CU={class:"status-text"},TU=["onScroll"],AU={key:1,class:"text-output"},EU={key:2,class:"sub-agent-system-summary-line"},MU={class:"append-placeholder-content"},xU={key:0,class:"icon-label append-status"},RU={key:1,class:"icon-label append-status append-error-text"},IU={key:2,class:"append-meta"},PU={key:0},LU={key:1},OU={key:3,class:"append-warning icon-label"},DU={class:"append-placeholder-content"},NU={class:"icon-label append-status"},$U={key:0,class:"append-meta"},BU={key:0},FU={key:1},HU={key:1,class:"append-warning icon-label"},UU={key:2,class:"system-message"},WU=["data-block-id"],zU=["onClick"],jU={class:"status-icon"},VU={class:"status-text"},GU={class:"content-inner"},KU=["aria-label"],qU=["onClick"],QU={class:"quick-nav-preview-user"},XU={class:"quick-nav-preview-ai"},pC=10,mC=240,tp=8,YU=900,JU=36,wx=48.74,gC=34,Sx=116,ZU=ct({__name:"ChatArea",props:{messages:{},iconStyle:{type:Function},expandedBlocks:{},streamingMessage:{type:Boolean},toggleBlock:{type:Function},handleThinkingScroll:{type:Function},renderMarkdown:{type:Function},getToolIcon:{type:Function},getToolStatusText:{type:Function},getToolAnimationClass:{type:Function},getToolDescription:{type:Function},formatSearchTopic:{type:Function},formatSearchTime:{type:Function},formatSearchDomains:{type:Function},historyLoading:{type:Boolean}},emits:["stick-state-change","user-scroll-intent"],setup(s,{expose:e,emit:t}){const n=s,i=t,r=Js(),o=be(()=>!!r.loaded||!!r.error),a=be(()=>!!n.historyLoading||!o.value),c=be(()=>rH(n.messages||[]));function l(z){var te;const ie=(te=z==null?void 0:z.metadata)==null?void 0:te.citations;return Array.isArray(ie)?ie:c.value.length?c.value:void 0}function u(z){var ie;return Array.isArray((ie=z==null?void 0:z.metadata)==null?void 0:ie.citations)}const d=be(()=>r.experiments.blockDisplayMode||"stacked"),h=be(()=>r.form.compact_message_display||r.experiments.compactMessageDisplay||"full"),p=be(()=>d.value==="stacked"||d.value==="minimal"),g=be(()=>r.form.use_custom_names&&r.form.self_identify||"Astrion"),v=be(()=>(lt.value,r.form.use_custom_names?r.form.user_name||S("chat.userDefaultName"):S("chat.userDefaultName"))),m=new Map,y=ge({}),_=ge(new Set),b=ge(!1);let k=null,w=new Map,T=0;const A=(z,ie)=>(z==null?void 0:z.id)||`user-bubble-${ie}`,C=(z,ie,te)=>{const de=A(z,ie);if(te instanceof HTMLElement){m.set(de,te),k&&k.observe(te);const Ee=y.value[de];Ee&&Ee.foldHeight===0&&requestAnimationFrame(()=>{te.isConnected&&D()})}else m.delete(de)},E=z=>{const ie=typeof(z==null?void 0:z.content)=="string"?z.content:"";if(!ie)return!1;const de=48*(pC+2),Ee=(ie.match(/\n/g)||[]).length;return ie.length>de||Ee>=pC+2},x=()=>{(Array.isArray(pe.value)?pe.value:[]).forEach((z,ie)=>{if(!z||z.role!=="user")return;const te=A(z,ie);if(y.value[te])return;const de=E(z);y.value[te]={needsFold:de,expanded:!1,foldHeight:0,fullHeight:0}})},D=()=>{m.forEach((z,ie)=>{if(!z.isConnected){m.delete(ie);return}const te=window.getComputedStyle(z),de=parseFloat(te.lineHeight),Ee=Number.isFinite(de)?de:24,fe=Math.round(Ee*pC),Qe=Math.ceil(z.scrollHeight),vt=Qe>fe+1,Pt=y.value[ie];y.value[ie]={needsFold:vt,expanded:(Pt==null?void 0:Pt.expanded)??!1,foldHeight:fe,fullHeight:Qe},z.style.setProperty("--bubble-fold-height",`${fe}px`),z.style.setProperty("--bubble-full-height",`${Qe}px`)})},N=(z,ie)=>{var de;const te=A(z,ie);return!!((de=y.value[te])!=null&&de.needsFold)},O=(z,ie)=>{var de;const te=A(z,ie);return!!((de=y.value[te])!=null&&de.expanded)},G=(z,ie)=>{const te=A(z,ie),de=y.value[te];return!!(de!=null&&de.needsFold)&&!(de!=null&&de.expanded)},Z=(z,ie)=>{const te=A(z,ie),de=y.value[te];!de||!de.needsFold||(y.value[te]={...de,expanded:!de.expanded})},q=z=>{lt.value;const ie=z==null?void 0:z.created_at;if(!ie)return"";const te=new Date(ie),Ee=Math.max(0,new Date().getTime()-te.getTime()),fe=Math.floor(Ee/1e3),Qe=Math.floor(fe/60),vt=Math.floor(Qe/60);if(Math.floor(vt/24)>=1){const Lt=te.getMonth()+1,Bs=te.getDate(),Fs=String(te.getHours()).padStart(2,"0"),fo=String(te.getMinutes()).padStart(2,"0");return S("common.timeDate",{month:Lt,day:Bs,hour:Fs,minute:fo})}return vt>0?S("common.hoursAgo",{n:vt}):Qe>0?S("common.minutesAgo",{n:Qe}):fe>0?S("common.secondsAgo",{n:fe}):S("common.justNow")},V=(z,ie)=>{const te=A(z,ie);return _.value.has(te)},I=async(z,ie)=>{const te=A(z,ie),de=typeof(z==null?void 0:z.content)=="string"?z.content:"";if(!(!de||_.value.has(te)))try{await navigator.clipboard.writeText(de),_.value.add(te);const Ee=w.get(te);Ee&&window.clearTimeout(Ee);const fe=window.setTimeout(()=>{_.value.delete(te),w.delete(te)},5e3);w.set(te,fe)}catch(Ee){console.warn("复制用户消息失败:",Ee)}},$=z=>{},L=()=>{k&&(k.disconnect(),m.forEach(z=>{z.isConnected&&k.observe(z)}))},K=()=>{const z=++T;requestAnimationFrame(()=>{requestAnimationFrame(()=>{z===T&&(b.value=!1)})})},se=/^\u6765\u81ea\s+(.+?)\s+\u7684(.+?)\nid:\s*(\S+)\n\n<(.+?)>\n<(\w+)([^>]*)>\n([\s\S]*?)\n<\/\5>\n<\/\4>$/,oe=/^From\s+(.+?)(?:\s+to\s+.+?)?\s*:\s*(.+?)\nid:\s*(\S+)\n\n<(.+?)>\n<(\w+)([^>]*)>\n([\s\S]*?)\n<\/\5>\n<\/\4>$/;function ve(z){const ie=String(z||""),te=ie.match(se)||ie.match(oe);if(!te)return null;const Ee=(te[6]||"").match(/subtype="([^"]+)"/);return{displayName:te[1].trim(),subtype:Ee?Ee[1]:"",content:te[7]}}function le(z){if(!z||z.role!=="user")return!1;const ie=z.metadata||{};return String(ie.auto_message_type||z.auto_message_type||"").startsWith("multi_agent_")}function ue(z){var de;lt.value;const ie=((de=z==null?void 0:z.metadata)==null?void 0:de.multi_agent_display_name)||(z==null?void 0:z.multi_agent_display_name);if(ie)return ie;const te=ve((z==null?void 0:z.content)||"");return(te==null?void 0:te.displayName)||S("chat.subAgentName")}function P(z,ie){if(!le(z))return!1;const de=he()[ie-1];return!de||!le(de)?!1:ue(z)===ue(de)}function X(z){const ie=ve((z==null?void 0:z.content)||"");return((ie==null?void 0:ie.content)||(z==null?void 0:z.content)||"").trim()}const J=z=>String(z||"").replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"),ne=/\[\$([^\]\n]+)\]\(((?:[^)\n]*[\\/])?\.astrion[\\/]skills[\\/][^)\n]+[\\/]SKILL\.md)\)/g,ce=/\[([^\]\n]+)\]\(file:\/\/([^)\n]+)\)/g,_e=/^(?:\u5b50\u667a\u80fd\u4f53\d+\s*\u4efb\u52a1\u5b8c\u6210|Sub-agent\s*\d+\s*complete)$/,Pe=/^(?:✅\s*)?(?:\u5b50\u667a\u80fd\u4f53|Sub-agent)\s*#?\s*(\d+)\s*(?:\u4efb\u52a1\u6458\u8981|task summary)[::]/,it=/^(?:\[)?(?:\u540e\u53f0\s*run_command\s*\u5b8c\u6210|Background\s*run_command\s*finished)(?:\])?$/,at=new Set(["thinking","text","tool","append","append_payload","system"]);function rt(z){const ie=String(z||""),te=new RegExp(`(?:${ne.source})|(?:${ce.source})`,"g");let de="",Ee=0,fe;for(;fe=te.exec(ie);)de+=J(ie.slice(Ee,fe.index)),fe[1]!==void 0?de+=` ${J(fe[1]||"")} `:fe[3]!==void 0&&(de+=` ${J(fe[3]||"")} `),Ee=fe.index+fe[0].length;return de+=J(ie.slice(Ee)),de}const Oe=z=>!z||z.role!=="user"?!1:Fd(z)==="hidden",xe=z=>!z||z.role!=="assistant"||(Array.isArray(z.actions)?z.actions:[]).some(Ee=>_d(Ee))||z.awaitingFirstContent?!1:!!!(z.streaming||z.currentStreamingType||z.streamingText||z.streamingThinking),pe=be(()=>{const z=n.messages||[];z.filter(de=>de&&de.role==="system").length>0;const te=z.filter(de=>de&&de.metadata&&de.metadata.system_injected_image||(de==null?void 0:de.role)==="system"||Oe(de)?!1:xe(de)?(jt("ChatArea.filteredMessages:drop-empty-assistant",{actions:Array.isArray(de==null?void 0:de.actions)?de.actions.map(Ee=>Ee==null?void 0:Ee.type):[],awaitingFirstContent:!!(de!=null&&de.awaitingFirstContent)}),!1):!0);return z.length!==te.length&&jt("ChatArea.filteredMessages:dropped",{sourceLength:z.length,resultLength:te.length,dropped:z.length-te.length}),te}),he=()=>Array.isArray(pe.value)?pe.value:[],ye=be(()=>{var de,Ee,fe;const z=new Map,ie=he(),te=!!r.form.edit_summary_live_display;for(let Qe=0;Qe=0&&z.set(Lt,Pt)}return z}),ke=be(()=>he().length-1),Le=ge(Date.now());let st=null;const gt=new Set,Wt=new Set,jt=(...z)=>{},{scrollRef:ht,contentRef:Qt,isAtBottom:It,isNearBottom:ns,escapedFromLock:ot,scrollToBottom:$s,stopScroll:Er}=h3({resize:"instant",initial:"instant"}),In=new WeakMap;let Ko=0;const ao=(z,ie)=>{if(z&&typeof z=="object"){let te=In.get(z);if(!te){const de=z.id;te=de!=null?`msg-${String(de)}`:`mk-${++Ko}`,In.set(z,te)}return te}return`idx-${ie}`},Pn=be(()=>ht.value??void 0),qo=be(()=>{if(!n.streamingMessage)return[];const z=ke.value;return z>=0?[z]:[]});tF("mathRenderedCallback",()=>{wl||ns.value&&Cs&&requestAnimationFrame(()=>{Cs({preserveScrollPosition:!1})})});const Yn=ht,{anchorBlockElement:Oi,stopAll:Mr}=M3(ht,{stopScroll:Er});let Di=null;function gl(){if(Di=null,!n.streamingMessage)return;const z=ht.value;if(z&&!wl&&It.value&&!ot.value){const ie=z.scrollHeight-z.clientHeight;ie-z.scrollTop>1&&(Sa("ChatArea.liveStickLock"),z.scrollTop=ie)}Di=requestAnimationFrame(gl)}function Qo(){Di!==null&&(cancelAnimationFrame(Di),Di=null)}Ke(()=>n.streamingMessage,z=>{z?Di===null&&(Di=requestAnimationFrame(gl)):Qo()},{immediate:!0});const lo=new Map;let fi=null,Ni=0;const wa=new Map;let vl=0,re=0,we=0,Ae=0,bt=0,hs="",Ps=0,is=!1,en=null,ut=null,pn=null,co=null,$i=null,Bc=!1,xr=0,Bi=!1;function Fc(z){const ie=ht.value;if(!ie||!(z instanceof HTMLElement))return!1;let te=z;for(;te&&te!==ie;){if(te.scrollHeight>te.clientHeight+2){const de=getComputedStyle(te).overflowY;if(de==="auto"||de==="scroll")return!0}te=te.parentElement}return!1}function Fi(){var z;if(typeof window>"u")return!1;try{const ie=window.__SCROLL_BOUNCE_TRACE__;if(ie===!1||ie==="0")return!1;if(ie===!0||ie==="1")return!0;const te=(z=window.localStorage)==null?void 0:z.getItem("scrollBounceTrace");return te==="0"||te==="false"?!1:te==="1"||te==="true"}catch{return!1}}function mn(z){const ie=z.scrollTop,te=z.scrollHeight,de=z.clientHeight;return{top:ie,height:te,client:de,remain:te-ie-de,hasShowHtml:!!z.querySelector("show_html, show-html, .chat-inline-html, .chat-inline-card--html")}}function Hi(z,ie={},te=z,de=120){if(!Fi()||Ni>=mC)return;const Ee=Date.now(),fe=wa.get(te)||0;if(!(de>0&&Ee-fe{if(ie.touches.length!==1){xr=0,Bi=!1;return}xr=ie.touches[0].clientY,Bi=!1},co=ie=>{if(Bi||!xr||ie.touches.length!==1)return;const te=ht.value;if(!te)return;const de=ie.touches[0].clientY-xr;if(de<=8)return;const Ee=Date.now();Ee<=Ps||Fc(ie.target)||(Bi=!0,Ae=Ee,Er(),Mr(),qf(),i("user-scroll-intent",{ts:Ee,delta:-de,top:te.scrollTop||0}),Hi("user-scroll-intent:touch-drag",{deltaY:de,top:te.scrollTop||0,...mn(te)},"user-scroll-intent:touch-drag",80))},$i=()=>{xr=0,Bi=!1},z.addEventListener("touchstart",pn,{passive:!0,capture:!0}),z.addEventListener("touchmove",co,{passive:!0,capture:!0}),z.addEventListener("touchend",$i,{passive:!0,capture:!0}),z.addEventListener("touchcancel",$i,{passive:!0,capture:!0}),ut=ie=>{const te=ht.value;if(!te)return;const de=ie.isTrusted===!0,Ee=Number(ie.deltaY||0);if(!(de&&Ee<-1&&Date.now()>Ps))return;const fe=Date.now();Ae=fe,Er(),Mr(),qf(),i("user-scroll-intent",{ts:fe,delta:Ee,top:te.scrollTop||0}),Hi("user-scroll-intent:wheel-up",{deltaY:Ee,top:te.scrollTop||0,...mn(te)},"user-scroll-intent:wheel-up",80)},z.addEventListener("wheel",ut,{passive:!0,capture:!0}),en=ie=>{const te=ie.target;if(!te)return;const de=ie.isTrusted===!0,Ee=te.scrollTop,fe=Ee-vl,Qe=te.scrollHeight||0,vt=Qe-re;vl=Ee,re=Qe,E_(Ee),vt!==0&&Hi("height-change",{heightDelta:vt,scrollHeight:Qe,top:Ee,delta:fe,escapedFromLock:ot.value,isAtBottom:It.value,isNearBottom:ns.value},"height-change",120);const Pt=Math.max(200,te.clientHeight*.35||200);!is&&vt>Pt&&!ot.value&&(Hi("large-growth:trigger",{heightDelta:vt,threshold:Pt,top:Ee,delta:fe,escapedFromLock:ot.value,isAtBottom:It.value,isNearBottom:ns.value},"large-growth:trigger",0),is=!0,Sa("ChatArea.largeGrowth"),Ps=Date.now()+900,$s({animation:"instant",preserveScrollPosition:!1}),Hi("large-growth:instant-scroll",{heightDelta:vt,threshold:Pt,...mn(te)},"large-growth:instant-scroll",120),setTimeout(()=>{is=!1},400));const Lt=Date.now(),Bs=Lt-bt<=140,Fs=Math.abs(vt)>2,fo=fe<-3&&Lt-Ae<=240,Jo=fe<-18&&Lt>Ps&&!Bs;if(de&&Math.abs(fe)>5&&Lt>Ps&&(!Bs||Jo)&&(fe<0&&(Jo||fo)||!Fs)&&(Er(),Mr(),we=Lt,i("user-scroll-intent",{ts:we,delta:fe,top:Ee}),Hi("user-scroll-intent",{delta:fe,top:Ee,ts:we,closeToProgrammaticHint:Bs,likelyLayoutDriven:Fs,manualUpByWheel:fo,strongManualUp:Jo,...mn(te)},"user-scroll-intent",120)),fe<-8){if(Lt-we<=1400){const kl=Lt-bt<=1200;Hi("rebound:detected",{delta:fe,trusted:de,likelySource:kl?hs||"programmatic-unknown":"unknown(internal-stick/browser-anchor)",msSinceUserDown:Lt-we,msSinceProgrammatic:Lt-bt,...mn(te),stickState:{isAtBottom:!!It.value,isNearBottom:!!ns.value,escapedFromLock:!!ot.value}},"rebound:detected",0)}}else Hi("scroll:event",{delta:fe,trusted:de,...mn(te),stickState:{isAtBottom:!!It.value,isNearBottom:!!ns.value,escapedFromLock:!!ot.value}},"scroll:event",180)},z.addEventListener("scroll",en,{passive:!0}),!Bc&&Fi()&&(Bc=!0,console.warn("[SCROLL_BOUNCE_TRACE]","listener-attached",{hasElement:!!z,className:z.className||""})))}function Xo(){const z=ht.value;if(!z)return;const ie=Math.max(0,z.offsetWidth-z.clientWidth);z.style.setProperty("--chat-scrollbar-width",`${ie}px`)}Ke([It,ns,ot],([z,ie,te])=>{i("stick-state-change",{isAtBottom:!!z,isNearBottom:!!ie,escapedFromLock:!!te})},{immediate:!0});function Yo(z){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(z):z.replace(/["\\]/g,"\\$&")}const et=ge(new Set);function ae(z){return n.streamingMessage?wl?!0:!(!ot.value&&!!It.value)||!z?!1:z.classList.contains("processing")||z.classList.contains("running")||!!z.querySelector(".processing, .running, .thinking-animation"):!1}Ke(()=>n.expandedBlocks,(z,ie)=>{const te=ie??et.value,de=new Set([...Array.from(z),...Array.from(te)]),Ee=new Set;for(const Qe of de)z.has(Qe)!==te.has(Qe)&&Ee.add(Qe);if(et.value=new Set(z),Ee.size===0)return;const fe=ht.value;if(fe)for(const Qe of Ee){const vt=fe.querySelector(`[data-block-id="${Yo(Qe)}"]`);ae(vt)||vt&&Oi(vt,Qe,{direction:"auto",duration:260,phase:z.has(Qe)?"expand":"collapse"})}},{flush:"post"});function Me(z){ae(z.element)||Oi(z.element,`more-${z.stackKey}`,{direction:"auto",duration:260,phase:expanded?"expand":"collapse"})}function Ge(z){const{groupId:ie,expanded:te}=z,de=ht.value;if(!de)return;const Ee=de.querySelector(`[data-group-id="${Yo(ie)}"]`);ae(Ee)||Ee&&Oi(Ee,ie,{direction:"auto",duration:300,phase:te?"expand":"collapse"})}const Bt=(z,ie)=>{if(!(ie instanceof HTMLElement))return;const te=600;requestAnimationFrame(()=>{const de=ie.scrollHeight||ie.offsetHeight||0;de>0&&ie.style.setProperty("--collapse-max",`${Math.min(de,te)}px`)})};function Tt(z,ie){ie instanceof HTMLElement?lo.set(z,ie):lo.delete(z)}function Zt(z){return lo.get(z)||null}async function Cs(z={}){const ie=ht.value;return ie&&Hi("programmatic:scrollToBottom:before",{source:"ChatArea.stickScrollToBottom",behavior:z.behavior||"auto",force:!!z.force,preserveScrollPosition:!!z.preserveScrollPosition,...mn(ie)},"programmatic:scrollToBottom:before",80),Sa("ChatArea.stickScrollToBottom"),(z.force||z.behavior==="smooth")&&(Ps=Date.now()+900),await $s({animation:z.behavior==="smooth"?"smooth":"auto",ignoreEscapes:!!z.force,preserveScrollPosition:!!z.preserveScrollPosition,duration:z.force?260:0})}async function pi(z={}){const ie=ht.value;return ie&&Hi("programmatic:conditional:before",{source:"ChatArea.stickConditionalScrollToBottom",force:!!z.force,...mn(ie)},"programmatic:conditional:before",100),Sa("ChatArea.stickConditionalScrollToBottom"),z.force?await Cs({force:!0,preserveScrollPosition:!1}):await Cs({preserveScrollPosition:!1})}function mi(){return{isAtBottom:!!It.value,isNearBottom:!!ns.value,escapedFromLock:!!ot.value}}function fs(z,ie){return typeof n.iconStyle=="function"?n.iconStyle(z,ie):{}}function Es(z){return z?typeof z=="string"?z:typeof(z==null?void 0:z.path)=="string"?z.path:typeof(z==null?void 0:z.source_path)=="string"?z.source_path:"":""}function rs(z){const ie=Es(z);if(!ie)return typeof(z==null?void 0:z.name)=="string"&&z.name?z.name:typeof(z==null?void 0:z.title)=="string"&&z.title?z.title:typeof(z==null?void 0:z.media_id)=="string"&&z.media_id?z.media_id:"";const te=ie.split(/[/\\]/);return te[te.length-1]||ie}function Ln(z){var te;const ie=(te=z==null?void 0:z.metadata)==null?void 0:te.files;return Array.isArray(ie)?ie.filter(de=>typeof de=="string"&&de||de&&typeof de.path=="string"&&de.path).slice(0,9):[]}function bd(z,ie){const te=Ui(z,ie,"image");te&&Is().openImagePreview({url:te,name:rs(ie)})}function cr(z,ie,te){var vt;const de=(z==null?void 0:z.media_refs)||((vt=z==null?void 0:z.metadata)==null?void 0:vt.media_refs)||[];if(!Array.isArray(de)||!de.length)return null;const Ee=typeof(ie==null?void 0:ie.media_id)=="string"?ie.media_id:"";if(Ee){const Pt=de.find(Lt=>(Lt==null?void 0:Lt.media_id)===Ee);if(Pt)return Pt}const fe=Es(ie);if(fe){const Pt=de.find(Lt=>Lt&&Lt.kind===te&&typeof Lt.source_path=="string"&&Lt.source_path===fe);if(Pt)return Pt}return de.find(Pt=>Pt&&Pt.kind===te)||null}function Ui(z,ie,te){const de=cr(z,ie,te),Ee=typeof(de==null?void 0:de.media_id)=="string"?de.media_id:"";if(Ee)return`/api/conversations/media/${encodeURIComponent(Ee)}`;const fe=Es(ie);return fe?`/api/gui/files/download?path=${encodeURIComponent(fe)}`:""}function Rr(z,ie,te){const de=cr(z,ie,"image")||cr(z,ie,"video");if(typeof(de==null?void 0:de.media_id)=="string"&&de.media_id)return`${de.media_id}-${te}`;const Ee=Es(ie);return Ee?`${Ee}-${te}`:`media-${te}`}function Sg(z){const ie=Math.max(0,Math.floor((z||0)/1e3)),te=Math.floor(ie/3600),de=Math.floor(ie%3600/60),Ee=ie%60;return te>0?`${String(te).padStart(2,"0")}:${String(de).padStart(2,"0")}:${String(Ee).padStart(2,"0")}`:`${String(de).padStart(2,"0")}:${String(Ee).padStart(2,"0")}`}function Uc(z){if(lt.value,!z||z.type!=="system")return null;const ie=typeof z.content=="string"?z.content.trim():"",te=(z==null?void 0:z.id)||`no-id-${ie.slice(0,32)}`;if(!ie)return gt.has(`${te}-empty`)||gt.add(`${te}-empty`),null;if(z.variant==="sub_agent_done"&&(_e.test(ie)||it.test(ie)))return gt.has(`${te}-variant-pass`)||gt.add(`${te}-variant-pass`),ie;const de=ie.match(Pe);return de&&/(?:\u5df2\u5b8c\u6210|Completed\.)/.test(ie)?(gt.has(`${te}-regex-pass`)||gt.add(`${te}-regex-pass`),S("chat.subAgentDoneLabel",{n:de[1]})):(gt.has(`${te}-blocked`)||gt.add(`${te}-blocked`),null)}function _d(z){if(!z)return!1;const ie=z.type;if(!at.has(ie)){const te=(z==null?void 0:z.id)||`unknown-${ie||"none"}`;return Wt.has(te)||Wt.add(te),!1}if(z.type==="tool"){const te=(z==null?void 0:z.tool)||{},de=typeof te.name=="string"&&te.name.trim().length>0,Ee=typeof te.message=="string"&&te.message.trim().length>0,fe=te.result!==null&&te.result!==void 0,Qe=te.arguments&&typeof te.arguments=="object"&&Object.keys(te.arguments).length>0;return de||Ee||fe||Qe}return z.type!=="system"?!0:!!Uc(z)}function k_(z=[]){return(z||[]).some(ie=>_d(ie))}function C_(z){if(!z||z.role!=="assistant")return!1;const ie=(z.actions||[]).filter(Ee=>_d(Ee));if(ie.length!==1)return!1;const te=ie[0],de=(te==null?void 0:te.type)==="system"&&!!Uc(te);return de&&jt("ChatArea.isSubAgentNoticeOnlyMessage:hit",{actionId:te==null?void 0:te.id,content:te==null?void 0:te.content}),de}function Fk(z){var Ee;const ie=he(),te=ie[z+1],de=!!te&&C_(te);return de&&jt("ChatArea.isFollowedBySubAgentNotice:hit",{index:z,currentRole:(Ee=ie[z])==null?void 0:Ee.role,nextRole:te==null?void 0:te.role}),de}function Wc(z){var Qe;if(lt.value,z<=0)return"";const ie=T_(z),te=(Qe=ie==null?void 0:ie.metadata)==null?void 0:Qe.work_timer;if(!te||!te.started_at)return"";const de=Date.parse(te.started_at);if(!Number.isFinite(de))return"";if((te.status||"working")==="working")return S("chat.workInProgress",{duration:Sg(Le.value-de)});const fe=typeof te.duration_ms=="number"?te.duration_ms:Math.max(0,(Number.isFinite(Date.parse(te.finished_at||""))?Date.parse(te.finished_at):Le.value)-de);return S("chat.workCompleted",{duration:Sg(fe)})}function Hk(z){return!!T_(z)}function T_(z){if(z<=0)return null;const ie=he(),te=ie[z-1];if(!te||te.role!=="user")return null;for(let de=z-1;de>=0;de-=1){const Ee=ie[de];if(!Ee||Ee.role!=="user")break;if($v(Ee))return Ee}return null}function jf(z){var ie;return String(((ie=z==null?void 0:z.metadata)==null?void 0:ie.message_source)||"user").trim().toLowerCase()}function bl(z){lt.value;const ie=jf(z);return ie==="guidance"?S("chat.userHeaderGuide"):ie==="goal"?S("chat.userHeaderGoal"):ie==="goal_review"?S("chat.userHeaderReview"):ie==="compression"||ie==="compression_handoff"?S("chat.userHeaderCompression"):ie==="notify"||ie==="sub_agent"||ie==="background_command"?S("chat.userHeaderNotify"):v.value}function uo(z){const ie=jf(z);return ie==="guidance"?"navigation":ie==="goal"?"flag":ie==="goal_review"?"circleAlert":ie==="compression"||ie==="compression_handoff"?"layers":ie==="notify"||ie==="sub_agent"||ie==="background_command"?"bell":"user"}function ka(z){return!z||z.role!=="user"||h.value!=="brief"?!1:Fd(z)==="compact"}function zc(z){switch(lt.value,jf(z)){case"goal_review":return S("chat.briefGoalReview");case"sub_agent":return S("chat.briefSubAgent");case"background_command":return S("chat.briefBackgroundCommand");case"compression":case"compression_handoff":return S("chat.briefCompression");case"goal":return S("chat.briefGoal");case"guidance":return S("chat.briefGuidance");case"notify":return S("chat.briefNotify");default:return S("chat.briefSystem")}}Ke(()=>he().map(z=>{var ie;return(z==null?void 0:z.id)??((ie=z==null?void 0:z.content)==null?void 0:ie.slice(0,80))}),()=>{b.value=!0,x(),ft(()=>{requestAnimationFrame(()=>{D(),L(),K()})})},{immediate:!0}),dn(()=>{Hc(),Xo(),typeof ResizeObserver<"u"&&ht.value&&(fi=new ResizeObserver(Xo),fi.observe(ht.value)),typeof ResizeObserver<"u"&&(k=new ResizeObserver(()=>{requestAnimationFrame(D)}),ft(()=>L())),Fi()&&console.warn("[SCROLL_BOUNCE_TRACE]","mounted",{hasScrollRef:!!ht.value}),st=window.setInterval(()=>{Le.value=Date.now()},1e3),Gk()}),Ke(ht,()=>{Hc(),Xo(),fi&&(fi.disconnect(),fi=null),typeof ResizeObserver<"u"&&ht.value&&(fi=new ResizeObserver(Xo),fi.observe(ht.value))}),Rn(()=>{yl(),Mr(),qf(),Qo(),fi&&(fi.disconnect(),fi=null),k&&(k.disconnect(),k=null),m.clear(),w.forEach(z=>window.clearTimeout(z)),w.clear(),st!==null&&(clearInterval(st),st=null),Kk()});const jc=z=>z&&(z.type==="thinking"||z.type==="tool"),kg=z=>!z||z.type!=="text"?!1:!(typeof z.content=="string"?z.content:"").trim(),Vf=(z=[],ie=0)=>{const te=[];let de=[];const Ee=()=>{de.length>=1&&te.push({kind:"stack",actions:de.slice(),key:`stack-${ie}-${te.length}`}),de=[]};return z.forEach((fe,Qe)=>{kg(fe)||(jc(fe)?de.push(fe):(Ee(),te.push({kind:"single",action:fe,actionIndex:Qe,key:fe.id||`single-${ie}-${Qe}`})))}),Ee(),te};function Cg(z){lt.value;const ie=typeof(z==null?void 0:z.generatingLabel)=="string"&&z.generatingLabel.trim()?z.generatingLabel.trim():S("chat.generating");return Array.from(ie)}const ur=ge(null),Tg=ge(null),_l=ge(-1),Gf=new Map,Uk=z=>{var te;if(!z||z.role!=="user")return!1;const ie=String(((te=z==null?void 0:z.metadata)==null?void 0:te.message_source)||"user").trim().toLowerCase();return ie==="user"||ie==="presend"};function wd(z){lt.value;const ie=z==null?void 0:z.content;let te="";return typeof ie=="string"?te=ie:Array.isArray(ie)?te=ie.filter(Ee=>Ee&&Ee.type==="text"&&typeof Ee.text=="string").map(Ee=>Ee.text).join(` `):ie!=null&&(te=String(ie)),te.split(` `).map(Ee=>Ee.trim()).filter(Ee=>Ee&&!Ee.startsWith("[系统通知|"))[0]||S("chat.emptyInput")}function Ag(z){const ie=Array.isArray(z==null?void 0:z.actions)?z.actions:[];for(let de=ie.length-1;de>=0;de-=1){const Ee=ie[de];if((Ee==null?void 0:Ee.type)==="text"&&typeof(Ee==null?void 0:Ee.content)=="string"&&Ee.content.trim())return Ee.content.trim()}const te=z==null?void 0:z.content;return typeof te=="string"?te.trim():""}const ho=be(()=>{lt.value;const z=he(),ie=[];for(let te=0;te{const Ee=de+1te;Qe-=1){const vt=z[Qe];if(!vt||vt.role!=="assistant")continue;const Pt=Ag(vt);if(Pt){fe=Pt;break}}return{msgIndex:te,userText:wd(z[te]),aiText:fe||S("chat.noReply")}})}),A_=[34,25,17,12];function Wk(z){const ie=_l.value;if(ie<0)return tp;const te=Math.abs(z-ie),de=A_[te]??tp;if(de===tp)return de;const Ee=zk.value;return Math.max(tp,Math.round(de*Ee))}const Eg=ge(-1);function E_(z){var Pt;const ie=ho.value;if(!ie.length){Eg.value=-1;return}const te=Tg.value;if(!te)return;const de=typeof z=="number"?z:Number(te.scrollOffset)||0,Ee=Number(te.viewportSize)||((Pt=ur.value)==null?void 0:Pt.clientHeight)||0,fe=de+Ee*.25,Qe=te.findItemIndex(fe);let vt=-1;for(let Lt=0;Lt{E_()});const Kf=ge(100),Mg=ge(!0),xg=ge(wx/2),Sd=be(()=>Kf.value{const z=Kf.value;if(Sd.value==="pinned"){const ie=xg.value-tp/2;return Math.max(0,Math.min(1,(z-ie-6)/gC))}return Sd.value==="center"?Math.max(0,Math.min(1,(z-6)/gC)):1}),jk=be(()=>{const z={"--qn-count":String(ho.value.length)};if(Sd.value==="center")return{...z,left:"0px",width:`${Kf.value}px`};const ie=xg.value-tp/2;return{...z,left:`${ie}px`,width:`${gC}px`}});function M_(){const z=ur.value,ie=Qt.value;if(!z||!ie)return;const te=z.getBoundingClientRect(),de=ie.getBoundingClientRect(),Ee=ht.value,fe=Ee?Math.max(0,Ee.offsetWidth-Ee.clientWidth):0;xg.value=(wx+fe/2)/2,Kf.value=de.left-te.left,Mg.value=de.width>=YU-.5}let Ks=null;function Ir(z,ie){ie?Gf.set(z,ie):Gf.delete(z)}function Vk(z){let ie=-1,te=1/0;Gf.forEach((de,Ee)=>{const fe=de.getBoundingClientRect(),Qe=Math.abs(z.clientY-(fe.top+fe.height/2));Qe"u"||!ur.value||(Ks=new ResizeObserver(()=>{M_()}),Ks.observe(ur.value),Qt.value&&Ks.observe(Qt.value),M_())}function Kk(){Ks&&(Ks.disconnect(),Ks=null)}let Vc=null,wl=!1;function qf(){Vc!==null&&(cancelAnimationFrame(Vc),Vc=null),wl=!1}function qk(z){var vt;const ie=ht.value,te=Tg.value;if(!ie||!te||typeof te.getItemOffset!="function"){(vt=te==null?void 0:te.scrollToIndex)==null||vt.call(te,z,{align:"start",smooth:!0});return}qf(),wl=!0;const de=ie.scrollTop,Ee=performance.now(),fe=380,Qe=()=>{if(Vc=null,!wl)return;const Pt=Math.max(0,ie.scrollHeight-ie.clientHeight),Lt=Math.max(0,Math.min(Number(te.getItemOffset(z))||0,Pt)),Bs=Math.min(1,(performance.now()-Ee)/fe),Fs=1-Math.pow(1-Bs,3);Sa("ChatArea.quickNavJump"),ie.scrollTop=de+(Lt-de)*Fs,Bs<1?Vc=requestAnimationFrame(Qe):(Sa("ChatArea.quickNavJump"),ie.scrollTop=Lt,wl=!1)};Vc=requestAnimationFrame(Qe)}function R_(z){const ie=ht.value,te=Date.now();Er(),Mr(),i("user-scroll-intent",{ts:te,delta:-1,top:ie&&ie.scrollTop||0}),qk(z.msgIndex)}const kd=ge(""),I_=ge(""),Cd=ge({});return Ke(_l,z=>{if(z<0)return;const ie=ho.value[z];if(!ie)return;kd.value=ie.userText,I_.value=ie.aiText;const te=ur.value,de=Gf.get(z);if(!te||!de)return;const Ee=te.getBoundingClientRect(),fe=de.getBoundingClientRect();let vt=fe.top-Ee.top+fe.height/2-Sx/2;vt=Math.max(8,Math.min(vt,Ee.height-Sx-8));const Pt=fe.right-Ee.left+14;Cd.value={top:`${vt}px`,left:`${Pt}px`}}),e({rootEl:Yn,getThinkingRef:Zt,isUsingStickToBottom:()=>!0,getStickState:mi,stopStickScroll:Er,scrollToBottom:Cs,conditionalStickToBottom:pi}),(z,ie)=>(F(),U("div",{class:"chat-area-shell",ref_key:"shellRef",ref:ur},[M("div",{class:Ce(["messages-area messages-area--stick",{"messages-area--render-pending":a.value}]),ref_key:"scrollRef",ref:ht},[M("div",{class:"messages-flow",ref_key:"contentRef",ref:Qt},[Pn.value?(F(),Ft(Ne(E3),{key:0,ref_key:"virtualizerRef",ref:Tg,data:pe.value||[],"scroll-ref":Pn.value,"buffer-size":400,"keep-mounted":qo.value},{default:Gt(({item:te,index:de})=>{var Ee;return[(F(),U("div",{key:ao(te,de),class:Ce(["message-block",{"message-block--compact-user":Ne(Fd)(te)==="compact","message-block--sub-agent-notice":C_(te),"message-block--before-sub-agent-notice":Fk(de),"message-block--multi-agent":le(te),"message-block--first":de===0,"message-block--last":de===(pe.value||[]).length-1}])},[te.role==="user"?(F(),U("div",{key:0,class:Ce(["user-message",{"user-message--multi-agent":le(te),"user-message--compact":Ne(Fd)(te)==="compact","user-message--brief":ka(te)}])},[ka(te)?(F(),U("div",O6,[M("span",D6,Q(zc(te)),1)])):(F(),U(Ie,{key:1},[M("div",{class:Ce(["message-header icon-label",{"message-header--multi-agent":le(te),"message-header--hidden":le(te)&&P(te,de)}])},[le(te)?(F(),U("span",N6,Q(ue(te)),1)):(F(),U(Ie,{key:1},[M("span",{class:"icon icon-sm",style:qe(fs(uo(te))),"aria-hidden":"true"},null,4),M("span",null,Q(bl(te)),1)],64))],2),M("div",{class:Ce(["message-text user-bubble-text",{"is-collapsed":G(te,de),"is-expandable":N(te,de),"is-history-loading":n.historyLoading||b.value}])},[te.content?(F(),U("div",{key:0,class:Ce(["bubble-text",{"is-expanded":O(te,de)}]),ref:fe=>C(te,de,fe)},[le(te)?(F(),Ft(zg,{key:0,content:X(te),"is-streaming":!1},null,8,["content"])):(F(),U("span",{key:1,innerHTML:rt(te.content)},null,8,$6))],2)):me("",!0),te.images&&te.images.length||Ln(te).length?(F(),U("div",B6,[(F(!0),U(Ie,null,Ze(te.images,(fe,Qe)=>(F(),U("div",{class:"image-thumbnail-wrapper",key:Rr(te,fe,Qe),onClick:De(vt=>bd(te,fe),["stop"])},[M("img",{src:Ui(te,fe,"image"),alt:rs(fe),class:"image-thumbnail"},null,8,H6)],8,F6))),128)),Ln(te).length?(F(),Ft(AL,{key:0,files:Ln(te)},null,8,["files"])):me("",!0)])):me("",!0),te.videos&&te.videos.length?(F(),U("div",U6,[(F(!0),U(Ie,null,Ze(te.videos,(fe,Qe)=>(F(),U("div",{class:"image-thumbnail-wrapper",key:Rr(te,fe,Qe)},[M("img",{src:Ui(te,fe,"video"),alt:rs(fe),class:"image-thumbnail"},null,8,W6)]))),128))])):me("",!0),N(te,de)?(F(),U("div",z6,[M("button",{class:Ce(["user-bubble-action-btn user-bubble-expand-btn",{expanded:O(te,de)}]),title:O(te,de)?z.$t("chat.collapse"):z.$t("chat.expand"),"aria-label":O(te,de)?z.$t("chat.collapse"):z.$t("chat.expand"),onClick:De(fe=>Z(te,de),["stop"])},null,10,j6)])):me("",!0)],2),le(te)?me("",!0):(F(),U("div",V6,[M("button",{class:Ce(["user-bubble-action-btn copy",{copied:V(te,de)}]),title:V(te,de)?z.$t("common.copied"):z.$t("common.copy"),"aria-label":V(te,de)?z.$t("common.copied"):z.$t("common.copy"),onClick:fe=>I(te,de)},null,10,G6),M("button",{class:"user-bubble-action-btn branch",title:z.$t("chat.branch"),"aria-label":z.$t("chat.branch"),onClick:fe=>$(te)},null,8,K6),M("span",q6,Q(q(te)),1)]))],64))],2)):te.role==="assistant"?(F(),U("div",Q6,[Hk(de)&&(k_(te.actions||[])||te.awaitingFirstContent)?(F(),U("div",X6,[M("span",null,Q(g.value),1),Wc(de)?(F(),U("span",Y6,Q(Wc(de)),1)):me("",!0)])):me("",!0),te.awaitingFirstContent?(F(),U("div",J6,[M("div",Z6,[M("div",eU,[(F(!0),U(Ie,null,Ze(Cg(te),(fe,Qe)=>(F(),U("span",{key:Qe,class:"assistant-generating-letter",style:qe({animationDelay:`${Qe*.08}s`})},Q(fe),5))),128))])])])):me("",!0),d.value==="minimal"?(F(),U(Ie,{key:2},[k_(te.actions||[])?(F(),Ft(zH,{key:0,actions:te.actions||[],citations:l(te),"citations-final":u(te),"enable-citations":"","conversation-running":s.streamingMessage,"is-latest-message":de===ke.value,"icon-style":fs,"get-tool-icon":s.getToolIcon,"get-tool-status-text":s.getToolStatusText,"get-tool-description":s.getToolDescription,"format-search-topic":s.formatSearchTopic,"format-search-time":s.formatSearchTime,"format-search-domains":s.formatSearchDomains,"register-thinking-ref":Tt,"handle-thinking-scroll":n.handleThinkingScroll,onGroupToggle:Ge},null,8,["actions","citations","citations-final","conversation-running","is-latest-message","get-tool-icon","get-tool-status-text","get-tool-description","format-search-topic","format-search-time","format-search-domains","handle-thinking-scroll"])):me("",!0)],64)):p.value?(F(!0),U(Ie,{key:3},Ze(Vf(te.actions||[],de),fe=>{var Qe,vt,Pt,Lt,Bs,Fs,fo,Jo,Sl,Ca,kl,po,Rg,P_,W,j,ee,Te,Re,Ve,Ue,Ye,Xe,xt,Ot;return F(),U(Ie,{key:fe.key},[fe.kind==="stack"?(F(),Ft(K5,{key:0,class:"stacked-blocks-wrapper",actions:fe.actions,"expanded-blocks":s.expandedBlocks,"conversation-running":s.streamingMessage,"is-latest-message":de===ke.value,"icon-style":fs,"toggle-block":s.toggleBlock,"register-thinking-ref":Tt,"handle-thinking-scroll":s.handleThinkingScroll,"get-tool-animation-class":s.getToolAnimationClass,"get-tool-icon":s.getToolIcon,"get-tool-status-text":s.getToolStatusText,"get-tool-description":s.getToolDescription,"format-search-topic":s.formatSearchTopic,"format-search-time":s.formatSearchTime,"format-search-domains":s.formatSearchDomains,onMoreToggle:Me},null,8,["actions","expanded-blocks","conversation-running","is-latest-message","toggle-block","handle-thinking-scroll","get-tool-animation-class","get-tool-icon","get-tool-status-text","get-tool-description","format-search-topic","format-search-time","format-search-domains"])):_d(fe.action)?(F(),U("div",{class:Ce(["action-item",{"streaming-content":(Qe=fe.action)==null?void 0:Qe.streaming,"completed-tool":((vt=fe.action)==null?void 0:vt.type)==="tool"&&!((Pt=fe.action)!=null&&Pt.streaming),"immediate-show":((Lt=fe.action)==null?void 0:Lt.streaming)||((Bs=fe.action)==null?void 0:Bs.type)==="text"||((Fs=fe.action)==null?void 0:Fs.type)==="thinking","thinking-finished":((fo=fe.action)==null?void 0:fo.type)==="thinking"&&!((Jo=fe.action)!=null&&Jo.streaming),"no-entry-animation":!s.streamingMessage||de!==ke.value}]),key:((Sl=fe.action)==null?void 0:Sl.id)||`${de}-${fe.actionIndex}`},[((Ca=fe.action)==null?void 0:Ca.type)==="thinking"?(F(),U("div",{key:0,class:Ce(["collapsible-block thinking-block",{expanded:(kl=s.expandedBlocks)==null?void 0:kl.has(fe.action.blockId||`${de}-thinking-${fe.actionIndex}`)}]),"data-block-id":fe.action.blockId||`${de}-thinking-${fe.actionIndex}`},[M("div",{class:"collapsible-header",onClick:Jt=>s.toggleBlock(fe.action.blockId||`${de}-thinking-${fe.actionIndex}`)},[ie[0]||(ie[0]=M("div",{class:"arrow"},null,-1)),M("div",nU,[M("span",{class:Ce(["thinking-icon",{"thinking-animation":fe.action.streaming}])},[M("span",{class:"icon icon-sm",style:qe(fs("brain")),"aria-hidden":"true"},null,4)],2)]),M("span",iU,Q(fe.action.streaming?z.$t("chat.thinkingRunning"):z.$t("chat.thinking")),1)],8,sU),M("div",{class:"collapsible-content",ref_for:!0,ref:Jt=>Bt(fe.action.blockId||`${de}-thinking-${fe.actionIndex}`,Jt)},[M("div",{class:"content-inner thinking-content",ref_for:!0,ref:Jt=>Tt(fe.action.blockId||`${de}-thinking-${fe.actionIndex}`,Jt),onScroll:Jt=>s.handleThinkingScroll(fe.action.blockId||`${de}-thinking-${fe.actionIndex}`,Jt),style:{"max-height":"240px","overflow-y":"auto"}},Q(fe.action.content),41,rU)],512)],10,tU)):((po=fe.action)==null?void 0:po.type)==="text"?(F(),U("div",oU,[M("div",{class:Ce(["text-content",{"streaming-text":fe.action.streaming}])},[We(zg,{content:fe.action.content||"","is-streaming":fe.action.streaming,citations:l(te),"citations-final":u(te),"enable-citations":""},null,8,["content","is-streaming","citations","citations-final"])],2)])):((Rg=fe.action)==null?void 0:Rg.type)==="system"&&Uc(fe.action)?(F(),U("div",aU,Q(Uc(fe.action)),1)):((P_=fe.action)==null?void 0:P_.type)==="append_payload"?(F(),U("div",{key:3,class:Ce(["append-placeholder",{"append-error":((W=fe.action.append)==null?void 0:W.success)===!1}])},[M("div",lU,[((j=fe.action.append)==null?void 0:j.success)!==!1?(F(),U("div",cU,[M("span",{class:"icon icon-sm",style:qe(fs("pencil")),"aria-hidden":"true"},null,4),M("span",null,Q(z.$t("chat.appendSuccess",{path:((ee=fe.action.append)==null?void 0:ee.path)||z.$t("chat.targetFile")})),1)])):(F(),U("div",uU,[M("span",{class:"icon icon-sm",style:qe(fs("x")),"aria-hidden":"true"},null,4),M("span",null,Q(z.$t("chat.appendFailed",{path:((Te=fe.action.append)==null?void 0:Te.path)||z.$t("chat.targetFile")})),1)])),fe.action.append?(F(),U("div",dU,[fe.action.append.lines!==null&&fe.action.append.lines!==void 0?(F(),U("span",hU,Q(z.$t("chat.linesCount",{n:fe.action.append.lines})),1)):me("",!0),fe.action.append.bytes!==null&&fe.action.append.bytes!==void 0?(F(),U("span",fU,Q(z.$t("chat.bytesCount",{n:fe.action.append.bytes})),1)):me("",!0)])):me("",!0),(Re=fe.action.append)!=null&&Re.forced?(F(),U("div",pU,[M("span",{class:"icon icon-sm",style:qe(fs("triangleAlert")),"aria-hidden":"true"},null,4),M("span",null,Q(z.$t("chat.appendWarning")),1)])):me("",!0)])],2)):((Ve=fe.action)==null?void 0:Ve.type)==="append"?(F(),U("div",{key:4,class:Ce(["append-placeholder",{"append-error":((Ue=fe.action.append)==null?void 0:Ue.success)===!1}])},[M("div",mU,[M("div",gU,[M("span",{class:"icon icon-sm",style:qe(fs("pencil")),"aria-hidden":"true"},null,4),M("span",null,Q(((Ye=fe.action.append)==null?void 0:Ye.summary)||z.$t("chat.appendDone")),1)]),fe.action.append?(F(),U("div",vU,[M("span",null,Q(fe.action.append.path||z.$t("chat.targetFile")),1),fe.action.append.lines?(F(),U("span",yU,Q(z.$t("chat.linesCount",{n:fe.action.append.lines})),1)):me("",!0),fe.action.append.bytes?(F(),U("span",bU,Q(z.$t("chat.bytesCount",{n:fe.action.append.bytes})),1)):me("",!0)])):me("",!0),(Xe=fe.action.append)!=null&&Xe.forced?(F(),U("div",_U,[M("span",{class:"icon icon-sm",style:qe(fs("triangleAlert")),"aria-hidden":"true"},null,4),M("span",null,Q(z.$t("chat.appendWarningFollow")),1)])):me("",!0)])],2)):((xt=fe.action)==null?void 0:xt.type)==="tool"?(F(),Ft(cx,{key:5,action:fe.action,expanded:(Ot=s.expandedBlocks)==null?void 0:Ot.has(fe.action.blockId||`${de}-tool-${fe.actionIndex}`),"icon-style":fs,"get-tool-animation-class":s.getToolAnimationClass,"get-tool-icon":s.getToolIcon,"get-tool-status-text":s.getToolStatusText,"get-tool-description":s.getToolDescription,"format-search-topic":s.formatSearchTopic,"format-search-time":s.formatSearchTime,"format-search-domains":s.formatSearchDomains,"streaming-message":s.streamingMessage,"register-collapse-content":Bt,"collapse-key":fe.action.blockId||`${de}-tool-${fe.actionIndex}`,"block-id":fe.action.blockId||`${de}-tool-${fe.actionIndex}`,onToggle:Jt=>s.toggleBlock(fe.action.blockId||`${de}-tool-${fe.actionIndex}`)},null,8,["action","expanded","get-tool-animation-class","get-tool-icon","get-tool-status-text","get-tool-description","format-search-topic","format-search-time","format-search-domains","streaming-message","collapse-key","block-id","onToggle"])):me("",!0)],2)):me("",!0)],64)}),128)):(F(!0),U(Ie,{key:4},Ze(te.actions||[],(fe,Qe)=>{var vt,Pt,Lt,Bs,Fs,fo,Jo,Sl,Ca,kl;return F(),U(Ie,{key:fe.id||`${de}-${Qe}`},[_d(fe)?(F(),U("div",{key:0,class:Ce(["action-item",{"streaming-content":fe.streaming,"completed-tool":fe.type==="tool"&&!fe.streaming,"immediate-show":fe.streaming||fe.type==="text"||fe.type==="thinking","thinking-finished":fe.type==="thinking"&&!fe.streaming,"no-entry-animation":!s.streamingMessage||de!==ke.value}])},[fe.type==="thinking"?(F(),U("div",{key:0,class:Ce(["collapsible-block thinking-block",{expanded:(vt=s.expandedBlocks)==null?void 0:vt.has(fe.blockId||`${de}-thinking-${Qe}`)}]),"data-block-id":fe.blockId||`${de}-thinking-${Qe}`},[M("div",{class:"collapsible-header",onClick:po=>s.toggleBlock(fe.blockId||`${de}-thinking-${Qe}`)},[ie[1]||(ie[1]=M("div",{class:"arrow"},null,-1)),M("div",kU,[M("span",{class:Ce(["thinking-icon",{"thinking-animation":fe.streaming}])},[M("span",{class:"icon icon-sm",style:qe(fs("brain")),"aria-hidden":"true"},null,4)],2)]),M("span",CU,Q(fe.streaming?z.$t("chat.thinkingRunning"):z.$t("chat.thinking")),1)],8,SU),M("div",{class:"collapsible-content",ref_for:!0,ref:po=>Bt(fe.blockId||`${de}-thinking-${Qe}`,po)},[M("div",{class:"content-inner thinking-content",ref_for:!0,ref:po=>Tt(fe.blockId||`${de}-thinking-${Qe}`,po),onScroll:po=>s.handleThinkingScroll(fe.blockId||`${de}-thinking-${Qe}`,po),style:{"max-height":"240px","overflow-y":"auto"}},Q(fe.content),41,TU)],512)],10,wU)):fe.type==="text"?(F(),U("div",AU,[M("div",{class:Ce(["text-content",{"streaming-text":fe.streaming}])},[We(zg,{content:fe.content||"","is-streaming":fe.streaming,citations:l(te),"citations-final":u(te),"enable-citations":""},null,8,["content","is-streaming","citations","citations-final"])],2)])):fe.type==="system"&&Uc(fe)?(F(),U("div",EU,Q(Uc(fe)),1)):fe.type==="append_payload"?(F(),U("div",{key:3,class:Ce(["append-placeholder",{"append-error":((Pt=fe.append)==null?void 0:Pt.success)===!1}])},[M("div",MU,[((Lt=fe.append)==null?void 0:Lt.success)!==!1?(F(),U("div",xU,[M("span",{class:"icon icon-sm",style:qe(fs("pencil")),"aria-hidden":"true"},null,4),M("span",null,Q(z.$t("chat.appendSuccess",{path:((Bs=fe.append)==null?void 0:Bs.path)||z.$t("chat.targetFile")})),1)])):(F(),U("div",RU,[M("span",{class:"icon icon-sm",style:qe(fs("x")),"aria-hidden":"true"},null,4),M("span",null,Q(z.$t("chat.appendFailed",{path:((Fs=fe.append)==null?void 0:Fs.path)||z.$t("chat.targetFile")})),1)])),fe.append?(F(),U("div",IU,[fe.append.lines!==null&&fe.append.lines!==void 0?(F(),U("span",PU,Q(z.$t("chat.linesCount",{n:fe.append.lines})),1)):me("",!0),fe.append.bytes!==null&&fe.append.bytes!==void 0?(F(),U("span",LU,Q(z.$t("chat.bytesCount",{n:fe.append.bytes})),1)):me("",!0)])):me("",!0),(fo=fe.append)!=null&&fo.forced?(F(),U("div",OU,[M("span",{class:"icon icon-sm",style:qe(fs("triangleAlert")),"aria-hidden":"true"},null,4),M("span",null,Q(z.$t("chat.appendWarning")),1)])):me("",!0)])],2)):fe.type==="append"?(F(),U("div",{key:4,class:Ce(["append-placeholder",{"append-error":((Jo=fe.append)==null?void 0:Jo.success)===!1}])},[M("div",DU,[M("div",NU,[M("span",{class:"icon icon-sm",style:qe(fs("pencil")),"aria-hidden":"true"},null,4),M("span",null,Q(((Sl=fe.append)==null?void 0:Sl.summary)||z.$t("chat.appendDone")),1)]),fe.append?(F(),U("div",$U,[M("span",null,Q(fe.append.path||z.$t("chat.targetFile")),1),fe.append.lines?(F(),U("span",BU,Q(z.$t("chat.linesCount",{n:fe.append.lines})),1)):me("",!0),fe.append.bytes?(F(),U("span",FU,Q(z.$t("chat.bytesCount",{n:fe.append.bytes})),1)):me("",!0)])):me("",!0),(Ca=fe.append)!=null&&Ca.forced?(F(),U("div",HU,[M("span",{class:"icon icon-sm",style:qe(fs("triangleAlert")),"aria-hidden":"true"},null,4),M("span",null,Q(z.$t("chat.appendWarningFollow")),1)])):me("",!0)])],2)):fe.type==="tool"?(F(),Ft(cx,{key:5,action:fe,expanded:(kl=s.expandedBlocks)==null?void 0:kl.has(fe.blockId||`${de}-tool-${Qe}`),"icon-style":fs,"get-tool-animation-class":s.getToolAnimationClass,"get-tool-icon":s.getToolIcon,"get-tool-status-text":s.getToolStatusText,"get-tool-description":s.getToolDescription,"format-search-topic":s.formatSearchTopic,"format-search-time":s.formatSearchTime,"format-search-domains":s.formatSearchDomains,"streaming-message":s.streamingMessage,"register-collapse-content":Bt,"collapse-key":fe.blockId||`${de}-tool-${Qe}`,"block-id":fe.blockId||`${de}-tool-${Qe}`,onToggle:po=>s.toggleBlock(fe.blockId||`${de}-tool-${Qe}`)},null,8,["action","expanded","get-tool-animation-class","get-tool-icon","get-tool-status-text","get-tool-description","format-search-topic","format-search-time","format-search-domains","streaming-message","collapse-key","block-id","onToggle"])):me("",!0)],2)):me("",!0)],64)}),128)),ye.value.has(de)?(F(),Ft(_6,{key:5,summary:ye.value.get(de),"icon-style":fs},null,8,["summary"])):me("",!0)])):(F(),U("div",UU,[M("div",{class:Ce(["collapsible-block system-block",{expanded:(Ee=s.expandedBlocks)==null?void 0:Ee.has(`system-${de}`)}]),"data-block-id":`system-${de}`},[M("div",{class:"collapsible-header",onClick:fe=>s.toggleBlock(`system-${de}`)},[ie[2]||(ie[2]=M("div",{class:"arrow"},null,-1)),M("div",jU,[M("span",{class:"tool-icon icon icon-md",style:qe(fs("info")),"aria-hidden":"true"},null,4)]),M("span",VU,Q(z.$t("chat.systemMessage",{role:te.role})),1)],8,zU),M("div",{class:"collapsible-content",ref:fe=>Bt(`system-${de}`,fe)},[M("div",GU,Q(te.content),1)],512)],10,WU)]))],2))]}),_:1},8,["data","scroll-ref","keep-mounted"])):me("",!0)],512),ie[3]||(ie[3]=M("div",{class:"messages-bottom-spacer","aria-hidden":"true"},null,-1))],2),ho.value.length>0&&Sd.value!=="hidden"?(F(),U("nav",{key:0,class:Ce(["chat-quick-nav",{"chat-quick-nav--center":Sd.value==="center"}]),style:qe(jk.value),"aria-label":z.$t("chat.quickNavAria"),onMousemove:Vk,onMouseleave:x_},[(F(!0),U(Ie,null,Ze(ho.value,(te,de)=>(F(),U("div",{key:te.msgIndex,class:Ce(["qn-line",{"is-hot":_l.value===de,"is-current":Eg.value===de}]),style:qe({width:Wk(de)+"px"}),ref_for:!0,ref:Ee=>Ir(de,Ee),onClick:Ee=>R_(te)},null,14,qU))),128))],46,KU)):me("",!0),M("div",{class:Ce(["quick-nav-preview",{"is-visible":_l.value>=0}]),style:qe(Cd.value)},[M("div",QU,Q(kd.value),1),M("div",XU,[We(zg,{content:I_.value,"is-streaming":!1},null,8,["content"])])],6)],512))}}),e8=["aria-label"],t8={class:"ws-switcher__header"},s8={class:"ws-switcher__title"},n8={class:"ws-switcher__count"},i8=["data-ws-id","aria-selected","onClick"],r8={key:0,class:"ws-confirm"},o8={class:"ws-confirm-text"},a8={class:"ws-confirm-actions"},l8=["disabled"],c8=["disabled","onClick"],u8={class:"ws-row-text"},d8=["disabled","onKeydown"],h8={key:1,class:"ws-row-name"},f8={key:2,class:"ws-row-path"},p8={class:"ws-row-meta"},m8={key:0,class:"ws-tag"},g8=["aria-expanded","aria-label","onClick"],v8={key:0,class:"ws-empty"},y8=["disabled"],b8=["placeholder","disabled"],_8=["placeholder","disabled"],w8={key:1,class:"ws-create-error"},S8={class:"ws-create-actions"},k8=["disabled"],C8=["disabled"],T8=["disabled"],A8=["disabled"],E8=["disabled"],M8=["disabled"],vC=300,x8=480,R8=ct({name:"WorkspaceSwitcher",__name:"WorkspaceSwitcher",props:{open:{type:Boolean},anchorRect:{default:null},workspaces:{default:()=>[]},currentWorkspaceId:{default:""},defaultWorkspaceId:{default:""},workspaceKind:{default:"workspace"},busy:{type:Boolean,default:!1},createSubmitting:{type:Boolean,default:!1},errorMessage:{default:""}},emits:["close","switch","create","rename","delete","set-default","reveal"],setup(s,{emit:e}){const t=s,n=e,i=be(()=>t.workspaceKind==="project"),r=be(()=>i.value?"sidebar.project":"sidebar.workspace"),o=ge(null),a=ge(null),c=ge(null),l=ge(null),u=ge(null),d=ge(null),h=ge(null),p=ge(null),g=ge(""),v=ge(!1),m=ge(""),y=ge(""),_=ge(!1),b=ge({}),k=()=>{var ue;const L=t.anchorRect;if(!L||typeof window>"u")return;const K=window.innerWidth,se=window.innerHeight,oe=((ue=o.value)==null?void 0:ue.offsetHeight)||360;let ve=L.right+8,le=L.top-6;KK-8&&(ve=Math.max(8,Math.min(L.left,K-vC-8)),le=L.bottom+6),le+oe>se-8&&(le=Math.max(8,se-oe-8)),b.value={left:`${Math.round(ve)}px`,top:`${Math.round(le)}px`}},w=ge({}),T=()=>{d.value=null},A=async L=>{var ne;if(t.busy)return;if(d.value===L.workspace_id){T();return}h.value=null,p.value=null,d.value=L.workspace_id,await ft();const K=L.workspace_id,se=(ne=a.value)==null?void 0:ne.querySelector(`.ws-row[data-ws-id="${CSS.escape(K)}"]`),oe=se==null?void 0:se.querySelector(".ws-more");if(!oe){T();return}const ve=oe.getBoundingClientRect(),le=document.querySelector(".ws-menu-floating"),ue=(le==null?void 0:le.offsetWidth)||150,P=(le==null?void 0:le.offsetHeight)||150;let X=ve.right-ue,J=ve.bottom+4;X=Math.max(8,Math.min(X,window.innerWidth-ue-8)),J+P>window.innerHeight-8&&(J=ve.top-P-4),w.value={left:`${Math.round(X)}px`,top:`${Math.round(J)}px`}},C=L=>{const K=d.value,se=t.workspaces.find(oe=>oe.workspace_id===K);T(),se&&(L==="set-default"?n("set-default",se.workspace_id):L==="rename"?(h.value=se.workspace_id,g.value=se.label,ft(()=>{var ve;const oe=(ve=u.value)==null?void 0:ve[0];oe==null||oe.focus(),oe==null||oe.select()})):L==="reveal"?n("reveal",se.workspace_id):L==="delete"&&(p.value=se.workspace_id))},E=L=>{if(!t.busy&&!(h.value||p.value)){if(d.value){T();return}L.workspace_id!==t.currentWorkspaceId&&n("switch",L.workspace_id)}},x=L=>{const K=g.value.trim();K&&K!==L.label&&n("rename",{workspace_id:L.workspace_id,label:K}),h.value=null},D=L=>{p.value=null,n("delete",L)};let N=!1;const O=(L,K)=>{if(N)return;N=!0;const se=c.value;if(!se){v.value=L,N=!1,K&&K();return}const oe=se.offsetHeight;se.style.height=`${oe}px`,_.value=!0,window.setTimeout(()=>{v.value=L,ft(()=>{se.style.height="auto";const ve=se.offsetHeight;se.style.height=`${oe}px`,se.offsetHeight,se.style.height=`${ve}px`,_.value=!1,window.setTimeout(()=>{se.style.height="",N=!1,K&&K()},210)})},130)},G=()=>{v.value||t.busy||(T(),m.value="",y.value="",O(!0,()=>{var L;return(L=l.value)==null?void 0:L.focus()}))},Z=()=>{v.value&&O(!1)},q=()=>{n("create",{path:m.value.trim(),label:y.value.trim()})};Ke(()=>t.createSubmitting,(L,K)=>{K&&!L&&v.value&&!t.errorMessage&&Z()});const V=L=>{var se;const K=L.target;if(K&&!((se=K.closest)!=null&&se.call(K,".ws-menu-floating"))&&o.value&&!o.value.contains(K)){const oe=t.anchorRect;if(oe){const ve=L.clientX,le=L.clientY;if(ve>=oe.left&&ve<=oe.right&&le>=oe.top&&le<=oe.bottom)return}n("close")}},I=L=>{if(L.key==="Escape"){if(d.value){T();return}if(h.value||p.value){h.value=null,p.value=null;return}if(v.value){Z();return}n("close")}},$=()=>{T(),k()};return Ke(()=>t.open,async L=>{L?(d.value=null,h.value=null,p.value=null,await ft(),k(),document.addEventListener("click",V,!0),document.addEventListener("keydown",I),window.addEventListener("resize",$)):(v.value&&(v.value=!1),document.removeEventListener("click",V,!0),document.removeEventListener("keydown",I),window.removeEventListener("resize",$))}),Rn(()=>{document.removeEventListener("click",V,!0),document.removeEventListener("keydown",I),window.removeEventListener("resize",$)}),(L,K)=>(F(),Ft(Tf,{to:"body"},[We(gs,{name:"ws-switcher"},{default:Gt(()=>[s.open?(F(),U("div",{key:0,ref_key:"popoverEl",ref:o,class:Ce(["ws-switcher",{"ws-switcher--project":i.value}]),style:qe(b.value),role:"dialog","aria-label":L.$t(r.value),onClick:K[6]||(K[6]=De(()=>{},["stop"]))},[M("div",t8,[M("span",s8,Q(L.$t(r.value)),1),M("span",n8,Q(L.$t("sidebar.workspaceCount",{n:s.workspaces.length})),1)]),M("div",{class:"ws-switcher__list",ref_key:"listEl",ref:a,onScroll:T},[(F(!0),U(Ie,null,Ze(s.workspaces,se=>(F(),U("div",{key:se.workspace_id,class:Ce(["ws-row",{current:se.workspace_id===s.currentWorkspaceId,"menu-open":d.value===se.workspace_id}]),"data-ws-id":se.workspace_id,role:"option","aria-selected":se.workspace_id===s.currentWorkspaceId,onClick:oe=>E(se)},[p.value===se.workspace_id?(F(),U("div",r8,[M("div",o8,Q(L.$t(i.value?"sidebar.deleteProjectConfirm":"sidebar.deleteWorkspaceConfirm",{label:se.label})),1),M("div",a8,[M("button",{type:"button",class:"ws-btn ghost",disabled:s.busy,onClick:K[0]||(K[0]=De(oe=>p.value=null,["stop"]))},Q(L.$t("common.cancel")),9,l8),M("button",{type:"button",class:"ws-btn danger",disabled:s.busy,onClick:De(oe=>D(se),["stop"])},Q(L.$t("common.delete")),9,c8)])])):(F(),U(Ie,{key:1},[K[13]||(K[13]=M("span",{class:"ws-row-icon","aria-hidden":"true"},[M("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","stroke-linejoin":"round"},[M("path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"})])],-1)),M("span",u8,[h.value===se.workspace_id?Ov((F(),U("input",{key:0,ref_for:!0,ref_key:"renameInputEl",ref:u,"onUpdate:modelValue":K[1]||(K[1]=oe=>g.value=oe),class:"ws-rename-input",disabled:s.busy,onClick:K[2]||(K[2]=De(()=>{},["stop"])),onKeydown:[Dv(De(oe=>x(se),["prevent"]),["enter"]),K[3]||(K[3]=Dv(De(oe=>h.value=null,["prevent"]),["esc"]))]},null,40,d8)),[[yw,g.value]]):(F(),U("span",h8,Q(se.label),1)),i.value?me("",!0):(F(),U("span",f8,Q(se.path||L.$t("sidebar.unconfiguredPath")),1))]),M("span",p8,[se.workspace_id===s.defaultWorkspaceId?(F(),U("span",m8,Q(L.$t("sidebar.default")),1)):me("",!0),M("button",{type:"button",class:"ws-more","aria-expanded":d.value===se.workspace_id,"aria-label":L.$t("common.moreActions"),onClick:De(oe=>A(se),["stop"])},[...K[12]||(K[12]=[M("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true"},[M("circle",{cx:"5",cy:"12",r:"1.6"}),M("circle",{cx:"12",cy:"12",r:"1.6"}),M("circle",{cx:"19",cy:"12",r:"1.6"})],-1)])],8,g8)])],64))],10,i8))),128)),s.workspaces.length?me("",!0):(F(),U("div",v8,Q(i.value?L.$t("sidebar.noProjects"):L.$t("sidebar.noWorkspaces")),1))],544),M("div",{class:"ws-bottom",ref_key:"bottomEl",ref:c},[v.value?(F(),U("form",{key:1,class:Ce(["ws-create-form",{fading:_.value}]),onSubmit:De(q,["prevent"])},[Ov(M("input",{ref_key:"createNameEl",ref:l,"onUpdate:modelValue":K[4]||(K[4]=se=>y.value=se),type:"text",placeholder:i.value?L.$t("sidebar.projectNamePlaceholder"):L.$t("sidebar.workspaceNamePlaceholder"),autocomplete:"off",disabled:s.createSubmitting},null,8,b8),[[yw,y.value]]),i.value?me("",!0):Ov((F(),U("input",{key:0,"onUpdate:modelValue":K[5]||(K[5]=se=>m.value=se),type:"text",placeholder:L.$t("sidebar.pathPlaceholder"),autocomplete:"off",disabled:s.createSubmitting},null,8,_8)),[[yw,m.value]]),s.errorMessage?(F(),U("div",w8,Q(s.errorMessage),1)):me("",!0),M("div",S8,[M("button",{type:"button",class:"ws-btn ghost",disabled:s.createSubmitting,onClick:De(Z,["stop"])},Q(L.$t("common.cancel")),9,k8),M("button",{type:"submit",class:"ws-btn primary",disabled:s.createSubmitting},Q(s.createSubmitting?L.$t("sidebar.creating"):L.$t("sidebar.create")),9,C8)])],34)):(F(),U("div",{key:0,class:Ce(["ws-footer",{fading:_.value}])},[M("button",{type:"button",class:"ws-create-btn",disabled:s.busy,onClick:De(G,["stop"])},[K[14]||(K[14]=M("span",{class:"ws-create-icon","aria-hidden":"true"},[M("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","stroke-linejoin":"round"},[M("path",{d:"M5 12h14"}),M("path",{d:"M12 5v14"})])],-1)),M("span",null,Q(L.$t("sidebar.createNoun",{noun:L.$t(r.value)})),1)],8,y8)],2))],512)],14,e8)):me("",!0)]),_:1}),We(gs,{name:"ws-menu"},{default:Gt(()=>[d.value?(F(),U("div",{key:0,class:"ws-menu-floating",style:qe(w.value),role:"menu",onClick:K[11]||(K[11]=De(()=>{},["stop"]))},[M("button",{type:"button",disabled:d.value===s.defaultWorkspaceId||s.busy,onClick:K[7]||(K[7]=se=>C("set-default"))},Q(L.$t("sidebar.setDefault")),9,T8),M("button",{type:"button",disabled:s.busy,onClick:K[8]||(K[8]=se=>C("rename"))},Q(L.$t("sidebar.rename")),9,A8),M("button",{type:"button",disabled:i.value||s.busy,onClick:K[9]||(K[9]=se=>C("reveal"))},Q(L.$t("sidebar.revealInFolder")),9,E8),K[15]||(K[15]=M("div",{class:"ws-menu-sep"},null,-1)),M("button",{type:"button",class:"danger",disabled:s.busy,onClick:K[10]||(K[10]=se=>C("delete"))},Q(L.$t("common.delete")),9,M8)],4)):me("",!0)]),_:1})]))}}),I8=qt(R8,[["__scopeId","data-v-e7284b1f"]]),P8={class:"conversation-sidebar-inner"},L8={class:"conversation-primary-actions"},O8=["title"],D8={class:"sidebar-nav-label"},N8=["title"],$8={class:"sidebar-nav-label"},B8=["title"],F8={class:"sidebar-nav-label"},H8=["title"],U8={class:"sidebar-nav-label"},W8={class:"conversation-search"},z8={class:"search-input-wrap"},j8={class:"sidebar-nav-icon search-inline-icon","aria-hidden":"true"},V8=["value","placeholder"],G8={key:0,class:"conversation-type-switch"},K8={key:0,class:"running-task-section"},q8={class:"running-task-section-title"},Q8=["onClick"],X8={class:"running-task-workspace"},Y8={class:"running-task-main"},J8={class:"running-task-title"},Z8=["aria-label"],eW=["aria-label"],tW=["onMouseenter"],sW=["onClick"],nW={class:"workspace-group-label"},iW=["aria-label"],rW=["aria-label"],oW=["title","aria-label","onClick"],aW=["title","aria-label","aria-expanded","onClick"],lW=["onClick"],cW=["onClick"],uW=["onClick"],dW={class:"workspace-group-children-inner"},hW={key:0,class:"workspace-no-conversations"},fW=["onClick"],pW={class:"conversation-title"},mW=["aria-label","title"],gW=["aria-label","title"],vW=["title","aria-label","data-action-trigger","aria-expanded","onClick"],yW=["onClick"],bW=["onClick"],_W={key:0,class:"load-more workspace-load-more"},wW=["disabled","onClick"],SW={key:2,class:"workspace-groups search-result-groups"},kW={key:0,class:"no-conversations"},CW={class:"workspace-group-header search-result-group-header"},TW={class:"workspace-group-toggle search-result-group-toggle"},AW={class:"workspace-group-label"},EW={class:"workspace-group-children expanded"},MW={class:"workspace-group-children-inner"},xW={class:"workspace-conversations-list"},RW=["onClick"],IW={class:"conversation-title"},PW=["aria-label","title"],LW=["aria-label","title"],OW=["title","aria-label","data-action-trigger","aria-expanded","onClick"],DW=["onClick"],NW=["onClick"],$W={key:0,class:"loading-conversations"},BW={key:1,class:"no-conversations"},FW=["onClick"],HW={class:"conversation-title"},UW=["aria-label","title"],WW=["aria-label","title"],zW=["title","aria-label","data-action-trigger","aria-expanded","onClick"],jW=["onClick"],VW=["onClick"],GW={key:4,class:"load-more"},KW=["disabled"],qW={key:5,class:"load-more search-more"},QW={key:0,class:"search-progress"},XW={class:"search-spinner","aria-hidden":"true"},YW={class:"search-spinner-orbit"},JW={class:"search-progress-text"},ZW={key:2,class:"search-done"},ez={class:"workspace-rename-card"},tz={class:"workspace-rename-title"},sz=["placeholder","onKeydown"],nz={class:"workspace-rename-actions"},iz=["title"],rz={class:"sidebar-nav-label personal-label"},oz=ct({name:"ConversationSidebar",__name:"ConversationSidebar",props:{formatTime:{},iconStyle:{},showCollapseButton:{type:Boolean,default:!0},collapseButtonVariant:{default:"toggle"},runningTasks:{default:()=>[]},currentWorkspaceId:{default:""},defaultWorkspaceId:{default:""},workspaces:{default:()=>[]},workspaceKind:{default:"workspace"},workspaceBusy:{type:Boolean,default:!1},workspaceCreateSubmitting:{type:Boolean,default:!1},workspaceError:{default:""},hostWorkspaceEnabled:{type:Boolean,default:!1},groupByWorkspace:{type:Boolean,default:!1},versioningHostMode:{type:Boolean,default:!1},currentTaskInProgress:{type:Boolean,default:!1},currentConversationId:{default:""}},emits:["toggle","create","search","search-submit","select","select-running-task","load-more","search-more","personal","delete","duplicate","switch-workspace","create-workspace","delete-workspace","set-default-workspace","select-workspace-conversation","create-workspace-conversation","reveal-workspace","rename-workspace","pin-workspace","conversation-type-change","open-workflows"],setup(s,{emit:e}){const t=s,n=e,i=Is(),r=kr(),o=Js(),a=be(()=>r.sidebarConversationType),c=be(()=>a.value==="multi_agent"?"type-slide-left":"type-slide-right"),l=ge(null),u=re=>{r.sidebarConversationType!==re&&(l.value&&(l.value.scrollTop=0),r.setSidebarConversationType(re),n("conversation-type-change",re))},{sidebarCollapsed:d}=xi(i),{searchQuery:h,searchResults:p,searchGroups:g,searchActive:v,searchInProgress:m,searchMoreAvailable:y,conversations:_,conversationInsertAnimations:b,conversationListAnimationMode:k,pendingDeletingConversationIds:w,conversationsLoading:T,hasMoreConversations:A,loadingMoreConversations:C,currentConversationId:E}=xi(r),{visible:x}=xi(o),D=re=>t.iconStyle?t.iconStyle(re):{},N=ge(null),O=ge(!1),G=ge(null),Z=()=>{if(O.value){O.value=!1;return}const re=N.value;if(re){const we=re.getBoundingClientRect(),Ae=re.closest(".conversation-sidebar"),bt=Ae?Ae.getBoundingClientRect().right:we.right;G.value={left:we.left,top:we.top,right:Math.min(we.right,bt),bottom:we.bottom}}O.value=!0},q=ge(null),V=ge({top:0,right:0}),I=ge(!1),$=ge(null),L=ge(null),K=ge(null),se=ge(""),oe=ge(null);Ke(K,async re=>{var we,Ae;re&&(await ft(),(we=oe.value)==null||we.focus(),(Ae=oe.value)==null||Ae.select())});const ve=re=>{if(typeof document>"u")return;const we=document.querySelector(`[data-action-trigger="${re}"]`);if(!we)return;const Ae=we.getBoundingClientRect();V.value={top:Ae.bottom+6,right:(typeof window<"u"?window.innerWidth:0)-Ae.right}},le=re=>{q.value===re?q.value=null:(ve(re),q.value=re)};Ke(q,async re=>{re&&(await ft(),ve(re))});const ue=re=>q.value===re&&!ot(re)&&!$s(re),P=re=>{const we=re;we.style.top=`${we.offsetTop}px`},X=()=>{q.value=null},J=ge(new Set),ne=ge([]),ce=ge(!1),_e=()=>{J.value=new Set(Array.isArray(o.form.sidebar_pinned_workspaces)?o.form.sidebar_pinned_workspaces:[])},Pe=()=>{ne.value=Array.isArray(o.form.sidebar_workspace_order)?[...o.form.sidebar_workspace_order]:[]},it=()=>{if(!ce.value)return;const re=Array.from(J.value),we=o.form.sidebar_pinned_workspaces||[];JSON.stringify(re)!==JSON.stringify(we)&&o.updateField({key:"sidebar_pinned_workspaces",value:re})},at=()=>{if(!ce.value)return;const re=Array.from(ne.value),we=o.form.sidebar_workspace_order||[];JSON.stringify(re)!==JSON.stringify(we)&&o.updateField({key:"sidebar_workspace_order",value:re})},rt=()=>{if(!ce.value)return;const re=String(t.currentWorkspaceId||"");if(!re||J.value.has(re)||ne.value[0]===re)return;const we=ne.value.filter(Ae=>Ae!==re);we.unshift(re),ne.value=we,at()},Oe=re=>{if(!ce.value||!Array.isArray(re))return;const we=re.map(is=>String((is==null?void 0:is.workspace_id)||"")).filter(Boolean),Ae=new Set(ne.value),bt=new Set(we.filter(is=>J.value.has(is))),hs=we.filter(is=>!Ae.has(is)&&!bt.has(is)),Ps=new Set(ne.value.filter(is=>!we.includes(is)));(hs.length||Ps.size)&&(ne.value=ne.value.filter(is=>!Ps.has(is)).concat(hs),at())},xe=()=>{!o.loaded||ce.value||(_e(),Pe(),ce.value=!0,Array.isArray(t.workspaces)&&t.workspaces.length>0&&Oe(t.workspaces),rt())};Ke(()=>o.loaded,re=>{re&&xe()},{immediate:!0}),Ke(()=>o.form.sidebar_pinned_workspaces,()=>{ce.value&&_e()},{deep:!0}),Ke(()=>o.form.sidebar_workspace_order,()=>{ce.value&&(Pe(),Array.isArray(t.workspaces)&&t.workspaces.length>0&&Oe(t.workspaces),rt())},{deep:!0}),Ke(()=>t.workspaces,re=>{Array.isArray(re)&&re.length>0&&Oe(re)},{immediate:!0,deep:!0});const pe=be(()=>t.groupByWorkspace&&t.hostWorkspaceEnabled&&Array.isArray(t.workspaces)&&t.workspaces.length>0);Ke(()=>t.currentWorkspaceId,async()=>{pe.value?(I.value=!0,rt(),await ft(),I.value=!1):rt()},{immediate:!0});const he=be(()=>(Array.isArray(t.workspaces)?[...t.workspaces]:[]).sort((we,Ae)=>{const bt=String((we==null?void 0:we.workspace_id)||""),hs=String((Ae==null?void 0:Ae.workspace_id)||""),Ps=J.value.has(bt)?1:0,is=J.value.has(hs)?1:0;if(Ps!==is)return is-Ps;const en=ne.value.indexOf(bt),ut=ne.value.indexOf(hs);return en!==-1&&ut!==-1?en-ut:en!==-1?-1:ut!==-1?1:String((we==null?void 0:we.label)||bt).localeCompare(String((Ae==null?void 0:Ae.label)||hs))})),ye=be(()=>v.value?p.value:_.value),ke=be(()=>(Array.isArray(g.value)?[...g.value]:[]).sort((we,Ae)=>{const bt=String((we==null?void 0:we.workspace_id)||""),hs=String((Ae==null?void 0:Ae.workspace_id)||""),Ps=J.value.has(bt)?1:0,is=J.value.has(hs)?1:0;if(Ps!==is)return is-Ps;const en=ne.value.indexOf(bt),ut=ne.value.indexOf(hs);return en!==-1&&ut!==-1?en-ut:en!==-1?-1:ut!==-1?1:String((we==null?void 0:we.label)||bt).localeCompare(String((Ae==null?void 0:Ae.label)||hs))})),Le=be(()=>v.value?m.value:T.value),st=be(()=>k.value==="delete"),gt=be(()=>Array.isArray(t.runningTasks)?t.runningTasks.filter(re=>re&&re.task_id&&re.conversation_id&&re.conversation_id!==E.value&&String(re.workspace_id||"")!==String(t.currentWorkspaceId||"")):[]),Wt=new Set(["pending","running","cancel_requested"]),jt=new Set(["succeeded","failed","canceled"]),ht=re=>Wt.has(String((re==null?void 0:re.status)||"")),Qt=re=>jt.has(String((re==null?void 0:re.status)||"")),It=be(()=>new Set((Array.isArray(t.runningTasks)?t.runningTasks:[]).filter(re=>ht(re)).map(re=>String((re==null?void 0:re.conversation_id)||"")).filter(Boolean))),ns=be(()=>new Set((Array.isArray(t.runningTasks)?t.runningTasks:[]).filter(re=>Qt(re)).map(re=>String((re==null?void 0:re.conversation_id)||"")).filter(Boolean))),ot=re=>!!(It.value.has(String(re||""))||t.currentTaskInProgress&&String(re||"")===String(t.currentConversationId||"")),$s=re=>ns.value.has(String(re||"")),Er=re=>(Array.isArray(t.runningTasks)?t.runningTasks:[]).some(we=>ht(we)&&String((we==null?void 0:we.workspace_id)||"")===re),In=re=>r.workspaceGroups.find(we=>we.workspaceId===re),Ko=re=>{const we=In(re);if(!we)return[];const Ae=we.visibleLimit+we.bufferLimit;return we.conversations.slice(0,Ae)},ao=re=>{const we=In(re);return we?we.hasMore||we.conversations.length>we.visibleLimit:!1},Pn=re=>{const we=In(re);return we?we.expanded:!0},qo=re=>{const we=In(re);if(!we){r.ensureWorkspaceGroup(re),r.loadWorkspaceConversations(re);return}r.setWorkspaceGroupExpanded(re,!we.expanded),!we.expanded&&we.conversations.length===0&&!we.loading&&r.loadWorkspaceConversations(re)},Yn=re=>{const we=In(re);we?we.conversations.length===0&&!we.loading&&!we.loadingMore&&r.loadWorkspaceConversations(re):(r.ensureWorkspaceGroup(re),r.loadWorkspaceConversations(re))};Ke([pe,he],([re,we])=>{re&&we.length>0&&we.forEach(Ae=>Yn(String((Ae==null?void 0:Ae.workspace_id)||"")))},{immediate:!0});const Oi=(re,we)=>{L.value=null,n("select-workspace-conversation",{conversationId:re,workspaceId:we})},Mr=re=>{L.value=null,n("create-workspace-conversation",re)},Di=re=>{L.value=L.value===re?null:re},gl=()=>{L.value=null},Qo=re=>{L.value=null;const we=[...ne.value],Ae=we.indexOf(re);if(J.value.has(re)){J.value.delete(re),Ae!==-1&&we.splice(Ae,1);const bt=String(t.currentWorkspaceId||""),hs=we.indexOf(bt),Ps=hs!==-1?hs+1:0;we.splice(Ps,0,re)}else J.value.add(re),Ae!==-1&&we.splice(Ae,1);ne.value=we,it(),at(),n("pin-workspace",re)},lo=re=>{L.value=null,n("reveal-workspace",re)},fi=re=>{L.value=null,K.value=String((re==null?void 0:re.workspace_id)||""),se.value=String((re==null?void 0:re.label)||(re==null?void 0:re.workspace_id)||"")},Ni=()=>{const re=K.value,we=se.value.trim();re&&we&&n("rename-workspace",{workspaceId:re,label:we}),K.value=null,se.value=""},wa=()=>{K.value=null,se.value=""},vl=re=>{r.loadMoreWorkspaceConversations(re)};return dn(()=>{document.addEventListener("click",X),document.addEventListener("click",gl),pe.value&&he.value.forEach(re=>Yn(String((re==null?void 0:re.workspace_id)||"")))}),Rn(()=>{document.removeEventListener("click",X),document.removeEventListener("click",gl)}),(re,we)=>(F(),U("aside",{class:Ce(["conversation-sidebar",{collapsed:Ne(d)}])},[M("div",P8,[M("div",L8,[M("button",{type:"button",class:"sidebar-nav-row conversation-menu-btn",title:Ne(d)?re.$t("sidebar.expandConversations"):re.$t("sidebar.collapseConversations"),onClick:we[0]||(we[0]=Ae=>re.$emit("toggle"))},[we[22]||(we[22]=Mi('',1)),M("span",D8,Q(re.$t("sidebar.conversationHistory")),1)],8,O8),M("button",{type:"button",class:"sidebar-nav-row",title:re.$t("sidebar.newConversation"),onClick:we[1]||(we[1]=Ae=>re.$emit("create"))},[we[23]||(we[23]=M("span",{class:"sidebar-nav-icon pencil-icon","data-tutorial":"quick-new-conversation","aria-hidden":"true"},[M("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round","stroke-linejoin":"round"},[M("path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"}),M("path",{d:"m15 5 4 4"})])],-1)),M("span",$8,Q(re.$t("sidebar.newConversation")),1)],8,N8),s.hostWorkspaceEnabled?(F(),U("button",{key:0,type:"button",class:Ce(["sidebar-nav-row workspace-entry-btn",{active:O.value}]),title:s.workspaceKind==="project"?re.$t("sidebar.project"):re.$t("sidebar.workspace"),"data-tutorial":"workspace-toggle",ref_key:"workspaceEntryBtn",ref:N,onClick:Z},[we[24]||(we[24]=Mi('',1)),M("span",F8,Q(s.workspaceKind==="project"?re.$t("sidebar.project"):re.$t("sidebar.workspace")),1)],10,B8)):me("",!0),M("button",{type:"button",class:"sidebar-nav-row",title:re.$t("sidebar.workflows"),onClick:we[2]||(we[2]=Ae=>re.$emit("open-workflows"))},[we[25]||(we[25]=Mi('',1)),M("span",U8,Q(re.$t("sidebar.workflows")),1)],8,H8)]),M("div",W8,[M("label",z8,[M("span",j8,[M("span",{class:"icon icon-sm",style:qe(D("search"))},null,4)]),M("input",{class:"search-input",value:Ne(h),placeholder:re.$t("sidebar.searchConversationPlaceholder"),onInput:we[3]||(we[3]=Ae=>re.$emit("search",Ae.target.value)),onKeydown:we[4]||(we[4]=Dv(De(Ae=>re.$emit("search-submit",Ae.target.value),["prevent"]),["enter"]))},null,40,V8)])]),Ne(v)?me("",!0):(F(),U("div",G8,[M("button",{type:"button",class:Ce(["conversation-type-option",{active:a.value==="normal"}]),onClick:we[5]||(we[5]=Ae=>u("normal"))},Q(re.$t("sidebar.normalConversations")),3),M("button",{type:"button",class:Ce(["conversation-type-option",{active:a.value==="multi_agent"}]),onClick:we[6]||(we[6]=Ae=>u("multi_agent"))},Q(re.$t("sidebar.multiAgent")),3)])),M("div",{ref_key:"conversationListEl",ref:l,class:"conversation-list"},[We(gs,{name:c.value},{default:Gt(()=>[(F(),U("div",{key:a.value,class:"conversation-list-pane"},[gt.value.length&&!Ne(v)&&!pe.value?(F(),U("div",K8,[M("div",q8,Q(re.$t("sidebar.runningTasksTitle")),1),(F(!0),U(Ie,null,Ze(gt.value,Ae=>(F(),U("button",{key:Ae.task_id,type:"button",class:Ce(["running-task-item",{active:Ae.conversation_id===Ne(E)}]),onClick:bt=>re.$emit("select-running-task",Ae)},[M("span",X8,Q(Ae.workspace_label||Ae.workspace_id),1),M("span",Y8,[M("span",J8,Q(Ae.conversation_title||Ae.message||re.$t("sidebar.runningConversation")),1),ht(Ae)?(F(),U("span",{key:0,class:"conversation-running-loader running-task-state","aria-label":re.$t("common.running")},null,8,Z8)):(F(),U("span",{key:1,class:"conversation-complete-check running-task-state","aria-label":re.$t("sidebar.completed")},null,8,eW))])],10,Q8))),128))])):me("",!0),pe.value&&!Ne(v)?(F(),U("div",{key:1,class:Ce(["workspace-groups",{"switch-instant":I.value}])},[(F(!0),U(Ie,null,Ze(he.value,Ae=>{var bt,hs,Ps,is,en;return F(),U("div",{key:String(Ae.workspace_id||Ae.label),class:"workspace-group"},[M("div",{class:Ce(["workspace-group-header",{active:String(Ae.workspace_id||"")===s.currentWorkspaceId}]),onMouseenter:ut=>$.value=String(Ae.workspace_id||""),onMouseleave:we[7]||(we[7]=ut=>$.value=null)},[M("button",{type:"button",class:"workspace-group-toggle",onClick:ut=>qo(String(Ae.workspace_id||""))},[M("span",{class:"icon icon-sm workspace-folder-icon",style:qe(D(Pn(String(Ae.workspace_id||""))?"folderOpen":"folderClosed")),"aria-hidden":"true"},null,4),M("span",nW,Q(Ae.label||Ae.workspace_id),1),String(Ae.workspace_id||"")===s.currentWorkspaceId?(F(),U("span",{key:0,class:"workspace-current-dot","aria-label":re.$t("sidebar.currentWorkspace")},null,8,iW)):me("",!0),Er(String(Ae.workspace_id||""))&&!Pn(String(Ae.workspace_id||""))&&$.value!==String(Ae.workspace_id||"")&&L.value!==String(Ae.workspace_id||"")?(F(),U("span",{key:1,class:"workspace-running-loader","aria-label":re.$t("common.running")},null,8,rW)):me("",!0)],8,sW),M("div",{class:Ce(["workspace-group-actions",{visible:$.value===String(Ae.workspace_id||"")||L.value===String(Ae.workspace_id||"")}])},[M("button",{type:"button",class:"workspace-new-btn",title:re.$t("sidebar.newConversation"),"aria-label":re.$t("sidebar.newConversation"),onClick:ut=>Mr(String(Ae.workspace_id||""))},[M("span",{class:"icon icon-sm",style:qe(D("pencil")),"aria-hidden":"true"},null,4)],8,oW),M("button",{type:"button",class:"workspace-more-btn",title:re.$t("common.moreActions"),"aria-label":re.$t("common.moreActions"),"aria-expanded":L.value===String(Ae.workspace_id||""),onClick:De(ut=>Di(String(Ae.workspace_id||"")),["stop"])},[...we[26]||(we[26]=[M("span",{"aria-hidden":"true"},null,-1)])],8,aW),M("div",{class:Ce(["workspace-actions-menu",{open:L.value===String(Ae.workspace_id||"")}])},[M("button",{type:"button",onClick:ut=>Qo(String(Ae.workspace_id||""))},[M("span",null,Q(J.value.has(String(Ae.workspace_id||""))?re.$t("sidebar.unpinWorkspace"):re.$t("sidebar.pinWorkspace")),1)],8,lW),t.versioningHostMode?(F(),U("button",{key:0,type:"button",onClick:ut=>lo(String(Ae.workspace_id||""))},[M("span",null,Q(re.$t("sidebar.revealInFolder")),1)],8,cW)):me("",!0),M("button",{type:"button",onClick:ut=>fi(Ae)},[M("span",null,Q(re.$t("sidebar.rename")),1)],8,uW)],2)],2)],42,tW),M("div",{class:Ce(["workspace-group-children",{expanded:Pn(String(Ae.workspace_id||""))}])},[M("div",dW,[(hs=(bt=In(String(Ae.workspace_id||"")))==null?void 0:bt.conversations)!=null&&hs.length?(F(),U(Ie,{key:1},[M("div",{class:"workspace-conversations-viewport",style:qe({"--workspace-visible-count":((Ps=In(String(Ae.workspace_id||"")))==null?void 0:Ps.visibleLimit)||5})},[We(ay,{name:"conversation-delete",tag:"div",class:Ce(["workspace-conversations-list",`animation-mode-${Ne(k)}`]),onBeforeLeave:P},{default:Gt(()=>[(F(!0),U(Ie,null,Ze(Ko(String(Ae.workspace_id||"")),ut=>(F(),U("div",{key:ut.id,class:Ce(["conversation-item workspace-conversation-item",{active:ut.id===Ne(E),running:ot(ut.id)||$s(ut.id),"insert-from-left":Ne(b)[ut.id]==="create","insert-from-under":Ne(b)[ut.id]==="duplicate","duplicate-source-mask":Ne(b)[ut.id]==="duplicateSource"}]),onClick:pn=>Oi(ut.id,String(Ae.workspace_id||""))},[M("div",pW,Q(ut.title),1),M("div",{class:Ce(["conversation-action-wrap",{"menu-open":q.value===ut.id}]),onClick:we[8]||(we[8]=De(()=>{},["stop"]))},[ot(ut.id)?(F(),U("span",{key:0,class:"conversation-running-loader","aria-label":re.$t("common.running"),title:re.$t("common.running")},null,8,mW)):$s(ut.id)?(F(),U("span",{key:1,class:"conversation-complete-check","aria-label":re.$t("sidebar.completed"),title:re.$t("sidebar.completed")},null,8,gW)):(F(),U("button",{key:2,type:"button",class:"conversation-more-btn",title:re.$t("common.moreActions"),"aria-label":re.$t("common.moreActions"),"data-action-trigger":ut.id,"aria-expanded":q.value===ut.id,onClick:pn=>le(ut.id)},[...we[27]||(we[27]=[M("span",{"aria-hidden":"true"},null,-1)])],8,vW)),(F(),Ft(Tf,{to:"body"},[ue(ut.id)?(F(),U("div",{key:0,class:Ce(["conversation-actions-menu conversation-actions-menu--fixed",{open:q.value===ut.id}]),style:qe({top:V.value.top+"px",right:V.value.right+"px"})},[M("button",{type:"button",onClick:pn=>{q.value=null,re.$emit("duplicate",ut.id)}},[M("span",{class:"icon icon-sm",style:qe(D("copy")),"aria-hidden":"true"},null,4),M("span",null,Q(re.$t("common.copy")),1)],8,yW),M("button",{type:"button",class:"danger",onClick:pn=>{q.value=null,re.$emit("delete",{id:ut.id,workspaceId:String(Ae.workspace_id||"")})}},[M("span",{class:"icon icon-sm",style:qe(D("trash")),"aria-hidden":"true"},null,4),M("span",null,Q(re.$t("common.delete")),1)],8,bW)],6)):me("",!0)]))],2)],10,fW))),128))]),_:2},1032,["class"])],4),ao(String(Ae.workspace_id||""))?(F(),U("div",_W,[M("button",{class:"load-more-btn",type:"button",disabled:(is=In(String(Ae.workspace_id||"")))==null?void 0:is.loadingMore,onClick:ut=>vl(String(Ae.workspace_id||""))},Q((en=In(String(Ae.workspace_id||"")))!=null&&en.loadingMore?re.$t("sidebar.loadingMore"):re.$t("sidebar.loadMore")),9,wW)])):me("",!0)],64)):(F(),U("div",hW,Q(re.$t("sidebar.noConversations")),1))])],2)])}),128))],2)):pe.value&&Ne(v)?(F(),U("div",SW,[!Ne(m)&&!ke.value.length?(F(),U("div",kW,Q(re.$t("sidebar.noMatchingConversations")),1)):me("",!0),(F(!0),U(Ie,null,Ze(ke.value,Ae=>(F(),U("div",{key:String(Ae.workspace_id||""),class:"workspace-group"},[M("div",CW,[M("div",TW,[M("span",{class:"icon icon-sm workspace-folder-icon",style:qe(D("folderClosed")),"aria-hidden":"true"},null,4),M("span",AW,Q(Ae.label||Ae.workspace_id),1)])]),M("div",EW,[M("div",MW,[M("div",xW,[(F(!0),U(Ie,null,Ze(Ae.results,bt=>(F(),U("div",{key:bt.id,class:Ce(["conversation-item workspace-conversation-item",{active:bt.id===Ne(E),running:ot(bt.id)||$s(bt.id)}]),onClick:hs=>Oi(bt.id,String(Ae.workspace_id||""))},[M("div",IW,Q(bt.title),1),M("div",{class:Ce(["conversation-action-wrap",{"menu-open":q.value===bt.id}]),onClick:we[9]||(we[9]=De(()=>{},["stop"]))},[ot(bt.id)?(F(),U("span",{key:0,class:"conversation-running-loader","aria-label":re.$t("common.running"),title:re.$t("common.running")},null,8,PW)):$s(bt.id)?(F(),U("span",{key:1,class:"conversation-complete-check","aria-label":re.$t("sidebar.completed"),title:re.$t("sidebar.completed")},null,8,LW)):(F(),U("button",{key:2,type:"button",class:"conversation-more-btn",title:re.$t("common.moreActions"),"aria-label":re.$t("common.moreActions"),"data-action-trigger":bt.id,"aria-expanded":q.value===bt.id,onClick:hs=>le(bt.id)},[...we[28]||(we[28]=[M("span",{"aria-hidden":"true"},null,-1)])],8,OW)),(F(),Ft(Tf,{to:"body"},[ue(bt.id)?(F(),U("div",{key:0,class:Ce(["conversation-actions-menu conversation-actions-menu--fixed",{open:q.value===bt.id}]),style:qe({top:V.value.top+"px",right:V.value.right+"px"})},[M("button",{type:"button",onClick:hs=>{q.value=null,re.$emit("duplicate",bt.id)}},[M("span",{class:"icon icon-sm",style:qe(D("copy")),"aria-hidden":"true"},null,4),M("span",null,Q(re.$t("common.copy")),1)],8,DW),M("button",{type:"button",class:"danger",onClick:hs=>{q.value=null,re.$emit("delete",{id:bt.id,workspaceId:String(Ae.workspace_id||"")})}},[M("span",{class:"icon icon-sm",style:qe(D("trash")),"aria-hidden":"true"},null,4),M("span",null,Q(re.$t("common.delete")),1)],8,NW)],6)):me("",!0)]))],2)],10,RW))),128))])])])]))),128))])):(F(),U(Ie,{key:3},[Le.value&&!ye.value.length&&!Ne(v)&&!st.value?(F(),U("div",$W,Q(re.$t("sidebar.loading")),1)):!ye.value.length&&!Le.value&&!st.value?(F(),U("div",BW,Q(Ne(v)?re.$t("sidebar.noMatchingConversations"):re.$t("sidebar.noConversationHistory")),1)):(F(),Ft(ay,{key:2,name:"conversation-delete",tag:"div",class:Ce(["conversation-list-items",`animation-mode-${Ne(k)}`])},{default:Gt(()=>[(F(!0),U(Ie,null,Ze(ye.value,Ae=>(F(),U("div",{key:Ae.id,class:Ce(["conversation-item",{active:Ae.id===Ne(E),running:ot(Ae.id)||$s(Ae.id),"insert-from-left":Ne(b)[Ae.id]==="create","insert-from-under":Ne(b)[Ae.id]==="duplicate","duplicate-source-mask":Ne(b)[Ae.id]==="duplicateSource",deleting:Ne(w).includes(Ae.id)}]),onClick:bt=>{q.value=null,re.$emit("select",Ae.id)}},[M("div",HW,Q(Ae.title),1),M("div",{class:Ce(["conversation-action-wrap",{"menu-open":q.value===Ae.id}]),onClick:we[10]||(we[10]=De(()=>{},["stop"]))},[ot(Ae.id)?(F(),U("span",{key:0,class:"conversation-running-loader","aria-label":re.$t("common.running"),title:re.$t("common.running")},null,8,UW)):$s(Ae.id)?(F(),U("span",{key:1,class:"conversation-complete-check","aria-label":re.$t("sidebar.completed"),title:re.$t("sidebar.completed")},null,8,WW)):(F(),U("button",{key:2,type:"button",class:"conversation-more-btn",title:re.$t("common.moreActions"),"aria-label":re.$t("common.moreActions"),"data-action-trigger":Ae.id,"aria-expanded":q.value===Ae.id,onClick:bt=>le(Ae.id)},[...we[29]||(we[29]=[M("span",{"aria-hidden":"true"},null,-1)])],8,zW)),(F(),Ft(Tf,{to:"body"},[!ot(Ae.id)&&!$s(Ae.id)&&q.value===Ae.id?(F(),U("div",{key:0,class:Ce(["conversation-actions-menu conversation-actions-menu--fixed",{open:q.value===Ae.id}]),style:qe({top:V.value.top+"px",right:V.value.right+"px"})},[M("button",{type:"button",onClick:bt=>{q.value=null,re.$emit("duplicate",Ae.id)}},[M("span",{class:"icon icon-sm",style:qe(D("copy")),"aria-hidden":"true"},null,4),M("span",null,Q(re.$t("common.copy")),1)],8,jW),M("button",{type:"button",class:"danger",onClick:bt=>{q.value=null,re.$emit("delete",Ae.id)}},[M("span",{class:"icon icon-sm",style:qe(D("trash")),"aria-hidden":"true"},null,4),M("span",null,Q(re.$t("common.delete")),1)],8,VW)],6)):me("",!0)]))],2)],10,FW))),128))]),_:1},8,["class"]))],64)),!Ne(v)&&!pe.value&&Ne(A)?(F(),U("div",GW,[M("button",{class:"load-more-btn",type:"button",disabled:Ne(C),onClick:we[11]||(we[11]=Ae=>re.$emit("load-more"))},Q(Ne(C)?re.$t("sidebar.loadingMore"):re.$t("sidebar.loadMore")),9,KW)])):Ne(v)?(F(),U("div",qW,[Ne(m)?(F(),U("div",QW,[M("span",XW,[M("span",YW,[M("span",{class:"icon icon-sm search-spinner-icon",style:qe(D("search"))},null,4)])]),M("span",JW,Q(re.$t("sidebar.searching")),1)])):Ne(y)?(F(),U("button",{key:1,class:"load-more-btn",type:"button",onClick:we[12]||(we[12]=Ae=>re.$emit("search-more"))},Q(re.$t("sidebar.searchMore")),1)):ye.value.length?(F(),U("div",ZW,Q(re.$t("sidebar.searchExhausted")),1)):me("",!0)])):me("",!0)]))]),_:1},8,["name"])],512),K.value?(F(),U("div",{key:1,class:"workspace-rename-overlay",onClick:De(wa,["self"])},[M("div",ez,[M("div",tz,Q(re.$t("sidebar.renameTitle",{kind:re.$t(s.workspaceKind==="workspace"?"sidebar.workspace":"sidebar.project")})),1),Ov(M("input",{ref_key:"renameInput",ref:oe,"onUpdate:modelValue":we[13]||(we[13]=Ae=>se.value=Ae),type:"text",class:"workspace-rename-input",placeholder:re.$t("sidebar.renamePlaceholder"),onKeydown:[Dv(De(Ni,["prevent"]),["enter"]),Dv(De(wa,["prevent"]),["esc"])]},null,40,sz),[[yw,se.value]]),M("div",nz,[M("button",{type:"button",class:"workspace-rename-cancel",onClick:wa},Q(re.$t("common.cancel")),1),M("button",{type:"button",class:"workspace-rename-confirm",onClick:Ni},Q(re.$t("common.confirm")),1)])])])):me("",!0),We(I8,{open:O.value,"anchor-rect":G.value,workspaces:s.workspaces,"current-workspace-id":s.currentWorkspaceId,"default-workspace-id":s.defaultWorkspaceId,"workspace-kind":s.workspaceKind,busy:s.workspaceBusy,"create-submitting":s.workspaceCreateSubmitting,"error-message":s.workspaceError,onClose:we[14]||(we[14]=Ae=>O.value=!1),onSwitch:we[15]||(we[15]=Ae=>re.$emit("switch-workspace",Ae)),onCreate:we[16]||(we[16]=Ae=>re.$emit("create-workspace",Ae)),onRename:we[17]||(we[17]=Ae=>re.$emit("rename-workspace",Ae)),onDelete:we[18]||(we[18]=Ae=>re.$emit("delete-workspace",Ae)),onSetDefault:we[19]||(we[19]=Ae=>re.$emit("set-default-workspace",Ae)),onReveal:we[20]||(we[20]=Ae=>re.$emit("reveal-workspace",Ae))},null,8,["open","anchor-rect","workspaces","current-workspace-id","default-workspace-id","workspace-kind","busy","create-submitting","error-message"]),M("div",{class:Ce(["conversation-personal-entry",{active:Ne(x)}])},[M("button",{type:"button",class:"sidebar-nav-row personal-page-btn","data-tutorial":"open-personal-space",title:re.$t("sidebar.personalSpace"),onClick:we[21]||(we[21]=Ae=>re.$emit("personal"))},[we[30]||(we[30]=M("span",{class:"sidebar-nav-icon","aria-hidden":"true"},[M("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},[M("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M10 9a3 3 0 100-6 3 3 0 000 6zm-7 9a7 7 0 1114 0H3z"})])],-1)),M("span",rz,Q(re.$t("sidebar.personalSpace")),1)],8,iz)],2)])],2))}}),az={class:"icon-label"},lz={key:0,class:"approval-panel-body"},cz={key:0,class:"no-files"},uz={key:1,class:"approval-list"},dz={class:"approval-card__title"},hz={class:"approval-card__summary"},fz={key:0,class:"approval-edit-preview"},pz={class:"approval-path"},mz={class:"tool-result-diff approval-diff"},gz={key:1,class:"approval-edit-preview"},vz={class:"approval-path"},yz={class:"tool-result-diff approval-diff"},bz={key:2,class:"approval-kv"},_z={class:"approval-value approval-value--path"},wz={key:3,class:"approval-kv"},Sz={class:"approval-value approval-value--path"},kz={key:4,class:"approval-lines approval-lines--cmd"},Cz={key:5,class:"approval-kv"},Tz={key:0},Az={class:"approval-actions"},Ez=["disabled","onClick"],Mz=["disabled","onClick"],xz=["disabled","onClick"],Rz={key:0,class:"auto-approval-block__title"},Iz={class:"auto-approval-block__content"},Pz={key:1,class:"auto-approval-block__final"},Lz={class:"auto-approval-block__reason"},Oz=ct({name:"ToolApprovalPanel",__name:"ToolApprovalPanel",props:{collapsed:{type:Boolean},width:{},approvals:{},decidingApprovalIds:{},autoApprovalFeedLines:{},autoApprovalFinalMessage:{},autoApprovalTitle:{}},emits:["approve","reject","switch-unrestricted","close"],setup(s,{emit:e}){const t=s,n=be(()=>(lt.value,t.autoApprovalTitle||S("appTasks.autoApprovalRecordTitle"))),i=be(()=>(lt.value,n.value===S("appTasks.goalReviewTitle"))),r=be(()=>(lt.value,i.value?S("appTasks.goalReviewTitle"):S("shell.toolApprovalTitle",{n:t.approvals.length}))),o=e,a=()=>{o("close")},c=be(()=>typeof window<"u"&&window.innerWidth<=768);dn(()=>{document.querySelector(".tool-approval-panel");const w=document.querySelector(".tool-approval-panel .sidebar-header");w&&window.getComputedStyle(w)});const l=w=>{var T;return(w==null?void 0:w.tool_name)==="edit_file"&&((T=w==null?void 0:w.preview)==null?void 0:T.edit_context)},u=w=>["run_command","terminal_input"].includes(w==null?void 0:w.tool_name),d=w=>(w==null?void 0:w.tool_name)==="write_file",h=w=>(w==null?void 0:w.tool_name)==="rename_file",p=w=>["create_file","create_folder","delete_file"].includes(w==null?void 0:w.tool_name),g=w=>Array.isArray(t.decidingApprovalIds)&&t.decidingApprovalIds.includes(w),v=w=>{var T,A,C,E;return((T=w==null?void 0:w.preview)==null?void 0:T.path)||((A=w==null?void 0:w.preview)==null?void 0:A.file_path)||((C=w==null?void 0:w.arguments)==null?void 0:C.path)||((E=w==null?void 0:w.arguments)==null?void 0:E.file_path)||""},m=w=>{lt.value;const T=String(w||""),C={run_command:"shell.toolRunCommand",terminal_input:"shell.toolTerminalInput",create_file:"shell.toolCreateFile",create_folder:"shell.toolCreateFolder",delete_file:"shell.toolDeleteFile",rename_file:"shell.toolRenameFile",write_file:"shell.toolWriteFile",edit_file:"shell.toolEditFile"}[T];return C?S(C):T||S("shell.pendingApproval")},y=w=>{var A;return String(((A=w==null?void 0:w.preview)==null?void 0:A.content_preview)||"").split(` `)},_=w=>{var A,C;return(Array.isArray((C=(A=w==null?void 0:w.preview)==null?void 0:A.edit_context)==null?void 0:C.old)?w.preview.edit_context.old:[]).map(E=>String((E==null?void 0:E.content)??""))},b=w=>{var A,C;return(Array.isArray((C=(A=w==null?void 0:w.preview)==null?void 0:A.edit_context)==null?void 0:C.new)?w.preview.edit_context.new:[]).map(E=>String((E==null?void 0:E.content)??""))},k=w=>{const A=String(w||"").split(` `),C=String(A[0]||"").trim(),E=String(A.slice(1).join(` `)||"").trim();return{title:C,reason:E,isApproved:C.includes(S("appTasks.approvalApproved"))}};return(w,T)=>(F(),U("aside",{class:Ce(["sidebar right-sidebar tool-approval-panel",{collapsed:s.collapsed,"is-goal-approval-mode":i.value}]),style:qe({width:s.collapsed?"0px":s.width+"px"})},[M("div",{class:Ce(["sidebar-header",{"mobile-header":c.value}])},[M("h3",az,Q(r.value),1),We(ml,{label:w.$t("shell.closeApprovalPanel"),onClick:a},null,8,["label"])],2),s.collapsed?me("",!0):(F(),U("div",lz,[!s.approvals.length&&!i.value?(F(),U("div",cz,Q(w.$t("shell.noPendingApprovals")),1)):(F(),U("div",uz,[(F(!0),U(Ie,null,Ze(s.approvals,A=>{var C,E,x,D,N,O,G,Z;return F(),U("div",{key:A.approval_id,class:"approval-card"},[M("div",dz,Q(A.tool_name),1),M("div",hz,Q(m(A.tool_name)),1),l(A)?(F(),U("div",fz,[M("div",pz,Q(((C=A.preview)==null?void 0:C.file_path)||((E=A.preview)==null?void 0:E.resolved_path)),1),M("div",mz,[(F(!0),U(Ie,null,Ze(_(A),(q,V)=>(F(),U("div",{class:"diff-line diff-remove",key:`o-${A.approval_id}-${V}`}," - "+Q(q),1))),128)),(F(!0),U(Ie,null,Ze(b(A),(q,V)=>(F(),U("div",{class:"diff-line diff-add",key:`n-${A.approval_id}-${V}`}," + "+Q(q),1))),128))])])):d(A)?(F(),U("div",gz,[M("div",vz,Q((x=A.preview)==null?void 0:x.file_path),1),M("div",yz,[(F(!0),U(Ie,null,Ze(y(A),(q,V)=>(F(),U("div",{class:"diff-line diff-add",key:`w-${A.approval_id}-${V}`}," + "+Q(q),1))),128))])])):p(A)?(F(),U("div",bz,[M("div",null,[M("strong",null,Q(w.$t("shell.pathLabel")),1),M("span",_z,Q(v(A)),1)])])):h(A)?(F(),U("div",wz,[M("div",null,[M("strong",null,Q(w.$t("shell.renameLabel")),1),M("span",Sz,Q((D=A.preview)==null?void 0:D.old_path)+" → "+Q((N=A.preview)==null?void 0:N.new_path),1)])])):u(A)?(F(),U("pre",kz,Q(((O=A.preview)==null?void 0:O.code)||((G=A.preview)==null?void 0:G.command)||""),1)):(F(),U("div",Cz,[M("div",null,[M("strong",null,Q(w.$t("shell.toolLabel")),1),cn(Q(A.tool_name),1)]),(Z=A.preview)!=null&&Z.summary?(F(),U("div",Tz,[M("strong",null,Q(w.$t("shell.summaryLabel")),1),cn(Q(A.preview.summary),1)])):me("",!0)])),M("div",Az,[M("button",{type:"button",class:"approval-btn approval-btn--switch",disabled:g(A.approval_id),onClick:q=>w.$emit("switch-unrestricted",A.approval_id)},Q(w.$t("shell.switchToUnrestricted")),9,Ez),M("button",{type:"button",class:"approval-btn approval-btn--approve",disabled:g(A.approval_id),onClick:q=>w.$emit("approve",A.approval_id)},Q(w.$t("shell.run")),9,Mz),M("button",{type:"button",class:"approval-btn approval-btn--reject",disabled:g(A.approval_id),onClick:q=>w.$emit("reject",A.approval_id)},Q(w.$t("shell.reject")),9,xz)])])}),128))])),s.autoApprovalFeedLines.length||s.autoApprovalFinalMessage?(F(),U("div",{key:2,class:Ce(["auto-approval-block",{"auto-approval-block--goal":i.value}])},[i.value?me("",!0):(F(),U("div",Rz,Q(n.value),1)),M("pre",Iz,Q(s.autoApprovalFeedLines.join(` `)),1),s.autoApprovalFinalMessage?(F(),U("div",Pz,[k(s.autoApprovalFinalMessage).title?(F(),U("div",{key:0,class:Ce(["auto-approval-block__decision",k(s.autoApprovalFinalMessage).isApproved?"auto-approval-block__decision--approved":"auto-approval-block__decision--rejected"])},Q(k(s.autoApprovalFinalMessage).title),3)):me("",!0),M("div",Lz,Q(k(s.autoApprovalFinalMessage).reason),1)])):me("",!0)],2)):me("",!0)]))],6))}}),Dz=qt(Oz,[["__scopeId","data-v-8dea89c1"]]),Nz={class:"git-changes-panel__header"},$z={class:"git-changes-panel__title"},Bz={class:"git-changes-panel__branch"},Fz={class:"git-changes-panel__upstream"},Hz={class:"git-changes-panel__summary"},Uz={class:"git-changes-panel__add"},Wz={class:"git-changes-panel__del"},zz={class:"git-changes-panel__body"},jz={key:0,class:"git-changes-panel__empty"},Vz={key:1,class:"git-changes-panel__empty git-changes-panel__empty--error"},Gz={key:2,class:"git-changes-panel__empty"},Kz={class:"git-change-file__header"},qz={class:"git-change-file__title"},Qz={class:"git-change-file__open-wrap"},Xz=["disabled","title","onClick"],Yz=["src"],Jz={key:0,class:"git-change-file__open-empty"},Zz=["onClick"],ej=["src"],tj={key:2,class:"git-change-file__open-empty"},sj={class:"git-change-file__path"},nj=["onClick"],ij={class:"git-change-file__stats"},rj={class:"git-changes-panel__add"},oj={class:"git-changes-panel__del"},aj={class:"git-change-file__diff"},lj={class:"git-change-file__diff-inner"},cj=["onClick"],uj={class:"git-change-file__fold-content"},dj={class:"git-change-line__num"},hj={class:"git-change-line__marker"},fj={class:"git-change-line__text"},pj=["onClick"],mj={class:"git-change-file__fold-content"},gj=ct({name:"GitChangesPanel",__name:"GitChangesPanel",props:{width:{},loading:{type:Boolean},error:{},hostMode:{type:Boolean},foldContexts:{},diff:{}},emits:["close","expand-context","reset-context"],setup(s,{emit:e}){const t=s,n=e,i=be(()=>{var w;return String(((w=t.diff)==null?void 0:w.branch)||"HEAD")}),r=be(()=>{var w;return lt.value,String(((w=t.diff)==null?void 0:w.upstream)||S("shell.unsetUpstream"))}),o=be(()=>{var w;return Math.max(0,Number(((w=t.diff)==null?void 0:w.additions)||0))}),a=be(()=>{var w;return Math.max(0,Number(((w=t.diff)==null?void 0:w.deletions)||0))}),c=be(()=>{var w;return Array.isArray((w=t.diff)==null?void 0:w.files)?t.diff.files:[]}),l=w=>{var A;const T=(A=t.foldContexts)==null?void 0:A[w];return!!T&&Object.values(T).some(C=>Number(C||0)>0)},u=new URL("data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20width='24'%20height='24'%20fill='none'%20stroke='%23000000'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%20style='opacity:1;'%3e%3cpath%20d='M12.5%2022H18a2%202%200%200%200%202-2V7l-5-5H6a2%202%200%200%200-2%202v9.5'/%3e%3cpath%20d='M14%202v4a2%202%200%200%200%202%202h4m-6.622%207.626a1%201%200%201%200-3.004-3.004l-5.01%205.012a2%202%200%200%200-.506.854l-.837%202.87a.5.5%200%200%200%20.62.62l2.87-.837a2%202%200%200%200%20.854-.506z'/%3e%3c/svg%3e",import.meta.url).href,d=ge(""),h=ge([]),p=ge(""),g=ge(""),v=w=>{const T=(w==null?void 0:w.kind)==="delete"?w.old_line:w==null?void 0:w.new_line,A=Number(T);return Number.isFinite(A)&&A>0?String(A):""},m=w=>w==="add"?"+":w==="delete"?"-":" ",y=(w,T)=>{n("expand-context",{path:w,foldKey:T})},_=w=>{n("reset-context",w)},b=async w=>{var T;if(t.hostMode){if(d.value===w){d.value="";return}d.value="",h.value=[],p.value="",g.value=w;try{const A=await fetch(`/api/project/file-open-apps?path=${encodeURIComponent(w)}`),C=await A.json().catch(()=>({}));if(!A.ok||!(C!=null&&C.success))throw new Error((C==null?void 0:C.error)||S("shell.detectAppsFailed"));h.value=Array.isArray((T=C==null?void 0:C.data)==null?void 0:T.apps)?C.data.apps:[],d.value=w}catch(A){p.value=(A==null?void 0:A.message)||S("shell.detectAppsFailed"),d.value=w}finally{g.value=""}}},k=async(w,T)=>{try{const A=await fetch("/api/project/open-file-with-app",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:w,app_id:T})}),C=await A.json().catch(()=>({}));if(!A.ok||!(C!=null&&C.success))throw new Error((C==null?void 0:C.error)||S("shell.openFileFailed"));d.value=""}catch(A){p.value=A instanceof Error?A.message:S("shell.openFileFailed")}};return(w,T)=>(F(),U("aside",{class:"git-changes-panel",style:qe({width:s.width+"px"})},[M("header",Nz,[M("div",$z,[M("span",Bz,Q(i.value),1),T[2]||(T[2]=M("span",{class:"git-changes-panel__arrow"},"→",-1)),M("span",Fz,Q(r.value),1)]),M("div",Hz,[M("span",Uz,"+"+Q(o.value),1),M("span",Wz,"-"+Q(a.value),1),We(ml,{label:w.$t("shell.closeGitPanel"),onClick:T[0]||(T[0]=A=>w.$emit("close"))},null,8,["label"])])]),M("div",zz,[s.loading&&!s.diff?(F(),U("div",jz,Q(w.$t("shell.loadingGitChanges")),1)):s.error&&!c.value.length?(F(),U("div",Vz,Q(s.error),1)):c.value.length?(F(!0),U(Ie,{key:3},Ze(c.value,A=>(F(),U("section",{key:A.path,class:"git-change-file"},[M("div",Kz,[M("span",qz,[M("span",Qz,[M("button",{type:"button",class:Ce(["git-change-file__open-btn",{open:d.value===A.path||g.value===A.path}]),disabled:!s.hostMode,title:s.hostMode?w.$t("shell.openFileWithApp"):w.$t("shell.dockerModeUnavailable"),onClick:De(C=>b(A.path),["stop","prevent"])},[M("img",{class:"git-change-file__open-icon",src:Ne(u),alt:"","aria-hidden":"true"},null,8,Yz),T[4]||(T[4]=M("span",{class:"git-change-file__open-caret","aria-hidden":"true"},null,-1))],10,Xz),d.value===A.path?(F(),U("div",{key:0,class:"git-change-file__open-menu",onClick:T[1]||(T[1]=De(()=>{},["stop"]))},[p.value?(F(),U("div",Jz,Q(p.value),1)):(F(!0),U(Ie,{key:1},Ze(h.value,C=>(F(),U("button",{key:C.id,type:"button",class:"git-change-file__open-option",onClick:De(E=>k(A.path,C.id),["stop","prevent"])},[M("img",{class:"git-change-file__open-option-icon",src:C.icon_url||Ne(u),alt:"","aria-hidden":"true"},null,8,ej),M("span",null,Q(C.label),1)],8,Zz))),128)),!g.value&&!p.value&&!h.value.length?(F(),U("div",tj,Q(w.$t("shell.noAppsDetected")),1)):me("",!0)])):me("",!0)]),M("span",sj,Q(A.path),1),l(A.path)?(F(),U("button",{key:0,type:"button",class:"git-change-file__reset",onClick:De(C=>_(A.path),["stop","prevent"])},Q(w.$t("shell.restore")),9,nj)):me("",!0)]),M("span",ij,[M("span",rj,"+"+Q(A.additions||0),1),M("span",oj,"-"+Q(A.deletions||0),1)])]),M("div",aj,[M("div",lj,[(F(!0),U(Ie,null,Ze(A.hunks,(C,E)=>(F(),U(Ie,{key:`${A.path}-${E}`},[C.before_hidden>0?(F(),U("button",{key:0,type:"button",class:"git-change-file__fold",onClick:De(x=>y(A.path,C.before_fold_key),["stop","prevent"])},[M("span",uj,[T[5]||(T[5]=M("span",{class:"git-change-file__fold-icon git-change-file__fold-icon--up","aria-hidden":"true"},null,-1)),M("span",null,Q(w.$t("shell.hiddenLines",{n:C.before_hidden})),1)])],8,cj)):me("",!0),(F(!0),U(Ie,null,Ze(C.lines,(x,D)=>(F(),U("div",{key:`${A.path}-${E}-${D}`,class:Ce(["git-change-line",{"git-change-line--add":x.kind==="add","git-change-line--delete":x.kind==="delete"}])},[M("span",dj,Q(v(x)),1),M("span",hj,Q(m(x.kind)),1),M("span",fj,Q(x.text),1)],2))),128))],64))),128)),A.after_hidden>0?(F(),U("button",{key:0,type:"button",class:"git-change-file__fold",onClick:De(C=>y(A.path,A.after_fold_key||"after"),["stop","prevent"])},[M("span",mj,[T[6]||(T[6]=M("span",{class:"git-change-file__fold-icon git-change-file__fold-icon--down","aria-hidden":"true"},null,-1)),M("span",null,Q(w.$t("shell.hiddenLines",{n:A.after_hidden})),1)])],8,pj)):me("",!0)])])]))),128)):(F(),U("div",Gz,[T[3]||(T[3]=Mi('',1)),M("span",null,Q(w.$t("shell.noUncommittedChanges")),1)]))])],4))}});var EL={exports:{}};(function(s,e){(function(t,n){s.exports=n()})(self,()=>(()=>{var t={4567:function(o,a,c){var l=this&&this.__decorate||function(b,k,w,T){var A,C=arguments.length,E=C<3?k:T===null?T=Object.getOwnPropertyDescriptor(k,w):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(b,k,w,T);else for(var x=b.length-1;x>=0;x--)(A=b[x])&&(E=(C<3?A(E):C>3?A(k,w,E):A(k,w))||E);return C>3&&E&&Object.defineProperty(k,w,E),E},u=this&&this.__param||function(b,k){return function(w,T){k(w,T,b)}};Object.defineProperty(a,"__esModule",{value:!0}),a.AccessibilityManager=void 0;const d=c(9042),h=c(6114),p=c(9924),g=c(844),v=c(5596),m=c(4725),y=c(3656);let _=a.AccessibilityManager=class extends g.Disposable{constructor(b,k){super(),this._terminal=b,this._renderService=k,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=document.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=document.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let w=0;wthis._handleBoundaryFocus(w,0),this._bottomBoundaryFocusListener=w=>this._handleBoundaryFocus(w,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=document.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new p.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize(w=>this._handleResize(w.rows))),this.register(this._terminal.onRender(w=>this._refreshRows(w.start,w.end))),this.register(this._terminal.onScroll(()=>this._refreshRows())),this.register(this._terminal.onA11yChar(w=>this._handleChar(w))),this.register(this._terminal.onLineFeed(()=>this._handleChar(` `))),this.register(this._terminal.onA11yTab(w=>this._handleTab(w))),this.register(this._terminal.onKey(w=>this._handleKey(w.key))),this.register(this._terminal.onBlur(()=>this._clearLiveRegion())),this.register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._screenDprMonitor=new v.ScreenDprMonitor(window),this.register(this._screenDprMonitor),this._screenDprMonitor.setListener(()=>this._refreshRowsDimensions()),this.register((0,y.addDisposableDomListener)(window,"resize",()=>this._refreshRowsDimensions())),this._refreshRows(),this.register((0,g.toDisposable)(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(b){for(let k=0;k0?this._charsToConsume.shift()!==b&&(this._charsToAnnounce+=b):this._charsToAnnounce+=b,b===` `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=d.tooMuchOutput)),h.isMac&&this._liveRegion.textContent&&this._liveRegion.textContent.length>0&&!this._liveRegion.parentNode&&setTimeout(()=>{this._accessibilityContainer.appendChild(this._liveRegion)},0))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0,h.isMac&&this._liveRegion.remove()}_handleKey(b){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(b)||this._charsToConsume.push(b)}_refreshRows(b,k){this._liveRegionDebouncer.refresh(b,k,this._terminal.rows)}_renderRows(b,k){const w=this._terminal.buffer,T=w.lines.length.toString();for(let A=b;A<=k;A++){const C=w.translateBufferLineToString(w.ydisp+A,!0),E=(w.ydisp+A+1).toString(),x=this._rowElements[A];x&&(C.length===0?x.innerText=" ":x.textContent=C,x.setAttribute("aria-posinset",E),x.setAttribute("aria-setsize",T))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(b,k){const w=b.target,T=this._rowElements[k===0?1:this._rowElements.length-2];if(w.getAttribute("aria-posinset")===(k===0?"1":`${this._terminal.buffer.lines.length}`)||b.relatedTarget!==T)return;let A,C;if(k===0?(A=w,C=this._rowElements.pop(),this._rowContainer.removeChild(C)):(A=this._rowElements.shift(),C=w,this._rowContainer.removeChild(A)),A.removeEventListener("focus",this._topBoundaryFocusListener),C.removeEventListener("focus",this._bottomBoundaryFocusListener),k===0){const E=this._createAccessibilityTreeNode();this._rowElements.unshift(E),this._rowContainer.insertAdjacentElement("afterbegin",E)}else{const E=this._createAccessibilityTreeNode();this._rowElements.push(E),this._rowContainer.appendChild(E)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(k===0?-1:1),this._rowElements[k===0?1:this._rowElements.length-2].focus(),b.preventDefault(),b.stopImmediatePropagation()}_handleResize(b){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let k=this._rowContainer.children.length;kb;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const b=document.createElement("div");return b.setAttribute("role","listitem"),b.tabIndex=-1,this._refreshRowDimensions(b),b}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let b=0;b{function c(h){return h.replace(/\r?\n/g,"\r")}function l(h,p){return p?"\x1B[200~"+h+"\x1B[201~":h}function u(h,p,g,v){h=l(h=c(h),g.decPrivateModes.bracketedPasteMode&&v.rawOptions.ignoreBracketedPasteMode!==!0),g.triggerDataEvent(h,!0),p.value=""}function d(h,p,g){const v=g.getBoundingClientRect(),m=h.clientX-v.left-10,y=h.clientY-v.top-10;p.style.width="20px",p.style.height="20px",p.style.left=`${m}px`,p.style.top=`${y}px`,p.style.zIndex="1000",p.focus()}Object.defineProperty(a,"__esModule",{value:!0}),a.rightClickHandler=a.moveTextAreaUnderMouseCursor=a.paste=a.handlePasteEvent=a.copyHandler=a.bracketTextForPaste=a.prepareTextForTerminal=void 0,a.prepareTextForTerminal=c,a.bracketTextForPaste=l,a.copyHandler=function(h,p){h.clipboardData&&h.clipboardData.setData("text/plain",p.selectionText),h.preventDefault()},a.handlePasteEvent=function(h,p,g,v){h.stopPropagation(),h.clipboardData&&u(h.clipboardData.getData("text/plain"),p,g,v)},a.paste=u,a.moveTextAreaUnderMouseCursor=d,a.rightClickHandler=function(h,p,g,v,m){d(h,p,g),m&&v.rightClickSelect(h),p.value=v.selectionText,p.select()}},7239:(o,a,c)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.ColorContrastCache=void 0;const l=c(1505);a.ColorContrastCache=class{constructor(){this._color=new l.TwoKeyMap,this._css=new l.TwoKeyMap}setCss(u,d,h){this._css.set(u,d,h)}getCss(u,d){return this._css.get(u,d)}setColor(u,d,h){this._color.set(u,d,h)}getColor(u,d){return this._color.get(u,d)}clear(){this._color.clear(),this._css.clear()}}},3656:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.addDisposableDomListener=void 0,a.addDisposableDomListener=function(c,l,u,d){c.addEventListener(l,u,d);let h=!1;return{dispose:()=>{h||(h=!0,c.removeEventListener(l,u,d))}}}},6465:function(o,a,c){var l=this&&this.__decorate||function(m,y,_,b){var k,w=arguments.length,T=w<3?y:b===null?b=Object.getOwnPropertyDescriptor(y,_):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(m,y,_,b);else for(var A=m.length-1;A>=0;A--)(k=m[A])&&(T=(w<3?k(T):w>3?k(y,_,T):k(y,_))||T);return w>3&&T&&Object.defineProperty(y,_,T),T},u=this&&this.__param||function(m,y){return function(_,b){y(_,b,m)}};Object.defineProperty(a,"__esModule",{value:!0}),a.Linkifier2=void 0;const d=c(3656),h=c(8460),p=c(844),g=c(2585);let v=a.Linkifier2=class extends p.Disposable{get currentLink(){return this._currentLink}constructor(m){super(),this._bufferService=m,this._linkProviders=[],this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new h.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new h.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,p.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,p.toDisposable)(()=>{this._lastMouseEvent=void 0})),this.register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0}))}registerLinkProvider(m){return this._linkProviders.push(m),{dispose:()=>{const y=this._linkProviders.indexOf(m);y!==-1&&this._linkProviders.splice(y,1)}}}attachToDom(m,y,_){this._element=m,this._mouseService=y,this._renderService=_,this.register((0,d.addDisposableDomListener)(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this.register((0,d.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,d.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,d.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(m){if(this._lastMouseEvent=m,!this._element||!this._mouseService)return;const y=this._positionFromMouseEvent(m,this._element,this._mouseService);if(!y)return;this._isMouseOut=!1;const _=m.composedPath();for(let b=0;b<_.length;b++){const k=_[b];if(k.classList.contains("xterm"))break;if(k.classList.contains("xterm-hover"))return}this._lastBufferCell&&y.x===this._lastBufferCell.x&&y.y===this._lastBufferCell.y||(this._handleHover(y),this._lastBufferCell=y)}_handleHover(m){if(this._activeLine!==m.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(m,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,m)||(this._clearCurrentLink(),this._askForLink(m,!0))}_askForLink(m,y){var _,b;this._activeProviderReplies&&y||((_=this._activeProviderReplies)===null||_===void 0||_.forEach(w=>{w==null||w.forEach(T=>{T.link.dispose&&T.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=m.y);let k=!1;for(const[w,T]of this._linkProviders.entries())y?!((b=this._activeProviderReplies)===null||b===void 0)&&b.get(w)&&(k=this._checkLinkProviderResult(w,m,k)):T.provideLinks(m.y,A=>{var C,E;if(this._isMouseOut)return;const x=A==null?void 0:A.map(D=>({link:D}));(C=this._activeProviderReplies)===null||C===void 0||C.set(w,x),k=this._checkLinkProviderResult(w,m,k),((E=this._activeProviderReplies)===null||E===void 0?void 0:E.size)===this._linkProviders.length&&this._removeIntersectingLinks(m.y,this._activeProviderReplies)})}_removeIntersectingLinks(m,y){const _=new Set;for(let b=0;bm?this._bufferService.cols:T.link.range.end.x;for(let E=A;E<=C;E++){if(_.has(E)){k.splice(w--,1);break}_.add(E)}}}}_checkLinkProviderResult(m,y,_){var b;if(!this._activeProviderReplies)return _;const k=this._activeProviderReplies.get(m);let w=!1;for(let T=0;Tthis._linkAtPosition(A.link,y));T&&(_=!0,this._handleNewLink(T))}if(this._activeProviderReplies.size===this._linkProviders.length&&!_)for(let T=0;Tthis._linkAtPosition(C.link,y));if(A){_=!0,this._handleNewLink(A);break}}return _}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(m){if(!this._element||!this._mouseService||!this._currentLink)return;const y=this._positionFromMouseEvent(m,this._element,this._mouseService);y&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,y)&&this._currentLink.link.activate(m,this._currentLink.link.text)}_clearCurrentLink(m,y){this._element&&this._currentLink&&this._lastMouseEvent&&(!m||!y||this._currentLink.link.range.start.y>=m&&this._currentLink.link.range.end.y<=y)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,p.disposeArray)(this._linkCacheDisposables))}_handleNewLink(m){if(!this._element||!this._lastMouseEvent||!this._mouseService)return;const y=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);y&&this._linkAtPosition(m.link,y)&&(this._currentLink=m,this._currentLink.state={decorations:{underline:m.link.decorations===void 0||m.link.decorations.underline,pointerCursor:m.link.decorations===void 0||m.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,m.link,this._lastMouseEvent),m.link.decorations={},Object.defineProperties(m.link.decorations,{pointerCursor:{get:()=>{var _,b;return(b=(_=this._currentLink)===null||_===void 0?void 0:_.state)===null||b===void 0?void 0:b.decorations.pointerCursor},set:_=>{var b,k;!((b=this._currentLink)===null||b===void 0)&&b.state&&this._currentLink.state.decorations.pointerCursor!==_&&(this._currentLink.state.decorations.pointerCursor=_,this._currentLink.state.isHovered&&((k=this._element)===null||k===void 0||k.classList.toggle("xterm-cursor-pointer",_)))}},underline:{get:()=>{var _,b;return(b=(_=this._currentLink)===null||_===void 0?void 0:_.state)===null||b===void 0?void 0:b.decorations.underline},set:_=>{var b,k,w;!((b=this._currentLink)===null||b===void 0)&&b.state&&((w=(k=this._currentLink)===null||k===void 0?void 0:k.state)===null||w===void 0?void 0:w.decorations.underline)!==_&&(this._currentLink.state.decorations.underline=_,this._currentLink.state.isHovered&&this._fireUnderlineEvent(m.link,_))}}}),this._renderService&&this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(_=>{if(!this._currentLink)return;const b=_.start===0?0:_.start+1+this._bufferService.buffer.ydisp,k=this._bufferService.buffer.ydisp+1+_.end;if(this._currentLink.link.range.start.y>=b&&this._currentLink.link.range.end.y<=k&&(this._clearCurrentLink(b,k),this._lastMouseEvent&&this._element)){const w=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);w&&this._askForLink(w,!1)}})))}_linkHover(m,y,_){var b;!((b=this._currentLink)===null||b===void 0)&&b.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(y,!0),this._currentLink.state.decorations.pointerCursor&&m.classList.add("xterm-cursor-pointer")),y.hover&&y.hover(_,y.text)}_fireUnderlineEvent(m,y){const _=m.range,b=this._bufferService.buffer.ydisp,k=this._createLinkUnderlineEvent(_.start.x-1,_.start.y-b-1,_.end.x,_.end.y-b-1,void 0);(y?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(k)}_linkLeave(m,y,_){var b;!((b=this._currentLink)===null||b===void 0)&&b.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(y,!1),this._currentLink.state.decorations.pointerCursor&&m.classList.remove("xterm-cursor-pointer")),y.leave&&y.leave(_,y.text)}_linkAtPosition(m,y){const _=m.range.start.y*this._bufferService.cols+m.range.start.x,b=m.range.end.y*this._bufferService.cols+m.range.end.x,k=y.y*this._bufferService.cols+y.x;return _<=k&&k<=b}_positionFromMouseEvent(m,y,_){const b=_.getCoords(m,y,this._bufferService.cols,this._bufferService.rows);if(b)return{x:b[0],y:b[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(m,y,_,b,k){return{x1:m,y1:y,x2:_,y2:b,cols:this._bufferService.cols,fg:k}}};a.Linkifier2=v=l([u(0,g.IBufferService)],v)},9042:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.tooMuchOutput=a.promptLabel=void 0,a.promptLabel="Terminal input",a.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(o,a,c){var l=this&&this.__decorate||function(v,m,y,_){var b,k=arguments.length,w=k<3?m:_===null?_=Object.getOwnPropertyDescriptor(m,y):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(v,m,y,_);else for(var T=v.length-1;T>=0;T--)(b=v[T])&&(w=(k<3?b(w):k>3?b(m,y,w):b(m,y))||w);return k>3&&w&&Object.defineProperty(m,y,w),w},u=this&&this.__param||function(v,m){return function(y,_){m(y,_,v)}};Object.defineProperty(a,"__esModule",{value:!0}),a.OscLinkProvider=void 0;const d=c(511),h=c(2585);let p=a.OscLinkProvider=class{constructor(v,m,y){this._bufferService=v,this._optionsService=m,this._oscLinkService=y}provideLinks(v,m){var y;const _=this._bufferService.buffer.lines.get(v-1);if(!_)return void m(void 0);const b=[],k=this._optionsService.rawOptions.linkHandler,w=new d.CellData,T=_.getTrimmedLength();let A=-1,C=-1,E=!1;for(let x=0;xk?k.activate(G,Z,N):g(0,Z),hover:(G,Z)=>{var q;return(q=k==null?void 0:k.hover)===null||q===void 0?void 0:q.call(k,G,Z,N)},leave:(G,Z)=>{var q;return(q=k==null?void 0:k.leave)===null||q===void 0?void 0:q.call(k,G,Z,N)}})}E=!1,w.hasExtendedAttrs()&&w.extended.urlId?(C=x,A=w.extended.urlId):(C=-1,A=-1)}}m(b)}};function g(v,m){if(confirm(`Do you want to navigate to ${m}? WARNING: This link could potentially be dangerous`)){const y=window.open();if(y){try{y.opener=null}catch{}y.location.href=m}else console.warn("Opening link blocked as opener could not be cleared")}}a.OscLinkProvider=p=l([u(0,h.IBufferService),u(1,h.IOptionsService),u(2,h.IOscLinkService)],p)},6193:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.RenderDebouncer=void 0,a.RenderDebouncer=class{constructor(c,l){this._parentWindow=c,this._renderCallback=l,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._parentWindow.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(c){return this._refreshCallbacks.push(c),this._animationFrame||(this._animationFrame=this._parentWindow.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(c,l,u){this._rowCount=u,c=c!==void 0?c:0,l=l!==void 0?l:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,c):c,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,l):l,this._animationFrame||(this._animationFrame=this._parentWindow.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();const c=Math.max(this._rowStart,0),l=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(c,l),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const c of this._refreshCallbacks)c(0);this._refreshCallbacks=[]}}},5596:(o,a,c)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.ScreenDprMonitor=void 0;const l=c(844);class u extends l.Disposable{constructor(h){super(),this._parentWindow=h,this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this.register((0,l.toDisposable)(()=>{this.clearListener()}))}setListener(h){this._listener&&this.clearListener(),this._listener=h,this._outerListener=()=>{this._listener&&(this._listener(this._parentWindow.devicePixelRatio,this._currentDevicePixelRatio),this._updateDpr())},this._updateDpr()}_updateDpr(){var h;this._outerListener&&((h=this._resolutionMediaMatchList)===null||h===void 0||h.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._listener&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._listener=void 0,this._outerListener=void 0)}}a.ScreenDprMonitor=u},3236:(o,a,c)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.Terminal=void 0;const l=c(3614),u=c(3656),d=c(6465),h=c(9042),p=c(3730),g=c(1680),v=c(3107),m=c(5744),y=c(2950),_=c(1296),b=c(428),k=c(4269),w=c(5114),T=c(8934),A=c(3230),C=c(9312),E=c(4725),x=c(6731),D=c(8055),N=c(8969),O=c(8460),G=c(844),Z=c(6114),q=c(8437),V=c(2584),I=c(7399),$=c(5941),L=c(9074),K=c(2585),se=c(5435),oe=c(4567),ve=typeof window<"u"?window.document:null;class le extends N.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(P={}){super(P),this.browser=Z,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new G.MutableDisposable),this._onCursorMove=this.register(new O.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new O.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new O.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new O.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new O.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new O.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new O.EventEmitter),this._onBlur=this.register(new O.EventEmitter),this._onA11yCharEmitter=this.register(new O.EventEmitter),this._onA11yTabEmitter=this.register(new O.EventEmitter),this._onWillOpen=this.register(new O.EventEmitter),this._setup(),this.linkifier2=this.register(this._instantiationService.createInstance(d.Linkifier2)),this.linkifier2.registerLinkProvider(this._instantiationService.createInstance(p.OscLinkProvider)),this._decorationService=this._instantiationService.createInstance(L.DecorationService),this._instantiationService.setService(K.IDecorationService,this._decorationService),this.register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this.register(this._inputHandler.onRequestRefreshRows((X,J)=>this.refresh(X,J))),this.register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this.register(this._inputHandler.onRequestReset(()=>this.reset())),this.register(this._inputHandler.onRequestWindowsOptionsReport(X=>this._reportWindowsOptions(X))),this.register(this._inputHandler.onColor(X=>this._handleColorEvent(X))),this.register((0,O.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,O.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,O.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,O.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize(X=>this._afterResize(X.cols,X.rows))),this.register((0,G.toDisposable)(()=>{var X,J;this._customKeyEventHandler=void 0,(J=(X=this.element)===null||X===void 0?void 0:X.parentNode)===null||J===void 0||J.removeChild(this.element)}))}_handleColorEvent(P){if(this._themeService)for(const X of P){let J,ne="";switch(X.index){case 256:J="foreground",ne="10";break;case 257:J="background",ne="11";break;case 258:J="cursor",ne="12";break;default:J="ansi",ne="4;"+X.index}switch(X.type){case 0:const ce=D.color.toColorRGB(J==="ansi"?this._themeService.colors.ansi[X.index]:this._themeService.colors[J]);this.coreService.triggerDataEvent(`${V.C0.ESC}]${ne};${(0,$.toRgbString)(ce)}${V.C1_ESCAPED.ST}`);break;case 1:if(J==="ansi")this._themeService.modifyColors(_e=>_e.ansi[X.index]=D.rgba.toColor(...X.color));else{const _e=J;this._themeService.modifyColors(Pe=>Pe[_e]=D.rgba.toColor(...X.color))}break;case 2:this._themeService.restoreColor(X.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(P){P?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(oe.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(P){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(V.C0.ESC+"[I"),this.updateCursorStyle(P),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var P;return(P=this.textarea)===null||P===void 0?void 0:P.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(V.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const P=this.buffer.ybase+this.buffer.y,X=this.buffer.lines.get(P);if(!X)return;const J=Math.min(this.buffer.x,this.cols-1),ne=this._renderService.dimensions.css.cell.height,ce=X.getWidth(J),_e=this._renderService.dimensions.css.cell.width*ce,Pe=this.buffer.y*this._renderService.dimensions.css.cell.height,it=J*this._renderService.dimensions.css.cell.width;this.textarea.style.left=it+"px",this.textarea.style.top=Pe+"px",this.textarea.style.width=_e+"px",this.textarea.style.height=ne+"px",this.textarea.style.lineHeight=ne+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,u.addDisposableDomListener)(this.element,"copy",X=>{this.hasSelection()&&(0,l.copyHandler)(X,this._selectionService)}));const P=X=>(0,l.handlePasteEvent)(X,this.textarea,this.coreService,this.optionsService);this.register((0,u.addDisposableDomListener)(this.textarea,"paste",P)),this.register((0,u.addDisposableDomListener)(this.element,"paste",P)),Z.isFirefox?this.register((0,u.addDisposableDomListener)(this.element,"mousedown",X=>{X.button===2&&(0,l.rightClickHandler)(X,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this.register((0,u.addDisposableDomListener)(this.element,"contextmenu",X=>{(0,l.rightClickHandler)(X,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Z.isLinux&&this.register((0,u.addDisposableDomListener)(this.element,"auxclick",X=>{X.button===1&&(0,l.moveTextAreaUnderMouseCursor)(X,this.textarea,this.screenElement)}))}_bindKeys(){this.register((0,u.addDisposableDomListener)(this.textarea,"keyup",P=>this._keyUp(P),!0)),this.register((0,u.addDisposableDomListener)(this.textarea,"keydown",P=>this._keyDown(P),!0)),this.register((0,u.addDisposableDomListener)(this.textarea,"keypress",P=>this._keyPress(P),!0)),this.register((0,u.addDisposableDomListener)(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this.register((0,u.addDisposableDomListener)(this.textarea,"compositionupdate",P=>this._compositionHelper.compositionupdate(P))),this.register((0,u.addDisposableDomListener)(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this.register((0,u.addDisposableDomListener)(this.textarea,"input",P=>this._inputEvent(P),!0)),this.register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(P){var X;if(!P)throw new Error("Terminal requires a parent element.");P.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this._document=P.ownerDocument,this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),P.appendChild(this.element);const J=ve.createDocumentFragment();this._viewportElement=ve.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),J.appendChild(this._viewportElement),this._viewportScrollArea=ve.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=ve.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._helperContainer=ve.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),J.appendChild(this.screenElement),this.textarea=ve.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",h.promptLabel),Z.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._coreBrowserService=this._instantiationService.createInstance(w.CoreBrowserService,this.textarea,(X=this._document.defaultView)!==null&&X!==void 0?X:window),this._instantiationService.setService(E.ICoreBrowserService,this._coreBrowserService),this.register((0,u.addDisposableDomListener)(this.textarea,"focus",ne=>this._handleTextAreaFocus(ne))),this.register((0,u.addDisposableDomListener)(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(b.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(E.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(x.ThemeService),this._instantiationService.setService(E.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(k.CharacterJoinerService),this._instantiationService.setService(E.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(A.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(E.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange(ne=>this._onRender.fire(ne))),this.onResize(ne=>this._renderService.resize(ne.cols,ne.rows)),this._compositionView=ve.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(y.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this.element.appendChild(J);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._mouseService=this._instantiationService.createInstance(T.MouseService),this._instantiationService.setService(E.IMouseService,this._mouseService),this.viewport=this._instantiationService.createInstance(g.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines(ne=>this.scrollLines(ne.amount,ne.suppressScrollEvent,1)),this.register(this._inputHandler.onRequestSyncScrollBar(()=>this.viewport.syncScrollArea())),this.register(this.viewport),this.register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this.register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this.register(this.onBlur(()=>this._renderService.handleBlur())),this.register(this.onFocus(()=>this._renderService.handleFocus())),this.register(this._renderService.onDimensionsChange(()=>this.viewport.syncScrollArea())),this._selectionService=this.register(this._instantiationService.createInstance(C.SelectionService,this.element,this.screenElement,this.linkifier2)),this._instantiationService.setService(E.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines(ne=>this.scrollLines(ne.amount,ne.suppressScrollEvent))),this.register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this.register(this._selectionService.onRequestRedraw(ne=>this._renderService.handleSelectionChanged(ne.start,ne.end,ne.columnSelectMode))),this.register(this._selectionService.onLinuxMouseSelection(ne=>{this.textarea.value=ne,this.textarea.focus(),this.textarea.select()})),this.register(this._onScroll.event(ne=>{this.viewport.syncScrollArea(),this._selectionService.refresh()})),this.register((0,u.addDisposableDomListener)(this._viewportElement,"scroll",()=>this._selectionService.refresh())),this.linkifier2.attachToDom(this.screenElement,this._mouseService,this._renderService),this.register(this._instantiationService.createInstance(v.BufferDecorationRenderer,this.screenElement)),this.register((0,u.addDisposableDomListener)(this.element,"mousedown",ne=>this._selectionService.handleMouseDown(ne))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(oe.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",ne=>this._handleScreenReaderModeOptionChange(ne))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(m.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",ne=>{!this._overviewRulerRenderer&&ne&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(m.OverviewRulerRenderer,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(_.DomRenderer,this.element,this.screenElement,this._viewportElement,this.linkifier2)}bindMouse(){const P=this,X=this.element;function J(_e){const Pe=P._mouseService.getMouseReportCoords(_e,P.screenElement);if(!Pe)return!1;let it,at;switch(_e.overrideType||_e.type){case"mousemove":at=32,_e.buttons===void 0?(it=3,_e.button!==void 0&&(it=_e.button<3?_e.button:3)):it=1&_e.buttons?0:4&_e.buttons?1:2&_e.buttons?2:3;break;case"mouseup":at=0,it=_e.button<3?_e.button:3;break;case"mousedown":at=1,it=_e.button<3?_e.button:3;break;case"wheel":if(P.viewport.getLinesScrolled(_e)===0)return!1;at=_e.deltaY<0?0:1,it=4;break;default:return!1}return!(at===void 0||it===void 0||it>4)&&P.coreMouseService.triggerMouseEvent({col:Pe.col,row:Pe.row,x:Pe.x,y:Pe.y,button:it,action:at,ctrl:_e.ctrlKey,alt:_e.altKey,shift:_e.shiftKey})}const ne={mouseup:null,wheel:null,mousedrag:null,mousemove:null},ce={mouseup:_e=>(J(_e),_e.buttons||(this._document.removeEventListener("mouseup",ne.mouseup),ne.mousedrag&&this._document.removeEventListener("mousemove",ne.mousedrag)),this.cancel(_e)),wheel:_e=>(J(_e),this.cancel(_e,!0)),mousedrag:_e=>{_e.buttons&&J(_e)},mousemove:_e=>{_e.buttons||J(_e)}};this.register(this.coreMouseService.onProtocolChange(_e=>{_e?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(_e)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&_e?ne.mousemove||(X.addEventListener("mousemove",ce.mousemove),ne.mousemove=ce.mousemove):(X.removeEventListener("mousemove",ne.mousemove),ne.mousemove=null),16&_e?ne.wheel||(X.addEventListener("wheel",ce.wheel,{passive:!1}),ne.wheel=ce.wheel):(X.removeEventListener("wheel",ne.wheel),ne.wheel=null),2&_e?ne.mouseup||(X.addEventListener("mouseup",ce.mouseup),ne.mouseup=ce.mouseup):(this._document.removeEventListener("mouseup",ne.mouseup),X.removeEventListener("mouseup",ne.mouseup),ne.mouseup=null),4&_e?ne.mousedrag||(ne.mousedrag=ce.mousedrag):(this._document.removeEventListener("mousemove",ne.mousedrag),ne.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,u.addDisposableDomListener)(X,"mousedown",_e=>{if(_e.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(_e))return J(_e),ne.mouseup&&this._document.addEventListener("mouseup",ne.mouseup),ne.mousedrag&&this._document.addEventListener("mousemove",ne.mousedrag),this.cancel(_e)})),this.register((0,u.addDisposableDomListener)(X,"wheel",_e=>{if(!ne.wheel){if(!this.buffer.hasScrollback){const Pe=this.viewport.getLinesScrolled(_e);if(Pe===0)return;const it=V.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(_e.deltaY<0?"A":"B");let at="";for(let rt=0;rt{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(_e),this.cancel(_e)},{passive:!0})),this.register((0,u.addDisposableDomListener)(X,"touchmove",_e=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(_e)?void 0:this.cancel(_e)},{passive:!1}))}refresh(P,X){var J;(J=this._renderService)===null||J===void 0||J.refreshRows(P,X)}updateCursorStyle(P){var X;!((X=this._selectionService)===null||X===void 0)&&X.shouldColumnSelect(P)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(P,X,J=0){var ne;J===1?(super.scrollLines(P,X,J),this.refresh(0,this.rows-1)):(ne=this.viewport)===null||ne===void 0||ne.scrollLines(P)}paste(P){(0,l.paste)(P,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(P){this._customKeyEventHandler=P}registerLinkProvider(P){return this.linkifier2.registerLinkProvider(P)}registerCharacterJoiner(P){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const X=this._characterJoinerService.register(P);return this.refresh(0,this.rows-1),X}deregisterCharacterJoiner(P){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(P)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(P){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+P)}registerDecoration(P){return this._decorationService.registerDecoration(P)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(P,X,J){this._selectionService.setSelection(P,X,J)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var P;(P=this._selectionService)===null||P===void 0||P.clearSelection()}selectAll(){var P;(P=this._selectionService)===null||P===void 0||P.selectAll()}selectLines(P,X){var J;(J=this._selectionService)===null||J===void 0||J.selectLines(P,X)}_keyDown(P){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(P)===!1)return!1;const X=this.browser.isMac&&this.options.macOptionIsMeta&&P.altKey;if(!X&&!this._compositionHelper.keydown(P))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;X||P.key!=="Dead"&&P.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const J=(0,I.evaluateKeyboardEvent)(P,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(P),J.type===3||J.type===2){const ne=this.rows-1;return this.scrollLines(J.type===2?-ne:ne),this.cancel(P,!0)}return J.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,P)||(J.cancel&&this.cancel(P,!0),!J.key||!!(P.key&&!P.ctrlKey&&!P.altKey&&!P.metaKey&&P.key.length===1&&P.key.charCodeAt(0)>=65&&P.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(J.key!==V.C0.ETX&&J.key!==V.C0.CR||(this.textarea.value=""),this._onKey.fire({key:J.key,domEvent:P}),this._showCursor(),this.coreService.triggerDataEvent(J.key,!0),!this.optionsService.rawOptions.screenReaderMode||P.altKey||P.ctrlKey?this.cancel(P,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(P,X){const J=P.isMac&&!this.options.macOptionIsMeta&&X.altKey&&!X.ctrlKey&&!X.metaKey||P.isWindows&&X.altKey&&X.ctrlKey&&!X.metaKey||P.isWindows&&X.getModifierState("AltGraph");return X.type==="keypress"?J:J&&(!X.keyCode||X.keyCode>47)}_keyUp(P){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(P)===!1||(function(X){return X.keyCode===16||X.keyCode===17||X.keyCode===18}(P)||this.focus(),this.updateCursorStyle(P),this._keyPressHandled=!1)}_keyPress(P){let X;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(P)===!1)return!1;if(this.cancel(P),P.charCode)X=P.charCode;else if(P.which===null||P.which===void 0)X=P.keyCode;else{if(P.which===0||P.charCode===0)return!1;X=P.which}return!(!X||(P.altKey||P.ctrlKey||P.metaKey)&&!this._isThirdLevelShift(this.browser,P)||(X=String.fromCharCode(X),this._onKey.fire({key:X,domEvent:P}),this._showCursor(),this.coreService.triggerDataEvent(X,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(P){if(P.data&&P.inputType==="insertText"&&(!P.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const X=P.data;return this.coreService.triggerDataEvent(X,!0),this.cancel(P),!0}return!1}resize(P,X){P!==this.cols||X!==this.rows?super.resize(P,X):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(P,X){var J,ne;(J=this._charSizeService)===null||J===void 0||J.measure(),(ne=this.viewport)===null||ne===void 0||ne.syncScrollArea(!0)}clear(){var P;if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let X=1;X{Object.defineProperty(a,"__esModule",{value:!0}),a.TimeBasedDebouncer=void 0,a.TimeBasedDebouncer=class{constructor(c,l=1e3){this._renderCallback=c,this._debounceThresholdMS=l,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(c,l,u){this._rowCount=u,c=c!==void 0?c:0,l=l!==void 0?l:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,c):c,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,l):l;const d=Date.now();if(d-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=d,this._innerRefresh();else if(!this._additionalRefreshRequested){const h=d-this._lastRefreshMs,p=this._debounceThresholdMS-h;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},p)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const c=Math.max(this._rowStart,0),l=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(c,l)}}},1680:function(o,a,c){var l=this&&this.__decorate||function(y,_,b,k){var w,T=arguments.length,A=T<3?_:k===null?k=Object.getOwnPropertyDescriptor(_,b):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(y,_,b,k);else for(var C=y.length-1;C>=0;C--)(w=y[C])&&(A=(T<3?w(A):T>3?w(_,b,A):w(_,b))||A);return T>3&&A&&Object.defineProperty(_,b,A),A},u=this&&this.__param||function(y,_){return function(b,k){_(b,k,y)}};Object.defineProperty(a,"__esModule",{value:!0}),a.Viewport=void 0;const d=c(3656),h=c(4725),p=c(8460),g=c(844),v=c(2585);let m=a.Viewport=class extends g.Disposable{constructor(y,_,b,k,w,T,A,C){super(),this._viewportElement=y,this._scrollArea=_,this._bufferService=b,this._optionsService=k,this._charSizeService=w,this._renderService=T,this._coreBrowserService=A,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new p.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,d.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(E=>this._activeBuffer=E.activeBuffer)),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange(E=>this._renderDimensions=E)),this._handleThemeChange(C.colors),this.register(C.onChangeColors(E=>this._handleThemeChange(E))),this.register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.syncScrollArea())),setTimeout(()=>this.syncScrollArea())}_handleThemeChange(y){this._viewportElement.style.backgroundColor=y.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame(()=>this.syncScrollArea())}_refresh(y){if(y)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderService.dimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderService.dimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const _=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderService.dimensions.css.canvas.height);this._lastRecordedBufferHeight!==_&&(this._lastRecordedBufferHeight=_,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const y=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==y&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=y),this._refreshAnimationFrame=null}syncScrollArea(y=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(y);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(y)}_handleScroll(y){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const _=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:_,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const y=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(y*(this._smoothScrollState.target-this._smoothScrollState.origin)),y<1?this._coreBrowserService.window.requestAnimationFrame(()=>this._smoothScroll()):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(y,_){const b=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(_<0&&this._viewportElement.scrollTop!==0||_>0&&b0&&(k=N),w=""}}return{bufferElements:T,cursorElement:k}}getLinesScrolled(y){if(y.deltaY===0||y.shiftKey)return 0;let _=this._applyScrollModifier(y.deltaY,y);return y.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(_/=this._currentRowHeight+0,this._wheelPartialScroll+=_,_=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):y.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(_*=this._bufferService.rows),_}_applyScrollModifier(y,_){const b=this._optionsService.rawOptions.fastScrollModifier;return b==="alt"&&_.altKey||b==="ctrl"&&_.ctrlKey||b==="shift"&&_.shiftKey?y*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:y*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(y){this._lastTouchY=y.touches[0].pageY}handleTouchMove(y){const _=this._lastTouchY-y.touches[0].pageY;return this._lastTouchY=y.touches[0].pageY,_!==0&&(this._viewportElement.scrollTop+=_,this._bubbleScroll(y,_))}};a.Viewport=m=l([u(2,v.IBufferService),u(3,v.IOptionsService),u(4,h.ICharSizeService),u(5,h.IRenderService),u(6,h.ICoreBrowserService),u(7,h.IThemeService)],m)},3107:function(o,a,c){var l=this&&this.__decorate||function(m,y,_,b){var k,w=arguments.length,T=w<3?y:b===null?b=Object.getOwnPropertyDescriptor(y,_):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(m,y,_,b);else for(var A=m.length-1;A>=0;A--)(k=m[A])&&(T=(w<3?k(T):w>3?k(y,_,T):k(y,_))||T);return w>3&&T&&Object.defineProperty(y,_,T),T},u=this&&this.__param||function(m,y){return function(_,b){y(_,b,m)}};Object.defineProperty(a,"__esModule",{value:!0}),a.BufferDecorationRenderer=void 0;const d=c(3656),h=c(4725),p=c(844),g=c(2585);let v=a.BufferDecorationRenderer=class extends p.Disposable{constructor(m,y,_,b){super(),this._screenElement=m,this._bufferService=y,this._decorationService=_,this._renderService=b,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this.register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this.register((0,d.addDisposableDomListener)(window,"resize",()=>this._queueRefresh())),this.register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this.register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this.register(this._decorationService.onDecorationRemoved(k=>this._removeDecoration(k))),this.register((0,p.toDisposable)(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(const m of this._decorationService.decorations)this._renderDecoration(m);this._dimensionsChanged=!1}_renderDecoration(m){this._refreshStyle(m),this._dimensionsChanged&&this._refreshXPosition(m)}_createElement(m){var y,_;const b=document.createElement("div");b.classList.add("xterm-decoration"),b.classList.toggle("xterm-decoration-top-layer",((y=m==null?void 0:m.options)===null||y===void 0?void 0:y.layer)==="top"),b.style.width=`${Math.round((m.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,b.style.height=(m.options.height||1)*this._renderService.dimensions.css.cell.height+"px",b.style.top=(m.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",b.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const k=(_=m.options.x)!==null&&_!==void 0?_:0;return k&&k>this._bufferService.cols&&(b.style.display="none"),this._refreshXPosition(m,b),b}_refreshStyle(m){const y=m.marker.line-this._bufferService.buffers.active.ydisp;if(y<0||y>=this._bufferService.rows)m.element&&(m.element.style.display="none",m.onRenderEmitter.fire(m.element));else{let _=this._decorationElements.get(m);_||(_=this._createElement(m),m.element=_,this._decorationElements.set(m,_),this._container.appendChild(_),m.onDispose(()=>{this._decorationElements.delete(m),_.remove()})),_.style.top=y*this._renderService.dimensions.css.cell.height+"px",_.style.display=this._altBufferIsActive?"none":"block",m.onRenderEmitter.fire(_)}}_refreshXPosition(m,y=m.element){var _;if(!y)return;const b=(_=m.options.x)!==null&&_!==void 0?_:0;(m.options.anchor||"left")==="right"?y.style.right=b?b*this._renderService.dimensions.css.cell.width+"px":"":y.style.left=b?b*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(m){var y;(y=this._decorationElements.get(m))===null||y===void 0||y.remove(),this._decorationElements.delete(m),m.dispose()}};a.BufferDecorationRenderer=v=l([u(1,g.IBufferService),u(2,g.IDecorationService),u(3,h.IRenderService)],v)},5871:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.ColorZoneStore=void 0,a.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(c){if(c.options.overviewRulerOptions){for(const l of this._zones)if(l.color===c.options.overviewRulerOptions.color&&l.position===c.options.overviewRulerOptions.position){if(this._lineIntersectsZone(l,c.marker.line))return;if(this._lineAdjacentToZone(l,c.marker.line,c.options.overviewRulerOptions.position))return void this._addLineToZone(l,c.marker.line)}if(this._zonePoolIndex=c.startBufferLine&&l<=c.endBufferLine}_lineAdjacentToZone(c,l,u){return l>=c.startBufferLine-this._linePadding[u||"full"]&&l<=c.endBufferLine+this._linePadding[u||"full"]}_addLineToZone(c,l){c.startBufferLine=Math.min(c.startBufferLine,l),c.endBufferLine=Math.max(c.endBufferLine,l)}}},5744:function(o,a,c){var l=this&&this.__decorate||function(k,w,T,A){var C,E=arguments.length,x=E<3?w:A===null?A=Object.getOwnPropertyDescriptor(w,T):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(k,w,T,A);else for(var D=k.length-1;D>=0;D--)(C=k[D])&&(x=(E<3?C(x):E>3?C(w,T,x):C(w,T))||x);return E>3&&x&&Object.defineProperty(w,T,x),x},u=this&&this.__param||function(k,w){return function(T,A){w(T,A,k)}};Object.defineProperty(a,"__esModule",{value:!0}),a.OverviewRulerRenderer=void 0;const d=c(5871),h=c(3656),p=c(4725),g=c(844),v=c(2585),m={full:0,left:0,center:0,right:0},y={full:0,left:0,center:0,right:0},_={full:0,left:0,center:0,right:0};let b=a.OverviewRulerRenderer=class extends g.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(k,w,T,A,C,E,x){var D;super(),this._viewportElement=k,this._screenElement=w,this._bufferService=T,this._decorationService=A,this._renderService=C,this._optionsService=E,this._coreBrowseService=x,this._colorZoneStore=new d.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=document.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(D=this._viewportElement.parentElement)===null||D===void 0||D.insertBefore(this._canvas,this._viewportElement);const N=this._canvas.getContext("2d");if(!N)throw new Error("Ctx cannot be null");this._ctx=N,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,g.toDisposable)(()=>{var O;(O=this._canvas)===null||O===void 0||O.remove()}))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this.register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0)))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this.register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this.register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())}))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender(()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",()=>this._queueRefresh(!0))),this.register((0,h.addDisposableDomListener)(this._coreBrowseService.window,"resize",()=>this._queueRefresh(!0))),this._queueRefresh(!0)}_refreshDrawConstants(){const k=Math.floor(this._canvas.width/3),w=Math.ceil(this._canvas.width/3);y.full=this._canvas.width,y.left=k,y.center=w,y.right=k,this._refreshDrawHeightConstants(),_.full=0,_.left=0,_.center=y.left,_.right=y.left+y.center}_refreshDrawHeightConstants(){m.full=Math.round(2*this._coreBrowseService.dpr);const k=this._canvas.height/this._bufferService.buffer.lines.length,w=Math.round(Math.max(Math.min(k,12),6)*this._coreBrowseService.dpr);m.left=w,m.center=w,m.right=w}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*m.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*m.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*m.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*m.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowseService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowseService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(const w of this._decorationService.decorations)this._colorZoneStore.addDecoration(w);this._ctx.lineWidth=1;const k=this._colorZoneStore.zones;for(const w of k)w.position!=="full"&&this._renderColorZone(w);for(const w of k)w.position==="full"&&this._renderColorZone(w);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(k){this._ctx.fillStyle=k.color,this._ctx.fillRect(_[k.position||"full"],Math.round((this._canvas.height-1)*(k.startBufferLine/this._bufferService.buffers.active.lines.length)-m[k.position||"full"]/2),y[k.position||"full"],Math.round((this._canvas.height-1)*((k.endBufferLine-k.startBufferLine)/this._bufferService.buffers.active.lines.length)+m[k.position||"full"]))}_queueRefresh(k,w){this._shouldUpdateDimensions=k||this._shouldUpdateDimensions,this._shouldUpdateAnchor=w||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowseService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};a.OverviewRulerRenderer=b=l([u(2,v.IBufferService),u(3,v.IDecorationService),u(4,p.IRenderService),u(5,v.IOptionsService),u(6,p.ICoreBrowserService)],b)},2950:function(o,a,c){var l=this&&this.__decorate||function(v,m,y,_){var b,k=arguments.length,w=k<3?m:_===null?_=Object.getOwnPropertyDescriptor(m,y):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(v,m,y,_);else for(var T=v.length-1;T>=0;T--)(b=v[T])&&(w=(k<3?b(w):k>3?b(m,y,w):b(m,y))||w);return k>3&&w&&Object.defineProperty(m,y,w),w},u=this&&this.__param||function(v,m){return function(y,_){m(y,_,v)}};Object.defineProperty(a,"__esModule",{value:!0}),a.CompositionHelper=void 0;const d=c(4725),h=c(2585),p=c(2584);let g=a.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(v,m,y,_,b,k){this._textarea=v,this._compositionView=m,this._bufferService=y,this._optionsService=_,this._coreService=b,this._renderService=k,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(v){this._compositionView.textContent=v.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(v){if(this._isComposing||this._isSendingComposition){if(v.keyCode===229||v.keyCode===16||v.keyCode===17||v.keyCode===18)return!1;this._finalizeComposition(!1)}return v.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(v){if(this._compositionView.classList.remove("active"),this._isComposing=!1,v){const m={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){let y;this._isSendingComposition=!1,m.start+=this._dataAlreadySent.length,y=this._isComposing?this._textarea.value.substring(m.start,m.end):this._textarea.value.substring(m.start),y.length>0&&this._coreService.triggerDataEvent(y,!0)}},0)}else{this._isSendingComposition=!1;const m=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(m,!0)}}_handleAnyTextareaChanges(){const v=this._textarea.value;setTimeout(()=>{if(!this._isComposing){const m=this._textarea.value,y=m.replace(v,"");this._dataAlreadySent=y,m.length>v.length?this._coreService.triggerDataEvent(y,!0):m.lengththis.updateCompositionElements(!0),0)}}};a.CompositionHelper=g=l([u(2,h.IBufferService),u(3,h.IOptionsService),u(4,h.ICoreService),u(5,d.IRenderService)],g)},9806:(o,a)=>{function c(l,u,d){const h=d.getBoundingClientRect(),p=l.getComputedStyle(d),g=parseInt(p.getPropertyValue("padding-left")),v=parseInt(p.getPropertyValue("padding-top"));return[u.clientX-h.left-g,u.clientY-h.top-v]}Object.defineProperty(a,"__esModule",{value:!0}),a.getCoords=a.getCoordsRelativeToElement=void 0,a.getCoordsRelativeToElement=c,a.getCoords=function(l,u,d,h,p,g,v,m,y){if(!g)return;const _=c(l,u,d);return _?(_[0]=Math.ceil((_[0]+(y?v/2:0))/v),_[1]=Math.ceil(_[1]/m),_[0]=Math.min(Math.max(_[0],1),h+(y?1:0)),_[1]=Math.min(Math.max(_[1],1),p),_):void 0}},9504:(o,a,c)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.moveToCellSequence=void 0;const l=c(2584);function u(m,y,_,b){const k=m-d(m,_),w=y-d(y,_),T=Math.abs(k-w)-function(A,C,E){let x=0;const D=A-d(A,E),N=C-d(C,E);for(let O=0;O=0&&my?"A":"B"}function p(m,y,_,b,k,w){let T=m,A=y,C="";for(;T!==_||A!==b;)T+=k?1:-1,k&&T>w.cols-1?(C+=w.buffer.translateBufferLineToString(A,!1,m,T),T=0,m=0,A++):!k&&T<0&&(C+=w.buffer.translateBufferLineToString(A,!1,0,m+1),T=w.cols-1,m=T,A--);return C+w.buffer.translateBufferLineToString(A,!1,m,T)}function g(m,y){const _=y?"O":"[";return l.C0.ESC+_+m}function v(m,y){m=Math.floor(m);let _="";for(let b=0;b0?D-d(D,N):E;const Z=D,q=function(V,I,$,L,K,se){let oe;return oe=u($,L,K,se).length>0?L-d(L,K):I,V<$&&oe<=L||V>=$&&oem?"D":"C",v(Math.abs(k-m),g(T,b));T=w>y?"D":"C";const A=Math.abs(w-y);return v(function(C,E){return E.cols-C}(w>y?m:k,_)+(A-1)*_.cols+1+((w>y?k:m)-1),g(T,b))}},1296:function(o,a,c){var l=this&&this.__decorate||function(N,O,G,Z){var q,V=arguments.length,I=V<3?O:Z===null?Z=Object.getOwnPropertyDescriptor(O,G):Z;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(N,O,G,Z);else for(var $=N.length-1;$>=0;$--)(q=N[$])&&(I=(V<3?q(I):V>3?q(O,G,I):q(O,G))||I);return V>3&&I&&Object.defineProperty(O,G,I),I},u=this&&this.__param||function(N,O){return function(G,Z){O(G,Z,N)}};Object.defineProperty(a,"__esModule",{value:!0}),a.DomRenderer=void 0;const d=c(3787),h=c(2550),p=c(2223),g=c(6171),v=c(4725),m=c(8055),y=c(8460),_=c(844),b=c(2585),k="xterm-dom-renderer-owner-",w="xterm-rows",T="xterm-fg-",A="xterm-bg-",C="xterm-focus",E="xterm-selection";let x=1,D=a.DomRenderer=class extends _.Disposable{constructor(N,O,G,Z,q,V,I,$,L,K){super(),this._element=N,this._screenElement=O,this._viewportElement=G,this._linkifier2=Z,this._charSizeService=V,this._optionsService=I,this._bufferService=$,this._coreBrowserService=L,this._themeService=K,this._terminalClass=x++,this._rowElements=[],this.onRequestRedraw=this.register(new y.EventEmitter).event,this._rowContainer=document.createElement("div"),this._rowContainer.classList.add(w),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=document.createElement("div"),this._selectionContainer.classList.add(E),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,g.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._themeService.onChangeColors(se=>this._injectCss(se))),this._injectCss(this._themeService.colors),this._rowFactory=q.createInstance(d.DomRendererRowFactory,document),this._element.classList.add(k+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline(se=>this._handleLinkHover(se))),this.register(this._linkifier2.onHideLinkUnderline(se=>this._handleLinkLeave(se))),this.register((0,_.toDisposable)(()=>{this._element.classList.remove(k+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new h.WidthCache(document),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){const N=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*N,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*N),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/N),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/N),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(const G of this._rowElements)G.style.width=`${this.dimensions.css.canvas.width}px`,G.style.height=`${this.dimensions.css.cell.height}px`,G.style.lineHeight=`${this.dimensions.css.cell.height}px`,G.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const O=`${this._terminalSelector} .${w} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=O,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(N){this._themeStyleElement||(this._themeStyleElement=document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let O=`${this._terminalSelector} .${w} { color: ${N.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;O+=`${this._terminalSelector} .${w} .xterm-dim { color: ${m.color.multiplyOpacity(N.foreground,.5).css};}`,O+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`,O+="@keyframes blink_box_shadow_"+this._terminalClass+" { 50% { border-bottom-style: hidden; }}",O+="@keyframes blink_block_"+this._terminalClass+` { 0% { background-color: ${N.cursor.css}; color: ${N.cursorAccent.css}; } 50% { background-color: inherit; color: ${N.cursor.css}; }}`,O+=`${this._terminalSelector} .${w}.${C} .xterm-cursor.xterm-cursor-blink:not(.xterm-cursor-block) { animation: blink_box_shadow_`+this._terminalClass+` 1s step-end infinite;}${this._terminalSelector} .${w}.${C} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: blink_block_`+this._terminalClass+` 1s step-end infinite;}${this._terminalSelector} .${w} .xterm-cursor.xterm-cursor-block { background-color: ${N.cursor.css}; color: ${N.cursorAccent.css};}${this._terminalSelector} .${w} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${N.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${w} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${N.cursor.css} inset;}${this._terminalSelector} .${w} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${N.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,O+=`${this._terminalSelector} .${E} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${E} div { position: absolute; background-color: ${N.selectionBackgroundOpaque.css};}${this._terminalSelector} .${E} div { position: absolute; background-color: ${N.selectionInactiveBackgroundOpaque.css};}`;for(const[G,Z]of N.ansi.entries())O+=`${this._terminalSelector} .${T}${G} { color: ${Z.css}; }${this._terminalSelector} .${T}${G}.xterm-dim { color: ${m.color.multiplyOpacity(Z,.5).css}; }${this._terminalSelector} .${A}${G} { background-color: ${Z.css}; }`;O+=`${this._terminalSelector} .${T}${p.INVERTED_DEFAULT_COLOR} { color: ${m.color.opaque(N.background).css}; }${this._terminalSelector} .${T}${p.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${m.color.multiplyOpacity(m.color.opaque(N.background),.5).css}; }${this._terminalSelector} .${A}${p.INVERTED_DEFAULT_COLOR} { background-color: ${N.foreground.css}; }`,this._themeStyleElement.textContent=O}_setDefaultSpacing(){const N=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${N}px`,this._rowFactory.defaultSpacing=N}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(N,O){for(let G=this._rowElements.length;G<=O;G++){const Z=document.createElement("div");this._rowContainer.appendChild(Z),this._rowElements.push(Z)}for(;this._rowElements.length>O;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(N,O){this._refreshRowElements(N,O),this._updateDimensions()}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(C)}handleFocus(){this._rowContainer.classList.add(C),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(N,O,G){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(N,O,G),this.renderRows(0,this._bufferService.rows-1),!N||!O)return;const Z=N[1]-this._bufferService.buffer.ydisp,q=O[1]-this._bufferService.buffer.ydisp,V=Math.max(Z,0),I=Math.min(q,this._bufferService.rows-1);if(V>=this._bufferService.rows||I<0)return;const $=document.createDocumentFragment();if(G){const L=N[0]>O[0];$.appendChild(this._createSelectionElement(V,L?O[0]:N[0],L?N[0]:O[0],I-V+1))}else{const L=Z===V?N[0]:0,K=V===q?O[0]:this._bufferService.cols;$.appendChild(this._createSelectionElement(V,L,K));const se=I-V-1;if($.appendChild(this._createSelectionElement(V+1,0,this._bufferService.cols,se)),V!==I){const oe=q===I?O[0]:this._bufferService.cols;$.appendChild(this._createSelectionElement(I,0,oe))}}this._selectionContainer.appendChild($)}_createSelectionElement(N,O,G,Z=1){const q=document.createElement("div");return q.style.height=Z*this.dimensions.css.cell.height+"px",q.style.top=N*this.dimensions.css.cell.height+"px",q.style.left=O*this.dimensions.css.cell.width+"px",q.style.width=this.dimensions.css.cell.width*(G-O)+"px",q}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(const N of this._rowElements)N.replaceChildren()}renderRows(N,O){const G=this._bufferService.buffer,Z=G.ybase+G.y,q=Math.min(G.x,this._bufferService.cols-1),V=this._optionsService.rawOptions.cursorBlink,I=this._optionsService.rawOptions.cursorStyle,$=this._optionsService.rawOptions.cursorInactiveStyle;for(let L=N;L<=O;L++){const K=L+G.ydisp,se=this._rowElements[L],oe=G.lines.get(K);if(!se||!oe)break;se.replaceChildren(...this._rowFactory.createRow(oe,K,K===Z,I,$,q,V,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${k}${this._terminalClass}`}_handleLinkHover(N){this._setCellUnderline(N.x1,N.x2,N.y1,N.y2,N.cols,!0)}_handleLinkLeave(N){this._setCellUnderline(N.x1,N.x2,N.y1,N.y2,N.cols,!1)}_setCellUnderline(N,O,G,Z,q,V){G<0&&(N=0),Z<0&&(O=0);const I=this._bufferService.rows-1;G=Math.max(Math.min(G,I),0),Z=Math.max(Math.min(Z,I),0),q=Math.min(q,this._bufferService.cols);const $=this._bufferService.buffer,L=$.ybase+$.y,K=Math.min($.x,q-1),se=this._optionsService.rawOptions.cursorBlink,oe=this._optionsService.rawOptions.cursorStyle,ve=this._optionsService.rawOptions.cursorInactiveStyle;for(let le=G;le<=Z;++le){const ue=le+$.ydisp,P=this._rowElements[le],X=$.lines.get(ue);if(!P||!X)break;P.replaceChildren(...this._rowFactory.createRow(X,ue,ue===L,oe,ve,K,se,this.dimensions.css.cell.width,this._widthCache,V?le===G?N:0:-1,V?(le===Z?O:q)-1:-1))}}};a.DomRenderer=D=l([u(4,b.IInstantiationService),u(5,v.ICharSizeService),u(6,b.IOptionsService),u(7,b.IBufferService),u(8,v.ICoreBrowserService),u(9,v.IThemeService)],D)},3787:function(o,a,c){var l=this&&this.__decorate||function(T,A,C,E){var x,D=arguments.length,N=D<3?A:E===null?E=Object.getOwnPropertyDescriptor(A,C):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(T,A,C,E);else for(var O=T.length-1;O>=0;O--)(x=T[O])&&(N=(D<3?x(N):D>3?x(A,C,N):x(A,C))||N);return D>3&&N&&Object.defineProperty(A,C,N),N},u=this&&this.__param||function(T,A){return function(C,E){A(C,E,T)}};Object.defineProperty(a,"__esModule",{value:!0}),a.DomRendererRowFactory=void 0;const d=c(2223),h=c(643),p=c(511),g=c(2585),v=c(8055),m=c(4725),y=c(4269),_=c(6171),b=c(3734);let k=a.DomRendererRowFactory=class{constructor(T,A,C,E,x,D,N){this._document=T,this._characterJoinerService=A,this._optionsService=C,this._coreBrowserService=E,this._coreService=x,this._decorationService=D,this._themeService=N,this._workCell=new p.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(T,A,C){this._selectionStart=T,this._selectionEnd=A,this._columnSelectMode=C}createRow(T,A,C,E,x,D,N,O,G,Z,q){const V=[],I=this._characterJoinerService.getJoinedCharacters(A),$=this._themeService.colors;let L,K=T.getNoBgTrimmedLength();C&&K0&&Pe===I[0][0]){at=!0;const ot=I.shift();Oe=new y.JoinedCellData(this._workCell,T.translateToString(!0,ot[0],ot[1]),ot[1]-ot[0]),rt=ot[1]-1,it=Oe.getWidth()}const xe=this._isCellInSelection(Pe,A),pe=C&&Pe===D,he=_e&&Pe>=Z&&Pe<=q;let ye=!1;this._decorationService.forEachDecorationAtCell(Pe,A,void 0,ot=>{ye=!0});let ke=Oe.getChars()||h.WHITESPACE_CELL_CHAR;if(ke===" "&&(Oe.isUnderline()||Oe.isOverline())&&(ke=" "),ne=it*O-G.get(ke,Oe.isBold(),Oe.isItalic()),L){if(se&&(xe&&J||!xe&&!J&&Oe.bg===ve)&&(xe&&J&&$.selectionForeground||Oe.fg===le)&&Oe.extended.ext===ue&&he===P&&ne===X&&!pe&&!at&&!ye){oe+=ke,se++;continue}se&&(L.textContent=oe),L=this._document.createElement("span"),se=0,oe=""}else L=this._document.createElement("span");if(ve=Oe.bg,le=Oe.fg,ue=Oe.extended.ext,P=he,X=ne,J=xe,at&&D>=Pe&&D<=rt&&(D=Pe),!this._coreService.isCursorHidden&&pe){if(ce.push("xterm-cursor"),this._coreBrowserService.isFocused)N&&ce.push("xterm-cursor-blink"),ce.push(E==="bar"?"xterm-cursor-bar":E==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(x)switch(x){case"outline":ce.push("xterm-cursor-outline");break;case"block":ce.push("xterm-cursor-block");break;case"bar":ce.push("xterm-cursor-bar");break;case"underline":ce.push("xterm-cursor-underline")}}if(Oe.isBold()&&ce.push("xterm-bold"),Oe.isItalic()&&ce.push("xterm-italic"),Oe.isDim()&&ce.push("xterm-dim"),oe=Oe.isInvisible()?h.WHITESPACE_CELL_CHAR:Oe.getChars()||h.WHITESPACE_CELL_CHAR,Oe.isUnderline()&&(ce.push(`xterm-underline-${Oe.extended.underlineStyle}`),oe===" "&&(oe=" "),!Oe.isUnderlineColorDefault()))if(Oe.isUnderlineColorRGB())L.style.textDecorationColor=`rgb(${b.AttributeData.toColorRGB(Oe.getUnderlineColor()).join(",")})`;else{let ot=Oe.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Oe.isBold()&&ot<8&&(ot+=8),L.style.textDecorationColor=$.ansi[ot].css}Oe.isOverline()&&(ce.push("xterm-overline"),oe===" "&&(oe=" ")),Oe.isStrikethrough()&&ce.push("xterm-strikethrough"),he&&(L.style.textDecoration="underline");let Le=Oe.getFgColor(),st=Oe.getFgColorMode(),gt=Oe.getBgColor(),Wt=Oe.getBgColorMode();const jt=!!Oe.isInverse();if(jt){const ot=Le;Le=gt,gt=ot;const $s=st;st=Wt,Wt=$s}let ht,Qt,It,ns=!1;switch(this._decorationService.forEachDecorationAtCell(Pe,A,void 0,ot=>{ot.options.layer!=="top"&&ns||(ot.backgroundColorRGB&&(Wt=50331648,gt=ot.backgroundColorRGB.rgba>>8&16777215,ht=ot.backgroundColorRGB),ot.foregroundColorRGB&&(st=50331648,Le=ot.foregroundColorRGB.rgba>>8&16777215,Qt=ot.foregroundColorRGB),ns=ot.options.layer==="top")}),!ns&&xe&&(ht=this._coreBrowserService.isFocused?$.selectionBackgroundOpaque:$.selectionInactiveBackgroundOpaque,gt=ht.rgba>>8&16777215,Wt=50331648,ns=!0,$.selectionForeground&&(st=50331648,Le=$.selectionForeground.rgba>>8&16777215,Qt=$.selectionForeground)),ns&&ce.push("xterm-decoration-top"),Wt){case 16777216:case 33554432:It=$.ansi[gt],ce.push(`xterm-bg-${gt}`);break;case 50331648:It=v.rgba.toColor(gt>>16,gt>>8&255,255>),this._addStyle(L,`background-color:#${w((gt>>>0).toString(16),"0",6)}`);break;default:jt?(It=$.foreground,ce.push(`xterm-bg-${d.INVERTED_DEFAULT_COLOR}`)):It=$.background}switch(ht||Oe.isDim()&&(ht=v.color.multiplyOpacity(It,.5)),st){case 16777216:case 33554432:Oe.isBold()&&Le<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(Le+=8),this._applyMinimumContrast(L,It,$.ansi[Le],Oe,ht,void 0)||ce.push(`xterm-fg-${Le}`);break;case 50331648:const ot=v.rgba.toColor(Le>>16&255,Le>>8&255,255&Le);this._applyMinimumContrast(L,It,ot,Oe,ht,Qt)||this._addStyle(L,`color:#${w(Le.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(L,It,$.foreground,Oe,ht,void 0)||jt&&ce.push(`xterm-fg-${d.INVERTED_DEFAULT_COLOR}`)}ce.length&&(L.className=ce.join(" "),ce.length=0),pe||at||ye?L.textContent=oe:se++,ne!==this.defaultSpacing&&(L.style.letterSpacing=`${ne}px`),V.push(L),Pe=rt}return L&&se&&(L.textContent=oe),V}_applyMinimumContrast(T,A,C,E,x,D){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,_.excludeFromContrastRatioDemands)(E.getCode()))return!1;const N=this._getContrastCache(E);let O;if(x||D||(O=N.getColor(A.rgba,C.rgba)),O===void 0){const G=this._optionsService.rawOptions.minimumContrastRatio/(E.isDim()?2:1);O=v.color.ensureContrastRatio(x||A,D||C,G),N.setColor((x||A).rgba,(D||C).rgba,O??null)}return!!O&&(this._addStyle(T,`color:${O.css}`),!0)}_getContrastCache(T){return T.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(T,A){T.setAttribute("style",`${T.getAttribute("style")||""}${A};`)}_isCellInSelection(T,A){const C=this._selectionStart,E=this._selectionEnd;return!(!C||!E)&&(this._columnSelectMode?C[0]<=E[0]?T>=C[0]&&A>=C[1]&&T=C[1]&&T>=E[0]&&A<=E[1]:A>C[1]&&A=C[0]&&T=C[0])}};function w(T,A,C){for(;T.length{Object.defineProperty(a,"__esModule",{value:!0}),a.WidthCache=void 0,a.WidthCache=class{constructor(c){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=c.createElement("div"),this._container.style.position="absolute",this._container.style.top="-50000px",this._container.style.width="50000px",this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const l=c.createElement("span"),u=c.createElement("span");u.style.fontWeight="bold";const d=c.createElement("span");d.style.fontStyle="italic";const h=c.createElement("span");h.style.fontWeight="bold",h.style.fontStyle="italic",this._measureElements=[l,u,d,h],this._container.appendChild(l),this._container.appendChild(u),this._container.appendChild(d),this._container.appendChild(h),c.body.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(c,l,u,d){c===this._font&&l===this._fontSize&&u===this._weight&&d===this._weightBold||(this._font=c,this._fontSize=l,this._weight=u,this._weightBold=d,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${u}`,this._measureElements[1].style.fontWeight=`${d}`,this._measureElements[2].style.fontWeight=`${u}`,this._measureElements[3].style.fontWeight=`${d}`,this.clear())}get(c,l,u){let d=0;if(!l&&!u&&c.length===1&&(d=c.charCodeAt(0))<256)return this._flat[d]!==-9999?this._flat[d]:this._flat[d]=this._measure(c,0);let h=c;l&&(h+="B"),u&&(h+="I");let p=this._holey.get(h);if(p===void 0){let g=0;l&&(g|=1),u&&(g|=2),p=this._measure(c,g),this._holey.set(h,p)}return p}_measure(c,l){const u=this._measureElements[l];return u.textContent=c.repeat(32),u.offsetWidth/32}}},2223:(o,a,c)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.TEXT_BASELINE=a.DIM_OPACITY=a.INVERTED_DEFAULT_COLOR=void 0;const l=c(6114);a.INVERTED_DEFAULT_COLOR=257,a.DIM_OPACITY=.5,a.TEXT_BASELINE=l.isFirefox||l.isLegacyEdge?"bottom":"ideographic"},6171:(o,a)=>{function c(l){return 57508<=l&&l<=57558}Object.defineProperty(a,"__esModule",{value:!0}),a.createRenderDimensions=a.excludeFromContrastRatioDemands=a.isRestrictedPowerlineGlyph=a.isPowerlineGlyph=a.throwIfFalsy=void 0,a.throwIfFalsy=function(l){if(!l)throw new Error("value must not be falsy");return l},a.isPowerlineGlyph=c,a.isRestrictedPowerlineGlyph=function(l){return 57520<=l&&l<=57527},a.excludeFromContrastRatioDemands=function(l){return c(l)||function(u){return 9472<=u&&u<=9631}(l)},a.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}}},456:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.SelectionModel=void 0,a.SelectionModel=class{constructor(c){this._bufferService=c,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){const c=this.selectionStart[0]+this.selectionStartLength;return c>this._bufferService.cols?c%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(c/this._bufferService.cols)-1]:[c%this._bufferService.cols,this.selectionStart[1]+Math.floor(c/this._bufferService.cols)]:[c,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const c=this.selectionStart[0]+this.selectionStartLength;return c>this._bufferService.cols?[c%this._bufferService.cols,this.selectionStart[1]+Math.floor(c/this._bufferService.cols)]:[Math.max(c,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const c=this.selectionStart,l=this.selectionEnd;return!(!c||!l)&&(c[1]>l[1]||c[1]===l[1]&&c[0]>l[0])}handleTrim(c){return this.selectionStart&&(this.selectionStart[1]-=c),this.selectionEnd&&(this.selectionEnd[1]-=c),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(o,a,c){var l=this&&this.__decorate||function(m,y,_,b){var k,w=arguments.length,T=w<3?y:b===null?b=Object.getOwnPropertyDescriptor(y,_):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(m,y,_,b);else for(var A=m.length-1;A>=0;A--)(k=m[A])&&(T=(w<3?k(T):w>3?k(y,_,T):k(y,_))||T);return w>3&&T&&Object.defineProperty(y,_,T),T},u=this&&this.__param||function(m,y){return function(_,b){y(_,b,m)}};Object.defineProperty(a,"__esModule",{value:!0}),a.CharSizeService=void 0;const d=c(2585),h=c(8460),p=c(844);let g=a.CharSizeService=class extends p.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(m,y,_){super(),this._optionsService=_,this.width=0,this.height=0,this._onCharSizeChange=this.register(new h.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event,this._measureStrategy=new v(m,y,this._optionsService),this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}measure(){const m=this._measureStrategy.measure();m.width===this.width&&m.height===this.height||(this.width=m.width,this.height=m.height,this._onCharSizeChange.fire())}};a.CharSizeService=g=l([u(2,d.IOptionsService)],g);class v{constructor(y,_,b){this._document=y,this._parentElement=_,this._optionsService=b,this._result={width:0,height:0},this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`;const y={height:Number(this._measureElement.offsetHeight),width:Number(this._measureElement.offsetWidth)};return y.width!==0&&y.height!==0&&(this._result.width=y.width/32,this._result.height=Math.ceil(y.height)),this._result}}},4269:function(o,a,c){var l=this&&this.__decorate||function(y,_,b,k){var w,T=arguments.length,A=T<3?_:k===null?k=Object.getOwnPropertyDescriptor(_,b):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(y,_,b,k);else for(var C=y.length-1;C>=0;C--)(w=y[C])&&(A=(T<3?w(A):T>3?w(_,b,A):w(_,b))||A);return T>3&&A&&Object.defineProperty(_,b,A),A},u=this&&this.__param||function(y,_){return function(b,k){_(b,k,y)}};Object.defineProperty(a,"__esModule",{value:!0}),a.CharacterJoinerService=a.JoinedCellData=void 0;const d=c(3734),h=c(643),p=c(511),g=c(2585);class v extends d.AttributeData{constructor(_,b,k){super(),this.content=0,this.combinedData="",this.fg=_.fg,this.bg=_.bg,this.combinedData=b,this._width=k}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(_){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}a.JoinedCellData=v;let m=a.CharacterJoinerService=class ML{constructor(_){this._bufferService=_,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new p.CellData}register(_){const b={id:this._nextCharacterJoinerId++,handler:_};return this._characterJoiners.push(b),b.id}deregister(_){for(let b=0;b1){const N=this._getJoinedRanges(w,C,A,b,T);for(let O=0;O1){const D=this._getJoinedRanges(w,C,A,b,T);for(let N=0;N{Object.defineProperty(a,"__esModule",{value:!0}),a.CoreBrowserService=void 0,a.CoreBrowserService=class{constructor(c,l){this._textarea=c,this.window=l,this._isFocused=!1,this._cachedIsFocused=void 0,this._textarea.addEventListener("focus",()=>this._isFocused=!0),this._textarea.addEventListener("blur",()=>this._isFocused=!1)}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}}},8934:function(o,a,c){var l=this&&this.__decorate||function(g,v,m,y){var _,b=arguments.length,k=b<3?v:y===null?y=Object.getOwnPropertyDescriptor(v,m):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(g,v,m,y);else for(var w=g.length-1;w>=0;w--)(_=g[w])&&(k=(b<3?_(k):b>3?_(v,m,k):_(v,m))||k);return b>3&&k&&Object.defineProperty(v,m,k),k},u=this&&this.__param||function(g,v){return function(m,y){v(m,y,g)}};Object.defineProperty(a,"__esModule",{value:!0}),a.MouseService=void 0;const d=c(4725),h=c(9806);let p=a.MouseService=class{constructor(g,v){this._renderService=g,this._charSizeService=v}getCoords(g,v,m,y,_){return(0,h.getCoords)(window,g,v,m,y,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,_)}getMouseReportCoords(g,v){const m=(0,h.getCoordsRelativeToElement)(window,g,v);if(this._charSizeService.hasValidSize)return m[0]=Math.min(Math.max(m[0],0),this._renderService.dimensions.css.canvas.width-1),m[1]=Math.min(Math.max(m[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(m[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(m[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(m[0]),y:Math.floor(m[1])}}};a.MouseService=p=l([u(0,d.IRenderService),u(1,d.ICharSizeService)],p)},3230:function(o,a,c){var l=this&&this.__decorate||function(k,w,T,A){var C,E=arguments.length,x=E<3?w:A===null?A=Object.getOwnPropertyDescriptor(w,T):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(k,w,T,A);else for(var D=k.length-1;D>=0;D--)(C=k[D])&&(x=(E<3?C(x):E>3?C(w,T,x):C(w,T))||x);return E>3&&x&&Object.defineProperty(w,T,x),x},u=this&&this.__param||function(k,w){return function(T,A){w(T,A,k)}};Object.defineProperty(a,"__esModule",{value:!0}),a.RenderService=void 0;const d=c(3656),h=c(6193),p=c(5596),g=c(4725),v=c(8460),m=c(844),y=c(7226),_=c(2585);let b=a.RenderService=class extends m.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(k,w,T,A,C,E,x,D){if(super(),this._rowCount=k,this._charSizeService=A,this._renderer=this.register(new m.MutableDisposable),this._pausedResizeTask=new y.DebouncedIdleTask,this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new v.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new v.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new v.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new v.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new h.RenderDebouncer(x.window,(N,O)=>this._renderRows(N,O)),this.register(this._renderDebouncer),this._screenDprMonitor=new p.ScreenDprMonitor(x.window),this._screenDprMonitor.setListener(()=>this.handleDevicePixelRatioChange()),this.register(this._screenDprMonitor),this.register(E.onResize(()=>this._fullRefresh())),this.register(E.buffers.onBufferActivate(()=>{var N;return(N=this._renderer.value)===null||N===void 0?void 0:N.clear()})),this.register(T.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this.register(C.onDecorationRegistered(()=>this._fullRefresh())),this.register(C.onDecorationRemoved(()=>this._fullRefresh())),this.register(T.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio"],()=>{this.clear(),this.handleResize(E.cols,E.rows),this._fullRefresh()})),this.register(T.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(E.buffer.y,E.buffer.y,!0))),this.register((0,d.addDisposableDomListener)(x.window,"resize",()=>this.handleDevicePixelRatioChange())),this.register(D.onChangeColors(()=>this._fullRefresh())),"IntersectionObserver"in x.window){const N=new x.window.IntersectionObserver(O=>this._handleIntersectionChange(O[O.length-1]),{threshold:0});N.observe(w),this.register({dispose:()=>N.disconnect()})}}_handleIntersectionChange(k){this._isPaused=k.isIntersecting===void 0?k.intersectionRatio===0:!k.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(k,w,T=!1){this._isPaused?this._needsFullRefresh=!0:(T||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(k,w,this._rowCount))}_renderRows(k,w){this._renderer.value&&(k=Math.min(k,this._rowCount-1),w=Math.min(w,this._rowCount-1),this._renderer.value.renderRows(k,w),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:k,end:w}),this._onRender.fire({start:k,end:w}),this._isNextRenderRedrawOnly=!0)}resize(k,w){this._rowCount=w,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(k){this._renderer.value=k,this._renderer.value.onRequestRedraw(w=>this.refreshRows(w.start,w.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh()}addRefreshCallback(k){return this._renderDebouncer.addRefreshCallback(k)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var k,w;this._renderer.value&&((w=(k=this._renderer.value).clearTextureAtlas)===null||w===void 0||w.call(k),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(k,w){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value.handleResize(k,w)):this._renderer.value.handleResize(k,w),this._fullRefresh())}handleCharSizeChanged(){var k;(k=this._renderer.value)===null||k===void 0||k.handleCharSizeChanged()}handleBlur(){var k;(k=this._renderer.value)===null||k===void 0||k.handleBlur()}handleFocus(){var k;(k=this._renderer.value)===null||k===void 0||k.handleFocus()}handleSelectionChanged(k,w,T){var A;this._selectionState.start=k,this._selectionState.end=w,this._selectionState.columnSelectMode=T,(A=this._renderer.value)===null||A===void 0||A.handleSelectionChanged(k,w,T)}handleCursorMove(){var k;(k=this._renderer.value)===null||k===void 0||k.handleCursorMove()}clear(){var k;(k=this._renderer.value)===null||k===void 0||k.clear()}};a.RenderService=b=l([u(2,_.IOptionsService),u(3,g.ICharSizeService),u(4,_.IDecorationService),u(5,_.IBufferService),u(6,g.ICoreBrowserService),u(7,g.IThemeService)],b)},9312:function(o,a,c){var l=this&&this.__decorate||function(C,E,x,D){var N,O=arguments.length,G=O<3?E:D===null?D=Object.getOwnPropertyDescriptor(E,x):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")G=Reflect.decorate(C,E,x,D);else for(var Z=C.length-1;Z>=0;Z--)(N=C[Z])&&(G=(O<3?N(G):O>3?N(E,x,G):N(E,x))||G);return O>3&&G&&Object.defineProperty(E,x,G),G},u=this&&this.__param||function(C,E){return function(x,D){E(x,D,C)}};Object.defineProperty(a,"__esModule",{value:!0}),a.SelectionService=void 0;const d=c(9806),h=c(9504),p=c(456),g=c(4725),v=c(8460),m=c(844),y=c(6114),_=c(4841),b=c(511),k=c(2585),w=" ",T=new RegExp(w,"g");let A=a.SelectionService=class extends m.Disposable{constructor(C,E,x,D,N,O,G,Z,q){super(),this._element=C,this._screenElement=E,this._linkifier=x,this._bufferService=D,this._coreService=N,this._mouseService=O,this._optionsService=G,this._renderService=Z,this._coreBrowserService=q,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new b.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new v.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new v.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new v.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new v.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=V=>this._handleMouseMove(V),this._mouseUpListener=V=>this._handleMouseUp(V),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(V=>this._handleTrim(V)),this.register(this._bufferService.buffers.onBufferActivate(V=>this._handleBufferActivate(V))),this.enable(),this._model=new p.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,m.toDisposable)(()=>{this._removeMouseDownListeners()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){const C=this._model.finalSelectionStart,E=this._model.finalSelectionEnd;return!(!C||!E||C[0]===E[0]&&C[1]===E[1])}get selectionText(){const C=this._model.finalSelectionStart,E=this._model.finalSelectionEnd;if(!C||!E)return"";const x=this._bufferService.buffer,D=[];if(this._activeSelectionMode===3){if(C[0]===E[0])return"";const N=C[0]N.replace(T," ")).join(y.isWindows?`\r `:` `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(C){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),y.isLinux&&C&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(C){const E=this._getMouseBufferCoords(C),x=this._model.finalSelectionStart,D=this._model.finalSelectionEnd;return!!(x&&D&&E)&&this._areCoordsInSelection(E,x,D)}isCellInSelection(C,E){const x=this._model.finalSelectionStart,D=this._model.finalSelectionEnd;return!(!x||!D)&&this._areCoordsInSelection([C,E],x,D)}_areCoordsInSelection(C,E,x){return C[1]>E[1]&&C[1]=E[0]&&C[0]=E[0]}_selectWordAtCursor(C,E){var x,D;const N=(D=(x=this._linkifier.currentLink)===null||x===void 0?void 0:x.link)===null||D===void 0?void 0:D.range;if(N)return this._model.selectionStart=[N.start.x-1,N.start.y-1],this._model.selectionStartLength=(0,_.getRangeLength)(N,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const O=this._getMouseBufferCoords(C);return!!O&&(this._selectWordAt(O,E),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(C,E){this._model.clearSelection(),C=Math.max(C,0),E=Math.min(E,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,C],this._model.selectionEnd=[this._bufferService.cols,E],this.refresh(),this._onSelectionChange.fire()}_handleTrim(C){this._model.handleTrim(C)&&this.refresh()}_getMouseBufferCoords(C){const E=this._mouseService.getCoords(C,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(E)return E[0]--,E[1]--,E[1]+=this._bufferService.buffer.ydisp,E}_getMouseEventScrollAmount(C){let E=(0,d.getCoordsRelativeToElement)(this._coreBrowserService.window,C,this._screenElement)[1];const x=this._renderService.dimensions.css.canvas.height;return E>=0&&E<=x?0:(E>x&&(E-=x),E=Math.min(Math.max(E,-50),50),E/=50,E/Math.abs(E)+Math.round(14*E))}shouldForceSelection(C){return y.isMac?C.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:C.shiftKey}handleMouseDown(C){if(this._mouseDownTimeStamp=C.timeStamp,(C.button!==2||!this.hasSelection)&&C.button===0){if(!this._enabled){if(!this.shouldForceSelection(C))return;C.stopPropagation()}C.preventDefault(),this._dragScrollAmount=0,this._enabled&&C.shiftKey?this._handleIncrementalClick(C):C.detail===1?this._handleSingleClick(C):C.detail===2?this._handleDoubleClick(C):C.detail===3&&this._handleTripleClick(C),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(C){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(C))}_handleSingleClick(C){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(C)?3:0,this._model.selectionStart=this._getMouseBufferCoords(C),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const E=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);E&&E.length!==this._model.selectionStart[0]&&E.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(C){this._selectWordAtCursor(C,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(C){const E=this._getMouseBufferCoords(C);E&&(this._activeSelectionMode=2,this._selectLineAt(E[1]))}shouldColumnSelect(C){return C.altKey&&!(y.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(C){if(C.stopImmediatePropagation(),!this._model.selectionStart)return;const E=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(C),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const x=this._bufferService.buffer;if(this._model.selectionEnd[1]0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(C.ydisp+this._bufferService.rows,C.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=C.ydisp),this.refresh()}}_handleMouseUp(C){const E=C.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&E<500&&C.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const x=this._mouseService.getCoords(C,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(x&&x[0]!==void 0&&x[1]!==void 0){const D=(0,h.moveToCellSequence)(x[0]-1,x[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(D,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const C=this._model.finalSelectionStart,E=this._model.finalSelectionEnd,x=!(!C||!E||C[0]===E[0]&&C[1]===E[1]);x?C&&E&&(this._oldSelectionStart&&this._oldSelectionEnd&&C[0]===this._oldSelectionStart[0]&&C[1]===this._oldSelectionStart[1]&&E[0]===this._oldSelectionEnd[0]&&E[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(C,E,x)):this._oldHasSelection&&this._fireOnSelectionChange(C,E,x)}_fireOnSelectionChange(C,E,x){this._oldSelectionStart=C,this._oldSelectionEnd=E,this._oldHasSelection=x,this._onSelectionChange.fire()}_handleBufferActivate(C){this.clearSelection(),this._trimListener.dispose(),this._trimListener=C.activeBuffer.lines.onTrim(E=>this._handleTrim(E))}_convertViewportColToCharacterIndex(C,E){let x=E;for(let D=0;E>=D;D++){const N=C.loadCell(D,this._workCell).getChars().length;this._workCell.getWidth()===0?x--:N>1&&E!==D&&(x+=N-1)}return x}setSelection(C,E,x){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[C,E],this._model.selectionStartLength=x,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(C){this._isClickInSelection(C)||(this._selectWordAtCursor(C,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(C,E,x=!0,D=!0){if(C[0]>=this._bufferService.cols)return;const N=this._bufferService.buffer,O=N.lines.get(C[1]);if(!O)return;const G=N.translateBufferLineToString(C[1],!1);let Z=this._convertViewportColToCharacterIndex(O,C[0]),q=Z;const V=C[0]-Z;let I=0,$=0,L=0,K=0;if(G.charAt(Z)===" "){for(;Z>0&&G.charAt(Z-1)===" ";)Z--;for(;q1&&(K+=ue-1,q+=ue-1);ve>0&&Z>0&&!this._isCharWordSeparator(O.loadCell(ve-1,this._workCell));){O.loadCell(ve-1,this._workCell);const P=this._workCell.getChars().length;this._workCell.getWidth()===0?(I++,ve--):P>1&&(L+=P-1,Z-=P-1),Z--,ve--}for(;le1&&(K+=P-1,q+=P-1),q++,le++}}q++;let se=Z+V-I+L,oe=Math.min(this._bufferService.cols,q-Z+I+$-L-K);if(E||G.slice(Z,q).trim()!==""){if(x&&se===0&&O.getCodePoint(0)!==32){const ve=N.lines.get(C[1]-1);if(ve&&O.isWrapped&&ve.getCodePoint(this._bufferService.cols-1)!==32){const le=this._getWordAt([this._bufferService.cols-1,C[1]-1],!1,!0,!1);if(le){const ue=this._bufferService.cols-le.start;se-=ue,oe+=ue}}}if(D&&se+oe===this._bufferService.cols&&O.getCodePoint(this._bufferService.cols-1)!==32){const ve=N.lines.get(C[1]+1);if(ve!=null&&ve.isWrapped&&ve.getCodePoint(0)!==32){const le=this._getWordAt([0,C[1]+1],!1,!1,!0);le&&(oe+=le.length)}}return{start:se,length:oe}}}_selectWordAt(C,E){const x=this._getWordAt(C,E);if(x){for(;x.start<0;)x.start+=this._bufferService.cols,C[1]--;this._model.selectionStart=[x.start,C[1]],this._model.selectionStartLength=x.length}}_selectToWordAt(C){const E=this._getWordAt(C,!0);if(E){let x=C[1];for(;E.start<0;)E.start+=this._bufferService.cols,x--;if(!this._model.areSelectionValuesReversed())for(;E.start+E.length>this._bufferService.cols;)E.length-=this._bufferService.cols,x++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?E.start:E.start+E.length,x]}}_isCharWordSeparator(C){return C.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(C.getChars())>=0}_selectLineAt(C){const E=this._bufferService.buffer.getWrappedRangeForLine(C),x={start:{x:0,y:E.first},end:{x:this._bufferService.cols-1,y:E.last}};this._model.selectionStart=[0,E.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,_.getRangeLength)(x,this._bufferService.cols)}};a.SelectionService=A=l([u(3,k.IBufferService),u(4,k.ICoreService),u(5,g.IMouseService),u(6,k.IOptionsService),u(7,g.IRenderService),u(8,g.ICoreBrowserService)],A)},4725:(o,a,c)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.IThemeService=a.ICharacterJoinerService=a.ISelectionService=a.IRenderService=a.IMouseService=a.ICoreBrowserService=a.ICharSizeService=void 0;const l=c(8343);a.ICharSizeService=(0,l.createDecorator)("CharSizeService"),a.ICoreBrowserService=(0,l.createDecorator)("CoreBrowserService"),a.IMouseService=(0,l.createDecorator)("MouseService"),a.IRenderService=(0,l.createDecorator)("RenderService"),a.ISelectionService=(0,l.createDecorator)("SelectionService"),a.ICharacterJoinerService=(0,l.createDecorator)("CharacterJoinerService"),a.IThemeService=(0,l.createDecorator)("ThemeService")},6731:function(o,a,c){var l=this&&this.__decorate||function(A,C,E,x){var D,N=arguments.length,O=N<3?C:x===null?x=Object.getOwnPropertyDescriptor(C,E):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate(A,C,E,x);else for(var G=A.length-1;G>=0;G--)(D=A[G])&&(O=(N<3?D(O):N>3?D(C,E,O):D(C,E))||O);return N>3&&O&&Object.defineProperty(C,E,O),O},u=this&&this.__param||function(A,C){return function(E,x){C(E,x,A)}};Object.defineProperty(a,"__esModule",{value:!0}),a.ThemeService=a.DEFAULT_ANSI_COLORS=void 0;const d=c(7239),h=c(8055),p=c(8460),g=c(844),v=c(2585),m=h.css.toColor("#ffffff"),y=h.css.toColor("#000000"),_=h.css.toColor("#ffffff"),b=h.css.toColor("#000000"),k={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};a.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const A=[h.css.toColor("#2e3436"),h.css.toColor("#cc0000"),h.css.toColor("#4e9a06"),h.css.toColor("#c4a000"),h.css.toColor("#3465a4"),h.css.toColor("#75507b"),h.css.toColor("#06989a"),h.css.toColor("#d3d7cf"),h.css.toColor("#555753"),h.css.toColor("#ef2929"),h.css.toColor("#8ae234"),h.css.toColor("#fce94f"),h.css.toColor("#729fcf"),h.css.toColor("#ad7fa8"),h.css.toColor("#34e2e2"),h.css.toColor("#eeeeec")],C=[0,95,135,175,215,255];for(let E=0;E<216;E++){const x=C[E/36%6|0],D=C[E/6%6|0],N=C[E%6];A.push({css:h.channels.toCss(x,D,N),rgba:h.channels.toRgba(x,D,N)})}for(let E=0;E<24;E++){const x=8+10*E;A.push({css:h.channels.toCss(x,x,x),rgba:h.channels.toRgba(x,x,x)})}return A})());let w=a.ThemeService=class extends g.Disposable{get colors(){return this._colors}constructor(A){super(),this._optionsService=A,this._contrastCache=new d.ColorContrastCache,this._halfContrastCache=new d.ColorContrastCache,this._onChangeColors=this.register(new p.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:m,background:y,cursor:_,cursorAccent:b,selectionForeground:void 0,selectionBackgroundTransparent:k,selectionBackgroundOpaque:h.color.blend(y,k),selectionInactiveBackgroundTransparent:k,selectionInactiveBackgroundOpaque:h.color.blend(y,k),ansi:a.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this.register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}_setTheme(A={}){const C=this._colors;if(C.foreground=T(A.foreground,m),C.background=T(A.background,y),C.cursor=T(A.cursor,_),C.cursorAccent=T(A.cursorAccent,b),C.selectionBackgroundTransparent=T(A.selectionBackground,k),C.selectionBackgroundOpaque=h.color.blend(C.background,C.selectionBackgroundTransparent),C.selectionInactiveBackgroundTransparent=T(A.selectionInactiveBackground,C.selectionBackgroundTransparent),C.selectionInactiveBackgroundOpaque=h.color.blend(C.background,C.selectionInactiveBackgroundTransparent),C.selectionForeground=A.selectionForeground?T(A.selectionForeground,h.NULL_COLOR):void 0,C.selectionForeground===h.NULL_COLOR&&(C.selectionForeground=void 0),h.color.isOpaque(C.selectionBackgroundTransparent)&&(C.selectionBackgroundTransparent=h.color.opacity(C.selectionBackgroundTransparent,.3)),h.color.isOpaque(C.selectionInactiveBackgroundTransparent)&&(C.selectionInactiveBackgroundTransparent=h.color.opacity(C.selectionInactiveBackgroundTransparent,.3)),C.ansi=a.DEFAULT_ANSI_COLORS.slice(),C.ansi[0]=T(A.black,a.DEFAULT_ANSI_COLORS[0]),C.ansi[1]=T(A.red,a.DEFAULT_ANSI_COLORS[1]),C.ansi[2]=T(A.green,a.DEFAULT_ANSI_COLORS[2]),C.ansi[3]=T(A.yellow,a.DEFAULT_ANSI_COLORS[3]),C.ansi[4]=T(A.blue,a.DEFAULT_ANSI_COLORS[4]),C.ansi[5]=T(A.magenta,a.DEFAULT_ANSI_COLORS[5]),C.ansi[6]=T(A.cyan,a.DEFAULT_ANSI_COLORS[6]),C.ansi[7]=T(A.white,a.DEFAULT_ANSI_COLORS[7]),C.ansi[8]=T(A.brightBlack,a.DEFAULT_ANSI_COLORS[8]),C.ansi[9]=T(A.brightRed,a.DEFAULT_ANSI_COLORS[9]),C.ansi[10]=T(A.brightGreen,a.DEFAULT_ANSI_COLORS[10]),C.ansi[11]=T(A.brightYellow,a.DEFAULT_ANSI_COLORS[11]),C.ansi[12]=T(A.brightBlue,a.DEFAULT_ANSI_COLORS[12]),C.ansi[13]=T(A.brightMagenta,a.DEFAULT_ANSI_COLORS[13]),C.ansi[14]=T(A.brightCyan,a.DEFAULT_ANSI_COLORS[14]),C.ansi[15]=T(A.brightWhite,a.DEFAULT_ANSI_COLORS[15]),A.extendedAnsi){const E=Math.min(C.ansi.length-16,A.extendedAnsi.length);for(let x=0;x{Object.defineProperty(a,"__esModule",{value:!0}),a.CircularList=void 0;const l=c(8460),u=c(844);class d extends u.Disposable{constructor(p){super(),this._maxLength=p,this.onDeleteEmitter=this.register(new l.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new l.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new l.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(p){if(this._maxLength===p)return;const g=new Array(p);for(let v=0;vthis._length)for(let g=this._length;g=p;m--)this._array[this._getCyclicIndex(m+v.length)]=this._array[this._getCyclicIndex(m)];for(let m=0;mthis._maxLength){const m=this._length+v.length-this._maxLength;this._startIndex+=m,this._length=this._maxLength,this.onTrimEmitter.fire(m)}else this._length+=v.length}trimStart(p){p>this._length&&(p=this._length),this._startIndex+=p,this._length-=p,this.onTrimEmitter.fire(p)}shiftElements(p,g,v){if(!(g<=0)){if(p<0||p>=this._length)throw new Error("start argument out of range");if(p+v<0)throw new Error("Cannot shift elements in list beyond index 0");if(v>0){for(let y=g-1;y>=0;y--)this.set(p+y+v,this.get(p+y));const m=p+g+v-this._length;if(m>0)for(this._length+=m;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let m=0;m{Object.defineProperty(a,"__esModule",{value:!0}),a.clone=void 0,a.clone=function c(l,u=5){if(typeof l!="object")return l;const d=Array.isArray(l)?[]:{};for(const h in l)d[h]=u<=1?l[h]:l[h]&&c(l[h],u-1);return d}},8055:(o,a,c)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.contrastRatio=a.toPaddedHex=a.rgba=a.rgb=a.css=a.color=a.channels=a.NULL_COLOR=void 0;const l=c(6114);let u=0,d=0,h=0,p=0;var g,v,m,y,_;function b(w){const T=w.toString(16);return T.length<2?"0"+T:T}function k(w,T){return w>>0}}(g||(a.channels=g={})),function(w){function T(A,C){return p=Math.round(255*C),[u,d,h]=_.toChannels(A.rgba),{css:g.toCss(u,d,h,p),rgba:g.toRgba(u,d,h,p)}}w.blend=function(A,C){if(p=(255&C.rgba)/255,p===1)return{css:C.css,rgba:C.rgba};const E=C.rgba>>24&255,x=C.rgba>>16&255,D=C.rgba>>8&255,N=A.rgba>>24&255,O=A.rgba>>16&255,G=A.rgba>>8&255;return u=N+Math.round((E-N)*p),d=O+Math.round((x-O)*p),h=G+Math.round((D-G)*p),{css:g.toCss(u,d,h),rgba:g.toRgba(u,d,h)}},w.isOpaque=function(A){return(255&A.rgba)==255},w.ensureContrastRatio=function(A,C,E){const x=_.ensureContrastRatio(A.rgba,C.rgba,E);if(x)return _.toColor(x>>24&255,x>>16&255,x>>8&255)},w.opaque=function(A){const C=(255|A.rgba)>>>0;return[u,d,h]=_.toChannels(C),{css:g.toCss(u,d,h),rgba:C}},w.opacity=T,w.multiplyOpacity=function(A,C){return p=255&A.rgba,T(A,p*C/255)},w.toColorRGB=function(A){return[A.rgba>>24&255,A.rgba>>16&255,A.rgba>>8&255]}}(v||(a.color=v={})),function(w){let T,A;if(!l.isNode){const C=document.createElement("canvas");C.width=1,C.height=1;const E=C.getContext("2d",{willReadFrequently:!0});E&&(T=E,T.globalCompositeOperation="copy",A=T.createLinearGradient(0,0,1,1))}w.toColor=function(C){if(C.match(/#[\da-f]{3,8}/i))switch(C.length){case 4:return u=parseInt(C.slice(1,2).repeat(2),16),d=parseInt(C.slice(2,3).repeat(2),16),h=parseInt(C.slice(3,4).repeat(2),16),_.toColor(u,d,h);case 5:return u=parseInt(C.slice(1,2).repeat(2),16),d=parseInt(C.slice(2,3).repeat(2),16),h=parseInt(C.slice(3,4).repeat(2),16),p=parseInt(C.slice(4,5).repeat(2),16),_.toColor(u,d,h,p);case 7:return{css:C,rgba:(parseInt(C.slice(1),16)<<8|255)>>>0};case 9:return{css:C,rgba:parseInt(C.slice(1),16)>>>0}}const E=C.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(E)return u=parseInt(E[1]),d=parseInt(E[2]),h=parseInt(E[3]),p=Math.round(255*(E[5]===void 0?1:parseFloat(E[5]))),_.toColor(u,d,h,p);if(!T||!A)throw new Error("css.toColor: Unsupported css format");if(T.fillStyle=A,T.fillStyle=C,typeof T.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(T.fillRect(0,0,1,1),[u,d,h,p]=T.getImageData(0,0,1,1).data,p!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:g.toRgba(u,d,h,p),css:C}}}(m||(a.css=m={})),function(w){function T(A,C,E){const x=A/255,D=C/255,N=E/255;return .2126*(x<=.03928?x/12.92:Math.pow((x+.055)/1.055,2.4))+.7152*(D<=.03928?D/12.92:Math.pow((D+.055)/1.055,2.4))+.0722*(N<=.03928?N/12.92:Math.pow((N+.055)/1.055,2.4))}w.relativeLuminance=function(A){return T(A>>16&255,A>>8&255,255&A)},w.relativeLuminance2=T}(y||(a.rgb=y={})),function(w){function T(C,E,x){const D=C>>24&255,N=C>>16&255,O=C>>8&255;let G=E>>24&255,Z=E>>16&255,q=E>>8&255,V=k(y.relativeLuminance2(G,Z,q),y.relativeLuminance2(D,N,O));for(;V0||Z>0||q>0);)G-=Math.max(0,Math.ceil(.1*G)),Z-=Math.max(0,Math.ceil(.1*Z)),q-=Math.max(0,Math.ceil(.1*q)),V=k(y.relativeLuminance2(G,Z,q),y.relativeLuminance2(D,N,O));return(G<<24|Z<<16|q<<8|255)>>>0}function A(C,E,x){const D=C>>24&255,N=C>>16&255,O=C>>8&255;let G=E>>24&255,Z=E>>16&255,q=E>>8&255,V=k(y.relativeLuminance2(G,Z,q),y.relativeLuminance2(D,N,O));for(;V>>0}w.ensureContrastRatio=function(C,E,x){const D=y.relativeLuminance(C>>8),N=y.relativeLuminance(E>>8);if(k(D,N)>8));if(qk(D,y.relativeLuminance(V>>8))?Z:V}return Z}const O=A(C,E,x),G=k(D,y.relativeLuminance(O>>8));if(Gk(D,y.relativeLuminance(Z>>8))?O:Z}return O}},w.reduceLuminance=T,w.increaseLuminance=A,w.toChannels=function(C){return[C>>24&255,C>>16&255,C>>8&255,255&C]},w.toColor=function(C,E,x,D){return{css:g.toCss(C,E,x,D),rgba:g.toRgba(C,E,x,D)}}}(_||(a.rgba=_={})),a.toPaddedHex=b,a.contrastRatio=k},8969:(o,a,c)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.CoreTerminal=void 0;const l=c(844),u=c(2585),d=c(4348),h=c(7866),p=c(744),g=c(7302),v=c(6975),m=c(8460),y=c(1753),_=c(1480),b=c(7994),k=c(9282),w=c(5435),T=c(5981),A=c(2660);let C=!1;class E extends l.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new m.EventEmitter),this._onScroll.event(D=>{var N;(N=this._onScrollApi)===null||N===void 0||N.fire(D.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(D){for(const N in D)this.optionsService.options[N]=D[N]}constructor(D){super(),this._windowsWrappingHeuristics=this.register(new l.MutableDisposable),this._onBinary=this.register(new m.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new m.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new m.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new m.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new m.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new m.EventEmitter),this._instantiationService=new d.InstantiationService,this.optionsService=this.register(new g.OptionsService(D)),this._instantiationService.setService(u.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(p.BufferService)),this._instantiationService.setService(u.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(h.LogService)),this._instantiationService.setService(u.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(v.CoreService)),this._instantiationService.setService(u.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(y.CoreMouseService)),this._instantiationService.setService(u.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(_.UnicodeService)),this._instantiationService.setService(u.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(b.CharsetService),this._instantiationService.setService(u.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(A.OscLinkService),this._instantiationService.setService(u.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new w.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,m.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,m.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,m.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,m.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom())),this.register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this.register(this._bufferService.onScroll(N=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this.register(this._inputHandler.onScroll(N=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this.register(new T.WriteBuffer((N,O)=>this._inputHandler.parse(N,O))),this.register((0,m.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(D,N){this._writeBuffer.write(D,N)}writeSync(D,N){this._logService.logLevel<=u.LogLevelEnum.WARN&&!C&&(this._logService.warn("writeSync is unreliable and will be removed soon."),C=!0),this._writeBuffer.writeSync(D,N)}resize(D,N){isNaN(D)||isNaN(N)||(D=Math.max(D,p.MINIMUM_COLS),N=Math.max(N,p.MINIMUM_ROWS),this._bufferService.resize(D,N))}scroll(D,N=!1){this._bufferService.scroll(D,N)}scrollLines(D,N,O){this._bufferService.scrollLines(D,N,O)}scrollPages(D){this.scrollLines(D*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(D){const N=D-this._bufferService.buffer.ydisp;N!==0&&this.scrollLines(N)}registerEscHandler(D,N){return this._inputHandler.registerEscHandler(D,N)}registerDcsHandler(D,N){return this._inputHandler.registerDcsHandler(D,N)}registerCsiHandler(D,N){return this._inputHandler.registerCsiHandler(D,N)}registerOscHandler(D,N){return this._inputHandler.registerOscHandler(D,N)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let D=!1;const N=this.optionsService.rawOptions.windowsPty;N&&N.buildNumber!==void 0&&N.buildNumber!==void 0?D=N.backend==="conpty"&&N.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(D=!0),D?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const D=[];D.push(this.onLineFeed(k.updateWindowsModeWrappedState.bind(null,this._bufferService))),D.push(this.registerCsiHandler({final:"H"},()=>((0,k.updateWindowsModeWrappedState)(this._bufferService),!1))),this._windowsWrappingHeuristics.value=(0,l.toDisposable)(()=>{for(const N of D)N.dispose()})}}}a.CoreTerminal=E},8460:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.forwardEvent=a.EventEmitter=void 0,a.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=c=>(this._listeners.push(c),{dispose:()=>{if(!this._disposed){for(let l=0;ll.fire(u))}},5435:function(o,a,c){var l=this&&this.__decorate||function(V,I,$,L){var K,se=arguments.length,oe=se<3?I:L===null?L=Object.getOwnPropertyDescriptor(I,$):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")oe=Reflect.decorate(V,I,$,L);else for(var ve=V.length-1;ve>=0;ve--)(K=V[ve])&&(oe=(se<3?K(oe):se>3?K(I,$,oe):K(I,$))||oe);return se>3&&oe&&Object.defineProperty(I,$,oe),oe},u=this&&this.__param||function(V,I){return function($,L){I($,L,V)}};Object.defineProperty(a,"__esModule",{value:!0}),a.InputHandler=a.WindowsOptionsReportType=void 0;const d=c(2584),h=c(7116),p=c(2015),g=c(844),v=c(482),m=c(8437),y=c(8460),_=c(643),b=c(511),k=c(3734),w=c(2585),T=c(6242),A=c(6351),C=c(5941),E={"(":0,")":1,"*":2,"+":3,"-":1,".":2},x=131072;function D(V,I){if(V>24)return I.setWinLines||!1;switch(V){case 1:return!!I.restoreWin;case 2:return!!I.minimizeWin;case 3:return!!I.setWinPosition;case 4:return!!I.setWinSizePixels;case 5:return!!I.raiseWin;case 6:return!!I.lowerWin;case 7:return!!I.refreshWin;case 8:return!!I.setWinSizeChars;case 9:return!!I.maximizeWin;case 10:return!!I.fullscreenWin;case 11:return!!I.getWinState;case 13:return!!I.getWinPosition;case 14:return!!I.getWinSizePixels;case 15:return!!I.getScreenSizePixels;case 16:return!!I.getCellSizePixels;case 18:return!!I.getWinSizeChars;case 19:return!!I.getScreenSizeChars;case 20:return!!I.getIconTitle;case 21:return!!I.getWinTitle;case 22:return!!I.pushTitle;case 23:return!!I.popTitle;case 24:return!!I.setWinLines}return!1}var N;(function(V){V[V.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",V[V.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(N||(a.WindowsOptionsReportType=N={}));let O=0;class G extends g.Disposable{getAttrData(){return this._curAttrData}constructor(I,$,L,K,se,oe,ve,le,ue=new p.EscapeSequenceParser){super(),this._bufferService=I,this._charsetService=$,this._coreService=L,this._logService=K,this._optionsService=se,this._oscLinkService=oe,this._coreMouseService=ve,this._unicodeService=le,this._parser=ue,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new v.StringToUtf32,this._utf8Decoder=new v.Utf8ToUtf32,this._workCell=new b.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=m.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=m.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new y.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new y.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new y.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new y.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new y.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new y.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new y.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new y.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new y.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new y.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new y.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new y.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new y.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new Z(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(P=>this._activeBuffer=P.activeBuffer)),this._parser.setCsiHandlerFallback((P,X)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(P),params:X.toArray()})}),this._parser.setEscHandlerFallback(P=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(P)})}),this._parser.setExecuteHandlerFallback(P=>{this._logService.debug("Unknown EXECUTE code: ",{code:P})}),this._parser.setOscHandlerFallback((P,X,J)=>{this._logService.debug("Unknown OSC code: ",{identifier:P,action:X,data:J})}),this._parser.setDcsHandlerFallback((P,X,J)=>{X==="HOOK"&&(J=J.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(P),action:X,payload:J})}),this._parser.setPrintHandler((P,X,J)=>this.print(P,X,J)),this._parser.registerCsiHandler({final:"@"},P=>this.insertChars(P)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},P=>this.scrollLeft(P)),this._parser.registerCsiHandler({final:"A"},P=>this.cursorUp(P)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},P=>this.scrollRight(P)),this._parser.registerCsiHandler({final:"B"},P=>this.cursorDown(P)),this._parser.registerCsiHandler({final:"C"},P=>this.cursorForward(P)),this._parser.registerCsiHandler({final:"D"},P=>this.cursorBackward(P)),this._parser.registerCsiHandler({final:"E"},P=>this.cursorNextLine(P)),this._parser.registerCsiHandler({final:"F"},P=>this.cursorPrecedingLine(P)),this._parser.registerCsiHandler({final:"G"},P=>this.cursorCharAbsolute(P)),this._parser.registerCsiHandler({final:"H"},P=>this.cursorPosition(P)),this._parser.registerCsiHandler({final:"I"},P=>this.cursorForwardTab(P)),this._parser.registerCsiHandler({final:"J"},P=>this.eraseInDisplay(P,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},P=>this.eraseInDisplay(P,!0)),this._parser.registerCsiHandler({final:"K"},P=>this.eraseInLine(P,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},P=>this.eraseInLine(P,!0)),this._parser.registerCsiHandler({final:"L"},P=>this.insertLines(P)),this._parser.registerCsiHandler({final:"M"},P=>this.deleteLines(P)),this._parser.registerCsiHandler({final:"P"},P=>this.deleteChars(P)),this._parser.registerCsiHandler({final:"S"},P=>this.scrollUp(P)),this._parser.registerCsiHandler({final:"T"},P=>this.scrollDown(P)),this._parser.registerCsiHandler({final:"X"},P=>this.eraseChars(P)),this._parser.registerCsiHandler({final:"Z"},P=>this.cursorBackwardTab(P)),this._parser.registerCsiHandler({final:"`"},P=>this.charPosAbsolute(P)),this._parser.registerCsiHandler({final:"a"},P=>this.hPositionRelative(P)),this._parser.registerCsiHandler({final:"b"},P=>this.repeatPrecedingCharacter(P)),this._parser.registerCsiHandler({final:"c"},P=>this.sendDeviceAttributesPrimary(P)),this._parser.registerCsiHandler({prefix:">",final:"c"},P=>this.sendDeviceAttributesSecondary(P)),this._parser.registerCsiHandler({final:"d"},P=>this.linePosAbsolute(P)),this._parser.registerCsiHandler({final:"e"},P=>this.vPositionRelative(P)),this._parser.registerCsiHandler({final:"f"},P=>this.hVPosition(P)),this._parser.registerCsiHandler({final:"g"},P=>this.tabClear(P)),this._parser.registerCsiHandler({final:"h"},P=>this.setMode(P)),this._parser.registerCsiHandler({prefix:"?",final:"h"},P=>this.setModePrivate(P)),this._parser.registerCsiHandler({final:"l"},P=>this.resetMode(P)),this._parser.registerCsiHandler({prefix:"?",final:"l"},P=>this.resetModePrivate(P)),this._parser.registerCsiHandler({final:"m"},P=>this.charAttributes(P)),this._parser.registerCsiHandler({final:"n"},P=>this.deviceStatus(P)),this._parser.registerCsiHandler({prefix:"?",final:"n"},P=>this.deviceStatusPrivate(P)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},P=>this.softReset(P)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},P=>this.setCursorStyle(P)),this._parser.registerCsiHandler({final:"r"},P=>this.setScrollRegion(P)),this._parser.registerCsiHandler({final:"s"},P=>this.saveCursor(P)),this._parser.registerCsiHandler({final:"t"},P=>this.windowOptions(P)),this._parser.registerCsiHandler({final:"u"},P=>this.restoreCursor(P)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},P=>this.insertColumns(P)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},P=>this.deleteColumns(P)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},P=>this.selectProtected(P)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},P=>this.requestMode(P,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},P=>this.requestMode(P,!1)),this._parser.setExecuteHandler(d.C0.BEL,()=>this.bell()),this._parser.setExecuteHandler(d.C0.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(d.C0.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(d.C0.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(d.C0.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(d.C0.BS,()=>this.backspace()),this._parser.setExecuteHandler(d.C0.HT,()=>this.tab()),this._parser.setExecuteHandler(d.C0.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(d.C0.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(d.C1.IND,()=>this.index()),this._parser.setExecuteHandler(d.C1.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(d.C1.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new T.OscHandler(P=>(this.setTitle(P),this.setIconName(P),!0))),this._parser.registerOscHandler(1,new T.OscHandler(P=>this.setIconName(P))),this._parser.registerOscHandler(2,new T.OscHandler(P=>this.setTitle(P))),this._parser.registerOscHandler(4,new T.OscHandler(P=>this.setOrReportIndexedColor(P))),this._parser.registerOscHandler(8,new T.OscHandler(P=>this.setHyperlink(P))),this._parser.registerOscHandler(10,new T.OscHandler(P=>this.setOrReportFgColor(P))),this._parser.registerOscHandler(11,new T.OscHandler(P=>this.setOrReportBgColor(P))),this._parser.registerOscHandler(12,new T.OscHandler(P=>this.setOrReportCursorColor(P))),this._parser.registerOscHandler(104,new T.OscHandler(P=>this.restoreIndexedColor(P))),this._parser.registerOscHandler(110,new T.OscHandler(P=>this.restoreFgColor(P))),this._parser.registerOscHandler(111,new T.OscHandler(P=>this.restoreBgColor(P))),this._parser.registerOscHandler(112,new T.OscHandler(P=>this.restoreCursorColor(P))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(const P in h.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:P},()=>this.selectCharset("("+P)),this._parser.registerEscHandler({intermediates:")",final:P},()=>this.selectCharset(")"+P)),this._parser.registerEscHandler({intermediates:"*",final:P},()=>this.selectCharset("*"+P)),this._parser.registerEscHandler({intermediates:"+",final:P},()=>this.selectCharset("+"+P)),this._parser.registerEscHandler({intermediates:"-",final:P},()=>this.selectCharset("-"+P)),this._parser.registerEscHandler({intermediates:".",final:P},()=>this.selectCharset("."+P)),this._parser.registerEscHandler({intermediates:"/",final:P},()=>this.selectCharset("/"+P));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(P=>(this._logService.error("Parsing error: ",P),P)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new A.DcsHandler((P,X)=>this.requestStatusString(P,X)))}_preserveStack(I,$,L,K){this._parseStack.paused=!0,this._parseStack.cursorStartX=I,this._parseStack.cursorStartY=$,this._parseStack.decodedLength=L,this._parseStack.position=K}_logSlowResolvingAsync(I){this._logService.logLevel<=w.LogLevelEnum.WARN&&Promise.race([I,new Promise(($,L)=>setTimeout(()=>L("#SLOW_TIMEOUT"),5e3))]).catch($=>{if($!=="#SLOW_TIMEOUT")throw $;console.warn("async parser handler taking longer than 5000 ms")})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(I,$){let L,K=this._activeBuffer.x,se=this._activeBuffer.y,oe=0;const ve=this._parseStack.paused;if(ve){if(L=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,$))return this._logSlowResolvingAsync(L),L;K=this._parseStack.cursorStartX,se=this._parseStack.cursorStartY,this._parseStack.paused=!1,I.length>x&&(oe=this._parseStack.position+x)}if(this._logService.logLevel<=w.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof I=="string"?` "${I}"`:` "${Array.prototype.map.call(I,le=>String.fromCharCode(le)).join("")}"`),typeof I=="string"?I.split("").map(le=>le.charCodeAt(0)):I),this._parseBuffer.lengthx)for(let le=oe;le0&&J.getWidth(this._activeBuffer.x-1)===2&&J.setCellFromCodePoint(this._activeBuffer.x-1,0,1,X.fg,X.bg,X.extended);for(let ne=$;ne=le){if(ue){for(;this._activeBuffer.x=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),J=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)}else if(this._activeBuffer.x=le-1,se===2)continue}if(P&&(J.insertCells(this._activeBuffer.x,se,this._activeBuffer.getNullCell(X),X),J.getWidth(le-1)===2&&J.setCellFromCodePoint(le-1,_.NULL_CELL_CODE,_.NULL_CELL_WIDTH,X.fg,X.bg,X.extended)),J.setCellFromCodePoint(this._activeBuffer.x++,K,se,X.fg,X.bg,X.extended),se>0)for(;--se;)J.setCellFromCodePoint(this._activeBuffer.x++,0,0,X.fg,X.bg,X.extended)}else J.getWidth(this._activeBuffer.x-1)?J.addCodepointToCell(this._activeBuffer.x-1,K):J.addCodepointToCell(this._activeBuffer.x-2,K)}L-$>0&&(J.loadCell(this._activeBuffer.x-1,this._workCell),this._workCell.getWidth()===2||this._workCell.getCode()>65535?this._parser.precedingCodepoint=0:this._workCell.isCombined()?this._parser.precedingCodepoint=this._workCell.getChars().charCodeAt(0):this._parser.precedingCodepoint=this._workCell.content),this._activeBuffer.x0&&J.getWidth(this._activeBuffer.x)===0&&!J.hasContent(this._activeBuffer.x)&&J.setCellFromCodePoint(this._activeBuffer.x,0,1,X.fg,X.bg,X.extended),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(I,$){return I.final!=="t"||I.prefix||I.intermediates?this._parser.registerCsiHandler(I,$):this._parser.registerCsiHandler(I,L=>!D(L.params[0],this._optionsService.rawOptions.windowOptions)||$(L))}registerDcsHandler(I,$){return this._parser.registerDcsHandler(I,new A.DcsHandler($))}registerEscHandler(I,$){return this._parser.registerEscHandler(I,$)}registerOscHandler(I,$){return this._parser.registerOscHandler(I,new T.OscHandler($))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var I;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&(!((I=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))===null||I===void 0)&&I.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);$.hasWidth(this._activeBuffer.x)&&!$.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const I=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-I),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(I=this._bufferService.cols-1){this._activeBuffer.x=Math.min(I,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(I,$){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=I,this._activeBuffer.y=this._activeBuffer.scrollTop+$):(this._activeBuffer.x=I,this._activeBuffer.y=$),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(I,$){this._restrictCursor(),this._setCursor(this._activeBuffer.x+I,this._activeBuffer.y+$)}cursorUp(I){const $=this._activeBuffer.y-this._activeBuffer.scrollTop;return $>=0?this._moveCursor(0,-Math.min($,I.params[0]||1)):this._moveCursor(0,-(I.params[0]||1)),!0}cursorDown(I){const $=this._activeBuffer.scrollBottom-this._activeBuffer.y;return $>=0?this._moveCursor(0,Math.min($,I.params[0]||1)):this._moveCursor(0,I.params[0]||1),!0}cursorForward(I){return this._moveCursor(I.params[0]||1,0),!0}cursorBackward(I){return this._moveCursor(-(I.params[0]||1),0),!0}cursorNextLine(I){return this.cursorDown(I),this._activeBuffer.x=0,!0}cursorPrecedingLine(I){return this.cursorUp(I),this._activeBuffer.x=0,!0}cursorCharAbsolute(I){return this._setCursor((I.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(I){return this._setCursor(I.length>=2?(I.params[1]||1)-1:0,(I.params[0]||1)-1),!0}charPosAbsolute(I){return this._setCursor((I.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(I){return this._moveCursor(I.params[0]||1,0),!0}linePosAbsolute(I){return this._setCursor(this._activeBuffer.x,(I.params[0]||1)-1),!0}vPositionRelative(I){return this._moveCursor(0,I.params[0]||1),!0}hVPosition(I){return this.cursorPosition(I),!0}tabClear(I){const $=I.params[0];return $===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:$===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(I){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let $=I.params[0]||1;for(;$--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(I){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let $=I.params[0]||1;for(;$--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(I){const $=I.params[0];return $===1&&(this._curAttrData.bg|=536870912),$!==2&&$!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(I,$,L,K=!1,se=!1){const oe=this._activeBuffer.lines.get(this._activeBuffer.ybase+I);oe.replaceCells($,L,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData(),se),K&&(oe.isWrapped=!1)}_resetBufferLine(I,$=!1){const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+I);L&&(L.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),$),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+I),L.isWrapped=!1)}eraseInDisplay(I,$=!1){let L;switch(this._restrictCursor(this._bufferService.cols),I.params[0]){case 0:for(L=this._activeBuffer.y,this._dirtyRowTracker.markDirty(L),this._eraseInBufferLine(L++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,$);L=this._bufferService.cols&&(this._activeBuffer.lines.get(L+1).isWrapped=!1);L--;)this._resetBufferLine(L,$);this._dirtyRowTracker.markDirty(0);break;case 2:for(L=this._bufferService.rows,this._dirtyRowTracker.markDirty(L-1);L--;)this._resetBufferLine(L,$);this._dirtyRowTracker.markDirty(0);break;case 3:const K=this._activeBuffer.lines.length-this._bufferService.rows;K>0&&(this._activeBuffer.lines.trimStart(K),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-K,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-K,0),this._onScroll.fire(0))}return!0}eraseInLine(I,$=!1){switch(this._restrictCursor(this._bufferService.cols),I.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,$);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,$);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,$)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(I){this._restrictCursor();let $=I.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.y0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(d.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(d.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(I){return I.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(d.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(d.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(I.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(d.C0.ESC+"[>83;40003;0c")),!0}_is(I){return(this._optionsService.rawOptions.termName+"").indexOf(I)===0}setMode(I){for(let $=0;$Pe?1:2,ne=I.params[0];return ce=ne,_e=$?ne===2?4:ne===4?J(oe.modes.insertMode):ne===12?3:ne===20?J(X.convertEol):0:ne===1?J(L.applicationCursorKeys):ne===3?X.windowOptions.setWinLines?le===80?2:le===132?1:0:0:ne===6?J(L.origin):ne===7?J(L.wraparound):ne===8?3:ne===9?J(K==="X10"):ne===12?J(X.cursorBlink):ne===25?J(!oe.isCursorHidden):ne===45?J(L.reverseWraparound):ne===66?J(L.applicationKeypad):ne===67?4:ne===1e3?J(K==="VT200"):ne===1002?J(K==="DRAG"):ne===1003?J(K==="ANY"):ne===1004?J(L.sendFocus):ne===1005?4:ne===1006?J(se==="SGR"):ne===1015?4:ne===1016?J(se==="SGR_PIXELS"):ne===1048?1:ne===47||ne===1047||ne===1049?J(ue===P):ne===2004?J(L.bracketedPasteMode):0,oe.triggerDataEvent(`${d.C0.ESC}[${$?"":"?"}${ce};${_e}$y`),!0;var ce,_e}_updateAttrColor(I,$,L,K,se){return $===2?(I|=50331648,I&=-16777216,I|=k.AttributeData.fromColorRGB([L,K,se])):$===5&&(I&=-50331904,I|=33554432|255&L),I}_extractColor(I,$,L){const K=[0,0,-1,0,0,0];let se=0,oe=0;do{if(K[oe+se]=I.params[$+oe],I.hasSubParams($+oe)){const ve=I.getSubParams($+oe);let le=0;do K[1]===5&&(se=1),K[oe+le+1+se]=ve[le];while(++le=2||K[1]===2&&oe+se>=5)break;K[1]&&(se=1)}while(++oe+$5)&&(I=1),$.extended.underlineStyle=I,$.fg|=268435456,I===0&&($.fg&=-268435457),$.updateExtended()}_processSGR0(I){I.fg=m.DEFAULT_ATTR_DATA.fg,I.bg=m.DEFAULT_ATTR_DATA.bg,I.extended=I.extended.clone(),I.extended.underlineStyle=0,I.extended.underlineColor&=-67108864,I.updateExtended()}charAttributes(I){if(I.length===1&&I.params[0]===0)return this._processSGR0(this._curAttrData),!0;const $=I.length;let L;const K=this._curAttrData;for(let se=0;se<$;se++)L=I.params[se],L>=30&&L<=37?(K.fg&=-50331904,K.fg|=16777216|L-30):L>=40&&L<=47?(K.bg&=-50331904,K.bg|=16777216|L-40):L>=90&&L<=97?(K.fg&=-50331904,K.fg|=16777224|L-90):L>=100&&L<=107?(K.bg&=-50331904,K.bg|=16777224|L-100):L===0?this._processSGR0(K):L===1?K.fg|=134217728:L===3?K.bg|=67108864:L===4?(K.fg|=268435456,this._processUnderline(I.hasSubParams(se)?I.getSubParams(se)[0]:1,K)):L===5?K.fg|=536870912:L===7?K.fg|=67108864:L===8?K.fg|=1073741824:L===9?K.fg|=2147483648:L===2?K.bg|=134217728:L===21?this._processUnderline(2,K):L===22?(K.fg&=-134217729,K.bg&=-134217729):L===23?K.bg&=-67108865:L===24?(K.fg&=-268435457,this._processUnderline(0,K)):L===25?K.fg&=-536870913:L===27?K.fg&=-67108865:L===28?K.fg&=-1073741825:L===29?K.fg&=2147483647:L===39?(K.fg&=-67108864,K.fg|=16777215&m.DEFAULT_ATTR_DATA.fg):L===49?(K.bg&=-67108864,K.bg|=16777215&m.DEFAULT_ATTR_DATA.bg):L===38||L===48||L===58?se+=this._extractColor(I,se,K):L===53?K.bg|=1073741824:L===55?K.bg&=-1073741825:L===59?(K.extended=K.extended.clone(),K.extended.underlineColor=-1,K.updateExtended()):L===100?(K.fg&=-67108864,K.fg|=16777215&m.DEFAULT_ATTR_DATA.fg,K.bg&=-67108864,K.bg|=16777215&m.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",L);return!0}deviceStatus(I){switch(I.params[0]){case 5:this._coreService.triggerDataEvent(`${d.C0.ESC}[0n`);break;case 6:const $=this._activeBuffer.y+1,L=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${d.C0.ESC}[${$};${L}R`)}return!0}deviceStatusPrivate(I){if(I.params[0]===6){const $=this._activeBuffer.y+1,L=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${d.C0.ESC}[?${$};${L}R`)}return!0}softReset(I){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=m.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(I){const $=I.params[0]||1;switch($){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const L=$%2==1;return this._optionsService.options.cursorBlink=L,!0}setScrollRegion(I){const $=I.params[0]||1;let L;return(I.length<2||(L=I.params[1])>this._bufferService.rows||L===0)&&(L=this._bufferService.rows),L>$&&(this._activeBuffer.scrollTop=$-1,this._activeBuffer.scrollBottom=L-1,this._setCursor(0,0)),!0}windowOptions(I){if(!D(I.params[0],this._optionsService.rawOptions.windowOptions))return!0;const $=I.length>1?I.params[1]:0;switch(I.params[0]){case 14:$!==2&&this._onRequestWindowsOptionsReport.fire(N.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(N.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${d.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:$!==0&&$!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),$!==0&&$!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:$!==0&&$!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),$!==0&&$!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(I){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(I){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(I){return this._windowTitle=I,this._onTitleChange.fire(I),!0}setIconName(I){return this._iconName=I,!0}setOrReportIndexedColor(I){const $=[],L=I.split(";");for(;L.length>1;){const K=L.shift(),se=L.shift();if(/^\d+$/.exec(K)){const oe=parseInt(K);if(q(oe))if(se==="?")$.push({type:0,index:oe});else{const ve=(0,C.parseColor)(se);ve&&$.push({type:1,index:oe,color:ve})}}}return $.length&&this._onColor.fire($),!0}setHyperlink(I){const $=I.split(";");return!($.length<2)&&($[1]?this._createHyperlink($[0],$[1]):!$[0]&&this._finishHyperlink())}_createHyperlink(I,$){this._getCurrentLinkId()&&this._finishHyperlink();const L=I.split(":");let K;const se=L.findIndex(oe=>oe.startsWith("id="));return se!==-1&&(K=L[se].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:K,uri:$}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(I,$){const L=I.split(";");for(let K=0;K=this._specialColors.length);++K,++$)if(L[K]==="?")this._onColor.fire([{type:0,index:this._specialColors[$]}]);else{const se=(0,C.parseColor)(L[K]);se&&this._onColor.fire([{type:1,index:this._specialColors[$],color:se}])}return!0}setOrReportFgColor(I){return this._setOrReportSpecialColor(I,0)}setOrReportBgColor(I){return this._setOrReportSpecialColor(I,1)}setOrReportCursorColor(I){return this._setOrReportSpecialColor(I,2)}restoreIndexedColor(I){if(!I)return this._onColor.fire([{type:2}]),!0;const $=[],L=I.split(";");for(let K=0;K=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const I=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,I,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=m.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=m.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(I){return this._charsetService.setgLevel(I),!0}screenAlignmentPattern(){const I=new b.CellData;I.content=4194373,I.fg=this._curAttrData.fg,I.bg=this._curAttrData.bg,this._setCursor(0,0);for(let $=0;$(this._coreService.triggerDataEvent(`${d.C0.ESC}${se}${d.C0.ESC}\\`),!0))(I==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:I==='"p'?'P1$r61;1"p':I==="r"?`P1$r${L.scrollTop+1};${L.scrollBottom+1}r`:I==="m"?"P1$r0m":I===" q"?`P1$r${{block:2,underline:4,bar:6}[K.cursorStyle]-(K.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(I,$){this._dirtyRowTracker.markRangeDirty(I,$)}}a.InputHandler=G;let Z=class{constructor(V){this._bufferService=V,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(V){Vthis.end&&(this.end=V)}markRangeDirty(V,I){V>I&&(O=V,V=I,I=O),Vthis.end&&(this.end=I)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function q(V){return 0<=V&&V<256}Z=l([u(0,w.IBufferService)],Z)},844:(o,a)=>{function c(l){for(const u of l)u.dispose();l.length=0}Object.defineProperty(a,"__esModule",{value:!0}),a.getDisposeArrayDisposable=a.disposeArray=a.toDisposable=a.MutableDisposable=a.Disposable=void 0,a.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const l of this._disposables)l.dispose();this._disposables.length=0}register(l){return this._disposables.push(l),l}unregister(l){const u=this._disposables.indexOf(l);u!==-1&&this._disposables.splice(u,1)}},a.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(l){var u;this._isDisposed||l===this._value||((u=this._value)===null||u===void 0||u.dispose(),this._value=l)}clear(){this.value=void 0}dispose(){var l;this._isDisposed=!0,(l=this._value)===null||l===void 0||l.dispose(),this._value=void 0}},a.toDisposable=function(l){return{dispose:l}},a.disposeArray=c,a.getDisposeArrayDisposable=function(l){return{dispose:()=>c(l)}}},1505:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.FourKeyMap=a.TwoKeyMap=void 0;class c{constructor(){this._data={}}set(u,d,h){this._data[u]||(this._data[u]={}),this._data[u][d]=h}get(u,d){return this._data[u]?this._data[u][d]:void 0}clear(){this._data={}}}a.TwoKeyMap=c,a.FourKeyMap=class{constructor(){this._data=new c}set(l,u,d,h,p){this._data.get(l,u)||this._data.set(l,u,new c),this._data.get(l,u).set(d,h,p)}get(l,u,d,h){var p;return(p=this._data.get(l,u))===null||p===void 0?void 0:p.get(d,h)}clear(){this._data.clear()}}},6114:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.isChromeOS=a.isLinux=a.isWindows=a.isIphone=a.isIpad=a.isMac=a.getSafariVersion=a.isSafari=a.isLegacyEdge=a.isFirefox=a.isNode=void 0,a.isNode=typeof navigator>"u";const c=a.isNode?"node":navigator.userAgent,l=a.isNode?"node":navigator.platform;a.isFirefox=c.includes("Firefox"),a.isLegacyEdge=c.includes("Edge"),a.isSafari=/^((?!chrome|android).)*safari/i.test(c),a.getSafariVersion=function(){if(!a.isSafari)return 0;const u=c.match(/Version\/(\d+)/);return u===null||u.length<2?0:parseInt(u[1])},a.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(l),a.isIpad=l==="iPad",a.isIphone=l==="iPhone",a.isWindows=["Windows","Win16","Win32","WinCE"].includes(l),a.isLinux=l.indexOf("Linux")>=0,a.isChromeOS=/\bCrOS\b/.test(c)},6106:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.SortedList=void 0;let c=0;a.SortedList=class{constructor(l){this._getKey=l,this._array=[]}clear(){this._array.length=0}insert(l){this._array.length!==0?(c=this._search(this._getKey(l)),this._array.splice(c,0,l)):this._array.push(l)}delete(l){if(this._array.length===0)return!1;const u=this._getKey(l);if(u===void 0||(c=this._search(u),c===-1)||this._getKey(this._array[c])!==u)return!1;do if(this._array[c]===l)return this._array.splice(c,1),!0;while(++c=this._array.length)&&this._getKey(this._array[c])===l))do yield this._array[c];while(++c=this._array.length)&&this._getKey(this._array[c])===l))do u(this._array[c]);while(++c=u;){let h=u+d>>1;const p=this._getKey(this._array[h]);if(p>l)d=h-1;else{if(!(p0&&this._getKey(this._array[h-1])===l;)h--;return h}u=h+1}}return u}}},7226:(o,a,c)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.DebouncedIdleTask=a.IdleTaskQueue=a.PriorityTaskQueue=void 0;const l=c(6114);class u{constructor(){this._tasks=[],this._i=0}enqueue(p){this._tasks.push(p),this._start()}flush(){for(;this._iy)return m-g<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(m-g))}ms`),void this._start();m=y}this.clear()}}class d extends u{_requestCallback(p){return setTimeout(()=>p(this._createDeadline(16)))}_cancelCallback(p){clearTimeout(p)}_createDeadline(p){const g=Date.now()+p;return{timeRemaining:()=>Math.max(0,g-Date.now())}}}a.PriorityTaskQueue=d,a.IdleTaskQueue=!l.isNode&&"requestIdleCallback"in window?class extends u{_requestCallback(h){return requestIdleCallback(h)}_cancelCallback(h){cancelIdleCallback(h)}}:d,a.DebouncedIdleTask=class{constructor(){this._queue=new a.IdleTaskQueue}set(h){this._queue.clear(),this._queue.enqueue(h)}flush(){this._queue.flush()}}},9282:(o,a,c)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.updateWindowsModeWrappedState=void 0;const l=c(643);a.updateWindowsModeWrappedState=function(u){const d=u.buffer.lines.get(u.buffer.ybase+u.buffer.y-1),h=d==null?void 0:d.get(u.cols-1),p=u.buffer.lines.get(u.buffer.ybase+u.buffer.y);p&&h&&(p.isWrapped=h[l.CHAR_DATA_CODE_INDEX]!==l.NULL_CELL_CODE&&h[l.CHAR_DATA_CODE_INDEX]!==l.WHITESPACE_CELL_CODE)}},3734:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.ExtendedAttrs=a.AttributeData=void 0;class c{constructor(){this.fg=0,this.bg=0,this.extended=new l}static toColorRGB(d){return[d>>>16&255,d>>>8&255,255&d]}static fromColorRGB(d){return(255&d[0])<<16|(255&d[1])<<8|255&d[2]}clone(){const d=new c;return d.fg=this.fg,d.bg=this.bg,d.extended=this.extended.clone(),d}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}}a.AttributeData=c;class l{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(d){this._ext=d}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(d){this._ext&=-469762049,this._ext|=d<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(d){this._ext&=-67108864,this._ext|=67108863&d}get urlId(){return this._urlId}set urlId(d){this._urlId=d}constructor(d=0,h=0){this._ext=0,this._urlId=0,this._ext=d,this._urlId=h}clone(){return new l(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}a.ExtendedAttrs=l},9092:(o,a,c)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.Buffer=a.MAX_BUFFER_SIZE=void 0;const l=c(6349),u=c(7226),d=c(3734),h=c(8437),p=c(4634),g=c(511),v=c(643),m=c(4863),y=c(7116);a.MAX_BUFFER_SIZE=4294967295,a.Buffer=class{constructor(_,b,k){this._hasScrollback=_,this._optionsService=b,this._bufferService=k,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=h.DEFAULT_ATTR_DATA.clone(),this.savedCharset=y.DEFAULT_CHARSET,this.markers=[],this._nullCell=g.CellData.fromCharData([0,v.NULL_CELL_CHAR,v.NULL_CELL_WIDTH,v.NULL_CELL_CODE]),this._whitespaceCell=g.CellData.fromCharData([0,v.WHITESPACE_CELL_CHAR,v.WHITESPACE_CELL_WIDTH,v.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new u.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new l.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(_){return _?(this._nullCell.fg=_.fg,this._nullCell.bg=_.bg,this._nullCell.extended=_.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new d.ExtendedAttrs),this._nullCell}getWhitespaceCell(_){return _?(this._whitespaceCell.fg=_.fg,this._whitespaceCell.bg=_.bg,this._whitespaceCell.extended=_.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new d.ExtendedAttrs),this._whitespaceCell}getBlankLine(_,b){return new h.BufferLine(this._bufferService.cols,this.getNullCell(_),b)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const _=this.ybase+this.y-this.ydisp;return _>=0&&_a.MAX_BUFFER_SIZE?a.MAX_BUFFER_SIZE:b}fillViewportRows(_){if(this.lines.length===0){_===void 0&&(_=h.DEFAULT_ATTR_DATA);let b=this._rows;for(;b--;)this.lines.push(this.getBlankLine(_))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new l.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(_,b){const k=this.getNullCell(h.DEFAULT_ATTR_DATA);let w=0;const T=this._getCorrectBufferLength(b);if(T>this.lines.maxLength&&(this.lines.maxLength=T),this.lines.length>0){if(this._cols<_)for(let C=0;C0&&this.lines.length<=this.ybase+this.y+A+1?(this.ybase--,A++,this.ydisp>0&&this.ydisp--):this.lines.push(new h.BufferLine(_,k)));else for(let C=this._rows;C>b;C--)this.lines.length>b+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(T0&&(this.lines.trimStart(C),this.ybase=Math.max(this.ybase-C,0),this.ydisp=Math.max(this.ydisp-C,0),this.savedY=Math.max(this.savedY-C,0)),this.lines.maxLength=T}this.x=Math.min(this.x,_-1),this.y=Math.min(this.y,b-1),A&&(this.y+=A),this.savedX=Math.min(this.savedX,_-1),this.scrollTop=0}if(this.scrollBottom=b-1,this._isReflowEnabled&&(this._reflow(_,b),this._cols>_))for(let A=0;A.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let _=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,_=!1);let b=0;for(;this._memoryCleanupPosition100)return!0;return _}get _isReflowEnabled(){const _=this._optionsService.rawOptions.windowsPty;return _&&_.buildNumber?this._hasScrollback&&_.backend==="conpty"&&_.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(_,b){this._cols!==_&&(_>this._cols?this._reflowLarger(_,b):this._reflowSmaller(_,b))}_reflowLarger(_,b){const k=(0,p.reflowLargerGetLinesToRemove)(this.lines,this._cols,_,this.ybase+this.y,this.getNullCell(h.DEFAULT_ATTR_DATA));if(k.length>0){const w=(0,p.reflowLargerCreateNewLayout)(this.lines,k);(0,p.reflowLargerApplyNewLayout)(this.lines,w.layout),this._reflowLargerAdjustViewport(_,b,w.countRemoved)}}_reflowLargerAdjustViewport(_,b,k){const w=this.getNullCell(h.DEFAULT_ATTR_DATA);let T=k;for(;T-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length=0;A--){let C=this.lines.get(A);if(!C||!C.isWrapped&&C.getTrimmedLength()<=_)continue;const E=[C];for(;C.isWrapped&&A>0;)C=this.lines.get(--A),E.unshift(C);const x=this.ybase+this.y;if(x>=A&&x0&&(w.push({start:A+E.length+T,newLines:Z}),T+=Z.length),E.push(...Z);let q=N.length-1,V=N[q];V===0&&(q--,V=N[q]);let I=E.length-O-1,$=D;for(;I>=0;){const K=Math.min($,V);if(E[q]===void 0)break;if(E[q].copyCellsFrom(E[I],$-K,V-K,K,!0),V-=K,V===0&&(q--,V=N[q]),$-=K,$===0){I--;const se=Math.max(I,0);$=(0,p.getWrappedLineTrimmedLength)(E,se,this._cols)}}for(let K=0;K0;)this.ybase===0?this.y0){const A=[],C=[];for(let q=0;q=0;q--)if(N&&N.start>x+O){for(let V=N.newLines.length-1;V>=0;V--)this.lines.set(q--,N.newLines[V]);q++,A.push({index:x+1,amount:N.newLines.length}),O+=N.newLines.length,N=w[++D]}else this.lines.set(q,C[x--]);let G=0;for(let q=A.length-1;q>=0;q--)A[q].index+=G,this.lines.onInsertEmitter.fire(A[q]),G+=A[q].amount;const Z=Math.max(0,E+T-this.lines.maxLength);Z>0&&this.lines.onTrimEmitter.fire(Z)}}translateBufferLineToString(_,b,k=0,w){const T=this.lines.get(_);return T?T.translateToString(b,k,w):""}getWrappedRangeForLine(_){let b=_,k=_;for(;b>0&&this.lines.get(b).isWrapped;)b--;for(;k+10;);return _>=this._cols?this._cols-1:_<0?0:_}nextStop(_){for(_==null&&(_=this.x);!this.tabs[++_]&&_=this._cols?this._cols-1:_<0?0:_}clearMarkers(_){this._isClearing=!0;for(let b=0;b{b.line-=k,b.line<0&&b.dispose()})),b.register(this.lines.onInsert(k=>{b.line>=k.index&&(b.line+=k.amount)})),b.register(this.lines.onDelete(k=>{b.line>=k.index&&b.linek.index&&(b.line-=k.amount)})),b.register(b.onDispose(()=>this._removeMarker(b))),b}_removeMarker(_){this._isClearing||this.markers.splice(this.markers.indexOf(_),1)}}},8437:(o,a,c)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.BufferLine=a.DEFAULT_ATTR_DATA=void 0;const l=c(3734),u=c(511),d=c(643),h=c(482);a.DEFAULT_ATTR_DATA=Object.freeze(new l.AttributeData);let p=0;class g{constructor(m,y,_=!1){this.isWrapped=_,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*m);const b=y||u.CellData.fromCharData([0,d.NULL_CELL_CHAR,d.NULL_CELL_WIDTH,d.NULL_CELL_CODE]);for(let k=0;k>22,2097152&y?this._combined[m].charCodeAt(this._combined[m].length-1):_]}set(m,y){this._data[3*m+1]=y[d.CHAR_DATA_ATTR_INDEX],y[d.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[m]=y[1],this._data[3*m+0]=2097152|m|y[d.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*m+0]=y[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|y[d.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(m){return this._data[3*m+0]>>22}hasWidth(m){return 12582912&this._data[3*m+0]}getFg(m){return this._data[3*m+1]}getBg(m){return this._data[3*m+2]}hasContent(m){return 4194303&this._data[3*m+0]}getCodePoint(m){const y=this._data[3*m+0];return 2097152&y?this._combined[m].charCodeAt(this._combined[m].length-1):2097151&y}isCombined(m){return 2097152&this._data[3*m+0]}getString(m){const y=this._data[3*m+0];return 2097152&y?this._combined[m]:2097151&y?(0,h.stringFromCodePoint)(2097151&y):""}isProtected(m){return 536870912&this._data[3*m+2]}loadCell(m,y){return p=3*m,y.content=this._data[p+0],y.fg=this._data[p+1],y.bg=this._data[p+2],2097152&y.content&&(y.combinedData=this._combined[m]),268435456&y.bg&&(y.extended=this._extendedAttrs[m]),y}setCell(m,y){2097152&y.content&&(this._combined[m]=y.combinedData),268435456&y.bg&&(this._extendedAttrs[m]=y.extended),this._data[3*m+0]=y.content,this._data[3*m+1]=y.fg,this._data[3*m+2]=y.bg}setCellFromCodePoint(m,y,_,b,k,w){268435456&k&&(this._extendedAttrs[m]=w),this._data[3*m+0]=y|_<<22,this._data[3*m+1]=b,this._data[3*m+2]=k}addCodepointToCell(m,y){let _=this._data[3*m+0];2097152&_?this._combined[m]+=(0,h.stringFromCodePoint)(y):(2097151&_?(this._combined[m]=(0,h.stringFromCodePoint)(2097151&_)+(0,h.stringFromCodePoint)(y),_&=-2097152,_|=2097152):_=y|4194304,this._data[3*m+0]=_)}insertCells(m,y,_,b){if((m%=this.length)&&this.getWidth(m-1)===2&&this.setCellFromCodePoint(m-1,0,1,(b==null?void 0:b.fg)||0,(b==null?void 0:b.bg)||0,(b==null?void 0:b.extended)||new l.ExtendedAttrs),y=0;--w)this.setCell(m+y+w,this.loadCell(m+w,k));for(let w=0;wthis.length){if(this._data.buffer.byteLength>=4*_)this._data=new Uint32Array(this._data.buffer,0,_);else{const b=new Uint32Array(_);b.set(this._data),this._data=b}for(let b=this.length;b=m&&delete this._combined[T]}const k=Object.keys(this._extendedAttrs);for(let w=0;w=m&&delete this._extendedAttrs[T]}}return this.length=m,4*_*2=0;--m)if(4194303&this._data[3*m+0])return m+(this._data[3*m+0]>>22);return 0}getNoBgTrimmedLength(){for(let m=this.length-1;m>=0;--m)if(4194303&this._data[3*m+0]||50331648&this._data[3*m+2])return m+(this._data[3*m+0]>>22);return 0}copyCellsFrom(m,y,_,b,k){const w=m._data;if(k)for(let A=b-1;A>=0;A--){for(let C=0;C<3;C++)this._data[3*(_+A)+C]=w[3*(y+A)+C];268435456&w[3*(y+A)+2]&&(this._extendedAttrs[_+A]=m._extendedAttrs[y+A])}else for(let A=0;A=y&&(this._combined[C-y+_]=m._combined[C])}}translateToString(m=!1,y=0,_=this.length){m&&(_=Math.min(_,this.getTrimmedLength()));let b="";for(;y<_;){const k=this._data[3*y+0],w=2097151&k;b+=2097152&k?this._combined[y]:w?(0,h.stringFromCodePoint)(w):d.WHITESPACE_CELL_CHAR,y+=k>>22||1}return b}}a.BufferLine=g},4841:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.getRangeLength=void 0,a.getRangeLength=function(c,l){if(c.start.y>c.end.y)throw new Error(`Buffer range end (${c.end.x}, ${c.end.y}) cannot be before start (${c.start.x}, ${c.start.y})`);return l*(c.end.y-c.start.y)+(c.end.x-c.start.x+1)}},4634:(o,a)=>{function c(l,u,d){if(u===l.length-1)return l[u].getTrimmedLength();const h=!l[u].hasContent(d-1)&&l[u].getWidth(d-1)===1,p=l[u+1].getWidth(0)===2;return h&&p?d-1:d}Object.defineProperty(a,"__esModule",{value:!0}),a.getWrappedLineTrimmedLength=a.reflowSmallerGetNewLineLengths=a.reflowLargerApplyNewLayout=a.reflowLargerCreateNewLayout=a.reflowLargerGetLinesToRemove=void 0,a.reflowLargerGetLinesToRemove=function(l,u,d,h,p){const g=[];for(let v=0;v=v&&h0&&(C>b||_[C].getTrimmedLength()===0);C--)A++;A>0&&(g.push(v+_.length-A),g.push(A)),v+=_.length-1}return g},a.reflowLargerCreateNewLayout=function(l,u){const d=[];let h=0,p=u[h],g=0;for(let v=0;vc(l,_,u)).reduce((y,_)=>y+_);let g=0,v=0,m=0;for(;my&&(g-=y,v++);const _=l[v].getWidth(g-1)===2;_&&g--;const b=_?d-1:d;h.push(b),m+=b}return h},a.getWrappedLineTrimmedLength=c},5295:(o,a,c)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.BufferSet=void 0;const l=c(8460),u=c(844),d=c(9092);class h extends u.Disposable{constructor(g,v){super(),this._optionsService=g,this._bufferService=v,this._onBufferActivate=this.register(new l.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new d.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new d.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(g){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(g),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(g,v){this._normal.resize(g,v),this._alt.resize(g,v),this.setupTabStops(g)}setupTabStops(g){this._normal.setupTabStops(g),this._alt.setupTabStops(g)}}a.BufferSet=h},511:(o,a,c)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.CellData=void 0;const l=c(482),u=c(643),d=c(3734);class h extends d.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new d.ExtendedAttrs,this.combinedData=""}static fromCharData(g){const v=new h;return v.setFromCharData(g),v}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,l.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(g){this.fg=g[u.CHAR_DATA_ATTR_INDEX],this.bg=0;let v=!1;if(g[u.CHAR_DATA_CHAR_INDEX].length>2)v=!0;else if(g[u.CHAR_DATA_CHAR_INDEX].length===2){const m=g[u.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=m&&m<=56319){const y=g[u.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=y&&y<=57343?this.content=1024*(m-55296)+y-56320+65536|g[u.CHAR_DATA_WIDTH_INDEX]<<22:v=!0}else v=!0}else this.content=g[u.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|g[u.CHAR_DATA_WIDTH_INDEX]<<22;v&&(this.combinedData=g[u.CHAR_DATA_CHAR_INDEX],this.content=2097152|g[u.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}a.CellData=h},643:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.WHITESPACE_CELL_CODE=a.WHITESPACE_CELL_WIDTH=a.WHITESPACE_CELL_CHAR=a.NULL_CELL_CODE=a.NULL_CELL_WIDTH=a.NULL_CELL_CHAR=a.CHAR_DATA_CODE_INDEX=a.CHAR_DATA_WIDTH_INDEX=a.CHAR_DATA_CHAR_INDEX=a.CHAR_DATA_ATTR_INDEX=a.DEFAULT_EXT=a.DEFAULT_ATTR=a.DEFAULT_COLOR=void 0,a.DEFAULT_COLOR=0,a.DEFAULT_ATTR=256|a.DEFAULT_COLOR<<9,a.DEFAULT_EXT=0,a.CHAR_DATA_ATTR_INDEX=0,a.CHAR_DATA_CHAR_INDEX=1,a.CHAR_DATA_WIDTH_INDEX=2,a.CHAR_DATA_CODE_INDEX=3,a.NULL_CELL_CHAR="",a.NULL_CELL_WIDTH=1,a.NULL_CELL_CODE=0,a.WHITESPACE_CELL_CHAR=" ",a.WHITESPACE_CELL_WIDTH=1,a.WHITESPACE_CELL_CODE=32},4863:(o,a,c)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.Marker=void 0;const l=c(8460),u=c(844);class d{get id(){return this._id}constructor(p){this.line=p,this.isDisposed=!1,this._disposables=[],this._id=d._nextId++,this._onDispose=this.register(new l.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,u.disposeArray)(this._disposables),this._disposables.length=0)}register(p){return this._disposables.push(p),p}}a.Marker=d,d._nextId=1},7116:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.DEFAULT_CHARSET=a.CHARSETS=void 0,a.CHARSETS={},a.DEFAULT_CHARSET=a.CHARSETS.B,a.CHARSETS[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"␤",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"},a.CHARSETS.A={"#":"£"},a.CHARSETS.B=void 0,a.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},a.CHARSETS.C=a.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},a.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},a.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},a.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},a.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},a.CHARSETS.E=a.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},a.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},a.CHARSETS.H=a.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},a.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(o,a)=>{var c,l,u;Object.defineProperty(a,"__esModule",{value:!0}),a.C1_ESCAPED=a.C1=a.C0=void 0,function(d){d.NUL="\0",d.SOH="",d.STX="",d.ETX="",d.EOT="",d.ENQ="",d.ACK="",d.BEL="\x07",d.BS="\b",d.HT=" ",d.LF=` `,d.VT="\v",d.FF="\f",d.CR="\r",d.SO="",d.SI="",d.DLE="",d.DC1="",d.DC2="",d.DC3="",d.DC4="",d.NAK="",d.SYN="",d.ETB="",d.CAN="",d.EM="",d.SUB="",d.ESC="\x1B",d.FS="",d.GS="",d.RS="",d.US="",d.SP=" ",d.DEL=""}(c||(a.C0=c={})),function(d){d.PAD="€",d.HOP="",d.BPH="‚",d.NBH="ƒ",d.IND="„",d.NEL="…",d.SSA="†",d.ESA="‡",d.HTS="ˆ",d.HTJ="‰",d.VTS="Š",d.PLD="‹",d.PLU="Œ",d.RI="",d.SS2="Ž",d.SS3="",d.DCS="",d.PU1="‘",d.PU2="’",d.STS="“",d.CCH="”",d.MW="•",d.SPA="–",d.EPA="—",d.SOS="˜",d.SGCI="™",d.SCI="š",d.CSI="›",d.ST="œ",d.OSC="",d.PM="ž",d.APC="Ÿ"}(l||(a.C1=l={})),function(d){d.ST=`${c.ESC}\\`}(u||(a.C1_ESCAPED=u={}))},7399:(o,a,c)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.evaluateKeyboardEvent=void 0;const l=c(2584),u={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};a.evaluateKeyboardEvent=function(d,h,p,g){const v={type:0,cancel:!1,key:void 0},m=(d.shiftKey?1:0)|(d.altKey?2:0)|(d.ctrlKey?4:0)|(d.metaKey?8:0);switch(d.keyCode){case 0:d.key==="UIKeyInputUpArrow"?v.key=h?l.C0.ESC+"OA":l.C0.ESC+"[A":d.key==="UIKeyInputLeftArrow"?v.key=h?l.C0.ESC+"OD":l.C0.ESC+"[D":d.key==="UIKeyInputRightArrow"?v.key=h?l.C0.ESC+"OC":l.C0.ESC+"[C":d.key==="UIKeyInputDownArrow"&&(v.key=h?l.C0.ESC+"OB":l.C0.ESC+"[B");break;case 8:if(d.altKey){v.key=l.C0.ESC+l.C0.DEL;break}v.key=l.C0.DEL;break;case 9:if(d.shiftKey){v.key=l.C0.ESC+"[Z";break}v.key=l.C0.HT,v.cancel=!0;break;case 13:v.key=d.altKey?l.C0.ESC+l.C0.CR:l.C0.CR,v.cancel=!0;break;case 27:v.key=l.C0.ESC,d.altKey&&(v.key=l.C0.ESC+l.C0.ESC),v.cancel=!0;break;case 37:if(d.metaKey)break;m?(v.key=l.C0.ESC+"[1;"+(m+1)+"D",v.key===l.C0.ESC+"[1;3D"&&(v.key=l.C0.ESC+(p?"b":"[1;5D"))):v.key=h?l.C0.ESC+"OD":l.C0.ESC+"[D";break;case 39:if(d.metaKey)break;m?(v.key=l.C0.ESC+"[1;"+(m+1)+"C",v.key===l.C0.ESC+"[1;3C"&&(v.key=l.C0.ESC+(p?"f":"[1;5C"))):v.key=h?l.C0.ESC+"OC":l.C0.ESC+"[C";break;case 38:if(d.metaKey)break;m?(v.key=l.C0.ESC+"[1;"+(m+1)+"A",p||v.key!==l.C0.ESC+"[1;3A"||(v.key=l.C0.ESC+"[1;5A")):v.key=h?l.C0.ESC+"OA":l.C0.ESC+"[A";break;case 40:if(d.metaKey)break;m?(v.key=l.C0.ESC+"[1;"+(m+1)+"B",p||v.key!==l.C0.ESC+"[1;3B"||(v.key=l.C0.ESC+"[1;5B")):v.key=h?l.C0.ESC+"OB":l.C0.ESC+"[B";break;case 45:d.shiftKey||d.ctrlKey||(v.key=l.C0.ESC+"[2~");break;case 46:v.key=m?l.C0.ESC+"[3;"+(m+1)+"~":l.C0.ESC+"[3~";break;case 36:v.key=m?l.C0.ESC+"[1;"+(m+1)+"H":h?l.C0.ESC+"OH":l.C0.ESC+"[H";break;case 35:v.key=m?l.C0.ESC+"[1;"+(m+1)+"F":h?l.C0.ESC+"OF":l.C0.ESC+"[F";break;case 33:d.shiftKey?v.type=2:d.ctrlKey?v.key=l.C0.ESC+"[5;"+(m+1)+"~":v.key=l.C0.ESC+"[5~";break;case 34:d.shiftKey?v.type=3:d.ctrlKey?v.key=l.C0.ESC+"[6;"+(m+1)+"~":v.key=l.C0.ESC+"[6~";break;case 112:v.key=m?l.C0.ESC+"[1;"+(m+1)+"P":l.C0.ESC+"OP";break;case 113:v.key=m?l.C0.ESC+"[1;"+(m+1)+"Q":l.C0.ESC+"OQ";break;case 114:v.key=m?l.C0.ESC+"[1;"+(m+1)+"R":l.C0.ESC+"OR";break;case 115:v.key=m?l.C0.ESC+"[1;"+(m+1)+"S":l.C0.ESC+"OS";break;case 116:v.key=m?l.C0.ESC+"[15;"+(m+1)+"~":l.C0.ESC+"[15~";break;case 117:v.key=m?l.C0.ESC+"[17;"+(m+1)+"~":l.C0.ESC+"[17~";break;case 118:v.key=m?l.C0.ESC+"[18;"+(m+1)+"~":l.C0.ESC+"[18~";break;case 119:v.key=m?l.C0.ESC+"[19;"+(m+1)+"~":l.C0.ESC+"[19~";break;case 120:v.key=m?l.C0.ESC+"[20;"+(m+1)+"~":l.C0.ESC+"[20~";break;case 121:v.key=m?l.C0.ESC+"[21;"+(m+1)+"~":l.C0.ESC+"[21~";break;case 122:v.key=m?l.C0.ESC+"[23;"+(m+1)+"~":l.C0.ESC+"[23~";break;case 123:v.key=m?l.C0.ESC+"[24;"+(m+1)+"~":l.C0.ESC+"[24~";break;default:if(!d.ctrlKey||d.shiftKey||d.altKey||d.metaKey)if(p&&!g||!d.altKey||d.metaKey)!p||d.altKey||d.ctrlKey||d.shiftKey||!d.metaKey?d.key&&!d.ctrlKey&&!d.altKey&&!d.metaKey&&d.keyCode>=48&&d.key.length===1?v.key=d.key:d.key&&d.ctrlKey&&(d.key==="_"&&(v.key=l.C0.US),d.key==="@"&&(v.key=l.C0.NUL)):d.keyCode===65&&(v.type=1);else{const y=u[d.keyCode],_=y==null?void 0:y[d.shiftKey?1:0];if(_)v.key=l.C0.ESC+_;else if(d.keyCode>=65&&d.keyCode<=90){const b=d.ctrlKey?d.keyCode-64:d.keyCode+32;let k=String.fromCharCode(b);d.shiftKey&&(k=k.toUpperCase()),v.key=l.C0.ESC+k}else if(d.keyCode===32)v.key=l.C0.ESC+(d.ctrlKey?l.C0.NUL:" ");else if(d.key==="Dead"&&d.code.startsWith("Key")){let b=d.code.slice(3,4);d.shiftKey||(b=b.toLowerCase()),v.key=l.C0.ESC+b,v.cancel=!0}}else d.keyCode>=65&&d.keyCode<=90?v.key=String.fromCharCode(d.keyCode-64):d.keyCode===32?v.key=l.C0.NUL:d.keyCode>=51&&d.keyCode<=55?v.key=String.fromCharCode(d.keyCode-51+27):d.keyCode===56?v.key=l.C0.DEL:d.keyCode===219?v.key=l.C0.ESC:d.keyCode===220?v.key=l.C0.FS:d.keyCode===221&&(v.key=l.C0.GS)}return v}},482:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.Utf8ToUtf32=a.StringToUtf32=a.utf32ToString=a.stringFromCodePoint=void 0,a.stringFromCodePoint=function(c){return c>65535?(c-=65536,String.fromCharCode(55296+(c>>10))+String.fromCharCode(c%1024+56320)):String.fromCharCode(c)},a.utf32ToString=function(c,l=0,u=c.length){let d="";for(let h=l;h65535?(p-=65536,d+=String.fromCharCode(55296+(p>>10))+String.fromCharCode(p%1024+56320)):d+=String.fromCharCode(p)}return d},a.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(c,l){const u=c.length;if(!u)return 0;let d=0,h=0;if(this._interim){const p=c.charCodeAt(h++);56320<=p&&p<=57343?l[d++]=1024*(this._interim-55296)+p-56320+65536:(l[d++]=this._interim,l[d++]=p),this._interim=0}for(let p=h;p=u)return this._interim=g,d;const v=c.charCodeAt(p);56320<=v&&v<=57343?l[d++]=1024*(g-55296)+v-56320+65536:(l[d++]=g,l[d++]=v)}else g!==65279&&(l[d++]=g)}return d}},a.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(c,l){const u=c.length;if(!u)return 0;let d,h,p,g,v=0,m=0,y=0;if(this.interim[0]){let k=!1,w=this.interim[0];w&=(224&w)==192?31:(240&w)==224?15:7;let T,A=0;for(;(T=63&this.interim[++A])&&A<4;)w<<=6,w|=T;const C=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,E=C-A;for(;y=u)return 0;if(T=c[y++],(192&T)!=128){y--,k=!0;break}this.interim[A++]=T,w<<=6,w|=63&T}k||(C===2?w<128?y--:l[v++]=w:C===3?w<2048||w>=55296&&w<=57343||w===65279||(l[v++]=w):w<65536||w>1114111||(l[v++]=w)),this.interim.fill(0)}const _=u-4;let b=y;for(;b=u)return this.interim[0]=d,v;if(h=c[b++],(192&h)!=128){b--;continue}if(m=(31&d)<<6|63&h,m<128){b--;continue}l[v++]=m}else if((240&d)==224){if(b>=u)return this.interim[0]=d,v;if(h=c[b++],(192&h)!=128){b--;continue}if(b>=u)return this.interim[0]=d,this.interim[1]=h,v;if(p=c[b++],(192&p)!=128){b--;continue}if(m=(15&d)<<12|(63&h)<<6|63&p,m<2048||m>=55296&&m<=57343||m===65279)continue;l[v++]=m}else if((248&d)==240){if(b>=u)return this.interim[0]=d,v;if(h=c[b++],(192&h)!=128){b--;continue}if(b>=u)return this.interim[0]=d,this.interim[1]=h,v;if(p=c[b++],(192&p)!=128){b--;continue}if(b>=u)return this.interim[0]=d,this.interim[1]=h,this.interim[2]=p,v;if(g=c[b++],(192&g)!=128){b--;continue}if(m=(7&d)<<18|(63&h)<<12|(63&p)<<6|63&g,m<65536||m>1114111)continue;l[v++]=m}}return v}}},225:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.UnicodeV6=void 0;const c=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],l=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let u;a.UnicodeV6=class{constructor(){if(this.version="6",!u){u=new Uint8Array(65536),u.fill(1),u[0]=0,u.fill(0,1,32),u.fill(0,127,160),u.fill(2,4352,4448),u[9001]=2,u[9002]=2,u.fill(2,11904,42192),u[12351]=1,u.fill(2,44032,55204),u.fill(2,63744,64256),u.fill(2,65040,65050),u.fill(2,65072,65136),u.fill(2,65280,65377),u.fill(2,65504,65511);for(let d=0;dp[m][1])return!1;for(;m>=v;)if(g=v+m>>1,h>p[g][1])v=g+1;else{if(!(h=131072&&d<=196605||d>=196608&&d<=262141?2:1}}},5981:(o,a,c)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.WriteBuffer=void 0;const l=c(8460),u=c(844);class d extends u.Disposable{constructor(p){super(),this._action=p,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new l.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(p,g){if(g!==void 0&&this._syncCalls>g)return void(this._syncCalls=0);if(this._pendingData+=p.length,this._writeBuffer.push(p),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let v;for(this._isSyncWriting=!0;v=this._writeBuffer.shift();){this._action(v);const m=this._callbacks.shift();m&&m()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(p,g){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=p.length,this._writeBuffer.push(p),this._callbacks.push(g),void this._innerWrite();setTimeout(()=>this._innerWrite())}this._pendingData+=p.length,this._writeBuffer.push(p),this._callbacks.push(g)}_innerWrite(p=0,g=!0){const v=p||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const m=this._writeBuffer[this._bufferOffset],y=this._action(m,g);if(y){const b=k=>Date.now()-v>=12?setTimeout(()=>this._innerWrite(0,k)):this._innerWrite(v,k);return void y.catch(k=>(queueMicrotask(()=>{throw k}),Promise.resolve(!1))).then(b)}const _=this._callbacks[this._bufferOffset];if(_&&_(),this._bufferOffset++,this._pendingData-=m.length,Date.now()-v>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}a.WriteBuffer=d},5941:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.toRgbString=a.parseColor=void 0;const c=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,l=/^[\da-f]+$/;function u(d,h){const p=d.toString(16),g=p.length<2?"0"+p:p;switch(h){case 4:return p[0];case 8:return g;case 12:return(g+g).slice(0,3);default:return g+g}}a.parseColor=function(d){if(!d)return;let h=d.toLowerCase();if(h.indexOf("rgb:")===0){h=h.slice(4);const p=c.exec(h);if(p){const g=p[1]?15:p[4]?255:p[7]?4095:65535;return[Math.round(parseInt(p[1]||p[4]||p[7]||p[10],16)/g*255),Math.round(parseInt(p[2]||p[5]||p[8]||p[11],16)/g*255),Math.round(parseInt(p[3]||p[6]||p[9]||p[12],16)/g*255)]}}else if(h.indexOf("#")===0&&(h=h.slice(1),l.exec(h)&&[3,6,9,12].includes(h.length))){const p=h.length/3,g=[0,0,0];for(let v=0;v<3;++v){const m=parseInt(h.slice(p*v,p*v+p),16);g[v]=p===1?m<<4:p===2?m:p===3?m>>4:m>>8}return g}},a.toRgbString=function(d,h=16){const[p,g,v]=d;return`rgb:${u(p,h)}/${u(g,h)}/${u(v,h)}`}},5770:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.PAYLOAD_LIMIT=void 0,a.PAYLOAD_LIMIT=1e7},6351:(o,a,c)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.DcsHandler=a.DcsParser=void 0;const l=c(482),u=c(8742),d=c(5770),h=[];a.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=h,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=h}registerHandler(g,v){this._handlers[g]===void 0&&(this._handlers[g]=[]);const m=this._handlers[g];return m.push(v),{dispose:()=>{const y=m.indexOf(v);y!==-1&&m.splice(y,1)}}}clearHandler(g){this._handlers[g]&&delete this._handlers[g]}setHandlerFallback(g){this._handlerFb=g}reset(){if(this._active.length)for(let g=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;g>=0;--g)this._active[g].unhook(!1);this._stack.paused=!1,this._active=h,this._ident=0}hook(g,v){if(this.reset(),this._ident=g,this._active=this._handlers[g]||h,this._active.length)for(let m=this._active.length-1;m>=0;m--)this._active[m].hook(v);else this._handlerFb(this._ident,"HOOK",v)}put(g,v,m){if(this._active.length)for(let y=this._active.length-1;y>=0;y--)this._active[y].put(g,v,m);else this._handlerFb(this._ident,"PUT",(0,l.utf32ToString)(g,v,m))}unhook(g,v=!0){if(this._active.length){let m=!1,y=this._active.length-1,_=!1;if(this._stack.paused&&(y=this._stack.loopPosition-1,m=v,_=this._stack.fallThrough,this._stack.paused=!1),!_&&m===!1){for(;y>=0&&(m=this._active[y].unhook(g),m!==!0);y--)if(m instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=y,this._stack.fallThrough=!1,m;y--}for(;y>=0;y--)if(m=this._active[y].unhook(!1),m instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=y,this._stack.fallThrough=!0,m}else this._handlerFb(this._ident,"UNHOOK",g);this._active=h,this._ident=0}};const p=new u.Params;p.addParam(0),a.DcsHandler=class{constructor(g){this._handler=g,this._data="",this._params=p,this._hitLimit=!1}hook(g){this._params=g.length>1||g.params[0]?g.clone():p,this._data="",this._hitLimit=!1}put(g,v,m){this._hitLimit||(this._data+=(0,l.utf32ToString)(g,v,m),this._data.length>d.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(g){let v=!1;if(this._hitLimit)v=!1;else if(g&&(v=this._handler(this._data,this._params),v instanceof Promise))return v.then(m=>(this._params=p,this._data="",this._hitLimit=!1,m));return this._params=p,this._data="",this._hitLimit=!1,v}}},2015:(o,a,c)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.EscapeSequenceParser=a.VT500_TRANSITION_TABLE=a.TransitionTable=void 0;const l=c(844),u=c(8742),d=c(6242),h=c(6351);class p{constructor(y){this.table=new Uint8Array(y)}setDefault(y,_){this.table.fill(y<<4|_)}add(y,_,b,k){this.table[_<<8|y]=b<<4|k}addMany(y,_,b,k){for(let w=0;wC),_=(A,C)=>y.slice(A,C),b=_(32,127),k=_(0,24);k.push(25),k.push.apply(k,_(28,32));const w=_(0,14);let T;for(T in m.setDefault(1,0),m.addMany(b,0,2,0),w)m.addMany([24,26,153,154],T,3,0),m.addMany(_(128,144),T,3,0),m.addMany(_(144,152),T,3,0),m.add(156,T,0,0),m.add(27,T,11,1),m.add(157,T,4,8),m.addMany([152,158,159],T,0,7),m.add(155,T,11,3),m.add(144,T,11,9);return m.addMany(k,0,3,0),m.addMany(k,1,3,1),m.add(127,1,0,1),m.addMany(k,8,0,8),m.addMany(k,3,3,3),m.add(127,3,0,3),m.addMany(k,4,3,4),m.add(127,4,0,4),m.addMany(k,6,3,6),m.addMany(k,5,3,5),m.add(127,5,0,5),m.addMany(k,2,3,2),m.add(127,2,0,2),m.add(93,1,4,8),m.addMany(b,8,5,8),m.add(127,8,5,8),m.addMany([156,27,24,26,7],8,6,0),m.addMany(_(28,32),8,0,8),m.addMany([88,94,95],1,0,7),m.addMany(b,7,0,7),m.addMany(k,7,0,7),m.add(156,7,0,0),m.add(127,7,0,7),m.add(91,1,11,3),m.addMany(_(64,127),3,7,0),m.addMany(_(48,60),3,8,4),m.addMany([60,61,62,63],3,9,4),m.addMany(_(48,60),4,8,4),m.addMany(_(64,127),4,7,0),m.addMany([60,61,62,63],4,0,6),m.addMany(_(32,64),6,0,6),m.add(127,6,0,6),m.addMany(_(64,127),6,0,0),m.addMany(_(32,48),3,9,5),m.addMany(_(32,48),5,9,5),m.addMany(_(48,64),5,0,6),m.addMany(_(64,127),5,7,0),m.addMany(_(32,48),4,9,5),m.addMany(_(32,48),1,9,2),m.addMany(_(32,48),2,9,2),m.addMany(_(48,127),2,10,0),m.addMany(_(48,80),1,10,0),m.addMany(_(81,88),1,10,0),m.addMany([89,90,92],1,10,0),m.addMany(_(96,127),1,10,0),m.add(80,1,11,9),m.addMany(k,9,0,9),m.add(127,9,0,9),m.addMany(_(28,32),9,0,9),m.addMany(_(32,48),9,9,12),m.addMany(_(48,60),9,8,10),m.addMany([60,61,62,63],9,9,10),m.addMany(k,11,0,11),m.addMany(_(32,128),11,0,11),m.addMany(_(28,32),11,0,11),m.addMany(k,10,0,10),m.add(127,10,0,10),m.addMany(_(28,32),10,0,10),m.addMany(_(48,60),10,8,10),m.addMany([60,61,62,63],10,0,11),m.addMany(_(32,48),10,9,12),m.addMany(k,12,0,12),m.add(127,12,0,12),m.addMany(_(28,32),12,0,12),m.addMany(_(32,48),12,9,12),m.addMany(_(48,64),12,0,11),m.addMany(_(64,127),12,12,13),m.addMany(_(64,127),10,12,13),m.addMany(_(64,127),9,12,13),m.addMany(k,13,13,13),m.addMany(b,13,13,13),m.add(127,13,0,13),m.addMany([27,156,24,26],13,14,0),m.add(g,0,2,0),m.add(g,8,5,8),m.add(g,6,0,6),m.add(g,11,0,11),m.add(g,13,13,13),m}();class v extends l.Disposable{constructor(y=a.VT500_TRANSITION_TABLE){super(),this._transitions=y,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new u.Params,this._params.addParam(0),this._collect=0,this.precedingCodepoint=0,this._printHandlerFb=(_,b,k)=>{},this._executeHandlerFb=_=>{},this._csiHandlerFb=(_,b)=>{},this._escHandlerFb=_=>{},this._errorHandlerFb=_=>_,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,l.toDisposable)(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this.register(new d.OscParser),this._dcsParser=this.register(new h.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(y,_=[64,126]){let b=0;if(y.prefix){if(y.prefix.length>1)throw new Error("only one byte as prefix supported");if(b=y.prefix.charCodeAt(0),b&&60>b||b>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(y.intermediates){if(y.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let w=0;wT||T>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");b<<=8,b|=T}}if(y.final.length!==1)throw new Error("final must be a single byte");const k=y.final.charCodeAt(0);if(_[0]>k||k>_[1])throw new Error(`final must be in range ${_[0]} .. ${_[1]}`);return b<<=8,b|=k,b}identToString(y){const _=[];for(;y;)_.push(String.fromCharCode(255&y)),y>>=8;return _.reverse().join("")}setPrintHandler(y){this._printHandler=y}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(y,_){const b=this._identifier(y,[48,126]);this._escHandlers[b]===void 0&&(this._escHandlers[b]=[]);const k=this._escHandlers[b];return k.push(_),{dispose:()=>{const w=k.indexOf(_);w!==-1&&k.splice(w,1)}}}clearEscHandler(y){this._escHandlers[this._identifier(y,[48,126])]&&delete this._escHandlers[this._identifier(y,[48,126])]}setEscHandlerFallback(y){this._escHandlerFb=y}setExecuteHandler(y,_){this._executeHandlers[y.charCodeAt(0)]=_}clearExecuteHandler(y){this._executeHandlers[y.charCodeAt(0)]&&delete this._executeHandlers[y.charCodeAt(0)]}setExecuteHandlerFallback(y){this._executeHandlerFb=y}registerCsiHandler(y,_){const b=this._identifier(y);this._csiHandlers[b]===void 0&&(this._csiHandlers[b]=[]);const k=this._csiHandlers[b];return k.push(_),{dispose:()=>{const w=k.indexOf(_);w!==-1&&k.splice(w,1)}}}clearCsiHandler(y){this._csiHandlers[this._identifier(y)]&&delete this._csiHandlers[this._identifier(y)]}setCsiHandlerFallback(y){this._csiHandlerFb=y}registerDcsHandler(y,_){return this._dcsParser.registerHandler(this._identifier(y),_)}clearDcsHandler(y){this._dcsParser.clearHandler(this._identifier(y))}setDcsHandlerFallback(y){this._dcsParser.setHandlerFallback(y)}registerOscHandler(y,_){return this._oscParser.registerHandler(y,_)}clearOscHandler(y){this._oscParser.clearHandler(y)}setOscHandlerFallback(y){this._oscParser.setHandlerFallback(y)}setErrorHandler(y){this._errorHandler=y}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(y,_,b,k,w){this._parseStack.state=y,this._parseStack.handlers=_,this._parseStack.handlerPos=b,this._parseStack.transition=k,this._parseStack.chunkPos=w}parse(y,_,b){let k,w=0,T=0,A=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,A=this._parseStack.chunkPos+1;else{if(b===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const C=this._parseStack.handlers;let E=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(b===!1&&E>-1){for(;E>=0&&(k=C[E](this._params),k!==!0);E--)if(k instanceof Promise)return this._parseStack.handlerPos=E,k}this._parseStack.handlers=[];break;case 4:if(b===!1&&E>-1){for(;E>=0&&(k=C[E](),k!==!0);E--)if(k instanceof Promise)return this._parseStack.handlerPos=E,k}this._parseStack.handlers=[];break;case 6:if(w=y[this._parseStack.chunkPos],k=this._dcsParser.unhook(w!==24&&w!==26,b),k)return k;w===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(w=y[this._parseStack.chunkPos],k=this._oscParser.end(w!==24&&w!==26,b),k)return k;w===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,A=this._parseStack.chunkPos+1,this.precedingCodepoint=0,this.currentState=15&this._parseStack.transition}for(let C=A;C<_;++C){switch(w=y[C],T=this._transitions.table[this.currentState<<8|(w<160?w:g)],T>>4){case 2:for(let O=C+1;;++O){if(O>=_||(w=y[O])<32||w>126&&w=_||(w=y[O])<32||w>126&&w=_||(w=y[O])<32||w>126&&w=_||(w=y[O])<32||w>126&&w=0&&(k=E[x](this._params),k!==!0);x--)if(k instanceof Promise)return this._preserveStack(3,E,x,T,C),k;x<0&&this._csiHandlerFb(this._collect<<8|w,this._params),this.precedingCodepoint=0;break;case 8:do switch(w){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(w-48)}while(++C<_&&(w=y[C])>47&&w<60);C--;break;case 9:this._collect<<=8,this._collect|=w;break;case 10:const D=this._escHandlers[this._collect<<8|w];let N=D?D.length-1:-1;for(;N>=0&&(k=D[N](),k!==!0);N--)if(k instanceof Promise)return this._preserveStack(4,D,N,T,C),k;N<0&&this._escHandlerFb(this._collect<<8|w),this.precedingCodepoint=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|w,this._params);break;case 13:for(let O=C+1;;++O)if(O>=_||(w=y[O])===24||w===26||w===27||w>127&&w=_||(w=y[O])<32||w>127&&w{Object.defineProperty(a,"__esModule",{value:!0}),a.OscHandler=a.OscParser=void 0;const l=c(5770),u=c(482),d=[];a.OscParser=class{constructor(){this._state=0,this._active=d,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(h,p){this._handlers[h]===void 0&&(this._handlers[h]=[]);const g=this._handlers[h];return g.push(p),{dispose:()=>{const v=g.indexOf(p);v!==-1&&g.splice(v,1)}}}clearHandler(h){this._handlers[h]&&delete this._handlers[h]}setHandlerFallback(h){this._handlerFb=h}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=d}reset(){if(this._state===2)for(let h=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;h>=0;--h)this._active[h].end(!1);this._stack.paused=!1,this._active=d,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||d,this._active.length)for(let h=this._active.length-1;h>=0;h--)this._active[h].start();else this._handlerFb(this._id,"START")}_put(h,p,g){if(this._active.length)for(let v=this._active.length-1;v>=0;v--)this._active[v].put(h,p,g);else this._handlerFb(this._id,"PUT",(0,u.utf32ToString)(h,p,g))}start(){this.reset(),this._state=1}put(h,p,g){if(this._state!==3){if(this._state===1)for(;p0&&this._put(h,p,g)}}end(h,p=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let g=!1,v=this._active.length-1,m=!1;if(this._stack.paused&&(v=this._stack.loopPosition-1,g=p,m=this._stack.fallThrough,this._stack.paused=!1),!m&&g===!1){for(;v>=0&&(g=this._active[v].end(h),g!==!0);v--)if(g instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=v,this._stack.fallThrough=!1,g;v--}for(;v>=0;v--)if(g=this._active[v].end(!1),g instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=v,this._stack.fallThrough=!0,g}else this._handlerFb(this._id,"END",h);this._active=d,this._id=-1,this._state=0}}},a.OscHandler=class{constructor(h){this._handler=h,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(h,p,g){this._hitLimit||(this._data+=(0,u.utf32ToString)(h,p,g),this._data.length>l.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(h){let p=!1;if(this._hitLimit)p=!1;else if(h&&(p=this._handler(this._data),p instanceof Promise))return p.then(g=>(this._data="",this._hitLimit=!1,g));return this._data="",this._hitLimit=!1,p}}},8742:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.Params=void 0;const c=2147483647;class l{static fromArray(d){const h=new l;if(!d.length)return h;for(let p=Array.isArray(d[0])?1:0;p256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(d),this.length=0,this._subParams=new Int32Array(h),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(d),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const d=new l(this.maxLength,this.maxSubParamsLength);return d.params.set(this.params),d.length=this.length,d._subParams.set(this._subParams),d._subParamsLength=this._subParamsLength,d._subParamsIdx.set(this._subParamsIdx),d._rejectDigits=this._rejectDigits,d._rejectSubDigits=this._rejectSubDigits,d._digitIsSub=this._digitIsSub,d}toArray(){const d=[];for(let h=0;h>8,g=255&this._subParamsIdx[h];g-p>0&&d.push(Array.prototype.slice.call(this._subParams,p,g))}return d}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(d){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(d<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=d>c?c:d}}addSubParam(d){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(d<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=d>c?c:d,this._subParamsIdx[this.length-1]++}}hasSubParams(d){return(255&this._subParamsIdx[d])-(this._subParamsIdx[d]>>8)>0}getSubParams(d){const h=this._subParamsIdx[d]>>8,p=255&this._subParamsIdx[d];return p-h>0?this._subParams.subarray(h,p):null}getSubParamsAll(){const d={};for(let h=0;h>8,g=255&this._subParamsIdx[h];g-p>0&&(d[h]=this._subParams.slice(p,g))}return d}addDigit(d){let h;if(this._rejectDigits||!(h=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const p=this._digitIsSub?this._subParams:this.params,g=p[h-1];p[h-1]=~g?Math.min(10*g+d,c):d}}a.Params=l},5741:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.AddonManager=void 0,a.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let c=this._addons.length-1;c>=0;c--)this._addons[c].instance.dispose()}loadAddon(c,l){const u={instance:l,dispose:l.dispose,isDisposed:!1};this._addons.push(u),l.dispose=()=>this._wrappedAddonDispose(u),l.activate(c)}_wrappedAddonDispose(c){if(c.isDisposed)return;let l=-1;for(let u=0;u{Object.defineProperty(a,"__esModule",{value:!0}),a.BufferApiView=void 0;const l=c(3785),u=c(511);a.BufferApiView=class{constructor(d,h){this._buffer=d,this.type=h}init(d){return this._buffer=d,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(d){const h=this._buffer.lines.get(d);if(h)return new l.BufferLineApiView(h)}getNullCell(){return new u.CellData}}},3785:(o,a,c)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.BufferLineApiView=void 0;const l=c(511);a.BufferLineApiView=class{constructor(u){this._line=u}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(u,d){if(!(u<0||u>=this._line.length))return d?(this._line.loadCell(u,d),d):this._line.loadCell(u,new l.CellData)}translateToString(u,d,h){return this._line.translateToString(u,d,h)}}},8285:(o,a,c)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.BufferNamespaceApi=void 0;const l=c(8771),u=c(8460),d=c(844);class h extends d.Disposable{constructor(g){super(),this._core=g,this._onBufferChange=this.register(new u.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new l.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new l.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}a.BufferNamespaceApi=h},7975:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.ParserApi=void 0,a.ParserApi=class{constructor(c){this._core=c}registerCsiHandler(c,l){return this._core.registerCsiHandler(c,u=>l(u.toArray()))}addCsiHandler(c,l){return this.registerCsiHandler(c,l)}registerDcsHandler(c,l){return this._core.registerDcsHandler(c,(u,d)=>l(u,d.toArray()))}addDcsHandler(c,l){return this.registerDcsHandler(c,l)}registerEscHandler(c,l){return this._core.registerEscHandler(c,l)}addEscHandler(c,l){return this.registerEscHandler(c,l)}registerOscHandler(c,l){return this._core.registerOscHandler(c,l)}addOscHandler(c,l){return this.registerOscHandler(c,l)}}},7090:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.UnicodeApi=void 0,a.UnicodeApi=class{constructor(c){this._core=c}register(c){this._core.unicodeService.register(c)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(c){this._core.unicodeService.activeVersion=c}}},744:function(o,a,c){var l=this&&this.__decorate||function(m,y,_,b){var k,w=arguments.length,T=w<3?y:b===null?b=Object.getOwnPropertyDescriptor(y,_):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(m,y,_,b);else for(var A=m.length-1;A>=0;A--)(k=m[A])&&(T=(w<3?k(T):w>3?k(y,_,T):k(y,_))||T);return w>3&&T&&Object.defineProperty(y,_,T),T},u=this&&this.__param||function(m,y){return function(_,b){y(_,b,m)}};Object.defineProperty(a,"__esModule",{value:!0}),a.BufferService=a.MINIMUM_ROWS=a.MINIMUM_COLS=void 0;const d=c(8460),h=c(844),p=c(5295),g=c(2585);a.MINIMUM_COLS=2,a.MINIMUM_ROWS=1;let v=a.BufferService=class extends h.Disposable{get buffer(){return this.buffers.active}constructor(m){super(),this.isUserScrolling=!1,this._onResize=this.register(new d.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new d.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(m.rawOptions.cols||0,a.MINIMUM_COLS),this.rows=Math.max(m.rawOptions.rows||0,a.MINIMUM_ROWS),this.buffers=this.register(new p.BufferSet(m,this))}resize(m,y){this.cols=m,this.rows=y,this.buffers.resize(m,y),this._onResize.fire({cols:m,rows:y})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(m,y=!1){const _=this.buffer;let b;b=this._cachedBlankLine,b&&b.length===this.cols&&b.getFg(0)===m.fg&&b.getBg(0)===m.bg||(b=_.getBlankLine(m,y),this._cachedBlankLine=b),b.isWrapped=y;const k=_.ybase+_.scrollTop,w=_.ybase+_.scrollBottom;if(_.scrollTop===0){const T=_.lines.isFull;w===_.lines.length-1?T?_.lines.recycle().copyFrom(b):_.lines.push(b.clone()):_.lines.splice(w+1,0,b.clone()),T?this.isUserScrolling&&(_.ydisp=Math.max(_.ydisp-1,0)):(_.ybase++,this.isUserScrolling||_.ydisp++)}else{const T=w-k+1;_.lines.shiftElements(k+1,T-1,-1),_.lines.set(w,b.clone())}this.isUserScrolling||(_.ydisp=_.ybase),this._onScroll.fire(_.ydisp)}scrollLines(m,y,_){const b=this.buffer;if(m<0){if(b.ydisp===0)return;this.isUserScrolling=!0}else m+b.ydisp>=b.ybase&&(this.isUserScrolling=!1);const k=b.ydisp;b.ydisp=Math.max(Math.min(b.ydisp+m,b.ybase),0),k!==b.ydisp&&(y||this._onScroll.fire(b.ydisp))}};a.BufferService=v=l([u(0,g.IOptionsService)],v)},7994:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.CharsetService=void 0,a.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(c){this.glevel=c,this.charset=this._charsets[c]}setgCharset(c,l){this._charsets[c]=l,this.glevel===c&&(this.charset=l)}}},1753:function(o,a,c){var l=this&&this.__decorate||function(b,k,w,T){var A,C=arguments.length,E=C<3?k:T===null?T=Object.getOwnPropertyDescriptor(k,w):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(b,k,w,T);else for(var x=b.length-1;x>=0;x--)(A=b[x])&&(E=(C<3?A(E):C>3?A(k,w,E):A(k,w))||E);return C>3&&E&&Object.defineProperty(k,w,E),E},u=this&&this.__param||function(b,k){return function(w,T){k(w,T,b)}};Object.defineProperty(a,"__esModule",{value:!0}),a.CoreMouseService=void 0;const d=c(2585),h=c(8460),p=c(844),g={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:b=>b.button!==4&&b.action===1&&(b.ctrl=!1,b.alt=!1,b.shift=!1,!0)},VT200:{events:19,restrict:b=>b.action!==32},DRAG:{events:23,restrict:b=>b.action!==32||b.button!==3},ANY:{events:31,restrict:b=>!0}};function v(b,k){let w=(b.ctrl?16:0)|(b.shift?4:0)|(b.alt?8:0);return b.button===4?(w|=64,w|=b.action):(w|=3&b.button,4&b.button&&(w|=64),8&b.button&&(w|=128),b.action===32?w|=32:b.action!==0||k||(w|=3)),w}const m=String.fromCharCode,y={DEFAULT:b=>{const k=[v(b,!1)+32,b.col+32,b.row+32];return k[0]>255||k[1]>255||k[2]>255?"":`\x1B[M${m(k[0])}${m(k[1])}${m(k[2])}`},SGR:b=>{const k=b.action===0&&b.button!==4?"m":"M";return`\x1B[<${v(b,!0)};${b.col};${b.row}${k}`},SGR_PIXELS:b=>{const k=b.action===0&&b.button!==4?"m":"M";return`\x1B[<${v(b,!0)};${b.x};${b.y}${k}`}};let _=a.CoreMouseService=class extends p.Disposable{constructor(b,k){super(),this._bufferService=b,this._coreService=k,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new h.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const w of Object.keys(g))this.addProtocol(w,g[w]);for(const w of Object.keys(y))this.addEncoding(w,y[w]);this.reset()}addProtocol(b,k){this._protocols[b]=k}addEncoding(b,k){this._encodings[b]=k}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(b){if(!this._protocols[b])throw new Error(`unknown protocol "${b}"`);this._activeProtocol=b,this._onProtocolChange.fire(this._protocols[b].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(b){if(!this._encodings[b])throw new Error(`unknown encoding "${b}"`);this._activeEncoding=b}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(b){if(b.col<0||b.col>=this._bufferService.cols||b.row<0||b.row>=this._bufferService.rows||b.button===4&&b.action===32||b.button===3&&b.action!==32||b.button!==4&&(b.action===2||b.action===3)||(b.col++,b.row++,b.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,b,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(b))return!1;const k=this._encodings[this._activeEncoding](b);return k&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(k):this._coreService.triggerDataEvent(k,!0)),this._lastEvent=b,!0}explainEvents(b){return{down:!!(1&b),up:!!(2&b),drag:!!(4&b),move:!!(8&b),wheel:!!(16&b)}}_equalEvents(b,k,w){if(w){if(b.x!==k.x||b.y!==k.y)return!1}else if(b.col!==k.col||b.row!==k.row)return!1;return b.button===k.button&&b.action===k.action&&b.ctrl===k.ctrl&&b.alt===k.alt&&b.shift===k.shift}};a.CoreMouseService=_=l([u(0,d.IBufferService),u(1,d.ICoreService)],_)},6975:function(o,a,c){var l=this&&this.__decorate||function(_,b,k,w){var T,A=arguments.length,C=A<3?b:w===null?w=Object.getOwnPropertyDescriptor(b,k):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(_,b,k,w);else for(var E=_.length-1;E>=0;E--)(T=_[E])&&(C=(A<3?T(C):A>3?T(b,k,C):T(b,k))||C);return A>3&&C&&Object.defineProperty(b,k,C),C},u=this&&this.__param||function(_,b){return function(k,w){b(k,w,_)}};Object.defineProperty(a,"__esModule",{value:!0}),a.CoreService=void 0;const d=c(1439),h=c(8460),p=c(844),g=c(2585),v=Object.freeze({insertMode:!1}),m=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let y=a.CoreService=class extends p.Disposable{constructor(_,b,k){super(),this._bufferService=_,this._logService=b,this._optionsService=k,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new h.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new h.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new h.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new h.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,d.clone)(v),this.decPrivateModes=(0,d.clone)(m)}reset(){this.modes=(0,d.clone)(v),this.decPrivateModes=(0,d.clone)(m)}triggerDataEvent(_,b=!1){if(this._optionsService.rawOptions.disableStdin)return;const k=this._bufferService.buffer;b&&this._optionsService.rawOptions.scrollOnUserInput&&k.ybase!==k.ydisp&&this._onRequestScrollToBottom.fire(),b&&this._onUserInput.fire(),this._logService.debug(`sending data "${_}"`,()=>_.split("").map(w=>w.charCodeAt(0))),this._onData.fire(_)}triggerBinaryEvent(_){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${_}"`,()=>_.split("").map(b=>b.charCodeAt(0))),this._onBinary.fire(_))}};a.CoreService=y=l([u(0,g.IBufferService),u(1,g.ILogService),u(2,g.IOptionsService)],y)},9074:(o,a,c)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.DecorationService=void 0;const l=c(8055),u=c(8460),d=c(844),h=c(6106);let p=0,g=0;class v extends d.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new h.SortedList(_=>_==null?void 0:_.marker.line),this._onDecorationRegistered=this.register(new u.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new u.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,d.toDisposable)(()=>this.reset()))}registerDecoration(_){if(_.marker.isDisposed)return;const b=new m(_);if(b){const k=b.marker.onDispose(()=>b.dispose());b.onDispose(()=>{b&&(this._decorations.delete(b)&&this._onDecorationRemoved.fire(b),k.dispose())}),this._decorations.insert(b),this._onDecorationRegistered.fire(b)}return b}reset(){for(const _ of this._decorations.values())_.dispose();this._decorations.clear()}*getDecorationsAtCell(_,b,k){var w,T,A;let C=0,E=0;for(const x of this._decorations.getKeyIterator(b))C=(w=x.options.x)!==null&&w!==void 0?w:0,E=C+((T=x.options.width)!==null&&T!==void 0?T:1),_>=C&&_{var A,C,E;p=(A=T.options.x)!==null&&A!==void 0?A:0,g=p+((C=T.options.width)!==null&&C!==void 0?C:1),_>=p&&_{Object.defineProperty(a,"__esModule",{value:!0}),a.InstantiationService=a.ServiceCollection=void 0;const l=c(2585),u=c(8343);class d{constructor(...p){this._entries=new Map;for(const[g,v]of p)this.set(g,v)}set(p,g){const v=this._entries.get(p);return this._entries.set(p,g),v}forEach(p){for(const[g,v]of this._entries.entries())p(g,v)}has(p){return this._entries.has(p)}get(p){return this._entries.get(p)}}a.ServiceCollection=d,a.InstantiationService=class{constructor(){this._services=new d,this._services.set(l.IInstantiationService,this)}setService(h,p){this._services.set(h,p)}getService(h){return this._services.get(h)}createInstance(h,...p){const g=(0,u.getServiceDependencies)(h).sort((y,_)=>y.index-_.index),v=[];for(const y of g){const _=this._services.get(y.id);if(!_)throw new Error(`[createInstance] ${h.name} depends on UNKNOWN service ${y.id}.`);v.push(_)}const m=g.length>0?g[0].index:p.length;if(p.length!==m)throw new Error(`[createInstance] First service dependency of ${h.name} at position ${m+1} conflicts with ${p.length} static arguments`);return new h(...p,...v)}}},7866:function(o,a,c){var l=this&&this.__decorate||function(m,y,_,b){var k,w=arguments.length,T=w<3?y:b===null?b=Object.getOwnPropertyDescriptor(y,_):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(m,y,_,b);else for(var A=m.length-1;A>=0;A--)(k=m[A])&&(T=(w<3?k(T):w>3?k(y,_,T):k(y,_))||T);return w>3&&T&&Object.defineProperty(y,_,T),T},u=this&&this.__param||function(m,y){return function(_,b){y(_,b,m)}};Object.defineProperty(a,"__esModule",{value:!0}),a.traceCall=a.setTraceLogger=a.LogService=void 0;const d=c(844),h=c(2585),p={trace:h.LogLevelEnum.TRACE,debug:h.LogLevelEnum.DEBUG,info:h.LogLevelEnum.INFO,warn:h.LogLevelEnum.WARN,error:h.LogLevelEnum.ERROR,off:h.LogLevelEnum.OFF};let g,v=a.LogService=class extends d.Disposable{get logLevel(){return this._logLevel}constructor(m){super(),this._optionsService=m,this._logLevel=h.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),g=this}_updateLogLevel(){this._logLevel=p[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(m){for(let y=0;yJSON.stringify(T)).join(", ")})`);const w=b.apply(this,k);return g.trace(`GlyphRenderer#${b.name} return`,w),w}}},7302:(o,a,c)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.OptionsService=a.DEFAULT_OPTIONS=void 0;const l=c(8460),u=c(844),d=c(6114);a.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rightClickSelectsWord:d.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const h=["normal","bold","100","200","300","400","500","600","700","800","900"];class p extends u.Disposable{constructor(v){super(),this._onOptionChange=this.register(new l.EventEmitter),this.onOptionChange=this._onOptionChange.event;const m=Object.assign({},a.DEFAULT_OPTIONS);for(const y in v)if(y in m)try{const _=v[y];m[y]=this._sanitizeAndValidateOption(y,_)}catch(_){console.error(_)}this.rawOptions=m,this.options=Object.assign({},m),this._setupOptions()}onSpecificOptionChange(v,m){return this.onOptionChange(y=>{y===v&&m(this.rawOptions[v])})}onMultipleOptionChange(v,m){return this.onOptionChange(y=>{v.indexOf(y)!==-1&&m()})}_setupOptions(){const v=y=>{if(!(y in a.DEFAULT_OPTIONS))throw new Error(`No option with key "${y}"`);return this.rawOptions[y]},m=(y,_)=>{if(!(y in a.DEFAULT_OPTIONS))throw new Error(`No option with key "${y}"`);_=this._sanitizeAndValidateOption(y,_),this.rawOptions[y]!==_&&(this.rawOptions[y]=_,this._onOptionChange.fire(y))};for(const y in this.rawOptions){const _={get:v.bind(this,y),set:m.bind(this,y)};Object.defineProperty(this.options,y,_)}}_sanitizeAndValidateOption(v,m){switch(v){case"cursorStyle":if(m||(m=a.DEFAULT_OPTIONS[v]),!function(y){return y==="block"||y==="underline"||y==="bar"}(m))throw new Error(`"${m}" is not a valid value for ${v}`);break;case"wordSeparator":m||(m=a.DEFAULT_OPTIONS[v]);break;case"fontWeight":case"fontWeightBold":if(typeof m=="number"&&1<=m&&m<=1e3)break;m=h.includes(m)?m:a.DEFAULT_OPTIONS[v];break;case"cursorWidth":m=Math.floor(m);case"lineHeight":case"tabStopWidth":if(m<1)throw new Error(`${v} cannot be less than 1, value: ${m}`);break;case"minimumContrastRatio":m=Math.max(1,Math.min(21,Math.round(10*m)/10));break;case"scrollback":if((m=Math.min(m,4294967295))<0)throw new Error(`${v} cannot be less than 0, value: ${m}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(m<=0)throw new Error(`${v} cannot be less than or equal to 0, value: ${m}`);break;case"rows":case"cols":if(!m&&m!==0)throw new Error(`${v} must be numeric, value: ${m}`);break;case"windowsPty":m=m??{}}return m}}a.OptionsService=p},2660:function(o,a,c){var l=this&&this.__decorate||function(p,g,v,m){var y,_=arguments.length,b=_<3?g:m===null?m=Object.getOwnPropertyDescriptor(g,v):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(p,g,v,m);else for(var k=p.length-1;k>=0;k--)(y=p[k])&&(b=(_<3?y(b):_>3?y(g,v,b):y(g,v))||b);return _>3&&b&&Object.defineProperty(g,v,b),b},u=this&&this.__param||function(p,g){return function(v,m){g(v,m,p)}};Object.defineProperty(a,"__esModule",{value:!0}),a.OscLinkService=void 0;const d=c(2585);let h=a.OscLinkService=class{constructor(p){this._bufferService=p,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(p){const g=this._bufferService.buffer;if(p.id===void 0){const k=g.addMarker(g.ybase+g.y),w={data:p,id:this._nextId++,lines:[k]};return k.onDispose(()=>this._removeMarkerFromLink(w,k)),this._dataByLinkId.set(w.id,w),w.id}const v=p,m=this._getEntryIdKey(v),y=this._entriesWithId.get(m);if(y)return this.addLineToLink(y.id,g.ybase+g.y),y.id;const _=g.addMarker(g.ybase+g.y),b={id:this._nextId++,key:this._getEntryIdKey(v),data:v,lines:[_]};return _.onDispose(()=>this._removeMarkerFromLink(b,_)),this._entriesWithId.set(b.key,b),this._dataByLinkId.set(b.id,b),b.id}addLineToLink(p,g){const v=this._dataByLinkId.get(p);if(v&&v.lines.every(m=>m.line!==g)){const m=this._bufferService.buffer.addMarker(g);v.lines.push(m),m.onDispose(()=>this._removeMarkerFromLink(v,m))}}getLinkData(p){var g;return(g=this._dataByLinkId.get(p))===null||g===void 0?void 0:g.data}_getEntryIdKey(p){return`${p.id};;${p.uri}`}_removeMarkerFromLink(p,g){const v=p.lines.indexOf(g);v!==-1&&(p.lines.splice(v,1),p.lines.length===0&&(p.data.id!==void 0&&this._entriesWithId.delete(p.key),this._dataByLinkId.delete(p.id)))}};a.OscLinkService=h=l([u(0,d.IBufferService)],h)},8343:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.createDecorator=a.getServiceDependencies=a.serviceRegistry=void 0;const c="di$target",l="di$dependencies";a.serviceRegistry=new Map,a.getServiceDependencies=function(u){return u[l]||[]},a.createDecorator=function(u){if(a.serviceRegistry.has(u))return a.serviceRegistry.get(u);const d=function(h,p,g){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(v,m,y){m[c]===m?m[l].push({id:v,index:y}):(m[l]=[{id:v,index:y}],m[c]=m)})(d,h,g)};return d.toString=()=>u,a.serviceRegistry.set(u,d),d}},2585:(o,a,c)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.IDecorationService=a.IUnicodeService=a.IOscLinkService=a.IOptionsService=a.ILogService=a.LogLevelEnum=a.IInstantiationService=a.ICharsetService=a.ICoreService=a.ICoreMouseService=a.IBufferService=void 0;const l=c(8343);var u;a.IBufferService=(0,l.createDecorator)("BufferService"),a.ICoreMouseService=(0,l.createDecorator)("CoreMouseService"),a.ICoreService=(0,l.createDecorator)("CoreService"),a.ICharsetService=(0,l.createDecorator)("CharsetService"),a.IInstantiationService=(0,l.createDecorator)("InstantiationService"),function(d){d[d.TRACE=0]="TRACE",d[d.DEBUG=1]="DEBUG",d[d.INFO=2]="INFO",d[d.WARN=3]="WARN",d[d.ERROR=4]="ERROR",d[d.OFF=5]="OFF"}(u||(a.LogLevelEnum=u={})),a.ILogService=(0,l.createDecorator)("LogService"),a.IOptionsService=(0,l.createDecorator)("OptionsService"),a.IOscLinkService=(0,l.createDecorator)("OscLinkService"),a.IUnicodeService=(0,l.createDecorator)("UnicodeService"),a.IDecorationService=(0,l.createDecorator)("DecorationService")},1480:(o,a,c)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.UnicodeService=void 0;const l=c(8460),u=c(225);a.UnicodeService=class{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new l.EventEmitter,this.onChange=this._onChange.event;const d=new u.UnicodeV6;this.register(d),this._active=d.version,this._activeProvider=d}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(d){if(!this._providers[d])throw new Error(`unknown Unicode version "${d}"`);this._active=d,this._activeProvider=this._providers[d],this._onChange.fire(d)}register(d){this._providers[d.version]=d}wcwidth(d){return this._activeProvider.wcwidth(d)}getStringCellWidth(d){let h=0;const p=d.length;for(let g=0;g=p)return h+this.wcwidth(v);const m=d.charCodeAt(g);56320<=m&&m<=57343?v=1024*(v-55296)+m-56320+65536:h+=this.wcwidth(m)}h+=this.wcwidth(v)}return h}}}},n={};function i(o){var a=n[o];if(a!==void 0)return a.exports;var c=n[o]={exports:{}};return t[o].call(c.exports,c,c.exports,i),c.exports}var r={};return(()=>{var o=r;Object.defineProperty(o,"__esModule",{value:!0}),o.Terminal=void 0;const a=i(9042),c=i(3236),l=i(844),u=i(5741),d=i(8285),h=i(7975),p=i(7090),g=["cols","rows"];class v extends l.Disposable{constructor(y){super(),this._core=this.register(new c.Terminal(y)),this._addonManager=this.register(new u.AddonManager),this._publicOptions=Object.assign({},this._core.options);const _=k=>this._core.options[k],b=(k,w)=>{this._checkReadonlyOptions(k),this._core.options[k]=w};for(const k in this._core.options){const w={get:_.bind(this,k),set:b.bind(this,k)};Object.defineProperty(this._publicOptions,k,w)}}_checkReadonlyOptions(y){if(g.includes(y))throw new Error(`Option "${y}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new h.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new p.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new d.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const y=this._core.coreService.decPrivateModes;let _="none";switch(this._core.coreMouseService.activeProtocol){case"X10":_="x10";break;case"VT200":_="vt200";break;case"DRAG":_="drag";break;case"ANY":_="any"}return{applicationCursorKeysMode:y.applicationCursorKeys,applicationKeypadMode:y.applicationKeypad,bracketedPasteMode:y.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:_,originMode:y.origin,reverseWraparoundMode:y.reverseWraparound,sendFocusMode:y.sendFocus,wraparoundMode:y.wraparound}}get options(){return this._publicOptions}set options(y){for(const _ in y)this._publicOptions[_]=y[_]}blur(){this._core.blur()}focus(){this._core.focus()}resize(y,_){this._verifyIntegers(y,_),this._core.resize(y,_)}open(y){this._core.open(y)}attachCustomKeyEventHandler(y){this._core.attachCustomKeyEventHandler(y)}registerLinkProvider(y){return this._core.registerLinkProvider(y)}registerCharacterJoiner(y){return this._checkProposedApi(),this._core.registerCharacterJoiner(y)}deregisterCharacterJoiner(y){this._checkProposedApi(),this._core.deregisterCharacterJoiner(y)}registerMarker(y=0){return this._verifyIntegers(y),this._core.registerMarker(y)}registerDecoration(y){var _,b,k;return this._checkProposedApi(),this._verifyPositiveIntegers((_=y.x)!==null&&_!==void 0?_:0,(b=y.width)!==null&&b!==void 0?b:0,(k=y.height)!==null&&k!==void 0?k:0),this._core.registerDecoration(y)}hasSelection(){return this._core.hasSelection()}select(y,_,b){this._verifyIntegers(y,_,b),this._core.select(y,_,b)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(y,_){this._verifyIntegers(y,_),this._core.selectLines(y,_)}dispose(){super.dispose()}scrollLines(y){this._verifyIntegers(y),this._core.scrollLines(y)}scrollPages(y){this._verifyIntegers(y),this._core.scrollPages(y)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(y){this._verifyIntegers(y),this._core.scrollToLine(y)}clear(){this._core.clear()}write(y,_){this._core.write(y,_)}writeln(y,_){this._core.write(y),this._core.write(`\r `,_)}paste(y){this._core.paste(y)}refresh(y,_){this._verifyIntegers(y,_),this._core.refresh(y,_)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(y){this._addonManager.loadAddon(this,y)}static get strings(){return a}_verifyIntegers(...y){for(const _ of y)if(_===1/0||isNaN(_)||_%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...y){for(const _ of y)if(_&&(_===1/0||isNaN(_)||_%1!=0||_<0))throw new Error("This API only accepts positive integers")}}o.Terminal=v})(),r})())})(EL);var vj=EL.exports;const cl=Object.create(null);cl.open="0";cl.close="1";cl.ping="2";cl.pong="3";cl.message="4";cl.upgrade="5";cl.noop="6";const Sw=Object.create(null);Object.keys(cl).forEach(s=>{Sw[cl[s]]=s});const HT={type:"error",data:"parser error"},xL=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",RL=typeof ArrayBuffer=="function",IL=s=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(s):s&&s.buffer instanceof ArrayBuffer,IE=({type:s,data:e},t,n)=>xL&&e instanceof Blob?t?n(e):kx(e,n):RL&&(e instanceof ArrayBuffer||IL(e))?t?n(e):kx(new Blob([e]),n):n(cl[s]+(e||"")),kx=(s,e)=>{const t=new FileReader;return t.onload=function(){const n=t.result.split(",")[1];e("b"+(n||""))},t.readAsDataURL(s)};function Cx(s){return s instanceof Uint8Array?s:s instanceof ArrayBuffer?new Uint8Array(s):new Uint8Array(s.buffer,s.byteOffset,s.byteLength)}let yC;function yj(s,e){if(xL&&s.data instanceof Blob)return s.data.arrayBuffer().then(Cx).then(e);if(RL&&(s.data instanceof ArrayBuffer||IL(s.data)))return e(Cx(s.data));IE(s,!1,t=>{yC||(yC=new TextEncoder),e(yC.encode(t))})}const Tx="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",jg=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let s=0;s{let e=s.length*.75,t=s.length,n,i=0,r,o,a,c;s[s.length-1]==="="&&(e--,s[s.length-2]==="="&&e--);const l=new ArrayBuffer(e),u=new Uint8Array(l);for(n=0;n>4,u[i++]=(o&15)<<4|a>>2,u[i++]=(a&3)<<6|c&63;return l},_j=typeof ArrayBuffer=="function",PE=(s,e)=>{if(typeof s!="string")return{type:"message",data:PL(s,e)};const t=s.charAt(0);return t==="b"?{type:"message",data:wj(s.substring(1),e)}:Sw[t]?s.length>1?{type:Sw[t],data:s.substring(1)}:{type:Sw[t]}:HT},wj=(s,e)=>{if(_j){const t=bj(s);return PL(t,e)}else return{base64:!0,data:s}},PL=(s,e)=>{switch(e){case"blob":return s instanceof Blob?s:new Blob([s]);case"arraybuffer":default:return s instanceof ArrayBuffer?s:s.buffer}},LL="",Sj=(s,e)=>{const t=s.length,n=new Array(t);let i=0;s.forEach((r,o)=>{IE(r,!1,a=>{n[o]=a,++i===t&&e(n.join(LL))})})},kj=(s,e)=>{const t=s.split(LL),n=[];for(let i=0;i{const n=t.length;let i;if(n<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,n);else if(n<65536){i=new Uint8Array(3);const r=new DataView(i.buffer);r.setUint8(0,126),r.setUint16(1,n)}else{i=new Uint8Array(9);const r=new DataView(i.buffer);r.setUint8(0,127),r.setBigUint64(1,BigInt(n))}s.data&&typeof s.data!="string"&&(i[0]|=128),e.enqueue(i),e.enqueue(t)})}})}let bC;function H_(s){return s.reduce((e,t)=>e+t.length,0)}function U_(s,e){if(s[0].length===e)return s.shift();const t=new Uint8Array(e);let n=0;for(let i=0;iMath.pow(2,21)-1){a.enqueue(HT);break}i=u*Math.pow(2,32)+l.getUint32(4),n=3}else{if(H_(t)s){a.enqueue(HT);break}}}})}const OL=4;function An(s){if(s)return Aj(s)}function Aj(s){for(var e in An.prototype)s[e]=An.prototype[e];return s}An.prototype.on=An.prototype.addEventListener=function(s,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+s]=this._callbacks["$"+s]||[]).push(e),this};An.prototype.once=function(s,e){function t(){this.off(s,t),e.apply(this,arguments)}return t.fn=e,this.on(s,t),this};An.prototype.off=An.prototype.removeListener=An.prototype.removeAllListeners=An.prototype.removeEventListener=function(s,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+s];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+s],this;for(var n,i=0;iPromise.resolve().then(e):(e,t)=>t(e,0),No=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Ej="arraybuffer";function DL(s,...e){return e.reduce((t,n)=>(s.hasOwnProperty(n)&&(t[n]=s[n]),t),{})}const Mj=No.setTimeout,xj=No.clearTimeout;function uk(s,e){e.useNativeTimers?(s.setTimeoutFn=Mj.bind(No),s.clearTimeoutFn=xj.bind(No)):(s.setTimeoutFn=No.setTimeout.bind(No),s.clearTimeoutFn=No.clearTimeout.bind(No))}const Rj=1.33;function Ij(s){return typeof s=="string"?Pj(s):Math.ceil((s.byteLength||s.size)*Rj)}function Pj(s){let e=0,t=0;for(let n=0,i=s.length;n=57344?t+=3:(n++,t+=4);return t}function NL(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Lj(s){let e="";for(let t in s)s.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(s[t]));return e}function Oj(s){let e={},t=s.split("&");for(let n=0,i=t.length;n{this.readyState="paused",e()};if(this._polling||!this.writable){let n=0;this._polling&&(n++,this.once("pollComplete",function(){--n||t()})),this.writable||(n++,this.once("drain",function(){--n||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const t=n=>{if(this.readyState==="opening"&&n.type==="open"&&this.onOpen(),n.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(n)};kj(e,this.socket.binaryType).forEach(t),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,Sj(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=NL()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}}let $L=!1;try{$L=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const $j=$L;function Bj(){}class Fj extends Nj{constructor(e){if(super(e),typeof location<"u"){const t=location.protocol==="https:";let n=location.port;n||(n=t?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||n!==e.port}}doWrite(e,t){const n=this.request({method:"POST",data:e});n.on("success",t),n.on("error",(i,r)=>{this.onError("xhr post error",i,r)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,n)=>{this.onError("xhr poll error",t,n)}),this.pollXhr=e}}class ll extends An{constructor(e,t,n){super(),this.createRequest=e,uk(this,n),this._opts=n,this._method=n.method||"GET",this._uri=t,this._data=n.data!==void 0?n.data:null,this._create()}_create(){var e;const t=DL(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this._opts.xd;const n=this._xhr=this.createRequest(t);try{n.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){n.setDisableHeaderCheck&&n.setDisableHeaderCheck(!0);for(let i in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(i)&&n.setRequestHeader(i,this._opts.extraHeaders[i])}}catch{}if(this._method==="POST")try{n.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{n.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(n),"withCredentials"in n&&(n.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(n.timeout=this._opts.requestTimeout),n.onreadystatechange=()=>{var i;n.readyState===3&&((i=this._opts.cookieJar)===null||i===void 0||i.parseCookies(n.getResponseHeader("set-cookie"))),n.readyState===4&&(n.status===200||n.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof n.status=="number"?n.status:0)},0))},n.send(this._data)}catch(i){this.setTimeoutFn(()=>{this._onError(i)},0);return}typeof document<"u"&&(this._index=ll.requestsCount++,ll.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=Bj,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete ll.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}ll.requestsCount=0;ll.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Ax);else if(typeof addEventListener=="function"){const s="onpagehide"in No?"pagehide":"unload";addEventListener(s,Ax,!1)}}function Ax(){for(let s in ll.requests)ll.requests.hasOwnProperty(s)&&ll.requests[s].abort()}const Hj=function(){const s=BL({xdomain:!1});return s&&s.responseType!==null}();class Uj extends Fj{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=Hj&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new ll(BL,this.uri(),e)}}function BL(s){const e=s.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||$j))return new XMLHttpRequest}catch{}if(!e)try{return new No[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const FL=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class Wj extends LE{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,n=FL?{}:DL(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,n)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t{try{this.doWrite(n,r)}catch{}i&&ck(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=NL()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const _C=No.WebSocket||No.MozWebSocket;let zj=class extends Wj{createSocket(e,t,n){return FL?new _C(e,t,n):t?new _C(e,t):new _C(e)}doWrite(e,t){this.ws.send(t)}};class jj extends LE{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const t=Tj(Number.MAX_SAFE_INTEGER,this.socket.binaryType),n=e.readable.pipeThrough(t).getReader(),i=Cj();i.readable.pipeTo(e.writable),this._writer=i.writable.getWriter();const r=()=>{n.read().then(({done:a,value:c})=>{a||(this.onPacket(c),r())}).catch(a=>{})};r();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t{i&&ck(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const Vj={websocket:zj,webtransport:jj,polling:Uj},Gj=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Kj=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function UT(s){if(s.length>8e3)throw"URI too long";const e=s,t=s.indexOf("["),n=s.indexOf("]");t!=-1&&n!=-1&&(s=s.substring(0,t)+s.substring(t,n).replace(/:/g,";")+s.substring(n,s.length));let i=Gj.exec(s||""),r={},o=14;for(;o--;)r[Kj[o]]=i[o]||"";return t!=-1&&n!=-1&&(r.source=e,r.host=r.host.substring(1,r.host.length-1).replace(/;/g,":"),r.authority=r.authority.replace("[","").replace("]","").replace(/;/g,":"),r.ipv6uri=!0),r.pathNames=qj(r,r.path),r.queryKey=Qj(r,r.query),r}function qj(s,e){const t=/\/{2,9}/g,n=e.replace(t,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&n.splice(0,1),e.slice(-1)=="/"&&n.splice(n.length-1,1),n}function Qj(s,e){const t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(n,i,r){i&&(t[i]=r)}),t}const WT=typeof addEventListener=="function"&&typeof removeEventListener=="function",kw=[];WT&&addEventListener("offline",()=>{kw.forEach(s=>s())},!1);class ad extends An{constructor(e,t){if(super(),this.binaryType=Ej,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(t=e,e=null),e){const n=UT(e);t.hostname=n.host,t.secure=n.protocol==="https"||n.protocol==="wss",t.port=n.port,n.query&&(t.query=n.query)}else t.host&&(t.hostname=UT(t.host).host);uk(this,t),this.secure=t.secure!=null?t.secure:typeof location<"u"&&location.protocol==="https:",t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=t.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},t.transports.forEach(n=>{const i=n.prototype.name;this.transports.push(i),this._transportsByName[i]=n}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=Oj(this.opts.query)),WT&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},kw.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=OL,t.transport=e,this.id&&(t.sid=this.id);const n=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](n)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const e=this.opts.rememberUpgrade&&ad.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const t=this.createTransport(e);t.open(),this.setTransport(t)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",t=>this._onClose("transport close",t))}onOpen(){this.readyState="open",ad.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const t=new Error("server error");t.code=e.data,this._onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let n=0;n0&&t>this._maxPayload)return this.writeBuffer.slice(0,n);t+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,ck(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,t,n){return this._sendPacket("message",e,t,n),this}send(e,t,n){return this._sendPacket("message",e,t,n),this}_sendPacket(e,t,n,i){if(typeof t=="function"&&(i=t,t=void 0),typeof n=="function"&&(i=n,n=null),this.readyState==="closing"||this.readyState==="closed")return;n=n||{},n.compress=n.compress!==!1;const r={type:e,data:t,options:n};this.emitReserved("packetCreate",r),this.writeBuffer.push(r),i&&this.once("flush",i),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},n=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?n():e()}):this.upgrading?n():e()),this}_onError(e){if(ad.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),WT&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const n=kw.indexOf(this._offlineEventListener);n!==-1&&kw.splice(n,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}ad.protocol=OL;class Xj extends ad{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e{n||(t.send([{type:"ping",data:"probe"}]),t.once("packet",d=>{if(!n)if(d.type==="pong"&&d.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;ad.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{n||this.readyState!=="closed"&&(u(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const h=new Error("probe error");h.transport=t.name,this.emitReserved("upgradeError",h)}}))};function r(){n||(n=!0,u(),t.close(),t=null)}const o=d=>{const h=new Error("probe error: "+d);h.transport=t.name,r(),this.emitReserved("upgradeError",h)};function a(){o("transport closed")}function c(){o("socket closed")}function l(d){t&&d.name!==t.name&&r()}const u=()=>{t.removeListener("open",i),t.removeListener("error",o),t.removeListener("close",a),this.off("close",c),this.off("upgrading",l)};t.once("open",i),t.once("error",o),t.once("close",a),this.once("close",c),this.once("upgrading",l),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{n||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const t=[];for(let n=0;nVj[i]).filter(i=>!!i)),super(e,n)}};function Jj(s,e="",t){let n=s;t=t||typeof location<"u"&&location,s==null&&(s=t.protocol+"//"+t.host),typeof s=="string"&&(s.charAt(0)==="/"&&(s.charAt(1)==="/"?s=t.protocol+s:s=t.host+s),/^(https?|wss?):\/\//.test(s)||(typeof t<"u"?s=t.protocol+"//"+s:s="https://"+s),n=UT(s)),n.port||(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443")),n.path=n.path||"/";const r=n.host.indexOf(":")!==-1?"["+n.host+"]":n.host;return n.id=n.protocol+"://"+r+":"+n.port+e,n.href=n.protocol+"://"+r+(t&&t.port===n.port?"":":"+n.port),n}const Zj=typeof ArrayBuffer=="function",e9=s=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(s):s.buffer instanceof ArrayBuffer,HL=Object.prototype.toString,t9=typeof Blob=="function"||typeof Blob<"u"&&HL.call(Blob)==="[object BlobConstructor]",s9=typeof File=="function"||typeof File<"u"&&HL.call(File)==="[object FileConstructor]";function OE(s){return Zj&&(s instanceof ArrayBuffer||e9(s))||t9&&s instanceof Blob||s9&&s instanceof File}function Cw(s,e){if(!s||typeof s!="object")return!1;if(Array.isArray(s)){for(let t=0,n=s.length;t=0&&s.numthis.opts.maxAttachments)throw new Error("too many attachments");n.attachments=a}if(e.charAt(t+1)==="/"){const r=t+1;for(;++t&&!(e.charAt(t)===","||t===e.length););n.nsp=e.substring(r,t)}else n.nsp="/";const i=e.charAt(t+1);if(i!==""&&Number(i)==i){const r=t+1;for(;++t;){const o=e.charAt(t);if(o==null||Number(o)!=o){--t;break}if(t===e.length)break}n.id=Number(e.substring(r,t+1))}if(e.charAt(++t)){const r=this.tryParse(e.substr(t));if(DE.isPayloadValid(n.type,r))n.data=r;else throw new Error("invalid payload")}return n}tryParse(e){try{return JSON.parse(e,this.opts.reviver)}catch{return!1}}static isPayloadValid(e,t){switch(e){case Kt.CONNECT:return Ex(t);case Kt.DISCONNECT:return t===void 0;case Kt.CONNECT_ERROR:return typeof t=="string"||Ex(t);case Kt.EVENT:case Kt.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&r9.indexOf(t[0])===-1);case Kt.ACK:case Kt.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class a9{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const t=i9(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const l9=Number.isInteger||function(s){return typeof s=="number"&&isFinite(s)&&Math.floor(s)===s};function Ex(s){return Object.prototype.toString.call(s)==="[object Object]"}const c9=Object.freeze(Object.defineProperty({__proto__:null,Decoder:DE,Encoder:o9,get PacketType(){return Kt}},Symbol.toStringTag,{value:"Module"}));function va(s,e,t){return s.on(e,t),function(){s.off(e,t)}}const u9=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class UL extends An{constructor(e,t,n){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,n&&n.auth&&(this.auth=n.auth),this._opts=Object.assign({},n),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[va(e,"open",this.onopen.bind(this)),va(e,"packet",this.onpacket.bind(this)),va(e,"error",this.onerror.bind(this)),va(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var n,i,r;if(u9.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const o={type:Kt.EVENT,data:t};if(o.options={},o.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){const u=this.ids++,d=t.pop();this._registerAckCallback(u,d),o.id=u}const a=(i=(n=this.io.engine)===null||n===void 0?void 0:n.transport)===null||i===void 0?void 0:i.writable,c=this.connected&&!(!((r=this.io.engine)===null||r===void 0)&&r._hasPingExpired());return this.flags.volatile&&!a||(c?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(e,t){var n;const i=(n=this.flags.timeout)!==null&&n!==void 0?n:this._opts.ackTimeout;if(i===void 0){this.acks[e]=t;return}const r=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let a=0;a{this.io.clearTimeoutFn(r),t.apply(this,a)};o.withError=!0,this.acks[e]=o}emitWithAck(e,...t){return new Promise((n,i)=>{const r=(o,a)=>o?i(o):n(a);r.withError=!0,t.push(r),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]=="function"&&(t=e.pop());const n={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((i,...r)=>(this._queue[0],i!==null?n.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(i)):(this._queue.shift(),t&&t(null,...r)),n.pending=!1,this._drainQueue())),this._queue.push(n),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:Kt.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(n=>String(n.id)===e)){const n=this.acks[e];delete this.acks[e],n.withError&&n.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case Kt.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Kt.EVENT:case Kt.BINARY_EVENT:this.onevent(e);break;case Kt.ACK:case Kt.BINARY_ACK:this.onack(e);break;case Kt.DISCONNECT:this.ondisconnect();break;case Kt.CONNECT_ERROR:this.destroy();const n=new Error(e.data.message);n.data=e.data.data,this.emitReserved("connect_error",n);break}}onevent(e){const t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const n of t)n.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let n=!1;return function(...i){n||(n=!0,t.packet({type:Kt.ACK,id:e,data:i}))}}onack(e){const t=this.acks[e.id];typeof t=="function"&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Kt.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let n=0;n0&&s.jitter<=1?s.jitter:0,this.attempts=0}bg.prototype.duration=function(){var s=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),t=Math.floor(e*this.jitter*s);s=Math.floor(e*10)&1?s+t:s-t}return Math.min(s,this.max)|0};bg.prototype.reset=function(){this.attempts=0};bg.prototype.setMin=function(s){this.ms=s};bg.prototype.setMax=function(s){this.max=s};bg.prototype.setJitter=function(s){this.jitter=s};class VT extends An{constructor(e,t){var n;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,uk(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((n=t.randomizationFactor)!==null&&n!==void 0?n:.5),this.backoff=new bg({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;const i=t.parser||c9;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)===null||t===void 0||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)===null||t===void 0||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)===null||t===void 0||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new Yj(this.uri,this.opts);const t=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const i=va(t,"open",function(){n.onopen(),e&&e()}),r=a=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",a),e?e(a):this.maybeReconnectOnOpen()},o=va(t,"error",r);if(this._timeout!==!1){const a=this._timeout,c=this.setTimeoutFn(()=>{i(),r(new Error("timeout")),t.close()},a);this.opts.autoUnref&&c.unref(),this.subs.push(()=>{this.clearTimeoutFn(c)})}return this.subs.push(i),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(va(e,"ping",this.onping.bind(this)),va(e,"data",this.ondata.bind(this)),va(e,"error",this.onerror.bind(this)),va(e,"close",this.onclose.bind(this)),va(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){ck(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let n=this.nsps[e];return n?this._autoConnect&&!n.active&&n.connect():(n=new UL(this,e,t),this.nsps[e]=n),n}_destroy(e){const t=Object.keys(this.nsps);for(const n of t)if(this.nsps[n].active)return;this._close()}_packet(e){const t=this.encoder.encode(e);for(let n=0;ne()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var n;this.cleanup(),(n=this.engine)===null||n===void 0||n.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const n=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(i=>{i?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",i)):e.onreconnect()}))},t);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const Lg={};function Tw(s,e){typeof s=="object"&&(e=s,s=void 0),e=e||{};const t=Jj(s,e.path||"/socket.io"),n=t.source,i=t.id,r=t.path,o=Lg[i]&&r in Lg[i].nsps,a=e.forceNew||e["force new connection"]||e.multiplex===!1||o;let c;return a?c=new VT(n,e):(Lg[i]||(Lg[i]=new VT(n,e)),c=Lg[i]),t.query&&!e.query&&(e.query=t.queryKey),c.socket(t.path,e)}Object.assign(Tw,{Manager:VT,Socket:UL,io:Tw,connect:Tw});const d9={class:"terminal-panel__header"},h9={class:"terminal-panel__tabs"},f9={key:0,class:"terminal-panel__empty-tab"},p9=["title","onClick"],m9={class:"terminal-panel__tab-name"},g9={key:0,class:"terminal-panel__idle"},v9=ct({name:"TerminalPanel",__name:"TerminalPanel",props:{width:{},workspaceId:{},conversationId:{}},emits:["close"],setup(s,{emit:e}){const t=s,n=ge({}),i=ge(""),r=ge({}),o=ge({});let a=null;const c=ge(null);let l=null,u=null,d=null;const h=ge({}),p=ge({}),g=be(()=>Object.keys(n.value));function v(E){const x=E==null?void 0:E.conversation_id;return!x||!t.conversationId?!1:x===t.conversationId}function m(){return document.documentElement.getAttribute("data-theme")==="dark"?"dark":"light"}function y(){return{background:"#ffffff",foreground:"#1f1f1f",cursor:"#3d3929",black:"#1f1f1f",red:"#c04a2f",green:"#4b8f60",yellow:"#b48a2c",blue:"#4a6ea9",magenta:"#9b4d88",cyan:"#2a8c8c",white:"#f4f0ea",brightBlack:"#6b6b6b",brightRed:"#d94a3a",brightGreen:"#5c9e6f",brightYellow:"#c49a3c",brightBlue:"#5a7eb9",brightMagenta:"#ab5d98",brightCyan:"#3a9c9c",brightWhite:"#faf9f5"}}function _(){return{background:"#181818",foreground:"#d4d4d8",cursor:"#d4d4d8",black:"#181818",red:"#f87171",green:"#4ade80",yellow:"#fbbf24",blue:"#60a5fa",magenta:"#c084fc",cyan:"#22d3ee",white:"#e4e4e7",brightBlack:"#3f3f46",brightRed:"#fb7185",brightGreen:"#86efac",brightYellow:"#fcd34d",brightBlue:"#93c5fd",brightMagenta:"#d8b4fe",brightCyan:"#67e8f9",brightWhite:"#fafafa"}}function b(){if(!l)return;const E=m()==="dark";l.options.theme=E?_():y()}function k(){if(!c.value)return;const x=m()==="dark"?_():y();l=new vj.Terminal({cursorBlink:!0,fontSize:13,fontFamily:'"JetBrains Mono", "SF Mono", "Fira Code", "Consolas", monospace',theme:x,scrollback:1e4,convertEol:!0,allowTransparency:!1,disableStdin:!0}),l.open(c.value),d=new ResizeObserver(()=>{if(!l||!c.value)return;const D=c.value.getBoundingClientRect();if(D.width<40||D.height<40)return;const N=l._core._renderService.dimensions.css.cell.width||7.8,O=l._core._renderService.dimensions.css.cell.height||17,G=Math.max(2,Math.floor((D.width-16)/N)),Z=Math.max(1,Math.floor((D.height-16)/O));(G!==l.cols||Z!==l.rows)&&l.resize(G,Z)}),d.observe(c.value),u=new MutationObserver(()=>b()),u.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]})}function w(){d==null||d.disconnect(),d=null,u==null||u.disconnect(),u=null,l==null||l.dispose(),l=null}function T(){if(!l||!i.value)return;const E=r.value[i.value]||"";l.clear(),E&&l.write(E,()=>{l==null||l.scrollToBottom()})}function A(E){if(E&&(i.value=E,!o.value[E])){h.value={...h.value,[E]:!1};const x={...p.value};delete x[E],p.value=x,a!=null&&a.connected&&a.emit("get_terminal_output",{session:E,lines:0,conversation_id:t.conversationId})}}Ke(i,E=>{l&&T()}),Ke(g,E=>{E.length>0&&l&&!i.value&&A(E[0])}),Ke(()=>t.workspaceId,(E,x)=>{E&&x&&E!==x&&(a&&(a.disconnect(),a=null),n.value={},i.value="",r.value={},o.value={},h.value={},p.value={},l&&l.clear(),C())}),Ke(()=>t.conversationId,(E,x)=>{E!==x&&(n.value={},i.value="",r.value={},o.value={},h.value={},p.value={},l&&l.clear(),a!=null&&a.connected&&a.emit("terminal_subscribe",{all:!0,conversation_id:E}))});async function C(){a=Tw("/",{transports:["websocket","polling"],autoConnect:!1});const E=async()=>{const N=window;if(typeof N.requestSocketToken!="function")return console.warn("[TerminalPanel] requestSocketToken 不可用"),!1;try{const O=await N.requestSocketToken();return a.auth={socket_token:O},!0}catch(O){return console.error("[TerminalPanel] 获取 token 失败:",O),!1}};if(a.io.on("reconnect_attempt",()=>E()),!await E()){console.error("[TerminalPanel] token 获取失败,放弃 socket"),a=null;return}a.on("connect",()=>{a.emit("terminal_subscribe",{all:!0,conversation_id:t.conversationId})}),a.on("disconnect",()=>{}),a.on("terminal_subscribed",N=>{if(N!=null&&N.terminals){const O={};for(const G of N.terminals)O[G.name]={working_dir:G.working_dir,shell:"bash"};n.value=O,N.terminals.length>0&&!i.value&&A(N.terminals[0].name)}}),a.on("terminal_started",N=>{v(N)&&(n.value={...n.value,[N.session]:{working_dir:N.working_dir,shell:"bash"}},i.value||A(N.session))}),a.on("terminal_list_update",N=>{if(v(N)&&N!=null&&N.terminals){const O={};for(const G of N.terminals)O[G.name]={working_dir:G.working_dir,shell:"bash"};n.value=O,N.active&&!i.value&&A(N.active)}}),a.on("terminal_output",N=>{if(!v(N))return;const O=N.session;if(!O)return;const G=N.data||"",Z=p.value[O]||0,q=typeof N.timestamp=="number"?N.timestamp:0;Z>0&&q>0&&q<=Z||(r.value[O]=(r.value[O]||"")+G,O===i.value&&l&&h.value[O]&&l.write(G),i.value||A(O))}),a.on("terminal_input",N=>{v(N)&&!i.value&&N.session&&A(N.session)}),a.on("terminal_closed",N=>{if(!v(N))return;const O={...n.value};delete O[N.session],n.value=O;const G=Object.keys(O);i.value===N.session&&(i.value=G.length>0?G[0]:"")}),a.on("terminal_reset",N=>{if(!v(N))return;const O=N.session||i.value;if(O){r.value={...r.value,[O]:""},o.value={...o.value,[O]:!0};const G={...p.value};delete G[O],p.value=G,O===i.value&&T()}}),a.on("terminal_switched",N=>{v(N)&&N.current&&A(N.current)});const D=N=>{const O=N.session||N.active;if(!O)return;const G=N.output||N.data||"";let Z="";typeof G=="string"?Z=G:Array.isArray(G)&&(Z=G.join(` `)),Z&&(r.value[O]=Z),o.value={...o.value,[O]:!0},h.value={...h.value,[O]:!0};const q=typeof N.last_event_time=="number"?N.last_event_time:0;p.value={...p.value,[O]:q},O===i.value&&T()};a.on("terminal_output_history",D),a.on("terminal_history",D),a.connect()}return dn(()=>{ft(()=>{k(),C()})}),Rn(()=>{w(),a&&(a.disconnect(),a=null)}),(E,x)=>(F(),U("aside",{class:"terminal-panel",style:qe({width:s.width+"px"})},[M("header",d9,[M("div",h9,[g.value.length?me("",!0):(F(),U("div",f9,[M("span",null,Q(E.$t("shell.waitingTerminalSession")),1)])),(F(!0),U(Ie,null,Ze(g.value,D=>{var N;return F(),U("button",{key:D,type:"button",class:Ce(["terminal-panel__tab",{active:D===i.value}]),title:((N=n.value[D])==null?void 0:N.working_dir)||D,onClick:O=>A(D)},[M("span",m9,Q(D),1)],10,p9)}),128))]),We(ml,{label:E.$t("shell.closeTerminalPanel"),onClick:x[0]||(x[0]=D=>E.$emit("close"))},null,8,["label"])]),M("div",{class:"terminal-panel__body",ref_key:"terminalContainer",ref:c},[g.value.length?me("",!0):(F(),U("div",g9,[x[1]||(x[1]=M("svg",{class:"terminal-panel__idle-svg",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true"},[M("rect",{x:"2",y:"3",width:"20",height:"16",rx:"2",stroke:"currentColor","stroke-width":"1.5"}),M("path",{d:"M6 7h12M6 10h8",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"})],-1)),M("span",null,Q(E.$t("shell.noOpenTerminals")),1)]))],512)],4))}}),y9=qt(v9,[["__scopeId","data-v-fa145c42"]]),b9={class:"token-display-panel"},_9={class:"token-panel-content"},w9={class:"usage-dashboard"},S9={class:"usage-cell usage-cell--left usage-cell--token panel-card"},k9={class:"usage-title"},C9={class:"stat-grid stat-grid--triple"},T9={class:"stat-block"},A9={class:"stat-label"},E9={class:"stat-value stat-value--accent"},M9={class:"stat-block"},x9={class:"stat-label"},R9={class:"stat-value stat-value--success"},I9={class:"stat-block"},P9={class:"stat-label"},L9={class:"stat-value stat-value--warning"},O9={class:"stat-block"},D9={class:"stat-label"},N9={class:"stat-value"},$9={class:"stat-block"},B9={class:"stat-label"},F9={class:"stat-value"},H9={class:"usage-cell usage-cell--right usage-cell--performance panel-card"},U9={class:"usage-title"},W9={key:0,class:"stat-grid stat-grid--double"},z9={class:"stat-block"},j9={class:"stat-value"},V9={class:"stat-block"},G9={class:"stat-label"},K9={class:"stat-value stat-value--mono"},q9={key:0,class:"stat-foot"},Q9={key:1,class:"usage-placeholder"},X9={key:1,class:"usage-placeholder"},Y9={class:"usage-cell usage-cell--left usage-cell--quota panel-card"},J9={class:"usage-title"},Z9={class:"stat-grid stat-grid--triple"},e7={class:"stat-label"},t7={class:"stat-value"},s7={key:0,class:"stat-foot"},n7={class:"usage-cell usage-cell--right usage-cell--resource panel-card"},i7={class:"usage-title"},r7={class:"stat-grid stat-grid--double"},o7={class:"stat-block"},a7={class:"stat-label"},l7={class:"stat-value stat-value--mono"},c7={class:"stat-block"},u7={class:"stat-label"},d7={class:"stat-value stat-value--mono"},h7={key:0,class:"stat-foot"},f7=ct({name:"TokenDrawer",__name:"TokenDrawer",props:{visible:{type:Boolean},collapsed:{type:Boolean},currentConversationTokens:{},currentContextTokens:{},containerStatus:{},containerNetRate:{},projectStorage:{},usageQuota:{},formatTokenCount:{type:Function},formatPercentage:{type:Function},formatBytes:{type:Function},formatQuotaValue:{type:Function},formatResetTime:{type:Function},formatRate:{type:Function}},emits:["toggle"],setup(s,{emit:e}){const t=e,n=s,i=be(()=>[{key:"fast",label:"sidebar.quotaTierFast",value:n.usageQuota.fast},{key:"thinking",label:"sidebar.quotaTierThinking",value:n.usageQuota.thinking},{key:"search",label:"sidebar.quotaTierSearch",value:n.usageQuota.search}]),r=be(()=>{const l=n.currentConversationTokens.cumulative_input_tokens||0,u=n.currentConversationTokens.cache_exempt_input_tokens||0,d=l-u;return d<=0?"--":`${((n.currentConversationTokens.cumulative_cached_input_tokens||0)/d*100).toFixed(1)}%`}),o=be(()=>{const l=n.containerStatus;return!l||!l.stats?!1:typeof l.stats.cpu_percent<"u"?!0:!!(l.stats.memory&&typeof l.stats.memory.used_bytes<"u")}),a=be(()=>{const l=n.containerStatus;if(!l)return{};if(l.mode!=="docker")return{"status-pill--host":!0};const u=l.state&&l.state.running===!1;return{"status-pill--running":!u,"status-pill--stopped":u}}),c=be(()=>{lt.value;const l=n.containerStatus;return l?l.mode!=="docker"?"Host":l.state&&l.state.running===!1?S("sidebar.stopped"):S("sidebar.containerRunning"):S("sidebar.unknown")});return(l,u)=>s.visible?(F(),U("div",{key:0,class:Ce(["token-drawer",{collapsed:s.collapsed}]),"data-tutorial":"token-drawer"},[M("div",b9,[We(ml,{class:"token-close-btn","data-tutorial":"token-close",label:l.$t("sidebar.collapseUsage"),onClick:u[0]||(u[0]=d=>t("toggle"))},null,8,["label"]),M("div",_9,[M("div",w9,[M("div",S9,[M("div",k9,Q(l.$t("sidebar.tokenStats")),1),M("div",C9,[M("div",T9,[M("div",A9,Q(l.$t("sidebar.currentContext")),1),M("div",E9,Q(s.formatTokenCount(s.currentContextTokens||0)),1)]),M("div",M9,[M("div",x9,Q(l.$t("sidebar.cumulativeInput")),1),M("div",R9,Q(s.formatTokenCount(s.currentConversationTokens.cumulative_input_tokens||0)),1)]),M("div",I9,[M("div",P9,Q(l.$t("sidebar.cumulativeOutput")),1),M("div",L9,Q(s.formatTokenCount(s.currentConversationTokens.cumulative_output_tokens||0)),1)]),M("div",O9,[M("div",D9,Q(l.$t("sidebar.cumulativeCachedInput")),1),M("div",N9,Q(s.formatTokenCount(s.currentConversationTokens.cumulative_cached_input_tokens||0)),1)]),M("div",$9,[M("div",B9,Q(l.$t("sidebar.cacheHitRate")),1),M("div",F9,Q(r.value),1)])])]),M("div",H9,[M("div",U9,[M("span",null,Q(l.$t("sidebar.performanceStats")),1),s.containerStatus?(F(),U("span",{key:0,class:Ce(["status-pill",a.value])},Q(c.value),3)):me("",!0)]),s.containerStatus&&s.containerStatus.mode==="docker"?(F(),U(Ie,{key:0},[o.value?(F(),U("div",W9,[M("div",z9,[u[1]||(u[1]=M("div",{class:"stat-label"},"CPU",-1)),M("div",j9,Q(s.formatPercentage(s.containerStatus.stats.cpu_percent)),1)]),M("div",V9,[M("div",G9,Q(l.$t("sidebar.memory")),1),M("div",K9,[cn(Q(s.formatBytes(s.containerStatus.stats.memory.used_bytes))+" ",1),s.containerStatus.stats.memory.limit_bytes?(F(),U(Ie,{key:0},[cn(" / "+Q(s.formatBytes(s.containerStatus.stats.memory.limit_bytes)),1)],64)):me("",!0)]),s.containerStatus.stats.memory.percent?(F(),U("div",q9,Q(s.formatPercentage(s.containerStatus.stats.memory.percent)),1)):me("",!0)])])):(F(),U("div",Q9,Q(l.$t("sidebar.containerMetricsPending")),1))],64)):(F(),U("div",X9,Q(l.$t("sidebar.hostModeNoContainer")),1))]),M("div",Y9,[M("div",J9,Q(l.$t("sidebar.quotaStats")),1),M("div",Z9,[(F(!0),U(Ie,null,Ze(i.value,d=>(F(),U("div",{class:"stat-block",key:d.key},[M("div",e7,Q(l.$t(d.label)),1),M("div",t7,Q(s.formatQuotaValue(d.value)),1),(d.value.count||0)>0?(F(),U("div",s7,Q(l.$t("sidebar.resetAt",{time:s.formatResetTime(d.value.reset_at)})),1)):me("",!0)]))),128))])]),M("div",n7,[M("div",i7,Q(l.$t("sidebar.resourceStats")),1),M("div",r7,[M("div",o7,[M("div",a7,Q(l.$t("sidebar.network")),1),M("div",l7," ↓"+Q(s.formatRate(s.containerNetRate.down_bps))+" ↑"+Q(s.formatRate(s.containerNetRate.up_bps)),1)]),M("div",c7,[M("div",u7,Q(l.$t("sidebar.storage")),1),M("div",d7,[cn(Q(s.formatBytes(s.projectStorage.used_bytes))+" ",1),s.projectStorage.limit_bytes?(F(),U(Ie,{key:0},[cn("/ "+Q(s.formatBytes(s.projectStorage.limit_bytes)),1)],64)):me("",!0)]),typeof s.projectStorage.usage_percent=="number"?(F(),U("div",h7,Q(s.projectStorage.usage_percent.toFixed(1))+"% ",1)):me("",!0)])])])])])])],2)):me("",!0)}}),p7={class:"quick-menu-list"},m7=["disabled"],g7=["disabled"],v7=["disabled"],y7=["disabled"],b7=["disabled"],_7=["disabled"],w7={class:"entry-arrow"},S7=["disabled"],k7={key:0,class:"quick-submenu tool-submenu"},C7={key:0,class:"submenu-status"},T7={key:1,class:"submenu-empty"},A7={key:2,class:"submenu-list tool-submenu-list"},E7=["onClick","disabled"],M7={class:"submenu-label icon-label"},x7={class:"entry-arrow"},R7={key:0,class:"quick-submenu settings-submenu"},I7={class:"submenu-list"},P7=["disabled"],L7=["disabled"],O7=["disabled"],D7=["disabled"],N7=ct({name:"QuickMenu",__name:"QuickMenu",props:{open:{type:Boolean},isConnected:{type:Boolean},uploading:{type:Boolean},streamingMessage:{type:Boolean},thinkingMode:{type:Boolean},toolMenuOpen:{type:Boolean},toolSettings:{},toolSettingsLoading:{type:Boolean},settingsOpen:{type:Boolean},compressing:{type:Boolean},currentConversationId:{},iconStyle:{type:Function},toolCategoryIcon:{type:Function},modeMenuOpen:{type:Boolean},runMode:{},modelMenuOpen:{type:Boolean},modelOptions:{},currentModelKey:{},blockUpload:{type:Boolean},blockToolToggle:{type:Boolean},blockRealtimeTerminal:{type:Boolean},blockFocusPanel:{type:Boolean},blockTokenPanel:{type:Boolean},blockCompressConversation:{type:Boolean},blockConversationReview:{type:Boolean},executionModeEnabled:{type:Boolean},goalModeArmed:{type:Boolean},goalRunning:{type:Boolean},goalProgress:{}},emits:["quick-upload","toggle-tool-menu","toggle-settings","update-tool-category","realtime-terminal","toggle-token-panel","compress-conversation","toggle-approval-panel","toggle-mode-menu","select-run-mode","toggle-model-menu","select-model","open-review","pick-video","open-path-authorization","toggle-goal-mode"],setup(s){const e=s,t=o=>e.iconStyle?e.iconStyle(o):{},n=be(()=>{var a;const o=(a=e.modelOptions)==null?void 0:a.find(c=>c.key===e.currentModelKey);return!!(o!=null&&o.supportsImage)}),i=be(()=>{var a;const o=(a=e.modelOptions)==null?void 0:a.find(c=>c.key===e.currentModelKey);return!!(o!=null&&o.supportsVideo)}),r=be(()=>{var o;return String(((o=e.goalProgress)==null?void 0:o.status)||"").toLowerCase()==="done"});return(o,a)=>(F(),Ft(gs,{name:"quick-menu"},{default:Gt(()=>[s.open?(F(),U("div",{key:0,class:"quick-menu",onClick:a[12]||(a[12]=De(()=>{},["stop"]))},[M("div",p7,[M("button",{type:"button",class:"menu-entry","data-tutorial":"quick-upload",onClick:a[0]||(a[0]=c=>o.$emit("quick-upload")),disabled:!s.isConnected||s.uploading},Q(s.uploading?o.$t("quickdock.uploading"):o.$t("quickdock.uploadFile")),9,m7),M("button",{type:"button",class:"menu-entry","data-tutorial":"quick-review",onClick:a[1]||(a[1]=De(c=>o.$emit("open-review"),["stop"])),disabled:!s.isConnected||s.streamingMessage},Q(o.$t("quickdock.conversationReview")),9,g7),n.value?(F(),U("button",{key:0,type:"button",class:"menu-entry","data-tutorial":"quick-send-image",onClick:a[2]||(a[2]=De(c=>o.$emit("pick-images"),["stop"])),disabled:!s.isConnected||s.streamingMessage},Q(o.$t("quickdock.sendImage")),9,v7)):me("",!0),i.value?(F(),U("button",{key:1,type:"button",class:"menu-entry","data-tutorial":"quick-send-video",onClick:a[3]||(a[3]=De(c=>o.$emit("pick-video"),["stop"])),disabled:!s.isConnected||s.streamingMessage},Q(o.$t("quickdock.sendVideo")),9,y7)):me("",!0),M("button",{type:"button",class:"menu-entry has-submenu","data-tutorial":"quick-tool-menu",onClick:a[4]||(a[4]=De(c=>o.$emit("toggle-tool-menu"),["stop"])),disabled:!s.isConnected},[cn(Q(o.$t("quickdock.disableTools"))+" ",1),a[13]||(a[13]=M("span",{class:"entry-arrow"},"›",-1))],8,b7),M("button",{type:"button",class:Ce(["menu-entry",{"goal-entry-active":s.goalModeArmed||s.goalRunning||r.value}]),onClick:a[5]||(a[5]=De(c=>o.$emit("toggle-goal-mode"),["stop"])),disabled:!s.isConnected},[cn(Q(o.$t("quickdock.goalMode"))+" ",1),M("span",w7,[s.goalRunning?(F(),U(Ie,{key:0},[cn(Q(o.$t("common.running")),1)],64)):r.value?(F(),U(Ie,{key:1},[cn(Q(o.$t("quickdock.goalDone")),1)],64)):(F(),U(Ie,{key:2},[cn(Q(s.goalModeArmed?o.$t("quickdock.goalArmed"):""),1)],64))])],10,_7),M("button",{type:"button",class:"menu-entry has-submenu","data-tutorial":"quick-settings-menu",onClick:a[6]||(a[6]=De(c=>o.$emit("toggle-settings"),["stop"])),disabled:!s.isConnected},[cn(Q(o.$t("quickdock.settingsMenu"))+" ",1),a[14]||(a[14]=M("span",{class:"entry-arrow"},"›",-1))],8,S7)]),We(gs,{name:"submenu-slide"},{default:Gt(()=>[s.toolMenuOpen?(F(),U("div",k7,[s.toolSettingsLoading?(F(),U("div",C7,Q(o.$t("quickdock.toolSettingsSyncing")),1)):s.toolSettings.length?(F(),U("div",A7,[(F(!0),U(Ie,null,Ze(s.toolSettings,c=>(F(),U("button",{key:c.id,type:"button",class:Ce(["menu-entry submenu-entry",{disabled:!c.enabled||c.locked}]),onClick:De(l=>o.$emit("update-tool-category",c.id,!c.enabled),["stop"]),disabled:s.streamingMessage||!s.isConnected||s.toolSettingsLoading},[M("span",M7,[M("span",{class:"icon icon-sm",style:qe(t(s.toolCategoryIcon(c.id))),"aria-hidden":"true"},null,4),M("span",null,Q(c.label),1)]),M("span",x7,[c.locked?(F(),U(Ie,{key:0},[cn(Q(o.$t("quickdock.lockedByAdmin")),1)],64)):(F(),U(Ie,{key:1},[cn(Q(c.enabled?o.$t("quickdock.toolDisable"):o.$t("quickdock.toolEnable")),1)],64))])],10,E7))),128))])):(F(),U("div",T7,Q(o.$t("quickdock.noControllableTools")),1))])):me("",!0)]),_:1}),We(gs,{name:"submenu-slide"},{default:Gt(()=>[s.settingsOpen?(F(),U("div",R7,[M("div",I7,[M("button",{type:"button",class:"menu-entry submenu-entry",onClick:a[7]||(a[7]=c=>o.$emit("realtime-terminal")),disabled:!s.isConnected},Q(o.$t("quickdock.realtimeTerminal")),9,P7),M("button",{type:"button",class:"menu-entry submenu-entry","data-tutorial":"settings-token-panel",onClick:a[8]||(a[8]=c=>{console.log("[UI_DEBUG] QuickMenu 用量统计按钮 clicked, emitting toggle-token-panel with true"),o.$emit("toggle-token-panel",!0)}),disabled:!s.currentConversationId},Q(o.$t("quickdock.usageStats")),9,L7),M("button",{type:"button",class:"menu-entry submenu-entry",onClick:a[9]||(a[9]=c=>o.$emit("compress-conversation")),disabled:s.compressing||s.streamingMessage||!s.isConnected},Q(s.compressing?o.$t("quickdock.compressing"):o.$t("quickdock.compressConversation")),9,O7),M("button",{type:"button",class:"menu-entry submenu-entry",onClick:a[10]||(a[10]=c=>o.$emit("toggle-approval-panel")),disabled:!s.currentConversationId},Q(o.$t("quickdock.approvalPanel")),9,D7),s.executionModeEnabled?(F(),U("button",{key:0,type:"button",class:"menu-entry submenu-entry",onClick:a[11]||(a[11]=c=>o.$emit("open-path-authorization"))},Q(o.$t("quickdock.pathAuthorization")),1)):me("",!0)])])):me("",!0)]),_:1})])):me("",!0)]),_:1}))}}),WL=qt(N7,[["__scopeId","data-v-20682656"]]);function oi(s){this.content=s}oi.prototype={constructor:oi,find:function(s){for(var e=0;e>1}};oi.from=function(s){if(s instanceof oi)return s;var e=[];if(s)for(var t in s)e.push(t,s[t]);return new oi(e)};function zL(s,e,t){for(let n=0;;n++){if(n==s.childCount||n==e.childCount)return s.childCount==e.childCount?null:t;let i=s.child(n),r=e.child(n);if(i==r){t+=i.nodeSize;continue}if(!i.sameMarkup(r))return t;if(i.isText&&i.text!=r.text){for(let o=0;i.text[o]==r.text[o];o++)t++;return t}if(i.content.size||r.content.size){let o=zL(i.content,r.content,t+1);if(o!=null)return o}t+=i.nodeSize}}function jL(s,e,t,n){for(let i=s.childCount,r=e.childCount;;){if(i==0||r==0)return i==r?null:{a:t,b:n};let o=s.child(--i),a=e.child(--r),c=o.nodeSize;if(o==a){t-=c,n-=c;continue}if(!o.sameMarkup(a))return{a:t,b:n};if(o.isText&&o.text!=a.text){let l=0,u=Math.min(o.text.length,a.text.length);for(;le&&n(c,i+a,r||null,o)!==!1&&c.content.size){let u=a+1;c.nodesBetween(Math.max(0,e-u),Math.min(c.content.size,t-u),n,i+u)}a=l}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,i){let r="",o=!0;return this.nodesBetween(e,t,(a,c)=>{let l=a.isText?a.text.slice(Math.max(e,c)-c,t-c):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&l||a.isTextblock)&&n&&(o?o=!1:r+=n),r+=l},0),r}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,n=e.firstChild,i=this.content.slice(),r=0;for(t.isText&&t.sameMarkup(n)&&(i[i.length-1]=t.withText(t.text+n.text),r=1);re)for(let r=0,o=0;oe&&((ot)&&(a.isText?a=a.cut(Math.max(0,e-o),Math.min(a.text.length,t-o)):a=a.cut(Math.max(0,e-o-1),Math.min(a.content.size,t-o-1))),n.push(a),i+=a.nodeSize),o=c}return new Wi(n,i)}cutByIndex(e,t){return e==t?Wi.empty:e==0&&t==this.content.length?this:new Wi(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;let i=this.content.slice(),r=this.size+t.nodeSize-n.nodeSize;return i[e]=t,new Wi(i,r)}addToStart(e){return new Wi([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Wi(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;tthis.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let i=this.child(t),r=n+i.nodeSize;if(r>=e)return r==e?W_(t+1,r):W_(t,n);n=r}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return Wi.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return Wi.fromArray(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return Wi.empty;let t,n=0;for(let i=0;ithis.type.rank&&(t||(t=e.slice(0,i)),t.push(this),n=!0),t&&t.push(r)}}return t||(t=e.slice()),n||t.push(this),t}removeFromSet(e){for(let t=0;tn.type.rank-i.type.rank),t}};As.none=[];let OS=class extends Error{},tt=class up{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=GL(this.content,e+this.openStart,t,this.openStart+1,this.openEnd+1);return n&&new up(n,this.openStart,this.openEnd)}removeBetween(e,t){return new up(VL(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return up.empty;let n=t.openStart||0,i=t.openEnd||0;if(typeof n!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new up(He.fromJSON(e,t.content),n,i)}static maxOpen(e,t=!0){let n=0,i=0;for(let r=e.firstChild;r&&!r.isLeaf&&(t||!r.type.spec.isolating);r=r.firstChild)n++;for(let r=e.lastChild;r&&!r.isLeaf&&(t||!r.type.spec.isolating);r=r.lastChild)i++;return new up(e,n,i)}};tt.empty=new tt(He.empty,0,0);function VL(s,e,t){let{index:n,offset:i}=s.findIndex(e),r=s.maybeChild(n),{index:o,offset:a}=s.findIndex(t);if(i==e||r.isText){if(a!=t&&!s.child(o).isText)throw new RangeError("Removing non-flat range");return s.cut(0,e).append(s.cut(t))}if(n!=o)throw new RangeError("Removing non-flat range");return s.replaceChild(n,r.copy(VL(r.content,e-i-1,t-i-1)))}function GL(s,e,t,n,i,r){let{index:o,offset:a}=s.findIndex(e),c=s.maybeChild(o);if(a==e||c.isText)return r&&n<=0&&i<=0&&!r.canReplace(o,o,t)?null:s.cut(0,e).append(t).append(s.cut(e));let l=GL(c.content,e-a-1,t,o==0?n-1:0,o==s.childCount-1?i-1:0,c);return l&&s.replaceChild(o,c.copy(l))}function $7(s,e,t){if(t.openStart>s.depth)throw new OS("Inserted content deeper than insertion position");if(s.depth-t.openStart!=e.depth-t.openEnd)throw new OS("Inconsistent open depths");return KL(s,e,t,0)}function KL(s,e,t,n){let i=s.index(n),r=s.node(n);if(i==e.index(n)&&n=0&&s.isText&&s.sameMarkup(e[t])?e[t]=s.withText(e[t].text+s.text):e.push(s)}function Hv(s,e,t,n){let i=(e||s).node(t),r=0,o=e?e.index(t):i.childCount;s&&(r=s.index(t),s.depth>t?r++:s.textOffset&&(Af(s.nodeAfter,n),r++));for(let a=r;ai&&KT(s,e,i+1),o=n.depth>i&&KT(t,n,i+1),a=[];return Hv(null,s,i,a),r&&o&&e.index(i)==t.index(i)?(qL(r,o),Af(Ef(r,QL(s,e,t,n,i+1)),a)):(r&&Af(Ef(r,DS(s,e,i+1)),a),Hv(e,t,i,a),o&&Af(Ef(o,DS(t,n,i+1)),a)),Hv(n,null,i,a),new He(a)}function DS(s,e,t){let n=[];if(Hv(null,s,t,n),s.depth>t){let i=KT(s,e,t+1);Af(Ef(i,DS(s,e,t+1)),n)}return Hv(e,null,t,n),new He(n)}function B7(s,e){let t=e.depth-s.openStart,i=e.node(t).copy(s.content);for(let r=t-1;r>=0;r--)i=e.node(r).copy(He.from(i));return{start:i.resolveNoCache(s.openStart+t),end:i.resolveNoCache(i.content.size-s.openEnd-t)}}class cy{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],i=e.child(t);return n?e.child(t).cut(n):i}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let r=0;r0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new NS(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let n=[],i=0,r=t;for(let o=e;;){let{index:a,offset:c}=o.content.findIndex(r),l=r-c;if(n.push(o,a,i+c),!l||(o=o.child(a),o.isText))break;r=l-1,i+=c+1}return new cy(t,n,r)}static resolveCached(e,t){let n=Mx.get(e);if(n)for(let r=0;re&&this.nodesBetween(e,t,r=>(n.isInSet(r.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),XL(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,n=He.empty,i=0,r=n.childCount){let o=this.contentMatchAt(e).matchFragment(n,i,r),a=o&&o.matchFragment(this.content,t);if(!a||!a.validEnd)return!1;for(let c=i;ct.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let n;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,n)}let i=He.fromJSON(e,t.content),r=e.nodeType(t.type).create(t.attrs,i,n);return r.type.checkAttrs(r.attrs),r}};Tc.prototype.text=void 0;class $S extends Tc{constructor(e,t,n,i){if(super(e,t,null,i),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):XL(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new $S(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new $S(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function XL(s,e){for(let t=s.length-1;t>=0;t--)e=s[t].type.name+"("+e+")";return e}class If{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let n=new W7(e,t);if(n.next==null)return If.empty;let i=YL(n);n.next&&n.err("Unexpected trailing text");let r=Q7(q7(i));return X7(r,n),r}matchType(e){for(let t=0;tl.createAndFill()));for(let l=0;l=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let i=0;i{let r=i+(n.validEnd?"*":" ")+" ";for(let o=0;o"+e.indexOf(n.next[o].next);return r}).join(` `)}}If.empty=new If(!0);class W7{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function YL(s){let e=[];do e.push(z7(s));while(s.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function z7(s){let e=[];do e.push(j7(s));while(s.next&&s.next!=")"&&s.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function j7(s){let e=K7(s);for(;;)if(s.eat("+"))e={type:"plus",expr:e};else if(s.eat("*"))e={type:"star",expr:e};else if(s.eat("?"))e={type:"opt",expr:e};else if(s.eat("{"))e=V7(s,e);else break;return e}function xx(s){/\D/.test(s.next)&&s.err("Expected number, got '"+s.next+"'");let e=Number(s.next);return s.pos++,e}function V7(s,e){let t=xx(s),n=t;return s.eat(",")&&(s.next!="}"?n=xx(s):n=-1),s.eat("}")||s.err("Unclosed braced range"),{type:"range",min:t,max:n,expr:e}}function G7(s,e){let t=s.nodeTypes,n=t[e];if(n)return[n];let i=[];for(let r in t){let o=t[r];o.isInGroup(e)&&i.push(o)}return i.length==0&&s.err("No node type or group '"+e+"' found"),i}function K7(s){if(s.eat("(")){let e=YL(s);return s.eat(")")||s.err("Missing closing paren"),e}else if(/\W/.test(s.next))s.err("Unexpected token '"+s.next+"'");else{let e=G7(s,s.next).map(t=>(s.inline==null?s.inline=t.isInline:s.inline!=t.isInline&&s.err("Mixing inline and block content"),{type:"name",value:t}));return s.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function q7(s){let e=[[]];return i(r(s,0),t()),e;function t(){return e.push([])-1}function n(o,a,c){let l={term:c,to:a};return e[o].push(l),l}function i(o,a){o.forEach(c=>c.to=a)}function r(o,a){if(o.type=="choice")return o.exprs.reduce((c,l)=>c.concat(r(l,a)),[]);if(o.type=="seq")for(let c=0;;c++){let l=r(o.exprs[c],a);if(c==o.exprs.length-1)return l;i(l,a=t())}else if(o.type=="star"){let c=t();return n(a,c),i(r(o.expr,c),c),[n(c)]}else if(o.type=="plus"){let c=t();return i(r(o.expr,a),c),i(r(o.expr,c),c),[n(c)]}else{if(o.type=="opt")return[n(a)].concat(r(o.expr,a));if(o.type=="range"){let c=a;for(let l=0;l{s[o].forEach(({term:a,to:c})=>{if(!a)return;let l;for(let u=0;u{l||i.push([a,l=[]]),l.indexOf(u)==-1&&l.push(u)})})});let r=e[n.join(",")]=new If(n.indexOf(s.length-1)>-1);for(let o=0;o-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:e2(this.attrs,e)}create(e=null,t,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Tc(this,this.computeAttrs(e),He.from(t),As.setFrom(n))}createChecked(e=null,t,n){return t=He.from(t),this.checkContent(t),new Tc(this,this.computeAttrs(e),t,As.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=He.from(t),t.size){let o=this.contentMatch.fillBefore(t);if(!o)return null;t=o.append(t)}let i=this.contentMatch.matchFragment(t),r=i&&i.fillBefore(He.empty,!0);return r?new Tc(this,e,t.append(r),As.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let n=0;n-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;tn[r]=new n2(r,t,o));let i=t.spec.topNode||"doc";if(!n[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!n.text)throw new RangeError("Every schema needs a 'text' type");for(let r in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n}};function Y7(s,e,t){let n=t.split("|");return i=>{let r=i===null?"null":typeof i;if(n.indexOf(r)<0)throw new RangeError(`Expected value of type ${n} for attribute ${e} on type ${s}, got ${r}`)}}class J7{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate=typeof n.validate=="string"?Y7(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}}class dk{constructor(e,t,n,i){this.name=e,this.rank=t,this.schema=n,this.spec=i,this.attrs=s2(e,i.attrs),this.excluded=null;let r=ZL(this.attrs);this.instance=r?new As(this,r):null}create(e=null){return!e&&this.instance?this.instance:new As(this,e2(this.attrs,e))}static compile(e,t){let n=Object.create(null),i=0;return e.forEach((r,o)=>n[r]=new dk(r,i++,t,o)),n}removeFromSet(e){for(var t=0;t-1}}class i2{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let i in e)t[i]=e[i];t.nodes=oi.from(e.nodes),t.marks=oi.from(e.marks||{}),this.nodes=Ix.compile(this.spec.nodes,this),this.marks=dk.compile(this.spec.marks,this);let n=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let r=this.nodes[i],o=r.spec.content||"",a=r.spec.marks;if(r.contentMatch=n[o]||(n[o]=If.parse(o,this.nodes)),r.inlineContent=r.contentMatch.inlineContent,r.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!r.isInline||!r.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=r}r.markSet=a=="_"?null:a?Px(this,a.split(" ")):a==""||!r.inlineContent?[]:null}for(let i in this.marks){let r=this.marks[i],o=r.spec.excludes;r.excluded=o==null?[r]:o==""?[]:Px(this,o.split(" "))}this.nodeFromJSON=i=>Tc.fromJSON(this,i),this.markFromJSON=i=>As.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,n,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Ix){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,n,i)}text(e,t){let n=this.nodes.text;return new $S(n,n.defaultAttrs,e,As.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function Px(s,e){let t=[];for(let n=0;n-1)&&t.push(o=c)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[n]+"'")}return t}function Z7(s){return s.tag!=null}function eV(s){return s.style!=null}let Uv=class QT{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(i=>{if(Z7(i))this.tags.push(i);else if(eV(i)){let r=/[^=]*/.exec(i.style)[0];n.indexOf(r)<0&&n.push(r),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let r=e.nodes[i.node];return r.contentMatch.matchType(r)})}parse(e,t={}){let n=new Ox(this,t,!1);return n.addAll(e,As.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new Ox(this,t,!0);return n.addAll(e,As.none,t.from,t.to),tt.maxOpen(n.finish())}matchTag(e,t,n){for(let i=n?this.tags.indexOf(n)+1:0;ie.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(o.getAttrs){let c=o.getAttrs(t);if(c===!1)continue;o.attrs=c||void 0}return o}}}static schemaRules(e){let t=[];function n(i){let r=i.priority==null?50:i.priority,o=0;for(;o{n(o=Dx(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let r=e.nodes[i].spec.parseDOM;r&&r.forEach(o=>{n(o=Dx(o)),o.node||o.ignore||o.mark||(o.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new QT(e,QT.schemaRules(e)))}};const r2={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},tV={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},o2={ol:!0,ul:!0},uy=1,XT=2,Wv=4;function Lx(s,e,t){return e!=null?(e?uy:0)|(e==="full"?XT:0):s&&s.whitespace=="pre"?uy|XT:t&~Wv}class z_{constructor(e,t,n,i,r,o){this.type=e,this.attrs=t,this.marks=n,this.solid=i,this.options=o,this.content=[],this.activeMarks=As.none,this.match=r||(o&Wv?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(He.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let n=this.type.contentMatch,i;return(i=n.findWrapping(e.type))?(this.match=n,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&uy)){let n=this.content[this.content.length-1],i;if(n&&n.isText&&(i=/[ \t\r\n\u000c]+$/.exec(n.text))){let r=n;n.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=r.withText(r.text.slice(0,r.text.length-i[0].length))}}let t=He.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(He.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!r2.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Ox{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let i=t.topNode,r,o=Lx(null,t.preserveWhitespace,0)|(n?Wv:0);i?r=new z_(i.type,i.attrs,As.none,!0,t.topMatch||i.type.contentMatch,o):n?r=new z_(null,null,As.none,!0,null,o):r=new z_(e.schema.topNodeType,null,As.none,!0,null,o),this.nodes=[r],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,i=this.top,r=i.options&XT?"full":this.localPreserveWS||(i.options&uy)>0,{schema:o}=this.parser;if(r==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(r)if(r==="full")n=n.replace(/\r\n?/g,` `);else if(o.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(o.linebreakReplacement.create())){let a=n.split(/\r?\n|\r/);for(let c=0;c!c.clearMark(l)):t=t.concat(this.parser.schema.marks[c.mark].create(c.attrs)),c.consuming===!1)a=c;else break}}return t}addElementByRule(e,t,n,i){let r,o;if(t.node)if(o=this.parser.schema.nodes[t.node],o.isLeaf)this.insertNode(o.create(t.attrs),n,e.nodeName=="BR")||this.leafFallback(e,n);else{let c=this.enter(o,t.attrs||null,n,t.preserveWhitespace);c&&(r=!0,n=c)}else{let c=this.parser.schema.marks[t.mark];n=n.concat(c.create(t.attrs))}let a=this.top;if(o&&o.isLeaf)this.findInside(e);else if(i)this.addElement(e,n,i);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(c=>this.insertNode(c,n,!1));else{let c=e;typeof t.contentElement=="string"?c=e.querySelector(t.contentElement):typeof t.contentElement=="function"?c=t.contentElement(e):t.contentElement&&(c=t.contentElement),this.findAround(e,c,!0),this.addAll(c,n),this.findAround(e,c,!1)}r&&this.sync(a)&&this.open--}addAll(e,t,n,i){let r=n||0;for(let o=n?e.childNodes[n]:e.firstChild,a=i==null?null:e.childNodes[i];o!=a;o=o.nextSibling,++r)this.findAtPoint(e,r),this.addDOM(o,t);this.findAtPoint(e,r)}findPlace(e,t,n){let i,r;for(let o=this.open,a=0;o>=0;o--){let c=this.nodes[o],l=c.findWrapping(e);if(l&&(!i||i.length>l.length+a)&&(i=l,r=c,!l.length))break;if(c.solid){if(n)break;a+=2}}if(!i)return null;this.sync(r);for(let o=0;o(o.type?o.type.allowsMarkType(l.type):Nx(l.type,e))?(c=l.addToSet(c),!1):!0),this.nodes.push(new z_(e,t,c,i,null,a)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=uy)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let i=n.length-1;i>=0;i--)e+=n[i].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),n=this.options.context,i=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),r=-(n?n.depth+1:0)+(i?0:1),o=(a,c)=>{for(;a>=0;a--){let l=t[a];if(l==""){if(a==t.length-1||a==0)continue;for(;c>=r;c--)if(o(a-1,c))return!0;return!1}else{let u=c>0||c==0&&i?this.nodes[c].type:n&&c>=r?n.node(c-r).type:null;if(!u||u.name!=l&&!u.isInGroup(l))return!1;c--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let t in this.parser.schema.nodes){let n=this.parser.schema.nodes[t];if(n.isTextblock&&n.defaultAttrs)return n}}}function sV(s){for(let e=s.firstChild,t=null;e;e=e.nextSibling){let n=e.nodeType==1?e.nodeName.toLowerCase():null;n&&o2.hasOwnProperty(n)&&t?(t.appendChild(e),e=t):n=="li"?t=e:n&&(t=null)}}function nV(s,e){return(s.matches||s.msMatchesSelector||s.webkitMatchesSelector||s.mozMatchesSelector).call(s,e)}function Dx(s){let e={};for(let t in s)e[t]=s[t];return e}function Nx(s,e){let t=e.schema.nodes;for(let n in t){let i=t[n];if(!i.allowsMarkType(s))continue;let r=[],o=a=>{r.push(a);for(let c=0;c{if(r.length||o.marks.length){let a=0,c=0;for(;a=0;i--){let r=this.serializeMark(e.marks[i],e.isInline,t);r&&((r.contentDOM||r.dom).appendChild(n),n=r.dom)}return n}serializeMark(e,t,n={}){let i=this.marks[e.type.name];return i&&Aw(j_(n),i(e,t),null,e.attrs)}static renderSpec(e,t,n=null,i){return typeof t=="string"?{dom:e.createTextNode(t)}:Aw(e,t,n,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Hf(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=$x(e.nodes);return t.text||(t.text=n=>n.text),t}static marksFromSchema(e){return $x(e.marks)}}function $x(s){let e={};for(let t in s){let n=s[t].spec.toDOM;n&&(e[t]=n)}return e}function j_(s){return s.document||window.document}const Bx=new WeakMap;function iV(s){let e=Bx.get(s);return e===void 0&&Bx.set(s,e=rV(s)),e}function rV(s){let e=null;function t(n){if(n&&typeof n=="object")if(Array.isArray(n))if(typeof n[0]=="string")e||(e=[]),e.push(n);else for(let i=0;i-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=i.indexOf(" ");o>0&&(t=i.slice(0,o),i=i.slice(o+1));let a,c=t?s.createElementNS(t,i):s.createElement(i),l=e[1],u=1;if(l&&typeof l=="object"&&l.nodeType==null&&!Array.isArray(l)){u=2;for(let d in l)if(l[d]!=null){let h=d.indexOf(" ");h>0?c.setAttributeNS(d.slice(0,h),d.slice(h+1),l[d]):d=="style"&&c.style?c.style.cssText=l[d]:c.setAttribute(d,l[d])}}for(let d=u;du)throw new RangeError("Content hole must be the only child of its parent node");return{dom:c,contentDOM:c}}else if(typeof h=="string")c.appendChild(s.createTextNode(h));else{let{dom:p,contentDOM:g}=Aw(s,h,t,n);if(c.appendChild(p),g){if(a)throw new RangeError("Multiple content holes");a=g}}}return{dom:c,contentDOM:a}}const a2=65535,l2=Math.pow(2,16);function oV(s,e){return s+e*l2}function Fx(s){return s&a2}function aV(s){return(s-(s&a2))/l2}const c2=1,u2=2,Ew=4,d2=8;let YT=class{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&d2)>0}get deletedBefore(){return(this.delInfo&(c2|Ew))>0}get deletedAfter(){return(this.delInfo&(u2|Ew))>0}get deletedAcross(){return(this.delInfo&Ew)>0}},Pf=class dp{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&dp.empty)return dp.empty}recover(e){let t=0,n=Fx(e);if(!this.inverted)for(let i=0;ie)break;let l=this.ranges[a+r],u=this.ranges[a+o],d=c+l;if(e<=d){let h=l?e==c?-1:e==d?1:t:t,p=c+i+(h<0?0:u);if(n)return p;let g=e==(t<0?c:d)?null:oV(a/3,e-c),v=e==c?u2:e==d?c2:Ew;return(t<0?e!=c:e!=d)&&(v|=d2),new YT(p,v,g)}i+=u-l}return n?e+i:new YT(e+i,0,null)}touches(e,t){let n=0,i=Fx(t),r=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;ae)break;let l=this.ranges[a+r],u=c+l;if(e<=u&&a==i*3)return!0;n+=this.ranges[a+o]-l}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let i=0,r=0;i=0;t--){let i=e.getMirror(t);this.appendMap(e._maps[t].invert(),i!=null&&i>t?n-i-1:void 0)}}invert(){let e=new dy;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;nr&&c!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),t.openStart,t.openEnd);return tr.fromReplace(e,this.from,this.to,r)}invert(){return new _g(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new Gg(t.pos,n.pos,this.mark)}merge(e){return e instanceof Gg&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Gg(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Gg(t.from,t.to,e.markFromJSON(t.mark))}};Pi.jsonID("addMark",$E);let _g=class Kg extends Pi{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new tt(NE(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return tr.fromReplace(e,this.from,this.to,n)}invert(){return new $E(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new Kg(t.pos,n.pos,this.mark)}merge(e){return e instanceof Kg&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Kg(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Kg(t.from,t.to,e.markFromJSON(t.mark))}};Pi.jsonID("removeMark",_g);let BE=class qg extends Pi{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return tr.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return tr.fromReplace(e,this.pos,this.pos+1,new tt(He.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let n=this.mark.addToSet(t.marks);if(n.length==t.marks.length){for(let i=0;in.pos?null:new Mw(t.pos,n.pos,i,r,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Mw(t.from,t.to,t.gapFrom,t.gapTo,tt.fromJSON(e,t.slice),t.insert,!!t.structure)}};Pi.jsonID("replaceAround",Tr);function ZT(s,e,t){let n=s.resolve(e),i=t-e,r=n.depth;for(;i>0&&r>0&&n.indexAfter(r)==n.node(r).childCount;)r--,i--;if(i>0){let o=n.node(r).maybeChild(n.indexAfter(r));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function lV(s,e,t,n){let i=[],r=[],o,a;s.doc.nodesBetween(e,t,(c,l,u)=>{if(!c.isInline)return;let d=c.marks;if(!n.isInSet(d)&&u.type.allowsMarkType(n.type)){let h=Math.max(l,e),p=Math.min(l+c.nodeSize,t),g=n.addToSet(d);for(let v=0;vs.step(c)),r.forEach(c=>s.step(c))}function cV(s,e,t,n){let i=[],r=0;s.doc.nodesBetween(e,t,(o,a)=>{if(!o.isInline)return;r++;let c=null;if(n instanceof dk){let l=o.marks,u;for(;u=n.isInSet(l);)(c||(c=[])).push(u),l=u.removeFromSet(l)}else n?n.isInSet(o.marks)&&(c=[n]):c=o.marks;if(c&&c.length){let l=Math.min(a+o.nodeSize,t);for(let u=0;us.step(new _g(o.from,o.to,o.style)))}function FE(s,e,t,n=t.contentMatch,i=!0){let r=s.doc.nodeAt(e),o=[],a=e+1;for(let c=0;c=0;c--)s.step(o[c])}function uV(s,e,t){return(e==0||s.canReplace(e,s.childCount))&&(t==s.childCount||s.canReplace(0,t))}function wg(s){let t=s.parent.content.cutByIndex(s.startIndex,s.endIndex);for(let n=s.depth,i=0,r=0;;--n){let o=s.$from.node(n),a=s.$from.index(n)+i,c=s.$to.indexAfter(n)-r;if(nt;g--)v||n.index(g)>0?(v=!0,u=He.from(n.node(g).copy(u)),d++):c--;let h=He.empty,p=0;for(let g=r,v=!1;g>t;g--)v||i.after(g+1)=0;o--){if(n.size){let a=t[o].type.contentMatch.matchFragment(n);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}n=He.from(t[o].type.create(t[o].attrs,n))}let i=e.start,r=e.end;s.step(new Tr(i,r,i,r,new tt(n,0,0),t.length,!0))}function mV(s,e,t,n,i){if(!n.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let r=s.steps.length;s.doc.nodesBetween(e,t,(o,a)=>{let c=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(n,c)&&gV(s.doc,s.mapping.slice(r).map(a),n)){let l=null;if(n.schema.linebreakReplacement){let p=n.whitespace=="pre",g=!!n.contentMatch.matchType(n.schema.linebreakReplacement);p&&!g?l=!1:!p&&g&&(l=!0)}l===!1&&f2(s,o,a,r),FE(s,s.mapping.slice(r).map(a,1),n,void 0,l===null);let u=s.mapping.slice(r),d=u.map(a,1),h=u.map(a+o.nodeSize,1);return s.step(new Tr(d,h,d+1,h-1,new tt(He.from(n.create(c,null,o.marks)),0,0),1,!0)),l===!0&&h2(s,o,a,r),!1}})}function h2(s,e,t,n){e.forEach((i,r)=>{if(i.isText){let o,a=/\r?\n|\r/g;for(;o=a.exec(i.text);){let c=s.mapping.slice(n).map(t+1+r+o.index);s.replaceWith(c,c+1,e.type.schema.linebreakReplacement.create())}}})}function f2(s,e,t,n){e.forEach((i,r)=>{if(i.type==i.type.schema.linebreakReplacement){let o=s.mapping.slice(n).map(t+1+r);s.replaceWith(o,o+1,e.type.schema.text(` `))}})}function gV(s,e,t){let n=s.resolve(e),i=n.index();return n.parent.canReplaceWith(i,i+1,t)}function vV(s,e,t,n,i){let r=s.doc.nodeAt(e);if(!r)throw new RangeError("No node at given position");t||(t=r.type);let o=t.create(n,null,i||r.marks);if(r.isLeaf)return s.replaceWith(e,e+r.nodeSize,o);if(!t.validContent(r.content))throw new RangeError("Invalid content for node type "+t.name);s.step(new Tr(e,e+r.nodeSize,e+1,e+r.nodeSize-1,new tt(He.from(o),0,0),1,!0))}function Ac(s,e,t=1,n){let i=s.resolve(e),r=i.depth-t,o=n&&n[n.length-1]||i.parent;if(r<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let l=i.depth-1,u=t-2;l>r;l--,u--){let d=i.node(l),h=i.index(l);if(d.type.spec.isolating)return!1;let p=d.content.cutByIndex(h,d.childCount),g=n&&n[u+1];g&&(p=p.replaceChild(0,g.type.create(g.attrs)));let v=n&&n[u]||d;if(!d.canReplace(h+1,d.childCount)||!v.type.validContent(p))return!1}let a=i.indexAfter(r),c=n&&n[0];return i.node(r).canReplaceWith(a,a,c?c.type:i.node(r+1).type)}function yV(s,e,t=1,n){let i=s.doc.resolve(e),r=He.empty,o=He.empty;for(let a=i.depth,c=i.depth-t,l=t-1;a>c;a--,l--){r=He.from(i.node(a).copy(r));let u=n&&n[l];o=He.from(u?u.type.create(u.attrs,o):i.node(a).copy(o))}s.step(new jo(e,e,new tt(r.append(o),t,t),!0))}function vd(s,e){let t=s.resolve(e),n=t.index();return p2(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(n,n+1)}function bV(s,e){e.content.size||s.type.compatibleContent(e.type);let t=s.contentMatchAt(s.childCount),{linebreakReplacement:n}=s.type.schema;for(let i=0;i0?(r=n.node(i+1),a++,o=n.node(i).maybeChild(a)):(r=n.node(i).maybeChild(a-1),o=n.node(i+1)),r&&!r.isTextblock&&p2(r,o)&&n.node(i).canReplace(a,a+1))return e;if(i==0)break;e=t<0?n.before(i):n.after(i)}}function _V(s,e,t){let n=null,{linebreakReplacement:i}=s.doc.type.schema,r=s.doc.resolve(e-t),o=r.node().type;if(i&&o.inlineContent){let u=o.whitespace=="pre",d=!!o.contentMatch.matchType(i);u&&!d?n=!1:!u&&d&&(n=!0)}let a=s.steps.length;if(n===!1){let u=s.doc.resolve(e+t);f2(s,u.node(),u.before(),a)}o.inlineContent&&FE(s,e+t-1,o,r.node().contentMatchAt(r.index()),n==null);let c=s.mapping.slice(a),l=c.map(e-t);if(s.step(new jo(l,c.map(e+t,-1),tt.empty,!0)),n===!0){let u=s.doc.resolve(l);h2(s,u.node(),u.before(),s.steps.length)}return s}function wV(s,e,t){let n=s.resolve(e);if(n.parent.canReplaceWith(n.index(),n.index(),t))return e;if(n.parentOffset==0)for(let i=n.depth-1;i>=0;i--){let r=n.index(i);if(n.node(i).canReplaceWith(r,r,t))return n.before(i+1);if(r>0)return null}if(n.parentOffset==n.parent.content.size)for(let i=n.depth-1;i>=0;i--){let r=n.indexAfter(i);if(n.node(i).canReplaceWith(r,r,t))return n.after(i+1);if(r=0;o--){let a=o==n.depth?0:n.pos<=(n.start(o+1)+n.end(o+1))/2?-1:1,c=n.index(o)+(a>0?1:0),l=n.node(o),u=!1;if(r==1)u=l.canReplace(c,c,i);else{let d=l.contentMatchAt(c).findWrapping(i.firstChild.type);u=d&&l.canReplaceWith(c,c,d[0])}if(u)return a==0?n.pos:a<0?n.before(o+1):n.after(o+1)}return null}function fk(s,e,t=e,n=tt.empty){if(e==t&&!n.size)return null;let i=s.resolve(e),r=s.resolve(t);return g2(i,r,n)?new jo(e,t,n):new SV(i,r,n).fit()}function g2(s,e,t){return!t.openStart&&!t.openEnd&&s.start()==e.start()&&s.parent.canReplace(s.index(),e.index(),t.content)}class SV{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=He.empty;for(let i=0;i<=e.depth;i++){let r=e.node(i);this.frontier.push({type:r.type,match:r.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=He.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let l=this.findFittable();l?this.placeNodes(l):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,i=this.close(e<0?this.$to:n.doc.resolve(e));if(!i)return null;let r=this.placed,o=n.depth,a=i.depth;for(;o&&a&&r.childCount==1;)r=r.firstChild.content,o--,a--;let c=new tt(r,o,a);return e>-1?new Tr(n.pos,e,this.$to.pos,this.$to.end(),c,t):c.size||n.pos!=this.$to.pos?new jo(n.pos,i.pos,c):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,i=this.unplaced.openEnd;n1&&(i=0),r.type.spec.isolating&&i<=n){e=n;break}t=r.content}for(let t=1;t<=2;t++)for(let n=t==1?e:this.unplaced.openStart;n>=0;n--){let i,r=null;n?(r=kC(this.unplaced.content,n-1).firstChild,i=r.content):i=this.unplaced.content;let o=i.firstChild;for(let a=this.depth;a>=0;a--){let{type:c,match:l}=this.frontier[a],u,d=null;if(t==1&&(o?l.matchType(o.type)||(d=l.fillBefore(He.from(o),!1)):r&&c.compatibleContent(r.type)))return{sliceDepth:n,frontierDepth:a,parent:r,inject:d};if(t==2&&o&&(u=l.findWrapping(o.type)))return{sliceDepth:n,frontierDepth:a,parent:r,wrap:u};if(r&&l.matchType(r.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,i=kC(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new tt(e,t+1,Math.max(n,i.size+t>=e.size-n?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,i=kC(e,t);if(i.childCount<=1&&t>0){let r=e.size-t<=t+i.size;this.unplaced=new tt(Qg(e,t-1,1),t-1,r?t-1:n)}else this.unplaced=new tt(Qg(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:i,wrap:r}){for(;this.depth>t;)this.closeFrontierNode();if(r)for(let v=0;v1||c==0||v.content.size)&&(d=m,u.push(v2(v.mark(h.allowedMarks(v.marks)),l==1?c:0,l==a.childCount?p:-1)))}let g=l==a.childCount;g||(p=-1),this.placed=Xg(this.placed,t,He.from(u)),this.frontier[t].match=d,g&&p<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let v=0,m=a;v1&&i==this.$to.end(--n);)++i;return i}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:i}=this.frontier[t],r=t=0;a--){let{match:c,type:l}=this.frontier[a],u=CC(e,a,l,c,!0);if(!u||u.childCount)continue e}return{depth:t,fit:o,move:r?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=Xg(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let i=e.node(n),r=i.type.contentMatch.fillBefore(i.content,!0,e.index(n));this.openFrontierNode(i.type,i.attrs,r)}return e}openFrontierNode(e,t=null,n){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Xg(this.placed,this.depth,He.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(He.empty,!0);t.childCount&&(this.placed=Xg(this.placed,this.frontier.length,t))}}function Qg(s,e,t){return e==0?s.cutByIndex(t,s.childCount):s.replaceChild(0,s.firstChild.copy(Qg(s.firstChild.content,e-1,t)))}function Xg(s,e,t){return e==0?s.append(t):s.replaceChild(s.childCount-1,s.lastChild.copy(Xg(s.lastChild.content,e-1,t)))}function kC(s,e){for(let t=0;t1&&(n=n.replaceChild(0,v2(n.firstChild,e-1,n.childCount==1?t-1:0))),e>0&&(n=s.type.contentMatch.fillBefore(n).append(n),t<=0&&(n=n.append(s.type.contentMatch.matchFragment(n).fillBefore(He.empty,!0)))),s.copy(n)}function CC(s,e,t,n,i){let r=s.node(e),o=i?s.indexAfter(e):s.index(e);if(o==r.childCount&&!t.compatibleContent(r.type))return null;let a=n.fillBefore(r.content,!0,o);return a&&!kV(t,r.content,o)?a:null}function kV(s,e,t){for(let n=t;n0;h--,p--){let g=i.node(h).type.spec;if(g.defining||g.definingAsContext||g.isolating)break;o.indexOf(h)>-1?a=h:i.before(h)==p&&o.splice(1,0,-h)}let c=o.indexOf(a),l=[],u=n.openStart;for(let h=n.content,p=0;;p++){let g=h.firstChild;if(l.push(g),p==n.openStart)break;h=g.content}for(let h=u-1;h>=0;h--){let p=l[h],g=CV(p.type);if(g&&!p.sameMarkup(i.node(Math.abs(a)-1)))u=h;else if(g||!p.type.isTextblock)break}for(let h=n.openStart;h>=0;h--){let p=(h+u+1)%(n.openStart+1),g=l[p];if(g)for(let v=0;v=0&&(s.replace(e,t,n),!(s.steps.length>d));h--){let p=o[h];p<0||(e=i.before(p),t=r.after(p))}}function y2(s,e,t,n,i){if(en){let r=i.contentMatchAt(0),o=r.fillBefore(s).append(s);s=o.append(r.matchFragment(o).fillBefore(He.empty,!0))}return s}function AV(s,e,t,n){if(!n.isInline&&e==t&&s.doc.resolve(e).parent.content.size){let i=wV(s.doc,e,n.type);i!=null&&(e=t=i)}s.replaceRange(e,t,new tt(He.from(n),0,0))}function EV(s,e,t){let n=s.doc.resolve(e),i=s.doc.resolve(t);if(n.parent.isTextblock&&i.parent.isTextblock&&n.start()!=i.start()&&n.parentOffset==0&&i.parentOffset==0){let o=n.sharedDepth(t),a=!1;for(let c=n.depth;c>o;c--)n.node(c).type.spec.isolating&&(a=!0);for(let c=i.depth;c>o;c--)i.node(c).type.spec.isolating&&(a=!0);if(!a){for(let c=n.depth;c>0&&e==n.start(c);c--)e=n.before(c);for(let c=i.depth;c>0&&t==i.start(c);c--)t=i.before(c);n=s.doc.resolve(e),i=s.doc.resolve(t)}}let r=b2(n,i);for(let o=0;o0&&(c||n.node(a-1).canReplace(n.index(a-1),i.indexAfter(a-1))))return s.delete(n.before(a),i.after(a))}for(let o=1;o<=n.depth&&o<=i.depth;o++)if(e-n.start(o)==n.depth-o&&t>n.end(o)&&i.end(o)-t!=i.depth-o&&n.start(o-1)==i.start(o-1)&&n.node(o-1).canReplace(n.index(o-1),i.index(o-1)))return s.delete(n.before(o),t);s.delete(e,t)}function b2(s,e){let t=[],n=Math.min(s.depth,e.depth);for(let i=n;i>=0;i--){let r=s.start(i);if(re.pos+(e.depth-i)||s.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(r==e.start(i)||i==s.depth&&i==e.depth&&s.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==r-1)&&t.push(i)}return t}let _2=class xw extends Pi{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return tr.fail("No node at attribute step's position");let n=Object.create(null);for(let r in t.attrs)n[r]=t.attrs[r];n[this.attr]=this.value;let i=t.type.create(n,null,t.marks);return tr.fromReplace(e,this.pos,this.pos+1,new tt(He.from(i),0,t.isLeaf?0:1))}getMap(){return Pf.empty}invert(e){return new xw(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new xw(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new xw(t.pos,t.attr,t.value)}};Pi.jsonID("attr",_2);let w2=class e1 extends Pi{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let i in e.attrs)t[i]=e.attrs[i];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return tr.ok(n)}getMap(){return Pf.empty}invert(e){return new e1(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new e1(t.attr,t.value)}};Pi.jsonID("docAttr",w2);let og=class extends Error{};og=function s(e){let t=Error.call(this,e);return t.__proto__=s.prototype,t};og.prototype=Object.create(Error.prototype);og.prototype.constructor=og;og.prototype.name="TransformError";class S2{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new dy}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new og(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let n=0;n{e=Math.min(e,a),t=Math.max(t,c)})}return e==1e9?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=tt.empty){let i=fk(this.doc,e,t,n);return i&&this.step(i),this}replaceWith(e,t,n){return this.replace(e,t,new tt(He.from(n),0,0))}delete(e,t){return this.replace(e,t,tt.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return TV(this,e,t,n),this}replaceRangeWith(e,t,n){return AV(this,e,t,n),this}deleteRange(e,t){return EV(this,e,t),this}lift(e,t){return dV(this,e,t),this}join(e,t=1){return _V(this,e,t),this}wrap(e,t){return pV(this,e,t),this}setBlockType(e,t=e,n,i=null){return mV(this,e,t,n,i),this}setNodeMarkup(e,t,n=null,i){return vV(this,e,t,n,i),this}setNodeAttribute(e,t,n){return this.step(new _2(e,t,n)),this}setDocAttribute(e,t){return this.step(new w2(e,t)),this}addNodeMark(e,t){return this.step(new BE(e,t)),this}removeNodeMark(e,t){let n=this.doc.nodeAt(e);if(!n)throw new RangeError("No node at position "+e);if(t instanceof As)t.isInSet(n.marks)&&this.step(new BS(e,t));else{let i=n.marks,r,o=[];for(;r=t.isInSet(i);)o.push(new BS(e,r)),i=r.removeFromSet(i);for(let a=o.length-1;a>=0;a--)this.step(o[a])}return this}split(e,t=1,n){return yV(this,e,t,n),this}addMark(e,t,n){return lV(this,e,t,n),this}removeMark(e,t,n){return cV(this,e,t,n),this}clearIncompatible(e,t,n){return FE(this,e,t,n),this}}const TC=Object.create(null);let Ht=class{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new MV(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t=0;r--){let o=t<0?hp(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):hp(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,t,n);if(o)return o}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Ec(e.node(0))}static atStart(e){return hp(e,e,0,0,1)||new Ec(e)}static atEnd(e){return hp(e,e,e.content.size,e.childCount,-1)||new Ec(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=TC[t.type];if(!n)throw new RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in TC)throw new RangeError("Duplicate use of selection JSON ID "+e);return TC[e]=t,t.prototype.jsonID=e,t}getBookmark(){return kt.between(this.$anchor,this.$head).getBookmark()}};Ht.prototype.visible=!0;let MV=class{constructor(e,t){this.$from=e,this.$to=t}},Ux=!1;function Wx(s){!Ux&&!s.parent.inlineContent&&(Ux=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+s.parent.type.name+")"))}let kt=class Yg extends Ht{constructor(e,t=e){Wx(e),Wx(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let n=e.resolve(t.map(this.head));if(!n.parent.inlineContent)return Ht.near(n);let i=e.resolve(t.map(this.anchor));return new Yg(i.parent.inlineContent?i:n,n)}replace(e,t=tt.empty){if(super.replace(e,t),t==tt.empty){let n=this.$from.marksAcross(this.$to);n&&e.ensureMarks(n)}}eq(e){return e instanceof Yg&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new k2(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new Yg(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){let i=e.resolve(t);return new this(i,n==t?i:e.resolve(n))}static between(e,t,n){let i=e.pos-t.pos;if((!n||i)&&(n=i>=0?1:-1),!t.parent.inlineContent){let r=Ht.findFrom(t,n,!0)||Ht.findFrom(t,-n,!0);if(r)t=r.$head;else return Ht.near(t,n)}return e.parent.inlineContent||(i==0?e=t:(e=(Ht.findFrom(e,-n,!0)||Ht.findFrom(e,n,!0)).$anchor,e.pos0?0:1);i>0?o=0;o+=i){let a=e.child(o);if(a.isAtom){if(!r&&_t.isSelectable(a))return _t.create(s,t-(i<0?a.nodeSize:0))}else{let c=hp(s,a,t+i,i<0?a.childCount:0,i,r);if(c)return c}t+=a.nodeSize*i}return null}function zx(s,e,t){let n=s.steps.length-1;if(n{o==null&&(o=u)}),s.setSelection(Ht.near(s.doc.resolve(o),t))}const jx=1,V_=2,Vx=4;class IV extends S2{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor0}setStoredMarks(e){return this.storedMarks=e,this.updated|=V_,this}ensureMarks(e){return As.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&V_)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~V_,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||As.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let i=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(n==null&&(n=t),!e)return this.deleteRange(t,n);let r=this.storedMarks;if(!r){let o=this.doc.resolve(t);r=n==t?o.marks():o.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,i.text(e,r)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(Ht.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=Vx,this}get scrolledIntoView(){return(this.updated&Vx)>0}}function Gx(s,e){return!e||!s?s:s.bind(e)}let Zg=class{constructor(e,t,n){this.name=e,this.init=Gx(t.init,n),this.apply=Gx(t.apply,n)}};const PV=[new Zg("doc",{init(s){return s.doc||s.schema.topNodeType.createAndFill()},apply(s){return s.doc}}),new Zg("selection",{init(s,e){return s.selection||Ht.atStart(e.doc)},apply(s){return s.selection}}),new Zg("storedMarks",{init(s){return s.storedMarks||null},apply(s,e,t,n){return n.selection.$cursor?s.storedMarks:null}}),new Zg("scrollToSelection",{init(){return 0},apply(s,e){return s.scrolledIntoView?e+1:e}})];class AC{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=PV.slice(),t&&t.forEach(n=>{if(this.pluginsByKey[n.key])throw new RangeError("Adding different instances of a keyed plugin ("+n.key+")");this.plugins.push(n),this.pluginsByKey[n.key]=n,n.spec.state&&this.fields.push(new Zg(n.key,n.spec.state,n))})}}class Tp{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let n=0;nn.toJSON())),e&&typeof e=="object")for(let n in e){if(n=="doc"||n=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[n],r=i.spec.state;r&&r.toJSON&&(t[n]=r.toJSON.call(i,this[i.key]))}return t}static fromJSON(e,t,n){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new AC(e.schema,e.plugins),r=new Tp(i);return i.fields.forEach(o=>{if(o.name=="doc")r.doc=Tc.fromJSON(e.schema,t.doc);else if(o.name=="selection")r.selection=Ht.fromJSON(r.doc,t.selection);else if(o.name=="storedMarks")t.storedMarks&&(r.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(n)for(let a in n){let c=n[a],l=c.spec.state;if(c.key==o.name&&l&&l.fromJSON&&Object.prototype.hasOwnProperty.call(t,a)){r[o.name]=l.fromJSON.call(c,e,t[a],r);return}}r[o.name]=o.init(e,r)}}),r}}function A2(s,e,t){for(let n in s){let i=s[n];i instanceof Function?i=i.bind(e):n=="handleDOMEvents"&&(i=A2(i,e,{})),t[n]=i}return t}class Gs{constructor(e){this.spec=e,this.props={},e.props&&A2(e.props,this,this.props),this.key=e.key?e.key.key:E2("plugin")}getState(e){return e[this.key]}}const EC=Object.create(null);function E2(s){return s in EC?s+"$"+ ++EC[s]:(EC[s]=0,s+"$")}class _n{constructor(e="key"){this.key=E2(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const M2=(s,e)=>s.selection.empty?!1:(e&&e(s.tr.deleteSelection().scrollIntoView()),!0);function x2(s,e){let{$cursor:t}=s.selection;return!t||(e?!e.endOfTextblock("backward",s):t.parentOffset>0)?null:t}const R2=(s,e,t)=>{let n=x2(s,t);if(!n)return!1;let i=UE(n);if(!i){let o=n.blockRange(),a=o&&wg(o);return a==null?!1:(e&&e(s.tr.lift(o,a).scrollIntoView()),!0)}let r=i.nodeBefore;if(F2(s,i,e,-1))return!0;if(n.parent.content.size==0&&(ag(r,"end")||_t.isSelectable(r)))for(let o=n.depth;;o--){let a=fk(s.doc,n.before(o),n.after(o),tt.empty);if(a&&a.slice.size1)break}return r.isAtom&&i.depth==n.depth-1?(e&&e(s.tr.delete(i.pos-r.nodeSize,i.pos).scrollIntoView()),!0):!1},LV=(s,e,t)=>{let n=x2(s,t);if(!n)return!1;let i=UE(n);return i?I2(s,i,e):!1},OV=(s,e,t)=>{let n=L2(s,t);if(!n)return!1;let i=WE(n);return i?I2(s,i,e):!1};function I2(s,e,t){let n=e.nodeBefore,i=n,r=e.pos-1;for(;!i.isTextblock;r--){if(i.type.spec.isolating)return!1;let u=i.lastChild;if(!u)return!1;i=u}let o=e.nodeAfter,a=o,c=e.pos+1;for(;!a.isTextblock;c++){if(a.type.spec.isolating)return!1;let u=a.firstChild;if(!u)return!1;a=u}let l=fk(s.doc,r,c,tt.empty);if(!l||l.from!=r||l instanceof jo&&l.slice.size>=c-r)return!1;if(t){let u=s.tr.step(l);u.setSelection(kt.create(u.doc,r)),t(u.scrollIntoView())}return!0}function ag(s,e,t=!1){for(let n=s;n;n=e=="start"?n.firstChild:n.lastChild){if(n.isTextblock)return!0;if(t&&n.childCount!=1)return!1}return!1}const P2=(s,e,t)=>{let{$head:n,empty:i}=s.selection,r=n;if(!i)return!1;if(n.parent.isTextblock){if(t?!t.endOfTextblock("backward",s):n.parentOffset>0)return!1;r=UE(n)}let o=r&&r.nodeBefore;return!o||!_t.isSelectable(o)?!1:(e&&e(s.tr.setSelection(_t.create(s.doc,r.pos-o.nodeSize)).scrollIntoView()),!0)};function UE(s){if(!s.parent.type.spec.isolating)for(let e=s.depth-1;e>=0;e--){if(s.index(e)>0)return s.doc.resolve(s.before(e+1));if(s.node(e).type.spec.isolating)break}return null}function L2(s,e){let{$cursor:t}=s.selection;return!t||(e?!e.endOfTextblock("forward",s):t.parentOffset{let n=L2(s,t);if(!n)return!1;let i=WE(n);if(!i)return!1;let r=i.nodeAfter;if(F2(s,i,e,1))return!0;if(n.parent.content.size==0&&(ag(r,"start")||_t.isSelectable(r))){let o=fk(s.doc,n.before(),n.after(),tt.empty);if(o&&o.slice.size{let{$head:n,empty:i}=s.selection,r=n;if(!i)return!1;if(n.parent.isTextblock){if(t?!t.endOfTextblock("forward",s):n.parentOffset=0;e--){let t=s.node(e);if(s.index(e)+1{let t=s.selection,n=t instanceof _t,i;if(n){if(t.node.isTextblock||!vd(s.doc,t.from))return!1;i=t.from}else if(i=hk(s.doc,t.from,-1),i==null)return!1;if(e){let r=s.tr.join(i);n&&r.setSelection(_t.create(r.doc,i-s.doc.resolve(i).nodeBefore.nodeSize)),e(r.scrollIntoView())}return!0},NV=(s,e)=>{let t=s.selection,n;if(t instanceof _t){if(t.node.isTextblock||!vd(s.doc,t.to))return!1;n=t.to}else if(n=hk(s.doc,t.to,1),n==null)return!1;return e&&e(s.tr.join(n).scrollIntoView()),!0},$V=(s,e)=>{let{$from:t,$to:n}=s.selection,i=t.blockRange(n),r=i&&wg(i);return r==null?!1:(e&&e(s.tr.lift(i,r).scrollIntoView()),!0)},N2=(s,e)=>{let{$head:t,$anchor:n}=s.selection;return!t.parent.type.spec.code||!t.sameParent(n)?!1:(e&&e(s.tr.insertText(` `).scrollIntoView()),!0)};function zE(s){for(let e=0;e{let{$head:t,$anchor:n}=s.selection;if(!t.parent.type.spec.code||!t.sameParent(n))return!1;let i=t.node(-1),r=t.indexAfter(-1),o=zE(i.contentMatchAt(r));if(!o||!i.canReplaceWith(r,r,o))return!1;if(e){let a=t.after(),c=s.tr.replaceWith(a,a,o.createAndFill());c.setSelection(Ht.near(c.doc.resolve(a),1)),e(c.scrollIntoView())}return!0},$2=(s,e)=>{let t=s.selection,{$from:n,$to:i}=t;if(t instanceof Ec||n.parent.inlineContent||i.parent.inlineContent)return!1;let r=zE(i.parent.contentMatchAt(i.indexAfter()));if(!r||!r.isTextblock)return!1;if(e){let o=(!n.parentOffset&&i.index(){let{$cursor:t}=s.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let r=t.before();if(Ac(s.doc,r))return e&&e(s.tr.split(r).scrollIntoView()),!0}let n=t.blockRange(),i=n&&wg(n);return i==null?!1:(e&&e(s.tr.lift(n,i).scrollIntoView()),!0)};function FV(s){return(e,t)=>{let{$from:n,$to:i}=e.selection;if(e.selection instanceof _t&&e.selection.node.isBlock)return!n.parentOffset||!Ac(e.doc,n.pos)?!1:(t&&t(e.tr.split(n.pos).scrollIntoView()),!0);if(!n.depth)return!1;let r=[],o,a,c=!1,l=!1;for(let p=n.depth;;p--)if(n.node(p).isBlock){c=n.end(p)==n.pos+(n.depth-p),l=n.start(p)==n.pos-(n.depth-p),a=zE(n.node(p-1).contentMatchAt(n.indexAfter(p-1))),r.unshift(c&&a?{type:a}:null),o=p;break}else{if(p==1)return!1;r.unshift(null)}let u=e.tr;(e.selection instanceof kt||e.selection instanceof Ec)&&u.deleteSelection();let d=u.mapping.map(n.pos),h=Ac(u.doc,d,r.length,r);if(h||(r[0]=a?{type:a}:null,h=Ac(u.doc,d,r.length,r)),!h)return!1;if(u.split(d,r.length,r),!c&&l&&n.node(o).type!=a){let p=u.mapping.map(n.before(o)),g=u.doc.resolve(p);a&&n.node(o-1).canReplaceWith(g.index(),g.index()+1,a)&&u.setNodeMarkup(u.mapping.map(n.before(o)),a)}return t&&t(u.scrollIntoView()),!0}}const HV=FV(),UV=(s,e)=>{let{$from:t,to:n}=s.selection,i,r=t.sharedDepth(n);return r==0?!1:(i=t.before(r),e&&e(s.tr.setSelection(_t.create(s.doc,i))),!0)};function WV(s,e,t){let n=e.nodeBefore,i=e.nodeAfter,r=e.index();return!n||!i||!n.type.compatibleContent(i.type)?!1:!n.content.size&&e.parent.canReplace(r-1,r)?(t&&t(s.tr.delete(e.pos-n.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(r,r+1)||!(i.isTextblock||vd(s.doc,e.pos))?!1:(t&&t(s.tr.join(e.pos).scrollIntoView()),!0)}function F2(s,e,t,n){let i=e.nodeBefore,r=e.nodeAfter,o,a,c=i.type.spec.isolating||r.type.spec.isolating;if(!c&&WV(s,e,t))return!0;let l=!c&&e.parent.canReplace(e.index(),e.index()+1);if(l&&(o=(a=i.contentMatchAt(i.childCount)).findWrapping(r.type))&&a.matchType(o[0]||r.type).validEnd){if(t){let p=e.pos+r.nodeSize,g=He.empty;for(let y=o.length-1;y>=0;y--)g=He.from(o[y].create(null,g));g=He.from(i.copy(g));let v=s.tr.step(new Tr(e.pos-1,p,e.pos,p,new tt(g,1,0),o.length,!0)),m=v.doc.resolve(p+2*o.length);m.nodeAfter&&m.nodeAfter.type==i.type&&vd(v.doc,m.pos)&&v.join(m.pos),t(v.scrollIntoView())}return!0}let u=r.type.spec.isolating||n>0&&c?null:Ht.findFrom(e,1),d=u&&u.$from.blockRange(u.$to),h=d&&wg(d);if(h!=null&&h>=e.depth)return t&&t(s.tr.lift(d,h).scrollIntoView()),!0;if(l&&ag(r,"start",!0)&&ag(i,"end")){let p=i,g=[];for(;g.push(p),!p.isTextblock;)p=p.lastChild;let v=r,m=1;for(;!v.isTextblock;v=v.firstChild)m++;if(p.canReplace(p.childCount,p.childCount,v.content)){if(t){let y=He.empty;for(let b=g.length-1;b>=0;b--)y=He.from(g[b].copy(y));let _=s.tr.step(new Tr(e.pos-g.length,e.pos+r.nodeSize,e.pos+m,e.pos+r.nodeSize-m,new tt(y,g.length,0),0,!0));t(_.scrollIntoView())}return!0}}return!1}function H2(s){return function(e,t){let n=e.selection,i=s<0?n.$from:n.$to,r=i.depth;for(;i.node(r).isInline;){if(!r)return!1;r--}return i.node(r).isTextblock?(t&&t(e.tr.setSelection(kt.create(e.doc,s<0?i.start(r):i.end(r)))),!0):!1}}const zV=H2(-1),jV=H2(1);function VV(s,e=null){return function(t,n){let{$from:i,$to:r}=t.selection,o=i.blockRange(r),a=o&&HE(o,s,e);return a?(n&&n(t.tr.wrap(o,a).scrollIntoView()),!0):!1}}function Kx(s,e=null){return function(t,n){let i=!1;for(let r=0;r{if(i)return!1;if(!(!c.isTextblock||c.hasMarkup(s,e)))if(c.type==s)i=!0;else{let u=t.doc.resolve(l),d=u.index();i=u.parent.canReplaceWith(d,d+1,s)}})}if(!i)return!1;if(n){let r=t.tr;for(let o=0;o=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let c=o.resolve(e.start-2);r=new NS(c,c,e.depth),e.endIndex=0;u--)r=He.from(t[u].type.create(t[u].attrs,r));s.step(new Tr(e.start-(n?2:0),e.end,e.start,e.end,new tt(r,0,0),t.length,!0));let o=0;for(let u=0;uo.childCount>0&&o.firstChild.type==s);return r?t?n.node(r.depth-1).type==s?XV(e,t,s,r):YV(e,t,r):!0:!1}}function XV(s,e,t,n){let i=s.tr,r=n.end,o=n.$to.end(n.depth);rv;g--)p-=i.child(g).nodeSize,n.delete(p-1,p+1);let r=n.doc.resolve(t.start),o=r.nodeAfter;if(n.mapping.map(t.end)!=t.start+r.nodeAfter.nodeSize)return!1;let a=t.startIndex==0,c=t.endIndex==i.childCount,l=r.node(-1),u=r.index(-1);if(!l.canReplace(u+(a?0:1),u+1,o.content.append(c?He.empty:He.from(i))))return!1;let d=r.pos,h=d+o.nodeSize;return n.step(new Tr(d-(a?1:0),h+(c?1:0),d+1,h-1,new tt((a?He.empty:He.from(i.copy(He.empty))).append(c?He.empty:He.from(i.copy(He.empty))),a?0:1,c?0:1),a?0:1)),e(n.scrollIntoView()),!0}function JV(s){return function(e,t){let{$from:n,$to:i}=e.selection,r=n.blockRange(i,l=>l.childCount>0&&l.firstChild.type==s);if(!r)return!1;let o=r.startIndex;if(o==0)return!1;let a=r.parent,c=a.child(o-1);if(c.type!=s)return!1;if(t){let l=c.lastChild&&c.lastChild.type==a.type,u=He.from(l?s.create():null),d=new tt(He.from(s.create(null,He.from(a.type.create(null,u)))),l?3:1,0),h=r.start,p=r.end;t(e.tr.step(new Tr(h-(l?3:1),p,h,p,d,1,!0)).scrollIntoView())}return!0}}const ci=function(s){for(var e=0;;e++)if(s=s.previousSibling,!s)return e},lg=function(s){let e=s.assignedSlot||s.parentNode;return e&&e.nodeType==11?e.host:e};let t1=null;const Ll=function(s,e,t){let n=t1||(t1=document.createRange());return n.setEnd(s,t??s.nodeValue.length),n.setStart(s,e||0),n},ZV=function(){t1=null},Lf=function(s,e,t,n){return t&&(qx(s,e,t,n,-1)||qx(s,e,t,n,1))},eG=/^(img|br|input|textarea|hr)$/i;function qx(s,e,t,n,i){for(var r;;){if(s==t&&e==n)return!0;if(e==(i<0?0:Bo(s))){let o=s.parentNode;if(!o||o.nodeType!=1||m_(s)||eG.test(s.nodeName)||s.contentEditable=="false")return!1;e=ci(s)+(i<0?0:1),s=o}else if(s.nodeType==1){let o=s.childNodes[e+(i<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((r=o.pmViewDesc)===null||r===void 0)&&r.ignoreForSelection)e+=i;else return!1;else s=o,e=i<0?Bo(s):0}else return!1}}function Bo(s){return s.nodeType==3?s.nodeValue.length:s.childNodes.length}function tG(s,e){for(;;){if(s.nodeType==3&&e)return s;if(s.nodeType==1&&e>0){if(s.contentEditable=="false")return null;s=s.childNodes[e-1],e=Bo(s)}else if(s.parentNode&&!m_(s))e=ci(s),s=s.parentNode;else return null}}function sG(s,e){for(;;){if(s.nodeType==3&&e2),Do=cg||(ul?/Mac/.test(ul.platform):!1),z2=ul?/Win/.test(ul.platform):!1,wc=/Android \d/.test(yd),g_=!!Qx&&"webkitFontSmoothing"in Qx.documentElement.style,oG=g_?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function aG(s){let e=s.defaultView&&s.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:s.documentElement.clientWidth,top:0,bottom:s.documentElement.clientHeight}}function Tl(s,e){return typeof s=="number"?s:s[e]}function lG(s){let e=s.getBoundingClientRect(),t=e.width/s.offsetWidth||1,n=e.height/s.offsetHeight||1;return{left:e.left,right:e.left+s.clientWidth*t,top:e.top,bottom:e.top+s.clientHeight*n}}function Xx(s,e,t){let n=s.someProp("scrollThreshold")||0,i=s.someProp("scrollMargin")||5,r=s.dom.ownerDocument;for(let o=t||s.dom;o;){if(o.nodeType!=1){o=lg(o);continue}let a=o,c=a==r.body,l=c?aG(r):lG(a),u=0,d=0;if(e.topl.bottom-Tl(n,"bottom")&&(d=e.bottom-e.top>l.bottom-l.top?e.top+Tl(i,"top")-l.top:e.bottom-l.bottom+Tl(i,"bottom")),e.leftl.right-Tl(n,"right")&&(u=e.right-l.right+Tl(i,"right")),u||d)if(c)r.defaultView.scrollBy(u,d);else{let p=a.scrollLeft,g=a.scrollTop;d&&(a.scrollTop+=d),u&&(a.scrollLeft+=u);let v=a.scrollLeft-p,m=a.scrollTop-g;e={left:e.left-v,top:e.top-m,right:e.right-v,bottom:e.bottom-m}}let h=c?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(h))break;o=h=="absolute"?o.offsetParent:lg(o)}}function cG(s){let e=s.dom.getBoundingClientRect(),t=Math.max(0,e.top),n,i;for(let r=(e.left+e.right)/2,o=t+1;o=t-20){n=a,i=c.top;break}}return{refDOM:n,refTop:i,stack:j2(s.dom)}}function j2(s){let e=[],t=s.ownerDocument;for(let n=s;n&&(e.push({dom:n,top:n.scrollTop,left:n.scrollLeft}),s!=t);n=lg(n));return e}function uG({refDOM:s,refTop:e,stack:t}){let n=s?s.getBoundingClientRect().top:0;V2(t,n==0?0:n-e)}function V2(s,e){for(let t=0;t=a){o=Math.max(g.bottom,o),a=Math.min(g.top,a);let v=g.left>e.left?g.left-e.left:g.right=(g.left+g.right)/2?1:0));continue}}else g.top>e.top&&!c&&g.left<=e.left&&g.right>=e.left&&(c=u,l={left:Math.max(g.left,Math.min(g.right,e.left)),top:g.top});!t&&(e.left>=g.right&&e.top>=g.top||e.left>=g.left&&e.top>=g.bottom)&&(r=d+1)}}return!t&&c&&(t=c,i=l,n=0),t&&t.nodeType==3?hG(t,i):!t||n&&t.nodeType==1?{node:s,offset:r}:G2(t,i)}function hG(s,e){let t=s.nodeValue.length,n=document.createRange(),i;for(let r=0;r=(o.left+o.right)/2?1:0)};break}}return n.detach(),i||{node:s,offset:0}}function VE(s,e){return s.left>=e.left-1&&s.left<=e.right+1&&s.top>=e.top-1&&s.top<=e.bottom+1}function fG(s,e){let t=s.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left(o.left+o.right)/2?1:-1}return s.docView.posFromDOM(n,i,r)}function mG(s,e,t,n){let i=-1;for(let r=e,o=!1;r!=s.dom;){let a=s.docView.nearestDesc(r,!0),c;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((c=a.dom.getBoundingClientRect()).width||c.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!o&&c.left>n.left||c.top>n.top?i=a.posBefore:(!o&&c.right-1?i:s.docView.posFromDOM(e,t,-1)}function K2(s,e,t){let n=s.childNodes.length;if(n&&t.tope.top&&i++}let l;g_&&i&&n.nodeType==1&&(l=n.childNodes[i-1]).nodeType==1&&l.contentEditable=="false"&&l.getBoundingClientRect().top>=e.top&&i--,n==s.dom&&i==n.childNodes.length-1&&n.lastChild.nodeType==1&&e.top>n.lastChild.getBoundingClientRect().bottom?a=s.state.doc.content.size:(i==0||n.nodeType!=1||n.childNodes[i-1].nodeName!="BR")&&(a=mG(s,n,i,e))}a==null&&(a=pG(s,o,e));let c=s.docView.nearestDesc(o,!0);return{pos:a,inside:c?c.posAtStart-c.border:-1}}function Yx(s){return s.top=0&&i==n.nodeValue.length?(c--,u=1):t<0?c--:l++,Og(Xc(Ll(n,c,l),u),u<0)}if(!s.state.doc.resolve(e-(r||0)).parent.inlineContent){if(r==null&&i&&(t<0||i==Bo(n))){let c=n.childNodes[i-1];if(c.nodeType==1)return MC(c.getBoundingClientRect(),!1)}if(r==null&&i=0)}if(r==null&&i&&(t<0||i==Bo(n))){let c=n.childNodes[i-1],l=c.nodeType==3?Ll(c,Bo(c)-(o?0:1)):c.nodeType==1&&(c.nodeName!="BR"||!c.nextSibling)?c:null;if(l)return Og(Xc(l,1),!1)}if(r==null&&i=0)}function Og(s,e){if(s.width==0)return s;let t=e?s.left:s.right;return{top:s.top,bottom:s.bottom,left:t,right:t}}function MC(s,e){if(s.height==0)return s;let t=e?s.top:s.bottom;return{top:t,bottom:t,left:s.left,right:s.right}}function Q2(s,e,t){let n=s.state,i=s.root.activeElement;n!=e&&s.updateState(e),i!=s.dom&&s.focus();try{return t()}finally{n!=e&&s.updateState(n),i!=s.dom&&i&&i.focus()}}function yG(s,e,t){let n=e.selection,i=t=="up"?n.$from:n.$to;return Q2(s,e,()=>{let{node:r}=s.docView.domFromPos(i.pos,t=="up"?-1:1);for(;;){let a=s.docView.nearestDesc(r,!0);if(!a)break;if(a.node.isBlock){r=a.contentDOM||a.dom;break}r=a.dom.parentNode}let o=q2(s,i.pos,1);for(let a=r.firstChild;a;a=a.nextSibling){let c;if(a.nodeType==1)c=a.getClientRects();else if(a.nodeType==3)c=Ll(a,0,a.nodeValue.length).getClientRects();else continue;for(let l=0;lu.top+1&&(t=="up"?o.top-u.top>(u.bottom-o.top)*2:u.bottom-o.bottom>(o.bottom-u.top)*2))return!1}}return!0})}const bG=/[\u0590-\u08ac]/;function _G(s,e,t){let{$head:n}=e.selection;if(!n.parent.isTextblock)return!1;let i=n.parentOffset,r=!i,o=i==n.parent.content.size,a=s.domSelection();return a?!bG.test(n.parent.textContent)||!a.modify?t=="left"||t=="backward"?r:o:Q2(s,e,()=>{let{focusNode:c,focusOffset:l,anchorNode:u,anchorOffset:d}=s.domSelectionRange(),h=a.caretBidiLevel;a.modify("move",t,"character");let p=n.depth?s.docView.domAfterPos(n.before()):s.dom,{focusNode:g,focusOffset:v}=s.domSelectionRange(),m=g&&!p.contains(g.nodeType==1?g:g.parentNode)||c==g&&l==v;try{a.collapse(u,d),c&&(c!=u||l!=d)&&a.extend&&a.extend(c,l)}catch{}return h!=null&&(a.caretBidiLevel=h),m}):n.pos==n.start()||n.pos==n.end()}let Jx=null,Zx=null,eR=!1;function wG(s,e,t){return Jx==e&&Zx==t?eR:(Jx=e,Zx=t,eR=t=="up"||t=="down"?yG(s,e,t):_G(s,e,t))}const Uo=0,tR=1,Ud=2,dl=3;class v_{constructor(e,t,n,i){this.parent=e,this.children=t,this.dom=n,this.contentDOM=i,this.dirty=Uo,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;tci(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let r=e;;r=r.parentNode){if(r==this.dom){i=!1;break}if(r.previousSibling)break}if(i==null&&t==e.childNodes.length)for(let r=e;;r=r.parentNode){if(r==this.dom){i=!0;break}if(r.nextSibling)break}}return i??n>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,i=e;i;i=i.parentNode){let r=this.getDesc(i),o;if(r&&(!t||r.node))if(n&&(o=r.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))n=!1;else return r}}getDesc(e){let t=e.pmViewDesc;for(let n=t;n;n=n.parent)if(n==this)return t}posFromDOM(e,t,n){for(let i=e;i;i=i.parentNode){let r=this.getDesc(i);if(r)return r.localPosFromDOM(e,t,n)}return-1}descAt(e){for(let t=0,n=0;te||o instanceof Y2){i=e-r;break}r=a}if(i)return this.children[n].domFromPos(i-this.children[n].border,t);for(let r;n&&!(r=this.children[n-1]).size&&r instanceof X2&&r.side>=0;n--);if(t<=0){let r,o=!0;for(;r=n?this.children[n-1]:null,!(!r||r.dom.parentNode==this.contentDOM);n--,o=!1);return r&&t&&o&&!r.border&&!r.domAtom?r.domFromPos(r.size,t):{node:this.contentDOM,offset:r?ci(r.dom)+1:0}}else{let r,o=!0;for(;r=n=u&&t<=l-c.border&&c.node&&c.contentDOM&&this.contentDOM.contains(c.contentDOM))return c.parseRange(e,t,u);e=o;for(let d=a;d>0;d--){let h=this.children[d-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){i=ci(h.dom)+1;break}e-=h.size}i==-1&&(i=0)}if(i>-1&&(l>t||a==this.children.length-1)){t=l;for(let u=a+1;ug&&ot){let g=a;a=c,c=g}let p=document.createRange();p.setEnd(c.node,c.offset),p.setStart(a.node,a.offset),l.removeAllRanges(),l.addRange(p)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let n=0,i=0;i=n:en){let a=n+r.border,c=o-r.border;if(e>=a&&t<=c){this.dirty=e==n||t==o?Ud:tR,e==a&&t==c&&(r.contentLost||r.dom.parentNode!=this.contentDOM)?r.dirty=dl:r.markDirty(e-a,t-a);return}else r.dirty=r.dom==r.contentDOM&&r.dom.parentNode==this.contentDOM&&!r.children.length?Ud:dl}n=o}this.dirty=Ud}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=e==1?Ud:tR;t.dirty{if(!r)return i;if(r.parent)return r.parent.posBeforeChild(r)})),!t.type.spec.raw){if(o.nodeType!=1){let a=document.createElement("span");a.appendChild(o),o=a}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=t,this.widget=t,r=this}matchesWidget(e){return this.dirty==Uo&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class SG extends v_{constructor(e,t,n,i){super(e,[],t,null),this.textDOM=n,this.text=i}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class Of extends v_{constructor(e,t,n,i,r){super(e,[],n,i),this.mark=t,this.spec=r}static create(e,t,n,i){let r=i.nodeViews[t.type.name],o=r&&r(t,i,n);return(!o||!o.dom)&&(o=Hf.renderSpec(document,t.type.spec.toDOM(t,n),null,t.attrs)),new Of(e,t,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&dl||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=dl&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=Uo){let n=this.parent;for(;!n.node;)n=n.parent;n.dirty0&&(r=o1(r,0,e,n));for(let a=0;a{if(!c)return o;if(c.parent)return c.parent.posBeforeChild(c)},n,i),u=l&&l.dom,d=l&&l.contentDOM;if(t.isText){if(!u)u=document.createTextNode(t.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:d}=Hf.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!d&&!t.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),t.type.spec.draggable&&(u.draggable=!0));let h=u;return u=eO(u,n,t),l?c=new kG(e,t,n,i,u,d||null,h,l,r,o+1):t.isText?new mk(e,t,n,i,u,h,r):new cd(e,t,n,i,u,d||null,h,r,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let n=this.children[t];if(this.dom.contains(n.dom.parentNode)){e.contentElement=n.dom.parentNode;break}}e.contentElement||(e.getContent=()=>He.empty)}return e}matchesNode(e,t,n){return this.dirty==Uo&&e.eq(this.node)&&FS(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let n=this.node.inlineContent,i=t,r=e.composing?this.localCompositionInfo(e,t):null,o=r&&r.pos>-1?r:null,a=r&&r.pos<0,c=new TG(this,o&&o.node,e);MG(this.node,this.innerDeco,(l,u,d)=>{l.spec.marks?c.syncToMarks(l.spec.marks,n,e,u):l.type.side>=0&&!d&&c.syncToMarks(u==this.node.childCount?As.none:this.node.child(u).marks,n,e,u),c.placeWidget(l,e,i)},(l,u,d,h)=>{c.syncToMarks(l.marks,n,e,h);let p;c.findNodeMatch(l,u,d,h)||a&&e.state.selection.from>i&&e.state.selection.to-1&&c.updateNodeAt(l,u,d,p,e)||c.updateNextNode(l,u,d,e,h,i)||c.addNode(l,u,d,e,i),i+=l.nodeSize}),c.syncToMarks([],n,e,0),this.node.isTextblock&&c.addTextblockHacks(),c.destroyRest(),(c.changed||this.dirty==Ud)&&(o&&this.protectLocalComposition(e,o),J2(this.contentDOM,this.children,e),cg&&xG(this.dom))}localCompositionInfo(e,t){let{from:n,to:i}=e.state.selection;if(!(e.state.selection instanceof kt)||nt+this.node.content.size)return null;let r=e.input.compositionNode;if(!r||!this.dom.contains(r.parentNode))return null;if(this.node.inlineContent){let o=r.nodeValue,a=RG(this.node.content,o,n-t,i-t);return a<0?null:{node:r,pos:a,text:o}}else return{node:r,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:n,text:i}){if(this.getDesc(t))return;let r=t;for(;r.parentNode!=this.contentDOM;r=r.parentNode){for(;r.previousSibling;)r.parentNode.removeChild(r.previousSibling);for(;r.nextSibling;)r.parentNode.removeChild(r.nextSibling);r.pmViewDesc&&(r.pmViewDesc=void 0)}let o=new SG(this,r,t,i);e.input.compositionNodes.push(o),this.children=o1(this.children,n,n+i.length,e,o)}update(e,t,n,i){return this.dirty==dl||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,n,i),!0)}updateInner(e,t,n,i){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=Uo}updateOuterDeco(e){if(FS(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,n=this.dom;this.dom=Z2(this.dom,this.nodeDOM,r1(this.outerDeco,this.node,t),r1(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function sR(s,e,t,n,i){eO(n,e,s);let r=new cd(void 0,s,e,t,n,n,n,i,0);return r.contentDOM&&r.updateChildren(i,0),r}class mk extends cd{constructor(e,t,n,i,r,o,a){super(e,t,n,i,r,null,o,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,i){return this.dirty==dl||this.dirty!=Uo&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=Uo||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=Uo,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,n){let i=this.node.cut(e,t),r=document.createTextNode(i.text);return new mk(this.parent,i,this.outerDeco,this.innerDeco,r,r,n)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=dl)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Y2 extends v_{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Uo&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class kG extends cd{constructor(e,t,n,i,r,o,a,c,l,u){super(e,t,n,i,r,o,a,l,u),this.spec=c}update(e,t,n,i){if(this.dirty==dl)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let r=this.spec.update(e,t,n);return r&&this.updateInner(e,t,n,i),r}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,n,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,i){this.spec.setSelection?this.spec.setSelection(e,t,n.root):super.setSelection(e,t,n,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function J2(s,e,t){let n=s.firstChild,i=!1;for(let r=0;r>1,a=Math.min(o,e.length);for(;r-1)c>this.index&&(this.changed=!0,this.destroyBetween(this.index,c)),this.top=this.top.children[this.index];else{let u=Of.create(this.top,e[o],t,n);this.top.children.splice(this.index,0,u),this.top=u,this.changed=!0}this.index=0,o++}}findNodeMatch(e,t,n,i){let r=-1,o;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,n))r=this.top.children.indexOf(o,this.index);else for(let a=this.index,c=Math.min(this.top.children.length,a+5);a0;){let a;for(;;)if(n){let l=t.children[n-1];if(l instanceof Of)t=l,n=l.children.length;else{a=l,n--;break}}else{if(t==e)break e;n=t.parent.children.indexOf(t),t=t.parent}let c=a.node;if(c){if(c!=s.child(i-1))break;--i,r.set(a,i),o.push(a)}}return{index:i,matched:r,matches:o.reverse()}}function EG(s,e){return s.type.side-e.type.side}function MG(s,e,t,n){let i=e.locals(s),r=0;if(i.length==0){for(let l=0;lr;)a.push(i[o++]);let g=r+h.nodeSize;if(h.isText){let m=g;o!m.inline):a.slice();n(h,v,e.forChild(r,h),p),r=g}}function xG(s){if(s.nodeName=="UL"||s.nodeName=="OL"){let e=s.style.cssText;s.style.cssText=e+"; list-style: square !important",window.getComputedStyle(s).listStyle,s.style.cssText=e}}function RG(s,e,t,n){for(let i=0,r=0;i=t){if(r>=n&&c.slice(n-e.length-a,n-a)==e)return n-e.length;let l=a=0&&l+e.length+a>=t)return a+l;if(t==n&&c.length>=n+e.length-a&&c.slice(n-a,n-a+e.length)==e)return n}}return-1}function o1(s,e,t,n,i){let r=[];for(let o=0,a=0;o=t||u<=e?r.push(c):(lt&&r.push(c.slice(t-l,c.size,n)))}return r}function GE(s,e=null){let t=s.domSelectionRange(),n=s.state.doc;if(!t.focusNode)return null;let i=s.docView.nearestDesc(t.focusNode),r=i&&i.size==0,o=s.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(o<0)return null;let a=n.resolve(o),c,l;if(pk(t)){for(c=o;i&&!i.node;)i=i.parent;let d=i.node;if(i&&d.isAtom&&_t.isSelectable(d)&&i.parent&&!(d.isInline&&nG(t.focusNode,t.focusOffset,i.dom))){let h=i.posBefore;l=new _t(o==h?a:n.resolve(h))}}else{if(t instanceof s.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let d=o,h=o;for(let p=0;p{(t.anchorNode!=n||t.anchorOffset!=i)&&(e.removeEventListener("selectionchange",s.input.hideSelectionGuard),setTimeout(()=>{(!tO(s)||s.state.selection.visible)&&s.dom.classList.remove("ProseMirror-hideselection")},20))})}function PG(s){let e=s.domSelection();if(!e)return;let t=s.cursorWrapper.dom,n=t.nodeName=="IMG";n?e.collapse(t.parentNode,ci(t)+1):e.collapse(t,0),!n&&!s.state.selection.visible&&Cr&&ld<=11&&(t.disabled=!0,t.disabled=!1)}function sO(s,e){if(e instanceof _t){let t=s.docView.descAt(e.from);t!=s.lastSelectedViewDesc&&(aR(s),t&&t.selectNode(),s.lastSelectedViewDesc=t)}else aR(s)}function aR(s){s.lastSelectedViewDesc&&(s.lastSelectedViewDesc.parent&&s.lastSelectedViewDesc.deselectNode(),s.lastSelectedViewDesc=void 0)}function KE(s,e,t,n){return s.someProp("createSelectionBetween",i=>i(s,e,t))||kt.between(e,t,n)}function lR(s){return s.editable&&!s.hasFocus()?!1:nO(s)}function nO(s){let e=s.domSelectionRange();if(!e.anchorNode)return!1;try{return s.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(s.editable||s.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function LG(s){let e=s.docView.domFromPos(s.state.selection.anchor,0),t=s.domSelectionRange();return Lf(e.node,e.offset,t.anchorNode,t.anchorOffset)}function a1(s,e){let{$anchor:t,$head:n}=s.selection,i=e>0?t.max(n):t.min(n),r=i.parent.inlineContent?i.depth?s.doc.resolve(e>0?i.after():i.before()):null:i;return r&&Ht.findFrom(r,e)}function eu(s,e){return s.dispatch(s.state.tr.setSelection(e).scrollIntoView()),!0}function cR(s,e,t){let n=s.state.selection;if(n instanceof kt)if(t.indexOf("s")>-1){let{$head:i}=n,r=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!r||r.isText||!r.isLeaf)return!1;let o=s.state.doc.resolve(i.pos+r.nodeSize*(e<0?-1:1));return eu(s,new kt(n.$anchor,o))}else if(n.empty){if(s.endOfTextblock(e>0?"forward":"backward")){let i=a1(s.state,e);return i&&i instanceof _t?eu(s,i):!1}else if(!(Do&&t.indexOf("m")>-1)){let i=n.$head,r=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!r||r.isText)return!1;let a=e<0?i.pos-r.nodeSize:i.pos;return r.isAtom||(o=s.docView.descAt(a))&&!o.contentDOM?_t.isSelectable(r)?eu(s,new _t(e<0?s.state.doc.resolve(i.pos-r.nodeSize):i)):g_?eu(s,new kt(s.state.doc.resolve(e<0?a:a+r.nodeSize))):!1:!1}}else return!1;else{if(n instanceof _t&&n.node.isInline)return eu(s,new kt(e>0?n.$to:n.$from));{let i=a1(s.state,e);return i?eu(s,i):!1}}}function HS(s){return s.nodeType==3?s.nodeValue.length:s.childNodes.length}function jv(s,e){let t=s.pmViewDesc;return t&&t.size==0&&(e<0||s.nextSibling||s.nodeName!="BR")}function np(s,e){return e<0?OG(s):DG(s)}function OG(s){let e=s.domSelectionRange(),t=e.focusNode,n=e.focusOffset;if(!t)return;let i,r,o=!1;for(Ho&&t.nodeType==1&&n0){if(t.nodeType!=1)break;{let a=t.childNodes[n-1];if(jv(a,-1))i=t,r=--n;else if(a.nodeType==3)t=a,n=t.nodeValue.length;else break}}else{if(iO(t))break;{let a=t.previousSibling;for(;a&&jv(a,-1);)i=t.parentNode,r=ci(a),a=a.previousSibling;if(a)t=a,n=HS(t);else{if(t=t.parentNode,t==s.dom)break;n=0}}}o?l1(s,t,n):i&&l1(s,i,r)}function DG(s){let e=s.domSelectionRange(),t=e.focusNode,n=e.focusOffset;if(!t)return;let i=HS(t),r,o;for(;;)if(n{s.state==i&&Mc(s)},50)}function uR(s,e){let t=s.state.doc.resolve(e);if(!(hi||z2)&&t.parent.inlineContent){let i=s.coordsAtPos(e);if(e>t.start()){let r=s.coordsAtPos(e-1),o=(r.top+r.bottom)/2;if(o>i.top&&o1)return r.lefti.top&&o1)return r.left>i.left?"ltr":"rtl"}}return getComputedStyle(s.dom).direction=="rtl"?"rtl":"ltr"}function dR(s,e,t){let n=s.state.selection;if(n instanceof kt&&!n.empty||t.indexOf("s")>-1||Do&&t.indexOf("m")>-1)return!1;let{$from:i,$to:r}=n;if(!i.parent.inlineContent||s.endOfTextblock(e<0?"up":"down")){let o=a1(s.state,e);if(o&&o instanceof _t)return eu(s,o)}if(!i.parent.inlineContent){let o=e<0?i:r,a=n instanceof Ec?Ht.near(o,e):Ht.findFrom(o,e);return a?eu(s,a):!1}return!1}function hR(s,e){if(!(s.state.selection instanceof kt))return!0;let{$head:t,$anchor:n,empty:i}=s.state.selection;if(!t.sameParent(n))return!0;if(!i)return!1;if(s.endOfTextblock(e>0?"forward":"backward"))return!0;let r=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(r&&!r.isText){let o=s.state.tr;return e<0?o.delete(t.pos-r.nodeSize,t.pos):o.delete(t.pos,t.pos+r.nodeSize),s.dispatch(o),!0}return!1}function fR(s,e,t){s.domObserver.stop(),e.contentEditable=t,s.domObserver.start()}function BG(s){if(!Ii||s.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=s.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let n=e.firstChild;fR(s,n,"true"),setTimeout(()=>fR(s,n,"false"),20)}return!1}function FG(s){let e="";return s.ctrlKey&&(e+="c"),s.metaKey&&(e+="m"),s.altKey&&(e+="a"),s.shiftKey&&(e+="s"),e}function HG(s,e){let t=e.keyCode,n=FG(e);if(t==8||Do&&t==72&&n=="c")return hR(s,-1)||np(s,-1);if(t==46&&!e.shiftKey||Do&&t==68&&n=="c")return hR(s,1)||np(s,1);if(t==13||t==27)return!0;if(t==37||Do&&t==66&&n=="c"){let i=t==37?uR(s,s.state.selection.from)=="ltr"?-1:1:-1;return cR(s,i,n)||np(s,i)}else if(t==39||Do&&t==70&&n=="c"){let i=t==39?uR(s,s.state.selection.from)=="ltr"?1:-1:1;return cR(s,i,n)||np(s,i)}else{if(t==38||Do&&t==80&&n=="c")return dR(s,-1,n)||np(s,-1);if(t==40||Do&&t==78&&n=="c")return BG(s)||dR(s,1,n)||np(s,1);if(n==(Do?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function qE(s,e){s.someProp("transformCopied",p=>{e=p(e,s)});let t=[],{content:n,openStart:i,openEnd:r}=e;for(;i>1&&r>1&&n.childCount==1&&n.firstChild.childCount==1;){i--,r--;let p=n.firstChild;t.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),n=p.content}let o=s.someProp("clipboardSerializer")||Hf.fromSchema(s.state.schema),a=uO(),c=a.createElement("div");c.appendChild(o.serializeFragment(n,{document:a}));let l=c.firstChild,u,d=0;for(;l&&l.nodeType==1&&(u=cO[l.nodeName.toLowerCase()]);){for(let p=u.length-1;p>=0;p--){let g=a.createElement(u[p]);for(;c.firstChild;)g.appendChild(c.firstChild);c.appendChild(g),d++}l=c.firstChild}l&&l.nodeType==1&&l.setAttribute("data-pm-slice",`${i} ${r}${d?` -${d}`:""} ${JSON.stringify(t)}`);let h=s.someProp("clipboardTextSerializer",p=>p(e,s))||e.content.textBetween(0,e.content.size,` `);return{dom:c,text:h,slice:e}}function rO(s,e,t,n,i){let r=i.parent.type.spec.code,o,a;if(!t&&!e)return null;let c=!!e&&(n||r||!t);if(c){if(s.someProp("transformPastedText",h=>{e=h(e,r||n,s)}),r)return a=new tt(He.from(s.state.schema.text(e.replace(/\r\n?/g,` `))),0,0),s.someProp("transformPasted",h=>{a=h(a,s,!0)}),a;let d=s.someProp("clipboardTextParser",h=>h(e,i,n,s));if(d)a=d;else{let h=i.marks(),{schema:p}=s.state,g=Hf.fromSchema(p);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(v=>{let m=o.appendChild(document.createElement("p"));v&&m.appendChild(g.serializeNode(p.text(v,h)))})}}else s.someProp("transformPastedHTML",d=>{t=d(t,s)}),o=jG(t),g_&&VG(o);let l=o&&o.querySelector("[data-pm-slice]"),u=l&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(l.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let h=o.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;o=h}if(a||(a=(s.someProp("clipboardParser")||s.someProp("domParser")||Uv.fromSchema(s.state.schema)).parseSlice(o,{preserveWhitespace:!!(c||u),context:i,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!UG.test(h.parentNode.nodeName)?{ignore:!0}:null}})),u)a=GG(pR(a,+u[1],+u[2]),u[4]);else if(a=tt.maxOpen(WG(a.content,i),!0),a.openStart||a.openEnd){let d=0,h=0;for(let p=a.content.firstChild;d{a=d(a,s,c)}),a}const UG=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function WG(s,e){if(s.childCount<2)return s;for(let t=e.depth;t>=0;t--){let i=e.node(t).contentMatchAt(e.index(t)),r,o=[];if(s.forEach(a=>{if(!o)return;let c=i.findWrapping(a.type),l;if(!c)return o=null;if(l=o.length&&r.length&&aO(c,r,a,o[o.length-1],0))o[o.length-1]=l;else{o.length&&(o[o.length-1]=lO(o[o.length-1],r.length));let u=oO(a,c);o.push(u),i=i.matchType(u.type),r=c}}),o)return He.from(o)}return s}function oO(s,e,t=0){for(let n=e.length-1;n>=t;n--)s=e[n].create(null,He.from(s));return s}function aO(s,e,t,n,i){if(i1&&(r=0),i=t&&(a=e<0?o.contentMatchAt(0).fillBefore(a,r<=i).append(a):a.append(o.contentMatchAt(o.childCount).fillBefore(He.empty,!0))),s.replaceChild(e<0?0:s.childCount-1,o.copy(a))}function pR(s,e,t){return et})),RC.createHTML(s)):s}function jG(s){let e=/^(\s*]*>)*/.exec(s);e&&(s=s.slice(e[0].length));let t=uO().createElement("div"),n=/<([a-z][^>\s]+)/i.exec(s),i;if((i=n&&cO[n[1].toLowerCase()])&&(s=i.map(r=>"<"+r+">").join("")+s+i.map(r=>"").reverse().join("")),t.innerHTML=zG(s),i)for(let r=0;r=0;a-=2){let c=t.nodes[n[a]];if(!c||c.hasRequiredAttrs())break;i=He.from(c.create(n[a+1],i)),r++,o++}return new tt(i,r,o)}const or={},ar={},KG={touchstart:!0,touchmove:!0};class qG{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function QG(s){for(let e in or){let t=or[e];s.dom.addEventListener(e,s.input.eventHandlers[e]=n=>{YG(s,n)&&!QE(s,n)&&(s.editable||!(n.type in ar))&&t(s,n)},KG[e]?{passive:!0}:void 0)}Ii&&s.dom.addEventListener("input",()=>null),u1(s)}function od(s,e){s.input.lastSelectionOrigin=e,s.input.lastSelectionTime=Date.now()}function XG(s){s.domObserver.stop();for(let e in s.input.eventHandlers)s.dom.removeEventListener(e,s.input.eventHandlers[e]);clearTimeout(s.input.composingTimeout),clearTimeout(s.input.lastIOSEnterFallbackTimeout)}function u1(s){s.someProp("handleDOMEvents",e=>{for(let t in e)s.input.eventHandlers[t]||s.dom.addEventListener(t,s.input.eventHandlers[t]=n=>QE(s,n))})}function QE(s,e){return s.someProp("handleDOMEvents",t=>{let n=t[e.type];return n?n(s,e)||e.defaultPrevented:!1})}function YG(s,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=s.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function JG(s,e){!QE(s,e)&&or[e.type]&&(s.editable||!(e.type in ar))&&or[e.type](s,e)}ar.keydown=(s,e)=>{let t=e;if(s.input.shiftKey=t.keyCode==16||t.shiftKey,!hO(s,t)&&(s.input.lastKeyCode=t.keyCode,s.input.lastKeyCodeTime=Date.now(),!(wc&&hi&&t.keyCode==13)))if(t.keyCode!=229&&s.domObserver.forceFlush(),cg&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let n=Date.now();s.input.lastIOSEnter=n,s.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{s.input.lastIOSEnter==n&&(s.someProp("handleKeyDown",i=>i(s,Dd(13,"Enter"))),s.input.lastIOSEnter=0)},200)}else s.someProp("handleKeyDown",n=>n(s,t))||HG(s,t)?t.preventDefault():od(s,"key")};ar.keyup=(s,e)=>{e.keyCode==16&&(s.input.shiftKey=!1)};ar.keypress=(s,e)=>{let t=e;if(hO(s,t)||!t.charCode||t.ctrlKey&&!t.altKey||Do&&t.metaKey)return;if(s.someProp("handleKeyPress",i=>i(s,t))){t.preventDefault();return}let n=s.state.selection;if(!(n instanceof kt)||!n.$from.sameParent(n.$to)){let i=String.fromCharCode(t.charCode),r=()=>s.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!s.someProp("handleTextInput",o=>o(s,n.$from.pos,n.$to.pos,i,r))&&s.dispatch(r()),t.preventDefault()}};function gk(s){return{left:s.clientX,top:s.clientY}}function ZG(s,e){let t=e.x-s.clientX,n=e.y-s.clientY;return t*t+n*n<100}function XE(s,e,t,n,i){if(n==-1)return!1;let r=s.state.doc.resolve(n);for(let o=r.depth+1;o>0;o--)if(s.someProp(e,a=>o>r.depth?a(s,t,r.nodeAfter,r.before(o),i,!0):a(s,t,r.node(o),r.before(o),i,!1)))return!0;return!1}function xp(s,e,t){if(s.focused||s.focus(),s.state.selection.eq(e))return;let n=s.state.tr.setSelection(e);n.setMeta("pointer",!0),s.dispatch(n)}function eK(s,e){if(e==-1)return!1;let t=s.state.doc.resolve(e),n=t.nodeAfter;return n&&n.isAtom&&_t.isSelectable(n)?(xp(s,new _t(t)),!0):!1}function tK(s,e){if(e==-1)return!1;let t=s.state.selection,n,i;t instanceof _t&&(n=t.node);let r=s.state.doc.resolve(e);for(let o=r.depth+1;o>0;o--){let a=o>r.depth?r.nodeAfter:r.node(o);if(_t.isSelectable(a)){n&&t.$from.depth>0&&o>=t.$from.depth&&r.before(t.$from.depth+1)==t.$from.pos?i=r.before(t.$from.depth):i=r.before(o);break}}return i!=null?(xp(s,_t.create(s.state.doc,i)),!0):!1}function sK(s,e,t,n,i){return XE(s,"handleClickOn",e,t,n)||s.someProp("handleClick",r=>r(s,e,n))||(i?tK(s,t):eK(s,t))}function nK(s,e,t,n){return XE(s,"handleDoubleClickOn",e,t,n)||s.someProp("handleDoubleClick",i=>i(s,e,n))}function iK(s,e,t,n){return XE(s,"handleTripleClickOn",e,t,n)||s.someProp("handleTripleClick",i=>i(s,e,n))||rK(s,t,n)}function rK(s,e,t){if(t.button!=0)return!1;let n=s.state.doc;if(e==-1)return n.inlineContent?(xp(s,kt.create(n,0,n.content.size)),!0):!1;let i=n.resolve(e);for(let r=i.depth+1;r>0;r--){let o=r>i.depth?i.nodeAfter:i.node(r),a=i.before(r);if(o.inlineContent)xp(s,kt.create(n,a+1,a+1+o.content.size));else if(_t.isSelectable(o))xp(s,_t.create(n,a));else continue;return!0}}function YE(s){return US(s)}const dO=Do?"metaKey":"ctrlKey";or.mousedown=(s,e)=>{let t=e;s.input.shiftKey=t.shiftKey;let n=YE(s),i=Date.now(),r="singleClick";i-s.input.lastClick.time<500&&ZG(t,s.input.lastClick)&&!t[dO]&&s.input.lastClick.button==t.button&&(s.input.lastClick.type=="singleClick"?r="doubleClick":s.input.lastClick.type=="doubleClick"&&(r="tripleClick")),s.input.lastClick={time:i,x:t.clientX,y:t.clientY,type:r,button:t.button};let o=s.posAtCoords(gk(t));o&&(r=="singleClick"?(s.input.mouseDown&&s.input.mouseDown.done(),s.input.mouseDown=new oK(s,o,t,!!n)):(r=="doubleClick"?nK:iK)(s,o.pos,o.inside,t)?t.preventDefault():od(s,"pointer"))};class oK{constructor(e,t,n,i){this.view=e,this.pos=t,this.event=n,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!n[dO],this.allowDefault=n.shiftKey;let r,o;if(t.inside>-1)r=e.state.doc.nodeAt(t.inside),o=t.inside;else{let u=e.state.doc.resolve(t.pos);r=u.parent,o=u.depth?u.before():0}const a=i?null:n.target,c=a?e.docView.nearestDesc(a,!0):null;this.target=c&&c.nodeDOM.nodeType==1?c.nodeDOM:null;let{selection:l}=e.state;n.button==0&&(r.type.spec.draggable&&r.type.spec.selectable!==!1||l instanceof _t&&l.from<=o&&l.to>o)&&(this.mightDrag={node:r,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Ho&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),od(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Mc(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(gk(e))),this.updateAllowDefault(e),this.allowDefault||!t?od(this.view,"pointer"):sK(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Ii&&this.mightDrag&&!this.mightDrag.node.isAtom||hi&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(xp(this.view,Ht.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):od(this.view,"pointer")}move(e){this.updateAllowDefault(e),od(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}or.touchstart=s=>{s.input.lastTouch=Date.now(),YE(s),od(s,"pointer")};or.touchmove=s=>{s.input.lastTouch=Date.now(),od(s,"pointer")};or.contextmenu=s=>YE(s);function hO(s,e){return s.composing?!0:Ii&&Math.abs(e.timeStamp-s.input.compositionEndedAt)<500?(s.input.compositionEndedAt=-2e8,!0):!1}const aK=wc?5e3:-1;ar.compositionstart=ar.compositionupdate=s=>{if(!s.composing){s.domObserver.flush();let{state:e}=s,t=e.selection.$to;if(e.selection instanceof kt&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(n=>n.type.spec.inclusive===!1)||hi&&z2&&lK(s)))s.markCursor=s.state.storedMarks||t.marks(),US(s,!0),s.markCursor=null;else if(US(s,!e.selection.empty),Ho&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let n=s.domSelectionRange();for(let i=n.focusNode,r=n.focusOffset;i&&i.nodeType==1&&r!=0;){let o=r<0?i.lastChild:i.childNodes[r-1];if(!o)break;if(o.nodeType==3){let a=s.domSelection();a&&a.collapse(o,o.nodeValue.length);break}else i=o,r=-1}}s.input.composing=!0}fO(s,aK)};function lK(s){let{focusNode:e,focusOffset:t}=s.domSelectionRange();if(!e||e.nodeType!=1||t>=e.childNodes.length)return!1;let n=e.childNodes[t];return n.nodeType==1&&n.contentEditable=="false"}ar.compositionend=(s,e)=>{s.composing&&(s.input.composing=!1,s.input.compositionEndedAt=e.timeStamp,s.input.compositionPendingChanges=s.domObserver.pendingRecords().length?s.input.compositionID:0,s.input.compositionNode=null,s.input.badSafariComposition?s.domObserver.forceFlush():s.input.compositionPendingChanges&&Promise.resolve().then(()=>s.domObserver.flush()),s.input.compositionID++,fO(s,20))};function fO(s,e){clearTimeout(s.input.composingTimeout),e>-1&&(s.input.composingTimeout=setTimeout(()=>US(s),e))}function pO(s){for(s.composing&&(s.input.composing=!1,s.input.compositionEndedAt=uK());s.input.compositionNodes.length>0;)s.input.compositionNodes.pop().markParentsDirty()}function cK(s){let e=s.domSelectionRange();if(!e.focusNode)return null;let t=tG(e.focusNode,e.focusOffset),n=sG(e.focusNode,e.focusOffset);if(t&&n&&t!=n){let i=n.pmViewDesc,r=s.domObserver.lastChangedTextNode;if(t==r||n==r)return r;if(!i||!i.isText(n.nodeValue))return n;if(s.input.compositionNode==n){let o=t.pmViewDesc;if(!(!o||!o.isText(t.nodeValue)))return n}}return t||n}function uK(){let s=document.createEvent("Event");return s.initEvent("event",!0,!0),s.timeStamp}function US(s,e=!1){if(!(wc&&s.domObserver.flushingSoon>=0)){if(s.domObserver.forceFlush(),pO(s),e||s.docView&&s.docView.dirty){let t=GE(s),n=s.state.selection;return t&&!t.eq(n)?s.dispatch(s.state.tr.setSelection(t)):(s.markCursor||e)&&!n.$from.node(n.$from.sharedDepth(n.to)).inlineContent?s.dispatch(s.state.tr.deleteSelection()):s.updateState(s.state),!0}return!1}}function dK(s,e){if(!s.dom.parentNode)return;let t=s.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let n=getSelection(),i=document.createRange();i.selectNodeContents(e),s.dom.blur(),n.removeAllRanges(),n.addRange(i),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),s.focus()},50)}const hy=Cr&&ld<15||cg&&oG<604;or.copy=ar.cut=(s,e)=>{let t=e,n=s.state.selection,i=t.type=="cut";if(n.empty)return;let r=hy?null:t.clipboardData,o=n.content(),{dom:a,text:c}=qE(s,o);r?(t.preventDefault(),r.clearData(),r.setData("text/html",a.innerHTML),r.setData("text/plain",c)):dK(s,a),i&&s.dispatch(s.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function hK(s){return s.openStart==0&&s.openEnd==0&&s.content.childCount==1?s.content.firstChild:null}function fK(s,e){if(!s.dom.parentNode)return;let t=s.input.shiftKey||s.state.selection.$from.parent.type.spec.code,n=s.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(n.contentEditable="true"),n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus();let i=s.input.shiftKey&&s.input.lastKeyCode!=45;setTimeout(()=>{s.focus(),n.parentNode&&n.parentNode.removeChild(n),t?fy(s,n.value,null,i,e):fy(s,n.textContent,n.innerHTML,i,e)},50)}function fy(s,e,t,n,i){let r=rO(s,e,t,n,s.state.selection.$from);if(s.someProp("handlePaste",c=>c(s,i,r||tt.empty)))return!0;if(!r)return!1;let o=hK(r),a=o?s.state.tr.replaceSelectionWith(o,n):s.state.tr.replaceSelection(r);return s.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function mO(s){let e=s.getData("text/plain")||s.getData("Text");if(e)return e;let t=s.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}ar.paste=(s,e)=>{let t=e;if(s.composing&&!wc)return;let n=hy?null:t.clipboardData,i=s.input.shiftKey&&s.input.lastKeyCode!=45;n&&fy(s,mO(n),n.getData("text/html"),i,t)?t.preventDefault():fK(s,t)};class gO{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}}const pK=Do?"altKey":"ctrlKey";function vO(s,e){let t;return s.someProp("dragCopies",n=>{t=t||n(e)}),t!=null?!t:!e[pK]}or.dragstart=(s,e)=>{let t=e,n=s.input.mouseDown;if(n&&n.done(),!t.dataTransfer)return;let i=s.state.selection,r=i.empty?null:s.posAtCoords(gk(t)),o;if(!(r&&r.pos>=i.from&&r.pos<=(i instanceof _t?i.to-1:i.to))){if(n&&n.mightDrag)o=_t.create(s.state.doc,n.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let d=s.docView.nearestDesc(t.target,!0);d&&d.node.type.spec.draggable&&d!=s.docView&&(o=_t.create(s.state.doc,d.posBefore))}}let a=(o||s.state.selection).content(),{dom:c,text:l,slice:u}=qE(s,a);(!t.dataTransfer.files.length||!hi||W2>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(hy?"Text":"text/html",c.innerHTML),t.dataTransfer.effectAllowed="copyMove",hy||t.dataTransfer.setData("text/plain",l),s.dragging=new gO(u,vO(s,t),o)};or.dragend=s=>{let e=s.dragging;window.setTimeout(()=>{s.dragging==e&&(s.dragging=null)},50)};ar.dragover=ar.dragenter=(s,e)=>e.preventDefault();ar.drop=(s,e)=>{try{mK(s,e,s.dragging)}finally{s.dragging=null}};function mK(s,e,t){if(!e.dataTransfer)return;let n=s.posAtCoords(gk(e));if(!n)return;let i=s.state.doc.resolve(n.pos),r=t&&t.slice;r?s.someProp("transformPasted",p=>{r=p(r,s,!1)}):r=rO(s,mO(e.dataTransfer),hy?null:e.dataTransfer.getData("text/html"),!1,i);let o=!!(t&&vO(s,e));if(s.someProp("handleDrop",p=>p(s,e,r||tt.empty,o))){e.preventDefault();return}if(!r)return;e.preventDefault();let a=r?m2(s.state.doc,i.pos,r):i.pos;a==null&&(a=i.pos);let c=s.state.tr;if(o){let{node:p}=t;p?p.replace(c):c.deleteSelection()}let l=c.mapping.map(a),u=r.openStart==0&&r.openEnd==0&&r.content.childCount==1,d=c.doc;if(u?c.replaceRangeWith(l,l,r.content.firstChild):c.replaceRange(l,l,r),c.doc.eq(d))return;let h=c.doc.resolve(l);if(u&&_t.isSelectable(r.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(r.content.firstChild))c.setSelection(new _t(h));else{let p=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((g,v,m,y)=>p=y),c.setSelection(KE(s,h,c.doc.resolve(p)))}s.focus(),s.dispatch(c.setMeta("uiEvent","drop"))}or.focus=s=>{s.input.lastFocus=Date.now(),s.focused||(s.domObserver.stop(),s.dom.classList.add("ProseMirror-focused"),s.domObserver.start(),s.focused=!0,setTimeout(()=>{s.docView&&s.hasFocus()&&!s.domObserver.currentSelection.eq(s.domSelectionRange())&&Mc(s)},20))};or.blur=(s,e)=>{let t=e;s.focused&&(s.domObserver.stop(),s.dom.classList.remove("ProseMirror-focused"),s.domObserver.start(),t.relatedTarget&&s.dom.contains(t.relatedTarget)&&s.domObserver.currentSelection.clear(),s.focused=!1)};or.beforeinput=(s,e)=>{if(hi&&wc&&e.inputType=="deleteContentBackward"){s.domObserver.flushSoon();let{domChangeCount:n}=s.input;setTimeout(()=>{if(s.input.domChangeCount!=n||(s.dom.blur(),s.focus(),s.someProp("handleKeyDown",r=>r(s,Dd(8,"Backspace")))))return;let{$cursor:i}=s.state.selection;i&&i.pos>0&&s.dispatch(s.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let s in ar)or[s]=ar[s];function py(s,e){if(s==e)return!0;for(let t in s)if(s[t]!==e[t])return!1;for(let t in e)if(!(t in s))return!1;return!0}class WS{constructor(e,t){this.toDOM=e,this.spec=t||Mf,this.side=this.spec.side||0}map(e,t,n,i){let{pos:r,deleted:o}=e.mapResult(t.from+i,this.side<0?-1:1);return o?null:new Ai(r-n,r-n,this)}valid(){return!0}eq(e){return this==e||e instanceof WS&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&py(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class ud{constructor(e,t){this.attrs=e,this.spec=t||Mf}map(e,t,n,i){let r=e.map(t.from+i,this.spec.inclusiveStart?-1:1)-n,o=e.map(t.to+i,this.spec.inclusiveEnd?1:-1)-n;return r>=o?null:new Ai(r,o,this)}valid(e,t){return t.from=e&&(!r||r(a.spec))&&n.push(a.copy(a.from+i,a.to+i))}for(let o=0;oe){let a=this.children[o]+1;this.children[o+2].findInner(e-a,t-a,n,i+a,r)}}map(e,t,n){return this==ki||e.maps.length==0?this:this.mapInner(e,t,0,0,n||Mf)}mapInner(e,t,n,i,r){let o;for(let a=0;a{let l=c+n,u;if(u=bO(t,a,l)){for(i||(i=this.children.slice());ra&&d.to=e){this.children[a]==e&&(n=this.children[a+2]);break}let r=e+1,o=r+t.content.size;for(let a=0;ar&&c.type instanceof ud){let l=Math.max(r,c.from)-r,u=Math.min(o,c.to)-r;li.map(e,t,Mf));return nu.from(n)}forChild(e,t){if(t.isLeaf)return js.empty;let n=[];for(let i=0;it instanceof js)?e:e.reduce((t,n)=>t.concat(n instanceof js?n:n.members),[]))}}forEachSet(e){for(let t=0;t{let m=v-g-(p-h);for(let y=0;y_+u-d)continue;let b=a[y]+u-d;p>=b?a[y+1]=h<=b?-2:-1:h>=u&&m&&(a[y]+=m,a[y+1]+=m)}d+=m}),u=t.maps[l].map(u,-1)}let c=!1;for(let l=0;l=n.content.size){c=!0;continue}let h=t.map(s[l+1]+r,-1),p=h-i,{index:g,offset:v}=n.content.findIndex(d),m=n.maybeChild(g);if(m&&v==d&&v+m.nodeSize==p){let y=a[l+2].mapInner(t,m,u+1,s[l]+r+1,o);y!=ki?(a[l]=d,a[l+1]=p,a[l+2]=y):(a[l+1]=-2,c=!0)}else c=!0}if(c){let l=vK(a,s,e,t,i,r,o),u=zS(l,n,0,o);e=u.local;for(let d=0;dt&&o.to{let l=bO(s,a,c+t);if(l){r=!0;let u=zS(l,a,t+c+1,n);u!=ki&&i.push(c,c+a.nodeSize,u)}});let o=yO(r?_O(s):s,-t).sort(xf);for(let a=0;a0;)e++;s.splice(e,0,t)}function IC(s){let e=[];return s.someProp("decorations",t=>{let n=t(s.state);n&&n!=ki&&e.push(n)}),s.cursorWrapper&&e.push(js.create(s.state.doc,[s.cursorWrapper.deco])),nu.from(e)}const yK={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},bK=Cr&&ld<=11;class _K{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class wK{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new _K,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(n=>{for(let i=0;ii.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():Ii&&e.composing&&n.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),bK&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,yK)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;tthis.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(lR(this.view)){if(this.suppressingSelectionUpdates)return Mc(this.view);if(Cr&&ld<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Lf(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,n;for(let r=e.focusNode;r;r=lg(r))t.add(r);for(let r=e.anchorNode;r;r=lg(r))if(t.has(r)){n=r;break}let i=n&&this.view.docView.nearestDesc(n);if(i&&i.ignoreMutation({type:"selection",target:n.nodeType==3?n.parentNode:n}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let n=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&lR(e)&&!this.ignoreSelectionChange(n),r=-1,o=-1,a=!1,c=[];if(e.editable)for(let u=0;uu.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let u of c)if(u.nodeName=="BR"&&u.parentNode){let d=u.nextSibling;for(;d&&d.nodeType==1;){if(d.contentEditable=="false"){u.parentNode.removeChild(u);break}d=d.firstChild}}}else if(Ho&&c.length){let u=c.filter(d=>d.nodeName=="BR");if(u.length==2){let[d,h]=u;d.parentNode&&d.parentNode.parentNode==h.parentNode?h.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let h of u){let p=h.parentNode;p&&p.nodeName=="LI"&&(!d||CK(e,d)!=p)&&h.remove()}}}let l=null;r<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)-1||i)&&(r>-1&&(e.docView.markDirty(r,o),SK(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,TK(e,c)),this.handleDOMChange(r,o,a,c),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||Mc(e),this.currentSelection.set(n))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(n==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!n||n.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;ui;m--){let y=n.childNodes[m-1],_=y.pmViewDesc;if(y.nodeName=="BR"&&!_){r=m;break}if(!_||_.size)break}let d=s.state.doc,h=s.someProp("domParser")||Uv.fromSchema(s.state.schema),p=d.resolve(o),g=null,v=h.parse(n,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:r,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:l,ruleFromNode:EK,context:p});if(l&&l[0].pos!=null){let m=l[0].pos,y=l[1]&&l[1].pos;y==null&&(y=m),g={anchor:m+o,head:y+o}}return{doc:v,sel:g,from:o,to:a}}function EK(s){let e=s.pmViewDesc;if(e)return e.parseRule();if(s.nodeName=="BR"&&s.parentNode){if(Ii&&/^(ul|ol)$/i.test(s.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(s.parentNode.lastChild==s||Ii&&/^(tr|table)$/i.test(s.parentNode.nodeName))return{ignore:!0}}else if(s.nodeName=="IMG"&&s.getAttribute("mark-placeholder"))return{ignore:!0};return null}const MK=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function xK(s,e,t,n,i){let r=s.input.compositionPendingChanges||(s.composing?s.input.compositionID:0);if(s.input.compositionPendingChanges=0,e<0){let A=s.input.lastSelectionTime>Date.now()-50?s.input.lastSelectionOrigin:null,C=GE(s,A);if(C&&!s.state.selection.eq(C)){if(hi&&wc&&s.input.lastKeyCode===13&&Date.now()-100x(s,Dd(13,"Enter"))))return;let E=s.state.tr.setSelection(C);A=="pointer"?E.setMeta("pointer",!0):A=="key"&&E.scrollIntoView(),r&&E.setMeta("composition",r),s.dispatch(E)}return}let o=s.state.doc.resolve(e),a=o.sharedDepth(t);e=o.before(a+1),t=s.state.doc.resolve(t).after(a+1);let c=s.state.selection,l=AK(s,e,t),u=s.state.doc,d=u.slice(l.from,l.to),h,p;s.input.lastKeyCode===8&&Date.now()-100Date.now()-225||wc)&&i.some(A=>A.nodeType==1&&!MK.test(A.nodeName))&&(!g||g.endA>=g.endB)&&s.someProp("handleKeyDown",A=>A(s,Dd(13,"Enter")))){s.input.lastIOSEnter=0;return}if(!g)if(n&&c instanceof kt&&!c.empty&&c.$head.sameParent(c.$anchor)&&!s.composing&&!(l.sel&&l.sel.anchor!=l.sel.head))g={start:c.from,endA:c.to,endB:c.to};else{if(l.sel){let A=_R(s,s.state.doc,l.sel);if(A&&!A.eq(s.state.selection)){let C=s.state.tr.setSelection(A);r&&C.setMeta("composition",r),s.dispatch(C)}}return}s.state.selection.froms.state.selection.from&&g.start<=s.state.selection.from+2&&s.state.selection.from>=l.from?g.start=s.state.selection.from:g.endA=s.state.selection.to-2&&s.state.selection.to<=l.to&&(g.endB+=s.state.selection.to-g.endA,g.endA=s.state.selection.to)),Cr&&ld<=11&&g.endB==g.start+1&&g.endA==g.start&&g.start>l.from&&l.doc.textBetween(g.start-l.from-1,g.start-l.from+1)=="  "&&(g.start--,g.endA--,g.endB--);let v=l.doc.resolveNoCache(g.start-l.from),m=l.doc.resolveNoCache(g.endB-l.from),y=u.resolve(g.start),_=v.sameParent(m)&&v.parent.inlineContent&&y.end()>=g.endA;if((cg&&s.input.lastIOSEnter>Date.now()-225&&(!_||i.some(A=>A.nodeName=="DIV"||A.nodeName=="P"))||!_&&v.posA(s,Dd(13,"Enter")))){s.input.lastIOSEnter=0;return}if(s.state.selection.anchor>g.start&&IK(u,g.start,g.endA,v,m)&&s.someProp("handleKeyDown",A=>A(s,Dd(8,"Backspace")))){wc&&hi&&s.domObserver.suppressSelectionUpdates();return}hi&&g.endB==g.start&&(s.input.lastChromeDelete=Date.now()),wc&&!_&&v.start()!=m.start()&&m.parentOffset==0&&v.depth==m.depth&&l.sel&&l.sel.anchor==l.sel.head&&l.sel.head==g.endA&&(g.endB-=2,m=l.doc.resolveNoCache(g.endB-l.from),setTimeout(()=>{s.someProp("handleKeyDown",function(A){return A(s,Dd(13,"Enter"))})},20));let b=g.start,k=g.endA,w=A=>{let C=A||s.state.tr.replace(b,k,l.doc.slice(g.start-l.from,g.endB-l.from));if(l.sel){let E=_R(s,C.doc,l.sel);E&&!(hi&&s.composing&&E.empty&&(g.start!=g.endB||s.input.lastChromeDeleteMc(s),20));let A=w(s.state.tr.delete(b,k)),C=u.resolve(g.start).marksAcross(u.resolve(g.endA));C&&A.ensureMarks(C),s.dispatch(A)}else if(g.endA==g.endB&&(T=RK(v.parent.content.cut(v.parentOffset,m.parentOffset),y.parent.content.cut(y.parentOffset,g.endA-y.start())))){let A=w(s.state.tr);T.type=="add"?A.addMark(b,k,T.mark):A.removeMark(b,k,T.mark),s.dispatch(A)}else if(v.parent.child(v.index()).isText&&v.index()==m.index()-(m.textOffset?0:1)){let A=v.parent.textBetween(v.parentOffset,m.parentOffset),C=()=>w(s.state.tr.insertText(A,b,k));s.someProp("handleTextInput",E=>E(s,b,k,A,C))||s.dispatch(C())}else s.dispatch(w());else s.dispatch(w())}function _R(s,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:KE(s,e.resolve(t.anchor),e.resolve(t.head))}function RK(s,e){let t=s.firstChild.marks,n=e.firstChild.marks,i=t,r=n,o,a,c;for(let u=0;uu.mark(a.addToSet(u.marks));else if(i.length==0&&r.length==1)a=r[0],o="remove",c=u=>u.mark(a.removeFromSet(u.marks));else return null;let l=[];for(let u=0;ut||PC(o,!0,!1)0&&(e||s.indexAfter(n)==s.node(n).childCount);)n--,i++,e=!1;if(t){let r=s.node(n).maybeChild(s.indexAfter(n));for(;r&&!r.isLeaf;)r=r.firstChild,i++}return i}function PK(s,e,t,n,i){let r=s.findDiffStart(e,t);if(r==null)return null;let{a:o,b:a}=s.findDiffEnd(e,t+s.size,t+e.size);if(i=="end"){let c=Math.max(0,r-Math.min(o,a));n-=o+c-r}if(o=o?r-n:0;r-=c,r&&r=a?r-n:0;r-=c,r&&r=56320&&e<=57343&&t>=55296&&t<=56319}class wO{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new qG,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(AR),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=CR(this),kR(this),this.nodeViews=TR(this),this.docView=sR(this.state.doc,SR(this),IC(this),this.dom,this),this.domObserver=new wK(this,(n,i,r,o)=>xK(this,n,i,r,o)),this.domObserver.start(),QG(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&u1(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(AR),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let n in this._props)t[n]=this._props[n];t.state=this.state;for(let n in e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var n;let i=this.state,r=!1,o=!1;e.storedMarks&&this.composing&&(pO(this),o=!0),this.state=e;let a=i.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let p=TR(this);OK(p,this.nodeViews)&&(this.nodeViews=p,r=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&u1(this),this.editable=CR(this),kR(this);let c=IC(this),l=SR(this),u=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",d=r||!this.docView.matchesNode(e.doc,l,c);(d||!e.selection.eq(i.selection))&&(o=!0);let h=u=="preserve"&&o&&this.dom.style.overflowAnchor==null&&cG(this);if(o){this.domObserver.stop();let p=d&&(Cr||hi)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&LK(i.selection,e.selection);if(d){let g=hi?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=cK(this)),(r||!this.docView.update(e.doc,l,c,this))&&(this.docView.updateOuterDeco(l),this.docView.destroy(),this.docView=sR(e.doc,l,c,this.dom,this)),g&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&LG(this))?Mc(this,p):(sO(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((n=this.dragging)===null||n===void 0)&&n.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():h&&uG(h)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof _t){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&Xx(this,t.getBoundingClientRect(),e)}else Xx(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t0&&rt.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return gG(this,e)}coordsAtPos(e,t=1){return q2(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,n=-1){let i=this.docView.posFromDOM(e,t,n);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,t){return wG(this,t||this.state,e)}pasteHTML(e,t){return fy(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return fy(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return qE(this,e)}destroy(){this.docView&&(XG(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],IC(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,ZV())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return JG(this,e)}domSelectionRange(){let e=this.domSelection();return e?Ii&&this.root.nodeType===11&&iG(this.dom.ownerDocument)==this.dom&&kK(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}wO.prototype.dispatch=function(s){let e=this._props.dispatchTransaction;e?e.call(this,s):this.updateState(this.state.apply(s))};function SR(s){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(s.editable),s.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(s.state)),t)for(let n in t)n=="class"?e.class+=" "+t[n]:n=="style"?e.style=(e.style?e.style+";":"")+t[n]:!e[n]&&n!="contenteditable"&&n!="nodeName"&&(e[n]=String(t[n]))}),e.translate||(e.translate="no"),[Ai.node(0,s.state.doc.content.size,e)]}function kR(s){if(s.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),s.cursorWrapper={dom:e,deco:Ai.widget(s.state.selection.from,e,{raw:!0,marks:s.markCursor})}}else s.cursorWrapper=null}function CR(s){return!s.someProp("editable",e=>e(s.state)===!1)}function LK(s,e){let t=Math.min(s.$anchor.sharedDepth(s.head),e.$anchor.sharedDepth(e.head));return s.$anchor.start(t)!=e.$anchor.start(t)}function TR(s){let e=Object.create(null);function t(n){for(let i in n)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=n[i])}return s.someProp("nodeViews",t),s.someProp("markViews",t),e}function OK(s,e){let t=0,n=0;for(let i in s){if(s[i]!=e[i])return!0;t++}for(let i in e)n++;return t!=n}function AR(s){if(s.spec.state||s.spec.filterTransaction||s.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var hd={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},jS={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},DK=typeof navigator<"u"&&/Mac/.test(navigator.platform),NK=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var ui=0;ui<10;ui++)hd[48+ui]=hd[96+ui]=String(ui);for(var ui=1;ui<=24;ui++)hd[ui+111]="F"+ui;for(var ui=65;ui<=90;ui++)hd[ui]=String.fromCharCode(ui+32),jS[ui]=String.fromCharCode(ui);for(var LC in hd)jS.hasOwnProperty(LC)||(jS[LC]=hd[LC]);function $K(s){var e=DK&&s.metaKey&&s.shiftKey&&!s.ctrlKey&&!s.altKey||NK&&s.shiftKey&&s.key&&s.key.length==1||s.key=="Unidentified",t=!e&&s.key||(s.shiftKey?jS:hd)[s.keyCode]||s.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}const BK=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),FK=typeof navigator<"u"&&/Win/.test(navigator.platform);function HK(s){let e=s.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let n,i,r,o;for(let a=0;a{for(var t in e)zK(s,t,{get:e[t],enumerable:!0})};function vk(s){const{state:e,transaction:t}=s;let{selection:n}=t,{doc:i}=t,{storedMarks:r}=t;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return r},get selection(){return n},get doc(){return i},get tr(){return n=t.selection,i=t.doc,r=t.storedMarks,t}}}var yk=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:t,state:n}=this,{view:i}=t,{tr:r}=n,o=this.buildProps(r);return Object.fromEntries(Object.entries(e).map(([a,c])=>[a,(...u)=>{const d=c(...u)(o);return!r.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(r),d}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){const{rawCommands:n,editor:i,state:r}=this,{view:o}=i,a=[],c=!!e,l=e||r.tr,u=()=>(!c&&t&&!l.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(l),a.every(h=>h===!0)),d={...Object.fromEntries(Object.entries(n).map(([h,p])=>[h,(...v)=>{const m=this.buildProps(l,t),y=p(...v)(m);return a.push(y),d}])),run:u};return d}createCan(e){const{rawCommands:t,state:n}=this,i=!1,r=e||n.tr,o=this.buildProps(r,i);return{...Object.fromEntries(Object.entries(t).map(([c,l])=>[c,(...u)=>l(...u)({...o,dispatch:void 0})])),chain:()=>this.createChain(r,i)}}buildProps(e,t=!0){const{rawCommands:n,editor:i,state:r}=this,{view:o}=i,a={tr:e,editor:i,view:o,state:vk({state:r,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map(([c,l])=>[c,(...u)=>l(...u)(a)]))}};return a}},kO={};eM(kO,{blur:()=>jK,clearContent:()=>VK,clearNodes:()=>GK,command:()=>KK,createParagraphNear:()=>qK,cut:()=>QK,deleteCurrentNode:()=>XK,deleteNode:()=>YK,deleteRange:()=>JK,deleteSelection:()=>tq,enter:()=>sq,exitCode:()=>nq,extendMarkRange:()=>iq,first:()=>rq,focus:()=>aq,forEach:()=>lq,insertContent:()=>cq,insertContentAt:()=>hq,joinBackward:()=>mq,joinDown:()=>pq,joinForward:()=>gq,joinItemBackward:()=>vq,joinItemForward:()=>yq,joinTextblockBackward:()=>bq,joinTextblockForward:()=>_q,joinUp:()=>fq,keyboardShortcut:()=>Sq,lift:()=>kq,liftEmptyBlock:()=>Cq,liftListItem:()=>Tq,newlineInCode:()=>Aq,resetAttributes:()=>Eq,scrollIntoView:()=>Mq,selectAll:()=>xq,selectNodeBackward:()=>Rq,selectNodeForward:()=>Iq,selectParentNode:()=>Pq,selectTextblockEnd:()=>Lq,selectTextblockStart:()=>Oq,setContent:()=>Dq,setMark:()=>sQ,setMeta:()=>nQ,setNode:()=>iQ,setNodeSelection:()=>rQ,setTextDirection:()=>oQ,setTextSelection:()=>aQ,sinkListItem:()=>lQ,splitBlock:()=>cQ,splitListItem:()=>uQ,toggleList:()=>hQ,toggleMark:()=>fQ,toggleNode:()=>pQ,toggleWrap:()=>mQ,undoInputRule:()=>gQ,unsetAllMarks:()=>vQ,unsetMark:()=>yQ,unsetTextDirection:()=>bQ,updateAttributes:()=>_Q,wrapIn:()=>wQ,wrapInList:()=>SQ});var jK=()=>({editor:s,view:e})=>(requestAnimationFrame(()=>{var t;s.isDestroyed||(e.dom.blur(),(t=window==null?void 0:window.getSelection())==null||t.removeAllRanges())}),!0),VK=(s=!0)=>({commands:e})=>e.setContent("",{emitUpdate:s}),GK=()=>({state:s,tr:e,dispatch:t})=>{const{selection:n}=e,{ranges:i}=n;return t&&i.forEach(({$from:r,$to:o})=>{s.doc.nodesBetween(r.pos,o.pos,(a,c)=>{if(a.type.isText)return;const{doc:l,mapping:u}=e,d=l.resolve(u.map(c)),h=l.resolve(u.map(c+a.nodeSize)),p=d.blockRange(h);if(!p)return;const g=wg(p);if(a.type.isTextblock){const{defaultType:v}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(p.start,v)}(g||g===0)&&e.lift(p,g)})}),!0},KK=s=>e=>s(e),qK=()=>({state:s,dispatch:e})=>$2(s,e),QK=(s,e)=>({editor:t,tr:n})=>{const{state:i}=t,r=i.doc.slice(s.from,s.to);n.deleteRange(s.from,s.to);const o=n.mapping.map(e);return n.insert(o,r.content),n.setSelection(new kt(n.doc.resolve(Math.max(o-1,0)))),!0},XK=()=>({tr:s,dispatch:e})=>{const{selection:t}=s,n=t.$anchor.node();if(n.content.size>0)return!1;const i=s.selection.$anchor;for(let r=i.depth;r>0;r-=1)if(i.node(r).type===n.type){if(e){const a=i.before(r),c=i.after(r);s.delete(a,c).scrollIntoView()}return!0}return!1};function Mn(s,e){if(typeof s=="string"){if(!e.nodes[s])throw Error(`There is no node type named '${s}'. Maybe you forgot to add the extension?`);return e.nodes[s]}return s}var YK=s=>({tr:e,state:t,dispatch:n})=>{const i=Mn(s,t.schema),r=e.selection.$anchor;for(let o=r.depth;o>0;o-=1)if(r.node(o).type===i){if(n){const c=r.before(o),l=r.after(o);e.delete(c,l).scrollIntoView()}return!0}return!1},JK=s=>({tr:e,dispatch:t})=>{const{from:n,to:i}=s;return t&&e.delete(n,i),!0},ZK=s=>s.content?/^text(\*|\+)/.test(s.content):!1,ER=(s,e,t)=>{if(!s.parent.isInline||t==="left"&&s.pos>s.start()||t==="right"&&s.pos{const n=ER(s,t,"left"),i=ER(e,t,"right");return{from:n,to:i}},tq=()=>({state:s,dispatch:e})=>{const{$from:t,$to:n}=s.selection;if(s.selection.empty)return!1;const{from:i,to:r}=eq(t,n,s.schema);return e&&(s.tr.deleteRange(i,r).scrollIntoView(),e(s.tr)),!0},sq=()=>({commands:s})=>s.keyboardShortcut("Enter"),nq=()=>({state:s,dispatch:e})=>BV(s,e);function tM(s){return Object.prototype.toString.call(s)==="[object RegExp]"}function VS(s,e,t={strict:!0}){const n=Object.keys(e);return n.length?n.every(i=>t.strict?e[i]===s[i]:tM(e[i])?e[i].test(s[i]):e[i]===s[i]):!0}function CO(s,e,t={}){return s.find(n=>n.type===e&&VS(Object.fromEntries(Object.keys(t).map(i=>[i,n.attrs[i]])),t))}function MR(s,e,t={}){return!!CO(s,e,t)}function sM(s,e,t){if(!s||!e)return;let n=s.parent.childAfter(s.parentOffset);if((!n.node||!n.node.marks.some(l=>l.type===e))&&(n=s.parent.childBefore(s.parentOffset)),!n.node||!n.node.marks.some(l=>l.type===e))return;if(!t){const l=n.node.marks.find(u=>u.type===e);l&&(t=l.attrs)}if(!CO([...n.node.marks],e,t))return;let r=n.index,o=s.start()+n.offset,a=r+1,c=o+n.node.nodeSize;for(;r>0&&MR([...s.parent.child(r-1).marks],e,t);)r-=1,o-=s.parent.child(r).nodeSize;for(;a({tr:t,state:n,dispatch:i})=>{const r=$c(s,n.schema),{doc:o,selection:a}=t,{$from:c,from:l,to:u}=a;if(i){const d=sM(c,r,e);if(d&&d.from<=l&&d.to>=u){const h=kt.create(o,d.from,d.to);t.setSelection(h)}}return!0},rq=s=>e=>{const t=typeof s=="function"?s(e):s;for(let n=0;n({editor:t,view:n,tr:i,dispatch:r})=>{e={scrollIntoView:!0,...e};const o=()=>{(GS()||xR())&&n.dom.focus(),oq()&&!GS()&&!xR()&&n.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{t.isDestroyed||(n.focus(),e!=null&&e.scrollIntoView&&t.commands.scrollIntoView())})};try{if(n.hasFocus()&&s===null||s===!1)return!0}catch{return!1}if(r&&s===null&&!TO(t.state.selection))return o(),!0;const a=AO(i.doc,s)||t.state.selection,c=t.state.selection.eq(a);return r&&(c||i.setSelection(a),c&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},lq=(s,e)=>t=>s.every((n,i)=>e(n,{...t,index:i})),cq=(s,e)=>({tr:t,commands:n})=>n.insertContentAt({from:t.selection.from,to:t.selection.to},s,e),EO=s=>{const e=s.childNodes;for(let t=e.length-1;t>=0;t-=1){const n=e[t];n.nodeType===3&&n.nodeValue&&/^(\n\s\s|\n)$/.test(n.nodeValue)?s.removeChild(n):n.nodeType===1&&EO(n)}return s};function G_(s){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`${s}`,t=new window.DOMParser().parseFromString(e,"text/html").body;return EO(t)}function my(s,e,t){if(s instanceof Tc||s instanceof He)return s;t={slice:!0,parseOptions:{},...t};const n=typeof s=="object"&&s!==null,i=typeof s=="string";if(n)try{if(Array.isArray(s)&&s.length>0)return He.fromArray(s.map(a=>e.nodeFromJSON(a)));const o=e.nodeFromJSON(s);return t.errorOnInvalidContent&&o.check(),o}catch(r){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:r});return console.warn("[tiptap warn]: Invalid content.","Passed value:",s,"Error:",r),my("",e,t)}if(i){if(t.errorOnInvalidContent){let o=!1,a="";const c=new i2({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:l=>(o=!0,a=typeof l=="string"?l:l.outerHTML,null)}]}})});if(t.slice?Uv.fromSchema(c).parseSlice(G_(s),t.parseOptions):Uv.fromSchema(c).parse(G_(s),t.parseOptions),t.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const r=Uv.fromSchema(e);return t.slice?r.parseSlice(G_(s),t.parseOptions).content:r.parse(G_(s),t.parseOptions)}return my("",e,t)}function uq(s,e,t){const n=s.steps.length-1;if(n{o===0&&(o=u)}),s.setSelection(Ht.near(s.doc.resolve(o),t))}var dq=s=>!("type"in s),hq=(s,e,t)=>({tr:n,dispatch:i,editor:r})=>{var o;if(i){t={parseOptions:r.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let a;const c=m=>{r.emit("contentError",{editor:r,error:m,disableCollaboration:()=>{"collaboration"in r.storage&&typeof r.storage.collaboration=="object"&&r.storage.collaboration&&(r.storage.collaboration.isDisabled=!0)}})},l={preserveWhitespace:"full",...t.parseOptions};if(!t.errorOnInvalidContent&&!r.options.enableContentCheck&&r.options.emitContentError)try{my(e,r.schema,{parseOptions:l,errorOnInvalidContent:!0})}catch(m){c(m)}try{a=my(e,r.schema,{parseOptions:l,errorOnInvalidContent:(o=t.errorOnInvalidContent)!=null?o:r.options.enableContentCheck})}catch(m){return c(m),!1}let{from:u,to:d}=typeof s=="number"?{from:s,to:s}:{from:s.from,to:s.to},h=!0,p=!0;if((dq(a)?a:[a]).forEach(m=>{m.check(),h=h?m.isText&&m.marks.length===0:!1,p=p?m.isBlock:!1}),u===d&&p){const{parent:m}=n.doc.resolve(u);m.isTextblock&&!m.type.spec.code&&!m.childCount&&(u-=1,d+=1)}let v;if(h){if(Array.isArray(e))v=e.map(m=>m.text||"").join("");else if(e instanceof He){let m="";e.forEach(y=>{y.text&&(m+=y.text)}),v=m}else typeof e=="object"&&e&&e.text?v=e.text:v=e;n.insertText(v,u,d)}else{v=a;const m=n.doc.resolve(u),y=m.node(),_=m.parentOffset===0,b=y.isText||y.isTextblock,k=y.content.size>0;_&&b&&k&&p&&(u=Math.max(0,u-1)),n.replaceWith(u,d,v)}t.updateSelection&&uq(n,n.steps.length-1,-1),t.applyInputRules&&n.setMeta("applyInputRules",{from:u,text:v}),t.applyPasteRules&&n.setMeta("applyPasteRules",{from:u,text:v})}return!0},fq=()=>({state:s,dispatch:e})=>DV(s,e),pq=()=>({state:s,dispatch:e})=>NV(s,e),mq=()=>({state:s,dispatch:e})=>R2(s,e),gq=()=>({state:s,dispatch:e})=>O2(s,e),vq=()=>({state:s,dispatch:e,tr:t})=>{try{const n=hk(s.doc,s.selection.$from.pos,-1);return n==null?!1:(t.join(n,2),e&&e(t),!0)}catch{return!1}},yq=()=>({state:s,dispatch:e,tr:t})=>{try{const n=hk(s.doc,s.selection.$from.pos,1);return n==null?!1:(t.join(n,2),e&&e(t),!0)}catch{return!1}},bq=()=>({state:s,dispatch:e})=>LV(s,e),_q=()=>({state:s,dispatch:e})=>OV(s,e);function MO(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function wq(s){const e=s.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let n,i,r,o;for(let a=0;a({editor:e,view:t,tr:n,dispatch:i})=>{const r=wq(s).split(/-(?!$)/),o=r.find(l=>!["Alt","Ctrl","Meta","Shift"].includes(l)),a=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:r.includes("Alt"),ctrlKey:r.includes("Ctrl"),metaKey:r.includes("Meta"),shiftKey:r.includes("Shift"),bubbles:!0,cancelable:!0}),c=e.captureTransaction(()=>{t.someProp("handleKeyDown",l=>l(t,a))});return c==null||c.steps.forEach(l=>{const u=l.map(n.mapping);u&&i&&n.maybeStep(u)}),!0};function fd(s,e,t={}){const{from:n,to:i,empty:r}=s.selection,o=e?Mn(e,s.schema):null,a=[];s.doc.nodesBetween(n,i,(d,h)=>{if(d.isText)return;const p=Math.max(n,h),g=Math.min(i,h+d.nodeSize);a.push({node:d,from:p,to:g})});const c=i-n,l=a.filter(d=>o?o.name===d.node.type.name:!0).filter(d=>VS(d.node.attrs,t,{strict:!1}));return r?!!l.length:l.reduce((d,h)=>d+h.to-h.from,0)>=c}var kq=(s,e={})=>({state:t,dispatch:n})=>{const i=Mn(s,t.schema);return fd(t,i,e)?$V(t,n):!1},Cq=()=>({state:s,dispatch:e})=>B2(s,e),Tq=s=>({state:e,dispatch:t})=>{const n=Mn(s,e.schema);return QV(n)(e,t)},Aq=()=>({state:s,dispatch:e})=>N2(s,e);function bk(s,e){return e.nodes[s]?"node":e.marks[s]?"mark":null}function RR(s,e){const t=typeof e=="string"?[e]:e;return Object.keys(s).reduce((n,i)=>(t.includes(i)||(n[i]=s[i]),n),{})}var Eq=(s,e)=>({tr:t,state:n,dispatch:i})=>{let r=null,o=null;const a=bk(typeof s=="string"?s:s.name,n.schema);if(!a)return!1;a==="node"&&(r=Mn(s,n.schema)),a==="mark"&&(o=$c(s,n.schema));let c=!1;return t.selection.ranges.forEach(l=>{n.doc.nodesBetween(l.$from.pos,l.$to.pos,(u,d)=>{r&&r===u.type&&(c=!0,i&&t.setNodeMarkup(d,void 0,RR(u.attrs,e))),o&&u.marks.length&&u.marks.forEach(h=>{o===h.type&&(c=!0,i&&t.addMark(d,d+u.nodeSize,o.create(RR(h.attrs,e))))})})}),c},Mq=()=>({tr:s,dispatch:e})=>(e&&s.scrollIntoView(),!0),xq=()=>({tr:s,dispatch:e})=>{if(e){const t=new Ec(s.doc);s.setSelection(t)}return!0},Rq=()=>({state:s,dispatch:e})=>P2(s,e),Iq=()=>({state:s,dispatch:e})=>D2(s,e),Pq=()=>({state:s,dispatch:e})=>UV(s,e),Lq=()=>({state:s,dispatch:e})=>jV(s,e),Oq=()=>({state:s,dispatch:e})=>zV(s,e);function d1(s,e,t={},n={}){return my(s,e,{slice:!1,parseOptions:t,errorOnInvalidContent:n.errorOnInvalidContent})}var Dq=(s,{errorOnInvalidContent:e,emitUpdate:t=!0,parseOptions:n={}}={})=>({editor:i,tr:r,dispatch:o,commands:a})=>{const{doc:c}=r;if(n.preserveWhitespace!=="full"){const l=d1(s,i.schema,n,{errorOnInvalidContent:e??i.options.enableContentCheck});return o&&r.replaceWith(0,c.content.size,l).setMeta("preventUpdate",!t),!0}return o&&r.setMeta("preventUpdate",!t),a.insertContentAt({from:0,to:c.content.size},s,{parseOptions:n,errorOnInvalidContent:e??i.options.enableContentCheck})};function xO(s,e){const t=$c(e,s.schema),{from:n,to:i,empty:r}=s.selection,o=[];r?(s.storedMarks&&o.push(...s.storedMarks),o.push(...s.selection.$head.marks())):s.doc.nodesBetween(n,i,c=>{o.push(...c.marks)});const a=o.find(c=>c.type.name===t.name);return a?{...a.attrs}:{}}function RO(s,e){const t=new S2(s);return e.forEach(n=>{n.steps.forEach(i=>{t.step(i)})}),t}function Nq(s){for(let e=0;e{t(i)&&n.push({node:i,pos:r})}),n}function Bq(s,e){for(let t=s.depth;t>0;t-=1){const n=s.node(t);if(e(n))return{pos:t>0?s.before(t):0,start:s.start(t),depth:t,node:n}}}function _k(s){return e=>Bq(e.$from,s)}function dt(s,e,t){return s.config[e]===void 0&&s.parent?dt(s.parent,e,t):typeof s.config[e]=="function"?s.config[e].bind({...t,parent:s.parent?dt(s.parent,e,t):null}):s.config[e]}function nM(s){return s.map(e=>{const t={name:e.name,options:e.options,storage:e.storage},n=dt(e,"addExtensions",t);return n?[e,...nM(n())]:e}).flat(10)}function iM(s,e){const t=Hf.fromSchema(e).serializeFragment(s),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(t),i.innerHTML}function IO(s){return typeof s=="function"}function ls(s,e=void 0,...t){return IO(s)?e?s.bind(e)(...t):s(...t):s}function Fq(s={}){return Object.keys(s).length===0&&s.constructor===Object}function ug(s){const e=s.filter(i=>i.type==="extension"),t=s.filter(i=>i.type==="node"),n=s.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:n}}function PO(s){const e=[],{nodeExtensions:t,markExtensions:n}=ug(s),i=[...t,...n],r={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=t.filter(l=>l.name!=="text").map(l=>l.name),a=n.map(l=>l.name),c=[...o,...a];return s.forEach(l=>{const u={name:l.name,options:l.options,storage:l.storage,extensions:i},d=dt(l,"addGlobalAttributes",u);if(!d)return;d().forEach(p=>{let g;Array.isArray(p.types)?g=p.types:p.types==="*"?g=c:p.types==="nodes"?g=o:p.types==="marks"?g=a:g=[],g.forEach(v=>{Object.entries(p.attributes).forEach(([m,y])=>{e.push({type:v,name:m,attribute:{...r,...y}})})})})}),i.forEach(l=>{const u={name:l.name,options:l.options,storage:l.storage},d=dt(l,"addAttributes",u);if(!d)return;const h=d();Object.entries(h).forEach(([p,g])=>{const v={...r,...g};typeof(v==null?void 0:v.default)=="function"&&(v.default=v.default()),v!=null&&v.isRequired&&(v==null?void 0:v.default)===void 0&&delete v.default,e.push({type:l.name,name:p,attribute:v})})}),e}function Hq(s){const e=[];let t="",n=!1,i=!1,r=0;const o=s.length;for(let a=0;a0){r-=1,t+=c;continue}if(c===";"&&r===0){e.push(t),t="";continue}}t+=c}return t&&e.push(t),e}function IR(s){const e=[],t=Hq(s||""),n=t.length;for(let i=0;i!!e).reduce((e,t)=>{const n={...e};return Object.entries(t).forEach(([i,r])=>{if(!n[i]){n[i]=r;return}if(i==="class"){const a=r?String(r).split(" "):[],c=n[i]?n[i].split(" "):[],l=a.filter(u=>!c.includes(u));n[i]=[...c,...l].join(" ")}else if(i==="style"){const a=new Map([...IR(n[i]),...IR(r)]);n[i]=Array.from(a.entries()).map(([c,l])=>`${c}: ${l}`).join("; ")}else n[i]=r}),n},{})}function gy(s,e){return e.filter(t=>t.type===s.type.name).filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(s.attrs)||{}:{[t.name]:s.attrs[t.name]}).reduce((t,n)=>Vs(t,n),{})}function Uq(s){return typeof s!="string"?s:s.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(s):s==="true"?!0:s==="false"?!1:s}function PR(s,e){return"style"in s?s:{...s,getAttrs:t=>{const n=s.getAttrs?s.getAttrs(t):s.attrs;if(n===!1)return!1;const i=e.reduce((r,o)=>{const a=o.attribute.parseHTML?o.attribute.parseHTML(t):Uq(t.getAttribute(o.name));return a==null?r:{...r,[o.name]:a}},{});return{...n,...i}}}}function LR(s){return Object.fromEntries(Object.entries(s).filter(([e,t])=>e==="attrs"&&Fq(t)?!1:t!=null))}function OR(s){var e,t;const n={};return!((e=s==null?void 0:s.attribute)!=null&&e.isRequired)&&"default"in((s==null?void 0:s.attribute)||{})&&(n.default=s.attribute.default),((t=s==null?void 0:s.attribute)==null?void 0:t.validate)!==void 0&&(n.validate=s.attribute.validate),[s.name,n]}function Wq(s,e){var t;const n=PO(s),{nodeExtensions:i,markExtensions:r}=ug(s),o=(t=i.find(l=>dt(l,"topNode")))==null?void 0:t.name,a=Object.fromEntries(i.map(l=>{const u=n.filter(y=>y.type===l.name),d={name:l.name,options:l.options,storage:l.storage,editor:e},h=s.reduce((y,_)=>{const b=dt(_,"extendNodeSchema",d);return{...y,...b?b(l):{}}},{}),p=LR({...h,content:ls(dt(l,"content",d)),marks:ls(dt(l,"marks",d)),group:ls(dt(l,"group",d)),inline:ls(dt(l,"inline",d)),atom:ls(dt(l,"atom",d)),selectable:ls(dt(l,"selectable",d)),draggable:ls(dt(l,"draggable",d)),code:ls(dt(l,"code",d)),whitespace:ls(dt(l,"whitespace",d)),linebreakReplacement:ls(dt(l,"linebreakReplacement",d)),defining:ls(dt(l,"defining",d)),isolating:ls(dt(l,"isolating",d)),attrs:Object.fromEntries(u.map(OR))}),g=ls(dt(l,"parseHTML",d));g&&(p.parseDOM=g.map(y=>PR(y,u)));const v=dt(l,"renderHTML",d);v&&(p.toDOM=y=>v({node:y,HTMLAttributes:gy(y,u)}));const m=dt(l,"renderText",d);return m&&(p.toText=m),[l.name,p]})),c=Object.fromEntries(r.map(l=>{const u=n.filter(m=>m.type===l.name),d={name:l.name,options:l.options,storage:l.storage,editor:e},h=s.reduce((m,y)=>{const _=dt(y,"extendMarkSchema",d);return{...m,..._?_(l):{}}},{}),p=LR({...h,inclusive:ls(dt(l,"inclusive",d)),excludes:ls(dt(l,"excludes",d)),group:ls(dt(l,"group",d)),spanning:ls(dt(l,"spanning",d)),code:ls(dt(l,"code",d)),attrs:Object.fromEntries(u.map(OR))}),g=ls(dt(l,"parseHTML",d));g&&(p.parseDOM=g.map(m=>PR(m,u)));const v=dt(l,"renderHTML",d);return v&&(p.toDOM=m=>v({mark:m,HTMLAttributes:gy(m,u)})),[l.name,p]}));return new i2({topNode:o,nodes:a,marks:c})}function zq(s){const e=s.filter((t,n)=>s.indexOf(t)!==n);return Array.from(new Set(e))}function Vv(s){return s.sort((t,n)=>{const i=dt(t,"priority")||100,r=dt(n,"priority")||100;return i>r?-1:in.name));return t.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${t.map(n=>`'${n}'`).join(", ")}]. This can lead to issues.`),e}function OO(s,e,t){const{from:n,to:i}=e,{blockSeparator:r=` `,textSerializers:o={}}=t||{};let a="";return s.nodesBetween(n,i,(c,l,u,d)=>{var h;c.isBlock&&l>n&&(a+=r);const p=o==null?void 0:o[c.type.name];if(p)return u&&(a+=p({node:c,pos:l,parent:u,index:d,range:e})),!1;c.isText&&(a+=(h=c==null?void 0:c.text)==null?void 0:h.slice(Math.max(n,l)-l,i-l))}),a}function jq(s,e){const t={from:0,to:s.content.size};return OO(s,t,e)}function DO(s){return Object.fromEntries(Object.entries(s.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function Vq(s,e){const t=Mn(e,s.schema),{from:n,to:i}=s.selection,r=[];s.doc.nodesBetween(n,i,a=>{r.push(a)});const o=r.reverse().find(a=>a.type.name===t.name);return o?{...o.attrs}:{}}function NO(s,e){const t=bk(typeof e=="string"?e:e.name,s.schema);return t==="node"?Vq(s,e):t==="mark"?xO(s,e):{}}function Gq(s,e=JSON.stringify){const t={};return s.filter(n=>{const i=e(n);return Object.prototype.hasOwnProperty.call(t,i)?!1:t[i]=!0})}function Kq(s){const e=Gq(s);return e.length===1?e:e.filter((t,n)=>!e.filter((r,o)=>o!==n).some(r=>t.oldRange.from>=r.oldRange.from&&t.oldRange.to<=r.oldRange.to&&t.newRange.from>=r.newRange.from&&t.newRange.to<=r.newRange.to))}function $O(s){const{mapping:e,steps:t}=s,n=[];return e.maps.forEach((i,r)=>{const o=[];if(i.ranges.length)i.forEach((a,c)=>{o.push({from:a,to:c})});else{const{from:a,to:c}=t[r];if(a===void 0||c===void 0)return;o.push({from:a,to:c})}o.forEach(({from:a,to:c})=>{const l=e.slice(r).map(a,-1),u=e.slice(r).map(c),d=e.invert().map(l,-1),h=e.invert().map(u);n.push({oldRange:{from:d,to:h},newRange:{from:l,to:u}})})}),Kq(n)}function rM(s,e,t){const n=[];return s===e?t.resolve(s).marks().forEach(i=>{const r=t.resolve(s),o=sM(r,i.type);o&&n.push({mark:i,...o})}):t.nodesBetween(s,e,(i,r)=>{!i||(i==null?void 0:i.nodeSize)===void 0||n.push(...i.marks.map(o=>({from:r,to:r+i.nodeSize,mark:o})))}),n}var qq=(s,e,t,n=20)=>{const i=s.doc.resolve(t);let r=n,o=null;for(;r>0&&o===null;){const a=i.node(r);(a==null?void 0:a.type.name)===e?o=a:r-=1}return[o,r]};function Dg(s,e){return e.nodes[s]||e.marks[s]||null}function Iw(s,e,t){return Object.fromEntries(Object.entries(t).filter(([n])=>{const i=s.find(r=>r.type===e&&r.name===n);return i?i.attribute.keepOnSplit:!1}))}var Qq=(s,e=500)=>{let t="";const n=s.parentOffset;return s.parent.nodesBetween(Math.max(0,n-e),n,(i,r,o,a)=>{var c,l;const u=((l=(c=i.type.spec).toText)==null?void 0:l.call(c,{node:i,pos:r,parent:o,index:a}))||i.textContent||"%leaf%";t+=i.isAtom&&!i.isText?u:u.slice(0,Math.max(0,n-r))}),t};function h1(s,e,t={}){const{empty:n,ranges:i}=s.selection,r=e?$c(e,s.schema):null;if(n)return!!(s.storedMarks||s.selection.$from.marks()).filter(d=>r?r.name===d.type.name:!0).find(d=>VS(d.attrs,t,{strict:!1}));let o=0;const a=[];if(i.forEach(({$from:d,$to:h})=>{const p=d.pos,g=h.pos;s.doc.nodesBetween(p,g,(v,m)=>{if(r&&v.inlineContent&&!v.type.allowsMarkType(r))return!1;if(!v.isText&&!v.marks.length)return;const y=Math.max(p,m),_=Math.min(g,m+v.nodeSize),b=_-y;o+=b,a.push(...v.marks.map(k=>({mark:k,from:y,to:_})))})}),o===0)return!1;const c=a.filter(d=>r?r.name===d.mark.type.name:!0).filter(d=>VS(d.mark.attrs,t,{strict:!1})).reduce((d,h)=>d+h.to-h.from,0),l=a.filter(d=>r?d.mark.type!==r&&d.mark.type.excludes(r):!0).reduce((d,h)=>d+h.to-h.from,0);return(c>0?c+l:c)>=o}function Xq(s,e,t={}){if(!e)return fd(s,null,t)||h1(s,null,t);const n=bk(e,s.schema);return n==="node"?fd(s,e,t):n==="mark"?h1(s,e,t):!1}var Yq=(s,e)=>{const{$from:t,$to:n,$anchor:i}=s.selection;if(e){const r=_k(a=>a.type.name===e)(s.selection);if(!r)return!1;const o=s.doc.resolve(r.pos+1);return i.pos+1===o.end()}return!(n.parentOffset{const{$from:e,$to:t}=s.selection;return!(e.parentOffset>0||e.pos!==t.pos)};function DR(s,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===s.name):e}function DC(s,e){const{nodeExtensions:t}=ug(e),n=t.find(o=>o.name===s);if(!n)return!1;const i={name:n.name,options:n.options,storage:n.storage},r=ls(dt(n,"group",i));return typeof r!="string"?!1:r.split(" ").includes("list")}function vy(s,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){var n;if(t){if(s.type.name==="hardBreak")return!0;if(s.isText)return!/\S/.test((n=s.text)!=null?n:"")}if(s.isText)return!s.text;if(s.isAtom||s.isLeaf)return!1;if(s.content.childCount===0)return!0;if(e){let i=!0;return s.content.forEach(r=>{i!==!1&&(vy(r,{ignoreWhitespace:t,checkChildren:e})||(i=!1))}),i}return!1}function BO(s){return s instanceof _t}var FO=class HO{constructor(e){this.position=e}static fromJSON(e){return new HO(e.position)}toJSON(){return{position:this.position}}};function Zq(s,e){const t=e.mapping.mapResult(s.position);return{position:new FO(t.pos),mapResult:t}}function eQ(s){return new FO(s)}function tQ(s,e,t){var n;const{selection:i}=e;let r=null;if(TO(i)&&(r=i.$cursor),r){const a=(n=s.storedMarks)!=null?n:r.marks();return r.parent.type.allowsMarkType(t)&&(!!t.isInSet(a)||!a.some(l=>l.type.excludes(t)))}const{ranges:o}=i;return o.some(({$from:a,$to:c})=>{let l=a.depth===0?s.doc.inlineContent&&s.doc.type.allowsMarkType(t):!1;return s.doc.nodesBetween(a.pos,c.pos,(u,d,h)=>{if(l)return!1;if(u.isInline){const p=!h||h.type.allowsMarkType(t),g=!!t.isInSet(u.marks)||!u.marks.some(v=>v.type.excludes(t));l=p&&g}return!l}),l})}var sQ=(s,e={})=>({tr:t,state:n,dispatch:i})=>{const{selection:r}=t,{empty:o,ranges:a}=r,c=$c(s,n.schema);if(i)if(o){const l=xO(n,c);t.addStoredMark(c.create({...l,...e}))}else a.forEach(l=>{const u=l.$from.pos,d=l.$to.pos;n.doc.nodesBetween(u,d,(h,p)=>{const g=Math.max(p,u),v=Math.min(p+h.nodeSize,d);h.marks.find(y=>y.type===c)?h.marks.forEach(y=>{c===y.type&&t.addMark(g,v,c.create({...y.attrs,...e}))}):t.addMark(g,v,c.create(e))})});return tQ(n,t,c)},nQ=(s,e)=>({tr:t})=>(t.setMeta(s,e),!0),iQ=(s,e={})=>({state:t,dispatch:n,chain:i})=>{const r=Mn(s,t.schema);let o;return t.selection.$anchor.sameParent(t.selection.$head)&&(o=t.selection.$anchor.parent.attrs),r.isTextblock?i().command(({commands:a})=>Kx(r,{...o,...e})(t)?!0:a.clearNodes()).command(({state:a})=>Kx(r,{...o,...e})(a,n)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},rQ=s=>({tr:e,dispatch:t})=>{if(t){const{doc:n}=e,i=zd(s,0,n.content.size),r=_t.create(n,i);e.setSelection(r)}return!0},oQ=(s,e)=>({tr:t,state:n,dispatch:i})=>{const{selection:r}=n;let o,a;return typeof e=="number"?(o=e,a=e):e&&"from"in e&&"to"in e?(o=e.from,a=e.to):(o=r.from,a=r.to),i&&t.doc.nodesBetween(o,a,(c,l)=>{c.isText||t.setNodeMarkup(l,void 0,{...c.attrs,dir:s})}),!0},aQ=s=>({tr:e,dispatch:t})=>{if(t){const{doc:n}=e,{from:i,to:r}=typeof s=="number"?{from:s,to:s}:s,o=kt.atStart(n).from,a=kt.atEnd(n).to,c=zd(i,o,a),l=zd(r,o,a),u=kt.create(n,c,l);e.setSelection(u)}return!0},lQ=s=>({state:e,dispatch:t})=>{const n=Mn(s,e.schema);return JV(n)(e,t)};function NR(s,e){const t=s.storedMarks||s.selection.$to.parentOffset&&s.selection.$from.marks();if(t){const n=t.filter(i=>e==null?void 0:e.includes(i.type.name));s.tr.ensureMarks(n)}}var cQ=({keepMarks:s=!0}={})=>({tr:e,state:t,dispatch:n,editor:i})=>{const{selection:r,doc:o}=e,{$from:a,$to:c}=r,l=i.extensionManager.attributes,u=Iw(l,a.node().type.name,a.node().attrs);if(r instanceof _t&&r.node.isBlock)return!a.parentOffset||!Ac(o,a.pos)?!1:(n&&(s&&NR(t,i.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const d=c.parentOffset===c.parent.content.size,h=a.depth===0?void 0:Nq(a.node(-1).contentMatchAt(a.indexAfter(-1)));let p=d&&h?[{type:h,attrs:u}]:void 0,g=Ac(e.doc,e.mapping.map(a.pos),1,p);if(!p&&!g&&Ac(e.doc,e.mapping.map(a.pos),1,h?[{type:h}]:void 0)&&(g=!0,p=h?[{type:h,attrs:u}]:void 0),n){if(g&&(r instanceof kt&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,p),h&&!d&&!a.parentOffset&&a.parent.type!==h)){const v=e.mapping.map(a.before()),m=e.doc.resolve(v);a.node(-1).canReplaceWith(m.index(),m.index()+1,h)&&e.setNodeMarkup(e.mapping.map(a.before()),h)}s&&NR(t,i.extensionManager.splittableMarks),e.scrollIntoView()}return g},uQ=(s,e={})=>({tr:t,state:n,dispatch:i,editor:r})=>{var o;const a=Mn(s,n.schema),{$from:c,$to:l}=n.selection,u=n.selection.node;if(u&&u.isBlock||c.depth<2||!c.sameParent(l))return!1;const d=c.node(-1);if(d.type!==a)return!1;const h=r.extensionManager.attributes;if(c.parent.content.size===0&&c.node(-1).childCount===c.indexAfter(-1)){if(c.depth===2||c.node(-3).type!==a||c.index(-2)!==c.node(-2).childCount-1)return!1;if(i){let y=He.empty;const _=c.index(-1)?1:c.index(-2)?2:3;for(let C=c.depth-_;C>=c.depth-3;C-=1)y=He.from(c.node(C).copy(y));const b=c.indexAfter(-1){if(A>-1)return!1;C.isTextblock&&C.content.size===0&&(A=E+1)}),A>-1&&t.setSelection(kt.near(t.doc.resolve(A))),t.scrollIntoView()}return!0}const p=l.pos===c.end()?d.contentMatchAt(0).defaultType:null,g={...Iw(h,d.type.name,d.attrs),...e},v={...Iw(h,c.node().type.name,c.node().attrs),...e};t.delete(c.pos,l.pos);const m=p?[{type:a,attrs:g},{type:p,attrs:v}]:[{type:a,attrs:g}];if(!Ac(t.doc,c.pos,2))return!1;if(i){const{selection:y,storedMarks:_}=n,{splittableMarks:b}=r.extensionManager,k=_||y.$to.parentOffset&&y.$from.marks();if(t.split(c.pos,2,m).scrollIntoView(),!k||!i)return!0;const w=k.filter(T=>b.includes(T.type.name));t.ensureMarks(w)}return!0},NC=(s,e)=>{const t=_k(o=>o.type===e)(s.selection);if(!t)return!0;const n=s.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(n===void 0)return!0;const i=s.doc.nodeAt(n);return t.node.type===(i==null?void 0:i.type)&&vd(s.doc,t.pos)&&s.join(t.pos),!0},$C=(s,e)=>{const t=_k(o=>o.type===e)(s.selection);if(!t)return!0;const n=s.doc.resolve(t.start).after(t.depth);if(n===void 0)return!0;const i=s.doc.nodeAt(n);return t.node.type===(i==null?void 0:i.type)&&vd(s.doc,n)&&s.join(n),!0};function dQ(s){const e=s.doc,t=e.firstChild;if(!t)return null;const n=e.resolve(1),i=e.resolve(t.nodeSize-1);return kt.between(n,i)}var hQ=(s,e,t,n={})=>({editor:i,tr:r,state:o,dispatch:a,chain:c,commands:l,can:u})=>{const{extensions:d,splittableMarks:h}=i.extensionManager,p=Mn(s,o.schema),g=Mn(e,o.schema),{selection:v,storedMarks:m}=o,{$from:y,$to:_}=v,b=y.blockRange(_),k=m||v.$to.parentOffset&&v.$from.marks();if(!b)return!1;const w=_k(O=>DC(O.type.name,d))(v),T=v.from===0&&v.to===o.doc.content.size,A=o.doc.content.content,C=A.length===1?A[0]:null,E=T&&C&&DC(C.type.name,d)?{node:C,pos:0}:null,x=w??E,D=!!w&&b.depth>=1&&b.depth-w.depth<=1,N=!!E;if((D||N)&&x){if(x.node.type===p)return T&&N?c().command(({tr:O,dispatch:G})=>{const Z=dQ(O);return Z?(O.setSelection(Z),G&&G(O),!0):!1}).liftListItem(g).run():l.liftListItem(g);if(DC(x.node.type.name,d)&&p.validContent(x.node.content))return c().command(()=>(r.setNodeMarkup(x.pos,p),!0)).command(()=>NC(r,p)).command(()=>$C(r,p)).run()}return!t||!k||!a?c().command(()=>u().wrapInList(p,n)?!0:l.clearNodes()).wrapInList(p,n).command(()=>NC(r,p)).command(()=>$C(r,p)).run():c().command(()=>{const O=u().wrapInList(p,n),G=k.filter(Z=>h.includes(Z.type.name));return r.ensureMarks(G),O?!0:l.clearNodes()}).wrapInList(p,n).command(()=>NC(r,p)).command(()=>$C(r,p)).run()},fQ=(s,e={},t={})=>({state:n,commands:i})=>{const{extendEmptyMarkRange:r=!1}=t,o=$c(s,n.schema);return h1(n,o,e)?i.unsetMark(o,{extendEmptyMarkRange:r}):i.setMark(o,e)},pQ=(s,e,t={})=>({state:n,commands:i})=>{const r=Mn(s,n.schema),o=Mn(e,n.schema),a=fd(n,r,t);let c;return n.selection.$anchor.sameParent(n.selection.$head)&&(c=n.selection.$anchor.parent.attrs),a?i.setNode(o,c):i.setNode(r,{...c,...t})},mQ=(s,e={})=>({state:t,commands:n})=>{const i=Mn(s,t.schema);return fd(t,i,e)?n.lift(i):n.wrapIn(i,e)},gQ=()=>({state:s,dispatch:e})=>{const t=s.plugins;for(let n=0;n=0;c-=1)o.step(a.steps[c].invert(a.docs[c]));if(r.text){const c=o.doc.resolve(r.from).marks();o.replaceWith(r.from,r.to,s.schema.text(r.text,c))}else o.delete(r.from,r.to)}return!0}}return!1},vQ=(s={})=>({tr:e,dispatch:t,editor:n})=>{const{ignoreClearable:i=!1}=s,{selection:r}=e,{empty:o,ranges:a}=r;if(o)return!0;const{nonClearableMarks:c}=n.extensionManager;if(t){const l=Object.values(n.schema.marks).filter(u=>i||!c.includes(u.name));a.forEach(u=>{for(const d of l)e.removeMark(u.$from.pos,u.$to.pos,d)})}return!0},yQ=(s,e={})=>({tr:t,state:n,dispatch:i})=>{var r;const{extendEmptyMarkRange:o=!1}=e,{selection:a}=t,c=$c(s,n.schema),{$from:l,empty:u,ranges:d}=a;if(!i)return!0;if(u&&o){let{from:h,to:p}=a;const g=(r=l.marks().find(m=>m.type===c))==null?void 0:r.attrs,v=sM(l,c,g);v&&(h=v.from,p=v.to),t.removeMark(h,p,c)}else d.forEach(h=>{t.removeMark(h.$from.pos,h.$to.pos,c)});return t.removeStoredMark(c),!0},bQ=s=>({tr:e,state:t,dispatch:n})=>{const{selection:i}=t;let r,o;return typeof s=="number"?(r=s,o=s):s&&"from"in s&&"to"in s?(r=s.from,o=s.to):(r=i.from,o=i.to),n&&e.doc.nodesBetween(r,o,(a,c)=>{if(a.isText)return;const l={...a.attrs};delete l.dir,e.setNodeMarkup(c,void 0,l)}),!0},_Q=(s,e={})=>({tr:t,state:n,dispatch:i})=>{let r=null,o=null;const a=bk(typeof s=="string"?s:s.name,n.schema);if(!a)return!1;a==="node"&&(r=Mn(s,n.schema)),a==="mark"&&(o=$c(s,n.schema));let c=!1;return t.selection.ranges.forEach(l=>{const u=l.$from.pos,d=l.$to.pos;let h,p,g,v;t.selection.empty?n.doc.nodesBetween(u,d,(m,y)=>{r&&r===m.type&&(c=!0,g=Math.max(y,u),v=Math.min(y+m.nodeSize,d),h=y,p=m)}):n.doc.nodesBetween(u,d,(m,y)=>{y=u&&y<=d&&(r&&r===m.type&&(c=!0,i&&t.setNodeMarkup(y,void 0,{...m.attrs,...e})),o&&m.marks.length&&m.marks.forEach(_=>{if(o===_.type&&(c=!0,i)){const b=Math.max(y,u),k=Math.min(y+m.nodeSize,d);t.addMark(b,k,o.create({..._.attrs,...e}))}}))}),p&&(h!==void 0&&i&&t.setNodeMarkup(h,void 0,{...p.attrs,...e}),o&&p.marks.length&&p.marks.forEach(m=>{o===m.type&&i&&t.addMark(g,v,o.create({...m.attrs,...e}))}))}),c},wQ=(s,e={})=>({state:t,dispatch:n})=>{const i=Mn(s,t.schema);return VV(i,e)(t,n)},SQ=(s,e={})=>({state:t,dispatch:n})=>{const i=Mn(s,t.schema);return GV(i,e)(t,n)},kQ=class{constructor(){this.callbacks={}}on(s,e){return this.callbacks[s]||(this.callbacks[s]=[]),this.callbacks[s].push(e),this}emit(s,...e){const t=this.callbacks[s];return t&&t.forEach(n=>n.apply(this,e)),this}off(s,e){const t=this.callbacks[s];return t&&(e?this.callbacks[s]=t.filter(n=>n!==e):delete this.callbacks[s]),this}once(s,e){const t=(...n)=>{this.off(s,t),e.apply(this,n)};return this.on(s,t)}removeAllListeners(){this.callbacks={}}},wk=class{constructor(s){var e;this.find=s.find,this.handler=s.handler,this.undoable=(e=s.undoable)!=null?e:!0}},CQ=(s,e)=>{if(tM(e))return e.exec(s);const t=e(s);if(!t)return null;const n=[t.text];return n.index=t.index,n.input=s,n.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),n.push(t.replaceWith)),n};function K_(s){var e;const{editor:t,from:n,to:i,text:r,rules:o,plugin:a}=s,{view:c}=t;if(c.composing)return!1;const l=c.state.doc.resolve(n);if(l.parent.type.spec.code||(e=l.nodeBefore||l.nodeAfter)!=null&&e.marks.find(h=>h.type.spec.code))return!1;let u=!1;const d=Qq(l)+r;return o.forEach(h=>{if(u)return;const p=CQ(d,h.find);if(!p)return;const g=c.state.tr,v=vk({state:c.state,transaction:g}),m={from:n-(p[0].length-r.length),to:i},{commands:y,chain:_,can:b}=new yk({editor:t,state:v});h.handler({state:v,range:m,match:p,commands:y,chain:_,can:b})===null||!g.steps.length||(h.undoable&&g.setMeta(a,{transform:g,from:n,to:i,text:r}),c.dispatch(g),u=!0)}),u}function TQ(s){const{editor:e,rules:t}=s,n=new Gs({state:{init(){return null},apply(i,r,o){const a=i.getMeta(n);if(a)return a;const c=i.getMeta("applyInputRules");return!!c&&setTimeout(()=>{let{text:u}=c;typeof u=="string"?u=u:u=iM(He.from(u),o.schema);const{from:d}=c,h=d+u.length;K_({editor:e,from:d,to:h,text:u,rules:t,plugin:n})}),i.selectionSet||i.docChanged?null:r}},props:{handleTextInput(i,r,o,a){return K_({editor:e,from:r,to:o,text:a,rules:t,plugin:n})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:r}=i.state.selection;r&&K_({editor:e,from:r.pos,to:r.pos,text:"",rules:t,plugin:n})}),!1)},handleKeyDown(i,r){if(r.key!=="Enter")return!1;const{$cursor:o}=i.state.selection;return o?K_({editor:e,from:o.pos,to:o.pos,text:` `,rules:t,plugin:n}):!1}},isInputRules:!0});return n}function AQ(s){return Object.prototype.toString.call(s).slice(8,-1)}function q_(s){return AQ(s)!=="Object"?!1:s.constructor===Object&&Object.getPrototypeOf(s)===Object.prototype}function UO(s,e){const t={...s};return q_(s)&&q_(e)&&Object.keys(e).forEach(n=>{q_(e[n])&&q_(s[n])?t[n]=UO(s[n],e[n]):t[n]=e[n]}),t}var oM=class{constructor(s={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...s},this.name=this.config.name}get options(){return{...ls(dt(this,"addOptions",{name:this.name}))}}get storage(){return{...ls(dt(this,"addStorage",{name:this.name,options:this.options}))}}configure(s={}){const e=this.extend({...this.config,addOptions:()=>UO(this.options,s)});return e.name=this.name,e.parent=this.parent,this.child=null,e}extend(s={}){const e=new this.constructor({...this.config,...s});return e.parent=this,this.child=e,e.name="name"in s?s.name:e.parent.name,e}},Uf=class WO extends oM{constructor(){super(...arguments),this.type="mark"}static create(e={}){const t=typeof e=="function"?e():e;return new WO(t)}static handleExit({editor:e,mark:t}){const{tr:n}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const o=i.marks();if(!!!o.find(l=>(l==null?void 0:l.type.name)===t.name))return!1;const c=o.find(l=>(l==null?void 0:l.type.name)===t.name);return c&&n.removeStoredMark(c),n.insertText(" ",i.pos),e.view.dispatch(n),!0}return!1}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};function EQ(s){return typeof s=="number"}var MQ=class{constructor(s){this.find=s.find,this.handler=s.handler}},xQ=(s,e,t)=>{if(tM(e))return[...s.matchAll(e)];const n=e(s,t);return n?n.map(i=>{const r=[i.text];return r.index=i.index,r.input=s,r.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),r.push(i.replaceWith)),r}):[]};function RQ(s){const{editor:e,state:t,from:n,to:i,rule:r,pasteEvent:o,dropEvent:a}=s,{commands:c,chain:l,can:u}=new yk({editor:e,state:t}),d=[];return t.doc.nodesBetween(n,i,(p,g)=>{var v,m,y,_,b;if((m=(v=p.type)==null?void 0:v.spec)!=null&&m.code||!(p.isText||p.isTextblock||p.isInline))return;const k=(b=(_=(y=p.content)==null?void 0:y.size)!=null?_:p.nodeSize)!=null?b:0,w=Math.max(n,g),T=Math.min(i,g+k);if(w>=T)return;const A=p.isText?p.text||"":p.textBetween(w-g,T-g,void 0,"");xQ(A,r.find,o).forEach(E=>{if(E.index===void 0)return;const x=w+E.index+1,D=x+E[0].length,N={from:t.tr.mapping.map(x),to:t.tr.mapping.map(D)},O=r.handler({state:t,range:N,match:E,commands:c,chain:l,can:u,pasteEvent:o,dropEvent:a});d.push(O)})}),d.every(p=>p!==null)}var Q_=null,IQ=s=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)==null||e.setData("text/html",s),t};function PQ(s){const{editor:e,rules:t}=s;let n=null,i=!1,r=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const c=({state:u,from:d,to:h,rule:p,pasteEvt:g})=>{const v=u.tr,m=vk({state:u,transaction:v});if(!(!RQ({editor:e,state:m,from:Math.max(d-1,0),to:h.b-1,rule:p,pasteEvent:g,dropEvent:a})||!v.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,v}};return t.map(u=>new Gs({view(d){const h=g=>{var v;n=(v=d.dom.parentElement)!=null&&v.contains(g.target)?d.dom.parentElement:null,n&&(Q_=e)},p=()=>{Q_&&(Q_=null)};return window.addEventListener("dragstart",h),window.addEventListener("dragend",p),{destroy(){window.removeEventListener("dragstart",h),window.removeEventListener("dragend",p)}}},props:{handleDOMEvents:{drop:(d,h)=>{if(r=n===d.dom.parentElement,a=h,!r){const p=Q_;p!=null&&p.isEditable&&setTimeout(()=>{const g=p.state.selection;g&&p.commands.deleteRange({from:g.from,to:g.to})},10)}return!1},paste:(d,h)=>{var p;const g=(p=h.clipboardData)==null?void 0:p.getData("text/html");return o=h,i=!!(g!=null&&g.includes("data-pm-slice")),!1}}},appendTransaction:(d,h,p)=>{const g=d[0],v=g.getMeta("uiEvent")==="paste"&&!i,m=g.getMeta("uiEvent")==="drop"&&!r,y=g.getMeta("applyPasteRules"),_=!!y;if(!v&&!m&&!_)return;if(_){let{text:w}=y;typeof w=="string"?w=w:w=iM(He.from(w),p.schema);const{from:T}=y,A=T+w.length,C=IQ(w);return c({rule:u,state:p,from:T,to:{b:A},pasteEvt:C})}const b=h.doc.content.findDiffStart(p.doc.content),k=h.doc.content.findDiffEnd(p.doc.content);if(!(!EQ(b)||!k||b===k.b))return c({rule:u,state:p,from:b,to:k,pasteEvt:o})}}))}var Sk=class{constructor(s,e){this.splittableMarks=[],this.nonClearableMarks=[],this.editor=e,this.baseExtensions=s,this.extensions=LO(s),this.schema=Wq(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((s,e)=>{const t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Dg(e.name,this.schema)},n=dt(e,"addCommands",t);return n?{...s,...n()}:s},{})}get plugins(){const{editor:s}=this;return Vv([...this.extensions].reverse()).flatMap(n=>{const i={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:s,type:Dg(n.name,this.schema)},r=[],o=dt(n,"addKeyboardShortcuts",i);let a={};if(n.type==="mark"&&dt(n,"exitable",i)&&(a.ArrowRight=()=>Uf.handleExit({editor:s,mark:n})),o){const h=Object.fromEntries(Object.entries(o()).map(([p,g])=>[p,()=>g({editor:s})]));a={...a,...h}}const c=WK(a);r.push(c);const l=dt(n,"addInputRules",i);if(DR(n,s.options.enableInputRules)&&l){const h=l();if(h&&h.length){const p=TQ({editor:s,rules:h}),g=Array.isArray(p)?p:[p];r.push(...g)}}const u=dt(n,"addPasteRules",i);if(DR(n,s.options.enablePasteRules)&&u){const h=u();if(h&&h.length){const p=PQ({editor:s,rules:h});r.push(...p)}}const d=dt(n,"addProseMirrorPlugins",i);if(d){const h=d();r.push(...h)}return r})}get attributes(){return PO(this.extensions)}get nodeViews(){const{editor:s}=this,{nodeExtensions:e}=ug(this.extensions);return Object.fromEntries(e.filter(t=>!!dt(t,"addNodeView")).map(t=>{const n=this.attributes.filter(c=>c.type===t.name),i={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:s,type:Mn(t.name,this.schema)},r=dt(t,"addNodeView",i);if(!r)return[];const o=r();if(!o)return[];const a=(c,l,u,d,h)=>{const p=gy(c,n);return o({node:c,view:l,getPos:u,decorations:d,innerDecorations:h,editor:s,extension:t,HTMLAttributes:p})};return[t.name,a]}))}dispatchTransaction(s){const{editor:e}=this;return Vv([...this.extensions].reverse()).reduceRight((n,i)=>{const r={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:Dg(i.name,this.schema)},o=dt(i,"dispatchTransaction",r);return o?a=>{o.call(r,{transaction:a,next:n})}:n},s)}transformPastedHTML(s){const{editor:e}=this;return Vv([...this.extensions]).reduce((n,i)=>{const r={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:Dg(i.name,this.schema)},o=dt(i,"transformPastedHTML",r);return o?(a,c)=>{const l=n(a,c);return o.call(r,l)}:n},s||(n=>n))}get markViews(){const{editor:s}=this,{markExtensions:e}=ug(this.extensions);return Object.fromEntries(e.filter(t=>!!dt(t,"addMarkView")).map(t=>{const n=this.attributes.filter(a=>a.type===t.name),i={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:s,type:$c(t.name,this.schema)},r=dt(t,"addMarkView",i);if(!r)return[];const o=(a,c,l)=>{const u=gy(a,n);return r()({mark:a,view:c,inline:l,editor:s,extension:t,HTMLAttributes:u,updateAttributes:d=>{VQ(a,s,d)}})};return[t.name,o]}))}destroy(){this.extensions.forEach(s=>{let e=s;for(;e.parent;){const t=e.parent;t.child===e&&(t.child=null),e=t}}),this.extensions=[],this.baseExtensions=[],this.schema=null,this.editor=null}setupExtensions(){const s=this.extensions;this.editor.extensionStorage=Object.fromEntries(s.map(e=>[e.name,e.storage])),s.forEach(e=>{var t,n;const i={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Dg(e.name,this.schema)};e.type==="mark"&&(((t=ls(dt(e,"keepOnSplit",i)))==null||t)&&this.splittableMarks.push(e.name),(n=ls(dt(e,"clearable",i)))==null||n||this.nonClearableMarks.push(e.name));const r=dt(e,"onBeforeCreate",i),o=dt(e,"onCreate",i),a=dt(e,"onUpdate",i),c=dt(e,"onSelectionUpdate",i),l=dt(e,"onTransaction",i),u=dt(e,"onFocus",i),d=dt(e,"onBlur",i),h=dt(e,"onDestroy",i);r&&this.editor.on("beforeCreate",r),o&&this.editor.on("create",o),a&&this.editor.on("update",a),c&&this.editor.on("selectionUpdate",c),l&&this.editor.on("transaction",l),u&&this.editor.on("focus",u),d&&this.editor.on("blur",d),h&&this.editor.on("destroy",h)})}};Sk.resolve=LO;Sk.sort=Vv;Sk.flatten=nM;var LQ={};eM(LQ,{ClipboardTextSerializer:()=>jO,Commands:()=>VO,Delete:()=>GO,Drop:()=>KO,Editable:()=>qO,FocusEvents:()=>XO,Keymap:()=>YO,Paste:()=>JO,Tabindex:()=>ZO,TextDirection:()=>eD,focusEventsPluginKey:()=>QO});var fn=class zO extends oM{constructor(){super(...arguments),this.type="extension"}static create(e={}){const t=typeof e=="function"?e():e;return new zO(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},jO=fn.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Gs({key:new _n("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:s}=this,{state:e,schema:t}=s,{doc:n,selection:i}=e,r=DO(t),{blockSeparator:o}=this.options,a={...o!==void 0?{blockSeparator:o}:{},textSerializers:r};return[...i.ranges].sort((l,u)=>l.$from.pos-u.$from.pos).map(({$from:l,$to:u})=>OO(n,{from:l.pos,to:u.pos},a)).join(o??` `)}}})]}}),VO=fn.create({name:"commands",addCommands(){return{...kO}}}),GO=fn.create({name:"delete",onUpdate({transaction:s,appendedTransactions:e}){var t,n,i;const r=()=>{var o,a,c,l;if((l=(c=(a=(o=this.editor.options.coreExtensionOptions)==null?void 0:o.delete)==null?void 0:a.filterTransaction)==null?void 0:c.call(a,s))!=null?l:s.getMeta("y-sync$"))return;const u=RO(s.before,[s,...e]);$O(u).forEach(p=>{u.mapping.mapResult(p.oldRange.from).deletedAfter&&u.mapping.mapResult(p.oldRange.to).deletedBefore&&u.before.nodesBetween(p.oldRange.from,p.oldRange.to,(g,v)=>{const m=v+g.nodeSize-2,y=p.oldRange.from<=v&&m<=p.oldRange.to;this.editor.emit("delete",{type:"node",node:g,from:v,to:m,newFrom:u.mapping.map(v),newTo:u.mapping.map(m),deletedRange:p.oldRange,newRange:p.newRange,partial:!y,editor:this.editor,transaction:s,combinedTransform:u})})});const h=u.mapping;u.steps.forEach((p,g)=>{var v,m;if(p instanceof _g){const y=h.slice(g).map(p.from,-1),_=h.slice(g).map(p.to),b=h.invert().map(y,-1),k=h.invert().map(_),w=y>0?(v=u.doc.nodeAt(y-1))==null?void 0:v.marks.some(A=>A.eq(p.mark)):!1,T=(m=u.doc.nodeAt(_))==null?void 0:m.marks.some(A=>A.eq(p.mark));this.editor.emit("delete",{type:"mark",mark:p.mark,from:p.from,to:p.to,deletedRange:{from:b,to:k},newRange:{from:y,to:_},partial:!!(T||w),editor:this.editor,transaction:s,combinedTransform:u})}})};(i=(n=(t=this.editor.options.coreExtensionOptions)==null?void 0:t.delete)==null?void 0:n.async)==null||i?setTimeout(r,0):r()}}),KO=fn.create({name:"drop",addProseMirrorPlugins(){return[new Gs({key:new _n("tiptapDrop"),props:{handleDrop:(s,e,t,n)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:n})}}})]}}),qO=fn.create({name:"editable",addProseMirrorPlugins(){return[new Gs({key:new _n("editable"),props:{editable:()=>this.editor.options.editable}})]}}),QO=new _n("focusEvents"),XO=fn.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:s}=this;return[new Gs({key:QO,props:{handleDOMEvents:{focus:(e,t)=>{s.isFocused=!0;const n=s.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(n),!1},blur:(e,t)=>{s.isFocused=!1;const n=s.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(n),!1}}}})]}}),YO=fn.create({name:"keymap",addKeyboardShortcuts(){const s=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:a})=>{const{selection:c,doc:l}=a,{empty:u,$anchor:d}=c,{pos:h,parent:p}=d,g=d.parent.isTextblock&&h>0?a.doc.resolve(h-1):d,v=g.parent.type.spec.isolating,m=d.pos-d.parentOffset,y=v&&g.parent.childCount===1?m===d.pos:Ht.atStart(l).from===h;return!u||!p.type.isTextblock||p.textContent.length||!y||y&&d.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:s,"Mod-Backspace":s,"Shift-Backspace":s,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...n},r={...n,"Ctrl-h":s,"Alt-Backspace":s,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return GS()||MO()?r:i},addProseMirrorPlugins(){return[new Gs({key:new _n("clearDocument"),appendTransaction:(s,e,t)=>{if(s.some(v=>v.getMeta("composition")))return;const n=s.some(v=>v.docChanged)&&!e.doc.eq(t.doc),i=s.some(v=>v.getMeta("preventClearDocument"));if(!n||i)return;const{empty:r,from:o,to:a}=e.selection,c=Ht.atStart(e.doc).from,l=Ht.atEnd(e.doc).to;if(r||!(o===c&&a===l)||!vy(t.doc))return;const h=t.tr,p=vk({state:t,transaction:h}),{commands:g}=new yk({editor:this.editor,state:p});if(g.clearNodes(),!!h.steps.length)return h}})]}}),JO=fn.create({name:"paste",addProseMirrorPlugins(){return[new Gs({key:new _n("tiptapPaste"),props:{handlePaste:(s,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),ZO=fn.create({name:"tabindex",addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new Gs({key:new _n("tabindex"),props:{attributes:()=>{var s;return!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:(s=this.options.value)!=null?s:"0"}}}})]}}),eD=fn.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:s}=ug(this.extensions);return[{types:s.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const t=e.getAttribute("dir");return t&&(t==="ltr"||t==="rtl"||t==="auto")?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new Gs({key:new _n("textDirection"),props:{attributes:()=>{const s=this.options.direction;return s?{dir:s}:{}}}})]}}),OQ=class ev{constructor(e,t,n=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=e,this.editor=t,this.currentNode=i}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,n=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}t=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:t,to:n},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),t=this.resolvedPos.doc.resolve(e);return new ev(t,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new ev(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new ev(e,this.editor)}get children(){const e=[];return this.node.content.forEach((t,n)=>{const i=t.isBlock&&!t.isTextblock,r=t.isAtom&&!t.isText,o=t.isInline,a=this.pos+n+(r?0:1);if(a<0||a>this.resolvedPos.doc.nodeSize-2)return;const c=this.resolvedPos.doc.resolve(a);if(!i&&!o&&c.depth<=this.depth)return;const l=new ev(c,this.editor,i,i||o?t:null);i&&(l.actualDepth=this.depth+1),e.push(l)}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,t={}){let n=null,i=this.parent;for(;i&&!n;){if(i.node.type.name===e)if(Object.keys(t).length>0){const r=i.node.attrs,o=Object.keys(t);for(let a=0;a{n&&i.length>0||(o.node.type.name===e&&r.every(c=>t[c]===o.node.attrs[c])&&i.push(o),!(n&&i.length>0)&&(i=i.concat(o.querySelectorAll(e,t,n))))}),i}setAttribute(e){const{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},DQ=`.ProseMirror { position: relative; } .ProseMirror { word-wrap: break-word; white-space: pre-wrap; white-space: break-spaces; -webkit-font-variant-ligatures: none; font-variant-ligatures: none; font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */ } .ProseMirror [contenteditable="false"] { white-space: normal; } .ProseMirror [contenteditable="false"] [contenteditable="true"] { white-space: pre-wrap; } .ProseMirror pre { white-space: pre-wrap; } img.ProseMirror-separator { display: inline !important; border: none !important; margin: 0 !important; width: 0 !important; height: 0 !important; } .ProseMirror-gapcursor { display: none; pointer-events: none; position: absolute; margin: 0; } .ProseMirror-gapcursor:after { content: ""; display: block; position: absolute; top: -2px; width: 20px; border-top: 1px solid black; animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite; } @keyframes ProseMirror-cursor-blink { to { visibility: hidden; } } .ProseMirror-hideselection *::selection { background: transparent; } .ProseMirror-hideselection *::-moz-selection { background: transparent; } .ProseMirror-hideselection * { caret-color: transparent; } .ProseMirror-focused .ProseMirror-gapcursor { display: block; }`;function tD(s,e,t){const n=document.querySelector(`style[data-tiptap-style${t?`-${t}`:""}]`);if(n!==null)return n;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute(`data-tiptap-style${t?`-${t}`:""}`,""),i.innerHTML=s,document.getElementsByTagName("head")[0].appendChild(i),i}var NQ=class extends kQ{constructor(e={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.destroyed=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:i})=>{throw i},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:Zq,createMappablePosition:eQ},this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:i,slice:r,moved:o})=>this.options.onDrop(i,r,o)),this.on("paste",({event:i,slice:r})=>this.options.onPaste(i,r)),this.on("delete",this.options.onDelete);const t=this.createDoc(),n=AO(t,this.options.autofocus);this.editorState=Tp.create({doc:t,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(e){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(e),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const e=this.editorView.dom;e!=null&&e.editor&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn("Failed to remove CSS element:",e)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=tD(DQ,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if(t==="state")return this.editorState;if(t in e)return Reflect.get(e,t);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){const n=IO(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],i=this.state.reconfigure({plugins:n});return this.view.updateState(i),i}unregisterPlugin(e){if(this.isDestroyed)return;const t=this.state.plugins;let n=t;if([].concat(e).forEach(r=>{const o=typeof r=="string"?`${r}$`:r.key;n=n.filter(a=>!a.key.startsWith(o))}),t.length===n.length)return;const i=this.state.reconfigure({plugins:n});return this.view.updateState(i),i}createExtensionManager(){var e,t,n,i;const o=[...this.options.enableCoreExtensions?[qO,jO.configure({blockSeparator:(t=(e=this.options.coreExtensionOptions)==null?void 0:e.clipboardTextSerializer)==null?void 0:t.blockSeparator}),VO,XO,YO,ZO.configure({value:(i=(n=this.options.coreExtensionOptions)==null?void 0:n.tabindex)==null?void 0:i.value}),KO,JO,GO,eD.configure({direction:this.options.textDirection})].filter(a=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[a.name]!==!1:!0):[],...this.options.extensions].filter(a=>["extension","node","mark"].includes(a==null?void 0:a.type));this.extensionManager=new Sk(o,this)}createCommandManager(){this.commandManager=new yk({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=d1(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(t.message))throw t;this.emit("contentError",{editor:this,error:t,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(n=>n.name!=="collaboration"),this.createExtensionManager()}}),e=d1(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){const{editorProps:t,enableExtensionDispatchTransaction:n}=this.options,i=t.dispatchTransaction||this.dispatchTransaction.bind(this),r=n?this.extensionManager.dispatchTransaction(i):i,o=t.transformPastedHTML,a=this.extensionManager.transformPastedHTML(o);this.editorView=new wO(e,{...t,attributes:{role:"textbox",...t==null?void 0:t.attributes},dispatchTransaction:r,transformPastedHTML:a,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const c=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(c),this.prependClass(),this.injectCSS();const l=this.view.dom;l.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(u=>{var d;return(d=this.capturedTransaction)==null?void 0:d.step(u)});return}const{state:t,transactions:n}=this.state.applyTransaction(e),i=!this.state.selection.eq(t.selection),r=n.includes(e),o=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),!r)return;this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e,appendedTransactions:n.slice(1)}),i&&this.emit("selectionUpdate",{editor:this,transaction:e});const a=n.findLast(u=>u.getMeta("focus")||u.getMeta("blur")),c=a==null?void 0:a.getMeta("focus"),l=a==null?void 0:a.getMeta("blur");c&&this.emit("focus",{editor:this,event:c.event,transaction:a}),l&&this.emit("blur",{editor:this,event:l.event,transaction:a}),!(e.getMeta("preventUpdate")||!n.some(u=>u.docChanged)||o.doc.eq(t.doc))&&this.emit("update",{editor:this,transaction:e,appendedTransactions:n.slice(1)})}getAttributes(e){return NO(this.state,e)}isActive(e,t){const n=typeof e=="string"?e:null,i=typeof e=="string"?t:e;return Xq(this.state,n,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return iM(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t=` `,textSerializers:n={}}=e||{};return jq(this.state.doc,{blockSeparator:t,textSerializers:{...DO(this.schema),...n}})}get isEmpty(){return vy(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit("destroy"),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){var e,t;return(t=(e=this.editorView)==null?void 0:e.isDestroyed)!=null?t:!0}$node(e,t){var n;return((n=this.$doc)==null?void 0:n.querySelector(e,t))||null}$nodes(e,t){var n;return((n=this.$doc)==null?void 0:n.querySelectorAll(e,t))||null}$pos(e){const t=this.state.doc.resolve(e),n=e>0&&t.nodeAfter&&!t.nodeAfter.isText?t.nodeAfter:null;return new OQ(t,this,!1,n)}get $doc(){return this.$pos(0)}};function dg(s){return new wk({find:s.find,handler:({state:e,range:t,match:n})=>{const i=ls(s.getAttributes,void 0,n);if(i===!1||i===null)return null;const{tr:r}=e,o=n[n.length-1],a=n[0];if(o){const c=a.search(/\S/),l=t.from+a.indexOf(o),u=l+o.length;if(rM(t.from,t.to,e.doc).filter(p=>p.mark.type.excluded.find(v=>v===s.type&&v!==p.mark.type)).filter(p=>p.to>l).length)return null;ut.from&&r.delete(t.from+c,l);const h=t.from+c+o.length;r.addMark(t.from+c,h,s.type.create(i||{})),r.removeStoredMark(s.type)}},undoable:s.undoable})}function $Q(s){return new wk({find:s.find,handler:({state:e,range:t,match:n})=>{const i=ls(s.getAttributes,void 0,n)||{},{tr:r}=e,o=t.from;let a=t.to;const c=s.type.create(i);if(n[1]){const l=n[0].lastIndexOf(n[1]);let u=o+l;u>a?u=a:a=u+n[1].length;const d=n[0][n[0].length-1];r.insertText(d,o+n[0].length-1),r.replaceWith(u,a,c)}else if(n[0]){const l=s.type.isInline?o:o-1;r.insert(l,s.type.create(i)).delete(r.mapping.map(o),r.mapping.map(a))}r.scrollIntoView()},undoable:s.undoable})}function f1(s){return new wk({find:s.find,handler:({state:e,range:t,match:n})=>{const i=e.doc.resolve(t.from),r=ls(s.getAttributes,void 0,n)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),s.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,s.type,r)},undoable:s.undoable})}function hg(s){return new wk({find:s.find,handler:({state:e,range:t,match:n,chain:i})=>{const r=ls(s.getAttributes,void 0,n)||{},o=e.tr.delete(t.from,t.to),c=o.doc.resolve(t.from).blockRange(),l=c&&HE(c,s.type,r);if(!l)return null;if(o.wrap(c,l),s.keepMarks&&s.editor){const{selection:d,storedMarks:h}=e,{splittableMarks:p}=s.editor.extensionManager,g=h||d.$to.parentOffset&&d.$from.marks();if(g){const v=g.filter(m=>p.includes(m.type.name));o.ensureMarks(v)}}if(s.keepAttributes){const d=s.type.name==="bulletList"||s.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(d,r).run()}const u=o.doc.resolve(t.from-1).nodeBefore;u&&u.type===s.type&&vd(o.doc,t.from-1)&&(!s.joinPredicate||s.joinPredicate(n,u))&&o.join(t.from-1)},undoable:s.undoable})}function BQ(s,e){const{selection:t}=s,{$from:n}=t;if(t instanceof _t){const r=n.index();return n.parent.canReplaceWith(r,r+1,e)}let i=n.depth;for(;i>=0;){const r=n.index(i);if(n.node(i).contentMatchAt(r).matchType(e))return!0;i-=1}return!1}function FQ(s){return s.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}var HQ={};eM(HQ,{createAtomBlockMarkdownSpec:()=>UQ,createBlockMarkdownSpec:()=>WQ,createInlineMarkdownSpec:()=>sD,parseAttributes:()=>aM,parseIndentedBlocks:()=>p1,renderNestedMarkdownContent:()=>cM,serializeAttributes:()=>lM});function aM(s){if(!(s!=null&&s.trim()))return{};const e={},t=[],n=s.replace(/["']([^"']*)["']/g,l=>(t.push(l),`__QUOTED_${t.length-1}__`)),i=n.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(i){const l=i.map(u=>u.trim().slice(1));e.class=l.join(" ")}const r=n.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);r&&(e.id=r[1]);const o=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(n.matchAll(o)).forEach(([,l,u])=>{var d;const h=parseInt(((d=u.match(/__QUOTED_(\d+)__/))==null?void 0:d[1])||"0",10),p=t[h];p&&(e[l]=p.slice(1,-1))});const c=n.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return c&&c.split(/\s+/).filter(Boolean).forEach(u=>{u.match(/^[a-zA-Z][\w-]*$/)&&(e[u]=!0)}),e}function lM(s){if(!s||Object.keys(s).length===0)return"";const e=[];return s.class&&String(s.class).split(/\s+/).filter(Boolean).forEach(n=>e.push(`.${n}`)),s.id&&e.push(`#${s.id}`),Object.entries(s).forEach(([t,n])=>{t==="class"||t==="id"||(n===!0?e.push(t):n!==!1&&n!=null&&e.push(`${t}="${String(n)}"`))}),e.join(" ")}function UQ(s){const{nodeName:e,name:t,parseAttributes:n=aM,serializeAttributes:i=lM,defaultAttributes:r={},requiredAttributes:o=[],allowedAttributes:a}=s,c=t||e,l=u=>{if(!a)return u;const d={};return a.forEach(h=>{h in u&&(d[h]=u[h])}),d};return{parseMarkdown:(u,d)=>{const h={...r,...u.attributes};return d.createNode(e,h,[])},markdownTokenizer:{name:e,level:"block",start(u){var d;const h=new RegExp(`^:::${c}(?:\\s|$)`,"m"),p=(d=u.match(h))==null?void 0:d.index;return p!==void 0?p:-1},tokenize(u,d,h){const p=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),g=u.match(p);if(!g)return;const v=g[1]||"",m=n(v);if(!o.find(_=>!(_ in m)))return{type:e,raw:g[0],attributes:m}}},renderMarkdown:u=>{const d=l(u.attrs||{}),h=i(d),p=h?` {${h}}`:"";return`:::${c}${p} :::`}}}function WQ(s){const{nodeName:e,name:t,getContent:n,parseAttributes:i=aM,serializeAttributes:r=lM,defaultAttributes:o={},content:a="block",allowedAttributes:c}=s,l=t||e,u=d=>{if(!c)return d;const h={};return c.forEach(p=>{p in d&&(h[p]=d[p])}),h};return{parseMarkdown:(d,h)=>{let p;if(n){const v=n(d);p=typeof v=="string"?[{type:"text",text:v}]:v}else a==="block"?p=h.parseChildren(d.tokens||[]):p=h.parseInline(d.tokens||[]);const g={...o,...d.attributes};return h.createNode(e,g,p)},markdownTokenizer:{name:e,level:"block",start(d){var h;const p=new RegExp(`^:::${l}`,"m"),g=(h=d.match(p))==null?void 0:h.index;return g!==void 0?g:-1},tokenize(d,h,p){var g;const v=new RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),m=d.match(v);if(!m)return;const[y,_=""]=m,b=i(_);let k=1;const w=y.length;let T="";const A=/^:::([\w-]*)(\s.*)?/gm,C=d.slice(w);for(A.lastIndex=0;;){const E=A.exec(C);if(E===null)break;const x=E.index,D=E[1];if(!((g=E[2])!=null&&g.endsWith(":::"))){if(D)k+=1;else if(k-=1,k===0){const N=C.slice(0,x);T=N.trim();const O=d.slice(0,w+x+E[0].length);let G=[];if(T)if(a==="block")for(G=p.blockTokens(N),G.forEach(Z=>{Z.text&&(!Z.tokens||Z.tokens.length===0)&&(Z.tokens=p.inlineTokens(Z.text))});G.length>0;){const Z=G[G.length-1];if(Z.type==="paragraph"&&(!Z.text||Z.text.trim()===""))G.pop();else break}else G=p.inlineTokens(T);return{type:e,raw:O,attributes:b,content:T,tokens:G}}}}}},renderMarkdown:(d,h)=>{const p=u(d.attrs||{}),g=r(p),v=g?` {${g}}`:"",m=h.renderChildren(d.content||[],` `);return`:::${l}${v} ${m} :::`}}}function zQ(s){if(!s.trim())return{};const e={},t=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let n=t.exec(s);for(;n!==null;){const[,i,r,o]=n;e[i]=r||o,n=t.exec(s)}return e}function jQ(s){return Object.entries(s).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(" ")}function sD(s){const{nodeName:e,name:t,getContent:n,parseAttributes:i=zQ,serializeAttributes:r=jQ,defaultAttributes:o={},selfClosing:a=!1,allowedAttributes:c}=s,l=t||e,u=h=>{if(!c)return h;const p={};return c.forEach(g=>{const v=typeof g=="string"?g:g.name,m=typeof g=="string"?void 0:g.skipIfDefault;if(v in h){const y=h[v];if(m!==void 0&&y===m)return;p[v]=y}}),p},d=l.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(h,p)=>{const g={...o,...h.attributes};if(a)return p.createNode(e,g);const v=n?n(h):h.content||"";return v?p.createNode(e,g,[p.createTextNode(v)]):p.createNode(e,g,[])},markdownTokenizer:{name:e,level:"inline",start(h){const p=a?new RegExp(`\\[${d}\\s*[^\\]]*\\]`):new RegExp(`\\[${d}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${d}\\]`),g=h.match(p),v=g==null?void 0:g.index;return v!==void 0?v:-1},tokenize(h,p,g){const v=a?new RegExp(`^\\[${d}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${d}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${d}\\]`),m=h.match(v);if(!m)return;let y="",_="";if(a){const[,k]=m;_=k}else{const[,k,w]=m;_=k,y=w||""}const b=i(_.trim());return{type:e,raw:m[0],content:y.trim(),attributes:b}}},renderMarkdown:h=>{let p="";n?p=n(h):h.content&&h.content.length>0&&(p=h.content.filter(y=>y.type==="text").map(y=>y.text).join(""));const g=u(h.attrs||{}),v=r(g),m=v?` ${v}`:"";return a?`[${l}${m}]`:`[${l}${m}]${p}[/${l}]`}}}function p1(s,e,t){var n,i,r,o;const a=s.split(` `),c=[];let l="",u=0;const d=e.baseIndentSize||2;for(;u0)break;if(h.trim()===""){u+=1,l=`${l}${h} `;continue}else return}const g=e.extractItemData(p),{indentLevel:v,mainContent:m}=g;l=`${l}${h} `;const y=[m];for(u+=1;ux.trim()!=="");if(A===-1)break;if((((i=(n=a[u+1+A].match(/^(\s*)/))==null?void 0:n[1])==null?void 0:i.length)||0)>v){y.push(w),l=`${l}${w} `,u+=1;continue}else break}if((((o=(r=w.match(/^(\s*)/))==null?void 0:r[1])==null?void 0:o.length)||0)>v)y.push(w),l=`${l}${w} `,u+=1;else break}let _;const b=y.slice(1);if(b.length>0){const w=b.map(T=>T.slice(v+d)).join(` `);w.trim()&&(e.customNestedParser?_=e.customNestedParser(w):_=t.blockTokens(w))}const k=e.createToken(g,_);c.push(k)}if(c.length!==0)return{items:c,raw:l}}function cM(s,e,t,n){if(!s||!Array.isArray(s.content))return"";const i=typeof t=="function"?t(n):t,[r,...o]=s.content,a=e.renderChildren([r]);let c=`${i}${a}`;return o&&o.length>0&&o.forEach((l,u)=>{var d,h;const p=(h=(d=e.renderChild)==null?void 0:d.call(e,l,u+1))!=null?h:e.renderChildren([l]);if(p!=null){const g=p.split(` `).map(v=>v?e.indent(v):e.indent("")).join(` `);c+=l.type==="paragraph"?` ${g}`:` ${g}`}}),c}function VQ(s,e,t={}){const{state:n}=e,{doc:i,tr:r}=n,o=s;i.descendants((a,c)=>{const l=r.mapping.map(c),u=r.mapping.map(c)+a.nodeSize;let d=null;if(a.marks.forEach(p=>{if(p!==o)return!1;d=p}),!d)return;let h=!1;if(Object.keys(t).forEach(p=>{t[p]!==d.attrs[p]&&(h=!0)}),h){const p=s.type.create({...s.attrs,...t});r.removeMark(l,u,s.type),r.addMark(l,u,p)}}),r.docChanged&&e.view.dispatch(r)}var Ar=class nD extends oM{constructor(){super(...arguments),this.type="node"}static create(e={}){const t=typeof e=="function"?e():e;return new nD(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};function Df(s){return new MQ({find:s.find,handler:({state:e,range:t,match:n,pasteEvent:i})=>{const r=ls(s.getAttributes,void 0,n,i);if(r===!1||r===null)return null;const{tr:o}=e,a=n[n.length-1],c=n[0];let l=t.to;if(a){const u=c.search(/\S/),d=t.from+c.indexOf(a),h=d+a.length;if(rM(t.from,t.to,e.doc).filter(v=>v.mark.type.excluded.find(y=>y===s.type&&y!==v.mark.type)).filter(v=>v.to>d).length)return null;ht.from&&o.delete(t.from+u,d),l=t.from+u+a.length,o.addMark(t.from+u,l,s.type.create(r||{})),n.index!==void 0&&n.input!==void 0&&n.index+n[0].length>=n.input.length||o.removeStoredMark(s.type)}}})}function $R(s){return iF((e,t)=>({get(){return e(),s},set(n){s=n,requestAnimationFrame(()=>{requestAnimationFrame(()=>{t()})})}}))}var GQ=class extends NQ{constructor(s={}){return super(s),this.contentComponent=null,this.appContext=null,this.reactiveState=$R(this.view.state),this.reactiveExtensionStorage=$R(this.extensionStorage),this.on("beforeTransaction",({nextState:e})=>{this.reactiveState.value=e,this.reactiveExtensionStorage.value=this.extensionStorage}),CE(this)}get state(){return this.reactiveState?this.reactiveState.value:this.view.state}get storage(){return this.reactiveExtensionStorage?this.reactiveExtensionStorage.value:super.storage}registerPlugin(s,e){const t=super.registerPlugin(s,e);return this.reactiveState&&(this.reactiveState.value=t),t}unregisterPlugin(s){const e=super.unregisterPlugin(s);return this.reactiveState&&e&&(this.reactiveState.value=e),e}},KQ=ct({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(s){const e=ge(),t=rF();return jP(()=>{const n=s.editor;n&&n.options.element&&e.value&&ft(()=>{var i;if(!e.value||!((i=n.view.dom)!=null&&i.parentNode))return;const r=Ne(e.value);e.value.append(...n.view.dom.parentNode.childNodes),n.contentComponent=t.ctx._,t&&(n.appContext={...t.appContext,provides:t.provides}),n.setOptions({element:r}),n.createNodeViews()})}),Rn(()=>{const n=s.editor;n&&(n.contentComponent=null,n.appContext=null)}),{rootEl:e}},render(){return sF("div",{ref:s=>{this.rootEl=s}})}}),qQ=(s={})=>{const e=nF();return dn(()=>{e.value=new GQ(s)}),Rn(()=>{var t;(t=e.value)==null||t.destroy()}),e},KS=(s,e)=>{if(s==="slot")return 0;if(s instanceof Function)return s(e);const{children:t,...n}=e??{};if(s==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[s,n,t]};function iD(s,e,t){for(let n=0;;n++){if(n==s.childCount||n==e.childCount)return s.childCount==e.childCount?null:t;let i=s.child(n),r=e.child(n);if(i==r){t+=i.nodeSize;continue}if(!i.sameMarkup(r))return t;if(i.isText&&i.text!=r.text){for(let o=0;i.text[o]==r.text[o];o++)t++;return t}if(i.content.size||r.content.size){let o=iD(i.content,r.content,t+1);if(o!=null)return o}t+=i.nodeSize}}function rD(s,e,t,n){for(let i=s.childCount,r=e.childCount;;){if(i==0||r==0)return i==r?null:{a:t,b:n};let o=s.child(--i),a=e.child(--r),c=o.nodeSize;if(o==a){t-=c,n-=c;continue}if(!o.sameMarkup(a))return{a:t,b:n};if(o.isText&&o.text!=a.text){let l=0,u=Math.min(o.text.length,a.text.length);for(;le&&n(c,i+a,r||null,o)!==!1&&c.content.size){let u=a+1;c.nodesBetween(Math.max(0,e-u),Math.min(c.content.size,t-u),n,i+u)}a=l}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,i){let r="",o=!0;return this.nodesBetween(e,t,(a,c)=>{let l=a.isText?a.text.slice(Math.max(e,c)-c,t-c):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&l||a.isTextblock)&&n&&(o?o=!1:r+=n),r+=l},0),r}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,n=e.firstChild,i=this.content.slice(),r=0;for(t.isText&&t.sameMarkup(n)&&(i[i.length-1]=t.withText(t.text+n.text),r=1);re)for(let r=0,o=0;oe&&((ot)&&(a.isText?a=a.cut(Math.max(0,e-o),Math.min(a.text.length,t-o)):a=a.cut(Math.max(0,e-o-1),Math.min(a.content.size,t-o-1))),n.push(a),i+=a.nodeSize),o=c}return new zi(n,i)}cutByIndex(e,t){return e==t?zi.empty:e==0&&t==this.content.length?this:new zi(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;let i=this.content.slice(),r=this.size+t.nodeSize-n.nodeSize;return i[e]=t,new zi(i,r)}addToStart(e){return new zi([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new zi(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;tthis.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let i=this.child(t),r=n+i.nodeSize;if(r>=e)return r==e?X_(t+1,r):X_(t,n);n=r}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return zi.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return zi.fromArray(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return zi.empty;let t,n=0;for(let i=0;i0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return pp.empty;let n=t.openStart||0,i=t.openEnd||0;if(typeof n!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new pp(Lc.fromJSON(e,t.content),n,i)}static maxOpen(e,t=!0){let n=0,i=0;for(let r=e.firstChild;r&&!r.isLeaf&&(t||!r.type.spec.isolating);r=r.firstChild)n++;for(let r=e.lastChild;r&&!r.isLeaf&&(t||!r.type.spec.isolating);r=r.lastChild)i++;return new pp(e,n,i)}};Tn.empty=new Tn(Lc.empty,0,0);function oD(s,e,t){let{index:n,offset:i}=s.findIndex(e),r=s.maybeChild(n),{index:o,offset:a}=s.findIndex(t);if(i==e||r.isText){if(a!=t&&!s.child(o).isText)throw new RangeError("Removing non-flat range");return s.cut(0,e).append(s.cut(t))}if(n!=o)throw new RangeError("Removing non-flat range");return s.replaceChild(n,r.copy(oD(r.content,e-i-1,t-i-1)))}function aD(s,e,t,n,i,r){let{index:o,offset:a}=s.findIndex(e),c=s.maybeChild(o);if(a==e||c.isText)return r&&n<=0&&i<=0&&!r.canReplace(o,o,t)?null:s.cut(0,e).append(t).append(s.cut(e));let l=aD(c.content,e-a-1,t,o==0?n-1:0,o==s.childCount-1?i-1:0,c);return l&&s.replaceChild(o,c.copy(l))}var lD=65535,cD=Math.pow(2,16);function XQ(s,e){return s+e*cD}function BR(s){return s&lD}function YQ(s){return(s-(s&lD))/cD}var uD=1,dD=2,Pw=4,hD=8,FR=class{constructor(s,e,t){this.pos=s,this.delInfo=e,this.recover=t}get deleted(){return(this.delInfo&hD)>0}get deletedBefore(){return(this.delInfo&(uD|Pw))>0}get deletedAfter(){return(this.delInfo&(dD|Pw))>0}get deletedAcross(){return(this.delInfo&Pw)>0}},Nf=class mp{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&mp.empty)return mp.empty}recover(e){let t=0,n=BR(e);if(!this.inverted)for(let i=0;ie)break;let l=this.ranges[a+r],u=this.ranges[a+o],d=c+l;if(e<=d){let h=l?e==c?-1:e==d?1:t:t,p=c+i+(h<0?0:u);if(n)return p;let g=e==(t<0?c:d)?null:XQ(a/3,e-c),v=e==c?dD:e==d?uD:Pw;return(t<0?e!=c:e!=d)&&(v|=hD),new FR(p,v,g)}i+=u-l}return n?e+i:new FR(e+i,0,null)}touches(e,t){let n=0,i=BR(t),r=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;ae)break;let l=this.ranges[a+r],u=c+l;if(e<=u&&a==i*3)return!0;n+=this.ranges[a+o]-l}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let i=0,r=0;i!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),t.openStart,t.openEnd);return sr.fromReplace(e,this.from,this.to,r)}invert(){return new pD(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new sv(t.pos,n.pos,this.mark)}merge(e){return e instanceof sv&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new sv(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new sv(t.from,t.to,e.markFromJSON(t.mark))}};Li.jsonID("addMark",fD);var pD=class nv extends Li{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new Tn(uM(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return sr.fromReplace(e,this.from,this.to,n)}invert(){return new fD(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new nv(t.pos,n.pos,this.mark)}merge(e){return e instanceof nv&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new nv(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new nv(t.from,t.to,e.markFromJSON(t.mark))}};Li.jsonID("removeMark",pD);var mD=class iv extends Li{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return sr.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return sr.fromReplace(e,this.pos,this.pos+1,new Tn(Lc.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let n=this.mark.addToSet(t.marks);if(n.length==t.marks.length){for(let i=0;in.pos?null:new Lw(t.pos,n.pos,i,r,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Lw(t.from,t.to,t.gapFrom,t.gapTo,Tn.fromJSON(e,t.slice),t.insert,!!t.structure)}};Li.jsonID("replaceAround",vD);function g1(s,e,t){let n=s.resolve(e),i=t-e,r=n.depth;for(;i>0&&r>0&&n.indexAfter(r)==n.node(r).childCount;)r--,i--;if(i>0){let o=n.node(r).maybeChild(n.indexAfter(r));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}var JQ=class Ow extends Li{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return sr.fail("No node at attribute step's position");let n=Object.create(null);for(let r in t.attrs)n[r]=t.attrs[r];n[this.attr]=this.value;let i=t.type.create(n,null,t.marks);return sr.fromReplace(e,this.pos,this.pos+1,new Tn(Lc.from(i),0,t.isLeaf?0:1))}getMap(){return Nf.empty}invert(e){return new Ow(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Ow(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Ow(t.pos,t.attr,t.value)}};Li.jsonID("attr",JQ);var ZQ=class v1 extends Li{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let i in e.attrs)t[i]=e.attrs[i];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return sr.ok(n)}getMap(){return Nf.empty}invert(e){return new v1(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new v1(t.attr,t.value)}};Li.jsonID("docAttr",ZQ);var yy=class extends Error{};yy=function s(e){let t=Error.call(this,e);return t.__proto__=s.prototype,t};yy.prototype=Object.create(Error.prototype);yy.prototype.constructor=yy;yy.prototype.name="TransformError";var HC=Object.create(null),Qn=class{constructor(s,e,t){this.$anchor=s,this.$head=e,this.ranges=t||[new eX(s.min(e),s.max(e))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let s=this.ranges;for(let e=0;e=0;i--){let r=e<0?gp(s.node(0),s.node(i),s.before(i+1),s.index(i),e,t):gp(s.node(0),s.node(i),s.after(i+1),s.index(i)+1,e,t);if(r)return r}return null}static near(s,e=1){return this.findFrom(s,e)||this.findFrom(s,-e)||new Gv(s.node(0))}static atStart(s){return gp(s,s,0,0,1)||new Gv(s)}static atEnd(s){return gp(s,s,s.content.size,s.childCount,-1)||new Gv(s)}static fromJSON(s,e){if(!e||!e.type)throw new RangeError("Invalid input for Selection.fromJSON");let t=HC[e.type];if(!t)throw new RangeError(`No selection type ${e.type} defined`);return t.fromJSON(s,e)}static jsonID(s,e){if(s in HC)throw new RangeError("Duplicate use of selection JSON ID "+s);return HC[s]=e,e.prototype.jsonID=s,e}getBookmark(){return fg.between(this.$anchor,this.$head).getBookmark()}};Qn.prototype.visible=!0;var eX=class{constructor(s,e){this.$from=s,this.$to=e}},HR=!1;function UR(s){!HR&&!s.parent.inlineContent&&(HR=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+s.parent.type.name+")"))}var fg=class rv extends Qn{constructor(e,t=e){UR(e),UR(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let n=e.resolve(t.map(this.head));if(!n.parent.inlineContent)return Qn.near(n);let i=e.resolve(t.map(this.anchor));return new rv(i.parent.inlineContent?i:n,n)}replace(e,t=Tn.empty){if(super.replace(e,t),t==Tn.empty){let n=this.$from.marksAcross(this.$to);n&&e.ensureMarks(n)}}eq(e){return e instanceof rv&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new yD(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new rv(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){let i=e.resolve(t);return new this(i,n==t?i:e.resolve(n))}static between(e,t,n){let i=e.pos-t.pos;if((!n||i)&&(n=i>=0?1:-1),!t.parent.inlineContent){let r=Qn.findFrom(t,n,!0)||Qn.findFrom(t,-n,!0);if(r)t=r.$head;else return Qn.near(t,n)}return e.parent.inlineContent||(i==0?e=t:(e=(Qn.findFrom(e,-n,!0)||Qn.findFrom(e,n,!0)).$anchor,e.pos0?0:1);i>0?o=0;o+=i){let a=e.child(o);if(a.isAtom){if(!r&&pg.isSelectable(a))return pg.create(s,t-(i<0?a.nodeSize:0))}else{let c=gp(s,a,t+i,i<0?a.childCount:0,i,r);if(c)return c}t+=a.nodeSize*i}return null}function WR(s,e,t){let n=s.steps.length-1;if(n{o==null&&(o=u)}),s.setSelection(Qn.near(s.doc.resolve(o),t))}function zR(s,e){return!e||!s?s:s.bind(e)}var Y_=class{constructor(s,e,t){this.name=s,this.init=zR(e.init,t),this.apply=zR(e.apply,t)}};new Y_("doc",{init(s){return s.doc||s.schema.topNodeType.createAndFill()},apply(s){return s.doc}}),new Y_("selection",{init(s,e){return s.selection||Qn.atStart(e.doc)},apply(s){return s.selection}}),new Y_("storedMarks",{init(s){return s.storedMarks||null},apply(s,e,t,n){return n.selection.$cursor?s.storedMarks:null}}),new Y_("scrollToSelection",{init(){return 0},apply(s,e){return s.scrolledIntoView?e+1:e}});var nX=(s,e)=>{var t;const{state:n,view:i}=s,{selection:r}=n;if(!r.empty)return!1;const{$from:o}=r;if(o.parentOffset!==0)return!1;const a=o.depth-1,c=o.node(a),l=o.index(a);if(l===0)return!1;if(c.type===e)return s.commands.lift(e.name);const u=c.child(l-1);if(u.type!==e||!((t=u.lastChild)!=null&&t.isTextblock))return!1;const d=o.before(),p=d-1-1,{tr:g}=n;return g.delete(d,o.after()).insert(p,o.parent.content),g.setSelection(fg.create(g.doc,p)),i.dispatch(g.scrollIntoView()),!0},iX=/^\s*>\s$/,rX=Ar.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:s}){return KS("blockquote",{...Vs(this.options.HTMLAttributes,s),children:KS("slot",{})})},parseMarkdown:(s,e)=>{var t;const n=(t=e.parseBlockChildren)!=null?t:e.parseChildren;return e.createNode("blockquote",void 0,n(s.tokens||[]))},renderMarkdown:(s,e)=>{if(!s.content)return"";const t=">",n=[];return s.content.forEach((i,r)=>{var o,a;const u=((a=(o=e.renderChild)==null?void 0:o.call(e,i,r))!=null?a:e.renderChildren([i])).split(` `).map(d=>d.trim()===""?t:`${t} ${d}`);n.push(u.join(` `))}),n.join(` ${t} `)},addCommands(){return{setBlockquote:()=>({commands:s})=>s.wrapIn(this.name),toggleBlockquote:()=>({commands:s})=>s.toggleWrap(this.name),unsetBlockquote:()=>({commands:s})=>s.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote(),Backspace:()=>nX(this.editor,this.type)}},addInputRules(){return[hg({find:iX,type:this.type})]}}),oX=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,aX=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,lX=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,cX=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,uX=Uf.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:s=>s.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:s=>s.type.name===this.name},{style:"font-weight",getAttrs:s=>/^(bold(er)?|[5-9]\d{2,})$/.test(s)&&null}]},renderHTML({HTMLAttributes:s}){return KS("strong",{...Vs(this.options.HTMLAttributes,s),children:KS("slot",{})})},markdownTokenName:"strong",parseMarkdown:(s,e)=>e.applyMark("bold",e.parseInline(s.tokens||[])),markdownOptions:{htmlReopen:{open:"",close:""}},renderMarkdown:(s,e)=>`**${e.renderChildren(s)}**`,addCommands(){return{setBold:()=>({commands:s})=>s.setMark(this.name),toggleBold:()=>({commands:s})=>s.toggleMark(this.name),unsetBold:()=>({commands:s})=>s.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[dg({find:oX,type:this.type}),dg({find:lX,type:this.type})]},addPasteRules(){return[Df({find:aX,type:this.type}),Df({find:cX,type:this.type})]}}),dX=s=>{const e=/`([^`]+)`(?!`)$/.exec(s);return!e||e.index>0&&s[e.index-1]==="`"?null:{index:e.index,text:e[0],replaceWith:e[1]}},hX=s=>{const e=/`([^`]+)`(?!`)/g,t=[];let n;for(;(n=e.exec(s))!==null;)n.index>0&&s[n.index-1]==="`"||t.push({index:n.index,text:n[0],replaceWith:n[1]});return t},fX=Uf.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:s}){return["code",Vs(this.options.HTMLAttributes,s),0]},markdownTokenName:"codespan",parseMarkdown:(s,e)=>e.applyMark("code",[{type:"text",text:s.text||""}]),renderMarkdown:(s,e)=>s.content?`\`${e.renderChildren(s.content)}\``:"",addCommands(){return{setCode:()=>({commands:s})=>s.setMark(this.name),toggleCode:()=>({commands:s})=>s.toggleMark(this.name),unsetCode:()=>({commands:s})=>s.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[dg({find:dX,type:this.type})]},addPasteRules(){return[Df({find:hX,type:this.type})]}}),UC=4,pX=/^```([a-z]+)?[\s\n]$/,mX=/^~~~([a-z]+)?[\s\n]$/,gX=Ar.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:UC,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:s=>{var e;const{languageClassPrefix:t}=this.options;if(!t)return null;const r=[...((e=s.firstElementChild)==null?void 0:e.classList)||[]].filter(o=>o.startsWith(t)).map(o=>o.replace(t,""))[0];return r||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:s,HTMLAttributes:e}){return["pre",Vs(this.options.HTMLAttributes,e),["code",{class:s.attrs.language?this.options.languageClassPrefix+s.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(s,e)=>{var t,n;return((t=s.raw)==null?void 0:t.startsWith("```"))===!1&&((n=s.raw)==null?void 0:n.startsWith("~~~"))===!1&&s.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:s.lang||null},s.text?[e.createTextNode(s.text)]:[])},renderMarkdown:(s,e)=>{var t;let n="";const i=((t=s.attrs)==null?void 0:t.language)||"";return s.content?n=[`\`\`\`${i}`,e.renderChildren(s.content),"```"].join(` `):n=`\`\`\`${i} \`\`\``,n},addCommands(){return{setCodeBlock:s=>({commands:e})=>e.setNode(this.name,s),toggleCodeBlock:s=>({commands:e})=>e.toggleNode(this.name,"paragraph",s)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:s,$anchor:e}=this.editor.state.selection,t=e.pos===1;return!s||e.parent.type.name!==this.name?!1:t||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:s})=>{var e;if(!this.options.enableTabIndentation)return!1;const t=(e=this.options.tabSize)!=null?e:UC,{state:n}=s,{selection:i}=n,{$from:r,empty:o}=i;if(r.parent.type!==this.type)return!1;const a=" ".repeat(t);return o?s.commands.insertContent(a):s.commands.command(({tr:c})=>{const{from:l,to:u}=i,p=n.doc.textBetween(l,u,` `,` `).split(` `).map(g=>a+g).join(` `);return c.replaceWith(l,u,n.schema.text(p)),!0})},"Shift-Tab":({editor:s})=>{var e;if(!this.options.enableTabIndentation)return!1;const t=(e=this.options.tabSize)!=null?e:UC,{state:n}=s,{selection:i}=n,{$from:r,empty:o}=i;return r.parent.type!==this.type?!1:o?s.commands.command(({tr:a})=>{var c;const{pos:l}=r,u=r.start(),d=r.end(),p=n.doc.textBetween(u,d,` `,` `).split(` `);let g=0,v=0;const m=l-u;for(let T=0;T=m){g=T;break}v+=p[T].length+1}const _=((c=p[g].match(/^ */))==null?void 0:c[0])||"",b=Math.min(_.length,t);if(b===0)return!0;let k=u;for(let T=0;T{const{from:c,to:l}=i,h=n.doc.textBetween(c,l,` `,` `).split(` `).map(p=>{var g;const v=((g=p.match(/^ */))==null?void 0:g[0])||"",m=Math.min(v.length,t);return p.slice(m)}).join(` `);return a.replaceWith(c,l,n.schema.text(h)),!0})},Enter:({editor:s})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=s,{selection:t}=e,{$from:n,empty:i}=t;if(!i||n.parent.type!==this.type)return!1;const r=n.parentOffset===n.parent.nodeSize-2,o=n.parent.textContent.endsWith(` `);return!r||!o?!1:s.chain().command(({tr:a})=>(a.delete(n.pos-2,n.pos),!0)).exitCode().run()},ArrowDown:({editor:s})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=s,{selection:t,doc:n}=e,{$from:i,empty:r}=t;if(!r||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const a=i.after();return a===void 0?!1:n.nodeAt(a)?s.commands.command(({tr:l})=>(l.setSelection(Ht.near(n.resolve(a))),!0)):s.commands.exitCode()}}},addInputRules(){return[f1({find:pX,type:this.type,getAttributes:s=>({language:s[1]})}),f1({find:mX,type:this.type,getAttributes:s=>({language:s[1]})})]},addProseMirrorPlugins(){return[new Gs({key:new _n("codeBlockVSCodeHandler"),props:{handlePaste:(s,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const t=e.clipboardData.getData("text/plain"),n=e.clipboardData.getData("vscode-editor-data"),i=n?JSON.parse(n):void 0,r=i==null?void 0:i.mode;if(!t||!r)return!1;const{tr:o,schema:a}=s.state,c=a.text(t.replace(/\r\n?/g,` `));return o.replaceSelectionWith(this.type.create({language:r},c)),o.selection.$from.parent.type!==this.type&&o.setSelection(kt.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),s.dispatch(o),!0}}})]}}),vX=Ar.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(s,e)=>s.content?e.renderChildren(s.content,` `):""}),yX=Ar.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:s}){return["br",Vs(this.options.HTMLAttributes,s)]},renderText(){return` `},renderMarkdown:()=>` `,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:s,chain:e,state:t,editor:n})=>s.first([()=>s.exitCode(),()=>s.command(()=>{const{selection:i,storedMarks:r}=t;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:a}=n.extensionManager,c=r||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:l,dispatch:u})=>{if(u&&c&&o){const d=c.filter(h=>a.includes(h.type.name));l.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),bX=Ar.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(s=>({tag:`h${s}`,attrs:{level:s}}))},renderHTML({node:s,HTMLAttributes:e}){return[`h${this.options.levels.includes(s.attrs.level)?s.attrs.level:this.options.levels[0]}`,Vs(this.options.HTMLAttributes,e),0]},parseMarkdown:(s,e)=>e.createNode("heading",{level:s.depth||1},e.parseInline(s.tokens||[])),renderMarkdown:(s,e)=>{var t;const n=(t=s.attrs)!=null&&t.level?parseInt(s.attrs.level,10):1,i="#".repeat(n);return s.content?`${i} ${e.renderChildren(s.content)}`:""},addCommands(){return{setHeading:s=>({commands:e})=>this.options.levels.includes(s.level)?e.setNode(this.name,s):!1,toggleHeading:s=>({commands:e})=>this.options.levels.includes(s.level)?e.toggleNode(this.name,"paragraph",s):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((s,e)=>({...s,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(s=>f1({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${s}})\\s$`),type:this.type,getAttributes:{level:s}}))}}),_X=Ar.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:s}){return["hr",Vs(this.options.HTMLAttributes,s)]},markdownTokenName:"hr",parseMarkdown:(s,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:s,state:e})=>{if(!BQ(e,e.schema.nodes[this.name]))return!1;const{selection:t}=e,{$to:n}=t,i=s();return BO(t)?i.insertContentAt(n.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:r,tr:o,dispatch:a})=>{if(a){const{$to:c}=o.selection,l=c.end();if(c.nodeAfter)c.nodeAfter.isTextblock?o.setSelection(kt.create(o.doc,c.pos+1)):c.nodeAfter.isBlock?o.setSelection(_t.create(o.doc,c.pos)):o.setSelection(kt.create(o.doc,c.pos));else{const u=r.schema.nodes[this.options.nextNodeType]||c.parent.type.contentMatch.defaultType,d=u==null?void 0:u.create();d&&(o.insert(l,d),o.setSelection(kt.create(o.doc,l+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[$Q({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),wX=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,SX=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,kX=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,CX=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,TX=Uf.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:s=>s.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:s=>s.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:s}){return["em",Vs(this.options.HTMLAttributes,s),0]},addCommands(){return{setItalic:()=>({commands:s})=>s.setMark(this.name),toggleItalic:()=>({commands:s})=>s.toggleMark(this.name),unsetItalic:()=>({commands:s})=>s.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(s,e)=>e.applyMark("italic",e.parseInline(s.tokens||[])),markdownOptions:{htmlReopen:{open:"",close:""}},renderMarkdown:(s,e)=>`*${e.renderChildren(s)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[dg({find:wX,type:this.type}),dg({find:kX,type:this.type})]},addPasteRules(){return[Df({find:SX,type:this.type}),Df({find:CX,type:this.type})]}});const AX="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",EX="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",y1="numeric",b1="ascii",_1="alpha",Kv="asciinumeric",av="alphanumeric",w1="domain",wD="emoji",MX="scheme",xX="slashscheme",WC="whitespace";function RX(s,e){return s in e||(e[s]=[]),e[s]}function jd(s,e,t){e[y1]&&(e[Kv]=!0,e[av]=!0),e[b1]&&(e[Kv]=!0,e[_1]=!0),e[Kv]&&(e[av]=!0),e[_1]&&(e[av]=!0),e[av]&&(e[w1]=!0),e[wD]&&(e[w1]=!0);for(const n in e){const i=RX(n,t);i.indexOf(s)<0&&i.push(s)}}function IX(s,e){const t={};for(const n in e)e[n].indexOf(s)>=0&&(t[n]=!0);return t}function Sr(s=null){this.j={},this.jr=[],this.jd=null,this.t=s}Sr.groups={};Sr.prototype={accepts(){return!!this.t},go(s){const e=this,t=e.j[s];if(t)return t;for(let n=0;ns.ta(e,t,n,i),tn=(s,e,t,n,i)=>s.tr(e,t,n,i),jR=(s,e,t,n,i)=>s.ts(e,t,n,i),$e=(s,e,t,n,i)=>s.tt(e,t,n,i),Rl="WORD",S1="UWORD",SD="ASCIINUMERICAL",kD="ALPHANUMERICAL",by="LOCALHOST",k1="TLD",C1="UTLD",Nw="SCHEME",vp="SLASH_SCHEME",hM="NUM",T1="WS",fM="NL",qv="OPENBRACE",Qv="CLOSEBRACE",qS="OPENBRACKET",QS="CLOSEBRACKET",XS="OPENPAREN",YS="CLOSEPAREN",JS="OPENANGLEBRACKET",ZS="CLOSEANGLEBRACKET",e0="FULLWIDTHLEFTPAREN",t0="FULLWIDTHRIGHTPAREN",s0="LEFTCORNERBRACKET",n0="RIGHTCORNERBRACKET",i0="LEFTWHITECORNERBRACKET",r0="RIGHTWHITECORNERBRACKET",o0="FULLWIDTHLESSTHAN",a0="FULLWIDTHGREATERTHAN",l0="AMPERSAND",c0="APOSTROPHE",u0="ASTERISK",tu="AT",d0="BACKSLASH",h0="BACKTICK",f0="CARET",Vd="COLON",pM="COMMA",p0="DOLLAR",Ia="DOT",m0="EQUALS",mM="EXCLAMATION",_o="HYPHEN",Xv="PERCENT",g0="PIPE",v0="PLUS",y0="POUND",Yv="QUERY",gM="QUOTE",CD="FULLWIDTHMIDDLEDOT",vM="SEMI",Pa="SLASH",Jv="TILDE",b0="UNDERSCORE",TD="EMOJI",_0="SYM";var AD=Object.freeze({__proto__:null,ALPHANUMERICAL:kD,AMPERSAND:l0,APOSTROPHE:c0,ASCIINUMERICAL:SD,ASTERISK:u0,AT:tu,BACKSLASH:d0,BACKTICK:h0,CARET:f0,CLOSEANGLEBRACKET:ZS,CLOSEBRACE:Qv,CLOSEBRACKET:QS,CLOSEPAREN:YS,COLON:Vd,COMMA:pM,DOLLAR:p0,DOT:Ia,EMOJI:TD,EQUALS:m0,EXCLAMATION:mM,FULLWIDTHGREATERTHAN:a0,FULLWIDTHLEFTPAREN:e0,FULLWIDTHLESSTHAN:o0,FULLWIDTHMIDDLEDOT:CD,FULLWIDTHRIGHTPAREN:t0,HYPHEN:_o,LEFTCORNERBRACKET:s0,LEFTWHITECORNERBRACKET:i0,LOCALHOST:by,NL:fM,NUM:hM,OPENANGLEBRACKET:JS,OPENBRACE:qv,OPENBRACKET:qS,OPENPAREN:XS,PERCENT:Xv,PIPE:g0,PLUS:v0,POUND:y0,QUERY:Yv,QUOTE:gM,RIGHTCORNERBRACKET:n0,RIGHTWHITECORNERBRACKET:r0,SCHEME:Nw,SEMI:vM,SLASH:Pa,SLASH_SCHEME:vp,SYM:_0,TILDE:Jv,TLD:k1,UNDERSCORE:b0,UTLD:C1,UWORD:S1,WORD:Rl,WS:T1});const Al=/[a-z]/,Ng=new RegExp("\\p{L}","u"),zC=new RegExp("\\p{Emoji}","u"),El=/\d/,jC=/\s/,VR="\r",VC=` `,PX="️",LX="‍",GC="";let J_=null,Z_=null;function OX(s=[]){const e={};Sr.groups=e;const t=new Sr;J_==null&&(J_=GR(AX)),Z_==null&&(Z_=GR(EX)),$e(t,"'",c0),$e(t,"{",qv),$e(t,"}",Qv),$e(t,"[",qS),$e(t,"]",QS),$e(t,"(",XS),$e(t,")",YS),$e(t,"<",JS),$e(t,">",ZS),$e(t,"(",e0),$e(t,")",t0),$e(t,"「",s0),$e(t,"」",n0),$e(t,"『",i0),$e(t,"』",r0),$e(t,"<",o0),$e(t,">",a0),$e(t,"&",l0),$e(t,"*",u0),$e(t,"@",tu),$e(t,"`",h0),$e(t,"^",f0),$e(t,":",Vd),$e(t,",",pM),$e(t,"$",p0),$e(t,".",Ia),$e(t,"=",m0),$e(t,"!",mM),$e(t,"-",_o),$e(t,"%",Xv),$e(t,"|",g0),$e(t,"+",v0),$e(t,"#",y0),$e(t,"?",Yv),$e(t,'"',gM),$e(t,"/",Pa),$e(t,";",vM),$e(t,"~",Jv),$e(t,"_",b0),$e(t,"\\",d0),$e(t,"・",CD);const n=tn(t,El,hM,{[y1]:!0});tn(n,El,n);const i=tn(n,Al,SD,{[Kv]:!0}),r=tn(n,Ng,kD,{[av]:!0}),o=tn(t,Al,Rl,{[b1]:!0});tn(o,El,i),tn(o,Al,o),tn(i,El,i),tn(i,Al,i);const a=tn(t,Ng,S1,{[_1]:!0});tn(a,Al),tn(a,El,r),tn(a,Ng,a),tn(r,El,r),tn(r,Al),tn(r,Ng,r);const c=$e(t,VC,fM,{[WC]:!0}),l=$e(t,VR,T1,{[WC]:!0}),u=tn(t,jC,T1,{[WC]:!0});$e(t,GC,u),$e(l,VC,c),$e(l,GC,u),tn(l,jC,u),$e(u,VR),$e(u,VC),tn(u,jC,u),$e(u,GC,u);const d=tn(t,zC,TD,{[wD]:!0});$e(d,"#"),tn(d,zC,d),$e(d,PX,d);const h=$e(d,LX);$e(h,"#"),tn(h,zC,d);const p=[[Al,o],[El,i]],g=[[Al,null],[Ng,a],[El,r]];for(let v=0;vv[0]>m[0]?1:-1);for(let v=0;v=0?_[w1]=!0:Al.test(m)?El.test(m)?_[Kv]=!0:_[b1]=!0:_[y1]=!0,jR(t,m,m,_)}return jR(t,"localhost",by,{ascii:!0}),t.jd=new Sr(_0),{start:t,tokens:Object.assign({groups:e},AD)}}function ED(s,e){const t=DX(e.replace(/[A-Z]/g,a=>a.toLowerCase())),n=t.length,i=[];let r=0,o=0;for(;o=0&&(d+=t[o].length,h++),l+=t[o].length,r+=t[o].length,o++;r-=d,o-=h,l-=d,i.push({t:u.t,v:e.slice(r-l,r),s:r-l,e:r})}return i}function DX(s){const e=[],t=s.length;let n=0;for(;n56319||n+1===t||(r=s.charCodeAt(n+1))<56320||r>57343?s[n]:s.slice(n,n+2);e.push(o),n+=o.length}return e}function Gc(s,e,t,n,i){let r;const o=e.length;for(let a=0;a=0;)r++;if(r>0){e.push(t.join(""));for(let o=parseInt(s.substring(n,n+r),10);o>0;o--)t.pop();n+=r}else t.push(s[n]),n++}return e}const _y={defaultProtocol:"http",events:null,format:KR,formatHref:KR,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function yM(s,e=null){let t=Object.assign({},_y);s&&(t=Object.assign(t,s instanceof yM?s.o:s));const n=t.ignoreTags,i=[];for(let r=0;rt?n.substring(0,t)+"…":n},toFormattedHref(s){return s.get("formatHref",this.toHref(s.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(s=_y.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(s),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(s){return{type:this.t,value:this.toFormattedString(s),isLink:this.isLink,href:this.toFormattedHref(s),start:this.startIndex(),end:this.endIndex()}},validate(s){return s.get("validate",this.toString(),this)},render(s){const e=this,t=this.toHref(s.get("defaultProtocol")),n=s.get("formatHref",t,this),i=s.get("tagName",t,e),r=this.toFormattedString(s),o={},a=s.get("className",t,e),c=s.get("target",t,e),l=s.get("rel",t,e),u=s.getObj("attributes",t,e),d=s.getObj("events",t,e);return o.href=n,a&&(o.class=a),c&&(o.target=c),l&&(o.rel=l),u&&Object.assign(o,u),{tagName:i,attributes:o,content:r,eventListeners:d}}};function kk(s,e){class t extends MD{constructor(i,r){super(i,r),this.t=s}}for(const n in e)t.prototype[n]=e[n];return t.t=s,t}const NX=kk("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),qR=kk("text"),$X=kk("nl"),ew=kk("url",{isLink:!0,toHref(s=_y.defaultProtocol){return this.hasProtocol()?this.v:`${s}://${this.v}`},hasProtocol(){const s=this.tk;return s.length>=2&&s[0].t!==by&&s[1].t===Vd}}),mo=s=>new Sr(s);function BX({groups:s}){const e=s.domain.concat([l0,u0,tu,d0,h0,f0,p0,m0,_o,hM,Xv,g0,v0,y0,Pa,_0,Jv,b0]),t=[c0,Vd,pM,Ia,mM,Xv,Yv,gM,vM,JS,ZS,qv,Qv,QS,qS,XS,YS,e0,t0,s0,n0,i0,r0,o0,a0],n=[l0,c0,u0,d0,h0,f0,p0,m0,_o,qv,Qv,Xv,g0,v0,y0,Yv,Pa,_0,Jv,b0],i=mo(),r=$e(i,Jv);Ut(r,n,r),Ut(r,s.domain,r);const o=mo(),a=mo(),c=mo();Ut(i,s.domain,o),Ut(i,s.scheme,a),Ut(i,s.slashscheme,c),Ut(o,n,r),Ut(o,s.domain,o);const l=$e(o,tu);$e(r,tu,l),$e(a,tu,l),$e(c,tu,l);const u=$e(r,Ia);Ut(u,n,r),Ut(u,s.domain,r);const d=mo();Ut(l,s.domain,d),Ut(d,s.domain,d);const h=$e(d,Ia);Ut(h,s.domain,d);const p=mo(NX);Ut(h,s.tld,p),Ut(h,s.utld,p),$e(l,by,p);const g=$e(d,_o);$e(g,_o,g),Ut(g,s.domain,d),Ut(p,s.domain,d),$e(p,Ia,h),$e(p,_o,g);const v=$e(o,_o),m=$e(o,Ia);$e(v,_o,v),Ut(v,s.domain,o),Ut(m,n,r),Ut(m,s.domain,o);const y=mo(ew);Ut(m,s.tld,y),Ut(m,s.utld,y),Ut(y,s.domain,o),Ut(y,n,r),$e(y,Ia,m),$e(y,_o,v),$e(y,tu,l);const _=$e(y,Vd),b=mo(ew);Ut(_,s.numeric,b);const k=mo(ew),w=mo();Ut(k,e,k),Ut(k,t,w),Ut(w,e,k),Ut(w,t,w),$e(y,Pa,k),$e(b,Pa,k);const T=$e(a,Vd),A=$e(c,Vd),C=$e(A,Pa),E=$e(C,Pa);Ut(a,s.domain,o),$e(a,Ia,m),$e(a,_o,v),Ut(c,s.domain,o),$e(c,Ia,m),$e(c,_o,v),Ut(T,s.domain,k),$e(T,Pa,k),$e(T,Yv,k),Ut(E,s.domain,k),Ut(E,e,k),$e(E,Pa,k);const x=[[qv,Qv],[qS,QS],[XS,YS],[JS,ZS],[e0,t0],[s0,n0],[i0,r0],[o0,a0]];for(let D=0;D=0&&h++,i++,u++;if(h<0)i-=u,i0&&(r.push(KC(qR,e,o)),o=[]),i-=h,u-=h;const p=d.t,g=t.slice(i-u,i);r.push(KC(p,e,g))}}return o.length>0&&r.push(KC(qR,e,o)),r}function KC(s,e,t){const n=t[0].s,i=t[t.length-1].e,r=e.slice(n,i);return new s(r,t)}const HX=typeof console<"u"&&console&&console.warn||(()=>{}),UX="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Ns={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function WX(){return Sr.groups={},Ns.scanner=null,Ns.parser=null,Ns.tokenQueue=[],Ns.pluginQueue=[],Ns.customSchemes=[],Ns.initialized=!1,Ns}function QR(s,e=!1){if(Ns.initialized&&HX(`linkifyjs: already initialized - will not register custom scheme "${s}" ${UX}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(s))throw new Error(`linkifyjs: incorrect scheme format. 1. Must only contain digits, lowercase ASCII letters or "-" 2. Cannot start or end with "-" 3. "-" cannot repeat`);Ns.customSchemes.push([s,e])}function zX(){Ns.scanner=OX(Ns.customSchemes);for(let s=0;s{const i=e.some(l=>l.docChanged)&&!t.doc.eq(n.doc),r=e.some(l=>l.getMeta("preventAutolink"));if(!i||r)return;const{tr:o}=n,a=RO(t.doc,[...e]);if($O(a).forEach(({newRange:l})=>{const u=$q(n.doc,l,p=>p.isTextblock);let d,h;if(u.length>1)d=u[0],h=n.doc.textBetween(d.pos,d.pos+d.node.nodeSize,void 0," ");else if(u.length){const p=n.doc.textBetween(l.from,l.to," "," ");if(!VX.test(p))return;d=u[0],h=n.doc.textBetween(d.pos,l.to,void 0," ")}if(d&&h){const p=h.split(jX).filter(Boolean);if(p.length<=0)return!1;const g=p[p.length-1],v=d.pos+h.lastIndexOf(g);if(!g)return!1;const m=bM(g).map(y=>y.toObject(s.defaultProtocol));if(!KX(m))return!1;m.filter(y=>y.isLink).map(y=>({...y,from:v+y.start+1,to:v+y.end+1})).filter(y=>n.schema.marks.code?!n.doc.rangeHasMark(y.from,y.to,n.schema.marks.code):!0).filter(y=>s.validate(y.value)).filter(y=>s.shouldAutoLink(y.value)).forEach(y=>{rM(y.from,y.to,n.doc).some(_=>_.mark.type===s.type)||o.addMark(y.from,y.to,s.type.create({href:y.href}))})}}),!!o.steps.length)return o}})}function QX(s){return new Gs({key:new _n("handleClickLink"),props:{handleClick:(e,t,n)=>{var i,r;if(n.button!==0||!e.editable)return!1;let o=null;if(n.target instanceof HTMLAnchorElement)o=n.target;else{const c=n.target;if(!c)return!1;const l=s.editor.view.dom;o=c.closest("a"),o&&!l.contains(o)&&(o=null)}if(!o)return!1;let a=!1;if(s.enableClickSelection&&(a=s.editor.commands.extendMarkRange(s.type.name)),s.openOnClick){const c=NO(e.state,s.type.name),l=(i=o.href)!=null?i:c.href,u=(r=o.target)!=null?r:c.target;l&&(window.open(l,u),a=!0)}return a}}})}function XX(s){return new Gs({key:new _n("handlePasteLink"),props:{handlePaste:(e,t,n)=>{const{shouldAutoLink:i}=s,{state:r}=e,{selection:o}=r,{empty:a}=o;if(a)return!1;let c="";n.content.forEach(u=>{c+=u.textContent});const l=xD(c,{defaultProtocol:s.defaultProtocol}).find(u=>u.isLink&&u.value===c);return!c||!l||i!==void 0&&!i(l.value)?!1:s.editor.commands.setMark(s.type,{href:l.href})}}})}function Ad(s,e){const t=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(n=>{const i=typeof n=="string"?n:n.scheme;i&&t.push(i)}),!s||s.replace(GX,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var YX=Uf.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(s=>{if(typeof s=="string"){QR(s);return}QR(s.scheme,s.optionalSlashes)})},onDestroy(){WX()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(s,e)=>!!Ad(s,e.protocols),validate:s=>!!s,shouldAutoLink:s=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(s),t=/^[a-z][a-z0-9+.-]*:/i.test(s);if(e||t&&!s.includes("@"))return!0;const i=(s.includes("@")?s.split("@").pop():s).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(i)||!/\./.test(i))}}},addAttributes(){return{href:{default:null,parseHTML(s){return s.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:s=>{const e=s.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:t=>!!Ad(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:s}){return this.options.isAllowedUri(s.href,{defaultValidate:e=>!!Ad(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Vs(this.options.HTMLAttributes,s),0]:["a",Vs(this.options.HTMLAttributes,{...s,href:""}),0]},markdownTokenName:"link",parseMarkdown:(s,e)=>e.applyMark("link",e.parseInline(s.tokens||[]),{href:s.href,title:s.title||null}),renderMarkdown:(s,e)=>{var t,n,i,r;const o=(n=(t=s.attrs)==null?void 0:t.href)!=null?n:"",a=(r=(i=s.attrs)==null?void 0:i.title)!=null?r:"",c=e.renderChildren(s);return a?`[${c}](${o} "${a}")`:`[${c}](${o})`},addCommands(){return{setLink:s=>({chain:e})=>{const{href:t}=s;return this.options.isAllowedUri(t,{defaultValidate:n=>!!Ad(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,s).setMeta("preventAutolink",!0).run():!1},toggleLink:s=>({chain:e})=>{const{href:t}=s||{};return t&&!this.options.isAllowedUri(t,{defaultValidate:n=>!!Ad(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,s,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:s})=>s().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Df({find:s=>{const e=[];if(s){const{protocols:t,defaultProtocol:n}=this.options,i=xD(s).filter(r=>r.isLink&&this.options.isAllowedUri(r.value,{defaultValidate:o=>!!Ad(o,t),protocols:t,defaultProtocol:n}));i.length&&i.forEach(r=>{this.options.shouldAutoLink(r.value)&&e.push({text:r.value,data:{href:r.href},index:r.start})})}return e},type:this.type,getAttributes:s=>{var e;return{href:(e=s.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const s=[],{protocols:e,defaultProtocol:t}=this.options;return this.options.autolink&&s.push(qX({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:n=>this.options.isAllowedUri(n,{defaultValidate:i=>!!Ad(i,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),s.push(QX({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&s.push(XX({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),s}}),JX=Object.defineProperty,ZX=(s,e)=>{for(var t in e)JX(s,t,{get:e[t],enumerable:!0})},eY="listItem",XR="textStyle",YR=/^\s*([-+*])\s$/,RD=Ar.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:s}){return["ul",Vs(this.options.HTMLAttributes,s),0]},markdownTokenName:"list",parseMarkdown:(s,e)=>s.type!=="list"||s.ordered?[]:{type:"bulletList",content:s.items?e.parseChildren(s.items):[]},renderMarkdown:(s,e)=>s.content?e.renderChildren(s.content,` `):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:s,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(eY,this.editor.getAttributes(XR)).run():s.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let s=hg({find:YR,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(s=hg({find:YR,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(XR),editor:this.editor})),[s]}}),tY=(s,e,t)=>{const{selection:n}=s;if(!n.empty)return null;const{$from:i}=n;if(!i.parent.isTextblock||i.parentOffset!==i.parent.content.size)return null;let r=-1;for(let p=i.depth;p>0;p-=1)if(i.node(p).type.name===e){r=p;break}if(r<0)return null;const o=i.node(r),a=i.index(r);if(a+1>=o.childCount)return null;const c=o.child(a+1);if(!t.includes(c.type.name))return null;const l=s.schema.nodes[e];let u=!1;if(c.forEach(p=>{p.type===l&&p.childCount>1&&(u=!0)}),!u)return null;const d=s.doc.resolve(i.after()).nodeAfter;if(!d||!t.includes(d.type.name))return null;const h=[];return d.forEach(p=>{h.push(p)}),h.length===0?null:{listItemDepth:r,nestedList:d,nestedListPos:i.after(),insertPos:i.after(r),items:h}},sY=(s,e,t,n)=>{const i=tY(s,t,n);if(!i)return!1;const{selection:r}=s,{nestedList:o,nestedListPos:a,insertPos:c,items:l}=i,u=s.tr;u.delete(a,a+o.nodeSize);const d=u.mapping.map(c);return u.insert(d,He.from(l)),u.setSelection(r.map(u.doc,u.mapping)),e&&e(u),!0},nY=(s,e,t)=>sY(s.state,s.view.dispatch,e,t),ID=(s,e)=>fn.create({name:`${s}BranchingDeleteKeymap`,priority:101,addKeyboardShortcuts(){const t=()=>nY(this.editor,s,e);return{Delete:t,"Mod-Delete":t}}});function iY(s){var e,t;const n=(e=s.tokens)==null?void 0:e[0];return!!(s.text&&((t=s.tokens)==null?void 0:t.length)===1&&(n==null?void 0:n.type)==="list"&&n.ordered&&n.raw===s.text)}function rY(s,e){return e.tokenizeInline?e.parseInline(e.tokenizeInline(s)):e.parseInline([{type:"text",raw:s,text:s}])}var PD=Ar.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:s}){return["li",Vs(this.options.HTMLAttributes,s),0]},markdownTokenName:"list_item",parseMarkdown:(s,e)=>{var t;if(s.type!=="list_item")return[];const n=(t=e.parseBlockChildren)!=null?t:e.parseChildren;let i=[];if(s.tokens&&s.tokens.length>0){if(iY(s))return{type:"listItem",content:[{type:"paragraph",content:rY(s.text||"",e)}]};if(s.tokens.some(o=>o.type==="paragraph"))i=n(s.tokens);else{const o=s.tokens[0];if(o&&o.type==="text"&&o.tokens&&o.tokens.length>0){if(i=[{type:"paragraph",content:e.parseInline(o.tokens)}],s.tokens.length>1){const c=s.tokens.slice(1),l=n(c);i.push(...l)}}else i=n(s.tokens)}}return i.length===0&&(i=[{type:"paragraph",content:[]}]),{type:"listItem",content:i}},renderMarkdown:(s,e,t)=>cM(s,e,n=>{var i,r;return n.parentType==="bulletList"?"- ":n.parentType==="orderedList"?`${(((r=(i=n.meta)==null?void 0:i.parentAttrs)==null?void 0:r.start)||1)+n.index}. `:"- "},t),addExtensions(){return[ID(this.name,[this.options.bulletListTypeName,this.options.orderedListTypeName])]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),oY={};ZX(oY,{findListItemPos:()=>Ck,getNextListDepth:()=>wM,handleBackspace:()=>A1,handleDelete:()=>E1,hasListBefore:()=>LD,hasListItemAfter:()=>aY,hasListItemBefore:()=>lY,listItemHasSubList:()=>cY,nextListIsDeeper:()=>OD,nextListIsHigher:()=>DD});var Ck=(s,e)=>{const{$from:t}=e.selection,n=Mn(s,e.schema);let i=null,r=t.depth,o=t.pos,a=null;for(;r>0&&a===null;)i=t.node(r),i.type===n?a=r:(r-=1,o-=1);return a===null?null:{$pos:e.doc.resolve(o),depth:a}},wM=(s,e)=>{const t=Ck(s,e);if(!t)return!1;const[,n]=qq(e,s,t.$pos.pos+4);return n},LD=(s,e,t)=>{const{$anchor:n}=s.selection,i=Math.max(0,n.pos-2),r=s.doc.resolve(i).node();return!(!r||!t.includes(r.type.name))},A1=(s,e,t)=>{if(s.commands.undoInputRule())return!0;if(s.state.selection.from!==s.state.selection.to)return!1;if(!fd(s.state,e)&&LD(s.state,e,t)){const{$anchor:n}=s.state.selection,i=s.state.doc.resolve(n.before()-1),r=[];i.node().descendants((c,l)=>{c.type.name===e&&r.push({node:c,pos:l})});const o=r.at(-1);if(!o)return!1;const a=s.state.doc.resolve(i.start()+o.pos+1);return s.chain().cut({from:n.start()-1,to:n.end()+1},a.end()).joinForward().run()}return!fd(s.state,e)||!Jq(s.state)?!1:s.chain().liftListItem(e).run()},OD=(s,e)=>{const t=wM(s,e),n=Ck(s,e);return!n||!t?!1:t>n.depth},DD=(s,e)=>{const t=wM(s,e),n=Ck(s,e);return!n||!t?!1:t{if(!fd(s.state,e)||!Yq(s.state,e))return!1;const{selection:t}=s.state,{$from:n,$to:i}=t;return!t.empty&&n.sameParent(i)?!1:OD(e,s.state)?s.chain().focus(s.state.selection.from+4).lift(e).joinBackward().run():DD(e,s.state)?s.chain().joinForward().joinBackward().run():s.commands.joinItemForward()},aY=(s,e)=>{var t;const{$anchor:n}=e.selection,i=e.doc.resolve(n.pos-n.parentOffset-2);return!(i.index()===i.parent.childCount-1||((t=i.nodeAfter)==null?void 0:t.type.name)!==s)},lY=(s,e)=>{var t;const{$anchor:n}=e.selection,i=e.doc.resolve(n.pos-2);return!(i.index()===0||((t=i.nodeBefore)==null?void 0:t.type.name)!==s)},cY=(s,e,t)=>{if(!t)return!1;const n=Mn(s,e.schema);let i=!1;return t.descendants(r=>{r.type===n&&(i=!0)}),i},ND=fn.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:s})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{s.state.schema.nodes[t]!==void 0&&E1(s,t)&&(e=!0)}),e},"Mod-Delete":({editor:s})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{s.state.schema.nodes[t]!==void 0&&E1(s,t)&&(e=!0)}),e},Backspace:({editor:s})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:n})=>{s.state.schema.nodes[t]!==void 0&&A1(s,t,n)&&(e=!0)}),e},"Mod-Backspace":({editor:s})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:n})=>{s.state.schema.nodes[t]!==void 0&&A1(s,t,n)&&(e=!0)}),e}}}}),JR=/^(\s*)(\d+)\.\s+(.*)$/,uY=/^\s/;function dY(s){const e=s.trimStart();return/^[-+*]\s+/.test(e)||/^\d+\.\s+/.test(e)||/^>\s?/.test(e)||/^```/.test(e)||/^~~~/.test(e)}function hY(s){const e=[],t=[];let n=!1;return s.forEach(i=>{if(n){t.push(i);return}if(i.trim()===""){n=!0,t.push(i);return}if(e.length>0&&dY(i)){n=!0,t.push(i);return}e.push(i)}),{paragraphLines:e,blockLines:t}}function fY(s){const e=[];let t=0,n=0;for(;te;)h.push(s[d]),d+=1;if(h.length>0){const p=Math.min(...h.map(v=>v.indent)),g=$D(h,p,t);l.push({type:"list",ordered:!0,start:h[0].number,items:g,raw:h.map(v=>v.raw).join(` `)})}n.push({type:"list_item",raw:r.raw,tokens:l}),i=d}else i+=1}return n}function pY(s,e){return s.map(t=>{if(t.type!=="list_item")return e.parseChildren([t])[0];const n=[];return t.tokens&&t.tokens.length>0&&t.tokens.forEach(i=>{if(i.type==="paragraph"||i.type==="list"||i.type==="blockquote"||i.type==="code")n.push(...e.parseChildren([i]));else if(i.type==="text"&&i.tokens){const r=e.parseChildren([i]);n.push({type:"paragraph",content:r})}else{const r=e.parseChildren([i]);r.length>0&&n.push(...r)}}),{type:"listItem",content:n}})}var mY="listItem",ZR="textStyle",eI=/^(\d+)\.\s$/,BD=Ar.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:s=>s.hasAttribute("start")?parseInt(s.getAttribute("start")||"",10):1},type:{default:null,parseHTML:s=>s.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:s}){const{start:e,...t}=s;return e===1?["ol",Vs(this.options.HTMLAttributes,t),0]:["ol",Vs(this.options.HTMLAttributes,s),0]},markdownTokenName:"list",parseMarkdown:(s,e)=>{if(s.type!=="list"||!s.ordered)return[];const t=s.start||1,n=s.items?pY(s.items,e):[];return t!==1?{type:"orderedList",attrs:{start:t},content:n}:{type:"orderedList",content:n}},renderMarkdown:(s,e)=>s.content?e.renderChildren(s.content,` `):"",markdownTokenizer:{name:"orderedList",level:"block",start:s=>{const e=s.match(/^(\s*)(\d+)\.\s+/),t=e==null?void 0:e.index;return t!==void 0?t:-1},tokenize:(s,e,t)=>{var n;const i=s.split(` `),[r,o]=fY(i);if(r.length===0)return;const a=$D(r,0,t);return a.length===0?void 0:{type:"list",ordered:!0,start:((n=r[0])==null?void 0:n.number)||1,items:a,raw:i.slice(0,o).join(` `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:s,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(mY,this.editor.getAttributes(ZR)).run():s.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let s=hg({find:eI,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(s=hg({find:eI,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(ZR)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[s]}}),gY=/^\s*(\[([( |x])?\])\s$/,vY=Ar.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:s=>{const e=s.getAttribute("data-checked");return e===""||e==="true"},renderHTML:s=>({"data-checked":s.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:s,HTMLAttributes:e}){return["li",Vs(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:s.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(s,e)=>{const t=[];if(s.tokens&&s.tokens.length>0?t.push(e.createNode("paragraph",{},e.parseInline(s.tokens))):s.text?t.push(e.createNode("paragraph",{},[e.createNode("text",{text:s.text})])):t.push(e.createNode("paragraph",{},[])),s.nestedTokens&&s.nestedTokens.length>0){const n=e.parseChildren(s.nestedTokens);t.push(...n)}return e.createNode("taskItem",{checked:s.checked||!1},t)},renderMarkdown:(s,e)=>{var t;const i=`- [${(t=s.attrs)!=null&&t.checked?"x":" "}] `;return cM(s,e,i)},addExtensions(){return this.options.nested?[ID(this.name,[this.options.taskListTypeName])]:[]},addKeyboardShortcuts(){const s={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...s,Tab:()=>this.editor.commands.sinkListItem(this.name)}:s},addNodeView(){return({node:s,HTMLAttributes:e,getPos:t,editor:n})=>{const i=document.createElement("li"),r=document.createElement("label"),o=document.createElement("span"),a=document.createElement("input"),c=document.createElement("div"),l=d=>{var h,p;a.ariaLabel=((p=(h=this.options.a11y)==null?void 0:h.checkboxLabel)==null?void 0:p.call(h,d,a.checked))||`Task item checkbox for ${d.textContent||"empty task item"}`};l(s),r.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",d=>d.preventDefault()),a.addEventListener("change",d=>{if(!n.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:h}=d.target;n.isEditable&&typeof t=="function"&&n.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:p})=>{const g=t();if(typeof g!="number")return!1;const v=p.doc.nodeAt(g);return p.setNodeMarkup(g,void 0,{...v==null?void 0:v.attrs,checked:h}),!0}).run(),!n.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(s,h)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([d,h])=>{i.setAttribute(d,h)}),i.dataset.checked=s.attrs.checked,a.checked=s.attrs.checked,r.append(a,o),i.append(r,c),Object.entries(e).forEach(([d,h])=>{i.setAttribute(d,h)});let u=new Set(Object.keys(e));return{dom:i,contentDOM:c,update:d=>{if(d.type!==this.type)return!1;i.dataset.checked=d.attrs.checked,a.checked=d.attrs.checked,l(d);const h=n.extensionManager.attributes,p=gy(d,h),g=new Set(Object.keys(p)),v=this.options.HTMLAttributes;return u.forEach(m=>{g.has(m)||(m in v?i.setAttribute(m,v[m]):i.removeAttribute(m))}),Object.entries(p).forEach(([m,y])=>{y==null?m in v?i.setAttribute(m,v[m]):i.removeAttribute(m):i.setAttribute(m,y)}),u=g,!0}}}},addInputRules(){return[hg({find:gY,type:this.type,getAttributes:s=>({checked:s[s.length-1]==="x"})})]}}),yY=Ar.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:s}){return["ul",Vs(this.options.HTMLAttributes,s,{"data-type":this.name}),0]},parseMarkdown:(s,e)=>e.createNode("taskList",{},e.parseChildren(s.items||[])),renderMarkdown:(s,e)=>s.content?e.renderChildren(s.content,` `):"",markdownTokenizer:{name:"taskList",level:"block",start(s){var e;const t=(e=s.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return t!==void 0?t:-1},tokenize(s,e,t){const n=r=>{const o=p1(r,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:a=>({indentLevel:a[1].length,mainContent:a[4],checked:a[3].toLowerCase()==="x"}),createToken:(a,c)=>({type:"taskItem",raw:"",mainContent:a.mainContent,indentLevel:a.indentLevel,checked:a.checked,text:a.mainContent,tokens:t.inlineTokens(a.mainContent),nestedTokens:c}),customNestedParser:n},t);return o?[{type:"taskList",raw:o.raw,items:o.items}]:t.blockTokens(r)},i=p1(s,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:r=>({indentLevel:r[1].length,mainContent:r[4],checked:r[3].toLowerCase()==="x"}),createToken:(r,o)=>({type:"taskItem",raw:"",mainContent:r.mainContent,indentLevel:r.indentLevel,checked:r.checked,text:r.mainContent,tokens:t.inlineTokens(r.mainContent),nestedTokens:o}),customNestedParser:n},t);if(i)return{type:"taskList",raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:s})=>s.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});fn.create({name:"listKit",addExtensions(){const s=[];return this.options.bulletList!==!1&&s.push(RD.configure(this.options.bulletList)),this.options.listItem!==!1&&s.push(PD.configure(this.options.listItem)),this.options.listKeymap!==!1&&s.push(ND.configure(this.options.listKeymap)),this.options.orderedList!==!1&&s.push(BD.configure(this.options.orderedList)),this.options.taskItem!==!1&&s.push(vY.configure(this.options.taskItem)),this.options.taskList!==!1&&s.push(yY.configure(this.options.taskList)),s}});var tw=" ",qC=" ",bY=Ar.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:s}){return["p",Vs(this.options.HTMLAttributes,s),0]},parseMarkdown:(s,e)=>{const t=s.tokens||[];if(t.length===1&&t[0].type==="image")return e.parseChildren([t[0]]);const n=e.parseInline(t);return t.length===1&&t[0].type==="text"&&(t[0].raw===tw||t[0].text===tw||t[0].raw===qC||t[0].text===qC)&&n.length===1&&n[0].type==="text"&&(n[0].text===tw||n[0].text===qC)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,n)},renderMarkdown:(s,e,t)=>{var n,i;if(!s)return"";const r=Array.isArray(s.content)?s.content:[];if(r.length===0){const o=Array.isArray((n=t==null?void 0:t.previousNode)==null?void 0:n.content)?t.previousNode.content:[];return((i=t==null?void 0:t.previousNode)==null?void 0:i.type)==="paragraph"&&o.length===0?tw:""}return e.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:s})=>s.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),_Y=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,wY=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,SY=Uf.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:s=>s.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:s}){return["s",Vs(this.options.HTMLAttributes,s),0]},markdownTokenName:"del",parseMarkdown:(s,e)=>e.applyMark("strike",e.parseInline(s.tokens||[])),renderMarkdown:(s,e)=>`~~${e.renderChildren(s)}~~`,addCommands(){return{setStrike:()=>({commands:s})=>s.setMark(this.name),toggleStrike:()=>({commands:s})=>s.toggleMark(this.name),unsetStrike:()=>({commands:s})=>s.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[dg({find:_Y,type:this.type})]},addPasteRules(){return[Df({find:wY,type:this.type})]}}),kY=Ar.create({name:"text",group:"inline",parseMarkdown:s=>({type:"text",text:s.text||""}),renderMarkdown:s=>s.text||""}),CY=Uf.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:s=>s.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:s}){return["u",Vs(this.options.HTMLAttributes,s),0]},parseMarkdown(s,e){return e.applyMark(this.name||"underline",e.parseInline(s.tokens||[]))},renderMarkdown(s,e){return`++${e.renderChildren(s)}++`},markdownTokenizer:{name:"underline",level:"inline",start(s){return s.indexOf("++")},tokenize(s,e,t){const i=/^(\+\+)([\s\S]+?)(\+\+)/.exec(s);if(!i)return;const r=i[2].trim();return{type:"underline",raw:i[0],text:r,tokens:t.inlineTokens(r)}}},addCommands(){return{setUnderline:()=>({commands:s})=>s.setMark(this.name),toggleUnderline:()=>({commands:s})=>s.toggleMark(this.name),unsetUnderline:()=>({commands:s})=>s.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function TY(s={}){return new Gs({view(e){return new AY(e,s)}})}class AY{constructor(e,t){var n;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(n=t.width)!==null&&n!==void 0?n:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let r=o=>{this[i](o)};return e.dom.addEventListener(i,r),{name:i,handler:r}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,n,i=this.editorView.dom,r=i.getBoundingClientRect(),o=r.width/i.offsetWidth,a=r.height/i.offsetHeight;if(t){let d=e.nodeBefore,h=e.nodeAfter;if(d||h){let p=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(p){let g=p.getBoundingClientRect(),v=d?g.bottom:g.top;d&&h&&(v=(v+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let m=this.width/2*a;n={left:g.left,right:g.right,top:v-m,bottom:v+m}}}}if(!n){let d=this.editorView.coordsAtPos(this.cursorPos),h=this.width/2*o;n={left:d.left-h,right:d.left+h,top:d.top,bottom:d.bottom}}let c=this.editorView.dom.offsetParent;this.element||(this.element=c.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let l,u;if(!c||c==document.body&&getComputedStyle(c).position=="static")l=-pageXOffset,u=-pageYOffset;else{let d=c.getBoundingClientRect(),h=d.width/c.offsetWidth,p=d.height/c.offsetHeight;l=d.left-c.scrollLeft*h,u=d.top-c.scrollTop*p}this.element.style.left=(n.left-l)/o+"px",this.element.style.top=(n.top-u)/a+"px",this.element.style.width=(n.right-n.left)/o+"px",this.element.style.height=(n.bottom-n.top)/a+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),i=n&&n.type.spec.disableDropCursor,r=typeof i=="function"?i(this.editorView,t,e):i;if(t&&!r){let o=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=m2(this.editorView.state.doc,o,this.editorView.dragging.slice);a!=null&&(o=a)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class un extends Ht{constructor(e){super(e,e)}map(e,t){let n=e.resolve(t.map(this.head));return un.valid(n)?new un(n):Ht.near(n)}content(){return tt.empty}eq(e){return e instanceof un&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new un(e.resolve(t.pos))}getBookmark(){return new SM(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!EY(e)||!MY(e))return!1;let n=t.type.spec.allowGapCursor;if(n!=null)return n;let i=t.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,t,n=!1){e:for(;;){if(!n&&un.valid(e))return e;let i=e.pos,r=null;for(let o=e.depth;;o--){let a=e.node(o);if(t>0?e.indexAfter(o)0){r=a.child(t>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;i+=t;let c=e.doc.resolve(i);if(un.valid(c))return c}for(;;){let o=t>0?r.firstChild:r.lastChild;if(!o){if(r.isAtom&&!r.isText&&!_t.isSelectable(r)){e=e.doc.resolve(i+r.nodeSize*t),n=!1;continue e}break}r=o,i+=t;let a=e.doc.resolve(i);if(un.valid(a))return a}return null}}}un.prototype.visible=!1;un.findFrom=un.findGapCursorFrom;Ht.jsonID("gapcursor",un);class SM{constructor(e){this.pos=e}map(e){return new SM(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return un.valid(t)?new un(t):Ht.near(t)}}function FD(s){return s.isAtom||s.spec.isolating||s.spec.createGapCursor}function EY(s){for(let e=s.depth;e>=0;e--){let t=s.index(e),n=s.node(e);if(t==0){if(n.type.spec.isolating)return!0;continue}for(let i=n.child(t-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||FD(i.type))return!0;if(i.inlineContent)return!1}}return!0}function MY(s){for(let e=s.depth;e>=0;e--){let t=s.indexAfter(e),n=s.node(e);if(t==n.childCount){if(n.type.spec.isolating)return!0;continue}for(let i=n.child(t);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||FD(i.type))return!0;if(i.inlineContent)return!1}}return!0}function xY(){return new Gs({props:{decorations:LY,createSelectionBetween(s,e,t){return e.pos==t.pos&&un.valid(t)?new un(t):null},handleClick:IY,handleKeyDown:RY,handleDOMEvents:{beforeinput:PY}}})}const RY=SO({ArrowLeft:sw("horiz",-1),ArrowRight:sw("horiz",1),ArrowUp:sw("vert",-1),ArrowDown:sw("vert",1)});function sw(s,e){const t=s=="vert"?e>0?"down":"up":e>0?"right":"left";return function(n,i,r){let o=n.selection,a=e>0?o.$to:o.$from,c=o.empty;if(o instanceof kt){if(!r.endOfTextblock(t)||a.depth==0)return!1;c=!1,a=n.doc.resolve(e>0?a.after():a.before())}let l=un.findGapCursorFrom(a,e,c);return l?(i&&i(n.tr.setSelection(new un(l))),!0):!1}}function IY(s,e,t){if(!s||!s.editable)return!1;let n=s.state.doc.resolve(e);if(!un.valid(n))return!1;let i=s.posAtCoords({left:t.clientX,top:t.clientY});return i&&i.inside>-1&&_t.isSelectable(s.state.doc.nodeAt(i.inside))?!1:(s.dispatch(s.state.tr.setSelection(new un(n))),!0)}function PY(s,e){if(e.inputType!="insertCompositionText"||!(s.state.selection instanceof un))return!1;let{$from:t}=s.state.selection,n=t.parent.contentMatchAt(t.index()).findWrapping(s.state.schema.nodes.text);if(!n)return!1;let i=He.empty;for(let o=n.length-1;o>=0;o--)i=He.from(n[o].createAndFill(null,i));let r=s.state.tr.replace(t.pos,t.pos,new tt(i,0,0));return r.setSelection(kt.near(r.doc.resolve(t.pos+1))),s.dispatch(r),!1}function LY(s){if(!(s.selection instanceof un))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",js.create(s.doc,[Ai.widget(s.selection.head,e,{key:"gapcursor"})])}var w0=200,Xn=function(){};Xn.prototype.append=function(e){return e.length?(e=Xn.from(e),!this.length&&e||e.length=t?Xn.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};Xn.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Xn.prototype.forEach=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)};Xn.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var i=[];return this.forEach(function(r,o){return i.push(e(r,o))},t,n),i};Xn.from=function(e){return e instanceof Xn?e:e&&e.length?new HD(e):Xn.empty};var HD=function(s){function e(n){s.call(this),this.values=n}s&&(e.__proto__=s),e.prototype=Object.create(s&&s.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,r){return i==0&&r==this.length?this:new e(this.values.slice(i,r))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,r,o,a){for(var c=r;c=o;c--)if(i(this.values[c],a+c)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=w0)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=w0)return new e(i.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e}(Xn);Xn.empty=new HD([]);var OY=function(s){function e(t,n){s.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return s&&(e.__proto__=s),e.prototype=Object.create(s&&s.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(n){return na&&this.right.forEachInner(n,Math.max(i-a,0),Math.min(this.length,r)-a,o+a)===!1)return!1},e.prototype.forEachInvertedInner=function(n,i,r,o){var a=this.left.length;if(i>a&&this.right.forEachInvertedInner(n,i-a,Math.max(r,a)-a,o+a)===!1||r=r?this.right.slice(n-r,i-r):this.left.slice(n,r).append(this.right.slice(0,i-r))},e.prototype.leafAppend=function(n){var i=this.right.leafAppend(n);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(n){var i=this.left.leafPrepend(n);if(i)return new e(i,this.right)},e.prototype.appendInner=function(n){return this.left.depth>=Math.max(this.right.depth,n.depth)+1?new e(this.left,new e(this.right,n)):new e(this,n)},e}(Xn);const DY=500;class ya{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let n=this.items.length;for(;;n--)if(this.items.get(n-1).selection){--n;break}let i,r;t&&(i=this.remapping(n,this.items.length),r=i.maps.length);let o=e.tr,a,c,l=[],u=[];return this.items.forEach((d,h)=>{if(!d.step){i||(i=this.remapping(n,h+1),r=i.maps.length),r--,u.push(d);return}if(i){u.push(new La(d.map));let p=d.step.map(i.slice(r)),g;p&&o.maybeStep(p).doc&&(g=o.mapping.maps[o.mapping.maps.length-1],l.push(new La(g,void 0,void 0,l.length+u.length))),r--,g&&i.appendMap(g,r)}else o.maybeStep(d.step);if(d.selection)return a=i?d.selection.map(i.slice(r)):d.selection,c=new ya(this.items.slice(0,n).append(u.reverse().concat(l)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:o,selection:a}}addTransform(e,t,n,i){let r=[],o=this.eventCount,a=this.items,c=!i&&a.length?a.get(a.length-1):null;for(let u=0;u$Y&&(a=NY(a,l),o-=l),new ya(a.append(r),o)}remapping(e,t){let n=new dy;return this.items.forEach((i,r)=>{let o=i.mirrorOffset!=null&&r-i.mirrorOffset>=e?n.maps.length-i.mirrorOffset:void 0;n.appendMap(i.map,o)},e,t),n}addMaps(e){return this.eventCount==0?this:new ya(this.items.append(e.map(t=>new La(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],i=Math.max(0,this.items.length-t),r=e.mapping,o=e.steps.length,a=this.eventCount;this.items.forEach(h=>{h.selection&&a--},i);let c=t;this.items.forEach(h=>{let p=r.getMirror(--c);if(p==null)return;o=Math.min(o,p);let g=r.maps[p];if(h.step){let v=e.steps[p].invert(e.docs[p]),m=h.selection&&h.selection.map(r.slice(c+1,p));m&&a++,n.push(new La(g,v,m))}else n.push(new La(g))},i);let l=[];for(let h=t;hDY&&(d=d.compress(this.items.length-n.length)),d}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,i=[],r=0;return this.items.forEach((o,a)=>{if(a>=e)i.push(o),o.selection&&r++;else if(o.step){let c=o.step.map(t.slice(n)),l=c&&c.getMap();if(n--,l&&t.appendMap(l,n),c){let u=o.selection&&o.selection.map(t.slice(n));u&&r++;let d=new La(l.invert(),c,u),h,p=i.length-1;(h=i.length&&i[p].merge(d))?i[p]=h:i.push(d)}}else o.map&&n--},this.items.length,0),new ya(Xn.from(i.reverse()),r)}}ya.empty=new ya(Xn.empty,0);function NY(s,e){let t;return s.forEach((n,i)=>{if(n.selection&&e--==0)return t=i,!1}),s.slice(t)}class La{constructor(e,t,n,i){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new La(t.getMap().invert(),t,this.selection)}}}class su{constructor(e,t,n,i,r){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=i,this.prevComposition=r}}const $Y=20;function BY(s,e,t,n){let i=t.getMeta(Rf),r;if(i)return i.historyState;t.getMeta(UY)&&(s=new su(s.done,s.undone,null,0,-1));let o=t.getMeta("appendedTransaction");if(t.steps.length==0)return s;if(o&&o.getMeta(Rf))return o.getMeta(Rf).redo?new su(s.done.addTransform(t,void 0,n,$w(e)),s.undone,tI(t.mapping.maps),s.prevTime,s.prevComposition):new su(s.done,s.undone.addTransform(t,void 0,n,$w(e)),null,s.prevTime,s.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let a=t.getMeta("composition"),c=s.prevTime==0||!o&&s.prevComposition!=a&&(s.prevTime<(t.time||0)-n.newGroupDelay||!FY(t,s.prevRanges)),l=o?QC(s.prevRanges,t.mapping):tI(t.mapping.maps);return new su(s.done.addTransform(t,c?e.selection.getBookmark():void 0,n,$w(e)),ya.empty,l,t.time,a??s.prevComposition)}else return(r=t.getMeta("rebased"))?new su(s.done.rebased(t,r),s.undone.rebased(t,r),QC(s.prevRanges,t.mapping),s.prevTime,s.prevComposition):new su(s.done.addMaps(t.mapping.maps),s.undone.addMaps(t.mapping.maps),QC(s.prevRanges,t.mapping),s.prevTime,s.prevComposition)}function FY(s,e){if(!e)return!1;if(!s.docChanged)return!0;let t=!1;return s.mapping.maps[0].forEach((n,i)=>{for(let r=0;r=e[r]&&(t=!0)}),t}function tI(s){let e=[];for(let t=s.length-1;t>=0&&e.length==0;t--)s[t].forEach((n,i,r,o)=>e.push(r,o));return e}function QC(s,e){if(!s)return null;let t=[];for(let n=0;n{let i=Rf.getState(t);if(!i||(s?i.undone:i.done).eventCount==0)return!1;if(n){let r=HY(i,t,s);r&&n(e?r.scrollIntoView():r)}return!0}}const WD=UD(!1,!0),zD=UD(!0,!0);fn.create({name:"characterCount",addOptions(){return{limit:null,autoTrim:!0,mode:"textSize",textCounter:s=>s.length,wordCounter:s=>s.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=s=>{const e=(s==null?void 0:s.node)||this.editor.state.doc;if(((s==null?void 0:s.mode)||this.options.mode)==="textSize"){const n=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(n)}return e.nodeSize},this.storage.words=s=>{const e=(s==null?void 0:s.node)||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let s=!1;return[new Gs({key:new _n("characterCount"),appendTransaction:(e,t,n)=>{if(s)return;const i=this.options.limit,r=this.options.autoTrim;if(i==null||i===0||r===!1){s=!0;return}const o=this.storage.characters({node:n.doc});if(o>i){const a=o-i,c=0,l=a;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);const u=n.tr.deleteRange(c,l);return s=!0,u}s=!0},filterTransaction:(e,t)=>{const n=this.options.limit;if(!e.docChanged||n===0||n===null||n===void 0)return!0;const i=this.storage.characters({node:t.doc}),r=this.storage.characters({node:e.doc});if(r<=n||i>n&&r>n&&r<=i)return!0;if(i>n&&r>n&&r>i||!e.getMeta("paste"))return!1;const a=e.selection.$head.pos,c=r-n,l=a-c,u=a;return e.deleteRange(l,u),!(this.storage.characters({node:e.doc})>n)}})]}});var zY=fn.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[TY(this.options)]}});fn.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Gs({key:new _n("focus"),props:{decorations:({doc:s,selection:e})=>{const{isEditable:t,isFocused:n}=this.editor,{anchor:i}=e,r=[];if(!t||!n)return js.create(s,[]);let o=0;this.options.mode==="deepest"&&s.descendants((c,l)=>{if(c.isText)return;if(!(i>=l&&i<=l+c.nodeSize-1))return!1;o+=1});let a=0;return s.descendants((c,l)=>{if(c.isText||!(i>=l&&i<=l+c.nodeSize-1))return!1;if(a+=1,this.options.mode==="deepest"&&o-a>0||this.options.mode==="shallowest"&&a>1)return this.options.mode==="deepest";r.push(Ai.node(l,l+c.nodeSize,{class:this.options.className}))}),js.create(s,r)}}})]}});var jY=fn.create({name:"gapCursor",addProseMirrorPlugins(){return[xY()]},extendNodeSchema(s){var e;const t={name:s.name,options:s.options,storage:s.storage};return{allowGapCursor:(e=ls(dt(s,"allowGapCursor",t)))!=null?e:null}}}),jD="placeholder",wy=new _n("tiptap__placeholder"),nI=200;function iI(s){const{editor:e,placeholder:t,dataAttribute:n,pos:i,node:r,isEmptyDoc:o,hasAnchor:a,classes:{emptyNode:c,emptyEditor:l}}=s,u=[c];return o&&u.push(l),Ai.node(i,i+r.nodeSize,{class:u.join(" "),[n]:typeof t=="function"?t({editor:e,node:r,pos:i,hasAnchor:a}):t})}function rI(s,e){return typeof s=="function"?s(e):s}function VY({editor:s,options:e,dataAttribute:t,doc:n,selection:i}){var r,o;if(!(s.isEditable||!e.showOnlyWhenEditable))return null;const{anchor:c}=i,l=[],u=s.isEmpty;if(e.showOnlyCurrent&&!e.includeChildren){const h=n.resolve(c),p=h.depth>0?h.node(1):h.nodeAfter,g=h.depth>0?h.before(1):c;if(p&&p.type.isTextblock&&vy(p)){const v=c>=g&&c<=g+p.nodeSize;l.push(iI({editor:s,isEmptyDoc:u,dataAttribute:t,hasAnchor:v,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:rI(e.emptyNodeClass,{editor:s,node:p,pos:g,hasAnchor:v})},node:p,pos:g}))}}else{const h=wy.getState(s.state),p=(r=h==null?void 0:h.topPos)!=null?r:0,g=(o=h==null?void 0:h.bottomPos)!=null?o:n.content.size;n.nodesBetween(p,g,(v,m)=>{const y=c>=m&&c<=m+v.nodeSize,_=!v.isLeaf&&vy(v);return v.type.isTextblock&&(y||!e.showOnlyCurrent)&&_&&l.push(iI({editor:s,isEmptyDoc:u,dataAttribute:t,hasAnchor:y,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:rI(e.emptyNodeClass,{editor:s,node:v,pos:m,hasAnchor:y})},node:v,pos:m})),e.includeChildren})}return js.create(n,l)}function GY(s){return s.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}function KY(s){const e=getComputedStyle(s),t=`${e.overflow} ${e.overflowY} ${e.overflowX}`;return/auto|scroll|overlay/.test(t)}function qY(s){let e=s;for(;e;){if(KY(e))return e;const t=e.parentElement;if(!t){const n=e.getRootNode();if(n instanceof ShadowRoot){e=n.host;continue}return window}e=t}return window}function QY(s){return s===window?{top:0,bottom:window.innerHeight}:s.getBoundingClientRect()}function XY({doc:s,view:e,scrollContainer:t}){const n=e.dom.getBoundingClientRect(),i=t?QY(t):{top:0,bottom:window.innerHeight},r=Math.max(n.top,i.top)-nI,o=Math.min(n.bottom,i.bottom)+nI;if(r>=o)return{top:0,bottom:s.content.size};const c=getComputedStyle(e.dom).direction==="rtl"?Math.max(n.right-2,n.left+2):n.left+2,l=e.posAtCoords({left:c,top:r+2}),u=e.posAtCoords({left:c,top:o-2});return{top:l?l.pos:0,bottom:u?u.pos:s.content.size}}var YY={init(){return{topPos:null,bottomPos:null}},apply(s,e){const t=s.getMeta(wy);return t!=null&&t.positions?{topPos:t.positions.top,bottomPos:t.positions.bottom}:s.docChanged?{topPos:e.topPos!==null?s.mapping.map(e.topPos):null,bottomPos:e.bottomPos!==null?s.mapping.map(e.bottomPos):null}:e}};function JY(s){const e=qY(s.dom),t=()=>{const a=XY({view:s,doc:s.state.doc,scrollContainer:e}),c=wy.getState(s.state);if((c==null?void 0:c.topPos)===a.top&&(c==null?void 0:c.bottomPos)===a.bottom)return;const l=s.state.tr.setMeta(wy,{positions:a});s.dispatch(l)};let n=null,i=0;const r=150,o=()=>{n===null&&(n=requestAnimationFrame(()=>{n=null;const a=performance.now();a-i>=r?(i=a,t()):o()}))};return e.addEventListener("scroll",o,{passive:!0}),t(),{update(a,c){s.state.doc.content.size!==c.doc.content.size&&o()},destroy:()=>{n!==null&&cancelAnimationFrame(n),e.removeEventListener("scroll",o)}}}function ZY({editor:s,options:e}){const t=e.dataAttribute?`data-${GY(e.dataAttribute)}`:`data-${jD}`;return new Gs({key:wy,state:YY,view:JY,props:{decorations:({doc:n,selection:i})=>VY({editor:s,options:e,dataAttribute:t,doc:n,selection:i})}})}var eJ=fn.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:jD,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[ZY({editor:this.editor,options:this.options})]}}),tJ=`.ProseMirror:not(.ProseMirror-focused) *::selection { background: transparent; } .ProseMirror:not(.ProseMirror-focused) *::-moz-selection { background: transparent; }`;fn.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:s,options:e}=this;return s.options.injectCSS&&typeof document<"u"&&tD(tJ,s.options.injectNonce,"selection"),[new Gs({key:new _n("selection"),props:{decorations(t){return t.selection.empty||s.isFocused||!s.isEditable||BO(t.selection)||s.view.dragging?null:js.create(t.doc,[Ai.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});var sJ="skipTrailingNode";function oI({types:s,node:e}){return e&&Array.isArray(s)&&s.includes(e.type)||(e==null?void 0:e.type)===s}var nJ=fn.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var s;const e=new _n(this.name),t=this.options.node||((s=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:s.name)||"paragraph",n=Object.entries(this.editor.schema.nodes).map(([,i])=>i).filter(i=>(this.options.notAfter||[]).concat(t).includes(i.name));return[new Gs({key:e,appendTransaction:(i,r,o)=>{const{doc:a,tr:c,schema:l}=o,u=e.getState(o),d=a.content.size,h=l.nodes[t];if(!i.some(p=>p.getMeta(sJ))&&u)return c.insert(d,h.create())},state:{init:(i,r)=>{const o=r.tr.doc.lastChild;return!oI({node:o,types:n})},apply:(i,r)=>{if(!i.docChanged||i.getMeta("__uniqueIDTransaction"))return r;const o=i.doc.lastChild;return!oI({node:o,types:n})}}})]}}),iJ=fn.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:s,dispatch:e})=>WD(s,e),redo:()=>({state:s,dispatch:e})=>zD(s,e)}},addProseMirrorPlugins(){return[WY(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),rJ=fn.create({name:"starterKit",addExtensions(){var s,e,t,n;const i=[];return this.options.bold!==!1&&i.push(uX.configure(this.options.bold)),this.options.blockquote!==!1&&i.push(rX.configure(this.options.blockquote)),this.options.bulletList!==!1&&i.push(RD.configure(this.options.bulletList)),this.options.code!==!1&&i.push(fX.configure(this.options.code)),this.options.codeBlock!==!1&&i.push(gX.configure(this.options.codeBlock)),this.options.document!==!1&&i.push(vX.configure(this.options.document)),this.options.dropcursor!==!1&&i.push(zY.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&i.push(jY.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&i.push(yX.configure(this.options.hardBreak)),this.options.heading!==!1&&i.push(bX.configure(this.options.heading)),this.options.undoRedo!==!1&&i.push(iJ.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&i.push(_X.configure(this.options.horizontalRule)),this.options.italic!==!1&&i.push(TX.configure(this.options.italic)),this.options.listItem!==!1&&i.push(PD.configure(this.options.listItem)),this.options.listKeymap!==!1&&i.push(ND.configure((s=this.options)==null?void 0:s.listKeymap)),this.options.link!==!1&&i.push(YX.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&i.push(BD.configure(this.options.orderedList)),this.options.paragraph!==!1&&i.push(bY.configure(this.options.paragraph)),this.options.strike!==!1&&i.push(SY.configure(this.options.strike)),this.options.text!==!1&&i.push(kY.configure(this.options.text)),this.options.underline!==!1&&i.push(CY.configure((t=this.options)==null?void 0:t.underline)),this.options.trailingNode!==!1&&i.push(nJ.configure((n=this.options)==null?void 0:n.trailingNode)),i}}),oJ=rJ;function aJ(s){var e;const{char:t,allowSpaces:n,allowToIncludeChar:i,allowedPrefixes:r,startOfLine:o,$position:a}=s,c=n&&!i,l=FQ(t),u=new RegExp(`\\s${l}$`),d=o?"^":"",h=i?"":l,p=c?new RegExp(`${d}${l}.*?(?=\\s${h}|$)`,"gm"):new RegExp(`${d}(?:^)?${l}[^\\s${h}]*`,"gm"),g=((e=a.nodeBefore)==null?void 0:e.isText)&&a.nodeBefore.text;if(!g)return null;const v=a.pos-g.length,m=Array.from(g.matchAll(p)).pop();if(!m||m.input===void 0||m.index===void 0)return null;const y=m.input.slice(Math.max(0,m.index-1),m.index),_=new RegExp(`^[${r==null?void 0:r.join("")}\0]?$`).test(y);if(r!==null&&!_)return null;const b=v+m.index;let k=b+m[0].length;return c&&u.test(g.slice(k-1,k+1))&&(m[0]+=" ",k+=1),b=a.pos?{range:{from:b,to:k},query:m[0].slice(t.length),text:m[0]}:null}function lJ(s){return s.docChanged?s.steps.some(e=>{const t=e.slice;if(!(t!=null&&t.content))return!1;const n=t.content.textBetween(0,t.content.size,` `);return/\s/.test(n)}):!1}var cJ=new _n("suggestion");function uJ({pluginKey:s=cJ,editor:e,char:t="@",allowSpaces:n=!1,allowToIncludeChar:i=!1,allowedPrefixes:r=[" "],startOfLine:o=!1,decorationTag:a="span",decorationClass:c="suggestion",decorationContent:l="",decorationEmptyClass:u="is-empty",command:d=()=>null,items:h=()=>[],render:p=()=>({}),allow:g=()=>!0,findSuggestionMatch:v=aJ,shouldShow:m,shouldResetDismissed:y}){let _;const b=p==null?void 0:p(),k=n&&!i,w=()=>{const x=e.state.selection.$anchor.pos,D=e.view.coordsAtPos(x),{top:N,right:O,bottom:G,left:Z}=D;try{return new DOMRect(Z,N,O-Z,G-N)}catch{return null}},T=(x,D)=>D?()=>{const N=s.getState(e.state),O=N==null?void 0:N.decorationId,G=x.dom.querySelector(`[data-decoration-id="${O}"]`);return(G==null?void 0:G.getBoundingClientRect())||null}:w,A=({match:x,dismissedRange:D,state:N,transaction:O})=>y!=null&&y({editor:e,state:N,range:D,match:x,transaction:O,allowSpaces:k})?!1:k?x.range.from===D.from:x.range.from===D.from&&!lJ(O);function C(x,D){var N;try{const G=s.getState(x.state),Z=G!=null&&G.decorationId?x.dom.querySelector(`[data-decoration-id="${G.decorationId}"]`):null,q={editor:e,range:(G==null?void 0:G.range)||{from:0,to:0},query:(G==null?void 0:G.query)||null,text:(G==null?void 0:G.text)||null,items:[],command:V=>d({editor:e,range:(G==null?void 0:G.range)||{from:0,to:0},props:V}),decorationNode:Z,clientRect:T(x,Z)};(N=b==null?void 0:b.onExit)==null||N.call(b,q)}catch{}const O=x.state.tr.setMeta(D,{exit:!0});x.dispatch(O)}const E=new Gs({key:s,view(){return{update:async(x,D)=>{var N,O,G,Z,q,V,I;const $=(N=this.key)==null?void 0:N.getState(D),L=(O=this.key)==null?void 0:O.getState(x.state),K=$.active&&L.active&&$.range.from!==L.range.from,se=!$.active&&L.active,oe=$.active&&!L.active,ve=!se&&!oe&&$.query!==L.query,le=se||K&&ve,ue=ve||K,P=oe||K&&ve;if(!le&&!ue&&!P)return;const X=P&&!le?$:L,J=x.dom.querySelector(`[data-decoration-id="${X.decorationId}"]`);_={editor:e,range:X.range,query:X.query,text:X.text,items:[],command:ne=>d({editor:e,range:X.range,props:ne}),decorationNode:J,clientRect:T(x,J)},le&&((G=b==null?void 0:b.onBeforeStart)==null||G.call(b,_)),ue&&((Z=b==null?void 0:b.onBeforeUpdate)==null||Z.call(b,_)),(ue||le)&&(_.items=await h({editor:e,query:X.query})),P&&((q=b==null?void 0:b.onExit)==null||q.call(b,_)),ue&&((V=b==null?void 0:b.onUpdate)==null||V.call(b,_)),le&&((I=b==null?void 0:b.onStart)==null||I.call(b,_))},destroy:()=>{var x;_&&((x=b==null?void 0:b.onExit)==null||x.call(b,_))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1,dismissedRange:null}},apply(x,D,N,O){const{isEditable:G}=e,{composing:Z}=e.view,{selection:q}=x,{empty:V,from:I}=q,$={...D},L=x.getMeta(s);if(L&&L.exit)return $.active=!1,$.decorationId=null,$.range={from:0,to:0},$.query=null,$.text=null,$.dismissedRange=D.active?{...D.range}:D.dismissedRange,$;if($.composing=Z,x.docChanged&&$.dismissedRange!==null&&($.dismissedRange={from:x.mapping.map($.dismissedRange.from),to:x.mapping.map($.dismissedRange.to)}),G&&(V||e.view.composing)){(ID.range.to)&&!Z&&!D.composing&&($.active=!1);const K=v({char:t,allowSpaces:n,allowToIncludeChar:i,allowedPrefixes:r,startOfLine:o,$position:q.$from}),se=`id_${Math.floor(Math.random()*4294967295)}`;K&&g({editor:e,state:O,range:K.range,isActive:D.active})&&(!m||m({editor:e,range:K.range,query:K.query,text:K.text,transaction:x}))?($.dismissedRange!==null&&!A({match:K,dismissedRange:$.dismissedRange,state:O,transaction:x})&&($.dismissedRange=null),$.dismissedRange===null?($.active=!0,$.decorationId=D.decorationId?D.decorationId:se,$.range=K.range,$.query=K.query,$.text=K.text):$.active=!1):(K||($.dismissedRange=null),$.active=!1)}else $.active=!1;return $.active||($.decorationId=null,$.range={from:0,to:0},$.query=null,$.text=null),$}},props:{handleKeyDown(x,D){var N,O;const{active:G,range:Z}=E.getState(x.state);if(!G)return!1;if(D.key==="Escape"||D.key==="Esc"){const V=E.getState(x.state);return(N=b==null?void 0:b.onKeyDown)==null||N.call(b,{view:x,event:D,range:V.range}),C(x,s),!0}return((O=b==null?void 0:b.onKeyDown)==null?void 0:O.call(b,{view:x,event:D,range:Z}))||!1},decorations(x){const{active:D,range:N,decorationId:O,query:G}=E.getState(x);if(!D)return null;const Z=!(G!=null&&G.length),q=[c];return Z&&q.push(u),js.create(x.doc,[Ai.inline(N.from,N.to,{nodeName:a,class:q.join(" "),"data-decoration-id":O,"data-decoration-content":l})])}}});return E}function dJ({editor:s,overrideSuggestionOptions:e,extensionName:t,char:n="@"}){const i=new _n;return{editor:s,char:n,pluginKey:i,command:({editor:r,range:o,props:a})=>{var c,l,u;const d=r.view.state.selection.$to.nodeAfter;((c=d==null?void 0:d.text)==null?void 0:c.startsWith(" "))&&(o.to+=1),r.chain().focus().insertContentAt(o,[{type:t,attrs:{...a,mentionSuggestionChar:n}},{type:"text",text:" "}]).run(),(u=(l=r.view.dom.ownerDocument.defaultView)==null?void 0:l.getSelection())==null||u.collapseToEnd()},allow:({state:r,range:o})=>{const a=r.doc.resolve(o.from),c=r.schema.nodes[t];return!!a.parent.type.contentMatch.matchType(c)},...e}}function VD(s){return(s.options.suggestions.length?s.options.suggestions:[s.options.suggestion]).map(e=>dJ({editor:s.editor,overrideSuggestionOptions:e,extensionName:s.name,char:e.char}))}function aI(s,e){const t=VD(s),n=t.find(i=>i.char===e);return n||(t.length?t[0]:null)}var hJ=Ar.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:s,suggestion:e}){var t,n;return`${(t=e==null?void 0:e.char)!=null?t:"@"}${(n=s.attrs.label)!=null?n:s.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:s,node:e,suggestion:t}){var n,i;return["span",Vs(this.HTMLAttributes,s.HTMLAttributes),`${(n=t==null?void 0:t.char)!=null?n:"@"}${(i=e.attrs.label)!=null?i:e.attrs.id}`]},suggestions:[],suggestion:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:s=>s.getAttribute("data-id"),renderHTML:s=>s.id?{"data-id":s.id}:{}},label:{default:null,parseHTML:s=>s.getAttribute("data-label"),renderHTML:s=>s.label?{"data-label":s.label}:{}},mentionSuggestionChar:{default:"@",parseHTML:s=>s.getAttribute("data-mention-suggestion-char"),renderHTML:s=>({"data-mention-suggestion-char":s.mentionSuggestionChar})}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:s,HTMLAttributes:e}){const t=aI(this,s.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",Vs({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:s,suggestion:t})];const n={...this.options};n.HTMLAttributes=Vs({"data-type":this.name},this.options.HTMLAttributes,e);const i=this.options.renderHTML({options:n,node:s,suggestion:t});return typeof i=="string"?["span",Vs({"data-type":this.name},this.options.HTMLAttributes,e),i]:i},...sD({nodeName:"mention",name:"@",selfClosing:!0,allowedAttributes:["id","label",{name:"mentionSuggestionChar",skipIfDefault:"@"}],parseAttributes:s=>{const e={},t=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let n=t.exec(s);for(;n!==null;){const[,i,r,o]=n,a=r??o;e[i==="char"?"mentionSuggestionChar":i]=a,n=t.exec(s)}return e},serializeAttributes:s=>Object.entries(s).filter(([,e])=>e!=null).map(([e,t])=>`${e==="mentionSuggestionChar"?"char":e}="${t}"`).join(" ")}),renderText({node:s}){const e={options:this.options,node:s,suggestion:aI(this,s.attrs.mentionSuggestionChar)};return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel(e)):this.options.renderText(e)},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:s,state:e})=>{let t=!1;const{selection:n}=e,{empty:i,anchor:r}=n;if(!i)return!1;let o=new Tc,a=0;return e.doc.nodesBetween(r-1,r,(c,l)=>{if(c.type.name===this.name)return t=!0,o=c,a=l,!1}),t&&s.insertText(this.options.deleteTriggerWithBackspace?"":o.attrs.mentionSuggestionChar,a,a+o.nodeSize),t})}},addProseMirrorPlugins(){return VD(this).map(uJ)}}),fJ=hJ,pJ=eJ;const mJ=["aria-label"],gJ=["aria-selected"],vJ={class:"file-at-item__name"},yJ={class:"file-at-item__description"},bJ=["aria-selected","onMouseenter","onMousedown"],_J={class:"file-at-item__name"},wJ={class:"file-at-item__description"},SJ={key:1,class:"file-at-empty"},kJ={key:2,class:"file-at-empty"},CJ=ct({__name:"FileAtMenu",props:{visible:{type:Boolean},items:{},activeIndex:{},loading:{type:Boolean},hostMode:{type:Boolean},menuStyle:{}},emits:["select","hover"],setup(s,{expose:e}){const t=s,n=ge(null),i=be(()=>t.hostMode),r=be(()=>t.items||[]),o=u=>i.value?u+1:u;Ke(()=>t.visible,()=>{t.visible&&ft(()=>{const u=n.value;u&&(u.scrollTop=0)})});const a=u=>{const d=n.value;if(!d)return;const h=31,p=u*h,g=p+h;pd.scrollTop+d.clientHeight&&(d.scrollTop=g-d.clientHeight)};return e({focusActive:()=>{ft(()=>{a(t.activeIndex)})},setManualScroll:()=>{}}),(u,d)=>(F(),Ft(gs,{name:"file-at-menu-motion"},{default:Gt(()=>[s.visible?(F(),U("div",{key:0,class:"file-at-menu-wrapper",role:"listbox","aria-label":u.$t("quickdock.atMenuAria"),style:qe(s.menuStyle),onClick:d[2]||(d[2]=De(()=>{},["stop"]))},[M("div",{ref_key:"fileAtList",ref:n,class:"file-at-menu"},[s.hostMode?(F(),U("button",{key:0,type:"button",class:Ce(["file-at-item file-at-item--picker",{"file-at-item--active":s.activeIndex===0}]),role:"option","aria-selected":s.activeIndex===0,onMouseenter:d[0]||(d[0]=h=>u.$emit("hover",0)),onMousedown:d[1]||(d[1]=De(h=>u.$emit("select",0),["prevent"]))},[M("span",vJ,Q(u.$t("quickdock.atMenuPicker")),1),M("span",yJ,Q(u.$t("quickdock.atMenuPickerDesc")),1)],42,gJ)):me("",!0),(F(!0),U(Ie,null,Ze(r.value,(h,p)=>(F(),U("button",{key:h.path,type:"button",class:Ce(["file-at-item",{"file-at-item--active":o(p)===s.activeIndex}]),role:"option","aria-selected":o(p)===s.activeIndex,onMouseenter:g=>u.$emit("hover",o(p)),onMousedown:De(g=>u.$emit("select",o(p)),["prevent"])},[M("span",_J,Q(h.name),1),M("span",wJ,Q(h.path),1)],42,bJ))),128)),!s.hostMode&&!r.value.length&&!s.loading?(F(),U("div",SJ,Q(u.$t("quickdock.atMenuNoMatch")),1)):me("",!0),s.loading?(F(),U("div",kJ,Q(u.$t("quickdock.atMenuSearching")),1)):me("",!0)],512)],12,mJ)):me("",!0)]),_:1}))}}),TJ=qt(CJ,[["__scopeId","data-v-a1cb8c9d"]]),AJ={class:"rolling-number"},EJ={class:"rolling-number__cell"},MJ={class:"rolling-number__cell"},lI=38,xJ=360,RJ=ct({__name:"RollingNumber",props:{value:{}},setup(s){const e=s,t=ge([]),n=new Map;let i=!1,r=0;const o=new Set,a=new Map;function c(d){const h=Math.max(0,Math.trunc(Number(d)||0)).toString(),p=h.length,g=new Map;for(let v=0;vt.value.map(d=>({place:d,state:n.get(d)})).filter(d=>!!d.state));function u(d){t.value=[...new Set(d)].sort((h,p)=>p-h)}return Ke(()=>e.value,async d=>{const h=c(d),p=++r;if(!i){i=!0,n.clear();for(const[k,w]of h)n.set(k,oy({top:w,bottom:w,offset:0,animate:!1,delay:0}));u(h.keys());return}const g=new Set([...n.keys(),...h.keys()]),v=Math.max(...g,0),m=[],y=[];for(const k of h.keys()){const w=a.get(k);w&&(window.clearTimeout(w),a.delete(k))}for(const k of g){const w=(v-k)*lI,T=h.get(k);if(T===void 0)continue;const A=n.get(k);if(!A){n.set(k,oy({top:T,bottom:T,offset:0,animate:!1,delay:w}));continue}A.delay=w;const C=A.top;if(C===T){A.bottom=T,A.offset=0,A.animate=!1;continue}C{a.delete(k),n.delete(k)},260);a.set(k,w)}await ft(),requestAnimationFrame(()=>{requestAnimationFrame(()=>{if(p===r){for(const k of m)k.animate=!0,k.offset=1;for(const k of y)k.animate=!0,k.offset=0}})});const _=v*lI+xJ+80,b=window.setTimeout(()=>{if(o.delete(b),p===r)for(const[k,w]of h){const T=n.get(k);T&&(T.animate=!1,T.top=w,T.bottom=w,T.offset=0)}},_);o.add(b)},{immediate:!0}),Rn(()=>{o.forEach(d=>window.clearTimeout(d)),o.clear(),a.forEach(d=>window.clearTimeout(d)),a.clear()}),(d,h)=>(F(),U("span",AJ,[We(ay,{name:"rn-place",tag:"span",class:"rolling-number__track"},{default:Gt(()=>[(F(!0),U(Ie,null,Ze(l.value,p=>(F(),U("span",{key:p.place,class:"rolling-number__digit"},[M("span",{class:Ce(["rolling-number__strip",{"is-animating":p.state.animate}]),style:qe({"--rn-offset":p.state.offset,transitionDelay:p.state.delay+"ms"})},[M("span",EJ,Q(p.state.top),1),M("span",MJ,Q(p.state.bottom),1)],6)]))),128))]),_:1})]))}}),cI=qt(RJ,[["__scopeId","data-v-492eb155"]]),IJ={key:0,class:"sa-bg",d:"M 175.959,107.000 Q 180.000,100.000 175.959,93.000 L 144.041,37.718 Q 140.000,30.718 131.917,30.718 L 68.083,30.718 Q 60.000,30.718 55.959,37.718 L 24.041,93.000 Q 20.000,100.000 24.041,107.000 L 55.959,162.282 Q 60.000,169.282 68.083,169.282 L 131.917,169.282 Q 140.000,169.282 144.041,162.282 Z"},PJ=["clip-path"],LJ=["innerHTML"],OJ=150,DJ=210,uI="transform 0.55s cubic-bezier(0.22, 1, 0.36, 1)",dI="transform 0.22s cubic-bezier(0.65, 0, 0.35, 1)",NJ=ct({__name:"StatusAvatar",props:{mode:{default:"idle"},toolKeys:{default:()=>[]},tracking:{type:Boolean,default:!1},size:{default:30},hexBackground:{type:Boolean,default:!1}},emits:["poke"],setup(s,{emit:e}){const t=s,n=e,i=`sa-hex-clip-${Math.random().toString(36).slice(2,9)}`,r=ge(null),o=ge(null),a=ge(null),c=ge(null),l=ge(null),u=ge(!0),d=[{key:"search",motion:"wiggle",svg:''},{key:"webpage",motion:"bob",svg:''},{key:"write",motion:"wiggle",svg:''},{key:"read",motion:"bob",svg:''},{key:"save",motion:"bob",svg:''},{key:"camera",motion:"bob",svg:''},{key:"monitor",motion:"bob",svg:''},{key:"keyboard",motion:"bob",svg:''},{key:"clipboard",motion:"bob",svg:''},{key:"command",motion:"bob",svg:''},{key:"brain",motion:"bob",svg:''},{key:"notebook",motion:"bob",svg:''},{key:"note",motion:"bob",svg:''},{key:"check",motion:"bob",svg:''},{key:"skill",motion:"bob",svg:''},{key:"persona",motion:"bob",svg:''},{key:"mcp",motion:"bob",raw:''},{key:"ask",motion:"bob",scale:3.7,svg:''},{key:"sleep",motion:"special",raw:'ZZZ'}];function h(xe){if(xe.raw)return xe.motion==="bob"?`${xe.raw}`:xe.raw;const he=`${xe.svg}`;return`${he}`}const p={idle:"M 0,-11 Q 0,-5.5 0,0 Q 0,5.5 0,11 Q 0,5.5 0,0 Q 0,-5.5 0,-11",blink:"M 0,0 Q 0,0 0,0 Q 0,0 0,0 Q 0,0 0,0 Q 0,0 0,0",nervousLeft:"M -10,-12 Q -2,-6 6,0 Q -2,6 -10,12 Q -2,6 6,0 Q -2,-6 -10,-12",nervousRight:"M 10,-12 Q 2,-6 -6,0 Q 2,6 10,12 Q 2,6 -6,0 Q 2,-6 10,-12",work:"M 0,0 Q 8.5,0 17,0 Q 25.5,0 34,0 Q 25.5,0 17,0 Q 8.5,0 0,0"},g={x:84,y:96},v={x:116,y:96},m={x:82,y:96},y={x:118,y:96},_={x:117,y:100};let b="idle",k="idle";function w(xe,pe,he,ye){const ke=3*xe,Le=3*(he-xe)-ke,st=1-ke-Le,gt=3*pe,Wt=3*(ye-pe)-gt,jt=1-gt-Wt,ht=Qt=>((st*Qt+Le)*Qt+ke)*Qt;return Qt=>{let It=Qt;for(let ns=0;ns<8;ns++){const ot=ht(It)-Qt;if(Math.abs(ot)<1e-6)return((jt*It+Wt)*It+gt)*It;const $s=(3*st*It+2*Le)*It+ke;if(Math.abs($s)<1e-6)break;It-=ot/$s}return((jt*It+Wt)*It+gt)*It}}const T=w(.22,1,.36,1),A=w(.65,0,.35,1);function C(xe){return(xe.match(/[-\d.]+/g)||[]).map(Number)}function E(xe){return`M ${xe[0]},${xe[1]} Q ${xe[2]},${xe[3]} ${xe[4]},${xe[5]} Q ${xe[6]},${xe[7]} ${xe[8]},${xe[9]} Q ${xe[10]},${xe[11]} ${xe[12]},${xe[13]} Q ${xe[14]},${xe[15]} ${xe[16]},${xe[17]}`}const x=new Map;function D(xe,pe,he,ye=550,ke=T){if(!xe)return;xe.setAttribute("d",p[pe]);const Le=C(p[pe]),st=C(p[he]),gt=performance.now(),Wt=x.get(xe);Wt&&cancelAnimationFrame(Wt);const jt=ht=>{const Qt=Math.min((ht-gt)/ye,1),It=ke(Qt),ns=Le.map((ot,$s)=>ot+(st[$s]-ot)*It);xe.setAttribute("d",E(ns)),Qt<1?x.set(xe,requestAnimationFrame(jt)):x.delete(xe)};x.set(xe,requestAnimationFrame(jt))}function N(){a.value&&(a.value.style.transition=uI,a.value.style.transform=`translate(${_.x}px, ${_.y}px) rotate(${OJ}deg)`),c.value&&(c.value.style.transition=uI,c.value.style.transform=`translate(${_.x}px, ${_.y}px) rotate(${DJ}deg)`)}function O(xe=!0){a.value&&(xe||(a.value.style.transition="none"),a.value.style.transform=`translate(${g.x}px, ${g.y}px)`,xe||(a.value.offsetWidth,a.value.style.transition="")),c.value&&(xe||(c.value.style.transition="none"),c.value.style.transform=`translate(${v.x}px, ${v.y}px)`,xe||(c.value.offsetWidth,c.value.style.transition=""))}function G(){a.value&&(a.value.style.transition=dI,a.value.style.transform=`translate(${m.x}px, ${m.y}px)`),c.value&&(c.value.style.transition=dI,c.value.style.transform=`translate(${y.x}px, ${y.y}px)`)}let Z=0,q=0,V=0,I=0,$=null;function L(xe){Z=xe.clientX,q=xe.clientY}function K(){$&&cancelAnimationFrame($),$=null,o.value&&(o.value.style.transform="translate(0px, 0px)")}function se(){const xe=P.value||t.mode;if(!(t.tracking&&(xe==="idle"||xe==="nervous"))||!r.value){K();return}const pe=r.value.getBoundingClientRect(),he=pe.left+pe.width/2,ye=pe.top+pe.height/2,ke=Z-he,Le=q-ye,st=Math.sqrt(ke*ke+Le*Le),gt=Math.atan2(Le,ke),Wt=Math.min(st/180,1),jt=Math.cos(gt)*10*Wt,ht=Math.sin(gt)*10*Wt;V+=(jt-V)*.15,I+=(ht-I)*.15,o.value&&(o.value.style.transform=`translate(${V}px, ${I}px)`),$=requestAnimationFrame(se)}let oe=null,ve=null,le=null,ue=!1;const P=ge(null);function X(){oe&&clearTimeout(oe),oe=null}function J(){ve&&clearTimeout(ve),ve=null}function ne(){le&&clearTimeout(le),le=null}function ce(xe){return new Promise(pe=>window.setTimeout(pe,xe))}function _e(){if(J(),t.mode!=="idle"||P.value)return;const xe=2800+Math.random()*3600;ve=window.setTimeout(async()=>{await Pe(),_e()},xe)}async function Pe(){if(t.mode!=="idle"||P.value||ue)return;ue=!0;const xe=Math.random()<.5?1:2;for(let pe=0;pe{P.value==="nervous"&&(P.value=null)},500))}function at(){t.mode==="idle"&&(n("poke"),it())}function rt(xe,pe=!0){const he=u.value&&!l.value;if(u.value=!1,!pe||l.value===xe){l.value=xe;return}if(he){l.value=null,X(),oe=window.setTimeout(()=>{l.value=xe,oe=null},160);return}if(!l.value){l.value=xe;return}l.value=null,X(),oe=window.setTimeout(()=>{l.value=xe,oe=null},160)}function Oe(){t.mode!=="idle"&&P.value&&(P.value=null,ne());const xe=P.value||t.mode;if(xe!=="idle"&&J(),xe==="tool"){K();const ke=(t.toolKeys||[]).filter(Boolean);rt(ke.length?ke[0]:"command");return}if(X(),xe==="think"){K(),rt("think");return}if(xe==="nervous")return;const pe=xe==="work"?"work":"idle",he=!!l.value;l.value=null;const ye=()=>{u.value=!0,D(a.value,b,pe),D(c.value,k,pe),pe==="work"?N():O(),b=pe,k=pe};he?oe=window.setTimeout(()=>{ye(),oe=null},160):ye(),pe==="idle"&&t.tracking?(K(),se(),_e()):(K(),J())}return Ke(()=>[t.mode,(t.toolKeys||[]).join(""),t.tracking,P.value],()=>Oe()),dn(()=>{O(!1),document.addEventListener("mousemove",L),Oe()}),Rn(()=>{document.removeEventListener("mousemove",L),K(),X(),J(),ne(),x.forEach(xe=>cancelAnimationFrame(xe)),x.clear()}),(xe,pe)=>(F(),U("svg",{ref_key:"svgRef",ref:r,class:Ce(["status-avatar",`status-avatar--${t.mode||"idle"}`]),style:qe({width:s.size+"px",height:s.size+"px"}),viewBox:"0 0 200 200","aria-hidden":"true",onClick:at},[t.hexBackground?(F(),U("path",IJ)):me("",!0),pe[3]||(pe[3]=M("path",{class:"sa-frame",d:"M 175.959,107.000 Q 180.000,100.000 175.959,93.000 L 144.041,37.718 Q 140.000,30.718 131.917,30.718 L 68.083,30.718 Q 60.000,30.718 55.959,37.718 L 24.041,93.000 Q 20.000,100.000 24.041,107.000 L 55.959,162.282 Q 60.000,169.282 68.083,169.282 L 131.917,169.282 Q 140.000,169.282 144.041,162.282 Z"},null,-1)),M("defs",null,[M("clipPath",{id:i},[...pe[0]||(pe[0]=[M("path",{d:"M 180,100 L 140,30.718 L 60,30.718 L 20,100 L 60,169.282 L 140,169.282 Z"},null,-1)])])]),M("g",{class:"sa-face",ref_key:"faceRef",ref:o},[M("g",{class:Ce(["sa-fc sa-shared",{hidden:!u.value}])},[M("path",{class:"sa-eye",ref_key:"eyeLeftRef",ref:a,d:"M 0,-11 Q 0,-5.5 0,0 Q 0,5.5 0,11 Q 0,5.5 0,0 Q 0,-5.5 0,-11",transform:"translate(84, 96)"},null,512),M("path",{class:"sa-eye",ref_key:"eyeRightRef",ref:c,d:"M 0,-11 Q 0,-5.5 0,0 Q 0,5.5 0,11 Q 0,5.5 0,0 Q 0,-5.5 0,-11",transform:"translate(116, 96)"},null,512)],2),M("g",{class:Ce(["sa-fc sa-icon",{active:l.value==="think"}])},[...pe[1]||(pe[1]=[M("circle",{class:"sa-think-dot",cx:"80",cy:"100",r:"7"},null,-1),M("circle",{class:"sa-think-dot",cx:"100",cy:"100",r:"7"},null,-1),M("circle",{class:"sa-think-dot",cx:"120",cy:"100",r:"7"},null,-1)])],2),M("g",{class:Ce(["sa-fc sa-icon",{active:l.value==="subagent"}]),"clip-path":`url(#${i})`},[...pe[2]||(pe[2]=[Mi('',1)])],10,PJ),(F(),U(Ie,null,Ze(d,he=>M("g",{key:he.key,class:Ce(["sa-fc sa-icon",{active:l.value===he.key}]),innerHTML:h(he)},null,10,LJ)),64))],512)],6))}}),GD=qt(NJ,[["__scopeId","data-v-05190602"]]),$J=["data-runtime-queue-id"],BJ={class:"runtime-queue-item__text"},FJ=["onClick"],HJ=["onClick"],UJ=["aria-label"],WJ=["aria-selected","disabled","onMousedown"],zJ={class:"skill-slash-item__name"},jJ={class:"skill-slash-item__description"},VJ={key:0,class:"skill-slash-empty"},GJ={key:0,class:"floating-project-status__left"},KJ={class:"floating-project-status__menu-wrap"},qJ={class:"floating-project-status__menu-wrap"},QJ={class:"floating-project-status__right"},XJ={key:0,class:"floating-project-status__notice"},YJ={key:1,class:"floating-project-status__notice"},JJ={class:"floating-project-status__add"},ZJ={class:"floating-project-status__del"},eZ={class:"input-stack"},tZ={key:0,class:"image-inline-row"},sZ=["onClick"],nZ=["src","alt"],iZ=["onClick"],rZ={key:1,class:"image-inline-row video-inline-row"},oZ=["src","alt"],aZ=["onClick"],lZ={class:"input-row"},cZ={class:"stadium-input-rich"},uZ={class:"input-actions"},dZ={class:"input-actions-left"},hZ=["disabled","aria-label"],fZ=["disabled","aria-expanded"],pZ=["onClick"],mZ={class:"agent-type-switcher__menu-label"},gZ={class:"agent-type-switcher__menu-desc"},vZ=["disabled","aria-expanded","title"],yZ=["onClick"],bZ={class:"agent-type-switcher__menu-label"},_Z={class:"agent-type-switcher__menu-desc"},wZ={class:"input-actions-right"},SZ=["disabled","title"],kZ={key:0,class:"mic-icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"20",height:"20",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},CZ={key:1,class:"voice-wave"},TZ=["disabled"],AZ={key:0,class:"stop-icon"},EZ={key:1,class:"send-icon"},MZ=["disabled"],xZ=["disabled","title"],RZ={key:0,class:"permission-switcher__lock",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"12",height:"12",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},IZ={class:"permission-switcher__group-title"},PZ={key:0,class:"permission-switcher__group-lock"},LZ=["disabled","onClick"],OZ={class:"permission-switcher__item-label"},DZ={class:"permission-switcher__item-desc"},NZ={class:"permission-switcher__group-title"},$Z={key:0,class:"permission-switcher__group-lock"},BZ={key:1,class:"permission-switcher__group-lock"},FZ=["disabled","onClick"],HZ={class:"permission-switcher__item-desc"},UZ={class:"permission-switcher__group-title"},WZ=["disabled","onClick"],zZ={class:"permission-switcher__item-desc"},jZ=["disabled"],VZ={class:"context-usage-switcher__tooltip"},YC=300,GZ="cubic-bezier(0.25, 0.8, 0.25, 1)",KZ=ct({name:"InputComposer",__name:"InputComposer",props:{inputMessage:{},inputIsMultiline:{type:Boolean},inputIsFocused:{type:Boolean},isConnected:{type:Boolean},streamingMessage:{type:Boolean},inputLocked:{type:Boolean},uploading:{type:Boolean},thinkingMode:{type:Boolean},runMode:{},quickMenuOpen:{type:Boolean},toolMenuOpen:{type:Boolean},modeMenuOpen:{type:Boolean},modelMenuOpen:{type:Boolean},toolSettings:{},toolSettingsLoading:{type:Boolean},settingsOpen:{type:Boolean},compressing:{type:Boolean},currentConversationId:{},iconStyle:{type:Function},toolCategoryIcon:{type:Function},modelOptions:{},currentModelKey:{},selectedImages:{},selectedFiles:{},selectedVideos:{},mediaUploading:{type:Boolean},blockUpload:{type:Boolean},blockToolToggle:{type:Boolean},blockRealtimeTerminal:{type:Boolean},blockFocusPanel:{type:Boolean},blockTokenPanel:{type:Boolean},blockCompressConversation:{type:Boolean},blockConversationReview:{type:Boolean},currentPermissionMode:{},permissionMenuOpen:{type:Boolean},permissionOptions:{},executionModeEnabled:{type:Boolean},currentExecutionMode:{},executionModeOptions:{},networkPermissionEnabled:{type:Boolean},currentNetworkPermission:{},networkPermissionOptions:{},currentContextTokens:{},versioningEnabled:{type:Boolean},runtimeQueuedMessages:{},projectGitSummary:{},userQuestionMinimized:{type:Boolean},pendingUserQuestionCount:{},planApprovalMinimized:{type:Boolean},pendingPlanApprovalCount:{},goalModeArmed:{type:Boolean},goalRunning:{type:Boolean},goalProgress:{},currentConversationType:{},newConversationType:{},agentTypeMenuOpen:{type:Boolean},currentWorkMode:{},workModeMenuOpen:{type:Boolean},workModeOptions:{},hostWorkspaces:{},currentHostWorkspaceId:{},hostWorkspaceSwitching:{type:Boolean},workspaceKind:{},mainChatIdle:{type:Boolean},activeSubAgentCount:{},hasPendingRuntimeGuidance:{type:Boolean},terminalCount:{},hostMode:{type:Boolean},avatarStatus:{}},emits:["update:input-message","input-change","input-focus","input-blur","toggle-quick-menu","send-message","send-or-stop","quick-upload","pick-images","pick-video","toggle-tool-menu","toggle-mode-menu","toggle-model-menu","select-run-mode","select-model","toggle-settings","update-tool-category","realtime-terminal","toggle-focus-panel","toggle-token-panel","compress-conversation","toggle-approval-panel","file-selected","paste-files","remove-image","remove-video","remove-file","open-review","open-path-authorization","toggle-permission-menu","change-permission-mode","change-execution-mode","change-network-permission","open-versioning-dialog","guide-runtime-message","delete-runtime-message","composer-height-change","restore-user-question","restore-plan-approval","toggle-goal-mode","open-goal-dialog","workflow-activated","open-git-changes-panel","toggle-agent-type-menu","select-new-conversation-type","toggle-work-mode-menu","change-work-mode","new-conversation","switch-host-workspace","fetch-host-workspaces","stop-all-sub-agents"],setup(s,{expose:e,emit:t}){const n=t,i=s,r=lk(),o=Js(),a=ge(null),c=ge(null),l=ge(null),u=ge(null),d=ge(null),h=ge(0),p=ge([]),g=ge([]),v=ge(!1),m=ge(!1),y=ge(!1),_=ge(""),b=ge(0),k=ge(null),w=ge("root"),T=ge(0),A=ge(!1),C=ge(4),E=ge(!1),x=ge(null),D=ge(!1),N=yg(),O=ge([]),G=ge(!1),Z=ge(!1),q=ge(!1);let V=null,I=!1,$=null,L=0;const K=ge(null),se=ge(!1),oe=ge(null),ve=ge(0),le=ge([]),ue=ge(!1),P=ge({}),X=ge(!1);let J=null;const ne=ge("");let ce=null;const _e=be(()=>(lt.value,[S("input.pokeStop"),S("input.pokeHalt"),S("input.pokeDontPoke"),S("input.pokeOops"),S("input.pokeYouPokedMe"),S("input.pokeGentle"),S("input.pokeNotButton"),S("input.pokeNoClicking"),S("input.pokeWhimper"),S("input.pokeHexagonHurt"),S("input.pokeDeform"),S("input.pokeNervous"),S("input.pokePretendCalm"),S("input.pokeTokensFell"),S("input.pokeContextMessy"),S("input.pokeAntiPokeFailed"),S("input.pokeSystemHint"),S("input.pokeWarning"),S("input.pokeRemembered"),S("input.pokePokeBack")])),Pe=be(()=>{var j;if(E.value)return{display:"none"};const W=b.value===0&&((j=k.value)==null?void 0:j.scrollTop)===0;return{top:`${C.value}px`,...W?{borderTopLeftRadius:"calc(var(--skill-slash-radius) - var(--skill-slash-gap))",borderTopRightRadius:"calc(var(--skill-slash-radius) - var(--skill-slash-gap))"}:{}}}),it=(W,j)=>{const ee=V!==null;ee&&cancelAnimationFrame(V),I=!0,$=j;const Te=W.scrollTop,Re=C.value,Ve=j-Te,Ye=4+b.value*31-j-Re,Xe=ee?60:180,xt=performance.now(),Ot=Jt=>{const Ta=Math.max(0,Jt-xt),Cl=Math.min(Ta/Xe,1),L_=1-Math.pow(1-Cl,3);W.scrollTop=Te+Ve*L_,C.value=Re+Ye*L_,Cl<1?V=requestAnimationFrame(Ot):(V=null,I=!1,L=performance.now())};V=requestAnimationFrame(Ot)},at=()=>{if(I||V!==null)return;const W=k.value;if(!W)return;const j=performance.now();$!==null&&j-L<150&&Math.abs(W.scrollTop-$)<1||(E.value=!0)};let rt=null,Oe=!1;const xe=W=>{if(!W)return"";const j=W.split(/[/\\]/);return j[j.length-1]||W},pe=W=>{const j=he(W);j&&Is().openImagePreview({url:j,name:xe(W)})},he=W=>W?`/api/gui/files/download?path=${encodeURIComponent(W)}`:"",ye=(W,j)=>{r.setInputLineCount(W),r.setInputMultiline(j)},ke=be(()=>(Array.isArray(i.runtimeQueuedMessages)?i.runtimeQueuedMessages:[]).filter(j=>j&&j.id&&j.text).map(j=>({...j,text:String(j.text||"").replace(/[\r\n\u2028\u2029]+/g," ")}))),Le=be(()=>{var Re;if(((Re=o==null?void 0:o.form)==null?void 0:Re.show_git_status_bar)===!1)return null;const W=i.projectGitSummary;if(!(W!=null&&W.has_git))return null;const j=String(W.project_name||"").trim(),ee=String(W.branch||"").trim();return!j||!ee?null:{projectName:j,projectPath:String(W.project_path||"").trim(),branch:ee,additions:Math.max(0,Number(W.additions||0)),deletions:Math.max(0,Number(W.deletions||0))}}),st=be(()=>yl.value||se.value||i.quickMenuOpen||ke.value.length>0||i.hasPendingRuntimeGuidance?!1:!!Le.value||!!i.goalRunning||!!i.goalModeArmed||Number(i.pendingUserQuestionCount||0)>0||!!i.planApprovalMinimized&&Number(i.pendingPlanApprovalCount||0)>0||Number(i.activeSubAgentCount||0)>0),gt=be(()=>yl.value||se.value||i.quickMenuOpen||ke.value.length>0||i.hasPendingRuntimeGuidance?!1:!!i.avatarStatus),Wt=be(()=>i.avatarStatus&&(i.avatarStatus.mode==="tool"||i.avatarStatus.mode==="think"||i.avatarStatus.mode==="work"&&i.avatarStatus.apiWaiting)&&i.avatarStatus.text||""),jt=be(()=>{var j;const W=i.avatarStatus;return W?W.mode==="tool"?`avatar-tool-${((j=W.toolKeys)==null?void 0:j[0])||""}`:W.mode==="work"&&W.apiWaiting?"avatar-work-api-waiting":`avatar-${W.mode}`:"avatar-none"}),ht=ge(null),Qt=()=>{ht.value=null},It=W=>{ht.value=ht.value===W?null:W},ns=async W=>{var ee;const j=String(W||"").trim();!j||typeof navigator>"u"||!((ee=navigator.clipboard)!=null&&ee.writeText)||(await navigator.clipboard.writeText(j),Qt())},ot=()=>{var W;ns(((W=Le.value)==null?void 0:W.projectPath)||"")},$s=()=>{var W;ns(((W=Le.value)==null?void 0:W.branch)||"")},Er=async()=>{try{await fetch("/api/project/open-in-file-manager",{method:"POST"})}catch(W){console.warn("打开项目文件管理器失败:",W)}finally{Qt()}},In=()=>{const W=rs.value;if(!W)return null;const{state:j}=W,{$from:ee}=j.selection;ee.start();const Te=ee.parent.textBetween(0,ee.parentOffset,` `,` `),Re=/(^|[ \n])(\/{1,2})([^\s/]*)$/.exec(Te);if(!Re)return null;const Ve=Re[2]||"/",Ue=Re[3]||"",Ye=ee.pos-Ue.length-Ve.length,Xe=ee.pos;return{start:Ye,end:Xe,query:Ue,doubleSlash:Ve.length===2}},Ko=()=>{const W=rs.value;if(!W)return null;const{state:j}=W,{$from:ee}=j.selection,Te=ee.parent.textBetween(0,ee.parentOffset,` `,` `),Re=/(^|[ \n])@([^\s@]*)$/.exec(Te);if(!Re)return null;const Ve=Re[2]||"",Ue=ee.pos-Ve.length-1,Ye=ee.pos;return{start:Ue,end:Ye,query:Ve,charStart:Ue}},ao=()=>{V!==null&&(cancelAnimationFrame(V),V=null),I=!1,$=null,L=0,y.value=!1,_.value="",b.value=0,w.value="root",T.value=0,C.value=4,E.value=!1,x.value=null,D.value=!1},Pn=()=>{se.value=!1,oe.value=null,ve.value=0,le.value=[],ue.value=!1,P.value={},J!==null&&(window.clearTimeout(J),J=null)},qo=()=>{ce!==null&&(window.clearTimeout(ce),ce=null),ne.value=""},Yn=()=>{if(!i.avatarStatus||i.avatarStatus.mode!=="idle")return;const W=_e.value;ne.value=W[Math.floor(Math.random()*W.length)]||S("input.pokeStop"),ce!==null&&window.clearTimeout(ce),ce=window.setTimeout(()=>{ne.value="",ce=null},1800)},Oi=W=>{ft(()=>{const j=rs.value;if(j)try{const ee=j.view.coordsAtPos(W),Te=window.innerWidth,Re=window.innerHeight,Ve=280,Ue=250,Ye=4;let Xe=ee.right,xt=ee.top-Ue;Xe+Ve>Te-Ye&&(Xe=Math.max(Ye,Te-Ve-Ye)),xtRe-Ye&&(xt=Math.max(Ye,Re-Ue-Ye)),P.value={left:`${Xe}px`,top:`${xt}px`,width:`${Ve}px`,maxHeight:`${Ue}px`}}catch{P.value={}}})},Mr=W=>{var ee;if(!W)return!1;const j=((ee=W.split(".").pop())==null?void 0:ee.toLowerCase())||"";return["jpg","jpeg","png","gif","webp","bmp","ico"].includes(j)},Di=async W=>{var j;ue.value=!0;try{const ee=`/api/project/files/search?q=${encodeURIComponent(W)}&limit=50`,Te=await fetch(ee),Re=await Te.json().catch(()=>({}));if(!Te.ok||!(Re!=null&&Re.success)){le.value=[];return}le.value=Array.isArray((j=Re==null?void 0:Re.data)==null?void 0:j.items)?Re.data.items:[]}catch(ee){console.warn("[FileAt] 搜索文件失败:",ee),le.value=[]}finally{ue.value=!1}},gl=W=>{J!==null&&window.clearTimeout(J),J=window.setTimeout(()=>{Di(W)},120)},Qo=()=>{const W=Ko();if(!W||!i.isConnected||i.inputLocked){Pn();return}Qt();const j=oe.value!==W.query;se.value=!0,(j||le.value.length===0)&&(ve.value=0,oe.value=W.query,gl(W.query)),Oi(W.end)},lo=W=>{const j=Ko(),ee=rs.value;if(!j||!ee)return;const{state:Te,view:Re,schema:Ve}=ee,Ue=Ve.nodes.mention;if(!Ue)return;const Ye=Ue.create({id:`file://${W.path}`,label:W.name});let Xe=Te.tr.delete(j.start,j.end);Xe=Xe.insert(j.start,Ye);const xt=j.start+Ye.nodeSize;Xe=Xe.insertText(" ",xt),Xe=Xe.setSelection(kt.near(Xe.doc.resolve(xt+1))),Re.dispatch(Xe),Re.focus(),Pn(),ft(()=>{Ir()})},fi=()=>{var W;Pn(),i.hostMode&&(X.value=!0,(W=d.value)==null||W.click())},Ni=W=>{const j=!!i.hostMode;if(j&&W===0){fi();return}const ee=j?W-1:W,Te=le.value[ee];if(Te){if(Te.type==="file"&&Mr(Te.path)){Pn(),n("pick-images");return}lo(Te)}},wa=W=>{var Te,Re,Ve,Ue;if(!se.value)return!1;const ee=(!!i.hostMode?1:0)+le.value.length;return ee<=0?!1:W.key==="ArrowDown"?(W.preventDefault(),(Te=K.value)==null||Te.setManualScroll(!1),ve.value=(ve.value+1)%ee,(Re=K.value)==null||Re.focusActive(),!0):W.key==="ArrowUp"?(W.preventDefault(),(Ve=K.value)==null||Ve.setManualScroll(!1),ve.value=(ve.value-1+ee)%ee,(Ue=K.value)==null||Ue.focusActive(),!0):W.key==="Enter"?(W.preventDefault(),Ni(ve.value),!0):W.key==="Escape"?(W.preventDefault(),Pn(),!0):!1},vl=()=>{const W=In(),j=rs.value;if(!W||!j)return;const{state:ee,view:Te}=j;let Re=ee.tr.delete(W.start,W.end);Re=Re.setSelection(kt.near(Re.doc.resolve(Math.max(0,W.start)))),Te.dispatch(Re),Te.focus(),ft(()=>{Ir()})},re=()=>{ft(()=>{const W=k.value;if(!W)return;const j=getComputedStyle(W),ee=parseFloat(j.getPropertyValue("--skill-slash-row-height")),Te=parseFloat(j.getPropertyValue("--skill-slash-gap")),Re=(Number.isFinite(ee)?ee:38)+(Number.isFinite(Te)?Te:5),Ve=Math.max(1,Math.floor(W.clientHeight/Re)||5),Ue=Math.floor(Ve/2),Ye=Math.max(0,W.scrollHeight-W.clientHeight),Xe=Math.max(0,Math.min(Ye,(b.value-Ue)*Re));it(W,Xe)})},we=be(()=>{const W=_.value.trim().toLowerCase(),j=Array.isArray(p.value)?p.value:[];return(W?j.filter(Te=>String(Te.name||"").toLowerCase().includes(W)):j).slice(0,100)}),Ae=be(()=>{var j;const W=(j=i.modelOptions)==null?void 0:j.find(ee=>ee.key===i.currentModelKey);return!!(W!=null&&W.supportsImage)}),bt=be(()=>{var j;const W=(j=i.modelOptions)==null?void 0:j.find(ee=>ee.key===i.currentModelKey);return!!(W!=null&&W.supportsVideo)}),hs=async W=>{o.applyTheme(W),o.updateField({key:"theme",value:W});try{const j=await fetch("/api/personalization",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theme:W})}),ee=await j.json().catch(()=>({}));(!j.ok||!ee.success)&&console.warn("保存主题到后端失败:",ee==null?void 0:ee.error)}catch(j){console.warn("保存主题到后端失败:",j)}},Ps=W=>{vl(),ao(),W()},is=be(()=>{var ee;lt.value;const W=[{id:"new",label:S("common.newConversation"),description:S("input.newConversationDesc"),disabled:!i.isConnected,action:()=>n("new-conversation")},{id:"upload",label:S("input.uploadFile"),description:i.uploading?S("input.uploadingDesc"):S("input.selectFileDesc"),disabled:!i.isConnected||i.uploading||i.blockUpload,action:()=>n("quick-upload")},{id:"image",label:S("input.sendImage"),description:Ae.value?S("input.sendImageDesc"):S("input.imageNotSupported"),disabled:!i.isConnected||i.streamingMessage||!Ae.value,action:()=>n("pick-images")},{id:"video",label:S("input.sendVideo"),description:bt.value?S("input.sendVideoDesc"):S("input.videoNotSupported"),disabled:!i.isConnected||i.streamingMessage||!bt.value,action:()=>n("pick-video")},{id:"compress",label:S("input.compressConversation"),description:i.compressing?S("input.compressingDesc"):S("input.compressDesc"),disabled:!i.isConnected||i.compressing||i.streamingMessage||i.blockCompressConversation,action:()=>n("compress-conversation")},{id:"skills",label:S("input.selectAgentSkill"),description:S("input.selectAgentSkillDesc"),mode:"skills"},{id:"workflows",label:S("input.workflows"),description:N.isActive?S("input.workflowRunningDesc",{name:N.snapshot.name}):S("input.workflowActivateDesc"),disabled:!i.isConnected,mode:"workflows"},{id:"conversation-type",label:S("input.conversationType"),description:S("input.conversationTypeDesc"),disabled:!i.isConnected,mode:"conversation-type"},{id:"work-mode",label:S("input.switchWorkMode"),description:S("input.switchWorkModeDesc"),disabled:!i.isConnected||i.streamingMessage,mode:"work-mode"},{id:"theme",label:S("input.switchTheme"),description:S("input.switchThemeDesc"),mode:"theme"},{id:"review",label:S("input.conversationReview"),description:S("input.conversationReviewDesc"),disabled:!i.isConnected||i.streamingMessage||i.blockConversationReview,action:()=>n("open-review")},{id:"tokens",label:S("input.usageStats"),description:S("input.usageStatsDesc"),disabled:!i.currentConversationId||i.blockTokenPanel,action:()=>n("toggle-token-panel",!0)},{id:"goal",label:S("input.goalMode"),description:i.goalRunning?S("input.goalModeRunning"):i.goalModeArmed?S("input.goalModeArmed"):S("input.goalModeToggleDesc"),disabled:!i.isConnected,action:()=>n("toggle-goal-mode")},{id:"personalization",label:S("input.personalSettings"),description:S("input.personalSettingsDesc"),action:()=>{o.openDrawer()}},{id:"terminal",label:S("input.realtimeTerminal"),description:S("input.realtimeTerminalDesc"),disabled:!i.isConnected||i.blockRealtimeTerminal,action:()=>n("realtime-terminal")},{id:"model",label:S("input.switchModel"),description:S("input.switchModelDesc"),disabled:!i.isConnected||i.streamingMessage,mode:"model"},{id:"run-mode",label:S("input.thinkingMode"),description:S("input.thinkingModeDesc"),disabled:!i.isConnected||i.streamingMessage,mode:"run-mode"},{id:"permission",label:S("input.permissionMode"),description:S("input.permissionModeDesc"),disabled:!i.isConnected||i.streamingMessage,mode:"permission"},{id:"network",label:S("input.networkPermission"),description:i.networkPermissionEnabled?S("input.networkPermissionDesc"):S("input.networkUnsupportedDesc"),disabled:!i.isConnected||i.streamingMessage||!i.networkPermissionEnabled,mode:"network"},...i.executionModeEnabled?[{id:"execution",label:S("input.executionEnv"),description:S("input.executionEnvDesc"),disabled:!i.isConnected||i.streamingMessage,mode:"execution"}]:[],...i.workspaceKind?[{id:"workspace",label:i.workspaceKind==="project"?S("input.switchProject"):S("input.switchWorkspace"),description:S("input.workspaceDesc"),disabled:!i.isConnected||i.streamingMessage,mode:"workspace"}]:[],{id:"versioning",label:S("input.versionControl"),description:i.versioningEnabled?S("input.versioningOn"):S("input.versioningOff"),disabled:!i.isConnected||i.streamingMessage,action:()=>n("open-versioning-dialog")},{id:"git-bar",label:S("input.gitStatusBar"),description:((ee=o==null?void 0:o.form)==null?void 0:ee.show_git_status_bar)!==!1?S("input.gitStatusBarShown"):S("input.gitStatusBarHidden"),action:()=>{var Ve;const Re=!(((Ve=o==null?void 0:o.form)==null?void 0:Ve.show_git_status_bar)!==!1);o!=null&&o.form&&(o.form.show_git_status_bar=Re),fetch("/api/personalization",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({show_git_status_bar:Re})}).catch(()=>{})}},{id:"path-auth",label:S("input.pathAuth"),description:S("input.pathAuthDesc"),disabled:!i.isConnected,action:()=>n("open-path-authorization")},{id:"approval",label:S("input.approvalPanel"),description:S("input.approvalPanelDesc"),disabled:!i.isConnected,action:()=>n("toggle-approval-panel")}],j=_.value.trim().toLowerCase();return j?W.filter(Te=>`${Te.label} ${Te.description} ${Te.id}`.toLowerCase().includes(j)):W}),en=be(()=>(lt.value,[{id:"theme-classic",label:S("input.themeClassic"),description:S("input.themeClassicDesc"),theme:"classic"},{id:"theme-light",label:S("input.themeLight"),description:S("input.themeLightDesc"),theme:"light"},{id:"theme-dark",label:S("input.themeDark"),description:S("input.themeDarkDesc"),theme:"dark"}].map(j=>({...j,action:()=>{hs(j.theme)}})))),ut=be(()=>{lt.value;const W=i.permissionOptions||[],j=String(i.currentPermissionMode||""),ee=i.currentWorkMode==="plan";return W.map(Te=>({id:`perm:${Te.value}`,label:S(Te.labelKey),description:ee?S("input.permissionLockedReadonlyDesc"):Te.value===j?S("input.optionWithCurrent",{desc:S(Te.descriptionKey)}):S(Te.descriptionKey),disabled:ee,action:()=>n("change-permission-mode",Te.value)}))}),pn=be(()=>{lt.value;const W=i.executionModeOptions||[],j=String(i.currentExecutionMode||""),ee=i.currentWorkMode==="plan";return W.map(Te=>({id:`exec:${Te.value}`,label:S(Te.labelKey),description:ee?S("input.executionLockedSandboxDesc"):Te.value===j?S("input.optionWithCurrent",{desc:S(Te.descriptionKey)}):S(Te.descriptionKey),disabled:ee,action:()=>n("change-execution-mode",Te.value)}))}),co=be(()=>{lt.value;const W=Array.isArray(i.modelOptions)?i.modelOptions:[],j=String(i.currentModelKey||"");return W.map(ee=>({id:`model:${ee.key}`,label:ee.label,description:ee.key===j?S("input.optionWithCurrent",{desc:ee.description||""}):ee.description||"",disabled:!!ee.disabled,action:()=>n("select-model",ee.key)}))}),$i=be(()=>{lt.value;const W=[{value:"fast",label:S("input.runModeFast")},{value:"thinking",label:S("input.runModeThinking")}],j=String(i.runMode||"");return W.map(ee=>({id:`runmode:${ee.value}`,label:ee.label,description:ee.value===j?S("input.currentMark"):"",action:()=>n("select-run-mode",ee.value)}))}),Bc=be(()=>{lt.value;const W=i.networkPermissionOptions||[],j=String(i.currentNetworkPermission||"");return W.map(ee=>({id:`network:${ee.value}`,label:S(ee.labelKey),description:ee.value===j?S("input.optionWithCurrent",{desc:S(ee.descriptionKey)}):S(ee.descriptionKey),action:()=>n("change-network-permission",ee.value)}))}),xr=be(()=>{lt.value;const W=i.workModeOptions||[],j=String(i.currentWorkMode||"");return W.map(ee=>({id:`workmode:${ee.value}`,label:S(ee.labelKey),description:ee.value===j?S("input.optionWithCurrent",{desc:S(ee.descriptionKey)}):S(ee.descriptionKey),action:()=>n("change-work-mode",ee.value)}))}),Bi=be(()=>{lt.value;const W=Array.isArray(i.hostWorkspaces)?i.hostWorkspaces:[],j=String(i.currentHostWorkspaceId||""),ee=!!i.hostWorkspaceSwitching;return W.map(Te=>({id:`workspace:${Te.workspace_id}`,label:Te.label,description:Te.workspace_id===j?S("input.optionWithCurrent",{desc:Te.path||""}):Te.path||"",disabled:ee||Te.workspace_id===j,action:()=>n("switch-host-workspace",Te.workspace_id)}))}),Fc=be(()=>{lt.value;const W=kd.value,j=String(i.newConversationType||"agent");return R_.value.map(ee=>({id:`convtype:${ee.value}`,label:ee.label,description:W?S("input.conversationTypeLockedDesc"):ee.value===j?S("input.optionWithCurrent",{desc:ee.description||""}):ee.description||"",disabled:W,action:()=>n("select-new-conversation-type",ee.value)}))}),Fi=be(()=>we.value.map(W=>({id:`skill:${W.path}`,label:W.name,description:W.description,skill:W}))),mn=be(()=>w.value==="skills"?Fi.value:w.value==="workflows"?ae.value:w.value==="theme"?en.value:w.value==="permission"?ut.value:w.value==="execution"?pn.value:w.value==="model"?co.value:w.value==="run-mode"?$i.value:w.value==="network"?Bc.value:w.value==="work-mode"?xr.value:w.value==="workspace"?Bi.value:w.value==="conversation-type"?Fc.value:is.value),Hi=be(()=>(lt.value,w.value==="skills"?S("input.slashSkillsAria"):w.value==="workflows"?S("input.slashWorkflowsAria"):w.value==="theme"?S("input.slashThemeAria"):w.value==="permission"?S("input.slashPermissionAria"):w.value==="execution"?S("input.slashExecutionAria"):w.value==="model"?S("input.slashModelAria"):w.value==="run-mode"?S("input.slashRunModeAria"):w.value==="network"?S("input.slashNetworkAria"):w.value==="work-mode"?S("input.slashWorkModeAria"):w.value==="workspace"?i.workspaceKind==="project"?S("input.slashProjectAria"):S("input.slashWorkspaceAria"):w.value==="conversation-type"?S("input.slashConversationTypeAria"):S("input.slashRootAria"))),Sa=be(()=>(lt.value,w.value==="skills"?m.value?S("input.skillsLoadingEmpty"):S("input.skillsEmpty"):w.value==="workflows"?Z.value?S("input.workflowsLoadingEmpty"):S("input.workflowsEmpty"):w.value==="permission"?S("input.permissionEmpty"):w.value==="execution"?S("input.executionEmpty"):w.value==="model"?S("input.modelEmpty"):w.value==="network"?S("input.networkEmpty"):w.value==="work-mode"?S("input.workModeEmpty"):w.value==="workspace"?i.workspaceKind==="project"?S("input.projectEmpty"):S("input.workspaceEmpty"):w.value==="conversation-type"?S("input.conversationTypeEmpty"):S("input.commandEmpty"))),yl=be(()=>y.value&&(m.value||mn.value.length>=0)),Hc=async()=>{if(!(v.value||m.value)){m.value=!0;try{const W=await fetch("/api/skills"),j=await W.json().catch(()=>({}));if(!W.ok||!(j!=null&&j.success))throw new Error((j==null?void 0:j.error)||S("input.loadSkillsFailed"));p.value=Array.isArray(j.skills)?j.skills.filter(ee=>ee&&ee.name&&ee.path).map(ee=>({name:String(ee.name||""),description:String(ee.description||""),path:String(ee.path||"")})):[],v.value=!0}catch(W){p.value=[],v.value=!1,console.warn("[SkillSlash] 加载 skills 失败:",W)}finally{m.value=!1}}},Xo=async(W=!1)=>{if(!(G.value&&!W||Z.value)){Z.value=!0;try{const j=await fetch("/api/workflows"),ee=await j.json().catch(()=>({}));if(!j.ok)throw new Error((ee==null?void 0:ee.error)||S("input.loadWorkflowsFailed"));O.value=Array.isArray(ee.workflows)?ee.workflows.filter(Te=>Te&&Te.name).map(Te=>({name:String(Te.name||""),description:String(Te.description||""),source:String(Te.source||""),updatedAt:String(Te.updatedAt||""),nodeCount:Number(Te.nodeCount??0)})):[],G.value=!0}catch(j){O.value=[],G.value=!1,console.warn("[WorkflowSlash] 加载工作流列表失败:",j)}finally{Z.value=!1}}},Yo=async W=>{if(q.value)return;const j=String(i.currentConversationId||"").trim();q.value=!0;try{const ee={name:W};j&&(ee.conversation_id=j);const Te=await fetch("/api/workflow/activate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ee)}),Re=await Te.json().catch(()=>({}));if(!Te.ok||!(Re!=null&&Re.success))throw new Error((Re==null?void 0:Re.error)||S("input.activateWorkflowFailed"));Re!=null&&Re.snapshot&&N.setWorkflow(Re.snapshot,!0),Is().pushToast({title:S("input.workflowActivated",{name:W}),type:"success"});const Ve=String((Re==null?void 0:Re.conversation_id)||"").trim();Ve&&Ve!==j&&n("workflow-activated",Ve)}catch(ee){Is().pushToast({title:S("input.activateWorkflowFailed"),message:String((ee==null?void 0:ee.message)||ee||""),type:"error"})}finally{q.value=!1}},et=async()=>{if(q.value)return;const W=String(i.currentConversationId||"").trim();if(W){q.value=!0;try{const j=await fetch("/api/workflow/deactivate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({conversation_id:W})}),ee=await j.json().catch(()=>({}));if(!j.ok||!(ee!=null&&ee.success))throw new Error((ee==null?void 0:ee.error)||S("input.exitWorkflowFailed"));N.setWorkflow(null,!0),Is().pushToast({title:S("input.workflowExited",{name:(ee==null?void 0:ee.workflow_name)||""}),type:"success"})}catch(j){Is().pushToast({title:S("input.exitWorkflowFailed"),message:String((j==null?void 0:j.message)||j||""),type:"error"})}finally{q.value=!1}}},ae=be(()=>{lt.value;const W=[],j=N.isActive?String(N.snapshot.name||""):"";j&&W.push({id:"workflow-deactivate",label:S("input.exitCurrentWorkflow"),description:S("input.workflowRunningExitDesc",{name:j}),disabled:q.value,action:()=>{et()}});const ee=!i.isConnected||i.streamingMessage||q.value||!!j;for(const Te of O.value){const Re=j&&Te.name===j;W.push({id:`workflow-activate-${Te.name}`,label:Te.name,description:Re?S("input.workflowCurrentActive"):S("input.workflowItemDesc",{desc:Te.description||S("input.workflowNoDesc"),builtinSuffix:Te.source==="builtin"?S("input.workflowBuiltinSuffix"):""}),disabled:ee||!!Re,action:()=>{Yo(Te.name)}})}return W}),Me=()=>{const W=In();if(!W||!i.isConnected||i.inputLocked){ao();return}Qt(),y.value=!0,_.value!==W.query&&(b.value=0),_.value=W.query,W.doubleSlash&&w.value==="root"&&!D.value?(w.value="skills",x.value="typed",b.value=0):!W.doubleSlash&&w.value==="skills"&&x.value==="typed"&&(w.value="root",x.value=null,b.value=0),w.value==="skills"&&Hc(),b.value=Math.min(b.value,Math.max(0,mn.value.length-1)),re()},Ge=(W=b.value)=>{const j=In(),ee=we.value[W],Te=rs.value;if(!j||!ee||!Te)return;g.value=[...g.value.filter(Jt=>Jt.path!==ee.path),ee];const{state:Re,view:Ve,schema:Ue}=Te,Ye=Ue.nodes.mention;if(!Ye)return;const Xe=Ye.create({id:ee.path,label:ee.name,path:ee.path,description:ee.description||"",mentionSuggestionChar:""});let xt=Re.tr.delete(j.start,j.end);xt=xt.insert(j.start,Xe);const Ot=j.start+Xe.nodeSize;xt=xt.insertText(" ",Ot),xt=xt.setSelection(kt.near(xt.doc.resolve(Ot+1))),Ve.dispatch(xt),Ve.focus(),ao(),ft(()=>{Ir()})},Bt=(W=b.value)=>{const j=mn.value[W];if(!(!j||j.disabled)){if(j.mode){T.value=W,w.value=j.mode,b.value=0,x.value=j.mode==="skills"?"menu":null,j.mode==="skills"&&Hc(),j.mode==="workflows"&&Xo(),j.mode==="workspace"&&n("fetch-host-workspaces"),re();return}if(j.skill){const ee=we.value.findIndex(Te=>{var Re;return Te.path===((Re=j.skill)==null?void 0:Re.path)});Ge(ee>=0?ee:W);return}j.action&&Ps(j.action)}},Tt=W=>{if(W.ctrlKey&&W.key==="Enter")return!1;if(y.value){if(W.key==="ArrowDown"){W.preventDefault(),E.value=!1;const j=mn.value.length;return j>0&&(b.value=(b.value+1)%j,re()),!0}if(W.key==="ArrowUp"){W.preventDefault(),E.value=!1;const j=mn.value.length;return j>0&&(b.value=(b.value-1+j)%j,re()),!0}if(W.key==="Enter")return mn.value.length>0&&(W.preventDefault(),Bt(b.value)),!0;if(W.key==="Escape")return W.preventDefault(),w.value!=="root"?(w.value==="skills"&&x.value==="typed"&&(D.value=!0),x.value=null,w.value="root",b.value=Math.min(T.value,Math.max(0,mn.value.length-1)),re()):ao(),!0}return!1},Zt=W=>wa(W)||Tt(W)?!0:(requestAnimationFrame(()=>{Me(),Qo()}),!1),Cs=()=>{n("input-blur"),window.setTimeout(()=>{ao(),Pn()},120)},pi=W=>{const j=W.clipboardData;if(!j)return[];const ee=[];if(j.items&&j.items.length)for(const Te of Array.from(j.items)){if(Te.kind!=="file")continue;const Re=Te.getAsFile();Re&&ee.push(Re)}return!ee.length&&j.files&&j.files.length&&ee.push(...Array.from(j.files)),ee},mi=(W="")=>{const j=String(W||"").split(` `);return{type:"doc",content:(j.length?j:[""]).map(ee=>({type:"paragraph",content:ee?[{type:"text",text:ee}]:void 0}))}},fs=()=>{const W=rs.value;return W?W.getText({blockSeparator:` `}):i.inputMessage||""},Es=W=>{const j=[],ee=Ve=>{if(!Ve)return"";if(Ve.type==="text")return Ve.text||"";if(Ve.type==="mention"){const Ue=Ve.attrs||{},Ye=String(Ue.id||""),Xe=String(Ue.label||Ye).trim();if(Ye.startsWith("file://")){const Ta=Ye.slice(7);return Xe&&Ta?`[${Xe}](file://${Ta})`:Xe}const Ot=Xe,Jt=String(Ue.path||Ye).trim();return Ot&&Jt&&!j.some(Ta=>Ta.path===Jt)&&j.push({name:Ot,path:Jt}),Ot&&Jt?`[$${Ot}](${Jt})`:Ot}return Ve.type==="hardBreak"?` `:Array.isArray(Ve.content)?Ve.content.map(ee).join(""):""};return{message:(Array.isArray(W==null?void 0:W.content)?W.content:[]).map(Ve=>ee(Ve)).join(` `).trim(),skillRefs:j}},rs=qQ({content:mi(i.inputMessage||""),editable:i.isConnected&&!i.inputLocked,extensions:[oJ.configure({codeBlock:!1,heading:!1,blockquote:!1,bulletList:!1,orderedList:!1,listItem:!1,horizontalRule:!1}),pJ.configure({placeholder:S("input.messagePlaceholder")}),fJ.configure({HTMLAttributes:{class:"skill-md-link"},deleteTriggerWithBackspace:!0,renderText({node:W}){return String(W.attrs.label||W.attrs.id||"")},renderHTML({node:W,HTMLAttributes:j}){const ee=j||{},Te=String(W.attrs.id||""),Re=Te.startsWith("file://"),Ve=Re?`${ee.class||""} file-md-link`.trim():`${ee.class||""} skill-md-link`.trim(),Ue=Re?"data-file-path":"data-skill-path",Ye=Re?Te.slice(7):W.attrs.path||W.attrs.id||"";return["span",{...ee,class:Ve,[Ue]:Ye},String(W.attrs.label||W.attrs.id||"")]},suggestion:{char:"\0"}})],editorProps:{attributes:{class:"stadium-input-editor","data-placeholder":S("input.messagePlaceholder")},handleKeyDown(W,j){return j.ctrlKey&&j.key==="Enter"?(j.preventDefault(),n("send-or-stop"),!0):Zt(j)},handlePaste(W,j){const ee=pi(j);return ee.length?(j.preventDefault(),n("paste-files",ee),!0):!1}},onUpdate(){Oe||(n("update:input-message",fs()),n("input-change"),ft(()=>{Ir(),Me(),Qo()}))},onFocus(){n("input-focus")}}),Ln=ge(!1),bd=ge(null);let cr=0,Ui=0;const Rr=ge("idle"),Sg=ge(0),Uc=ge(""),_d=be(()=>typeof window>"u"?!1:!!window.AndroidVoiceBridge),k_=be(()=>(lt.value,Rr.value==="downloading"?S("input.voiceModelDownloading",{percent:Sg.value}):Rr.value==="model_not_ready"?S("input.voiceModelNotReady"):Ln.value?S("input.stopRecording"):S("input.voiceInput"))),C_=()=>{typeof window>"u"||(window.__onVoiceResult=W=>{const j=window.AndroidVoiceBridge;if(j==null||j.debugLog("__onVoiceResult 被调用, text="+JSON.stringify(W)),!W){j==null||j.debugLog("__onVoiceResult: text 为空,跳过");return}const ee=rs.value;if(!ee){j==null||j.debugLog("__onVoiceResult: editor.value 为 null"),console.warn("[VoiceInput] editor is null");return}j==null||j.debugLog("__onVoiceResult: editor.value 存在,准备插入文字"),j==null||j.debugLog("__onVoiceResult: voiceAnchorPos="+cr+" lastVoiceTextLength="+Ui);const{state:Te,view:Re}=ee,Ve=Te.doc.content.size,Ue=Math.max(0,Math.min(cr,Ve)),Ye=Math.min(Ue+Ui,Ve);j==null||j.debugLog("__onVoiceResult: docSize="+Ve+" safeAnchor="+Ue+" oldEnd="+Ye);try{let Xe=Te.tr;Ye>Ue&&(Xe=Xe.delete(Ue,Ye)),Xe=Xe.insertText(W,Ue);const xt=Math.min(Ue+W.length,Xe.doc.content.size),Ot=window.TextSelection;Ot&&(Xe=Xe.setSelection(Ot.create(Xe.doc,xt))),Re.dispatch(Xe),Re.focus(),Ui=W.length,n("update:input-message",fs()),n("input-change"),ft(()=>Ir()),j==null||j.debugLog("__onVoiceResult: 文字插入成功")}catch(Xe){j==null||j.debugLog("__onVoiceResult: 插入异常 "+(Xe.message||String(Xe)))}},window.__onVoiceStatus=W=>{W==="listening"||W==="processing"||W==="initializing"?Ln.value=!0:W==="idle"?(Ln.value=!1,cr=0,Ui=0):W==="model_not_ready"&&(Rr.value="model_not_ready")},window.__onVoiceError=W=>{console.warn("[VoiceInput] 错误:",W),Ln.value=!1,cr=0,Ui=0},window.__onVoiceDownloadProgress=(W,j)=>{Rr.value="downloading",Sg.value=W,Uc.value=j,W>=100&&(Rr.value="ready")},window.__onVoiceModelReady=()=>{Rr.value="ready"})};if(typeof window<"u"){C_();const W=window.AndroidVoiceBridge;if(W&&typeof W.isModelReady=="function")try{Rr.value=W.isModelReady()?"ready":"model_not_ready"}catch{Rr.value="idle"}}const Fk=()=>typeof window>"u"?null:window.SpeechRecognition||window.webkitSpeechRecognition||null,Wc=()=>{if(bd.value){try{bd.value.stop()}catch(W){console.warn("[VoiceInput] recognition.stop() error:",W)}bd.value=null}Ln.value=!1,cr=0,Ui=0},Hk=()=>{const W=Fk();if(!W)return null;const j=new W;j.lang="zh-CN",j.continuous=!0,j.interimResults=!0,j.maxAlternatives=1;const ee=rs.value;return ee?cr=ee.state.selection.from:cr=0,Ui=0,j.onresult=Te=>{let Re="";for(let Cl=0;Clxt&&(Jt=Jt.delete(xt,Ot)),Jt=Jt.insertText(Re,xt);const Ta=Math.min(xt+Re.length,Jt.doc.content.size);Jt=Jt.setSelection(kt.create(Jt.doc,Ta)),Ye.dispatch(Jt),Ye.focus(),Ui=Re.length,n("update:input-message",fs()),n("input-change"),ft(()=>{Ir()})},j.onerror=Te=>{console.warn("[VoiceInput] onerror:",{error:Te.error,message:Te.message}),Te.error!=="aborted"&&(console.warn("[VoiceInput] stopping due to error:",Te.error),Wc())},j.onstart=()=>{},j.onaudiostart=()=>{},j.onsoundstart=()=>{},j.onspeechstart=()=>{},j.onspeechend=()=>{},j.onsoundend=()=>{},j.onaudioend=()=>{},j.onend=()=>{Ln.value=!1,bd.value=null,cr=0,Ui=0},j},T_=()=>{const W=window.AndroidVoiceBridge;if(W){if(Ln.value){W.stopListening();return}const ee=rs.value;cr=ee?ee.state.selection.from:0,Ui=0,W.startListening();return}if(Ln.value){Wc();return}const j=Hk();if(!j){console.warn("[VoiceInput] 浏览器不支持语音识别");return}try{j.start(),bd.value=j,Ln.value=!0}catch(ee){console.warn("[VoiceInput] 启动语音识别失败:",ee),Wc()}},jf=ge(null),bl=new Map,uo=[],ka=new Map,zc=new Map,jc=new Map,kg=new WeakMap,Vf=ge(!1);let Cg=!1,ur=null;const Tg=W=>j=>{W&&(j instanceof HTMLElement?bl.set(W,j):bl.delete(W))},_l=W=>{const j=Math.round(W.getBoundingClientRect().height);return j>0?j:W.offsetHeight>0?W.offsetHeight:34},Gf=()=>ke.value.map(W=>String((W==null?void 0:W.id)||"").trim()).filter(W=>!!W),Uk=()=>{Vf.value=!0,ur!==null&&window.clearTimeout(ur),ur=window.setTimeout(()=>{Vf.value=!1,ur=null,Ks()},YC+40)},wd=W=>{const j=kg.get(W);j&&(clearTimeout(j),kg.delete(W)),W.style.removeProperty("transition"),W.style.removeProperty("transform"),W.style.removeProperty("opacity")},Ag=(W,j,ee,Te,Re)=>{const Ve=()=>{W.style.removeProperty("transition"),j.forEach(Ue=>W.style.removeProperty(Ue)),Re==null||Re()};W.style.transition="none",Object.entries(ee).forEach(([Ue,Ye])=>{W.style.setProperty(Ue,Ye)}),requestAnimationFrame(()=>{W.style.transition=j.map(Ye=>`${Ye} ${YC}ms ${GZ}`).join(", "),Object.entries(Te).forEach(([Ye,Xe])=>{W.style.setProperty(Ye,Xe)});const Ue=window.setTimeout(Ve,YC+40);kg.set(W,Ue)})};let ho=[];oF(()=>{uo.splice(0,uo.length,...ho),ka.clear(),zc.clear(),ho.forEach(W=>{const j=bl.get(W);j!=null&&j.isConnected&&(ka.set(W,j.getBoundingClientRect()),zc.set(W,j))})}),PT(()=>{const W=jf.value,j=Gf();if(!Cg){Cg=!0,ho=[...j],uo.splice(0,uo.length),ka.clear(),zc.clear();return}Uk();const ee=new Set(uo),Te=new Set(j),Re=j.filter(Ue=>!ee.has(Ue)),Ve=uo.filter(Ue=>!Te.has(Ue));!Re.length&&!Ve.length||(Ve.forEach(Ue=>{const Ye=zc.get(Ue),Xe=ka.get(Ue);if(!Ye||!Xe||!(W!=null&&W.isConnected))return;wd(Ye);const xt=jc.get(Ue);xt&&(wd(xt),xt.remove(),jc.delete(Ue));const Ot=Ye.cloneNode(!0),Jt=W.getBoundingClientRect();Ot.style.position="absolute",Ot.style.left="0",Ot.style.top=`${Math.round(Xe.top-Jt.top)}px`,Ot.style.width=`${Math.round(Xe.width>0?Xe.width:Jt.width)}px`,Ot.style.pointerEvents="none",Ot.style.zIndex="0",Ot.style.margin="0",Ot.style.opacity="1",Ot.querySelectorAll("button").forEach(Cl=>{Cl instanceof HTMLButtonElement&&(Cl.disabled=!0)}),W.appendChild(Ot),jc.set(Ue,Ot);const Ta=_l(Ot);Ag(Ot,["transform"],{transform:"translateY(0)"},{transform:`translateY(${Ta}px)`},()=>{jc.delete(Ue),Ot.remove()}),bl.delete(Ue)}),j.forEach(Ue=>{const Ye=bl.get(Ue);if(!(Ye!=null&&Ye.isConnected))return;if(wd(Ye),Re.includes(Ue)){const Jt=_l(Ye);Ag(Ye,["transform"],{transform:`translateY(${Jt}px)`},{transform:"translateY(0)"});return}const Xe=ka.get(Ue);if(!Xe)return;const xt=Ye.getBoundingClientRect(),Ot=Xe.top-xt.top;Math.abs(Ot)<.5||Ag(Ye,["transform"],{transform:`translateY(${Ot}px)`},{transform:"translateY(0)"})}),uo.splice(0,uo.length),ka.clear(),zc.clear(),ho=[...j])});const A_=be(()=>{const W=!!(i.inputMessage||"").trim();if(i.streamingMessage)return W;const j=Array.isArray(i.selectedImages)&&i.selectedImages.length>0,ee=Array.isArray(i.selectedVideos)&&i.selectedVideos.length>0;return W||j||ee}),Wk=be(()=>!!i.streamingMessage&&!A_.value),Eg=be(()=>i.isConnected?i.streamingMessage?!1:i.inputLocked||i.mediaUploading?!0:!A_.value:!0),E_=be(()=>{const W=ke.value.length>0,j=Array.isArray(i.selectedImages)&&i.selectedImages.length>0,ee=Array.isArray(i.selectedVideos)&&i.selectedVideos.length>0,Te=Array.isArray(i.selectedFiles)&&i.selectedFiles.length>0;return W||st.value||gt.value||y.value||se.value||j||ee||Te||!!i.inputIsMultiline||!!i.goalModeArmed||!!i.goalRunning||Kf.value}),Kf=be(()=>{var W;return String(((W=i.goalProgress)==null?void 0:W.status)||"").toLowerCase()==="done"}),Mg=()=>{A.value=!0},xg=()=>{A.value=!1,Ks()},Sd=()=>{A.value=!1,Ks()},zk=be(()=>ke.value.length>0||Vf.value||yl.value||A.value),jk=()=>{const W=a.value,j=l.value;if(!W||!j)return 0;let ee=j.offsetTop,Te=j.offsetTop+j.offsetHeight;const Re=W.querySelector(".skill-slash-menu");if(Re instanceof HTMLElement){const Ue=Re.offsetTop,Ye=Re.offsetTop+Re.offsetHeight;return Math.max(0,Math.max(Te,Ye)-Math.min(ee,Ue))}return W.querySelectorAll(".runtime-queue-list:not(.runtime-queue-list--empty), .floating-status-row, .composer-avatar").forEach(Ue=>{Ue instanceof HTMLElement&&(Ue.classList.contains("floating-status-row")&&!st.value||Ue.classList.contains("composer-avatar")&&!gt.value||(ee=Math.min(ee,Ue.offsetTop),Te=Math.max(Te,Ue.offsetTop+Ue.offsetHeight)))}),Math.max(0,Te-ee)},M_=()=>{const W=l.value;return W?Math.max(0,W.getBoundingClientRect().height):0},Ks=()=>{const W=jk();if(!W)return;const j=M_();E_.value?h.value<=0&&j>0?h.value=j:h.value>0&&j>0?h.value=Math.min(h.value,j):h.value<=0&&(h.value=W):h.value=W;const ee=h.value||W,Te=Math.max(0,W-ee),Ve=Math.ceil(123+Te);n("composer-height-change",{reservedHeight:Ve,visualHeight:W,growth:Te})},Ir=()=>{var Ot;const W=(Ot=a.value)==null?void 0:Ot.querySelector(".stadium-input-editor");if(!W)return;const j=W,ee=j.scrollTop,Te=document.activeElement===j||j.contains(document.activeElement);j.style.height="auto";const Re=window.getComputedStyle(j),Ve=parseFloat(Re.lineHeight||"20")||20,Ue=Ve*10,Ye=Math.min(j.scrollHeight,Ue),Xe=Math.max(1,Math.round(Ye/Ve)),xt=Ye>Ve*1.4;ye(Xe,xt),j.style.height=`${Ye}px`,Vk(j,{previousScrollTop:ee,selectionShouldStayVisible:Te,padding:Math.max(4,Ve*.3)}),ft(()=>{Ks()})},Vk=(W,j)=>{const ee=Math.max(0,W.scrollHeight-W.clientHeight);if(ee<=0){W.scrollTop=0;return}if(!j.selectionShouldStayVisible){W.scrollTop=Math.min(ee,Math.max(0,j.previousScrollTop));return}requestAnimationFrame(()=>{const Te=rs.value;if(!Te){W.scrollTop=Math.min(ee,Math.max(0,j.previousScrollTop));return}try{const Re=Te.view.coordsAtPos(Te.state.selection.head),Ve=W.getBoundingClientRect(),Ue=j.padding,Ye=Math.max(0,W.scrollHeight-W.clientHeight);let Xe=W.scrollTop;Re.bottom>Ve.bottom-Ue?Xe+=Re.bottom-Ve.bottom+Ue:Re.top{const ee=Ko(),Te=rs.value;if(!Te||!ee)return;const Re=Te.schema.nodes.mention;if(!Re)return;const Ve=Re.create({id:`file://${W}`,label:j}),{state:Ue,view:Ye}=Te;let Xe=Ue.tr.delete(ee.start,ee.end);Xe=Xe.insert(ee.start,Ve);const xt=ee.start+Ve.nodeSize;Xe=Xe.insertText(" ",xt),Xe=Xe.setSelection(kt.near(Xe.doc.resolve(xt+1))),Ye.dispatch(Xe),Ye.focus(),Pn(),ft(()=>{Ir()})},Gk=async W=>{var Te;const j=W.target,ee=(j==null?void 0:j.files)||null;if(X.value&&ee&&ee.length>0){X.value=!1;const Re=ee[0];try{const Ue=await(await fetch(`/api/project/files/search?q=${encodeURIComponent(Re.name)}&limit=10`)).json().catch(()=>({})),Ye=Array.isArray((Te=Ue==null?void 0:Ue.data)==null?void 0:Te.items)?Ue.data.items:[],Xe=Ye.find(xt=>xt.name===Re.name)||Ye[0];Xe?lo(Xe):x_(Re.name,Re.name)}catch(Ve){console.warn("[FileAt] 通过文件选择器查找路径失败:",Ve),x_(Re.name,Re.name)}j&&(j.value="");return}n("file-selected",ee),j&&(j.value="")},Kk=()=>{var W;return Es((W=rs.value)==null?void 0:W.getJSON())},Vc=()=>{var W,j;return{editor_json:((W=rs.value)==null?void 0:W.getJSON())||null,skill_refs:Es((j=rs.value)==null?void 0:j.getJSON()).skillRefs}},wl=W=>{const j=rs.value;j&&W!=null&&W.editor_json&&typeof W.editor_json=="object"&&(Oe=!0,j.commands.setContent(W.editor_json),Oe=!1,n("update:input-message",fs()),ft(Ir))},qf=()=>{!i.isConnected||i.uploading||n("quick-upload")},qk=be(()=>{lt.value;const W=(i.permissionOptions||[]).find(j=>j.value===i.currentPermissionMode);return W?S(W.labelKey):i.currentPermissionMode}),R_=be(()=>(lt.value,[{value:"agent",label:S("input.agentType"),description:S("input.agentTypeDesc")},{value:"multi_agent",label:S("input.multiAgentType"),description:S("input.multiAgentTypeDesc")}])),kd=be(()=>!!i.currentConversationId),I_=be(()=>(lt.value,i.currentConversationId?i.currentConversationType==="multi_agent"?S("input.multiAgentType"):S("input.agentType"):i.newConversationType==="multi_agent"?S("input.multiAgentType"):S("input.agentType"))),Cd=be(()=>!!i.streamingMessage),z=be(()=>{lt.value;const W=(i.workModeOptions||[]).find(j=>j.value===i.currentWorkMode);return W?S(W.labelKey):i.currentWorkMode||S("input.workModePlanFallback")}),ie=be(()=>i.currentWorkMode==="plan"),te=be(()=>i.currentPermissionMode!=="unrestricted"),de=be(()=>ie.value||te.value),Ee=ge(null),fe=ge(null),Qe=ge(!1),vt=ge("0px");async function Pt(){if(Qe.value=!1,!i.permissionMenuOpen||!window.matchMedia("(max-width: 768px)").matches)return;await ft();const W=Ee.value,j=fe.value;if(!W||!j)return;const ee=W.getBoundingClientRect(),Te=j.offsetWidth;if(ee.right-Te<8){const Ve=(window.innerWidth-Te)/2-ee.left;vt.value=`${Math.round(Ve)}px`,Qe.value=!0}}function Lt(){i.permissionMenuOpen&&Pt()}Ke(()=>i.permissionMenuOpen,W=>{W&&Pt()});const Bs=be(()=>{lt.value;const W=String(i.currentExecutionMode||"");return W==="direct"?S("input.executionFullAccess"):W==="sandbox"?S("input.executionSandbox"):W}),Fs=be(()=>{const j=(Array.isArray(i.modelOptions)?i.modelOptions:[]).find(ee=>ee.key===i.currentModelKey);return Number((j==null?void 0:j.contextWindow)||0)}),fo=be(()=>{var W;return!!((W=o==null?void 0:o.form)!=null&&W.auto_deep_compress_enabled)}),Jo=be(()=>{var j;const W=Number(((j=o==null?void 0:o.form)==null?void 0:j.deep_compress_trigger_tokens)||0);return W>0?W:15e4}),Sl=be(()=>fo.value?Jo.value:Fs.value>0?Fs.value:0),Ca=be(()=>{const W=Number(Sl.value||0);if(W<=0)return 0;const j=Math.max(0,Number(i.currentContextTokens||0));return Math.max(0,Math.min(100,j/W*100))}),kl=be(()=>`${Math.round(Ca.value)}%`),po=be(()=>{const W=Ca.value;return W<40?"var(--state-success)":W<=80?"var(--state-warning)":"var(--state-danger)"}),Rg=W=>{const j=Math.max(0,Number(W||0));if(j>=1e3){const ee=j/1e3;return`${ee>=100?Math.round(ee).toString():ee.toFixed(1).replace(/\.0$/,"")}k`}return`${Math.round(j)}`},P_=be(()=>{const W=Rg(i.currentContextTokens||0),j=Number(Sl.value||0);return j<=0?`${W}/--`:`${W}/${Rg(j)}`});return e({inputAreaRoot:a,stadiumShellOuter:c,compactInputShell:l,stadiumInput:u,fileUploadInput:d,emitComposerHeight:Ks,prepareMessageForSend:Kk,getComposerDraftMeta:Vc,restoreComposerDraftMeta:wl}),Ke(()=>i.inputMessage,async()=>{const W=rs.value;W&&!Oe&&fs()!==(i.inputMessage||"")&&(Oe=!0,W.commands.setContent(mi(i.inputMessage||"")),Oe=!1),await ft(),Ir(),Me()}),Ke(()=>i.isConnected,async W=>{var j,ee;(j=rs.value)==null||j.setEditable(!!W&&!i.inputLocked),W||(ee=rs.value)==null||ee.commands.blur(),await ft(),Ir()}),Ke(()=>i.inputLocked,W=>{var j;(j=rs.value)==null||j.setEditable(i.isConnected&&!W)}),Ke(()=>i.currentConversationId,async()=>{h.value=0,await ft(),Ks()}),Ke(()=>i.runtimeQueuedMessages,async()=>{await ft(),Ks()},{deep:!0}),Ke(()=>i.projectGitSummary,async()=>{Le.value||Qt(),await ft(),Ks()},{deep:!0}),Ke(st,async()=>{await ft(),Ks(),window.setTimeout(()=>{Ks()},280)}),Ke(gt,async()=>{await ft(),Ks(),window.setTimeout(()=>{Ks()},280)}),Ke(()=>{var W;return(W=i.avatarStatus)==null?void 0:W.mode},()=>{var W;((W=i.avatarStatus)==null?void 0:W.mode)!=="idle"&&qo()}),Ke(()=>{var W,j;return[((W=i.selectedImages)==null?void 0:W.length)||0,((j=i.selectedVideos)==null?void 0:j.length)||0]},async()=>{await ft(),Ks()}),Ke(zk,async()=>{await ft(),Ks()}),Ke(()=>i.streamingMessage||i.inputLocked,W=>{W&&Ln.value&&Wc()}),dn(()=>{document.addEventListener("click",Qt),window.addEventListener("resize",Lt),Ir(),ft(()=>{Ks(),typeof ResizeObserver<"u"&&(rt=new ResizeObserver(()=>{Ks()}),a.value&&rt.observe(a.value),c.value&&rt.observe(c.value),l.value&&rt.observe(l.value))})}),Rn(()=>{var W;Wc(),document.removeEventListener("click",Qt),window.removeEventListener("resize",Lt),(W=rs.value)==null||W.destroy(),bl.forEach(j=>{j&&wd(j)}),jc.forEach(j=>{wd(j),j.remove()}),jc.clear(),bl.clear(),uo.splice(0,uo.length),ka.clear(),zc.clear(),Cg=!1,ho=[],ur!==null&&(window.clearTimeout(ur),ur=null),Vf.value=!1,rt&&(rt.disconnect(),rt=null),qo()}),(W,j)=>(F(),U("div",{class:"input-area compact-input-area",ref_key:"inputAreaRoot",ref:a},[M("div",{class:"stadium-input-wrapper",ref_key:"stadiumShellOuter",ref:c},[M("div",{class:Ce(["runtime-queue-list",{"runtime-queue-list--empty":!ke.value.length}]),ref_key:"runtimeQueueList",ref:jf},[(F(!0),U(Ie,null,Ze(ke.value,(ee,Te)=>(F(),U("div",{key:ee.id,class:Ce(["runtime-queue-item",{"runtime-queue-item--top":Te===0}]),"data-runtime-queue-id":ee.id||"",ref_for:!0,ref:Tg(ee.id)},[M("span",BJ,Q(ee.text||""),1),M("button",{type:"button",class:"runtime-queue-item__action",onClick:De(Re=>W.$emit("guide-runtime-message",ee.id),["stop"])},Q(W.$t("input.guide")),9,FJ),M("button",{type:"button",class:"runtime-queue-item__action runtime-queue-item__action--danger",onClick:De(Re=>W.$emit("delete-runtime-message",ee.id),["stop"])},Q(W.$t("common.delete")),9,HJ)],10,$J))),128))],2),We(gs,{name:"skill-slash-menu-motion",onBeforeEnter:Mg,onBeforeLeave:Mg,onAfterEnter:xg,onAfterLeave:Sd},{default:Gt(()=>[yl.value?(F(),U("div",{key:w.value,class:"skill-slash-menu-wrapper",role:"listbox","aria-label":Hi.value},[M("div",{ref_key:"skillSlashList",ref:k,class:"skill-slash-menu",onScroll:at},[(F(!0),U(Ie,null,Ze(mn.value,(ee,Te)=>(F(),U("button",{key:ee.id,type:"button",class:Ce(["skill-slash-item",{"skill-slash-item--active":Te===b.value&&!E.value,"skill-slash-item--disabled":ee.disabled}]),role:"option","aria-selected":Te===b.value,disabled:ee.disabled,onMousedown:De(Re=>Bt(Te),["prevent"])},[M("span",zJ,Q(ee.label),1),M("span",jJ,Q(ee.description),1)],42,WJ))),128)),mn.value.length?me("",!0):(F(),U("div",VJ,Q(Sa.value),1))],544),M("div",{class:"skill-slash-menu__highlight",style:qe(Pe.value)},null,4)],8,UJ)):me("",!0)]),_:1}),We(TJ,{ref_key:"fileAtMenuRef",ref:K,visible:se.value,items:le.value,"active-index":ve.value,loading:ue.value,"host-mode":!!i.hostMode,"menu-style":P.value,onSelect:Ni,onHover:j[0]||(j[0]=ee=>ve.value=ee)},null,8,["visible","items","active-index","loading","host-mode","menu-style"]),We(gs,{name:"floating-status-motion"},{default:Gt(()=>[gt.value?(F(),U("div",{key:0,class:"composer-avatar",onClick:De(Yn,["stop"])},[We(GD,{mode:i.avatarStatus.mode,"tool-keys":i.avatarStatus.toolKeys||[],tracking:i.avatarStatus.tracking!==!1,size:45,"hex-background":""},null,8,["mode","tool-keys","tracking"]),We(gs,{name:"composer-avatar-text-fade",mode:"out-in"},{default:Gt(()=>[ne.value?(F(),U("span",{key:`poke-${ne.value}`,class:Ce(["composer-avatar__text",{"composer-avatar__text--right":!st.value,"composer-avatar__text--top":st.value}])},Q(ne.value),3)):Wt.value?(F(),U("span",{key:jt.value,class:Ce(["composer-avatar__text",{"composer-avatar__text--right":!st.value,"composer-avatar__text--top":st.value}])},Q(Wt.value),3)):me("",!0)]),_:1})])):me("",!0)]),_:1}),We(gs,{name:"floating-status-motion"},{default:Gt(()=>[st.value?(F(),U("div",{key:0,class:"floating-status-row",onClick:j[11]||(j[11]=De(()=>{},["stop"]))},[M("div",{class:"floating-project-status",onClick:j[10]||(j[10]=De(()=>{},["stop"]))},[Le.value?(F(),U("span",GJ,[M("span",KJ,[M("button",{type:"button",class:Ce(["floating-project-status__button floating-project-status__button--project",{"floating-project-status__button--active":ht.value==="project"}]),onClick:j[1]||(j[1]=De(ee=>It("project"),["stop"]))},Q(Le.value.projectName),3),ht.value==="project"?(F(),U("div",{key:0,class:"floating-project-status__submenu floating-project-status__submenu--project",onClick:j[2]||(j[2]=De(()=>{},["stop"]))},[M("button",{type:"button",onClick:De(Er,["stop"])},Q(W.$t("input.openInFileManager")),1),M("button",{type:"button",onClick:De(ot,["stop"])},Q(W.$t("input.copyPath")),1)])):me("",!0)]),M("span",qJ,[M("button",{type:"button",class:Ce(["floating-project-status__button floating-project-status__button--branch",{"floating-project-status__button--active":ht.value==="branch"}]),onClick:j[3]||(j[3]=De(ee=>It("branch"),["stop"]))},Q(Le.value.branch),3),ht.value==="branch"?(F(),U("div",{key:0,class:"floating-project-status__submenu floating-project-status__submenu--branch",onClick:j[4]||(j[4]=De(()=>{},["stop"]))},[M("button",{type:"button",onClick:De($s,["stop"])},Q(W.$t("input.copyBranchName")),1)])):me("",!0)])])):me("",!0),M("span",QJ,[s.goalRunning?(F(),U("span",XJ,Q(W.$t("input.goalModeRunning")),1)):s.goalModeArmed?(F(),U("span",YJ,Q(W.$t("input.goalModeReady")),1)):me("",!0),s.pendingUserQuestionCount>0?(F(),U("button",{key:2,type:"button",class:"floating-project-status__notice floating-project-status__notice--button",onClick:j[5]||(j[5]=De(ee=>W.$emit("restore-user-question"),["stop"]))},Q(W.$t("input.waitingForQuestion")),1)):me("",!0),s.planApprovalMinimized&&(s.pendingPlanApprovalCount||0)>0?(F(),U("button",{key:3,type:"button",class:"floating-project-status__notice floating-project-status__notice--button",onClick:j[6]||(j[6]=De(ee=>W.$emit("restore-plan-approval"),["stop"]))},Q(W.$t("input.planApprovalPending")),1)):me("",!0),(s.activeSubAgentCount||0)>0?(F(),U("button",{key:4,type:"button",class:"floating-project-status__notice floating-project-status__notice--button",onClick:j[7]||(j[7]=De(ee=>W.$emit("stop-all-sub-agents"),["stop"]))},Q(W.$t("input.subAgentsRunning",{n:s.activeSubAgentCount})),1)):me("",!0),s.terminalCount>0?(F(),U("button",{key:5,type:"button",class:"floating-project-status__terminal",onClick:j[8]||(j[8]=De(ee=>W.$emit("realtime-terminal"),["stop"]))},Q(W.$t("input.terminalsRunning",{n:s.terminalCount})),1)):me("",!0),Le.value?(F(),U("button",{key:6,type:"button",class:"floating-project-status__stats",onClick:j[9]||(j[9]=De(ee=>W.$emit("open-git-changes-panel"),["stop"]))},[M("span",JJ,[j[42]||(j[42]=cn("+",-1)),We(cI,{value:Le.value.additions},null,8,["value"])]),M("span",ZJ,[j[43]||(j[43]=cn("-",-1)),We(cI,{value:Le.value.deletions},null,8,["value"])])])):me("",!0)])])])):me("",!0)]),_:1}),M("div",{class:Ce(["stadium-shell",{"is-multiline":s.inputIsMultiline,"is-focused":s.inputIsFocused,"has-text":(s.inputMessage||"").trim().length>0}]),ref_key:"compactInputShell",ref:l},[M("input",{type:"file",ref_key:"fileUploadInput",ref:d,class:"file-input-hidden",multiple:"",onChange:Gk},null,544),M("div",eZ,[s.selectedImages&&s.selectedImages.length||s.selectedFiles&&s.selectedFiles.length?(F(),U("div",tZ,[(F(!0),U(Ie,null,Ze(s.selectedImages,ee=>(F(),U("div",{class:"image-thumbnail-wrapper",key:ee,onClick:De(Te=>pe(ee),["stop"])},[M("img",{src:he(ee),alt:xe(ee),class:"image-thumbnail"},null,8,nZ),M("button",{type:"button",class:"image-remove-btn-hover",onClick:De(Te=>W.$emit("remove-image",ee),["stop"])},[...j[44]||(j[44]=[M("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none","aria-hidden":"true"},[M("path",{d:"M2.5 2.5l5 5M7.5 2.5l-5 5",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"})],-1)])],8,iZ)],8,sZ))),128)),s.selectedFiles&&s.selectedFiles.length?(F(),Ft(AL,{key:0,files:s.selectedFiles,removable:"",onRemove:j[12]||(j[12]=ee=>W.$emit("remove-file",ee))},null,8,["files"])):me("",!0)])):me("",!0),s.selectedVideos&&s.selectedVideos.length?(F(),U("div",rZ,[(F(!0),U(Ie,null,Ze(s.selectedVideos,ee=>(F(),U("div",{class:"image-thumbnail-wrapper",key:ee},[M("img",{src:he(ee),alt:xe(ee),class:"image-thumbnail"},null,8,oZ),M("button",{type:"button",class:"image-remove-btn-hover",onClick:De(Te=>W.$emit("remove-video",ee),["stop"])},[...j[45]||(j[45]=[M("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none","aria-hidden":"true"},[M("path",{d:"M2.5 2.5l5 5M7.5 2.5l-5 5",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"})],-1)])],8,aZ)]))),128))])):me("",!0),M("div",lZ,[M("div",cZ,[We(Ne(KQ),{editor:Ne(rs),class:Ce(["stadium-input stadium-input-tiptap",{"is-disabled":!s.isConnected||s.inputLocked}]),onFocusin:j[13]||(j[13]=ee=>W.$emit("input-focus")),onFocusout:Cs},null,8,["editor","class"])])]),M("div",uZ,[M("div",dZ,[M("button",{type:"button",class:"stadium-btn add-btn","data-tutorial":"quick-menu-open",onClick:j[14]||(j[14]=De(ee=>W.$emit("toggle-quick-menu"),["stop"])),disabled:!s.isConnected,"aria-label":W.$t("input.quickMenuAriaLabel")},[...j[46]||(j[46]=[M("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},[M("path",{d:"M5 12h14"}),M("path",{d:"M12 5v14"})],-1)])],8,hZ),M("div",{class:Ce(["agent-type-switcher",{"is-disabled":kd.value}])},[M("button",{type:"button",class:"agent-type-switcher__btn",onClick:j[15]||(j[15]=De(ee=>W.$emit("toggle-agent-type-menu"),["stop"])),disabled:!s.isConnected||kd.value,"aria-expanded":s.agentTypeMenuOpen,"aria-haspopup":"true"},[M("span",null,Q(I_.value),1),M("span",{class:Ce(["agent-type-switcher__caret",{open:s.agentTypeMenuOpen}]),"aria-hidden":"true"},"›",2)],8,fZ),s.agentTypeMenuOpen&&!kd.value?(F(),U("div",{key:0,class:"agent-type-switcher__menu",onClick:j[16]||(j[16]=De(()=>{},["stop"]))},[(F(!0),U(Ie,null,Ze(R_.value,ee=>(F(),U("button",{key:ee.value,type:"button",class:Ce(["agent-type-switcher__menu-item",{"is-active":ee.value===s.newConversationType}]),onClick:De(Te=>W.$emit("select-new-conversation-type",ee.value),["stop"])},[M("span",mZ,Q(ee.label),1),M("span",gZ,Q(ee.description),1)],10,pZ))),128))])):me("",!0)],2),M("div",{class:Ce(["agent-type-switcher work-mode-switcher",{"is-disabled":Cd.value}])},[M("button",{type:"button",class:"agent-type-switcher__btn",onClick:j[17]||(j[17]=De(ee=>W.$emit("toggle-work-mode-menu"),["stop"])),disabled:!s.isConnected||Cd.value,"aria-expanded":s.workModeMenuOpen,"aria-haspopup":"true",title:Cd.value?W.$t("input.workModeLockedTitle"):W.$t("input.workModeTitle")},[M("span",null,Q(z.value),1),M("span",{class:Ce(["agent-type-switcher__caret",{open:s.workModeMenuOpen}]),"aria-hidden":"true"},"›",2)],8,vZ),s.workModeMenuOpen&&!Cd.value?(F(),U("div",{key:0,class:"agent-type-switcher__menu",onClick:j[18]||(j[18]=De(()=>{},["stop"]))},[(F(!0),U(Ie,null,Ze(s.workModeOptions,ee=>(F(),U("button",{key:ee.value,type:"button",class:Ce(["agent-type-switcher__menu-item",{"is-active":ee.value===s.currentWorkMode}]),onClick:De(Te=>W.$emit("change-work-mode",ee.value),["stop"])},[M("span",bZ,Q(W.$t(ee.labelKey)),1),M("span",_Z,Q(W.$t(ee.descriptionKey)),1)],10,yZ))),128))])):me("",!0)],2)]),M("div",wZ,[_d.value?(F(),U("button",{key:0,type:"button",class:Ce(["stadium-btn voice-btn",{"voice-btn--recording":Ln.value,"voice-btn--disabled":Rr.value==="downloading"||Rr.value==="model_not_ready"}]),onClick:T_,disabled:!s.isConnected||s.inputLocked,title:k_.value},[Ln.value?(F(),U("div",CZ,[...j[48]||(j[48]=[M("span",{class:"voice-wave-bar"},null,-1),M("span",{class:"voice-wave-bar"},null,-1),M("span",{class:"voice-wave-bar"},null,-1),M("span",{class:"voice-wave-bar"},null,-1)])])):(F(),U("svg",kZ,[...j[47]||(j[47]=[M("path",{d:"M12 19v3m7-12v2a7 7 0 0 1-14 0v-2"},null,-1),M("rect",{width:"6",height:"13",x:"9",y:"2",rx:"3"},null,-1)])]))],10,SZ)):me("",!0),M("button",{type:"button",class:"stadium-btn send-btn",onClick:j[19]||(j[19]=ee=>W.$emit("send-or-stop")),disabled:Eg.value},[Wk.value?(F(),U("span",AZ)):(F(),U("span",EZ))],8,TZ)])])])],2),We(WL,{open:s.quickMenuOpen,"is-connected":s.isConnected,uploading:s.uploading,"streaming-message":s.streamingMessage,"thinking-mode":s.thinkingMode,"run-mode":s.runMode,"model-menu-open":s.modelMenuOpen,"model-options":s.modelOptions,"current-model-key":s.currentModelKey,"tool-menu-open":s.toolMenuOpen,"tool-settings":s.toolSettings,"tool-settings-loading":s.toolSettingsLoading,"settings-open":s.settingsOpen,"mode-menu-open":s.modeMenuOpen,compressing:s.compressing,"current-conversation-id":s.currentConversationId,"icon-style":s.iconStyle,"tool-category-icon":s.toolCategoryIcon,"block-upload":s.blockUpload,"block-tool-toggle":s.blockToolToggle,"block-realtime-terminal":s.blockRealtimeTerminal,"block-focus-panel":s.blockFocusPanel,"block-token-panel":s.blockTokenPanel,"block-compress-conversation":s.blockCompressConversation,"block-conversation-review":s.blockConversationReview,"execution-mode-enabled":s.executionModeEnabled,"goal-mode-armed":s.goalModeArmed,"goal-running":s.goalRunning,onQuickUpload:qf,onPickImages:j[20]||(j[20]=ee=>W.$emit("pick-images")),onPickVideo:j[21]||(j[21]=ee=>W.$emit("pick-video")),onToggleToolMenu:j[22]||(j[22]=ee=>W.$emit("toggle-tool-menu")),onToggleSettings:j[23]||(j[23]=ee=>W.$emit("toggle-settings")),onToggleModeMenu:j[24]||(j[24]=ee=>W.$emit("toggle-mode-menu")),onSelectRunMode:j[25]||(j[25]=ee=>W.$emit("select-run-mode",ee)),onToggleModelMenu:j[26]||(j[26]=ee=>W.$emit("toggle-model-menu")),onSelectModel:j[27]||(j[27]=ee=>W.$emit("select-model",ee)),onUpdateToolCategory:j[28]||(j[28]=(ee,Te)=>W.$emit("update-tool-category",ee,Te)),onRealtimeTerminal:j[29]||(j[29]=ee=>W.$emit("realtime-terminal")),onToggleFocusPanel:j[30]||(j[30]=ee=>W.$emit("toggle-focus-panel")),onToggleTokenPanel:j[31]||(j[31]=ee=>W.$emit("toggle-token-panel",ee)),onCompressConversation:j[32]||(j[32]=ee=>W.$emit("compress-conversation")),onToggleApprovalPanel:j[33]||(j[33]=ee=>W.$emit("toggle-approval-panel")),onOpenReview:j[34]||(j[34]=ee=>W.$emit("open-review")),onOpenPathAuthorization:j[35]||(j[35]=ee=>W.$emit("open-path-authorization")),onToggleGoalMode:j[36]||(j[36]=ee=>W.$emit("toggle-goal-mode"))},null,8,["open","is-connected","uploading","streaming-message","thinking-mode","run-mode","model-menu-open","model-options","current-model-key","tool-menu-open","tool-settings","tool-settings-loading","settings-open","mode-menu-open","compressing","current-conversation-id","icon-style","tool-category-icon","block-upload","block-tool-toggle","block-realtime-terminal","block-focus-panel","block-token-panel","block-compress-conversation","block-conversation-review","execution-mode-enabled","goal-mode-armed","goal-running"]),M("div",{class:"permission-switcher",onClick:j[39]||(j[39]=De(()=>{},["stop"]))},[M("button",{type:"button",class:"permission-switcher__btn",disabled:!s.isConnected||s.streamingMessage,onClick:j[37]||(j[37]=ee=>W.$emit("open-versioning-dialog"))},[M("span",null,Q(W.$t("input.versionControl")),1)],8,MZ),M("div",{ref_key:"permissionBlockEl",ref:Ee,class:"permission-switcher__block"},[M("button",{type:"button",class:"permission-switcher__btn",disabled:!s.isConnected,title:ie.value?W.$t("input.permissionLockedByPlanTitle"):te.value?W.$t("input.executionLockedRestrictedTitle"):"",onClick:j[38]||(j[38]=ee=>W.$emit("toggle-permission-menu"))},[ie.value||te.value?(F(),U("svg",RZ,[...j[49]||(j[49]=[M("rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"},null,-1),M("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"},null,-1)])])):me("",!0),M("span",null,Q(qk.value),1),s.executionModeEnabled?(F(),U("span",{key:1,class:Ce(["permission-switcher__exec",{"permission-switcher__exec--warn":s.currentExecutionMode==="direct"}])},Q(Bs.value),3)):me("",!0),M("span",{class:Ce(["permission-switcher__caret",{open:s.permissionMenuOpen}])},"›",2)],8,xZ),s.permissionMenuOpen?(F(),U("div",{key:0,ref_key:"permissionMenuEl",ref:fe,class:Ce(["permission-switcher__menu",{"permission-switcher__menu--split":s.executionModeEnabled,"permission-switcher__menu--centered":Qe.value}]),style:qe(Qe.value?{left:vt.value,right:"auto"}:void 0)},[M("div",{class:Ce(["permission-switcher__group",{"permission-switcher__group--disabled":ie.value}])},[M("div",IZ,[cn(Q(W.$t("input.permissionGroup")),1),ie.value?(F(),U("span",PZ,Q(W.$t("input.planModeLocked")),1)):me("",!0)]),(F(!0),U(Ie,null,Ze(s.permissionOptions,ee=>(F(),U("button",{key:`permission-${ee.value}`,type:"button",class:Ce(["permission-switcher__item",{active:ee.value===s.currentPermissionMode}]),disabled:ie.value,onClick:Te=>W.$emit("change-permission-mode",ee.value)},[M("span",OZ,Q(W.$t(ee.labelKey)),1),M("span",DZ,Q(W.$t(ee.descriptionKey)),1)],10,LZ))),128))],2),s.executionModeEnabled?(F(),U("div",{key:0,class:Ce(["permission-switcher__group",{"permission-switcher__group--disabled":de.value}])},[M("div",NZ,[cn(Q(W.$t("input.executionEnv"))+" ",1),ie.value?(F(),U("span",$Z,Q(W.$t("input.planModeLocked")),1)):te.value?(F(),U("span",BZ,Q(W.$t("input.restrictedModeLocked")),1)):me("",!0)]),(F(!0),U(Ie,null,Ze(s.executionModeOptions,ee=>(F(),U("button",{key:`execution-${ee.value}`,type:"button",class:Ce(["permission-switcher__item",{active:ee.value===s.currentExecutionMode}]),disabled:de.value,onClick:Te=>W.$emit("change-execution-mode",ee.value)},[M("span",{class:Ce(["permission-switcher__item-label",{"permission-switcher__item-label--warn":ee.value==="direct"}])},Q(W.$t(ee.labelKey)),3),M("span",HZ,Q(W.$t(ee.descriptionKey)),1)],10,FZ))),128))],2)):me("",!0),s.networkPermissionEnabled?(F(),U("div",{key:1,class:Ce(["permission-switcher__group",{"permission-switcher__group--disabled":s.currentExecutionMode==="direct"}])},[M("div",UZ,Q(W.$t("input.networkPermission")),1),(F(!0),U(Ie,null,Ze(s.networkPermissionOptions,ee=>(F(),U("button",{key:`network-${ee.value}`,type:"button",class:Ce(["permission-switcher__item",{active:ee.value===s.currentNetworkPermission}]),disabled:s.currentExecutionMode==="direct",onClick:Te=>W.$emit("change-network-permission",ee.value)},[M("span",{class:Ce(["permission-switcher__item-label",{"permission-switcher__item-label--warn":ee.value==="full"}])},Q(W.$t(ee.labelKey)),3),M("span",zZ,Q(W.$t(ee.descriptionKey)),1)],10,WZ))),128))],2)):me("",!0)],6)):me("",!0)],512)]),M("div",{class:"context-usage-switcher",onClick:j[41]||(j[41]=De(()=>{},["stop"]))},[M("button",{type:"button",class:"context-usage-switcher__btn",disabled:!s.isConnected,onClick:j[40]||(j[40]=ee=>W.$emit("toggle-token-panel"))},[M("span",{class:"context-usage-ring",style:qe({"--context-progress":`${Ca.value}%`,"--context-ring-color":po.value}),"aria-hidden":"true"},[...j[50]||(j[50]=[M("span",{class:"context-usage-ring__inner"},null,-1)])],4)],8,jZ),M("div",VZ,[M("div",null,Q(W.$t("input.usedPercent",{n:kl.value})),1),M("div",null,Q(P_.value),1)])])],512)],512))}}),qZ=qt(KZ,[["__scopeId","data-v-e9e814be"]]),QZ={class:"effort-header"},XZ={class:"header-state header-idle"},YZ={class:"header-title"},JZ={class:"default-label"},ZZ={class:"header-state header-drag"},eee={class:"slider-zone"},tee={class:"level-labels"},go=20,see=200,nee=ct({__name:"EffortSlider",props:{modelValue:{}},emits:["update:modelValue"],setup(s,{emit:e}){const t=["low","medium","high","xhigh","max"],n=s,i=e,r=ge(null),o=ge(null),a=ge(null),c=[],l=(L,K)=>{c[K]=L??null},u=ge(0),d=ge(2),h=ge(2),p=ge(!1),g=ge(!1);let v=0,m=0,y=0;const _=be(()=>n.modelValue===null),b=L=>L/(t.length-1),k=L=>`calc(${go}px + (100% - ${go*2}px) * ${b(L)})`,w=L=>go+(u.value-go*2)*b(L),T=L=>{const K=u.value;if(K<=go*2)return 0;const se=(L-go)/(K-go*2);return Math.max(0,Math.min(t.length-1,Math.round(se*(t.length-1))))},A=L=>{const K=r.value;if(!K)return go;const se=K.getBoundingClientRect(),oe=L-se.left;return Math.max(go,Math.min(se.width-go,oe))},C=L=>L<.5?2*L*L:1-(-2*L+2)**2/2,E=L=>{const K=u.value>go*2,se=K?`${L}px`:k(d.value),oe=o.value;oe&&(oe.style.transform=`translate(calc(${se} - 50%), -50%)`);const ve=a.value;ve&&(ve.style.clipPath=`inset(0 calc(100% - (${se})) 0 0 round 17px)`);for(let le=0;le{m&&(cancelAnimationFrame(m),m=0)},D=L=>{x(),y=L,E(L)},N=L=>{const K=y;if(K===L)return;x();const se=performance.now(),oe=ve=>{const le=Math.min(1,(ve-se)/see);y=K+(L-K)*C(le),E(y),le<1?m=requestAnimationFrame(oe):m=0};m=requestAnimationFrame(oe)},O=(L=!1)=>{const K=w(d.value);h.value=d.value,L&&u.value>go*2?N(K):D(K)},G=()=>{i("update:modelValue",t[d.value])},Z=L=>{var K;p.value=!0,g.value=!1,v=L.clientX,(K=r.value)==null||K.setPointerCapture(L.pointerId),d.value=T(A(L.clientX)),G(),O(!0)},q=L=>{if(p.value&&(!g.value&&Math.abs(L.clientX-v)>3&&(g.value=!0),g.value)){const K=A(L.clientX);x(),y=K,E(K),h.value=T(K)}},V=L=>{if(p.value){if(p.value=!1,g.value){g.value=!1,d.value=T(A(L.clientX)),G(),O(!0);return}O(!0)}},I=()=>{i("update:modelValue",_.value?t[d.value]:null)},$=()=>{var L;u.value=((L=r.value)==null?void 0:L.clientWidth)??0,O()};return Ke(()=>n.modelValue,L=>{if(L===null)return;const K=t.indexOf(L);K<0||K===d.value||(d.value=K,O(!1))},{immediate:!0}),dn(()=>{$(),window.addEventListener("resize",$)}),Rn(()=>{x(),window.removeEventListener("resize",$)}),(L,K)=>(F(),U("div",{class:Ce(["effort-slider",{"is-default":_.value,"live-drag":g.value}])},[M("div",QZ,[M("div",XZ,[M("span",YZ,Q(L.$t("quickdock.effortTitle")),1),M("span",{class:Ce(["default-toggle",{checked:_.value}]),onClick:De(I,["stop"])},[M("span",JZ,Q(L.$t("quickdock.effortDefault")),1),We(mF,{checked:_.value,size:14},null,8,["checked"])],2)]),M("div",ZZ,[M("span",null,Q(L.$t("quickdock.effortMoreEfficient")),1),M("span",null,Q(L.$t("quickdock.effortMoreIntelligent")),1)])]),M("div",eee,[M("div",{ref_key:"trackRef",ref:r,class:"track",onPointerdown:Z,onPointermove:q,onPointerup:V,onPointercancel:V},[M("div",{ref_key:"fillRef",ref:a,class:"fill-stack"},[(F(),U(Ie,null,Ze(t,(se,oe)=>M("div",{key:`lv-${oe}`,class:Ce(["fill-layer",[`lv-${oe}`,{on:oe===h.value}]])},null,2)),64))],512),(F(),U(Ie,null,Ze(t,(se,oe)=>M("div",{key:`dot-${oe}`,class:"dot",ref_for:!0,ref:ve=>l(ve,oe),style:qe({left:k(oe)})},null,4)),64)),M("div",{ref_key:"knobRef",ref:o,class:"knob"},null,512)],544),M("div",tee,[(F(),U(Ie,null,Ze(t,(se,oe)=>M("span",{key:`label-${oe}`,class:Ce(["level-label",{active:oe===h.value}]),style:qe({left:k(oe)})},Q(se),7)),64))])])],2))}}),iee=qt(nee,[["__scopeId","data-v-c614d0e4"]]),ree={class:"confirm-modal"},oee={class:"confirm-title"},aee={class:"confirm-message"},lee={key:0,class:"confirm-warning"},cee=ct({__name:"ConfirmDialog",setup(s){const e=Is(),{confirmDialog:t}=xi(e),n=i=>e.resolveConfirm(i);return(i,r)=>(F(),Ft(gs,{name:"confirm-dialog-fade"},{default:Gt(()=>{var o;return[(o=Ne(t))!=null&&o.visible?(F(),U("div",{key:0,class:"confirm-overlay",onClick:r[2]||(r[2]=De(a=>{var c;return((c=Ne(t))==null?void 0:c.closeOnBackdrop)!==!1&&n(!1)},["self"]))},[M("div",ree,[M("div",oee,Q(Ne(t).title||i.$t("shell.confirmOperation")),1),M("div",aee,Q(Ne(t).message),1),Ne(t).warningText?(F(),U("div",lee,Q(Ne(t).warningText),1)):me("",!0),M("div",{class:Ce(["confirm-actions",{"confirm-actions--confirm-left":Ne(t).confirmOnLeft}])},[M("button",{type:"button",class:"confirm-button confirm-button--cancel",onClick:r[0]||(r[0]=a=>n(!1))},Q(Ne(t).cancelText||i.$t("common.cancel")),1),M("button",{type:"button",class:Ce(["confirm-button confirm-button--confirm",Ne(t).confirmVariant==="danger"?"confirm-button--danger":"confirm-button--primary"]),onClick:r[1]||(r[1]=a=>n(!0))},Q(Ne(t).confirmText||i.$t("common.confirm")),3)],2)])])):me("",!0)]}),_:1}))}});let nw=null;function lv(){const s=Is(),e=o=>{nw=o,o||t()},t=()=>{const o=s.easterEgg;o.cleanupTimer&&clearTimeout(o.cleanupTimer);const a=nw;a&&(a.innerHTML=""),s.clearEasterEgg()},n=(o=!1)=>{const a=s.easterEgg;a.cleanupTimer&&(clearTimeout(a.cleanupTimer),s.setEasterEggState({cleanupTimer:null}));const c=a.instance;if(!c)return t(),Promise.resolve();if(a.destroying)return a.destroyPromise||Promise.resolve();s.setEasterEggState({destroying:!0});let l;try{l=c.destroy({immediate:o,payload:a.payload,root:nw})}catch(d){return console.warn("销毁彩蛋时发生错误:",d),s.setEasterEggState({destroying:!1}),t(),Promise.resolve()}const u=()=>{s.setEasterEggState({destroyPromise:null,destroying:!1}),t()};if(l&&typeof l.then=="function"){const d=l.then(()=>{u()}).catch(h=>{console.warn("彩蛋清理失败:",h),u()});return s.setEasterEggState({destroyPromise:d}),d}return u(),Promise.resolve()},i=async(o,a={},c)=>{const l=window.EasterEggRegistry;if(!l){console.warn("EasterEggRegistry 尚未加载,无法播放彩蛋");return}if(!l.has(o)){console.warn("未注册的彩蛋 effect:",o),await n(!0);return}const u=nw;if(!u){console.warn("未找到彩蛋根节点");return}await n(!0),s.setEasterEggState({active:!0,effect:o,payload:a});const d=l.start(o,{root:u,payload:a,app:c});if(!d){t();return}s.setEasterEggState({instance:d,destroyPromise:null,destroying:!1}),s.easterEgg.cleanupTimer&&clearTimeout(s.easterEgg.cleanupTimer);const h=Math.max(8,Number(a==null?void 0:a.duration_seconds)||45),p=setTimeout(()=>{const g=n(!1);g&&typeof g.catch=="function"&&g.catch(()=>{})},h*1e3);s.setEasterEggState({cleanupTimer:p}),a!=null&&a.message};return{registerOverlayRoot:e,handlePayload:async(o,a)=>{let c=o;if(typeof o=="string")try{c=JSON.parse(o)}catch{console.warn("无法解析彩蛋结果:",o);return}if(!c||typeof c!="object")return;if(!c.success){c.error&&console.warn("彩蛋触发失败:",c.error),await n(!0);return}const l=(c.effect||"").toLowerCase();if(!l){console.warn("彩蛋结果缺少 effect 字段");return}await i(l,c,a)},startEffect:i,destroyEffect:n,finishCleanup:t}}const uee=ct({__name:"EasterEggOverlay",setup(s){const e=Is(),{easterEgg:t}=xi(e),n=ge(null),i=lv();return dn(()=>{i.registerOverlayRoot(n.value)}),Rn(()=>{i.registerOverlayRoot(null)}),(r,o)=>(F(),U("div",{class:Ce(["easter-egg-overlay",{active:Ne(t).active}]),"aria-hidden":"true",ref_key:"overlayRoot",ref:n},null,2))}}),dee=["disabled"],hee=ct({__name:"FileContextMenu",props:{downloadFile:{type:Function},downloadFolder:{type:Function}},setup(s){const e=s,t=Pc(),{contextMenu:n}=xi(t),i=()=>{const l=n.value.node;!l||l.type!=="file"||!l.path||(e.downloadFile(l.path),t.hideContextMenu())},r=()=>{const l=n.value.node;!l||l.type!=="folder"||!l.path||(e.downloadFolder(l.path),t.hideContextMenu())},o=l=>{if(!n.value.visible)return;const u=l.target;u&&u.closest(".context-menu")||t.hideContextMenu()},a=()=>{n.value.visible&&t.hideContextMenu()},c=l=>{l.key==="Escape"&&n.value.visible&&t.hideContextMenu()};return dn(()=>{document.addEventListener("click",o),window.addEventListener("scroll",a,!0),document.addEventListener("keydown",c)}),Rn(()=>{document.removeEventListener("click",o),window.removeEventListener("scroll",a,!0),document.removeEventListener("keydown",c)}),(l,u)=>Ne(n).visible?(F(),U("div",{key:0,class:"context-menu",style:qe({top:Ne(n).y+"px",left:Ne(n).x+"px"}),onClick:u[0]||(u[0]=De(()=>{},["stop"]))},[Ne(n).node&&Ne(n).node.type==="file"?(F(),U("button",{key:0,type:"button",onClick:De(i,["stop"])},Q(l.$t("shell.downloadFile")),1)):me("",!0),Ne(n).node&&Ne(n).node.type==="folder"?(F(),U("button",{key:1,type:"button",disabled:!Ne(n).node.path,onClick:De(r,["stop"])},Q(l.$t("shell.downloadArchive")),9,dee)):me("",!0)],4)):me("",!0)}}),fee={key:0,class:"quota-toast"},pee={class:"quota-toast-label"},mee=ct({__name:"QuotaToast",setup(s){const e=Is(),{quotaToast:t}=xi(e),n=()=>e.dismissQuotaToast();return(i,r)=>(F(),Ft(gs,{name:"quota-toast-fade"},{default:Gt(()=>[Ne(t)?(F(),U("div",fee,[M("span",pee,Q(Ne(t).message),1),We(ml,{size:"sm",label:i.$t("shell.closeNotification"),onClick:n},null,8,["label"])])):me("",!0)]),_:1}))}}),gee={class:"app-toast-body"},vee={key:0,class:"app-toast-title"},yee={class:"app-toast-message"},bee=ct({__name:"ToastStack",setup(s){const e=Is(),{toastQueue:t}=xi(e),n=i=>e.dismissToast(i);return(i,r)=>(F(),U("div",{class:Ce(["toast-stack",{"toast-stack--empty":!Ne(t).length}])},[We(ay,{name:"quota-toast-fade",tag:"div"},{default:Gt(()=>[(F(!0),U(Ie,null,Ze(Ne(t),o=>(F(),U("div",{key:o.id,class:Ce(["app-toast",o.type?`app-toast--${o.type}`:""])},[M("div",gee,[o.title?(F(),U("div",vee,Q(o.title),1)):me("",!0),M("div",yee,Q(o.message),1)]),o.closable!==!1?(F(),Ft(ml,{key:0,size:"sm",label:i.$t("shell.closeNotification"),onClick:a=>n(o.id)},null,8,["label","onClick"])):me("",!0)],2))),128))]),_:1})],2))}}),_ee={class:"app-root"},wee=ct({__name:"AppShell",props:{downloadFile:{type:Function},downloadFolder:{type:Function}},setup(s){return(e,t)=>(F(),U("div",_ee,[We(mee),We(bee),We(cee),aF(e.$slots,"default"),We(uee),We(hee,{"download-file":s.downloadFile,"download-folder":s.downloadFolder},null,8,["download-file","download-folder"])]))}}),See=rr(()=>St(()=>import("./PersonalizationDrawer.js"),__vite__mapDeps([0,1,2,3,4,5,6]))),kee=rr(()=>St(()=>import("./ImagePicker.js"),__vite__mapDeps([7,1,2,3,4,8]))),Cee=rr(()=>St(()=>import("./ConversationReviewDialog.js"),__vite__mapDeps([9,1,2,3,4,10]))),Tee=rr(()=>St(()=>import("./SubAgentActivityDialog.js"),__vite__mapDeps([11,1,2,3,4,5,12]))),Aee=rr(()=>St(()=>import("./BackgroundCommandDialog.js"),__vite__mapDeps([13,1,2,3,4,5]))),Eee=rr(()=>St(()=>import("./VersioningDialog.js"),__vite__mapDeps([14,1,2,3,4,15]))),Mee=rr(()=>St(()=>import("./UserQuestionDialog.js"),__vite__mapDeps([16,1,2,3,4,17]))),xee=rr(()=>St(()=>import("./PlanApprovalDialog.js"),__vite__mapDeps([18,1,2,3,4,5,19]))),Ree=rr(()=>St(()=>import("./SandboxSetupDialog.js"),__vite__mapDeps([20,1,2,3,4,5,21]))),Iee=rr(()=>St(()=>import("./TutorialOverlay.js"),__vite__mapDeps([22,1,3,5,2,4]))),Pee=rr(()=>St(()=>import("./NewUserTutorialPrompt.js"),__vite__mapDeps([23,1,3,24]))),Lee=rr(()=>St(()=>import("./GoalProgressDialog.js"),__vite__mapDeps([25,1,2,3,4,26]))),Oee=rr(()=>St(()=>import("./WorkflowDemoShell.js"),__vite__mapDeps([27,1,2,3,4,28]))),Dee={ChatArea:ZU,ConversationSidebar:oz,ToolApprovalPanel:Dz,GitChangesPanel:gj,TerminalPanel:y9,TokenDrawer:f7,PersonalizationDrawer:See,QuickMenu:WL,InputComposer:qZ,EffortSlider:iee,AppShell:wee,StatusAvatar:GD,ImagePicker:kee,ConversationReviewDialog:Cee,SubAgentActivityDialog:Tee,BackgroundCommandDialog:Aee,VersioningDialog:Eee,UserQuestionDialog:Mee,PlanApprovalDialog:xee,SandboxSetupDialog:Ree,TutorialOverlay:Iee,NewUserTutorialPrompt:Pee,GoalProgressDialog:Lee,WorkflowDemoShell:Oee},KD="agents_workspace_mode",Nee=()=>{try{const s=window.localStorage.getItem(KD);return s==="host"||s==="docker"?s:null}catch{return null}},M1=s=>{try{window.localStorage.setItem(KD,s?"host":"docker")}catch{}},qD="agents_new_conversation_type",$ee=()=>{try{return window.localStorage.getItem(qD)==="multi_agent"?"multi_agent":"agent"}catch{return"agent"}},QD=s=>{try{window.localStorage.setItem(qD,s)}catch{}},hI=Nee(),Bee=$ee();function Fee(){return{initialRouteResolved:!1,dropToolEvents:!1,workflowDemoRoute:"",currentConversationType:null,newConversationType:Bee,agentTypeMenuOpen:!1,multiAgentIndexRebuildTriggered:!1,usePollingMode:!0,waitingForSubAgent:!1,waitingForBackgroundCommand:!1,hideSystemMessages:!0,preparingTools:new Map,activeTools:new Map,toolActionIndex:new Map,toolStacks:new Map,taskInProgress:!1,apiRequestPending:!1,runningStateReconcileTimer:null,_runningStateIdleStreak:0,runningWorkspaceTasksRefreshTimer:null,runtimeQueuedMessages:[],runtimeGuidanceFallbackQueue:[],runtimeQueueSuppressedMessageIds:new Set,runtimeGuidanceSuppressedTextCounts:{},runtimeQueueLimit:5,runtimeQueueAutoSendInProgress:!1,runtimeQueueSyncLockKey:"",runtimeQueueSyncLockUntil:0,projectGitSummary:null,projectGitSummaryRefreshTimer:null,terminalCountRefreshTimer:null,projectGitSummaryRefreshing:!1,gitChangesPanelOpen:!1,gitChangesLoading:!1,gitChangesError:"",gitChangesContext:3,gitChangesFileContexts:{},gitChangesFoldContexts:{},gitChangesDiff:null,terminalPanelOpen:!1,terminalSessions:{},terminalActiveSession:"",terminalSessionLogs:{},terminalHydrated:{},terminalCount:0,previousTerminalCount:0,rightSplitRatio:.5,composerReservedHeight:80,lastHistoryLoadedConversationId:null,searchRequestSeq:0,searchActiveQuery:"",compressing:!1,compressionInProgress:!1,compressionConversationId:null,compressionMode:"",compressionStage:"",compressionError:"",compressionToastId:null,skipConversationLoadedEvent:!1,skipConversationHistoryReload:!1,_scrollListenerReady:!1,historyLoading:!1,historyLoadingFor:null,historyLoadSeq:0,blankHeroActive:!1,blankHeroExiting:!1,blankWelcomeText:"",lastBlankConversationId:null,titleTypingText:"",titleTypingTarget:"",titleTypingTimer:null,titleReady:!1,suppressTitleTyping:!1,headerMenuOpen:!1,blankWelcomePool:[S("appCore.welcomeHelp"),S("appCore.welcomeHot"),S("appCore.welcomeHomework"),S("appCore.welcomeCode"),S("appCore.welcomeChat"),S("appCore.welcomeOrganize"),S("appCore.welcomeTool"),S("appCore.welcomeContinue"),S("appCore.welcomeDraw"),S("appCore.welcomeCat"),S("appCore.welcomePuzzle"),S("appCore.welcomeFun"),S("appCore.welcomeNeed")],mobileViewportQuery:null,modeMenuOpen:!1,modelMenuOpen:!1,permissionMenuOpen:!1,currentPermissionMode:"unrestricted",pendingPermissionMode:"",executionModeEnabled:!1,currentExecutionMode:"sandbox",pendingExecutionMode:"",networkPermissionEnabled:!1,currentNetworkPermission:"restricted",pendingNetworkPermission:"",networkPermissionOptions:[{value:"restricted",labelKey:"appUi.networkRestricted",descriptionKey:"appCore.networkRestrictedDesc"},{value:"full",labelKey:"appUi.networkFull",descriptionKey:"appCore.networkFullDesc"}],workModeMenuOpen:!1,currentWorkMode:"plan",workModeOptions:[{value:"plan",labelKey:"appUi.workModePlan",descriptionKey:"appCore.workModePlanDesc"},{value:"ask",labelKey:"appUi.workModeAsk",descriptionKey:"appCore.workModeAskDesc"},{value:"execute",labelKey:"appUi.workModeExecute",descriptionKey:"appCore.workModeExecuteDesc"}],pathAuthorizationDialogOpen:!1,pathAuthorizationMode:"writable",pathAuthorizationWritableDraft:"",pathAuthorizationReadableDraft:"",pathAuthorizationDraft:"",pathAuthorizationSaving:!1,versioningHostMode:hI==="host",dockerProjectMode:hI==="docker",hostWorkspaces:[],currentHostWorkspaceId:"",defaultHostWorkspaceId:"",hostWorkspaceSwitching:!1,hostWorkspaceCreatePath:"",hostWorkspaceCreateLabel:"",hostWorkspaceCreateSubmitting:!1,hostWorkspaceCreateError:"",hostWorkspaceManageSubmitting:!1,versioningEnabled:!1,versioningTrackingMode:"conversation_only",versioningMode:"overwrite",versioningDialogOpen:!1,versioningLoading:!1,versioningCheckpoints:[],versioningSelectedSeq:null,versioningSelectedDetail:null,versioningDetailLoading:!1,versioningRestoring:!1,versioningRestoreMode:"overwrite",versioningInitializingBackupToastId:null,permissionModeOptions:[{value:"readonly",labelKey:"personalization.permissionReadonly",descriptionKey:"appCore.permissionReadonlyDesc"},{value:"approval",labelKey:"appCore.permissionApproval",descriptionKey:"appCore.permissionApprovalDesc"},{value:"auto_approval",labelKey:"appCore.permissionAutoApproval",descriptionKey:"appCore.permissionAutoApprovalDesc"},{value:"unrestricted",labelKey:"appCore.permissionUnrestricted",descriptionKey:"appCore.permissionUnrestrictedDesc"}],executionModeOptions:[{value:"sandbox",labelKey:"input.executionSandbox",descriptionKey:"appCore.executionSandboxDesc"},{value:"direct",labelKey:"input.executionFullAccess",descriptionKey:"appCore.executionDirectDesc"}],pendingToolApprovals:[],decidingApprovalIds:[],pendingUserQuestions:[],pendingPlanApprovals:[],answeringPlanApprovalIds:[],planApprovalMinimized:!1,userQuestionDialogVisible:!1,userQuestionMinimized:!1,userQuestionActiveIndex:0,answeringUserQuestionIds:[],userQuestionOriginalTitle:"",userQuestionTitleBlinkTimer:null,userQuestionTitleBlinkRed:!0,autoApprovalFeedLines:[],autoApprovalFinalMessage:"",autoApprovalTitle:S("appTasks.autoApprovalRecordTitle"),approvalAutoCloseTimer:null,imageEntries:[],imageLoading:!1,videoEntries:[],videoLoading:!1,conversationHasImages:!1,conversationHasVideos:!1,conversationListRequestSeq:0,conversationListRefreshToken:0,connectionHeartbeatTimer:null,connectionHeartbeatActive:!1,connectionHeartbeatFailCount:0,connectionHeartbeatSeq:0,connectionHeartbeatLastLatencyMs:0,connectionHeartbeatLastError:"",connectionHeartbeatLastStatusCode:null,connectionHeartbeatLastChangeAt:0,connectionHeartbeatInFlight:!1,connectionHeartbeatFailThreshold:3,connectionHeartbeatRequestTimeoutMs:5e3,connectionHeartbeatIntervalMs:8e3,connectionHeartbeatDisconnectedIntervalMs:1e3,composerDraftSaveTimer:null,composerDraftDirty:!1,composerDraftLastSyncedContent:"",composerDraftFetchSeq:0,icons:vF,toolCategoryIcons:gF,reviewDialogOpen:!1,reviewSelectedConversationId:null,reviewSubmitting:!1,reviewPreviewLines:[],reviewPreviewLoading:!1,reviewPreviewError:null,reviewPreviewLimit:20,reviewSendToModel:!0,reviewGeneratedPath:null,reviewConversations:[],reviewListLoading:!1,reviewListLoadingMore:!1,reviewListHasMore:!1,reviewListOffset:0,reviewListLimit:20,tutorialPromptVisible:!1,tutorialPromptLoading:!1,tutorialPromptUsername:"",dragOverActive:!1,_boundDragEnter:null,_boundDragOver:null,_boundDragLeave:null,_boundDrop:null,_manualScrollSuppressUntil:0,_escapedByUserScroll:!1,_autoRelockCooldownUntil:0,stickIsAtBottom:!0,stickIsNearBottom:!0}}const Hee={web_search:"search",conversation_search:"search",extract_webpage:"webpage",save_webpage:"save",write_file:"write",edit_file:"write",read_file:"read",read_skill:"read",conversation_review:"read",vlm_analyze:"camera",ocr_image:"camera",view_image:"camera",view_video:"camera",create_skill:"skill",trigger_easter_egg:"skill",terminal_session:"monitor",terminal_input:"keyboard",terminal_snapshot:"clipboard",sleep:"sleep",run_command:"command",update_memory:"brain",recall_project_memory:"notebook",search_project_memory:"search",update_project_memory:"notebook",todo_create:"note",todo_update_task:"check",create_sub_agent:"subagent",close_sub_agent:"subagent",terminate_sub_agent:"subagent",get_sub_agent_status:"subagent",manage_personalization:"persona",ask_user:"ask",list_mcp_servers:"mcp"};function Uee(s){const e=String(s||"");return e.startsWith("mcp__")?"mcp":Hee[e]||"command"}function Wee(s){var n,i,r;if(!Array.isArray(s))return[];let e=-1;for(let o=s.length-1;o>=0;o--){if(((n=s[o])==null?void 0:n.type)==="tool"){e=o;break}if(((i=s[o])==null?void 0:i.type)==="thinking")break}if(e<0)return[];let t=e;for(;t>0&&((r=s[t-1])==null?void 0:r.type)==="tool";)t--;return s.slice(t,e+1)}const fI=new Set(["preparing","running","pending","queued","awaiting_approval","pending_approval","awaiting_user_answer"]),zee=new Set(["completed","failed","timeout","terminated","cancelled"]),jee={...Zo(fL,["isConnected","socket","stopRequested","projectPath","agentVersion","thinkingMode","runMode","reasoningEffort"]),...O_(Pc,["contextMenu","fileTree","expandedFolders","todoList"]),...O_(oo,{qdHasContent:"hasContent",qdExpanded:"expanded"}),...Zo(oo,{qdUserCollapsed:"userCollapsed"}),...Zo(Is,["sidebarCollapsed","chatDisplayMode","rightWidth","rightCollapsed","isResizing","resizingPanel","minPanelWidth","maxPanelWidth","quotaToast","toastQueue","confirmDialog","easterEgg","isMobileViewport","mobileOverlayMenuOpen","activeMobileOverlay"]),...Zo(kr,["conversations","conversationsLoading","hasMoreConversations","loadingMoreConversations","currentConversationId","currentConversationTitle","searchQuery","searchTimer","searchResults","searchGroups","conversationInsertAnimations","conversationListAnimationMode","pendingDeletingConversationIds","searchActive","searchInProgress","searchMoreAvailable","searchOffset","searchTotal","conversationsOffset","conversationsLimit","runningWorkspaceTasks","acknowledgedCompletedTaskIds","workspaceGroups"]),...Zo(er,["currentModelKey"]),...O_(er,["models"]),...Zo(TE,["messages","currentMessageIndex","streamingMessage","expandedBlocks","autoScrollEnabled","userScrolling","thinkingScrollLocks"]),...Zo(lk,["inputMessage","inputLineCount","inputIsMultiline","inputIsFocused","quickMenuOpen","toolMenuOpen","settingsOpen","imagePickerOpen","videoPickerOpen","selectedImages","selectedVideos","selectedFiles","goalModeArmed","goalRunning","goalProgress","goalDialogOpen"]),resolvedRunMode(){const s=this.runMode==="deep"?"thinking":this.runMode;return["fast","thinking"].includes(s)?s:this.thinkingMode?"thinking":"fast"},headerRunModeOptions(){return lt.value,[{value:"fast",label:S("appCore.fastMode"),desc:S("appCore.fastModeDesc")},{value:"thinking",label:S("input.thinkingMode"),desc:S("appCore.thinkingModeDesc")}]},headerRunModeLabel(){lt.value;const s=this.headerRunModeOptions.find(e=>e.value===this.resolvedRunMode);return s?s.label:S("appCore.fastMode")},showEffortSlider(){var e;const s=er();return this.resolvedRunMode==="thinking"&&!!((e=s.currentModel)!=null&&e.supportsReasoningEffort)},currentModelLabel(){var e;const s=er();return lt.value,((e=s.currentModel)==null?void 0:e.label)||S("appCore.modelNotSelected")},policyUiBlocks(){return zo().uiBlocks||{}},adminDisabledModels(){return zo().disabledModelSet},modelOptions(){const s=this.adminDisabledModels||new Set;return(this.models||[]).map(t=>({...t,disabled:s.has(t.key)}))},titleRibbonVisible(){return!this.isMobileViewport&&this.chatDisplayMode==="chat"},chatContainerStyle(){const e=Number(this.composerReservedHeight||0),t=Number.isFinite(e)?Math.max(90,Math.round(e)):90,n=Math.max(0,t-90);return{"--composer-base-height":"calc(90px + var(--app-bottom-inset, 0px))","--composer-reserved-height":`calc(${t}px + var(--app-bottom-inset, 0px))`,"--composer-growth-height":`${n}px`}},...Zo(eL,["preparingTools","activeTools","toolActionIndex","toolStacks","toolSettings","toolSettingsLoading"]),...Zo(tL,["tokenPanelCollapsed","currentContextTokens","currentConversationTokens","projectStorage","containerStatus","containerNetRate","usageQuota"]),...Zo(oL,["focusedFiles"]),...Zo(rL,["uploading","mediaUploading"]),...O_(pL,{monitorIsLocked:s=>s.isLocked}),displayModeSwitchDisabled(){return!!this.policyUiBlocks.block_virtual_monitor},compressionActiveForCurrentConversation(){if(!this.compressionInProgress&&!this.compressing)return!1;const s=this.compressionConversationId;return s?s===this.currentConversationId:!!this.currentConversationId},displayLockEngaged(){return this.compressionActiveForCurrentConversation},currentWorkspaceHasRunningTask(){return!(this.versioningHostMode||this.dockerProjectMode)||!this.currentHostWorkspaceId?!1:(Array.isArray(this.runningWorkspaceTasks)?this.runningWorkspaceTasks:[]).some(e=>{const t=String((e==null?void 0:e.status)||"");return(e==null?void 0:e.workspace_id)===this.currentHostWorkspaceId&&(e==null?void 0:e.conversation_id)===this.currentConversationId&&["pending","running","cancel_requested"].includes(t)})},streamingUi(){return this.streamingMessage||this.hasPendingToolActions()},composerBusy(){const s=this.monitorIsLocked&&this.chatDisplayMode==="monitor";return this.streamingUi||this.taskInProgress||s||this.stopRequested||this.compressionActiveForCurrentConversation},activeSubAgentCount(){const s=dd(),e=Array.isArray(s.subAgents)?s.subAgents:[],t=new Set(["completed","failed","timeout","terminated"]);return e.filter(n=>{const i=String((n==null?void 0:n.status)||"").toLowerCase();return!t.has(i)}).length},mainChatIdle(){return!this.streamingUi&&!this.stopRequested&&!(this.monitorIsLocked&&this.chatDisplayMode==="monitor")&&!this.compressionActiveForCurrentConversation},composerStreamingForInput(){return this.composerBusy&&!this.displayLockEngaged},composerHeroActive(){return(this.blankHeroActive||this.blankHeroExiting)&&!this.composerInteractionActive},showStatusAvatar(){var s;return((s=Js().form)==null?void 0:s.show_status_avatar)!==!1},composerInteractionActive(){const s=!!(this.inputMessage&&this.inputMessage.trim().length>0),e=Array.isArray(this.selectedImages)&&this.selectedImages.length>0,t=Array.isArray(this.selectedFiles)&&this.selectedFiles.length>0;return this.quickMenuOpen||s||e||t},showScrollToBottomButton(){return this.chatDisplayMode==="chat"&&!this.stickIsNearBottom},rightPanelsStyle(){const s=Math.min(this.rightWidth||420,600),e=this.terminalPanelOpen,t=this.gitChangesPanelOpen,n=this.rightSplitRatio??.5,i=Math.max(.15,Math.min(.85,Number(n)||.5));let r;return e&&t?r=`${i}fr 2px ${1-i}fr`:e?r="1fr 0px 0fr":t?r="0fr 0px 1fr":r="0fr 0px 0fr",{width:s+"px",gridTemplateRows:r}},avatarStatus(){var p,g,v,m,y,_;lt.value;const s=Array.isArray(this.messages)?this.messages:[],e=(()=>{var b;for(let k=s.length-1;k>=0;k--)if(((b=s[k])==null?void 0:b.role)==="assistant")return s[k];return null})(),t=dd(),n=vg(),i=b=>(Array.isArray(b)?b:[]).filter(k=>{if(!k)return!1;const w=String((k==null?void 0:k.status)||"").toLowerCase();return w?!zee.has(w):!0}).length,r=i(t.subAgents),o=i(n.commands),a=(()=>{const b=[];return o>0&&b.push(S("appCore.backgroundCommandCount",{n:o,count:o})),r>0&&b.push(S("appCore.backgroundAgentCount",{n:r,count:r})),b.length?`${b.join(",")}${S("appCore.backgroundRunning")}`:""})(),c=!!((p=Js().form)!=null&&p.tool_intent_enabled),l=!!e&&(this.taskInProgress||this.streamingMessage)&&(e.currentStreamingType==="thinking"||e.activeThinkingId!=null);let u=[];e&&(u=Wee(e.actions||[]).filter(k=>{var T,A;const w=String(((T=k==null?void 0:k.tool)==null?void 0:T.status)||"").toLowerCase();return((A=k==null?void 0:k.tool)==null?void 0:A.awaiting_content)||!w||fI.has(w)})),u.length===0&&(u=[...Array.from(((v=(g=this.preparingTools)==null?void 0:g.values)==null?void 0:v.call(g))||[]),...Array.from(((y=(m=this.activeTools)==null?void 0:m.values)==null?void 0:y.call(m))||[])].map(k=>(k==null?void 0:k.type)==="tool"?k:{type:"tool",tool:k}).filter(k=>{const w=k==null?void 0:k.tool;if(!w)return!1;const T=String((w==null?void 0:w.status)||"").toLowerCase();return(w==null?void 0:w.awaiting_content)||!T||fI.has(T)}));const d=this.preparingTools&&this.preparingTools.size>0||this.activeTools&&this.activeTools.size>0,h=this.streamingMessage||this.taskInProgress||this.waitingForSubAgent||this.waitingForBackgroundCommand||this.stopRequested||d||u.length>0||r>0||o>0;if(l)return{mode:"think",toolKeys:[],toolTexts:[],text:S("appCore.thinking"),tracking:!1};if(u.length>0){const b=u.map(A=>{var C;return Uee((C=A==null?void 0:A.tool)==null?void 0:C.name)}),k=A=>{if(!A)return"";const C=A.intent_full||"",E=A.intent_rendered||"";return C&&E===C?C:""},w=u.map(A=>c?k(A==null?void 0:A.tool):"");let T=w[0]||"";return u.length>1?T=w[0]||"":T||(T=c?k((_=u[0])==null?void 0:_.tool):""),{mode:"tool",toolKeys:b,toolTexts:w,text:T,tracking:!1}}if(h){let b=a;if(!b&&this.apiRequestPending)return{mode:"work",toolKeys:[],toolTexts:[],text:S("appCore.waitingApiResponse"),tracking:!1,apiWaiting:!0};if(!b){const k=e&&e.awaitingFirstContent?e:null;k&&(b=typeof k.generatingLabel=="string"&&k.generatingLabel.trim()||"")}return{mode:"work",toolKeys:[],toolTexts:[],text:b,tracking:!1}}return{mode:"idle",toolKeys:[],toolTexts:[],text:"",tracking:!0}}};function Be(...s){}const al=(...s)=>{};function Vee(){var s;if(typeof window>"u")return!1;try{const e=window.__GOAL_MODE_DEBUG__;if(e===!0||e==="1")return!0;if(e===!1||e==="0")return!1;const t=(s=window.localStorage)==null?void 0:s.getItem("goalModeDebug");return t==="1"||t==="true"}catch{return!1}}let pI=0;function Cn(s,e={}){if(Vee())try{pI+=1;const t={event:s,seq:pI,client_ts:new Date().toISOString(),...e};console.log("[GOAL_MODE_DEBUG]",s,t),typeof fetch<"u"&&fetch("/api/client_debug_log",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).catch(()=>{})}catch{}}const Gee={inputMessage(){this.autoResizeInput(),typeof this.scheduleComposerDraftPersist=="function"&&this.scheduleComposerDraftPersist("watch-input-message")},messages:{deep:!0,handler(){this.refreshBlankHeroState()}},composerBusy(s,e){e&&!s&&typeof this.tryAutoSendRuntimeQueuedMessages=="function"&&this.tryAutoSendRuntimeQueuedMessages("watch-composer-idle")},runtimeQueuedMessages:{deep:!0,handler(s){Array.isArray(s)&&s.length>0&&!this.composerBusy&&typeof this.tryAutoSendRuntimeQueuedMessages=="function"&&this.tryAutoSendRuntimeQueuedMessages("watch-runtime-queue")}},runtimeGuidanceFallbackQueue:{deep:!0,handler(s){Array.isArray(s)&&s.length>0&&!this.composerBusy&&typeof this.tryAutoSendRuntimeQueuedMessages=="function"&&this.tryAutoSendRuntimeQueuedMessages("watch-runtime-guidance-fallback")}},currentConversationTitle(s,e){const t=s&&s.trim()||"";if(this.suppressTitleTyping){this.titleTypingText=t,this.titleTypingTarget=t;return}const n=e&&e.trim()||this.titleTypingText&&this.titleTypingText.trim()||"",i=c=>c==="新对话"||c==="New Chat",r=!n||i(n),o=!t||i(t),a=r&&!o;this.startTitleTyping(t,{animate:a})},currentConversationId:{immediate:!1,handler(s,e){if(s!==e){kr().setCurrentConversationId(s||null),s||(this.currentConversationType=null,kr().$patch({multiAgentMode:!1}));const t=oo();t.resetTransient(),s||(t.setEditedFiles([]),Pc().setTodoList(null))}if(Be("currentConversationId 变化",{oldValue:e,newValue:s,skipConversationHistoryReload:this.skipConversationHistoryReload}),al("watch:currentConversationId",{oldValue:e,newValue:s,skipConversationHistoryReload:this.skipConversationHistoryReload,historyLoading:this.historyLoading,historyLoadingFor:this.historyLoadingFor,historyLoadSeq:this.historyLoadSeq}),this.refreshBlankHeroState(),this.logMessageState("watch:currentConversationId",{oldValue:e,newValue:s,skipConversationHistoryReload:this.skipConversationHistoryReload}),e!==s&&!this.taskInProgress&&!this.composerBusy&&typeof this.restoreComposerDraftState=="function"&&this.restoreComposerDraftState(`watch-conversation-id:${e||"none"}->${s||"none"}`),!s||typeof s!="string"||s.startsWith("temp_")){this.versioningEnabled=!1,this.versioningTrackingMode="conversation_only";return}if(this.fetchVersioningStatus(s,{silent:!0}),this.skipConversationHistoryReload){this.skipConversationHistoryReload=!1;return}e&&s===e||(this.fetchAndDisplayHistory(),this.fetchConversationTokenStatistics(),this.updateCurrentContextTokens())}},fileTree:{immediate:!0,handler(s){this.monitorSyncDesktop(s)}}},Kee={pushToast:()=>{},autoResizeInput:()=>{},focusComposer:()=>{},isConnected:()=>!1,executeCommand:async()=>({success:!1,message:S("stores.commandChannelUnavailable")}),downloadResource:async()=>{}};function qee(s){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(s):s.replace(/["\\]/g,"\\$&")}function Qee(s){const e=document.createElement("textarea");return e.innerHTML=s,e.value}const Xee=hn("chatActions",{state:()=>({dependencies:{...Kee}}),actions:{registerDependencies(s){this.dependencies={...this.dependencies,...s}},async copyActionContent(s,e){var n;const t=(n=s&&(s.content||s.text||""))==null?void 0:n.toString();if(!t)return this.dependencies.pushToast({title:S("common.copyFailed"),message:S("stores.copyContentNotFound"),type:"warning"}),!1;try{return await this.copyText(t),this.dependencies.pushToast({title:S("common.copied"),message:e?S("stores.blockCopied",{id:e}):S("stores.contentCopied"),type:"success"}),!0}catch(i){return console.warn("复制失败:",i),this.dependencies.pushToast({title:S("common.copyFailed"),message:S("stores.copyBlockedByBrowser"),type:"error"}),!1}},async copyCodeBlock(s){if(!s)return!1;const e=`[data-code-id="${qee(s)}"]`,t=document.querySelector(e);if(!t)return this.dependencies.pushToast({title:S("common.copyFailed"),message:S("stores.codeBlockNotFound"),type:"warning"}),!1;const n=t.getAttribute("data-original-code"),i=n?Qee(n):t.textContent||"";if(!i.trim())return this.dependencies.pushToast({title:S("common.copyFailed"),message:S("stores.codeContentEmpty"),type:"warning"}),!1;try{return await this.copyText(i),this.dependencies.pushToast({title:S("common.copied"),message:S("stores.codeCopied"),type:"success"}),!0}catch(r){return console.warn("复制代码失败:",r),this.dependencies.pushToast({title:S("common.copyFailed"),message:S("stores.copyBlockedManual"),type:"error"}),!1}},applyActionContent(s){return!s||!s.content?(this.dependencies.pushToast({title:S("stores.applyFailed"),message:S("stores.applyContentMissing"),type:"warning"}),!1):(lk().setInputMessage(s.content),this.dependencies.autoResizeInput(),this.dependencies.focusComposer(),this.dependencies.pushToast({title:S("stores.filled"),message:S("stores.checkContentBeforeSend"),type:"info"}),!0)},async runCommand(s){var t;const e=(t=s&&(s.command||s.content))==null?void 0:t.toString();if(!e)return this.dependencies.pushToast({title:S("stores.cannotExecute"),message:S("stores.commandContentMissing"),type:"warning"}),!1;if(!this.dependencies.isConnected())return this.dependencies.pushToast({title:S("stores.connectionLost"),message:S("stores.reconnectAndRetry"),type:"error"}),!1;try{const n=await this.dependencies.executeCommand(e);return n&&n.success===!1?(this.dependencies.pushToast({title:S("stores.commandFailed"),message:n.message||S("common.retryLater"),type:"error"}),!1):(this.dependencies.pushToast({title:S("stores.commandExecuted"),message:e,type:"success"}),!0)}catch(n){return this.dependencies.pushToast({title:S("stores.commandFailed"),message:(n==null?void 0:n.message)||S("common.retryLater"),type:"error"}),!1}},async downloadActionAttachment(s){return!s||!s.path?(this.dependencies.pushToast({title:S("common.downloadFailed"),message:S("stores.downloadTargetMissing"),type:"warning"}),!1):this.downloadFile(s.path)},async downloadFile(s){if(!s)return this.dependencies.pushToast({title:S("common.downloadFailed"),message:S("stores.downloadPathInvalid"),type:"warning"}),!1;const e=`/api/download/file?path=${encodeURIComponent(s)}`,t=s.split("/").pop()||"file";try{return await this.dependencies.downloadResource(e,t),!0}catch(n){return console.warn("下载失败:",n),n&&n.message&&this.dependencies.pushToast({title:S("common.downloadFailed"),message:n.message,type:"error"}),!1}},async copyText(s){if(navigator.clipboard&&navigator.clipboard.writeText){await navigator.clipboard.writeText(s);return}const e=document.createElement("textarea");e.value=s,e.style.position="fixed",e.style.top="-1000px",document.body.appendChild(e),e.focus(),e.select(),document.execCommand("copy"),document.body.removeChild(e)}}}),JC="agents_sandbox_setup_never",x1="agents_sandbox_setup_snoozed",Yee=1e3,Jee=12*60*60*1e3;function Zee(){try{const s=sessionStorage.getItem(x1);if(!s)return!1;const e=Number(s);return!Number.isFinite(e)||Date.now()-e>Jee?(sessionStorage.removeItem(x1),!1):!0}catch{return!1}}const ete=hn("sandboxSetup",{state:()=>({status:null,checking:!1,dialogVisible:!1,progress:null,starting:!1,snoozed:Zee(),pollTimer:null}),getters:{neverAsk(){try{return localStorage.getItem(JC)==="1"}catch{return!1}},missing(){const s=this.status;return!s||!s.applicable?!1:s.state==="wsl_missing"||s.state==="distro_missing"||s.state==="bwrap_missing"},shouldAutoPrompt(){var s;return this.dialogVisible||this.snoozed||this.neverAsk?!1:(s=this.progress)!=null&&s.active?!0:this.missing},setupFinished(){const s=this.progress;return!!s&&!s.active&&s.phase!=="idle"}},actions:{async fetchStatus(s=!1){if(!this.checking){this.checking=!0;try{const e=await fetch(`/api/sandbox/status${s?"?force=1":""}`,{credentials:"same-origin"}),t=await e.json().catch(()=>({}));e.ok&&(t!=null&&t.success)&&(this.status=t.data)}catch{}finally{this.checking=!1}}},async autoCheck(){var s;if(await this.fetchStatus(),(s=this.status)!=null&&s.setup_running){this.dialogVisible=!0,this.startPolling();return}this.shouldAutoPrompt&&(this.dialogVisible=!0)},async recheck(){await this.fetchStatus(!0)},openWizard(){var s;this.dialogVisible=!0,(s=this.progress)!=null&&s.active&&this.startPolling(),this.status||this.fetchStatus()},snooze(){this.snoozed=!0;try{sessionStorage.setItem(x1,String(Date.now()))}catch{}this.dialogVisible=!1},setNeverAsk(){try{localStorage.setItem(JC,"1")}catch{}},resetNeverAsk(){try{localStorage.removeItem(JC)}catch{}},closeDialog(s){var e;(e=this.progress)!=null&&e.active||(s&&this.setNeverAsk(),this.snooze())},async startSetup(){var s;if(!(this.starting||(s=this.progress)!=null&&s.active)){this.starting=!0;try{const e=await fetch("/api/sandbox/setup",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({enable_wsl_if_needed:!0})}),t=await e.json().catch(()=>({}));e.ok&&(t!=null&&t.success)?(this.progress=t.data,this.startPolling()):this.progress={active:!1,phase:"error",step_index:0,step_total:6,step_title:"",log_tail:[],download_bytes:null,download_total:null,error:(t==null?void 0:t.error)||"start failed",error_kind:"start_failed",updated_at:Date.now()/1e3}}catch{this.progress={active:!1,phase:"error",step_index:0,step_total:6,step_title:"",log_tail:[],download_bytes:null,download_total:null,error:"network error",error_kind:"start_failed",updated_at:Date.now()/1e3}}finally{this.starting=!1}}},startPolling(){this.pollTimer||(this.pollOnce(),this.pollTimer=setInterval(()=>void this.pollOnce(),Yee))},stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)},async pollOnce(){try{const s=await fetch("/api/sandbox/setup/status",{credentials:"same-origin"}),e=await s.json().catch(()=>({}));if(!s.ok||!(e!=null&&e.success))return;this.progress=e.data,this.progress.active||(this.stopPolling(),this.progress.phase==="done"&&this.fetchStatus(!0))}catch{}},async retrySetup(){this.progress=null,await this.startSetup()}}}),S0=new WeakMap;let iw=null;const mI=new WeakMap;let rw=null,ZC=0;const eT=1200,gI=new Map;let tT=0;const sT=160,vI=new Map;function Bw(){if(typeof window>"u")return!1;try{const s=Number(window.__SHOW_TAG_DRAWING_UNTIL__||0);return Date.now()<=s}catch{return!1}}function tte(){var s;if(typeof window>"u")return!1;try{const e=window.__SCROLL_DEBUG__;if(e===!1||e==="0")return!1;if(e===!0||e==="1"){const i=Number(window.__SHOW_TAG_DRAWING_UNTIL__||0);return Date.now()<=i}const t=(s=window.localStorage)==null?void 0:s.getItem("scrollDebug");if(t==="0"||t==="false")return!1;if(t==="1"||t==="true"){const i=Number(window.__SHOW_TAG_DRAWING_UNTIL__||0);return Date.now()<=i}const n=Number(window.__SHOW_TAG_DRAWING_UNTIL__||0);return Date.now()<=n}catch{return!1}}function ste(){var s;if(typeof window>"u")return!1;try{const e=window.__SHOW_HTML_SCROLL_TRACE__;if(e===!1||e==="0")return!1;if(e===!0||e==="1")return!0;const t=(s=window.localStorage)==null?void 0:s.getItem("showHtmlScrollTrace");return t==="0"||t==="false"?!1:t==="1"||t==="true"}catch{return!1}}function Fw(s){const e=s.scrollTop,t=s.scrollHeight,n=s.clientHeight,i=Math.max(0,t-n),r=t-e-n;return{top:e,height:t,client:n,maxTop:i,remain:r}}function Zv(s){const e=s.querySelectorAll(".chat-inline-card--html, .chat-inline-html"),t=e[e.length-1]||null;if(!t)return null;const n=s.getBoundingClientRect(),i=t.getBoundingClientRect();return{count:e.length,y:Math.round(i.y),h:Math.round(i.height),bottomInArea:Math.round(i.bottom-n.top),areaClient:Math.round(s.clientHeight),belowViewportPx:Math.round(Math.max(0,i.bottom-n.bottom))}}function R1(s){return!!s.querySelector("show_html, show-html, .chat-inline-html, .chat-inline-card--html")}function Gd(s,e={},t=s,n=280){if(!ste()||tT>=sT)return;const i=Date.now(),r=vI.get(t)||0;if(!(n>0&&i-r=eT)return;const i=Date.now(),r=gI.get(t)||0;if(!(n>0&&i-rt.clientHeight+2)&&!(e!=null&&e.force)&&!n){Ci("scrollToBottom:skip:no-overflow",{top:t.scrollTop,height:t.scrollHeight,client:t.clientHeight,drawingActive:n},"scrollToBottom:skip:no-overflow",120),typeof s._setScrollingFlag=="function"&&s._setScrollingFlag(!1),e!=null&&e.resetUserScrolling&&((d=s.chatSetScrollState)==null||d.call(s,{userScrolling:!1}));return}const r=`t${Date.now()}_${Math.random().toString(36).slice(2,7)}`,o=Fw(t);(n||e!=null&&e.force)&&Gd("scrollToBottom:start",{traceId:r,drawingActive:n,force:!!(e!=null&&e.force),...o,lastShowHtml:Zv(t)},"scrollToBottom:start",120);const a=(e==null?void 0:e.behavior)==="smooth"&&typeof t.scrollTo=="function";Ci("scrollToBottom:start",{traceId:r,useSmooth:a,ignoreUserScrolling:!!(e!=null&&e.ignoreUserScrolling),resetUserScrolling:!!(e!=null&&e.resetUserScrolling),autoScrollEnabled:s.autoScrollEnabled,userScrolling:s.userScrolling,drawingActive:n,top:t.scrollTop,height:t.scrollHeight,client:t.clientHeight},`scrollToBottom:start:${r}`,0);let c=S0.get(t);c||(c={rafId:null,settleTimer:null},S0.set(t,c)),c.rafId!==null&&(cancelAnimationFrame(c.rafId),c.rafId=null),c.settleTimer&&(clearTimeout(c.settleTimer),c.settleTimer=null);const l=()=>{if(s.userScrolling&&!(e!=null&&e.ignoreUserScrolling)&&!(e!=null&&e.force)){Ci("scrollToBottom:skip:user-scrolling",{traceId:r,userScrolling:s.userScrolling},"scrollToBottom:skip:user-scrolling",0),typeof s._setScrollingFlag=="function"&&s._setScrollingFlag(!1);return}a?t.scrollTo({top:t.scrollHeight+(n?Math.max(24,Math.floor(t.clientHeight*.12)):0),behavior:"smooth"}):t.scrollTop=t.scrollHeight+(n?Math.max(24,Math.floor(t.clientHeight*.12)):0),(n||e!=null&&e.force)&&Gd("scrollToBottom:after-write",{traceId:r,drawingActive:n,...Fw(t),lastShowHtml:Zv(t)},"scrollToBottom:after-write",120);let h=0,p=-1;const g=Date.now(),v=n?30:12,m=n?3200:1200,y=()=>{h+=1,t.scrollTop=t.scrollHeight+(n?Math.max(24,Math.floor(t.clientHeight*.12)):0);const _=t.scrollHeight,b=_-t.scrollTop-t.clientHeight,k=Math.abs(_-p)<=2,w=Math.abs(b)<=2,T=Date.now()-g,A=!w&&h2)&&Gd("scrollToBottom:done",{traceId:r,settleCount:h,drawingActive:n,...Fw(t),lastShowHtml:Zv(t)},"scrollToBottom:done",120),Ci("scrollToBottom:done",{traceId:r,settleCount:h,top:t.scrollTop,height:t.scrollHeight,client:t.clientHeight},`scrollToBottom:done:${r}`,0)};c.settleTimer=setTimeout(y,120)};typeof s._setScrollingFlag=="function"&&s._setScrollingFlag(!0),c.rafId=requestAnimationFrame(()=>{c.rafId=null,Ci("scrollToBottom:raf",{traceId:r},`scrollToBottom:raf:${r}`,0),l(),!c.settleTimer&&typeof s._setScrollingFlag=="function"&&s._setScrollingFlag(!1)})}function yI(s){var i,r,o;const e=typeof s.isOutputActive=="function"?s.isOutputActive():!0,t=(i=s.getMessagesAreaElement)==null?void 0:i.call(s),n=!!t&&Bw()&&R1(t);if(!n&&Bw()&&t&&Gd("conditional:skip-stale-drawing-window",{...Fw(t),lastShowHtml:Zv(t)},"conditional:skip-stale-drawing-window",260),Ci("conditional:start",{active:e,autoScrollEnabled:s.autoScrollEnabled,userScrolling:s.userScrolling,drawingActive:n},"conditional:start",120),s.autoScrollEnabled===!0&&e){if(!t){Ci("conditional:skip:no-area");return}if(rw&&rw!==t){Ci("conditional:area-replaced",{},"conditional:area-replaced",0);const g=S0.get(rw);g&&g.rafId!==null&&(cancelAnimationFrame(g.rafId),g.rafId=null),g&&g.settleTimer&&(clearTimeout(g.settleTimer),g.settleTimer=null)}rw=t;const a=t.scrollTop,c=t.scrollHeight,l=t.clientHeight,u=c-a-l;if(c<=l+2&&!n){(r=s.chatSetScrollState)==null||r.call(s,{userScrolling:!1}),Ci("conditional:skip:no-overflow",{top:a,height:c,client:l,remain:u},"conditional:skip:no-overflow",120);return}c<=l+2&&n&&Gd("conditional:drawing-no-overflow-but-continue",{top:a,height:c,client:l,remain:u,drawingActive:n},"conditional:drawing-no-overflow-but-continue",200);const d=S0.get(t);if((d==null?void 0:d.rafId)!==null||d!=null&&d.settleTimer){Ci("conditional:skip:pending-task",{hasRaf:(d==null?void 0:d.rafId)!==null,hasSettle:!!(d!=null&&d.settleTimer),top:a,height:c,client:l},"conditional:skip:pending-task",100);return}const h=Date.now(),p=mI.get(t)||0;if(h-p<90){Ci("conditional:skip:too-frequent",{gap:h-p,top:a,height:c,client:l},"conditional:skip:too-frequent",100);return}mI.set(t,h),s.userScrolling===!0&&((o=s.chatSetScrollState)==null||o.call(s,{userScrolling:!1})),iw!==null&&cancelAnimationFrame(iw),iw=requestAnimationFrame(()=>{var _;iw=null;const g=(_=s.getMessagesAreaElement)==null?void 0:_.call(s);if(!g||g!==t){Ci("conditional:skip:area-changed-before-raf",{},"conditional:skip:area-changed-before-raf",0);return}const v=g.scrollHeight,m=g.clientHeight,y=Bw()&&R1(g);if(v<=m+2&&!y){Ci("conditional:skip:no-overflow-before-raf",{top:g.scrollTop,height:v,client:m},"conditional:skip:no-overflow-before-raf",100);return}y&&Gd("conditional:raf-scroll",{top:g.scrollTop,height:v,client:m,remain:v-g.scrollTop-m,lastShowHtml:Zv(g)},"conditional:raf-scroll",140),Ci("conditional:raf-scroll",{top:g.scrollTop,height:v,client:m},"conditional:raf-scroll",80),I1(s,{ignoreUserScrolling:!0,resetUserScrolling:!0,force:y})})}}function nte(s){var e;s.autoScrollEnabled||(e=s.chatSetScrollState)==null||e.call(s,{autoScrollEnabled:!0,userScrolling:!1})}function ite(s,e){var n,i;if(!e||!((n=s.thinkingScrollLocks)!=null&&n.get(e)))return;const t=(i=s.getThinkingContentElement)==null?void 0:i.call(s,e);t&&(t.scrollTop=t.scrollHeight)}/*! @license DOMPurify 3.4.8 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.8/LICENSE */function bI(s,e){(e==null||e>s.length)&&(e=s.length);for(var t=0,n=Array(e);t2?n-2:0),r=2;r1?t-1:0),i=1;i"u"?null:xn(BigInt.prototype.toString),TI=typeof Symbol>"u"?null:xn(Symbol.prototype.toString),sn=xn(Object.prototype.hasOwnProperty),$g=xn(Object.prototype.toString),Jn=xn(RegExp.prototype.test),op=yte(TypeError);function xn(s){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i2&&arguments[2]!==void 0?arguments[2]:cv;if(_I&&_I(s,null),!Vi(e))return s;let n=e.length;for(;n--;){let i=e[n];if(typeof i=="string"){const r=t(i);r!==i&&(ute(e)||(e[n]=r),i=r)}s[i]=!0}return s}function bte(s){for(let e=0;e/g),Ate=Vo(/\${[\w\W]*/g),Ete=Vo(/^data-[\-\w.\u00B7-\uFFFF]+$/),Mte=Vo(/^aria-[\-\w]+$/),RI=Vo(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),xte=Vo(/^(?:\w+script|data):/i),Rte=Vo(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Ite=Vo(/^html$/i),Pte=Vo(/^[a-z][.\w]*(-[.\w]+)+$/i),Aa={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Lte=function(){return typeof window>"u"?null:window},Ote=function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let n=null;const i="data-tt-policy-suffix";t&&t.hasAttribute(i)&&(n=t.getAttribute(i));const r="dompurify"+(n?"#"+n:"");try{return e.createPolicy(r,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+r+" could not be created."),null}},II=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function JD(){let s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Lte();const e=et=>JD(et);if(e.version="3.4.8",e.removed=[],!s||!s.document||s.document.nodeType!==Aa.document||!s.Element)return e.isSupported=!1,e;let t=s.document;const n=t,i=n.currentScript;s.DocumentFragment;const r=s.HTMLTemplateElement,o=s.Node,a=s.Element,c=s.NodeFilter,l=s.NamedNodeMap;l===void 0&&(s.NamedNodeMap||s.MozNamedAttrMap),s.HTMLFormElement;const u=s.DOMParser,d=s.trustedTypes,h=a.prototype,p=xa(h,"cloneNode"),g=xa(h,"remove"),v=xa(h,"nextSibling"),m=xa(h,"childNodes"),y=xa(h,"parentNode"),_=xa(h,"shadowRoot"),b=xa(h,"attributes"),k=o&&o.prototype?xa(o.prototype,"nodeType"):null,w=o&&o.prototype?xa(o.prototype,"nodeName"):null;if(typeof r=="function"){const et=t.createElement("template");et.content&&et.content.ownerDocument&&(t=et.content.ownerDocument)}let T,A="",C=0;const E=function(ae){if(C>0)throw op('The configured TRUSTED_TYPES_POLICY.createHTML must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose createHTML wraps DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.');C++;try{return T.createHTML(ae)}finally{C--}},x=t,D=x.implementation,N=x.createNodeIterator,O=x.createDocumentFragment,G=x.getElementsByTagName,Z=n.importNode;let q=II();e.isSupported=typeof XD=="function"&&typeof y=="function"&&D&&D.createHTMLDocument!==void 0;const V=Cte,I=Tte,$=Ate,L=Ete,K=Mte,se=xte,oe=Rte,ve=Pte;let le=RI,ue=null;const P=Dt({},[...AI,...iT,...rT,...oT,...EI]);let X=null;const J=Dt({},[...MI,...aT,...xI,...ow]);let ne=Object.seal(yp(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ce=null,_e=null;const Pe=Object.seal(yp(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let it=!0,at=!0,rt=!1,Oe=!0,xe=!1,pe=!0,he=!1,ye=!1,ke=!1,Le=!1,st=!1,gt=!1,Wt=!0,jt=!1;const ht="user-content-";let Qt=!0,It=!1,ns={},ot=null;const $s=Dt({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Er=null;const In=Dt({},["audio","video","img","source","image","track"]);let Ko=null;const ao=Dt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Pn="http://www.w3.org/1998/Math/MathML",qo="http://www.w3.org/2000/svg",Yn="http://www.w3.org/1999/xhtml";let Oi=Yn,Mr=!1,Di=null;const gl=Dt({},[Pn,qo,Yn],nT);let Qo=Dt({},["mi","mo","mn","ms","mtext"]),lo=Dt({},["annotation-xml"]);const fi=Dt({},["title","style","font","a","script"]);let Ni=null;const wa=["application/xhtml+xml","text/html"],vl="text/html";let re=null,we=null;const Ae=t.createElement("form"),bt=function(ae){return ae instanceof RegExp||ae instanceof Function},hs=function(){let ae=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(we&&we===ae)return;(!ae||typeof ae!="object")&&(ae={}),ae=gi(ae),Ni=wa.indexOf(ae.PARSER_MEDIA_TYPE)===-1?vl:ae.PARSER_MEDIA_TYPE,re=Ni==="application/xhtml+xml"?nT:cv,ue=sn(ae,"ALLOWED_TAGS")&&Vi(ae.ALLOWED_TAGS)?Dt({},ae.ALLOWED_TAGS,re):P,X=sn(ae,"ALLOWED_ATTR")&&Vi(ae.ALLOWED_ATTR)?Dt({},ae.ALLOWED_ATTR,re):J,Di=sn(ae,"ALLOWED_NAMESPACES")&&Vi(ae.ALLOWED_NAMESPACES)?Dt({},ae.ALLOWED_NAMESPACES,nT):gl,Ko=sn(ae,"ADD_URI_SAFE_ATTR")&&Vi(ae.ADD_URI_SAFE_ATTR)?Dt(gi(ao),ae.ADD_URI_SAFE_ATTR,re):ao,Er=sn(ae,"ADD_DATA_URI_TAGS")&&Vi(ae.ADD_DATA_URI_TAGS)?Dt(gi(In),ae.ADD_DATA_URI_TAGS,re):In,ot=sn(ae,"FORBID_CONTENTS")&&Vi(ae.FORBID_CONTENTS)?Dt({},ae.FORBID_CONTENTS,re):$s,ce=sn(ae,"FORBID_TAGS")&&Vi(ae.FORBID_TAGS)?Dt({},ae.FORBID_TAGS,re):gi({}),_e=sn(ae,"FORBID_ATTR")&&Vi(ae.FORBID_ATTR)?Dt({},ae.FORBID_ATTR,re):gi({}),ns=sn(ae,"USE_PROFILES")?ae.USE_PROFILES&&typeof ae.USE_PROFILES=="object"?gi(ae.USE_PROFILES):ae.USE_PROFILES:!1,it=ae.ALLOW_ARIA_ATTR!==!1,at=ae.ALLOW_DATA_ATTR!==!1,rt=ae.ALLOW_UNKNOWN_PROTOCOLS||!1,Oe=ae.ALLOW_SELF_CLOSE_IN_ATTR!==!1,xe=ae.SAFE_FOR_TEMPLATES||!1,pe=ae.SAFE_FOR_XML!==!1,he=ae.WHOLE_DOCUMENT||!1,Le=ae.RETURN_DOM||!1,st=ae.RETURN_DOM_FRAGMENT||!1,gt=ae.RETURN_TRUSTED_TYPE||!1,ke=ae.FORCE_BODY||!1,Wt=ae.SANITIZE_DOM!==!1,jt=ae.SANITIZE_NAMED_PROPS||!1,Qt=ae.KEEP_CONTENT!==!1,It=ae.IN_PLACE||!1,le=wte(ae.ALLOWED_URI_REGEXP)?ae.ALLOWED_URI_REGEXP:RI,Oi=typeof ae.NAMESPACE=="string"?ae.NAMESPACE:Yn,Qo=sn(ae,"MATHML_TEXT_INTEGRATION_POINTS")&&ae.MATHML_TEXT_INTEGRATION_POINTS&&typeof ae.MATHML_TEXT_INTEGRATION_POINTS=="object"?gi(ae.MATHML_TEXT_INTEGRATION_POINTS):Dt({},["mi","mo","mn","ms","mtext"]),lo=sn(ae,"HTML_INTEGRATION_POINTS")&&ae.HTML_INTEGRATION_POINTS&&typeof ae.HTML_INTEGRATION_POINTS=="object"?gi(ae.HTML_INTEGRATION_POINTS):Dt({},["annotation-xml"]);const Me=sn(ae,"CUSTOM_ELEMENT_HANDLING")&&ae.CUSTOM_ELEMENT_HANDLING&&typeof ae.CUSTOM_ELEMENT_HANDLING=="object"?gi(ae.CUSTOM_ELEMENT_HANDLING):yp(null);if(ne=yp(null),sn(Me,"tagNameCheck")&&bt(Me.tagNameCheck)&&(ne.tagNameCheck=Me.tagNameCheck),sn(Me,"attributeNameCheck")&&bt(Me.attributeNameCheck)&&(ne.attributeNameCheck=Me.attributeNameCheck),sn(Me,"allowCustomizedBuiltInElements")&&typeof Me.allowCustomizedBuiltInElements=="boolean"&&(ne.allowCustomizedBuiltInElements=Me.allowCustomizedBuiltInElements),xe&&(at=!1),st&&(Le=!0),ns&&(ue=Dt({},EI),X=yp(null),ns.html===!0&&(Dt(ue,AI),Dt(X,MI)),ns.svg===!0&&(Dt(ue,iT),Dt(X,aT),Dt(X,ow)),ns.svgFilters===!0&&(Dt(ue,rT),Dt(X,aT),Dt(X,ow)),ns.mathMl===!0&&(Dt(ue,oT),Dt(X,xI),Dt(X,ow))),Pe.tagCheck=null,Pe.attributeCheck=null,sn(ae,"ADD_TAGS")&&(typeof ae.ADD_TAGS=="function"?Pe.tagCheck=ae.ADD_TAGS:Vi(ae.ADD_TAGS)&&(ue===P&&(ue=gi(ue)),Dt(ue,ae.ADD_TAGS,re))),sn(ae,"ADD_ATTR")&&(typeof ae.ADD_ATTR=="function"?Pe.attributeCheck=ae.ADD_ATTR:Vi(ae.ADD_ATTR)&&(X===J&&(X=gi(X)),Dt(X,ae.ADD_ATTR,re))),sn(ae,"ADD_URI_SAFE_ATTR")&&Vi(ae.ADD_URI_SAFE_ATTR)&&Dt(Ko,ae.ADD_URI_SAFE_ATTR,re),sn(ae,"FORBID_CONTENTS")&&Vi(ae.FORBID_CONTENTS)&&(ot===$s&&(ot=gi(ot)),Dt(ot,ae.FORBID_CONTENTS,re)),sn(ae,"ADD_FORBID_CONTENTS")&&Vi(ae.ADD_FORBID_CONTENTS)&&(ot===$s&&(ot=gi(ot)),Dt(ot,ae.ADD_FORBID_CONTENTS,re)),Qt&&(ue["#text"]=!0),he&&Dt(ue,["html","head","body"]),ue.table&&(Dt(ue,["tbody"]),delete ce.tbody),ae.TRUSTED_TYPES_POLICY){if(typeof ae.TRUSTED_TYPES_POLICY.createHTML!="function")throw op('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof ae.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw op('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const Ge=T;T=ae.TRUSTED_TYPES_POLICY;try{A=E("")}catch(Bt){throw T=Ge,Bt}}else T===void 0&&ae.TRUSTED_TYPES_POLICY!==null&&(T=Ote(d,i)),T&&typeof A=="string"&&(A=E(""));(q.uponSanitizeElement.length>0||q.uponSanitizeAttribute.length>0)&&ue===P&&(ue=gi(ue)),q.uponSanitizeAttribute.length>0&&X===J&&(X=gi(X)),lr&&lr(ae),we=ae},Ps=Dt({},[...iT,...rT,...Ste]),is=Dt({},[...oT,...kte]),en=function(ae){let Me=y(ae);(!Me||!Me.tagName)&&(Me={namespaceURI:Oi,tagName:"template"});const Ge=cv(ae.tagName),Bt=cv(Me.tagName);return Di[ae.namespaceURI]?ae.namespaceURI===qo?Me.namespaceURI===Yn?Ge==="svg":Me.namespaceURI===Pn?Ge==="svg"&&(Bt==="annotation-xml"||Qo[Bt]):!!Ps[Ge]:ae.namespaceURI===Pn?Me.namespaceURI===Yn?Ge==="math":Me.namespaceURI===qo?Ge==="math"&&lo[Bt]:!!is[Ge]:ae.namespaceURI===Yn?Me.namespaceURI===qo&&!lo[Bt]||Me.namespaceURI===Pn&&!Qo[Bt]?!1:!is[Ge]&&(fi[Ge]||!Ps[Ge]):!!(Ni==="application/xhtml+xml"&&Di[ae.namespaceURI]):!1},ut=function(ae){ip(e.removed,{element:ae});try{y(ae).removeChild(ae)}catch{g(ae)}},pn=function(ae,Me){try{ip(e.removed,{attribute:Me.getAttributeNode(ae),from:Me})}catch{ip(e.removed,{attribute:null,from:Me})}if(Me.removeAttribute(ae),ae==="is")if(Le||st)try{ut(Me)}catch{}else try{Me.setAttribute(ae,"")}catch{}},co=function(ae){let Me=null,Ge=null;if(ke)ae=""+ae;else{const Zt=SI(ae,/^[\r\n\t ]+/);Ge=Zt&&Zt[0]}Ni==="application/xhtml+xml"&&Oi===Yn&&(ae=''+ae+"");const Bt=T?E(ae):ae;if(Oi===Yn)try{Me=new u().parseFromString(Bt,Ni)}catch{}if(!Me||!Me.documentElement){Me=D.createDocument(Oi,"template",null);try{Me.documentElement.innerHTML=Mr?A:Bt}catch{}}const Tt=Me.body||Me.documentElement;return ae&&Ge&&Tt.insertBefore(t.createTextNode(Ge),Tt.childNodes[0]||null),Oi===Yn?G.call(Me,he?"html":"body")[0]:he?Me.documentElement:Tt},$i=function(ae){return N.call(ae.ownerDocument||ae,ae,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Bc=function(ae){var Me,Ge;ae.normalize();const Bt=N.call(ae.ownerDocument||ae,ae,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null);let Tt=Bt.nextNode();for(;Tt;){let Cs=Tt.data;Ed([V,I,$],pi=>{Cs=rp(Cs,pi," ")}),Tt.data=Cs,Tt=Bt.nextNode()}const Zt=(Me=(Ge=ae.querySelectorAll)===null||Ge===void 0?void 0:Ge.call(ae,"template"))!==null&&Me!==void 0?Me:[];Ed(Array.from(Zt),Cs=>{Bi(Cs.content)&&Bc(Cs.content)})},xr=function(ae){const Me=w?w(ae):null;return typeof Me!="string"||re(Me)!=="form"?!1:typeof ae.nodeName!="string"||typeof ae.textContent!="string"||typeof ae.removeChild!="function"||ae.attributes!==b(ae)||typeof ae.removeAttribute!="function"||typeof ae.setAttribute!="function"||typeof ae.namespaceURI!="string"||typeof ae.insertBefore!="function"||typeof ae.hasChildNodes!="function"||ae.nodeType!==k(ae)||ae.childNodes!==m(ae)},Bi=function(ae){if(!k||typeof ae!="object"||ae===null)return!1;try{return k(ae)===Aa.documentFragment}catch{return!1}},Fc=function(ae){if(!k||typeof ae!="object"||ae===null)return!1;try{return typeof k(ae)=="number"}catch{return!1}};function Fi(et,ae,Me){Ed(et,Ge=>{Ge.call(e,ae,Me,we)})}const mn=function(ae){let Me=null;if(Fi(q.beforeSanitizeElements,ae,null),xr(ae))return ut(ae),!0;const Ge=re(w?w(ae):ae.nodeName);if(Fi(q.uponSanitizeElement,ae,{tagName:Ge,allowedTags:ue}),pe&&ae.hasChildNodes()&&!Fc(ae.firstElementChild)&&Jn(/<[/\w!]/g,ae.innerHTML)&&Jn(/<[/\w!]/g,ae.textContent)||pe&&ae.namespaceURI===Yn&&Ge==="style"&&Fc(ae.firstElementChild)||ae.nodeType===Aa.progressingInstruction||pe&&ae.nodeType===Aa.comment&&Jn(/<[/\w]/g,ae.data))return ut(ae),!0;if(ce[Ge]||!(Pe.tagCheck instanceof Function&&Pe.tagCheck(Ge))&&!ue[Ge]){if(!ce[Ge]&&yl(Ge)&&(ne.tagNameCheck instanceof RegExp&&Jn(ne.tagNameCheck,Ge)||ne.tagNameCheck instanceof Function&&ne.tagNameCheck(Ge)))return!1;if(Qt&&!ot[Ge]){const Tt=y(ae),Zt=m(ae);if(Zt&&Tt){const Cs=Zt.length;for(let pi=Cs-1;pi>=0;--pi){const mi=p(Zt[pi],!0);Tt.insertBefore(mi,v(ae))}}}return ut(ae),!0}return(k?k(ae):ae.nodeType)===Aa.element&&!en(ae)||(Ge==="noscript"||Ge==="noembed"||Ge==="noframes")&&Jn(/<\/no(script|embed|frames)/i,ae.innerHTML)?(ut(ae),!0):(xe&&ae.nodeType===Aa.text&&(Me=ae.textContent,Ed([V,I,$],Tt=>{Me=rp(Me,Tt," ")}),ae.textContent!==Me&&(ip(e.removed,{element:ae.cloneNode()}),ae.textContent=Me)),Fi(q.afterSanitizeElements,ae,null),!1)},Hi=function(ae,Me,Ge){if(_e[Me]||Wt&&(Me==="id"||Me==="name")&&(Ge in t||Ge in Ae))return!1;const Bt=X[Me]||Pe.attributeCheck instanceof Function&&Pe.attributeCheck(Me,ae);if(!(at&&!_e[Me]&&Jn(L,Me))){if(!(it&&Jn(K,Me))){if(!Bt||_e[Me]){if(!(yl(ae)&&(ne.tagNameCheck instanceof RegExp&&Jn(ne.tagNameCheck,ae)||ne.tagNameCheck instanceof Function&&ne.tagNameCheck(ae))&&(ne.attributeNameCheck instanceof RegExp&&Jn(ne.attributeNameCheck,Me)||ne.attributeNameCheck instanceof Function&&ne.attributeNameCheck(Me,ae))||Me==="is"&&ne.allowCustomizedBuiltInElements&&(ne.tagNameCheck instanceof RegExp&&Jn(ne.tagNameCheck,Ge)||ne.tagNameCheck instanceof Function&&ne.tagNameCheck(Ge))))return!1}else if(!Ko[Me]){if(!Jn(le,rp(Ge,oe,""))){if(!((Me==="src"||Me==="xlink:href"||Me==="href")&&ae!=="script"&&kI(Ge,"data:")===0&&Er[ae])){if(!(rt&&!Jn(se,rp(Ge,oe,"")))){if(Ge)return!1}}}}}}return!0},Sa=Dt({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),yl=function(ae){return!Sa[cv(ae)]&&Jn(ve,ae)},Hc=function(ae){Fi(q.beforeSanitizeAttributes,ae,null);const Me=ae.attributes;if(!Me||xr(ae))return;const Ge={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:X,forceKeepAttr:void 0};let Bt=Me.length;for(;Bt--;){const Tt=Me[Bt],Zt=Tt.name,Cs=Tt.namespaceURI,pi=Tt.value,mi=re(Zt),fs=pi;let Es=Zt==="value"?fs:mte(fs);if(Ge.attrName=mi,Ge.attrValue=Es,Ge.keepAttr=!0,Ge.forceKeepAttr=void 0,Fi(q.uponSanitizeAttribute,ae,Ge),Es=Ge.attrValue,jt&&(mi==="id"||mi==="name")&&kI(Es,ht)!==0&&(pn(Zt,ae),Es=ht+Es),pe&&Jn(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Es)){pn(Zt,ae);continue}if(mi==="attributename"&&SI(Es,"href")){pn(Zt,ae);continue}if(Ge.forceKeepAttr)continue;if(!Ge.keepAttr){pn(Zt,ae);continue}if(!Oe&&Jn(/\/>/i,Es)){pn(Zt,ae);continue}xe&&Ed([V,I,$],Ln=>{Es=rp(Es,Ln," ")});const rs=re(ae.nodeName);if(!Hi(rs,mi,Es)){pn(Zt,ae);continue}if(T&&typeof d=="object"&&typeof d.getAttributeType=="function"&&!Cs)switch(d.getAttributeType(rs,mi)){case"TrustedHTML":{Es=E(Es);break}case"TrustedScriptURL":{Es=T.createScriptURL(Es);break}}if(Es!==fs)try{Cs?ae.setAttributeNS(Cs,Zt,Es):ae.setAttribute(Zt,Es),xr(ae)?ut(ae):wI(e.removed)}catch{pn(Zt,ae)}}Fi(q.afterSanitizeAttributes,ae,null)},Xo=function(ae){let Me=null;const Ge=$i(ae);for(Fi(q.beforeSanitizeShadowDOM,ae,null);Me=Ge.nextNode();)if(Fi(q.uponSanitizeShadowNode,Me,null),mn(Me),Hc(Me),Bi(Me.content)&&Xo(Me.content),(k?k(Me):Me.nodeType)===Aa.element){const Tt=_?_(Me):Me.shadowRoot;Bi(Tt)&&(Yo(Tt),Xo(Tt))}Fi(q.afterSanitizeShadowDOM,ae,null)},Yo=function(ae){const Me=k?k(ae):ae.nodeType;if(Me===Aa.element){const Tt=_?_(ae):ae.shadowRoot;Bi(Tt)&&(Yo(Tt),Xo(Tt))}const Ge=m?m(ae):ae.childNodes;if(!Ge)return;const Bt=[];Ed(Ge,Tt=>{ip(Bt,Tt)});for(const Tt of Bt)Yo(Tt);if(Me===Aa.element){const Tt=w?w(ae):null;if(typeof Tt=="string"&&re(Tt)==="template"){const Zt=ae.content;Bi(Zt)&&Yo(Zt)}}};return e.sanitize=function(et){let ae=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Me=null,Ge=null,Bt=null,Tt=null;if(Mr=!et,Mr&&(et=""),typeof et!="string"&&!Fc(et)&&(et=_te(et),typeof et!="string"))throw op("dirty is not a string, aborting");if(!e.isSupported)return et;if(ye||hs(ae),e.removed=[],typeof et=="string"&&(It=!1),It){const pi=w?w(et):et.nodeName;if(typeof pi=="string"){const mi=re(pi);if(!ue[mi]||ce[mi])throw op("root node is forbidden and cannot be sanitized in-place")}if(xr(et))throw op("root node is clobbered and cannot be sanitized in-place");Yo(et)}else if(Fc(et))Me=co(""),Ge=Me.ownerDocument.importNode(et,!0),Ge.nodeType===Aa.element&&Ge.nodeName==="BODY"||Ge.nodeName==="HTML"?Me=Ge:Me.appendChild(Ge),Yo(Ge);else{if(!Le&&!xe&&!he&&et.indexOf("<")===-1)return T&>?E(et):et;if(Me=co(et),!Me)return Le?null:gt?A:""}Me&&ke&&ut(Me.firstChild);const Zt=$i(It?et:Me);for(;Bt=Zt.nextNode();)mn(Bt),Hc(Bt),Bi(Bt.content)&&Xo(Bt.content);if(It)return xe&&Bc(et),et;if(Le){if(xe&&Bc(Me),st)for(Tt=O.call(Me.ownerDocument);Me.firstChild;)Tt.appendChild(Me.firstChild);else Tt=Me;return(X.shadowroot||X.shadowrootmode)&&(Tt=Z.call(n,Tt,!0)),Tt}let Cs=he?Me.outerHTML:Me.innerHTML;return he&&ue["!doctype"]&&Me.ownerDocument&&Me.ownerDocument.doctype&&Me.ownerDocument.doctype.name&&Jn(Ite,Me.ownerDocument.doctype.name)&&(Cs=" `+Cs),xe&&Ed([V,I,$],pi=>{Cs=rp(Cs,pi," ")}),T&>?E(Cs):Cs},e.setConfig=function(){let et=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};hs(et),ye=!0},e.clearConfig=function(){we=null,ye=!1},e.isValidAttribute=function(et,ae,Me){we||hs({});const Ge=re(et),Bt=re(ae);return Hi(Ge,Bt,Me)},e.addHook=function(et,ae){typeof ae=="function"&&ip(q[et],ae)},e.removeHook=function(et,ae){if(ae!==void 0){const Me=fte(q[et],ae);return Me===-1?void 0:pte(q[et],Me,1)[0]}return wI(q[et])},e.removeHooks=function(et){q[et]=[]},e.removeAllHooks=function(){q=II()},e}var Dte=JD();(function(s){function e(t,n){return"___"+t.toUpperCase()+n+"___"}Object.defineProperties(s.languages["markup-templating"]={},{buildPlaceholders:{value:function(t,n,i,r){if(t.language===n){var o=t.tokenStack=[];t.code=t.code.replace(i,function(a){if(typeof r=="function"&&!r(a))return a;for(var c=o.length,l;t.code.indexOf(l=e(n,c))!==-1;)++c;return o[c]=a,l}),t.grammar=s.languages.markup}}},tokenizePlaceholders:{value:function(t,n){if(t.language!==n||!t.tokenStack)return;t.grammar=s.languages[n];var i=0,r=Object.keys(t.tokenStack);function o(a){for(var c=0;c=r.length);c++){var l=a[c];if(typeof l=="string"||l.content&&typeof l.content=="string"){var u=r[i],d=t.tokenStack[u],h=typeof l=="string"?l:l.content,p=e(n,u),g=h.indexOf(p);if(g>-1){++i;var v=h.substring(0,g),m=new s.Token(n,s.tokenize(d,t.grammar),"language-"+n,d),y=h.substring(g+p.length),_=[];v&&_.push.apply(_,o([v])),_.push(m),y&&_.push.apply(_,o([y])),typeof l=="string"?a.splice.apply(a,[c,1].concat(_)):l.content=_}}else l.content&&o(l.content)}return a}o(t.tokens)}}})})(Prism);Prism.languages.c=Prism.languages.extend("clike",{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/});Prism.languages.insertBefore("c","string",{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}});Prism.languages.insertBefore("c","string",{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:"property",inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},Prism.languages.c.string],char:Prism.languages.c.char,comment:Prism.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:"function"}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:"keyword"},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:Prism.languages.c}}}});Prism.languages.insertBefore("c","function",{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/});delete Prism.languages.c.boolean;(function(s){var e=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,t=/\b(?!)\w+(?:\s*\.\s*\w+)*\b/.source.replace(//g,function(){return e.source});s.languages.cpp=s.languages.extend("c",{"class-name":[{pattern:RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!)\w+/.source.replace(//g,function(){return e.source})),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:e,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),s.languages.insertBefore("cpp","string",{module:{pattern:RegExp(/(\b(?:import|module)\s+)/.source+"(?:"+/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source+"|"+/(?:\s*:\s*)?|:\s*/.source.replace(//g,function(){return t})+")"),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}),s.languages.insertBefore("cpp","keyword",{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:s.languages.cpp}}}}),s.languages.insertBefore("cpp","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}}),s.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:s.languages.extend("cpp",{})}}),s.languages.insertBefore("inside","double-colon",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},s.languages.cpp["base-clause"])})(Prism);(function(s){var e=/\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/,t=/(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source,n={pattern:RegExp(/(^|[^\w.])/.source+t+/[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),lookbehind:!0,inside:{namespace:{pattern:/^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,inside:{punctuation:/\./}},punctuation:/\./}};s.languages.java=s.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,lookbehind:!0,greedy:!0},"class-name":[n,{pattern:RegExp(/(^|[^\w.])/.source+t+/[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),lookbehind:!0,inside:n.inside},{pattern:RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source+t+/[A-Z]\w*\b/.source),lookbehind:!0,inside:n.inside}],keyword:e,function:[s.languages.clike.function,{pattern:/(::\s*)[a-z_]\w*/,lookbehind:!0}],number:/\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,operator:{pattern:/(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,lookbehind:!0},constant:/\b[A-Z][A-Z_\d]+\b/}),s.languages.insertBefore("java","string",{"triple-quoted-string":{pattern:/"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,greedy:!0,alias:"string"},char:{pattern:/'(?:\\.|[^'\\\r\n]){1,6}'/,greedy:!0}}),s.languages.insertBefore("java","class-name",{annotation:{pattern:/(^|[^.])@\w+(?:\s*\.\s*\w+)*/,lookbehind:!0,alias:"punctuation"},generics:{pattern:/<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,inside:{"class-name":n,keyword:e,punctuation:/[<>(),.:]/,operator:/[?&|]/}},import:[{pattern:RegExp(/(\bimport\s+)/.source+t+/(?:[A-Z]\w*|\*)(?=\s*;)/.source),lookbehind:!0,inside:{namespace:n.inside.namespace,punctuation:/\./,operator:/\*/,"class-name":/\w+/}},{pattern:RegExp(/(\bimport\s+static\s+)/.source+t+/(?:\w+|\*)(?=\s*;)/.source),lookbehind:!0,alias:"static",inside:{namespace:n.inside.namespace,static:/\b\w+$/,punctuation:/\./,operator:/\*/,"class-name":/\w+/}}],namespace:{pattern:RegExp(/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!)[a-z]\w*(?:\.[a-z]\w*)*\.?/.source.replace(//g,function(){return e.source})),lookbehind:!0,inside:{punctuation:/\./}}})})(Prism);(function(s){function e($,L){return $.replace(/<<(\d+)>>/g,function(K,se){return"(?:"+L[+se]+")"})}function t($,L,K){return RegExp(e($,L),"")}function n($,L){for(var K=0;K>/g,function(){return"(?:"+$+")"});return $.replace(/<>/g,"[^\\s\\S]")}var i={type:"bool byte char decimal double dynamic float int long object sbyte short string uint ulong ushort var void",typeDeclaration:"class enum interface record struct",contextual:"add alias and ascending async await by descending from(?=\\s*(?:\\w|$)) get global group into init(?=\\s*;) join let nameof not notnull on or orderby partial remove select set unmanaged value when where with(?=\\s*{)",other:"abstract as base break case catch checked const continue default delegate do else event explicit extern finally fixed for foreach goto if implicit in internal is lock namespace new null operator out override params private protected public readonly ref return sealed sizeof stackalloc static switch this throw try typeof unchecked unsafe using virtual volatile while yield"};function r($){return"\\b(?:"+$.trim().replace(/ /g,"|")+")\\b"}var o=r(i.typeDeclaration),a=RegExp(r(i.type+" "+i.typeDeclaration+" "+i.contextual+" "+i.other)),c=r(i.typeDeclaration+" "+i.contextual+" "+i.other),l=r(i.type+" "+i.typeDeclaration+" "+i.other),u=n(/<(?:[^<>;=+\-*/%&|^]|<>)*>/.source,2),d=n(/\((?:[^()]|<>)*\)/.source,2),h=/@?\b[A-Za-z_]\w*\b/.source,p=e(/<<0>>(?:\s*<<1>>)?/.source,[h,u]),g=e(/(?!<<0>>)<<1>>(?:\s*\.\s*<<1>>)*/.source,[c,p]),v=/\[\s*(?:,\s*)*\]/.source,m=e(/<<0>>(?:\s*(?:\?\s*)?<<1>>)*(?:\s*\?)?/.source,[g,v]),y=e(/[^,()<>[\];=+\-*/%&|^]|<<0>>|<<1>>|<<2>>/.source,[u,d,v]),_=e(/\(<<0>>+(?:,<<0>>+)+\)/.source,[y]),b=e(/(?:<<0>>|<<1>>)(?:\s*(?:\?\s*)?<<2>>)*(?:\s*\?)?/.source,[_,g,v]),k={keyword:a,punctuation:/[<>()?,.:[\]]/},w=/'(?:[^\r\n'\\]|\\.|\\[Uux][\da-fA-F]{1,8})'/.source,T=/"(?:\\.|[^\\"\r\n])*"/.source,A=/@"(?:""|\\[\s\S]|[^\\"])*"(?!")/.source;s.languages.csharp=s.languages.extend("clike",{string:[{pattern:t(/(^|[^$\\])<<0>>/.source,[A]),lookbehind:!0,greedy:!0},{pattern:t(/(^|[^@$\\])<<0>>/.source,[T]),lookbehind:!0,greedy:!0}],"class-name":[{pattern:t(/(\busing\s+static\s+)<<0>>(?=\s*;)/.source,[g]),lookbehind:!0,inside:k},{pattern:t(/(\busing\s+<<0>>\s*=\s*)<<1>>(?=\s*;)/.source,[h,b]),lookbehind:!0,inside:k},{pattern:t(/(\busing\s+)<<0>>(?=\s*=)/.source,[h]),lookbehind:!0},{pattern:t(/(\b<<0>>\s+)<<1>>/.source,[o,p]),lookbehind:!0,inside:k},{pattern:t(/(\bcatch\s*\(\s*)<<0>>/.source,[g]),lookbehind:!0,inside:k},{pattern:t(/(\bwhere\s+)<<0>>/.source,[h]),lookbehind:!0},{pattern:t(/(\b(?:is(?:\s+not)?|as)\s+)<<0>>/.source,[m]),lookbehind:!0,inside:k},{pattern:t(/\b<<0>>(?=\s+(?!<<1>>|with\s*\{)<<2>>(?:\s*[=,;:{)\]]|\s+(?:in|when)\b))/.source,[b,l,h]),inside:k}],keyword:a,number:/(?:\b0(?:x[\da-f_]*[\da-f]|b[01_]*[01])|(?:\B\.\d+(?:_+\d+)*|\b\d+(?:_+\d+)*(?:\.\d+(?:_+\d+)*)?)(?:e[-+]?\d+(?:_+\d+)*)?)(?:[dflmu]|lu|ul)?\b/i,operator:/>>=?|<<=?|[-=]>|([-+&|])\1|~|\?\?=?|[-+*/%&|^!=<>]=?/,punctuation:/\?\.?|::|[{}[\];(),.:]/}),s.languages.insertBefore("csharp","number",{range:{pattern:/\.\./,alias:"operator"}}),s.languages.insertBefore("csharp","punctuation",{"named-parameter":{pattern:t(/([(,]\s*)<<0>>(?=\s*:)/.source,[h]),lookbehind:!0,alias:"punctuation"}}),s.languages.insertBefore("csharp","class-name",{namespace:{pattern:t(/(\b(?:namespace|using)\s+)<<0>>(?:\s*\.\s*<<0>>)*(?=\s*[;{])/.source,[h]),lookbehind:!0,inside:{punctuation:/\./}},"type-expression":{pattern:t(/(\b(?:default|sizeof|typeof)\s*\(\s*(?!\s))(?:[^()\s]|\s(?!\s)|<<0>>)*(?=\s*\))/.source,[d]),lookbehind:!0,alias:"class-name",inside:k},"return-type":{pattern:t(/<<0>>(?=\s+(?:<<1>>\s*(?:=>|[({]|\.\s*this\s*\[)|this\s*\[))/.source,[b,g]),inside:k,alias:"class-name"},"constructor-invocation":{pattern:t(/(\bnew\s+)<<0>>(?=\s*[[({])/.source,[b]),lookbehind:!0,inside:k,alias:"class-name"},"generic-method":{pattern:t(/<<0>>\s*<<1>>(?=\s*\()/.source,[h,u]),inside:{function:t(/^<<0>>/.source,[h]),generic:{pattern:RegExp(u),alias:"class-name",inside:k}}},"type-list":{pattern:t(/\b((?:<<0>>\s+<<1>>|record\s+<<1>>\s*<<5>>|where\s+<<2>>)\s*:\s*)(?:<<3>>|<<4>>|<<1>>\s*<<5>>|<<6>>)(?:\s*,\s*(?:<<3>>|<<4>>|<<6>>))*(?=\s*(?:where|[{;]|=>|$))/.source,[o,p,h,b,a.source,d,/\bnew\s*\(\s*\)/.source]),lookbehind:!0,inside:{"record-arguments":{pattern:t(/(^(?!new\s*\()<<0>>\s*)<<1>>/.source,[p,d]),lookbehind:!0,greedy:!0,inside:s.languages.csharp},keyword:a,"class-name":{pattern:RegExp(b),greedy:!0,inside:k},punctuation:/[,()]/}},preprocessor:{pattern:/(^[\t ]*)#.*/m,lookbehind:!0,alias:"property",inside:{directive:{pattern:/(#)\b(?:define|elif|else|endif|endregion|error|if|line|nullable|pragma|region|undef|warning)\b/,lookbehind:!0,alias:"keyword"}}}});var C=T+"|"+w,E=e(/\/(?![*/])|\/\/[^\r\n]*[\r\n]|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>/.source,[C]),x=n(e(/[^"'/()]|<<0>>|\(<>*\)/.source,[E]),2),D=/\b(?:assembly|event|field|method|module|param|property|return|type)\b/.source,N=e(/<<0>>(?:\s*\(<<1>>*\))?/.source,[g,x]);s.languages.insertBefore("csharp","class-name",{attribute:{pattern:t(/((?:^|[^\s\w>)?])\s*\[\s*)(?:<<0>>\s*:\s*)?<<1>>(?:\s*,\s*<<1>>)*(?=\s*\])/.source,[D,N]),lookbehind:!0,greedy:!0,inside:{target:{pattern:t(/^<<0>>(?=\s*:)/.source,[D]),alias:"keyword"},"attribute-arguments":{pattern:t(/\(<<0>>*\)/.source,[x]),inside:s.languages.csharp},"class-name":{pattern:RegExp(g),inside:{punctuation:/\./}},punctuation:/[:,]/}}});var O=/:[^}\r\n]+/.source,G=n(e(/[^"'/()]|<<0>>|\(<>*\)/.source,[E]),2),Z=e(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source,[G,O]),q=n(e(/[^"'/()]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>|\(<>*\)/.source,[C]),2),V=e(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source,[q,O]);function I($,L){return{interpolation:{pattern:t(/((?:^|[^{])(?:\{\{)*)<<0>>/.source,[$]),lookbehind:!0,inside:{"format-string":{pattern:t(/(^\{(?:(?![}:])<<0>>)*)<<1>>(?=\}$)/.source,[L,O]),lookbehind:!0,inside:{punctuation:/^:/}},punctuation:/^\{|\}$/,expression:{pattern:/[\s\S]+/,alias:"language-csharp",inside:s.languages.csharp}}},string:/[\s\S]+/}}s.languages.insertBefore("csharp","string",{"interpolation-string":[{pattern:t(/(^|[^\\])(?:\$@|@\$)"(?:""|\\[\s\S]|\{\{|<<0>>|[^\\{"])*"/.source,[Z]),lookbehind:!0,greedy:!0,inside:I(Z,G)},{pattern:t(/(^|[^@\\])\$"(?:\\.|\{\{|<<0>>|[^\\"{])*"/.source,[V]),lookbehind:!0,greedy:!0,inside:I(V,q)}],char:{pattern:RegExp(w),greedy:!0}}),s.languages.dotnet=s.languages.cs=s.languages.csharp})(Prism);(function(s){s.languages.kotlin=s.languages.extend("clike",{keyword:{pattern:/(^|[^.])\b(?:abstract|actual|annotation|as|break|by|catch|class|companion|const|constructor|continue|crossinline|data|do|dynamic|else|enum|expect|external|final|finally|for|fun|get|if|import|in|infix|init|inline|inner|interface|internal|is|lateinit|noinline|null|object|open|operator|out|override|package|private|protected|public|reified|return|sealed|set|super|suspend|tailrec|this|throw|to|try|typealias|val|var|vararg|when|where|while)\b/,lookbehind:!0},function:[{pattern:/(?:`[^\r\n`]+`|\b\w+)(?=\s*\()/,greedy:!0},{pattern:/(\.)(?:`[^\r\n`]+`|\w+)(?=\s*\{)/,lookbehind:!0,greedy:!0}],number:/\b(?:0[xX][\da-fA-F]+(?:_[\da-fA-F]+)*|0[bB][01]+(?:_[01]+)*|\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?[fFL]?)\b/,operator:/\+[+=]?|-[-=>]?|==?=?|!(?:!|==?)?|[\/*%<>]=?|[?:]:?|\.\.|&&|\|\||\b(?:and|inv|or|shl|shr|ushr|xor)\b/}),delete s.languages.kotlin["class-name"];var e={"interpolation-punctuation":{pattern:/^\$\{?|\}$/,alias:"punctuation"},expression:{pattern:/[\s\S]+/,inside:s.languages.kotlin}};s.languages.insertBefore("kotlin","string",{"string-literal":[{pattern:/"""(?:[^$]|\$(?:(?!\{)|\{[^{}]*\}))*?"""/,alias:"multiline",inside:{interpolation:{pattern:/\$(?:[a-z_]\w*|\{[^{}]*\})/i,inside:e},string:/[\s\S]+/}},{pattern:/"(?:[^"\\\r\n$]|\\.|\$(?:(?!\{)|\{[^{}]*\}))*"/,alias:"singleline",inside:{interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$(?:[a-z_]\w*|\{[^{}]*\})/i,lookbehind:!0,inside:e},string:/[\s\S]+/}}],char:{pattern:/'(?:[^'\\\r\n]|\\(?:.|u[a-fA-F0-9]{0,4}))'/,greedy:!0}}),delete s.languages.kotlin.string,s.languages.insertBefore("kotlin","keyword",{annotation:{pattern:/\B@(?:\w+:)?(?:[A-Z]\w*|\[[^\]]+\])/,alias:"builtin"}}),s.languages.insertBefore("kotlin","function",{label:{pattern:/\b\w+@|@\w+\b/,alias:"symbol"}}),s.languages.kt=s.languages.kotlin,s.languages.kts=s.languages.kotlin})(Prism);Prism.languages.swift={comment:{pattern:/(^|[^\\:])(?:\/\/.*|\/\*(?:[^/*]|\/(?!\*)|\*(?!\/)|\/\*(?:[^*]|\*(?!\/))*\*\/)*\*\/)/,lookbehind:!0,greedy:!0},"string-literal":[{pattern:RegExp(/(^|[^"#])/.source+"(?:"+/"(?:\\(?:\((?:[^()]|\([^()]*\))*\)|\r\n|[^(])|[^\\\r\n"])*"/.source+"|"+/"""(?:\\(?:\((?:[^()]|\([^()]*\))*\)|[^(])|[^\\"]|"(?!""))*"""/.source+")"+/(?!["#])/.source),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\\($/,alias:"punctuation"},punctuation:/\\(?=[\r\n])/,string:/[\s\S]+/}},{pattern:RegExp(/(^|[^"#])(#+)/.source+"(?:"+/"(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|\r\n|[^#])|[^\\\r\n])*?"/.source+"|"+/"""(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|[^#])|[^\\])*?"""/.source+")\\2"),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\#+\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\#+\($/,alias:"punctuation"},string:/[\s\S]+/}}],directive:{pattern:RegExp(/#/.source+"(?:"+(/(?:elseif|if)\b/.source+"(?:[ ]*"+/(?:![ \t]*)?(?:\b\w+\b(?:[ \t]*\((?:[^()]|\([^()]*\))*\))?|\((?:[^()]|\([^()]*\))*\))(?:[ \t]*(?:&&|\|\|))?/.source+")+")+"|"+/(?:else|endif)\b/.source+")"),alias:"property",inside:{"directive-name":/^#\w+/,boolean:/\b(?:false|true)\b/,number:/\b\d+(?:\.\d+)*\b/,operator:/!|&&|\|\||[<>]=?/,punctuation:/[(),]/}},literal:{pattern:/#(?:colorLiteral|column|dsohandle|file(?:ID|Literal|Path)?|function|imageLiteral|line)\b/,alias:"constant"},"other-directive":{pattern:/#\w+\b/,alias:"property"},attribute:{pattern:/@\w+/,alias:"atrule"},"function-definition":{pattern:/(\bfunc\s+)\w+/,lookbehind:!0,alias:"function"},label:{pattern:/\b(break|continue)\s+\w+|\b[a-zA-Z_]\w*(?=\s*:\s*(?:for|repeat|while)\b)/,lookbehind:!0,alias:"important"},keyword:/\b(?:Any|Protocol|Self|Type|actor|as|assignment|associatedtype|associativity|async|await|break|case|catch|class|continue|convenience|default|defer|deinit|didSet|do|dynamic|else|enum|extension|fallthrough|fileprivate|final|for|func|get|guard|higherThan|if|import|in|indirect|infix|init|inout|internal|is|isolated|lazy|left|let|lowerThan|mutating|none|nonisolated|nonmutating|open|operator|optional|override|postfix|precedencegroup|prefix|private|protocol|public|repeat|required|rethrows|return|right|safe|self|set|some|static|struct|subscript|super|switch|throw|throws|try|typealias|unowned|unsafe|var|weak|where|while|willSet)\b/,boolean:/\b(?:false|true)\b/,nil:{pattern:/\bnil\b/,alias:"constant"},"short-argument":/\$\d+\b/,omit:{pattern:/\b_\b/,alias:"keyword"},number:/\b(?:[\d_]+(?:\.[\de_]+)?|0x[a-f0-9_]+(?:\.[a-f0-9p_]+)?|0b[01_]+|0o[0-7_]+)\b/i,"class-name":/\b[A-Z](?:[A-Z_\d]*[a-z]\w*)?\b/,function:/\b[a-z_]\w*(?=\s*\()/i,constant:/\b(?:[A-Z_]{2,}|k[A-Z][A-Za-z_]+)\b/,operator:/[-+*/%=!<>&|^~?]+|\.[.\-+*/%=!<>&|^~?]+/,punctuation:/[{}[\]();,.:\\]/};Prism.languages.swift["string-literal"].forEach(function(s){s.inside.interpolation.inside=Prism.languages.swift});Prism.languages.go=Prism.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,lookbehind:!0,greedy:!0},keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,boolean:/\b(?:_|false|iota|nil|true)\b/,number:[/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i],operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,builtin:/\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/});Prism.languages.insertBefore("go","string",{char:{pattern:/'(?:\\.|[^'\\\r\n]){0,10}'/,greedy:!0}});delete Prism.languages.go["class-name"];(function(s){for(var e=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|)*\*\//.source,t=0;t<2;t++)e=e.replace(//g,function(){return e});e=e.replace(//g,function(){return/[^\s\S]/.source}),s.languages.rust={comment:[{pattern:RegExp(/(^|[^\\])/.source+e),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:"attr-name",inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:"punctuation"},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:"symbol"},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:"punctuation"},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:"function"},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:"class-name"},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:"namespace"},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:"namespace",inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:"property"},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<>?=?|[@?]/},s.languages.rust["closure-params"].inside.rest=s.languages.rust,s.languages.rust.attribute.inside.string=s.languages.rust.string})(Prism);(function(s){var e=/\/\*[\s\S]*?\*\/|\/\/.*|#(?!\[).*/,t=[{pattern:/\b(?:false|true)\b/i,alias:"boolean"},{pattern:/(::\s*)\b[a-z_]\w*\b(?!\s*\()/i,greedy:!0,lookbehind:!0},{pattern:/(\b(?:case|const)\s+)\b[a-z_]\w*(?=\s*[;=])/i,greedy:!0,lookbehind:!0},/\b(?:null)\b/i,/\b[A-Z_][A-Z0-9_]*\b(?!\s*\()/],n=/\b0b[01]+(?:_[01]+)*\b|\b0o[0-7]+(?:_[0-7]+)*\b|\b0x[\da-f]+(?:_[\da-f]+)*\b|(?:\b\d+(?:_\d+)*\.?(?:\d+(?:_\d+)*)?|\B\.\d+)(?:e[+-]?\d+)?/i,i=/|\?\?=?|\.{3}|\??->|[!=]=?=?|::|\*\*=?|--|\+\+|&&|\|\||<<|>>|[?~]|[/^|%*&<>.+-]=?/,r=/[{}\[\](),:;]/;s.languages.php={delimiter:{pattern:/\?>$|^<\?(?:php(?=\s)|=)?/i,alias:"important"},comment:e,variable:/\$+(?:\w+\b|(?=\{))/,package:{pattern:/(namespace\s+|use\s+(?:function\s+)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,lookbehind:!0,inside:{punctuation:/\\/}},"class-name-definition":{pattern:/(\b(?:class|enum|interface|trait)\s+)\b[a-z_]\w*(?!\\)\b/i,lookbehind:!0,alias:"class-name"},"function-definition":{pattern:/(\bfunction\s+)[a-z_]\w*(?=\s*\()/i,lookbehind:!0,alias:"function"},keyword:[{pattern:/(\(\s*)\b(?:array|bool|boolean|float|int|integer|object|string)\b(?=\s*\))/i,alias:"type-casting",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|object|self|static|string)\b(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|never|object|self|static|string|void)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/\b(?:array(?!\s*\()|bool|float|int|iterable|mixed|object|string|void)\b/i,alias:"type-declaration",greedy:!0},{pattern:/(\|\s*)(?:false|null)\b|\b(?:false|null)(?=\s*\|)/i,alias:"type-declaration",greedy:!0,lookbehind:!0},{pattern:/\b(?:parent|self|static)(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(\byield\s+)from\b/i,lookbehind:!0},/\bclass\b/i,{pattern:/((?:^|[^\s>:]|(?:^|[^-])>|(?:^|[^:]):)\s*)\b(?:abstract|and|array|as|break|callable|case|catch|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|enum|eval|exit|extends|final|finally|fn|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|match|namespace|never|new|or|parent|print|private|protected|public|readonly|require|require_once|return|self|static|switch|throw|trait|try|unset|use|var|while|xor|yield|__halt_compiler)\b/i,lookbehind:!0}],"argument-name":{pattern:/([(,]\s*)\b[a-z_]\w*(?=\s*:(?!:))/i,lookbehind:!0},"class-name":[{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self|\s+static))\s+|\bcatch\s*\()\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/(\|\s*)\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/\b[a-z_]\w*(?!\\)\b(?=\s*\|)/i,greedy:!0},{pattern:/(\|\s*)(?:\\?\b[a-z_]\w*)+\b/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(?:\\?\b[a-z_]\w*)+\b(?=\s*\|)/i,alias:"class-name-fully-qualified",greedy:!0,inside:{punctuation:/\\/}},{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self\b|\s+static\b))\s+|\bcatch\s*\()(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*\$)/i,alias:"type-declaration",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-declaration"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*::)/i,alias:["class-name-fully-qualified","static-context"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/([(,?]\s*)[a-z_]\w*(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-hint"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b[a-z_]\w*(?!\\)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:["class-name-fully-qualified","return-type"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:t,function:{pattern:/(^|[^\\\w])\\?[a-z_](?:[\w\\]*\w)?(?=\s*\()/i,lookbehind:!0,inside:{punctuation:/\\/}},property:{pattern:/(->\s*)\w+/,lookbehind:!0},number:n,operator:i,punctuation:r};var o={pattern:/\{\$(?:\{(?:\{[^{}]+\}|[^{}]+)\}|[^{}])+\}|(^|[^\\{])\$+(?:\w+(?:\[[^\r\n\[\]]+\]|->\w+)?)/,lookbehind:!0,inside:s.languages.php},a=[{pattern:/<<<'([^']+)'[\r\n](?:.*[\r\n])*?\1;/,alias:"nowdoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<'[^']+'|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<'?|[';]$/}}}},{pattern:/<<<(?:"([^"]+)"[\r\n](?:.*[\r\n])*?\1;|([a-z_]\w*)[\r\n](?:.*[\r\n])*?\2;)/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<(?:"[^"]+"|[a-z_]\w*)|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<"?|[";]$/}},interpolation:o}},{pattern:/`(?:\\[\s\S]|[^\\`])*`/,alias:"backtick-quoted-string",greedy:!0},{pattern:/'(?:\\[\s\S]|[^\\'])*'/,alias:"single-quoted-string",greedy:!0},{pattern:/"(?:\\[\s\S]|[^\\"])*"/,alias:"double-quoted-string",greedy:!0,inside:{interpolation:o}}];s.languages.insertBefore("php","variable",{string:a,attribute:{pattern:/#\[(?:[^"'\/#]|\/(?![*/])|\/\/.*$|#(?!\[).*$|\/\*(?:[^*]|\*(?!\/))*\*\/|"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*')+\](?=\s*[a-z$#])/im,greedy:!0,inside:{"attribute-content":{pattern:/^(#\[)[\s\S]+(?=\]$)/,lookbehind:!0,inside:{comment:e,string:a,"attribute-class-name":[{pattern:/([^:]|^)\b[a-z_]\w*(?!\\)\b/i,alias:"class-name",greedy:!0,lookbehind:!0},{pattern:/([^:]|^)(?:\\?\b[a-z_]\w*)+/i,alias:["class-name","class-name-fully-qualified"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:t,number:n,operator:i,punctuation:r}},delimiter:{pattern:/^#\[|\]$/,alias:"punctuation"}}}}),s.hooks.add("before-tokenize",function(c){if(/<\?/.test(c.code)){var l=/<\?(?:[^"'/#]|\/(?![*/])|("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|(?:\/\/|#(?!\[))(?:[^?\n\r]|\?(?!>))*(?=$|\?>|[\r\n])|#\[|\/\*(?:[^*]|\*(?!\/))*(?:\*\/|$))*?(?:\?>|$)/g;s.languages["markup-templating"].buildPlaceholders(c,"php",l)}}),s.hooks.add("after-tokenize",function(c){s.languages["markup-templating"].tokenizePlaceholders(c,"php")})})(Prism);Prism.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/};Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest=Prism.languages.python;Prism.languages.py=Prism.languages.python;(function(s){s.languages.ruby=s.languages.extend("clike",{comment:{pattern:/#.*|^=begin\s[\s\S]*?^=end/m,greedy:!0},"class-name":{pattern:/(\b(?:class|module)\s+|\bcatch\s+\()[\w.\\]+|\b[A-Z_]\w*(?=\s*\.\s*new\b)/,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:BEGIN|END|alias|and|begin|break|case|class|def|define_method|defined|do|each|else|elsif|end|ensure|extend|for|if|in|include|module|new|next|nil|not|or|prepend|private|protected|public|raise|redo|require|rescue|retry|return|self|super|then|throw|undef|unless|until|when|while|yield)\b/,operator:/\.{2,3}|&\.|===||[!=]?~|(?:&&|\|\||<<|>>|\*\*|[+\-*/%<>!^&|=])=?|[?:]/,punctuation:/[(){}[\].,;]/}),s.languages.insertBefore("ruby","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}});var e={pattern:/((?:^|[^\\])(?:\\{2})*)#\{(?:[^{}]|\{[^{}]*\})*\}/,lookbehind:!0,inside:{content:{pattern:/^(#\{)[\s\S]+(?=\}$)/,lookbehind:!0,inside:s.languages.ruby},delimiter:{pattern:/^#\{|\}$/,alias:"punctuation"}}};delete s.languages.ruby.function;var t="(?:"+[/([^a-zA-Z0-9\s{(\[<=])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,/\((?:[^()\\]|\\[\s\S]|\((?:[^()\\]|\\[\s\S])*\))*\)/.source,/\{(?:[^{}\\]|\\[\s\S]|\{(?:[^{}\\]|\\[\s\S])*\})*\}/.source,/\[(?:[^\[\]\\]|\\[\s\S]|\[(?:[^\[\]\\]|\\[\s\S])*\])*\]/.source,/<(?:[^<>\\]|\\[\s\S]|<(?:[^<>\\]|\\[\s\S])*>)*>/.source].join("|")+")",n=/(?:"(?:\\.|[^"\\\r\n])*"|(?:\b[a-zA-Z_]\w*|[^\s\0-\x7F]+)[?!]?|\$.)/.source;s.languages.insertBefore("ruby","keyword",{"regex-literal":[{pattern:RegExp(/%r/.source+t+/[egimnosux]{0,6}/.source),greedy:!0,inside:{interpolation:e,regex:/[\s\S]+/}},{pattern:/(^|[^/])\/(?!\/)(?:\[[^\r\n\]]+\]|\\.|[^[/\\\r\n])+\/[egimnosux]{0,6}(?=\s*(?:$|[\r\n,.;})#]))/,lookbehind:!0,greedy:!0,inside:{interpolation:e,regex:/[\s\S]+/}}],variable:/[@$]+[a-zA-Z_]\w*(?:[?!]|\b)/,symbol:[{pattern:RegExp(/(^|[^:]):/.source+n),lookbehind:!0,greedy:!0},{pattern:RegExp(/([\r\n{(,][ \t]*)/.source+n+/(?=:(?!:))/.source),lookbehind:!0,greedy:!0}],"method-definition":{pattern:/(\bdef\s+)\w+(?:\s*\.\s*\w+)?/,lookbehind:!0,inside:{function:/\b\w+$/,keyword:/^self\b/,"class-name":/^\w+/,punctuation:/\./}}}),s.languages.insertBefore("ruby","string",{"string-literal":[{pattern:RegExp(/%[qQiIwWs]?/.source+t),greedy:!0,inside:{interpolation:e,string:/[\s\S]+/}},{pattern:/("|')(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|(?!\1)[^\\#\r\n])*\1/,greedy:!0,inside:{interpolation:e,string:/[\s\S]+/}},{pattern:/<<[-~]?([a-z_]\w*)[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?[a-z_]\w*|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?/}},interpolation:e,string:/[\s\S]+/}},{pattern:/<<[-~]?'([a-z_]\w*)'[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?'[a-z_]\w*'|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?'|'$/}},string:/[\s\S]+/}}],"command-literal":[{pattern:RegExp(/%x/.source+t),greedy:!0,inside:{interpolation:e,command:{pattern:/[\s\S]+/,alias:"string"}}},{pattern:/`(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|[^\\`#\r\n])*`/,greedy:!0,inside:{interpolation:e,command:{pattern:/[\s\S]+/,alias:"string"}}}]}),delete s.languages.ruby.string,s.languages.insertBefore("ruby","number",{builtin:/\b(?:Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Fixnum|Float|Hash|IO|Integer|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|Stat|String|Struct|Symbol|TMS|Thread|ThreadGroup|Time|TrueClass)\b/,constant:/\b[A-Z][A-Z0-9_]*(?:[?!]|\b)/}),s.languages.rb=s.languages.ruby})(Prism);(function(s){var e="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",t={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},n={bash:t,environment:{pattern:RegExp("\\$"+e),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+e),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};s.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+e),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:n},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:t}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:n},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:n.entity}}],environment:{pattern:RegExp("\\$?"+e),alias:"constant"},variable:n.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},t.inside=s.languages.bash;for(var i=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],r=n.variable[1].inside,o=0;o/,lookbehind:!0},{pattern:/(^|[^`])#.*/,lookbehind:!0}],string:[{pattern:/"(?:`[\s\S]|[^`"])*"/,greedy:!0,inside:null},{pattern:/'(?:[^']|'')*'/,greedy:!0}],namespace:/\[[a-z](?:\[(?:\[[^\]]*\]|[^\[\]])*\]|[^\[\]])*\]/i,boolean:/\$(?:false|true)\b/i,variable:/\$\w+\b/,function:[/\b(?:Add|Approve|Assert|Backup|Block|Checkpoint|Clear|Close|Compare|Complete|Compress|Confirm|Connect|Convert|ConvertFrom|ConvertTo|Copy|Debug|Deny|Disable|Disconnect|Dismount|Edit|Enable|Enter|Exit|Expand|Export|Find|ForEach|Format|Get|Grant|Group|Hide|Import|Initialize|Install|Invoke|Join|Limit|Lock|Measure|Merge|Move|New|Open|Optimize|Out|Ping|Pop|Protect|Publish|Push|Read|Receive|Redo|Register|Remove|Rename|Repair|Request|Reset|Resize|Resolve|Restart|Restore|Resume|Revoke|Save|Search|Select|Send|Set|Show|Skip|Sort|Split|Start|Step|Stop|Submit|Suspend|Switch|Sync|Tee|Test|Trace|Unblock|Undo|Uninstall|Unlock|Unprotect|Unpublish|Unregister|Update|Use|Wait|Watch|Where|Write)-[a-z]+\b/i,/\b(?:ac|cat|chdir|clc|cli|clp|clv|compare|copy|cp|cpi|cpp|cvpa|dbp|del|diff|dir|ebp|echo|epal|epcsv|epsn|erase|fc|fl|ft|fw|gal|gbp|gc|gci|gcs|gdr|gi|gl|gm|gp|gps|group|gsv|gu|gv|gwmi|iex|ii|ipal|ipcsv|ipsn|irm|iwmi|iwr|kill|lp|ls|measure|mi|mount|move|mp|mv|nal|ndr|ni|nv|ogv|popd|ps|pushd|pwd|rbp|rd|rdr|ren|ri|rm|rmdir|rni|rnp|rp|rv|rvpa|rwmi|sal|saps|sasv|sbp|sc|select|set|shcm|si|sl|sleep|sls|sort|sp|spps|spsv|start|sv|swmi|tee|trcm|type|write)\b/i],keyword:/\b(?:Begin|Break|Catch|Class|Continue|Data|Define|Do|DynamicParam|Else|ElseIf|End|Exit|Filter|Finally|For|ForEach|From|Function|If|InlineScript|Parallel|Param|Process|Return|Sequence|Switch|Throw|Trap|Try|Until|Using|Var|While|Workflow)\b/i,operator:{pattern:/(^|\W)(?:!|-(?:b?(?:and|x?or)|as|(?:Not)?(?:Contains|In|Like|Match)|eq|ge|gt|is(?:Not)?|Join|le|lt|ne|not|Replace|sh[lr])\b|-[-=]?|\+[+=]?|[*\/%]=?)/i,lookbehind:!0},punctuation:/[|{}[\];(),.]/};e.string[0].inside={function:{pattern:/(^|[^`])\$\((?:\$\([^\r\n()]*\)|(?!\$\()[^\r\n)])*\)/,lookbehind:!0,inside:e},boolean:e.boolean,variable:e.variable}})(Prism);(function(s){var e=/%%?[~:\w]+%?|!\S+!/,t={pattern:/\/[a-z?]+(?=[ :]|$):?|-[a-z]\b|--[a-z-]+\b/im,alias:"attr-name",inside:{punctuation:/:/}},n=/"(?:[\\"]"|[^"])*"(?!")/,i=/(?:\b|-)\d+\b/;s.languages.batch={comment:[/^::.*/m,{pattern:/((?:^|[&(])[ \t]*)rem\b(?:[^^&)\r\n]|\^(?:\r\n|[\s\S]))*/im,lookbehind:!0}],label:{pattern:/^:.*/m,alias:"property"},command:[{pattern:/((?:^|[&(])[ \t]*)for(?: \/[a-z?](?:[ :](?:"[^"]*"|[^\s"/]\S*))?)* \S+ in \([^)]+\) do/im,lookbehind:!0,inside:{keyword:/\b(?:do|in)\b|^for\b/i,string:n,parameter:t,variable:e,number:i,punctuation:/[()',]/}},{pattern:/((?:^|[&(])[ \t]*)if(?: \/[a-z?](?:[ :](?:"[^"]*"|[^\s"/]\S*))?)* (?:not )?(?:cmdextversion \d+|defined \w+|errorlevel \d+|exist \S+|(?:"[^"]*"|(?!")(?:(?!==)\S)+)?(?:==| (?:equ|geq|gtr|leq|lss|neq) )(?:"[^"]*"|[^\s"]\S*))/im,lookbehind:!0,inside:{keyword:/\b(?:cmdextversion|defined|errorlevel|exist|not)\b|^if\b/i,string:n,parameter:t,variable:e,number:i,operator:/\^|==|\b(?:equ|geq|gtr|leq|lss|neq)\b/i}},{pattern:/((?:^|[&()])[ \t]*)else\b/im,lookbehind:!0,inside:{keyword:/^else\b/i}},{pattern:/((?:^|[&(])[ \t]*)set(?: \/[a-z](?:[ :](?:"[^"]*"|[^\s"/]\S*))?)* (?:[^^&)\r\n]|\^(?:\r\n|[\s\S]))*/im,lookbehind:!0,inside:{keyword:/^set\b/i,string:n,parameter:t,variable:[e,/\w+(?=(?:[*\/%+\-&^|]|<<|>>)?=)/],number:i,operator:/[*\/%+\-&^|]=?|<<=?|>>=?|[!~_=]/,punctuation:/[()',]/}},{pattern:/((?:^|[&(])[ \t]*@?)\w+\b(?:"(?:[\\"]"|[^"])*"(?!")|[^"^&)\r\n]|\^(?:\r\n|[\s\S]))*/m,lookbehind:!0,inside:{keyword:/^\w+\b/,string:n,parameter:t,label:{pattern:/(^\s*):\S+/m,lookbehind:!0,alias:"property"},variable:e,number:i,operator:/\^/}}],operator:/[&@]/,punctuation:/[()']/}})(Prism);(function(s){var e=/[*&][^\s[\]{},]+/,t=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,n="(?:"+t.source+"(?:[ ]+"+e.source+")?|"+e.source+"(?:[ ]+"+t.source+")?)",i=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-])(?:[ \t]*(?:(?![#:])|:))*/.source.replace(//g,function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source}),r=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function o(a,c){c=(c||"").replace(/m/g,"")+"m";var l=/([:\-,[{]\s*(?:\s<>[ \t]+)?)(?:<>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<>/g,function(){return n}).replace(/<>/g,function(){return a});return RegExp(l,c)}s.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<>/g,function(){return n})),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<>[ \t]+)?)<>(?=\s*:\s)/.source.replace(/<>/g,function(){return n}).replace(/<>/g,function(){return"(?:"+i+"|"+r+")"})),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:o(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:o(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:o(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:o(r),lookbehind:!0,greedy:!0},number:{pattern:o(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:t,important:e,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},s.languages.yml=s.languages.yaml})(Prism);Prism.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}};Prism.languages.webmanifest=Prism.languages.json;Prism.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/};Prism.languages.scss=Prism.languages.extend("css",{comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},atrule:{pattern:/@[\w-](?:\([^()]+\)|[^()\s]|\s+(?!\s))*?(?=\s+[{;])/,inside:{rule:/@[\w-]+/}},url:/(?:[-a-z]+-)?url(?=\()/i,selector:{pattern:/(?=\S)[^@;{}()]?(?:[^@;{}()\s]|\s+(?!\s)|#\{\$[-\w]+\})+(?=\s*\{(?:\}|\s|[^}][^:{}]*[:{][^}]))/,inside:{parent:{pattern:/&/,alias:"important"},placeholder:/%[-\w]+/,variable:/\$[-\w]+|#\{\$[-\w]+\}/}},property:{pattern:/(?:[-\w]|\$[-\w]|#\{\$[-\w]+\})+(?=\s*:)/,inside:{variable:/\$[-\w]+|#\{\$[-\w]+\}/}}});Prism.languages.insertBefore("scss","atrule",{keyword:[/@(?:content|debug|each|else(?: if)?|extend|for|forward|function|if|import|include|mixin|return|use|warn|while)\b/i,{pattern:/( )(?:from|through)(?= )/,lookbehind:!0}]});Prism.languages.insertBefore("scss","important",{variable:/\$[-\w]+|#\{\$[-\w]+\}/});Prism.languages.insertBefore("scss","function",{"module-modifier":{pattern:/\b(?:as|hide|show|with)\b/i,alias:"keyword"},placeholder:{pattern:/%[-\w]+/,alias:"selector"},statement:{pattern:/\B!(?:default|optional)\b/i,alias:"keyword"},boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"},operator:{pattern:/(\s)(?:[-+*\/%]|[=!]=|<=?|>=?|and|not|or)(?=\s)/,lookbehind:!0}});Prism.languages.scss.atrule.inside.rest=Prism.languages.scss;(function(s){s.languages.sass=s.languages.extend("css",{comment:{pattern:/^([ \t]*)\/[\/*].*(?:(?:\r?\n|\r)\1[ \t].+)*/m,lookbehind:!0,greedy:!0}}),s.languages.insertBefore("sass","atrule",{"atrule-line":{pattern:/^(?:[ \t]*)[@+=].+/m,greedy:!0,inside:{atrule:/(?:@[\w-]+|[+=])/}}}),delete s.languages.sass.atrule;var e=/\$[-\w]+|#\{\$[-\w]+\}/,t=[/[+*\/%]|[=!]=|<=?|>=?|\b(?:and|not|or)\b/,{pattern:/(\s)-(?=\s)/,lookbehind:!0}];s.languages.insertBefore("sass","property",{"variable-line":{pattern:/^[ \t]*\$.+/m,greedy:!0,inside:{punctuation:/:/,variable:e,operator:t}},"property-line":{pattern:/^[ \t]*(?:[^:\s]+ *:.*|:[^:\s].*)/m,greedy:!0,inside:{property:[/[^:\s]+(?=\s*:)/,{pattern:/(:)[^:\s]+/,lookbehind:!0}],punctuation:/:/,variable:e,operator:t,important:s.languages.sass.important}}}),delete s.languages.sass.property,delete s.languages.sass.important,s.languages.insertBefore("sass","punctuation",{selector:{pattern:/^([ \t]*)\S(?:,[^,\r\n]+|[^,\r\n]*)(?:,[^,\r\n]+)*(?:,(?:\r?\n|\r)\1[ \t]+\S(?:,[^,\r\n]+|[^,\r\n]*)(?:,[^,\r\n]+)*)*/m,lookbehind:!0,greedy:!0}})})(Prism);Prism.languages.less=Prism.languages.extend("css",{comment:[/\/\*[\s\S]*?\*\//,{pattern:/(^|[^\\])\/\/.*/,lookbehind:!0}],atrule:{pattern:/@[\w-](?:\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};\s]|\s+(?!\s))*?(?=\s*\{)/,inside:{punctuation:/[:()]/}},selector:{pattern:/(?:@\{[\w-]+\}|[^{};\s@])(?:@\{[\w-]+\}|\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};@\s]|\s+(?!\s))*?(?=\s*\{)/,inside:{variable:/@+[\w-]+/}},property:/(?:@\{[\w-]+\}|[\w-])+(?:\+_?)?(?=\s*:)/,operator:/[+\-*\/]/});Prism.languages.insertBefore("less","property",{variable:[{pattern:/@[\w-]+\s*:/,inside:{punctuation:/:/}},/@@?[\w-]+/],"mixin-usage":{pattern:/([{;]\s*)[.#](?!\d)[\w-].*?(?=[(;])/,lookbehind:!0,alias:"function"}});(function(s){s.languages.typescript=s.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),s.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete s.languages.typescript.parameter,delete s.languages.typescript["literal-property"];var e=s.languages.extend("typescript",{});delete e["class-name"],s.languages.typescript["class-name"].inside=e,s.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:e}}}}),s.languages.ts=s.languages.typescript})(Prism);(function(s){var e=s.util.clone(s.languages.javascript),t=/(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source,n=/(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source,i=/(?:\{*\.{3}(?:[^{}]|)*\})/.source;function r(c,l){return c=c.replace(//g,function(){return t}).replace(//g,function(){return n}).replace(//g,function(){return i}),RegExp(c,l)}i=r(i).source,s.languages.jsx=s.languages.extend("markup",e),s.languages.jsx.tag.pattern=r(/<\/?(?:[\w.:-]+(?:+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|))?|))**\/?)?>/.source),s.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,s.languages.jsx.tag.inside["attr-value"].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,s.languages.jsx.tag.inside.tag.inside["class-name"]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,s.languages.jsx.tag.inside.comment=e.comment,s.languages.insertBefore("inside","attr-name",{spread:{pattern:r(//.source),inside:s.languages.jsx}},s.languages.jsx.tag),s.languages.insertBefore("inside","special-attr",{script:{pattern:r(/=/.source),alias:"language-javascript",inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:"punctuation"},rest:s.languages.jsx}}},s.languages.jsx.tag);var o=function(c){return c?typeof c=="string"?c:typeof c.content=="string"?c.content:c.content.map(o).join(""):""},a=function(c){for(var l=[],u=0;u0&&l[l.length-1].tagName===o(d.content[0].content[1])&&l.pop():d.content[d.content.length-1].content==="/>"||l.push({tagName:o(d.content[0].content[1]),openedBraces:0}):l.length>0&&d.type==="punctuation"&&d.content==="{"?l[l.length-1].openedBraces++:l.length>0&&l[l.length-1].openedBraces>0&&d.type==="punctuation"&&d.content==="}"?l[l.length-1].openedBraces--:h=!0),(h||typeof d=="string")&&l.length>0&&l[l.length-1].openedBraces===0){var p=o(d);u0&&(typeof c[u-1]=="string"||c[u-1].type==="plain-text")&&(p=o(c[u-1])+p,c.splice(u-1,1),u--),c[u]=new s.Token("plain-text",p,null,p)}d.content&&typeof d.content!="string"&&a(d.content)}};s.hooks.add("after-tokenize",function(c){c.language!=="jsx"&&c.language!=="tsx"||a(c.tokens)})})(Prism);(function(s){var e=s.util.clone(s.languages.typescript);s.languages.tsx=s.languages.extend("jsx",e),delete s.languages.tsx.parameter,delete s.languages.tsx["literal-property"];var t=s.languages.tsx.tag;t.pattern=RegExp(/(^|[^\w$]|(?=<\/))/.source+"(?:"+t.pattern.source+")",t.pattern.flags),t.lookbehind=!0})(Prism);(function(s){var e=/(?:[\w-]+|'[^'\n\r]*'|"(?:\\.|[^\\"\r\n])*")/.source;function t(n){return n.replace(/__/g,function(){return e})}s.languages.toml={comment:{pattern:/#.*/,greedy:!0},table:{pattern:RegExp(t(/(^[\t ]*\[\s*(?:\[\s*)?)__(?:\s*\.\s*__)*(?=\s*\])/.source),"m"),lookbehind:!0,greedy:!0,alias:"class-name"},key:{pattern:RegExp(t(/(^[\t ]*|[{,]\s*)__(?:\s*\.\s*__)*(?=\s*=)/.source),"m"),lookbehind:!0,greedy:!0,alias:"property"},string:{pattern:/"""(?:\\[\s\S]|[^\\])*?"""|'''[\s\S]*?'''|'[^'\n\r]*'|"(?:\\.|[^\\"\r\n])*"/,greedy:!0},date:[{pattern:/\b\d{4}-\d{2}-\d{2}(?:[T\s]\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})?)?\b/i,alias:"number"},{pattern:/\b\d{2}:\d{2}:\d{2}(?:\.\d+)?\b/,alias:"number"}],number:/(?:\b0(?:x[\da-zA-Z]+(?:_[\da-zA-Z]+)*|o[0-7]+(?:_[0-7]+)*|b[10]+(?:_[10]+)*))\b|[-+]?\b\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?\b|[-+]?\b(?:inf|nan)\b/,boolean:/\b(?:false|true)\b/,punctuation:/[.,=[\]{}]/}})(Prism);Prism.languages.ini={comment:{pattern:/(^[ \f\t\v]*)[#;][^\n\r]*/m,lookbehind:!0},section:{pattern:/(^[ \f\t\v]*)\[[^\n\r\]]*\]?/m,lookbehind:!0,inside:{"section-name":{pattern:/(^\[[ \f\t\v]*)[^ \f\t\v\]]+(?:[ \f\t\v]+[^ \f\t\v\]]+)*/,lookbehind:!0,alias:"selector"},punctuation:/\[|\]/}},key:{pattern:/(^[ \f\t\v]*)[^ \f\n\r\t\v=]+(?:[ \f\t\v]+[^ \f\n\r\t\v=]+)*(?=[ \f\t\v]*=)/m,lookbehind:!0,alias:"attr-name"},value:{pattern:/(=[ \f\t\v]*)[^ \f\n\r\t\v]+(?:[ \f\t\v]+[^ \f\n\r\t\v]+)*/,lookbehind:!0,alias:"attr-value",inside:{"inner-value":{pattern:/^("|').+(?=\1$)/,lookbehind:!0}}},punctuation:/=/};(function(s){var e=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function t(u){return u=u.replace(//g,function(){return e}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+u+")")}var n=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,i=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return n}),r=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;s.languages.markdown=s.languages.extend("markup",{}),s.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:s.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+i+r+"(?:"+i+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+i+r+")(?:"+i+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(n),inside:s.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+i+")"+r+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+i+"$"),inside:{"table-header":{pattern:RegExp(n),alias:"important",inside:s.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:t(/\b__(?:(?!_)|_(?:(?!_))+_)+__\b|\*\*(?:(?!\*)|\*(?:(?!\*))+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:t(/\b_(?:(?!_)|__(?:(?!_))+__)+_\b|\*(?:(?!\*)|\*\*(?:(?!\*))+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:t(/(~~?)(?:(?!~))+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:t(/!?\[(?:(?!\]))+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\]))+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(u){["url","bold","italic","strike","code-snippet"].forEach(function(d){u!==d&&(s.languages.markdown[u].inside.content.inside[d]=s.languages.markdown[d])})}),s.hooks.add("after-tokenize",function(u){if(u.language!=="markdown"&&u.language!=="md")return;function d(h){if(!(!h||typeof h=="string"))for(var p=0,g=h.length;p",quot:'"'},c=String.fromCodePoint||String.fromCharCode;function l(u){var d=u.replace(o,"");return d=d.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,function(h,p){if(p=p.toLowerCase(),p[0]==="#"){var g;return p[1]==="x"?g=parseInt(p.slice(2),16):g=Number(p.slice(1)),c(g)}else{var v=a[p];return v||h}}),d}s.languages.md=s.languages.markdown})(Prism);const Nte={".js":"javascript",".mjs":"javascript",".cjs":"javascript",".jsx":"jsx",".ts":"typescript",".mts":"typescript",".cts":"typescript",".tsx":"tsx",".vue":"markup",".py":"python",".rb":"ruby",".go":"go",".rs":"rust",".java":"java",".c":"c",".h":"c",".cpp":"cpp",".hpp":"cpp",".cc":"cpp",".hh":"cpp",".cxx":"cpp",".cs":"csharp",".php":"php",".swift":"swift",".kt":"kotlin",".kts":"kotlin",".sh":"bash",".bash":"bash",".zsh":"bash",".ps1":"powershell",".bat":"batch",".cmd":"batch",".html":"markup",".htm":"markup",".xhtml":"markup",".xml":"markup",".svg":"markup",".css":"css",".scss":"scss",".sass":"sass",".less":"less",".json":"json",".json5":"json",".yaml":"yaml",".yml":"yaml",".toml":"toml",".ini":"ini",".cfg":"ini",".conf":"ini",".sql":"sql",".md":"markdown",".markdown":"markdown"};function ZD(s){const e=s.split("/").pop()||"",t=e.lastIndexOf(".");if(t<0)return null;const n=e.slice(t).toLowerCase();return Nte[n]||null}function $te(s){return s.replace(/&/g,"&").replace(//g,">")}function O1(s,e){if(e){const t=PS.languages[e];if(t)try{return PS.highlight(s,t,e)}catch{}}return $te(s)}const Bte=["default-src 'none'","script-src 'unsafe-inline' https:","style-src 'unsafe-inline' https:","img-src data: blob: https:","font-src data: https:","media-src data: blob: https:","connect-src 'none'","form-action 'none'","base-uri 'none'","frame-src 'none'","child-src 'none'","worker-src 'none'","object-src 'none'"].join("; "),Fte=`(function () { 'use strict'; if (window.__astrionSandboxGuard) return; window.__astrionSandboxGuard = true; function scrollingContainerList(el) { var list = []; var node = el.parentElement; while (node && node !== document.body && node !== document.documentElement) { var s = window.getComputedStyle(node); if (/(auto|scroll|overlay)/.test(String(s.overflow) + String(s.overflowY) + String(s.overflowX))) { list.push(node); } node = node.parentElement; } list.push(document.scrollingElement || document.documentElement); return list; } function scrollOneContainer(container, el, block) { var isRoot = container === (document.scrollingElement || document.documentElement); var eRect = el.getBoundingClientRect(); var viewH = isRoot ? window.innerHeight : container.clientHeight; var top = isRoot ? eRect.top : eRect.top - container.getBoundingClientRect().top; var bottom = top + eRect.height; var delta = 0; if (block === 'start') delta = top; else if (block === 'end') delta = bottom - viewH; else if (block === 'center') delta = top - (viewH - eRect.height) / 2; else if (top < 0) delta = top; else if (bottom > viewH) delta = Math.min(bottom - viewH, top); if (delta) container.scrollTop += delta; } function localScrollIntoView(el, arg) { var block = 'start'; if (arg === false) block = 'end'; else if (arg && typeof arg === 'object' && typeof arg.block === 'string') block = arg.block; var containers = scrollingContainerList(el); for (var i = 0; i < containers.length; i++) { scrollOneContainer(containers[i], el, block); } } Element.prototype.scrollIntoView = function (arg) { localScrollIntoView(this, arg); }; if ('scrollIntoViewIfNeeded' in Element.prototype) { Element.prototype.scrollIntoViewIfNeeded = function () { localScrollIntoView(this, { block: 'nearest' }); }; } var origFocus = HTMLElement.prototype.focus; HTMLElement.prototype.focus = function (options) { var opts = options && typeof options === 'object' ? Object.assign({}, options, { preventScroll: true }) : { preventScroll: true }; origFocus.call(this, opts); localScrollIntoView(this, { block: 'nearest' }); }; document.addEventListener('click', function (ev) { var t = ev.target; var anchor = t && t.closest ? t.closest('a[href^="#"]') : null; if (!anchor) return; var id = (anchor.getAttribute('href') || '').slice(1); ev.preventDefault(); if (!id) return; var target = document.getElementById(id); if (target) { // Remove the id first so the hash update does not trigger the browser's default anchor scroll target.removeAttribute('id'); try { window.location.hash = id; } catch (err) { /* ignore under opaque origin */ } target.setAttribute('id', id); localScrollIntoView(target, { block: 'start' }); } else { try { window.location.hash = id; } catch (err) { /* ignore */ } } }, true); function patchFrame(win) { try { win.Element.prototype.scrollIntoView = Element.prototype.scrollIntoView; win.HTMLElement.prototype.focus = HTMLElement.prototype.focus; } catch (err) { /* skip cross-origin child frames */ } } new MutationObserver(function (mutations) { for (var i = 0; i < mutations.length; i++) { var added = mutations[i].addedNodes; for (var j = 0; j < added.length; j++) { var n = added[j]; if (!n || n.nodeType !== 1) continue; var frames = []; if (n.tagName === 'IFRAME' || n.tagName === 'FRAME') frames.push(n); if (n.querySelectorAll) { var found = n.querySelectorAll('iframe,frame'); for (var k = 0; k < found.length; k++) frames.push(found[k]); } for (var m = 0; m < frames.length; m++) { if (frames[m].contentWindow) patchFrame(frames[m].contentWindow); } } } }).observe(document.documentElement, { childList: true, subtree: true }); })();`;function eN(){return`