@chaaskit/server 0.1.0

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 (189) hide show
  1. package/dist/api/admin.js +438 -0
  2. package/dist/api/admin.js.map +1 -0
  3. package/dist/api/agents.js +21 -0
  4. package/dist/api/agents.js.map +1 -0
  5. package/dist/api/api-keys.js +122 -0
  6. package/dist/api/api-keys.js.map +1 -0
  7. package/dist/api/auth.js +399 -0
  8. package/dist/api/auth.js.map +1 -0
  9. package/dist/api/chat.js +900 -0
  10. package/dist/api/chat.js.map +1 -0
  11. package/dist/api/config.js +91 -0
  12. package/dist/api/config.js.map +1 -0
  13. package/dist/api/documents.js +237 -0
  14. package/dist/api/documents.js.map +1 -0
  15. package/dist/api/export.js +107 -0
  16. package/dist/api/export.js.map +1 -0
  17. package/dist/api/health.js +25 -0
  18. package/dist/api/health.js.map +1 -0
  19. package/dist/api/mcp-server.js +84 -0
  20. package/dist/api/mcp-server.js.map +1 -0
  21. package/dist/api/mcp.js +400 -0
  22. package/dist/api/mcp.js.map +1 -0
  23. package/dist/api/mentions.js +94 -0
  24. package/dist/api/mentions.js.map +1 -0
  25. package/dist/api/oauth.js +366 -0
  26. package/dist/api/oauth.js.map +1 -0
  27. package/dist/api/payments.js +473 -0
  28. package/dist/api/payments.js.map +1 -0
  29. package/dist/api/projects.js +301 -0
  30. package/dist/api/projects.js.map +1 -0
  31. package/dist/api/scheduled-prompts.js +617 -0
  32. package/dist/api/scheduled-prompts.js.map +1 -0
  33. package/dist/api/search.js +85 -0
  34. package/dist/api/search.js.map +1 -0
  35. package/dist/api/share.js +188 -0
  36. package/dist/api/share.js.map +1 -0
  37. package/dist/api/slack.js +468 -0
  38. package/dist/api/slack.js.map +1 -0
  39. package/dist/api/teams.js +693 -0
  40. package/dist/api/teams.js.map +1 -0
  41. package/dist/api/templates.js +134 -0
  42. package/dist/api/templates.js.map +1 -0
  43. package/dist/api/threads.js +323 -0
  44. package/dist/api/threads.js.map +1 -0
  45. package/dist/api/upload.js +57 -0
  46. package/dist/api/upload.js.map +1 -0
  47. package/dist/api/user.js +111 -0
  48. package/dist/api/user.js.map +1 -0
  49. package/dist/api/v1/openai.js +245 -0
  50. package/dist/api/v1/openai.js.map +1 -0
  51. package/dist/app.js +168 -0
  52. package/dist/app.js.map +1 -0
  53. package/dist/bin/cli.js +57 -0
  54. package/dist/bin/cli.js.map +1 -0
  55. package/dist/commands/db-sync.js +108 -0
  56. package/dist/commands/db-sync.js.map +1 -0
  57. package/dist/config/loader.js +374 -0
  58. package/dist/config/loader.js.map +1 -0
  59. package/dist/documents/extractors.js +136 -0
  60. package/dist/documents/extractors.js.map +1 -0
  61. package/dist/extensions/glob.js +53 -0
  62. package/dist/extensions/glob.js.map +1 -0
  63. package/dist/extensions/loader.js +72 -0
  64. package/dist/extensions/loader.js.map +1 -0
  65. package/dist/index.js +25 -0
  66. package/dist/index.js.map +1 -0
  67. package/dist/loaders/index.js +75 -0
  68. package/dist/loaders/index.js.map +1 -0
  69. package/dist/mcp/client.js +551 -0
  70. package/dist/mcp/client.js.map +1 -0
  71. package/dist/mcp/server.js +335 -0
  72. package/dist/mcp/server.js.map +1 -0
  73. package/dist/middleware/apiKeyAuth.js +136 -0
  74. package/dist/middleware/apiKeyAuth.js.map +1 -0
  75. package/dist/middleware/auth.js +192 -0
  76. package/dist/middleware/auth.js.map +1 -0
  77. package/dist/middleware/errorHandler.js +41 -0
  78. package/dist/middleware/errorHandler.js.map +1 -0
  79. package/dist/middleware/mcpServerAuth.js +164 -0
  80. package/dist/middleware/mcpServerAuth.js.map +1 -0
  81. package/dist/middleware/requestLogger.js +9 -0
  82. package/dist/middleware/requestLogger.js.map +1 -0
  83. package/dist/middleware/team.js +132 -0
  84. package/dist/middleware/team.js.map +1 -0
  85. package/dist/oauth/server.js +410 -0
  86. package/dist/oauth/server.js.map +1 -0
  87. package/dist/queue/cli.js +93 -0
  88. package/dist/queue/cli.js.map +1 -0
  89. package/dist/queue/handlers/index.js +91 -0
  90. package/dist/queue/handlers/index.js.map +1 -0
  91. package/dist/queue/handlers/scheduled-prompt.js +270 -0
  92. package/dist/queue/handlers/scheduled-prompt.js.map +1 -0
  93. package/dist/queue/index.js +91 -0
  94. package/dist/queue/index.js.map +1 -0
  95. package/dist/queue/providers/memory.js +296 -0
  96. package/dist/queue/providers/memory.js.map +1 -0
  97. package/dist/queue/providers/sqs.js +275 -0
  98. package/dist/queue/providers/sqs.js.map +1 -0
  99. package/dist/queue/scheduler.js +355 -0
  100. package/dist/queue/scheduler.js.map +1 -0
  101. package/dist/queue/types.js +5 -0
  102. package/dist/queue/types.js.map +1 -0
  103. package/dist/queue/worker.js +230 -0
  104. package/dist/queue/worker.js.map +1 -0
  105. package/dist/registry/index.js +40 -0
  106. package/dist/registry/index.js.map +1 -0
  107. package/dist/server.js +207 -0
  108. package/dist/server.js.map +1 -0
  109. package/dist/services/agent.js +530 -0
  110. package/dist/services/agent.js.map +1 -0
  111. package/dist/services/agents.js +194 -0
  112. package/dist/services/agents.js.map +1 -0
  113. package/dist/services/documents.js +507 -0
  114. package/dist/services/documents.js.map +1 -0
  115. package/dist/services/email/index.js +91 -0
  116. package/dist/services/email/index.js.map +1 -0
  117. package/dist/services/email/providers/ses.js +97 -0
  118. package/dist/services/email/providers/ses.js.map +1 -0
  119. package/dist/services/email/templates.js +194 -0
  120. package/dist/services/email/templates.js.map +1 -0
  121. package/dist/services/email/types.js +5 -0
  122. package/dist/services/email/types.js.map +1 -0
  123. package/dist/services/encryption.js +69 -0
  124. package/dist/services/encryption.js.map +1 -0
  125. package/dist/services/oauth-discovery.js +226 -0
  126. package/dist/services/oauth-discovery.js.map +1 -0
  127. package/dist/services/pendingConfirmation.js +105 -0
  128. package/dist/services/pendingConfirmation.js.map +1 -0
  129. package/dist/services/scheduledPrompts.js +70 -0
  130. package/dist/services/scheduledPrompts.js.map +1 -0
  131. package/dist/services/slack/client.js +174 -0
  132. package/dist/services/slack/client.js.map +1 -0
  133. package/dist/services/slack/events.js +189 -0
  134. package/dist/services/slack/events.js.map +1 -0
  135. package/dist/services/slack/index.js +6 -0
  136. package/dist/services/slack/index.js.map +1 -0
  137. package/dist/services/slack/notifications.js +124 -0
  138. package/dist/services/slack/notifications.js.map +1 -0
  139. package/dist/services/slack/signature.js +74 -0
  140. package/dist/services/slack/signature.js.map +1 -0
  141. package/dist/services/slack/thread-context.js +191 -0
  142. package/dist/services/slack/thread-context.js.map +1 -0
  143. package/dist/services/toolConfirmation.js +55 -0
  144. package/dist/services/toolConfirmation.js.map +1 -0
  145. package/dist/services/usage.js +241 -0
  146. package/dist/services/usage.js.map +1 -0
  147. package/dist/ssr/build.js +90 -0
  148. package/dist/ssr/build.js.map +1 -0
  149. package/dist/ssr/components/SSRMessageList.js +120 -0
  150. package/dist/ssr/components/SSRMessageList.js.map +1 -0
  151. package/dist/ssr/entry.client.js +8 -0
  152. package/dist/ssr/entry.client.js.map +1 -0
  153. package/dist/ssr/entry.server.js +71 -0
  154. package/dist/ssr/entry.server.js.map +1 -0
  155. package/dist/ssr/handler.js +51 -0
  156. package/dist/ssr/handler.js.map +1 -0
  157. package/dist/ssr/root.js +184 -0
  158. package/dist/ssr/root.js.map +1 -0
  159. package/dist/ssr/routes/login.js +140 -0
  160. package/dist/ssr/routes/login.js.map +1 -0
  161. package/dist/ssr/routes/pricing.js +195 -0
  162. package/dist/ssr/routes/pricing.js.map +1 -0
  163. package/dist/ssr/routes/privacy.js +39 -0
  164. package/dist/ssr/routes/privacy.js.map +1 -0
  165. package/dist/ssr/routes/register.js +148 -0
  166. package/dist/ssr/routes/register.js.map +1 -0
  167. package/dist/ssr/routes/shared.$shareId.js +153 -0
  168. package/dist/ssr/routes/shared.$shareId.js.map +1 -0
  169. package/dist/ssr/routes/terms.js +39 -0
  170. package/dist/ssr/routes/terms.js.map +1 -0
  171. package/dist/storage/index.js +43 -0
  172. package/dist/storage/index.js.map +1 -0
  173. package/dist/storage/providers/database.js +38 -0
  174. package/dist/storage/providers/database.js.map +1 -0
  175. package/dist/storage/providers/filesystem.js +51 -0
  176. package/dist/storage/providers/filesystem.js.map +1 -0
  177. package/dist/storage/types.js +2 -0
  178. package/dist/storage/types.js.map +1 -0
  179. package/dist/tools/documents.js +336 -0
  180. package/dist/tools/documents.js.map +1 -0
  181. package/dist/tools/get-plan-usage.js +82 -0
  182. package/dist/tools/get-plan-usage.js.map +1 -0
  183. package/dist/tools/index.js +106 -0
  184. package/dist/tools/index.js.map +1 -0
  185. package/dist/tools/types.js +2 -0
  186. package/dist/tools/types.js.map +1 -0
  187. package/dist/tools/web-scrape.js +145 -0
  188. package/dist/tools/web-scrape.js.map +1 -0
  189. package/package.json +93 -0
