pleasenobugs 0.2.0 → 0.3.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 (39) hide show
  1. package/README.md +108 -30
  2. package/dist/chunks/demo-CL3oK-zC.js +212 -0
  3. package/dist/chunks/index--SJW3aE-.js +2749 -0
  4. package/dist/client.js +139 -107
  5. package/dist/index.js +9 -10
  6. package/dist/pleasenobugs.iife.js +2 -2
  7. package/dist/types/client.d.ts +59 -1
  8. package/dist/types/client.d.ts.map +1 -1
  9. package/dist/types/demo.d.ts +39 -3
  10. package/dist/types/demo.d.ts.map +1 -1
  11. package/dist/types/element.d.ts +17 -12
  12. package/dist/types/element.d.ts.map +1 -1
  13. package/dist/types/filter.d.ts +66 -0
  14. package/dist/types/filter.d.ts.map +1 -0
  15. package/dist/types/i18n.d.ts +212 -526
  16. package/dist/types/i18n.d.ts.map +1 -1
  17. package/dist/types/index.d.ts +4 -3
  18. package/dist/types/index.d.ts.map +1 -1
  19. package/dist/types/readonly.d.ts +1 -1
  20. package/dist/types/readonly.d.ts.map +1 -1
  21. package/dist/types/ui/App.d.ts +4 -3
  22. package/dist/types/ui/App.d.ts.map +1 -1
  23. package/dist/types/ui/Compose.d.ts +5 -4
  24. package/dist/types/ui/Compose.d.ts.map +1 -1
  25. package/dist/types/ui/Manage.d.ts +60 -0
  26. package/dist/types/ui/Manage.d.ts.map +1 -0
  27. package/dist/types/ui/PostCard.d.ts +50 -5
  28. package/dist/types/ui/PostCard.d.ts.map +1 -1
  29. package/dist/types/ui/Sheets.d.ts +32 -28
  30. package/dist/types/ui/Sheets.d.ts.map +1 -1
  31. package/dist/types/ui/Talk.d.ts +57 -0
  32. package/dist/types/ui/Talk.d.ts.map +1 -0
  33. package/dist/types/ui/Updates.d.ts +37 -0
  34. package/dist/types/ui/Updates.d.ts.map +1 -0
  35. package/dist/types/ui/icons.d.ts +16 -0
  36. package/dist/types/ui/icons.d.ts.map +1 -1
  37. package/package.json +3 -3
  38. package/dist/chunks/demo-nnvUgJyJ.js +0 -107
  39. package/dist/chunks/index-13DToKWI.js +0 -1751
@@ -1,4 +1,4 @@
1
- import { type Answer, type AppLogin, type BoardRead, type ErrorCode, type Me, type PostContext, type PostKind, type PostStatus, type ShotType } from '@pleasenobugs/core';
1
+ import { type Answer, type AppLogin, type BoardRead, type ErrorCode, type Me, type Message, type PostContext, type PostFix, type PostKind, type PostStatus, type ShotType, type Update } from '@pleasenobugs/core';
2
2
  import { type Signer } from './signer.js';
3
3
  export { insideNimiqPay, nimiqPaySigner, SignerError, type Signer, type SignedMessage } from './signer.js';
4
4
  export { createMatcher, sortPosts } from '@pleasenobugs/core';
@@ -133,14 +133,72 @@ export declare function createClient(options: ClientOptions): {
133
133
  ok: true;
134
134
  name?: string;
135
135
  }>>;
