angular-three 2.0.0-beta.4 → 2.0.0-beta.40
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/README.md +4 -147
- package/esm2022/angular-three.mjs +1 -1
- package/esm2022/index.mjs +10 -11
- package/esm2022/lib/before-render.mjs +13 -0
- package/esm2022/lib/canvas.mjs +137 -161
- package/esm2022/lib/directives/args.mjs +13 -11
- package/esm2022/lib/directives/common.mjs +28 -27
- package/esm2022/lib/directives/key.mjs +29 -0
- package/esm2022/lib/directives/parent.mjs +13 -11
- package/esm2022/lib/dom/events.mjs +6 -1
- package/esm2022/lib/events.mjs +77 -60
- package/esm2022/lib/instance.mjs +65 -0
- package/esm2022/lib/loader.mjs +35 -41
- package/esm2022/lib/loop.mjs +6 -3
- package/esm2022/lib/portal.mjs +103 -112
- package/esm2022/lib/ref.mjs +48 -0
- package/esm2022/lib/renderer/catalogue.mjs +7 -0
- package/esm2022/lib/renderer/constants.mjs +21 -0
- package/esm2022/lib/renderer/index.mjs +419 -0
- package/esm2022/lib/renderer/store.mjs +148 -112
- package/esm2022/lib/renderer/utils.mjs +63 -48
- package/esm2022/lib/roots.mjs +249 -0
- package/esm2022/lib/routed-scene.mjs +11 -8
- package/esm2022/lib/store.mjs +207 -0
- package/esm2022/lib/three-types.mjs +2 -2
- package/esm2022/lib/types.mjs +1 -1
- package/esm2022/lib/utils/apply-props.mjs +23 -11
- package/esm2022/lib/utils/attach.mjs +2 -2
- package/esm2022/lib/utils/is.mjs +1 -1
- package/esm2022/lib/utils/make.mjs +1 -1
- package/esm2022/lib/utils/safe-detect-changes.mjs +15 -13
- package/esm2022/lib/utils/signal-store.mjs +96 -0
- package/esm2022/lib/utils/update.mjs +1 -1
- package/fesm2022/angular-three.mjs +2010 -1881
- package/fesm2022/angular-three.mjs.map +1 -1
- package/index.d.ts +9 -10
- package/lib/{di/before-render.d.ts → before-render.d.ts} +1 -1
- package/lib/canvas.d.ts +82 -12
- package/lib/directives/args.d.ts +2 -2
- package/lib/directives/common.d.ts +5 -1
- package/lib/directives/key.d.ts +10 -0
- package/lib/directives/parent.d.ts +5 -5
- package/lib/dom/events.d.ts +3 -2
- package/lib/events.d.ts +78 -2
- package/lib/instance.d.ts +36 -0
- package/lib/loader.d.ts +21 -3
- package/lib/loop.d.ts +68 -6
- package/lib/portal.d.ts +21 -12
- package/lib/{di/ref.d.ts → ref.d.ts} +3 -2
- package/lib/renderer/catalogue.d.ts +13 -0
- package/lib/renderer/constants.d.ts +20 -0
- package/lib/renderer/index.d.ts +5 -0
- package/lib/renderer/store.d.ts +21 -15
- package/lib/renderer/utils.d.ts +29 -19
- package/lib/roots.d.ts +11 -0
- package/lib/routed-scene.d.ts +1 -1
- package/lib/store.d.ts +147 -0
- package/lib/three-types.d.ts +5 -5
- package/lib/types.d.ts +1 -309
- package/lib/utils/apply-props.d.ts +4 -2
- package/lib/utils/attach.d.ts +5 -3
- package/lib/utils/is.d.ts +5 -4
- package/lib/utils/make.d.ts +12 -1
- package/lib/utils/safe-detect-changes.d.ts +2 -2
- package/lib/utils/signal-store.d.ts +17 -0
- package/lib/utils/update.d.ts +1 -1
- package/metadata.json +1 -1
- package/package.json +22 -5
- package/plugin/generators.json +47 -17
- package/plugin/migrations.json +27 -0
- package/plugin/package.json +20 -4
- package/plugin/src/generators/init/compat.d.ts +3 -1
- package/plugin/src/generators/init/compat.js +2 -2
- package/plugin/src/generators/init/compat.js.map +1 -1
- package/plugin/src/generators/init/files/experience/experience.component.html__tmpl__ +4 -0
- package/plugin/src/generators/init/files/experience/experience.component.ts__tmpl__ +18 -0
- package/plugin/src/generators/init/generator.d.ts +6 -0
- package/plugin/src/generators/init/generator.js +160 -0
- package/plugin/src/generators/init/generator.js.map +1 -0
- package/plugin/src/generators/init/schema.json +15 -4
- package/plugin/src/generators/init-cannon/compat.d.ts +2 -0
- package/plugin/src/generators/init-cannon/compat.js +6 -0
- package/plugin/src/generators/init-cannon/compat.js.map +1 -0
- package/plugin/src/generators/init-cannon/generator.d.ts +2 -0
- package/plugin/src/generators/init-cannon/generator.js +23 -0
- package/plugin/src/generators/init-cannon/generator.js.map +1 -0
- package/plugin/src/generators/init-cannon/schema.json +6 -0
- package/plugin/src/generators/init-postprocessing/compat.d.ts +2 -0
- package/plugin/src/generators/init-postprocessing/compat.js +6 -0
- package/plugin/src/generators/init-postprocessing/compat.js.map +1 -0
- package/plugin/src/generators/init-postprocessing/generator.d.ts +2 -0
- package/plugin/src/generators/init-postprocessing/generator.js +21 -0
- package/plugin/src/generators/init-postprocessing/generator.js.map +1 -0
- package/plugin/src/generators/init-postprocessing/schema.json +6 -0
- package/plugin/src/generators/init-soba/compat.d.ts +2 -0
- package/plugin/src/generators/init-soba/compat.js +6 -0
- package/plugin/src/generators/init-soba/compat.js.map +1 -0
- package/plugin/src/generators/init-soba/generator.d.ts +2 -0
- package/plugin/src/generators/init-soba/generator.js +27 -0
- package/plugin/src/generators/init-soba/generator.js.map +1 -0
- package/plugin/src/generators/init-soba/schema.json +6 -0
- package/plugin/src/generators/utils.d.ts +2 -0
- package/plugin/src/generators/utils.js +34 -0
- package/plugin/src/generators/utils.js.map +1 -0
- package/plugin/src/generators/versions.d.ts +13 -0
- package/plugin/src/generators/versions.js +17 -0
- package/plugin/src/generators/versions.js.map +1 -0
- package/plugin/src/index.d.ts +3 -1
- package/plugin/src/index.js +7 -3
- package/plugin/src/index.js.map +1 -1
- package/plugin/src/migrations/migrate-to-ngxtension/compat.d.ts +2 -0
- package/plugin/src/migrations/migrate-to-ngxtension/compat.js +6 -0
- package/plugin/src/migrations/migrate-to-ngxtension/compat.js.map +1 -0
- package/plugin/src/migrations/migrate-to-ngxtension/migrate-to-ngxtension.d.ts +2 -0
- package/plugin/src/migrations/migrate-to-ngxtension/migrate-to-ngxtension.js +55 -0
- package/plugin/src/migrations/migrate-to-ngxtension/migrate-to-ngxtension.js.map +1 -0
- package/web-types.json +1 -1
- package/esm2022/lib/di/before-render.mjs +0 -13
- package/esm2022/lib/di/catalogue.mjs +0 -7
- package/esm2022/lib/di/ref.mjs +0 -49
- package/esm2022/lib/directives/repeat.mjs +0 -18
- package/esm2022/lib/renderer/di.mjs +0 -3
- package/esm2022/lib/renderer/enums.mjs +0 -2
- package/esm2022/lib/renderer/provider.mjs +0 -18
- package/esm2022/lib/renderer/renderer.mjs +0 -368
- package/esm2022/lib/stores/signal.store.mjs +0 -79
- package/esm2022/lib/stores/store.mjs +0 -420
- package/esm2022/lib/utils/assert-in-injection-context.mjs +0 -14
- package/esm2022/lib/utils/instance.mjs +0 -63
- package/esm2022/lib/utils/signal.mjs +0 -24
- package/esm2022/lib/utils/timing.mjs +0 -21
- package/lib/di/catalogue.d.ts +0 -3
- package/lib/directives/repeat.d.ts +0 -7
- package/lib/renderer/di.d.ts +0 -2
- package/lib/renderer/enums.d.ts +0 -26
- package/lib/renderer/provider.d.ts +0 -8
- package/lib/renderer/renderer.d.ts +0 -49
- package/lib/stores/signal.store.d.ts +0 -21
- package/lib/stores/store.d.ts +0 -13
- package/lib/utils/assert-in-injection-context.d.ts +0 -2
- package/lib/utils/instance.d.ts +0 -4
- package/lib/utils/signal.d.ts +0 -2
- package/lib/utils/timing.d.ts +0 -4
- package/plugin/src/generators/init/init.d.ts +0 -5
- package/plugin/src/generators/init/init.js +0 -56
- package/plugin/src/generators/init/init.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,150 +1,7 @@
|
|
|
1
|
-
#
|
|
1
|
+
# core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This library was generated with [Nx](https://nx.dev).
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Running unit tests
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
### Angular CLI
|
|
10
|
-
|
|
11
|
-
```shell
|
|
12
|
-
npx ng add angular-three
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
### Nx
|
|
16
|
-
|
|
17
|
-
```shell
|
|
18
|
-
npm i angular-three
|
|
19
|
-
npx nx g angular-three:init
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
### Manual
|
|
23
|
-
|
|
24
|
-
```shell
|
|
25
|
-
npm i angular-three three
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
```shell
|
|
29
|
-
npm i -D @types/three
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
- Adjust `tsconfig.json` (or `tsconfig.base.json`) to include `skipTypeCheck: false`
|
|
33
|
-
|
|
34
|
-
> Typically, we'd want to keep `three` and `@types/three` on the same minor version. Eg: `0.147`, `0.148` etc..
|
|
35
|
-
|
|
36
|
-
## Type
|
|
37
|
-
|
|
38
|
-
### VSCode
|
|
39
|
-
|
|
40
|
-
- If you use `ng add` or `nx generate` command, this is setup for you.
|
|
41
|
-
- If you install `angular-three` manually, you can do the following steps to enable typings
|
|
42
|
-
- Open `.vscode/settings.json`, or create one if you do not have it
|
|
43
|
-
- Add `html.customData` property with the value of `["./node_modules/angular-three/metadata.json"]`. If `html.customData` exists, simply add `"./node_modules/angular-three/metadata.json"` to the array
|
|
44
|
-
|
|
45
|
-
### WebStorm/IntelliJ
|
|
46
|
-
|
|
47
|
-
- You **should not** need to do anything here but if things do not work, you can add `web-types` property to `package.json` with the value of `"./node_modules/angular-three/web-types.json"`
|
|
48
|
-
|
|
49
|
-
### NeoVim
|
|
50
|
-
|
|
51
|
-
Setup will vary depending on your current NeoVim configuration. However, I'd expect the **required** steps to be the same
|
|
52
|
-
|
|
53
|
-
- `neovim/nvim-lspconfig` needs to be configured for `html` LSP
|
|
54
|
-
- `init_options.dataPaths` needs to include the path to `node_modules/angular-three/metadata.json`
|
|
55
|
-
- Setup a `html/customDataContent` handler (`handlers = {["html/customDataContent"] = function() ... end}` for Lua syntax)
|
|
56
|
-
and return the content of the `init_options.dataPaths`
|
|
57
|
-
|
|
58
|
-
Here's an example setup for [LazyVim](https://www.lazyvim.org/)
|
|
59
|
-
|
|
60
|
-
```lua
|
|
61
|
-
return {
|
|
62
|
-
{
|
|
63
|
-
"neovim/nvim-lspconfig",
|
|
64
|
-
---@class PluginLspOpts
|
|
65
|
-
opts = {
|
|
66
|
-
---@type table<string, fun(server:string, opts:_.lspconfig.options):boolean?>
|
|
67
|
-
setup = {
|
|
68
|
-
html = function(_, opts)
|
|
69
|
-
opts.init_options = {
|
|
70
|
-
dataPaths = {
|
|
71
|
-
vim.fn.getcwd() .. "/node_modules/angular-three/metadata.json",
|
|
72
|
-
},
|
|
73
|
-
configurationSection = { "html", "css", "javascript" },
|
|
74
|
-
embeddedLanguages = {
|
|
75
|
-
css = true,
|
|
76
|
-
javascript = true,
|
|
77
|
-
},
|
|
78
|
-
provideFormatter = true,
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
opts.handlers = {
|
|
82
|
-
["html/customDataContent"] = function(err, result, ctx, config)
|
|
83
|
-
local function exists(name)
|
|
84
|
-
if type(name) ~= "string" then
|
|
85
|
-
return false
|
|
86
|
-
end
|
|
87
|
-
return os.execute("test -e " .. name)
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
if not vim.tbl_isempty(result) and #result == 1 then
|
|
91
|
-
if not exists(result[1]) then
|
|
92
|
-
return ""
|
|
93
|
-
end
|
|
94
|
-
local content = vim.fn.join(vim.fn.readfile(result[1]), "\n")
|
|
95
|
-
return content
|
|
96
|
-
end
|
|
97
|
-
return ""
|
|
98
|
-
end,
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
return false
|
|
102
|
-
end,
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
},
|
|
106
|
-
}
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
## Documentations
|
|
110
|
-
|
|
111
|
-
Read more about Angular Three usages in [Documentations](https://angular-three-backupjs.netlify.app)
|
|
112
|
-
|
|
113
|
-
## Simple usage
|
|
114
|
-
|
|
115
|
-
1. Create a `Scene` component as a Standalone Component
|
|
116
|
-
|
|
117
|
-
```ts
|
|
118
|
-
import { extend } from 'angular-three';
|
|
119
|
-
import { Mesh, BoxGeometry, MeshBasicMaterial } from 'three';
|
|
120
|
-
|
|
121
|
-
extend({ Mesh, BoxGeometry, MeshBasicMaterial });
|
|
122
|
-
|
|
123
|
-
@Component({
|
|
124
|
-
standalone: true,
|
|
125
|
-
template: `
|
|
126
|
-
<ngt-mesh>
|
|
127
|
-
<ngt-box-geometry />
|
|
128
|
-
<ngt-mesh-basic-material color="darkred" />
|
|
129
|
-
</ngt-mesh>
|
|
130
|
-
`,
|
|
131
|
-
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
132
|
-
})
|
|
133
|
-
export class Scene {}
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
- `extend` will add the THREE entities to `angular-three` catalogue which allows the renderer to recognize the custom tags: `ngt-mesh`, `ngt-box-geometry` etc..
|
|
137
|
-
- Custom Element tags follow this rule: `ngt-` + THREE classes in **kebab-case**. `Mesh` -> `ngt-mesh`
|
|
138
|
-
- `schemas: [CUSTOM_ELEMENTS_SCHEMA]` allows us to use custom tags on the template. This is Angular's limitation at the moment
|
|
139
|
-
|
|
140
|
-
2. Render `<ngt-canvas>` component, use `Scene` component above to pass into `[sceneGraph]` input on `<ngt-canvas>`
|
|
141
|
-
|
|
142
|
-
```html
|
|
143
|
-
<ngt-canvas [sceneGraph]="Scene" />
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
- `ngt-canvas` creates the basic building blocks of THREE.js: a default `WebGLRenderer`, a default `Scene`, and a default `PerspectiveCamera`
|
|
147
|
-
|
|
148
|
-
## Contributions
|
|
149
|
-
|
|
150
|
-
Contributions are welcomed
|
|
7
|
+
Run `nx test core` to execute the unit tests.
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* Generated bundle index. Do not edit.
|
|
3
3
|
*/
|
|
4
4
|
export * from './index';
|
|
5
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYW5ndWxhci10aHJlZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL2xpYnMvY29yZS9zcmMvYW5ndWxhci10aHJlZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7R0FFRztBQUVILGNBQWMsU0FBUyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBHZW5lcmF0ZWQgYnVuZGxlIGluZGV4LiBEbyBub3QgZWRpdC5cbiAqL1xuXG5leHBvcnQgKiBmcm9tICcuL2luZGV4JztcbiJdfQ==
|
package/esm2022/index.mjs
CHANGED
|
@@ -1,26 +1,25 @@
|
|
|
1
|
+
export * from './lib/before-render';
|
|
1
2
|
export * from './lib/canvas';
|
|
2
|
-
export * from './lib/di/before-render';
|
|
3
|
-
export * from './lib/di/catalogue';
|
|
4
|
-
export * from './lib/di/ref';
|
|
5
3
|
export * from './lib/directives/args';
|
|
4
|
+
export * from './lib/directives/key';
|
|
6
5
|
export * from './lib/directives/parent';
|
|
7
|
-
export
|
|
6
|
+
export {} from './lib/events';
|
|
7
|
+
export * from './lib/instance';
|
|
8
8
|
export * from './lib/loader';
|
|
9
9
|
export { addAfterEffect, addEffect, addTail } from './lib/loop';
|
|
10
10
|
export { NgtPortal, NgtPortalContent } from './lib/portal';
|
|
11
|
+
export * from './lib/ref';
|
|
12
|
+
export * from './lib/renderer';
|
|
11
13
|
export * from './lib/routed-scene';
|
|
12
|
-
export * from './lib/
|
|
13
|
-
export * from './lib/stores/store';
|
|
14
|
+
export * from './lib/store';
|
|
14
15
|
export * from './lib/three-types';
|
|
15
16
|
export * from './lib/types';
|
|
16
17
|
export * from './lib/utils/apply-props';
|
|
17
|
-
export * from './lib/utils/assert-in-injection-context';
|
|
18
18
|
export { createAttachFunction } from './lib/utils/attach';
|
|
19
|
-
export * from './lib/utils/instance';
|
|
20
19
|
export * from './lib/utils/is';
|
|
21
20
|
export * from './lib/utils/make';
|
|
22
21
|
export * from './lib/utils/safe-detect-changes';
|
|
23
|
-
export * from './lib/utils/signal';
|
|
24
|
-
export * from './lib/utils/timing';
|
|
22
|
+
export * from './lib/utils/signal-store';
|
|
25
23
|
export * from './lib/utils/update';
|
|
26
|
-
|
|
24
|
+
import './lib/three-types';
|
|
25
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9saWJzL2NvcmUvc3JjL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMscUJBQXFCLENBQUM7QUFDcEMsY0FBYyxjQUFjLENBQUM7QUFDN0IsY0FBYyx1QkFBdUIsQ0FBQztBQUN0QyxjQUFjLHNCQUFzQixDQUFDO0FBQ3JDLGNBQWMseUJBQXlCLENBQUM7QUFDeEMsT0FBTyxFQUFzQyxNQUFNLGNBQWMsQ0FBQztBQUNsRSxjQUFjLGdCQUFnQixDQUFDO0FBQy9CLGNBQWMsY0FBYyxDQUFDO0FBQzdCLE9BQU8sRUFBRSxjQUFjLEVBQUUsU0FBUyxFQUFFLE9BQU8sRUFBRSxNQUFNLFlBQVksQ0FBQztBQUNoRSxPQUFPLEVBQUUsU0FBUyxFQUFFLGdCQUFnQixFQUFFLE1BQU0sY0FBYyxDQUFDO0FBQzNELGNBQWMsV0FBVyxDQUFDO0FBQzFCLGNBQWMsZ0JBQWdCLENBQUM7QUFDL0IsY0FBYyxvQkFBb0IsQ0FBQztBQUNuQyxjQUFjLGFBQWEsQ0FBQztBQUM1QixjQUFjLG1CQUFtQixDQUFDO0FBQ2xDLGNBQWMsYUFBYSxDQUFDO0FBQzVCLGNBQWMseUJBQXlCLENBQUM7QUFDeEMsT0FBTyxFQUFFLG9CQUFvQixFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFDMUQsY0FBYyxnQkFBZ0IsQ0FBQztBQUMvQixjQU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bHktcHJvcHMnO1xuZXhwb3J0IHsgY3JlYXRlQXR0YWNoRnVuY3Rpb24gfSBmcm9tICcuL2xpYi91dGlscy9hdHRhY2gnO1xuZXhwb3J0ICogZnJvbSAnLi9saWIvdXRpbHMvaXMnO1xuZXhwb3J0ICogZnJvbSAnLi9saWIvdXRpbHMvbWFrZSc7XG5leHBvcnQgKiBmcm9tICcuL2xpYi91dGlscy9zYWZlLWRldGVjdC1jaGFuZ2VzJztcbmV4cG9ydCAqIGZyb20gJy4vbGliL3V0aWxzL3NpZ25hbC1zdG9yZSc7XG5leHBvcnQgKiBmcm9tICcuL2xpYi91dGlscy91cGRhdGUnO1xuaW1wb3J0ICcuL2xpYi90aHJlZS10eXBlcyc7XG4iXX0=
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DestroyRef, Injector, inject, runInInjectionContext } from '@angular/core';
|
|
2
|
+
import { assertInjector } from 'ngxtension/assert-injector';
|
|
3
|
+
import { injectNgtStore } from './store';
|
|
4
|
+
export function injectBeforeRender(cb, { priority = 0, injector } = {}) {
|
|
5
|
+
injector = assertInjector(injectBeforeRender, injector);
|
|
6
|
+
return runInInjectionContext(injector, () => {
|
|
7
|
+
const store = injectNgtStore();
|
|
8
|
+
const sub = store.get('internal').subscribe(cb, priority, store);
|
|
9
|
+
inject(DestroyRef).onDestroy(() => void sub());
|
|
10
|
+
return sub;
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmVmb3JlLXJlbmRlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL2xpYnMvY29yZS9zcmMvbGliL2JlZm9yZS1yZW5kZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFVBQVUsRUFBRSxRQUFRLEVBQUUsTUFBTSxFQUFFLHFCQUFxQixFQUFFL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