@univerjs/drawing 0.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +176 -0
- package/README.md +16 -0
- package/lib/cjs/index.js +1 -0
- package/lib/es/index.js +2053 -0
- package/lib/types/basics/config.d.ts +20 -0
- package/lib/types/index.d.ts +25 -0
- package/lib/types/models/image-model-interface.d.ts +17 -0
- package/lib/types/plugin.d.ts +13 -0
- package/lib/types/services/drawing-manager-impl.service.d.ts +110 -0
- package/lib/types/services/drawing-manager.service.d.ts +141 -0
- package/lib/types/services/image-io-impl.service.d.ts +16 -0
- package/lib/types/services/image-io.service.d.ts +31 -0
- package/lib/types/services/interface.d.ts +15 -0
- package/lib/types/utils/get-image-shape-key.d.ts +3 -0
- package/lib/types/utils/get-image-size.d.ts +7 -0
- package/lib/umd/index.js +1 -0
- package/package.json +79 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export declare const DRAWING_IMAGE_WIDTH_LIMIT = 500;
|
|
17
|
+
export declare const DRAWING_IMAGE_HEIGHT_LIMIT = 500;
|
|
18
|
+
export declare const DRAWING_IMAGE_COUNT_LIMIT = 10;
|
|
19
|
+
export declare const DRAWING_IMAGE_ALLOW_SIZE: number;
|
|
20
|
+
export declare const DRAWING_IMAGE_ALLOW_IMAGE_LIST: string[];
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export { DRAWING_IMAGE_WIDTH_LIMIT, DRAWING_IMAGE_HEIGHT_LIMIT, DRAWING_IMAGE_COUNT_LIMIT, DRAWING_IMAGE_ALLOW_SIZE, DRAWING_IMAGE_ALLOW_IMAGE_LIST } from './basics/config';
|
|
17
|
+
export { DrawingManagerService, UnitDrawingService, type IDrawingJson1Type, type IDrawingJsonUndo1 } from './services/drawing-manager-impl.service';
|
|
18
|
+
export { getDrawingShapeKeyByDrawingSearch } from './utils/get-image-shape-key';
|
|
19
|
+
export { getImageSize } from './utils/get-image-size';
|
|
20
|
+
export { UniverDrawingPlugin } from './plugin';
|
|
21
|
+
export { type IImageData } from './models/image-model-interface';
|
|
22
|
+
export { IImageIoService, type IImageIoServiceParam, ImageSourceType, ImageUploadStatusType } from './services/image-io.service';
|
|
23
|
+
export { ImageIoService } from './services/image-io-impl.service';
|
|
24
|
+
export type { ITransformState, IRotationSkewFlipTransform, ISrcRect } from './services/interface';
|
|
25
|
+
export { DEFAULT_DOCUMENT_SUB_COMPONENT_ID, type DrawingType, DrawingTypeEnum, type IDrawingSearch, type IDrawingSpace, type IDrawingParam, IDrawingManagerService, type IDrawingOrderUpdateParam, type IUnitDrawingService, type IDrawingMap, type IDrawingSubunitMap, type IDrawingOrderMapParam, type IDrawingGroupUpdateParam, type IDrawingVisibleParam, type IDrawingMapItemData, type IDrawingMapItem, ArrangeTypeEnum, } from './services/drawing-manager.service';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Nullable, PresetGeometryType } from '@univerjs/core';
|
|
2
|
+
import { IDrawingParam } from '../services/drawing-manager.service';
|
|
3
|
+
import { ImageSourceType } from '../services/image-io.service';
|
|
4
|
+
import { ISrcRect } from '../services/interface';
|
|
5
|
+
|
|
6
|
+
export interface IImageData extends IDrawingParam {
|
|
7
|
+
imageSourceType: ImageSourceType;
|
|
8
|
+
source: string;
|
|
9
|
+
/**
|
|
10
|
+
* 20.1.8.55 srcRect (Source Rectangle)
|
|
11
|
+
*/
|
|
12
|
+
srcRect?: Nullable<ISrcRect>;
|
|
13
|
+
/**
|
|
14
|
+
* 20.1.9.18 prstGeom (Preset geometry)
|
|
15
|
+
*/
|
|
16
|
+
prstGeom?: Nullable<PresetGeometryType>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DependencyOverride, Plugin } from '@univerjs/core';
|
|
2
|
+
import { Injector } from '@wendellhu/redi';
|
|
3
|
+
|
|
4
|
+
export declare class UniverDrawingPlugin extends Plugin {
|
|
5
|
+
private _config;
|
|
6
|
+
protected _injector: Injector;
|
|
7
|
+
static pluginName: string;
|
|
8
|
+
constructor(_config: {
|
|
9
|
+
override?: DependencyOverride;
|
|
10
|
+
}, _injector: Injector);
|
|
11
|
+
onStarting(_injector: Injector): void;
|
|
12
|
+
private _initDependencies;
|
|
13
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { Nullable } from '@univerjs/core';
|
|
3
|
+
import { JSONOp, JSONOpList } from 'ot-json1';
|
|
4
|
+
import { IDrawingGroupUpdateParam, IDrawingMap, IDrawingOrderMapParam, IDrawingOrderUpdateParam, IDrawingParam, IDrawingSearch, IDrawingSubunitMap, IDrawingVisibleParam, IUnitDrawingService } from './drawing-manager.service';
|
|
5
|
+
|
|
6
|
+
export interface IDrawingJsonUndo1 {
|
|
7
|
+
undo: JSONOp;
|
|
8
|
+
redo: JSONOp;
|
|
9
|
+
unitId: string;
|
|
10
|
+
subUnitId: string;
|
|
11
|
+
objects: IDrawingSearch[] | IDrawingOrderMapParam | IDrawingGroupUpdateParam | IDrawingGroupUpdateParam[];
|
|
12
|
+
}
|
|
13
|
+
export interface IDrawingJson1Type {
|
|
14
|
+
op: JSONOp | JSONOpList;
|
|
15
|
+
unitId: string;
|
|
16
|
+
subUnitId: string;
|
|
17
|
+
objects: IDrawingSearch[] | IDrawingOrderMapParam | IDrawingGroupUpdateParam | IDrawingGroupUpdateParam[];
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* unitId -> subUnitId -> drawingId -> drawingParam
|
|
21
|
+
*/
|
|
22
|
+
export declare class UnitDrawingService<T extends IDrawingParam> implements IUnitDrawingService<T> {
|
|
23
|
+
drawingManagerData: IDrawingMap<T>;
|
|
24
|
+
private _oldDrawingManagerData;
|
|
25
|
+
private _focusDrawings;
|
|
26
|
+
private readonly _remove$;
|
|
27
|
+
readonly remove$: Observable<IDrawingSearch[]>;
|
|
28
|
+
private readonly _add$;
|
|
29
|
+
readonly add$: Observable<IDrawingSearch[]>;
|
|
30
|
+
private readonly _update$;
|
|
31
|
+
readonly update$: Observable<IDrawingSearch[]>;
|
|
32
|
+
private _order$;
|
|
33
|
+
readonly order$: Observable<IDrawingOrderMapParam>;
|
|
34
|
+
private _group$;
|
|
35
|
+
readonly group$: Observable<IDrawingGroupUpdateParam[]>;
|
|
36
|
+
private _ungroup$;
|
|
37
|
+
readonly ungroup$: Observable<IDrawingGroupUpdateParam[]>;
|
|
38
|
+
private _refreshTransform$;
|
|
39
|
+
readonly refreshTransform$: Observable<T[]>;
|
|
40
|
+
private _visible$;
|
|
41
|
+
readonly visible$: Observable<IDrawingVisibleParam[]>;
|
|
42
|
+
private _focus$;
|
|
43
|
+
focus$: Observable<T[]>;
|
|
44
|
+
private readonly _featurePluginUpdate$;
|
|
45
|
+
readonly featurePluginUpdate$: Observable<T[]>;
|
|
46
|
+
private readonly _featurePluginAdd$;
|
|
47
|
+
readonly featurePluginAdd$: Observable<T[]>;
|
|
48
|
+
private readonly _featurePluginRemove$;
|
|
49
|
+
readonly featurePluginRemove$: Observable<IDrawingSearch[]>;
|
|
50
|
+
private readonly _featurePluginOrderUpdate$;
|
|
51
|
+
readonly featurePluginOrderUpdate$: Observable<IDrawingOrderUpdateParam>;
|
|
52
|
+
private readonly _featurePluginGroupUpdate$;
|
|
53
|
+
readonly featurePluginGroupUpdate$: Observable<IDrawingGroupUpdateParam[]>;
|
|
54
|
+
private readonly _featurePluginUngroupUpdate$;
|
|
55
|
+
readonly featurePluginUngroupUpdate$: Observable<IDrawingGroupUpdateParam[]>;
|
|
56
|
+
dispose(): void;
|
|
57
|
+
visibleNotification(visibleParams: IDrawingVisibleParam[]): void;
|
|
58
|
+
refreshTransform(updateParams: T[]): void;
|
|
59
|
+
getDrawingDataForUnit(unitId: string): IDrawingSubunitMap<T>;
|
|
60
|
+
removeDrawingDataForUnit(unitId: string): void;
|
|
61
|
+
registerDrawingData(unitId: string, data: IDrawingSubunitMap<T>): void;
|
|
62
|
+
getDrawingData(unitId: string, subUnitId: string): import('./drawing-manager.service').IDrawingMapItemData<T>;
|
|
63
|
+
getBatchAddOp(insertParams: T[]): IDrawingJsonUndo1;
|
|
64
|
+
getBatchRemoveOp(removeParams: IDrawingSearch[]): IDrawingJsonUndo1;
|
|
65
|
+
getBatchUpdateOp(updateParams: T[]): IDrawingJsonUndo1;
|
|
66
|
+
removeNotification(removeParams: IDrawingSearch[]): void;
|
|
67
|
+
addNotification(insertParams: IDrawingSearch[]): void;
|
|
68
|
+
updateNotification(updateParams: IDrawingSearch[]): void;
|
|
69
|
+
orderNotification(orderParams: IDrawingOrderMapParam): void;
|
|
70
|
+
groupUpdateNotification(groupParams: IDrawingGroupUpdateParam[]): void;
|
|
71
|
+
ungroupUpdateNotification(groupParams: IDrawingGroupUpdateParam[]): void;
|
|
72
|
+
refreshTransformNotification(refreshParams: T[]): void;
|
|
73
|
+
getGroupDrawingOp(groupParams: IDrawingGroupUpdateParam[]): IDrawingJsonUndo1;
|
|
74
|
+
getUngroupDrawingOp(groupParams: IDrawingGroupUpdateParam[]): IDrawingJsonUndo1;
|
|
75
|
+
getDrawingsByGroup(groupParam: IDrawingSearch): IDrawingParam[];
|
|
76
|
+
private _getGroupDrawingOp;
|
|
77
|
+
private _getUngroupDrawingOp;
|
|
78
|
+
applyJson1(unitId: string, subUnitId: string, jsonOp: JSONOp): void;
|
|
79
|
+
featurePluginUpdateNotification(updateParams: T[]): void;
|
|
80
|
+
featurePluginOrderUpdateNotification(drawingOrderUpdateParam: IDrawingOrderUpdateParam): void;
|
|
81
|
+
featurePluginAddNotification(insertParams: T[]): void;
|
|
82
|
+
featurePluginRemoveNotification(removeParams: IDrawingSearch[]): void;
|
|
83
|
+
featurePluginGroupUpdateNotification(groupParams: IDrawingGroupUpdateParam[]): void;
|
|
84
|
+
featurePluginUngroupUpdateNotification(groupParams: IDrawingGroupUpdateParam[]): void;
|
|
85
|
+
getDrawingByParam(param: Nullable<IDrawingSearch>): Nullable<T>;
|
|
86
|
+
getOldDrawingByParam(param: Nullable<IDrawingSearch>): Nullable<T>;
|
|
87
|
+
getDrawingOKey(oKey: string): Nullable<T>;
|
|
88
|
+
focusDrawing(params: Nullable<IDrawingSearch[]>): void;
|
|
89
|
+
getFocusDrawings(): T[];
|
|
90
|
+
getDrawingOrder(unitId: string, subUnitId: string): string[];
|
|
91
|
+
orderUpdateNotification(orderParams: IDrawingOrderMapParam): void;
|
|
92
|
+
getForwardDrawingsOp(orderParams: IDrawingOrderMapParam): IDrawingJsonUndo1;
|
|
93
|
+
getBackwardDrawingOp(orderParams: IDrawingOrderMapParam): IDrawingJsonUndo1;
|
|
94
|
+
getFrontDrawingsOp(orderParams: IDrawingOrderMapParam): IDrawingJsonUndo1;
|
|
95
|
+
getBackDrawingsOp(orderParams: IDrawingOrderMapParam): IDrawingJsonUndo1;
|
|
96
|
+
private _getDrawingCount;
|
|
97
|
+
private _getOrderFromSearchParams;
|
|
98
|
+
private _hasDrawingOrder;
|
|
99
|
+
private _getCurrentBySearch;
|
|
100
|
+
private _getOldBySearch;
|
|
101
|
+
private _establishDrawingMap;
|
|
102
|
+
private _addByParam;
|
|
103
|
+
private _removeByParam;
|
|
104
|
+
private _updateByParam;
|
|
105
|
+
private _getUpdateParamCompareOp;
|
|
106
|
+
private _getDrawingData;
|
|
107
|
+
private _getDrawingOrder;
|
|
108
|
+
}
|
|
109
|
+
export declare class DrawingManagerService extends UnitDrawingService<IDrawingParam> {
|
|
110
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { IDisposable } from '@wendellhu/redi';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { Nullable } from '@univerjs/core';
|
|
4
|
+
import { ITransformState } from './interface';
|
|
5
|
+
|
|
6
|
+
export declare const DEFAULT_DOCUMENT_SUB_COMPONENT_ID = "__default_document_sub_component_id20231101__";
|
|
7
|
+
export declare enum ArrangeTypeEnum {
|
|
8
|
+
forward = 0,
|
|
9
|
+
backward = 1,
|
|
10
|
+
front = 2,
|
|
11
|
+
back = 3
|
|
12
|
+
}
|
|
13
|
+
export declare enum DrawingTypeEnum {
|
|
14
|
+
UNRECOGNIZED = -1,
|
|
15
|
+
DRAWING_IMAGE = 0,
|
|
16
|
+
DRAWING_SHAPE = 1,
|
|
17
|
+
DRAWING_CHART = 2,
|
|
18
|
+
DRAWING_TABLE = 3,
|
|
19
|
+
DRAWING_SMART_ART = 4,
|
|
20
|
+
DRAWING_VIDEO = 5,
|
|
21
|
+
DRAWING_GROUP = 6,
|
|
22
|
+
DRAWING_UNIT = 7,
|
|
23
|
+
DRAWING_DOM = 8
|
|
24
|
+
}
|
|
25
|
+
export type DrawingType = DrawingTypeEnum | number;
|
|
26
|
+
export interface IDrawingSpace {
|
|
27
|
+
unitId: string;
|
|
28
|
+
subUnitId: string;
|
|
29
|
+
}
|
|
30
|
+
export interface IDrawingSearch extends IDrawingSpace {
|
|
31
|
+
drawingId: string;
|
|
32
|
+
}
|
|
33
|
+
export interface IDrawingParam extends IDrawingSearch {
|
|
34
|
+
drawingType: DrawingType;
|
|
35
|
+
transform?: Nullable<ITransformState>;
|
|
36
|
+
groupId?: string;
|
|
37
|
+
}
|
|
38
|
+
export interface IDrawingMap<T extends IDrawingParam> {
|
|
39
|
+
[unitId: string]: IDrawingSubunitMap<T>;
|
|
40
|
+
}
|
|
41
|
+
export interface IDrawingSubunitMap<T extends IDrawingParam> {
|
|
42
|
+
[subUnitId: string]: IDrawingMapItem<T>;
|
|
43
|
+
}
|
|
44
|
+
export interface IDrawingMapItemData<T> {
|
|
45
|
+
[drawingId: string]: T;
|
|
46
|
+
}
|
|
47
|
+
export interface IDrawingMapItem<T extends IDrawingParam> {
|
|
48
|
+
data: IDrawingMapItemData<T>;
|
|
49
|
+
order: string[];
|
|
50
|
+
}
|
|
51
|
+
export interface IDrawingOrderMapParam {
|
|
52
|
+
unitId: string;
|
|
53
|
+
subUnitId: string;
|
|
54
|
+
drawingIds: string[];
|
|
55
|
+
}
|
|
56
|
+
export interface IDrawingOrderUpdateParam extends IDrawingOrderMapParam {
|
|
57
|
+
arrangeType: ArrangeTypeEnum;
|
|
58
|
+
}
|
|
59
|
+
export interface IDrawingGroupUpdateParam {
|
|
60
|
+
parent: IDrawingParam;
|
|
61
|
+
children: IDrawingParam[];
|
|
62
|
+
}
|
|
63
|
+
export interface IDrawingVisibleParam extends IDrawingSearch {
|
|
64
|
+
visible: boolean;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Responsible for operations related to drawing additions, deletions, and modifications,
|
|
68
|
+
* including observers, events, broadcasting, and generating operations.
|
|
69
|
+
*/
|
|
70
|
+
export interface IUnitNormalDrawingService<T extends IDrawingParam> {
|
|
71
|
+
readonly remove$: Observable<IDrawingSearch[]>;
|
|
72
|
+
readonly add$: Observable<IDrawingSearch[]>;
|
|
73
|
+
readonly update$: Observable<IDrawingSearch[]>;
|
|
74
|
+
readonly refreshTransform$: Observable<T[]>;
|
|
75
|
+
readonly visible$: Observable<IDrawingVisibleParam[]>;
|
|
76
|
+
readonly featurePluginUpdate$: Observable<T[]>;
|
|
77
|
+
refreshTransform(updateParams: T[]): void;
|
|
78
|
+
removeNotification(removeParams: IDrawingSearch[]): void;
|
|
79
|
+
addNotification(insertParams: IDrawingSearch[]): void;
|
|
80
|
+
updateNotification(updateParams: IDrawingSearch[]): void;
|
|
81
|
+
refreshTransformNotification(refreshParams: T[]): void;
|
|
82
|
+
visibleNotification(visibleParams: IDrawingVisibleParam[]): void;
|
|
83
|
+
getBatchAddOp(insertParams: T[]): unknown;
|
|
84
|
+
getBatchRemoveOp(removeParams: IDrawingSearch[]): unknown;
|
|
85
|
+
getBatchUpdateOp(updateParams: T[]): unknown;
|
|
86
|
+
featurePluginUpdateNotification(updateParams: T[]): void;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Responsible for operations related to drawing focus, including observers,broadcasting
|
|
90
|
+
*/
|
|
91
|
+
export interface IUnitFocusDrawingService {
|
|
92
|
+
readonly focus$: Observable<IDrawingParam[]>;
|
|
93
|
+
focusDrawing(params: Nullable<IDrawingSearch[]>): void;
|
|
94
|
+
getFocusDrawings(): IDrawingParam[];
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Responsible for operations related to drawing grouping, including observers,broadcasting, and generating operations.
|
|
98
|
+
*/
|
|
99
|
+
export interface IUnitGroupDrawingService {
|
|
100
|
+
readonly group$: Observable<IDrawingGroupUpdateParam[]>;
|
|
101
|
+
readonly ungroup$: Observable<IDrawingGroupUpdateParam[]>;
|
|
102
|
+
readonly featurePluginGroupUpdate$: Observable<IDrawingGroupUpdateParam[]>;
|
|
103
|
+
readonly featurePluginUngroupUpdate$: Observable<IDrawingGroupUpdateParam[]>;
|
|
104
|
+
getGroupDrawingOp(groupParams: IDrawingGroupUpdateParam[]): unknown;
|
|
105
|
+
getUngroupDrawingOp(groupParams: IDrawingGroupUpdateParam[]): unknown;
|
|
106
|
+
groupUpdateNotification(groupParams: IDrawingGroupUpdateParam[]): void;
|
|
107
|
+
ungroupUpdateNotification(groupParams: IDrawingGroupUpdateParam[]): void;
|
|
108
|
+
getDrawingsByGroup(groupParam: IDrawingSearch): IDrawingParam[];
|
|
109
|
+
featurePluginGroupUpdateNotification(groupParams: IDrawingGroupUpdateParam[]): void;
|
|
110
|
+
featurePluginUngroupUpdateNotification(groupParams: IDrawingGroupUpdateParam[]): void;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Responsible for operations related to drawing order, including observers,broadcasting, and generating operations.
|
|
114
|
+
*/
|
|
115
|
+
export interface IUnitOrderDrawingService {
|
|
116
|
+
readonly order$: Observable<IDrawingOrderMapParam>;
|
|
117
|
+
readonly featurePluginOrderUpdate$: Observable<IDrawingOrderUpdateParam>;
|
|
118
|
+
orderNotification(orderParams: IDrawingOrderMapParam): void;
|
|
119
|
+
getForwardDrawingsOp(orderParams: IDrawingOrderMapParam): unknown;
|
|
120
|
+
getBackwardDrawingOp(orderParams: IDrawingOrderMapParam): unknown;
|
|
121
|
+
getFrontDrawingsOp(orderParams: IDrawingOrderMapParam): unknown;
|
|
122
|
+
getBackDrawingsOp(orderParams: IDrawingOrderMapParam): unknown;
|
|
123
|
+
getDrawingOrder(unitId: string, subUnitId: string): string[];
|
|
124
|
+
orderUpdateNotification(orderParams: IDrawingOrderMapParam): void;
|
|
125
|
+
featurePluginOrderUpdateNotification(drawingOrderUpdateParam: IDrawingOrderUpdateParam): void;
|
|
126
|
+
}
|
|
127
|
+
export interface IUnitDrawingService<T extends IDrawingParam> extends IUnitNormalDrawingService<T>, IUnitFocusDrawingService, IUnitGroupDrawingService, IUnitOrderDrawingService, IDisposable {
|
|
128
|
+
drawingManagerData: IDrawingMap<T>;
|
|
129
|
+
dispose(): void;
|
|
130
|
+
getDrawingDataForUnit(unitId: string): IDrawingSubunitMap<T>;
|
|
131
|
+
removeDrawingDataForUnit(unitId: string): void;
|
|
132
|
+
registerDrawingData(unitId: string, data: IDrawingSubunitMap<T>): void;
|
|
133
|
+
getDrawingData(unitId: string, subUnitId: string): IDrawingMapItemData<T>;
|
|
134
|
+
getDrawingByParam(param: Nullable<IDrawingSearch>): Nullable<T>;
|
|
135
|
+
getOldDrawingByParam(param: Nullable<IDrawingSearch>): Nullable<T>;
|
|
136
|
+
getDrawingOKey(oKey: string): Nullable<T>;
|
|
137
|
+
applyJson1(unitId: string, subUnitId: string, jsonOp: unknown): void;
|
|
138
|
+
}
|
|
139
|
+
export interface IDrawingManagerService extends IUnitDrawingService<IDrawingParam> {
|
|
140
|
+
}
|
|
141
|
+
export declare const IDrawingManagerService: import('@wendellhu/redi').IdentifierDecorator<IUnitDrawingService<IDrawingParam>>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Nullable } from '@univerjs/core';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { IImageIoService, IImageIoServiceParam, ImageSourceType } from './image-io.service';
|
|
4
|
+
|
|
5
|
+
export declare class ImageIoService implements IImageIoService {
|
|
6
|
+
private _waitCount;
|
|
7
|
+
private _change$;
|
|
8
|
+
change$: Observable<number>;
|
|
9
|
+
setWaitCount(count: number): void;
|
|
10
|
+
private _imageSourceCache;
|
|
11
|
+
getImageSourceCache(source: string, imageSourceType: ImageSourceType): HTMLImageElement | undefined;
|
|
12
|
+
addImageSourceCache(source: string, imageSourceType: ImageSourceType, imageSource: Nullable<HTMLImageElement>): void;
|
|
13
|
+
getImage(imageId: string): Promise<string>;
|
|
14
|
+
saveImage(imageFile: File): Promise<Nullable<IImageIoServiceParam>>;
|
|
15
|
+
private _decreaseWaiting;
|
|
16
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Nullable } from '@univerjs/core';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
|
|
4
|
+
export declare enum ImageSourceType {
|
|
5
|
+
URL = "URL",
|
|
6
|
+
UUID = "UUID",
|
|
7
|
+
BASE64 = "BASE64"
|
|
8
|
+
}
|
|
9
|
+
export declare enum ImageUploadStatusType {
|
|
10
|
+
SUCCUSS = "0",
|
|
11
|
+
ERROR_EXCEED_SIZE = "1",
|
|
12
|
+
ERROR_IMAGE_TYPE = "2",
|
|
13
|
+
ERROR_UPLOAD_COUNT_LIMIT = "3",
|
|
14
|
+
ERROR_IMAGE = "4"
|
|
15
|
+
}
|
|
16
|
+
export interface IImageIoServiceParam {
|
|
17
|
+
imageId: string;
|
|
18
|
+
imageSourceType: ImageSourceType;
|
|
19
|
+
source: string;
|
|
20
|
+
base64Cache: string;
|
|
21
|
+
status: ImageUploadStatusType;
|
|
22
|
+
}
|
|
23
|
+
export interface IImageIoService {
|
|
24
|
+
change$: Observable<number>;
|
|
25
|
+
setWaitCount(count: number): void;
|
|
26
|
+
getImage(imageId: string): Promise<string>;
|
|
27
|
+
saveImage(imageFile: File): Promise<Nullable<IImageIoServiceParam>>;
|
|
28
|
+
getImageSourceCache(source: string, imageSourceType: ImageSourceType): Nullable<HTMLImageElement>;
|
|
29
|
+
addImageSourceCache(source: string, imageSourceType: ImageSourceType, imageSource: Nullable<HTMLImageElement>): void;
|
|
30
|
+
}
|
|
31
|
+
export declare const IImageIoService: import('@wendellhu/redi').IdentifierDecorator<IImageIoService>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IAbsoluteTransform, IOffset } from '@univerjs/core';
|
|
2
|
+
|
|
3
|
+
export interface IRotationSkewFlipTransform {
|
|
4
|
+
angle?: number;
|
|
5
|
+
skewX?: number;
|
|
6
|
+
skewY?: number;
|
|
7
|
+
flipX?: boolean;
|
|
8
|
+
flipY?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface ISrcRect extends IOffset {
|
|
11
|
+
right?: number;
|
|
12
|
+
bottom?: number;
|
|
13
|
+
}
|
|
14
|
+
export interface ITransformState extends IAbsoluteTransform, IRotationSkewFlipTransform {
|
|
15
|
+
}
|
package/lib/umd/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(Y,re){typeof exports=="object"&&typeof module<"u"?re(exports,require("rxjs"),require("@univerjs/core"),require("@wendellhu/redi")):typeof define=="function"&&define.amd?define(["exports","rxjs","@univerjs/core","@wendellhu/redi"],re):(Y=typeof globalThis<"u"?globalThis:Y||self,re(Y.UniverDrawing={},Y.rxjs,Y.UniverCore,Y["@wendellhu/redi"]))})(this,function(Y,re,Ue,tt){"use strict";var Xt=Object.defineProperty;var Zt=(Y,re,Ue)=>re in Y?Xt(Y,re,{enumerable:!0,configurable:!0,writable:!0,value:Ue}):Y[re]=Ue;var q=(Y,re,Ue)=>(Zt(Y,typeof re!="symbol"?re+"":re,Ue),Ue);var gt;const vt=["image/png","image/jpeg","image/jpg","image/gif","image/bmp"];var Ee=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},F={},yt={},it={};Object.defineProperty(it,"__esModule",{value:!0});function Rt(n,e){if(Array.isArray(e))return!1;for(let t in n)if(!st(n[t],e[t]))return!1;for(let t in e)if(n[t]===void 0)return!1;return!0}function kt(n,e){if(!Array.isArray(e)||n.length!==e.length)return!1;for(let t=0;t<n.length;t++)if(!st(n[t],e[t]))return!1;return!0}function st(n,e){return n===e?!0:n===null||e===null||typeof n!="object"||typeof e!="object"?!1:Array.isArray(n)?kt(n,e):Rt(n,e)}it.default=st;var ot={};Object.defineProperty(ot,"__esModule",{value:!0});function lt(n){if(n===null)return null;if(Array.isArray(n))return n.map(lt);if(typeof n=="object"){const e={};for(let t in n)e[t]=lt(n[t]);return e}else return n}ot.default=lt;var at={};(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.eachChildOf=n.advancer=n.readCursor=n.writeCursor=n.WriteCursor=n.ReadCursor=n.isValidPathItem=void 0;function e(O,o){if(!O)throw new Error(o)}const t=O=>O!=null&&typeof O=="object"&&!Array.isArray(O),s=(O,o)=>typeof O==typeof o?O>o:typeof O=="string"&&typeof o=="number";function i(O,o){for(let c in O){const h=c;o.write(h,O[h])}}n.isValidPathItem=O=>typeof O=="number"||typeof O=="string"&&O!=="__proto__";class d{constructor(o=null){this.parents=[],this.indexes=[],this.lcIdx=-1,this.idx=-1,this.container=o}ascend(){e(this.parents.length===this.indexes.length/2),this.idx===0?this.parents.length?(this.lcIdx=this.indexes.pop(),this.container=this.parents.pop(),this.idx=this.indexes.pop()):(this.lcIdx=0,this.idx=-1):(e(this.idx>0),this.idx--,t(this.container[this.idx])&&this.idx--)}getPath(){const o=[];let c=this.container,h=this.parents.length-1,T=this.idx;for(;T>=0;)o.unshift(c[T]),T===0?(T=this.indexes[h*2],c=this.parents[h--]):T-=t(c[T-1])?2:1;return o}}class l extends d{get(){return this.container?this.container.slice(this.idx+1):null}getKey(){return e(this.container!=null,"Invalid call to getKey before cursor descended"),this.container[this.idx]}getComponent(){let o;return this.container&&this.container.length>this.idx+1&&t(o=this.container[this.idx+1])?o:null}descendFirst(){let o=this.idx+1;if(!this.container||o>=this.container.length||t(this.container[o])&&o+1>=this.container.length)return!1;t(this.container[o])&&o++;const c=this.container[o];return Array.isArray(c)?(this.indexes.push(this.idx),this.parents.push(this.container),this.indexes.push(o),this.idx=0,this.container=c):this.idx=o,!0}nextSibling(){if(e(this.parents.length===this.indexes.length/2),this.idx>0||this.parents.length===0)return!1;const o=this.indexes[this.indexes.length-1]+1,c=this.parents[this.parents.length-1];return o>=c.length?!1:(e(!isNaN(o)),this.indexes[this.indexes.length-1]=o,this.container=c[o],!0)}_init(o,c,h,T){this.container=o,this.idx=c,this.parents=h.slice(),this.indexes=T.slice()}clone(){const o=new l;return o._init(this.container,this.idx,this.parents,this.indexes),o}*[Symbol.iterator](){if(this.descendFirst()){do yield this.getKey();while(this.nextSibling());this.ascend()}}traverse(o,c){const h=this.getComponent();h&&c(h,o);for(const T of this)o&&o.descend(T),this.traverse(o,c),o&&o.ascend()}eachPick(o,c){this.traverse(o,(h,T)=>{h.p!=null&&c(h.p,T)})}eachDrop(o,c){this.traverse(o,(h,T)=>{h.d!=null&&c(h.d,T)})}}n.ReadCursor=l;class a extends d{constructor(o=null){super(o),this.pendingDescent=[],this._op=o}flushDescent(){e(this.parents.length===this.indexes.length/2),this.container===null&&(this._op=this.container=[]);for(let o=0;o<this.pendingDescent.length;o++){const c=this.pendingDescent[o];let h=this.idx+1;if(h<this.container.length&&t(this.container[h])&&h++,e(h===this.container.length||!t(this.container[h])),h===this.container.length)this.container.push(c),this.idx=h;else if(this.container[h]===c)this.idx=h;else{if(!Array.isArray(this.container[h])){const T=this.container.splice(h,this.container.length-h);this.container.push(T),this.lcIdx>-1&&(this.lcIdx=h)}for(this.indexes.push(this.idx),this.parents.push(this.container),this.lcIdx!==-1&&(e(s(c,this.container[this.lcIdx][0])),h=this.lcIdx+1,this.lcIdx=-1);h<this.container.length&&s(c,this.container[h][0]);)h++;if(this.indexes.push(h),this.idx=0,h<this.container.length&&this.container[h][0]===c)this.container=this.container[h];else{const T=[c];this.container.splice(h,0,T),this.container=T}}}this.pendingDescent.length=0}reset(){this.lcIdx=-1}getComponent(){this.flushDescent();const o=this.idx+1;if(o<this.container.length&&t(this.container[o]))return this.container[o];{const c={};return this.container.splice(o,0,c),c}}write(o,c){const h=this.getComponent();e(h[o]==null||h[o]===c,"Internal consistency error: Overwritten component. File a bug"),h[o]=c}get(){return this._op}descend(o){if(!n.isValidPathItem(o))throw Error("Invalid JSON key");this.pendingDescent.push(o)}descendPath(o){return this.pendingDescent.push(...o),this}ascend(){this.pendingDescent.length?this.pendingDescent.pop():super.ascend()}mergeTree(o,c=i){if(o===null)return;if(e(Array.isArray(o)),o===this._op)throw Error("Cannot merge into my own tree");const h=this.lcIdx,T=this.parents.length;let J=0;for(let _e=0;_e<o.length;_e++){const Q=o[_e];typeof Q=="string"||typeof Q=="number"?(J++,this.descend(Q)):Array.isArray(Q)?this.mergeTree(Q,c):typeof Q=="object"&&c(Q,this)}for(;J--;)this.ascend();this.lcIdx=this.parents.length===T?h:-1}at(o,c){this.descendPath(o),c(this);for(let h=0;h<o.length;h++)this.ascend();return this}writeAtPath(o,c,h){return this.at(o,()=>this.write(c,h)),this.reset(),this}writeMove(o,c,h=0){return this.writeAtPath(o,"p",h).writeAtPath(c,"d",h)}getPath(){const o=super.getPath();return o.push(...this.pendingDescent),o}}n.WriteCursor=a,n.writeCursor=()=>new a,n.readCursor=O=>new l(O);function E(O,o,c){let h,T;T=h=O?O.descendFirst():!1;function J(_e){let Q;for(;T;){const Ce=Q=O.getKey();if(_e!=null){let Ke=!1;if(o&&typeof Ce=="number"&&(Q=o(Ce,O.getComponent()),Q<0&&(Q=~Q,Ke=!0)),s(Q,_e))return null;if(Q===_e&&!Ke)return O}c&&typeof Q=="number"&&c(Q,O.getComponent()),T=O.nextSibling()}return null}return J.end=()=>{h&&O.ascend()},J}n.advancer=E;function G(O,o,c){let h,T,J,_e;for(h=T=O&&O.descendFirst(),J=_e=o&&o.descendFirst();h||J;){let Q=h?O.getKey():null,Ce=J?o.getKey():null;Q!==null&&Ce!==null&&(s(Ce,Q)?Ce=null:Q!==Ce&&(Q=null)),c(Q==null?Ce:Q,Q!=null?O:null,Ce!=null?o:null),Q!=null&&h&&(h=O.nextSibling()),Ce!=null&&J&&(J=o.nextSibling())}T&&O.ascend(),_e&&o.ascend()}n.eachChildOf=G})(at);var ct={};(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.ConflictType=void 0,function(e){e[e.RM_UNEXPECTED_CONTENT=1]="RM_UNEXPECTED_CONTENT",e[e.DROP_COLLISION=2]="DROP_COLLISION",e[e.BLACKHOLE=3]="BLACKHOLE"}(n.ConflictType||(n.ConflictType={}))})(ct);var ut={},xe={},It;function dt(){return It||(It=1,Object.defineProperty(xe,"__esModule",{value:!0}),xe.uniToStrPos=xe.strPosToUni=void 0,xe.strPosToUni=(n,e=n.length)=>{let t=0,s=0;for(;s<e;s++){const i=n.charCodeAt(s);i>=55296&&i<=57343&&(t++,s++)}if(s!==e)throw Error("Invalid offset - splits unicode bytes");return s-t},xe.uniToStrPos=(n,e)=>{let t=0;for(;e>0;e--){const s=n.charCodeAt(t);t+=s>=55296&&s<=57343?2:1}return t}),xe}var ft={},bt;function ht(){return bt||(bt=1,function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.uniSlice=n.dlen=n.eachOp=void 0;const e=dt(),t=f=>{if(!Array.isArray(f))throw Error("Op must be an array of components");let _=null;for(let m=0;m<f.length;m++){const H=f[m];switch(typeof H){case"object":if(typeof H.d!="number"&&typeof H.d!="string")throw Error("Delete must be number or string");if(n.dlen(H.d)<=0)throw Error("Deletes must not be empty");break;case"string":if(!(H.length>0))throw Error("Inserts cannot be empty");break;case"number":if(!(H>0))throw Error("Skip components must be >0");if(typeof _=="number")throw Error("Adjacent skip components should be combined");break}_=H}if(typeof _=="number")throw Error("Op has a trailing skip")};function s(f,_){let m=0,H=0;for(let z=0;z<f.length;z++){const x=f[z];switch(_(x,m,H),typeof x){case"object":m+=n.dlen(x.d);break;case"string":H+=e.strPosToUni(x);break;case"number":m+=x,H+=x;break}}}n.eachOp=s;function i(f,_){const m=[],H=a(m);return s(f,(z,x,De)=>{H(_(z,x,De))}),o(m)}const d=f=>f,l=f=>i(f,d);n.dlen=f=>typeof f=="number"?f:e.strPosToUni(f);const a=f=>_=>{if(!(!_||_.d===0||_.d===""))if(f.length===0)f.push(_);else if(typeof _==typeof f[f.length-1])if(typeof _=="object"){const m=f[f.length-1];m.d=typeof m.d=="string"&&typeof _.d=="string"?m.d+_.d:n.dlen(m.d)+n.dlen(_.d)}else f[f.length-1]+=_;else f.push(_)},E=f=>typeof f=="number"?f:typeof f=="string"?e.strPosToUni(f):typeof f.d=="number"?f.d:e.strPosToUni(f.d);n.uniSlice=(f,_,m)=>{const H=e.uniToStrPos(f,_),z=m==null?1/0:e.uniToStrPos(f,m);return f.slice(H,z)};const G=(f,_,m)=>typeof f=="number"?m==null?f-_:Math.min(f,m)-_:n.uniSlice(f,_,m),O=f=>{let _=0,m=0;return{take:(x,De)=>{if(_===f.length)return x===-1?null:x;const fe=f[_];let ie;if(typeof fe=="number")return x===-1||fe-m<=x?(ie=fe-m,++_,m=0,ie):(m+=x,x);if(typeof fe=="string"){if(x===-1||De==="i"||e.strPosToUni(fe.slice(m))<=x)return ie=fe.slice(m),++_,m=0,ie;{const ue=m+e.uniToStrPos(fe.slice(m),x);return ie=fe.slice(m,ue),m=ue,ie}}else{if(x===-1||De==="d"||n.dlen(fe.d)-m<=x)return ie={d:G(fe.d,m)},++_,m=0,ie;{let ue=G(fe.d,m,m+x);return m+=x,{d:ue}}}},peek:()=>f[_]}},o=f=>(f.length>0&&typeof f[f.length-1]=="number"&&f.pop(),f);function c(f,_,m){if(m!=="left"&&m!=="right")throw Error("side ("+m+") must be 'left' or 'right'");t(f),t(_);const H=[],z=a(H),{take:x,peek:De}=O(f);for(let ie=0;ie<_.length;ie++){const ue=_[ie];let Oe,Pe;switch(typeof ue){case"number":for(Oe=ue;Oe>0;)Pe=x(Oe,"i"),z(Pe),typeof Pe!="string"&&(Oe-=E(Pe));break;case"string":m==="left"&&typeof De()=="string"&&z(x(-1)),z(e.strPosToUni(ue));break;case"object":for(Oe=n.dlen(ue.d);Oe>0;)switch(Pe=x(Oe,"i"),typeof Pe){case"number":Oe-=Pe;break;case"string":z(Pe);break;case"object":Oe-=n.dlen(Pe.d)}break}}let fe;for(;fe=x(-1);)z(fe);return o(H)}function h(f,_){t(f),t(_);const m=[],H=a(m),{take:z}=O(f);for(let De=0;De<_.length;De++){const fe=_[De];let ie,ue;switch(typeof fe){case"number":for(ie=fe;ie>0;)ue=z(ie,"d"),H(ue),typeof ue!="object"&&(ie-=E(ue));break;case"string":H(fe);break;case"object":ie=n.dlen(fe.d);let Oe=0;for(;Oe<ie;)switch(ue=z(ie-Oe,"d"),typeof ue){case"number":H({d:G(fe.d,Oe,Oe+ue)}),Oe+=ue;break;case"string":Oe+=e.strPosToUni(ue);break;case"object":H(ue)}break}}let x;for(;x=z(-1);)H(x);return o(m)}const T=(f,_)=>{let m=0;for(let H=0;H<_.length&&f>m;H++){const z=_[H];switch(typeof z){case"number":{m+=z;break}case"string":const x=e.strPosToUni(z);m+=x,f+=x;break;case"object":f-=Math.min(n.dlen(z.d),f-m);break}}return f},J=(f,_)=>typeof f=="number"?T(f,_):f.map(m=>T(m,_));function _e(f,_,m){return i(f,(H,z)=>typeof H=="object"&&typeof H.d=="number"?{d:m.slice(_,z,z+H.d)}:H)}function Q(f){return i(f,_=>{switch(typeof _){case"object":if(typeof _.d=="number")throw Error("Cannot invert text op: Deleted characters missing from operation. makeInvertible must be called first.");return _.d;case"string":return{d:_};case"number":return _}})}function Ce(f){return i(f,_=>typeof _=="object"&&typeof _.d=="string"?{d:e.strPosToUni(_.d)}:_)}function Ke(f){let _=!0;return s(f,m=>{typeof m=="object"&&typeof m.d=="number"&&(_=!1)}),_}function Ie(f){return{name:"text-unicode",uri:"http://sharejs.org/types/text-unicode",trim:o,normalize:l,checkOp:t,create(_=""){if(typeof _!="string")throw Error("Initial data must be a string");return f.create(_)},apply(_,m){t(m);const H=f.builder(_);for(let z=0;z<m.length;z++){const x=m[z];switch(typeof x){case"number":H.skip(x);break;case"string":H.append(x);break;case"object":H.del(n.dlen(x.d));break}}return H.build()},transform:c,compose:h,transformPosition:T,transformSelection:J,isInvertible:Ke,makeInvertible(_,m){return _e(_,m,f)},stripInvertible:Ce,invert:Q,invertWithDoc(_,m){return Q(_e(_,m,f))},isNoop:_=>_.length===0}}n.default=Ie}(ft)),ft}var nt={},mt;function jt(){if(mt)return nt;mt=1,Object.defineProperty(nt,"__esModule",{value:!0});const n=ht(),e=dt();function t(s,i){return{get:s,getLength(){return s().length},insert(d,l,a){const E=e.strPosToUni(s(),d);return i([E,l],a)},remove(d,l,a){const E=e.strPosToUni(s(),d);return i([E,{d:l}],a)},_onOp(d){n.eachOp(d,(l,a,E)=>{switch(typeof l){case"string":this.onInsert&&this.onInsert(E,l);break;case"object":const G=n.dlen(l.d);this.onRemove&&this.onRemove(E,G)}})},onInsert:null,onRemove:null}}return nt.default=t,t.provides={text:!0},nt}var wt;function $t(){return wt||(wt=1,function(n){var e=Ee&&Ee.__createBinding||(Object.create?function(c,h,T,J){J===void 0&&(J=T),Object.defineProperty(c,J,{enumerable:!0,get:function(){return h[T]}})}:function(c,h,T,J){J===void 0&&(J=T),c[J]=h[T]}),t=Ee&&Ee.__setModuleDefault||(Object.create?function(c,h){Object.defineProperty(c,"default",{enumerable:!0,value:h})}:function(c,h){c.default=h}),s=Ee&&Ee.__importStar||function(c){if(c&&c.__esModule)return c;var h={};if(c!=null)for(var T in c)Object.hasOwnProperty.call(c,T)&&e(h,c,T);return t(h,c),h},i=Ee&&Ee.__importDefault||function(c){return c&&c.__esModule?c:{default:c}};Object.defineProperty(n,"__esModule",{value:!0}),n.type=n.remove=n.insert=void 0;const d=dt(),l=s(ht()),a=i(jt()),E={create(c){return c},toString(c){return c},builder(c){if(typeof c!="string")throw Error("Invalid document snapshot: "+c);const h=[];return{skip(T){let J=d.uniToStrPos(c,T);if(J>c.length)throw Error("The op is too long for this document");h.push(c.slice(0,J)),c=c.slice(J)},append(T){h.push(T)},del(T){c=c.slice(d.uniToStrPos(c,T))},build(){return h.join("")+c}}},slice:l.uniSlice},G=l.default(E),O=Object.assign(Object.assign({},G),{api:a.default});n.type=O,n.insert=(c,h)=>h.length===0?[]:c===0?[h]:[c,h],n.remove=(c,h)=>l.dlen(h)===0?[]:c===0?[{d:h}]:[c,{d:h}];var o=ht();Object.defineProperty(n,"makeType",{enumerable:!0,get:function(){return o.default}})}(ut)),ut}(function(n){var e=Ee&&Ee.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(n,"__esModule",{value:!0}),n.editOp=n.replaceOp=n.insertOp=n.moveOp=n.removeOp=n.type=void 0;const t=e(it),s=e(ot),i=at,d=ct;function l(r,u){if(!r)throw new Error(u)}n.type={name:"json1",uri:"http://sharejs.org/types/JSONv1",readCursor:i.readCursor,writeCursor:i.writeCursor,create:r=>r,isNoop:r=>r==null,setDebug(r){},registerSubtype:Q,checkValidOp:z,normalize:x,apply:De,transformPosition:fe,compose:ie,tryTransform:_t,transform:qt,makeInvertible:Pe,invert:ue,invertWithDoc:Vt,RM_UNEXPECTED_CONTENT:d.ConflictType.RM_UNEXPECTED_CONTENT,DROP_COLLISION:d.ConflictType.DROP_COLLISION,BLACKHOLE:d.ConflictType.BLACKHOLE,transformNoConflict:(r,u,y)=>Nt(()=>!0,r,u,y),typeAllowingConflictsPred:r=>Object.assign(Object.assign({},n.type),{transform:(u,y,A)=>Nt(r,u,y,A)})};const a=r=>r?r.getComponent():null;function E(r){return r&&typeof r=="object"&&!Array.isArray(r)}const G=r=>Array.isArray(r)?r.slice():r!==null&&typeof r=="object"?Object.assign({},r):r,O=r=>r&&(r.p!=null||r.r!==void 0),o=r=>r&&(r.d!=null||r.i!==void 0);function c(r,u){return l(r!=null),typeof u=="number"?(l(Array.isArray(r),"Invalid key - child is not an array"),(r=r.slice()).splice(u,1)):(l(E(r),"Invalid key - child is not an object"),delete(r=Object.assign({},r))[u]),r}function h(r,u,y){return typeof u=="number"?(l(r!=null,"Container is missing for key"),l(Array.isArray(r),"Cannot use numerical key for object container"),l(r.length>=u,"Cannot insert into out of bounds index"),r.splice(u,0,y)):(l(E(r),"Cannot insert into missing item"),l(r[u]===void 0,"Trying to overwrite value at key. Your op needs to remove it first"),r[u]=y),y}n.removeOp=(r,u=!0)=>i.writeCursor().writeAtPath(r,"r",u).get(),n.moveOp=(r,u)=>i.writeCursor().writeMove(r,u).get(),n.insertOp=(r,u)=>i.writeCursor().writeAtPath(r,"i",u).get(),n.replaceOp=(r,u,y)=>i.writeCursor().at(r,A=>{A.write("r",u),A.write("i",y)}).get(),n.editOp=(r,u,y,A=!1)=>i.writeCursor().at(r,I=>_(I,u,y,A)).get();const T=(r,u)=>r!=null&&(typeof u=="number"?Array.isArray(r):typeof r=="object"),J=(r,u)=>T(r,u)?r[u]:void 0,_e={};function Q(r){let u=r.type?r.type:r;u.name&&(_e[u.name]=u),u.uri&&(_e[u.uri]=u)}const Ce=r=>{const u=_e[r];if(u)return u;throw Error("Missing type: "+r)};Q($t());const Ke=(r,u)=>r+u;Q({name:"number",apply:Ke,compose:Ke,invert:r=>-r,transform:r=>r});const Ie=r=>r==null?null:r.et?Ce(r.et):r.es?_e["text-unicode"]:r.ena!=null?_e.number:null,f=r=>r.es?r.es:r.ena!=null?r.ena:r.e,_=(r,u,y,A=!1)=>{const[I,C]=typeof u=="string"?[Ce(u),u]:[u,u.name];!A&&I.isNoop&&I.isNoop(y)||(C==="number"?r.write("ena",y):C==="text-unicode"?r.write("es",y):(r.write("et",C),r.write("e",y)))};function m(r){l(typeof r=="number"),l(r>=0),l(r===(0|r))}function H(r){typeof r=="number"?m(r):l(typeof r=="string")}function z(r){if(r===null)return;const u=new Set,y=new Set,A=C=>{let $=!0,k=!1;for(let g in C){const v=C[g];if($=!1,l(g==="p"||g==="r"||g==="d"||g==="i"||g==="e"||g==="es"||g==="ena"||g==="et","Invalid component item '"+g+"'"),g==="p")m(v),l(!u.has(v)),u.add(v),l(C.r===void 0);else if(g==="d")m(v),l(!y.has(v)),y.add(v),l(C.i===void 0);else if(g==="e"||g==="es"||g==="ena"){l(!k),k=!0;const b=Ie(C);l(b,"Missing type in edit"),b.checkValidOp&&b.checkValidOp(f(C))}}l(!$)},I=(C,$,k)=>{if(!Array.isArray(C))throw Error("Op must be null or a list");if(C.length===0)throw Error("Empty descent");$||H(C[0]);let g=1,v=0,b=0;for(let w=0;w<C.length;w++){const j=C[w];if(l(j!=null),Array.isArray(j)){const W=I(j,!1);if(v){const p=typeof b,U=typeof W;p===U?l(b<W,"descent keys are not in order"):l(p==="number"&&U==="string")}b=W,v++,g=3}else typeof j=="object"?(l(g===1,`Prev not scalar - instead ${g}`),A(j),g=2):(l(g!==3),H(j),l(i.isValidPathItem(j),"Invalid path key"),g=1)}return l(v!==1,"Operation makes multiple descents. Remove some []"),l(g===2||g===3),C[0]};I(r,!0),l(u.size===y.size,"Mismatched picks and drops in op");for(let C=0;C<u.size;C++)l(u.has(C)),l(y.has(C))}function x(r){let u=0,y=[];const A=i.writeCursor();return A.mergeTree(r,(I,C)=>{const $=Ie(I);if($){const g=f(I);_(C,$,$.normalize?$.normalize(g):g)}for(const g of["r","p","i","d"])if(I[g]!==void 0){const v=g==="p"||g==="d"?(k=I[g],y[k]==null&&(y[k]=u++),y[k]):I[g];C.write(g,v)}var k}),A.get()}function De(r,u){if(z(u),u===null)return r;const y=[];return function A(I,C){let $=I,k=0,g={root:I},v=0,b=g,w="root";function j(){for(;v<k;v++){let W=C[v];typeof W!="object"&&(l(T(b,w)),b=b[w]=G(b[w]),w=W)}}for(;k<C.length;k++){const W=C[k];if(Array.isArray(W)){const p=A($,W);p!==$&&p!==void 0&&(j(),$=b[w]=p)}else if(typeof W=="object"){W.d!=null?(j(),$=h(b,w,y[W.d])):W.i!==void 0&&(j(),$=h(b,w,W.i));const p=Ie(W);if(p)j(),$=b[w]=p.apply($,f(W));else if(W.e!==void 0)throw Error("Subtype "+W.et+" undefined")}else $=J($,W)}return g.root}(r=function A(I,C){const $=[];let k=0;for(;k<C.length;k++){const w=C[k];if(Array.isArray(w))break;typeof w!="object"&&($.push(I),I=J(I,w))}for(let w=C.length-1;w>=k;w--)I=A(I,C[w]);for(--k;k>=0;k--){const w=C[k];if(typeof w!="object"){const j=$.pop();I=I===J(j,w)?j:I===void 0?c(j,w):(v=w,b=I,(g=G(g=j))[v]=b,g)}else O(w)&&(l(I!==void 0,"Cannot pick up or remove undefined"),w.p!=null&&(y[w.p]=I),I=void 0)}var g,v,b;return I}(r,u),u)}function fe(r,u){r=r.slice(),z(u);const y=i.readCursor(u);let A,I,C=!1;const $=[];for(let g=0;;g++){const v=r[g],b=y.getComponent();if(b&&(b.r!==void 0?C=!0:b.p!=null&&(C=!1,A=b.p,I=g)),g>=r.length)break;let w=0;const j=i.advancer(y,void 0,(p,U)=>{O(U)&&w++});$.unshift(j);const W=j(v);if(typeof v=="number"&&(r[g]-=w),!W)break}if($.forEach(g=>g.end()),C)return null;const k=()=>{let g=0;if(A!=null){const v=y.getPath();g=v.length,r=v.concat(r.slice(I))}for(;g<r.length;g++){const v=r[g],b=a(y),w=Ie(b);if(w){const p=f(b);w.transformPosition&&(r[g]=w.transformPosition(r[g],p));break}let j=0;const W=i.advancer(y,(p,U)=>o(U)?~(p-j):p-j,(p,U)=>{o(U)&&j++})(v);if(typeof v=="number"&&(r[g]+=j),!W)break}};return A!=null?y.eachDrop(null,g=>{g===A&&k()}):k(),r}function ie(r,u){if(z(r),z(u),r==null)return u;if(u==null)return r;let y=0;const A=i.readCursor(r),I=i.readCursor(u),C=i.writeCursor(),$=[],k=[],g=[],v=[],b=[],w=[],j=new Set;A.traverse(null,p=>{p.p!=null&&(g[p.p]=A.clone())}),I.traverse(null,p=>{p.d!=null&&(v[p.d]=I.clone())});const W=i.writeCursor();return function p(U,se,ne,K,le,Ge,me,ve){l(se||ne);const ae=a(se),Me=a(ne),Ne=!!Me&&Me.r!==void 0,Fe=!!ae&&ae.i!==void 0,Se=ae?ae.d:null,Ae=Me?Me.p:null,We=(Ge||Ne)&&Ae==null;if(Ae!=null)K=v[Ae],me=k[Ae]=new i.WriteCursor;else if(Me&&Me.r!==void 0)K=null;else{const P=a(K);P&&P.d!=null&&(K=null)}const ee=a(K);if(Se!=null)if(U=g[Se],ve=$[Se]=new i.WriteCursor,We)Ge&&!Ne&&ve.write("r",!0);else{const P=b[Se]=y++;me.write("d",P)}else if(ae&&ae.i!==void 0)U=null;else{const P=a(U);P&&P.p!=null&&(U=null)}let M;Fe?(l(le===void 0),M=ae.i):M=le;const L=(Ae==null?!Fe||Ge||Ne:M===void 0)?null:me.getComponent();if(Ae!=null){if(!(le!==void 0||Fe)){const P=Se!=null?b[Se]:y++;w[Ae]=P,ve.write("p",P)}}else Ne&&(Fe||le!==void 0||(Me.r,ve.write("r",Me.r)));const S=We?null:Ie(ae),D=Ie(ee);if((S||D)&&(S&&S.name,D&&D.name),S&&D){l(S===D);const P=f(ae),B=f(ee),pe=S.compose(P,B);_(me,S,pe),j.add(ee)}else S?_(me,S,f(ae)):D&&(_(me,D,f(ee)),j.add(ee));const N=typeof M=="object"&&M!=null;let X=!1,Z=0,te=0,ge=0,he=0,ce=0;const be=i.advancer(K,(P,B)=>o(B)?he-P-1:P-he,(P,B)=>{o(B)&&he++}),V=i.advancer(U,(P,B)=>O(B)?Z-P-1:P-Z,(P,B)=>{O(B)&&Z++});if(i.eachChildOf(se,ne,(P,B,pe)=>{let we,Le,Ve=P,Te=P,et=P;if(typeof P=="number"){let ye=P+ge;Le=be(ye),Te=ye+he;let de=P+te;we=V(de),o(a(Le))&&(we=null),Ve=de+Z,et=P+ce,l(Ve>=0,"p1PickKey is negative"),l(Te>=0,"p2DropKey is negative");const Re=o(a(B)),Be=O(a(pe));(Re||Be&&!We)&&ce--,Re&&te--,Be&&ge--}else we=V(P),Le=be(P);ve.descend(Ve),me.descend(Te);const Ye=N&&!o(a(B))?M[et]:void 0,je=p(we,B,pe,Le,Ye,We,me,ve);var $e,R,oe;N&&!We?Ye!==je&&(X||(M=Array.isArray(M)?M.slice():Object.assign({},M),X=!0),$e=M,oe=je,typeof(R=et)=="number"?(l(Array.isArray($e)),l(R<$e.length)):(l(!Array.isArray($e)),l($e[R]!==void 0)),oe===void 0?typeof R=="number"?$e.splice(R,1):delete $e[R]:$e[R]=oe):l(je===void 0),me.ascend(),ve.ascend()}),V.end(),be.end(),L!=null)L.i=M;else if(!Ge&&!Ne&&Ae==null)return M}(A,A.clone(),I,I.clone(),void 0,!1,C,W),C.reset(),C.mergeTree(W.get()),C.reset(),C.get(),$.map(p=>p.get()),k.map(p=>p.get()),A.traverse(C,(p,U)=>{const se=p.p;if(se!=null){const ne=b[se];ne!=null&&U.write("p",ne);const K=$[se];K&&K.get(),K&&U.mergeTree(K.get())}else p.r!==void 0&&U.write("r",p.r)}),C.reset(),C.get(),I.traverse(C,(p,U)=>{const se=p.d;if(se!=null){const K=w[se];K!=null&&U.write("d",K);const le=k[se];le&&U.mergeTree(le.get())}else p.i!==void 0&&U.write("i",p.i);const ne=Ie(p);ne&&!j.has(p)&&_(U,ne,f(p))}),C.get()}function ue(r){if(r==null)return null;const u=new i.ReadCursor(r),y=new i.WriteCursor;let A;const I=[],C=[];return function $(k,g,v){const b=k.getComponent();let w,j=!1;if(b){b.p!=null&&(g.write("d",b.p),I[b.p]=k.clone()),b.r!==void 0&&g.write("i",b.r),b.d!=null&&(g.write("p",b.d),v=void 0),b.i!==void 0&&(v=w=b.i);const p=Ie(b);p&&(v===void 0?(A||(A=new Set),A.add(b)):(f(b),v=p.apply(v,f(b)),j=!0))}let W=0;for(const p of k){g.descend(p);const U=typeof p=="number"?p-W:p,se=J(v,U);o(k.getComponent())&&W++;const ne=$(k,g,se);if(v!==void 0&&ne!==void 0){if(j||(j=!0,v=G(v)),!T(v,U))throw Error("Cannot modify child - invalid operation");v[U]=ne}g.ascend()}if(w===void 0)return j?v:void 0;g.write("r",v)}(u,y,void 0),A&&(y.reset(),function $(k,g,v){const b=g.getComponent();if(b){const p=b.d;if(p!=null&&(k=I[p],v=C[p]=i.writeCursor()),A.has(b)){const U=Ie(b);if(!U.invert)throw Error(`Cannot invert subtype ${U.name}`);_(v,U,U.invert(f(b)))}}let w=0,j=0;const W=i.advancer(k,(p,U)=>O(U)?w-p-1:p-w,(p,U)=>{O(U)&&w++});for(const p of g)if(typeof p=="number"){const U=p-j,se=W(U),ne=U+w;v.descend(ne),$(se,g,v),o(g.getComponent())&&j++,v.ascend()}else v.descend(p),$(W(p),g,v),v.ascend();W.end()}(u.clone(),u,y),C.length&&(y.reset(),u.traverse(y,($,k)=>{const g=$.p;if(g!=null){const v=C[g];v&&v.get(),v&&k.mergeTree(v.get())}}))),y.get()}const Oe=(r,u)=>r.some(y=>typeof y=="object"&&(Array.isArray(y)?Oe(y,u):u(y)));function Pe(r,u){if(r==null||!Oe(r,g=>{var v;return g.r!==void 0||((v=Ie(g))===null||v===void 0?void 0:v.makeInvertible)!=null}))return r;const y=new i.ReadCursor(r),A=new i.WriteCursor;let I=!1;const C=[],$=[],k=(g,v,b)=>{const w=g.getComponent();let j=!1;if(w){w.d!=null&&v.write("d",w.d),w.i!==void 0&&v.write("i",w.i);const p=w.p;if(p!=null&&(C[p]=g.clone(),l(b!==void 0,"Operation picks up at an invalid key"),$[p]=b,v.write("p",w.p)),w.r!==void 0&&b===void 0)throw Error("Invalid doc / op in makeInvertible: removed item missing from doc");const U=Ie(w);U&&(U.makeInvertible?I=!0:_(v,U,f(w),!0))}let W=0;for(const p of g){v.descend(p);const U=typeof p=="number"?p-W:p,se=J(b,U),ne=k(g,v,se);se!==ne&&(j||(j=!0,b=G(b)),ne===void 0?(b=c(b,U),typeof p=="number"&&W++):b[U]=ne),v.ascend()}return w&&(w.r!==void 0?(v.write("r",s.default(b)),b=void 0):w.p!=null&&(b=void 0)),b};return k(y,A,u),A.get(),I&&(A.reset(),function g(v,b,w,j,W){const p=b.getComponent();if(p){p.i!==void 0?(j=p.i,W=!0):p.d!=null&&(j=$[p.d],v=C[p.d],W=!1,p.d);let K=Ie(p);if(K&&K.makeInvertible){const le=f(p);_(w,K,K.makeInvertible(le,j),!0)}}let U=0,se=0;const ne=i.advancer(v,(K,le)=>O(le)?U-K-1:K-U,(K,le)=>{O(le)&&U++});for(const K of b)if(typeof K=="number"){const le=K-se,Ge=ne(le),me=le+U,ve=J(j,W?le:me);w.descend(K),g(Ge,b,w,ve,W),o(b.getComponent())&&se++,w.ascend()}else{const le=J(j,K);w.descend(K),g(ne(K),b,w,le,W),w.ascend()}ne.end()}(y.clone(),y,A,u,!1)),A.get()}function Vt(r,u){return ue(Pe(r,u))}const pt=r=>{if(r==null)return null;const u=r.slice();for(let y=0;y<r.length;y++){const A=u[y];Array.isArray(A)&&(u[y]=pt(A))}return u};function _t(r,u,y){l(y==="left"||y==="right","Direction must be left or right");const A=y==="left"?0:1;if(u==null)return{ok:!0,result:r};z(r),z(u);let I=null;const C=[],$=[],k=[],g=[],v=[],b=[],w=[],j=[],W=[],p=[],U=[],se=[],ne=[],K=[],le=[];let Ge=0;const me=i.readCursor(r),ve=i.readCursor(u),ae=i.writeCursor();if(function ee(M,L=null,S){const D=a(L);D&&(D.r!==void 0?S=L.clone():D.p!=null&&(S=null,b[D.p]=M.clone()));const N=M.getComponent();let X;N&&(X=N.p)!=null&&(v[X]=L?L.clone():null,k[X]=M.clone(),S&&(p[X]=!0,W[X]=S),D&&D.p!=null&&(K[X]=D.p));const Z=i.advancer(L);for(const te of M)ee(M,Z(te),S);Z.end()}(ve,me,null),function ee(M,L,S,D,N){const X=S.getComponent();let Z,te=!1;X&&((Z=X.d)!=null?(g[Z]=S.clone(),D!=null&&(le[D]==null&&(le[D]=[]),le[D].push(Z)),M=v[Z]||null,L=k[Z]||null,p[Z]?(N&&(U[Z]=!0),N=W[Z]||null):!N||A!==1&&K[Z]!=null||I==null&&(I={type:d.ConflictType.RM_UNEXPECTED_CONTENT,op1:n.removeOp(N.getPath()),op2:n.moveOp(L.getPath(),S.getPath())}),te=!0):X.i!==void 0&&(M=L=null,te=!0,N&&I==null&&(I={type:d.ConflictType.RM_UNEXPECTED_CONTENT,op1:n.removeOp(N.getPath()),op2:n.insertOp(S.getPath(),X.i)})));const ge=a(M);ge&&(ge.r!==void 0?N=M.clone():ge.p!=null&&(ge.p,D=ge.p,N=null));const he=Ie(X);he&&N&&I==null&&(I={type:d.ConflictType.RM_UNEXPECTED_CONTENT,op1:n.removeOp(N.getPath()),op2:n.editOp(S.getPath(),he,f(X),!0)});let ce=0,be=0;const V=i.advancer(L,(B,pe)=>O(pe)?ce-B-1:B-ce,(B,pe)=>{O(pe)&&ce++}),P=i.advancer(M);for(const B of S)if(typeof B=="number"){const pe=B-be,we=V(pe);be+=+ee(P(pe+ce),we,S,D,N)}else{const pe=V(B);ee(P(B),pe,S,D,N)}return V.end(),P.end(),te}(me,ve,ve.clone(),null,null),g.map(ee=>ee&&ee.get()),I)return{ok:!1,conflict:I};U.map(ee=>!!ee);const Me=[];let Ne=null;(function ee(M,L,S,D,N){let X=!1;const Z=a(L);if(O(Z)){const V=Z.p;V!=null?(S=g[V],D=se[V]=i.writeCursor(),X=!0,N=null):(S=null,N=L.clone())}else o(a(S))&&(S=null);const te=M.getComponent();if(te){const V=te.p;V!=null?(N&&(j[V]=N),Me[V]=N||A===1&&X?null:D.getComponent(),C[V]=M.clone(),S&&(w[V]=S.clone())):te.r!==void 0&&(N||D.write("r",!0),(N||X)&&(Ne==null&&(Ne=new Set),Ne.add(te)))}let ge=0,he=0;const ce=i.advancer(L,void 0,(V,P)=>{O(P)&&ge++}),be=i.advancer(S,(V,P)=>o(P)?~(V-he):V-he,(V,P)=>{o(P)&&he++});if(M)for(const V of M)if(typeof V=="string"){const P=ce(V),B=be(V);D.descend(V),ee(M,P,B,D,N),D.ascend()}else{const P=ce(V),B=V-ge,pe=O(a(P))?null:be(B),we=B+he;l(we>=0),D.descend(we),ee(M,P,pe,D,N),D.ascend()}ce.end(),be.end()})(me,ve,ve.clone(),ae,null),ae.reset();let Fe=[];if(function ee(M,L,S,D,N,X){l(L);const Z=L.getComponent();let te=a(D),ge=!1;const he=(R,oe,ye)=>R?n.moveOp(R.getPath(),oe.getPath()):n.insertOp(oe.getPath(),ye.i);if(o(Z)){const R=Z.d;R!=null&&($[R]=L.clone());const oe=R!=null?Me[R]:null;let ye=!1;if(Z.i!==void 0||R!=null&&oe){let de;te&&(te.i!==void 0||(de=te.d)!=null&&!p[de])&&(ye=de!=null?R!=null&&R===K[de]:t.default(te.i,Z.i),ye||de!=null&&A!==1&&K[de]!=null||I==null&&(I={type:d.ConflictType.DROP_COLLISION,op1:he(R!=null?C[R]:null,L,Z),op2:he(de!=null?k[de]:null,D,te)})),ye||(X?I==null&&(I={type:d.ConflictType.RM_UNEXPECTED_CONTENT,op1:he(R!=null?C[R]:null,L,Z),op2:n.removeOp(X.getPath())}):(R!=null?(Fe[Ge]=R,N.write("d",oe.p=Ge++)):N.write("i",s.default(Z.i)),ge=!0))}else if(R!=null&&!oe){const de=j[R];de&&(X=de.clone())}R!=null?(M=C[R],S=b[R],D=w[R]):Z.i!==void 0&&(M=S=null,ye||(D=null))}else O(a(M))&&(M=S=D=null);const ce=a(M),be=a(S);if(O(be)){const R=be.p;be.r!==void 0&&(!ce||ce.r===void 0)||p[R]?(D=null,X=S.clone()):R!=null&&(D=g[R],A!==1&&K[R]!=null||((N=ne[R])||(N=ne[R]=i.writeCursor()),N.reset(),X=null))}else!o(Z)&&o(te)&&(D=null);te=D!=null?D.getComponent():null;const V=Ie(Z);if(V){const R=f(Z);if(X)I==null&&(I={type:d.ConflictType.RM_UNEXPECTED_CONTENT,op1:n.editOp(L.getPath(),V,R,!0),op2:n.removeOp(X.getPath())});else{const oe=Ie(te);let ye;if(oe){if(V!==oe)throw Error("Transforming incompatible types");const de=f(te);ye=V.transform(R,de,y)}else ye=s.default(R);_(N,V,ye)}}let P=0,B=0,pe=0,we=0,Le=0,Ve=0,Te=M!=null&&M.descendFirst(),et=Te;const Ye=i.advancer(S,void 0,(R,oe)=>{O(oe)&&pe++});let je=D!=null&&D.descendFirst(),$e=je;for(const R of L)if(typeof R=="number"){let oe;const ye=o(L.getComponent()),de=R-B;{let He;for(;Te&&typeof(He=M.getKey())=="number";){He+=P;const ke=M.getComponent(),Je=O(ke);if(He>de||He===de&&(!Je||A===0&&ye))break;if(Je){P--;const qe=ke.p;K.includes(qe),ke.d,a(ne[ke.d]),O(a(ne[ke.d])),(ke.r===void 0||Ne&&Ne.has(ke))&&(qe==null||!Me[qe]||A!==1&&K.includes(qe))||Le--}Te=M.nextSibling()}oe=Te&&He===de?M:null}const Re=de-P;let Be=Ye(Re);const Ot=Re-pe;let rt=null;{let He,ke;for(;je&&typeof(He=D.getKey())=="number";){ke=He-we;const Je=D.getComponent(),qe=o(Je);if(ke>Ot)break;if(ke===Ot){if(!qe){rt=D;break}{if(A===0&&ye){rt=D;break}const ze=Be&&O(Be.getComponent());if(A===0&&ze)break}}if(qe){const ze=Je.d;K[ze],Je.i===void 0&&(p[ze]||K[ze]!=null&&A!==1)?(p[ze]||K[ze]!=null&&A===0)&&(we++,Ve--):we++}je=D.nextSibling()}}const Tt=Ot+we+Le+Ve;l(Tt>=0,"trying to descend to a negative index"),N.descend(Tt),ye&&(oe=Be=rt=null,B++),ee(oe,L,Be,rt,N,X)&&Ve++,N.ascend()}else{let oe;for(;Te&&(oe=M.getKey(),typeof oe!="string"||!(oe>R||oe===R));)Te=M.nextSibling();const ye=Te&&oe===R?M:null,de=Ye(R);let Re;for(;je&&(Re=D.getKey(),typeof Re!="string"||!(Re>R||Re===R));)je=D.nextSibling();const Be=je&&Re===R?D:null;N.descend(R),ee(ye,L,de,Be,N,X),N.ascend()}return Ye.end(),et&&M.ascend(),$e&&D.ascend(),ge}(me,me.clone(),ve,ve.clone(),ae,null),I)return{ok:!1,conflict:I};ae.reset();const Se=(ee,M,L)=>ee.traverse(M,(S,D)=>{S.d!=null&&L(S.d,ee,D)});(p.length||se.length)&&(Se(ve,ae,(ee,M,L)=>{p[ee]&&!U[ee]&&L.write("r",!0),se[ee]&&L.mergeTree(se[ee].get())}),ae.reset());const Ae=[],We=[];if((ne.length||p.length)&&!I){const ee=i.readCursor(pt(ae.get()));if(Se(ee,null,(M,L)=>{Ae[M]=L.clone()}),ne.forEach(M=>{M&&Se(i.readCursor(M.get()),null,(L,S)=>{Ae[L]=S.clone()})}),function M(L,S,D,N,X,Z){const te=a(S);if(te&&O(te))if(te.p!=null){const P=te.p;Ae[P].getPath(),D=Ae[P],N=We[P]=i.writeCursor()}else te.r!==void 0&&(D=null);else o(a(D))&&(D=null);const ge=L.getComponent();if(ge){let P;if((P=ge.d)!=null){const B=ne[P];B&&(B.get(),N.mergeTree(B.get()),D=i.readCursor(B.get()))}}let he=0,ce=0;const be=i.advancer(S,void 0,(P,B)=>{O(B)&&he--}),V=i.advancer(D,(P,B)=>o(B)?-(P-ce)-1:P-ce,(P,B)=>{o(B)&&ce++});for(const P of L)if(typeof P=="number"){const B=be(P),pe=P+he,we=V(pe),Le=pe+ce;N.descend(Le),M(L,B,we,N),N.ascend()}else N.descend(P),M(L,be(P),V(P),N),N.ascend();be.end(),V.end()}(ve,ee,ee.clone(),ae),ae.reset(),I)return{ok:!1,conflict:I};if(ae.get(),We.length){const M=We.map(S=>S?S.get():null),L=i.readCursor(pt(ae.get()));if(Se(L,ae,(S,D,N)=>{const X=M[S];X&&(N.mergeTree(X),M[S]=null)}),M.find(S=>S)){const S=i.writeCursor(),D=i.writeCursor();let N=0,X=0;M.forEach(Z=>{Z!=null&&Se(i.readCursor(Z),null,te=>{const ge=Fe[te];S.writeMove(C[ge].getPath(),$[ge].getPath(),N++);const he=le[ge];he&&he.forEach(ce=>{p[ce]||A!==1&&K[ce]!=null||D.writeMove(k[ce].getPath(),g[ce].getPath(),X++)})})}),I={type:d.ConflictType.BLACKHOLE,op1:S.get(),op2:D.get()}}}}return I?{ok:!1,conflict:I}:{ok:!0,result:ae.get()}}const Ut=r=>{const u=new Error("Transform detected write conflict");throw u.conflict=r,u.type=u.name="writeConflict",u};function qt(r,u,y){const A=_t(r,u,y);if(A.ok)return A.result;Ut(A.conflict)}const Ze=r=>{const u=i.writeCursor();return i.readCursor(r).traverse(u,(y,A)=>{(o(y)||Ie(y))&&A.write("r",!0)}),u.get()},zt=(r,u)=>{const{type:y,op1:A,op2:I}=r;switch(y){case d.ConflictType.DROP_COLLISION:return u==="left"?[null,Ze(I)]:[Ze(A),null];case d.ConflictType.RM_UNEXPECTED_CONTENT:let C=!1;return i.readCursor(A).traverse(null,$=>{$.r!==void 0&&(C=!0)}),C?[null,Ze(I)]:[Ze(A),null];case d.ConflictType.BLACKHOLE:return[Ze(A),Ze(I)];default:throw Error("Unrecognised conflict: "+y)}};function Nt(r,u,y,A){let I=null;for(;;){const C=_t(u,y,A);if(C.ok)return ie(I,C.result);{const{conflict:$}=C;r($)||Ut($);const[k,g]=zt($,A);u=ie(x(u),k),y=ie(x(y),g),I=ie(I,g)}}}})(yt),function(n){var e=Ee&&Ee.__createBinding||(Object.create?function(d,l,a,E){E===void 0&&(E=a),Object.defineProperty(d,E,{enumerable:!0,get:function(){return l[a]}})}:function(d,l,a,E){E===void 0&&(E=a),d[E]=l[a]}),t=Ee&&Ee.__exportStar||function(d,l){for(var a in d)a!=="default"&&!l.hasOwnProperty(a)&&e(l,d,a)};Object.defineProperty(n,"__esModule",{value:!0}),t(yt,n);var s=at;Object.defineProperty(n,"ReadCursor",{enumerable:!0,get:function(){return s.ReadCursor}}),Object.defineProperty(n,"WriteCursor",{enumerable:!0,get:function(){return s.WriteCursor}});var i=ct;Object.defineProperty(n,"ConflictType",{enumerable:!0,get:function(){return i.ConflictType}})}(F);class Ct{constructor(){q(this,"drawingManagerData",{});q(this,"_oldDrawingManagerData",{});q(this,"_focusDrawings",[]);q(this,"_remove$",new re.Subject);q(this,"remove$",this._remove$.asObservable());q(this,"_add$",new re.Subject);q(this,"add$",this._add$.asObservable());q(this,"_update$",new re.Subject);q(this,"update$",this._update$.asObservable());q(this,"_order$",new re.Subject);q(this,"order$",this._order$.asObservable());q(this,"_group$",new re.Subject);q(this,"group$",this._group$.asObservable());q(this,"_ungroup$",new re.Subject);q(this,"ungroup$",this._ungroup$.asObservable());q(this,"_refreshTransform$",new re.Subject);q(this,"refreshTransform$",this._refreshTransform$.asObservable());q(this,"_visible$",new re.Subject);q(this,"visible$",this._visible$.asObservable());q(this,"_focus$",new re.Subject);q(this,"focus$",this._focus$.asObservable());q(this,"_featurePluginUpdate$",new re.Subject);q(this,"featurePluginUpdate$",this._featurePluginUpdate$.asObservable());q(this,"_featurePluginAdd$",new re.Subject);q(this,"featurePluginAdd$",this._featurePluginAdd$.asObservable());q(this,"_featurePluginRemove$",new re.Subject);q(this,"featurePluginRemove$",this._featurePluginRemove$.asObservable());q(this,"_featurePluginOrderUpdate$",new re.Subject);q(this,"featurePluginOrderUpdate$",this._featurePluginOrderUpdate$.asObservable());q(this,"_featurePluginGroupUpdate$",new re.Subject);q(this,"featurePluginGroupUpdate$",this._featurePluginGroupUpdate$.asObservable());q(this,"_featurePluginUngroupUpdate$",new re.Subject);q(this,"featurePluginUngroupUpdate$",this._featurePluginUngroupUpdate$.asObservable())}dispose(){this._remove$.complete(),this._add$.complete(),this._update$.complete(),this._order$.complete(),this._focus$.complete(),this._featurePluginUpdate$.complete(),this._featurePluginAdd$.complete(),this._featurePluginRemove$.complete(),this._featurePluginOrderUpdate$.complete(),this.drawingManagerData={},this._oldDrawingManagerData={}}visibleNotification(e){this._visible$.next(e)}refreshTransform(e){e.forEach(t=>{if(this.getDrawingByParam(t)==null)return;const i=this._getCurrentBySearch(t);i!=null&&(i.transform=t.transform)}),this.refreshTransformNotification(e)}getDrawingDataForUnit(e){return this.drawingManagerData[e]}removeDrawingDataForUnit(e){const t=this.drawingManagerData[e];if(t==null)return;delete this.drawingManagerData[e];const s=[];Object.keys(t).forEach(i=>{const d=t[i];(d==null?void 0:d.data)!=null&&Object.keys(d.data).forEach(l=>{s.push({unitId:e,subUnitId:i,drawingId:l})})}),s.length>0&&this.removeNotification(s)}registerDrawingData(e,t){this.drawingManagerData[e]=t;const s=[];Object.keys(t).forEach(i=>{this._establishDrawingMap(e,i);const d=t[i];Object.keys(d.data).forEach(l=>{const a=d.data[l];s.push(a)})}),s.length>0&&this.addNotification(s)}getDrawingData(e,t){return this._getDrawingData(e,t)}getBatchAddOp(e){const t=[],s=[],i=[];e.forEach(G=>{const{op:O,invertOp:o}=this._addByParam(G);t.push({unitId:G.unitId,subUnitId:G.subUnitId,drawingId:G.drawingId}),s.push(O),i.push(o)});const d=s.reduce(F.type.compose,null),l=i.reduce(F.type.compose,null),{unitId:a,subUnitId:E}=e[0];return{undo:l,redo:d,unitId:a,subUnitId:E,objects:t}}getBatchRemoveOp(e){const t=[],s=[];e.forEach(E=>{const{op:G,invertOp:O}=this._removeByParam(E);t.push(G),s.push(O)});const i=t.reduce(F.type.compose,null),d=s.reduce(F.type.compose,null),{unitId:l,subUnitId:a}=e[0];return{undo:d,redo:i,unitId:l,subUnitId:a,objects:e}}getBatchUpdateOp(e){const t=[],s=[],i=[];e.forEach(G=>{const{op:O,invertOp:o}=this._updateByParam(G);t.push({unitId:G.unitId,subUnitId:G.subUnitId,drawingId:G.drawingId}),s.push(O),i.push(o)});const d=s.reduce(F.type.compose,null),l=i.reduce(F.type.compose,null),{unitId:a,subUnitId:E}=e[0];return{undo:l,redo:d,unitId:a,subUnitId:E,objects:t}}removeNotification(e){this._remove$.next(e)}addNotification(e){this._add$.next(e)}updateNotification(e){this._update$.next(e)}orderNotification(e){this._order$.next(e)}groupUpdateNotification(e){this._group$.next(e)}ungroupUpdateNotification(e){this._ungroup$.next(e)}refreshTransformNotification(e){this._refreshTransform$.next(e)}getGroupDrawingOp(e){const t=[],{unitId:s,subUnitId:i}=e[0].parent;e.forEach(a=>{t.push(this._getGroupDrawingOp(a))});const d=t.reduce(F.type.compose,null);return{undo:F.type.invertWithDoc(d,this.drawingManagerData),redo:d,unitId:s,subUnitId:i,objects:e}}getUngroupDrawingOp(e){const t=[],{unitId:s,subUnitId:i}=e[0].parent;e.forEach(a=>{t.push(this._getUngroupDrawingOp(a))});const d=t.reduce(F.type.compose,null);return{undo:F.type.invertWithDoc(d,this.drawingManagerData),redo:d,unitId:s,subUnitId:i,objects:e}}getDrawingsByGroup(e){const{unitId:t,subUnitId:s,drawingId:i}=e;if(this.getDrawingByParam({unitId:t,subUnitId:s,drawingId:i})==null)return[];const l=this._getDrawingData(t,s),a=[];return Object.keys(l).forEach(E=>{const G=l[E];G.groupId===i&&a.push(G)}),a}_getGroupDrawingOp(e){const{parent:t,children:s}=e,{unitId:i,subUnitId:d,drawingId:l}=t,a=[];a.push(F.insertOp([i,d,"data",l],t));let E=Number.NEGATIVE_INFINITY;return s.forEach(G=>{const{unitId:O,subUnitId:o,drawingId:c}=G,h=this._hasDrawingOrder({unitId:O,subUnitId:o,drawingId:c});E=Math.max(E,h),a.push(...this._getUpdateParamCompareOp(G,this.getDrawingByParam({unitId:O,subUnitId:o,drawingId:c})))}),E===Number.NEGATIVE_INFINITY&&(E=this._getDrawingOrder(i,d).length),a.push(F.insertOp([i,d,"order",E],l)),a.reduce(F.type.compose,null)}_getUngroupDrawingOp(e){const{parent:t,children:s}=e,{unitId:i,subUnitId:d,drawingId:l}=t,a=[];return s.forEach(E=>{const{unitId:G,subUnitId:O,drawingId:o}=E;a.push(...this._getUpdateParamCompareOp(E,this.getDrawingByParam({unitId:G,subUnitId:O,drawingId:o})))}),a.push(F.removeOp([i,d,"data",l],!0)),a.push(F.removeOp([i,d,"order",this._getDrawingOrder(i,d).indexOf(l)],!0)),a.reduce(F.type.compose,null)}applyJson1(e,t,s){this._establishDrawingMap(e,t),this._oldDrawingManagerData={...this.drawingManagerData},this.drawingManagerData=F.type.apply(this.drawingManagerData,s)}featurePluginUpdateNotification(e){this._featurePluginUpdate$.next(e)}featurePluginOrderUpdateNotification(e){this._featurePluginOrderUpdate$.next(e)}featurePluginAddNotification(e){this._featurePluginAdd$.next(e)}featurePluginRemoveNotification(e){this._featurePluginRemove$.next(e)}featurePluginGroupUpdateNotification(e){this._featurePluginGroupUpdate$.next(e)}featurePluginUngroupUpdateNotification(e){this._featurePluginUngroupUpdate$.next(e)}getDrawingByParam(e){return this._getCurrentBySearch(e)}getOldDrawingByParam(e){return this._getOldBySearch(e)}getDrawingOKey(e){const[t,s,i]=e.split("#-#");return this._getCurrentBySearch({unitId:t,subUnitId:s,drawingId:i})}focusDrawing(e){if(e==null){this._focusDrawings=[],this._focus$.next([]);return}const t=[];e.forEach(s=>{var E;const{unitId:i,subUnitId:d,drawingId:l}=s,a=(E=this._getDrawingData(i,d))==null?void 0:E[l];a!=null&&t.push(a)}),t.length>0&&(this._focusDrawings=t,this._focus$.next(t))}getFocusDrawings(){const e=[];return this._focusDrawings.forEach(t=>{var a;const{unitId:s,subUnitId:i,drawingId:d}=t,l=(a=this._getDrawingData(s,i))==null?void 0:a[d];l!=null&&e.push(l)}),e}getDrawingOrder(e,t){return this._getDrawingOrder(e,t)}orderUpdateNotification(e){this._order$.next(e)}getForwardDrawingsOp(e){const{unitId:t,subUnitId:s,drawingIds:i}=e,d=[],l=this.getDrawingOrder(t,s),a=[...i];i.forEach(O=>{const o=this._hasDrawingOrder({unitId:t,subUnitId:s,drawingId:O});if(o===-1||o===l.length-1)return;const c=F.moveOp([t,s,"order",o],[t,s,"order",o+1]);d.push(c),a.includes(l[o+1])||a.push(l[o+1])});const E=d.reduce(F.type.compose,null);return{undo:F.type.invertWithDoc(E,this.drawingManagerData),redo:E,unitId:t,subUnitId:s,objects:{...e,drawingIds:a}}}getBackwardDrawingOp(e){const{unitId:t,subUnitId:s,drawingIds:i}=e,d=[],l=this.getDrawingOrder(t,s),a=[...i];i.forEach(O=>{const o=this._hasDrawingOrder({unitId:t,subUnitId:s,drawingId:O});if(o===-1||o===0)return;const c=F.moveOp([t,s,"order",o],[t,s,"order",o-1]);d.push(c),a.includes(l[o-1])||a.push(l[o-1])});const E=d.reduce(F.type.compose,null);return{undo:F.type.invertWithDoc(E,this.drawingManagerData),redo:E,unitId:t,subUnitId:s,objects:{...e,drawingIds:a}}}getFrontDrawingsOp(e){const{unitId:t,subUnitId:s,drawingIds:i}=e,d=this._getOrderFromSearchParams(t,s,i),l=[...i],a=this.getDrawingOrder(t,s),E=[];d.forEach(o=>{const{drawingId:c}=o,h=this._getDrawingCount(t,s)-1,T=F.moveOp([t,s,"order",this._getDrawingOrder(t,s).indexOf(c)],[t,s,"order",h]);E.push(T),l.includes(a[h])||l.push(a[h])});const G=E.reduce(F.type.compose,null);return{undo:F.type.invertWithDoc(G,this.drawingManagerData),redo:G,unitId:t,subUnitId:s,objects:{...e,drawingIds:l}}}getBackDrawingsOp(e){const{unitId:t,subUnitId:s,drawingIds:i}=e,d=this._getOrderFromSearchParams(t,s,i,!0),l=[...i],a=this.getDrawingOrder(t,s),E=[];d.forEach(o=>{const{drawingId:c}=o,h=F.moveOp([t,s,"order",this._getDrawingOrder(t,s).indexOf(c)],[t,s,"order",0]);E.push(h),l.includes(a[0])||l.push(a[0])});const G=E.reduce(F.type.compose,null);return{undo:F.type.invertWithDoc(G,this.drawingManagerData),redo:G,unitId:t,subUnitId:s,objects:{...e,drawingIds:l}}}_getDrawingCount(e,t){return this.getDrawingOrder(e,t).length||0}_getOrderFromSearchParams(e,t,s,i=!1){return s.map(d=>{const l=this._hasDrawingOrder({unitId:e,subUnitId:t,drawingId:d});return{drawingId:d,zIndex:l}}).sort(i===!1?Ue.sortRules:Ue.sortRulesByDesc)}_hasDrawingOrder(e){if(e==null)return-1;const{unitId:t,subUnitId:s,drawingId:i}=e;return this._establishDrawingMap(t,s),this._getDrawingOrder(t,s).indexOf(i)}_getCurrentBySearch(e){var d,l,a;if(e==null)return;const{unitId:t,subUnitId:s,drawingId:i}=e;return(a=(l=(d=this.drawingManagerData[t])==null?void 0:d[s])==null?void 0:l.data)==null?void 0:a[i]}_getOldBySearch(e){var d,l,a;if(e==null)return;const{unitId:t,subUnitId:s,drawingId:i}=e;return(a=(l=(d=this._oldDrawingManagerData[t])==null?void 0:d[s])==null?void 0:l.data)==null?void 0:a[i]}_establishDrawingMap(e,t,s){var i;return this.drawingManagerData[e]||(this.drawingManagerData[e]={}),this.drawingManagerData[e][t]||(this.drawingManagerData[e][t]={data:{},order:[]}),s==null?null:(i=this.drawingManagerData[e][t].data)==null?void 0:i[s]}_addByParam(e){const{unitId:t,subUnitId:s,drawingId:i}=e;this._establishDrawingMap(t,s,i);const d=F.insertOp([t,s,"data",i],e),l=F.insertOp([t,s,"order",this._getDrawingOrder(t,s).length],i),a=[d,l].reduce(F.type.compose,null),E=F.type.invertWithDoc(a,this.drawingManagerData);return{op:a,invertOp:E}}_removeByParam(e){if(e==null)return{op:[],invertOp:[]};const{unitId:t,subUnitId:s,drawingId:i}=e;if(this._establishDrawingMap(t,s,i)==null)return{op:[],invertOp:[]};const l=F.removeOp([t,s,"data",i],!0),a=F.removeOp([t,s,"order",this._getDrawingOrder(t,s).indexOf(i)],!0),E=[l,a].reduce(F.type.compose,null),G=F.type.invertWithDoc(E,this.drawingManagerData);return{op:E,invertOp:G}}_updateByParam(e){const{unitId:t,subUnitId:s,drawingId:i}=e,d=this._establishDrawingMap(t,s,i);if(d==null)return{op:[],invertOp:[]};const a=this._getUpdateParamCompareOp(e,d).reduce(F.type.compose,null),E=F.type.invertWithDoc(a,this.drawingManagerData);return{op:a,invertOp:E}}_getUpdateParamCompareOp(e,t){const{unitId:s,subUnitId:i,drawingId:d}=e,l=[];return Object.keys(e).forEach(a=>{const E=e[a],G=t[a];G!==E&&l.push(F.replaceOp([s,i,"data",d,a],G,E))}),l}_getDrawingData(e,t){var s,i;return((i=(s=this.drawingManagerData[e])==null?void 0:s[t])==null?void 0:i.data)||{}}_getDrawingOrder(e,t){var s,i;return((i=(s=this.drawingManagerData[e])==null?void 0:s[t])==null?void 0:i.order)||[]}}class Et extends Ct{}function Gt(n){const{unitId:e,subUnitId:t,drawingId:s}=n;return`${e}#-#${t}#-#${s}`}const Wt=async n=>new Promise((e,t)=>{const s=new Image;s.src=n,s.onload=()=>{e({width:s.width,height:s.height,image:s})},s.onerror=i=>{t(i)}});var Qe=(n=>(n.URL="URL",n.UUID="UUID",n.BASE64="BASE64",n))(Qe||{}),Xe=(n=>(n.SUCCUSS="0",n.ERROR_EXCEED_SIZE="1",n.ERROR_IMAGE_TYPE="2",n.ERROR_UPLOAD_COUNT_LIMIT="3",n.ERROR_IMAGE="4",n))(Xe||{});const At=tt.createIdentifier("core.image-io.service");class Dt{constructor(){q(this,"_waitCount",0);q(this,"_change$",new re.Subject);q(this,"change$",this._change$);q(this,"_imageSourceCache",new Map)}setWaitCount(e){this._waitCount=e,this._change$.next(e)}getImageSourceCache(e,t){if(t===Qe.BASE64){const s=new Image;return s.src=e,s}return this._imageSourceCache.get(e)}addImageSourceCache(e,t,s){t===Qe.BASE64||s==null||this._imageSourceCache.set(e,s)}async getImage(e){return Promise.resolve(e)}async saveImage(e){return new Promise((t,s)=>{if(!vt.includes(e.type)){s(new Error(Xe.ERROR_IMAGE_TYPE)),this._decreaseWaiting();return}if(e.size>5242880){s(new Error(Xe.ERROR_EXCEED_SIZE)),this._decreaseWaiting();return}const i=new FileReader;i.readAsDataURL(e),i.onload=d=>{var E;const l=(E=d.target)==null?void 0:E.result;if(l==null){s(new Error(Xe.ERROR_IMAGE)),this._decreaseWaiting();return}const a=Ue.Tools.generateRandomId(6);t({imageId:a,imageSourceType:Qe.BASE64,source:l,base64Cache:l,status:Xe.SUCCUSS}),this._decreaseWaiting()}})}_decreaseWaiting(){this._waitCount-=1,this._change$.next(this._waitCount)}}const Lt="__default_document_sub_component_id20231101__";var Pt=(n=>(n[n.forward=0]="forward",n[n.backward=1]="backward",n[n.front=2]="front",n[n.back=3]="back",n))(Pt||{}),Mt=(n=>(n[n.UNRECOGNIZED=-1]="UNRECOGNIZED",n[n.DRAWING_IMAGE=0]="DRAWING_IMAGE",n[n.DRAWING_SHAPE=1]="DRAWING_SHAPE",n[n.DRAWING_CHART=2]="DRAWING_CHART",n[n.DRAWING_TABLE=3]="DRAWING_TABLE",n[n.DRAWING_SMART_ART=4]="DRAWING_SMART_ART",n[n.DRAWING_VIDEO=5]="DRAWING_VIDEO",n[n.DRAWING_GROUP=6]="DRAWING_GROUP",n[n.DRAWING_UNIT=7]="DRAWING_UNIT",n[n.DRAWING_DOM=8]="DRAWING_DOM",n))(Mt||{});const St=tt.createIdentifier("univer.drawing-manager.service");var Bt=Object.defineProperty,Ht=Object.getOwnPropertyDescriptor,xt=(n,e,t,s)=>{for(var i=s>1?void 0:s?Ht(e,t):e,d=n.length-1,l;d>=0;d--)(l=n[d])&&(i=(s?l(e,t,i):l(i))||i);return s&&i&&Bt(e,t,i),i},Kt=(n,e)=>(t,s)=>e(t,s,n);const Ft="DRAWING_PLUGIN";Y.UniverDrawingPlugin=(gt=class extends Ue.Plugin{constructor(e,t){super(),this._config=e,this._injector=t}onStarting(e){this._initDependencies(e)}_initDependencies(e){var i;const t=[[At,{useClass:Dt}],[St,{useClass:Et}]];Ue.mergeOverrideWithDependencies(t,(i=this._config)==null?void 0:i.override).forEach(d=>e.add(d))}},q(gt,"pluginName",Ft),gt),Y.UniverDrawingPlugin=xt([Kt(1,tt.Inject(tt.Injector))],Y.UniverDrawingPlugin),Y.ArrangeTypeEnum=Pt,Y.DEFAULT_DOCUMENT_SUB_COMPONENT_ID=Lt,Y.DRAWING_IMAGE_ALLOW_IMAGE_LIST=vt,Y.DRAWING_IMAGE_ALLOW_SIZE=5242880,Y.DRAWING_IMAGE_COUNT_LIMIT=10,Y.DRAWING_IMAGE_HEIGHT_LIMIT=500,Y.DRAWING_IMAGE_WIDTH_LIMIT=500,Y.DrawingManagerService=Et,Y.DrawingTypeEnum=Mt,Y.IDrawingManagerService=St,Y.IImageIoService=At,Y.ImageIoService=Dt,Y.ImageSourceType=Qe,Y.ImageUploadStatusType=Xe,Y.UnitDrawingService=Ct,Y.getDrawingShapeKeyByDrawingSearch=Gt,Y.getImageSize=Wt,Object.defineProperty(Y,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@univerjs/drawing",
|
|
3
|
+
"version": "0.1.13",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "",
|
|
6
|
+
"author": "DreamNum <developer@univer.ai>",
|
|
7
|
+
"license": "Apache-2.0",
|
|
8
|
+
"funding": {
|
|
9
|
+
"type": "opencollective",
|
|
10
|
+
"url": "https://opencollective.com/univer"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://univer.ai",
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "https://github.com/dream-num/univer"
|
|
16
|
+
},
|
|
17
|
+
"bugs": {
|
|
18
|
+
"url": "https://github.com/dream-num/univer/issues"
|
|
19
|
+
},
|
|
20
|
+
"keywords": [],
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"import": "./lib/es/index.js",
|
|
24
|
+
"require": "./lib/cjs/index.js",
|
|
25
|
+
"types": "./lib/types/index.d.ts"
|
|
26
|
+
},
|
|
27
|
+
"./*": {
|
|
28
|
+
"import": "./lib/es/*",
|
|
29
|
+
"require": "./lib/cjs/*",
|
|
30
|
+
"types": "./lib/types/index.d.ts"
|
|
31
|
+
},
|
|
32
|
+
"./lib/*": "./lib/*"
|
|
33
|
+
},
|
|
34
|
+
"main": "./lib/cjs/index.js",
|
|
35
|
+
"module": "./lib/es/index.js",
|
|
36
|
+
"types": "./lib/types/index.d.ts",
|
|
37
|
+
"publishConfig": {
|
|
38
|
+
"access": "public"
|
|
39
|
+
},
|
|
40
|
+
"directories": {
|
|
41
|
+
"lib": "lib"
|
|
42
|
+
},
|
|
43
|
+
"files": [
|
|
44
|
+
"lib"
|
|
45
|
+
],
|
|
46
|
+
"engines": {
|
|
47
|
+
"node": ">=16.0.0",
|
|
48
|
+
"npm": ">=8.0.0"
|
|
49
|
+
},
|
|
50
|
+
"peerDependencies": {
|
|
51
|
+
"@wendellhu/redi": "0.15.2",
|
|
52
|
+
"rxjs": ">=7.0.0",
|
|
53
|
+
"@univerjs/core": "0.1.13"
|
|
54
|
+
},
|
|
55
|
+
"dependencies": {
|
|
56
|
+
"@univerjs/icons": "^0.1.55",
|
|
57
|
+
"ot-json1": "^1.0.2"
|
|
58
|
+
},
|
|
59
|
+
"devDependencies": {
|
|
60
|
+
"@wendellhu/redi": "0.15.2",
|
|
61
|
+
"less": "^4.2.0",
|
|
62
|
+
"ot-json1": "^1.0.2",
|
|
63
|
+
"react": "18.2.0",
|
|
64
|
+
"rxjs": "^7.8.1",
|
|
65
|
+
"typescript": "^5.4.5",
|
|
66
|
+
"vite": "^5.2.12",
|
|
67
|
+
"vitest": "^1.6.0",
|
|
68
|
+
"@univerjs/core": "0.1.13",
|
|
69
|
+
"@univerjs/shared": "0.1.13",
|
|
70
|
+
"@univerjs/ui": "0.1.13"
|
|
71
|
+
},
|
|
72
|
+
"scripts": {
|
|
73
|
+
"test": "vitest run",
|
|
74
|
+
"test:watch": "vitest",
|
|
75
|
+
"coverage": "vitest run --coverage",
|
|
76
|
+
"lint:types": "tsc --noEmit",
|
|
77
|
+
"build": "tsc && vite build"
|
|
78
|
+
}
|
|
79
|
+
}
|