136
+ /**
137
+ * An owner answering a post. `fix` says where the fix is, on a bug or an
138
+ * idea set to done: `{ version?, link? }`, the link on github.com or
139
+ * gitlab.com. Moving a post away from done takes its fix away by itself.
140
+ */
136
141
  manage: (id: string, change: {
137
142
  status?: PostStatus;
138
143
  reply?: string;
139
144
  hidden?: boolean;
140
145
  shotOff?: boolean;
141
146
  approved?: boolean;
147
+ fix?: PostFix | null;
148
+ }) => Promise<Result<{
149
+ ok: true;
150
+ }>>;
151
+ /**
152
+ * Write under a post: an owner for the app, whenever they like; its
153
+ * author only right after the app, on a bug or an idea that is not done
154
+ * (`not_your_turn`, `closed` otherwise). `message.id` is yours to mint.
155
+ */
156
+ say: (id: string, message: {
157
+ id: string;
158
+ text: string;
159
+ }) => Promise<Result<{
160
+ ok: true;
161
+ message: Message;
162
+ }>>;
163
+ /**
164
+ * Change your own last message before anybody answered it (`text`), or,
165
+ * as an owner, take an author's message off the board or put it back
166
+ * (`hidden`).
167
+ */
168
+ editMessage: (id: string, messageId: string, change: {
169
+ text?: string;
170
+ hidden?: boolean;
142
171
  }) => Promise<Result<{
143
172
  ok: true;
173
+ message: Message;
174
+ }>>;
175
+ /** Take your own last message back, before anybody answered it. */
176
+ unsay: (id: string, messageId: string) => Promise<Result<{
177
+ ok: true;
178
+ }>>;
179
+ /** What changed in the app, newest first. Anybody's to read; never prompts. */
180
+ updates: () => Promise<Result<{
181
+ updates: Update[];
182
+ }>>;
183
+ /**
184
+ * An owner writing one. `link` is a page on github.com or gitlab.com;
185
+ * `posts` are the bugs and ideas it fixed, which go to done with its
186
+ * version and link.
187
+ */
188
+ postUpdate: (u: {
189
+ id: string;
190
+ title: string;
191
+ text?: string;
192
+ version?: string;
193
+ link: string;
194
+ posts?: string[];
195
+ }) => Promise<Result<{
196
+ ok: true;
197
+ update: Update;
198
+ }>>;
199
+ /** An owner taking one off the page. The posts it fixed stay done. */
200
+ removeUpdate: (id: string) => Promise<Result<{
201
+ ok: true;
144
202
  }>>;
145
203
  };
146
204
  export type Client = ReturnType<typeof createClient>;
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,MAAM,EACX,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,KAAK,SAAS,EAEd,KAAK,EAAE,EACP,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,UAAU,EACf,KAAK,QAAQ,EACd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAA+C,KAAK,MAAM,EAAE,MAAM,aAAa,CAAC;AAEvF,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,WAAW,EAAE,KAAK,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAC3G,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC9D,mBAAmB,oBAAoB,CAAC;AAExC,MAAM,WAAW,aAAa;IAC5B,+DAA+D;IAC/D,MAAM,EAAE,MAAM,CAAC;IACf,6DAA6D;IAC7D,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,MAAM,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AAM,EAAE,CAAA;KAAE;YAC9F,IAAI;gBAAU,MAAM;;IACpC,sEAAsE;uBACnD,MAAM;YACT,IAAI;;EAEvB;AAED,MAAM,MAAM,MAAM,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { type MessageFrom, type PostKind, type PostStatus } from '@pleasenobugs/core';
1
2
  import type { Client } from './client.js';
2
3
  /**
3
4
  * A board that lives in this page's memory, for `<please-no-bugs demo>`.
@@ -7,11 +8,46 @@ import type { Client } from './client.js';
7
8
  * "Feedback sent!") and **nothing leaves the browser**. Nothing is stored
8
9
  * either, not even in `localStorage`, so a reload is a fresh board.
9
10
  *
10
- * The visitor is signed in from the start as an ordinary user, never an
11
- * owner: a demo should show what an app's users see.
11
+ * The visitor is signed in from the start as an ordinary user: a demo shows
12
+ * what an app's users see. With `owner` (`<please-no-bugs demo="owner">`)
13
+ * they are the app's owner instead, and the owner's side works too:
14
+ * answering, a status, "Fixed in", hiding, writing and deleting updates.
15
+ * Still nothing leaves the browser.
16
+ *
17
+ * The conversation under a post follows the server's turns: a visitor's own
18
+ * idea starts with a question from the app they can answer, and an owner
19
+ * finds a bug whose author answered and waits for them.
20
+ *
21
+ * With `samples`, the board starts with those posts instead of its own, and
22
+ * with no updates (its own updates are about its own posts): for a page that
23
+ * tells one short story, such as the website's home page tour.
12
24
  *
13
25
  * Typed as a {@link Client}, so a change to the real client that this one
14
26
  * does not follow is a type error rather than a demo that quietly lies.
15
27
  */
