cauthy-auth 0.5.1 → 0.8.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 (72) hide show
  1. package/README.md +68 -3
  2. package/dist/{cauthy-BCTCqubt.d.ts → cauthy-Bn3iv50y.d.ts} +1 -1
  3. package/dist/{cauthy-hswMoS7B.d.mts → cauthy-C29HCvag.d.mts} +1 -1
  4. package/dist/cli.js +492 -25
  5. package/dist/client.d.mts +236 -0
  6. package/dist/client.d.ts +236 -0
  7. package/dist/client.js +331 -0
  8. package/dist/client.js.map +1 -0
  9. package/dist/client.mjs +297 -0
  10. package/dist/client.mjs.map +1 -0
  11. package/dist/express.d.mts +24 -0
  12. package/dist/express.d.ts +24 -0
  13. package/dist/express.js +102 -0
  14. package/dist/express.js.map +1 -0
  15. package/dist/express.mjs +76 -0
  16. package/dist/express.mjs.map +1 -0
  17. package/dist/fastify.d.mts +2 -2
  18. package/dist/fastify.d.ts +2 -2
  19. package/dist/fastify.js +3 -1
  20. package/dist/fastify.js.map +1 -1
  21. package/dist/fastify.mjs +3 -1
  22. package/dist/fastify.mjs.map +1 -1
  23. package/dist/hono.d.mts +23 -0
  24. package/dist/hono.d.ts +23 -0
  25. package/dist/hono.js +50 -0
  26. package/dist/hono.js.map +1 -0
  27. package/dist/hono.mjs +24 -0
  28. package/dist/hono.mjs.map +1 -0
  29. package/dist/index.d.mts +44 -6
  30. package/dist/index.d.ts +44 -6
  31. package/dist/index.js +672 -37
  32. package/dist/index.js.map +1 -1
  33. package/dist/index.mjs +660 -37
  34. package/dist/index.mjs.map +1 -1
  35. package/dist/next.d.mts +24 -0
  36. package/dist/next.d.ts +24 -0
  37. package/dist/next.js +77 -0
  38. package/dist/next.js.map +1 -0
  39. package/dist/next.mjs +52 -0
  40. package/dist/next.mjs.map +1 -0
  41. package/dist/react.d.mts +546 -7
  42. package/dist/react.d.ts +546 -7
  43. package/dist/react.js +925 -14
  44. package/dist/react.js.map +1 -1
  45. package/dist/react.mjs +913 -10
  46. package/dist/react.mjs.map +1 -1
  47. package/dist/styles.css +271 -0
  48. package/dist/svelte.d.mts +26 -0
  49. package/dist/svelte.d.ts +26 -0
  50. package/dist/svelte.js +402 -0
  51. package/dist/svelte.js.map +1 -0
  52. package/dist/svelte.mjs +373 -0
  53. package/dist/svelte.mjs.map +1 -0
  54. package/dist/{system-DvcQjORr.d.ts → system-DhRr_WxR.d.ts} +139 -1
  55. package/dist/{system-CR8p4BjB.d.mts → system-ZD_Wa8Bm.d.mts} +139 -1
  56. package/dist/theme.d.mts +59 -1
  57. package/dist/theme.d.ts +59 -1
  58. package/dist/theme.js +185 -5
  59. package/dist/theme.js.map +1 -1
  60. package/dist/theme.mjs +180 -4
  61. package/dist/theme.mjs.map +1 -1
  62. package/dist/validate-B_iC-4y8.d.mts +19 -0
  63. package/dist/validate-B_iC-4y8.d.ts +19 -0
  64. package/dist/vue.d.mts +28 -0
  65. package/dist/vue.d.ts +28 -0
  66. package/dist/vue.js +420 -0
  67. package/dist/vue.js.map +1 -0
  68. package/dist/vue.mjs +391 -0
  69. package/dist/vue.mjs.map +1 -0
  70. package/package.json +68 -7
  71. package/dist/permissions-B-a3eN0h.d.mts +0 -52
  72. package/dist/permissions-B-a3eN0h.d.ts +0 -52
