qrdx 0.0.60 → 0.0.61

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 (46) hide show
  1. package/README.md +1 -1
  2. package/dist/core.js +7 -7
  3. package/dist/core.js.map +1 -1
  4. package/dist/core.mjs +7 -7
  5. package/dist/core.mjs.map +1 -1
  6. package/dist/index.js +7 -7
  7. package/dist/index.js.map +1 -1
  8. package/dist/index.mjs +7 -7
  9. package/dist/index.mjs.map +1 -1
  10. package/dist/node.js +2 -2
  11. package/dist/node.js.map +1 -1
  12. package/dist/node.mjs +2 -2
  13. package/dist/node.mjs.map +1 -1
  14. package/dist/qr-code-canvas.js +1 -1
  15. package/dist/qr-code-canvas.js.map +1 -1
  16. package/dist/qr-code-canvas.mjs +1 -1
  17. package/dist/qr-code-canvas.mjs.map +1 -1
  18. package/dist/src/api.d.ts +2 -3
  19. package/dist/src/api.d.ts.map +1 -1
  20. package/dist/src/qr-code-canvas.d.ts +2 -8
  21. package/dist/src/qr-code-canvas.d.ts.map +1 -1
  22. package/dist/src/qr-code-svg.d.ts +2 -3
  23. package/dist/src/qr-code-svg.d.ts.map +1 -1
  24. package/dist/src/qr-code.d.ts +2 -2
  25. package/dist/src/qr-code.d.ts.map +1 -1
  26. package/dist/src/qr-frame-svg.d.ts +2 -3
  27. package/dist/src/qr-frame-svg.d.ts.map +1 -1
  28. package/dist/src/rasterize.d.ts +8 -0
  29. package/dist/src/rasterize.d.ts.map +1 -1
  30. package/dist/src/react-elements.d.ts.map +1 -1
  31. package/dist/src/scan-score.d.ts +34 -0
  32. package/dist/src/scan-score.d.ts.map +1 -1
  33. package/dist/types/react.d.ts +21 -3
  34. package/dist/types/react.d.ts.map +1 -1
  35. package/dist/vanilla.browser.mjs +12 -12
  36. package/dist/vanilla.browser.mjs.map +1 -1
  37. package/package.json +4 -6
  38. package/src/api.tsx +3 -4
  39. package/src/qr-code-canvas.tsx +34 -27
  40. package/src/qr-code-svg.tsx +3 -4
  41. package/src/qr-code.tsx +7 -5
  42. package/src/qr-frame-svg.tsx +3 -4
  43. package/src/rasterize.ts +14 -1
  44. package/src/react-elements.ts +40 -2
  45. package/src/scan-score.ts +220 -47
  46. package/types/react.ts +22 -3
package/dist/src/api.d.ts CHANGED
@@ -1,9 +1,8 @@
1
- import type { JSX } from "react";
2
- import type { QRPropsSVG } from "../types/react";
1
+ import type { QRPropsSVG, ReactQRElement } from "../types/react";
3
2
  /**
4
3
  * The plain code as a React element: one path for the dark modules on a
5
4
  * background rect, plus the logo and frame (`getQRAsSVGNode` is the same
6
5
  * without React). A logo that isn't a data URL is fetched as base64 first.
7
6
  */
8
- export declare function getQRAsSVG(props: QRPropsSVG): Promise<JSX.Element>;
7
+ export declare function getQRAsSVG(props: QRPropsSVG): Promise<ReactQRElement>;
9
8
  //# sourceMappingURL=api.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/api.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAKjD;;;;GAIG;AACH,wBAAsB,UAAU,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAKxE"}
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/api.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAKjE;;;;GAIG;AACH,wBAAsB,UAAU,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,cAAc,CAAC,CAK3E"}
@@ -2,12 +2,6 @@
2
2
  /** biome-ignore-all lint/correctness/useImageSize: false positive */
3
3
  /** biome-ignore-all lint/performance/noImgElement: false positive */
4
4
  /** biome-ignore-all lint/a11y/noNoninteractiveElementInteractions: hidden loader image */
5
- /**
6
- * @license qrcode.react
7
- * Copyright (c) Paul O'Shannessy
8
- * SPDX-License-Identifier: ISC
9
- */
10
- import { type JSX } from "react";
11
- import type { QRPropsCanvas } from "../types/react";
12
- export declare function QRCodeCanvas(props: QRPropsCanvas): JSX.Element;
5
+ import type { QRPropsCanvas, ReactQRElement } from "../types/react";
6
+ export declare function QRCodeCanvas(props: QRPropsCanvas): ReactQRElement;
13
7
  //# sourceMappingURL=qr-code-canvas.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"qr-code-canvas.d.ts","sourceRoot":"","sources":["../../src/qr-code-canvas.tsx"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,qEAAqE;AACrE,qEAAqE;AACrE,0FAA0F;AAI1F;;;;GAIG;AACH,OAAO,EAAE,KAAK,GAAG,EAA+B,MAAM,OAAO,CAAC;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAwBpD,wBAAgB,YAAY,CAAC,KAAK,EAAE,aAAa,eAiOhD"}
