@daoyi/nmtl-ui 2.0.1-beta.8 → 2.0.1-beta.80
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/lib/components/Autocomplete-cf913b25.js +423 -0
- package/lib/components/Autocomplete.js +19 -1
- package/lib/components/Avatar.js +53 -1
- package/lib/components/BackTop.js +109 -1
- package/lib/components/BarChart.js +762 -1
- package/lib/components/Breadcrumbs.js +122 -1
- package/lib/components/Button-611f1770.js +92 -0
- package/lib/components/Button.js +6 -1
- package/lib/components/Carousel.js +4654 -1
- package/lib/components/Checkbox.js +37 -1
- package/lib/components/CollapseContent.js +179 -1
- package/lib/components/ContactModal-0a4c67b8.js +12020 -0
- package/lib/components/ContactModal.js +22 -3
- package/lib/components/Drawer-55c0f66f.js +156 -0
- package/lib/components/Drawer.js +11 -1
- package/lib/components/Dropdown.js +134 -1
- package/lib/components/Empty-67b4d7d7.js +45 -0
- package/lib/components/Empty.js +5 -1
- package/lib/components/ExportButton.js +112 -1
- package/lib/components/ExtraTools-e4f085bc.js +3537 -0
- package/lib/components/ExtraTools.js +10 -22
- package/lib/components/Filter.js +782 -12
- package/lib/components/Footer.js +271 -1
- package/lib/components/ForwardLink-edab5061.js +106 -0
- package/lib/components/ForwardLink.js +8 -0
- package/lib/components/Header.js +194 -1
- package/lib/components/Image.js +61 -1
- package/lib/components/Input.js +82 -1
- package/lib/components/InputMethod.js +33949 -12
- package/lib/components/KeywordSearch-0b5681d9.js +144 -0
- package/lib/components/KeywordSearch.js +21 -1
- package/lib/components/KeywordTicker.js +190 -1
- package/lib/components/Keywords.js +317 -1
- package/lib/components/Loading.js +28 -1
- package/lib/components/MUITheme.js +2624 -1
- package/lib/components/Modal-c33b7a7f.js +108 -0
- package/lib/components/Modal.js +9 -1
- package/lib/components/MoreButton-b2306abb.js +110 -0
- package/lib/components/MoreButton.js +6 -1
- package/lib/components/Pagination.js +3637 -0
- package/lib/components/Radio.js +78 -1
- package/lib/components/SNA.js +1691 -22
- package/lib/components/Select-9a745e5c.js +115 -0
- package/lib/components/Select.js +8 -1
- package/lib/components/Spin-96bc2c76.js +75 -0
- package/lib/components/Spin.js +6 -1
- package/lib/components/Table.js +51 -1
- package/lib/components/Tooltip-123cc349.js +70 -0
- package/lib/components/Tooltip.js +7 -1
- package/lib/components/_commonjsHelpers-70de2c37.js +28 -0
- package/lib/components/_rollupPluginBabelHelpers-a52356f6.js +142 -0
- package/lib/components/createSvgIcon-ad1104bb.js +576 -0
- package/lib/components/dataExport-04b77185.js +93 -0
- package/lib/components/debounce-127da66c.js +355 -0
- package/lib/components/defaultTheme-ed7746fe.js +1661 -0
- package/lib/components/globalConfig.js +175 -0
- package/lib/components/hoist-non-react-statics.cjs-3f408ad2.js +105 -0
- package/lib/components/index-848f4409.js +61 -0
- package/lib/components/index-983dcd15.js +481 -0
- package/lib/components/isObjectLike-e111475d.js +190 -0
- package/lib/components/style-inject.es-1f59c1d0.js +28 -1
- package/lib/components/toConsumableArray-dbe8af76.js +19 -0
- package/lib/components/transform-3a04288b.js +5475 -0
- package/lib/components/withTheme-2d778133.js +6 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +2 -0
- package/lib/utils/_rollupPluginBabelHelpers-8dd26e1a.js +121 -0
- package/lib/utils/arrayMerge.js +4953 -1
- package/lib/utils/chunkArray.js +15 -1
- package/lib/utils/convert2HtmlEntities.js +42 -1
- package/lib/utils/domToImage.js +802 -1
- package/lib/utils/downloadGephi.js +106 -1
- package/lib/utils/exportXlsx.js +219 -1
- package/lib/utils/historyAppendSearch.js +502 -1
- package/lib/utils/isDevelopMode.js +5 -1
- package/lib/utils/parseYMD.js +36 -1
- package/lib/utils/removeDuplicateItem.js +11 -1
- package/lib/utils/sendEmail.js +39 -1
- package/lib/utils/snaDefine-6a2bcd94.js +5 -0
- package/lib/utils/snaDefine.js +1 -1
- package/lib/utils/snaPreProcess.js +84 -1
- package/package.json +17 -21
- package/lib/components/Empty-54b79907.js +0 -1
- package/lib/components/KeywordSearch-5a393f12.js +0 -1
- package/lib/components/Select-f2441b83.js +0 -1
- package/lib/components/_rollupPluginBabelHelpers-1b8c042f.js +0 -1
- package/lib/components/_rollupPluginBabelHelpers-ec4e2a53.js +0 -1
- package/lib/components/createSvgIcon-62b64929.js +0 -1
- package/lib/components/createSvgIcon-e24792d4.js +0 -1
- package/lib/components/createTheme-7fffa109.js +0 -1
- package/lib/components/dataExport-9fccd4f0.js +0 -1
- package/lib/components/debounce-c993109b.js +0 -1
- package/lib/components/hoist-non-react-statics.cjs-d6a9befd.js +0 -1
- package/lib/components/index-11391ca3.js +0 -7
- package/lib/components/index-b2745105.js +0 -7
- package/lib/components/isObjectLike-2f1983fe.js +0 -1
- package/lib/components/style-inject.es-c875d022.js +0 -1
- package/lib/components/transform-0eb2d36e.js +0 -1
- package/lib/utils/_commonjsHelpers-e2cda605.js +0 -1
- package/lib/utils/_rollupPluginBabelHelpers-928a52ce.js +0 -1
|
@@ -0,0 +1,3537 @@
|
|
|
1
|
+
import { _ as _extends } from './_rollupPluginBabelHelpers-a52356f6.js';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import React__default, { Component, forwardRef, useState } from 'react';
|
|
4
|
+
import { c as classNames } from './index-848f4409.js';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
import { a as getDefaultExportFromCjs } from './_commonjsHelpers-70de2c37.js';
|
|
7
|
+
import { Menu, MenuItem, useMediaQuery, IconButton } from '@material-ui/core';
|
|
8
|
+
import { T as Tooltip } from './Tooltip-123cc349.js';
|
|
9
|
+
import { s as snaToExcel, f as fileDownload$1, a as jsonExcel } from './dataExport-04b77185.js';
|
|
10
|
+
import { s as styleInject } from './style-inject.es-1f59c1d0.js';
|
|
11
|
+
|
|
12
|
+
var __assign$3 = (undefined && undefined.__assign) || function () {
|
|
13
|
+
__assign$3 = Object.assign || function(t) {
|
|
14
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
15
|
+
s = arguments[i];
|
|
16
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
17
|
+
t[p] = s[p];
|
|
18
|
+
}
|
|
19
|
+
return t;
|
|
20
|
+
};
|
|
21
|
+
return __assign$3.apply(this, arguments);
|
|
22
|
+
};
|
|
23
|
+
var __rest$2 = (undefined && undefined.__rest) || function (s, e) {
|
|
24
|
+
var t = {};
|
|
25
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
26
|
+
t[p] = s[p];
|
|
27
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
28
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
29
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
30
|
+
t[p[i]] = s[p[i]];
|
|
31
|
+
}
|
|
32
|
+
return t;
|
|
33
|
+
};
|
|
34
|
+
function createIcon(iconConfig) {
|
|
35
|
+
var Icon = function (_a) {
|
|
36
|
+
var bgStyle = _a.bgStyle, borderRadius = _a.borderRadius, iconFillColor = _a.iconFillColor, round = _a.round, size = _a.size, rest = __rest$2(_a, ["bgStyle", "borderRadius", "iconFillColor", "round", "size"]);
|
|
37
|
+
return (React__default.createElement("svg", __assign$3({ viewBox: "0 0 64 64", width: size, height: size }, rest),
|
|
38
|
+
round ? (React__default.createElement("circle", { cx: "32", cy: "32", r: "31", fill: iconConfig.color, style: bgStyle })) : (React__default.createElement("rect", { width: "64", height: "64", rx: borderRadius, ry: borderRadius, fill: iconConfig.color, style: bgStyle })),
|
|
39
|
+
React__default.createElement("path", { d: iconConfig.path, fill: iconFillColor })));
|
|
40
|
+
};
|
|
41
|
+
Icon.defaultProps = {
|
|
42
|
+
bgStyle: {},
|
|
43
|
+
borderRadius: 0,
|
|
44
|
+
iconFillColor: 'white',
|
|
45
|
+
size: 64,
|
|
46
|
+
};
|
|
47
|
+
return Icon;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
createIcon({
|
|
51
|
+
color: '#7f7f7f',
|
|
52
|
+
networkName: 'email',
|
|
53
|
+
path: 'M17,22v20h30V22H17z M41.1,25L32,32.1L22.9,25H41.1z M20,39V26.6l12,9.3l12-9.3V39H20z',
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
function objectToGetParams(object) {
|
|
57
|
+
var params = Object.entries(object)
|
|
58
|
+
.filter(function (_a) {
|
|
59
|
+
var value = _a[1];
|
|
60
|
+
return value !== undefined && value !== null;
|
|
61
|
+
})
|
|
62
|
+
.map(function (_a) {
|
|
63
|
+
var key = _a[0], value = _a[1];
|
|
64
|
+
return encodeURIComponent(key) + "=" + encodeURIComponent(String(value));
|
|
65
|
+
});
|
|
66
|
+
return params.length > 0 ? "?" + params.join('&') : '';
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
var __extends$2 = (undefined && undefined.__extends) || (function () {
|
|
70
|
+
var extendStatics = function (d, b) {
|
|
71
|
+
extendStatics = Object.setPrototypeOf ||
|
|
72
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
73
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
74
|
+
return extendStatics(d, b);
|
|
75
|
+
};
|
|
76
|
+
return function (d, b) {
|
|
77
|
+
extendStatics(d, b);
|
|
78
|
+
function __() { this.constructor = d; }
|
|
79
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
80
|
+
};
|
|
81
|
+
})();
|
|
82
|
+
var __assign$2 = (undefined && undefined.__assign) || function () {
|
|
83
|
+
__assign$2 = Object.assign || function(t) {
|
|
84
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
85
|
+
s = arguments[i];
|
|
86
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
87
|
+
t[p] = s[p];
|
|
88
|
+
}
|
|
89
|
+
return t;
|
|
90
|
+
};
|
|
91
|
+
return __assign$2.apply(this, arguments);
|
|
92
|
+
};
|
|
93
|
+
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
94
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
95
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
96
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
97
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
98
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
99
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
var __generator = (undefined && undefined.__generator) || function (thisArg, body) {
|
|
103
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
104
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
105
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
106
|
+
function step(op) {
|
|
107
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
108
|
+
while (_) try {
|
|
109
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
110
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
111
|
+
switch (op[0]) {
|
|
112
|
+
case 0: case 1: t = op; break;
|
|
113
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
114
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
115
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
116
|
+
default:
|
|
117
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
118
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
119
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
120
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
121
|
+
if (t[2]) _.ops.pop();
|
|
122
|
+
_.trys.pop(); continue;
|
|
123
|
+
}
|
|
124
|
+
op = body.call(thisArg, _);
|
|
125
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
126
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
var __rest$1 = (undefined && undefined.__rest) || function (s, e) {
|
|
130
|
+
var t = {};
|
|
131
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
132
|
+
t[p] = s[p];
|
|
133
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
134
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
135
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
136
|
+
t[p[i]] = s[p[i]];
|
|
137
|
+
}
|
|
138
|
+
return t;
|
|
139
|
+
};
|
|
140
|
+
var isPromise = function (obj) {
|
|
141
|
+
return !!obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function';
|
|
142
|
+
};
|
|
143
|
+
var getBoxPositionOnWindowCenter = function (width, height) { return ({
|
|
144
|
+
left: window.outerWidth / 2 + (window.screenX || window.screenLeft || 0) - width / 2,
|
|
145
|
+
top: window.outerHeight / 2 + (window.screenY || window.screenTop || 0) - height / 2,
|
|
146
|
+
}); };
|
|
147
|
+
var getBoxPositionOnScreenCenter = function (width, height) { return ({
|
|
148
|
+
top: (window.screen.height - height) / 2,
|
|
149
|
+
left: (window.screen.width - width) / 2,
|
|
150
|
+
}); };
|
|
151
|
+
function windowOpen(url, _a, onClose) {
|
|
152
|
+
var height = _a.height, width = _a.width, configRest = __rest$1(_a, ["height", "width"]);
|
|
153
|
+
var config = __assign$2({ height: height,
|
|
154
|
+
width: width, location: 'no', toolbar: 'no', status: 'no', directories: 'no', menubar: 'no', scrollbars: 'yes', resizable: 'no', centerscreen: 'yes', chrome: 'yes' }, configRest);
|
|
155
|
+
var shareDialog = window.open(url, '', Object.keys(config)
|
|
156
|
+
.map(function (key) { return key + "=" + config[key]; })
|
|
157
|
+
.join(', '));
|
|
158
|
+
if (onClose) {
|
|
159
|
+
var interval_1 = window.setInterval(function () {
|
|
160
|
+
try {
|
|
161
|
+
if (shareDialog === null || shareDialog.closed) {
|
|
162
|
+
window.clearInterval(interval_1);
|
|
163
|
+
onClose(shareDialog);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
catch (e) {
|
|
167
|
+
/* eslint-disable no-console */
|
|
168
|
+
console.error(e);
|
|
169
|
+
/* eslint-enable no-console */
|
|
170
|
+
}
|
|
171
|
+
}, 1000);
|
|
172
|
+
}
|
|
173
|
+
return shareDialog;
|
|
174
|
+
}
|
|
175
|
+
var ShareButton$1 = /** @class */ (function (_super) {
|
|
176
|
+
__extends$2(ShareButton, _super);
|
|
177
|
+
function ShareButton() {
|
|
178
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
179
|
+
_this.openShareDialog = function (link) {
|
|
180
|
+
var _a = _this.props, onShareWindowClose = _a.onShareWindowClose, _b = _a.windowHeight, windowHeight = _b === void 0 ? 400 : _b, _c = _a.windowPosition, windowPosition = _c === void 0 ? 'windowCenter' : _c, _d = _a.windowWidth, windowWidth = _d === void 0 ? 550 : _d;
|
|
181
|
+
var windowConfig = __assign$2({ height: windowHeight, width: windowWidth }, (windowPosition === 'windowCenter'
|
|
182
|
+
? getBoxPositionOnWindowCenter(windowWidth, windowHeight)
|
|
183
|
+
: getBoxPositionOnScreenCenter(windowWidth, windowHeight)));
|
|
184
|
+
windowOpen(link, windowConfig, onShareWindowClose);
|
|
185
|
+
};
|
|
186
|
+
_this.handleClick = function (event) { return __awaiter(_this, void 0, void 0, function () {
|
|
187
|
+
var _a, beforeOnClick, disabled, networkLink, onClick, url, openShareDialogOnClick, opts, link, returnVal;
|
|
188
|
+
return __generator(this, function (_b) {
|
|
189
|
+
switch (_b.label) {
|
|
190
|
+
case 0:
|
|
191
|
+
_a = this.props, beforeOnClick = _a.beforeOnClick, disabled = _a.disabled, networkLink = _a.networkLink, onClick = _a.onClick, url = _a.url, openShareDialogOnClick = _a.openShareDialogOnClick, opts = _a.opts;
|
|
192
|
+
link = networkLink(url, opts);
|
|
193
|
+
if (disabled) {
|
|
194
|
+
return [2 /*return*/];
|
|
195
|
+
}
|
|
196
|
+
event.preventDefault();
|
|
197
|
+
if (!beforeOnClick) return [3 /*break*/, 2];
|
|
198
|
+
returnVal = beforeOnClick();
|
|
199
|
+
if (!isPromise(returnVal)) return [3 /*break*/, 2];
|
|
200
|
+
return [4 /*yield*/, returnVal];
|
|
201
|
+
case 1:
|
|
202
|
+
_b.sent();
|
|
203
|
+
_b.label = 2;
|
|
204
|
+
case 2:
|
|
205
|
+
if (openShareDialogOnClick) {
|
|
206
|
+
this.openShareDialog(link);
|
|
207
|
+
}
|
|
208
|
+
if (onClick) {
|
|
209
|
+
onClick(event, link);
|
|
210
|
+
}
|
|
211
|
+
return [2 /*return*/];
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
}); };
|
|
215
|
+
return _this;
|
|
216
|
+
}
|
|
217
|
+
ShareButton.prototype.render = function () {
|
|
218
|
+
var _a = this.props; _a.beforeOnClick; var children = _a.children, className = _a.className, disabled = _a.disabled, disabledStyle = _a.disabledStyle, forwardedRef = _a.forwardedRef; _a.networkLink; var networkName = _a.networkName; _a.onShareWindowClose; _a.openShareDialogOnClick; _a.opts; var resetButtonStyle = _a.resetButtonStyle, style = _a.style; _a.url; _a.windowHeight; _a.windowPosition; _a.windowWidth; var rest = __rest$1(_a, ["beforeOnClick", "children", "className", "disabled", "disabledStyle", "forwardedRef", "networkLink", "networkName", "onShareWindowClose", "openShareDialogOnClick", "opts", "resetButtonStyle", "style", "url", "windowHeight", "windowPosition", "windowWidth"]);
|
|
219
|
+
var newClassName = classNames('react-share__ShareButton', {
|
|
220
|
+
'react-share__ShareButton--disabled': !!disabled,
|
|
221
|
+
disabled: !!disabled,
|
|
222
|
+
}, className);
|
|
223
|
+
var newStyle = resetButtonStyle
|
|
224
|
+
? __assign$2(__assign$2({ backgroundColor: 'transparent', border: 'none', padding: 0, font: 'inherit', color: 'inherit', cursor: 'pointer' }, style), (disabled && disabledStyle)) : __assign$2(__assign$2({}, style), (disabled && disabledStyle));
|
|
225
|
+
return (React__default.createElement("button", __assign$2({}, rest, { "aria-label": rest['aria-label'] || networkName, className: newClassName, onClick: this.handleClick, ref: forwardedRef, style: newStyle }), children));
|
|
226
|
+
};
|
|
227
|
+
ShareButton.defaultProps = {
|
|
228
|
+
disabledStyle: { opacity: 0.6 },
|
|
229
|
+
openShareDialogOnClick: true,
|
|
230
|
+
resetButtonStyle: true,
|
|
231
|
+
};
|
|
232
|
+
return ShareButton;
|
|
233
|
+
}(Component));
|
|
234
|
+
|
|
235
|
+
var __assign$1 = (undefined && undefined.__assign) || function () {
|
|
236
|
+
__assign$1 = Object.assign || function(t) {
|
|
237
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
238
|
+
s = arguments[i];
|
|
239
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
240
|
+
t[p] = s[p];
|
|
241
|
+
}
|
|
242
|
+
return t;
|
|
243
|
+
};
|
|
244
|
+
return __assign$1.apply(this, arguments);
|
|
245
|
+
};
|
|
246
|
+
function createShareButton(networkName, link, optsMap, defaultProps) {
|
|
247
|
+
function CreatedButton(props, ref) {
|
|
248
|
+
var opts = optsMap(props);
|
|
249
|
+
var passedProps = __assign$1({}, props);
|
|
250
|
+
// remove keys from passed props that are passed as opts
|
|
251
|
+
var optsKeys = Object.keys(opts);
|
|
252
|
+
optsKeys.forEach(function (key) {
|
|
253
|
+
delete passedProps[key];
|
|
254
|
+
});
|
|
255
|
+
return (React__default.createElement(ShareButton$1, __assign$1({}, defaultProps, passedProps, { forwardedRef: ref, networkName: networkName, networkLink: link, opts: optsMap(props) })));
|
|
256
|
+
}
|
|
257
|
+
CreatedButton.displayName = "ShareButton-" + networkName;
|
|
258
|
+
return forwardRef(CreatedButton);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
function emailLink(url, _a) {
|
|
262
|
+
var subject = _a.subject, body = _a.body, separator = _a.separator;
|
|
263
|
+
return 'mailto:' + objectToGetParams({ subject: subject, body: body ? body + separator + url : url });
|
|
264
|
+
}
|
|
265
|
+
createShareButton('email', emailLink, function (props) { return ({
|
|
266
|
+
subject: props.subject,
|
|
267
|
+
body: props.body,
|
|
268
|
+
separator: props.separator || ' ',
|
|
269
|
+
}); }, {
|
|
270
|
+
openShareDialogOnClick: false,
|
|
271
|
+
onClick: function (_, link) {
|
|
272
|
+
window.location.href = link;
|
|
273
|
+
},
|
|
274
|
+
});
|
|
275
|
+
|
|
276
|
+
var FacebookIcon = createIcon({
|
|
277
|
+
color: '#3b5998',
|
|
278
|
+
networkName: 'facebook',
|
|
279
|
+
path: 'M34.1,47V33.3h4.6l0.7-5.3h-5.3v-3.4c0-1.5,0.4-2.6,2.6-2.6l2.8,0v-4.8c-0.5-0.1-2.2-0.2-4.1-0.2 c-4.1,0-6.9,2.5-6.9,7V28H24v5.3h4.6V47H34.1z',
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
createIcon({
|
|
283
|
+
color: '#2196F3',
|
|
284
|
+
networkName: 'facebookmessenger',
|
|
285
|
+
path: 'M 53.066406 21.871094 C 52.667969 21.339844 51.941406 21.179688 51.359375 21.496094 L 37.492188 29.058594 L 28.867188 21.660156 C 28.339844 21.207031 27.550781 21.238281 27.054688 21.730469 L 11.058594 37.726562 C 10.539062 38.25 10.542969 39.09375 11.0625 39.613281 C 11.480469 40.027344 12.121094 40.121094 12.640625 39.839844 L 26.503906 32.28125 L 35.136719 39.679688 C 35.667969 40.132812 36.457031 40.101562 36.949219 39.609375 L 52.949219 23.613281 C 53.414062 23.140625 53.464844 22.398438 53.066406 21.871094 Z M 53.066406 21.871094',
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
function facebookMessengerLink(url, _a) {
|
|
289
|
+
var appId = _a.appId, redirectUri = _a.redirectUri, to = _a.to;
|
|
290
|
+
return ('https://www.facebook.com/dialog/send' +
|
|
291
|
+
objectToGetParams({
|
|
292
|
+
link: url,
|
|
293
|
+
redirect_uri: redirectUri || url,
|
|
294
|
+
app_id: appId,
|
|
295
|
+
to: to,
|
|
296
|
+
}));
|
|
297
|
+
}
|
|
298
|
+
createShareButton('facebookmessenger', facebookMessengerLink, function (props) { return ({
|
|
299
|
+
appId: props.appId,
|
|
300
|
+
redirectUri: props.redirectUri,
|
|
301
|
+
to: props.to,
|
|
302
|
+
}); }, {
|
|
303
|
+
windowWidth: 1000,
|
|
304
|
+
windowHeight: 820,
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
var __extends$1 = (undefined && undefined.__extends) || (function () {
|
|
308
|
+
var extendStatics = function (d, b) {
|
|
309
|
+
extendStatics = Object.setPrototypeOf ||
|
|
310
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
311
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
312
|
+
return extendStatics(d, b);
|
|
313
|
+
};
|
|
314
|
+
return function (d, b) {
|
|
315
|
+
extendStatics(d, b);
|
|
316
|
+
function __() { this.constructor = d; }
|
|
317
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
318
|
+
};
|
|
319
|
+
})();
|
|
320
|
+
var AssertionError = /** @class */ (function (_super) {
|
|
321
|
+
__extends$1(AssertionError, _super);
|
|
322
|
+
function AssertionError(message) {
|
|
323
|
+
var _this = _super.call(this, message) || this;
|
|
324
|
+
_this.name = 'AssertionError';
|
|
325
|
+
return _this;
|
|
326
|
+
}
|
|
327
|
+
return AssertionError;
|
|
328
|
+
}(Error));
|
|
329
|
+
function assert(value, message) {
|
|
330
|
+
if (!value) {
|
|
331
|
+
throw new AssertionError(message);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
function facebookLink(url, _a) {
|
|
336
|
+
var quote = _a.quote, hashtag = _a.hashtag;
|
|
337
|
+
assert(url, 'facebook.url');
|
|
338
|
+
return ('https://www.facebook.com/sharer/sharer.php' +
|
|
339
|
+
objectToGetParams({
|
|
340
|
+
u: url,
|
|
341
|
+
quote: quote,
|
|
342
|
+
hashtag: hashtag,
|
|
343
|
+
}));
|
|
344
|
+
}
|
|
345
|
+
var FacebookShareButton = createShareButton('facebook', facebookLink, function (props) { return ({
|
|
346
|
+
quote: props.quote,
|
|
347
|
+
hashtag: props.hashtag,
|
|
348
|
+
}); }, {
|
|
349
|
+
windowWidth: 550,
|
|
350
|
+
windowHeight: 400,
|
|
351
|
+
});
|
|
352
|
+
|
|
353
|
+
var browser = {exports: {}};
|
|
354
|
+
|
|
355
|
+
var debug$1 = {exports: {}};
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* Helpers.
|
|
359
|
+
*/
|
|
360
|
+
|
|
361
|
+
var s = 1000;
|
|
362
|
+
var m = s * 60;
|
|
363
|
+
var h = m * 60;
|
|
364
|
+
var d = h * 24;
|
|
365
|
+
var y = d * 365.25;
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* Parse or format the given `val`.
|
|
369
|
+
*
|
|
370
|
+
* Options:
|
|
371
|
+
*
|
|
372
|
+
* - `long` verbose formatting [false]
|
|
373
|
+
*
|
|
374
|
+
* @param {String|Number} val
|
|
375
|
+
* @param {Object} [options]
|
|
376
|
+
* @throws {Error} throw an error if val is not a non-empty string or a number
|
|
377
|
+
* @return {String|Number}
|
|
378
|
+
* @api public
|
|
379
|
+
*/
|
|
380
|
+
|
|
381
|
+
var ms = function(val, options) {
|
|
382
|
+
options = options || {};
|
|
383
|
+
var type = typeof val;
|
|
384
|
+
if (type === 'string' && val.length > 0) {
|
|
385
|
+
return parse(val);
|
|
386
|
+
} else if (type === 'number' && isNaN(val) === false) {
|
|
387
|
+
return options.long ? fmtLong(val) : fmtShort(val);
|
|
388
|
+
}
|
|
389
|
+
throw new Error(
|
|
390
|
+
'val is not a non-empty string or a valid number. val=' +
|
|
391
|
+
JSON.stringify(val)
|
|
392
|
+
);
|
|
393
|
+
};
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* Parse the given `str` and return milliseconds.
|
|
397
|
+
*
|
|
398
|
+
* @param {String} str
|
|
399
|
+
* @return {Number}
|
|
400
|
+
* @api private
|
|
401
|
+
*/
|
|
402
|
+
|
|
403
|
+
function parse(str) {
|
|
404
|
+
str = String(str);
|
|
405
|
+
if (str.length > 100) {
|
|
406
|
+
return;
|
|
407
|
+
}
|
|
408
|
+
var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(
|
|
409
|
+
str
|
|
410
|
+
);
|
|
411
|
+
if (!match) {
|
|
412
|
+
return;
|
|
413
|
+
}
|
|
414
|
+
var n = parseFloat(match[1]);
|
|
415
|
+
var type = (match[2] || 'ms').toLowerCase();
|
|
416
|
+
switch (type) {
|
|
417
|
+
case 'years':
|
|
418
|
+
case 'year':
|
|
419
|
+
case 'yrs':
|
|
420
|
+
case 'yr':
|
|
421
|
+
case 'y':
|
|
422
|
+
return n * y;
|
|
423
|
+
case 'days':
|
|
424
|
+
case 'day':
|
|
425
|
+
case 'd':
|
|
426
|
+
return n * d;
|
|
427
|
+
case 'hours':
|
|
428
|
+
case 'hour':
|
|
429
|
+
case 'hrs':
|
|
430
|
+
case 'hr':
|
|
431
|
+
case 'h':
|
|
432
|
+
return n * h;
|
|
433
|
+
case 'minutes':
|
|
434
|
+
case 'minute':
|
|
435
|
+
case 'mins':
|
|
436
|
+
case 'min':
|
|
437
|
+
case 'm':
|
|
438
|
+
return n * m;
|
|
439
|
+
case 'seconds':
|
|
440
|
+
case 'second':
|
|
441
|
+
case 'secs':
|
|
442
|
+
case 'sec':
|
|
443
|
+
case 's':
|
|
444
|
+
return n * s;
|
|
445
|
+
case 'milliseconds':
|
|
446
|
+
case 'millisecond':
|
|
447
|
+
case 'msecs':
|
|
448
|
+
case 'msec':
|
|
449
|
+
case 'ms':
|
|
450
|
+
return n;
|
|
451
|
+
default:
|
|
452
|
+
return undefined;
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
/**
|
|
457
|
+
* Short format for `ms`.
|
|
458
|
+
*
|
|
459
|
+
* @param {Number} ms
|
|
460
|
+
* @return {String}
|
|
461
|
+
* @api private
|
|
462
|
+
*/
|
|
463
|
+
|
|
464
|
+
function fmtShort(ms) {
|
|
465
|
+
if (ms >= d) {
|
|
466
|
+
return Math.round(ms / d) + 'd';
|
|
467
|
+
}
|
|
468
|
+
if (ms >= h) {
|
|
469
|
+
return Math.round(ms / h) + 'h';
|
|
470
|
+
}
|
|
471
|
+
if (ms >= m) {
|
|
472
|
+
return Math.round(ms / m) + 'm';
|
|
473
|
+
}
|
|
474
|
+
if (ms >= s) {
|
|
475
|
+
return Math.round(ms / s) + 's';
|
|
476
|
+
}
|
|
477
|
+
return ms + 'ms';
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
/**
|
|
481
|
+
* Long format for `ms`.
|
|
482
|
+
*
|
|
483
|
+
* @param {Number} ms
|
|
484
|
+
* @return {String}
|
|
485
|
+
* @api private
|
|
486
|
+
*/
|
|
487
|
+
|
|
488
|
+
function fmtLong(ms) {
|
|
489
|
+
return plural(ms, d, 'day') ||
|
|
490
|
+
plural(ms, h, 'hour') ||
|
|
491
|
+
plural(ms, m, 'minute') ||
|
|
492
|
+
plural(ms, s, 'second') ||
|
|
493
|
+
ms + ' ms';
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
/**
|
|
497
|
+
* Pluralization helper.
|
|
498
|
+
*/
|
|
499
|
+
|
|
500
|
+
function plural(ms, n, name) {
|
|
501
|
+
if (ms < n) {
|
|
502
|
+
return;
|
|
503
|
+
}
|
|
504
|
+
if (ms < n * 1.5) {
|
|
505
|
+
return Math.floor(ms / n) + ' ' + name;
|
|
506
|
+
}
|
|
507
|
+
return Math.ceil(ms / n) + ' ' + name + 's';
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
(function (module, exports) {
|
|
511
|
+
/**
|
|
512
|
+
* This is the common logic for both the Node.js and web browser
|
|
513
|
+
* implementations of `debug()`.
|
|
514
|
+
*
|
|
515
|
+
* Expose `debug()` as the module.
|
|
516
|
+
*/
|
|
517
|
+
|
|
518
|
+
exports = module.exports = createDebug.debug = createDebug['default'] = createDebug;
|
|
519
|
+
exports.coerce = coerce;
|
|
520
|
+
exports.disable = disable;
|
|
521
|
+
exports.enable = enable;
|
|
522
|
+
exports.enabled = enabled;
|
|
523
|
+
exports.humanize = ms;
|
|
524
|
+
|
|
525
|
+
/**
|
|
526
|
+
* The currently active debug mode names, and names to skip.
|
|
527
|
+
*/
|
|
528
|
+
|
|
529
|
+
exports.names = [];
|
|
530
|
+
exports.skips = [];
|
|
531
|
+
|
|
532
|
+
/**
|
|
533
|
+
* Map of special "%n" handling functions, for the debug "format" argument.
|
|
534
|
+
*
|
|
535
|
+
* Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
|
|
536
|
+
*/
|
|
537
|
+
|
|
538
|
+
exports.formatters = {};
|
|
539
|
+
|
|
540
|
+
/**
|
|
541
|
+
* Previous log timestamp.
|
|
542
|
+
*/
|
|
543
|
+
|
|
544
|
+
var prevTime;
|
|
545
|
+
|
|
546
|
+
/**
|
|
547
|
+
* Select a color.
|
|
548
|
+
* @param {String} namespace
|
|
549
|
+
* @return {Number}
|
|
550
|
+
* @api private
|
|
551
|
+
*/
|
|
552
|
+
|
|
553
|
+
function selectColor(namespace) {
|
|
554
|
+
var hash = 0, i;
|
|
555
|
+
|
|
556
|
+
for (i in namespace) {
|
|
557
|
+
hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
|
|
558
|
+
hash |= 0; // Convert to 32bit integer
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
return exports.colors[Math.abs(hash) % exports.colors.length];
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* Create a debugger with the given `namespace`.
|
|
566
|
+
*
|
|
567
|
+
* @param {String} namespace
|
|
568
|
+
* @return {Function}
|
|
569
|
+
* @api public
|
|
570
|
+
*/
|
|
571
|
+
|
|
572
|
+
function createDebug(namespace) {
|
|
573
|
+
|
|
574
|
+
function debug() {
|
|
575
|
+
// disabled?
|
|
576
|
+
if (!debug.enabled) return;
|
|
577
|
+
|
|
578
|
+
var self = debug;
|
|
579
|
+
|
|
580
|
+
// set `diff` timestamp
|
|
581
|
+
var curr = +new Date();
|
|
582
|
+
var ms = curr - (prevTime || curr);
|
|
583
|
+
self.diff = ms;
|
|
584
|
+
self.prev = prevTime;
|
|
585
|
+
self.curr = curr;
|
|
586
|
+
prevTime = curr;
|
|
587
|
+
|
|
588
|
+
// turn the `arguments` into a proper Array
|
|
589
|
+
var args = new Array(arguments.length);
|
|
590
|
+
for (var i = 0; i < args.length; i++) {
|
|
591
|
+
args[i] = arguments[i];
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
args[0] = exports.coerce(args[0]);
|
|
595
|
+
|
|
596
|
+
if ('string' !== typeof args[0]) {
|
|
597
|
+
// anything else let's inspect with %O
|
|
598
|
+
args.unshift('%O');
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
// apply any `formatters` transformations
|
|
602
|
+
var index = 0;
|
|
603
|
+
args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) {
|
|
604
|
+
// if we encounter an escaped % then don't increase the array index
|
|
605
|
+
if (match === '%%') return match;
|
|
606
|
+
index++;
|
|
607
|
+
var formatter = exports.formatters[format];
|
|
608
|
+
if ('function' === typeof formatter) {
|
|
609
|
+
var val = args[index];
|
|
610
|
+
match = formatter.call(self, val);
|
|
611
|
+
|
|
612
|
+
// now we need to remove `args[index]` since it's inlined in the `format`
|
|
613
|
+
args.splice(index, 1);
|
|
614
|
+
index--;
|
|
615
|
+
}
|
|
616
|
+
return match;
|
|
617
|
+
});
|
|
618
|
+
|
|
619
|
+
// apply env-specific formatting (colors, etc.)
|
|
620
|
+
exports.formatArgs.call(self, args);
|
|
621
|
+
|
|
622
|
+
var logFn = debug.log || exports.log || console.log.bind(console);
|
|
623
|
+
logFn.apply(self, args);
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
debug.namespace = namespace;
|
|
627
|
+
debug.enabled = exports.enabled(namespace);
|
|
628
|
+
debug.useColors = exports.useColors();
|
|
629
|
+
debug.color = selectColor(namespace);
|
|
630
|
+
|
|
631
|
+
// env-specific initialization logic for debug instances
|
|
632
|
+
if ('function' === typeof exports.init) {
|
|
633
|
+
exports.init(debug);
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
return debug;
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
/**
|
|
640
|
+
* Enables a debug mode by namespaces. This can include modes
|
|
641
|
+
* separated by a colon and wildcards.
|
|
642
|
+
*
|
|
643
|
+
* @param {String} namespaces
|
|
644
|
+
* @api public
|
|
645
|
+
*/
|
|
646
|
+
|
|
647
|
+
function enable(namespaces) {
|
|
648
|
+
exports.save(namespaces);
|
|
649
|
+
|
|
650
|
+
exports.names = [];
|
|
651
|
+
exports.skips = [];
|
|
652
|
+
|
|
653
|
+
var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
|
|
654
|
+
var len = split.length;
|
|
655
|
+
|
|
656
|
+
for (var i = 0; i < len; i++) {
|
|
657
|
+
if (!split[i]) continue; // ignore empty strings
|
|
658
|
+
namespaces = split[i].replace(/\*/g, '.*?');
|
|
659
|
+
if (namespaces[0] === '-') {
|
|
660
|
+
exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
|
|
661
|
+
} else {
|
|
662
|
+
exports.names.push(new RegExp('^' + namespaces + '$'));
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
/**
|
|
668
|
+
* Disable debug output.
|
|
669
|
+
*
|
|
670
|
+
* @api public
|
|
671
|
+
*/
|
|
672
|
+
|
|
673
|
+
function disable() {
|
|
674
|
+
exports.enable('');
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
/**
|
|
678
|
+
* Returns true if the given mode name is enabled, false otherwise.
|
|
679
|
+
*
|
|
680
|
+
* @param {String} name
|
|
681
|
+
* @return {Boolean}
|
|
682
|
+
* @api public
|
|
683
|
+
*/
|
|
684
|
+
|
|
685
|
+
function enabled(name) {
|
|
686
|
+
var i, len;
|
|
687
|
+
for (i = 0, len = exports.skips.length; i < len; i++) {
|
|
688
|
+
if (exports.skips[i].test(name)) {
|
|
689
|
+
return false;
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
for (i = 0, len = exports.names.length; i < len; i++) {
|
|
693
|
+
if (exports.names[i].test(name)) {
|
|
694
|
+
return true;
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
return false;
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
/**
|
|
701
|
+
* Coerce `val`.
|
|
702
|
+
*
|
|
703
|
+
* @param {Mixed} val
|
|
704
|
+
* @return {Mixed}
|
|
705
|
+
* @api private
|
|
706
|
+
*/
|
|
707
|
+
|
|
708
|
+
function coerce(val) {
|
|
709
|
+
if (val instanceof Error) return val.stack || val.message;
|
|
710
|
+
return val;
|
|
711
|
+
}
|
|
712
|
+
} (debug$1, debug$1.exports));
|
|
713
|
+
|
|
714
|
+
/**
|
|
715
|
+
* This is the web browser implementation of `debug()`.
|
|
716
|
+
*
|
|
717
|
+
* Expose `debug()` as the module.
|
|
718
|
+
*/
|
|
719
|
+
|
|
720
|
+
(function (module, exports) {
|
|
721
|
+
exports = module.exports = debug$1.exports;
|
|
722
|
+
exports.log = log;
|
|
723
|
+
exports.formatArgs = formatArgs;
|
|
724
|
+
exports.save = save;
|
|
725
|
+
exports.load = load;
|
|
726
|
+
exports.useColors = useColors;
|
|
727
|
+
exports.storage = 'undefined' != typeof chrome
|
|
728
|
+
&& 'undefined' != typeof chrome.storage
|
|
729
|
+
? chrome.storage.local
|
|
730
|
+
: localstorage();
|
|
731
|
+
|
|
732
|
+
/**
|
|
733
|
+
* Colors.
|
|
734
|
+
*/
|
|
735
|
+
|
|
736
|
+
exports.colors = [
|
|
737
|
+
'lightseagreen',
|
|
738
|
+
'forestgreen',
|
|
739
|
+
'goldenrod',
|
|
740
|
+
'dodgerblue',
|
|
741
|
+
'darkorchid',
|
|
742
|
+
'crimson'
|
|
743
|
+
];
|
|
744
|
+
|
|
745
|
+
/**
|
|
746
|
+
* Currently only WebKit-based Web Inspectors, Firefox >= v31,
|
|
747
|
+
* and the Firebug extension (any Firefox version) are known
|
|
748
|
+
* to support "%c" CSS customizations.
|
|
749
|
+
*
|
|
750
|
+
* TODO: add a `localStorage` variable to explicitly enable/disable colors
|
|
751
|
+
*/
|
|
752
|
+
|
|
753
|
+
function useColors() {
|
|
754
|
+
// NB: In an Electron preload script, document will be defined but not fully
|
|
755
|
+
// initialized. Since we know we're in Chrome, we'll just detect this case
|
|
756
|
+
// explicitly
|
|
757
|
+
if (typeof window !== 'undefined' && window.process && window.process.type === 'renderer') {
|
|
758
|
+
return true;
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
// is webkit? http://stackoverflow.com/a/16459606/376773
|
|
762
|
+
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
|
|
763
|
+
return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
|
|
764
|
+
// is firebug? http://stackoverflow.com/a/398120/376773
|
|
765
|
+
(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
|
|
766
|
+
// is firefox >= v31?
|
|
767
|
+
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
|
768
|
+
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
|
|
769
|
+
// double check webkit in userAgent just in case we are in a worker
|
|
770
|
+
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
/**
|
|
774
|
+
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
|
|
775
|
+
*/
|
|
776
|
+
|
|
777
|
+
exports.formatters.j = function(v) {
|
|
778
|
+
try {
|
|
779
|
+
return JSON.stringify(v);
|
|
780
|
+
} catch (err) {
|
|
781
|
+
return '[UnexpectedJSONParseError]: ' + err.message;
|
|
782
|
+
}
|
|
783
|
+
};
|
|
784
|
+
|
|
785
|
+
|
|
786
|
+
/**
|
|
787
|
+
* Colorize log arguments if enabled.
|
|
788
|
+
*
|
|
789
|
+
* @api public
|
|
790
|
+
*/
|
|
791
|
+
|
|
792
|
+
function formatArgs(args) {
|
|
793
|
+
var useColors = this.useColors;
|
|
794
|
+
|
|
795
|
+
args[0] = (useColors ? '%c' : '')
|
|
796
|
+
+ this.namespace
|
|
797
|
+
+ (useColors ? ' %c' : ' ')
|
|
798
|
+
+ args[0]
|
|
799
|
+
+ (useColors ? '%c ' : ' ')
|
|
800
|
+
+ '+' + exports.humanize(this.diff);
|
|
801
|
+
|
|
802
|
+
if (!useColors) return;
|
|
803
|
+
|
|
804
|
+
var c = 'color: ' + this.color;
|
|
805
|
+
args.splice(1, 0, c, 'color: inherit');
|
|
806
|
+
|
|
807
|
+
// the final "%c" is somewhat tricky, because there could be other
|
|
808
|
+
// arguments passed either before or after the %c, so we need to
|
|
809
|
+
// figure out the correct index to insert the CSS into
|
|
810
|
+
var index = 0;
|
|
811
|
+
var lastC = 0;
|
|
812
|
+
args[0].replace(/%[a-zA-Z%]/g, function(match) {
|
|
813
|
+
if ('%%' === match) return;
|
|
814
|
+
index++;
|
|
815
|
+
if ('%c' === match) {
|
|
816
|
+
// we only are interested in the *last* %c
|
|
817
|
+
// (the user may have provided their own)
|
|
818
|
+
lastC = index;
|
|
819
|
+
}
|
|
820
|
+
});
|
|
821
|
+
|
|
822
|
+
args.splice(lastC, 0, c);
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
/**
|
|
826
|
+
* Invokes `console.log()` when available.
|
|
827
|
+
* No-op when `console.log` is not a "function".
|
|
828
|
+
*
|
|
829
|
+
* @api public
|
|
830
|
+
*/
|
|
831
|
+
|
|
832
|
+
function log() {
|
|
833
|
+
// this hackery is required for IE8/9, where
|
|
834
|
+
// the `console.log` function doesn't have 'apply'
|
|
835
|
+
return 'object' === typeof console
|
|
836
|
+
&& console.log
|
|
837
|
+
&& Function.prototype.apply.call(console.log, console, arguments);
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
/**
|
|
841
|
+
* Save `namespaces`.
|
|
842
|
+
*
|
|
843
|
+
* @param {String} namespaces
|
|
844
|
+
* @api private
|
|
845
|
+
*/
|
|
846
|
+
|
|
847
|
+
function save(namespaces) {
|
|
848
|
+
try {
|
|
849
|
+
if (null == namespaces) {
|
|
850
|
+
exports.storage.removeItem('debug');
|
|
851
|
+
} else {
|
|
852
|
+
exports.storage.debug = namespaces;
|
|
853
|
+
}
|
|
854
|
+
} catch(e) {}
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
/**
|
|
858
|
+
* Load `namespaces`.
|
|
859
|
+
*
|
|
860
|
+
* @return {String} returns the previously persisted debug modes
|
|
861
|
+
* @api private
|
|
862
|
+
*/
|
|
863
|
+
|
|
864
|
+
function load() {
|
|
865
|
+
var r;
|
|
866
|
+
try {
|
|
867
|
+
r = exports.storage.debug;
|
|
868
|
+
} catch(e) {}
|
|
869
|
+
|
|
870
|
+
// If debug isn't set in LS, and we're in Electron, try to load $DEBUG
|
|
871
|
+
if (!r && typeof process !== 'undefined' && 'env' in process) {
|
|
872
|
+
r = process.env.DEBUG;
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
return r;
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
/**
|
|
879
|
+
* Enable namespaces listed in `localStorage.debug` initially.
|
|
880
|
+
*/
|
|
881
|
+
|
|
882
|
+
exports.enable(load());
|
|
883
|
+
|
|
884
|
+
/**
|
|
885
|
+
* Localstorage attempts to return the localstorage.
|
|
886
|
+
*
|
|
887
|
+
* This is necessary because safari throws
|
|
888
|
+
* when a user disables cookies/localstorage
|
|
889
|
+
* and you attempt to access it.
|
|
890
|
+
*
|
|
891
|
+
* @return {LocalStorage}
|
|
892
|
+
* @api private
|
|
893
|
+
*/
|
|
894
|
+
|
|
895
|
+
function localstorage() {
|
|
896
|
+
try {
|
|
897
|
+
return window.localStorage;
|
|
898
|
+
} catch (e) {}
|
|
899
|
+
}
|
|
900
|
+
} (browser, browser.exports));
|
|
901
|
+
|
|
902
|
+
/**
|
|
903
|
+
* Module dependencies
|
|
904
|
+
*/
|
|
905
|
+
|
|
906
|
+
var debug = browser.exports('jsonp');
|
|
907
|
+
|
|
908
|
+
/**
|
|
909
|
+
* Module exports.
|
|
910
|
+
*/
|
|
911
|
+
|
|
912
|
+
var jsonp_1 = jsonp;
|
|
913
|
+
|
|
914
|
+
/**
|
|
915
|
+
* Callback index.
|
|
916
|
+
*/
|
|
917
|
+
|
|
918
|
+
var count = 0;
|
|
919
|
+
|
|
920
|
+
/**
|
|
921
|
+
* Noop function.
|
|
922
|
+
*/
|
|
923
|
+
|
|
924
|
+
function noop(){}
|
|
925
|
+
|
|
926
|
+
/**
|
|
927
|
+
* JSONP handler
|
|
928
|
+
*
|
|
929
|
+
* Options:
|
|
930
|
+
* - param {String} qs parameter (`callback`)
|
|
931
|
+
* - prefix {String} qs parameter (`__jp`)
|
|
932
|
+
* - name {String} qs parameter (`prefix` + incr)
|
|
933
|
+
* - timeout {Number} how long after a timeout error is emitted (`60000`)
|
|
934
|
+
*
|
|
935
|
+
* @param {String} url
|
|
936
|
+
* @param {Object|Function} optional options / callback
|
|
937
|
+
* @param {Function} optional callback
|
|
938
|
+
*/
|
|
939
|
+
|
|
940
|
+
function jsonp(url, opts, fn){
|
|
941
|
+
if ('function' == typeof opts) {
|
|
942
|
+
fn = opts;
|
|
943
|
+
opts = {};
|
|
944
|
+
}
|
|
945
|
+
if (!opts) opts = {};
|
|
946
|
+
|
|
947
|
+
var prefix = opts.prefix || '__jp';
|
|
948
|
+
|
|
949
|
+
// use the callback name that was passed if one was provided.
|
|
950
|
+
// otherwise generate a unique name by incrementing our counter.
|
|
951
|
+
var id = opts.name || (prefix + (count++));
|
|
952
|
+
|
|
953
|
+
var param = opts.param || 'callback';
|
|
954
|
+
var timeout = null != opts.timeout ? opts.timeout : 60000;
|
|
955
|
+
var enc = encodeURIComponent;
|
|
956
|
+
var target = document.getElementsByTagName('script')[0] || document.head;
|
|
957
|
+
var script;
|
|
958
|
+
var timer;
|
|
959
|
+
|
|
960
|
+
|
|
961
|
+
if (timeout) {
|
|
962
|
+
timer = setTimeout(function(){
|
|
963
|
+
cleanup();
|
|
964
|
+
if (fn) fn(new Error('Timeout'));
|
|
965
|
+
}, timeout);
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
function cleanup(){
|
|
969
|
+
if (script.parentNode) script.parentNode.removeChild(script);
|
|
970
|
+
window[id] = noop;
|
|
971
|
+
if (timer) clearTimeout(timer);
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
function cancel(){
|
|
975
|
+
if (window[id]) {
|
|
976
|
+
cleanup();
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
window[id] = function(data){
|
|
981
|
+
debug('jsonp got', data);
|
|
982
|
+
cleanup();
|
|
983
|
+
if (fn) fn(null, data);
|
|
984
|
+
};
|
|
985
|
+
|
|
986
|
+
// add qs component
|
|
987
|
+
url += (~url.indexOf('?') ? '&' : '?') + param + '=' + enc(id);
|
|
988
|
+
url = url.replace('?&', '?');
|
|
989
|
+
|
|
990
|
+
debug('jsonp req "%s"', url);
|
|
991
|
+
|
|
992
|
+
// create script
|
|
993
|
+
script = document.createElement('script');
|
|
994
|
+
script.src = url;
|
|
995
|
+
target.parentNode.insertBefore(script, target);
|
|
996
|
+
|
|
997
|
+
return cancel;
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
var __extends = (undefined && undefined.__extends) || (function () {
|
|
1001
|
+
var extendStatics = function (d, b) {
|
|
1002
|
+
extendStatics = Object.setPrototypeOf ||
|
|
1003
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
1004
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
1005
|
+
return extendStatics(d, b);
|
|
1006
|
+
};
|
|
1007
|
+
return function (d, b) {
|
|
1008
|
+
extendStatics(d, b);
|
|
1009
|
+
function __() { this.constructor = d; }
|
|
1010
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
1011
|
+
};
|
|
1012
|
+
})();
|
|
1013
|
+
var __assign = (undefined && undefined.__assign) || function () {
|
|
1014
|
+
__assign = Object.assign || function(t) {
|
|
1015
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
1016
|
+
s = arguments[i];
|
|
1017
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
1018
|
+
t[p] = s[p];
|
|
1019
|
+
}
|
|
1020
|
+
return t;
|
|
1021
|
+
};
|
|
1022
|
+
return __assign.apply(this, arguments);
|
|
1023
|
+
};
|
|
1024
|
+
var __rest = (undefined && undefined.__rest) || function (s, e) {
|
|
1025
|
+
var t = {};
|
|
1026
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
1027
|
+
t[p] = s[p];
|
|
1028
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
1029
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1030
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
1031
|
+
t[p[i]] = s[p[i]];
|
|
1032
|
+
}
|
|
1033
|
+
return t;
|
|
1034
|
+
};
|
|
1035
|
+
var defaultChildren = function (shareCount) { return shareCount; };
|
|
1036
|
+
var SocialMediaShareCount = /** @class */ (function (_super) {
|
|
1037
|
+
__extends(SocialMediaShareCount, _super);
|
|
1038
|
+
function SocialMediaShareCount(props) {
|
|
1039
|
+
var _this = _super.call(this, props) || this;
|
|
1040
|
+
_this._isMounted = false;
|
|
1041
|
+
_this.state = { count: 0, isLoading: false };
|
|
1042
|
+
return _this;
|
|
1043
|
+
}
|
|
1044
|
+
SocialMediaShareCount.prototype.componentDidMount = function () {
|
|
1045
|
+
this._isMounted = true;
|
|
1046
|
+
this.updateCount(this.props.url);
|
|
1047
|
+
};
|
|
1048
|
+
SocialMediaShareCount.prototype.componentDidUpdate = function (prevProps) {
|
|
1049
|
+
if (this.props.url !== prevProps.url) {
|
|
1050
|
+
this.updateCount(this.props.url);
|
|
1051
|
+
}
|
|
1052
|
+
};
|
|
1053
|
+
SocialMediaShareCount.prototype.componentWillUnmount = function () {
|
|
1054
|
+
this._isMounted = false;
|
|
1055
|
+
};
|
|
1056
|
+
SocialMediaShareCount.prototype.updateCount = function (url) {
|
|
1057
|
+
var _this = this;
|
|
1058
|
+
this.setState({
|
|
1059
|
+
isLoading: true,
|
|
1060
|
+
});
|
|
1061
|
+
this.props.getCount(url, function (count) {
|
|
1062
|
+
if (_this._isMounted) {
|
|
1063
|
+
_this.setState({
|
|
1064
|
+
count: count,
|
|
1065
|
+
isLoading: false,
|
|
1066
|
+
});
|
|
1067
|
+
}
|
|
1068
|
+
});
|
|
1069
|
+
};
|
|
1070
|
+
SocialMediaShareCount.prototype.render = function () {
|
|
1071
|
+
var _a = this.state, count = _a.count, isLoading = _a.isLoading;
|
|
1072
|
+
var _b = this.props, _c = _b.children, children = _c === void 0 ? defaultChildren : _c, className = _b.className; _b.getCount; var rest = __rest(_b, ["children", "className", "getCount"]);
|
|
1073
|
+
return (React__default.createElement("span", __assign({ className: classNames('react-share__ShareCount', className) }, rest), !isLoading && count !== undefined && children(count)));
|
|
1074
|
+
};
|
|
1075
|
+
return SocialMediaShareCount;
|
|
1076
|
+
}(Component));
|
|
1077
|
+
function createShareCount(getCount) {
|
|
1078
|
+
var ShareCount = function (props) { return (React__default.createElement(SocialMediaShareCount, __assign({ getCount: getCount }, props))); };
|
|
1079
|
+
ShareCount.displayName = "ShareCount(" + getCount.name + ")";
|
|
1080
|
+
return ShareCount;
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
function getFacebookShareCount(shareUrl, callback) {
|
|
1084
|
+
var endpoint = "https://graph.facebook.com/?id=" + shareUrl + "&fields=og_object{engagement}";
|
|
1085
|
+
jsonp_1(endpoint, function (err, data) {
|
|
1086
|
+
callback(!err && data && data.og_object && data.og_object.engagement
|
|
1087
|
+
? data.og_object.engagement.count
|
|
1088
|
+
: undefined);
|
|
1089
|
+
});
|
|
1090
|
+
}
|
|
1091
|
+
createShareCount(getFacebookShareCount);
|
|
1092
|
+
|
|
1093
|
+
createIcon({
|
|
1094
|
+
color: '#009ad9',
|
|
1095
|
+
networkName: 'hatena',
|
|
1096
|
+
path: 'M 36.164062 33.554688 C 34.988281 32.234375 33.347656 31.5 31.253906 31.34375 C 33.125 30.835938 34.476562 30.09375 35.335938 29.09375 C 36.191406 28.09375 36.609375 26.78125 36.609375 25.101562 C 36.628906 23.875 36.332031 22.660156 35.75 21.578125 C 35.160156 20.558594 34.292969 19.71875 33.253906 19.160156 C 32.304688 18.640625 31.175781 18.265625 29.847656 18.042969 C 28.523438 17.824219 26.195312 17.730469 22.867188 17.730469 L 14.769531 17.730469 L 14.769531 47.269531 L 23.113281 47.269531 C 26.46875 47.269531 28.886719 47.15625 30.367188 46.929688 C 31.851562 46.695312 33.085938 46.304688 34.085938 45.773438 C 35.289062 45.148438 36.28125 44.179688 36.933594 42.992188 C 37.597656 41.796875 37.933594 40.402344 37.933594 38.816406 C 37.933594 36.621094 37.347656 34.867188 36.164062 33.554688 Z M 22.257812 24.269531 L 23.984375 24.269531 C 25.988281 24.269531 27.332031 24.496094 28.015625 24.945312 C 28.703125 25.402344 29.042969 26.183594 29.042969 27.285156 C 29.042969 28.390625 28.664062 29.105469 27.9375 29.550781 C 27.210938 29.992188 25.84375 30.199219 23.855469 30.199219 L 22.257812 30.199219 Z M 29.121094 41.210938 C 28.328125 41.691406 26.976562 41.925781 25.078125 41.925781 L 22.257812 41.925781 L 22.257812 35.488281 L 25.195312 35.488281 C 27.144531 35.488281 28.496094 35.738281 29.210938 36.230469 C 29.925781 36.726562 30.304688 37.582031 30.304688 38.832031 C 30.304688 40.078125 29.914062 40.742188 29.105469 41.222656 Z M 29.121094 41.210938 M 46.488281 39.792969 C 44.421875 39.792969 42.742188 41.46875 42.742188 43.535156 C 42.742188 45.605469 44.421875 47.28125 46.488281 47.28125 C 48.554688 47.28125 50.230469 45.605469 50.230469 43.535156 C 50.230469 41.46875 48.554688 39.792969 46.488281 39.792969 Z M 46.488281 39.792969 M 43.238281 17.730469 L 49.738281 17.730469 L 49.738281 37.429688 L 43.238281 37.429688 Z M 43.238281 17.730469 ',
|
|
1097
|
+
});
|
|
1098
|
+
|
|
1099
|
+
function hatenaLink(url, _a) {
|
|
1100
|
+
var title = _a.title;
|
|
1101
|
+
assert(url, 'hatena.url');
|
|
1102
|
+
return "http://b.hatena.ne.jp/add?mode=confirm&url=" + url + "&title=" + title;
|
|
1103
|
+
}
|
|
1104
|
+
createShareButton('hatena', hatenaLink, function (props) { return ({
|
|
1105
|
+
title: props.title,
|
|
1106
|
+
}); }, {
|
|
1107
|
+
windowWidth: 660,
|
|
1108
|
+
windowHeight: 460,
|
|
1109
|
+
windowPosition: 'windowCenter',
|
|
1110
|
+
});
|
|
1111
|
+
|
|
1112
|
+
function getHatenaShareCount(shareUrl, callback) {
|
|
1113
|
+
var url = 'https://bookmark.hatenaapis.com/count/entry';
|
|
1114
|
+
jsonp_1(url +
|
|
1115
|
+
objectToGetParams({
|
|
1116
|
+
url: shareUrl,
|
|
1117
|
+
}), function (err, data) {
|
|
1118
|
+
callback(data ? data : undefined);
|
|
1119
|
+
});
|
|
1120
|
+
}
|
|
1121
|
+
createShareCount(getHatenaShareCount);
|
|
1122
|
+
|
|
1123
|
+
createIcon({
|
|
1124
|
+
color: '#1F1F1F',
|
|
1125
|
+
networkName: 'instapaper',
|
|
1126
|
+
path: 'M35.688 43.012c0 2.425.361 2.785 3.912 3.056V48H24.401v-1.932c3.555-.27 3.912-.63 3.912-3.056V20.944c0-2.379-.36-2.785-3.912-3.056V16H39.6v1.888c-3.55.27-3.912.675-3.912 3.056v22.068h.001z',
|
|
1127
|
+
});
|
|
1128
|
+
|
|
1129
|
+
function instapaperLink(url, _a) {
|
|
1130
|
+
var title = _a.title, description = _a.description;
|
|
1131
|
+
assert(url, 'instapaper.url');
|
|
1132
|
+
return ('http://www.instapaper.com/hello2' +
|
|
1133
|
+
objectToGetParams({
|
|
1134
|
+
url: url,
|
|
1135
|
+
title: title,
|
|
1136
|
+
description: description,
|
|
1137
|
+
}));
|
|
1138
|
+
}
|
|
1139
|
+
createShareButton('instapaper', instapaperLink, function (props) { return ({
|
|
1140
|
+
title: props.title,
|
|
1141
|
+
description: props.description,
|
|
1142
|
+
}); }, {
|
|
1143
|
+
windowWidth: 500,
|
|
1144
|
+
windowHeight: 500,
|
|
1145
|
+
windowPosition: 'windowCenter',
|
|
1146
|
+
});
|
|
1147
|
+
|
|
1148
|
+
createIcon({
|
|
1149
|
+
color: '#00b800',
|
|
1150
|
+
networkName: 'line',
|
|
1151
|
+
path: 'M52.62 30.138c0 3.693-1.432 7.019-4.42 10.296h.001c-4.326 4.979-14 11.044-16.201 11.972-2.2.927-1.876-.591-1.786-1.112l.294-1.765c.069-.527.142-1.343-.066-1.865-.232-.574-1.146-.872-1.817-1.016-9.909-1.31-17.245-8.238-17.245-16.51 0-9.226 9.251-16.733 20.62-16.733 11.37 0 20.62 7.507 20.62 16.733zM27.81 25.68h-1.446a.402.402 0 0 0-.402.401v8.985c0 .221.18.4.402.4h1.446a.401.401 0 0 0 .402-.4v-8.985a.402.402 0 0 0-.402-.401zm9.956 0H36.32a.402.402 0 0 0-.402.401v5.338L31.8 25.858a.39.39 0 0 0-.031-.04l-.002-.003-.024-.025-.008-.007a.313.313 0 0 0-.032-.026.255.255 0 0 1-.021-.014l-.012-.007-.021-.012-.013-.006-.023-.01-.013-.005-.024-.008-.014-.003-.023-.005-.017-.002-.021-.003-.021-.002h-1.46a.402.402 0 0 0-.402.401v8.985c0 .221.18.4.402.4h1.446a.401.401 0 0 0 .402-.4v-5.337l4.123 5.568c.028.04.063.072.101.099l.004.003a.236.236 0 0 0 .025.015l.012.006.019.01a.154.154 0 0 1 .019.008l.012.004.028.01.005.001a.442.442 0 0 0 .104.013h1.446a.4.4 0 0 0 .401-.4v-8.985a.402.402 0 0 0-.401-.401zm-13.442 7.537h-3.93v-7.136a.401.401 0 0 0-.401-.401h-1.447a.4.4 0 0 0-.401.401v8.984a.392.392 0 0 0 .123.29c.072.068.17.111.278.111h5.778a.4.4 0 0 0 .401-.401v-1.447a.401.401 0 0 0-.401-.401zm21.429-5.287c.222 0 .401-.18.401-.402v-1.446a.401.401 0 0 0-.401-.402h-5.778a.398.398 0 0 0-.279.113l-.005.004-.006.008a.397.397 0 0 0-.111.276v8.984c0 .108.043.206.112.278l.005.006a.401.401 0 0 0 .284.117h5.778a.4.4 0 0 0 .401-.401v-1.447a.401.401 0 0 0-.401-.401h-3.93v-1.519h3.93c.222 0 .401-.18.401-.402V29.85a.401.401 0 0 0-.401-.402h-3.93V27.93h3.93z',
|
|
1152
|
+
});
|
|
1153
|
+
|
|
1154
|
+
function lineLink(url, _a) {
|
|
1155
|
+
var title = _a.title;
|
|
1156
|
+
assert(url, 'line.url');
|
|
1157
|
+
return ('https://social-plugins.line.me/lineit/share' +
|
|
1158
|
+
objectToGetParams({
|
|
1159
|
+
url: url,
|
|
1160
|
+
text: title,
|
|
1161
|
+
}));
|
|
1162
|
+
}
|
|
1163
|
+
createShareButton('line', lineLink, function (props) { return ({
|
|
1164
|
+
title: props.title,
|
|
1165
|
+
}); }, {
|
|
1166
|
+
windowWidth: 500,
|
|
1167
|
+
windowHeight: 500,
|
|
1168
|
+
});
|
|
1169
|
+
|
|
1170
|
+
createIcon({
|
|
1171
|
+
color: '#007fb1',
|
|
1172
|
+
networkName: 'linkedin',
|
|
1173
|
+
path: 'M20.4,44h5.4V26.6h-5.4V44z M23.1,18c-1.7,0-3.1,1.4-3.1,3.1c0,1.7,1.4,3.1,3.1,3.1 c1.7,0,3.1-1.4,3.1-3.1C26.2,19.4,24.8,18,23.1,18z M39.5,26.2c-2.6,0-4.4,1.4-5.1,2.8h-0.1v-2.4h-5.2V44h5.4v-8.6 c0-2.3,0.4-4.5,3.2-4.5c2.8,0,2.8,2.6,2.8,4.6V44H46v-9.5C46,29.8,45,26.2,39.5,26.2z',
|
|
1174
|
+
});
|
|
1175
|
+
|
|
1176
|
+
function linkedinLink(url, _a) {
|
|
1177
|
+
var title = _a.title, summary = _a.summary, source = _a.source;
|
|
1178
|
+
assert(url, 'linkedin.url');
|
|
1179
|
+
return ('https://linkedin.com/shareArticle' +
|
|
1180
|
+
objectToGetParams({ url: url, mini: 'true', title: title, summary: summary, source: source }));
|
|
1181
|
+
}
|
|
1182
|
+
createShareButton('linkedin', linkedinLink, function (_a) {
|
|
1183
|
+
var title = _a.title, summary = _a.summary, source = _a.source;
|
|
1184
|
+
return ({ title: title, summary: summary, source: source });
|
|
1185
|
+
}, {
|
|
1186
|
+
windowWidth: 750,
|
|
1187
|
+
windowHeight: 600,
|
|
1188
|
+
});
|
|
1189
|
+
|
|
1190
|
+
createIcon({
|
|
1191
|
+
color: '#21A5D8',
|
|
1192
|
+
networkName: 'livejournal',
|
|
1193
|
+
path: 'M18.3407821,28.1764706 L21.9441341,31.789916 L33.0055865,42.882353 C33.0055865,42.882353 33.0893855,42.9663866 33.0893855,42.9663866 L46.6648046,47 C46.6648046,47 46.6648046,47 46.7486034,47 C46.8324022,47 46.8324022,47 46.9162012,46.9159664 C47,46.8319327 47,46.8319327 47,46.7478991 L42.9776536,33.1344537 C42.9776536,33.1344537 42.9776536,33.1344537 42.8938548,33.0504202 L31.1620111,21.3697479 L31.1620111,21.3697479 L28.1452514,18.2605042 C27.3072626,17.4201681 26.5530726,17 25.7150838,17 C24.2905028,17 23.0335195,18.3445378 21.5251397,19.8571429 C21.273743,20.1092437 20.9385475,20.4453781 20.6871508,20.697479 C20.3519553,21.0336134 20.1005586,21.2857143 19.849162,21.5378151 C18.3407821,22.9663866 17.0837989,24.2268908 17,25.7394958 C17.0837989,26.4957983 17.5027933,27.3361345 18.3407821,28.1764706 Z M39.9012319,39.6134454 C39.7336341,39.4453781 39.4822374,37.6806724 40.2364275,36.8403362 C40.9906174,36.0840337 41.6610084,36 42.1638017,36 C42.3313995,36 42.4989973,36 42.5827961,36 L44.8453659,43.5630253 L43.5883828,44.8235295 L36.0464833,42.5546218 C35.9626843,42.2184874 35.8788855,41.2100841 36.8844722,40.2016807 C37.2196676,39.8655463 37.8900587,39.6134454 38.5604498,39.6134454 C39.147042,39.6134454 39.5660364,39.7815126 39.5660364,39.7815126 C39.6498353,39.8655463 39.8174331,39.8655463 39.8174331,39.7815126 C39.9850307,39.7815126 39.9850307,39.697479 39.9012319,39.6134454 Z',
|
|
1194
|
+
});
|
|
1195
|
+
|
|
1196
|
+
function livejournalLink(url, _a) {
|
|
1197
|
+
var title = _a.title, description = _a.description;
|
|
1198
|
+
assert(url, 'livejournal.url');
|
|
1199
|
+
return ('https://www.livejournal.com/update.bml' +
|
|
1200
|
+
objectToGetParams({
|
|
1201
|
+
subject: title,
|
|
1202
|
+
event: description,
|
|
1203
|
+
}));
|
|
1204
|
+
}
|
|
1205
|
+
createShareButton('livejournal', livejournalLink, function (props) { return ({
|
|
1206
|
+
title: props.title,
|
|
1207
|
+
description: props.description,
|
|
1208
|
+
}); }, {
|
|
1209
|
+
windowWidth: 660,
|
|
1210
|
+
windowHeight: 460,
|
|
1211
|
+
});
|
|
1212
|
+
|
|
1213
|
+
createIcon({
|
|
1214
|
+
color: '#168DE2',
|
|
1215
|
+
networkName: 'mailru',
|
|
1216
|
+
path: 'M39.7107745,17 C41.6619755,17 43.3204965,18.732852 43.3204965,21.0072202 C43.3204965,23.2815885 41.7595357,25.0144404 39.7107745,25.0144404 C37.7595732,25.0144404 36.1010522,23.2815885 36.1010522,21.0072202 C36.1010522,18.732852 37.7595732,17 39.7107745,17 Z M24.3938451,17 C26.3450463,17 28.0035672,18.732852 28.0035672,21.0072202 C28.0035672,23.2815885 26.4426063,25.0144404 24.3938451,25.0144404 C22.4426439,25.0144404 20.7841229,23.2815885 20.7841229,21.0072202 C20.7841229,18.732852 22.4426439,17 24.3938451,17 Z M51.9057817,43.4259928 C51.7106617,44.0758123 51.4179815,44.6173285 50.9301812,44.9422383 C50.637501,45.1588448 50.2472607,45.267148 49.8570205,45.267148 C49.07654,45.267148 48.3936197,44.833935 48.0033795,44.0758123 L46.2472985,40.7184115 L45.759498,41.2599278 C42.5400162,44.9422383 37.466893,47 32.0035297,47 C26.5401664,47 21.5646034,44.9422383 18.2475614,41.2599278 L17.7597611,40.7184115 L16.00368,44.0758123 C15.6134398,44.833935 14.9305194,45.267148 14.1500389,45.267148 C13.7597986,45.267148 13.3695584,45.1588448 13.0768782,44.9422383 C12.0037176,44.2924187 11.7110374,42.7761733 12.2963978,41.5848375 L16.7841605,33.0288807 C17.1744007,32.270758 17.8573211,31.8375453 18.6378016,31.8375453 C19.0280418,31.8375453 19.4182821,31.9458485 19.7109623,32.1624548 C20.7841229,32.8122743 21.0768031,34.3285197 20.4914427,35.5198555 L20.1012025,36.2779783 L20.2963226,36.602888 C22.4426439,39.9602888 27.0279667,42.234657 31.9059697,42.234657 C36.7839727,42.234657 41.3692955,40.068592 43.5156167,36.602888 L43.7107367,36.2779783 L43.3204965,35.6281587 C43.0278165,35.0866425 42.9302562,34.436823 43.1253765,33.7870035 C43.3204965,33.137184 43.6131767,32.5956678 44.100977,32.270758 C44.3936572,32.0541515 44.7838975,31.9458485 45.1741377,31.9458485 C45.9546182,31.9458485 46.6375385,32.3790613 47.0277787,33.137184 L51.5155415,41.6931408 C52.003342,42.234657 52.100902,42.8844765 51.9057817,43.4259928 Z',
|
|
1217
|
+
});
|
|
1218
|
+
|
|
1219
|
+
function mailruLink(url, _a) {
|
|
1220
|
+
var title = _a.title, description = _a.description, imageUrl = _a.imageUrl;
|
|
1221
|
+
assert(url, 'mailru.url');
|
|
1222
|
+
return ('https://connect.mail.ru/share' +
|
|
1223
|
+
objectToGetParams({
|
|
1224
|
+
url: url,
|
|
1225
|
+
title: title,
|
|
1226
|
+
description: description,
|
|
1227
|
+
image_url: imageUrl,
|
|
1228
|
+
}));
|
|
1229
|
+
}
|
|
1230
|
+
createShareButton('mailru', mailruLink, function (props) { return ({
|
|
1231
|
+
title: props.title,
|
|
1232
|
+
description: props.description,
|
|
1233
|
+
imageUrl: props.imageUrl,
|
|
1234
|
+
}); }, {
|
|
1235
|
+
windowWidth: 660,
|
|
1236
|
+
windowHeight: 460,
|
|
1237
|
+
});
|
|
1238
|
+
|
|
1239
|
+
createIcon({
|
|
1240
|
+
color: '#f2720c',
|
|
1241
|
+
networkName: 'ok',
|
|
1242
|
+
path: 'M39,30c-1,0-3,2-7,2s-6-2-7-2c-1.1,0-2,0.9-2,2c0,1,0.6,1.5,1,1.7c1.2,0.7,5,2.3,5,2.3l-4.3,5.4 c0,0-0.8,0.9-0.8,1.6c0,1.1,0.9,2,2,2c1,0,1.5-0.7,1.5-0.7S32,39,32,39c0,0,4.5,5.3,4.5,5.3S37,45,38,45c1.1,0,2-0.9,2-2 c0-0.6-0.8-1.6-0.8-1.6L35,36c0,0,3.8-1.6,5-2.3c0.4-0.3,1-0.7,1-1.7C41,30.9,40.1,30,39,30z M32,15c-3.9,0-7,3.1-7,7s3.1,7,7,7c3.9,0,7-3.1,7-7S35.9,15,32,15z M32,25.5 c-1.9,0-3.5-1.6-3.5-3.5c0-1.9,1.6-3.5,3.5-3.5c1.9,0,3.5,1.6,3.5,3.5C35.5,23.9,33.9,22.5,35,22.5z ',
|
|
1243
|
+
});
|
|
1244
|
+
|
|
1245
|
+
function okLink(url, _a) {
|
|
1246
|
+
var title = _a.title, description = _a.description, image = _a.image;
|
|
1247
|
+
assert(url, 'ok.url');
|
|
1248
|
+
return ('https://connect.ok.ru/offer' +
|
|
1249
|
+
objectToGetParams({
|
|
1250
|
+
url: url,
|
|
1251
|
+
title: title,
|
|
1252
|
+
description: description,
|
|
1253
|
+
imageUrl: image,
|
|
1254
|
+
}));
|
|
1255
|
+
}
|
|
1256
|
+
createShareButton('ok', okLink, function (props) { return ({
|
|
1257
|
+
title: props.title,
|
|
1258
|
+
description: props.description,
|
|
1259
|
+
image: props.image,
|
|
1260
|
+
}); }, {
|
|
1261
|
+
windowWidth: 588,
|
|
1262
|
+
windowHeight: 480,
|
|
1263
|
+
windowPosition: 'screenCenter',
|
|
1264
|
+
});
|
|
1265
|
+
|
|
1266
|
+
function getOKShareCount(shareUrl, callback) {
|
|
1267
|
+
if (!window.OK) {
|
|
1268
|
+
window.OK = {
|
|
1269
|
+
Share: {
|
|
1270
|
+
count: function count(index, _count) {
|
|
1271
|
+
window.OK.callbacks[index](_count);
|
|
1272
|
+
},
|
|
1273
|
+
},
|
|
1274
|
+
callbacks: [],
|
|
1275
|
+
};
|
|
1276
|
+
}
|
|
1277
|
+
var url = 'https://connect.ok.ru/dk';
|
|
1278
|
+
var index = window.OK.callbacks.length;
|
|
1279
|
+
window.ODKL = {
|
|
1280
|
+
updateCount: function (index, count) {
|
|
1281
|
+
var callbackIndex = index === '' ? 0 : parseInt(index.replace('react-share-', ''), 10);
|
|
1282
|
+
window.OK.callbacks[callbackIndex](count === '' ? undefined : parseInt(count, 10));
|
|
1283
|
+
},
|
|
1284
|
+
};
|
|
1285
|
+
window.OK.callbacks.push(callback);
|
|
1286
|
+
return jsonp_1(url +
|
|
1287
|
+
objectToGetParams({
|
|
1288
|
+
'st.cmd': 'extLike',
|
|
1289
|
+
uid: "react-share-" + index,
|
|
1290
|
+
ref: shareUrl,
|
|
1291
|
+
}));
|
|
1292
|
+
}
|
|
1293
|
+
createShareCount(getOKShareCount);
|
|
1294
|
+
|
|
1295
|
+
createIcon({
|
|
1296
|
+
color: '#cb2128',
|
|
1297
|
+
networkName: 'pinterest',
|
|
1298
|
+
path: 'M32,16c-8.8,0-16,7.2-16,16c0,6.6,3.9,12.2,9.6,14.7c0-1.1,0-2.5,0.3-3.7 c0.3-1.3,2.1-8.7,2.1-8.7s-0.5-1-0.5-2.5c0-2.4,1.4-4.1,3.1-4.1c1.5,0,2.2,1.1,2.2,2.4c0,1.5-0.9,3.7-1.4,5.7 c-0.4,1.7,0.9,3.1,2.5,3.1c3,0,5.1-3.9,5.1-8.5c0-3.5-2.4-6.1-6.7-6.1c-4.9,0-7.9,3.6-7.9,7.7c0,1.4,0.4,2.4,1.1,3.1 c0.3,0.3,0.3,0.5,0.2,0.9c-0.1,0.3-0.3,1-0.3,1.3c-0.1,0.4-0.4,0.6-0.8,0.4c-2.2-0.9-3.3-3.4-3.3-6.1c0-4.5,3.8-10,11.4-10 c6.1,0,10.1,4.4,10.1,9.2c0,6.3-3.5,11-8.6,11c-1.7,0-3.4-0.9-3.9-2c0,0-0.9,3.7-1.1,4.4c-0.3,1.2-1,2.5-1.6,3.4 c1.4,0.4,3,0.7,4.5,0.7c8.8,0,16-7.2,16-16C48,23.2,40.8,16,32,16z',
|
|
1299
|
+
});
|
|
1300
|
+
|
|
1301
|
+
function pinterestLink(url, _a) {
|
|
1302
|
+
var media = _a.media, description = _a.description;
|
|
1303
|
+
assert(url, 'pinterest.url');
|
|
1304
|
+
assert(media, 'pinterest.media');
|
|
1305
|
+
return ('https://pinterest.com/pin/create/button/' +
|
|
1306
|
+
objectToGetParams({
|
|
1307
|
+
url: url,
|
|
1308
|
+
media: media,
|
|
1309
|
+
description: description,
|
|
1310
|
+
}));
|
|
1311
|
+
}
|
|
1312
|
+
createShareButton('pinterest', pinterestLink, function (props) { return ({
|
|
1313
|
+
media: props.media,
|
|
1314
|
+
description: props.description,
|
|
1315
|
+
}); }, {
|
|
1316
|
+
windowWidth: 1000,
|
|
1317
|
+
windowHeight: 730,
|
|
1318
|
+
});
|
|
1319
|
+
|
|
1320
|
+
function getPinterestShareCount(shareUrl, callback) {
|
|
1321
|
+
var url = 'https://api.pinterest.com/v1/urls/count.json';
|
|
1322
|
+
jsonp_1(url +
|
|
1323
|
+
objectToGetParams({
|
|
1324
|
+
url: shareUrl,
|
|
1325
|
+
}), function (err, data) {
|
|
1326
|
+
callback(data ? data.count : undefined);
|
|
1327
|
+
});
|
|
1328
|
+
}
|
|
1329
|
+
createShareCount(getPinterestShareCount);
|
|
1330
|
+
|
|
1331
|
+
createIcon({
|
|
1332
|
+
color: '#EF3F56',
|
|
1333
|
+
networkName: 'pocket',
|
|
1334
|
+
path: 'M41.084 29.065l-7.528 7.882a2.104 2.104 0 0 1-1.521.666 2.106 2.106 0 0 1-1.522-.666l-7.528-7.882c-.876-.914-.902-2.43-.065-3.384.84-.955 2.228-.987 3.1-.072l6.015 6.286 6.022-6.286c.88-.918 2.263-.883 3.102.071.841.938.82 2.465-.06 3.383l-.015.002zm6.777-10.976C47.463 16.84 46.361 16 45.14 16H18.905c-1.2 0-2.289.82-2.716 2.044-.125.363-.189.743-.189 1.125v10.539l.112 2.096c.464 4.766 2.73 8.933 6.243 11.838.06.053.125.102.19.153l.04.033c1.882 1.499 3.986 2.514 6.259 3.014a14.662 14.662 0 0 0 6.13.052c.118-.042.235-.065.353-.087.03 0 .065-.022.098-.042a15.395 15.395 0 0 0 6.011-2.945l.039-.045.18-.153c3.502-2.902 5.765-7.072 6.248-11.852L48 29.674v-10.52c0-.366-.041-.728-.161-1.08l.022.015z',
|
|
1335
|
+
});
|
|
1336
|
+
|
|
1337
|
+
function pocketLink(url, _a) {
|
|
1338
|
+
var title = _a.title;
|
|
1339
|
+
assert(url, 'pocket.url');
|
|
1340
|
+
return ('https://getpocket.com/save' +
|
|
1341
|
+
objectToGetParams({
|
|
1342
|
+
url: url,
|
|
1343
|
+
title: title,
|
|
1344
|
+
}));
|
|
1345
|
+
}
|
|
1346
|
+
createShareButton('pocket', pocketLink, function (props) { return ({
|
|
1347
|
+
title: props.title,
|
|
1348
|
+
}); }, {
|
|
1349
|
+
windowWidth: 500,
|
|
1350
|
+
windowHeight: 500,
|
|
1351
|
+
});
|
|
1352
|
+
|
|
1353
|
+
createIcon({
|
|
1354
|
+
color: '#ff4500',
|
|
1355
|
+
networkName: 'reddit',
|
|
1356
|
+
path: 'm 52.8165,31.942362 c 0,-2.4803 -2.0264,-4.4965 -4.5169,-4.4965 -1.2155,0 -2.3171,0.4862 -3.128,1.2682 -3.077,-2.0247 -7.2403,-3.3133 -11.8507,-3.4782 l 2.5211,-7.9373 6.8272,1.5997 -0.0102,0.0986 c 0,2.0281 1.6575,3.6771 3.6958,3.6771 2.0366,0 3.6924,-1.649 3.6924,-3.6771 0,-2.0281 -1.6575,-3.6788 -3.6924,-3.6788 -1.564,0 -2.8968,0.9758 -3.4357,2.3443 l -7.3593,-1.7255 c -0.3213,-0.0782 -0.6477,0.1071 -0.748,0.4233 L 32,25.212062 c -4.8246,0.0578 -9.1953,1.3566 -12.41,3.4425 -0.8058,-0.7446 -1.8751,-1.2104 -3.0583,-1.2104 -2.4905,0 -4.5152,2.0179 -4.5152,4.4982 0,1.649 0.9061,3.0787 2.2389,3.8607 -0.0884,0.4794 -0.1462,0.9639 -0.1462,1.4569 0,6.6487 8.1736,12.0581 18.2223,12.0581 10.0487,0 18.224,-5.4094 18.224,-12.0581 0,-0.4658 -0.0493,-0.9248 -0.1275,-1.377 1.4144,-0.7599 2.3885,-2.2304 2.3885,-3.9406 z m -29.2808,3.0872 c 0,-1.4756 1.207,-2.6775 2.6894,-2.6775 1.4824,0 2.6877,1.2019 2.6877,2.6775 0,1.4756 -1.2053,2.6758 -2.6877,2.6758 -1.4824,0 -2.6894,-1.2002 -2.6894,-2.6758 z m 15.4037,7.9373 c -1.3549,1.3481 -3.4816,2.0043 -6.5008,2.0043 l -0.0221,-0.0051 -0.0221,0.0051 c -3.0209,0 -5.1476,-0.6562 -6.5008,-2.0043 -0.2465,-0.2448 -0.2465,-0.6443 0,-0.8891 0.2465,-0.2465 0.6477,-0.2465 0.8942,0 1.105,1.0999 2.9393,1.6337 5.6066,1.6337 l 0.0221,0.0051 0.0221,-0.0051 c 2.6673,0 4.5016,-0.5355 5.6066,-1.6354 0.2465,-0.2465 0.6477,-0.2448 0.8942,0 0.2465,0.2465 0.2465,0.6443 0,0.8908 z m -0.3213,-5.2615 c -1.4824,0 -2.6877,-1.2002 -2.6877,-2.6758 0,-1.4756 1.2053,-2.6775 2.6877,-2.6775 1.4824,0 2.6877,1.2019 2.6877,2.6775 0,1.4756 -1.2053,2.6758 -2.6877,2.6758 z',
|
|
1357
|
+
});
|
|
1358
|
+
|
|
1359
|
+
function redditLink(url, _a) {
|
|
1360
|
+
var title = _a.title;
|
|
1361
|
+
assert(url, 'reddit.url');
|
|
1362
|
+
return ('https://www.reddit.com/submit' +
|
|
1363
|
+
objectToGetParams({
|
|
1364
|
+
url: url,
|
|
1365
|
+
title: title,
|
|
1366
|
+
}));
|
|
1367
|
+
}
|
|
1368
|
+
createShareButton('reddit', redditLink, function (props) { return ({
|
|
1369
|
+
title: props.title,
|
|
1370
|
+
}); }, {
|
|
1371
|
+
windowWidth: 660,
|
|
1372
|
+
windowHeight: 460,
|
|
1373
|
+
windowPosition: 'windowCenter',
|
|
1374
|
+
});
|
|
1375
|
+
|
|
1376
|
+
function getRedditShareCount(shareUrl, callback) {
|
|
1377
|
+
var endpoint = "https://www.reddit.com/api/info.json?limit=1&url=" + shareUrl;
|
|
1378
|
+
jsonp_1(endpoint, { param: 'jsonp' }, function (err, response) {
|
|
1379
|
+
callback(!err &&
|
|
1380
|
+
response &&
|
|
1381
|
+
response.data &&
|
|
1382
|
+
response.data.children.length > 0 &&
|
|
1383
|
+
response.data.children[0].data.score
|
|
1384
|
+
? response.data.children[0].data.score
|
|
1385
|
+
: undefined);
|
|
1386
|
+
});
|
|
1387
|
+
}
|
|
1388
|
+
createShareCount(getRedditShareCount);
|
|
1389
|
+
|
|
1390
|
+
createIcon({
|
|
1391
|
+
color: '#37aee2',
|
|
1392
|
+
networkName: 'telegram',
|
|
1393
|
+
path: 'm45.90873,15.44335c-0.6901,-0.0281 -1.37668,0.14048 -1.96142,0.41265c-0.84989,0.32661 -8.63939,3.33986 -16.5237,6.39174c-3.9685,1.53296 -7.93349,3.06593 -10.98537,4.24067c-3.05012,1.1765 -5.34694,2.05098 -5.4681,2.09312c-0.80775,0.28096 -1.89996,0.63566 -2.82712,1.72788c-0.23354,0.27218 -0.46884,0.62161 -0.58825,1.10275c-0.11941,0.48114 -0.06673,1.09222 0.16682,1.5716c0.46533,0.96052 1.25376,1.35737 2.18443,1.71383c3.09051,0.99037 6.28638,1.93508 8.93263,2.8236c0.97632,3.44171 1.91401,6.89571 2.84116,10.34268c0.30554,0.69185 0.97105,0.94823 1.65764,0.95525l-0.00351,0.03512c0,0 0.53908,0.05268 1.06412,-0.07375c0.52679,-0.12292 1.18879,-0.42846 1.79109,-0.99212c0.662,-0.62161 2.45836,-2.38812 3.47683,-3.38552l7.6736,5.66477l0.06146,0.03512c0,0 0.84989,0.59703 2.09312,0.68132c0.62161,0.04214 1.4399,-0.07726 2.14229,-0.59176c0.70766,-0.51626 1.1765,-1.34683 1.396,-2.29506c0.65673,-2.86224 5.00979,-23.57745 5.75257,-27.00686l-0.02107,0.08077c0.51977,-1.93157 0.32837,-3.70159 -0.87096,-4.74991c-0.60054,-0.52152 -1.2924,-0.7498 -1.98425,-0.77965l0,0.00176zm-0.2072,3.29069c0.04741,0.0439 0.0439,0.0439 0.00351,0.04741c-0.01229,-0.00351 0.14048,0.2072 -0.15804,1.32576l-0.01229,0.04214l-0.00878,0.03863c-0.75858,3.50668 -5.15554,24.40802 -5.74203,26.96472c-0.08077,0.34417 -0.11414,0.31959 -0.09482,0.29852c-0.1756,-0.02634 -0.50045,-0.16506 -0.52679,-0.1756l-13.13468,-9.70175c4.4988,-4.33199 9.09945,-8.25307 13.744,-12.43229c0.8218,-0.41265 0.68483,-1.68573 -0.29852,-1.70681c-1.04305,0.24584 -1.92279,0.99564 -2.8798,1.47502c-5.49971,3.2626 -11.11882,6.13186 -16.55882,9.49279c-2.792,-0.97105 -5.57873,-1.77704 -8.15298,-2.57601c2.2336,-0.89555 4.00889,-1.55579 5.75608,-2.23009c3.05188,-1.1765 7.01687,-2.7042 10.98537,-4.24067c7.94051,-3.06944 15.92667,-6.16346 16.62028,-6.43037l0.05619,-0.02283l0.05268,-0.02283c0.19316,-0.0878 0.30378,-0.09658 0.35471,-0.10009c0,0 -0.01756,-0.05795 -0.00351,-0.04566l-0.00176,0zm-20.91715,22.0638l2.16687,1.60145c-0.93418,0.91311 -1.81743,1.77353 -2.45485,2.38812l0.28798,-3.98957',
|
|
1394
|
+
});
|
|
1395
|
+
|
|
1396
|
+
function telegramLink(url, _a) {
|
|
1397
|
+
var title = _a.title;
|
|
1398
|
+
assert(url, 'telegram.url');
|
|
1399
|
+
return ('https://telegram.me/share/url' +
|
|
1400
|
+
objectToGetParams({
|
|
1401
|
+
url: url,
|
|
1402
|
+
text: title,
|
|
1403
|
+
}));
|
|
1404
|
+
}
|
|
1405
|
+
createShareButton('telegram', telegramLink, function (props) { return ({
|
|
1406
|
+
title: props.title,
|
|
1407
|
+
}); }, {
|
|
1408
|
+
windowWidth: 550,
|
|
1409
|
+
windowHeight: 400,
|
|
1410
|
+
});
|
|
1411
|
+
|
|
1412
|
+
createIcon({
|
|
1413
|
+
color: '#2c4762',
|
|
1414
|
+
networkName: 'tumblr',
|
|
1415
|
+
path: 'M39.2,41c-0.6,0.3-1.6,0.5-2.4,0.5c-2.4,0.1-2.9-1.7-2.9-3v-9.3h6v-4.5h-6V17c0,0-4.3,0-4.4,0 c-0.1,0-0.2,0.1-0.2,0.2c-0.3,2.3-1.4,6.4-5.9,8.1v3.9h3V39c0,3.4,2.5,8.1,9,8c2.2,0,4.7-1,5.2-1.8L39.2,41z',
|
|
1416
|
+
});
|
|
1417
|
+
|
|
1418
|
+
function tumblrLink(url, _a) {
|
|
1419
|
+
var title = _a.title, caption = _a.caption, tags = _a.tags, posttype = _a.posttype;
|
|
1420
|
+
assert(url, 'tumblr.url');
|
|
1421
|
+
return ('https://www.tumblr.com/widgets/share/tool' +
|
|
1422
|
+
objectToGetParams({
|
|
1423
|
+
canonicalUrl: url,
|
|
1424
|
+
title: title,
|
|
1425
|
+
caption: caption,
|
|
1426
|
+
tags: tags,
|
|
1427
|
+
posttype: posttype,
|
|
1428
|
+
}));
|
|
1429
|
+
}
|
|
1430
|
+
createShareButton('tumblr', tumblrLink, function (props) { return ({
|
|
1431
|
+
title: props.title,
|
|
1432
|
+
tags: (props.tags || []).join(','),
|
|
1433
|
+
caption: props.caption,
|
|
1434
|
+
posttype: props.posttype || 'link',
|
|
1435
|
+
}); }, {
|
|
1436
|
+
windowWidth: 660,
|
|
1437
|
+
windowHeight: 460,
|
|
1438
|
+
});
|
|
1439
|
+
|
|
1440
|
+
function getTumblrShareCount(shareUrl, callback) {
|
|
1441
|
+
var endpoint = 'https://api.tumblr.com/v2/share/stats';
|
|
1442
|
+
return jsonp_1(endpoint +
|
|
1443
|
+
objectToGetParams({
|
|
1444
|
+
url: shareUrl,
|
|
1445
|
+
}), function (err, data) {
|
|
1446
|
+
callback(!err && data && data.response ? data.response.note_count : undefined);
|
|
1447
|
+
});
|
|
1448
|
+
}
|
|
1449
|
+
createShareCount(getTumblrShareCount);
|
|
1450
|
+
|
|
1451
|
+
createIcon({
|
|
1452
|
+
color: '#00aced',
|
|
1453
|
+
networkName: 'twitter',
|
|
1454
|
+
path: 'M48,22.1c-1.2,0.5-2.4,0.9-3.8,1c1.4-0.8,2.4-2.1,2.9-3.6c-1.3,0.8-2.7,1.3-4.2,1.6 C41.7,19.8,40,19,38.2,19c-3.6,0-6.6,2.9-6.6,6.6c0,0.5,0.1,1,0.2,1.5c-5.5-0.3-10.3-2.9-13.5-6.9c-0.6,1-0.9,2.1-0.9,3.3 c0,2.3,1.2,4.3,2.9,5.5c-1.1,0-2.1-0.3-3-0.8c0,0,0,0.1,0,0.1c0,3.2,2.3,5.8,5.3,6.4c-0.6,0.1-1.1,0.2-1.7,0.2c-0.4,0-0.8,0-1.2-0.1 c0.8,2.6,3.3,4.5,6.1,4.6c-2.2,1.8-5.1,2.8-8.2,2.8c-0.5,0-1.1,0-1.6-0.1c2.9,1.9,6.4,2.9,10.1,2.9c12.1,0,18.7-10,18.7-18.7 c0-0.3,0-0.6,0-0.8C46,24.5,47.1,23.4,48,22.1z',
|
|
1455
|
+
});
|
|
1456
|
+
|
|
1457
|
+
function twitterLink(url, _a) {
|
|
1458
|
+
var title = _a.title, via = _a.via, _b = _a.hashtags, hashtags = _b === void 0 ? [] : _b, _c = _a.related, related = _c === void 0 ? [] : _c;
|
|
1459
|
+
assert(url, 'twitter.url');
|
|
1460
|
+
assert(Array.isArray(hashtags), 'twitter.hashtags is not an array');
|
|
1461
|
+
assert(Array.isArray(related), 'twitter.related is not an array');
|
|
1462
|
+
return ('https://twitter.com/share' +
|
|
1463
|
+
objectToGetParams({
|
|
1464
|
+
url: url,
|
|
1465
|
+
text: title,
|
|
1466
|
+
via: via,
|
|
1467
|
+
hashtags: hashtags.length > 0 ? hashtags.join(',') : undefined,
|
|
1468
|
+
related: related.length > 0 ? related.join(',') : undefined,
|
|
1469
|
+
}));
|
|
1470
|
+
}
|
|
1471
|
+
createShareButton('twitter', twitterLink, function (props) { return ({
|
|
1472
|
+
hashtags: props.hashtags,
|
|
1473
|
+
title: props.title,
|
|
1474
|
+
via: props.via,
|
|
1475
|
+
related: props.related,
|
|
1476
|
+
}); }, {
|
|
1477
|
+
windowWidth: 550,
|
|
1478
|
+
windowHeight: 400,
|
|
1479
|
+
});
|
|
1480
|
+
|
|
1481
|
+
createIcon({
|
|
1482
|
+
color: '#7C529E',
|
|
1483
|
+
networkName: 'viber',
|
|
1484
|
+
path: 'm31.0,12.3c9.0,0.2 16.4,6.2 18.0,15.2c0.2,1.5 0.3,3.0 0.4,4.6a1.0,1.0 0 0 1 -0.8,1.2l-0.1,0a1.1,1.1 0 0 1 -1.0,-1.2l0,0c-0.0,-1.2 -0.1,-2.5 -0.3,-3.8a16.1,16.1 0 0 0 -13.0,-13.5c-1.0,-0.1 -2.0,-0.2 -3.0,-0.3c-0.6,-0.0 -1.4,-0.1 -1.6,-0.8a1.1,1.1 0 0 1 0.9,-1.2l0.6,0l0.0,-0.0zm10.6,39.2a19.9,19.9 0 0 1 -2.1,-0.6c-6.9,-2.9 -13.2,-6.6 -18.3,-12.2a47.5,47.5 0 0 1 -7.0,-10.7c-0.8,-1.8 -1.6,-3.7 -2.4,-5.6c-0.6,-1.7 0.3,-3.4 1.4,-4.7a11.3,11.3 0 0 1 3.7,-2.8a2.4,2.4 0 0 1 3.0,0.7a39.0,39.0 0 0 1 4.7,6.5a3.1,3.1 0 0 1 -0.8,4.2c-0.3,0.2 -0.6,0.5 -1.0,0.8a3.3,3.3 0 0 0 -0.7,0.7a2.1,2.1 0 0 0 -0.1,1.9c1.7,4.9 4.7,8.7 9.7,10.8a5.0,5.0 0 0 0 2.5,0.6c1.5,-0.1 2.0,-1.8 3.1,-2.7a2.9,2.9 0 0 1 3.5,-0.1c1.1,0.7 2.2,1.4 3.3,2.2a37.8,37.8 0 0 1 3.1,2.4a2.4,2.4 0 0 1 0.7,3.0a10.4,10.4 0 0 1 -4.4,4.8a10.8,10.8 0 0 1 -1.9,0.6c-0.7,-0.2 0.6,-0.2 0,0l0.0,0l0,-0.0zm3.1,-21.4a4.2,4.2 0 0 1 -0.0,0.6a1.0,1.0 0 0 1 -1.9,0.1a2.7,2.7 0 0 1 -0.1,-0.8a10.9,10.9 0 0 0 -1.4,-5.5a10.2,10.2 0 0 0 -4.2,-4.0a12.3,12.3 0 0 0 -3.4,-1.0c-0.5,-0.0 -1.0,-0.1 -1.5,-0.2a0.9,0.9 0 0 1 -0.9,-1.0l0,-0.1a0.9,0.9 0 0 1 0.9,-0.9l0.1,0a14.1,14.1 0 0 1 5.9,1.5a11.9,11.9 0 0 1 6.5,9.3c0,0.1 0.0,0.3 0.0,0.5c0,0.4 0.0,0.9 0.0,1.5l0,0l0.0,0.0zm-5.6,-0.2a1.1,1.1 0 0 1 -1.2,-0.9l0,-0.1a11.3,11.3 0 0 0 -0.2,-1.4a4.0,4.0 0 0 0 -1.5,-2.3a3.9,3.9 0 0 0 -1.2,-0.5c-0.5,-0.1 -1.1,-0.1 -1.6,-0.2a1.0,1.0 0 0 1 -0.8,-1.1l0,0l0,0a1.0,1.0 0 0 1 1.1,-0.8c3.4,0.2 6.0,2.0 6.3,6.2a2.8,2.8 0 0 1 0,0.8a0.8,0.8 0 0 1 -0.8,0.7l0,0l0.0,-0.0z',
|
|
1485
|
+
});
|
|
1486
|
+
|
|
1487
|
+
function viberLink(url, _a) {
|
|
1488
|
+
var title = _a.title, separator = _a.separator;
|
|
1489
|
+
assert(url, 'viber.url');
|
|
1490
|
+
return ('viber://forward' +
|
|
1491
|
+
objectToGetParams({
|
|
1492
|
+
text: title ? title + separator + url : url,
|
|
1493
|
+
}));
|
|
1494
|
+
}
|
|
1495
|
+
createShareButton('viber', viberLink, function (props) { return ({
|
|
1496
|
+
title: props.title,
|
|
1497
|
+
separator: props.separator || ' ',
|
|
1498
|
+
}); }, {
|
|
1499
|
+
windowWidth: 660,
|
|
1500
|
+
windowHeight: 460,
|
|
1501
|
+
});
|
|
1502
|
+
|
|
1503
|
+
createIcon({
|
|
1504
|
+
color: '#45668e',
|
|
1505
|
+
networkName: 'vk',
|
|
1506
|
+
path: 'M44.94,44.84h-0.2c-2.17-.36-3.66-1.92-4.92-3.37C39.1,40.66,38,38.81,36.7,39c-1.85.3-.93,3.52-1.71,4.9-0.62,1.11-3.29.91-5.12,0.71-5.79-.62-8.75-3.77-11.35-7.14A64.13,64.13,0,0,1,11.6,26a10.59,10.59,0,0,1-1.51-4.49C11,20.7,12.56,21,14.11,21c1.31,0,3.36-.29,4.32.2C19,21.46,19.57,23,20,24a37.18,37.18,0,0,0,3.31,5.82c0.56,0.81,1.41,2.35,2.41,2.14s1.06-2.63,1.1-4.18c0-1.77,0-4-.5-4.9S25,22,24.15,21.47c0.73-1.49,2.72-1.63,5.12-1.63,2,0,4.84-.23,5.62,1.12s0.25,3.85.2,5.71c-0.06,2.09-.41,4.25,1,5.21,1.09-.12,1.68-1.2,2.31-2A28,28,0,0,0,41.72,24c0.44-1,.91-2.65,1.71-3,1.21-.47,3.15-0.1,4.92-0.1,1.46,0,4.05-.41,4.52.61,0.39,0.85-.75,3-1.1,3.57a61.88,61.88,0,0,1-4.12,5.61c-0.58.78-1.78,2-1.71,3.27,0.05,0.94,1,1.67,1.71,2.35a33.12,33.12,0,0,1,3.92,4.18c0.47,0.62,1.5,2,1.4,2.76C52.66,45.81,46.88,44.24,44.94,44.84Z',
|
|
1507
|
+
});
|
|
1508
|
+
|
|
1509
|
+
function vkLink(url, _a) {
|
|
1510
|
+
var title = _a.title, image = _a.image, noParse = _a.noParse, noVkLinks = _a.noVkLinks;
|
|
1511
|
+
assert(url, 'vk.url');
|
|
1512
|
+
return ('https://vk.com/share.php' +
|
|
1513
|
+
objectToGetParams({
|
|
1514
|
+
url: url,
|
|
1515
|
+
title: title,
|
|
1516
|
+
image: image,
|
|
1517
|
+
noparse: noParse ? 1 : 0,
|
|
1518
|
+
no_vk_links: noVkLinks ? 1 : 0,
|
|
1519
|
+
}));
|
|
1520
|
+
}
|
|
1521
|
+
createShareButton('vk', vkLink, function (props) { return ({
|
|
1522
|
+
title: props.title,
|
|
1523
|
+
image: props.image,
|
|
1524
|
+
noParse: props.noParse,
|
|
1525
|
+
noVkLinks: props.noVkLinks,
|
|
1526
|
+
}); }, {
|
|
1527
|
+
windowWidth: 660,
|
|
1528
|
+
windowHeight: 460,
|
|
1529
|
+
});
|
|
1530
|
+
|
|
1531
|
+
function getVKShareCount(shareUrl, callback) {
|
|
1532
|
+
if (!window.VK)
|
|
1533
|
+
window.VK = {};
|
|
1534
|
+
window.VK.Share = {
|
|
1535
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
1536
|
+
count: function (index, count) { return window.VK.callbacks[index](count); },
|
|
1537
|
+
};
|
|
1538
|
+
window.VK.callbacks = [];
|
|
1539
|
+
var url = 'https://vk.com/share.php';
|
|
1540
|
+
var index = window.VK.callbacks.length;
|
|
1541
|
+
window.VK.callbacks.push(callback);
|
|
1542
|
+
return jsonp_1(url +
|
|
1543
|
+
objectToGetParams({
|
|
1544
|
+
act: 'count',
|
|
1545
|
+
index: index,
|
|
1546
|
+
url: shareUrl,
|
|
1547
|
+
}));
|
|
1548
|
+
}
|
|
1549
|
+
createShareCount(getVKShareCount);
|
|
1550
|
+
|
|
1551
|
+
createIcon({
|
|
1552
|
+
color: '#CD201F',
|
|
1553
|
+
networkName: 'weibo',
|
|
1554
|
+
path: 'M40.9756152,15.0217119 C40.5000732,15.0546301 39.9999314,15.1204666 39.5325878,15.2192213 C38.6634928,15.4085016 38.0977589,16.2643757 38.2863368,17.1284787 C38.4667163,18.0008129 39.3194143,18.5686519 40.1885094,18.3793715 C42.8613908,17.8115326 45.7720411,18.6427174 47.7316073,20.8153207 C49.6911735,22.996153 50.2077122,25.975254 49.3714112,28.5840234 C49.1008441,29.4316684 49.5763861,30.3533789 50.4208857,30.6249537 C51.2653852,30.8965286 52.1754769,30.4192153 52.4542425,29.5715703 C53.6349013,25.9011885 52.9133876,21.7699494 50.1585171,18.7085538 C48.0923641,16.4042776 45.2063093,15.1533848 42.3530505,15.0217119 C41.8775084,14.9970227 41.4511594,14.9887937 40.9756152,15.0217119 Z M27.9227762,19.8277737 C24.9957268,20.140498 20.863421,22.4365431 17.2312548,26.0822378 C13.2711279,30.0571148 11,34.2871065 11,37.9328012 C11,44.9032373 19.8713401,49.125 28.5786978,49.125 C39.9917329,49.125 47.600423,42.4261409 47.600423,37.1427636 C47.600423,33.9496952 44.9603397,32.1638816 42.549827,31.4149913 C41.9594976,31.2339421 41.5167516,31.1434164 41.8283133,30.3616079 C42.5006339,28.66632 42.6236176,27.1932286 41.8939054,26.1480742 C40.5328692,24.1894405 36.7203236,24.2881952 32.448635,26.0822378 C32.448635,26.0822378 31.1203949,26.6912261 31.4647526,25.6213825 C32.1206742,23.4981576 32.0304845,21.712342 31.0056075,20.6836478 C30.2840938,19.9512176 29.2510184,19.6878718 27.9227762,19.8277737 Z M42.0906819,20.6836478 C41.6233383,20.6589586 41.1723917,20.716566 40.7132466,20.8153207 C39.9671353,20.9716828 39.4997917,21.7781784 39.6637721,22.5270687 C39.8277525,23.275959 40.5574647,23.7450433 41.303576,23.5804521 C42.1972686,23.3911718 43.2057485,23.6380596 43.8616701,24.3704897 C44.5175916,25.1029198 44.6733735,26.0657797 44.3864073,26.9381118 C44.1486363,27.6705419 44.5093932,28.4770397 45.2391054,28.7156963 C45.9688176,28.9461239 46.780521,28.5922524 47.0100936,27.8598223 C47.584026,26.0740087 47.2396661,24.0248493 45.8950269,22.5270687 C44.886547,21.4078489 43.4845162,20.7494842 42.0906819,20.6836478 Z M29.496988,29.9665891 C35.3100922,30.1723275 39.9917329,33.0691319 40.3852858,37.0769272 C40.8362324,41.6607904 35.5970585,45.9319315 28.6442899,46.6232144 C21.6915214,47.3144973 15.6488446,44.154347 15.197898,39.5787128 C14.7469514,34.9948495 20.059916,30.7237084 27.004486,30.0324256 C27.8735831,29.950131 28.6688875,29.9336709 29.496988,29.9665891 Z M25.5614586,34.3776322 C23.183744,34.5916017 20.9372116,35.9577073 19.9205332,37.9328012 C18.5348994,40.6238672 19.9041362,43.6029661 23.0689567,44.582284 C26.340366,45.5945202 30.1857056,44.0638213 31.5303448,41.1587879 C32.8503864,38.3195909 31.1613894,35.3734082 27.9227762,34.5751416 C27.1438688,34.3776322 26.356763,34.3035667 25.5614586,34.3776322 Z M24.052839,38.7228388 C24.3316067,38.7310678 24.5857748,38.8215935 24.8399449,38.9203482 C25.8648218,39.3400561 26.1845841,40.4428158 25.5614586,41.4221338 C24.9219361,42.3932227 23.5690963,42.8623069 22.5442194,42.4096807 C21.5357395,41.9652856 21.2487754,40.8542948 21.8882979,39.9078951 C22.3638421,39.2001542 23.2247386,38.7146097 24.052839,38.7228388 Z',
|
|
1555
|
+
});
|
|
1556
|
+
|
|
1557
|
+
function weiboLink(url, _a) {
|
|
1558
|
+
var title = _a.title, image = _a.image;
|
|
1559
|
+
assert(url, 'weibo.url');
|
|
1560
|
+
return ('http://service.weibo.com/share/share.php' +
|
|
1561
|
+
objectToGetParams({
|
|
1562
|
+
url: url,
|
|
1563
|
+
title: title,
|
|
1564
|
+
pic: image,
|
|
1565
|
+
}));
|
|
1566
|
+
}
|
|
1567
|
+
createShareButton('weibo', weiboLink, function (props) { return ({
|
|
1568
|
+
title: props.title,
|
|
1569
|
+
image: props.image,
|
|
1570
|
+
}); }, {
|
|
1571
|
+
windowWidth: 660,
|
|
1572
|
+
windowHeight: 550,
|
|
1573
|
+
windowPosition: 'screenCenter',
|
|
1574
|
+
});
|
|
1575
|
+
|
|
1576
|
+
createIcon({
|
|
1577
|
+
color: '#25D366',
|
|
1578
|
+
networkName: 'whatsapp',
|
|
1579
|
+
path: 'm42.32286,33.93287c-0.5178,-0.2589 -3.04726,-1.49644 -3.52105,-1.66732c-0.4712,-0.17346 -0.81554,-0.2589 -1.15987,0.2589c-0.34175,0.51004 -1.33075,1.66474 -1.63108,2.00648c-0.30032,0.33658 -0.60064,0.36247 -1.11327,0.12945c-0.5178,-0.2589 -2.17994,-0.80259 -4.14759,-2.56312c-1.53269,-1.37217 -2.56312,-3.05503 -2.86603,-3.57283c-0.30033,-0.5178 -0.03366,-0.80259 0.22524,-1.06149c0.23301,-0.23301 0.5178,-0.59547 0.7767,-0.90616c0.25372,-0.31068 0.33657,-0.5178 0.51262,-0.85437c0.17088,-0.36246 0.08544,-0.64725 -0.04402,-0.90615c-0.12945,-0.2589 -1.15987,-2.79613 -1.58964,-3.80584c-0.41424,-1.00971 -0.84142,-0.88027 -1.15987,-0.88027c-0.29773,-0.02588 -0.64208,-0.02588 -0.98382,-0.02588c-0.34693,0 -0.90616,0.12945 -1.37736,0.62136c-0.4712,0.5178 -1.80194,1.76053 -1.80194,4.27186c0,2.51134 1.84596,4.945 2.10227,5.30747c0.2589,0.33657 3.63497,5.51458 8.80262,7.74113c1.23237,0.5178 2.1903,0.82848 2.94111,1.08738c1.23237,0.38836 2.35599,0.33657 3.24402,0.20712c0.99159,-0.15534 3.04985,-1.24272 3.47963,-2.45956c0.44013,-1.21683 0.44013,-2.22654 0.31068,-2.45955c-0.12945,-0.23301 -0.46601,-0.36247 -0.98382,-0.59548m-9.40068,12.84407l-0.02589,0c-3.05503,0 -6.08417,-0.82849 -8.72495,-2.38189l-0.62136,-0.37023l-6.47252,1.68286l1.73463,-6.29129l-0.41424,-0.64725c-1.70875,-2.71846 -2.6149,-5.85116 -2.6149,-9.07706c0,-9.39809 7.68934,-17.06155 17.15993,-17.06155c4.58253,0 8.88029,1.78642 12.11655,5.02268c3.23625,3.21036 5.02267,7.50812 5.02267,12.06476c-0.0078,9.3981 -7.69712,17.06155 -17.14699,17.06155m14.58906,-31.58846c-3.93529,-3.80584 -9.1133,-5.95471 -14.62789,-5.95471c-11.36055,0 -20.60848,9.2065 -20.61625,20.52564c0,3.61684 0.94757,7.14565 2.75211,10.26282l-2.92557,10.63564l10.93337,-2.85309c3.0136,1.63108 6.4052,2.4958 9.85634,2.49839l0.01037,0c11.36574,0 20.61884,-9.2091 20.62403,-20.53082c0,-5.48093 -2.14111,-10.64081 -6.03239,-14.51915',
|
|
1580
|
+
});
|
|
1581
|
+
|
|
1582
|
+
function isMobileOrTablet() {
|
|
1583
|
+
return /(android|iphone|ipad|mobile)/i.test(navigator.userAgent);
|
|
1584
|
+
}
|
|
1585
|
+
function whatsappLink(url, _a) {
|
|
1586
|
+
var title = _a.title, separator = _a.separator;
|
|
1587
|
+
assert(url, 'whatsapp.url');
|
|
1588
|
+
return ('https://' +
|
|
1589
|
+
(isMobileOrTablet() ? 'api' : 'web') +
|
|
1590
|
+
'.whatsapp.com/send' +
|
|
1591
|
+
objectToGetParams({
|
|
1592
|
+
text: title ? title + separator + url : url,
|
|
1593
|
+
}));
|
|
1594
|
+
}
|
|
1595
|
+
createShareButton('whatsapp', whatsappLink, function (props) { return ({
|
|
1596
|
+
title: props.title,
|
|
1597
|
+
separator: props.separator || ' ',
|
|
1598
|
+
}); }, {
|
|
1599
|
+
windowWidth: 550,
|
|
1600
|
+
windowHeight: 400,
|
|
1601
|
+
});
|
|
1602
|
+
|
|
1603
|
+
createIcon({
|
|
1604
|
+
color: '#3b3d4a',
|
|
1605
|
+
networkName: 'workplace',
|
|
1606
|
+
path: 'M34.019,10.292c0.21,0.017,0.423,0.034,0.636,0.049 c3.657,0.262,6.976,1.464,9.929,3.635c3.331,2.448,5.635,5.65,6.914,9.584c0.699,2.152,0.983,4.365,0.885,6.623 c-0.136,3.171-1.008,6.13-2.619,8.867c-0.442,0.75-0.908,1.492-1.495,2.141c-0.588,0.651-1.29,1.141-2.146,1.383 c-1.496,0.426-3.247-0.283-3.961-1.642c-0.26-0.494-0.442-1.028-0.654-1.548c-1.156-2.838-2.311-5.679-3.465-8.519 c-0.017-0.042-0.037-0.082-0.065-0.145c-0.101,0.245-0.192,0.472-0.284,0.698c-1.237,3.051-2.475,6.103-3.711,9.155 c-0.466,1.153-1.351,1.815-2.538,2.045c-1.391,0.267-2.577-0.154-3.496-1.247c-0.174-0.209-0.31-0.464-0.415-0.717 c-2.128-5.22-4.248-10.442-6.37-15.665c-0.012-0.029-0.021-0.059-0.036-0.104c0.054-0.003,0.103-0.006,0.15-0.006 c1.498-0.001,2.997,0,4.495-0.004c0.12-0.001,0.176,0.03,0.222,0.146c1.557,3.846,3.117,7.691,4.679,11.536 c0.018,0.046,0.039,0.091,0.067,0.159c0.273-0.673,0.536-1.32,0.797-1.968c1.064-2.627,2.137-5.25,3.19-7.883 c0.482-1.208,1.376-1.917,2.621-2.135c1.454-0.255,2.644,0.257,3.522,1.449c0.133,0.18,0.229,0.393,0.313,0.603 c1.425,3.495,2.848,6.991,4.269,10.488c0.02,0.047,0.04,0.093,0.073,0.172c0.196-0.327,0.385-0.625,0.559-0.935 c0.783-1.397,1.323-2.886,1.614-4.461c0.242-1.312,0.304-2.634,0.187-3.962c-0.242-2.721-1.16-5.192-2.792-7.38 c-2.193-2.939-5.086-4.824-8.673-5.625c-1.553-0.346-3.124-0.405-4.705-0.257c-3.162,0.298-6.036,1.366-8.585,3.258 c-3.414,2.534-5.638,5.871-6.623,10.016c-0.417,1.76-0.546,3.547-0.384,5.348c0.417,4.601,2.359,8.444,5.804,11.517 c2.325,2.073,5.037,3.393,8.094,3.989c1.617,0.317,3.247,0.395,4.889,0.242c1-0.094,1.982-0.268,2.952-0.529 c0.04-0.01,0.081-0.018,0.128-0.028c0,1.526,0,3.047,0,4.586c-0.402,0.074-0.805,0.154-1.21,0.221 c-0.861,0.14-1.728,0.231-2.601,0.258c-0.035,0.002-0.071,0.013-0.108,0.021c-0.493,0-0.983,0-1.476,0 c-0.049-0.007-0.1-0.018-0.149-0.022c-0.315-0.019-0.629-0.033-0.945-0.058c-1.362-0.105-2.702-0.346-4.017-0.716 c-3.254-0.914-6.145-2.495-8.66-4.752c-2.195-1.971-3.926-4.29-5.176-6.963c-1.152-2.466-1.822-5.057-1.993-7.774 c-0.014-0.226-0.033-0.451-0.05-0.676c0-0.502,0-1.003,0-1.504c0.008-0.049,0.02-0.099,0.022-0.148 c0.036-1.025,0.152-2.043,0.338-3.052c0.481-2.616,1.409-5.066,2.8-7.331c2.226-3.625,5.25-6.386,9.074-8.254 c2.536-1.24,5.217-1.947,8.037-2.126c0.23-0.015,0.461-0.034,0.691-0.051C33.052,10.292,33.535,10.292,34.019,10.292z',
|
|
1607
|
+
});
|
|
1608
|
+
|
|
1609
|
+
function workplaceLink(url, _a) {
|
|
1610
|
+
var quote = _a.quote, hashtag = _a.hashtag;
|
|
1611
|
+
assert(url, 'workplace.url');
|
|
1612
|
+
return ('https://work.facebook.com/sharer.php' +
|
|
1613
|
+
objectToGetParams({
|
|
1614
|
+
u: url,
|
|
1615
|
+
quote: quote,
|
|
1616
|
+
hashtag: hashtag,
|
|
1617
|
+
}));
|
|
1618
|
+
}
|
|
1619
|
+
createShareButton('workplace', workplaceLink, function (props) { return ({
|
|
1620
|
+
quote: props.quote,
|
|
1621
|
+
hashtag: props.hashtag,
|
|
1622
|
+
}); }, {
|
|
1623
|
+
windowWidth: 550,
|
|
1624
|
+
windowHeight: 400,
|
|
1625
|
+
});
|
|
1626
|
+
|
|
1627
|
+
var screenfull$1 = {exports: {}};
|
|
1628
|
+
|
|
1629
|
+
/*!
|
|
1630
|
+
* screenfull
|
|
1631
|
+
* v5.2.0 - 2021-11-03
|
|
1632
|
+
* (c) Sindre Sorhus; MIT License
|
|
1633
|
+
*/
|
|
1634
|
+
|
|
1635
|
+
(function (module) {
|
|
1636
|
+
(function () {
|
|
1637
|
+
|
|
1638
|
+
var document = typeof window !== 'undefined' && typeof window.document !== 'undefined' ? window.document : {};
|
|
1639
|
+
var isCommonjs = module.exports;
|
|
1640
|
+
|
|
1641
|
+
var fn = (function () {
|
|
1642
|
+
var val;
|
|
1643
|
+
|
|
1644
|
+
var fnMap = [
|
|
1645
|
+
[
|
|
1646
|
+
'requestFullscreen',
|
|
1647
|
+
'exitFullscreen',
|
|
1648
|
+
'fullscreenElement',
|
|
1649
|
+
'fullscreenEnabled',
|
|
1650
|
+
'fullscreenchange',
|
|
1651
|
+
'fullscreenerror'
|
|
1652
|
+
],
|
|
1653
|
+
// New WebKit
|
|
1654
|
+
[
|
|
1655
|
+
'webkitRequestFullscreen',
|
|
1656
|
+
'webkitExitFullscreen',
|
|
1657
|
+
'webkitFullscreenElement',
|
|
1658
|
+
'webkitFullscreenEnabled',
|
|
1659
|
+
'webkitfullscreenchange',
|
|
1660
|
+
'webkitfullscreenerror'
|
|
1661
|
+
|
|
1662
|
+
],
|
|
1663
|
+
// Old WebKit
|
|
1664
|
+
[
|
|
1665
|
+
'webkitRequestFullScreen',
|
|
1666
|
+
'webkitCancelFullScreen',
|
|
1667
|
+
'webkitCurrentFullScreenElement',
|
|
1668
|
+
'webkitCancelFullScreen',
|
|
1669
|
+
'webkitfullscreenchange',
|
|
1670
|
+
'webkitfullscreenerror'
|
|
1671
|
+
|
|
1672
|
+
],
|
|
1673
|
+
[
|
|
1674
|
+
'mozRequestFullScreen',
|
|
1675
|
+
'mozCancelFullScreen',
|
|
1676
|
+
'mozFullScreenElement',
|
|
1677
|
+
'mozFullScreenEnabled',
|
|
1678
|
+
'mozfullscreenchange',
|
|
1679
|
+
'mozfullscreenerror'
|
|
1680
|
+
],
|
|
1681
|
+
[
|
|
1682
|
+
'msRequestFullscreen',
|
|
1683
|
+
'msExitFullscreen',
|
|
1684
|
+
'msFullscreenElement',
|
|
1685
|
+
'msFullscreenEnabled',
|
|
1686
|
+
'MSFullscreenChange',
|
|
1687
|
+
'MSFullscreenError'
|
|
1688
|
+
]
|
|
1689
|
+
];
|
|
1690
|
+
|
|
1691
|
+
var i = 0;
|
|
1692
|
+
var l = fnMap.length;
|
|
1693
|
+
var ret = {};
|
|
1694
|
+
|
|
1695
|
+
for (; i < l; i++) {
|
|
1696
|
+
val = fnMap[i];
|
|
1697
|
+
if (val && val[1] in document) {
|
|
1698
|
+
for (i = 0; i < val.length; i++) {
|
|
1699
|
+
ret[fnMap[0][i]] = val[i];
|
|
1700
|
+
}
|
|
1701
|
+
return ret;
|
|
1702
|
+
}
|
|
1703
|
+
}
|
|
1704
|
+
|
|
1705
|
+
return false;
|
|
1706
|
+
})();
|
|
1707
|
+
|
|
1708
|
+
var eventNameMap = {
|
|
1709
|
+
change: fn.fullscreenchange,
|
|
1710
|
+
error: fn.fullscreenerror
|
|
1711
|
+
};
|
|
1712
|
+
|
|
1713
|
+
var screenfull = {
|
|
1714
|
+
request: function (element, options) {
|
|
1715
|
+
return new Promise(function (resolve, reject) {
|
|
1716
|
+
var onFullScreenEntered = function () {
|
|
1717
|
+
this.off('change', onFullScreenEntered);
|
|
1718
|
+
resolve();
|
|
1719
|
+
}.bind(this);
|
|
1720
|
+
|
|
1721
|
+
this.on('change', onFullScreenEntered);
|
|
1722
|
+
|
|
1723
|
+
element = element || document.documentElement;
|
|
1724
|
+
|
|
1725
|
+
var returnPromise = element[fn.requestFullscreen](options);
|
|
1726
|
+
|
|
1727
|
+
if (returnPromise instanceof Promise) {
|
|
1728
|
+
returnPromise.then(onFullScreenEntered).catch(reject);
|
|
1729
|
+
}
|
|
1730
|
+
}.bind(this));
|
|
1731
|
+
},
|
|
1732
|
+
exit: function () {
|
|
1733
|
+
return new Promise(function (resolve, reject) {
|
|
1734
|
+
if (!this.isFullscreen) {
|
|
1735
|
+
resolve();
|
|
1736
|
+
return;
|
|
1737
|
+
}
|
|
1738
|
+
|
|
1739
|
+
var onFullScreenExit = function () {
|
|
1740
|
+
this.off('change', onFullScreenExit);
|
|
1741
|
+
resolve();
|
|
1742
|
+
}.bind(this);
|
|
1743
|
+
|
|
1744
|
+
this.on('change', onFullScreenExit);
|
|
1745
|
+
|
|
1746
|
+
var returnPromise = document[fn.exitFullscreen]();
|
|
1747
|
+
|
|
1748
|
+
if (returnPromise instanceof Promise) {
|
|
1749
|
+
returnPromise.then(onFullScreenExit).catch(reject);
|
|
1750
|
+
}
|
|
1751
|
+
}.bind(this));
|
|
1752
|
+
},
|
|
1753
|
+
toggle: function (element, options) {
|
|
1754
|
+
return this.isFullscreen ? this.exit() : this.request(element, options);
|
|
1755
|
+
},
|
|
1756
|
+
onchange: function (callback) {
|
|
1757
|
+
this.on('change', callback);
|
|
1758
|
+
},
|
|
1759
|
+
onerror: function (callback) {
|
|
1760
|
+
this.on('error', callback);
|
|
1761
|
+
},
|
|
1762
|
+
on: function (event, callback) {
|
|
1763
|
+
var eventName = eventNameMap[event];
|
|
1764
|
+
if (eventName) {
|
|
1765
|
+
document.addEventListener(eventName, callback, false);
|
|
1766
|
+
}
|
|
1767
|
+
},
|
|
1768
|
+
off: function (event, callback) {
|
|
1769
|
+
var eventName = eventNameMap[event];
|
|
1770
|
+
if (eventName) {
|
|
1771
|
+
document.removeEventListener(eventName, callback, false);
|
|
1772
|
+
}
|
|
1773
|
+
},
|
|
1774
|
+
raw: fn
|
|
1775
|
+
};
|
|
1776
|
+
|
|
1777
|
+
if (!fn) {
|
|
1778
|
+
if (isCommonjs) {
|
|
1779
|
+
module.exports = {isEnabled: false};
|
|
1780
|
+
} else {
|
|
1781
|
+
window.screenfull = {isEnabled: false};
|
|
1782
|
+
}
|
|
1783
|
+
|
|
1784
|
+
return;
|
|
1785
|
+
}
|
|
1786
|
+
|
|
1787
|
+
Object.defineProperties(screenfull, {
|
|
1788
|
+
isFullscreen: {
|
|
1789
|
+
get: function () {
|
|
1790
|
+
return Boolean(document[fn.fullscreenElement]);
|
|
1791
|
+
}
|
|
1792
|
+
},
|
|
1793
|
+
element: {
|
|
1794
|
+
enumerable: true,
|
|
1795
|
+
get: function () {
|
|
1796
|
+
return document[fn.fullscreenElement];
|
|
1797
|
+
}
|
|
1798
|
+
},
|
|
1799
|
+
isEnabled: {
|
|
1800
|
+
enumerable: true,
|
|
1801
|
+
get: function () {
|
|
1802
|
+
// Coerce to boolean in case of old WebKit
|
|
1803
|
+
return Boolean(document[fn.fullscreenEnabled]);
|
|
1804
|
+
}
|
|
1805
|
+
}
|
|
1806
|
+
});
|
|
1807
|
+
|
|
1808
|
+
if (isCommonjs) {
|
|
1809
|
+
module.exports = screenfull;
|
|
1810
|
+
} else {
|
|
1811
|
+
window.screenfull = screenfull;
|
|
1812
|
+
}
|
|
1813
|
+
})();
|
|
1814
|
+
} (screenfull$1));
|
|
1815
|
+
|
|
1816
|
+
var screenfull = screenfull$1.exports;
|
|
1817
|
+
|
|
1818
|
+
var bundle = {exports: {}};
|
|
1819
|
+
|
|
1820
|
+
(function (module, exports) {
|
|
1821
|
+
!function(e,t){module.exports=t();}(window,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r});},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0});},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=8)}([function(e,t,n){e.exports=n(2);},function(e,t,n){var r=n(4);"string"==typeof r&&(r=[[e.i,r,""]]);var o={hmr:!0,transform:void 0,insertInto:void 0};n(6)(r,o);r.locals&&(e.exports=r.locals);},function(e,t,n){ /** @license React v16.5.2
|
|
1822
|
+
* react.production.min.js
|
|
1823
|
+
*
|
|
1824
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
1825
|
+
*
|
|
1826
|
+
* This source code is licensed under the MIT license found in the
|
|
1827
|
+
* LICENSE file in the root directory of this source tree.
|
|
1828
|
+
*/var r=n(3),o="function"==typeof Symbol&&Symbol.for,i=o?Symbol.for("react.element"):60103,u=o?Symbol.for("react.portal"):60106,a=o?Symbol.for("react.fragment"):60107,c=o?Symbol.for("react.strict_mode"):60108,l=o?Symbol.for("react.profiler"):60114,s=o?Symbol.for("react.provider"):60109,f=o?Symbol.for("react.context"):60110,p=o?Symbol.for("react.async_mode"):60111,d=o?Symbol.for("react.forward_ref"):60112;var y="function"==typeof Symbol&&Symbol.iterator;function h(e){for(var t=arguments.length-1,n="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=0;r<t;r++)n+="&args[]="+encodeURIComponent(arguments[r+1]);!function(e,t,n,r,o,i,u,a){if(!e){if(e=void 0,void 0===t)e=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else {var c=[n,r,o,i,u,a],l=0;(e=Error(t.replace(/%s/g,function(){return c[l++]}))).name="Invariant Violation";}throw e.framesToPop=1,e}}(!1,"Minified React error #"+e+"; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ",n);}var v={isMounted:function(){return !1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},b={};function g(e,t,n){this.props=e,this.context=t,this.refs=b,this.updater=n||v;}function m(){}function S(e,t,n){this.props=e,this.context=t,this.refs=b,this.updater=n||v;}g.prototype.isReactComponent={},g.prototype.setState=function(e,t){"object"!=typeof e&&"function"!=typeof e&&null!=e&&h("85"),this.updater.enqueueSetState(this,e,t,"setState");},g.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate");},m.prototype=g.prototype;var w=S.prototype=new m;w.constructor=S,r(w,g.prototype),w.isPureReactComponent=!0;var C={current:null,currentDispatcher:null},x=Object.prototype.hasOwnProperty,O={key:!0,ref:!0,__self:!0,__source:!0};function j(e,t,n){var r=void 0,o={},u=null,a=null;if(null!=t)for(r in void 0!==t.ref&&(a=t.ref),void 0!==t.key&&(u=""+t.key),t)x.call(t,r)&&!O.hasOwnProperty(r)&&(o[r]=t[r]);var c=arguments.length-2;if(1===c)o.children=n;else if(1<c){for(var l=Array(c),s=0;s<c;s++)l[s]=arguments[s+2];o.children=l;}if(e&&e.defaultProps)for(r in c=e.defaultProps)void 0===o[r]&&(o[r]=c[r]);return {$$typeof:i,type:e,key:u,ref:a,props:o,_owner:C.current}}function k(e){return "object"==typeof e&&null!==e&&e.$$typeof===i}var _=/\/+/g,z=[];function E(e,t,n,r){if(z.length){var o=z.pop();return o.result=e,o.keyPrefix=t,o.func=n,o.context=r,o.count=0,o}return {result:e,keyPrefix:t,func:n,context:r,count:0}}function P(e){e.result=null,e.keyPrefix=null,e.func=null,e.context=null,e.count=0,10>z.length&&z.push(e);}function R(e,t,n){return null==e?0:function e(t,n,r,o){var a=typeof t;"undefined"!==a&&"boolean"!==a||(t=null);var c=!1;if(null===t)c=!0;else switch(a){case"string":case"number":c=!0;break;case"object":switch(t.$$typeof){case i:case u:c=!0;}}if(c)return r(o,t,""===n?"."+F(t,0):n),1;if(c=0,n=""===n?".":n+":",Array.isArray(t))for(var l=0;l<t.length;l++){var s=n+F(a=t[l],l);c+=e(a,s,r,o);}else if(s=null===t||"object"!=typeof t?null:"function"==typeof(s=y&&t[y]||t["@@iterator"])?s:null,"function"==typeof s)for(t=s.call(t),l=0;!(a=t.next()).done;)c+=e(a=a.value,s=n+F(a,l++),r,o);else "object"===a&&h("31","[object Object]"==(r=""+t)?"object with keys {"+Object.keys(t).join(", ")+"}":r,"");return c}(e,"",t,n)}function F(e,t){return "object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return "$"+(""+e).replace(/[=:]/g,function(e){return t[e]})}(e.key):t.toString(36)}function A(e,t){e.func.call(e.context,t,e.count++);}function U(e,t,n){var r=e.result,o=e.keyPrefix;e=e.func.call(e.context,t,e.count++),Array.isArray(e)?D(e,r,n,function(e){return e}):null!=e&&(k(e)&&(e=function(e,t){return {$$typeof:i,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(e,o+(!e.key||t&&t.key===e.key?"":(""+e.key).replace(_,"$&/")+"/")+n)),r.push(e));}function D(e,t,n,r,o){var i="";null!=n&&(i=(""+n).replace(_,"$&/")+"/"),R(e,U,t=E(t,i,r,o)),P(t);}var M={Children:{map:function(e,t,n){if(null==e)return e;var r=[];return D(e,r,null,t,n),r},forEach:function(e,t,n){if(null==e)return e;R(e,A,t=E(null,null,t,n)),P(t);},count:function(e){return R(e,function(){return null},null)},toArray:function(e){var t=[];return D(e,t,null,function(e){return e}),t},only:function(e){return k(e)||h("143"),e}},createRef:function(){return {current:null}},Component:g,PureComponent:S,createContext:function(e,t){return void 0===t&&(t=null),(e={$$typeof:f,_calculateChangedBits:t,_currentValue:e,_currentValue2:e,Provider:null,Consumer:null,unstable_read:null}).Provider={$$typeof:s,_context:e},e.Consumer=e,e.unstable_read=function(e,t){var n=C.currentDispatcher;return null===n&&h("277"),n.readContext(e,t)}.bind(null,e),e},forwardRef:function(e){return {$$typeof:d,render:e}},Fragment:a,StrictMode:c,unstable_AsyncMode:p,unstable_Profiler:l,createElement:j,cloneElement:function(e,t,n){(null===e||void 0===e)&&h("267",e);var o=void 0,u=r({},e.props),a=e.key,c=e.ref,l=e._owner;if(null!=t){void 0!==t.ref&&(c=t.ref,l=C.current),void 0!==t.key&&(a=""+t.key);var s=void 0;for(o in e.type&&e.type.defaultProps&&(s=e.type.defaultProps),t)x.call(t,o)&&!O.hasOwnProperty(o)&&(u[o]=void 0===t[o]&&void 0!==s?s[o]:t[o]);}if(1===(o=arguments.length-2))u.children=n;else if(1<o){s=Array(o);for(var f=0;f<o;f++)s[f]=arguments[f+2];u.children=s;}return {$$typeof:i,type:e.type,key:a,ref:c,props:u,_owner:l}},createFactory:function(e){var t=j.bind(null,e);return t.type=e,t},isValidElement:k,version:"16.5.2",__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{ReactCurrentOwner:C,assign:r}},$={default:M},T=$&&M||$;e.exports=T.default||T;},function(e,t,n){ /*
|
|
1829
|
+
object-assign
|
|
1830
|
+
(c) Sindre Sorhus
|
|
1831
|
+
@license MIT
|
|
1832
|
+
*/var r=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return !1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return !1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return !1;var r={};return "abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e;}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return !1}}()?Object.assign:function(e,t){for(var n,u,a=function(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),c=1;c<arguments.length;c++){for(var l in n=Object(arguments[c]))o.call(n,l)&&(a[l]=n[l]);if(r){u=r(n);for(var s=0;s<u.length;s++)i.call(n,u[s])&&(a[u[s]]=n[u[s]]);}}return a};},function(e,t,n){(e.exports=n(5)(!1)).push([e.i,".font-size-changer {\n display: inline-block; }\n .font-size-changer .font-size-changer-buttons > div {\n float: left;\n border: 1px solid;\n text-align: center;\n line-height: 40px;\n -webkit-box-sizing: border-box;\n /* Safari/Chrome, other WebKit */\n -moz-box-sizing: border-box;\n /* Firefox, other Gecko */\n box-sizing: border-box;\n -webkit-touch-callout: none;\n /* iOS Safari */\n -webkit-user-select: none;\n /* Safari */\n -khtml-user-select: none;\n /* Konqueror HTML */\n -moz-user-select: none;\n /* Firefox */\n -ms-user-select: none;\n /* Internet Explorer/Edge */\n user-select: none;\n /* Non-prefixed version, currently\r\n supported by Chrome and Opera */ }\n",""]);},function(e,t){e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var n=function(e,t){var n=e[1]||"",r=e[3];if(!r)return n;if(t&&"function"==typeof btoa){var o=function(e){return "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(e))))+" */"}(r),i=r.sources.map(function(e){return "/*# sourceURL="+r.sourceRoot+e+" */"});return [n].concat(i).concat([o]).join("\n")}return [n].join("\n")}(t,e);return t[2]?"@media "+t[2]+"{"+n+"}":n}).join("")},t.i=function(e,n){"string"==typeof e&&(e=[[null,e,""]]);for(var r={},o=0;o<this.length;o++){var i=this[o][0];"number"==typeof i&&(r[i]=!0);}for(o=0;o<e.length;o++){var u=e[o];"number"==typeof u[0]&&r[u[0]]||(n&&!u[2]?u[2]=n:n&&(u[2]="("+u[2]+") and ("+n+")"),t.push(u));}},t};},function(e,t,n){var r={},o=function(e){var t;return function(){return void 0===t&&(t=e.apply(this,arguments)),t}}(function(){return window&&document&&document.all&&!window.atob}),i=function(e){var t={};return function(e,n){if("function"==typeof e)return e();if(void 0===t[e]){var r=function(e,t){return t?t.querySelector(e):document.querySelector(e)}.call(this,e,n);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head;}catch(e){r=null;}t[e]=r;}return t[e]}}(),u=null,a=0,c=[],l=n(7);function s(e,t){for(var n=0;n<e.length;n++){var o=e[n],i=r[o.id];if(i){i.refs++;for(var u=0;u<i.parts.length;u++)i.parts[u](o.parts[u]);for(;u<o.parts.length;u++)i.parts.push(v(o.parts[u],t));}else {var a=[];for(u=0;u<o.parts.length;u++)a.push(v(o.parts[u],t));r[o.id]={id:o.id,refs:1,parts:a};}}}function f(e,t){for(var n=[],r={},o=0;o<e.length;o++){var i=e[o],u=t.base?i[0]+t.base:i[0],a={css:i[1],media:i[2],sourceMap:i[3]};r[u]?r[u].parts.push(a):n.push(r[u]={id:u,parts:[a]});}return n}function p(e,t){var n=i(e.insertInto);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var r=c[c.length-1];if("top"===e.insertAt)r?r.nextSibling?n.insertBefore(t,r.nextSibling):n.appendChild(t):n.insertBefore(t,n.firstChild),c.push(t);else if("bottom"===e.insertAt)n.appendChild(t);else {if("object"!=typeof e.insertAt||!e.insertAt.before)throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");var o=i(e.insertAt.before,n);n.insertBefore(t,o);}}function d(e){if(null===e.parentNode)return !1;e.parentNode.removeChild(e);var t=c.indexOf(e);t>=0&&c.splice(t,1);}function y(e){var t=document.createElement("style");if(void 0===e.attrs.type&&(e.attrs.type="text/css"),void 0===e.attrs.nonce){var r=function(){return n.nc}();r&&(e.attrs.nonce=r);}return h(t,e.attrs),p(e,t),t}function h(e,t){Object.keys(t).forEach(function(n){e.setAttribute(n,t[n]);});}function v(e,t){var n,r,o,i;if(t.transform&&e.css){if(!(i=t.transform(e.css)))return function(){};e.css=i;}if(t.singleton){var c=a++;n=u||(u=y(t)),r=g.bind(null,n,c,!1),o=g.bind(null,n,c,!0);}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(e){var t=document.createElement("link");return void 0===e.attrs.type&&(e.attrs.type="text/css"),e.attrs.rel="stylesheet",h(t,e.attrs),p(e,t),t}(t),r=function(e,t,n){var r=n.css,o=n.sourceMap,i=void 0===t.convertToAbsoluteUrls&&o;(t.convertToAbsoluteUrls||i)&&(r=l(r));o&&(r+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */");var u=new Blob([r],{type:"text/css"}),a=e.href;e.href=URL.createObjectURL(u),a&&URL.revokeObjectURL(a);}.bind(null,n,t),o=function(){d(n),n.href&&URL.revokeObjectURL(n.href);}):(n=y(t),r=function(e,t){var n=t.css,r=t.media;r&&e.setAttribute("media",r);if(e.styleSheet)e.styleSheet.cssText=n;else {for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n));}}.bind(null,n),o=function(){d(n);});return r(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;r(e=t);}else o();}}e.exports=function(e,t){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(t=t||{}).attrs="object"==typeof t.attrs?t.attrs:{},t.singleton||"boolean"==typeof t.singleton||(t.singleton=o()),t.insertInto||(t.insertInto="head"),t.insertAt||(t.insertAt="bottom");var n=f(e,t);return s(n,t),function(e){for(var o=[],i=0;i<n.length;i++){var u=n[i];(a=r[u.id]).refs--,o.push(a);}e&&s(f(e,t),t);for(i=0;i<o.length;i++){var a;if(0===(a=o[i]).refs){for(var c=0;c<a.parts.length;c++)a.parts[c]();delete r[a.id];}}}};var b=function(){var e=[];return function(t,n){return e[t]=n,e.filter(Boolean).join("\n")}}();function g(e,t,n,r){var o=n?"":r.css;if(e.styleSheet)e.styleSheet.cssText=b(t,o);else {var i=document.createTextNode(o),u=e.childNodes;u[t]&&e.removeChild(u[t]),u.length?e.insertBefore(i,u[t]):e.appendChild(i);}}},function(e,t){e.exports=function(e){var t="undefined"!=typeof window&&window.location;if(!t)throw new Error("fixUrls requires window.location");if(!e||"string"!=typeof e)return e;var n=t.protocol+"//"+t.host,r=n+t.pathname.replace(/\/[^\/]*$/,"/");return e.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,function(e,t){var o,i=t.trim().replace(/^"(.*)"$/,function(e,t){return t}).replace(/^'(.*)'$/,function(e,t){return t});return /^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(i)?e:(o=0===i.indexOf("//")?i:0===i.indexOf("/")?n+i:r+i.replace(/^\.\//,""),"url("+JSON.stringify(o)+")")})};},function(e,t,n){n.r(t);var r=n(0),o=n.n(r),i="up",u="down";function a(e){return (a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function c(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r);}}function l(e){return (l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function s(e,t){return (s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function f(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var p=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=function(e,t){return !t||"object"!==a(t)&&"function"!=typeof t?f(e):t}(this,l(t).call(this))).onClick=e.onClick.bind(f(f(e))),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&s(e,t);}(t,r["Component"]),function(e,t,n){t&&c(e.prototype,t),n&&c(e,n);}(t,[{key:"onClick",value:function(){var e=this.props.onClick;e();}},{key:"getDefaultButtonContent",value:function(){var e=this.props.direction===i?"36px":"20px";return o.a.createElement("span",{style:{fontSize:e}},"A")}},{key:"render",value:function(){var e=this.props.direction,t=this.props,n=t.style,r=void 0===n?{}:n,i=t.customButton,u=void 0===i?this.getDefaultButtonContent():i;return o.a.createElement("div",{className:"font-size-".concat(e),style:r,onClick:this.onClick},u)}}]),t}();n(1);function d(e){return (d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function y(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r);}}function h(e){return (h=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function v(e,t){return (v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function b(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var g=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=function(e,t){return !t||"object"!==d(t)&&"function"!=typeof t?b(e):t}(this,h(t).call(this))).handleChange.bind(b(b(e))),e.setChangeDirection.bind(b(b(e))),e.state={options:{stepSize:2,range:3},changeCount:0,changeDirection:null},e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&v(e,t);}(t,r["Component"]),function(e,t,n){t&&y(e.prototype,t),n&&y(e,n);}(t,[{key:"handleChange",value:function(e,t,n){this.props.onChange&&(0, this.props.onChange)(e,t,n);}},{key:"componentDidMount",value:function(){var e=this.props.options;this.setState({options:Object.assign({},this.state.options,e)});}},{key:"getFontSizeDetails",value:function(e){var t=parseFloat(e);return {value:t,unit:e.toString().replace(t.toString(),"")}}},{key:"applyFontSize",value:function(e){var t=this.state.options.stepSize,n=this.state.changeDirection===i?t:-1*t,r=window.getComputedStyle(e,null).getPropertyValue("font-size"),o=this.getFontSizeDetails(r).value,u=o+n;e.style.fontSize=u+"px",u!==o&&this.handleChange(e,u,o);}},{key:"iterateChildren",value:function(e){if(this.applyFontSize(e),e.children&&0!==e.children.length){var t=!0,n=!1,r=void 0;try{for(var o,i=e.children[Symbol.iterator]();!(t=(o=i.next()).done);t=!0){var u=o.value;this.iterateChildren(u);}}catch(e){n=!0,r=e;}finally{try{t||null==i.return||i.return();}finally{if(n)throw r}}}}},{key:"updateChangeCount",value:function(){var e=this.state,t=e.changeCount,n=e.changeDirection===i?1:-1;this.setState({changeCount:t+n});}},{key:"iterateElementsAndApplyFontSizeChange",value:function(){var e=this.props.targets,t=!0,n=!1,r=void 0;try{for(var o,i=e[Symbol.iterator]();!(t=(o=i.next()).done);t=!0){var u=o.value,a=document.querySelectorAll(u),c=!0,l=!1,s=void 0;try{for(var f,p=a[Symbol.iterator]();!(c=(f=p.next()).done);c=!0){var d=f.value;this.iterateChildren(d);}}catch(e){l=!0,s=e;}finally{try{c||null==p.return||p.return();}finally{if(l)throw s}}}}catch(e){n=!0,r=e;}finally{try{t||null==i.return||i.return();}finally{if(n)throw r}}this.updateChangeCount();}},{key:"validateChangePerRange",value:function(){var e=this.state,t=e.changeCount,n=e.changeDirection,r=this.state.options.range,o=!0;return n===i&&t>=r&&(o=!1),n===u&&t<=-1*r&&(o=!1),o}},{key:"initFontSizeChange",value:function(){this.validateChangePerRange()&&this.iterateElementsAndApplyFontSizeChange();}},{key:"setChangeDirection",value:function(e,t){var n=e?i:u;this.setState({changeDirection:n},t);}},{key:"onFontSizeUp",value:function(){this.setChangeDirection(!0,this.initFontSizeChange);}},{key:"onFontSizeDown",value:function(){this.setChangeDirection(!1,this.initFontSizeChange);}},{key:"getFontSizeChangerStyle",value:function(e){var t=e.style,n=void 0===t?{}:t,r=e.verticalAlignment,o=void 0!==r&&r,i=e.buttonsMargin,u=void 0===i?4:i,a=this.getFontSizeDetails(n.width||"40px"),c=this.getFontSizeDetails(n.height||"40px");return {width:(!1===o?2*a.value+u:a.value)+a.unit,height:(!1===o?c.value:2*c.value+u)+c.unit}}},{key:"getFontSizeChangerButtonStyle",value:function(e,t){var n=t.style,r=void 0===n?{}:n,o=t.verticalAlignment,a=void 0!==o&&o,c=t.reverseOrder,l=void 0!==c&&c,s=t.buttonsMargin,f=void 0===s?4:s,p=this.getFontSizeDetails(r.width||"40px"),d=this.getFontSizeDetails(r.height||"40px"),y={width:p.value+p.unit,height:d.value+d.unit},h=f+(!1===a?p.unit:d.unit);return (e===i&&!1===l||e===u&&!0===l)&&(!1===a?y.marginRight=h:y.marginBottom=h),Object.assign({},r,y)}},{key:"render",value:function(){var e=this.props.customButtons,t=void 0===e?{}:e,n=t.up,r=t.down,a=this.getFontSizeChangerStyle(t),c=this.getFontSizeChangerButtonStyle(i,t),l=this.getFontSizeChangerButtonStyle(u,t);return o.a.createElement("div",{className:"font-size-changer",style:a},o.a.createElement("div",{className:"font-size-changer-buttons",style:a},o.a.createElement(p,{direction:i,customButton:n,onClick:this.onFontSizeUp.bind(this),style:c}),o.a.createElement(p,{direction:u,customButton:r,onClick:this.onFontSizeDown.bind(this),style:l})))}}]),t}();t.default=g;}])});
|
|
1833
|
+
|
|
1834
|
+
} (bundle));
|
|
1835
|
+
|
|
1836
|
+
var FontSize = /*@__PURE__*/getDefaultExportFromCjs(bundle.exports);
|
|
1837
|
+
|
|
1838
|
+
var domToImage$1 = {exports: {}};
|
|
1839
|
+
|
|
1840
|
+
(function (module) {
|
|
1841
|
+
(function (global) {
|
|
1842
|
+
|
|
1843
|
+
var util = newUtil();
|
|
1844
|
+
var inliner = newInliner();
|
|
1845
|
+
var fontFaces = newFontFaces();
|
|
1846
|
+
var images = newImages();
|
|
1847
|
+
|
|
1848
|
+
// Default impl options
|
|
1849
|
+
var defaultOptions = {
|
|
1850
|
+
// Default is to fail on error, no placeholder
|
|
1851
|
+
imagePlaceholder: undefined,
|
|
1852
|
+
// Default cache bust is false, it will use the cache
|
|
1853
|
+
cacheBust: false
|
|
1854
|
+
};
|
|
1855
|
+
|
|
1856
|
+
var domtoimage = {
|
|
1857
|
+
toSvg: toSvg,
|
|
1858
|
+
toPng: toPng,
|
|
1859
|
+
toJpeg: toJpeg,
|
|
1860
|
+
toBlob: toBlob,
|
|
1861
|
+
toPixelData: toPixelData,
|
|
1862
|
+
impl: {
|
|
1863
|
+
fontFaces: fontFaces,
|
|
1864
|
+
images: images,
|
|
1865
|
+
util: util,
|
|
1866
|
+
inliner: inliner,
|
|
1867
|
+
options: {}
|
|
1868
|
+
}
|
|
1869
|
+
};
|
|
1870
|
+
|
|
1871
|
+
module.exports = domtoimage;
|
|
1872
|
+
|
|
1873
|
+
|
|
1874
|
+
/**
|
|
1875
|
+
* @param {Node} node - The DOM Node object to render
|
|
1876
|
+
* @param {Object} options - Rendering options
|
|
1877
|
+
* @param {Function} options.filter - Should return true if passed node should be included in the output
|
|
1878
|
+
* (excluding node means excluding it's children as well). Not called on the root node.
|
|
1879
|
+
* @param {String} options.bgcolor - color for the background, any valid CSS color value.
|
|
1880
|
+
* @param {Number} options.width - width to be applied to node before rendering.
|
|
1881
|
+
* @param {Number} options.height - height to be applied to node before rendering.
|
|
1882
|
+
* @param {Object} options.style - an object whose properties to be copied to node's style before rendering.
|
|
1883
|
+
* @param {Number} options.quality - a Number between 0 and 1 indicating image quality (applicable to JPEG only),
|
|
1884
|
+
defaults to 1.0.
|
|
1885
|
+
* @param {String} options.imagePlaceholder - dataURL to use as a placeholder for failed images, default behaviour is to fail fast on images we can't fetch
|
|
1886
|
+
* @param {Boolean} options.cacheBust - set to true to cache bust by appending the time to the request url
|
|
1887
|
+
* @return {Promise} - A promise that is fulfilled with a SVG image data URL
|
|
1888
|
+
* */
|
|
1889
|
+
function toSvg(node, options) {
|
|
1890
|
+
options = options || {};
|
|
1891
|
+
copyOptions(options);
|
|
1892
|
+
return Promise.resolve(node)
|
|
1893
|
+
.then(function (node) {
|
|
1894
|
+
return cloneNode(node, options.filter, true);
|
|
1895
|
+
})
|
|
1896
|
+
.then(embedFonts)
|
|
1897
|
+
.then(inlineImages)
|
|
1898
|
+
.then(applyOptions)
|
|
1899
|
+
.then(function (clone) {
|
|
1900
|
+
return makeSvgDataUri(clone,
|
|
1901
|
+
options.width || util.width(node),
|
|
1902
|
+
options.height || util.height(node)
|
|
1903
|
+
);
|
|
1904
|
+
});
|
|
1905
|
+
|
|
1906
|
+
function applyOptions(clone) {
|
|
1907
|
+
if (options.bgcolor) clone.style.backgroundColor = options.bgcolor;
|
|
1908
|
+
|
|
1909
|
+
if (options.width) clone.style.width = options.width + 'px';
|
|
1910
|
+
if (options.height) clone.style.height = options.height + 'px';
|
|
1911
|
+
|
|
1912
|
+
if (options.style)
|
|
1913
|
+
Object.keys(options.style).forEach(function (property) {
|
|
1914
|
+
clone.style[property] = options.style[property];
|
|
1915
|
+
});
|
|
1916
|
+
|
|
1917
|
+
return clone;
|
|
1918
|
+
}
|
|
1919
|
+
}
|
|
1920
|
+
|
|
1921
|
+
/**
|
|
1922
|
+
* @param {Node} node - The DOM Node object to render
|
|
1923
|
+
* @param {Object} options - Rendering options, @see {@link toSvg}
|
|
1924
|
+
* @return {Promise} - A promise that is fulfilled with a Uint8Array containing RGBA pixel data.
|
|
1925
|
+
* */
|
|
1926
|
+
function toPixelData(node, options) {
|
|
1927
|
+
return draw(node, options || {})
|
|
1928
|
+
.then(function (canvas) {
|
|
1929
|
+
return canvas.getContext('2d').getImageData(
|
|
1930
|
+
0,
|
|
1931
|
+
0,
|
|
1932
|
+
util.width(node),
|
|
1933
|
+
util.height(node)
|
|
1934
|
+
).data;
|
|
1935
|
+
});
|
|
1936
|
+
}
|
|
1937
|
+
|
|
1938
|
+
/**
|
|
1939
|
+
* @param {Node} node - The DOM Node object to render
|
|
1940
|
+
* @param {Object} options - Rendering options, @see {@link toSvg}
|
|
1941
|
+
* @return {Promise} - A promise that is fulfilled with a PNG image data URL
|
|
1942
|
+
* */
|
|
1943
|
+
function toPng(node, options) {
|
|
1944
|
+
return draw(node, options || {})
|
|
1945
|
+
.then(function (canvas) {
|
|
1946
|
+
return canvas.toDataURL();
|
|
1947
|
+
});
|
|
1948
|
+
}
|
|
1949
|
+
|
|
1950
|
+
/**
|
|
1951
|
+
* @param {Node} node - The DOM Node object to render
|
|
1952
|
+
* @param {Object} options - Rendering options, @see {@link toSvg}
|
|
1953
|
+
* @return {Promise} - A promise that is fulfilled with a JPEG image data URL
|
|
1954
|
+
* */
|
|
1955
|
+
function toJpeg(node, options) {
|
|
1956
|
+
options = options || {};
|
|
1957
|
+
return draw(node, options)
|
|
1958
|
+
.then(function (canvas) {
|
|
1959
|
+
return canvas.toDataURL('image/jpeg', options.quality || 1.0);
|
|
1960
|
+
});
|
|
1961
|
+
}
|
|
1962
|
+
|
|
1963
|
+
/**
|
|
1964
|
+
* @param {Node} node - The DOM Node object to render
|
|
1965
|
+
* @param {Object} options - Rendering options, @see {@link toSvg}
|
|
1966
|
+
* @return {Promise} - A promise that is fulfilled with a PNG image blob
|
|
1967
|
+
* */
|
|
1968
|
+
function toBlob(node, options) {
|
|
1969
|
+
return draw(node, options || {})
|
|
1970
|
+
.then(util.canvasToBlob);
|
|
1971
|
+
}
|
|
1972
|
+
|
|
1973
|
+
function copyOptions(options) {
|
|
1974
|
+
// Copy options to impl options for use in impl
|
|
1975
|
+
if(typeof(options.imagePlaceholder) === 'undefined') {
|
|
1976
|
+
domtoimage.impl.options.imagePlaceholder = defaultOptions.imagePlaceholder;
|
|
1977
|
+
} else {
|
|
1978
|
+
domtoimage.impl.options.imagePlaceholder = options.imagePlaceholder;
|
|
1979
|
+
}
|
|
1980
|
+
|
|
1981
|
+
if(typeof(options.cacheBust) === 'undefined') {
|
|
1982
|
+
domtoimage.impl.options.cacheBust = defaultOptions.cacheBust;
|
|
1983
|
+
} else {
|
|
1984
|
+
domtoimage.impl.options.cacheBust = options.cacheBust;
|
|
1985
|
+
}
|
|
1986
|
+
}
|
|
1987
|
+
|
|
1988
|
+
function draw(domNode, options) {
|
|
1989
|
+
return toSvg(domNode, options)
|
|
1990
|
+
.then(util.makeImage)
|
|
1991
|
+
.then(util.delay(100))
|
|
1992
|
+
.then(function (image) {
|
|
1993
|
+
var canvas = newCanvas(domNode);
|
|
1994
|
+
canvas.getContext('2d').drawImage(image, 0, 0);
|
|
1995
|
+
return canvas;
|
|
1996
|
+
});
|
|
1997
|
+
|
|
1998
|
+
function newCanvas(domNode) {
|
|
1999
|
+
var canvas = document.createElement('canvas');
|
|
2000
|
+
canvas.width = options.width || util.width(domNode);
|
|
2001
|
+
canvas.height = options.height || util.height(domNode);
|
|
2002
|
+
|
|
2003
|
+
if (options.bgcolor) {
|
|
2004
|
+
var ctx = canvas.getContext('2d');
|
|
2005
|
+
ctx.fillStyle = options.bgcolor;
|
|
2006
|
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
2007
|
+
}
|
|
2008
|
+
|
|
2009
|
+
return canvas;
|
|
2010
|
+
}
|
|
2011
|
+
}
|
|
2012
|
+
|
|
2013
|
+
function cloneNode(node, filter, root) {
|
|
2014
|
+
if (!root && filter && !filter(node)) return Promise.resolve();
|
|
2015
|
+
|
|
2016
|
+
return Promise.resolve(node)
|
|
2017
|
+
.then(makeNodeCopy)
|
|
2018
|
+
.then(function (clone) {
|
|
2019
|
+
return cloneChildren(node, clone, filter);
|
|
2020
|
+
})
|
|
2021
|
+
.then(function (clone) {
|
|
2022
|
+
return processClone(node, clone);
|
|
2023
|
+
});
|
|
2024
|
+
|
|
2025
|
+
function makeNodeCopy(node) {
|
|
2026
|
+
if (node instanceof HTMLCanvasElement) return util.makeImage(node.toDataURL());
|
|
2027
|
+
return node.cloneNode(false);
|
|
2028
|
+
}
|
|
2029
|
+
|
|
2030
|
+
function cloneChildren(original, clone, filter) {
|
|
2031
|
+
var children = original.childNodes;
|
|
2032
|
+
if (children.length === 0) return Promise.resolve(clone);
|
|
2033
|
+
|
|
2034
|
+
return cloneChildrenInOrder(clone, util.asArray(children), filter)
|
|
2035
|
+
.then(function () {
|
|
2036
|
+
return clone;
|
|
2037
|
+
});
|
|
2038
|
+
|
|
2039
|
+
function cloneChildrenInOrder(parent, children, filter) {
|
|
2040
|
+
var done = Promise.resolve();
|
|
2041
|
+
children.forEach(function (child) {
|
|
2042
|
+
done = done
|
|
2043
|
+
.then(function () {
|
|
2044
|
+
return cloneNode(child, filter);
|
|
2045
|
+
})
|
|
2046
|
+
.then(function (childClone) {
|
|
2047
|
+
if (childClone) parent.appendChild(childClone);
|
|
2048
|
+
});
|
|
2049
|
+
});
|
|
2050
|
+
return done;
|
|
2051
|
+
}
|
|
2052
|
+
}
|
|
2053
|
+
|
|
2054
|
+
function processClone(original, clone) {
|
|
2055
|
+
if (!(clone instanceof Element)) return clone;
|
|
2056
|
+
|
|
2057
|
+
return Promise.resolve()
|
|
2058
|
+
.then(cloneStyle)
|
|
2059
|
+
.then(clonePseudoElements)
|
|
2060
|
+
.then(copyUserInput)
|
|
2061
|
+
.then(fixSvg)
|
|
2062
|
+
.then(function () {
|
|
2063
|
+
return clone;
|
|
2064
|
+
});
|
|
2065
|
+
|
|
2066
|
+
function cloneStyle() {
|
|
2067
|
+
copyStyle(window.getComputedStyle(original), clone.style);
|
|
2068
|
+
|
|
2069
|
+
function copyStyle(source, target) {
|
|
2070
|
+
if (source.cssText) target.cssText = source.cssText;
|
|
2071
|
+
else copyProperties(source, target);
|
|
2072
|
+
|
|
2073
|
+
function copyProperties(source, target) {
|
|
2074
|
+
util.asArray(source).forEach(function (name) {
|
|
2075
|
+
target.setProperty(
|
|
2076
|
+
name,
|
|
2077
|
+
source.getPropertyValue(name),
|
|
2078
|
+
source.getPropertyPriority(name)
|
|
2079
|
+
);
|
|
2080
|
+
});
|
|
2081
|
+
}
|
|
2082
|
+
}
|
|
2083
|
+
}
|
|
2084
|
+
|
|
2085
|
+
function clonePseudoElements() {
|
|
2086
|
+
[':before', ':after'].forEach(function (element) {
|
|
2087
|
+
clonePseudoElement(element);
|
|
2088
|
+
});
|
|
2089
|
+
|
|
2090
|
+
function clonePseudoElement(element) {
|
|
2091
|
+
var style = window.getComputedStyle(original, element);
|
|
2092
|
+
var content = style.getPropertyValue('content');
|
|
2093
|
+
|
|
2094
|
+
if (content === '' || content === 'none') return;
|
|
2095
|
+
|
|
2096
|
+
var className = util.uid();
|
|
2097
|
+
clone.className = clone.className + ' ' + className;
|
|
2098
|
+
var styleElement = document.createElement('style');
|
|
2099
|
+
styleElement.appendChild(formatPseudoElementStyle(className, element, style));
|
|
2100
|
+
clone.appendChild(styleElement);
|
|
2101
|
+
|
|
2102
|
+
function formatPseudoElementStyle(className, element, style) {
|
|
2103
|
+
var selector = '.' + className + ':' + element;
|
|
2104
|
+
var cssText = style.cssText ? formatCssText(style) : formatCssProperties(style);
|
|
2105
|
+
return document.createTextNode(selector + '{' + cssText + '}');
|
|
2106
|
+
|
|
2107
|
+
function formatCssText(style) {
|
|
2108
|
+
var content = style.getPropertyValue('content');
|
|
2109
|
+
return style.cssText + ' content: ' + content + ';';
|
|
2110
|
+
}
|
|
2111
|
+
|
|
2112
|
+
function formatCssProperties(style) {
|
|
2113
|
+
|
|
2114
|
+
return util.asArray(style)
|
|
2115
|
+
.map(formatProperty)
|
|
2116
|
+
.join('; ') + ';';
|
|
2117
|
+
|
|
2118
|
+
function formatProperty(name) {
|
|
2119
|
+
return name + ': ' +
|
|
2120
|
+
style.getPropertyValue(name) +
|
|
2121
|
+
(style.getPropertyPriority(name) ? ' !important' : '');
|
|
2122
|
+
}
|
|
2123
|
+
}
|
|
2124
|
+
}
|
|
2125
|
+
}
|
|
2126
|
+
}
|
|
2127
|
+
|
|
2128
|
+
function copyUserInput() {
|
|
2129
|
+
if (original instanceof HTMLTextAreaElement) clone.innerHTML = original.value;
|
|
2130
|
+
if (original instanceof HTMLInputElement) clone.setAttribute("value", original.value);
|
|
2131
|
+
}
|
|
2132
|
+
|
|
2133
|
+
function fixSvg() {
|
|
2134
|
+
if (!(clone instanceof SVGElement)) return;
|
|
2135
|
+
clone.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
|
|
2136
|
+
|
|
2137
|
+
if (!(clone instanceof SVGRectElement)) return;
|
|
2138
|
+
['width', 'height'].forEach(function (attribute) {
|
|
2139
|
+
var value = clone.getAttribute(attribute);
|
|
2140
|
+
if (!value) return;
|
|
2141
|
+
|
|
2142
|
+
clone.style.setProperty(attribute, value);
|
|
2143
|
+
});
|
|
2144
|
+
}
|
|
2145
|
+
}
|
|
2146
|
+
}
|
|
2147
|
+
|
|
2148
|
+
function embedFonts(node) {
|
|
2149
|
+
return fontFaces.resolveAll()
|
|
2150
|
+
.then(function (cssText) {
|
|
2151
|
+
var styleNode = document.createElement('style');
|
|
2152
|
+
node.appendChild(styleNode);
|
|
2153
|
+
styleNode.appendChild(document.createTextNode(cssText));
|
|
2154
|
+
return node;
|
|
2155
|
+
});
|
|
2156
|
+
}
|
|
2157
|
+
|
|
2158
|
+
function inlineImages(node) {
|
|
2159
|
+
return images.inlineAll(node)
|
|
2160
|
+
.then(function () {
|
|
2161
|
+
return node;
|
|
2162
|
+
});
|
|
2163
|
+
}
|
|
2164
|
+
|
|
2165
|
+
function makeSvgDataUri(node, width, height) {
|
|
2166
|
+
return Promise.resolve(node)
|
|
2167
|
+
.then(function (node) {
|
|
2168
|
+
node.setAttribute('xmlns', 'http://www.w3.org/1999/xhtml');
|
|
2169
|
+
return new XMLSerializer().serializeToString(node);
|
|
2170
|
+
})
|
|
2171
|
+
.then(util.escapeXhtml)
|
|
2172
|
+
.then(function (xhtml) {
|
|
2173
|
+
return '<foreignObject x="0" y="0" width="100%" height="100%">' + xhtml + '</foreignObject>';
|
|
2174
|
+
})
|
|
2175
|
+
.then(function (foreignObject) {
|
|
2176
|
+
return '<svg xmlns="http://www.w3.org/2000/svg" width="' + width + '" height="' + height + '">' +
|
|
2177
|
+
foreignObject + '</svg>';
|
|
2178
|
+
})
|
|
2179
|
+
.then(function (svg) {
|
|
2180
|
+
return 'data:image/svg+xml;charset=utf-8,' + svg;
|
|
2181
|
+
});
|
|
2182
|
+
}
|
|
2183
|
+
|
|
2184
|
+
function newUtil() {
|
|
2185
|
+
return {
|
|
2186
|
+
escape: escape,
|
|
2187
|
+
parseExtension: parseExtension,
|
|
2188
|
+
mimeType: mimeType,
|
|
2189
|
+
dataAsUrl: dataAsUrl,
|
|
2190
|
+
isDataUrl: isDataUrl,
|
|
2191
|
+
canvasToBlob: canvasToBlob,
|
|
2192
|
+
resolveUrl: resolveUrl,
|
|
2193
|
+
getAndEncode: getAndEncode,
|
|
2194
|
+
uid: uid(),
|
|
2195
|
+
delay: delay,
|
|
2196
|
+
asArray: asArray,
|
|
2197
|
+
escapeXhtml: escapeXhtml,
|
|
2198
|
+
makeImage: makeImage,
|
|
2199
|
+
width: width,
|
|
2200
|
+
height: height
|
|
2201
|
+
};
|
|
2202
|
+
|
|
2203
|
+
function mimes() {
|
|
2204
|
+
/*
|
|
2205
|
+
* Only WOFF and EOT mime types for fonts are 'real'
|
|
2206
|
+
* see http://www.iana.org/assignments/media-types/media-types.xhtml
|
|
2207
|
+
*/
|
|
2208
|
+
var WOFF = 'application/font-woff';
|
|
2209
|
+
var JPEG = 'image/jpeg';
|
|
2210
|
+
|
|
2211
|
+
return {
|
|
2212
|
+
'woff': WOFF,
|
|
2213
|
+
'woff2': WOFF,
|
|
2214
|
+
'ttf': 'application/font-truetype',
|
|
2215
|
+
'eot': 'application/vnd.ms-fontobject',
|
|
2216
|
+
'png': 'image/png',
|
|
2217
|
+
'jpg': JPEG,
|
|
2218
|
+
'jpeg': JPEG,
|
|
2219
|
+
'gif': 'image/gif',
|
|
2220
|
+
'tiff': 'image/tiff',
|
|
2221
|
+
'svg': 'image/svg+xml'
|
|
2222
|
+
};
|
|
2223
|
+
}
|
|
2224
|
+
|
|
2225
|
+
function parseExtension(url) {
|
|
2226
|
+
var match = /\.([^\.\/]*?)$/g.exec(url);
|
|
2227
|
+
if (match) return match[1];
|
|
2228
|
+
else return '';
|
|
2229
|
+
}
|
|
2230
|
+
|
|
2231
|
+
function mimeType(url) {
|
|
2232
|
+
var extension = parseExtension(url).toLowerCase();
|
|
2233
|
+
return mimes()[extension] || '';
|
|
2234
|
+
}
|
|
2235
|
+
|
|
2236
|
+
function isDataUrl(url) {
|
|
2237
|
+
return url.search(/^(data:)/) !== -1;
|
|
2238
|
+
}
|
|
2239
|
+
|
|
2240
|
+
function toBlob(canvas) {
|
|
2241
|
+
return new Promise(function (resolve) {
|
|
2242
|
+
var binaryString = window.atob(canvas.toDataURL().split(',')[1]);
|
|
2243
|
+
var length = binaryString.length;
|
|
2244
|
+
var binaryArray = new Uint8Array(length);
|
|
2245
|
+
|
|
2246
|
+
for (var i = 0; i < length; i++)
|
|
2247
|
+
binaryArray[i] = binaryString.charCodeAt(i);
|
|
2248
|
+
|
|
2249
|
+
resolve(new Blob([binaryArray], {
|
|
2250
|
+
type: 'image/png'
|
|
2251
|
+
}));
|
|
2252
|
+
});
|
|
2253
|
+
}
|
|
2254
|
+
|
|
2255
|
+
function canvasToBlob(canvas) {
|
|
2256
|
+
if (canvas.toBlob)
|
|
2257
|
+
return new Promise(function (resolve) {
|
|
2258
|
+
canvas.toBlob(resolve);
|
|
2259
|
+
});
|
|
2260
|
+
|
|
2261
|
+
return toBlob(canvas);
|
|
2262
|
+
}
|
|
2263
|
+
|
|
2264
|
+
function resolveUrl(url, baseUrl) {
|
|
2265
|
+
var doc = document.implementation.createHTMLDocument();
|
|
2266
|
+
var base = doc.createElement('base');
|
|
2267
|
+
doc.head.appendChild(base);
|
|
2268
|
+
var a = doc.createElement('a');
|
|
2269
|
+
doc.body.appendChild(a);
|
|
2270
|
+
base.href = baseUrl;
|
|
2271
|
+
a.href = url;
|
|
2272
|
+
return a.href;
|
|
2273
|
+
}
|
|
2274
|
+
|
|
2275
|
+
function uid() {
|
|
2276
|
+
var index = 0;
|
|
2277
|
+
|
|
2278
|
+
return function () {
|
|
2279
|
+
return 'u' + fourRandomChars() + index++;
|
|
2280
|
+
|
|
2281
|
+
function fourRandomChars() {
|
|
2282
|
+
/* see http://stackoverflow.com/a/6248722/2519373 */
|
|
2283
|
+
return ('0000' + (Math.random() * Math.pow(36, 4) << 0).toString(36)).slice(-4);
|
|
2284
|
+
}
|
|
2285
|
+
};
|
|
2286
|
+
}
|
|
2287
|
+
|
|
2288
|
+
function makeImage(uri) {
|
|
2289
|
+
return new Promise(function (resolve, reject) {
|
|
2290
|
+
var image = new Image();
|
|
2291
|
+
image.onload = function () {
|
|
2292
|
+
resolve(image);
|
|
2293
|
+
};
|
|
2294
|
+
image.onerror = reject;
|
|
2295
|
+
image.src = uri;
|
|
2296
|
+
});
|
|
2297
|
+
}
|
|
2298
|
+
|
|
2299
|
+
function getAndEncode(url) {
|
|
2300
|
+
var TIMEOUT = 30000;
|
|
2301
|
+
if(domtoimage.impl.options.cacheBust) {
|
|
2302
|
+
// Cache bypass so we dont have CORS issues with cached images
|
|
2303
|
+
// Source: https://developer.mozilla.org/en/docs/Web/API/XMLHttpRequest/Using_XMLHttpRequest#Bypassing_the_cache
|
|
2304
|
+
url += ((/\?/).test(url) ? "&" : "?") + (new Date()).getTime();
|
|
2305
|
+
}
|
|
2306
|
+
|
|
2307
|
+
return new Promise(function (resolve) {
|
|
2308
|
+
var request = new XMLHttpRequest();
|
|
2309
|
+
|
|
2310
|
+
request.onreadystatechange = done;
|
|
2311
|
+
request.ontimeout = timeout;
|
|
2312
|
+
request.responseType = 'blob';
|
|
2313
|
+
request.timeout = TIMEOUT;
|
|
2314
|
+
request.open('GET', url, true);
|
|
2315
|
+
request.send();
|
|
2316
|
+
|
|
2317
|
+
var placeholder;
|
|
2318
|
+
if(domtoimage.impl.options.imagePlaceholder) {
|
|
2319
|
+
var split = domtoimage.impl.options.imagePlaceholder.split(/,/);
|
|
2320
|
+
if(split && split[1]) {
|
|
2321
|
+
placeholder = split[1];
|
|
2322
|
+
}
|
|
2323
|
+
}
|
|
2324
|
+
|
|
2325
|
+
function done() {
|
|
2326
|
+
if (request.readyState !== 4) return;
|
|
2327
|
+
|
|
2328
|
+
if (request.status !== 200) {
|
|
2329
|
+
if(placeholder) {
|
|
2330
|
+
resolve(placeholder);
|
|
2331
|
+
} else {
|
|
2332
|
+
fail('cannot fetch resource: ' + url + ', status: ' + request.status);
|
|
2333
|
+
}
|
|
2334
|
+
|
|
2335
|
+
return;
|
|
2336
|
+
}
|
|
2337
|
+
|
|
2338
|
+
var encoder = new FileReader();
|
|
2339
|
+
encoder.onloadend = function () {
|
|
2340
|
+
var content = encoder.result.split(/,/)[1];
|
|
2341
|
+
resolve(content);
|
|
2342
|
+
};
|
|
2343
|
+
encoder.readAsDataURL(request.response);
|
|
2344
|
+
}
|
|
2345
|
+
|
|
2346
|
+
function timeout() {
|
|
2347
|
+
if(placeholder) {
|
|
2348
|
+
resolve(placeholder);
|
|
2349
|
+
} else {
|
|
2350
|
+
fail('timeout of ' + TIMEOUT + 'ms occured while fetching resource: ' + url);
|
|
2351
|
+
}
|
|
2352
|
+
}
|
|
2353
|
+
|
|
2354
|
+
function fail(message) {
|
|
2355
|
+
console.error(message);
|
|
2356
|
+
resolve('');
|
|
2357
|
+
}
|
|
2358
|
+
});
|
|
2359
|
+
}
|
|
2360
|
+
|
|
2361
|
+
function dataAsUrl(content, type) {
|
|
2362
|
+
return 'data:' + type + ';base64,' + content;
|
|
2363
|
+
}
|
|
2364
|
+
|
|
2365
|
+
function escape(string) {
|
|
2366
|
+
return string.replace(/([.*+?^${}()|\[\]\/\\])/g, '\\$1');
|
|
2367
|
+
}
|
|
2368
|
+
|
|
2369
|
+
function delay(ms) {
|
|
2370
|
+
return function (arg) {
|
|
2371
|
+
return new Promise(function (resolve) {
|
|
2372
|
+
setTimeout(function () {
|
|
2373
|
+
resolve(arg);
|
|
2374
|
+
}, ms);
|
|
2375
|
+
});
|
|
2376
|
+
};
|
|
2377
|
+
}
|
|
2378
|
+
|
|
2379
|
+
function asArray(arrayLike) {
|
|
2380
|
+
var array = [];
|
|
2381
|
+
var length = arrayLike.length;
|
|
2382
|
+
for (var i = 0; i < length; i++) array.push(arrayLike[i]);
|
|
2383
|
+
return array;
|
|
2384
|
+
}
|
|
2385
|
+
|
|
2386
|
+
function escapeXhtml(string) {
|
|
2387
|
+
return string.replace(/#/g, '%23').replace(/\n/g, '%0A');
|
|
2388
|
+
}
|
|
2389
|
+
|
|
2390
|
+
function width(node) {
|
|
2391
|
+
var leftBorder = px(node, 'border-left-width');
|
|
2392
|
+
var rightBorder = px(node, 'border-right-width');
|
|
2393
|
+
return node.scrollWidth + leftBorder + rightBorder;
|
|
2394
|
+
}
|
|
2395
|
+
|
|
2396
|
+
function height(node) {
|
|
2397
|
+
var topBorder = px(node, 'border-top-width');
|
|
2398
|
+
var bottomBorder = px(node, 'border-bottom-width');
|
|
2399
|
+
return node.scrollHeight + topBorder + bottomBorder;
|
|
2400
|
+
}
|
|
2401
|
+
|
|
2402
|
+
function px(node, styleProperty) {
|
|
2403
|
+
var value = window.getComputedStyle(node).getPropertyValue(styleProperty);
|
|
2404
|
+
return parseFloat(value.replace('px', ''));
|
|
2405
|
+
}
|
|
2406
|
+
}
|
|
2407
|
+
|
|
2408
|
+
function newInliner() {
|
|
2409
|
+
var URL_REGEX = /url\(['"]?([^'"]+?)['"]?\)/g;
|
|
2410
|
+
|
|
2411
|
+
return {
|
|
2412
|
+
inlineAll: inlineAll,
|
|
2413
|
+
shouldProcess: shouldProcess,
|
|
2414
|
+
impl: {
|
|
2415
|
+
readUrls: readUrls,
|
|
2416
|
+
inline: inline
|
|
2417
|
+
}
|
|
2418
|
+
};
|
|
2419
|
+
|
|
2420
|
+
function shouldProcess(string) {
|
|
2421
|
+
return string.search(URL_REGEX) !== -1;
|
|
2422
|
+
}
|
|
2423
|
+
|
|
2424
|
+
function readUrls(string) {
|
|
2425
|
+
var result = [];
|
|
2426
|
+
var match;
|
|
2427
|
+
while ((match = URL_REGEX.exec(string)) !== null) {
|
|
2428
|
+
result.push(match[1]);
|
|
2429
|
+
}
|
|
2430
|
+
return result.filter(function (url) {
|
|
2431
|
+
return !util.isDataUrl(url);
|
|
2432
|
+
});
|
|
2433
|
+
}
|
|
2434
|
+
|
|
2435
|
+
function inline(string, url, baseUrl, get) {
|
|
2436
|
+
return Promise.resolve(url)
|
|
2437
|
+
.then(function (url) {
|
|
2438
|
+
return baseUrl ? util.resolveUrl(url, baseUrl) : url;
|
|
2439
|
+
})
|
|
2440
|
+
.then(get || util.getAndEncode)
|
|
2441
|
+
.then(function (data) {
|
|
2442
|
+
return util.dataAsUrl(data, util.mimeType(url));
|
|
2443
|
+
})
|
|
2444
|
+
.then(function (dataUrl) {
|
|
2445
|
+
return string.replace(urlAsRegex(url), '$1' + dataUrl + '$3');
|
|
2446
|
+
});
|
|
2447
|
+
|
|
2448
|
+
function urlAsRegex(url) {
|
|
2449
|
+
return new RegExp('(url\\([\'"]?)(' + util.escape(url) + ')([\'"]?\\))', 'g');
|
|
2450
|
+
}
|
|
2451
|
+
}
|
|
2452
|
+
|
|
2453
|
+
function inlineAll(string, baseUrl, get) {
|
|
2454
|
+
if (nothingToInline()) return Promise.resolve(string);
|
|
2455
|
+
|
|
2456
|
+
return Promise.resolve(string)
|
|
2457
|
+
.then(readUrls)
|
|
2458
|
+
.then(function (urls) {
|
|
2459
|
+
var done = Promise.resolve(string);
|
|
2460
|
+
urls.forEach(function (url) {
|
|
2461
|
+
done = done.then(function (string) {
|
|
2462
|
+
return inline(string, url, baseUrl, get);
|
|
2463
|
+
});
|
|
2464
|
+
});
|
|
2465
|
+
return done;
|
|
2466
|
+
});
|
|
2467
|
+
|
|
2468
|
+
function nothingToInline() {
|
|
2469
|
+
return !shouldProcess(string);
|
|
2470
|
+
}
|
|
2471
|
+
}
|
|
2472
|
+
}
|
|
2473
|
+
|
|
2474
|
+
function newFontFaces() {
|
|
2475
|
+
return {
|
|
2476
|
+
resolveAll: resolveAll,
|
|
2477
|
+
impl: {
|
|
2478
|
+
readAll: readAll
|
|
2479
|
+
}
|
|
2480
|
+
};
|
|
2481
|
+
|
|
2482
|
+
function resolveAll() {
|
|
2483
|
+
return readAll()
|
|
2484
|
+
.then(function (webFonts) {
|
|
2485
|
+
return Promise.all(
|
|
2486
|
+
webFonts.map(function (webFont) {
|
|
2487
|
+
return webFont.resolve();
|
|
2488
|
+
})
|
|
2489
|
+
);
|
|
2490
|
+
})
|
|
2491
|
+
.then(function (cssStrings) {
|
|
2492
|
+
return cssStrings.join('\n');
|
|
2493
|
+
});
|
|
2494
|
+
}
|
|
2495
|
+
|
|
2496
|
+
function readAll() {
|
|
2497
|
+
return Promise.resolve(util.asArray(document.styleSheets))
|
|
2498
|
+
.then(getCssRules)
|
|
2499
|
+
.then(selectWebFontRules)
|
|
2500
|
+
.then(function (rules) {
|
|
2501
|
+
return rules.map(newWebFont);
|
|
2502
|
+
});
|
|
2503
|
+
|
|
2504
|
+
function selectWebFontRules(cssRules) {
|
|
2505
|
+
return cssRules
|
|
2506
|
+
.filter(function (rule) {
|
|
2507
|
+
return rule.type === CSSRule.FONT_FACE_RULE;
|
|
2508
|
+
})
|
|
2509
|
+
.filter(function (rule) {
|
|
2510
|
+
return inliner.shouldProcess(rule.style.getPropertyValue('src'));
|
|
2511
|
+
});
|
|
2512
|
+
}
|
|
2513
|
+
|
|
2514
|
+
function getCssRules(styleSheets) {
|
|
2515
|
+
var cssRules = [];
|
|
2516
|
+
styleSheets.forEach(function (sheet) {
|
|
2517
|
+
try {
|
|
2518
|
+
util.asArray(sheet.cssRules || []).forEach(cssRules.push.bind(cssRules));
|
|
2519
|
+
} catch (e) {
|
|
2520
|
+
console.log('Error while reading CSS rules from ' + sheet.href, e.toString());
|
|
2521
|
+
}
|
|
2522
|
+
});
|
|
2523
|
+
return cssRules;
|
|
2524
|
+
}
|
|
2525
|
+
|
|
2526
|
+
function newWebFont(webFontRule) {
|
|
2527
|
+
return {
|
|
2528
|
+
resolve: function resolve() {
|
|
2529
|
+
var baseUrl = (webFontRule.parentStyleSheet || {}).href;
|
|
2530
|
+
return inliner.inlineAll(webFontRule.cssText, baseUrl);
|
|
2531
|
+
},
|
|
2532
|
+
src: function () {
|
|
2533
|
+
return webFontRule.style.getPropertyValue('src');
|
|
2534
|
+
}
|
|
2535
|
+
};
|
|
2536
|
+
}
|
|
2537
|
+
}
|
|
2538
|
+
}
|
|
2539
|
+
|
|
2540
|
+
function newImages() {
|
|
2541
|
+
return {
|
|
2542
|
+
inlineAll: inlineAll,
|
|
2543
|
+
impl: {
|
|
2544
|
+
newImage: newImage
|
|
2545
|
+
}
|
|
2546
|
+
};
|
|
2547
|
+
|
|
2548
|
+
function newImage(element) {
|
|
2549
|
+
return {
|
|
2550
|
+
inline: inline
|
|
2551
|
+
};
|
|
2552
|
+
|
|
2553
|
+
function inline(get) {
|
|
2554
|
+
if (util.isDataUrl(element.src)) return Promise.resolve();
|
|
2555
|
+
|
|
2556
|
+
return Promise.resolve(element.src)
|
|
2557
|
+
.then(get || util.getAndEncode)
|
|
2558
|
+
.then(function (data) {
|
|
2559
|
+
return util.dataAsUrl(data, util.mimeType(element.src));
|
|
2560
|
+
})
|
|
2561
|
+
.then(function (dataUrl) {
|
|
2562
|
+
return new Promise(function (resolve, reject) {
|
|
2563
|
+
element.onload = resolve;
|
|
2564
|
+
element.onerror = reject;
|
|
2565
|
+
element.src = dataUrl;
|
|
2566
|
+
});
|
|
2567
|
+
});
|
|
2568
|
+
}
|
|
2569
|
+
}
|
|
2570
|
+
|
|
2571
|
+
function inlineAll(node) {
|
|
2572
|
+
if (!(node instanceof Element)) return Promise.resolve(node);
|
|
2573
|
+
|
|
2574
|
+
return inlineBackground(node)
|
|
2575
|
+
.then(function () {
|
|
2576
|
+
if (node instanceof HTMLImageElement)
|
|
2577
|
+
return newImage(node).inline();
|
|
2578
|
+
else
|
|
2579
|
+
return Promise.all(
|
|
2580
|
+
util.asArray(node.childNodes).map(function (child) {
|
|
2581
|
+
return inlineAll(child);
|
|
2582
|
+
})
|
|
2583
|
+
);
|
|
2584
|
+
});
|
|
2585
|
+
|
|
2586
|
+
function inlineBackground(node) {
|
|
2587
|
+
var background = node.style.getPropertyValue('background');
|
|
2588
|
+
|
|
2589
|
+
if (!background) return Promise.resolve(node);
|
|
2590
|
+
|
|
2591
|
+
return inliner.inlineAll(background)
|
|
2592
|
+
.then(function (inlined) {
|
|
2593
|
+
node.style.setProperty(
|
|
2594
|
+
'background',
|
|
2595
|
+
inlined,
|
|
2596
|
+
node.style.getPropertyPriority('background')
|
|
2597
|
+
);
|
|
2598
|
+
})
|
|
2599
|
+
.then(function () {
|
|
2600
|
+
return node;
|
|
2601
|
+
});
|
|
2602
|
+
}
|
|
2603
|
+
}
|
|
2604
|
+
}
|
|
2605
|
+
})();
|
|
2606
|
+
} (domToImage$1));
|
|
2607
|
+
|
|
2608
|
+
var domtoimage = domToImage$1.exports;
|
|
2609
|
+
|
|
2610
|
+
const domToImage = _ref => {
|
|
2611
|
+
let {
|
|
2612
|
+
id,
|
|
2613
|
+
fileName = 'image',
|
|
2614
|
+
quality = 0.95
|
|
2615
|
+
} = _ref;
|
|
2616
|
+
const node = document.getElementById(id);
|
|
2617
|
+
// 防止barchart的Y軸擋住圖,就先將他移到最左邊,拍完照再移回來
|
|
2618
|
+
const yaxis = document.getElementById('yaxis');
|
|
2619
|
+
const barChartElement = document.getElementById('barChart__block');
|
|
2620
|
+
if (yaxis) {
|
|
2621
|
+
yaxis.setAttribute('transform', 'translate(0, 0 )');
|
|
2622
|
+
}
|
|
2623
|
+
domtoimage.toPng(node, {
|
|
2624
|
+
quality
|
|
2625
|
+
}).then(dataUrl => {
|
|
2626
|
+
const link = document.createElement('a');
|
|
2627
|
+
link.download = `${fileName}.png`;
|
|
2628
|
+
link.href = dataUrl;
|
|
2629
|
+
link.click();
|
|
2630
|
+
if (yaxis && barChartElement) {
|
|
2631
|
+
yaxis.setAttribute('transform', 'translate(0, 0 )');
|
|
2632
|
+
yaxis.setAttribute('transform', `translate(${barChartElement.scrollLeft}, 0)`);
|
|
2633
|
+
}
|
|
2634
|
+
}).catch(error => {
|
|
2635
|
+
console.error('oops, something went wrong!', error);
|
|
2636
|
+
});
|
|
2637
|
+
};
|
|
2638
|
+
|
|
2639
|
+
const JSZip = require('jszip');
|
|
2640
|
+
const fileDownload = require('react-file-download');
|
|
2641
|
+
const DownloadGephiFileName = 'Gephi_generated_by_NMTL.zip';
|
|
2642
|
+
const generateNode = result => {
|
|
2643
|
+
let IdCount = 10000000;
|
|
2644
|
+
const nodeMap = {};
|
|
2645
|
+
let foundType = false;
|
|
2646
|
+
result.forEach(_ref => {
|
|
2647
|
+
let {
|
|
2648
|
+
source,
|
|
2649
|
+
target,
|
|
2650
|
+
sourceType,
|
|
2651
|
+
targetType
|
|
2652
|
+
} = _ref;
|
|
2653
|
+
if (target === '' || source === '') {
|
|
2654
|
+
return;
|
|
2655
|
+
}
|
|
2656
|
+
if (Object.keys(nodeMap).indexOf(source) < 0) {
|
|
2657
|
+
if (sourceType !== '') {
|
|
2658
|
+
foundType = true;
|
|
2659
|
+
nodeMap[source] = {
|
|
2660
|
+
ID: IdCount,
|
|
2661
|
+
WEIGHT: 1,
|
|
2662
|
+
NODE_TYPE: sourceType
|
|
2663
|
+
};
|
|
2664
|
+
} else {
|
|
2665
|
+
nodeMap[source] = {
|
|
2666
|
+
ID: IdCount,
|
|
2667
|
+
WEIGHT: 1
|
|
2668
|
+
};
|
|
2669
|
+
}
|
|
2670
|
+
IdCount += 1;
|
|
2671
|
+
} else {
|
|
2672
|
+
nodeMap[source].WEIGHT += 1;
|
|
2673
|
+
}
|
|
2674
|
+
if (Object.keys(nodeMap).indexOf(target) < 0) {
|
|
2675
|
+
if (targetType !== '') {
|
|
2676
|
+
foundType = true;
|
|
2677
|
+
nodeMap[target] = {
|
|
2678
|
+
ID: IdCount,
|
|
2679
|
+
WEIGHT: 1,
|
|
2680
|
+
NODE_TYPE: targetType
|
|
2681
|
+
};
|
|
2682
|
+
} else {
|
|
2683
|
+
nodeMap[target] = {
|
|
2684
|
+
ID: IdCount,
|
|
2685
|
+
WEIGHT: 1
|
|
2686
|
+
};
|
|
2687
|
+
}
|
|
2688
|
+
IdCount += 1;
|
|
2689
|
+
} else {
|
|
2690
|
+
nodeMap[target].WEIGHT += 1;
|
|
2691
|
+
}
|
|
2692
|
+
});
|
|
2693
|
+
let tsvStr = foundType ? 'ID\tLABEL\tWEIGHT\tNODE_TYPE\r\n' : 'ID\tLABEL\tWEIGHT\r\n';
|
|
2694
|
+
Object.keys(nodeMap).forEach(key => {
|
|
2695
|
+
const idval = nodeMap[key].ID;
|
|
2696
|
+
const wval = nodeMap[key].WEIGHT;
|
|
2697
|
+
const type = foundType ? nodeMap[key].NODE_TYPE : '';
|
|
2698
|
+
tsvStr += foundType ? `${idval}\t${key}\t${wval}\t${type}\r\n` : `${idval}\t${key}\t${wval}\r\n`;
|
|
2699
|
+
});
|
|
2700
|
+
return {
|
|
2701
|
+
nodeMap,
|
|
2702
|
+
nodesTsv: tsvStr
|
|
2703
|
+
};
|
|
2704
|
+
};
|
|
2705
|
+
const generateEdge = (result, nodeMap) => {
|
|
2706
|
+
let edgeStr = 'SOURCE\tTARGET\tWEIGHT\tTYPE\r\n';
|
|
2707
|
+
result.forEach(_ref2 => {
|
|
2708
|
+
let {
|
|
2709
|
+
source,
|
|
2710
|
+
target
|
|
2711
|
+
} = _ref2;
|
|
2712
|
+
if (target === '' || source === '') {
|
|
2713
|
+
return;
|
|
2714
|
+
}
|
|
2715
|
+
const sourceId = nodeMap[source].ID;
|
|
2716
|
+
const targetId = nodeMap[target].ID;
|
|
2717
|
+
edgeStr += `${sourceId}\t${targetId}\t1\tUndirected\r\n`;
|
|
2718
|
+
});
|
|
2719
|
+
return edgeStr;
|
|
2720
|
+
};
|
|
2721
|
+
const downloadGephi = snaData => {
|
|
2722
|
+
const {
|
|
2723
|
+
nodes,
|
|
2724
|
+
links
|
|
2725
|
+
} = snaData;
|
|
2726
|
+
const result = (links || []).map(_ref3 => {
|
|
2727
|
+
let {
|
|
2728
|
+
source,
|
|
2729
|
+
target
|
|
2730
|
+
} = _ref3;
|
|
2731
|
+
return {
|
|
2732
|
+
source: nodes[source].name,
|
|
2733
|
+
target: nodes[target].name,
|
|
2734
|
+
sourceType: nodes[source].type,
|
|
2735
|
+
targetType: nodes[target].type
|
|
2736
|
+
};
|
|
2737
|
+
});
|
|
2738
|
+
const {
|
|
2739
|
+
nodeMap,
|
|
2740
|
+
nodesTsv
|
|
2741
|
+
} = generateNode(result);
|
|
2742
|
+
const edgesTsv = generateEdge(result, nodeMap);
|
|
2743
|
+
const zip = new JSZip();
|
|
2744
|
+
zip.file('Node_Table.tsv', nodesTsv);
|
|
2745
|
+
zip.file('Edge_Table.tsv', edgesTsv);
|
|
2746
|
+
zip.generateAsync({
|
|
2747
|
+
type: 'blob'
|
|
2748
|
+
}).then(content => {
|
|
2749
|
+
fileDownload(content, DownloadGephiFileName);
|
|
2750
|
+
});
|
|
2751
|
+
};
|
|
2752
|
+
|
|
2753
|
+
/* 轉檔工具, 提供API轉下載tsv/xlsx */
|
|
2754
|
+
|
|
2755
|
+
/* 大事年表 */
|
|
2756
|
+
const chronologyConvert = data => {
|
|
2757
|
+
const getText = function () {
|
|
2758
|
+
let text = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
2759
|
+
const [before, after] = text.split('<span class="tooltip">');
|
|
2760
|
+
return {
|
|
2761
|
+
before,
|
|
2762
|
+
after
|
|
2763
|
+
};
|
|
2764
|
+
};
|
|
2765
|
+
|
|
2766
|
+
/* 做資料過濾 */
|
|
2767
|
+
const newData = (data || []).map(_ref => {
|
|
2768
|
+
let {
|
|
2769
|
+
start_date: {
|
|
2770
|
+
day,
|
|
2771
|
+
month,
|
|
2772
|
+
year
|
|
2773
|
+
},
|
|
2774
|
+
display_date: displayDate,
|
|
2775
|
+
text: {
|
|
2776
|
+
headline,
|
|
2777
|
+
text
|
|
2778
|
+
}
|
|
2779
|
+
} = _ref;
|
|
2780
|
+
return {
|
|
2781
|
+
日期: `${year || ''}/${month || ''}/${day || ''}`,
|
|
2782
|
+
名稱: (displayDate || '').replace('<span>', '').replace('</span>', ''),
|
|
2783
|
+
描述: (headline || '').replaceAll(/(<([^>]+)>)/gi, ''),
|
|
2784
|
+
類型: getText(text).before,
|
|
2785
|
+
'註(資料集名稱)': getText(text).after.replaceAll('\n', '').replaceAll('\t', '').replace('註', '').replace('資料來源:', '').replaceAll(/(<([^>]+)>)/gi, '')
|
|
2786
|
+
};
|
|
2787
|
+
});
|
|
2788
|
+
return newData;
|
|
2789
|
+
};
|
|
2790
|
+
|
|
2791
|
+
/* 文學數據 - 地圖 */
|
|
2792
|
+
const mapConvert = data => (data || []).map(_ref2 => {
|
|
2793
|
+
let {
|
|
2794
|
+
title,
|
|
2795
|
+
author,
|
|
2796
|
+
publisher,
|
|
2797
|
+
locations,
|
|
2798
|
+
posX,
|
|
2799
|
+
posY
|
|
2800
|
+
} = _ref2;
|
|
2801
|
+
return {
|
|
2802
|
+
'名稱(書名/文章名)': title || '',
|
|
2803
|
+
作者: author || '',
|
|
2804
|
+
出版者: publisher || '',
|
|
2805
|
+
'地點(作品描述區域)': locations || '',
|
|
2806
|
+
經度: posX || '',
|
|
2807
|
+
緯度: posY || ''
|
|
2808
|
+
};
|
|
2809
|
+
});
|
|
2810
|
+
|
|
2811
|
+
/* 文學數據 - 地圖(文學聚落) */
|
|
2812
|
+
const mapLgConvert = data => (data || []).map(_ref3 => {
|
|
2813
|
+
let {
|
|
2814
|
+
title,
|
|
2815
|
+
locationOfFormation,
|
|
2816
|
+
workLocations,
|
|
2817
|
+
createPosX,
|
|
2818
|
+
createPosY,
|
|
2819
|
+
activePosX,
|
|
2820
|
+
activePosY
|
|
2821
|
+
} = _ref3;
|
|
2822
|
+
return {
|
|
2823
|
+
組織名稱: title || '',
|
|
2824
|
+
創立地點: locationOfFormation,
|
|
2825
|
+
創立地點經度: createPosX || '',
|
|
2826
|
+
創立地點緯度: createPosY || '',
|
|
2827
|
+
活動地點: workLocations || '',
|
|
2828
|
+
活動地點經度: activePosX || '',
|
|
2829
|
+
活動地點緯度: activePosY || ''
|
|
2830
|
+
};
|
|
2831
|
+
});
|
|
2832
|
+
|
|
2833
|
+
/* 文學數據 - 年度聲量 */
|
|
2834
|
+
const worksBarChart = data => (data || []).map(_ref4 => {
|
|
2835
|
+
let {
|
|
2836
|
+
date,
|
|
2837
|
+
year,
|
|
2838
|
+
title,
|
|
2839
|
+
keywords,
|
|
2840
|
+
authors,
|
|
2841
|
+
genreName
|
|
2842
|
+
} = _ref4;
|
|
2843
|
+
return {
|
|
2844
|
+
'出版年/發表年': date || year || '',
|
|
2845
|
+
'名稱(書名/文章名)': title || '',
|
|
2846
|
+
作者: (authors || []).map(_ref5 => {
|
|
2847
|
+
let {
|
|
2848
|
+
author
|
|
2849
|
+
} = _ref5;
|
|
2850
|
+
return author;
|
|
2851
|
+
}).join(','),
|
|
2852
|
+
關鍵字: (keywords || '').replaceAll('\n', ''),
|
|
2853
|
+
文學分類: genreName || ''
|
|
2854
|
+
};
|
|
2855
|
+
});
|
|
2856
|
+
|
|
2857
|
+
/* 文學數據 - 文學自由搭配 */
|
|
2858
|
+
const worksSlider = data => (data || []).map(_ref6 => {
|
|
2859
|
+
let {
|
|
2860
|
+
title,
|
|
2861
|
+
author,
|
|
2862
|
+
date
|
|
2863
|
+
} = _ref6;
|
|
2864
|
+
return {
|
|
2865
|
+
'名稱(書名/文章名)': title || '',
|
|
2866
|
+
作者: author || '',
|
|
2867
|
+
'出版日期/發表日期': date || ''
|
|
2868
|
+
// 文學分類: genreName || '',
|
|
2869
|
+
// 作品描述地: workDesc || '',
|
|
2870
|
+
// 作家出生地: locations,
|
|
2871
|
+
// 獲獎獎項: awards || '',
|
|
2872
|
+
};
|
|
2873
|
+
});
|
|
2874
|
+
|
|
2875
|
+
const exportXlsx = _ref => {
|
|
2876
|
+
let {
|
|
2877
|
+
data,
|
|
2878
|
+
dataType,
|
|
2879
|
+
extType = 'xlsx'
|
|
2880
|
+
} = _ref;
|
|
2881
|
+
let metadata;
|
|
2882
|
+
switch (dataType) {
|
|
2883
|
+
case 'sna':
|
|
2884
|
+
metadata = snaToExcel(data);
|
|
2885
|
+
break;
|
|
2886
|
+
default:
|
|
2887
|
+
metadata = data;
|
|
2888
|
+
break;
|
|
2889
|
+
}
|
|
2890
|
+
fileDownload$1(`\uFEFF${jsonExcel(metadata)}`, `output.${extType}`);
|
|
2891
|
+
};
|
|
2892
|
+
|
|
2893
|
+
// 供外部使用dataConvert
|
|
2894
|
+
exportXlsx.chronologyConvert = chronologyConvert;
|
|
2895
|
+
exportXlsx.mapConvert = mapConvert;
|
|
2896
|
+
exportXlsx.mapLgConvert = mapLgConvert;
|
|
2897
|
+
exportXlsx.worksBarChart = worksBarChart;
|
|
2898
|
+
exportXlsx.worksSlider = worksSlider;
|
|
2899
|
+
|
|
2900
|
+
/* eslint-disable max-len */
|
|
2901
|
+
const DownloadImg = _ref => {
|
|
2902
|
+
let {
|
|
2903
|
+
fill = '#825c0d'
|
|
2904
|
+
} = _ref;
|
|
2905
|
+
return /*#__PURE__*/React__default.createElement("svg", {
|
|
2906
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2907
|
+
width: 32,
|
|
2908
|
+
height: 32,
|
|
2909
|
+
viewBox: "0 0 32 32"
|
|
2910
|
+
}, /*#__PURE__*/React__default.createElement("defs", null, /*#__PURE__*/React__default.createElement("clipPath", {
|
|
2911
|
+
id: "a"
|
|
2912
|
+
}, /*#__PURE__*/React__default.createElement("path", {
|
|
2913
|
+
"data-name": "Rectangle 125",
|
|
2914
|
+
style: {
|
|
2915
|
+
fill: '#fff'
|
|
2916
|
+
},
|
|
2917
|
+
d: "M0 0h32v32H0z"
|
|
2918
|
+
}))), /*#__PURE__*/React__default.createElement("g", {
|
|
2919
|
+
style: {
|
|
2920
|
+
clipPath: 'url(#a)'
|
|
2921
|
+
}
|
|
2922
|
+
}, /*#__PURE__*/React__default.createElement("path", {
|
|
2923
|
+
d: "M-960 600h-20v-10h4v2h-2v6h16v-6h-2v-2h4zm-5.06-12.608-1.348-1.454-2.592 2.427V580h-2v8.365l-2.544-2.427-1.362 1.454 4.948 4.671z",
|
|
2924
|
+
transform: "translate(986 -574)",
|
|
2925
|
+
style: {
|
|
2926
|
+
fill
|
|
2927
|
+
},
|
|
2928
|
+
"data-name": "Mask Group 42"
|
|
2929
|
+
})));
|
|
2930
|
+
};
|
|
2931
|
+
|
|
2932
|
+
/* eslint-disable max-len */
|
|
2933
|
+
const SVGComponent$2 = _ref => {
|
|
2934
|
+
let {
|
|
2935
|
+
fill = '#825c0d'
|
|
2936
|
+
} = _ref;
|
|
2937
|
+
return /*#__PURE__*/React.createElement("svg", {
|
|
2938
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2939
|
+
width: 32,
|
|
2940
|
+
height: 32,
|
|
2941
|
+
viewBox: "0 0 32 32"
|
|
2942
|
+
}, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("clipPath", {
|
|
2943
|
+
id: "clip-path"
|
|
2944
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
2945
|
+
id: "Rectangle_128",
|
|
2946
|
+
"data-name": "Rectangle 128",
|
|
2947
|
+
style: {
|
|
2948
|
+
fill: '#fff'
|
|
2949
|
+
},
|
|
2950
|
+
d: "M0 0h32v32H0z"
|
|
2951
|
+
})), /*#__PURE__*/React.createElement("style", null, `\n .cls-3{fill:${fill}}\n `)), /*#__PURE__*/React.createElement("g", {
|
|
2952
|
+
id: "Mask_Group_47",
|
|
2953
|
+
"data-name": "Mask Group 47",
|
|
2954
|
+
style: {
|
|
2955
|
+
clipPath: 'url(#clip-path)'
|
|
2956
|
+
}
|
|
2957
|
+
}, /*#__PURE__*/React.createElement("g", {
|
|
2958
|
+
id: "Group_3633",
|
|
2959
|
+
"data-name": "Group 3633",
|
|
2960
|
+
transform: "translate(6 6)"
|
|
2961
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
2962
|
+
id: "Path_181",
|
|
2963
|
+
"data-name": "Path 181",
|
|
2964
|
+
className: "cls-3",
|
|
2965
|
+
d: "M514 371v-2h-2v2h-2v2h2v2h2v-2h2v-2z",
|
|
2966
|
+
transform: "translate(-495 -369)"
|
|
2967
|
+
}), /*#__PURE__*/React.createElement("g", {
|
|
2968
|
+
id: "Group_3632",
|
|
2969
|
+
"data-name": "Group 3632",
|
|
2970
|
+
transform: "translate(0 2)"
|
|
2971
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
2972
|
+
id: "Path_182",
|
|
2973
|
+
"data-name": "Path 182",
|
|
2974
|
+
className: "cls-3",
|
|
2975
|
+
d: "M502.276 371h3.447L512 389h-3.164l-1.595-5.129h-6.586L499.036 389H496zm-.926 10.649h5.17l-.746-2.419c-.643-1.953-1.209-3.956-1.776-5.983h-.128a126.193 126.193 0 0 1-1.748 5.983z",
|
|
2976
|
+
transform: "translate(-496 -371)"
|
|
2977
|
+
})))));
|
|
2978
|
+
};
|
|
2979
|
+
|
|
2980
|
+
/* eslint-disable max-len */
|
|
2981
|
+
const SVGComponent$1 = _ref => {
|
|
2982
|
+
let {
|
|
2983
|
+
fill = '#825c0d'
|
|
2984
|
+
} = _ref;
|
|
2985
|
+
return /*#__PURE__*/React.createElement("svg", {
|
|
2986
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2987
|
+
width: 32,
|
|
2988
|
+
height: 32,
|
|
2989
|
+
viewBox: "0 0 32 32"
|
|
2990
|
+
}, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("clipPath", {
|
|
2991
|
+
id: "clip-path"
|
|
2992
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
2993
|
+
id: "Rectangle_129",
|
|
2994
|
+
"data-name": "Rectangle 129",
|
|
2995
|
+
style: {
|
|
2996
|
+
fill: '#fff'
|
|
2997
|
+
},
|
|
2998
|
+
d: "M0 0h32v32H0z"
|
|
2999
|
+
})), /*#__PURE__*/React.createElement("style", null, `\n .cls-3{fill:${fill}}\n `)), /*#__PURE__*/React.createElement("g", {
|
|
3000
|
+
id: "Mask_Group_48",
|
|
3001
|
+
"data-name": "Mask Group 48",
|
|
3002
|
+
style: {
|
|
3003
|
+
clipPath: 'url(#clip-path)'
|
|
3004
|
+
}
|
|
3005
|
+
}, /*#__PURE__*/React.createElement("g", {
|
|
3006
|
+
id: "Group_3635",
|
|
3007
|
+
"data-name": "Group 3635",
|
|
3008
|
+
transform: "translate(6 8)"
|
|
3009
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
3010
|
+
id: "Path_181",
|
|
3011
|
+
"data-name": "Path 181",
|
|
3012
|
+
className: "cls-3",
|
|
3013
|
+
d: "M510 371v2h6v-2z",
|
|
3014
|
+
transform: "translate(-495 -371)"
|
|
3015
|
+
}), /*#__PURE__*/React.createElement("g", {
|
|
3016
|
+
id: "Group_3632",
|
|
3017
|
+
"data-name": "Group 3632"
|
|
3018
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
3019
|
+
id: "Path_182",
|
|
3020
|
+
"data-name": "Path 182",
|
|
3021
|
+
className: "cls-3",
|
|
3022
|
+
d: "M502.276 371h3.447L512 389h-3.164l-1.595-5.129h-6.586L499.036 389H496zm-.926 10.649h5.17l-.746-2.419c-.643-1.953-1.209-3.956-1.776-5.983h-.128a126.193 126.193 0 0 1-1.748 5.983z",
|
|
3023
|
+
transform: "translate(-496 -371)"
|
|
3024
|
+
})))));
|
|
3025
|
+
};
|
|
3026
|
+
|
|
3027
|
+
const SVGComponent = _ref => {
|
|
3028
|
+
let {
|
|
3029
|
+
fill = '#825c0d'
|
|
3030
|
+
} = _ref;
|
|
3031
|
+
return /*#__PURE__*/React.createElement("svg", {
|
|
3032
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3033
|
+
width: 32,
|
|
3034
|
+
height: 32,
|
|
3035
|
+
viewBox: "0 0 32 32"
|
|
3036
|
+
}, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("clipPath", {
|
|
3037
|
+
id: "clip-path"
|
|
3038
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
3039
|
+
id: "Rectangle_124",
|
|
3040
|
+
"data-name": "Rectangle 124",
|
|
3041
|
+
style: {
|
|
3042
|
+
fill: '#fff'
|
|
3043
|
+
},
|
|
3044
|
+
d: "M0 0h32v32H0z"
|
|
3045
|
+
})), /*#__PURE__*/React.createElement("style", null, `\n .cls-3{fill:${fill}}\n `)), /*#__PURE__*/React.createElement("g", {
|
|
3046
|
+
id: "Mask_Group_46",
|
|
3047
|
+
"data-name": "Mask Group 46",
|
|
3048
|
+
style: {
|
|
3049
|
+
clipPath: 'url(#clip-path)'
|
|
3050
|
+
}
|
|
3051
|
+
}, /*#__PURE__*/React.createElement("g", {
|
|
3052
|
+
id: "Group_3629",
|
|
3053
|
+
"data-name": "Group 3629",
|
|
3054
|
+
transform: "translate(6 6.001)"
|
|
3055
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
3056
|
+
id: "Path_176",
|
|
3057
|
+
"data-name": "Path 176",
|
|
3058
|
+
className: "cls-3",
|
|
3059
|
+
d: "M-721 1949.376h2.5v-3.755h3.755v-2.5H-721z",
|
|
3060
|
+
transform: "translate(721.003 -1943.118)"
|
|
3061
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
3062
|
+
id: "Path_177",
|
|
3063
|
+
"data-name": "Path 177",
|
|
3064
|
+
className: "cls-3",
|
|
3065
|
+
d: "M-721 1960.376h6.258v-2.5h-3.758v-3.755h-2.5z",
|
|
3066
|
+
transform: "translate(721.003 -1940.376)"
|
|
3067
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
3068
|
+
id: "Path_178",
|
|
3069
|
+
"data-name": "Path 178",
|
|
3070
|
+
className: "cls-3",
|
|
3071
|
+
d: "M-703.744 1943.118H-710v2.5h3.755v3.755h2.5z",
|
|
3072
|
+
transform: "translate(723.744 -1943.118)"
|
|
3073
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
3074
|
+
id: "Path_179",
|
|
3075
|
+
"data-name": "Path 179",
|
|
3076
|
+
className: "cls-3",
|
|
3077
|
+
d: "M-703.744 1960.376v-6.259h-2.5v3.755H-710v2.5z",
|
|
3078
|
+
transform: "translate(723.744 -1940.376)"
|
|
3079
|
+
}))));
|
|
3080
|
+
};
|
|
3081
|
+
|
|
3082
|
+
const ResetIcon = _ref => {
|
|
3083
|
+
let {
|
|
3084
|
+
fill = '#825c0d'
|
|
3085
|
+
} = _ref;
|
|
3086
|
+
return /*#__PURE__*/React__default.createElement("svg", {
|
|
3087
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3088
|
+
width: "32",
|
|
3089
|
+
height: "32",
|
|
3090
|
+
viewBox: "0 0 32 32"
|
|
3091
|
+
}, /*#__PURE__*/React__default.createElement("defs", null, /*#__PURE__*/React__default.createElement("clipPath", {
|
|
3092
|
+
id: "lt43fd2cha"
|
|
3093
|
+
}, /*#__PURE__*/React__default.createElement("path", {
|
|
3094
|
+
"data-name": "Rectangle 235",
|
|
3095
|
+
transform: "translate(1257 1065)",
|
|
3096
|
+
fill: fill,
|
|
3097
|
+
d: "M0 0h32v32H0z"
|
|
3098
|
+
}))), /*#__PURE__*/React__default.createElement("g", {
|
|
3099
|
+
"data-name": "Mask Group 85",
|
|
3100
|
+
transform: "translate(-1257 -1065)",
|
|
3101
|
+
style: {
|
|
3102
|
+
clipPath: 'url(#lt43fd2cha)'
|
|
3103
|
+
}
|
|
3104
|
+
}, /*#__PURE__*/React__default.createElement("path", {
|
|
3105
|
+
"data-name": "Path 624",
|
|
3106
|
+
d: "M10.17 2.285V.369L5.749 3.463l4.42 3.094V4.645a6.682 6.682 0 1 1-6.711 6.681H1.1a9.042 9.042 0 1 0 9.07-9.041z",
|
|
3107
|
+
transform: "translate(1262.9 1070.631)",
|
|
3108
|
+
fill: fill
|
|
3109
|
+
})));
|
|
3110
|
+
};
|
|
3111
|
+
|
|
3112
|
+
const ResetMobileIcon = _ref => {
|
|
3113
|
+
let {
|
|
3114
|
+
fill = '#825c0d'
|
|
3115
|
+
} = _ref;
|
|
3116
|
+
return /*#__PURE__*/React__default.createElement("svg", {
|
|
3117
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3118
|
+
width: "32",
|
|
3119
|
+
height: "32",
|
|
3120
|
+
viewBox: "0 0 32 32"
|
|
3121
|
+
}, /*#__PURE__*/React__default.createElement("defs", null, /*#__PURE__*/React__default.createElement("clipPath", {
|
|
3122
|
+
id: "c8go4wjvba"
|
|
3123
|
+
}, /*#__PURE__*/React__default.createElement("path", {
|
|
3124
|
+
"data-name": "Rectangle 236",
|
|
3125
|
+
transform: "translate(1257 1065)",
|
|
3126
|
+
style: {
|
|
3127
|
+
fill: '#fff'
|
|
3128
|
+
},
|
|
3129
|
+
d: "M0 0h32v32H0z"
|
|
3130
|
+
}))), /*#__PURE__*/React__default.createElement("g", {
|
|
3131
|
+
"data-name": "Mask Group 86",
|
|
3132
|
+
transform: "translate(-1257 -1065)",
|
|
3133
|
+
style: {
|
|
3134
|
+
clipPath: 'url(#c8go4wjvba)'
|
|
3135
|
+
}
|
|
3136
|
+
}, /*#__PURE__*/React__default.createElement("path", {
|
|
3137
|
+
"data-name": "Path 625",
|
|
3138
|
+
d: "M8.809 2V.369L5.052 3l3.757 2.63V4A5.68 5.68 0 1 1 3.1 9.682h-2A7.686 7.686 0 1 0 8.809 2z",
|
|
3139
|
+
transform: "translate(1264.214 1072.131)",
|
|
3140
|
+
style: {
|
|
3141
|
+
fill
|
|
3142
|
+
}
|
|
3143
|
+
})));
|
|
3144
|
+
};
|
|
3145
|
+
|
|
3146
|
+
var css_248z = ".extraTools {\n width: 100%;\n display: inline-flex;\n justify-content: flex-end;\n align-items: center;\n gap: 1rem;\n padding: 0px 20px;\n padding-top: 12px; }\n .extraTools__share button {\n display: flex;\n justify-content: center;\n align-items: center; }\n .extraTools__download {\n cursor: pointer; }\n .extraTools__download-icon {\n display: flex;\n justify-content: center;\n align-items: center; }\n .extraTools__fullscreenBtn {\n cursor: pointer;\n padding-top: 0; }\n .extraTools__fullscreenBtn-icon {\n display: flex;\n justify-content: center;\n align-items: center; }\n .extraTools__fontsize {\n display: flex;\n justify-content: center;\n align-items: center; }\n .extraTools .font-size-changer,\n .extraTools .font-size-changer-buttons,\n .extraTools .font-size-up,\n .extraTools .font-size-down,\n .extraTools .tooltip {\n display: flex;\n justify-content: center;\n align-items: center; }\n .extraTools .font-size-up {\n width: 32px !important;\n cursor: pointer;\n margin-right: 16px !important; }\n .extraTools .font-size-down {\n cursor: pointer;\n width: 32px !important; }\n .extraTools .fullscreenExit {\n text-align: right;\n cursor: pointer;\n border: 0; }\n .extraTools #download-menu .MuiMenuItem-root {\n color: #4e3a16;\n width: auto;\n overflow: hidden;\n font-size: 1rem;\n box-sizing: border-box;\n min-height: 48px;\n font-weight: 400;\n line-height: 1;\n padding-top: 1rem;\n white-space: initial;\n border-bottom: 0;\n letter-spacing: 0.00938em;\n padding-bottom: 1rem; }\n";
|
|
3147
|
+
styleInject(css_248z);
|
|
3148
|
+
|
|
3149
|
+
/* eslint-disable prefer-destructuring */
|
|
3150
|
+
const ShareButton = _ref => {
|
|
3151
|
+
let {
|
|
3152
|
+
className
|
|
3153
|
+
} = _ref;
|
|
3154
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
3155
|
+
className: classNames('extraTools__share', className)
|
|
3156
|
+
}, /*#__PURE__*/React__default.createElement(FacebookShareButton, {
|
|
3157
|
+
url: document.location.href
|
|
3158
|
+
}, /*#__PURE__*/React__default.createElement(FacebookIcon, {
|
|
3159
|
+
size: 32,
|
|
3160
|
+
round: true
|
|
3161
|
+
})));
|
|
3162
|
+
};
|
|
3163
|
+
ShareButton.defaultProps = {
|
|
3164
|
+
className: undefined
|
|
3165
|
+
};
|
|
3166
|
+
|
|
3167
|
+
/* Write props detail information and 'npm run updateStory' will help you generate stories's argTypes */
|
|
3168
|
+
ShareButton.propTypes = {
|
|
3169
|
+
/** Css Name */
|
|
3170
|
+
className: PropTypes.string
|
|
3171
|
+
};
|
|
3172
|
+
const DownloadMenu = _ref2 => {
|
|
3173
|
+
let {
|
|
3174
|
+
className,
|
|
3175
|
+
intl,
|
|
3176
|
+
exclude,
|
|
3177
|
+
iconColor,
|
|
3178
|
+
data,
|
|
3179
|
+
dataType,
|
|
3180
|
+
domToImageId,
|
|
3181
|
+
DownloadExcel
|
|
3182
|
+
} = _ref2;
|
|
3183
|
+
const [anchorEl, setAnchorEl] = useState(null);
|
|
3184
|
+
const hideButton = type => (exclude || []).filter(key => key === type).length > 0;
|
|
3185
|
+
const btns = [{
|
|
3186
|
+
key: 'downloadImage',
|
|
3187
|
+
onClick: () => domToImage({
|
|
3188
|
+
id: domToImageId
|
|
3189
|
+
}),
|
|
3190
|
+
label: intl ? 'knowledge.writersAndWorksSNA.download.img' : '下載圖片'
|
|
3191
|
+
}, {
|
|
3192
|
+
key: 'downloadGephi',
|
|
3193
|
+
onClick: () => downloadGephi(data),
|
|
3194
|
+
label: intl ? 'knowledge.writersAndWorksSNA.download.gephi' : '下載Gephi'
|
|
3195
|
+
}, {
|
|
3196
|
+
key: 'downloadTsv',
|
|
3197
|
+
onClick: () => exportXlsx({
|
|
3198
|
+
data,
|
|
3199
|
+
dataType,
|
|
3200
|
+
extType: 'tsv'
|
|
3201
|
+
}),
|
|
3202
|
+
label: intl ? 'knowledge.writersAndWorksSNA.download.tsv' : '下載Tsv'
|
|
3203
|
+
}, {
|
|
3204
|
+
key: 'downloadXls',
|
|
3205
|
+
// download click trigger 交給 react-data-export
|
|
3206
|
+
label: intl ? 'knowledge.writersAndWorksSNA.download.xls' : '下載Excel'
|
|
3207
|
+
}];
|
|
3208
|
+
// eslint-disable-next-line no-confusing-arrow
|
|
3209
|
+
const isXlsxButton = (key, dom) => key === 'downloadXls' && DownloadExcel ? /*#__PURE__*/React__default.createElement(DownloadExcel, {
|
|
3210
|
+
key: key,
|
|
3211
|
+
element: dom,
|
|
3212
|
+
data: data
|
|
3213
|
+
}) : dom;
|
|
3214
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
3215
|
+
className: classNames('extraTools__download', className)
|
|
3216
|
+
}, /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
3217
|
+
title: intl ? intl.formatMessage({
|
|
3218
|
+
id: 'knowledge.writersAndWorksSNA.download'
|
|
3219
|
+
}) : '下載',
|
|
3220
|
+
placement: "bottom"
|
|
3221
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
3222
|
+
className: "extraTools__download-icon",
|
|
3223
|
+
onClick: e => setAnchorEl(e.currentTarget)
|
|
3224
|
+
}, /*#__PURE__*/React__default.createElement(DownloadImg, {
|
|
3225
|
+
fill: iconColor
|
|
3226
|
+
}))), /*#__PURE__*/React__default.createElement(Menu, {
|
|
3227
|
+
id: "download-menu",
|
|
3228
|
+
anchorEl: anchorEl,
|
|
3229
|
+
keepMounted: true,
|
|
3230
|
+
open: Boolean(anchorEl),
|
|
3231
|
+
onClose: () => setAnchorEl(null)
|
|
3232
|
+
}, btns.map(_ref3 => {
|
|
3233
|
+
let {
|
|
3234
|
+
key,
|
|
3235
|
+
onClick,
|
|
3236
|
+
label
|
|
3237
|
+
} = _ref3;
|
|
3238
|
+
return !hideButton(key) && isXlsxButton(key, /*#__PURE__*/React__default.createElement(MenuItem, {
|
|
3239
|
+
key: key,
|
|
3240
|
+
onClick: onClick
|
|
3241
|
+
}, intl ? intl.formatMessage({
|
|
3242
|
+
id: label
|
|
3243
|
+
}) : label));
|
|
3244
|
+
})));
|
|
3245
|
+
};
|
|
3246
|
+
DownloadMenu.defaultProps = {
|
|
3247
|
+
className: undefined,
|
|
3248
|
+
intl: undefined,
|
|
3249
|
+
exclude: undefined,
|
|
3250
|
+
data: null,
|
|
3251
|
+
dataType: undefined,
|
|
3252
|
+
iconColor: '#825c0d',
|
|
3253
|
+
domToImageId: 'network-graph',
|
|
3254
|
+
DownloadExcel: undefined
|
|
3255
|
+
};
|
|
3256
|
+
|
|
3257
|
+
/* Write props detail information and 'npm run updateStory' will help you generate stories's argTypes */
|
|
3258
|
+
DownloadMenu.propTypes = {
|
|
3259
|
+
/** Css Name */
|
|
3260
|
+
className: PropTypes.string,
|
|
3261
|
+
/** 語言 */
|
|
3262
|
+
intl: PropTypes.objectOf(PropTypes.any),
|
|
3263
|
+
/** 不顯示的按鈕 [ 'downloadImage', 'downloadTsv', 'downloadXls'] */
|
|
3264
|
+
exclude: PropTypes.arrayOf(PropTypes.string),
|
|
3265
|
+
/** 資料 */
|
|
3266
|
+
data: PropTypes.oneOfType([PropTypes.array, PropTypes.object]),
|
|
3267
|
+
/** 如果有下載xlsx文件, 需要提供type輸出使用 */
|
|
3268
|
+
dataType: PropTypes.string,
|
|
3269
|
+
/** icon顏色 */
|
|
3270
|
+
iconColor: PropTypes.string,
|
|
3271
|
+
/** 指定dom轉換畫布的DOM ID */
|
|
3272
|
+
domToImageId: PropTypes.string,
|
|
3273
|
+
/** Download元件, 由外部傳入的原因是需要環境設定 */
|
|
3274
|
+
DownloadExcel: PropTypes.oneOfType([PropTypes.node, PropTypes.func])
|
|
3275
|
+
};
|
|
3276
|
+
const FullscreenBtn = _ref4 => {
|
|
3277
|
+
let {
|
|
3278
|
+
className,
|
|
3279
|
+
intl,
|
|
3280
|
+
iconColor,
|
|
3281
|
+
fullscreenDomId
|
|
3282
|
+
} = _ref4;
|
|
3283
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
3284
|
+
className: classNames('extraTools__fullscreenBtn', className)
|
|
3285
|
+
}, /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
3286
|
+
title: intl ? intl.formatMessage({
|
|
3287
|
+
id: 'knowledge.writersAndWorksSNA.fullscreen'
|
|
3288
|
+
}) : '全螢幕模式',
|
|
3289
|
+
placement: "bottom"
|
|
3290
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
3291
|
+
className: "extraTools__fullscreenBtn-icon",
|
|
3292
|
+
onClick: () => {
|
|
3293
|
+
if (screenfull.isEnabled && fullscreenDomId) screenfull.request(document.getElementById(fullscreenDomId));
|
|
3294
|
+
}
|
|
3295
|
+
}, /*#__PURE__*/React__default.createElement(SVGComponent, {
|
|
3296
|
+
fill: iconColor
|
|
3297
|
+
}))));
|
|
3298
|
+
};
|
|
3299
|
+
FullscreenBtn.defaultProps = {
|
|
3300
|
+
className: undefined,
|
|
3301
|
+
intl: undefined,
|
|
3302
|
+
iconColor: '#825c0d',
|
|
3303
|
+
fullscreenDomId: undefined
|
|
3304
|
+
};
|
|
3305
|
+
|
|
3306
|
+
/* Write props detail information and 'npm run updateStory' will help you generate stories's argTypes */
|
|
3307
|
+
FullscreenBtn.propTypes = {
|
|
3308
|
+
/** Css Name */
|
|
3309
|
+
className: PropTypes.string,
|
|
3310
|
+
/** 語言 */
|
|
3311
|
+
intl: PropTypes.objectOf(PropTypes.any),
|
|
3312
|
+
/** icon顏色 */
|
|
3313
|
+
iconColor: PropTypes.string,
|
|
3314
|
+
/** 全螢幕指定DOM */
|
|
3315
|
+
fullscreenDomId: PropTypes.string
|
|
3316
|
+
};
|
|
3317
|
+
const FontSizeChanger = _ref5 => {
|
|
3318
|
+
let {
|
|
3319
|
+
className,
|
|
3320
|
+
intl,
|
|
3321
|
+
iconColor,
|
|
3322
|
+
FontSizeTargets,
|
|
3323
|
+
FontSizeOptions
|
|
3324
|
+
} = _ref5;
|
|
3325
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
3326
|
+
className: classNames('extraTools__fontsize', className)
|
|
3327
|
+
}, /*#__PURE__*/React__default.createElement(FontSize, {
|
|
3328
|
+
targets: FontSizeTargets,
|
|
3329
|
+
options: FontSizeOptions,
|
|
3330
|
+
customButtons: {
|
|
3331
|
+
up: /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
3332
|
+
title: intl ? intl.formatMessage({
|
|
3333
|
+
id: 'knowledge.writersAndWorksSNA.big'
|
|
3334
|
+
}) : '字級放大',
|
|
3335
|
+
placement: "bottom"
|
|
3336
|
+
}, /*#__PURE__*/React__default.createElement(SVGComponent$2, {
|
|
3337
|
+
fill: iconColor
|
|
3338
|
+
})),
|
|
3339
|
+
down: /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
3340
|
+
title: intl ? intl.formatMessage({
|
|
3341
|
+
id: 'knowledge.writersAndWorksSNA.small'
|
|
3342
|
+
}) : '字級縮小',
|
|
3343
|
+
placement: "bottom"
|
|
3344
|
+
}, /*#__PURE__*/React__default.createElement(SVGComponent$1, {
|
|
3345
|
+
fill: iconColor
|
|
3346
|
+
})),
|
|
3347
|
+
style: {
|
|
3348
|
+
border: 'none'
|
|
3349
|
+
},
|
|
3350
|
+
buttonsMargin: 10
|
|
3351
|
+
}
|
|
3352
|
+
}));
|
|
3353
|
+
};
|
|
3354
|
+
FontSizeChanger.defaultProps = {
|
|
3355
|
+
className: undefined,
|
|
3356
|
+
intl: undefined,
|
|
3357
|
+
iconColor: '#825c0d',
|
|
3358
|
+
FontSizeTargets: ['#network-graph svg g text'],
|
|
3359
|
+
FontSizeOptions: {
|
|
3360
|
+
stepSize: 2,
|
|
3361
|
+
range: 1
|
|
3362
|
+
}
|
|
3363
|
+
};
|
|
3364
|
+
|
|
3365
|
+
/* Write props detail information and 'npm run updateStory' will help you generate stories's argTypes */
|
|
3366
|
+
FontSizeChanger.propTypes = {
|
|
3367
|
+
/** Css Name */
|
|
3368
|
+
className: PropTypes.string,
|
|
3369
|
+
/** 語言 */
|
|
3370
|
+
intl: PropTypes.objectOf(PropTypes.any),
|
|
3371
|
+
/** icon顏色 */
|
|
3372
|
+
iconColor: PropTypes.string,
|
|
3373
|
+
/** 改變文字的目標DOM['css selector']) */
|
|
3374
|
+
FontSizeTargets: PropTypes.arrayOf(PropTypes.string),
|
|
3375
|
+
/** 改變文字的選項 */
|
|
3376
|
+
FontSizeOptions: PropTypes.objectOf(PropTypes.any)
|
|
3377
|
+
};
|
|
3378
|
+
const SNAResetBtn = _ref6 => {
|
|
3379
|
+
let {
|
|
3380
|
+
className,
|
|
3381
|
+
intl,
|
|
3382
|
+
iconColor,
|
|
3383
|
+
renderSNA
|
|
3384
|
+
} = _ref6;
|
|
3385
|
+
const isMobile = useMediaQuery('(max-width: 746px)');
|
|
3386
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
3387
|
+
className: classNames('extraTools__resetSNA', className)
|
|
3388
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
3389
|
+
id: "resetBtn"
|
|
3390
|
+
}, /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
3391
|
+
title: intl ? intl.formatMessage({
|
|
3392
|
+
id: 'common.sna.reset'
|
|
3393
|
+
}) : '回到原來位置與大小',
|
|
3394
|
+
placement: "bottom"
|
|
3395
|
+
}, /*#__PURE__*/React__default.createElement(IconButton, {
|
|
3396
|
+
onClick: () => renderSNA(),
|
|
3397
|
+
style: {
|
|
3398
|
+
padding: '0px'
|
|
3399
|
+
}
|
|
3400
|
+
}, isMobile ? /*#__PURE__*/React__default.createElement(ResetMobileIcon, {
|
|
3401
|
+
fill: iconColor
|
|
3402
|
+
}) : /*#__PURE__*/React__default.createElement(ResetIcon, {
|
|
3403
|
+
fill: iconColor
|
|
3404
|
+
})))));
|
|
3405
|
+
};
|
|
3406
|
+
SNAResetBtn.defaultProps = {
|
|
3407
|
+
className: undefined,
|
|
3408
|
+
intl: undefined,
|
|
3409
|
+
iconColor: '#825c0d',
|
|
3410
|
+
renderSNA: undefined
|
|
3411
|
+
};
|
|
3412
|
+
SNAResetBtn.propTypes = {
|
|
3413
|
+
/** Css Name */
|
|
3414
|
+
className: PropTypes.string,
|
|
3415
|
+
/** 語言 */
|
|
3416
|
+
intl: PropTypes.objectOf(PropTypes.any),
|
|
3417
|
+
/** icon顏色 */
|
|
3418
|
+
iconColor: PropTypes.string,
|
|
3419
|
+
/** 重新渲染SNA */
|
|
3420
|
+
renderSNA: PropTypes.func
|
|
3421
|
+
};
|
|
3422
|
+
|
|
3423
|
+
var ExtraTools = function ExtraTools(_ref) {
|
|
3424
|
+
var className = _ref.className,
|
|
3425
|
+
intl = _ref.intl,
|
|
3426
|
+
exclude = _ref.exclude,
|
|
3427
|
+
data = _ref.data,
|
|
3428
|
+
dataType = _ref.dataType,
|
|
3429
|
+
iconColor = _ref.iconColor,
|
|
3430
|
+
domToImageId = _ref.domToImageId,
|
|
3431
|
+
FontSizeTargets = _ref.FontSizeTargets,
|
|
3432
|
+
FontSizeOptions = _ref.FontSizeOptions,
|
|
3433
|
+
DownloadExcel = _ref.DownloadExcel,
|
|
3434
|
+
fullscreenDomId = _ref.fullscreenDomId,
|
|
3435
|
+
renderSNA = _ref.renderSNA;
|
|
3436
|
+
var hideButton = function hideButton(keys) {
|
|
3437
|
+
return (exclude || []).filter(function (key) {
|
|
3438
|
+
return keys.some(function (item) {
|
|
3439
|
+
return item === key;
|
|
3440
|
+
});
|
|
3441
|
+
}).length === keys.length;
|
|
3442
|
+
};
|
|
3443
|
+
var BtnsProps = {
|
|
3444
|
+
intl: intl,
|
|
3445
|
+
exclude: exclude,
|
|
3446
|
+
data: data,
|
|
3447
|
+
dataType: dataType,
|
|
3448
|
+
iconColor: iconColor,
|
|
3449
|
+
domToImageId: domToImageId,
|
|
3450
|
+
FontSizeTargets: FontSizeTargets,
|
|
3451
|
+
FontSizeOptions: FontSizeOptions,
|
|
3452
|
+
DownloadExcel: DownloadExcel,
|
|
3453
|
+
fullscreenDomId: fullscreenDomId,
|
|
3454
|
+
renderSNA: renderSNA
|
|
3455
|
+
};
|
|
3456
|
+
var isIOSMobile = /iPhone|iPad|iPod/i.test(navigator.userAgent);
|
|
3457
|
+
var tools = [{
|
|
3458
|
+
keys: ['share'],
|
|
3459
|
+
Component: ShareButton
|
|
3460
|
+
}, {
|
|
3461
|
+
keys: ['downloadImage', 'downloadGephi', 'downloadTsv', 'downloadXls'],
|
|
3462
|
+
Component: DownloadMenu
|
|
3463
|
+
}, !isIOSMobile && {
|
|
3464
|
+
keys: ['fullscreen'],
|
|
3465
|
+
Component: FullscreenBtn
|
|
3466
|
+
}, {
|
|
3467
|
+
keys: ['fontSizeChanger'],
|
|
3468
|
+
Component: FontSizeChanger
|
|
3469
|
+
}, {
|
|
3470
|
+
keys: ['resetSNA'],
|
|
3471
|
+
Component: SNAResetBtn
|
|
3472
|
+
}];
|
|
3473
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
3474
|
+
className: classNames('extraTools', className)
|
|
3475
|
+
}, tools.filter(function (t) {
|
|
3476
|
+
return t;
|
|
3477
|
+
}).map(function (_ref2) {
|
|
3478
|
+
var keys = _ref2.keys,
|
|
3479
|
+
Component = _ref2.Component;
|
|
3480
|
+
return !hideButton(keys) && /*#__PURE__*/React__default.createElement(Component, _extends({
|
|
3481
|
+
key: keys[0]
|
|
3482
|
+
}, BtnsProps));
|
|
3483
|
+
}));
|
|
3484
|
+
};
|
|
3485
|
+
|
|
3486
|
+
/* 提供外部引用子元件, 子元件各自享獨立運作功能 */
|
|
3487
|
+
ExtraTools.ShareButton = ShareButton;
|
|
3488
|
+
ExtraTools.DownloadMenu = DownloadMenu;
|
|
3489
|
+
ExtraTools.FullscreenBtn = FullscreenBtn;
|
|
3490
|
+
ExtraTools.FontSizeChanger = FontSizeChanger;
|
|
3491
|
+
ExtraTools.defaultProps = {
|
|
3492
|
+
className: undefined,
|
|
3493
|
+
intl: undefined,
|
|
3494
|
+
exclude: ['downloadGephi'],
|
|
3495
|
+
data: null,
|
|
3496
|
+
dataType: undefined,
|
|
3497
|
+
iconColor: '#825c0d',
|
|
3498
|
+
domToImageId: 'network-graph',
|
|
3499
|
+
FontSizeTargets: ['#network-graph svg g text'],
|
|
3500
|
+
FontSizeOptions: {
|
|
3501
|
+
stepSize: 2,
|
|
3502
|
+
range: 1
|
|
3503
|
+
},
|
|
3504
|
+
DownloadExcel: undefined,
|
|
3505
|
+
fullscreenDomId: undefined,
|
|
3506
|
+
renderSNA: undefined
|
|
3507
|
+
};
|
|
3508
|
+
|
|
3509
|
+
/* Write props detail information and 'npm run updateStory' will help you generate stories's argTypes */
|
|
3510
|
+
ExtraTools.propTypes = {
|
|
3511
|
+
/** Css Name */
|
|
3512
|
+
className: PropTypes.string,
|
|
3513
|
+
/** 語言 */
|
|
3514
|
+
intl: PropTypes.objectOf(PropTypes.any),
|
|
3515
|
+
/** 不顯示的按鈕 ['share', 'downloadImage', 'downloadTsv', 'downloadXls', 'fullscreen', 'fontSizeChanger'] */
|
|
3516
|
+
exclude: PropTypes.arrayOf(PropTypes.string),
|
|
3517
|
+
/** 資料 */
|
|
3518
|
+
data: PropTypes.oneOfType([PropTypes.array, PropTypes.object]),
|
|
3519
|
+
/** 如果有下載xlsx文件, 需要提供type輸出使用 */
|
|
3520
|
+
dataType: PropTypes.string,
|
|
3521
|
+
/** icon顏色 */
|
|
3522
|
+
iconColor: PropTypes.string,
|
|
3523
|
+
/** 指定dom轉換畫布的DOM ID */
|
|
3524
|
+
domToImageId: PropTypes.string,
|
|
3525
|
+
/** 改變文字的目標DOM['css selector']) */
|
|
3526
|
+
FontSizeTargets: PropTypes.arrayOf(PropTypes.string),
|
|
3527
|
+
/** 改變文字的選項 */
|
|
3528
|
+
FontSizeOptions: PropTypes.objectOf(PropTypes.any),
|
|
3529
|
+
/** Download元件, 由外部傳入的原因是需要環境設定 */
|
|
3530
|
+
DownloadExcel: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
3531
|
+
/** 全螢幕指定DOM */
|
|
3532
|
+
fullscreenDomId: PropTypes.string,
|
|
3533
|
+
/** 重設SNA */
|
|
3534
|
+
renderSNA: PropTypes.func
|
|
3535
|
+
};
|
|
3536
|
+
|
|
3537
|
+
export { ExtraTools as E };
|