@@ -0,0 +1,148 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Link, useOutletContext } from '@remix-run/react';
3
+ export const meta = ({ matches }) => {
4
+ const parentData = matches.find((m) => m.id === 'root')?.data;
5
+ const appName = parentData?.config?.app?.name || 'AI Chat';
6
+ return [
7
+ { title: `Sign Up - ${appName}` },
8
+ { name: 'description', content: `Create your ${appName} account` },
9
+ // Prevent indexing of registration page
10
+ { name: 'robots', content: 'noindex, nofollow' },
11
+ ];
12
+ };
13
+ export default function RegisterPage() {
14
+ const { config } = useOutletContext();
15
+ const hasEmailPassword = config.auth?.methods?.includes('email-password') ?? true;
16
+ const hasGoogle = config.auth?.methods?.includes('google') ?? false;
17
+ const hasGitHub = config.auth?.methods?.includes('github') ?? false;
18
+ return (_jsx("div", { style: {
19
+ display: 'flex',
20
+ minHeight: '100vh',
21
+ alignItems: 'center',
22
+ justifyContent: 'center',
23
+ backgroundColor: 'rgb(var(--color-background))',
24
+ padding: '1rem',
25
+ }, children: _jsxs("div", { style: { width: '100%', maxWidth: '28rem' }, children: [_jsxs("div", { style: { marginBottom: '2rem', textAlign: 'center' }, children: [config.ui?.logo && (_jsx("img", { src: typeof config.ui.logo === 'string' ? config.ui.logo : config.ui.logo.light, alt: config.app.name, style: {
26
+ height: '4rem',
27
+ width: '4rem',
28
+ marginLeft: 'auto',
29
+ marginRight: 'auto',
30
+ marginBottom: '1rem',
31
+ borderRadius: '0.5rem',
32
+ objectFit: 'contain',
33
+ } })), _jsx("h1", { style: {
34
+ fontSize: '1.875rem',
35
+ fontWeight: 'bold',
36
+ color: 'rgb(var(--color-text-primary))',
37
+ margin: 0,
38
+ }, children: "Create an account" }), _jsxs("p", { style: {
39
+ marginTop: '0.5rem',
40
+ color: 'rgb(var(--color-text-secondary))',
41
+ }, children: ["Get started with ", config.app.name] })] }), (hasGoogle || hasGitHub) && (_jsxs("div", { style: { marginBottom: '1.5rem', display: 'flex', flexDirection: 'column', gap: '0.75rem' }, children: [hasGoogle && (_jsxs("a", { href: "/api/auth/oauth/google", style: {
42
+ display: 'flex',
43
+ width: '100%',
44
+ alignItems: 'center',
45
+ justifyContent: 'center',
46
+ gap: '0.5rem',
47
+ borderRadius: '0.5rem',
48
+ border: '1px solid rgb(var(--color-border))',
49
+ backgroundColor: 'rgb(var(--color-background))',
50
+ padding: '0.5rem 1rem',
51
+ color: 'rgb(var(--color-text-primary))',
52
+ textDecoration: 'none',
53
+ }, children: [_jsxs("svg", { style: { height: '1.25rem', width: '1.25rem' }, viewBox: "0 0 24 24", children: [_jsx("path", { fill: "currentColor", d: "M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z" }), _jsx("path", { fill: "currentColor", d: "M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z" }), _jsx("path", { fill: "currentColor", d: "M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z" }), _jsx("path", { fill: "currentColor", d: "M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z" })] }), "Sign up with Google"] })), hasGitHub && (_jsxs("a", { href: "/api/auth/oauth/github", style: {
54
+ display: 'flex',
55
+ width: '100%',
56
+ alignItems: 'center',
57
+ justifyContent: 'center',
58
+ gap: '0.5rem',
59
+ borderRadius: '0.5rem',
60
+ border: '1px solid rgb(var(--color-border))',
61
+ backgroundColor: 'rgb(var(--color-background))',
62
+ padding: '0.5rem 1rem',
63
+ color: 'rgb(var(--color-text-primary))',
64
+ textDecoration: 'none',
65
+ }, children: [_jsx("svg", { style: { height: '1.25rem', width: '1.25rem' }, viewBox: "0 0 24 24", fill: "currentColor", children: _jsx("path", { d: "M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z" }) }), "Sign up with GitHub"] }))] })), (hasGoogle || hasGitHub) && hasEmailPassword && (_jsxs("div", { style: { position: 'relative', marginBottom: '1.5rem' }, children: [_jsx("div", { style: {
66
+ position: 'absolute',
67
+ inset: 0,
68
+ display: 'flex',
69
+ alignItems: 'center',
70
+ }, children: _jsx("div", { style: {
71
+ width: '100%',
72
+ borderTop: '1px solid rgb(var(--color-border))',
73
+ } }) }), _jsx("div", { style: {
74
+ position: 'relative',
75
+ display: 'flex',
76
+ justifyContent: 'center',
77
+ fontSize: '0.875rem',
78
+ }, children: _jsx("span", { style: {
79
+ backgroundColor: 'rgb(var(--color-background))',
80
+ padding: '0 0.5rem',
81
+ color: 'rgb(var(--color-text-muted))',
82
+ }, children: "Or continue with email" }) })] })), hasEmailPassword && (_jsxs("form", { method: "post", action: "/api/auth/register", style: { display: 'flex', flexDirection: 'column', gap: '1rem' }, children: [_jsxs("div", { children: [_jsx("label", { htmlFor: "name", style: {
83
+ display: 'block',
84
+ fontSize: '0.875rem',
85
+ fontWeight: 500,
86
+ color: 'rgb(var(--color-text-primary))',
87
+ }, children: "Name" }), _jsx("input", { type: "text", id: "name", name: "name", required: true, style: {
88
+ marginTop: '0.25rem',
89
+ width: '100%',
90
+ borderRadius: '0.5rem',
91
+ border: '1px solid rgb(var(--color-input-border))',
92
+ backgroundColor: 'rgb(var(--color-input-background))',
93
+ padding: '0.5rem 1rem',
94
+ color: 'rgb(var(--color-text-primary))',
95
+ boxSizing: 'border-box',
96
+ } })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: "email", style: {
97
+ display: 'block',
98
+ fontSize: '0.875rem',
99
+ fontWeight: 500,
100
+ color: 'rgb(var(--color-text-primary))',
101
+ }, children: "Email" }), _jsx("input", { type: "email", id: "email", name: "email", required: true, style: {
102
+ marginTop: '0.25rem',
103
+ width: '100%',
104
+ borderRadius: '0.5rem',
105
+ border: '1px solid rgb(var(--color-input-border))',
106
+ backgroundColor: 'rgb(var(--color-input-background))',
107
+ padding: '0.5rem 1rem',
108
+ color: 'rgb(var(--color-text-primary))',
109
+ boxSizing: 'border-box',
110
+ } })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: "password", style: {
111
+ display: 'block',
112
+ fontSize: '0.875rem',
113
+ fontWeight: 500,
114
+ color: 'rgb(var(--color-text-primary))',
115
+ }, children: "Password" }), _jsx("input", { type: "password", id: "password", name: "password", required: true, minLength: 8, style: {
116
+ marginTop: '0.25rem',
117
+ width: '100%',
118
+ borderRadius: '0.5rem',
119
+ border: '1px solid rgb(var(--color-input-border))',
120
+ backgroundColor: 'rgb(var(--color-input-background))',
121
+ padding: '0.5rem 1rem',
122
+ color: 'rgb(var(--color-text-primary))',
123
+ boxSizing: 'border-box',
124
+ } })] }), _jsx("button", { type: "submit", style: {
125
+ width: '100%',
126
+ borderRadius: '0.5rem',
127
+ backgroundColor: 'rgb(var(--color-primary))',
128
+ padding: '0.5rem 1rem',
129
+ fontWeight: 500,
130
+ color: 'white',
131
+ border: 'none',
132
+ cursor: 'pointer',
133
+ }, children: "Create account" })] })), _jsxs("p", { style: {
134
+ marginTop: '1rem',
135
+ textAlign: 'center',
136
+ fontSize: '0.75rem',
137
+ color: 'rgb(var(--color-text-muted))',
138
+ }, children: ["By signing up, you agree to our", ' ', _jsx(Link, { to: config.legal?.termsOfServiceUrl || '/terms', style: { color: 'rgb(var(--color-primary))', textDecoration: 'none' }, children: "Terms of Service" }), ' ', "and", ' ', _jsx(Link, { to: config.legal?.privacyPolicyUrl || '/privacy', style: { color: 'rgb(var(--color-primary))', textDecoration: 'none' }, children: "Privacy Policy" })] }), _jsxs("p", { style: {
139
+ marginTop: '1.5rem',
140
+ textAlign: 'center',
141
+ fontSize: '0.875rem',
142
+ color: 'rgb(var(--color-text-secondary))',
143
+ }, children: ["Already have an account?", ' ', _jsx(Link, { to: "/login", style: {
144
+ color: 'rgb(var(--color-primary))',
145
+ textDecoration: 'none',
146
+ }, children: "Sign in" })] })] }) }));
147
+ }
148
+ //# sourceMappingURL=register.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register.js","sourceRoot":"","sources":["../../../src/ssr/routes/register.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,gB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AAS,EAAE,MAAM;wBACjB,SAAS,EAAE,QAAQ;wBACnB,QAAQ,EAAE,SAAS;wBACnB,KAAK,EAAE,8BAA8B;qBACtC,gDAE+B,GAAG,EACnC,KAAC,IAAI,IACH,EAAE,EAAE,MAAM,CAAC,KAAK,EAAE,iBAAiB,IAAI,QAAQ,EAC/C,KAAK,EAAE,EAAE,KAAK,EAAE,2BAA2B,EAAE,cAAc,EAAE,MAAM,EAAE,iCAGhE,EAAC,GAAG,SACP,GAAG,EACP,KAAC,IAAI,IACH,EAAE,EAAE,MAAM,CAAC,KAAK,EAAE,gBAAgB,IAAI,UAAU,EAChD,KAAK,EAAE,EAAE,KAAK,EAAE,2BAA2B,EAAE,cAAc,EAAE,MAAM,EAAE,+BAGhE,IACL,EAGJ,aACE,KAAK,EAAE;wBACL,SAAS,EAAE,QAAQ;wBACnB,SAAS,EAAE,QAAQ;wBACnB,QAAQ,EAAE,UAAU;wBACpB,KAAK,EAAE,kCAAkC;qBAC1C,yCAEwB,GAAG,EAC5B,KAAC,IAAI,IACH,EAAE,EAAC,QAAQ,EACX,KAAK,EAAE;gCACL,KAAK,EAAE,2BAA2B;gCAClC,cAAc,EAAE,MAAM;6BACvB,wBAGI,IACL,IACA,GACF,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,153 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { json } from '@remix-run/node';
3
+ import { useLoaderData, Link, useOutletContext } from '@remix-run/react';
4
+ import { db } from '@chaaskit/db';
5
+ import { SSRMessageList } from '../components/SSRMessageList.js';
6
+ export const meta = ({ data }) => {
7
+ if (!data) {
8
+ return [
9
+ { title: 'Thread Not Found' },
10
+ { name: 'description', content: 'This shared thread could not be found.' },
11
+ ];
12
+ }
13
+ const title = data.thread.title || 'Shared Conversation';
14
+ const messageCount = data.thread.messages.length;
15
+ const description = `A shared conversation with ${messageCount} messages`;
16
+ return [
17
+ { title },
18
+ { name: 'description', content: description },
19
+ // Open Graph
20
+ { property: 'og:title', content: title },
21
+ { property: 'og:description', content: description },
22
+ { property: 'og:type', content: 'article' },
23
+ // Twitter
24
+ { name: 'twitter:card', content: 'summary' },
25
+ { name: 'twitter:title', content: title },
26
+ { name: 'twitter:description', content: description },
27
+ ];
28
+ };
29
+ export async function loader({ params }) {
30
+ const { shareId } = params;
31
+ if (!shareId) {
32
+ throw new Response('Share ID required', { status: 400 });
33
+ }
34
+ const shared = await db.sharedThread.findUnique({
35
+ where: { shareId },
36
+ include: {
37
+ thread: {
38
+ include: {
39
+ messages: {
40
+ orderBy: { createdAt: 'asc' },
41
+ select: {
42
+ id: true,
43
+ role: true,
44
+ content: true,
45
+ createdAt: true,
46
+ },
47
+ },
48
+ },
49
+ },
50
+ },
51
+ });
52
+ if (!shared) {
53
+ throw new Response('Shared thread not found', { status: 404 });
54
+ }
55
+ // Check expiration
56
+ if (shared.expiresAt && shared.expiresAt < new Date()) {
57
+ throw new Response('Share link has expired', { status: 410 });
58
+ }
59
+ return json({
60
+ thread: {
61
+ id: shared.thread.id,
62
+ title: shared.thread.title,
63
+ messages: shared.thread.messages.map((m) => ({
64
+ id: m.id,
65
+ role: m.role,
66
+ content: m.content,
67
+ createdAt: m.createdAt.toISOString(),
68
+ })),
69
+ createdAt: shared.thread.createdAt.toISOString(),
70
+ },
71
+ });
72
+ }
73
+ export default function SharedThreadPage() {
74
+ const { thread } = useLoaderData();
75
+ const { config } = useOutletContext();
76
+ // Convert messages to the format expected by SSRMessageList
77
+ const messages = thread.messages.map((m) => ({
78
+ id: m.id,
79
+ role: m.role,
80
+ content: m.content,
81
+ createdAt: new Date(m.createdAt),
82
+ threadId: thread.id,
83
+ }));
84
+ return (_jsxs("div", { className: "min-h-screen bg-background", style: {
85
+ minHeight: '100vh',
86
+ backgroundColor: 'rgb(var(--color-background))',
87
+ }, children: [_jsx("header", { className: "border-b border-border bg-background-secondary", style: {
88
+ borderBottom: '1px solid rgb(var(--color-border))',
89
+ backgroundColor: 'rgb(var(--color-background-secondary))',
90
+ }, children: _jsx("div", { className: "mx-auto max-w-3xl px-4 py-4", style: {
91
+ maxWidth: '48rem',
92
+ marginLeft: 'auto',
93
+ marginRight: 'auto',
94
+ padding: '1rem',
95
+ }, children: _jsxs("div", { className: "flex items-center justify-between", style: {
96
+ display: 'flex',
97
+ alignItems: 'center',
98
+ justifyContent: 'space-between',
99
+ }, children: [_jsxs("div", { children: [_jsx("h1", { className: "text-lg font-semibold text-text-primary", style: {
100
+ fontSize: '1.125rem',
101
+ fontWeight: 600,
102
+ color: 'rgb(var(--color-text-primary))',
103
+ margin: 0,
104
+ }, children: thread.title }), _jsxs("p", { className: "text-sm text-text-muted", style: {
105
+ fontSize: '0.875rem',
106
+ color: 'rgb(var(--color-text-muted))',
107
+ margin: '0.25rem 0 0 0',
108
+ }, children: ["Shared conversation from ", config.app.name] })] }), _jsxs(Link, { to: "/", className: "rounded-lg bg-primary px-4 py-2 text-sm text-white hover:bg-primary-hover", style: {
109
+ backgroundColor: 'rgb(var(--color-primary))',
110
+ color: 'white',
111
+ padding: '0.5rem 1rem',
112
+ borderRadius: '0.5rem',
113
+ fontSize: '0.875rem',
114
+ textDecoration: 'none',
115
+ }, children: ["Try ", config.app.name] })] }) }) }), _jsx("main", { className: "pb-8", style: { paddingBottom: '2rem' }, children: _jsx(SSRMessageList, { messages: messages, appName: config.app.name }) }), _jsx("footer", { className: "border-t border-border bg-background-secondary py-4", style: {
116
+ borderTop: '1px solid rgb(var(--color-border))',
117
+ backgroundColor: 'rgb(var(--color-background-secondary))',
118
+ padding: '1rem',
119
+ }, children: _jsxs("p", { className: "text-center text-sm text-text-muted", style: {
120
+ textAlign: 'center',
121
+ fontSize: '0.875rem',
122
+ color: 'rgb(var(--color-text-muted))',
123
+ margin: 0,
124
+ }, children: ["Powered by ", config.app.name] }) })] }));
125
+ }
126
+ // Error boundary for this route
127
+ export function ErrorBoundary() {
128
+ return (_jsx("div", { style: {
129
+ display: 'flex',
130
+ flexDirection: 'column',
131
+ alignItems: 'center',
132
+ justifyContent: 'center',
133
+ minHeight: '100vh',
134
+ padding: '1rem',
135
+ backgroundColor: 'rgb(var(--color-background))',
136
+ }, children: _jsxs("div", { style: { textAlign: 'center' }, children: [_jsx("h1", { style: {
137
+ fontSize: '1.5rem',
138
+ fontWeight: 'bold',
139
+ color: 'rgb(var(--color-text-primary))',
140
+ marginBottom: '0.5rem',
141
+ }, children: "Conversation not available" }), _jsx("p", { style: {
142
+ color: 'rgb(var(--color-text-secondary))',
143
+ marginBottom: '1.5rem',
144
+ }, children: "This shared conversation was not found or has expired." }), _jsx(Link, { to: "/", style: {
145
+ backgroundColor: 'rgb(var(--color-primary))',
146
+ color: 'white',
147
+ padding: '0.5rem 1rem',
148
+ borderRadius: '0.5rem',
149
+ textDecoration: 'none',
150
+ display: 'inline-block',
151
+ }, children: "Go to Home" })] }) }));
152
+ }
153
+ //# sourceMappingURL=shared.$shareId.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.$shareId.js","sourceRoot":"","sources":["../../../src/ssr/routes/shared.$shareId.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAiBjE,MAAM,CAAC,MAAM,IAAI,GAAgC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE;IAC5D,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO;YACL,EAAE,KAAK,EAAE,kBAAkB,EAAE;YAC7B,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,wCAAwC,EAAE;SAC3E,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,qBAAqB,CAAC;IAC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,KAAC,IAAI,IACH,EAAE,EAAC,GAAG,EACN,KAAK,EAAE;wBACL,eAAe,EAAE,2BAA2B;wBAC5C,KAAK,EAAE,OAAO;wBACd,OAAO,EAAE,aAAa;wBACtB,YAAY,EAAE,QAAQ;wBACtB,cAAc,EAAE,MAAM;wBACtB,OAAO,EAAE,cAAc;qBACxB,2BAGI,IACH,GACF,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,39 @@
1
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
+ import { Link, useOutletContext } from '@remix-run/react';
3
+ export const meta = ({ matches }) => {
4
+ const parentData = matches.find((m) => m.id === 'root')?.data;
5
+ const appName = parentData?.config?.app?.name || 'AI Chat';
6
+ return [
7
+ { title: `Terms of Service - ${appName}` },
8
+ { name: 'description', content: `Terms of Service for ${appName}` },
9
+ ];
10
+ };
11
+ export default function TermsPage() {
12
+ const { config } = useOutletContext();
13
+ return (_jsx("div", { style: {
14
+ minHeight: '100vh',
15
+ backgroundColor: 'rgb(var(--color-background))',
16
+ padding: '2rem 1rem',
17
+ }, children: _jsxs("div", { style: {
18
+ maxWidth: '48rem',
19
+ marginLeft: 'auto',
20
+ marginRight: 'auto',
21
+ }, children: [_jsx("div", { style: { marginBottom: '2rem' }, children: _jsxs(Link, { to: "/", style: {
22
+ fontSize: '0.875rem',
23
+ color: 'rgb(var(--color-primary))',
24
+ textDecoration: 'none',
25
+ }, children: ["\u2190 Back to ", config.app.name] }) }), _jsxs("article", { children: [_jsx("h1", { style: {
26
+ fontSize: '2rem',
27
+ fontWeight: 'bold',
28
+ color: 'rgb(var(--color-text-primary))',
29
+ marginBottom: '1.5rem',
30
+ }, children: "Terms of Service" }), _jsxs("p", { style: {
31
+ color: 'rgb(var(--color-text-muted))',
32
+ marginBottom: '2rem',
33
+ fontSize: '0.875rem',
34
+ }, children: ["Last updated: ", new Date().toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric' })] }), _jsxs("div", { className: "markdown-content", style: {
35
+ color: 'rgb(var(--color-text-secondary))',
36
+ lineHeight: 1.7,
37
+ }, children: [_jsx("h2", { style: { fontSize: '1.25rem', fontWeight: 600, marginTop: '2rem', marginBottom: '1rem', color: 'rgb(var(--color-text-primary))' }, children: "Agreement to Terms" }), _jsxs("p", { style: { marginBottom: '1rem' }, children: ["By accessing or using ", config.app.name, ", you agree to be bound by these Terms of Service. If you disagree with any part of the terms, you may not access the service."] }), _jsx("h2", { style: { fontSize: '1.25rem', fontWeight: 600, marginTop: '2rem', marginBottom: '1rem', color: 'rgb(var(--color-text-primary))' }, children: "Use of Service" }), _jsxs("p", { style: { marginBottom: '1rem' }, children: ["You agree to use ", config.app.name, " only for lawful purposes and in accordance with these Terms. You agree not to:"] }), _jsxs("ul", { style: { marginBottom: '1rem', paddingLeft: '1.5rem', listStyleType: 'disc' }, children: [_jsx("li", { style: { marginBottom: '0.5rem' }, children: "Use the service for any illegal purpose" }), _jsx("li", { style: { marginBottom: '0.5rem' }, children: "Attempt to gain unauthorized access to the service" }), _jsx("li", { style: { marginBottom: '0.5rem' }, children: "Interfere with or disrupt the service" }), _jsx("li", { style: { marginBottom: '0.5rem' }, children: "Use the service to send spam or unsolicited messages" })] }), _jsx("h2", { style: { fontSize: '1.25rem', fontWeight: 600, marginTop: '2rem', marginBottom: '1rem', color: 'rgb(var(--color-text-primary))' }, children: "User Accounts" }), _jsx("p", { style: { marginBottom: '1rem' }, children: "When you create an account, you must provide accurate and complete information. You are responsible for maintaining the security of your account and password." }), _jsx("h2", { style: { fontSize: '1.25rem', fontWeight: 600, marginTop: '2rem', marginBottom: '1rem', color: 'rgb(var(--color-text-primary))' }, children: "AI-Generated Content" }), _jsxs("p", { style: { marginBottom: '1rem' }, children: [config.app.name, " uses AI to generate responses. While we strive for accuracy, AI-generated content may contain errors or inaccuracies. You should verify important information independently."] }), _jsx("h2", { style: { fontSize: '1.25rem', fontWeight: 600, marginTop: '2rem', marginBottom: '1rem', color: 'rgb(var(--color-text-primary))' }, children: "Intellectual Property" }), _jsx("p", { style: { marginBottom: '1rem' }, children: "The service and its original content, features, and functionality are owned by us and are protected by international copyright, trademark, and other intellectual property laws." }), _jsx("h2", { style: { fontSize: '1.25rem', fontWeight: 600, marginTop: '2rem', marginBottom: '1rem', color: 'rgb(var(--color-text-primary))' }, children: "Limitation of Liability" }), _jsx("p", { style: { marginBottom: '1rem' }, children: "In no event shall we be liable for any indirect, incidental, special, consequential, or punitive damages arising out of or relating to your use of the service." }), _jsx("h2", { style: { fontSize: '1.25rem', fontWeight: 600, marginTop: '2rem', marginBottom: '1rem', color: 'rgb(var(--color-text-primary))' }, children: "Changes to Terms" }), _jsx("p", { style: { marginBottom: '1rem' }, children: "We reserve the right to modify these terms at any time. We will notify users of any material changes by posting the new Terms of Service on this page." }), _jsx("h2", { style: { fontSize: '1.25rem', fontWeight: 600, marginTop: '2rem', marginBottom: '1rem', color: 'rgb(var(--color-text-primary))' }, children: "Contact Us" }), _jsx("p", { style: { marginBottom: '1rem' }, children: "If you have any questions about these Terms of Service, please contact us." })] })] })] }) }));
38
+ }
39
+ //# sourceMappingURL=terms.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"terms.js","sourceRoot":"","sources":["../../../src/ssr/routes/terms.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAG1D,MAAM,CAAC,MAAM,IAAI,GAAiB,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE;IAChD,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,MAAM,CAAC,EAAE,IAA4D,CAAC;IACtH,MAAM,OAAO,GAAG,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,IAAI,SAAS,CAAC;IAE3D,OAAO;QACL,EAAE,KAAK,EAAE,sBAAsB,OAAO,EAAE,EAAE;QAC1C,EAAE,IAAI,EA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AAY,EAAE,MAAM,EAAE,aAC/B,MAAM,CAAC,GAAG,CAAC,IAAI,qLAEd,EAEJ,aAAI,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,gCAAgC,EAAE,sCAEhI,EACL,YAAG,KAAK,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,iMAG9B,EAEJ,aAAI,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,gCAAgC,EAAE,wCAEhI,EACL,YAAG,KAAK,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,gLAG9B,EAEJ,aAAI,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,gCAAgC,EAAE,iCAEhI,EACL,YAAG,KAAK,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,uKAG9B,EAEJ,aAAI,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,gCAAgC,EAAE,2BAEhI,EACL,YAAG,KAAK,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,2FAE9B,IACA,IACE,IACN,GACF,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,43 @@
1
+ import { DatabaseStorageProvider } from './providers/database.js';
2
+ import { FilesystemStorageProvider } from './providers/filesystem.js';
3
+ let storageProvider = null;
4
+ /**
5
+ * Get the configured storage provider
6
+ */
7
+ export function getStorageProvider(config) {
8
+ if (storageProvider) {
9
+ return storageProvider;
10
+ }
11
+ if (!config) {
12
+ // Default to database storage
13
+ storageProvider = new DatabaseStorageProvider();
14
+ return storageProvider;
15
+ }
16
+ switch (config.provider) {
17
+ case 'database':
18
+ storageProvider = new DatabaseStorageProvider();
19
+ break;
20
+ case 'filesystem':
21
+ if (!config.filesystem?.basePath) {
22
+ throw new Error('Filesystem storage requires basePath configuration');
23
+ }
24
+ storageProvider = new FilesystemStorageProvider(config.filesystem.basePath);
25
+ break;
26
+ case 's3':
27
+ // S3 storage would be implemented here
28
+ // For now, fall back to filesystem with a warning
29
+ console.warn('S3 storage not yet implemented, falling back to database storage');
30
+ storageProvider = new DatabaseStorageProvider();
31
+ break;
32
+ default:
33
+ storageProvider = new DatabaseStorageProvider();
34
+ }
35
+ return storageProvider;
36
+ }
37
+ /**
38
+ * Reset the storage provider (for testing)
39
+ */
40
+ export function resetStorageProvider() {
41
+ storageProvider = null;
42
+ }
43
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAItE,IAAI,eAAe,GAA2B,IAAI,CAAC;AAEnD;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAsB;IACvD,IAAI,eAAe,EAAE,CAAC;QACpB,OAAO,eAAe,CAAC;IACzB,CAAC;IAED,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,8BAA8B;QAC9B,eAAe,GAAG,IAAI,uBAAuB,EAAE,CAAC;QAChD,OAAO,eAAe,CAAC;IACzB,CAAC;IAED,QAAQ,MAAM,CAAC,QAAQ,EAAE,CAAC;QACxB,KAAK,UAAU;YACb,eAAe,GAAG,IAAI,uBAAuB,EAAE,CAAC;YAChD,MAAM;QAER,KAAK,YAAY;YACf,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,QAAQ,EAAE,CAAC;gBACjC,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;YACxE,CAAC;YACD,eAAe,GAAG,IAAI,yBAAyB,CAAC,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;YAC5E,MAAM;QAER,KAAK,IAAI;YACP,uCAAuC;YACvC,kDAAkD;YAClD,OAAO,CAAC,IAAI,CAAC,kEAAkE,CAAC,CAAC;YACjF,eAAe,GAAG,IAAI,uBAAuB,EAAE,CAAC;YAChD,MAAM;QAER;YACE,eAAe,GAAG,IAAI,uBAAuB,EAAE,CAAC;IACpD,CAAC;IAED,OAAO,eAAe,CAAC;AACzB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB;IAClC,eAAe,GAAG,IAAI,CAAC;AACzB,CAAC"}
@@ -0,0 +1,38 @@
1
+ import { db } from '@chaaskit/db';
2
+ /**
3
+ * Database storage provider - stores content directly in Document.content field
4
+ * Suitable for small text documents
5
+ */
6
+ export class DatabaseStorageProvider {
7
+ name = 'database';
8
+ async upload(key, content, _mimeType) {
9
+ // For database storage, the content is stored directly in the Document model
10
+ // The key is the document ID
11
+ // This is handled by the DocumentService when creating/updating documents
12
+ // This method is a no-op for database storage
13
+ const textContent = content.toString('utf-8');
14
+ await db.document.update({
15
+ where: { id: key },
16
+ data: { content: textContent },
17
+ });
18
+ }
19
+ async download(key) {
20
+ const doc = await db.document.findUnique({
21
+ where: { id: key },
22
+ select: { content: true },
23
+ });
24
+ if (!doc || !doc.content) {
25
+ throw new Error(`Document not found: ${key}`);
26
+ }
27
+ return Buffer.from(doc.content, 'utf-8');
28
+ }
29
+ async delete(key) {
30
+ // For database storage, content is deleted with the document
31
+ // This is a no-op as the Document model handles this
32
+ await db.document.update({
33
+ where: { id: key },
34
+ data: { content: null },
35
+ });
36
+ }
37
+ }
38
+ //# sourceMappingURL=database.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"database.js","sourceRoot":"","sources":["../../../src/storage/providers/database.ts"],"names":[],"mappings":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 import * as path from 'path';
3
+ /**
4
+ * Filesystem storage provider - stores files on the local filesystem
5
+ * Suitable for self-hosted deployments
6
+ */
7
+ export class FilesystemStorageProvider {
8
+ name = 'filesystem';
9
+ basePath;
10
+ constructor(basePath) {
11
+ this.basePath = basePath;
12
+ }
13
+ getFilePath(key) {
14
+ // Sanitize the key to prevent directory traversal
15
+ const sanitizedKey = key.replace(/\.\./g, '').replace(/[<>:"|?*]/g, '_');
16
+ return path.join(this.basePath, sanitizedKey);
17
+ }
18
+ async upload(key, content, _mimeType) {
19
+ const filePath = this.getFilePath(key);
20
+ const dir = path.dirname(filePath);
21
+ // Ensure directory exists
22
+ await fs.mkdir(dir, { recursive: true });
23
+ // Write file
24
+ await fs.writeFile(filePath, content);
25
+ }
26
+ async download(key) {
27
+ const filePath = this.getFilePath(key);
28
+ try {
29
+ return await fs.readFile(filePath);
30
+ }
31
+ catch (error) {
32
+ if (error.code === 'ENOENT') {
33
+ throw new Error(`File not found: ${key}`);
34
+ }
35
+ throw error;
36
+ }
37
+ }
38
+ async delete(key) {
39
+ const filePath = this.getFilePath(key);
40
+ try {
41
+ await fs.unlink(filePath);
42
+ }
43
+ catch (error) {
44
+ // Ignore if file doesn't exist
45
+ if (error.code !== 'ENOENT') {
46
+ throw error;
47
+ }
48
+ }
49
+ }
50
+ }
51
+ //# sourceMappingURL=filesystem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filesystem.js","sourceRoot":"","sources":["../../../src/storage/providers/filesystem.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAG7B;;;GAGG;AACH,MAAM,OAAO,yBAAyB;IACpC,IAAI,GAAG,YAAY,CAAC;IACZ,QAAQ,CAAS;IAEzB,YAAY,QAAgB;QAC1B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAEO,WAAW,CAAC,GAAW;QAC7B,kDAAkD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