@sealpixel/vue 1.0.0-rc.2 → 1.0.0-rc.20

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.
package/LICENSE.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  **Licensor:** nine feet UG (haftungsbeschränkt), Germany (https://9feet.io)
6
6
 
7
- **Licensed Work:** Sealpixel, in every version the Licensor publishes: the source code, the npm packages under the `@sealpixel` scope and the unscoped `sealpixel` package, the Rust crates, the WebAssembly binaries, the documentation and the example projects. The Licensed Work is (c) 2026 nine feet UG (haftungsbeschränkt).
7
+ **Licensed Work:** Sealpixel, in every version the Licensor publishes: the source code, the npm packages under the `@sealpixel` scope and the unscoped `sealpixel` package, the Rust crates, the WebAssembly binaries, the documentation and the example projects, except the package `@sealpixel/c2pa-sign` and the crate `sealpixel-c2pa-sign`, which are licensed under the Business Source License 1.1 with their own parameters in `packages/c2pa-sign/LICENSE.md`. The Licensed Work is (c) 2026 nine feet UG (haftungsbeschränkt).
8
8
 
9
9
  **Additional Use Grant:** You may make production use of the Licensed Work if you are a Small User. You are a Small User if you are a natural person acting for yourself, or if the organization you act for had less than EUR 1,000,000 of gross revenue in its most recent completed financial year. Revenue is counted across the whole group: the organization, everything that controls it, everything it controls, and everything under common control with it. Where the work is done for a client, the client's revenue decides.
10
10
 
@@ -16,7 +16,7 @@ This Additional Use Grant does not permit offering the Licensed Work, or a work
16
16
 
17
17
  For information about alternative licensing arrangements for the Licensed Work, please visit: https://sealpixel.dev/pricing
18
18
 
19
- Organizations, and anyone who develops with the Licensed Work for an organization, obtain the commercial license this License refers to as developer seats under the Sealpixel Developer Seat License (`LICENSE-COMMERCIAL.md`).
19
+ Organizations, and anyone who develops with the Licensed Work for an organization, obtain the commercial license this License refers to as developer seats under the Sealpixel Developer Seat License, published at https://sealpixel.dev/license#seats and as `LICENSE-COMMERCIAL.md` in the source repository.
20
20
 
21
21
  ## Notice
22
22
 
package/dist/index.d.ts CHANGED
@@ -2,6 +2,7 @@ import type { PluginOptionsMap } from '@sealpixel/core';
2
2
  import { type EditorSession, type ExportResult, type SealpixelError, type SessionOptions, type SessionState, type SourceDescriptor } from '@sealpixel/core';
3
3
  import '@sealpixel/element';
4
4
  import type { AnyPlugin, AssetResolver, OutputOptions, Renderer } from '@sealpixel/core';
5
+ import type { SealpixelEditor as SealpixelEditorElement } from '@sealpixel/element';
5
6
  import { type App, type PropType, type ShallowRef } from 'vue';
6
7
  export type { EditorSession, SessionOptions, SessionState } from '@sealpixel/core';
7
8
  export interface EditLogState {
@@ -46,8 +47,8 @@ export declare const SealpixelEditor: import("vue").DefineComponent<import("vue"
46
47
  type: PropType<EditorSession | null>;
47
48
  default: null;
48
49
  };
49
- server: {
50
- type: PropType<SessionOptions["server"] | null>;
50
+ limits: {
51
+ type: PropType<SessionOptions["limits"] | null>;
51
52
  default: null;
52
53
  };
53
54
  output: {
@@ -88,9 +89,15 @@ export declare const SealpixelEditor: import("vue").DefineComponent<import("vue"
88
89
  type: PropType<string | null>;
89
90
  default: null;
90
91
  };
91
- }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
92
- [key: string]: any;
93
- }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
92
+ }>, {
93
+ element: ShallowRef<SealpixelEditorElement | null, SealpixelEditorElement | null>;
94
+ getSession: () => EditorSession | undefined;
95
+ getEditLog: () => ReturnType<EditorSession["getEditLog"]> | undefined;
96
+ undo: () => void;
97
+ redo: () => void;
98
+ export: (output?: OutputOptions) => Promise<ExportResult> | undefined;
99
+ download: (options?: Parameters<SealpixelEditorElement["download"]>[0]) => ReturnType<SealpixelEditorElement["download"]> | undefined;
100
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
94
101
  'update:editLog': (_state: EditLogState) => true;
95
102
  change: (_state: EditLogState) => true;
96
103
  process: (_result: ExportResult) => true;
@@ -130,8 +137,8 @@ export declare const SealpixelEditor: import("vue").DefineComponent<import("vue"
130
137
  type: PropType<EditorSession | null>;
131
138
  default: null;
132
139
  };
133
- server: {
134
- type: PropType<SessionOptions["server"] | null>;
140
+ limits: {
141
+ type: PropType<SessionOptions["limits"] | null>;
135
142
  default: null;
136
143
  };
137
144
  output: {
@@ -180,10 +187,9 @@ export declare const SealpixelEditor: import("vue").DefineComponent<import("vue"
180
187
  onReady?: () => any;
181
188
  onLoad?: (_descriptor: SourceDescriptor) => any;
182
189
  }>, {
183
- server: {
184
- endpoint: string;
185
- fetch?: typeof fetch;
186
- headers?: Record<string, string>;
190
+ limits: {
191
+ maxClientMegapixels?: number;
192
+ maxClientBytes?: number;
187
193
  } | null | undefined;
188
194
  src: string | File | Blob | Uint8Array<ArrayBufferLike> | null;
189
195
  editLog: EditLogState | null;
@@ -202,7 +208,7 @@ export declare const SealpixelEditor: import("vue").DefineComponent<import("vue"
202
208
  locale: string;
203
209
  dictionary: Record<string, string> | null;
204
210
  activeTool: string | null;
205
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
211
+ }, {}, {}, {}, "element" | "getSession" | "getEditLog" | "undo" | "redo" | "export" | "download", import("vue").ComponentProvideOptions, true, {}, any>;
206
212
  /** Headless composable: a session whose state is a shallow ref, disposed with the scope. */
207
213
  export declare function useSealpixel(options: SessionOptions): {
208
214
  session: EditorSession;
@@ -212,4 +218,3 @@ export declare function useSealpixel(options: SessionOptions): {
212
218
  export declare const Sealpixel: {
213
219
  install(app: App): void;
214
220
  };
215
- //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -20,7 +20,7 @@ export const SealpixelEditor = defineComponent({
20
20
  renderer: { type: Object, default: null },
21
21
  assets: { type: Object, default: null },
22
22
  session: { type: Object, default: null },
23
- server: { type: Object, default: null },
23
+ limits: { type: Object, default: null },
24
24
  output: { type: Object, default: () => ({ format: 'image/png' }) },
25
25
  theme: { type: String, default: 'dark' },
26
26
  showExport: { type: String, default: 'auto' },
@@ -39,48 +39,61 @@ export const SealpixelEditor = defineComponent({
39
39
  ready: () => true,
40
40
  load: (_descriptor) => true,
41
41
  },
42
- setup(props, { emit, expose }) {
43
- const el = shallowRef(null);
44
- expose({
45
- element: el,
46
- getSession: () => el.value?.getSession(),
47
- getEditLog: () => el.value?.getEditLog(),
48
- undo: () => el.value?.undo(),
49
- redo: () => el.value?.redo(),
50
- export: (output) => el.value?.export(output),
51
- download: (options) => el.value?.download(options),
52
- });
53
- return () => h('sealpixel-editor', {
54
- ref: el,
55
- theme: props.theme,
56
- 'show-export': props.showExport,
57
- 'show-download': props.showDownload,
58
- 'show-history': props.showHistory,
59
- 'download-label': props.downloadLabel ?? undefined,
60
- '.src': props.src,
61
- '.editLog': props.editLog,
62
- '.defaultEditLog': props.defaultEditLog,
63
- '.plugins': props.plugins,
64
- '.pluginOptions': props.pluginOptions,
65
- '.renderer': props.renderer,
66
- '.assets': props.assets,
67
- '.session': props.session,
68
- '.server': props.server,
69
- '.output': props.output,
70
- '.locale': props.locale,
71
- '.dictionary': props.dictionary,
72
- '.activeTool': props.activeTool,
42
+ // The `expose` option, unlike an `expose()` call, types the template ref.
43
+ expose: ['element', 'getSession', 'getEditLog', 'undo', 'redo', 'export', 'download'],
44
+ setup() {
45
+ const element = shallowRef(null);
46
+ return {
47
+ element,
48
+ getSession: () => element.value?.getSession(),
49
+ getEditLog: () => element.value?.getEditLog(),
50
+ undo: () => element.value?.undo(),
51
+ redo: () => element.value?.redo(),
52
+ export: (output) => element.value?.export(output),
53
+ download: (options) => element.value?.download(options),
54
+ };
55
+ },
56
+ render() {
57
+ // The element shows Export in `auto` mode while a `sealpixel:process`
58
+ // listener exists, so listen only when the parent listens to `process`.
59
+ const parent = this.$.vnode.props;
60
+ const listensToProcess = Boolean(parent?.onProcess || parent?.onProcessOnce);
61
+ return h('sealpixel-editor', {
62
+ ref: 'element',
63
+ theme: this.theme,
64
+ 'show-export': this.showExport,
65
+ 'show-download': this.showDownload,
66
+ 'show-history': this.showHistory,
67
+ 'download-label': this.downloadLabel ?? undefined,
68
+ '.src': this.src,
69
+ '.editLog': this.editLog,
70
+ '.defaultEditLog': this.defaultEditLog,
71
+ '.plugins': this.plugins,
72
+ '.pluginOptions': this.pluginOptions,
73
+ '.renderer': this.renderer,
74
+ '.assets': this.assets,
75
+ '.session': this.session,
76
+ '.limits': this.limits,
77
+ '.output': this.output,
78
+ '.locale': this.locale,
79
+ '.dictionary': this.dictionary,
80
+ '.activeTool': this.activeTool,
73
81
  'onSealpixel:change': (e) => {
74
- emit('update:editLog', e.detail);
75
- emit('change', e.detail);
82
+ this.$emit('update:editLog', e.detail);
83
+ this.$emit('change', e.detail);
76
84
  },
77
- 'onSealpixel:process': (e) => emit('process', e.detail),
78
- 'onSealpixel:error': (e) => emit('error', e.detail),
79
- 'onSealpixel:ready': () => emit('ready'),
80
- 'onSealpixel:load': (e) => emit('load', e.detail),
85
+ ...(listensToProcess
86
+ ? {
87
+ 'onSealpixel:process': (e) => this.$emit('process', e.detail),
88
+ }
89
+ : {}),
90
+ 'onSealpixel:error': (e) => this.$emit('error', e.detail),
91
+ 'onSealpixel:ready': () => this.$emit('ready'),
92
+ 'onSealpixel:load': (e) => this.$emit('load', e.detail),
81
93
  });
82
94
  },
83
95
  });
96
+ // #region headless
84
97
  /** Headless composable: a session whose state is a shallow ref, disposed with the scope. */
85
98
  export function useSealpixel(options) {
86
99
  const session = createEditorSession(options);
@@ -94,6 +107,7 @@ export function useSealpixel(options) {
94
107
  });
95
108
  return { session, state };
96
109
  }
110
+ // #endregion headless
97
111
  /** `app.use(Sealpixel)` registers `<SealpixelEditor>` globally. */
98
112
  export const Sealpixel = {
99
113
  install(app) {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,mBAAmB,GAOpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,oBAAoB,CAAC;AAG5B,OAAO,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AC,CAA4B,EAAE,EAAE,CACtD,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC;iBAClC;gBACH,CAAC,CAAC,EAAE,CAAC;YACP,mBAAmB,EAAE,CAAC,CAA8B,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC;YACtF,mBAAmB,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;YAC9C,kBAAkB,EAAE,CAAC,CAAgC,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;SACvF,CAAC,CAAC;IACL,CAAC;CACF,CAAC,CAAC;AAEH,mBAAmB;AACnB,4FAA4F;AAC5F,MAAM,UAAU,YAAY,CAAC,OAAuB;IAIlD,MAAM,OAAO,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAC;IAC7C,MAAM,KAAK,GAAG,UAAU,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC7C,MAAM,WAAW,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE;QAC1C,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;IACH,cAAc,CAAC,GAAG,EAAE;QAClB,WAAW,EAAE,CAAC;QACd,OAAO,CAAC,OAAO,EAAE,CAAC;IACpB,CAAC,CAAC,CAAC;IACH,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;AAC5B,CAAC;AACD,sBAAsB;AAEtB,mEAAmE;AACnE,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,OAAO,CAAC,GAAQ;QACd,GAAG,CAAC,SAAS,CAAC,iBAAiB,EAAE,eAAe,CAAC,CAAC;IACpD,CAAC;CACF,CAAC","sourcesContent":["import type { PluginOptionsMap } from '@sealpixel/core';\nimport {\n createEditorSession,\n type EditorSession,\n type ExportResult,\n type SealpixelError,\n type SessionOptions,\n type SessionState,\n type SourceDescriptor,\n} from '@sealpixel/core';\nimport '@sealpixel/element';\nimport type { AnyPlugin, AssetResolver, OutputOptions, Renderer } from '@sealpixel/core';\nimport type { SealpixelEditor as SealpixelEditorElement } from '@sealpixel/element';\nimport {\n type App,\n defineComponent,\n h,\n onScopeDispose,\n type PropType,\n type ShallowRef,\n shallowRef,\n} from 'vue';\n\nexport type { EditorSession, SessionOptions, SessionState } from '@sealpixel/core';\n\nexport interface EditLogState {\n log: unknown;\n index: number;\n}\n\n/**\n * `<SealpixelEditor>` for Vue 3. `v-model:editLog` gives controlled mode; without\n * it the editor owns the log and emits `change`. Add `sealpixel-editor` to your\n * compiler's `isCustomElement` when you also use the raw tag in templates.\n */\nexport const SealpixelEditor = defineComponent({\n name: 'SealpixelEditor',\n props: {\n src: {\n type: [Object, String] as PropType<File | Blob | Uint8Array | string | null>,\n default: null,\n },\n editLog: { type: Object as PropType<EditLogState | null>, default: undefined },\n defaultEditLog: { type: Object as PropType<EditLogState | null>, default: undefined },\n plugins: { type: Array as PropType<readonly AnyPlugin[] | null>, default: null },\n pluginOptions: { type: Object as PropType<PluginOptionsMap | null>, default: null },\n renderer: { type: Object as PropType<Renderer | null>, default: null },\n assets: { type: Object as PropType<AssetResolver | null>, default: null },\n session: { type: Object as PropType<EditorSession | null>, default: null },\n limits: { type: Object as PropType<SessionOptions['limits'] | null>, default: null },\n output: { type: Object as PropType<OutputOptions>, default: () => ({ format: 'image/png' }) },\n theme: { type: String as PropType<'dark' | 'light' | 'auto'>, default: 'dark' },\n showExport: { type: String as PropType<'auto' | 'always' | 'never'>, default: 'auto' },\n showDownload: { type: String as PropType<'always' | 'never'>, default: 'always' },\n showHistory: { type: String as PropType<'all' | 'buttons' | 'none'>, default: 'all' },\n downloadLabel: { type: String as PropType<string | null>, default: null },\n locale: { type: String, default: 'en' },\n dictionary: { type: Object as PropType<Record<string, string> | null>, default: null },\n activeTool: { type: String as PropType<string | null>, default: null },\n },\n emits: {\n 'update:editLog': (_state: EditLogState) => true,\n change: (_state: EditLogState) => true,\n process: (_result: ExportResult) => true,\n error: (_error: SealpixelError) => true,\n ready: () => true,\n load: (_descriptor: SourceDescriptor) => true,\n },\n // The `expose` option, unlike an `expose()` call, types the template ref.\n expose: ['element', 'getSession', 'getEditLog', 'undo', 'redo', 'export', 'download'],\n setup() {\n const element = shallowRef<SealpixelEditorElement | null>(null);\n return {\n element,\n getSession: (): EditorSession | undefined => element.value?.getSession(),\n getEditLog: (): ReturnType<EditorSession['getEditLog']> | undefined =>\n element.value?.getEditLog(),\n undo: (): void => element.value?.undo(),\n redo: (): void => element.value?.redo(),\n export: (output?: OutputOptions): Promise<ExportResult> | undefined =>\n element.value?.export(output),\n download: (\n options?: Parameters<SealpixelEditorElement['download']>[0],\n ): ReturnType<SealpixelEditorElement['download']> | undefined =>\n element.value?.download(options),\n };\n },\n render() {\n // The element shows Export in `auto` mode while a `sealpixel:process`\n // listener exists, so listen only when the parent listens to `process`.\n const parent = this.$.vnode.props as { onProcess?: unknown; onProcessOnce?: unknown } | null;\n const listensToProcess = Boolean(parent?.onProcess || parent?.onProcessOnce);\n return h('sealpixel-editor', {\n ref: 'element',\n theme: this.theme,\n 'show-export': this.showExport,\n 'show-download': this.showDownload,\n 'show-history': this.showHistory,\n 'download-label': this.downloadLabel ?? undefined,\n '.src': this.src,\n '.editLog': this.editLog,\n '.defaultEditLog': this.defaultEditLog,\n '.plugins': this.plugins,\n '.pluginOptions': this.pluginOptions,\n '.renderer': this.renderer,\n '.assets': this.assets,\n '.session': this.session,\n '.limits': this.limits,\n '.output': this.output,\n '.locale': this.locale,\n '.dictionary': this.dictionary,\n '.activeTool': this.activeTool,\n 'onSealpixel:change': (e: CustomEvent<EditLogState>) => {\n this.$emit('update:editLog', e.detail);\n this.$emit('change', e.detail);\n },\n ...(listensToProcess\n ? {\n 'onSealpixel:process': (e: CustomEvent<ExportResult>) =>\n this.$emit('process', e.detail),\n }\n : {}),\n 'onSealpixel:error': (e: CustomEvent<SealpixelError>) => this.$emit('error', e.detail),\n 'onSealpixel:ready': () => this.$emit('ready'),\n 'onSealpixel:load': (e: CustomEvent<SourceDescriptor>) => this.$emit('load', e.detail),\n });\n },\n});\n\n// #region headless\n/** Headless composable: a session whose state is a shallow ref, disposed with the scope. */\nexport function useSealpixel(options: SessionOptions): {\n session: EditorSession;\n state: ShallowRef<SessionState>;\n} {\n const session = createEditorSession(options);\n const state = shallowRef(session.getState());\n const unsubscribe = session.subscribe((s) => {\n state.value = s;\n });\n onScopeDispose(() => {\n unsubscribe();\n session.dispose();\n });\n return { session, state };\n}\n// #endregion headless\n\n/** `app.use(Sealpixel)` registers `<SealpixelEditor>` globally. */\nexport const Sealpixel = {\n install(app: App) {\n app.component('SealpixelEditor', SealpixelEditor);\n },\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sealpixel/vue",
3
- "version": "1.0.0-rc.2",
3
+ "version": "1.0.0-rc.20",
4
4
  "description": "Vue 3 bindings for the Sealpixel image editor: <SealpixelEditor> with v-model:editLog and the useSealpixel composable.",
5
5
  "license": "BUSL-1.1",
6
6
  "repository": {
@@ -24,21 +24,24 @@
24
24
  "./package.json": "./package.json"
25
25
  },
26
26
  "dependencies": {
27
- "@sealpixel/core": "1.0.0-rc.2",
28
- "@sealpixel/ui": "1.0.0-rc.2",
29
- "@sealpixel/element": "1.0.0-rc.2"
27
+ "@sealpixel/core": "1.0.0-rc.20",
28
+ "@sealpixel/element": "1.0.0-rc.20",
29
+ "@sealpixel/ui": "1.0.0-rc.20"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "vue": "^3.4.0"
33
33
  },
34
34
  "devDependencies": {
35
+ "@sealpixel/config": "0.0.0",
35
36
  "@types/node": "^24.0.0",
36
- "typescript": "^5.9.0",
37
- "vue": "^3.5.0",
38
- "@sealpixel/config": "0.0.0"
37
+ "happy-dom": "^20.0.0",
38
+ "typescript": "^6.0.0",
39
+ "vitest": "^5.0.0",
40
+ "vue": "^3.5.0"
39
41
  },
40
42
  "scripts": {
41
43
  "build": "tsc -p tsconfig.build.json",
42
- "typecheck": "tsc -p tsconfig.json --noEmit"
44
+ "typecheck": "tsc -p tsconfig.json --noEmit",
45
+ "test": "vitest run"
43
46
  }
44
47
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAEL,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEzF,OAAO,EACL,KAAK,GAAG,EAIR,KAAK,QAAQ,EACb,KAAK,UAAU,EAEhB,MAAM,KAAK,CAAC;AAEb,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEnF,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,OAAO,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe;;cAII,QAAQ,CAAC,IAAI,GAAG,IAAI,GAAG,UAAU,GAAG,MAAM,GAAG,IAAI,CAAC;;;;cAGnD,QAAQ,CAAC,YAAY,GAAG,IAAI,CAAC;;;;cACtB,QAAQ,CAAC,YAAY,GAAG,IAAI,CAAC;;;;cACrC,QAAQ,CAAC,SAAS,SAAS,EAAE,GAAG,IAAI,CAAC;;;;cAC9B,QAAQ,CAAC,gBAAgB,GAAG,IAAI,CAAC;;;;cACtC,QAAQ,CAAC,QAAQ,GAAG,IAAI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