@nextclaw/ui 0.5.35 → 0.5.37

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.
Files changed (41) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/assets/ChannelsList-DtvhbEV9.js +1 -0
  3. package/dist/assets/{ChatPage-C_wANEY9.js → ChatPage-Bw_aXB4R.js} +2 -2
  4. package/dist/assets/CronConfig-BZLXcDbm.js +1 -0
  5. package/dist/assets/{DocBrowser-CdX5oDgu.js → DocBrowser-BY0TiFOc.js} +1 -1
  6. package/dist/assets/MarketplacePage-BDlAw7fO.js +1 -0
  7. package/dist/assets/{ModelConfig-DagIPD4R.js → ModelConfig-Bi8Q4_NG.js} +1 -1
  8. package/dist/assets/ProvidersList-D2OB0siE.js +1 -0
  9. package/dist/assets/{RuntimeConfig-BDyqfVSA.js → RuntimeConfig-Bz9aUkwu.js} +1 -1
  10. package/dist/assets/{SecretsConfig-De2IZ7GX.js → SecretsConfig-Bqi-biOL.js} +1 -1
  11. package/dist/assets/SessionsConfig-DcWT2QvI.js +2 -0
  12. package/dist/assets/{card-CWG4Tz0Y.js → card-DwZkVl7S.js} +1 -1
  13. package/dist/assets/index-C1NAfZSm.js +2 -0
  14. package/dist/assets/index-DWgSvrx4.css +1 -0
  15. package/dist/assets/{label-LbWa2Yzc.js → label-BBDuC6Nm.js} +1 -1
  16. package/dist/assets/logos-DMFt4YDI.js +1 -0
  17. package/dist/assets/{page-layout-Bz8CAEiD.js → page-layout-hPFzCUTQ.js} +1 -1
  18. package/dist/assets/{switch-BwbfObfA.js → switch-CwkcbkEs.js} +1 -1
  19. package/dist/assets/{tabs-custom-VeX6BYro.js → tabs-custom-TUrWRyYy.js} +1 -1
  20. package/dist/assets/{useConfig-CFFZ66EV.js → useConfig-DZVUrqQz.js} +1 -1
  21. package/dist/assets/useConfirmDialog-D5X0Iqid.js +5 -0
  22. package/dist/assets/{vendor-CmqkRoMs.js → vendor-DN_iJQc4.js} +75 -85
  23. package/dist/index.html +3 -3
  24. package/package.json +1 -1
  25. package/src/components/common/LogoBadge.tsx +2 -2
  26. package/src/components/config/ChannelForm.tsx +170 -180
  27. package/src/components/config/ChannelsList.tsx +131 -93
  28. package/src/components/config/ProviderForm.tsx +3 -2
  29. package/src/components/config/ProvidersList.tsx +3 -2
  30. package/src/components/config/config-layout.ts +10 -0
  31. package/src/lib/i18n.ts +6 -0
  32. package/dist/assets/ChannelsList-DGoIQT1t.js +0 -1
  33. package/dist/assets/CronConfig-Q7faThLl.js +0 -1
  34. package/dist/assets/MarketplacePage-DXoPkFYk.js +0 -1
  35. package/dist/assets/ProvidersList-2aHarRNe.js +0 -1
  36. package/dist/assets/SessionsConfig-BK0xx6EF.js +0 -2
  37. package/dist/assets/dialog-ssdjbutm.js +0 -5
  38. package/dist/assets/index-B8Wh_FvS.css +0 -1
  39. package/dist/assets/index-q2B1bssI.js +0 -2
  40. package/dist/assets/logos-DncMldHC.js +0 -1
  41. package/dist/assets/useConfirmDialog-ClpvgpHh.js +0 -1
@@ -1,27 +1,18 @@
1
1
  import { useConfig, useConfigMeta, useConfigSchema } from '@/hooks/useConfig';
2
- import { MessageCircle, Mail, MessageSquare, Slack, ExternalLink, Bell } from 'lucide-react';
3
- import { useState } from 'react';
2
+ import { MessageSquare, ExternalLink, Search } from 'lucide-react';
3
+ import { useEffect, useMemo, useState } from 'react';
4
4
  import { ChannelForm } from './ChannelForm';
5
- import { useUiStore } from '@/stores/ui.store';
6
5
  import { Tabs } from '@/components/ui/tabs-custom';
7
6
  import { LogoBadge } from '@/components/common/LogoBadge';
8
7
  import { getChannelLogo } from '@/lib/logos';
9
8
  import { hintForPath } from '@/lib/config-hints';
10
- import { ConfigCard, ConfigCardHeader, ConfigCardBody, ConfigCardFooter } from '@/components/ui/config-card';
11
9
  import { StatusDot } from '@/components/ui/status-dot';
12
- import { ActionLink } from '@/components/ui/action-link';
13
10
  import { cn } from '@/lib/utils';
14
11
  import { t } from '@/lib/i18n';
15
12
  import { PageLayout, PageHeader } from '@/components/layout/page-layout';
16
13
  import { resolveChannelTutorialUrl } from '@/lib/channel-tutorials';
17
-
18
- const channelIcons: Record<string, typeof MessageCircle> = {
19
- telegram: MessageCircle,
20
- slack: Slack,
21
- email: Mail,
22
- webhook: Bell,
23
- default: MessageSquare
24
- };
14
+ import { Input } from '@/components/ui/input';
15
+ import { CONFIG_SIDEBAR_CARD_CLASS, CONFIG_SPLIT_GRID_CLASS } from './config-layout';
25
16
 