16
- export declare function createDemoClient(lang?: string): Client;
28
+ export declare function createDemoClient({ owner, samples }?: {
29
+ owner?: boolean;
30
+ samples?: DemoSample[];
31
+ }): Client;
32
+ /** A post a demo board starts with. Votes default to 1, and it was written an hour ago. */
33
+ export interface DemoSample {
34
+ kind: PostKind;
35
+ text: string;
36
+ votes?: number;
37
+ /** How long ago it was written, in milliseconds. */
38
+ ago?: number;
39
+ status?: PostStatus;
40
+ who?: string;
41
+ rating?: number;
42
+ /** The app's one answer. */
43
+ reply?: string;
44
+ /** A conversation instead: who said what, in order. */
45
+ thread?: [MessageFrom, string][];
46
+ /** The visitor's own, so they can answer the app under it. Never an owner's. */
47
+ mine?: boolean;
48
+ /** The version a done post was fixed in. */
49
+ fix?: string;
50
+ /** What the app sent along with it, shown to owners. */
51
+ context?: Record<string, string>;
52
+ }
17
53
  //# sourceMappingURL=demo.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"demo.d.ts","sourceRoot":"","sources":["../../src/demo.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAU,MAAM,aAAa,CAAC;AAElD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,SAAO,GAAG,MAAM,CA6FpD"}
1
+ {"version":3,"file":"demo.d.ts","sourceRoot":"","sources":["../../src/demo.ts"],"names":[],"mappings":"AAAA,OAAO,EASL,KAAK,WAAW,EAEhB,KAAK,QAAQ,EACb,KAAK,UAAU,EAEhB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,MAAM,EAAU,MAAM,aAAa,CAAC;AAElD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,KAAa,EAAE,OAAO,EAAE,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,UAAU,EAAE,CAAA;CAAO,GAAG,MAAM,CAsPrH;AAgBD,2FAA2F;AAC3F,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oDAAoD;IACpD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4BAA4B;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uDAAuD;IACvD,MAAM,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,CAAC,EAAE,CAAC;IACjC,gFAAgF;IAChF,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,4CAA4C;IAC5C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,wDAAwD;IACxD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC"}
@@ -2,6 +2,7 @@ import { type AppLogin, type PostContext, type PostKind } from '@pleasenobugs/co
2
2
  import { type Strings } from './i18n.js';
3
3
  import type { Signer } from './signer.js';
4
4
  import { type View } from './ui/App.js';
5
+ import type { DemoSample } from './demo.js';
5
6
  export declare const TAG = "please-no-bugs";
6
7
  /**
7
8
  * `<please-no-bugs>`: the whole board as one tag.
@@ -14,19 +15,23 @@ export declare const TAG = "please-no-bugs";
14
15
  * whole screen. The "paste one line and done" route.
15
16
  * - `overlay`: the board over the whole screen, now. What {@link open} uses.
16
17
  *
18
+ * Each opens on the tiles that ask what to write, with the board one tap
19
+ * under them; `start="board"` opens on the board instead.
20
+ *
17
21
  * Attributes: `project` and `server` (both required, unless `demo`), `mode`,
18
- * `lang`, `theme` (`auto` | `light` | `dark` | `pleasenobugs` | `nimiq`), `accent`
19
- * (a colour), `app-name`, `name` (a display name to suggest), `kinds` (which
22
+ * `start` (`tiles` or `board`), `theme` (`nimiq`, the default, or `nimiq-dark`),
23
+ * `lang` (the language of your `strings`, for dates; English by default), `app-name`, `name` (a display name to suggest), `kinds` (which
20
24
  * of `bug,idea,review` to offer), `screenshots` (`owners` to keep them off
21
25
  * the board, for the app's owners only; `off` to leave them out), `names`
22
26
  * (`off` leaves out "Show my name", so every post is anonymous),
23
27
  * `readonly` (the board to scroll through and nothing else: see
24
28
  * `readonly.ts`), `demo` (sample posts in the page's memory, no server: see
25
- * `demo.ts`) and, with `demo` only, `screen` (`button`, `tiles`, `board`,
26
- * `write` or `sent`: that screen, held, for the website's configurator).
29
+ * `demo.ts`; `demo="owner"` is the owner's side of it) and, with `demo` only, `screen` (`button`, `tiles`, `board`,
30
+ * `write`, `sent` or `updates`: that screen, held, for the website's
31
+ * Make it yours).
27
32
  *
28
33
  * Properties, for things an attribute cannot carry: `signer`, `appLogin`,
29
- * `context`, `noise`, `strings`.
34
+ * `context`, `noise`, `strings` and, with `demo`, `samples`.
30
35
  *
31
36
  * Events: `pleasenobugs:posted` (`detail: { id, kind }`) and
32
37
  * `pleasenobugs:close`.
@@ -54,9 +59,15 @@ export declare class PleaseNoBugsElement extends HTMLElement {
54
59
  /** Words common in your app, so "said already?" ignores them: `['nim', 'wallet']`. */