1
+ {"version":3,"file":"qr-code-canvas.d.ts","sourceRoot":"","sources":["../../src/qr-code-canvas.tsx"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,qEAAqE;AACrE,qEAAqE;AACrE,0FAA0F;AAmB1F,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAwBpE,wBAAgB,YAAY,CAAC,KAAK,EAAE,aAAa,GAAG,cAAc,CA+NjE"}
@@ -1,10 +1,9 @@
1
- import type { JSX } from "react";
2
- import type { QRPropsSVG } from "../types/react";
1
+ import type { QRPropsSVG, ReactQRElement } from "../types/react";
3
2
  /**
4
3
  * The core renderer as a React component: every styling option is supported.
5
4
  * It draws with `createQRCodeTree`, building React elements directly, so its
6
5
  * markup is exactly `toSVGString`'s. No hooks: it renders in React Server
7
6
  * Components too.
8
7
  */
9
- export declare function QRCodeSVG(props: QRPropsSVG): JSX.Element;
8
+ export declare function QRCodeSVG(props: QRPropsSVG): ReactQRElement;
10
9
  //# sourceMappingURL=qr-code-svg.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"qr-code-svg.d.ts","sourceRoot":"","sources":["../../src/qr-code-svg.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAKjD;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,UAAU,GAAG,GAAG,CAAC,OAAO,CAIxD"}
1
+ {"version":3,"file":"qr-code-svg.d.ts","sourceRoot":"","sources":["../../src/qr-code-svg.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAKjE;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,UAAU,GAAG,cAAc,CAI3D"}
@@ -1,8 +1,8 @@
1
- import type { QRCodePropsSVG } from "../types/react";
1
+ import type { QRCodePropsSVG, ReactQRElement } from "../types/react";
2
2
  /**
3
3
  * `QRCodeSVG` with the simpler logo API (`logo`, `logoOptions`, `hideLogo`,
4
4
  * `scale`). Any other prop (`className`, `aria-label`, `role`, `data-*`…)
5
5
  * goes on the `<svg>`, as with `QRCodeSVG`.
6
6
  */
7
- export declare const QRCode: import("react").MemoExoticComponent<(props: QRCodePropsSVG) => import("react").JSX.Element>;
7
+ export declare const QRCode: import("react").MemoExoticComponent<(props: QRCodePropsSVG) => ReactQRElement>;
8
8
  //# sourceMappingURL=qr-code.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"qr-code.d.ts","sourceRoot":"","sources":["../../src/qr-code.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAQrD;;;;GAIG;AACH,eAAO,MAAM,MAAM,8CAAgB,cAAc,iCAQ/C,CAAC"}
1
+ {"version":3,"file":"qr-code.d.ts","sourceRoot":"","sources":["../../src/qr-code.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAQrE;;;;GAIG;AACH,eAAO,MAAM,MAAM,8CAAgB,cAAc,KAAG,cAAc,CAQhE,CAAC"}
@@ -1,10 +1,9 @@
1
- import type { JSX } from "react";
2
- import type { QRFrameSVGProps } from "../types/react";
1
+ import type { QRFrameSVGProps, ReactQRElement } from "../types/react";
3
2
  /**
4
3
  * A frame on its own, as a React component: `createFrameTree` drawn with
5
4
  * React's elements, so its markup is the core's. The code's slot holds
6
5
  * `slot` (a React element, placed and sized as the code would be) or is
7
6
  * left empty. No hooks: it renders in React Server Components too.
8
7
  */
9
- export declare function QRFrameSVG({ frame, size, bgColor, slot, ...svgProps }: QRFrameSVGProps): JSX.Element;
8
+ export declare function QRFrameSVG({ frame, size, bgColor, slot, ...svgProps }: QRFrameSVGProps): ReactQRElement;
10
9
  //# sourceMappingURL=qr-frame-svg.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"qr-frame-svg.d.ts","sourceRoot":"","sources":["../../src/qr-frame-svg.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAKtD;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,IAAI,EACJ,OAAO,EACP,IAAI,EACJ,GAAG,QAAQ,EACZ,EAAE,eAAe,GAAG,GAAG,CAAC,OAAO,CAO/B"}
1
+ {"version":3,"file":"qr-frame-svg.d.ts","sourceRoot":"","sources":["../../src/qr-frame-svg.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAKtE;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,IAAI,EACJ,OAAO,EACP,IAAI,EACJ,GAAG,QAAQ,EACZ,EAAE,eAAe,GAAG,cAAc,CAOlC"}
@@ -22,4 +22,12 @@ export declare function loadLogoForRasterizer(src: string, loadExternal?: boolea
22
22
  * neither is installed the error names what to install.
23
23
  */
24
24
  export declare function rasterizeSvgToPng(svg: string, logo: RasterLogo | null): Promise<Uint8Array>;
25
+ /**
26
+ * Whether drawing `svg` can need a font: it has text (a frame's label) or
27
+ * embeds an SVG image (a logo, which may have text of its own). resvg reads
28
+ * every system font each time it's created when asked to (about 50 ms on a
29
+ * Mac, the most of a plain code's render), and nothing else in a code needs
30
+ * them.
31
+ */
32
+ export declare function svgNeedsFonts(svg: string): boolean;
25
33
  //# sourceMappingURL=rasterize.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rasterize.d.ts","sourceRoot":"","sources":["../../src/rasterize.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAa3E,sFAAsF;AACtF,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,UAAU,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB;AAyFD;;;;;;;;;GASG;AACH,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,MAAM,EACX,YAAY,UAAQ,GACnB,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAiE5B;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,UAAU,GAAG,IAAI,GACtB,OAAO,CAAC,UAAU,CAAC,CAYrB"}
1
+ {"version":3,"file":"rasterize.d.ts","sourceRoot":"","sources":["../../src/rasterize.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAa3E,sFAAsF;AACtF,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,UAAU,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB;AAyFD;;;;;;;;;GASG;AACH,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,MAAM,EACX,YAAY,UAAQ,GACnB,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAiE5B;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,UAAU,GAAG,IAAI,GACtB,OAAO,CAAC,UAAU,CAAC,CAcrB;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAElD"}
@@ -1 +1 @@
1
- {"version":3,"file":"react-elements.d.ts","sourceRoot":"","sources":["../../src/react-elements.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEpD,eAAO,MAAM,cAAc,EAAE,cAM5B,CAAC"}
1
+ {"version":3,"file":"react-elements.d.ts","sourceRoot":"","sources":["../../src/react-elements.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAuCpD,eAAO,MAAM,cAAc,EAAE,cAM5B,CAAC"}
@@ -105,6 +105,40 @@ export declare function getScanContrast(props: QRProps, options?: {
105
105
  * This is a heuristic: real cameras, lighting and scanner apps vary.
106
106
  */
107
107
  export declare function getScanScore(props: QRProps, options?: ScanScoreOptions): Promise<ScanScoreResult>;
108
+ /**
109
+ * One frame `getScanScore` decodes: the artwork on white with the code
110
+ * `codeWidth` px wide, before the camera model.
111
+ */
112
+ export interface ScanFrame {
113
+ codeWidth: number;
114
+ width: number;
115
+ height: number;
116
+ /** RGBA bytes, `width × height × 4` */
117
+ data: Uint8ClampedArray;
118
+ }
119
+ export interface ScanFrames {
120
+ /** The test sizes, smallest first */
121
+ sizes: number[];
122
+ /** Every frame the score may decode, smallest code first */
123
+ frames: ScanFrame[];
124
+ /** Tones of the images the design paints with, for the contrast checks */
125
+ imageTones: ImageToneMap;
126
+ }
127
+ /**
128
+ * The frames `getScanScore` decodes, drawn on the page's canvas (browser
129
+ * only), for `getScanScoreFromFrames` to score somewhere else, such as a Web
130
+ * Worker: drawing is quick native work, and the camera model and decoding
131
+ * are what keep the page busy. It can be posted as it is (transfer each
132
+ * frame's `data.buffer` to skip the copy).
133
+ */
134
+ export declare function drawScanFrames(props: QRProps, options?: ScanScoreOptions): Promise<ScanFrames>;
135
+ /**
136
+ * `getScanScore`'s result from the frames `drawScanFrames` drew for the same
137
+ * props. Needs no DOM, so it runs in a Web Worker. The frames aren't changed
138
+ * (each is copied before the camera model blurs it), so they can be scored
139
+ * again.
140
+ */
141
+ export declare function getScanScoreFromFrames(props: QRProps, scan: ScanFrames, options?: Pick<ScanScoreOptions, "signal">): Promise<ScanScoreResult>;
108
142
  /**
109
143
  * Smallest code width (px) the artwork passed to `getScanScoreFromPixels`
110
144
  * should have: twice the largest default test size, so every test size is a
@@ -1 +1 @@
1
- {"version":3,"file":"scan-score.d.ts","sourceRoot":"","sources":["../../src/scan-score.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAe,OAAO,EAAE,MAAM,UAAU,CAAC;AAGrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAyBzC,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,IAAI,GAAG,OAAO,GAAG,OAAO,CAAC;AAE3D,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,+EAA+E;IAC/E,MAAM,EAAE,OAAO,CAAC;IAChB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,gCAAgC;IAChC,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,eAAe;IAC9B,YAAY;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,SAAS,CAAC;IACjB,MAAM,EAAE,SAAS,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,oBAAqB,SAAQ,eAAe;IAC3D,yDAAyD;IACzD,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,uDAAuD;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,QAAQ,CAAM,GAC7C,OAAO,CAAC,eAAe,CAAC,CAuB1B;AAyDD;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,MAAc,CAAC;AAEtD;;;;;;;;;;GAUG;AACH,wBAAsB,sBAAsB,CAC1C,KAAK,EAAE,OAAO,EACd,MAAM,EAAE,WAAW,EACnB,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CAAC,eAAe,CAAC,CAqB1B;AAwGD;;;;GAIG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,gBAAgB,GAAG,IAAI,EAC/B,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CAAC,oBAAoB,CAAC,CAyS/B;AAID,MAAM,WAAW,eAAe;IAC9B,4EAA4E;IAC5E,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,qDAAqD;IACrD,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB;;;OAGG;IACH,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,uEAAuE;AACvE,eAAO,MAAM,gBAAgB,gBAAiB,CAAC;AAuF/C;;;;;;GAMG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,WAAW,EACnB,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAAO,GAC1C,OAAO,CAAC,eAAe,CAAC,CA8C1B"}
@@ -1,14 +1,31 @@
1
- import type { CanvasHTMLAttributes, ReactElement, SVGProps } from "react";
1
+ import type { CanvasHTMLAttributes, ReactElement, Ref, SVGProps } from "react";
2
2
  import type { FrameTreeOptions } from "../src/frame";
3
3
  import type { QRCodeProps } from "../src/qr-code-props";
4
4
  import type { QRProps } from "./qr";
5
+ /**
6
+ * What the React components return: `ReactElement<any, any>`, the type that
7
+ * React 18 and 19's types call `JSX.Element`. It's spelled out because the
8
+ * `react` module of @types/react 16 and 17 has no `JSX` to import.
9
+ */
10
+ export type ReactQRElement = ReactElement<any, any>;
11
+ /**
12
+ * React's attributes for the `<svg>`, with `ref` a ref object or callback.
13
+ * @types/react 16 to 18 also allow a string there (a legacy string ref,
14
+ * which React never took on a function component), and with it a typed set
15
+ * of these props didn't type-check when spread into `QRCode`, a memo
16
+ * component, under those versions' types. React 19's types are the same
17
+ * either way.
18
+ */
19
+ type SVGRootProps = Omit<SVGProps<SVGSVGElement>, "ref"> & {
20
+ ref?: Ref<SVGSVGElement>;
21
+ };
5
22
  export type QRPropsCanvas = QRProps & CanvasHTMLAttributes<HTMLCanvasElement>;
6
- export type QRPropsSVG = QRProps & SVGProps<SVGSVGElement>;
23
+ export type QRPropsSVG = QRProps & SVGRootProps;
7
24
  /**
8
25
  * React's `QRCode` props: `QRCodeProps` (the logo API included) plus the
9
26
  * SVG attributes, which go on the `<svg>` as with `QRCodeSVG`.
10
27
  */
11
- export type QRCodePropsSVG = QRCodeProps & SVGProps<SVGSVGElement>;
28
+ export type QRCodePropsSVG = QRCodeProps & SVGRootProps;
12
29
  /**
13
30
  * `QRFrameSVG`'s props: the frame, the code size it's laid out around and
14
31
  * the code's background, an optional element for the code's slot, and SVG
@@ -17,4 +34,5 @@ export type QRCodePropsSVG = QRCodeProps & SVGProps<SVGSVGElement>;
17
34
  export type QRFrameSVGProps = Omit<FrameTreeOptions, "slot" | "svgProps"> & {
18
35
  slot?: ReactElement;
19
36
  } & Omit<SVGProps<SVGSVGElement>, "children" | "slot">;
37
+ export {};
20
38
  //# sourceMappingURL=react.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../types/react.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC1E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM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