@aiquants/plant-scene 0.0.0-stage → 0.1.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.
- package/CHANGELOG.md +25 -0
- package/LICENSE +21 -0
- package/README.md +187 -2
- package/dist/chunk-IDQ6FMAI.js +4 -0
- package/dist/index.d.ts +169 -0
- package/dist/index.js +1 -0
- package/dist/plantScene-7IMBSUGH.js +1 -0
- package/package.json +69 -3
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.0 (2026-11-09)
|
|
4
|
+
|
|
5
|
+
The first release: a React 3D view of a plant site drawn with Babylon.js, and the rules a page around it lists the
|
|
6
|
+
scene's objects by.
|
|
7
|
+
|
|
8
|
+
### Added
|
|
9
|
+
|
|
10
|
+
- **`PlantSceneCanvas`**: draws the site's boxes first, then the site drawing's lines and the detailed buildings' models
|
|
11
|
+
as they arrive; reports picks, loads and failures; shows a detailed building alone up to a floor; frames into the part
|
|
12
|
+
of the canvas the host's panels leave (`insets`). Babylon.js loads only when the canvas mounts, with a dynamic
|
|
13
|
+
`import()`. The canvas lays itself out with its own `style`.
|
|
14
|
+
- **Colours from the host** (`ScenePaint`, `checkedPaint`): the sky, the ground, the drawings' ink and the floors, each
|
|
15
|
+
`#rrggbb`; a changed colour repaints the open view. A colour that is not `#rrggbb`, and insets that leave no height in
|
|
16
|
+
sight, throw a `RangeError` while rendering.
|
|
17
|
+
- **Display options** (`useDisplayOptions`, `offeredOptions`, `DEFAULT_DISPLAY_OPTIONS`): kept in `localStorage` under a
|
|
18
|
+
key the host chooses, followed by every reader of the key in every tab.
|
|
19
|
+
- **Panels over the view** (`useViewInsets`): measures how much of the view the panels hide.
|
|
20
|
+
- **Rules for the page's list and cards** (`listedBuildings`, `objectSummary`, `detailOfObject`, `buildingRequestOf`,
|
|
21
|
+
`sceneObjectLabel`, `detailPlacement`): they take the host's own manifest entries (`SceneDetail`) and hand them back in
|
|
22
|
+
the host's type.
|
|
23
|
+
- **Search folding** (`foldForSearch`, `searchTerms`): NFKC, lower case, split by white space.
|
|
24
|
+
|
|
25
|
+
Peers: `@babylonjs/core` ^9.31.0, `@babylonjs/loaders` ^9.31.0, `react` >=19.2.0, `zod` ^3.25.0.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 AI Quants
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,188 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @aiquants/plant-scene
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A React 3D view of a plant site, drawn with Babylon.js, and the rules a page around it lists the scene's objects by.
|
|
4
|
+
Babylon.js で描く工場の構内の 3D の表示 (React) と、周りの画面が場面の物体を並べる規則。
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Overview / 概要
|
|
9
|
+
|
|
10
|
+
- **The view**: `PlantSceneCanvas` draws the site's buildings and tanks as boxes first, then lays the site drawing's lines and text and the detailed buildings' models over them as they arrive. A click picks a building, a tank or a piece of equipment; a detailed building can be shown alone, up to one of its floors.
|
|
11
|
+
- **表示**: `PlantSceneCanvas` はまず構内の建屋とタンクを箱で描き、届き次第、構内の図面の線と字と詳しい建屋の模型を重ねる。押すと建屋・タンク・機器を選べ、詳しい建屋は 1 つだけ、ある階までを見せられる。
|
|
12
|
+
- **Babylon.js loads late**: the canvas loads the scene module with a dynamic `import()` when it mounts, so the page's entry chunk and the server render never carry Babylon.js.
|
|
13
|
+
- **Babylon.js は後から読む**: キャンバスは置かれたときに場面のモジュールを動的な `import()` で読むので、画面の入口の塊にもサーバの描画にも Babylon.js は載らない。
|
|
14
|
+
- **The rules around it**: the list of buildings with their floors and equipment, the summary of a selected object, the drawings an object asks for, the display options a manifest offers, and the search folding.
|
|
15
|
+
- **周りの規則**: 建屋とその階・機器の一覧、選んだ物体の要約、物体が求める図面、目録が出す表示オプション、検索の語のそろえ方。
|
|
16
|
+
- **What the host keeps**: the route that serves the models, the manifest of detailed buildings, the colours of its theme, the key the display options are kept under, and the page's own panels.
|
|
17
|
+
- **使い手が持つもの**: 模型を配る口、詳しい建屋の目録、テーマの色、表示オプションを残す鍵、画面の欄。
|
|
18
|
+
|
|
19
|
+
The labels the package returns and shows (the display options, the legend, the object summaries and the canvas's accessible name) are Japanese.
|
|
20
|
+
パッケージが返し見せる名 (表示オプション・凡例・物体の要約・キャンバスの名) は日本語。
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Installation / インストール
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
pnpm add @aiquants/plant-scene @babylonjs/core @babylonjs/loaders zod
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Peer dependencies:
|
|
31
|
+
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"@babylonjs/core": "^9.31.0",
|
|
36
|
+
"@babylonjs/loaders": "^9.31.0",
|
|
37
|
+
"react": ">=19.2.0",
|
|
38
|
+
"zod": "^3.25.0"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
The package is ES modules only (`import`), as Babylon.js 9 is. React 19.2 is the first version with `useEffectEvent`, which the canvas uses.
|
|
44
|
+
パッケージは ES モジュールだけ (`import`。Babylon.js 9 と同じ)。キャンバスが使う `useEffectEvent` は React 19.2 から。
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Usage / 使い方
|
|
49
|
+
|
|
50
|
+
```tsx
|
|
51
|
+
import { detailPlacement, type DetailModel, PlantSceneCanvas, type ScenePaint, type SceneSelection, useDisplayOptions, useViewInsets } from "@aiquants/plant-scene"
|
|
52
|
+
import { useMemo, useState } from "react"
|
|
53
|
+
|
|
54
|
+
const PAINT: ScenePaint = { sky: "#f1f5f9", ground: "#e2e8f0", ink: "#0f172a", floor: "#ffffff" }
|
|
55
|
+
|
|
56
|
+
export const PlantView = ({ manifest }: { manifest: YourManifest }) => {
|
|
57
|
+
const [options] = useDisplayOptions("<your-app>:plant-scene:display-options")
|
|
58
|
+
const [view, setView] = useState<HTMLDivElement | null>(null)
|
|
59
|
+
const [card, setCard] = useState<HTMLDivElement | null>(null)
|
|
60
|
+
const panels = useMemo(() => [card], [card])
|
|
61
|
+
const insets = useViewInsets(view, panels)
|
|
62
|
+
const [selection, setSelection] = useState<SceneSelection | null>(null)
|
|
63
|
+
const details = useMemo<DetailModel[]>(
|
|
64
|
+
() => manifest.details.map((detail) => ({ key: detail.key, glbUrl: `/your-asset-route/${detail.glb}`, buildingId: detail.buildingId, placement: detailPlacement(detail, manifest.originMm), floors: detail.floors })),
|
|
65
|
+
[manifest],
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
return (
|
|
69
|
+
<div ref={setView} style={{ position: "relative", height: "100dvh", background: PAINT.sky }}>
|
|
70
|
+
<PlantSceneCanvas
|
|
71
|
+
massingUrl="/your-asset-route/site.massing.glb"
|
|
72
|
+
linesUrl="/your-asset-route/site.lines.glb"
|
|
73
|
+
details={details}
|
|
74
|
+
heights={manifest.heights}
|
|
75
|
+
display={{ isolated: null, floor: null, selection }}
|
|
76
|
+
options={options}
|
|
77
|
+
insets={insets}
|
|
78
|
+
paint={PAINT}
|
|
79
|
+
onPick={(object) => setSelection(object === null ? null : { id: object.id, focus: false })}
|
|
80
|
+
onLoad={({ objects, legend, complete }) => { /* list the objects, show the legend */ }}
|
|
81
|
+
onFailure={(error) => { /* show the error */ }}
|
|
82
|
+
/>
|
|
83
|
+
<div ref={setCard} style={{ position: "absolute", top: 0, left: 0, right: 0 }}>{/* a panel over the view */}</div>
|
|
84
|
+
</div>
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
The canvas fills its nearest positioned ancestor, which gives it its size; it lays itself out with its own `style` and needs no stylesheet. Pass stable arrays (`details`, `heights`): the view lives as long as the two URLs and these arrays, compared by identity, and a new one closes the view and loads the models again.
|
|
90
|
+
キャンバスはいちばん近い位置指定の祖先いっぱいに広がり、その祖先が大きさを与える。自分の `style` で自分を置くので、スタイルシートは要らない。`details`・`heights` は変わらない配列を渡すこと。表示は 2 つの URL とこれらの配列 (同一性で比べる) と同じだけ生き、新しいものなら表示を閉じて模型を読み直す。
|
|
91
|
+
|
|
92
|
+
### `PlantSceneCanvas` props / 引数
|
|
93
|
+
|
|
94
|
+
| Prop | Type | What it is |
|
|
95
|
+
| --- | --- | --- |
|
|
96
|
+
| `massingUrl` | `string` | GLB of the site's buildings and tanks. 構内の建屋とタンクの GLB。 |
|
|
97
|
+
| `linesUrl` | `string` | GLB of the site drawing's lines and text. 構内の図面の線と字の GLB。 |
|
|
98
|
+
| `details` | `readonly DetailModel[]` | The detailed buildings' models: `key`, `glbUrl`, `buildingId` (the site building it replaces), `placement` (`detailPlacement`) and `floors`. 詳しい建屋の模型。 |
|
|
99
|
+
| `heights` | `readonly BuildingHeight[]` | Heights of the site buildings whose height is known (`buildingId`, `buildingName`, `heightMm`). 高さの分かる構内の建屋の高さ。 |
|
|
100
|
+
| `display` | `SceneDisplay` | What the view shows: `isolated` (a detailed building's key shown alone, or `null`), `floor` (the floor it is shown up to, or `null`) and `selection` (`{ id, focus }` or `null`; `focus` turns the camera to it). 表示が見せるもの。 |
|
|
101
|
+
| `options` | `DisplayOptions` | How the view draws (`useDisplayOptions`). 描き方。 |
|
|
102
|
+
| `insets` | `ViewInsets` | The parts of the canvas's height the panels hide (`useViewInsets`): each side 0 or more, the two less than 1. 欄が隠す高さの部分。 |
|
|
103
|
+
| `paint` | `ScenePaint` | The colours of the sky, the ground, the drawings' ink and the floors, each `#rrggbb`. 空・地面・墨・床の色。 |
|
|
104
|
+
| `onPick` | `(object: SceneObject \| null) => void` | The object a click hit, or `null`. 押して当たった物体。 |
|
|
105
|
+
| `onLoad` | `(models: LoadedModels) => void` | The objects and the legend each time more models have loaded (`complete` once everything has). 読み進めるたびの物体と凡例。 |
|
|
106
|
+
| `onFailure` | `(error: Error) => void` | Babylon.js or a model could not be loaded, or a model breaks the contract below. 読めなかったときや模型が約束を破るとき。 |
|
|
107
|
+
|
|
108
|
+
A colour that is not `#rrggbb` (`checkedPaint`) or insets that leave no height in sight (`checkedInsets`) make the canvas throw a `RangeError` while rendering, before a view opens or is painted; an error boundary of the host catches it.
|
|
109
|
+
`#rrggbb` でない色や、見える高さを残さない余白は、描く中で `RangeError` になる (表示を開く前・塗る前)。使い手のエラーの境界が受ける。
|
|
110
|
+
|
|
111
|
+
### The rest of the API / ほかの API
|
|
112
|
+
|
|
113
|
+
| Name | What it does |
|
|
114
|
+
| --- | --- |
|
|
115
|
+
| `useDisplayOptions(storageKey)` | The display options kept under the host's key in `localStorage`, and the function that keeps new ones. Every reader of the same key, in this tab and the others, follows a change; the server render gets `DEFAULT_DISPLAY_OPTIONS`. An empty key throws a `RangeError`. 使い手の鍵で残す表示オプションと、それを変える関数。 |
|
|
116
|
+
| `offeredOptions({ hasDetails, hasHeights })` | The options worth offering for a manifest, with their labels, in the page's order. 目録に意味のあるオプション。 |
|
|
117
|
+
| `DEFAULT_DISPLAY_OPTIONS` | Every option on. 全てのオプションが入った状態。 |
|
|
118
|
+
| `useViewInsets(view, panels)` | How much of the view the panels laid over it hide, measured again whenever the view or a panel changes size. Pass a memoized `panels` array. 重ねた欄が隠す部分。 |
|
|
119
|
+
| `detailPlacement(detail, originMm)` | Where a detailed building's model goes on the site model, from its turn (`rotationDeg`) and shift (`offsetMm`) on the site drawing and the drawing's point the site model's origin stands on. 詳しい建屋の模型の置き方。 |
|
|
120
|
+
| `listedBuildings(objects, details, filter, only)` | The page's list: the named buildings and the detailed ones, with their floors (highest first) and equipment, narrowed by words. 画面の一覧。 |
|
|
121
|
+
| `objectSummary(object, details, objects)` | A selected object's title, what it is, and its detailed building. 選んだ物体の要約。 |
|
|
122
|
+
| `detailOfObject(object, details)` | The detailed building a building or a piece of equipment belongs to, or `null`. 物体が属する詳しい建屋。 |
|
|
123
|
+
| `buildingRequestOf(object, details)` | The site building and the words an object asks the drawings for, or `null`. 物体が図面に求める建屋と語。 |
|
|
124
|
+
| `sceneObjectLabel(object)` | An object's label. 物体の名札。 |
|
|
125
|
+
| `foldForSearch(text)` / `searchTerms(query)` | The search folding (NFKC, then lower case) and a query split into folded words at any white space. Fold the host's own matches the same way. 検索の語のそろえ方。 |
|
|
126
|
+
| `checkedPaint(paint)` | Returns the paint when every colour is `#rrggbb`, or throws a `RangeError` naming the first wrong one. 色を確かめる。 |
|
|
127
|
+
|
|
128
|
+
`detailOfObject`, `objectSummary` and `listedBuildings` take the host's own manifest entries (any type with the fields of `SceneDetail`: `key`, `buildingId`, `buildingName`, `rotationDeg`, `offsetMm`, `floors`) and hand them back in the host's type.
|
|
129
|
+
`detailOfObject`・`objectSummary`・`listedBuildings` は使い手の目録の項目 (`SceneDetail` の項目を持つ型) を受け、使い手の型のまま返す。
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## The models / 模型の約束
|
|
134
|
+
|
|
135
|
+
The view reads what each mesh is from its glTF `extras`:
|
|
136
|
+
表示は網ごとの glTF の `extras` から、それが何かを読む。
|
|
137
|
+
|
|
138
|
+
| Model | Mesh | `extras` |
|
|
139
|
+
| --- | --- | --- |
|
|
140
|
+
| Site boxes (`massingUrl`) | A building | `sceneRole: "building"`, `buildingId`, `buildingCode`, `buildingName` (the last two may be empty) |
|
|
141
|
+
| | A tank | `sceneRole: "tank"`, `tankId` |
|
|
142
|
+
| Site drawing (`linesUrl`) | Lines, text | `sceneRole: "lines"` or `"text"` |
|
|
143
|
+
| A detailed building (`glbUrl`) | The lowest floor | `sceneRole: "slab"`, `floorName` |
|
|
144
|
+
| | The other floors | `sceneRole: "plate"`, `floorName` |
|
|
145
|
+
| | A floor plan's lines and text | `sceneRole: "lines"` or `"text"`, `floorName` |
|
|
146
|
+
| | A piece of equipment | `sceneRole: "equipment"`, `equipmentId`, `equipmentName`, `equipmentTag` (may be empty), `floorName`, `drawingQuery` |
|
|
147
|
+
|
|
148
|
+
An unknown role, a building, tank or piece of equipment missing a field, a part of a detailed building that names no floor, or equipment in the site model is reported through `onFailure`. The site model and the detailed models share one frame (east +X, north +Y and up +Z in the tool that builds them, in metres), which the glTF loader turns the same way for both. `floorName` is a floor's `name` in `details[].floors`.
|
|
149
|
+
知らない役、項目の欠けた建屋・タンク・機器、階を名乗らない詳しい建屋の部品、構内の模型の機器は `onFailure` で知らせる。構内の模型と詳しい模型は 1 つの軸 (作る道具で東が +X・北が +Y・上が +Z、m) を共にし、glTF の読み手はどちらも同じ形で回す。`floorName` は `details[].floors` の階の `name`。
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## Network / 通信
|
|
154
|
+
|
|
155
|
+
The view fetches the GLB URLs it is given and nothing else. Babylon.js fetches a decoder from its own CDN only for a model compressed with Draco, meshopt or KTX2 / Basis textures, so build the models without those compressions (or point Babylon.js's decoder URLs at the host before the canvas mounts).
|
|
156
|
+
表示は渡された GLB の URL だけを読む。Babylon.js は Draco・meshopt・KTX2 / Basis で縮めた模型のときだけ自身の CDN から復号器を読むので、模型はそれらで縮めずに作ること (またはキャンバスを置く前に Babylon.js の復号器の URL を使い手へ向けること)。
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## Bundling with Vite / Vite での束ね方
|
|
161
|
+
|
|
162
|
+
- **Pre-bundle the package** (`optimizeDeps.include: ["@aiquants/plant-scene"]`). A host whose dev server does not scan its sources for dependencies (React Router's default) otherwise finds the package and the Babylon.js modules of its scene chunk only on the first visit, and reloads the page to optimize them.
|
|
163
|
+
- **パッケージを事前バンドルに挙げる**。依存を探しにソースを走査しない開発サーバー (React Router の既定) では、挙げなければ初めて訪れたときにパッケージと場面の塊の Babylon.js のモジュールが見つかり、それらを最適化するために画面を読み直す。
|
|
164
|
+
- **Name the pre-bundled chunks without the source's name** (`optimizeDeps.esbuildOptions: { chunkNames: "chunk-[hash]" }`). A chunk named after a Babylon.js shader (`default.vertex-XXXX.js`) has a dot in its name and is served without its version query, so after the dev server optimizes again a browser keeps an old copy and the scene draws nothing.
|
|
165
|
+
- **事前バンドルの塊の名に元の名を入れない**。Babylon.js の色付け器の名の塊 (`default.vertex-XXXX.js`) は名に点があり版の問い合わせなしで配られるので、開発サーバーが最適化し直した後もブラウザが古い写しを使い、場面が何も描かない。
|
|
166
|
+
- **Keep Babylon.js in a chunk of its own** when the build groups `node_modules` into named chunks (`manualChunks`), so no other page's chunk depends on it statically. Match Babylon.js by its own directory (`/node_modules/@babylonjs/`), not by `@babylonjs` anywhere in a module's path: pnpm writes a package's peers into its directory name (`@aiquants+plant-scene@0.1.0_@babylonjs+core@…`), so the looser test also moves this package's own modules, the canvas included, into the Babylon.js chunk, and the page then loads Babylon.js before the view mounts.
|
|
167
|
+
- 組み立てが `node_modules` を名前付きの塊へまとめるときは、**Babylon.js を自分の塊に置く** (ほかの画面の塊が静的に頼らないように)。Babylon.js は自身のディレクトリ (`/node_modules/@babylonjs/`) で見分け、モジュールの道のどこかにある `@babylonjs` では見分けない。pnpm はパッケージの peer をディレクトリの名に書く (`@aiquants+plant-scene@0.1.0_@babylonjs+core@…`) ので、緩い見分けはこのパッケージ自身のモジュール (キャンバスを含む) まで Babylon.js の塊へ移し、画面は表示を置く前に Babylon.js を読む。
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## Test hooks / 試験のフック
|
|
172
|
+
|
|
173
|
+
- The canvas is `data-testid="plant-scene-canvas"`.
|
|
174
|
+
- Every frame drawn writes the camera into the canvas's `data-camera-pose`: alpha, beta, radius and the target's x, y and z, split by spaces.
|
|
175
|
+
- キャンバスは `data-testid="plant-scene-canvas"`。描くコマごとに視点をキャンバスの `data-camera-pose` へ書く (alpha・beta・radius・注視点の x・y・z を空白で分ける)。
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## What ships / 配るもの
|
|
180
|
+
|
|
181
|
+
`dist/` holds the minified ES modules (the entry and the chunks it loads, Babylon.js kept external) and one declaration file whose comments are removed; no source map ships. This README is the reference.
|
|
182
|
+
`dist/` には縮めた ES モジュール (入口と、それが読む塊。Babylon.js は外のまま) と注記を除いた宣言のファイル 1 つがあり、ソースマップは配らない。説明はこの README。
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## License / ライセンス
|
|
187
|
+
|
|
188
|
+
MIT
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var w=/^#[0-9a-f]{6}$/iu,O=["sky","ground","ink","floor"],B=e=>{for(let t of O){let n=e[t];if(typeof n!="string"||!w.test(n))throw new RangeError(`the scene's ${t} colour must be #rrggbb, not ${JSON.stringify(n)}`)}return e};var h={top:0,bottom:0},q=.15,D=1e-4,T=e=>{for(let t of[e.top,e.bottom])if(!Number.isFinite(t)||t<0)throw new RangeError(`view insets must be finite and not negative: top ${e.top}, bottom ${e.bottom}`);if(e.top+e.bottom>=1)throw new RangeError(`view insets must leave some height in sight: top ${e.top}, bottom ${e.bottom}`);return e},V=(e,t)=>{let n=e.bottom-e.top,o=e.right-e.left;if(!(Number.isFinite(n)&&Number.isFinite(o)&&n>0&&o>0))return h;let s=(e.top+e.bottom)/2,l=0,u=0;for(let i of t){let r={left:Math.max(i.left,e.left),top:Math.max(i.top,e.top),right:Math.min(i.right,e.right),bottom:Math.min(i.bottom,e.bottom)};r.left<r.right&&r.top<r.bottom&&((r.top+r.bottom)/2<s?l=Math.max(l,r.bottom-e.top):u=Math.max(u,e.bottom-r.top))}let m={top:l/n,bottom:u/n};return m.top+m.bottom<1?m:h},L=(e,t,n)=>{if(!Number.isFinite(n)||n<0)throw new RangeError(`elapsed seconds must be finite and not negative: ${n}`);let o=1-Math.exp(-n/q),s=(l,u)=>{let m=l+(u-l)*o;return Math.abs(u-m)<D?u:m};return{top:s(e.top,t.top),bottom:s(e.bottom,t.bottom)}},X=(e,t)=>{let n=1-t.top-t.bottom,o=t.bottom-t.top,s=e.m;for(let l=0;l<4;l+=1){let u=l*4;e.setRowFromFloats(l,s[u]*n,s[u+1]*n+s[u+3]*o,s[u+2],s[u+3])}};var v=(e,t)=>({rotationY:-e.rotationDeg*Math.PI/180,position:[-(e.offsetMm[0]-t[0])/1e3,0,-(e.offsetMm[1]-t[1])/1e3]}),j=(e,t,n,o)=>{let s=m=>{let i=e.find(r=>r.name===m);if(i===void 0)throw new Error(`floor ${m} is not one of the building's floors (${e.map(r=>r.name).join(", ")})`);return i.levelMm},l=s(n);if(t===null)return"shown";let u=s(t);return l>u?"hidden":l<u&&(o==="lines"||o==="text")?"faint":"shown"},Z=({alone:e,open:t,envelope:n,near:o})=>e||t&&!n?"hidden":t?"envelope":o?"see-through":"solid";var E=(e,t)=>Math.hypot(Math.max(0,e.minX-t.maxX,t.minX-e.maxX),Math.max(0,e.minZ-t.maxZ,t.minZ-e.maxZ)),Y=(e,t)=>{let n=Math.hypot(e.maxX-e.minX,e.maxZ-e.minZ)*1;return t.filter(o=>E(e,o.footprint)<=n).map(o=>o.id)};var g=e=>e.normalize("NFKC").toLowerCase(),S=e=>g(e).split(/\s+/u).filter(t=>t!=="");import{z as a}from"zod";var M=["building","tank","lines","text","slab","plate","equipment"],$=a.object({gltf:a.object({extras:a.record(a.string(),a.unknown())})}),I=a.object({sceneRole:a.enum(M),floorName:a.string().min(1).optional()}),R=a.object({buildingId:a.string().min(1),buildingCode:a.string(),buildingName:a.string()}),N=a.object({tankId:a.string().min(1)}),P=a.object({equipmentId:a.string().min(1),equipmentName:a.string().min(1),equipmentTag:a.string(),floorName:a.string().min(1),drawingQuery:a.string().min(1)}),k=e=>{let t=$.safeParse(e);return t.success?t.data.gltf.extras:null},F=(e,t)=>`${e}/${t}`,G=e=>{let t=k(e);if(t===null||!("sceneRole"in t))return null;let n=I.parse(t);return{role:n.sceneRole,floor:n.floorName===void 0?null:n.floorName}},J=(e,t)=>{let n=k(e);if(n===null)return null;if("buildingId"in n){let o=R.parse(n);return{kind:"building",id:o.buildingId,code:o.buildingCode,name:o.buildingName}}if("tankId"in n)return{kind:"tank",id:N.parse(n).tankId};if("equipmentId"in n){let o=P.parse(n);if(t===null)throw new Error(`equipment ${o.equipmentId} is in the site's model, outside every detailed building`);return{kind:"equipment",id:F(t,o.equipmentId),detailKey:t,name:o.equipmentName,tag:o.equipmentTag,floor:o.floorName,query:o.drawingQuery}}return null},U=(e,t)=>{for(let n=e;n!==null;n=n.parent){let o=t(n.metadata);if(o!==null)return o}return null},f=e=>{switch(e.kind){case"tank":return`\u30BF\u30F3\u30AF (${e.id})`;case"equipment":return e.tag===""?`${e.name} (${e.floor})`:`${e.name} (${e.tag}\u30FB${e.floor})`;case"building":return e.name===""?`\u540D\u524D\u306E\u7121\u3044\u5EFA\u5C4B (${e.id})`:e.code===""?e.name:`${e.name} (${e.code})`}},b=(e,t)=>{let n=t.find(o=>o.key===e.detailKey);if(n===void 0)throw new Error(`equipment ${e.id} belongs to detailed building ${e.detailKey}, which the manifest does not have`);return n},W=(e,t)=>{switch(e.kind){case"equipment":return{building:b(e,t).buildingName,query:e.query};case"building":return e.name===""?null:{building:e.name,query:""};case"tank":return null}},ee=(e,t,n,o)=>{let s=S(n),l=i=>{let r=g(i);return s.every(p=>r.includes(p))},u=e.filter(i=>i.kind==="equipment"),m=[];for(let i of e){if(i.kind!=="building")continue;let r=t.find(c=>c.buildingId===i.id);if(r===void 0&&i.name===""||o!==null&&r?.key!==o)continue;let p=l(`${i.name}
|
|
2
|
+
${i.code}`),x=r===void 0?[]:[...r.floors].sort((c,d)=>d.levelMm-c.levelMm).map(c=>({floor:c,equipment:u.filter(d=>d.detailKey===r.key&&d.floor===c.name&&(p||l(`${d.name}
|
|
3
|
+
${d.tag}
|
|
4
|
+
${d.floor}`))).sort((d,y)=>d.name.localeCompare(y.name,"ja")||d.id.localeCompare(y.id))})).filter(c=>p||c.equipment.length>0);(p||x.length>0)&&m.push({building:i,detail:r===void 0?null:r,floors:x})}return m.sort((i,r)=>i.building.name.localeCompare(r.building.name,"ja")||i.building.id.localeCompare(r.building.id))},_=(e,t)=>{switch(e.kind){case"equipment":return b(e,t);case"building":{let n=t.find(o=>o.buildingId===e.id);return n===void 0?null:n}case"tank":return null}},te=(e,t,n)=>{switch(e.kind){case"building":{let o=_(e,t);if(o===null)return{title:f(e),meta:"\u5EFA\u5C4B",detail:o};let s=n.filter(l=>l.kind==="equipment"&&l.detailKey===o.key).length;return{title:f(e),meta:`\u5EFA\u5C4B\u30FB\u8A73\u3057\u3044\u6A21\u578B\u3042\u308A (${o.floors.length} \u968E\u30FB\u6A5F\u5668 ${s})`,detail:o}}case"tank":return{title:f(e),meta:"\u30BF\u30F3\u30AF",detail:null};case"equipment":{let o=b(e,t),s=e.tag===""?"":`\u30FB\u8A2D\u5099\u30BF\u30B0 ${e.tag}`;return{title:e.name,meta:`\u6A5F\u5668\u30FB${o.buildingName}\u306E ${e.floor}${s}`,detail:o}}}};export{B as a,h as b,T as c,V as d,L as e,X as f,v as g,j as h,Z as i,Y as j,g as k,S as l,G as m,J as n,U as o,f as p,W as q,ee as r,_ as s,te as t};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import * as react from "react";
|
|
3
|
+
declare const displayOptionsSchema: z.ZodObject<{
|
|
4
|
+
shadows: z.ZodCatch<z.ZodBoolean>;
|
|
5
|
+
shading: z.ZodCatch<z.ZodBoolean>;
|
|
6
|
+
edges: z.ZodCatch<z.ZodBoolean>;
|
|
7
|
+
fadeLines: z.ZodCatch<z.ZodBoolean>;
|
|
8
|
+
envelope: z.ZodCatch<z.ZodBoolean>;
|
|
9
|
+
realHeights: z.ZodCatch<z.ZodBoolean>;
|
|
10
|
+
}, "strip", z.ZodTypeAny, {
|
|
11
|
+
shadows: boolean;
|
|
12
|
+
shading: boolean;
|
|
13
|
+
edges: boolean;
|
|
14
|
+
fadeLines: boolean;
|
|
15
|
+
envelope: boolean;
|
|
16
|
+
realHeights: boolean;
|
|
17
|
+
}, {
|
|
18
|
+
shadows?: unknown;
|
|
19
|
+
shading?: unknown;
|
|
20
|
+
edges?: unknown;
|
|
21
|
+
fadeLines?: unknown;
|
|
22
|
+
envelope?: unknown;
|
|
23
|
+
realHeights?: unknown;
|
|
24
|
+
}>;
|
|
25
|
+
type DisplayOptions = z.infer<typeof displayOptionsSchema>;
|
|
26
|
+
type DisplayOptionKey = keyof DisplayOptions;
|
|
27
|
+
declare const DEFAULT_DISPLAY_OPTIONS: DisplayOptions;
|
|
28
|
+
type OptionSubjects = {
|
|
29
|
+
hasDetails: boolean;
|
|
30
|
+
hasHeights: boolean;
|
|
31
|
+
};
|
|
32
|
+
type OfferedOption = {
|
|
33
|
+
key: DisplayOptionKey;
|
|
34
|
+
label: string;
|
|
35
|
+
};
|
|
36
|
+
declare const offeredOptions: ({ hasDetails, hasHeights }: OptionSubjects) => OfferedOption[];
|
|
37
|
+
declare const useDisplayOptions: (storageKey: string) => [
|
|
38
|
+
DisplayOptions,
|
|
39
|
+
(options: DisplayOptions) => void
|
|
40
|
+
];
|
|
41
|
+
type PlantFloor = {
|
|
42
|
+
readonly name: string;
|
|
43
|
+
readonly levelMm: number;
|
|
44
|
+
};
|
|
45
|
+
type BuildingHeight = {
|
|
46
|
+
readonly buildingId: string;
|
|
47
|
+
readonly buildingName: string;
|
|
48
|
+
readonly heightMm: number;
|
|
49
|
+
};
|
|
50
|
+
type SceneDetail = {
|
|
51
|
+
readonly key: string;
|
|
52
|
+
readonly buildingId: string;
|
|
53
|
+
readonly buildingName: string;
|
|
54
|
+
readonly rotationDeg: number;
|
|
55
|
+
readonly offsetMm: readonly [
|
|
56
|
+
number,
|
|
57
|
+
number
|
|
58
|
+
];
|
|
59
|
+
readonly floors: readonly PlantFloor[];
|
|
60
|
+
};
|
|
61
|
+
type ScenePaint = {
|
|
62
|
+
readonly sky: string;
|
|
63
|
+
readonly ground: string;
|
|
64
|
+
readonly ink: string;
|
|
65
|
+
readonly floor: string;
|
|
66
|
+
};
|
|
67
|
+
declare const checkedPaint: (paint: ScenePaint) => ScenePaint;
|
|
68
|
+
type BuildingObject = {
|
|
69
|
+
kind: "building";
|
|
70
|
+
id: string;
|
|
71
|
+
code: string;
|
|
72
|
+
name: string;
|
|
73
|
+
};
|
|
74
|
+
type TankObject = {
|
|
75
|
+
kind: "tank";
|
|
76
|
+
id: string;
|
|
77
|
+
};
|
|
78
|
+
type EquipmentObject = {
|
|
79
|
+
kind: "equipment";
|
|
80
|
+
id: string;
|
|
81
|
+
detailKey: string;
|
|
82
|
+
name: string;
|
|
83
|
+
tag: string;
|
|
84
|
+
floor: string;
|
|
85
|
+
query: string;
|
|
86
|
+
};
|
|
87
|
+
type SceneObject = BuildingObject | TankObject | EquipmentObject;
|
|
88
|
+
type SceneSelection = {
|
|
89
|
+
id: string;
|
|
90
|
+
focus: boolean;
|
|
91
|
+
};
|
|
92
|
+
declare const sceneObjectLabel: (object: SceneObject) => string;
|
|
93
|
+
type BuildingRequest = {
|
|
94
|
+
building: string;
|
|
95
|
+
query: string;
|
|
96
|
+
};
|
|
97
|
+
declare const buildingRequestOf: <D extends SceneDetail>(object: SceneObject, details: readonly D[]) => BuildingRequest | null;
|
|
98
|
+
type ListedFloor = {
|
|
99
|
+
floor: PlantFloor;
|
|
100
|
+
equipment: EquipmentObject[];
|
|
101
|
+
};
|
|
102
|
+
type ListedBuilding<D extends SceneDetail> = {
|
|
103
|
+
building: BuildingObject;
|
|
104
|
+
detail: D | null;
|
|
105
|
+
floors: ListedFloor[];
|
|
106
|
+
};
|
|
107
|
+
declare const listedBuildings: <D extends SceneDetail>(objects: readonly SceneObject[], details: readonly D[], filter: string, only: string | null) => ListedBuilding<D>[];
|
|
108
|
+
declare const detailOfObject: <D extends SceneDetail>(object: SceneObject, details: readonly D[]) => D | null;
|
|
109
|
+
type ObjectSummary<D extends SceneDetail> = {
|
|
110
|
+
title: string;
|
|
111
|
+
meta: string;
|
|
112
|
+
detail: D | null;
|
|
113
|
+
};
|
|
114
|
+
declare const objectSummary: <D extends SceneDetail>(object: SceneObject, details: readonly D[], objects: readonly SceneObject[]) => ObjectSummary<D>;
|
|
115
|
+
type DetailPlacement = {
|
|
116
|
+
rotationY: number;
|
|
117
|
+
position: readonly [
|
|
118
|
+
number,
|
|
119
|
+
number,
|
|
120
|
+
number
|
|
121
|
+
];
|
|
122
|
+
};
|
|
123
|
+
declare const detailPlacement: (detail: Pick<SceneDetail, "rotationDeg" | "offsetMm">, originMm: readonly [
|
|
124
|
+
number,
|
|
125
|
+
number
|
|
126
|
+
]) => DetailPlacement;
|
|
127
|
+
type ViewInsets = {
|
|
128
|
+
top: number;
|
|
129
|
+
bottom: number;
|
|
130
|
+
};
|
|
131
|
+
type DetailModel = {
|
|
132
|
+
key: string;
|
|
133
|
+
glbUrl: string;
|
|
134
|
+
buildingId: string;
|
|
135
|
+
placement: DetailPlacement;
|
|
136
|
+
floors: readonly PlantFloor[];
|
|
137
|
+
};
|
|
138
|
+
type SceneDisplay = {
|
|
139
|
+
isolated: string | null;
|
|
140
|
+
floor: string | null;
|
|
141
|
+
selection: SceneSelection | null;
|
|
142
|
+
};
|
|
143
|
+
type LegendEntry = {
|
|
144
|
+
label: string;
|
|
145
|
+
color: string;
|
|
146
|
+
};
|
|
147
|
+
type LoadedModels = {
|
|
148
|
+
objects: SceneObject[];
|
|
149
|
+
legend: LegendEntry[];
|
|
150
|
+
complete: boolean;
|
|
151
|
+
};
|
|
152
|
+
type PlantSceneCanvasProps = {
|
|
153
|
+
massingUrl: string;
|
|
154
|
+
linesUrl: string;
|
|
155
|
+
details: readonly DetailModel[];
|
|
156
|
+
heights: readonly BuildingHeight[];
|
|
157
|
+
display: SceneDisplay;
|
|
158
|
+
options: DisplayOptions;
|
|
159
|
+
insets: ViewInsets;
|
|
160
|
+
paint: ScenePaint;
|
|
161
|
+
onPick: (object: SceneObject | null) => void;
|
|
162
|
+
onLoad: (models: LoadedModels) => void;
|
|
163
|
+
onFailure: (error: Error) => void;
|
|
164
|
+
};
|
|
165
|
+
declare const PlantSceneCanvas: ({ massingUrl, linesUrl, details, heights, display, options, insets, paint, onPick, onLoad, onFailure }: PlantSceneCanvasProps) => react.JSX.Element;
|
|
166
|
+
declare const foldForSearch: (text: string) => string;
|
|
167
|
+
declare const searchTerms: (query: string) => string[];
|
|
168
|
+
declare const useViewInsets: (view: Element | null, panels: readonly (Element | null)[]) => ViewInsets;
|
|
169
|
+
export { type BuildingHeight, type BuildingObject, type BuildingRequest, DEFAULT_DISPLAY_OPTIONS, type DetailModel, type DetailPlacement, type DisplayOptionKey, type DisplayOptions, type EquipmentObject, type LegendEntry, type ListedBuilding, type ListedFloor, type LoadedModels, type ObjectSummary, type OfferedOption, type OptionSubjects, type PlantFloor, PlantSceneCanvas, type PlantSceneCanvasProps, type SceneDetail, type SceneDisplay, type SceneObject, type ScenePaint, type SceneSelection, type TankObject, type ViewInsets, buildingRequestOf, checkedPaint, detailOfObject, detailPlacement, foldForSearch, listedBuildings, objectSummary, offeredOptions, sceneObjectLabel, searchTerms, useDisplayOptions, useViewInsets };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as g,b as w,c as B,d as H,g as X,k as Z,l as $,p as K,q as ee,r as te,s as ne,t as oe}from"./chunk-IDQ6FMAI.js";import{useCallback as M,useSyncExternalStore as se}from"react";import{z as F}from"zod";var c=F.boolean().catch(!0),re=F.object({shadows:c,shading:c,edges:c,fadeLines:c,envelope:c,realHeights:c}),f={shadows:!0,shading:!0,edges:!0,fadeLines:!0,envelope:!0,realHeights:!0},ie=({hasDetails:e,hasHeights:t})=>[{key:"shadows",label:"\u5F71"},{key:"shading",label:"\u9670\u5F71\u3092\u5F37\u3081\u308B"},{key:"edges",label:"\u8F2A\u90ED\u7DDA"},{key:"fadeLines",label:"\u9060\u304F\u306E\u7DDA\u3092\u8584\u304F"},...e?[{key:"envelope",label:"\u8A73\u3057\u3044\u5EFA\u5C4B\u306E\u5916\u58C1"}]:[],...t?[{key:"realHeights",label:"\u5B9F\u969B\u306E\u9AD8\u3055"}]:[]],pe=e=>{if(e===null)return f;try{let t=re.safeParse(JSON.parse(e));return t.success?t.data:f}catch(t){if(t instanceof SyntaxError)return f;throw t}},h=new Set,le=e=>(h.add(e),window.addEventListener("storage",e),()=>{h.delete(e),window.removeEventListener("storage",e)}),A=new Map,ae=e=>{let t=window.localStorage.getItem(e),n=A.get(e);if(n!==void 0&&n.text===t)return n.options;let o=pe(t);return A.set(e,{text:t,options:o}),o},ce=()=>f,de=(e,t)=>{window.localStorage.setItem(e,JSON.stringify(t));for(let n of h)n()},ue=e=>{if(e==="")throw new RangeError("useDisplayOptions needs a storage key");let t=M(()=>ae(e),[e]),n=M(o=>de(e,o),[e]);return[se(le,t,ce),n]};import{useEffect as O,useEffectEvent as p,useRef as D}from"react";import{jsx as Oe}from"react/jsx-runtime";var ye={position:"absolute",top:0,right:0,bottom:0,left:0,display:"block",width:"100%",height:"100%",touchAction:"none",outlineStyle:"none"},fe=({massingUrl:e,linesUrl:t,details:n,heights:o,display:r,options:l,insets:a,paint:s,onPick:d,onLoad:_,onFailure:q})=>{let P=D(null),u=D(null),b=D(null),z=p(d),Y=p(_),J=p(q),U=p(()=>r),G=p(()=>s),Q=p(()=>a),W=p(()=>l),{isolated:v,floor:x,selection:k}=r,{top:E,bottom:L}=B(a),{sky:I,ground:j,ink:V,floor:R}=g(s);return O(()=>{let C=P.current;if(C===null)return;let m=!1,T=()=>{};return(async()=>{let{openPlantSceneView:y}=await import("./plantScene-7IMBSUGH.js");if(m)return;let S=y(C,G(),W(),i=>z(i));u.current=S,T=S.close,S.inset(Q()),await S.load({massingUrl:e,linesUrl:t},n,o,i=>{m||(b.current=i,i.show(U()),Y({objects:i.objects,legend:i.legend,complete:i.complete}))})})().catch(y=>{m||J(y instanceof Error?y:new Error(String(y)))}),()=>{m=!0,u.current=null,b.current=null,T()}},[e,t,n,o]),O(()=>{u.current?.paint({sky:I,ground:j,ink:V,floor:R})},[I,j,V,R]),O(()=>{u.current?.inset({top:E,bottom:L})},[E,L]),O(()=>{u.current?.options(l)},[l]),O(()=>{b.current?.show({isolated:v,floor:x,selection:k})},[v,x,k]),Oe("canvas",{ref:P,"data-testid":"plant-scene-canvas",style:ye,"aria-label":"\u5DE5\u5834\u306E 3D \u6A21\u578B"})};import{useEffect as me,useState as Se}from"react";var N=e=>{let{left:t,top:n,right:o,bottom:r}=e.getBoundingClientRect();return{left:t,top:n,right:o,bottom:r}},be=(e,t)=>{let[n,o]=Se(w);return me(()=>{if(e===null){o(w);return}let r=t.filter(s=>s!==null),l=()=>{let s=H(N(e),r.map(N));o(d=>d.top===s.top&&d.bottom===s.bottom?d:s)},a=new ResizeObserver(l);a.observe(e);for(let s of r)a.observe(s);return l(),()=>a.disconnect()},[e,t]),n};export{f as DEFAULT_DISPLAY_OPTIONS,fe as PlantSceneCanvas,ee as buildingRequestOf,g as checkedPaint,ne as detailOfObject,X as detailPlacement,Z as foldForSearch,te as listedBuildings,oe as objectSummary,ie as offeredOptions,K as sceneObjectLabel,$ as searchTerms,ue as useDisplayOptions,be as useViewInsets};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as he,b as Xe,c as $e,e as Ze,f as qe,h as Ke,i as Je,j as Qe,m as fe,n as ge,o as W}from"./chunk-IDQ6FMAI.js";import"@babylonjs/core/Animations/animatable.js";import"@babylonjs/core/Culling/ray.js";import"@babylonjs/core/Rendering/edgesRenderer.js";import"@babylonjs/loaders/glTF/index.js";import{Animation as C}from"@babylonjs/core/Animations/animation.js";import{ArcRotateCamera as $n}from"@babylonjs/core/Cameras/arcRotateCamera.js";import{ArcRotateCameraPointersInput as Zn}from"@babylonjs/core/Cameras/Inputs/arcRotateCameraPointersInput.js";import{Engine as qn}from"@babylonjs/core/Engines/engine.js";import{PointerEventTypes as Kn}from"@babylonjs/core/Events/pointerEvents.js";import{HighlightLayer as Jn}from"@babylonjs/core/Layers/highlightLayer.js";import{DirectionalLight as Qn}from"@babylonjs/core/Lights/directionalLight.js";import{HemisphericLight as bn}from"@babylonjs/core/Lights/hemisphericLight.js";import{ShadowGenerator as et}from"@babylonjs/core/Lights/Shadows/shadowGenerator.js";import{ImportMeshAsync as Me}from"@babylonjs/core/Loading/sceneLoader.js";import{Material as On}from"@babylonjs/core/Materials/material.js";import{StandardMaterial as Mn}from"@babylonjs/core/Materials/standardMaterial.js";import{RenderTargetTexture as nt}from"@babylonjs/core/Materials/Textures/renderTargetTexture.js";import{Color3 as I,Color4 as yn}from"@babylonjs/core/Maths/math.color.js";import{Vector3 as y}from"@babylonjs/core/Maths/math.vector.js";import{CreateGround as tt}from"@babylonjs/core/Meshes/Builders/groundBuilder.js";import{Mesh as ot}from"@babylonjs/core/Meshes/mesh.js";import{TransformNode as rt}from"@babylonjs/core/Meshes/transformNode.js";import{Scene as st}from"@babylonjs/core/scene.js";var Q=[-.5,-1,.35],vn=-Q[1]/Math.hypot(...Q),Fn={sky:.55,skyGround:[.3,.3,.34],sun:1},Bn={sky:.75,skyGround:[.45,.45,.5],sun:.6},nn=n=>n?Fn:Bn,Hn=.85,tn=(n,o,i,u)=>{let m=o/2/Hn/(Math.tan(i/2)*u);return Number.isFinite(m)?Math.max(n,m):n},on=n=>1-n*vn,jn=.35,Gn=1,Wn=.7,rn=(n,o)=>{let i=o*jn,u=o*Gn;return Wn*Math.min(1,Math.max(0,(n-i)/(u-i)))},zn=1,Vn=50,sn=(n,o)=>2*Vn*zn*n/o,ln=(n,o,i)=>{let u=i/(o-n);return{scaleY:u,offsetY:n-n*u}},an=(n,o)=>n===null?o:n/1e3,cn=(n,o,i)=>{if(o!==null)return o/1e3;let u=n.at(-1),m=n.at(-2);return u===void 0||m===void 0?i:(u.levelMm*2-m.levelMm)/1e3},be=3,dn=()=>{let n=be,o=[];return{invalidate:()=>{n=be},shouldDraw:(i,u)=>{let m=i.length!==o.length||i.some((c,w)=>c!==o[w]);return o=i,(m||u)&&(n=be),n>0},drawn:i=>{i&&(n=Math.max(0,n-1))}}},Un=[6,12],en=8,un=(n,o)=>Un.flatMap(i=>Array.from({length:en},(u,m)=>{let c=m/en*2*Math.PI;return{x:n+i*Math.cos(c),y:o+i*Math.sin(c)}})),Yn=Math.PI/4,mn=n=>Math.min(n,Yn),pn=(n,o,i,u)=>i/(2*n*Math.tan(o/2))/(1-u),hn=4,fn=(n,o,i,u)=>{let m=(i-n.y)/o.y;return m>0&&m<=u?{x:n.x+o.x*m,y:i,z:n.z+o.z*m}:null},gn=(n,o,i,u,m)=>{let c=n.x+o.x-i.x-u.x,w=n.z+o.z-i.z-u.z,L=Math.min(1,m/Math.hypot(c,w));return{x:u.x+c*L,y:n.y,z:u.z+w*L}};var it=[1,.78,.18],lt=2.7,at=4,In=1.1,ct=3,dt=5,ut=1.3,mt=2,ye=30,pt=.05,ht=1.3,ft=.35,gt=.25,bt=.25,Mt=.22,yt=.005,It=.05,St=2048,Et=.45,xt=3e-4,wt=2,Ot=.95,Pt=[.12,.16,.22,.55],Sn=new Set(["building","tank","slab","equipment"]),_t=new Set(["building","tank","equipment"]),At=n=>{let o=n.material;return o!==null&&"albedoColor"in o&&o.albedoColor instanceof I?o.albedoColor.toGammaSpace().toHexString():null},z=(n,o,i)=>{n.setEnabled(o!=="hidden"),n.visibility=o==="faint"?bt:1,n.isPickable=i&&o==="shown"},En=(n,o,i)=>{n.material=o,n.setEnabled(!0),n.visibility=i,n.isPickable=!1},Rt=n=>{let o=n.clone(`${n.name}-see-through`);if(o===null)throw new Error(`the site model's material ${n.name} cannot be copied`);return o.transparencyMode=On.MATERIAL_ALPHABLEND,o.backFaceCulling=!0,o},xn=n=>n.flatMap(o=>{let i=W(o,fe);return i===null?[]:[{mesh:o,part:i,detail:null,object:W(o,u=>ge(u,null))}]}),ee=n=>n.detail===null&&(n.part.role==="building"||n.part.role==="tank"),wn=n=>({min:n.reduce((o,i)=>y.Minimize(o,i.min),new y(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY)),max:n.reduce((o,i)=>y.Maximize(o,i.max),new y(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY))}),so=(n,o,i,u)=>{he(o);let m=new qn(n,!0,{stencil:!0,preserveDrawingBuffer:!1,limitDeviceRatio:2},!0),c=new st(m),w=dn(),L=t=>{let r=new Mn(t,c);return r.disableLighting=!0,r},Ie=t=>{let r=new Mn(t,c);return r.specularColor=I.Black(),r},Se=Ie("ground"),V=L("ink-lines");V.fillMode=On.LineListDrawMode;let ne=L("ink-text");ne.backFaceCulling=!1;let Ee=Ie("floor-slab"),U=L("floor-plate");U.alpha=ft,U.backFaceCulling=!1;let Y=new bn("sky",y.Up(),c),D=new Qn("sun",new y(...Q),c),v=new bn("ground-fill",y.Up(),c);v.groundColor=I.Black(),v.specular=I.Black();let T=tt("ground",{width:1,height:1},c);T.material=Se,T.isPickable=!1,T.receiveShadows=!0,Y.excludedMeshes=[T],v.includedOnlyMeshes=[T];let N=new et(St,D);N.usePercentageCloserFiltering=!0,N.setDarkness(Et),N.bias=xt,N.transparencyShadow=!0;let te=N.getShadowMap();if(te===null)throw new Error("the sun's shadow generator has no shadow map");te.refreshRate=nt.REFRESHRATE_RENDER_ONCE;let xe=new I,oe=new I,Pn=new yn(...Pt),re=0,A=i,F=Xe,B=!1,X=!0,se=()=>{},$=()=>{B=!1,w.invalidate()},we=()=>{I.LerpToRef(xe,oe,re,V.emissiveColor),ne.emissiveColor.copyFrom(V.emissiveColor)},Oe=t=>{let{sky:r,ground:p,ink:h,floor:g}=he(t);c.clearColor=yn.FromColor3(I.FromHexString(r),1),oe.copyFrom(I.FromHexString(p)),Se.diffuseColor.copyFrom(oe),xe.copyFrom(I.FromHexString(h)),we(),Ee.diffuseColor=I.FromHexString(g),U.emissiveColor=I.FromHexString(g),$()};Oe(o);let S=[],Pe=new Map,ie=new Map,_e=new Map,le=new Map,Ae=new Map,Re=new Map,ae=null,Te={isolated:null,floor:null,selection:null},Ne=new Jn("selection",c),_n=new I(...it),An=t=>S.filter(r=>r.object?.id===t&&r.part.role!=="lines"&&r.part.role!=="text"&&!(r.detail===null&&le.has(t))).map(r=>r.mesh),Rn=(t,r,p,h)=>{let g=t.object!==null&&Sn.has(t.part.role),M=Pe.get(t.mesh);if(M===void 0){z(t.mesh,r?"hidden":"shown",g);return}let a=h?.has(String(t.mesh.uniqueId))===!0;a?N.removeShadowCaster(t.mesh,!1):N.addShadowCaster(t.mesh,!1);let O=p!==void 0&&t.object?.id===p.buildingId;switch(Je({alone:r,open:O,envelope:A.envelope,near:a})){case"hidden":z(t.mesh,"hidden",g);break;case"envelope":En(t.mesh,M.seeThrough,Mt);break;case"see-through":En(t.mesh,M.seeThrough,gt);break;case"solid":t.mesh.material=M.solid,z(t.mesh,"shown",g);break}},De=t=>{Te=t;let r=ae===null||t.isolated===null?null:ae.find(a=>a.key===t.isolated);if(r===void 0)throw new Error(`no detailed building ${t.isolated} to show alone`);let p=t.selection===null?void 0:Re.get(t.selection.id),h=r===null?p:r,g=r===null&&p!==void 0?Ae.get(p.key):void 0;for(let a of S){if(a.detail===null){Rn(a,r!==null,h,g);continue}let O=a.object!==null&&Sn.has(a.part.role);if(a.detail.key!==h?.key){z(a.mesh,"hidden",O);continue}let P=a.part.floor;if(P===null)throw new Error(`a ${a.part.role} of detailed building ${a.detail.key} names no floor`);z(a.mesh,r===null?"shown":Ke(a.detail.floors,t.floor,P,a.part.role),O)}Ne.removeAllMeshes();let M=t.selection===null?[]:An(t.selection.id).filter(a=>a.isEnabled());for(let a of M)a instanceof ot&&Ne.addMesh(a,_n);return{isolated:r,selectedMeshes:M}},Tn=t=>{A.edges&&t.edgesRenderer===null&&(t.enableEdgesRendering(Ot,!0),t.edgesColor=Pn),t.edgesRenderer!==null&&(t.edgesRenderer.isEnabled=A.edges)},Nn=({mesh:t,object:r})=>{if(r?.kind!=="building")return;let{minimum:p,maximum:h}=t.getBoundingInfo().boundingBox,g=h.y-p.y,M=A.realHeights?_e.get(r.id)??null:null,a=le.get(r.id),O=a===void 0?an(M,g):cn(a.floors,M,g),{scaleY:P,offsetY:x}=ln(p.y,h.y,O);t.scaling.y=P,t.position.y=x},Z=()=>{let t=nn(A.shading);Y.intensity=t.sky,Y.groundColor=new I(...t.skyGround),D.intensity=t.sun,v.intensity=on(t.sun),D.shadowEnabled=A.shadows;for(let r of S)ee(r)&&(Tn(r.mesh),Nn(r));De(Te),X=!0,$()};Z();let Le=t=>{let{min:r,max:p}=wn(t),h=y.Center(r,p),g=Math.max(p.x-r.x,p.z-r.z)*ht;T.scaling=new y(g,1,g),T.position=new y(h.x,r.y-pt,h.z);let M=g*wt;D.position=h.subtract(D.direction.normalizeToNew().scale(M)),D.shadowMinZ=1,D.shadowMaxZ=M*2},Dn=t=>{let r=new Map;for(let{mesh:p}of t.filter(ee)){let h=p.material;if(h===null)throw new Error(`the site model's box ${p.name} has no material`);let g=r.get(h)??Rt(h);r.set(h,g),Pe.set(p,{solid:h,seeThrough:g})}},ke=t=>{for(let{mesh:r,part:p}of t)_t.has(p.role)&&N.addShadowCaster(r,!1);for(let r of t)r.mesh.receiveShadows=ee(r)||r.part.role==="slab"},Ce=new ResizeObserver(()=>{m.resize(),w.invalidate(),se()});Ce.observe(n);let ve=()=>w.invalidate();document.addEventListener("visibilitychange",ve),m.onContextRestoredObservable.add($);let k=new AbortController;return{load:async(t,r,p,h)=>{let g=await Me(t.massingUrl,c,{pluginExtension:".glb"});if(c.isDisposed)return;S.push(...xn(g.meshes)),Dn(S);let M=new Map(S.flatMap(e=>e.object?.kind==="building"?[[e.object.id,e.object]]:[]));for(let{buildingId:e,heightMm:l}of p){if(!M.has(e))throw new Error(`the height table names site building ${e}, which the site model does not have`);_e.set(e,l)}ke(S);let a=g.meshes[0].getHierarchyBoundingVectors(!0),O=y.Center(a.min,a.max),P=Math.max(a.max.x-a.min.x,a.max.z-a.min.z);Le([a]);let x=F,s=new $n("camera",Math.PI/2,Math.PI/3.2,P*In,O.clone(),c),ce=(e,l)=>tn(e,l,s.fov,n.clientWidth/n.clientHeight),de=()=>ce(P*In,P);s.radius=de(),s.lowerRadiusLimit=mt,s.upperBetaLimit=Math.PI/2.05,s.wheelDeltaPercentage=.02,s.attachControl(n,!0);let q=s.inputs.attached.pointers;q instanceof Zn&&(q.useNaturalPinchZoom=!0,q.multiTouchPanAndZoom=!1,q.multiTouchPanning=!1);let H=new Map,j=null,Fe=()=>{let[e,l]=[...H.values()],{origin:d,direction:f}=c.createPickingRay((e.x+l.x)/2,(e.y+l.y)/2,null,s);return fn(d,f,T.position.y,s.radius*hn)},Be=e=>{e.pointerType==="touch"&&(H.set(e.pointerId,{x:e.offsetX,y:e.offsetY}),e.type==="pointerdown"&&H.size===2&&(j=Fe()))},He=e=>{H.delete(e.pointerId)};n.addEventListener("pointerdown",Be,{signal:k.signal}),n.addEventListener("pointermove",Be,{signal:k.signal}),n.addEventListener("pointerup",He,{signal:k.signal}),n.addEventListener("pointercancel",He,{signal:k.signal}),n.addEventListener("touchend",e=>e.preventDefault(),{passive:!1,signal:k.signal});let Ln=()=>{if(H.size!==2){j=null;return}let e=Fe();if(e===null)return;if(j===null){j=e;return}let{x:l,y:d,z:f}=gn(s.target,j,e,O,P);s.target.copyFromFloats(l,d,f)};s.onProjectionMatrixChangedObservable.add(()=>qe(s.getProjectionMatrix(),x)),c.onBeforeRenderObservable.add(()=>{s.minZ=Math.max(It,s.radius*yt);let e=Ze(x,F,m.getDeltaTime()/1e3);(e.top!==x.top||e.bottom!==x.bottom)&&(x=e,s.getProjectionMatrix(!0));let l=A.fadeLines?rn(s.radius,P):0;if(l!==re&&(re=l,we()),A.edges){let d=sn(s.radius,n.clientHeight);for(let f of S)f.mesh.edgesWidth=d}});let ue=(e,l,d)=>{C.CreateAndStartAnimation("move-target",s,"target",60,ye,s.target.clone(),e,C.ANIMATIONLOOPMODE_CONSTANT),C.CreateAndStartAnimation("move-radius",s,"radius",60,ye,s.radius,l,C.ANIMATIONLOOPMODE_CONSTANT),d!==null&&C.CreateAndStartAnimation("move-beta",s,"beta",60,ye,s.beta,d,C.ANIMATIONLOOPMODE_CONSTANT)},je=null,Ge=null,We=e=>{let{isolated:l,selectedMeshes:d}=De(e),f=e.selection,E=l===null?null:l.key;if(E!==je)if(E===null)ue(O,de(),null);else{let b=ie.get(E);if(b!==void 0){let{min:_,max:R}=b.getHierarchyBoundingVectors(!0),J=y.Distance(_,R);ue(y.Center(_,R),ce(J*ut,J),null)}}else if(f!==null&&f!==Ge&&f.focus&&d.length>0){let{min:b,max:_}=wn(d.map(J=>J.getHierarchyBoundingVectors(!0))),R=y.Distance(b,_);ue(y.Center(b,_),ce(Math.max(R*ct,dt),R),mn(s.beta))}je=E,Ge=f,X=!0,$()},kn=(e,l)=>{let d=e===null?void 0:S.find(f=>f.mesh===e);if(d!==void 0||!l)return d;for(let{x:f,y:E}of un(c.pointerX,c.pointerY)){let{pickedMesh:b}=c.pick(f,E),_=b===null?void 0:S.find(R=>R.mesh===b);if(_!==void 0)return _}};c.onPointerObservable.add(e=>{if(e.type!==Kn.POINTERTAP)return;let l="pointerType"in e.event&&e.event.pointerType==="touch",d=kn(e.pickInfo?.hit===!0?e.pickInfo.pickedMesh:null,l);u(d===void 0?null:d.object)});let ze=()=>[...new Map(S.flatMap(e=>e.object===null?[]:[[e.object.id,e.object]])).values()],me=[],pe=(e,l)=>{if(l===void 0)return;let d=At(l.mesh);if(d===null)throw new Error(`the site model's box ${l.mesh.name} (${e}) has no PBR base colour`);me.push({label:e,color:d})},K=S.filter(ee);pe("\u540D\u524D\u306E\u3042\u308B\u5EFA\u5C4B",K.find(e=>e.object?.kind==="building"&&e.object.name!=="")),pe("\u540D\u524D\u306E\u7121\u3044\u5EFA\u5C4B",K.find(e=>e.object?.kind==="building"&&e.object.name==="")),pe("\u30BF\u30F3\u30AF",K.find(e=>e.part.role==="tank")),Z(),se=()=>c.render(!1),m.runRenderLoop(()=>{s.panningSensibility=pn(s.radius,s.fov,n.clientHeight*(1-x.top-x.bottom),s.panningInertia),s.upperRadiusLimit=de()*lt,s.maxZ=s.upperRadiusLimit*at,s.update(),Ln();let e=x.top!==F.top||x.bottom!==F.bottom,l=[s.alpha,s.beta,s.radius,s.target.x,s.target.y,s.target.z];w.shouldDraw(l,e||c.animatables.length>0)&&(n.dataset.cameraPose=l.join(" "),B=B||c.isReady(),B&&X&&(X=!1,te.resetRefreshCounter()),se(),w.drawn(B))}),h({objects:ze(),legend:me,complete:!1,show:We});let[Ve,...Ue]=await Promise.all([Me(t.linesUrl,c,{pluginExtension:".glb"}),...r.map(e=>Me(e.glbUrl,c,{pluginExtension:".glb"}))]);if(c.isDisposed)return;let G=xn(Ve.meshes);r.forEach((e,l)=>{let d=M.get(e.buildingId);if(d===void 0)throw new Error(`detailed building ${e.key} replaces site building ${e.buildingId}, which the site model does not have`);let f=new rt(`detail-${e.key}`,c);f.rotation.y=e.placement.rotationY,f.position=new y(...e.placement.position),Ue[l].meshes[0].parent=f,ie.set(e.key,f),le.set(e.buildingId,e);for(let E of Ue[l].meshes){let b=W(E,fe);if(b===null)continue;if(b.floor===null)throw new Error(`a ${b.role} of detailed building ${e.key} names no floor`);let _=b.role==="slab"||b.role==="plate"?d:W(E,R=>ge(R,e.key));G.push({mesh:E,part:b,detail:e,object:_})}});for(let e of G)switch(e.part.role){case"lines":e.mesh.material=V;break;case"text":e.mesh.material=ne;break;case"slab":e.mesh.material=Ee,Y.excludedMeshes.push(e.mesh),v.includedOnlyMeshes.push(e.mesh);break;case"plate":e.mesh.material=U;break;default:break}S.push(...G),ke(G);let Ye=[...ie.values()].map(e=>e.getHierarchyBoundingVectors(!0));Le([a,Ve.meshes[0].getHierarchyBoundingVectors(!0),...Ye]);let Cn=e=>{let{minimumWorld:l,maximumWorld:d}=e.getBoundingInfo().boundingBox;return{minX:l.x,maxX:d.x,minZ:l.z,maxZ:d.z}};r.forEach((e,l)=>{let{min:d,max:f}=Ye[l],E=K.filter(b=>b.object?.id!==e.buildingId).map(b=>({id:String(b.mesh.uniqueId),footprint:Cn(b.mesh)}));Ae.set(e.key,new Set(Qe({minX:d.x,maxX:f.x,minZ:d.z,maxZ:f.z},E)))});for(let e of G)e.detail!==null&&e.object!==null&&Re.set(e.object.id,e.detail);ae=r,Z(),h({objects:ze(),legend:me,complete:!0,show:We})},paint:Oe,inset:t=>{F=$e(t)},options:t=>{A=t,Z()},close:()=>{Ce.disconnect(),document.removeEventListener("visibilitychange",ve),k.abort(),m.stopRenderLoop(),c.dispose(),m.dispose()}}};export{so as openPlantSceneView};
|
package/package.json
CHANGED
|
@@ -1,6 +1,72 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiquants/plant-scene",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "React 3D view of a plant site drawn with Babylon.js: site massing and drawing lines from GLB, detailed buildings by floor, an orbit camera moved by fingers, picking and display options.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"README.md",
|
|
17
|
+
"CHANGELOG.md",
|
|
18
|
+
"LICENSE"
|
|
19
|
+
],
|
|
20
|
+
"keywords": [
|
|
21
|
+
"babylonjs",
|
|
22
|
+
"glb",
|
|
23
|
+
"gltf",
|
|
24
|
+
"3d",
|
|
25
|
+
"plant",
|
|
26
|
+
"react",
|
|
27
|
+
"typescript"
|
|
28
|
+
],
|
|
29
|
+
"author": "AI Quants",
|
|
30
|
+
"license": "MIT",
|
|
31
|
+
"peerDependencies": {
|
|
32
|
+
"@babylonjs/core": "^9.31.0",
|
|
33
|
+
"@babylonjs/loaders": "^9.31.0",
|
|
34
|
+
"react": ">=19.2.0",
|
|
35
|
+
"zod": "^3.25.0"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@babylonjs/core": "^9.31.0",
|
|
39
|
+
"@babylonjs/loaders": "^9.31.0",
|
|
40
|
+
"@testing-library/react": "^16.3.2",
|
|
41
|
+
"@types/node": "^25.9.1",
|
|
42
|
+
"@types/react": "^19.2.7",
|
|
43
|
+
"@types/react-dom": "^19.2.3",
|
|
44
|
+
"jsdom": "^27.4.0",
|
|
45
|
+
"react": "^19.2.7",
|
|
46
|
+
"react-dom": "^19.2.7",
|
|
47
|
+
"rimraf": "^6.1.2",
|
|
48
|
+
"tsup": "^8.5.1",
|
|
49
|
+
"typescript": "^5.9.3",
|
|
50
|
+
"vitest": "^4.1.10",
|
|
51
|
+
"zod": "^3.25.76"
|
|
52
|
+
},
|
|
53
|
+
"publishConfig": {
|
|
54
|
+
"access": "public"
|
|
55
|
+
},
|
|
56
|
+
"scripts": {
|
|
57
|
+
"build": "pnpm -w run workspace:build \"$PNPM_SCRIPT_SRC_DIR\"",
|
|
58
|
+
"prebuild:self": "pnpm -w run workspace:sync \"$PNPM_SCRIPT_SRC_DIR\"",
|
|
59
|
+
"build:self": "tsup && node ../../.config/scripts/strip-dts-comments.mjs dist && node scripts/check-dist.mjs dist",
|
|
60
|
+
"typecheck": "tsc --noEmit",
|
|
61
|
+
"clean": "rimraf dist",
|
|
62
|
+
"test": "vitest run",
|
|
63
|
+
"test:scripts": "node --test scripts/check-dist.test.mjs",
|
|
64
|
+
"check": "biome check src/ scripts/",
|
|
65
|
+
"check:fix": "biome check --write src/ scripts/",
|
|
66
|
+
"check:md": "cd ../.. && node_modules/.bin/markdownlint-cli2 \"packages/plant-scene/**/*.md\"",
|
|
67
|
+
"verify": "node_modules/.bin/tsc --noEmit && node_modules/.bin/tsc --noEmit -p tsconfig.spec.json && ../../node_modules/.bin/biome check src/ scripts/ && pnpm run check:md && node_modules/.bin/vitest run && node --test scripts/check-dist.test.mjs",
|
|
68
|
+
"publish:patch": "pnpm run verify && pnpm run build && node ../../.config/scripts/check-publish-leaks.mjs && pnpm version patch --no-git-tag-version --no-git-checks && pnpm publish --no-git-checks",
|
|
69
|
+
"publish:minor": "pnpm run verify && pnpm run build && node ../../.config/scripts/check-publish-leaks.mjs && pnpm version minor --no-git-tag-version --no-git-checks && pnpm publish --no-git-checks",
|
|
70
|
+
"publish:major": "pnpm run verify && pnpm run build && node ../../.config/scripts/check-publish-leaks.mjs && pnpm version major --no-git-tag-version --no-git-checks && pnpm publish --no-git-checks"
|
|
71
|
+
}
|
|
6
72
|
}
|