55
60
  get noise(): string[] | undefined;
56
61
  set noise(v: string[] | undefined);
57
- /** Override any string, or supply a language: `{ 'board.title': 'Ideas box' }`. */
62
+ /** Override any string, or put the whole board in your app's language: `{ 'board.title': 'Ideas box' }`. */
58
63
  get strings(): Strings | undefined;
59
64
  set strings(v: Strings | undefined);
65
+ /**
66
+ * With `demo` only: the posts the demo board starts with, instead of its
67
+ * own, and no updates: `[{ kind: 'idea', text: 'Pin my contacts', votes: 12 }]`.
68
+ */
69
+ get samples(): DemoSample[] | undefined;
70
+ set samples(v: DemoSample[] | undefined);
60
71
  connectedCallback(): void;
61
72
  disconnectedCallback(): void;
62
73
  attributeChangedCallback(name: string): void;
@@ -82,12 +93,6 @@ export declare function readScreen(v: string | null): Screen | undefined;
82
93
  * readKinds('bug, review') // → ['bug', 'review']
83
94
  */
84
95
  export declare function readKinds(v: string | null): PostKind[] | undefined;
85
- /**
86
- * Black or white, whichever reads better on `color`. So `accent="#ffd400"`
87
- * gets dark text and `accent="#1f2348"` gets white, without the developer
88
- * having to know there was a question.
89
- */
90
- export declare function readableOn(color: string): string;
91
96
  /** Register the element once, however many times the script is loaded. */
92
97
  export declare function define(): void;
