@xopcai/xopc 0.0.25 → 0.0.27
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/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/agents-w8_jzuiX.js +216 -0
- package/dist/gateway/static/root/assets/agents-w8_jzuiX.js.map +1 -0
- package/dist/gateway/static/root/assets/{apps-page-DbzO48lg.js → apps-page-CBBh_Ww8.js} +2 -2
- package/dist/gateway/static/root/assets/{apps-page-DbzO48lg.js.map → apps-page-CBBh_Ww8.js.map} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-DUKRPC7C.js +9 -0
- package/dist/gateway/static/root/assets/{channels-settings-CeGoU9v8.js.map → channels-settings-DUKRPC7C.js.map} +1 -1
- package/dist/gateway/static/root/assets/cron-page-S18t1yG-.js +2 -0
- package/dist/gateway/static/root/assets/{cron-page-DpEYUvxB.js.map → cron-page-S18t1yG-.js.map} +1 -1
- package/dist/gateway/static/root/assets/{cron-utils-Cvv0F3pa.js → cron-utils-08gdQfl9.js} +2 -2
- package/dist/gateway/static/root/assets/{cron-utils-Cvv0F3pa.js.map → cron-utils-08gdQfl9.js.map} +1 -1
- package/dist/gateway/static/root/assets/dist-C1MrygQH.js +2 -0
- package/dist/gateway/static/root/assets/{dist-C41N3YrO.js.map → dist-C1MrygQH.js.map} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-CkkYZjNP.js → extension-debug-page-DN3HKUGS.js} +2 -2
- package/dist/gateway/static/root/assets/{extension-debug-page-CkkYZjNP.js.map → extension-debug-page-DN3HKUGS.js.map} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-BjUIPVNG.js → extension-page-CoFDHZtZ.js} +2 -2
- package/dist/gateway/static/root/assets/{extension-page-BjUIPVNG.js.map → extension-page-CoFDHZtZ.js.map} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-CwuFDOdk.js → extension-settings-page-BcPCu_Go.js} +2 -2
- package/dist/gateway/static/root/assets/{extension-settings-page-CwuFDOdk.js.map → extension-settings-page-BcPCu_Go.js.map} +1 -1
- package/dist/gateway/static/root/assets/index-OT4cGzon.css +1 -0
- package/dist/gateway/static/root/assets/index-PfkB8N37.js +4734 -0
- package/dist/gateway/static/root/assets/index-PfkB8N37.js.map +1 -0
- package/dist/gateway/static/root/assets/logs-page-DoWe1GWy.js +2 -0
- package/dist/gateway/static/root/assets/{logs-page-BtwGPuw2.js.map → logs-page-DoWe1GWy.js.map} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-2uOYwEwd.js +2 -0
- package/dist/gateway/static/root/assets/{sessions-page-4rKFDn2k.js.map → sessions-page-2uOYwEwd.js.map} +1 -1
- package/dist/gateway/static/root/assets/settings-page-fQWswCuq.js +2 -0
- package/dist/gateway/static/root/assets/settings-page-fQWswCuq.js.map +1 -0
- package/dist/gateway/static/root/assets/skills-page-BmBDCEbY.js +3 -0
- package/dist/gateway/static/root/assets/{skills-page-_siDuHeF.js.map → skills-page-BmBDCEbY.js.map} +1 -1
- package/dist/gateway/static/root/index.html +2 -2
- package/dist/package.js +1 -1
- package/dist/src/agent/memory/dreaming/config.d.ts +37 -9
- package/dist/src/agent/memory/dreaming/config.js +60 -18
- package/dist/src/agent/memory/dreaming/config.js.map +1 -1
- package/dist/src/agent/memory/dreaming/constants.d.ts +22 -1
- package/dist/src/agent/memory/dreaming/constants.js +26 -2
- package/dist/src/agent/memory/dreaming/constants.js.map +1 -1
- package/dist/src/agent/memory/dreaming/deep-promotion.d.ts +5 -6
- package/dist/src/agent/memory/dreaming/deep-promotion.js +90 -156
- package/dist/src/agent/memory/dreaming/deep-promotion.js.map +1 -1
- package/dist/src/agent/memory/dreaming/events.d.ts +36 -0
- package/dist/src/agent/memory/dreaming/events.js +44 -0
- package/dist/src/agent/memory/dreaming/events.js.map +1 -0
- package/dist/src/agent/memory/dreaming/last-run.d.ts +80 -0
- package/dist/src/agent/memory/dreaming/last-run.js +98 -0
- package/dist/src/agent/memory/dreaming/last-run.js.map +1 -0
- package/dist/src/agent/memory/dreaming/light-sweep.d.ts +19 -0
- package/dist/src/agent/memory/dreaming/light-sweep.js +328 -0
- package/dist/src/agent/memory/dreaming/light-sweep.js.map +1 -0
- package/dist/src/agent/memory/dreaming/preview.d.ts +3 -1
- package/dist/src/agent/memory/dreaming/preview.js +11 -90
- package/dist/src/agent/memory/dreaming/preview.js.map +1 -1
- package/dist/src/agent/memory/dreaming/rem-patterns.d.ts +21 -0
- package/dist/src/agent/memory/dreaming/rem-patterns.js +286 -0
- package/dist/src/agent/memory/dreaming/rem-patterns.js.map +1 -0
- package/dist/src/agent/memory/dreaming/short-term-store.d.ts +20 -0
- package/dist/src/agent/memory/dreaming/short-term-store.js +25 -15
- package/dist/src/agent/memory/dreaming/short-term-store.js.map +1 -1
- package/dist/src/agent/memory/dreaming/utils.d.ts +42 -0
- package/dist/src/agent/memory/dreaming/utils.js +141 -0
- package/dist/src/agent/memory/dreaming/utils.js.map +1 -0
- package/dist/src/agent/orchestration/agent-orchestrator.js +54 -12
- package/dist/src/agent/orchestration/agent-orchestrator.js.map +1 -1
- package/dist/src/agent/service.js +54 -28
- package/dist/src/agent/service.js.map +1 -1
- package/dist/src/config/schema.d.ts +54 -0
- package/dist/src/config/schema.js +34 -8
- package/dist/src/config/schema.js.map +1 -1
- package/dist/src/gateway/hono/lib/config-payload.d.ts +18 -0
- package/dist/src/gateway/hono/routes/dreaming.js +105 -15
- package/dist/src/gateway/hono/routes/dreaming.js.map +1 -1
- package/dist/src/gateway/hono/routes/models.js +26 -1
- package/dist/src/gateway/hono/routes/models.js.map +1 -1
- package/dist/src/gateway/hono/routes/public-gateway.js +1 -0
- package/dist/src/gateway/hono/routes/public-gateway.js.map +1 -1
- package/package.json +1 -1
- package/dist/gateway/static/root/assets/agents-C_bPhtBs.js +0 -216
- package/dist/gateway/static/root/assets/agents-C_bPhtBs.js.map +0 -1
- package/dist/gateway/static/root/assets/channels-settings-CeGoU9v8.js +0 -9
- package/dist/gateway/static/root/assets/cron-page-DpEYUvxB.js +0 -2
- package/dist/gateway/static/root/assets/dist-C41N3YrO.js +0 -2
- package/dist/gateway/static/root/assets/index-DwzwDCjW.js +0 -150
- package/dist/gateway/static/root/assets/index-DwzwDCjW.js.map +0 -1
- package/dist/gateway/static/root/assets/index-dhtHG1nU.css +0 -1
- package/dist/gateway/static/root/assets/logs-page-BtwGPuw2.js +0 -2
- package/dist/gateway/static/root/assets/sessions-page-4rKFDn2k.js +0 -2
- package/dist/gateway/static/root/assets/settings-page-iYLSxQYc.js +0 -2
- package/dist/gateway/static/root/assets/settings-page-iYLSxQYc.js.map +0 -1
- package/dist/gateway/static/root/assets/skills-page-_siDuHeF.js +0 -3
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import{i as e,t}from"./rolldown-runtime-DWdDZTNf.js";import{i as n,t as r}from"./vendor-react-DbimaAId.js";import{i}from"./vendor-swr-B5fPo7KK.js";import{t as a}from"./cn-BMCV0OMB.js";import{A as o,Gt as s,Hn as c,Jt as l,Nr as u,On as d,Pr as f,Qt as p,Ut as m,_n as h,an as g,at as _,br as v,ct as y,dn as b,dt as x,gr as S,hr as C,in as w,k as T,l as ee,lt as te,mr as E,nn as ne,on as re,ot as ie,pr as ae,qt as oe,sn as D,st as se,ut as ce,zn as O}from"./index-DwzwDCjW.js";import{a as le,i as k,n as ue,r as de,t as fe}from"./dist-C41N3YrO.js";var A=e(n(),1);function j(e){return(e??``).trim().toLowerCase()}function pe(e){let t=e.match;return!(!t?.channel||!t.accountId||t.peerId||t.peerKind||t.guildId||t.teamId||t.memberRoleIds&&t.memberRoleIds.length>0)}function me(e){let t=Object.keys(e.accounts??{});return t.length>0?[...t].sort():typeof e.botToken==`string`&&e.botToken.trim()?[`default`]:[]}function M(e){return Object.keys(e.accounts??{}).sort()}function he(e){let t=Object.keys(e.accounts??{});return t.length>0?[...t].sort():typeof e.appId==`string`&&e.appId.trim()&&typeof e.appSecret==`string`&&e.appSecret.trim()?[`default`]:[]}function N(e,t,n,r,i){let a={},o={},s={};for(let n of t)a[n]=(e.find(e=>j(e.match?.channel)===`telegram`&&j(e.match?.accountId)===j(n)&&pe(e))?.agentId??i).trim().toLowerCase();for(let t of n)o[t]=(e.find(e=>j(e.match?.channel)===`weixin`&&j(e.match?.accountId)===j(t)&&pe(e))?.agentId??i).trim().toLowerCase();for(let t of r)s[t]=(e.find(e=>j(e.match?.channel)===`feishu`&&j(e.match?.accountId)===j(t)&&pe(e))?.agentId??i).trim().toLowerCase();return{telegram:a,weixin:o,feishu:s}}function P(e,t,n,r,i,a){let o=new Set(n.map(j)),s=new Set(r.map(j)),c=new Set(i.map(j)),l=e.filter(e=>{if(e.id?.startsWith(`ui:route:account:`))return!1;if(!pe(e))return!0;let t=j(e.match.channel),n=j(e.match.accountId);return!n||n===`*`?!0:!(t===`telegram`&&o.has(n)||t===`weixin`&&s.has(n)||t===`feishu`&&c.has(n))}),u=[];for(let e of n){let n=(t.telegram[e]??t.telegram[j(e)]??a).trim().toLowerCase();u.push({id:`ui:route:account:telegram:${e}`,agentId:n,priority:45,enabled:!0,match:{channel:`telegram`,accountId:e}})}for(let e of r){let n=(t.weixin[e]??t.weixin[j(e)]??a).trim().toLowerCase();u.push({id:`ui:route:account:weixin:${e}`,agentId:n,priority:45,enabled:!0,match:{channel:`weixin`,accountId:e}})}for(let e of i){let n=(t.feishu[e]??t.feishu[j(e)]??a).trim().toLowerCase();u.push({id:`ui:route:account:feishu:${e}`,agentId:n,priority:45,enabled:!0,match:{channel:`feishu`,accountId:e}})}return[...l,...u]}function ge(){return{bindingsFull:[],channelAgentRoutes:{telegram:{},weixin:{},feishu:{}},defaultAgentId:`main`,telegram:{enabled:!1,botToken:``,apiRoot:``,debug:!1,allowFrom:[],groupAllowFrom:[],dmPolicy:`pairing`,groupPolicy:`open`,replyToMode:`off`,streamMode:`partial`,historyLimit:50,textChunkLimit:4e3,proxy:``,accounts:{}},weixin:{enabled:!1,dmPolicy:`pairing`,allowFrom:[],debug:!1,streamMode:`partial`,historyLimit:50,textChunkLimit:4e3,routeTag:``,accounts:{}},feishu:{enabled:!1,defaultAccount:``,appId:``,appSecret:``,domain:`feishu`,connectionMode:`websocket`,verificationToken:``,encryptKey:``,webhookHost:`127.0.0.1`,webhookPort:3e3,webhookPath:`/feishu/events`,dmPolicy:`pairing`,groupPolicy:`allowlist`,allowFrom:[],groupAllowFrom:[],requireMention:!0,historyLimit:50,textChunkLimit:4e3,renderMode:`auto`,streaming:!1,reactionNotifications:`own`,tools:{doc:!0,wiki:!0,drive:!0,scopes:!0,bitable:!0,perm:!1},actions:{reactions:!0},accounts:{}}}}function _e(e){let t=e&&typeof e==`object`?e.channels:void 0,n=t&&typeof t==`object`?t:{},r=n.telegram,i=n.weixin,a=n.feishu,o=r?.accounts,s=o&&typeof o==`object`&&!Array.isArray(o)?o:{},c=i?.accounts,l=c&&typeof c==`object`&&!Array.isArray(c)?c:{},u=(()=>{let t=(e&&typeof e==`object`?e:{}).bindings;return Array.isArray(t)?t:[]})(),d=(()=>{let t=(e&&typeof e==`object`?e:{}).agents;return t&&typeof t==`object`?t:{}})(),f=typeof d.defaultId==`string`&&d.defaultId.trim()?d.defaultId.trim().toLowerCase():`main`,p={telegram:{enabled:!!r?.enabled,botToken:typeof r?.botToken==`string`?r.botToken:``,apiRoot:typeof r?.apiRoot==`string`?r.apiRoot:``,debug:!!r?.debug,allowFrom:Array.isArray(r?.allowFrom)?[...r.allowFrom]:[],groupAllowFrom:Array.isArray(r?.groupAllowFrom)?[...r.groupAllowFrom]:[],dmPolicy:r?.dmPolicy||`pairing`,groupPolicy:r?.groupPolicy||`open`,replyToMode:r?.replyToMode||`off`,streamMode:r?.streamMode??`partial`,historyLimit:typeof r?.historyLimit==`number`?r.historyLimit:50,textChunkLimit:typeof r?.textChunkLimit==`number`?r.textChunkLimit:4e3,proxy:typeof r?.proxy==`string`?r.proxy:``,accounts:{...s}},weixin:{enabled:!!i?.enabled,dmPolicy:i?.dmPolicy||`pairing`,allowFrom:Array.isArray(i?.allowFrom)?[...i.allowFrom]:[],debug:!!i?.debug,streamMode:i?.streamMode??`partial`,historyLimit:typeof i?.historyLimit==`number`?i.historyLimit:50,textChunkLimit:typeof i?.textChunkLimit==`number`?i.textChunkLimit:4e3,routeTag:i?.routeTag==null?``:String(i.routeTag),accounts:{...l}},feishu:{enabled:!!a?.enabled,defaultAccount:typeof a?.defaultAccount==`string`?a.defaultAccount:``,appId:typeof a?.appId==`string`?a.appId:``,appSecret:typeof a?.appSecret==`string`?a.appSecret:``,domain:typeof a?.domain==`string`&&a.domain||`feishu`,connectionMode:a?.connectionMode||`websocket`,verificationToken:typeof a?.verificationToken==`string`?a.verificationToken:``,encryptKey:typeof a?.encryptKey==`string`?a.encryptKey:``,webhookHost:typeof a?.webhookHost==`string`?a.webhookHost:`127.0.0.1`,webhookPort:typeof a?.webhookPort==`number`?a.webhookPort:3e3,webhookPath:typeof a?.webhookPath==`string`?a.webhookPath:`/feishu/events`,dmPolicy:a?.dmPolicy||`pairing`,groupPolicy:a?.groupPolicy||`allowlist`,allowFrom:Array.isArray(a?.allowFrom)?[...a.allowFrom]:[],groupAllowFrom:Array.isArray(a?.groupAllowFrom)?[...a.groupAllowFrom]:[],requireMention:a?.requireMention===void 0?!0:!!a.requireMention,historyLimit:typeof a?.historyLimit==`number`?a.historyLimit:50,textChunkLimit:typeof a?.textChunkLimit==`number`?a.textChunkLimit:4e3,renderMode:a?.renderMode||`auto`,streaming:a?.streaming===void 0?!1:!!a.streaming,reactionNotifications:a?.reactionNotifications||`own`,tools:a?.tools&&typeof a.tools==`object`&&!Array.isArray(a.tools)?{...a.tools}:void 0,actions:a?.actions&&typeof a.actions==`object`&&!Array.isArray(a.actions)?{...a.actions}:void 0,accounts:a?.accounts&&typeof a.accounts==`object`&&!Array.isArray(a.accounts)?{...a.accounts}:{}}},m=N(u,me(p.telegram),M(p.weixin),he(p.feishu),f);return{...p,bindingsFull:u.map(e=>({...e})),channelAgentRoutes:m,defaultAgentId:f}}async function ve(e){return(await s(m(`/api/channels/weixin/login/start`),{method:`POST`,body:JSON.stringify(e??{})})).payload}async function ye(e){return(await s(m(`/api/channels/weixin/login/${encodeURIComponent(e)}`))).payload.status}async function be(e){let t=e.telegram,n=e.weixin,r=e.feishu,i=P(e.bindingsFull,e.channelAgentRoutes,me(t),M(n),he(r),e.defaultAgentId),a=(()=>{let e=n.routeTag.trim();return e?/^\d+$/.test(e)?Number(e):e:null})(),o=(await s(m(`/api/config`),{method:`PATCH`,body:JSON.stringify({bindings:i,channels:{telegram:{enabled:t.enabled,botToken:t.botToken,apiRoot:t.apiRoot||void 0,debug:t.debug,allowFrom:t.allowFrom,groupAllowFrom:t.groupAllowFrom.length?t.groupAllowFrom:void 0,dmPolicy:t.dmPolicy,groupPolicy:t.groupPolicy,replyToMode:t.replyToMode,streamMode:t.streamMode,historyLimit:t.historyLimit,textChunkLimit:t.textChunkLimit,proxy:t.proxy||void 0,accounts:t.accounts},weixin:{enabled:n.enabled,dmPolicy:n.dmPolicy,allowFrom:n.allowFrom,debug:n.debug,streamMode:n.streamMode,historyLimit:n.historyLimit,textChunkLimit:n.textChunkLimit,routeTag:a,accounts:n.accounts},feishu:{enabled:r.enabled,defaultAccount:r.defaultAccount||void 0,appId:r.appId,appSecret:r.appSecret||void 0,domain:r.domain||void 0,connectionMode:r.connectionMode,verificationToken:r.verificationToken?.trim()?r.verificationToken:void 0,encryptKey:r.encryptKey?.trim()?r.encryptKey:void 0,webhookHost:r.webhookHost?.trim()?r.webhookHost:void 0,webhookPort:typeof r.webhookPort==`number`?r.webhookPort:void 0,webhookPath:r.webhookPath?.trim()?r.webhookPath:void 0,dmPolicy:r.dmPolicy,groupPolicy:r.groupPolicy,allowFrom:r.allowFrom,groupAllowFrom:r.groupAllowFrom.length?r.groupAllowFrom:void 0,requireMention:r.requireMention,historyLimit:r.historyLimit,textChunkLimit:r.textChunkLimit,renderMode:r.renderMode,streaming:r.streaming,reactionNotifications:r.reactionNotifications,tools:r.tools,actions:r.actions,accounts:r.accounts}}})})).payload?.config;return T(),o?_e(o):{...e,bindingsFull:i}}async function xe(e){return(await s(m(`/api/channels/feishu/setup/start`),{method:`POST`,body:JSON.stringify(e??{})})).payload}async function Se(e){return(await s(m(`/api/channels/feishu/setup/${encodeURIComponent(e)}`))).payload.status}function Ce(){return a(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,g,`dark:border-edge`)}function we(){return a(w,ne)}function Te(e){return e.split(/[,\n]/).map(e=>e.trim()).filter(Boolean).map(e=>/^-?\d+$/.test(e)?Number(e):e)}function Ee(e){return e.map(String).join(`, `)}function De(e){return!!e.botToken?.trim()||Object.keys(e.accounts??{}).length>0}function Oe(e){return Object.keys(e.accounts??{}).length>0||e.allowFrom.length>0}function ke(e){return!!(e.appId?.trim()&&e.appSecret?.trim())||Object.keys(e.accounts??{}).length>0}var F=r();function I({children:e}){return(0,F.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:e})}function L({children:e}){return(0,F.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-subtle`,children:e})}function R({label:e,value:t,onChange:n,options:r}){return(0,F.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,F.jsx)(I,{children:e}),(0,F.jsx)(`select`,{className:we(),value:t,onChange:e=>n(e.target.value),children:r.map(e=>(0,F.jsx)(`option`,{value:e.value,children:e.label},e.value))})]})}function Ae({accountIds:e,routes:t,defaultAgentId:n,agentItems:r,disabled:i,onChange:o,ch:s}){if(e.length===0)return null;let c=r.length>0?r:[{id:n}];return(0,F.jsxs)(`div`,{className:`space-y-3 border-t border-edge-subtle pt-4 dark:border-edge`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(I,{children:s.agentRoutingTitle}),(0,F.jsx)(L,{children:s.agentRoutingHint})]}),(0,F.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>(0,F.jsxs)(`div`,{className:`grid grid-cols-1 items-start gap-2 rounded-lg border border-edge-subtle bg-surface-base px-3 py-2.5 sm:grid-cols-2 sm:items-center dark:border-edge`,children:[(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:s.agentRoutingAccountLabel}),(0,F.jsx)(`p`,{className:`mt-0.5 truncate font-mono text-sm text-fg`,title:e,children:e})]}),(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsx)(`label`,{className:`sr-only`,htmlFor:`agent-route-${e}`,children:s.agentRoutingAgentLabel}),(0,F.jsx)(`select`,{id:`agent-route-${e}`,className:a(Ce(),ne),disabled:i,value:(t[e]??n).toLowerCase(),onChange:t=>o(e,t.target.value),children:c.map(e=>(0,F.jsx)(`option`,{value:e.id,children:e.name?.trim()?`${e.name} (${e.id})`:e.id},e.id))})]})]},e))})]})}function je({icon:e,title:t,subtitle:n,configured:r,enabled:i,onToggle:o,toggleDisabled:s,onConfigure:c,onEdit:l,onRemove:u,ch:d}){return(0,F.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-2xl border border-edge bg-surface-base px-4 py-4 dark:border-edge sm:flex-row sm:items-center sm:gap-4`,children:[(0,F.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start gap-4`,children:[(0,F.jsx)(`div`,{className:`flex size-12 shrink-0 items-center justify-center rounded-xl bg-surface-hover`,"aria-hidden":!0,children:e}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,F.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t}),r?(0,F.jsx)(`span`,{className:`inline-flex items-center rounded-full bg-success-soft px-2 py-0.5 text-xs font-medium text-success`,children:d.hubConnectedBadge}):null]}),(0,F.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n})]})]}),r?(0,F.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-2 sm:gap-3`,children:[(0,F.jsxs)(k,{children:[(0,F.jsx)(le,{asChild:!0,children:(0,F.jsx)(D,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":d.menuMoreAria,children:(0,F.jsx)(S,{className:`size-5 text-fg-muted`,strokeWidth:1.75})})}),(0,F.jsx)(de,{children:(0,F.jsxs)(fe,{className:`z-[70] min-w-[11rem] rounded-xl border border-edge bg-surface-panel p-1 shadow-popover dark:border-edge`,sideOffset:6,align:`end`,children:[(0,F.jsx)(ue,{className:`cursor-pointer rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover data-[highlighted]:bg-surface-hover`,onSelect:()=>l(),children:(0,F.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(O,{className:`size-4 shrink-0 text-fg-muted`,strokeWidth:1.75}),d.menuEditConfig]})}),(0,F.jsx)(ue,{className:`cursor-pointer rounded-lg px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover data-[highlighted]:bg-surface-hover`,onSelect:()=>u(),children:(0,F.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(h,{className:`size-4 shrink-0`,strokeWidth:1.75}),d.menuRemoveConfig]})})]})})]}),(0,F.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":i,"aria-label":`${t} — ${d.enableChannelAria}`,disabled:s,className:a(`inline-flex h-6 w-10 shrink-0 items-center rounded-full border border-edge p-0.5 transition-colors`,i?`justify-end bg-accent`:`justify-start bg-surface-hover`,s&&`cursor-not-allowed opacity-50`),onClick:()=>void o(!i),children:(0,F.jsx)(`span`,{className:`size-4 rounded-full bg-surface-panel shadow-surface ring-1 ring-edge/40 dark:ring-edge/55`})})]}):(0,F.jsx)(`div`,{className:`flex shrink-0 justify-end sm:justify-end`,children:(0,F.jsx)(D,{type:`button`,variant:`primary`,className:`shrink-0`,onClick:c,children:d.hubConfigureButton})})]})}function Me({tg:e,updateTelegram:t,ch:n,dmOpts:r,groupOpts:i,replyOpts:o,streamOpts:s,tgAccountsDraft:c,setTgAccountsDraft:l,tgAccountsError:u,onTgAccountsBlur:d}){let f=Ce;return(0,F.jsxs)(`div`,{className:`space-y-4 border-t border-edge-subtle pt-4 dark:border-edge`,children:[(0,F.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,F.jsx)(I,{children:n.apiRoot}),(0,F.jsx)(`input`,{className:f(),value:e.apiRoot,onChange:e=>t({apiRoot:e.target.value}),placeholder:`https://api.telegram.org`})]}),(0,F.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,F.jsx)(I,{children:n.proxy}),(0,F.jsx)(`input`,{className:f(),value:e.proxy,onChange:e=>t({proxy:e.target.value}),placeholder:`http://proxy.example.com:8080`})]}),(0,F.jsx)(R,{label:n.dmPolicy,value:e.dmPolicy,onChange:e=>t({dmPolicy:e}),options:r}),(0,F.jsx)(R,{label:n.groupPolicy,value:e.groupPolicy,onChange:e=>t({groupPolicy:e}),options:i}),(0,F.jsx)(R,{label:n.replyToMode,value:e.replyToMode,onChange:e=>t({replyToMode:e}),options:o}),(0,F.jsx)(R,{label:n.streamMode,value:e.streamMode,onChange:e=>t({streamMode:e}),options:s}),(0,F.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,F.jsx)(I,{children:n.allowFromGroups}),(0,F.jsx)(`textarea`,{className:a(f(),`min-h-[2.75rem] resize-y font-mono text-xs`),rows:2,placeholder:`-1001234567890`,value:Ee(e.groupAllowFrom),onChange:e=>t({groupAllowFrom:Te(e.target.value)})})]}),(0,F.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,F.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,F.jsx)(I,{children:n.historyLimit}),(0,F.jsx)(`input`,{type:`number`,min:10,max:200,className:f(),value:e.historyLimit,onChange:e=>t({historyLimit:parseInt(e.target.value,10)||50})})]}),(0,F.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,F.jsx)(I,{children:n.textChunkLimit}),(0,F.jsx)(`input`,{type:`number`,min:1e3,max:1e4,step:100,className:f(),value:e.textChunkLimit,onChange:e=>t({textChunkLimit:parseInt(e.target.value,10)||4e3})})]})]}),(0,F.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[(0,F.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:e.debug,onChange:e=>t({debug:e.target.checked})}),n.telegramDebug]}),(0,F.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,F.jsx)(I,{children:n.multiAccountJson}),(0,F.jsx)(`textarea`,{className:a(f(),`min-h-[140px] resize-y font-mono text-xs`),spellCheck:!1,value:c,onChange:e=>l(e.target.value),onBlur:d,placeholder:`{ "personal": { "accountId": "personal", "botToken": "...", ... } }`}),u?(0,F.jsx)(`p`,{className:`text-xs text-red-600 dark:text-red-400`,children:u}):(0,F.jsx)(L,{children:n.multiAccountJsonDesc})]})]})}function Ne({wx:e,updateWeixin:t,ch:n,dmOpts:r,streamOpts:i,wxAccountsDraft:o,setWxAccountsDraft:s,wxAccountsError:c,onWxAccountsBlur:l,channelAgentRoutesWx:u,defaultAgentId:d,agentItems:f,onAgentRouteChange:p,routingDisabled:m}){let h=Ce;return(0,F.jsxs)(`div`,{className:`space-y-4 border-t border-edge-subtle pt-4 dark:border-edge`,children:[(0,F.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,F.jsx)(I,{children:n.weixinAllowFrom}),(0,F.jsx)(`textarea`,{className:a(h(),`min-h-[2.75rem] resize-y font-mono text-xs`),rows:2,placeholder:`wxid_..., openid_...`,value:e.allowFrom.join(`, `),onChange:e=>t({allowFrom:e.target.value.split(/[,\n]/).map(e=>e.trim()).filter(Boolean)})}),(0,F.jsx)(L,{children:n.weixinAllowFromDesc})]}),(0,F.jsx)(R,{label:n.dmPolicy,value:e.dmPolicy,onChange:e=>t({dmPolicy:e}),options:r}),(0,F.jsx)(R,{label:n.streamMode,value:e.streamMode,onChange:e=>t({streamMode:e}),options:i}),(0,F.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,F.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,F.jsx)(I,{children:n.historyLimit}),(0,F.jsx)(`input`,{type:`number`,min:10,max:200,className:h(),value:e.historyLimit,onChange:e=>t({historyLimit:parseInt(e.target.value,10)||50})})]}),(0,F.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,F.jsx)(I,{children:n.textChunkLimit}),(0,F.jsx)(`input`,{type:`number`,min:1e3,max:1e4,step:100,className:h(),value:e.textChunkLimit,onChange:e=>t({textChunkLimit:parseInt(e.target.value,10)||4e3})})]})]}),(0,F.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,F.jsx)(I,{children:n.weixinRouteTag}),(0,F.jsx)(`input`,{className:h(),value:e.routeTag,onChange:e=>t({routeTag:e.target.value}),placeholder:n.routeTagPlaceholder}),(0,F.jsx)(L,{children:n.weixinRouteTagDesc})]}),(0,F.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[(0,F.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:e.debug,onChange:e=>t({debug:e.target.checked})}),n.weixinDebug]}),(0,F.jsx)(L,{children:n.weixinDebugDesc}),(0,F.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,F.jsx)(I,{children:n.weixinAccountsJson}),(0,F.jsx)(`textarea`,{className:a(h(),`min-h-[140px] resize-y font-mono text-xs`),spellCheck:!1,value:o,onChange:e=>s(e.target.value),onBlur:l,placeholder:`{ "personal": { "name": "...", "cdnBaseUrl": "...", "enabled": true } }`}),c?(0,F.jsx)(`p`,{className:`text-xs text-red-600 dark:text-red-400`,children:c}):(0,F.jsx)(L,{children:n.weixinAccountsJsonDesc})]}),(0,F.jsx)(Ae,{accountIds:M(e),routes:u,defaultAgentId:d,agentItems:f,disabled:m,onChange:p,ch:n})]})}var Pe=t(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),z=t((e=>{var t,n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(e){if(!e)throw Error(`"version" cannot be null or undefined`);if(e<1||e>40)throw Error(`"version" should be in range from 1 to 40`);return e*4+17},e.getSymbolTotalCodewords=function(e){return n[e]},e.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t},e.setToSJISFunction=function(e){if(typeof e!=`function`)throw Error(`"toSJISFunc" is not a valid function.`);t=e},e.isKanjiModeEnabled=function(){return t!==void 0},e.toSJIS=function(e){return t(e)}})),B=t((e=>{e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`l`:case`low`:return e.L;case`m`:case`medium`:return e.M;case`q`:case`quartile`:return e.Q;case`h`:case`high`:return e.H;default:throw Error(`Unknown EC Level: `+t)}}e.isValid=function(e){return e&&e.bit!==void 0&&e.bit>=0&&e.bit<4},e.from=function(n,r){if(e.isValid(n))return n;try{return t(n)}catch{return r}}})),Fe=t(((e,t)=>{function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){let t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(let n=0;n<t;n++)this.putBit((e>>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n})),Ie=t(((e,t)=>{function n(e){if(!e||e<1)throw Error(`BitMatrix size must be defined and greater than 0`);this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}n.prototype.set=function(e,t,n,r){let i=e*this.size+t;this.data[i]=n,r&&(this.reservedBit[i]=!0)},n.prototype.get=function(e,t){return this.data[e*this.size+t]},n.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},n.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},t.exports=n})),Le=t((e=>{var t=z().getSymbolSize;e.getRowColCoords=function(e){if(e===1)return[];let n=Math.floor(e/7)+2,r=t(e),i=r===145?26:Math.ceil((r-13)/(2*n-2))*2,a=[r-7];for(let e=1;e<n-1;e++)a[e]=a[e-1]-i;return a.push(6),a.reverse()},e.getPositions=function(t){let n=[],r=e.getRowColCoords(t),i=r.length;for(let e=0;e<i;e++)for(let t=0;t<i;t++)e===0&&t===0||e===0&&t===i-1||e===i-1&&t===0||n.push([r[e],r[t]]);return n}})),Re=t((e=>{var t=z().getSymbolSize,n=7;e.getPositions=function(e){let r=t(e);return[[0,0],[r-n,0],[0,r-n]]}})),ze=t((e=>{e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(e){return e!=null&&e!==``&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){let n=e.size,r=0,i=0,a=0,o=null,s=null;for(let c=0;c<n;c++){i=a=0,o=s=null;for(let l=0;l<n;l++){let n=e.get(c,l);n===o?i++:(i>=5&&(r+=t.N1+(i-5)),o=n,i=1),n=e.get(l,c),n===s?a++:(a>=5&&(r+=t.N1+(a-5)),s=n,a=1)}i>=5&&(r+=t.N1+(i-5)),a>=5&&(r+=t.N1+(a-5))}return r},e.getPenaltyN2=function(e){let n=e.size,r=0;for(let t=0;t<n-1;t++)for(let i=0;i<n-1;i++){let n=e.get(t,i)+e.get(t,i+1)+e.get(t+1,i)+e.get(t+1,i+1);(n===4||n===0)&&r++}return r*t.N2},e.getPenaltyN3=function(e){let n=e.size,r=0,i=0,a=0;for(let t=0;t<n;t++){i=a=0;for(let o=0;o<n;o++)i=i<<1&2047|e.get(t,o),o>=10&&(i===1488||i===93)&&r++,a=a<<1&2047|e.get(o,t),o>=10&&(a===1488||a===93)&&r++}return r*t.N3},e.getPenaltyN4=function(e){let n=0,r=e.data.length;for(let t=0;t<r;t++)n+=e.data[t];return Math.abs(Math.ceil(n*100/r/5)-10)*t.N4};function n(t,n,r){switch(t){case e.Patterns.PATTERN000:return(n+r)%2==0;case e.Patterns.PATTERN001:return n%2==0;case e.Patterns.PATTERN010:return r%3==0;case e.Patterns.PATTERN011:return(n+r)%3==0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case e.Patterns.PATTERN101:return n*r%2+n*r%3==0;case e.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case e.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw Error(`bad maskPattern:`+t)}}e.applyMask=function(e,t){let r=t.size;for(let i=0;i<r;i++)for(let a=0;a<r;a++)t.isReserved(a,i)||t.xor(a,i,n(e,a,i))},e.getBestMask=function(t,n){let r=Object.keys(e.Patterns).length,i=0,a=1/0;for(let o=0;o<r;o++){n(o),e.applyMask(o,t);let r=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(o,t),r<a&&(a=r,i=o)}return i}})),Be=t((e=>{var t=B(),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],r=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];e.getBlocksCount=function(e,r){switch(r){case t.L:return n[(e-1)*4+0];case t.M:return n[(e-1)*4+1];case t.Q:return n[(e-1)*4+2];case t.H:return n[(e-1)*4+3];default:return}},e.getTotalCodewordsCount=function(e,n){switch(n){case t.L:return r[(e-1)*4+0];case t.M:return r[(e-1)*4+1];case t.Q:return r[(e-1)*4+2];case t.H:return r[(e-1)*4+3];default:return}}})),Ve=t((e=>{var t=new Uint8Array(512),n=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)t[r]=e,n[e]=r,e<<=1,e&256&&(e^=285);for(let e=255;e<512;e++)t[e]=t[e-255]})(),e.log=function(e){if(e<1)throw Error(`log(`+e+`)`);return n[e]},e.exp=function(e){return t[e]},e.mul=function(e,r){return e===0||r===0?0:t[n[e]+n[r]]}})),He=t((e=>{var t=Ve();e.mul=function(e,n){let r=new Uint8Array(e.length+n.length-1);for(let i=0;i<e.length;i++)for(let a=0;a<n.length;a++)r[i+a]^=t.mul(e[i],n[a]);return r},e.mod=function(e,n){let r=new Uint8Array(e);for(;r.length-n.length>=0;){let e=r[0];for(let i=0;i<n.length;i++)r[i]^=t.mul(n[i],e);let i=0;for(;i<r.length&&r[i]===0;)i++;r=r.slice(i)}return r},e.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let i=0;i<n;i++)r=e.mul(r,new Uint8Array([1,t.exp(i)]));return r}})),Ue=t(((e,t)=>{var n=He();function r(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}r.prototype.initialize=function(e){this.degree=e,this.genPoly=n.generateECPolynomial(this.degree)},r.prototype.encode=function(e){if(!this.genPoly)throw Error(`Encoder not initialized`);let t=new Uint8Array(e.length+this.degree);t.set(e);let r=n.mod(t,this.genPoly),i=this.degree-r.length;if(i>0){let e=new Uint8Array(this.degree);return e.set(r,i),e}return r},t.exports=r})),We=t((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),Ge=t((e=>{var t=`[0-9]+`,n=`[A-Z $%*+\\-./:]+`,r=`(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+`;r=r.replace(/u/g,`\\u`);var i=`(?:(?![A-Z0-9 $%*+\\-./:]|`+r+`)(?:.|[\r
|
|
2
|
-
]))+`;e.KANJI=new RegExp(r,`g`),e.BYTE_KANJI=RegExp(`[^A-Z0-9 $%*+\\-./:]+`,`g`),e.BYTE=new RegExp(i,`g`),e.NUMERIC=new RegExp(t,`g`),e.ALPHANUMERIC=new RegExp(n,`g`);var a=RegExp(`^`+r+`$`),o=RegExp(`^`+t+`$`),s=RegExp(`^[A-Z0-9 $%*+\\-./:]+$`);e.testKanji=function(e){return a.test(e)},e.testNumeric=function(e){return o.test(e)},e.testAlphanumeric=function(e){return s.test(e)}})),V=t((e=>{var t=We(),n=Ge();e.NUMERIC={id:`Numeric`,bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:`Alphanumeric`,bit:2,ccBits:[9,11,13]},e.BYTE={id:`Byte`,bit:4,ccBits:[8,16,16]},e.KANJI={id:`Kanji`,bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(e,n){if(!e.ccBits)throw Error(`Invalid mode: `+e);if(!t.isValid(n))throw Error(`Invalid version: `+n);return n>=1&&n<10?e.ccBits[0]:n<27?e.ccBits[1]:e.ccBits[2]},e.getBestModeForData=function(t){return n.testNumeric(t)?e.NUMERIC:n.testAlphanumeric(t)?e.ALPHANUMERIC:n.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(e){if(e&&e.id)return e.id;throw Error(`Invalid mode`)},e.isValid=function(e){return e&&e.bit&&e.ccBits};function r(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`numeric`:return e.NUMERIC;case`alphanumeric`:return e.ALPHANUMERIC;case`kanji`:return e.KANJI;case`byte`:return e.BYTE;default:throw Error(`Unknown mode: `+t)}}e.from=function(t,n){if(e.isValid(t))return t;try{return r(t)}catch{return n}}})),H=t((e=>{var t=z(),n=Be(),r=B(),i=V(),a=We(),o=7973,s=t.getBCHDigit(o);function c(t,n,r){for(let i=1;i<=40;i++)if(n<=e.getCapacity(i,r,t))return i}function l(e,t){return i.getCharCountIndicator(e,t)+4}function u(e,t){let n=0;return e.forEach(function(e){let r=l(e.mode,t);n+=r+e.getBitsLength()}),n}function d(t,n){for(let r=1;r<=40;r++)if(u(t,r)<=e.getCapacity(r,n,i.MIXED))return r}e.from=function(e,t){return a.isValid(e)?parseInt(e,10):t},e.getCapacity=function(e,r,o){if(!a.isValid(e))throw Error(`Invalid QR Code version`);o===void 0&&(o=i.BYTE);let s=(t.getSymbolTotalCodewords(e)-n.getTotalCodewordsCount(e,r))*8;if(o===i.MIXED)return s;let c=s-l(o,e);switch(o){case i.NUMERIC:return Math.floor(c/10*3);case i.ALPHANUMERIC:return Math.floor(c/11*2);case i.KANJI:return Math.floor(c/13);case i.BYTE:default:return Math.floor(c/8)}},e.getBestVersionForData=function(e,t){let n,i=r.from(t,r.M);if(Array.isArray(e)){if(e.length>1)return d(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return c(n.mode,n.getLength(),i)},e.getEncodedBits=function(e){if(!a.isValid(e)||e<7)throw Error(`Invalid QR Code version`);let n=e<<12;for(;t.getBCHDigit(n)-s>=0;)n^=o<<t.getBCHDigit(n)-s;return e<<12|n}})),Ke=t((e=>{var t=z(),n=1335,r=21522,i=t.getBCHDigit(n);e.getEncodedBits=function(e,a){let o=e.bit<<3|a,s=o<<10;for(;t.getBCHDigit(s)-i>=0;)s^=n<<t.getBCHDigit(s)-i;return(o<<10|s)^r}})),U=t(((e,t)=>{var n=V();function r(e){this.mode=n.NUMERIC,this.data=e.toString()}r.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){let t,n,r;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),r=parseInt(n,10),e.put(r,10);let i=this.data.length-t;i>0&&(n=this.data.substr(t),r=parseInt(n,10),e.put(r,i*3+1))},t.exports=r})),qe=t(((e,t)=>{var n=V(),r=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`.split(``);function i(e){this.mode=n.ALPHANUMERIC,this.data=e}i.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let n=r.indexOf(this.data[t])*45;n+=r.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(r.indexOf(this.data[t]),6)},t.exports=i})),W=t(((e,t)=>{var n=V();function r(e){this.mode=n.BYTE,typeof e==`string`?this.data=new TextEncoder().encode(e):this.data=new Uint8Array(e)}r.getBitsLength=function(e){return e*8},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){for(let t=0,n=this.data.length;t<n;t++)e.put(this.data[t],8)},t.exports=r})),Je=t(((e,t)=>{var n=V(),r=z();function i(e){this.mode=n.KANJI,this.data=e}i.getBitsLength=function(e){return e*13},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let n=r.toSJIS(this.data[t]);if(n>=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw Error(`Invalid SJIS character: `+this.data[t]+`
|
|
3
|
-
Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),e.put(n,13)}},t.exports=i})),G=t(((e,t)=>{var n={single_source_shortest_paths:function(e,t,r){var i={},a={};a[t]=0;var o=n.PriorityQueue.make();o.push(t,0);for(var s,c,l,u,d,f,p,m,h;!o.empty();)for(l in s=o.pop(),c=s.value,u=s.cost,d=e[c]||{},d)d.hasOwnProperty(l)&&(f=d[l],p=u+f,m=a[l],h=a[l]===void 0,(h||m>p)&&(a[l]=p,o.push(l,p),i[l]=c));if(r!==void 0&&a[r]===void 0){var g=[`Could not find a path from `,t,` to `,r,`.`].join(``);throw Error(g)}return i},extract_shortest_path_from_predecessor_list:function(e,t){for(var n=[],r=t;r;)n.push(r),e[r],r=e[r];return n.reverse(),n},find_path:function(e,t,r){var i=n.single_source_shortest_paths(e,t,r);return n.extract_shortest_path_from_predecessor_list(i,r)},PriorityQueue:{make:function(e){var t=n.PriorityQueue,r={},i;for(i in e||={},t)t.hasOwnProperty(i)&&(r[i]=t[i]);return r.queue=[],r.sorter=e.sorter||t.default_sorter,r},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var n={value:e,cost:t};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};t!==void 0&&(t.exports=n)})),Ye=t((e=>{var t=V(),n=U(),r=qe(),i=W(),a=Je(),o=Ge(),s=z(),c=G();function l(e){return unescape(encodeURIComponent(e)).length}function u(e,t,n){let r=[],i;for(;(i=e.exec(n))!==null;)r.push({data:i[0],index:i.index,mode:t,length:i[0].length});return r}function d(e){let n=u(o.NUMERIC,t.NUMERIC,e),r=u(o.ALPHANUMERIC,t.ALPHANUMERIC,e),i,a;return s.isKanjiModeEnabled()?(i=u(o.BYTE,t.BYTE,e),a=u(o.KANJI,t.KANJI,e)):(i=u(o.BYTE_KANJI,t.BYTE,e),a=[]),n.concat(r,i,a).sort(function(e,t){return e.index-t.index}).map(function(e){return{data:e.data,mode:e.mode,length:e.length}})}function f(e,o){switch(o){case t.NUMERIC:return n.getBitsLength(e);case t.ALPHANUMERIC:return r.getBitsLength(e);case t.KANJI:return a.getBitsLength(e);case t.BYTE:return i.getBitsLength(e)}}function p(e){return e.reduce(function(e,t){let n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)},[])}function m(e){let n=[];for(let r=0;r<e.length;r++){let i=e[r];switch(i.mode){case t.NUMERIC:n.push([i,{data:i.data,mode:t.ALPHANUMERIC,length:i.length},{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.ALPHANUMERIC:n.push([i,{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.KANJI:n.push([i,{data:i.data,mode:t.BYTE,length:l(i.data)}]);break;case t.BYTE:n.push([{data:i.data,mode:t.BYTE,length:l(i.data)}])}}return n}function h(e,n){let r={},i={start:{}},a=[`start`];for(let o=0;o<e.length;o++){let s=e[o],c=[];for(let e=0;e<s.length;e++){let l=s[e],u=``+o+e;c.push(u),r[u]={node:l,lastCount:0},i[u]={};for(let e=0;e<a.length;e++){let o=a[e];r[o]&&r[o].node.mode===l.mode?(i[o][u]=f(r[o].lastCount+l.length,l.mode)-f(r[o].lastCount,l.mode),r[o].lastCount+=l.length):(r[o]&&(r[o].lastCount=l.length),i[o][u]=f(l.length,l.mode)+4+t.getCharCountIndicator(l.mode,n))}}a=c}for(let e=0;e<a.length;e++)i[a[e]].end=0;return{map:i,table:r}}function g(e,o){let c,l=t.getBestModeForData(e);if(c=t.from(o,l),c!==t.BYTE&&c.bit<l.bit)throw Error(`"`+e+`" cannot be encoded with mode `+t.toString(c)+`.
|
|
4
|
-
Suggested mode is: `+t.toString(l));switch(c===t.KANJI&&!s.isKanjiModeEnabled()&&(c=t.BYTE),c){case t.NUMERIC:return new n(e);case t.ALPHANUMERIC:return new r(e);case t.KANJI:return new a(e);case t.BYTE:return new i(e)}}e.fromArray=function(e){return e.reduce(function(e,t){return typeof t==`string`?e.push(g(t,null)):t.data&&e.push(g(t.data,t.mode)),e},[])},e.fromString=function(t,n){let r=h(m(d(t,s.isKanjiModeEnabled())),n),i=c.find_path(r.map,`start`,`end`),a=[];for(let e=1;e<i.length-1;e++)a.push(r.table[i[e]].node);return e.fromArray(p(a))},e.rawSplit=function(t){return e.fromArray(d(t,s.isKanjiModeEnabled()))}})),K=t((e=>{var t=z(),n=B(),r=Fe(),i=Ie(),a=Le(),o=Re(),s=ze(),c=Be(),l=Ue(),u=H(),d=Ke(),f=V(),p=Ye();function m(e,t){let n=e.size,r=o.getPositions(t);for(let t=0;t<r.length;t++){let i=r[t][0],a=r[t][1];for(let t=-1;t<=7;t++)if(!(i+t<=-1||n<=i+t))for(let r=-1;r<=7;r++)a+r<=-1||n<=a+r||(t>=0&&t<=6&&(r===0||r===6)||r>=0&&r<=6&&(t===0||t===6)||t>=2&&t<=4&&r>=2&&r<=4?e.set(i+t,a+r,!0,!0):e.set(i+t,a+r,!1,!0))}}function h(e){let t=e.size;for(let n=8;n<t-8;n++){let t=n%2==0;e.set(n,6,t,!0),e.set(6,n,t,!0)}}function g(e,t){let n=a.getPositions(t);for(let t=0;t<n.length;t++){let r=n[t][0],i=n[t][1];for(let t=-2;t<=2;t++)for(let n=-2;n<=2;n++)t===-2||t===2||n===-2||n===2||t===0&&n===0?e.set(r+t,i+n,!0,!0):e.set(r+t,i+n,!1,!0)}}function _(e,t){let n=e.size,r=u.getEncodedBits(t),i,a,o;for(let t=0;t<18;t++)i=Math.floor(t/3),a=t%3+n-8-3,o=(r>>t&1)==1,e.set(i,a,o,!0),e.set(a,i,o,!0)}function v(e,t,n){let r=e.size,i=d.getEncodedBits(t,n),a,o;for(a=0;a<15;a++)o=(i>>a&1)==1,a<6?e.set(a,8,o,!0):a<8?e.set(a+1,8,o,!0):e.set(r-15+a,8,o,!0),a<8?e.set(8,r-a-1,o,!0):a<9?e.set(8,15-a-1+1,o,!0):e.set(8,15-a-1,o,!0);e.set(r-8,8,1,!0)}function y(e,t){let n=e.size,r=-1,i=n-1,a=7,o=0;for(let s=n-1;s>0;s-=2)for(s===6&&s--;;){for(let n=0;n<2;n++)if(!e.isReserved(i,s-n)){let r=!1;o<t.length&&(r=(t[o]>>>a&1)==1),e.set(i,s-n,r),a--,a===-1&&(o++,a=7)}if(i+=r,i<0||n<=i){i-=r,r=-r;break}}}function b(e,n,i){let a=new r;i.forEach(function(t){a.put(t.mode.bit,4),a.put(t.getLength(),f.getCharCountIndicator(t.mode,e)),t.write(a)});let o=(t.getSymbolTotalCodewords(e)-c.getTotalCodewordsCount(e,n))*8;for(a.getLengthInBits()+4<=o&&a.put(0,4);a.getLengthInBits()%8!=0;)a.putBit(0);let s=(o-a.getLengthInBits())/8;for(let e=0;e<s;e++)a.put(e%2?17:236,8);return x(a,e,n)}function x(e,n,r){let i=t.getSymbolTotalCodewords(n),a=i-c.getTotalCodewordsCount(n,r),o=c.getBlocksCount(n,r),s=o-i%o,u=Math.floor(i/o),d=Math.floor(a/o),f=d+1,p=u-d,m=new l(p),h=0,g=Array(o),_=Array(o),v=0,y=new Uint8Array(e.buffer);for(let e=0;e<o;e++){let t=e<s?d:f;g[e]=y.slice(h,h+t),_[e]=m.encode(g[e]),h+=t,v=Math.max(v,t)}let b=new Uint8Array(i),x=0,S,C;for(S=0;S<v;S++)for(C=0;C<o;C++)S<g[C].length&&(b[x++]=g[C][S]);for(S=0;S<p;S++)for(C=0;C<o;C++)b[x++]=_[C][S];return b}function S(e,n,r,a){let o;if(Array.isArray(e))o=p.fromArray(e);else if(typeof e==`string`){let t=n;if(!t){let n=p.rawSplit(e);t=u.getBestVersionForData(n,r)}o=p.fromString(e,t||40)}else throw Error(`Invalid data`);let c=u.getBestVersionForData(o,r);if(!c)throw Error(`The amount of data is too big to be stored in a QR Code`);if(!n)n=c;else if(n<c)throw Error(`
|
|
5
|
-
The chosen QR Code version cannot contain this amount of data.
|
|
6
|
-
Minimum version required to store current data is: `+c+`.
|
|
7
|
-
`);let l=b(n,r,o),d=new i(t.getSymbolSize(n));return m(d,n),h(d),g(d,n),v(d,r,0),n>=7&&_(d,n),y(d,l),isNaN(a)&&(a=s.getBestMask(d,v.bind(null,d,r))),s.applyMask(a,d),v(d,r,a),{modules:d,version:n,errorCorrectionLevel:r,maskPattern:a,segments:o}}e.create=function(e,r){if(e===void 0||e===``)throw Error(`No input text`);let i=n.M,a,o;return r!==void 0&&(i=n.from(r.errorCorrectionLevel,n.M),a=u.from(r.version),o=s.from(r.maskPattern),r.toSJISFunc&&t.setToSJISFunction(r.toSJISFunc)),S(e,a,i,o)}})),Xe=t((e=>{function t(e){if(typeof e==`number`&&(e=e.toString()),typeof e!=`string`)throw Error(`Color should be defined as hex string`);let t=e.slice().replace(`#`,``).split(``);if(t.length<3||t.length===5||t.length>8)throw Error(`Invalid hex color: `+e);(t.length===3||t.length===4)&&(t=Array.prototype.concat.apply([],t.map(function(e){return[e,e]}))),t.length===6&&t.push(`F`,`F`);let n=parseInt(t.join(``),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:n&255,hex:`#`+t.slice(0,6).join(``)}}e.getOptions=function(e){e||={},e.color||={};let n=e.margin===void 0||e.margin===null||e.margin<0?4:e.margin,r=e.width&&e.width>=21?e.width:void 0,i=e.scale||4;return{width:r,scale:r?4:i,margin:n,color:{dark:t(e.color.dark||`#000000ff`),light:t(e.color.light||`#ffffffff`)},type:e.type,rendererOpts:e.rendererOpts||{}}},e.getScale=function(e,t){return t.width&&t.width>=e+t.margin*2?t.width/(e+t.margin*2):t.scale},e.getImageWidth=function(t,n){let r=e.getScale(t,n);return Math.floor((t+n.margin*2)*r)},e.qrToImageData=function(t,n,r){let i=n.modules.size,a=n.modules.data,o=e.getScale(i,r),s=Math.floor((i+r.margin*2)*o),c=r.margin*o,l=[r.color.light,r.color.dark];for(let e=0;e<s;e++)for(let n=0;n<s;n++){let u=(e*s+n)*4,d=r.color.light;if(e>=c&&n>=c&&e<s-c&&n<s-c){let t=Math.floor((e-c)/o),r=Math.floor((n-c)/o);d=l[+!!a[t*i+r]]}t[u++]=d.r,t[u++]=d.g,t[u++]=d.b,t[u]=d.a}}})),q=t((e=>{var t=Xe();function n(e,t,n){e.clearRect(0,0,t.width,t.height),t.style||={},t.height=n,t.width=n,t.style.height=n+`px`,t.style.width=n+`px`}function r(){try{return document.createElement(`canvas`)}catch{throw Error(`You need to specify a canvas element`)}}e.render=function(e,i,a){let o=a,s=i;o===void 0&&(!i||!i.getContext)&&(o=i,i=void 0),i||(s=r()),o=t.getOptions(o);let c=t.getImageWidth(e.modules.size,o),l=s.getContext(`2d`),u=l.createImageData(c,c);return t.qrToImageData(u.data,e,o),n(l,s,c),l.putImageData(u,0,0),s},e.renderToDataURL=function(t,n,r){let i=r;i===void 0&&(!n||!n.getContext)&&(i=n,n=void 0),i||={};let a=e.render(t,n,i),o=i.type||`image/png`,s=i.rendererOpts||{};return a.toDataURL(o,s.quality)}})),Ze=t((e=>{var t=Xe();function n(e,t){let n=e.a/255,r=t+`="`+e.hex+`"`;return n<1?r+` `+t+`-opacity="`+n.toFixed(2).slice(1)+`"`:r}function r(e,t,n){let r=e+t;return n!==void 0&&(r+=` `+n),r}function i(e,t,n){let i=``,a=0,o=!1,s=0;for(let c=0;c<e.length;c++){let l=Math.floor(c%t),u=Math.floor(c/t);!l&&!o&&(o=!0),e[c]?(s++,c>0&&l>0&&e[c-1]||(i+=o?r(`M`,l+n,.5+u+n):r(`m`,a,0),a=0,o=!1),l+1<t&&e[c+1]||(i+=r(`h`,s),s=0)):a++}return i}e.render=function(e,r,a){let o=t.getOptions(r),s=e.modules.size,c=e.modules.data,l=s+o.margin*2,u=o.color.light.a?`<path `+n(o.color.light,`fill`)+` d="M0 0h`+l+`v`+l+`H0z"/>`:``,d=`<path `+n(o.color.dark,`stroke`)+` d="`+i(c,s,o.margin)+`"/>`,f=`viewBox="0 0 `+l+` `+l+`"`,p=`<svg xmlns="http://www.w3.org/2000/svg" `+(o.width?`width="`+o.width+`" height="`+o.width+`" `:``)+f+` shape-rendering="crispEdges">`+u+d+`</svg>
|
|
8
|
-
`;return typeof a==`function`&&a(null,p),p}})),J=e(t((e=>{var t=Pe(),n=K(),r=q(),i=Ze();function a(e,r,i,a,o){let s=[].slice.call(arguments,1),c=s.length,l=typeof s[c-1]==`function`;if(!l&&!t())throw Error(`Callback required as last argument`);if(l){if(c<2)throw Error(`Too few arguments provided`);c===2?(o=i,i=r,r=a=void 0):c===3&&(r.getContext&&o===void 0?(o=a,a=void 0):(o=a,a=i,i=r,r=void 0))}else{if(c<1)throw Error(`Too few arguments provided`);return c===1?(i=r,r=a=void 0):c===2&&!r.getContext&&(a=i,i=r,r=void 0),new Promise(function(t,o){try{t(e(n.create(i,a),r,a))}catch(e){o(e)}})}try{let t=n.create(i,a);o(null,e(t,r,a))}catch(e){o(e)}}e.create=n.create,e.toCanvas=a.bind(null,r.render),e.toDataURL=a.bind(null,r.renderToDataURL),e.toString=a.bind(null,function(e,t,n){return i.render(e,n)})}))(),1);function Qe({open:e,onOpenChange:t,ch:n,onSetupSuccess:r}){let[i,o]=(0,A.useState)(!1),[s,c]=(0,A.useState)(`feishu`),[l,u]=(0,A.useState)(null),[d,f]=(0,A.useState)(null),[p,m]=(0,A.useState)(null),[h,g]=(0,A.useState)(null),[v,S]=(0,A.useState)(!1),[w,T]=(0,A.useState)(!0),ee=(0,A.useCallback)(async()=>{m(null),u(null),f(null),o(!0),T(!1);try{let e=await xe({domain:s});f(e.qrUrl),u(e.sessionKey)}catch(e){m(e instanceof Error?e.message:`Start failed`),T(!0)}finally{o(!1)}},[s]);(0,A.useEffect)(()=>{e||(u(null),f(null),m(null),g(null),S(!1),T(!0),o(!1))},[e]),(0,A.useEffect)(()=>{if(!l)return;let e=!1,n,i=async()=>{try{let i=await Se(l);if(e||i.phase===`polling`)return;if(i.phase===`done`){n!==void 0&&(window.clearInterval(n),n=void 0),u(null),i.ok?(f(null),t(!1),r({appId:i.appId,domain:i.domain,openId:i.openId})):(m(i.message),f(null),T(!0));return}i.phase===`unknown`&&(n!==void 0&&window.clearInterval(n),m(i.message),u(null),f(null),T(!0))}catch(t){e||(n!==void 0&&window.clearInterval(n),m(t instanceof Error?t.message:`Request failed`),u(null),f(null),T(!0))}};return n=window.setInterval(()=>void i(),3e3),i(),()=>{e=!0,n!==void 0&&window.clearInterval(n)}},[l,t,r]),(0,A.useEffect)(()=>{if(!d){g(null),S(!1);return}let e=!1;return S(!1),J.toDataURL(d,{width:208,margin:2,errorCorrectionLevel:`M`,color:{dark:`#000000ff`,light:`#ffffffff`}}).then(t=>{e||g(t)}).catch(()=>{e||(S(!0),g(null))}),()=>{e=!0}},[d]);let E=!!(d&&l);return(0,F.jsx)(ce,{open:e,onOpenChange:t,children:(0,F.jsxs)(te,{children:[(0,F.jsx)(y,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim backdrop-blur-[1px]`}),(0,F.jsxs)(ie,{className:a(`fixed left-1/2 top-1/2 z-[60] max-h-[min(90vh,52rem)] w-[min(100%-2rem,32rem)] -translate-x-1/2 -translate-y-1/2`,`overflow-y-auto rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,F.jsx)(_,{asChild:!0,children:(0,F.jsx)(`button`,{type:`button`,className:`absolute right-3 top-3 z-20 rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":n.feishuQrCloseAria,children:(0,F.jsx)(b,{className:`size-4`})})}),(0,F.jsx)(x,{className:`sr-only`,children:n.feishuQrModalTitle}),(0,F.jsx)(se,{className:`sr-only`,children:n.feishuQrModalSubtitle}),(0,F.jsxs)(`div`,{className:`text-center`,children:[(0,F.jsx)(`p`,{className:`text-lg font-semibold tracking-tight text-fg`,children:n.feishuQrModalTitle}),(0,F.jsx)(`p`,{className:`mt-1.5 text-sm text-fg-muted`,children:n.feishuQrModalSubtitle})]}),w&&!E?(0,F.jsxs)(`div`,{className:`mt-6 flex flex-col items-center gap-4`,children:[(0,F.jsxs)(`div`,{className:`flex w-full flex-col gap-1.5`,children:[(0,F.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:`feishu-qr-domain`,children:n.feishuQrDomainLabel}),(0,F.jsxs)(`select`,{id:`feishu-qr-domain`,className:`w-full rounded-lg border border-edge bg-surface px-3 py-2 text-sm text-fg outline-none focus:ring-2 focus:ring-accent/40`,value:s,onChange:e=>c(e.target.value),children:[(0,F.jsx)(`option`,{value:`feishu`,children:`feishu (open.feishu.cn) — China`}),(0,F.jsx)(`option`,{value:`lark`,children:`lark (open.larksuite.com) — International`})]})]}),(0,F.jsx)(D,{type:`button`,variant:`primary`,className:`h-11 w-full rounded-full`,disabled:i,onClick:()=>void ee(),children:i?n.feishuQrStarting:n.feishuQrStartButton})]}):null,(0,F.jsxs)(`div`,{className:`mt-6 flex min-h-[200px] flex-col items-center justify-center`,children:[i&&!E?(0,F.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.feishuQrStarting}):null,p?(0,F.jsx)(`p`,{className:`text-center text-sm text-red-600 dark:text-red-400`,children:p}):null,E&&d&&!p?(0,F.jsxs)(`div`,{className:`flex w-full flex-col items-center gap-3`,children:[(0,F.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.feishuQrScanHint}),h&&!v?(0,F.jsx)(`img`,{src:h,alt:``,className:`h-52 w-52 rounded-lg border border-edge-subtle bg-white object-contain p-3 dark:border-edge`}):null,!h&&!v?(0,F.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.feishuQrEncoding}):null,v?(0,F.jsxs)(`div`,{className:`flex w-full flex-col items-center gap-3`,children:[(0,F.jsx)(`p`,{className:`max-w-[16rem] text-center text-sm text-fg-muted`,children:n.feishuQrImageError}),(0,F.jsxs)(`a`,{href:d,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1.5 text-sm text-accent underline-offset-2 hover:underline`,children:[(0,F.jsx)(C,{className:`size-3.5 shrink-0`}),n.feishuQrOpenLink]})]}):null]}):null]}),E?(0,F.jsx)(`div`,{className:`mt-6`,children:(0,F.jsx)(D,{type:`button`,variant:`secondary`,className:`h-11 w-full rounded-full border-0 bg-fg text-surface-panel hover:opacity-90 dark:bg-fg dark:text-surface-panel`,disabled:i,onClick:()=>void ee(),children:i?n.feishuQrStarting:n.feishuQrRegenerate})}):null]})]})})}function $e({open:e,onOpenChange:t,ch:n,onLoginSuccess:r,moreSettings:i}){let[o,s]=(0,A.useState)(!1),[c,l]=(0,A.useState)(null),[u,d]=(0,A.useState)(null),[f,p]=(0,A.useState)(null),[m,h]=(0,A.useState)(null),[g,v]=(0,A.useState)(null),[S,w]=(0,A.useState)(!1),T=(0,A.useCallback)(async()=>{p(null),h(null),l(null),s(!0);try{let e=await ve();d(e.qrcodeUrl),l(e.sessionKey)}catch(e){p(e instanceof Error?e.message:`Start failed`)}finally{s(!1)}},[]);(0,A.useEffect)(()=>{if(!e){l(null),d(null),p(null),v(null),w(!1),h(null);return}T()},[e,T]),(0,A.useEffect)(()=>{if(!c)return;let e=!1,i,a=async()=>{try{let a=await ye(c);if(e)return;if(a.phase===`polling`){d(a.qrcodeUrl),a.qrStatus===`scaned`?h(n.weixinQrLoginScanned):h(null);return}if(a.phase===`done`){i!==void 0&&(window.clearInterval(i),i=void 0),l(null),a.ok?(d(null),t(!1),await r()):(p(a.message),d(null));return}a.phase===`unknown`&&h(null)}catch(t){e||(i!==void 0&&window.clearInterval(i),p(t instanceof Error?t.message:`Request failed`),l(null),d(null))}};return i=window.setInterval(()=>void a(),2e3),a(),()=>{e=!0,i!==void 0&&window.clearInterval(i)}},[c,n.weixinQrLoginScanned,n.weixinQrLoginSuccess,r,t]),(0,A.useEffect)(()=>{if(!u){v(null),w(!1);return}let e=!1;return w(!1),J.toDataURL(u,{width:208,margin:2,errorCorrectionLevel:`M`,color:{dark:`#000000ff`,light:`#ffffffff`}}).then(t=>{e||v(t)}).catch(()=>{e||(w(!0),v(null))}),()=>{e=!0}},[u]);let ee=!!(u&&c);return(0,F.jsx)(ce,{open:e,onOpenChange:t,children:(0,F.jsxs)(te,{children:[(0,F.jsx)(y,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim backdrop-blur-[1px]`}),(0,F.jsxs)(ie,{className:a(`fixed left-1/2 top-1/2 z-[60] max-h-[min(90vh,52rem)] w-[min(100%-2rem,32rem)] -translate-x-1/2 -translate-y-1/2`,`overflow-y-auto rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,F.jsx)(_,{asChild:!0,children:(0,F.jsx)(`button`,{type:`button`,className:`absolute right-3 top-3 z-20 rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":n.weixinQrModalCloseAria,children:(0,F.jsx)(b,{className:`size-4`})})}),(0,F.jsx)(x,{className:`sr-only`,children:n.weixinQrModalTitle}),(0,F.jsx)(se,{className:`sr-only`,children:n.weixinQrModalSubtitle}),(0,F.jsxs)(`div`,{className:`text-center`,children:[(0,F.jsx)(`p`,{className:`text-lg font-semibold tracking-tight text-fg`,children:n.weixinQrModalTitle}),(0,F.jsx)(`p`,{className:`mt-1.5 text-sm text-fg-muted`,children:n.weixinQrModalSubtitle})]}),(0,F.jsxs)(`div`,{className:`mt-6 flex min-h-[200px] flex-col items-center justify-center`,children:[o&&!ee?(0,F.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.weixinQrLoginBusy}):null,f?(0,F.jsx)(`p`,{className:`text-center text-sm text-red-600 dark:text-red-400`,children:f}):null,m&&!f?(0,F.jsx)(`p`,{className:`mb-3 text-center text-sm text-accent`,children:m}):null,ee&&u&&!f?(0,F.jsxs)(`div`,{className:`flex w-full flex-col items-center gap-3`,children:[g&&!S?(0,F.jsx)(`img`,{src:g,alt:``,className:`h-52 w-52 rounded-lg border border-edge-subtle bg-white object-contain p-3 dark:border-edge`}):null,!g&&!S?(0,F.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.weixinQrEncoding}):null,S?(0,F.jsxs)(`div`,{className:`flex w-full flex-col items-center gap-3`,children:[(0,F.jsx)(`p`,{className:`max-w-[16rem] text-center text-sm text-fg-muted`,children:n.weixinQrImageError}),(0,F.jsxs)(`a`,{href:u,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1.5 text-sm text-accent underline-offset-2 hover:underline`,children:[(0,F.jsx)(C,{className:`size-3.5 shrink-0`}),n.weixinQrOpenLink]})]}):null]}):null]}),(0,F.jsx)(`div`,{className:`mt-6`,children:(0,F.jsx)(D,{type:`button`,variant:`secondary`,className:`h-11 w-full rounded-full border-0 bg-fg text-surface-panel hover:opacity-90 dark:bg-fg dark:text-surface-panel`,disabled:o,onClick:()=>void T(),children:o?n.weixinQrLoginBusy:n.weixinQrRegenerate})}),i?(0,F.jsx)(`div`,{className:`mt-6 border-t border-edge-subtle pt-4 dark:border-edge-subtle`,children:i}):null]})]})})}function et(){let e=Ce,t=p(e=>e.language),n=re(t),r=n.channelsSettings,s=!!oe(e=>e.token),[m,h]=(0,A.useState)(null),[g,S]=(0,A.useState)(null),[w,T]=(0,A.useState)(!1),[ne,O]=(0,A.useState)(null),[le,k]=(0,A.useState)(!1),[ue,de]=(0,A.useState)(!1),[fe,j]=(0,A.useState)(!1),[pe,M]=(0,A.useState)(!1),[N,P]=(0,A.useState)(null),[ve,ye]=(0,A.useState)(null),[xe,Se]=(0,A.useState)(!1),[we,R]=(0,A.useState)(null),[Pe,z]=(0,A.useState)(!1),[B,Fe]=(0,A.useState)(!1),[Ie,Le]=(0,A.useState)(!1),[Re,ze]=(0,A.useState)(!1),[Be,Ve]=(0,A.useState)(!1),[He,Ue]=(0,A.useState)(!1),[We,Ge]=(0,A.useState)(!1),[V,H]=(0,A.useState)(``),[Ke,U]=(0,A.useState)(``),[qe,W]=(0,A.useState)(``),[Je,G]=(0,A.useState)(``),[Ye,K]=(0,A.useState)(``),[Xe,q]=(0,A.useState)(``),{data:Ze}=i(s?`gateway-chat-agents-ch`:null,ee,{revalidateOnFocus:!1}),{data:J,error:et,isLoading:tt,mutate:nt}=o(s),Y=(0,A.useMemo)(()=>J?.payload?.config===void 0?null:_e(J.payload.config),[J]),rt=(0,A.useMemo)(()=>!m||!g?!1:JSON.stringify(m)!==JSON.stringify(g),[m,g]);(0,A.useEffect)(()=>{if(!s){h(null),S(null);return}Y!==null&&(rt||(h(Y),S(structuredClone(Y)),H(JSON.stringify(Y.telegram.accounts??{},null,2)),U(``),W(JSON.stringify(Y.weixin.accounts??{},null,2)),G(``),K(JSON.stringify(Y.feishu?.accounts??{},null,2)),q(``),k(!1)))},[s,Y,rt]);let it=!!(s&&tt&&J===void 0&&!et),at=et instanceof Error?et.message:et?String(et):null,ot=(0,A.useCallback)((e,t,n)=>{h(r=>{if(!r)return null;let i=e===`telegram`?`telegram`:e===`weixin`?`weixin`:`feishu`;return{...r,channelAgentRoutes:{...r.channelAgentRoutes,[i]:{...r.channelAgentRoutes[i],[t]:n.trim().toLowerCase()}}}})},[]),X=(0,A.useCallback)(e=>{h(t=>t?{...t,telegram:{...t.telegram,...e}}:null)},[]),st=(0,A.useCallback)(e=>{h(t=>t?{...t,weixin:{...t.weixin,...e}}:null)},[]),Z=(0,A.useCallback)(e=>{h(t=>t?{...t,feishu:{...t.feishu,...e}}:null)},[]),ct=(0,A.useCallback)(async()=>{if(!m||w)return!1;T(!0),O(null),k(!1);try{let e=await be(m);h(e);let t=structuredClone(e);return S(t),H(JSON.stringify(t.telegram.accounts??{},null,2)),U(``),W(JSON.stringify(t.weixin.accounts??{},null,2)),G(``),K(JSON.stringify(t.feishu?.accounts??{},null,2)),q(``),k(!0),window.setTimeout(()=>k(!1),2500),!0}catch(e){return O(e instanceof Error?e.message:r.saveError),!1}finally{T(!1)}},[m,w,r.saveError]),lt=(0,A.useCallback)(async(e,t)=>{if(!m||w)return;let n=m,i=e===`weixin`?{...m,weixin:{...m.weixin,enabled:t}}:e===`telegram`?{...m,telegram:{...m.telegram,enabled:t}}:{...m,feishu:{...m.feishu,enabled:t}};h(i),T(!0),O(null);try{let e=await be(i);h(e);let t=structuredClone(e);S(t),H(JSON.stringify(t.telegram.accounts??{},null,2)),W(JSON.stringify(t.weixin.accounts??{},null,2)),K(JSON.stringify(t.feishu?.accounts??{},null,2))}catch(e){O(e instanceof Error?e.message:r.saveError),h(n)}finally{T(!1)}},[m,w,r.saveError]),ut=(0,A.useCallback)(async()=>{if(!m||!N||w)return;let e=ge(),t=N===`weixin`?{...m,weixin:e.weixin}:N===`telegram`?{...m,telegram:e.telegram}:{...m,feishu:e.feishu};T(!0),O(null);try{let e=await be(t);h(e);let n=structuredClone(e);S(n),H(JSON.stringify(n.telegram.accounts??{},null,2)),W(JSON.stringify(n.weixin.accounts??{},null,2)),U(``),G(``),K(JSON.stringify(n.feishu?.accounts??{},null,2)),q(``),P(null),k(!0),window.setTimeout(()=>k(!1),2500)}catch(e){O(e instanceof Error?e.message:r.saveError)}finally{T(!1)}},[m,N,w,r.saveError]),dt=(0,A.useCallback)(async()=>{let e=m?.telegram.botToken;e&&(await navigator.clipboard.writeText(e).catch(()=>{}),Ve(!0),window.setTimeout(()=>Ve(!1),2e3))},[m?.telegram.botToken]),ft=(0,A.useCallback)(e=>{Z({appId:e.appId,domain:e.domain,enabled:!0}),nt(),R(r.feishuQrSetupSuccess),window.setTimeout(()=>R(null),4e3)},[Z,nt,r.feishuQrSetupSuccess]),pt=(0,A.useCallback)(async()=>{let e=m?.feishu?.appSecret;e&&(await navigator.clipboard.writeText(e).catch(()=>{}),Ue(!0),window.setTimeout(()=>Ue(!1),2e3))},[m]),mt=(0,A.useCallback)(async()=>{let e=m?.feishu;if(!e)return;let t={connectionMode:e.connectionMode,verificationToken:e.verificationToken||``,encryptKey:e.encryptKey||``,webhookHost:e.webhookHost||``,webhookPort:e.webhookPort||0,webhookPath:e.webhookPath||``};await navigator.clipboard.writeText(JSON.stringify(t,null,2)).catch(()=>{}),Ge(!0),window.setTimeout(()=>Ge(!1),2e3)},[m]),ht=(0,A.useCallback)(()=>{if(!m)return;let e=V.trim();if(!e){X({accounts:{}}),U(``);return}try{let t=JSON.parse(e);if(typeof t!=`object`||!t||Array.isArray(t))throw Error(r.jsonObjectAccounts);X({accounts:t}),U(``)}catch(e){U(e instanceof Error?e.message:r.jsonInvalid)}},[m,V,X,r.jsonObjectAccounts,r.jsonInvalid]),gt=(0,A.useCallback)(()=>{if(!m)return;let e=qe.trim();if(!e){st({accounts:{}}),G(``);return}try{let t=JSON.parse(e);if(typeof t!=`object`||!t||Array.isArray(t))throw Error(r.jsonObjectAccounts);st({accounts:t}),G(``)}catch(e){G(e instanceof Error?e.message:r.jsonInvalid)}},[m,qe,st,r.jsonObjectAccounts,r.jsonInvalid]),_t=(0,A.useCallback)(()=>{if(!m)return;let e=Ye.trim();if(!e){Z({accounts:{}}),q(``);return}try{let t=JSON.parse(e);if(typeof t!=`object`||!t||Array.isArray(t))throw Error(r.jsonObjectAccounts);Z({accounts:t}),q(``)}catch(e){q(e instanceof Error?e.message:r.jsonInvalid)}},[m,Ye,Z,r.jsonObjectAccounts,r.jsonInvalid]),vt=(0,A.useMemo)(()=>[`pairing`,`allowlist`,`open`,`disabled`].map(e=>({value:e,label:r.policy.dm[e]})),[r.policy.dm]),yt=(0,A.useMemo)(()=>[`open`,`disabled`,`allowlist`].map(e=>({value:e,label:r.policy.group[e]})),[r.policy.group]),bt=(0,A.useMemo)(()=>[`off`,`first`,`all`].map(e=>({value:e,label:r.policy.reply[e]})),[r.policy.reply]),xt=(0,A.useMemo)(()=>[`off`,`partial`,`block`].map(e=>({value:e,label:r.policy.stream[e]})),[r.policy.stream]);if(!s)return(0,F.jsxs)(`div`,{className:`mx-auto flex w-full max-w-app-main flex-col gap-3 px-4 py-8`,children:[(0,F.jsx)(`h1`,{className:`text-lg font-semibold text-fg`,children:n.settingsSections.channels}),(0,F.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r.needToken})]});if(it)return(0,F.jsxs)(`div`,{className:`mx-auto w-full max-w-app-main px-4 py-8`,children:[(0,F.jsx)(`div`,{className:`h-8 w-48 animate-pulse rounded bg-surface-hover`}),(0,F.jsx)(`div`,{className:`mt-6 h-32 animate-pulse rounded-xl bg-surface-hover`}),(0,F.jsx)(`p`,{className:`mt-4 text-sm text-fg-muted`,children:r.loading})]});if(!m)return(0,F.jsxs)(`div`,{className:`mx-auto flex w-full max-w-app-main flex-col gap-3 px-4 py-8`,children:[(0,F.jsx)(`p`,{className:`text-sm text-fg-muted`,children:ne??at??r.loadError}),(0,F.jsx)(D,{type:`button`,variant:`secondary`,onClick:()=>void nt(),children:r.retry})]});let Q=m.telegram,St=m.weixin,$=m.feishu,Ct=g?.telegram?.botToken??``,wt=!B&&!!String(Ct).trim()&&Q.botToken===Ct,Tt=g?.feishu?.appSecret??``,Et=!Ie&&!!String(Tt).trim()&&$.appSecret===Tt,Dt=Oe(St),Ot=De(Q),kt=ke($),At=(0,F.jsxs)(`details`,{className:`group rounded-xl border border-edge-subtle bg-surface-base open:pb-3 dark:border-edge`,children:[(0,F.jsx)(`summary`,{className:`cursor-pointer list-none px-3 py-2.5 text-sm font-medium text-fg transition-colors hover:bg-surface-hover [&::-webkit-details-marker]:hidden`,children:(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,F.jsx)(u,{className:`size-4 shrink-0 text-fg-muted transition-transform group-open:rotate-180`}),r.advancedShow]})}),(0,F.jsxs)(`div`,{className:`space-y-4 border-t border-edge-subtle px-3 pb-3 pt-3 dark:border-edge-subtle`,children:[(0,F.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-muted`,children:r.weixinAdvancedHint}),(0,F.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,F.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:St.enabled,onChange:e=>st({enabled:e.target.checked})}),(0,F.jsx)(`span`,{children:r.enableWeixinAria})]}),(0,F.jsx)(`div`,{className:`[&>div]:border-0 [&>div]:pt-0`,children:(0,F.jsx)(Ne,{wx:St,updateWeixin:st,ch:r,dmOpts:vt,streamOpts:xt,wxAccountsDraft:qe,setWxAccountsDraft:W,wxAccountsError:Je,onWxAccountsBlur:gt,channelAgentRoutesWx:m.channelAgentRoutes.weixin,defaultAgentId:m.defaultAgentId,agentItems:Ze?.items??[],onAgentRouteChange:(e,t)=>ot(`weixin`,e,t),routingDisabled:w})}),(0,F.jsx)(D,{type:`button`,variant:`primary`,className:`w-full`,disabled:!rt||w,onClick:async()=>{await ct()},children:w?r.saving:r.save})]})]});return(0,F.jsx)(`div`,{className:`mx-auto flex w-full max-w-app-main flex-col gap-6 px-4 py-6`,children:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`header`,{className:`flex flex-col gap-1`,children:[(0,F.jsx)(`h1`,{className:`text-lg font-semibold tracking-tight text-fg`,children:n.settingsSections.channels}),(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r.subtitle}),(0,F.jsxs)(`a`,{href:l(t,`channels`),target:`_blank`,rel:`noreferrer`,className:`mt-1 inline-flex items-center gap-1 text-sm text-accent hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,children:[r.docsLink,(0,F.jsx)(C,{className:`size-3.5`})]})]}),rt?(0,F.jsx)(`p`,{className:`text-xs text-amber-800 dark:text-amber-200`,children:r.unsavedHint}):null,le?(0,F.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.saved}):null,ne?(0,F.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:ne}):null,ve?(0,F.jsx)(`p`,{className:`text-xs text-accent`,children:ve}):null,we?(0,F.jsx)(`div`,{className:`rounded-xl border border-success/30 bg-success-soft px-4 py-3 text-sm text-success`,children:we}):null,(0,F.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,F.jsx)(je,{icon:(0,F.jsx)(c,{className:`size-6 text-accent`,strokeWidth:1.75}),title:r.weixinTitle,subtitle:r.weixinSubtitle,configured:Dt,enabled:St.enabled,toggleDisabled:w,onToggle:e=>void lt(`weixin`,e),onConfigure:()=>de(!0),onEdit:()=>de(!0),onRemove:()=>P(`weixin`),ch:r}),(0,F.jsx)(je,{icon:(0,F.jsx)(d,{className:`size-6 text-accent`,strokeWidth:1.75}),title:r.telegramTitle,subtitle:r.telegramSubtitle,configured:Ot,enabled:Q.enabled,toggleDisabled:w,onToggle:e=>void lt(`telegram`,e),onConfigure:()=>j(!0),onEdit:()=>j(!0),onRemove:()=>P(`telegram`),ch:r}),(0,F.jsx)(je,{icon:(0,F.jsx)(c,{className:`size-6 text-accent`,strokeWidth:1.75}),title:r.feishuTitle,subtitle:r.feishuSubtitle,configured:kt,enabled:$.enabled,toggleDisabled:w,onToggle:e=>void lt(`feishu`,e),onConfigure:()=>M(!0),onEdit:()=>M(!0),onRemove:()=>P(`feishu`),ch:r})]}),(0,F.jsx)($e,{open:ue,onOpenChange:de,ch:r,onLoginSuccess:async()=>{await nt(),ye(r.weixinQrLoginSuccess),window.setTimeout(()=>ye(null),4e3)},moreSettings:At}),(0,F.jsx)(Qe,{open:xe,onOpenChange:Se,ch:r,onSetupSuccess:ft}),(0,F.jsx)(ce,{open:fe,onOpenChange:j,children:(0,F.jsxs)(te,{children:[(0,F.jsx)(y,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim backdrop-blur-[1px]`}),(0,F.jsxs)(ie,{className:a(`fixed left-1/2 top-1/2 z-[60] max-h-[min(90vh,48rem)] w-[min(100%-2rem,36rem)] -translate-x-1/2 -translate-y-1/2`,`overflow-y-auto rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,F.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(x,{className:`text-lg font-semibold tracking-tight text-fg`,children:r.telegramTitle}),(0,F.jsx)(se,{className:`mt-1 text-sm text-fg-muted`,children:r.telegramSubtitle})]}),(0,F.jsx)(_,{asChild:!0,children:(0,F.jsx)(`button`,{type:`button`,className:`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":r.modalCancel,children:(0,F.jsx)(b,{className:`size-4`})})})]}),(0,F.jsxs)(`label`,{className:`mt-6 flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[(0,F.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:Q.enabled,onChange:e=>X({enabled:e.target.checked})}),(0,F.jsx)(`span`,{children:r.enableTelegramAria})]}),(0,F.jsxs)(`div`,{className:`mt-6 space-y-4`,children:[(0,F.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,F.jsxs)(I,{children:[r.telegramToken,(0,F.jsx)(`span`,{className:`text-red-600 dark:text-red-400`,children:` *`})]}),(0,F.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,F.jsx)(`input`,{className:a(e(),`min-w-0 flex-1 font-mono text-xs`),type:B?`text`:`password`,autoComplete:`off`,readOnly:wt,value:wt?`*`.repeat(Math.max(1,Q.botToken.length)):Q.botToken,onChange:e=>{wt||X({botToken:e.target.value})},placeholder:`123456789:ABCdefGHIjklMNOpqrsTUVwxyz`}),Q.botToken?(0,F.jsxs)(D,{type:`button`,variant:`secondary`,className:`px-2 py-1 text-xs`,onClick:()=>void dt(),children:[Be?(0,F.jsx)(f,{className:`size-3.5`}):(0,F.jsx)(v,{className:`size-3.5`}),Be?r.copied:r.copy]}):null,(0,F.jsxs)(D,{type:`button`,variant:`secondary`,className:`px-2 py-1 text-xs`,onClick:()=>Fe(e=>!e),children:[B?(0,F.jsx)(E,{className:`size-3.5`}):(0,F.jsx)(ae,{className:`size-3.5`}),B?r.hide:r.show]})]}),(0,F.jsx)(L,{children:r.telegramTokenDesc})]}),(0,F.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,F.jsx)(I,{children:r.allowFromDm}),(0,F.jsx)(`textarea`,{className:a(e(),`min-h-[2.75rem] resize-y font-mono text-xs`),rows:2,placeholder:`123456789, 987654321`,value:Ee(Q.allowFrom),onChange:e=>X({allowFrom:Te(e.target.value)})}),(0,F.jsx)(L,{children:r.allowFromDmDesc})]}),m?(0,F.jsx)(Ae,{accountIds:me(Q),routes:m.channelAgentRoutes.telegram,defaultAgentId:m.defaultAgentId,agentItems:Ze?.items??[],disabled:w,onChange:(e,t)=>ot(`telegram`,e,t),ch:r}):null,(0,F.jsxs)(D,{type:`button`,variant:`ghost`,className:`-ml-2 h-auto justify-start px-2 py-1 text-sm text-fg-muted hover:text-fg`,onClick:()=>z(e=>!e),children:[(0,F.jsx)(u,{className:a(`mr-1 size-4 transition-transform`,Pe&&`rotate-180`)}),Pe?r.advancedHide:r.advancedShow]}),Pe?(0,F.jsx)(Me,{tg:Q,updateTelegram:X,ch:r,dmOpts:vt,groupOpts:yt,replyOpts:bt,streamOpts:xt,tgAccountsDraft:V,setTgAccountsDraft:H,tgAccountsError:Ke,onTgAccountsBlur:ht}):null]}),(0,F.jsxs)(`div`,{className:`mt-8 flex flex-wrap justify-end gap-2 border-t border-edge-subtle pt-4 dark:border-edge-subtle`,children:[(0,F.jsx)(D,{type:`button`,variant:`secondary`,onClick:()=>j(!1),children:r.modalCancel}),(0,F.jsx)(D,{type:`button`,variant:`primary`,disabled:!rt||w,onClick:async()=>{await ct()&&j(!1)},children:w?r.saving:r.save})]})]})]})}),(0,F.jsx)(ce,{open:pe,onOpenChange:M,children:(0,F.jsxs)(te,{children:[(0,F.jsx)(y,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim backdrop-blur-[1px]`}),(0,F.jsxs)(ie,{className:a(`fixed left-1/2 top-1/2 z-[60] max-h-[min(90vh,48rem)] w-[min(100%-2rem,36rem)] -translate-x-1/2 -translate-y-1/2`,`overflow-y-auto rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,F.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(x,{className:`text-lg font-semibold tracking-tight text-fg`,children:r.feishuTitle}),(0,F.jsx)(se,{className:`mt-1 text-sm text-fg-muted`,children:r.feishuSubtitle})]}),(0,F.jsx)(_,{asChild:!0,children:(0,F.jsx)(`button`,{type:`button`,className:`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":r.modalCancel,children:(0,F.jsx)(b,{className:`size-4`})})})]}),(0,F.jsxs)(`label`,{className:`mt-6 flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[(0,F.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:$.enabled,onChange:e=>Z({enabled:e.target.checked})}),(0,F.jsx)(`span`,{children:r.enableFeishuAria})]}),kt?null:(0,F.jsx)(`div`,{className:`mt-6 rounded-xl border border-dashed border-accent/40 bg-accent/5 px-4 py-3 dark:bg-accent/10`,children:(0,F.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.feishuQrSetupTitle}),(0,F.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:r.feishuQrSetupDesc})]}),(0,F.jsx)(D,{type:`button`,variant:`primary`,className:`shrink-0`,onClick:()=>Se(!0),children:r.feishuQrSetupButton})]})}),(0,F.jsxs)(`div`,{className:`mt-6 space-y-4`,children:[(0,F.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,F.jsxs)(I,{children:[r.feishuAppId,(0,F.jsx)(`span`,{className:`text-red-600 dark:text-red-400`,children:` *`})]}),(0,F.jsx)(`input`,{className:a(e(),`min-w-0 flex-1 font-mono text-xs`),value:$.appId,onChange:e=>Z({appId:e.target.value}),placeholder:`cli_xxx`}),(0,F.jsx)(L,{children:r.feishuAppIdDesc})]}),(0,F.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,F.jsxs)(I,{children:[r.feishuAppSecret,(0,F.jsx)(`span`,{className:`text-red-600 dark:text-red-400`,children:` *`})]}),(0,F.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,F.jsx)(`input`,{className:a(e(),`min-w-0 flex-1 font-mono text-xs`),type:Ie?`text`:`password`,autoComplete:`off`,readOnly:Et,value:Et?`*`.repeat(Math.max(1,$.appSecret.length)):$.appSecret,onChange:e=>{Et||Z({appSecret:e.target.value})},placeholder:`••••••••`}),$.appSecret?(0,F.jsxs)(D,{type:`button`,variant:`secondary`,className:`px-2 py-1 text-xs`,onClick:()=>void pt(),children:[He?(0,F.jsx)(f,{className:`size-3.5`}):(0,F.jsx)(v,{className:`size-3.5`}),He?r.copied:r.copy]}):null,(0,F.jsxs)(D,{type:`button`,variant:`secondary`,className:`px-2 py-1 text-xs`,onClick:()=>Le(e=>!e),children:[Ie?(0,F.jsx)(E,{className:`size-3.5`}):(0,F.jsx)(ae,{className:`size-3.5`}),Ie?r.hide:r.show]})]}),(0,F.jsx)(L,{children:r.feishuAppSecretDesc})]}),(0,F.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,F.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,F.jsx)(I,{children:r.feishuDomain}),(0,F.jsxs)(`select`,{className:e(),value:String($.domain||`feishu`),onChange:e=>Z({domain:e.target.value}),children:[(0,F.jsx)(`option`,{value:`feishu`,children:`feishu`}),(0,F.jsx)(`option`,{value:`lark`,children:`lark`})]})]}),(0,F.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,F.jsx)(I,{children:r.connectionMode}),(0,F.jsxs)(`select`,{className:e(),value:$.connectionMode,onChange:e=>Z({connectionMode:e.target.value}),children:[(0,F.jsx)(`option`,{value:`websocket`,children:`websocket`}),(0,F.jsx)(`option`,{value:`webhook`,children:`webhook`})]}),(0,F.jsx)(L,{children:r.connectionModeDesc})]})]}),$.connectionMode===`webhook`?(0,F.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface px-4 py-3 dark:border-edge-subtle`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,F.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:r.webhookTitle}),(0,F.jsxs)(`div`,{className:`flex gap-2`,children:[(0,F.jsxs)(D,{type:`button`,variant:`secondary`,className:`px-2 py-1 text-xs`,onClick:()=>ze(e=>!e),children:[Re?(0,F.jsx)(E,{className:`size-3.5`}):(0,F.jsx)(ae,{className:`size-3.5`}),Re?r.hide:r.show]}),(0,F.jsxs)(D,{type:`button`,variant:`secondary`,className:`px-2 py-1 text-xs`,onClick:()=>void mt(),children:[We?(0,F.jsx)(f,{className:`size-3.5`}):(0,F.jsx)(v,{className:`size-3.5`}),We?r.copied:r.copy]})]})]}),(0,F.jsxs)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:[(0,F.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,F.jsx)(I,{children:r.verificationToken}),(0,F.jsx)(`input`,{className:a(e(),`min-w-0 flex-1 font-mono text-xs`),type:Re?`text`:`password`,autoComplete:`off`,value:$.verificationToken??``,onChange:e=>Z({verificationToken:e.target.value})}),(0,F.jsx)(L,{children:r.verificationTokenDesc})]}),(0,F.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,F.jsx)(I,{children:r.encryptKey}),(0,F.jsx)(`input`,{className:a(e(),`min-w-0 flex-1 font-mono text-xs`),type:Re?`text`:`password`,autoComplete:`off`,value:$.encryptKey??``,onChange:e=>Z({encryptKey:e.target.value})}),(0,F.jsx)(L,{children:r.encryptKeyDesc})]})]}),(0,F.jsxs)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-3`,children:[(0,F.jsxs)(`div`,{className:`flex flex-col gap-1.5 sm:col-span-2`,children:[(0,F.jsx)(I,{children:r.webhookHost}),(0,F.jsx)(`input`,{className:a(e(),`min-w-0 flex-1 font-mono text-xs`),value:$.webhookHost??``,onChange:e=>Z({webhookHost:e.target.value}),placeholder:`127.0.0.1`})]}),(0,F.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,F.jsx)(I,{children:r.webhookPort}),(0,F.jsx)(`input`,{className:a(e(),`min-w-0 flex-1 font-mono text-xs`),type:`number`,inputMode:`numeric`,value:String($.webhookPort??``),onChange:e=>Z({webhookPort:Number(e.target.value||`0`)||0}),placeholder:`3000`})]})]}),(0,F.jsxs)(`div`,{className:`mt-3 flex flex-col gap-1.5`,children:[(0,F.jsx)(I,{children:r.webhookPath}),(0,F.jsx)(`input`,{className:a(e(),`min-w-0 flex-1 font-mono text-xs`),value:$.webhookPath??``,onChange:e=>Z({webhookPath:e.target.value}),placeholder:`/feishu/events`}),(0,F.jsx)(L,{children:r.webhookPathDesc})]})]}):null,(0,F.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,F.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,F.jsx)(I,{children:r.renderMode}),(0,F.jsxs)(`select`,{className:e(),value:$.renderMode,onChange:e=>Z({renderMode:e.target.value}),children:[(0,F.jsx)(`option`,{value:`auto`,children:`auto`}),(0,F.jsx)(`option`,{value:`raw`,children:`raw`}),(0,F.jsx)(`option`,{value:`card`,children:`card`})]})]}),(0,F.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,F.jsx)(I,{children:r.reactionNotifications}),(0,F.jsxs)(`select`,{className:e(),value:$.reactionNotifications,onChange:e=>Z({reactionNotifications:e.target.value}),children:[(0,F.jsx)(`option`,{value:`off`,children:`off`}),(0,F.jsx)(`option`,{value:`own`,children:`own`}),(0,F.jsx)(`option`,{value:`all`,children:`all`})]})]})]}),(0,F.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[(0,F.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:$.streaming,onChange:e=>Z({streaming:e.target.checked})}),r.enableStreaming]}),(0,F.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,F.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,F.jsx)(I,{children:r.dmPolicy}),(0,F.jsx)(`select`,{className:e(),value:$.dmPolicy,onChange:e=>Z({dmPolicy:e.target.value}),children:vt.map(e=>(0,F.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),(0,F.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,F.jsx)(I,{children:r.groupPolicy}),(0,F.jsx)(`select`,{className:e(),value:$.groupPolicy,onChange:e=>Z({groupPolicy:e.target.value}),children:yt.map(e=>(0,F.jsx)(`option`,{value:e.value,children:e.label},e.value))})]})]}),(0,F.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[(0,F.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:$.requireMention,onChange:e=>Z({requireMention:e.target.checked})}),r.requireMention]}),(0,F.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,F.jsx)(I,{children:r.allowFromDm}),(0,F.jsx)(`textarea`,{className:a(e(),`min-h-[2.75rem] resize-y font-mono text-xs`),rows:2,placeholder:`ou_xxx, on_xxx`,value:Ee($.allowFrom),onChange:e=>Z({allowFrom:Te(e.target.value)})}),(0,F.jsx)(L,{children:r.allowFromDmDesc})]}),(0,F.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,F.jsx)(I,{children:r.allowFromGroups}),(0,F.jsx)(`textarea`,{className:a(e(),`min-h-[2.75rem] resize-y font-mono text-xs`),rows:2,placeholder:`oc_xxx, oc_yyy`,value:Ee($.groupAllowFrom),onChange:e=>Z({groupAllowFrom:Te(e.target.value)})}),(0,F.jsx)(L,{children:r.allowFromGroupsDesc})]}),(0,F.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,F.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,F.jsx)(I,{children:r.historyLimit}),(0,F.jsx)(`input`,{className:a(e(),`min-w-0 flex-1 font-mono text-xs`),type:`number`,inputMode:`numeric`,value:String($.historyLimit),onChange:e=>Z({historyLimit:Number(e.target.value||`0`)||0})})]}),(0,F.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,F.jsx)(I,{children:r.textChunkLimit}),(0,F.jsx)(`input`,{className:a(e(),`min-w-0 flex-1 font-mono text-xs`),type:`number`,inputMode:`numeric`,value:String($.textChunkLimit),onChange:e=>Z({textChunkLimit:Number(e.target.value||`0`)||0})})]})]}),(0,F.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface px-4 py-3 dark:border-edge-subtle`,children:[(0,F.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:r.feishuToolsTitle}),(0,F.jsx)(`div`,{className:`mt-2 grid gap-2 sm:grid-cols-2`,children:[[`doc`,r.feishuToolDoc],[`wiki`,r.feishuToolWiki],[`drive`,r.feishuToolDrive],[`perm`,r.feishuToolPerm],[`bitable`,r.feishuToolBitable],[`scopes`,r.feishuToolScopes]].map(([e,t])=>(0,F.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[(0,F.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:!!$.tools?.[e],onChange:t=>Z({tools:{...$.tools,[e]:t.target.checked}})}),t]},e))}),(0,F.jsx)(`div`,{className:`mt-2`,children:(0,F.jsx)(L,{children:r.feishuToolsDesc})})]}),(0,F.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface px-4 py-3 dark:border-edge-subtle`,children:[(0,F.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:r.feishuActionsTitle}),(0,F.jsxs)(`label`,{className:`mt-2 flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[(0,F.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:!!$.actions?.reactions,onChange:e=>Z({actions:{...$.actions,reactions:e.target.checked}})}),r.feishuActionReactions]})]}),m?(0,F.jsx)(Ae,{accountIds:he($),routes:m.channelAgentRoutes.feishu,defaultAgentId:m.defaultAgentId,agentItems:Ze?.items??[],disabled:w,onChange:(e,t)=>ot(`feishu`,e,t),ch:r}):null,(0,F.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,F.jsx)(I,{children:r.multiAccountJson}),(0,F.jsx)(`textarea`,{className:a(e(),`min-h-[140px] resize-y font-mono text-xs`),spellCheck:!1,value:Ye,onChange:e=>K(e.target.value),onBlur:_t,placeholder:`{ "default": { "appId": "...", "appSecret": "...", "enabled": true } }`}),Xe?(0,F.jsx)(`p`,{className:`text-xs text-red-600 dark:text-red-400`,children:Xe}):(0,F.jsx)(L,{children:r.multiAccountJsonDesc})]})]}),(0,F.jsxs)(`div`,{className:`mt-8 flex flex-wrap justify-end gap-2 border-t border-edge-subtle pt-4 dark:border-edge-subtle`,children:[(0,F.jsx)(D,{type:`button`,variant:`secondary`,onClick:()=>M(!1),children:r.modalCancel}),(0,F.jsx)(D,{type:`button`,variant:`primary`,disabled:!rt||w,onClick:async()=>{await ct()&&M(!1)},children:w?r.saving:r.save})]})]})]})}),(0,F.jsx)(ce,{open:N!==null,onOpenChange:e=>!e&&P(null),children:(0,F.jsxs)(te,{children:[(0,F.jsx)(y,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim backdrop-blur-[1px]`}),(0,F.jsxs)(ie,{className:a(`fixed left-1/2 top-1/2 z-[70] w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,F.jsx)(x,{className:`text-base font-semibold text-fg`,children:r.removeChannelTitle}),(0,F.jsx)(se,{className:`mt-2 text-sm text-fg-muted`,children:N?r.removeChannelConfirm.replace(`{{name}}`,N===`weixin`?r.weixinTitle:N===`telegram`?r.telegramTitle:r.feishuTitle):`\xA0`}),(0,F.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,F.jsx)(D,{type:`button`,variant:`secondary`,onClick:()=>P(null),children:r.modalCancel}),(0,F.jsx)(D,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:w,onClick:()=>void ut(),children:w?r.saving:r.removeChannelAction})]})]})]})})]})})}export{et as ChannelsSettingsPanel};
|
|
9
|
-
//# sourceMappingURL=channels-settings-CeGoU9v8.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{i as t,t as n}from"./vendor-react-DbimaAId.js";import{t as r}from"./cn-BMCV0OMB.js";import{Cr as i,Gr as a,H as o,Kt as s,Pn as c,Qt as ee,U as te,V as ne,Zn as re,Zt as ie,_r as ae,at as l,ct as u,d as oe,dn as d,dt as se,h as ce,in as f,it as le,jn as ue,l as de,lr as fe,lt as p,m as pe,nn as m,on as me,ot as h,pr as he,qn as g,qt as ge,rr as _e,rt as ve,sn as _,tn as v,ut as ye,xn as be}from"./index-DwzwDCjW.js";import{C as xe,S as Se,_ as Ce,a as we,b as Te,c as Ee,d as De,f as Oe,g as ke,h as Ae,i as je,l as Me,m as Ne,n as Pe,o as Fe,p as Ie,r as Le,s as Re,t as ze,u as Be,v as Ve,x as He,y as Ue}from"./cron-utils-Cvv0F3pa.js";import{a as We,i as Ge,n as Ke,r as qe,t as Je}from"./dist-C41N3YrO.js";var y=e(t(),1);function Ye(e,t){let n=e.templates;if(!n||typeof n!=`object`)return;let r=n[t];if(!r||typeof r!=`object`)return;let i=r.title?.trim(),a=r.prompt?.trim();if(!(!i||!a))return{title:i,description:(r.description??``).trim(),prompt:a}}var b=[`daily`,`monitoring`,`reports`,`automation`],Xe=[{templateId:`morning_briefing`,category:`daily`,defaultSchedule:`0 7 * * 1-5`,defaultSessionTarget:`isolated`},{templateId:`standup_prep`,category:`daily`,defaultSchedule:`0 8 * * 1-5`,defaultSessionTarget:`isolated`},{templateId:`end_of_day_wrap_up`,category:`daily`,defaultSchedule:`0 18 * * 1-5`,defaultSessionTarget:`isolated`},{templateId:`inbox_triage`,category:`daily`,defaultSchedule:`30 8 * * 1-5`,defaultSessionTarget:`isolated`},{templateId:`competitor_watch`,category:`monitoring`,defaultSchedule:`0 9 * * 1`,defaultSessionTarget:`isolated`},{templateId:`trending_topics_monitor`,category:`monitoring`,defaultSchedule:`0 10 * * 1-5`,defaultSessionTarget:`isolated`},{templateId:`tech_radar_stack`,category:`monitoring`,defaultSchedule:`0 11 * * 3`,defaultSessionTarget:`isolated`},{templateId:`dependency_check_audit`,category:`monitoring`,defaultSchedule:`0 9 * * 0`,defaultSessionTarget:`isolated`},{templateId:`weekly_review`,category:`reports`,defaultSchedule:`0 17 * * 5`,defaultSessionTarget:`isolated`},{templateId:`code_quality_report`,category:`reports`,defaultSchedule:`0 14 * * 1`,defaultSessionTarget:`isolated`},{templateId:`git_activity_summary`,category:`reports`,defaultSchedule:`0 9 * * 1`,defaultSessionTarget:`isolated`},{templateId:`user_feedback_digest`,category:`reports`,defaultSchedule:`0 16 * * 5`,defaultSessionTarget:`isolated`},{templateId:`stale_todo_or_issue_sweep`,category:`automation`,defaultSchedule:`0 10 * * 2`,defaultSessionTarget:`isolated`},{templateId:`release_notes_or_changelog_draft`,category:`automation`,defaultSchedule:`0 10 * * 4`,defaultSessionTarget:`isolated`},{templateId:`workspace_cleanup_suggestions`,category:`automation`,defaultSchedule:`30 18 * * 5`,defaultSessionTarget:`isolated`},{templateId:`smoke_or_ci_health_reminder`,category:`automation`,defaultSchedule:`0 8 * * 1`,defaultSessionTarget:`isolated`}];function Ze(e){return Xe.find(t=>t.templateId===e)}var x=n();function Qe(e){let{cron:t,localeTag:n,scheduleBadgeLabels:i,categoryFilter:a,onCategoryFilterChange:o,onSelectTemplate:s}=e,c=a===`all`?[...Xe]:Xe.filter(e=>e.category===a);return(0,x.jsxs)(`div`,{className:`flex w-full flex-col gap-4`,children:[(0,x.jsxs)(`div`,{className:`flex flex-wrap gap-2`,role:`group`,"aria-label":t.fromTemplate,children:[(0,x.jsx)(_,{type:`button`,variant:a===`all`?`secondary`:`ghost`,className:`h-8 rounded-full px-3 py-1.5 text-xs`,onClick:()=>o(`all`),children:t.templateFilterAll}),b.map(e=>(0,x.jsx)(_,{type:`button`,variant:a===e?`secondary`:`ghost`,className:`h-8 rounded-full px-3 py-1.5 text-xs`,onClick:()=>o(e),children:t.templateCategories[e]},e))]}),c.length===0?(0,x.jsx)(`p`,{className:`text-center text-sm text-fg-muted`,children:t.templatesEmptyHint}):(0,x.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:c.map(e=>{let a=Ye(t,e.templateId);if(!a)return null;let o=Fe({schedule:e.defaultSchedule,timezone:void 0,next_run:void 0},n,i);return(0,x.jsxs)(`button`,{type:`button`,className:r(`flex flex-col gap-1.5 rounded-xl border border-edge-subtle bg-surface-base p-4 text-left transition-colors`,`hover:border-accent/40 hover:bg-surface-hover`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`),onClick:()=>s(e.templateId),"aria-label":`${t.templateCategories[e.category]} — ${a.title}`,children:[(0,x.jsx)(`span`,{className:`font-semibold text-fg`,children:a.title}),(0,x.jsx)(`span`,{className:`line-clamp-2 text-sm text-fg-muted`,children:a.description}),(0,x.jsx)(`span`,{className:`mt-1 flex items-center gap-1 text-xs text-fg-muted`,children:(0,x.jsx)(`span`,{className:`tabular-nums`,children:o})})]},e.templateId)})})]})}var S=Me(),C=r(f,`min-w-0 shrink text-xs sm:min-w-[7rem] sm:max-w-[11rem]`),w=r(`h-9 min-w-[6.5rem] shrink-0 rounded-lg border border-edge-subtle bg-surface-panel px-2 py-1.5 text-sm text-fg`,v,`dark:bg-surface-panel`),$e=r(`h-9 min-w-[9.5rem] shrink-0 rounded-lg border border-edge-subtle bg-surface-panel px-2 py-1.5 text-sm text-fg`,v),T=r(`h-9 w-14 shrink-0 rounded-lg border border-edge-subtle bg-surface-panel px-2 py-1.5 text-center text-sm tabular-nums text-fg`,v),et=r(`min-h-[2.5rem] w-full rounded-lg border border-edge-subtle bg-surface-base px-3 py-2 font-mono text-xs text-fg`,v);function tt(){let e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`}function E(e){return Array.isArray(e)?e.filter(e=>typeof e==`number`).sort((e,t)=>e-t):[]}function D(e){if(e.length<2)return null;let t=e[1]-e[0];if(t<=0)return null;for(let n=2;n<e.length;n++)if(e[n]-e[n-1]!==t)return null;return t}function nt(e){let t=[];for(let n=0;n<7;n++)e[n]&&t.push(n===6?0:n+1);return t.length===0?`1`:t.sort((e,t)=>e-t).join(`,`)}function O(e){let t=[!1,!1,!1,!1,!1,!1,!1];for(let n of e){let e=n===0||n===7?6:n-1;e>=0&&e<=6&&(t[e]=!0)}return t}function rt(e){let t=e.trim(),n={mode:`custom`,intervalKind:`minutes`,onceDate:tt(),intervalMinutes:5,intervalHours:2,minute:0,hour:9,weekDays:[!0,!0,!0,!0,!0,!1,!1],dayOfMonth:1,rawCron:t};if(!t)return{...n,mode:`interval`,rawCron:`*/5 * * * *`};try{let e=S.CronExpressionParser.parse(t).fields,r=E(e.minute.values),i=E(e.hour.values),a=E(e.dayOfMonth.values),o=E(e.month.values),s=E(e.dayOfWeek.values);if(r.length===60&&e.hour.isWildcard&&e.dayOfMonth.isWildcard&&e.month.isWildcard&&e.dayOfWeek.isWildcard)return{...n,mode:`interval`,intervalKind:`minutes`,intervalMinutes:1,rawCron:t};if(!e.minute.isWildcard&&e.hour.isWildcard&&e.dayOfMonth.isWildcard&&e.month.isWildcard&&e.dayOfWeek.isWildcard&&r.length>1){let e=D(r);if(e!=null&&e>0)return{...n,mode:`interval`,intervalKind:`minutes`,intervalMinutes:e,rawCron:t}}if(!e.minute.isWildcard&&r.length===1&&!e.hour.isWildcard&&i.length>1&&e.dayOfMonth.isWildcard&&e.month.isWildcard&&e.dayOfWeek.isWildcard){let e=D(i);if(e!=null&&e>0)return{...n,mode:`interval`,intervalKind:`hours`,intervalHours:e,minute:r[0],rawCron:t}}if(!e.minute.isWildcard&&r.length===1&&e.hour.isWildcard&&e.dayOfMonth.isWildcard&&e.month.isWildcard&&e.dayOfWeek.isWildcard&&i.length===24)return{...n,mode:`hourly`,minute:r[0],rawCron:t};if(r.length===1&&i.length===1&&a.length===1&&o.length===1&&!e.dayOfMonth.isWildcard&&!e.month.isWildcard&&e.dayOfWeek.isWildcard){let e=new Date().getFullYear(),s=o[0],c=a[0],ee=`${e}-${String(s).padStart(2,`0`)}-${String(c).padStart(2,`0`)}`;return{...n,mode:`no_repeat`,minute:r[0],hour:i[0],onceDate:ee,rawCron:t}}if(r.length===1&&i.length===1&&e.dayOfMonth.isWildcard&&e.month.isWildcard&&e.dayOfWeek.isWildcard)return{...n,mode:`daily`,minute:r[0],hour:i[0],rawCron:t};if(r.length===1&&i.length===1&&e.dayOfMonth.isWildcard&&e.month.isWildcard&&!e.dayOfWeek.isWildcard&&s.length>0)return{...n,mode:`weekly`,minute:r[0],hour:i[0],weekDays:O(s),rawCron:t};if(r.length===1&&i.length===1&&!e.dayOfMonth.isWildcard&&a.length===1&&e.month.isWildcard&&e.dayOfWeek.isWildcard)return{...n,mode:`monthly`,minute:r[0],hour:i[0],dayOfMonth:a[0],rawCron:t}}catch{}return n}function it(e){let t=(e,t,n)=>Math.min(n,Math.max(t,e));switch(e.mode){case`custom`:return e.rawCron.trim()||`*/5 * * * *`;case`no_repeat`:{let n=e.onceDate.split(`-`);if(n.length===3){let r=t(parseInt(n[2],10),1,31),i=t(parseInt(n[1],10),1,12);return`${t(e.minute,0,59)} ${t(e.hour,0,23)} ${r} ${i} *`}return`0 9 1 1 *`}case`interval`:if(e.intervalKind===`hours`){let n=t(Math.round(e.intervalHours)||1,1,23);return`${t(e.minute,0,59)} */${n} * * *`}return`*/${t(Math.round(e.intervalMinutes)||5,1,59)} * * * *`;case`hourly`:return`${t(e.minute,0,59)} * * * *`;case`daily`:return`${t(e.minute,0,59)} ${t(e.hour,0,23)} * * *`;case`weekly`:return`${t(e.minute,0,59)} ${t(e.hour,0,23)} * * ${nt(e.weekDays)}`;case`monthly`:return`${t(e.minute,0,59)} ${t(e.hour,0,23)} ${t(Math.round(e.dayOfMonth)||1,1,31)} * *`;default:return`*/5 * * * *`}}function at({value:e,onChange:t,labels:n,disabled:i}){let a=(0,y.useMemo)(()=>rt(e),[e]),[o,s]=(0,y.useState)(a.mode),[c,ee]=(0,y.useState)(a.intervalKind),[te,ne]=(0,y.useState)(a.onceDate),[re,ie]=(0,y.useState)(a.intervalMinutes),[ae,l]=(0,y.useState)(a.intervalHours),[u,oe]=(0,y.useState)(a.minute),[d,se]=(0,y.useState)(a.hour),[ce,f]=(0,y.useState)(a.weekDays),[le,ue]=(0,y.useState)(a.dayOfMonth),[de,fe]=(0,y.useState)(a.rawCron),[p,pe]=(0,y.useState)(null),[m,me]=(0,y.useState)(null);(0,y.useEffect)(()=>{let t=rt(e);s(t.mode),ee(t.intervalKind),ne(t.onceDate),ie(t.intervalMinutes),l(t.intervalHours),oe(t.minute),se(t.hour),f(t.weekDays),ue(t.dayOfMonth),fe(t.rawCron),pe(null),me(null)},[e]);let h=(0,y.useCallback)(e=>{t(it({mode:o,intervalKind:c,onceDate:te,intervalMinutes:re,intervalHours:ae,minute:u,hour:d,weekDays:ce,dayOfMonth:le,rawCron:de,...e}))},[o,c,te,re,ae,u,d,ce,le,de,t]),he=`${String(d).padStart(2,`0`)}:${String(u).padStart(2,`0`)}`,g=e=>{let t=e.target.value;if(!t)return;let[n,r]=t.split(`:`).map(e=>parseInt(e,10));Number.isNaN(n)||Number.isNaN(r)||h({minute:r,hour:n})},ge=(0,x.jsxs)(`div`,{className:`flex min-w-0 flex-nowrap items-center gap-2 overflow-x-auto pb-0.5`,children:[(0,x.jsxs)(`select`,{className:C,disabled:i,value:o,onChange:e=>{let t=e.target.value;s(t),h({mode:t})},"aria-label":n.scheduleTimeLabel,children:[(0,x.jsx)(`option`,{value:`no_repeat`,children:n.modeNoRepeat}),(0,x.jsx)(`option`,{value:`interval`,children:n.modeInterval}),(0,x.jsx)(`option`,{value:`hourly`,children:n.modeHourly}),(0,x.jsx)(`option`,{value:`daily`,children:n.modeDaily}),(0,x.jsx)(`option`,{value:`weekly`,children:n.modeWeekly}),(0,x.jsx)(`option`,{value:`monthly`,children:n.modeMonthly}),(0,x.jsx)(`option`,{value:`custom`,children:n.modeCustom})]}),o===`no_repeat`&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`input`,{type:`date`,disabled:i,className:$e,value:te,onChange:e=>{let t=e.target.value;ne(t),h({onceDate:t})},"aria-label":n.modeNoRepeat}),(0,x.jsx)(`input`,{type:`time`,step:60,disabled:i,className:w,value:he,onChange:g,"aria-label":n.scheduleTimeLabel})]}),o===`interval`&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`select`,{className:r(C,`w-auto min-w-[5rem]`),disabled:i,value:c,onChange:e=>{let t=e.target.value;ee(t),pe(null),me(null),h({intervalKind:t})},"aria-label":n.modeInterval,children:[(0,x.jsx)(`option`,{value:`minutes`,children:n.intervalKindMinutes}),(0,x.jsx)(`option`,{value:`hours`,children:n.intervalKindHours})]}),c===`minutes`?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`input`,{type:`number`,min:1,max:59,disabled:i,className:T,value:p??String(re),onChange:e=>{let t=e.target.value;pe(t);let n=parseInt(t,10);Number.isFinite(n)&&n>=1&&n<=59&&(ie(n),h({intervalMinutes:n}))},onBlur:()=>{if(p===null)return;let e=parseInt(p,10),t=!Number.isFinite(e)||e<1?5:Math.min(59,Math.max(1,Math.round(e)));ie(t),h({intervalMinutes:t}),pe(null)},"aria-label":n.intervalMinutes}),(0,x.jsx)(`span`,{className:`shrink-0 text-sm text-fg-muted`,children:n.minuteUnit})]}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`input`,{type:`number`,min:1,max:23,disabled:i,className:T,value:m??String(ae),onChange:e=>{let t=e.target.value;me(t);let n=parseInt(t,10);Number.isFinite(n)&&n>=1&&n<=23&&(l(n),h({intervalHours:n}))},onBlur:()=>{if(m===null)return;let e=parseInt(m,10),t=!Number.isFinite(e)||e<1?2:Math.min(23,Math.max(1,Math.round(e)));l(t),h({intervalHours:t}),me(null)},"aria-label":n.intervalHours}),(0,x.jsx)(`span`,{className:`shrink-0 text-sm text-fg-muted`,children:n.hourUnit}),(0,x.jsx)(`select`,{className:r(C,`w-auto min-w-[4rem]`),disabled:i,value:u,onChange:e=>{let t=parseInt(e.target.value,10);oe(t),h({minute:t})},"aria-label":n.minuteAtHour,children:Array.from({length:60},(e,t)=>(0,x.jsx)(`option`,{value:t,children:String(t).padStart(2,`0`)},t))}),(0,x.jsx)(`span`,{className:`shrink-0 text-sm text-fg-muted`,children:n.minuteUnit})]})]}),o===`daily`&&(0,x.jsx)(`input`,{type:`time`,step:60,disabled:i,className:w,value:he,onChange:g,"aria-label":n.scheduleTimeLabel}),o===`weekly`&&(0,x.jsx)(`input`,{type:`time`,step:60,disabled:i,className:w,value:he,onChange:g,"aria-label":n.scheduleTimeLabel}),o===`monthly`&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`select`,{className:r(C,`w-auto min-w-[4.5rem]`),disabled:i,value:le,onChange:e=>{let t=parseInt(e.target.value,10);ue(t),h({dayOfMonth:t})},"aria-label":n.dayOfMonth,children:Array.from({length:31},(e,t)=>t+1).map(e=>(0,x.jsx)(`option`,{value:e,children:e},e))}),(0,x.jsx)(`input`,{type:`time`,step:60,disabled:i,className:w,value:he,onChange:g,"aria-label":n.scheduleTimeLabel})]}),o===`hourly`&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`select`,{className:r(C,`w-auto min-w-[4rem]`),disabled:i,value:u,onChange:e=>{let t=parseInt(e.target.value,10);oe(t),h({minute:t})},"aria-label":n.minuteAtHour,children:Array.from({length:60},(e,t)=>(0,x.jsx)(`option`,{value:t,children:String(t).padStart(2,`0`)},t))}),(0,x.jsx)(`span`,{className:`shrink-0 text-sm text-fg-muted`,children:n.minuteUnit})]})]}),_e=o===`weekly`?(0,x.jsx)(`div`,{className:`flex flex-wrap gap-1.5 pt-1`,role:`group`,"aria-label":n.modeWeekly,children:n.weekdays.map((e,t)=>{let n=ce[t];return(0,x.jsx)(`button`,{type:`button`,disabled:i,className:r(`flex size-9 select-none items-center justify-center rounded-full border text-xs font-medium transition-colors`,n?`border-fg bg-fg text-surface-panel`:`border-edge-subtle bg-surface-panel text-fg hover:border-edge`),"aria-pressed":n,onClick:()=>{let e=[...ce];e[t]=!e[t],f(e),h({weekDays:e})},children:e},e)})}):null,ve=o===`custom`?(0,x.jsxs)(`div`,{className:`pt-1`,children:[(0,x.jsx)(`textarea`,{disabled:i,className:et,rows:2,spellCheck:!1,value:de,placeholder:`*/5 * * * *`,onChange:e=>{let n=e.target.value;fe(n),t(n.trim()||`*/5 * * * *`)},"aria-label":n.modeCustom}),(0,x.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n.customCronHint})]}):null;return(0,x.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,x.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:n.scheduleTimeLabel}),ge,_e,ve]})}var ot=400;function st(e){let t=new Date(e);return t.setHours(0,0,0,0),t}function ct(e){let t=st(e),n=t.getDay(),r=n===0?-6:1-n;return t.setDate(t.getDate()+r),t}function lt(e){return new Date(e.getFullYear(),e.getMonth(),1,0,0,0,0)}var ut=`*/5 * * * *`,dt=`xopc.recentWorkspaceDirs.v1`,k=10;function ft(e){let t=e?.trim();t&&window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{sessionKey:t},bubbles:!0}))}function pt(e){let t=e.trim();if(t)try{let e=localStorage.getItem(dt),n=e?JSON.parse(e):[],r=[t,...(Array.isArray(n)?n.filter(e=>typeof e==`string`&&e.trim().length>0):[]).filter(e=>e!==t)].slice(0,k);localStorage.setItem(dt,JSON.stringify(r))}catch{}}function mt(e){return r(`w-full rounded-md border border-edge bg-surface-base px-3 py-2 text-sm text-fg placeholder:text-fg-disabled`,v,e&&`cursor-not-allowed opacity-60`)}function ht(){return r(f,m)}var gt=r(f,`w-full text-xs sm:w-auto sm:min-w-[11rem] sm:max-w-[17rem] sm:shrink-0`),_t=r(f,`w-auto min-w-[9rem] max-w-[14rem] shrink-0 text-xs`);function vt(){let e=ee(e=>e.language),t=me(e),n=t.cron,f=t.chat,m=!!ge(e=>e.token),v=ie(e=>e.resolved)===`dark`,Me=e===`zh`?`zh-CN`:`en-US`,[b,Xe]=(0,y.useState)([]),[S,C]=(0,y.useState)(`tasks`),[w,$e]=(0,y.useState)(`created_desc`),[T,et]=(0,y.useState)(`day`),[tt,E]=(0,y.useState)(``),[D,nt]=(0,y.useState)(``),[O,rt]=(0,y.useState)(!1),it=(0,y.useRef)(null),dt=(0,y.useRef)(O),k=typeof navigator<`u`&&`wakeLock`in navigator,[vt,yt]=(0,y.useState)([]),[bt,xt]=(0,y.useState)([]),[St,Ct]=(0,y.useState)(``),[wt,Tt]=(0,y.useState)([]),[Et,Dt]=(0,y.useState)([]),[Ot,kt]=(0,y.useState)(!1),[At,A]=(0,y.useState)(null),[jt,Mt]=(0,y.useState)([]),[j,Nt]=(0,y.useState)(!1),[M,Pt]=(0,y.useState)(!1),[N,Ft]=(0,y.useState)(`add`),[It,Lt]=(0,y.useState)(null),[Rt,zt]=(0,y.useState)(``),[Bt,Vt]=(0,y.useState)(ut),[P,F]=(0,y.useState)(`local`),[Ht,I]=(0,y.useState)(``),[L,R]=(0,y.useState)(``),[Ut,Wt]=(0,y.useState)(`edit`),[Gt,Kt]=(0,y.useState)(0),[z,B]=(0,y.useState)(`main`),[qt,V]=(0,y.useState)(``),[Jt,H]=(0,y.useState)(!1),[U,W]=(0,y.useState)(``),[Yt,Xt]=(0,y.useState)(!1),[Zt,G]=(0,y.useState)(``),[K,Qt]=(0,y.useState)(!1),$t=(0,y.useRef)(!1),[en,tn]=(0,y.useState)(!1),[q,nn]=(0,y.useState)(null),[rn,an]=(0,y.useState)([]),[on,sn]=(0,y.useState)(!1),[cn,ln]=(0,y.useState)(!1),[J,un]=(0,y.useState)(null),[dn,fn]=(0,y.useState)(null),[pn,mn]=(0,y.useState)(!1),[hn,gn]=(0,y.useState)(`all`),Y=(0,y.useRef)(null),_n=(0,y.useCallback)(e=>{Y.current=e,window.setTimeout(()=>{Y.current===e&&(Y.current=null)},400)},[]),X=(0,y.useCallback)(()=>St||(bt.length>0?bt[0].id:``),[St,bt]),vn=typeof window<`u`&&!!window.electronAPI?.file?.openDirectory,yn=(0,y.useCallback)(async()=>{let e=typeof window<`u`?window.electronAPI?.file?.openDirectory:void 0;return e?e():null},[]),bn=(0,y.useCallback)(async e=>{let t=e.trim();t&&(pt(t),W(t))},[]),xn=(0,y.useMemo)(()=>{let e=new Set(Et.map(e=>e.id)),t=[...Et],n=qt.trim().toLowerCase();return n&&!e.has(n)&&t.push({id:n}),t},[Et,qt]),Sn=P!==`local`&&(z===`main`||z===`isolated`&&!Jt),Cn=z===`main`||z===`isolated`&&!Jt,wn=!!Rt.trim()&&!!Bt.trim()&&!!L.trim()&&(!Sn||!!Ht.trim()),Z=(0,y.useCallback)(async()=>{Nt(!0);try{Mt(await Oe(ot))}catch{}finally{Nt(!1)}},[]),Q=(0,y.useCallback)(async()=>{kt(!0),A(null);try{Xe(await Ue())}catch(e){A(e instanceof Error?e.message:n.failedToLoadJobs)}finally{kt(!1)}},[n.failedToLoadJobs]),$=(0,y.useCallback)(async()=>{try{let[e,t,n,r]=await Promise.all([Ie(),Ce(),Ne(),de().catch(()=>null)]);yt(e),xt(t),Ct(n.model||``),r&&Dt(r.items)}catch{}},[]);(0,y.useEffect)(()=>{m&&(Q(),$())},[m,Q,$]),(0,y.useEffect)(()=>{!m||S!==`history`||Z()},[m,S,Z]);let Tn=(0,y.useCallback)(async()=>{try{await it.current?.release()}catch{}it.current=null},[]),En=(0,y.useCallback)(async()=>{if(k)try{let e=await navigator.wakeLock.request(`screen`);it.current=e,e.addEventListener(`release`,()=>{it.current=null})}catch{A(n.wakeLockUnavailable),rt(!1)}},[n.wakeLockUnavailable,k]);dt.current=O,(0,y.useEffect)(()=>{if(!O){Tn();return}En();let e=()=>{document.visibilityState===`visible`&&dt.current&&En()};return document.addEventListener(`visibilitychange`,e),()=>{document.removeEventListener(`visibilitychange`,e),Tn()}},[O,En,Tn]),(0,y.useEffect)(()=>{if(!M||N!==`add`||$t.current)return;let e=X();e&&G(e)},[M,N,X]),(0,y.useEffect)(()=>{!M||N!==`add`||new Set([`local`,...vt.map(e=>e.name)]).has(P)||F(`local`)},[vt,P,N,M]),(0,y.useEffect)(()=>{if(P===`local`){Tt([]);return}let e=!1;return Ve(P).then(t=>{e||Tt(t)}),()=>{e=!0}},[P,M]);let Dn=(0,y.useCallback)(e=>{if($t.current=!1,Pt(!0),Ft(e?`edit`:`add`),Lt(e?.id??null),e){zt(e.name||``),Vt(e.schedule&&String(e.schedule).trim()||ut);let t=De(e);R(t??``),B(e.sessionTarget||`main`),V((e.sessionTarget||`main`)===`isolated`&&e.agentId?.trim()?e.agentId.trim().toLowerCase():``),W((e.sessionTarget||`main`)===`isolated`&&e.workingDirectory?.trim()?e.workingDirectory.trim():``);let n=e.payload?.kind===`agentTurn`&&e.payload.model?.trim()?e.payload.model.trim():``;G(e.model?.trim()||n||X());let r=e.delivery?.channel===`local`,i=(e.sessionTarget||`main`)===`isolated`&&!r&&(!e.delivery?.to||e.delivery.mode===`none`);if(H(i),r)F(`local`),I(``);else if(e.delivery&&e.delivery.mode!==`none`&&e.delivery.to)F(e.delivery.channel||`telegram`),I(e.delivery.to||``);else if(i)F(`telegram`),I(``);else{let e=t.split(`:`);e.length>=3&&[`telegram`,`cli`,`gateway`,`local`].includes(e[0])?(F(e[0]),I(e[1]),R(e.slice(2).join(`:`))):(F(`telegram`),I(``))}}else zt(``),Vt(ut),F(`local`),I(``),R(``),B(`main`),V(``),W(``),H(!1),G(X());Wt(`edit`),Kt(e=>e+1)},[X]),On=(0,y.useCallback)(e=>{Wt(e),e===`edit`&&Kt(e=>e+1)},[]),kn=(0,y.useCallback)(e=>{let n=Ze(e),r=n?Ye(t.cron,e):void 0;!n||!r||($t.current=!1,Ft(`add`),Lt(null),zt(r.title),Vt(n.defaultSchedule),R(r.prompt),B(n.defaultSessionTarget),F(`local`),I(``),H(!1),V(``),W(``),G(X()),Wt(`edit`),Kt(e=>e+1),mn(!1),Pt(!0))},[X,t.cron]),An=(0,y.useCallback)(()=>{Pt(!1),Ft(`add`),Lt(null),zt(``),Vt(ut),F(`local`),I(``),R(``),B(`main`),V(``),W(``),Xt(!1),H(!1),G(``),Wt(`edit`),$t.current=!1},[]),jn=async()=>{if(!Rt.trim()){A(n.nameRequired);return}if(!Bt.trim()||!L.trim()){A(n.scheduleRequired);return}if(Sn&&!Ht.trim()){A(n.chatIdRequired);return}Qt(!0),A(null);try{let e=L.trim(),t;t=z===`isolated`&&Jt?{mode:`none`}:P===`local`?{mode:`direct`,channel:`local`}:{mode:`direct`,channel:P,to:Ht.trim()};let n=z===`isolated`?{kind:`agentTurn`,message:e,...Zt.trim()?{model:Zt.trim()}:{}}:{kind:`systemEvent`,text:e},r=Zt.trim(),i=qt.trim().toLowerCase(),a=z===`main`?null:i||null,o=U.trim(),s={name:Rt.trim(),schedule:Bt.trim(),sessionTarget:z,model:z===`isolated`&&r?r:void 0,delivery:t,payload:n,...N===`edit`?{agentId:a,workingDirectory:z===`isolated`&&o||null}:{...z===`isolated`&&i?{agentId:i}:{},...z===`isolated`&&o?{workingDirectory:o}:{}}};if(N===`edit`&&It)await xe(It,s);else{let{schedule:e,agentId:t,workingDirectory:n,...r}=s;await Be(e,{...r,...t==null?{}:{agentId:t},...n?{workingDirectory:n}:{}})}An(),await Q(),await $()}catch(e){A(e instanceof Error?e.message:N===`edit`?n.failedToUpdateJob:n.failedToCreateJob)}finally{Qt(!1)}},Mn=async e=>{tn(!0),nn(e),sn(!0),an([]);try{let t=await ke(e.id);t&&(nn(t),an(await Ae(e.id,20)))}catch{}finally{sn(!1)}},Nn=async(e,t)=>{try{await Se(e.id,t),await Q(),await $()}catch(e){A(e instanceof Error?e.message:n.failedToToggleJob)}},Pn=async()=>{if(!dn||!J)return;let e=dn,t=J;ln(!1),fn(null),un(null);try{t===`run`?await He(e):(await Te(e),q?.id===e&&(tn(!1),nn(null))),await Q(),await $(),await Z()}catch(e){A(e instanceof Error?e.message:n.actionFailed)}};(0,y.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(M?An():en&&(tn(!1),nn(null)))};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[M,en,An]);let Fn={running:n.execStatusRunning,success:n.execStatusSuccess,failed:n.execStatusFailed,cancelled:n.execStatusCancelled},In=(0,y.useMemo)(()=>{let e=[...b];return e.sort((e,t)=>{let n=new Date(e.created_at).getTime(),r=new Date(t.created_at).getTime();return w===`created_desc`?r-n:n-r}),e},[b,w]),Ln=(0,y.useMemo)(()=>{let e=new Date,t=T===`day`?st(e):T===`week`?ct(e):lt(e);return jt.filter(e=>!(new Date(e.startedAt)<t||tt&&e.jobId!==tt||D&&e.status!==D))},[jt,T,tt,D]),Rn=n.scheduleBadge,zn=(0,y.useCallback)(()=>{Q(),$(),Z()},[Q,$,Z]),Bn=s(e=>e.setPageHeader),Vn=s(e=>e.clearPageHeader),{pathname:Hn}=a(),Un=Hn.startsWith(`/settings/`),Wn=(0,y.useMemo)(()=>(0,x.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center justify-end gap-2`,children:[(0,x.jsx)(_,{type:`button`,variant:`ghost`,className:`h-9 w-9 shrink-0 p-0`,disabled:Ot||j,title:n.refresh,"aria-label":n.refresh,onClick:()=>void zn(),children:(0,x.jsx)(ue,{className:r(`size-4`,(Ot||j)&&`animate-spin`),strokeWidth:1.75})}),(0,x.jsxs)(_,{type:`button`,variant:`secondary`,className:`gap-2`,onClick:()=>{gn(`all`),mn(!0)},children:[(0,x.jsx)(re,{className:`size-4`,strokeWidth:1.75}),n.fromTemplate]}),(0,x.jsxs)(_,{type:`button`,variant:`primary`,className:`gap-2`,onClick:()=>Dn(),children:[(0,x.jsx)(c,{className:`size-4`,strokeWidth:1.75}),n.addJob]})]}),[n.addJob,n.fromTemplate,n.refresh,Ot,Dn,zn,j]);return(0,y.useLayoutEffect)(()=>!m||Un?(Vn(),()=>Vn()):(Bn({startExtra:null,main:null,end:Wn}),()=>Vn()),[Vn,Wn,m,Un,Bn]),m?(0,x.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto bg-surface-panel`,children:[(0,x.jsxs)(`div`,{className:`mx-auto flex w-full max-w-app-main flex-col gap-6 px-4 py-6 sm:px-8`,children:[At?(0,x.jsx)(`div`,{className:`rounded-xl border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-800 dark:border-red-900/50 dark:bg-red-950/40 dark:text-red-200`,role:`alert`,children:At}):null,(0,x.jsx)(`header`,{className:`flex flex-col gap-4`,children:(0,x.jsxs)(`div`,{className:`min-w-0`,children:[(0,x.jsx)(`h1`,{className:`text-xl font-semibold tracking-tight text-fg`,children:n.title}),(0,x.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm text-fg-muted`,children:n.subtitle})]})}),Un?(0,x.jsx)(`div`,{className:`flex flex-wrap items-center justify-end gap-2 border-b border-edge-subtle pb-3 dark:border-edge-subtle`,children:Wn}):null,(0,x.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-edge-subtle pb-3 sm:flex-row sm:items-center sm:justify-between dark:border-edge-subtle`,children:[(0,x.jsxs)(`div`,{className:`flex gap-1`,role:`tablist`,"aria-label":n.title,children:[(0,x.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":S===`tasks`,className:r(`rounded-md px-3 py-2 text-sm font-medium transition-colors`,S===`tasks`?`text-fg`:`text-fg-muted hover:text-fg`),onClick:()=>C(`tasks`),children:n.tabMyTasks}),(0,x.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":S===`history`,className:r(`rounded-md px-3 py-2 text-sm font-medium transition-colors`,S===`history`?`text-fg`:`text-fg-muted hover:text-fg`),onClick:()=>C(`history`),children:n.tabRunHistory})]}),(0,x.jsx)(`div`,{className:r(`flex min-w-0 items-center gap-2`,S===`history`?`flex-nowrap overflow-x-auto pb-0.5 sm:justify-end`:`flex-wrap sm:justify-end`),children:S===`tasks`?(0,x.jsxs)(`select`,{className:_t,value:w,onChange:e=>$e(e.target.value),"aria-label":n.sortCreatedDesc,children:[(0,x.jsx)(`option`,{value:`created_desc`,children:n.sortCreatedDesc}),(0,x.jsx)(`option`,{value:`created_asc`,children:n.sortCreatedAsc})]}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`div`,{className:r(le,`shrink-0`),role:`group`,"aria-label":n.runHistoryTitle,children:[`day`,`week`,`month`].map(e=>(0,x.jsx)(`button`,{type:`button`,className:r(ve,`px-2.5 py-1`,T===e&&`bg-surface-panel shadow-sm dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,T===e&&`text-fg`),onClick:()=>et(e),children:e===`day`?n.historyRangeDay:e===`week`?n.historyRangeWeek:n.historyRangeMonth},e))}),(0,x.jsxs)(`select`,{className:_t,value:tt,onChange:e=>E(e.target.value),"aria-label":n.filterAllTasks,children:[(0,x.jsx)(`option`,{value:``,children:n.filterAllTasks}),b.map(e=>(0,x.jsx)(`option`,{value:e.id,children:e.name||e.id},e.id))]}),(0,x.jsxs)(`select`,{className:_t,value:D,onChange:e=>nt(e.target.value),"aria-label":n.filterAllStatuses,children:[(0,x.jsx)(`option`,{value:``,children:n.filterAllStatuses}),(0,x.jsx)(`option`,{value:`success`,children:n.execStatusSuccess}),(0,x.jsx)(`option`,{value:`failed`,children:n.execStatusFailed}),(0,x.jsx)(`option`,{value:`cancelled`,children:n.execStatusCancelled}),(0,x.jsx)(`option`,{value:`running`,children:n.execStatusRunning})]})]})})]}),S===`tasks`?(0,x.jsxs)(`section`,{"aria-labelledby":`cron-tasks-panel`,className:`flex flex-col gap-4`,children:[(0,x.jsx)(`h2`,{id:`cron-tasks-panel`,className:`sr-only`,children:n.tabMyTasks}),(0,x.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-xl border border-accent/25 bg-accent/5 px-4 py-3 dark:border-accent/30 dark:bg-accent/10 sm:flex-row sm:items-center sm:justify-between`,children:[(0,x.jsxs)(`div`,{className:`flex gap-3 text-sm text-fg`,children:[(0,x.jsx)(_e,{className:`mt-0.5 size-4 shrink-0 text-accent`,strokeWidth:1.75,"aria-hidden":!0}),(0,x.jsx)(`p`,{className:`text-pretty text-fg-muted`,children:n.wakeBanner})]}),(0,x.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 sm:pl-4`,children:[(0,x.jsx)(`span`,{className:`text-sm text-fg`,children:n.keepAwake}),(0,x.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":O,disabled:!k,title:k?void 0:n.wakeLockUnavailable,className:r(`inline-flex h-6 w-10 shrink-0 items-center rounded-full border border-edge p-0.5 transition-colors`,O?`justify-end bg-accent`:`justify-start bg-surface-hover`,!k&&`cursor-not-allowed opacity-50`),onClick:()=>{k?rt(e=>!e):A(n.wakeLockUnavailable)},children:(0,x.jsx)(`span`,{className:`size-4 rounded-full bg-surface-panel shadow-surface ring-1 ring-edge/40 dark:ring-edge/55`})})]})]}),Ot&&b.length===0?(0,x.jsx)(`div`,{className:`flex justify-center py-16`,"aria-busy":`true`,children:(0,x.jsx)(g,{className:`size-8 animate-spin text-accent`,strokeWidth:1.75})}):b.length===0?(0,x.jsxs)(`div`,{className:`flex flex-col gap-6 rounded-2xl bg-surface-base px-4 py-8 dark:bg-surface-hover/25 sm:px-6 sm:py-10`,children:[(0,x.jsx)(`div`,{className:`w-full max-w-3xl`,children:(0,x.jsx)(Qe,{cron:n,localeTag:Me,scheduleBadgeLabels:Rn,categoryFilter:hn,onCategoryFilterChange:gn,onSelectTemplate:kn})}),(0,x.jsx)(`div`,{className:`flex justify-center`,children:(0,x.jsx)(_,{type:`button`,variant:`primary`,onClick:()=>Dn(),children:n.emptyStateCta})})]}):(0,x.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:In.map(e=>(0,x.jsxs)(`article`,{role:`button`,tabIndex:0,className:r(`flex cursor-pointer flex-col rounded-xl border border-edge-subtle bg-surface-base text-left transition-colors duration-150 ease-out dark:border-edge-subtle`,`hover:bg-surface-hover`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`),onClick:()=>{if(Y.current===e.id){Y.current=null;return}Mn(e)},onKeyDown:t=>{if(t.key===`Enter`||t.key===` `){if(t.preventDefault(),Y.current===e.id){Y.current=null;return}Mn(e)}},children:[(0,x.jsxs)(`div`,{className:`flex items-start justify-between gap-2 px-4 pt-3`,children:[(0,x.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e.enabled,className:r(`inline-flex h-6 w-10 shrink-0 items-center rounded-full border border-edge p-0.5 transition-colors`,e.enabled?`justify-end bg-accent`:`justify-start bg-surface-hover`),onClick:t=>{t.stopPropagation(),Nn(e,!e.enabled)},children:(0,x.jsx)(`span`,{className:`size-4 rounded-full bg-surface-panel shadow-surface ring-1 ring-edge/40 dark:ring-edge/55`})}),(0,x.jsxs)(Ge,{children:[(0,x.jsx)(We,{asChild:!0,children:(0,x.jsx)(_,{type:`button`,variant:`ghost`,className:`h-8 w-8 shrink-0 p-0`,"aria-label":n.jobCardMenuAria,onClick:e=>e.stopPropagation(),children:(0,x.jsx)(ae,{className:`size-4`,strokeWidth:1.75})})}),(0,x.jsx)(qe,{children:(0,x.jsxs)(Je,{className:`z-50 min-w-[10rem] rounded-xl border border-edge-subtle bg-surface-panel p-1 shadow-elevated dark:border-edge-subtle`,sideOffset:4,align:`end`,onCloseAutoFocus:e=>e.preventDefault(),children:[(0,x.jsx)(Ke,{className:`cursor-pointer select-none rounded-lg px-2 py-1.5 text-sm text-fg outline-none data-highlighted:bg-surface-hover`,onSelect:()=>{_n(e.id),Dn(e)},children:n.edit}),(0,x.jsx)(Ke,{className:`cursor-pointer select-none rounded-lg px-2 py-1.5 text-sm text-fg outline-none data-highlighted:bg-surface-hover`,onSelect:()=>{_n(e.id),un(`run`),fn(e.id),ln(!0)},children:n.runNow}),(0,x.jsx)(Ke,{className:`cursor-pointer select-none rounded-lg px-2 py-1.5 text-sm text-red-600 outline-none data-highlighted:bg-red-500/10 dark:text-red-400`,onSelect:()=>{_n(e.id),un(`delete`),fn(e.id),ln(!0)},children:n.delete})]})})]})]}),(0,x.jsxs)(`div`,{className:`flex flex-1 flex-col gap-2 px-4 pb-3 pt-2`,children:[(0,x.jsx)(`h3`,{className:`line-clamp-2 font-semibold text-fg`,children:e.name||e.id}),(0,x.jsx)(`div`,{className:`max-h-[4.5rem] overflow-hidden text-sm text-fg-muted [&_.markdown-body]:text-sm [&_.markdown-body]:leading-snug`,title:De(e),children:(0,x.jsx)(o,{content:De(e),compact:!0})})]}),(0,x.jsxs)(`div`,{className:`flex items-center gap-1.5 border-t border-edge-subtle/90 px-4 py-2.5 text-xs text-fg-muted dark:border-edge-subtle`,children:[(0,x.jsx)(i,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,x.jsx)(`span`,{className:`min-w-0 truncate`,children:Fe(e,Me,Rn)})]})]},e.id))})]}):(0,x.jsxs)(`section`,{"aria-labelledby":`cron-history-panel`,className:`flex flex-col gap-3`,children:[(0,x.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`h2`,{id:`cron-history-panel`,className:`sr-only`,children:n.tabRunHistory}),(0,x.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.runHistoryHint})]}),(0,x.jsx)(_,{type:`button`,variant:`ghost`,className:`h-9 w-9 shrink-0 p-0`,disabled:j,title:n.refresh,"aria-label":n.refresh,onClick:()=>void Z(),children:(0,x.jsx)(ue,{className:r(`size-4`,j&&`animate-spin`),strokeWidth:1.75})})]}),j&&jt.length===0?(0,x.jsx)(`div`,{className:`flex justify-center py-16`,children:(0,x.jsx)(g,{className:`size-8 animate-spin text-accent`,strokeWidth:1.75})}):Ln.length===0?(0,x.jsxs)(`div`,{className:`flex flex-col items-center rounded-2xl border border-dashed border-edge-subtle px-6 py-16 text-center dark:border-edge-subtle`,children:[(0,x.jsx)(i,{className:`mb-4 size-14 text-fg-disabled`,strokeWidth:1.1,"aria-hidden":!0}),(0,x.jsx)(`h3`,{className:`text-base font-semibold text-fg`,children:jt.length===0?n.emptyHistoryTitle:n.noRunsYet}),(0,x.jsx)(`p`,{className:`mt-2 max-w-sm text-sm text-fg-muted`,children:jt.length===0?n.emptyHistoryHint:n.runHistoryHint})]}):(0,x.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-edge-subtle bg-surface-base dark:border-edge-subtle`,children:(0,x.jsxs)(`table`,{className:`w-full min-w-[700px] border-collapse text-left text-sm`,children:[(0,x.jsx)(`thead`,{children:(0,x.jsxs)(`tr`,{className:`border-b border-edge text-xs font-medium text-fg-muted`,children:[(0,x.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:n.colStarted}),(0,x.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:n.colJob}),(0,x.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:n.status}),(0,x.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:n.colDuration}),(0,x.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:n.colDetail}),(0,x.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:n.colChat})]})}),(0,x.jsx)(`tbody`,{children:Ln.map(e=>(0,x.jsxs)(`tr`,{className:`border-b border-edge/60 last:border-0`,children:[(0,x.jsx)(`td`,{className:`whitespace-nowrap px-3 py-2.5 text-fg`,children:(0,x.jsx)(`time`,{dateTime:e.startedAt,children:Re(e.startedAt)})}),(0,x.jsx)(`td`,{className:`max-w-[10rem] truncate px-3 py-2.5`,children:b.some(t=>t.id===e.jobId)?(0,x.jsx)(`button`,{type:`button`,className:`text-left text-accent hover:underline`,onClick:()=>{let t=b.find(t=>t.id===e.jobId);t&&Mn(t)},children:e.jobName||e.jobId}):(0,x.jsx)(`span`,{className:`text-fg-muted`,children:e.jobName||e.jobId})}),(0,x.jsx)(`td`,{className:`px-3 py-2.5`,children:(0,x.jsx)(`span`,{className:r(`inline-flex rounded-md px-2 py-0.5 text-xs font-medium`,e.status===`success`&&`bg-emerald-500/15 text-emerald-800 dark:text-emerald-300`,e.status===`failed`&&`bg-red-500/15 text-red-800 dark:text-red-300`,e.status===`running`&&`bg-accent/15 text-accent`,e.status===`cancelled`&&`bg-surface-hover text-fg-muted`),children:ze(e.status,Fn)})}),(0,x.jsx)(`td`,{className:`whitespace-nowrap px-3 py-2.5 text-fg-muted`,children:Le(e.duration)}),(0,x.jsx)(`td`,{className:`max-w-xs truncate px-3 py-2.5 text-fg-muted`,title:e.summary||e.error||``,children:Ee(e.summary||e.error,96)}),(0,x.jsx)(`td`,{className:`whitespace-nowrap px-3 py-2.5`,children:e.sessionKey?.trim()?(0,x.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-accent hover:underline`,title:n.openChatTitle,"aria-label":n.openChatTitle,onClick:()=>ft(e.sessionKey),children:n.openChat}):(0,x.jsx)(`span`,{className:`text-fg-disabled`,children:`—`})})]},e.id))})]})})]})]}),(0,x.jsx)(ye,{open:M,onOpenChange:e=>!e&&An(),children:(0,x.jsxs)(p,{children:[(0,x.jsx)(u,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,x.jsx)(`div`,{className:`fixed inset-0 z-[60] flex items-center justify-center p-4 pointer-events-none`,children:(0,x.jsxs)(h,{className:`xopc-dialog-content-pane pointer-events-auto relative flex max-h-[min(90vh,800px)] w-full max-w-md flex-col rounded-xl border border-edge bg-surface-panel shadow-popover outline-none sm:max-w-lg lg:max-w-xl dark:border-edge`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,x.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[(0,x.jsx)(se,{className:`text-base font-semibold text-fg`,children:N===`edit`?n.editJob:n.addJob}),(0,x.jsx)(l,{asChild:!0,children:(0,x.jsx)(_,{type:`button`,variant:`ghost`,className:`h-9 w-9 shrink-0 p-0`,"aria-label":n.close,children:(0,x.jsx)(d,{className:`size-5`,strokeWidth:1.75})})})]}),(0,x.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:(0,x.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,x.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,x.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:n.name}),(0,x.jsx)(`input`,{type:`text`,className:mt(),value:Rt,onChange:e=>zt(e.target.value),placeholder:n.namePlaceholder})]}),(0,x.jsx)(at,{value:Bt,onChange:Vt,disabled:K,labels:n.schedulePicker}),(0,x.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,x.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:n.mode}),(0,x.jsxs)(`select`,{className:ht(),value:z,onChange:e=>{let t=e.target.value;B(t),t===`main`?(H(!1),V(``),W(``)):t===`isolated`&&!Zt.trim()&&G(X())},children:[(0,x.jsx)(`option`,{value:`main`,children:n.modeDirectOption}),(0,x.jsx)(`option`,{value:`isolated`,children:n.modeAgentOption})]}),(0,x.jsx)(`p`,{className:`text-xs text-fg-muted`,children:z===`main`?n.modeDirect:n.modeAgent})]}),z===`isolated`?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,x.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:n.model}),(0,x.jsx)(oe,{value:Zt,placeholder:f.modelPlaceholder,searchPlaceholder:f.modelSearchPlaceholder,noMatches:f.modelNoMatches,className:`w-full max-w-none min-w-0`,popoverContentClassName:`z-[70]`,onChange:e=>{$t.current=!0,G(e)}})]}),(0,x.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,x.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:n.agentProfile}),(0,x.jsxs)(`select`,{className:ht(),value:qt,disabled:K,onChange:e=>V(e.target.value),children:[(0,x.jsx)(`option`,{value:``,children:n.agentProfileDefault}),xn.map(e=>(0,x.jsx)(`option`,{value:e.id,children:e.name?`${e.id} — ${e.name}`:e.id},e.id))]}),(0,x.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.agentProfileHint})]}),(0,x.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,x.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:n.workingDirectoryLabel}),(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,x.jsxs)(`button`,{type:`button`,disabled:K,className:r(`inline-flex min-h-8 max-w-[min(16rem,48vw)] min-w-0 shrink-0 items-center gap-1 rounded-lg px-2 py-1 text-xs`,`border border-edge-subtle/80 bg-surface-hover/40 dark:border-edge-subtle`,ne.transition,ne.focusRingPanel,`cursor-pointer hover:bg-surface-hover/70 dark:hover:bg-surface-hover/50`,K&&`cursor-not-allowed opacity-60`),title:U.trim()?`${U.trim()}\n${f.workingDirectory.chooseFolder}`:`${n.workingDirectoryHint}\n${f.workingDirectory.selectWorkingDirectory}`,onClick:e=>{e.stopPropagation(),!K&&(vn?(async()=>{let e=await yn();e&&bn(e)})():Xt(!0))},children:[(0,x.jsx)(fe,{className:`size-3.5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,x.jsx)(`span`,{className:`min-w-0 truncate text-left font-medium text-fg`,children:U.trim()?pe(U.trim()):f.workingDirectory.notSet})]}),U.trim()?(0,x.jsx)(`button`,{type:`button`,disabled:K,className:`text-xs font-medium text-accent hover:underline disabled:opacity-50`,onClick:()=>W(``),children:n.workingDirectoryReset}):null]}),(0,x.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.workingDirectoryHint})]}),(0,x.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 rounded-md bg-surface-hover/45 px-3 py-2 dark:bg-surface-hover/30`,children:[(0,x.jsx)(`input`,{type:`checkbox`,className:r(`ui-checkbox`,`mt-0.5`),checked:Jt,onChange:e=>H(e.target.checked)}),(0,x.jsxs)(`span`,{children:[(0,x.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:n.agentLocalOnly}),(0,x.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n.agentLocalOnlyHint})]})]})]}):null,Cn?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,x.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:n.channel}),(0,x.jsxs)(`select`,{className:ht(),value:P,onChange:e=>{let t=e.target.value;F(t),t===`local`&&H(!1),I(``)},children:[(0,x.jsx)(`option`,{value:`local`,children:n.channelLocal}),vt.map(e=>(0,x.jsxs)(`option`,{value:e.name,disabled:!e.enabled,children:[e.name,` `,e.enabled?``:`(disabled)`]},e.name))]})]}),Sn?(0,x.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,x.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,x.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:n.recipient}),(0,x.jsxs)(_,{type:`button`,variant:`ghost`,className:`h-7 gap-1 px-2 text-xs`,title:n.refreshRecipientHint,onClick:()=>void Ve(P).then(Tt),children:[(0,x.jsx)(ue,{className:`size-3.5`,strokeWidth:1.75}),n.refreshList]})]}),(0,x.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-stretch sm:gap-2`,children:[(0,x.jsx)(`input`,{type:`text`,className:r(mt(),`min-w-0 w-full sm:flex-1`),value:Ht,onChange:e=>I(e.target.value),placeholder:n.recipientPlaceholder}),(0,x.jsxs)(`select`,{className:gt,value:Ht,onChange:e=>{let t=e.target.value;t&&I(t)},children:[(0,x.jsx)(`option`,{value:``,children:n.selectRecipient}),wt.length>0?wt.map(e=>(0,x.jsx)(`option`,{value:e.chatId,children:we(e,n.lastActiveLabels)},`${e.channel}-${e.chatId}`)):(0,x.jsx)(`option`,{value:``,disabled:!0,children:n.noRecentChatsOption})]})]}),(0,x.jsx)(`p`,{className:`text-xs text-fg-muted`,children:wt.length>0?n.enterManuallyOrSelect:n.noRecentChats})]}):null]}):null,(0,x.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,x.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:n.message}),(0,x.jsxs)(`div`,{className:`inline-flex rounded-lg border border-edge bg-surface-base p-0.5 dark:border-edge`,children:[(0,x.jsxs)(`button`,{type:`button`,className:r(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium`,Ut===`edit`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`),onClick:()=>On(`edit`),children:[(0,x.jsx)(be,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),n.messageEdit]}),(0,x.jsxs)(`button`,{type:`button`,className:r(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium`,Ut===`preview`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`),onClick:()=>On(`preview`),children:[(0,x.jsx)(he,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),n.messagePreview]})]})]}),(0,x.jsx)(`div`,{className:r(`overflow-hidden rounded-md border border-edge bg-surface-base dark:border-edge`,K&&`pointer-events-none opacity-60`),children:Ut===`edit`?(0,x.jsx)(te,{initialContent:L,onChange:R,isDark:v,className:`h-[min(18rem,40vh)] min-h-[12rem]`},`cron-msg-${It??`new`}-${Gt}`):(0,x.jsx)(`div`,{className:`h-[min(18rem,40vh)] min-h-[12rem] max-h-[min(24rem,50vh)] overflow-y-auto px-3 py-2`,children:L.trim()?(0,x.jsx)(o,{content:L,compact:!0,className:`text-sm`}):(0,x.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.messagePlaceholder})})}),(0,x.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.messageMarkdownHint})]})]})}),(0,x.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-4 py-3`,children:[(0,x.jsx)(_,{type:`button`,variant:`secondary`,onClick:An,children:n.cancel}),(0,x.jsx)(_,{type:`button`,variant:`primary`,disabled:K||!wn,onClick:()=>void jn(),children:K?n.loading:N===`edit`?n.save:n.create})]})]})})]})}),vn?null:(0,x.jsx)(ce,{open:Yt,onOpenChange:Xt,initialAbsolutePath:U.trim()||void 0,onConfirm:async e=>{await bn(e),Xt(!1)},wd:f.workingDirectory}),(0,x.jsx)(ye,{open:pn,onOpenChange:e=>{mn(e),e&&gn(`all`)},children:(0,x.jsxs)(p,{children:[(0,x.jsx)(u,{className:`xopc-dialog-overlay fixed inset-0 z-[62] bg-scrim`}),(0,x.jsx)(`div`,{className:`fixed inset-0 z-[62] flex items-center justify-center p-4 pointer-events-none`,children:(0,x.jsxs)(h,{className:`xopc-dialog-content-pane pointer-events-auto relative flex max-h-[min(90vh,840px)] w-full max-w-lg flex-col rounded-xl border border-edge bg-surface-panel shadow-popover outline-none sm:max-w-2xl dark:border-edge`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,x.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end border-b border-edge px-4 py-3`,children:[(0,x.jsx)(se,{className:`sr-only`,children:n.fromTemplate}),(0,x.jsx)(l,{asChild:!0,children:(0,x.jsx)(_,{type:`button`,variant:`ghost`,className:`h-9 w-9 shrink-0 p-0`,"aria-label":n.close,children:(0,x.jsx)(d,{className:`size-5`,strokeWidth:1.75})})})]}),(0,x.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-4`,children:(0,x.jsx)(Qe,{cron:n,localeTag:Me,scheduleBadgeLabels:Rn,categoryFilter:hn,onCategoryFilterChange:gn,onSelectTemplate:kn})})]})})]})}),(0,x.jsx)(ye,{open:en,onOpenChange:e=>{e||(tn(!1),nn(null))},children:(0,x.jsxs)(p,{children:[(0,x.jsx)(u,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,x.jsxs)(h,{className:r(`xopc-drawer-right fixed right-0 top-0 z-[60] flex h-full w-full max-w-lg flex-col border-l border-edge bg-surface-panel shadow-popover outline-none`,`dark:border-edge`),"aria-describedby":void 0,children:[(0,x.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[(0,x.jsx)(se,{className:`min-w-0 truncate text-base font-semibold text-fg`,children:q?.name?.trim()||q?.id||`—`}),(0,x.jsx)(l,{asChild:!0,children:(0,x.jsx)(_,{type:`button`,variant:`ghost`,className:`h-9 w-9 shrink-0 p-0`,"aria-label":n.close,children:(0,x.jsx)(d,{className:`size-5`,strokeWidth:1.75})})})]}),(0,x.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:on?(0,x.jsx)(`div`,{className:`flex justify-center py-16`,children:(0,x.jsx)(g,{className:`size-8 animate-spin text-accent`,strokeWidth:1.75})}):q?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`dl`,{className:`space-y-3 text-sm`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:n.scheduleLabel}),(0,x.jsx)(`dd`,{className:`mt-1 font-mono text-fg`,children:(0,x.jsx)(`code`,{children:q.schedule})})]}),(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:n.messageLabel}),(0,x.jsx)(`dd`,{className:`mt-1 min-w-0 break-words text-fg`,children:(0,x.jsx)(o,{content:De(q),compact:!0,className:`text-sm`})})]}),(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:n.mode}),(0,x.jsx)(`dd`,{className:`mt-1 text-fg`,children:q.sessionTarget===`isolated`?n.modeAgentOption:n.modeDirectOption})]}),q.sessionTarget===`isolated`?(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:n.agentProfile}),(0,x.jsx)(`dd`,{className:`mt-1 font-mono text-sm text-fg`,children:q.agentId?.trim()?q.agentId.trim():n.agentProfileDefault})]}):null,q.sessionTarget===`isolated`?(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:n.workingDirectoryLabel}),(0,x.jsx)(`dd`,{className:`mt-1 break-all font-mono text-xs text-fg`,children:q.workingDirectory?.trim()?q.workingDirectory.trim():f.workingDirectory.notSet})]}):null,q.delivery?.channel===`local`||q.sessionTarget===`isolated`&&!q.delivery?.to?(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:n.deliveryTarget}),(0,x.jsx)(`dd`,{className:`mt-1 text-fg`,children:q.delivery?.channel===`local`?n.deliveryTargetLocalChannel:n.deliveryLocalOnly})]}):q.delivery?.to?(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:n.deliveryTarget}),(0,x.jsxs)(`dd`,{className:`mt-1 break-words text-fg`,children:[(0,x.jsx)(`code`,{className:`text-xs`,children:q.delivery?.channel??``}),` → `,Pe(q,n.channelLocal)]})]}):null,(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:n.status}),(0,x.jsx)(`dd`,{className:`mt-1 text-fg`,children:q.enabled?n.enabled:n.disabled})]}),(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:n.nextRun}),(0,x.jsx)(`dd`,{className:`mt-1 text-fg`,children:q.next_run?je(q.next_run,n.timeLabels):`—`})]})]}),(0,x.jsx)(`h3`,{className:`mt-6 text-sm font-semibold text-fg`,children:n.detailRunHistory}),rn.length===0?(0,x.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:n.noRunsYet}):(0,x.jsx)(`div`,{className:`mt-2 overflow-x-auto`,children:(0,x.jsxs)(`table`,{className:`w-full border-collapse text-left text-xs`,children:[(0,x.jsx)(`thead`,{children:(0,x.jsxs)(`tr`,{className:`border-b border-edge text-fg-muted`,children:[(0,x.jsx)(`th`,{className:`py-1.5 pr-2 font-medium`,children:n.colStarted}),(0,x.jsx)(`th`,{className:`py-1.5 pr-2 font-medium`,children:n.status}),(0,x.jsx)(`th`,{className:`py-1.5 pr-2 font-medium`,children:n.colDuration}),(0,x.jsx)(`th`,{className:`py-1.5 pr-2 font-medium`,children:n.colDetail}),(0,x.jsx)(`th`,{className:`py-1.5 font-medium`,children:n.colChat})]})}),(0,x.jsx)(`tbody`,{children:rn.map(e=>(0,x.jsxs)(`tr`,{className:`border-b border-edge/60`,children:[(0,x.jsx)(`td`,{className:`whitespace-nowrap py-1.5 pr-2 text-fg`,children:(0,x.jsx)(`time`,{dateTime:e.startedAt,children:Re(e.startedAt)})}),(0,x.jsx)(`td`,{className:`py-1.5 pr-2`,children:(0,x.jsx)(`span`,{className:r(`inline-flex rounded px-1.5 py-0.5 font-medium`,e.status===`success`&&`bg-emerald-500/15 text-emerald-800 dark:text-emerald-300`,e.status===`failed`&&`bg-red-500/15 text-red-800 dark:text-red-300`),children:ze(e.status,Fn)})}),(0,x.jsx)(`td`,{className:`py-1.5 pr-2 text-fg-muted`,children:Le(e.duration)}),(0,x.jsx)(`td`,{className:`max-w-[8rem] truncate py-1.5 pr-2 text-fg-muted`,title:e.summary||e.error||``,children:Ee(e.summary||e.error,120)}),(0,x.jsx)(`td`,{className:`whitespace-nowrap py-1.5`,children:e.sessionKey?.trim()?(0,x.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-accent hover:underline`,title:n.openChatTitle,"aria-label":n.openChatTitle,onClick:()=>ft(e.sessionKey),children:n.openChat}):(0,x.jsx)(`span`,{className:`text-fg-disabled`,children:`—`})})]},e.id))})]})})]}):null})]})]})}),(0,x.jsx)(ye,{open:cn,onOpenChange:ln,children:(0,x.jsxs)(p,{children:[(0,x.jsx)(u,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim`}),(0,x.jsx)(`div`,{className:`fixed inset-0 z-[70] flex items-center justify-center p-4 pointer-events-none`,children:(0,x.jsxs)(h,{className:`xopc-dialog-content-pane pointer-events-auto relative w-full max-w-md rounded-xl border border-edge bg-surface-panel p-4 shadow-popover dark:border-edge`,children:[(0,x.jsx)(se,{className:`text-base font-semibold text-fg`,children:J===`delete`?n.delete:n.runNow}),(0,x.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:J===`delete`?n.confirmDelete:n.confirmRun}),(0,x.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,x.jsx)(_,{type:`button`,variant:`secondary`,onClick:()=>{ln(!1),fn(null),un(null)},children:n.cancel}),(0,x.jsx)(_,{type:`button`,variant:`primary`,className:J===`delete`?`bg-red-600 hover:bg-red-700`:void 0,onClick:()=>void Pn(),children:J===`delete`?n.delete:n.runNow})]})]})})]})})]}):(0,x.jsx)(`div`,{className:`mx-auto w-full max-w-app-main px-4 py-16 text-center text-sm text-fg-muted sm:px-8`,children:n.needToken})}export{vt as CronPage};
|
|
2
|
-
//# sourceMappingURL=cron-page-DpEYUvxB.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{i as t,t as n}from"./vendor-react-DbimaAId.js";import{At as r,Ct as i,Dt as a,Et as o,Ft as s,It as c,Lt as l,Mt as u,Nt as d,Ot as f,Pt as p,St as m,Tt as h,bt as g,cn as _,jt as v,kt as ee,ln as y,vt as te,wt as b,xt as x,yt as S}from"./index-DwzwDCjW.js";var C=e(t(),1),w=n();function T(e){let t=e+`CollectionProvider`,[n,r]=c(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=C.useRef(null),a=C.useRef(new Map).current;return(0,w.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let l=e+`CollectionSlot`,u=s(l),d=C.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,w.jsx)(u,{ref:y(t,a(l,n).collectionRef),children:r})});d.displayName=l;let f=e+`CollectionItemSlot`,p=`data-radix-collection-item`,m=s(f),h=C.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=C.useRef(null),s=y(t,o),c=a(f,n);return C.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,w.jsx)(m,{[p]:``,ref:s,children:r})});h.displayName=f;function g(t){let n=a(e+`CollectionConsumer`,t);return C.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${p}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:o,Slot:d,ItemSlot:h},g,r]}var E=C.createContext(void 0);function D(e){let t=C.useContext(E);return e||t||`ltr`}var O=`rovingFocusGroup.onEntryFocus`,ne={bubbles:!1,cancelable:!0},k=`RovingFocusGroup`,[A,j,M]=T(k),[re,N]=c(k,[M]),[P,F]=re(k),I=C.forwardRef((e,t)=>(0,w.jsx)(A.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,w.jsx)(A.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,w.jsx)(ie,{...e,ref:t})})}));I.displayName=k;var ie=C.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:f,preventScrollOnEntryFocus:p=!1,...m}=e,h=C.useRef(null),_=y(t,h),v=D(a),[ee,te]=g({prop:o,defaultProp:s??null,onChange:c,caller:k}),[b,x]=C.useState(!1),S=u(f),T=j(n),E=C.useRef(!1),[A,M]=C.useState(0);return C.useEffect(()=>{let e=h.current;if(e)return e.addEventListener(O,S),()=>e.removeEventListener(O,S)},[S]),(0,w.jsx)(P,{scope:n,orientation:r,dir:v,loop:i,currentTabStopId:ee,onItemFocus:C.useCallback(e=>te(e),[te]),onItemShiftTab:C.useCallback(()=>x(!0),[]),onFocusableItemAdd:C.useCallback(()=>M(e=>e+1),[]),onFocusableItemRemove:C.useCallback(()=>M(e=>e-1),[]),children:(0,w.jsx)(d.div,{tabIndex:b||A===0?-1:0,"data-orientation":r,...m,ref:_,style:{outline:`none`,...e.style},onMouseDown:l(e.onMouseDown,()=>{E.current=!0}),onFocus:l(e.onFocus,e=>{let t=!E.current;if(e.target===e.currentTarget&&t&&!b){let t=new CustomEvent(O,ne);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=T().filter(e=>e.focusable);le([e.find(e=>e.active),e.find(e=>e.id===ee),...e].filter(Boolean).map(e=>e.ref.current),p)}}E.current=!1}),onBlur:l(e.onBlur,()=>x(!1))})})}),ae=`RovingFocusGroupItem`,L=C.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=f(),u=a||c,p=F(ae,n),m=p.currentTabStopId===u,h=j(n),{onFocusableItemAdd:g,onFocusableItemRemove:_,currentTabStopId:v}=p;return C.useEffect(()=>{if(r)return g(),()=>_()},[r,g,_]),(0,w.jsx)(A.ItemSlot,{scope:n,id:u,focusable:r,active:i,children:(0,w.jsx)(d.span,{tabIndex:m?0:-1,"data-orientation":p.orientation,...s,ref:t,onMouseDown:l(e.onMouseDown,e=>{r?p.onItemFocus(u):e.preventDefault()}),onFocus:l(e.onFocus,()=>p.onItemFocus(u)),onKeyDown:l(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){p.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=ce(e,p.orientation,p.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=h().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=p.loop?ue(n,r+1):n.slice(r+1)}setTimeout(()=>le(n))}}),children:typeof o==`function`?o({isCurrentTabStop:m,hasTabStop:v!=null}):o})})});L.displayName=ae;var oe={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function se(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function ce(e,t,n){let r=se(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return oe[r]}function le(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function ue(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var de=I,fe=L,pe=[`Enter`,` `],me=[`ArrowDown`,`PageUp`,`Home`],he=[`ArrowUp`,`PageDown`,`End`],ge=[...me,...he],_e={ltr:[...pe,`ArrowRight`],rtl:[...pe,`ArrowLeft`]},ve={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},R=`Menu`,[z,ye,be]=T(R),[B,xe]=c(R,[be,a,N]),V=a(),Se=N(),[Ce,H]=B(R),[we,U]=B(R),Te=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:s=!0}=e,c=V(t),[l,d]=C.useState(null),f=C.useRef(!1),p=u(a),m=D(i);return C.useEffect(()=>{let e=()=>{f.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>f.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),(0,w.jsx)(o,{...c,children:(0,w.jsx)(Ce,{scope:t,open:n,onOpenChange:p,content:l,onContentChange:d,children:(0,w.jsx)(we,{scope:t,onClose:C.useCallback(()=>p(!1),[p]),isUsingKeyboardRef:f,dir:m,modal:s,children:r})})})};Te.displayName=R;var Ee=`MenuAnchor`,W=C.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,a=V(n);return(0,w.jsx)(i,{...a,...r,ref:t})});W.displayName=Ee;var De=`MenuPortal`,[Oe,ke]=B(De,{forceMount:void 0}),Ae=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=H(De,t);return(0,w.jsx)(Oe,{scope:t,forceMount:n,children:(0,w.jsx)(x,{present:n||a.open,children:(0,w.jsx)(m,{asChild:!0,container:i,children:r})})})};Ae.displayName=De;var G=`MenuContent`,[je,Me]=B(G),Ne=C.forwardRef((e,t)=>{let n=ke(G,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=H(G,e.__scopeMenu),o=U(G,e.__scopeMenu);return(0,w.jsx)(z.Provider,{scope:e.__scopeMenu,children:(0,w.jsx)(x,{present:r||a.open,children:(0,w.jsx)(z.Slot,{scope:e.__scopeMenu,children:o.modal?(0,w.jsx)(Pe,{...i,ref:t}):(0,w.jsx)(Fe,{...i,ref:t})})})})}),Pe=C.forwardRef((e,t)=>{let n=H(G,e.__scopeMenu),r=C.useRef(null),i=y(t,r);return C.useEffect(()=>{let e=r.current;if(e)return S(e)},[]),(0,w.jsx)(Le,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:l(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Fe=C.forwardRef((e,t)=>{let n=H(G,e.__scopeMenu);return(0,w.jsx)(Le,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Ie=s(`MenuContent.ScrollLock`),Le=C.forwardRef((e,t)=>{let{__scopeMenu:n,loop:i=!1,trapFocus:a,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:c,onEntryFocus:u,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:p,onInteractOutside:m,onDismiss:g,disableOutsideScroll:_,...b}=e,x=H(G,n),S=U(G,n),T=V(n),E=Se(n),D=ye(n),[O,ne]=C.useState(null),k=C.useRef(null),A=y(t,k,x.onContentChange),j=C.useRef(0),M=C.useRef(``),re=C.useRef(0),N=C.useRef(null),P=C.useRef(`right`),F=C.useRef(0),I=_?te:C.Fragment,ie=_?{as:Ie,allowPinchZoom:!0}:void 0,ae=e=>{let t=M.current+e,n=D().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=gt(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){M.current=t,window.clearTimeout(j.current),t!==``&&(j.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};C.useEffect(()=>()=>window.clearTimeout(j.current),[]),r();let L=C.useCallback(e=>P.current===N.current?.side&&vt(e,N.current?.area),[]);return(0,w.jsx)(je,{scope:n,searchRef:M,onItemEnter:C.useCallback(e=>{L(e)&&e.preventDefault()},[L]),onItemLeave:C.useCallback(e=>{L(e)||(k.current?.focus(),ne(null))},[L]),onTriggerLeave:C.useCallback(e=>{L(e)&&e.preventDefault()},[L]),pointerGraceTimerRef:re,onPointerGraceIntentChange:C.useCallback(e=>{N.current=e},[]),children:(0,w.jsx)(I,{...ie,children:(0,w.jsx)(ee,{asChild:!0,trapped:a,onMountAutoFocus:l(o,e=>{e.preventDefault(),k.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:(0,w.jsx)(v,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:p,onInteractOutside:m,onDismiss:g,children:(0,w.jsx)(de,{asChild:!0,...E,dir:S.dir,orientation:`vertical`,loop:i,currentTabStopId:O,onCurrentTabStopIdChange:ne,onEntryFocus:l(u,e=>{S.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,w.jsx)(h,{role:`menu`,"aria-orientation":`vertical`,"data-state":pt(x.open),"data-radix-menu-content":``,dir:S.dir,...T,...b,ref:A,style:{outline:`none`,...b.style},onKeyDown:l(b.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&ae(e.key));let i=k.current;if(e.target!==i||!ge.includes(e.key))return;e.preventDefault();let a=D().filter(e=>!e.disabled).map(e=>e.ref.current);he.includes(e.key)&&a.reverse(),mt(a)}),onBlur:l(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(j.current),M.current=``)}),onPointerMove:l(e.onPointerMove,Z(e=>{let t=e.target,n=F.current!==e.clientX;e.currentTarget.contains(t)&&n&&(P.current=e.clientX>F.current?`right`:`left`,F.current=e.clientX)}))})})})})})})});Ne.displayName=G;var Re=`MenuGroup`,ze=C.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,w.jsx)(d.div,{role:`group`,...r,ref:t})});ze.displayName=Re;var Be=`MenuLabel`,Ve=C.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,w.jsx)(d.div,{...r,ref:t})});Ve.displayName=Be;var K=`MenuItem`,He=`menu.itemSelect`,q=C.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=C.useRef(null),o=U(K,e.__scopeMenu),s=Me(K,e.__scopeMenu),c=y(t,a),u=C.useRef(!1),d=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(He,{bubbles:!0,cancelable:!0});e.addEventListener(He,e=>r?.(e),{once:!0}),p(e,t),t.defaultPrevented?u.current=!1:o.onClose()}};return(0,w.jsx)(Ue,{...i,ref:c,disabled:n,onClick:l(e.onClick,d),onPointerDown:t=>{e.onPointerDown?.(t),u.current=!0},onPointerUp:l(e.onPointerUp,e=>{u.current||e.currentTarget?.click()}),onKeyDown:l(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||pe.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});q.displayName=K;var Ue=C.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=Me(K,n),s=Se(n),c=C.useRef(null),u=y(t,c),[f,p]=C.useState(!1),[m,h]=C.useState(``);return C.useEffect(()=>{let e=c.current;e&&h((e.textContent??``).trim())},[a.children]),(0,w.jsx)(z.ItemSlot,{scope:n,disabled:r,textValue:i??m,children:(0,w.jsx)(fe,{asChild:!0,...s,focusable:!r,children:(0,w.jsx)(d.div,{role:`menuitem`,"data-highlighted":f?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:u,onPointerMove:l(e.onPointerMove,Z(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:l(e.onPointerLeave,Z(e=>o.onItemLeave(e))),onFocus:l(e.onFocus,()=>p(!0)),onBlur:l(e.onBlur,()=>p(!1))})})})}),We=`MenuCheckboxItem`,Ge=C.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,w.jsx)($e,{scope:e.__scopeMenu,checked:n,children:(0,w.jsx)(q,{role:`menuitemcheckbox`,"aria-checked":Y(n)?`mixed`:n,...i,ref:t,"data-state":X(n),onSelect:l(i.onSelect,()=>r?.(Y(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Ge.displayName=We;var Ke=`MenuRadioGroup`,[qe,Je]=B(Ke,{value:void 0,onValueChange:()=>{}}),Ye=C.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=u(r);return(0,w.jsx)(qe,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,w.jsx)(ze,{...i,ref:t})})});Ye.displayName=Ke;var Xe=`MenuRadioItem`,Ze=C.forwardRef((e,t)=>{let{value:n,...r}=e,i=Je(Xe,e.__scopeMenu),a=n===i.value;return(0,w.jsx)($e,{scope:e.__scopeMenu,checked:a,children:(0,w.jsx)(q,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":X(a),onSelect:l(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});Ze.displayName=Xe;var Qe=`MenuItemIndicator`,[$e,et]=B(Qe,{checked:!1}),tt=C.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=et(Qe,n);return(0,w.jsx)(x,{present:r||Y(a.checked)||a.checked===!0,children:(0,w.jsx)(d.span,{...i,ref:t,"data-state":X(a.checked)})})});tt.displayName=Qe;var nt=`MenuSeparator`,rt=C.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,w.jsx)(d.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});rt.displayName=nt;var it=`MenuArrow`,at=C.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=V(n);return(0,w.jsx)(b,{...i,...r,ref:t})});at.displayName=it;var ot=`MenuSub`,[st,ct]=B(ot),lt=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=H(ot,t),s=V(t),[c,l]=C.useState(null),[d,p]=C.useState(null),m=u(i);return C.useEffect(()=>(a.open===!1&&m(!1),()=>m(!1)),[a.open,m]),(0,w.jsx)(o,{...s,children:(0,w.jsx)(Ce,{scope:t,open:r,onOpenChange:m,content:d,onContentChange:p,children:(0,w.jsx)(st,{scope:t,contentId:f(),triggerId:f(),trigger:c,onTriggerChange:l,children:n})})})};lt.displayName=ot;var J=`MenuSubTrigger`,ut=C.forwardRef((e,t)=>{let n=H(J,e.__scopeMenu),r=U(J,e.__scopeMenu),i=ct(J,e.__scopeMenu),a=Me(J,e.__scopeMenu),o=C.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,u={__scopeMenu:e.__scopeMenu},d=C.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return C.useEffect(()=>d,[d]),C.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]),(0,w.jsx)(W,{asChild:!0,...u,children:(0,w.jsx)(Ue,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":pt(n.open),...e,ref:_(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:l(e.onPointerMove,Z(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:l(e.onPointerLeave,Z(e=>{d();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:l(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||_e[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});ut.displayName=J;var dt=`MenuSubContent`,ft=C.forwardRef((e,t)=>{let n=ke(G,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=H(G,e.__scopeMenu),o=U(G,e.__scopeMenu),s=ct(dt,e.__scopeMenu),c=C.useRef(null),u=y(t,c);return(0,w.jsx)(z.Provider,{scope:e.__scopeMenu,children:(0,w.jsx)(x,{present:r||a.open,children:(0,w.jsx)(z.Slot,{scope:e.__scopeMenu,children:(0,w.jsx)(Le,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:u,align:`start`,side:o.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&c.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:l(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:l(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:l(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=ve[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});ft.displayName=dt;function pt(e){return e?`open`:`closed`}function Y(e){return e===`indeterminate`}function X(e){return Y(e)?`indeterminate`:e?`checked`:`unchecked`}function mt(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function ht(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function gt(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=ht(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function _t(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function vt(e,t){return t?_t({x:e.clientX,y:e.clientY},t):!1}function Z(e){return t=>t.pointerType===`mouse`?e(t):void 0}var yt=Te,bt=W,xt=Ae,St=Ne,Ct=ze,wt=Ve,Tt=q,Et=Ge,Dt=Ye,Ot=Ze,kt=tt,At=rt,jt=at,Mt=ut,Nt=ft,Q=`DropdownMenu`,[Pt,Ft]=c(Q,[xe]),$=xe(),[It,Lt]=Pt(Q),Rt=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=$(t),l=C.useRef(null),[u,d]=g({prop:i,defaultProp:a??!1,onChange:o,caller:Q});return(0,w.jsx)(It,{scope:t,triggerId:f(),triggerRef:l,contentId:f(),open:u,onOpenChange:d,onOpenToggle:C.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,w.jsx)(yt,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};Rt.displayName=Q;var zt=`DropdownMenuTrigger`,Bt=C.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=Lt(zt,n),o=$(n);return(0,w.jsx)(bt,{asChild:!0,...o,children:(0,w.jsx)(d.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:_(t,a.triggerRef),onPointerDown:l(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:l(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});Bt.displayName=zt;var Vt=`DropdownMenuPortal`,Ht=e=>{let{__scopeDropdownMenu:t,...n}=e,r=$(t);return(0,w.jsx)(xt,{...r,...n})};Ht.displayName=Vt;var Ut=`DropdownMenuContent`,Wt=C.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Lt(Ut,n),a=$(n),o=C.useRef(!1);return(0,w.jsx)(St,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:l(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:l(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Wt.displayName=Ut;var Gt=`DropdownMenuGroup`,Kt=C.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,w.jsx)(Ct,{...i,...r,ref:t})});Kt.displayName=Gt;var qt=`DropdownMenuLabel`,Jt=C.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,w.jsx)(wt,{...i,...r,ref:t})});Jt.displayName=qt;var Yt=`DropdownMenuItem`,Xt=C.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,w.jsx)(Tt,{...i,...r,ref:t})});Xt.displayName=Yt;var Zt=`DropdownMenuCheckboxItem`,Qt=C.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,w.jsx)(Et,{...i,...r,ref:t})});Qt.displayName=Zt;var $t=`DropdownMenuRadioGroup`,en=C.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,w.jsx)(Dt,{...i,...r,ref:t})});en.displayName=$t;var tn=`DropdownMenuRadioItem`,nn=C.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,w.jsx)(Ot,{...i,...r,ref:t})});nn.displayName=tn;var rn=`DropdownMenuItemIndicator`,an=C.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,w.jsx)(kt,{...i,...r,ref:t})});an.displayName=rn;var on=`DropdownMenuSeparator`,sn=C.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,w.jsx)(At,{...i,...r,ref:t})});sn.displayName=on;var cn=`DropdownMenuArrow`,ln=C.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,w.jsx)(jt,{...i,...r,ref:t})});ln.displayName=cn;var un=`DropdownMenuSubTrigger`,dn=C.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,w.jsx)(Mt,{...i,...r,ref:t})});dn.displayName=un;var fn=`DropdownMenuSubContent`,pn=C.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,w.jsx)(Nt,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});pn.displayName=fn;var mn=Rt,hn=Bt,gn=Ht,_n=Wt,vn=Xt;export{hn as a,mn as i,vn as n,gn as r,_n as t};
|
|
2
|
-
//# sourceMappingURL=dist-C41N3YrO.js.map
|