@hatiolab/things-scene 9.0.0-beta.31 → 9.0.0-beta.32
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/package.json +1 -1
- package/things-scene.d.ts +762 -0
- package/things-scene.mjs +1 -1
package/package.json
CHANGED
|
@@ -0,0 +1,762 @@
|
|
|
1
|
+
declare module '@hatiolab/things-scene' {
|
|
2
|
+
type Constructor<T = {}> = new (...args: any[]) => T
|
|
3
|
+
type Class = { new (...args: any[]): any }
|
|
4
|
+
type Properties = { [key: string]: any }
|
|
5
|
+
type State = Properties
|
|
6
|
+
type Style = Properties
|
|
7
|
+
type Decorator = (component: Component, context: CanvasRenderingContext2D, delta?: number) => boolean
|
|
8
|
+
type PopupOptions = {
|
|
9
|
+
data: any
|
|
10
|
+
location: 'center' | 'left-top' | 'right-top' | 'left-bottom' | 'right-bottom'
|
|
11
|
+
modal: boolean
|
|
12
|
+
closable: boolean
|
|
13
|
+
output: boolean
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
type ChangeFunction = (selector: string, value: any, self: any) => Component[]
|
|
17
|
+
|
|
18
|
+
const MODE_VIEW = 0
|
|
19
|
+
const MODE_EDIT = 1
|
|
20
|
+
const MODE_SHIFT = 2
|
|
21
|
+
const MODE_ADD = 3
|
|
22
|
+
const MODE_PASTE_STYLE = 4
|
|
23
|
+
const MODE_PASTE_DATABIND = 5
|
|
24
|
+
|
|
25
|
+
enum SCENE_MODE {
|
|
26
|
+
VIEW = 0,
|
|
27
|
+
EDIT = 1,
|
|
28
|
+
SHIFT = 2,
|
|
29
|
+
ADD = 3,
|
|
30
|
+
PASTE_STYLE = 4,
|
|
31
|
+
PASTE_DATABIND = 5
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
type FITMODE = 'both' | 'ratio' | 'width' | 'height' | 'center' | 'none'
|
|
35
|
+
type POINT = { x: number; y: number; z?: number }
|
|
36
|
+
type SCALE = POINT
|
|
37
|
+
type TRANSLATE = POINT
|
|
38
|
+
type POSITION = POINT
|
|
39
|
+
type LOCATION = POINT
|
|
40
|
+
type ROTATION = POINT
|
|
41
|
+
type DIMENSION = { width: number; height: number; depth: number }
|
|
42
|
+
type BOUNDS = { left: number; top: number; width: number; height: number }
|
|
43
|
+
type DELTA = {
|
|
44
|
+
tx?: number
|
|
45
|
+
ty?: number
|
|
46
|
+
tz?: number
|
|
47
|
+
sx?: number
|
|
48
|
+
sy?: number
|
|
49
|
+
sz?: number
|
|
50
|
+
rx?: number
|
|
51
|
+
ry?: number
|
|
52
|
+
rz?: number
|
|
53
|
+
theta?: number
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
type ComponentNature = {
|
|
57
|
+
mutable?: boolean
|
|
58
|
+
resizable?: boolean
|
|
59
|
+
rotatable?: boolean
|
|
60
|
+
properties?: {
|
|
61
|
+
type: string
|
|
62
|
+
label: string
|
|
63
|
+
name: string
|
|
64
|
+
placeholder?: string
|
|
65
|
+
observe?: (this: HTMLElement, value: any) => void
|
|
66
|
+
readonly?: boolean
|
|
67
|
+
editor?: {
|
|
68
|
+
fullwidth?: boolean
|
|
69
|
+
}
|
|
70
|
+
property?:
|
|
71
|
+
| {
|
|
72
|
+
options?: any
|
|
73
|
+
[key: string]: any
|
|
74
|
+
}
|
|
75
|
+
| string
|
|
76
|
+
}[]
|
|
77
|
+
'value-property'?: string
|
|
78
|
+
valueProperty?: string
|
|
79
|
+
help?: string
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
type ReferenceProvider = {
|
|
83
|
+
get ids(): string[]
|
|
84
|
+
add(id: string, target?: any): Promise<Scene & { release: () => void }>
|
|
85
|
+
get(id: string, createIf?: boolean): Promise<Scene & { release: () => void }>
|
|
86
|
+
create(id: string): Promise<Scene & { release: () => void }>
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
type DataSubscriptionProvider = {
|
|
90
|
+
subscribe(tag: string, component: Component): Promise<{ unsubscribe: () => void }>
|
|
91
|
+
dispose(): void
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
interface LAYOUT {
|
|
95
|
+
reflow: (container: Container) => void
|
|
96
|
+
capturables?: (container: Container) => Component[]
|
|
97
|
+
drawables?: (container: Container) => Component[]
|
|
98
|
+
isStuck?: (component: Container) => boolean
|
|
99
|
+
keyNavigate?: (container: Container, component: Component, e: KeyboardEvent) => Component | undefined
|
|
100
|
+
joinType?: boolean
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
interface LayoutRegistry {
|
|
104
|
+
register(name: string, layout: LAYOUT): void
|
|
105
|
+
unregister(name: string): void
|
|
106
|
+
get(name: string): LAYOUT
|
|
107
|
+
list(): { [name: string]: LAYOUT }
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const Layout: LayoutRegistry
|
|
111
|
+
|
|
112
|
+
const AbsoluteLayout: LAYOUT & { ABSOLUTE: boolean }
|
|
113
|
+
const TableLayout: LAYOUT
|
|
114
|
+
const CardLayout: LAYOUT
|
|
115
|
+
const HTMLAbsoluteLayout: LAYOUT
|
|
116
|
+
const LinearHorizontalLayout: LAYOUT
|
|
117
|
+
const LinearVerticalLayout: LAYOUT
|
|
118
|
+
|
|
119
|
+
interface PersistentDataStorage {
|
|
120
|
+
load(key: object): Promise<any>
|
|
121
|
+
save(key: object, value: any): Promise<void>
|
|
122
|
+
clear(key: object): Promise<void>
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
type AnimationConfig = {
|
|
126
|
+
duration?: number
|
|
127
|
+
delay?: number
|
|
128
|
+
step: Function
|
|
129
|
+
delta: 'linear' | 'quad' | 'circ' | 'back' | 'bounce' | 'elastic' | Function
|
|
130
|
+
ease: 'in' | 'out' | 'inout'
|
|
131
|
+
options?: object
|
|
132
|
+
repeat?: boolean
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
type ControlHandler = {
|
|
136
|
+
ondragstart?(point: POSITION, index: number, component: Component): void
|
|
137
|
+
ondragmove?(point: POSITION, index: number, component: Component): void
|
|
138
|
+
ondragend?(point: POSITION, index: number, component: Component): void
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
interface Control extends POINT {
|
|
142
|
+
handler: ControlHandler
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function create({
|
|
146
|
+
target,
|
|
147
|
+
model,
|
|
148
|
+
style,
|
|
149
|
+
layers,
|
|
150
|
+
handlers,
|
|
151
|
+
mode,
|
|
152
|
+
refProvider,
|
|
153
|
+
dataSubscriptionProvider,
|
|
154
|
+
dataStorage,
|
|
155
|
+
baseUrl,
|
|
156
|
+
fitMode
|
|
157
|
+
}: {
|
|
158
|
+
target?: HTMLElement
|
|
159
|
+
model: Object
|
|
160
|
+
style?: any
|
|
161
|
+
layers?: Array<any>
|
|
162
|
+
handlers?: Array<any>
|
|
163
|
+
mode?: SCENE_MODE
|
|
164
|
+
refProvider?: ReferenceProvider
|
|
165
|
+
dataSubscriptionProvider?: DataSubscriptionProvider
|
|
166
|
+
dataStorage?: PersistentDataStorage
|
|
167
|
+
baseUrl?: string | undefined
|
|
168
|
+
fitMode?: FITMODE
|
|
169
|
+
}): Scene
|
|
170
|
+
|
|
171
|
+
function error(...args: any[]): void
|
|
172
|
+
function warn(...args: any[]): void
|
|
173
|
+
function debug(...args: any[]): void
|
|
174
|
+
|
|
175
|
+
function FPS(): number
|
|
176
|
+
|
|
177
|
+
type EventHandler = (e: Event, ...args: any[]) => void
|
|
178
|
+
|
|
179
|
+
interface EventPropagation {
|
|
180
|
+
[delegator: string]: {
|
|
181
|
+
[target: string]: {
|
|
182
|
+
[event: string]: EventHandler
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
class EventMap {
|
|
188
|
+
static get(name: string): any
|
|
189
|
+
static register(name: string, EventMap: any): void
|
|
190
|
+
static unregister(name: string): void
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
class ReferenceMap<T> {
|
|
194
|
+
constructor(
|
|
195
|
+
creator: (boardId: string, resolve: (target: T) => void, reject: (error: any) => void) => Promise<T>,
|
|
196
|
+
disposer: (id: string, ref: T) => Promise<void>
|
|
197
|
+
)
|
|
198
|
+
get(id: string, createIf?: boolean): Promise<T & { release: () => void }>
|
|
199
|
+
get ids(): string[]
|
|
200
|
+
add(id: string, target: any): Promise<T & { release: () => void }>
|
|
201
|
+
create(id: string): Promise<T & { release: () => void }>
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
class ScriptLoader {
|
|
205
|
+
static load(scripts: string | Array<string>, styles?: string | Array<string>): Promise<void>
|
|
206
|
+
}
|
|
207
|
+
class ScenePopup {
|
|
208
|
+
static hideAll(root: Component): void
|
|
209
|
+
static hide(component: Component): void
|
|
210
|
+
static show(component: Component, ref: string, options: PopupOptions): void
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
type Anchor = {
|
|
214
|
+
name: string
|
|
215
|
+
position: POSITION
|
|
216
|
+
bounds?: BOUNDS
|
|
217
|
+
inout?: 'in' | 'out' | 'inout'
|
|
218
|
+
type?: string
|
|
219
|
+
multiplicity?: number
|
|
220
|
+
draw?: (this: Anchor, context: CanvasRenderingContext2D, component: Component) => void
|
|
221
|
+
filter?: (this: Anchor, linkEnd?: LinkEnd) => boolean
|
|
222
|
+
template?: any
|
|
223
|
+
[prop: string]: any
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
type LinkEndConfig = {
|
|
227
|
+
component: string /** end component refid */
|
|
228
|
+
anchor: string /** end anchor name of end component */
|
|
229
|
+
position: POSITION /** position of the link end */
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
class LinkEnd {
|
|
233
|
+
component: Component
|
|
234
|
+
anchor: Anchor
|
|
235
|
+
position: POSITION
|
|
236
|
+
fromto: 'from' | 'to'
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
class Model {
|
|
240
|
+
static compile(model: Model, context?: any): Component
|
|
241
|
+
|
|
242
|
+
type?: string;
|
|
243
|
+
[key: string]: any
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
class ApplicationContext {
|
|
247
|
+
readonly refProvider: ReferenceProvider
|
|
248
|
+
readonly dataStorage: PersistentDataStorage
|
|
249
|
+
readonly dataSubscriptionProvider: DataSubscriptionProvider
|
|
250
|
+
readonly isViewMode: boolean
|
|
251
|
+
readonly isEditMode: boolean
|
|
252
|
+
|
|
253
|
+
mode: SCENE_MODE
|
|
254
|
+
baseUrl: string
|
|
255
|
+
|
|
256
|
+
url(x: string): string
|
|
257
|
+
dispose(): void
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/* mixins */
|
|
261
|
+
|
|
262
|
+
function RectPath<TBase extends Constructor>(Base: TBase): TBase
|
|
263
|
+
|
|
264
|
+
function ValueHolder<TBase extends Constructor>(
|
|
265
|
+
Base: TBase
|
|
266
|
+
): {
|
|
267
|
+
new (...args: any[]): {
|
|
268
|
+
value: number
|
|
269
|
+
animValue: number
|
|
270
|
+
animOnValueChange(value: number, animFromBase: boolean, base: number): void
|
|
271
|
+
}
|
|
272
|
+
} & TBase
|
|
273
|
+
|
|
274
|
+
function DataSource<TBase extends Constructor>(
|
|
275
|
+
Base: TBase
|
|
276
|
+
): {
|
|
277
|
+
new (...args: any[]): {
|
|
278
|
+
isDataSource(): boolean
|
|
279
|
+
_convertDataFormat(data: any, format: 'json' | 'text' | 'jsonp' | string): any
|
|
280
|
+
}
|
|
281
|
+
} & TBase
|
|
282
|
+
|
|
283
|
+
function MoveHandle<TBase extends Constructor>(Base: TBase): TBase
|
|
284
|
+
|
|
285
|
+
function Connectable<TBase extends Constructor>(
|
|
286
|
+
Base: TBase
|
|
287
|
+
): {
|
|
288
|
+
new (...args: any[]): {
|
|
289
|
+
findOutletLines(anchorName: string): Line[]
|
|
290
|
+
findOutletEnds(anchorName: string): Component[]
|
|
291
|
+
findInletLines(anchorName: string): Line[]
|
|
292
|
+
findInletEnds(anchorName: string): Component[]
|
|
293
|
+
}
|
|
294
|
+
} & TBase
|
|
295
|
+
|
|
296
|
+
function MixinHTMLElement<TBase extends Constructor>(
|
|
297
|
+
Base: TBase
|
|
298
|
+
): {
|
|
299
|
+
new (...args: any[]): {
|
|
300
|
+
get tagName(): string
|
|
301
|
+
element: HTMLElement
|
|
302
|
+
|
|
303
|
+
createElement(): void
|
|
304
|
+
userInputEventHandler(e: Event): void
|
|
305
|
+
reposition(): void
|
|
306
|
+
disposeElement(): void
|
|
307
|
+
}
|
|
308
|
+
} & TBase
|
|
309
|
+
|
|
310
|
+
function MixinEvent<TBase extends Constructor>(
|
|
311
|
+
Base: TBase
|
|
312
|
+
): {
|
|
313
|
+
new (...args: any[]): {
|
|
314
|
+
on(name: string, callback: Function, context?: any): void
|
|
315
|
+
off(name: string, callback: Function, context?: any): void
|
|
316
|
+
once(name: string, callback: Function, context?: any): void
|
|
317
|
+
trigger(name: string, ...others: any[]): void
|
|
318
|
+
}
|
|
319
|
+
} & TBase
|
|
320
|
+
|
|
321
|
+
/* components */
|
|
322
|
+
|
|
323
|
+
class Component extends MixinEvent(Object) {
|
|
324
|
+
static register(type: string, Clazz?: typeof Component): void
|
|
325
|
+
static memoize(base: any, property: string, needClone: boolean): void
|
|
326
|
+
static drawStroke(context: CanvasRenderingContext2D, style: Style): void
|
|
327
|
+
static buildSubstitutor(
|
|
328
|
+
expression: string,
|
|
329
|
+
component: Component,
|
|
330
|
+
customObjToVal?: (obj: any) => any
|
|
331
|
+
): () => string | undefined
|
|
332
|
+
static reposition(component: Component): void
|
|
333
|
+
static registerDecorator(name: string, decorator: Decorator): void
|
|
334
|
+
static createCanvas(width: number, height: number): HTMLCanvasElement
|
|
335
|
+
static template(
|
|
336
|
+
template: string,
|
|
337
|
+
options?: {
|
|
338
|
+
escape?: RegExp
|
|
339
|
+
evaluate?: RegExp
|
|
340
|
+
imports?: any
|
|
341
|
+
interpolate?: RegExp
|
|
342
|
+
sourceURL?: string
|
|
343
|
+
variable?: string
|
|
344
|
+
}
|
|
345
|
+
): any
|
|
346
|
+
|
|
347
|
+
state: Properties
|
|
348
|
+
root: RootContainer
|
|
349
|
+
rootModel: ModelLayer
|
|
350
|
+
parent: ContainerAbstract
|
|
351
|
+
app: ApplicationContext
|
|
352
|
+
|
|
353
|
+
get nature(): ComponentNature
|
|
354
|
+
|
|
355
|
+
get bounds(): BOUNDS
|
|
356
|
+
set bounds(bounds: BOUNDS)
|
|
357
|
+
|
|
358
|
+
get model(): Model
|
|
359
|
+
get hierarchy(): Model
|
|
360
|
+
|
|
361
|
+
get disposed(): boolean
|
|
362
|
+
get font(): string
|
|
363
|
+
|
|
364
|
+
get data(): any
|
|
365
|
+
set data(data: any)
|
|
366
|
+
|
|
367
|
+
get hidden(): boolean
|
|
368
|
+
set hidden(hidden: boolean)
|
|
369
|
+
|
|
370
|
+
get value(): any
|
|
371
|
+
set value(value: any)
|
|
372
|
+
|
|
373
|
+
get text(): string
|
|
374
|
+
set text(text: string)
|
|
375
|
+
|
|
376
|
+
get textBounds(): BOUNDS
|
|
377
|
+
get textRotation(): number
|
|
378
|
+
|
|
379
|
+
get path(): Array<POINT>
|
|
380
|
+
set path(path: Array<POINT>)
|
|
381
|
+
|
|
382
|
+
get center(): POINT
|
|
383
|
+
set center(point: POINT)
|
|
384
|
+
|
|
385
|
+
get location(): POINT
|
|
386
|
+
set location(location: POINT)
|
|
387
|
+
|
|
388
|
+
get rotate(): ROTATION
|
|
389
|
+
set rotate(rotation: ROTATION)
|
|
390
|
+
|
|
391
|
+
get dimension(): DIMENSION
|
|
392
|
+
set dimension(dimension: DIMENSION)
|
|
393
|
+
|
|
394
|
+
get strokeStyle(): any
|
|
395
|
+
set strokeStyle(strokeStyle: any)
|
|
396
|
+
|
|
397
|
+
get fillStyle(): any
|
|
398
|
+
set fillStyle(fillStyle: any)
|
|
399
|
+
|
|
400
|
+
get anchors(): Array<Anchor>
|
|
401
|
+
get controls(): Array<Control> | undefined
|
|
402
|
+
get hasTextProperty(): boolean
|
|
403
|
+
get textSubstitutor(): () => string
|
|
404
|
+
|
|
405
|
+
get decorators(): Array<string | Decorator>
|
|
406
|
+
get reactionDecorators(): Array<string | Decorator>
|
|
407
|
+
|
|
408
|
+
get started(): boolean
|
|
409
|
+
set started(started: boolean)
|
|
410
|
+
|
|
411
|
+
resetAnimation(): void
|
|
412
|
+
|
|
413
|
+
isRootModel(): boolean
|
|
414
|
+
isContainer(): boolean
|
|
415
|
+
isLine(): boolean
|
|
416
|
+
isLayer(): boolean
|
|
417
|
+
is3dish(): boolean
|
|
418
|
+
isHTMLElement(): boolean
|
|
419
|
+
isConnectable(): boolean
|
|
420
|
+
isIdentifiable(): boolean
|
|
421
|
+
isTemplate(): boolean
|
|
422
|
+
isIn3DSpace(): boolean
|
|
423
|
+
|
|
424
|
+
ready(): void
|
|
425
|
+
dispose(): void
|
|
426
|
+
getState(prop: string): any
|
|
427
|
+
setState(props: Properties | any, value?: any): void
|
|
428
|
+
get(prop: string): any
|
|
429
|
+
contains(x: number, y: number): boolean
|
|
430
|
+
set(props: Properties | string, value?: any): void
|
|
431
|
+
reposition(): void
|
|
432
|
+
clearCache(): void
|
|
433
|
+
|
|
434
|
+
/*
|
|
435
|
+
* selector에 해당하는 모든 컴포넌트들을 찾는다.
|
|
436
|
+
* @params selector {string}
|
|
437
|
+
*/
|
|
438
|
+
findAll(selector: string, component?: Component): Array<Component>
|
|
439
|
+
|
|
440
|
+
/*
|
|
441
|
+
* selector에 해당하는 첫번째 컴포넌트를 찾는다.
|
|
442
|
+
* @params selector {string}
|
|
443
|
+
*/
|
|
444
|
+
findFirst(selector: string, ...others: any[]): Component
|
|
445
|
+
|
|
446
|
+
prepareIf(condition: boolean): void
|
|
447
|
+
mutatePath(
|
|
448
|
+
beforeLogic: ((path: Array<POINT>) => void) | null,
|
|
449
|
+
afterLogic: ((path: Array<POINT>) => void) | null,
|
|
450
|
+
context?: any
|
|
451
|
+
): void
|
|
452
|
+
|
|
453
|
+
transcoordP2S(x: number, y: number): POSITION
|
|
454
|
+
transcoordC2S(x: number, y: number, top?: RootContainer): POSITION
|
|
455
|
+
transcoordS2T(x: number, y: number): POSITION
|
|
456
|
+
transcoordS2C(x: number, y: number, top?: RootContainer): POSITION
|
|
457
|
+
|
|
458
|
+
prerender(context: CanvasRenderingContext2D): void
|
|
459
|
+
render(context: CanvasRenderingContext2D): void
|
|
460
|
+
postrender(context: CanvasRenderingContext2D): void
|
|
461
|
+
|
|
462
|
+
executeMappings(force?: boolean): void
|
|
463
|
+
invalidate(): void
|
|
464
|
+
animate(config: AnimationConfig): {
|
|
465
|
+
start: Function
|
|
466
|
+
stop: Function
|
|
467
|
+
}
|
|
468
|
+
delta(attr?: string, value?: number): DELTA | void
|
|
469
|
+
|
|
470
|
+
access(expression: string): any
|
|
471
|
+
substitute(expression: string, customObjToVal?: (obj: any) => any): string
|
|
472
|
+
|
|
473
|
+
onchange(after: Properties, before: Properties): void
|
|
474
|
+
onchangeData(after: Properties, before: Properties): void
|
|
475
|
+
onchangeMappings(after: Properties, before: Properties): void
|
|
476
|
+
|
|
477
|
+
drawImage(
|
|
478
|
+
context: CanvasRenderingContext2D,
|
|
479
|
+
image: HTMLImageElement,
|
|
480
|
+
left: number,
|
|
481
|
+
top: number,
|
|
482
|
+
width: number,
|
|
483
|
+
height: number
|
|
484
|
+
): void
|
|
485
|
+
drawStroke(context: CanvasRenderingContext2D, override?: { [prop: string]: any }): void
|
|
486
|
+
drawFill(context: CanvasRenderingContext2D, override?: { [prop: string]: any }): void
|
|
487
|
+
drawText(context: CanvasRenderingContext2D): void
|
|
488
|
+
move(position: { x: number; y: number }, absolutely?: boolean): void
|
|
489
|
+
|
|
490
|
+
ondblclick(e: MouseEvent): void
|
|
491
|
+
|
|
492
|
+
closeScene(data: any): void
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
class ContainerAbstract extends MoveHandle(RectPath(Component)) {
|
|
496
|
+
indexOf(component: Component): number
|
|
497
|
+
size(): number
|
|
498
|
+
addComponent(target: Component, ghost?: boolean): void
|
|
499
|
+
removeComponent(target: Component, ghost?: boolean): void
|
|
500
|
+
insertComponentAt(target: Component, idx: number, ghost?: boolean): void
|
|
501
|
+
findById(id: string): Component | undefined
|
|
502
|
+
findAllById(id: string): Component[]
|
|
503
|
+
getAt(at: number): Component | undefined
|
|
504
|
+
|
|
505
|
+
reflow(): void
|
|
506
|
+
|
|
507
|
+
add(components: Component[] | Component, ghost?: boolean): Container
|
|
508
|
+
remove(components: Component[] | Component, ghost?: boolean): Container
|
|
509
|
+
|
|
510
|
+
components: Component[]
|
|
511
|
+
}
|
|
512
|
+
class Container extends MixinHTMLElement(ContainerAbstract) {}
|
|
513
|
+
class RootContainer extends Container {
|
|
514
|
+
get selected(): Component[]
|
|
515
|
+
set selected(selected: Component[])
|
|
516
|
+
get style(): { [key: string]: any }
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
class Layer extends ContainerAbstract {
|
|
520
|
+
target: HTMLElement | null
|
|
521
|
+
canvas: HTMLCanvasElement | null
|
|
522
|
+
|
|
523
|
+
getContext(): CanvasRenderingContext2D
|
|
524
|
+
centerTo(component: Component, animated?: boolean): void
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
class ModelLayer extends Layer {
|
|
528
|
+
overlay: HTMLDivElement
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
class InfoWindow extends RectPath(Shape) {}
|
|
532
|
+
class Text extends RectPath(Component) {}
|
|
533
|
+
class Shape extends Component {}
|
|
534
|
+
class Ellipse extends Shape {}
|
|
535
|
+
class Polygon extends Shape {}
|
|
536
|
+
class Line extends Component {
|
|
537
|
+
get fromEnd(): LinkEnd | undefined
|
|
538
|
+
get toEnd(): LinkEnd | undefined
|
|
539
|
+
get from(): LinkEndConfig
|
|
540
|
+
get to(): LinkEndConfig
|
|
541
|
+
}
|
|
542
|
+
class OrthoLine extends Line {}
|
|
543
|
+
class Donut extends Ellipse {}
|
|
544
|
+
class Rect extends RectPath(Shape) {}
|
|
545
|
+
class HTMLOverlayElement extends MixinHTMLElement(RectPath(Component)) {}
|
|
546
|
+
|
|
547
|
+
class HTMLOverlayContainer extends Container {
|
|
548
|
+
readonly layout: any
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
/* Scene API */
|
|
552
|
+
|
|
553
|
+
class Scene {
|
|
554
|
+
static readonly residents: WeakSet<Scene>
|
|
555
|
+
static readonly DPPX: number
|
|
556
|
+
|
|
557
|
+
/**
|
|
558
|
+
* scene에 컴포넌트를 추가한다.
|
|
559
|
+
* @param models {object} - Component Model Object
|
|
560
|
+
* @param boundsOrOffset {object} - x, y, cx, cy, ...
|
|
561
|
+
* @param onto {string} - onto
|
|
562
|
+
*/
|
|
563
|
+
add(
|
|
564
|
+
models: Model,
|
|
565
|
+
boundsOrOffset?: {
|
|
566
|
+
left?: number
|
|
567
|
+
top?: number
|
|
568
|
+
width?: number
|
|
569
|
+
height?: number
|
|
570
|
+
x?: number
|
|
571
|
+
y?: number
|
|
572
|
+
cx?: number
|
|
573
|
+
cy?: number
|
|
574
|
+
},
|
|
575
|
+
onto?: string
|
|
576
|
+
): Component
|
|
577
|
+
|
|
578
|
+
/**
|
|
579
|
+
* scene에 컴포넌트를 추가하는 모드를 시작한다.
|
|
580
|
+
* @param models {object} - Component Model Object
|
|
581
|
+
*/
|
|
582
|
+
startAddMode(models: Model): void
|
|
583
|
+
|
|
584
|
+
/**
|
|
585
|
+
* scene의 컴포넌트를 복제한다.
|
|
586
|
+
* 현재 선택되어있는 컴포넌트가 복제되므로, 컴포넌트를 복제하기 위해서는
|
|
587
|
+
* 먼저 복제하고자하는 컴포넌트를 선택된 상태로 만든 후에(참조. {@link select} 메쏘드) 이 메쏘드를 호출한다.
|
|
588
|
+
*/
|
|
589
|
+
duplicate(): void
|
|
590
|
+
|
|
591
|
+
/**
|
|
592
|
+
* scene의 컴포넌트를 삭제한다.
|
|
593
|
+
* 현재 선택되어있는 컴포넌트가 삭제되므로, 컴포넌트를 삭제하기 위해서는
|
|
594
|
+
* 먼저 삭제하고자하는 컴포넌트를 선택된 상태로 만든 후에(참조. {@link select} 메쏘드) 이 메쏘드를 호출한다.
|
|
595
|
+
*/
|
|
596
|
+
remove(): void
|
|
597
|
+
|
|
598
|
+
animate(config: AnimationConfig): {
|
|
599
|
+
start: Function /* start function */
|
|
600
|
+
stop: Function /* stop function */
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
/**
|
|
604
|
+
* scene이 그려지고 있는 컨테이너를 전체화면 모드에서 표시되도록 한다.
|
|
605
|
+
*/
|
|
606
|
+
fullscreen(): void
|
|
607
|
+
|
|
608
|
+
/**
|
|
609
|
+
* 파라미터로 주어지는 id를 가진 컴포넌트의 data 값을 변경한다.
|
|
610
|
+
* @param id {string} - component id
|
|
611
|
+
* @param value {any} - data value
|
|
612
|
+
*/
|
|
613
|
+
variable(id: string, value: any): any
|
|
614
|
+
|
|
615
|
+
target: HTMLElement | null
|
|
616
|
+
scale: SCALE
|
|
617
|
+
translate: TRANSLATE
|
|
618
|
+
|
|
619
|
+
readonly unit: string /* 'px' */
|
|
620
|
+
readonly PPM: number
|
|
621
|
+
readonly PPI: number
|
|
622
|
+
readonly DPPX: number
|
|
623
|
+
|
|
624
|
+
mode: SCENE_MODE
|
|
625
|
+
|
|
626
|
+
/**
|
|
627
|
+
* Scene 모델의 단위(unit)을 감안한 기본 Scale 값을 제공한다.
|
|
628
|
+
* 통산 'mm', 'cm' 단위의 Scene은 각 값에 10배를 곱한 수치로 모델링된다.(값을 10으로 나눈값이 실제 단위와 일치한다.)
|
|
629
|
+
* unitScale의 의미는 scene에 unitScale값으로 scale하면, 각 단위값이 화면과 일치한다는 의미이다.
|
|
630
|
+
*
|
|
631
|
+
* 모델링의 수치단위가 픽셀이 아니고, mm, cm, inch 등의 단위인 경우에,
|
|
632
|
+
* 화면에서의 크기가 실물과 유사하게 보이는 수준의 기본 스케일을 제공하는 기능이다.
|
|
633
|
+
* 이 값은 내부적으로는, Ruler에서 눈금을 실제 자의 눈금과 일치시키기 위해서 사용한다.
|
|
634
|
+
*/
|
|
635
|
+
readonly unitScale: string
|
|
636
|
+
|
|
637
|
+
/**
|
|
638
|
+
* scene이 그려질 모니터 화면의 크기정보 (inch)
|
|
639
|
+
* 예시) 17, 20, 24, 27, 30, ...
|
|
640
|
+
* @type {number}
|
|
641
|
+
*/
|
|
642
|
+
screen: number
|
|
643
|
+
|
|
644
|
+
/**
|
|
645
|
+
* 컨테이너의 크기에 맞게 크기를 조정한다.
|
|
646
|
+
*/
|
|
647
|
+
resize(): void
|
|
648
|
+
|
|
649
|
+
release(): void
|
|
650
|
+
dispose(): void
|
|
651
|
+
|
|
652
|
+
/* Selection Based API - Modeling APIs */
|
|
653
|
+
|
|
654
|
+
/**
|
|
655
|
+
* scene 내에서 선택된 컴포넌트의 리스트
|
|
656
|
+
* @type {object-array}
|
|
657
|
+
*/
|
|
658
|
+
selected: Array<Component>
|
|
659
|
+
|
|
660
|
+
/**
|
|
661
|
+
* scene이 그리고 있는 컴포넌트 모델정보
|
|
662
|
+
* @type {object}
|
|
663
|
+
*/
|
|
664
|
+
model: Model
|
|
665
|
+
|
|
666
|
+
/*
|
|
667
|
+
* root는 모델의 최상위 컨테이너인 모델레이어를 의미한다.
|
|
668
|
+
*/
|
|
669
|
+
readonly root: Container
|
|
670
|
+
|
|
671
|
+
/*
|
|
672
|
+
* rootContainer는 모든 컴포넌트의 최상위 컨테이너이다.
|
|
673
|
+
* 이 컨테이너는 하위에 모델레이어를 위주로 많은 자식 컴포넌트를 보유한다.
|
|
674
|
+
*/
|
|
675
|
+
readonly rootContainer: RootContainer
|
|
676
|
+
|
|
677
|
+
/*
|
|
678
|
+
* selector에 해당하는 모든 컴포넌트들을 찾는다.
|
|
679
|
+
* @params selector {string}
|
|
680
|
+
*/
|
|
681
|
+
findAll(selector: string, component?: Component): Array<Component>
|
|
682
|
+
|
|
683
|
+
/*
|
|
684
|
+
* selector에 해당하는 첫번째 컴포넌트를 찾는다.
|
|
685
|
+
* @params selector {string}
|
|
686
|
+
*/
|
|
687
|
+
findFirst(selector: string, ...others: any[]): Component
|
|
688
|
+
|
|
689
|
+
/*
|
|
690
|
+
* id를 갖는 컴포넌트를 찾는다.
|
|
691
|
+
* @params id {string}
|
|
692
|
+
*/
|
|
693
|
+
findById(id: string): Component
|
|
694
|
+
|
|
695
|
+
/*
|
|
696
|
+
* id를 갖는 모든 컴포넌트를 찾는다.
|
|
697
|
+
* @params id {string}
|
|
698
|
+
*/
|
|
699
|
+
findAllById(id: string): Component[]
|
|
700
|
+
|
|
701
|
+
/*
|
|
702
|
+
* scene이 그리는 모델 오브젝트를 JSON 텍스트로 리턴한다.
|
|
703
|
+
*/
|
|
704
|
+
serialize(): string
|
|
705
|
+
|
|
706
|
+
on(event: string, listener: Function, context?: any): void
|
|
707
|
+
once(event: string, listener: Function, context?: any): void
|
|
708
|
+
off(event: string, listener?: Function, context?: any): void
|
|
709
|
+
|
|
710
|
+
toDataURL(): string
|
|
711
|
+
|
|
712
|
+
fit(type?: FITMODE): void
|
|
713
|
+
|
|
714
|
+
readonly fitMode: FITMODE
|
|
715
|
+
readonly ids: { [id: string]: any }[]
|
|
716
|
+
|
|
717
|
+
copy(): string
|
|
718
|
+
cut(): string
|
|
719
|
+
redo(): void
|
|
720
|
+
undo(): void
|
|
721
|
+
preserve(): void
|
|
722
|
+
undoable(): boolean
|
|
723
|
+
redoable(): boolean
|
|
724
|
+
hasUnpreservedChanges(): boolean
|
|
725
|
+
move(component: Component, to_container: Container, to_index: number): void
|
|
726
|
+
centerTo(component: Component, animated?: boolean): void
|
|
727
|
+
|
|
728
|
+
select(selector: string | Function, ...others: (string | Function)[]): Component[]
|
|
729
|
+
paste(clipboard: string): void
|
|
730
|
+
align(type: 'left' | 'right' | 'center' | 'top' | 'bottom' | 'middle' | string): void
|
|
731
|
+
place(type: 'left' | 'right' | 'center' | 'top' | 'bottom' | 'middle' | string): void
|
|
732
|
+
distribute(type: string): void
|
|
733
|
+
symmetryX(): void
|
|
734
|
+
symmetryY(): void
|
|
735
|
+
|
|
736
|
+
group(): void
|
|
737
|
+
ungroup(): void
|
|
738
|
+
|
|
739
|
+
change(f: ChangeFunction): void
|
|
740
|
+
undoableChange(f: () => void): void
|
|
741
|
+
zorder(type: 'forward' | 'backward' | 'front' | string): void
|
|
742
|
+
|
|
743
|
+
startStylePasteMode(): void
|
|
744
|
+
stopStylePasteMode(): void
|
|
745
|
+
|
|
746
|
+
startDatabindPasteMode(): void
|
|
747
|
+
stopDatabindPasteMode(): void
|
|
748
|
+
|
|
749
|
+
data: object
|
|
750
|
+
dataByRefid: object
|
|
751
|
+
|
|
752
|
+
values: object
|
|
753
|
+
valuesByRefid: object
|
|
754
|
+
|
|
755
|
+
anchorStarterTemplate: object
|
|
756
|
+
|
|
757
|
+
// @deprecated
|
|
758
|
+
variables: object
|
|
759
|
+
|
|
760
|
+
baseUrl: string
|
|
761
|
+
}
|
|
762
|
+
}
|
package/things-scene.mjs
CHANGED
|
@@ -68,4 +68,4 @@ class Bot extends tot{constructor(){super(...arguments),this.renderOptions={host
|
|
|
68
68
|
</button>`:Aot}
|
|
69
69
|
${r?xot`<button class="closable" @click=${this.closeContainer}>close</button>`:Aot}
|
|
70
70
|
</div>
|
|
71
|
-
`,this.element)}onchangeMinimized(){const{minimized:t}=this.state;t?this.setState("height",24):this.setState("height",this.get("height"))}}ret.register("container",qot);const Xot=Math.sqrt(3),Vot=2;function Kot(t,e,r,n,i){var o,a,s,c,u=5+i,l=r.x,h=r.y,f=n.x,d=n.y;if(Math.abs(l-f)>u&&Math.abs(h-d)>u){var p=(d-h)/(f-l),g=h-p*l;if(Math.abs(e-(p*t+g))>u)return!1}return l>f?(a=l,o=f):(a=f,o=l),h>d?(c=h,s=d):(c=d,s=h),!(a+5<t)&&(!(o-5>t)&&(!(c+5<e)&&!(s-5>e)))}function Qot(t,e,r,n=2){for(let i=0;i<r.length-1;i++)if(Kot(t,e,r[i],r[i+1],n))return!0;return!1}function Jot(t,e,r,n){if("arrow"!=t.slice(-5))return r;var i=Math.atan2(n.y-r.y,n.x-r.x),o=1.5*e;return{x:r.x+Math.cos(i)*o,y:r.y+Math.sin(i)*o}}function Zot(t,e,r){var{lineWidth:n=Vot,strokeStyle:i="#000000",lineCap:o=!1,alpha:a=1,begin:s="none",end:c="none",beginSize:u="size5",endSize:l="size5"}=r;if(("none"!=s||"none"!=c)&&(n=Number(n)||Vot,t.lineCap=o,t.lineWidth=n,t.strokeStyle=i,t.fillStyle=i,t.globalAlpha*=a,"none"!=s&&tat(t,e[0],e[1],n,s,eat(u,n)),"none"!=c)){let r=e.length;tat(t,e[r-1],e[r-2],n,c,eat(l,n))}}function tat(t,e,r,n,i,o){var{x:a,y:s}=e,c=Math.atan2(r.y-s,r.x-a);switch(t.beginPath(),t.translate(a,s),t.rotate(c),i){case"oval":t.ellipse(0,0,o.X,o.Y,0,0,2*Math.PI),t.fill();break;case"diamond":t.moveTo(-o.X,0),t.lineTo(0,-o.Y),t.lineTo(o.X,0),t.lineTo(0,o.Y),t.fill();break;case"arrow":t.moveTo(0,0),t.lineTo(Xot*o.X,-o.Y),t.lineTo(Xot*o.X,o.Y),t.fill();break;case"sharp-arrow":t.moveTo(0,0),t.lineTo(Xot*o.X,-o.Y),t.lineTo(-o.X/1.5+Xot*o.X,0),t.lineTo(Xot*o.X,o.Y),t.fill();break;case"open-arrow":t.moveTo(Xot*o.X+n,-o.Y),t.lineTo(n,0),t.lineTo(Xot*o.X+n,o.Y),t.stroke()}t.rotate(-c),t.translate(-a,-s),t.closePath()}function eat(t,e){let r={};switch(e*=1.2,t){case"size1":r.X=e,r.Y=e;break;case"size2":r.X=1.5*e,r.Y=e;break;case"size3":r.X=2*e,r.Y=e;break;case"size4":r.X=e,r.Y=1.5*e;break;case"size5":default:r.X=1.5*e,r.Y=1.5*e;break;case"size6":r.X=2*e,r.Y=1.5*e;break;case"size7":r.X=e,r.Y=2*e;break;case"size8":r.X=1.5*e,r.Y=2*e;break;case"size9":r.X=2*e,r.Y=2*e}return r}const rat="N",nat="S",iat="E",oat="W";class aat{constructor({component:t,anchor:e,position:r,self:n}){this.component=t,this._anchorName=e,this._position=r,this.self=n}get position(){const t=this.anchor;if(t){var{position:e}=t;const r=this.component.transcoordS2T(e.x,e.y);return this.self.transcoordT2P(r.x,r.y)}return this._position}set position({x:t,y:e}){this._position={x:t,y:e}}get anchor(){return this.component?.findAnchor(this._anchorName)}get direction(){const t=this.component.bounds,e=this.anchor;if(!e)return iat;const r=e.position;return r.y<=t.top?rat:r.y>=t.top+t.height?nat:r.x<=t.left?oat:iat}get boundaryPosition(){const t=this.anchor;if(t){var{position:e}=t,r=0,n=0;switch(this.direction){case nat:n=20;break;case rat:n=-20;break;case oat:r=-20;break;default:r=20}e={x:e.x+r,y:e.y+n};const i=this.component.transcoordS2T(e.x,e.y);return this.self.transcoordT2P(i.x,i.y)}}}class sat extends ret{isLine(){return!0}replaceRefids(t){["from","to"].forEach((e=>{const r=this.get(e);if(r?.component){const n=t.get(r.component)||r.component;this.set(e,{...r,component:n})}}))}get fromEnd(){if(this.parent&&!this._fromEnd){const{component:t,anchor:e,position:r}=this.getState("from")||{};if(!t)return;const n=this.root?.findByRefid(t);if(!n)return;this._fromEnd=new aat({component:n,fromto:"from",anchor:e,position:r,self:this})}return this._fromEnd}get from(){return this.getState("from")}set from(t){delete this._fromEnd,this.set("from",t)}get toEnd(){if(this.parent&&!this._toEnd){const{component:t,anchor:e,position:r}=this.getState("to")||{};if(!t)return;const n=this.root?.findByRefid(t);if(!n)return;this._toEnd=new aat({component:n,fromto:"to",anchor:e,position:r,self:this})}return this._toEnd}get to(){return this.getState("to")}set to(t){delete this._toEnd,this.set("to",t)}move({x:t,y:e},r){r&&(this.from={position:this._fromEnd?.position||this.getState("from")?.position||{x:0,y:0}},this.to={position:this._toEnd?.position||this.getState("to")?.position||{x:0,y:0}}),super.move({x:t,y:e},r)}render(t){var{begin:e="none",end:r="none",lineWidth:n,round:i=0}=this.state,o=this.drawPath;Zot(t,o,this.state),t.beginPath();var a=Jot(e,n,o[0],o[1]),s=Jot(r,n,o[o.length-1],o[o.length-2]);o=[a,...o.slice(1,-1),s];var c={x:a.x,y:a.y};t.moveTo(a.x,a.y);for(var u=1;u<o.length;u++){const e=c;c=o[u];const r=o[u+1];if(e.x===c.x&&e.y===c.y)continue;if(!r){t.lineTo(c.x,c.y);break}var l=0!==(d=Math.sqrt((e.x-c.x)*(e.x-c.x)+(e.y-c.y)*(e.y-c.y)))?Math.atan2(e.x-c.x,e.y-c.y):0,h=Math.sin(l)*Math.min(i,d/2)+c.x,f=Math.cos(l)*Math.min(i,d/2)+c.y;const n=i>0||0!==d?{x:h,y:f}:c;var d;l=0!==(d=Math.sqrt((r.x-c.x)*(r.x-c.x)+(r.y-c.y)*(r.y-c.y)))?Math.atan2(r.x-c.x,r.y-c.y):0,h=Math.sin(l)*Math.min(i,d/2)+c.x,f=Math.cos(l)*Math.min(i,d/2)+c.y;const a=i>0||0!==d?{x:h,y:f}:c;t.lineTo(n.x,n.y),i>0&&t.quadraticCurveTo(c.x,c.y,a.x,a.y)}this.drawStroke(t)}contains(t,e){var{lineWidth:r}=this.state;return Qot(t,e,this.drawPath,r)}get resizable(){return!1}get mutable(){return!0}get rotatable(){return!1}get path(){const{from:t,to:e}=this.state;var{x1:r,y1:n,x2:i,y2:o}=this.state;return[this.fromEnd?.position||t?.position||{x:r,y:n},this.toEnd?.position||e?.position||{x:i,y:o}]}set path(t){const[e,r]=t,{from:n,to:i}=this.state;delete this._fromEnd,delete this._toEnd,this.set({from:{...n,position:e},to:{...i,position:r}})}get textBounds(){var t,e,r=this.drawPath,n=0;for(let s=1;s<r.length;s++){var i=r[s-1],o=r[s],a=(i.x-o.x)*(i.x-o.x)+(i.y-o.y)*(i.y-o.y);a>n&&(n=Math.ceil(a),t=i,e=o)}var{paddingTop:s,paddingLeft:c,paddingRight:u,paddingBottom:l}=this.state;return l||=0,s||=0,c||=0,u||=0,{left:Math.min(t.x,e.x)+c,top:Math.min(t.y,e.y)+s,width:Math.max(Math.abs(t.x-e.x)-c-u,0),height:Math.max(Math.abs(t.y-e.y)-s-l,0)}}get decorators(){return["decotag"]}}sat.getTipNeckPos=Jot,sat.containedInPath=Qot,sat.drawEndTips=Zot,ret.register("line",sat);const cat={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"angle",label:"start-angle",name:"startAngle",property:"startAngle"},{type:"angle",label:"end-angle",name:"endAngle",property:"endAngle"}],"value-property":"text"};class uat extends(Net(net)){is3dish(){return!0}render(t){var{cx:e,cy:r,rx:n,ry:i,startAngle:o,endAngle:a,anticlockwise:s}=this.state;t.beginPath(),t.ellipse(e,r,Math.abs(n),Math.abs(i),0,o||0,a||2*Math.PI,s),void 0!==o&&void 0!==a&&(t.lineTo(e,r),t.closePath())}get path(){var{cx:t,cy:e,rx:r,ry:n}=this.state;return[{x:t-r,y:e-n},{x:t+r,y:e-n},{x:t+r,y:e+n},{x:t-r,y:e+n}]}set path(t){var e=t[0],r=t[2];this.set({cx:e.x+(r.x-e.x)/2,cy:e.y+(r.y-e.y)/2,rx:(r.x-e.x)/2,ry:(r.y-e.y)/2})}contains(t,e){var{cx:r,cy:n,rx:i,ry:o}=this.state,a=(t-r)/(2*i-.5),s=(e-n)/(2*o-.5);return a*a+s*s<.25}outline(t){return function(t,e){var{cx:r,cy:n,rx:i,ry:o}=t.model,a=2*Math.PI*e,s=r+i*Math.cos(a),c=n+o*Math.sin(a);return t.transcoordS2T(s,c)}(this,t)}get anchors(){return function(t){var{left:e,top:r,width:n,height:i}=t.bounds,o=e+n/2,a=r+i/2;return[{name:"TOP",position:{x:o,y:r}},{name:"RIGHT",position:{x:e+n,y:a}},{name:"BOTTOM",position:{x:o,y:r+i}},{name:"LEFT",position:{x:e,y:a}}]}(this)}get nature(){return cat}}ret.memoize(uat.prototype,"path",!1),ret.register("ellipse",uat);var lat={ondragstart:function(t,e,r){r.mutatePath(null,(function(r){r.splice(e+1,0,t)}))},ondragmove:function(t,e,r){r.mutatePath(null,(function(r){r[e+1]=t}))},ondragend:function(t,e,r){}};const hat={mutable:!0,resizable:!1,rotatable:!0,properties:[{type:"number",label:"round",name:"round",property:{min:0,max:100,step:1}}],help:"scene/component/polygon"};class fat extends net{is3dish(){return!0}get mutable(){return!0}get pathExtendable(){return!0}get path(){return this.state.path}set path(t){this.set("path",t)}contains(t,e){var r=this.state.path,n=!1;return r.forEach(((i,o)=>{let a=(o+r.length+1)%r.length,s=i.x,c=i.y,u=r[a].x,l=r[a].y;c>e!=l>e&&t<(u-s)*(e-c)/(l-c)+s&&(n=!n)})),n}get controls(){var t=this.path;return t.map(((e,r)=>{let n=t[r+1>=t.length?0:r+1];return{x:(e.x+n.x)/2,y:(e.y+n.y)/2,handler:lat}}))}get nature(){return hat}}ret.memoize(fat.prototype,"controls",!1),ret.register("polygon",fat);var dat={ondragstart:function(t,e,r){r.mutatePath(null,(function(r){r.splice(e,0,t)}))},ondragmove:function(t,e,r){r.mutatePath(null,(function(r){r[e]=t}))},ondragend:function(t,e,r){}};const pat={mutable:!1,resizable:!1,rotatable:!1,properties:[{type:"number",label:"round",name:"round",property:{min:0,max:100,step:1}}],help:"scene/component/polyline"};class gat extends sat{get pathExtendable(){return!0}get path(){const{from:t,to:e}=this.state,{path:r}=this.state;return[this.fromEnd?.position||t?.position||r[0],...r.slice(1,-1),this.toEnd?.position||e?.position||r[r.length-1]]}set path(t){const{from:e,to:r}=this.state;delete this._fromEnd,delete this._toEnd,this.set({from:{...e,position:t[0]},to:{...r,position:t[t.length-1]},path:t})}get controls(){var t=this.path,e=[];for(let r=0;r<t.length-1;r++){let n=t[r],i=t[r+1];0==r&&e.push({x:n.x,y:n.y,handler:dat}),e.push({x:(n.x+i.x)/2,y:(n.y+i.y)/2,handler:dat}),r==t.length-2&&e.push({x:i.x,y:i.y,handler:dat})}return e}get nature(){return pat}}ret.register("polyline",gat);const vat={mutable:!1,resizable:!1,rotatable:!1,properties:[{type:"number",label:"round",name:"round",property:{min:0,max:100,step:1}}],help:"scene/component/ortholine"};class yat extends sat{get pathExtendable(){return!1}get drawPath(){const t=this.path[0],e=this.path[1],{component:r,direction:n,boundaryPosition:i=t}=this.fromEnd||{},{component:o,direction:a,boundaryPosition:s=e}=this.toEnd||{};var c=[i,s],u=[];i&&u.push(i);var l=r?.bounds;if(l){var h=r.transcoordS2T(l.left,l.top);h=this.transcoordT2P(h.x,h.y),l={...l,left:h.x,top:h.y}}var f=l?{left:l.left-20,top:l.top-20,width:l.width+40,height:l.height+40}:{left:i.x,top:i.y,width:0,height:0};l=l||f;var d=o?.bounds;if(d){h=o.transcoordS2T(d.left,d.top);h=this.transcoordT2P(h.x,h.y),d={...d,left:h.x,top:h.y}}var p=d?{left:d.left-20,top:d.top-20,width:d.width+40,height:d.height+40}:{left:s.x,top:s.y,width:0,height:0};d=d||p;var g=[f,p];const v=f.left>p.left?p.left:f.left,y=f.top>p.top?p.top:f.top;var m,b,x,w,A,_,k,E,S,M,T={left:v,top:y,width:f.left+f.width>p.left+p.width?f.left+f.width-v:p.left+p.width-v,height:f.top+f.height>p.top+p.height?f.top+f.height-y:p.top+p.height-y},P=0,O=0;l.left+l.width<d.left?(w=0,A=1,S=n,M=a,m=(l.left+l.width+d.left)/2,P=d.left-m):d.left+d.width<l.left&&(w=1,A=0,S=a,M=n,m=(l.left+d.width+d.left)/2,P=l.left-m),l.top+l.height<d.top?(x=0,_=1,k=n,E=a,b=(l.top+l.height+d.top)/2,O=d.top-b):d.top+d.height<l.top&&(x=1,_=0,k=a,E=n,b=(l.top+d.height+d.top)/2,O=l.top-b);var I=[];if(m&&P>O){switch(M){case oat:switch(S){case iat:I.push({x:m,y:c[w].y}),I.push({x:m,y:c[A].y});break;case oat:var C=g[w].top+g[w].height/2>c[A].y?Math.min(g[w].top,c[A].y):Math.max(g[w].top+g[w].height,c[A].y);I.push({x:c[w].x,y:C}),I.push({x:m,y:C}),I.push({x:m,y:c[A].y});break;case rat:case nat:C=S===nat?Math.max(c[w].y,c[A].y):Math.min(c[w].y,c[A].y);I.push({x:c[w].x,y:C}),I.push({x:m,y:C}),I.push({x:m,y:c[A].y});break;default:return this.path}break;case iat:switch(S){case iat:var R=C=c[w].y<c[A].y?Math.min(g[A].top,c[w].y):Math.max(g[A].top+g[A].height,c[w].y);break;case oat:R=C=void 0!==b?b:c[w].y<c[A].y?T.top-.5*P:T.top+T.height+.5*P;break;case nat:R=C=void 0!==b?Math.max(b,c[w].y):T.top+T.height;break;case rat:R=C=b?Math.min(b,g[w].top):T.top;break;default:return this.path}I.push({x:c[w].x,y:C}),I.push({x:m,y:C}),I.push({x:m,y:R}),I.push({x:c[A].x,y:R});break;case nat:switch(S){case iat:C=c[w].y,R=c[w].y>c[A].y?c[w].y:g[A].top+g[A].height;break;case oat:R=C=b?Math.max(b,g[A].top+g[A].height):T.top+T.height;break;case nat:R=C=T.top+T.height;break;case rat:C=b?Math.min(b,g[w].top):g[w].top,R=b?Math.max(b,g[A].top+g[A].height):g[A].top+g[A].height;break;default:return this.path}I.push({x:c[w].x,y:C}),I.push({x:m,y:C}),I.push({x:m,y:R}),I.push({x:c[A].x,y:R});break;case rat:switch(S){case iat:C=c[w].y,R=c[w].y<c[A].y?c[w].y:g[A].top;break;case oat:R=C=b?Math.min(b,g[A].top):T.top;break;case nat:C=void 0!==b?Math.max(b,c[w].y):c[w].y,R=void 0!==b?Math.min(b,c[A].y):c[A].y;break;case rat:R=C=T.top;break;default:return this.path}I.push({x:c[w].x,y:C}),I.push({x:m,y:C}),I.push({x:m,y:R}),I.push({x:c[A].x,y:R});break;default:return this.path}u.push(...0===w?I:I.reverse())}else if(b){switch(E){case rat:switch(k){case nat:I.push({x:c[x].x,y:b}),I.push({x:c[_].x,y:b});break;case rat:var j=g[x].left+g[x].width/2>c[_].x?Math.min(g[x].left,c[_].x):Math.max(g[x].left+g[x].width,c[_].x);I.push({x:j,y:c[x].y}),I.push({x:j,y:b}),I.push({x:c[_].x,y:b});break;case oat:j=Math.min(c[x].x,c[_].x);I.push({x:j,y:c[x].y}),I.push({x:j,y:b}),I.push({x:c[_].x,y:b});break;case iat:j=Math.max(c[x].x,c[_].x);I.push({x:j,y:c[x].y}),I.push({x:j,y:b}),I.push({x:c[_].x,y:b});break;default:return this.path}break;case nat:switch(k){case oat:var L=j=T.left;break;case iat:L=j=void 0!==m?Math.max(m,c[x].x):T.left+T.width;break;case rat:L=j=void 0!==m?m:c[x].x<c[_].x?T.left-.5*O:T.left+T.width+.5*O;break;case nat:j=c[x].x,L=c[x].x<c[_].x?Math.min(g[_].left,c[x].x):Math.max(g[_].left+g[_].width,c[x].x);break;default:return this.path}I.push({x:j,y:c[x].y}),I.push({x:j,y:b}),I.push({x:L,y:b}),I.push({x:L,y:c[_].y});break;case iat:switch(k){case oat:j=void 0!==m?Math.min(m,c[x].x):c[x].x,L=void 0!==m?Math.max(m,c[_].x):c[_].x;break;case iat:L=j=T.left+T.width;break;case rat:L=j=void 0!==m?Math.max(m,c[_].x):T.left+T.width;break;case nat:j=c[x].x,L=Math.max(g[_].left+g[_].width,c[x].x);break;default:return this.path}I.push({x:j,y:c[x].y}),I.push({x:j,y:b}),I.push({x:L,y:b}),I.push({x:L,y:c[_].y});break;case oat:switch(k){case oat:L=j=T.left;break;case iat:j=void 0!==m?Math.max(m,c[x].x):c[x].x,L=void 0!==m?Math.min(m,c[_].x):c[_].x;break;case rat:L=j=T.left;break;case nat:j=c[x].x<c[_].x?Math.min(g[_].left,c[x].x):c[x].x,L=Math.min(j,c[_].x);break;default:return this.path}I.push({x:j,y:c[x].y}),I.push({x:j,y:b}),I.push({x:L,y:b}),I.push({x:L,y:c[_].y});break;default:return this.path}u.push(...0===x?I:I.reverse())}else switch(n){case rat:switch(a){case rat:var D=T.top;u.push({x:c[0].x,y:D}),u.push({x:c[1].x,y:D});break;case nat:var z=T.left+T.width;u.push({x:z,y:c[0].y}),u.push({x:z,y:T.top+T.height}),u.push({x:c[1].x,y:T.top+T.height});break;case iat:z=c[1].y<c[0].y&&c[1].x<c[0].x?c[0].x:T.left+T.width;u.push({x:z,y:c[0].y}),u.push({x:z,y:c[1].y});break;case oat:z=T.left;u.push({x:z,y:c[0].y}),u.push({x:z,y:c[1].y});break;default:return this.path}break;case nat:switch(a){case rat:z=T.left+T.width;u.push({x:z,y:c[0].y}),u.push({x:z,y:T.top}),u.push({x:c[1].x,y:T.top});break;case nat:D=T.top+T.height;u.push({x:c[0].x,y:D}),u.push({x:c[1].x,y:D});break;case iat:D=T.top+T.height;u.push({x:c[0].x,y:D}),u.push({x:c[1].x,y:D});break;case oat:D=T.top+T.height;u.push({x:c[0].x,y:D}),u.push({x:c[1].x,y:D});break;default:return this.path}break;case oat:switch(a){case rat:z=c[0].x>c[1].x&&c[0].y<c[1].y?c[1].x:T.left,D=c[0].x>c[1].x&&c[0].y<c[1].y?c[1].y:Math.min(T.top,c[0].y);u.push({x:z,y:c[0].y}),u.push({x:z,y:D}),u.push({x:c[1].x,y:D});break;case nat:z=T.left,D=Math.max(T.top+T.height,c[0].y);u.push({x:z,y:c[0].y}),u.push({x:z,y:D}),u.push({x:c[1].x,y:D});break;case iat:z=T.left+T.width;u.push({x:c[0].x,y:T.top}),u.push({x:z,y:T.top}),u.push({x:z,y:c[1].y});break;case oat:z=T.left;u.push({x:z,y:c[0].y}),u.push({x:z,y:c[1].y});break;default:return this.path}break;case iat:switch(a){case rat:D=c[0].y<c[1].y&&c[0].x<c[1].x?c[0].y:T.top;u.push({x:c[0].x,y:D}),u.push({x:c[1].x,y:D});break;case nat:D=c[0].y>c[1].y&&c[0].x<c[1].x?c[0].y:T.top+T.height;u.push({x:c[0].x,y:D}),u.push({x:c[1].x,y:D});break;case iat:D=T.top+T.height;u.push({x:c[0].x,y:D}),u.push({x:c[1].x,y:D});break;case oat:D=T.top+T.height;u.push({x:c[0].x,y:D}),u.push({x:c[1].x,y:D});break;default:return this.path}break;default:return this.path}return s&&u.push(s),[t,...u,e].filter(((t,e,r)=>{if(0===e)return!0;const n=r[e-1];return t.x!==n.x||t.y!==n.y})).filter(((t,e,r)=>{if(0===e||e>=r.length-1)return!0;const n=r[e-1],i=r[e+1];return!(t.x===n.x&&t.x===i.x||t.y===n.y&&t.y===i.y)}))}get nature(){return vat}}ret.register("ortholine",yat);const mat={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"image-selector",label:"image-src",name:"src",property:{displayField:"id",displayFullUrl:!0,baseUrlAlias:"$base_url",defaultStorage:"scene-image",storageFilters:{type:Array,value:[{name:"category",value:"image"}]},useUpload:!0}},{type:"select",label:"cross-origin",name:"crossOrigin",property:{options:["","anonymous","use-credentials"]}}],"value-property":"src",help:"scene/component/image-view"};class bat extends(oet(net)){static get noimage(){return bat.NOIMAGE||(bat.NOIMAGE=new Image,bat.NOIMAGE.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABIBAMAAAD7Se1QAAAAIVBMVEUAAABHcEwBAQEREREBAQEEBAQGBgYLCwsDAwMDAwMICAi6HF9tAAAAC3RSTlNNAEAERiMYCS41Eac10lYAAAEgSURBVHhe7dY9asQwEAXgh7DNertNiJy48pIitY3SB7bYdk0ukL1BDDmA9gZecoH4pmFQ3MQayUMguPBrNPD4wD9TCMvJmt3M/AtYwXOlXiWgqADVCUBD46MAnGhMBaCiUQmAm8VA/Eh/eWl9Fn5WcxD+OLuRrUYJDKLluwH2InACUgkoACSdADxQc50Bytadb9RkM0CT13TcvlCT1HFg8UTHvasuUVACCa3El6u2UdD8LFTlKhUFFgA+d3dj10aABkUN72N3jAADCrJq7PIIsPidcxBoTHIIAjMFmyCwmGYIAA1P9gFgfCANAOsDSccCDW+uLDB+kLGg94OkZoAGkwsDDAe2DOg5oPxAg03rBR88OHpBz4N8UVeHFSwma74BTW6Ge4rIRa4AAAAASUVORK5CYII="),bat.NOIMAGE}dispose(){super.dispose(),this._offcanvas=null,this._image=null}render(t){var{left:e,top:r,width:n,height:i,isGray:o=!1,alpha:a=1,src:s}=this.state;if(this.prepareIf(!this._image&&s),t.beginPath(),t.globalAlpha*=a,this._image&&this._image.complete)if(o&&this._offcanvas)t.drawImage(this._offcanvas,e,r,n,i);else try{t.drawImage(this._image,e,r,n,i)}catch(o){t.drawImage(bat.noimage,e,r,n,i)}else!this.app.isViewMode&&t.drawImage(bat.noimage,e,r,n,i)}get nature(){return mat}get hasTextProperty(){return!1}ready(){super.ready(),this.prepareIf(!this._image&&this.state.src)}prepare(t,e){var{src:r,crossOrigin:n}=this.state;if(r){this._image=new Image;try{n&&(this._image.crossOrigin=n),this._image.src=this.app.url(r)||""}catch(t){return void e(t)}this._image.onload=()=>{if(this.get("isGray")){let t=this._image.width,e=this._image.height;this._offcanvas=ret.createCanvas(t,e);let r=this._offcanvas.getContext("2d");r.drawImage(this._image,0,0);let n=function(t,e,r){try{var n=t.getImageData(0,0,e,r)}catch(t){return M9("Get Image Data Error: "+t.message),null}var i=n.data;for(let t=0;t<e*r*4;t+=4){let e=i[t],r=i[t+1],o=i[t+2],a=parseInt((e+r+o)/3);n.data[t]=a,n.data[t+1]=a,n.data[t+2]=a}return n}(r,t,e);r.putImageData(n,0,0)}t(this)},this._image.onerror=t=>{this._image&&!this._image.currentSrc&&(this._image=null),e(t)}}else t(this)}get src(){return this.get("src")}set src(t){this.set("src",t)}onchange(t,e){(t.hasOwnProperty("src")||t.hasOwnProperty("isGray"))&&(this._offcanvas=null,this._image=null,this.prepareIf(t.src))}ondropfile(t,e){for(let r=0;r<t.length;r++)if(t[r].type.startsWith("image/"))return void(this.src=e[r])}}ret.register("image-view",bat);class xat extends(Hot(oet(ret))){is3dish(){return!0}prerender(){}}var wat={},Aat={},_at={};Object.defineProperty(_at,"__esModule",{value:!0});var kat=function(){function t(){}return t.bitsToNum=function(t){return t.reduce((function(t,e){return 2*t+e}),0)},t.byteToBitArr=function(t){for(var e=[],r=7;r>=0;r--)e.push(!!(t&1<<r));return e},t.lzwDecode=function(t,e){for(var r,n,i=0,o=function(t){for(var r=0,n=0;n<t;n++)e.charCodeAt(i>>3)&1<<(7&i)&&(r|=1<<n),i++;return r},a=[],s=1<<t,c=s+1,u=t+1,l=[],h=function(){l=[],u=t+1;for(var e=0;e<s;e++)l[e]=[e];l[s]=[],l[c]=null};;)if(n=r,(r=o(u))!==s){if(r===c)break;if(r<l.length)n!==s&&l.push(l[n].concat(l[r][0]));else{if(r!==l.length)throw new Error("Invalid LZW code.");l.push(l[n].concat(l[n][0]))}a.push.apply(a,l[r]),l.length===1<<u&&u<12&&u++}else h();return a},t}();_at.SuperGifUtils=kat,Object.defineProperty(Aat,"__esModule",{value:!0});var Eat=_at,Sat=function(){function t(t,e){this.stream=t,this.handler=e}return t.prototype.parseCT=function(t){for(var e=[],r=0;r<t;r++)e.push(this.stream.readBytes(3));return e},t.prototype.readSubBlocks=function(){var t,e;e="";do{t=this.stream.readByte(),e+=this.stream.read(t)}while(0!==t);return e},t.prototype.parseHeader=function(){var t={};if(t.sig=this.stream.read(3),t.ver=this.stream.read(3),"GIF"!==t.sig)throw new Error("Not a GIF file.");t.width=this.stream.readUnsigned(),t.height=this.stream.readUnsigned();var e=Eat.SuperGifUtils.byteToBitArr(this.stream.readByte());t.gctFlag=e.shift(),t.colorRes=Eat.SuperGifUtils.bitsToNum(e.splice(0,3)),t.sorted=e.shift(),t.gctSize=Eat.SuperGifUtils.bitsToNum(e.splice(0,3)),t.bgColor=this.stream.readByte(),t.pixelAspectRatio=this.stream.readByte(),t.gctFlag&&(t.gct=this.parseCT(1<<t.gctSize+1)),this.handler.hdr&&this.handler.hdr(t)},t.prototype.parseExt=function(t){var e=this;switch(t.label=this.stream.readByte(),t.label){case 249:t.extType="gce",function(t){e.stream.readByte();var r=Eat.SuperGifUtils.byteToBitArr(e.stream.readByte());t.reserved=r.splice(0,3),t.disposalMethod=Eat.SuperGifUtils.bitsToNum(r.splice(0,3)),t.userInput=r.shift(),t.transparencyGiven=r.shift(),t.delayTime=e.stream.readUnsigned(),t.transparencyIndex=e.stream.readByte(),t.terminator=e.stream.readByte(),e.handler.gce&&e.handler.gce(t)}(t);break;case 254:t.extType="com",function(t){t.comment=e.readSubBlocks(),e.handler.com&&e.handler.com(t)}(t);break;case 1:t.extType="pte",function(t){e.stream.readByte(),t.ptHeader=e.stream.readBytes(12),t.ptData=e.readSubBlocks(),e.handler.pte&&e.handler.pte(t)}(t);break;case 255:t.extType="app",function(t){e.stream.readByte(),t.identifier=e.stream.read(8),t.authCode=e.stream.read(3),"NETSCAPE"===t.identifier?function(t){e.stream.readByte(),t.unknown=e.stream.readByte(),t.iterations=e.stream.readUnsigned(),t.terminator=e.stream.readByte(),e.handler.app&&e.handler.app.NETSCAPE&&e.handler.app.NETSCAPE(t)}(t):function(t){t.appData=e.readSubBlocks(),e.handler.app&&e.handler.app[t.identifier]&&e.handler.app[t.identifier](t)}(t)}(t);break;default:t.extType="unknown",function(t){t.data=e.readSubBlocks(),e.handler.unknown&&e.handler.unknown(t)}(t)}},t.prototype.parseImg=function(t){t.leftPos=this.stream.readUnsigned(),t.topPos=this.stream.readUnsigned(),t.width=this.stream.readUnsigned(),t.height=this.stream.readUnsigned();var e=Eat.SuperGifUtils.byteToBitArr(this.stream.readByte());t.lctFlag=e.shift(),t.interlaced=e.shift(),t.sorted=e.shift(),t.reserved=e.splice(0,2),t.lctSize=Eat.SuperGifUtils.bitsToNum(e.splice(0,3)),t.lctFlag&&(t.lct=this.parseCT(1<<t.lctSize+1)),t.lzwMinCodeSize=this.stream.readByte();var r=this.readSubBlocks();t.pixels=Eat.SuperGifUtils.lzwDecode(t.lzwMinCodeSize,r),t.interlaced&&(t.pixels=function(t,e){for(var r=new Array(t.length),n=t.length/e,i=function(n,i){var o=t.slice(i*e,(i+1)*e);r.splice.apply(r,[n*e,e].concat(o))},o=[0,4,2,1],a=[8,8,4,2],s=0,c=0;c<4;c++)for(var u=o[c];u<n;u+=a[c])i(u,s),s++;return r}(t.pixels,t.width)),this.handler.img&&this.handler.img(t)},t.prototype.parseBlock=function(){var t={};switch(t.sentinel=this.stream.readByte(),String.fromCharCode(t.sentinel)){case"!":t.type="ext",this.parseExt(t);break;case",":t.type="img",this.parseImg(t);break;case";":t.type="eof",this.handler.eof&&this.handler.eof(t);break;default:throw new Error("Unknown block: 0x"+t.sentinel.toString(16))}"eof"!==t.type&&setTimeout(this.parseBlock.bind(this),0)},t.prototype.parse=function(){this.parseHeader(),setTimeout(this.parseBlock.bind(this),0)},t}();Aat.SuperGifParser=Sat;var Mat={};Object.defineProperty(Mat,"__esModule",{value:!0});var Tat=function(){function t(t){this.data=t,this.position=0}return t.prototype.readByte=function(){if(this.position>=this.data.length)throw new Error("Attempted to read past end of stream.");return this.data instanceof Uint8Array?this.data[this.position++]:255&this.data.charCodeAt(this.position++)},t.prototype.readBytes=function(t){for(var e=[],r=0;r<t;r++)e.push(this.readByte());return e},t.prototype.read=function(t){for(var e="",r=0;r<t;r++)e+=String.fromCharCode(this.readByte());return e},t.prototype.readUnsigned=function(){var t=this.readBytes(2);return(t[1]<<8)+t[0]},t}();Mat.SuperGifStream=Tat,Object.defineProperty(wat,"__esModule",{value:!0});var Pat=Aat,Oat=Mat,Iat=function(){function t(t,e){var r=this;for(var n in this.gifImgElement=t,this.options={autoPlay:!0},this.loading=!1,this.ready=!1,this.transparency=null,this.delay=null,this.disposalMethod=null,this.disposalRestoreFromIdx=null,this.lastDisposalMethod=null,this.frame=null,this.lastImg=null,this.playing=!0,this.forward=!0,this.ctxScaled=!1,this.frames=[],this.frameOffsets=[],this.initialized=!1,this.currentFrameIndex=-1,this.iterationCount=0,this.stepping=!1,this.handler={hdr:this.withProgress(this.doHdr.bind(this)),gce:this.withProgress(this.doGCE.bind(this)),com:this.withProgress(this.doNothing.bind(this)),app:{NETSCAPE:this.withProgress(this.doNothing.bind(this))},img:this.withProgress(this.doImg.bind(this)),eof:function(){r.pushFrame(),r.canvas.width=r.hdr.width*r.getCanvasScale(),r.canvas.height=r.hdr.height*r.getCanvasScale(),r.playerInit(),r.loading=!1,r.ready=!0,r.loadCallback&&r.loadCallback(r.gifImgElement)}},e)this.options[n]=e[n];this.onEndListener=e.onEnd,this.loopDelay=e.loopDelay||0,this.overrideLoopMode=null!=e.loopMode?e.loopMode:"auto",this.drawWhileLoading=null==e.drawWhileLoading||e.drawWhileLoading}return t.prototype.init=function(){var t=this.gifImgElement.parentNode,e=document.createElement("div");this.canvas=document.createElement("canvas"),this.canvasContext=this.canvas.getContext("2d"),this.tmpCanvas=document.createElement("canvas"),e.className=this.options.enclosingClass||"super-gif",e.appendChild(this.canvas),t&&(t.insertBefore(e,this.gifImgElement),t.removeChild(this.gifImgElement)),this.initialized=!0},t.prototype.loadSetup=function(t){return!this.loading&&(t&&(this.loadCallback=t),this.loading=!0,this.frames=[],this.clear(),this.disposalRestoreFromIdx=null,this.lastDisposalMethod=null,this.frame=null,this.lastImg=null,!0)},t.prototype.completeLoop=function(){this.onEndListener&&this.onEndListener(this.gifImgElement),this.iterationCount++,!1!==this.overrideLoopMode||this.iterationCount<0?this.doStep():(this.stepping=!1,this.playing=!1)},t.prototype.doStep=function(){if(this.stepping=this.playing,this.stepping){this.stepFrame(1);var t=10*this.frames[this.currentFrameIndex].delay;t||(t=100),0===this.getNextFrameNo()?(t+=this.loopDelay,setTimeout(this.completeLoop.bind(this),t)):setTimeout(this.doStep.bind(this),t)}},t.prototype.step=function(){this.stepping||setTimeout(this.doStep.bind(this),0)},t.prototype.putFrame=function(){var t;this.currentFrameIndex=parseInt(this.currentFrameIndex.toString(),10),this.currentFrameIndex>this.frames.length-1&&(this.currentFrameIndex=0),this.currentFrameIndex<0&&(this.currentFrameIndex=0),t=this.frameOffsets[this.currentFrameIndex],this.tmpCanvas.getContext("2d").putImageData(this.frames[this.currentFrameIndex].data,t.x,t.y),this.canvasContext.globalCompositeOperation="copy",this.canvasContext.drawImage(this.tmpCanvas,0,0)},t.prototype.playerInit=function(){this.loadErrorCause||(this.canvasContext.scale(this.getCanvasScale(),this.getCanvasScale()),this.options.autoPlay?this.step():(this.currentFrameIndex=0,this.putFrame()))},t.prototype.clear=function(){this.transparency=null,this.delay=null,this.lastDisposalMethod=this.disposalMethod,this.disposalMethod=null,this.frame=null},t.prototype.parseStream=function(t){try{new Pat.SuperGifParser(t,this.handler).parse()}catch(t){this.handleError("parse")}},t.prototype.setSizes=function(t,e){this.canvas.width=t*this.getCanvasScale(),this.canvas.height=e*this.getCanvasScale(),this.tmpCanvas.width=t,this.tmpCanvas.height=e,this.tmpCanvas.style.width=t+"px",this.tmpCanvas.style.height=e+"px",this.tmpCanvas.getContext("2d").setTransform(1,0,0,1,0,0)},t.prototype.drawError=function(){this.canvasContext.fillStyle="black",this.canvasContext.fillRect(0,0,this.hdr.width,this.hdr.height),this.canvasContext.strokeStyle="red",this.canvasContext.lineWidth=3,this.canvasContext.moveTo(0,0),this.canvasContext.lineTo(this.hdr.width,this.hdr.height),this.canvasContext.moveTo(0,this.hdr.height),this.canvasContext.lineTo(this.hdr.width,0),this.canvasContext.stroke()},t.prototype.handleError=function(t){this.loadErrorCause=t,this.hdr={width:this.gifImgElement.width,height:this.gifImgElement.height},this.frames=[],this.drawError()},t.prototype.doHdr=function(t){this.hdr=t,this.setSizes(this.hdr.width,this.hdr.height)},t.prototype.doGCE=function(t){this.pushFrame(),this.clear(),this.transparency=t.transparencyGiven?t.transparencyIndex:null,this.delay=t.delayTime,this.disposalMethod=t.disposalMethod},t.prototype.pushFrame=function(){this.frame&&(this.frames.push({data:this.frame.getImageData(0,0,this.hdr.width,this.hdr.height),delay:this.delay}),this.frameOffsets.push({x:0,y:0}))},t.prototype.doImg=function(t){var e=this;this.frame||(this.frame=this.tmpCanvas.getContext("2d"));var r=this.frames.length,n=t.lctFlag?t.lct:this.hdr.gct;r>0&&(3===this.lastDisposalMethod?null!==this.disposalRestoreFromIdx?this.frame.putImageData(frames[this.disposalRestoreFromIdx].data,0,0):this.frame.clearRect(this.lastImg.leftPos,this.lastImg.topPos,this.lastImg.width,this.lastImg.height):this.disposalRestoreFromIdx=r-1,2===this.lastDisposalMethod&&this.frame.clearRect(this.lastImg.leftPos,this.lastImg.topPos,this.lastImg.width,this.lastImg.height));var i=this.frame.getImageData(t.leftPos,t.topPos,t.width,t.height);t.pixels.forEach((function(t,r){t!==e.transparency&&(i.data[4*r+0]=n[t][0],i.data[4*r+1]=n[t][1],i.data[4*r+2]=n[t][2],i.data[4*r+3]=255)})),this.frame.putImageData(i,t.leftPos,t.topPos),this.ctxScaled||(this.canvasContext.scale(this.getCanvasScale(),this.getCanvasScale()),this.ctxScaled=!0),this.drawWhileLoading&&(this.canvasContext.drawImage(this.tmpCanvas,0,0),this.drawWhileLoading=this.options.autoPlay),this.lastImg=t},t.prototype.doNothing=function(){},t.prototype.withProgress=function(t){return function(e){t(e)}},t.prototype.getNextFrameNo=function(){var t=this.forward?1:-1;return(this.currentFrameIndex+t+this.frames.length)%this.frames.length},t.prototype.stepFrame=function(t){this.currentFrameIndex=this.currentFrameIndex+t,this.putFrame()},t.prototype.getCanvasScale=function(){return this.options.maxWidth&&this.hdr&&this.hdr.width>this.options.maxWidth?this.options.maxWidth/this.hdr.width:window.devicePixelRatio||1},t.prototype.play=function(){this.playing=!0,this.step()},t.prototype.pause=function(){this.playing=!1},t.prototype.isPlaying=function(){return this.playing},t.prototype.getCanvas=function(){return this.canvas},t.prototype.isLoading=function(){return this.loading},t.prototype.isReady=function(){return this.ready},t.prototype.isAutoPlay=function(){return this.options.autoPlay},t.prototype.getLength=function(){return this.frames.length},t.prototype.getCurrentFrame=function(){return this.currentFrameIndex},t.prototype.moveTo=function(t){this.currentFrameIndex=t,this.putFrame()},t.prototype.loadURL=function(t,e){var r=this;if(this.loadSetup(e)){var n=new XMLHttpRequest;n.open("GET",t,!0),"overrideMimeType"in n?n.overrideMimeType("text/plain; charset=x-user-defined"):"responseType"in n?n.responseType="arraybuffer":n.setRequestHeader("Accept-Charset","x-user-defined"),n.onloadstart=function(){r.initialized||r.init()},n.onload=function(){if(200===n.status){var t=n.response;t.toString().indexOf("ArrayBuffer")>0&&(t=new Uint8Array(t));var e=new Oat.SuperGifStream(t);setTimeout((function(){r.parseStream(e)}),0)}else r.handleError("xhr - response")},n.onerror=function(){r.handleError("xhr")},n.send()}},t.prototype.load=function(t){this.loadURL(this.gifImgElement.src,t)},t}(),Cat=wat.SuperGif=Iat;const Rat={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"image-selector",label:"src",name:"src"},{type:"checkbox",label:"play",name:"play"}],"value-property":"src",help:"scene/component/gif-view"};class jat extends xat{async oncreate_element(t){var{src:e,play:r}=this.state;this.onchangesrc(e),this.onchangeplay(r)}buildImg(){var t=this.element;t.innerHTML="";var e=document.createElement("img");return e.style.width="100%",e.style.height="100%",t.appendChild(e),e}onchange(t,e){super.onchange(t,e),"src"in t&&this.onchangesrc(t.src),"play"in t&&this.onchangeplay(t.play)}setElementProperties(t){}onchangeplay(t){var e=this._superGif;e&&e.isReady()&&(t?e.play():e.pause())}onchangesrc(t){var e=this.buildImg();t||(t="data:image/gif;base64,R0lGODlhYABIAPcAAAAAAAEBAQICAgMDAwQEBAUFBQYGBgcHBwgICAkJCQoKCgsLCwwMDA0NDQ4ODg8PDxAQEBERERISEhMTExQUFBUVFRYWFhcXFxgYGBkZGRoaGhsbGxwcHB0dHR4eHh8fHyAgICEhISIiIiMjIyQkJCUlJSYmJicnJygoKCkpKSoqKisrKywsLC0tLS4uLi8vLzAwMDExMTIyMjMzMzQ0NDU1NTY2Njc3Nzg4ODk5OTo6Ojs7Ozw8PD09PT4+Pj8/P0BAQEFBQUJCQkNDQ0REREVFRUZGRkdHR0hISElJSUpKSktLS0xMTE1NTU5OTk9PT1BQUFFRUVJSUlNTU1RUVFVVVVZWVldXV1hYWFlZWVpaWltbW1xcXF1dXV5eXl9fX2BgYGFhYWJiYmNjY2RkZGVlZWZmZmdnZ2hoaGlpaWpqamtra2xsbG1tbW5ubm9vb3BwcHFxcXJycnNzc3R0dHV1dXZ2dnd3d3h4eHl5eXp6ent7e3x8fH19fX5+fn9/f4CAgIGBgYKCgoODg4SEhIWFhYaGhoeHh4iIiImJiYqKio+Pj5iYmKCgoKampqurq66urrCwsLGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrOzs7S0tLa2tre3t7m5ubu7u7+/v8DAwMHBwcPDw8XFxcfHx8vLy8/Pz9LS0tXV1dfX193d3eTk5Onp6fj4+Pz8/P7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v///////////////////////////////////////////////////////////////////////////////yH5BAkAAPUAIf47R2VuZXJhdGVkIGJ5IGpzZ2lmIChodHRwczovL2dpdGh1Yi5jb20vYW50aW1hdHRlcjE1L2pzZ2lmLykALAAAAABgAEgAAAj+AGcJHEiwoMGDCBMqXMiwocOHECNKnEixosWLGDNq3Mixo8ePIEOKHEmypMmR9VKqXMmypcuXMGPKnJkSIs2bOHPqZGlzp8+fQOv1DEq0KMyhRpMmRaq0KVCmTqPmhCq1qkyqLrFRSyYwGTVsVo1iZXmNa8Fk18ISHasSm1mDycCq/ck2JTWF1ObSfTjz7cFken3WFbow8M7BDA3rHOwXruKpfGXeTZg3qDVrUge7RRg3KLZjx+Q2HVyvLNy0QaMJjBaVdD2tZr2K/mmNIObRkR+n9AsYt0Pddg1WXppb8bWDx1CLLW74GcJnSl3TtDY8Zu2Et4tKl7n52eyWnxXvhl7+26jqrspbnlfIWjtz2gWPZV95neH8veU9NxZYfbfD3kFt99J6Bnmn0mQO9XfYezrVxxlmx0GUXIAM4hSeffsxBN1TFd5E4Ef3QZbfTg6CNJ5gHXJ3TEntLThiTh+KFCJNAqZU4kgAitjQTheepOBMNcZI0oQ6JpbTjSZtiNN2PZ400IxHpdiSc07G911M0iFZZYtAStnWilUeBGVLrlEZpmM0elmPlmfO8iOZXl4DZpsGEYmll2bSWWCXLwJXVY1+urhjoGEBSuiSah6K36CKtpZoo4s9CimielZq6aWYZqrpppx26umnoIZ6UkAAOw=="),e.src=t,e.setAttribute("rel:animated_src",t),e.setAttribute("rel:auto_play",0),this._superGif=new Cat(e,{autoPlay:!1}),this._superGif.init();for(const t of this.element.children)t.style.width="100%",t.style.height="100%";var r=this._superGif.getCanvas();r.style.width="100%",r.style.height="100%",this._superGif.load((()=>{setTimeout((()=>{this._superGif.moveTo(0),this.play&&this._superGif.play()}),100)}))}ondropfile(t,e){for(let r=0;r<t.length;r++)if(/\.gif$/.test(t[r].name))return void(this.src=e[r])}get src(){return this.getState("src")}set src(t){this.set("src",t)}get play(){return this.getState("play")}set play(t){this.setState("play",t)}get nature(){return Rat}get tagName(){return"div"}}ret.register("gif-view",jat);const Lat={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"attachment-selector",label:"src",name:"src",property:{category:"audio"}},{type:"checkbox",label:"started",name:"started"},{type:"checkbox",label:"loop",name:"loop"}],"value-property":"src",help:"scene/component/audio"};class Dat extends(oet(net)){static get image(){return Dat.IMAGE||(Dat.IMAGE=new Image,Dat.IMAGE.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAGQCAMAAAC3Ycb+AAAAP1BMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACzJYIvAAAAFHRSTlMA8BAwgNBgQKB/wCBwUJDg37CvXyUlBK8AABFYSURBVHja7NsBkqIwFIThTiAQgyBq3/+sm6p1tnamZkaTMhJJf1f4S/JeEIiIiIiIiIiIiIiIiEhD7Hg4BH84TpAKjJ4f3NFCtjVd+InXz2RTs+FXlxGylYHfcVfIJmb+YFWSLUyGVJKKBJJKUo+Rd6w63l/qzLuCkryO5fe0l2xk5mMWbe+v0fNBRqf7S3je6CipQ2ACr+dWcYEpzBFS1plpguatsnomMgdIQSOTuQ5SjmE6/UgK8szgdJIUM/FG41YlFmYJ2kkKsY5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AmIkzdyaaAnLg1Nnw8WGYSk40X/BOh4+El6LMSBnN2Cd0tPq4w/LJXGrMbCX06PZ2dcM65yzlNertShSHf3SzRAyPM332IcSAHUKPi8EHmXU0l8Uglmni0yipDoi16s+jJKejhywLooz68yiMEcHr2qM4h81CJ++VPJfTu5UwBpv4Pp9DJSi6MJx0bvUwiw4ewgT8zNR0LHUL+OccOpY/3ElzyGKD5pBlMJpDlsOkMythRoNbXh95PJsdA67MrMtAEYbjeDqNo+7oKqWUUkoppZRSSimllFJKFfMXp4vmSjB8n6sAAAAASUVORK5CYII="),Dat.IMAGE}dispose(){super.dispose(),this.started=!1,delete this._audio}ready(){super.ready(),this._audio=new Audio,this._audio.addEventListener("canplay",(()=>{this.started&&this._audio.play()}));var{src:t="",loop:e=!1,started:r=!1}=this.state;this.onchangeSrc(t),this.onchangeLoop(e),this.onchangeStarted(r)}render(t){var{left:e,top:r,width:n,height:i,src:o}=this.state;t.beginPath(),this.drawImage(t,Dat.image,e,r,n,i)}get nature(){return Lat}get hasTextProperty(){return!1}get src(){return this.get("src")}set src(t){this.set("src",t)}get started(){return!!this.get("started")}set started(t){this.set("started",t)}start(){this._audio&&(this._audio.classList.add("active"),this._audio.play())}pause(){this._audio&&(this._audio.classList.remove("active"),this._audio.pause())}onchangeSrc(t){try{"data"!==String(t).substring(0,4)?this._audio.crossOrigin="use-credentials":this._audio.crossOrigin=null,this._audio.src="string"==typeof t?this.app.url(t):t}catch(t){return void console.error(t)}}onchangeStarted(t){const e=this._audio;t?4==e.readyState&&e.play():e.pause()}onchangeLoop(t){this._audio.loop=t}onchange(t,e){"src"in t&&this.onchangeSrc(t.src),"started"in t&&this.onchangeStarted(t.started),"loop"in t&&this.onchangeLoop(t.loop)}ondblclick(t){this.started=!this.started}ondropfile(t,e){for(let r=0;r<t.length;r++)if(t[r].type.startsWith("audio/"))return void(this.src=e[r])}}ret.register("audio",Dat);class zat extends(oet(ret)){is3dish(){return!0}}ret.register("text",zat);const Nat=["refid","left","top","width","height","rotation","animation"];class Fat extends qot{isGroup(){return!0}get(t){return this._model[t]}set(t,e){if("string"==typeof t)return this.set({[t]:e});var r=Nat.reduce(((e,r)=>(t.hasOwnProperty(r)&&(e[r]=t[r]),e)),{});return super.set(r)}capture(t,e,r){var n=super.capture(t,e,r);if(n!==this)return n}set bounds(t){if(this.__MUTATING__)super.bounds=t;else{var e=this.bounds,r=t.width/e.width,n=t.height/e.height;this.path=this.path.map((i=>({x:t.left+(i.x-e.left)*r,y:t.top+(i.y-e.top)*n}))),this.components&&this.components.forEach((t=>{if(t.mutable)t.mutatePath(null,(function(t){return t.map((function(t){return{x:t.x*r,y:t.y*n}}))}));else{let e=t.bounds,i=t.center,o={x:i.x*(1-r),y:i.y*(1-n)},a=e.width*(1-r),s=e.height*(1-n),c=-(o.x-a/2),u=-(o.y-s/2);t.bounds={left:e.left+c,top:e.top+u,width:e.width*r,height:e.height*n}}}))}}get focusible(){return!1}get bounds(){return super.bounds}get hasTextProperty(){return!1}isIdentifiable(){return!1}calculateBounds(){this.clearCache(),this.__MUTATING__=!0,this.mutateBounds((function(t){var e=ret.union(this.components.map((t=>t.bounds)));return this.components.forEach((t=>{let r=t.bounds;t.bounds={left:r.left-e.left,top:r.top-e.top,width:r.width,height:r.height}})),{left:t.left+e.left,top:t.top+e.top,width:e.width,height:e.height}}),this),this.__MUTATING__=!1,this.parent.isGroup()&&this.parent.calculateBounds()}render(t){}postrender(t){var{top:e,left:r,scale:n}=this.state;t.translate(r,e),this.layout.drawables(this).forEach((e=>{e.draw(t)})),t.translate(-r,-e)}}ret.register("group",Fat);const Bat={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"id-input",label:"ref",name:"ref"},{type:"select",label:"fit",name:"fit",property:{options:["","both","ratio"]}}],"value-property":"ref",help:"scene/component/local-ref"};class Uat extends(oet(net)){get ref(){var t=this.getState("ref");return t&&"string"==typeof t?this.root.findById(t):null}set ref(t){this.setState("ref",t)}get refScale(){let t=this.ref.bounds,e=this.bounds,r=e.width/t.width,n=e.height/t.height;return"both"===this.model.fit?{x:r,y:n}:{x:Math.min(r,n),y:Math.min(r,n)}}draw(t){this._drawing||(this._drawing=!0,super.draw(t),this._drawing=!1)}prerender(t){if(super.prerender(t),this.ref){let e=this.ref.center,r=this.center,n=this.refScale;t.translate(r.x,r.y),t.scale(n.x,n.y),t.translate(-e.x,-e.y)}}postrender(t){if(this.ref)return this.ref.postrender(t);super.postrender(t)}render(t){if(this.ref)return this.ref.render(t);this.state;var{left:e,top:r,width:n,height:i}=this.bounds;t.beginPath(),t.rect(e,r,n,i)}get nature(){return Bat}get hasTextProperty(){return!1}}ret.memoize(Uat.prototype,"ref",!1),ret.memoize(Uat.prototype,"refScale",!1),ret.register("local-ref",Uat);class Yat extends(Hot(Iet)){render(t){}is3dish(){return!0}get layout(){return fet.get(this.get("layout"))||det}}const Hat={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"board-selector",label:"scene-number",name:"ref",placeholder:"SCENE-1"},{type:"number",label:"round",name:"round",property:{min:0}},{type:"select",label:"fit",name:"fit",property:{options:["","both","ratio","width","height","none"]}},{type:"select",label:"mode",name:"mode",property:{options:["view","interaction"]}}],"value-property":"ref",help:"scene/component/global-ref"};class $at extends Yat{dispose(){this._releaseRef(),super.dispose()}get nature(){return Hat}get hasTextProperty(){return!1}get tagName(){return"div"}setElementProperties(t){var{mode:e="view",round:r=0}=this.state;t.style.pointerEvents="view"==e?"none":"inherit",t.style.borderRadius=r+"px"}ready(){super.ready(),this.fetchRef()}reposition(){if(!this.element)return;super.reposition();let t=this._element_bounds,{offsetWidth:e,offsetHeight:r}=this.element;if(this._element_bounds={offsetWidth:e,offsetHeight:r},(!t||t.offsetWidth!=e||t.offsetHeight!=r)&&this.ref&&this.root.target_element){let{fit:t="ratio"}=this.state;this.ref.fit(t)}}async fetchRef(){this._releaseRef();var{ref:t,fit:e="ratio"}=this.state;if(t){var r=this.app.refProvider;if(r&&t)try{this.__ref=await r.get(t,!0),this.__ref.target=this.element,this.__ref.fit(e),this.__ref.data=this.data}catch(t){M9(t)}}}get ref(){return this.__ref}set ref(t){this.setState("ref",t)}_releaseRef(){this.__ref&&this.__ref.release&&this.__ref.release(),delete this.__ref}onchange(t,e,r){super.onchange(t,e,r),"ref"in t&&this.fetchRef(),"fit"in t&&this.ref&&requestAnimationFrame((()=>{let{fit:t}=this.state;this.ref.fit(t)})),"data"in t&&this.ref&&requestAnimationFrame((()=>{this.ref.data=t.data}))}}ret.register("global-ref",$at);const Gat={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"board-selector",label:"board",name:"board"},{type:"checkbox",label:"modal",name:"modal"},{type:"checkbox",label:"closable",name:"closable"},{type:"checkbox",label:"draggable",name:"draggable"},{type:"checkbox",label:"minimizable",name:"minimizable"},{type:"checkbox",label:"show",name:"show"},{type:"select",label:"location",name:"location",property:{options:["center","left-top","right-top","left-bottom","right-bottom","auto"]}},{type:"string",label:"title",name:"text"},{type:"data",label:"value",name:"value"}],help:"scene/component/popup"};class Wat extends(oet(net)){static get image(){return Wat._image||(Wat._image=new Image,Wat._image.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEYAAABGCAMAAABG8BK2AAADJmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgNzkuZGFiYWNiYiwgMjAyMS8wNC8xNC0wMDozOTo0NCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC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MARhB73r9B7YLrsqdE+0cq9Avzeg31eQx4aQ+Ks6aUd5DsYKixEX1w8vyT2VjoZ3YezY/cCEDvl+QTvRwJ0ifwK/5T/aw6+IuFuCImAcS6MQAAAeJJREFUWMPt2FlX2zAQhuHJYmOSFhIggbC0QNn3rS1dKXSH9///Hi58CJLxKIpEWi6YO8c5z4lG/nxGEXmu/1OVLGnhrFaSVQYg1SZetTTvUibqeFZ9QlfmvRWoV1VmCaCRzroXPpsuAjTV7gLUfPahBqD1OQMW/fazAWTKvQRI/ZgUSJR7U8CM/dHZ+/2VcatWdvdEZAaYUhiAwkerJXt0rnzXwdRKmHfDM0fHD5kxjTFyVLzVfvvirn7+cDJWjhy7c7XlYuwc6Urvu2tRhRypyhwAf1sKY+TIxfQA+H39q5wxc+RgVrcBduTmZTlj5khnDgH4IzKpMGaOVCbvyyvRGTNHGtPrKypjXirM5jb910I4k69oQeKY+77EMAcALEsck/+W6f71tyCma/ZFROTrJVwMy7wmf3bv6/MX+Dgkkysblvxps/dhOKZb6IvrTakzXXuPApnpYneDGOeKvJlaSXcDmA7AicQyW84VeTOnY+NdiWcG1uiZksFEHdyAlsJEjEkmkwGNsKHNZCJGSKtVTYC1tO022mnjwUBrMdXg8dreuOBhv7D/62/8lGZ1wLxXyZKOm+iUHIQintyny0TkaATHjYgcjeAoFpEje9R/nGPqIx2aw3NU9odCQI6e6x/VLY32cKQXVBnkAAAAAElFTkSuQmCC"),Wat._image}ready(){super.ready(),this.show&&this.onchangeShow(!0)}render(t){var{left:e,top:r,width:n,height:i}=this.bounds;t.beginPath(),this.drawImage(t,Wat.image,e,r,n,i)}onchange(t,e){"value"in t?this.show?this.onchangeShow(!0):this.show=!0:"show"in t&&this.onchangeShow(this.show)}onchangeShow(t){!this.app.isEditMode&&this.getState("board")&&(t?met.show(this,this.getState("board"),{location:this.getState("location"),modal:this.getState("modal"),closable:this.getState("closable")||!1,draggable:this.getState("draggable")||!1,minimizable:this.getState("minimizable")||!1,title:this.text,data:this.value}):met.hide(this))}get board(){return this.getState("board")}set board(t){this.set("board",t)}get show(){return this.getState("show")}set show(t){this.setState("show",t)}get started(){return this.getState("show")}set started(t){this.setState("show",t)}get value(){return this.getState("value")}set value(t){this.setState("value",t)}get hasTextProperty(){return!1}get nature(){return Gat}}ret.register("popup",Wat);class qat extends ret{render(t){var{path:e=[]}=this.state;if(!(e.length<=1)){t.beginPath(),t.moveTo(e[0].x,e[0].y);for(let r=1;r<e.length;r++)t.lineTo(e[r].x,e[r].y);t.closePath(),this.drawStroke(t)}}get path(){return this.model.path}set path(t){this.set("path",t)}contains(t,e){var r=this.state.path,n=!1;return r.forEach(((i,o)=>{let a=(o+r.length+1)%r.length,s=i.x,c=i.y,u=r[a].x,l=r[a].y;c>e!=l>e&&t<(u-s)*(e-c)/(l-c)+s&&(n=!n)})),n}}ret.register("path",qat);const Xat={mutable:!0,resizable:!1,rotatable:!0,properties:[{type:"number",label:"round",name:"round",property:{min:0,max:100,step:1}}],help:"scene/component/triangle"};class Vat extends net{contains(t,e){var{x1:r,y1:n,x2:i,y2:o,x3:a,y3:s}=this.state,c=[r,n,i,o,a,s],u=!1;for(let r=0;r<c.length;r+=2){let n=(r+2)%c.length,i=c[r],o=c[r+1],a=c[n+1];o>e!=a>e&&t<(c[n]-i)*(e-o)/(a-o)+i&&(u=!u)}return u}get mutable(){return!0}get path(){var{x1:t,y1:e,x2:r,y2:n,x3:i,y3:o}=this.state;return[{x:t,y:e},{x:r,y:n},{x:i,y:o}]}set path(t){this.set({x1:t[0].x,y1:t[0].y,x2:t[1].x,y2:t[1].y,x3:t[2].x,y3:t[2].y})}get nature(){return Xat}}ret.memoize(Vat.prototype,"path",!1),ret.register("triangle",Vat);const Kat={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"number",label:"ratio",name:"ratio",property:"ratio"}],help:"scene/component/donut"};var Qat={ondragmove:function(t,e,r){r.controls;var{cx:n,rx:i}=r.model;i=Math.abs(i);var o=(r.transcoordP2S(t.x,t.y).x-n)/i*100;o=o>=100||o<=-100?100:Math.abs(o),r.set({ratio:o})}};class Jat extends uat{is3dish(){return!1}render(t){var{ratio:e=50,cx:r,cy:n,rx:i,ry:o,startAngle:a,endAngle:s,anticlockwise:c}=this.state;i=Math.abs(i),o=Math.abs(o),t.beginPath(),t.ellipse(r,n,i,o,0,a||0,s||2*Math.PI,c),t.moveTo(r+i/100*e,n),t.ellipse(r,n,i/100*e,o/100*e,0,a||0,s||2*Math.PI,!0)}contains(t,e){var{cx:r,cy:n,rx:i,ry:o,ratio:a}=this.state,s=(t-r)/(2*(i=Math.abs(i))-.5),c=(e-n)/(2*(o=Math.abs(o))-.5),u=(t-r)/(i/100*a*2-.5),l=(e-n)/(o/100*a*2-.5),h=!1;return s*s+c*c<.25&&u*u+l*l>.25&&(h=!h),h}get controls(){var{cx:t,cy:e,rx:r,ratio:n}=this.state;return[{x:t+(r=Math.abs(r))/100*n,y:e,handler:Qat}]}get nature(){return Kat}}ret.memoize(Jat.prototype,"controls",!1),ret.register("donut",Jat);const Zat={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"number",label:"ratio",name:"ratio",property:"ratio"},{type:"number",label:"wing",name:"wing",property:"wing"}],help:"scene/component/star"};var tst={ondragmove:function(t,e,r){r.controls;var{cy:n,ry:i}=r.model,o=(r.transcoordP2S(t.x,t.y).y-n)/i*100+100;o>=100?o=100:o<=0&&(o=0),r.set({ratio:o})}};class est extends uat{is3dish(){return!1}render(t){var{ratio:e=30,wing:r=5,cx:n,cy:i,rx:o,ry:a,startAngle:s,endAngle:c,anticlockwise:u}=this.state;if(r<3)return;const l=1.5707963267948966;var h=2*Math.PI/r,f=o-e/100*o,d=a-e/100*a;t.save(),t.beginPath(),t.translate(n,i),t.moveTo(o*Math.cos(-l),a*Math.sin(-l)),t.lineTo((o-f)*(Math.cos(h-l)+Math.cos(0-l))/2,(a-d)*(Math.sin(h-l)+Math.sin(0-l))/2);for(var p=1;p<r;p++)t.lineTo(o*Math.cos(h*p-l),a*Math.sin(h*p-l)),t.lineTo((o-f)*(Math.cos(h*(p+1)-l)+Math.cos(h*p-l))/2,(a-d)*(Math.sin(h*(p+1)-l)+Math.sin(h*p-l))/2);t.closePath(),t.restore()}get controls(){var{cx:t,cy:e,ry:r,ratio:n}=this.state;return[{x:t,y:e-r+r*(n/100),handler:tst}]}get nature(){return Zat}}ret.memoize(est.prototype,"controls",!1),ret.register("star",est);var rst=t=>class extends t{animOnValueChange(t,e=!1,r){if(t!=this._lastValue){if(e)var n=t-(Number(r)||0);else n=t-(this._lastValue||0);this._lastValue=t,this._anim_alpha=-n,this.animate({step:t=>{this._anim_alpha=n*(t-1),this.invalidate()},duration:1e3,delta:"circ",options:{x:1},ease:"out"}).start()}}dispose(){super.dispose(),delete this._value_substitutor}onchange(t,e){t.hasOwnProperty("value")&&delete this._value_substitutor}get animAlpha(){return this._anim_alpha||0}get animValue(){return(this._lastValue||0)+(this._anim_alpha||0)}defaultValueSubstitutor(){return this.getState("value")}get valueSubstitutor(){return this._value_substitutor||(this._value_substitutor=$tt(this.getState("value"),this)||this.defaultValueSubstitutor),this._value_substitutor}get value(){return Number(this.valueSubstitutor())||0}set value(t){delete this._value_substitutor,this.setState("value",Number(g9(t)))}},nst=t=>class extends t{_convertDataFormat(t,e){var r;if("json"===e)r=JSON.parse(t);else r=t;return r}isDataSource(){return!0}},ist=0;const ost=new FinalizationRegistry((()=>{ist--}));class ast{static get residents(){return ist}static get residentsCount(){return ist}constructor(t,e){this.counters={},this.references={},this.creator=t,this.disposer=e,ist++,ost.register(this,ist)}dispose(){if(this.disposer)for(let t in this.references)this.disposer.call(null,t,this.references[t]);delete this.references,delete this.counters}get ids(){return Object.keys(this.references)}create(t){var e=this;return new Promise((function(r,n){e.creator?e.creator.call(null,t,(function(e){!function(e){e.release=function(){this.disposer&&this.disposer.call(null,t,e),delete e.release,P9("RELEASED",t)},r(e)}(e)}),(function(t){n(t)})):n(Error("Reference id("+t+") could not be created. Reference creator should be defined."))}))}add(t,e){var r=this,n=new Promise((function(n,i){var o=r.references[t];if(o)o===e?i(Error("Reference ID and target duplicate")):e?i(Error("Reference ID duplicate")):n(o);else{function a(e){e.release=function(){r.release(this)},r.references[t]=e,r.counters[t]=1,n(e)}if(e)a(e);else{if(!r.creator)return void i(Error("Reference id("+t+") is not allowed. Reference creator should be defined."));r.creator.call(null,t,(function(t){a(t)}),(function(t){i(t)}))}}}));return this.references[t]||(this.references[t]=n),n}async get(t,e){var r=this.references[t];if(r){if(!(r instanceof Promise)){if(!(t in this.counters))throw new Error("No Reference Count");return this.counters[t]++,r}if(e)return r=await r,this.counters[t]++,r}if(e)return await this.add(t);throw new Error("No References for "+t)}_id(t){for(let e in this.references){if(this.references[e]===t)return e}return-1}release(t){var e=this._id(t),r=this.references[e];r?(this.counters[e]--,0==this.counters[e]&&(this.disposer&&this.disposer.call(null,e,r),delete this.references[e],delete this.counters[e],delete t.release,P9("RELEASED",e))):M9("No Referenced ID")}}var sst={},cst={},ust=[];function lst(t){var e="SCRIPT"==t.target.tagName?sst:cst,r=t.target.src||t.target.href;e[r]=!0,ust.forEach(((t,n)=>{let{resolve:i,scripts:o,styles:a}=t;if(e==sst){let t=o.indexOf(r);t>-1&&t<o.length-1&&fst(o[t+1])}for(let t=0;t<o.length;t++)if(!sst[o[t]])return;if(a)for(let t=0;t<a.length;t++)if(!cst[a[t]])return;i(),ust[n]=null})),ust=ust.filter(Boolean)}function hst(t){var e=t.target.src,r="SCRIPT"==t.target.tagName?sst:cst;ust.forEach(((n,i)=>{let{reject:o,scripts:a,styles:s}=n,c=!1;if(r===sst){for(let t=0;t<a.length;t++)if(a[t]==e){c=!0;break}}else if(s)for(let t=0;t<s.length;t++)if(s[t]==e){c=!0;break}c&&(o(t),ust[i]=null)})),ust=ust.filter(Boolean),delete r[e],document.head.removeChild(t.target)}function fst(t){sst[t]=!1;var e=document.createElement("script");e.onload=lst,e.onerror=hst,e.type="text/javascript",e.src=t,document.head.appendChild(e)}class dst{static load(t,e){return"string"==typeof t&&(t=[t]),"string"==typeof e&&(e=[e]),new Promise((function(r,n){if((!t||t instanceof Array)&&(!e||e instanceof Array)){var i,o=!0;if(e&&e.forEach((t=>{cst.hasOwnProperty(t)||function(t){cst[t]=!1;var e=document.createElement("link");e.onload=lst,e.onerror=hst,e.type="text/css",e.rel="stylesheet",e.media="screen,print",e.href=t,document.head.appendChild(e)}(t),cst[t]||(o=!1)})),t&&t.length>0&&t.forEach((t=>{sst.hasOwnProperty(t)?sst[t]||(o=!1):i=i||t})),i)fst(i);else if(o)return void r();ust.push({resolve:r,reject:n,scripts:t,styles:e})}else n("invalid sources for load")}))}}const pst="0.0.0";var gst=0,vst=performance.now(),yst=0;function mst(){return gst}requestAnimationFrame((function t(){requestAnimationFrame(t),yst++;var e=performance.now(),r=e-vst;r<1e3||(gst=Math.round(1e3*yst/r),vst=e,yst=0)}));var bst=brt;function xst(){}export{bet as AbsoluteLayout,Dat as AudioPlayer,wet as CardLayout,ret as Component,Net as Connectable,qot as Container,Iet as ContainerAbstract,H9 as DEFAULT,B9 as DPPX,nst as DataSource,Jat as Donut,uat as Ellipse,Xnt as EventMap,mst as FPS,U9 as GESTURES,jat as GifView,$at as GlobalRef,Fat as Group,det as HTMLAbsoluteLayout,Yat as HTMLOverlayContainer,xat as HTMLOverlayElement,bat as ImageView,uet as InfoWindow,Y9 as KEYEVENTS,Cet as Layer,fet as Layout,sat as Line,_et as LinearHorizontalLayout,Eet as LinearVerticalLayout,Uat as LocalRef,F9 as MAX_UNDO_SIZE,L9 as MODE_ADD,R9 as MODE_EDIT,z9 as MODE_PASTE_DATABIND,D9 as MODE_PASTE_STYLE,j9 as MODE_SHIFT,C9 as MODE_VIEW,bst as Model,Pet as MoveHandle,I9 as NOTHING,yat as OrthoLine,qat as Path,fat as Polygon,gat as Polyline,Wat as Popup,Uet as Rect,oet as RectPath,ast as ReferenceMap,dit as RootContainer,Het as Ruler,N9 as SCENE_MODE,Mit as Scene,met as ScenePopup,dst as ScriptLoader,net as Shape,est as Star,Met as TableLayout,zat as Text,Vat as Triangle,rst as ValueHolder,Pit as create,P9 as debug,M9 as error,xst as license,u5 as polyfill,pst as version,T9 as warn};console.log("@hatiolab/things-scene@9.0.0-beta.31 is loaded");
|
|
71
|
+
`,this.element)}onchangeMinimized(){const{minimized:t}=this.state;t?this.setState("height",24):this.setState("height",this.get("height"))}}ret.register("container",qot);const Xot=Math.sqrt(3),Vot=2;function Kot(t,e,r,n,i){var o,a,s,c,u=5+i,l=r.x,h=r.y,f=n.x,d=n.y;if(Math.abs(l-f)>u&&Math.abs(h-d)>u){var p=(d-h)/(f-l),g=h-p*l;if(Math.abs(e-(p*t+g))>u)return!1}return l>f?(a=l,o=f):(a=f,o=l),h>d?(c=h,s=d):(c=d,s=h),!(a+5<t)&&(!(o-5>t)&&(!(c+5<e)&&!(s-5>e)))}function Qot(t,e,r,n=2){for(let i=0;i<r.length-1;i++)if(Kot(t,e,r[i],r[i+1],n))return!0;return!1}function Jot(t,e,r,n){if("arrow"!=t.slice(-5))return r;var i=Math.atan2(n.y-r.y,n.x-r.x),o=1.5*e;return{x:r.x+Math.cos(i)*o,y:r.y+Math.sin(i)*o}}function Zot(t,e,r){var{lineWidth:n=Vot,strokeStyle:i="#000000",lineCap:o=!1,alpha:a=1,begin:s="none",end:c="none",beginSize:u="size5",endSize:l="size5"}=r;if(("none"!=s||"none"!=c)&&(n=Number(n)||Vot,t.lineCap=o,t.lineWidth=n,t.strokeStyle=i,t.fillStyle=i,t.globalAlpha*=a,"none"!=s&&tat(t,e[0],e[1],n,s,eat(u,n)),"none"!=c)){let r=e.length;tat(t,e[r-1],e[r-2],n,c,eat(l,n))}}function tat(t,e,r,n,i,o){var{x:a,y:s}=e,c=Math.atan2(r.y-s,r.x-a);switch(t.beginPath(),t.translate(a,s),t.rotate(c),i){case"oval":t.ellipse(0,0,o.X,o.Y,0,0,2*Math.PI),t.fill();break;case"diamond":t.moveTo(-o.X,0),t.lineTo(0,-o.Y),t.lineTo(o.X,0),t.lineTo(0,o.Y),t.fill();break;case"arrow":t.moveTo(0,0),t.lineTo(Xot*o.X,-o.Y),t.lineTo(Xot*o.X,o.Y),t.fill();break;case"sharp-arrow":t.moveTo(0,0),t.lineTo(Xot*o.X,-o.Y),t.lineTo(-o.X/1.5+Xot*o.X,0),t.lineTo(Xot*o.X,o.Y),t.fill();break;case"open-arrow":t.moveTo(Xot*o.X+n,-o.Y),t.lineTo(n,0),t.lineTo(Xot*o.X+n,o.Y),t.stroke()}t.rotate(-c),t.translate(-a,-s),t.closePath()}function eat(t,e){let r={};switch(e*=1.2,t){case"size1":r.X=e,r.Y=e;break;case"size2":r.X=1.5*e,r.Y=e;break;case"size3":r.X=2*e,r.Y=e;break;case"size4":r.X=e,r.Y=1.5*e;break;case"size5":default:r.X=1.5*e,r.Y=1.5*e;break;case"size6":r.X=2*e,r.Y=1.5*e;break;case"size7":r.X=e,r.Y=2*e;break;case"size8":r.X=1.5*e,r.Y=2*e;break;case"size9":r.X=2*e,r.Y=2*e}return r}const rat="N",nat="S",iat="E",oat="W";class aat{constructor({component:t,anchor:e,position:r,self:n}){this.component=t,this._anchorName=e,this._position=r,this.self=n}get position(){const t=this.anchor;if(t){var{position:e}=t;const r=this.component.transcoordS2T(e.x,e.y);return this.self.transcoordT2P(r.x,r.y)}return this._position}set position({x:t,y:e}){this._position={x:t,y:e}}get anchor(){return this.component?.findAnchor(this._anchorName)}get direction(){const t=this.component.bounds,e=this.anchor;if(!e)return iat;const r=e.position;return r.y<=t.top?rat:r.y>=t.top+t.height?nat:r.x<=t.left?oat:iat}get boundaryPosition(){const t=this.anchor;if(t){var{position:e}=t,r=0,n=0;switch(this.direction){case nat:n=20;break;case rat:n=-20;break;case oat:r=-20;break;default:r=20}e={x:e.x+r,y:e.y+n};const i=this.component.transcoordS2T(e.x,e.y);return this.self.transcoordT2P(i.x,i.y)}}}class sat extends ret{isLine(){return!0}replaceRefids(t){["from","to"].forEach((e=>{const r=this.get(e);if(r?.component){const n=t.get(r.component)||r.component;this.set(e,{...r,component:n})}}))}get fromEnd(){if(this.parent&&!this._fromEnd){const{component:t,anchor:e,position:r}=this.getState("from")||{};if(!t)return;const n=this.root?.findByRefid(t);if(!n)return;this._fromEnd=new aat({component:n,fromto:"from",anchor:e,position:r,self:this})}return this._fromEnd}get from(){return this.getState("from")}set from(t){delete this._fromEnd,this.set("from",t)}get toEnd(){if(this.parent&&!this._toEnd){const{component:t,anchor:e,position:r}=this.getState("to")||{};if(!t)return;const n=this.root?.findByRefid(t);if(!n)return;this._toEnd=new aat({component:n,fromto:"to",anchor:e,position:r,self:this})}return this._toEnd}get to(){return this.getState("to")}set to(t){delete this._toEnd,this.set("to",t)}move({x:t,y:e},r){r&&(this.from={position:this._fromEnd?.position||this.getState("from")?.position||{x:0,y:0}},this.to={position:this._toEnd?.position||this.getState("to")?.position||{x:0,y:0}}),super.move({x:t,y:e},r)}render(t){var{begin:e="none",end:r="none",lineWidth:n,round:i=0}=this.state,o=this.drawPath;Zot(t,o,this.state),t.beginPath();var a=Jot(e,n,o[0],o[1]),s=Jot(r,n,o[o.length-1],o[o.length-2]);o=[a,...o.slice(1,-1),s];var c={x:a.x,y:a.y};t.moveTo(a.x,a.y);for(var u=1;u<o.length;u++){const e=c;c=o[u];const r=o[u+1];if(e.x===c.x&&e.y===c.y)continue;if(!r){t.lineTo(c.x,c.y);break}var l=0!==(d=Math.sqrt((e.x-c.x)*(e.x-c.x)+(e.y-c.y)*(e.y-c.y)))?Math.atan2(e.x-c.x,e.y-c.y):0,h=Math.sin(l)*Math.min(i,d/2)+c.x,f=Math.cos(l)*Math.min(i,d/2)+c.y;const n=i>0||0!==d?{x:h,y:f}:c;var d;l=0!==(d=Math.sqrt((r.x-c.x)*(r.x-c.x)+(r.y-c.y)*(r.y-c.y)))?Math.atan2(r.x-c.x,r.y-c.y):0,h=Math.sin(l)*Math.min(i,d/2)+c.x,f=Math.cos(l)*Math.min(i,d/2)+c.y;const a=i>0||0!==d?{x:h,y:f}:c;t.lineTo(n.x,n.y),i>0&&t.quadraticCurveTo(c.x,c.y,a.x,a.y)}this.drawStroke(t)}contains(t,e){var{lineWidth:r}=this.state;return Qot(t,e,this.drawPath,r)}get resizable(){return!1}get mutable(){return!0}get rotatable(){return!1}get path(){const{from:t,to:e}=this.state;var{x1:r,y1:n,x2:i,y2:o}=this.state;return[this.fromEnd?.position||t?.position||{x:r,y:n},this.toEnd?.position||e?.position||{x:i,y:o}]}set path(t){const[e,r]=t,{from:n,to:i}=this.state;delete this._fromEnd,delete this._toEnd,this.set({from:{...n,position:e},to:{...i,position:r}})}get textBounds(){var t,e,r=this.drawPath,n=0;for(let s=1;s<r.length;s++){var i=r[s-1],o=r[s],a=(i.x-o.x)*(i.x-o.x)+(i.y-o.y)*(i.y-o.y);a>n&&(n=Math.ceil(a),t=i,e=o)}var{paddingTop:s,paddingLeft:c,paddingRight:u,paddingBottom:l}=this.state;return l||=0,s||=0,c||=0,u||=0,{left:Math.min(t.x,e.x)+c,top:Math.min(t.y,e.y)+s,width:Math.max(Math.abs(t.x-e.x)-c-u,0),height:Math.max(Math.abs(t.y-e.y)-s-l,0)}}get decorators(){return["decotag"]}}sat.getTipNeckPos=Jot,sat.containedInPath=Qot,sat.drawEndTips=Zot,ret.register("line",sat);const cat={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"angle",label:"start-angle",name:"startAngle",property:"startAngle"},{type:"angle",label:"end-angle",name:"endAngle",property:"endAngle"}],"value-property":"text"};class uat extends(Net(net)){is3dish(){return!0}render(t){var{cx:e,cy:r,rx:n,ry:i,startAngle:o,endAngle:a,anticlockwise:s}=this.state;t.beginPath(),t.ellipse(e,r,Math.abs(n),Math.abs(i),0,o||0,a||2*Math.PI,s),void 0!==o&&void 0!==a&&(t.lineTo(e,r),t.closePath())}get path(){var{cx:t,cy:e,rx:r,ry:n}=this.state;return[{x:t-r,y:e-n},{x:t+r,y:e-n},{x:t+r,y:e+n},{x:t-r,y:e+n}]}set path(t){var e=t[0],r=t[2];this.set({cx:e.x+(r.x-e.x)/2,cy:e.y+(r.y-e.y)/2,rx:(r.x-e.x)/2,ry:(r.y-e.y)/2})}contains(t,e){var{cx:r,cy:n,rx:i,ry:o}=this.state,a=(t-r)/(2*i-.5),s=(e-n)/(2*o-.5);return a*a+s*s<.25}outline(t){return function(t,e){var{cx:r,cy:n,rx:i,ry:o}=t.model,a=2*Math.PI*e,s=r+i*Math.cos(a),c=n+o*Math.sin(a);return t.transcoordS2T(s,c)}(this,t)}get anchors(){return function(t){var{left:e,top:r,width:n,height:i}=t.bounds,o=e+n/2,a=r+i/2;return[{name:"TOP",position:{x:o,y:r}},{name:"RIGHT",position:{x:e+n,y:a}},{name:"BOTTOM",position:{x:o,y:r+i}},{name:"LEFT",position:{x:e,y:a}}]}(this)}get nature(){return cat}}ret.memoize(uat.prototype,"path",!1),ret.register("ellipse",uat);var lat={ondragstart:function(t,e,r){r.mutatePath(null,(function(r){r.splice(e+1,0,t)}))},ondragmove:function(t,e,r){r.mutatePath(null,(function(r){r[e+1]=t}))},ondragend:function(t,e,r){}};const hat={mutable:!0,resizable:!1,rotatable:!0,properties:[{type:"number",label:"round",name:"round",property:{min:0,max:100,step:1}}],help:"scene/component/polygon"};class fat extends net{is3dish(){return!0}get mutable(){return!0}get pathExtendable(){return!0}get path(){return this.state.path}set path(t){this.set("path",t)}contains(t,e){var r=this.state.path,n=!1;return r.forEach(((i,o)=>{let a=(o+r.length+1)%r.length,s=i.x,c=i.y,u=r[a].x,l=r[a].y;c>e!=l>e&&t<(u-s)*(e-c)/(l-c)+s&&(n=!n)})),n}get controls(){var t=this.path;return t.map(((e,r)=>{let n=t[r+1>=t.length?0:r+1];return{x:(e.x+n.x)/2,y:(e.y+n.y)/2,handler:lat}}))}get nature(){return hat}}ret.memoize(fat.prototype,"controls",!1),ret.register("polygon",fat);var dat={ondragstart:function(t,e,r){r.mutatePath(null,(function(r){r.splice(e,0,t)}))},ondragmove:function(t,e,r){r.mutatePath(null,(function(r){r[e]=t}))},ondragend:function(t,e,r){}};const pat={mutable:!1,resizable:!1,rotatable:!1,properties:[{type:"number",label:"round",name:"round",property:{min:0,max:100,step:1}}],help:"scene/component/polyline"};class gat extends sat{get pathExtendable(){return!0}get path(){const{from:t,to:e}=this.state,{path:r}=this.state;return[this.fromEnd?.position||t?.position||r[0],...r.slice(1,-1),this.toEnd?.position||e?.position||r[r.length-1]]}set path(t){const{from:e,to:r}=this.state;delete this._fromEnd,delete this._toEnd,this.set({from:{...e,position:t[0]},to:{...r,position:t[t.length-1]},path:t})}get controls(){var t=this.path,e=[];for(let r=0;r<t.length-1;r++){let n=t[r],i=t[r+1];0==r&&e.push({x:n.x,y:n.y,handler:dat}),e.push({x:(n.x+i.x)/2,y:(n.y+i.y)/2,handler:dat}),r==t.length-2&&e.push({x:i.x,y:i.y,handler:dat})}return e}get nature(){return pat}}ret.register("polyline",gat);const vat={mutable:!1,resizable:!1,rotatable:!1,properties:[{type:"number",label:"round",name:"round",property:{min:0,max:100,step:1}}],help:"scene/component/ortholine"};class yat extends sat{get pathExtendable(){return!1}get drawPath(){const t=this.path[0],e=this.path[1],{component:r,direction:n,boundaryPosition:i=t}=this.fromEnd||{},{component:o,direction:a,boundaryPosition:s=e}=this.toEnd||{};var c=[i,s],u=[];i&&u.push(i);var l=r?.bounds;if(l){var h=r.transcoordS2T(l.left,l.top);h=this.transcoordT2P(h.x,h.y),l={...l,left:h.x,top:h.y}}var f=l?{left:l.left-20,top:l.top-20,width:l.width+40,height:l.height+40}:{left:i.x,top:i.y,width:0,height:0};l=l||f;var d=o?.bounds;if(d){h=o.transcoordS2T(d.left,d.top);h=this.transcoordT2P(h.x,h.y),d={...d,left:h.x,top:h.y}}var p=d?{left:d.left-20,top:d.top-20,width:d.width+40,height:d.height+40}:{left:s.x,top:s.y,width:0,height:0};d=d||p;var g=[f,p];const v=f.left>p.left?p.left:f.left,y=f.top>p.top?p.top:f.top;var m,b,x,w,A,_,k,E,S,M,T={left:v,top:y,width:f.left+f.width>p.left+p.width?f.left+f.width-v:p.left+p.width-v,height:f.top+f.height>p.top+p.height?f.top+f.height-y:p.top+p.height-y},P=0,O=0;l.left+l.width<d.left?(w=0,A=1,S=n,M=a,m=(l.left+l.width+d.left)/2,P=d.left-m):d.left+d.width<l.left&&(w=1,A=0,S=a,M=n,m=(l.left+d.width+d.left)/2,P=l.left-m),l.top+l.height<d.top?(x=0,_=1,k=n,E=a,b=(l.top+l.height+d.top)/2,O=d.top-b):d.top+d.height<l.top&&(x=1,_=0,k=a,E=n,b=(l.top+d.height+d.top)/2,O=l.top-b);var I=[];if(m&&P>O){switch(M){case oat:switch(S){case iat:I.push({x:m,y:c[w].y}),I.push({x:m,y:c[A].y});break;case oat:var C=g[w].top+g[w].height/2>c[A].y?Math.min(g[w].top,c[A].y):Math.max(g[w].top+g[w].height,c[A].y);I.push({x:c[w].x,y:C}),I.push({x:m,y:C}),I.push({x:m,y:c[A].y});break;case rat:case nat:C=S===nat?Math.max(c[w].y,c[A].y):Math.min(c[w].y,c[A].y);I.push({x:c[w].x,y:C}),I.push({x:m,y:C}),I.push({x:m,y:c[A].y});break;default:return this.path}break;case iat:switch(S){case iat:var R=C=c[w].y<c[A].y?Math.min(g[A].top,c[w].y):Math.max(g[A].top+g[A].height,c[w].y);break;case oat:R=C=void 0!==b?b:c[w].y<c[A].y?T.top-.5*P:T.top+T.height+.5*P;break;case nat:R=C=void 0!==b?Math.max(b,c[w].y):T.top+T.height;break;case rat:R=C=b?Math.min(b,g[w].top):T.top;break;default:return this.path}I.push({x:c[w].x,y:C}),I.push({x:m,y:C}),I.push({x:m,y:R}),I.push({x:c[A].x,y:R});break;case nat:switch(S){case iat:C=c[w].y,R=c[w].y>c[A].y?c[w].y:g[A].top+g[A].height;break;case oat:R=C=b?Math.max(b,g[A].top+g[A].height):T.top+T.height;break;case nat:R=C=T.top+T.height;break;case rat:C=b?Math.min(b,g[w].top):g[w].top,R=b?Math.max(b,g[A].top+g[A].height):g[A].top+g[A].height;break;default:return this.path}I.push({x:c[w].x,y:C}),I.push({x:m,y:C}),I.push({x:m,y:R}),I.push({x:c[A].x,y:R});break;case rat:switch(S){case iat:C=c[w].y,R=c[w].y<c[A].y?c[w].y:g[A].top;break;case oat:R=C=b?Math.min(b,g[A].top):T.top;break;case nat:C=void 0!==b?Math.max(b,c[w].y):c[w].y,R=void 0!==b?Math.min(b,c[A].y):c[A].y;break;case rat:R=C=T.top;break;default:return this.path}I.push({x:c[w].x,y:C}),I.push({x:m,y:C}),I.push({x:m,y:R}),I.push({x:c[A].x,y:R});break;default:return this.path}u.push(...0===w?I:I.reverse())}else if(b){switch(E){case rat:switch(k){case nat:I.push({x:c[x].x,y:b}),I.push({x:c[_].x,y:b});break;case rat:var j=g[x].left+g[x].width/2>c[_].x?Math.min(g[x].left,c[_].x):Math.max(g[x].left+g[x].width,c[_].x);I.push({x:j,y:c[x].y}),I.push({x:j,y:b}),I.push({x:c[_].x,y:b});break;case oat:j=Math.min(c[x].x,c[_].x);I.push({x:j,y:c[x].y}),I.push({x:j,y:b}),I.push({x:c[_].x,y:b});break;case iat:j=Math.max(c[x].x,c[_].x);I.push({x:j,y:c[x].y}),I.push({x:j,y:b}),I.push({x:c[_].x,y:b});break;default:return this.path}break;case nat:switch(k){case oat:var L=j=T.left;break;case iat:L=j=void 0!==m?Math.max(m,c[x].x):T.left+T.width;break;case rat:L=j=void 0!==m?m:c[x].x<c[_].x?T.left-.5*O:T.left+T.width+.5*O;break;case nat:j=c[x].x,L=c[x].x<c[_].x?Math.min(g[_].left,c[x].x):Math.max(g[_].left+g[_].width,c[x].x);break;default:return this.path}I.push({x:j,y:c[x].y}),I.push({x:j,y:b}),I.push({x:L,y:b}),I.push({x:L,y:c[_].y});break;case iat:switch(k){case oat:j=void 0!==m?Math.min(m,c[x].x):c[x].x,L=void 0!==m?Math.max(m,c[_].x):c[_].x;break;case iat:L=j=T.left+T.width;break;case rat:L=j=void 0!==m?Math.max(m,c[_].x):T.left+T.width;break;case nat:j=c[x].x,L=Math.max(g[_].left+g[_].width,c[x].x);break;default:return this.path}I.push({x:j,y:c[x].y}),I.push({x:j,y:b}),I.push({x:L,y:b}),I.push({x:L,y:c[_].y});break;case oat:switch(k){case oat:L=j=T.left;break;case iat:j=void 0!==m?Math.max(m,c[x].x):c[x].x,L=void 0!==m?Math.min(m,c[_].x):c[_].x;break;case rat:L=j=T.left;break;case nat:j=c[x].x<c[_].x?Math.min(g[_].left,c[x].x):c[x].x,L=Math.min(j,c[_].x);break;default:return this.path}I.push({x:j,y:c[x].y}),I.push({x:j,y:b}),I.push({x:L,y:b}),I.push({x:L,y:c[_].y});break;default:return this.path}u.push(...0===x?I:I.reverse())}else switch(n){case rat:switch(a){case rat:var D=T.top;u.push({x:c[0].x,y:D}),u.push({x:c[1].x,y:D});break;case nat:var z=T.left+T.width;u.push({x:z,y:c[0].y}),u.push({x:z,y:T.top+T.height}),u.push({x:c[1].x,y:T.top+T.height});break;case iat:z=c[1].y<c[0].y&&c[1].x<c[0].x?c[0].x:T.left+T.width;u.push({x:z,y:c[0].y}),u.push({x:z,y:c[1].y});break;case oat:z=T.left;u.push({x:z,y:c[0].y}),u.push({x:z,y:c[1].y});break;default:return this.path}break;case nat:switch(a){case rat:z=T.left+T.width;u.push({x:z,y:c[0].y}),u.push({x:z,y:T.top}),u.push({x:c[1].x,y:T.top});break;case nat:D=T.top+T.height;u.push({x:c[0].x,y:D}),u.push({x:c[1].x,y:D});break;case iat:D=T.top+T.height;u.push({x:c[0].x,y:D}),u.push({x:c[1].x,y:D});break;case oat:D=T.top+T.height;u.push({x:c[0].x,y:D}),u.push({x:c[1].x,y:D});break;default:return this.path}break;case oat:switch(a){case rat:z=c[0].x>c[1].x&&c[0].y<c[1].y?c[1].x:T.left,D=c[0].x>c[1].x&&c[0].y<c[1].y?c[1].y:Math.min(T.top,c[0].y);u.push({x:z,y:c[0].y}),u.push({x:z,y:D}),u.push({x:c[1].x,y:D});break;case nat:z=T.left,D=Math.max(T.top+T.height,c[0].y);u.push({x:z,y:c[0].y}),u.push({x:z,y:D}),u.push({x:c[1].x,y:D});break;case iat:z=T.left+T.width;u.push({x:c[0].x,y:T.top}),u.push({x:z,y:T.top}),u.push({x:z,y:c[1].y});break;case oat:z=T.left;u.push({x:z,y:c[0].y}),u.push({x:z,y:c[1].y});break;default:return this.path}break;case iat:switch(a){case rat:D=c[0].y<c[1].y&&c[0].x<c[1].x?c[0].y:T.top;u.push({x:c[0].x,y:D}),u.push({x:c[1].x,y:D});break;case nat:D=c[0].y>c[1].y&&c[0].x<c[1].x?c[0].y:T.top+T.height;u.push({x:c[0].x,y:D}),u.push({x:c[1].x,y:D});break;case iat:D=T.top+T.height;u.push({x:c[0].x,y:D}),u.push({x:c[1].x,y:D});break;case oat:D=T.top+T.height;u.push({x:c[0].x,y:D}),u.push({x:c[1].x,y:D});break;default:return this.path}break;default:return this.path}return s&&u.push(s),[t,...u,e].filter(((t,e,r)=>{if(0===e)return!0;const n=r[e-1];return t.x!==n.x||t.y!==n.y})).filter(((t,e,r)=>{if(0===e||e>=r.length-1)return!0;const n=r[e-1],i=r[e+1];return!(t.x===n.x&&t.x===i.x||t.y===n.y&&t.y===i.y)}))}get nature(){return vat}}ret.register("ortholine",yat);const mat={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"image-selector",label:"image-src",name:"src",property:{displayField:"id",displayFullUrl:!0,baseUrlAlias:"$base_url",defaultStorage:"scene-image",storageFilters:{type:Array,value:[{name:"category",value:"image"}]},useUpload:!0}},{type:"select",label:"cross-origin",name:"crossOrigin",property:{options:["","anonymous","use-credentials"]}}],"value-property":"src",help:"scene/component/image-view"};class bat extends(oet(net)){static get noimage(){return bat.NOIMAGE||(bat.NOIMAGE=new Image,bat.NOIMAGE.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABIBAMAAAD7Se1QAAAAIVBMVEUAAABHcEwBAQEREREBAQEEBAQGBgYLCwsDAwMDAwMICAi6HF9tAAAAC3RSTlNNAEAERiMYCS41Eac10lYAAAEgSURBVHhe7dY9asQwEAXgh7DNertNiJy48pIitY3SB7bYdk0ukL1BDDmA9gZecoH4pmFQ3MQayUMguPBrNPD4wD9TCMvJmt3M/AtYwXOlXiWgqADVCUBD46MAnGhMBaCiUQmAm8VA/Eh/eWl9Fn5WcxD+OLuRrUYJDKLluwH2InACUgkoACSdADxQc50Bytadb9RkM0CT13TcvlCT1HFg8UTHvasuUVACCa3El6u2UdD8LFTlKhUFFgA+d3dj10aABkUN72N3jAADCrJq7PIIsPidcxBoTHIIAjMFmyCwmGYIAA1P9gFgfCANAOsDSccCDW+uLDB+kLGg94OkZoAGkwsDDAe2DOg5oPxAg03rBR88OHpBz4N8UVeHFSwma74BTW6Ge4rIRa4AAAAASUVORK5CYII="),bat.NOIMAGE}dispose(){super.dispose(),this._offcanvas=null,this._image=null}render(t){var{left:e,top:r,width:n,height:i,isGray:o=!1,alpha:a=1,src:s}=this.state;if(this.prepareIf(!this._image&&s),t.beginPath(),t.globalAlpha*=a,this._image&&this._image.complete)if(o&&this._offcanvas)t.drawImage(this._offcanvas,e,r,n,i);else try{t.drawImage(this._image,e,r,n,i)}catch(o){t.drawImage(bat.noimage,e,r,n,i)}else!this.app.isViewMode&&t.drawImage(bat.noimage,e,r,n,i)}get nature(){return mat}get hasTextProperty(){return!1}ready(){super.ready(),this.prepareIf(!this._image&&this.state.src)}prepare(t,e){var{src:r,crossOrigin:n}=this.state;if(r){this._image=new Image;try{n&&(this._image.crossOrigin=n),this._image.src=this.app.url(r)||""}catch(t){return void e(t)}this._image.onload=()=>{if(this.get("isGray")){let t=this._image.width,e=this._image.height;this._offcanvas=ret.createCanvas(t,e);let r=this._offcanvas.getContext("2d");r.drawImage(this._image,0,0);let n=function(t,e,r){try{var n=t.getImageData(0,0,e,r)}catch(t){return M9("Get Image Data Error: "+t.message),null}var i=n.data;for(let t=0;t<e*r*4;t+=4){let e=i[t],r=i[t+1],o=i[t+2],a=parseInt((e+r+o)/3);n.data[t]=a,n.data[t+1]=a,n.data[t+2]=a}return n}(r,t,e);r.putImageData(n,0,0)}t(this)},this._image.onerror=t=>{this._image&&!this._image.currentSrc&&(this._image=null),e(t)}}else t(this)}get src(){return this.get("src")}set src(t){this.set("src",t)}onchange(t,e){(t.hasOwnProperty("src")||t.hasOwnProperty("isGray"))&&(this._offcanvas=null,this._image=null,this.prepareIf(t.src))}ondropfile(t,e){for(let r=0;r<t.length;r++)if(t[r].type.startsWith("image/"))return void(this.src=e[r])}}ret.register("image-view",bat);class xat extends(Hot(oet(ret))){is3dish(){return!0}prerender(){}}var wat={},Aat={},_at={};Object.defineProperty(_at,"__esModule",{value:!0});var kat=function(){function t(){}return t.bitsToNum=function(t){return t.reduce((function(t,e){return 2*t+e}),0)},t.byteToBitArr=function(t){for(var e=[],r=7;r>=0;r--)e.push(!!(t&1<<r));return e},t.lzwDecode=function(t,e){for(var r,n,i=0,o=function(t){for(var r=0,n=0;n<t;n++)e.charCodeAt(i>>3)&1<<(7&i)&&(r|=1<<n),i++;return r},a=[],s=1<<t,c=s+1,u=t+1,l=[],h=function(){l=[],u=t+1;for(var e=0;e<s;e++)l[e]=[e];l[s]=[],l[c]=null};;)if(n=r,(r=o(u))!==s){if(r===c)break;if(r<l.length)n!==s&&l.push(l[n].concat(l[r][0]));else{if(r!==l.length)throw new Error("Invalid LZW code.");l.push(l[n].concat(l[n][0]))}a.push.apply(a,l[r]),l.length===1<<u&&u<12&&u++}else h();return a},t}();_at.SuperGifUtils=kat,Object.defineProperty(Aat,"__esModule",{value:!0});var Eat=_at,Sat=function(){function t(t,e){this.stream=t,this.handler=e}return t.prototype.parseCT=function(t){for(var e=[],r=0;r<t;r++)e.push(this.stream.readBytes(3));return e},t.prototype.readSubBlocks=function(){var t,e;e="";do{t=this.stream.readByte(),e+=this.stream.read(t)}while(0!==t);return e},t.prototype.parseHeader=function(){var t={};if(t.sig=this.stream.read(3),t.ver=this.stream.read(3),"GIF"!==t.sig)throw new Error("Not a GIF file.");t.width=this.stream.readUnsigned(),t.height=this.stream.readUnsigned();var e=Eat.SuperGifUtils.byteToBitArr(this.stream.readByte());t.gctFlag=e.shift(),t.colorRes=Eat.SuperGifUtils.bitsToNum(e.splice(0,3)),t.sorted=e.shift(),t.gctSize=Eat.SuperGifUtils.bitsToNum(e.splice(0,3)),t.bgColor=this.stream.readByte(),t.pixelAspectRatio=this.stream.readByte(),t.gctFlag&&(t.gct=this.parseCT(1<<t.gctSize+1)),this.handler.hdr&&this.handler.hdr(t)},t.prototype.parseExt=function(t){var e=this;switch(t.label=this.stream.readByte(),t.label){case 249:t.extType="gce",function(t){e.stream.readByte();var r=Eat.SuperGifUtils.byteToBitArr(e.stream.readByte());t.reserved=r.splice(0,3),t.disposalMethod=Eat.SuperGifUtils.bitsToNum(r.splice(0,3)),t.userInput=r.shift(),t.transparencyGiven=r.shift(),t.delayTime=e.stream.readUnsigned(),t.transparencyIndex=e.stream.readByte(),t.terminator=e.stream.readByte(),e.handler.gce&&e.handler.gce(t)}(t);break;case 254:t.extType="com",function(t){t.comment=e.readSubBlocks(),e.handler.com&&e.handler.com(t)}(t);break;case 1:t.extType="pte",function(t){e.stream.readByte(),t.ptHeader=e.stream.readBytes(12),t.ptData=e.readSubBlocks(),e.handler.pte&&e.handler.pte(t)}(t);break;case 255:t.extType="app",function(t){e.stream.readByte(),t.identifier=e.stream.read(8),t.authCode=e.stream.read(3),"NETSCAPE"===t.identifier?function(t){e.stream.readByte(),t.unknown=e.stream.readByte(),t.iterations=e.stream.readUnsigned(),t.terminator=e.stream.readByte(),e.handler.app&&e.handler.app.NETSCAPE&&e.handler.app.NETSCAPE(t)}(t):function(t){t.appData=e.readSubBlocks(),e.handler.app&&e.handler.app[t.identifier]&&e.handler.app[t.identifier](t)}(t)}(t);break;default:t.extType="unknown",function(t){t.data=e.readSubBlocks(),e.handler.unknown&&e.handler.unknown(t)}(t)}},t.prototype.parseImg=function(t){t.leftPos=this.stream.readUnsigned(),t.topPos=this.stream.readUnsigned(),t.width=this.stream.readUnsigned(),t.height=this.stream.readUnsigned();var e=Eat.SuperGifUtils.byteToBitArr(this.stream.readByte());t.lctFlag=e.shift(),t.interlaced=e.shift(),t.sorted=e.shift(),t.reserved=e.splice(0,2),t.lctSize=Eat.SuperGifUtils.bitsToNum(e.splice(0,3)),t.lctFlag&&(t.lct=this.parseCT(1<<t.lctSize+1)),t.lzwMinCodeSize=this.stream.readByte();var r=this.readSubBlocks();t.pixels=Eat.SuperGifUtils.lzwDecode(t.lzwMinCodeSize,r),t.interlaced&&(t.pixels=function(t,e){for(var r=new Array(t.length),n=t.length/e,i=function(n,i){var o=t.slice(i*e,(i+1)*e);r.splice.apply(r,[n*e,e].concat(o))},o=[0,4,2,1],a=[8,8,4,2],s=0,c=0;c<4;c++)for(var u=o[c];u<n;u+=a[c])i(u,s),s++;return r}(t.pixels,t.width)),this.handler.img&&this.handler.img(t)},t.prototype.parseBlock=function(){var t={};switch(t.sentinel=this.stream.readByte(),String.fromCharCode(t.sentinel)){case"!":t.type="ext",this.parseExt(t);break;case",":t.type="img",this.parseImg(t);break;case";":t.type="eof",this.handler.eof&&this.handler.eof(t);break;default:throw new Error("Unknown block: 0x"+t.sentinel.toString(16))}"eof"!==t.type&&setTimeout(this.parseBlock.bind(this),0)},t.prototype.parse=function(){this.parseHeader(),setTimeout(this.parseBlock.bind(this),0)},t}();Aat.SuperGifParser=Sat;var Mat={};Object.defineProperty(Mat,"__esModule",{value:!0});var Tat=function(){function t(t){this.data=t,this.position=0}return t.prototype.readByte=function(){if(this.position>=this.data.length)throw new Error("Attempted to read past end of stream.");return this.data instanceof Uint8Array?this.data[this.position++]:255&this.data.charCodeAt(this.position++)},t.prototype.readBytes=function(t){for(var e=[],r=0;r<t;r++)e.push(this.readByte());return e},t.prototype.read=function(t){for(var e="",r=0;r<t;r++)e+=String.fromCharCode(this.readByte());return e},t.prototype.readUnsigned=function(){var t=this.readBytes(2);return(t[1]<<8)+t[0]},t}();Mat.SuperGifStream=Tat,Object.defineProperty(wat,"__esModule",{value:!0});var Pat=Aat,Oat=Mat,Iat=function(){function t(t,e){var r=this;for(var n in this.gifImgElement=t,this.options={autoPlay:!0},this.loading=!1,this.ready=!1,this.transparency=null,this.delay=null,this.disposalMethod=null,this.disposalRestoreFromIdx=null,this.lastDisposalMethod=null,this.frame=null,this.lastImg=null,this.playing=!0,this.forward=!0,this.ctxScaled=!1,this.frames=[],this.frameOffsets=[],this.initialized=!1,this.currentFrameIndex=-1,this.iterationCount=0,this.stepping=!1,this.handler={hdr:this.withProgress(this.doHdr.bind(this)),gce:this.withProgress(this.doGCE.bind(this)),com:this.withProgress(this.doNothing.bind(this)),app:{NETSCAPE:this.withProgress(this.doNothing.bind(this))},img:this.withProgress(this.doImg.bind(this)),eof:function(){r.pushFrame(),r.canvas.width=r.hdr.width*r.getCanvasScale(),r.canvas.height=r.hdr.height*r.getCanvasScale(),r.playerInit(),r.loading=!1,r.ready=!0,r.loadCallback&&r.loadCallback(r.gifImgElement)}},e)this.options[n]=e[n];this.onEndListener=e.onEnd,this.loopDelay=e.loopDelay||0,this.overrideLoopMode=null!=e.loopMode?e.loopMode:"auto",this.drawWhileLoading=null==e.drawWhileLoading||e.drawWhileLoading}return t.prototype.init=function(){var t=this.gifImgElement.parentNode,e=document.createElement("div");this.canvas=document.createElement("canvas"),this.canvasContext=this.canvas.getContext("2d"),this.tmpCanvas=document.createElement("canvas"),e.className=this.options.enclosingClass||"super-gif",e.appendChild(this.canvas),t&&(t.insertBefore(e,this.gifImgElement),t.removeChild(this.gifImgElement)),this.initialized=!0},t.prototype.loadSetup=function(t){return!this.loading&&(t&&(this.loadCallback=t),this.loading=!0,this.frames=[],this.clear(),this.disposalRestoreFromIdx=null,this.lastDisposalMethod=null,this.frame=null,this.lastImg=null,!0)},t.prototype.completeLoop=function(){this.onEndListener&&this.onEndListener(this.gifImgElement),this.iterationCount++,!1!==this.overrideLoopMode||this.iterationCount<0?this.doStep():(this.stepping=!1,this.playing=!1)},t.prototype.doStep=function(){if(this.stepping=this.playing,this.stepping){this.stepFrame(1);var t=10*this.frames[this.currentFrameIndex].delay;t||(t=100),0===this.getNextFrameNo()?(t+=this.loopDelay,setTimeout(this.completeLoop.bind(this),t)):setTimeout(this.doStep.bind(this),t)}},t.prototype.step=function(){this.stepping||setTimeout(this.doStep.bind(this),0)},t.prototype.putFrame=function(){var t;this.currentFrameIndex=parseInt(this.currentFrameIndex.toString(),10),this.currentFrameIndex>this.frames.length-1&&(this.currentFrameIndex=0),this.currentFrameIndex<0&&(this.currentFrameIndex=0),t=this.frameOffsets[this.currentFrameIndex],this.tmpCanvas.getContext("2d").putImageData(this.frames[this.currentFrameIndex].data,t.x,t.y),this.canvasContext.globalCompositeOperation="copy",this.canvasContext.drawImage(this.tmpCanvas,0,0)},t.prototype.playerInit=function(){this.loadErrorCause||(this.canvasContext.scale(this.getCanvasScale(),this.getCanvasScale()),this.options.autoPlay?this.step():(this.currentFrameIndex=0,this.putFrame()))},t.prototype.clear=function(){this.transparency=null,this.delay=null,this.lastDisposalMethod=this.disposalMethod,this.disposalMethod=null,this.frame=null},t.prototype.parseStream=function(t){try{new Pat.SuperGifParser(t,this.handler).parse()}catch(t){this.handleError("parse")}},t.prototype.setSizes=function(t,e){this.canvas.width=t*this.getCanvasScale(),this.canvas.height=e*this.getCanvasScale(),this.tmpCanvas.width=t,this.tmpCanvas.height=e,this.tmpCanvas.style.width=t+"px",this.tmpCanvas.style.height=e+"px",this.tmpCanvas.getContext("2d").setTransform(1,0,0,1,0,0)},t.prototype.drawError=function(){this.canvasContext.fillStyle="black",this.canvasContext.fillRect(0,0,this.hdr.width,this.hdr.height),this.canvasContext.strokeStyle="red",this.canvasContext.lineWidth=3,this.canvasContext.moveTo(0,0),this.canvasContext.lineTo(this.hdr.width,this.hdr.height),this.canvasContext.moveTo(0,this.hdr.height),this.canvasContext.lineTo(this.hdr.width,0),this.canvasContext.stroke()},t.prototype.handleError=function(t){this.loadErrorCause=t,this.hdr={width:this.gifImgElement.width,height:this.gifImgElement.height},this.frames=[],this.drawError()},t.prototype.doHdr=function(t){this.hdr=t,this.setSizes(this.hdr.width,this.hdr.height)},t.prototype.doGCE=function(t){this.pushFrame(),this.clear(),this.transparency=t.transparencyGiven?t.transparencyIndex:null,this.delay=t.delayTime,this.disposalMethod=t.disposalMethod},t.prototype.pushFrame=function(){this.frame&&(this.frames.push({data:this.frame.getImageData(0,0,this.hdr.width,this.hdr.height),delay:this.delay}),this.frameOffsets.push({x:0,y:0}))},t.prototype.doImg=function(t){var e=this;this.frame||(this.frame=this.tmpCanvas.getContext("2d"));var r=this.frames.length,n=t.lctFlag?t.lct:this.hdr.gct;r>0&&(3===this.lastDisposalMethod?null!==this.disposalRestoreFromIdx?this.frame.putImageData(frames[this.disposalRestoreFromIdx].data,0,0):this.frame.clearRect(this.lastImg.leftPos,this.lastImg.topPos,this.lastImg.width,this.lastImg.height):this.disposalRestoreFromIdx=r-1,2===this.lastDisposalMethod&&this.frame.clearRect(this.lastImg.leftPos,this.lastImg.topPos,this.lastImg.width,this.lastImg.height));var i=this.frame.getImageData(t.leftPos,t.topPos,t.width,t.height);t.pixels.forEach((function(t,r){t!==e.transparency&&(i.data[4*r+0]=n[t][0],i.data[4*r+1]=n[t][1],i.data[4*r+2]=n[t][2],i.data[4*r+3]=255)})),this.frame.putImageData(i,t.leftPos,t.topPos),this.ctxScaled||(this.canvasContext.scale(this.getCanvasScale(),this.getCanvasScale()),this.ctxScaled=!0),this.drawWhileLoading&&(this.canvasContext.drawImage(this.tmpCanvas,0,0),this.drawWhileLoading=this.options.autoPlay),this.lastImg=t},t.prototype.doNothing=function(){},t.prototype.withProgress=function(t){return function(e){t(e)}},t.prototype.getNextFrameNo=function(){var t=this.forward?1:-1;return(this.currentFrameIndex+t+this.frames.length)%this.frames.length},t.prototype.stepFrame=function(t){this.currentFrameIndex=this.currentFrameIndex+t,this.putFrame()},t.prototype.getCanvasScale=function(){return this.options.maxWidth&&this.hdr&&this.hdr.width>this.options.maxWidth?this.options.maxWidth/this.hdr.width:window.devicePixelRatio||1},t.prototype.play=function(){this.playing=!0,this.step()},t.prototype.pause=function(){this.playing=!1},t.prototype.isPlaying=function(){return this.playing},t.prototype.getCanvas=function(){return this.canvas},t.prototype.isLoading=function(){return this.loading},t.prototype.isReady=function(){return this.ready},t.prototype.isAutoPlay=function(){return this.options.autoPlay},t.prototype.getLength=function(){return this.frames.length},t.prototype.getCurrentFrame=function(){return this.currentFrameIndex},t.prototype.moveTo=function(t){this.currentFrameIndex=t,this.putFrame()},t.prototype.loadURL=function(t,e){var r=this;if(this.loadSetup(e)){var n=new XMLHttpRequest;n.open("GET",t,!0),"overrideMimeType"in n?n.overrideMimeType("text/plain; charset=x-user-defined"):"responseType"in n?n.responseType="arraybuffer":n.setRequestHeader("Accept-Charset","x-user-defined"),n.onloadstart=function(){r.initialized||r.init()},n.onload=function(){if(200===n.status){var t=n.response;t.toString().indexOf("ArrayBuffer")>0&&(t=new Uint8Array(t));var e=new Oat.SuperGifStream(t);setTimeout((function(){r.parseStream(e)}),0)}else r.handleError("xhr - response")},n.onerror=function(){r.handleError("xhr")},n.send()}},t.prototype.load=function(t){this.loadURL(this.gifImgElement.src,t)},t}(),Cat=wat.SuperGif=Iat;const Rat={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"image-selector",label:"src",name:"src"},{type:"checkbox",label:"play",name:"play"}],"value-property":"src",help:"scene/component/gif-view"};class jat extends xat{async oncreate_element(t){var{src:e,play:r}=this.state;this.onchangesrc(e),this.onchangeplay(r)}buildImg(){var t=this.element;t.innerHTML="";var e=document.createElement("img");return e.style.width="100%",e.style.height="100%",t.appendChild(e),e}onchange(t,e){super.onchange(t,e),"src"in t&&this.onchangesrc(t.src),"play"in t&&this.onchangeplay(t.play)}setElementProperties(t){}onchangeplay(t){var e=this._superGif;e&&e.isReady()&&(t?e.play():e.pause())}onchangesrc(t){var e=this.buildImg();t||(t="data:image/gif;base64,R0lGODlhYABIAPcAAAAAAAEBAQICAgMDAwQEBAUFBQYGBgcHBwgICAkJCQoKCgsLCwwMDA0NDQ4ODg8PDxAQEBERERISEhMTExQUFBUVFRYWFhcXFxgYGBkZGRoaGhsbGxwcHB0dHR4eHh8fHyAgICEhISIiIiMjIyQkJCUlJSYmJicnJygoKCkpKSoqKisrKywsLC0tLS4uLi8vLzAwMDExMTIyMjMzMzQ0NDU1NTY2Njc3Nzg4ODk5OTo6Ojs7Ozw8PD09PT4+Pj8/P0BAQEFBQUJCQkNDQ0REREVFRUZGRkdHR0hISElJSUpKSktLS0xMTE1NTU5OTk9PT1BQUFFRUVJSUlNTU1RUVFVVVVZWVldXV1hYWFlZWVpaWltbW1xcXF1dXV5eXl9fX2BgYGFhYWJiYmNjY2RkZGVlZWZmZmdnZ2hoaGlpaWpqamtra2xsbG1tbW5ubm9vb3BwcHFxcXJycnNzc3R0dHV1dXZ2dnd3d3h4eHl5eXp6ent7e3x8fH19fX5+fn9/f4CAgIGBgYKCgoODg4SEhIWFhYaGhoeHh4iIiImJiYqKio+Pj5iYmKCgoKampqurq66urrCwsLGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrOzs7S0tLa2tre3t7m5ubu7u7+/v8DAwMHBwcPDw8XFxcfHx8vLy8/Pz9LS0tXV1dfX193d3eTk5Onp6fj4+Pz8/P7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v///////////////////////////////////////////////////////////////////////////////yH5BAkAAPUAIf47R2VuZXJhdGVkIGJ5IGpzZ2lmIChodHRwczovL2dpdGh1Yi5jb20vYW50aW1hdHRlcjE1L2pzZ2lmLykALAAAAABgAEgAAAj+AGcJHEiwoMGDCBMqXMiwocOHECNKnEixosWLGDNq3Mixo8ePIEOKHEmypMmR9VKqXMmypcuXMGPKnJkSIs2bOHPqZGlzp8+fQOv1DEq0KMyhRpMmRaq0KVCmTqPmhCq1qkyqLrFRSyYwGTVsVo1iZXmNa8Fk18ISHasSm1mDycCq/ck2JTWF1ObSfTjz7cFken3WFbow8M7BDA3rHOwXruKpfGXeTZg3qDVrUge7RRg3KLZjx+Q2HVyvLNy0QaMJjBaVdD2tZr2K/mmNIObRkR+n9AsYt0Pddg1WXppb8bWDx1CLLW74GcJnSl3TtDY8Zu2Et4tKl7n52eyWnxXvhl7+26jqrspbnlfIWjtz2gWPZV95neH8veU9NxZYfbfD3kFt99J6Bnmn0mQO9XfYezrVxxlmx0GUXIAM4hSeffsxBN1TFd5E4Ef3QZbfTg6CNJ5gHXJ3TEntLThiTh+KFCJNAqZU4kgAitjQTheepOBMNcZI0oQ6JpbTjSZtiNN2PZ400IxHpdiSc07G911M0iFZZYtAStnWilUeBGVLrlEZpmM0elmPlmfO8iOZXl4DZpsGEYmll2bSWWCXLwJXVY1+urhjoGEBSuiSah6K36CKtpZoo4s9CimielZq6aWYZqrpppx26umnoIZ6UkAAOw=="),e.src=t,e.setAttribute("rel:animated_src",t),e.setAttribute("rel:auto_play",0),this._superGif=new Cat(e,{autoPlay:!1}),this._superGif.init();for(const t of this.element.children)t.style.width="100%",t.style.height="100%";var r=this._superGif.getCanvas();r.style.width="100%",r.style.height="100%",this._superGif.load((()=>{setTimeout((()=>{this._superGif.moveTo(0),this.play&&this._superGif.play()}),100)}))}ondropfile(t,e){for(let r=0;r<t.length;r++)if(/\.gif$/.test(t[r].name))return void(this.src=e[r])}get src(){return this.getState("src")}set src(t){this.set("src",t)}get play(){return this.getState("play")}set play(t){this.setState("play",t)}get nature(){return Rat}get tagName(){return"div"}}ret.register("gif-view",jat);const Lat={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"attachment-selector",label:"src",name:"src",property:{category:"audio"}},{type:"checkbox",label:"started",name:"started"},{type:"checkbox",label:"loop",name:"loop"}],"value-property":"src",help:"scene/component/audio"};class Dat extends(oet(net)){static get image(){return Dat.IMAGE||(Dat.IMAGE=new Image,Dat.IMAGE.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAGQCAMAAAC3Ycb+AAAAP1BMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACzJYIvAAAAFHRSTlMA8BAwgNBgQKB/wCBwUJDg37CvXyUlBK8AABFYSURBVHja7NsBkqIwFIThTiAQgyBq3/+sm6p1tnamZkaTMhJJf1f4S/JeEIiIiIiIiIiIiIiIiEhD7Hg4BH84TpAKjJ4f3NFCtjVd+InXz2RTs+FXlxGylYHfcVfIJmb+YFWSLUyGVJKKBJJKUo+Rd6w63l/qzLuCkryO5fe0l2xk5mMWbe+v0fNBRqf7S3je6CipQ2ACr+dWcYEpzBFS1plpguatsnomMgdIQSOTuQ5SjmE6/UgK8szgdJIUM/FG41YlFmYJ2kkKsY5ZzAwBurHDk3WGeRY0bvYrGa1+rqNI22f7dS32ZnUK1GMr0eSK3mEc9dhKMxp+ZTo8kT2emOXS5LQ1kCxbJBocSd2k5PaIjMVzjWcdJPk9ooBnmzx1t5XbIxqBKpJ4NGTgzwKiGpK4do72gb+ZUMIYtCPm9WCPMsYTE5k2hq2ZvzujlCE1iRmwf3dvmRyKsT0T7b9I7HEPCpqCiqT2IIqaT1pI0noQZdlFC8l/PbYPAnRORT56VBEE6FXkb49agmByKhJ71BME6FsvEntUFQTdqekisUdlQWCXhovEHtUFAWbTapHYo8YgmFybO3vsUWcQYGmxSOxRbRAMprkisUfFQVKmrX18sxt7VB0ENjT1xir2qDxIwkFi3v89e+xRfxAMzfzzIfZ4hyAYDR9zwVuLPd4jCDrTwoLYGb5LEFi3/+E3rweR6urX20c/Fvls2Pvwm9mDSGIPhv8YPyGf3/eo9Ye7O8B2FIShAAooakEttex/rbODad5/yTHIAjqn505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qQsdTPg45ApXtYaUXKr9TNuPcvqO2pVMkitFXAL2a79/qr3HQvVSTXUtofCl79RDXh5CDpw3pwu6+9kRlvtiI5VtPhmHLltT4EKVQkfb8pcOHrXqk6nBAksUjgpKtuYsskaxGKYT0+84uYgziE4YQgMdx0m8PRfis2MbL33PMXoVjD6PEunI4HSjDjStiJP08vQk9hZzQ7oH/geoLYCUBDW4rf4FqCDFt7THUO6B+4jiDn2XNTW7zf4hqCMND4BOsGyw+yAmh0x+QeFh7EeqD5Ce8nLDrI8NpbDyIWHIQNruo4GyAPlhrEzuixBxHLDDJMnfYgYolBricHNfjIdgMWF+Qyu+pkgX4HCwuymL57ELGkIHZG7z2IWE6Q5VV7vGMhQewbtMcZiwhyHj26ne9+xs8PcvDQHnFFqCD7Au0RW4TK+fOKqw4eoOcqYqgU53HR3/5uShFPCfKey9hFDyJO/vAi7RDZnp7X5igyUH72xSDW1E2Pn4tMRCQgR8vLwbgii4gcmLvqQcSPGtIPX3M08wn6I4qYQ94cM/Yw9Xxhmw+X/59wHrtMlX1AmIkzdyaaAnLg1Nnw8WGYSk40X/BOh4+El6LMSBnN2Cd0tPq4w/LJXGrMbCX06PZ2dcM65yzlNertShSHf3SzRAyPM332IcSAHUKPi8EHmXU0l8Uglmni0yipDoi16s+jJKejhywLooz68yiMEcHr2qM4h81CJ++VPJfTu5UwBpv4Pp9DJSi6MJx0bvUwiw4ewgT8zNR0LHUL+OccOpY/3ElzyGKD5pBlMJpDlsOkMythRoNbXh95PJsdA67MrMtAEYbjeDqNo+7oKqWUUkoppZRSSimllFJKFfMXp4vmSjB8n6sAAAAASUVORK5CYII="),Dat.IMAGE}dispose(){super.dispose(),this.started=!1,delete this._audio}ready(){super.ready(),this._audio=new Audio,this._audio.addEventListener("canplay",(()=>{this.started&&this._audio.play()}));var{src:t="",loop:e=!1,started:r=!1}=this.state;this.onchangeSrc(t),this.onchangeLoop(e),this.onchangeStarted(r)}render(t){var{left:e,top:r,width:n,height:i,src:o}=this.state;t.beginPath(),this.drawImage(t,Dat.image,e,r,n,i)}get nature(){return Lat}get hasTextProperty(){return!1}get src(){return this.get("src")}set src(t){this.set("src",t)}get started(){return!!this.get("started")}set started(t){this.set("started",t)}start(){this._audio&&(this._audio.classList.add("active"),this._audio.play())}pause(){this._audio&&(this._audio.classList.remove("active"),this._audio.pause())}onchangeSrc(t){try{"data"!==String(t).substring(0,4)?this._audio.crossOrigin="use-credentials":this._audio.crossOrigin=null,this._audio.src="string"==typeof t?this.app.url(t):t}catch(t){return void console.error(t)}}onchangeStarted(t){const e=this._audio;t?4==e.readyState&&e.play():e.pause()}onchangeLoop(t){this._audio.loop=t}onchange(t,e){"src"in t&&this.onchangeSrc(t.src),"started"in t&&this.onchangeStarted(t.started),"loop"in t&&this.onchangeLoop(t.loop)}ondblclick(t){this.started=!this.started}ondropfile(t,e){for(let r=0;r<t.length;r++)if(t[r].type.startsWith("audio/"))return void(this.src=e[r])}}ret.register("audio",Dat);class zat extends(oet(ret)){is3dish(){return!0}}ret.register("text",zat);const Nat=["refid","left","top","width","height","rotation","animation"];class Fat extends qot{isGroup(){return!0}get(t){return this._model[t]}set(t,e){if("string"==typeof t)return this.set({[t]:e});var r=Nat.reduce(((e,r)=>(t.hasOwnProperty(r)&&(e[r]=t[r]),e)),{});return super.set(r)}capture(t,e,r){var n=super.capture(t,e,r);if(n!==this)return n}set bounds(t){if(this.__MUTATING__)super.bounds=t;else{var e=this.bounds,r=t.width/e.width,n=t.height/e.height;this.path=this.path.map((i=>({x:t.left+(i.x-e.left)*r,y:t.top+(i.y-e.top)*n}))),this.components&&this.components.forEach((t=>{if(t.mutable)t.mutatePath(null,(function(t){return t.map((function(t){return{x:t.x*r,y:t.y*n}}))}));else{let e=t.bounds,i=t.center,o={x:i.x*(1-r),y:i.y*(1-n)},a=e.width*(1-r),s=e.height*(1-n),c=-(o.x-a/2),u=-(o.y-s/2);t.bounds={left:e.left+c,top:e.top+u,width:e.width*r,height:e.height*n}}}))}}get focusible(){return!1}get bounds(){return super.bounds}get hasTextProperty(){return!1}isIdentifiable(){return!1}calculateBounds(){this.clearCache(),this.__MUTATING__=!0,this.mutateBounds((function(t){var e=ret.union(this.components.map((t=>t.bounds)));return this.components.forEach((t=>{let r=t.bounds;t.bounds={left:r.left-e.left,top:r.top-e.top,width:r.width,height:r.height}})),{left:t.left+e.left,top:t.top+e.top,width:e.width,height:e.height}}),this),this.__MUTATING__=!1,this.parent.isGroup()&&this.parent.calculateBounds()}render(t){}postrender(t){var{top:e,left:r,scale:n}=this.state;t.translate(r,e),this.layout.drawables(this).forEach((e=>{e.draw(t)})),t.translate(-r,-e)}}ret.register("group",Fat);const Bat={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"id-input",label:"ref",name:"ref"},{type:"select",label:"fit",name:"fit",property:{options:["","both","ratio"]}}],"value-property":"ref",help:"scene/component/local-ref"};class Uat extends(oet(net)){get ref(){var t=this.getState("ref");return t&&"string"==typeof t?this.root.findById(t):null}set ref(t){this.setState("ref",t)}get refScale(){let t=this.ref.bounds,e=this.bounds,r=e.width/t.width,n=e.height/t.height;return"both"===this.model.fit?{x:r,y:n}:{x:Math.min(r,n),y:Math.min(r,n)}}draw(t){this._drawing||(this._drawing=!0,super.draw(t),this._drawing=!1)}prerender(t){if(super.prerender(t),this.ref){let e=this.ref.center,r=this.center,n=this.refScale;t.translate(r.x,r.y),t.scale(n.x,n.y),t.translate(-e.x,-e.y)}}postrender(t){if(this.ref)return this.ref.postrender(t);super.postrender(t)}render(t){if(this.ref)return this.ref.render(t);this.state;var{left:e,top:r,width:n,height:i}=this.bounds;t.beginPath(),t.rect(e,r,n,i)}get nature(){return Bat}get hasTextProperty(){return!1}}ret.memoize(Uat.prototype,"ref",!1),ret.memoize(Uat.prototype,"refScale",!1),ret.register("local-ref",Uat);class Yat extends(Hot(Iet)){render(t){}is3dish(){return!0}get layout(){return fet.get(this.get("layout"))||det}}const Hat={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"board-selector",label:"scene-number",name:"ref",placeholder:"SCENE-1"},{type:"number",label:"round",name:"round",property:{min:0}},{type:"select",label:"fit",name:"fit",property:{options:["","both","ratio","width","height","none"]}},{type:"select",label:"mode",name:"mode",property:{options:["view","interaction"]}}],"value-property":"ref",help:"scene/component/global-ref"};class $at extends Yat{dispose(){this._releaseRef(),super.dispose()}get nature(){return Hat}get hasTextProperty(){return!1}get tagName(){return"div"}setElementProperties(t){var{mode:e="view",round:r=0}=this.state;t.style.pointerEvents="view"==e?"none":"inherit",t.style.borderRadius=r+"px"}ready(){super.ready(),this.fetchRef()}reposition(){if(!this.element)return;super.reposition();let t=this._element_bounds,{offsetWidth:e,offsetHeight:r}=this.element;if(this._element_bounds={offsetWidth:e,offsetHeight:r},(!t||t.offsetWidth!=e||t.offsetHeight!=r)&&this.ref&&this.root.target_element){let{fit:t="ratio"}=this.state;this.ref.fit(t)}}async fetchRef(){this._releaseRef();var{ref:t,fit:e="ratio"}=this.state;if(t){var r=this.app.refProvider;if(r&&t)try{this.__ref=await r.get(t,!0),this.__ref.target=this.element,this.__ref.fit(e),this.__ref.data=this.data}catch(t){M9(t)}}}get ref(){return this.__ref}set ref(t){this.setState("ref",t)}_releaseRef(){this.__ref&&this.__ref.release&&this.__ref.release(),delete this.__ref}onchange(t,e,r){super.onchange(t,e,r),"ref"in t&&this.fetchRef(),"fit"in t&&this.ref&&requestAnimationFrame((()=>{let{fit:t}=this.state;this.ref.fit(t)})),"data"in t&&this.ref&&requestAnimationFrame((()=>{this.ref.data=t.data}))}}ret.register("global-ref",$at);const Gat={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"board-selector",label:"board",name:"board"},{type:"checkbox",label:"modal",name:"modal"},{type:"checkbox",label:"closable",name:"closable"},{type:"checkbox",label:"draggable",name:"draggable"},{type:"checkbox",label:"minimizable",name:"minimizable"},{type:"checkbox",label:"show",name:"show"},{type:"select",label:"location",name:"location",property:{options:["center","left-top","right-top","left-bottom","right-bottom","auto"]}},{type:"string",label:"title",name:"text"},{type:"data",label:"value",name:"value"}],help:"scene/component/popup"};class Wat extends(oet(net)){static get image(){return Wat._image||(Wat._image=new Image,Wat._image.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEYAAABGCAMAAABG8BK2AAADJmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgNzkuZGFiYWNiYiwgMjAyMS8wNC8xNC0wMDozOTo0NCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDIzLjAgKE1hY2ludG9zaCkiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6RkM4QzQxNUMzMzBEMTFFQ0JEMzZDMDUwQUI4MEI3QTAiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6RkM4QzQxNUQzMzBEMTFFQ0JEMzZDMDUwQUI4MEI3QTAiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpENjlENTQ3RjMzMDkxMUVDQkQzNkMwNTBBQjgwQjdBMCIgc3RSZW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yCma/ZFROTrJVwMy7wmf3bv6/MX+Dgkkysblvxps/dhOKZb6IvrTakzXXuPApnpYneDGOeKvJlaSXcDmA7AicQyW84VeTOnY+NdiWcG1uiZksFEHdyAlsJEjEkmkwGNsKHNZCJGSKtVTYC1tO022mnjwUBrMdXg8dreuOBhv7D/62/8lGZ1wLxXyZKOm+iUHIQintyny0TkaATHjYgcjeAoFpEje9R/nGPqIx2aw3NU9odCQI6e6x/VLY32cKQXVBnkAAAAAElFTkSuQmCC"),Wat._image}ready(){super.ready(),this.show&&this.onchangeShow(!0)}render(t){var{left:e,top:r,width:n,height:i}=this.bounds;t.beginPath(),this.drawImage(t,Wat.image,e,r,n,i)}onchange(t,e){"value"in t?this.show?this.onchangeShow(!0):this.show=!0:"show"in t&&this.onchangeShow(this.show)}onchangeShow(t){!this.app.isEditMode&&this.getState("board")&&(t?met.show(this,this.getState("board"),{location:this.getState("location"),modal:this.getState("modal"),closable:this.getState("closable")||!1,draggable:this.getState("draggable")||!1,minimizable:this.getState("minimizable")||!1,title:this.text,data:this.value}):met.hide(this))}get board(){return this.getState("board")}set board(t){this.set("board",t)}get show(){return this.getState("show")}set show(t){this.setState("show",t)}get started(){return this.getState("show")}set started(t){this.setState("show",t)}get value(){return this.getState("value")}set value(t){this.setState("value",t)}get hasTextProperty(){return!1}get nature(){return Gat}}ret.register("popup",Wat);class qat extends ret{render(t){var{path:e=[]}=this.state;if(!(e.length<=1)){t.beginPath(),t.moveTo(e[0].x,e[0].y);for(let r=1;r<e.length;r++)t.lineTo(e[r].x,e[r].y);t.closePath(),this.drawStroke(t)}}get path(){return this.model.path}set path(t){this.set("path",t)}contains(t,e){var r=this.state.path,n=!1;return r.forEach(((i,o)=>{let a=(o+r.length+1)%r.length,s=i.x,c=i.y,u=r[a].x,l=r[a].y;c>e!=l>e&&t<(u-s)*(e-c)/(l-c)+s&&(n=!n)})),n}}ret.register("path",qat);const Xat={mutable:!0,resizable:!1,rotatable:!0,properties:[{type:"number",label:"round",name:"round",property:{min:0,max:100,step:1}}],help:"scene/component/triangle"};class Vat extends net{contains(t,e){var{x1:r,y1:n,x2:i,y2:o,x3:a,y3:s}=this.state,c=[r,n,i,o,a,s],u=!1;for(let r=0;r<c.length;r+=2){let n=(r+2)%c.length,i=c[r],o=c[r+1],a=c[n+1];o>e!=a>e&&t<(c[n]-i)*(e-o)/(a-o)+i&&(u=!u)}return u}get mutable(){return!0}get path(){var{x1:t,y1:e,x2:r,y2:n,x3:i,y3:o}=this.state;return[{x:t,y:e},{x:r,y:n},{x:i,y:o}]}set path(t){this.set({x1:t[0].x,y1:t[0].y,x2:t[1].x,y2:t[1].y,x3:t[2].x,y3:t[2].y})}get nature(){return Xat}}ret.memoize(Vat.prototype,"path",!1),ret.register("triangle",Vat);const Kat={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"number",label:"ratio",name:"ratio",property:"ratio"}],help:"scene/component/donut"};var Qat={ondragmove:function(t,e,r){r.controls;var{cx:n,rx:i}=r.model;i=Math.abs(i);var o=(r.transcoordP2S(t.x,t.y).x-n)/i*100;o=o>=100||o<=-100?100:Math.abs(o),r.set({ratio:o})}};class Jat extends uat{is3dish(){return!1}render(t){var{ratio:e=50,cx:r,cy:n,rx:i,ry:o,startAngle:a,endAngle:s,anticlockwise:c}=this.state;i=Math.abs(i),o=Math.abs(o),t.beginPath(),t.ellipse(r,n,i,o,0,a||0,s||2*Math.PI,c),t.moveTo(r+i/100*e,n),t.ellipse(r,n,i/100*e,o/100*e,0,a||0,s||2*Math.PI,!0)}contains(t,e){var{cx:r,cy:n,rx:i,ry:o,ratio:a}=this.state,s=(t-r)/(2*(i=Math.abs(i))-.5),c=(e-n)/(2*(o=Math.abs(o))-.5),u=(t-r)/(i/100*a*2-.5),l=(e-n)/(o/100*a*2-.5),h=!1;return s*s+c*c<.25&&u*u+l*l>.25&&(h=!h),h}get controls(){var{cx:t,cy:e,rx:r,ratio:n}=this.state;return[{x:t+(r=Math.abs(r))/100*n,y:e,handler:Qat}]}get nature(){return Kat}}ret.memoize(Jat.prototype,"controls",!1),ret.register("donut",Jat);const Zat={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"number",label:"ratio",name:"ratio",property:"ratio"},{type:"number",label:"wing",name:"wing",property:"wing"}],help:"scene/component/star"};var tst={ondragmove:function(t,e,r){r.controls;var{cy:n,ry:i}=r.model,o=(r.transcoordP2S(t.x,t.y).y-n)/i*100+100;o>=100?o=100:o<=0&&(o=0),r.set({ratio:o})}};class est extends uat{is3dish(){return!1}render(t){var{ratio:e=30,wing:r=5,cx:n,cy:i,rx:o,ry:a,startAngle:s,endAngle:c,anticlockwise:u}=this.state;if(r<3)return;const l=1.5707963267948966;var h=2*Math.PI/r,f=o-e/100*o,d=a-e/100*a;t.save(),t.beginPath(),t.translate(n,i),t.moveTo(o*Math.cos(-l),a*Math.sin(-l)),t.lineTo((o-f)*(Math.cos(h-l)+Math.cos(0-l))/2,(a-d)*(Math.sin(h-l)+Math.sin(0-l))/2);for(var p=1;p<r;p++)t.lineTo(o*Math.cos(h*p-l),a*Math.sin(h*p-l)),t.lineTo((o-f)*(Math.cos(h*(p+1)-l)+Math.cos(h*p-l))/2,(a-d)*(Math.sin(h*(p+1)-l)+Math.sin(h*p-l))/2);t.closePath(),t.restore()}get controls(){var{cx:t,cy:e,ry:r,ratio:n}=this.state;return[{x:t,y:e-r+r*(n/100),handler:tst}]}get nature(){return Zat}}ret.memoize(est.prototype,"controls",!1),ret.register("star",est);var rst=t=>class extends t{animOnValueChange(t,e=!1,r){if(t!=this._lastValue){if(e)var n=t-(Number(r)||0);else n=t-(this._lastValue||0);this._lastValue=t,this._anim_alpha=-n,this.animate({step:t=>{this._anim_alpha=n*(t-1),this.invalidate()},duration:1e3,delta:"circ",options:{x:1},ease:"out"}).start()}}dispose(){super.dispose(),delete this._value_substitutor}onchange(t,e){t.hasOwnProperty("value")&&delete this._value_substitutor}get animAlpha(){return this._anim_alpha||0}get animValue(){return(this._lastValue||0)+(this._anim_alpha||0)}defaultValueSubstitutor(){return this.getState("value")}get valueSubstitutor(){return this._value_substitutor||(this._value_substitutor=$tt(this.getState("value"),this)||this.defaultValueSubstitutor),this._value_substitutor}get value(){return Number(this.valueSubstitutor())||0}set value(t){delete this._value_substitutor,this.setState("value",Number(g9(t)))}},nst=t=>class extends t{_convertDataFormat(t,e){var r;if("json"===e)r=JSON.parse(t);else r=t;return r}isDataSource(){return!0}},ist=0;const ost=new FinalizationRegistry((()=>{ist--}));class ast{static get residents(){return ist}static get residentsCount(){return ist}constructor(t,e){this.counters={},this.references={},this.creator=t,this.disposer=e,ist++,ost.register(this,ist)}dispose(){if(this.disposer)for(let t in this.references)this.disposer.call(null,t,this.references[t]);delete this.references,delete this.counters}get ids(){return Object.keys(this.references)}create(t){var e=this;return new Promise((function(r,n){e.creator?e.creator.call(null,t,(function(e){!function(e){e.release=function(){this.disposer&&this.disposer.call(null,t,e),delete e.release,P9("RELEASED",t)},r(e)}(e)}),(function(t){n(t)})):n(Error("Reference id("+t+") could not be created. Reference creator should be defined."))}))}add(t,e){var r=this,n=new Promise((function(n,i){var o=r.references[t];if(o)o===e?i(Error("Reference ID and target duplicate")):e?i(Error("Reference ID duplicate")):n(o);else{function a(e){e.release=function(){r.release(this)},r.references[t]=e,r.counters[t]=1,n(e)}if(e)a(e);else{if(!r.creator)return void i(Error("Reference id("+t+") is not allowed. Reference creator should be defined."));r.creator.call(null,t,(function(t){a(t)}),(function(t){i(t)}))}}}));return this.references[t]||(this.references[t]=n),n}async get(t,e){var r=this.references[t];if(r){if(!(r instanceof Promise)){if(!(t in this.counters))throw new Error("No Reference Count");return this.counters[t]++,r}if(e)return r=await r,this.counters[t]++,r}if(e)return await this.add(t);throw new Error("No References for "+t)}_id(t){for(let e in this.references){if(this.references[e]===t)return e}return-1}release(t){var e=this._id(t),r=this.references[e];r?(this.counters[e]--,0==this.counters[e]&&(this.disposer&&this.disposer.call(null,e,r),delete this.references[e],delete this.counters[e],delete t.release,P9("RELEASED",e))):M9("No Referenced ID")}}var sst={},cst={},ust=[];function lst(t){var e="SCRIPT"==t.target.tagName?sst:cst,r=t.target.src||t.target.href;e[r]=!0,ust.forEach(((t,n)=>{let{resolve:i,scripts:o,styles:a}=t;if(e==sst){let t=o.indexOf(r);t>-1&&t<o.length-1&&fst(o[t+1])}for(let t=0;t<o.length;t++)if(!sst[o[t]])return;if(a)for(let t=0;t<a.length;t++)if(!cst[a[t]])return;i(),ust[n]=null})),ust=ust.filter(Boolean)}function hst(t){var e=t.target.src,r="SCRIPT"==t.target.tagName?sst:cst;ust.forEach(((n,i)=>{let{reject:o,scripts:a,styles:s}=n,c=!1;if(r===sst){for(let t=0;t<a.length;t++)if(a[t]==e){c=!0;break}}else if(s)for(let t=0;t<s.length;t++)if(s[t]==e){c=!0;break}c&&(o(t),ust[i]=null)})),ust=ust.filter(Boolean),delete r[e],document.head.removeChild(t.target)}function fst(t){sst[t]=!1;var e=document.createElement("script");e.onload=lst,e.onerror=hst,e.type="text/javascript",e.src=t,document.head.appendChild(e)}class dst{static load(t,e){return"string"==typeof t&&(t=[t]),"string"==typeof e&&(e=[e]),new Promise((function(r,n){if((!t||t instanceof Array)&&(!e||e instanceof Array)){var i,o=!0;if(e&&e.forEach((t=>{cst.hasOwnProperty(t)||function(t){cst[t]=!1;var e=document.createElement("link");e.onload=lst,e.onerror=hst,e.type="text/css",e.rel="stylesheet",e.media="screen,print",e.href=t,document.head.appendChild(e)}(t),cst[t]||(o=!1)})),t&&t.length>0&&t.forEach((t=>{sst.hasOwnProperty(t)?sst[t]||(o=!1):i=i||t})),i)fst(i);else if(o)return void r();ust.push({resolve:r,reject:n,scripts:t,styles:e})}else n("invalid sources for load")}))}}const pst="0.0.0";var gst=0,vst=performance.now(),yst=0;function mst(){return gst}requestAnimationFrame((function t(){requestAnimationFrame(t),yst++;var e=performance.now(),r=e-vst;r<1e3||(gst=Math.round(1e3*yst/r),vst=e,yst=0)}));var bst=brt;function xst(){}export{bet as AbsoluteLayout,Dat as AudioPlayer,wet as CardLayout,ret as Component,Net as Connectable,qot as Container,Iet as ContainerAbstract,H9 as DEFAULT,B9 as DPPX,nst as DataSource,Jat as Donut,uat as Ellipse,Xnt as EventMap,mst as FPS,U9 as GESTURES,jat as GifView,$at as GlobalRef,Fat as Group,det as HTMLAbsoluteLayout,Yat as HTMLOverlayContainer,xat as HTMLOverlayElement,bat as ImageView,uet as InfoWindow,Y9 as KEYEVENTS,Cet as Layer,fet as Layout,sat as Line,_et as LinearHorizontalLayout,Eet as LinearVerticalLayout,Uat as LocalRef,F9 as MAX_UNDO_SIZE,L9 as MODE_ADD,R9 as MODE_EDIT,z9 as MODE_PASTE_DATABIND,D9 as MODE_PASTE_STYLE,j9 as MODE_SHIFT,C9 as MODE_VIEW,bst as Model,Pet as MoveHandle,I9 as NOTHING,yat as OrthoLine,qat as Path,fat as Polygon,gat as Polyline,Wat as Popup,Uet as Rect,oet as RectPath,ast as ReferenceMap,dit as RootContainer,Het as Ruler,N9 as SCENE_MODE,Mit as Scene,met as ScenePopup,dst as ScriptLoader,net as Shape,est as Star,Met as TableLayout,zat as Text,Vat as Triangle,rst as ValueHolder,Pit as create,P9 as debug,M9 as error,xst as license,u5 as polyfill,pst as version,T9 as warn};console.log("@hatiolab/things-scene@9.0.0-beta.32 is loaded");
|