93
98
  declare global {
@@ -1 +1 @@
1
- {"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../../src/element.tsx"],"names":[],"mappings":"AAEA,O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AAG,IAAI,GAAG,SAAS,EAK1C;IAED,0EAA0E;IAC1E,IAAI,OAAO,IAGI,WAAW,GAAG,SAAS,CADrC;IACD,IAAI,OAAO,CAAC,CAAC,EAAE,WAAW,GAAG,SAAS,EAGrC;IAED,sFAAsF;IACtF,IAAI,KAAK,IAGI,MAAM,EAAE,GAAG,SAAS,CADhC;IACD,IAAI,KAAK,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,EAGhC;IAED,4GAA4G;IAC5G,IAAI,OAAO,IAGI,OAAO,GAAG,SAAS,CADjC;IACD,IAAI,OAAO,CAAC,CAAC,EAAE,OAAO,GAAG,SAAS,EAGjC;IAED;;;OAGG;IACH,IAAI,OAAO,IAGI,UAAU,EAAE,GAAG,SAAS,CADtC;IACD,IAAI,OAAO,CAAC,CAAC,EAAE,UAAU,EAAE,GAAG,SAAS,EAKtC;IAED,iBAAiB;IAYjB,oBAAoB;IAIpB,wBAAwB,CAAC,IAAI,EAAE,MAAM;IAKrC,2DAA2D;IAC3D,KAAK;CA4FN;AAID,oFAAoF;AACpF,KAAK,MAAM,GAAG,QAAQ,GAAG,IAAI,CAAC;AAE9B;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,SAAS,CAU/D;AAkOD;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,QAAQ,EAAE,GAAG,SAAS,CAMlE;AAED,0EAA0E;AAC1E,wBAAgB,MAAM,SAIrB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,gBAAgB,EAAE,mBAAmB,CAAC;KACvC;CACF"}
@@ -0,0 +1,66 @@
1
+ import { type Message, type Post, type PostKind, type PostStatus } from '@pleasenobugs/core';
2
+ /** What only an owner can narrow the board to. */
3
+ export type OwnFilter = 'waiting' | 'hidden' | 'pending';
4
+ /**
5
+ * What the Filter panel narrows the board to. Inside a group any choice
6
+ * matches (Bugs and Ideas shows both); between groups every one has to
7
+ * (Bugs and Planned shows planned bugs). An empty group is no filter.
8
+ */
9
+ export interface BoardFilter {
10
+ kinds: PostKind[];
11
+ statuses: PostStatus[];
12
+ /** Only what you wrote yourself. */
13
+ mine: boolean;
14
+ /** Owners only. */
15
+ own: OwnFilter[];
16
+ }
17
+ export declare const NO_FILTER: BoardFilter;
18
+ /** How many filters are on, for the number on the Filter button. */
19
+ export declare function filtersOn(f: BoardFilter): number;
20
+ /**
21
+ * Whether a post passes the filter. A review has no status, so choosing a
22
+ * status leaves reviews out rather than pretending they are all open.
23
+ */
24
+ export declare function matchesFilter(p: Post, f: BoardFilter): boolean;
25
+ /** The words of a search, lower case, in the order typed. */
26
+ export declare function searchWords(query: string): string[];
27
+ /** Where a search found a post: its own text, or a message in the conversation under it. */
28
+ export type Found = {
29
+ in: 'text';
30
+ } | {
31
+ in: 'thread';
32
+ message: Message;
33
+ };
34
+ /**
35
+ * Whether a post matches a search, and where: every word has to be in it,
36
+ * anywhere in the post or its conversation, so "pixel camera" finds the bug
37
+ * about the camera whose author said "Pixel 7" when asked.
38
+ *
39
+ * Plain substrings, no ranking: a board is a list in the tens or hundreds,
40
+ * read top to bottom, and a search that hides how it decided is one people
41
+ * stop trusting.
42
+ *
43
+ * @example
44
+ * findIn({ text: 'Camera opens black', thread: [{ text: 'A Pixel 7', … }] }, 'pixel')
45
+ * // → { in: 'thread', message: { text: 'A Pixel 7', … } }
46
+ */
47
+ export declare function findIn(p: Post, query: string): Found | null;
48
+ /**
49
+ * A bit of a long text around the first word searched for, so a card can
50
+ * show why it matched without the whole message.
51
+ *
52
+ * @example
53
+ * snippet('Only on my old Samsung. My new phone is fine.', 'phone', 24) // → '…My new phone is fine.'
54
+ */
55
+ export declare function snippet(text: string, query: string, max?: number): string;
56
+ /**
57
+ * A text cut where the searched words are, so each can be marked.
58
+ *
59
+ * @example
60
+ * marks('My Pixel 6', 'pixel') // → [{ text: 'My ', hit: false }, { text: 'Pixel', hit: true }, { text: ' 6', hit: false }]
61
+ */
62
+ export declare function marks(text: string, query: string): {
63
+ text: string;
64
+ hit: boolean;
65
+ }[];
66
+ //# sourceMappingURL=filter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../src/filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6B,KAAK,OAAO,EAAE,KAAK,IAAI,EAAE,KAAK,QAAQ,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAExH,kDAAkD;AAClD,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEzD;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,QAAQ,EAAE,UAAU,EAAE,CAAC;IACvB,oCAAoC;IACpC,IAAI,EAAE,OAAO,CAAC;IACd,mBAAmB;IACnB,GAAG,EAAE,SAAS,EAAE,CAAC;CAClB;AAED,eAAO,MAAM,SAAS,EAAE,WAA6F,CAAC;AAEtH,oEAAoE;AACpE,wBAAgB,SAAS,CAAC,CAAC,EAAE,WAAW,GAAG,MAAM,CAEhD;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,WAAW,GAAG,OAAO,CAW9D;AAED,6DAA6D;AAC7D,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAEnD;AAED,4FAA4F;AAC5F,MAAM,MAAM,KAAK,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,QAAQ,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC;AAExE;;;;;;;;;;;;GAYG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,KAAK,GAAG,IAAI,CAW3D;AAED;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