@sciol/xyzen 1.9.77-beta.2aac5ec → 1.9.77-beta.2dcdf11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/xyzen.es.js +7 -7
- package/dist/xyzen.umd.js +2 -2
- package/package.json +1 -1
package/dist/xyzen.umd.js
CHANGED
|
@@ -106,7 +106,7 @@ border-radius:50%;animation:spin .8s linear infinite;margin:0 auto}
|
|
|
106
106
|
`)){if(o.startsWith(":"))continue;const l=o.indexOf(":");if(l===-1)continue;const u=o.slice(0,l),d=o.slice(l+1).trimStart();switch(u){case"id":i.id=d;break;case"event":i.event=d;break;case"data":i.data=i.data?`${i.data}
|
|
107
107
|
${d}`:d;break}}(i.data!==void 0||i.event!==void 0)&&(yield{event:i,remaining:e})}yield{event:{},remaining:e}}class hOn{connections=new Map;retryTimeouts=new Map;constructor(){setTimeout(()=>{try{Ed().visibility.onVisible(()=>{this._retryAllPending()})}catch{typeof document<"u"&&document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&this._retryAllPending()})}},0)}_retryAllPending(){for(const[e,n]of this.retryTimeouts){clearTimeout(n),this.retryTimeouts.delete(e);const r=this.connections.get(e);r&&(r.retryCount=0,r.controller=new AbortController,this._startStream(r))}}get baseUrl(){const e=Ed().env.backendUrl;return(!e||e==="")&&typeof window<"u"?`${window.location.protocol}//${window.location.host}`:e}connect(e,n){this.disconnect(e);const r=new AbortController,i={topicId:e,controller:r,lastEventId:null,retryCount:0,callbacks:n};this.connections.set(e,i),this._startStream(i)}disconnect(e){const n=this.connections.get(e);n&&(n.controller.abort(),this.connections.delete(e));const r=this.retryTimeouts.get(e);r&&(clearTimeout(r),this.retryTimeouts.delete(e))}disconnectAll(){for(const e of[...this.connections.keys()])this.disconnect(e)}getOpenTopicIds(){return[...this.connections.keys()]}hasConnection(e){return this.connections.has(e)}updateCallbacks(e,n){const r=this.connections.get(e);return r?(r.callbacks=n,!0):!1}async _startStream(e){const{topicId:n,controller:r,callbacks:i}=e,o=Eo.getToken();if(!o){i.onStatusChange({connected:!1,error:"Authentication required"});return}const l={Authorization:`Bearer ${o}`,Accept:"text/event-stream"};e.lastEventId&&(l["Last-Event-ID"]=e.lastEventId);const u=`${this.baseUrl}/xyzen/api/v1/topics/${n}/events`;try{const d=Ed().streamingFetch,p=await d(u,{headers:l,signal:r.signal});if(!p.ok){if(p.status===401){Eo.removeToken(),i.onStatusChange({connected:!1,error:"Authentication failed"}),l5n();return}throw new Error(`SSE HTTP ${p.status}`)}if(!p.body)throw new Error("SSE response has no body");e.retryCount=0,i.onStatusChange({connected:!0});const m=p.body.getReader(),g=new TextDecoder;let h="";for(;;){const{done:f,value:b}=await m.read();if(f)break;h+=g.decode(b,{stream:!0});let y=h;for(const{event:v,remaining:_}of gOn(h))if(y=_,v.data!==void 0){v.id&&(e.lastEventId=v.id);try{const w=JSON.parse(v.data),x=v.event||w.type||"message";i.onMessageEvent({type:x,data:w.data!==void 0?w.data:w})}catch{console.warn("SSE: failed to parse event data",v.data)}}h=y}this._handleDisconnect(e)}catch(d){if(r.signal.aborted)return;console.error(`SSE error for topic ${n}:`,d),this._handleDisconnect(e)}}_handleDisconnect(e){const{topicId:n,callbacks:r}=e;if(this.connections.get(n)!==e)return;if(r.onStatusChange({connected:!1}),e.retryCount>=dOn){r.onStatusChange({connected:!1,error:"Connection closed. Please refresh the page."}),this.connections.delete(n);return}const i=Math.min(pOn*Math.pow(2,e.retryCount),mOn);e.retryCount++,e.controller=new AbortController;const o=setTimeout(()=>{this.retryTimeouts.delete(n),this.connections.get(n)===e&&this._startStream(e)},i);this.retryTimeouts.set(n,o)}}const Qb=new hOn;class fOn{async createTopic(e){return on.post("/xyzen/api/v1/topics/",e)}async updateTopic(e,n){return on.put(`/xyzen/api/v1/topics/${e}`,n)}async deleteTopic(e){return on.delete(`/xyzen/api/v1/topics/${e}`)}async getMessages(e,n){const r=new URLSearchParams;n?.before&&r.set("before",n.before),n?.limit&&r.set("limit",String(n.limit));const i=r.toString();return on.get(`/xyzen/api/v1/topics/${e}/messages${i?`?${i}`:""}`)}async getMessageNav(e){return on.get(`/xyzen/api/v1/topics/${e}/message-nav`)}async getTokenStats(e){return on.get(`/xyzen/api/v1/topics/${e}/token-stats`)}async compactTopic(e,n){return on.post(`/xyzen/api/v1/topics/${e}/compact`,n?{up_to_message_id:n}:{})}async sendMessage(e,n){return on.post(`/xyzen/api/v1/topics/${e}/messages`,n)}async abort(e){return on.post(`/xyzen/api/v1/topics/${e}/abort`)}async regenerate(e){return on.post(`/xyzen/api/v1/topics/${e}/regenerate`)}async answerQuestion(e,n){return on.post(`/xyzen/api/v1/topics/${e}/question-response`,n)}}const dg=new fOn,ix=787,qv="Asia/Shanghai",zxe=576,Uxe=640,SN="app.chatConfig.defaultTitle",sot="/workspace";class AOn{getProviderDisplayName(e){return{openai:"OpenAI",azure_openai:"Azure OpenAI",google:"Google",google_vertex:"Google Vertex AI"}[e]||e}async getProviderTemplates(){const e=await on.get("/xyzen/api/v1/providers/templates",{auth:!1});return Object.entries(e).map(([n,r])=>({type:n,display_name:this.getProviderDisplayName(n),models:r}))}async getSupportedModels(){return on.get("/xyzen/api/v1/providers/models",{auth:!1})}async getAvailableModels(){return on.get("/xyzen/api/v1/providers/available-models")}async getTierModels(){return on.get("/xyzen/api/v1/providers/tier-models")}async getDefaultModelConfig(){return on.get("/xyzen/api/v1/providers/default-model",{auth:!1})}async getMyProviders(){return on.get("/xyzen/api/v1/providers/me")}async getSystemProviders(){return on.get("/xyzen/api/v1/providers/system")}async createProvider(e){return on.post("/xyzen/api/v1/providers/",e)}async getProvider(e){return on.get(`/xyzen/api/v1/providers/${e}`)}async updateProvider(e,n){return on.patch(`/xyzen/api/v1/providers/${e}`,n)}async deleteProvider(e){return on.delete(`/xyzen/api/v1/providers/${e}`)}}const N7=new AOn;class bOn{defaultModelConfig=null;defaultModelConfigPromise=null;async getDefaultModelConfig(){return this.defaultModelConfig?this.defaultModelConfig:this.defaultModelConfigPromise?this.defaultModelConfigPromise:(this.defaultModelConfigPromise=N7.getDefaultModelConfig().then(e=>(this.defaultModelConfig=e,this.defaultModelConfigPromise=null,e)).catch(e=>{throw console.error("Failed to fetch default model config:",e),this.defaultModelConfigPromise=null,e}),this.defaultModelConfigPromise)}async getDefaultSystemProviderId(e){try{const n=await this.getDefaultModelConfig();return e.find(i=>i.provider_type===n.provider_type&&i.is_system)?.id||null}catch(n){return console.error("Failed to get default system provider:",n),null}}async getDefaultModelName(){try{return(await this.getDefaultModelConfig()).key}catch(e){return console.error("Failed to get default model name:",e),null}}async getDefaultProviderAndModel(e){try{const n=await this.getDefaultModelConfig(),r={openai:"openai",azure:"azure_openai",google:"google",vertex_ai:"google_vertex","vertex_ai-language-models":"google_vertex"};let i=e.find(o=>o.provider_type===n.provider_type);if(!i&&n.litellm_provider){const o=r[n.litellm_provider];o&&(i=e.find(l=>l.provider_type===o))}return i?{providerId:i.id,model:n.key}:(console.error("No matching provider found for default model"),{providerId:null,model:null})}catch(n){return console.error("Failed to get default provider and model:",n),{providerId:null,model:null}}}clearCache(){this.defaultModelConfig=null,this.defaultModelConfigPromise=null}}const lot=new bOn,A1=new Map,NP=new Set,yOn=5e3,vOn=100;function cot(t){Qb.disconnect(t);const e=A1.get(t);e&&(clearTimeout(e),A1.delete(t))}function _On(t,e,n){const{reconcileChannelFromBackend:r,getAgentNameById:i,waitForChannelConnection:o}=n;return{setActiveChatChannel:l=>t({activeChatChannel:l}),fetchChatHistory:async()=>{const{setLoading:l}=e();l("chatHistory",!0);try{const u=await Np.getSessions(),d=e().channels,p={...d},m=Object.entries(d).filter(([,h])=>h.responding).map(([h,f])=>`${h.slice(0,8)}(msgs=${f.messages.length})`);m.length>0&&console.warn("[fetchChatHistory] DANGER: overwriting channels while responding:",m.join(", "));const g=u.flatMap(h=>h.topics?.map(f=>(p[f.id]?p[f.id]={...p[f.id],sessionId:h.id,title:f.name,agentId:h.agent_id}:p[f.id]={id:f.id,sessionId:h.id,title:f.name,messages:[],agentId:h.agent_id,provider_id:h.provider_id,model:h.model,model_tier:h.model_tier,knowledge_set_id:h.knowledge_set_id,sandbox_backend:h.sandbox_backend,connected:!1,error:null},{id:f.id,sessionId:h.id,title:f.name,updatedAt:f.updated_at,assistantTitle:i(h.agent_id),lastMessage:"",isPinned:f.is_pinned??!1}))||[]);t(h=>{h.chatHistory=g,h.chatHistoryLoading=!1;for(const[f,b]of Object.entries(p)){const y=h.channels[f];if(!y)h.channels[f]=b;else{if(y.responding)continue;y.sessionId=b.sessionId,y.title=b.title,y.agentId=b.agentId,b.provider_id!==void 0&&(y.provider_id=b.provider_id),b.model!==void 0&&(y.model=b.model),b.model_tier!==void 0&&(y.model_tier=b.model_tier),b.knowledge_set_id!==void 0&&(y.knowledge_set_id=b.knowledge_set_id),b.sandbox_backend!==void 0&&(y.sandbox_backend=b.sandbox_backend)}}})}catch(u){console.error("ChatSlice: Failed to fetch chat history:",u),t({chatHistoryLoading:!1})}finally{e().setLoading("chatHistory",!1)}},togglePinChat:l=>{const u=e().chatHistory.find(p=>p.id===l);if(!u)return;const d=!u.isPinned;t(p=>{const m=p.chatHistory.find(g=>g.id===l);m&&(m.isPinned=d)}),dg.updateTopic(l,{is_pinned:d}).catch(p=>{console.error("Failed to persist pin state:",p),t(m=>{const g=m.chatHistory.find(h=>h.id===l);g&&(g.isPinned=!d)})})},activateChannel:async l=>{const{channels:u,activeChatChannel:d,connectToChannel:p}=e();if(console.debug(`[activateChannel] topic=${l.slice(0,8)} current=${d?.slice(0,8)} connected=${u[l]?.connected} msgs=${u[l]?.messages.length} responding=${u[l]?.responding}`),l===d&&u[l]?.connected){console.debug("[activateChannel] SKIP (already active & connected)");return}const m=u[l];m?.agentId&&t(h=>{h.activeTopicByAgent[m.agentId]=l});let g=u[l];if(!g)try{const h=await Np.getSessionByTopic(l),f=h.topics.find(E=>E.id===l),b=h.id,y=f?.name??null,v=h.agent_id,_=h.provider_id,w=h.model,x=h.model_tier,k=h.knowledge_set_id,C=h.sandbox_backend;if(y)g={id:l,sessionId:b,title:y,messages:[],agentId:v,provider_id:_,model:w,model_tier:x,knowledge_set_id:k,sandbox_backend:C,connected:!1,error:null},t(E=>{E.channels[l]=g});else{console.error(`Topic ${l} not found in any session, refetching history...`),await e().fetchChatHistory();const E=e().channels;if(E[l])g=E[l];else{console.error(`Topic ${l} still not found after refetch.`);return}}}catch(h){console.error("Failed to find session for topic:",h);return}if(g){if(t({activeChatChannel:l}),Qb.hasConnection(l))console.debug("[activateChannel] hasLiveWs, skipping reconcile");else{const f=g.messages.some(b=>b.status==="pending"||b.status==="streaming"||b.status==="thinking");console.debug(`[activateChannel] noLiveWs, msgs=${g.messages.length} stale=${f} → ${g.messages.length===0||f?"RECONCILE":"SKIP"}`),(g.messages.length===0||f)&&await r(l)}p(g.sessionId,g.id),await o(l,{logFailure:!0})}},activateChannelForAgent:async l=>{const u=`activate:${l}`;if(!NP.has(u)){NP.add(u);try{try{const d=await Np.getSessionByAgent(l);if(d.topics&&d.topics.length>0){const p=d.topics[0],m={id:p.id,sessionId:d.id,title:p.name,messages:[],agentId:d.agent_id,provider_id:d.provider_id,model:d.model,model_tier:d.model_tier,knowledge_set_id:d.knowledge_set_id,sandbox_backend:d.sandbox_backend,connected:!1,error:null};t(g=>{const h=g.channels[p.id];g.channels[p.id]=not(h,m)}),await e().activateChannel(p.id)}else{const p=await dg.createTopic({name:to.t(SN),session_id:d.id}),m={id:p.id,sessionId:d.id,title:p.name,messages:[],agentId:d.agent_id,provider_id:d.provider_id,model:d.model,model_tier:d.model_tier,knowledge_set_id:d.knowledge_set_id,sandbox_backend:d.sandbox_backend,connected:!1,error:null};t(g=>{g.channels[p.id]=m}),await e().activateChannel(p.id)}}catch(d){d instanceof cg&&d.status===404?await e().createDefaultChannel(l):(console.error("Failed to activate channel for agent:",d),await e().createDefaultChannel(l))}}finally{NP.delete(u)}}},createDefaultChannel:async l=>{const u=l||e().rootAgentId;if(!u){console.error("createDefaultChannel: no agentId and rootAgentId not loaded");return}const d=`create:${u}`;if(!NP.has(d)){NP.add(d);try{const p=u;let m;try{m=await Np.getSessionByAgent(p)}catch(y){if(y instanceof cg&&y.status===404)m=null;else throw y}if(m){if(!m.provider_id||!m.model){console.log(" - Existing session missing provider/model, updating with defaults...");try{const x=e().agents.find(E=>E.id===m.agent_id);let k=m.provider_id,C=m.model;if(x?.provider_id&&x?.model)k=x.provider_id,C=x.model;else{const E=await N7.getMyProviders(),S=await lot.getDefaultProviderAndModel(E);k=k||S.providerId||void 0,C=C||S.model||void 0}k&&C&&(await Np.updateSession(m.id,{provider_id:k,model:C}),m.provider_id=k,m.model=C,console.log(` - Updated session with provider (${k}) and model (${C})`))}catch(w){console.warn(" - Failed to update session with defaults:",w)}}const y=await dg.createTopic({name:to.t(SN),session_id:m.id}),v={id:y.id,sessionId:m.id,title:y.name,messages:[],agentId:m.agent_id,provider_id:m.provider_id,model:m.model,model_tier:m.model_tier,knowledge_set_id:m.knowledge_set_id,sandbox_backend:m.sandbox_backend,connected:!1,error:null},_={id:y.id,sessionId:m.id,title:y.name,updatedAt:y.updated_at,assistantTitle:i(m.agent_id),lastMessage:"",isPinned:!1};t(w=>{w.channels[y.id]=v,w.chatHistory.unshift(_),w.activeChatChannel=y.id,w.activeTabIndex=1}),e().connectToChannel(m.id,y.id);return}const g=e().resolveAgent(u),h={name:"New Session",agent_id:u};g?.mcp_servers?.length&&(h.mcp_server_ids=g.mcp_servers.map(y=>y.id));let f=[];try{f=await N7.getMyProviders()}catch(y){console.error("Failed to fetch providers:",y)}try{if(g?.provider_id&&g?.model)h.provider_id=g.provider_id,h.model=g.model;else{const{providerId:y,model:v}=await lot.getDefaultProviderAndModel(f);y&&v&&(h.provider_id=y,h.model=v)}}catch(y){console.error("Error getting provider/model:",y)}const b=await Np.createSession(h);if(b.topics&&b.topics.length>0){const y=b.topics[0],v={id:y.id,sessionId:b.id,title:y.name,messages:[],agentId:b.agent_id,provider_id:b.provider_id,model:b.model,model_tier:b.model_tier,connected:!1,error:null},_={id:y.id,sessionId:b.id,title:y.name,updatedAt:y.updated_at,assistantTitle:i(b.agent_id),lastMessage:"",isPinned:!1};t(w=>{w.channels[y.id]=v,w.chatHistory.unshift(_),w.activeChatChannel=y.id,w.activeTabIndex=1}),e().connectToChannel(b.id,y.id)}else{const y=await dg.createTopic({name:to.t(SN),session_id:b.id}),v={id:y.id,sessionId:b.id,title:y.name,messages:[],agentId:b.agent_id,provider_id:b.provider_id,model:b.model,model_tier:b.model_tier,connected:!1,error:null},_={id:y.id,sessionId:b.id,title:y.name,updatedAt:y.updated_at,assistantTitle:i(b.agent_id),lastMessage:"",isPinned:!1};t(w=>{w.channels[y.id]=v,w.chatHistory.unshift(_),w.activeChatChannel=y.id,w.activeTabIndex=1}),e().connectToChannel(b.id,y.id)}}catch(p){console.error("Failed to create channel:",p)}finally{NP.delete(d)}}},updateTopicName:async(l,u)=>{try{await dg.updateTopic(l,{name:u}),t(d=>{d.channels[l]&&(d.channels[l].title=u);const p=d.chatHistory.find(m=>m.id===l);p&&(p.title=u)}),console.log(`Topic ${l} name updated to: ${u}`)}catch(d){throw console.error("Failed to update topic name:",d),d}},deleteTopic:async l=>{try{await dg.deleteTopic(l),cot(l);const u=e().chatHistory,p=u.find(h=>h.id===l)?.sessionId,m=e().activeChatChannel===l,g=m?u.find(h=>h.id!==l&&h.sessionId===p)?.id??null:null;t(h=>{delete h.channels[l],h.chatHistory=h.chatHistory.filter(f=>f.id!==l),m&&(h.activeChatChannel=g)}),m&&g&&e().activateChannel(g),console.log(`Topic ${l} deleted`)}catch(u){throw console.error("Failed to delete topic:",u),u}},clearSessionTopics:async l=>{try{const u=e().channels;for(const[p,m]of Object.entries(u))m.sessionId===l&&cot(p);await Np.clearSessionTopics(l);const d=e().activeChatChannel;d&&u[d]?.sessionId===l&&t({activeChatChannel:null}),await e().fetchChatHistory(),console.log(`Session ${l} topics cleared`)}catch(u){console.error("Failed to clear session topics:",u)}},updateSessionConfig:async(l,u)=>{try{const d=await Np.updateSession(l,u);t(p=>{for(const m of Object.values(p.channels))m.sessionId===l&&(m.provider_id=d.provider_id,m.model=d.model,m.model_tier=d.model_tier,m.knowledge_set_id=d.knowledge_set_id,m.sandbox_backend=d.sandbox_backend)})}catch(d){console.error("Failed to update session config:",d),e().showNotification("Error","Failed to update session configuration","error")}},ensureChannelForTopic:async(l,u,d)=>{const{channels:p}=e();if(!p[l]){let m;try{m=await Np.getSessionByAgent(d)}catch{}const g={id:l,sessionId:u,title:"",messages:[],agentId:d,provider_id:m?.provider_id,model:m?.model,model_tier:m?.model_tier,knowledge_set_id:m?.knowledge_set_id,sandbox_backend:m?.sandbox_backend,connected:!1,error:null};t(h=>{const f=h.channels[l];h.channels[l]=not(f,g)})}await e().activateChannel(l)},updateSessionProviderAndModel:async(l,u,d)=>{try{await Np.updateSession(l,{provider_id:u,model:d}),t(p=>{const m=p.activeChatChannel;m&&p.channels[m]?.sessionId===l&&(p.channels[m].provider_id=u,p.channels[m].model=d),Object.keys(p.channels).forEach(g=>{p.channels[g].sessionId===l&&(p.channels[g].provider_id=u,p.channels[g].model=d)})})}catch(p){console.error("Failed to update session provider and model:",p),e().showNotification("Error","Failed to update model selection","error")}}}}class wOn{constructor(e){this.mutateChannel=e}buffer=[];rafId=null;pushStreaming(e,n,r){this.buffer.push({type:"streaming",id:e,content:n,execution_id:r}),this.scheduleFlush()}pushThinking(e,n){this.buffer.push({type:"thinking",id:e,content:n}),this.scheduleFlush()}flushSync(){this.buffer.length!==0&&(this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null),this.flush())}destroy(){this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null),this.buffer=[]}get hasPending(){return this.buffer.length>0}scheduleFlush(){this.rafId===null&&(this.rafId=requestAnimationFrame(()=>this.flush()))}flush(){if(this.rafId=null,this.buffer.length===0)return;const e=this.buffer;this.buffer=[],this.mutateChannel(n=>{for(const r of e)r.type==="streaming"?this.applyStreamingChunk(n,r):this.applyThinkingChunk(n,r);jxe(n)})}applyStreamingChunk(e,n){const r=ax(e,n.id,n.execution_id);if(r===-1){e.messages.push({id:n.id,streamId:n.id,clientId:EN(),role:"assistant",content:n.content,created_at:new Date().toISOString(),status:"streaming"});return}const i=e.messages[r];if(i.streamId=n.id,i.status="streaming",i.agentExecution&&i.agentExecution.phases.length>0){const o=i.agentExecution;let l=o.currentNode?o.phases.findLast(d=>d.nodeId===o.currentNode):null;l||(l=o.phases.findLast(d=>d.status==="running")),l||(l=o.phases[o.phases.length-1]);const u=l.streamedContent||"";u.length>100&&n.content.length>u.length&&n.content.startsWith(u.slice(0,100))?l.streamedContent=n.content:l.streamedContent=u+n.content}else{const o=i.content;e.messages[r].content=o+n.content}}applyThinkingChunk(e,n){let r=e.messages.findIndex(i=>i.id===n.id);if(r===-1&&(r=e.messages.findLastIndex(i=>i.status==="thinking"&&i.agentExecution?.status==="running")),r!==-1){const i=e.messages[r].thinkingContent??"";e.messages[r].thinkingContent=i+n.content}}}function xOn(t,e){if(t.responding=!0,ax(t,e)!==-1)return;CN(t)===-1&&t.messages.push({id:e,streamId:e,clientId:EN(),role:"assistant",content:"",created_at:new Date().toISOString(),status:"pending",isNewMessage:!0})}function kOn(t,e){t.responding=!0;let n=ax(t,e.stream_id,e.execution_id);if(n===-1&&(n=CN(t)),n!==-1){const r=t.messages[n];r.id=e.stream_id,r.streamId=e.stream_id,r.status="streaming",r.content||(r.content="");return}t.messages.push({id:e.stream_id,streamId:e.stream_id,clientId:EN(),role:"assistant",content:"",isNewMessage:!0,created_at:new Date().toISOString(),status:"streaming"})}function EOn(t,e){let n=ax(t,e.stream_id,e.execution_id);if(n===-1){const r=t.messages.map((i,o)=>i.status==="streaming"?o:-1).filter(i=>i!==-1);n=r.length===1?r[0]:-1}if(n!==-1){const r=t.messages[n];if(!r.content&&r.agentExecution&&r.agentExecution.phases.length>0){const i=r.agentExecution.phases.map(o=>o.streamedContent||"").filter(Boolean).join(`
|
|
108
108
|
|
|
109
|
-
`);i&&(r.content=i)}r.agentExecution?.status==="running"||ate(r,{status:"completed",onlyIfRunning:!0}),r.created_at=e.created_at||new Date().toISOString(),console.debug("[ChatSlice] streaming_end: finalized message at index",n)}else console.warn("[ChatSlice] streaming_end: no message found to finalize")}function COn(t,e){t.messages.some(n=>n.id===e.id)||t.messages.push({...e,status:e.status||"completed",isNewMessage:!0})}function SOn(t,e){let n=ax(t,e.stream_id);if(n===-1)for(let r=t.messages.length-1;r>=0;r--){const i=t.messages[r];if(i.role==="assistant"&&i.error&&!Jit(i.id)){n=r;break}}if(n!==-1){if(t.messages.findIndex((l,u)=>u!==n&&l.id===e.db_id)!==-1){t.messages.splice(n,1);return}const i=t.messages[n];i.dbId=e.db_id,i.id=e.db_id,i.created_at=e.created_at,i.status==="waiting_for_user"||i.userQuestion?.status==="pending"||ate(i,{status:"completed",onlyIfRunning:!0})}}function IOn(t,e){t.responding=!0;const n=CN(t);if(n!==-1){const i=t.messages[n];i.id=e.stream_id,i.status="thinking",i.thinkingContent="",i.content=i.content||"";return}const r=D7(t);if(r!==-1){const i=t.messages[r];i.status="thinking",i.thinkingContent=i.thinkingContent??"";return}t.messages.push({id:e.stream_id,clientId:`thinking-${Date.now()}`,role:"assistant",content:"",isNewMessage:!0,created_at:new Date().toISOString(),status:"thinking",thinkingContent:""})}function Kgo(t,e){}function TOn(t,e){t.responding=!0;const{context:n}=e;let r=-1;n.stream_id&&(r=ax(t,n.stream_id)),r===-1&&(r=CN(t));const i={agentId:n.agent_id,agentName:n.agent_name,agentType:n.agent_type,executionId:n.execution_id,status:"running",startedAt:n.started_at,phases:[],subagents:[]};if(r!==-1){const o=t.messages[r];t.messages[r]={...o,id:`agent-${n.execution_id}`,streamId:n.stream_id||o.streamId,status:"pending",agentExecution:i}}else t.messages.push({id:`agent-${n.execution_id}`,streamId:n.stream_id,clientId:EN(),role:"assistant",content:"",created_at:new Date().toISOString(),status:"pending",isNewMessage:!0,agentExecution:i})}function BOn(t,e){t.responding=!1;const{context:n}=e,r=t.messages.findIndex(i=>i.agentExecution?.executionId===n.execution_id);if(r!==-1){const i=t.messages[r];i.agentExecution?ate(i,{status:e.status==="completed"?"completed":e.status==="cancelled"?"cancelled":"failed",durationMs:e.duration_ms}):Qxe(i)}}function DOn(t,e){t.responding=!1;const{context:n}=e,r=t.messages.findIndex(i=>i.agentExecution?.executionId===n.execution_id);if(r!==-1){const i=t.messages[r],o=i.agentExecution;o?(o.error={type:e.error_type,message:e.error_message,recoverable:e.recoverable,nodeId:e.node_id},ate(i,{status:"failed"})):Qxe(i)}}function NOn(t,e){const{context:n}=e,r=t.messages.findIndex(i=>i.agentExecution?.executionId===n.execution_id);if(r!==-1){const i=t.messages[r].agentExecution;if(i){const o=i.phases.find(p=>p.status==="running");o&&(o.status="completed",o.endedAt=Date.now(),o.startedAt&&(o.durationMs=Date.now()-o.startedAt));const l=sOn(e.node_id),u=i.phases.filter(p=>p.nodeId===e.node_id).length,d=u>0?`${e.node_id}__${u}`:e.node_id;i.phases.push({id:d,nodeId:e.node_id,name:l,componentKey:e.component_key,status:"running",startedAt:Date.now(),nodes:[],streamedContent:""}),i.currentPhase=l,i.currentNode=e.node_id}}}function ROn(t,e){const{context:n}=e,r=t.messages.findIndex(i=>i.agentExecution?.executionId===n.execution_id);if(r!==-1){const i=t.messages[r].agentExecution;if(i){const o=i.phases.findLast(l=>l.nodeId===e.node_id&&l.status==="running");o&&(o.status=e.status==="completed"?"completed":e.status==="skipped"?"skipped":"failed",o.endedAt=Date.now(),o.durationMs=e.duration_ms,o.outputSummary=e.output_summary)}}}function LOn(t,e){const{context:n}=e,r=t.messages.findIndex(i=>i.agentExecution&&(i.agentExecution.executionId===n.parent_execution_id||i.agentExecution.executionId===n.execution_id));if(r!==-1){const i=t.messages[r].agentExecution;i&&i.subagents.push({id:e.subagent_id,name:e.subagent_name,type:e.subagent_type,status:"running",depth:n.depth,executionPath:n.execution_path,startedAt:n.started_at})}}function MOn(t,e){const n=t.messages.findIndex(r=>r.agentExecution?.subagents?.some(i=>i.id===e.subagent_id));if(n!==-1){const r=t.messages[n].agentExecution;if(r){const i=r.subagents.find(o=>o.id===e.subagent_id);i&&(i.status=e.status==="completed"?"completed":"failed",i.endedAt=Date.now(),i.durationMs=e.duration_ms,i.outputSummary=e.output_summary)}}}function POn(t,e){const{context:n}=e,r=t.messages.findIndex(i=>i.agentExecution?.executionId===n.execution_id);if(r!==-1){const i=t.messages[r].agentExecution;i&&(i.progressPercent=e.progress_percent,i.progressMessage=e.message)}}function OOn(t,e){t.responding=!1;const n=e.error_code?{code:e.error_code,category:e.error_category||e.error_code.split(".")[0],message:e.error,recoverable:e.recoverable??!1,detail:e.detail,errorRef:e.error_ref,occurredAt:e.occurred_at}:{code:"system.internal_error",category:"system",message:e.error||"An error occurred",recoverable:!1};let r=ax(t,e.stream_id);r===-1&&(r=CN(t)),r===-1&&(r=lOn(t)),r===-1&&(r=D7(t)),r!==-1?t.messages[r]={...t.messages[r],status:"failed",error:n}:t.messages.push({id:e.stream_id,streamId:e.stream_id,clientId:EN(),role:"assistant",content:"",created_at:new Date().toISOString(),status:"failed",isNewMessage:!0,error:n}),console.error("Chat error:",e.error_code||e.error)}function FOn(t,e){console.warn("Insufficient balance:",e),t.responding=!1;let n=ax(t,e.stream_id);return n===-1&&(n=CN(t)),n!==-1&&(t.messages[n]={...t.messages[n],content:"",status:"failed",error:{code:"billing.insufficient_balance",category:"billing",message:e.message||"Insufficient balance. Please recharge to continue.",recoverable:!1}}),{isOpen:!0,title:"积分用尽",message:"您的积分已用尽。目前产品处于内测阶段,欢迎填写问卷参与内测,获取更多使用额度。",type:"warning",actionLabel:"填写问卷",actionUrl:"https://sii-czxy.feishu.cn/share/base/form/shrcnYu8Y3GNgI7M14En1xJ7rMb"}}function QOn(t,e){console.warn("Parallel chat limit reached:",e),t.responding=!1;const n=CN(t);return n!==-1&&t.messages.splice(n,1),{isOpen:!0,title:"并行会话已达上限",message:`您已达到并行会话上限(${e.current??"?"}/${e.limit??"?"})。请等待其他会话完成后重试。`,type:"warning"}}function $On(t,e,n){console.log("Stream aborted:",e);const r=n.get(t.id);r&&(clearTimeout(r),n.delete(t.id)),t.responding=!1,t.aborting=!1,$xe(t)}function jOn(t,e){t.responding=!0;const n=t.messages.findIndex(l=>l.status==="pending"&&!l.agentExecution);n!==-1&&t.messages.splice(n,1);const r={id:e.id,name:e.name,description:e.description,arguments:e.arguments,status:e.status,timestamp:new Date(e.timestamp*1e3).toISOString()};let i=D7(t);if(i===-1&&e.stream_id&&(i=ax(t,e.stream_id)),i!==-1){const l=t.messages[i].agentExecution;if(l){let u=l.currentNode?l.phases.findLast(d=>d.nodeId===l.currentNode):null;if(u||(u=l.phases.findLast(d=>d.status==="running")),!u&&l.phases.length>0&&(u=l.phases[l.phases.length-1]),u){u.toolCalls||(u.toolCalls=[]);const d=u.streamedContent?.length??0;r.contentOffset=d,u.toolCalls.push(r),console.log(`ChatSlice: Added tool call ${e.name} to phase ${u.id}`);return}}}const o=`tool-call-${e.id}`;t.messages.push({id:o,streamId:e.stream_id,clientId:EN(),role:"assistant",content:"",created_at:new Date().toISOString(),status:"streaming",isNewMessage:!0,toolCalls:[r]}),console.log(`ChatSlice: Created new tool call message with tool ${e.name}`)}function zOn(t,e){const n=D7(t);if(n!==-1){const r=t.messages[n].agentExecution;if(r){for(const i of r.phases)if(i.toolCalls){const o=i.toolCalls.find(l=>l.id===e.toolCallId);if(o){o.status=e.status,e.result!=null&&(o.result=e.result),e.error&&(o.error=e.error),e.duration_ms!==void 0&&(o.duration_ms=e.duration_ms);break}}}}t.messages.forEach(r=>{r.toolCalls&&r.toolCalls.forEach(i=>{i.id===e.toolCallId&&(i.status=e.status,e.result!=null&&(i.result=e.result),e.error&&(i.error=e.error),e.duration_ms!==void 0&&(i.duration_ms=e.duration_ms))})})}function UOn(t,e,n){t.title=e.name;const r=n.find(i=>i.id===e.id);r&&(r.title=e.name,r.updatedAt=e.updated_at)}function qOn(t,e){const n=rot(t,"citations");n!==-1?(t.messages[n].citations=e.citations,console.log(`Attached ${e.citations.length} citations to message ${t.messages[n].id}`)):console.warn("[Citation Debug] Could not find assistant message to attach citations")}function GOn(t,e){const n=rot(t,"attachments");if(n!==-1){t.messages[n].attachments||(t.messages[n].attachments=[]);const i=t.messages[n].attachments||[],o=e.files.filter(l=>!i.some(u=>u.id===l.id));t.messages[n].attachments=[...i,...o]}}function HOn(t,e){t.contextUsage={estimatedTokens:e.estimated_tokens,maxTokens:e.max_tokens,usagePercent:e.usage_percent,nearLimit:e.near_limit,critical:e.critical}}function WOn(t){return{questionId:t.question_id,question:t.question,options:t.options?.map(e=>({id:e.id,label:e.label,description:e.description,markdown:e.markdown})),multiSelect:t.multi_select??!1,allowTextInput:t.allow_text_input,timeoutSeconds:t.timeout_seconds,threadId:t.thread_id,status:"pending",askedAt:Date.now()}}function YOn(t,e){let n=ax(t,e.stream_id);if(n===-1&&(n=D7(t)),n===-1){for(let o=t.messages.length-1;o>=0;o--)if(t.messages[o].role==="assistant"){n=o;break}}if(n===-1){console.warn("[questionHandlers] No target message found for ask_user_question event");return}const r=t.messages[n],i=WOn(e);r.agentExecution&&r.agentExecution.phases.length>0&&(i.afterPhaseIndex=r.agentExecution.phases.length-1),r.userQuestion&&r.userQuestion.status!=="pending"&&(r.answeredQuestions||(r.answeredQuestions=[]),r.answeredQuestions.push(r.userQuestion)),r.status="waiting_for_user",r.userQuestion=i,t.responding=!0}const R7=new Map;function VOn(t,e,n){const{updateDerivedStatus:r,closeIdleNonPrimaryConnection:i}=n;return{connectToChannel:(o,l)=>{console.debug(`[connectToChannel] topic=${l.slice(0,8)} hasExistingSSE=${Qb.hasConnection(l)} msgs=${e().channels[l]?.messages.length}`),R7.get(l)?.destroy();const u=new wOn(m=>{t(g=>{const h=g.channels[l];h&&m(h)})});R7.set(l,u);const d=m=>{const g=m;if(g.type==="streaming_chunk"){u.pushStreaming(g.data.stream_id,g.data.content,g.data.execution_id);return}if(g.type==="thinking_chunk"){u.pushThinking(g.data.stream_id,g.data.content);return}const h=u.hasPending;u.flushSync();const f=e().channels[l]?.responding;console.groupCollapsed(`[ChatEvent] ${g.type} | topic=${l.slice(0,8)} | responding=${f}`),t(y=>{const v=y.channels[l];if(v){switch(console.debug(`msgs=${v.messages.length}`,`| latestAssist=${(()=>{const _=[...v.messages].reverse().find(w=>w.role==="assistant");return _?`id=${_.id.slice(0,12)} status=${_.status} agentExec=${_.agentExecution?.status}`:"none"})()}`),g.type){case"processing":case"loading":{xOn(v,g.data.stream_id);break}case"streaming_start":{kOn(v,g.data);break}case"streaming_end":{EOn(v,g.data);break}case"message":{const _=g.data,w=_.client_id;if(w){const x=v.messages.findIndex(k=>k.clientId===w);if(x!==-1){const k=v.messages[x];v.messages[x]={...k,..._,id:_.id,status:_.status||"completed",isNewMessage:!1};break}}COn(v,_);break}case"search_citations":{qOn(v,g.data);break}case"generated_files":{GOn(v,g.data);break}case"message_saved":{SOn(v,g.data);break}case"message_ack":{const{message_id:_,client_id:w}=g.data;if(w){const x=v.messages.findIndex(k=>k.clientId===w);if(x!==-1){const k=v.messages[x];k.id=_,k.status==="sending"&&(k.status="completed")}}break}case"tool_call_request":{jOn(v,g.data);break}case"tool_call_response":{zOn(v,g.data);break}case"error":{OOn(v,g.data);break}case"insufficient_balance":{const _=FOn(v,g.data);_&&(y.notification={..._,onAction:()=>window.open(_.actionUrl,"_blank")});break}case"parallel_chat_limit":{const _=QOn(v,g.data);y.notification=_;break}case"stream_aborted":{$On(v,g.data,A1);break}case"thinking_start":{IOn(v,g.data);break}case"thinking_end":{g.data;break}case"topic_updated":{UOn(v,g.data,y.chatHistory);break}case"agent_start":{TOn(v,g.data);break}case"agent_end":{BOn(v,g.data);break}case"agent_error":{DOn(v,g.data);break}case"node_start":{NOn(v,g.data);break}case"node_end":{ROn(v,g.data);break}case"subagent_start":{LOn(v,g.data);break}case"subagent_end":{MOn(v,g.data);break}case"progress_update":{POn(v,g.data);break}case"ask_user_question":{YOn(v,g.data);break}case"token_usage":{const{total_tokens:_}=g.data;v.tokenUsage=_;break}case"context_usage":{HOn(v,g.data);break}}jxe(v)}});const b=e().channels[l]?.responding;if(f!==b&&console.debug(`responding changed: ${f} → ${b}`,`| hadPendingChunks: ${h}`),console.groupEnd(),g.type==="topic_updated"&&e().renameTab(g.data.id,g.data.name),g.type==="agent_end"){const y=e().channels[l];y?.sessionId&&!y.sandbox_backend&&Np.getSessionByTopic(l).then(v=>{v.sandbox_backend&&t(_=>{const w=_.channels[l];w&&!w.sandbox_backend&&(w.sandbox_backend=v.sandbox_backend)})}).catch(()=>{})}r(),i(l)};if(Qb.hasConnection(l)){Qb.updateCallbacks(l,{onMessageEvent:d,onStatusChange:m=>{t(g=>{const h=g.channels[l];h&&(h.connected=m.connected,h.error=m.error??null)})}}),t(m=>{m.channels[l]&&(m.channels[l].connected=!0,m.channels[l].error=null)});return}const p=Qb.getOpenTopicIds();for(const m of p){if(m===l)continue;e().channels[m]?.responding||Qb.disconnect(m)}t(m=>{Object.entries(m.channels).forEach(([g,h])=>{Qb.hasConnection(g)||(h.connected=!1)}),m.channels[l]&&(m.channels[l].error=null)}),Qb.connect(l,{onMessageEvent:d,onStatusChange:m=>{t(g=>{const h=g.channels[l];h&&(h.connected=m.connected,h.error=m.error??null)})}}),t(m=>{m.channels[l]&&(m.channels[l].connected=!0,m.channels[l].error=null)})},disconnectFromChannel:()=>{for(const[,o]of R7)o.destroy();R7.clear();for(const[o,l]of A1)clearTimeout(l),A1.delete(o);Qb.disconnectAll()},abortGeneration:o=>{dg.abort(o).catch(p=>{console.error("Failed to send abort signal:",p)});const l=A1.get(o);l&&(clearTimeout(l),A1.delete(o));const u=R7.get(o);u&&u.destroy(),t(p=>{const m=p.channels[o];m&&(m.aborting=!0,$xe(m))}),r();const d=setTimeout(()=>{A1.delete(o),e().channels[o]?.aborting&&(console.warn("Abort timeout: Backend did not respond, resetting state"),t(g=>{const h=g.channels[o];h&&(h.aborting=!1,h.responding=!1,$xe(h))}),r())},1e4);A1.set(o,d)},respondToQuestion:(o,l,u)=>{dg.answerQuestion(o,{question_id:l,selected_options:u.selectedOptions,text:u.text||""}).catch(d=>{console.error("Failed to send question response:",d)}),t(d=>{const p=d.channels[o];if(!p)return;const m=p.messages.find(h=>h.userQuestion?.questionId===l||h.answeredQuestions?.some(f=>f.questionId===l));if(!m)return;const g=m.userQuestion?.questionId===l?m.userQuestion:m.answeredQuestions?.find(h=>h.questionId===l);g&&(g.status="answered",g.selectedOptions=u.selectedOptions,g.userText=u.text,m.status="pending")}),r()},confirmToolCall:(o,l)=>{console.warn("confirmToolCall: not implemented in SSE mode"),t(u=>{u.channels[o]&&u.channels[o].messages.forEach(d=>{d.toolCalls&&d.toolCalls.forEach(p=>{p.id===l&&p.status==="waiting_confirmation"&&(p.status="executing")})})})},cancelToolCall:(o,l)=>{console.warn("cancelToolCall: not implemented in SSE mode"),t(u=>{u.channels[o]&&u.channels[o].messages.forEach(d=>{d.toolCalls&&d.toolCalls.forEach(p=>{p.id===l&&p.status==="waiting_confirmation"&&(p.status="failed",p.error="用户取消执行")})})})}}}const KOn=["image/jpeg","image/jpg","image/png","image/gif","image/webp","application/pdf","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/json","application/xml","application/x-yaml","text/plain","text/markdown","text/csv","text/html","text/xml","text/yaml","text/x-yaml","audio/mpeg","audio/wav","audio/wave","audio/x-wav",".csv",".docx",".htm",".html",".json",".md",".pdf",".pptx",".txt",".xlsx",".xml",".yaml",".yml"],ZOn=[".csv",".docx",".htm",".html",".json",".md",".pdf",".pptx",".txt",".xlsx",".xml",".yaml",".yml"];class XOn{appendUploadFields(e,n){e.append("file",n.file),e.append("scope",n.scope),n.category&&e.append("category",n.category),n.parentId&&e.append("parent_id",n.parentId),n.knowledgeSetId&&e.append("knowledge_set_id",n.knowledgeSetId),n.purpose&&e.append("purpose",n.purpose)}getUploadError(e){if(e.status===429)return new Error("Too many requests. Please wait a moment and try again.");try{const n=JSON.parse(e.responseText);if(typeof n.detail=="string"&&n.detail.trim())return new Error(n.detail)}catch{}return new Error(`Upload failed: ${e.statusText||`HTTP ${e.status}`}`)}uploadWithXhr(e,n){const r=new FormData;this.appendUploadFields(r,e);const i=new XMLHttpRequest,o=on.baseUrl;return{promise:new Promise((u,d)=>{i.upload.addEventListener("progress",m=>{if(n&&m.lengthComputable){const g=Math.round(m.loaded*100/m.total);n({loaded:m.loaded,total:m.total,percentage:g})}}),i.addEventListener("load",()=>{i.status>=200&&i.status<300?u(JSON.parse(i.responseText)):d(this.getUploadError(i))}),i.addEventListener("error",()=>{d(new Error("Upload failed"))}),i.addEventListener("abort",()=>{d(new Error("Upload cancelled"))}),i.open("POST",`${o}/xyzen/api/v1/files/upload`);const p=Eo.getToken();p&&i.setRequestHeader("Authorization",`Bearer ${p}`),i.send(r)}),abort:()=>i.abort()}}isAllowedType(e,n){return n.endsWith("/*")?e.type.startsWith(n.slice(0,-1)):n.startsWith(".")?e.name.toLowerCase().endsWith(n.toLowerCase()):e.type===n}uploadFileWithProgress(e,n="private",r,i,o,l){return this.uploadWithXhr({file:e,scope:n,category:r,parentId:i,knowledgeSetId:o},l)}async uploadFile(e,n="private",r,i,o,l){return this.uploadWithXhr({file:e,scope:n,category:r,parentId:i,knowledgeSetId:o},l).promise}async uploadChatAttachment(e,n="private",r,i,o,l){return this.uploadWithXhr({file:e,scope:n,category:r,parentId:i,knowledgeSetId:o,purpose:"chat_attachment"},l).promise}async getFile(e){return on.get(`/xyzen/api/v1/files/${e}`)}async listFiles(e){const n=new URLSearchParams;e&&(e.scope&&n.append("scope",e.scope),e.category&&n.append("category",e.category),e.include_deleted&&n.append("include_deleted","true"),e.limit&&n.append("limit",e.limit.toString()),e.offset&&n.append("offset",e.offset.toString()),e.parent_id&&n.append("parent_id",e.parent_id),e.filter_by_parent&&n.append("filter_by_parent","true"),e.is_dir!==void 0&&n.append("is_dir",e.is_dir.toString()),e.knowledge_set_id&&n.append("knowledge_set_id",e.knowledge_set_id));const r=n.toString()?"?"+n.toString():"";return on.get(`/xyzen/api/v1/files/${r}`)}async getFileUrl(e,n=3600){return on.get(`/xyzen/api/v1/files/${e}/url`,{params:{expires_in:n}})}async updateFile(e,n){return on.patch(`/xyzen/api/v1/files/${e}`,n)}async confirmFiles(e,n){await Promise.all(e.map(r=>this.updateFile(r,{message_id:n,status:"confirmed"})))}async deleteFile(e,n=!1){return on.delete(`/xyzen/api/v1/files/${e}`,void 0,{params:{hard_delete:n}})}async restoreFile(e){return on.post(`/xyzen/api/v1/files/${e}/restore`)}async getStorageStats(){return on.get("/xyzen/api/v1/files/stats/summary")}async getChatUploadCapabilities(){return on.get("/xyzen/api/v1/files/chat-upload-capabilities")}async emptyTrash(){return on.post("/xyzen/api/v1/files/empty-trash")}async bulkDeleteFiles(e){return on.delete("/xyzen/api/v1/files/bulk",e)}async updateFileContent(e,n,r){const i=new Blob([n],{type:r||"text/plain"}),o=new FormData;return o.append("file",i,"content"),on.put(`/xyzen/api/v1/files/${e}/content`,o)}async downloadRaw(e,n){return on.raw(`/xyzen/api/v1/files/${e}/download`,{signal:n?.signal})}validateFile(e,n={}){const{maxSize:r=100*1024*1024,allowedTypes:i=KOn}=n;return e.size>r?{valid:!1,reason:"file_too_large",maxSize:r,actualSize:e.size,error:`File size exceeds ${(r/(1024*1024)).toFixed(0)}MB limit`}:i.length>0&&!i.some(l=>this.isAllowedType(e,l))?{valid:!1,reason:"unsupported_type",fileType:e.type||"unknown",error:`File type ${e.type||"unknown"} is not supported`}:{valid:!0}}getFileCategory(e){if(e.type.startsWith("image/"))return"images";if(e.type.startsWith("audio/"))return"audio";const n=e.name.toLowerCase();return e.type.includes("pdf")||e.type.includes("text")||e.type.includes("document")||e.type.includes("sheet")||e.type.includes("presentation")||e.type.includes("json")||e.type.includes("xml")||e.type.includes("yaml")||ZOn.some(r=>n.endsWith(r))?"documents":"others"}getAttachmentAccessHint(e,n){const r=n||this.getFileCategory({name:e.name,type:e.type});return r==="images"||r==="audio"?"view":"read"}generateThumbnail(e){return new Promise((n,r)=>{if(!e.type.startsWith("image/")){r(new Error("File is not an image"));return}const i=160,o=URL.createObjectURL(e),l=new Image;l.onload=()=>{URL.revokeObjectURL(o);let u=l.width,d=l.height;u>d?u>i&&(d=Math.round(d*i/u),u=i):d>i&&(u=Math.round(u*i/d),d=i);const p=document.createElement("canvas");p.width=u,p.height=d;const m=p.getContext("2d");if(!m){r(new Error("Failed to get canvas context"));return}m.drawImage(l,0,0,u,d);const g=p.toDataURL("image/jpeg",.8);n(g)},l.onerror=()=>{URL.revokeObjectURL(o),r(new Error("Failed to load image"))},l.src=o})}}const ys=new XOn;class JOn{async editMessage(e,n){return on.patch(`/xyzen/api/v1/messages/${e}`,n)}async deleteMessage(e){return on.delete(`/xyzen/api/v1/messages/${e}`)}}const uot=new JOn;function eFn(t,e,n){const{updateDerivedStatus:r,waitForChannelConnection:i}=n;return{sendMessage:async o=>{const{activeChatChannel:l,uploadedFiles:u,clearFiles:d,isUploading:p,channels:m,connectToChannel:g,showNotification:h}=e();if(!l)return;if(p){console.warn("Cannot send message while files are uploading");return}const f=m[l];if(!f)return;if(f.responding){console.warn("Cannot send message while assistant is responding");return}Qb.hasConnection(l)||(g(f.sessionId,f.id),await i(l));const b=e().channels[l];if(!b?.connected){h("Connection not ready","Please wait for chat connection and try again.","warning");return}const y=EN(),v=u.filter(k=>k.status==="completed"&&k.uploadedId),_=v.map(k=>({id:k.uploadedId,name:k.file.name,type:k.file.type,size:k.file.size,category:ys.getFileCategory(k.file)}));t(k=>{const C=k.channels[l];C&&(C.responding=!0,C.messages.push({id:y,clientId:y,role:"user",content:o,created_at:new Date().toISOString(),status:"sending",isNewMessage:!0,..._.length>0?{attachments:_}:{}}))}),r();const w={message:o,client_id:y};v.length>0&&(w.file_ids=v.map(k=>k.uploadedId));const x=b;x?.knowledgeContext&&(w.context=x.knowledgeContext);try{await dg.sendMessage(l,w)}catch(k){console.error("Failed to send message via REST:",k),t(E=>{const S=E.channels[l];if(S){S.responding=!1;const I=S.messages.find(B=>B.clientId===y);I&&(I.status="failed")}}),r();const C=k instanceof Error&&"detail"in k?k.detail:void 0;if(C&&typeof C=="object"&&C.type==="parallel_chat_limit"){const E=C.data;e().showNotification(to.t("app.chat.parallelLimitTitle","Parallel chat limit reached"),to.t("app.chat.parallelLimitMessage","You have reached the parallel chat limit ({{current}}/{{limit}}). Please wait for other chats to finish.",{current:E?.current??"?",limit:E?.limit??"?"}),"warning")}else C&&typeof C=="object"&&C.error_code==="INSUFFICIENT_BALANCE"&&e().showNotification(to.t("app.chat.insufficientBalance","Insufficient balance"),to.t("app.chat.insufficientBalanceMessage","Your photon balance is insufficient. Please top up to continue."),"warning");return}d(!1)},startEditMessage:(o,l,u)=>{t({editingMessageId:o,editingContent:l,editingMode:u})},cancelEditMessage:()=>{t({editingMessageId:null,editingContent:"",editingMode:null})},submitEditMessage:async()=>{const{editingMessageId:o,editingContent:l,editingMode:u,activeChatChannel:d,channels:p}=e();if(!o||!d||!u)return;const m=p[d];if(!m)return;if(!m.messages.some(f=>f.id===o)){console.error("Message not found in active channel, skipping edit"),e().cancelEditMessage();return}const h=u==="edit_and_regenerate";try{const f=await uot.editMessage(o,{content:l,truncate_and_regenerate:h});t(b=>{const y=b.channels[d];if(!y)return;const v=y.messages.findIndex(_=>_.id===o);v!==-1&&(y.messages[v].content=f.message.content,y.messages[v].created_at=f.message.created_at,h&&(y.messages=y.messages.slice(0,v+1),y.responding=!1),b.editingMessageId=null,b.editingContent="",b.editingMode=null)}),f.regenerate&&e().triggerRegeneration()}catch(f){console.error("Failed to edit message:",f),e().showNotification("Error",to.t("app.message.editFailed"),"error")}},triggerRegeneration:()=>{const{activeChatChannel:o}=e();if(o){if(!Qb.hasConnection(o)){console.warn("[triggerRegeneration] No SSE connection, skipping");return}t(l=>{const u=l.channels[o];u&&(u.responding=!0)}),dg.regenerate(o).catch(l=>{console.error("Failed to trigger regeneration:",l),t(u=>{const d=u.channels[o];d&&(d.responding=!1)}),r()})}},deleteMessage:async o=>{const{activeChatChannel:l,channels:u}=e();if(!l)return;const d=u[l];if(!d)return;if(!Jit(o)){const g=d.messages.find(h=>h.id===o)?.status==="streaming"?to.t("app.message.deleteStillStreaming"):to.t("app.message.deleteNotSaved");console.error(`Cannot delete message: ${g} (id: ${o.slice(0,20)}...)`),e().showNotification(to.t("app.message.cannotDelete"),g,"warning");return}if(!d.messages.some(m=>m.id===o)){console.error("Message not found in active channel, skipping delete");return}try{await uot.deleteMessage(o),t(m=>{const g=m.channels[l];g&&(g.messages=g.messages.filter(h=>h.id!==o))})}catch(m){console.error("Failed to delete message:",m),e().showNotification("Error",to.t("app.message.deleteFailed"),"error")}},retryMessage:o=>{const{activeChatChannel:l,channels:u,sendMessage:d}=e();if(!l)return;const p=u[l];if(!p)return;const m=p.messages.find(h=>h.id===o);if(!m||m.status!=="failed")return;const g=m.content;t(h=>{const f=h.channels[l];f&&(f.messages=f.messages.filter(b=>b.id!==o))}),d(g)}}}const ite=50,tFn=(t,e)=>{const n=d=>d&&e().resolveAgent(d)?.name||"通用助理",r=async(d,p)=>{const m=Date.now();for(;Date.now()-m<=yOn;){const g=e().channels[d];if(g?.connected)return!0;if(g?.error)return p?.logFailure&&console.warn(`Connection failed for topic ${d}: ${g.error}`),!1;await new Promise(h=>{setTimeout(h,vOn)})}return p?.logFailure&&console.warn(`Connection timeout for topic ${d}`),!1},i=()=>{const d=e().respondingChannelIds;t(p=>{const m=new Set,g=new Set,h={};for(const b of Object.values(p.channels)){const y=oOn(b);(y==="running"||y==="stopping")&&(m.add(b.id),b.agentId&&g.add(b.agentId)),y==="running"&&b.agentId&&(h[b.agentId]=(h[b.agentId]||0)+1)}p.respondingChannelIds=m,p.runningAgentIds=g,p.activeTopicCountByAgent=h;const f=p.activeChatChannel;if(f){const b=d.has(f),y=m.has(f);b!==y&&console.debug(`[updateDerivedStatus] active channel ${f}: respondingChannelIds ${b} → ${y}`,`| channel.responding: ${p.channels[f]?.responding}`)}})},u={reconcileChannelFromBackend:async d=>{const{setLoading:p}=e(),m=`topicMessages-${d}`,g=e().channels[d];if(g?.responding){console.debug(`[reconcile] SKIP — channel is responding, topic=${d.slice(0,8)} msgs=${g.messages.length}`);return}console.groupCollapsed(`[reconcile] topic=${d.slice(0,8)} responding=${g?.responding} msgs=${g?.messages.length}`),console.debug(new Error().stack?.split(`
|
|
109
|
+
`);i&&(r.content=i)}r.agentExecution?.status==="running"||ate(r,{status:"completed",onlyIfRunning:!0}),r.created_at=e.created_at||new Date().toISOString(),console.debug("[ChatSlice] streaming_end: finalized message at index",n)}else console.warn("[ChatSlice] streaming_end: no message found to finalize")}function COn(t,e){t.messages.some(n=>n.id===e.id)||t.messages.push({...e,status:e.status||"completed",isNewMessage:!0})}function SOn(t,e){let n=ax(t,e.stream_id);if(n===-1)for(let r=t.messages.length-1;r>=0;r--){const i=t.messages[r];if(i.role==="assistant"&&i.error&&!Jit(i.id)){n=r;break}}if(n!==-1){if(t.messages.findIndex((l,u)=>u!==n&&l.id===e.db_id)!==-1){t.messages.splice(n,1);return}const i=t.messages[n];i.dbId=e.db_id,i.id=e.db_id,i.created_at=e.created_at,i.status==="waiting_for_user"||i.userQuestion?.status==="pending"||ate(i,{status:"completed",onlyIfRunning:!0})}}function IOn(t,e){t.responding=!0;const n=CN(t);if(n!==-1){const i=t.messages[n];i.id=e.stream_id,i.status="thinking",i.thinkingContent="",i.content=i.content||"";return}const r=D7(t);if(r!==-1){const i=t.messages[r];i.status="thinking",i.thinkingContent=i.thinkingContent??"";return}t.messages.push({id:e.stream_id,clientId:`thinking-${Date.now()}`,role:"assistant",content:"",isNewMessage:!0,created_at:new Date().toISOString(),status:"thinking",thinkingContent:""})}function Kgo(t,e){}function TOn(t,e){t.responding=!0;const{context:n}=e;let r=-1;n.stream_id&&(r=ax(t,n.stream_id)),r===-1&&(r=CN(t));const i={agentId:n.agent_id,agentName:n.agent_name,agentType:n.agent_type,executionId:n.execution_id,status:"running",startedAt:n.started_at,phases:[],subagents:[]};if(r!==-1){const o=t.messages[r];t.messages[r]={...o,id:`agent-${n.execution_id}`,streamId:n.stream_id||o.streamId,status:"pending",agentExecution:i}}else t.messages.push({id:`agent-${n.execution_id}`,streamId:n.stream_id,clientId:EN(),role:"assistant",content:"",created_at:new Date().toISOString(),status:"pending",isNewMessage:!0,agentExecution:i})}function BOn(t,e){t.responding=!1;const{context:n}=e,r=t.messages.findIndex(i=>i.agentExecution?.executionId===n.execution_id);if(r!==-1){const i=t.messages[r];i.agentExecution?ate(i,{status:e.status==="completed"?"completed":e.status==="cancelled"?"cancelled":"failed",durationMs:e.duration_ms}):Qxe(i)}}function DOn(t,e){t.responding=!1;const{context:n}=e,r=t.messages.findIndex(i=>i.agentExecution?.executionId===n.execution_id);if(r!==-1){const i=t.messages[r],o=i.agentExecution;o?(o.error={type:e.error_type,message:e.error_message,recoverable:e.recoverable,nodeId:e.node_id},ate(i,{status:"failed"})):Qxe(i)}}function NOn(t,e){const{context:n}=e,r=t.messages.findIndex(i=>i.agentExecution?.executionId===n.execution_id);if(r!==-1){const i=t.messages[r].agentExecution;if(i){const o=i.phases.find(p=>p.status==="running");o&&(o.status="completed",o.endedAt=Date.now(),o.startedAt&&(o.durationMs=Date.now()-o.startedAt));const l=sOn(e.node_id),u=i.phases.filter(p=>p.nodeId===e.node_id).length,d=u>0?`${e.node_id}__${u}`:e.node_id;i.phases.push({id:d,nodeId:e.node_id,name:l,componentKey:e.component_key,status:"running",startedAt:Date.now(),nodes:[],streamedContent:""}),i.currentPhase=l,i.currentNode=e.node_id}}}function ROn(t,e){const{context:n}=e,r=t.messages.findIndex(i=>i.agentExecution?.executionId===n.execution_id);if(r!==-1){const i=t.messages[r].agentExecution;if(i){const o=i.phases.findLast(l=>l.nodeId===e.node_id&&l.status==="running");o&&(o.status=e.status==="completed"?"completed":e.status==="skipped"?"skipped":"failed",o.endedAt=Date.now(),o.durationMs=e.duration_ms,o.outputSummary=e.output_summary)}}}function LOn(t,e){const{context:n}=e,r=t.messages.findIndex(i=>i.agentExecution&&(i.agentExecution.executionId===n.parent_execution_id||i.agentExecution.executionId===n.execution_id));if(r!==-1){const i=t.messages[r].agentExecution;i&&i.subagents.push({id:e.subagent_id,name:e.subagent_name,type:e.subagent_type,status:"running",depth:n.depth,executionPath:n.execution_path,startedAt:n.started_at})}}function MOn(t,e){const n=t.messages.findIndex(r=>r.agentExecution?.subagents?.some(i=>i.id===e.subagent_id));if(n!==-1){const r=t.messages[n].agentExecution;if(r){const i=r.subagents.find(o=>o.id===e.subagent_id);i&&(i.status=e.status==="completed"?"completed":"failed",i.endedAt=Date.now(),i.durationMs=e.duration_ms,i.outputSummary=e.output_summary)}}}function POn(t,e){const{context:n}=e,r=t.messages.findIndex(i=>i.agentExecution?.executionId===n.execution_id);if(r!==-1){const i=t.messages[r].agentExecution;i&&(i.progressPercent=e.progress_percent,i.progressMessage=e.message)}}function OOn(t,e){t.responding=!1;const n=e.error_code?{code:e.error_code,category:e.error_category||e.error_code.split(".")[0],message:e.error,recoverable:e.recoverable??!1,detail:e.detail,errorRef:e.error_ref,occurredAt:e.occurred_at}:{code:"system.internal_error",category:"system",message:e.error||"An error occurred",recoverable:!1};let r=ax(t,e.stream_id);r===-1&&(r=CN(t)),r===-1&&(r=lOn(t)),r===-1&&(r=D7(t)),r!==-1?t.messages[r]={...t.messages[r],status:"failed",error:n}:t.messages.push({id:e.stream_id,streamId:e.stream_id,clientId:EN(),role:"assistant",content:"",created_at:new Date().toISOString(),status:"failed",isNewMessage:!0,error:n}),console.error("Chat error:",e.error_code||e.error)}function FOn(t,e){console.warn("Insufficient balance:",e),t.responding=!1;let n=ax(t,e.stream_id);return n===-1&&(n=CN(t)),n!==-1&&(t.messages[n]={...t.messages[n],content:"",status:"failed",error:{code:"billing.insufficient_balance",category:"billing",message:e.message||"Insufficient balance. Please recharge to continue.",recoverable:!1}}),{isOpen:!0,title:"积分用尽",message:"您的积分已用尽。目前产品处于内测阶段,欢迎填写问卷参与内测,获取更多使用额度。",type:"warning",actionLabel:"填写问卷",actionUrl:"https://sii-czxy.feishu.cn/share/base/form/shrcnYu8Y3GNgI7M14En1xJ7rMb"}}function QOn(t,e){console.warn("Parallel chat limit reached:",e),t.responding=!1;const n=CN(t);return n!==-1&&t.messages.splice(n,1),{isOpen:!0,title:"并行会话已达上限",message:`您已达到并行会话上限(${e.current??"?"}/${e.limit??"?"})。请等待其他会话完成后重试。`,type:"warning"}}function $On(t,e,n){console.log("Stream aborted:",e);const r=n.get(t.id);r&&(clearTimeout(r),n.delete(t.id)),t.responding=!1,t.aborting=!1,$xe(t)}function jOn(t,e){t.responding=!0;const n=t.messages.findIndex(l=>l.status==="pending"&&!l.agentExecution);n!==-1&&t.messages.splice(n,1);const r={id:e.id,name:e.name,description:e.description,arguments:e.arguments,status:e.status,timestamp:new Date(e.timestamp*1e3).toISOString()};let i=D7(t);if(i===-1&&e.stream_id&&(i=ax(t,e.stream_id)),i!==-1){const l=t.messages[i].agentExecution;if(l){let u=l.currentNode?l.phases.findLast(d=>d.nodeId===l.currentNode):null;if(u||(u=l.phases.findLast(d=>d.status==="running")),!u&&l.phases.length>0&&(u=l.phases[l.phases.length-1]),u){u.toolCalls||(u.toolCalls=[]);const d=u.streamedContent?.length??0;r.contentOffset=d,u.toolCalls.push(r),console.log(`ChatSlice: Added tool call ${e.name} to phase ${u.id}`);return}}}const o=`tool-call-${e.id}`;t.messages.push({id:o,streamId:e.stream_id,clientId:EN(),role:"assistant",content:"",created_at:new Date().toISOString(),status:"streaming",isNewMessage:!0,toolCalls:[r]}),console.log(`ChatSlice: Created new tool call message with tool ${e.name}`)}function zOn(t,e){const n=D7(t);if(n!==-1){const r=t.messages[n].agentExecution;if(r){for(const i of r.phases)if(i.toolCalls){const o=i.toolCalls.find(l=>l.id===e.toolCallId);if(o){o.status=e.status,e.result!=null&&(o.result=e.result),e.error&&(o.error=e.error),e.duration_ms!==void 0&&(o.duration_ms=e.duration_ms);break}}}}t.messages.forEach(r=>{r.toolCalls&&r.toolCalls.forEach(i=>{i.id===e.toolCallId&&(i.status=e.status,e.result!=null&&(i.result=e.result),e.error&&(i.error=e.error),e.duration_ms!==void 0&&(i.duration_ms=e.duration_ms))})})}function UOn(t,e,n){t.title=e.name;const r=n.find(i=>i.id===e.id);r&&(r.title=e.name,r.updatedAt=e.updated_at)}function qOn(t,e){const n=rot(t,"citations");n!==-1?(t.messages[n].citations=e.citations,console.log(`Attached ${e.citations.length} citations to message ${t.messages[n].id}`)):console.warn("[Citation Debug] Could not find assistant message to attach citations")}function GOn(t,e){const n=rot(t,"attachments");if(n!==-1){t.messages[n].attachments||(t.messages[n].attachments=[]);const i=t.messages[n].attachments||[],o=e.files.filter(l=>!i.some(u=>u.id===l.id)).map(l=>({...l,download_url:`/xyzen/api/v1/files/${l.id}/download`}));t.messages[n].attachments=[...i,...o]}}function HOn(t,e){t.contextUsage={estimatedTokens:e.estimated_tokens,maxTokens:e.max_tokens,usagePercent:e.usage_percent,nearLimit:e.near_limit,critical:e.critical}}function WOn(t){return{questionId:t.question_id,question:t.question,options:t.options?.map(e=>({id:e.id,label:e.label,description:e.description,markdown:e.markdown})),multiSelect:t.multi_select??!1,allowTextInput:t.allow_text_input,timeoutSeconds:t.timeout_seconds,threadId:t.thread_id,status:"pending",askedAt:Date.now()}}function YOn(t,e){let n=ax(t,e.stream_id);if(n===-1&&(n=D7(t)),n===-1){for(let o=t.messages.length-1;o>=0;o--)if(t.messages[o].role==="assistant"){n=o;break}}if(n===-1){console.warn("[questionHandlers] No target message found for ask_user_question event");return}const r=t.messages[n],i=WOn(e);r.agentExecution&&r.agentExecution.phases.length>0&&(i.afterPhaseIndex=r.agentExecution.phases.length-1),r.userQuestion&&r.userQuestion.status!=="pending"&&(r.answeredQuestions||(r.answeredQuestions=[]),r.answeredQuestions.push(r.userQuestion)),r.status="waiting_for_user",r.userQuestion=i,t.responding=!0}const R7=new Map;function VOn(t,e,n){const{updateDerivedStatus:r,closeIdleNonPrimaryConnection:i}=n;return{connectToChannel:(o,l)=>{console.debug(`[connectToChannel] topic=${l.slice(0,8)} hasExistingSSE=${Qb.hasConnection(l)} msgs=${e().channels[l]?.messages.length}`),R7.get(l)?.destroy();const u=new wOn(m=>{t(g=>{const h=g.channels[l];h&&m(h)})});R7.set(l,u);const d=m=>{const g=m;if(g.type==="streaming_chunk"){u.pushStreaming(g.data.stream_id,g.data.content,g.data.execution_id);return}if(g.type==="thinking_chunk"){u.pushThinking(g.data.stream_id,g.data.content);return}const h=u.hasPending;u.flushSync();const f=e().channels[l]?.responding;console.groupCollapsed(`[ChatEvent] ${g.type} | topic=${l.slice(0,8)} | responding=${f}`),t(y=>{const v=y.channels[l];if(v){switch(console.debug(`msgs=${v.messages.length}`,`| latestAssist=${(()=>{const _=[...v.messages].reverse().find(w=>w.role==="assistant");return _?`id=${_.id.slice(0,12)} status=${_.status} agentExec=${_.agentExecution?.status}`:"none"})()}`),g.type){case"processing":case"loading":{xOn(v,g.data.stream_id);break}case"streaming_start":{kOn(v,g.data);break}case"streaming_end":{EOn(v,g.data);break}case"message":{const _=g.data,w=_.client_id;if(w){const x=v.messages.findIndex(k=>k.clientId===w);if(x!==-1){const k=v.messages[x];v.messages[x]={...k,..._,id:_.id,status:_.status||"completed",isNewMessage:!1};break}}COn(v,_);break}case"search_citations":{qOn(v,g.data);break}case"generated_files":{GOn(v,g.data);break}case"message_saved":{SOn(v,g.data);break}case"message_ack":{const{message_id:_,client_id:w}=g.data;if(w){const x=v.messages.findIndex(k=>k.clientId===w);if(x!==-1){const k=v.messages[x];k.id=_,k.status==="sending"&&(k.status="completed")}}break}case"tool_call_request":{jOn(v,g.data);break}case"tool_call_response":{zOn(v,g.data);break}case"error":{OOn(v,g.data);break}case"insufficient_balance":{const _=FOn(v,g.data);_&&(y.notification={..._,onAction:()=>window.open(_.actionUrl,"_blank")});break}case"parallel_chat_limit":{const _=QOn(v,g.data);y.notification=_;break}case"stream_aborted":{$On(v,g.data,A1);break}case"thinking_start":{IOn(v,g.data);break}case"thinking_end":{g.data;break}case"topic_updated":{UOn(v,g.data,y.chatHistory);break}case"agent_start":{TOn(v,g.data);break}case"agent_end":{BOn(v,g.data);break}case"agent_error":{DOn(v,g.data);break}case"node_start":{NOn(v,g.data);break}case"node_end":{ROn(v,g.data);break}case"subagent_start":{LOn(v,g.data);break}case"subagent_end":{MOn(v,g.data);break}case"progress_update":{POn(v,g.data);break}case"ask_user_question":{YOn(v,g.data);break}case"token_usage":{const{total_tokens:_}=g.data;v.tokenUsage=_;break}case"context_usage":{HOn(v,g.data);break}}jxe(v)}});const b=e().channels[l]?.responding;if(f!==b&&console.debug(`responding changed: ${f} → ${b}`,`| hadPendingChunks: ${h}`),console.groupEnd(),g.type==="topic_updated"&&e().renameTab(g.data.id,g.data.name),g.type==="agent_end"){const y=e().channels[l];y?.sessionId&&!y.sandbox_backend&&Np.getSessionByTopic(l).then(v=>{v.sandbox_backend&&t(_=>{const w=_.channels[l];w&&!w.sandbox_backend&&(w.sandbox_backend=v.sandbox_backend)})}).catch(()=>{})}r(),i(l)};if(Qb.hasConnection(l)){Qb.updateCallbacks(l,{onMessageEvent:d,onStatusChange:m=>{t(g=>{const h=g.channels[l];h&&(h.connected=m.connected,h.error=m.error??null)})}}),t(m=>{m.channels[l]&&(m.channels[l].connected=!0,m.channels[l].error=null)});return}const p=Qb.getOpenTopicIds();for(const m of p){if(m===l)continue;e().channels[m]?.responding||Qb.disconnect(m)}t(m=>{Object.entries(m.channels).forEach(([g,h])=>{Qb.hasConnection(g)||(h.connected=!1)}),m.channels[l]&&(m.channels[l].error=null)}),Qb.connect(l,{onMessageEvent:d,onStatusChange:m=>{t(g=>{const h=g.channels[l];h&&(h.connected=m.connected,h.error=m.error??null)})}}),t(m=>{m.channels[l]&&(m.channels[l].connected=!0,m.channels[l].error=null)})},disconnectFromChannel:()=>{for(const[,o]of R7)o.destroy();R7.clear();for(const[o,l]of A1)clearTimeout(l),A1.delete(o);Qb.disconnectAll()},abortGeneration:o=>{dg.abort(o).catch(p=>{console.error("Failed to send abort signal:",p)});const l=A1.get(o);l&&(clearTimeout(l),A1.delete(o));const u=R7.get(o);u&&u.destroy(),t(p=>{const m=p.channels[o];m&&(m.aborting=!0,$xe(m))}),r();const d=setTimeout(()=>{A1.delete(o),e().channels[o]?.aborting&&(console.warn("Abort timeout: Backend did not respond, resetting state"),t(g=>{const h=g.channels[o];h&&(h.aborting=!1,h.responding=!1,$xe(h))}),r())},1e4);A1.set(o,d)},respondToQuestion:(o,l,u)=>{dg.answerQuestion(o,{question_id:l,selected_options:u.selectedOptions,text:u.text||""}).catch(d=>{console.error("Failed to send question response:",d)}),t(d=>{const p=d.channels[o];if(!p)return;const m=p.messages.find(h=>h.userQuestion?.questionId===l||h.answeredQuestions?.some(f=>f.questionId===l));if(!m)return;const g=m.userQuestion?.questionId===l?m.userQuestion:m.answeredQuestions?.find(h=>h.questionId===l);g&&(g.status="answered",g.selectedOptions=u.selectedOptions,g.userText=u.text,m.status="pending")}),r()},confirmToolCall:(o,l)=>{console.warn("confirmToolCall: not implemented in SSE mode"),t(u=>{u.channels[o]&&u.channels[o].messages.forEach(d=>{d.toolCalls&&d.toolCalls.forEach(p=>{p.id===l&&p.status==="waiting_confirmation"&&(p.status="executing")})})})},cancelToolCall:(o,l)=>{console.warn("cancelToolCall: not implemented in SSE mode"),t(u=>{u.channels[o]&&u.channels[o].messages.forEach(d=>{d.toolCalls&&d.toolCalls.forEach(p=>{p.id===l&&p.status==="waiting_confirmation"&&(p.status="failed",p.error="用户取消执行")})})})}}}const KOn=["image/jpeg","image/jpg","image/png","image/gif","image/webp","application/pdf","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/json","application/xml","application/x-yaml","text/plain","text/markdown","text/csv","text/html","text/xml","text/yaml","text/x-yaml","audio/mpeg","audio/wav","audio/wave","audio/x-wav",".csv",".docx",".htm",".html",".json",".md",".pdf",".pptx",".txt",".xlsx",".xml",".yaml",".yml"],ZOn=[".csv",".docx",".htm",".html",".json",".md",".pdf",".pptx",".txt",".xlsx",".xml",".yaml",".yml"];class XOn{appendUploadFields(e,n){e.append("file",n.file),e.append("scope",n.scope),n.category&&e.append("category",n.category),n.parentId&&e.append("parent_id",n.parentId),n.knowledgeSetId&&e.append("knowledge_set_id",n.knowledgeSetId),n.purpose&&e.append("purpose",n.purpose)}getUploadError(e){if(e.status===429)return new Error("Too many requests. Please wait a moment and try again.");try{const n=JSON.parse(e.responseText);if(typeof n.detail=="string"&&n.detail.trim())return new Error(n.detail)}catch{}return new Error(`Upload failed: ${e.statusText||`HTTP ${e.status}`}`)}uploadWithXhr(e,n){const r=new FormData;this.appendUploadFields(r,e);const i=new XMLHttpRequest,o=on.baseUrl;return{promise:new Promise((u,d)=>{i.upload.addEventListener("progress",m=>{if(n&&m.lengthComputable){const g=Math.round(m.loaded*100/m.total);n({loaded:m.loaded,total:m.total,percentage:g})}}),i.addEventListener("load",()=>{i.status>=200&&i.status<300?u(JSON.parse(i.responseText)):d(this.getUploadError(i))}),i.addEventListener("error",()=>{d(new Error("Upload failed"))}),i.addEventListener("abort",()=>{d(new Error("Upload cancelled"))}),i.open("POST",`${o}/xyzen/api/v1/files/upload`);const p=Eo.getToken();p&&i.setRequestHeader("Authorization",`Bearer ${p}`),i.send(r)}),abort:()=>i.abort()}}isAllowedType(e,n){return n.endsWith("/*")?e.type.startsWith(n.slice(0,-1)):n.startsWith(".")?e.name.toLowerCase().endsWith(n.toLowerCase()):e.type===n}uploadFileWithProgress(e,n="private",r,i,o,l){return this.uploadWithXhr({file:e,scope:n,category:r,parentId:i,knowledgeSetId:o},l)}async uploadFile(e,n="private",r,i,o,l){return this.uploadWithXhr({file:e,scope:n,category:r,parentId:i,knowledgeSetId:o},l).promise}async uploadChatAttachment(e,n="private",r,i,o,l){return this.uploadWithXhr({file:e,scope:n,category:r,parentId:i,knowledgeSetId:o,purpose:"chat_attachment"},l).promise}async getFile(e){return on.get(`/xyzen/api/v1/files/${e}`)}async listFiles(e){const n=new URLSearchParams;e&&(e.scope&&n.append("scope",e.scope),e.category&&n.append("category",e.category),e.include_deleted&&n.append("include_deleted","true"),e.limit&&n.append("limit",e.limit.toString()),e.offset&&n.append("offset",e.offset.toString()),e.parent_id&&n.append("parent_id",e.parent_id),e.filter_by_parent&&n.append("filter_by_parent","true"),e.is_dir!==void 0&&n.append("is_dir",e.is_dir.toString()),e.knowledge_set_id&&n.append("knowledge_set_id",e.knowledge_set_id));const r=n.toString()?"?"+n.toString():"";return on.get(`/xyzen/api/v1/files/${r}`)}async getFileUrl(e,n=3600){return on.get(`/xyzen/api/v1/files/${e}/url`,{params:{expires_in:n}})}async updateFile(e,n){return on.patch(`/xyzen/api/v1/files/${e}`,n)}async confirmFiles(e,n){await Promise.all(e.map(r=>this.updateFile(r,{message_id:n,status:"confirmed"})))}async deleteFile(e,n=!1){return on.delete(`/xyzen/api/v1/files/${e}`,void 0,{params:{hard_delete:n}})}async restoreFile(e){return on.post(`/xyzen/api/v1/files/${e}/restore`)}async getStorageStats(){return on.get("/xyzen/api/v1/files/stats/summary")}async getChatUploadCapabilities(){return on.get("/xyzen/api/v1/files/chat-upload-capabilities")}async emptyTrash(){return on.post("/xyzen/api/v1/files/empty-trash")}async bulkDeleteFiles(e){return on.delete("/xyzen/api/v1/files/bulk",e)}async updateFileContent(e,n,r){const i=new Blob([n],{type:r||"text/plain"}),o=new FormData;return o.append("file",i,"content"),on.put(`/xyzen/api/v1/files/${e}/content`,o)}async downloadRaw(e,n){return on.raw(`/xyzen/api/v1/files/${e}/download`,{signal:n?.signal})}validateFile(e,n={}){const{maxSize:r=100*1024*1024,allowedTypes:i=KOn}=n;return e.size>r?{valid:!1,reason:"file_too_large",maxSize:r,actualSize:e.size,error:`File size exceeds ${(r/(1024*1024)).toFixed(0)}MB limit`}:i.length>0&&!i.some(l=>this.isAllowedType(e,l))?{valid:!1,reason:"unsupported_type",fileType:e.type||"unknown",error:`File type ${e.type||"unknown"} is not supported`}:{valid:!0}}getFileCategory(e){if(e.type.startsWith("image/"))return"images";if(e.type.startsWith("audio/"))return"audio";const n=e.name.toLowerCase();return e.type.includes("pdf")||e.type.includes("text")||e.type.includes("document")||e.type.includes("sheet")||e.type.includes("presentation")||e.type.includes("json")||e.type.includes("xml")||e.type.includes("yaml")||ZOn.some(r=>n.endsWith(r))?"documents":"others"}getAttachmentAccessHint(e,n){const r=n||this.getFileCategory({name:e.name,type:e.type});return r==="images"||r==="audio"?"view":"read"}generateThumbnail(e){return new Promise((n,r)=>{if(!e.type.startsWith("image/")){r(new Error("File is not an image"));return}const i=160,o=URL.createObjectURL(e),l=new Image;l.onload=()=>{URL.revokeObjectURL(o);let u=l.width,d=l.height;u>d?u>i&&(d=Math.round(d*i/u),u=i):d>i&&(u=Math.round(u*i/d),d=i);const p=document.createElement("canvas");p.width=u,p.height=d;const m=p.getContext("2d");if(!m){r(new Error("Failed to get canvas context"));return}m.drawImage(l,0,0,u,d);const g=p.toDataURL("image/jpeg",.8);n(g)},l.onerror=()=>{URL.revokeObjectURL(o),r(new Error("Failed to load image"))},l.src=o})}}const ys=new XOn;class JOn{async editMessage(e,n){return on.patch(`/xyzen/api/v1/messages/${e}`,n)}async deleteMessage(e){return on.delete(`/xyzen/api/v1/messages/${e}`)}}const uot=new JOn;function eFn(t,e,n){const{updateDerivedStatus:r,waitForChannelConnection:i}=n;return{sendMessage:async o=>{const{activeChatChannel:l,uploadedFiles:u,clearFiles:d,isUploading:p,channels:m,connectToChannel:g,showNotification:h}=e();if(!l)return;if(p){console.warn("Cannot send message while files are uploading");return}const f=m[l];if(!f)return;if(f.responding){console.warn("Cannot send message while assistant is responding");return}Qb.hasConnection(l)||(g(f.sessionId,f.id),await i(l));const b=e().channels[l];if(!b?.connected){h("Connection not ready","Please wait for chat connection and try again.","warning");return}const y=EN(),v=u.filter(k=>k.status==="completed"&&k.uploadedId),_=v.map(k=>({id:k.uploadedId,name:k.file.name,type:k.file.type,size:k.file.size,category:ys.getFileCategory(k.file)}));t(k=>{const C=k.channels[l];C&&(C.responding=!0,C.messages.push({id:y,clientId:y,role:"user",content:o,created_at:new Date().toISOString(),status:"sending",isNewMessage:!0,..._.length>0?{attachments:_}:{}}))}),r();const w={message:o,client_id:y};v.length>0&&(w.file_ids=v.map(k=>k.uploadedId));const x=b;x?.knowledgeContext&&(w.context=x.knowledgeContext);try{await dg.sendMessage(l,w)}catch(k){console.error("Failed to send message via REST:",k),t(E=>{const S=E.channels[l];if(S){S.responding=!1;const I=S.messages.find(B=>B.clientId===y);I&&(I.status="failed")}}),r();const C=k instanceof Error&&"detail"in k?k.detail:void 0;if(C&&typeof C=="object"&&C.type==="parallel_chat_limit"){const E=C.data;e().showNotification(to.t("app.chat.parallelLimitTitle","Parallel chat limit reached"),to.t("app.chat.parallelLimitMessage","You have reached the parallel chat limit ({{current}}/{{limit}}). Please wait for other chats to finish.",{current:E?.current??"?",limit:E?.limit??"?"}),"warning")}else C&&typeof C=="object"&&C.error_code==="INSUFFICIENT_BALANCE"&&e().showNotification(to.t("app.chat.insufficientBalance","Insufficient balance"),to.t("app.chat.insufficientBalanceMessage","Your photon balance is insufficient. Please top up to continue."),"warning");return}d(!1)},startEditMessage:(o,l,u)=>{t({editingMessageId:o,editingContent:l,editingMode:u})},cancelEditMessage:()=>{t({editingMessageId:null,editingContent:"",editingMode:null})},submitEditMessage:async()=>{const{editingMessageId:o,editingContent:l,editingMode:u,activeChatChannel:d,channels:p}=e();if(!o||!d||!u)return;const m=p[d];if(!m)return;if(!m.messages.some(f=>f.id===o)){console.error("Message not found in active channel, skipping edit"),e().cancelEditMessage();return}const h=u==="edit_and_regenerate";try{const f=await uot.editMessage(o,{content:l,truncate_and_regenerate:h});t(b=>{const y=b.channels[d];if(!y)return;const v=y.messages.findIndex(_=>_.id===o);v!==-1&&(y.messages[v].content=f.message.content,y.messages[v].created_at=f.message.created_at,h&&(y.messages=y.messages.slice(0,v+1),y.responding=!1),b.editingMessageId=null,b.editingContent="",b.editingMode=null)}),f.regenerate&&e().triggerRegeneration()}catch(f){console.error("Failed to edit message:",f),e().showNotification("Error",to.t("app.message.editFailed"),"error")}},triggerRegeneration:()=>{const{activeChatChannel:o}=e();if(o){if(!Qb.hasConnection(o)){console.warn("[triggerRegeneration] No SSE connection, skipping");return}t(l=>{const u=l.channels[o];u&&(u.responding=!0)}),dg.regenerate(o).catch(l=>{console.error("Failed to trigger regeneration:",l),t(u=>{const d=u.channels[o];d&&(d.responding=!1)}),r()})}},deleteMessage:async o=>{const{activeChatChannel:l,channels:u}=e();if(!l)return;const d=u[l];if(!d)return;if(!Jit(o)){const g=d.messages.find(h=>h.id===o)?.status==="streaming"?to.t("app.message.deleteStillStreaming"):to.t("app.message.deleteNotSaved");console.error(`Cannot delete message: ${g} (id: ${o.slice(0,20)}...)`),e().showNotification(to.t("app.message.cannotDelete"),g,"warning");return}if(!d.messages.some(m=>m.id===o)){console.error("Message not found in active channel, skipping delete");return}try{await uot.deleteMessage(o),t(m=>{const g=m.channels[l];g&&(g.messages=g.messages.filter(h=>h.id!==o))})}catch(m){console.error("Failed to delete message:",m),e().showNotification("Error",to.t("app.message.deleteFailed"),"error")}},retryMessage:o=>{const{activeChatChannel:l,channels:u,sendMessage:d}=e();if(!l)return;const p=u[l];if(!p)return;const m=p.messages.find(h=>h.id===o);if(!m||m.status!=="failed")return;const g=m.content;t(h=>{const f=h.channels[l];f&&(f.messages=f.messages.filter(b=>b.id!==o))}),d(g)}}}const ite=50,tFn=(t,e)=>{const n=d=>d&&e().resolveAgent(d)?.name||"通用助理",r=async(d,p)=>{const m=Date.now();for(;Date.now()-m<=yOn;){const g=e().channels[d];if(g?.connected)return!0;if(g?.error)return p?.logFailure&&console.warn(`Connection failed for topic ${d}: ${g.error}`),!1;await new Promise(h=>{setTimeout(h,vOn)})}return p?.logFailure&&console.warn(`Connection timeout for topic ${d}`),!1},i=()=>{const d=e().respondingChannelIds;t(p=>{const m=new Set,g=new Set,h={};for(const b of Object.values(p.channels)){const y=oOn(b);(y==="running"||y==="stopping")&&(m.add(b.id),b.agentId&&g.add(b.agentId)),y==="running"&&b.agentId&&(h[b.agentId]=(h[b.agentId]||0)+1)}p.respondingChannelIds=m,p.runningAgentIds=g,p.activeTopicCountByAgent=h;const f=p.activeChatChannel;if(f){const b=d.has(f),y=m.has(f);b!==y&&console.debug(`[updateDerivedStatus] active channel ${f}: respondingChannelIds ${b} → ${y}`,`| channel.responding: ${p.channels[f]?.responding}`)}})},u={reconcileChannelFromBackend:async d=>{const{setLoading:p}=e(),m=`topicMessages-${d}`,g=e().channels[d];if(g?.responding){console.debug(`[reconcile] SKIP — channel is responding, topic=${d.slice(0,8)} msgs=${g.messages.length}`);return}console.groupCollapsed(`[reconcile] topic=${d.slice(0,8)} responding=${g?.responding} msgs=${g?.messages.length}`),console.debug(new Error().stack?.split(`
|
|
110
110
|
`).slice(1,5).join(" <- ")),p(m,!0);try{const[h,f]=await Promise.all([dg.getMessages(d,{limit:ite}),dg.getTokenStats(d).catch(()=>null)]),b=Mxe(h);t(y=>{const v=y.channels[d];if(v){const _=new Set(b.map(E=>E.id)),w=v.messages.filter(E=>_.has(E.id)||E.dbId&&_.has(E.dbId)?!1:!!(E.status==="pending"||E.status==="streaming"||E.status==="thinking"||E.agentExecution)),x=new Set,k=[];for(const E of w){let S=-1;if(E.role==="assistant"){for(let I=b.length-1;I>=0;I--)if(b[I].role==="assistant"&&!x.has(I)){S=I;break}}if(S!==-1){const I=b[S];I.streamId=E.streamId,I.status=E.status,I.agentExecution=E.agentExecution,I.thinkingContent=E.thinkingContent,x.add(S)}else k.push(E)}const C=[...b,...k];console.debug(`[reconcile] OVERWRITE topic=${d.slice(0,8)} oldMsgs=${v.messages.length} dbMsgs=${b.length} preserved=${w.length} merged=${w.length-k.length} new=${k.length} responding=${v.responding}`),v.messages=C,v.hasOlderMessages=h.length>=ite,f?.total_tokens!=null&&(v.tokenUsage=f.total_tokens),jxe(v)}}),i()}catch(h){console.error("Failed to reconcile topic messages:",h)}finally{console.groupEnd(),p(m,!1)}},updateDerivedStatus:i,closeIdleNonPrimaryConnection:d=>{setTimeout(()=>{e().channels[d]?.responding||e().activeChatChannel===d||Qb.disconnect(d)},0)},getAgentNameById:n,waitForChannelConnection:r};return{activeChatChannel:null,activeTopicByAgent:{},chatHistory:[],chatHistoryLoading:!0,channels:{},respondingChannelIds:new Set,runningAgentIds:new Set,activeTopicCountByAgent:{},notification:null,editingMessageId:null,editingContent:"",editingMode:null,setKnowledgeContext:(d,p)=>{t(m=>{m.channels[d]&&(m.channels[d].knowledgeContext=p||void 0)})},showNotification:(d,p,m="info",g,h)=>{t(f=>{f.notification={isOpen:!0,title:d,message:p,type:m,actionLabel:g,onAction:h}})},closeNotification:()=>{t({notification:null})},loadOlderMessages:async d=>{const p=e().channels[d];if(!p||p.loadingOlderMessages||!p.hasOlderMessages)return;const m=p.messages.find(g=>g.id);if(m?.id){t(g=>{const h=g.channels[d];h&&(h.loadingOlderMessages=!0)});try{const g=await dg.getMessages(d,{before:m.id,limit:ite}),h=Mxe(g);t(f=>{const b=f.channels[d];if(b){const y=new Set(b.messages.map(_=>_.id)),v=h.filter(_=>!y.has(_.id));b.messages=[...v,...b.messages],b.hasOlderMessages=g.length>=ite,b.loadingOlderMessages=!1}})}catch(g){console.error("Failed to load older messages:",g),t(h=>{const f=h.channels[d];f&&(f.loadingOlderMessages=!1)})}}},..._On(t,e,u),...eFn(t,e,u),...VOn(t,e,u)}},nFn={maxSize:10*1024*1024,maxFiles:5,maxTotalSize:20*1024*1024,allowedTypes:["image/jpeg","image/jpg","image/png","image/gif","image/webp","application/pdf","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/json","application/xml","application/x-yaml","text/plain","text/markdown","text/csv","text/html","text/xml","text/yaml","text/x-yaml","audio/mpeg","audio/wav","audio/wave","audio/x-wav",".csv",".docx",".htm",".html",".json",".md",".pdf",".pptx",".txt",".xlsx",".xml",".yaml",".yml"],autoUpload:!0};function IN(t){return(t/(1024*1024)).toFixed(1)}function dot(t){const e=t.slice(0,3).map(r=>r.name).join(", "),n=t.length>3?to.t("app.input.moreFilesSuffix",{count:t.length-3}):"";return e+n}function pot(t,e){switch(e.reason){case"file_too_large":return to.t("app.input.fileTooLargeDetail",{name:t.name,maxSize:IN(e.maxSize??t.size),actualSize:IN(e.actualSize??t.size)});case"unsupported_type":return to.t("app.input.unsupportedFileTypeDetail",{name:t.name});default:return e.error||t.name}}const rFn=(t,e)=>({uploadedFiles:[],isUploading:!1,uploadError:null,fileUploadOptions:{...nFn},validateFiles:n=>{const r=e(),i=r.fileUploadOptions,o=r.uploadedFiles,l=[];o.length+n.length>(i.maxFiles||5)&&l.push(`Maximum ${i.maxFiles} files allowed. You have ${o.length} files and are trying to add ${n.length} more.`);for(const m of n){const g=ys.validateFile(m,{maxSize:i.maxSize,allowedTypes:i.allowedTypes});g.valid||l.push(pot(m,g))}const u=r.getTotalSize(),d=n.reduce((m,g)=>m+g.size,0),p=u+d;return p>(i.maxTotalSize||20*1024*1024)&&l.push(to.t("app.input.totalSizeExceededMessage",{maxSize:IN(i.maxTotalSize||20*1024*1024),actualSize:IN(p)})),{valid:l.length===0,errors:l.length>0?l:void 0,error:l.length>0?l.join("; "):void 0}},addFiles:async n=>{const r=e(),i=r.fileUploadOptions,o=r.uploadedFiles,l=[],u=[],d=[];for(const C of n){const E=ys.validateFile(C,{maxSize:i.maxSize,allowedTypes:i.allowedTypes});E.valid?l.push(C):(u.push({file:C,validation:E}),d.push(pot(C,E)))}const p=u.filter(({validation:C})=>C.reason==="file_too_large").map(({file:C})=>C);p.length>0&&e().showNotification(to.t("app.input.fileTooLargeTitle"),to.t("app.input.fileTooLargeMessage",{files:dot(p),maxSize:IN(i.maxSize||10*1024*1024)}),"warning");const m=u.filter(({validation:C})=>C.reason==="unsupported_type").map(({file:C})=>C);m.length>0&&e().showNotification(to.t("app.input.unsupportedFilesTitle"),to.t("app.input.unsupportedFilesMessage",{files:dot(m)}),"warning");const g=Math.max(0,(i.maxFiles||5)-o.length);if(g===0){const C=to.t("app.dragDrop.maxReached");t({uploadError:C}),e().showNotification(to.t("app.input.fileLimitTitle"),C,"warning");return}const h=l.slice(0,g);l.slice(g).length>0&&e().showNotification(to.t("app.input.fileLimitTitle"),to.t("app.input.fileLimitMessage",{count:g}),"warning");const b=i.maxTotalSize||20*1024*1024,y=r.getTotalSize(),v=y+h.reduce((C,E)=>C+E.size,0);let _=y;const w=[],x=[];for(const C of h){if(_+C.size>b){x.push(C);continue}w.push(C),_+=C.size}if(x.length>0){const C=to.t("app.input.totalSizeExceededMessage",{maxSize:IN(b),actualSize:IN(v)});t({uploadError:C}),e().showNotification(to.t("app.input.totalSizeExceededTitle"),C,"warning")}if(w.length===0){d.length>0&&t({uploadError:d.join("; ")});return}const k=w.map(C=>({id:`${Date.now()}-${Math.random().toString(36).slice(2,9)}`,file:C,name:C.name,size:C.size,type:C.type,category:ys.getFileCategory(C),status:"pending",progress:0,createdAt:new Date}));if(t(C=>({uploadedFiles:[...C.uploadedFiles,...k],uploadError:d.length>0?d.join("; "):null})),r.fileUploadOptions.autoUpload)for(const C of k)await r.uploadFile(C.file)},uploadFile:async n=>{const i=e().uploadedFiles.find(o=>o.file===n);if(!i)return null;try{if(t(p=>({uploadedFiles:p.uploadedFiles.map(m=>m.id===i.id?{...m,status:"uploading",progress:0}:m),isUploading:!0})),n.type.startsWith("image/"))try{const p=await ys.generateThumbnail(n);t(m=>({uploadedFiles:m.uploadedFiles.map(g=>g.id===i.id?{...g,thumbnailUrl:p}:g)}))}catch(p){console.warn("Failed to generate thumbnail:",p)}const o=e().activeChatChannel,u=(o?e().channels[o]:null)?.knowledge_set_id??null,d=await ys.uploadChatAttachment(n,"private",i.category,null,u,p=>{t(m=>({uploadedFiles:m.uploadedFiles.map(g=>g.id===i.id?{...g,progress:p.percentage}:g)}))});return t(p=>({uploadedFiles:p.uploadedFiles.map(m=>m.id===i.id?{...m,status:"completed",progress:100,uploadedId:d.id,downloadUrl:d.download_url}:m),isUploading:p.uploadedFiles.some(m=>m.id!==i.id&&m.status==="uploading")})),d.id}catch(o){const l=o instanceof Error?o.message:"Upload failed";return t(u=>({uploadedFiles:u.uploadedFiles.map(d=>d.id===i.id?{...d,status:"error",error:l}:d),isUploading:u.uploadedFiles.some(d=>d.id!==i.id&&d.status==="uploading"),uploadError:l})),null}},removeFile:n=>{const i=e().uploadedFiles.find(o=>o.id===n);i?.uploadedId&&ys.deleteFile(i.uploadedId,!1).catch(o=>{console.error("Failed to delete file from server:",o)}),t(o=>({uploadedFiles:o.uploadedFiles.filter(l=>l.id!==n)}))},clearFiles:(n=!1)=>{const r=e();if(n){const i=r.uploadedFiles.filter(o=>o.uploadedId).map(o=>o.uploadedId);i.length>0&&ys.bulkDeleteFiles(i).catch(o=>{console.error("Failed to delete files from server:",o)})}t({uploadedFiles:[],isUploading:!1,uploadError:null})},confirmFilesForMessage:async n=>{const i=e().uploadedFiles.filter(o=>o.uploadedId&&o.status==="completed").map(o=>o.uploadedId);if(i.length>0)try{await ys.confirmFiles(i,n),t({uploadedFiles:[]})}catch(o){throw console.error("Failed to confirm files:",o),o}},cancelUpload:n=>{t(r=>({uploadedFiles:r.uploadedFiles.map(i=>i.id===n?{...i,status:"error",error:"Cancelled"}:i)}))},retryUpload:async n=>{const r=e(),i=r.uploadedFiles.find(o=>o.id===n);i&&await r.uploadFile(i.file)},updateFileUploadOptions:n=>{t(r=>({fileUploadOptions:{...r.fileUploadOptions,...n}}))},getTotalSize:()=>e().uploadedFiles.reduce((r,i)=>r+i.size,0),canAddMoreFiles:()=>{const n=e();return n.uploadedFiles.length<(n.fileUploadOptions.maxFiles||5)}});class aFn{async createFolder(e){return on.post("/xyzen/api/v1/folders/",e)}async listFolders(e=null,n=!1,r){return on.get("/xyzen/api/v1/folders/",{params:{parent_id:e??void 0,include_deleted:n||void 0,knowledge_set_id:r}})}async getTree(e,n){return on.get("/xyzen/api/v1/folders/tree",{params:{knowledge_set_id:e,only_deleted:n||void 0}})}async getFolder(e){return on.get(`/xyzen/api/v1/folders/${e}`)}async getFolderPath(e){return on.get(`/xyzen/api/v1/folders/${e}/path`)}async updateFolder(e,n){return on.patch(`/xyzen/api/v1/folders/${e}`,n)}async deleteFolder(e,n=!1){return on.delete(`/xyzen/api/v1/folders/${e}`,void 0,{params:{hard_delete:n}})}}const uf=new aFn,iFn=(t,e)=>({knowledgeActiveTab:"home",knowledgeFolderId:null,knowledgeSetId:null,knowledgeTreeItems:[],knowledgeTreeLoading:!1,knowledgeTreeSignal:0,trashTreeItems:[],trashTreeLoading:!1,navigateKnowledge:(n,r=null)=>{t(i=>{i.knowledgeActiveTab=n,i.knowledgeSetId=n==="knowledge"?r??null:null,i.knowledgeFolderId=null})},setKnowledgeFolderId:n=>{t(r=>{r.knowledgeFolderId=n})},fetchKnowledgeTree:async()=>{const{knowledgeActiveTab:n,knowledgeSetId:r}=e();if(n==="trash"){t(i=>{i.trashTreeLoading=!0});try{const i=await uf.getTree(void 0,!0);t(o=>{o.trashTreeItems=i,o.trashTreeLoading=!1})}catch(i){console.error("Failed to fetch trash tree",i),t(o=>{o.trashTreeLoading=!1})}return}if(!(n!=="all"&&n!=="knowledge"&&n!=="images"&&n!=="documents")){if(n==="knowledge"&&!r){t(i=>{i.knowledgeTreeItems=[],i.knowledgeTreeLoading=!1});return}t(i=>{i.knowledgeTreeLoading=!0});try{const i=n==="knowledge"?r??void 0:void 0,o=await uf.getTree(i);t(l=>{l.knowledgeTreeItems=o,l.knowledgeTreeLoading=!1})}catch(i){console.error("Failed to fetch knowledge tree",i),t(o=>{o.knowledgeTreeLoading=!1})}}},refreshKnowledge:()=>{t(n=>{n.knowledgeTreeSignal+=1})},removeTreeItems:n=>{t(r=>{const i=new Set(n);r.knowledgeActiveTab==="trash"?r.trashTreeItems=r.trashTreeItems.filter(o=>!i.has(o.id)):r.knowledgeTreeItems=r.knowledgeTreeItems.filter(o=>!i.has(o.id))})},renameTreeItem:(n,r)=>{t(i=>{const l=(i.knowledgeActiveTab==="trash"?i.trashTreeItems:i.knowledgeTreeItems).find(u=>u.id===n);l&&(l.name=r)})}}),oFn=(t,e)=>({loadingStates:{},setLoading:(n,r)=>{t(i=>{r?i.loadingStates[n]=!0:delete i.loadingStates[n]})},getLoading:n=>e().loadingStates[n]||!1,clearAllLoading:()=>{t(n=>{n.loadingStates={}})}}),BA={MCP_SERVERS:"mcpServers",MCP_SERVER_CREATE:"mcpServerCreate",MCP_SERVER_UPDATE:"mcpServerUpdate",MCP_SERVER_DELETE:"mcpServerDelete"},b1={async getMcpServers(){return on.get("/xyzen/api/v1/mcps")},async createMcpServer(t){return on.post("/xyzen/api/v1/mcps",t)},async updateMcpServer(t,e){return on.patch(`/xyzen/api/v1/mcps/${t}`,e)},async deleteMcpServer(t){return on.delete(`/xyzen/api/v1/mcps/${t}`)},async refreshMcpServers(){return on.post("/xyzen/api/v1/mcps/refresh")},async activateSmitheryServer(t,e){return on.post("/xyzen/api/v1/mcps/smithery/activate",{qualifiedName:t,profile:e})},async getBuiltinMcpServers(){try{return await on.get("/xyzen/api/v1/mcps/discover")}catch(t){return console.warn("Error discovering builtin MCP servers:",t),[]}},async getBuiltinSearchServers(){try{return await on.get("/xyzen/api/v1/mcps/search-servers/discover")}catch(t){return console.warn("Error discovering builtin search servers:",t),[]}},async getSearchServers(){return on.get("/xyzen/api/v1/mcps")},async getSessionSearchEngine(t){try{return await on.get(`/xyzen/api/v1/sessions/${t}/search-engine`)}catch(e){if(e instanceof Error&&"status"in e&&e.status===404)return null;throw e}},async setSessionSearchEngine(t,e){return on.put(`/xyzen/api/v1/sessions/${t}/search-engine`,{mcp_server_id:e})},async removeSessionSearchEngine(t){return on.delete(`/xyzen/api/v1/sessions/${t}/search-engine`)},async testTool(t,e,n){return on.post(`/xyzen/api/v1/mcps/${t}/tools/${e}/test`,{parameters:n})}};function sFn(t){if("data"in t&&"source"in t&&t.source==="official")return t;const e=t,n={name:e.name,module_name:e.module_name,mount_path:e.mount_path,description:e.description,is_builtin:!0,requires_auth:e.requires_auth||!1,is_default:e.is_default,banner:e.banner};return{id:e.module_name,name:e.name,description:e.description,source:"official",cover:e.banner,data:n}}function lFn(t){return Array.isArray(t)?t.filter(e=>e&&typeof e=="object").map(e=>sFn(e)):(console.warn("convertBuiltinServers: input is not an array",t),[])}const cFn=(t,e)=>({mcpServers:[],builtinMcpServers:[],lastFetchTime:0,isEditMcpServerModalOpen:!1,editingMcpServer:null,openEditMcpServerModal:n=>{t({isEditMcpServerModalOpen:!0,editingMcpServer:n})},closeEditMcpServerModal:()=>{t({isEditMcpServerModalOpen:!1,editingMcpServer:null})},fetchMcpServers:async()=>{const{setLoading:n}=e(),r=Date.now(),{lastFetchTime:i}=e();if(r-i<5e3){console.log("McpSlice: 使用缓存的MCP服务器数据");return}n(BA.MCP_SERVERS,!0);try{console.log("McpSlice: Starting to fetch MCP servers...");const o=await b1.getMcpServers();console.log(`McpSlice: Loaded ${o.length} MCP servers`),t({mcpServers:o,lastFetchTime:r})}catch(o){console.error("Failed to fetch MCP servers:",o)}finally{n(BA.MCP_SERVERS,!1)}},fetchBuiltinMcpServers:async()=>{try{const n=await b1.getBuiltinMcpServers(),r=lFn(n),{mcpServers:i,backendUrl:o}=e(),l=i.map(d=>d.url),u=r.filter(d=>{const p=d.data.mount_path.endsWith("/")?d.data.mount_path:`${d.data.mount_path}/`,m=`${o}${p}`;return!l.includes(m)});t({builtinMcpServers:u})}catch(n){console.error("Failed to fetch builtin MCP servers:",n),t({builtinMcpServers:[]})}},refreshMcpServers:async()=>{const{setLoading:n}=e();n(BA.MCP_SERVERS,!0);try{await b1.refreshMcpServers(),setTimeout(()=>{e().fetchMcpServers()},1e3)}catch(r){console.error("Failed to refresh MCP servers:",r)}finally{setTimeout(()=>n(BA.MCP_SERVERS,!1),1500)}},addMcpServer:async n=>{const{setLoading:r}=e();r(BA.MCP_SERVER_CREATE,!0);try{const i=await b1.createMcpServer(n);t(o=>{o.mcpServers.push(i)}),e().closeAddMcpServerModal()}catch(i){throw console.error("Failed to add MCP server:",i),i}finally{r(BA.MCP_SERVER_CREATE,!1)}},quickAddBuiltinServer:async n=>{const{backendUrl:r,token:i,setLoading:o}=e();o(BA.MCP_SERVER_CREATE,!0);try{const l=n.data.mount_path.endsWith("/")?n.data.mount_path:`${n.data.mount_path}/`,u={name:n.name,description:n.description,url:`${r}${l}`,token:i||""},d=await b1.createMcpServer(u);return t(p=>{p.mcpServers.push(d),p.builtinMcpServers=p.builtinMcpServers.filter(m=>m.data.module_name!==n.data.module_name)}),e().closeAddMcpServerModal(),d}catch(l){throw console.error("Failed to add builtin MCP server:",l),l}finally{o(BA.MCP_SERVER_CREATE,!1)}},activateSmitheryServer:async(n,r)=>{const{setLoading:i}=e();i(BA.MCP_SERVER_CREATE,!0);try{const o=await b1.activateSmitheryServer(n,r);t(l=>{l.mcpServers.push(o)}),e().closeAddMcpServerModal()}catch(o){throw console.error("Failed to activate Smithery MCP server:",o),o}finally{i(BA.MCP_SERVER_CREATE,!1)}},editMcpServer:async(n,r)=>{const{setLoading:i}=e();i(BA.MCP_SERVER_UPDATE,!0);try{const o=await b1.updateMcpServer(n,r);t(l=>{const u=l.mcpServers.findIndex(d=>d.id===n);u!==-1&&(l.mcpServers[u]=o)})}catch(o){throw console.error("Failed to edit MCP server:",o),o}finally{i(BA.MCP_SERVER_UPDATE,!1)}},removeMcpServer:async n=>{const{setLoading:r}=e();r(BA.MCP_SERVER_DELETE,!0);try{await b1.deleteMcpServer(n),t(i=>{i.mcpServers=i.mcpServers.filter(o=>o.id!==n)})}catch(i){throw console.error("Failed to remove MCP server:",i),i}finally{r(BA.MCP_SERVER_DELETE,!1)}},updateMcpServerInList:n=>{t(r=>{const i=r.mcpServers.findIndex(o=>o.id===n.id);i!==-1?r.mcpServers[i]=n:r.mcpServers.push(n)})}}),uFn=(t,e)=>({toolTestModal:{isOpen:!1},toolExecutionHistory:[],openToolTestModal:(n,r,i)=>{t(o=>{o.toolTestModal={isOpen:!0,server:n,toolName:r,toolDescription:i}})},closeToolTestModal:()=>{t(n=>{n.toolTestModal={isOpen:!1}})},addToolExecution:n=>{t(r=>{const i={...n,id:`${Date.now()}-${Math.random().toString(36).substr(2,9)}`,timestamp:new Date};r.toolExecutionHistory.unshift(i),r.toolExecutionHistory.length>100&&(r.toolExecutionHistory=r.toolExecutionHistory.slice(0,100))})},clearToolExecutionHistory:()=>{t(n=>{n.toolExecutionHistory=[]})},getToolExecutionHistory:(n,r)=>{const{toolExecutionHistory:i}=e();return!n&&!r?i:i.filter(o=>{const l=!n||o.serverId===n,u=!r||o.toolName===r;return l&&u})}}),dFn=t=>({notificationEnabled:!1,novuAppIdentifier:"",novuApiUrl:"",novuWsUrl:"",pushPermission:typeof Notification<"u"&&typeof Notification.permission=="string"?Notification.permission:"default",pushSubscribed:!1,setNotificationConfig:(e,n,r,i)=>{t(o=>{o.notificationEnabled=e,o.novuAppIdentifier=n,o.novuApiUrl=r,o.novuWsUrl=i})},setPushPermission:e=>{t(n=>{n.pushPermission=e})},setPushSubscribed:e=>{t(n=>{n.pushSubscribed=e})}});class qxe{static STORAGE_KEY="xyzen_provider_preferences";static getPreferences(){try{const e=localStorage.getItem(this.STORAGE_KEY);if(e){const n=JSON.parse(e);return{defaultProviderId:n.defaultProviderId||null,lastUsedProviders:n.lastUsedProviders||{}}}}catch(e){console.warn("Failed to load provider preferences:",e)}return{defaultProviderId:null,lastUsedProviders:{}}}static savePreferences(e){try{localStorage.setItem(this.STORAGE_KEY,JSON.stringify(e))}catch(n){console.error("Failed to save provider preferences:",n)}}static setDefaultProvider(e){const n=this.getPreferences();n.defaultProviderId=e,this.savePreferences(n)}static getDefaultProviderId(){return this.getPreferences().defaultProviderId}static getDefaultProvider(e){const n=this.getDefaultProviderId();return n&&e.find(r=>r.id===n)||null}static setLastUsedProviderForAgent(e,n){const r=this.getPreferences();r.lastUsedProviders[e]=n,this.savePreferences(r)}static getLastUsedProviderForAgent(e){return this.getPreferences().lastUsedProviders[e]||null}static clearPreferences(){try{localStorage.removeItem(this.STORAGE_KEY)}catch(e){console.error("Failed to clear provider preferences:",e)}}static migrateFromDatabaseDefault(e){if(!this.getPreferences().defaultProviderId){const r=e.find(i=>i.is_default&&!i.is_system);r&&(console.info("Migrating database default provider to local preferences:",r.name),this.setDefaultProvider(r.id))}}}function pFn(t,e){if(t?.provider_id){const o=e.find(l=>l.id===t.provider_id);if(o)return o}const n=qxe.getDefaultProvider(e);if(n&&!n.is_system)return n;const r=e.find(o=>o.is_system);return r||e.filter(o=>!o.is_system)[0]||null}const mFn=(t,e)=>({userDefaultProviderId:null,initializeProviderPreferences:()=>{const n=qxe.getDefaultProviderId();t({userDefaultProviderId:n})},setUserDefaultProvider:n=>{qxe.setDefaultProvider(n),t({userDefaultProviderId:n})},getUserDefaultProvider:n=>{const{userDefaultProviderId:r}=e();return r&&n.find(i=>i.id===r)||null},resolveProviderForAgent:(n,r)=>pFn(n,r),llmProviders:[],llmProvidersLoading:!1,providerTemplates:[],templatesLoading:!1,availableModels:{},availableModelsLoading:!1,fetchProviderTemplates:async()=>{console.warn("[DEPRECATED] fetchProviderTemplates is deprecated. Use useProviderTemplates() hook instead.")},fetchMyProviders:async()=>{console.warn("[DEPRECATED] fetchMyProviders is deprecated. Use useMyProviders() hook instead."),e().initializeProviderPreferences()},fetchAvailableModels:async()=>{console.warn("[DEPRECATED] fetchAvailableModels is deprecated. Use useAvailableModels() hook instead.")},addProvider:async()=>{throw console.warn("[DEPRECATED] addProvider is deprecated. Use useCreateProvider().mutateAsync instead."),new Error("addProvider is deprecated. Use useCreateProvider().mutateAsync instead.")},updateProvider:async()=>{throw console.warn("[DEPRECATED] updateProvider is deprecated. Use useUpdateProvider().mutateAsync instead."),new Error("updateProvider is deprecated. Use useUpdateProvider().mutateAsync instead.")},removeProvider:async()=>{throw console.warn("[DEPRECATED] removeProvider is deprecated. Use useDeleteProvider().mutateAsync instead."),new Error("removeProvider is deprecated. Use useDeleteProvider().mutateAsync instead.")}});class gFn{async listRunners(){return on.get("/xyzen/api/v1/runners/")}async createRunnerToken(e){return on.post("/xyzen/api/v1/runners/token",{name:e})}async updateRunner(e,n){return on.patch(`/xyzen/api/v1/runners/${e}`,n)}async deleteRunner(e){return on.delete(`/xyzen/api/v1/runners/${e}`)}}const ote=new gFn;class hFn{ws=null;handlers=new Map;reconnectTimer=null;reconnectDelay=1e3;maxReconnectDelay=3e4;intentionalClose=!1;connect(){if(this.ws?.readyState===WebSocket.OPEN)return;const e=Eo.getToken();if(!e)return;const n=Ed().env.backendUrl;if(!n)return;const r=`${n.replace(/^http(s?):\/\//,"ws$1://")}/xyzen/ws/v1/user/events?token=${encodeURIComponent(e)}`;this.intentionalClose=!1;try{this.ws=new WebSocket(r)}catch{this.scheduleReconnect();return}this.ws.onopen=()=>{this.reconnectDelay=1e3},this.ws.onmessage=i=>{try{const o=JSON.parse(i.data);if(o.type==="pong")return;const l=this.handlers.get(o.type);if(l)for(const u of l)u(o)}catch{}},this.ws.onclose=()=>{this.ws=null,this.intentionalClose||this.scheduleReconnect()},this.ws.onerror=()=>{}}disconnect(){this.intentionalClose=!0,this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.ws&&(this.ws.close(),this.ws=null)}on(e,n){let r=this.handlers.get(e);return r||(r=new Set,this.handlers.set(e,r)),r.add(n),()=>{r.delete(n),r.size===0&&this.handlers.delete(e)}}scheduleReconnect(){this.reconnectTimer||(this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.reconnectDelay=Math.min(this.reconnectDelay*2,this.maxReconnectDelay),this.connect()},this.reconnectDelay))}}const RP=new hFn,fFn=t=>({runners:[],runnersLoading:!1,fetchRunners:async()=>{t({runnersLoading:!0});try{const e=await ote.listRunners();t({runners:e,runnersLoading:!1})}catch{t({runnersLoading:!1})}},createRunnerToken:async e=>{try{const n=await ote.createRunnerToken(e);return t(r=>{r.runners.unshift(n.runner)}),{token:n.token,connect_command:n.connect_command}}catch{return null}},deleteRunner:async e=>{try{await ote.deleteRunner(e),t(n=>{n.runners=n.runners.filter(r=>r.id!==e)})}catch{}},updateRunner:async(e,n)=>{try{const r=await ote.updateRunner(e,n);t(i=>{const o=i.runners.findIndex(l=>l.id===e);o>=0&&(i.runners[o]=r)})}catch{}},connectRunnerEvents:()=>{RP.connect();const e=RP.on("runner_status",n=>{const{runner_id:r,is_online:i}=n.data;t(o=>{const l=o.runners.find(u=>u.id===r);l&&(l.is_online=i)})});return()=>{e(),RP.disconnect()}}}),AFn=t=>({isTerminalOpen:!1,activeSessionId:null,terminalSessions:{},pendingCommand:"",pendingArgs:[],pendingRunnerId:null,openTerminal:(e="",n=[],r)=>{t(i=>{i.isTerminalOpen=!0,i.pendingCommand=e,i.pendingArgs=n,i.pendingRunnerId=r??null})},closeTerminalModal:()=>{t(e=>{e.isTerminalOpen=!1})},addSession:e=>{t(n=>{n.terminalSessions[e.id]=e,n.activeSessionId=e.id})},updateSession:(e,n)=>{t(r=>{const i=r.terminalSessions[e];i&&Object.assign(i,n)})},removeSession:e=>{t(n=>{if(delete n.terminalSessions[e],n.activeSessionId===e){const r=Object.keys(n.terminalSessions);n.activeSessionId=r.length>0?r[0]:null}})},setActiveSession:e=>{t({activeSessionId:e})}}),mot={Sidebar:"sidebar"},bFn=t=>({backendUrl:Ed().env.backendUrl,isXyzenOpen:!1,panelWidth:Uxe,activeTabIndex:0,activePanel:"chat",theme:Ed().storage.getItem("theme")||"system",layoutStyle:Ed().storage.getItem("layoutStyle")||Ed().env.layoutStyle||mot.Sidebar,inputPosition:Ed().storage.getItem("inputPosition")||"bottom",isMcpListModalOpen:!1,isLlmProvidersModalOpen:!1,isAddMcpServerModalOpen:!1,isAddLlmProviderModalOpen:!1,isSettingsModalOpen:!1,activeSettingsCategory:"account",activeUiSetting:"theme",selectedProviderId:null,pendingInput:"",spatialSidebarCollapsed:!1,capsuleOpen:!1,capsuleActiveTab:"knowledge",showOfficialRecommendations:Ed().storage.getItem("officialRecommendationsDismissed")!=="true",mobileCeoOverlay:!0,mobilePage:0,pendingFocusAgentId:null,highlightMessageId:null,dockMinimized:!1,openTabsByAgent:{},toggleXyzen:()=>t(e=>({isXyzenOpen:!e.isXyzenOpen})),openXyzen:()=>t({isXyzenOpen:!0}),closeXyzen:()=>t({isXyzenOpen:!1}),setPanelWidth:e=>t({panelWidth:e}),setTabIndex:e=>t({activeTabIndex:e}),setActivePanel:e=>t({activePanel:e}),setTheme:e=>{Ed().storage.setItem("theme",e),t({theme:e})},setLayoutStyle:e=>{Ed().storage.setItem("layoutStyle",e),t({layoutStyle:e})},setInputPosition:e=>{Ed().storage.setItem("inputPosition",e),t({inputPosition:e})},setBackendUrl:e=>{Ed().env.backendUrl=e,t({backendUrl:e})},openMcpListModal:()=>t({isMcpListModalOpen:!0}),closeMcpListModal:()=>t({isMcpListModalOpen:!1}),openLlmProvidersModal:()=>t({isLlmProvidersModalOpen:!0}),closeLlmProvidersModal:()=>t({isLlmProvidersModalOpen:!1}),openAddMcpServerModal:()=>t({isAddMcpServerModalOpen:!0}),closeAddMcpServerModal:()=>t({isAddMcpServerModalOpen:!1}),openAddLlmProviderModal:()=>t({isAddLlmProviderModalOpen:!0}),closeAddLlmProviderModal:()=>t({isAddLlmProviderModalOpen:!1}),openSettingsModal:(e="account")=>t({isSettingsModalOpen:!0,activeSettingsCategory:e}),closeSettingsModal:()=>t({isSettingsModalOpen:!1,selectedProviderId:null}),setActiveSettingsCategory:e=>t({activeSettingsCategory:e}),setActiveUiSetting:e=>t({activeUiSetting:e}),setSelectedProvider:e=>t({selectedProviderId:e}),setPendingInput:e=>t({pendingInput:e}),submitInput:()=>t(()=>({isXyzenOpen:!0,activeTabIndex:1,activePanel:"chat"})),setSpatialSidebarCollapsed:e=>t({spatialSidebarCollapsed:e}),setCapsuleOpen:e=>t({capsuleOpen:e}),setCapsuleActiveTab:e=>t({capsuleActiveTab:e}),setShowOfficialRecommendations:e=>{Ed().storage.setItem("officialRecommendationsDismissed",e?"false":"true"),t({showOfficialRecommendations:e})},setMobileCeoOverlay:e=>t({mobileCeoOverlay:e}),setMobilePage:e=>t({mobilePage:e}),requestFocusAgent:e=>t({pendingFocusAgentId:e}),highlightMessage:e=>t({highlightMessageId:e}),openTab:(e,n)=>t(r=>{const i=r.openTabsByAgent[e]??[];i.some(o=>o.id===n.id)||(r.openTabsByAgent[e]=[...i,n])}),closeTab:(e,n)=>t(r=>{const i=r.openTabsByAgent[e];i&&(r.openTabsByAgent[e]=i.filter(o=>o.id!==n))}),setOpenTabs:(e,n)=>t(r=>{r.openTabsByAgent[e]=n}),setDockMinimized:e=>t({dockMinimized:e}),renameTab:(e,n)=>t(r=>{for(const i of Object.values(r.openTabsByAgent)){const o=i.find(l=>l.id===e);if(o){o.name=n;break}}})});class yFn{async redeemCode(e){return on.post("/xyzen/api/v1/redemption/redeem",{code:e})}async getUserWallet(){return on.get("/xyzen/api/v1/redemption/wallet")}async getRedemptionHistory(e=100,n=0){return on.get("/xyzen/api/v1/redemption/history",{params:{limit:e,offset:n}})}async getDailyTokenStats(e,n,r){return on.get("/xyzen/api/v1/redemption/admin/stats/daily-tokens",{auth:!1,headers:{"X-Admin-Secret":e},params:{date:n,tz:r}})}async getTopUsersByConsumption(e,n=20){return on.get("/xyzen/api/v1/redemption/admin/stats/top-users",{auth:!1,headers:{"X-Admin-Secret":e},params:{limit:n}})}async getConsumeRecords(e,n,r,i,o=1e4,l=0){return on.get("/xyzen/api/v1/redemption/admin/stats/consume-records",{auth:!1,headers:{"X-Admin-Secret":e},params:{start_date:n,end_date:r,tz:i,limit:o,offset:l}})}async getAllConsumeRecords(e,n,r,i,o=1e4){const l=[];let u=0;for(;;){const d=await this.getConsumeRecords(e,n,r,i,o,u);if(l.push(...d),d.length<o)break;u+=o}return l}async getUserActivityStats(e,n,r,i){return on.get("/xyzen/api/v1/redemption/admin/stats/user-activity",{auth:!1,headers:{"X-Admin-Secret":e},params:{start_date:n,end_date:r,tz:i}})}async adminListCodes(e,n=50){return on.get("/xyzen/api/v1/redemption/admin/codes",{auth:!1,headers:{"X-Admin-Secret":e},params:{limit:n}})}async adminCreateCode(e,n){return on.post("/xyzen/api/v1/redemption/admin/codes",n,{auth:!1,headers:{"X-Admin-Secret":e}})}async adminDeactivateCode(e,n){return on.post(`/xyzen/api/v1/redemption/admin/codes/${n}/deactivate`,void 0,{auth:!1,headers:{"X-Admin-Secret":e}})}async getConsumptionHeatmap(e,n,r,i,o,l,u){return on.get("/xyzen/api/v1/redemption/admin/stats/consumption-heatmap",{auth:!1,headers:{"X-Admin-Secret":e},params:{year:n,tz:r,model_tier:i,model_name:o,provider:l,tool_name:u}})}async getUserConsumptionHeatmap(e,n,r,i,o,l,u){return on.get("/xyzen/api/v1/redemption/admin/stats/user-consumption-heatmap",{auth:!1,headers:{"X-Admin-Secret":e},params:{year:n,tz:r,model_tier:i,model_name:o,provider:l,tool_name:u}})}async getConsumptionTopUsers(e,n,r,i,o,l,u=20,d,p,m,g){return on.get("/xyzen/api/v1/redemption/admin/stats/consumption-top-users",{auth:!1,headers:{"X-Admin-Secret":e},params:{year:n,tz:r,date:i,model_tier:o,model_name:l,limit:u,search:d,provider:p,include_tiers:m||void 0,tool_name:g}})}async getRedemptionHeatmap(e,n,r){return on.get("/xyzen/api/v1/redemption/admin/stats/redemption-heatmap",{auth:!1,headers:{"X-Admin-Secret":e},params:{year:n,tz:r}})}async getRedemptionRankings(e,n,r,i,o=20,l){return on.get("/xyzen/api/v1/redemption/admin/stats/redemption-rankings",{auth:!1,headers:{"X-Admin-Secret":e},params:{year:n,tz:r,date:i,limit:o,search:l}})}async getNewUsersHeatmap(e,n,r){return on.get("/xyzen/api/v1/redemption/admin/stats/new-users-heatmap",{auth:!1,headers:{"X-Admin-Secret":e},params:{year:n,tz:r}})}async getFilterOptions(e,n,r,i){return on.get("/xyzen/api/v1/redemption/admin/stats/filter-options",{auth:!1,headers:{"X-Admin-Secret":e},params:{year:n,tz:r,provider:i}})}async getModelOptions(e){return on.get("/xyzen/api/v1/redemption/admin/stats/model-options",{auth:!1,headers:{"X-Admin-Secret":e}})}async getCreditSources(e){return on.get("/xyzen/api/v1/redemption/admin/stats/credit-sources",{auth:!1,headers:{"X-Admin-Secret":e}})}async getCreditHeatmap(e,n,r,i,o){return on.get("/xyzen/api/v1/redemption/admin/stats/credit-heatmap",{auth:!1,headers:{"X-Admin-Secret":e},params:{year:n,tz:r,source:i,tier:o}})}async getCreditRankings(e,n,r,i,o,l,u=20,d){return on.get("/xyzen/api/v1/redemption/admin/stats/credit-rankings",{auth:!1,headers:{"X-Admin-Secret":e},params:{year:n,tz:r,source:i,tier:o,date:l,limit:u,search:d}})}}const DA=new yFn,vFn=t=>({walletBalance:null,walletLoading:!1,fetchWallet:async()=>{t({walletLoading:!0});try{const e=await DA.getUserWallet();t({walletBalance:{free:e.free_balance,paid:e.paid_balance,earned:e.earned_balance,total:e.virtual_balance},walletLoading:!1})}catch{t({walletLoading:!1})}},connectWalletEvents:()=>{RP.connect();const e=RP.on("credit_updated",n=>{const r=n.data;t({walletBalance:{free:r.free_balance??0,paid:r.paid_balance??0,earned:r.earned_balance??0,total:r.virtual_balance??0}})});return()=>{e(),RP.disconnect()}},_handleCreditUpdated:e=>{t({walletBalance:{free:e.free_balance??0,paid:e.paid_balance??0,earned:e.earned_balance??0,total:e.virtual_balance??0}})}});let Gxe=null;function _Fn(t){Gxe=t}function ste(){if(!Gxe)throw new Error("toolbarActions not initialized — call initToolbarActions() at app startup");return Gxe()}async function wFn(t,e){try{await ste()(t,{model_tier:e,provider_id:null,model:null})}catch(n){console.error("Failed to update session tier:",n)}}async function xFn(t,e,n,r){try{await ste()(t,{model_tier:e,provider_id:n,model:r})}catch(i){console.error("Failed to update session tier model:",i)}}async function kFn(t,e){try{await ste()(t,{sandbox_backend:e})}catch(n){console.error("Failed to update session sandbox backend:",n)}}async function EFn(t,e){try{await ste()(t,{knowledge_set_id:e})}catch(n){console.error("Failed to update session knowledge set:",n)}}i5n(W5n),on.configure({getToken:()=>Eo.getToken(),onUnauthorized:()=>{Promise.resolve().then(()=>m5n).then(t=>t.logout()).catch(()=>{})}}),N5n();let CFn;const SFn={getItem:()=>null,setItem:()=>{},removeItem:()=>{}},Un=O5n()(Yit(U5n((...t)=>({...bFn(...t),...tFn(...t),...K5n(...t),...cFn(...t),...uFn(...t),...mFn(...t),...Z5n(...t),...oFn(...t),...rFn(...t),...iFn(...t),...dFn(...t),...fFn(...t),...AFn(...t),...vFn(...t)})),{name:"xyzen-storage",storage:Wit(()=>CFn??(typeof localStorage<"u"?localStorage:SFn)),partialize:t=>({isXyzenOpen:t.isXyzenOpen,panelWidth:t.panelWidth,activePanel:t.activePanel,theme:t.theme,token:t.token,user:t.user,backendUrl:t.backendUrl,activeChatChannel:t.activeChatChannel,spatialSidebarCollapsed:t.spatialSidebarCollapsed,capsuleOpen:t.capsuleOpen,capsuleActiveTab:t.capsuleActiveTab,mobileCeoOverlay:t.mobileCeoOverlay,mobilePage:t.mobilePage,openTabsByAgent:t.openTabsByAgent,terminalSessions:t.terminalSessions}),onRehydrateStorage:()=>t=>{if(!t)return;const e=t.terminalSessions;if(e)for(const n of Object.keys(e)){const r=e[n];(r.status==="connected"||r.status==="connecting"||r.status==="reconnecting")&&(r.status="detached")}}}));if(p5n(Un),_Fn(()=>Un.getState().updateSessionConfig),typeof window<"u"){const t=new Map;Un.subscribe(e=>{const n=e.activeChatChannel;if(!n)return;const r=e.channels[n];if(!r)return;const i=t.get(n)??0,o=r.messages.length;i>0&&o<i&&console.error(`[DIAGNOSTIC] MESSAGE COUNT DROP: ${n.slice(0,8)} ${i} → ${o}`,`| responding=${r.responding}`,`| latestAssist=${(()=>{const l=[...r.messages].reverse().find(u=>u.role==="assistant");return l?`id=${l.id.slice(0,12)} agentExec=${l.agentExecution?.status}`:"none"})()}`,new Error("trace").stack),t.set(n,o)})}function IFn(t){return Un.getState().status!=="succeeded"&&localStorage.getItem("platform")==="bohrium"?(t("provider_bohrium"),!0):!1}async function Hxe(){try{const t=await Eo.getAuthStatus();if(!t.is_configured||!t.provider)throw new Error("Authentication is not configured");const e=await Eo.getAuthConfig(),n=t.provider,r=`${window.location.origin}${window.location.pathname}`;let i=null;if(n==="casdoor"){const o=Math.random().toString(36).substring(7);sessionStorage.setItem("auth_state",o),i=xN(n,e,r,o)}else i=xN(n,e,r);if(i)window.location.href=i;else throw new Error(`Unsupported auth provider: ${n}`)}catch(t){throw console.error("Failed to initiate OAuth login:",t),t}}function TFn(t){const e=Un(M=>M.setBackendUrl),[n,r]=T.useState(!1),[i,o]=T.useState(!1),[l,u]=T.useState(!1),[d,p]=T.useState(),m=T.useRef(!1),g=T.useRef(null);T.useEffect(()=>{e(t),!m.current&&(m.current=!0,Cit().then(()=>{IFn(M=>g.current?.(M))}))},[t,e]);const h=T.useCallback(async M=>{const N=Math.random().toString(36).substring(7);sessionStorage.setItem("auth_state",N);const D=`${window.location.origin}${window.location.pathname}`;let P=null;try{const O=await Eo.getOAuthUrl(M,D,N);O.url&&(P=O.url)}catch{}if(!P)try{const O=await Eo.getAuthConfig();P=xN("casdoor",O,D,N,M)}catch{}if(P){u(!0);try{const O=await h5n(P);await rx(O.access_token,O.user_info)}catch(O){const F=O.message;if(F!=="OAuth popup was closed")if(F==="Popup blocked by browser"){window.location.href=P;return}else console.error("Failed to initiate provider login:",O),o(!1),r(!0)}finally{u(!1)}}},[]);g.current=h;const f=T.useCallback(async()=>{try{const[M,N]=await Promise.all([Eo.getAuthStatus(),Eo.getAuthConfig(),Dit()]),D=N?.provider??M?.provider;if(D==="casdoor"){N?.turnstile_site_key&&p(N.turnstile_site_key),o(!0);return}if(D&&D!=="bohr_app"){const P=xN(D,N,`${window.location.origin}${window.location.pathname}`);if(P){window.location.href=P;return}}}catch{}r(!0)},[]),b=T.useCallback(()=>{Cit()},[]),y=T.useCallback(()=>{o(!1)},[]),v=T.useCallback(async(M,N)=>Eo.sendVerificationCode(M,N),[]),_=T.useCallback(async(M,N)=>{await _xe(M,N,"email")},[]),w=T.useCallback(async(M,N,D,P)=>{await wxe(M,N,D,P)},[]),x=T.useCallback(async(M,N)=>{await vit(M,N)},[]),k=T.useCallback(async M=>{await Eo.sendResetCode(M)},[]),C=T.useCallback(async(M,N,D)=>{await wit(M,N,D)},[]),E=T.useCallback(async M=>Eo.sendPhoneVerificationCode(M),[]),S=T.useCallback(async M=>Eo.checkPhoneExists(M),[]),I=T.useCallback(async(M,N)=>{await _xe(M,N,"phone")},[]),B=T.useCallback(async(M,N)=>{await _it(M,N)},[]),R=T.useCallback(async(M,N,D,P)=>{await wxe("",N,D,P,"phone",M)},[]),L=T.useCallback(()=>{r(!1),o(!1)},[]);return{state:{showAuthScreen:n,showLoginPage:i,oauthLoading:l,turnstileSiteKey:d},handlers:{handleRetry:b,handleShowAuthScreen:f,handleSelectProvider:h,handleLoginBack:y,handleSendCode:v,handleCodeLogin:_,handleSignup:w,handlePasswordLogin:x,handleSendResetCode:k,handleResetPassword:C,handleSendPhoneCode:E,handleCheckPhone:S,handlePhoneCodeLogin:I,handlePhonePasswordLogin:B,handlePhoneSignup:R},resetAuthScreens:L}}var TN=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},BFn=class extends TN{#e;#t;#r;constructor(){super(),this.#r=t=>{if(typeof window<"u"&&window.addEventListener){const e=()=>t();return window.addEventListener("visibilitychange",e,!1),()=>{window.removeEventListener("visibilitychange",e)}}}}onSubscribe(){this.#t||this.setEventListener(this.#r)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(t){this.#r=t,this.#t?.(),this.#t=t(e=>{typeof e=="boolean"?this.setFocused(e):this.onFocus()})}setFocused(t){this.#e!==t&&(this.#e=t,this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(e=>{e(t)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},Wxe=new BFn,DFn={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},NFn=class{#e=DFn;#t=!1;setTimeoutProvider(t){process.env.NODE_ENV!=="production"&&this.#t&&t!==this.#e&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:this.#e,provider:t}),this.#e=t,process.env.NODE_ENV!=="production"&&(this.#t=!1)}setTimeout(t,e){return process.env.NODE_ENV!=="production"&&(this.#t=!0),this.#e.setTimeout(t,e)}clearTimeout(t){this.#e.clearTimeout(t)}setInterval(t,e){return process.env.NODE_ENV!=="production"&&(this.#t=!0),this.#e.setInterval(t,e)}clearInterval(t){this.#e.clearInterval(t)}},BN=new NFn;function RFn(t){setTimeout(t,0)}var LFn=typeof window>"u"||"Deno"in globalThis;function eh(){}function MFn(t,e){return typeof t=="function"?t(e):t}function Yxe(t){return typeof t=="number"&&t>=0&&t!==1/0}function got(t,e){return Math.max(t+(e||0)-Date.now(),0)}function eI(t,e){return typeof t=="function"?t(e):t}function ey(t,e){return typeof t=="function"?t(e):t}function hot(t,e){const{type:n="all",exact:r,fetchStatus:i,predicate:o,queryKey:l,stale:u}=t;if(l){if(r){if(e.queryHash!==Vxe(l,e.options))return!1}else if(!L7(e.queryKey,l))return!1}if(n!=="all"){const d=e.isActive();if(n==="active"&&!d||n==="inactive"&&d)return!1}return!(typeof u=="boolean"&&e.isStale()!==u||i&&i!==e.state.fetchStatus||o&&!o(e))}function fot(t,e){const{exact:n,status:r,predicate:i,mutationKey:o}=t;if(o){if(!e.options.mutationKey)return!1;if(n){if(DN(e.options.mutationKey)!==DN(o))return!1}else if(!L7(e.options.mutationKey,o))return!1}return!(r&&e.state.status!==r||i&&!i(e))}function Vxe(t,e){return(e?.queryKeyHashFn||DN)(t)}function DN(t){return JSON.stringify(t,(e,n)=>Kxe(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function L7(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(n=>L7(t[n],e[n])):!1}var PFn=Object.prototype.hasOwnProperty;function lte(t,e,n=0){if(t===e)return t;if(n>500)return e;const r=Aot(t)&&Aot(e);if(!r&&!(Kxe(t)&&Kxe(e)))return e;const o=(r?t:Object.keys(t)).length,l=r?e:Object.keys(e),u=l.length,d=r?new Array(u):{};let p=0;for(let m=0;m<u;m++){const g=r?m:l[m],h=t[g],f=e[g];if(h===f){d[g]=h,(r?m<o:PFn.call(t,g))&&p++;continue}if(h===null||f===null||typeof h!="object"||typeof f!="object"){d[g]=f;continue}const b=lte(h,f,n+1);d[g]=b,b===h&&p++}return o===u&&p===o?t:d}function M7(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(const n in t)if(t[n]!==e[n])return!1;return!0}function Aot(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function Kxe(t){if(!bot(t))return!1;const e=t.constructor;if(e===void 0)return!0;const n=e.prototype;return!(!bot(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function bot(t){return Object.prototype.toString.call(t)==="[object Object]"}function OFn(t){return new Promise(e=>{BN.setTimeout(e,t)})}function Zxe(t,e,n){if(typeof n.structuralSharing=="function")return n.structuralSharing(t,e);if(n.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return lte(t,e)}catch(r){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${n.queryHash}]: ${r}`),r}return lte(t,e)}return e}function FFn(t,e,n=0){const r=[...t,e];return n&&r.length>n?r.slice(1):r}function QFn(t,e,n=0){const r=[e,...t];return n&&r.length>n?r.slice(0,-1):r}var cte=Symbol();function yot(t,e){return process.env.NODE_ENV!=="production"&&t.queryFn===cte&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${t.queryHash}'`),!t.queryFn&&e?.initialPromise?()=>e.initialPromise:!t.queryFn||t.queryFn===cte?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function Xxe(t,e){return typeof t=="function"?t(...e):!!t}function $Fn(t,e,n){let r=!1,i;return Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(i??=e(),r||(r=!0,i.aborted?n():i.addEventListener("abort",n,{once:!0})),i)}),t}var P7=(()=>{let t=()=>LFn;return{isServer(){return t()},setIsServer(e){t=e}}})();function Jxe(){let t,e;const n=new Promise((i,o)=>{t=i,e=o});n.status="pending",n.catch(()=>{});function r(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{r({status:"fulfilled",value:i}),t(i)},n.reject=i=>{r({status:"rejected",reason:i}),e(i)},n}var jFn=RFn;function zFn(){let t=[],e=0,n=u=>{u()},r=u=>{u()},i=jFn;const o=u=>{e?t.push(u):i(()=>{n(u)})},l=()=>{const u=t;t=[],u.length&&i(()=>{r(()=>{u.forEach(d=>{n(d)})})})};return{batch:u=>{let d;e++;try{d=u()}finally{e--,e||l()}return d},batchCalls:u=>(...d)=>{o(()=>{u(...d)})},schedule:o,setNotifyFunction:u=>{n=u},setBatchNotifyFunction:u=>{r=u},setScheduler:u=>{i=u}}}var rd=zFn(),UFn=class extends TN{#e=!0;#t;#r;constructor(){super(),this.#r=t=>{if(typeof window<"u"&&window.addEventListener){const e=()=>t(!0),n=()=>t(!1);return window.addEventListener("online",e,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#r)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(t){this.#r=t,this.#t?.(),this.#t=t(this.setOnline.bind(this))}setOnline(t){this.#e!==t&&(this.#e=t,this.listeners.forEach(n=>{n(t)}))}isOnline(){return this.#e}},ute=new UFn;function qFn(t){return Math.min(1e3*2**t,3e4)}function vot(t){return(t??"online")==="online"?ute.isOnline():!0}var eke=class extends Error{constructor(t){super("CancelledError"),this.revert=t?.revert,this.silent=t?.silent}};function _ot(t){let e=!1,n=0,r;const i=Jxe(),o=()=>i.status!=="pending",l=y=>{if(!o()){const v=new eke(y);h(v),t.onCancel?.(v)}},u=()=>{e=!0},d=()=>{e=!1},p=()=>Wxe.isFocused()&&(t.networkMode==="always"||ute.isOnline())&&t.canRun(),m=()=>vot(t.networkMode)&&t.canRun(),g=y=>{o()||(r?.(),i.resolve(y))},h=y=>{o()||(r?.(),i.reject(y))},f=()=>new Promise(y=>{r=v=>{(o()||p())&&y(v)},t.onPause?.()}).then(()=>{r=void 0,o()||t.onContinue?.()}),b=()=>{if(o())return;let y;const v=n===0?t.initialPromise:void 0;try{y=v??t.fn()}catch(_){y=Promise.reject(_)}Promise.resolve(y).then(g).catch(_=>{if(o())return;const w=t.retry??(P7.isServer()?0:3),x=t.retryDelay??qFn,k=typeof x=="function"?x(n,_):x,C=w===!0||typeof w=="number"&&n<w||typeof w=="function"&&w(n,_);if(e||!C){h(_);return}n++,t.onFail?.(n,_),OFn(k).then(()=>p()?void 0:f()).then(()=>{e?h(_):b()})})};return{promise:i,status:()=>i.status,cancel:l,continue:()=>(r?.(),i),cancelRetry:u,continueRetry:d,canStart:m,start:()=>(m()?b():f().then(b),i)}}var wot=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Yxe(this.gcTime)&&(this.#e=BN.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(P7.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e&&(BN.clearTimeout(this.#e),this.#e=void 0)}},GFn=class extends wot{#e;#t;#r;#n;#a;#o;#i;constructor(t){super(),this.#i=!1,this.#o=t.defaultOptions,this.setOptions(t.options),this.observers=[],this.#n=t.client,this.#r=this.#n.getQueryCache(),this.queryKey=t.queryKey,this.queryHash=t.queryHash,this.#e=Eot(this.options),this.state=t.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#a?.promise}setOptions(t){if(this.options={...this.#o,...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const e=Eot(this.options);e.data!==void 0&&(this.setState(kot(e.data,e.dataUpdatedAt)),this.#e=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#r.remove(this)}setData(t,e){const n=Zxe(this.state.data,t,this.options);return this.#l({data:n,type:"success",dataUpdatedAt:e?.updatedAt,manual:e?.manual}),n}setState(t,e){this.#l({type:"setState",state:t,setStateOptions:e})}cancel(t){const e=this.#a?.promise;return this.#a?.cancel(t),e?e.then(eh).catch(eh):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#e}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>ey(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===cte||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>eI(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!got(this.state.dataUpdatedAt,t)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(e=>e!==t),this.observers.length||(this.#a&&(this.#i||this.#s()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}#s(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"}invalidate(){this.state.isInvalidated||this.#l({type:"invalidate"})}async fetch(t,e){if(this.state.fetchStatus!=="idle"&&this.#a?.status()!=="rejected"){if(this.state.data!==void 0&&e?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(t&&this.setOptions(t),!this.options.queryFn){const u=this.observers.find(d=>d.options.queryFn);u&&this.setOptions(u.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const n=new AbortController,r=u=>{Object.defineProperty(u,"signal",{enumerable:!0,get:()=>(this.#i=!0,n.signal)})},i=()=>{const u=yot(this.options,e),p=(()=>{const m={client:this.#n,queryKey:this.queryKey,meta:this.meta};return r(m),m})();return this.#i=!1,this.options.persister?this.options.persister(u,p,this):u(p)},l=(()=>{const u={fetchOptions:e,options:this.options,queryKey:this.queryKey,client:this.#n,state:this.state,fetchFn:i};return r(u),u})();this.options.behavior?.onFetch(l,this),this.#t=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==l.fetchOptions?.meta)&&this.#l({type:"fetch",meta:l.fetchOptions?.meta}),this.#a=_ot({initialPromise:e?.initialPromise,fn:l.fetchFn,onCancel:u=>{u instanceof eke&&u.revert&&this.setState({...this.#t,fetchStatus:"idle"}),n.abort()},onFail:(u,d)=>{this.#l({type:"failed",failureCount:u,error:d})},onPause:()=>{this.#l({type:"pause"})},onContinue:()=>{this.#l({type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0});try{const u=await this.#a.start();if(u===void 0)throw process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(u),this.#r.config.onSuccess?.(u,this),this.#r.config.onSettled?.(u,this.state.error,this),u}catch(u){if(u instanceof eke){if(u.silent)return this.#a.promise;if(u.revert){if(this.state.data===void 0)throw u;return this.state.data}}throw this.#l({type:"error",error:u}),this.#r.config.onError?.(u,this),this.#r.config.onSettled?.(this.state.data,u,this),u}finally{this.scheduleGc()}}#l(t){const e=n=>{switch(t.type){case"failed":return{...n,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...xot(n.data,this.options),fetchMeta:t.meta??null};case"success":const r={...n,...kot(t.data,t.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#t=t.manual?r:void 0,r;case"error":const i=t.error;return{...n,error:i,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...t.state}}};this.state=e(this.state),rd.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),this.#r.notify({query:this,type:"updated",action:t})})}};function xot(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:vot(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function kot(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Eot(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,n=e!==void 0,r=n?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var dte=class extends TN{constructor(t,e){super(),this.options=e,this.#e=t,this.#s=null,this.#i=Jxe(),this.bindMethods(),this.setOptions(e)}#e;#t=void 0;#r=void 0;#n=void 0;#a;#o;#i;#s;#l;#c;#p;#u;#m;#h;#g=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Cot(this.#t,this.options)?this.#d():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return tke(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return tke(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#k(),this.#x(),this.#t.removeObserver(this)}setOptions(t){const e=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof ey(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#v(),this.#t.setOptions(this.options),e._defaulted&&!M7(this.options,e)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const r=this.hasListeners();r&&Sot(this.#t,n,this.options,e)&&this.#d(),this.updateResult(),r&&(this.#t!==n||ey(this.options.enabled,this.#t)!==ey(e.enabled,this.#t)||eI(this.options.staleTime,this.#t)!==eI(e.staleTime,this.#t))&&this.#f();const i=this.#A();r&&(this.#t!==n||ey(this.options.enabled,this.#t)!==ey(e.enabled,this.#t)||i!==this.#h)&&this.#y(i)}getOptimisticResult(t){const e=this.#e.getQueryCache().build(this.#e,t),n=this.createResult(e,t);return WFn(this,n)&&(this.#n=n,this.#o=this.options,this.#a=this.#t.state),n}getCurrentResult(){return this.#n}trackResult(t,e){return new Proxy(t,{get:(n,r)=>(this.trackProp(r),e?.(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#i.status==="pending"&&this.#i.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,r))})}trackProp(t){this.#g.add(t)}getCurrentQuery(){return this.#t}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const e=this.#e.defaultQueryOptions(t),n=this.#e.getQueryCache().build(this.#e,e);return n.fetch().then(()=>this.createResult(n,e))}fetch(t){return this.#d({...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#n))}#d(t){this.#v();let e=this.#t.fetch(this.options,t);return t?.throwOnError||(e=e.catch(eh)),e}#f(){this.#k();const t=eI(this.options.staleTime,this.#t);if(P7.isServer()||this.#n.isStale||!Yxe(t))return;const n=got(this.#n.dataUpdatedAt,t)+1;this.#u=BN.setTimeout(()=>{this.#n.isStale||this.updateResult()},n)}#A(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#y(t){this.#x(),this.#h=t,!(P7.isServer()||ey(this.options.enabled,this.#t)===!1||!Yxe(this.#h)||this.#h===0)&&(this.#m=BN.setInterval(()=>{(this.options.refetchIntervalInBackground||Wxe.isFocused())&&this.#d()},this.#h))}#b(){this.#f(),this.#y(this.#A())}#k(){this.#u&&(BN.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#m&&(BN.clearInterval(this.#m),this.#m=void 0)}createResult(t,e){const n=this.#t,r=this.options,i=this.#n,o=this.#a,l=this.#o,d=t!==n?t.state:this.#r,{state:p}=t;let m={...p},g=!1,h;if(e._optimisticResults){const I=this.hasListeners(),B=!I&&Cot(t,e),R=I&&Sot(t,n,e,r);(B||R)&&(m={...m,...xot(p.data,t.options)}),e._optimisticResults==="isRestoring"&&(m.fetchStatus="idle")}let{error:f,errorUpdatedAt:b,status:y}=m;h=m.data;let v=!1;if(e.placeholderData!==void 0&&h===void 0&&y==="pending"){let I;i?.isPlaceholderData&&e.placeholderData===l?.placeholderData?(I=i.data,v=!0):I=typeof e.placeholderData=="function"?e.placeholderData(this.#p?.state.data,this.#p):e.placeholderData,I!==void 0&&(y="success",h=Zxe(i?.data,I,e),g=!0)}if(e.select&&h!==void 0&&!v)if(i&&h===o?.data&&e.select===this.#l)h=this.#c;else try{this.#l=e.select,h=e.select(h),h=Zxe(i?.data,h,e),this.#c=h,this.#s=null}catch(I){this.#s=I}this.#s&&(f=this.#s,h=this.#c,b=Date.now(),y="error");const _=m.fetchStatus==="fetching",w=y==="pending",x=y==="error",k=w&&_,C=h!==void 0,S={status:y,fetchStatus:m.fetchStatus,isPending:w,isSuccess:y==="success",isError:x,isInitialLoading:k,isLoading:k,data:h,dataUpdatedAt:m.dataUpdatedAt,error:f,errorUpdatedAt:b,failureCount:m.fetchFailureCount,failureReason:m.fetchFailureReason,errorUpdateCount:m.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:m.dataUpdateCount>d.dataUpdateCount||m.errorUpdateCount>d.errorUpdateCount,isFetching:_,isRefetching:_&&!w,isLoadingError:x&&!C,isPaused:m.fetchStatus==="paused",isPlaceholderData:g,isRefetchError:x&&C,isStale:nke(t,e),refetch:this.refetch,promise:this.#i,isEnabled:ey(e.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const I=S.data!==void 0,B=S.status==="error"&&!I,R=N=>{B?N.reject(S.error):I&&N.resolve(S.data)},L=()=>{const N=this.#i=S.promise=Jxe();R(N)},M=this.#i;switch(M.status){case"pending":t.queryHash===n.queryHash&&R(M);break;case"fulfilled":(B||S.data!==M.value)&&L();break;case"rejected":(!B||S.error!==M.reason)&&L();break}}return S}updateResult(){const t=this.#n,e=this.createResult(this.#t,this.options);if(this.#a=this.#t.state,this.#o=this.options,this.#a.data!==void 0&&(this.#p=this.#t),M7(e,t))return;this.#n=e;const n=()=>{if(!t)return!0;const{notifyOnChangeProps:r}=this.options,i=typeof r=="function"?r():r;if(i==="all"||!i&&!this.#g.size)return!0;const o=new Set(i??this.#g);return this.options.throwOnError&&o.add("error"),Object.keys(this.#n).some(l=>{const u=l;return this.#n[u]!==t[u]&&o.has(u)})};this.#C({listeners:n()})}#v(){const t=this.#e.getQueryCache().build(this.#e,this.options);if(t===this.#t)return;const e=this.#t;this.#t=t,this.#r=t.state,this.hasListeners()&&(e?.removeObserver(this),t.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#b()}#C(t){rd.batch(()=>{t.listeners&&this.listeners.forEach(e=>{e(this.#n)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function HFn(t,e){return ey(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function Cot(t,e){return HFn(t,e)||t.state.data!==void 0&&tke(t,e,e.refetchOnMount)}function tke(t,e,n){if(ey(e.enabled,t)!==!1&&eI(e.staleTime,t)!=="static"){const r=typeof n=="function"?n(t):n;return r==="always"||r!==!1&&nke(t,e)}return!1}function Sot(t,e,n,r){return(t!==e||ey(r.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&nke(t,n)}function nke(t,e){return ey(e.enabled,t)!==!1&&t.isStaleByTime(eI(e.staleTime,t))}function WFn(t,e){return!M7(t.getCurrentResult(),e)}function pte(t){return{onFetch:(e,n)=>{const r=e.options,i=e.fetchOptions?.meta?.fetchMore?.direction,o=e.state.data?.pages||[],l=e.state.data?.pageParams||[];let u={pages:[],pageParams:[]},d=0;const p=async()=>{let m=!1;const g=b=>{$Fn(b,()=>e.signal,()=>m=!0)},h=yot(e.options,e.fetchOptions),f=async(b,y,v)=>{if(m)return Promise.reject();if(y==null&&b.pages.length)return Promise.resolve(b);const w=(()=>{const E={client:e.client,queryKey:e.queryKey,pageParam:y,direction:v?"backward":"forward",meta:e.options.meta};return g(E),E})(),x=await h(w),{maxPages:k}=e.options,C=v?QFn:FFn;return{pages:C(b.pages,x,k),pageParams:C(b.pageParams,y,k)}};if(i&&o.length){const b=i==="backward",y=b?Iot:rke,v={pages:o,pageParams:l},_=y(r,v);u=await f(v,_,b)}else{const b=t??o.length;do{const y=d===0?l[0]??r.initialPageParam:rke(r,u);if(d>0&&y==null)break;u=await f(u,y),d++}while(d<b)}return u};e.options.persister?e.fetchFn=()=>e.options.persister?.(p,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},n):e.fetchFn=p}}}function rke(t,{pages:e,pageParams:n}){const r=e.length-1;return e.length>0?t.getNextPageParam(e[r],e,n[r],n):void 0}function Iot(t,{pages:e,pageParams:n}){return e.length>0?t.getPreviousPageParam?.(e[0],e,n[0],n):void 0}function YFn(t,e){return e?rke(t,e)!=null:!1}function VFn(t,e){return!e||!t.getPreviousPageParam?!1:Iot(t,e)!=null}var KFn=class extends dte{constructor(t,e){super(t,e)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(t){super.setOptions({...t,behavior:pte()})}getOptimisticResult(t){return t.behavior=pte(),super.getOptimisticResult(t)}fetchNextPage(t){return this.fetch({...t,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(t){return this.fetch({...t,meta:{fetchMore:{direction:"backward"}}})}createResult(t,e){const{state:n}=t,r=super.createResult(t,e),{isFetching:i,isRefetching:o,isError:l,isRefetchError:u}=r,d=n.fetchMeta?.fetchMore?.direction,p=l&&d==="forward",m=i&&d==="forward",g=l&&d==="backward",h=i&&d==="backward";return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:YFn(e,n.data),hasPreviousPage:VFn(e,n.data),isFetchNextPageError:p,isFetchingNextPage:m,isFetchPreviousPageError:g,isFetchingPreviousPage:h,isRefetchError:u&&!p&&!g,isRefetching:o&&!m&&!h}}},ZFn=class extends wot{#e;#t;#r;#n;constructor(t){super(),this.#e=t.client,this.mutationId=t.mutationId,this.#r=t.mutationCache,this.#t=[],this.state=t.state||Tot(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){this.#t.includes(t)||(this.#t.push(t),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){this.#t=this.#t.filter(e=>e!==t),this.scheduleGc(),this.#r.notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#r.remove(this))}continue(){return this.#n?.continue()??this.execute(this.state.variables)}async execute(t){const e=()=>{this.#a({type:"continue"})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#n=_ot({fn:()=>this.options.mutationFn?this.options.mutationFn(t,n):Promise.reject(new Error("No mutationFn found")),onFail:(o,l)=>{this.#a({type:"failed",failureCount:o,error:l})},onPause:()=>{this.#a({type:"pause"})},onContinue:e,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#r.canRun(this)});const r=this.state.status==="pending",i=!this.#n.canStart();try{if(r)e();else{this.#a({type:"pending",variables:t,isPaused:i}),this.#r.config.onMutate&&await this.#r.config.onMutate(t,this,n);const l=await this.options.onMutate?.(t,n);l!==this.state.context&&this.#a({type:"pending",context:l,variables:t,isPaused:i})}const o=await this.#n.start();return await this.#r.config.onSuccess?.(o,t,this.state.context,this,n),await this.options.onSuccess?.(o,t,this.state.context,n),await this.#r.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,t,this.state.context,n),this.#a({type:"success",data:o}),o}catch(o){try{await this.#r.config.onError?.(o,t,this.state.context,this,n)}catch(l){Promise.reject(l)}try{await this.options.onError?.(o,t,this.state.context,n)}catch(l){Promise.reject(l)}try{await this.#r.config.onSettled?.(void 0,o,this.state.variables,this.state.context,this,n)}catch(l){Promise.reject(l)}try{await this.options.onSettled?.(void 0,o,t,this.state.context,n)}catch(l){Promise.reject(l)}throw this.#a({type:"error",error:o}),o}finally{this.#r.runNext(this)}}#a(t){const e=n=>{switch(t.type){case"failed":return{...n,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...n,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:t.error,failureCount:n.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=e(this.state),rd.batch(()=>{this.#t.forEach(n=>{n.onMutationUpdate(t)}),this.#r.notify({mutation:this,type:"updated",action:t})})}};function Tot(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var XFn=class extends TN{constructor(t={}){super(),this.config=t,this.#e=new Set,this.#t=new Map,this.#r=0}#e;#t;#r;build(t,e,n){const r=new ZFn({client:t,mutationCache:this,mutationId:++this.#r,options:t.defaultMutationOptions(e),state:n});return this.add(r),r}add(t){this.#e.add(t);const e=mte(t);if(typeof e=="string"){const n=this.#t.get(e);n?n.push(t):this.#t.set(e,[t])}this.notify({type:"added",mutation:t})}remove(t){if(this.#e.delete(t)){const e=mte(t);if(typeof e=="string"){const n=this.#t.get(e);if(n)if(n.length>1){const r=n.indexOf(t);r!==-1&&n.splice(r,1)}else n[0]===t&&this.#t.delete(e)}}this.notify({type:"removed",mutation:t})}canRun(t){const e=mte(t);if(typeof e=="string"){const r=this.#t.get(e)?.find(i=>i.state.status==="pending");return!r||r===t}else return!0}runNext(t){const e=mte(t);return typeof e=="string"?this.#t.get(e)?.find(r=>r!==t&&r.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){rd.batch(()=>{this.#e.forEach(t=>{this.notify({type:"removed",mutation:t})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(t){const e={exact:!0,...t};return this.getAll().find(n=>fot(e,n))}findAll(t={}){return this.getAll().filter(e=>fot(t,e))}notify(t){rd.batch(()=>{this.listeners.forEach(e=>{e(t)})})}resumePausedMutations(){const t=this.getAll().filter(e=>e.state.isPaused);return rd.batch(()=>Promise.all(t.map(e=>e.continue().catch(eh))))}};function mte(t){return t.options.scope?.id}var JFn=class extends TN{#e;#t=void 0;#r;#n;constructor(e,n){super(),this.#e=e,this.setOptions(n),this.bindMethods(),this.#a()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){const n=this.options;this.options=this.#e.defaultMutationOptions(e),M7(this.options,n)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#r,observer:this}),n?.mutationKey&&this.options.mutationKey&&DN(n.mutationKey)!==DN(this.options.mutationKey)?this.reset():this.#r?.state.status==="pending"&&this.#r.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#r?.removeObserver(this)}onMutationUpdate(e){this.#a(),this.#o(e)}getCurrentResult(){return this.#t}reset(){this.#r?.removeObserver(this),this.#r=void 0,this.#a(),this.#o()}mutate(e,n){return this.#n=n,this.#r?.removeObserver(this),this.#r=this.#e.getMutationCache().build(this.#e,this.options),this.#r.addObserver(this),this.#r.execute(e)}#a(){const e=this.#r?.state??Tot();this.#t={...e,isPending:e.status==="pending",isSuccess:e.status==="success",isError:e.status==="error",isIdle:e.status==="idle",mutate:this.mutate,reset:this.reset}}#o(e){rd.batch(()=>{if(this.#n&&this.hasListeners()){const n=this.#t.variables,r=this.#t.context,i={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type==="success"){try{this.#n.onSuccess?.(e.data,n,r,i)}catch(o){Promise.reject(o)}try{this.#n.onSettled?.(e.data,null,n,r,i)}catch(o){Promise.reject(o)}}else if(e?.type==="error"){try{this.#n.onError?.(e.error,n,r,i)}catch(o){Promise.reject(o)}try{this.#n.onSettled?.(void 0,e.error,n,r,i)}catch(o){Promise.reject(o)}}}this.listeners.forEach(n=>{n(this.#t)})})}};function Bot(t,e){const n=new Set(e);return t.filter(r=>!n.has(r))}function e8n(t,e,n){const r=t.slice(0);return r[e]=n,r}var t8n=class extends TN{#e;#t;#r;#n;#a;#o;#i;#s;#l;#c=[];constructor(t,e,n){super(),this.#e=t,this.#n=n,this.#r=[],this.#a=[],this.#t=[],this.setQueries(e)}onSubscribe(){this.listeners.size===1&&this.#a.forEach(t=>{t.subscribe(e=>{this.#h(t,e)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#a.forEach(t=>{t.destroy()})}setQueries(t,e){if(this.#r=t,this.#n=e,process.env.NODE_ENV!=="production"){const n=t.map(r=>this.#e.defaultQueryOptions(r).queryHash);new Set(n).size!==n.length&&console.warn("[QueriesObserver]: Duplicate Queries found. This might result in unexpected behavior.")}rd.batch(()=>{const n=this.#a,r=this.#m(this.#r);r.forEach(m=>m.observer.setOptions(m.defaultedQueryOptions));const i=r.map(m=>m.observer),o=i.map(m=>m.getCurrentResult()),l=n.length!==i.length,u=i.some((m,g)=>m!==n[g]),d=l||u,p=d?!0:o.some((m,g)=>{const h=this.#t[g];return!h||!M7(m,h)});!d&&!p||(d&&(this.#c=r,this.#a=i),this.#t=o,this.hasListeners()&&(d&&(Bot(n,i).forEach(m=>{m.destroy()}),Bot(i,n).forEach(m=>{m.subscribe(g=>{this.#h(m,g)})})),this.#g()))})}getCurrentResult(){return this.#t}getQueries(){return this.#a.map(t=>t.getCurrentQuery())}getObservers(){return this.#a}getOptimisticResult(t,e){const n=this.#m(t),r=n.map(o=>o.observer.getOptimisticResult(o.defaultedQueryOptions)),i=n.map(o=>o.defaultedQueryOptions.queryHash);return[r,o=>this.#u(o??r,e,i),()=>this.#p(r,n)]}#p(t,e){return e.map((n,r)=>{const i=t[r];return n.defaultedQueryOptions.notifyOnChangeProps?i:n.observer.trackResult(i,o=>{e.forEach(l=>{l.observer.trackProp(o)})})})}#u(t,e,n){if(e){const r=this.#l,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((o,l)=>o!==r[l]));return(!this.#o||this.#t!==this.#s||i||e!==this.#i)&&(this.#i=e,this.#s=this.#t,n!==void 0&&(this.#l=n),this.#o=lte(this.#o,e(t))),this.#o}return t}#m(t){const e=new Map;this.#a.forEach(r=>{const i=r.options.queryHash;if(!i)return;const o=e.get(i);o?o.push(r):e.set(i,[r])});const n=[];return t.forEach(r=>{const i=this.#e.defaultQueryOptions(r),l=e.get(i.queryHash)?.shift()??new dte(this.#e,i);n.push({defaultedQueryOptions:i,observer:l})}),n}#h(t,e){const n=this.#a.indexOf(t);n!==-1&&(this.#t=e8n(this.#t,n,e),this.#g())}#g(){if(this.hasListeners()){const t=this.#o,e=this.#p(this.#t,this.#c),n=this.#u(e,this.#n?.combine);t!==n&&rd.batch(()=>{this.listeners.forEach(r=>{r(this.#t)})})}}},n8n=class extends TN{constructor(t={}){super(),this.config=t,this.#e=new Map}#e;build(t,e,n){const r=e.queryKey,i=e.queryHash??Vxe(r,e);let o=this.get(i);return o||(o=new GFn({client:t,queryKey:r,queryHash:i,options:t.defaultQueryOptions(e),state:n,defaultOptions:t.getQueryDefaults(r)}),this.add(o)),o}add(t){this.#e.has(t.queryHash)||(this.#e.set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const e=this.#e.get(t.queryHash);e&&(t.destroy(),e===t&&this.#e.delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){rd.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return this.#e.get(t)}getAll(){return[...this.#e.values()]}find(t){const e={exact:!0,...t};return this.getAll().find(n=>hot(e,n))}findAll(t={}){const e=this.getAll();return Object.keys(t).length>0?e.filter(n=>hot(t,n)):e}notify(t){rd.batch(()=>{this.listeners.forEach(e=>{e(t)})})}onFocus(){rd.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){rd.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},r8n=class{#e;#t;#r;#n;#a;#o;#i;#s;constructor(t={}){this.#e=t.queryCache||new n8n,this.#t=t.mutationCache||new XFn,this.#r=t.defaultOptions||{},this.#n=new Map,this.#a=new Map,this.#o=0}mount(){this.#o++,this.#o===1&&(this.#i=Wxe.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=ute.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#o--,this.#o===0&&(this.#i?.(),this.#i=void 0,this.#s?.(),this.#s=void 0)}isFetching(t){return this.#e.findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return this.#t.findAll({...t,status:"pending"}).length}getQueryData(t){const e=this.defaultQueryOptions({queryKey:t});return this.#e.get(e.queryHash)?.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),n=this.#e.build(this,e),r=n.state.data;return r===void 0?this.fetchQuery(t):(t.revalidateIfStale&&n.isStaleByTime(eI(e.staleTime,n))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return this.#e.findAll(t).map(({queryKey:e,state:n})=>{const r=n.data;return[e,r]})}setQueryData(t,e,n){const r=this.defaultQueryOptions({queryKey:t}),o=this.#e.get(r.queryHash)?.state.data,l=MFn(e,o);if(l!==void 0)return this.#e.build(this,r).setData(l,{...n,manual:!0})}setQueriesData(t,e,n){return rd.batch(()=>this.#e.findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,n)]))}getQueryState(t){const e=this.defaultQueryOptions({queryKey:t});return this.#e.get(e.queryHash)?.state}removeQueries(t){const e=this.#e;rd.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=this.#e;return rd.batch(()=>(n.findAll(t).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const n={revert:!0,...e},r=rd.batch(()=>this.#e.findAll(t).map(i=>i.cancel(n)));return Promise.all(r).then(eh).catch(eh)}invalidateQueries(t,e={}){return rd.batch(()=>(this.#e.findAll(t).forEach(n=>{n.invalidate()}),t?.refetchType==="none"?Promise.resolve():this.refetchQueries({...t,type:t?.refetchType??t?.type??"active"},e)))}refetchQueries(t,e={}){const n={...e,cancelRefetch:e.cancelRefetch??!0},r=rd.batch(()=>this.#e.findAll(t).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let o=i.fetch(void 0,n);return n.throwOnError||(o=o.catch(eh)),i.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(r).then(eh)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=this.#e.build(this,e);return n.isStaleByTime(eI(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(eh).catch(eh)}fetchInfiniteQuery(t){return t.behavior=pte(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(eh).catch(eh)}ensureInfiniteQueryData(t){return t.behavior=pte(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return ute.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#r}setDefaultOptions(t){this.#r=t}setQueryDefaults(t,e){this.#n.set(DN(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...this.#n.values()],n={};return e.forEach(r=>{L7(t,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(t,e){this.#a.set(DN(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...this.#a.values()],n={};return e.forEach(r=>{L7(t,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...this.#r.queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=Vxe(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===cte&&(e.enabled=!1),e}defaultMutationOptions(t){return t?._defaulted?t:{...this.#r.mutations,...t?.mutationKey&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Dot=ee.createContext(void 0),Tc=t=>{const e=ee.useContext(Dot);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},O7=({client:t,children:e})=>(ee.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),A.jsx(Dot.Provider,{value:t,children:e})),Not=ee.createContext(!1),Rot=()=>ee.useContext(Not);Not.Provider;function a8n(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var i8n=ee.createContext(a8n()),Lot=()=>ee.useContext(i8n),Mot=(t,e,n)=>{const r=n?.state.error&&typeof t.throwOnError=="function"?Xxe(t.throwOnError,[n.state.error,n]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||r)&&(e.isReset()||(t.retryOnMount=!1))},Pot=t=>{ee.useEffect(()=>{t.clearReset()},[t])},Oot=({result:t,errorResetBoundary:e,throwOnError:n,query:r,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(i&&t.data===void 0||Xxe(n,[t.error,r])),Fot=t=>{if(t.suspense){const n=i=>i==="static"?i:Math.max(i??1e3,1e3),r=t.staleTime;t.staleTime=typeof r=="function"?(...i)=>n(r(...i)):n(r),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},o8n=(t,e)=>t.isLoading&&t.isFetching&&!e,ake=(t,e)=>t?.suspense&&e.isPending,ike=(t,e,n)=>e.fetchOptimistic(t).catch(()=>{n.clearReset()});function s8n({queries:t,...e},n){const r=Tc(),i=Rot(),o=Lot(),l=ee.useMemo(()=>t.map(y=>{const v=r.defaultQueryOptions(y);return v._optimisticResults=i?"isRestoring":"optimistic",v}),[t,r,i]);l.forEach(y=>{Fot(y);const v=r.getQueryCache().get(y.queryHash);Mot(y,o,v)}),Pot(o);const[u]=ee.useState(()=>new t8n(r,l,e)),[d,p,m]=u.getOptimisticResult(l,e.combine),g=!i&&e.subscribed!==!1;ee.useSyncExternalStore(ee.useCallback(y=>g?u.subscribe(rd.batchCalls(y)):eh,[u,g]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),ee.useEffect(()=>{u.setQueries(l,e)},[l,e,u]);const f=d.some((y,v)=>ake(l[v],y))?d.flatMap((y,v)=>{const _=l[v];if(_&&ake(_,y)){const w=new dte(r,_);return ike(_,w,o)}return[]}):[];if(f.length>0)throw Promise.all(f);const b=d.find((y,v)=>{const _=l[v];return _&&Oot({result:y,errorResetBoundary:o,throwOnError:_.throwOnError,query:r.getQueryCache().get(_.queryHash),suspense:_.suspense})});if(b?.error)throw b.error;return p(m())}function Qot(t,e,n){if(process.env.NODE_ENV!=="production"&&(typeof t!="object"||Array.isArray(t)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const r=Rot(),i=Lot(),o=Tc(),l=o.defaultQueryOptions(t);o.getDefaultOptions().queries?._experimental_beforeQuery?.(l);const u=o.getQueryCache().get(l.queryHash);process.env.NODE_ENV!=="production"&&(l.queryFn||console.error(`[${l.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),l._optimisticResults=r?"isRestoring":"optimistic",Fot(l),Mot(l,i,u),Pot(i);const d=!o.getQueryCache().get(l.queryHash),[p]=ee.useState(()=>new e(o,l)),m=p.getOptimisticResult(l),g=!r&&t.subscribed!==!1;if(ee.useSyncExternalStore(ee.useCallback(h=>{const f=g?p.subscribe(rd.batchCalls(h)):eh;return p.updateResult(),f},[p,g]),()=>p.getCurrentResult(),()=>p.getCurrentResult()),ee.useEffect(()=>{p.setOptions(l)},[l,p]),ake(l,m))throw ike(l,p,i);if(Oot({result:m,errorResetBoundary:i,throwOnError:l.throwOnError,query:u,suspense:l.suspense}))throw m.error;return o.getDefaultOptions().queries?._experimental_afterQuery?.(l,m),l.experimental_prefetchInRender&&!P7.isServer()&&o8n(m,r)&&(d?ike(l,p,i):u?.promise)?.catch(eh).finally(()=>{p.updateResult()}),l.notifyOnChangeProps?m:p.trackResult(m)}function Ns(t,e){return Qot(t,dte)}function NA(t,e){const n=Tc(),[r]=ee.useState(()=>new JFn(n,t));ee.useEffect(()=>{r.setOptions(t)},[r,t]);const i=ee.useSyncExternalStore(ee.useCallback(l=>r.subscribe(rd.batchCalls(l)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),o=ee.useCallback((l,u)=>{r.mutate(l,u).catch(eh)},[r]);if(i.error&&Xxe(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:o,mutateAsync:i.mutate}}function $ot(t,e){return Qot(t,KFn)}class l8n{async getActiveCampaigns(){return on.get("/xyzen/api/v1/gifts/active")}async claimGift(e){return on.post(`/xyzen/api/v1/gifts/${e}/claim`)}}const jot=new l8n,c8n=!1,u8n=!0;console.log("=== Environment Debug ==="),console.log("MODE:","production"),console.log("isDevelopment:",c8n),console.log("isProduction:",u8n),console.log("VITE_XYZEN_BACKEND_URL:","https://xyzen.cc");const NN="https://xyzen.cc";console.log("Final DEFAULT_BACKEND_URL:",NN);const d8n=typeof localStorage<"u"&&localStorage.getItem("layoutStyle")?localStorage.getItem("layoutStyle"):"sidebar";console.log("Final DEFAULT_LAYOUT_STYLE:",d8n);function oke(){return typeof window<"u"&&"__TAURI__"in window}async function ske(t,e){const{invoke:n}=await Promise.resolve().then(()=>_Zn);return n(t,e)}async function p8n(t,e,n){return ske("runner_start",{token:t,url:e,workDir:n})}async function m8n(){return ske("runner_stop")}async function g8n(){return ske("runner_status")}function h8n(){return A.jsx("div",{"data-tauri-drag-region":!0,className:"fixed top-0 left-0 right-0 h-2 z-[100] select-none backdrop-blur-xl backdrop-saturate-150",style:{WebkitMaskImage:"linear-gradient(to bottom, black 0%, transparent 100%)",maskImage:"linear-gradient(to bottom, black 0%, transparent 100%)",background:"linear-gradient(to bottom, rgba(128,128,128,0.2) 0%, transparent 100%)"}})}const f8n=Object.freeze({billing:!1,admin:!1,checkIn:!1,subscription:!1,developerReward:!1}),A8n=Object.freeze({billing:!0,admin:!0,checkIn:!0,subscription:!0,developerReward:!0}),lke=Object.freeze({edition:"ce",isEE:!1,features:f8n}),b8n=Object.freeze({edition:"ee",isEE:!0,features:A8n});let LP=lke,zot=!1;async function y8n(){if(zot)return LP;try{const[t,e]=await Promise.all([Wee.getEdition(),Wee.getFeatures().catch(()=>null)]),n=t.edition==="ee"?b8n:lke;if(e){const r={...n.features,developerReward:n.features.developerReward&&e.developer_reward};LP=Object.freeze({...n,features:Object.freeze(r)})}else LP=n}catch{LP=lke}return zot=!0,LP}function RA(t){return LP.features[t]}const gte=()=>{const[t,e]=T.useState("system"),n=Un(l=>l.setTheme),r=T.useCallback(l=>{const u=window.document.documentElement,d=l==="dark"||l==="system"&&window.matchMedia("(prefers-color-scheme: dark)").matches,p=document.createElement("style");p.innerHTML="*, *::before, *::after { transition: none !important; }",document.head.appendChild(p),u.classList.toggle("dark",d),localStorage.setItem("theme",l);const m=d?"#000000":"#ffffff";document.querySelectorAll('meta[name="theme-color"]').forEach(g=>{g.content=m}),setTimeout(()=>{document.head.contains(p)&&document.head.removeChild(p)},50)},[]);return T.useEffect(()=>{const u=localStorage.getItem("theme")||"system";e(u),r(u)},[r]),T.useEffect(()=>{const l=window.matchMedia("(prefers-color-scheme: dark)"),u=()=>{t==="system"&&r("system")};return l.addEventListener("change",u),()=>l.removeEventListener("change",u)},[t,r]),{theme:t,cycleTheme:()=>{const l=["light","dark","system"],u=l.indexOf(t),d=l[(u+1)%l.length];e(d),r(d)},setTheme:l=>{e(l),r(l),n(l)}}};function v8n(t){if(typeof document>"u")return;let e=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",e.appendChild(n),n.styleSheet?n.styleSheet.cssText=t:n.appendChild(document.createTextNode(t))}const _8n=t=>{switch(t){case"success":return k8n;case"info":return C8n;case"warning":return E8n;case"error":return S8n;default:return null}},w8n=Array(12).fill(0),x8n=({visible:t,className:e})=>T.createElement("div",{className:["sonner-loading-wrapper",e].filter(Boolean).join(" "),"data-visible":t},T.createElement("div",{className:"sonner-spinner"},w8n.map((n,r)=>T.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),k8n=T.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},T.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),E8n=T.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},T.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),C8n=T.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},T.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),S8n=T.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},T.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),I8n=T.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},T.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),T.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),T8n=()=>{const[t,e]=T.useState(document.hidden);return T.useEffect(()=>{const n=()=>{e(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),t};let cke=1;class B8n{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{const n=this.subscribers.indexOf(e);this.subscribers.splice(n,1)}),this.publish=e=>{this.subscribers.forEach(n=>n(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var n;const{message:r,...i}=e,o=typeof e?.id=="number"||((n=e.id)==null?void 0:n.length)>0?e.id:cke++,l=this.toasts.find(d=>d.id===o),u=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(o)&&this.dismissedToasts.delete(o),l?this.toasts=this.toasts.map(d=>d.id===o?(this.publish({...d,...e,id:o,title:r}),{...d,...e,id:o,dismissible:u,title:r}):d):this.addToast({title:r,...i,dismissible:u,id:o}),o},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(n=>n({id:e,dismiss:!0})))):this.toasts.forEach(n=>{this.subscribers.forEach(r=>r({id:n.id,dismiss:!0}))}),e),this.message=(e,n)=>this.create({...n,message:e}),this.error=(e,n)=>this.create({...n,message:e,type:"error"}),this.success=(e,n)=>this.create({...n,type:"success",message:e}),this.info=(e,n)=>this.create({...n,type:"info",message:e}),this.warning=(e,n)=>this.create({...n,type:"warning",message:e}),this.loading=(e,n)=>this.create({...n,type:"loading",message:e}),this.promise=(e,n)=>{if(!n)return;let r;n.loading!==void 0&&(r=this.create({...n,promise:e,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const i=Promise.resolve(e instanceof Function?e():e);let o=r!==void 0,l;const u=i.then(async p=>{if(l=["resolve",p],T.isValidElement(p))o=!1,this.create({id:r,type:"default",message:p});else if(N8n(p)&&!p.ok){o=!1;const g=typeof n.error=="function"?await n.error(`HTTP error! status: ${p.status}`):n.error,h=typeof n.description=="function"?await n.description(`HTTP error! status: ${p.status}`):n.description,b=typeof g=="object"&&!T.isValidElement(g)?g:{message:g};this.create({id:r,type:"error",description:h,...b})}else if(p instanceof Error){o=!1;const g=typeof n.error=="function"?await n.error(p):n.error,h=typeof n.description=="function"?await n.description(p):n.description,b=typeof g=="object"&&!T.isValidElement(g)?g:{message:g};this.create({id:r,type:"error",description:h,...b})}else if(n.success!==void 0){o=!1;const g=typeof n.success=="function"?await n.success(p):n.success,h=typeof n.description=="function"?await n.description(p):n.description,b=typeof g=="object"&&!T.isValidElement(g)?g:{message:g};this.create({id:r,type:"success",description:h,...b})}}).catch(async p=>{if(l=["reject",p],n.error!==void 0){o=!1;const m=typeof n.error=="function"?await n.error(p):n.error,g=typeof n.description=="function"?await n.description(p):n.description,f=typeof m=="object"&&!T.isValidElement(m)?m:{message:m};this.create({id:r,type:"error",description:g,...f})}}).finally(()=>{o&&(this.dismiss(r),r=void 0),n.finally==null||n.finally.call(n)}),d=()=>new Promise((p,m)=>u.then(()=>l[0]==="reject"?m(l[1]):p(l[1])).catch(m));return typeof r!="string"&&typeof r!="number"?{unwrap:d}:Object.assign(r,{unwrap:d})},this.custom=(e,n)=>{const r=n?.id||cke++;return this.create({jsx:e(r),id:r,...n}),r},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const LA=new B8n,D8n=(t,e)=>{const n=e?.id||cke++;return LA.addToast({title:t,...e,id:n}),n},N8n=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",R8n=D8n,L8n=()=>LA.toasts,M8n=()=>LA.getActiveToasts(),Gr=Object.assign(R8n,{success:LA.success,info:LA.info,warning:LA.warning,error:LA.error,custom:LA.custom,message:LA.message,promise:LA.promise,dismiss:LA.dismiss,loading:LA.loading},{getHistory:L8n,getToasts:M8n});v8n("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function hte(t){return t.label!==void 0}const P8n=3,O8n="24px",F8n="16px",Uot=4e3,Q8n=356,$8n=14,j8n=45,z8n=200;function ox(...t){return t.filter(Boolean).join(" ")}function U8n(t){const[e,n]=t.split("-"),r=[];return e&&r.push(e),n&&r.push(n),r}const q8n=t=>{var e,n,r,i,o,l,u,d,p;const{invert:m,toast:g,unstyled:h,interacting:f,setHeights:b,visibleToasts:y,heights:v,index:_,toasts:w,expanded:x,removeToast:k,defaultRichColors:C,closeButton:E,style:S,cancelButtonStyle:I,actionButtonStyle:B,className:R="",descriptionClassName:L="",duration:M,position:N,gap:D,expandByDefault:P,classNames:O,icons:F,closeButtonAriaLabel:$="Close toast"}=t,[j,Q]=T.useState(null),[z,U]=T.useState(null),[H,te]=T.useState(!1),[V,re]=T.useState(!1),[ie,X]=T.useState(!1),[W,q]=T.useState(!1),[Y,Z]=T.useState(!1),[ae,de]=T.useState(0),[se,ce]=T.useState(0),ge=T.useRef(g.duration||M||Uot),_e=T.useRef(null),Ce=T.useRef(null),He=_===0,Le=_+1<=y,lt=g.type,pt=g.dismissible!==!1,wt=g.className||"",Lt=g.descriptionClassName||"",Je=T.useMemo(()=>v.findIndex(fe=>fe.toastId===g.id)||0,[v,g.id]),bt=T.useMemo(()=>{var fe;return(fe=g.closeButton)!=null?fe:E},[g.closeButton,E]),Ne=T.useMemo(()=>g.duration||M||Uot,[g.duration,M]),at=T.useRef(0),$t=T.useRef(0),me=T.useRef(0),Xe=T.useRef(null),[oe,Re]=N.split("-"),ye=T.useMemo(()=>v.reduce((fe,xe,dt)=>dt>=Je?fe:fe+xe.height,0),[v,Je]),Qe=T8n(),we=g.invert||m,it=lt==="loading";$t.current=T.useMemo(()=>Je*D+ye,[Je,ye]),T.useEffect(()=>{ge.current=Ne},[Ne]),T.useEffect(()=>{te(!0)},[]),T.useEffect(()=>{const fe=Ce.current;if(fe){const xe=fe.getBoundingClientRect().height;return ce(xe),b(dt=>[{toastId:g.id,height:xe,position:g.position},...dt]),()=>b(dt=>dt.filter(et=>et.toastId!==g.id))}},[b,g.id]),T.useLayoutEffect(()=>{if(!H)return;const fe=Ce.current,xe=fe.style.height;fe.style.height="auto";const dt=fe.getBoundingClientRect().height;fe.style.height=xe,ce(dt),b(et=>et.find(rn=>rn.toastId===g.id)?et.map(rn=>rn.toastId===g.id?{...rn,height:dt}:rn):[{toastId:g.id,height:dt,position:g.position},...et])},[H,g.title,g.description,b,g.id,g.jsx,g.action,g.cancel]);const yt=T.useCallback(()=>{re(!0),de($t.current),b(fe=>fe.filter(xe=>xe.toastId!==g.id)),setTimeout(()=>{k(g)},z8n)},[g,k,b,$t]);T.useEffect(()=>{if(g.promise&<==="loading"||g.duration===1/0||g.type==="loading")return;let fe;return x||f||Qe?(()=>{if(me.current<at.current){const et=new Date().getTime()-at.current;ge.current=ge.current-et}me.current=new Date().getTime()})():ge.current!==1/0&&(at.current=new Date().getTime(),fe=setTimeout(()=>{g.onAutoClose==null||g.onAutoClose.call(g,g),yt()},ge.current)),()=>clearTimeout(fe)},[x,f,g,lt,Qe,yt]),T.useEffect(()=>{g.delete&&(yt(),g.onDismiss==null||g.onDismiss.call(g,g))},[yt,g.delete]);function ue(){var fe;if(F?.loading){var xe;return T.createElement("div",{className:ox(O?.loader,g==null||(xe=g.classNames)==null?void 0:xe.loader,"sonner-loader"),"data-visible":lt==="loading"},F.loading)}return T.createElement(x8n,{className:ox(O?.loader,g==null||(fe=g.classNames)==null?void 0:fe.loader),visible:lt==="loading"})}const tt=g.icon||F?.[lt]||_8n(lt);var st,De;return T.createElement("li",{tabIndex:0,ref:Ce,className:ox(R,wt,O?.toast,g==null||(e=g.classNames)==null?void 0:e.toast,O?.default,O?.[lt],g==null||(n=g.classNames)==null?void 0:n[lt]),"data-sonner-toast":"","data-rich-colors":(st=g.richColors)!=null?st:C,"data-styled":!(g.jsx||g.unstyled||h),"data-mounted":H,"data-promise":!!g.promise,"data-swiped":Y,"data-removed":V,"data-visible":Le,"data-y-position":oe,"data-x-position":Re,"data-index":_,"data-front":He,"data-swiping":ie,"data-dismissible":pt,"data-type":lt,"data-invert":we,"data-swipe-out":W,"data-swipe-direction":z,"data-expanded":!!(x||P&&H),"data-testid":g.testId,style:{"--index":_,"--toasts-before":_,"--z-index":w.length-_,"--offset":`${V?ae:$t.current}px`,"--initial-height":P?"auto":`${se}px`,...S,...g.style},onDragEnd:()=>{X(!1),Q(null),Xe.current=null},onPointerDown:fe=>{fe.button!==2&&(it||!pt||(_e.current=new Date,de($t.current),fe.target.setPointerCapture(fe.pointerId),fe.target.tagName!=="BUTTON"&&(X(!0),Xe.current={x:fe.clientX,y:fe.clientY})))},onPointerUp:()=>{var fe,xe,dt;if(W||!pt)return;Xe.current=null;const et=Number(((fe=Ce.current)==null?void 0:fe.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Yt=Number(((xe=Ce.current)==null?void 0:xe.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),rn=new Date().getTime()-((dt=_e.current)==null?void 0:dt.getTime()),an=j==="x"?et:Yt,Xt=Math.abs(an)/rn;if(Math.abs(an)>=j8n||Xt>.11){de($t.current),g.onDismiss==null||g.onDismiss.call(g,g),U(j==="x"?et>0?"right":"left":Yt>0?"down":"up"),yt(),q(!0);return}else{var Nt,Bt;(Nt=Ce.current)==null||Nt.style.setProperty("--swipe-amount-x","0px"),(Bt=Ce.current)==null||Bt.style.setProperty("--swipe-amount-y","0px")}Z(!1),X(!1),Q(null)},onPointerMove:fe=>{var xe,dt,et;if(!Xe.current||!pt||((xe=window.getSelection())==null?void 0:xe.toString().length)>0)return;const rn=fe.clientY-Xe.current.y,an=fe.clientX-Xe.current.x;var Xt;const Nt=(Xt=t.swipeDirections)!=null?Xt:U8n(N);!j&&(Math.abs(an)>1||Math.abs(rn)>1)&&Q(Math.abs(an)>Math.abs(rn)?"x":"y");let Bt={x:0,y:0};const nt=gn=>1/(1.5+Math.abs(gn)/20);if(j==="y"){if(Nt.includes("top")||Nt.includes("bottom"))if(Nt.includes("top")&&rn<0||Nt.includes("bottom")&&rn>0)Bt.y=rn;else{const gn=rn*nt(rn);Bt.y=Math.abs(gn)<Math.abs(rn)?gn:rn}}else if(j==="x"&&(Nt.includes("left")||Nt.includes("right")))if(Nt.includes("left")&&an<0||Nt.includes("right")&&an>0)Bt.x=an;else{const gn=an*nt(an);Bt.x=Math.abs(gn)<Math.abs(an)?gn:an}(Math.abs(Bt.x)>0||Math.abs(Bt.y)>0)&&Z(!0),(dt=Ce.current)==null||dt.style.setProperty("--swipe-amount-x",`${Bt.x}px`),(et=Ce.current)==null||et.style.setProperty("--swipe-amount-y",`${Bt.y}px`)}},bt&&!g.jsx&<!=="loading"?T.createElement("button",{"aria-label":$,"data-disabled":it,"data-close-button":!0,onClick:it||!pt?()=>{}:()=>{yt(),g.onDismiss==null||g.onDismiss.call(g,g)},className:ox(O?.closeButton,g==null||(r=g.classNames)==null?void 0:r.closeButton)},(De=F?.close)!=null?De:I8n):null,(lt||g.icon||g.promise)&&g.icon!==null&&(F?.[lt]!==null||g.icon)?T.createElement("div",{"data-icon":"",className:ox(O?.icon,g==null||(i=g.classNames)==null?void 0:i.icon)},g.promise||g.type==="loading"&&!g.icon?g.icon||ue():null,g.type!=="loading"?tt:null):null,T.createElement("div",{"data-content":"",className:ox(O?.content,g==null||(o=g.classNames)==null?void 0:o.content)},T.createElement("div",{"data-title":"",className:ox(O?.title,g==null||(l=g.classNames)==null?void 0:l.title)},g.jsx?g.jsx:typeof g.title=="function"?g.title():g.title),g.description?T.createElement("div",{"data-description":"",className:ox(L,Lt,O?.description,g==null||(u=g.classNames)==null?void 0:u.description)},typeof g.description=="function"?g.description():g.description):null),T.isValidElement(g.cancel)?g.cancel:g.cancel&&hte(g.cancel)?T.createElement("button",{"data-button":!0,"data-cancel":!0,style:g.cancelButtonStyle||I,onClick:fe=>{hte(g.cancel)&&pt&&(g.cancel.onClick==null||g.cancel.onClick.call(g.cancel,fe),yt())},className:ox(O?.cancelButton,g==null||(d=g.classNames)==null?void 0:d.cancelButton)},g.cancel.label):null,T.isValidElement(g.action)?g.action:g.action&&hte(g.action)?T.createElement("button",{"data-button":!0,"data-action":!0,style:g.actionButtonStyle||B,onClick:fe=>{hte(g.action)&&(g.action.onClick==null||g.action.onClick.call(g.action,fe),!fe.defaultPrevented&&yt())},className:ox(O?.actionButton,g==null||(p=g.classNames)==null?void 0:p.actionButton)},g.action.label):null)};function qot(){if(typeof window>"u"||typeof document>"u")return"ltr";const t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}function G8n(t,e){const n={};return[t,e].forEach((r,i)=>{const o=i===1,l=o?"--mobile-offset":"--offset",u=o?F8n:O8n;function d(p){["top","right","bottom","left"].forEach(m=>{n[`${l}-${m}`]=typeof p=="number"?`${p}px`:p})}typeof r=="number"||typeof r=="string"?d(r):typeof r=="object"?["top","right","bottom","left"].forEach(p=>{r[p]===void 0?n[`${l}-${p}`]=u:n[`${l}-${p}`]=typeof r[p]=="number"?`${r[p]}px`:r[p]}):d(u)}),n}const H8n=T.forwardRef(function(e,n){const{id:r,invert:i,position:o="bottom-right",hotkey:l=["altKey","KeyT"],expand:u,closeButton:d,className:p,offset:m,mobileOffset:g,theme:h="light",richColors:f,duration:b,style:y,visibleToasts:v=P8n,toastOptions:_,dir:w=qot(),gap:x=$8n,icons:k,containerAriaLabel:C="Notifications"}=e,[E,S]=T.useState([]),I=T.useMemo(()=>r?E.filter(H=>H.toasterId===r):E.filter(H=>!H.toasterId),[E,r]),B=T.useMemo(()=>Array.from(new Set([o].concat(I.filter(H=>H.position).map(H=>H.position)))),[I,o]),[R,L]=T.useState([]),[M,N]=T.useState(!1),[D,P]=T.useState(!1),[O,F]=T.useState(h!=="system"?h:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),$=T.useRef(null),j=l.join("+").replace(/Key/g,"").replace(/Digit/g,""),Q=T.useRef(null),z=T.useRef(!1),U=T.useCallback(H=>{S(te=>{var V;return(V=te.find(re=>re.id===H.id))!=null&&V.delete||LA.dismiss(H.id),te.filter(({id:re})=>re!==H.id)})},[]);return T.useEffect(()=>LA.subscribe(H=>{if(H.dismiss){requestAnimationFrame(()=>{S(te=>te.map(V=>V.id===H.id?{...V,delete:!0}:V))});return}setTimeout(()=>{Qi.flushSync(()=>{S(te=>{const V=te.findIndex(re=>re.id===H.id);return V!==-1?[...te.slice(0,V),{...te[V],...H},...te.slice(V+1)]:[H,...te]})})})}),[E]),T.useEffect(()=>{if(h!=="system"){F(h);return}if(h==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?F("dark"):F("light")),typeof window>"u")return;const H=window.matchMedia("(prefers-color-scheme: dark)");try{H.addEventListener("change",({matches:te})=>{F(te?"dark":"light")})}catch{H.addListener(({matches:V})=>{try{F(V?"dark":"light")}catch(re){console.error(re)}})}},[h]),T.useEffect(()=>{E.length<=1&&N(!1)},[E]),T.useEffect(()=>{const H=te=>{var V;if(l.every(X=>te[X]||te.code===X)){var ie;N(!0),(ie=$.current)==null||ie.focus()}te.code==="Escape"&&(document.activeElement===$.current||(V=$.current)!=null&&V.contains(document.activeElement))&&N(!1)};return document.addEventListener("keydown",H),()=>document.removeEventListener("keydown",H)},[l]),T.useEffect(()=>{if($.current)return()=>{Q.current&&(Q.current.focus({preventScroll:!0}),Q.current=null,z.current=!1)}},[$.current]),T.createElement("section",{ref:n,"aria-label":`${C} ${j}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},B.map((H,te)=>{var V;const[re,ie]=H.split("-");return I.length?T.createElement("ol",{key:H,dir:w==="auto"?qot():w,tabIndex:-1,ref:$,className:p,"data-sonner-toaster":!0,"data-sonner-theme":O,"data-y-position":re,"data-x-position":ie,style:{"--front-toast-height":`${((V=R[0])==null?void 0:V.height)||0}px`,"--width":`${Q8n}px`,"--gap":`${x}px`,...y,...G8n(m,g)},onBlur:X=>{z.current&&!X.currentTarget.contains(X.relatedTarget)&&(z.current=!1,Q.current&&(Q.current.focus({preventScroll:!0}),Q.current=null))},onFocus:X=>{X.target instanceof HTMLElement&&X.target.dataset.dismissible==="false"||z.current||(z.current=!0,Q.current=X.relatedTarget)},onMouseEnter:()=>N(!0),onMouseMove:()=>N(!0),onMouseLeave:()=>{D||N(!1)},onDragEnd:()=>N(!1),onPointerDown:X=>{X.target instanceof HTMLElement&&X.target.dataset.dismissible==="false"||P(!0)},onPointerUp:()=>P(!1)},I.filter(X=>!X.position&&te===0||X.position===H).map((X,W)=>{var q,Y;return T.createElement(q8n,{key:X.id,icons:k,index:W,toast:X,defaultRichColors:f,duration:(q=_?.duration)!=null?q:b,className:_?.className,descriptionClassName:_?.descriptionClassName,invert:i,visibleToasts:v,closeButton:(Y=_?.closeButton)!=null?Y:d,interacting:D,position:H,style:_?.style,unstyled:_?.unstyled,classNames:_?.classNames,cancelButtonStyle:_?.cancelButtonStyle,actionButtonStyle:_?.actionButtonStyle,closeButtonAriaLabel:_?.closeButtonAriaLabel,removeToast:U,toasts:I.filter(Z=>Z.position==X.position),heights:R.filter(Z=>Z.position==X.position),setHeights:L,expandByDefault:u,gap:x,expanded:M,swipeDirections:e.swipeDirections})})):null}))});function W8n(){return{needRefresh:[!1,()=>{}],offlineReady:[!1,()=>{}],updateServiceWorker:async()=>{}}}const Got=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim();const Y8n=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const V8n=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase());const Hot=t=>{const e=V8n(t);return e.charAt(0).toUpperCase()+e.slice(1)};var K8n={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const Z8n=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0;return!1};const X8n=T.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:o,iconNode:l,...u},d)=>T.createElement("svg",{ref:d,...K8n,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:Got("lucide",i),...!o&&!Z8n(u)&&{"aria-hidden":"true"},...u},[...l.map(([p,m])=>T.createElement(p,m)),...Array.isArray(o)?o:[o]]));const Yr=(t,e)=>{const n=T.forwardRef(({className:r,...i},o)=>T.createElement(X8n,{ref:o,iconNode:e,className:Got(`lucide-${Y8n(Hot(t))}`,`lucide-${t}`,r),...i}));return n.displayName=Hot(t),n};const uke=Yr("archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);const sx=Yr("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);const MP=Yr("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);const Wot=Yr("audio-lines",[["path",{d:"M2 10v3",key:"1fnikh"}],["path",{d:"M6 6v11",key:"11sgs0"}],["path",{d:"M10 3v18",key:"yhl04a"}],["path",{d:"M14 8v7",key:"3a1oy3"}],["path",{d:"M18 5v13",key:"123xd1"}],["path",{d:"M22 10v3",key:"154ddg"}]]);const J8n=Yr("bold",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]]);const e6n=Yr("book-open",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);const PP=Yr("bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);const t6n=Yr("braces",[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]]);const fte=Yr("brain",[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]]);const n6n=Yr("check-check",[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]]);const th=Yr("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const df=Yr("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const dke=Yr("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);const tI=Yr("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);const Ate=Yr("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const r6n=Yr("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);const Yot=Yr("circle-stop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]]);const a6n=Yr("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);const i6n=Yr("circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);const o6n=Yr("clipboard-copy",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",key:"4jdomd"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4",key:"3hqy98"}],["path",{d:"M21 14H11",key:"1bme5i"}],["path",{d:"m15 10-4 4 4 4",key:"5dvupr"}]]);const s6n=Yr("cloud-off",[["path",{d:"M10.94 5.274A7 7 0 0 1 15.71 10h1.79a4.5 4.5 0 0 1 4.222 6.057",key:"1uxyv8"}],["path",{d:"M18.796 18.81A4.5 4.5 0 0 1 17.5 19H9A7 7 0 0 1 5.79 5.78",key:"99tcn7"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);const pke=Yr("code-xml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);const l6n=Yr("coins",[["path",{d:"M13.744 17.736a6 6 0 1 1-7.48-7.48",key:"bq4yh3"}],["path",{d:"M15 6h1v4",key:"11y1tn"}],["path",{d:"m6.134 14.768.866-.5 2 3.464",key:"17snzx"}],["circle",{cx:"16",cy:"8",r:"6",key:"14bfc9"}]]);const c6n=Yr("columns-3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);const u6n=Yr("compass",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}]]);const mke=Yr("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);const d6n=Yr("cpu",[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]);const gke=Yr("credit-card",[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]]);const y1=Yr("crown",[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]]);const v1=Yr("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);const Vot=Yr("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);const Kot=Yr("eye-off",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);const Zot=Yr("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const p6n=Yr("file-code",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]]);const hke=Yr("file-up",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"m15 15-3-3-3 3",key:"15xj92"}]]);const Xot=Yr("film",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 3v18",key:"bbkbws"}],["path",{d:"M3 7.5h4",key:"zfgn84"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 16.5h4",key:"1230mu"}],["path",{d:"M17 3v18",key:"in4fa5"}],["path",{d:"M17 7.5h4",key:"myr1c1"}],["path",{d:"M17 16.5h4",key:"go4c1d"}]]);const Jot=Yr("folder-open",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);const fke=Yr("folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);const bte=Yr("gem",[["path",{d:"M10.5 3 8 9l4 13 4-13-2.5-6",key:"b3dvk1"}],["path",{d:"M17 3a2 2 0 0 1 1.6.8l3 4a2 2 0 0 1 .013 2.382l-7.99 10.986a2 2 0 0 1-3.247 0l-7.99-10.986A2 2 0 0 1 2.4 7.8l2.998-3.997A2 2 0 0 1 7 3z",key:"7w4byz"}],["path",{d:"M2 9h20",key:"16fsjt"}]]);const est=Yr("gift",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M20 11v8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-8",key:"1sqzm4"}],["path",{d:"M7.5 7a1 1 0 0 1 0-5A4.8 8 0 0 1 12 7a4.8 8 0 0 1 4.5-5 1 1 0 0 1 0 5",key:"kc0143"}],["rect",{x:"3",y:"7",width:"18",height:"4",rx:"1",key:"1hberx"}]]);const tst=Yr("github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]);const Ake=Yr("globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);const m6n=Yr("heading-1",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]]);const g6n=Yr("heading-2",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]]);const h6n=Yr("heading-3",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]]);const f6n=Yr("heading-4",[["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17 10v3a1 1 0 0 0 1 1h3",key:"tj5zdr"}],["path",{d:"M21 10v8",key:"1kdml4"}],["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}]]);const A6n=Yr("heading-5",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17 13v-3h4",key:"1nvgqp"}],["path",{d:"M17 17.7c.4.2.8.3 1.3.3 1.5 0 2.7-1.1 2.7-2.5S19.8 13 18.3 13H17",key:"2nebdn"}]]);const b6n=Yr("heading-6",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["circle",{cx:"19",cy:"16",r:"2",key:"15mx69"}],["path",{d:"M20 10c-2 2-3 3.5-3 6",key:"f35dl0"}]]);const OP=Yr("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);const y6n=Yr("inbox",[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]);const F7=Yr("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);const v6n=Yr("italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]);const FP=Yr("link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);const nst=Yr("list-ordered",[["path",{d:"M11 5h10",key:"1cz7ny"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 19h10",key:"11t30w"}],["path",{d:"M4 4h1v5",key:"10yrso"}],["path",{d:"M4 9h2",key:"r1h2o0"}],["path",{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",key:"xtkcd5"}]]);const rst=Yr("list",[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]);const nh=Yr("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);const bke=Yr("log-in",[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]]);const ast=Yr("mail-open",[["path",{d:"M21.2 8.4c.5.38.8.97.8 1.6v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V10a2 2 0 0 1 .8-1.6l8-6a2 2 0 0 1 2.4 0l8 6Z",key:"1jhwl8"}],["path",{d:"m22 10-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 10",key:"1qfld7"}]]);const yte=Yr("mail",[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]]);const _6n=Yr("message-square-plus",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M12 8v6",key:"1ib9pf"}],["path",{d:"M9 11h6",key:"1fldmi"}]]);const yke=Yr("message-square",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]]);const ist=Yr("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);const w6n=Yr("monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);const x6n=Yr("octagon-x",[["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);const k6n=Yr("panel-right-close",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]]);const Q7=Yr("phone",[["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]]);const E6n=Yr("pilcrow",[["path",{d:"M13 4v16",key:"8vvj80"}],["path",{d:"M17 4v16",key:"7dpous"}],["path",{d:"M19 4H9.5a4.5 4.5 0 0 0 0 9H13",key:"sh4n9v"}]]);const ost=Yr("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const C6n=Yr("quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]]);const S6n=Yr("redo-2",[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]]);const sst=Yr("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);const I6n=Yr("scale",[["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"m19 8 3 8a5 5 0 0 1-6 0zV7",key:"zcdpyk"}],["path",{d:"M3 7h1a17 17 0 0 0 8-2 17 17 0 0 0 8 2h1",key:"1yorad"}],["path",{d:"m5 8 3 8a5 5 0 0 1-6 0zV7",key:"eua70x"}],["path",{d:"M7 21h10",key:"1b0cd5"}]]);const T6n=Yr("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);const B6n=Yr("share-2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]);const D6n=Yr("shield-alert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);const vte=Yr("shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);const N6n=Yr("smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);const lx=Yr("sparkles",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]]);const R6n=Yr("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);const L6n=Yr("strikethrough",[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]]);const M6n=Yr("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]);const P6n=Yr("text-align-start",[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 19H3",key:"z6ezky"}]]);const _te=Yr("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);const vke=Yr("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);const lst=Yr("undo-2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]);const O6n=Yr("unlink",[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]]);const wte=Yr("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);const xte=Yr("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]);const F6n=Yr("video",[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]]);const Q6n=Yr("wallet",[["path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",key:"18etb6"}],["path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4",key:"xoc0q4"}]]);const _1=Yr("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);const kte=Yr("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);function $6n({title:t,description:e,actionLabel:n,cancelLabel:r,onAction:i,onCancel:o}){return A.jsxs("div",{className:"flex w-[360px] flex-col gap-3 rounded-lg border border-neutral-200/60 bg-white p-4 shadow-lg dark:border-neutral-800/60 dark:bg-neutral-900",children:[A.jsxs("div",{className:"flex items-start gap-3",children:[A.jsx("div",{className:"mt-0.5 shrink-0 rounded-full bg-indigo-500/10 p-1.5",children:A.jsx(sst,{className:"size-4 text-indigo-500"})}),A.jsxs("div",{className:"min-w-0",children:[A.jsx("p",{className:"text-[13px] font-semibold text-neutral-900 dark:text-neutral-100",children:t}),A.jsx("p",{className:"mt-0.5 text-xs text-neutral-500 dark:text-neutral-400",children:e})]})]}),A.jsxs("div",{className:"flex flex-col gap-1.5",children:[A.jsx("button",{onClick:i,className:"w-full rounded-lg bg-indigo-500 px-3 py-2 text-[13px] font-semibold text-white transition-colors hover:bg-indigo-600 active:bg-indigo-700",children:n}),A.jsx("button",{onClick:o,className:"w-full rounded-lg bg-neutral-100/80 px-3 py-2 text-[13px] text-neutral-600 transition-colors hover:bg-neutral-200/80 dark:bg-white/[0.06] dark:text-neutral-400 dark:hover:bg-white/[0.1]",children:r})]})]})}function j6n(){const{t}=Cn(),e=T.useRef(null),n=T.useRef(null),{needRefresh:[r],updateServiceWorker:i}=W8n();T.useEffect(()=>()=>{n.current?.(),n.current=null},[]);const o=T.useCallback(()=>{i()},[i]);T.useEffect(()=>{if(!r){e.current!=null&&(Gr.dismiss(e.current),e.current=null);return}e.current=Gr.custom(l=>$6n({title:t("app.pwa.updateAvailableTitle","New version available"),description:t("app.pwa.updateAvailableDescription","A new version of Xyzen is ready. Refresh to update."),actionLabel:t("app.pwa.updateAction","Refresh"),cancelLabel:t("app.pwa.updateDismiss","Dismiss"),onAction:o,onCancel:()=>{Gr.dismiss(l),e.current=null}}),{duration:1/0})},[r,o,t])}function z6n(){const t=Xg(),e=(t.isAuthenticated||!!t.token)&&RA("billing"),n=Un(i=>i.fetchWallet),r=Un(i=>i.connectWalletEvents);T.useEffect(()=>e?(n(),r()):void 0,[e,n,r])}const U6n=({...t})=>A.jsx(H8n,{theme:"system",className:"toaster group",richColors:!0,icons:{success:A.jsx(r6n,{className:"size-4"}),info:A.jsx(F7,{className:"size-4"}),warning:A.jsx(vke,{className:"size-4"}),error:A.jsx(x6n,{className:"size-4"}),loading:A.jsx(nh,{className:"size-4 animate-spin"})},style:{"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"var(--border)","--border-radius":"var(--radius)"},...t}),$7=T.createContext({});function nI(t){const e=T.useRef(null);return e.current===null&&(e.current=t()),e.current}const Ete=typeof window<"u"?T.useLayoutEffect:T.useEffect,Cte=T.createContext(null);function _ke(t,e){t.indexOf(e)===-1&&t.push(e)}function QP(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const cx=(t,e,n)=>n>e?e:n<t?t:n;function wke(t,e){return e?`${t}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${e}`:t}let $P=()=>{},Gv=()=>{};typeof process<"u"&&process.env?.NODE_ENV!=="production"&&($P=(t,e,n)=>{!t&&typeof console<"u"&&console.warn(wke(e,n))},Gv=(t,e,n)=>{if(!t)throw new Error(wke(e,n))});const rI={},cst=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);function ust(t){return typeof t=="object"&&t!==null}const dst=t=>/^0[^.\s]+$/u.test(t);function pst(t){let e;return()=>(e===void 0&&(e=t()),e)}const ty=t=>t,q6n=(t,e)=>n=>e(t(n)),j7=(...t)=>t.reduce(q6n),jP=(t,e,n)=>{const r=e-t;return r===0?1:(n-t)/r};class xke{constructor(){this.subscriptions=[]}add(e){return _ke(this.subscriptions,e),()=>QP(this.subscriptions,e)}notify(e,n,r){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](e,n,r);else for(let o=0;o<i;o++){const l=this.subscriptions[o];l&&l(e,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const pf=t=>t*1e3,ny=t=>t/1e3;function mst(t,e){return e?t*(1e3/e):0}const gst=new Set;function kke(t,e,n){t||gst.has(e)||(console.warn(wke(e,n)),gst.add(e))}const G6n=(t,e,n)=>{const r=e-t;return((n-t)%r+r)%r+t},hst=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,H6n=1e-7,W6n=12;function Y6n(t,e,n,r,i){let o,l,u=0;do l=e+(n-e)/2,o=hst(l,r,i)-t,o>0?n=l:e=l;while(Math.abs(o)>H6n&&++u<W6n);return l}function z7(t,e,n,r){if(t===e&&n===r)return ty;const i=o=>Y6n(o,0,1,t,n);return o=>o===0||o===1?o:hst(i(o),e,r)}const fst=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,Ast=t=>e=>1-t(1-e),bst=z7(.33,1.53,.69,.99),Eke=Ast(bst),yst=fst(Eke),vst=t=>t>=1?1:(t*=2)<1?.5*Eke(t):.5*(2-Math.pow(2,-10*(t-1))),Cke=t=>1-Math.sin(Math.acos(t)),_st=Ast(Cke),wst=fst(Cke),V6n=z7(.42,0,1,1),Ske=z7(0,0,.58,1),xst=z7(.42,0,.58,1),kst=t=>Array.isArray(t)&&typeof t[0]!="number";function Est(t,e){return kst(t)?t[G6n(0,t.length,e)]:t}const Cst=t=>Array.isArray(t)&&typeof t[0]=="number",Sst={linear:ty,easeIn:V6n,easeInOut:xst,easeOut:Ske,circIn:Cke,circInOut:wst,circOut:_st,backIn:Eke,backInOut:yst,backOut:bst,anticipate:vst},K6n=t=>typeof t=="string",Ist=t=>{if(Cst(t)){Gv(t.length===4,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[e,n,r,i]=t;return z7(e,n,r,i)}else if(K6n(t))return Gv(Sst[t]!==void 0,`Invalid easing type '${t}'`,"invalid-easing-type"),Sst[t];return t},Ste=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function Z6n(t,e){let n=new Set,r=new Set,i=!1,o=!1;const l=new WeakSet;let u={delta:0,timestamp:0,isProcessing:!1};function d(m){l.has(m)&&(p.schedule(m),t()),m(u)}const p={schedule:(m,g=!1,h=!1)=>{const b=h&&i?n:r;return g&&l.add(m),b.add(m),m},cancel:m=>{r.delete(m),l.delete(m)},process:m=>{if(u=m,i){o=!0;return}i=!0;const g=n;n=r,r=g,n.forEach(d),n.clear(),i=!1,o&&(o=!1,p.process(m))}};return p}const X6n=40;function Tst(t,e){let n=!1,r=!0;const i={delta:0,timestamp:0,isProcessing:!1},o=()=>n=!0,l=Ste.reduce((x,k)=>(x[k]=Z6n(o),x),{}),{setup:u,read:d,resolveKeyframes:p,preUpdate:m,update:g,preRender:h,render:f,postRender:b}=l,y=()=>{const x=rI.useManualTiming,k=x?i.timestamp:performance.now();n=!1,x||(i.delta=r?1e3/60:Math.max(Math.min(k-i.timestamp,X6n),1)),i.timestamp=k,i.isProcessing=!0,u.process(i),d.process(i),p.process(i),m.process(i),g.process(i),h.process(i),f.process(i),b.process(i),i.isProcessing=!1,n&&e&&(r=!1,t(y))},v=()=>{n=!0,r=!0,i.isProcessing||t(y)};return{schedule:Ste.reduce((x,k)=>{const C=l[k];return x[k]=(E,S=!1,I=!1)=>(n||v(),C.schedule(E,S,I)),x},{}),cancel:x=>{for(let k=0;k<Ste.length;k++)l[Ste[k]].cancel(x)},state:i,steps:l}}const{schedule:Nl,cancel:w1,state:pg,steps:Ike}=Tst(typeof requestAnimationFrame<"u"?requestAnimationFrame:ty,!0);let Ite;function J6n(){Ite=void 0}const mf={now:()=>(Ite===void 0&&mf.set(pg.isProcessing||rI.useManualTiming?pg.timestamp:performance.now()),Ite),set:t=>{Ite=t,queueMicrotask(J6n)}},Bst=t=>e=>typeof e=="string"&&e.startsWith(t),Dst=Bst("--"),e9n=Bst("var(--"),Tke=t=>e9n(t)?t9n.test(t.split("/*")[0].trim()):!1,t9n=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function Nst(t){return typeof t!="string"?!1:t.split("/*")[0].includes("var(--")}const zP={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},U7={...zP,transform:t=>cx(0,1,t)},Tte={...zP,default:1},q7=t=>Math.round(t*1e5)/1e5,Bke=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function n9n(t){return t==null}const r9n=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Dke=(t,e)=>n=>!!(typeof n=="string"&&r9n.test(n)&&n.startsWith(t)||e&&!n9n(n)&&Object.prototype.hasOwnProperty.call(n,e)),Rst=(t,e,n)=>r=>{if(typeof r!="string")return r;const[i,o,l,u]=r.match(Bke);return{[t]:parseFloat(i),[e]:parseFloat(o),[n]:parseFloat(l),alpha:u!==void 0?parseFloat(u):1}},a9n=t=>cx(0,255,t),Nke={...zP,transform:t=>Math.round(a9n(t))},RN={test:Dke("rgb","red"),parse:Rst("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+Nke.transform(t)+", "+Nke.transform(e)+", "+Nke.transform(n)+", "+q7(U7.transform(r))+")"};function i9n(t){let e="",n="",r="",i="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),r=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),r=t.substring(3,4),i=t.substring(4,5),e+=e,n+=n,r+=r,i+=i),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}const Rke={test:Dke("#"),parse:i9n,transform:RN.transform},G7=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),aI=G7("deg"),ux=G7("%"),Ja=G7("px"),o9n=G7("vh"),s9n=G7("vw"),Lst={...ux,parse:t=>ux.parse(t)/100,transform:t=>ux.transform(t*100)},UP={test:Dke("hsl","hue"),parse:Rst("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+ux.transform(q7(e))+", "+ux.transform(q7(n))+", "+q7(U7.transform(r))+")"},ep={test:t=>RN.test(t)||Rke.test(t)||UP.test(t),parse:t=>RN.test(t)?RN.parse(t):UP.test(t)?UP.parse(t):Rke.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?RN.transform(t):UP.transform(t),getAnimatableNone:t=>{const e=ep.parse(t);return e.alpha=0,ep.transform(e)}},l9n=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function c9n(t){return isNaN(t)&&typeof t=="string"&&(t.match(Bke)?.length||0)+(t.match(l9n)?.length||0)>0}const Mst="number",Pst="color",u9n="var",d9n="var(",Ost="${}",p9n=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function qP(t){const e=t.toString(),n=[],r={color:[],number:[],var:[]},i=[];let o=0;const u=e.replace(p9n,d=>(ep.test(d)?(r.color.push(o),i.push(Pst),n.push(ep.parse(d))):d.startsWith(d9n)?(r.var.push(o),i.push(u9n),n.push(d)):(r.number.push(o),i.push(Mst),n.push(parseFloat(d))),++o,Ost)).split(Ost);return{values:n,split:u,indexes:r,types:i}}function m9n(t){return qP(t).values}function Fst({split:t,types:e}){const n=t.length;return r=>{let i="";for(let o=0;o<n;o++)if(i+=t[o],r[o]!==void 0){const l=e[o];l===Mst?i+=q7(r[o]):l===Pst?i+=ep.transform(r[o]):i+=r[o]}return i}}function g9n(t){return Fst(qP(t))}const h9n=t=>typeof t=="number"?0:ep.test(t)?ep.getAnimatableNone(t):t,f9n=(t,e)=>typeof t=="number"?e?.trim().endsWith("/")?t:0:h9n(t);function A9n(t){const e=qP(t);return Fst(e)(e.values.map((r,i)=>f9n(r,e.split[i])))}const Hv={test:c9n,parse:m9n,createTransformer:g9n,getAnimatableNone:A9n};function Lke(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function b9n({hue:t,saturation:e,lightness:n,alpha:r}){t/=360,e/=100,n/=100;let i=0,o=0,l=0;if(!e)i=o=l=n;else{const u=n<.5?n*(1+e):n+e-n*e,d=2*n-u;i=Lke(d,u,t+1/3),o=Lke(d,u,t),l=Lke(d,u,t-1/3)}return{red:Math.round(i*255),green:Math.round(o*255),blue:Math.round(l*255),alpha:r}}function Bte(t,e){return n=>n>0?e:t}const Bc=(t,e,n)=>t+(e-t)*n,Mke=(t,e,n)=>{const r=t*t,i=n*(e*e-r)+r;return i<0?0:Math.sqrt(i)},y9n=[Rke,RN,UP],v9n=t=>y9n.find(e=>e.test(t));function Qst(t){const e=v9n(t);if($P(!!e,`'${t}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!e)return!1;let n=e.parse(t);return e===UP&&(n=b9n(n)),n}const $st=(t,e)=>{const n=Qst(t),r=Qst(e);if(!n||!r)return Bte(t,e);const i={...n};return o=>(i.red=Mke(n.red,r.red,o),i.green=Mke(n.green,r.green,o),i.blue=Mke(n.blue,r.blue,o),i.alpha=Bc(n.alpha,r.alpha,o),RN.transform(i))},Pke=new Set(["none","hidden"]);function _9n(t,e){return Pke.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function w9n(t,e){return n=>Bc(t,e,n)}function Oke(t){return typeof t=="number"?w9n:typeof t=="string"?Tke(t)?Bte:ep.test(t)?$st:E9n:Array.isArray(t)?jst:typeof t=="object"?ep.test(t)?$st:x9n:Bte}function jst(t,e){const n=[...t],r=n.length,i=t.map((o,l)=>Oke(o)(o,e[l]));return o=>{for(let l=0;l<r;l++)n[l]=i[l](o);return n}}function x9n(t,e){const n={...t,...e},r={};for(const i in n)t[i]!==void 0&&e[i]!==void 0&&(r[i]=Oke(t[i])(t[i],e[i]));return i=>{for(const o in r)n[o]=r[o](i);return n}}function k9n(t,e){const n=[],r={color:0,var:0,number:0};for(let i=0;i<e.values.length;i++){const o=e.types[i],l=t.indexes[o][r[o]],u=t.values[l]??0;n[i]=u,r[o]++}return n}const E9n=(t,e)=>{const n=Hv.createTransformer(e),r=qP(t),i=qP(e);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?Pke.has(t)&&!i.values.length||Pke.has(e)&&!r.values.length?_9n(t,e):j7(jst(k9n(r,i),i.values),n):($P(!0,`Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),Bte(t,e))};function zst(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?Bc(t,e,n):Oke(t)(t,e)}const C9n=t=>{const e=({timestamp:n})=>t(n);return{start:(n=!0)=>Nl.update(e,n),stop:()=>w1(e),now:()=>pg.isProcessing?pg.timestamp:mf.now()}},Ust=(t,e,n=10)=>{let r="";const i=Math.max(Math.round(e/n),2);for(let o=0;o<i;o++)r+=Math.round(t(o/(i-1))*1e4)/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},Dte=2e4;function Fke(t){let e=0;const n=50;let r=t.next(e);for(;!r.done&&e<Dte;)e+=n,r=t.next(e);return e>=Dte?1/0:e}function qst(t,e=100,n){const r=n({...t,keyframes:[0,e]}),i=Math.min(Fke(r),Dte);return{type:"keyframes",ease:o=>r.next(i*o).value/e,duration:ny(i)}}const Ru={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function Qke(t,e){return t*Math.sqrt(1-e*e)}const S9n=12;function I9n(t,e,n){let r=n;for(let i=1;i<S9n;i++)r=r-t(r)/e(r);return r}const $ke=.001;function T9n({duration:t=Ru.duration,bounce:e=Ru.bounce,velocity:n=Ru.velocity,mass:r=Ru.mass}){let i,o;$P(t<=pf(Ru.maxDuration),"Spring duration must be 10 seconds or less","spring-duration-limit");let l=1-e;l=cx(Ru.minDamping,Ru.maxDamping,l),t=cx(Ru.minDuration,Ru.maxDuration,ny(t)),l<1?(i=p=>{const m=p*l,g=m*t,h=m-n,f=Qke(p,l),b=Math.exp(-g);return $ke-h/f*b},o=p=>{const g=p*l*t,h=g*n+n,f=Math.pow(l,2)*Math.pow(p,2)*t,b=Math.exp(-g),y=Qke(Math.pow(p,2),l);return(-i(p)+$ke>0?-1:1)*((h-f)*b)/y}):(i=p=>{const m=Math.exp(-p*t),g=(p-n)*t+1;return-$ke+m*g},o=p=>{const m=Math.exp(-p*t),g=(n-p)*(t*t);return m*g});const u=5/t,d=I9n(i,o,u);if(t=pf(t),isNaN(d))return{stiffness:Ru.stiffness,damping:Ru.damping,duration:t};{const p=Math.pow(d,2)*r;return{stiffness:p,damping:l*2*Math.sqrt(r*p),duration:t}}}const B9n=["duration","bounce"],D9n=["stiffness","damping","mass"];function Gst(t,e){return e.some(n=>t[n]!==void 0)}function N9n(t){let e={velocity:Ru.velocity,stiffness:Ru.stiffness,damping:Ru.damping,mass:Ru.mass,isResolvedFromDuration:!1,...t};if(!Gst(t,D9n)&&Gst(t,B9n))if(e.velocity=0,t.visualDuration){const n=t.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,o=2*cx(.05,1,1-(t.bounce||0))*Math.sqrt(i);e={...e,mass:Ru.mass,stiffness:i,damping:o}}else{const n=T9n({...t,velocity:0});e={...e,...n,mass:Ru.mass},e.isResolvedFromDuration=!0}return e}function H7(t=Ru.visualDuration,e=Ru.bounce){const n=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:r,restDelta:i}=n;const o=n.keyframes[0],l=n.keyframes[n.keyframes.length-1],u={done:!1,value:o},{stiffness:d,damping:p,mass:m,duration:g,velocity:h,isResolvedFromDuration:f}=N9n({...n,velocity:-ny(n.velocity||0)}),b=h||0,y=p/(2*Math.sqrt(d*m)),v=l-o,_=ny(Math.sqrt(d/m)),w=Math.abs(v)<5;r||(r=w?Ru.restSpeed.granular:Ru.restSpeed.default),i||(i=w?Ru.restDelta.granular:Ru.restDelta.default);let x,k,C,E,S,I;if(y<1)C=Qke(_,y),E=(b+y*_*v)/C,x=R=>{const L=Math.exp(-y*_*R);return l-L*(E*Math.sin(C*R)+v*Math.cos(C*R))},S=y*_*E+v*C,I=y*_*v-E*C,k=R=>Math.exp(-y*_*R)*(S*Math.sin(C*R)+I*Math.cos(C*R));else if(y===1){x=L=>l-Math.exp(-_*L)*(v+(b+_*v)*L);const R=b+_*v;k=L=>Math.exp(-_*L)*(_*R*L-b)}else{const R=_*Math.sqrt(y*y-1);x=D=>{const P=Math.exp(-y*_*D),O=Math.min(R*D,300);return l-P*((b+y*_*v)*Math.sinh(O)+R*v*Math.cosh(O))/R};const L=(b+y*_*v)/R,M=y*_*L-v*R,N=y*_*v-L*R;k=D=>{const P=Math.exp(-y*_*D),O=Math.min(R*D,300);return P*(M*Math.sinh(O)+N*Math.cosh(O))}}const B={calculatedDuration:f&&g||null,velocity:R=>pf(k(R)),next:R=>{if(!f&&y<1){const M=Math.exp(-y*_*R),N=Math.sin(C*R),D=Math.cos(C*R),P=l-M*(E*N+v*D),O=pf(M*(S*N+I*D));return u.done=Math.abs(O)<=r&&Math.abs(l-P)<=i,u.value=u.done?l:P,u}const L=x(R);if(f)u.done=R>=g;else{const M=pf(k(R));u.done=Math.abs(M)<=r&&Math.abs(l-L)<=i}return u.value=u.done?l:L,u},toString:()=>{const R=Math.min(Fke(B),Dte),L=Ust(M=>B.next(R*M).value,R,30);return R+"ms "+L},toTransition:()=>{}};return B}H7.applyToOptions=t=>{const e=qst(t,100,H7);return t.ease=e.ease,t.duration=pf(e.duration),t.type="keyframes",t};const R9n=5;function Hst(t,e,n){const r=Math.max(e-R9n,0);return mst(n-t(r),e-r)}function jke({keyframes:t,velocity:e=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:o=500,modifyTarget:l,min:u,max:d,restDelta:p=.5,restSpeed:m}){const g=t[0],h={done:!1,value:g},f=I=>u!==void 0&&I<u||d!==void 0&&I>d,b=I=>u===void 0?d:d===void 0||Math.abs(u-I)<Math.abs(d-I)?u:d;let y=n*e;const v=g+y,_=l===void 0?v:l(v);_!==v&&(y=_-g);const w=I=>-y*Math.exp(-I/r),x=I=>_+w(I),k=I=>{const B=w(I),R=x(I);h.done=Math.abs(B)<=p,h.value=h.done?_:R};let C,E;const S=I=>{f(h.value)&&(C=I,E=H7({keyframes:[h.value,b(h.value)],velocity:Hst(x,I,h.value),damping:i,stiffness:o,restDelta:p,restSpeed:m}))};return S(0),{calculatedDuration:null,next:I=>{let B=!1;return!E&&C===void 0&&(B=!0,k(I),S(I)),C!==void 0&&I>=C?E.next(I-C):(!B&&k(I),h)}}}function L9n(t,e,n){const r=[],i=n||rI.mix||zst,o=t.length-1;for(let l=0;l<o;l++){let u=i(t[l],t[l+1]);if(e){const d=Array.isArray(e)?e[l]||ty:e;u=j7(d,u)}r.push(u)}return r}function Wst(t,e,{clamp:n=!0,ease:r,mixer:i}={}){const o=t.length;if(Gv(o===e.length,"Both input and output ranges must be the same length","range-length"),o===1)return()=>e[0];if(o===2&&e[0]===e[1])return()=>e[1];const l=t[0]===t[1];t[0]>t[o-1]&&(t=[...t].reverse(),e=[...e].reverse());const u=L9n(e,r,i),d=u.length,p=m=>{if(l&&m<t[0])return e[0];let g=0;if(d>1)for(;g<t.length-2&&!(m<t[g+1]);g++);const h=jP(t[g],t[g+1],m);return u[g](h)};return n?m=>p(cx(t[0],t[o-1],m)):p}function Yst(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const i=jP(0,e,r);t.push(Bc(n,1,i))}}function Vst(t){const e=[0];return Yst(e,t.length-1),e}function M9n(t,e){return t.map(n=>n*e)}function P9n(t,e){return t.map(()=>e||xst).splice(0,t.length-1)}function GP({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const i=kst(r)?r.map(Ist):Ist(r),o={done:!1,value:e[0]},l=M9n(n&&n.length===e.length?n:Vst(e),t),u=Wst(l,e,{ease:Array.isArray(i)?i:P9n(e,i)});return{calculatedDuration:t,next:d=>(o.value=u(d),o.done=d>=t,o)}}const O9n=t=>t!==null;function Nte(t,{repeat:e,repeatType:n="loop"},r,i=1){const o=t.filter(O9n),u=i<0||e&&n!=="loop"&&e%2===1?0:o.length-1;return!u||r===void 0?o[u]:r}const F9n={decay:jke,inertia:jke,tween:GP,keyframes:GP,spring:H7};function Kst(t){typeof t.type=="string"&&(t.type=F9n[t.type])}class zke{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,n){return this.finished.then(e,n)}}const Q9n=t=>t/100;class W7 extends zke{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{const{motionValue:n}=this.options;n&&n.updatedAt!==mf.now()&&this.tick(mf.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){const{options:e}=this;Kst(e);const{type:n=GP,repeat:r=0,repeatDelay:i=0,repeatType:o,velocity:l=0}=e;let{keyframes:u}=e;const d=n||GP;process.env.NODE_ENV!=="production"&&d!==GP&&Gv(u.length<=2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${u}`,"spring-two-frames"),d!==GP&&typeof u[0]!="number"&&(this.mixKeyframes=j7(Q9n,zst(u[0],u[1])),u=[0,100]);const p=d({...e,keyframes:u});o==="mirror"&&(this.mirroredGenerator=d({...e,keyframes:[...u].reverse(),velocity:-l})),p.calculatedDuration===null&&(p.calculatedDuration=Fke(p));const{calculatedDuration:m}=p;this.calculatedDuration=m,this.resolvedDuration=m+i,this.totalDuration=this.resolvedDuration*(r+1)-i,this.generator=p}updateTime(e){const n=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(e,n=!1){const{generator:r,totalDuration:i,mixKeyframes:o,mirroredGenerator:l,resolvedDuration:u,calculatedDuration:d}=this;if(this.startTime===null)return r.next(0);const{delay:p=0,keyframes:m,repeat:g,repeatType:h,repeatDelay:f,type:b,onUpdate:y,finalKeyframe:v}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-i/this.speed,this.startTime)),n?this.currentTime=e:this.updateTime(e);const _=this.currentTime-p*(this.playbackSpeed>=0?1:-1),w=this.playbackSpeed>=0?_<0:_>i;this.currentTime=Math.max(_,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=i);let x=this.currentTime,k=r;if(g){const I=Math.min(this.currentTime,i)/u;let B=Math.floor(I),R=I%1;!R&&I>=1&&(R=1),R===1&&B--,B=Math.min(B,g+1),B%2&&(h==="reverse"?(R=1-R,f&&(R-=f/u)):h==="mirror"&&(k=l)),x=cx(0,1,R)*u}let C;w?(this.delayState.value=m[0],C=this.delayState):C=k.next(x),o&&!w&&(C.value=o(C.value));let{done:E}=C;!w&&d!==null&&(E=this.playbackSpeed>=0?this.currentTime>=i:this.currentTime<=0);const S=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&E);return S&&b!==jke&&(C.value=Nte(m,this.options,v,this.speed)),y&&y(C.value),S&&this.finish(),C}then(e,n){return this.finished.then(e,n)}get duration(){return ny(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+ny(e)}get time(){return ny(this.currentTime)}set time(e){e=pf(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=e,this.tick(e))}getGeneratorVelocity(){const e=this.currentTime;if(e<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(e);const n=this.generator.next(e).value;return Hst(r=>this.generator.next(r).value,e,n)}get speed(){return this.playbackSpeed}set speed(e){const n=this.playbackSpeed!==e;n&&this.driver&&this.updateTime(mf.now()),this.playbackSpeed=e,n&&this.driver&&(this.time=ny(this.currentTime))}play(){if(this.isStopped)return;const{driver:e=C9n,startTime:n}=this.options;this.driver||(this.driver=e(i=>this.tick(i))),this.options.onPlay?.();const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=n??r),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(mf.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),e.observe(this)}}function $9n(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}const LN=t=>t*180/Math.PI,Uke=t=>{const e=LN(Math.atan2(t[1],t[0]));return qke(e)},j9n={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:Uke,rotateZ:Uke,skewX:t=>LN(Math.atan(t[1])),skewY:t=>LN(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},qke=t=>(t=t%360,t<0&&(t+=360),t),Zst=Uke,Xst=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),Jst=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),z9n={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Xst,scaleY:Jst,scale:t=>(Xst(t)+Jst(t))/2,rotateX:t=>qke(LN(Math.atan2(t[6],t[5]))),rotateY:t=>qke(LN(Math.atan2(-t[2],t[0]))),rotateZ:Zst,rotate:Zst,skewX:t=>LN(Math.atan(t[4])),skewY:t=>LN(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function Gke(t){return t.includes("scale")?1:0}function Hke(t,e){if(!t||t==="none")return Gke(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,i;if(n)r=z9n,i=n;else{const u=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=j9n,i=u}if(!i)return Gke(e);const o=r[e],l=i[1].split(",").map(q9n);return typeof o=="function"?o(l):l[o]}const U9n=(t,e)=>{const{transform:n="none"}=getComputedStyle(t);return Hke(n,e)};function q9n(t){return parseFloat(t.trim())}const HP=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],WP=new Set(HP),elt=t=>t===zP||t===Ja,G9n=new Set(["x","y","z"]),H9n=HP.filter(t=>!G9n.has(t));function W9n(t){const e=[];return H9n.forEach(n=>{const r=t.getValue(n);r!==void 0&&(e.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),e}const iI={width:({x:t},{paddingLeft:e="0",paddingRight:n="0",boxSizing:r})=>{const i=t.max-t.min;return r==="border-box"?i:i-parseFloat(e)-parseFloat(n)},height:({y:t},{paddingTop:e="0",paddingBottom:n="0",boxSizing:r})=>{const i=t.max-t.min;return r==="border-box"?i:i-parseFloat(e)-parseFloat(n)},top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>Hke(e,"x"),y:(t,{transform:e})=>Hke(e,"y")};iI.translateX=iI.x,iI.translateY=iI.y;const MN=new Set;let Wke=!1,Yke=!1,Vke=!1;function tlt(){if(Yke){const t=Array.from(MN).filter(r=>r.needsMeasurement),e=new Set(t.map(r=>r.element)),n=new Map;e.forEach(r=>{const i=W9n(r);i.length&&(n.set(r,i),r.render())}),t.forEach(r=>r.measureInitialState()),e.forEach(r=>{r.render();const i=n.get(r);i&&i.forEach(([o,l])=>{r.getValue(o)?.set(l)})}),t.forEach(r=>r.measureEndState()),t.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}Yke=!1,Wke=!1,MN.forEach(t=>t.complete(Vke)),MN.clear()}function nlt(){MN.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Yke=!0)})}function Y9n(){Vke=!0,nlt(),tlt(),Vke=!1}class Kke{constructor(e,n,r,i,o,l=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=n,this.name=r,this.motionValue=i,this.element=o,this.isAsync=l}scheduleResolve(){this.state="scheduled",this.isAsync?(MN.add(this),Wke||(Wke=!0,Nl.read(nlt),Nl.resolveKeyframes(tlt))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:n,element:r,motionValue:i}=this;if(e[0]===null){const o=i?.get(),l=e[e.length-1];if(o!==void 0)e[0]=o;else if(r&&n){const u=r.readValue(n,l);u!=null&&(e[0]=u)}e[0]===void 0&&(e[0]=l),i&&o===void 0&&i.set(e[0])}$9n(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),MN.delete(this)}cancel(){this.state==="scheduled"&&(MN.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const V9n=t=>t.startsWith("--");function rlt(t,e,n){V9n(e)?t.style.setProperty(e,n):t.style[e]=n}const K9n={};function alt(t,e){const n=pst(t);return()=>K9n[e]??n()}const Z9n=alt(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),ilt=alt(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Y7=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,olt={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Y7([0,.65,.55,1]),circOut:Y7([.55,0,1,.45]),backIn:Y7([.31,.01,.66,-.59]),backOut:Y7([.33,1.53,.69,.99])};function slt(t,e){if(t)return typeof t=="function"?ilt()?Ust(t,e):"ease-out":Cst(t)?Y7(t):Array.isArray(t)?t.map(n=>slt(n,e)||olt.easeOut):olt[t]}function X9n(t,e,n,{delay:r=0,duration:i=300,repeat:o=0,repeatType:l="loop",ease:u="easeOut",times:d}={},p=void 0){const m={[e]:n};d&&(m.offset=d);const g=slt(u,i);Array.isArray(g)&&(m.easing=g);const h={delay:r,duration:i,easing:Array.isArray(g)?"linear":g,fill:"both",iterations:o+1,direction:l==="reverse"?"alternate":"normal"};return p&&(h.pseudoElement=p),t.animate(m,h)}function Zke(t){return typeof t=="function"&&"applyToOptions"in t}function J9n({type:t,...e}){return Zke(t)&&ilt()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class llt extends zke{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:n,name:r,keyframes:i,pseudoElement:o,allowFlatten:l=!1,finalKeyframe:u,onComplete:d}=e;this.isPseudoElement=!!o,this.allowFlatten=l,this.options=e,Gv(typeof e.type!="string",`Mini animate() doesn't support "type" as a string.`,"mini-spring");const p=J9n(e);this.animation=X9n(n,r,i,p,o),p.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!o){const m=Nte(i,this.options,u,this.speed);this.updateMotionValue&&this.updateMotionValue(m),rlt(n,r,m),this.animation.cancel()}d?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;e==="idle"||e==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){const e=this.options?.element;!this.isPseudoElement&&e?.isConnected&&this.animation.commitStyles?.()}get duration(){const e=this.animation.effect?.getComputedTiming?.().duration||0;return ny(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+ny(e)}get time(){return ny(Number(this.animation.currentTime)||0)}set time(e){const n=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=pf(e),n&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,rangeStart:n,rangeEnd:r,observe:i}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,e&&Z9n()?(this.animation.timeline=e,n&&(this.animation.rangeStart=n),r&&(this.animation.rangeEnd=r),ty):i(this)}}const clt={anticipate:vst,backInOut:yst,circInOut:wst};function eQn(t){return t in clt}function tQn(t){typeof t.ease=="string"&&eQn(t.ease)&&(t.ease=clt[t.ease])}const Xke=10;class nQn extends llt{constructor(e){tQn(e),Kst(e),super(e),e.startTime!==void 0&&e.autoplay!==!1&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:n,onUpdate:r,onComplete:i,element:o,...l}=this.options;if(!n)return;if(e!==void 0){n.set(e);return}const u=new W7({...l,autoplay:!1}),d=Math.max(Xke,mf.now()-this.startTime),p=cx(0,Xke,d-Xke),m=u.sample(d).value,{name:g}=this.options;o&&g&&rlt(o,g,m),n.setWithVelocity(u.sample(Math.max(0,d-p)).value,m,p),u.stop()}}const ult=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Hv.test(t)||t==="0")&&!t.startsWith("url("));function rQn(t){const e=t[0];if(t.length===1)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}function aQn(t,e,n,r){const i=t[0];if(i===null)return!1;if(e==="display"||e==="visibility")return!0;const o=t[t.length-1],l=ult(i,e),u=ult(o,e);return $P(l===u,`You are trying to animate ${e} from "${i}" to "${o}". "${l?o:i}" is not an animatable value.`,"value-not-animatable"),!l||!u?!1:rQn(t)||(n==="spring"||Zke(n))&&r}function Jke(t){t.duration=0,t.type="keyframes"}const dlt=new Set(["opacity","clipPath","filter","transform"]),iQn=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function oQn(t){for(let e=0;e<t.length;e++)if(typeof t[e]=="string"&&iQn.test(t[e]))return!0;return!1}const sQn=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),lQn=pst(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function cQn(t){const{motionValue:e,name:n,repeatDelay:r,repeatType:i,damping:o,type:l,keyframes:u}=t;if(!(e?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:p,transformTemplate:m}=e.owner.getProps();return lQn()&&n&&(dlt.has(n)||sQn.has(n)&&oQn(u))&&(n!=="transform"||!m)&&!p&&!r&&i!=="mirror"&&o!==0&&l!=="inertia"}const uQn=40;class dQn extends zke{constructor({autoplay:e=!0,delay:n=0,type:r="keyframes",repeat:i=0,repeatDelay:o=0,repeatType:l="loop",keyframes:u,name:d,motionValue:p,element:m,...g}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=mf.now();const h={autoplay:e,delay:n,type:r,repeat:i,repeatDelay:o,repeatType:l,name:d,motionValue:p,element:m,...g},f=m?.KeyframeResolver||Kke;this.keyframeResolver=new f(u,(b,y,v)=>this.onKeyframesResolved(b,y,h,!v),d,p,m),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,n,r,i){this.keyframeResolver=void 0;const{name:o,type:l,velocity:u,delay:d,isHandoff:p,onUpdate:m}=r;this.resolvedAt=mf.now();let g=!0;aQn(e,o,l,u)||(g=!1,(rI.instantAnimations||!d)&&m?.(Nte(e,r,n)),e[0]=e[e.length-1],Jke(r),r.repeat=0);const f={startTime:i?this.resolvedAt?this.resolvedAt-this.createdAt>uQn?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...r,keyframes:e},b=g&&!p&&cQn(f),y=f.motionValue?.owner?.current;let v;if(b)try{v=new nQn({...f,element:y})}catch{v=new W7(f)}else v=new W7(f);v.finished.then(()=>{this.notifyFinished()}).catch(ty),this.pendingTimeline&&(this.stopTimeline=v.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=v}get finished(){return this._animation?this.animation.finished:this._finished}then(e,n){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),Y9n()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}class pQn{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}get finished(){return Promise.all(this.animations.map(e=>e.finished))}getAll(e){return this.animations[0][e]}setAll(e,n){for(let r=0;r<this.animations.length;r++)this.animations[r][e]=n}attachTimeline(e){const n=this.animations.map(r=>r.attachTimeline(e));return()=>{n.forEach((r,i)=>{r&&r(),this.animations[i].stop()})}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get state(){return this.getAll("state")}get startTime(){return this.getAll("startTime")}get duration(){return plt(this.animations,"duration")}get iterationDuration(){return plt(this.animations,"iterationDuration")}runAll(e){this.animations.forEach(n=>n[e]())}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}function plt(t,e){let n=0;for(let r=0;r<t.length;r++){const i=t[r][e];i!==null&&i>n&&(n=i)}return n}class mQn extends pQn{then(e,n){return this.finished.finally(e).then(()=>{})}}function mlt(t,e,n,r=0,i=1){const o=Array.from(t).sort((p,m)=>p.sortNodePosition(m)).indexOf(e),l=t.size,u=(l-1)*r;return typeof n=="function"?n(o,l):i===1?o*r:u-o*r}const gQn=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function hQn(t){const e=gQn.exec(t);if(!e)return[,];const[,n,r,i]=e;return[`--${n??r}`,i]}const fQn=4;function glt(t,e,n=1){Gv(n<=fQn,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[r,i]=hQn(t);if(!r)return;const o=window.getComputedStyle(e).getPropertyValue(r);if(o){const l=o.trim();return cst(l)?parseFloat(l):l}return Tke(i)?glt(i,e,n+1):i}const AQn={type:"spring",stiffness:500,damping:25,restSpeed:10},bQn=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),yQn={type:"keyframes",duration:.8},vQn={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},_Qn=(t,{keyframes:e})=>e.length>2?yQn:WP.has(t)?t.startsWith("scale")?bQn(e[1]):AQn:vQn;function hlt(t,e){if(t?.inherit&&e){const{inherit:n,...r}=t;return{...e,...r}}return t}function eEe(t,e){const n=t?.[e]??t?.default??t;return n!==t?hlt(n,t):n}const wQn=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function xQn(t){for(const e in t)if(!wQn.has(e))return!0;return!1}const tEe=(t,e,n,r={},i,o)=>l=>{const u=eEe(r,t)||{},d=u.delay||r.delay||0;let{elapsed:p=0}=r;p=p-pf(d);const m={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...u,delay:-p,onUpdate:h=>{e.set(h),u.onUpdate&&u.onUpdate(h)},onComplete:()=>{l(),u.onComplete&&u.onComplete()},name:t,motionValue:e,element:o?void 0:i};xQn(u)||Object.assign(m,_Qn(t,m)),m.duration&&(m.duration=pf(m.duration)),m.repeatDelay&&(m.repeatDelay=pf(m.repeatDelay)),m.from!==void 0&&(m.keyframes[0]=m.from);let g=!1;if((m.type===!1||m.duration===0&&!m.repeatDelay)&&(Jke(m),m.delay===0&&(g=!0)),(rI.instantAnimations||rI.skipAnimations||i?.shouldSkipAnimations)&&(g=!0,Jke(m),m.delay=0),m.allowFlatten=!u.type&&!u.ease,g&&!o&&e.get()!==void 0){const h=Nte(m.keyframes,u);if(h!==void 0){Nl.update(()=>{m.onUpdate(h),m.onComplete()});return}}return u.isSync?new W7(m):new dQn(m)};function flt(t){const e=[{},{}];return t?.values.forEach((n,r)=>{e[0][r]=n.get(),e[1][r]=n.getVelocity()}),e}function nEe(t,e,n,r){if(typeof e=="function"){const[i,o]=flt(r);e=e(n!==void 0?n:t.custom,i,o)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[i,o]=flt(r);e=e(n!==void 0?n:t.custom,i,o)}return e}function PN(t,e,n){const r=t.getProps();return nEe(r,e,n!==void 0?n:r.custom,t)}const Alt=new Set(["width","height","top","left","right","bottom",...HP]),blt=30,kQn=t=>!isNaN(parseFloat(t)),V7={current:void 0};class EQn{constructor(e,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{const i=mf.now();if(this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const o of this.dependents)o.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=n.owner}setCurrent(e){this.current=e,this.updatedAt=mf.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=kQn(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return process.env.NODE_ENV!=="production"&&kke(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",e)}on(e,n){this.events[e]||(this.events[e]=new xke);const r=this.events[e].add(n);return e==="change"?()=>{r(),Nl.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,n){this.passiveEffect=e,this.stopPassiveEffect=n}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-r}jump(e,n=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return V7.current&&V7.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const e=mf.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>blt)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,blt);return mst(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(e){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=e(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function oI(t,e){return new EQn(t,e)}const rEe=t=>Array.isArray(t);function CQn(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,oI(n))}function SQn(t){return rEe(t)?t[t.length-1]||0:t}function IQn(t,e){const n=PN(t,e);let{transitionEnd:r={},transition:i={},...o}=n||{};o={...o,...r};for(const l in o){const u=SQn(o[l]);CQn(t,l,u)}}const Cd=t=>!!(t&&t.getVelocity);function TQn(t){return!!(Cd(t)&&t.add)}function aEe(t,e){const n=t.getValue("willChange");if(TQn(n))return n.add(e);if(!n&&rI.WillChange){const r=new rI.WillChange("auto");t.addValue("willChange",r),r.add(e)}}function iEe(t){return t.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}const ylt="data-"+iEe("framerAppearId");function vlt(t){return t.props[ylt]}function BQn({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,r}function oEe(t,e,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:o,transitionEnd:l,...u}=e;const d=t.getDefaultTransition();o=o?hlt(o,d):d;const p=o?.reduceMotion;r&&(o=r);const m=[],g=i&&t.animationState&&t.animationState.getState()[i];for(const h in u){const f=t.getValue(h,t.latestValues[h]??null),b=u[h];if(b===void 0||g&&BQn(g,h))continue;const y={delay:n,...eEe(o||{},h)},v=f.get();if(v!==void 0&&!f.isAnimating()&&!Array.isArray(b)&&b===v&&!y.velocity){Nl.update(()=>f.set(b));continue}let _=!1;if(window.MotionHandoffAnimation){const k=vlt(t);if(k){const C=window.MotionHandoffAnimation(k,h,Nl);C!==null&&(y.startTime=C,_=!0)}}aEe(t,h);const w=p??t.shouldReduceMotion;f.start(tEe(h,f,b,w&&Alt.has(h)?{type:!1}:y,t,_));const x=f.animation;x&&m.push(x)}if(l){const h=()=>Nl.update(()=>{l&&IQn(t,l)});m.length?Promise.all(m).then(h):h()}return m}function sEe(t,e,n={}){const r=PN(t,e,n.type==="exit"?t.presenceContext?.custom:void 0);let{transition:i=t.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(i=n.transitionOverride);const o=r?()=>Promise.all(oEe(t,r,n)):()=>Promise.resolve(),l=t.variantChildren&&t.variantChildren.size?(d=0)=>{const{delayChildren:p=0,staggerChildren:m,staggerDirection:g}=i;return DQn(t,e,d,p,m,g,n)}:()=>Promise.resolve(),{when:u}=i;if(u){const[d,p]=u==="beforeChildren"?[o,l]:[l,o];return d().then(()=>p())}else return Promise.all([o(),l(n.delay)])}function DQn(t,e,n=0,r=0,i=0,o=1,l){const u=[];for(const d of t.variantChildren)d.notify("AnimationStart",e),u.push(sEe(d,e,{...l,delay:n+(typeof r=="function"?0:r)+mlt(t.variantChildren,d,r,i,o)}).then(()=>d.notify("AnimationComplete",e)));return Promise.all(u)}function NQn(t,e,n={}){t.notify("AnimationStart",e);let r;if(Array.isArray(e)){const i=e.map(o=>sEe(t,o,n));r=Promise.all(i)}else if(typeof e=="string")r=sEe(t,e,n);else{const i=typeof e=="function"?PN(t,e,n.custom):e;r=Promise.all(oEe(t,i,n))}return r.then(()=>{t.notify("AnimationComplete",e)})}const RQn={test:t=>t==="auto",parse:t=>t},_lt=t=>e=>e.test(t),wlt=[zP,Ja,ux,aI,s9n,o9n,RQn],xlt=t=>wlt.find(_lt(t));function LQn(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||dst(t):!0}const MQn=new Set(["brightness","contrast","saturate","opacity"]);function PQn(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[r]=n.match(Bke)||[];if(!r)return t;const i=n.replace(r,"");let o=MQn.has(e)?1:0;return r!==n&&(o*=100),e+"("+o+i+")"}const OQn=/\b([a-z-]*)\(.*?\)/gu,lEe={...Hv,getAnimatableNone:t=>{const e=t.match(OQn);return e?e.map(PQn).join(" "):t}},cEe={...Hv,getAnimatableNone:t=>{const e=Hv.parse(t);return Hv.createTransformer(t)(e.map(r=>typeof r=="number"?0:typeof r=="object"?{...r,alpha:1}:r))}},klt={...zP,transform:Math.round},uEe={borderWidth:Ja,borderTopWidth:Ja,borderRightWidth:Ja,borderBottomWidth:Ja,borderLeftWidth:Ja,borderRadius:Ja,borderTopLeftRadius:Ja,borderTopRightRadius:Ja,borderBottomRightRadius:Ja,borderBottomLeftRadius:Ja,width:Ja,maxWidth:Ja,height:Ja,maxHeight:Ja,top:Ja,right:Ja,bottom:Ja,left:Ja,inset:Ja,insetBlock:Ja,insetBlockStart:Ja,insetBlockEnd:Ja,insetInline:Ja,insetInlineStart:Ja,insetInlineEnd:Ja,padding:Ja,paddingTop:Ja,paddingRight:Ja,paddingBottom:Ja,paddingLeft:Ja,paddingBlock:Ja,paddingBlockStart:Ja,paddingBlockEnd:Ja,paddingInline:Ja,paddingInlineStart:Ja,paddingInlineEnd:Ja,margin:Ja,marginTop:Ja,marginRight:Ja,marginBottom:Ja,marginLeft:Ja,marginBlock:Ja,marginBlockStart:Ja,marginBlockEnd:Ja,marginInline:Ja,marginInlineStart:Ja,marginInlineEnd:Ja,fontSize:Ja,backgroundPositionX:Ja,backgroundPositionY:Ja,...{rotate:aI,rotateX:aI,rotateY:aI,rotateZ:aI,scale:Tte,scaleX:Tte,scaleY:Tte,scaleZ:Tte,skew:aI,skewX:aI,skewY:aI,distance:Ja,translateX:Ja,translateY:Ja,translateZ:Ja,x:Ja,y:Ja,z:Ja,perspective:Ja,transformPerspective:Ja,opacity:U7,originX:Lst,originY:Lst,originZ:Ja},zIndex:klt,fillOpacity:U7,strokeOpacity:U7,numOctaves:klt},FQn={...uEe,color:ep,backgroundColor:ep,outlineColor:ep,fill:ep,stroke:ep,borderColor:ep,borderTopColor:ep,borderRightColor:ep,borderBottomColor:ep,borderLeftColor:ep,filter:lEe,WebkitFilter:lEe,mask:cEe,WebkitMask:cEe},Elt=t=>FQn[t],QQn=new Set([lEe,cEe]);function Clt(t,e){let n=Elt(t);return QQn.has(n)||(n=Hv),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const $Qn=new Set(["auto","none","0"]);function jQn(t,e,n){let r=0,i;for(;r<t.length&&!i;){const o=t[r];typeof o=="string"&&!$Qn.has(o)&&qP(o).values.length&&(i=t[r]),r++}if(i&&n)for(const o of e)t[o]=Clt(n,i)}class zQn extends Kke{constructor(e,n,r,i,o){super(e,n,r,i,o,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let m=0;m<e.length;m++){let g=e[m];if(typeof g=="string"&&(g=g.trim(),Tke(g))){const h=glt(g,n.current);h!==void 0&&(e[m]=h),m===e.length-1&&(this.finalKeyframe=g)}}if(this.resolveNoneKeyframes(),!Alt.has(r)||e.length!==2)return;const[i,o]=e,l=xlt(i),u=xlt(o),d=Nst(i),p=Nst(o);if(d!==p&&iI[r]){this.needsMeasurement=!0;return}if(l!==u)if(elt(l)&&elt(u))for(let m=0;m<e.length;m++){const g=e[m];typeof g=="string"&&(e[m]=parseFloat(g))}else iI[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:n}=this,r=[];for(let i=0;i<e.length;i++)(e[i]===null||LQn(e[i]))&&r.push(i);r.length&&jQn(e,r,n)}measureInitialState(){const{element:e,unresolvedKeyframes:n,name:r}=this;if(!e||!e.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=iI[r](e.measureViewportBox(),window.getComputedStyle(e.current)),n[0]=this.measuredOrigin;const i=n[n.length-1];i!==void 0&&e.getValue(r,i).jump(i,!1)}measureEndState(){const{element:e,name:n,unresolvedKeyframes:r}=this;if(!e||!e.current)return;const i=e.getValue(n);i&&i.jump(this.measuredOrigin,!1);const o=r.length-1,l=r[o];r[o]=iI[n](e.measureViewportBox(),window.getComputedStyle(e.current)),l!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=l),this.removedTransforms?.length&&this.removedTransforms.forEach(([u,d])=>{e.getValue(u).set(d)}),this.resolveNoneKeyframes()}}function Rte(t,e,n){if(t==null)return[];if(t instanceof EventTarget)return[t];if(typeof t=="string"){let r=document;e&&(r=e.current);const i=n?.[t]??r.querySelectorAll(t);return i?Array.from(i):[]}return Array.from(t).filter(r=>r!=null)}const Slt=(t,e)=>e&&typeof t=="number"?e.transform(t):t;function Lte(t){return ust(t)&&"offsetHeight"in t&&!("ownerSVGElement"in t)}const{schedule:dEe}=Tst(queueMicrotask,!1),Wv={x:!1,y:!1};function Ilt(){return Wv.x||Wv.y}function UQn(t){return t==="x"||t==="y"?Wv[t]?null:(Wv[t]=!0,()=>{Wv[t]=!1}):Wv.x||Wv.y?null:(Wv.x=Wv.y=!0,()=>{Wv.x=Wv.y=!1})}function Tlt(t,e){const n=Rte(t),r=new AbortController,i={passive:!0,...e,signal:r.signal};return[n,i,()=>r.abort()]}function qQn(t){return!(t.pointerType==="touch"||Ilt())}function GQn(t,e,n={}){const[r,i,o]=Tlt(t,n);return r.forEach(l=>{let u=!1,d=!1,p;const m=()=>{l.removeEventListener("pointerleave",b)},g=v=>{p&&(p(v),p=void 0),m()},h=v=>{u=!1,window.removeEventListener("pointerup",h),window.removeEventListener("pointercancel",h),d&&(d=!1,g(v))},f=()=>{u=!0,window.addEventListener("pointerup",h,i),window.addEventListener("pointercancel",h,i)},b=v=>{if(v.pointerType!=="touch"){if(u){d=!0;return}g(v)}},y=v=>{if(!qQn(v))return;d=!1;const _=e(l,v);typeof _=="function"&&(p=_,l.addEventListener("pointerleave",b,i))};l.addEventListener("pointerenter",y,i),l.addEventListener("pointerdown",f,i)}),o}const Blt=(t,e)=>e?t===e?!0:Blt(t,e.parentElement):!1,pEe=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,HQn=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function WQn(t){return HQn.has(t.tagName)||t.isContentEditable===!0}const YQn=new Set(["INPUT","SELECT","TEXTAREA"]);function VQn(t){return YQn.has(t.tagName)||t.isContentEditable===!0}const Mte=new WeakSet;function Dlt(t){return e=>{e.key==="Enter"&&t(e)}}function mEe(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const KQn=(t,e)=>{const n=t.currentTarget;if(!n)return;const r=Dlt(()=>{if(Mte.has(n))return;mEe(n,"down");const i=Dlt(()=>{mEe(n,"up")}),o=()=>mEe(n,"cancel");n.addEventListener("keyup",i,e),n.addEventListener("blur",o,e)});n.addEventListener("keydown",r,e),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),e)};function Nlt(t){return pEe(t)&&!Ilt()}const Rlt=new WeakSet;function ZQn(t,e,n={}){const[r,i,o]=Tlt(t,n),l=u=>{const d=u.currentTarget;if(!Nlt(u)||Rlt.has(u))return;Mte.add(d),n.stopPropagation&&Rlt.add(u);const p=e(d,u),m=(f,b)=>{window.removeEventListener("pointerup",g),window.removeEventListener("pointercancel",h),Mte.has(d)&&Mte.delete(d),Nlt(f)&&typeof p=="function"&&p(f,{success:b})},g=f=>{m(f,d===window||d===document||n.useGlobalTarget||Blt(d,f.target))},h=f=>{m(f,!1)};window.addEventListener("pointerup",g,i),window.addEventListener("pointercancel",h,i)};return r.forEach(u=>{(n.useGlobalTarget?window:u).addEventListener("pointerdown",l,i),Lte(u)&&(u.addEventListener("focus",p=>KQn(p,i)),!WQn(u)&&!u.hasAttribute("tabindex")&&(u.tabIndex=0))}),o}function Pte(t){return ust(t)&&"ownerSVGElement"in t}const Ote=new WeakMap;let Fte;const Llt=(t,e,n)=>(r,i)=>i&&i[0]?i[0][t+"Size"]:Pte(r)&&"getBBox"in r?r.getBBox()[e]:r[n],XQn=Llt("inline","width","offsetWidth"),JQn=Llt("block","height","offsetHeight");function e$n({target:t,borderBoxSize:e}){Ote.get(t)?.forEach(n=>{n(t,{get width(){return XQn(t,e)},get height(){return JQn(t,e)}})})}function t$n(t){t.forEach(e$n)}function n$n(){typeof ResizeObserver>"u"||(Fte=new ResizeObserver(t$n))}function r$n(t,e){Fte||n$n();const n=Rte(t);return n.forEach(r=>{let i=Ote.get(r);i||(i=new Set,Ote.set(r,i)),i.add(e),Fte?.observe(r)}),()=>{n.forEach(r=>{const i=Ote.get(r);i?.delete(e),i?.size||Fte?.unobserve(r)})}}const Qte=new Set;let YP;function a$n(){YP=()=>{const t={get width(){return window.innerWidth},get height(){return window.innerHeight}};Qte.forEach(e=>e(t))},window.addEventListener("resize",YP)}function i$n(t){return Qte.add(t),YP||a$n(),()=>{Qte.delete(t),!Qte.size&&typeof YP=="function"&&(window.removeEventListener("resize",YP),YP=void 0)}}function Mlt(t,e){return typeof t=="function"?i$n(t):r$n(t,e)}function Plt(t){return Pte(t)&&t.tagName==="svg"}function o$n(...t){const e=!Array.isArray(t[0]),n=e?0:-1,r=t[0+n],i=t[1+n],o=t[2+n],l=t[3+n],u=Wst(i,o,l);return e?u(r):u}function s$n(t,e,n={}){const r=t.get();let i=null,o=r,l;const u=typeof r=="string"?r.replace(/[\d.-]/g,""):void 0,d=()=>{i&&(i.stop(),i=null),t.animation=void 0},p=()=>{const g=Olt(t.get()),h=Olt(o);if(g===h){d();return}const f=i?i.getGeneratorVelocity():t.getVelocity();d(),i=new W7({keyframes:[g,h],velocity:f,type:"spring",restDelta:.001,restSpeed:.01,...n,onUpdate:l})},m=()=>{p(),t.animation=i??void 0,t.events.animationStart?.notify(),i?.then(()=>{t.animation=void 0,t.events.animationComplete?.notify()})};if(t.attach((g,h)=>{o=g,l=f=>h(gEe(f,u)),Nl.postRender(m)},d),Cd(e)){let g=n.skipInitialAnimation===!0;const h=e.on("change",b=>{g?(g=!1,t.jump(gEe(b,u),!1)):t.set(gEe(b,u))}),f=t.on("destroy",h);return()=>{h(),f()}}return d}function gEe(t,e){return e?t+e:t}function Olt(t){return typeof t=="number"?t:parseFloat(t)}const l$n=[...wlt,ep,Hv],c$n=t=>l$n.find(_lt(t)),Flt=()=>({translate:0,scale:1,origin:0,originPoint:0}),VP=()=>({x:Flt(),y:Flt()}),Qlt=()=>({min:0,max:0}),tp=()=>({x:Qlt(),y:Qlt()}),K7=new WeakMap;function $te(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function Z7(t){return typeof t=="string"||Array.isArray(t)}const hEe=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],fEe=["initial",...hEe];function jte(t){return $te(t.animate)||fEe.some(e=>Z7(t[e]))}function $lt(t){return!!(jte(t)||t.variants)}function u$n(t,e,n){for(const r in e){const i=e[r],o=n[r];if(Cd(i))t.addValue(r,i);else if(Cd(o))t.addValue(r,oI(i,{owner:t}));else if(o!==i)if(t.hasValue(r)){const l=t.getValue(r);l.liveStyle===!0?l.jump(i):l.hasAnimated||l.set(i)}else{const l=t.getStaticValue(r);t.addValue(r,oI(l!==void 0?l:i,{owner:t}))}}for(const r in n)e[r]===void 0&&t.removeValue(r);return e}const AEe={current:null},jlt={current:!1},d$n=typeof window<"u";function p$n(){if(jlt.current=!0,!!d$n)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>AEe.current=t.matches;t.addEventListener("change",e),e()}else AEe.current=!1}const zlt=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let zte={};function Ult(t){zte=t}function m$n(){return zte}class qlt{scrapeMotionValuesFromProps(e,n,r){return{}}constructor({parent:e,props:n,presenceContext:r,reducedMotionConfig:i,skipAnimations:o,blockInitialAnimation:l,visualState:u},d={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=Kke,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const f=mf.now();this.renderScheduledAt<f&&(this.renderScheduledAt=f,Nl.render(this.render,!1,!0))};const{latestValues:p,renderState:m}=u;this.latestValues=p,this.baseTarget={...p},this.initialValues=n.initial?{...p}:{},this.renderState=m,this.parent=e,this.props=n,this.presenceContext=r,this.depth=e?e.depth+1:0,this.reducedMotionConfig=i,this.skipAnimationsConfig=o,this.options=d,this.blockInitialAnimation=!!l,this.isControllingVariants=jte(n),this.isVariantNode=$lt(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:g,...h}=this.scrapeMotionValuesFromProps(n,{},this);for(const f in h){const b=h[f];p[f]!==void 0&&Cd(b)&&b.set(p[f])}}mount(e){if(this.hasBeenMounted)for(const n in this.initialValues)this.values.get(n)?.jump(this.initialValues[n]),this.latestValues[n]=this.initialValues[n];this.current=e,K7.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,r)=>this.bindToMotionValue(r,n)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(jlt.current||p$n(),this.shouldReduceMotion=AEe.current),process.env.NODE_ENV!=="production"&&kke(this.shouldReduceMotion!==!0,"You have Reduced Motion enabled on your device. Animations may not appear as expected.","reduced-motion-disabled"),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),w1(this.notifyUpdate),w1(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const n=this.features[e];n&&(n.unmount(),n.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,n){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),n.accelerate&&dlt.has(e)&&this.current instanceof HTMLElement){const{factory:l,keyframes:u,times:d,ease:p,duration:m}=n.accelerate,g=new llt({element:this.current,name:e,keyframes:u,times:d,ease:p,duration:pf(m)}),h=l(g);this.valueSubscriptions.set(e,()=>{h(),g.cancel()});return}const r=WP.has(e);r&&this.onBindTransform&&this.onBindTransform();const i=n.on("change",l=>{this.latestValues[e]=l,this.props.onUpdate&&Nl.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let o;typeof window<"u"&&window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,e,n)),this.valueSubscriptions.set(e,()=>{i(),o&&o(),n.owner&&n.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in zte){const n=zte[e];if(!n)continue;const{isEnabled:r,Feature:i}=n;if(!this.features[e]&&i&&r(this.props)&&(this.features[e]=new i(this)),this.features[e]){const o=this.features[e];o.isMounted?o.update():(o.mount(),o.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):tp()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,n){this.latestValues[e]=n}update(e,n){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;r<zlt.length;r++){const i=zlt[r];this.propEventSubscriptions[i]&&(this.propEventSubscriptions[i](),delete this.propEventSubscriptions[i]);const o="on"+i,l=e[o];l&&(this.propEventSubscriptions[i]=this.on(i,l))}this.prevMotionValues=u$n(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(e),()=>n.variantChildren.delete(e)}addValue(e,n){const r=this.values.get(e);n!==r&&(r&&this.removeValue(e),this.bindToMotionValue(e,n),this.values.set(e,n),this.latestValues[e]=n.get())}removeValue(e){this.values.delete(e);const n=this.valueSubscriptions.get(e);n&&(n(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,n){if(this.props.values&&this.props.values[e])return this.props.values[e];let r=this.values.get(e);return r===void 0&&n!==void 0&&(r=oI(n===null?void 0:n,{owner:this}),this.addValue(e,r)),r}readValue(e,n){let r=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return r!=null&&(typeof r=="string"&&(cst(r)||dst(r))?r=parseFloat(r):!c$n(r)&&Hv.test(n)&&(r=Clt(e,n)),this.setBaseTarget(e,Cd(r)?r.get():r)),Cd(r)?r.get():r}setBaseTarget(e,n){this.baseTarget[e]=n}getBaseTarget(e){const{initial:n}=this.props;let r;if(typeof n=="string"||typeof n=="object"){const o=nEe(this.props,n,this.presenceContext?.custom);o&&(r=o[e])}if(n&&r!==void 0)return r;const i=this.getBaseTargetFromProps(this.props,e);return i!==void 0&&!Cd(i)?i:this.initialValues[e]!==void 0&&r===void 0?void 0:this.baseTarget[e]}on(e,n){return this.events[e]||(this.events[e]=new xke),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}scheduleRenderMicrotask(){dEe.render(this.render)}}class Glt extends qlt{constructor(){super(...arguments),this.KeyframeResolver=zQn}sortInstanceNodePosition(e,n){return e.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(e,n){const r=e.style;return r?r[n]:void 0}removeValueFromRenderState(e,{vars:n,style:r}){delete n[e],delete r[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Cd(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}class sI{constructor(e){this.isMounted=!1,this.node=e}update(){}}function Hlt({top:t,left:e,right:n,bottom:r}){return{x:{min:e,max:n},y:{min:t,max:r}}}function g$n({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function h$n(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),r=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function bEe(t){return t===void 0||t===1}function yEe({scale:t,scaleX:e,scaleY:n}){return!bEe(t)||!bEe(e)||!bEe(n)}function ON(t){return yEe(t)||Wlt(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function Wlt(t){return Ylt(t.x)||Ylt(t.y)}function Ylt(t){return t&&t!=="0%"}function Ute(t,e,n){const r=t-n,i=e*r;return n+i}function Vlt(t,e,n,r,i){return i!==void 0&&(t=Ute(t,i,r)),Ute(t,n,r)+e}function vEe(t,e=0,n=1,r,i){t.min=Vlt(t.min,e,n,r,i),t.max=Vlt(t.max,e,n,r,i)}function Klt(t,{x:e,y:n}){vEe(t.x,e.translate,e.scale,e.originPoint),vEe(t.y,n.translate,n.scale,n.originPoint)}const Zlt=.999999999999,Xlt=1.0000000000001;function f$n(t,e,n,r=!1){const i=n.length;if(!i)return;e.x=e.y=1;let o,l;for(let u=0;u<i;u++){o=n[u],l=o.projectionDelta;const{visualElement:d}=o.options;d&&d.props.style&&d.props.style.display==="contents"||(r&&o.options.layoutScroll&&o.scroll&&o!==o.root&&(dx(t.x,-o.scroll.offset.x),dx(t.y,-o.scroll.offset.y)),l&&(e.x*=l.x.scale,e.y*=l.y.scale,Klt(t,l)),r&&ON(o.latestValues)&&qte(t,o.latestValues,o.layout?.layoutBox))}e.x<Xlt&&e.x>Zlt&&(e.x=1),e.y<Xlt&&e.y>Zlt&&(e.y=1)}function dx(t,e){t.min+=e,t.max+=e}function Jlt(t,e,n,r,i=.5){const o=Bc(t.min,t.max,i);vEe(t,e,n,o,r)}function ect(t,e){return typeof t=="string"?parseFloat(t)/100*(e.max-e.min):t}function qte(t,e,n){const r=n??t;Jlt(t.x,ect(e.x,r.x),e.scaleX,e.scale,e.originX),Jlt(t.y,ect(e.y,r.y),e.scaleY,e.scale,e.originY)}function tct(t,e){return Hlt(h$n(t.getBoundingClientRect(),e))}function A$n(t,e,n){const r=tct(t,n),{scroll:i}=e;return i&&(dx(r.x,i.offset.x),dx(r.y,i.offset.y)),r}const b$n={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},y$n=HP.length;function v$n(t,e,n){let r="",i=!0;for(let o=0;o<y$n;o++){const l=HP[o],u=t[l];if(u===void 0)continue;let d=!0;if(typeof u=="number")d=u===(l.startsWith("scale")?1:0);else{const p=parseFloat(u);d=l.startsWith("scale")?p===1:p===0}if(!d||n){const p=Slt(u,uEe[l]);if(!d){i=!1;const m=b$n[l]||l;r+=`${m}(${p}) `}n&&(e[l]=p)}}return r=r.trim(),n?r=n(e,i?"":r):i&&(r="none"),r}function _Ee(t,e,n){const{style:r,vars:i,transformOrigin:o}=t;let l=!1,u=!1;for(const d in e){const p=e[d];if(WP.has(d)){l=!0;continue}else if(Dst(d)){i[d]=p;continue}else{const m=Slt(p,uEe[d]);d.startsWith("origin")?(u=!0,o[d]=m):r[d]=m}}if(e.transform||(l||n?r.transform=v$n(e,t.transform,n):r.transform&&(r.transform="none")),u){const{originX:d="50%",originY:p="50%",originZ:m=0}=o;r.transformOrigin=`${d} ${p} ${m}`}}function nct(t,{style:e,vars:n},r,i){const o=t.style;let l;for(l in e)o[l]=e[l];i?.applyProjectionStyles(o,r);for(l in n)o.setProperty(l,n[l])}function rct(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const X7={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(Ja.test(t))t=parseFloat(t);else return t;const n=rct(t,e.target.x),r=rct(t,e.target.y);return`${n}% ${r}%`}},_$n={correct:(t,{treeScale:e,projectionDelta:n})=>{const r=t,i=Hv.parse(t);if(i.length>5)return r;const o=Hv.createTransformer(t),l=typeof i[0]!="number"?1:0,u=n.x.scale*e.x,d=n.y.scale*e.y;i[0+l]/=u,i[1+l]/=d;const p=Bc(u,d,.5);return typeof i[2+l]=="number"&&(i[2+l]/=p),typeof i[3+l]=="number"&&(i[3+l]/=p),o(i)}},wEe={borderRadius:{...X7,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:X7,borderTopRightRadius:X7,borderBottomLeftRadius:X7,borderBottomRightRadius:X7,boxShadow:_$n};function act(t,{layout:e,layoutId:n}){return WP.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!wEe[t]||t==="opacity")}function xEe(t,e,n){const r=t.style,i=e?.style,o={};if(!r)return o;for(const l in r)(Cd(r[l])||i&&Cd(i[l])||act(l,t)||n?.getValue(l)?.liveStyle!==void 0)&&(o[l]=r[l]);return o}function w$n(t){return window.getComputedStyle(t)}class ict extends Glt{constructor(){super(...arguments),this.type="html",this.renderInstance=nct}readValueFromInstance(e,n){if(WP.has(n))return this.projection?.isProjecting?Gke(n):U9n(e,n);{const r=w$n(e),i=(Dst(n)?r.getPropertyValue(n):r[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:n}){return tct(e,n)}build(e,n,r){_Ee(e,n,r.transformTemplate)}scrapeMotionValuesFromProps(e,n,r){return xEe(e,n,r)}}function x$n(t,e){return t in e}class k$n extends qlt{constructor(){super(...arguments),this.type="object"}readValueFromInstance(e,n){if(x$n(n,e)){const r=e[n];if(typeof r=="string"||typeof r=="number")return r}}getBaseTargetFromProps(){}removeValueFromRenderState(e,n){delete n.output[e]}measureInstanceViewportBox(){return tp()}build(e,n){Object.assign(e.output,n)}renderInstance(e,{output:n}){Object.assign(e,n)}sortInstanceNodePosition(){return 0}}const E$n={offset:"stroke-dashoffset",array:"stroke-dasharray"},C$n={offset:"strokeDashoffset",array:"strokeDasharray"};function S$n(t,e,n=1,r=0,i=!0){t.pathLength=1;const o=i?E$n:C$n;t[o.offset]=`${-r}`,t[o.array]=`${e} ${n}`}const I$n=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function oct(t,{attrX:e,attrY:n,attrScale:r,pathLength:i,pathSpacing:o=1,pathOffset:l=0,...u},d,p,m){if(_Ee(t,u,p),d){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:g,style:h}=t;g.transform&&(h.transform=g.transform,delete g.transform),(h.transform||g.transformOrigin)&&(h.transformOrigin=g.transformOrigin??"50% 50%",delete g.transformOrigin),h.transform&&(h.transformBox=m?.transformBox??"fill-box",delete g.transformBox);for(const f of I$n)g[f]!==void 0&&(h[f]=g[f],delete g[f]);e!==void 0&&(g.x=e),n!==void 0&&(g.y=n),r!==void 0&&(g.scale=r),i!==void 0&&S$n(g,i,o,l,!1)}const sct=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),lct=t=>typeof t=="string"&&t.toLowerCase()==="svg";function T$n(t,e,n,r){nct(t,e,void 0,r);for(const i in e.attrs)t.setAttribute(sct.has(i)?i:iEe(i),e.attrs[i])}function cct(t,e,n){const r=xEe(t,e,n);for(const i in t)if(Cd(t[i])||Cd(e[i])){const o=HP.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;r[o]=t[i]}return r}class uct extends Glt{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=tp}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(WP.has(n)){const r=Elt(n);return r&&r.default||0}return n=sct.has(n)?n:iEe(n),e.getAttribute(n)}scrapeMotionValuesFromProps(e,n,r){return cct(e,n,r)}build(e,n,r){oct(e,n,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(e,n,r,i){T$n(e,n,r,i)}mount(e){this.isSVGTag=lct(e.tagName),super.mount(e)}}const B$n=fEe.length;function dct(t){if(!t)return;if(!t.isControllingVariants){const n=t.parent?dct(t.parent)||{}:{};return t.props.initial!==void 0&&(n.initial=t.props.initial),n}const e={};for(let n=0;n<B$n;n++){const r=fEe[n],i=t.props[r];(Z7(i)||i===!1)&&(e[r]=i)}return e}function pct(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}const D$n=[...hEe].reverse(),N$n=hEe.length;function R$n(t){return e=>Promise.all(e.map(({animation:n,options:r})=>NQn(t,n,r)))}function L$n(t){let e=R$n(t),n=mct(),r=!0,i=!1;const o=p=>(m,g)=>{const h=PN(t,g,p==="exit"?t.presenceContext?.custom:void 0);if(h){const{transition:f,transitionEnd:b,...y}=h;m={...m,...y,...b}}return m};function l(p){e=p(t)}function u(p){const{props:m}=t,g=dct(t.parent)||{},h=[],f=new Set;let b={},y=1/0;for(let _=0;_<N$n;_++){const w=D$n[_],x=n[w],k=m[w]!==void 0?m[w]:g[w],C=Z7(k),E=w===p?x.isActive:null;E===!1&&(y=_);let S=k===g[w]&&k!==m[w]&&C;if(S&&(r||i)&&t.manuallyAnimateOnMount&&(S=!1),x.protectedKeys={...b},!x.isActive&&E===null||!k&&!x.prevProp||$te(k)||typeof k=="boolean")continue;if(w==="exit"&&x.isActive&&E!==!0){x.prevResolvedValues&&(b={...b,...x.prevResolvedValues});continue}const I=M$n(x.prevProp,k);let B=I||w===p&&x.isActive&&!S&&C||_>y&&C,R=!1;const L=Array.isArray(k)?k:[k];let M=L.reduce(o(w),{});E===!1&&(M={});const{prevResolvedValues:N={}}=x,D={...N,...M},P=$=>{B=!0,f.has($)&&(R=!0,f.delete($)),x.needsAnimating[$]=!0;const j=t.getValue($);j&&(j.liveStyle=!1)};for(const $ in D){const j=M[$],Q=N[$];if(b.hasOwnProperty($))continue;let z=!1;rEe(j)&&rEe(Q)?z=!pct(j,Q):z=j!==Q,z?j!=null?P($):f.add($):j!==void 0&&f.has($)?P($):x.protectedKeys[$]=!0}x.prevProp=k,x.prevResolvedValues=M,x.isActive&&(b={...b,...M}),(r||i)&&t.blockInitialAnimation&&(B=!1);const O=S&&I;B&&(!O||R)&&h.push(...L.map($=>{const j={type:w};if(typeof $=="string"&&(r||i)&&!O&&t.manuallyAnimateOnMount&&t.parent){const{parent:Q}=t,z=PN(Q,$);if(Q.enteringChildren&&z){const{delayChildren:U}=z.transition||{};j.delay=mlt(Q.enteringChildren,t,U)}}return{animation:$,options:j}}))}if(f.size){const _={};if(typeof m.initial!="boolean"){const w=PN(t,Array.isArray(m.initial)?m.initial[0]:m.initial);w&&w.transition&&(_.transition=w.transition)}f.forEach(w=>{const x=t.getBaseTarget(w),k=t.getValue(w);k&&(k.liveStyle=!0),_[w]=x??null}),h.push({animation:_})}let v=!!h.length;return r&&(m.initial===!1||m.initial===m.animate)&&!t.manuallyAnimateOnMount&&(v=!1),r=!1,i=!1,v?e(h):Promise.resolve()}function d(p,m){if(n[p].isActive===m)return Promise.resolve();t.variantChildren?.forEach(h=>h.animationState?.setActive(p,m)),n[p].isActive=m;const g=u(p);for(const h in n)n[h].protectedKeys={};return g}return{animateChanges:u,setActive:d,setAnimateFunction:l,getState:()=>n,reset:()=>{n=mct(),i=!0}}}function M$n(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!pct(e,t):!1}function FN(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function mct(){return{animate:FN(!0),whileInView:FN(),whileHover:FN(),whileTap:FN(),whileDrag:FN(),whileFocus:FN(),exit:FN()}}function kEe(t,e){t.min=e.min,t.max=e.max}function Yv(t,e){kEe(t.x,e.x),kEe(t.y,e.y)}function gct(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}const hct=1e-4,P$n=1-hct,O$n=1+hct,fct=.01,F$n=0-fct,Q$n=0+fct;function gf(t){return t.max-t.min}function $$n(t,e,n){return Math.abs(t-e)<=n}function Act(t,e,n,r=.5){t.origin=r,t.originPoint=Bc(e.min,e.max,t.origin),t.scale=gf(n)/gf(e),t.translate=Bc(n.min,n.max,t.origin)-t.originPoint,(t.scale>=P$n&&t.scale<=O$n||isNaN(t.scale))&&(t.scale=1),(t.translate>=F$n&&t.translate<=Q$n||isNaN(t.translate))&&(t.translate=0)}function J7(t,e,n,r){Act(t.x,e.x,n.x,r?r.originX:void 0),Act(t.y,e.y,n.y,r?r.originY:void 0)}function bct(t,e,n,r=0){const i=r?Bc(n.min,n.max,r):n.min;t.min=i+e.min,t.max=t.min+gf(e)}function j$n(t,e,n,r){bct(t.x,e.x,n.x,r?.x),bct(t.y,e.y,n.y,r?.y)}function yct(t,e,n,r=0){const i=r?Bc(n.min,n.max,r):n.min;t.min=e.min-i,t.max=t.min+gf(e)}function Gte(t,e,n,r){yct(t.x,e.x,n.x,r?.x),yct(t.y,e.y,n.y,r?.y)}function vct(t,e,n,r,i){return t-=e,t=Ute(t,1/n,r),i!==void 0&&(t=Ute(t,1/i,r)),t}function z$n(t,e=0,n=1,r=.5,i,o=t,l=t){if(ux.test(e)&&(e=parseFloat(e),e=Bc(l.min,l.max,e/100)-l.min),typeof e!="number")return;let u=Bc(o.min,o.max,r);t===o&&(u-=e),t.min=vct(t.min,e,n,u,i),t.max=vct(t.max,e,n,u,i)}function _ct(t,e,[n,r,i],o,l){z$n(t,e[n],e[r],e[i],e.scale,o,l)}const U$n=["x","scaleX","originX"],q$n=["y","scaleY","originY"];function wct(t,e,n,r){_ct(t.x,e,U$n,n?n.x:void 0,r?r.x:void 0),_ct(t.y,e,q$n,n?n.y:void 0,r?r.y:void 0)}function xct(t){return t.translate===0&&t.scale===1}function kct(t){return xct(t.x)&&xct(t.y)}function Ect(t,e){return t.min===e.min&&t.max===e.max}function G$n(t,e){return Ect(t.x,e.x)&&Ect(t.y,e.y)}function Cct(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function Sct(t,e){return Cct(t.x,e.x)&&Cct(t.y,e.y)}function Ict(t){return gf(t.x)/gf(t.y)}function Tct(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}function px(t){return[t("x"),t("y")]}function H$n(t,e,n){let r="";const i=t.x.translate/e.x,o=t.y.translate/e.y,l=n?.z||0;if((i||o||l)&&(r=`translate3d(${i}px, ${o}px, ${l}px) `),(e.x!==1||e.y!==1)&&(r+=`scale(${1/e.x}, ${1/e.y}) `),n){const{transformPerspective:p,rotate:m,rotateX:g,rotateY:h,skewX:f,skewY:b}=n;p&&(r=`perspective(${p}px) ${r}`),m&&(r+=`rotate(${m}deg) `),g&&(r+=`rotateX(${g}deg) `),h&&(r+=`rotateY(${h}deg) `),f&&(r+=`skewX(${f}deg) `),b&&(r+=`skewY(${b}deg) `)}const u=t.x.scale*e.x,d=t.y.scale*e.y;return(u!==1||d!==1)&&(r+=`scale(${u}, ${d})`),r||"none"}const Bct=["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"],W$n=Bct.length,Dct=t=>typeof t=="string"?parseFloat(t):t,Nct=t=>typeof t=="number"||Ja.test(t);function Y$n(t,e,n,r,i,o){i?(t.opacity=Bc(0,n.opacity??1,V$n(r)),t.opacityExit=Bc(e.opacity??1,0,K$n(r))):o&&(t.opacity=Bc(e.opacity??1,n.opacity??1,r));for(let l=0;l<W$n;l++){const u=Bct[l];let d=Rct(e,u),p=Rct(n,u);if(d===void 0&&p===void 0)continue;d||(d=0),p||(p=0),d===0||p===0||Nct(d)===Nct(p)?(t[u]=Math.max(Bc(Dct(d),Dct(p),r),0),(ux.test(p)||ux.test(d))&&(t[u]+="%")):t[u]=p}(e.rotate||n.rotate)&&(t.rotate=Bc(e.rotate||0,n.rotate||0,r))}function Rct(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const V$n=Lct(0,.5,_st),K$n=Lct(.5,.95,ty);function Lct(t,e,n){return r=>r<t?0:r>e?1:n(jP(t,e,r))}function Mct(t,e,n){const r=Cd(t)?t:oI(t);return r.start(tEe("",r,e,n)),r.animation}function ez(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}const Z$n=(t,e)=>t.depth-e.depth;class X$n{constructor(){this.children=[],this.isDirty=!1}add(e){_ke(this.children,e),this.isDirty=!0}remove(e){QP(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(Z$n),this.isDirty=!1,this.children.forEach(e)}}function J$n(t,e){const n=mf.now(),r=({timestamp:i})=>{const o=i-n;o>=e&&(w1(r),t(o-e))};return Nl.setup(r,!0),()=>w1(r)}function Hte(t){return Cd(t)?t.get():t}class ejn{constructor(){this.members=[]}add(e){_ke(this.members,e);for(let n=this.members.length-1;n>=0;n--){const r=this.members[n];if(r===e||r===this.lead||r===this.prevLead)continue;const i=r.instance;(!i||i.isConnected===!1)&&!r.snapshot&&(QP(this.members,r),r.unmount())}e.scheduleRender()}remove(e){if(QP(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(e){for(let n=this.members.indexOf(e)-1;n>=0;n--){const r=this.members[n];if(r.isPresent!==!1&&r.instance?.isConnected!==!1)return this.promote(r),!0}return!1}promote(e,n){const r=this.lead;if(e!==r&&(this.prevLead=r,this.lead=e,e.show(),r)){r.updateSnapshot(),e.scheduleRender();const{layoutDependency:i}=r.options,{layoutDependency:o}=e.options;(i===void 0||i!==o)&&(e.resumeFrom=r,n&&(r.preserveOpacity=!0),r.snapshot&&(e.snapshot=r.snapshot,e.snapshot.latestValues=r.animationValues||r.latestValues),e.root?.isUpdating&&(e.isLayoutDirty=!0)),e.options.crossfade===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(e=>{e.options.onExitComplete?.(),e.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}}const Wte={hasAnimatedSinceResize:!0,hasEverUpdated:!1},EEe=["","X","Y","Z"],tjn=1e3;let njn=0;function CEe(t,e,n,r){const{latestValues:i}=e;i[t]&&(n[t]=i[t],e.setStaticValue(t,0),r&&(r[t]=0))}function Pct(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=vlt(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:i,layoutId:o}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",Nl,!(i||o))}const{parent:r}=t;r&&!r.hasCheckedOptimisedAppear&&Pct(r)}function Oct({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(l={},u=e?.()){this.id=njn++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(ijn),this.nodes.forEach(djn),this.nodes.forEach(pjn),this.nodes.forEach(ojn)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=l,this.root=u?u.root||u:this,this.path=u?[...u.path,u]:[],this.parent=u,this.depth=u?u.depth+1:0;for(let d=0;d<this.path.length;d++)this.path[d].shouldResetTransform=!0;this.root===this&&(this.nodes=new X$n)}addEventListener(l,u){return this.eventHandlers.has(l)||this.eventHandlers.set(l,new xke),this.eventHandlers.get(l).add(u)}notifyListeners(l,...u){const d=this.eventHandlers.get(l);d&&d.notify(...u)}hasListeners(l){return this.eventHandlers.has(l)}mount(l){if(this.instance)return;this.isSVG=Pte(l)&&!Plt(l),this.instance=l;const{layoutId:u,layout:d,visualElement:p}=this.options;if(p&&!p.current&&p.mount(l),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(d||u)&&(this.isLayoutDirty=!0),t){let m,g=0;const h=()=>this.root.updateBlockedByResize=!1;Nl.read(()=>{g=window.innerWidth}),t(l,()=>{const f=window.innerWidth;f!==g&&(g=f,this.root.updateBlockedByResize=!0,m&&m(),m=J$n(h,250),Wte.hasAnimatedSinceResize&&(Wte.hasAnimatedSinceResize=!1,this.nodes.forEach($ct)))})}u&&this.root.registerSharedNode(u,this),this.options.animate!==!1&&p&&(u||d)&&this.addEventListener("didUpdate",({delta:m,hasLayoutChanged:g,hasRelativeLayoutChanged:h,layout:f})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const b=this.options.transition||p.getDefaultTransition()||Ajn,{onLayoutAnimationStart:y,onLayoutAnimationComplete:v}=p.getProps(),_=!this.targetLayout||!Sct(this.targetLayout,f),w=!g&&h;if(this.options.layoutRoot||this.resumeFrom||w||g&&(_||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const x={...eEe(b,"layout"),onPlay:y,onComplete:v};(p.shouldReduceMotion||this.options.layoutRoot)&&(x.delay=0,x.type=!1),this.startAnimation(x),this.setAnimationOrigin(m,w)}else g||$ct(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=f})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const l=this.getStack();l&&l.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),w1(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(mjn),this.animationId++)}getTransformTemplate(){const{visualElement:l}=this.options;return l&&l.getProps().transformTemplate}willUpdate(l=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&Pct(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let m=0;m<this.path.length;m++){const g=this.path[m];g.shouldResetTransform=!0,(typeof g.latestValues.x=="string"||typeof g.latestValues.y=="string")&&(g.isLayoutDirty=!0),g.updateScroll("snapshot"),g.options.layoutRoot&&g.willUpdate(!1)}const{layoutId:u,layout:d}=this.options;if(u===void 0&&!d)return;const p=this.getTransformTemplate();this.prevTransformTemplateValue=p?p(this.latestValues,""):void 0,this.updateSnapshot(),l&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){const d=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),d&&this.nodes.forEach(ljn),this.nodes.forEach(Fct);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(Qct);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(cjn),this.nodes.forEach(ujn),this.nodes.forEach(rjn),this.nodes.forEach(ajn)):this.nodes.forEach(Qct),this.clearAllSnapshots();const u=mf.now();pg.delta=cx(0,1e3/60,u-pg.timestamp),pg.timestamp=u,pg.isProcessing=!0,Ike.update.process(pg),Ike.preRender.process(pg),Ike.render.process(pg),pg.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,dEe.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(sjn),this.sharedNodes.forEach(gjn)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Nl.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Nl.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!gf(this.snapshot.measuredBox.x)&&!gf(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let d=0;d<this.path.length;d++)this.path[d].updateScroll();const l=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||(this.layoutCorrected=tp()),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:u}=this.options;u&&u.notify("LayoutMeasure",this.layout.layoutBox,l?l.layoutBox:void 0)}updateScroll(l="measure"){let u=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===l&&(u=!1),u&&this.instance){const d=r(this.instance);this.scroll={animationId:this.root.animationId,phase:l,isRoot:d,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:d}}}resetTransform(){if(!i)return;const l=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,u=this.projectionDelta&&!kct(this.projectionDelta),d=this.getTransformTemplate(),p=d?d(this.latestValues,""):void 0,m=p!==this.prevTransformTemplateValue;l&&this.instance&&(u||ON(this.latestValues)||m)&&(i(this.instance,p),this.shouldResetTransform=!1,this.scheduleRender())}measure(l=!0){const u=this.measurePageBox();let d=this.removeElementScroll(u);return l&&(d=this.removeTransform(d)),bjn(d),{animationId:this.root.animationId,measuredBox:u,layoutBox:d,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:l}=this.options;if(!l)return tp();const u=l.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(yjn))){const{scroll:p}=this.root;p&&(dx(u.x,p.offset.x),dx(u.y,p.offset.y))}return u}removeElementScroll(l){const u=tp();if(Yv(u,l),this.scroll?.wasRoot)return u;for(let d=0;d<this.path.length;d++){const p=this.path[d],{scroll:m,options:g}=p;p!==this.root&&m&&g.layoutScroll&&(m.wasRoot&&Yv(u,l),dx(u.x,m.offset.x),dx(u.y,m.offset.y))}return u}applyTransform(l,u=!1,d){const p=d||tp();Yv(p,l);for(let m=0;m<this.path.length;m++){const g=this.path[m];!u&&g.options.layoutScroll&&g.scroll&&g!==g.root&&(dx(p.x,-g.scroll.offset.x),dx(p.y,-g.scroll.offset.y)),ON(g.latestValues)&&qte(p,g.latestValues,g.layout?.layoutBox)}return ON(this.latestValues)&&qte(p,this.latestValues,this.layout?.layoutBox),p}removeTransform(l){const u=tp();Yv(u,l);for(let d=0;d<this.path.length;d++){const p=this.path[d];if(!ON(p.latestValues))continue;let m;p.instance&&(yEe(p.latestValues)&&p.updateSnapshot(),m=tp(),Yv(m,p.measurePageBox())),wct(u,p.latestValues,p.snapshot?.layoutBox,m)}return ON(this.latestValues)&&wct(u,this.latestValues),u}setTargetDelta(l){this.targetDelta=l,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(l){this.options={...this.options,...l,crossfade:l.crossfade!==void 0?l.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==pg.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(l=!1){const u=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=u.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=u.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=u.isSharedProjectionDirty);const d=!!this.resumingFrom||this!==u;if(!(l||d&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:m,layoutId:g}=this.options;if(!this.layout||!(m||g))return;this.resolvedRelativeTargetAt=pg.timestamp;const h=this.getClosestProjectingParent();h&&this.linkedParentVersion!==h.layoutVersion&&!h.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&h&&h.layout?this.createRelativeTarget(h,this.layout.layoutBox,h.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=tp(),this.targetWithTransforms=tp()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),j$n(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):Yv(this.target,this.layout.layoutBox),Klt(this.target,this.targetDelta)):Yv(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&h&&!!h.resumingFrom==!!this.resumingFrom&&!h.options.layoutScroll&&h.target&&this.animationProgress!==1?this.createRelativeTarget(h,this.target,h.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||yEe(this.parent.latestValues)||Wlt(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(l,u,d){this.relativeParent=l,this.linkedParentVersion=l.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=tp(),this.relativeTargetOrigin=tp(),Gte(this.relativeTargetOrigin,u,d,this.options.layoutAnchor||void 0),Yv(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const l=this.getLead(),u=!!this.resumingFrom||this!==l;let d=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(d=!1),u&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(d=!1),this.resolvedRelativeTargetAt===pg.timestamp&&(d=!1),d)return;const{layout:p,layoutId:m}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(p||m))return;Yv(this.layoutCorrected,this.layout.layoutBox);const g=this.treeScale.x,h=this.treeScale.y;f$n(this.layoutCorrected,this.treeScale,this.path,u),l.layout&&!l.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(l.target=l.layout.layoutBox,l.targetWithTransforms=tp());const{target:f}=l;if(!f){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(gct(this.prevProjectionDelta.x,this.projectionDelta.x),gct(this.prevProjectionDelta.y,this.projectionDelta.y)),J7(this.projectionDelta,this.layoutCorrected,f,this.latestValues),(this.treeScale.x!==g||this.treeScale.y!==h||!Tct(this.projectionDelta.x,this.prevProjectionDelta.x)||!Tct(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",f))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(l=!0){if(this.options.visualElement?.scheduleRender(),l){const u=this.getStack();u&&u.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=VP(),this.projectionDelta=VP(),this.projectionDeltaWithTransform=VP()}setAnimationOrigin(l,u=!1){const d=this.snapshot,p=d?d.latestValues:{},m={...this.latestValues},g=VP();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!u;const h=tp(),f=d?d.source:void 0,b=this.layout?this.layout.source:void 0,y=f!==b,v=this.getStack(),_=!v||v.members.length<=1,w=!!(y&&!_&&this.options.crossfade===!0&&!this.path.some(fjn));this.animationProgress=0;let x;this.mixTargetDelta=k=>{const C=k/1e3;jct(g.x,l.x,C),jct(g.y,l.y,C),this.setTargetDelta(g),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Gte(h,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),hjn(this.relativeTarget,this.relativeTargetOrigin,h,C),x&&G$n(this.relativeTarget,x)&&(this.isProjectionDirty=!1),x||(x=tp()),Yv(x,this.relativeTarget)),y&&(this.animationValues=m,Y$n(m,p,this.latestValues,C,w,_)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=C},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(l){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(w1(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Nl.update(()=>{Wte.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=oI(0)),this.motionValue.jump(0,!1),this.currentAnimation=Mct(this.motionValue,[0,1e3],{...l,velocity:0,isSync:!0,onUpdate:u=>{this.mixTargetDelta(u),l.onUpdate&&l.onUpdate(u)},onStop:()=>{},onComplete:()=>{l.onComplete&&l.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const l=this.getStack();l&&l.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(tjn),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const l=this.getLead();let{targetWithTransforms:u,target:d,layout:p,latestValues:m}=l;if(!(!u||!d||!p)){if(this!==l&&this.layout&&p&&Hct(this.options.animationType,this.layout.layoutBox,p.layoutBox)){d=this.target||tp();const g=gf(this.layout.layoutBox.x);d.x.min=l.target.x.min,d.x.max=d.x.min+g;const h=gf(this.layout.layoutBox.y);d.y.min=l.target.y.min,d.y.max=d.y.min+h}Yv(u,d),qte(u,m),J7(this.projectionDeltaWithTransform,this.layoutCorrected,u,m)}}registerSharedNode(l,u){this.sharedNodes.has(l)||this.sharedNodes.set(l,new ejn),this.sharedNodes.get(l).add(u);const p=u.options.initialPromotionConfig;u.promote({transition:p?p.transition:void 0,preserveFollowOpacity:p&&p.shouldPreserveFollowOpacity?p.shouldPreserveFollowOpacity(u):void 0})}isLead(){const l=this.getStack();return l?l.lead===this:!0}getLead(){const{layoutId:l}=this.options;return l?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:l}=this.options;return l?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:l}=this.options;if(l)return this.root.sharedNodes.get(l)}promote({needsReset:l,transition:u,preserveFollowOpacity:d}={}){const p=this.getStack();p&&p.promote(this,d),l&&(this.projectionDelta=void 0,this.needsReset=!0),u&&this.setOptions({transition:u})}relegate(){const l=this.getStack();return l?l.relegate(this):!1}resetSkewAndRotation(){const{visualElement:l}=this.options;if(!l)return;let u=!1;const{latestValues:d}=l;if((d.z||d.rotate||d.rotateX||d.rotateY||d.rotateZ||d.skewX||d.skewY)&&(u=!0),!u)return;const p={};d.z&&CEe("z",l,p,this.animationValues);for(let m=0;m<EEe.length;m++)CEe(`rotate${EEe[m]}`,l,p,this.animationValues),CEe(`skew${EEe[m]}`,l,p,this.animationValues);l.render();for(const m in p)l.setStaticValue(m,p[m]),this.animationValues&&(this.animationValues[m]=p[m]);l.scheduleRender()}applyProjectionStyles(l,u){if(!this.instance||this.isSVG)return;if(!this.isVisible){l.visibility="hidden";return}const d=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,l.visibility="",l.opacity="",l.pointerEvents=Hte(u?.pointerEvents)||"",l.transform=d?d(this.latestValues,""):"none";return}const p=this.getLead();if(!this.projectionDelta||!this.layout||!p.target){this.options.layoutId&&(l.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,l.pointerEvents=Hte(u?.pointerEvents)||""),this.hasProjected&&!ON(this.latestValues)&&(l.transform=d?d({},""):"none",this.hasProjected=!1);return}l.visibility="";const m=p.animationValues||p.latestValues;this.applyTransformsToTarget();let g=H$n(this.projectionDeltaWithTransform,this.treeScale,m);d&&(g=d(m,g)),l.transform=g;const{x:h,y:f}=this.projectionDelta;l.transformOrigin=`${h.origin*100}% ${f.origin*100}% 0`,p.animationValues?l.opacity=p===this?m.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:m.opacityExit:l.opacity=p===this?m.opacity!==void 0?m.opacity:"":m.opacityExit!==void 0?m.opacityExit:0;for(const b in wEe){if(m[b]===void 0)continue;const{correct:y,applyTo:v,isCSSVariable:_}=wEe[b],w=g==="none"?m[b]:y(m[b],p);if(v){const x=v.length;for(let k=0;k<x;k++)l[v[k]]=w}else _?this.options.visualElement.renderState.vars[b]=w:l[b]=w}this.options.layoutId&&(l.pointerEvents=p===this?Hte(u?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(l=>l.currentAnimation?.stop()),this.root.nodes.forEach(Fct),this.root.sharedNodes.clear()}}}function rjn(t){t.updateLayout()}function ajn(t){const e=t.resumeFrom?.snapshot||t.snapshot;if(t.isLead()&&t.layout&&e&&t.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:r}=t.layout,{animationType:i}=t.options,o=e.source!==t.layout.source;if(i==="size")px(m=>{const g=o?e.measuredBox[m]:e.layoutBox[m],h=gf(g);g.min=n[m].min,g.max=g.min+h});else if(i==="x"||i==="y"){const m=i==="x"?"y":"x";kEe(o?e.measuredBox[m]:e.layoutBox[m],n[m])}else Hct(i,e.layoutBox,n)&&px(m=>{const g=o?e.measuredBox[m]:e.layoutBox[m],h=gf(n[m]);g.max=g.min+h,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[m].max=t.relativeTarget[m].min+h)});const l=VP();J7(l,n,e.layoutBox);const u=VP();o?J7(u,t.applyTransform(r,!0),e.measuredBox):J7(u,n,e.layoutBox);const d=!kct(l);let p=!1;if(!t.resumeFrom){const m=t.getClosestProjectingParent();if(m&&!m.resumeFrom){const{snapshot:g,layout:h}=m;if(g&&h){const f=t.options.layoutAnchor||void 0,b=tp();Gte(b,e.layoutBox,g.layoutBox,f);const y=tp();Gte(y,n,h.layoutBox,f),Sct(b,y)||(p=!0),m.options.layoutRoot&&(t.relativeTarget=y,t.relativeTargetOrigin=b,t.relativeParent=m)}}}t.notifyListeners("didUpdate",{layout:n,snapshot:e,delta:u,layoutDelta:l,hasLayoutChanged:d,hasRelativeLayoutChanged:p})}else if(t.isLead()){const{onExitComplete:n}=t.options;n&&n()}t.options.transition=void 0}function ijn(t){t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function ojn(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function sjn(t){t.clearSnapshot()}function Fct(t){t.clearMeasurements()}function ljn(t){t.isLayoutDirty=!0,t.updateLayout()}function Qct(t){t.isLayoutDirty=!1}function cjn(t){t.isAnimationBlocked&&t.layout&&!t.isLayoutDirty&&(t.snapshot=t.layout,t.isLayoutDirty=!0)}function ujn(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function $ct(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function djn(t){t.resolveTargetDelta()}function pjn(t){t.calcProjection()}function mjn(t){t.resetSkewAndRotation()}function gjn(t){t.removeLeadSnapshot()}function jct(t,e,n){t.translate=Bc(e.translate,0,n),t.scale=Bc(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function zct(t,e,n,r){t.min=Bc(e.min,n.min,r),t.max=Bc(e.max,n.max,r)}function hjn(t,e,n,r){zct(t.x,e.x,n.x,r),zct(t.y,e.y,n.y,r)}function fjn(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const Ajn={duration:.45,ease:[.4,0,.1,1]},Uct=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),qct=Uct("applewebkit/")&&!Uct("chrome/")?Math.round:ty;function Gct(t){t.min=qct(t.min),t.max=qct(t.max)}function bjn(t){Gct(t.x),Gct(t.y)}function Hct(t,e,n){return t==="position"||t==="preserve-aspect"&&!$$n(Ict(e),Ict(n),.2)}function yjn(t){return t!==t.root&&t.scroll?.wasRoot}const vjn=Oct({attachResizeListener:(t,e)=>ez(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),_jn=t=>!t.isLayoutDirty&&t.willUpdate(!1);function Wct(){const t=new Set,e=new WeakMap,n=()=>t.forEach(_jn);return{add:r=>{t.add(r),e.set(r,r.addEventListener("willUpdate",n))},remove:r=>{t.delete(r);const i=e.get(r);i&&(i(),e.delete(r)),n()},dirty:n}}const SEe={current:void 0},Yct=Oct({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!SEe.current){const t=new vjn({});t.mount(window),t.setOptions({layoutScroll:!0}),SEe.current=t}return SEe.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),tz=T.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});function Vct(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function wjn(...t){return e=>{let n=!1;const r=t.map(i=>{const o=Vct(i,e);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let i=0;i<r.length;i++){const o=r[i];typeof o=="function"?o():Vct(t[i],null)}}}}function xjn(...t){return ee.useCallback(wjn(...t),t)}class kjn extends ee.Component{getSnapshotBeforeUpdate(e){const n=this.props.childRef.current;if(Lte(n)&&e.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const r=n.offsetParent,i=Lte(r)&&r.offsetWidth||0,o=Lte(r)&&r.offsetHeight||0,l=getComputedStyle(n),u=this.props.sizeRef.current;u.height=parseFloat(l.height),u.width=parseFloat(l.width),u.top=n.offsetTop,u.left=n.offsetLeft,u.right=i-u.width-u.left,u.bottom=o-u.height-u.top}return null}componentDidUpdate(){}render(){return this.props.children}}function Ejn({children:t,isPresent:e,anchorX:n,anchorY:r,root:i,pop:o}){const l=T.useId(),u=T.useRef(null),d=T.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0}),{nonce:p}=T.useContext(tz),m=t.props?.ref??t?.ref,g=xjn(u,m);return T.useInsertionEffect(()=>{const{width:h,height:f,top:b,left:y,right:v,bottom:_}=d.current;if(e||o===!1||!u.current||!h||!f)return;const w=n==="left"?`left: ${y}`:`right: ${v}`,x=r==="bottom"?`bottom: ${_}`:`top: ${b}`;u.current.dataset.motionPopId=l;const k=document.createElement("style");p&&(k.nonce=p);const C=i??document.head;return C.appendChild(k),k.sheet&&k.sheet.insertRule(`
|
|
111
111
|
[data-motion-pop-id="${l}"] {
|
|
112
112
|
position: absolute !important;
|
|
@@ -682,7 +682,7 @@ WARNING: This link could potentially be dangerous`)){let n=window.open();if(n){t
|
|
|
682
682
|
${n?"bg-indigo-100 text-indigo-600 shadow-sm dark:bg-indigo-900/30 dark:text-indigo-400":r?"text-neutral-300 cursor-not-allowed dark:text-neutral-600":"text-neutral-500 hover:bg-neutral-100 hover:text-neutral-700 dark:text-neutral-400 dark:hover:bg-neutral-800/50 dark:hover:text-neutral-300"}`,title:r?`${e} (${u("app.activityBar.comingSoon")})`:e,children:[A.jsx(t,{className:l?"h-5 w-5":"h-6 w-6"}),l&&A.jsx("span",{className:"text-[10px] font-medium leading-none",children:e}),!l&&n&&A.jsx(Et.div,{layoutId:"activeIndicatorDesktop",className:"absolute -right-1 top-1/2 h-6 w-0.5 -translate-y-1/2 rounded-full bg-indigo-600 dark:bg-indigo-400",initial:!1,transition:{type:"spring",stiffness:300,damping:30}}),l&&n&&A.jsx(Et.div,{layoutId:"activeIndicatorMobile",className:"absolute left-1/2 top-0 h-0.5 w-8 -translate-x-1/2 rounded-full bg-indigo-600 dark:bg-indigo-400",initial:!1,transition:{type:"spring",stiffness:300,damping:30}}),r&&A.jsx("div",{className:"absolute inset-0 rounded-sm bg-neutral-100/50 dark:bg-neutral-800/50"})]})},NPt=["skills","memory","sandbox","runner","tasks"],GVr=({isOpen:t,onClose:e,activePanel:n,activities:r,onPanelChange:i})=>{const o=T.useCallback(l=>{i(l),e()},[i,e]);return A.jsxs(A.Fragment,{children:[t&&A.jsx("div",{className:"fixed inset-0",onClick:e}),A.jsx("div",{className:"absolute bottom-full left-0 right-0 overflow-hidden pointer-events-none",children:A.jsx($r,{children:t&&A.jsx(Et.div,{initial:{y:"100%"},animate:{y:0},exit:{y:"100%"},transition:{type:"spring",damping:26,stiffness:300},className:"pointer-events-auto bg-white/70 dark:bg-neutral-900/60 backdrop-blur-2xl border-t border-white/40 dark:border-neutral-700/40",children:A.jsx("div",{className:"grid grid-cols-4 gap-1 px-4 py-3",children:r.map(({panel:l,icon:u,label:d})=>{const p=n===l;return A.jsxs("button",{onClick:()=>o(l),className:`flex flex-col items-center gap-1.5 rounded-xl px-2 py-2.5 transition-colors
|
|
683
683
|
${p?"bg-indigo-50/80 text-indigo-600 dark:bg-indigo-900/30 dark:text-indigo-400":"text-neutral-600 active:bg-white/50 dark:text-neutral-300 dark:active:bg-neutral-700/50"}`,children:[A.jsx(u,{className:"h-5 w-5"}),A.jsx("span",{className:"text-[11px] font-medium",children:d})]},l)})})},"more-panel")})})]})},RPt=({activePanel:t,onPanelChange:e,className:n="",isMobile:r=!1})=>{const{t:i}=Cn(),[o,l]=T.useState(!1),u=[{panel:"chat",icon:qb,label:i("app.activityBar.chat"),disabled:!1},{panel:"knowledge",icon:Q1,label:i("app.activityBar.knowledge"),disabled:!1},{panel:"skills",icon:BI,label:i("app.activityBar.skills","Skills"),disabled:!1},{panel:"memory",icon:JSe,label:i("app.activityBar.memory"),disabled:!1},{panel:"sandbox",icon:OA,label:i("app.activityBar.sandbox","Sandbox"),disabled:!1},{panel:"runner",icon:VSe,label:i("app.activityBar.runner","Runner"),disabled:!1},{panel:"tasks",icon:F1,label:i("app.activityBar.tasks","Tasks"),disabled:!1},{panel:"marketplace",icon:Ks,label:i("app.activityBar.community"),disabled:!1}];if(!r)return A.jsx("div",{className:`flex w-16 flex-col items-center space-y-2 border-r bg-white py-4 dark:bg-black border-neutral-200 dark:border-neutral-800 ${n}`,children:u.map(g=>A.jsx(qVr,{icon:g.icon,label:g.label,panel:g.panel,isActive:t===g.panel,isDisabled:g.disabled,onClick:()=>e(g.panel)},g.panel))});const d=u.filter(g=>NPt.includes(g.panel)),p=[{panel:"chat",icon:qb,labelKey:"app.activityBar.chat"},{panel:"knowledge",icon:Q1,labelKey:"app.activityBar.knowledge"},{panel:"marketplace",icon:Ks,labelKey:"app.activityBar.community"},{panel:"account",icon:t2e,labelKey:"app.activityBar.account"}],m=NPt.includes(t);return A.jsxs("div",{className:"relative bg-white dark:bg-black",style:{paddingBottom:"env(safe-area-inset-bottom)"},children:[A.jsx(GVr,{isOpen:o,onClose:()=>l(!1),activePanel:t,activities:d,onPanelChange:e}),A.jsxs("div",{className:`relative z-10 flex w-full h-14 flex-row items-center justify-around px-2 bg-white/50 dark:bg-black/40 backdrop-blur-2xl ${n}`,children:[p.map(({panel:g,icon:h,labelKey:f})=>{const b=t===g;return A.jsxs(Et.button,{whileTap:{scale:.95},onClick:()=>e(g),className:`relative flex h-12 flex-1 flex-col items-center justify-center gap-1 rounded-sm py-1 transition-all duration-200
|
|
684
684
|
${b?"text-indigo-600 dark:text-indigo-400":"text-neutral-500 dark:text-neutral-400"}`,children:[A.jsx(h,{className:"h-5 w-5"}),A.jsx("span",{className:"text-[10px] font-medium leading-none",children:i(f)}),b&&A.jsx(Et.div,{layoutId:"activeIndicatorMobile",className:"absolute left-1/2 top-0 h-0.5 w-8 -translate-x-1/2 rounded-full bg-indigo-600 dark:bg-indigo-400",initial:!1,transition:{type:"spring",stiffness:300,damping:30}})]},g)}),A.jsxs(Et.button,{whileTap:{scale:.95},onClick:()=>l(g=>!g),className:`relative flex h-12 flex-1 flex-col items-center justify-center gap-1 rounded-sm py-1 transition-all duration-200
|
|
685
|
-
${m||o?"text-indigo-600 dark:text-indigo-400":"text-neutral-500 dark:text-neutral-400"}`,children:[A.jsx(Lor,{className:"h-5 w-5"}),A.jsx("span",{className:"text-[10px] font-medium leading-none",children:i("app.activityBar.more")}),m&&!o&&A.jsx(Et.div,{layoutId:"activeIndicatorMobile",className:"absolute left-1/2 top-0 h-0.5 w-8 -translate-x-1/2 rounded-full bg-indigo-600 dark:bg-indigo-400",initial:!1,transition:{type:"spring",stiffness:300,damping:30}})]})]})]})};function HVr({className:t="",variant:e="fullscreen",isMobile:n=!1,onDragStart:r,onDragMove:i,onDragEnd:o,showBackButton:l=!1,onBackClick:u,backButtonLabel:d="Chat"}){const p=Un(x=>x.closeXyzen),m=pO(),g=dBe(),[h,f]=T.useState(!1),[b,y]=T.useState(!1),v=e==="fullscreen",_=e==="side",w=v?"flex h-14 shrink-0 items-center justify-between px-4 bg-white/80 dark:bg-black/60 backdrop-blur-md supports-[backdrop-filter]:backdrop-blur-md shadow-sm ring-1 ring-neutral-200/60 dark:ring-neutral-800/60":`flex h-14 shrink-0 items-center justify-between border-b border-neutral-200 px-4 dark:border-neutral-800 ${n?"":"cursor-move select-none active:cursor-grabbing"}`;return A.jsxs(A.Fragment,{children:[A.jsxs("header",{className:`${w} ${t}`,onPointerDown:_?r:void 0,onPointerMove:_?i:void 0,onPointerUp:_?o:void 0,children:[A.jsxs("div",{className:"flex items-center gap-2",children:[l&&u?A.jsxs("button",{className:"rounded-sm flex items-center gap-2 p-1.5 text-neutral-500 hover:bg-neutral-100 dark:text-neutral-400 dark:hover:bg-neutral-800",title:"Back to Assistants",onClick:x=>{x.stopPropagation(),u()},onPointerDown:x=>x.stopPropagation(),children:[A.jsx(xx,{className:"size-4"}),A.jsx("h3",{className:"text-sm font-medium text-neutral-700 dark:text-neutral-300",children:d})]}):A.jsx("h1",{className:"text-base sm:text-lg font-semibold tracking-tight bg-linear-to-r from-indigo-600 via-purple-600 to-pink-600 dark:from-indigo-400 dark:via-purple-400 dark:to-pink-400 bg-clip-text text-transparent pointer-events-none",children:"Xyzen"}),_&&!n&&A.jsx("div",{className:"ml-2 pointer-events-none",children:A.jsx("kbd",{className:"rounded border border-neutral-300 bg-neutral-50 px-1.5 py-0.5 text-[10px] font-medium text-neutral-600 dark:border-neutral-700 dark:bg-neutral-800 dark:text-neutral-400",children:"⌘⇧X"})})]}),A.jsxs("div",{className:"flex items-center space-x-1",onPointerDown:_?x=>x.stopPropagation():void 0,children:[m&&A.jsxs(A.Fragment,{children:[A.jsxs("div",{className:"flex items-center gap-1.5 rounded-md border border-indigo-100 bg-linear-to-br from-indigo-50/80 to-white px-2 py-1 sm:gap-2 sm:px-3 sm:py-1.5 dark:border-indigo-500/20 dark:from-indigo-950/20 dark:to-neutral-900/20",children:[A.jsx("div",{className:"hidden sm:flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-indigo-100 text-indigo-600 dark:bg-indigo-500/20 dark:text-indigo-400",children:A.jsx(Ks,{className:"h-3.5 w-3.5"})}),A.jsxs("div",{className:"hidden sm:flex items-center gap-1 sm:gap-1.5",children:[A.jsx("span",{className:"hidden text-xs font-medium text-neutral-500 dark:text-neutral-400 sm:inline",children:"积分"}),A.jsx("span",{className:"sr-only",children:m.isLoading?"积分加载中":`积分 ${(m.points??"--").toString()}`}),A.jsx("span",{className:"hidden text-sm font-bold text-indigo-900 dark:text-indigo-100 sm:inline sm:text-base",children:m.isLoading?"...":m.points??"--"})]}),A.jsx("button",{type:"button",onClick:()=>f(!0),className:"rounded-full p-0.5 text-neutral-400 transition-colors hover:bg-white/50 hover:text-indigo-600 dark:text-neutral-500 dark:hover:bg-neutral-800 dark:hover:text-indigo-400",title:"积分说明",children:A.jsx(du,{className:"h-4 w-4"})})]}),g&&A.jsx("button",{type:"button",onClick:()=>y(!0),className:"relative rounded-md border border-amber-100 bg-linear-to-br from-amber-50/80 to-white px-2 py-1 text-sm font-medium text-amber-700 transition-colors hover:from-amber-100/80 hover:to-amber-50 sm:px-2.5 sm:py-1.5 dark:border-amber-500/20 dark:from-amber-950/20 dark:to-neutral-900/20 dark:text-amber-400 dark:hover:from-amber-900/30 dark:hover:to-amber-950/30",title:"每日签到",children:A.jsxs("div",{className:"flex items-center gap-1.5",children:[A.jsx(uR,{className:"h-4 w-4"}),A.jsx("span",{className:"sr-only",children:"签到"}),A.jsx("span",{className:"hidden sm:inline",children:"签到"})]})}),A.jsx("div",{className:"mx-2 hidden h-6 w-px bg-neutral-200 dark:bg-neutral-700 sm:block"})]}),A.jsx(UCt,{className:"ml-2"}),_&&!n&&A.jsx("button",{onClick:p,className:"rounded-sm p-1.5 text-neutral-500 hover:bg-neutral-100 hover:text-red-500 dark:text-neutral-400 dark:hover:bg-neutral-800 dark:hover:text-red-400",title:"Close",children:A.jsx(k6n,{className:"h-5 w-5"})})]})]}),m&&A.jsx(gO,{isOpen:h,onClose:()=>f(!1)}),g&&A.jsx(HDe,{isOpen:b,onClose:()=>y(!1)})]})}function WVr(t,e,n){return t.id===e?{allowed:!1,reason:"Root agent cannot be deleted"}:n.has(t.id)?{allowed:!1,reason:"This agent is published to Agent Market. Please unpublish it first, then delete it."}:{allowed:!0}}function YVr(t,e){const n=t.find(i=>i.id===e),r=t.filter(i=>i.id!==e);return n?[n,...r]:r}function LPt({onNavigateToChat:t,scrollRef:e,containerRef:n,onSortModeChange:r}={}){const{t:i}=Cn(),[o,l]=T.useState(!1),[u,d]=T.useState(!1),[p,m]=T.useState(null),[g,h]=T.useState(!1),[f,b]=T.useState(null),[y,v]=T.useState(null),[_,w]=T.useState(!1),{agents:x,rootAgentId:k,deleteAgent:C,updateAgentAvatar:E,reorderAgents:S,chatHistory:I,activateChannelForAgent:B,fetchMcpServers:R}=Un(us(te=>({agents:te.agents,rootAgentId:te.rootAgentId,deleteAgent:te.deleteAgent,updateAgentAvatar:te.updateAgentAvatar,reorderAgents:te.reorderAgents,chatHistory:te.chatHistory,activateChannelForAgent:te.activateChannelForAgent,fetchMcpServers:te.fetchMcpServers}))),L=eFr(),M=oNt(),N=T.useMemo(()=>YVr(x,k),[x,k]),{data:D}=pae(),P=T.useMemo(()=>{const te=new Set;for(const V of D??[])V.is_published&&te.add(V.agent_id);return te},[D]),O=T.useMemo(()=>sNt(I,M),[I,M]);T.useEffect(()=>{R().catch(console.error)},[R]);const F=async te=>{const V=te.id;v(V);try{await B(V),t?.()}finally{v(null)}},$=te=>{m(te),d(!0)},j=te=>{b(te),h(!0)},Q=T.useCallback(async te=>{try{await S(te)}catch(V){console.error("Failed to reorder agents:",V)}},[S]),z=T.useCallback(te=>{w(te),r?.(te)},[r]);nNt();const U=T.useRef(null),H=T.useCallback(te=>{U.current=te,e&&(e.current=te)},[e]);return A.jsx(Vie,{children:A.jsxs("div",{ref:n,className:"relative flex h-full flex-col bg-white dark:bg-neutral-950",children:[A.jsxs("div",{className:"shrink-0 flex items-center justify-between px-5 pb-2 pt-4",children:[A.jsx("h1",{className:"text-[17px] font-semibold text-neutral-900 dark:text-neutral-100",children:i("agents.agentTeam",{defaultValue:"Agent Team"})}),A.jsxs("div",{className:"flex items-center gap-1",children:[A.jsx("button",{onClick:()=>z(!_),className:`flex h-8 w-8 items-center justify-center rounded-full transition-colors ${_?"bg-neutral-900 text-white dark:bg-white dark:text-neutral-900":"text-neutral-500 active:bg-neutral-100 dark:text-neutral-400 dark:active:bg-neutral-800"}`,children:A.jsx(Par,{className:"h-[18px] w-[18px]"})}),A.jsx("button",{onClick:()=>l(!0),className:"flex h-8 w-8 items-center justify-center rounded-full text-neutral-500 active:bg-neutral-100 dark:text-neutral-400 dark:active:bg-neutral-800 transition-colors",children:A.jsx(Bd,{className:"h-5 w-5"})})]})]}),A.jsx("div",{ref:H,className:"custom-scrollbar flex-1 overflow-y-auto pb-4",style:{overscrollBehaviorY:"none"},children:A.jsx("div",{children:A.jsx(ENt,{agents:N,variant:"detailed",sortable:!0,sortModeControlled:_,rootAgentId:k,publishedAgentIds:P,lastConversationTimeByAgent:O,activeTopicCountByAgent:L,onAgentClick:F,loadingAgentId:y,onEdit:$,onDelete:j,onReorder:Q,onSortModeChange:z})})}),A.jsx(ZDt,{isOpen:o,onClose:()=>l(!1)}),p&&A.jsx(QNe,{isOpen:u,onClose:()=>{d(!1),m(null)},sessionId:"",agentId:p.id,agentName:p.name,agent:p,currentAvatar:p.avatar??void 0,onAvatarChange:te=>{m({...p,avatar:te}),E(p.id,te)},onGridSizeChange:()=>{},onDelete:WVr(p,k,P).allowed?()=>{C(p.id),d(!1),m(null)}:void 0},p.id),f&&A.jsx(x_,{isOpen:g,onClose:()=>h(!1),onConfirm:()=>{P.has(f.id)||(C(f.id),h(!1),b(null))},title:P.has(f.id)?i("agents.deleteBlockedTitle",{defaultValue:"Can't delete agent"}):i("agents.deleteTitle"),message:P.has(f.id)?i("agents.deleteBlockedMessage",{defaultValue:"This agent is published to Agent Market. Please unpublish it first, then delete it."}):i("agents.deleteConfirm",{name:f.name}),confirmLabel:P.has(f.id)?i("common.ok"):i("agents.deleteAgent"),cancelLabel:i("common.cancel"),destructive:!P.has(f.id)})]})})}const QLe=400;function VVr({backendUrl:t=NN,showAuthError:e=!1,onRetryAuth:n,authOverlay:r}){M3e();const{t:i}=Cn(),{isXyzenOpen:o,closeXyzen:l,activePanel:u,setActivePanel:d,setBackendUrl:p,activeChatChannel:m,setActiveChatChannel:g}=Un(us(j=>({isXyzenOpen:j.isXyzenOpen,closeXyzen:j.closeXyzen,activePanel:j.activePanel,setActivePanel:j.setActivePanel,setBackendUrl:j.setBackendUrl,activeChatChannel:j.activeChatChannel,setActiveChatChannel:j.setActiveChatChannel}))),[h,f]=T.useState(!1),[b,y]=T.useState({x:0,y:0}),[v,_]=T.useState({width:Uxe,height:600}),[w,x]=T.useState(!1),[k,C]=T.useState(!1),E=T.useRef(null);T.useEffect(()=>{if(f(!0),p(t),typeof window<"u"){const j=Math.min(window.innerHeight-100,700),Q=Uxe,z=window.innerWidth-Q-50,U=(window.innerHeight-j)/2;y({x:Math.max(20,z),y:Math.max(20,U)}),_({width:Q,height:j})}},[t,p]),T.useEffect(()=>{const j=Q=>{(Q.metaKey||Q.ctrlKey)&&Q.shiftKey&&Q.key==="X"&&(Q.preventDefault(),o&&l())};return window.addEventListener("keydown",j),()=>window.removeEventListener("keydown",j)},[o,l]);const S=T.useRef({x:0,y:0}),I=T.useRef({x:0,y:0}),B=j=>{j.target.closest("button, [role='button']")||(x(!0),S.current={x:j.clientX,y:j.clientY},I.current={...b},j.currentTarget.setPointerCapture(j.pointerId))},R=j=>{if(!w)return;j.preventDefault();const Q=j.clientX-S.current.x,z=j.clientY-S.current.y;let U=I.current.x+Q,H=I.current.y+z;const te=window.innerWidth-v.width,V=window.innerHeight-v.height;U=Math.max(0,Math.min(U,te)),H=Math.max(0,Math.min(H,V)),y({x:U,y:H})},L=j=>{x(!1),j.currentTarget.releasePointerCapture(j.pointerId)},M=T.useRef({x:0,y:0}),N=T.useRef({width:0,height:0}),D=T.useRef({x:0,y:0}),P=(j,Q)=>{j.preventDefault(),j.stopPropagation(),C(!0),E.current=Q,M.current={x:j.clientX,y:j.clientY},N.current={...v},D.current={...b},j.target.setPointerCapture(j.pointerId)},O=j=>{if(!k||!E.current)return;j.preventDefault(),j.stopPropagation();const Q=j.clientX-M.current.x,z=j.clientY-M.current.y,U=N.current.width,H=N.current.height,te=D.current.x,V=D.current.y;let re=U,ie=H,X=te,W=V;const q=E.current;if(q.includes("e")&&(re=U+Q),q.includes("w")&&(re=U-Q,X=te+Q),q.includes("s")&&(ie=H+z),q.includes("n")&&(ie=H-z,W=V+z),re<zxe&&(re=zxe,q.includes("w")&&(X=te+(U-zxe))),ie<QLe&&(ie=QLe,q.includes("n")&&(W=V+(H-QLe))),X<0){const Y=0-X;X=0,re-=Y}if(W<0){const Y=0-W;W=0,ie-=Y}X+re>window.innerWidth&&(re=window.innerWidth-X),W+ie>window.innerHeight&&(ie=window.innerHeight-W),_({width:re,height:ie}),y({x:X,y:W})},F=j=>{C(!1),E.current=null,j.target.releasePointerCapture(j.pointerId)};if(!h)return null;const $={position:"fixed",left:b.x,top:b.y,width:v.width,height:v.height,zIndex:50,boxShadow:"0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)"};return A.jsxs(A.Fragment,{children:[A.jsxs("div",{className:"flex flex-col bg-white dark:bg-black overflow-visible rounded-sm",style:$,children:[A.jsxs(A.Fragment,{children:[A.jsx("div",{className:"absolute top-0 left-0 w-full h-1.5 cursor-ns-resize z-50 bg-transparent hover:bg-indigo-500/10 transition-colors",onPointerDown:j=>P(j,"n"),onPointerMove:O,onPointerUp:F}),A.jsx("div",{className:"absolute bottom-0 left-0 w-full h-1.5 cursor-ns-resize z-50 bg-transparent hover:bg-indigo-500/10 transition-colors",onPointerDown:j=>P(j,"s"),onPointerMove:O,onPointerUp:F}),A.jsx("div",{className:"absolute top-0 left-0 w-1.5 h-full cursor-ew-resize z-50 bg-transparent hover:bg-indigo-500/10 transition-colors",onPointerDown:j=>P(j,"w"),onPointerMove:O,onPointerUp:F}),A.jsx("div",{className:"absolute top-0 right-0 w-1.5 h-full cursor-ew-resize z-50 bg-transparent hover:bg-indigo-500/10 transition-colors",onPointerDown:j=>P(j,"e"),onPointerMove:O,onPointerUp:F}),A.jsx("div",{className:"absolute top-0 left-0 w-4 h-4 cursor-nwse-resize z-51 bg-transparent",onPointerDown:j=>P(j,"nw"),onPointerMove:O,onPointerUp:F}),A.jsx("div",{className:"absolute top-0 right-0 w-4 h-4 cursor-nesw-resize z-51 bg-transparent",onPointerDown:j=>P(j,"ne"),onPointerMove:O,onPointerUp:F}),A.jsx("div",{className:"absolute bottom-0 left-0 w-4 h-4 cursor-nesw-resize z-51 bg-transparent",onPointerDown:j=>P(j,"sw"),onPointerMove:O,onPointerUp:F}),A.jsx("div",{className:"absolute bottom-0 right-0 w-4 h-4 cursor-nwse-resize z-51 bg-transparent",onPointerDown:j=>P(j,"se"),onPointerMove:O,onPointerUp:F})]}),A.jsx(HVr,{variant:"side",isMobile:!1,onDragStart:B,onDragMove:R,onDragEnd:L,showBackButton:u==="chat"&&!!m,onBackClick:()=>{g(null)},backButtonLabel:i(m?"app.chat.chatLabel":"app.chat.assistantsTitle")}),A.jsxs("div",{className:"flex flex-1 overflow-hidden relative",children:[A.jsx(RPt,{activePanel:u,onPanelChange:d,isMobile:!1}),A.jsx("div",{className:"flex-1 flex flex-col h-full overflow-hidden bg-white dark:bg-neutral-950",children:r?A.jsx("div",{className:"flex-1 overflow-y-auto custom-scrollbar",children:r}):A.jsxs(A.Fragment,{children:[u==="chat"&&(m?A.jsxs("div",{className:"h-full flex",children:[A.jsx("div",{className:"flex-1 min-w-0 h-full bg-white dark:bg-black",children:A.jsx(g3e,{})}),A.jsx(JNe,{})]}):A.jsxs("div",{className:"h-full bg-white dark:bg-neutral-950 flex flex-col",children:[A.jsxs("div",{className:"sm:border-b border-neutral-200 p-4 dark:border-neutral-800 shrink-0",children:[A.jsx("h2",{className:"text-sm font-semibold text-neutral-900 dark:text-white",children:i("app.chat.assistantsTitle")}),A.jsx("p",{className:"mt-1 text-xs text-neutral-500 dark:text-neutral-400",children:i("app.chat.chooseAgentHint")})]}),A.jsx("div",{className:"flex-1 overflow-y-auto py-4",children:A.jsx(LPt,{})})]})),u==="knowledge"&&A.jsx(I3e,{compact:!0}),u==="skills"&&A.jsx("div",{className:"h-full bg-white dark:bg-neutral-950",children:A.jsx(L3e,{})}),u==="memory"&&A.jsx("div",{className:"h-full bg-white dark:bg-neutral-950",children:A.jsx(T3e,{})}),u==="marketplace"&&A.jsx("div",{className:"h-full bg-white dark:bg-neutral-950",children:A.jsx(S3e,{})}),u==="sandbox"&&A.jsx("div",{className:"h-full bg-white dark:bg-neutral-950",children:A.jsx(D3e,{})}),u==="runner"&&A.jsx("div",{className:"h-full bg-white dark:bg-neutral-950",children:A.jsx(B3e,{})}),u==="tasks"&&A.jsx("div",{className:"h-full bg-white dark:bg-neutral-950",children:A.jsx(R3e,{})}),e&&A.jsx("div",{className:"absolute inset-0 z-50 bg-background/80 backdrop-blur-sm flex items-center justify-center",children:A.jsx("div",{className:"w-full max-w-md px-4",children:A.jsx(OSe,{onRetry:n??(()=>{}),variant:"inline"})})})]})})]})]}),A.jsx(F3e,{}),A.jsx(FLe,{})]})}const KVr=Object.freeze(Object.defineProperty({__proto__:null,AppSide:VVr},Symbol.toStringTag,{value:"Module"}));function ZVr(){const{t}=Cn(),{user:e,logout:n}=Xg(),r=Un(I=>I.openSettingsModal),{backend:i}=EDe(),o=mO(),l=o?.subQuery.data,u=o?.usageQuery.data,d=pO(),m=dBe()?.query.data,h=NEt().data?.total_earned,f=Tc(),[b,y]=T.useState(!1),[v,_]=T.useState(!1),[w,x]=T.useState(!1),[k,C]=T.useState(!1),E=async()=>{if(!(b||m?.checked_in_today)){y(!0);try{await eC.checkIn(),await f.invalidateQueries({queryKey:["check-in"]}),await f.invalidateQueries({queryKey:["userWallet"]})}finally{y(!1)}}},S=I=>I<1024?`${I} B`:I<1024*1024?`${(I/1024).toFixed(1)} KB`:I<1024*1024*1024?`${(I/(1024*1024)).toFixed(1)} MB`:`${(I/(1024*1024*1024)).toFixed(2)} GB`;return A.jsxs("div",{className:"h-full overflow-y-auto custom-scrollbar bg-neutral-100 dark:bg-neutral-950",children:[A.jsxs("div",{className:"mx-auto max-w-lg px-4 py-6 space-y-6",children:[A.jsxs("div",{className:"flex items-center gap-4 rounded-xl bg-white p-4 dark:bg-neutral-900",children:[A.jsx("div",{className:"h-16 w-16 flex-shrink-0 overflow-hidden rounded-full bg-neutral-200 dark:bg-neutral-700",children:e?.avatar?A.jsx("img",{src:e.avatar,alt:e.username,className:"h-full w-full object-cover"}):A.jsx("div",{className:"flex h-full w-full items-center justify-center text-2xl font-bold text-neutral-400 dark:text-neutral-500",children:e?.username?.charAt(0)?.toUpperCase()??"?"})}),A.jsxs("div",{className:"min-w-0 flex-1",children:[A.jsx("h2",{className:"truncate text-lg font-semibold text-neutral-900 dark:text-neutral-100",children:e?.username??"—"}),l?.role&&A.jsx("span",{className:"mt-0.5 inline-block rounded-full bg-indigo-100 px-2.5 py-0.5 text-xs font-medium text-indigo-700 dark:bg-indigo-900/40 dark:text-indigo-300",children:l.role.display_name})]}),A.jsx(HDt,{})]}),A.jsxs("div",{className:"overflow-hidden rounded-xl bg-white dark:bg-neutral-900",children:[A.jsxs("div",{role:"button",tabIndex:0,onClick:()=>_(!0),onKeyDown:I=>{(I.key==="Enter"||I.key===" ")&&_(!0)},className:"flex w-full items-center gap-3 px-4 py-3 text-left active:bg-neutral-50 dark:active:bg-neutral-800 cursor-pointer",children:[A.jsx(uR,{className:"h-5 w-5 flex-shrink-0 text-orange-500"}),A.jsxs("div",{className:"min-w-0 flex-1",children:[A.jsx("p",{className:"text-sm text-neutral-900 dark:text-neutral-100",children:t("app.account.checkIn")}),A.jsx("p",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:m?t("app.account.streak",{days:m.consecutive_days}):"—"})]}),A.jsx("button",{onClick:I=>{I.stopPropagation(),E()},disabled:b||m?.checked_in_today,className:`rounded-full px-3 py-1 text-xs font-medium transition-colors ${m?.checked_in_today?"bg-neutral-100 text-neutral-400 dark:bg-neutral-800 dark:text-neutral-500":"bg-orange-500 text-white active:bg-orange-600"}`,children:b?"...":m?.checked_in_today?t("app.account.checkedIn"):t("app.account.checkInAction")})]}),A.jsx("div",{className:"ml-12 border-t border-neutral-100 dark:border-neutral-800"}),A.jsxs("button",{onClick:()=>x(!0),className:"flex w-full items-center gap-3 px-4 py-3 text-left active:bg-neutral-50 dark:active:bg-neutral-800",children:[A.jsx(Ks,{className:"h-5 w-5 flex-shrink-0 text-amber-500"}),A.jsxs("div",{className:"min-w-0 flex-1",children:[A.jsx("p",{className:"text-sm text-neutral-900 dark:text-neutral-100",children:t("app.account.credits")}),A.jsx("p",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:d?t("app.account.balance",{amount:(d.points??0).toLocaleString()}):"—"})]}),A.jsx(hg,{className:"h-4 w-4 flex-shrink-0 text-neutral-400 dark:text-neutral-500"})]}),A.jsx("div",{className:"ml-12 border-t border-neutral-100 dark:border-neutral-800"}),RA("developerReward")&&A.jsxs("button",{onClick:()=>C(!0),className:"flex w-full items-center gap-3 px-4 py-3 text-left active:bg-neutral-50 dark:active:bg-neutral-800",children:[A.jsx(vae,{className:"h-5 w-5 flex-shrink-0 text-purple-500"}),A.jsxs("div",{className:"min-w-0 flex-1",children:[A.jsx("p",{className:"text-sm text-neutral-900 dark:text-neutral-100",children:t("subscription.creator")}),A.jsx("p",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:h!=null?t("app.account.creatorEarnings",{amount:h.toLocaleString()}):"—"})]}),A.jsx(hg,{className:"h-4 w-4 flex-shrink-0 text-neutral-400 dark:text-neutral-500"})]})]}),u&&A.jsxs("div",{className:"overflow-hidden rounded-xl bg-white p-4 dark:bg-neutral-900 space-y-3",children:[A.jsx("h3",{className:"text-xs font-medium uppercase tracking-wide text-neutral-500 dark:text-neutral-400",children:t("app.account.usage")}),A.jsx(HG,{label:t("app.account.storage"),used:S(u.storage.used_bytes),limit:S(u.storage.limit_bytes),percent:u.storage.usage_percentage}),A.jsx(HG,{label:t("app.account.files"),used:String(u.files.used),limit:String(u.files.limit),percent:u.files.limit>0?u.files.used/u.files.limit*100:0}),A.jsx(HG,{label:t("app.account.parallelChats"),used:String(u.chats.used),limit:String(u.chats.limit),percent:u.chats.limit>0?u.chats.used/u.chats.limit*100:0}),u.sandboxes.limit>0&&A.jsx(HG,{label:t("subscription.sub.sandboxes"),used:String(u.sandboxes.used),limit:String(u.sandboxes.limit),percent:u.sandboxes.limit>0?u.sandboxes.used/u.sandboxes.limit*100:0}),u.scheduled_tasks&&u.scheduled_tasks.limit>0&&A.jsx(HG,{label:t("app.account.scheduledTasks"),used:String(u.scheduled_tasks.used),limit:String(u.scheduled_tasks.limit),percent:u.scheduled_tasks.limit>0?u.scheduled_tasks.used/u.scheduled_tasks.limit*100:0})]}),A.jsxs("div",{className:"overflow-hidden rounded-xl bg-white dark:bg-neutral-900",children:[A.jsx(ice,{icon:ch,label:t("app.account.settings"),onClick:()=>r()}),A.jsx(ice,{icon:N0t,label:t("app.account.redeem"),onClick:()=>r("redemption")}),A.jsx(ice,{icon:$1,label:t("app.account.region"),onClick:()=>r("region")}),A.jsx(ice,{icon:du,label:t("app.account.about"),onClick:()=>r("about"),isLast:!0})]}),A.jsx("div",{className:"overflow-hidden rounded-xl bg-white dark:bg-neutral-900",children:A.jsxs("button",{onClick:n,className:"flex w-full items-center justify-center py-3 text-sm font-medium text-red-600 active:bg-neutral-50 dark:text-red-400 dark:active:bg-neutral-800",children:[A.jsx(HSe,{className:"mr-2 h-5 w-5"}),t("app.authStatus.logout")]})}),A.jsx("p",{className:"pb-2 text-center text-xs text-neutral-400 dark:text-neutral-600",children:i.isLoaded?`${i.versionName} v${i.version}`:"Xyzen"})]}),A.jsx(HDe,{isOpen:v,onClose:()=>_(!1)}),A.jsx(gO,{isOpen:w,onClose:()=>x(!1)}),RA("developerReward")&&A.jsx(KTe,{isOpen:k,onClose:()=>C(!1)})]})}function ice({icon:t,label:e,onClick:n,isLast:r=!1}){return A.jsxs(A.Fragment,{children:[A.jsxs("button",{onClick:n,className:"flex w-full items-center gap-3 px-4 py-3 text-left active:bg-neutral-50 dark:active:bg-neutral-800",children:[A.jsx(t,{className:"h-5 w-5 flex-shrink-0 text-neutral-500 dark:text-neutral-400"}),A.jsx("span",{className:"flex-1 text-sm text-neutral-900 dark:text-neutral-100",children:e}),A.jsx(hg,{className:"h-4 w-4 flex-shrink-0 text-neutral-400 dark:text-neutral-500"})]}),!r&&A.jsx("div",{className:"ml-12 border-t border-neutral-100 dark:border-neutral-800"})]})}function HG({label:t,used:e,limit:n,percent:r}){const i=Math.min(100,Math.max(0,r));return A.jsxs("div",{children:[A.jsxs("div",{className:"flex items-center justify-between text-xs text-neutral-600 dark:text-neutral-400",children:[A.jsx("span",{children:t}),A.jsxs("span",{children:[e," / ",n]})]}),A.jsx("div",{className:"mt-1 h-1.5 w-full overflow-hidden rounded-full bg-neutral-100 dark:bg-neutral-800",children:A.jsx("div",{className:`h-full rounded-full transition-all ${i>90?"bg-red-500":i>70?"bg-amber-500":"bg-indigo-500"}`,style:{width:`${i}%`}})})]})}function XVr(){const t=new Date().getHours();return t<6?"night":t<12?"morning":t<18?"afternoon":"evening"}function JVr(t){const e=new Date,n=e.toLocaleDateString(t,{weekday:"long"}),r=String(e.getDate()).padStart(2,"0"),i=String(e.getMonth()+1).padStart(2,"0");return{weekday:n,dayNum:r,monthNum:i}}const eKr={free:lx,lite:lx,standard:vte,pro:bte,professional:bte,ultra:y1},TC=36,$Le=2.5,jLe=(TC-$Le)/2,oce=2*Math.PI*jLe;function tKr({daysLeft:t,totalDays:e,tierName:n,visible:r,onClick:i}){const o=t!==null&&e>0?Math.min(1,Math.max(.02,t/e)):0,l=oce*(1-o),u=eKr[n]??lx;return A.jsxs("button",{onClick:i,className:"relative flex items-center justify-center active:scale-95 transition-transform",style:{width:TC,height:TC},children:[A.jsxs("svg",{width:TC,height:TC,className:"-rotate-90",children:[A.jsx(Et.circle,{cx:TC/2,cy:TC/2,r:jLe,fill:"none",stroke:"currentColor",className:"text-neutral-300 dark:text-neutral-700",strokeWidth:$Le,initial:{opacity:0},animate:r?{opacity:1}:{opacity:0},transition:{duration:.4,delay:.3}}),t!==null&&A.jsx(Et.circle,{cx:TC/2,cy:TC/2,r:jLe,fill:"none",stroke:"currentColor",className:"text-neutral-800 dark:text-neutral-200",strokeWidth:$Le,strokeLinecap:"round",strokeDasharray:oce,initial:{strokeDashoffset:oce},animate:r?{strokeDashoffset:l}:{strokeDashoffset:oce},transition:{duration:1.2,delay:.6,ease:[.16,1,.3,1]}})]}),A.jsx(Et.span,{className:"absolute text-neutral-700 dark:text-neutral-300",initial:{opacity:0,scale:.5},animate:r?{opacity:1,scale:1}:{opacity:0,scale:.5},transition:{duration:.4,delay:.8},children:A.jsx(u,{className:"h-3.5 w-3.5"})})]})}const MPt=10,PPt=.05,nKr=2;function rKr({agents:t,rootAgentId:e,agentStats:n,yesterdaySummary:r,chatHistory:i,onAgentClick:o,onTopicClick:l,onActiveAgentChange:u}){const{t:d}=Cn(),[p,m]=T.useState(0),g=ry(0),[h,f]=T.useState(!1),[b,y]=T.useState(!1),v=T.useMemo(()=>{const k=t.find(E=>E.id===e),C=t.filter(E=>E.id!==e);return k?[k,...C]:C},[t,e]);T.useEffect(()=>{v[p]&&u(v[p])},[p,v,u]);const _=T.useCallback((k,C)=>{f(!1);const E=80;C.offset.x<-E&&p<v.length-1?m(S=>S+1):C.offset.x>E&&p>0&&m(S=>S-1),OEe(g,0,{type:"spring",stiffness:400,damping:30})},[p,v.length,g]),w=T.useCallback(k=>i.filter(C=>C.assistantTitle===t.find(E=>E.id===k)?.name).slice(0,3),[i,t]);if(v.length===0)return null;const x={type:"spring",stiffness:300,damping:30};return A.jsxs("div",{className:"relative flex w-full flex-1 flex-col",children:[A.jsx("p",{className:"mb-3 text-[11px] font-semibold uppercase tracking-[2px] text-neutral-400 dark:text-neutral-500",children:d("app.loft.agentStack")}),A.jsx("div",{className:"relative flex-1 min-h-0 overflow-hidden",children:v.map((k,C)=>{const E=C-p;if(E<0||E>nKr)return null;const S=E===0,I=v.length-E,B=n[k.id],R=r[k.id],L=w(k.id);return A.jsx(aKr,{agent:k,isActive:S,cardOffset:E,zIndex:I,dragX:g,dragging:h,setDragging:f,handleDragEnd:_,rootAgentId:e,stats:B,yesterday:R,recentTopics:L,topicsHidden:b,setTopicsHidden:y,onAgentClick:o,onTopicClick:l,spring:x,t:d},k.id)})}),v.length>1&&A.jsx("div",{className:"mt-3 flex justify-center gap-1.5",children:v.map((k,C)=>A.jsx(Et.div,{animate:{width:C===p?16:4},transition:x,className:`h-1 rounded-full ${C===p?"bg-neutral-800 dark:bg-neutral-200":"bg-neutral-300 dark:bg-neutral-600"}`},C))})]})}function aKr({agent:t,isActive:e,cardOffset:n,zIndex:r,dragX:i,dragging:o,setDragging:l,handleDragEnd:u,rootAgentId:d,stats:p,yesterday:m,recentTopics:g,topicsHidden:h,setTopicsHidden:f,onAgentClick:b,onTopicClick:y,spring:v,t:_}){const w=$b(i,[-200,0,200],[1,0,-1]),x=$b(w,E=>{const S=Math.max(0,Math.abs(E));return(n-S*Math.min(n,1))*MPt}),k=$b(w,E=>{const S=Math.max(0,Math.abs(E));return 1-(n-S*Math.min(n,1))*PPt}),C=$b(w,E=>{const S=Math.max(0,Math.abs(E));return 1-(n-S*Math.min(n,1))*.15});return A.jsx(Et.div,{className:"absolute inset-x-0 top-0 bottom-0",style:{zIndex:r,...e?{x:i}:{y:x,scale:k,opacity:C}},animate:e?{y:0,scale:1,opacity:1}:{y:n*MPt,scale:1-n*PPt,opacity:1-n*.15},transition:v,...e?{drag:"x",dragConstraints:{left:0,right:0},dragElastic:.6,onDragStart:()=>l(!0),onDragEnd:u}:{},onClick:()=>{o||b(t)},children:A.jsxs("div",{className:"relative flex h-full cursor-pointer flex-col overflow-hidden rounded-2xl bg-[#f9f7f0] p-5 shadow-sm shadow-black/[0.04] ring-1 ring-[#e8e4d8]/80 dark:bg-neutral-900 dark:shadow-black/20 dark:ring-neutral-800",style:{contain:"layout style paint",willChange:"transform"},children:[A.jsx("div",{className:"pointer-events-none absolute inset-0 dark:hidden",style:{backgroundImage:"radial-gradient(ellipse 80% 70% at 50% 45%, #f9f7f0 30%, transparent 100%), linear-gradient(to right, rgb(229 229 229 / 0.5) 1px, transparent 1px), linear-gradient(to bottom, rgb(229 229 229 / 0.5) 1px, transparent 1px)",backgroundSize:"100% 100%, 28px 28px, 28px 28px"}}),A.jsx("div",{className:"pointer-events-none absolute inset-0 hidden dark:block",style:{backgroundImage:"radial-gradient(ellipse 80% 70% at 50% 45%, rgb(23 23 23) 30%, transparent 100%), linear-gradient(to right, rgb(64 64 64 / 0.3) 1px, transparent 1px), linear-gradient(to bottom, rgb(64 64 64 / 0.3) 1px, transparent 1px)",backgroundSize:"100% 100%, 28px 28px, 28px 28px"}}),A.jsxs("div",{className:"relative flex flex-1 flex-col",children:[A.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[A.jsx("div",{className:"h-11 w-11 shrink-0 overflow-hidden rounded-xl bg-neutral-100 dark:bg-white/10",children:A.jsx("img",{src:t.avatar||`https://api.dicebear.com/7.x/avataaars/svg?seed=${t.id}`,alt:t.name,className:"h-full w-full object-cover"})}),A.jsxs("div",{className:"min-w-0 flex-1",children:[A.jsxs("div",{className:"flex items-center gap-2",children:[A.jsx("h3",{className:"truncate text-[16px] font-bold text-neutral-900 dark:text-white",children:t.name}),t.id===d&&A.jsx("span",{className:"shrink-0 rounded-sm bg-neutral-900/10 px-1.5 py-px text-[9px] font-semibold uppercase tracking-wider text-neutral-500 dark:bg-white/10 dark:text-neutral-400",children:"CEO"})]}),A.jsx("p",{className:"truncate text-[12px] text-neutral-500 dark:text-neutral-400",children:t.description||"Your AI assistant"})]})]}),A.jsxs("div",{className:"mb-3 flex items-center gap-4",children:[p&&A.jsxs(A.Fragment,{children:[A.jsxs("div",{className:"flex items-center gap-1.5",children:[A.jsx(qb,{className:"h-3.5 w-3.5 text-neutral-400 dark:text-neutral-500"}),A.jsx("span",{className:"text-xs font-semibold text-neutral-700 dark:text-neutral-300",children:p.message_count}),A.jsx("span",{className:"text-[10px] text-neutral-400 dark:text-neutral-500",children:"msgs"})]}),A.jsxs("div",{className:"flex items-center gap-1.5",children:[A.jsx(yf,{className:"h-3.5 w-3.5 text-neutral-400 dark:text-neutral-500"}),A.jsx("span",{className:"text-xs font-semibold text-neutral-700 dark:text-neutral-300",children:p.topic_count}),A.jsx("span",{className:"text-[10px] text-neutral-400 dark:text-neutral-500",children:"topics"})]})]}),A.jsx("button",{className:"ml-auto p-1 text-neutral-400 active:text-neutral-600 dark:text-neutral-500 dark:active:text-neutral-300 transition-colors",onClick:E=>{E.stopPropagation(),f(S=>!S)},children:h?A.jsx(ZSe,{className:"h-3.5 w-3.5"}):A.jsx(TI,{className:"h-3.5 w-3.5"})})]}),m&&m.message_count>0&&A.jsxs("div",{className:"mb-3 rounded-lg bg-neutral-100/60 px-3 py-2 dark:bg-white/[0.06]",children:[A.jsx("p",{className:"text-[11px] font-medium text-neutral-500 dark:text-neutral-400",children:_("agents.spatialNode.yesterdaySummary",{topicCount:m.topic_count,messageCount:m.message_count,defaultValue:`Yesterday: ${m.topic_count} topics, ${m.message_count} messages`})}),m.last_message_content&&A.jsxs("p",{className:"mt-1 truncate text-[11px] text-neutral-400 dark:text-neutral-500",children:["“",m.last_message_content,"”"]})]}),A.jsx("div",{className:"flex-1 space-y-1 overflow-hidden",children:g.length>0?g.map(E=>A.jsxs("button",{className:"flex w-full items-center justify-between rounded-lg bg-neutral-100/50 px-3 py-2 text-left transition-colors active:bg-neutral-200/60 dark:bg-white/[0.05] dark:active:bg-white/[0.12]",onClick:S=>{S.stopPropagation(),y(E.id)},children:[A.jsx("span",{className:"truncate text-[12px] text-neutral-700 dark:text-neutral-300",children:h?"***":E.title||"Untitled"}),A.jsx("span",{className:"shrink-0 text-[10px] text-neutral-400 dark:text-neutral-500",children:Cq(E.updatedAt)})]},E.id)):A.jsx("div",{className:"flex h-full items-center justify-center",children:A.jsx("p",{className:"text-[12px] text-neutral-400 dark:text-neutral-500",children:_("app.loft.noRecentChats")})})})]})]})})}const iKr={show:{transition:{staggerChildren:.08,delayChildren:.15}},hidden:{}},sce={hidden:{opacity:0,y:20},show:{opacity:1,y:0,transition:{duration:.55,ease:[.16,1,.3,1]}}},oKr={hidden:{opacity:0,x:-12},show:{opacity:1,x:0,transition:{duration:.5,ease:[.16,1,.3,1]}}},sKr=({visible:t,overlayRef:e,onDismiss:n,onNavigateToChat:r})=>{const{t:i,i18n:o}=Cn(),{agents:l,rootAgentId:u,activateChannelForAgent:d,activateChannel:p,createDefaultChannel:m,sendMessage:g,agentStats:h,yesterdaySummary:f,chatHistory:b}=Un(us(U=>({agents:U.agents,rootAgentId:U.rootAgentId,activateChannelForAgent:U.activateChannelForAgent,activateChannel:U.activateChannel,createDefaultChannel:U.createDefaultChannel,sendMessage:U.sendMessage,agentStats:U.agentStats,yesterdaySummary:U.yesterdaySummary,chatHistory:U.chatHistory}))),[y,v]=T.useState(null),_=y??l.find(U=>U.id===u)??null,w=XVr(),{weekday:x,dayNum:k,monthNum:C}=T.useMemo(()=>JVr(o.language==="zh"?"zh-CN":o.language==="ja"?"ja-JP":"en-US"),[o.language]),E=mO(),S=E?.subQuery?.data?.subscription,B=E?.subQuery?.data?.role?.name??"free",{daysLeft:R,totalDays:L}=T.useMemo(()=>{if(!S?.expires_at)return{daysLeft:null,totalDays:30};const U=new Date(S.expires_at).getTime()-Date.now();return U<=0?{daysLeft:0,totalDays:30}:{daysLeft:Math.ceil(U/(1e3*60*60*24)),totalDays:30}},[S?.expires_at]),[M,N]=T.useState(!1),{data:D}=YCt("active"),P=T.useMemo(()=>{if(!D||D.length===0)return 0;const U=new Date,H=new Date(U.getFullYear(),U.getMonth(),U.getDate());return D.filter(te=>te.schedule_type==="daily"||te.schedule_type==="cron"||te.schedule_type==="weekly"?!0:new Date(te.scheduled_at)>=H).length},[D]);T.useEffect(()=>{const U=e.current;if(U)if(t)U.style.pointerEvents="auto",requestAnimationFrame(()=>{U.style.transition="transform 0.4s cubic-bezier(0.32, 0.72, 0, 1)",U.style.transform="translateY(0)"});else{U.style.transition="transform 0.3s cubic-bezier(0.32, 0.72, 0, 1)",U.style.transform="translateY(-100%)";const H=()=>{U.removeEventListener("transitionend",H),U.style.pointerEvents="none"};U.addEventListener("transitionend",H),setTimeout(H,400)}},[t,e]);const[O,F]=T.useState(""),$=T.useCallback(async U=>{_&&(await m(_.id),g(U),r())},[_,m,g,r]),j=T.useCallback(async U=>{await d(U.id),r()},[d,r]),Q=T.useCallback(async U=>{await p(U),r()},[p,r]),z=T.useCallback(U=>{v(U)},[]);return A.jsxs("div",{ref:e,className:"absolute inset-0 z-40 will-change-transform",style:{transform:t?"translateY(0)":"translateY(-100%)",pointerEvents:t?"auto":"none"},children:[A.jsx("div",{className:"absolute inset-0 bg-gradient-to-b from-[#faf8f0] via-[#fcfbf7] via-60% to-white dark:from-[#131210] dark:via-[#171614] dark:via-60% dark:to-black"}),A.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-0 h-12 bg-gradient-to-b from-white/80 to-transparent dark:from-black/80"}),A.jsx("div",{className:"pointer-events-none absolute left-[-15%] top-[30%] h-[320px] w-[320px] rounded-full",style:{background:"radial-gradient(circle, rgb(163 163 163 / 0.3) 0%, transparent 70%)"}}),A.jsx("div",{className:"pointer-events-none absolute right-[-10%] top-[45%] h-[260px] w-[260px] rounded-full",style:{background:"radial-gradient(circle, rgb(212 212 212 / 0.25) 0%, transparent 70%)"}}),A.jsx("div",{className:"relative flex h-full flex-col px-6",children:A.jsxs(Et.div,{variants:iKr,initial:"hidden",animate:t?"show":"hidden",className:"flex flex-1 flex-col",children:[A.jsxs(Et.div,{variants:sce,className:"flex items-center justify-between py-3",children:[A.jsx(Et.button,{onClick:n,whileTap:{scale:.9},className:"flex h-9 w-9 items-center justify-center rounded-full bg-white/50 active:bg-white/70 dark:bg-white/[0.08] dark:active:bg-white/[0.12]",children:A.jsx(P1,{className:"h-4 w-4 text-neutral-700 dark:text-neutral-300"})}),A.jsx(tKr,{daysLeft:R,totalDays:L,tierName:B,visible:t,onClick:()=>N(!0)})]}),A.jsxs(Et.div,{variants:sce,className:"mt-1",children:[A.jsxs(Et.div,{variants:oKr,className:"flex items-baseline gap-1.5",children:[A.jsx("span",{className:"text-[72px] font-extrabold leading-none tracking-tighter text-neutral-900 dark:text-neutral-100",children:k}),A.jsxs("span",{className:"text-[28px] font-light leading-none tracking-tight text-neutral-400/60 dark:text-neutral-500/60",children:["/ ",C]}),A.jsx("span",{className:"text-[16px] font-light leading-none tracking-tight text-neutral-400/60 dark:text-neutral-500/60",children:x})]}),A.jsx("p",{className:"mt-2.5 text-[22px] font-bold leading-[1.15] tracking-tight text-neutral-700 dark:text-neutral-300",children:P>0?i("app.loft.tasksToday",{count:P}):i(`app.loft.timeGreeting.${w}`)})]}),A.jsx(Et.div,{variants:sce,className:"mt-4 mb-4 flex flex-1 flex-col overflow-hidden",children:A.jsx(rKr,{agents:l,rootAgentId:u,agentStats:h,yesterdaySummary:f,chatHistory:b,onAgentClick:j,onTopicClick:Q,onActiveAgentChange:z})}),A.jsxs(Et.form,{variants:sce,onSubmit:U=>{U.preventDefault();const H=O.trim();H&&(F(""),$(H))},className:"mb-6 flex items-center gap-2 rounded-2xl bg-white/90 px-4 py-3.5 shadow-lg shadow-neutral-400/15 supports-[backdrop-filter]:bg-white/80 backdrop-blur-md dark:bg-neutral-800/90 dark:shadow-black/20 dark:supports-[backdrop-filter]:bg-white/[0.08]",children:[A.jsx("input",{type:"text",value:O,onChange:U=>F(U.target.value),placeholder:i("app.loft.inputPlaceholder",{name:_?.name??"Agent"}),disabled:!_,className:"flex-1 bg-transparent text-[15px] text-neutral-800 placeholder:text-neutral-400 focus:outline-none dark:text-white dark:placeholder:text-neutral-500"}),A.jsx("button",{type:"submit",disabled:!_||!O.trim(),className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-neutral-900 text-white transition-all active:scale-90 disabled:opacity-15 dark:bg-white dark:text-neutral-900",children:A.jsx(Nar,{className:"h-4 w-4 stroke-[2.5]"})})]})]})}),A.jsx(gO,{isOpen:M,onClose:()=>N(!1)})]})},lKr=T.memo(sKr);function cKr({scrollRef:t,touchRef:e,enabled:n=!0,onPull:r,onProgress:i,onEnd:o}){const l=T.useRef(r);l.current=r;const u=T.useRef(i);u.current=i;const d=T.useRef(o);d.current=o;const p=T.useRef(n);p.current=n;const m=T.useRef(e);m.current=e,T.useEffect(()=>{const g=t.current;if(!g)return;const h=m.current?.current??g,f=800,b=2/3,y=1/3;let v=0,_=0,w=!1,x=!1,k=!1,C=!1,E=[0,0],S=[0,0];const I=L=>{if(!p.current)return;const M=L.touches[0];v=M.clientY,_=M.clientX,w=!1,x=!1,k=!1,E=[Date.now(),M.clientY],S=[Date.now(),M.clientY];const N=window.innerHeight;C=g.scrollTop<=0&&M.clientY<N*y,C&&(h.dataset.pullZone="")},B=L=>{if(!p.current)return;const M=L.touches[0],N=M.clientY-v,D=M.clientX-_;if(!x)if(Math.abs(D)>12||Math.abs(N)>12){if(x=!0,k=Math.abs(N)>Math.abs(D),!k){delete h.dataset.pullZone;return}}else return;if(k){if(g.scrollTop>0||N<=0||!C){w&&(w=!1,delete h.dataset.pulling,u.current?.(0));return}w=!0,h.dataset.pulling="",L.cancelable&&L.preventDefault(),E=S,S=[Date.now(),M.clientY],u.current?.(M.clientY)}},R=()=>{if(w){const L=(S[0]-E[0])/1e3,M=S[1]-E[1],N=L>0?M/L:0,D=window.innerHeight,P=S[1]>D*b||N>f;P&&l.current?.(),d.current?.(P)}w=!1,x=!1,k=!1,C=!1,delete h.dataset.pulling,delete h.dataset.pullZone};return h.addEventListener("touchstart",I,{passive:!0}),h.addEventListener("touchmove",B,{passive:!1}),h.addEventListener("touchend",R,{passive:!0}),h.addEventListener("touchcancel",R,{passive:!0}),()=>{h.removeEventListener("touchstart",I),h.removeEventListener("touchmove",B),h.removeEventListener("touchend",R),h.removeEventListener("touchcancel",R)}},[t])}function uKr(){const{activeChatChannel:t,mobileCeoOverlay:e,mobilePage:n}=Un(us(C=>({activeChatChannel:C.activeChatChannel,mobileCeoOverlay:C.mobileCeoOverlay,mobilePage:C.mobilePage}))),r=Un(C=>{const E=C.activeChatChannel;return E?C.channels[E]?.knowledge_set_id??null:null}),i=!!t,o=i&&!!r,l=o?3:i?2:1,u=T.useRef(!1),d=T.useRef(i),p=T.useRef(()=>{}),m=T.useRef(()=>{}),g=T.useRef(null),h=T.useRef(null),f=T.useRef(null),[b,y]=T.useState(!1),v=T.useCallback(()=>{const{setMobileCeoOverlay:C,activeChatChannel:E,rootAgentId:S,activateChannelForAgent:I}=Un.getState();C(!0),u.current=!1,!E&&S&&I(S)},[]),_=T.useCallback(()=>{const{setMobileCeoOverlay:C,setActiveChatChannel:E,activeChatChannel:S,mobilePage:I}=Un.getState();C(!1),I===0&&(S?E(null):u.current=!0)},[]),w=T.useCallback(()=>{const{setMobilePage:C}=Un.getState();u.current=!1,C(1),p.current(1)},[]),x=T.useCallback(C=>{const{setMobilePage:E,setActiveChatChannel:S,activeChatChannel:I,mobileCeoOverlay:B}=Un.getState();E(C),C===0&&I&&!B&&S(null),C>=1&&(u.current=!1)},[]);T.useEffect(()=>{const C=d.current;d.current=i,!i&&C?(m.current(0),Un.getState().setMobilePage(0)):i&&!C&&(u.current?(Un.getState().setActiveChatChannel(null),u.current=!1):Un.getState().mobileCeoOverlay||(p.current(1),Un.getState().setMobilePage(1)))},[i]);const k=T.useRef(!1);return T.useEffect(()=>{if(k.current)return;k.current=!0;const C=Math.min(n,l-1);C>0&&m.current(C)},[l]),cKr({scrollRef:h,touchRef:f,enabled:!e&&!b,onPull:v,onProgress:T.useCallback(C=>{const E=g.current;if(E)if(C>0){const S=window.innerHeight,I=C/S,B=I*(1-.2*I),R=S*B,L=S-R;E.style.transition="none",E.style.transform=`translateY(-${L}px)`,E.style.pointerEvents="none"}else E.style.transition="none",E.style.transform="translateY(-100%)",E.style.pointerEvents="none"},[]),onEnd:T.useCallback(C=>{const E=g.current;E&&(C?(E.style.transition="transform 0.35s cubic-bezier(0.25, 1, 0.5, 1)",E.style.transform="translateY(0)",E.style.pointerEvents="auto"):(E.style.transition="transform 0.35s cubic-bezier(0.32, 0.72, 0, 1)",E.style.transform="translateY(-100%)"))},[])}),{overlay:e,pageCount:l,hasChannel:i,hasCapsule:o,overlayRef:g,agentScrollRef:h,agentContainerRef:f,goToPageRef:p,setPageImmediateRef:m,onSnap:x,showOverlay:v,dismissOverlay:_,navigateToChat:w,setAgentSortMode:y}}function OPt({pageCount:t,onSnap:e,velocityThreshold:n=.3,distanceThreshold:r=.25,rubberBand:i=.25,edgeWidth:o=24,bypassEdge:l=!1}){const u=T.useRef(null),d=T.useRef(null),p=T.useRef(0),[m,g]=T.useState(0),h=T.useRef(e);h.current=e;const f=T.useRef({active:!1,startX:0,startY:0,startTime:0,locked:!1,horizontal:!1}),b=T.useRef(!1),y=T.useRef(0),v=T.useCallback(()=>u.current?.offsetWidth??window.innerWidth,[]),_=T.useCallback((I,B)=>{const R=d.current;R&&(b.current=B,R.style.transition=B?"transform 0.4s cubic-bezier(0.22, 1, 0.36, 1)":"none",R.style.transform=`translate3d(${I}px,0,0)`)},[]),w=T.useCallback((I,B=!0)=>{const R=Math.max(0,Math.min(t-1,I)),L=v();if(_(-R*L,!0),p.current=R,g(R),B){const M=++y.current,N=d.current;if(!N){h.current?.(R);return}let D=!1;const P=()=>{D||(D=!0,M===y.current&&h.current?.(R))},O=()=>{N.removeEventListener("transitionend",O),b.current=!1,P()};N.addEventListener("transitionend",O),setTimeout(()=>{N.removeEventListener("transitionend",O),b.current=!1,P()},500)}},[t,v,_]),x=T.useCallback(I=>{const B=Math.max(0,Math.min(t-1,I));p.current=B,g(B),_(-B*v(),!1)},[t,_,v]),k=T.useRef(w);k.current=w;const C=T.useRef(t);C.current=t;const E=T.useRef(l);E.current=l,T.useEffect(()=>{const I=u.current;if(!I)return;const B=M=>{const N=M.touches[0];if(!E.current){const D=N.clientX<=o,P=N.clientX>=(u.current?.offsetWidth??window.innerWidth)-o;if(!D&&!P)return}if(f.current={active:!0,startX:N.clientX,startY:N.clientY,startTime:Date.now(),locked:!1,horizontal:!1},b.current){const D=d.current;if(D){const P=new DOMMatrix(getComputedStyle(D).transform);D.style.transition="none",D.style.transform=`translate3d(${P.m41}px,0,0)`,b.current=!1}}},R=M=>{const N=f.current;if(!N.active)return;const D=M.touches[0],P=D.clientX-N.startX,O=D.clientY-N.startY;if(!N.locked)if(Math.abs(P)>12||Math.abs(O)>12){if(N.locked=!0,N.horizontal=Math.abs(P)>=Math.abs(O),!N.horizontal){N.active=!1;return}}else return;if(!N.horizontal)return;M.cancelable&&M.preventDefault();const F=v();let j=-p.current*F+P;const Q=-(C.current-1)*F;j>0?j*=i:j<Q&&(j=Q+(j-Q)*i),_(j,!1)},L=M=>{const N=f.current;if(!N.active||(N.active=!1,!N.locked||!N.horizontal))return;const D=M.changedTouches[0].clientX-N.startX,P=Math.max(Date.now()-N.startTime,1),O=Math.abs(D/P),F=v(),$=Math.abs(D)/F;let j=p.current;(O>n||$>r)&&(j+=D<0?1:-1),k.current(j)};return I.addEventListener("touchstart",B,{passive:!0}),I.addEventListener("touchmove",R,{passive:!1}),I.addEventListener("touchend",L,{passive:!0}),()=>{I.removeEventListener("touchstart",B),I.removeEventListener("touchmove",R),I.removeEventListener("touchend",L)}},[n,r,i,o,v,_]),T.useEffect(()=>{_(-p.current*v(),!1);const I=()=>_(-p.current*v(),!1);return window.addEventListener("resize",I),()=>window.removeEventListener("resize",I)},[_,v]);const S=T.useRef(t);return T.useEffect(()=>{if(S.current===t)return;S.current=t;const I=Math.max(0,t-1),B=Math.min(p.current,I);p.current=B,g(B),_(-B*v(),!1)},[t,_,v]),T.useEffect(()=>{const I=y;return()=>{I.current++}},[]),{wrapperRef:u,trackRef:d,currentPage:m,goToPage:w,setPageImmediate:x}}const dKr=T.forwardRef(function({onPageChange:e},n){const r=uKr(),{wrapperRef:i,trackRef:o,currentPage:l,goToPage:u,setPageImmediate:d}=OPt({pageCount:r.pageCount,onSnap:r.onSnap});return r.goToPageRef.current=u,r.setPageImmediateRef.current=d,T.useImperativeHandle(n,()=>({goToPage:u,currentPage:l}),[u,l]),T.useEffect(()=>{e?.(l)},[l,e]),A.jsx("div",{ref:i,className:"h-full overflow-hidden",children:A.jsxs("div",{ref:o,className:"flex h-full will-change-transform",children:[A.jsxs("div",{className:"relative h-full shrink-0 w-full",children:[A.jsx(LPt,{onNavigateToChat:r.navigateToChat,scrollRef:r.agentScrollRef,containerRef:r.agentContainerRef,onSortModeChange:r.setAgentSortMode}),A.jsx(lKr,{visible:r.overlay,overlayRef:r.overlayRef,onDismiss:r.dismissOverlay,onNavigateToChat:r.navigateToChat})]}),r.hasChannel&&A.jsx("div",{className:"h-full shrink-0 w-full bg-white dark:bg-neutral-950",children:A.jsx(g3e,{onBack:()=>u(0)})}),r.hasCapsule&&A.jsx("div",{className:"h-full shrink-0 w-full bg-white dark:bg-neutral-950",children:A.jsx(JNe,{variant:"mobile",onBack:()=>u(1)})})]})})});function pKr({showAuthError:t=!1,onRetryAuth:e}){M3e();const{activePanel:n,setActivePanel:r}=Un(us(u=>({activePanel:u.activePanel,setActivePanel:u.setActivePanel}))),[i,o]=T.useState(0),l=n==="chat"&&i>0;return A.jsxs(A.Fragment,{children:[A.jsxs("div",{className:"flex flex-col h-dvh bg-white dark:bg-black select-none",children:[A.jsxs("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden bg-white dark:bg-neutral-950",children:[n==="chat"&&A.jsx(dKr,{onPageChange:o}),n==="knowledge"&&A.jsx(I3e,{}),n==="skills"&&A.jsx("div",{className:"h-full bg-white dark:bg-neutral-950",children:A.jsx(L3e,{})}),n==="memory"&&A.jsx("div",{className:"h-full bg-white dark:bg-neutral-950",children:A.jsx(T3e,{})}),n==="marketplace"&&A.jsx("div",{className:"h-full bg-white dark:bg-neutral-950",children:A.jsx(S3e,{})}),n==="sandbox"&&A.jsx("div",{className:"h-full bg-white dark:bg-neutral-950",children:A.jsx(D3e,{})}),n==="runner"&&A.jsx("div",{className:"h-full bg-white dark:bg-neutral-950",children:A.jsx(B3e,{})}),n==="tasks"&&A.jsx("div",{className:"h-full bg-white dark:bg-neutral-950",children:A.jsx(R3e,{})}),n==="account"&&A.jsx(ZVr,{}),t&&A.jsx("div",{className:"absolute inset-0 z-50 bg-background/80 backdrop-blur-sm flex items-center justify-center",children:A.jsx("div",{className:"w-full max-w-md px-4",children:A.jsx(OSe,{onRetry:e??(()=>{}),variant:"inline"})})})]}),!l&&A.jsx(RPt,{activePanel:n,onPanelChange:r,isMobile:!0})]}),A.jsx(F3e,{}),A.jsx(FLe,{})]})}const mKr=Object.freeze(Object.defineProperty({__proto__:null,MobileApp:pKr},Symbol.toStringTag,{value:"Module"}));function gKr({onGetStarted:t}){const{t:e}=Cn(),[n,r]=T.useState(!1);return T.useEffect(()=>{const i=()=>r(window.scrollY>40);return window.addEventListener("scroll",i,{passive:!0}),()=>window.removeEventListener("scroll",i)},[]),A.jsx(Et.nav,{initial:{opacity:0,y:-12},animate:{opacity:1,y:0},transition:{duration:.5,delay:.05},className:`fixed left-0 right-0 top-0 z-50 transition-all duration-300 ${n?"border-b border-neutral-100 bg-white/80 backdrop-blur-xl dark:border-neutral-800 dark:bg-neutral-950/80":"bg-transparent"}`,children:A.jsxs("div",{className:"flex items-center justify-between px-8 py-4 md:px-16",children:[A.jsxs("a",{href:"#",className:"flex items-center gap-2.5",children:[A.jsx("img",{src:"/light-icon.png",alt:"Xyzen",className:"h-7 w-7 dark:invert"}),A.jsx("span",{className:"text-[15px] font-bold tracking-wide text-neutral-900 dark:text-neutral-100",children:"Xyzen"})]}),A.jsxs("div",{className:"flex items-center gap-4",children:[A.jsxs("a",{href:"/docs",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 px-3 py-2 text-[13px] font-medium text-neutral-500 transition-colors hover:text-neutral-900 dark:hover:text-neutral-100",children:[A.jsx(e6n,{className:"h-4 w-4"}),e("landing.v2.nav.docs")]}),A.jsx(Et.button,{onClick:t,whileHover:{scale:1.03},whileTap:{scale:.97},className:"rounded-full bg-neutral-900 px-5 py-2 text-[13px] font-semibold text-white transition-all hover:bg-neutral-800 dark:bg-white dark:text-neutral-900 dark:hover:bg-neutral-200",children:e("landing.v2.nav.getStarted")})]})]})})}const hKr=[{text:"Autonomous",x:"8%",y:"20%",delay:0,duration:18},{text:"Memory",x:"82%",y:"15%",delay:2,duration:22},{text:"Skills",x:"15%",y:"75%",delay:4,duration:20},{text:"Sandbox",x:"78%",y:"70%",delay:1,duration:19},{text:"MCP",x:"55%",y:"85%",delay:3,duration:21},{text:"Knowledge",x:"90%",y:"45%",delay:5,duration:17},{text:"Teams",x:"5%",y:"50%",delay:2.5,duration:23},{text:"Economy",x:"70%",y:"30%",delay:1.5,duration:20}];function FPt({text:t,delay:e=0,className:n=""}){const r=T.useMemo(()=>t.split(/(\s+)/),[t]);return A.jsx("h1",{className:n,children:r.map((i,o)=>/^\s+$/.test(i)?A.jsx("span",{children:i},o):A.jsx("span",{className:"inline-block overflow-hidden",children:A.jsx(Et.span,{className:"inline-block",initial:{y:"110%"},animate:{y:"0%"},transition:{duration:.65,delay:e+o*.08,ease:[.22,1,.36,1]},children:i})},o))})}function fKr({delay:t}){return A.jsx(Et.svg,{viewBox:"0 0 400 12",className:"mx-auto mt-2 h-3 w-[clamp(200px,40vw,400px)]",preserveAspectRatio:"none",children:A.jsx(Et.path,{d:"M 0 8 Q 100 2, 200 8 Q 300 14, 400 6",fill:"none",stroke:"rgb(163 163 163)",strokeWidth:"2",strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:.5},transition:{pathLength:{duration:1.2,delay:t,ease:[.16,1,.3,1]},opacity:{duration:.4,delay:t}}})})}function AKr({onGetStarted:t}){const{t:e}=Cn(),n=T.useCallback(()=>{document.getElementById("features")?.scrollIntoView({behavior:"smooth"})},[]);return A.jsxs("section",{className:"relative flex min-h-[100dvh] flex-col items-center justify-center overflow-hidden",children:[A.jsx("div",{className:"pointer-events-none absolute inset-0 dark:hidden",style:{backgroundImage:"linear-gradient(to right, rgb(229 229 229 / 0.5) 1px, transparent 1px), linear-gradient(to bottom, rgb(229 229 229 / 0.5) 1px, transparent 1px)"}}),A.jsx("div",{className:"pointer-events-none absolute inset-0 hidden dark:block",style:{backgroundImage:"linear-gradient(to right, rgb(64 64 64 / 0.3) 1px, transparent 1px), linear-gradient(to bottom, rgb(64 64 64 / 0.3) 1px, transparent 1px)",backgroundSize:"64px 64px"}}),A.jsx("div",{className:"pointer-events-none absolute inset-0 bg-[radial-gradient(ellipse_60%_50%_at_50%_50%,white_40%,transparent_100%)] dark:bg-[radial-gradient(ellipse_60%_50%_at_50%_50%,rgb(10_10_10)_40%,transparent_100%)]"}),A.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-0 h-32 bg-gradient-to-b from-white to-transparent dark:from-neutral-950"}),A.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 h-32 bg-gradient-to-t from-white to-transparent dark:from-neutral-950"}),A.jsx("div",{className:"pointer-events-none absolute inset-0",children:hKr.map(({text:r,x:i,y:o,delay:l,duration:u},d)=>A.jsx(Et.span,{className:"absolute select-none font-mono text-[13px] font-medium text-neutral-300 dark:text-neutral-700",style:{left:i,top:o},initial:{opacity:0},animate:{opacity:[0,.6,.6,0],y:[0,-30,-60,-90]},transition:{duration:u,delay:l,repeat:1/0,ease:"linear"},children:r},d))}),A.jsxs("div",{className:"relative z-10 w-full px-8 text-center md:px-16",children:[A.jsx(Et.div,{initial:{scaleX:0},animate:{scaleX:1},transition:{duration:1,delay:.1,ease:[.16,1,.3,1]},className:"mx-auto mb-12 h-px w-24 origin-center bg-neutral-300 dark:bg-neutral-700"}),A.jsx(FPt,{text:e("landing.v2.hero.title1"),delay:.2,className:"mb-2 text-[clamp(2.5rem,7vw,5.5rem)] font-bold leading-[1.15] tracking-tight text-neutral-900 dark:text-neutral-100"}),A.jsx(FPt,{text:e("landing.v2.hero.title2"),delay:.5,className:"mb-2 text-[clamp(2.5rem,7vw,5.5rem)] font-bold leading-[1.15] tracking-tight text-neutral-900 dark:text-neutral-100"}),A.jsx(fKr,{delay:1.2}),A.jsx(Et.p,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{duration:.7,delay:1},className:"mx-auto mb-12 mt-8 max-w-2xl text-lg leading-relaxed text-neutral-500 md:text-xl",children:e("landing.v2.hero.subtitle")}),A.jsxs(Et.div,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{duration:.6,delay:1.3},className:"flex flex-wrap items-center justify-center gap-4",children:[A.jsxs(Et.button,{onClick:t,whileHover:{scale:1.03},whileTap:{scale:.97},className:"inline-flex items-center gap-2.5 rounded-full bg-neutral-900 px-8 py-4 text-[16px] font-semibold text-white shadow-[0_2px_20px_rgba(0,0,0,0.08)] transition-shadow hover:shadow-[0_4px_30px_rgba(0,0,0,0.15)] dark:bg-white dark:text-neutral-900 dark:shadow-[0_2px_20px_rgba(255,255,255,0.08)] dark:hover:shadow-[0_4px_30px_rgba(255,255,255,0.15)]",children:[e("landing.v2.hero.getStarted"),A.jsx(MP,{className:"h-4 w-4"})]}),A.jsxs(Et.button,{onClick:()=>document.getElementById("download")?.scrollIntoView({behavior:"smooth"}),whileHover:{scale:1.03},whileTap:{scale:.97},className:"inline-flex items-center gap-2 rounded-full border border-neutral-200 px-8 py-4 text-[16px] font-semibold text-neutral-700 transition-colors hover:border-neutral-400 hover:text-neutral-900 dark:border-neutral-700 dark:text-neutral-300 dark:hover:border-neutral-500 dark:hover:text-neutral-100",children:[A.jsx(v1,{className:"h-4 w-4"}),e("landing.v2.download.badge")]})]})]}),A.jsx(Et.button,{onClick:n,initial:{opacity:0},animate:{opacity:.4},transition:{delay:2.5,duration:1},className:"absolute bottom-8",children:A.jsx(Et.div,{animate:{y:[0,6,0]},transition:{duration:2.5,repeat:1/0,ease:"easeInOut"},children:A.jsx(df,{className:"h-6 w-6 text-neutral-400"})})})]})}function bKr({target:t,suffix:e=""}){const n=T.useRef(null),r=az(n,{once:!0});return A.jsx(Et.span,{ref:n,initial:{opacity:0},animate:r?{opacity:1}:{},transition:{duration:.5},className:"tabular-nums",children:r?A.jsxs(Et.span,{initial:{opacity:0},animate:{opacity:1},children:[t,e]}):"0"})}function QPt({icon:t,badge:e,title1:n,title2:r,subtitle:i,items:o,stats:l,reverse:u=!1}){const d=T.useRef(null),p=az(d,{once:!0,margin:"-80px"});return A.jsx("div",{ref:d,className:"relative",children:A.jsxs("div",{className:`flex flex-col gap-16 lg:flex-row lg:items-start lg:gap-0 ${u?"lg:flex-row-reverse":""}`,children:[A.jsxs(Et.div,{initial:{opacity:0,x:u?40:-40},animate:p?{opacity:1,x:0}:{},transition:{duration:.8,ease:[.16,1,.3,1]},className:"flex-1 px-8 md:px-16 lg:py-8",children:[A.jsxs("div",{className:"mb-5 flex items-center gap-2.5",children:[A.jsx(t,{className:"h-4 w-4 text-neutral-400"}),A.jsx("span",{className:"text-[11px] font-bold uppercase tracking-[4px] text-neutral-400",children:e})]}),A.jsx("h2",{className:"mb-1 text-[clamp(1.75rem,4vw,3rem)] font-bold leading-[1.1] tracking-tight text-neutral-900 dark:text-neutral-100",children:n}),A.jsx("h2",{className:"mb-6 text-[clamp(1.75rem,4vw,3rem)] font-bold leading-[1.1] tracking-tight text-neutral-900 dark:text-neutral-100",children:r}),A.jsx("p",{className:"mb-10 max-w-lg text-[16px] leading-relaxed text-neutral-500",children:i}),l&&A.jsx("div",{className:"mb-10 flex gap-10",children:l.map(({value:m,suffix:g,label:h},f)=>A.jsxs(Et.div,{initial:{opacity:0,y:16},animate:p?{opacity:1,y:0}:{},transition:{delay:.4+f*.1,duration:.6},children:[A.jsx("div",{className:"text-3xl font-bold text-neutral-900 dark:text-neutral-100",children:A.jsx(bKr,{target:m,suffix:g})}),A.jsx("div",{className:"mt-1 text-[13px] text-neutral-400",children:h})]},f))})]}),A.jsx(Et.div,{initial:{opacity:0,x:u?-40:40},animate:p?{opacity:1,x:0}:{},transition:{duration:.8,delay:.15,ease:[.16,1,.3,1]},className:"flex flex-1 flex-col gap-3 px-8 md:px-16 lg:py-8",children:o.map(({icon:m,label:g,desc:h},f)=>A.jsxs(Et.div,{initial:{opacity:0,y:20},animate:p?{opacity:1,y:0}:{},transition:{delay:.3+f*.1,duration:.6},whileHover:{x:4},className:"group flex gap-5 rounded-lg border border-transparent p-5 transition-colors hover:border-neutral-100 hover:bg-neutral-50 dark:hover:border-neutral-800 dark:hover:bg-neutral-900",children:[A.jsx("span",{className:"mt-0.5 text-2xl",children:m}),A.jsxs("div",{className:"flex-1",children:[A.jsxs("div",{className:"mb-1 flex items-center gap-2",children:[A.jsx("h3",{className:"text-[15px] font-semibold text-neutral-900 dark:text-neutral-100",children:g}),A.jsx(MP,{className:"h-3.5 w-3.5 text-neutral-300 transition-all group-hover:translate-x-0.5 group-hover:text-neutral-500"})]}),A.jsx("p",{className:"text-[14px] leading-relaxed text-neutral-500",children:h})]})]},f))})]})})}function yKr(){const{t}=Cn();return A.jsxs("div",{id:"features",className:"space-y-32 py-24 md:py-32",children:[A.jsx("div",{className:"mx-auto h-px w-full max-w-[90%] bg-gradient-to-r from-transparent via-neutral-200 to-transparent dark:via-neutral-800"}),A.jsx(QPt,{icon:u6n,badge:t("landing.v2.exploration.badge"),title1:t("landing.v2.exploration.title1"),title2:t("landing.v2.exploration.title2"),subtitle:t("landing.v2.exploration.subtitle"),stats:[{value:24,suffix:"/7",label:"Always On"},{value:50,suffix:"+",label:"MCP Integrations"}],items:[{icon:"🔮",label:t("landing.v2.capabilities.items.autonomous.title"),desc:t("landing.v2.capabilities.items.autonomous.desc")},{icon:"🤝",label:t("landing.v2.capabilities.items.team.title"),desc:t("landing.v2.capabilities.items.team.desc")},{icon:"🛠️",label:t("landing.v2.capabilities.items.sandbox.title"),desc:t("landing.v2.capabilities.items.sandbox.desc")}]}),A.jsx("div",{className:"mx-auto h-px w-full max-w-[90%] bg-gradient-to-r from-transparent via-neutral-200 to-transparent dark:via-neutral-800"}),A.jsx(QPt,{icon:l6n,badge:t("landing.v2.economy.badge"),title1:t("landing.v2.economy.title1"),title2:t("landing.v2.economy.title2"),subtitle:t("landing.v2.economy.subtitle"),reverse:!0,stats:[{value:12,suffix:"+",label:"Capabilities"},{value:10,suffix:"x",label:"Open Source Bonus"}],items:[{icon:"💰",label:t("landing.v2.capabilities.items.agentic_pay.title"),desc:t("landing.v2.capabilities.items.agentic_pay.desc")},{icon:"🎨",label:t("landing.v2.capabilities.items.creator_center.title"),desc:t("landing.v2.capabilities.items.creator_center.desc")},{icon:"🔗",label:t("landing.v2.capabilities.items.chain_revenue.title"),desc:t("landing.v2.capabilities.items.chain_revenue.desc")}]})]})}const vKr=[{key:"pc_connect",icon:"💻"},{key:"autonomous",icon:"🔮"},{key:"team",icon:"🤝"},{key:"sandbox",icon:"🛠️"},{key:"skills",icon:"⚡"},{key:"memory",icon:"🧠"},{key:"knowledge",icon:"📚"},{key:"multimodal",icon:"🖼️"},{key:"mcp",icon:"🔌"},{key:"scheduled_tasks",icon:"⏰"},{key:"agentic_pay",icon:"💰"},{key:"agent_graph",icon:"🕸️"}];function _Kr(){const{t}=Cn(),e=T.useRef(null),n=az(e,{once:!0,margin:"-60px"}),r=T.useMemo(()=>vKr.map(i=>({...i,title:t(`landing.v2.capabilities.items.${i.key}.title`),desc:t(`landing.v2.capabilities.items.${i.key}.desc`)})),[t]);return A.jsxs("section",{ref:e,className:"py-24 md:py-32",children:[A.jsx("div",{className:"mx-auto mb-20 h-px w-full max-w-[90%] bg-gradient-to-r from-transparent via-neutral-200 to-transparent dark:via-neutral-800"}),A.jsxs(Et.div,{initial:{opacity:0,y:24},animate:n?{opacity:1,y:0}:{},transition:{duration:.7},className:"mb-16 px-8 md:px-16",children:[A.jsx("span",{className:"mb-4 block text-[11px] font-bold uppercase tracking-[4px] text-neutral-400",children:t("landing.v2.capabilities.badge")}),A.jsx("h2",{className:"mb-4 text-[clamp(1.75rem,4vw,3rem)] font-bold leading-[1.1] tracking-tight text-neutral-900 dark:text-neutral-100",children:t("landing.v2.capabilities.title1")}),A.jsx("p",{className:"max-w-xl text-[16px] leading-relaxed text-neutral-500",children:t("landing.v2.capabilities.subtitle")})]}),A.jsx("div",{className:"px-8 md:px-16",children:A.jsx("div",{className:"grid gap-px overflow-hidden rounded-lg border border-neutral-100 bg-neutral-100 dark:border-neutral-800 dark:bg-neutral-800 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:r.map((i,o)=>A.jsxs(Et.div,{initial:{opacity:0,y:20},animate:n?{opacity:1,y:0}:{},transition:{delay:.1+o*.04,duration:.5,ease:[.16,1,.3,1]},className:"flex flex-col gap-3 bg-white p-6 transition-colors hover:bg-neutral-50 dark:bg-neutral-950 dark:hover:bg-neutral-900",children:[A.jsx(Et.span,{className:"text-3xl",whileHover:{scale:1.15,rotate:5},transition:{type:"spring",stiffness:400,damping:15},children:i.icon}),A.jsx("h3",{className:"text-[15px] font-semibold text-neutral-900 dark:text-neutral-100",children:i.title}),A.jsx("p",{className:"text-[13px] leading-relaxed text-neutral-500",children:i.desc})]},i.key))})})]})}function $Pt(t){return lR({attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M318.7 268.7c-.2-36.7 16.4-64.4 50-84.8-18.8-26.9-47.2-41.7-84.7-44.6-35.5-2.8-74.3 20.7-88.5 20.7-15 0-49.4-19.7-76.4-19.7C63.3 141.2 4 184.8 4 273.5q0 39.3 14.4 81.2c12.8 36.7 59 126.7 107.2 125.2 25.2-.6 43-17.9 75.8-17.9 31.8 0 48.3 17.9 76.4 17.9 48.6-.7 90.4-82.5 102.6-119.3-65.2-30.7-61.7-90-61.7-91.9zm-56.6-164.2c27.3-32.4 24.8-61.9 24-72.5-24.1 1.4-52 16.4-67.9 34.9-17.5 19.8-27.8 44.3-25.6 71.9 26.1 2 49.9-11.4 69.5-34.3z"},child:[]}]})(t)}function wKr(t){return lR({attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M420.55,301.93a24,24,0,1,1,24-24,24,24,0,0,1-24,24m-265.1,0a24,24,0,1,1,24-24,24,24,0,0,1-24,24m273.7-144.48,47.94-83a10,10,0,1,0-17.27-10h0l-48.54,84.07a301.25,301.25,0,0,0-246.56,0L116.18,64.45a10,10,0,1,0-17.27,10h0l47.94,83C64.53,202.22,8.24,285.55,0,384H576c-8.24-98.45-64.54-181.78-146.85-226.55"},child:[]}]})(t)}const zLe="https://storage.sciol.ac.cn/xyzen/releases",jPt=[{key:"darwin-arm64",label:"macOS Apple Silicon",binary:"xyzen-darwin-arm64"},{key:"darwin-amd64",label:"macOS Intel",binary:"xyzen-darwin-amd64"},{key:"linux-amd64",label:"Linux x86_64",binary:"xyzen-linux-amd64"},{key:"linux-arm64",label:"Linux ARM64",binary:"xyzen-linux-arm64"},{key:"windows-amd64",label:"Windows x86_64",binary:"xyzen-windows-amd64.exe"}],zPt=[{key:"macos",label:"macOS (Universal)",binary:"Xyzen-macos-universal.dmg"},{key:"windows",label:"Windows (x64)",binary:"Xyzen-windows-x64-setup.exe"},{key:"linux-deb",label:"Linux (.deb)",binary:"Xyzen-linux-amd64.deb"},{key:"linux-appimage",label:"Linux (.AppImage)",binary:"Xyzen-linux-amd64.AppImage"}];function UPt(t){const e=navigator.userAgent.toLowerCase(),n=navigator.platform?.toLowerCase()??"";return e.includes("mac")||n.includes("mac")?t[0]:e.includes("win")||n.includes("win")?t.find(r=>r.key.includes("win"))??t[t.length-1]:t.find(r=>r.key.includes("linux"))??t[0]}function xKr(){const{t}=Cn(),e=T.useMemo(()=>UPt(jPt),[]),n=T.useMemo(()=>UPt(zPt),[]),[r,i]=T.useState(e),[o,l]=T.useState(n),[u,d]=T.useState(!1),[p,m]=T.useState(!1);return A.jsxs("div",{children:[A.jsx("div",{className:"mx-auto mb-20 h-px w-full bg-gradient-to-r from-transparent via-neutral-200 to-transparent dark:via-neutral-800"}),A.jsxs("div",{className:"mb-16",children:[A.jsx("span",{className:"mb-4 block text-[11px] font-bold uppercase tracking-[4px] text-neutral-400",children:t("landing.v2.download.badge")}),A.jsx("h2",{className:"mb-4 text-[clamp(1.75rem,4vw,3rem)] font-bold leading-[1.1] tracking-tight text-neutral-900 dark:text-neutral-100",children:t("landing.v2.download.title")}),A.jsx("p",{className:"max-w-xl text-[16px] leading-relaxed text-neutral-500",children:t("landing.v2.download.subtitle")})]}),A.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:[A.jsxs(Et.a,{href:`${zLe}/android/latest/xyzen-latest.apk`,download:!0,whileHover:{y:-4},whileTap:{scale:.98},className:"group flex flex-col items-center gap-5 rounded-lg border border-neutral-100 bg-white px-6 py-10 transition-colors hover:border-neutral-200 hover:bg-neutral-50 dark:border-neutral-800 dark:bg-neutral-900 dark:hover:border-neutral-700 dark:hover:bg-neutral-800",children:[A.jsx("div",{className:"flex h-14 w-14 items-center justify-center rounded-lg bg-green-50 dark:bg-green-950/40",children:A.jsx(wKr,{className:"h-7 w-7 text-green-600 dark:text-green-400"})}),A.jsxs("div",{className:"text-center",children:[A.jsx("h3",{className:"text-[16px] font-semibold text-neutral-900 dark:text-neutral-100",children:"Android"}),A.jsx("p",{className:"mt-1 text-[13px] text-neutral-500",children:t("landing.v2.download.androidDesc")})]}),A.jsxs("span",{className:"inline-flex items-center gap-2 rounded-full bg-green-50 px-5 py-2.5 text-[14px] font-semibold text-green-700 transition-colors group-hover:bg-green-100 dark:bg-green-950/50 dark:text-green-400 dark:group-hover:bg-green-950/80",children:[A.jsx(v1,{className:"h-4 w-4"}),t("landing.v2.download.downloadApk")]})]}),A.jsxs(Et.a,{href:"https://testflight.apple.com/join/RNW6tavA",target:"_blank",rel:"noopener noreferrer",whileHover:{y:-4},whileTap:{scale:.98},className:"group flex flex-col items-center gap-5 rounded-lg border border-neutral-100 bg-white px-6 py-10 transition-colors hover:border-neutral-200 hover:bg-neutral-50 dark:border-neutral-800 dark:bg-neutral-900 dark:hover:border-neutral-700 dark:hover:bg-neutral-800",children:[A.jsx("div",{className:"flex h-14 w-14 items-center justify-center rounded-lg bg-neutral-100 dark:bg-neutral-800",children:A.jsx($Pt,{className:"h-7 w-7 text-neutral-900 dark:text-neutral-100"})}),A.jsxs("div",{className:"text-center",children:[A.jsx("h3",{className:"text-[16px] font-semibold text-neutral-900 dark:text-neutral-100",children:"iOS"}),A.jsx("p",{className:"mt-1 text-[13px] text-neutral-500",children:t("landing.v2.download.iosDesc")})]}),A.jsxs("span",{className:"inline-flex items-center gap-2 rounded-full bg-blue-50 px-5 py-2.5 text-[14px] font-semibold text-blue-700 transition-colors group-hover:bg-blue-100 dark:bg-blue-950/50 dark:text-blue-400 dark:group-hover:bg-blue-950/80",children:[A.jsx(v1,{className:"h-4 w-4"}),"TestFlight"]})]}),A.jsxs(Et.div,{whileHover:{y:-4},className:"relative flex flex-col items-center gap-5 rounded-lg border border-neutral-100 bg-white px-6 py-10 transition-colors hover:border-neutral-200 hover:bg-neutral-50 dark:border-neutral-800 dark:bg-neutral-900 dark:hover:border-neutral-700 dark:hover:bg-neutral-800",children:[A.jsx("div",{className:"flex h-14 w-14 items-center justify-center rounded-lg bg-violet-50 dark:bg-violet-950/40",children:A.jsx(w6n,{className:"h-7 w-7 text-violet-600 dark:text-violet-400"})}),A.jsxs("div",{className:"text-center",children:[A.jsx("h3",{className:"text-[16px] font-semibold text-neutral-900 dark:text-neutral-100",children:"Desktop"}),A.jsx("p",{className:"mt-1 text-[13px] text-neutral-500",children:t("landing.v2.download.desktopDesc")})]}),A.jsxs("div",{className:"relative w-full",children:[A.jsxs("button",{onClick:()=>m(g=>!g),className:"flex w-full items-center justify-center gap-2 rounded-full bg-violet-50 px-4 py-2.5 text-[13px] font-semibold text-violet-700 transition-colors hover:bg-violet-100 dark:bg-violet-950/50 dark:text-violet-400 dark:hover:bg-violet-950/80",children:[o.label,A.jsx(df,{className:`h-3.5 w-3.5 transition-transform ${p?"rotate-180":""}`})]}),A.jsx($r,{children:p&&A.jsx(Et.div,{initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},className:"absolute left-0 right-0 top-full z-10 mt-1 overflow-hidden rounded-lg border border-neutral-100 bg-white shadow-lg dark:border-neutral-700 dark:bg-neutral-800",children:zPt.map(g=>A.jsxs("button",{onClick:()=>{l(g),m(!1)},className:`flex w-full items-center gap-2.5 px-4 py-2.5 text-left text-[13px] transition-colors hover:bg-neutral-50 dark:hover:bg-neutral-700 ${g.key===o.key?"font-medium text-neutral-900 dark:text-neutral-100":"text-neutral-500 dark:text-neutral-400"}`,children:[g.key===o.key?A.jsx(th,{className:"h-3.5 w-3.5 shrink-0 text-neutral-900 dark:text-neutral-100"}):A.jsx("span",{className:"inline-block w-3.5 shrink-0"}),g.label]},g.key))})})]}),A.jsxs(Et.a,{href:`${zLe}/desktop/latest/${o.binary}`,download:!0,whileHover:{scale:1.02},whileTap:{scale:.98},className:"inline-flex items-center gap-2 rounded-full bg-violet-600 px-6 py-2.5 text-[14px] font-semibold text-white transition-all hover:bg-violet-500",children:[A.jsx(v1,{className:"h-4 w-4"}),t("landing.v2.download.downloadDesktop")]})]}),A.jsxs(Et.div,{whileHover:{y:-4},className:"relative flex flex-col items-center gap-5 rounded-lg border border-neutral-100 bg-white px-6 py-10 transition-colors hover:border-neutral-200 hover:bg-neutral-50 dark:border-neutral-800 dark:bg-neutral-900 dark:hover:border-neutral-700 dark:hover:bg-neutral-800",children:[A.jsx("div",{className:"flex h-14 w-14 items-center justify-center rounded-lg bg-neutral-100 dark:bg-neutral-800",children:A.jsx(M6n,{className:"h-7 w-7 text-neutral-700 dark:text-neutral-300"})}),A.jsxs("div",{className:"text-center",children:[A.jsx("h3",{className:"text-[16px] font-semibold text-neutral-900 dark:text-neutral-100",children:"Runner SDK"}),A.jsx("p",{className:"mt-1 text-[13px] text-neutral-500",children:t("landing.v2.download.runnerDesc")})]}),A.jsxs("div",{className:"relative w-full",children:[A.jsxs("button",{onClick:()=>d(g=>!g),className:"flex w-full items-center justify-center gap-2 rounded-full bg-neutral-100 px-4 py-2.5 text-[13px] font-semibold text-neutral-700 transition-colors hover:bg-neutral-200/80 dark:bg-neutral-800 dark:text-neutral-300 dark:hover:bg-neutral-700",children:[r.label,A.jsx(df,{className:`h-3.5 w-3.5 transition-transform ${u?"rotate-180":""}`})]}),A.jsx($r,{children:u&&A.jsx(Et.div,{initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},className:"absolute left-0 right-0 top-full z-10 mt-1 overflow-hidden rounded-lg border border-neutral-100 bg-white shadow-lg dark:border-neutral-700 dark:bg-neutral-800",children:jPt.map(g=>A.jsxs("button",{onClick:()=>{i(g),d(!1)},className:`flex w-full items-center gap-2.5 px-4 py-2.5 text-left text-[13px] transition-colors hover:bg-neutral-50 dark:hover:bg-neutral-700 ${g.key===r.key?"font-medium text-neutral-900 dark:text-neutral-100":"text-neutral-500 dark:text-neutral-400"}`,children:[g.key===r.key?A.jsx(th,{className:"h-3.5 w-3.5 shrink-0 text-neutral-900 dark:text-neutral-100"}):A.jsx("span",{className:"inline-block w-3.5 shrink-0"}),g.label]},g.key))})})]}),A.jsxs(Et.a,{href:`${zLe}/runner/latest/${r.binary}`,download:!0,whileHover:{scale:1.02},whileTap:{scale:.98},className:"inline-flex items-center gap-2 rounded-full bg-neutral-900 px-6 py-2.5 text-[14px] font-semibold text-white transition-all hover:bg-neutral-800",children:[A.jsx(v1,{className:"h-4 w-4"}),t("landing.v2.download.downloadSdk")]})]})]})]})}const kKr=[{key:"autonomous",icon:"🔮"},{key:"team",icon:"🤝"},{key:"pc_connect",icon:"💻"},{key:"sandbox",icon:"🛠️"},{key:"skills",icon:"⚡"},{key:"memory",icon:"🧠"},{key:"mcp",icon:"🔌"},{key:"agentic_pay",icon:"💰"}],EKr=4,lce={hidden:{},show:{transition:{staggerChildren:.08,delayChildren:.15}}},wg={hidden:{opacity:0,y:20},show:{opacity:1,y:0,transition:{duration:.5,ease:[.16,1,.3,1]}}},ULe={hidden:{opacity:0,scale:.9},show:{opacity:1,scale:1,transition:{duration:.4,ease:[.16,1,.3,1]}}};function CKr({total:t,current:e,onSelect:n}){return A.jsx("div",{className:"flex items-center gap-2",children:Array.from({length:t},(r,i)=>A.jsx("button",{onClick:()=>n(i),className:"h-1.5 rounded-full transition-all duration-300",style:{width:i===e?20:6,background:i===e?"currentColor":"rgb(163 163 163 / 0.4)"}},i))})}const SKr="https://testflight.apple.com/join/RNW6tavA",IKr="https://storage.sciol.ac.cn/xyzen/releases/android/latest/xyzen-latest.apk";function qPt({platform:t}){const{t:e}=Cn(),n=t==="ios";if(!T.useMemo(()=>{const d=navigator.userAgent;return n?/iPhone|iPad|iPod|Macintosh/i.test(d):/Android/i.test(d)},[n]))return null;const i=n?$Pt:N6n,o=n?SKr:IKr,l=e(n?"landing.v2.download.getOnAppStore":"landing.v2.download.downloadApk"),u=e(n?"landing.v2.download.iosDesc":"landing.v2.download.androidDesc");return A.jsxs(Et.a,{href:o,...!n&&{download:!0},whileTap:{scale:.97},className:"flex items-center gap-3 rounded-2xl bg-white/60 px-4 py-3 ring-1 ring-black/[0.04] backdrop-blur-xl supports-[backdrop-filter]:bg-white/40 active:bg-white/70 dark:bg-white/[0.08] dark:ring-white/[0.06] dark:backdrop-blur-xl dark:supports-[backdrop-filter]:bg-white/[0.05] dark:active:bg-white/[0.12]",children:[A.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-xl bg-neutral-900/90 dark:bg-white/90",children:A.jsx(i,{className:"h-[18px] w-[18px] text-white dark:text-neutral-900"})}),A.jsxs("div",{className:"min-w-0 flex-1",children:[A.jsx("p",{className:"text-[13px] font-semibold text-neutral-800 dark:text-neutral-100",children:l}),A.jsx("p",{className:"text-[11px] text-neutral-400 dark:text-neutral-500",children:u})]}),A.jsx(v1,{className:"h-3.5 w-3.5 shrink-0 text-neutral-300 dark:text-neutral-600"})]})}const WG=4;function TKr({onGetStarted:t}){const{t:e}=Cn(),n=/android/i.test(navigator.userAgent),{wrapperRef:r,trackRef:i,currentPage:o,goToPage:l}=OPt({pageCount:WG,bypassEdge:!0});return A.jsxs("div",{className:"fixed inset-0 z-0 overflow-hidden bg-white text-neutral-900 dark:bg-neutral-950 dark:text-neutral-100",children:[A.jsx("div",{ref:r,className:"h-full w-full",children:A.jsxs("div",{ref:i,className:"flex h-full",style:{width:`${WG*100}%`,willChange:"transform"},children:[A.jsxs("div",{className:"relative flex h-full w-full flex-col px-7 pt-[20vh]",children:[A.jsx("div",{className:"pointer-events-none absolute inset-0",style:{backgroundImage:"linear-gradient(to right, rgb(64 64 64 / 0.15) 1px, transparent 1px), linear-gradient(to bottom, rgb(64 64 64 / 0.15) 1px, transparent 1px)",backgroundSize:"48px 48px"}}),A.jsx("div",{className:"pointer-events-none absolute inset-0 bg-[radial-gradient(ellipse_80%_60%_at_30%_40%,white_30%,transparent_100%)] dark:bg-[radial-gradient(ellipse_80%_60%_at_30%_40%,rgb(10_10_10)_30%,transparent_100%)]"}),o===0&&[{text:"Autonomous",x:"65%",y:"28%",delay:0},{text:"Memory",x:"72%",y:"48%",delay:1.5},{text:"Skills",x:"58%",y:"62%",delay:3},{text:"MCP",x:"80%",y:"72%",delay:2},{text:"Economy",x:"62%",y:"82%",delay:4}].map(({text:u,x:d,y:p,delay:m},g)=>A.jsx(Et.span,{className:"pointer-events-none absolute select-none font-mono text-[11px] font-medium text-neutral-300 dark:text-neutral-700",style:{left:d,top:p},initial:{opacity:0},animate:{opacity:[0,.5,.5,0],y:[0,-20,-40,-60]},transition:{duration:12,delay:m,repeat:1/0,ease:"linear"},children:u},g)),A.jsxs(Et.div,{variants:lce,initial:"hidden",animate:o===0?"show":"hidden",className:"relative z-10",children:[A.jsxs(Et.div,{variants:wg,className:"mb-6",children:[A.jsx("img",{src:"/light-icon.png",alt:"Xyzen",className:"h-10 w-10 dark:hidden"}),A.jsx("img",{src:"/icon.png",alt:"Xyzen",className:"hidden h-10 w-10 dark:block"})]}),A.jsx(Et.h1,{variants:wg,className:"text-[38px] font-bold leading-[1.1] tracking-tight text-neutral-900 dark:text-neutral-100",children:e("landing.v2.hero.title1")}),A.jsx(Et.h1,{variants:wg,className:"mb-6 text-[38px] font-bold leading-[1.1] tracking-tight text-neutral-900 dark:text-neutral-100",children:e("landing.v2.hero.title2")}),A.jsx(Et.p,{variants:wg,className:"max-w-[300px] text-base leading-relaxed text-neutral-500",children:e("landing.v2.hero.subtitle")})]}),A.jsxs(Et.div,{initial:{opacity:0,y:12},animate:o===0?{opacity:1,y:0}:{opacity:0,y:12},transition:{duration:.5,delay:.6,ease:[.16,1,.3,1]},className:"absolute bottom-44 left-7 right-7 z-10 flex flex-col gap-2.5",children:[A.jsx(qPt,{platform:"ios"}),A.jsx(qPt,{platform:"android"})]}),A.jsx(Et.div,{initial:{opacity:0},animate:{opacity:.4},transition:{delay:2,duration:1},className:"absolute bottom-24 left-7",children:A.jsxs(Et.div,{animate:{x:[0,6,0]},transition:{duration:2,repeat:1/0,ease:"easeInOut"},className:"flex items-center gap-2 text-xs text-neutral-400",children:[A.jsx("span",{children:e("landing.v2.mobile.swipeHint")}),A.jsx(MP,{className:"h-3 w-3"})]})})]}),A.jsx("div",{className:"relative flex h-full w-full flex-col px-7 pt-[18vh]",children:A.jsxs(Et.div,{variants:lce,initial:"hidden",animate:o===1?"show":"hidden",children:[A.jsx(Et.p,{variants:wg,className:"mb-4 text-xs font-semibold uppercase tracking-[3px] text-neutral-400",children:e("landing.v2.exploration.badge")}),A.jsx(Et.h1,{variants:wg,className:"text-[34px] font-bold leading-[1.15] tracking-tight text-neutral-900 dark:text-neutral-100",children:e("landing.v2.exploration.title1")}),A.jsx(Et.h1,{variants:wg,className:"mb-6 text-[34px] font-bold leading-[1.15] tracking-tight text-neutral-900 dark:text-neutral-100",children:e("landing.v2.exploration.title2")}),A.jsx(Et.p,{variants:wg,className:"mb-10 max-w-[300px] text-base leading-relaxed text-neutral-500",children:e("landing.v2.exploration.subtitle")}),A.jsx(Et.div,{variants:wg,className:"space-y-4",children:[{icon:"🔍",label:e("landing.v2.exploration.ceoAgent")},{icon:"📋",label:e("landing.v2.exploration.autonomousExplore")},{icon:"✅",label:e("landing.v2.exploration.done")}].map(({icon:u,label:d},p)=>A.jsxs(Et.div,{initial:{opacity:0,x:-16},animate:o===1?{opacity:1,x:0}:{opacity:0,x:-16},transition:{delay:.5+p*.15,duration:.4},className:"flex items-center gap-3",children:[A.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-neutral-100 dark:bg-neutral-800",children:A.jsx("span",{className:"text-base",children:u})}),A.jsx("div",{className:"h-px flex-1 bg-neutral-100 dark:bg-neutral-800"}),A.jsx("span",{className:"text-sm font-medium text-neutral-500",children:d})]},p))})]})}),A.jsx("div",{className:"relative flex h-full w-full flex-col px-7 pt-[16vh]",children:A.jsxs(Et.div,{variants:lce,initial:"hidden",animate:o===2?"show":"hidden",className:"flex flex-1 flex-col",children:[A.jsx(Et.p,{variants:wg,className:"mb-4 text-xs font-semibold uppercase tracking-[3px] text-neutral-400",children:e("landing.v2.capabilities.badge")}),A.jsx(Et.h1,{variants:wg,className:"mb-2 text-[34px] font-bold leading-[1.15] tracking-tight text-neutral-900 dark:text-neutral-100",children:e("landing.v2.capabilities.title1")}),A.jsx(Et.p,{variants:wg,className:"mb-8 text-[15px] text-neutral-500",children:e("landing.v2.capabilities.subtitle")}),A.jsx(Et.div,{variants:wg,className:"-mx-1 pb-28",children:A.jsxs("div",{className:"grid grid-cols-2 gap-2 px-1",children:[kKr.map(({key:u,icon:d})=>A.jsxs(Et.div,{variants:ULe,className:"flex flex-col gap-2 rounded-lg border border-neutral-100 bg-white p-3.5 dark:border-neutral-800 dark:bg-neutral-900",children:[A.jsx("span",{className:"text-lg",children:d}),A.jsx("span",{className:"text-sm font-semibold leading-tight text-neutral-800 dark:text-neutral-200",children:e(`landing.v2.capabilities.items.${u}.title`)})]},u)),A.jsxs(Et.div,{variants:ULe,className:"col-span-2 flex flex-row items-center justify-center gap-2 rounded-lg border border-dashed border-neutral-200 py-3 dark:border-neutral-700",children:[A.jsxs("span",{className:"text-lg font-semibold text-neutral-400 dark:text-neutral-500",children:["+",EKr]}),A.jsx("span",{className:"text-xs text-neutral-400 dark:text-neutral-500",children:"more"})]})]})})]})}),A.jsx("div",{className:"relative flex h-full w-full flex-col items-center justify-center px-7",children:A.jsxs(Et.div,{variants:lce,initial:"hidden",animate:o===3?"show":"hidden",className:"text-center",children:[A.jsxs(Et.div,{variants:ULe,children:[A.jsx("img",{src:"/light-icon.png",alt:"Xyzen",className:"mx-auto mb-8 h-16 w-16 dark:hidden"}),A.jsx("img",{src:"/icon.png",alt:"Xyzen",className:"mx-auto mb-8 hidden h-16 w-16 dark:block"})]}),A.jsx(Et.h1,{variants:wg,className:"mb-4 text-[36px] font-bold leading-[1.1] tracking-tight text-neutral-900 dark:text-neutral-100",children:e("landing.cta.title")}),A.jsx(Et.p,{variants:wg,className:"mx-auto mb-10 max-w-[300px] text-base leading-relaxed text-neutral-500",children:e("landing.cta.subtitle")}),A.jsxs(Et.button,{variants:wg,onClick:t,whileTap:{scale:.96},className:"inline-flex items-center gap-2.5 rounded-full bg-neutral-900 px-8 py-4 text-[16px] font-semibold text-white transition-colors active:bg-neutral-800 dark:bg-white dark:text-neutral-900 dark:active:bg-neutral-200",children:[e("landing.v2.hero.getStarted"),A.jsx(MP,{className:"h-5 w-5"})]}),n&&A.jsxs(Et.a,{variants:wg,href:"https://storage.sciol.ac.cn/xyzen/releases/android/latest/xyzen-latest.apk",download:!0,whileTap:{scale:.96},className:"mt-4 flex items-center justify-center gap-2 text-[14px] font-medium text-neutral-400 transition-colors active:text-neutral-600 dark:text-neutral-500 dark:active:text-neutral-300",children:[A.jsx(v1,{className:"h-4 w-4"}),e("landing.v2.download.downloadApk")]})]})})]})}),A.jsx("div",{className:"fixed bottom-8 left-0 right-0 z-10 flex justify-center",children:A.jsx(CKr,{total:WG,current:o,onSelect:l})}),o<WG-1&&A.jsx("button",{onClick:()=>l(WG-1),className:"fixed right-6 top-14 z-10 text-[13px] font-semibold text-neutral-400 transition-colors active:text-neutral-600",children:e("landing.v2.mobile.skip")})]})}function BKr({children:t,className:e="",id:n}){const r=T.useRef(null),i=az(r,{once:!0,margin:"-60px"});return A.jsx("section",{id:n,ref:r,className:`relative ${e}`,children:A.jsx(Et.div,{initial:{opacity:0,y:32},animate:i?{opacity:1,y:0}:{},transition:{duration:.7,ease:[.16,1,.3,1]},children:t})})}function DKr({onGetStarted:t}){const{t:e}=Cn(),n=T.useRef(null),r=az(n,{once:!0,margin:"-60px"});return A.jsxs("section",{ref:n,className:"relative overflow-hidden bg-neutral-900 px-8 py-28 dark:bg-neutral-900 md:py-36",children:[A.jsx("div",{className:"pointer-events-none absolute -left-[10%] -top-[20%] h-[50vh] w-[50vh] rounded-full border border-neutral-800/50"}),A.jsx("div",{className:"pointer-events-none absolute -bottom-[15%] -right-[8%] h-[40vh] w-[40vh] rounded-full border border-neutral-800/50"}),A.jsxs(Et.div,{initial:{opacity:0,y:30},animate:r?{opacity:1,y:0}:{},transition:{duration:.8},className:"relative z-10 mx-auto max-w-3xl text-center",children:[A.jsx("h2",{className:"mb-5 text-[clamp(2rem,5vw,3.5rem)] font-bold leading-[1.1] tracking-tight text-white",children:e("landing.cta.title")}),A.jsx("p",{className:"mx-auto mb-12 max-w-lg text-[16px] leading-relaxed text-neutral-400",children:e("landing.cta.subtitle")}),A.jsxs(Et.button,{onClick:t,whileHover:{scale:1.03},whileTap:{scale:.97},className:"inline-flex items-center gap-2.5 rounded-full bg-white px-8 py-4 text-[16px] font-semibold text-neutral-900 shadow-[0_2px_20px_rgba(255,255,255,0.1)] transition-shadow hover:shadow-[0_4px_30px_rgba(255,255,255,0.2)]",children:[e("landing.cta.start"),A.jsx(MP,{className:"h-4 w-4"})]})]})]})}function NKr({onGetStarted:t}){const{t:e}=Cn();return Eq()?A.jsx(TKr,{onGetStarted:t}):A.jsxs("div",{className:"h-dvh overflow-y-auto bg-white text-neutral-900 dark:bg-neutral-950 dark:text-neutral-100",children:[A.jsx(gKr,{onGetStarted:t}),A.jsx(AKr,{onGetStarted:t}),A.jsx(yKr,{}),A.jsx(_Kr,{}),A.jsx(BKr,{id:"download",className:"px-8 py-24 md:px-16 md:py-32",children:A.jsx(xKr,{})}),A.jsx(DKr,{onGetStarted:t}),A.jsxs("footer",{className:"border-t border-neutral-100 px-8 py-12 dark:border-neutral-800 md:px-16",children:[A.jsxs("div",{className:"flex flex-col items-center gap-5 md:flex-row md:justify-between",children:[A.jsxs("div",{className:"flex items-center gap-2.5",children:[A.jsx("img",{src:"/light-icon.png",alt:"Xyzen",className:"h-5 w-5 opacity-50 dark:invert"}),A.jsx("span",{className:"text-xs font-medium tracking-wider text-neutral-400",children:"XYZEN"})]}),A.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-x-6 gap-y-2 text-[13px] text-neutral-400",children:[A.jsxs("a",{href:"#/terms",className:"inline-flex items-center gap-1 transition-colors hover:text-neutral-700 dark:hover:text-neutral-300",children:[A.jsx(I6n,{className:"h-3.5 w-3.5"}),e("landing.footer.terms")]}),A.jsxs("a",{href:"#/privacy",className:"inline-flex items-center gap-1 transition-colors hover:text-neutral-700 dark:hover:text-neutral-300",children:[A.jsx(vte,{className:"h-3.5 w-3.5"}),e("landing.footer.privacy")]})]}),A.jsx("p",{className:"text-xs text-neutral-400",children:e("landing.footer.copyright")})]}),g1()==="zh-cn"&&A.jsxs("div",{className:"mt-5 flex flex-col items-center gap-2",children:[A.jsx("p",{className:"text-xs text-neutral-400",children:"本服务由深势科技股份有限公司提供运营支持"}),A.jsx("a",{href:"https://beian.miit.gov.cn/",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-neutral-400 transition-colors hover:text-neutral-600",children:"京ICP备20010051号-21"})]})]})]})}const RKr=Object.freeze(Object.defineProperty({__proto__:null,LandingPageV3:NKr},Symbol.toStringTag,{value:"Module"}));function LKr({onAuthenticated:t,isVerifying:e=!1,authError:n=null}){const[r,i]=T.useState(""),[o,l]=T.useState(null),u=async p=>{if(p.preventDefault(),!r.trim()){l("Please enter admin secret key");return}l(null),t(r.trim())},d=n||o;return A.jsxs("div",{className:"w-full max-w-md bg-white dark:bg-neutral-900 rounded-lg shadow-xl p-6",children:[A.jsxs("div",{className:"mb-6",children:[A.jsx("h1",{className:"text-2xl font-bold text-neutral-900 dark:text-white",children:"Admin Access"}),A.jsx("p",{className:"text-sm text-neutral-500 dark:text-neutral-400 mt-2",children:"Enter admin secret key to manage redemption codes"})]}),A.jsxs("form",{onSubmit:u,className:"space-y-4",children:[A.jsx("div",{children:A.jsx(qc,{id:"admin-secret",type:"password",placeholder:"Admin Secret Key",value:r,onChange:p=>i(p.target.value),disabled:e})}),d&&A.jsx("div",{className:"rounded-md bg-red-50 dark:bg-red-950/30 p-3 text-sm text-red-600 dark:text-red-400",children:d}),A.jsx(Co,{type:"submit",className:"w-full",disabled:e,children:e?"Verifying...":"Access Admin Panel"})]})]})}class MKr{headers(e){return{"X-Admin-Secret":e}}async getOverview(e){return on.get("/xyzen/api/v1/admin/marketplace/overview",{auth:!1,headers:this.headers(e)})}async getListings(e,n={}){return on.get("/xyzen/api/v1/admin/marketplace/listings",{auth:!1,headers:this.headers(e),params:n})}async getListingDetail(e,n){return on.get(`/xyzen/api/v1/admin/marketplace/listings/${n}`,{auth:!1,headers:this.headers(e)})}async togglePublish(e,n){return on.post(`/xyzen/api/v1/admin/marketplace/listings/${n}/toggle-publish`,void 0,{auth:!1,headers:this.headers(e)})}async updateListingCuration(e,n,r){return on.patch(`/xyzen/api/v1/admin/marketplace/listings/${n}/curation`,r,{auth:!1,headers:this.headers(e)})}async deleteListing(e,n){return on.delete(`/xyzen/api/v1/admin/marketplace/listings/${n}`,void 0,{auth:!1,headers:this.headers(e)})}async getEarningsHeatmap(e,n,r,i){return on.get("/xyzen/api/v1/admin/marketplace/heatmap/earnings",{auth:!1,headers:this.headers(e),params:{year:n,tz:r,subscription_tier:i}})}async getTopAgents(e,n="earned",r=20){return on.get("/xyzen/api/v1/admin/marketplace/top-agents",{auth:!1,headers:this.headers(e),params:{sort_by:n,limit:r}})}async getTopDevelopers(e,n,r,i,o=20){return on.get("/xyzen/api/v1/admin/marketplace/top-developers",{auth:!1,headers:this.headers(e),params:{year:n,tz:r,date:i,limit:o}})}async getDeveloperAgents(e,n){return on.get(`/xyzen/api/v1/admin/marketplace/developers/${n}/agents`,{auth:!1,headers:this.headers(e)})}}const ST=new MKr,IT={ultra:"bg-amber-900/40 text-amber-300",pro:"bg-purple-900/40 text-purple-300",professional:"bg-purple-900/40 text-purple-300",standard:"bg-blue-900/40 text-blue-300",lite:"bg-neutral-800 text-neutral-300",free:"bg-neutral-800 text-neutral-300",unknown:"bg-neutral-800 text-neutral-500"},BC={free:"Lite",lite:"Lite",standard:"Standard",pro:"Pro",professional:"Pro",ultra:"Ultra",unknown:"Unknown"},GPt={free:"bg-neutral-100 dark:bg-neutral-800 text-neutral-700 dark:text-neutral-300",standard:"bg-blue-100 dark:bg-blue-900/30 text-blue-800 dark:text-blue-200",professional:"bg-purple-100 dark:bg-purple-900/30 text-purple-800 dark:text-purple-200",ultra:"bg-amber-100 dark:bg-amber-900/30 text-amber-800 dark:text-amber-200"};function sl(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:t.toLocaleString()}function qLe(t){return t?new Date(t).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):"—"}function HPt(t){return new Date(t).toLocaleString("en-US",{year:"numeric",month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit"})}function PKr(t){return t?new Date(t)<new Date:!1}function OKr(t){return t>=1073741824?`${(t/1073741824).toFixed(0)} GB`:t>=1048576?`${(t/1048576).toFixed(0)} MB`:`${(t/1024).toFixed(0)} KB`}const FKr=2026,QKr=2030,$Kr=[{value:"",label:"All Tiers"},{value:"ultra",label:"Ultra"},{value:"pro",label:"Pro"},{value:"standard",label:"Standard"},{value:"lite",label:"Lite"}];function YG({year:t,onYearChange:e,selectedTier:n="",onTierChange:r,selectedModel:i="",onModelChange:o,showTierFilter:l=!1,showModelFilter:u=!1,selectedProvider:d="",onProviderChange:p,providerOptions:m=[],modelOptions:g=[],showProviderFilter:h=!1,selectedTool:f="",onToolChange:b,toolOptions:y=[],showToolFilter:v=!1,tierOptions:_}){const w=T.useMemo(()=>{const k=new Map;for(const C of m){const E=k.get(C.label);E?E.push(C.value):k.set(C.label,[C.value])}return Array.from(k.entries()).map(([C,E])=>({value:E.join(","),label:C}))},[m]),x=_?[{value:"",label:"All Tiers"},..._.map(k=>({value:k,label:BC[k]??k}))]:$Kr;return A.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[A.jsxs("div",{className:"flex items-center gap-1",children:[A.jsx("button",{onClick:()=>e(t-1),disabled:t<=FKr,className:"p-1.5 rounded hover:bg-neutral-800 disabled:opacity-30 text-neutral-400",children:A.jsx(xx,{className:"h-4 w-4"})}),A.jsx("span",{className:"min-w-12 text-center text-sm font-semibold text-neutral-300",children:t}),A.jsx("button",{onClick:()=>e(t+1),disabled:t>=QKr,className:"p-1.5 rounded hover:bg-neutral-800 disabled:opacity-30 text-neutral-400",children:A.jsx(hg,{className:"h-4 w-4"})})]}),l&&r&&A.jsx("select",{value:n,onChange:k=>r(k.target.value),className:"rounded-md border border-neutral-700 bg-neutral-800 px-3 py-1.5 text-sm text-white focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500",children:x.map(k=>A.jsx("option",{value:k.value,children:k.label},k.value))}),h&&p&&A.jsxs("select",{value:d,onChange:k=>p(k.target.value),className:"rounded-md border border-neutral-700 bg-neutral-800 px-3 py-1.5 text-sm text-white focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500",children:[A.jsx("option",{value:"",children:"All Providers"}),w.map(k=>A.jsx("option",{value:k.value,children:k.label},k.value))]}),u&&o&&(g.length>0?A.jsxs("select",{value:i,onChange:k=>o(k.target.value),className:"rounded-md border border-neutral-700 bg-neutral-800 px-3 py-1.5 text-sm text-white focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500",children:[A.jsx("option",{value:"",children:"All Models"}),g.map(k=>A.jsx("option",{value:k,children:k},k))]}):A.jsx("input",{type:"text",placeholder:"Filter model...",value:i,onChange:k=>o(k.target.value),className:"rounded-md border border-neutral-700 bg-neutral-800 px-3 py-1.5 text-sm text-white placeholder-neutral-500 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 w-40"})),v&&b&&A.jsxs("select",{value:f,onChange:k=>b(k.target.value),className:"rounded-md border border-neutral-700 bg-neutral-800 px-3 py-1.5 text-sm text-white focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500",children:[A.jsx("option",{value:"",children:"All Tools"}),y.map(k=>A.jsx("option",{value:k,children:k},k))]})]})}var GLe=function(t,e){return GLe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])},GLe(t,e)};function Ml(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");GLe(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}var jKr=(function(){function t(){this.firefox=!1,this.ie=!1,this.edge=!1,this.newEdge=!1,this.weChat=!1}return t})(),zKr=(function(){function t(){this.browser=new jKr,this.node=!1,this.wxa=!1,this.worker=!1,this.svgSupported=!1,this.touchEventsSupported=!1,this.pointerEventsSupported=!1,this.domSupported=!1,this.transformSupported=!1,this.transform3dSupported=!1,this.hasGlobalWindow=typeof window<"u"}return t})(),go=new zKr;typeof wx=="object"&&typeof wx.getSystemInfoSync=="function"?(go.wxa=!0,go.touchEventsSupported=!0):typeof document>"u"&&typeof self<"u"?go.worker=!0:!go.hasGlobalWindow||"Deno"in window||typeof navigator<"u"&&typeof navigator.userAgent=="string"&&navigator.userAgent.indexOf("Node.js")>-1?(go.node=!0,go.svgSupported=!0):UKr(navigator.userAgent,go);function UKr(t,e){var n=e.browser,r=t.match(/Firefox\/([\d.]+)/),i=t.match(/MSIE\s([\d.]+)/)||t.match(/Trident\/.+?rv:(([\d.]+))/),o=t.match(/Edge?\/([\d.]+)/),l=/micromessenger/i.test(t);r&&(n.firefox=!0,n.version=r[1]),i&&(n.ie=!0,n.version=i[1]),o&&(n.edge=!0,n.version=o[1],n.newEdge=+o[1].split(".")[0]>18),l&&(n.weChat=!0),e.svgSupported=typeof SVGRect<"u",e.touchEventsSupported="ontouchstart"in window&&!n.ie&&!n.edge,e.pointerEventsSupported="onpointerdown"in window&&(n.edge||n.ie&&+n.version>=11);var u=e.domSupported=typeof document<"u";if(u){var d=document.documentElement.style;e.transform3dSupported=(n.ie&&"transition"in d||n.edge||"WebKitCSSMatrix"in window&&"m11"in new WebKitCSSMatrix||"MozPerspective"in d)&&!("OTransition"in d),e.transformSupported=e.transform3dSupported||n.ie&&+n.version>=9}}var HLe=12,WPt="sans-serif",DC=HLe+"px "+WPt,qKr=20,GKr=100,HKr="007LLmW'55;N0500LLLLLLLLLL00NNNLzWW\\\\WQb\\0FWLg\\bWb\\WQ\\WrWWQ000CL5LLFLL0LL**F*gLLLL5F0LF\\FFF5.5N";function WKr(t){var e={};if(typeof JSON>"u")return e;for(var n=0;n<t.length;n++){var r=String.fromCharCode(n+32),i=(t.charCodeAt(n)-qKr)/GKr;e[r]=i}return e}var YKr=WKr(HKr),GA={createCanvas:function(){return typeof document<"u"&&document.createElement("canvas")},measureText:(function(){var t,e;return function(n,r){if(!t){var i=GA.createCanvas();t=i&&i.getContext("2d")}if(t)return e!==r&&(e=t.font=r||DC),t.measureText(n);n=n||"",r=r||DC;var o=/((?:\d+)?\.?\d*)px/.exec(r),l=o&&+o[1]||HLe,u=0;if(r.indexOf("mono")>=0)u=l*n.length;else for(var d=0;d<n.length;d++){var p=YKr[n[d]];u+=p==null?l:p*l}return{width:u}}})(),loadImage:function(t,e,n){var r=new Image;return r.onload=e,r.onerror=n,r.src=t,r}};function YPt(t){for(var e in GA)t[e]&&(GA[e]=t[e])}var VPt=mk(["Function","RegExp","Date","Error","CanvasGradient","CanvasPattern","Image","Canvas"],function(t,e){return t["[object "+e+"]"]=!0,t},{}),KPt=mk(["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64"],function(t,e){return t["[object "+e+"Array]"]=!0,t},{}),_F=Object.prototype.toString,cce=Array.prototype,VKr=cce.forEach,KKr=cce.filter,WLe=cce.slice,ZKr=cce.map,ZPt=(function(){}).constructor,uce=ZPt?ZPt.prototype:null,YLe="__proto__",XKr=2311;function VLe(){return XKr++}function D_(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];typeof console<"u"&&console.error.apply(console,t)}function ro(t){if(t==null||typeof t!="object")return t;var e=t,n=_F.call(t);if(n==="[object Array]"){if(!wF(t)){e=[];for(var r=0,i=t.length;r<i;r++)e[r]=ro(t[r])}}else if(KPt[n]){if(!wF(t)){var o=t.constructor;if(o.from)e=o.from(t);else{e=new o(t.length);for(var r=0,i=t.length;r<i;r++)e[r]=t[r]}}}else if(!VPt[n]&&!wF(t)&&!p3(t)){e={};for(var l in t)t.hasOwnProperty(l)&&l!==YLe&&(e[l]=ro(t[l]))}return e}function _c(t,e,n){if(!ai(e)||!ai(t))return n?ro(e):t;for(var r in e)if(e.hasOwnProperty(r)&&r!==YLe){var i=t[r],o=e[r];ai(o)&&ai(i)&&!fa(o)&&!fa(i)&&!p3(o)&&!p3(i)&&!ZLe(o)&&!ZLe(i)&&!wF(o)&&!wF(i)?_c(i,o,n):(n||!(r in t))&&(t[r]=ro(e[r]))}return t}function JKr(t,e){for(var n=t[0],r=1,i=t.length;r<i;r++)n=_c(n,t[r],e);return n}function ta(t,e){if(Object.assign)Object.assign(t,e);else for(var n in e)e.hasOwnProperty(n)&&n!==YLe&&(t[n]=e[n]);return t}function Yc(t,e,n){for(var r=Xs(e),i=0,o=r.length;i<o;i++){var l=r[i];(n?e[l]!=null:t[l]==null)&&(t[l]=e[l])}return t}var eZr=GA.createCanvas;function ic(t,e){if(t){if(t.indexOf)return t.indexOf(e);for(var n=0,r=t.length;n<r;n++)if(t[n]===e)return n}return-1}function KLe(t,e){var n=t.prototype;function r(){}r.prototype=e.prototype,t.prototype=new r;for(var i in n)n.hasOwnProperty(i)&&(t.prototype[i]=n[i]);t.prototype.constructor=t,t.superClass=e}function N_(t,e,n){if(t="prototype"in t?t.prototype:t,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames)for(var r=Object.getOwnPropertyNames(e),i=0;i<r.length;i++){var o=r[i];o!=="constructor"&&(n?e[o]!=null:t[o]==null)&&(t[o]=e[o])}else Yc(t,e,n)}function Pf(t){return!t||typeof t=="string"?!1:typeof t.length=="number"}function fn(t,e,n){if(t&&e)if(t.forEach&&t.forEach===VKr)t.forEach(e,n);else if(t.length===+t.length)for(var r=0,i=t.length;r<i;r++)e.call(n,t[r],r,t);else for(var o in t)t.hasOwnProperty(o)&&e.call(n,t[o],o,t)}function Ga(t,e,n){if(!t)return[];if(!e)return dce(t);if(t.map&&t.map===ZKr)return t.map(e,n);for(var r=[],i=0,o=t.length;i<o;i++)r.push(e.call(n,t[i],i,t));return r}function mk(t,e,n,r){if(t&&e){for(var i=0,o=t.length;i<o;i++)n=e.call(r,n,t[i],i,t);return n}}function fp(t,e,n){if(!t)return[];if(!e)return dce(t);if(t.filter&&t.filter===KKr)return t.filter(e,n);for(var r=[],i=0,o=t.length;i<o;i++)e.call(n,t[i],i,t)&&r.push(t[i]);return r}function tZr(t,e,n){if(t&&e){for(var r=0,i=t.length;r<i;r++)if(e.call(n,t[r],r,t))return t[r]}}function Xs(t){if(!t)return[];if(Object.keys)return Object.keys(t);var e=[];for(var n in t)t.hasOwnProperty(n)&&e.push(n);return e}function nZr(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return function(){return t.apply(e,n.concat(WLe.call(arguments)))}}var Fs=uce&&lo(uce.bind)?uce.call.bind(uce.bind):nZr;function Th(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return function(){return t.apply(this,e.concat(WLe.call(arguments)))}}function fa(t){return Array.isArray?Array.isArray(t):_F.call(t)==="[object Array]"}function lo(t){return typeof t=="function"}function Wa(t){return typeof t=="string"}function VG(t){return _F.call(t)==="[object String]"}function Rc(t){return typeof t=="number"}function ai(t){var e=typeof t;return e==="function"||!!t&&e==="object"}function ZLe(t){return!!VPt[_F.call(t)]}function Bh(t){return!!KPt[_F.call(t)]}function p3(t){return typeof t=="object"&&typeof t.nodeType=="number"&&typeof t.ownerDocument=="object"}function KG(t){return t.colorStops!=null}function XPt(t){return t.image!=null}function JPt(t){return _F.call(t)==="[object RegExp]"}function NC(t){return t!==t}function TT(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var n=0,r=t.length;n<r;n++)if(t[n]!=null)return t[n]}function ki(t,e){return t??e}function BT(t,e,n){return t??e??n}function dce(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return WLe.apply(t,e)}function pce(t){if(typeof t=="number")return[t,t,t,t];var e=t.length;return e===2?[t[0],t[1],t[0],t[1]]:e===3?[t[0],t[1],t[2],t[1]]:t}function Di(t,e){if(!t)throw new Error(e)}function R_(t){return t==null?null:typeof t.trim=="function"?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}var e5t="__ec_primitive__";function mce(t){t[e5t]=!0}function wF(t){return t[e5t]}var rZr=(function(){function t(){this.data={}}return t.prototype.delete=function(e){var n=this.has(e);return n&&delete this.data[e],n},t.prototype.has=function(e){return this.data.hasOwnProperty(e)},t.prototype.get=function(e){return this.data[e]},t.prototype.set=function(e,n){return this.data[e]=n,this},t.prototype.keys=function(){return Xs(this.data)},t.prototype.forEach=function(e){var n=this.data;for(var r in n)n.hasOwnProperty(r)&&e(n[r],r)},t})(),t5t=typeof Map=="function";function aZr(){return t5t?new Map:new rZr}var n5t=(function(){function t(e){var n=fa(e);this.data=aZr();var r=this;e instanceof t?e.each(i):e&&fn(e,i);function i(o,l){n?r.set(o,l):r.set(l,o)}}return t.prototype.hasKey=function(e){return this.data.has(e)},t.prototype.get=function(e){return this.data.get(e)},t.prototype.set=function(e,n){return this.data.set(e,n),n},t.prototype.each=function(e,n){this.data.forEach(function(r,i){e.call(n,r,i)})},t.prototype.keys=function(){var e=this.data.keys();return t5t?Array.from(e):e},t.prototype.removeKey=function(e){this.data.delete(e)},t})();function ss(t){return new n5t(t)}function r5t(t,e){for(var n=new t.constructor(t.length+e.length),r=0;r<t.length;r++)n[r]=t[r];for(var i=t.length,r=0;r<e.length;r++)n[r+i]=e[r];return n}function ZG(t,e){var n;if(Object.create)n=Object.create(t);else{var r=function(){};r.prototype=t,n=new r}return e&&ta(n,e),n}function XLe(t){var e=t.style;e.webkitUserSelect="none",e.userSelect="none",e.webkitTapHighlightColor="rgba(0,0,0,0)",e["-webkit-touch-callout"]="none"}function L_(t,e){return t.hasOwnProperty(e)}function xg(){}var XG=180/Math.PI,iZr=Number.EPSILON||Math.pow(2,-52);const oZr=Object.freeze(Object.defineProperty({__proto__:null,EPSILON:iZr,HashMap:n5t,RADIAN_TO_DEGREE:XG,assert:Di,bind:Fs,clone:ro,concatArray:r5t,createCanvas:eZr,createHashMap:ss,createObject:ZG,curry:Th,defaults:Yc,disableUserSelect:XLe,each:fn,eqNaN:NC,extend:ta,filter:fp,find:tZr,guid:VLe,hasOwn:L_,indexOf:ic,inherits:KLe,isArray:fa,isArrayLike:Pf,isBuiltInObject:ZLe,isDom:p3,isFunction:lo,isGradientObject:KG,isImagePatternObject:XPt,isNumber:Rc,isObject:ai,isPrimitive:wF,isRegExp:JPt,isString:Wa,isStringSafe:VG,isTypedArray:Bh,keys:Xs,logError:D_,map:Ga,merge:_c,mergeAll:JKr,mixin:N_,noop:xg,normalizeCssArray:pce,reduce:mk,retrieve:TT,retrieve2:ki,retrieve3:BT,setAsPrimitive:mce,slice:dce,trim:R_},Symbol.toStringTag,{value:"Module"}));var JLe=function(t,e){return JLe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])},JLe(t,e)};function oc(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");JLe(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}function m3(t,e){return t==null&&(t=0),e==null&&(e=0),[t,e]}function sZr(t,e){return t[0]=e[0],t[1]=e[1],t}function a5t(t){return[t[0],t[1]]}function lZr(t,e,n){return t[0]=e,t[1]=n,t}function e4e(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t}function cZr(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t}function i5t(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t}function t4e(t){return Math.sqrt(n4e(t))}var uZr=t4e;function n4e(t){return t[0]*t[0]+t[1]*t[1]}var dZr=n4e;function pZr(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t}function mZr(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t}function gZr(t,e){return t[0]*e[0]+t[1]*e[1]}function gce(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t}function o5t(t,e){var n=t4e(e);return n===0?(t[0]=0,t[1]=0):(t[0]=e[0]/n,t[1]=e[1]/n),t}function hce(t,e){return Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1]))}var fce=hce;function s5t(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}var g3=s5t;function hZr(t,e){return t[0]=-e[0],t[1]=-e[1],t}function Ace(t,e,n,r){return t[0]=e[0]+r*(n[0]-e[0]),t[1]=e[1]+r*(n[1]-e[1]),t}function c0(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[2]*i+n[4],t[1]=n[1]*r+n[3]*i+n[5],t}function DT(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t}function NT(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t}const fZr=Object.freeze(Object.defineProperty({__proto__:null,add:e4e,applyTransform:c0,clone:a5t,copy:sZr,create:m3,dist:fce,distSquare:g3,distance:hce,distanceSquare:s5t,div:mZr,dot:gZr,len:t4e,lenSquare:n4e,length:uZr,lengthSquare:dZr,lerp:Ace,max:NT,min:DT,mul:pZr,negate:hZr,normalize:o5t,scale:gce,scaleAndAdd:cZr,set:lZr,sub:i5t},Symbol.toStringTag,{value:"Module"}));var xF=(function(){function t(e,n){this.target=e,this.topTarget=n&&n.topTarget}return t})(),AZr=(function(){function t(e){this.handler=e,e.on("mousedown",this._dragStart,this),e.on("mousemove",this._drag,this),e.on("mouseup",this._dragEnd,this)}return t.prototype._dragStart=function(e){for(var n=e.target;n&&!n.draggable;)n=n.parent||n.__hostTarget;n&&(this._draggingTarget=n,n.dragging=!0,this._x=e.offsetX,this._y=e.offsetY,this.handler.dispatchToElement(new xF(n,e),"dragstart",e.event))},t.prototype._drag=function(e){var n=this._draggingTarget;if(n){var r=e.offsetX,i=e.offsetY,o=r-this._x,l=i-this._y;this._x=r,this._y=i,n.drift(o,l,e),this.handler.dispatchToElement(new xF(n,e),"drag",e.event);var u=this.handler.findHover(r,i,n).target,d=this._dropTarget;this._dropTarget=u,n!==u&&(d&&u!==d&&this.handler.dispatchToElement(new xF(d,e),"dragleave",e.event),u&&u!==d&&this.handler.dispatchToElement(new xF(u,e),"dragenter",e.event))}},t.prototype._dragEnd=function(e){var n=this._draggingTarget;n&&(n.dragging=!1),this.handler.dispatchToElement(new xF(n,e),"dragend",e.event),this._dropTarget&&this.handler.dispatchToElement(new xF(this._dropTarget,e),"drop",e.event),this._draggingTarget=null,this._dropTarget=null},t})(),gk=(function(){function t(e){e&&(this._$eventProcessor=e)}return t.prototype.on=function(e,n,r,i){this._$handlers||(this._$handlers={});var o=this._$handlers;if(typeof n=="function"&&(i=r,r=n,n=null),!r||!e)return this;var l=this._$eventProcessor;n!=null&&l&&l.normalizeQuery&&(n=l.normalizeQuery(n)),o[e]||(o[e]=[]);for(var u=0;u<o[e].length;u++)if(o[e][u].h===r)return this;var d={h:r,query:n,ctx:i||this,callAtLast:r.zrEventfulCallAtLast},p=o[e].length-1,m=o[e][p];return m&&m.callAtLast?o[e].splice(p,0,d):o[e].push(d),this},t.prototype.isSilent=function(e){var n=this._$handlers;return!n||!n[e]||!n[e].length},t.prototype.off=function(e,n){var r=this._$handlers;if(!r)return this;if(!e)return this._$handlers={},this;if(n){if(r[e]){for(var i=[],o=0,l=r[e].length;o<l;o++)r[e][o].h!==n&&i.push(r[e][o]);r[e]=i}r[e]&&r[e].length===0&&delete r[e]}else delete r[e];return this},t.prototype.trigger=function(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];if(!this._$handlers)return this;var i=this._$handlers[e],o=this._$eventProcessor;if(i)for(var l=n.length,u=i.length,d=0;d<u;d++){var p=i[d];if(!(o&&o.filter&&p.query!=null&&!o.filter(e,p.query)))switch(l){case 0:p.h.call(p.ctx);break;case 1:p.h.call(p.ctx,n[0]);break;case 2:p.h.call(p.ctx,n[0],n[1]);break;default:p.h.apply(p.ctx,n);break}}return o&&o.afterTrigger&&o.afterTrigger(e),this},t.prototype.triggerWithContext=function(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];if(!this._$handlers)return this;var i=this._$handlers[e],o=this._$eventProcessor;if(i)for(var l=n.length,u=n[l-1],d=i.length,p=0;p<d;p++){var m=i[p];if(!(o&&o.filter&&m.query!=null&&!o.filter(e,m.query)))switch(l){case 0:m.h.call(u);break;case 1:m.h.call(u,n[0]);break;case 2:m.h.call(u,n[0],n[1]);break;default:m.h.apply(u,n.slice(1,l-1));break}}return o&&o.afterTrigger&&o.afterTrigger(e),this},t})(),bZr=Math.log(2);function r4e(t,e,n,r,i,o){var l=r+"-"+i,u=t.length;if(o.hasOwnProperty(l))return o[l];if(e===1){var d=Math.round(Math.log((1<<u)-1&~i)/bZr);return t[n][d]}for(var p=r|1<<n,m=n+1;r&1<<m;)m++;for(var g=0,h=0,f=0;h<u;h++){var b=1<<h;b&i||(g+=(f%2?-1:1)*t[n][h]*r4e(t,e-1,m,p,i|b,o),f++)}return o[l]=g,g}function l5t(t,e){var n=[[t[0],t[1],1,0,0,0,-e[0]*t[0],-e[0]*t[1]],[0,0,0,t[0],t[1],1,-e[1]*t[0],-e[1]*t[1]],[t[2],t[3],1,0,0,0,-e[2]*t[2],-e[2]*t[3]],[0,0,0,t[2],t[3],1,-e[3]*t[2],-e[3]*t[3]],[t[4],t[5],1,0,0,0,-e[4]*t[4],-e[4]*t[5]],[0,0,0,t[4],t[5],1,-e[5]*t[4],-e[5]*t[5]],[t[6],t[7],1,0,0,0,-e[6]*t[6],-e[6]*t[7]],[0,0,0,t[6],t[7],1,-e[7]*t[6],-e[7]*t[7]]],r={},i=r4e(n,8,0,0,0,r);if(i!==0){for(var o=[],l=0;l<8;l++)for(var u=0;u<8;u++)o[u]==null&&(o[u]=0),o[u]+=((l+u)%2?-1:1)*r4e(n,7,l===0?1:0,1<<l,1<<u,r)/i*e[l];return function(d,p,m){var g=p*o[6]+m*o[7]+1;d[0]=(p*o[0]+m*o[1]+o[2])/g,d[1]=(p*o[3]+m*o[4]+o[5])/g}}}var bce="___zrEVENTSAVED",a4e=[];function yZr(t,e,n,r,i){return i4e(a4e,e,r,i,!0)&&i4e(t,n,a4e[0],a4e[1])}function vZr(t,e){t&&n(t),e&&n(e);function n(r){var i=r[bce];i&&(i.clearMarkers&&i.clearMarkers(),delete r[bce])}}function i4e(t,e,n,r,i){if(e.getBoundingClientRect&&go.domSupported&&!c5t(e)){var o=e[bce]||(e[bce]={}),l=_Zr(e,o),u=wZr(l,o,i);if(u)return u(t,n,r),!0}return!1}function _Zr(t,e){var n=e.markers;if(n)return n;n=e.markers=[];for(var r=["left","right"],i=["top","bottom"],o=0;o<4;o++){var l=document.createElement("div"),u=l.style,d=o%2,p=(o>>1)%2;u.cssText=["position: absolute","visibility: hidden","padding: 0","margin: 0","border-width: 0","user-select: none","width:0","height:0",r[d]+":0",i[p]+":0",r[1-d]+":auto",i[1-p]+":auto",""].join("!important;"),t.appendChild(l),n.push(l)}return e.clearMarkers=function(){fn(n,function(m){m.parentNode&&m.parentNode.removeChild(m)})},n}function wZr(t,e,n){for(var r=n?"invTrans":"trans",i=e[r],o=e.srcCoords,l=[],u=[],d=!0,p=0;p<4;p++){var m=t[p].getBoundingClientRect(),g=2*p,h=m.left,f=m.top;l.push(h,f),d=d&&o&&h===o[g]&&f===o[g+1],u.push(t[p].offsetLeft,t[p].offsetTop)}return d&&i?i:(e.srcCoords=l,e[r]=n?l5t(u,l):l5t(l,u))}function c5t(t){return t.nodeName.toUpperCase()==="CANVAS"}var xZr=/([&<>"'])/g,kZr={"&":"&","<":"<",">":">",'"':""","'":"'"};function Dh(t){return t==null?"":(t+"").replace(xZr,function(e,n){return kZr[n]})}var EZr=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,o4e=[],CZr=go.browser.firefox&&+go.browser.version.split(".")[0]<39;function s4e(t,e,n,r){return n=n||{},r?u5t(t,e,n):CZr&&e.layerX!=null&&e.layerX!==e.offsetX?(n.zrX=e.layerX,n.zrY=e.layerY):e.offsetX!=null?(n.zrX=e.offsetX,n.zrY=e.offsetY):u5t(t,e,n),n}function u5t(t,e,n){if(go.domSupported&&t.getBoundingClientRect){var r=e.clientX,i=e.clientY;if(c5t(t)){var o=t.getBoundingClientRect();n.zrX=r-o.left,n.zrY=i-o.top;return}else if(i4e(o4e,t,r,i)){n.zrX=o4e[0],n.zrY=o4e[1];return}}n.zrX=n.zrY=0}function l4e(t){return t||window.event}function Ry(t,e,n){if(e=l4e(e),e.zrX!=null)return e;var r=e.type,i=r&&r.indexOf("touch")>=0;if(i){var l=r!=="touchend"?e.targetTouches[0]:e.changedTouches[0];l&&s4e(t,l,e,n)}else{s4e(t,e,e,n);var o=SZr(e);e.zrDelta=o?o/120:-(e.detail||0)/3}var u=e.button;return e.which==null&&u!==void 0&&EZr.test(e.type)&&(e.which=u&1?1:u&2?3:u&4?2:0),e}function SZr(t){var e=t.wheelDelta;if(e)return e;var n=t.deltaX,r=t.deltaY;if(n==null||r==null)return e;var i=Math.abs(r!==0?r:n),o=r>0?-1:r<0?1:n>0?-1:1;return 3*i*o}function IZr(t,e,n,r){t.addEventListener(e,n,r)}function TZr(t,e,n,r){t.removeEventListener(e,n,r)}var d5t=function(t){t.preventDefault(),t.stopPropagation(),t.cancelBubble=!0},BZr=(function(){function t(){this._track=[]}return t.prototype.recognize=function(e,n,r){return this._doTrack(e,n,r),this._recognize(e)},t.prototype.clear=function(){return this._track.length=0,this},t.prototype._doTrack=function(e,n,r){var i=e.touches;if(i){for(var o={points:[],touches:[],target:n,event:e},l=0,u=i.length;l<u;l++){var d=i[l],p=s4e(r,d,{});o.points.push([p.zrX,p.zrY]),o.touches.push(d)}this._track.push(o)}},t.prototype._recognize=function(e){for(var n in c4e)if(c4e.hasOwnProperty(n)){var r=c4e[n](this._track,e);if(r)return r}},t})();function p5t(t){var e=t[1][0]-t[0][0],n=t[1][1]-t[0][1];return Math.sqrt(e*e+n*n)}function DZr(t){return[(t[0][0]+t[1][0])/2,(t[0][1]+t[1][1])/2]}var c4e={pinch:function(t,e){var n=t.length;if(n){var r=(t[n-1]||{}).points,i=(t[n-2]||{}).points||r;if(i&&i.length>1&&r&&r.length>1){var o=p5t(r)/p5t(i);!isFinite(o)&&(o=1),e.pinchScale=o;var l=DZr(r);return e.pinchX=l[0],e.pinchY=l[1],{type:"pinch",target:t[0].target,event:e}}}}};function M_(){return[1,0,0,1,0,0]}function JG(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t}function yce(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t}function h3(t,e,n){var r=e[0]*n[0]+e[2]*n[1],i=e[1]*n[0]+e[3]*n[1],o=e[0]*n[2]+e[2]*n[3],l=e[1]*n[2]+e[3]*n[3],u=e[0]*n[4]+e[2]*n[5]+e[4],d=e[1]*n[4]+e[3]*n[5]+e[5];return t[0]=r,t[1]=i,t[2]=o,t[3]=l,t[4]=u,t[5]=d,t}function vce(t,e,n){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4]+n[0],t[5]=e[5]+n[1],t}function _ce(t,e,n,r){r===void 0&&(r=[0,0]);var i=e[0],o=e[2],l=e[4],u=e[1],d=e[3],p=e[5],m=Math.sin(n),g=Math.cos(n);return t[0]=i*g+u*m,t[1]=-i*m+u*g,t[2]=o*g+d*m,t[3]=-o*m+g*d,t[4]=g*(l-r[0])+m*(p-r[1])+r[0],t[5]=g*(p-r[1])-m*(l-r[0])+r[1],t}function m5t(t,e,n){var r=n[0],i=n[1];return t[0]=e[0]*r,t[1]=e[1]*i,t[2]=e[2]*r,t[3]=e[3]*i,t[4]=e[4]*r,t[5]=e[5]*i,t}function kF(t,e){var n=e[0],r=e[2],i=e[4],o=e[1],l=e[3],u=e[5],d=n*l-o*r;return d?(d=1/d,t[0]=l*d,t[1]=-o*d,t[2]=-r*d,t[3]=n*d,t[4]=(r*u-l*i)*d,t[5]=(o*i-n*u)*d,t):null}function NZr(t){var e=M_();return yce(e,t),e}const RZr=Object.freeze(Object.defineProperty({__proto__:null,clone:NZr,copy:yce,create:M_,identity:JG,invert:kF,mul:h3,rotate:_ce,scale:m5t,translate:vce},Symbol.toStringTag,{value:"Module"}));var Io=(function(){function t(e,n){this.x=e||0,this.y=n||0}return t.prototype.copy=function(e){return this.x=e.x,this.y=e.y,this},t.prototype.clone=function(){return new t(this.x,this.y)},t.prototype.set=function(e,n){return this.x=e,this.y=n,this},t.prototype.equal=function(e){return e.x===this.x&&e.y===this.y},t.prototype.add=function(e){return this.x+=e.x,this.y+=e.y,this},t.prototype.scale=function(e){this.x*=e,this.y*=e},t.prototype.scaleAndAdd=function(e,n){this.x+=e.x*n,this.y+=e.y*n},t.prototype.sub=function(e){return this.x-=e.x,this.y-=e.y,this},t.prototype.dot=function(e){return this.x*e.x+this.y*e.y},t.prototype.len=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},t.prototype.lenSquare=function(){return this.x*this.x+this.y*this.y},t.prototype.normalize=function(){var e=this.len();return this.x/=e,this.y/=e,this},t.prototype.distance=function(e){var n=this.x-e.x,r=this.y-e.y;return Math.sqrt(n*n+r*r)},t.prototype.distanceSquare=function(e){var n=this.x-e.x,r=this.y-e.y;return n*n+r*r},t.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this},t.prototype.transform=function(e){if(e){var n=this.x,r=this.y;return this.x=e[0]*n+e[2]*r+e[4],this.y=e[1]*n+e[3]*r+e[5],this}},t.prototype.toArray=function(e){return e[0]=this.x,e[1]=this.y,e},t.prototype.fromArray=function(e){this.x=e[0],this.y=e[1]},t.set=function(e,n,r){e.x=n,e.y=r},t.copy=function(e,n){e.x=n.x,e.y=n.y},t.len=function(e){return Math.sqrt(e.x*e.x+e.y*e.y)},t.lenSquare=function(e){return e.x*e.x+e.y*e.y},t.dot=function(e,n){return e.x*n.x+e.y*n.y},t.add=function(e,n,r){e.x=n.x+r.x,e.y=n.y+r.y},t.sub=function(e,n,r){e.x=n.x-r.x,e.y=n.y-r.y},t.scale=function(e,n,r){e.x=n.x*r,e.y=n.y*r},t.scaleAndAdd=function(e,n,r,i){e.x=n.x+r.x*i,e.y=n.y+r.y*i},t.lerp=function(e,n,r,i){var o=1-i;e.x=o*n.x+i*r.x,e.y=o*n.y+i*r.y},t})(),f3=Math.min,EF=Math.max,u4e=Math.abs,g5t=["x","y"],LZr=["width","height"],A3=new Io,b3=new Io,y3=new Io,v3=new Io,u0=f5t(),eH=u0.minTv,d4e=u0.maxTv,tH=[0,0],Bo=(function(){function t(e,n,r,i){t.set(this,e,n,r,i)}return t.set=function(e,n,r,i,o){return i<0&&(n=n+i,i=-i),o<0&&(r=r+o,o=-o),e.x=n,e.y=r,e.width=i,e.height=o,e},t.prototype.union=function(e){var n=f3(e.x,this.x),r=f3(e.y,this.y);isFinite(this.x)&&isFinite(this.width)?this.width=EF(e.x+e.width,this.x+this.width)-n:this.width=e.width,isFinite(this.y)&&isFinite(this.height)?this.height=EF(e.y+e.height,this.y+this.height)-r:this.height=e.height,this.x=n,this.y=r},t.prototype.applyTransform=function(e){t.applyTransform(this,this,e)},t.prototype.calculateTransform=function(e){var n=this,r=e.width/n.width,i=e.height/n.height,o=M_();return vce(o,o,[-n.x,-n.y]),m5t(o,o,[r,i]),vce(o,o,[e.x,e.y]),o},t.prototype.intersect=function(e,n,r){return t.intersect(this,e,n,r)},t.intersect=function(e,n,r,i){r&&Io.set(r,0,0);var o=i&&i.outIntersectRect||null,l=i&&i.clamp;if(o&&(o.x=o.y=o.width=o.height=NaN),!e||!n)return!1;e instanceof t||(e=t.set(MZr,e.x,e.y,e.width,e.height)),n instanceof t||(n=t.set(PZr,n.x,n.y,n.width,n.height));var u=!!r;u0.reset(i,u);var d=u0.touchThreshold,p=e.x+d,m=e.x+e.width-d,g=e.y+d,h=e.y+e.height-d,f=n.x+d,b=n.x+n.width-d,y=n.y+d,v=n.y+n.height-d;if(p>m||g>h||f>b||y>v)return!1;var _=!(m<f||b<p||h<y||v<g);return(u||o)&&(tH[0]=1/0,tH[1]=0,h5t(p,m,f,b,0,u,o,l),h5t(g,h,y,v,1,u,o,l),u&&Io.copy(r,_?u0.useDir?u0.dirMinTv:eH:d4e)),_},t.contain=function(e,n,r){return n>=e.x&&n<=e.x+e.width&&r>=e.y&&r<=e.y+e.height},t.prototype.contain=function(e,n){return t.contain(this,e,n)},t.prototype.clone=function(){return new t(this.x,this.y,this.width,this.height)},t.prototype.copy=function(e){t.copy(this,e)},t.prototype.plain=function(){return{x:this.x,y:this.y,width:this.width,height:this.height}},t.prototype.isFinite=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)},t.prototype.isZero=function(){return this.width===0||this.height===0},t.create=function(e){return new t(e.x,e.y,e.width,e.height)},t.copy=function(e,n){return e.x=n.x,e.y=n.y,e.width=n.width,e.height=n.height,e},t.applyTransform=function(e,n,r){if(!r){e!==n&&t.copy(e,n);return}if(r[1]<1e-5&&r[1]>-1e-5&&r[2]<1e-5&&r[2]>-1e-5){var i=r[0],o=r[3],l=r[4],u=r[5];e.x=n.x*i+l,e.y=n.y*o+u,e.width=n.width*i,e.height=n.height*o,e.width<0&&(e.x+=e.width,e.width=-e.width),e.height<0&&(e.y+=e.height,e.height=-e.height);return}A3.x=y3.x=n.x,A3.y=v3.y=n.y,b3.x=v3.x=n.x+n.width,b3.y=y3.y=n.y+n.height,A3.transform(r),v3.transform(r),b3.transform(r),y3.transform(r),e.x=f3(A3.x,b3.x,y3.x,v3.x),e.y=f3(A3.y,b3.y,y3.y,v3.y);var d=EF(A3.x,b3.x,y3.x,v3.x),p=EF(A3.y,b3.y,y3.y,v3.y);e.width=d-e.x,e.height=p-e.y},t})(),MZr=new Bo(0,0,0,0),PZr=new Bo(0,0,0,0);function h5t(t,e,n,r,i,o,l,u){var d=u4e(e-n),p=u4e(r-t),m=f3(d,p),g=g5t[i],h=g5t[1-i],f=LZr[i];e<n||r<t?d<p?(o&&(d4e[g]=-d),u&&(l[g]=e,l[f]=0)):(o&&(d4e[g]=p),u&&(l[g]=t,l[f]=0)):(l&&(l[g]=EF(t,n),l[f]=f3(e,r)-l[g]),o&&(m<tH[0]||u0.useDir)&&(tH[0]=f3(m,tH[0]),(d<p||!u0.bidirectional)&&(eH[g]=d,eH[h]=0,u0.useDir&&u0.calcDirMTV()),(d>=p||!u0.bidirectional)&&(eH[g]=-p,eH[h]=0,u0.useDir&&u0.calcDirMTV())))}function f5t(){var t=0,e=new Io,n=new Io,r={minTv:new Io,maxTv:new Io,useDir:!1,dirMinTv:new Io,touchThreshold:0,bidirectional:!0,negativeSize:!1,reset:function(o,l){r.touchThreshold=0,o&&o.touchThreshold!=null&&(r.touchThreshold=EF(0,o.touchThreshold)),r.negativeSize=!1,l&&(r.minTv.set(1/0,1/0),r.maxTv.set(0,0),r.useDir=!1,o&&o.direction!=null&&(r.useDir=!0,r.dirMinTv.copy(r.minTv),n.copy(r.minTv),t=o.direction,r.bidirectional=o.bidirectional==null||!!o.bidirectional,r.bidirectional||e.set(Math.cos(t),Math.sin(t))))},calcDirMTV:function(){var o=r.minTv,l=r.dirMinTv,u=o.y*o.y+o.x*o.x,d=Math.sin(t),p=Math.cos(t),m=d*o.y+p*o.x;if(i(m)){i(o.x)&&i(o.y)&&l.set(0,0);return}if(n.x=u*p/m,n.y=u*d/m,i(n.x)&&i(n.y)){l.set(0,0);return}(r.bidirectional||e.dot(n)>0)&&n.len()<l.len()&&l.copy(n)}};function i(o){return u4e(o)<1e-10}return r}var A5t="silent";function OZr(t,e,n){return{type:t,event:n,target:e.target,topTarget:e.topTarget,cancelBubble:!1,offsetX:n.zrX,offsetY:n.zrY,gestureEvent:n.gestureEvent,pinchX:n.pinchX,pinchY:n.pinchY,pinchScale:n.pinchScale,wheelDelta:n.zrDelta,zrByTouch:n.zrByTouch,which:n.which,stop:FZr}}function FZr(){d5t(this.event)}var QZr=(function(t){oc(e,t);function e(){var n=t!==null&&t.apply(this,arguments)||this;return n.handler=null,n}return e.prototype.dispose=function(){},e.prototype.setCursor=function(){},e})(gk),nH=(function(){function t(e,n){this.x=e,this.y=n}return t})(),$Zr=["click","dblclick","mousewheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],p4e=new Bo(0,0,0,0),b5t=(function(t){oc(e,t);function e(n,r,i,o,l){var u=t.call(this)||this;return u._hovered=new nH(0,0),u.storage=n,u.painter=r,u.painterRoot=o,u._pointerSize=l,i=i||new QZr,u.proxy=null,u.setHandlerProxy(i),u._draggingMgr=new AZr(u),u}return e.prototype.setHandlerProxy=function(n){this.proxy&&this.proxy.dispose(),n&&(fn($Zr,function(r){n.on&&n.on(r,this[r],this)},this),n.handler=this),this.proxy=n},e.prototype.mousemove=function(n){var r=n.zrX,i=n.zrY,o=v5t(this,r,i),l=this._hovered,u=l.target;u&&!u.__zr&&(l=this.findHover(l.x,l.y),u=l.target);var d=this._hovered=o?new nH(r,i):this.findHover(r,i),p=d.target,m=this.proxy;m.setCursor&&m.setCursor(p?p.cursor:"default"),u&&p!==u&&this.dispatchToElement(l,"mouseout",n),this.dispatchToElement(d,"mousemove",n),p&&p!==u&&this.dispatchToElement(d,"mouseover",n)},e.prototype.mouseout=function(n){var r=n.zrEventControl;r!=="only_globalout"&&this.dispatchToElement(this._hovered,"mouseout",n),r!=="no_globalout"&&this.trigger("globalout",{type:"globalout",event:n})},e.prototype.resize=function(){this._hovered=new nH(0,0)},e.prototype.dispatch=function(n,r){var i=this[n];i&&i.call(this,r)},e.prototype.dispose=function(){this.proxy.dispose(),this.storage=null,this.proxy=null,this.painter=null},e.prototype.setCursorStyle=function(n){var r=this.proxy;r.setCursor&&r.setCursor(n)},e.prototype.dispatchToElement=function(n,r,i){n=n||{};var o=n.target;if(!(o&&o.silent)){for(var l="on"+r,u=OZr(r,n,i);o&&(o[l]&&(u.cancelBubble=!!o[l].call(o,u)),o.trigger(r,u),o=o.__hostTarget?o.__hostTarget:o.parent,!u.cancelBubble););u.cancelBubble||(this.trigger(r,u),this.painter&&this.painter.eachOtherLayer&&this.painter.eachOtherLayer(function(d){typeof d[l]=="function"&&d[l].call(d,u),d.trigger&&d.trigger(r,u)}))}},e.prototype.findHover=function(n,r,i){var o=this.storage.getDisplayList(),l=new nH(n,r);if(y5t(o,l,n,r,i),this._pointerSize&&!l.target){for(var u=[],d=this._pointerSize,p=d/2,m=new Bo(n-p,r-p,d,d),g=o.length-1;g>=0;g--){var h=o[g];h!==i&&!h.ignore&&!h.ignoreCoarsePointer&&(!h.parent||!h.parent.ignoreCoarsePointer)&&(p4e.copy(h.getBoundingRect()),h.transform&&p4e.applyTransform(h.transform),p4e.intersect(m)&&u.push(h))}if(u.length)for(var f=4,b=Math.PI/12,y=Math.PI*2,v=0;v<p;v+=f)for(var _=0;_<y;_+=b){var w=n+v*Math.cos(_),x=r+v*Math.sin(_);if(y5t(u,l,w,x,i),l.target)return l}}return l},e.prototype.processGesture=function(n,r){this._gestureMgr||(this._gestureMgr=new BZr);var i=this._gestureMgr;r==="start"&&i.clear();var o=i.recognize(n,this.findHover(n.zrX,n.zrY,null).target,this.proxy.dom);if(r==="end"&&i.clear(),o){var l=o.type;n.gestureEvent=l;var u=new nH;u.target=o.target,this.dispatchToElement(u,l,o.event)}},e})(gk);fn(["click","mousedown","mouseup","mousewheel","dblclick","contextmenu"],function(t){b5t.prototype[t]=function(e){var n=e.zrX,r=e.zrY,i=v5t(this,n,r),o,l;if((t!=="mouseup"||!i)&&(o=this.findHover(n,r),l=o.target),t==="mousedown")this._downEl=l,this._downPoint=[e.zrX,e.zrY],this._upEl=l;else if(t==="mouseup")this._upEl=l;else if(t==="click"){if(this._downEl!==this._upEl||!this._downPoint||fce(this._downPoint,[e.zrX,e.zrY])>4)return;this._downPoint=null}this.dispatchToElement(o,t,e)}});function jZr(t,e,n){if(t[t.rectHover?"rectContain":"contain"](e,n)){for(var r=t,i=void 0,o=!1;r;){if(r.ignoreClip&&(o=!0),!o){var l=r.getClipPath();if(l&&!l.contain(e,n))return!1}r.silent&&(i=!0);var u=r.__hostTarget;r=u?r.ignoreHostSilent?null:u:r.parent}return i?A5t:!0}return!1}function y5t(t,e,n,r,i){for(var o=t.length-1;o>=0;o--){var l=t[o],u=void 0;if(l!==i&&!l.ignore&&(u=jZr(l,n,r))&&(!e.topTarget&&(e.topTarget=l),u!==A5t)){e.target=l;break}}}function v5t(t,e,n){var r=t.painter;return e<0||e>r.getWidth()||n<0||n>r.getHeight()}var _5t=32,rH=7;function zZr(t){for(var e=0;t>=_5t;)e|=t&1,t>>=1;return t+e}function w5t(t,e,n,r){var i=e+1;if(i===n)return 1;if(r(t[i++],t[e])<0){for(;i<n&&r(t[i],t[i-1])<0;)i++;UZr(t,e,i)}else for(;i<n&&r(t[i],t[i-1])>=0;)i++;return i-e}function UZr(t,e,n){for(n--;e<n;){var r=t[e];t[e++]=t[n],t[n--]=r}}function x5t(t,e,n,r,i){for(r===e&&r++;r<n;r++){for(var o=t[r],l=e,u=r,d;l<u;)d=l+u>>>1,i(o,t[d])<0?u=d:l=d+1;var p=r-l;switch(p){case 3:t[l+3]=t[l+2];case 2:t[l+2]=t[l+1];case 1:t[l+1]=t[l];break;default:for(;p>0;)t[l+p]=t[l+p-1],p--}t[l]=o}}function m4e(t,e,n,r,i,o){var l=0,u=0,d=1;if(o(t,e[n+i])>0){for(u=r-i;d<u&&o(t,e[n+i+d])>0;)l=d,d=(d<<1)+1,d<=0&&(d=u);d>u&&(d=u),l+=i,d+=i}else{for(u=i+1;d<u&&o(t,e[n+i-d])<=0;)l=d,d=(d<<1)+1,d<=0&&(d=u);d>u&&(d=u);var p=l;l=i-d,d=i-p}for(l++;l<d;){var m=l+(d-l>>>1);o(t,e[n+m])>0?l=m+1:d=m}return d}function g4e(t,e,n,r,i,o){var l=0,u=0,d=1;if(o(t,e[n+i])<0){for(u=i+1;d<u&&o(t,e[n+i-d])<0;)l=d,d=(d<<1)+1,d<=0&&(d=u);d>u&&(d=u);var p=l;l=i-d,d=i-p}else{for(u=r-i;d<u&&o(t,e[n+i+d])>=0;)l=d,d=(d<<1)+1,d<=0&&(d=u);d>u&&(d=u),l+=i,d+=i}for(l++;l<d;){var m=l+(d-l>>>1);o(t,e[n+m])<0?d=m:l=m+1}return d}function qZr(t,e){var n=rH,r,i,o=0,l=[];r=[],i=[];function u(f,b){r[o]=f,i[o]=b,o+=1}function d(){for(;o>1;){var f=o-2;if(f>=1&&i[f-1]<=i[f]+i[f+1]||f>=2&&i[f-2]<=i[f]+i[f-1])i[f-1]<i[f+1]&&f--;else if(i[f]>i[f+1])break;m(f)}}function p(){for(;o>1;){var f=o-2;f>0&&i[f-1]<i[f+1]&&f--,m(f)}}function m(f){var b=r[f],y=i[f],v=r[f+1],_=i[f+1];i[f]=y+_,f===o-3&&(r[f+1]=r[f+2],i[f+1]=i[f+2]),o--;var w=g4e(t[v],t,b,y,0,e);b+=w,y-=w,y!==0&&(_=m4e(t[b+y-1],t,v,_,_-1,e),_!==0&&(y<=_?g(b,y,v,_):h(b,y,v,_)))}function g(f,b,y,v){var _=0;for(_=0;_<b;_++)l[_]=t[f+_];var w=0,x=y,k=f;if(t[k++]=t[x++],--v===0){for(_=0;_<b;_++)t[k+_]=l[w+_];return}if(b===1){for(_=0;_<v;_++)t[k+_]=t[x+_];t[k+v]=l[w];return}for(var C=n,E,S,I;;){E=0,S=0,I=!1;do if(e(t[x],l[w])<0){if(t[k++]=t[x++],S++,E=0,--v===0){I=!0;break}}else if(t[k++]=l[w++],E++,S=0,--b===1){I=!0;break}while((E|S)<C);if(I)break;do{if(E=g4e(t[x],l,w,b,0,e),E!==0){for(_=0;_<E;_++)t[k+_]=l[w+_];if(k+=E,w+=E,b-=E,b<=1){I=!0;break}}if(t[k++]=t[x++],--v===0){I=!0;break}if(S=m4e(l[w],t,x,v,0,e),S!==0){for(_=0;_<S;_++)t[k+_]=t[x+_];if(k+=S,x+=S,v-=S,v===0){I=!0;break}}if(t[k++]=l[w++],--b===1){I=!0;break}C--}while(E>=rH||S>=rH);if(I)break;C<0&&(C=0),C+=2}if(n=C,n<1&&(n=1),b===1){for(_=0;_<v;_++)t[k+_]=t[x+_];t[k+v]=l[w]}else{if(b===0)throw new Error;for(_=0;_<b;_++)t[k+_]=l[w+_]}}function h(f,b,y,v){var _=0;for(_=0;_<v;_++)l[_]=t[y+_];var w=f+b-1,x=v-1,k=y+v-1,C=0,E=0;if(t[k--]=t[w--],--b===0){for(C=k-(v-1),_=0;_<v;_++)t[C+_]=l[_];return}if(v===1){for(k-=b,w-=b,E=k+1,C=w+1,_=b-1;_>=0;_--)t[E+_]=t[C+_];t[k]=l[x];return}for(var S=n;;){var I=0,B=0,R=!1;do if(e(l[x],t[w])<0){if(t[k--]=t[w--],I++,B=0,--b===0){R=!0;break}}else if(t[k--]=l[x--],B++,I=0,--v===1){R=!0;break}while((I|B)<S);if(R)break;do{if(I=b-g4e(l[x],t,f,b,b-1,e),I!==0){for(k-=I,w-=I,b-=I,E=k+1,C=w+1,_=I-1;_>=0;_--)t[E+_]=t[C+_];if(b===0){R=!0;break}}if(t[k--]=l[x--],--v===1){R=!0;break}if(B=v-m4e(t[w],l,0,v,v-1,e),B!==0){for(k-=B,x-=B,v-=B,E=k+1,C=x+1,_=0;_<B;_++)t[E+_]=l[C+_];if(v<=1){R=!0;break}}if(t[k--]=t[w--],--b===0){R=!0;break}S--}while(I>=rH||B>=rH);if(R)break;S<0&&(S=0),S+=2}if(n=S,n<1&&(n=1),v===1){for(k-=b,w-=b,E=k+1,C=w+1,_=b-1;_>=0;_--)t[E+_]=t[C+_];t[k]=l[x]}else{if(v===0)throw new Error;for(C=k-(v-1),_=0;_<v;_++)t[C+_]=l[_]}}return{mergeRuns:d,forceMergeRuns:p,pushRun:u}}function wce(t,e,n,r){n||(n=0),r||(r=t.length);var i=r-n;if(!(i<2)){var o=0;if(i<_5t){o=w5t(t,n,r,e),x5t(t,n,r,n+o,e);return}var l=qZr(t,e),u=zZr(i);do{if(o=w5t(t,n,r,e),o<u){var d=i;d>u&&(d=u),x5t(t,n,n+d,n+o,e),o=d}l.pushRun(n,o),l.mergeRuns(),i-=o,n+=o}while(i!==0);l.forceMergeRuns()}}var d0=1,aH=2,CF=4,k5t=!1;function h4e(){k5t||(k5t=!0,console.warn("z / z2 / zlevel of displayable is invalid, which may cause unexpected errors"))}function E5t(t,e){return t.zlevel===e.zlevel?t.z===e.z?t.z2-e.z2:t.z-e.z:t.zlevel-e.zlevel}var GZr=(function(){function t(){this._roots=[],this._displayList=[],this._displayListLen=0,this.displayableSortFunc=E5t}return t.prototype.traverse=function(e,n){for(var r=0;r<this._roots.length;r++)this._roots[r].traverse(e,n)},t.prototype.getDisplayList=function(e,n){n=n||!1;var r=this._displayList;return(e||!r.length)&&this.updateDisplayList(n),r},t.prototype.updateDisplayList=function(e){this._displayListLen=0;for(var n=this._roots,r=this._displayList,i=0,o=n.length;i<o;i++)this._updateAndAddDisplayable(n[i],null,e);r.length=this._displayListLen,wce(r,E5t)},t.prototype._updateAndAddDisplayable=function(e,n,r){if(!(e.ignore&&!r)){e.beforeUpdate(),e.update(),e.afterUpdate();var i=e.getClipPath(),o=n&&n.length,l=0,u=e.__clipPaths;if(!e.ignoreClip&&(o||i)){if(u||(u=e.__clipPaths=[]),o)for(var d=0;d<n.length;d++)u[l++]=n[d];for(var p=i,m=e;p;)p.parent=m,p.updateTransform(),u[l++]=p,m=p,p=p.getClipPath()}if(u&&(u.length=l),e.childrenRef){for(var g=e.childrenRef(),h=0;h<g.length;h++){var f=g[h];e.__dirty&&(f.__dirty|=d0),this._updateAndAddDisplayable(f,u,r)}e.__dirty=0}else{var b=e;isNaN(b.z)&&(h4e(),b.z=0),isNaN(b.z2)&&(h4e(),b.z2=0),isNaN(b.zlevel)&&(h4e(),b.zlevel=0),this._displayList[this._displayListLen++]=b}var y=e.getDecalElement&&e.getDecalElement();y&&this._updateAndAddDisplayable(y,u,r);var v=e.getTextGuideLine();v&&this._updateAndAddDisplayable(v,u,r);var _=e.getTextContent();_&&this._updateAndAddDisplayable(_,u,r)}},t.prototype.addRoot=function(e){e.__zr&&e.__zr.storage===this||this._roots.push(e)},t.prototype.delRoot=function(e){if(e instanceof Array){for(var n=0,r=e.length;n<r;n++)this.delRoot(e[n]);return}var i=ic(this._roots,e);i>=0&&this._roots.splice(i,1)},t.prototype.delAllRoots=function(){this._roots=[],this._displayList=[],this._displayListLen=0},t.prototype.getRoots=function(){return this._roots},t.prototype.dispose=function(){this._displayList=null,this._roots=null},t})(),xce;xce=go.hasGlobalWindow&&(window.requestAnimationFrame&&window.requestAnimationFrame.bind(window)||window.msRequestAnimationFrame&&window.msRequestAnimationFrame.bind(window)||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame)||function(t){return setTimeout(t,16)};var iH={linear:function(t){return t},quadraticIn:function(t){return t*t},quadraticOut:function(t){return t*(2-t)},quadraticInOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)},cubicIn:function(t){return t*t*t},cubicOut:function(t){return--t*t*t+1},cubicInOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)},quarticIn:function(t){return t*t*t*t},quarticOut:function(t){return 1- --t*t*t*t},quarticInOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)},quinticIn:function(t){return t*t*t*t*t},quinticOut:function(t){return--t*t*t*t*t+1},quinticInOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)},sinusoidalIn:function(t){return 1-Math.cos(t*Math.PI/2)},sinusoidalOut:function(t){return Math.sin(t*Math.PI/2)},sinusoidalInOut:function(t){return .5*(1-Math.cos(Math.PI*t))},exponentialIn:function(t){return t===0?0:Math.pow(1024,t-1)},exponentialOut:function(t){return t===1?1:1-Math.pow(2,-10*t)},exponentialInOut:function(t){return t===0?0:t===1?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(-Math.pow(2,-10*(t-1))+2)},circularIn:function(t){return 1-Math.sqrt(1-t*t)},circularOut:function(t){return Math.sqrt(1- --t*t)},circularInOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},elasticIn:function(t){var e,n=.1,r=.4;return t===0?0:t===1?1:(!n||n<1?(n=1,e=r/4):e=r*Math.asin(1/n)/(2*Math.PI),-(n*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/r)))},elasticOut:function(t){var e,n=.1,r=.4;return t===0?0:t===1?1:(!n||n<1?(n=1,e=r/4):e=r*Math.asin(1/n)/(2*Math.PI),n*Math.pow(2,-10*t)*Math.sin((t-e)*(2*Math.PI)/r)+1)},elasticInOut:function(t){var e,n=.1,r=.4;return t===0?0:t===1?1:(!n||n<1?(n=1,e=r/4):e=r*Math.asin(1/n)/(2*Math.PI),(t*=2)<1?-.5*(n*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/r)):n*Math.pow(2,-10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/r)*.5+1)},backIn:function(t){var e=1.70158;return t*t*((e+1)*t-e)},backOut:function(t){var e=1.70158;return--t*t*((e+1)*t+e)+1},backInOut:function(t){var e=2.5949095;return(t*=2)<1?.5*(t*t*((e+1)*t-e)):.5*((t-=2)*t*((e+1)*t+e)+2)},bounceIn:function(t){return 1-iH.bounceOut(1-t)},bounceOut:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},bounceInOut:function(t){return t<.5?iH.bounceIn(t*2)*.5:iH.bounceOut(t*2-1)*.5+.5}},kce=Math.pow,RT=Math.sqrt,Ece=1e-8,C5t=1e-4,S5t=RT(3),Cce=1/3,hk=m3(),Ly=m3(),SF=m3();function LT(t){return t>-Ece&&t<Ece}function I5t(t){return t>Ece||t<-Ece}function Of(t,e,n,r,i){var o=1-i;return o*o*(o*t+3*i*e)+i*i*(i*r+3*o*n)}function T5t(t,e,n,r,i){var o=1-i;return 3*(((e-t)*o+2*(n-e)*i)*o+(r-n)*i*i)}function B5t(t,e,n,r,i,o){var l=r+3*(e-n)-t,u=3*(n-e*2+t),d=3*(e-t),p=t-i,m=u*u-3*l*d,g=u*d-9*l*p,h=d*d-3*u*p,f=0;if(LT(m)&<(g))if(LT(u))o[0]=0;else{var b=-d/u;b>=0&&b<=1&&(o[f++]=b)}else{var y=g*g-4*m*h;if(LT(y)){var v=g/m,b=-u/l+v,_=-v/2;b>=0&&b<=1&&(o[f++]=b),_>=0&&_<=1&&(o[f++]=_)}else if(y>0){var w=RT(y),x=m*u+1.5*l*(-g+w),k=m*u+1.5*l*(-g-w);x<0?x=-kce(-x,Cce):x=kce(x,Cce),k<0?k=-kce(-k,Cce):k=kce(k,Cce);var b=(-u-(x+k))/(3*l);b>=0&&b<=1&&(o[f++]=b)}else{var C=(2*m*u-3*l*g)/(2*RT(m*m*m)),E=Math.acos(C)/3,S=RT(m),I=Math.cos(E),b=(-u-2*S*I)/(3*l),_=(-u+S*(I+S5t*Math.sin(E)))/(3*l),B=(-u+S*(I-S5t*Math.sin(E)))/(3*l);b>=0&&b<=1&&(o[f++]=b),_>=0&&_<=1&&(o[f++]=_),B>=0&&B<=1&&(o[f++]=B)}}return f}function D5t(t,e,n,r,i){var o=6*n-12*e+6*t,l=9*e+3*r-3*t-9*n,u=3*e-3*t,d=0;if(LT(l)){if(I5t(o)){var p=-u/o;p>=0&&p<=1&&(i[d++]=p)}}else{var m=o*o-4*l*u;if(LT(m))i[0]=-o/(2*l);else if(m>0){var g=RT(m),p=(-o+g)/(2*l),h=(-o-g)/(2*l);p>=0&&p<=1&&(i[d++]=p),h>=0&&h<=1&&(i[d++]=h)}}return d}function Sce(t,e,n,r,i,o){var l=(e-t)*i+t,u=(n-e)*i+e,d=(r-n)*i+n,p=(u-l)*i+l,m=(d-u)*i+u,g=(m-p)*i+p;o[0]=t,o[1]=l,o[2]=p,o[3]=g,o[4]=g,o[5]=m,o[6]=d,o[7]=r}function HZr(t,e,n,r,i,o,l,u,d,p,m){var g,h=.005,f=1/0,b,y,v,_;hk[0]=d,hk[1]=p;for(var w=0;w<1;w+=.05)Ly[0]=Of(t,n,i,l,w),Ly[1]=Of(e,r,o,u,w),v=g3(hk,Ly),v<f&&(g=w,f=v);f=1/0;for(var x=0;x<32&&!(h<C5t);x++)b=g-h,y=g+h,Ly[0]=Of(t,n,i,l,b),Ly[1]=Of(e,r,o,u,b),v=g3(Ly,hk),b>=0&&v<f?(g=b,f=v):(SF[0]=Of(t,n,i,l,y),SF[1]=Of(e,r,o,u,y),_=g3(SF,hk),y<=1&&_<f?(g=y,f=_):h*=.5);return RT(f)}function WZr(t,e,n,r,i,o,l,u,d){for(var p=t,m=e,g=0,h=1/d,f=1;f<=d;f++){var b=f*h,y=Of(t,n,i,l,b),v=Of(e,r,o,u,b),_=y-p,w=v-m;g+=Math.sqrt(_*_+w*w),p=y,m=v}return g}function HA(t,e,n,r){var i=1-r;return i*(i*t+2*r*e)+r*r*n}function N5t(t,e,n,r){return 2*((1-r)*(e-t)+r*(n-e))}function YZr(t,e,n,r,i){var o=t-2*e+n,l=2*(e-t),u=t-r,d=0;if(LT(o)){if(I5t(l)){var p=-u/l;p>=0&&p<=1&&(i[d++]=p)}}else{var m=l*l-4*o*u;if(LT(m)){var p=-l/(2*o);p>=0&&p<=1&&(i[d++]=p)}else if(m>0){var g=RT(m),p=(-l+g)/(2*o),h=(-l-g)/(2*o);p>=0&&p<=1&&(i[d++]=p),h>=0&&h<=1&&(i[d++]=h)}}return d}function R5t(t,e,n){var r=t+n-2*e;return r===0?.5:(t-e)/r}function Ice(t,e,n,r,i){var o=(e-t)*r+t,l=(n-e)*r+e,u=(l-o)*r+o;i[0]=t,i[1]=o,i[2]=u,i[3]=u,i[4]=l,i[5]=n}function VZr(t,e,n,r,i,o,l,u,d){var p,m=.005,g=1/0;hk[0]=l,hk[1]=u;for(var h=0;h<1;h+=.05){Ly[0]=HA(t,n,i,h),Ly[1]=HA(e,r,o,h);var f=g3(hk,Ly);f<g&&(p=h,g=f)}g=1/0;for(var b=0;b<32&&!(m<C5t);b++){var y=p-m,v=p+m;Ly[0]=HA(t,n,i,y),Ly[1]=HA(e,r,o,y);var f=g3(Ly,hk);if(y>=0&&f<g)p=y,g=f;else{SF[0]=HA(t,n,i,v),SF[1]=HA(e,r,o,v);var _=g3(SF,hk);v<=1&&_<g?(p=v,g=_):m*=.5}}return RT(g)}function KZr(t,e,n,r,i,o,l){for(var u=t,d=e,p=0,m=1/l,g=1;g<=l;g++){var h=g*m,f=HA(t,n,i,h),b=HA(e,r,o,h),y=f-u,v=b-d;p+=Math.sqrt(y*y+v*v),u=f,d=b}return p}var ZZr=/cubic-bezier\(([0-9,\.e ]+)\)/;function f4e(t){var e=t&&ZZr.exec(t);if(e){var n=e[1].split(","),r=+R_(n[0]),i=+R_(n[1]),o=+R_(n[2]),l=+R_(n[3]);if(isNaN(r+i+o+l))return;var u=[];return function(d){return d<=0?0:d>=1?1:B5t(0,r,o,1,d,u)&&Of(0,i,l,1,u[0])}}}var XZr=(function(){function t(e){this._inited=!1,this._startTime=0,this._pausedTime=0,this._paused=!1,this._life=e.life||1e3,this._delay=e.delay||0,this.loop=e.loop||!1,this.onframe=e.onframe||xg,this.ondestroy=e.ondestroy||xg,this.onrestart=e.onrestart||xg,e.easing&&this.setEasing(e.easing)}return t.prototype.step=function(e,n){if(this._inited||(this._startTime=e+this._delay,this._inited=!0),this._paused){this._pausedTime+=n;return}var r=this._life,i=e-this._startTime-this._pausedTime,o=i/r;o<0&&(o=0),o=Math.min(o,1);var l=this.easingFunc,u=l?l(o):o;if(this.onframe(u),o===1)if(this.loop){var d=i%r;this._startTime=e-d,this._pausedTime=0,this.onrestart()}else return!0;return!1},t.prototype.pause=function(){this._paused=!0},t.prototype.resume=function(){this._paused=!1},t.prototype.setEasing=function(e){this.easing=e,this.easingFunc=lo(e)?e:iH[e]||f4e(e)},t})(),L5t=(function(){function t(e){this.value=e}return t})(),JZr=(function(){function t(){this._len=0}return t.prototype.insert=function(e){var n=new L5t(e);return this.insertEntry(n),n},t.prototype.insertEntry=function(e){this.head?(this.tail.next=e,e.prev=this.tail,e.next=null,this.tail=e):this.head=this.tail=e,this._len++},t.prototype.remove=function(e){var n=e.prev,r=e.next;n?n.next=r:this.head=r,r?r.prev=n:this.tail=n,e.next=e.prev=null,this._len--},t.prototype.len=function(){return this._len},t.prototype.clear=function(){this.head=this.tail=null,this._len=0},t})(),IF=(function(){function t(e){this._list=new JZr,this._maxSize=10,this._map={},this._maxSize=e}return t.prototype.put=function(e,n){var r=this._list,i=this._map,o=null;if(i[e]==null){var l=r.len(),u=this._lastRemovedEntry;if(l>=this._maxSize&&l>0){var d=r.head;r.remove(d),delete i[d.key],o=d.value,this._lastRemovedEntry=d}u?u.value=n:u=new L5t(n),u.key=e,r.insertEntry(u),i[e]=u}return o},t.prototype.get=function(e){var n=this._map[e],r=this._list;if(n!=null)return n!==r.tail&&(r.remove(n),r.insertEntry(n)),n.value},t.prototype.clear=function(){this._list.clear(),this._map={}},t.prototype.len=function(){return this._list.len()},t})(),M5t={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function P_(t){return t=Math.round(t),t<0?0:t>255?255:t}function eXr(t){return t=Math.round(t),t<0?0:t>360?360:t}function oH(t){return t<0?0:t>1?1:t}function Tce(t){var e=t;return e.length&&e.charAt(e.length-1)==="%"?P_(parseFloat(e)/100*255):P_(parseInt(e,10))}function MT(t){var e=t;return e.length&&e.charAt(e.length-1)==="%"?oH(parseFloat(e)/100):oH(parseFloat(e))}function A4e(t,e,n){return n<0?n+=1:n>1&&(n-=1),n*6<1?t+(e-t)*n*6:n*2<1?e:n*3<2?t+(e-t)*(2/3-n)*6:t}function PT(t,e,n){return t+(e-t)*n}function My(t,e,n,r,i){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t}function b4e(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}var P5t=new IF(20),Bce=null;function TF(t,e){Bce&&b4e(Bce,e),Bce=P5t.put(t,Bce||e.slice())}function WA(t,e){if(t){e=e||[];var n=P5t.get(t);if(n)return b4e(e,n);t=t+"";var r=t.replace(/ /g,"").toLowerCase();if(r in M5t)return b4e(e,M5t[r]),TF(t,e),e;var i=r.length;if(r.charAt(0)==="#"){if(i===4||i===5){var o=parseInt(r.slice(1,4),16);if(!(o>=0&&o<=4095)){My(e,0,0,0,1);return}return My(e,(o&3840)>>4|(o&3840)>>8,o&240|(o&240)>>4,o&15|(o&15)<<4,i===5?parseInt(r.slice(4),16)/15:1),TF(t,e),e}else if(i===7||i===9){var o=parseInt(r.slice(1,7),16);if(!(o>=0&&o<=16777215)){My(e,0,0,0,1);return}return My(e,(o&16711680)>>16,(o&65280)>>8,o&255,i===9?parseInt(r.slice(7),16)/255:1),TF(t,e),e}return}var l=r.indexOf("("),u=r.indexOf(")");if(l!==-1&&u+1===i){var d=r.substr(0,l),p=r.substr(l+1,u-(l+1)).split(","),m=1;switch(d){case"rgba":if(p.length!==4)return p.length===3?My(e,+p[0],+p[1],+p[2],1):My(e,0,0,0,1);m=MT(p.pop());case"rgb":if(p.length>=3)return My(e,Tce(p[0]),Tce(p[1]),Tce(p[2]),p.length===3?m:MT(p[3])),TF(t,e),e;My(e,0,0,0,1);return;case"hsla":if(p.length!==4){My(e,0,0,0,1);return}return p[3]=MT(p[3]),y4e(p,e),TF(t,e),e;case"hsl":if(p.length!==3){My(e,0,0,0,1);return}return y4e(p,e),TF(t,e),e;default:return}}My(e,0,0,0,1)}}function y4e(t,e){var n=(parseFloat(t[0])%360+360)%360/360,r=MT(t[1]),i=MT(t[2]),o=i<=.5?i*(r+1):i+r-i*r,l=i*2-o;return e=e||[],My(e,P_(A4e(l,o,n+1/3)*255),P_(A4e(l,o,n)*255),P_(A4e(l,o,n-1/3)*255),1),t.length===4&&(e[3]=t[3]),e}function tXr(t){if(t){var e=t[0]/255,n=t[1]/255,r=t[2]/255,i=Math.min(e,n,r),o=Math.max(e,n,r),l=o-i,u=(o+i)/2,d,p;if(l===0)d=0,p=0;else{u<.5?p=l/(o+i):p=l/(2-o-i);var m=((o-e)/6+l/2)/l,g=((o-n)/6+l/2)/l,h=((o-r)/6+l/2)/l;e===o?d=h-g:n===o?d=1/3+m-h:r===o&&(d=2/3+g-m),d<0&&(d+=1),d>1&&(d-=1)}var f=[d*360,p,u];return t[3]!=null&&f.push(t[3]),f}}function v4e(t,e){var n=WA(t);if(n){for(var r=0;r<3;r++)e<0?n[r]=n[r]*(1-e)|0:n[r]=(255-n[r])*e+n[r]|0,n[r]>255?n[r]=255:n[r]<0&&(n[r]=0);return fk(n,n.length===4?"rgba":"rgb")}}function nXr(t){var e=WA(t);if(e)return((1<<24)+(e[0]<<16)+(e[1]<<8)+ +e[2]).toString(16).slice(1)}function sH(t,e,n){if(!(!(e&&e.length)||!(t>=0&&t<=1))){n=n||[];var r=t*(e.length-1),i=Math.floor(r),o=Math.ceil(r),l=e[i],u=e[o],d=r-i;return n[0]=P_(PT(l[0],u[0],d)),n[1]=P_(PT(l[1],u[1],d)),n[2]=P_(PT(l[2],u[2],d)),n[3]=oH(PT(l[3],u[3],d)),n}}var rXr=sH;function O5t(t,e,n){if(!(!(e&&e.length)||!(t>=0&&t<=1))){var r=t*(e.length-1),i=Math.floor(r),o=Math.ceil(r),l=WA(e[i]),u=WA(e[o]),d=r-i,p=fk([P_(PT(l[0],u[0],d)),P_(PT(l[1],u[1],d)),P_(PT(l[2],u[2],d)),oH(PT(l[3],u[3],d))],"rgba");return n?{color:p,leftIndex:i,rightIndex:o,value:r}:p}}var aXr=O5t;function _3(t,e,n,r){var i=WA(t);if(t)return i=tXr(i),e!=null&&(i[0]=eXr(lo(e)?e(i[0]):e)),n!=null&&(i[1]=MT(lo(n)?n(i[1]):n)),r!=null&&(i[2]=MT(lo(r)?r(i[2]):r)),fk(y4e(i),"rgba")}function F5t(t,e){var n=WA(t);if(n&&e!=null)return n[3]=oH(e),fk(n,"rgba")}function fk(t,e){if(!(!t||!t.length)){var n=t[0]+","+t[1]+","+t[2];return(e==="rgba"||e==="hsva"||e==="hsla")&&(n+=","+t[3]),e+"("+n+")"}}function lH(t,e){var n=WA(t);return n?(.299*n[0]+.587*n[1]+.114*n[2])*n[3]/255+(1-n[3])*e:0}function iXr(){return fk([Math.round(Math.random()*255),Math.round(Math.random()*255),Math.round(Math.random()*255)],"rgb")}var Q5t=new IF(100);function Dce(t){if(Wa(t)){var e=Q5t.get(t);return e||(e=v4e(t,-.1),Q5t.put(t,e)),e}else if(KG(t)){var n=ta({},t);return n.colorStops=Ga(t.colorStops,function(r){return{offset:r.offset,color:v4e(r.color,-.1)}}),n}return t}const oXr=Object.freeze(Object.defineProperty({__proto__:null,fastLerp:sH,fastMapToColor:rXr,lerp:O5t,lift:v4e,liftColor:Dce,lum:lH,mapToColor:aXr,modifyAlpha:F5t,modifyHSL:_3,parse:WA,parseCssFloat:MT,parseCssInt:Tce,random:iXr,stringify:fk,toHex:nXr},Symbol.toStringTag,{value:"Module"}));var Nce=Math.round;function cH(t){var e;if(!t||t==="transparent")t="none";else if(typeof t=="string"&&t.indexOf("rgba")>-1){var n=WA(t);n&&(t="rgb("+n[0]+","+n[1]+","+n[2]+")",e=n[3])}return{color:t,opacity:e??1}}var $5t=1e-4;function OT(t){return t<$5t&&t>-$5t}function Rce(t){return Nce(t*1e3)/1e3}function _4e(t){return Nce(t*1e4)/1e4}function sXr(t){return"matrix("+Rce(t[0])+","+Rce(t[1])+","+Rce(t[2])+","+Rce(t[3])+","+_4e(t[4])+","+_4e(t[5])+")"}var lXr={left:"start",right:"end",center:"middle",middle:"middle"};function cXr(t,e,n){return n==="top"?t+=e/2:n==="bottom"&&(t-=e/2),t}function uXr(t){return t&&(t.shadowBlur||t.shadowOffsetX||t.shadowOffsetY)}function dXr(t){var e=t.style,n=t.getGlobalScale();return[e.shadowColor,(e.shadowBlur||0).toFixed(2),(e.shadowOffsetX||0).toFixed(2),(e.shadowOffsetY||0).toFixed(2),n[0],n[1]].join(",")}function j5t(t){return t&&!!t.image}function pXr(t){return t&&!!t.svgElement}function w4e(t){return j5t(t)||pXr(t)}function z5t(t){return t.type==="linear"}function U5t(t){return t.type==="radial"}function q5t(t){return t&&(t.type==="linear"||t.type==="radial")}function Lce(t){return"url(#"+t+")"}function G5t(t){var e=t.getGlobalScale(),n=Math.max(e[0],e[1]);return Math.max(Math.ceil(Math.log(n)/Math.log(10)),1)}function H5t(t){var e=t.x||0,n=t.y||0,r=(t.rotation||0)*XG,i=ki(t.scaleX,1),o=ki(t.scaleY,1),l=t.skewX||0,u=t.skewY||0,d=[];return(e||n)&&d.push("translate("+e+"px,"+n+"px)"),r&&d.push("rotate("+r+")"),(i!==1||o!==1)&&d.push("scale("+i+","+o+")"),(l||u)&&d.push("skew("+Nce(l*XG)+"deg, "+Nce(u*XG)+"deg)"),d.join(" ")}var mXr=(function(){return go.hasGlobalWindow&&lo(window.btoa)?function(t){return window.btoa(unescape(encodeURIComponent(t)))}:typeof Buffer<"u"?function(t){return Buffer.from(t).toString("base64")}:function(t){return process.env.NODE_ENV!=="production"&&D_("Base64 isn't natively supported in the current environment."),null}})(),x4e=Array.prototype.slice;function RC(t,e,n){return(e-t)*n+t}function k4e(t,e,n,r){for(var i=e.length,o=0;o<i;o++)t[o]=RC(e[o],n[o],r);return t}function gXr(t,e,n,r){for(var i=e.length,o=i&&e[0].length,l=0;l<i;l++){t[l]||(t[l]=[]);for(var u=0;u<o;u++)t[l][u]=RC(e[l][u],n[l][u],r)}return t}function Mce(t,e,n,r){for(var i=e.length,o=0;o<i;o++)t[o]=e[o]+n[o]*r;return t}function W5t(t,e,n,r){for(var i=e.length,o=i&&e[0].length,l=0;l<i;l++){t[l]||(t[l]=[]);for(var u=0;u<o;u++)t[l][u]=e[l][u]+n[l][u]*r}return t}function hXr(t,e){for(var n=t.length,r=e.length,i=n>r?e:t,o=Math.min(n,r),l=i[o-1]||{color:[0,0,0,0],offset:0},u=o;u<Math.max(n,r);u++)i.push({offset:l.offset,color:l.color.slice()})}function fXr(t,e,n){var r=t,i=e;if(!(!r.push||!i.push)){var o=r.length,l=i.length;if(o!==l){var u=o>l;if(u)r.length=l;else for(var d=o;d<l;d++)r.push(n===1?i[d]:x4e.call(i[d]))}for(var p=r[0]&&r[0].length,d=0;d<r.length;d++)if(n===1)isNaN(r[d])&&(r[d]=i[d]);else for(var m=0;m<p;m++)isNaN(r[d][m])&&(r[d][m]=i[d][m])}}function Pce(t){if(Pf(t)){var e=t.length;if(Pf(t[0])){for(var n=[],r=0;r<e;r++)n.push(x4e.call(t[r]));return n}return x4e.call(t)}return t}function Oce(t){return t[0]=Math.floor(t[0])||0,t[1]=Math.floor(t[1])||0,t[2]=Math.floor(t[2])||0,t[3]=t[3]==null?1:t[3],"rgba("+t.join(",")+")"}function AXr(t){return Pf(t&&t[0])?2:1}var Fce=0,Qce=1,Y5t=2,uH=3,E4e=4,C4e=5,V5t=6;function K5t(t){return t===E4e||t===C4e}function $ce(t){return t===Qce||t===Y5t}var dH=[0,0,0,0],bXr=(function(){function t(e){this.keyframes=[],this.discrete=!1,this._invalid=!1,this._needsSort=!1,this._lastFr=0,this._lastFrP=0,this.propName=e}return t.prototype.isFinished=function(){return this._finished},t.prototype.setFinished=function(){this._finished=!0,this._additiveTrack&&this._additiveTrack.setFinished()},t.prototype.needsAnimate=function(){return this.keyframes.length>=1},t.prototype.getAdditiveTrack=function(){return this._additiveTrack},t.prototype.addKeyframe=function(e,n,r){this._needsSort=!0;var i=this.keyframes,o=i.length,l=!1,u=V5t,d=n;if(Pf(n)){var p=AXr(n);u=p,(p===1&&!Rc(n[0])||p===2&&!Rc(n[0][0]))&&(l=!0)}else if(Rc(n)&&!NC(n))u=Fce;else if(Wa(n))if(!isNaN(+n))u=Fce;else{var m=WA(n);m&&(d=m,u=uH)}else if(KG(n)){var g=ta({},d);g.colorStops=Ga(n.colorStops,function(f){return{offset:f.offset,color:WA(f.color)}}),z5t(n)?u=E4e:U5t(n)&&(u=C4e),d=g}o===0?this.valType=u:(u!==this.valType||u===V5t)&&(l=!0),this.discrete=this.discrete||l;var h={time:e,value:d,rawValue:n,percent:0};return r&&(h.easing=r,h.easingFunc=lo(r)?r:iH[r]||f4e(r)),i.push(h),h},t.prototype.prepare=function(e,n){var r=this.keyframes;this._needsSort&&r.sort(function(y,v){return y.time-v.time});for(var i=this.valType,o=r.length,l=r[o-1],u=this.discrete,d=$ce(i),p=K5t(i),m=0;m<o;m++){var g=r[m],h=g.value,f=l.value;g.percent=g.time/e,u||(d&&m!==o-1?fXr(h,f,i):p&&hXr(h.colorStops,f.colorStops))}if(!u&&i!==C4e&&n&&this.needsAnimate()&&n.needsAnimate()&&i===n.valType&&!n._finished){this._additiveTrack=n;for(var b=r[0].value,m=0;m<o;m++)i===Fce?r[m].additiveValue=r[m].value-b:i===uH?r[m].additiveValue=Mce([],r[m].value,b,-1):$ce(i)&&(r[m].additiveValue=i===Qce?Mce([],r[m].value,b,-1):W5t([],r[m].value,b,-1))}},t.prototype.step=function(e,n){if(!this._finished){this._additiveTrack&&this._additiveTrack._finished&&(this._additiveTrack=null);var r=this._additiveTrack!=null,i=r?"additiveValue":"value",o=this.valType,l=this.keyframes,u=l.length,d=this.propName,p=o===uH,m,g=this._lastFr,h=Math.min,f,b;if(u===1)f=b=l[0];else{if(n<0)m=0;else if(n<this._lastFrP){var y=h(g+1,u-1);for(m=y;m>=0&&!(l[m].percent<=n);m--);m=h(m,u-2)}else{for(m=g;m<u&&!(l[m].percent>n);m++);m=h(m-1,u-2)}b=l[m+1],f=l[m]}if(f&&b){this._lastFr=m,this._lastFrP=n;var v=b.percent-f.percent,_=v===0?1:h((n-f.percent)/v,1);b.easingFunc&&(_=b.easingFunc(_));var w=r?this._additiveValue:p?dH:e[d];if(($ce(o)||p)&&!w&&(w=this._additiveValue=[]),this.discrete)e[d]=_<1?f.rawValue:b.rawValue;else if($ce(o))o===Qce?k4e(w,f[i],b[i],_):gXr(w,f[i],b[i],_);else if(K5t(o)){var x=f[i],k=b[i],C=o===E4e;e[d]={type:C?"linear":"radial",x:RC(x.x,k.x,_),y:RC(x.y,k.y,_),colorStops:Ga(x.colorStops,function(S,I){var B=k.colorStops[I];return{offset:RC(S.offset,B.offset,_),color:Oce(k4e([],S.color,B.color,_))}}),global:k.global},C?(e[d].x2=RC(x.x2,k.x2,_),e[d].y2=RC(x.y2,k.y2,_)):e[d].r=RC(x.r,k.r,_)}else if(p)k4e(w,f[i],b[i],_),r||(e[d]=Oce(w));else{var E=RC(f[i],b[i],_);r?this._additiveValue=E:e[d]=E}r&&this._addToTarget(e)}}},t.prototype._addToTarget=function(e){var n=this.valType,r=this.propName,i=this._additiveValue;n===Fce?e[r]=e[r]+i:n===uH?(WA(e[r],dH),Mce(dH,dH,i,1),e[r]=Oce(dH)):n===Qce?Mce(e[r],e[r],i,1):n===Y5t&&W5t(e[r],e[r],i,1)},t})(),S4e=(function(){function t(e,n,r,i){if(this._tracks={},this._trackKeys=[],this._maxTime=0,this._started=0,this._clip=null,this._target=e,this._loop=n,n&&i){D_("Can' use additive animation on looped animation.");return}this._additiveAnimators=i,this._allowDiscrete=r}return t.prototype.getMaxTime=function(){return this._maxTime},t.prototype.getDelay=function(){return this._delay},t.prototype.getLoop=function(){return this._loop},t.prototype.getTarget=function(){return this._target},t.prototype.changeTarget=function(e){this._target=e},t.prototype.when=function(e,n,r){return this.whenWithKeys(e,n,Xs(n),r)},t.prototype.whenWithKeys=function(e,n,r,i){for(var o=this._tracks,l=0;l<r.length;l++){var u=r[l],d=o[u];if(!d){d=o[u]=new bXr(u);var p=void 0,m=this._getAdditiveTrack(u);if(m){var g=m.keyframes,h=g[g.length-1];p=h&&h.value,m.valType===uH&&p&&(p=Oce(p))}else p=this._target[u];if(p==null)continue;e>0&&d.addKeyframe(0,Pce(p),i),this._trackKeys.push(u)}d.addKeyframe(e,Pce(n[u]),i)}return this._maxTime=Math.max(this._maxTime,e),this},t.prototype.pause=function(){this._clip.pause(),this._paused=!0},t.prototype.resume=function(){this._clip.resume(),this._paused=!1},t.prototype.isPaused=function(){return!!this._paused},t.prototype.duration=function(e){return this._maxTime=e,this._force=!0,this},t.prototype._doneCallback=function(){this._setTracksFinished(),this._clip=null;var e=this._doneCbs;if(e)for(var n=e.length,r=0;r<n;r++)e[r].call(this)},t.prototype._abortedCallback=function(){this._setTracksFinished();var e=this.animation,n=this._abortedCbs;if(e&&e.removeClip(this._clip),this._clip=null,n)for(var r=0;r<n.length;r++)n[r].call(this)},t.prototype._setTracksFinished=function(){for(var e=this._tracks,n=this._trackKeys,r=0;r<n.length;r++)e[n[r]].setFinished()},t.prototype._getAdditiveTrack=function(e){var n,r=this._additiveAnimators;if(r)for(var i=0;i<r.length;i++){var o=r[i].getTrack(e);o&&(n=o)}return n},t.prototype.start=function(e){if(!(this._started>0)){this._started=1;for(var n=this,r=[],i=this._maxTime||0,o=0;o<this._trackKeys.length;o++){var l=this._trackKeys[o],u=this._tracks[l],d=this._getAdditiveTrack(l),p=u.keyframes,m=p.length;if(u.prepare(i,d),u.needsAnimate())if(!this._allowDiscrete&&u.discrete){var g=p[m-1];g&&(n._target[u.propName]=g.rawValue),u.setFinished()}else r.push(u)}if(r.length||this._force){var h=new XZr({life:i,loop:this._loop,delay:this._delay||0,onframe:function(f){n._started=2;var b=n._additiveAnimators;if(b){for(var y=!1,v=0;v<b.length;v++)if(b[v]._clip){y=!0;break}y||(n._additiveAnimators=null)}for(var v=0;v<r.length;v++)r[v].step(n._target,f);var _=n._onframeCbs;if(_)for(var v=0;v<_.length;v++)_[v](n._target,f)},ondestroy:function(){n._doneCallback()}});this._clip=h,this.animation&&this.animation.addClip(h),e&&h.setEasing(e)}else this._doneCallback();return this}},t.prototype.stop=function(e){if(this._clip){var n=this._clip;e&&n.onframe(1),this._abortedCallback()}},t.prototype.delay=function(e){return this._delay=e,this},t.prototype.during=function(e){return e&&(this._onframeCbs||(this._onframeCbs=[]),this._onframeCbs.push(e)),this},t.prototype.done=function(e){return e&&(this._doneCbs||(this._doneCbs=[]),this._doneCbs.push(e)),this},t.prototype.aborted=function(e){return e&&(this._abortedCbs||(this._abortedCbs=[]),this._abortedCbs.push(e)),this},t.prototype.getClip=function(){return this._clip},t.prototype.getTrack=function(e){return this._tracks[e]},t.prototype.getTracks=function(){var e=this;return Ga(this._trackKeys,function(n){return e._tracks[n]})},t.prototype.stopTracks=function(e,n){if(!e.length||!this._clip)return!0;for(var r=this._tracks,i=this._trackKeys,o=0;o<e.length;o++){var l=r[e[o]];l&&!l.isFinished()&&(n?l.step(this._target,1):this._started===1&&l.step(this._target,0),l.setFinished())}for(var u=!0,o=0;o<i.length;o++)if(!r[i[o]].isFinished()){u=!1;break}return u&&this._abortedCallback(),u},t.prototype.saveTo=function(e,n,r){if(e){n=n||this._trackKeys;for(var i=0;i<n.length;i++){var o=n[i],l=this._tracks[o];if(!(!l||l.isFinished())){var u=l.keyframes,d=u[r?0:u.length-1];d&&(e[o]=Pce(d.rawValue))}}}},t.prototype.__changeFinalValue=function(e,n){n=n||Xs(e);for(var r=0;r<n.length;r++){var i=n[r],o=this._tracks[i];if(o){var l=o.keyframes;if(l.length>1){var u=l.pop();o.addKeyframe(u.time,e[i]),o.prepare(this._maxTime,o.getAdditiveTrack())}}}},t})();function BF(){return new Date().getTime()}var yXr=(function(t){oc(e,t);function e(n){var r=t.call(this)||this;return r._running=!1,r._time=0,r._pausedTime=0,r._pauseStart=0,r._paused=!1,n=n||{},r.stage=n.stage||{},r}return e.prototype.addClip=function(n){n.animation&&this.removeClip(n),this._head?(this._tail.next=n,n.prev=this._tail,n.next=null,this._tail=n):this._head=this._tail=n,n.animation=this},e.prototype.addAnimator=function(n){n.animation=this;var r=n.getClip();r&&this.addClip(r)},e.prototype.removeClip=function(n){if(n.animation){var r=n.prev,i=n.next;r?r.next=i:this._head=i,i?i.prev=r:this._tail=r,n.next=n.prev=n.animation=null}},e.prototype.removeAnimator=function(n){var r=n.getClip();r&&this.removeClip(r),n.animation=null},e.prototype.update=function(n){for(var r=BF()-this._pausedTime,i=r-this._time,o=this._head;o;){var l=o.next,u=o.step(r,i);u&&(o.ondestroy(),this.removeClip(o)),o=l}this._time=r,n||(this.trigger("frame",i),this.stage.update&&this.stage.update())},e.prototype._startLoop=function(){var n=this;this._running=!0;function r(){n._running&&(xce(r),!n._paused&&n.update())}xce(r)},e.prototype.start=function(){this._running||(this._time=BF(),this._pausedTime=0,this._startLoop())},e.prototype.stop=function(){this._running=!1},e.prototype.pause=function(){this._paused||(this._pauseStart=BF(),this._paused=!0)},e.prototype.resume=function(){this._paused&&(this._pausedTime+=BF()-this._pauseStart,this._paused=!1)},e.prototype.clear=function(){for(var n=this._head;n;){var r=n.next;n.prev=n.next=n.animation=null,n=r}this._head=this._tail=null},e.prototype.isFinished=function(){return this._head==null},e.prototype.animate=function(n,r){r=r||{},this.start();var i=new S4e(n,r.loop);return this.addAnimator(i),i},e})(gk),vXr=300,I4e=go.domSupported,T4e=(function(){var t=["click","dblclick","mousewheel","wheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],e=["touchstart","touchend","touchmove"],n={pointerdown:1,pointerup:1,pointermove:1,pointerout:1},r=Ga(t,function(i){var o=i.replace("mouse","pointer");return n.hasOwnProperty(o)?o:i});return{mouse:t,touch:e,pointer:r}})(),Z5t={mouse:["mousemove","mouseup"],pointer:["pointermove","pointerup"]},X5t=!1;function B4e(t){var e=t.pointerType;return e==="pen"||e==="touch"}function _Xr(t){t.touching=!0,t.touchTimer!=null&&(clearTimeout(t.touchTimer),t.touchTimer=null),t.touchTimer=setTimeout(function(){t.touching=!1,t.touchTimer=null},700)}function D4e(t){t&&(t.zrByTouch=!0)}function wXr(t,e){return Ry(t.dom,new xXr(t,e),!0)}function J5t(t,e){for(var n=e,r=!1;n&&n.nodeType!==9&&!(r=n.domBelongToZr||n!==e&&n===t.painterRoot);)n=n.parentNode;return r}var xXr=(function(){function t(e,n){this.stopPropagation=xg,this.stopImmediatePropagation=xg,this.preventDefault=xg,this.type=n.type,this.target=this.currentTarget=e.dom,this.pointerType=n.pointerType,this.clientX=n.clientX,this.clientY=n.clientY}return t})(),O_={mousedown:function(t){t=Ry(this.dom,t),this.__mayPointerCapture=[t.zrX,t.zrY],this.trigger("mousedown",t)},mousemove:function(t){t=Ry(this.dom,t);var e=this.__mayPointerCapture;e&&(t.zrX!==e[0]||t.zrY!==e[1])&&this.__togglePointerCapture(!0),this.trigger("mousemove",t)},mouseup:function(t){t=Ry(this.dom,t),this.__togglePointerCapture(!1),this.trigger("mouseup",t)},mouseout:function(t){t=Ry(this.dom,t);var e=t.toElement||t.relatedTarget;J5t(this,e)||(this.__pointerCapturing&&(t.zrEventControl="no_globalout"),this.trigger("mouseout",t))},wheel:function(t){X5t=!0,t=Ry(this.dom,t),this.trigger("mousewheel",t)},mousewheel:function(t){X5t||(t=Ry(this.dom,t),this.trigger("mousewheel",t))},touchstart:function(t){t=Ry(this.dom,t),D4e(t),this.__lastTouchMoment=new Date,this.handler.processGesture(t,"start"),O_.mousemove.call(this,t),O_.mousedown.call(this,t)},touchmove:function(t){t=Ry(this.dom,t),D4e(t),this.handler.processGesture(t,"change"),O_.mousemove.call(this,t)},touchend:function(t){t=Ry(this.dom,t),D4e(t),this.handler.processGesture(t,"end"),O_.mouseup.call(this,t),+new Date-+this.__lastTouchMoment<vXr&&O_.click.call(this,t)},pointerdown:function(t){O_.mousedown.call(this,t)},pointermove:function(t){B4e(t)||O_.mousemove.call(this,t)},pointerup:function(t){O_.mouseup.call(this,t)},pointerout:function(t){B4e(t)||O_.mouseout.call(this,t)}};fn(["click","dblclick","contextmenu"],function(t){O_[t]=function(e){e=Ry(this.dom,e),this.trigger(t,e)}});var N4e={pointermove:function(t){B4e(t)||N4e.mousemove.call(this,t)},pointerup:function(t){N4e.mouseup.call(this,t)},mousemove:function(t){this.trigger("mousemove",t)},mouseup:function(t){var e=this.__pointerCapturing;this.__togglePointerCapture(!1),this.trigger("mouseup",t),e&&(t.zrEventControl="only_globalout",this.trigger("mouseout",t))}};function kXr(t,e){var n=e.domHandlers;go.pointerEventsSupported?fn(T4e.pointer,function(r){jce(e,r,function(i){n[r].call(t,i)})}):(go.touchEventsSupported&&fn(T4e.touch,function(r){jce(e,r,function(i){n[r].call(t,i),_Xr(e)})}),fn(T4e.mouse,function(r){jce(e,r,function(i){i=l4e(i),e.touching||n[r].call(t,i)})}))}function EXr(t,e){go.pointerEventsSupported?fn(Z5t.pointer,n):go.touchEventsSupported||fn(Z5t.mouse,n);function n(r){function i(o){o=l4e(o),J5t(t,o.target)||(o=wXr(t,o),e.domHandlers[r].call(t,o))}jce(e,r,i,{capture:!0})}}function jce(t,e,n,r){t.mounted[e]=n,t.listenerOpts[e]=r,IZr(t.domTarget,e,n,r)}function R4e(t){var e=t.mounted;for(var n in e)e.hasOwnProperty(n)&&TZr(t.domTarget,n,e[n],t.listenerOpts[n]);t.mounted={}}var eOt=(function(){function t(e,n){this.mounted={},this.listenerOpts={},this.touching=!1,this.domTarget=e,this.domHandlers=n}return t})(),CXr=(function(t){oc(e,t);function e(n,r){var i=t.call(this)||this;return i.__pointerCapturing=!1,i.dom=n,i.painterRoot=r,i._localHandlerScope=new eOt(n,O_),I4e&&(i._globalHandlerScope=new eOt(document,N4e)),kXr(i,i._localHandlerScope),i}return e.prototype.dispose=function(){R4e(this._localHandlerScope),I4e&&R4e(this._globalHandlerScope)},e.prototype.setCursor=function(n){this.dom.style&&(this.dom.style.cursor=n||"default")},e.prototype.__togglePointerCapture=function(n){if(this.__mayPointerCapture=null,I4e&&+this.__pointerCapturing^+n){this.__pointerCapturing=n;var r=this._globalHandlerScope;n?EXr(this,r):R4e(r)}},e})(gk),tOt=1;go.hasGlobalWindow&&(tOt=Math.max(window.devicePixelRatio||window.screen&&window.screen.deviceXDPI/window.screen.logicalXDPI||1,1));var zce=tOt,L4e=.4,M4e="#333",P4e="#ccc",SXr="#eee",nOt=JG,rOt=5e-5;function w3(t){return t>rOt||t<-rOt}var x3=[],DF=[],O4e=M_(),F4e=Math.abs,Q4e=(function(){function t(){}return t.prototype.getLocalTransform=function(e){return t.getLocalTransform(this,e)},t.prototype.setPosition=function(e){this.x=e[0],this.y=e[1]},t.prototype.setScale=function(e){this.scaleX=e[0],this.scaleY=e[1]},t.prototype.setSkew=function(e){this.skewX=e[0],this.skewY=e[1]},t.prototype.setOrigin=function(e){this.originX=e[0],this.originY=e[1]},t.prototype.needLocalTransform=function(){return w3(this.rotation)||w3(this.x)||w3(this.y)||w3(this.scaleX-1)||w3(this.scaleY-1)||w3(this.skewX)||w3(this.skewY)},t.prototype.updateTransform=function(){var e=this.parent&&this.parent.transform,n=this.needLocalTransform(),r=this.transform;if(!(n||e)){r&&(nOt(r),this.invTransform=null);return}r=r||M_(),n?this.getLocalTransform(r):nOt(r),e&&(n?h3(r,e,r):yce(r,e)),this.transform=r,this._resolveGlobalScaleRatio(r)},t.prototype._resolveGlobalScaleRatio=function(e){var n=this.globalScaleRatio;if(n!=null&&n!==1){this.getGlobalScale(x3);var r=x3[0]<0?-1:1,i=x3[1]<0?-1:1,o=((x3[0]-r)*n+r)/x3[0]||0,l=((x3[1]-i)*n+i)/x3[1]||0;e[0]*=o,e[1]*=o,e[2]*=l,e[3]*=l}this.invTransform=this.invTransform||M_(),kF(this.invTransform,e)},t.prototype.getComputedTransform=function(){for(var e=this,n=[];e;)n.push(e),e=e.parent;for(;e=n.pop();)e.updateTransform();return this.transform},t.prototype.setLocalTransform=function(e){if(e){var n=e[0]*e[0]+e[1]*e[1],r=e[2]*e[2]+e[3]*e[3],i=Math.atan2(e[1],e[0]),o=Math.PI/2+i-Math.atan2(e[3],e[2]);r=Math.sqrt(r)*Math.cos(o),n=Math.sqrt(n),this.skewX=o,this.skewY=0,this.rotation=-i,this.x=+e[4],this.y=+e[5],this.scaleX=n,this.scaleY=r,this.originX=0,this.originY=0}},t.prototype.decomposeTransform=function(){if(this.transform){var e=this.parent,n=this.transform;e&&e.transform&&(e.invTransform=e.invTransform||M_(),h3(DF,e.invTransform,n),n=DF);var r=this.originX,i=this.originY;(r||i)&&(O4e[4]=r,O4e[5]=i,h3(DF,n,O4e),DF[4]-=r,DF[5]-=i,n=DF),this.setLocalTransform(n)}},t.prototype.getGlobalScale=function(e){var n=this.transform;return e=e||[],n?(e[0]=Math.sqrt(n[0]*n[0]+n[1]*n[1]),e[1]=Math.sqrt(n[2]*n[2]+n[3]*n[3]),n[0]<0&&(e[0]=-e[0]),n[3]<0&&(e[1]=-e[1]),e):(e[0]=1,e[1]=1,e)},t.prototype.transformCoordToLocal=function(e,n){var r=[e,n],i=this.invTransform;return i&&c0(r,r,i),r},t.prototype.transformCoordToGlobal=function(e,n){var r=[e,n],i=this.transform;return i&&c0(r,r,i),r},t.prototype.getLineScale=function(){var e=this.transform;return e&&F4e(e[0]-1)>1e-10&&F4e(e[3]-1)>1e-10?Math.sqrt(F4e(e[0]*e[3]-e[2]*e[1])):1},t.prototype.copyTransform=function(e){Uce(this,e)},t.getLocalTransform=function(e,n){n=n||[];var r=e.originX||0,i=e.originY||0,o=e.scaleX,l=e.scaleY,u=e.anchorX,d=e.anchorY,p=e.rotation||0,m=e.x,g=e.y,h=e.skewX?Math.tan(e.skewX):0,f=e.skewY?Math.tan(-e.skewY):0;if(r||i||u||d){var b=r+u,y=i+d;n[4]=-b*o-h*y*l,n[5]=-y*l-f*b*o}else n[4]=n[5]=0;return n[0]=o,n[3]=l,n[1]=f*o,n[2]=h*l,p&&_ce(n,n,p),n[4]+=r+m,n[5]+=i+g,n},t.initDefaultProps=(function(){var e=t.prototype;e.scaleX=e.scaleY=e.globalScaleRatio=1,e.x=e.y=e.originX=e.originY=e.skewX=e.skewY=e.rotation=e.anchorX=e.anchorY=0})(),t})(),pH=["x","y","originX","originY","anchorX","anchorY","rotation","scaleX","scaleY","skewX","skewY"];function Uce(t,e){for(var n=0;n<pH.length;n++){var r=pH[n];t[r]=e[r]}}function Ak(t){qce||(qce=new IF(100)),t=t||DC;var e=qce.get(t);return e||(e={font:t,strWidthCache:new IF(500),asciiWidthMap:null,asciiWidthMapTried:!1,stWideCharWidth:GA.measureText("国",t).width,asciiCharWidth:GA.measureText("a",t).width},qce.put(t,e)),e}var qce;function IXr(t){if(!($4e>=aOt)){t=t||DC;for(var e=[],n=+new Date,r=0;r<=127;r++)e[r]=GA.measureText(String.fromCharCode(r),t).width;var i=+new Date-n;return i>16?$4e=aOt:i>2&&$4e++,e}}var $4e=0,aOt=5;function iOt(t,e){return t.asciiWidthMapTried||(t.asciiWidthMap=IXr(t.font),t.asciiWidthMapTried=!0),0<=e&&e<=127?t.asciiWidthMap!=null?t.asciiWidthMap[e]:t.asciiCharWidth:t.stWideCharWidth}function bk(t,e){var n=t.strWidthCache,r=n.get(e);return r==null&&(r=GA.measureText(e,t.font).width,n.put(e,r)),r}function oOt(t,e,n,r){var i=bk(Ak(e),t),o=mH(e),l=NF(0,i,n),u=k3(0,o,r),d=new Bo(l,u,i,o);return d}function sOt(t,e,n,r){var i=((t||"")+"").split(`
|
|
685
|
+
${m||o?"text-indigo-600 dark:text-indigo-400":"text-neutral-500 dark:text-neutral-400"}`,children:[A.jsx(Lor,{className:"h-5 w-5"}),A.jsx("span",{className:"text-[10px] font-medium leading-none",children:i("app.activityBar.more")}),m&&!o&&A.jsx(Et.div,{layoutId:"activeIndicatorMobile",className:"absolute left-1/2 top-0 h-0.5 w-8 -translate-x-1/2 rounded-full bg-indigo-600 dark:bg-indigo-400",initial:!1,transition:{type:"spring",stiffness:300,damping:30}})]})]})]})};function HVr({className:t="",variant:e="fullscreen",isMobile:n=!1,onDragStart:r,onDragMove:i,onDragEnd:o,showBackButton:l=!1,onBackClick:u,backButtonLabel:d="Chat"}){const p=Un(x=>x.closeXyzen),m=pO(),g=dBe(),[h,f]=T.useState(!1),[b,y]=T.useState(!1),v=e==="fullscreen",_=e==="side",w=v?"flex h-14 shrink-0 items-center justify-between px-4 bg-white/80 dark:bg-black/60 backdrop-blur-md supports-[backdrop-filter]:backdrop-blur-md shadow-sm ring-1 ring-neutral-200/60 dark:ring-neutral-800/60":`flex h-14 shrink-0 items-center justify-between border-b border-neutral-200 px-4 dark:border-neutral-800 ${n?"":"cursor-move select-none active:cursor-grabbing"}`;return A.jsxs(A.Fragment,{children:[A.jsxs("header",{className:`${w} ${t}`,onPointerDown:_?r:void 0,onPointerMove:_?i:void 0,onPointerUp:_?o:void 0,children:[A.jsxs("div",{className:"flex items-center gap-2",children:[l&&u?A.jsxs("button",{className:"rounded-sm flex items-center gap-2 p-1.5 text-neutral-500 hover:bg-neutral-100 dark:text-neutral-400 dark:hover:bg-neutral-800",title:"Back to Assistants",onClick:x=>{x.stopPropagation(),u()},onPointerDown:x=>x.stopPropagation(),children:[A.jsx(xx,{className:"size-4"}),A.jsx("h3",{className:"text-sm font-medium text-neutral-700 dark:text-neutral-300",children:d})]}):A.jsx("h1",{className:"text-base sm:text-lg font-semibold tracking-tight bg-linear-to-r from-indigo-600 via-purple-600 to-pink-600 dark:from-indigo-400 dark:via-purple-400 dark:to-pink-400 bg-clip-text text-transparent pointer-events-none",children:"Xyzen"}),_&&!n&&A.jsx("div",{className:"ml-2 pointer-events-none",children:A.jsx("kbd",{className:"rounded border border-neutral-300 bg-neutral-50 px-1.5 py-0.5 text-[10px] font-medium text-neutral-600 dark:border-neutral-700 dark:bg-neutral-800 dark:text-neutral-400",children:"⌘⇧X"})})]}),A.jsxs("div",{className:"flex items-center space-x-1",onPointerDown:_?x=>x.stopPropagation():void 0,children:[m&&A.jsxs(A.Fragment,{children:[A.jsxs("div",{className:"flex items-center gap-1.5 rounded-md border border-indigo-100 bg-linear-to-br from-indigo-50/80 to-white px-2 py-1 sm:gap-2 sm:px-3 sm:py-1.5 dark:border-indigo-500/20 dark:from-indigo-950/20 dark:to-neutral-900/20",children:[A.jsx("div",{className:"hidden sm:flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-indigo-100 text-indigo-600 dark:bg-indigo-500/20 dark:text-indigo-400",children:A.jsx(Ks,{className:"h-3.5 w-3.5"})}),A.jsxs("div",{className:"hidden sm:flex items-center gap-1 sm:gap-1.5",children:[A.jsx("span",{className:"hidden text-xs font-medium text-neutral-500 dark:text-neutral-400 sm:inline",children:"积分"}),A.jsx("span",{className:"sr-only",children:m.isLoading?"积分加载中":`积分 ${(m.points??"--").toString()}`}),A.jsx("span",{className:"hidden text-sm font-bold text-indigo-900 dark:text-indigo-100 sm:inline sm:text-base",children:m.isLoading?"...":m.points??"--"})]}),A.jsx("button",{type:"button",onClick:()=>f(!0),className:"rounded-full p-0.5 text-neutral-400 transition-colors hover:bg-white/50 hover:text-indigo-600 dark:text-neutral-500 dark:hover:bg-neutral-800 dark:hover:text-indigo-400",title:"积分说明",children:A.jsx(du,{className:"h-4 w-4"})})]}),g&&A.jsx("button",{type:"button",onClick:()=>y(!0),className:"relative rounded-md border border-amber-100 bg-linear-to-br from-amber-50/80 to-white px-2 py-1 text-sm font-medium text-amber-700 transition-colors hover:from-amber-100/80 hover:to-amber-50 sm:px-2.5 sm:py-1.5 dark:border-amber-500/20 dark:from-amber-950/20 dark:to-neutral-900/20 dark:text-amber-400 dark:hover:from-amber-900/30 dark:hover:to-amber-950/30",title:"每日签到",children:A.jsxs("div",{className:"flex items-center gap-1.5",children:[A.jsx(uR,{className:"h-4 w-4"}),A.jsx("span",{className:"sr-only",children:"签到"}),A.jsx("span",{className:"hidden sm:inline",children:"签到"})]})}),A.jsx("div",{className:"mx-2 hidden h-6 w-px bg-neutral-200 dark:bg-neutral-700 sm:block"})]}),A.jsx(UCt,{className:"ml-2"}),_&&!n&&A.jsx("button",{onClick:p,className:"rounded-sm p-1.5 text-neutral-500 hover:bg-neutral-100 hover:text-red-500 dark:text-neutral-400 dark:hover:bg-neutral-800 dark:hover:text-red-400",title:"Close",children:A.jsx(k6n,{className:"h-5 w-5"})})]})]}),m&&A.jsx(gO,{isOpen:h,onClose:()=>f(!1)}),g&&A.jsx(HDe,{isOpen:b,onClose:()=>y(!1)})]})}function WVr(t,e,n){return t.id===e?{allowed:!1,reason:"Root agent cannot be deleted"}:n.has(t.id)?{allowed:!1,reason:"This agent is published to Agent Market. Please unpublish it first, then delete it."}:{allowed:!0}}function YVr(t,e){const n=t.find(i=>i.id===e),r=t.filter(i=>i.id!==e);return n?[n,...r]:r}function LPt({onNavigateToChat:t,scrollRef:e,containerRef:n,onSortModeChange:r}={}){const{t:i}=Cn(),[o,l]=T.useState(!1),[u,d]=T.useState(!1),[p,m]=T.useState(null),[g,h]=T.useState(!1),[f,b]=T.useState(null),[y,v]=T.useState(null),[_,w]=T.useState(!1),{agents:x,rootAgentId:k,deleteAgent:C,updateAgentAvatar:E,reorderAgents:S,chatHistory:I,activateChannelForAgent:B,fetchMcpServers:R}=Un(us(te=>({agents:te.agents,rootAgentId:te.rootAgentId,deleteAgent:te.deleteAgent,updateAgentAvatar:te.updateAgentAvatar,reorderAgents:te.reorderAgents,chatHistory:te.chatHistory,activateChannelForAgent:te.activateChannelForAgent,fetchMcpServers:te.fetchMcpServers}))),L=eFr(),M=oNt(),N=T.useMemo(()=>YVr(x,k),[x,k]),{data:D}=pae(),P=T.useMemo(()=>{const te=new Set;for(const V of D??[])V.is_published&&te.add(V.agent_id);return te},[D]),O=T.useMemo(()=>sNt(I,M),[I,M]);T.useEffect(()=>{R().catch(console.error)},[R]);const F=async te=>{const V=te.id;v(V);try{await B(V),t?.()}finally{v(null)}},$=te=>{m(te),d(!0)},j=te=>{b(te),h(!0)},Q=T.useCallback(async te=>{try{await S(te)}catch(V){console.error("Failed to reorder agents:",V)}},[S]),z=T.useCallback(te=>{w(te),r?.(te)},[r]);nNt();const U=T.useRef(null),H=T.useCallback(te=>{U.current=te,e&&(e.current=te)},[e]);return A.jsx(Vie,{children:A.jsxs("div",{ref:n,className:"relative flex h-full flex-col bg-white dark:bg-neutral-950",children:[A.jsxs("div",{className:"shrink-0 flex items-center justify-between px-5 pb-2 pt-4",children:[A.jsx("h1",{className:"text-[17px] font-semibold text-neutral-900 dark:text-neutral-100",children:i("agents.agentTeam",{defaultValue:"Agent Team"})}),A.jsxs("div",{className:"flex items-center gap-1",children:[A.jsx("button",{onClick:()=>z(!_),className:`flex h-8 w-8 items-center justify-center rounded-full transition-colors ${_?"bg-neutral-900 text-white dark:bg-white dark:text-neutral-900":"text-neutral-500 active:bg-neutral-100 dark:text-neutral-400 dark:active:bg-neutral-800"}`,children:A.jsx(Par,{className:"h-[18px] w-[18px]"})}),A.jsx("button",{onClick:()=>l(!0),className:"flex h-8 w-8 items-center justify-center rounded-full text-neutral-500 active:bg-neutral-100 dark:text-neutral-400 dark:active:bg-neutral-800 transition-colors",children:A.jsx(Bd,{className:"h-5 w-5"})})]})]}),A.jsx("div",{ref:H,className:"custom-scrollbar flex-1 overflow-y-auto pb-4",style:{overscrollBehaviorY:"none"},children:A.jsx("div",{children:A.jsx(ENt,{agents:N,variant:"detailed",sortable:!0,sortModeControlled:_,rootAgentId:k,publishedAgentIds:P,lastConversationTimeByAgent:O,activeTopicCountByAgent:L,onAgentClick:F,loadingAgentId:y,onEdit:$,onDelete:j,onReorder:Q,onSortModeChange:z})})}),A.jsx(ZDt,{isOpen:o,onClose:()=>l(!1)}),p&&A.jsx(QNe,{isOpen:u,onClose:()=>{d(!1),m(null)},sessionId:"",agentId:p.id,agentName:p.name,agent:p,currentAvatar:p.avatar??void 0,onAvatarChange:te=>{m({...p,avatar:te}),E(p.id,te)},onGridSizeChange:()=>{},onDelete:WVr(p,k,P).allowed?()=>{C(p.id),d(!1),m(null)}:void 0},p.id),f&&A.jsx(x_,{isOpen:g,onClose:()=>h(!1),onConfirm:()=>{P.has(f.id)||(C(f.id),h(!1),b(null))},title:P.has(f.id)?i("agents.deleteBlockedTitle",{defaultValue:"Can't delete agent"}):i("agents.deleteTitle"),message:P.has(f.id)?i("agents.deleteBlockedMessage",{defaultValue:"This agent is published to Agent Market. Please unpublish it first, then delete it."}):i("agents.deleteConfirm",{name:f.name}),confirmLabel:P.has(f.id)?i("common.ok"):i("agents.deleteAgent"),cancelLabel:i("common.cancel"),destructive:!P.has(f.id)})]})})}const QLe=400;function VVr({backendUrl:t=NN,showAuthError:e=!1,onRetryAuth:n,authOverlay:r}){M3e();const{t:i}=Cn(),{isXyzenOpen:o,closeXyzen:l,activePanel:u,setActivePanel:d,setBackendUrl:p,activeChatChannel:m,setActiveChatChannel:g}=Un(us(j=>({isXyzenOpen:j.isXyzenOpen,closeXyzen:j.closeXyzen,activePanel:j.activePanel,setActivePanel:j.setActivePanel,setBackendUrl:j.setBackendUrl,activeChatChannel:j.activeChatChannel,setActiveChatChannel:j.setActiveChatChannel}))),[h,f]=T.useState(!1),[b,y]=T.useState({x:0,y:0}),[v,_]=T.useState({width:Uxe,height:600}),[w,x]=T.useState(!1),[k,C]=T.useState(!1),E=T.useRef(null);T.useEffect(()=>{if(f(!0),p(t),typeof window<"u"){const j=Math.min(window.innerHeight-100,700),Q=Uxe,z=window.innerWidth-Q-50,U=(window.innerHeight-j)/2;y({x:Math.max(20,z),y:Math.max(20,U)}),_({width:Q,height:j})}},[t,p]),T.useEffect(()=>{const j=Q=>{(Q.metaKey||Q.ctrlKey)&&Q.shiftKey&&Q.key==="X"&&(Q.preventDefault(),o&&l())};return window.addEventListener("keydown",j),()=>window.removeEventListener("keydown",j)},[o,l]);const S=T.useRef({x:0,y:0}),I=T.useRef({x:0,y:0}),B=j=>{j.target.closest("button, [role='button']")||(x(!0),S.current={x:j.clientX,y:j.clientY},I.current={...b},j.currentTarget.setPointerCapture(j.pointerId))},R=j=>{if(!w)return;j.preventDefault();const Q=j.clientX-S.current.x,z=j.clientY-S.current.y;let U=I.current.x+Q,H=I.current.y+z;const te=window.innerWidth-v.width,V=window.innerHeight-v.height;U=Math.max(0,Math.min(U,te)),H=Math.max(0,Math.min(H,V)),y({x:U,y:H})},L=j=>{x(!1),j.currentTarget.releasePointerCapture(j.pointerId)},M=T.useRef({x:0,y:0}),N=T.useRef({width:0,height:0}),D=T.useRef({x:0,y:0}),P=(j,Q)=>{j.preventDefault(),j.stopPropagation(),C(!0),E.current=Q,M.current={x:j.clientX,y:j.clientY},N.current={...v},D.current={...b},j.target.setPointerCapture(j.pointerId)},O=j=>{if(!k||!E.current)return;j.preventDefault(),j.stopPropagation();const Q=j.clientX-M.current.x,z=j.clientY-M.current.y,U=N.current.width,H=N.current.height,te=D.current.x,V=D.current.y;let re=U,ie=H,X=te,W=V;const q=E.current;if(q.includes("e")&&(re=U+Q),q.includes("w")&&(re=U-Q,X=te+Q),q.includes("s")&&(ie=H+z),q.includes("n")&&(ie=H-z,W=V+z),re<zxe&&(re=zxe,q.includes("w")&&(X=te+(U-zxe))),ie<QLe&&(ie=QLe,q.includes("n")&&(W=V+(H-QLe))),X<0){const Y=0-X;X=0,re-=Y}if(W<0){const Y=0-W;W=0,ie-=Y}X+re>window.innerWidth&&(re=window.innerWidth-X),W+ie>window.innerHeight&&(ie=window.innerHeight-W),_({width:re,height:ie}),y({x:X,y:W})},F=j=>{C(!1),E.current=null,j.target.releasePointerCapture(j.pointerId)};if(!h)return null;const $={position:"fixed",left:b.x,top:b.y,width:v.width,height:v.height,zIndex:50,boxShadow:"0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)"};return A.jsxs(A.Fragment,{children:[A.jsxs("div",{className:"flex flex-col bg-white dark:bg-black overflow-visible rounded-sm",style:$,children:[A.jsxs(A.Fragment,{children:[A.jsx("div",{className:"absolute top-0 left-0 w-full h-1.5 cursor-ns-resize z-50 bg-transparent hover:bg-indigo-500/10 transition-colors",onPointerDown:j=>P(j,"n"),onPointerMove:O,onPointerUp:F}),A.jsx("div",{className:"absolute bottom-0 left-0 w-full h-1.5 cursor-ns-resize z-50 bg-transparent hover:bg-indigo-500/10 transition-colors",onPointerDown:j=>P(j,"s"),onPointerMove:O,onPointerUp:F}),A.jsx("div",{className:"absolute top-0 left-0 w-1.5 h-full cursor-ew-resize z-50 bg-transparent hover:bg-indigo-500/10 transition-colors",onPointerDown:j=>P(j,"w"),onPointerMove:O,onPointerUp:F}),A.jsx("div",{className:"absolute top-0 right-0 w-1.5 h-full cursor-ew-resize z-50 bg-transparent hover:bg-indigo-500/10 transition-colors",onPointerDown:j=>P(j,"e"),onPointerMove:O,onPointerUp:F}),A.jsx("div",{className:"absolute top-0 left-0 w-4 h-4 cursor-nwse-resize z-51 bg-transparent",onPointerDown:j=>P(j,"nw"),onPointerMove:O,onPointerUp:F}),A.jsx("div",{className:"absolute top-0 right-0 w-4 h-4 cursor-nesw-resize z-51 bg-transparent",onPointerDown:j=>P(j,"ne"),onPointerMove:O,onPointerUp:F}),A.jsx("div",{className:"absolute bottom-0 left-0 w-4 h-4 cursor-nesw-resize z-51 bg-transparent",onPointerDown:j=>P(j,"sw"),onPointerMove:O,onPointerUp:F}),A.jsx("div",{className:"absolute bottom-0 right-0 w-4 h-4 cursor-nwse-resize z-51 bg-transparent",onPointerDown:j=>P(j,"se"),onPointerMove:O,onPointerUp:F})]}),A.jsx(HVr,{variant:"side",isMobile:!1,onDragStart:B,onDragMove:R,onDragEnd:L,showBackButton:u==="chat"&&!!m,onBackClick:()=>{g(null)},backButtonLabel:i(m?"app.chat.chatLabel":"app.chat.assistantsTitle")}),A.jsxs("div",{className:"flex flex-1 overflow-hidden relative",children:[A.jsx(RPt,{activePanel:u,onPanelChange:d,isMobile:!1}),A.jsx("div",{className:"flex-1 flex flex-col h-full overflow-hidden bg-white dark:bg-neutral-950",children:r?A.jsx("div",{className:"flex-1 overflow-y-auto custom-scrollbar",children:r}):A.jsxs(A.Fragment,{children:[u==="chat"&&(m?A.jsxs("div",{className:"h-full flex",children:[A.jsx("div",{className:"flex-1 min-w-0 h-full bg-white dark:bg-black",children:A.jsx(g3e,{})}),A.jsx(JNe,{})]}):A.jsxs("div",{className:"h-full bg-white dark:bg-neutral-950 flex flex-col",children:[A.jsxs("div",{className:"sm:border-b border-neutral-200 p-4 dark:border-neutral-800 shrink-0",children:[A.jsx("h2",{className:"text-sm font-semibold text-neutral-900 dark:text-white",children:i("app.chat.assistantsTitle")}),A.jsx("p",{className:"mt-1 text-xs text-neutral-500 dark:text-neutral-400",children:i("app.chat.chooseAgentHint")})]}),A.jsx("div",{className:"flex-1 overflow-y-auto py-4",children:A.jsx(LPt,{})})]})),u==="knowledge"&&A.jsx(I3e,{compact:!0}),u==="skills"&&A.jsx("div",{className:"h-full bg-white dark:bg-neutral-950",children:A.jsx(L3e,{})}),u==="memory"&&A.jsx("div",{className:"h-full bg-white dark:bg-neutral-950",children:A.jsx(T3e,{})}),u==="marketplace"&&A.jsx("div",{className:"h-full bg-white dark:bg-neutral-950",children:A.jsx(S3e,{})}),u==="sandbox"&&A.jsx("div",{className:"h-full bg-white dark:bg-neutral-950",children:A.jsx(D3e,{})}),u==="runner"&&A.jsx("div",{className:"h-full bg-white dark:bg-neutral-950",children:A.jsx(B3e,{})}),u==="tasks"&&A.jsx("div",{className:"h-full bg-white dark:bg-neutral-950",children:A.jsx(R3e,{})}),e&&A.jsx("div",{className:"absolute inset-0 z-50 bg-background/80 backdrop-blur-sm flex items-center justify-center",children:A.jsx("div",{className:"w-full max-w-md px-4",children:A.jsx(OSe,{onRetry:n??(()=>{}),variant:"inline"})})})]})})]})]}),A.jsx(F3e,{}),A.jsx(FLe,{})]})}const KVr=Object.freeze(Object.defineProperty({__proto__:null,AppSide:VVr},Symbol.toStringTag,{value:"Module"}));function ZVr(){const{t}=Cn(),{user:e,logout:n}=Xg(),r=Un(I=>I.openSettingsModal),{backend:i}=EDe(),o=mO(),l=o?.subQuery.data,u=o?.usageQuery.data,d=pO(),m=dBe()?.query.data,h=NEt().data?.total_earned,f=Tc(),[b,y]=T.useState(!1),[v,_]=T.useState(!1),[w,x]=T.useState(!1),[k,C]=T.useState(!1),E=async()=>{if(!(b||m?.checked_in_today)){y(!0);try{await eC.checkIn(),await f.invalidateQueries({queryKey:["check-in"]}),await f.invalidateQueries({queryKey:["userWallet"]})}finally{y(!1)}}},S=I=>I<1024?`${I} B`:I<1024*1024?`${(I/1024).toFixed(1)} KB`:I<1024*1024*1024?`${(I/(1024*1024)).toFixed(1)} MB`:`${(I/(1024*1024*1024)).toFixed(2)} GB`;return A.jsxs("div",{className:"h-full overflow-y-auto custom-scrollbar bg-neutral-100 dark:bg-neutral-950",children:[A.jsxs("div",{className:"mx-auto max-w-lg px-4 py-6 space-y-6",children:[A.jsxs("div",{className:"flex items-center gap-4 rounded-xl bg-white p-4 dark:bg-neutral-900",children:[A.jsx("div",{className:"h-16 w-16 flex-shrink-0 overflow-hidden rounded-full bg-neutral-200 dark:bg-neutral-700",children:e?.avatar?A.jsx("img",{src:e.avatar,alt:e.username,className:"h-full w-full object-cover"}):A.jsx("div",{className:"flex h-full w-full items-center justify-center text-2xl font-bold text-neutral-400 dark:text-neutral-500",children:e?.username?.charAt(0)?.toUpperCase()??"?"})}),A.jsxs("div",{className:"min-w-0 flex-1",children:[A.jsx("h2",{className:"truncate text-lg font-semibold text-neutral-900 dark:text-neutral-100",children:e?.username??"—"}),l?.role&&A.jsx("span",{className:"mt-0.5 inline-block rounded-full bg-indigo-100 px-2.5 py-0.5 text-xs font-medium text-indigo-700 dark:bg-indigo-900/40 dark:text-indigo-300",children:l.role.display_name})]}),A.jsx(HDt,{})]}),A.jsxs("div",{className:"overflow-hidden rounded-xl bg-white dark:bg-neutral-900",children:[A.jsxs("div",{role:"button",tabIndex:0,onClick:()=>_(!0),onKeyDown:I=>{(I.key==="Enter"||I.key===" ")&&_(!0)},className:"flex w-full items-center gap-3 px-4 py-3 text-left active:bg-neutral-50 dark:active:bg-neutral-800 cursor-pointer",children:[A.jsx(uR,{className:"h-5 w-5 flex-shrink-0 text-orange-500"}),A.jsxs("div",{className:"min-w-0 flex-1",children:[A.jsx("p",{className:"text-sm text-neutral-900 dark:text-neutral-100",children:t("app.account.checkIn")}),A.jsx("p",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:m?t("app.account.streak",{days:m.consecutive_days}):"—"})]}),A.jsx("button",{onClick:I=>{I.stopPropagation(),E()},disabled:b||m?.checked_in_today,className:`rounded-full px-3 py-1 text-xs font-medium transition-colors ${m?.checked_in_today?"bg-neutral-100 text-neutral-400 dark:bg-neutral-800 dark:text-neutral-500":"bg-orange-500 text-white active:bg-orange-600"}`,children:b?"...":m?.checked_in_today?t("app.account.checkedIn"):t("app.account.checkInAction")})]}),A.jsx("div",{className:"ml-12 border-t border-neutral-100 dark:border-neutral-800"}),A.jsxs("button",{onClick:()=>x(!0),className:"flex w-full items-center gap-3 px-4 py-3 text-left active:bg-neutral-50 dark:active:bg-neutral-800",children:[A.jsx(Ks,{className:"h-5 w-5 flex-shrink-0 text-amber-500"}),A.jsxs("div",{className:"min-w-0 flex-1",children:[A.jsx("p",{className:"text-sm text-neutral-900 dark:text-neutral-100",children:t("app.account.credits")}),A.jsx("p",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:d?t("app.account.balance",{amount:(d.points??0).toLocaleString()}):"—"})]}),A.jsx(hg,{className:"h-4 w-4 flex-shrink-0 text-neutral-400 dark:text-neutral-500"})]}),A.jsx("div",{className:"ml-12 border-t border-neutral-100 dark:border-neutral-800"}),RA("developerReward")&&A.jsxs("button",{onClick:()=>C(!0),className:"flex w-full items-center gap-3 px-4 py-3 text-left active:bg-neutral-50 dark:active:bg-neutral-800",children:[A.jsx(vae,{className:"h-5 w-5 flex-shrink-0 text-purple-500"}),A.jsxs("div",{className:"min-w-0 flex-1",children:[A.jsx("p",{className:"text-sm text-neutral-900 dark:text-neutral-100",children:t("subscription.creator")}),A.jsx("p",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:h!=null?t("app.account.creatorEarnings",{amount:h.toLocaleString()}):"—"})]}),A.jsx(hg,{className:"h-4 w-4 flex-shrink-0 text-neutral-400 dark:text-neutral-500"})]})]}),u&&A.jsxs("div",{className:"overflow-hidden rounded-xl bg-white p-4 dark:bg-neutral-900 space-y-3",children:[A.jsx("h3",{className:"text-xs font-medium uppercase tracking-wide text-neutral-500 dark:text-neutral-400",children:t("app.account.usage")}),A.jsx(HG,{label:t("app.account.storage"),used:S(u.storage.used_bytes),limit:S(u.storage.limit_bytes),percent:u.storage.usage_percentage}),A.jsx(HG,{label:t("app.account.files"),used:String(u.files.used),limit:String(u.files.limit),percent:u.files.limit>0?u.files.used/u.files.limit*100:0}),A.jsx(HG,{label:t("app.account.parallelChats"),used:String(u.chats.used),limit:String(u.chats.limit),percent:u.chats.limit>0?u.chats.used/u.chats.limit*100:0}),u.sandboxes.limit>0&&A.jsx(HG,{label:t("subscription.sub.sandboxes"),used:String(u.sandboxes.used),limit:String(u.sandboxes.limit),percent:u.sandboxes.limit>0?u.sandboxes.used/u.sandboxes.limit*100:0}),u.scheduled_tasks&&u.scheduled_tasks.limit>0&&A.jsx(HG,{label:t("app.account.scheduledTasks"),used:String(u.scheduled_tasks.used),limit:String(u.scheduled_tasks.limit),percent:u.scheduled_tasks.limit>0?u.scheduled_tasks.used/u.scheduled_tasks.limit*100:0})]}),A.jsxs("div",{className:"overflow-hidden rounded-xl bg-white dark:bg-neutral-900",children:[A.jsx(ice,{icon:ch,label:t("app.account.settings"),onClick:()=>r()}),A.jsx(ice,{icon:N0t,label:t("app.account.redeem"),onClick:()=>r("redemption")}),A.jsx(ice,{icon:$1,label:t("app.account.region"),onClick:()=>r("region")}),A.jsx(ice,{icon:du,label:t("app.account.about"),onClick:()=>r("about"),isLast:!0})]}),A.jsx("div",{className:"overflow-hidden rounded-xl bg-white dark:bg-neutral-900",children:A.jsxs("button",{onClick:n,className:"flex w-full items-center justify-center py-3 text-sm font-medium text-red-600 active:bg-neutral-50 dark:text-red-400 dark:active:bg-neutral-800",children:[A.jsx(HSe,{className:"mr-2 h-5 w-5"}),t("app.authStatus.logout")]})}),A.jsx("p",{className:"pb-2 text-center text-xs text-neutral-400 dark:text-neutral-600",children:i.isLoaded?`${i.versionName} v${i.version}`:"Xyzen"})]}),A.jsx(HDe,{isOpen:v,onClose:()=>_(!1)}),A.jsx(gO,{isOpen:w,onClose:()=>x(!1)}),RA("developerReward")&&A.jsx(KTe,{isOpen:k,onClose:()=>C(!1)})]})}function ice({icon:t,label:e,onClick:n,isLast:r=!1}){return A.jsxs(A.Fragment,{children:[A.jsxs("button",{onClick:n,className:"flex w-full items-center gap-3 px-4 py-3 text-left active:bg-neutral-50 dark:active:bg-neutral-800",children:[A.jsx(t,{className:"h-5 w-5 flex-shrink-0 text-neutral-500 dark:text-neutral-400"}),A.jsx("span",{className:"flex-1 text-sm text-neutral-900 dark:text-neutral-100",children:e}),A.jsx(hg,{className:"h-4 w-4 flex-shrink-0 text-neutral-400 dark:text-neutral-500"})]}),!r&&A.jsx("div",{className:"ml-12 border-t border-neutral-100 dark:border-neutral-800"})]})}function HG({label:t,used:e,limit:n,percent:r}){const i=Math.min(100,Math.max(0,r));return A.jsxs("div",{children:[A.jsxs("div",{className:"flex items-center justify-between text-xs text-neutral-600 dark:text-neutral-400",children:[A.jsx("span",{children:t}),A.jsxs("span",{children:[e," / ",n]})]}),A.jsx("div",{className:"mt-1 h-1.5 w-full overflow-hidden rounded-full bg-neutral-100 dark:bg-neutral-800",children:A.jsx("div",{className:`h-full rounded-full transition-all ${i>90?"bg-red-500":i>70?"bg-amber-500":"bg-indigo-500"}`,style:{width:`${i}%`}})})]})}function XVr(){const t=new Date().getHours();return t<6?"night":t<12?"morning":t<18?"afternoon":"evening"}function JVr(t){const e=new Date,n=e.toLocaleDateString(t,{weekday:"long"}),r=String(e.getDate()).padStart(2,"0"),i=String(e.getMonth()+1).padStart(2,"0");return{weekday:n,dayNum:r,monthNum:i}}const eKr={free:lx,lite:lx,standard:vte,pro:bte,professional:bte,ultra:y1},TC=36,$Le=2.5,jLe=(TC-$Le)/2,oce=2*Math.PI*jLe;function tKr({daysLeft:t,totalDays:e,tierName:n,visible:r,onClick:i}){const o=t!==null&&e>0?Math.min(1,Math.max(.02,t/e)):0,l=oce*(1-o),u=eKr[n]??lx;return A.jsxs("button",{onClick:i,className:"relative flex items-center justify-center active:scale-95 transition-transform",style:{width:TC,height:TC},children:[A.jsxs("svg",{width:TC,height:TC,className:"-rotate-90",children:[A.jsx(Et.circle,{cx:TC/2,cy:TC/2,r:jLe,fill:"none",stroke:"currentColor",className:"text-neutral-300 dark:text-neutral-700",strokeWidth:$Le,initial:{opacity:0},animate:r?{opacity:1}:{opacity:0},transition:{duration:.4,delay:.3}}),t!==null&&A.jsx(Et.circle,{cx:TC/2,cy:TC/2,r:jLe,fill:"none",stroke:"currentColor",className:"text-neutral-800 dark:text-neutral-200",strokeWidth:$Le,strokeLinecap:"round",strokeDasharray:oce,initial:{strokeDashoffset:oce},animate:r?{strokeDashoffset:l}:{strokeDashoffset:oce},transition:{duration:1.2,delay:.6,ease:[.16,1,.3,1]}})]}),A.jsx(Et.span,{className:"absolute text-neutral-700 dark:text-neutral-300",initial:{opacity:0,scale:.5},animate:r?{opacity:1,scale:1}:{opacity:0,scale:.5},transition:{duration:.4,delay:.8},children:A.jsx(u,{className:"h-3.5 w-3.5"})})]})}const MPt=10,PPt=.05,nKr=2;function rKr({agents:t,rootAgentId:e,agentStats:n,yesterdaySummary:r,chatHistory:i,onAgentClick:o,onTopicClick:l,onActiveAgentChange:u}){const{t:d}=Cn(),[p,m]=T.useState(0),g=ry(0),[h,f]=T.useState(!1),[b,y]=T.useState(!1),v=T.useMemo(()=>{const k=t.find(E=>E.id===e),C=t.filter(E=>E.id!==e);return k?[k,...C]:C},[t,e]);T.useEffect(()=>{v[p]&&u(v[p])},[p,v,u]);const _=T.useCallback((k,C)=>{f(!1);const E=80;C.offset.x<-E&&p<v.length-1?m(S=>S+1):C.offset.x>E&&p>0&&m(S=>S-1),OEe(g,0,{type:"spring",stiffness:400,damping:30})},[p,v.length,g]),w=T.useCallback(k=>i.filter(C=>C.assistantTitle===t.find(E=>E.id===k)?.name).slice(0,3),[i,t]);if(v.length===0)return null;const x={type:"spring",stiffness:300,damping:30};return A.jsxs("div",{className:"relative flex w-full flex-1 flex-col",children:[A.jsx("p",{className:"mb-3 text-[11px] font-semibold uppercase tracking-[2px] text-neutral-400 dark:text-neutral-500",children:d("app.loft.agentStack")}),A.jsx("div",{className:"relative flex-1 min-h-0 overflow-hidden",children:v.map((k,C)=>{const E=C-p;if(E<0||E>nKr)return null;const S=E===0,I=v.length-E,B=n[k.id],R=r[k.id],L=w(k.id);return A.jsx(aKr,{agent:k,isActive:S,cardOffset:E,zIndex:I,dragX:g,dragging:h,setDragging:f,handleDragEnd:_,rootAgentId:e,stats:B,yesterday:R,recentTopics:L,topicsHidden:b,setTopicsHidden:y,onAgentClick:o,onTopicClick:l,spring:x,t:d},k.id)})}),v.length>1&&A.jsx("div",{className:"mt-3 flex justify-center gap-1.5",children:v.map((k,C)=>A.jsx(Et.div,{animate:{width:C===p?16:4},transition:x,className:`h-1 rounded-full ${C===p?"bg-neutral-800 dark:bg-neutral-200":"bg-neutral-300 dark:bg-neutral-600"}`},C))})]})}function aKr({agent:t,isActive:e,cardOffset:n,zIndex:r,dragX:i,dragging:o,setDragging:l,handleDragEnd:u,rootAgentId:d,stats:p,yesterday:m,recentTopics:g,topicsHidden:h,setTopicsHidden:f,onAgentClick:b,onTopicClick:y,spring:v,t:_}){const w=$b(i,[-200,0,200],[1,0,-1]),x=$b(w,E=>{const S=Math.max(0,Math.abs(E));return(n-S*Math.min(n,1))*MPt}),k=$b(w,E=>{const S=Math.max(0,Math.abs(E));return 1-(n-S*Math.min(n,1))*PPt}),C=$b(w,E=>{const S=Math.max(0,Math.abs(E));return 1-(n-S*Math.min(n,1))*.15});return A.jsx(Et.div,{className:"absolute inset-x-0 top-0 bottom-0",style:{zIndex:r,...e?{x:i}:{y:x,scale:k,opacity:C}},animate:e?{y:0,scale:1,opacity:1}:{y:n*MPt,scale:1-n*PPt,opacity:1-n*.15},transition:v,...e?{drag:"x",dragConstraints:{left:0,right:0},dragElastic:.6,onDragStart:()=>l(!0),onDragEnd:u}:{},onClick:()=>{o||b(t)},children:A.jsxs("div",{className:"relative flex h-full cursor-pointer flex-col overflow-hidden rounded-2xl bg-[#f9f7f0] p-5 shadow-sm shadow-black/[0.04] ring-1 ring-[#e8e4d8]/80 dark:bg-neutral-900 dark:shadow-black/20 dark:ring-neutral-800",style:{contain:"layout style paint",willChange:"transform"},children:[A.jsx("div",{className:"pointer-events-none absolute inset-0 dark:hidden",style:{backgroundImage:"radial-gradient(ellipse 80% 70% at 50% 45%, #f9f7f0 30%, transparent 100%), linear-gradient(to right, rgb(229 229 229 / 0.5) 1px, transparent 1px), linear-gradient(to bottom, rgb(229 229 229 / 0.5) 1px, transparent 1px)",backgroundSize:"100% 100%, 28px 28px, 28px 28px"}}),A.jsx("div",{className:"pointer-events-none absolute inset-0 hidden dark:block",style:{backgroundImage:"radial-gradient(ellipse 80% 70% at 50% 45%, rgb(23 23 23) 30%, transparent 100%), linear-gradient(to right, rgb(64 64 64 / 0.3) 1px, transparent 1px), linear-gradient(to bottom, rgb(64 64 64 / 0.3) 1px, transparent 1px)",backgroundSize:"100% 100%, 28px 28px, 28px 28px"}}),A.jsxs("div",{className:"relative flex flex-1 flex-col",children:[A.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[A.jsx("div",{className:"h-11 w-11 shrink-0 overflow-hidden rounded-xl bg-neutral-100 dark:bg-white/10",children:A.jsx("img",{src:t.avatar||`https://api.dicebear.com/7.x/avataaars/svg?seed=${t.id}`,alt:t.name,className:"h-full w-full object-cover"})}),A.jsxs("div",{className:"min-w-0 flex-1",children:[A.jsxs("div",{className:"flex items-center gap-2",children:[A.jsx("h3",{className:"truncate text-[16px] font-bold text-neutral-900 dark:text-white",children:t.name}),t.id===d&&A.jsx("span",{className:"shrink-0 rounded-sm bg-neutral-900/10 px-1.5 py-px text-[9px] font-semibold uppercase tracking-wider text-neutral-500 dark:bg-white/10 dark:text-neutral-400",children:"CEO"})]}),A.jsx("p",{className:"truncate text-[12px] text-neutral-500 dark:text-neutral-400",children:t.description||"Your AI assistant"})]})]}),A.jsxs("div",{className:"mb-3 flex items-center gap-4",children:[p&&A.jsxs(A.Fragment,{children:[A.jsxs("div",{className:"flex items-center gap-1.5",children:[A.jsx(qb,{className:"h-3.5 w-3.5 text-neutral-400 dark:text-neutral-500"}),A.jsx("span",{className:"text-xs font-semibold text-neutral-700 dark:text-neutral-300",children:p.message_count}),A.jsx("span",{className:"text-[10px] text-neutral-400 dark:text-neutral-500",children:"msgs"})]}),A.jsxs("div",{className:"flex items-center gap-1.5",children:[A.jsx(yf,{className:"h-3.5 w-3.5 text-neutral-400 dark:text-neutral-500"}),A.jsx("span",{className:"text-xs font-semibold text-neutral-700 dark:text-neutral-300",children:p.topic_count}),A.jsx("span",{className:"text-[10px] text-neutral-400 dark:text-neutral-500",children:"topics"})]})]}),A.jsx("button",{className:"ml-auto p-1 text-neutral-400 active:text-neutral-600 dark:text-neutral-500 dark:active:text-neutral-300 transition-colors",onClick:E=>{E.stopPropagation(),f(S=>!S)},children:h?A.jsx(ZSe,{className:"h-3.5 w-3.5"}):A.jsx(TI,{className:"h-3.5 w-3.5"})})]}),m&&m.message_count>0&&A.jsxs("div",{className:"mb-3 rounded-lg bg-neutral-100/60 px-3 py-2 dark:bg-white/[0.06]",children:[A.jsx("p",{className:"text-[11px] font-medium text-neutral-500 dark:text-neutral-400",children:_("agents.spatialNode.yesterdaySummary",{topicCount:m.topic_count,messageCount:m.message_count,defaultValue:`Yesterday: ${m.topic_count} topics, ${m.message_count} messages`})}),m.last_message_content&&A.jsxs("p",{className:"mt-1 truncate text-[11px] text-neutral-400 dark:text-neutral-500",children:["“",m.last_message_content,"”"]})]}),A.jsx("div",{className:"flex-1 space-y-1 overflow-hidden",children:g.length>0?g.map(E=>A.jsxs("button",{className:"flex w-full items-center justify-between rounded-lg bg-neutral-100/50 px-3 py-2 text-left transition-colors active:bg-neutral-200/60 dark:bg-white/[0.05] dark:active:bg-white/[0.12]",onClick:S=>{S.stopPropagation(),y(E.id)},children:[A.jsx("span",{className:"truncate text-[12px] text-neutral-700 dark:text-neutral-300",children:h?"***":E.title||"Untitled"}),A.jsx("span",{className:"shrink-0 text-[10px] text-neutral-400 dark:text-neutral-500",children:Cq(E.updatedAt)})]},E.id)):A.jsx("div",{className:"flex h-full items-center justify-center",children:A.jsx("p",{className:"text-[12px] text-neutral-400 dark:text-neutral-500",children:_("app.loft.noRecentChats")})})})]})]})})}const iKr={show:{transition:{staggerChildren:.08,delayChildren:.15}},hidden:{}},sce={hidden:{opacity:0,y:20},show:{opacity:1,y:0,transition:{duration:.55,ease:[.16,1,.3,1]}}},oKr={hidden:{opacity:0,x:-12},show:{opacity:1,x:0,transition:{duration:.5,ease:[.16,1,.3,1]}}},sKr=({visible:t,overlayRef:e,onDismiss:n,onNavigateToChat:r})=>{const{t:i,i18n:o}=Cn(),{agents:l,rootAgentId:u,activateChannelForAgent:d,activateChannel:p,createDefaultChannel:m,sendMessage:g,agentStats:h,yesterdaySummary:f,chatHistory:b}=Un(us(U=>({agents:U.agents,rootAgentId:U.rootAgentId,activateChannelForAgent:U.activateChannelForAgent,activateChannel:U.activateChannel,createDefaultChannel:U.createDefaultChannel,sendMessage:U.sendMessage,agentStats:U.agentStats,yesterdaySummary:U.yesterdaySummary,chatHistory:U.chatHistory}))),[y,v]=T.useState(null),_=y??l.find(U=>U.id===u)??null,w=XVr(),{weekday:x,dayNum:k,monthNum:C}=T.useMemo(()=>JVr(o.language==="zh"?"zh-CN":o.language==="ja"?"ja-JP":"en-US"),[o.language]),E=mO(),S=E?.subQuery?.data?.subscription,B=E?.subQuery?.data?.role?.name??"free",{daysLeft:R,totalDays:L}=T.useMemo(()=>{if(!S?.expires_at)return{daysLeft:null,totalDays:30};const U=new Date(S.expires_at).getTime()-Date.now();return U<=0?{daysLeft:0,totalDays:30}:{daysLeft:Math.ceil(U/(1e3*60*60*24)),totalDays:30}},[S?.expires_at]),[M,N]=T.useState(!1),{data:D}=YCt("active"),P=T.useMemo(()=>{if(!D||D.length===0)return 0;const U=new Date,H=new Date(U.getFullYear(),U.getMonth(),U.getDate());return D.filter(te=>te.schedule_type==="daily"||te.schedule_type==="cron"||te.schedule_type==="weekly"?!0:new Date(te.scheduled_at)>=H).length},[D]);T.useEffect(()=>{const U=e.current;if(U)if(t)U.style.pointerEvents="auto",requestAnimationFrame(()=>{U.style.transition="transform 0.4s cubic-bezier(0.32, 0.72, 0, 1)",U.style.transform="translateY(0)"});else{U.style.transition="transform 0.3s cubic-bezier(0.32, 0.72, 0, 1)",U.style.transform="translateY(-100%)";const H=()=>{U.removeEventListener("transitionend",H),U.style.pointerEvents="none"};U.addEventListener("transitionend",H),setTimeout(H,400)}},[t,e]);const[O,F]=T.useState(""),$=T.useCallback(async U=>{_&&(await m(_.id),g(U),r())},[_,m,g,r]),j=T.useCallback(async U=>{await d(U.id),r()},[d,r]),Q=T.useCallback(async U=>{await p(U),r()},[p,r]),z=T.useCallback(U=>{v(U)},[]);return A.jsxs("div",{ref:e,className:"absolute inset-0 z-40 will-change-transform",style:{transform:t?"translateY(0)":"translateY(-100%)",pointerEvents:t?"auto":"none"},children:[A.jsx("div",{className:"absolute inset-0 bg-gradient-to-b from-[#faf8f0] via-[#fcfbf7] via-60% to-white dark:from-[#131210] dark:via-[#171614] dark:via-60% dark:to-black"}),A.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-0 h-12 bg-gradient-to-b from-white/80 to-transparent dark:from-black/80"}),A.jsx("div",{className:"pointer-events-none absolute left-[-15%] top-[30%] h-[320px] w-[320px] rounded-full",style:{background:"radial-gradient(circle, rgb(163 163 163 / 0.3) 0%, transparent 70%)"}}),A.jsx("div",{className:"pointer-events-none absolute right-[-10%] top-[45%] h-[260px] w-[260px] rounded-full",style:{background:"radial-gradient(circle, rgb(212 212 212 / 0.25) 0%, transparent 70%)"}}),A.jsx("div",{className:"relative flex h-full flex-col px-6",children:A.jsxs(Et.div,{variants:iKr,initial:"hidden",animate:t?"show":"hidden",className:"flex flex-1 flex-col",children:[A.jsxs(Et.div,{variants:sce,className:"flex items-center justify-between py-3",children:[A.jsx(Et.button,{onClick:n,whileTap:{scale:.9},className:"flex h-9 w-9 items-center justify-center rounded-full bg-white/50 active:bg-white/70 dark:bg-white/[0.08] dark:active:bg-white/[0.12]",children:A.jsx(P1,{className:"h-4 w-4 text-neutral-700 dark:text-neutral-300"})}),A.jsx(tKr,{daysLeft:R,totalDays:L,tierName:B,visible:t,onClick:()=>N(!0)})]}),A.jsxs(Et.div,{variants:sce,className:"mt-1",children:[A.jsxs(Et.div,{variants:oKr,className:"flex items-baseline gap-1.5",children:[A.jsx("span",{className:"text-[72px] font-extrabold leading-none tracking-tighter text-neutral-900 dark:text-neutral-100",children:k}),A.jsxs("span",{className:"text-[28px] font-light leading-none tracking-tight text-neutral-400/60 dark:text-neutral-500/60",children:["/ ",C]}),A.jsx("span",{className:"text-[16px] font-light leading-none tracking-tight text-neutral-400/60 dark:text-neutral-500/60",children:x})]}),A.jsx("p",{className:"mt-2.5 text-[22px] font-bold leading-[1.15] tracking-tight text-neutral-700 dark:text-neutral-300",children:P>0?i("app.loft.tasksToday",{count:P}):i(`app.loft.timeGreeting.${w}`)})]}),A.jsx(Et.div,{variants:sce,className:"mt-4 mb-4 flex flex-1 flex-col overflow-hidden",children:A.jsx(rKr,{agents:l,rootAgentId:u,agentStats:h,yesterdaySummary:f,chatHistory:b,onAgentClick:j,onTopicClick:Q,onActiveAgentChange:z})}),A.jsxs(Et.form,{variants:sce,onSubmit:U=>{U.preventDefault();const H=O.trim();H&&(F(""),$(H))},className:"mb-6 flex items-center gap-2 rounded-2xl bg-white/90 px-4 py-3.5 shadow-lg shadow-neutral-400/15 supports-[backdrop-filter]:bg-white/80 backdrop-blur-md dark:bg-neutral-800/90 dark:shadow-black/20 dark:supports-[backdrop-filter]:bg-white/[0.08]",children:[A.jsx("input",{type:"text",value:O,onChange:U=>F(U.target.value),placeholder:i("app.loft.inputPlaceholder",{name:_?.name??"Agent"}),disabled:!_,className:"flex-1 bg-transparent text-[15px] text-neutral-800 placeholder:text-neutral-400 focus:outline-none dark:text-white dark:placeholder:text-neutral-500"}),A.jsx("button",{type:"submit",disabled:!_||!O.trim(),className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-neutral-900 text-white transition-all active:scale-90 disabled:opacity-15 dark:bg-white dark:text-neutral-900",children:A.jsx(Nar,{className:"h-4 w-4 stroke-[2.5]"})})]})]})}),A.jsx(gO,{isOpen:M,onClose:()=>N(!1)})]})},lKr=T.memo(sKr);function cKr({scrollRef:t,touchRef:e,enabled:n=!0,onPull:r,onProgress:i,onEnd:o}){const l=T.useRef(r);l.current=r;const u=T.useRef(i);u.current=i;const d=T.useRef(o);d.current=o;const p=T.useRef(n);p.current=n;const m=T.useRef(e);m.current=e,T.useEffect(()=>{const g=t.current;if(!g)return;const h=m.current?.current??g,f=800,b=2/3,y=1/3;let v=0,_=0,w=!1,x=!1,k=!1,C=!1,E=[0,0],S=[0,0];const I=L=>{if(!p.current)return;const M=L.touches[0];v=M.clientY,_=M.clientX,w=!1,x=!1,k=!1,E=[Date.now(),M.clientY],S=[Date.now(),M.clientY];const N=window.innerHeight;C=g.scrollTop<=0&&M.clientY<N*y,C&&(h.dataset.pullZone="")},B=L=>{if(!p.current)return;const M=L.touches[0],N=M.clientY-v,D=M.clientX-_;if(!x)if(Math.abs(D)>12||Math.abs(N)>12){if(x=!0,k=Math.abs(N)>Math.abs(D),!k){delete h.dataset.pullZone;return}}else return;if(k){if(g.scrollTop>0||N<=0||!C){w&&(w=!1,delete h.dataset.pulling,u.current?.(0));return}w=!0,h.dataset.pulling="",L.cancelable&&L.preventDefault(),E=S,S=[Date.now(),M.clientY],u.current?.(M.clientY)}},R=()=>{if(w){const L=(S[0]-E[0])/1e3,M=S[1]-E[1],N=L>0?M/L:0,D=window.innerHeight,P=S[1]>D*b||N>f;P&&l.current?.(),d.current?.(P)}w=!1,x=!1,k=!1,C=!1,delete h.dataset.pulling,delete h.dataset.pullZone};return h.addEventListener("touchstart",I,{passive:!0}),h.addEventListener("touchmove",B,{passive:!1}),h.addEventListener("touchend",R,{passive:!0}),h.addEventListener("touchcancel",R,{passive:!0}),()=>{h.removeEventListener("touchstart",I),h.removeEventListener("touchmove",B),h.removeEventListener("touchend",R),h.removeEventListener("touchcancel",R)}},[t])}function uKr(){const{activeChatChannel:t,mobileCeoOverlay:e,mobilePage:n}=Un(us(C=>({activeChatChannel:C.activeChatChannel,mobileCeoOverlay:C.mobileCeoOverlay,mobilePage:C.mobilePage}))),r=Un(C=>{const E=C.activeChatChannel;return E?C.channels[E]?.knowledge_set_id??null:null}),i=!!t,o=i&&!!r,l=o?3:i?2:1,u=T.useRef(!1),d=T.useRef(i),p=T.useRef(()=>{}),m=T.useRef(()=>{}),g=T.useRef(null),h=T.useRef(null),f=T.useRef(null),[b,y]=T.useState(!1),v=T.useCallback(()=>{const{setMobileCeoOverlay:C,activeChatChannel:E,rootAgentId:S,activateChannelForAgent:I}=Un.getState();C(!0),u.current=!1,!E&&S&&I(S)},[]),_=T.useCallback(()=>{const{setMobileCeoOverlay:C,setActiveChatChannel:E,activeChatChannel:S,mobilePage:I}=Un.getState();C(!1),I===0&&(S?E(null):u.current=!0)},[]),w=T.useCallback(()=>{const{setMobilePage:C}=Un.getState();u.current=!1,C(1),p.current(1)},[]),x=T.useCallback(C=>{const{setMobilePage:E,setActiveChatChannel:S,activeChatChannel:I,mobileCeoOverlay:B}=Un.getState();E(C),C===0&&I&&!B&&S(null),C>=1&&(u.current=!1)},[]);T.useEffect(()=>{const C=d.current;d.current=i,!i&&C?(m.current(0),Un.getState().setMobilePage(0)):i&&!C&&(u.current?(Un.getState().setActiveChatChannel(null),u.current=!1):Un.getState().mobileCeoOverlay||(p.current(1),Un.getState().setMobilePage(1)))},[i]);const k=T.useRef(!1);return T.useEffect(()=>{if(k.current)return;k.current=!0;const C=Math.min(n,l-1);C>0&&m.current(C)},[l]),cKr({scrollRef:h,touchRef:f,enabled:!e&&!b,onPull:v,onProgress:T.useCallback(C=>{const E=g.current;if(E)if(C>0){const S=window.innerHeight,I=C/S,B=I*(1-.2*I),R=S*B,L=S-R;E.style.transition="none",E.style.transform=`translateY(-${L}px)`,E.style.pointerEvents="none"}else E.style.transition="none",E.style.transform="translateY(-100%)",E.style.pointerEvents="none"},[]),onEnd:T.useCallback(C=>{const E=g.current;E&&(C?(E.style.transition="transform 0.35s cubic-bezier(0.25, 1, 0.5, 1)",E.style.transform="translateY(0)",E.style.pointerEvents="auto"):(E.style.transition="transform 0.35s cubic-bezier(0.32, 0.72, 0, 1)",E.style.transform="translateY(-100%)"))},[])}),{overlay:e,pageCount:l,hasChannel:i,hasCapsule:o,overlayRef:g,agentScrollRef:h,agentContainerRef:f,goToPageRef:p,setPageImmediateRef:m,onSnap:x,showOverlay:v,dismissOverlay:_,navigateToChat:w,setAgentSortMode:y}}function OPt({pageCount:t,onSnap:e,velocityThreshold:n=.3,distanceThreshold:r=.25,rubberBand:i=.25,edgeWidth:o=24,bypassEdge:l=!1}){const u=T.useRef(null),d=T.useRef(null),p=T.useRef(0),[m,g]=T.useState(0),h=T.useRef(e);h.current=e;const f=T.useRef({active:!1,startX:0,startY:0,startTime:0,locked:!1,horizontal:!1}),b=T.useRef(!1),y=T.useRef(0),v=T.useCallback(()=>u.current?.offsetWidth??window.innerWidth,[]),_=T.useCallback((I,B)=>{const R=d.current;R&&(b.current=B,R.style.transition=B?"transform 0.4s cubic-bezier(0.22, 1, 0.36, 1)":"none",R.style.transform=`translate3d(${I}px,0,0)`)},[]),w=T.useCallback((I,B=!0)=>{const R=Math.max(0,Math.min(t-1,I)),L=v();if(_(-R*L,!0),p.current=R,g(R),B){const M=++y.current,N=d.current;if(!N){h.current?.(R);return}let D=!1;const P=()=>{D||(D=!0,M===y.current&&h.current?.(R))},O=()=>{N.removeEventListener("transitionend",O),b.current=!1,P()};N.addEventListener("transitionend",O),setTimeout(()=>{N.removeEventListener("transitionend",O),b.current=!1,P()},500)}},[t,v,_]),x=T.useCallback(I=>{const B=Math.max(0,Math.min(t-1,I));p.current=B,g(B),_(-B*v(),!1)},[t,_,v]),k=T.useRef(w);k.current=w;const C=T.useRef(t);C.current=t;const E=T.useRef(l);E.current=l,T.useEffect(()=>{const I=u.current;if(!I)return;const B=M=>{const N=M.touches[0];if(!E.current){const D=N.clientX<=o,P=N.clientX>=(u.current?.offsetWidth??window.innerWidth)-o;if(!D&&!P)return}if(f.current={active:!0,startX:N.clientX,startY:N.clientY,startTime:Date.now(),locked:!1,horizontal:!1},b.current){const D=d.current;if(D){const P=new DOMMatrix(getComputedStyle(D).transform);D.style.transition="none",D.style.transform=`translate3d(${P.m41}px,0,0)`,b.current=!1}}},R=M=>{const N=f.current;if(!N.active)return;const D=M.touches[0],P=D.clientX-N.startX,O=D.clientY-N.startY;if(!N.locked)if(Math.abs(P)>12||Math.abs(O)>12){if(N.locked=!0,N.horizontal=Math.abs(P)>=Math.abs(O),!N.horizontal){N.active=!1;return}}else return;if(!N.horizontal)return;M.cancelable&&M.preventDefault();const F=v();let j=-p.current*F+P;const Q=-(C.current-1)*F;j>0?j*=i:j<Q&&(j=Q+(j-Q)*i),_(j,!1)},L=M=>{const N=f.current;if(!N.active||(N.active=!1,!N.locked||!N.horizontal))return;const D=M.changedTouches[0].clientX-N.startX,P=Math.max(Date.now()-N.startTime,1),O=Math.abs(D/P),F=v(),$=Math.abs(D)/F;let j=p.current;(O>n||$>r)&&(j+=D<0?1:-1),k.current(j)};return I.addEventListener("touchstart",B,{passive:!0}),I.addEventListener("touchmove",R,{passive:!1}),I.addEventListener("touchend",L,{passive:!0}),()=>{I.removeEventListener("touchstart",B),I.removeEventListener("touchmove",R),I.removeEventListener("touchend",L)}},[n,r,i,o,v,_]),T.useEffect(()=>{_(-p.current*v(),!1);const I=()=>_(-p.current*v(),!1);return window.addEventListener("resize",I),()=>window.removeEventListener("resize",I)},[_,v]);const S=T.useRef(t);return T.useEffect(()=>{if(S.current===t)return;S.current=t;const I=Math.max(0,t-1),B=Math.min(p.current,I);p.current=B,g(B),_(-B*v(),!1)},[t,_,v]),T.useEffect(()=>{const I=y;return()=>{I.current++}},[]),{wrapperRef:u,trackRef:d,currentPage:m,goToPage:w,setPageImmediate:x}}const dKr=T.forwardRef(function({onPageChange:e},n){const r=uKr(),{wrapperRef:i,trackRef:o,currentPage:l,goToPage:u,setPageImmediate:d}=OPt({pageCount:r.pageCount,onSnap:r.onSnap});return r.goToPageRef.current=u,r.setPageImmediateRef.current=d,T.useImperativeHandle(n,()=>({goToPage:u,currentPage:l}),[u,l]),T.useEffect(()=>{e?.(l)},[l,e]),A.jsx("div",{ref:i,className:"h-full overflow-hidden",children:A.jsxs("div",{ref:o,className:"flex h-full will-change-transform",children:[A.jsxs("div",{className:"relative h-full shrink-0 w-full",children:[A.jsx(LPt,{onNavigateToChat:r.navigateToChat,scrollRef:r.agentScrollRef,containerRef:r.agentContainerRef,onSortModeChange:r.setAgentSortMode}),A.jsx(lKr,{visible:r.overlay,overlayRef:r.overlayRef,onDismiss:r.dismissOverlay,onNavigateToChat:r.navigateToChat})]}),r.hasChannel&&A.jsx("div",{className:"h-full shrink-0 w-full bg-white dark:bg-neutral-950",children:A.jsx(g3e,{onBack:()=>u(0)})}),r.hasCapsule&&A.jsx("div",{className:"h-full shrink-0 w-full bg-white dark:bg-neutral-950",children:A.jsx(JNe,{variant:"mobile",onBack:()=>u(1)})})]})})});function pKr({showAuthError:t=!1,onRetryAuth:e}){M3e();const{activePanel:n,setActivePanel:r}=Un(us(u=>({activePanel:u.activePanel,setActivePanel:u.setActivePanel}))),[i,o]=T.useState(0),l=n==="chat"&&i>0;return A.jsxs(A.Fragment,{children:[A.jsxs("div",{className:"flex flex-col h-dvh bg-white dark:bg-black select-none",children:[A.jsxs("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden bg-white dark:bg-neutral-950",children:[n==="chat"&&A.jsx(dKr,{onPageChange:o}),n==="knowledge"&&A.jsx(I3e,{}),n==="skills"&&A.jsx("div",{className:"h-full bg-white dark:bg-neutral-950",children:A.jsx(L3e,{})}),n==="memory"&&A.jsx("div",{className:"h-full bg-white dark:bg-neutral-950",children:A.jsx(T3e,{})}),n==="marketplace"&&A.jsx("div",{className:"h-full bg-white dark:bg-neutral-950",children:A.jsx(S3e,{})}),n==="sandbox"&&A.jsx("div",{className:"h-full bg-white dark:bg-neutral-950",children:A.jsx(D3e,{})}),n==="runner"&&A.jsx("div",{className:"h-full bg-white dark:bg-neutral-950",children:A.jsx(B3e,{})}),n==="tasks"&&A.jsx("div",{className:"h-full bg-white dark:bg-neutral-950",children:A.jsx(R3e,{})}),n==="account"&&A.jsx(ZVr,{}),t&&A.jsx("div",{className:"absolute inset-0 z-50 bg-background/80 backdrop-blur-sm flex items-center justify-center",children:A.jsx("div",{className:"w-full max-w-md px-4",children:A.jsx(OSe,{onRetry:e??(()=>{}),variant:"inline"})})})]}),!l&&A.jsx(RPt,{activePanel:n,onPanelChange:r,isMobile:!0})]}),A.jsx(F3e,{}),A.jsx(FLe,{})]})}const mKr=Object.freeze(Object.defineProperty({__proto__:null,MobileApp:pKr},Symbol.toStringTag,{value:"Module"}));function gKr({onGetStarted:t}){const{t:e}=Cn(),[n,r]=T.useState(!1);return T.useEffect(()=>{const i=()=>r(window.scrollY>40);return window.addEventListener("scroll",i,{passive:!0}),()=>window.removeEventListener("scroll",i)},[]),A.jsx(Et.nav,{initial:{opacity:0,y:-12},animate:{opacity:1,y:0},transition:{duration:.5,delay:.05},className:`fixed left-0 right-0 top-0 z-50 transition-all duration-300 ${n?"border-b border-neutral-100 bg-white/80 backdrop-blur-xl dark:border-neutral-800 dark:bg-neutral-950/80":"bg-transparent"}`,children:A.jsxs("div",{className:"flex items-center justify-between px-8 py-4 md:px-16",children:[A.jsxs("a",{href:"#",className:"flex items-center gap-2.5",children:[A.jsx("img",{src:"/light-icon.png",alt:"Xyzen",className:"h-7 w-7 dark:invert"}),A.jsx("span",{className:"text-[15px] font-bold tracking-wide text-neutral-900 dark:text-neutral-100",children:"Xyzen"})]}),A.jsxs("div",{className:"flex items-center gap-4",children:[A.jsxs("a",{href:"/docs",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 px-3 py-2 text-[13px] font-medium text-neutral-500 transition-colors hover:text-neutral-900 dark:hover:text-neutral-100",children:[A.jsx(e6n,{className:"h-4 w-4"}),e("landing.v2.nav.docs")]}),A.jsx(Et.button,{onClick:t,whileHover:{scale:1.03},whileTap:{scale:.97},className:"rounded-full bg-neutral-900 px-5 py-2 text-[13px] font-semibold text-white transition-all hover:bg-neutral-800 dark:bg-white dark:text-neutral-900 dark:hover:bg-neutral-200",children:e("landing.v2.nav.getStarted")})]})]})})}const hKr=[{text:"Autonomous",x:"8%",y:"20%",delay:0,duration:18},{text:"Memory",x:"82%",y:"15%",delay:2,duration:22},{text:"Skills",x:"15%",y:"75%",delay:4,duration:20},{text:"Sandbox",x:"78%",y:"70%",delay:1,duration:19},{text:"MCP",x:"55%",y:"85%",delay:3,duration:21},{text:"Knowledge",x:"90%",y:"45%",delay:5,duration:17},{text:"Teams",x:"5%",y:"50%",delay:2.5,duration:23},{text:"Economy",x:"70%",y:"30%",delay:1.5,duration:20}];function FPt({text:t,delay:e=0,className:n=""}){const r=T.useMemo(()=>t.split(/(\s+)/),[t]);return A.jsx("h1",{className:n,children:r.map((i,o)=>/^\s+$/.test(i)?A.jsx("span",{children:i},o):A.jsx("span",{className:"inline-block overflow-hidden",children:A.jsx(Et.span,{className:"inline-block",initial:{y:"110%"},animate:{y:"0%"},transition:{duration:.65,delay:e+o*.08,ease:[.22,1,.36,1]},children:i})},o))})}function fKr({delay:t}){return A.jsx(Et.svg,{viewBox:"0 0 400 12",className:"mx-auto mt-2 h-3 w-[clamp(200px,40vw,400px)]",preserveAspectRatio:"none",children:A.jsx(Et.path,{d:"M 0 8 Q 100 2, 200 8 Q 300 14, 400 6",fill:"none",stroke:"rgb(163 163 163)",strokeWidth:"2",strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:.5},transition:{pathLength:{duration:1.2,delay:t,ease:[.16,1,.3,1]},opacity:{duration:.4,delay:t}}})})}function AKr({onGetStarted:t}){const{t:e}=Cn(),n=T.useCallback(()=>{document.getElementById("features")?.scrollIntoView({behavior:"smooth"})},[]);return A.jsxs("section",{className:"relative flex min-h-[100dvh] flex-col items-center justify-center overflow-hidden",children:[A.jsx("div",{className:"pointer-events-none absolute inset-0 dark:hidden",style:{backgroundImage:"linear-gradient(to right, rgb(229 229 229 / 0.5) 1px, transparent 1px), linear-gradient(to bottom, rgb(229 229 229 / 0.5) 1px, transparent 1px)"}}),A.jsx("div",{className:"pointer-events-none absolute inset-0 hidden dark:block",style:{backgroundImage:"linear-gradient(to right, rgb(64 64 64 / 0.3) 1px, transparent 1px), linear-gradient(to bottom, rgb(64 64 64 / 0.3) 1px, transparent 1px)",backgroundSize:"64px 64px"}}),A.jsx("div",{className:"pointer-events-none absolute inset-0 bg-[radial-gradient(ellipse_60%_50%_at_50%_50%,white_40%,transparent_100%)] dark:bg-[radial-gradient(ellipse_60%_50%_at_50%_50%,rgb(10_10_10)_40%,transparent_100%)]"}),A.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-0 h-32 bg-gradient-to-b from-white to-transparent dark:from-neutral-950"}),A.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 h-32 bg-gradient-to-t from-white to-transparent dark:from-neutral-950"}),A.jsx("div",{className:"pointer-events-none absolute inset-0",children:hKr.map(({text:r,x:i,y:o,delay:l,duration:u},d)=>A.jsx(Et.span,{className:"absolute select-none font-mono text-[13px] font-medium text-neutral-300 dark:text-neutral-700",style:{left:i,top:o},initial:{opacity:0},animate:{opacity:[0,.6,.6,0],y:[0,-30,-60,-90]},transition:{duration:u,delay:l,repeat:1/0,ease:"linear"},children:r},d))}),A.jsxs("div",{className:"relative z-10 w-full px-8 text-center md:px-16",children:[A.jsx(Et.div,{initial:{scaleX:0},animate:{scaleX:1},transition:{duration:1,delay:.1,ease:[.16,1,.3,1]},className:"mx-auto mb-12 h-px w-24 origin-center bg-neutral-300 dark:bg-neutral-700"}),A.jsx(FPt,{text:e("landing.v2.hero.title1"),delay:.2,className:"mb-2 text-[clamp(2.5rem,7vw,5.5rem)] font-bold leading-[1.15] tracking-tight text-neutral-900 dark:text-neutral-100"}),A.jsx(FPt,{text:e("landing.v2.hero.title2"),delay:.5,className:"mb-2 text-[clamp(2.5rem,7vw,5.5rem)] font-bold leading-[1.15] tracking-tight text-neutral-900 dark:text-neutral-100"}),A.jsx(fKr,{delay:1.2}),A.jsx(Et.p,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{duration:.7,delay:1},className:"mx-auto mb-12 mt-8 max-w-2xl text-lg leading-relaxed text-neutral-500 md:text-xl",children:e("landing.v2.hero.subtitle")}),A.jsxs(Et.div,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{duration:.6,delay:1.3},className:"flex flex-wrap items-center justify-center gap-4",children:[A.jsxs(Et.button,{onClick:t,whileHover:{scale:1.03},whileTap:{scale:.97},className:"inline-flex items-center gap-2.5 rounded-full bg-neutral-900 px-8 py-4 text-[16px] font-semibold text-white shadow-[0_2px_20px_rgba(0,0,0,0.08)] transition-shadow hover:shadow-[0_4px_30px_rgba(0,0,0,0.15)] dark:bg-white dark:text-neutral-900 dark:shadow-[0_2px_20px_rgba(255,255,255,0.08)] dark:hover:shadow-[0_4px_30px_rgba(255,255,255,0.15)]",children:[e("landing.v2.hero.getStarted"),A.jsx(MP,{className:"h-4 w-4"})]}),A.jsxs(Et.button,{onClick:()=>document.getElementById("download")?.scrollIntoView({behavior:"smooth"}),whileHover:{scale:1.03},whileTap:{scale:.97},className:"inline-flex items-center gap-2 rounded-full border border-neutral-200 px-8 py-4 text-[16px] font-semibold text-neutral-700 transition-colors hover:border-neutral-400 hover:text-neutral-900 dark:border-neutral-700 dark:text-neutral-300 dark:hover:border-neutral-500 dark:hover:text-neutral-100",children:[A.jsx(v1,{className:"h-4 w-4"}),e("landing.v2.download.badge")]})]})]}),A.jsx(Et.button,{onClick:n,initial:{opacity:0},animate:{opacity:.4},transition:{delay:2.5,duration:1},className:"absolute bottom-8",children:A.jsx(Et.div,{animate:{y:[0,6,0]},transition:{duration:2.5,repeat:1/0,ease:"easeInOut"},children:A.jsx(df,{className:"h-6 w-6 text-neutral-400"})})})]})}function bKr({target:t,suffix:e=""}){const n=T.useRef(null),r=az(n,{once:!0});return A.jsx(Et.span,{ref:n,initial:{opacity:0},animate:r?{opacity:1}:{},transition:{duration:.5},className:"tabular-nums",children:r?A.jsxs(Et.span,{initial:{opacity:0},animate:{opacity:1},children:[t,e]}):"0"})}function QPt({icon:t,badge:e,title1:n,title2:r,subtitle:i,items:o,stats:l,reverse:u=!1}){const d=T.useRef(null),p=az(d,{once:!0,margin:"-80px"});return A.jsx("div",{ref:d,className:"relative",children:A.jsxs("div",{className:`flex flex-col gap-16 lg:flex-row lg:items-start lg:gap-0 ${u?"lg:flex-row-reverse":""}`,children:[A.jsxs(Et.div,{initial:{opacity:0,x:u?40:-40},animate:p?{opacity:1,x:0}:{},transition:{duration:.8,ease:[.16,1,.3,1]},className:"flex-1 px-8 md:px-16 lg:py-8",children:[A.jsxs("div",{className:"mb-5 flex items-center gap-2.5",children:[A.jsx(t,{className:"h-4 w-4 text-neutral-400"}),A.jsx("span",{className:"text-[11px] font-bold uppercase tracking-[4px] text-neutral-400",children:e})]}),A.jsx("h2",{className:"mb-1 text-[clamp(1.75rem,4vw,3rem)] font-bold leading-[1.1] tracking-tight text-neutral-900 dark:text-neutral-100",children:n}),A.jsx("h2",{className:"mb-6 text-[clamp(1.75rem,4vw,3rem)] font-bold leading-[1.1] tracking-tight text-neutral-900 dark:text-neutral-100",children:r}),A.jsx("p",{className:"mb-10 max-w-lg text-[16px] leading-relaxed text-neutral-500",children:i}),l&&A.jsx("div",{className:"mb-10 flex gap-10",children:l.map(({value:m,suffix:g,label:h},f)=>A.jsxs(Et.div,{initial:{opacity:0,y:16},animate:p?{opacity:1,y:0}:{},transition:{delay:.4+f*.1,duration:.6},children:[A.jsx("div",{className:"text-3xl font-bold text-neutral-900 dark:text-neutral-100",children:A.jsx(bKr,{target:m,suffix:g})}),A.jsx("div",{className:"mt-1 text-[13px] text-neutral-400",children:h})]},f))})]}),A.jsx(Et.div,{initial:{opacity:0,x:u?-40:40},animate:p?{opacity:1,x:0}:{},transition:{duration:.8,delay:.15,ease:[.16,1,.3,1]},className:"flex flex-1 flex-col gap-3 px-8 md:px-16 lg:py-8",children:o.map(({icon:m,label:g,desc:h},f)=>A.jsxs(Et.div,{initial:{opacity:0,y:20},animate:p?{opacity:1,y:0}:{},transition:{delay:.3+f*.1,duration:.6},whileHover:{x:4},className:"group flex gap-5 rounded-lg border border-transparent p-5 transition-colors hover:border-neutral-100 hover:bg-neutral-50 dark:hover:border-neutral-800 dark:hover:bg-neutral-900",children:[A.jsx("span",{className:"mt-0.5 text-2xl",children:m}),A.jsxs("div",{className:"flex-1",children:[A.jsxs("div",{className:"mb-1 flex items-center gap-2",children:[A.jsx("h3",{className:"text-[15px] font-semibold text-neutral-900 dark:text-neutral-100",children:g}),A.jsx(MP,{className:"h-3.5 w-3.5 text-neutral-300 transition-all group-hover:translate-x-0.5 group-hover:text-neutral-500"})]}),A.jsx("p",{className:"text-[14px] leading-relaxed text-neutral-500",children:h})]})]},f))})]})})}function yKr(){const{t}=Cn();return A.jsxs("div",{id:"features",className:"space-y-32 py-24 md:py-32",children:[A.jsx("div",{className:"mx-auto h-px w-full max-w-[90%] bg-gradient-to-r from-transparent via-neutral-200 to-transparent dark:via-neutral-800"}),A.jsx(QPt,{icon:u6n,badge:t("landing.v2.exploration.badge"),title1:t("landing.v2.exploration.title1"),title2:t("landing.v2.exploration.title2"),subtitle:t("landing.v2.exploration.subtitle"),stats:[{value:24,suffix:"/7",label:"Always On"},{value:50,suffix:"+",label:"MCP Integrations"}],items:[{icon:"🔮",label:t("landing.v2.capabilities.items.autonomous.title"),desc:t("landing.v2.capabilities.items.autonomous.desc")},{icon:"🤝",label:t("landing.v2.capabilities.items.team.title"),desc:t("landing.v2.capabilities.items.team.desc")},{icon:"🛠️",label:t("landing.v2.capabilities.items.sandbox.title"),desc:t("landing.v2.capabilities.items.sandbox.desc")}]}),A.jsx("div",{className:"mx-auto h-px w-full max-w-[90%] bg-gradient-to-r from-transparent via-neutral-200 to-transparent dark:via-neutral-800"}),A.jsx(QPt,{icon:l6n,badge:t("landing.v2.economy.badge"),title1:t("landing.v2.economy.title1"),title2:t("landing.v2.economy.title2"),subtitle:t("landing.v2.economy.subtitle"),reverse:!0,stats:[{value:12,suffix:"+",label:"Capabilities"},{value:10,suffix:"x",label:"Open Source Bonus"}],items:[{icon:"💰",label:t("landing.v2.capabilities.items.agentic_pay.title"),desc:t("landing.v2.capabilities.items.agentic_pay.desc")},{icon:"🎨",label:t("landing.v2.capabilities.items.creator_center.title"),desc:t("landing.v2.capabilities.items.creator_center.desc")},{icon:"🔗",label:t("landing.v2.capabilities.items.chain_revenue.title"),desc:t("landing.v2.capabilities.items.chain_revenue.desc")}]})]})}const vKr=[{key:"pc_connect",icon:"💻"},{key:"autonomous",icon:"🔮"},{key:"team",icon:"🤝"},{key:"sandbox",icon:"🛠️"},{key:"skills",icon:"⚡"},{key:"memory",icon:"🧠"},{key:"knowledge",icon:"📚"},{key:"multimodal",icon:"🖼️"},{key:"mcp",icon:"🔌"},{key:"scheduled_tasks",icon:"⏰"},{key:"agentic_pay",icon:"💰"},{key:"agent_graph",icon:"🕸️"}];function _Kr(){const{t}=Cn(),e=T.useRef(null),n=az(e,{once:!0,margin:"-60px"}),r=T.useMemo(()=>vKr.map(i=>({...i,title:t(`landing.v2.capabilities.items.${i.key}.title`),desc:t(`landing.v2.capabilities.items.${i.key}.desc`)})),[t]);return A.jsxs("section",{ref:e,className:"py-24 md:py-32",children:[A.jsx("div",{className:"mx-auto mb-20 h-px w-full max-w-[90%] bg-gradient-to-r from-transparent via-neutral-200 to-transparent dark:via-neutral-800"}),A.jsxs(Et.div,{initial:{opacity:0,y:24},animate:n?{opacity:1,y:0}:{},transition:{duration:.7},className:"mb-16 px-8 md:px-16",children:[A.jsx("span",{className:"mb-4 block text-[11px] font-bold uppercase tracking-[4px] text-neutral-400",children:t("landing.v2.capabilities.badge")}),A.jsx("h2",{className:"mb-4 text-[clamp(1.75rem,4vw,3rem)] font-bold leading-[1.1] tracking-tight text-neutral-900 dark:text-neutral-100",children:t("landing.v2.capabilities.title1")}),A.jsx("p",{className:"max-w-xl text-[16px] leading-relaxed text-neutral-500",children:t("landing.v2.capabilities.subtitle")})]}),A.jsx("div",{className:"px-8 md:px-16",children:A.jsx("div",{className:"grid gap-px overflow-hidden rounded-lg border border-neutral-100 bg-neutral-100 dark:border-neutral-800 dark:bg-neutral-800 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:r.map((i,o)=>A.jsxs(Et.div,{initial:{opacity:0,y:20},animate:n?{opacity:1,y:0}:{},transition:{delay:.1+o*.04,duration:.5,ease:[.16,1,.3,1]},className:"flex flex-col gap-3 bg-white p-6 transition-colors hover:bg-neutral-50 dark:bg-neutral-950 dark:hover:bg-neutral-900",children:[A.jsx(Et.span,{className:"text-3xl",whileHover:{scale:1.15,rotate:5},transition:{type:"spring",stiffness:400,damping:15},children:i.icon}),A.jsx("h3",{className:"text-[15px] font-semibold text-neutral-900 dark:text-neutral-100",children:i.title}),A.jsx("p",{className:"text-[13px] leading-relaxed text-neutral-500",children:i.desc})]},i.key))})})]})}function $Pt(t){return lR({attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M318.7 268.7c-.2-36.7 16.4-64.4 50-84.8-18.8-26.9-47.2-41.7-84.7-44.6-35.5-2.8-74.3 20.7-88.5 20.7-15 0-49.4-19.7-76.4-19.7C63.3 141.2 4 184.8 4 273.5q0 39.3 14.4 81.2c12.8 36.7 59 126.7 107.2 125.2 25.2-.6 43-17.9 75.8-17.9 31.8 0 48.3 17.9 76.4 17.9 48.6-.7 90.4-82.5 102.6-119.3-65.2-30.7-61.7-90-61.7-91.9zm-56.6-164.2c27.3-32.4 24.8-61.9 24-72.5-24.1 1.4-52 16.4-67.9 34.9-17.5 19.8-27.8 44.3-25.6 71.9 26.1 2 49.9-11.4 69.5-34.3z"},child:[]}]})(t)}function wKr(t){return lR({attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M420.55,301.93a24,24,0,1,1,24-24,24,24,0,0,1-24,24m-265.1,0a24,24,0,1,1,24-24,24,24,0,0,1-24,24m273.7-144.48,47.94-83a10,10,0,1,0-17.27-10h0l-48.54,84.07a301.25,301.25,0,0,0-246.56,0L116.18,64.45a10,10,0,1,0-17.27,10h0l47.94,83C64.53,202.22,8.24,285.55,0,384H576c-8.24-98.45-64.54-181.78-146.85-226.55"},child:[]}]})(t)}const zLe="https://storage.sciol.ac.cn/xyzen/releases",jPt=[{key:"darwin-arm64",label:"macOS Apple Silicon",binary:"xyzen-darwin-arm64"},{key:"darwin-amd64",label:"macOS Intel",binary:"xyzen-darwin-amd64"},{key:"linux-amd64",label:"Linux x86_64",binary:"xyzen-linux-amd64"},{key:"linux-arm64",label:"Linux ARM64",binary:"xyzen-linux-arm64"},{key:"windows-amd64",label:"Windows x86_64",binary:"xyzen-windows-amd64.exe"}],zPt=[{key:"macos",label:"macOS (Universal)",binary:"Xyzen-macos-universal.dmg"},{key:"windows",label:"Windows (x64)",binary:"Xyzen-windows-x64-setup.exe"},{key:"linux-deb",label:"Linux (.deb)",binary:"Xyzen-linux-amd64.deb"}];function UPt(t){const e=navigator.userAgent.toLowerCase(),n=navigator.platform?.toLowerCase()??"";return e.includes("mac")||n.includes("mac")?t[0]:e.includes("win")||n.includes("win")?t.find(r=>r.key.includes("win"))??t[t.length-1]:t.find(r=>r.key.includes("linux"))??t[0]}function xKr(){const{t}=Cn(),e=T.useMemo(()=>UPt(jPt),[]),n=T.useMemo(()=>UPt(zPt),[]),[r,i]=T.useState(e),[o,l]=T.useState(n),[u,d]=T.useState(!1),[p,m]=T.useState(!1);return A.jsxs("div",{children:[A.jsx("div",{className:"mx-auto mb-20 h-px w-full bg-gradient-to-r from-transparent via-neutral-200 to-transparent dark:via-neutral-800"}),A.jsxs("div",{className:"mb-16",children:[A.jsx("span",{className:"mb-4 block text-[11px] font-bold uppercase tracking-[4px] text-neutral-400",children:t("landing.v2.download.badge")}),A.jsx("h2",{className:"mb-4 text-[clamp(1.75rem,4vw,3rem)] font-bold leading-[1.1] tracking-tight text-neutral-900 dark:text-neutral-100",children:t("landing.v2.download.title")}),A.jsx("p",{className:"max-w-xl text-[16px] leading-relaxed text-neutral-500",children:t("landing.v2.download.subtitle")})]}),A.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:[A.jsxs(Et.a,{href:`${zLe}/android/latest/xyzen-latest.apk`,download:!0,whileHover:{y:-4},whileTap:{scale:.98},className:"group flex flex-col items-center gap-5 rounded-lg border border-neutral-100 bg-white px-6 py-10 transition-colors hover:border-neutral-200 hover:bg-neutral-50 dark:border-neutral-800 dark:bg-neutral-900 dark:hover:border-neutral-700 dark:hover:bg-neutral-800",children:[A.jsx("div",{className:"flex h-14 w-14 items-center justify-center rounded-lg bg-green-50 dark:bg-green-950/40",children:A.jsx(wKr,{className:"h-7 w-7 text-green-600 dark:text-green-400"})}),A.jsxs("div",{className:"text-center",children:[A.jsx("h3",{className:"text-[16px] font-semibold text-neutral-900 dark:text-neutral-100",children:"Android"}),A.jsx("p",{className:"mt-1 text-[13px] text-neutral-500",children:t("landing.v2.download.androidDesc")})]}),A.jsxs("span",{className:"inline-flex items-center gap-2 rounded-full bg-green-50 px-5 py-2.5 text-[14px] font-semibold text-green-700 transition-colors group-hover:bg-green-100 dark:bg-green-950/50 dark:text-green-400 dark:group-hover:bg-green-950/80",children:[A.jsx(v1,{className:"h-4 w-4"}),t("landing.v2.download.downloadApk")]})]}),A.jsxs(Et.a,{href:"https://testflight.apple.com/join/RNW6tavA",target:"_blank",rel:"noopener noreferrer",whileHover:{y:-4},whileTap:{scale:.98},className:"group flex flex-col items-center gap-5 rounded-lg border border-neutral-100 bg-white px-6 py-10 transition-colors hover:border-neutral-200 hover:bg-neutral-50 dark:border-neutral-800 dark:bg-neutral-900 dark:hover:border-neutral-700 dark:hover:bg-neutral-800",children:[A.jsx("div",{className:"flex h-14 w-14 items-center justify-center rounded-lg bg-neutral-100 dark:bg-neutral-800",children:A.jsx($Pt,{className:"h-7 w-7 text-neutral-900 dark:text-neutral-100"})}),A.jsxs("div",{className:"text-center",children:[A.jsx("h3",{className:"text-[16px] font-semibold text-neutral-900 dark:text-neutral-100",children:"iOS"}),A.jsx("p",{className:"mt-1 text-[13px] text-neutral-500",children:t("landing.v2.download.iosDesc")})]}),A.jsxs("span",{className:"inline-flex items-center gap-2 rounded-full bg-blue-50 px-5 py-2.5 text-[14px] font-semibold text-blue-700 transition-colors group-hover:bg-blue-100 dark:bg-blue-950/50 dark:text-blue-400 dark:group-hover:bg-blue-950/80",children:[A.jsx(v1,{className:"h-4 w-4"}),"TestFlight"]})]}),A.jsxs(Et.div,{whileHover:{y:-4},className:"relative flex flex-col items-center gap-5 rounded-lg border border-neutral-100 bg-white px-6 py-10 transition-colors hover:border-neutral-200 hover:bg-neutral-50 dark:border-neutral-800 dark:bg-neutral-900 dark:hover:border-neutral-700 dark:hover:bg-neutral-800",children:[A.jsx("div",{className:"flex h-14 w-14 items-center justify-center rounded-lg bg-violet-50 dark:bg-violet-950/40",children:A.jsx(w6n,{className:"h-7 w-7 text-violet-600 dark:text-violet-400"})}),A.jsxs("div",{className:"text-center",children:[A.jsx("h3",{className:"text-[16px] font-semibold text-neutral-900 dark:text-neutral-100",children:"Desktop"}),A.jsx("p",{className:"mt-1 text-[13px] text-neutral-500",children:t("landing.v2.download.desktopDesc")})]}),A.jsxs("div",{className:"relative w-full",children:[A.jsxs("button",{onClick:()=>m(g=>!g),className:"flex w-full items-center justify-center gap-2 rounded-full bg-violet-50 px-4 py-2.5 text-[13px] font-semibold text-violet-700 transition-colors hover:bg-violet-100 dark:bg-violet-950/50 dark:text-violet-400 dark:hover:bg-violet-950/80",children:[o.label,A.jsx(df,{className:`h-3.5 w-3.5 transition-transform ${p?"rotate-180":""}`})]}),A.jsx($r,{children:p&&A.jsx(Et.div,{initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},className:"absolute left-0 right-0 top-full z-10 mt-1 overflow-hidden rounded-lg border border-neutral-100 bg-white shadow-lg dark:border-neutral-700 dark:bg-neutral-800",children:zPt.map(g=>A.jsxs("button",{onClick:()=>{l(g),m(!1)},className:`flex w-full items-center gap-2.5 px-4 py-2.5 text-left text-[13px] transition-colors hover:bg-neutral-50 dark:hover:bg-neutral-700 ${g.key===o.key?"font-medium text-neutral-900 dark:text-neutral-100":"text-neutral-500 dark:text-neutral-400"}`,children:[g.key===o.key?A.jsx(th,{className:"h-3.5 w-3.5 shrink-0 text-neutral-900 dark:text-neutral-100"}):A.jsx("span",{className:"inline-block w-3.5 shrink-0"}),g.label]},g.key))})})]}),A.jsxs(Et.a,{href:`${zLe}/desktop/latest/${o.binary}`,download:!0,whileHover:{scale:1.02},whileTap:{scale:.98},className:"inline-flex items-center gap-2 rounded-full bg-violet-600 px-6 py-2.5 text-[14px] font-semibold text-white transition-all hover:bg-violet-500",children:[A.jsx(v1,{className:"h-4 w-4"}),t("landing.v2.download.downloadDesktop")]})]}),A.jsxs(Et.div,{whileHover:{y:-4},className:"relative flex flex-col items-center gap-5 rounded-lg border border-neutral-100 bg-white px-6 py-10 transition-colors hover:border-neutral-200 hover:bg-neutral-50 dark:border-neutral-800 dark:bg-neutral-900 dark:hover:border-neutral-700 dark:hover:bg-neutral-800",children:[A.jsx("div",{className:"flex h-14 w-14 items-center justify-center rounded-lg bg-neutral-100 dark:bg-neutral-800",children:A.jsx(M6n,{className:"h-7 w-7 text-neutral-700 dark:text-neutral-300"})}),A.jsxs("div",{className:"text-center",children:[A.jsx("h3",{className:"text-[16px] font-semibold text-neutral-900 dark:text-neutral-100",children:"Runner SDK"}),A.jsx("p",{className:"mt-1 text-[13px] text-neutral-500",children:t("landing.v2.download.runnerDesc")})]}),A.jsxs("div",{className:"relative w-full",children:[A.jsxs("button",{onClick:()=>d(g=>!g),className:"flex w-full items-center justify-center gap-2 rounded-full bg-neutral-100 px-4 py-2.5 text-[13px] font-semibold text-neutral-700 transition-colors hover:bg-neutral-200/80 dark:bg-neutral-800 dark:text-neutral-300 dark:hover:bg-neutral-700",children:[r.label,A.jsx(df,{className:`h-3.5 w-3.5 transition-transform ${u?"rotate-180":""}`})]}),A.jsx($r,{children:u&&A.jsx(Et.div,{initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},className:"absolute left-0 right-0 top-full z-10 mt-1 overflow-hidden rounded-lg border border-neutral-100 bg-white shadow-lg dark:border-neutral-700 dark:bg-neutral-800",children:jPt.map(g=>A.jsxs("button",{onClick:()=>{i(g),d(!1)},className:`flex w-full items-center gap-2.5 px-4 py-2.5 text-left text-[13px] transition-colors hover:bg-neutral-50 dark:hover:bg-neutral-700 ${g.key===r.key?"font-medium text-neutral-900 dark:text-neutral-100":"text-neutral-500 dark:text-neutral-400"}`,children:[g.key===r.key?A.jsx(th,{className:"h-3.5 w-3.5 shrink-0 text-neutral-900 dark:text-neutral-100"}):A.jsx("span",{className:"inline-block w-3.5 shrink-0"}),g.label]},g.key))})})]}),A.jsxs(Et.a,{href:`${zLe}/runner/latest/${r.binary}`,download:!0,whileHover:{scale:1.02},whileTap:{scale:.98},className:"inline-flex items-center gap-2 rounded-full bg-neutral-900 px-6 py-2.5 text-[14px] font-semibold text-white transition-all hover:bg-neutral-800",children:[A.jsx(v1,{className:"h-4 w-4"}),t("landing.v2.download.downloadSdk")]})]})]})]})}const kKr=[{key:"autonomous",icon:"🔮"},{key:"team",icon:"🤝"},{key:"pc_connect",icon:"💻"},{key:"sandbox",icon:"🛠️"},{key:"skills",icon:"⚡"},{key:"memory",icon:"🧠"},{key:"mcp",icon:"🔌"},{key:"agentic_pay",icon:"💰"}],EKr=4,lce={hidden:{},show:{transition:{staggerChildren:.08,delayChildren:.15}}},wg={hidden:{opacity:0,y:20},show:{opacity:1,y:0,transition:{duration:.5,ease:[.16,1,.3,1]}}},ULe={hidden:{opacity:0,scale:.9},show:{opacity:1,scale:1,transition:{duration:.4,ease:[.16,1,.3,1]}}};function CKr({total:t,current:e,onSelect:n}){return A.jsx("div",{className:"flex items-center gap-2",children:Array.from({length:t},(r,i)=>A.jsx("button",{onClick:()=>n(i),className:"h-1.5 rounded-full transition-all duration-300",style:{width:i===e?20:6,background:i===e?"currentColor":"rgb(163 163 163 / 0.4)"}},i))})}const SKr="https://testflight.apple.com/join/RNW6tavA",IKr="https://storage.sciol.ac.cn/xyzen/releases/android/latest/xyzen-latest.apk";function qPt({platform:t}){const{t:e}=Cn(),n=t==="ios";if(!T.useMemo(()=>{const d=navigator.userAgent;return n?/iPhone|iPad|iPod|Macintosh/i.test(d):/Android/i.test(d)},[n]))return null;const i=n?$Pt:N6n,o=n?SKr:IKr,l=e(n?"landing.v2.download.getOnAppStore":"landing.v2.download.downloadApk"),u=e(n?"landing.v2.download.iosDesc":"landing.v2.download.androidDesc");return A.jsxs(Et.a,{href:o,...!n&&{download:!0},whileTap:{scale:.97},className:"flex items-center gap-3 rounded-2xl bg-white/60 px-4 py-3 ring-1 ring-black/[0.04] backdrop-blur-xl supports-[backdrop-filter]:bg-white/40 active:bg-white/70 dark:bg-white/[0.08] dark:ring-white/[0.06] dark:backdrop-blur-xl dark:supports-[backdrop-filter]:bg-white/[0.05] dark:active:bg-white/[0.12]",children:[A.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-xl bg-neutral-900/90 dark:bg-white/90",children:A.jsx(i,{className:"h-[18px] w-[18px] text-white dark:text-neutral-900"})}),A.jsxs("div",{className:"min-w-0 flex-1",children:[A.jsx("p",{className:"text-[13px] font-semibold text-neutral-800 dark:text-neutral-100",children:l}),A.jsx("p",{className:"text-[11px] text-neutral-400 dark:text-neutral-500",children:u})]}),A.jsx(v1,{className:"h-3.5 w-3.5 shrink-0 text-neutral-300 dark:text-neutral-600"})]})}const WG=4;function TKr({onGetStarted:t}){const{t:e}=Cn(),n=/android/i.test(navigator.userAgent),{wrapperRef:r,trackRef:i,currentPage:o,goToPage:l}=OPt({pageCount:WG,bypassEdge:!0});return A.jsxs("div",{className:"fixed inset-0 z-0 overflow-hidden bg-white text-neutral-900 dark:bg-neutral-950 dark:text-neutral-100",children:[A.jsx("div",{ref:r,className:"h-full w-full",children:A.jsxs("div",{ref:i,className:"flex h-full",style:{width:`${WG*100}%`,willChange:"transform"},children:[A.jsxs("div",{className:"relative flex h-full w-full flex-col px-7 pt-[20vh]",children:[A.jsx("div",{className:"pointer-events-none absolute inset-0",style:{backgroundImage:"linear-gradient(to right, rgb(64 64 64 / 0.15) 1px, transparent 1px), linear-gradient(to bottom, rgb(64 64 64 / 0.15) 1px, transparent 1px)",backgroundSize:"48px 48px"}}),A.jsx("div",{className:"pointer-events-none absolute inset-0 bg-[radial-gradient(ellipse_80%_60%_at_30%_40%,white_30%,transparent_100%)] dark:bg-[radial-gradient(ellipse_80%_60%_at_30%_40%,rgb(10_10_10)_30%,transparent_100%)]"}),o===0&&[{text:"Autonomous",x:"65%",y:"28%",delay:0},{text:"Memory",x:"72%",y:"48%",delay:1.5},{text:"Skills",x:"58%",y:"62%",delay:3},{text:"MCP",x:"80%",y:"72%",delay:2},{text:"Economy",x:"62%",y:"82%",delay:4}].map(({text:u,x:d,y:p,delay:m},g)=>A.jsx(Et.span,{className:"pointer-events-none absolute select-none font-mono text-[11px] font-medium text-neutral-300 dark:text-neutral-700",style:{left:d,top:p},initial:{opacity:0},animate:{opacity:[0,.5,.5,0],y:[0,-20,-40,-60]},transition:{duration:12,delay:m,repeat:1/0,ease:"linear"},children:u},g)),A.jsxs(Et.div,{variants:lce,initial:"hidden",animate:o===0?"show":"hidden",className:"relative z-10",children:[A.jsxs(Et.div,{variants:wg,className:"mb-6",children:[A.jsx("img",{src:"/light-icon.png",alt:"Xyzen",className:"h-10 w-10 dark:hidden"}),A.jsx("img",{src:"/icon.png",alt:"Xyzen",className:"hidden h-10 w-10 dark:block"})]}),A.jsx(Et.h1,{variants:wg,className:"text-[38px] font-bold leading-[1.1] tracking-tight text-neutral-900 dark:text-neutral-100",children:e("landing.v2.hero.title1")}),A.jsx(Et.h1,{variants:wg,className:"mb-6 text-[38px] font-bold leading-[1.1] tracking-tight text-neutral-900 dark:text-neutral-100",children:e("landing.v2.hero.title2")}),A.jsx(Et.p,{variants:wg,className:"max-w-[300px] text-base leading-relaxed text-neutral-500",children:e("landing.v2.hero.subtitle")})]}),A.jsxs(Et.div,{initial:{opacity:0,y:12},animate:o===0?{opacity:1,y:0}:{opacity:0,y:12},transition:{duration:.5,delay:.6,ease:[.16,1,.3,1]},className:"absolute bottom-44 left-7 right-7 z-10 flex flex-col gap-2.5",children:[A.jsx(qPt,{platform:"ios"}),A.jsx(qPt,{platform:"android"})]}),A.jsx(Et.div,{initial:{opacity:0},animate:{opacity:.4},transition:{delay:2,duration:1},className:"absolute bottom-24 left-7",children:A.jsxs(Et.div,{animate:{x:[0,6,0]},transition:{duration:2,repeat:1/0,ease:"easeInOut"},className:"flex items-center gap-2 text-xs text-neutral-400",children:[A.jsx("span",{children:e("landing.v2.mobile.swipeHint")}),A.jsx(MP,{className:"h-3 w-3"})]})})]}),A.jsx("div",{className:"relative flex h-full w-full flex-col px-7 pt-[18vh]",children:A.jsxs(Et.div,{variants:lce,initial:"hidden",animate:o===1?"show":"hidden",children:[A.jsx(Et.p,{variants:wg,className:"mb-4 text-xs font-semibold uppercase tracking-[3px] text-neutral-400",children:e("landing.v2.exploration.badge")}),A.jsx(Et.h1,{variants:wg,className:"text-[34px] font-bold leading-[1.15] tracking-tight text-neutral-900 dark:text-neutral-100",children:e("landing.v2.exploration.title1")}),A.jsx(Et.h1,{variants:wg,className:"mb-6 text-[34px] font-bold leading-[1.15] tracking-tight text-neutral-900 dark:text-neutral-100",children:e("landing.v2.exploration.title2")}),A.jsx(Et.p,{variants:wg,className:"mb-10 max-w-[300px] text-base leading-relaxed text-neutral-500",children:e("landing.v2.exploration.subtitle")}),A.jsx(Et.div,{variants:wg,className:"space-y-4",children:[{icon:"🔍",label:e("landing.v2.exploration.ceoAgent")},{icon:"📋",label:e("landing.v2.exploration.autonomousExplore")},{icon:"✅",label:e("landing.v2.exploration.done")}].map(({icon:u,label:d},p)=>A.jsxs(Et.div,{initial:{opacity:0,x:-16},animate:o===1?{opacity:1,x:0}:{opacity:0,x:-16},transition:{delay:.5+p*.15,duration:.4},className:"flex items-center gap-3",children:[A.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-neutral-100 dark:bg-neutral-800",children:A.jsx("span",{className:"text-base",children:u})}),A.jsx("div",{className:"h-px flex-1 bg-neutral-100 dark:bg-neutral-800"}),A.jsx("span",{className:"text-sm font-medium text-neutral-500",children:d})]},p))})]})}),A.jsx("div",{className:"relative flex h-full w-full flex-col px-7 pt-[16vh]",children:A.jsxs(Et.div,{variants:lce,initial:"hidden",animate:o===2?"show":"hidden",className:"flex flex-1 flex-col",children:[A.jsx(Et.p,{variants:wg,className:"mb-4 text-xs font-semibold uppercase tracking-[3px] text-neutral-400",children:e("landing.v2.capabilities.badge")}),A.jsx(Et.h1,{variants:wg,className:"mb-2 text-[34px] font-bold leading-[1.15] tracking-tight text-neutral-900 dark:text-neutral-100",children:e("landing.v2.capabilities.title1")}),A.jsx(Et.p,{variants:wg,className:"mb-8 text-[15px] text-neutral-500",children:e("landing.v2.capabilities.subtitle")}),A.jsx(Et.div,{variants:wg,className:"-mx-1 pb-28",children:A.jsxs("div",{className:"grid grid-cols-2 gap-2 px-1",children:[kKr.map(({key:u,icon:d})=>A.jsxs(Et.div,{variants:ULe,className:"flex flex-col gap-2 rounded-lg border border-neutral-100 bg-white p-3.5 dark:border-neutral-800 dark:bg-neutral-900",children:[A.jsx("span",{className:"text-lg",children:d}),A.jsx("span",{className:"text-sm font-semibold leading-tight text-neutral-800 dark:text-neutral-200",children:e(`landing.v2.capabilities.items.${u}.title`)})]},u)),A.jsxs(Et.div,{variants:ULe,className:"col-span-2 flex flex-row items-center justify-center gap-2 rounded-lg border border-dashed border-neutral-200 py-3 dark:border-neutral-700",children:[A.jsxs("span",{className:"text-lg font-semibold text-neutral-400 dark:text-neutral-500",children:["+",EKr]}),A.jsx("span",{className:"text-xs text-neutral-400 dark:text-neutral-500",children:"more"})]})]})})]})}),A.jsx("div",{className:"relative flex h-full w-full flex-col items-center justify-center px-7",children:A.jsxs(Et.div,{variants:lce,initial:"hidden",animate:o===3?"show":"hidden",className:"text-center",children:[A.jsxs(Et.div,{variants:ULe,children:[A.jsx("img",{src:"/light-icon.png",alt:"Xyzen",className:"mx-auto mb-8 h-16 w-16 dark:hidden"}),A.jsx("img",{src:"/icon.png",alt:"Xyzen",className:"mx-auto mb-8 hidden h-16 w-16 dark:block"})]}),A.jsx(Et.h1,{variants:wg,className:"mb-4 text-[36px] font-bold leading-[1.1] tracking-tight text-neutral-900 dark:text-neutral-100",children:e("landing.cta.title")}),A.jsx(Et.p,{variants:wg,className:"mx-auto mb-10 max-w-[300px] text-base leading-relaxed text-neutral-500",children:e("landing.cta.subtitle")}),A.jsxs(Et.button,{variants:wg,onClick:t,whileTap:{scale:.96},className:"inline-flex items-center gap-2.5 rounded-full bg-neutral-900 px-8 py-4 text-[16px] font-semibold text-white transition-colors active:bg-neutral-800 dark:bg-white dark:text-neutral-900 dark:active:bg-neutral-200",children:[e("landing.v2.hero.getStarted"),A.jsx(MP,{className:"h-5 w-5"})]}),n&&A.jsxs(Et.a,{variants:wg,href:"https://storage.sciol.ac.cn/xyzen/releases/android/latest/xyzen-latest.apk",download:!0,whileTap:{scale:.96},className:"mt-4 flex items-center justify-center gap-2 text-[14px] font-medium text-neutral-400 transition-colors active:text-neutral-600 dark:text-neutral-500 dark:active:text-neutral-300",children:[A.jsx(v1,{className:"h-4 w-4"}),e("landing.v2.download.downloadApk")]})]})})]})}),A.jsx("div",{className:"fixed bottom-8 left-0 right-0 z-10 flex justify-center",children:A.jsx(CKr,{total:WG,current:o,onSelect:l})}),o<WG-1&&A.jsx("button",{onClick:()=>l(WG-1),className:"fixed right-6 top-14 z-10 text-[13px] font-semibold text-neutral-400 transition-colors active:text-neutral-600",children:e("landing.v2.mobile.skip")})]})}function BKr({children:t,className:e="",id:n}){const r=T.useRef(null),i=az(r,{once:!0,margin:"-60px"});return A.jsx("section",{id:n,ref:r,className:`relative ${e}`,children:A.jsx(Et.div,{initial:{opacity:0,y:32},animate:i?{opacity:1,y:0}:{},transition:{duration:.7,ease:[.16,1,.3,1]},children:t})})}function DKr({onGetStarted:t}){const{t:e}=Cn(),n=T.useRef(null),r=az(n,{once:!0,margin:"-60px"});return A.jsxs("section",{ref:n,className:"relative overflow-hidden bg-neutral-900 px-8 py-28 dark:bg-neutral-900 md:py-36",children:[A.jsx("div",{className:"pointer-events-none absolute -left-[10%] -top-[20%] h-[50vh] w-[50vh] rounded-full border border-neutral-800/50"}),A.jsx("div",{className:"pointer-events-none absolute -bottom-[15%] -right-[8%] h-[40vh] w-[40vh] rounded-full border border-neutral-800/50"}),A.jsxs(Et.div,{initial:{opacity:0,y:30},animate:r?{opacity:1,y:0}:{},transition:{duration:.8},className:"relative z-10 mx-auto max-w-3xl text-center",children:[A.jsx("h2",{className:"mb-5 text-[clamp(2rem,5vw,3.5rem)] font-bold leading-[1.1] tracking-tight text-white",children:e("landing.cta.title")}),A.jsx("p",{className:"mx-auto mb-12 max-w-lg text-[16px] leading-relaxed text-neutral-400",children:e("landing.cta.subtitle")}),A.jsxs(Et.button,{onClick:t,whileHover:{scale:1.03},whileTap:{scale:.97},className:"inline-flex items-center gap-2.5 rounded-full bg-white px-8 py-4 text-[16px] font-semibold text-neutral-900 shadow-[0_2px_20px_rgba(255,255,255,0.1)] transition-shadow hover:shadow-[0_4px_30px_rgba(255,255,255,0.2)]",children:[e("landing.cta.start"),A.jsx(MP,{className:"h-4 w-4"})]})]})]})}function NKr({onGetStarted:t}){const{t:e}=Cn();return Eq()?A.jsx(TKr,{onGetStarted:t}):A.jsxs("div",{className:"h-dvh overflow-y-auto bg-white text-neutral-900 dark:bg-neutral-950 dark:text-neutral-100",children:[A.jsx(gKr,{onGetStarted:t}),A.jsx(AKr,{onGetStarted:t}),A.jsx(yKr,{}),A.jsx(_Kr,{}),A.jsx(BKr,{id:"download",className:"px-8 py-24 md:px-16 md:py-32",children:A.jsx(xKr,{})}),A.jsx(DKr,{onGetStarted:t}),A.jsxs("footer",{className:"border-t border-neutral-100 px-8 py-12 dark:border-neutral-800 md:px-16",children:[A.jsxs("div",{className:"flex flex-col items-center gap-5 md:flex-row md:justify-between",children:[A.jsxs("div",{className:"flex items-center gap-2.5",children:[A.jsx("img",{src:"/light-icon.png",alt:"Xyzen",className:"h-5 w-5 opacity-50 dark:invert"}),A.jsx("span",{className:"text-xs font-medium tracking-wider text-neutral-400",children:"XYZEN"})]}),A.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-x-6 gap-y-2 text-[13px] text-neutral-400",children:[A.jsxs("a",{href:"#/terms",className:"inline-flex items-center gap-1 transition-colors hover:text-neutral-700 dark:hover:text-neutral-300",children:[A.jsx(I6n,{className:"h-3.5 w-3.5"}),e("landing.footer.terms")]}),A.jsxs("a",{href:"#/privacy",className:"inline-flex items-center gap-1 transition-colors hover:text-neutral-700 dark:hover:text-neutral-300",children:[A.jsx(vte,{className:"h-3.5 w-3.5"}),e("landing.footer.privacy")]})]}),A.jsx("p",{className:"text-xs text-neutral-400",children:e("landing.footer.copyright")})]}),g1()==="zh-cn"&&A.jsxs("div",{className:"mt-5 flex flex-col items-center gap-2",children:[A.jsx("p",{className:"text-xs text-neutral-400",children:"本服务由深势科技股份有限公司提供运营支持"}),A.jsx("a",{href:"https://beian.miit.gov.cn/",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-neutral-400 transition-colors hover:text-neutral-600",children:"京ICP备20010051号-21"})]})]})]})}const RKr=Object.freeze(Object.defineProperty({__proto__:null,LandingPageV3:NKr},Symbol.toStringTag,{value:"Module"}));function LKr({onAuthenticated:t,isVerifying:e=!1,authError:n=null}){const[r,i]=T.useState(""),[o,l]=T.useState(null),u=async p=>{if(p.preventDefault(),!r.trim()){l("Please enter admin secret key");return}l(null),t(r.trim())},d=n||o;return A.jsxs("div",{className:"w-full max-w-md bg-white dark:bg-neutral-900 rounded-lg shadow-xl p-6",children:[A.jsxs("div",{className:"mb-6",children:[A.jsx("h1",{className:"text-2xl font-bold text-neutral-900 dark:text-white",children:"Admin Access"}),A.jsx("p",{className:"text-sm text-neutral-500 dark:text-neutral-400 mt-2",children:"Enter admin secret key to manage redemption codes"})]}),A.jsxs("form",{onSubmit:u,className:"space-y-4",children:[A.jsx("div",{children:A.jsx(qc,{id:"admin-secret",type:"password",placeholder:"Admin Secret Key",value:r,onChange:p=>i(p.target.value),disabled:e})}),d&&A.jsx("div",{className:"rounded-md bg-red-50 dark:bg-red-950/30 p-3 text-sm text-red-600 dark:text-red-400",children:d}),A.jsx(Co,{type:"submit",className:"w-full",disabled:e,children:e?"Verifying...":"Access Admin Panel"})]})]})}class MKr{headers(e){return{"X-Admin-Secret":e}}async getOverview(e){return on.get("/xyzen/api/v1/admin/marketplace/overview",{auth:!1,headers:this.headers(e)})}async getListings(e,n={}){return on.get("/xyzen/api/v1/admin/marketplace/listings",{auth:!1,headers:this.headers(e),params:n})}async getListingDetail(e,n){return on.get(`/xyzen/api/v1/admin/marketplace/listings/${n}`,{auth:!1,headers:this.headers(e)})}async togglePublish(e,n){return on.post(`/xyzen/api/v1/admin/marketplace/listings/${n}/toggle-publish`,void 0,{auth:!1,headers:this.headers(e)})}async updateListingCuration(e,n,r){return on.patch(`/xyzen/api/v1/admin/marketplace/listings/${n}/curation`,r,{auth:!1,headers:this.headers(e)})}async deleteListing(e,n){return on.delete(`/xyzen/api/v1/admin/marketplace/listings/${n}`,void 0,{auth:!1,headers:this.headers(e)})}async getEarningsHeatmap(e,n,r,i){return on.get("/xyzen/api/v1/admin/marketplace/heatmap/earnings",{auth:!1,headers:this.headers(e),params:{year:n,tz:r,subscription_tier:i}})}async getTopAgents(e,n="earned",r=20){return on.get("/xyzen/api/v1/admin/marketplace/top-agents",{auth:!1,headers:this.headers(e),params:{sort_by:n,limit:r}})}async getTopDevelopers(e,n,r,i,o=20){return on.get("/xyzen/api/v1/admin/marketplace/top-developers",{auth:!1,headers:this.headers(e),params:{year:n,tz:r,date:i,limit:o}})}async getDeveloperAgents(e,n){return on.get(`/xyzen/api/v1/admin/marketplace/developers/${n}/agents`,{auth:!1,headers:this.headers(e)})}}const ST=new MKr,IT={ultra:"bg-amber-900/40 text-amber-300",pro:"bg-purple-900/40 text-purple-300",professional:"bg-purple-900/40 text-purple-300",standard:"bg-blue-900/40 text-blue-300",lite:"bg-neutral-800 text-neutral-300",free:"bg-neutral-800 text-neutral-300",unknown:"bg-neutral-800 text-neutral-500"},BC={free:"Lite",lite:"Lite",standard:"Standard",pro:"Pro",professional:"Pro",ultra:"Ultra",unknown:"Unknown"},GPt={free:"bg-neutral-100 dark:bg-neutral-800 text-neutral-700 dark:text-neutral-300",standard:"bg-blue-100 dark:bg-blue-900/30 text-blue-800 dark:text-blue-200",professional:"bg-purple-100 dark:bg-purple-900/30 text-purple-800 dark:text-purple-200",ultra:"bg-amber-100 dark:bg-amber-900/30 text-amber-800 dark:text-amber-200"};function sl(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:t.toLocaleString()}function qLe(t){return t?new Date(t).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):"—"}function HPt(t){return new Date(t).toLocaleString("en-US",{year:"numeric",month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit"})}function PKr(t){return t?new Date(t)<new Date:!1}function OKr(t){return t>=1073741824?`${(t/1073741824).toFixed(0)} GB`:t>=1048576?`${(t/1048576).toFixed(0)} MB`:`${(t/1024).toFixed(0)} KB`}const FKr=2026,QKr=2030,$Kr=[{value:"",label:"All Tiers"},{value:"ultra",label:"Ultra"},{value:"pro",label:"Pro"},{value:"standard",label:"Standard"},{value:"lite",label:"Lite"}];function YG({year:t,onYearChange:e,selectedTier:n="",onTierChange:r,selectedModel:i="",onModelChange:o,showTierFilter:l=!1,showModelFilter:u=!1,selectedProvider:d="",onProviderChange:p,providerOptions:m=[],modelOptions:g=[],showProviderFilter:h=!1,selectedTool:f="",onToolChange:b,toolOptions:y=[],showToolFilter:v=!1,tierOptions:_}){const w=T.useMemo(()=>{const k=new Map;for(const C of m){const E=k.get(C.label);E?E.push(C.value):k.set(C.label,[C.value])}return Array.from(k.entries()).map(([C,E])=>({value:E.join(","),label:C}))},[m]),x=_?[{value:"",label:"All Tiers"},..._.map(k=>({value:k,label:BC[k]??k}))]:$Kr;return A.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[A.jsxs("div",{className:"flex items-center gap-1",children:[A.jsx("button",{onClick:()=>e(t-1),disabled:t<=FKr,className:"p-1.5 rounded hover:bg-neutral-800 disabled:opacity-30 text-neutral-400",children:A.jsx(xx,{className:"h-4 w-4"})}),A.jsx("span",{className:"min-w-12 text-center text-sm font-semibold text-neutral-300",children:t}),A.jsx("button",{onClick:()=>e(t+1),disabled:t>=QKr,className:"p-1.5 rounded hover:bg-neutral-800 disabled:opacity-30 text-neutral-400",children:A.jsx(hg,{className:"h-4 w-4"})})]}),l&&r&&A.jsx("select",{value:n,onChange:k=>r(k.target.value),className:"rounded-md border border-neutral-700 bg-neutral-800 px-3 py-1.5 text-sm text-white focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500",children:x.map(k=>A.jsx("option",{value:k.value,children:k.label},k.value))}),h&&p&&A.jsxs("select",{value:d,onChange:k=>p(k.target.value),className:"rounded-md border border-neutral-700 bg-neutral-800 px-3 py-1.5 text-sm text-white focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500",children:[A.jsx("option",{value:"",children:"All Providers"}),w.map(k=>A.jsx("option",{value:k.value,children:k.label},k.value))]}),u&&o&&(g.length>0?A.jsxs("select",{value:i,onChange:k=>o(k.target.value),className:"rounded-md border border-neutral-700 bg-neutral-800 px-3 py-1.5 text-sm text-white focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500",children:[A.jsx("option",{value:"",children:"All Models"}),g.map(k=>A.jsx("option",{value:k,children:k},k))]}):A.jsx("input",{type:"text",placeholder:"Filter model...",value:i,onChange:k=>o(k.target.value),className:"rounded-md border border-neutral-700 bg-neutral-800 px-3 py-1.5 text-sm text-white placeholder-neutral-500 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 w-40"})),v&&b&&A.jsxs("select",{value:f,onChange:k=>b(k.target.value),className:"rounded-md border border-neutral-700 bg-neutral-800 px-3 py-1.5 text-sm text-white focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500",children:[A.jsx("option",{value:"",children:"All Tools"}),y.map(k=>A.jsx("option",{value:k,children:k},k))]})]})}var GLe=function(t,e){return GLe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])},GLe(t,e)};function Ml(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");GLe(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}var jKr=(function(){function t(){this.firefox=!1,this.ie=!1,this.edge=!1,this.newEdge=!1,this.weChat=!1}return t})(),zKr=(function(){function t(){this.browser=new jKr,this.node=!1,this.wxa=!1,this.worker=!1,this.svgSupported=!1,this.touchEventsSupported=!1,this.pointerEventsSupported=!1,this.domSupported=!1,this.transformSupported=!1,this.transform3dSupported=!1,this.hasGlobalWindow=typeof window<"u"}return t})(),go=new zKr;typeof wx=="object"&&typeof wx.getSystemInfoSync=="function"?(go.wxa=!0,go.touchEventsSupported=!0):typeof document>"u"&&typeof self<"u"?go.worker=!0:!go.hasGlobalWindow||"Deno"in window||typeof navigator<"u"&&typeof navigator.userAgent=="string"&&navigator.userAgent.indexOf("Node.js")>-1?(go.node=!0,go.svgSupported=!0):UKr(navigator.userAgent,go);function UKr(t,e){var n=e.browser,r=t.match(/Firefox\/([\d.]+)/),i=t.match(/MSIE\s([\d.]+)/)||t.match(/Trident\/.+?rv:(([\d.]+))/),o=t.match(/Edge?\/([\d.]+)/),l=/micromessenger/i.test(t);r&&(n.firefox=!0,n.version=r[1]),i&&(n.ie=!0,n.version=i[1]),o&&(n.edge=!0,n.version=o[1],n.newEdge=+o[1].split(".")[0]>18),l&&(n.weChat=!0),e.svgSupported=typeof SVGRect<"u",e.touchEventsSupported="ontouchstart"in window&&!n.ie&&!n.edge,e.pointerEventsSupported="onpointerdown"in window&&(n.edge||n.ie&&+n.version>=11);var u=e.domSupported=typeof document<"u";if(u){var d=document.documentElement.style;e.transform3dSupported=(n.ie&&"transition"in d||n.edge||"WebKitCSSMatrix"in window&&"m11"in new WebKitCSSMatrix||"MozPerspective"in d)&&!("OTransition"in d),e.transformSupported=e.transform3dSupported||n.ie&&+n.version>=9}}var HLe=12,WPt="sans-serif",DC=HLe+"px "+WPt,qKr=20,GKr=100,HKr="007LLmW'55;N0500LLLLLLLLLL00NNNLzWW\\\\WQb\\0FWLg\\bWb\\WQ\\WrWWQ000CL5LLFLL0LL**F*gLLLL5F0LF\\FFF5.5N";function WKr(t){var e={};if(typeof JSON>"u")return e;for(var n=0;n<t.length;n++){var r=String.fromCharCode(n+32),i=(t.charCodeAt(n)-qKr)/GKr;e[r]=i}return e}var YKr=WKr(HKr),GA={createCanvas:function(){return typeof document<"u"&&document.createElement("canvas")},measureText:(function(){var t,e;return function(n,r){if(!t){var i=GA.createCanvas();t=i&&i.getContext("2d")}if(t)return e!==r&&(e=t.font=r||DC),t.measureText(n);n=n||"",r=r||DC;var o=/((?:\d+)?\.?\d*)px/.exec(r),l=o&&+o[1]||HLe,u=0;if(r.indexOf("mono")>=0)u=l*n.length;else for(var d=0;d<n.length;d++){var p=YKr[n[d]];u+=p==null?l:p*l}return{width:u}}})(),loadImage:function(t,e,n){var r=new Image;return r.onload=e,r.onerror=n,r.src=t,r}};function YPt(t){for(var e in GA)t[e]&&(GA[e]=t[e])}var VPt=mk(["Function","RegExp","Date","Error","CanvasGradient","CanvasPattern","Image","Canvas"],function(t,e){return t["[object "+e+"]"]=!0,t},{}),KPt=mk(["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64"],function(t,e){return t["[object "+e+"Array]"]=!0,t},{}),_F=Object.prototype.toString,cce=Array.prototype,VKr=cce.forEach,KKr=cce.filter,WLe=cce.slice,ZKr=cce.map,ZPt=(function(){}).constructor,uce=ZPt?ZPt.prototype:null,YLe="__proto__",XKr=2311;function VLe(){return XKr++}function D_(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];typeof console<"u"&&console.error.apply(console,t)}function ro(t){if(t==null||typeof t!="object")return t;var e=t,n=_F.call(t);if(n==="[object Array]"){if(!wF(t)){e=[];for(var r=0,i=t.length;r<i;r++)e[r]=ro(t[r])}}else if(KPt[n]){if(!wF(t)){var o=t.constructor;if(o.from)e=o.from(t);else{e=new o(t.length);for(var r=0,i=t.length;r<i;r++)e[r]=t[r]}}}else if(!VPt[n]&&!wF(t)&&!p3(t)){e={};for(var l in t)t.hasOwnProperty(l)&&l!==YLe&&(e[l]=ro(t[l]))}return e}function _c(t,e,n){if(!ai(e)||!ai(t))return n?ro(e):t;for(var r in e)if(e.hasOwnProperty(r)&&r!==YLe){var i=t[r],o=e[r];ai(o)&&ai(i)&&!fa(o)&&!fa(i)&&!p3(o)&&!p3(i)&&!ZLe(o)&&!ZLe(i)&&!wF(o)&&!wF(i)?_c(i,o,n):(n||!(r in t))&&(t[r]=ro(e[r]))}return t}function JKr(t,e){for(var n=t[0],r=1,i=t.length;r<i;r++)n=_c(n,t[r],e);return n}function ta(t,e){if(Object.assign)Object.assign(t,e);else for(var n in e)e.hasOwnProperty(n)&&n!==YLe&&(t[n]=e[n]);return t}function Yc(t,e,n){for(var r=Xs(e),i=0,o=r.length;i<o;i++){var l=r[i];(n?e[l]!=null:t[l]==null)&&(t[l]=e[l])}return t}var eZr=GA.createCanvas;function ic(t,e){if(t){if(t.indexOf)return t.indexOf(e);for(var n=0,r=t.length;n<r;n++)if(t[n]===e)return n}return-1}function KLe(t,e){var n=t.prototype;function r(){}r.prototype=e.prototype,t.prototype=new r;for(var i in n)n.hasOwnProperty(i)&&(t.prototype[i]=n[i]);t.prototype.constructor=t,t.superClass=e}function N_(t,e,n){if(t="prototype"in t?t.prototype:t,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames)for(var r=Object.getOwnPropertyNames(e),i=0;i<r.length;i++){var o=r[i];o!=="constructor"&&(n?e[o]!=null:t[o]==null)&&(t[o]=e[o])}else Yc(t,e,n)}function Pf(t){return!t||typeof t=="string"?!1:typeof t.length=="number"}function fn(t,e,n){if(t&&e)if(t.forEach&&t.forEach===VKr)t.forEach(e,n);else if(t.length===+t.length)for(var r=0,i=t.length;r<i;r++)e.call(n,t[r],r,t);else for(var o in t)t.hasOwnProperty(o)&&e.call(n,t[o],o,t)}function Ga(t,e,n){if(!t)return[];if(!e)return dce(t);if(t.map&&t.map===ZKr)return t.map(e,n);for(var r=[],i=0,o=t.length;i<o;i++)r.push(e.call(n,t[i],i,t));return r}function mk(t,e,n,r){if(t&&e){for(var i=0,o=t.length;i<o;i++)n=e.call(r,n,t[i],i,t);return n}}function fp(t,e,n){if(!t)return[];if(!e)return dce(t);if(t.filter&&t.filter===KKr)return t.filter(e,n);for(var r=[],i=0,o=t.length;i<o;i++)e.call(n,t[i],i,t)&&r.push(t[i]);return r}function tZr(t,e,n){if(t&&e){for(var r=0,i=t.length;r<i;r++)if(e.call(n,t[r],r,t))return t[r]}}function Xs(t){if(!t)return[];if(Object.keys)return Object.keys(t);var e=[];for(var n in t)t.hasOwnProperty(n)&&e.push(n);return e}function nZr(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return function(){return t.apply(e,n.concat(WLe.call(arguments)))}}var Fs=uce&&lo(uce.bind)?uce.call.bind(uce.bind):nZr;function Th(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return function(){return t.apply(this,e.concat(WLe.call(arguments)))}}function fa(t){return Array.isArray?Array.isArray(t):_F.call(t)==="[object Array]"}function lo(t){return typeof t=="function"}function Wa(t){return typeof t=="string"}function VG(t){return _F.call(t)==="[object String]"}function Rc(t){return typeof t=="number"}function ai(t){var e=typeof t;return e==="function"||!!t&&e==="object"}function ZLe(t){return!!VPt[_F.call(t)]}function Bh(t){return!!KPt[_F.call(t)]}function p3(t){return typeof t=="object"&&typeof t.nodeType=="number"&&typeof t.ownerDocument=="object"}function KG(t){return t.colorStops!=null}function XPt(t){return t.image!=null}function JPt(t){return _F.call(t)==="[object RegExp]"}function NC(t){return t!==t}function TT(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var n=0,r=t.length;n<r;n++)if(t[n]!=null)return t[n]}function ki(t,e){return t??e}function BT(t,e,n){return t??e??n}function dce(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return WLe.apply(t,e)}function pce(t){if(typeof t=="number")return[t,t,t,t];var e=t.length;return e===2?[t[0],t[1],t[0],t[1]]:e===3?[t[0],t[1],t[2],t[1]]:t}function Di(t,e){if(!t)throw new Error(e)}function R_(t){return t==null?null:typeof t.trim=="function"?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}var e5t="__ec_primitive__";function mce(t){t[e5t]=!0}function wF(t){return t[e5t]}var rZr=(function(){function t(){this.data={}}return t.prototype.delete=function(e){var n=this.has(e);return n&&delete this.data[e],n},t.prototype.has=function(e){return this.data.hasOwnProperty(e)},t.prototype.get=function(e){return this.data[e]},t.prototype.set=function(e,n){return this.data[e]=n,this},t.prototype.keys=function(){return Xs(this.data)},t.prototype.forEach=function(e){var n=this.data;for(var r in n)n.hasOwnProperty(r)&&e(n[r],r)},t})(),t5t=typeof Map=="function";function aZr(){return t5t?new Map:new rZr}var n5t=(function(){function t(e){var n=fa(e);this.data=aZr();var r=this;e instanceof t?e.each(i):e&&fn(e,i);function i(o,l){n?r.set(o,l):r.set(l,o)}}return t.prototype.hasKey=function(e){return this.data.has(e)},t.prototype.get=function(e){return this.data.get(e)},t.prototype.set=function(e,n){return this.data.set(e,n),n},t.prototype.each=function(e,n){this.data.forEach(function(r,i){e.call(n,r,i)})},t.prototype.keys=function(){var e=this.data.keys();return t5t?Array.from(e):e},t.prototype.removeKey=function(e){this.data.delete(e)},t})();function ss(t){return new n5t(t)}function r5t(t,e){for(var n=new t.constructor(t.length+e.length),r=0;r<t.length;r++)n[r]=t[r];for(var i=t.length,r=0;r<e.length;r++)n[r+i]=e[r];return n}function ZG(t,e){var n;if(Object.create)n=Object.create(t);else{var r=function(){};r.prototype=t,n=new r}return e&&ta(n,e),n}function XLe(t){var e=t.style;e.webkitUserSelect="none",e.userSelect="none",e.webkitTapHighlightColor="rgba(0,0,0,0)",e["-webkit-touch-callout"]="none"}function L_(t,e){return t.hasOwnProperty(e)}function xg(){}var XG=180/Math.PI,iZr=Number.EPSILON||Math.pow(2,-52);const oZr=Object.freeze(Object.defineProperty({__proto__:null,EPSILON:iZr,HashMap:n5t,RADIAN_TO_DEGREE:XG,assert:Di,bind:Fs,clone:ro,concatArray:r5t,createCanvas:eZr,createHashMap:ss,createObject:ZG,curry:Th,defaults:Yc,disableUserSelect:XLe,each:fn,eqNaN:NC,extend:ta,filter:fp,find:tZr,guid:VLe,hasOwn:L_,indexOf:ic,inherits:KLe,isArray:fa,isArrayLike:Pf,isBuiltInObject:ZLe,isDom:p3,isFunction:lo,isGradientObject:KG,isImagePatternObject:XPt,isNumber:Rc,isObject:ai,isPrimitive:wF,isRegExp:JPt,isString:Wa,isStringSafe:VG,isTypedArray:Bh,keys:Xs,logError:D_,map:Ga,merge:_c,mergeAll:JKr,mixin:N_,noop:xg,normalizeCssArray:pce,reduce:mk,retrieve:TT,retrieve2:ki,retrieve3:BT,setAsPrimitive:mce,slice:dce,trim:R_},Symbol.toStringTag,{value:"Module"}));var JLe=function(t,e){return JLe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])},JLe(t,e)};function oc(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");JLe(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}function m3(t,e){return t==null&&(t=0),e==null&&(e=0),[t,e]}function sZr(t,e){return t[0]=e[0],t[1]=e[1],t}function a5t(t){return[t[0],t[1]]}function lZr(t,e,n){return t[0]=e,t[1]=n,t}function e4e(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t}function cZr(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t}function i5t(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t}function t4e(t){return Math.sqrt(n4e(t))}var uZr=t4e;function n4e(t){return t[0]*t[0]+t[1]*t[1]}var dZr=n4e;function pZr(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t}function mZr(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t}function gZr(t,e){return t[0]*e[0]+t[1]*e[1]}function gce(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t}function o5t(t,e){var n=t4e(e);return n===0?(t[0]=0,t[1]=0):(t[0]=e[0]/n,t[1]=e[1]/n),t}function hce(t,e){return Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1]))}var fce=hce;function s5t(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}var g3=s5t;function hZr(t,e){return t[0]=-e[0],t[1]=-e[1],t}function Ace(t,e,n,r){return t[0]=e[0]+r*(n[0]-e[0]),t[1]=e[1]+r*(n[1]-e[1]),t}function c0(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[2]*i+n[4],t[1]=n[1]*r+n[3]*i+n[5],t}function DT(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t}function NT(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t}const fZr=Object.freeze(Object.defineProperty({__proto__:null,add:e4e,applyTransform:c0,clone:a5t,copy:sZr,create:m3,dist:fce,distSquare:g3,distance:hce,distanceSquare:s5t,div:mZr,dot:gZr,len:t4e,lenSquare:n4e,length:uZr,lengthSquare:dZr,lerp:Ace,max:NT,min:DT,mul:pZr,negate:hZr,normalize:o5t,scale:gce,scaleAndAdd:cZr,set:lZr,sub:i5t},Symbol.toStringTag,{value:"Module"}));var xF=(function(){function t(e,n){this.target=e,this.topTarget=n&&n.topTarget}return t})(),AZr=(function(){function t(e){this.handler=e,e.on("mousedown",this._dragStart,this),e.on("mousemove",this._drag,this),e.on("mouseup",this._dragEnd,this)}return t.prototype._dragStart=function(e){for(var n=e.target;n&&!n.draggable;)n=n.parent||n.__hostTarget;n&&(this._draggingTarget=n,n.dragging=!0,this._x=e.offsetX,this._y=e.offsetY,this.handler.dispatchToElement(new xF(n,e),"dragstart",e.event))},t.prototype._drag=function(e){var n=this._draggingTarget;if(n){var r=e.offsetX,i=e.offsetY,o=r-this._x,l=i-this._y;this._x=r,this._y=i,n.drift(o,l,e),this.handler.dispatchToElement(new xF(n,e),"drag",e.event);var u=this.handler.findHover(r,i,n).target,d=this._dropTarget;this._dropTarget=u,n!==u&&(d&&u!==d&&this.handler.dispatchToElement(new xF(d,e),"dragleave",e.event),u&&u!==d&&this.handler.dispatchToElement(new xF(u,e),"dragenter",e.event))}},t.prototype._dragEnd=function(e){var n=this._draggingTarget;n&&(n.dragging=!1),this.handler.dispatchToElement(new xF(n,e),"dragend",e.event),this._dropTarget&&this.handler.dispatchToElement(new xF(this._dropTarget,e),"drop",e.event),this._draggingTarget=null,this._dropTarget=null},t})(),gk=(function(){function t(e){e&&(this._$eventProcessor=e)}return t.prototype.on=function(e,n,r,i){this._$handlers||(this._$handlers={});var o=this._$handlers;if(typeof n=="function"&&(i=r,r=n,n=null),!r||!e)return this;var l=this._$eventProcessor;n!=null&&l&&l.normalizeQuery&&(n=l.normalizeQuery(n)),o[e]||(o[e]=[]);for(var u=0;u<o[e].length;u++)if(o[e][u].h===r)return this;var d={h:r,query:n,ctx:i||this,callAtLast:r.zrEventfulCallAtLast},p=o[e].length-1,m=o[e][p];return m&&m.callAtLast?o[e].splice(p,0,d):o[e].push(d),this},t.prototype.isSilent=function(e){var n=this._$handlers;return!n||!n[e]||!n[e].length},t.prototype.off=function(e,n){var r=this._$handlers;if(!r)return this;if(!e)return this._$handlers={},this;if(n){if(r[e]){for(var i=[],o=0,l=r[e].length;o<l;o++)r[e][o].h!==n&&i.push(r[e][o]);r[e]=i}r[e]&&r[e].length===0&&delete r[e]}else delete r[e];return this},t.prototype.trigger=function(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];if(!this._$handlers)return this;var i=this._$handlers[e],o=this._$eventProcessor;if(i)for(var l=n.length,u=i.length,d=0;d<u;d++){var p=i[d];if(!(o&&o.filter&&p.query!=null&&!o.filter(e,p.query)))switch(l){case 0:p.h.call(p.ctx);break;case 1:p.h.call(p.ctx,n[0]);break;case 2:p.h.call(p.ctx,n[0],n[1]);break;default:p.h.apply(p.ctx,n);break}}return o&&o.afterTrigger&&o.afterTrigger(e),this},t.prototype.triggerWithContext=function(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];if(!this._$handlers)return this;var i=this._$handlers[e],o=this._$eventProcessor;if(i)for(var l=n.length,u=n[l-1],d=i.length,p=0;p<d;p++){var m=i[p];if(!(o&&o.filter&&m.query!=null&&!o.filter(e,m.query)))switch(l){case 0:m.h.call(u);break;case 1:m.h.call(u,n[0]);break;case 2:m.h.call(u,n[0],n[1]);break;default:m.h.apply(u,n.slice(1,l-1));break}}return o&&o.afterTrigger&&o.afterTrigger(e),this},t})(),bZr=Math.log(2);function r4e(t,e,n,r,i,o){var l=r+"-"+i,u=t.length;if(o.hasOwnProperty(l))return o[l];if(e===1){var d=Math.round(Math.log((1<<u)-1&~i)/bZr);return t[n][d]}for(var p=r|1<<n,m=n+1;r&1<<m;)m++;for(var g=0,h=0,f=0;h<u;h++){var b=1<<h;b&i||(g+=(f%2?-1:1)*t[n][h]*r4e(t,e-1,m,p,i|b,o),f++)}return o[l]=g,g}function l5t(t,e){var n=[[t[0],t[1],1,0,0,0,-e[0]*t[0],-e[0]*t[1]],[0,0,0,t[0],t[1],1,-e[1]*t[0],-e[1]*t[1]],[t[2],t[3],1,0,0,0,-e[2]*t[2],-e[2]*t[3]],[0,0,0,t[2],t[3],1,-e[3]*t[2],-e[3]*t[3]],[t[4],t[5],1,0,0,0,-e[4]*t[4],-e[4]*t[5]],[0,0,0,t[4],t[5],1,-e[5]*t[4],-e[5]*t[5]],[t[6],t[7],1,0,0,0,-e[6]*t[6],-e[6]*t[7]],[0,0,0,t[6],t[7],1,-e[7]*t[6],-e[7]*t[7]]],r={},i=r4e(n,8,0,0,0,r);if(i!==0){for(var o=[],l=0;l<8;l++)for(var u=0;u<8;u++)o[u]==null&&(o[u]=0),o[u]+=((l+u)%2?-1:1)*r4e(n,7,l===0?1:0,1<<l,1<<u,r)/i*e[l];return function(d,p,m){var g=p*o[6]+m*o[7]+1;d[0]=(p*o[0]+m*o[1]+o[2])/g,d[1]=(p*o[3]+m*o[4]+o[5])/g}}}var bce="___zrEVENTSAVED",a4e=[];function yZr(t,e,n,r,i){return i4e(a4e,e,r,i,!0)&&i4e(t,n,a4e[0],a4e[1])}function vZr(t,e){t&&n(t),e&&n(e);function n(r){var i=r[bce];i&&(i.clearMarkers&&i.clearMarkers(),delete r[bce])}}function i4e(t,e,n,r,i){if(e.getBoundingClientRect&&go.domSupported&&!c5t(e)){var o=e[bce]||(e[bce]={}),l=_Zr(e,o),u=wZr(l,o,i);if(u)return u(t,n,r),!0}return!1}function _Zr(t,e){var n=e.markers;if(n)return n;n=e.markers=[];for(var r=["left","right"],i=["top","bottom"],o=0;o<4;o++){var l=document.createElement("div"),u=l.style,d=o%2,p=(o>>1)%2;u.cssText=["position: absolute","visibility: hidden","padding: 0","margin: 0","border-width: 0","user-select: none","width:0","height:0",r[d]+":0",i[p]+":0",r[1-d]+":auto",i[1-p]+":auto",""].join("!important;"),t.appendChild(l),n.push(l)}return e.clearMarkers=function(){fn(n,function(m){m.parentNode&&m.parentNode.removeChild(m)})},n}function wZr(t,e,n){for(var r=n?"invTrans":"trans",i=e[r],o=e.srcCoords,l=[],u=[],d=!0,p=0;p<4;p++){var m=t[p].getBoundingClientRect(),g=2*p,h=m.left,f=m.top;l.push(h,f),d=d&&o&&h===o[g]&&f===o[g+1],u.push(t[p].offsetLeft,t[p].offsetTop)}return d&&i?i:(e.srcCoords=l,e[r]=n?l5t(u,l):l5t(l,u))}function c5t(t){return t.nodeName.toUpperCase()==="CANVAS"}var xZr=/([&<>"'])/g,kZr={"&":"&","<":"<",">":">",'"':""","'":"'"};function Dh(t){return t==null?"":(t+"").replace(xZr,function(e,n){return kZr[n]})}var EZr=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,o4e=[],CZr=go.browser.firefox&&+go.browser.version.split(".")[0]<39;function s4e(t,e,n,r){return n=n||{},r?u5t(t,e,n):CZr&&e.layerX!=null&&e.layerX!==e.offsetX?(n.zrX=e.layerX,n.zrY=e.layerY):e.offsetX!=null?(n.zrX=e.offsetX,n.zrY=e.offsetY):u5t(t,e,n),n}function u5t(t,e,n){if(go.domSupported&&t.getBoundingClientRect){var r=e.clientX,i=e.clientY;if(c5t(t)){var o=t.getBoundingClientRect();n.zrX=r-o.left,n.zrY=i-o.top;return}else if(i4e(o4e,t,r,i)){n.zrX=o4e[0],n.zrY=o4e[1];return}}n.zrX=n.zrY=0}function l4e(t){return t||window.event}function Ry(t,e,n){if(e=l4e(e),e.zrX!=null)return e;var r=e.type,i=r&&r.indexOf("touch")>=0;if(i){var l=r!=="touchend"?e.targetTouches[0]:e.changedTouches[0];l&&s4e(t,l,e,n)}else{s4e(t,e,e,n);var o=SZr(e);e.zrDelta=o?o/120:-(e.detail||0)/3}var u=e.button;return e.which==null&&u!==void 0&&EZr.test(e.type)&&(e.which=u&1?1:u&2?3:u&4?2:0),e}function SZr(t){var e=t.wheelDelta;if(e)return e;var n=t.deltaX,r=t.deltaY;if(n==null||r==null)return e;var i=Math.abs(r!==0?r:n),o=r>0?-1:r<0?1:n>0?-1:1;return 3*i*o}function IZr(t,e,n,r){t.addEventListener(e,n,r)}function TZr(t,e,n,r){t.removeEventListener(e,n,r)}var d5t=function(t){t.preventDefault(),t.stopPropagation(),t.cancelBubble=!0},BZr=(function(){function t(){this._track=[]}return t.prototype.recognize=function(e,n,r){return this._doTrack(e,n,r),this._recognize(e)},t.prototype.clear=function(){return this._track.length=0,this},t.prototype._doTrack=function(e,n,r){var i=e.touches;if(i){for(var o={points:[],touches:[],target:n,event:e},l=0,u=i.length;l<u;l++){var d=i[l],p=s4e(r,d,{});o.points.push([p.zrX,p.zrY]),o.touches.push(d)}this._track.push(o)}},t.prototype._recognize=function(e){for(var n in c4e)if(c4e.hasOwnProperty(n)){var r=c4e[n](this._track,e);if(r)return r}},t})();function p5t(t){var e=t[1][0]-t[0][0],n=t[1][1]-t[0][1];return Math.sqrt(e*e+n*n)}function DZr(t){return[(t[0][0]+t[1][0])/2,(t[0][1]+t[1][1])/2]}var c4e={pinch:function(t,e){var n=t.length;if(n){var r=(t[n-1]||{}).points,i=(t[n-2]||{}).points||r;if(i&&i.length>1&&r&&r.length>1){var o=p5t(r)/p5t(i);!isFinite(o)&&(o=1),e.pinchScale=o;var l=DZr(r);return e.pinchX=l[0],e.pinchY=l[1],{type:"pinch",target:t[0].target,event:e}}}}};function M_(){return[1,0,0,1,0,0]}function JG(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t}function yce(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t}function h3(t,e,n){var r=e[0]*n[0]+e[2]*n[1],i=e[1]*n[0]+e[3]*n[1],o=e[0]*n[2]+e[2]*n[3],l=e[1]*n[2]+e[3]*n[3],u=e[0]*n[4]+e[2]*n[5]+e[4],d=e[1]*n[4]+e[3]*n[5]+e[5];return t[0]=r,t[1]=i,t[2]=o,t[3]=l,t[4]=u,t[5]=d,t}function vce(t,e,n){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4]+n[0],t[5]=e[5]+n[1],t}function _ce(t,e,n,r){r===void 0&&(r=[0,0]);var i=e[0],o=e[2],l=e[4],u=e[1],d=e[3],p=e[5],m=Math.sin(n),g=Math.cos(n);return t[0]=i*g+u*m,t[1]=-i*m+u*g,t[2]=o*g+d*m,t[3]=-o*m+g*d,t[4]=g*(l-r[0])+m*(p-r[1])+r[0],t[5]=g*(p-r[1])-m*(l-r[0])+r[1],t}function m5t(t,e,n){var r=n[0],i=n[1];return t[0]=e[0]*r,t[1]=e[1]*i,t[2]=e[2]*r,t[3]=e[3]*i,t[4]=e[4]*r,t[5]=e[5]*i,t}function kF(t,e){var n=e[0],r=e[2],i=e[4],o=e[1],l=e[3],u=e[5],d=n*l-o*r;return d?(d=1/d,t[0]=l*d,t[1]=-o*d,t[2]=-r*d,t[3]=n*d,t[4]=(r*u-l*i)*d,t[5]=(o*i-n*u)*d,t):null}function NZr(t){var e=M_();return yce(e,t),e}const RZr=Object.freeze(Object.defineProperty({__proto__:null,clone:NZr,copy:yce,create:M_,identity:JG,invert:kF,mul:h3,rotate:_ce,scale:m5t,translate:vce},Symbol.toStringTag,{value:"Module"}));var Io=(function(){function t(e,n){this.x=e||0,this.y=n||0}return t.prototype.copy=function(e){return this.x=e.x,this.y=e.y,this},t.prototype.clone=function(){return new t(this.x,this.y)},t.prototype.set=function(e,n){return this.x=e,this.y=n,this},t.prototype.equal=function(e){return e.x===this.x&&e.y===this.y},t.prototype.add=function(e){return this.x+=e.x,this.y+=e.y,this},t.prototype.scale=function(e){this.x*=e,this.y*=e},t.prototype.scaleAndAdd=function(e,n){this.x+=e.x*n,this.y+=e.y*n},t.prototype.sub=function(e){return this.x-=e.x,this.y-=e.y,this},t.prototype.dot=function(e){return this.x*e.x+this.y*e.y},t.prototype.len=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},t.prototype.lenSquare=function(){return this.x*this.x+this.y*this.y},t.prototype.normalize=function(){var e=this.len();return this.x/=e,this.y/=e,this},t.prototype.distance=function(e){var n=this.x-e.x,r=this.y-e.y;return Math.sqrt(n*n+r*r)},t.prototype.distanceSquare=function(e){var n=this.x-e.x,r=this.y-e.y;return n*n+r*r},t.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this},t.prototype.transform=function(e){if(e){var n=this.x,r=this.y;return this.x=e[0]*n+e[2]*r+e[4],this.y=e[1]*n+e[3]*r+e[5],this}},t.prototype.toArray=function(e){return e[0]=this.x,e[1]=this.y,e},t.prototype.fromArray=function(e){this.x=e[0],this.y=e[1]},t.set=function(e,n,r){e.x=n,e.y=r},t.copy=function(e,n){e.x=n.x,e.y=n.y},t.len=function(e){return Math.sqrt(e.x*e.x+e.y*e.y)},t.lenSquare=function(e){return e.x*e.x+e.y*e.y},t.dot=function(e,n){return e.x*n.x+e.y*n.y},t.add=function(e,n,r){e.x=n.x+r.x,e.y=n.y+r.y},t.sub=function(e,n,r){e.x=n.x-r.x,e.y=n.y-r.y},t.scale=function(e,n,r){e.x=n.x*r,e.y=n.y*r},t.scaleAndAdd=function(e,n,r,i){e.x=n.x+r.x*i,e.y=n.y+r.y*i},t.lerp=function(e,n,r,i){var o=1-i;e.x=o*n.x+i*r.x,e.y=o*n.y+i*r.y},t})(),f3=Math.min,EF=Math.max,u4e=Math.abs,g5t=["x","y"],LZr=["width","height"],A3=new Io,b3=new Io,y3=new Io,v3=new Io,u0=f5t(),eH=u0.minTv,d4e=u0.maxTv,tH=[0,0],Bo=(function(){function t(e,n,r,i){t.set(this,e,n,r,i)}return t.set=function(e,n,r,i,o){return i<0&&(n=n+i,i=-i),o<0&&(r=r+o,o=-o),e.x=n,e.y=r,e.width=i,e.height=o,e},t.prototype.union=function(e){var n=f3(e.x,this.x),r=f3(e.y,this.y);isFinite(this.x)&&isFinite(this.width)?this.width=EF(e.x+e.width,this.x+this.width)-n:this.width=e.width,isFinite(this.y)&&isFinite(this.height)?this.height=EF(e.y+e.height,this.y+this.height)-r:this.height=e.height,this.x=n,this.y=r},t.prototype.applyTransform=function(e){t.applyTransform(this,this,e)},t.prototype.calculateTransform=function(e){var n=this,r=e.width/n.width,i=e.height/n.height,o=M_();return vce(o,o,[-n.x,-n.y]),m5t(o,o,[r,i]),vce(o,o,[e.x,e.y]),o},t.prototype.intersect=function(e,n,r){return t.intersect(this,e,n,r)},t.intersect=function(e,n,r,i){r&&Io.set(r,0,0);var o=i&&i.outIntersectRect||null,l=i&&i.clamp;if(o&&(o.x=o.y=o.width=o.height=NaN),!e||!n)return!1;e instanceof t||(e=t.set(MZr,e.x,e.y,e.width,e.height)),n instanceof t||(n=t.set(PZr,n.x,n.y,n.width,n.height));var u=!!r;u0.reset(i,u);var d=u0.touchThreshold,p=e.x+d,m=e.x+e.width-d,g=e.y+d,h=e.y+e.height-d,f=n.x+d,b=n.x+n.width-d,y=n.y+d,v=n.y+n.height-d;if(p>m||g>h||f>b||y>v)return!1;var _=!(m<f||b<p||h<y||v<g);return(u||o)&&(tH[0]=1/0,tH[1]=0,h5t(p,m,f,b,0,u,o,l),h5t(g,h,y,v,1,u,o,l),u&&Io.copy(r,_?u0.useDir?u0.dirMinTv:eH:d4e)),_},t.contain=function(e,n,r){return n>=e.x&&n<=e.x+e.width&&r>=e.y&&r<=e.y+e.height},t.prototype.contain=function(e,n){return t.contain(this,e,n)},t.prototype.clone=function(){return new t(this.x,this.y,this.width,this.height)},t.prototype.copy=function(e){t.copy(this,e)},t.prototype.plain=function(){return{x:this.x,y:this.y,width:this.width,height:this.height}},t.prototype.isFinite=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)},t.prototype.isZero=function(){return this.width===0||this.height===0},t.create=function(e){return new t(e.x,e.y,e.width,e.height)},t.copy=function(e,n){return e.x=n.x,e.y=n.y,e.width=n.width,e.height=n.height,e},t.applyTransform=function(e,n,r){if(!r){e!==n&&t.copy(e,n);return}if(r[1]<1e-5&&r[1]>-1e-5&&r[2]<1e-5&&r[2]>-1e-5){var i=r[0],o=r[3],l=r[4],u=r[5];e.x=n.x*i+l,e.y=n.y*o+u,e.width=n.width*i,e.height=n.height*o,e.width<0&&(e.x+=e.width,e.width=-e.width),e.height<0&&(e.y+=e.height,e.height=-e.height);return}A3.x=y3.x=n.x,A3.y=v3.y=n.y,b3.x=v3.x=n.x+n.width,b3.y=y3.y=n.y+n.height,A3.transform(r),v3.transform(r),b3.transform(r),y3.transform(r),e.x=f3(A3.x,b3.x,y3.x,v3.x),e.y=f3(A3.y,b3.y,y3.y,v3.y);var d=EF(A3.x,b3.x,y3.x,v3.x),p=EF(A3.y,b3.y,y3.y,v3.y);e.width=d-e.x,e.height=p-e.y},t})(),MZr=new Bo(0,0,0,0),PZr=new Bo(0,0,0,0);function h5t(t,e,n,r,i,o,l,u){var d=u4e(e-n),p=u4e(r-t),m=f3(d,p),g=g5t[i],h=g5t[1-i],f=LZr[i];e<n||r<t?d<p?(o&&(d4e[g]=-d),u&&(l[g]=e,l[f]=0)):(o&&(d4e[g]=p),u&&(l[g]=t,l[f]=0)):(l&&(l[g]=EF(t,n),l[f]=f3(e,r)-l[g]),o&&(m<tH[0]||u0.useDir)&&(tH[0]=f3(m,tH[0]),(d<p||!u0.bidirectional)&&(eH[g]=d,eH[h]=0,u0.useDir&&u0.calcDirMTV()),(d>=p||!u0.bidirectional)&&(eH[g]=-p,eH[h]=0,u0.useDir&&u0.calcDirMTV())))}function f5t(){var t=0,e=new Io,n=new Io,r={minTv:new Io,maxTv:new Io,useDir:!1,dirMinTv:new Io,touchThreshold:0,bidirectional:!0,negativeSize:!1,reset:function(o,l){r.touchThreshold=0,o&&o.touchThreshold!=null&&(r.touchThreshold=EF(0,o.touchThreshold)),r.negativeSize=!1,l&&(r.minTv.set(1/0,1/0),r.maxTv.set(0,0),r.useDir=!1,o&&o.direction!=null&&(r.useDir=!0,r.dirMinTv.copy(r.minTv),n.copy(r.minTv),t=o.direction,r.bidirectional=o.bidirectional==null||!!o.bidirectional,r.bidirectional||e.set(Math.cos(t),Math.sin(t))))},calcDirMTV:function(){var o=r.minTv,l=r.dirMinTv,u=o.y*o.y+o.x*o.x,d=Math.sin(t),p=Math.cos(t),m=d*o.y+p*o.x;if(i(m)){i(o.x)&&i(o.y)&&l.set(0,0);return}if(n.x=u*p/m,n.y=u*d/m,i(n.x)&&i(n.y)){l.set(0,0);return}(r.bidirectional||e.dot(n)>0)&&n.len()<l.len()&&l.copy(n)}};function i(o){return u4e(o)<1e-10}return r}var A5t="silent";function OZr(t,e,n){return{type:t,event:n,target:e.target,topTarget:e.topTarget,cancelBubble:!1,offsetX:n.zrX,offsetY:n.zrY,gestureEvent:n.gestureEvent,pinchX:n.pinchX,pinchY:n.pinchY,pinchScale:n.pinchScale,wheelDelta:n.zrDelta,zrByTouch:n.zrByTouch,which:n.which,stop:FZr}}function FZr(){d5t(this.event)}var QZr=(function(t){oc(e,t);function e(){var n=t!==null&&t.apply(this,arguments)||this;return n.handler=null,n}return e.prototype.dispose=function(){},e.prototype.setCursor=function(){},e})(gk),nH=(function(){function t(e,n){this.x=e,this.y=n}return t})(),$Zr=["click","dblclick","mousewheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],p4e=new Bo(0,0,0,0),b5t=(function(t){oc(e,t);function e(n,r,i,o,l){var u=t.call(this)||this;return u._hovered=new nH(0,0),u.storage=n,u.painter=r,u.painterRoot=o,u._pointerSize=l,i=i||new QZr,u.proxy=null,u.setHandlerProxy(i),u._draggingMgr=new AZr(u),u}return e.prototype.setHandlerProxy=function(n){this.proxy&&this.proxy.dispose(),n&&(fn($Zr,function(r){n.on&&n.on(r,this[r],this)},this),n.handler=this),this.proxy=n},e.prototype.mousemove=function(n){var r=n.zrX,i=n.zrY,o=v5t(this,r,i),l=this._hovered,u=l.target;u&&!u.__zr&&(l=this.findHover(l.x,l.y),u=l.target);var d=this._hovered=o?new nH(r,i):this.findHover(r,i),p=d.target,m=this.proxy;m.setCursor&&m.setCursor(p?p.cursor:"default"),u&&p!==u&&this.dispatchToElement(l,"mouseout",n),this.dispatchToElement(d,"mousemove",n),p&&p!==u&&this.dispatchToElement(d,"mouseover",n)},e.prototype.mouseout=function(n){var r=n.zrEventControl;r!=="only_globalout"&&this.dispatchToElement(this._hovered,"mouseout",n),r!=="no_globalout"&&this.trigger("globalout",{type:"globalout",event:n})},e.prototype.resize=function(){this._hovered=new nH(0,0)},e.prototype.dispatch=function(n,r){var i=this[n];i&&i.call(this,r)},e.prototype.dispose=function(){this.proxy.dispose(),this.storage=null,this.proxy=null,this.painter=null},e.prototype.setCursorStyle=function(n){var r=this.proxy;r.setCursor&&r.setCursor(n)},e.prototype.dispatchToElement=function(n,r,i){n=n||{};var o=n.target;if(!(o&&o.silent)){for(var l="on"+r,u=OZr(r,n,i);o&&(o[l]&&(u.cancelBubble=!!o[l].call(o,u)),o.trigger(r,u),o=o.__hostTarget?o.__hostTarget:o.parent,!u.cancelBubble););u.cancelBubble||(this.trigger(r,u),this.painter&&this.painter.eachOtherLayer&&this.painter.eachOtherLayer(function(d){typeof d[l]=="function"&&d[l].call(d,u),d.trigger&&d.trigger(r,u)}))}},e.prototype.findHover=function(n,r,i){var o=this.storage.getDisplayList(),l=new nH(n,r);if(y5t(o,l,n,r,i),this._pointerSize&&!l.target){for(var u=[],d=this._pointerSize,p=d/2,m=new Bo(n-p,r-p,d,d),g=o.length-1;g>=0;g--){var h=o[g];h!==i&&!h.ignore&&!h.ignoreCoarsePointer&&(!h.parent||!h.parent.ignoreCoarsePointer)&&(p4e.copy(h.getBoundingRect()),h.transform&&p4e.applyTransform(h.transform),p4e.intersect(m)&&u.push(h))}if(u.length)for(var f=4,b=Math.PI/12,y=Math.PI*2,v=0;v<p;v+=f)for(var _=0;_<y;_+=b){var w=n+v*Math.cos(_),x=r+v*Math.sin(_);if(y5t(u,l,w,x,i),l.target)return l}}return l},e.prototype.processGesture=function(n,r){this._gestureMgr||(this._gestureMgr=new BZr);var i=this._gestureMgr;r==="start"&&i.clear();var o=i.recognize(n,this.findHover(n.zrX,n.zrY,null).target,this.proxy.dom);if(r==="end"&&i.clear(),o){var l=o.type;n.gestureEvent=l;var u=new nH;u.target=o.target,this.dispatchToElement(u,l,o.event)}},e})(gk);fn(["click","mousedown","mouseup","mousewheel","dblclick","contextmenu"],function(t){b5t.prototype[t]=function(e){var n=e.zrX,r=e.zrY,i=v5t(this,n,r),o,l;if((t!=="mouseup"||!i)&&(o=this.findHover(n,r),l=o.target),t==="mousedown")this._downEl=l,this._downPoint=[e.zrX,e.zrY],this._upEl=l;else if(t==="mouseup")this._upEl=l;else if(t==="click"){if(this._downEl!==this._upEl||!this._downPoint||fce(this._downPoint,[e.zrX,e.zrY])>4)return;this._downPoint=null}this.dispatchToElement(o,t,e)}});function jZr(t,e,n){if(t[t.rectHover?"rectContain":"contain"](e,n)){for(var r=t,i=void 0,o=!1;r;){if(r.ignoreClip&&(o=!0),!o){var l=r.getClipPath();if(l&&!l.contain(e,n))return!1}r.silent&&(i=!0);var u=r.__hostTarget;r=u?r.ignoreHostSilent?null:u:r.parent}return i?A5t:!0}return!1}function y5t(t,e,n,r,i){for(var o=t.length-1;o>=0;o--){var l=t[o],u=void 0;if(l!==i&&!l.ignore&&(u=jZr(l,n,r))&&(!e.topTarget&&(e.topTarget=l),u!==A5t)){e.target=l;break}}}function v5t(t,e,n){var r=t.painter;return e<0||e>r.getWidth()||n<0||n>r.getHeight()}var _5t=32,rH=7;function zZr(t){for(var e=0;t>=_5t;)e|=t&1,t>>=1;return t+e}function w5t(t,e,n,r){var i=e+1;if(i===n)return 1;if(r(t[i++],t[e])<0){for(;i<n&&r(t[i],t[i-1])<0;)i++;UZr(t,e,i)}else for(;i<n&&r(t[i],t[i-1])>=0;)i++;return i-e}function UZr(t,e,n){for(n--;e<n;){var r=t[e];t[e++]=t[n],t[n--]=r}}function x5t(t,e,n,r,i){for(r===e&&r++;r<n;r++){for(var o=t[r],l=e,u=r,d;l<u;)d=l+u>>>1,i(o,t[d])<0?u=d:l=d+1;var p=r-l;switch(p){case 3:t[l+3]=t[l+2];case 2:t[l+2]=t[l+1];case 1:t[l+1]=t[l];break;default:for(;p>0;)t[l+p]=t[l+p-1],p--}t[l]=o}}function m4e(t,e,n,r,i,o){var l=0,u=0,d=1;if(o(t,e[n+i])>0){for(u=r-i;d<u&&o(t,e[n+i+d])>0;)l=d,d=(d<<1)+1,d<=0&&(d=u);d>u&&(d=u),l+=i,d+=i}else{for(u=i+1;d<u&&o(t,e[n+i-d])<=0;)l=d,d=(d<<1)+1,d<=0&&(d=u);d>u&&(d=u);var p=l;l=i-d,d=i-p}for(l++;l<d;){var m=l+(d-l>>>1);o(t,e[n+m])>0?l=m+1:d=m}return d}function g4e(t,e,n,r,i,o){var l=0,u=0,d=1;if(o(t,e[n+i])<0){for(u=i+1;d<u&&o(t,e[n+i-d])<0;)l=d,d=(d<<1)+1,d<=0&&(d=u);d>u&&(d=u);var p=l;l=i-d,d=i-p}else{for(u=r-i;d<u&&o(t,e[n+i+d])>=0;)l=d,d=(d<<1)+1,d<=0&&(d=u);d>u&&(d=u),l+=i,d+=i}for(l++;l<d;){var m=l+(d-l>>>1);o(t,e[n+m])<0?d=m:l=m+1}return d}function qZr(t,e){var n=rH,r,i,o=0,l=[];r=[],i=[];function u(f,b){r[o]=f,i[o]=b,o+=1}function d(){for(;o>1;){var f=o-2;if(f>=1&&i[f-1]<=i[f]+i[f+1]||f>=2&&i[f-2]<=i[f]+i[f-1])i[f-1]<i[f+1]&&f--;else if(i[f]>i[f+1])break;m(f)}}function p(){for(;o>1;){var f=o-2;f>0&&i[f-1]<i[f+1]&&f--,m(f)}}function m(f){var b=r[f],y=i[f],v=r[f+1],_=i[f+1];i[f]=y+_,f===o-3&&(r[f+1]=r[f+2],i[f+1]=i[f+2]),o--;var w=g4e(t[v],t,b,y,0,e);b+=w,y-=w,y!==0&&(_=m4e(t[b+y-1],t,v,_,_-1,e),_!==0&&(y<=_?g(b,y,v,_):h(b,y,v,_)))}function g(f,b,y,v){var _=0;for(_=0;_<b;_++)l[_]=t[f+_];var w=0,x=y,k=f;if(t[k++]=t[x++],--v===0){for(_=0;_<b;_++)t[k+_]=l[w+_];return}if(b===1){for(_=0;_<v;_++)t[k+_]=t[x+_];t[k+v]=l[w];return}for(var C=n,E,S,I;;){E=0,S=0,I=!1;do if(e(t[x],l[w])<0){if(t[k++]=t[x++],S++,E=0,--v===0){I=!0;break}}else if(t[k++]=l[w++],E++,S=0,--b===1){I=!0;break}while((E|S)<C);if(I)break;do{if(E=g4e(t[x],l,w,b,0,e),E!==0){for(_=0;_<E;_++)t[k+_]=l[w+_];if(k+=E,w+=E,b-=E,b<=1){I=!0;break}}if(t[k++]=t[x++],--v===0){I=!0;break}if(S=m4e(l[w],t,x,v,0,e),S!==0){for(_=0;_<S;_++)t[k+_]=t[x+_];if(k+=S,x+=S,v-=S,v===0){I=!0;break}}if(t[k++]=l[w++],--b===1){I=!0;break}C--}while(E>=rH||S>=rH);if(I)break;C<0&&(C=0),C+=2}if(n=C,n<1&&(n=1),b===1){for(_=0;_<v;_++)t[k+_]=t[x+_];t[k+v]=l[w]}else{if(b===0)throw new Error;for(_=0;_<b;_++)t[k+_]=l[w+_]}}function h(f,b,y,v){var _=0;for(_=0;_<v;_++)l[_]=t[y+_];var w=f+b-1,x=v-1,k=y+v-1,C=0,E=0;if(t[k--]=t[w--],--b===0){for(C=k-(v-1),_=0;_<v;_++)t[C+_]=l[_];return}if(v===1){for(k-=b,w-=b,E=k+1,C=w+1,_=b-1;_>=0;_--)t[E+_]=t[C+_];t[k]=l[x];return}for(var S=n;;){var I=0,B=0,R=!1;do if(e(l[x],t[w])<0){if(t[k--]=t[w--],I++,B=0,--b===0){R=!0;break}}else if(t[k--]=l[x--],B++,I=0,--v===1){R=!0;break}while((I|B)<S);if(R)break;do{if(I=b-g4e(l[x],t,f,b,b-1,e),I!==0){for(k-=I,w-=I,b-=I,E=k+1,C=w+1,_=I-1;_>=0;_--)t[E+_]=t[C+_];if(b===0){R=!0;break}}if(t[k--]=l[x--],--v===1){R=!0;break}if(B=v-m4e(t[w],l,0,v,v-1,e),B!==0){for(k-=B,x-=B,v-=B,E=k+1,C=x+1,_=0;_<B;_++)t[E+_]=l[C+_];if(v<=1){R=!0;break}}if(t[k--]=t[w--],--b===0){R=!0;break}S--}while(I>=rH||B>=rH);if(R)break;S<0&&(S=0),S+=2}if(n=S,n<1&&(n=1),v===1){for(k-=b,w-=b,E=k+1,C=w+1,_=b-1;_>=0;_--)t[E+_]=t[C+_];t[k]=l[x]}else{if(v===0)throw new Error;for(C=k-(v-1),_=0;_<v;_++)t[C+_]=l[_]}}return{mergeRuns:d,forceMergeRuns:p,pushRun:u}}function wce(t,e,n,r){n||(n=0),r||(r=t.length);var i=r-n;if(!(i<2)){var o=0;if(i<_5t){o=w5t(t,n,r,e),x5t(t,n,r,n+o,e);return}var l=qZr(t,e),u=zZr(i);do{if(o=w5t(t,n,r,e),o<u){var d=i;d>u&&(d=u),x5t(t,n,n+d,n+o,e),o=d}l.pushRun(n,o),l.mergeRuns(),i-=o,n+=o}while(i!==0);l.forceMergeRuns()}}var d0=1,aH=2,CF=4,k5t=!1;function h4e(){k5t||(k5t=!0,console.warn("z / z2 / zlevel of displayable is invalid, which may cause unexpected errors"))}function E5t(t,e){return t.zlevel===e.zlevel?t.z===e.z?t.z2-e.z2:t.z-e.z:t.zlevel-e.zlevel}var GZr=(function(){function t(){this._roots=[],this._displayList=[],this._displayListLen=0,this.displayableSortFunc=E5t}return t.prototype.traverse=function(e,n){for(var r=0;r<this._roots.length;r++)this._roots[r].traverse(e,n)},t.prototype.getDisplayList=function(e,n){n=n||!1;var r=this._displayList;return(e||!r.length)&&this.updateDisplayList(n),r},t.prototype.updateDisplayList=function(e){this._displayListLen=0;for(var n=this._roots,r=this._displayList,i=0,o=n.length;i<o;i++)this._updateAndAddDisplayable(n[i],null,e);r.length=this._displayListLen,wce(r,E5t)},t.prototype._updateAndAddDisplayable=function(e,n,r){if(!(e.ignore&&!r)){e.beforeUpdate(),e.update(),e.afterUpdate();var i=e.getClipPath(),o=n&&n.length,l=0,u=e.__clipPaths;if(!e.ignoreClip&&(o||i)){if(u||(u=e.__clipPaths=[]),o)for(var d=0;d<n.length;d++)u[l++]=n[d];for(var p=i,m=e;p;)p.parent=m,p.updateTransform(),u[l++]=p,m=p,p=p.getClipPath()}if(u&&(u.length=l),e.childrenRef){for(var g=e.childrenRef(),h=0;h<g.length;h++){var f=g[h];e.__dirty&&(f.__dirty|=d0),this._updateAndAddDisplayable(f,u,r)}e.__dirty=0}else{var b=e;isNaN(b.z)&&(h4e(),b.z=0),isNaN(b.z2)&&(h4e(),b.z2=0),isNaN(b.zlevel)&&(h4e(),b.zlevel=0),this._displayList[this._displayListLen++]=b}var y=e.getDecalElement&&e.getDecalElement();y&&this._updateAndAddDisplayable(y,u,r);var v=e.getTextGuideLine();v&&this._updateAndAddDisplayable(v,u,r);var _=e.getTextContent();_&&this._updateAndAddDisplayable(_,u,r)}},t.prototype.addRoot=function(e){e.__zr&&e.__zr.storage===this||this._roots.push(e)},t.prototype.delRoot=function(e){if(e instanceof Array){for(var n=0,r=e.length;n<r;n++)this.delRoot(e[n]);return}var i=ic(this._roots,e);i>=0&&this._roots.splice(i,1)},t.prototype.delAllRoots=function(){this._roots=[],this._displayList=[],this._displayListLen=0},t.prototype.getRoots=function(){return this._roots},t.prototype.dispose=function(){this._displayList=null,this._roots=null},t})(),xce;xce=go.hasGlobalWindow&&(window.requestAnimationFrame&&window.requestAnimationFrame.bind(window)||window.msRequestAnimationFrame&&window.msRequestAnimationFrame.bind(window)||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame)||function(t){return setTimeout(t,16)};var iH={linear:function(t){return t},quadraticIn:function(t){return t*t},quadraticOut:function(t){return t*(2-t)},quadraticInOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)},cubicIn:function(t){return t*t*t},cubicOut:function(t){return--t*t*t+1},cubicInOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)},quarticIn:function(t){return t*t*t*t},quarticOut:function(t){return 1- --t*t*t*t},quarticInOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)},quinticIn:function(t){return t*t*t*t*t},quinticOut:function(t){return--t*t*t*t*t+1},quinticInOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)},sinusoidalIn:function(t){return 1-Math.cos(t*Math.PI/2)},sinusoidalOut:function(t){return Math.sin(t*Math.PI/2)},sinusoidalInOut:function(t){return .5*(1-Math.cos(Math.PI*t))},exponentialIn:function(t){return t===0?0:Math.pow(1024,t-1)},exponentialOut:function(t){return t===1?1:1-Math.pow(2,-10*t)},exponentialInOut:function(t){return t===0?0:t===1?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(-Math.pow(2,-10*(t-1))+2)},circularIn:function(t){return 1-Math.sqrt(1-t*t)},circularOut:function(t){return Math.sqrt(1- --t*t)},circularInOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},elasticIn:function(t){var e,n=.1,r=.4;return t===0?0:t===1?1:(!n||n<1?(n=1,e=r/4):e=r*Math.asin(1/n)/(2*Math.PI),-(n*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/r)))},elasticOut:function(t){var e,n=.1,r=.4;return t===0?0:t===1?1:(!n||n<1?(n=1,e=r/4):e=r*Math.asin(1/n)/(2*Math.PI),n*Math.pow(2,-10*t)*Math.sin((t-e)*(2*Math.PI)/r)+1)},elasticInOut:function(t){var e,n=.1,r=.4;return t===0?0:t===1?1:(!n||n<1?(n=1,e=r/4):e=r*Math.asin(1/n)/(2*Math.PI),(t*=2)<1?-.5*(n*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/r)):n*Math.pow(2,-10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/r)*.5+1)},backIn:function(t){var e=1.70158;return t*t*((e+1)*t-e)},backOut:function(t){var e=1.70158;return--t*t*((e+1)*t+e)+1},backInOut:function(t){var e=2.5949095;return(t*=2)<1?.5*(t*t*((e+1)*t-e)):.5*((t-=2)*t*((e+1)*t+e)+2)},bounceIn:function(t){return 1-iH.bounceOut(1-t)},bounceOut:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},bounceInOut:function(t){return t<.5?iH.bounceIn(t*2)*.5:iH.bounceOut(t*2-1)*.5+.5}},kce=Math.pow,RT=Math.sqrt,Ece=1e-8,C5t=1e-4,S5t=RT(3),Cce=1/3,hk=m3(),Ly=m3(),SF=m3();function LT(t){return t>-Ece&&t<Ece}function I5t(t){return t>Ece||t<-Ece}function Of(t,e,n,r,i){var o=1-i;return o*o*(o*t+3*i*e)+i*i*(i*r+3*o*n)}function T5t(t,e,n,r,i){var o=1-i;return 3*(((e-t)*o+2*(n-e)*i)*o+(r-n)*i*i)}function B5t(t,e,n,r,i,o){var l=r+3*(e-n)-t,u=3*(n-e*2+t),d=3*(e-t),p=t-i,m=u*u-3*l*d,g=u*d-9*l*p,h=d*d-3*u*p,f=0;if(LT(m)&<(g))if(LT(u))o[0]=0;else{var b=-d/u;b>=0&&b<=1&&(o[f++]=b)}else{var y=g*g-4*m*h;if(LT(y)){var v=g/m,b=-u/l+v,_=-v/2;b>=0&&b<=1&&(o[f++]=b),_>=0&&_<=1&&(o[f++]=_)}else if(y>0){var w=RT(y),x=m*u+1.5*l*(-g+w),k=m*u+1.5*l*(-g-w);x<0?x=-kce(-x,Cce):x=kce(x,Cce),k<0?k=-kce(-k,Cce):k=kce(k,Cce);var b=(-u-(x+k))/(3*l);b>=0&&b<=1&&(o[f++]=b)}else{var C=(2*m*u-3*l*g)/(2*RT(m*m*m)),E=Math.acos(C)/3,S=RT(m),I=Math.cos(E),b=(-u-2*S*I)/(3*l),_=(-u+S*(I+S5t*Math.sin(E)))/(3*l),B=(-u+S*(I-S5t*Math.sin(E)))/(3*l);b>=0&&b<=1&&(o[f++]=b),_>=0&&_<=1&&(o[f++]=_),B>=0&&B<=1&&(o[f++]=B)}}return f}function D5t(t,e,n,r,i){var o=6*n-12*e+6*t,l=9*e+3*r-3*t-9*n,u=3*e-3*t,d=0;if(LT(l)){if(I5t(o)){var p=-u/o;p>=0&&p<=1&&(i[d++]=p)}}else{var m=o*o-4*l*u;if(LT(m))i[0]=-o/(2*l);else if(m>0){var g=RT(m),p=(-o+g)/(2*l),h=(-o-g)/(2*l);p>=0&&p<=1&&(i[d++]=p),h>=0&&h<=1&&(i[d++]=h)}}return d}function Sce(t,e,n,r,i,o){var l=(e-t)*i+t,u=(n-e)*i+e,d=(r-n)*i+n,p=(u-l)*i+l,m=(d-u)*i+u,g=(m-p)*i+p;o[0]=t,o[1]=l,o[2]=p,o[3]=g,o[4]=g,o[5]=m,o[6]=d,o[7]=r}function HZr(t,e,n,r,i,o,l,u,d,p,m){var g,h=.005,f=1/0,b,y,v,_;hk[0]=d,hk[1]=p;for(var w=0;w<1;w+=.05)Ly[0]=Of(t,n,i,l,w),Ly[1]=Of(e,r,o,u,w),v=g3(hk,Ly),v<f&&(g=w,f=v);f=1/0;for(var x=0;x<32&&!(h<C5t);x++)b=g-h,y=g+h,Ly[0]=Of(t,n,i,l,b),Ly[1]=Of(e,r,o,u,b),v=g3(Ly,hk),b>=0&&v<f?(g=b,f=v):(SF[0]=Of(t,n,i,l,y),SF[1]=Of(e,r,o,u,y),_=g3(SF,hk),y<=1&&_<f?(g=y,f=_):h*=.5);return RT(f)}function WZr(t,e,n,r,i,o,l,u,d){for(var p=t,m=e,g=0,h=1/d,f=1;f<=d;f++){var b=f*h,y=Of(t,n,i,l,b),v=Of(e,r,o,u,b),_=y-p,w=v-m;g+=Math.sqrt(_*_+w*w),p=y,m=v}return g}function HA(t,e,n,r){var i=1-r;return i*(i*t+2*r*e)+r*r*n}function N5t(t,e,n,r){return 2*((1-r)*(e-t)+r*(n-e))}function YZr(t,e,n,r,i){var o=t-2*e+n,l=2*(e-t),u=t-r,d=0;if(LT(o)){if(I5t(l)){var p=-u/l;p>=0&&p<=1&&(i[d++]=p)}}else{var m=l*l-4*o*u;if(LT(m)){var p=-l/(2*o);p>=0&&p<=1&&(i[d++]=p)}else if(m>0){var g=RT(m),p=(-l+g)/(2*o),h=(-l-g)/(2*o);p>=0&&p<=1&&(i[d++]=p),h>=0&&h<=1&&(i[d++]=h)}}return d}function R5t(t,e,n){var r=t+n-2*e;return r===0?.5:(t-e)/r}function Ice(t,e,n,r,i){var o=(e-t)*r+t,l=(n-e)*r+e,u=(l-o)*r+o;i[0]=t,i[1]=o,i[2]=u,i[3]=u,i[4]=l,i[5]=n}function VZr(t,e,n,r,i,o,l,u,d){var p,m=.005,g=1/0;hk[0]=l,hk[1]=u;for(var h=0;h<1;h+=.05){Ly[0]=HA(t,n,i,h),Ly[1]=HA(e,r,o,h);var f=g3(hk,Ly);f<g&&(p=h,g=f)}g=1/0;for(var b=0;b<32&&!(m<C5t);b++){var y=p-m,v=p+m;Ly[0]=HA(t,n,i,y),Ly[1]=HA(e,r,o,y);var f=g3(Ly,hk);if(y>=0&&f<g)p=y,g=f;else{SF[0]=HA(t,n,i,v),SF[1]=HA(e,r,o,v);var _=g3(SF,hk);v<=1&&_<g?(p=v,g=_):m*=.5}}return RT(g)}function KZr(t,e,n,r,i,o,l){for(var u=t,d=e,p=0,m=1/l,g=1;g<=l;g++){var h=g*m,f=HA(t,n,i,h),b=HA(e,r,o,h),y=f-u,v=b-d;p+=Math.sqrt(y*y+v*v),u=f,d=b}return p}var ZZr=/cubic-bezier\(([0-9,\.e ]+)\)/;function f4e(t){var e=t&&ZZr.exec(t);if(e){var n=e[1].split(","),r=+R_(n[0]),i=+R_(n[1]),o=+R_(n[2]),l=+R_(n[3]);if(isNaN(r+i+o+l))return;var u=[];return function(d){return d<=0?0:d>=1?1:B5t(0,r,o,1,d,u)&&Of(0,i,l,1,u[0])}}}var XZr=(function(){function t(e){this._inited=!1,this._startTime=0,this._pausedTime=0,this._paused=!1,this._life=e.life||1e3,this._delay=e.delay||0,this.loop=e.loop||!1,this.onframe=e.onframe||xg,this.ondestroy=e.ondestroy||xg,this.onrestart=e.onrestart||xg,e.easing&&this.setEasing(e.easing)}return t.prototype.step=function(e,n){if(this._inited||(this._startTime=e+this._delay,this._inited=!0),this._paused){this._pausedTime+=n;return}var r=this._life,i=e-this._startTime-this._pausedTime,o=i/r;o<0&&(o=0),o=Math.min(o,1);var l=this.easingFunc,u=l?l(o):o;if(this.onframe(u),o===1)if(this.loop){var d=i%r;this._startTime=e-d,this._pausedTime=0,this.onrestart()}else return!0;return!1},t.prototype.pause=function(){this._paused=!0},t.prototype.resume=function(){this._paused=!1},t.prototype.setEasing=function(e){this.easing=e,this.easingFunc=lo(e)?e:iH[e]||f4e(e)},t})(),L5t=(function(){function t(e){this.value=e}return t})(),JZr=(function(){function t(){this._len=0}return t.prototype.insert=function(e){var n=new L5t(e);return this.insertEntry(n),n},t.prototype.insertEntry=function(e){this.head?(this.tail.next=e,e.prev=this.tail,e.next=null,this.tail=e):this.head=this.tail=e,this._len++},t.prototype.remove=function(e){var n=e.prev,r=e.next;n?n.next=r:this.head=r,r?r.prev=n:this.tail=n,e.next=e.prev=null,this._len--},t.prototype.len=function(){return this._len},t.prototype.clear=function(){this.head=this.tail=null,this._len=0},t})(),IF=(function(){function t(e){this._list=new JZr,this._maxSize=10,this._map={},this._maxSize=e}return t.prototype.put=function(e,n){var r=this._list,i=this._map,o=null;if(i[e]==null){var l=r.len(),u=this._lastRemovedEntry;if(l>=this._maxSize&&l>0){var d=r.head;r.remove(d),delete i[d.key],o=d.value,this._lastRemovedEntry=d}u?u.value=n:u=new L5t(n),u.key=e,r.insertEntry(u),i[e]=u}return o},t.prototype.get=function(e){var n=this._map[e],r=this._list;if(n!=null)return n!==r.tail&&(r.remove(n),r.insertEntry(n)),n.value},t.prototype.clear=function(){this._list.clear(),this._map={}},t.prototype.len=function(){return this._list.len()},t})(),M5t={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function P_(t){return t=Math.round(t),t<0?0:t>255?255:t}function eXr(t){return t=Math.round(t),t<0?0:t>360?360:t}function oH(t){return t<0?0:t>1?1:t}function Tce(t){var e=t;return e.length&&e.charAt(e.length-1)==="%"?P_(parseFloat(e)/100*255):P_(parseInt(e,10))}function MT(t){var e=t;return e.length&&e.charAt(e.length-1)==="%"?oH(parseFloat(e)/100):oH(parseFloat(e))}function A4e(t,e,n){return n<0?n+=1:n>1&&(n-=1),n*6<1?t+(e-t)*n*6:n*2<1?e:n*3<2?t+(e-t)*(2/3-n)*6:t}function PT(t,e,n){return t+(e-t)*n}function My(t,e,n,r,i){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t}function b4e(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}var P5t=new IF(20),Bce=null;function TF(t,e){Bce&&b4e(Bce,e),Bce=P5t.put(t,Bce||e.slice())}function WA(t,e){if(t){e=e||[];var n=P5t.get(t);if(n)return b4e(e,n);t=t+"";var r=t.replace(/ /g,"").toLowerCase();if(r in M5t)return b4e(e,M5t[r]),TF(t,e),e;var i=r.length;if(r.charAt(0)==="#"){if(i===4||i===5){var o=parseInt(r.slice(1,4),16);if(!(o>=0&&o<=4095)){My(e,0,0,0,1);return}return My(e,(o&3840)>>4|(o&3840)>>8,o&240|(o&240)>>4,o&15|(o&15)<<4,i===5?parseInt(r.slice(4),16)/15:1),TF(t,e),e}else if(i===7||i===9){var o=parseInt(r.slice(1,7),16);if(!(o>=0&&o<=16777215)){My(e,0,0,0,1);return}return My(e,(o&16711680)>>16,(o&65280)>>8,o&255,i===9?parseInt(r.slice(7),16)/255:1),TF(t,e),e}return}var l=r.indexOf("("),u=r.indexOf(")");if(l!==-1&&u+1===i){var d=r.substr(0,l),p=r.substr(l+1,u-(l+1)).split(","),m=1;switch(d){case"rgba":if(p.length!==4)return p.length===3?My(e,+p[0],+p[1],+p[2],1):My(e,0,0,0,1);m=MT(p.pop());case"rgb":if(p.length>=3)return My(e,Tce(p[0]),Tce(p[1]),Tce(p[2]),p.length===3?m:MT(p[3])),TF(t,e),e;My(e,0,0,0,1);return;case"hsla":if(p.length!==4){My(e,0,0,0,1);return}return p[3]=MT(p[3]),y4e(p,e),TF(t,e),e;case"hsl":if(p.length!==3){My(e,0,0,0,1);return}return y4e(p,e),TF(t,e),e;default:return}}My(e,0,0,0,1)}}function y4e(t,e){var n=(parseFloat(t[0])%360+360)%360/360,r=MT(t[1]),i=MT(t[2]),o=i<=.5?i*(r+1):i+r-i*r,l=i*2-o;return e=e||[],My(e,P_(A4e(l,o,n+1/3)*255),P_(A4e(l,o,n)*255),P_(A4e(l,o,n-1/3)*255),1),t.length===4&&(e[3]=t[3]),e}function tXr(t){if(t){var e=t[0]/255,n=t[1]/255,r=t[2]/255,i=Math.min(e,n,r),o=Math.max(e,n,r),l=o-i,u=(o+i)/2,d,p;if(l===0)d=0,p=0;else{u<.5?p=l/(o+i):p=l/(2-o-i);var m=((o-e)/6+l/2)/l,g=((o-n)/6+l/2)/l,h=((o-r)/6+l/2)/l;e===o?d=h-g:n===o?d=1/3+m-h:r===o&&(d=2/3+g-m),d<0&&(d+=1),d>1&&(d-=1)}var f=[d*360,p,u];return t[3]!=null&&f.push(t[3]),f}}function v4e(t,e){var n=WA(t);if(n){for(var r=0;r<3;r++)e<0?n[r]=n[r]*(1-e)|0:n[r]=(255-n[r])*e+n[r]|0,n[r]>255?n[r]=255:n[r]<0&&(n[r]=0);return fk(n,n.length===4?"rgba":"rgb")}}function nXr(t){var e=WA(t);if(e)return((1<<24)+(e[0]<<16)+(e[1]<<8)+ +e[2]).toString(16).slice(1)}function sH(t,e,n){if(!(!(e&&e.length)||!(t>=0&&t<=1))){n=n||[];var r=t*(e.length-1),i=Math.floor(r),o=Math.ceil(r),l=e[i],u=e[o],d=r-i;return n[0]=P_(PT(l[0],u[0],d)),n[1]=P_(PT(l[1],u[1],d)),n[2]=P_(PT(l[2],u[2],d)),n[3]=oH(PT(l[3],u[3],d)),n}}var rXr=sH;function O5t(t,e,n){if(!(!(e&&e.length)||!(t>=0&&t<=1))){var r=t*(e.length-1),i=Math.floor(r),o=Math.ceil(r),l=WA(e[i]),u=WA(e[o]),d=r-i,p=fk([P_(PT(l[0],u[0],d)),P_(PT(l[1],u[1],d)),P_(PT(l[2],u[2],d)),oH(PT(l[3],u[3],d))],"rgba");return n?{color:p,leftIndex:i,rightIndex:o,value:r}:p}}var aXr=O5t;function _3(t,e,n,r){var i=WA(t);if(t)return i=tXr(i),e!=null&&(i[0]=eXr(lo(e)?e(i[0]):e)),n!=null&&(i[1]=MT(lo(n)?n(i[1]):n)),r!=null&&(i[2]=MT(lo(r)?r(i[2]):r)),fk(y4e(i),"rgba")}function F5t(t,e){var n=WA(t);if(n&&e!=null)return n[3]=oH(e),fk(n,"rgba")}function fk(t,e){if(!(!t||!t.length)){var n=t[0]+","+t[1]+","+t[2];return(e==="rgba"||e==="hsva"||e==="hsla")&&(n+=","+t[3]),e+"("+n+")"}}function lH(t,e){var n=WA(t);return n?(.299*n[0]+.587*n[1]+.114*n[2])*n[3]/255+(1-n[3])*e:0}function iXr(){return fk([Math.round(Math.random()*255),Math.round(Math.random()*255),Math.round(Math.random()*255)],"rgb")}var Q5t=new IF(100);function Dce(t){if(Wa(t)){var e=Q5t.get(t);return e||(e=v4e(t,-.1),Q5t.put(t,e)),e}else if(KG(t)){var n=ta({},t);return n.colorStops=Ga(t.colorStops,function(r){return{offset:r.offset,color:v4e(r.color,-.1)}}),n}return t}const oXr=Object.freeze(Object.defineProperty({__proto__:null,fastLerp:sH,fastMapToColor:rXr,lerp:O5t,lift:v4e,liftColor:Dce,lum:lH,mapToColor:aXr,modifyAlpha:F5t,modifyHSL:_3,parse:WA,parseCssFloat:MT,parseCssInt:Tce,random:iXr,stringify:fk,toHex:nXr},Symbol.toStringTag,{value:"Module"}));var Nce=Math.round;function cH(t){var e;if(!t||t==="transparent")t="none";else if(typeof t=="string"&&t.indexOf("rgba")>-1){var n=WA(t);n&&(t="rgb("+n[0]+","+n[1]+","+n[2]+")",e=n[3])}return{color:t,opacity:e??1}}var $5t=1e-4;function OT(t){return t<$5t&&t>-$5t}function Rce(t){return Nce(t*1e3)/1e3}function _4e(t){return Nce(t*1e4)/1e4}function sXr(t){return"matrix("+Rce(t[0])+","+Rce(t[1])+","+Rce(t[2])+","+Rce(t[3])+","+_4e(t[4])+","+_4e(t[5])+")"}var lXr={left:"start",right:"end",center:"middle",middle:"middle"};function cXr(t,e,n){return n==="top"?t+=e/2:n==="bottom"&&(t-=e/2),t}function uXr(t){return t&&(t.shadowBlur||t.shadowOffsetX||t.shadowOffsetY)}function dXr(t){var e=t.style,n=t.getGlobalScale();return[e.shadowColor,(e.shadowBlur||0).toFixed(2),(e.shadowOffsetX||0).toFixed(2),(e.shadowOffsetY||0).toFixed(2),n[0],n[1]].join(",")}function j5t(t){return t&&!!t.image}function pXr(t){return t&&!!t.svgElement}function w4e(t){return j5t(t)||pXr(t)}function z5t(t){return t.type==="linear"}function U5t(t){return t.type==="radial"}function q5t(t){return t&&(t.type==="linear"||t.type==="radial")}function Lce(t){return"url(#"+t+")"}function G5t(t){var e=t.getGlobalScale(),n=Math.max(e[0],e[1]);return Math.max(Math.ceil(Math.log(n)/Math.log(10)),1)}function H5t(t){var e=t.x||0,n=t.y||0,r=(t.rotation||0)*XG,i=ki(t.scaleX,1),o=ki(t.scaleY,1),l=t.skewX||0,u=t.skewY||0,d=[];return(e||n)&&d.push("translate("+e+"px,"+n+"px)"),r&&d.push("rotate("+r+")"),(i!==1||o!==1)&&d.push("scale("+i+","+o+")"),(l||u)&&d.push("skew("+Nce(l*XG)+"deg, "+Nce(u*XG)+"deg)"),d.join(" ")}var mXr=(function(){return go.hasGlobalWindow&&lo(window.btoa)?function(t){return window.btoa(unescape(encodeURIComponent(t)))}:typeof Buffer<"u"?function(t){return Buffer.from(t).toString("base64")}:function(t){return process.env.NODE_ENV!=="production"&&D_("Base64 isn't natively supported in the current environment."),null}})(),x4e=Array.prototype.slice;function RC(t,e,n){return(e-t)*n+t}function k4e(t,e,n,r){for(var i=e.length,o=0;o<i;o++)t[o]=RC(e[o],n[o],r);return t}function gXr(t,e,n,r){for(var i=e.length,o=i&&e[0].length,l=0;l<i;l++){t[l]||(t[l]=[]);for(var u=0;u<o;u++)t[l][u]=RC(e[l][u],n[l][u],r)}return t}function Mce(t,e,n,r){for(var i=e.length,o=0;o<i;o++)t[o]=e[o]+n[o]*r;return t}function W5t(t,e,n,r){for(var i=e.length,o=i&&e[0].length,l=0;l<i;l++){t[l]||(t[l]=[]);for(var u=0;u<o;u++)t[l][u]=e[l][u]+n[l][u]*r}return t}function hXr(t,e){for(var n=t.length,r=e.length,i=n>r?e:t,o=Math.min(n,r),l=i[o-1]||{color:[0,0,0,0],offset:0},u=o;u<Math.max(n,r);u++)i.push({offset:l.offset,color:l.color.slice()})}function fXr(t,e,n){var r=t,i=e;if(!(!r.push||!i.push)){var o=r.length,l=i.length;if(o!==l){var u=o>l;if(u)r.length=l;else for(var d=o;d<l;d++)r.push(n===1?i[d]:x4e.call(i[d]))}for(var p=r[0]&&r[0].length,d=0;d<r.length;d++)if(n===1)isNaN(r[d])&&(r[d]=i[d]);else for(var m=0;m<p;m++)isNaN(r[d][m])&&(r[d][m]=i[d][m])}}function Pce(t){if(Pf(t)){var e=t.length;if(Pf(t[0])){for(var n=[],r=0;r<e;r++)n.push(x4e.call(t[r]));return n}return x4e.call(t)}return t}function Oce(t){return t[0]=Math.floor(t[0])||0,t[1]=Math.floor(t[1])||0,t[2]=Math.floor(t[2])||0,t[3]=t[3]==null?1:t[3],"rgba("+t.join(",")+")"}function AXr(t){return Pf(t&&t[0])?2:1}var Fce=0,Qce=1,Y5t=2,uH=3,E4e=4,C4e=5,V5t=6;function K5t(t){return t===E4e||t===C4e}function $ce(t){return t===Qce||t===Y5t}var dH=[0,0,0,0],bXr=(function(){function t(e){this.keyframes=[],this.discrete=!1,this._invalid=!1,this._needsSort=!1,this._lastFr=0,this._lastFrP=0,this.propName=e}return t.prototype.isFinished=function(){return this._finished},t.prototype.setFinished=function(){this._finished=!0,this._additiveTrack&&this._additiveTrack.setFinished()},t.prototype.needsAnimate=function(){return this.keyframes.length>=1},t.prototype.getAdditiveTrack=function(){return this._additiveTrack},t.prototype.addKeyframe=function(e,n,r){this._needsSort=!0;var i=this.keyframes,o=i.length,l=!1,u=V5t,d=n;if(Pf(n)){var p=AXr(n);u=p,(p===1&&!Rc(n[0])||p===2&&!Rc(n[0][0]))&&(l=!0)}else if(Rc(n)&&!NC(n))u=Fce;else if(Wa(n))if(!isNaN(+n))u=Fce;else{var m=WA(n);m&&(d=m,u=uH)}else if(KG(n)){var g=ta({},d);g.colorStops=Ga(n.colorStops,function(f){return{offset:f.offset,color:WA(f.color)}}),z5t(n)?u=E4e:U5t(n)&&(u=C4e),d=g}o===0?this.valType=u:(u!==this.valType||u===V5t)&&(l=!0),this.discrete=this.discrete||l;var h={time:e,value:d,rawValue:n,percent:0};return r&&(h.easing=r,h.easingFunc=lo(r)?r:iH[r]||f4e(r)),i.push(h),h},t.prototype.prepare=function(e,n){var r=this.keyframes;this._needsSort&&r.sort(function(y,v){return y.time-v.time});for(var i=this.valType,o=r.length,l=r[o-1],u=this.discrete,d=$ce(i),p=K5t(i),m=0;m<o;m++){var g=r[m],h=g.value,f=l.value;g.percent=g.time/e,u||(d&&m!==o-1?fXr(h,f,i):p&&hXr(h.colorStops,f.colorStops))}if(!u&&i!==C4e&&n&&this.needsAnimate()&&n.needsAnimate()&&i===n.valType&&!n._finished){this._additiveTrack=n;for(var b=r[0].value,m=0;m<o;m++)i===Fce?r[m].additiveValue=r[m].value-b:i===uH?r[m].additiveValue=Mce([],r[m].value,b,-1):$ce(i)&&(r[m].additiveValue=i===Qce?Mce([],r[m].value,b,-1):W5t([],r[m].value,b,-1))}},t.prototype.step=function(e,n){if(!this._finished){this._additiveTrack&&this._additiveTrack._finished&&(this._additiveTrack=null);var r=this._additiveTrack!=null,i=r?"additiveValue":"value",o=this.valType,l=this.keyframes,u=l.length,d=this.propName,p=o===uH,m,g=this._lastFr,h=Math.min,f,b;if(u===1)f=b=l[0];else{if(n<0)m=0;else if(n<this._lastFrP){var y=h(g+1,u-1);for(m=y;m>=0&&!(l[m].percent<=n);m--);m=h(m,u-2)}else{for(m=g;m<u&&!(l[m].percent>n);m++);m=h(m-1,u-2)}b=l[m+1],f=l[m]}if(f&&b){this._lastFr=m,this._lastFrP=n;var v=b.percent-f.percent,_=v===0?1:h((n-f.percent)/v,1);b.easingFunc&&(_=b.easingFunc(_));var w=r?this._additiveValue:p?dH:e[d];if(($ce(o)||p)&&!w&&(w=this._additiveValue=[]),this.discrete)e[d]=_<1?f.rawValue:b.rawValue;else if($ce(o))o===Qce?k4e(w,f[i],b[i],_):gXr(w,f[i],b[i],_);else if(K5t(o)){var x=f[i],k=b[i],C=o===E4e;e[d]={type:C?"linear":"radial",x:RC(x.x,k.x,_),y:RC(x.y,k.y,_),colorStops:Ga(x.colorStops,function(S,I){var B=k.colorStops[I];return{offset:RC(S.offset,B.offset,_),color:Oce(k4e([],S.color,B.color,_))}}),global:k.global},C?(e[d].x2=RC(x.x2,k.x2,_),e[d].y2=RC(x.y2,k.y2,_)):e[d].r=RC(x.r,k.r,_)}else if(p)k4e(w,f[i],b[i],_),r||(e[d]=Oce(w));else{var E=RC(f[i],b[i],_);r?this._additiveValue=E:e[d]=E}r&&this._addToTarget(e)}}},t.prototype._addToTarget=function(e){var n=this.valType,r=this.propName,i=this._additiveValue;n===Fce?e[r]=e[r]+i:n===uH?(WA(e[r],dH),Mce(dH,dH,i,1),e[r]=Oce(dH)):n===Qce?Mce(e[r],e[r],i,1):n===Y5t&&W5t(e[r],e[r],i,1)},t})(),S4e=(function(){function t(e,n,r,i){if(this._tracks={},this._trackKeys=[],this._maxTime=0,this._started=0,this._clip=null,this._target=e,this._loop=n,n&&i){D_("Can' use additive animation on looped animation.");return}this._additiveAnimators=i,this._allowDiscrete=r}return t.prototype.getMaxTime=function(){return this._maxTime},t.prototype.getDelay=function(){return this._delay},t.prototype.getLoop=function(){return this._loop},t.prototype.getTarget=function(){return this._target},t.prototype.changeTarget=function(e){this._target=e},t.prototype.when=function(e,n,r){return this.whenWithKeys(e,n,Xs(n),r)},t.prototype.whenWithKeys=function(e,n,r,i){for(var o=this._tracks,l=0;l<r.length;l++){var u=r[l],d=o[u];if(!d){d=o[u]=new bXr(u);var p=void 0,m=this._getAdditiveTrack(u);if(m){var g=m.keyframes,h=g[g.length-1];p=h&&h.value,m.valType===uH&&p&&(p=Oce(p))}else p=this._target[u];if(p==null)continue;e>0&&d.addKeyframe(0,Pce(p),i),this._trackKeys.push(u)}d.addKeyframe(e,Pce(n[u]),i)}return this._maxTime=Math.max(this._maxTime,e),this},t.prototype.pause=function(){this._clip.pause(),this._paused=!0},t.prototype.resume=function(){this._clip.resume(),this._paused=!1},t.prototype.isPaused=function(){return!!this._paused},t.prototype.duration=function(e){return this._maxTime=e,this._force=!0,this},t.prototype._doneCallback=function(){this._setTracksFinished(),this._clip=null;var e=this._doneCbs;if(e)for(var n=e.length,r=0;r<n;r++)e[r].call(this)},t.prototype._abortedCallback=function(){this._setTracksFinished();var e=this.animation,n=this._abortedCbs;if(e&&e.removeClip(this._clip),this._clip=null,n)for(var r=0;r<n.length;r++)n[r].call(this)},t.prototype._setTracksFinished=function(){for(var e=this._tracks,n=this._trackKeys,r=0;r<n.length;r++)e[n[r]].setFinished()},t.prototype._getAdditiveTrack=function(e){var n,r=this._additiveAnimators;if(r)for(var i=0;i<r.length;i++){var o=r[i].getTrack(e);o&&(n=o)}return n},t.prototype.start=function(e){if(!(this._started>0)){this._started=1;for(var n=this,r=[],i=this._maxTime||0,o=0;o<this._trackKeys.length;o++){var l=this._trackKeys[o],u=this._tracks[l],d=this._getAdditiveTrack(l),p=u.keyframes,m=p.length;if(u.prepare(i,d),u.needsAnimate())if(!this._allowDiscrete&&u.discrete){var g=p[m-1];g&&(n._target[u.propName]=g.rawValue),u.setFinished()}else r.push(u)}if(r.length||this._force){var h=new XZr({life:i,loop:this._loop,delay:this._delay||0,onframe:function(f){n._started=2;var b=n._additiveAnimators;if(b){for(var y=!1,v=0;v<b.length;v++)if(b[v]._clip){y=!0;break}y||(n._additiveAnimators=null)}for(var v=0;v<r.length;v++)r[v].step(n._target,f);var _=n._onframeCbs;if(_)for(var v=0;v<_.length;v++)_[v](n._target,f)},ondestroy:function(){n._doneCallback()}});this._clip=h,this.animation&&this.animation.addClip(h),e&&h.setEasing(e)}else this._doneCallback();return this}},t.prototype.stop=function(e){if(this._clip){var n=this._clip;e&&n.onframe(1),this._abortedCallback()}},t.prototype.delay=function(e){return this._delay=e,this},t.prototype.during=function(e){return e&&(this._onframeCbs||(this._onframeCbs=[]),this._onframeCbs.push(e)),this},t.prototype.done=function(e){return e&&(this._doneCbs||(this._doneCbs=[]),this._doneCbs.push(e)),this},t.prototype.aborted=function(e){return e&&(this._abortedCbs||(this._abortedCbs=[]),this._abortedCbs.push(e)),this},t.prototype.getClip=function(){return this._clip},t.prototype.getTrack=function(e){return this._tracks[e]},t.prototype.getTracks=function(){var e=this;return Ga(this._trackKeys,function(n){return e._tracks[n]})},t.prototype.stopTracks=function(e,n){if(!e.length||!this._clip)return!0;for(var r=this._tracks,i=this._trackKeys,o=0;o<e.length;o++){var l=r[e[o]];l&&!l.isFinished()&&(n?l.step(this._target,1):this._started===1&&l.step(this._target,0),l.setFinished())}for(var u=!0,o=0;o<i.length;o++)if(!r[i[o]].isFinished()){u=!1;break}return u&&this._abortedCallback(),u},t.prototype.saveTo=function(e,n,r){if(e){n=n||this._trackKeys;for(var i=0;i<n.length;i++){var o=n[i],l=this._tracks[o];if(!(!l||l.isFinished())){var u=l.keyframes,d=u[r?0:u.length-1];d&&(e[o]=Pce(d.rawValue))}}}},t.prototype.__changeFinalValue=function(e,n){n=n||Xs(e);for(var r=0;r<n.length;r++){var i=n[r],o=this._tracks[i];if(o){var l=o.keyframes;if(l.length>1){var u=l.pop();o.addKeyframe(u.time,e[i]),o.prepare(this._maxTime,o.getAdditiveTrack())}}}},t})();function BF(){return new Date().getTime()}var yXr=(function(t){oc(e,t);function e(n){var r=t.call(this)||this;return r._running=!1,r._time=0,r._pausedTime=0,r._pauseStart=0,r._paused=!1,n=n||{},r.stage=n.stage||{},r}return e.prototype.addClip=function(n){n.animation&&this.removeClip(n),this._head?(this._tail.next=n,n.prev=this._tail,n.next=null,this._tail=n):this._head=this._tail=n,n.animation=this},e.prototype.addAnimator=function(n){n.animation=this;var r=n.getClip();r&&this.addClip(r)},e.prototype.removeClip=function(n){if(n.animation){var r=n.prev,i=n.next;r?r.next=i:this._head=i,i?i.prev=r:this._tail=r,n.next=n.prev=n.animation=null}},e.prototype.removeAnimator=function(n){var r=n.getClip();r&&this.removeClip(r),n.animation=null},e.prototype.update=function(n){for(var r=BF()-this._pausedTime,i=r-this._time,o=this._head;o;){var l=o.next,u=o.step(r,i);u&&(o.ondestroy(),this.removeClip(o)),o=l}this._time=r,n||(this.trigger("frame",i),this.stage.update&&this.stage.update())},e.prototype._startLoop=function(){var n=this;this._running=!0;function r(){n._running&&(xce(r),!n._paused&&n.update())}xce(r)},e.prototype.start=function(){this._running||(this._time=BF(),this._pausedTime=0,this._startLoop())},e.prototype.stop=function(){this._running=!1},e.prototype.pause=function(){this._paused||(this._pauseStart=BF(),this._paused=!0)},e.prototype.resume=function(){this._paused&&(this._pausedTime+=BF()-this._pauseStart,this._paused=!1)},e.prototype.clear=function(){for(var n=this._head;n;){var r=n.next;n.prev=n.next=n.animation=null,n=r}this._head=this._tail=null},e.prototype.isFinished=function(){return this._head==null},e.prototype.animate=function(n,r){r=r||{},this.start();var i=new S4e(n,r.loop);return this.addAnimator(i),i},e})(gk),vXr=300,I4e=go.domSupported,T4e=(function(){var t=["click","dblclick","mousewheel","wheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],e=["touchstart","touchend","touchmove"],n={pointerdown:1,pointerup:1,pointermove:1,pointerout:1},r=Ga(t,function(i){var o=i.replace("mouse","pointer");return n.hasOwnProperty(o)?o:i});return{mouse:t,touch:e,pointer:r}})(),Z5t={mouse:["mousemove","mouseup"],pointer:["pointermove","pointerup"]},X5t=!1;function B4e(t){var e=t.pointerType;return e==="pen"||e==="touch"}function _Xr(t){t.touching=!0,t.touchTimer!=null&&(clearTimeout(t.touchTimer),t.touchTimer=null),t.touchTimer=setTimeout(function(){t.touching=!1,t.touchTimer=null},700)}function D4e(t){t&&(t.zrByTouch=!0)}function wXr(t,e){return Ry(t.dom,new xXr(t,e),!0)}function J5t(t,e){for(var n=e,r=!1;n&&n.nodeType!==9&&!(r=n.domBelongToZr||n!==e&&n===t.painterRoot);)n=n.parentNode;return r}var xXr=(function(){function t(e,n){this.stopPropagation=xg,this.stopImmediatePropagation=xg,this.preventDefault=xg,this.type=n.type,this.target=this.currentTarget=e.dom,this.pointerType=n.pointerType,this.clientX=n.clientX,this.clientY=n.clientY}return t})(),O_={mousedown:function(t){t=Ry(this.dom,t),this.__mayPointerCapture=[t.zrX,t.zrY],this.trigger("mousedown",t)},mousemove:function(t){t=Ry(this.dom,t);var e=this.__mayPointerCapture;e&&(t.zrX!==e[0]||t.zrY!==e[1])&&this.__togglePointerCapture(!0),this.trigger("mousemove",t)},mouseup:function(t){t=Ry(this.dom,t),this.__togglePointerCapture(!1),this.trigger("mouseup",t)},mouseout:function(t){t=Ry(this.dom,t);var e=t.toElement||t.relatedTarget;J5t(this,e)||(this.__pointerCapturing&&(t.zrEventControl="no_globalout"),this.trigger("mouseout",t))},wheel:function(t){X5t=!0,t=Ry(this.dom,t),this.trigger("mousewheel",t)},mousewheel:function(t){X5t||(t=Ry(this.dom,t),this.trigger("mousewheel",t))},touchstart:function(t){t=Ry(this.dom,t),D4e(t),this.__lastTouchMoment=new Date,this.handler.processGesture(t,"start"),O_.mousemove.call(this,t),O_.mousedown.call(this,t)},touchmove:function(t){t=Ry(this.dom,t),D4e(t),this.handler.processGesture(t,"change"),O_.mousemove.call(this,t)},touchend:function(t){t=Ry(this.dom,t),D4e(t),this.handler.processGesture(t,"end"),O_.mouseup.call(this,t),+new Date-+this.__lastTouchMoment<vXr&&O_.click.call(this,t)},pointerdown:function(t){O_.mousedown.call(this,t)},pointermove:function(t){B4e(t)||O_.mousemove.call(this,t)},pointerup:function(t){O_.mouseup.call(this,t)},pointerout:function(t){B4e(t)||O_.mouseout.call(this,t)}};fn(["click","dblclick","contextmenu"],function(t){O_[t]=function(e){e=Ry(this.dom,e),this.trigger(t,e)}});var N4e={pointermove:function(t){B4e(t)||N4e.mousemove.call(this,t)},pointerup:function(t){N4e.mouseup.call(this,t)},mousemove:function(t){this.trigger("mousemove",t)},mouseup:function(t){var e=this.__pointerCapturing;this.__togglePointerCapture(!1),this.trigger("mouseup",t),e&&(t.zrEventControl="only_globalout",this.trigger("mouseout",t))}};function kXr(t,e){var n=e.domHandlers;go.pointerEventsSupported?fn(T4e.pointer,function(r){jce(e,r,function(i){n[r].call(t,i)})}):(go.touchEventsSupported&&fn(T4e.touch,function(r){jce(e,r,function(i){n[r].call(t,i),_Xr(e)})}),fn(T4e.mouse,function(r){jce(e,r,function(i){i=l4e(i),e.touching||n[r].call(t,i)})}))}function EXr(t,e){go.pointerEventsSupported?fn(Z5t.pointer,n):go.touchEventsSupported||fn(Z5t.mouse,n);function n(r){function i(o){o=l4e(o),J5t(t,o.target)||(o=wXr(t,o),e.domHandlers[r].call(t,o))}jce(e,r,i,{capture:!0})}}function jce(t,e,n,r){t.mounted[e]=n,t.listenerOpts[e]=r,IZr(t.domTarget,e,n,r)}function R4e(t){var e=t.mounted;for(var n in e)e.hasOwnProperty(n)&&TZr(t.domTarget,n,e[n],t.listenerOpts[n]);t.mounted={}}var eOt=(function(){function t(e,n){this.mounted={},this.listenerOpts={},this.touching=!1,this.domTarget=e,this.domHandlers=n}return t})(),CXr=(function(t){oc(e,t);function e(n,r){var i=t.call(this)||this;return i.__pointerCapturing=!1,i.dom=n,i.painterRoot=r,i._localHandlerScope=new eOt(n,O_),I4e&&(i._globalHandlerScope=new eOt(document,N4e)),kXr(i,i._localHandlerScope),i}return e.prototype.dispose=function(){R4e(this._localHandlerScope),I4e&&R4e(this._globalHandlerScope)},e.prototype.setCursor=function(n){this.dom.style&&(this.dom.style.cursor=n||"default")},e.prototype.__togglePointerCapture=function(n){if(this.__mayPointerCapture=null,I4e&&+this.__pointerCapturing^+n){this.__pointerCapturing=n;var r=this._globalHandlerScope;n?EXr(this,r):R4e(r)}},e})(gk),tOt=1;go.hasGlobalWindow&&(tOt=Math.max(window.devicePixelRatio||window.screen&&window.screen.deviceXDPI/window.screen.logicalXDPI||1,1));var zce=tOt,L4e=.4,M4e="#333",P4e="#ccc",SXr="#eee",nOt=JG,rOt=5e-5;function w3(t){return t>rOt||t<-rOt}var x3=[],DF=[],O4e=M_(),F4e=Math.abs,Q4e=(function(){function t(){}return t.prototype.getLocalTransform=function(e){return t.getLocalTransform(this,e)},t.prototype.setPosition=function(e){this.x=e[0],this.y=e[1]},t.prototype.setScale=function(e){this.scaleX=e[0],this.scaleY=e[1]},t.prototype.setSkew=function(e){this.skewX=e[0],this.skewY=e[1]},t.prototype.setOrigin=function(e){this.originX=e[0],this.originY=e[1]},t.prototype.needLocalTransform=function(){return w3(this.rotation)||w3(this.x)||w3(this.y)||w3(this.scaleX-1)||w3(this.scaleY-1)||w3(this.skewX)||w3(this.skewY)},t.prototype.updateTransform=function(){var e=this.parent&&this.parent.transform,n=this.needLocalTransform(),r=this.transform;if(!(n||e)){r&&(nOt(r),this.invTransform=null);return}r=r||M_(),n?this.getLocalTransform(r):nOt(r),e&&(n?h3(r,e,r):yce(r,e)),this.transform=r,this._resolveGlobalScaleRatio(r)},t.prototype._resolveGlobalScaleRatio=function(e){var n=this.globalScaleRatio;if(n!=null&&n!==1){this.getGlobalScale(x3);var r=x3[0]<0?-1:1,i=x3[1]<0?-1:1,o=((x3[0]-r)*n+r)/x3[0]||0,l=((x3[1]-i)*n+i)/x3[1]||0;e[0]*=o,e[1]*=o,e[2]*=l,e[3]*=l}this.invTransform=this.invTransform||M_(),kF(this.invTransform,e)},t.prototype.getComputedTransform=function(){for(var e=this,n=[];e;)n.push(e),e=e.parent;for(;e=n.pop();)e.updateTransform();return this.transform},t.prototype.setLocalTransform=function(e){if(e){var n=e[0]*e[0]+e[1]*e[1],r=e[2]*e[2]+e[3]*e[3],i=Math.atan2(e[1],e[0]),o=Math.PI/2+i-Math.atan2(e[3],e[2]);r=Math.sqrt(r)*Math.cos(o),n=Math.sqrt(n),this.skewX=o,this.skewY=0,this.rotation=-i,this.x=+e[4],this.y=+e[5],this.scaleX=n,this.scaleY=r,this.originX=0,this.originY=0}},t.prototype.decomposeTransform=function(){if(this.transform){var e=this.parent,n=this.transform;e&&e.transform&&(e.invTransform=e.invTransform||M_(),h3(DF,e.invTransform,n),n=DF);var r=this.originX,i=this.originY;(r||i)&&(O4e[4]=r,O4e[5]=i,h3(DF,n,O4e),DF[4]-=r,DF[5]-=i,n=DF),this.setLocalTransform(n)}},t.prototype.getGlobalScale=function(e){var n=this.transform;return e=e||[],n?(e[0]=Math.sqrt(n[0]*n[0]+n[1]*n[1]),e[1]=Math.sqrt(n[2]*n[2]+n[3]*n[3]),n[0]<0&&(e[0]=-e[0]),n[3]<0&&(e[1]=-e[1]),e):(e[0]=1,e[1]=1,e)},t.prototype.transformCoordToLocal=function(e,n){var r=[e,n],i=this.invTransform;return i&&c0(r,r,i),r},t.prototype.transformCoordToGlobal=function(e,n){var r=[e,n],i=this.transform;return i&&c0(r,r,i),r},t.prototype.getLineScale=function(){var e=this.transform;return e&&F4e(e[0]-1)>1e-10&&F4e(e[3]-1)>1e-10?Math.sqrt(F4e(e[0]*e[3]-e[2]*e[1])):1},t.prototype.copyTransform=function(e){Uce(this,e)},t.getLocalTransform=function(e,n){n=n||[];var r=e.originX||0,i=e.originY||0,o=e.scaleX,l=e.scaleY,u=e.anchorX,d=e.anchorY,p=e.rotation||0,m=e.x,g=e.y,h=e.skewX?Math.tan(e.skewX):0,f=e.skewY?Math.tan(-e.skewY):0;if(r||i||u||d){var b=r+u,y=i+d;n[4]=-b*o-h*y*l,n[5]=-y*l-f*b*o}else n[4]=n[5]=0;return n[0]=o,n[3]=l,n[1]=f*o,n[2]=h*l,p&&_ce(n,n,p),n[4]+=r+m,n[5]+=i+g,n},t.initDefaultProps=(function(){var e=t.prototype;e.scaleX=e.scaleY=e.globalScaleRatio=1,e.x=e.y=e.originX=e.originY=e.skewX=e.skewY=e.rotation=e.anchorX=e.anchorY=0})(),t})(),pH=["x","y","originX","originY","anchorX","anchorY","rotation","scaleX","scaleY","skewX","skewY"];function Uce(t,e){for(var n=0;n<pH.length;n++){var r=pH[n];t[r]=e[r]}}function Ak(t){qce||(qce=new IF(100)),t=t||DC;var e=qce.get(t);return e||(e={font:t,strWidthCache:new IF(500),asciiWidthMap:null,asciiWidthMapTried:!1,stWideCharWidth:GA.measureText("国",t).width,asciiCharWidth:GA.measureText("a",t).width},qce.put(t,e)),e}var qce;function IXr(t){if(!($4e>=aOt)){t=t||DC;for(var e=[],n=+new Date,r=0;r<=127;r++)e[r]=GA.measureText(String.fromCharCode(r),t).width;var i=+new Date-n;return i>16?$4e=aOt:i>2&&$4e++,e}}var $4e=0,aOt=5;function iOt(t,e){return t.asciiWidthMapTried||(t.asciiWidthMap=IXr(t.font),t.asciiWidthMapTried=!0),0<=e&&e<=127?t.asciiWidthMap!=null?t.asciiWidthMap[e]:t.asciiCharWidth:t.stWideCharWidth}function bk(t,e){var n=t.strWidthCache,r=n.get(e);return r==null&&(r=GA.measureText(e,t.font).width,n.put(e,r)),r}function oOt(t,e,n,r){var i=bk(Ak(e),t),o=mH(e),l=NF(0,i,n),u=k3(0,o,r),d=new Bo(l,u,i,o);return d}function sOt(t,e,n,r){var i=((t||"")+"").split(`
|
|
686
686
|
`),o=i.length;if(o===1)return oOt(i[0],e,n,r);for(var l=new Bo(0,0,0,0),u=0;u<i.length;u++){var d=oOt(i[u],e,n,r);u===0?l.copy(d):l.union(d)}return l}function NF(t,e,n,r){return n==="right"?r?t+=e:t-=e:n==="center"&&(r?t+=e/2:t-=e/2),t}function k3(t,e,n,r){return n==="middle"?r?t+=e/2:t-=e/2:n==="bottom"&&(r?t+=e:t-=e),t}function mH(t){return Ak(t).stWideCharWidth}function FT(t,e){return typeof t=="string"?t.lastIndexOf("%")>=0?parseFloat(t)/100*e:parseFloat(t):t}function lOt(t,e,n){var r=e.position||"inside",i=e.distance!=null?e.distance:5,o=n.height,l=n.width,u=o/2,d=n.x,p=n.y,m="left",g="top";if(r instanceof Array)d+=FT(r[0],n.width),p+=FT(r[1],n.height),m=null,g=null;else switch(r){case"left":d-=i,p+=u,m="right",g="middle";break;case"right":d+=i+l,p+=u,g="middle";break;case"top":d+=l/2,p-=i,m="center",g="bottom";break;case"bottom":d+=l/2,p+=o+i,m="center";break;case"inside":d+=l/2,p+=u,m="center",g="middle";break;case"insideLeft":d+=i,p+=u,g="middle";break;case"insideRight":d+=l-i,p+=u,m="right",g="middle";break;case"insideTop":d+=l/2,p+=i,m="center";break;case"insideBottom":d+=l/2,p+=o-i,m="center",g="bottom";break;case"insideTopLeft":d+=i,p+=i;break;case"insideTopRight":d+=l-i,p+=i,m="right";break;case"insideBottomLeft":d+=i,p+=o-i,g="bottom";break;case"insideBottomRight":d+=l-i,p+=o-i,m="right",g="bottom";break}return t=t||{},t.x=d,t.y=p,t.align=m,t.verticalAlign=g,t}var j4e="__zr_normal__",z4e=pH.concat(["ignore"]),TXr=mk(pH,function(t,e){return t[e]=!0,t},{ignore:!1}),RF={},BXr=new Bo(0,0,0,0),Gce=[],Hce=(function(){function t(e){this.id=VLe(),this.animators=[],this.currentStates=[],this.states={},this._init(e)}return t.prototype._init=function(e){this.attr(e)},t.prototype.drift=function(e,n,r){switch(this.draggable){case"horizontal":n=0;break;case"vertical":e=0;break}var i=this.transform;i||(i=this.transform=[1,0,0,1,0,0]),i[4]+=e,i[5]+=n,this.decomposeTransform(),this.markRedraw()},t.prototype.beforeUpdate=function(){},t.prototype.afterUpdate=function(){},t.prototype.update=function(){this.updateTransform(),this.__dirty&&this.updateInnerText()},t.prototype.updateInnerText=function(e){var n=this._textContent;if(n&&(!n.ignore||e)){this.textConfig||(this.textConfig={});var r=this.textConfig,i=r.local,o=n.innerTransformable,l=void 0,u=void 0,d=!1;o.parent=i?this:null;var p=!1;o.copyTransform(n);var m=r.position!=null,g=r.autoOverflowArea,h=void 0;if((g||m)&&(h=BXr,r.layoutRect?h.copy(r.layoutRect):h.copy(this.getBoundingRect()),i||h.applyTransform(this.transform)),m){this.calculateTextPosition?this.calculateTextPosition(RF,r,h):lOt(RF,r,h),o.x=RF.x,o.y=RF.y,l=RF.align,u=RF.verticalAlign;var f=r.origin;if(f&&r.rotation!=null){var b=void 0,y=void 0;f==="center"?(b=h.width*.5,y=h.height*.5):(b=FT(f[0],h.width),y=FT(f[1],h.height)),p=!0,o.originX=-o.x+b+(i?0:h.x),o.originY=-o.y+y+(i?0:h.y)}}r.rotation!=null&&(o.rotation=r.rotation);var v=r.offset;v&&(o.x+=v[0],o.y+=v[1],p||(o.originX=-v[0],o.originY=-v[1]));var _=this._innerTextDefaultStyle||(this._innerTextDefaultStyle={});if(g){var w=_.overflowRect=_.overflowRect||new Bo(0,0,0,0);o.getLocalTransform(Gce),kF(Gce,Gce),Bo.copy(w,h),w.applyTransform(Gce)}else _.overflowRect=null;var x=r.inside==null?typeof r.position=="string"&&r.position.indexOf("inside")>=0:r.inside,k=void 0,C=void 0,E=void 0;x&&this.canBeInsideText()?(k=r.insideFill,C=r.insideStroke,(k==null||k==="auto")&&(k=this.getInsideTextFill()),(C==null||C==="auto")&&(C=this.getInsideTextStroke(k),E=!0)):(k=r.outsideFill,C=r.outsideStroke,(k==null||k==="auto")&&(k=this.getOutsideFill()),(C==null||C==="auto")&&(C=this.getOutsideStroke(k),E=!0)),k=k||"#000",(k!==_.fill||C!==_.stroke||E!==_.autoStroke||l!==_.align||u!==_.verticalAlign)&&(d=!0,_.fill=k,_.stroke=C,_.autoStroke=E,_.align=l,_.verticalAlign=u,n.setDefaultTextStyle(_)),n.__dirty|=d0,d&&n.dirtyStyle(!0)}},t.prototype.canBeInsideText=function(){return!0},t.prototype.getInsideTextFill=function(){return"#fff"},t.prototype.getInsideTextStroke=function(e){return"#000"},t.prototype.getOutsideFill=function(){return this.__zr&&this.__zr.isDarkMode()?P4e:M4e},t.prototype.getOutsideStroke=function(e){var n=this.__zr&&this.__zr.getBackgroundColor(),r=typeof n=="string"&&WA(n);r||(r=[255,255,255,1]);for(var i=r[3],o=this.__zr.isDarkMode(),l=0;l<3;l++)r[l]=r[l]*i+(o?0:255)*(1-i);return r[3]=1,fk(r,"rgba")},t.prototype.traverse=function(e,n){},t.prototype.attrKV=function(e,n){e==="textConfig"?this.setTextConfig(n):e==="textContent"?this.setTextContent(n):e==="clipPath"?this.setClipPath(n):e==="extra"?(this.extra=this.extra||{},ta(this.extra,n)):this[e]=n},t.prototype.hide=function(){this.ignore=!0,this.markRedraw()},t.prototype.show=function(){this.ignore=!1,this.markRedraw()},t.prototype.attr=function(e,n){if(typeof e=="string")this.attrKV(e,n);else if(ai(e))for(var r=e,i=Xs(r),o=0;o<i.length;o++){var l=i[o];this.attrKV(l,e[l])}return this.markRedraw(),this},t.prototype.saveCurrentToNormalState=function(e){this._innerSaveToNormal(e);for(var n=this._normalState,r=0;r<this.animators.length;r++){var i=this.animators[r],o=i.__fromStateTransition;if(!(i.getLoop()||o&&o!==j4e)){var l=i.targetName,u=l?n[l]:n;i.saveTo(u)}}},t.prototype._innerSaveToNormal=function(e){var n=this._normalState;n||(n=this._normalState={}),e.textConfig&&!n.textConfig&&(n.textConfig=this.textConfig),this._savePrimaryToNormal(e,n,z4e)},t.prototype._savePrimaryToNormal=function(e,n,r){for(var i=0;i<r.length;i++){var o=r[i];e[o]!=null&&!(o in n)&&(n[o]=this[o])}},t.prototype.hasState=function(){return this.currentStates.length>0},t.prototype.getState=function(e){return this.states[e]},t.prototype.ensureState=function(e){var n=this.states;return n[e]||(n[e]={}),n[e]},t.prototype.clearStates=function(e){this.useState(j4e,!1,e)},t.prototype.useState=function(e,n,r,i){var o=e===j4e,l=this.hasState();if(!(!l&&o)){var u=this.currentStates,d=this.stateTransition;if(!(ic(u,e)>=0&&(n||u.length===1))){var p;if(this.stateProxy&&!o&&(p=this.stateProxy(e)),p||(p=this.states&&this.states[e]),!p&&!o){D_("State "+e+" not exists.");return}o||this.saveCurrentToNormalState(p);var m=!!(p&&p.hoverLayer||i);m&&this._toggleHoverLayerFlag(!0),this._applyStateObj(e,p,this._normalState,n,!r&&!this.__inHover&&d&&d.duration>0,d);var g=this._textContent,h=this._textGuide;return g&&g.useState(e,n,r,m),h&&h.useState(e,n,r,m),o?(this.currentStates=[],this._normalState={}):n?this.currentStates.push(e):this.currentStates=[e],this._updateAnimationTargets(),this.markRedraw(),!m&&this.__inHover&&(this._toggleHoverLayerFlag(!1),this.__dirty&=~d0),p}}},t.prototype.useStates=function(e,n,r){if(!e.length)this.clearStates();else{var i=[],o=this.currentStates,l=e.length,u=l===o.length;if(u){for(var d=0;d<l;d++)if(e[d]!==o[d]){u=!1;break}}if(u)return;for(var d=0;d<l;d++){var p=e[d],m=void 0;this.stateProxy&&(m=this.stateProxy(p,e)),m||(m=this.states[p]),m&&i.push(m)}var g=i[l-1],h=!!(g&&g.hoverLayer||r);h&&this._toggleHoverLayerFlag(!0);var f=this._mergeStates(i),b=this.stateTransition;this.saveCurrentToNormalState(f),this._applyStateObj(e.join(","),f,this._normalState,!1,!n&&!this.__inHover&&b&&b.duration>0,b);var y=this._textContent,v=this._textGuide;y&&y.useStates(e,n,h),v&&v.useStates(e,n,h),this._updateAnimationTargets(),this.currentStates=e.slice(),this.markRedraw(),!h&&this.__inHover&&(this._toggleHoverLayerFlag(!1),this.__dirty&=~d0)}},t.prototype.isSilent=function(){for(var e=this;e;){if(e.silent)return!0;var n=e.__hostTarget;e=n?e.ignoreHostSilent?null:n:e.parent}return!1},t.prototype._updateAnimationTargets=function(){for(var e=0;e<this.animators.length;e++){var n=this.animators[e];n.targetName&&n.changeTarget(this[n.targetName])}},t.prototype.removeState=function(e){var n=ic(this.currentStates,e);if(n>=0){var r=this.currentStates.slice();r.splice(n,1),this.useStates(r)}},t.prototype.replaceState=function(e,n,r){var i=this.currentStates.slice(),o=ic(i,e),l=ic(i,n)>=0;o>=0?l?i.splice(o,1):i[o]=n:r&&!l&&i.push(n),this.useStates(i)},t.prototype.toggleState=function(e,n){n?this.useState(e,!0):this.removeState(e)},t.prototype._mergeStates=function(e){for(var n={},r,i=0;i<e.length;i++){var o=e[i];ta(n,o),o.textConfig&&(r=r||{},ta(r,o.textConfig))}return r&&(n.textConfig=r),n},t.prototype._applyStateObj=function(e,n,r,i,o,l){var u=!(n&&i);n&&n.textConfig?(this.textConfig=ta({},i?this.textConfig:r.textConfig),ta(this.textConfig,n.textConfig)):u&&r.textConfig&&(this.textConfig=r.textConfig);for(var d={},p=!1,m=0;m<z4e.length;m++){var g=z4e[m],h=o&&TXr[g];n&&n[g]!=null?h?(p=!0,d[g]=n[g]):this[g]=n[g]:u&&r[g]!=null&&(h?(p=!0,d[g]=r[g]):this[g]=r[g])}if(!o)for(var m=0;m<this.animators.length;m++){var f=this.animators[m],b=f.targetName;f.getLoop()||f.__changeFinalValue(b?(n||r)[b]:n||r)}p&&this._transitionState(e,d,l)},t.prototype._attachComponent=function(e){if(e.__zr&&!e.__hostTarget){if(process.env.NODE_ENV!=="production")throw new Error("Text element has been added to zrender.");return}if(e===this){if(process.env.NODE_ENV!=="production")throw new Error("Recursive component attachment.");return}var n=this.__zr;n&&e.addSelfToZr(n),e.__zr=n,e.__hostTarget=this},t.prototype._detachComponent=function(e){e.__zr&&e.removeSelfFromZr(e.__zr),e.__zr=null,e.__hostTarget=null},t.prototype.getClipPath=function(){return this._clipPath},t.prototype.setClipPath=function(e){this._clipPath&&this._clipPath!==e&&this.removeClipPath(),this._attachComponent(e),this._clipPath=e,this.markRedraw()},t.prototype.removeClipPath=function(){var e=this._clipPath;e&&(this._detachComponent(e),this._clipPath=null,this.markRedraw())},t.prototype.getTextContent=function(){return this._textContent},t.prototype.setTextContent=function(e){var n=this._textContent;if(n!==e){if(n&&n!==e&&this.removeTextContent(),process.env.NODE_ENV!=="production"&&e.__zr&&!e.__hostTarget)throw new Error("Text element has been added to zrender.");e.innerTransformable=new Q4e,this._attachComponent(e),this._textContent=e,this.markRedraw()}},t.prototype.setTextConfig=function(e){this.textConfig||(this.textConfig={}),ta(this.textConfig,e),this.markRedraw()},t.prototype.removeTextConfig=function(){this.textConfig=null,this.markRedraw()},t.prototype.removeTextContent=function(){var e=this._textContent;e&&(e.innerTransformable=null,this._detachComponent(e),this._textContent=null,this._innerTextDefaultStyle=null,this.markRedraw())},t.prototype.getTextGuideLine=function(){return this._textGuide},t.prototype.setTextGuideLine=function(e){this._textGuide&&this._textGuide!==e&&this.removeTextGuideLine(),this._attachComponent(e),this._textGuide=e,this.markRedraw()},t.prototype.removeTextGuideLine=function(){var e=this._textGuide;e&&(this._detachComponent(e),this._textGuide=null,this.markRedraw())},t.prototype.markRedraw=function(){this.__dirty|=d0;var e=this.__zr;e&&(this.__inHover?e.refreshHover():e.refresh()),this.__hostTarget&&this.__hostTarget.markRedraw()},t.prototype.dirty=function(){this.markRedraw()},t.prototype._toggleHoverLayerFlag=function(e){this.__inHover=e;var n=this._textContent,r=this._textGuide;n&&(n.__inHover=e),r&&(r.__inHover=e)},t.prototype.addSelfToZr=function(e){if(this.__zr!==e){this.__zr=e;var n=this.animators;if(n)for(var r=0;r<n.length;r++)e.animation.addAnimator(n[r]);this._clipPath&&this._clipPath.addSelfToZr(e),this._textContent&&this._textContent.addSelfToZr(e),this._textGuide&&this._textGuide.addSelfToZr(e)}},t.prototype.removeSelfFromZr=function(e){if(this.__zr){this.__zr=null;var n=this.animators;if(n)for(var r=0;r<n.length;r++)e.animation.removeAnimator(n[r]);this._clipPath&&this._clipPath.removeSelfFromZr(e),this._textContent&&this._textContent.removeSelfFromZr(e),this._textGuide&&this._textGuide.removeSelfFromZr(e)}},t.prototype.animate=function(e,n,r){var i=e?this[e]:this;if(process.env.NODE_ENV!=="production"&&!i){D_('Property "'+e+'" is not existed in element '+this.id);return}var o=new S4e(i,n,r);return e&&(o.targetName=e),this.addAnimator(o,e),o},t.prototype.addAnimator=function(e,n){var r=this.__zr,i=this;e.during(function(){i.updateDuringAnimation(n)}).done(function(){var o=i.animators,l=ic(o,e);l>=0&&o.splice(l,1)}),this.animators.push(e),r&&r.animation.addAnimator(e),r&&r.wakeUp()},t.prototype.updateDuringAnimation=function(e){this.markRedraw()},t.prototype.stopAnimation=function(e,n){for(var r=this.animators,i=r.length,o=[],l=0;l<i;l++){var u=r[l];!e||e===u.scope?u.stop(n):o.push(u)}return this.animators=o,this},t.prototype.animateTo=function(e,n,r){U4e(this,e,n,r)},t.prototype.animateFrom=function(e,n,r){U4e(this,e,n,r,!0)},t.prototype._transitionState=function(e,n,r,i){for(var o=U4e(this,n,r,i),l=0;l<o.length;l++)o[l].__fromStateTransition=e},t.prototype.getBoundingRect=function(){return null},t.prototype.getPaintRect=function(){return null},t.initDefaultProps=(function(){var e=t.prototype;e.type="element",e.name="",e.ignore=e.silent=e.ignoreHostSilent=e.isGroup=e.draggable=e.dragging=e.ignoreClip=e.__inHover=!1,e.__dirty=d0;var n={};function r(o,l,u){n[o+l+u]||(console.warn("DEPRECATED: '"+o+"' has been deprecated. use '"+l+"', '"+u+"' instead"),n[o+l+u]=!0)}function i(o,l,u,d){Object.defineProperty(e,o,{get:function(){if(process.env.NODE_ENV!=="production"&&r(o,u,d),!this[l]){var m=this[l]=[];p(this,m)}return this[l]},set:function(m){process.env.NODE_ENV!=="production"&&r(o,u,d),this[u]=m[0],this[d]=m[1],this[l]=m,p(this,m)}});function p(m,g){Object.defineProperty(g,0,{get:function(){return m[u]},set:function(h){m[u]=h}}),Object.defineProperty(g,1,{get:function(){return m[d]},set:function(h){m[d]=h}})}}Object.defineProperty&&(i("position","_legacyPos","x","y"),i("scale","_legacyScale","scaleX","scaleY"),i("origin","_legacyOrigin","originX","originY"))})(),t})();N_(Hce,gk),N_(Hce,Q4e);function U4e(t,e,n,r,i){n=n||{};var o=[];cOt(t,"",t,e,n,r,o,i);var l=o.length,u=!1,d=n.done,p=n.aborted,m=function(){u=!0,l--,l<=0&&(u?d&&d():p&&p())},g=function(){l--,l<=0&&(u?d&&d():p&&p())};l||d&&d(),o.length>0&&n.during&&o[0].during(function(b,y){n.during(y)});for(var h=0;h<o.length;h++){var f=o[h];m&&f.done(m),g&&f.aborted(g),n.force&&f.duration(n.duration),f.start(n.easing)}return o}function q4e(t,e,n){for(var r=0;r<n;r++)t[r]=e[r]}function DXr(t){return Pf(t[0])}function NXr(t,e,n){if(Pf(e[n]))if(Pf(t[n])||(t[n]=[]),Bh(e[n])){var r=e[n].length;t[n].length!==r&&(t[n]=new e[n].constructor(r),q4e(t[n],e[n],r))}else{var i=e[n],o=t[n],l=i.length;if(DXr(i))for(var u=i[0].length,d=0;d<l;d++)o[d]?q4e(o[d],i[d],u):o[d]=Array.prototype.slice.call(i[d]);else q4e(o,i,l);o.length=i.length}else t[n]=e[n]}function RXr(t,e){return t===e||Pf(t)&&Pf(e)&&LXr(t,e)}function LXr(t,e){var n=t.length;if(n!==e.length)return!1;for(var r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}function cOt(t,e,n,r,i,o,l,u){for(var d=Xs(r),p=i.duration,m=i.delay,g=i.additive,h=i.setToFinal,f=!ai(o),b=t.animators,y=[],v=0;v<d.length;v++){var _=d[v],w=r[_];if(w!=null&&n[_]!=null&&(f||o[_]))if(ai(w)&&!Pf(w)&&!KG(w)){if(e){u||(n[_]=w,t.updateDuringAnimation(e));continue}cOt(t,_,n[_],w,i,o&&o[_],l,u)}else y.push(_);else u||(n[_]=w,t.updateDuringAnimation(e),y.push(_))}var x=y.length;if(!g&&x)for(var k=0;k<b.length;k++){var C=b[k];if(C.targetName===e){var E=C.stopTracks(y);if(E){var S=ic(b,C);b.splice(S,1)}}}if(i.force||(y=fp(y,function(L){return!RXr(r[L],n[L])}),x=y.length),x>0||i.force&&!l.length){var I=void 0,B=void 0,R=void 0;if(u){B={},h&&(I={});for(var k=0;k<x;k++){var _=y[k];B[_]=n[_],h?I[_]=r[_]:n[_]=r[_]}}else if(h){R={};for(var k=0;k<x;k++){var _=y[k];R[_]=Pce(n[_]),NXr(n,r,_)}}var C=new S4e(n,!1,!1,g?fp(b,function(M){return M.targetName===e}):null);C.targetName=e,i.scope&&(C.scope=i.scope),h&&I&&C.whenWithKeys(0,I,y),R&&C.whenWithKeys(0,R,y),C.whenWithKeys(p??500,u?B:r,y).delay(m||0),t.addAnimator(C,e),l.push(C)}}var p0=(function(t){oc(e,t);function e(n){var r=t.call(this)||this;return r.isGroup=!0,r._children=[],r.attr(n),r}return e.prototype.childrenRef=function(){return this._children},e.prototype.children=function(){return this._children.slice()},e.prototype.childAt=function(n){return this._children[n]},e.prototype.childOfName=function(n){for(var r=this._children,i=0;i<r.length;i++)if(r[i].name===n)return r[i]},e.prototype.childCount=function(){return this._children.length},e.prototype.add=function(n){if(n&&(n!==this&&n.parent!==this&&(this._children.push(n),this._doAdd(n)),process.env.NODE_ENV!=="production"&&n.__hostTarget))throw"This elemenet has been used as an attachment";return this},e.prototype.addBefore=function(n,r){if(n&&n!==this&&n.parent!==this&&r&&r.parent===this){var i=this._children,o=i.indexOf(r);o>=0&&(i.splice(o,0,n),this._doAdd(n))}return this},e.prototype.replace=function(n,r){var i=ic(this._children,n);return i>=0&&this.replaceAt(r,i),this},e.prototype.replaceAt=function(n,r){var i=this._children,o=i[r];if(n&&n!==this&&n.parent!==this&&n!==o){i[r]=n,o.parent=null;var l=this.__zr;l&&o.removeSelfFromZr(l),this._doAdd(n)}return this},e.prototype._doAdd=function(n){n.parent&&n.parent.remove(n),n.parent=this;var r=this.__zr;r&&r!==n.__zr&&n.addSelfToZr(r),r&&r.refresh()},e.prototype.remove=function(n){var r=this.__zr,i=this._children,o=ic(i,n);return o<0?this:(i.splice(o,1),n.parent=null,r&&n.removeSelfFromZr(r),r&&r.refresh(),this)},e.prototype.removeAll=function(){for(var n=this._children,r=this.__zr,i=0;i<n.length;i++){var o=n[i];r&&o.removeSelfFromZr(r),o.parent=null}return n.length=0,this},e.prototype.eachChild=function(n,r){for(var i=this._children,o=0;o<i.length;o++){var l=i[o];n.call(r,l,o)}return this},e.prototype.traverse=function(n,r){for(var i=0;i<this._children.length;i++){var o=this._children[i],l=n.call(r,o);o.isGroup&&!l&&o.traverse(n,r)}return this},e.prototype.addSelfToZr=function(n){t.prototype.addSelfToZr.call(this,n);for(var r=0;r<this._children.length;r++){var i=this._children[r];i.addSelfToZr(n)}},e.prototype.removeSelfFromZr=function(n){t.prototype.removeSelfFromZr.call(this,n);for(var r=0;r<this._children.length;r++){var i=this._children[r];i.removeSelfFromZr(n)}},e.prototype.getBoundingRect=function(n){for(var r=new Bo(0,0,0,0),i=n||this._children,o=[],l=null,u=0;u<i.length;u++){var d=i[u];if(!(d.ignore||d.invisible)){var p=d.getBoundingRect(),m=d.getLocalTransform(o);m?(Bo.applyTransform(r,p,m),l=l||r.clone(),l.union(r)):(l=l||p.clone(),l.union(p))}}return l||r},e})(Hce);p0.prototype.type="group";var gH={},E3={};function MXr(t){delete E3[t]}function PXr(t){if(!t)return!1;if(typeof t=="string")return lH(t,1)<L4e;if(t.colorStops){for(var e=t.colorStops,n=0,r=e.length,i=0;i<r;i++)n+=lH(e[i].color,1);return n/=r,n<L4e}return!1}var OXr=(function(){function t(e,n,r){var i=this;this._sleepAfterStill=10,this._stillFrameAccum=0,this._needsRefresh=!0,this._needsRefreshHover=!0,this._darkMode=!1,r=r||{},this.dom=n,this.id=e;var o=new GZr,l=r.renderer||"canvas";if(gH[l]||(l=Xs(gH)[0]),process.env.NODE_ENV!=="production"&&!gH[l])throw new Error("Renderer '"+l+"' is not imported. Please import it first.");r.useDirtyRect=r.useDirtyRect==null?!1:r.useDirtyRect;var u=new gH[l](n,o,r,e),d=r.ssr||u.ssrOnly;this.storage=o,this.painter=u;var p=!go.node&&!go.worker&&!d?new CXr(u.getViewportRoot(),u.root):null,m=r.useCoarsePointer,g=m==null||m==="auto"?go.touchEventsSupported:!!m,h=44,f;g&&(f=ki(r.pointerSize,h)),this.handler=new b5t(o,u,p,u.root,f),this.animation=new yXr({stage:{update:d?null:function(){return i._flush(!0)}}}),d||this.animation.start()}return t.prototype.add=function(e){this._disposed||!e||(this.storage.addRoot(e),e.addSelfToZr(this),this.refresh())},t.prototype.remove=function(e){this._disposed||!e||(this.storage.delRoot(e),e.removeSelfFromZr(this),this.refresh())},t.prototype.configLayer=function(e,n){this._disposed||(this.painter.configLayer&&this.painter.configLayer(e,n),this.refresh())},t.prototype.setBackgroundColor=function(e){this._disposed||(this.painter.setBackgroundColor&&this.painter.setBackgroundColor(e),this.refresh(),this._backgroundColor=e,this._darkMode=PXr(e))},t.prototype.getBackgroundColor=function(){return this._backgroundColor},t.prototype.setDarkMode=function(e){this._darkMode=e},t.prototype.isDarkMode=function(){return this._darkMode},t.prototype.refreshImmediately=function(e){this._disposed||(e||this.animation.update(!0),this._needsRefresh=!1,this.painter.refresh(),this._needsRefresh=!1)},t.prototype.refresh=function(){this._disposed||(this._needsRefresh=!0,this.animation.start())},t.prototype.flush=function(){this._disposed||this._flush(!1)},t.prototype._flush=function(e){var n,r=BF();this._needsRefresh&&(n=!0,this.refreshImmediately(e)),this._needsRefreshHover&&(n=!0,this.refreshHoverImmediately());var i=BF();n?(this._stillFrameAccum=0,this.trigger("rendered",{elapsedTime:i-r})):this._sleepAfterStill>0&&(this._stillFrameAccum++,this._stillFrameAccum>this._sleepAfterStill&&this.animation.stop())},t.prototype.setSleepAfterStill=function(e){this._sleepAfterStill=e},t.prototype.wakeUp=function(){this._disposed||(this.animation.start(),this._stillFrameAccum=0)},t.prototype.refreshHover=function(){this._needsRefreshHover=!0},t.prototype.refreshHoverImmediately=function(){this._disposed||(this._needsRefreshHover=!1,this.painter.refreshHover&&this.painter.getType()==="canvas"&&this.painter.refreshHover())},t.prototype.resize=function(e){this._disposed||(e=e||{},this.painter.resize(e.width,e.height),this.handler.resize())},t.prototype.clearAnimation=function(){this._disposed||this.animation.clear()},t.prototype.getWidth=function(){if(!this._disposed)return this.painter.getWidth()},t.prototype.getHeight=function(){if(!this._disposed)return this.painter.getHeight()},t.prototype.setCursorStyle=function(e){this._disposed||this.handler.setCursorStyle(e)},t.prototype.findHover=function(e,n){if(!this._disposed)return this.handler.findHover(e,n)},t.prototype.on=function(e,n,r){return this._disposed||this.handler.on(e,n,r),this},t.prototype.off=function(e,n){this._disposed||this.handler.off(e,n)},t.prototype.trigger=function(e,n){this._disposed||this.handler.trigger(e,n)},t.prototype.clear=function(){if(!this._disposed){for(var e=this.storage.getRoots(),n=0;n<e.length;n++)e[n]instanceof p0&&e[n].removeSelfFromZr(this);this.storage.delAllRoots(),this.painter.clear()}},t.prototype.dispose=function(){this._disposed||(this.animation.stop(),this.clear(),this.storage.dispose(),this.painter.dispose(),this.handler.dispose(),this.animation=this.storage=this.painter=this.handler=null,this._disposed=!0,MXr(this.id))},t})();function G4e(t,e){var n=new OXr(VLe(),t,e);return E3[n.id]=n,n}function FXr(t){t.dispose()}function QXr(){for(var t in E3)E3.hasOwnProperty(t)&&E3[t].dispose();E3={}}function $Xr(t){return E3[t]}function uOt(t,e){gH[t]=e}var H4e;function dOt(t){if(typeof H4e=="function")return H4e(t)}function pOt(t){H4e=t}var jXr="6.0.0";const zXr=Object.freeze(Object.defineProperty({__proto__:null,dispose:FXr,disposeAll:QXr,getElementSSRData:dOt,getInstance:$Xr,init:G4e,registerPainter:uOt,registerSSRDataGetter:pOt,version:jXr},Symbol.toStringTag,{value:"Module"}));var mOt=1e-4,gOt=20;function UXr(t){return t.replace(/^\s+|\s+$/g,"")}var hH=Math.min,F_=Math.max,yk=Math.abs;function vk(t,e,n,r){var i=e[0],o=e[1],l=n[0],u=n[1],d=o-i,p=u-l;if(d===0)return p===0?l:(l+u)/2;if(r)if(d>0){if(t<=i)return l;if(t>=o)return u}else{if(t>=i)return l;if(t<=o)return u}else{if(t===i)return l;if(t===o)return u}return(t-i)/d*p+l}var Lc=qXr;function qXr(t,e,n){switch(t){case"center":case"middle":t="50%";break;case"left":case"top":t="0%";break;case"right":case"bottom":t="100%";break}return GXr(t,e,n)}function GXr(t,e,n){return Wa(t)?UXr(t).match(/%$/)?parseFloat(t)/100*e+(n||0):parseFloat(t):t==null?NaN:+t}function QT(t,e,n){return e==null&&(e=10),e=Math.min(Math.max(0,e),gOt),t=(+t).toFixed(e),n?t:+t}function hOt(t){return t.sort(function(e,n){return e-n}),t}function LF(t){if(t=+t,isNaN(t))return 0;if(t>1e-14){for(var e=1,n=0;n<15;n++,e*=10)if(Math.round(t*e)/e===t)return n}return fOt(t)}function fOt(t){var e=t.toString().toLowerCase(),n=e.indexOf("e"),r=n>0?+e.slice(n+1):0,i=n>0?n:e.length,o=e.indexOf("."),l=o<0?0:i-1-o;return Math.max(0,l-r)}function AOt(t,e){var n=Math.log,r=Math.LN10,i=Math.floor(n(t[1]-t[0])/r),o=Math.round(n(yk(e[1]-e[0]))/r),l=Math.min(Math.max(-i+o,0),20);return isFinite(l)?l:20}function HXr(t,e,n){if(!t[e])return 0;var r=bOt(t,n);return r[e]||0}function bOt(t,e){var n=mk(t,function(f,b){return f+(isNaN(b)?0:b)},0);if(n===0)return[];for(var r=Math.pow(10,e),i=Ga(t,function(f){return(isNaN(f)?0:f)/n*r*100}),o=r*100,l=Ga(i,function(f){return Math.floor(f)}),u=mk(l,function(f,b){return f+b},0),d=Ga(i,function(f,b){return f-l[b]});u<o;){for(var p=Number.NEGATIVE_INFINITY,m=null,g=0,h=d.length;g<h;++g)d[g]>p&&(p=d[g],m=g);++l[m],d[m]=0,++u}return Ga(l,function(f){return f/r})}function WXr(t,e){var n=Math.max(LF(t),LF(e)),r=t+e;return n>gOt?r:QT(r,n)}var YXr=9007199254740991;function W4e(t){var e=Math.PI*2;return(t%e+e)%e}function fH(t){return t>-mOt&&t<mOt}var VXr=/^(?:(\d{4})(?:[-\/](\d{1,2})(?:[-\/](\d{1,2})(?:[T ](\d{1,2})(?::(\d{1,2})(?::(\d{1,2})(?:[.,](\d+))?)?)?(Z|[\+\-]\d\d:?\d\d)?)?)?)?)?$/;function _k(t){if(t instanceof Date)return t;if(Wa(t)){var e=VXr.exec(t);if(!e)return new Date(NaN);if(e[8]){var n=+e[4]||0;return e[8].toUpperCase()!=="Z"&&(n-=+e[8].slice(0,3)),new Date(Date.UTC(+e[1],+(e[2]||1)-1,+e[3]||1,n,+(e[5]||0),+e[6]||0,e[7]?+e[7].substring(0,3):0))}else return new Date(+e[1],+(e[2]||1)-1,+e[3]||1,+e[4]||0,+(e[5]||0),+e[6]||0,e[7]?+e[7].substring(0,3):0)}else if(t==null)return new Date(NaN);return new Date(Math.round(t))}function yOt(t){return Math.pow(10,Y4e(t))}function Y4e(t){if(t===0)return 0;var e=Math.floor(Math.log(t)/Math.LN10);return t/Math.pow(10,e)>=10&&e++,e}function V4e(t,e){var n=Y4e(t),r=Math.pow(10,n),i=t/r,o;return e?i<1.5?o=1:i<2.5?o=2:i<4?o=3:i<7?o=5:o=10:i<1?o=1:i<2?o=2:i<3?o=3:i<5?o=5:o=10,t=o*r,n>=-20?+t.toFixed(n<0?-n:0):t}function KXr(t,e){var n=(t.length-1)*e+1,r=Math.floor(n),i=+t[r-1],o=n-r;return o?i+o*(t[r]-i):i}function K4e(t){t.sort(function(d,p){return u(d,p,0)?-1:1});for(var e=-1/0,n=1,r=0;r<t.length;){for(var i=t[r].interval,o=t[r].close,l=0;l<2;l++)i[l]<=e&&(i[l]=e,o[l]=l?1:1-n),e=i[l],n=o[l];i[0]===i[1]&&o[0]*o[1]!==1?t.splice(r,1):r++}return t;function u(d,p,m){return d.interval[m]<p.interval[m]||d.interval[m]===p.interval[m]&&(d.close[m]-p.close[m]===(m?-1:1)||!m&&u(d,p,1))}}function AH(t){var e=parseFloat(t);return e==t&&(e!==0||!Wa(t)||t.indexOf("x")<=0)?e:NaN}function Z4e(t){return!isNaN(AH(t))}function vOt(){return Math.round(Math.random()*9)}function _Ot(t,e){return e===0?t:_Ot(e,t%e)}function wOt(t,e){return t==null?e:e==null?t:t*e/_Ot(t,e)}var ZXr="[ECharts] ",xOt={},XXr=typeof console<"u"&&console.warn&&console.log;function Wce(t,e,n){if(XXr){if(n){if(xOt[e])return;xOt[e]=!0}console[t](ZXr+e)}}function JXr(t,e){Wce("log",t,e)}function m0(t,e){Wce("warn",t,e)}function wc(t,e){Wce("error",t,e)}function wk(t){process.env.NODE_ENV!=="production"&&Wce("warn","DEPRECATED: "+t,!0)}function Ap(t,e,n){process.env.NODE_ENV!=="production"&&wk((n?"["+n+"]":"")+(t+" is deprecated; use "+e+" instead."))}function Yce(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n="";if(process.env.NODE_ENV!=="production"){var r=function(i){return i===void 0?"undefined":i===1/0?"Infinity":i===-1/0?"-Infinity":NC(i)?"NaN":i instanceof Date?"Date("+i.toISOString()+")":lo(i)?"function () { ... }":JPt(i)?i+"":null};n=Ga(t,function(i){if(Wa(i))return i;var o=r(i);if(o!=null)return o;if(typeof JSON<"u"&&JSON.stringify)try{return JSON.stringify(i,function(l,u){var d=r(u);return d??u})}catch{return"?"}else return"?"}).join(" ")}return n}function YA(t){throw new Error(t)}var kOt="series\0",eJr="\0_ec_\0";function Ff(t){return t instanceof Array?t:t==null?[]:[t]}function X4e(t,e,n){if(t){t[e]=t[e]||{},t.emphasis=t.emphasis||{},t.emphasis[e]=t.emphasis[e]||{};for(var r=0,i=n.length;r<i;r++){var o=n[r];!t.emphasis[e].hasOwnProperty(o)&&t[e].hasOwnProperty(o)&&(t.emphasis[e][o]=t[e][o])}}}var EOt=["fontStyle","fontWeight","fontSize","fontFamily","rich","tag","color","textBorderColor","textBorderWidth","width","height","lineHeight","align","verticalAlign","baseline","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","textShadowColor","textShadowBlur","textShadowOffsetX","textShadowOffsetY","backgroundColor","borderColor","borderWidth","borderRadius","padding"];function bH(t){return ai(t)&&!fa(t)&&!(t instanceof Date)?t.value:t}function tJr(t){return ai(t)&&!(t instanceof Array)}function nJr(t,e,n){var r=n==="normalMerge",i=n==="replaceMerge",o=n==="replaceAll";t=t||[],e=(e||[]).slice();var l=ss();fn(e,function(d,p){if(!ai(d)){e[p]=null;return}process.env.NODE_ENV!=="production"&&(d.id!=null&&!IOt(d.id)&&SOt(d.id),d.name!=null&&!IOt(d.name)&&SOt(d.name))});var u=rJr(t,l,n);return(r||i)&&aJr(u,t,l,e),r&&iJr(u,e),r||i?oJr(u,e,i):o&&sJr(u,e),lJr(u),u}function rJr(t,e,n){var r=[];if(n==="replaceAll")return r;for(var i=0;i<t.length;i++){var o=t[i];o&&o.id!=null&&e.set(o.id,i),r.push({existing:n==="replaceMerge"||MF(o)?null:o,newOption:null,keyInfo:null,brandNew:null})}return r}function aJr(t,e,n,r){fn(r,function(i,o){if(!(!i||i.id==null)){var l=yH(i.id),u=n.get(l);if(u!=null){var d=t[u];Di(!d.newOption,'Duplicated option on id "'+l+'".'),d.newOption=i,d.existing=e[u],r[o]=null}}})}function iJr(t,e){fn(e,function(n,r){if(!(!n||n.name==null))for(var i=0;i<t.length;i++){var o=t[i].existing;if(!t[i].newOption&&o&&(o.id==null||n.id==null)&&!MF(n)&&!MF(o)&&COt("name",o,n)){t[i].newOption=n,e[r]=null;return}}})}function oJr(t,e,n){fn(e,function(r){if(r){for(var i,o=0;(i=t[o])&&(i.newOption||MF(i.existing)||i.existing&&r.id!=null&&!COt("id",r,i.existing));)o++;i?(i.newOption=r,i.brandNew=n):t.push({newOption:r,brandNew:n,existing:null,keyInfo:null}),o++}})}function sJr(t,e){fn(e,function(n){t.push({newOption:n,brandNew:!0,existing:null,keyInfo:null})})}function lJr(t){var e=ss();fn(t,function(n){var r=n.existing;r&&e.set(r.id,n)}),fn(t,function(n){var r=n.newOption;Di(!r||r.id==null||!e.get(r.id)||e.get(r.id)===n,"id duplicates: "+(r&&r.id)),r&&r.id!=null&&e.set(r.id,n),!n.keyInfo&&(n.keyInfo={})}),fn(t,function(n,r){var i=n.existing,o=n.newOption,l=n.keyInfo;if(ai(o)){if(l.name=o.name!=null?yH(o.name):i?i.name:kOt+r,i)l.id=yH(i.id);else if(o.id!=null)l.id=yH(o.id);else{var u=0;do l.id="\0"+l.name+"\0"+u++;while(e.get(l.id))}e.set(l.id,n)}})}function COt(t,e,n){var r=xk(e[t],null),i=xk(n[t],null);return r!=null&&i!=null&&r===i}function yH(t){if(process.env.NODE_ENV!=="production"&&t==null)throw new Error;return xk(t,"")}function xk(t,e){return t==null?e:Wa(t)?t:Rc(t)||VG(t)?t+"":e}function SOt(t){process.env.NODE_ENV!=="production"&&m0("`"+t+"` is invalid id or name. Must be a string or number.")}function IOt(t){return VG(t)||Z4e(t)}function TOt(t){var e=t.name;return!!(e&&e.indexOf(kOt))}function MF(t){return t&&t.id!=null&&yH(t.id).indexOf(eJr)===0}function cJr(t,e,n){fn(t,function(r){var i=r.newOption;ai(i)&&(r.keyInfo.mainType=e,r.keyInfo.subType=uJr(e,i,r.existing,n))})}function uJr(t,e,n,r){var i=e.type?e.type:n?n.subType:r.determineSubType(t,e);return i}function vH(t,e){if(e.dataIndexInside!=null)return e.dataIndexInside;if(e.dataIndex!=null)return fa(e.dataIndex)?Ga(e.dataIndex,function(n){return t.indexOfRawIndex(n)}):t.indexOfRawIndex(e.dataIndex);if(e.name!=null)return fa(e.name)?Ga(e.name,function(n){return t.indexOfName(n)}):t.indexOfName(e.name)}function ju(){var t="__ec_inner_"+dJr++;return function(e){return e[t]||(e[t]={})}}var dJr=vOt();function J4e(t,e,n){var r=eMe(e,n),i=r.mainTypeSpecified,o=r.queryOptionMap,l=r.others,u=l,d=n?n.defaultMainType:null;return!i&&d&&o.set(d,{}),o.each(function(p,m){var g=PF(t,m,p,{useDefault:d===m,enableAll:n&&n.enableAll!=null?n.enableAll:!0,enableNone:n&&n.enableNone!=null?n.enableNone:!0});u[m+"Models"]=g.models,u[m+"Model"]=g.models[0]}),u}function eMe(t,e){var n;if(Wa(t)){var r={};r[t+"Index"]=0,n=r}else n=t;var i=ss(),o={},l=!1;return fn(n,function(u,d){if(d==="dataIndex"||d==="dataIndexInside"){o[d]=u;return}var p=d.match(/^(\w+)(Index|Id|Name)$/)||[],m=p[1],g=(p[2]||"").toLowerCase();if(!(!m||!g||e&&e.includeMainTypes&&ic(e.includeMainTypes,m)<0)){l=l||!!m;var h=i.get(m)||i.set(m,{});h[g]=u}}),{mainTypeSpecified:l,queryOptionMap:i,others:o}}var LC={useDefault:!0,enableAll:!1,enableNone:!1};function PF(t,e,n,r){r=r||LC;var i=n.index,o=n.id,l=n.name,u={models:null,specified:i!=null||o!=null||l!=null};if(!u.specified){var d=void 0;return u.models=r.useDefault&&(d=t.getComponent(e))?[d]:[],u}if(i==="none"||i===!1){if(r.enableNone)return u.models=[],u;process.env.NODE_ENV!=="production"&&wc('`"none"` or `false` is not a valid value on index option.'),i=-1}return i==="all"&&(r.enableAll?i=o=l=null:(process.env.NODE_ENV!=="production"&&wc('`"all"` is not a valid value on index option.'),i=-1)),u.models=t.queryComponents({mainType:e,index:i,id:o,name:l}),u}function BOt(t,e,n){t.setAttribute?t.setAttribute(e,n):t[e]=n}function pJr(t,e){return t.getAttribute?t.getAttribute(e):t[e]}function mJr(t){return t==="auto"?go.domSupported?"html":"richText":t||"html"}var gJr=".",C3="___EC__COMPONENT__CONTAINER___",DOt="___EC__EXTENDED_CLASS___";function kk(t){var e={main:"",sub:""};if(t){var n=t.split(gJr);e.main=n[0]||"",e.sub=n[1]||""}return e}function hJr(t){Di(/^[a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)?$/.test(t),'componentType "'+t+'" illegal')}function fJr(t){return!!(t&&t[DOt])}function tMe(t,e){t.$constructor=t,t.extend=function(n){process.env.NODE_ENV!=="production"&&fn(e,function(o){n[o]||console.warn("Method `"+o+"` should be implemented"+(n.type?" in "+n.type:"")+".")});var r=this,i;return AJr(r)?i=(function(o){Ml(l,o);function l(){return o.apply(this,arguments)||this}return l})(r):(i=function(){(n.$constructor||r).apply(this,arguments)},KLe(i,this)),ta(i.prototype,n),i[DOt]=!0,i.extend=this.extend,i.superCall=vJr,i.superApply=_Jr,i.superClass=r,i}}function AJr(t){return lo(t)&&/^class\s/.test(Function.prototype.toString.call(t))}function NOt(t,e){t.extend=e.extend}var bJr=Math.round(Math.random()*10);function yJr(t){var e=["__\0is_clz",bJr++].join("_");t.prototype[e]=!0,process.env.NODE_ENV!=="production"&&Di(!t.isInstance,'The method "is" can not be defined.'),t.isInstance=function(n){return!!(n&&n[e])}}function vJr(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return this.superClass.prototype[e].apply(t,n)}function _Jr(t,e,n){return this.superClass.prototype[e].apply(t,n)}function Vce(t){var e={};t.registerClass=function(r){var i=r.type||r.prototype.type;if(i){hJr(i),r.prototype.type=i;var o=kk(i);if(!o.sub)process.env.NODE_ENV!=="production"&&e[o.main]&&console.warn(o.main+" exists."),e[o.main]=r;else if(o.sub!==C3){var l=n(o);l[o.sub]=r}}return r},t.getClass=function(r,i,o){var l=e[r];if(l&&l[C3]&&(l=i?l[i]:null),o&&!l)throw new Error(i?"Component "+r+"."+(i||"")+" is used but not imported.":r+".type should be specified.");return l},t.getClassesByMainType=function(r){var i=kk(r),o=[],l=e[i.main];return l&&l[C3]?fn(l,function(u,d){d!==C3&&o.push(u)}):o.push(l),o},t.hasClass=function(r){var i=kk(r);return!!e[i.main]},t.getAllClassMainTypes=function(){var r=[];return fn(e,function(i,o){r.push(o)}),r},t.hasSubTypes=function(r){var i=kk(r),o=e[i.main];return o&&o[C3]};function n(r){var i=e[r.main];return(!i||!i[C3])&&(i=e[r.main]={},i[C3]=!0),i}}function _H(t,e){for(var n=0;n<t.length;n++)t[n][1]||(t[n][1]=t[n][0]);return e=e||!1,function(r,i,o){for(var l={},u=0;u<t.length;u++){var d=t[u][1];if(!(i&&ic(i,d)>=0||o&&ic(o,d)<0)){var p=r.getShallow(d,e);p!=null&&(l[t[u][0]]=p)}}return l}}var wJr=[["fill","color"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["opacity"],["shadowColor"]],xJr=_H(wJr),kJr=(function(){function t(){}return t.prototype.getAreaStyle=function(e,n){return xJr(this,e,n)},t})(),nMe=new IF(50);function EJr(t){if(typeof t=="string"){var e=nMe.get(t);return e&&e.image}else return t}function rMe(t,e,n,r,i){if(t)if(typeof t=="string"){if(e&&e.__zrImageSrc===t||!n)return e;var o=nMe.get(t),l={hostEl:n,cb:r,cbPayload:i};return o?(e=o.image,!Kce(e)&&o.pending.push(l)):(e=GA.loadImage(t,ROt,ROt),e.__zrImageSrc=t,nMe.put(t,e.__cachedImgObj={image:e,pending:[l]})),e}else return t;else return e}function ROt(){var t=this.__cachedImgObj;this.onload=this.onerror=this.__cachedImgObj=null;for(var e=0;e<t.pending.length;e++){var n=t.pending[e],r=n.cb;r&&r(this,n.cbPayload),n.hostEl.dirty()}t.pending.length=0}function Kce(t){return t&&t.width&&t.height}var aMe=/\{([a-zA-Z0-9_]+)\|([^}]*)\}/g;function CJr(t,e,n,r,i){var o={};return LOt(o,t,e,n,r,i),o.text}function LOt(t,e,n,r,i,o){if(!n){t.text="",t.isTruncated=!1;return}var l=(e+"").split(`
|
|
687
687
|
`);o=MOt(n,r,i,o);for(var u=!1,d={},p=0,m=l.length;p<m;p++)POt(d,l[p],o),l[p]=d.textLine,u=u||d.isTruncated;t.text=l.join(`
|
|
688
688
|
`),t.isTruncated=u}function MOt(t,e,n,r){r=r||{};var i=ta({},r);n=ki(n,"..."),i.maxIterations=ki(r.maxIterations,2);var o=i.minChar=ki(r.minChar,0),l=i.fontMeasureInfo=Ak(e),u=l.asciiCharWidth;i.placeholder=ki(r.placeholder,"");for(var d=t=Math.max(0,t-1),p=0;p<o&&d>=u;p++)d-=u;var m=bk(l,n);return m>d&&(n="",m=0),d=t-m,i.ellipsis=n,i.ellipsisWidth=m,i.contentWidth=d,i.containerWidth=t,i}function POt(t,e,n){var r=n.containerWidth,i=n.contentWidth,o=n.fontMeasureInfo;if(!r){t.textLine="",t.isTruncated=!1;return}var l=bk(o,e);if(l<=r){t.textLine=e,t.isTruncated=!1;return}for(var u=0;;u++){if(l<=i||u>=n.maxIterations){e+=n.ellipsis;break}var d=u===0?SJr(e,i,o):l>0?Math.floor(e.length*i/l):0;e=e.substr(0,d),l=bk(o,e)}e===""&&(e=n.placeholder),t.textLine=e,t.isTruncated=!0}function SJr(t,e,n){for(var r=0,i=0,o=t.length;i<o&&r<e;i++)r+=iOt(n,t.charCodeAt(i));return i}function IJr(t,e,n,r){var i=oMe(t),o=e.overflow,l=e.padding,u=l?l[1]+l[3]:0,d=l?l[0]+l[2]:0,p=e.font,m=o==="truncate",g=mH(p),h=ki(e.lineHeight,g),f=e.lineOverflow==="truncate",b=!1,y=e.width;y==null&&n!=null&&(y=n-u);var v=e.height;v==null&&r!=null&&(v=r-d);var _;y!=null&&(o==="break"||o==="breakAll")?_=i?FOt(i,e.font,y,o==="breakAll",0).lines:[]:_=i?i.split(`
|