26
17
  const channelDescriptionKeys: Record<string, string> = {
27
18
  telegram: 'channelDescTelegram',
@@ -36,102 +27,149 @@ export function ChannelsList() {
36
27
  const { data: config } = useConfig();
37
28
  const { data: meta } = useConfigMeta();
38
29
  const { data: schema } = useConfigSchema();
39
- const { openChannelModal } = useUiStore();
40
- const [activeTab, setActiveTab] = useState('active');
30
+ const [activeTab, setActiveTab] = useState('enabled');
31
+ const [selectedChannel, setSelectedChannel] = useState<string | undefined>();
32
+ const [query, setQuery] = useState('');
41
33
  const uiHints = schema?.uiHints;
42
-
43
- if (!config || !meta) {
44
- return <div className="p-8 text-gray-400">{t('channelsLoading')}</div>;
45
- }
34
+ const channels = meta?.channels;
35
+ const channelConfigs = config?.channels;
46
36
 
47
37
  const tabs = [
48
- { id: 'active', label: t('channelsTabEnabled'), count: meta.channels.filter(c => config.channels[c.name]?.enabled).length },
49
- { id: 'all', label: t('channelsTabAll'), count: meta.channels.length }
38
+ { id: 'enabled', label: t('channelsTabEnabled'), count: (channels ?? []).filter((c) => channelConfigs?.[c.name]?.enabled).length },
39
+ { id: 'all', label: t('channelsTabAll'), count: (channels ?? []).length }
50
40
  ];
51
41
 
52
- const filteredChannels = meta.channels.filter(channel => {
53
- const enabled = config.channels[channel.name]?.enabled || false;
54
- return activeTab === 'all' || enabled;
55
- });
42
+ const filteredChannels = useMemo(() => {
43
+ const keyword = query.trim().toLowerCase();
44
+ return (channels ?? [])
45
+ .filter((channel) => {
46
+ const enabled = channelConfigs?.[channel.name]?.enabled || false;
47
+ if (activeTab === 'enabled') {
48
+ return enabled;
49
+ }
50
+ return true;
51
+ })
52
+ .filter((channel) => {
53
+ if (!keyword) {
54
+ return true;
55
+ }
56
+ const display = (channel.displayName || channel.name).toLowerCase();
57
+ return display.includes(keyword) || channel.name.toLowerCase().includes(keyword);
58
+ });
59
+ }, [activeTab, channelConfigs, channels, query]);
60
+
61
+ useEffect(() => {
62
+ if (filteredChannels.length === 0) {
63
+ setSelectedChannel(undefined);
64
+ return;
65
+ }
66
+ const exists = filteredChannels.some((channel) => channel.name === selectedChannel);
67
+ if (!exists) {
68
+ setSelectedChannel(filteredChannels[0].name);
69
+ }
70
+ }, [filteredChannels, selectedChannel]);
71
+
72
+ if (!config || !meta) {
73
+ return <div className="p-8 text-gray-400">{t('channelsLoading')}</div>;
74
+ }
56
75
 
57
76
  return (
58
77
  <PageLayout>
59
- <PageHeader title={t('channelsPageTitle')} />
78
+ <PageHeader title={t('channelsPageTitle')} description={t('channelsPageDescription')} />
79
+
80
+ <div className={CONFIG_SPLIT_GRID_CLASS}>
81
+ <section className={CONFIG_SIDEBAR_CARD_CLASS}>
82
+ <div className="border-b border-gray-100 px-4 pt-4">
83
+ <Tabs tabs={tabs} activeTab={activeTab} onChange={setActiveTab} className="mb-0" />
84
+ </div>
60
85
 
61
- <Tabs tabs={tabs} activeTab={activeTab} onChange={setActiveTab} />
86
+ <div className="border-b border-gray-100 px-4 py-3">
87
+ <div className="relative">
88
+ <Search className="pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-400" />
89
+ <Input
90
+ value={query}
91
+ onChange={(e) => setQuery(e.target.value)}
92
+ placeholder={t('channelsFilterPlaceholder')}
93
+ className="h-10 rounded-xl pl-9"
94
+ />
95
+ </div>
96
+ </div>
62
97
 
63
- {/* Channel Cards Grid */}
64
- <div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4">
65
- {filteredChannels.map((channel) => {
66
- const channelConfig = config.channels[channel.name];
67
- const enabled = channelConfig?.enabled || false;
68
- const Icon = channelIcons[channel.name] || channelIcons.default;
69
- const channelHint = hintForPath(`channels.${channel.name}`, uiHints);
70
- const tutorialUrl = resolveChannelTutorialUrl(channel);
71
- const description =
72
- channelHint?.help ||
73
- t(channelDescriptionKeys[channel.name] || 'channelDescriptionDefault');
98
+ <div className="min-h-0 flex-1 space-y-2 overflow-y-auto p-3">
99
+ {filteredChannels.map((channel) => {
100
+ const channelConfig = config.channels[channel.name];
101
+ const enabled = channelConfig?.enabled || false;
102
+ const channelHint = hintForPath(`channels.${channel.name}`, uiHints);
103
+ const tutorialUrl = resolveChannelTutorialUrl(channel);
104
+ const description =
105
+ channelHint?.help ||
106
+ t(channelDescriptionKeys[channel.name] || 'channelDescriptionDefault');
107
+ const isActive = selectedChannel === channel.name;
74
108
 
75
- return (
76
- <ConfigCard key={channel.name} onClick={() => openChannelModal(channel.name)}>
77
- <ConfigCardHeader>
78
- <LogoBadge
79
- name={channel.name}
80
- src={getChannelLogo(channel.name)}
109
+ return (
110
+ <button
111
+ key={channel.name}
112
+ type="button"
113
+ onClick={() => setSelectedChannel(channel.name)}
81
114
  className={cn(
82
- 'h-11 w-11 rounded-xl border transition-all',
83
- enabled
84
- ? 'bg-white border-primary/30'
85
- : 'bg-white border-gray-200/60 group-hover:border-gray-300'
115
+ 'w-full rounded-xl border p-2.5 text-left transition-all',
116
+ isActive
117
+ ? 'border-primary/30 bg-primary-50/40 shadow-sm'
118
+ : 'border-gray-200/70 bg-white hover:border-gray-300 hover:bg-gray-50/70'
86
119
  )}
87
- imgClassName="h-5 w-5"
88
- fallback={<Icon className="h-5 w-5" />}
89
- />
90
- <StatusDot
91
- status={enabled ? 'active' : 'inactive'}
92
- label={enabled ? t('statusActive') : t('statusInactive')}
93
- />
94
- </ConfigCardHeader>
120
+ >
121
+ <div className="flex items-start justify-between gap-3">
122
+ <div className="flex min-w-0 items-center gap-3">
123
+ <LogoBadge
124
+ name={channel.name}
125
+ src={getChannelLogo(channel.name)}
126
+ className={cn(
127
+ 'h-10 w-10 rounded-lg border',
128
+ enabled ? 'border-primary/30 bg-white' : 'border-gray-200/70 bg-white'
129
+ )}
130
+ imgClassName="h-5 w-5 object-contain"
131
+ fallback={<span className="text-sm font-semibold uppercase text-gray-500">{channel.name[0]}</span>}
132
+ />
133
+ <div className="min-w-0">
134
+ <p className="truncate text-sm font-semibold text-gray-900">{channel.displayName || channel.name}</p>
135
+ <p className="line-clamp-1 text-[11px] text-gray-500">{description}</p>
136
+ </div>
137
+ </div>
138
+ <div className="flex items-center gap-2">
139
+ {tutorialUrl && (
140
+ <a
141
+ href={tutorialUrl}
142
+ onClick={(e) => e.stopPropagation()}
143
+ className="inline-flex h-7 w-7 items-center justify-center rounded-md text-gray-300 transition-colors hover:bg-gray-100/70 hover:text-gray-500"
144
+ title={t('channelsGuideTitle')}
145
+ >
146
+ <ExternalLink className="h-3.5 w-3.5" />
147
+ </a>
148
+ )}
149
+ <StatusDot
150
+ status={enabled ? 'active' : 'inactive'}
151
+ label={enabled ? t('statusActive') : t('statusInactive')}
152
+ className="min-w-[56px] justify-center"
153
+ />
154
+ </div>
155
+ </div>
156
+ </button>
157
+ );
158
+ })}
95
159
 
96
- <ConfigCardBody
97
- title={channel.displayName || channel.name}
98
- description={description}
99
- />
100
-
101
- <ConfigCardFooter>
102
- <ActionLink label={enabled ? t('actionConfigure') : t('actionEnable')} />
103
- {tutorialUrl && (
104
- <a
105
- href={tutorialUrl}
106
- onClick={(e) => e.stopPropagation()}
107
- className="flex items-center justify-center h-6 w-6 rounded-md text-gray-300 hover:text-gray-500 hover:bg-gray-100/60 transition-colors"
108
- title={t('channelsGuideTitle')}
109
- >
110
- <ExternalLink className="h-3.5 w-3.5" />
111
- </a>
112
- )}
113
- </ConfigCardFooter>
114
- </ConfigCard>
115
- );
116
- })}
117
- </div>
118
-
119
- {/* Empty State */}
120
- {filteredChannels.length === 0 && (
121
- <div className="flex flex-col items-center justify-center py-16 text-center">
122
- <div className="h-14 w-14 flex items-center justify-center rounded-xl bg-gray-100/80 mb-4">
123
- <MessageSquare className="h-6 w-6 text-gray-300" />
160
+ {filteredChannels.length === 0 && (
161
+ <div className="flex h-full min-h-[220px] flex-col items-center justify-center rounded-xl border border-dashed border-gray-200 bg-gray-50/70 py-10 text-center">
162
+ <div className="mb-3 flex h-10 w-10 items-center justify-center rounded-lg bg-white">
163
+ <MessageSquare className="h-5 w-5 text-gray-300" />
164
+ </div>
165
+ <p className="text-sm font-medium text-gray-700">{t('channelsNoMatch')}</p>
166
+ </div>
167
+ )}
124
168
  </div>
125
- <h3 className="text-[14px] font-semibold text-gray-900 mb-1.5">
126
- {t('channelsEmptyTitle')}
127
- </h3>
128
- <p className="text-[13px] text-gray-400 max-w-sm">
129
- {t('channelsEmptyDescription')}
130
- </p>
131
- </div>
132
- )}
169
+ </section>
133
170
 
134
- <ChannelForm />
171
+ <ChannelForm channelName={selectedChannel} />
172
+ </div>
135
173
  </PageLayout>
136
174
  );
137
175
  }
@@ -12,6 +12,7 @@ import { hintForPath } from '@/lib/config-hints';
12
12
  import type { ProviderConfigUpdate, ProviderConnectionTestRequest } from '@/api/types';
13
13
  import { KeyRound, Globe, Hash, RotateCcw, CircleDotDashed, Sparkles, Plus, X } from 'lucide-react';
14
14
  import { toast } from 'sonner';
15
+ import { CONFIG_DETAIL_CARD_CLASS, CONFIG_EMPTY_DETAIL_CARD_CLASS } from './config-layout';
15
16
 
16
17
  type WireApiType = 'auto' | 'chat' | 'responses';
17
18
 
@@ -319,7 +320,7 @@ export function ProviderForm({ providerName }: ProviderFormProps) {
319
320
 
320
321
  if (!providerName || !providerSpec || !providerConfig) {
321
322
  return (
322
- <div className="flex min-h-[520px] items-center justify-center rounded-2xl border border-gray-200/70 bg-white px-6 text-center xl:h-[calc(100vh-180px)] xl:min-h-[600px] xl:max-h-[860px]">
323
+ <div className={CONFIG_EMPTY_DETAIL_CARD_CLASS}>
323
324
  <div>
324
325
  <h3 className="text-base font-semibold text-gray-900">{t('providersSelectTitle')}</h3>
325
326
  <p className="mt-2 text-sm text-gray-500">{t('providersSelectDescription')}</p>
@@ -331,7 +332,7 @@ export function ProviderForm({ providerName }: ProviderFormProps) {
331
332
  const statusLabel = providerConfig.apiKeySet ? t('statusReady') : t('statusSetup');
332
333
 
333
334
  return (
334
- <div className="flex min-h-[520px] flex-col rounded-2xl border border-gray-200/70 bg-white shadow-card xl:h-[calc(100vh-180px)] xl:min-h-[600px] xl:max-h-[860px]">
335
+ <div className={CONFIG_DETAIL_CARD_CLASS}>
335
336
  <div className="border-b border-gray-100 px-6 py-5">
336
337
  <div className="flex flex-wrap items-center justify-between gap-3">
337
338
  <div className="min-w-0">
@@ -11,6 +11,7 @@ import { StatusDot } from '@/components/ui/status-dot';
11
11
  import { t } from '@/lib/i18n';
12
12
  import { PageLayout, PageHeader } from '@/components/layout/page-layout';
13
13
  import { Input } from '@/components/ui/input';
14
+ import { CONFIG_SIDEBAR_CARD_CLASS, CONFIG_SPLIT_GRID_CLASS } from './config-layout';
14
15
 
15
16
  function formatBasePreview(base?: string | null): string | null {
16
17
  if (!base) {
@@ -86,8 +87,8 @@ export function ProvidersList() {
86
87
  <PageLayout>
87
88
  <PageHeader title={t('providersPageTitle')} description={t('providersPageDescription')} />
88
89
 
89
- <div className="grid grid-cols-1 gap-5 xl:grid-cols-[340px_minmax(0,1fr)]">
90
- <section className="flex min-h-[520px] flex-col rounded-2xl border border-gray-200/70 bg-white shadow-card xl:h-[calc(100vh-180px)] xl:min-h-[600px] xl:max-h-[860px]">
90
+ <div className={CONFIG_SPLIT_GRID_CLASS}>
91
+ <section className={CONFIG_SIDEBAR_CARD_CLASS}>
91
92
  <div className="border-b border-gray-100 px-4 pt-4">
92
93
  <Tabs tabs={tabs} activeTab={activeTab} onChange={setActiveTab} className="mb-0" />
93
94
  </div>
@@ -0,0 +1,10 @@
1
+ export const CONFIG_SPLIT_GRID_CLASS = 'grid min-h-0 grid-cols-1 gap-5 xl:grid-cols-[340px_minmax(0,1fr)]';
2
+
3
+ export const CONFIG_SIDEBAR_CARD_CLASS =
4
+ 'flex min-h-[520px] min-h-0 min-w-0 flex-col overflow-hidden rounded-2xl border border-gray-200/70 bg-white shadow-card xl:h-[calc(100vh-180px)] xl:min-h-[600px] xl:max-h-[860px]';
5
+
6
+ export const CONFIG_DETAIL_CARD_CLASS =
7
+ 'flex min-h-[520px] min-h-0 min-w-0 flex-col overflow-hidden rounded-2xl border border-gray-200/70 bg-white shadow-card xl:h-[calc(100vh-180px)] xl:min-h-[600px] xl:max-h-[860px]';
8
+
9
+ export const CONFIG_EMPTY_DETAIL_CARD_CLASS =
10
+ 'flex min-h-[520px] min-w-0 items-center justify-center overflow-hidden rounded-2xl border border-gray-200/70 bg-white px-6 text-center xl:h-[calc(100vh-180px)] xl:min-h-[600px] xl:max-h-[860px]';
package/src/lib/i18n.ts CHANGED
@@ -220,9 +220,15 @@ export const LABELS: Record<string, { zh: string; en: string }> = {
220
220
 
221
221
  // Channel
222
222
  channelsPageTitle: { zh: '消息渠道', en: 'Message Channels' },
223
+ channelsPageDescription: { zh: '在一个页面中连续筛选、切换并配置各个消息渠道。', en: 'Filter, switch, and configure messaging channels in one continuous workspace.' },
223
224
  channelsLoading: { zh: '加载渠道中...', en: 'Loading channels...' },
224
225
  channelsTabEnabled: { zh: '已启用', en: 'Enabled' },
225
226
  channelsTabAll: { zh: '全部渠道', en: 'All Channels' },
227
+ channelsFilterPlaceholder: { zh: '搜索渠道', en: 'Search channels' },
228
+ channelsNoMatch: { zh: '没有匹配的渠道', en: 'No matching channels' },
229
+ channelsSelectTitle: { zh: '选择左侧渠道开始配置', en: 'Select a channel from the left to configure' },
230
+ channelsSelectDescription: { zh: '你可以连续切换多个渠道并逐个保存配置。', en: 'Switch between channels continuously and save each configuration.' },
231
+ channelsFormDescription: { zh: '配置消息渠道参数', en: 'Configure message channel parameters' },
226
232
  channelsEmptyTitle: { zh: '暂无启用渠道', en: 'No channels enabled' },
227
233
  channelsEmptyDescription: { zh: '启用一个消息渠道以开始接收消息。', en: 'Enable a messaging channel to start receiving messages.' },
228
234
  channelDescriptionDefault: { zh: '配置该通信渠道', en: 'Configure this communication channel' },
@@ -1 +0,0 @@
1
- import{r as k,j as a,ad as oe,M as T,ah as U,s as re,ag as I,K as ce,a1 as ie,ac as me,ai as pe,aj as de,ak as ue,n as J,al as be,am as xe,an as ge}from"./vendor-CmqkRoMs.js";import{u as _,a as z,b as V,i as ye,j as he,I as F}from"./useConfig-CFFZ66EV.js";import{t as e,c as j,h as fe,u as Y,S as we,a as je,b as ve,d as ke,e as Ce}from"./index-q2B1bssI.js";import{D as Ne,a as Pe,b as Se,c as Ie,d as Te,e as De}from"./dialog-ssdjbutm.js";import{B as M,P as Fe,a as Me}from"./page-layout-Bz8CAEiD.js";import{L as Ae}from"./label-LbWa2Yzc.js";import{S as Ue}from"./switch-BwbfObfA.js";import{h as A}from"./config-hints-CApS3K_7.js";import{T as Le}from"./tabs-custom-VeX6BYro.js";import{L as Be,a as Ee,S as Oe}from"./logos-DncMldHC.js";function Re({value:n,onChange:l,className:c,placeholder:d=""}){const[i,u]=k.useState(""),f=p=>{p.key==="Enter"&&i.trim()?(p.preventDefault(),l([...n,i.trim()]),u("")):p.key==="Backspace"&&!i&&n.length>0&&l(n.slice(0,-1))},g=p=>{l(n.filter((m,x)=>x!==p))};return a.jsxs("div",{className:j("flex flex-wrap gap-2 p-2 border rounded-md min-h-[42px]",c),children:[n.map((p,m)=>a.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-primary text-primary-foreground rounded text-sm",children:[p,a.jsx("button",{type:"button",onClick:()=>g(m),className:"hover:text-red-300 transition-colors",children:a.jsx(oe,{className:"h-3 w-3"})})]},m)),a.jsx("input",{type:"text",value:i,onChange:p=>u(p.target.value),onKeyDown:f,className:"flex-1 outline-none min-w-[100px] bg-transparent text-sm",placeholder:d||e("enterTag")})]})}function W(n){var d,i;const l=fe();return((d=n.tutorialUrls)==null?void 0:d[l])||((i=n.tutorialUrls)==null?void 0:i.default)||n.tutorialUrl}const R=[{value:"pairing",label:"pairing"},{value:"allowlist",label:"allowlist"},{value:"open",label:"open"},{value:"disabled",label:"disabled"}],$=[{value:"open",label:"open"},{value:"allowlist",label:"allowlist"},{value:"disabled",label:"disabled"}],$e=[{value:"off",label:"off"},{value:"partial",label:"partial"},{value:"block",label:"block"},{value:"progress",label:"progress"}],He=n=>n.includes("token")||n.includes("secret")||n.includes("password")?a.jsx(ce,{className:"h-3.5 w-3.5 text-gray-500"}):n.includes("url")||n.includes("host")?a.jsx(ie,{className:"h-3.5 w-3.5 text-gray-500"}):n.includes("email")||n.includes("mail")?a.jsx(U,{className:"h-3.5 w-3.5 text-gray-500"}):n.includes("id")||n.includes("from")?a.jsx(me,{className:"h-3.5 w-3.5 text-gray-500"}):n==="enabled"||n==="consentGranted"?a.jsx(pe,{className:"h-3.5 w-3.5 text-gray-500"}):a.jsx(de,{className:"h-3.5 w-3.5 text-gray-500"});function H(){return{telegram:[{name:"enabled",type:"boolean",label:e("enabled")},{name:"token",type:"password",label:e("botToken")},{name:"allowFrom",type:"tags",label:e("allowFrom")},{name:"proxy",type:"text",label:e("proxy")},{name:"accountId",type:"text",label:e("accountId")},{name:"dmPolicy",type:"select",label:e("dmPolicy"),options:R},{name:"groupPolicy",type:"select",label:e("groupPolicy"),options:$},{name:"groupAllowFrom",type:"tags",label:e("groupAllowFrom")},{name:"requireMention",type:"boolean",label:e("requireMention")},{name:"mentionPatterns",type:"tags",label:e("mentionPatterns")},{name:"groups",type:"json",label:e("groupRulesJson")}],discord:[{name:"enabled",type:"boolean",label:e("enabled")},{name:"token",type:"password",label:e("botToken")},{name:"allowBots",type:"boolean",label:e("allowBotMessages")},{name:"allowFrom",type:"tags",label:e("allowFrom")},{name:"gatewayUrl",type:"text",label:e("gatewayUrl")},{name:"intents",type:"number",label:e("intents")},{name:"proxy",type:"text",label:e("proxy")},{name:"mediaMaxMb",type:"number",label:e("attachmentMaxSizeMb")},{name:"streaming",type:"select",label:e("streamingMode"),options:$e},{name:"draftChunk",type:"json",label:e("draftChunkingJson")},{name:"textChunkLimit",type:"number",label:e("textChunkLimit")},{name:"accountId",type:"text",label:e("accountId")},{name:"dmPolicy",type:"select",label:e("dmPolicy"),options:R},{name:"groupPolicy",type:"select",label:e("groupPolicy"),options:$},{name:"groupAllowFrom",type:"tags",label:e("groupAllowFrom")},{name:"requireMention",type:"boolean",label:e("requireMention")},{name:"mentionPatterns",type:"tags",label:e("mentionPatterns")},{name:"groups",type:"json",label:e("groupRulesJson")}],whatsapp:[{name:"enabled",type:"boolean",label:e("enabled")},{name:"bridgeUrl",type:"text",label:e("bridgeUrl")},{name:"allowFrom",type:"tags",label:e("allowFrom")}],feishu:[{name:"enabled",type:"boolean",label:e("enabled")},{name:"appId",type:"text",label:e("appId")},{name:"appSecret",type:"password",label:e("appSecret")},{name:"encryptKey",type:"password",label:e("encryptKey")},{name:"verificationToken",type:"password",label:e("verificationToken")},{name:"allowFrom",type:"tags",label:e("allowFrom")}],dingtalk:[{name:"enabled",type:"boolean",label:e("enabled")},{name:"clientId",type:"text",label:e("clientId")},{name:"clientSecret",type:"password",label:e("clientSecret")},{name:"allowFrom",type:"tags",label:e("allowFrom")}],wecom:[{name:"enabled",type:"boolean",label:e("enabled")},{name:"corpId",type:"text",label:e("corpId")},{name:"agentId",type:"text",label:e("agentId")},{name:"secret",type:"password",label:e("secret")},{name:"token",type:"password",label:e("token")},{name:"callbackPort",type:"number",label:e("callbackPort")},{name:"callbackPath",type:"text",label:e("callbackPath")},{name:"allowFrom",type:"tags",label:e("allowFrom")}],slack:[{name:"enabled",type:"boolean",label:e("enabled")},{name:"mode",type:"text",label:e("mode")},{name:"webhookPath",type:"text",label:e("webhookPath")},{name:"allowBots",type:"boolean",label:e("allowBotMessages")},{name:"botToken",type:"password",label:e("botToken")},{name:"appToken",type:"password",label:e("appToken")}],email:[{name:"enabled",type:"boolean",label:e("enabled")},{name:"consentGranted",type:"boolean",label:e("consentGranted")},{name:"imapHost",type:"text",label:e("imapHost")},{name:"imapPort",type:"number",label:e("imapPort")},{name:"imapUsername",type:"text",label:e("imapUsername")},{name:"imapPassword",type:"password",label:e("imapPassword")},{name:"fromAddress",type:"email",label:e("fromAddress")}],mochat:[{name:"enabled",type:"boolean",label:e("enabled")},{name:"baseUrl",type:"text",label:e("baseUrl")},{name:"clawToken",type:"password",label:e("clawToken")},{name:"agentUserId",type:"text",label:e("agentUserId")},{name:"allowFrom",type:"tags",label:e("allowFrom")}],qq:[{name:"enabled",type:"boolean",label:e("enabled")},{name:"appId",type:"text",label:e("appId")},{name:"secret",type:"password",label:e("appSecret")},{name:"markdownSupport",type:"boolean",label:e("markdownSupport")},{name:"allowFrom",type:"tags",label:e("allowFrom")}]}}const G={telegram:T,slack:T,email:U,default:T},K={telegram:"from-primary-300 to-primary-600",slack:"from-primary-200 to-primary-500",email:"from-primary-100 to-primary-400",default:"from-gray-300 to-gray-500"};function D(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function X(n,l){const c={...n};for(const[d,i]of Object.entries(l)){const u=c[d];if(D(u)&&D(i)){c[d]=X(u,i);continue}c[d]=i}return c}function Ge(n,l){const c=n.split("."),d={};let i=d;for(let u=0;u<c.length-1;u+=1){const f=c[u];i[f]={},i=i[f]}return i[c[c.length-1]]=l,d}function Ke(){var E,O;const{channelModal:n,closeChannelModal:l}=Y(),{data:c}=_(),{data:d}=z(),{data:i}=V(),u=ye(),f=he(),[g,p]=k.useState({}),[m,x]=k.useState({}),[h,N]=k.useState(null),s=n.channel,w=s?c==null?void 0:c.channels[s]:null,C=s?H()[s]??[]:[],P=i==null?void 0:i.uiHints,S=s?`channels.${s}`:null,Q=((E=i==null?void 0:i.actions)==null?void 0:E.filter(t=>t.scope===S))??[],Z=s&&(((O=A(`channels.${s}`,P))==null?void 0:O.label)??s),L=d==null?void 0:d.channels.find(t=>t.name===s),B=L?W(L):void 0;k.useEffect(()=>{if(w){p({...w});const t={};(s?H()[s]??[]:[]).filter(r=>r.type==="json").forEach(r=>{const y=w[r.name];t[r.name]=JSON.stringify(y??{},null,2)}),x(t)}else p({}),x({})},[w,s]);const v=(t,o)=>{p(r=>({...r,[t]:o}))},ee=t=>{if(t.preventDefault(),!s)return;const o={...g};for(const r of C){if(r.type!=="password")continue;const y=o[r.name];(typeof y!="string"||y.length===0)&&delete o[r.name]}for(const r of C){if(r.type!=="json")continue;const y=m[r.name]??"";try{o[r.name]=y.trim()?JSON.parse(y):{}}catch{I.error(`${e("invalidJson")}: ${r.name}`);return}}u.mutate({channel:s,data:o},{onSuccess:()=>l()})},ae=t=>{if(!t||!s)return;const o=t.channels;if(!D(o))return;const r=o[s];D(r)&&p(y=>X(y,r))},te=async t=>{if(!(!s||!S)){N(t.id);try{let o={...g};t.saveBeforeRun&&(o={...o,...t.savePatch??{}},p(o),await u.mutateAsync({channel:s,data:o}));const r=await f.mutateAsync({actionId:t.id,data:{scope:S,draftConfig:Ge(S,o)}});ae(r.patch),r.ok?I.success(r.message||e("success")):I.error(r.message||e("error"))}catch(o){const r=o instanceof Error?o.message:String(o);I.error(`${e("error")}: ${r}`)}finally{N(null)}}},ne=G[s||""]||G.default,le=K[s||""]||K.default;return a.jsx(Ne,{open:n.open,onOpenChange:l,children:a.jsxs(Pe,{className:"sm:max-w-[550px] max-h-[85vh] overflow-hidden flex flex-col",children:[a.jsx(Se,{children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`h-10 w-10 rounded-xl bg-gradient-to-br ${le} flex items-center justify-center`,children:a.jsx(ne,{className:"h-5 w-5 text-white"})}),a.jsxs("div",{children:[a.jsx(Ie,{className:"capitalize",children:Z}),a.jsx(Te,{children:e("configureMessageChannelParameters")}),B&&a.jsxs("a",{href:B,className:"mt-2 inline-flex items-center gap-1.5 text-xs text-primary hover:text-primary-hover transition-colors",children:[a.jsx(re,{className:"h-3.5 w-3.5"}),e("channelsGuideTitle")]})]})]})}),a.jsxs("form",{onSubmit:ee,className:"flex flex-col flex-1 overflow-hidden",children:[a.jsx("div",{className:"flex-1 overflow-y-auto custom-scrollbar py-2 pr-2 space-y-5",children:C.map(t=>{const o=s?A(`channels.${s}.${t.name}`,P):void 0,r=(o==null?void 0:o.label)??t.label,y=o==null?void 0:o.placeholder;return a.jsxs("div",{className:"space-y-2.5",children:[a.jsxs(Ae,{htmlFor:t.name,className:"text-sm font-medium text-gray-900 flex items-center gap-2",children:[He(t.name),r]}),t.type==="boolean"&&a.jsxs("div",{className:"flex items-center justify-between p-3 rounded-xl bg-gray-50",children:[a.jsx("span",{className:"text-sm text-gray-500",children:g[t.name]?e("enabled"):e("disabled")}),a.jsx(Ue,{id:t.name,checked:g[t.name]||!1,onCheckedChange:b=>v(t.name,b),className:"data-[state=checked]:bg-emerald-500"})]}),(t.type==="text"||t.type==="email")&&a.jsx(F,{id:t.name,type:t.type,value:g[t.name]||"",onChange:b=>v(t.name,b.target.value),placeholder:y,className:"rounded-xl"}),t.type==="password"&&a.jsx(F,{id:t.name,type:"password",value:g[t.name]||"",onChange:b=>v(t.name,b.target.value),placeholder:y??e("leaveBlankToKeepUnchanged"),className:"rounded-xl"}),t.type==="number"&&a.jsx(F,{id:t.name,type:"number",value:g[t.name]||0,onChange:b=>v(t.name,parseInt(b.target.value)||0),placeholder:y,className:"rounded-xl"}),t.type==="tags"&&a.jsx(Re,{value:g[t.name]||[],onChange:b=>v(t.name,b)}),t.type==="select"&&a.jsxs(we,{value:g[t.name]||"",onValueChange:b=>v(t.name,b),children:[a.jsx(je,{className:"rounded-xl",children:a.jsx(ve,{})}),a.jsx(ke,{children:(t.options??[]).map(b=>a.jsx(Ce,{value:b.value,children:b.label},b.value))})]}),t.type==="json"&&a.jsx("textarea",{id:t.name,value:m[t.name]??"{}",onChange:b=>x(se=>({...se,[t.name]:b.target.value})),className:"min-h-[120px] w-full rounded-lg border border-gray-200 bg-white px-3 py-2 text-xs font-mono"})]},t.name)})}),a.jsxs(De,{className:"pt-4 flex-shrink-0",children:[a.jsx(M,{type:"button",variant:"outline",onClick:l,children:e("cancel")}),a.jsx(M,{type:"submit",disabled:u.isPending||!!h,children:u.isPending?e("saving"):e("save")}),Q.filter(t=>t.trigger==="manual").map(t=>a.jsx(M,{type:"button",onClick:()=>te(t),disabled:u.isPending||!!h,variant:"secondary",children:h===t.id?e("connecting"):t.title},t.id))]})]})]})})}function qe({children:n,onClick:l,className:c}){return a.jsx("div",{onClick:l,className:j("group relative flex flex-col p-6 rounded-2xl border border-gray-200/50 bg-white shadow-card","transition-all duration-base cursor-pointer","hover:shadow-card-hover hover:border-gray-200",c),children:n})}function Je({children:n,className:l}){return a.jsx("div",{className:j("flex items-start justify-between mb-4",l),children:n})}function _e({title:n,description:l,className:c}){return a.jsxs("div",{className:j("flex-1",c),children:[a.jsx("h3",{className:"text-[14px] font-bold text-gray-900 mb-0.5",children:n}),l&&a.jsx("p",{className:"text-[12px] text-gray-400 leading-relaxed line-clamp-2",children:l})]})}function ze({children:n,className:l}){return a.jsx("div",{className:j("mt-4 pt-3 flex items-center justify-between",l),children:n})}function Ve({label:n,className:l,onClick:c}){return a.jsxs("span",{onClick:c,className:j("inline-flex items-center gap-1 text-[13px] font-medium text-gray-600 hover:text-primary transition-colors cursor-pointer group/action",l),children:[n,a.jsx(ue,{className:"h-3 w-3 transition-transform group-hover/action:translate-x-0.5"})]})}const q={telegram:T,slack:xe,email:U,webhook:be,default:J},Ye={telegram:"channelDescTelegram",slack:"channelDescSlack",email:"channelDescEmail",webhook:"channelDescWebhook",discord:"channelDescDiscord",feishu:"channelDescFeishu"};function oa(){const{data:n}=_(),{data:l}=z(),{data:c}=V(),{openChannelModal:d}=Y(),[i,u]=k.useState("active"),f=c==null?void 0:c.uiHints;if(!n||!l)return a.jsx("div",{className:"p-8 text-gray-400",children:e("channelsLoading")});const g=[{id:"active",label:e("channelsTabEnabled"),count:l.channels.filter(m=>{var x;return(x=n.channels[m.name])==null?void 0:x.enabled}).length},{id:"all",label:e("channelsTabAll"),count:l.channels.length}],p=l.channels.filter(m=>{var h;const x=((h=n.channels[m.name])==null?void 0:h.enabled)||!1;return i==="all"||x});return a.jsxs(Fe,{children:[a.jsx(Me,{title:e("channelsPageTitle")}),a.jsx(Le,{tabs:g,activeTab:i,onChange:u}),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:p.map(m=>{const x=n.channels[m.name],h=(x==null?void 0:x.enabled)||!1,N=q[m.name]||q.default,s=A(`channels.${m.name}`,f),w=W(m),C=(s==null?void 0:s.help)||e(Ye[m.name]||"channelDescriptionDefault");return a.jsxs(qe,{onClick:()=>d(m.name),children:[a.jsxs(Je,{children:[a.jsx(Be,{name:m.name,src:Ee(m.name),className:j("h-11 w-11 rounded-xl border transition-all",h?"bg-white border-primary/30":"bg-white border-gray-200/60 group-hover:border-gray-300"),imgClassName:"h-5 w-5",fallback:a.jsx(N,{className:"h-5 w-5"})}),a.jsx(Oe,{status:h?"active":"inactive",label:h?e("statusActive"):e("statusInactive")})]}),a.jsx(_e,{title:m.displayName||m.name,description:C}),a.jsxs(ze,{children:[a.jsx(Ve,{label:h?e("actionConfigure"):e("actionEnable")}),w&&a.jsx("a",{href:w,onClick:P=>P.stopPropagation(),className:"flex items-center justify-center h-6 w-6 rounded-md text-gray-300 hover:text-gray-500 hover:bg-gray-100/60 transition-colors",title:e("channelsGuideTitle"),children:a.jsx(ge,{className:"h-3.5 w-3.5"})})]})]},m.name)})}),p.length===0&&a.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[a.jsx("div",{className:"h-14 w-14 flex items-center justify-center rounded-xl bg-gray-100/80 mb-4",children:a.jsx(J,{className:"h-6 w-6 text-gray-300"})}),a.jsx("h3",{className:"text-[14px] font-semibold text-gray-900 mb-1.5",children:e("channelsEmptyTitle")}),a.jsx("p",{className:"text-[13px] text-gray-400 max-w-sm",children:e("channelsEmptyDescription")})]}),a.jsx(Ke,{})]})}export{oa as ChannelsList};
@@ -1 +0,0 @@
1
- import{r as x,j as e,a5 as j,A as D,ar as L,as as R,a8 as k}from"./vendor-CmqkRoMs.js";import{u as E}from"./useConfirmDialog-ClpvgpHh.js";import{m as M,n as P,o as T,p as J,I as A}from"./useConfig-CFFZ66EV.js";import{P as F,a as z,B as o}from"./page-layout-Bz8CAEiD.js";import{c as p,t,S as B,a as I,b as Q,d as q,e as f,g as y}from"./index-q2B1bssI.js";import{C as H,d as V}from"./card-CWG4Tz0Y.js";import"./dialog-ssdjbutm.js";function g(s){return y(s??void 0)}function O(s){return typeof s!="number"||!Number.isFinite(s)?"-":y(new Date(s))}function G(s){if(typeof s!="number"||!Number.isFinite(s))return"-";const r=Math.round(s/1e3);if(r<60)return`${r}s`;const n=Math.round(r/60);if(n<60)return`${n}m`;const c=Math.round(n/60);return c<24?`${c}h`:`${Math.round(c/24)}d`}function K(s){const r=s.schedule;return r.kind==="cron"?r.expr?`cron ${r.expr}`:"cron":r.kind==="every"?`every ${G(r.everyMs)}`:r.kind==="at"?`at ${O(r.atMs)}`:"-"}function U(s){if(!s.payload.deliver)return"-";const r=s.payload.channel??"-",n=s.payload.to??"-";return`${r}:${n}`}function W(s,r){const n=r.trim().toLowerCase();return n?[s.id,s.name,s.payload.message,s.payload.channel??"",s.payload.to??""].join(" ").toLowerCase().includes(n):!0}function X(s,r){return r==="all"?!0:r==="enabled"?s.enabled:!s.enabled}function re(){var h;const[s,r]=x.useState(""),[n,c]=x.useState("all"),i=M({all:!0}),v=P(),N=T(),w=J(),{confirm:m,ConfirmDialog:C}=E(),u=x.useMemo(()=>{var l;return(((l=i.data)==null?void 0:l.jobs)??[]).filter(d=>W(d,s)).filter(d=>X(d,n))},[i.data,s,n]),b=async a=>{await m({title:`${t("cronDeleteConfirm")}?`,description:a.name?`${a.name} (${a.id})`:a.id,variant:"destructive",confirmLabel:t("delete")})&&v.mutate({id:a.id})},S=async a=>{const l=!a.enabled;await m({title:l?`${t("cronEnableConfirm")}?`:`${t("cronDisableConfirm")}?`,description:a.name?`${a.name} (${a.id})`:a.id,variant:l?"default":"destructive",confirmLabel:l?t("cronEnable"):t("cronDisable")})&&N.mutate({id:a.id,enabled:l})},$=async a=>{const l=!a.enabled;await m({title:l?`${t("cronRunForceConfirm")}?`:`${t("cronRunConfirm")}?`,description:a.name?`${a.name} (${a.id})`:a.id,confirmLabel:t("cronRunNow")})&&w.mutate({id:a.id,force:l})};return e.jsxs(F,{fullHeight:!0,children:[e.jsx(z,{title:t("cronPageTitle"),description:t("cronPageDescription"),actions:e.jsx(o,{variant:"ghost",size:"icon",className:"h-9 w-9 rounded-lg text-gray-400 hover:text-gray-700 hover:bg-gray-100",onClick:()=>i.refetch(),children:e.jsx(j,{className:p("h-4 w-4",i.isFetching&&"animate-spin")})})}),e.jsx("div",{className:"mb-6",children:e.jsxs("div",{className:"flex flex-wrap gap-3 items-center",children:[e.jsxs("div",{className:"relative flex-1 min-w-[240px]",children:[e.jsx(A,{value:s,onChange:a=>r(a.target.value),placeholder:t("cronSearchPlaceholder"),className:"pl-9"}),e.jsx(D,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400"})]}),e.jsx("div",{className:"min-w-[180px]",children:e.jsxs(B,{value:n,onValueChange:a=>c(a),children:[e.jsx(I,{className:"w-full",children:e.jsx(Q,{placeholder:t("cronStatusLabel")})}),e.jsxs(q,{children:[e.jsx(f,{value:"all",children:t("cronStatusAll")}),e.jsx(f,{value:"enabled",children:t("cronStatusEnabled")}),e.jsx(f,{value:"disabled",children:t("cronStatusDisabled")})]})]})}),e.jsxs("div",{className:"text-xs text-gray-500 ml-auto",children:[t("cronTotalLabel"),": ",((h=i.data)==null?void 0:h.total)??0," / ",u.length]})]})}),e.jsx("div",{className:"flex-1 overflow-auto custom-scrollbar",children:i.isLoading?e.jsx("div",{className:"text-sm text-gray-400 p-4 text-center",children:t("cronLoading")}):u.length===0?e.jsx("div",{className:"text-sm text-gray-400 p-4 text-center",children:t("cronEmpty")}):e.jsx("div",{className:"space-y-4",children:u.map(a=>e.jsx(H,{className:"border border-gray-200",children:e.jsx(V,{className:"pt-5 pb-5",children:e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-[220px] flex-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"text-sm font-semibold text-gray-900",children:a.name||a.id}),e.jsx("span",{className:"text-[10px] font-semibold px-2 py-0.5 rounded-full bg-gray-100 text-gray-500",children:a.id}),e.jsx("span",{className:p("text-[10px] font-semibold px-2 py-0.5 rounded-full",a.enabled?"bg-emerald-50 text-emerald-700":"bg-gray-100 text-gray-500"),children:a.enabled?t("enabled"):t("disabled")}),a.deleteAfterRun&&e.jsx("span",{className:"text-[10px] font-semibold px-2 py-0.5 rounded-full bg-amber-50 text-amber-700",children:t("cronOneShot")})]}),e.jsxs("div",{className:"mt-2 text-xs text-gray-500",children:[t("cronScheduleLabel"),": ",K(a)]}),e.jsx("div",{className:"mt-2 text-sm text-gray-700 whitespace-pre-wrap break-words",children:a.payload.message}),e.jsxs("div",{className:"mt-2 text-xs text-gray-500",children:[t("cronDeliverTo"),": ",U(a)]})]}),e.jsxs("div",{className:"min-w-[220px] text-xs text-gray-500 space-y-2",children:[e.jsxs("div",{children:[e.jsxs("span",{className:"font-medium text-gray-700",children:[t("cronNextRun"),":"]})," ",g(a.state.nextRunAt)]}),e.jsxs("div",{children:[e.jsxs("span",{className:"font-medium text-gray-700",children:[t("cronLastRun"),":"]})," ",g(a.state.lastRunAt)]}),e.jsxs("div",{children:[e.jsxs("span",{className:"font-medium text-gray-700",children:[t("cronLastStatus"),":"]})," ",a.state.lastStatus??"-"]}),a.state.lastError&&e.jsx("div",{className:"text-[11px] text-red-500 break-words",children:a.state.lastError})]}),e.jsxs("div",{className:"flex items-start gap-2 flex-wrap justify-end",children:[e.jsxs(o,{variant:"subtle",size:"sm",onClick:()=>$(a),className:"gap-1",children:[e.jsx(L,{className:"h-3.5 w-3.5"}),t("cronRunNow")]}),e.jsxs(o,{variant:a.enabled?"outline":"primary",size:"sm",onClick:()=>S(a),className:"gap-1",children:[e.jsx(R,{className:"h-3.5 w-3.5"}),a.enabled?t("cronDisable"):t("cronEnable")]}),e.jsxs(o,{variant:"destructive",size:"sm",onClick:()=>b(a),className:"gap-1",children:[e.jsx(k,{className:"h-3.5 w-3.5"}),t("delete")]})]})]})})},a.id))})}),e.jsx(C,{})]})}export{re as CronConfig};
@@ -1 +0,0 @@
1
- import{r as o,j as s,aw as Oe,ax as $e,ay as Fe,az as xe,aA as qe,aB as He,aC as E,aD as he,aE as Ke,aF as Ue,aG as ze,aH as Qe,aI as Be,aJ as Ge,aK as Ve,at as ye,au as be,av as ke,ag as q,aL as Ye,aM as Xe,aN as Je}from"./vendor-CmqkRoMs.js";import{c as ve,j as H,t as c,S as We,a as Ze,b as et,d as tt,e as ge}from"./index-q2B1bssI.js";import{T as at}from"./tabs-custom-VeX6BYro.js";import{P as Te}from"./dialog-ssdjbutm.js";import{u as nt}from"./useConfirmDialog-ClpvgpHh.js";import{P as st,a as rt}from"./page-layout-Bz8CAEiD.js";var[K]=Ue("Tooltip",[he]),U=he(),Ce="TooltipProvider",lt=700,Y="tooltip.open",[ot,W]=K(Ce),Se=e=>{const{__scopeTooltip:t,delayDuration:a=lt,skipDelayDuration:n=300,disableHoverableContent:l=!1,children:r}=e,u=o.useRef(!0),b=o.useRef(!1),d=o.useRef(0);return o.useEffect(()=>{const x=d.current;return()=>window.clearTimeout(x)},[]),s.jsx(ot,{scope:t,isOpenDelayedRef:u,delayDuration:a,onOpen:o.useCallback(()=>{window.clearTimeout(d.current),u.current=!1},[]),onClose:o.useCallback(()=>{window.clearTimeout(d.current),d.current=window.setTimeout(()=>u.current=!0,n)},[n]),isPointerInTransitRef:b,onPointerInTransitChange:o.useCallback(x=>{b.current=x},[]),disableHoverableContent:l,children:r})};Se.displayName=Ce;var L="Tooltip",[it,A]=K(L),Pe=e=>{const{__scopeTooltip:t,children:a,open:n,defaultOpen:l,onOpenChange:r,disableHoverableContent:u,delayDuration:b}=e,d=W(L,e.__scopeTooltip),x=U(t),[i,h]=o.useState(null),k=Oe(),m=o.useRef(0),T=u??d.disableHoverableContent,y=b??d.delayDuration,C=o.useRef(!1),[P,f]=$e({prop:n,defaultProp:l??!1,onChange:O=>{O?(d.onOpen(),document.dispatchEvent(new CustomEvent(Y))):d.onClose(),r==null||r(O)},caller:L}),v=o.useMemo(()=>P?C.current?"delayed-open":"instant-open":"closed",[P]),j=o.useCallback(()=>{window.clearTimeout(m.current),m.current=0,C.current=!1,f(!0)},[f]),S=o.useCallback(()=>{window.clearTimeout(m.current),m.current=0,f(!1)},[f]),_=o.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>{C.current=!0,f(!0),m.current=0},y)},[y,f]);return o.useEffect(()=>()=>{m.current&&(window.clearTimeout(m.current),m.current=0)},[]),s.jsx(Fe,{...x,children:s.jsx(it,{scope:t,contentId:k,open:P,stateAttribute:v,trigger:i,onTriggerChange:h,onTriggerEnter:o.useCallback(()=>{d.isOpenDelayedRef.current?_():j()},[d.isOpenDelayedRef,_,j]),onTriggerLeave:o.useCallback(()=>{T?S():(window.clearTimeout(m.current),m.current=0)},[S,T]),onOpen:j,onClose:S,disableHoverableContent:T,children:a})})};Pe.displayName=L;var X="TooltipTrigger",we=o.forwardRef((e,t)=>{const{__scopeTooltip:a,...n}=e,l=A(X,a),r=W(X,a),u=U(a),b=o.useRef(null),d=xe(t,b,l.onTriggerChange),x=o.useRef(!1),i=o.useRef(!1),h=o.useCallback(()=>x.current=!1,[]);return o.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),s.jsx(qe,{asChild:!0,...u,children:s.jsx(He.button,{"aria-describedby":l.open?l.contentId:void 0,"data-state":l.stateAttribute,...n,ref:d,onPointerMove:E(e.onPointerMove,k=>{k.pointerType!=="touch"&&!i.current&&!r.isPointerInTransitRef.current&&(l.onTriggerEnter(),i.current=!0)}),onPointerLeave:E(e.onPointerLeave,()=>{l.onTriggerLeave(),i.current=!1}),onPointerDown:E(e.onPointerDown,()=>{l.open&&l.onClose(),x.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:E(e.onFocus,()=>{x.current||l.onOpen()}),onBlur:E(e.onBlur,l.onClose),onClick:E(e.onClick,l.onClose)})})});we.displayName=X;var Z="TooltipPortal",[ct,ut]=K(Z,{forceMount:void 0}),je=e=>{const{__scopeTooltip:t,forceMount:a,children:n,container:l}=e,r=A(Z,t);return s.jsx(ct,{scope:t,forceMount:a,children:s.jsx(Te,{present:a||r.open,children:s.jsx(Ke,{asChild:!0,container:l,children:n})})})};je.displayName=Z;var R="TooltipContent",Ie=o.forwardRef((e,t)=>{const a=ut(R,e.__scopeTooltip),{forceMount:n=a.forceMount,side:l="top",...r}=e,u=A(R,e.__scopeTooltip);return s.jsx(Te,{present:n||u.open,children:u.disableHoverableContent?s.jsx(Ne,{side:l,...r,ref:t}):s.jsx(dt,{side:l,...r,ref:t})})}),dt=o.forwardRef((e,t)=>{const a=A(R,e.__scopeTooltip),n=W(R,e.__scopeTooltip),l=o.useRef(null),r=xe(t,l),[u,b]=o.useState(null),{trigger:d,onClose:x}=a,i=l.current,{onPointerInTransitChange:h}=n,k=o.useCallback(()=>{b(null),h(!1)},[h]),m=o.useCallback((T,y)=>{const C=T.currentTarget,P={x:T.clientX,y:T.clientY},f=xt(P,C.getBoundingClientRect()),v=ht(P,f),j=yt(y.getBoundingClientRect()),S=kt([...v,...j]);b(S),h(!0)},[h]);return o.useEffect(()=>()=>k(),[k]),o.useEffect(()=>{if(d&&i){const T=C=>m(C,i),y=C=>m(C,d);return d.addEventListener("pointerleave",T),i.addEventListener("pointerleave",y),()=>{d.removeEventListener("pointerleave",T),i.removeEventListener("pointerleave",y)}}},[d,i,m,k]),o.useEffect(()=>{if(u){const T=y=>{const C=y.target,P={x:y.clientX,y:y.clientY},f=(d==null?void 0:d.contains(C))||(i==null?void 0:i.contains(C)),v=!bt(P,u);f?k():v&&(k(),x())};return document.addEventListener("pointermove",T),()=>document.removeEventListener("pointermove",T)}},[d,i,u,x,k]),s.jsx(Ne,{...e,ref:r})}),[pt,mt]=K(L,{isInside:!1}),gt=Ge("TooltipContent"),Ne=o.forwardRef((e,t)=>{const{__scopeTooltip:a,children:n,"aria-label":l,onEscapeKeyDown:r,onPointerDownOutside:u,...b}=e,d=A(R,a),x=U(a),{onClose:i}=d;return o.useEffect(()=>(document.addEventListener(Y,i),()=>document.removeEventListener(Y,i)),[i]),o.useEffect(()=>{if(d.trigger){const h=k=>{const m=k.target;m!=null&&m.contains(d.trigger)&&i()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[d.trigger,i]),s.jsx(ze,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:r,onPointerDownOutside:u,onFocusOutside:h=>h.preventDefault(),onDismiss:i,children:s.jsxs(Qe,{"data-state":d.stateAttribute,...x,...b,ref:t,style:{...b.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[s.jsx(gt,{children:n}),s.jsx(pt,{scope:a,isInside:!0,children:s.jsx(Be,{id:d.contentId,role:"tooltip",children:l||n})})]})})});Ie.displayName=R;var Ee="TooltipArrow",ft=o.forwardRef((e,t)=>{const{__scopeTooltip:a,...n}=e,l=U(a);return mt(Ee,a).isInside?null:s.jsx(Ve,{...l,...n,ref:t})});ft.displayName=Ee;function xt(e,t){const a=Math.abs(t.top-e.y),n=Math.abs(t.bottom-e.y),l=Math.abs(t.right-e.x),r=Math.abs(t.left-e.x);switch(Math.min(a,n,l,r)){case r:return"left";case l:return"right";case a:return"top";case n:return"bottom";default:throw new Error("unreachable")}}function ht(e,t,a=5){const n=[];switch(t){case"top":n.push({x:e.x-a,y:e.y+a},{x:e.x+a,y:e.y+a});break;case"bottom":n.push({x:e.x-a,y:e.y-a},{x:e.x+a,y:e.y-a});break;case"left":n.push({x:e.x+a,y:e.y-a},{x:e.x+a,y:e.y+a});break;case"right":n.push({x:e.x-a,y:e.y-a},{x:e.x-a,y:e.y+a});break}return n}function yt(e){const{top:t,right:a,bottom:n,left:l}=e;return[{x:l,y:t},{x:a,y:t},{x:a,y:n},{x:l,y:n}]}function bt(e,t){const{x:a,y:n}=e;let l=!1;for(let r=0,u=t.length-1;r<t.length;u=r++){const b=t[r],d=t[u],x=b.x,i=b.y,h=d.x,k=d.y;i>n!=k>n&&a<(h-x)*(n-i)/(k-i)+x&&(l=!l)}return l}function kt(e){const t=e.slice();return t.sort((a,n)=>a.x<n.x?-1:a.x>n.x?1:a.y<n.y?-1:a.y>n.y?1:0),vt(t)}function vt(e){if(e.length<=1)return e.slice();const t=[];for(let n=0;n<e.length;n++){const l=e[n];for(;t.length>=2;){const r=t[t.length-1],u=t[t.length-2];if((r.x-u.x)*(l.y-u.y)>=(r.y-u.y)*(l.x-u.x))t.pop();else break}t.push(l)}t.pop();const a=[];for(let n=e.length-1;n>=0;n--){const l=e[n];for(;a.length>=2;){const r=a[a.length-1],u=a[a.length-2];if((r.x-u.x)*(l.y-u.y)>=(r.y-u.y)*(l.x-u.x))a.pop();else break}a.push(l)}return a.pop(),t.length===1&&a.length===1&&t[0].x===a[0].x&&t[0].y===a[0].y?t:t.concat(a)}var Tt=Se,Ct=Pe,St=we,Pt=je,Me=Ie;const wt=Tt,G=Ct,V=St,F=o.forwardRef(({className:e,sideOffset:t=4,...a},n)=>s.jsx(Pt,{children:s.jsx(Me,{ref:n,sideOffset:t,className:ve("z-[var(--z-tooltip)] overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...a})}));F.displayName=Me.displayName;function z(e){return e==="plugin"?"plugins":"skills"}async function jt(e){var r,u;const t=new URLSearchParams,a=z(e.type);(r=e.q)!=null&&r.trim()&&t.set("q",e.q.trim()),(u=e.tag)!=null&&u.trim()&&t.set("tag",e.tag.trim()),e.sort&&t.set("sort",e.sort),typeof e.page=="number"&&Number.isFinite(e.page)&&t.set("page",String(Math.max(1,Math.trunc(e.page)))),typeof e.pageSize=="number"&&Number.isFinite(e.pageSize)&&t.set("pageSize",String(Math.max(1,Math.trunc(e.pageSize))));const n=t.toString(),l=await H.get(n?`/api/marketplace/${a}/items?${n}`:`/api/marketplace/${a}/items`);if(!l.ok)throw new Error(l.error.message);return l.data}async function It(e){const t=z(e.type),a=await H.post(`/api/marketplace/${t}/install`,e);if(!a.ok)throw new Error(a.error.message);return a.data}async function Nt(e){const t=z(e),a=await H.get(`/api/marketplace/${t}/installed`);if(!a.ok)throw new Error(a.error.message);return a.data}async function Et(e){const t=z(e.type),a=await H.post(`/api/marketplace/${t}/manage`,e);if(!a.ok)throw new Error(a.error.message);return a.data}function Mt(e){return ye({queryKey:["marketplace-items",e],queryFn:()=>jt(e),staleTime:15e3})}function Rt(e){return ye({queryKey:["marketplace-installed",e],queryFn:()=>Nt(e),staleTime:1e4})}function Dt(){const e=be();return ke({mutationFn:t=>It(t),onSuccess:t=>{e.invalidateQueries({queryKey:["marketplace-installed",t.type]}),e.refetchQueries({queryKey:["marketplace-installed",t.type],type:"active"}),e.refetchQueries({queryKey:["marketplace-items"],type:"active"});const a=t.type==="plugin"?c("marketplaceInstallSuccessPlugin"):c("marketplaceInstallSuccessSkill");q.success(t.message||a)},onError:t=>{q.error(t.message||c("marketplaceInstallFailed"))}})}function Lt(){const e=be();return ke({mutationFn:t=>Et(t),onSuccess:t=>{e.invalidateQueries({queryKey:["marketplace-installed",t.type]}),e.invalidateQueries({queryKey:["marketplace-items"]}),e.refetchQueries({queryKey:["marketplace-installed",t.type],type:"active"}),e.refetchQueries({queryKey:["marketplace-items"],type:"active"});const a=t.action==="enable"?c("marketplaceEnableSuccess"):t.action==="disable"?c("marketplaceDisableSuccess"):c("marketplaceUninstallSuccess");q.success(t.message||a)},onError:t=>{q.error(t.message||c("marketplaceOperationFailed"))}})}const At=12;function J(e){return(e??"").trim().toLowerCase()}function M(e,t){const a=J(t);return a.length>0?`${e}:${a}`:""}function _t(e){const t=new Map;for(const a of e){const n=[a.install.spec,a.slug,a.id];for(const l of n){const r=M(a.type,l);!r||t.has(r)||t.set(r,a)}}return t}function Ot(e){const t=new Map;for(const a of e){const n=[a.spec,a.id,a.label];for(const l of n){const r=M(a.type,l);!r||t.has(r)||t.set(r,a)}}return t}function $t(e,t){const a=[e.install.spec,e.slug,e.id];for(const n of a){const l=M(e.type,n);if(!l)continue;const r=t.get(l);if(r)return r}}function Ft(e,t){const a=t.get(M(e.type,e.spec));if(a)return a;const n=t.get(M(e.type,e.id));return n||t.get(M(e.type,e.label))}function qt(e,t,a){const n=J(a);return n?[e.id,e.spec,e.label,t==null?void 0:t.name,t==null?void 0:t.slug,t==null?void 0:t.summary,...(t==null?void 0:t.tags)??[]].map(r=>J(r)).filter(Boolean).some(r=>r.includes(n)):!0}function Ht(e){const t=["bg-amber-600","bg-orange-500","bg-yellow-600","bg-emerald-600","bg-teal-600","bg-cyan-600","bg-stone-600","bg-rose-500","bg-violet-500"];let a=0;for(let n=0;n<e.length;n++)a=e.charCodeAt(n)+((a<<5)-a);return t[Math.abs(a)%t.length]}function Kt({name:e,fallback:t}){const a=e||t,n=a.substring(0,2).toUpperCase(),l=Ht(a);return s.jsx("div",{className:ve("flex items-center justify-center w-10 h-10 rounded-xl text-white font-semibold text-sm shrink-0",l),children:n})}function Ut(e){return s.jsx("div",{className:"mb-4",children:s.jsxs("div",{className:"flex gap-3 items-center",children:[s.jsxs("div",{className:"flex-1 min-w-0 relative",children:[s.jsx(Je,{className:"h-4 w-4 text-gray-400 absolute left-3 top-1/2 -translate-y-1/2"}),s.jsx("input",{value:e.searchText,onChange:t=>e.onSearchTextChange(t.target.value),placeholder:e.searchPlaceholder,className:"w-full h-9 border border-gray-200/80 rounded-xl pl-9 pr-3 text-sm focus:outline-none focus:ring-1 focus:ring-primary/40"})]}),e.scope==="all"&&s.jsxs(We,{value:e.sort,onValueChange:t=>e.onSortChange(t),children:[s.jsx(Ze,{className:"h-9 w-[150px] shrink-0 rounded-lg",children:s.jsx(et,{})}),s.jsxs(tt,{children:[s.jsx(ge,{value:"relevance",children:c("marketplaceSortRelevance")}),s.jsx(ge,{value:"updated",children:c("marketplaceSortUpdated")})]})]})]})})}function fe(e){var P,f,v,j,S;const t=e.record,a=(t==null?void 0:t.type)==="plugin"?t:void 0,n=((P=e.item)==null?void 0:P.type)??(t==null?void 0:t.type),l=((f=e.item)==null?void 0:f.name)??(t==null?void 0:t.label)??(t==null?void 0:t.id)??(t==null?void 0:t.spec)??c("marketplaceUnknownItem"),r=((v=e.item)==null?void 0:v.summary)??(t?c("marketplaceInstalledLocalSummary"):""),u=((j=e.item)==null?void 0:j.install.spec)??(t==null?void 0:t.spec)??"",b=(t==null?void 0:t.id)||(t==null?void 0:t.spec),d=!!b&&e.manageState.isPending&&e.manageState.targetId===b,x=!!a,i=(t==null?void 0:t.type)==="plugin"&&t.origin!=="bundled",h=(t==null?void 0:t.type)==="skill"&&t.source==="workspace",k=!!(i||h),m=t?t.enabled===!1||t.runtimeStatus==="disabled":!1,T=(S=e.item)==null?void 0:S.install.spec,y=typeof T=="string"&&e.installState.installingSpecs.has(T),C=n==="plugin"?c("marketplaceTypePlugin"):n==="skill"?c("marketplaceTypeSkill"):c("marketplaceTypeExtension");return s.jsxs("article",{className:"group bg-white border border-gray-200/40 hover:border-gray-200/80 rounded-2xl px-5 py-4 hover:shadow-md shadow-sm transition-all flex items-start gap-3.5 justify-between cursor-default",children:[s.jsxs("div",{className:"flex gap-3 min-w-0 flex-1 h-full items-start",children:[s.jsx(Kt,{name:l,fallback:u||c("marketplaceTypeExtension")}),s.jsx("div",{className:"min-w-0 flex-1 flex flex-col justify-center h-full",children:s.jsxs(wt,{delayDuration:400,children:[s.jsxs(G,{children:[s.jsx(V,{asChild:!0,children:s.jsx("div",{className:"text-[14px] font-semibold text-gray-900 truncate leading-tight cursor-default",children:l})}),s.jsx(F,{className:"max-w-[300px] text-xs",children:l})]}),s.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5 mb-1.5",children:[s.jsx("span",{className:"text-[11px] text-gray-500 font-medium",children:C}),u&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"text-[10px] text-gray-300",children:"•"}),s.jsxs(G,{children:[s.jsx(V,{asChild:!0,children:s.jsx("span",{className:"text-[11px] text-gray-400 truncate max-w-full font-mono cursor-default",children:u})}),s.jsx(F,{className:"max-w-[300px] text-xs font-mono break-all",children:u})]})]})]}),s.jsxs(G,{children:[s.jsx(V,{asChild:!0,children:s.jsx("p",{className:"text-[12px] text-gray-500/90 line-clamp-1 transition-colors leading-relaxed text-left cursor-default",children:r})}),r&&s.jsx(F,{className:"max-w-[400px] text-xs leading-relaxed",children:r})]})]})})]}),s.jsxs("div",{className:"shrink-0 flex items-center h-full",children:[e.item&&!t&&s.jsx("button",{onClick:()=>e.onInstall(e.item),disabled:y,className:"inline-flex items-center gap-1.5 h-8 px-4 rounded-xl text-xs font-medium bg-primary text-white hover:bg-primary-600 disabled:opacity-50 transition-colors",children:y?c("marketplaceInstalling"):c("marketplaceInstall")}),a&&x&&s.jsx("button",{disabled:e.manageState.isPending,onClick:()=>e.onManage(m?"enable":"disable",a),className:"inline-flex items-center h-8 px-4 rounded-xl text-xs font-medium border border-gray-200/80 text-gray-600 bg-white hover:bg-gray-50 hover:border-gray-300 disabled:opacity-50 transition-colors",children:d&&e.manageState.action!=="uninstall"?e.manageState.action==="enable"?c("marketplaceEnabling"):c("marketplaceDisabling"):m?c("marketplaceEnable"):c("marketplaceDisable")}),t&&k&&s.jsx("button",{disabled:e.manageState.isPending,onClick:()=>e.onManage("uninstall",t),className:"inline-flex items-center h-8 px-4 rounded-xl text-xs font-medium border border-rose-100 text-rose-500 bg-white hover:bg-rose-50 hover:border-rose-200 disabled:opacity-50 transition-colors",children:d&&e.manageState.action==="uninstall"?c("marketplaceRemoving"):c("marketplaceUninstall")})]})]})}function zt(e){return s.jsxs("div",{className:"mt-4 flex items-center justify-end gap-2",children:[s.jsx("button",{className:"h-8 px-3 rounded-xl border border-gray-200/80 text-sm text-gray-600 disabled:opacity-40",onClick:e.onPrev,disabled:e.page<=1||e.busy,children:c("prev")}),s.jsx("div",{className:"text-sm text-gray-600 min-w-20 text-center",children:e.totalPages===0?"0 / 0":`${e.page} / ${e.totalPages}`}),s.jsx("button",{className:"h-8 px-3 rounded-xl border border-gray-200/80 text-sm text-gray-600 disabled:opacity-40",onClick:e.onNext,disabled:e.totalPages===0||e.page>=e.totalPages||e.busy,children:c("next")})]})}function Jt(){var le,oe,ie,ce,ue,de,pe,me;const e=Ye(),t=Xe(),a=o.useMemo(()=>t.type==="plugins"||t.type==="skills"?t.type:null,[t.type]);o.useEffect(()=>{a||e("/marketplace/plugins",{replace:!0})},[a,e]);const n=a==="skills"?"skill":"plugin",r=n==="plugin"?{pageTitle:"marketplacePluginsPageTitle",pageDescription:"marketplacePluginsPageDescription",tabMarketplace:"marketplaceTabMarketplacePlugins",tabInstalled:"marketplaceTabInstalledPlugins",searchPlaceholder:"marketplaceSearchPlaceholderPlugins",sectionCatalog:"marketplaceSectionPlugins",sectionInstalled:"marketplaceSectionInstalledPlugins",errorLoadData:"marketplaceErrorLoadingPluginsData",errorLoadInstalled:"marketplaceErrorLoadingInstalledPlugins",emptyData:"marketplaceNoPlugins",emptyInstalled:"marketplaceNoInstalledPlugins",installedCountSuffix:"marketplaceInstalledPluginsCountSuffix"}:{pageTitle:"marketplaceSkillsPageTitle",pageDescription:"marketplaceSkillsPageDescription",tabMarketplace:"marketplaceTabMarketplaceSkills",tabInstalled:"marketplaceTabInstalledSkills",searchPlaceholder:"marketplaceSearchPlaceholderSkills",sectionCatalog:"marketplaceSectionSkills",sectionInstalled:"marketplaceSectionInstalledSkills",errorLoadData:"marketplaceErrorLoadingSkillsData",errorLoadInstalled:"marketplaceErrorLoadingInstalledSkills",emptyData:"marketplaceNoSkills",emptyInstalled:"marketplaceNoInstalledSkills",installedCountSuffix:"marketplaceInstalledSkillsCountSuffix"},[u,b]=o.useState(""),[d,x]=o.useState(""),[i,h]=o.useState("all"),[k,m]=o.useState("relevance"),[T,y]=o.useState(1),[C,P]=o.useState(new Set);o.useEffect(()=>{const p=setTimeout(()=>{y(1),x(u.trim())},250);return()=>clearTimeout(p)},[u]),o.useEffect(()=>{y(1)},[n]);const f=Rt(n),v=Mt({q:d||void 0,type:n,sort:k,page:T,pageSize:At}),j=Dt(),S=Lt(),{confirm:_,ConfirmDialog:O}=nt(),$=o.useMemo(()=>{var p;return((p=f.data)==null?void 0:p.records)??[]},[(le=f.data)==null?void 0:le.records]),N=o.useMemo(()=>{var p;return((p=v.data)==null?void 0:p.items)??[]},[(oe=v.data)==null?void 0:oe.items]),ee=o.useMemo(()=>_t(N),[N]),Re=o.useMemo(()=>Ot($),[$]),D=o.useMemo(()=>{const p=$.filter(g=>g.type===n).map(g=>({key:`${g.type}:${g.spec}:${g.id??""}`,record:g,item:Ft(g,ee)})).filter(g=>qt(g.record,g.item,d));return p.sort((g,w)=>{const I=g.record.installedAt?Date.parse(g.record.installedAt):Number.NaN,B=w.record.installedAt?Date.parse(w.record.installedAt):Number.NaN,Ae=!Number.isNaN(I),_e=!Number.isNaN(B);return Ae&&_e&&I!==B?B-I:g.record.spec.localeCompare(w.record.spec)}),p},[$,n,ee,d]),te=i==="installed"?D.length:((ie=v.data)==null?void 0:ie.total)??0,Q=i==="installed"?1:((ce=v.data)==null?void 0:ce.totalPages)??0,De=o.useMemo(()=>i==="installed"?f.isLoading?c("loading"):`${D.length} ${c(r.installedCountSuffix)}`:v.data?`${N.length} / ${te}`:c("loading"),[i,f.isLoading,D.length,v.data,N.length,te,r.installedCountSuffix]),ae={installingSpecs:C},ne={isPending:S.isPending,targetId:((ue=S.variables)==null?void 0:ue.id)||((de=S.variables)==null?void 0:de.spec),action:(pe=S.variables)==null?void 0:pe.action},Le=[{id:"all",label:c(r.tabMarketplace)},{id:"installed",label:c(r.tabInstalled),count:((me=f.data)==null?void 0:me.total)??0}],se=async p=>{const g=p.install.spec;if(!C.has(g)){P(w=>{const I=new Set(w);return I.add(g),I});try{await j.mutateAsync({type:p.type,spec:g,kind:p.install.kind,...p.type==="skill"?{skill:p.slug,installPath:`skills/${p.slug}`}:{}})}catch{}finally{P(w=>{if(!w.has(g))return w;const I=new Set(w);return I.delete(g),I})}}},re=async(p,g)=>{if(S.isPending)return;const w=g.id||g.spec;w&&(p==="uninstall"&&!await _({title:`${c("marketplaceUninstallTitle")} ${w}?`,description:c("marketplaceUninstallDescription"),confirmLabel:c("marketplaceUninstall"),variant:"destructive"})||S.mutate({type:g.type,action:p,id:w,spec:g.spec}))};return s.jsxs(st,{children:[s.jsx(rt,{title:c(r.pageTitle),description:c(r.pageDescription)}),s.jsx(at,{tabs:Le,activeTab:i,onChange:p=>{h(p),y(1)},className:"mb-4"}),s.jsx(Ut,{scope:i,searchText:u,searchPlaceholder:c(r.searchPlaceholder),sort:k,onSearchTextChange:b,onSortChange:p=>{y(1),m(p)}}),s.jsxs("section",{children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsx("h3",{className:"text-[14px] font-semibold text-gray-900",children:i==="installed"?c(r.sectionInstalled):c(r.sectionCatalog)}),s.jsx("span",{className:"text-[12px] text-gray-500",children:De})]}),i==="all"&&v.isError&&s.jsxs("div",{className:"p-4 rounded-xl bg-rose-50 border border-rose-200 text-rose-700 text-sm",children:[c(r.errorLoadData),": ",v.error.message]}),i==="installed"&&f.isError&&s.jsxs("div",{className:"p-4 rounded-xl bg-rose-50 border border-rose-200 text-rose-700 text-sm",children:[c(r.errorLoadInstalled),": ",f.error.message]}),s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 2xl:grid-cols-3 gap-3",children:[i==="all"&&N.map(p=>s.jsx(fe,{item:p,record:$t(p,Re),installState:ae,manageState:ne,onInstall:se,onManage:re},p.id)),i==="installed"&&D.map(p=>s.jsx(fe,{item:p.item,record:p.record,installState:ae,manageState:ne,onInstall:se,onManage:re},p.key))]}),i==="all"&&!v.isLoading&&!v.isError&&N.length===0&&s.jsx("div",{className:"text-[13px] text-gray-500 py-8 text-center",children:c(r.emptyData)}),i==="installed"&&!f.isLoading&&!f.isError&&D.length===0&&s.jsx("div",{className:"text-[13px] text-gray-500 py-8 text-center",children:c(r.emptyInstalled)})]}),i==="all"&&s.jsx(zt,{page:T,totalPages:Q,busy:v.isFetching,onPrev:()=>y(p=>Math.max(1,p-1)),onNext:()=>y(p=>Q>0?Math.min(Q,p+1):p+1)}),s.jsx(O,{})]})}export{Jt as MarketplacePage};
@@ -1 +0,0 @@
1
- import{r as p,j as e,aa as ue,ab as he,a8 as pe,a6 as te,K as ae,a1 as fe,ac as ee,m as ye,ad as ge,ae as je,af as be,ag as U,a0 as we}from"./vendor-CmqkRoMs.js";import{I as B,u as re,a as ne,b as le,g as ve,h as Ne}from"./useConfig-CFFZ66EV.js";import{B as K,P as Ae,a as Pe}from"./page-layout-Bz8CAEiD.js";import{L as W}from"./label-LbWa2Yzc.js";import{t as a,c as V,S as Ce,a as Ee,b as Me,d as Ke,e as Le}from"./index-q2B1bssI.js";import{S as ie,L as Se,g as Te}from"./logos-DncMldHC.js";import{h as O}from"./config-hints-CApS3K_7.js";import{T as Be}from"./tabs-custom-VeX6BYro.js";function $e({maskedValue:s,isSet:t,className:n,...i}){const[u,g]=p.useState(!1);return e.jsxs("div",{className:"relative",children:[e.jsx(B,{type:u?"text":"password",className:V("pr-20",n),placeholder:t?`${a("apiKeySet")} (${a("unchanged")})`:"",...i}),e.jsx("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 flex gap-1",children:(t||s)&&e.jsx(K,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>g(!u),children:u?e.jsx(ue,{className:"h-4 w-4"}):e.jsx(he,{className:"h-4 w-4"})})})]})}function ke({value:s,onChange:t,className:n}){const i=s?Object.entries(s):[],u=(m,f,j)=>{const y=[...i];y[m]=[f,j],t(Object.fromEntries(y))},g=()=>{t({...s,"":""})},h=m=>{const f=i.filter((j,y)=>y!==m);t(Object.fromEntries(f))};return e.jsxs("div",{className:V("space-y-2",n),children:[i.map(([m,f],j)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(B,{type:"text",value:m,onChange:y=>u(j,y.target.value,f),placeholder:a("headerName"),className:"flex-1"}),e.jsx(B,{type:"text",value:f,onChange:y=>u(j,m,y.target.value),placeholder:a("headerValue"),className:"flex-1"}),e.jsx(K,{type:"button",variant:"ghost",size:"icon",onClick:()=>h(j),children:e.jsx(pe,{className:"h-4 w-4 text-red-500"})})]},j)),e.jsxs(K,{type:"button",variant:"outline",size:"sm",onClick:g,children:[e.jsx(te,{className:"h-4 w-4 mr-2"}),a("add")]})]})}function z(s){if(!s)return null;const t=Object.entries(s).map(([n,i])=>[n.trim(),i]).filter(([n])=>n.length>0);return t.length===0?null:Object.fromEntries(t)}function se(s,t){const n=z(s),i=z(t);if(n===null&&i===null)return!0;if(!n||!i)return!1;const u=Object.entries(n).sort(([h],[m])=>h.localeCompare(m)),g=Object.entries(i).sort(([h],[m])=>h.localeCompare(m));return u.length!==g.length?!1:u.every(([h,m],f)=>h===g[f][0]&&m===g[f][1])}function _(s){if(!s||s.length===0)return[];const t=new Set;for(const n of s){const i=n.trim();i&&t.add(i)}return[...t]}function De(s,t){const n=s.trim();if(!n||!t.trim())return n;const i=`${t.trim()}/`;return n.startsWith(i)?n.slice(i.length):n}function G(s,t){let n=s.trim();if(!n)return"";for(const i of t){const u=i.trim();u&&(n=De(n,u))}return n.trim()}function Q(s,t){return s.length!==t.length?!1:s.every((n,i)=>n===t[i])}function Fe(s,t){const n=[...s];for(const i of t)n.includes(i)||n.push(i);return n}function We(s,t){return t.length===0?s:t.every(i=>!s.includes(i))?Fe(s,t):t}function Oe(s,t){return Q(s,t)?[]:s}function ze({providerName:s}){const{data:t}=re(),{data:n}=ne(),{data:i}=le(),u=ve(),g=Ne(),[h,m]=p.useState(""),[f,j]=p.useState(""),[y,L]=p.useState(null),[A,S]=p.useState("auto"),[b,P]=p.useState([]),[d,x]=p.useState(""),r=n==null?void 0:n.providers.find(l=>l.name===s),c=s?t==null?void 0:t.providers[s]:null,w=i==null?void 0:i.uiHints,C=s?O(`providers.${s}.apiKey`,w):void 0,N=s?O(`providers.${s}.apiBase`,w):void 0,E=s?O(`providers.${s}.extraHeaders`,w):void 0,M=s?O(`providers.${s}.wireApi`,w):void 0,ce=(r==null?void 0:r.displayName)||s||a("providersSelectPlaceholder"),X=(r==null?void 0:r.modelPrefix)||s||"",$=p.useMemo(()=>_([X,s||""]),[X,s]),R=(r==null?void 0:r.defaultApiBase)||"",k=(c==null?void 0:c.apiBase)||R,q=z((c==null?void 0:c.extraHeaders)||null),D=(c==null?void 0:c.wireApi)||(r==null?void 0:r.defaultWireApi)||"auto",I=p.useMemo(()=>_(((r==null?void 0:r.defaultModels)??[]).map(l=>G(l,$))),[r==null?void 0:r.defaultModels,$]),J=p.useMemo(()=>_(((c==null?void 0:c.models)??[]).map(l=>G(l,$))),[c==null?void 0:c.models,$]),F=p.useMemo(()=>We(I,J),[I,J]);p.useEffect(()=>{if(!s){m(""),j(""),L(null),S("auto"),P([]),x("");return}m(""),j(k),L((c==null?void 0:c.extraHeaders)||null),S(D),P(F),x("")},[s,k,c==null?void 0:c.extraHeaders,D,F]);const Y=p.useMemo(()=>{if(!s)return!1;const l=h.trim().length>0,o=f.trim()!==k.trim(),v=!se(y,q),T=r!=null&&r.supportsWireApi?A!==D:!1,H=!Q(b,F);return l||o||v||T||H},[s,h,f,k,y,q,r==null?void 0:r.supportsWireApi,A,D,b,F]),oe=()=>{m(""),j(R),L(null),S((r==null?void 0:r.defaultWireApi)||"auto"),P(I),x("")},Z=()=>{const l=G(d,$);if(l){if(b.includes(l)){x("");return}P(o=>[...o,l]),x("")}},de=l=>{if(l.preventDefault(),!s)return;const o={},v=h.trim(),T=f.trim(),H=z(y);v.length>0&&(o.apiKey=v),T!==k.trim()&&(o.apiBase=T.length>0&&T!==R?T:null),se(H,q)||(o.extraHeaders=H),r!=null&&r.supportsWireApi&&A!==D&&(o.wireApi=A),Q(b,F)||(o.models=Oe(b,I)),u.mutate({provider:s,data:o})},me=async()=>{if(!s)return;const l={apiBase:f.trim(),extraHeaders:z(y),model:(t==null?void 0:t.agents.defaults.model)??null};h.trim().length>0&&(l.apiKey=h.trim()),r!=null&&r.supportsWireApi&&(l.wireApi=A);try{const o=await g.mutateAsync({provider:s,data:l});if(o.success){U.success(`${a("providerTestConnectionSuccess")} (${o.latencyMs}ms)`);return}const v=[`provider=${o.provider}`,`latency=${o.latencyMs}ms`];o.model&&v.push(`model=${o.model}`),U.error(`${a("providerTestConnectionFailed")}: ${o.message} | ${v.join(" | ")}`)}catch(o){const v=o instanceof Error?o.message:String(o);U.error(`${a("providerTestConnectionFailed")}: ${v}`)}};if(!s||!r||!c)return e.jsx("div",{className:"flex min-h-[520px] items-center justify-center rounded-2xl border border-gray-200/70 bg-white px-6 text-center xl:h-[calc(100vh-180px)] xl:min-h-[600px] xl:max-h-[860px]",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-semibold text-gray-900",children:a("providersSelectTitle")}),e.jsx("p",{className:"mt-2 text-sm text-gray-500",children:a("providersSelectDescription")})]})});const xe=c.apiKeySet?a("statusReady"):a("statusSetup");return e.jsxs("div",{className:"flex min-h-[520px] flex-col rounded-2xl border border-gray-200/70 bg-white shadow-card xl:h-[calc(100vh-180px)] xl:min-h-[600px] xl:max-h-[860px]",children:[e.jsx("div",{className:"border-b border-gray-100 px-6 py-5",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"truncate text-lg font-semibold text-gray-900",children:ce}),e.jsx("p",{className:"mt-1 text-sm text-gray-500",children:a("providerFormDescription")})]}),e.jsx(ie,{status:c.apiKeySet?"ready":"setup",label:xe})]})}),e.jsxs("form",{onSubmit:de,className:"flex min-h-0 flex-1 flex-col",children:[e.jsxs("div",{className:"min-h-0 flex-1 space-y-6 overflow-y-auto px-6 py-5",children:[e.jsxs("div",{className:"space-y-2.5",children:[e.jsxs(W,{htmlFor:"apiKey",className:"flex items-center gap-2 text-sm font-medium text-gray-900",children:[e.jsx(ae,{className:"h-3.5 w-3.5 text-gray-500"}),(C==null?void 0:C.label)??a("apiKey")]}),e.jsx($e,{id:"apiKey",value:h,isSet:c.apiKeySet,onChange:l=>m(l.target.value),placeholder:c.apiKeySet?a("apiKeySet"):(C==null?void 0:C.placeholder)??a("enterApiKey"),className:"rounded-xl"}),e.jsx("p",{className:"text-xs text-gray-500",children:a("leaveBlankToKeepUnchanged")})]}),e.jsxs("div",{className:"space-y-2.5",children:[e.jsxs(W,{htmlFor:"apiBase",className:"flex items-center gap-2 text-sm font-medium text-gray-900",children:[e.jsx(fe,{className:"h-3.5 w-3.5 text-gray-500"}),(N==null?void 0:N.label)??a("apiBase")]}),e.jsx(B,{id:"apiBase",type:"text",value:f,onChange:l=>j(l.target.value),placeholder:R||(N==null?void 0:N.placeholder)||"https://api.example.com",className:"rounded-xl"}),e.jsx("p",{className:"text-xs text-gray-500",children:(N==null?void 0:N.help)||a("providerApiBaseHelp")})]}),r.supportsWireApi&&e.jsxs("div",{className:"space-y-2.5",children:[e.jsxs(W,{htmlFor:"wireApi",className:"flex items-center gap-2 text-sm font-medium text-gray-900",children:[e.jsx(ee,{className:"h-3.5 w-3.5 text-gray-500"}),(M==null?void 0:M.label)??a("wireApi")]}),e.jsxs(Ce,{value:A,onValueChange:l=>S(l),children:[e.jsx(Ee,{className:"rounded-xl",children:e.jsx(Me,{})}),e.jsx(Ke,{children:(r.wireApiOptions||["auto","chat","responses"]).map(l=>e.jsx(Le,{value:l,children:l==="chat"?a("wireApiChat"):l==="responses"?a("wireApiResponses"):a("wireApiAuto")},l))})]}),(M==null?void 0:M.help)&&e.jsx("p",{className:"text-xs text-gray-500",children:M.help})]}),e.jsxs("div",{className:"space-y-2.5",children:[e.jsxs(W,{className:"flex items-center gap-2 text-sm font-medium text-gray-900",children:[e.jsx(ee,{className:"h-3.5 w-3.5 text-gray-500"}),(E==null?void 0:E.label)??a("extraHeaders")]}),e.jsx(ke,{value:y,onChange:L}),e.jsx("p",{className:"text-xs text-gray-500",children:(E==null?void 0:E.help)||a("providerExtraHeadersHelp")})]}),e.jsxs("div",{className:"space-y-2.5",children:[e.jsxs(W,{className:"flex items-center gap-2 text-sm font-medium text-gray-900",children:[e.jsx(ye,{className:"h-3.5 w-3.5 text-gray-500"}),a("providerModelsTitle")]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(B,{value:d,onChange:l=>x(l.target.value),onKeyDown:l=>{l.key==="Enter"&&(l.preventDefault(),Z())},placeholder:a("providerModelInputPlaceholder"),className:"flex-1"}),e.jsxs(K,{type:"button",variant:"outline",onClick:Z,disabled:d.trim().length===0,children:[e.jsx(te,{className:"mr-1.5 h-4 w-4"}),a("providerAddModel")]})]}),b.length===0?e.jsx("div",{className:"rounded-xl border border-dashed border-gray-200 bg-gray-50 px-3 py-2 text-xs text-gray-500",children:a("providerModelsEmpty")}):e.jsx("div",{className:"flex flex-wrap gap-2",children:b.map(l=>e.jsxs("div",{className:"group inline-flex max-w-full items-center gap-1 rounded-full border border-gray-200 bg-white px-3 py-1.5",children:[e.jsx("span",{className:"max-w-[180px] truncate text-sm text-gray-800 sm:max-w-[240px]",children:l}),e.jsx("button",{type:"button",onClick:()=>P(o=>o.filter(v=>v!==l)),className:"inline-flex h-5 w-5 items-center justify-center rounded-full text-gray-400 transition-opacity hover:bg-gray-100 hover:text-gray-600 opacity-100 md:opacity-0 md:group-hover:opacity-100 md:group-focus-within:opacity-100","aria-label":a("remove"),children:e.jsx(ge,{className:"h-3 w-3"})})]},l))}),e.jsx("p",{className:"text-xs text-gray-500",children:a("providerModelsHelp")})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 border-t border-gray-100 px-6 py-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs(K,{type:"button",variant:"outline",onClick:oe,children:[e.jsx(je,{className:"mr-2 h-4 w-4"}),a("resetToDefault")]}),e.jsxs(K,{type:"button",variant:"outline",onClick:me,disabled:g.isPending,children:[e.jsx(be,{className:"mr-2 h-4 w-4"}),g.isPending?a("providerTestingConnection"):a("providerTestConnection")]})]}),e.jsx(K,{type:"submit",disabled:u.isPending||!Y,children:u.isPending?a("saving"):Y?a("save"):a("unchanged")})]})]})]})}function Re(s){if(!s)return null;try{const t=new URL(s),n=t.pathname&&t.pathname!=="/"?t.pathname:"";return`${t.host}${n}`}catch{return s.replace(/^https?:\/\//,"")}}function Xe(){const{data:s}=re(),{data:t}=ne(),{data:n}=le(),[i,u]=p.useState("installed"),[g,h]=p.useState(),[m,f]=p.useState(""),j=n==null?void 0:n.uiHints,y=(t==null?void 0:t.providers)??[],L=(s==null?void 0:s.providers)??{},A=y.filter(d=>{var x;return(x=L[d.name])==null?void 0:x.apiKeySet}).length,S=[{id:"installed",label:a("providersTabConfigured"),count:A},{id:"all",label:a("providersTabAll"),count:y.length}],b=p.useMemo(()=>{const d=(t==null?void 0:t.providers)??[],x=(s==null?void 0:s.providers)??{},r=m.trim().toLowerCase();return d.filter(c=>{var w;return i==="installed"?!!((w=x[c.name])!=null&&w.apiKeySet):!0}).filter(c=>r?(c.displayName||c.name).toLowerCase().includes(r)||c.name.toLowerCase().includes(r):!0)},[t,s,i,m]);p.useEffect(()=>{if(b.length===0){h(void 0);return}b.some(x=>x.name===g)||h(b[0].name)},[b,g]);const P=g;return!s||!t?e.jsx("div",{className:"p-8",children:a("providersLoading")}):e.jsxs(Ae,{children:[e.jsx(Pe,{title:a("providersPageTitle"),description:a("providersPageDescription")}),e.jsxs("div",{className:"grid grid-cols-1 gap-5 xl:grid-cols-[340px_minmax(0,1fr)]",children:[e.jsxs("section",{className:"flex min-h-[520px] flex-col rounded-2xl border border-gray-200/70 bg-white shadow-card xl:h-[calc(100vh-180px)] xl:min-h-[600px] xl:max-h-[860px]",children:[e.jsx("div",{className:"border-b border-gray-100 px-4 pt-4",children:e.jsx(Be,{tabs:S,activeTab:i,onChange:u,className:"mb-0"})}),e.jsx("div",{className:"border-b border-gray-100 px-4 py-3",children:e.jsxs("div",{className:"relative",children:[e.jsx(we,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-400"}),e.jsx(B,{value:m,onChange:d=>f(d.target.value),placeholder:a("providersFilterPlaceholder"),className:"h-10 rounded-xl pl-9"})]})}),e.jsxs("div",{className:"min-h-0 flex-1 space-y-2 overflow-y-auto p-3",children:[b.map(d=>{const x=s.providers[d.name],r=!!(x!=null&&x.apiKeySet),c=P===d.name,w=O(`providers.${d.name}`,j),C=(x==null?void 0:x.apiBase)||d.defaultApiBase||"",E=Re(C)||(w==null?void 0:w.help)||a("providersDefaultDescription");return e.jsx("button",{type:"button",onClick:()=>h(d.name),className:V("w-full rounded-xl border p-2.5 text-left transition-all",c?"border-primary/30 bg-primary-50/40 shadow-sm":"border-gray-200/70 bg-white hover:border-gray-300 hover:bg-gray-50/70"),children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e.jsx(Se,{name:d.name,src:Te(d.name),className:V("h-10 w-10 rounded-lg border",r?"border-primary/30 bg-white":"border-gray-200/70 bg-white"),imgClassName:"h-5 w-5 object-contain",fallback:e.jsx("span",{className:"text-sm font-semibold uppercase text-gray-500",children:d.name[0]})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate text-sm font-semibold text-gray-900",children:d.displayName||d.name}),e.jsx("p",{className:"line-clamp-1 text-[11px] text-gray-500",children:E})]})]}),e.jsx(ie,{status:r?"ready":"setup",label:r?a("statusReady"):a("statusSetup"),className:"min-w-[56px] justify-center"})]})},d.name)}),b.length===0&&e.jsxs("div",{className:"flex h-full min-h-[220px] flex-col items-center justify-center rounded-xl border border-dashed border-gray-200 bg-gray-50/70 py-10 text-center",children:[e.jsx("div",{className:"mb-3 flex h-10 w-10 items-center justify-center rounded-lg bg-white",children:e.jsx(ae,{className:"h-5 w-5 text-gray-300"})}),e.jsx("p",{className:"text-sm font-medium text-gray-700",children:a("providersNoMatch")})]})]})]}),e.jsx(ze,{providerName:P})]})]})}export{Xe as ProvidersList};
@@ -1,2 +0,0 @@
1
- import{r as l,j as e,a5 as T,a0 as Y,ap as A,ac as $,aj as W,M as U,aq as X,X as G,Y as J}from"./vendor-CmqkRoMs.js";import{u as Z}from"./useConfirmDialog-ClpvgpHh.js";import{d as ee,e as se,l as te,f as ae,I as S}from"./useConfig-CFFZ66EV.js";import{P as re,a as le,B as g}from"./page-layout-Bz8CAEiD.js";import{t,c as o,S as ne,a as ie,b as oe,d as de,e as K,i as ce,g as xe}from"./index-q2B1bssI.js";import{e as me}from"./chat-message-D0s61C4e.js";import"./dialog-ssdjbutm.js";const u="__unknown_channel__";function he(a){return xe(a)}function j(a){const n=a.indexOf(":");return n<=0?u:a.slice(0,n).trim()||u}function C(a){return a===u?t("sessionsUnknownChannel"):a}function ge({session:a,channel:n,isSelected:i,onSelect:f}){const r=C(n),p=a.label||a.key.split(":").pop()||a.key;return e.jsxs("button",{onClick:f,className:o("w-full text-left p-3.5 rounded-xl transition-all duration-200 outline-none focus:outline-none focus:ring-0 group",i?"bg-brand-50 border border-brand-100/50":"bg-transparent border border-transparent hover:bg-gray-50/80"),children:[e.jsxs("div",{className:"flex items-start justify-between mb-1.5",children:[e.jsx("div",{className:o("font-semibold truncate pr-2 flex-1 text-sm",i?"text-brand-800":"text-gray-900"),children:p}),e.jsx("div",{className:o("text-[10px] font-bold px-2 py-0.5 rounded-full shrink-0 capitalize",i?"bg-white text-brand-600 shadow-[0_1px_2px_rgba(0,0,0,0.02)]":"bg-gray-100 text-gray-500"),children:r})]}),e.jsxs("div",{className:o("flex items-center text-xs justify-between mt-2 font-medium",i?"text-brand-600/80":"text-gray-400"),children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(X,{className:"w-3.5 h-3.5 opacity-70"}),e.jsx("span",{className:"truncate max-w-[100px]",children:ce(a.updatedAt)})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(U,{className:"w-3.5 h-3.5 opacity-70"}),e.jsx("span",{children:a.messageCount})]})]})]})}function ue({message:a}){const n=a.role.toLowerCase()==="user",i=me(a.content).trim();return e.jsx("div",{className:o("flex w-full mb-6",n?"justify-end":"justify-start"),children:e.jsxs("div",{className:o("max-w-[85%] rounded-[1.25rem] p-5 flex gap-3 text-sm",n?"bg-primary text-white rounded-tr-sm":"bg-gray-50 text-gray-800 rounded-tl-sm border border-gray-100/50"),children:[e.jsx("div",{className:"shrink-0 pt-0.5",children:n?e.jsx(G,{className:"w-4 h-4 text-primary-100"}):e.jsx(J,{className:"w-4 h-4 text-gray-400"})}),e.jsxs("div",{className:"flex-1 space-y-1 overflow-x-hidden",children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-4 mb-2",children:[e.jsx("span",{className:o("font-semibold text-xs",n?"text-primary-50":"text-gray-900 capitalize"),children:a.role}),e.jsx("span",{className:o("text-[10px]",n?"text-primary-200":"text-gray-400"),children:he(a.timestamp)})]}),e.jsx("div",{className:"whitespace-pre-wrap break-words leading-relaxed text-[15px]",children:i||"-"})]})]})})}function we(){var z,H,E;const[a,n]=l.useState(""),[i]=l.useState(100),[f]=l.useState(0),[r,p]=l.useState(null),[y,B]=l.useState("all"),[M,v]=l.useState(""),[L,N]=l.useState(""),[w,k]=l.useState(!1),q=l.useMemo(()=>({q:a.trim()||void 0,limit:i,activeMinutes:f}),[a,i,f]),h=ee(q),x=se(r,200),b=te(),D=ae(),{confirm:_,ConfirmDialog:F}=Z(),c=l.useMemo(()=>{var s;return((s=h.data)==null?void 0:s.sessions)??[]},[(z=h.data)==null?void 0:z.sessions]),d=l.useMemo(()=>c.find(s=>s.key===r),[c,r]),Q=l.useMemo(()=>{const s=new Set;for(const m of c)s.add(j(m.key));return Array.from(s).sort((m,I)=>m===u?1:I===u?-1:m.localeCompare(I))},[c]),P=l.useMemo(()=>y==="all"?c:c.filter(s=>j(s.key)===y),[c,y]);l.useEffect(()=>{d?(v(d.label||""),N(d.preferredModel||"")):(v(""),N("")),k(!1)},[d]);const O=()=>{r&&(b.mutate({key:r,data:{label:M.trim()||null,preferredModel:L.trim()||null}}),k(!1))},R=async()=>{if(!r)return;await _({title:t("sessionsClearHistory")+"?",variant:"destructive",confirmLabel:t("sessionsClearHistory")})&&b.mutate({key:r,data:{clearHistory:!0}})},V=async()=>{if(!r)return;await _({title:t("sessionsDeleteConfirm")+"?",variant:"destructive",confirmLabel:t("sessionsDeleteConfirm")})&&D.mutate({key:r},{onSuccess:()=>p(null)})};return e.jsxs(re,{fullHeight:!0,children:[e.jsx(le,{title:t("sessionsPageTitle"),description:t("sessionsPageDescription")}),e.jsxs("div",{className:"flex-1 flex gap-6 min-h-0 relative",children:[e.jsxs("div",{className:"w-[320px] flex flex-col shrink-0 bg-white rounded-2xl shadow-sm border border-gray-200 overflow-hidden",children:[e.jsxs("div",{className:"px-4 py-4 border-b border-gray-100 bg-white z-10 shrink-0 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-[11px] font-semibold text-gray-400 uppercase tracking-wider",children:[c.length," ",t("sessionsListTitle")]}),e.jsx(g,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-lg text-gray-400 hover:text-gray-700 hover:bg-gray-100",onClick:()=>h.refetch(),children:e.jsx(T,{className:o("h-3.5 w-3.5",h.isFetching&&"animate-spin")})})]}),e.jsxs(ne,{value:y,onValueChange:B,children:[e.jsx(ie,{className:"w-full h-8.5 rounded-lg bg-gray-50/50 hover:bg-gray-100 border-gray-200 focus:ring-0 shadow-none text-xs font-medium text-gray-700",children:e.jsx(oe,{placeholder:t("sessionsAllChannels")})}),e.jsxs(de,{className:"rounded-xl shadow-lg border-gray-100 max-w-[280px]",children:[e.jsx(K,{value:"all",className:"rounded-lg text-xs",children:t("sessionsAllChannels")}),Q.map(s=>e.jsx(K,{value:s,className:"rounded-lg text-xs truncate pr-6",children:C(s)},s))]})]}),e.jsxs("div",{className:"relative w-full",children:[e.jsx(Y,{className:"h-3.5 w-3.5 absolute left-3 top-2.5 text-gray-400"}),e.jsx(S,{value:a,onChange:s=>n(s.target.value),placeholder:t("sessionsSearchPlaceholder"),className:"pl-8 h-8.5 rounded-lg bg-gray-50/50 border-gray-200 focus-visible:bg-white text-xs"})]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-3 space-y-1 pb-10 custom-scrollbar relative",children:h.isLoading?e.jsx("div",{className:"text-sm text-gray-400 p-4 text-center",children:t("sessionsLoading")}):P.length===0?e.jsxs("div",{className:"text-sm text-gray-400 p-4 text-center border-2 border-dashed border-gray-100 rounded-xl mt-4",children:[e.jsx(A,{className:"w-8 h-8 mx-auto mb-2 text-gray-300"}),t("sessionsEmpty")]}):P.map(s=>e.jsx(ge,{session:s,channel:j(s.key),isSelected:r===s.key,onSelect:()=>p(s.key)},s.key))})]}),e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col overflow-hidden relative bg-white rounded-2xl shadow-sm border border-gray-200",children:[(b.isPending||D.isPending)&&e.jsx("div",{className:"absolute top-0 left-0 w-full h-1 bg-primary/20 overflow-hidden z-20",children:e.jsx("div",{className:"h-full bg-primary animate-pulse w-1/3 rounded-r-full"})}),r&&d?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"shrink-0 border-b border-gray-100 bg-white px-8 py-5 z-10 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"h-12 w-12 rounded-[14px] bg-gray-50 border border-gray-100 flex items-center justify-center text-gray-400 shrink-0",children:e.jsx($,{className:"h-6 w-6"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2.5 mb-1.5",children:[e.jsx("h3",{className:"text-lg font-bold text-gray-900 tracking-tight",children:d.label||d.key.split(":").pop()||d.key}),e.jsx("span",{className:"text-[10px] font-bold px-2 py-0.5 rounded-full bg-gray-100 text-gray-500 uppercase tracking-widest",children:C(j(d.key))})]}),e.jsx("div",{className:"text-xs text-gray-500 font-mono break-all line-clamp-1 opacity-70",title:r,children:r})]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsxs(g,{variant:"outline",size:"sm",onClick:()=>k(!w),className:o("h-8.5 rounded-lg shadow-none border-gray-200 transition-all text-xs font-semibold",w?"bg-gray-100 text-gray-900":"hover:bg-gray-50 hover:text-gray-900"),children:[e.jsx(W,{className:"w-3.5 h-3.5 mr-1.5"}),t("sessionsMetadata")]}),e.jsx(g,{variant:"outline",size:"sm",onClick:R,className:"h-8.5 rounded-lg shadow-none hover:bg-gray-50 hover:text-gray-900 border-gray-200 text-xs font-semibold text-gray-500",children:t("sessionsClearHistory")}),e.jsx(g,{variant:"outline",size:"sm",onClick:V,className:"h-8.5 rounded-lg shadow-none hover:bg-red-50 hover:text-red-600 hover:border-red-200 border-gray-200 text-xs font-semibold text-red-500",children:t("delete")})]})]}),w&&e.jsxs("div",{className:"flex items-center gap-3 bg-gray-50/50 p-3 rounded-lg border border-gray-100 animate-slide-in",children:[e.jsx(S,{placeholder:t("sessionsLabelPlaceholder"),value:M,onChange:s=>v(s.target.value),className:"h-8 text-sm bg-white"}),e.jsx(S,{placeholder:t("sessionsModelPlaceholder"),value:L,onChange:s=>N(s.target.value),className:"h-8 text-sm bg-white"}),e.jsx(g,{size:"sm",onClick:O,className:"h-8 px-4 shrink-0 shadow-none",disabled:b.isPending,children:t("sessionsSaveMeta")})]})]}),e.jsxs("div",{className:`flex-1 overflow-y-auto p-6 relative
2
- [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:bg-gray-300/80 [&::-webkit-scrollbar-thumb]:rounded-full`,children:[x.isLoading&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-50/50 backdrop-blur-sm z-10",children:e.jsxs("div",{className:"flex flex-col items-center gap-3 animate-pulse",children:[e.jsx(T,{className:"w-6 h-6 text-primary animate-spin"}),e.jsx("span",{className:"text-sm font-medium text-gray-500",children:t("sessionsHistoryLoading")})]})}),x.error&&e.jsx("div",{className:"text-center p-6 bg-red-50 rounded-xl text-red-600 border border-red-100 text-sm",children:x.error.message}),!x.isLoading&&((H=x.data)==null?void 0:H.messages.length)===0&&e.jsxs("div",{className:"h-full flex flex-col items-center justify-center text-gray-400",children:[e.jsx(U,{className:"w-12 h-12 mb-3 text-gray-300"}),e.jsx("p",{className:"text-sm",children:t("sessionsEmpty")})]}),e.jsx("div",{className:"max-w-3xl mx-auto",children:(((E=x.data)==null?void 0:E.messages)??[]).map((s,m)=>e.jsx(ue,{message:s},`${s.timestamp}-${m}`))})]})]}):e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-gray-400 p-8 h-full bg-white",children:[e.jsx("div",{className:"w-20 h-20 bg-gray-50 rounded-3xl flex items-center justify-center mb-6 border border-gray-100 shadow-[0_2px_8px_-2px_rgba(0,0,0,0.02)] rotate-3",children:e.jsx(A,{className:"h-8 w-8 text-gray-300 -rotate-3"})}),e.jsx("h3",{className:"text-lg font-bold text-gray-900 mb-2",children:t("sessionsNoSelectionTitle")}),e.jsx("p",{className:"text-sm text-center max-w-sm leading-relaxed",children:t("sessionsNoSelectionDescription")})]})]})]}),e.jsx(F,{})]})}export{we as SessionsConfig};
@@ -1,5 +0,0 @@
1
- import{r as i,az as C,aO as I,ax as ee,j as s,aw as A,aE as te,aB as D,aC as v,aF as ne,aP as oe,aQ as ae,aR as re,aS as se,aG as ie,aT as ce,aU as le,ad as de}from"./vendor-CmqkRoMs.js";import{c as x}from"./index-q2B1bssI.js";function ue(e,t){return i.useReducer((n,o)=>t[n][o]??n,e)}var E=e=>{const{present:t,children:n}=e,o=fe(t),a=typeof n=="function"?n({present:o.isPresent}):i.Children.only(n),r=C(o.ref,ge(a));return typeof n=="function"||o.isPresent?i.cloneElement(a,{ref:r}):null};E.displayName="Presence";function fe(e){const[t,n]=i.useState(),o=i.useRef(null),a=i.useRef(e),r=i.useRef("none"),c=e?"mounted":"unmounted",[d,u]=ue(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return i.useEffect(()=>{const l=R(o.current);r.current=d==="mounted"?l:"none"},[d]),I(()=>{const l=o.current,g=a.current;if(g!==e){const y=r.current,p=R(l);e?u("MOUNT"):p==="none"||(l==null?void 0:l.display)==="none"?u("UNMOUNT"):u(g&&y!==p?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,u]),I(()=>{if(t){let l;const g=t.ownerDocument.defaultView??window,m=p=>{const Z=R(o.current).includes(CSS.escape(p.animationName));if(p.target===t&&Z&&(u("ANIMATION_END"),!a.current)){const J=t.style.animationFillMode;t.style.animationFillMode="forwards",l=g.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=J)})}},y=p=>{p.target===t&&(r.current=R(o.current))};return t.addEventListener("animationstart",y),t.addEventListener("animationcancel",m),t.addEventListener("animationend",m),()=>{g.clearTimeout(l),t.removeEventListener("animationstart",y),t.removeEventListener("animationcancel",m),t.removeEventListener("animationend",m)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(d),ref:i.useCallback(l=>{o.current=l?getComputedStyle(l):null,n(l)},[])}}function R(e){return(e==null?void 0:e.animationName)||"none"}function ge(e){var o,a;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var O="Dialog",[w]=ne(O),[me,f]=w(O),M=e=>{const{__scopeDialog:t,children:n,open:o,defaultOpen:a,onOpenChange:r,modal:c=!0}=e,d=i.useRef(null),u=i.useRef(null),[l,g]=ee({prop:o,defaultProp:a??!1,onChange:r,caller:O});return s.jsx(me,{scope:t,triggerRef:d,contentRef:u,contentId:A(),titleId:A(),descriptionId:A(),open:l,onOpenChange:g,onOpenToggle:i.useCallback(()=>g(m=>!m),[g]),modal:c,children:n})};M.displayName=O;var T="DialogTrigger",pe=i.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,a=f(T,n),r=C(t,a.triggerRef);return s.jsx(D.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":b(a.open),...o,ref:r,onClick:v(e.onClick,a.onOpenToggle)})});pe.displayName=T;var P="DialogPortal",[Ne,j]=w(P,{forceMount:void 0}),S=e=>{const{__scopeDialog:t,forceMount:n,children:o,container:a}=e,r=f(P,t);return s.jsx(Ne,{scope:t,forceMount:n,children:i.Children.map(o,c=>s.jsx(E,{present:n||r.open,children:s.jsx(te,{asChild:!0,container:a,children:c})}))})};S.displayName=P;var h="DialogOverlay",F=i.forwardRef((e,t)=>{const n=j(h,e.__scopeDialog),{forceMount:o=n.forceMount,...a}=e,r=f(h,e.__scopeDialog);return r.modal?s.jsx(E,{present:o||r.open,children:s.jsx(ve,{...a,ref:t})}):null});F.displayName=h;var xe=ce("DialogOverlay.RemoveScroll"),ve=i.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,a=f(h,n);return s.jsx(ae,{as:xe,allowPinchZoom:!0,shards:[a.contentRef],children:s.jsx(D.div,{"data-state":b(a.open),...o,ref:t,style:{pointerEvents:"auto",...o.style}})})}),N="DialogContent",W=i.forwardRef((e,t)=>{const n=j(N,e.__scopeDialog),{forceMount:o=n.forceMount,...a}=e,r=f(N,e.__scopeDialog);return s.jsx(E,{present:o||r.open,children:r.modal?s.jsx(De,{...a,ref:t}):s.jsx(ye,{...a,ref:t})})});W.displayName=N;var De=i.forwardRef((e,t)=>{const n=f(N,e.__scopeDialog),o=i.useRef(null),a=C(t,n.contentRef,o);return i.useEffect(()=>{const r=o.current;if(r)return oe(r)},[]),s.jsx(L,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:v(e.onCloseAutoFocus,r=>{var c;r.preventDefault(),(c=n.triggerRef.current)==null||c.focus()}),onPointerDownOutside:v(e.onPointerDownOutside,r=>{const c=r.detail.originalEvent,d=c.button===0&&c.ctrlKey===!0;(c.button===2||d)&&r.preventDefault()}),onFocusOutside:v(e.onFocusOutside,r=>r.preventDefault())})}),ye=i.forwardRef((e,t)=>{const n=f(N,e.__scopeDialog),o=i.useRef(!1),a=i.useRef(!1);return s.jsx(L,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:r=>{var c,d;(c=e.onCloseAutoFocus)==null||c.call(e,r),r.defaultPrevented||(o.current||(d=n.triggerRef.current)==null||d.focus(),r.preventDefault()),o.current=!1,a.current=!1},onInteractOutside:r=>{var u,l;(u=e.onInteractOutside)==null||u.call(e,r),r.defaultPrevented||(o.current=!0,r.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const c=r.target;((l=n.triggerRef.current)==null?void 0:l.contains(c))&&r.preventDefault(),r.detail.originalEvent.type==="focusin"&&a.current&&r.preventDefault()}})}),L=i.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:o,onOpenAutoFocus:a,onCloseAutoFocus:r,...c}=e,d=f(N,n),u=i.useRef(null),l=C(t,u);return re(),s.jsxs(s.Fragment,{children:[s.jsx(se,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:a,onUnmountAutoFocus:r,children:s.jsx(ie,{role:"dialog",id:d.contentId,"aria-describedby":d.descriptionId,"aria-labelledby":d.titleId,"data-state":b(d.open),...c,ref:l,onDismiss:()=>d.onOpenChange(!1)})}),s.jsxs(s.Fragment,{children:[s.jsx(Re,{titleId:d.titleId}),s.jsx(Ce,{contentRef:u,descriptionId:d.descriptionId})]})]})}),_="DialogTitle",U=i.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,a=f(_,n);return s.jsx(D.h2,{id:a.titleId,...o,ref:t})});U.displayName=_;var k="DialogDescription",$=i.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,a=f(k,n);return s.jsx(D.p,{id:a.descriptionId,...o,ref:t})});$.displayName=k;var G="DialogClose",z=i.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,a=f(G,n);return s.jsx(D.button,{type:"button",...o,ref:t,onClick:v(e.onClick,()=>a.onOpenChange(!1))})});z.displayName=G;function b(e){return e?"open":"closed"}var B="DialogTitleWarning",[Se,H]=le(B,{contentName:N,titleName:_,docsSlug:"dialog"}),Re=({titleId:e})=>{const t=H(B),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
2
-
3
- If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
4
-
5
- For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return i.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},he="DialogDescriptionWarning",Ce=({contentRef:e,descriptionId:t})=>{const o=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${H(he).contentName}}.`;return i.useEffect(()=>{var r;const a=(r=e.current)==null?void 0:r.getAttribute("aria-describedby");t&&a&&(document.getElementById(t)||console.warn(o))},[o,e,t]),null},Ee=M,Oe=S,V=F,q=W,K=U,Q=$,Ae=z;const Fe=Ee,Pe=Oe,X=i.forwardRef(({className:e,...t},n)=>s.jsx(V,{ref:n,className:x("fixed inset-0 z-50 bg-black/40 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));X.displayName=V.displayName;const _e=i.forwardRef(({className:e,children:t,...n},o)=>s.jsxs(Pe,{children:[s.jsx(X,{}),s.jsxs(q,{ref:o,className:x("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-gray-200/50 bg-white p-6 shadow-xl duration-base data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] rounded-2xl",e),...n,children:[t,s.jsxs(Ae,{className:"absolute right-4 top-4 rounded-lg p-1 opacity-70 ring-offset-white transition-all duration-fast hover:opacity-100 hover:bg-gray-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 disabled:pointer-events-none",children:[s.jsx(de,{className:"h-4 w-4 text-gray-500"}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));_e.displayName=q.displayName;const be=({className:e,...t})=>s.jsx("div",{className:x("flex flex-col space-y-2 text-center sm:text-left",e),...t});be.displayName="DialogHeader";const Ie=({className:e,...t})=>s.jsx("div",{className:x("flex flex-col-reverse sm:flex-row sm:justify-end sm:gap-3",e),...t});Ie.displayName="DialogFooter";const we=i.forwardRef(({className:e,...t},n)=>s.jsx(K,{ref:n,className:x("text-lg font-semibold leading-tight tracking-tight text-gray-900",e),...t}));we.displayName=K.displayName;const Me=i.forwardRef(({className:e,...t},n)=>s.jsx(Q,{ref:n,className:x("text-sm text-gray-500 leading-relaxed",e),...t}));Me.displayName=Q.displayName;export{Fe as D,E as P,_e as a,be as b,we as c,Me as d,Ie as e};