@cloud-app-dev/vidc 4.0.20 → 4.0.22
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/es/AppContext/Sync.js +42 -0
- package/es/AppContext/index.js +141 -0
- package/es/AppContext/interface.d.ts +41 -0
- package/es/AppContext/static.js +9 -0
- package/es/Auth/index.js +14 -0
- package/es/AutoExit/index.js +19 -0
- package/es/CheckGroupFixed/demo.js +22 -0
- package/es/CheckGroupFixed/index.js +140 -0
- package/es/CheckGroupFixed/index.less +56 -0
- package/es/Config/index.js +77 -0
- package/es/Config/interface.d.ts +65 -0
- package/es/Config/utils.js +33 -0
- package/es/ConfigContext/index.js +21 -0
- package/es/CustomRenderSelect/index.js +72 -0
- package/es/CustomRenderSelect/index.less +25 -0
- package/es/DBTools/index.js +336 -0
- package/es/DisableMark/index.js +19 -0
- package/es/DisableMark/index.less +9 -0
- package/es/DomMove/demo.js +16 -0
- package/es/DomMove/index.js +139 -0
- package/es/DomMove/utils.js +32 -0
- package/es/Drag/DragAndDropItem.js +133 -0
- package/es/Drag/DropItem.js +50 -0
- package/es/Drag/index.d.ts +9 -0
- package/es/Drag/index.js +7 -0
- package/es/Drag/interface.d.ts +16 -0
- package/es/DynamicGridList/Demo.js +77 -0
- package/es/DynamicGridList/index.js +67 -0
- package/es/DynamicList/demo.js +44 -0
- package/es/DynamicList/index.js +86 -0
- package/es/DynamicList/index.less +17 -0
- package/es/DynamicList/interface.d.ts +19 -0
- package/es/DynamicList/utils.js +6 -0
- package/es/ErrorFallback/index.js +31 -0
- package/es/ErrorFallback/inerface.d.ts +48 -0
- package/es/EventTools/index.js +12 -0
- package/es/FrontendPlayer/index.js +2 -0
- package/es/FullScreen/index.js +33 -0
- package/es/FullScreen/index.less +18 -0
- package/es/GridList/Demo.js +80 -0
- package/es/GridList/data.js +609 -0
- package/es/GridList/hook.js +270 -0
- package/es/GridList/index.js +44 -0
- package/es/GridList/index.less +8 -0
- package/es/GridList/interface.d.ts +59 -0
- package/es/GridList/utils.js +42 -0
- package/es/HightLevel/index.js +18 -0
- package/es/HightLevel/index.less +3 -0
- package/es/IconFont/index.js +54 -0
- package/es/ImageView/index.js +51 -0
- package/es/ImageView/index.less +11 -0
- package/es/InstanceHistory/index.js +7 -0
- package/es/LabelPlayer/111.png +0 -0
- package/es/LabelPlayer/demo.js +115 -0
- package/es/LabelPlayer/index.js +160 -0
- package/es/LabelPlayer/index.less +24 -0
- package/es/LabelValue/index.js +27 -0
- package/es/LabelValue/index.less +23 -0
- package/es/List/demo.js +23 -0
- package/es/List/index.js +28 -0
- package/es/List/index.less +20 -0
- package/es/ListWithSizeAnimate/demo.js +98 -0
- package/es/ListWithSizeAnimate/index.js +85 -0
- package/es/ListWithSizeAnimate/index.less +23 -0
- package/es/LoaderScript/index.js +34 -0
- package/es/LoaderScript/utils.js +179 -0
- package/es/Map/AMap.d.ts +7109 -0
- package/es/Map/BasicMap/AMapInstance.js +98 -0
- package/es/Map/BasicMap/LeafletInstance.js +111 -0
- package/es/Map/BasicMap/index.js +90 -0
- package/es/Map/BasicMap/index.less +29 -0
- package/es/Map/ClusterLayer/demo.js +18 -0
- package/es/Map/ClusterLayer/hook.js +123 -0
- package/es/Map/ClusterLayer/index.js +28 -0
- package/es/Map/ClusterLayer/index.less +29 -0
- package/es/Map/ClusterLayer/props.d.ts +8 -0
- package/es/Map/Config/index.js +48 -0
- package/es/Map/Config/utils.js +65 -0
- package/es/Map/Context/index.js +51 -0
- package/es/Map/FindPio/index.js +13 -0
- package/es/Map/FindPio/index.less +7 -0
- package/es/Map/InfoWindow/MakerLikeWindow.js +108 -0
- package/es/Map/InfoWindow/demo.js +70 -0
- package/es/Map/InfoWindow/index.js +62 -0
- package/es/Map/LevelCenter/DragMarker/index.js +42 -0
- package/es/Map/LevelCenter/demo.js +38 -0
- package/es/Map/LevelCenter/index.js +66 -0
- package/es/Map/LoaderMap/index.js +62 -0
- package/es/Map/MapDrawSelect/demo.js +71 -0
- package/es/Map/MapDrawSelect/index.js +56 -0
- package/es/Map/MouseTool/index.js +40 -0
- package/es/Map/MouseTool/useMouseTools.js +83 -0
- package/es/Map/ResetTools/index.js +57 -0
- package/es/Map/ResetTools/index.less +39 -0
- package/es/Map/SinglePoint/demo.js +14 -0
- package/es/Map/SinglePoint/index.js +52 -0
- package/es/Map/SinglePoint/index.less +41 -0
- package/es/Map/hook/useMapEvent.js +19 -0
- package/es/Map/hook/useMapType.js +12 -0
- package/es/Map/icon.js +10 -0
- package/es/Map/index.js +25 -0
- package/es/Map/interface.d.ts +74 -0
- package/es/Map/points.js +1 -0
- package/es/Map/useMarker/index.js +71 -0
- package/es/Map/withMap/index.js +10 -0
- package/es/Picture/component/DefaultRects/RectInfo.js +80 -0
- package/es/Picture/component/DefaultRects/index.js +52 -0
- package/es/Picture/component/DefaultRects/index.less +211 -0
- package/es/Picture/component/DefaultRects/utils.js +11 -0
- package/es/Picture/component/DrawRect/index.js +46 -0
- package/es/Picture/component/DrawRect/index.less +8 -0
- package/es/Picture/component/RectMenu/index.js +76 -0
- package/es/Picture/component/RectMenu/index.less +36 -0
- package/es/Picture/component/RectMenu/utils.js +19 -0
- package/es/Picture/component/Tools/index.js +73 -0
- package/es/Picture/component/Tools/index.less +49 -0
- package/es/Picture/component/WheelScale/index.js +27 -0
- package/es/Picture/demo.js +105 -0
- package/es/Picture/index.js +341 -0
- package/es/Picture/index.less +20 -0
- package/es/Picture/interface.d.ts +196 -0
- package/es/Picture/loadCaptureRectImage.js +99 -0
- package/es/Picture/useDraw.js +103 -0
- package/es/Picture/utils.js +143 -0
- package/es/Player/api/index.js +309 -0
- package/es/Player/context.js +24 -0
- package/es/Player/contraller_bar/bar.js +20 -0
- package/es/Player/contraller_bar/contraller_event.js +48 -0
- package/es/Player/contraller_bar/index.js +27 -0
- package/es/Player/contraller_bar/left_bar.js +83 -0
- package/es/Player/contraller_bar/right_bar.js +32 -0
- package/es/Player/contraller_bar/time.js +19 -0
- package/es/Player/contraller_bar/useBarStatus.js +43 -0
- package/es/Player/contraller_bar/volume.js +62 -0
- package/es/Player/demo.js +266 -0
- package/es/Player/empty.js +4 -0
- package/es/Player/event/errorEvent.js +88 -0
- package/es/Player/event/eventName.js +29 -0
- package/es/Player/event/index.js +205 -0
- package/es/Player/fps_play.js +83 -0
- package/es/Player/frontend_player.js +64 -0
- package/es/Player/frontend_timeline.js +132 -0
- package/es/Player/iconfont.js +16 -0
- package/es/Player/index.js +2 -0
- package/es/Player/live_heart.js +45 -0
- package/es/Player/message.js +133 -0
- package/es/Player/player.d.ts +233 -0
- package/es/Player/segment_player.js +228 -0
- package/es/Player/segment_timeline.js +173 -0
- package/es/Player/single_player.js +262 -0
- package/es/Player/style/bar.less +43 -0
- package/es/Player/style/iconfont.js +43 -0
- package/es/Player/style/index.less +34 -0
- package/es/Player/style/message.less +56 -0
- package/es/Player/style/slider.less +106 -0
- package/es/Player/style/timeline.less +117 -0
- package/es/Player/style/volume.less +24 -0
- package/es/Player/timeline.js +95 -0
- package/es/Player/util.js +189 -0
- package/es/PlayerExt/demo.js +154 -0
- package/es/PlayerExt/index.js +188 -0
- package/es/PlayerExt/index.less +10 -0
- package/es/Progress/index.d.ts +9 -0
- package/es/Progress/index.js +53 -0
- package/es/Progress/index.less +21 -0
- package/es/ROI/demo.js +16 -0
- package/es/ROI/index.js +54 -0
- package/es/ROI/index.less +33 -0
- package/es/RefDrawer/Footer.js +22 -0
- package/es/RefDrawer/demo.js +18 -0
- package/es/RefDrawer/index.js +71 -0
- package/es/RefModal/demo.js +18 -0
- package/es/RefModal/index.js +70 -0
- package/es/ScreenPlayer/Live.js +212 -0
- package/es/ScreenPlayer/LiveTools.js +151 -0
- package/es/ScreenPlayer/PlayerWithExt.js +231 -0
- package/es/ScreenPlayer/RatePick.js +29 -0
- package/es/ScreenPlayer/Record.js +442 -0
- package/es/ScreenPlayer/RecordTools.js +169 -0
- package/es/ScreenPlayer/ScreenSelect.js +46 -0
- package/es/ScreenPlayer/SegmentTimeLine.js +36 -0
- package/es/ScreenPlayer/TimeMode.js +26 -0
- package/es/ScreenPlayer/TimeSelect.js +88 -0
- package/es/ScreenPlayer/demo.js +21 -0
- package/es/ScreenPlayer/demo2.js +194 -0
- package/es/ScreenPlayer/index.js +9 -0
- package/es/ScreenPlayer/index.less +335 -0
- package/es/ScreenPlayer/interface.d.ts +216 -0
- package/es/ScreenPlayer/useTimeSlider.js +456 -0
- package/es/ScreenPlayer/useVideoFit.js +35 -0
- package/es/ScreenPlayer/utils.js +85 -0
- package/es/SegmentPlayer/index.js +2 -0
- package/es/Service/http.js +133 -0
- package/es/Service/index.js +11 -0
- package/es/Service/interface.d.ts +23 -0
- package/es/Service/middleware.js +22 -0
- package/es/SocketEmitter/eventEmitter.js +88 -0
- package/es/SocketEmitter/index.js +125 -0
- package/es/SocketEmitter/interface.d.ts +4 -0
- package/es/TableLayout/index.js +27 -0
- package/es/TableLayout/index.less +4 -0
- package/es/ThemeAntd/demo.js +81 -0
- package/es/ThemeAntd/demo.less +20 -0
- package/es/ThemeAntd/index.js +21 -0
- package/es/ThemeAntd/index.less +4 -0
- package/es/Timeout/index.js +65 -0
- package/es/bigNumberTransformCN/index.js +58 -0
- package/es/cache/index.js +94 -0
- package/es/copy/index.js +9 -0
- package/es/core.d.ts +0 -0
- package/es/getThemeStyle/index.js +5 -0
- package/es/index.js +62 -0
- package/es/likeGo/index.js +31 -0
- package/es/likeGoSync/index.js +10 -0
- package/es/logger/index.js +30 -0
- package/es/nextTick/index.js +3 -0
- package/es/recorder/demo.js +181 -0
- package/es/recorder/index.js +992 -0
- package/es/submidstr/index.js +14 -0
- package/es/treeHelper/index.js +188 -0
- package/es/typings.d.ts +2 -0
- package/es/useDrawROI/index.js +318 -0
- package/es/useEventEmitterHandle/index.js +17 -0
- package/es/useFullscreen/demo.js +43 -0
- package/es/useFullscreen/index.js +76 -0
- package/es/useHistory/index.js +9 -0
- package/es/useHistory/interface.d.ts +3 -0
- package/es/useInfiniteScroll/index.js +102 -0
- package/es/useRafInterval/index.js +70 -0
- package/es/useSimpleState/index.js +35 -0
- package/es/useVirtualList/index.js +136 -0
- package/es/utils.js +46 -0
- package/es/uuid/index.js +19 -0
- package/package.json +2 -3
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
2
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
3
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
5
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
6
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
7
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
8
|
+
import { useScroll } from 'ahooks';
|
|
9
|
+
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
10
|
+
import { getColumnWidth, getElementOffset, getElementSize, getWindowScroll, getWindowSize, isSameElementScroll, isSameElementSize } from "./utils";
|
|
11
|
+
export function useConstRef(value) {
|
|
12
|
+
var ref = useRef(value);
|
|
13
|
+
ref.current = value;
|
|
14
|
+
return ref;
|
|
15
|
+
}
|
|
16
|
+
export function useWindowSize() {
|
|
17
|
+
var _useState = useState(function () {
|
|
18
|
+
return getWindowSize();
|
|
19
|
+
}),
|
|
20
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
21
|
+
windowSize = _useState2[0],
|
|
22
|
+
setWindowSize = _useState2[1];
|
|
23
|
+
var windowSizeRef = useConstRef(windowSize);
|
|
24
|
+
useEffect(function () {
|
|
25
|
+
function onResize() {
|
|
26
|
+
var nextWindowSize = getWindowSize();
|
|
27
|
+
if (!isSameElementSize(windowSizeRef.current, nextWindowSize)) {
|
|
28
|
+
setWindowSize(nextWindowSize);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
window.addEventListener('resize', onResize);
|
|
32
|
+
return function () {
|
|
33
|
+
return window.removeEventListener('resize', onResize);
|
|
34
|
+
};
|
|
35
|
+
}, [windowSizeRef]);
|
|
36
|
+
return windowSize;
|
|
37
|
+
}
|
|
38
|
+
export function useElementSize(ref) {
|
|
39
|
+
var _useState3 = useState(function () {
|
|
40
|
+
if (ref.current) {
|
|
41
|
+
return getElementSize(ref.current);
|
|
42
|
+
} else {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
}),
|
|
46
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
47
|
+
elementSize = _useState4[0],
|
|
48
|
+
setElementSize = _useState4[1];
|
|
49
|
+
var elementSizeRef = useConstRef(elementSize);
|
|
50
|
+
useEffect(function () {
|
|
51
|
+
var observer = new ResizeObserver(function (entries) {
|
|
52
|
+
var nextElementSize = getElementSize(entries[0].target);
|
|
53
|
+
if (elementSizeRef.current === null || !isSameElementSize(elementSizeRef.current, nextElementSize)) {
|
|
54
|
+
setElementSize(nextElementSize);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
if (ref.current) observer.observe(ref.current);
|
|
58
|
+
return function () {
|
|
59
|
+
return observer.disconnect();
|
|
60
|
+
};
|
|
61
|
+
}, [ref]);
|
|
62
|
+
return elementSize;
|
|
63
|
+
}
|
|
64
|
+
export function useWindowScroll() {
|
|
65
|
+
var _useState5 = useState(getWindowScroll()),
|
|
66
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
67
|
+
scrollPosition = _useState6[0],
|
|
68
|
+
setScrollPosition = _useState6[1];
|
|
69
|
+
var ref = useConstRef(scrollPosition);
|
|
70
|
+
useEffect(function () {
|
|
71
|
+
function update() {
|
|
72
|
+
var nextScrollPosition = getWindowScroll();
|
|
73
|
+
if (!isSameElementScroll(ref.current, nextScrollPosition)) {
|
|
74
|
+
setScrollPosition(nextScrollPosition);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
window.addEventListener('scroll', update);
|
|
78
|
+
window.addEventListener('resize', update);
|
|
79
|
+
return function () {
|
|
80
|
+
window.removeEventListener('scroll', update);
|
|
81
|
+
window.removeEventListener('resize', update);
|
|
82
|
+
};
|
|
83
|
+
}, [ref]);
|
|
84
|
+
return scrollPosition;
|
|
85
|
+
}
|
|
86
|
+
export function useElementWindowOffset(ref) {
|
|
87
|
+
var _useState7 = useState(function () {
|
|
88
|
+
if (ref.current) {
|
|
89
|
+
return getElementOffset(ref.current);
|
|
90
|
+
} else {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
}),
|
|
94
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
95
|
+
elementOffset = _useState8[0],
|
|
96
|
+
setElementOffset = _useState8[1];
|
|
97
|
+
useEffect(function () {
|
|
98
|
+
var observer = new ResizeObserver(function (entries) {
|
|
99
|
+
setElementOffset(getElementOffset(entries[0].target));
|
|
100
|
+
});
|
|
101
|
+
if (ref.current) observer.observe(ref.current);
|
|
102
|
+
return function () {
|
|
103
|
+
return observer.disconnect();
|
|
104
|
+
};
|
|
105
|
+
}, [ref]);
|
|
106
|
+
return elementOffset;
|
|
107
|
+
}
|
|
108
|
+
export function useIntersecting(ref, rootMargin) {
|
|
109
|
+
var _useState9 = useState(false),
|
|
110
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
111
|
+
intersecting = _useState10[0],
|
|
112
|
+
setIntersecting = _useState10[1];
|
|
113
|
+
useEffect(function () {
|
|
114
|
+
var observer = new IntersectionObserver(function (entries) {
|
|
115
|
+
setIntersecting(entries[0].isIntersecting);
|
|
116
|
+
}, {
|
|
117
|
+
rootMargin: rootMargin
|
|
118
|
+
});
|
|
119
|
+
if (ref.current) observer.observe(ref.current);
|
|
120
|
+
return function () {
|
|
121
|
+
return observer.disconnect();
|
|
122
|
+
};
|
|
123
|
+
}, [ref, rootMargin]);
|
|
124
|
+
return intersecting;
|
|
125
|
+
}
|
|
126
|
+
export function useGridListContainerData(ref) {
|
|
127
|
+
var windowSize = useWindowSize();
|
|
128
|
+
var windowScroll = useScroll(ref);
|
|
129
|
+
var elementWindowOffset = useElementWindowOffset(ref);
|
|
130
|
+
var elementSize = useElementSize(ref);
|
|
131
|
+
return useMemo(function () {
|
|
132
|
+
return {
|
|
133
|
+
windowSize: windowSize,
|
|
134
|
+
windowScroll: {
|
|
135
|
+
x: (windowScroll === null || windowScroll === void 0 ? void 0 : windowScroll.left) || 0,
|
|
136
|
+
y: (windowScroll === null || windowScroll === void 0 ? void 0 : windowScroll.top) || 0
|
|
137
|
+
},
|
|
138
|
+
elementWindowOffset: elementWindowOffset,
|
|
139
|
+
elementSize: elementSize
|
|
140
|
+
};
|
|
141
|
+
}, [windowSize, windowScroll, elementWindowOffset, elementSize]);
|
|
142
|
+
}
|
|
143
|
+
export function useGridListConfigData(containerData, props) {
|
|
144
|
+
var items = props.items,
|
|
145
|
+
getWindowMargin = props.getWindowMargin,
|
|
146
|
+
getGridGap = props.getGridGap,
|
|
147
|
+
getColumnCount = props.getColumnCount,
|
|
148
|
+
getItemData = props.getItemData;
|
|
149
|
+
var elementWidth = containerData.elementSize ? containerData.elementSize.width : null;
|
|
150
|
+
var windowMargin = useMemo(function () {
|
|
151
|
+
if (getWindowMargin) {
|
|
152
|
+
return getWindowMargin(containerData.windowSize.height);
|
|
153
|
+
} else {
|
|
154
|
+
return containerData.windowSize.height;
|
|
155
|
+
}
|
|
156
|
+
}, [containerData.windowSize.height, getWindowMargin]);
|
|
157
|
+
var gridGap = useMemo(function () {
|
|
158
|
+
if (elementWidth === null) return null;
|
|
159
|
+
if (getGridGap) {
|
|
160
|
+
return getGridGap(elementWidth, containerData.windowSize.height);
|
|
161
|
+
} else {
|
|
162
|
+
return 0;
|
|
163
|
+
}
|
|
164
|
+
}, [elementWidth, containerData.windowSize.height, getGridGap]);
|
|
165
|
+
var columnCount = useMemo(function () {
|
|
166
|
+
if (elementWidth === null) return null;
|
|
167
|
+
if (gridGap === null) return null;
|
|
168
|
+
return getColumnCount(elementWidth, gridGap);
|
|
169
|
+
}, [getColumnCount, elementWidth, gridGap]);
|
|
170
|
+
var columnWidth = getColumnWidth(columnCount, gridGap, elementWidth);
|
|
171
|
+
var entries = useMemo(function () {
|
|
172
|
+
if (columnWidth === null) return null;
|
|
173
|
+
var safeColumnWidth = columnWidth;
|
|
174
|
+
return items.map(function (item) {
|
|
175
|
+
return {
|
|
176
|
+
data: getItemData(item, safeColumnWidth),
|
|
177
|
+
item: item
|
|
178
|
+
};
|
|
179
|
+
});
|
|
180
|
+
}, [items, columnWidth, getItemData]);
|
|
181
|
+
return useMemo(function () {
|
|
182
|
+
if (windowMargin === null || gridGap === null || columnCount === null || entries === null) {
|
|
183
|
+
return null;
|
|
184
|
+
}
|
|
185
|
+
return {
|
|
186
|
+
windowMargin: windowMargin,
|
|
187
|
+
gridGap: gridGap,
|
|
188
|
+
columnCount: columnCount,
|
|
189
|
+
entries: entries
|
|
190
|
+
};
|
|
191
|
+
}, [windowMargin, gridGap, columnCount, entries]);
|
|
192
|
+
}
|
|
193
|
+
export function useGridListLayoutData(configData) {
|
|
194
|
+
return useMemo(function () {
|
|
195
|
+
if (configData === null) return null;
|
|
196
|
+
var currentRowNumber = 1;
|
|
197
|
+
var prevRowsTotalHeight = 0;
|
|
198
|
+
var currentRowMaxHeight = 0;
|
|
199
|
+
var cells = configData.entries.map(function (entry, index) {
|
|
200
|
+
var key = entry.data.key;
|
|
201
|
+
var columnNumber = index % configData.columnCount + 1;
|
|
202
|
+
var rowNumber = Math.floor(index / configData.columnCount) + 1;
|
|
203
|
+
if (rowNumber !== currentRowNumber) {
|
|
204
|
+
currentRowNumber = rowNumber;
|
|
205
|
+
prevRowsTotalHeight += currentRowMaxHeight + configData.gridGap;
|
|
206
|
+
currentRowMaxHeight = 0;
|
|
207
|
+
}
|
|
208
|
+
var offset = prevRowsTotalHeight;
|
|
209
|
+
var height = Math.round(entry.data.height);
|
|
210
|
+
var width = Math.round(entry.data.width);
|
|
211
|
+
currentRowMaxHeight = Math.max(currentRowMaxHeight, height);
|
|
212
|
+
return {
|
|
213
|
+
key: key,
|
|
214
|
+
columnNumber: columnNumber,
|
|
215
|
+
rowNumber: rowNumber,
|
|
216
|
+
offset: offset,
|
|
217
|
+
height: height,
|
|
218
|
+
width: width,
|
|
219
|
+
item: entry.item
|
|
220
|
+
};
|
|
221
|
+
});
|
|
222
|
+
var totalHeight = prevRowsTotalHeight + currentRowMaxHeight;
|
|
223
|
+
return {
|
|
224
|
+
totalHeight: totalHeight,
|
|
225
|
+
cells: cells
|
|
226
|
+
};
|
|
227
|
+
}, [configData]);
|
|
228
|
+
}
|
|
229
|
+
export function useGridListRenderData(containerData, configData, layoutData) {
|
|
230
|
+
return useMemo(function () {
|
|
231
|
+
if (layoutData === null || configData === null) return null;
|
|
232
|
+
var cellsToRender = [];
|
|
233
|
+
var firstRenderedRowNumber = null;
|
|
234
|
+
var firstRenderedRowOffset = null;
|
|
235
|
+
if (containerData.elementWindowOffset !== null) {
|
|
236
|
+
var elementWindowOffset = containerData.elementWindowOffset;
|
|
237
|
+
var _iterator = _createForOfIteratorHelper(layoutData.cells),
|
|
238
|
+
_step;
|
|
239
|
+
try {
|
|
240
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
241
|
+
var cell = _step.value;
|
|
242
|
+
var cellTop = elementWindowOffset + cell.offset;
|
|
243
|
+
var cellBottom = cellTop + cell.height;
|
|
244
|
+
var windowTop = containerData.windowScroll.y;
|
|
245
|
+
var windowBottom = windowTop + containerData.windowSize.height;
|
|
246
|
+
var renderTop = windowTop - configData.windowMargin;
|
|
247
|
+
var renderBottom = windowBottom + configData.windowMargin;
|
|
248
|
+
if (cellTop > renderBottom) continue;
|
|
249
|
+
if (cellBottom < renderTop) continue;
|
|
250
|
+
if (firstRenderedRowNumber === null) {
|
|
251
|
+
firstRenderedRowNumber = cell.rowNumber;
|
|
252
|
+
}
|
|
253
|
+
if (cell.rowNumber === firstRenderedRowNumber) {
|
|
254
|
+
firstRenderedRowOffset = firstRenderedRowOffset ? Math.min(firstRenderedRowOffset, cell.offset) : cell.offset;
|
|
255
|
+
}
|
|
256
|
+
cellsToRender.push(cell);
|
|
257
|
+
}
|
|
258
|
+
} catch (err) {
|
|
259
|
+
_iterator.e(err);
|
|
260
|
+
} finally {
|
|
261
|
+
_iterator.f();
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
return {
|
|
265
|
+
cellsToRender: cellsToRender,
|
|
266
|
+
firstRenderedRowNumber: firstRenderedRowNumber,
|
|
267
|
+
firstRenderedRowOffset: firstRenderedRowOffset
|
|
268
|
+
};
|
|
269
|
+
}, [layoutData, configData, containerData.windowScroll.y, containerData.windowSize.height, containerData.elementWindowOffset]);
|
|
270
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React, { useRef } from 'react';
|
|
2
|
+
import { useGridListConfigData, useGridListContainerData, useGridListLayoutData, useGridListRenderData, useIntersecting } from "./hook";
|
|
3
|
+
import { getGridRowStart } from "./utils";
|
|
4
|
+
import "./index.less";
|
|
5
|
+
var GridList = /*#__PURE__*/React.forwardRef(function GridList(props, ref) {
|
|
6
|
+
var containerRef = useRef(null);
|
|
7
|
+
var domRef = ref !== null && ref !== void 0 ? ref : containerRef;
|
|
8
|
+
var containerData = useGridListContainerData(domRef);
|
|
9
|
+
var configData = useGridListConfigData(containerData, props);
|
|
10
|
+
var layoutData = useGridListLayoutData(configData);
|
|
11
|
+
var renderData = useGridListRenderData(containerData, configData, layoutData);
|
|
12
|
+
var intersecting = useIntersecting(domRef, "".concat(configData !== null ? configData.windowMargin : 0, "px"));
|
|
13
|
+
var colWidth = props.fixedColumnWidth ? "".concat(props.fixedColumnWidth, "px") : '1fr';
|
|
14
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
15
|
+
ref: domRef,
|
|
16
|
+
className: "cloudapp-grid-list ".concat(props.className || '')
|
|
17
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
18
|
+
style: {
|
|
19
|
+
boxSizing: 'border-box',
|
|
20
|
+
height: layoutData !== null ? layoutData.totalHeight : undefined,
|
|
21
|
+
paddingTop: renderData !== null && renderData.firstRenderedRowOffset !== null ? renderData.firstRenderedRowOffset : 0
|
|
22
|
+
}
|
|
23
|
+
}, intersecting && /*#__PURE__*/React.createElement("div", {
|
|
24
|
+
style: {
|
|
25
|
+
display: 'grid',
|
|
26
|
+
gridTemplateColumns: configData !== null ? "repeat(".concat(configData.columnCount, ", ").concat(colWidth, ")") : undefined,
|
|
27
|
+
gridGap: configData ? configData.gridGap : undefined,
|
|
28
|
+
justifyContent: 'center',
|
|
29
|
+
alignItems: 'center'
|
|
30
|
+
}
|
|
31
|
+
}, renderData !== null && renderData.cellsToRender.map(function (cell) {
|
|
32
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
33
|
+
key: cell.key,
|
|
34
|
+
style: {
|
|
35
|
+
height: cell.height,
|
|
36
|
+
// maxWidth: cell.width,
|
|
37
|
+
width: '100%',
|
|
38
|
+
gridColumnStart: "".concat(cell.columnNumber),
|
|
39
|
+
gridRowStart: getGridRowStart(cell, renderData)
|
|
40
|
+
}
|
|
41
|
+
}, props.renderItem(cell.item, cell));
|
|
42
|
+
}))));
|
|
43
|
+
});
|
|
44
|
+
export default GridList;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { MutableRefObject } from 'react';
|
|
2
|
+
|
|
3
|
+
export type ConstRef<T> = Readonly<MutableRefObject<T>>;
|
|
4
|
+
|
|
5
|
+
export interface ElementSize {
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface ElementScroll {
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface GridListItemData {
|
|
16
|
+
key: string;
|
|
17
|
+
height: number;
|
|
18
|
+
width: number;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface GridListEntry<P> {
|
|
22
|
+
item: P;
|
|
23
|
+
data: GridListItemData;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface GridListConfigData<P> {
|
|
27
|
+
windowMargin: number;
|
|
28
|
+
gridGap: number;
|
|
29
|
+
columnCount: number;
|
|
30
|
+
entries: GridListEntry<P>[];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface GridListContainerData {
|
|
34
|
+
windowSize: ElementSize;
|
|
35
|
+
elementSize: ElementSize | null;
|
|
36
|
+
windowScroll: ElementScroll;
|
|
37
|
+
elementWindowOffset: number | null;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface GridListCell<P> {
|
|
41
|
+
key: string;
|
|
42
|
+
columnNumber: number;
|
|
43
|
+
rowNumber: number;
|
|
44
|
+
offset: number;
|
|
45
|
+
height: number;
|
|
46
|
+
width: number;
|
|
47
|
+
item: P;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface GridListLayoutData<P> {
|
|
51
|
+
totalHeight: number;
|
|
52
|
+
cells: GridListCell<P>[];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface GridListRenderData<P> {
|
|
56
|
+
cellsToRender: GridListCell<P>[];
|
|
57
|
+
firstRenderedRowNumber: number | null;
|
|
58
|
+
firstRenderedRowOffset: number | null;
|
|
59
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export function isSameElementSize(a, b) {
|
|
2
|
+
return a.width === b.width && a.height === b.height;
|
|
3
|
+
}
|
|
4
|
+
export function getWindowSize() {
|
|
5
|
+
return {
|
|
6
|
+
width: window.innerWidth,
|
|
7
|
+
height: window.innerHeight
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export function getElementSize(element) {
|
|
11
|
+
var rect = element.getBoundingClientRect();
|
|
12
|
+
return {
|
|
13
|
+
width: rect.width,
|
|
14
|
+
height: rect.height
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export function isSameElementScroll(a, b) {
|
|
18
|
+
return a.x === b.x && a.y === b.y;
|
|
19
|
+
}
|
|
20
|
+
export function getWindowScroll() {
|
|
21
|
+
return {
|
|
22
|
+
x: window.scrollX,
|
|
23
|
+
y: window.scrollY
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export function getElementOffset(element) {
|
|
27
|
+
return window.scrollY + element.getBoundingClientRect().top;
|
|
28
|
+
}
|
|
29
|
+
export function getColumnWidth(columnCount, gridGap, elementWidth) {
|
|
30
|
+
if (columnCount === null || gridGap === null || elementWidth === null) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
var totalGapSpace = (columnCount - 1) * gridGap;
|
|
34
|
+
var columnWidth = Math.round((elementWidth - totalGapSpace) / columnCount);
|
|
35
|
+
return columnWidth;
|
|
36
|
+
}
|
|
37
|
+
export function getGridRowStart(cell, renderData) {
|
|
38
|
+
if (renderData === null) return undefined;
|
|
39
|
+
var offset = renderData.firstRenderedRowNumber !== null ? renderData.firstRenderedRowNumber - 1 : 0;
|
|
40
|
+
var gridRowStart = cell.rowNumber - offset;
|
|
41
|
+
return "".concat(gridRowStart);
|
|
42
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { replace, escapeRegExp } from 'lodash-es';
|
|
3
|
+
import "./index.less";
|
|
4
|
+
function HighLevel(_ref) {
|
|
5
|
+
var keyword = _ref.keyword,
|
|
6
|
+
name = _ref.name;
|
|
7
|
+
if (!keyword) {
|
|
8
|
+
return /*#__PURE__*/React.createElement("span", null, name);
|
|
9
|
+
}
|
|
10
|
+
var reg = new RegExp(escapeRegExp(keyword), 'g');
|
|
11
|
+
var html = replace(name, reg, "<span class=\"high-level\">".concat(keyword, "</span>"));
|
|
12
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
13
|
+
dangerouslySetInnerHTML: {
|
|
14
|
+
__html: html
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
export default /*#__PURE__*/React.memo(HighLevel);
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
var _excluded = ["type", "className", "title", "style"];
|
|
2
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
4
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
5
|
+
import React from 'react';
|
|
6
|
+
var global = window;
|
|
7
|
+
if (!global._ICON_SCRIPT_URL) {
|
|
8
|
+
global._ICON_SCRIPT_URL = {};
|
|
9
|
+
}
|
|
10
|
+
function loadScript(url) {
|
|
11
|
+
return new Promise(function (resolve, reject) {
|
|
12
|
+
var script = document.createElement('script');
|
|
13
|
+
script.src = url;
|
|
14
|
+
document.body.appendChild(script);
|
|
15
|
+
script.addEventListener('load', function () {
|
|
16
|
+
resolve(null);
|
|
17
|
+
});
|
|
18
|
+
script.addEventListener('error', function (err) {
|
|
19
|
+
reject(err);
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
function registerIconFont(scriptUrl) {
|
|
24
|
+
if (!global._ICON_SCRIPT_URL[scriptUrl]) {
|
|
25
|
+
global._ICON_SCRIPT_URL[scriptUrl] = true;
|
|
26
|
+
loadScript(scriptUrl).catch(function (e) {
|
|
27
|
+
global._ICON_SCRIPT_URL[scriptUrl] = false;
|
|
28
|
+
console.error(e);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function IconFont(_ref) {
|
|
33
|
+
var type = _ref.type,
|
|
34
|
+
_ref$className = _ref.className,
|
|
35
|
+
className = _ref$className === void 0 ? '' : _ref$className,
|
|
36
|
+
title = _ref.title,
|
|
37
|
+
style = _ref.style,
|
|
38
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
39
|
+
return /*#__PURE__*/React.createElement("i", _extends({
|
|
40
|
+
className: "anticon ".concat(className),
|
|
41
|
+
title: title,
|
|
42
|
+
style: style
|
|
43
|
+
}, props), /*#__PURE__*/React.createElement("svg", {
|
|
44
|
+
width: "1em",
|
|
45
|
+
height: "1em",
|
|
46
|
+
fill: "currentColor",
|
|
47
|
+
"aria-hidden": "true",
|
|
48
|
+
focusable: "false"
|
|
49
|
+
}, /*#__PURE__*/React.createElement("use", {
|
|
50
|
+
xlinkHref: "#".concat(type)
|
|
51
|
+
})));
|
|
52
|
+
}
|
|
53
|
+
IconFont.registerIconFont = registerIconFont;
|
|
54
|
+
export default IconFont;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
var _excluded = ["src", "defaultSrc", "alt", "onError", "className"];
|
|
2
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
5
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
7
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
8
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
9
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
10
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
11
|
+
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
12
|
+
import "./index.less";
|
|
13
|
+
var defaultUrl = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAAAXNSR0IArs4c6QAAFmxJREFUeF7tXQvQdlVVfp6pAQwor6VZigQC8nNREYVMRYEQCgHl+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PsAmCDhBmqDnbUePgBNk9CH2ATZB4H8BgW8+XwSELpsAAAAASUVORK5CYII=';
|
|
14
|
+
function ImageView(_ref) {
|
|
15
|
+
var src = _ref.src,
|
|
16
|
+
_ref$defaultSrc = _ref.defaultSrc,
|
|
17
|
+
defaultSrc = _ref$defaultSrc === void 0 ? defaultUrl : _ref$defaultSrc,
|
|
18
|
+
alt = _ref.alt,
|
|
19
|
+
onError = _ref.onError,
|
|
20
|
+
_ref$className = _ref.className,
|
|
21
|
+
className = _ref$className === void 0 ? '' : _ref$className,
|
|
22
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
23
|
+
var _useState = useState(!src),
|
|
24
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
25
|
+
isError = _useState2[0],
|
|
26
|
+
setErrorStatus = _useState2[1];
|
|
27
|
+
var imgKey = useRef(Math.random());
|
|
28
|
+
var isErr = useMemo(function () {
|
|
29
|
+
return isError || !src;
|
|
30
|
+
}, [isError, src]);
|
|
31
|
+
var imgSrc = useMemo(function () {
|
|
32
|
+
return isErr ? defaultSrc : src;
|
|
33
|
+
}, [defaultSrc, isErr, src]);
|
|
34
|
+
useEffect(function () {
|
|
35
|
+
imgKey.current = Math.random();
|
|
36
|
+
setErrorStatus(null);
|
|
37
|
+
}, [src]);
|
|
38
|
+
function onImageError(e) {
|
|
39
|
+
setErrorStatus(true);
|
|
40
|
+
onError === null || onError === void 0 || onError(e);
|
|
41
|
+
}
|
|
42
|
+
return /*#__PURE__*/React.createElement("img", _extends({}, props, {
|
|
43
|
+
className: "lm-t-c-image-card ".concat(isErr ? 'lm-t-c-image-card-placeholder' : '', " ").concat(className),
|
|
44
|
+
key: imgKey.current,
|
|
45
|
+
"data-src": src,
|
|
46
|
+
src: imgSrc,
|
|
47
|
+
alt: alt,
|
|
48
|
+
onError: onImageError
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
51
|
+
export default ImageView;
|
|
Binary file
|