@@ -0,0 +1,24 @@
1
+ import { C as Cauthy } from './cauthy-C29HCvag.mjs';
2
+ import { S as Session } from './system-ZD_Wa8Bm.mjs';
3
+ import 'jose';
4
+ import './theme.mjs';
5
+
6
+ interface CauthyMiddlewareOptions {
7
+ /** The pages only a signed-in person may see: anybody else is sent to sign in, and back. */
8
+ protect?: (pathname: string) => boolean;
9
+ }
10
+ interface CauthyNext {
11
+ GET(request: Request): Promise<Response>;
12
+ POST(request: Request): Promise<Response>;
13
+ /**
14
+ * Who is signed in, or null: in a server component, a route handler or a
15
+ * server action. A server component cannot set a cookie, so renewing an
16
+ * expired session is the middleware's job: use `middleware()`.
17
+ */
18
+ session(): Promise<Session | null>;
19
+ /** For `middleware.ts`: renews the session when it has to be, and guards the pages named in `protect`. */
20
+ middleware(options?: CauthyMiddlewareOptions): (request: Request) => Promise<Response>;
21
+ }
22
+ declare function cauthyNext(auth: Cauthy): CauthyNext;
23
+
24
+ export { type CauthyMiddlewareOptions, type CauthyNext, cauthyNext };
package/dist/next.d.ts ADDED
@@ -0,0 +1,24 @@
1
+ import { C as Cauthy } from './cauthy-Bn3iv50y.js';
2
+ import { S as Session } from './system-DhRr_WxR.js';
3
+ import 'jose';
4
+ import './theme.js';
5
+
6
+ interface CauthyMiddlewareOptions {
7
+ /** The pages only a signed-in person may see: anybody else is sent to sign in, and back. */
8
+ protect?: (pathname: string) => boolean;
9
+ }
10
+ interface CauthyNext {
11
+ GET(request: Request): Promise<Response>;
12
+ POST(request: Request): Promise<Response>;
13
+ /**
14
+ * Who is signed in, or null: in a server component, a route handler or a
15
+ * server action. A server component cannot set a cookie, so renewing an
16
+ * expired session is the middleware's job: use `middleware()`.
17
+ */
18
+ session(): Promise<Session | null>;
19
+ /** For `middleware.ts`: renews the session when it has to be, and guards the pages named in `protect`. */
20
+ middleware(options?: CauthyMiddlewareOptions): (request: Request) => Promise<Response>;
21
+ }
22
+ declare function cauthyNext(auth: Cauthy): CauthyNext;
23
+
24
+ export { type CauthyMiddlewareOptions, type CauthyNext, cauthyNext };
package/dist/next.js ADDED
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/next.ts
21
+ var next_exports = {};
22
+ __export(next_exports, {
23
+ cauthyNext: () => cauthyNext
24
+ });
25
+ module.exports = __toCommonJS(next_exports);
26
+ var import_headers = require("next/headers");
27
+ var import_server = require("next/server");
28
+ function cookiesAfter(header, setCookies) {
29
+ const jar = /* @__PURE__ */ new Map();
30
+ for (const part of (header ?? "").split(";")) {
31
+ const i = part.indexOf("=");
32
+ if (i > 0) jar.set(part.slice(0, i).trim(), part.slice(i + 1).trim());
33
+ }
34
+ for (const c of setCookies) {
35
+ const [pair, ...attrs] = c.split("; ");
36
+ const i = pair.indexOf("=");
37
+ if (i <= 0) continue;
38
+ if (pair.slice(i + 1) === "" || attrs.some((a) => a.toLowerCase() === "max-age=0")) jar.delete(pair.slice(0, i));
39
+ else jar.set(pair.slice(0, i), pair.slice(i + 1));
40
+ }
41
+ return [...jar].map(([k, v]) => `${k}=${v}`).join("; ");
42
+ }
43
+ function cauthyNext(auth) {
44
+ const base = auth.options.basePath;
45
+ return {
46
+ GET: (request) => auth.handler(request),
47
+ POST: (request) => auth.handler(request),
48
+ async session() {
49
+ const h = await (0, import_headers.headers)();
50
+ const origin = `${h.get("x-forwarded-proto") ?? "http"}://${h.get("x-forwarded-host") ?? h.get("host") ?? "localhost"}`;
51
+ return auth.getSession(new Request(`${origin}/`, { headers: new Headers(h) }));
52
+ },
53
+ middleware(options = {}) {
54
+ return async (request) => {
55
+ const url = new URL(request.url);
56
+ if (url.pathname === base || url.pathname.startsWith(`${base}/`)) return import_server.NextResponse.next();
57
+ const resolved = await auth.resolve(request);
58
+ if (resolved.session === null && options.protect?.(url.pathname)) {
59
+ const to = import_server.NextResponse.redirect(new URL(auth.urls.signIn(url.pathname + url.search), url));
60
+ for (const c of resolved.cookies) to.headers.append("set-cookie", c);
61
+ return to;
62
+ }
63
+ if (resolved.cookies.length === 0) return import_server.NextResponse.next();
64
+ const forwarded = new Headers(request.headers);
65
+ forwarded.set("cookie", cookiesAfter(request.headers.get("cookie"), resolved.cookies));
66
+ const on = import_server.NextResponse.next({ request: { headers: forwarded } });
67
+ for (const c of resolved.cookies) on.headers.append("set-cookie", c);
68
+ return on;
69
+ };
70
+ }
71
+ };
72
+ }
73
+ // Annotate the CommonJS export names for ESM import in node:
74
+ 0 && (module.exports = {
75
+ cauthyNext
76
+ });
77
+ //# sourceMappingURL=next.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/next.ts"],"sourcesContent":["// Next.js (App Router): the routes, who is signed in on the server, and a\n// middleware that keeps the session renewed.\n//\n// // lib/auth.ts\n// export const auth = createCauthy()\n// export const cauthy = cauthyNext(auth)\n//\n// // app/api/auth/[...cauthy]/route.ts\n// export const { GET, POST } = cauthy\n//\n// // middleware.ts\n// export default cauthy.middleware({ protect: (path) => path.startsWith('/app') })\n//\n// // a server component, a route handler, a server action\n// const session = await cauthy.session()\n\nimport { headers } from 'next/headers'\nimport { NextResponse } from 'next/server'\nimport type { Cauthy } from './cauthy'\nimport type { Session } from './types'\n\nexport interface CauthyMiddlewareOptions {\n /** The pages only a signed-in person may see: anybody else is sent to sign in, and back. */\n protect?: (pathname: string) => boolean\n}\n\nexport interface CauthyNext {\n GET(request: Request): Promise<Response>\n POST(request: Request): Promise<Response>\n /**\n * Who is signed in, or null: in a server component, a route handler or a\n * server action. A server component cannot set a cookie, so renewing an\n * expired session is the middleware's job: use `middleware()`.\n */\n session(): Promise<Session | null>\n /** For `middleware.ts`: renews the session when it has to be, and guards the pages named in `protect`. */\n middleware(options?: CauthyMiddlewareOptions): (request: Request) => Promise<Response>\n}\n\n/** The request's cookies with the ones a response sets applied, as the browser's next request would carry them. */\nfunction cookiesAfter(header: string | null, setCookies: string[]): string {\n const jar = new Map<string, string>()\n for (const part of (header ?? '').split(';')) {\n const i = part.indexOf('=')\n if (i > 0) jar.set(part.slice(0, i).trim(), part.slice(i + 1).trim())\n }\n for (const c of setCookies) {\n const [pair, ...attrs] = c.split('; ')\n const i = pair.indexOf('=')\n if (i <= 0) continue\n if (pair.slice(i + 1) === '' || attrs.some((a) => a.toLowerCase() === 'max-age=0')) jar.delete(pair.slice(0, i))\n else jar.set(pair.slice(0, i), pair.slice(i + 1))\n }\n return [...jar].map(([k, v]) => `${k}=${v}`).join('; ')\n}\n\nexport function cauthyNext(auth: Cauthy): CauthyNext {\n const base = auth.options.basePath\n return {\n GET: (request) => auth.handler(request),\n POST: (request) => auth.handler(request),\n\n async session() {\n const h = await headers()\n const origin = `${h.get('x-forwarded-proto') ?? 'http'}://${h.get('x-forwarded-host') ?? h.get('host') ?? 'localhost'}`\n return auth.getSession(new Request(`${origin}/`, { headers: new Headers(h) }))\n },\n\n middleware(options = {}) {\n return async (request) => {\n const url = new URL(request.url)\n // The routes renew and clear the session themselves.\n if (url.pathname === base || url.pathname.startsWith(`${base}/`)) return NextResponse.next()\n\n const resolved = await auth.resolve(request)\n if (resolved.session === null && options.protect?.(url.pathname)) {\n const to = NextResponse.redirect(new URL(auth.urls.signIn(url.pathname + url.search), url))\n for (const c of resolved.cookies) to.headers.append('set-cookie', c)\n return to\n }\n if (resolved.cookies.length === 0) return NextResponse.next()\n\n // Renewed: the browser gets the new cookie, and so does what renders\n // this very request, which would otherwise still read the old one.\n const forwarded = new Headers(request.headers)\n forwarded.set('cookie', cookiesAfter(request.headers.get('cookie'), resolved.cookies))\n const on = NextResponse.next({ request: { headers: forwarded } })\n for (const c of resolved.cookies) on.headers.append('set-cookie', c)\n return on\n }\n },\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBA,qBAAwB;AACxB,oBAA6B;AAuB7B,SAAS,aAAa,QAAuB,YAA8B;AACzE,QAAM,MAAM,oBAAI,IAAoB;AACpC,aAAW,SAAS,UAAU,IAAI,MAAM,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AAM,IAAI,IAAI,QAAQ,GAAG;AAE/B,YAAI,IAAI,aAAa,QAAQ,IAAI,SAAS,WAAW,GAAG,IAAI,GAAG,EAAG,QAAO,2BAAa,KAAK;AAE3F,cAAM,WAAW,MAAM,KAAK,QAAQ,OAAO;AAC3C,YAAI,SAAS,YAAY,QAAQ,QAAQ,UAAU,IAAI,QAAQ,GAAG;AAChE,gBAAM,KAAK,2BAAa,SAAS,IAAI,IAAI,KAAK,KAAK,OAAO,IAAI,WAAW,IAAI,MAAM,GAAG,GAAG,CAAC;AAC1F,qBAAW,KAAK,SAAS,QAAS,IAAG,QAAQ,OAAO,cAAc,CAAC;AACnE,iBAAO;AAAA,QACT;AACA,YAAI,SAAS,QAAQ,WAAW,EAAG,QAAO,2BAAa,KAAK;AAI5D,cAAM,YAAY,IAAI,QAAQ,QAAQ,OAAO;AAC7C,kBAAU,IAAI,UAAU,aAAa,QAAQ,QAAQ,IAAI,QAAQ,GAAG,SAAS,OAAO,CAAC;AACrF,cAAM,KAAK,2BAAa,KAAK,EAAE,SAAS,EAAE,SAAS,UAAU,EAAE,CAAC;AAChE,mBAAW,KAAK,SAAS,QAAS,IAAG,QAAQ,OAAO,cAAc,CAAC;AACnE,eAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
package/dist/next.mjs ADDED
@@ -0,0 +1,52 @@
1
+ // src/next.ts
2
+ import { headers } from "next/headers";
3
+ import { NextResponse } from "next/server";
4
+ function cookiesAfter(header, setCookies) {
5
+ const jar = /* @__PURE__ */ new Map();
6
+ for (const part of (header ?? "").split(";")) {
7
+ const i = part.indexOf("=");
8
+ if (i > 0) jar.set(part.slice(0, i).trim(), part.slice(i + 1).trim());
9
+ }
10
+ for (const c of setCookies) {
11
+ const [pair, ...attrs] = c.split("; ");
12
+ const i = pair.indexOf("=");
13
+ if (i <= 0) continue;
14
+ if (pair.slice(i + 1) === "" || attrs.some((a) => a.toLowerCase() === "max-age=0")) jar.delete(pair.slice(0, i));
15
+ else jar.set(pair.slice(0, i), pair.slice(i + 1));
16
+ }
17
+ return [...jar].map(([k, v]) => `${k}=${v}`).join("; ");
18
+ }
19
+ function cauthyNext(auth) {
20
+ const base = auth.options.basePath;
21
+ return {
22
+ GET: (request) => auth.handler(request),
23
+ POST: (request) => auth.handler(request),
24
+ async session() {
25
+ const h = await headers();
26
+ const origin = `${h.get("x-forwarded-proto") ?? "http"}://${h.get("x-forwarded-host") ?? h.get("host") ?? "localhost"}`;
27
+ return auth.getSession(new Request(`${origin}/`, { headers: new Headers(h) }));
28
+ },
29
+ middleware(options = {}) {
30
+ return async (request) => {
31
+ const url = new URL(request.url);
32
+ if (url.pathname === base || url.pathname.startsWith(`${base}/`)) return NextResponse.next();
33
+ const resolved = await auth.resolve(request);
34
+ if (resolved.session === null && options.protect?.(url.pathname)) {
35
+ const to = NextResponse.redirect(new URL(auth.urls.signIn(url.pathname + url.search), url));
36
+ for (const c of resolved.cookies) to.headers.append("set-cookie", c);
37
+ return to;
38
+ }
39
+ if (resolved.cookies.length === 0) return NextResponse.next();
40
+ const forwarded = new Headers(request.headers);
41
+ forwarded.set("cookie", cookiesAfter(request.headers.get("cookie"), resolved.cookies));
42
+ const on = NextResponse.next({ request: { headers: forwarded } });
43
+ for (const c of resolved.cookies) on.headers.append("set-cookie", c);
44
+ return on;
45
+ };
46
+ }
47
+ };
48
+ }
49
+ export {
50
+ cauthyNext
51
+ };
52
+ //# sourceMappingURL=next.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/next.ts"],"sourcesContent":["// Next.js (App Router): the routes, who is signed in on the server, and a\n// middleware that keeps the session renewed.\n//\n// // lib/auth.ts\n// export const auth = createCauthy()\n// export const cauthy = cauthyNext(auth)\n//\n// // app/api/auth/[...cauthy]/route.ts\n// export const { GET, POST } = cauthy\n//\n// // middleware.ts\n// export default cauthy.middleware({ protect: (path) => path.startsWith('/app') })\n//\n// // a server component, a route handler, a server action\n// const session = await cauthy.session()\n\nimport { headers } from 'next/headers'\nimport { NextResponse } from 'next/server'\nimport type { Cauthy } from './cauthy'\nimport type { Session } from './types'\n\nexport interface CauthyMiddlewareOptions {\n /** The pages only a signed-in person may see: anybody else is sent to sign in, and back. */\n protect?: (pathname: string) => boolean\n}\n\nexport interface CauthyNext {\n GET(request: Request): Promise<Response>\n POST(request: Request): Promise<Response>\n /**\n * Who is signed in, or null: in a server component, a route handler or a\n * server action. A server component cannot set a cookie, so renewing an\n * expired session is the middleware's job: use `middleware()`.\n */\n session(): Promise<Session | null>\n /** For `middleware.ts`: renews the session when it has to be, and guards the pages named in `protect`. */\n middleware(options?: CauthyMiddlewareOptions): (request: Request) => Promise<Response>\n}\n\n/** The request's cookies with the ones a response sets applied, as the browser's next request would carry them. */\nfunction cookiesAfter(header: string | null, setCookies: string[]): string {\n const jar = new Map<string, string>()\n for (const part of (header ?? '').split(';')) {\n const i = part.indexOf('=')\n if (i > 0) jar.set(part.slice(0, i).trim(), part.slice(i + 1).trim())\n }\n for (const c of setCookies) {\n const [pair, ...attrs] = c.split('; ')\n const i = pair.indexOf('=')\n if (i <= 0) continue\n if (pair.slice(i + 1) === '' || attrs.some((a) => a.toLowerCase() === 'max-age=0')) jar.delete(pair.slice(0, i))\n else jar.set(pair.slice(0, i), pair.slice(i + 1))\n }\n return [...jar].map(([k, v]) => `${k}=${v}`).join('; ')\n}\n\nexport function cauthyNext(auth: Cauthy): CauthyNext {\n const base = auth.options.basePath\n return {\n GET: (request) => auth.handler(request),\n POST: (request) => auth.handler(request),\n\n async session() {\n const h = await headers()\n const origin = `${h.get('x-forwarded-proto') ?? 'http'}://${h.get('x-forwarded-host') ?? h.get('host') ?? 'localhost'}`\n return auth.getSession(new Request(`${origin}/`, { headers: new Headers(h) }))\n },\n\n middleware(options = {}) {\n return async (request) => {\n const url = new URL(request.url)\n // The routes renew and clear the session themselves.\n if (url.pathname === base || url.pathname.startsWith(`${base}/`)) return NextResponse.next()\n\n const resolved = await auth.resolve(request)\n if (resolved.session === null && options.protect?.(url.pathname)) {\n const to = NextResponse.redirect(new URL(auth.urls.signIn(url.pathname + url.search), url))\n for (const c of resolved.cookies) to.headers.append('set-cookie', c)\n return to\n }\n if (resolved.cookies.length === 0) return NextResponse.next()\n\n // Renewed: the browser gets the new cookie, and so does what renders\n // this very request, which would otherwise still read the old one.\n const forwarded = new Headers(request.headers)\n forwarded.set('cookie', cookiesAfter(request.headers.get('cookie'), resolved.cookies))\n const on = NextResponse.next({ request: { headers: forwarded } })\n for (const c of resolved.cookies) on.headers.append('set-cookie', c)\n return on\n }\n },\n }\n}\n"],"mappings":";AAgBA,SAAS,eAAe;AACxB,SAAS,oBAAoB;AAuB7B,SAAS,aAAa,QAAuB,YAA8B;AACzE,QAAM,MAAM,oBAAI,IAAoB;AACpC,aAAW,SAAS,UAAU,IAAI,MAAM,GAAG,GAAG;AAC5C,UAAM,IAAI,KAAK,QAAQ,GAAG;AAC1B,QAAI,IAAI,EAAG,KAAI,IAAI,KAAK,MAAM,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,MAAM,IAAI,CAAC,EAAE,KAAK,CAAC;AAAA,EACtE;AACA,aAAW,KAAK,YAAY;AAC1B,UAAM,CAAC,MAAM,GAAG,KAAK,IAAI,EAAE,MAAM,IAAI;AACrC,UAAM,IAAI,KAAK,QAAQ,GAAG;AAC1B,QAAI,KAAK,EAAG;AACZ,QAAI,KAAK,MAAM,IAAI,CAAC,MAAM,MAAM,MAAM,KAAK,CAAC,MAAM,EAAE,YAAY,MAAM,WAAW,EAAG,KAAI,OAAO,KAAK,MAAM,GAAG,CAAC,CAAC;AAAA,QAC1G,KAAI,IAAI,KAAK,MAAM,GAAG,CAAC,GAAG,KAAK,MAAM,IAAI,CAAC,CAAC;AAAA,EAClD;AACA,SAAO,CAAC,GAAG,GAAG,EAAE,IAAI,CAAC,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,IAAI;AACxD;AAEO,SAAS,WAAW,MAA0B;A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