Version Description
- 2018-06-26 =
- Added: support for long URLs in newsletter links;
- Fixed: controls in editor display correctly;
- Fixed: full post ALC content now displays post images;
Download this release
Release Info
Developer | wysija |
Plugin | MailPoet Newsletters (New) |
Version | 3.7.8 |
Comparing to | |
See all releases |
Code changes from version 3.7.6 to 3.7.8
assets/css/manifest.json
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
"admin-global.css": "admin-global.673373a1.css",
|
3 |
"admin.css": "admin.f9f0694a.css",
|
4 |
"importExport.css": "importExport.b3745466.css",
|
5 |
-
"newsletter_editor.css": "newsletter_editor.
|
6 |
"public.css": "public.cae357df.css",
|
7 |
"rtl.css": "rtl.d41d8cd9.css"
|
8 |
}
|
2 |
"admin-global.css": "admin-global.673373a1.css",
|
3 |
"admin.css": "admin.f9f0694a.css",
|
4 |
"importExport.css": "importExport.b3745466.css",
|
5 |
+
"newsletter_editor.css": "newsletter_editor.7aa0eb2b.css",
|
6 |
"public.css": "public.cae357df.css",
|
7 |
"rtl.css": "rtl.d41d8cd9.css"
|
8 |
}
|
assets/css/{newsletter_editor.200ef436.css → newsletter_editor.7aa0eb2b.css}
RENAMED
@@ -1629,17 +1629,16 @@ input.mailpoet_option_offset_left_small {
|
|
1629 |
vertical-align: top;
|
1630 |
}
|
1631 |
.mailpoet_container_horizontal + .mailpoet_tools {
|
|
|
|
|
1632 |
padding-left: 5px;
|
1633 |
-
width: 30px;
|
1634 |
-
transition: right 3s linear;
|
1635 |
}
|
1636 |
.mailpoet_container_horizontal + .mailpoet_tools .mailpoet_tool_slider {
|
1637 |
left: -100%;
|
1638 |
right: initial;
|
1639 |
}
|
1640 |
.mailpoet_container_horizontal + .mailpoet_tools.mailpoet_display_tools {
|
1641 |
-
|
1642 |
-
transition: none;
|
1643 |
}
|
1644 |
.mailpoet_container_horizontal + .mailpoet_tools.mailpoet_display_tools .mailpoet_tool_slider {
|
1645 |
left: 0;
|
1629 |
vertical-align: top;
|
1630 |
}
|
1631 |
.mailpoet_container_horizontal + .mailpoet_tools {
|
1632 |
+
left: 100%;
|
1633 |
+
right: initial;
|
1634 |
padding-left: 5px;
|
|
|
|
|
1635 |
}
|
1636 |
.mailpoet_container_horizontal + .mailpoet_tools .mailpoet_tool_slider {
|
1637 |
left: -100%;
|
1638 |
right: initial;
|
1639 |
}
|
1640 |
.mailpoet_container_horizontal + .mailpoet_tools.mailpoet_display_tools {
|
1641 |
+
z-index: 21;
|
|
|
1642 |
}
|
1643 |
.mailpoet_container_horizontal + .mailpoet_tools.mailpoet_display_tools .mailpoet_tool_slider {
|
1644 |
left: 0;
|
assets/img/blank_templates/fake-logo.png
CHANGED
Binary file
|
assets/img/mailpoet_logo_newsletter.png
CHANGED
Binary file
|
assets/js/admin.3cc8be0d.js
DELETED
@@ -1,25606 +0,0 @@
|
|
1 |
-
webpackJsonp([0],{
|
2 |
-
|
3 |
-
/***/ 508:
|
4 |
-
/***/ function(module, exports, __webpack_require__) {
|
5 |
-
|
6 |
-
/*
|
7 |
-
Module dependencies
|
8 |
-
*/
|
9 |
-
var ElementType = __webpack_require__(509);
|
10 |
-
var entities = __webpack_require__(510);
|
11 |
-
|
12 |
-
/*
|
13 |
-
Boolean Attributes
|
14 |
-
*/
|
15 |
-
var booleanAttributes = {
|
16 |
-
__proto__: null,
|
17 |
-
allowfullscreen: true,
|
18 |
-
async: true,
|
19 |
-
autofocus: true,
|
20 |
-
autoplay: true,
|
21 |
-
checked: true,
|
22 |
-
controls: true,
|
23 |
-
default: true,
|
24 |
-
defer: true,
|
25 |
-
disabled: true,
|
26 |
-
hidden: true,
|
27 |
-
ismap: true,
|
28 |
-
loop: true,
|
29 |
-
multiple: true,
|
30 |
-
muted: true,
|
31 |
-
open: true,
|
32 |
-
readonly: true,
|
33 |
-
required: true,
|
34 |
-
reversed: true,
|
35 |
-
scoped: true,
|
36 |
-
seamless: true,
|
37 |
-
selected: true,
|
38 |
-
typemustmatch: true
|
39 |
-
};
|
40 |
-
|
41 |
-
var unencodedElements = {
|
42 |
-
__proto__: null,
|
43 |
-
style: true,
|
44 |
-
script: true,
|
45 |
-
xmp: true,
|
46 |
-
iframe: true,
|
47 |
-
noembed: true,
|
48 |
-
noframes: true,
|
49 |
-
plaintext: true,
|
50 |
-
noscript: true
|
51 |
-
};
|
52 |
-
|
53 |
-
/*
|
54 |
-
Format attributes
|
55 |
-
*/
|
56 |
-
function formatAttrs(attributes, opts) {
|
57 |
-
if (!attributes) return;
|
58 |
-
|
59 |
-
var output = '',
|
60 |
-
value;
|
61 |
-
|
62 |
-
// Loop through the attributes
|
63 |
-
for (var key in attributes) {
|
64 |
-
value = attributes[key];
|
65 |
-
if (output) {
|
66 |
-
output += ' ';
|
67 |
-
}
|
68 |
-
|
69 |
-
if (!value && booleanAttributes[key]) {
|
70 |
-
output += key;
|
71 |
-
} else {
|
72 |
-
output += key + '="' + (opts.decodeEntities ? entities.encodeXML(value) : value) + '"';
|
73 |
-
}
|
74 |
-
}
|
75 |
-
|
76 |
-
return output;
|
77 |
-
}
|
78 |
-
|
79 |
-
/*
|
80 |
-
Self-enclosing tags (stolen from node-htmlparser)
|
81 |
-
*/
|
82 |
-
var singleTag = {
|
83 |
-
__proto__: null,
|
84 |
-
area: true,
|
85 |
-
base: true,
|
86 |
-
basefont: true,
|
87 |
-
br: true,
|
88 |
-
col: true,
|
89 |
-
command: true,
|
90 |
-
embed: true,
|
91 |
-
frame: true,
|
92 |
-
hr: true,
|
93 |
-
img: true,
|
94 |
-
input: true,
|
95 |
-
isindex: true,
|
96 |
-
keygen: true,
|
97 |
-
link: true,
|
98 |
-
meta: true,
|
99 |
-
param: true,
|
100 |
-
source: true,
|
101 |
-
track: true,
|
102 |
-
wbr: true,
|
103 |
-
};
|
104 |
-
|
105 |
-
|
106 |
-
var render = module.exports = function(dom, opts) {
|
107 |
-
if (!Array.isArray(dom) && !dom.cheerio) dom = [dom];
|
108 |
-
opts = opts || {};
|
109 |
-
|
110 |
-
var output = '';
|
111 |
-
|
112 |
-
for(var i = 0; i < dom.length; i++){
|
113 |
-
var elem = dom[i];
|
114 |
-
|
115 |
-
if (elem.type === 'root')
|
116 |
-
output += render(elem.children, opts);
|
117 |
-
else if (ElementType.isTag(elem))
|
118 |
-
output += renderTag(elem, opts);
|
119 |
-
else if (elem.type === ElementType.Directive)
|
120 |
-
output += renderDirective(elem);
|
121 |
-
else if (elem.type === ElementType.Comment)
|
122 |
-
output += renderComment(elem);
|
123 |
-
else if (elem.type === ElementType.CDATA)
|
124 |
-
output += renderCdata(elem);
|
125 |
-
else
|
126 |
-
output += renderText(elem, opts);
|
127 |
-
}
|
128 |
-
|
129 |
-
return output;
|
130 |
-
};
|
131 |
-
|
132 |
-
function renderTag(elem, opts) {
|
133 |
-
// Handle SVG
|
134 |
-
if (elem.name === "svg") opts = {decodeEntities: opts.decodeEntities, xmlMode: true};
|
135 |
-
|
136 |
-
var tag = '<' + elem.name,
|
137 |
-
attribs = formatAttrs(elem.attribs, opts);
|
138 |
-
|
139 |
-
if (attribs) {
|
140 |
-
tag += ' ' + attribs;
|
141 |
-
}
|
142 |
-
|
143 |
-
if (
|
144 |
-
opts.xmlMode
|
145 |
-
&& (!elem.children || elem.children.length === 0)
|
146 |
-
) {
|
147 |
-
tag += '/>';
|
148 |
-
} else {
|
149 |
-
tag += '>';
|
150 |
-
if (elem.children) {
|
151 |
-
tag += render(elem.children, opts);
|
152 |
-
}
|
153 |
-
|
154 |
-
if (!singleTag[elem.name] || opts.xmlMode) {
|
155 |
-
tag += '</' + elem.name + '>';
|
156 |
-
}
|
157 |
-
}
|
158 |
-
|
159 |
-
return tag;
|
160 |
-
}
|
161 |
-
|
162 |
-
function renderDirective(elem) {
|
163 |
-
return '<' + elem.data + '>';
|
164 |
-
}
|
165 |
-
|
166 |
-
function renderText(elem, opts) {
|
167 |
-
var data = elem.data || '';
|
168 |
-
|
169 |
-
// if entities weren't decoded, no need to encode them back
|
170 |
-
if (opts.decodeEntities && !(elem.parent && elem.parent.name in unencodedElements)) {
|
171 |
-
data = entities.encodeXML(data);
|
172 |
-
}
|
173 |
-
|
174 |
-
return data;
|
175 |
-
}
|
176 |
-
|
177 |
-
function renderCdata(elem) {
|
178 |
-
return '<![CDATA[' + elem.children[0].data + ']]>';
|
179 |
-
}
|
180 |
-
|
181 |
-
function renderComment(elem) {
|
182 |
-
return '<!--' + elem.data + '-->';
|
183 |
-
}
|
184 |
-
|
185 |
-
|
186 |
-
/***/ },
|
187 |
-
|
188 |
-
/***/ 0:
|
189 |
-
/***/ function(module, exports, __webpack_require__) {
|
190 |
-
|
191 |
-
__webpack_require__(1);
|
192 |
-
__webpack_require__(437);
|
193 |
-
__webpack_require__(563);
|
194 |
-
__webpack_require__(567);
|
195 |
-
__webpack_require__(569);
|
196 |
-
__webpack_require__(572);
|
197 |
-
__webpack_require__(577);
|
198 |
-
__webpack_require__(578);
|
199 |
-
module.exports = __webpack_require__(582);
|
200 |
-
|
201 |
-
|
202 |
-
/***/ },
|
203 |
-
|
204 |
-
/***/ 274:
|
205 |
-
/***/ function(module, exports, __webpack_require__) {
|
206 |
-
|
207 |
-
'use strict';
|
208 |
-
|
209 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
210 |
-
|
211 |
-
var _react = __webpack_require__(2);
|
212 |
-
|
213 |
-
var _react2 = _interopRequireDefault(_react);
|
214 |
-
|
215 |
-
var _reactRouter = __webpack_require__(181);
|
216 |
-
|
217 |
-
var _jquery = __webpack_require__(275);
|
218 |
-
|
219 |
-
var _jquery2 = _interopRequireDefault(_jquery);
|
220 |
-
|
221 |
-
var _mailpoet = __webpack_require__(276);
|
222 |
-
|
223 |
-
var _mailpoet2 = _interopRequireDefault(_mailpoet);
|
224 |
-
|
225 |
-
var _classnames = __webpack_require__(277);
|
226 |
-
|
227 |
-
var _classnames2 = _interopRequireDefault(_classnames);
|
228 |
-
|
229 |
-
var _listingListingJsx = __webpack_require__(279);
|
230 |
-
|
231 |
-
var _listingListingJsx2 = _interopRequireDefault(_listingListingJsx);
|
232 |
-
|
233 |
-
var _formFieldsSelectionJsx = __webpack_require__(289);
|
234 |
-
|
235 |
-
var _formFieldsSelectionJsx2 = _interopRequireDefault(_formFieldsSelectionJsx);
|
236 |
-
|
237 |
-
var columns = [{
|
238 |
-
name: 'email',
|
239 |
-
label: _mailpoet2['default'].I18n.t('subscriber'),
|
240 |
-
sortable: true
|
241 |
-
}, {
|
242 |
-
name: 'status',
|
243 |
-
label: _mailpoet2['default'].I18n.t('status'),
|
244 |
-
sortable: true
|
245 |
-
}, {
|
246 |
-
name: 'segments',
|
247 |
-
label: _mailpoet2['default'].I18n.t('lists')
|
248 |
-
}, {
|
249 |
-
name: 'created_at',
|
250 |
-
label: _mailpoet2['default'].I18n.t('subscribedOn'),
|
251 |
-
sortable: true
|
252 |
-
}, {
|
253 |
-
name: 'updated_at',
|
254 |
-
label: _mailpoet2['default'].I18n.t('lastModifiedOn'),
|
255 |
-
sortable: true
|
256 |
-
}];
|
257 |
-
|
258 |
-
var messages = {
|
259 |
-
onTrash: function onTrash(response) {
|
260 |
-
var count = Number(response.meta.count);
|
261 |
-
var message = null;
|
262 |
-
|
263 |
-
if (count === 1) {
|
264 |
-
message = _mailpoet2['default'].I18n.t('oneSubscriberTrashed');
|
265 |
-
} else {
|
266 |
-
message = _mailpoet2['default'].I18n.t('multipleSubscribersTrashed').replace('%$1d', count.toLocaleString());
|
267 |
-
}
|
268 |
-
_mailpoet2['default'].Notice.success(message);
|
269 |
-
},
|
270 |
-
onDelete: function onDelete(response) {
|
271 |
-
var count = Number(response.meta.count);
|
272 |
-
var message = null;
|
273 |
-
|
274 |
-
if (count === 1) {
|
275 |
-
message = _mailpoet2['default'].I18n.t('oneSubscriberDeleted');
|
276 |
-
} else {
|
277 |
-
message = _mailpoet2['default'].I18n.t('multipleSubscribersDeleted').replace('%$1d', count.toLocaleString());
|
278 |
-
}
|
279 |
-
_mailpoet2['default'].Notice.success(message);
|
280 |
-
},
|
281 |
-
onRestore: function onRestore(response) {
|
282 |
-
var count = Number(response.meta.count);
|
283 |
-
var message = null;
|
284 |
-
|
285 |
-
if (count === 1) {
|
286 |
-
message = _mailpoet2['default'].I18n.t('oneSubscriberRestored');
|
287 |
-
} else {
|
288 |
-
message = _mailpoet2['default'].I18n.t('multipleSubscribersRestored').replace('%$1d', count.toLocaleString());
|
289 |
-
}
|
290 |
-
_mailpoet2['default'].Notice.success(message);
|
291 |
-
},
|
292 |
-
onNoItemsFound: function onNoItemsFound(group) {
|
293 |
-
if (group === 'bounced' && !window.mailpoet_premium_active) {
|
294 |
-
return _react2['default'].createElement(
|
295 |
-
'div',
|
296 |
-
null,
|
297 |
-
_react2['default'].createElement(
|
298 |
-
'p',
|
299 |
-
null,
|
300 |
-
_mailpoet2['default'].I18n.t('bouncedSubscribersHelp')
|
301 |
-
),
|
302 |
-
_react2['default'].createElement(
|
303 |
-
'p',
|
304 |
-
null,
|
305 |
-
_react2['default'].createElement(
|
306 |
-
'a',
|
307 |
-
{ href: 'admin.php?page=mailpoet-premium', className: 'button-primary' },
|
308 |
-
_mailpoet2['default'].I18n.t('bouncedSubscribersPremiumButtonText')
|
309 |
-
)
|
310 |
-
)
|
311 |
-
);
|
312 |
-
}
|
313 |
-
// use default message
|
314 |
-
return false;
|
315 |
-
}
|
316 |
-
};
|
317 |
-
|
318 |
-
var bulkActions = [{
|
319 |
-
name: 'moveToList',
|
320 |
-
label: _mailpoet2['default'].I18n.t('moveToList'),
|
321 |
-
onSelect: function onSelect() {
|
322 |
-
var field = {
|
323 |
-
id: 'move_to_segment',
|
324 |
-
api_version: window.mailpoet_api_version,
|
325 |
-
endpoint: 'segments',
|
326 |
-
filter: function filter(segment) {
|
327 |
-
return !!(!segment.deleted_at && segment.type === 'default');
|
328 |
-
}
|
329 |
-
};
|
330 |
-
|
331 |
-
return _react2['default'].createElement(_formFieldsSelectionJsx2['default'], { field: field });
|
332 |
-
},
|
333 |
-
getData: function getData() {
|
334 |
-
return {
|
335 |
-
segment_id: Number((0, _jquery2['default'])('#move_to_segment').val())
|
336 |
-
};
|
337 |
-
},
|
338 |
-
onSuccess: function onSuccess(response) {
|
339 |
-
_mailpoet2['default'].Notice.success(_mailpoet2['default'].I18n.t('multipleSubscribersMovedToList').replace('%$1d', Number(response.meta.count).toLocaleString()).replace('%$2s', response.meta.segment));
|
340 |
-
}
|
341 |
-
}, {
|
342 |
-
name: 'addToList',
|
343 |
-
label: _mailpoet2['default'].I18n.t('addToList'),
|
344 |
-
onSelect: function onSelect() {
|
345 |
-
var field = {
|
346 |
-
id: 'add_to_segment',
|
347 |
-
api_version: window.mailpoet_api_version,
|
348 |
-
endpoint: 'segments',
|
349 |
-
filter: function filter(segment) {
|
350 |
-
return !!(!segment.deleted_at && segment.type === 'default');
|
351 |
-
}
|
352 |
-
};
|
353 |
-
|
354 |
-
return _react2['default'].createElement(_formFieldsSelectionJsx2['default'], { field: field });
|
355 |
-
},
|
356 |
-
getData: function getData() {
|
357 |
-
return {
|
358 |
-
segment_id: Number((0, _jquery2['default'])('#add_to_segment').val())
|
359 |
-
};
|
360 |
-
},
|
361 |
-
onSuccess: function onSuccess(response) {
|
362 |
-
_mailpoet2['default'].Notice.success(_mailpoet2['default'].I18n.t('multipleSubscribersAddedToList').replace('%$1d', Number(response.meta.count).toLocaleString()).replace('%$2s', response.meta.segment));
|
363 |
-
}
|
364 |
-
}, {
|
365 |
-
name: 'removeFromList',
|
366 |
-
label: _mailpoet2['default'].I18n.t('removeFromList'),
|
367 |
-
onSelect: function onSelect() {
|
368 |
-
var field = {
|
369 |
-
id: 'remove_from_segment',
|
370 |
-
api_version: window.mailpoet_api_version,
|
371 |
-
endpoint: 'segments',
|
372 |
-
filter: function filter(segment) {
|
373 |
-
return !!(segment.type === 'default');
|
374 |
-
}
|
375 |
-
};
|
376 |
-
|
377 |
-
return _react2['default'].createElement(_formFieldsSelectionJsx2['default'], { field: field });
|
378 |
-
},
|
379 |
-
getData: function getData() {
|
380 |
-
return {
|
381 |
-
segment_id: Number((0, _jquery2['default'])('#remove_from_segment').val())
|
382 |
-
};
|
383 |
-
},
|
384 |
-
onSuccess: function onSuccess(response) {
|
385 |
-
_mailpoet2['default'].Notice.success(_mailpoet2['default'].I18n.t('multipleSubscribersRemovedFromList').replace('%$1d', Number(response.meta.count).toLocaleString()).replace('%$2s', response.meta.segment));
|
386 |
-
}
|
387 |
-
}, {
|
388 |
-
name: 'removeFromAllLists',
|
389 |
-
label: _mailpoet2['default'].I18n.t('removeFromAllLists'),
|
390 |
-
onSuccess: function onSuccess(response) {
|
391 |
-
_mailpoet2['default'].Notice.success(_mailpoet2['default'].I18n.t('multipleSubscribersRemovedFromAllLists').replace('%$1d', Number(response.meta.count).toLocaleString()));
|
392 |
-
}
|
393 |
-
}, {
|
394 |
-
name: 'sendConfirmationEmail',
|
395 |
-
label: _mailpoet2['default'].I18n.t('resendConfirmationEmail'),
|
396 |
-
onSuccess: function onSuccess(response) {
|
397 |
-
_mailpoet2['default'].Notice.success(_mailpoet2['default'].I18n.t('multipleConfirmationEmailsSent').replace('%$1d', Number(response.meta.count).toLocaleString()));
|
398 |
-
}
|
399 |
-
}, {
|
400 |
-
name: 'trash',
|
401 |
-
label: _mailpoet2['default'].I18n.t('moveToTrash'),
|
402 |
-
onSuccess: messages.onTrash
|
403 |
-
}];
|
404 |
-
|
405 |
-
var itemActions = [{
|
406 |
-
name: 'edit',
|
407 |
-
label: _mailpoet2['default'].I18n.t('edit'),
|
408 |
-
link: function link(subscriber) {
|
409 |
-
return _react2['default'].createElement(
|
410 |
-
_reactRouter.Link,
|
411 |
-
{ to: '/edit/' + subscriber.id },
|
412 |
-
_mailpoet2['default'].I18n.t('edit')
|
413 |
-
);
|
414 |
-
}
|
415 |
-
}, {
|
416 |
-
name: 'trash',
|
417 |
-
display: function display(subscriber) {
|
418 |
-
return Number(subscriber.wp_user_id) === 0;
|
419 |
-
}
|
420 |
-
}];
|
421 |
-
|
422 |
-
var SubscriberList = _react2['default'].createClass({
|
423 |
-
displayName: 'SubscriberList',
|
424 |
-
|
425 |
-
getSegmentFromId: function getSegmentFromId(segmentId) {
|
426 |
-
var result = false;
|
427 |
-
window.mailpoet_segments.forEach(function (segment) {
|
428 |
-
if (segment.id === segmentId) {
|
429 |
-
result = segment;
|
430 |
-
}
|
431 |
-
});
|
432 |
-
return result;
|
433 |
-
},
|
434 |
-
renderItem: function renderItem(subscriber, actions) {
|
435 |
-
var _this = this;
|
436 |
-
|
437 |
-
var rowClasses = (0, _classnames2['default'])('manage-column', 'column-primary', 'has-row-actions', 'column-username');
|
438 |
-
|
439 |
-
var status = '';
|
440 |
-
|
441 |
-
switch (subscriber.status) {
|
442 |
-
case 'subscribed':
|
443 |
-
status = _mailpoet2['default'].I18n.t('subscribed');
|
444 |
-
break;
|
445 |
-
|
446 |
-
case 'unconfirmed':
|
447 |
-
status = _mailpoet2['default'].I18n.t('unconfirmed');
|
448 |
-
break;
|
449 |
-
|
450 |
-
case 'unsubscribed':
|
451 |
-
status = _mailpoet2['default'].I18n.t('unsubscribed');
|
452 |
-
break;
|
453 |
-
|
454 |
-
case 'bounced':
|
455 |
-
status = _mailpoet2['default'].I18n.t('bounced');
|
456 |
-
break;
|
457 |
-
|
458 |
-
default:
|
459 |
-
status = 'Invalid';
|
460 |
-
break;
|
461 |
-
}
|
462 |
-
|
463 |
-
var segments = false;
|
464 |
-
|
465 |
-
// Subscriptions
|
466 |
-
if (subscriber.subscriptions.length > 0) {
|
467 |
-
(function () {
|
468 |
-
var subscribedSegments = [];
|
469 |
-
|
470 |
-
subscriber.subscriptions.forEach(function (subscription) {
|
471 |
-
var segment = _this.getSegmentFromId(subscription.segment_id);
|
472 |
-
if (segment === false) return;
|
473 |
-
if (subscription.status === 'subscribed') {
|
474 |
-
subscribedSegments.push(segment.name);
|
475 |
-
}
|
476 |
-
});
|
477 |
-
|
478 |
-
segments = _react2['default'].createElement(
|
479 |
-
'span',
|
480 |
-
null,
|
481 |
-
subscribedSegments.join(', ')
|
482 |
-
);
|
483 |
-
})();
|
484 |
-
}
|
485 |
-
|
486 |
-
return _react2['default'].createElement(
|
487 |
-
'div',
|
488 |
-
null,
|
489 |
-
_react2['default'].createElement(
|
490 |
-
'td',
|
491 |
-
{ className: rowClasses },
|
492 |
-
_react2['default'].createElement(
|
493 |
-
'strong',
|
494 |
-
null,
|
495 |
-
_react2['default'].createElement(
|
496 |
-
_reactRouter.Link,
|
497 |
-
{
|
498 |
-
className: 'row-title',
|
499 |
-
to: '/edit/' + subscriber.id
|
500 |
-
},
|
501 |
-
subscriber.email
|
502 |
-
)
|
503 |
-
),
|
504 |
-
_react2['default'].createElement(
|
505 |
-
'p',
|
506 |
-
{ style: { margin: 0 } },
|
507 |
-
subscriber.first_name,
|
508 |
-
' ',
|
509 |
-
subscriber.last_name
|
510 |
-
),
|
511 |
-
actions
|
512 |
-
),
|
513 |
-
_react2['default'].createElement(
|
514 |
-
'td',
|
515 |
-
{ className: 'column', 'data-colname': _mailpoet2['default'].I18n.t('status') },
|
516 |
-
status
|
517 |
-
),
|
518 |
-
_react2['default'].createElement(
|
519 |
-
'td',
|
520 |
-
{ className: 'column', 'data-colname': _mailpoet2['default'].I18n.t('lists') },
|
521 |
-
segments
|
522 |
-
),
|
523 |
-
_react2['default'].createElement(
|
524 |
-
'td',
|
525 |
-
{ className: 'column-date', 'data-colname': _mailpoet2['default'].I18n.t('subscribedOn') },
|
526 |
-
_react2['default'].createElement(
|
527 |
-
'abbr',
|
528 |
-
null,
|
529 |
-
_mailpoet2['default'].Date.format(subscriber.created_at)
|
530 |
-
)
|
531 |
-
),
|
532 |
-
_react2['default'].createElement(
|
533 |
-
'td',
|
534 |
-
{ className: 'column-date', 'data-colname': _mailpoet2['default'].I18n.t('lastModifiedOn') },
|
535 |
-
_react2['default'].createElement(
|
536 |
-
'abbr',
|
537 |
-
null,
|
538 |
-
_mailpoet2['default'].Date.format(subscriber.updated_at)
|
539 |
-
)
|
540 |
-
)
|
541 |
-
);
|
542 |
-
},
|
543 |
-
render: function render() {
|
544 |
-
return _react2['default'].createElement(
|
545 |
-
'div',
|
546 |
-
null,
|
547 |
-
_react2['default'].createElement(
|
548 |
-
'h1',
|
549 |
-
{ className: 'title' },
|
550 |
-
_mailpoet2['default'].I18n.t('pageTitle'),
|
551 |
-
' ',
|
552 |
-
_react2['default'].createElement(
|
553 |
-
_reactRouter.Link,
|
554 |
-
{
|
555 |
-
className: 'page-title-action',
|
556 |
-
to: '/new'
|
557 |
-
},
|
558 |
-
_mailpoet2['default'].I18n.t('new')
|
559 |
-
),
|
560 |
-
_react2['default'].createElement(
|
561 |
-
'a',
|
562 |
-
{
|
563 |
-
className: 'page-title-action',
|
564 |
-
href: '?page=mailpoet-import#step1'
|
565 |
-
},
|
566 |
-
_mailpoet2['default'].I18n.t('import')
|
567 |
-
),
|
568 |
-
_react2['default'].createElement(
|
569 |
-
'a',
|
570 |
-
{
|
571 |
-
id: 'mailpoet_export_button',
|
572 |
-
className: 'page-title-action',
|
573 |
-
href: '?page=mailpoet-export'
|
574 |
-
},
|
575 |
-
_mailpoet2['default'].I18n.t('export')
|
576 |
-
)
|
577 |
-
),
|
578 |
-
_react2['default'].createElement(_listingListingJsx2['default'], {
|
579 |
-
limit: window.mailpoet_listing_per_page,
|
580 |
-
location: this.props.location,
|
581 |
-
params: this.props.params,
|
582 |
-
endpoint: 'subscribers',
|
583 |
-
onRenderItem: this.renderItem,
|
584 |
-
columns: columns,
|
585 |
-
bulk_actions: bulkActions,
|
586 |
-
item_actions: itemActions,
|
587 |
-
messages: messages,
|
588 |
-
sort_by: 'created_at',
|
589 |
-
sort_order: 'desc'
|
590 |
-
})
|
591 |
-
);
|
592 |
-
}
|
593 |
-
});
|
594 |
-
|
595 |
-
module.exports = SubscriberList;
|
596 |
-
|
597 |
-
/***/ },
|
598 |
-
|
599 |
-
/***/ 292:
|
600 |
-
/***/ function(module, exports, __webpack_require__) {
|
601 |
-
|
602 |
-
/* WEBPACK VAR INJECTION */(function(global) {"use strict";
|
603 |
-
|
604 |
-
if (!global["MailPoetLib"]) global["MailPoetLib"] = {};
|
605 |
-
module.exports = global["MailPoetLib"]["Form"] = __webpack_require__(293);
|
606 |
-
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
|
607 |
-
|
608 |
-
/***/ },
|
609 |
-
|
610 |
-
/***/ 293:
|
611 |
-
/***/ function(module, exports, __webpack_require__) {
|
612 |
-
|
613 |
-
'use strict';
|
614 |
-
|
615 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
616 |
-
|
617 |
-
var _react = __webpack_require__(2);
|
618 |
-
|
619 |
-
var _react2 = _interopRequireDefault(_react);
|
620 |
-
|
621 |
-
var _reactRouter = __webpack_require__(181);
|
622 |
-
|
623 |
-
var _mailpoet = __webpack_require__(276);
|
624 |
-
|
625 |
-
var _mailpoet2 = _interopRequireDefault(_mailpoet);
|
626 |
-
|
627 |
-
var _formFormJsx = __webpack_require__(294);
|
628 |
-
|
629 |
-
var _formFormJsx2 = _interopRequireDefault(_formFormJsx);
|
630 |
-
|
631 |
-
var _reactStringReplace = __webpack_require__(431);
|
632 |
-
|
633 |
-
var _reactStringReplace2 = _interopRequireDefault(_reactStringReplace);
|
634 |
-
|
635 |
-
var fields = [{
|
636 |
-
name: 'email',
|
637 |
-
label: _mailpoet2['default'].I18n.t('email'),
|
638 |
-
type: 'text',
|
639 |
-
disabled: function disabled(subscriber) {
|
640 |
-
return Number(subscriber.wp_user_id > 0);
|
641 |
-
}
|
642 |
-
}, {
|
643 |
-
name: 'first_name',
|
644 |
-
label: _mailpoet2['default'].I18n.t('firstname'),
|
645 |
-
type: 'text',
|
646 |
-
disabled: function disabled(subscriber) {
|
647 |
-
return Number(subscriber.wp_user_id > 0);
|
648 |
-
}
|
649 |
-
}, {
|
650 |
-
name: 'last_name',
|
651 |
-
label: _mailpoet2['default'].I18n.t('lastname'),
|
652 |
-
type: 'text',
|
653 |
-
disabled: function disabled(subscriber) {
|
654 |
-
return Number(subscriber.wp_user_id > 0);
|
655 |
-
}
|
656 |
-
}, {
|
657 |
-
name: 'status',
|
658 |
-
label: _mailpoet2['default'].I18n.t('status'),
|
659 |
-
type: 'select',
|
660 |
-
values: {
|
661 |
-
subscribed: _mailpoet2['default'].I18n.t('subscribed'),
|
662 |
-
unconfirmed: _mailpoet2['default'].I18n.t('unconfirmed'),
|
663 |
-
unsubscribed: _mailpoet2['default'].I18n.t('unsubscribed'),
|
664 |
-
bounced: _mailpoet2['default'].I18n.t('bounced')
|
665 |
-
},
|
666 |
-
filter: function filter(subscriber, value) {
|
667 |
-
if (Number(subscriber.wp_user_id) > 0 && value === 'unconfirmed') {
|
668 |
-
return false;
|
669 |
-
}
|
670 |
-
return true;
|
671 |
-
}
|
672 |
-
}, {
|
673 |
-
name: 'segments',
|
674 |
-
label: _mailpoet2['default'].I18n.t('lists'),
|
675 |
-
type: 'selection',
|
676 |
-
placeholder: _mailpoet2['default'].I18n.t('selectList'),
|
677 |
-
tip: _mailpoet2['default'].I18n.t('welcomeEmailTip'),
|
678 |
-
api_version: window.mailpoet_api_version,
|
679 |
-
endpoint: 'segments',
|
680 |
-
multiple: true,
|
681 |
-
selected: function selected(subscriber) {
|
682 |
-
if (Array.isArray(subscriber.subscriptions) === false) {
|
683 |
-
return null;
|
684 |
-
}
|
685 |
-
|
686 |
-
return subscriber.subscriptions.filter(function (subscription) {
|
687 |
-
return subscription.status === 'subscribed';
|
688 |
-
}).map(function (subscription) {
|
689 |
-
return subscription.segment_id;
|
690 |
-
});
|
691 |
-
},
|
692 |
-
filter: function filter(segment) {
|
693 |
-
return !segment.deleted_at && segment.type === 'default';
|
694 |
-
},
|
695 |
-
getLabel: function getLabel(segment) {
|
696 |
-
return segment.name + ' (' + segment.subscribers + ')';
|
697 |
-
},
|
698 |
-
getSearchLabel: function getSearchLabel(segment, subscriber) {
|
699 |
-
var label = '';
|
700 |
-
|
701 |
-
if (subscriber.subscriptions !== undefined) {
|
702 |
-
subscriber.subscriptions.forEach(function (subscription) {
|
703 |
-
if (segment.id === subscription.segment_id) {
|
704 |
-
label = segment.name;
|
705 |
-
|
706 |
-
if (subscription.status === 'unsubscribed') {
|
707 |
-
var unsubscribedAt = _mailpoet2['default'].Date.format(subscription.updated_at);
|
708 |
-
label += ' (%$1s)'.replace('%$1s', _mailpoet2['default'].I18n.t('unsubscribedOn').replace('%$1s', unsubscribedAt));
|
709 |
-
}
|
710 |
-
}
|
711 |
-
});
|
712 |
-
}
|
713 |
-
return label;
|
714 |
-
}
|
715 |
-
}];
|
716 |
-
|
717 |
-
var customFields = window.mailpoet_custom_fields || [];
|
718 |
-
customFields.forEach(function (customField) {
|
719 |
-
var field = {
|
720 |
-
name: 'cf_' + customField.id,
|
721 |
-
label: customField.name,
|
722 |
-
type: customField.type
|
723 |
-
};
|
724 |
-
if (customField.params) {
|
725 |
-
field.params = customField.params;
|
726 |
-
}
|
727 |
-
|
728 |
-
if (customField.params.values) {
|
729 |
-
field.values = customField.params.values;
|
730 |
-
}
|
731 |
-
|
732 |
-
// add placeholders for selects (date, select)
|
733 |
-
switch (customField.type) {
|
734 |
-
case 'date':
|
735 |
-
field.year_placeholder = _mailpoet2['default'].I18n.t('year');
|
736 |
-
field.month_placeholder = _mailpoet2['default'].I18n.t('month');
|
737 |
-
field.day_placeholder = _mailpoet2['default'].I18n.t('day');
|
738 |
-
break;
|
739 |
-
|
740 |
-
case 'select':
|
741 |
-
field.placeholder = '-';
|
742 |
-
break;
|
743 |
-
|
744 |
-
default:
|
745 |
-
field.placeholder = '';
|
746 |
-
break;
|
747 |
-
}
|
748 |
-
|
749 |
-
fields.push(field);
|
750 |
-
});
|
751 |
-
|
752 |
-
var messages = {
|
753 |
-
onUpdate: function onUpdate() {
|
754 |
-
_mailpoet2['default'].Notice.success(_mailpoet2['default'].I18n.t('subscriberUpdated'));
|
755 |
-
},
|
756 |
-
onCreate: function onCreate() {
|
757 |
-
_mailpoet2['default'].Notice.success(_mailpoet2['default'].I18n.t('subscriberAdded'));
|
758 |
-
_mailpoet2['default'].trackEvent('Subscribers > Add new', {
|
759 |
-
'MailPoet Free version': window.mailpoet_version
|
760 |
-
});
|
761 |
-
}
|
762 |
-
};
|
763 |
-
|
764 |
-
function beforeFormContent(subscriber) {
|
765 |
-
if (Number(subscriber.wp_user_id) > 0) {
|
766 |
-
return _react2['default'].createElement(
|
767 |
-
'p',
|
768 |
-
{ className: 'description' },
|
769 |
-
(0, _reactStringReplace2['default'])(_mailpoet2['default'].I18n.t('WPUserEditNotice'), /\[link\](.*?)\[\/link\]/g, function (match, i) {
|
770 |
-
return _react2['default'].createElement(
|
771 |
-
'a',
|
772 |
-
{
|
773 |
-
key: i,
|
774 |
-
href: 'user-edit.php?user_id=' + subscriber.wp_user_id
|
775 |
-
},
|
776 |
-
match
|
777 |
-
);
|
778 |
-
})
|
779 |
-
);
|
780 |
-
}
|
781 |
-
return undefined;
|
782 |
-
}
|
783 |
-
|
784 |
-
function afterFormContent() {
|
785 |
-
return _react2['default'].createElement(
|
786 |
-
'p',
|
787 |
-
{ className: 'description' },
|
788 |
-
_react2['default'].createElement(
|
789 |
-
'strong',
|
790 |
-
null,
|
791 |
-
_mailpoet2['default'].I18n.t('tip')
|
792 |
-
),
|
793 |
-
' ',
|
794 |
-
_mailpoet2['default'].I18n.t('customFieldsTip')
|
795 |
-
);
|
796 |
-
}
|
797 |
-
|
798 |
-
var SubscriberForm = _react2['default'].createClass({
|
799 |
-
displayName: 'SubscriberForm',
|
800 |
-
|
801 |
-
render: function render() {
|
802 |
-
return _react2['default'].createElement(
|
803 |
-
'div',
|
804 |
-
null,
|
805 |
-
_react2['default'].createElement(
|
806 |
-
'h1',
|
807 |
-
{ className: 'title' },
|
808 |
-
_mailpoet2['default'].I18n.t('subscriber'),
|
809 |
-
_react2['default'].createElement(
|
810 |
-
_reactRouter.Link,
|
811 |
-
{ className: 'page-title-action', to: '/' },
|
812 |
-
_mailpoet2['default'].I18n.t('backToList')
|
813 |
-
)
|
814 |
-
),
|
815 |
-
_react2['default'].createElement(_formFormJsx2['default'], {
|
816 |
-
endpoint: 'subscribers',
|
817 |
-
fields: fields,
|
818 |
-
params: this.props.params,
|
819 |
-
messages: messages,
|
820 |
-
beforeFormContent: beforeFormContent,
|
821 |
-
afterFormContent: afterFormContent
|
822 |
-
})
|
823 |
-
);
|
824 |
-
}
|
825 |
-
});
|
826 |
-
|
827 |
-
module.exports = SubscriberForm;
|
828 |
-
|
829 |
-
/***/ },
|
830 |
-
|
831 |
-
/***/ 437:
|
832 |
-
/***/ function(module, exports, __webpack_require__) {
|
833 |
-
|
834 |
-
'use strict';
|
835 |
-
|
836 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
837 |
-
|
838 |
-
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } }
|
839 |
-
|
840 |
-
var _react = __webpack_require__(2);
|
841 |
-
|
842 |
-
var _react2 = _interopRequireDefault(_react);
|
843 |
-
|
844 |
-
var _reactDom = __webpack_require__(34);
|
845 |
-
|
846 |
-
var _reactDom2 = _interopRequireDefault(_reactDom);
|
847 |
-
|
848 |
-
var _reactRouter = __webpack_require__(181);
|
849 |
-
|
850 |
-
var _history = __webpack_require__(244);
|
851 |
-
|
852 |
-
var _wpJsHooks = __webpack_require__(438);
|
853 |
-
|
854 |
-
var _wpJsHooks2 = _interopRequireDefault(_wpJsHooks);
|
855 |
-
|
856 |
-
var _underscore = __webpack_require__(281);
|
857 |
-
|
858 |
-
var _underscore2 = _interopRequireDefault(_underscore);
|
859 |
-
|
860 |
-
var _newslettersTypesJsx = __webpack_require__(440);
|
861 |
-
|
862 |
-
var _newslettersTypesJsx2 = _interopRequireDefault(_newslettersTypesJsx);
|
863 |
-
|
864 |
-
var _newslettersTemplatesJsx = __webpack_require__(443);
|
865 |
-
|
866 |
-
var _newslettersTemplatesJsx2 = _interopRequireDefault(_newslettersTemplatesJsx);
|
867 |
-
|
868 |
-
var _newslettersSendJsx = __webpack_require__(532);
|
869 |
-
|
870 |
-
var _newslettersSendJsx2 = _interopRequireDefault(_newslettersSendJsx);
|
871 |
-
|
872 |
-
var _newslettersTypesStandardJsx = __webpack_require__(544);
|
873 |
-
|
874 |
-
var _newslettersTypesStandardJsx2 = _interopRequireDefault(_newslettersTypesStandardJsx);
|
875 |
-
|
876 |
-
var _newslettersTypesNotificationNotificationJsx = __webpack_require__(545);
|
877 |
-
|
878 |
-
var _newslettersTypesNotificationNotificationJsx2 = _interopRequireDefault(_newslettersTypesNotificationNotificationJsx);
|
879 |
-
|
880 |
-
var _newslettersTypesAutomatic_emailsEvents_listJsx = __webpack_require__(546);
|
881 |
-
|
882 |
-
var _newslettersTypesAutomatic_emailsEvents_listJsx2 = _interopRequireDefault(_newslettersTypesAutomatic_emailsEvents_listJsx);
|
883 |
-
|
884 |
-
var _newslettersListingsStandardJsx = __webpack_require__(551);
|
885 |
-
|
886 |
-
var _newslettersListingsStandardJsx2 = _interopRequireDefault(_newslettersListingsStandardJsx);
|
887 |
-
|
888 |
-
var _newslettersListingsWelcomeJsx = __webpack_require__(560);
|
889 |
-
|
890 |
-
var _newslettersListingsWelcomeJsx2 = _interopRequireDefault(_newslettersListingsWelcomeJsx);
|
891 |
-
|
892 |
-
var _newslettersListingsNotificationJsx = __webpack_require__(561);
|
893 |
-
|
894 |
-
var _newslettersListingsNotificationJsx2 = _interopRequireDefault(_newslettersListingsNotificationJsx);
|
895 |
-
|
896 |
-
var _newslettersListingsNotification_historyJsx = __webpack_require__(562);
|
897 |
-
|
898 |
-
var _newslettersListingsNotification_historyJsx2 = _interopRequireDefault(_newslettersListingsNotification_historyJsx);
|
899 |
-
|
900 |
-
var history = (0, _reactRouter.useRouterHistory)(_history.createHashHistory)({ queryKey: false });
|
901 |
-
|
902 |
-
var App = _react2['default'].createClass({
|
903 |
-
displayName: 'App',
|
904 |
-
|
905 |
-
render: function render() {
|
906 |
-
return this.props.children;
|
907 |
-
}
|
908 |
-
});
|
909 |
-
|
910 |
-
var container = document.getElementById('newsletters_container');
|
911 |
-
|
912 |
-
var getAutomaticEmailsRoutes = function getAutomaticEmailsRoutes() {
|
913 |
-
if (!window.mailpoet_automatic_emails) return null;
|
914 |
-
|
915 |
-
return _underscore2['default'].map(window.mailpoet_automatic_emails, function (automaticEmail) {
|
916 |
-
return {
|
917 |
-
path: 'new/' + automaticEmail.slug,
|
918 |
-
name: automaticEmail.slug,
|
919 |
-
component: _newslettersTypesAutomatic_emailsEvents_listJsx2['default'],
|
920 |
-
data: {
|
921 |
-
email: automaticEmail
|
922 |
-
}
|
923 |
-
};
|
924 |
-
});
|
925 |
-
};
|
926 |
-
|
927 |
-
if (container) {
|
928 |
-
var routes = [
|
929 |
-
/* Listings */
|
930 |
-
{
|
931 |
-
path: 'standard(/)**',
|
932 |
-
params: { tab: 'standard' },
|
933 |
-
component: _newslettersListingsStandardJsx2['default']
|
934 |
-
}, {
|
935 |
-
path: 'welcome(/)**',
|
936 |
-
component: _newslettersListingsWelcomeJsx2['default']
|
937 |
-
}, {
|
938 |
-
path: 'notification/history/:parent_id(/)**',
|
939 |
-
component: _newslettersListingsNotification_historyJsx2['default']
|
940 |
-
}, {
|
941 |
-
path: 'notification(/)**',
|
942 |
-
component: _newslettersListingsNotificationJsx2['default']
|
943 |
-
},
|
944 |
-
/* Newsletter: type selection */
|
945 |
-
{
|
946 |
-
path: 'new',
|
947 |
-
component: _newslettersTypesJsx2['default']
|
948 |
-
},
|
949 |
-
/* New newsletter: types */
|
950 |
-
{
|
951 |
-
path: 'new/standard',
|
952 |
-
component: _newslettersTypesStandardJsx2['default']
|
953 |
-
}, {
|
954 |
-
path: 'new/notification',
|
955 |
-
component: _newslettersTypesNotificationNotificationJsx2['default']
|
956 |
-
},
|
957 |
-
/* Template selection */
|
958 |
-
{
|
959 |
-
name: 'template',
|
960 |
-
path: 'template/:id',
|
961 |
-
component: _newslettersTemplatesJsx2['default']
|
962 |
-
},
|
963 |
-
/* Sending options */
|
964 |
-
{
|
965 |
-
path: 'send/:id',
|
966 |
-
component: _newslettersSendJsx2['default']
|
967 |
-
}];
|
968 |
-
|
969 |
-
routes = _wpJsHooks2['default'].applyFilters('mailpoet_newsletters_before_router', [].concat(_toConsumableArray(routes), _toConsumableArray(getAutomaticEmailsRoutes())));
|
970 |
-
|
971 |
-
var mailpoetListing = _reactDom2['default'].render( // eslint-disable-line react/no-render-return-value
|
972 |
-
_react2['default'].createElement(
|
973 |
-
_reactRouter.Router,
|
974 |
-
{ history: history },
|
975 |
-
_react2['default'].createElement(
|
976 |
-
_reactRouter.Route,
|
977 |
-
{ path: '/', component: App },
|
978 |
-
_react2['default'].createElement(_reactRouter.IndexRedirect, { to: 'standard' }),
|
979 |
-
routes.map(function (route) {
|
980 |
-
return _react2['default'].createElement(_reactRouter.Route, {
|
981 |
-
key: route.path,
|
982 |
-
path: route.path,
|
983 |
-
component: route.component,
|
984 |
-
name: route.name || null,
|
985 |
-
params: route.params || null,
|
986 |
-
data: route.data || null
|
987 |
-
});
|
988 |
-
})
|
989 |
-
)
|
990 |
-
), container);
|
991 |
-
|
992 |
-
window.mailpoet_listing = mailpoetListing;
|
993 |
-
}
|
994 |
-
|
995 |
-
/***/ },
|
996 |
-
|
997 |
-
/***/ 440:
|
998 |
-
/***/ function(module, exports, __webpack_require__) {
|
999 |
-
|
1000 |
-
'use strict';
|
1001 |
-
|
1002 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
1003 |
-
|
1004 |
-
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } }
|
1005 |
-
|
1006 |
-
var _react = __webpack_require__(2);
|
1007 |
-
|
1008 |
-
var _react2 = _interopRequireDefault(_react);
|
1009 |
-
|
1010 |
-
var _mailpoet = __webpack_require__(276);
|
1011 |
-
|
1012 |
-
var _mailpoet2 = _interopRequireDefault(_mailpoet);
|
1013 |
-
|
1014 |
-
var _newslettersBreadcrumbJsx = __webpack_require__(441);
|
1015 |
-
|
1016 |
-
var _newslettersBreadcrumbJsx2 = _interopRequireDefault(_newslettersBreadcrumbJsx);
|
1017 |
-
|
1018 |
-
var _wpJsHooks = __webpack_require__(438);
|
1019 |
-
|
1020 |
-
var _wpJsHooks2 = _interopRequireDefault(_wpJsHooks);
|
1021 |
-
|
1022 |
-
var _underscore = __webpack_require__(281);
|
1023 |
-
|
1024 |
-
var _underscore2 = _interopRequireDefault(_underscore);
|
1025 |
-
|
1026 |
-
__webpack_require__(181);
|
1027 |
-
|
1028 |
-
var NewsletterTypes = _react2['default'].createClass({
|
1029 |
-
displayName: 'NewsletterTypes',
|
1030 |
-
|
1031 |
-
contextTypes: {
|
1032 |
-
router: _react2['default'].PropTypes.object.isRequired
|
1033 |
-
},
|
1034 |
-
setupNewsletter: function setupNewsletter(type) {
|
1035 |
-
if (type !== undefined) {
|
1036 |
-
this.context.router.push('/new/' + type);
|
1037 |
-
_mailpoet2['default'].trackEvent('Emails > Type selected', {
|
1038 |
-
'MailPoet Free version': window.mailpoet_version,
|
1039 |
-
'Email type': type
|
1040 |
-
});
|
1041 |
-
}
|
1042 |
-
},
|
1043 |
-
createNewsletter: function createNewsletter(type) {
|
1044 |
-
var _this = this;
|
1045 |
-
|
1046 |
-
_mailpoet2['default'].trackEvent('Emails > Type selected', {
|
1047 |
-
'MailPoet Free version': window.mailpoet_version,
|
1048 |
-
'Email type': type
|
1049 |
-
});
|
1050 |
-
_mailpoet2['default'].Ajax.post({
|
1051 |
-
api_version: window.mailpoet_api_version,
|
1052 |
-
endpoint: 'newsletters',
|
1053 |
-
action: 'create',
|
1054 |
-
data: {
|
1055 |
-
type: type,
|
1056 |
-
subject: _mailpoet2['default'].I18n.t('draftNewsletterTitle')
|
1057 |
-
}
|
1058 |
-
}).done(function (response) {
|
1059 |
-
_this.context.router.push('/template/' + response.data.id);
|
1060 |
-
}).fail(function (response) {
|
1061 |
-
if (response.errors.length > 0) {
|
1062 |
-
_mailpoet2['default'].Notice.error(response.errors.map(function (error) {
|
1063 |
-
return error.message;
|
1064 |
-
}), { scroll: true });
|
1065 |
-
}
|
1066 |
-
});
|
1067 |
-
},
|
1068 |
-
getAutomaticEmails: function getAutomaticEmails() {
|
1069 |
-
var _this2 = this;
|
1070 |
-
|
1071 |
-
if (!window.mailpoet_automatic_emails) return [];
|
1072 |
-
|
1073 |
-
return _underscore2['default'].map(window.mailpoet_automatic_emails, function (automaticEmail) {
|
1074 |
-
var email = automaticEmail;
|
1075 |
-
var onClick = _underscore2['default'].partial(_this2.setupNewsletter, automaticEmail.slug);
|
1076 |
-
email.title = email.beta ? email.title + ' (' + _mailpoet2['default'].I18n.t('beta') + ')' : email.title;
|
1077 |
-
email.action = (function () {
|
1078 |
-
return _react2['default'].createElement(
|
1079 |
-
'div',
|
1080 |
-
null,
|
1081 |
-
_react2['default'].createElement(
|
1082 |
-
'a',
|
1083 |
-
{
|
1084 |
-
className: 'button button-primary',
|
1085 |
-
onClick: onClick,
|
1086 |
-
role: 'button',
|
1087 |
-
tabIndex: 0
|
1088 |
-
},
|
1089 |
-
_mailpoet2['default'].I18n.t('setUp')
|
1090 |
-
)
|
1091 |
-
);
|
1092 |
-
})();
|
1093 |
-
|
1094 |
-
return email;
|
1095 |
-
});
|
1096 |
-
},
|
1097 |
-
render: function render() {
|
1098 |
-
var createStandardNewsletter = _underscore2['default'].partial(this.createNewsletter, 'standard');
|
1099 |
-
var createNotificationNewsletter = _underscore2['default'].partial(this.setupNewsletter, 'notification');
|
1100 |
-
var defaultTypes = [{
|
1101 |
-
slug: 'standard',
|
1102 |
-
title: _mailpoet2['default'].I18n.t('regularNewsletterTypeTitle'),
|
1103 |
-
description: _mailpoet2['default'].I18n.t('regularNewsletterTypeDescription'),
|
1104 |
-
action: (function action() {
|
1105 |
-
return _react2['default'].createElement(
|
1106 |
-
'a',
|
1107 |
-
{
|
1108 |
-
className: 'button button-primary',
|
1109 |
-
'data-automation-id': 'create_standard',
|
1110 |
-
onClick: createStandardNewsletter,
|
1111 |
-
role: 'button',
|
1112 |
-
tabIndex: 0
|
1113 |
-
},
|
1114 |
-
_mailpoet2['default'].I18n.t('create')
|
1115 |
-
);
|
1116 |
-
})()
|
1117 |
-
}, {
|
1118 |
-
slug: 'welcome',
|
1119 |
-
title: _mailpoet2['default'].I18n.t('welcomeNewsletterTypeTitle'),
|
1120 |
-
description: _mailpoet2['default'].I18n.t('welcomeNewsletterTypeDescription'),
|
1121 |
-
videoGuide: 'https://beta.docs.mailpoet.com/article/254-video-guide-to-welcome-emails',
|
1122 |
-
action: (function action() {
|
1123 |
-
return _react2['default'].createElement(
|
1124 |
-
'div',
|
1125 |
-
null,
|
1126 |
-
_react2['default'].createElement(
|
1127 |
-
'a',
|
1128 |
-
{ href: '?page=mailpoet-premium', target: '_blank' },
|
1129 |
-
_mailpoet2['default'].I18n.t('premiumFeatureLink')
|
1130 |
-
)
|
1131 |
-
);
|
1132 |
-
})()
|
1133 |
-
}, {
|
1134 |
-
slug: 'notification',
|
1135 |
-
title: _mailpoet2['default'].I18n.t('postNotificationNewsletterTypeTitle'),
|
1136 |
-
description: _mailpoet2['default'].I18n.t('postNotificationNewsletterTypeDescription'),
|
1137 |
-
videoGuide: 'https://beta.docs.mailpoet.com/article/210-video-guide-to-post-notifications',
|
1138 |
-
action: (function action() {
|
1139 |
-
return _react2['default'].createElement(
|
1140 |
-
'a',
|
1141 |
-
{
|
1142 |
-
className: 'button button-primary',
|
1143 |
-
'data-automation-id': 'create_notification',
|
1144 |
-
onClick: createNotificationNewsletter,
|
1145 |
-
role: 'button',
|
1146 |
-
tabIndex: 0
|
1147 |
-
},
|
1148 |
-
_mailpoet2['default'].I18n.t('setUp')
|
1149 |
-
);
|
1150 |
-
})()
|
1151 |
-
}];
|
1152 |
-
|
1153 |
-
var types = _wpJsHooks2['default'].applyFilters('mailpoet_newsletters_types', [].concat(defaultTypes, _toConsumableArray(this.getAutomaticEmails())), this);
|
1154 |
-
var badgeClassName = window.mailpoet_is_new_user === true ? 'mailpoet_badge mailpoet_badge_video' : 'mailpoet_badge mailpoet_badge_video mailpoet_badge_video_grey';
|
1155 |
-
|
1156 |
-
return _react2['default'].createElement(
|
1157 |
-
'div',
|
1158 |
-
null,
|
1159 |
-
_react2['default'].createElement(
|
1160 |
-
'h1',
|
1161 |
-
null,
|
1162 |
-
_mailpoet2['default'].I18n.t('pickCampaignType')
|
1163 |
-
),
|
1164 |
-
_react2['default'].createElement(_newslettersBreadcrumbJsx2['default'], { step: 'type' }),
|
1165 |
-
_react2['default'].createElement(
|
1166 |
-
'ul',
|
1167 |
-
{ className: 'mailpoet_boxes clearfix' },
|
1168 |
-
types.map(function (type) {
|
1169 |
-
return _react2['default'].createElement(
|
1170 |
-
'li',
|
1171 |
-
{ key: type.slug, 'data-type': type.slug, className: 'mailpoet_newsletter_types' },
|
1172 |
-
_react2['default'].createElement(
|
1173 |
-
'div',
|
1174 |
-
null,
|
1175 |
-
_react2['default'].createElement(
|
1176 |
-
'div',
|
1177 |
-
{ className: 'mailpoet_thumbnail' },
|
1178 |
-
type.thumbnailImage ? _react2['default'].createElement('img', { src: type.thumbnailImage, alt: '' }) : null
|
1179 |
-
),
|
1180 |
-
_react2['default'].createElement(
|
1181 |
-
'div',
|
1182 |
-
{ className: 'mailpoet_description' },
|
1183 |
-
_react2['default'].createElement(
|
1184 |
-
'h3',
|
1185 |
-
null,
|
1186 |
-
type.title
|
1187 |
-
),
|
1188 |
-
_react2['default'].createElement(
|
1189 |
-
'p',
|
1190 |
-
null,
|
1191 |
-
type.description
|
1192 |
-
),
|
1193 |
-
type.videoGuide && _react2['default'].createElement(
|
1194 |
-
'a',
|
1195 |
-
{ className: badgeClassName, href: type.videoGuide, target: '_blank' },
|
1196 |
-
_react2['default'].createElement('span', { className: 'dashicons dashicons-format-video' }),
|
1197 |
-
_mailpoet2['default'].I18n.t('seeVideoGuide')
|
1198 |
-
)
|
1199 |
-
),
|
1200 |
-
_react2['default'].createElement(
|
1201 |
-
'div',
|
1202 |
-
{ className: 'mailpoet_actions' },
|
1203 |
-
type.action
|
1204 |
-
)
|
1205 |
-
)
|
1206 |
-
);
|
1207 |
-
}, this)
|
1208 |
-
)
|
1209 |
-
);
|
1210 |
-
}
|
1211 |
-
});
|
1212 |
-
|
1213 |
-
module.exports = NewsletterTypes;
|
1214 |
-
|
1215 |
-
/***/ },
|
1216 |
-
|
1217 |
-
/***/ 443:
|
1218 |
-
/***/ function(module, exports, __webpack_require__) {
|
1219 |
-
|
1220 |
-
'use strict';
|
1221 |
-
|
1222 |
-
Object.defineProperty(exports, '__esModule', {
|
1223 |
-
value: true
|
1224 |
-
});
|
1225 |
-
|
1226 |
-
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
1227 |
-
|
1228 |
-
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
|
1229 |
-
|
1230 |
-
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
|
1231 |
-
|
1232 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
1233 |
-
|
1234 |
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
|
1235 |
-
|
1236 |
-
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
1237 |
-
|
1238 |
-
var _react = __webpack_require__(2);
|
1239 |
-
|
1240 |
-
var _react2 = _interopRequireDefault(_react);
|
1241 |
-
|
1242 |
-
var _mailpoet = __webpack_require__(276);
|
1243 |
-
|
1244 |
-
var _mailpoet2 = _interopRequireDefault(_mailpoet);
|
1245 |
-
|
1246 |
-
var _newslettersBreadcrumbJsx = __webpack_require__(441);
|
1247 |
-
|
1248 |
-
var _newslettersBreadcrumbJsx2 = _interopRequireDefault(_newslettersBreadcrumbJsx);
|
1249 |
-
|
1250 |
-
var _commonLoadingJsx = __webpack_require__(444);
|
1251 |
-
|
1252 |
-
var _commonLoadingJsx2 = _interopRequireDefault(_commonLoadingJsx);
|
1253 |
-
|
1254 |
-
var _newslettersTemplatesTabsJsx = __webpack_require__(445);
|
1255 |
-
|
1256 |
-
var _newslettersTemplatesTabsJsx2 = _interopRequireDefault(_newslettersTemplatesTabsJsx);
|
1257 |
-
|
1258 |
-
var _newslettersTemplatesTemplate_boxJsx = __webpack_require__(460);
|
1259 |
-
|
1260 |
-
var _newslettersTemplatesTemplate_boxJsx2 = _interopRequireDefault(_newslettersTemplatesTemplate_boxJsx);
|
1261 |
-
|
1262 |
-
var _newslettersTemplatesImport_templateJsx = __webpack_require__(462);
|
1263 |
-
|
1264 |
-
var _newslettersTemplatesImport_templateJsx2 = _interopRequireDefault(_newslettersTemplatesImport_templateJsx);
|
1265 |
-
|
1266 |
-
var _wpJsHooks = __webpack_require__(438);
|
1267 |
-
|
1268 |
-
var _wpJsHooks2 = _interopRequireDefault(_wpJsHooks);
|
1269 |
-
|
1270 |
-
var _underscore = __webpack_require__(281);
|
1271 |
-
|
1272 |
-
var _underscore2 = _interopRequireDefault(_underscore);
|
1273 |
-
|
1274 |
-
var _propTypes = __webpack_require__(185);
|
1275 |
-
|
1276 |
-
var _propTypes2 = _interopRequireDefault(_propTypes);
|
1277 |
-
|
1278 |
-
var getEditorUrl = function getEditorUrl(id) {
|
1279 |
-
return 'admin.php?page=mailpoet-newsletter-editor&id=' + id;
|
1280 |
-
};
|
1281 |
-
|
1282 |
-
var templatesCategories = [{
|
1283 |
-
name: 'standard',
|
1284 |
-
label: _mailpoet2['default'].I18n.t('tabStandardTitle')
|
1285 |
-
}, {
|
1286 |
-
name: 'welcome',
|
1287 |
-
label: _mailpoet2['default'].I18n.t('tabWelcomeTitle')
|
1288 |
-
}, {
|
1289 |
-
name: 'notification',
|
1290 |
-
label: _mailpoet2['default'].I18n.t('tabNotificationTitle')
|
1291 |
-
}, {
|
1292 |
-
name: 'sample',
|
1293 |
-
label: _mailpoet2['default'].I18n.t('sample')
|
1294 |
-
}, {
|
1295 |
-
name: 'blank',
|
1296 |
-
label: _mailpoet2['default'].I18n.t('blank')
|
1297 |
-
}, {
|
1298 |
-
name: 'recent',
|
1299 |
-
label: _mailpoet2['default'].I18n.t('recentlySent')
|
1300 |
-
}, {
|
1301 |
-
name: 'saved',
|
1302 |
-
label: _mailpoet2['default'].I18n.t('savedTemplates')
|
1303 |
-
}];
|
1304 |
-
|
1305 |
-
var NewsletterTemplates = (function (_React$Component) {
|
1306 |
-
_inherits(NewsletterTemplates, _React$Component);
|
1307 |
-
|
1308 |
-
function NewsletterTemplates(props) {
|
1309 |
-
_classCallCheck(this, NewsletterTemplates);
|
1310 |
-
|
1311 |
-
_get(Object.getPrototypeOf(NewsletterTemplates.prototype), 'constructor', this).call(this, props);
|
1312 |
-
this.state = {
|
1313 |
-
loading: true,
|
1314 |
-
templates: {}, // {category1: [template11, template12, ..], category2: [template21, ...]}
|
1315 |
-
emailType: null,
|
1316 |
-
selectedTab: ''
|
1317 |
-
};
|
1318 |
-
this.templates = {};
|
1319 |
-
|
1320 |
-
this.addTemplate = this.addTemplate.bind(this);
|
1321 |
-
this.afterTemplateDelete = this.afterTemplateDelete.bind(this);
|
1322 |
-
this.afterTemplateSelect = this.afterTemplateSelect.bind(this);
|
1323 |
-
this.afterTemplateImport = this.afterTemplateImport.bind(this);
|
1324 |
-
}
|
1325 |
-
|
1326 |
-
_createClass(NewsletterTemplates, [{
|
1327 |
-
key: 'componentWillMount',
|
1328 |
-
value: function componentWillMount() {
|
1329 |
-
var _this = this;
|
1330 |
-
|
1331 |
-
_mailpoet2['default'].Ajax.post({
|
1332 |
-
api_version: window.mailpoet_api_version,
|
1333 |
-
endpoint: 'newsletterTemplates',
|
1334 |
-
action: 'getAll'
|
1335 |
-
}).done(function (response) {
|
1336 |
-
if (response.data.length === 0) {
|
1337 |
-
response.data = [{
|
1338 |
-
name: _mailpoet2['default'].I18n.t('mailpoetGuideTemplateTitle'),
|
1339 |
-
categories: '["welcome", "notification", "standard"]',
|
1340 |
-
readonly: '1'
|
1341 |
-
}];
|
1342 |
-
}
|
1343 |
-
response.data.forEach(_this.addTemplate);
|
1344 |
-
_this.sortTemplates();
|
1345 |
-
}).fail(function (response) {
|
1346 |
-
if (response.errors.length > 0) {
|
1347 |
-
_mailpoet2['default'].Notice.error(response.errors.map(function (error) {
|
1348 |
-
return error.message;
|
1349 |
-
}), { scroll: true });
|
1350 |
-
}
|
1351 |
-
}).always(function () {
|
1352 |
-
_this.selectInitialTab();
|
1353 |
-
});
|
1354 |
-
}
|
1355 |
-
}, {
|
1356 |
-
key: 'addTemplate',
|
1357 |
-
value: function addTemplate(template) {
|
1358 |
-
var _this2 = this;
|
1359 |
-
|
1360 |
-
var categoriesNames = templatesCategories.map(function (category) {
|
1361 |
-
return category.name;
|
1362 |
-
});
|
1363 |
-
var categories = undefined;
|
1364 |
-
|
1365 |
-
try {
|
1366 |
-
categories = JSON.parse(template.categories).filter(function (name) {
|
1367 |
-
return categoriesNames.indexOf(name) !== -1;
|
1368 |
-
});
|
1369 |
-
} catch (err) {
|
1370 |
-
categories = [];
|
1371 |
-
}
|
1372 |
-
|
1373 |
-
// the template has no known category
|
1374 |
-
// we add it to "Your saved templates"
|
1375 |
-
if (categories.length === 0) {
|
1376 |
-
categories.push('saved');
|
1377 |
-
}
|
1378 |
-
|
1379 |
-
categories.forEach(function (category) {
|
1380 |
-
if (_this2.templates[category] === undefined) {
|
1381 |
-
_this2.templates[category] = [];
|
1382 |
-
}
|
1383 |
-
_this2.templates[category].unshift(template);
|
1384 |
-
});
|
1385 |
-
}
|
1386 |
-
}, {
|
1387 |
-
key: 'sortTemplates',
|
1388 |
-
value: function sortTemplates() {
|
1389 |
-
var _this3 = this;
|
1390 |
-
|
1391 |
-
Object.keys(this.templates).forEach(function (category) {
|
1392 |
-
_this3.templates[category].sort(function (a, b) {
|
1393 |
-
if (parseInt(a.id, 10) < parseInt(b.id, 10)) {
|
1394 |
-
return 1;
|
1395 |
-
}
|
1396 |
-
return -1;
|
1397 |
-
});
|
1398 |
-
});
|
1399 |
-
}
|
1400 |
-
}, {
|
1401 |
-
key: 'selectInitialTab',
|
1402 |
-
value: function selectInitialTab() {
|
1403 |
-
var _this4 = this;
|
1404 |
-
|
1405 |
-
var emailType = undefined;
|
1406 |
-
var selectedTab = 'standard';
|
1407 |
-
_mailpoet2['default'].Ajax.post({
|
1408 |
-
api_version: window.mailpoet_api_version,
|
1409 |
-
endpoint: 'newsletters',
|
1410 |
-
action: 'get',
|
1411 |
-
data: {
|
1412 |
-
id: this.props.params.id
|
1413 |
-
}
|
1414 |
-
}).done(function (response) {
|
1415 |
-
emailType = response.data.type;
|
1416 |
-
if (_underscore2['default'].findWhere(templatesCategories, { name: response.data.type })) {
|
1417 |
-
selectedTab = response.data.type;
|
1418 |
-
}
|
1419 |
-
}).fail(function (response) {
|
1420 |
-
if (response.errors.length > 0) {
|
1421 |
-
_mailpoet2['default'].Notice.error(response.errors.map(function (error) {
|
1422 |
-
return error.message;
|
1423 |
-
}), { scroll: true });
|
1424 |
-
}
|
1425 |
-
}).always(function () {
|
1426 |
-
_this4.setState({
|
1427 |
-
templates: _this4.templates,
|
1428 |
-
emailType: emailType,
|
1429 |
-
selectedTab: selectedTab,
|
1430 |
-
loading: false
|
1431 |
-
});
|
1432 |
-
});
|
1433 |
-
}
|
1434 |
-
}, {
|
1435 |
-
key: 'afterTemplateDelete',
|
1436 |
-
value: function afterTemplateDelete(success, id) {
|
1437 |
-
var _this5 = this;
|
1438 |
-
|
1439 |
-
if (success) {
|
1440 |
-
Object.keys(this.templates).forEach(function (category) {
|
1441 |
-
_this5.templates[category] = _this5.templates[category].filter(function (template) {
|
1442 |
-
return template.id !== id;
|
1443 |
-
});
|
1444 |
-
});
|
1445 |
-
}
|
1446 |
-
this.setState({
|
1447 |
-
templates: this.templates,
|
1448 |
-
loading: false
|
1449 |
-
});
|
1450 |
-
}
|
1451 |
-
}, {
|
1452 |
-
key: 'afterTemplateSelect',
|
1453 |
-
value: function afterTemplateSelect(success, id) {
|
1454 |
-
if (success) {
|
1455 |
-
window.location = getEditorUrl(id);
|
1456 |
-
} else {
|
1457 |
-
this.setState({ loading: false });
|
1458 |
-
}
|
1459 |
-
}
|
1460 |
-
}, {
|
1461 |
-
key: 'afterTemplateImport',
|
1462 |
-
value: function afterTemplateImport(success, template) {
|
1463 |
-
if (success) {
|
1464 |
-
this.addTemplate(template);
|
1465 |
-
}
|
1466 |
-
this.setState({
|
1467 |
-
templates: this.templates,
|
1468 |
-
selectedTab: success ? 'saved' : 'import',
|
1469 |
-
loading: false
|
1470 |
-
});
|
1471 |
-
}
|
1472 |
-
}, {
|
1473 |
-
key: 'render',
|
1474 |
-
value: function render() {
|
1475 |
-
var _this6 = this;
|
1476 |
-
|
1477 |
-
if (this.state.loading) return _react2['default'].createElement(_commonLoadingJsx2['default'], null);
|
1478 |
-
|
1479 |
-
var tabs = templatesCategories.concat({
|
1480 |
-
name: 'import',
|
1481 |
-
label: _mailpoet2['default'].I18n.t('tabImportTitle')
|
1482 |
-
});
|
1483 |
-
|
1484 |
-
var selectedTab = this.state.selectedTab;
|
1485 |
-
var content = null;
|
1486 |
-
if (selectedTab === 'import') {
|
1487 |
-
content = _react2['default'].createElement(_newslettersTemplatesImport_templateJsx2['default'], {
|
1488 |
-
beforeImport: function () {
|
1489 |
-
return _this6.setState({ loading: true });
|
1490 |
-
},
|
1491 |
-
afterImport: this.afterTemplateImport
|
1492 |
-
});
|
1493 |
-
} else {
|
1494 |
-
var templates = this.state.templates[this.state.selectedTab] || [];
|
1495 |
-
if (templates.length === 0) {
|
1496 |
-
if (this.state.loading) {
|
1497 |
-
templates = null;
|
1498 |
-
} else {
|
1499 |
-
templates = _react2['default'].createElement(
|
1500 |
-
'p',
|
1501 |
-
null,
|
1502 |
-
_mailpoet2['default'].I18n.t('noTemplates')
|
1503 |
-
);
|
1504 |
-
}
|
1505 |
-
} else {
|
1506 |
-
templates = templates.map(function (template, index) {
|
1507 |
-
return _react2['default'].createElement(_newslettersTemplatesTemplate_boxJsx2['default'], _extends({
|
1508 |
-
key: template.id,
|
1509 |
-
index: index,
|
1510 |
-
newsletterId: _this6.props.params.id,
|
1511 |
-
beforeDelete: function () {
|
1512 |
-
return _this6.setState({ loading: true });
|
1513 |
-
},
|
1514 |
-
afterDelete: _this6.afterTemplateDelete,
|
1515 |
-
beforeSelect: function () {
|
1516 |
-
return _this6.setState({ loading: true });
|
1517 |
-
},
|
1518 |
-
afterSelect: _this6.afterTemplateSelect
|
1519 |
-
}, template));
|
1520 |
-
});
|
1521 |
-
}
|
1522 |
-
content = _react2['default'].createElement(
|
1523 |
-
'ul',
|
1524 |
-
{ className: 'mailpoet_boxes clearfix' },
|
1525 |
-
templates
|
1526 |
-
);
|
1527 |
-
}
|
1528 |
-
|
1529 |
-
var breadcrumb = _wpJsHooks2['default'].applyFilters('mailpoet_newsletters_template_breadcrumb', _react2['default'].createElement(_newslettersBreadcrumbJsx2['default'], { step: 'template' }), this.state.emailType, 'template');
|
1530 |
-
|
1531 |
-
return _react2['default'].createElement(
|
1532 |
-
'div',
|
1533 |
-
null,
|
1534 |
-
_react2['default'].createElement(
|
1535 |
-
'h1',
|
1536 |
-
null,
|
1537 |
-
_mailpoet2['default'].I18n.t('selectTemplateTitle')
|
1538 |
-
),
|
1539 |
-
breadcrumb,
|
1540 |
-
_react2['default'].createElement(_newslettersTemplatesTabsJsx2['default'], {
|
1541 |
-
tabs: tabs,
|
1542 |
-
selected: this.state.selectedTab,
|
1543 |
-
select: function (name) {
|
1544 |
-
return _this6.setState({ selectedTab: name });
|
1545 |
-
}
|
1546 |
-
}),
|
1547 |
-
content
|
1548 |
-
);
|
1549 |
-
}
|
1550 |
-
}]);
|
1551 |
-
|
1552 |
-
return NewsletterTemplates;
|
1553 |
-
})(_react2['default'].Component);
|
1554 |
-
|
1555 |
-
NewsletterTemplates.propTypes = {
|
1556 |
-
params: _propTypes2['default'].shape({
|
1557 |
-
id: _propTypes2['default'].string.isRequired
|
1558 |
-
}).isRequired
|
1559 |
-
};
|
1560 |
-
|
1561 |
-
exports['default'] = NewsletterTemplates;
|
1562 |
-
module.exports = exports['default'];
|
1563 |
-
|
1564 |
-
/***/ },
|
1565 |
-
|
1566 |
-
/***/ 444:
|
1567 |
-
/***/ function(module, exports, __webpack_require__) {
|
1568 |
-
|
1569 |
-
'use strict';
|
1570 |
-
|
1571 |
-
Object.defineProperty(exports, '__esModule', {
|
1572 |
-
value: true
|
1573 |
-
});
|
1574 |
-
|
1575 |
-
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
|
1576 |
-
|
1577 |
-
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
|
1578 |
-
|
1579 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
1580 |
-
|
1581 |
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
|
1582 |
-
|
1583 |
-
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
1584 |
-
|
1585 |
-
var _react = __webpack_require__(2);
|
1586 |
-
|
1587 |
-
var _react2 = _interopRequireDefault(_react);
|
1588 |
-
|
1589 |
-
var _mailpoet = __webpack_require__(276);
|
1590 |
-
|
1591 |
-
var _mailpoet2 = _interopRequireDefault(_mailpoet);
|
1592 |
-
|
1593 |
-
var Loading = (function (_React$Component) {
|
1594 |
-
_inherits(Loading, _React$Component);
|
1595 |
-
|
1596 |
-
function Loading() {
|
1597 |
-
_classCallCheck(this, Loading);
|
1598 |
-
|
1599 |
-
_get(Object.getPrototypeOf(Loading.prototype), 'constructor', this).apply(this, arguments);
|
1600 |
-
}
|
1601 |
-
|
1602 |
-
_createClass(Loading, [{
|
1603 |
-
key: 'componentWillMount',
|
1604 |
-
value: function componentWillMount() {
|
1605 |
-
_mailpoet2['default'].Modal.loading(true);
|
1606 |
-
}
|
1607 |
-
}, {
|
1608 |
-
key: 'componentWillUnmount',
|
1609 |
-
value: function componentWillUnmount() {
|
1610 |
-
_mailpoet2['default'].Modal.loading(false);
|
1611 |
-
}
|
1612 |
-
}, {
|
1613 |
-
key: 'render',
|
1614 |
-
value: function render() {
|
1615 |
-
return null;
|
1616 |
-
}
|
1617 |
-
}]);
|
1618 |
-
|
1619 |
-
return Loading;
|
1620 |
-
})(_react2['default'].Component);
|
1621 |
-
|
1622 |
-
exports['default'] = Loading;
|
1623 |
-
module.exports = exports['default'];
|
1624 |
-
|
1625 |
-
/***/ },
|
1626 |
-
|
1627 |
-
/***/ 445:
|
1628 |
-
/***/ function(module, exports, __webpack_require__) {
|
1629 |
-
|
1630 |
-
'use strict';
|
1631 |
-
|
1632 |
-
Object.defineProperty(exports, '__esModule', {
|
1633 |
-
value: true
|
1634 |
-
});
|
1635 |
-
|
1636 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
1637 |
-
|
1638 |
-
var _react = __webpack_require__(2);
|
1639 |
-
|
1640 |
-
var _react2 = _interopRequireDefault(_react);
|
1641 |
-
|
1642 |
-
var _propTypes = __webpack_require__(185);
|
1643 |
-
|
1644 |
-
var _propTypes2 = _interopRequireDefault(_propTypes);
|
1645 |
-
|
1646 |
-
var _reactTooltip = __webpack_require__(446);
|
1647 |
-
|
1648 |
-
var _reactTooltip2 = _interopRequireDefault(_reactTooltip);
|
1649 |
-
|
1650 |
-
var _mailpoet = __webpack_require__(276);
|
1651 |
-
|
1652 |
-
var _mailpoet2 = _interopRequireDefault(_mailpoet);
|
1653 |
-
|
1654 |
-
var _reactStringReplace = __webpack_require__(431);
|
1655 |
-
|
1656 |
-
var _reactStringReplace2 = _interopRequireDefault(_reactStringReplace);
|
1657 |
-
|
1658 |
-
var tooltipText = (0, _reactStringReplace2['default'])(_mailpoet2['default'].I18n.t('tooltipTemplateTabs'), /\[link\](.*?)\[\/link\]/g, function (match) {
|
1659 |
-
return _react2['default'].createElement(
|
1660 |
-
'a',
|
1661 |
-
{
|
1662 |
-
href: 'https://mailpoet.polldaddy.com/s/select-template-feedback',
|
1663 |
-
key: 'feedback',
|
1664 |
-
target: '_blank',
|
1665 |
-
rel: 'noopener noreferrer'
|
1666 |
-
},
|
1667 |
-
match
|
1668 |
-
);
|
1669 |
-
});
|
1670 |
-
|
1671 |
-
var Tabs = function Tabs(_ref) {
|
1672 |
-
var tabs = _ref.tabs;
|
1673 |
-
var selected = _ref.selected;
|
1674 |
-
var select = _ref.select;
|
1675 |
-
return _react2['default'].createElement(
|
1676 |
-
'div',
|
1677 |
-
{ className: 'wp-filter hide-if-no-js' },
|
1678 |
-
_react2['default'].createElement(
|
1679 |
-
'ul',
|
1680 |
-
{ className: 'filter-links' },
|
1681 |
-
tabs.map(function (_ref2) {
|
1682 |
-
var name = _ref2.name;
|
1683 |
-
var label = _ref2.label;
|
1684 |
-
return _react2['default'].createElement(
|
1685 |
-
'li',
|
1686 |
-
{ key: name },
|
1687 |
-
_react2['default'].createElement(
|
1688 |
-
'a',
|
1689 |
-
{
|
1690 |
-
href: 'javascript:',
|
1691 |
-
className: selected === name ? 'current' : '',
|
1692 |
-
onClick: function () {
|
1693 |
-
return select(name);
|
1694 |
-
}
|
1695 |
-
},
|
1696 |
-
' ',
|
1697 |
-
label
|
1698 |
-
)
|
1699 |
-
);
|
1700 |
-
})
|
1701 |
-
),
|
1702 |
-
_react2['default'].createElement(
|
1703 |
-
'span',
|
1704 |
-
{
|
1705 |
-
className: 'feedback-tooltip newsletter-templates-feedback',
|
1706 |
-
'data-event': 'click',
|
1707 |
-
'data-tip': true,
|
1708 |
-
'data-for': 'feedback-newsletter-templates-tabs'
|
1709 |
-
},
|
1710 |
-
_mailpoet2['default'].I18n.t('feedback')
|
1711 |
-
),
|
1712 |
-
_react2['default'].createElement(
|
1713 |
-
_reactTooltip2['default'],
|
1714 |
-
{
|
1715 |
-
globalEventOff: 'click',
|
1716 |
-
multiline: true,
|
1717 |
-
id: 'feedback-newsletter-templates-tabs',
|
1718 |
-
efect: 'solid',
|
1719 |
-
place: 'bottom'
|
1720 |
-
},
|
1721 |
-
_react2['default'].createElement(
|
1722 |
-
'span',
|
1723 |
-
{
|
1724 |
-
style: {
|
1725 |
-
pointerEvents: 'all',
|
1726 |
-
display: 'inline-block'
|
1727 |
-
}
|
1728 |
-
},
|
1729 |
-
tooltipText
|
1730 |
-
)
|
1731 |
-
)
|
1732 |
-
);
|
1733 |
-
};
|
1734 |
-
|
1735 |
-
Tabs.propTypes = {
|
1736 |
-
selected: _propTypes2['default'].string.isRequired,
|
1737 |
-
select: _propTypes2['default'].func.isRequired,
|
1738 |
-
tabs: _propTypes2['default'].arrayOf(_propTypes2['default'].shape({
|
1739 |
-
label: _propTypes2['default'].string.isRequired,
|
1740 |
-
name: _propTypes2['default'].string.isRequired
|
1741 |
-
}).isRequired).isRequired
|
1742 |
-
};
|
1743 |
-
|
1744 |
-
exports['default'] = Tabs;
|
1745 |
-
module.exports = exports['default'];
|
1746 |
-
|
1747 |
-
/***/ },
|
1748 |
-
|
1749 |
-
/***/ 460:
|
1750 |
-
/***/ function(module, exports, __webpack_require__) {
|
1751 |
-
|
1752 |
-
'use strict';
|
1753 |
-
|
1754 |
-
Object.defineProperty(exports, '__esModule', {
|
1755 |
-
value: true
|
1756 |
-
});
|
1757 |
-
|
1758 |
-
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
|
1759 |
-
|
1760 |
-
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
|
1761 |
-
|
1762 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
1763 |
-
|
1764 |
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
|
1765 |
-
|
1766 |
-
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
1767 |
-
|
1768 |
-
var _react = __webpack_require__(2);
|
1769 |
-
|
1770 |
-
var _react2 = _interopRequireDefault(_react);
|
1771 |
-
|
1772 |
-
var _underscore = __webpack_require__(281);
|
1773 |
-
|
1774 |
-
var _underscore2 = _interopRequireDefault(_underscore);
|
1775 |
-
|
1776 |
-
var _mailpoet = __webpack_require__(276);
|
1777 |
-
|
1778 |
-
var _mailpoet2 = _interopRequireDefault(_mailpoet);
|
1779 |
-
|
1780 |
-
var _reactConfirmAlert = __webpack_require__(461);
|
1781 |
-
|
1782 |
-
var _propTypes = __webpack_require__(185);
|
1783 |
-
|
1784 |
-
var _propTypes2 = _interopRequireDefault(_propTypes);
|
1785 |
-
|
1786 |
-
/**
|
1787 |
-
* props = {
|
1788 |
-
* index, id, newsletterId, name, description, thumbnail, readonly,
|
1789 |
-
* beforeDelete, afterDelete, beforeSelect, afterSelect
|
1790 |
-
* }
|
1791 |
-
*/
|
1792 |
-
|
1793 |
-
var TemplateBox = (function (_React$Component) {
|
1794 |
-
_inherits(TemplateBox, _React$Component);
|
1795 |
-
|
1796 |
-
function TemplateBox(props) {
|
1797 |
-
_classCallCheck(this, TemplateBox);
|
1798 |
-
|
1799 |
-
_get(Object.getPrototypeOf(TemplateBox.prototype), 'constructor', this).call(this, props);
|
1800 |
-
this.onPreview = this.onPreview.bind(this);
|
1801 |
-
this.onDelete = this.onDelete.bind(this);
|
1802 |
-
this.onSelect = this.onSelect.bind(this);
|
1803 |
-
}
|
1804 |
-
|
1805 |
-
_createClass(TemplateBox, [{
|
1806 |
-
key: 'onDelete',
|
1807 |
-
value: function onDelete() {
|
1808 |
-
var _props = this.props;
|
1809 |
-
var id = _props.id;
|
1810 |
-
var name = _props.name;
|
1811 |
-
var beforeDelete = _props.beforeDelete;
|
1812 |
-
var afterDelete = _props.afterDelete;
|
1813 |
-
|
1814 |
-
var onConfirm = function onConfirm() {
|
1815 |
-
beforeDelete();
|
1816 |
-
_mailpoet2['default'].Ajax.post({
|
1817 |
-
api_version: window.mailpoet_api_version,
|
1818 |
-
endpoint: 'newsletterTemplates',
|
1819 |
-
action: 'delete',
|
1820 |
-
data: {
|
1821 |
-
id: id
|
1822 |
-
}
|
1823 |
-
}).done(function () {
|
1824 |
-
afterDelete(true, id);
|
1825 |
-
}).fail(function (response) {
|
1826 |
-
if (response.errors.length > 0) {
|
1827 |
-
_mailpoet2['default'].Notice.error(response.errors.map(function (error) {
|
1828 |
-
return error.message;
|
1829 |
-
}), { scroll: true });
|
1830 |
-
}
|
1831 |
-
afterDelete(false);
|
1832 |
-
});
|
1833 |
-
};
|
1834 |
-
(0, _reactConfirmAlert.confirmAlert)({
|
1835 |
-
title: _mailpoet2['default'].I18n.t('confirmTitle'),
|
1836 |
-
message: _mailpoet2['default'].I18n.t('confirmTemplateDeletion').replace('%$1s', name),
|
1837 |
-
confirmLabel: _mailpoet2['default'].I18n.t('confirmLabel'),
|
1838 |
-
cancelLabel: _mailpoet2['default'].I18n.t('cancelLabel'),
|
1839 |
-
onConfirm: onConfirm,
|
1840 |
-
onCancel: function onCancel() {}
|
1841 |
-
});
|
1842 |
-
}
|
1843 |
-
}, {
|
1844 |
-
key: 'onPreview',
|
1845 |
-
value: function onPreview() {
|
1846 |
-
_mailpoet2['default'].Modal.popup({
|
1847 |
-
title: this.props.name,
|
1848 |
-
template: '<div class="mailpoet_boxes_preview" style="background-color: {{ body.globalStyles.body.backgroundColor }}"><img src="{{ thumbnail }}" /></div>',
|
1849 |
-
data: this.props
|
1850 |
-
});
|
1851 |
-
}
|
1852 |
-
}, {
|
1853 |
-
key: 'onSelect',
|
1854 |
-
value: function onSelect() {
|
1855 |
-
var _props2 = this.props;
|
1856 |
-
var newsletterId = _props2.newsletterId;
|
1857 |
-
var name = _props2.name;
|
1858 |
-
var beforeSelect = _props2.beforeSelect;
|
1859 |
-
var afterSelect = _props2.afterSelect;
|
1860 |
-
|
1861 |
-
var body = this.props.body;
|
1862 |
-
|
1863 |
-
if (!_underscore2['default'].isUndefined(body)) {
|
1864 |
-
body = JSON.stringify(body);
|
1865 |
-
}
|
1866 |
-
|
1867 |
-
beforeSelect();
|
1868 |
-
|
1869 |
-
_mailpoet2['default'].trackEvent('Emails > Template selected', {
|
1870 |
-
'MailPoet Free version': window.mailpoet_version,
|
1871 |
-
'Email name': name
|
1872 |
-
});
|
1873 |
-
|
1874 |
-
_mailpoet2['default'].Ajax.post({
|
1875 |
-
api_version: window.mailpoet_api_version,
|
1876 |
-
endpoint: 'newsletters',
|
1877 |
-
action: 'save',
|
1878 |
-
data: {
|
1879 |
-
id: newsletterId,
|
1880 |
-
body: body
|
1881 |
-
}
|
1882 |
-
}).done(function (response) {
|
1883 |
-
afterSelect(true, response.data.id);
|
1884 |
-
}).fail(function (response) {
|
1885 |
-
if (response.errors.length > 0) {
|
1886 |
-
_mailpoet2['default'].Notice.error(response.errors.map(function (error) {
|
1887 |
-
return error.message;
|
1888 |
-
}), { scroll: true });
|
1889 |
-
}
|
1890 |
-
afterSelect(false);
|
1891 |
-
});
|
1892 |
-
}
|
1893 |
-
}, {
|
1894 |
-
key: 'render',
|
1895 |
-
value: function render() {
|
1896 |
-
var _props3 = this.props;
|
1897 |
-
var index = _props3.index;
|
1898 |
-
var name = _props3.name;
|
1899 |
-
var thumbnail = _props3.thumbnail;
|
1900 |
-
var readonly = _props3.readonly;
|
1901 |
-
|
1902 |
-
var deleteLink = _react2['default'].createElement(
|
1903 |
-
'div',
|
1904 |
-
{ className: 'mailpoet_delete button button-secondary' },
|
1905 |
-
_react2['default'].createElement(
|
1906 |
-
'a',
|
1907 |
-
{ href: 'javascript:;', onClick: this.onDelete },
|
1908 |
-
_mailpoet2['default'].I18n.t('delete')
|
1909 |
-
)
|
1910 |
-
);
|
1911 |
-
|
1912 |
-
var preview = '';
|
1913 |
-
if (typeof thumbnail === 'string' && thumbnail.length > 0) {
|
1914 |
-
preview = _react2['default'].createElement(
|
1915 |
-
'a',
|
1916 |
-
{ href: 'javascript:;', onClick: this.onPreview },
|
1917 |
-
_react2['default'].createElement('img', { src: thumbnail, alt: _mailpoet2['default'].I18n.t('templatePreview') }),
|
1918 |
-
_react2['default'].createElement(
|
1919 |
-
'div',
|
1920 |
-
{ className: 'mailpoet_overlay' },
|
1921 |
-
_react2['default'].createElement(
|
1922 |
-
'p',
|
1923 |
-
{ className: 'mailpoet_more_details' },
|
1924 |
-
_mailpoet2['default'].I18n.t('zoom')
|
1925 |
-
)
|
1926 |
-
)
|
1927 |
-
);
|
1928 |
-
}
|
1929 |
-
|
1930 |
-
return _react2['default'].createElement(
|
1931 |
-
'li',
|
1932 |
-
{ className: 'mailpoet_template_boxes' },
|
1933 |
-
_react2['default'].createElement(
|
1934 |
-
'div',
|
1935 |
-
{ className: 'mailpoet_thumbnail' },
|
1936 |
-
preview
|
1937 |
-
),
|
1938 |
-
_react2['default'].createElement(
|
1939 |
-
'div',
|
1940 |
-
{ className: 'mailpoet_description' },
|
1941 |
-
_react2['default'].createElement(
|
1942 |
-
'h3',
|
1943 |
-
null,
|
1944 |
-
name
|
1945 |
-
)
|
1946 |
-
),
|
1947 |
-
_react2['default'].createElement(
|
1948 |
-
'div',
|
1949 |
-
{ className: 'mailpoet_actions' },
|
1950 |
-
readonly === '1' ? false : deleteLink,
|
1951 |
-
_react2['default'].createElement(
|
1952 |
-
'a',
|
1953 |
-
{
|
1954 |
-
className: 'button button-primary',
|
1955 |
-
'data-automation-id': 'select_template_' + index,
|
1956 |
-
onClick: this.onSelect,
|
1957 |
-
role: 'button',
|
1958 |
-
tabIndex: 0
|
1959 |
-
},
|
1960 |
-
' ',
|
1961 |
-
_mailpoet2['default'].I18n.t('select'),
|
1962 |
-
' '
|
1963 |
-
)
|
1964 |
-
)
|
1965 |
-
);
|
1966 |
-
}
|
1967 |
-
}]);
|
1968 |
-
|
1969 |
-
return TemplateBox;
|
1970 |
-
})(_react2['default'].Component);
|
1971 |
-
|
1972 |
-
TemplateBox.propTypes = {
|
1973 |
-
index: _propTypes2['default'].number.isRequired,
|
1974 |
-
id: _propTypes2['default'].string.isRequired,
|
1975 |
-
newsletterId: _propTypes2['default'].string.isRequired,
|
1976 |
-
name: _propTypes2['default'].string.isRequired,
|
1977 |
-
thumbnail: _propTypes2['default'].string.isRequired,
|
1978 |
-
readonly: _propTypes2['default'].string.isRequired,
|
1979 |
-
beforeDelete: _propTypes2['default'].func.isRequired,
|
1980 |
-
afterDelete: _propTypes2['default'].func.isRequired,
|
1981 |
-
beforeSelect: _propTypes2['default'].func.isRequired,
|
1982 |
-
afterSelect: _propTypes2['default'].func.isRequired,
|
1983 |
-
body: _propTypes2['default'].object.isRequired };
|
1984 |
-
|
1985 |
-
// eslint-disable-line react/forbid-prop-types
|
1986 |
-
exports['default'] = TemplateBox;
|
1987 |
-
module.exports = exports['default'];
|
1988 |
-
|
1989 |
-
/***/ },
|
1990 |
-
|
1991 |
-
/***/ 461:
|
1992 |
-
/***/ function(module, exports, __webpack_require__) {
|
1993 |
-
|
1994 |
-
'use strict';
|
1995 |
-
|
1996 |
-
exports.__esModule = true;
|
1997 |
-
|
1998 |
-
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
|
1999 |
-
|
2000 |
-
exports.confirmAlert = confirmAlert;
|
2001 |
-
|
2002 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
2003 |
-
|
2004 |
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
|
2005 |
-
|
2006 |
-
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
2007 |
-
|
2008 |
-
var _react = __webpack_require__(2);
|
2009 |
-
|
2010 |
-
var _react2 = _interopRequireDefault(_react);
|
2011 |
-
|
2012 |
-
var _propTypes = __webpack_require__(185);
|
2013 |
-
|
2014 |
-
var _propTypes2 = _interopRequireDefault(_propTypes);
|
2015 |
-
|
2016 |
-
var _reactDom = __webpack_require__(34);
|
2017 |
-
|
2018 |
-
var ReactConfirmAlert = (function (_Component) {
|
2019 |
-
_inherits(ReactConfirmAlert, _Component);
|
2020 |
-
|
2021 |
-
function ReactConfirmAlert() {
|
2022 |
-
var _this = this;
|
2023 |
-
|
2024 |
-
_classCallCheck(this, ReactConfirmAlert);
|
2025 |
-
|
2026 |
-
_Component.apply(this, arguments);
|
2027 |
-
|
2028 |
-
this.onClickConfirm = function () {
|
2029 |
-
_this.props.onConfirm();
|
2030 |
-
_this.close();
|
2031 |
-
};
|
2032 |
-
|
2033 |
-
this.onClickCancel = function () {
|
2034 |
-
_this.props.onCancel();
|
2035 |
-
_this.close();
|
2036 |
-
};
|
2037 |
-
|
2038 |
-
this.close = function () {
|
2039 |
-
removeElementReconfirm();
|
2040 |
-
removeSVGBlurReconfirm();
|
2041 |
-
};
|
2042 |
-
}
|
2043 |
-
|
2044 |
-
ReactConfirmAlert.prototype.render = function render() {
|
2045 |
-
var _props = this.props;
|
2046 |
-
var title = _props.title;
|
2047 |
-
var message = _props.message;
|
2048 |
-
var confirmLabel = _props.confirmLabel;
|
2049 |
-
var cancelLabel = _props.cancelLabel;
|
2050 |
-
var childrenElement = _props.childrenElement;
|
2051 |
-
|
2052 |
-
return _react2['default'].createElement(
|
2053 |
-
'div',
|
2054 |
-
{ className: 'react-confirm-alert-overlay' },
|
2055 |
-
_react2['default'].createElement(
|
2056 |
-
'div',
|
2057 |
-
{ className: 'react-confirm-alert' },
|
2058 |
-
title && _react2['default'].createElement(
|
2059 |
-
'h1',
|
2060 |
-
null,
|
2061 |
-
title
|
2062 |
-
),
|
2063 |
-
message && _react2['default'].createElement(
|
2064 |
-
'h3',
|
2065 |
-
null,
|
2066 |
-
message
|
2067 |
-
),
|
2068 |
-
childrenElement(),
|
2069 |
-
_react2['default'].createElement(
|
2070 |
-
'div',
|
2071 |
-
{ className: 'react-confirm-alert-button-group' },
|
2072 |
-
cancelLabel && _react2['default'].createElement(
|
2073 |
-
'button',
|
2074 |
-
{ onClick: this.onClickCancel },
|
2075 |
-
cancelLabel
|
2076 |
-
),
|
2077 |
-
confirmLabel && _react2['default'].createElement(
|
2078 |
-
'button',
|
2079 |
-
{ onClick: this.onClickConfirm },
|
2080 |
-
confirmLabel
|
2081 |
-
)
|
2082 |
-
)
|
2083 |
-
)
|
2084 |
-
);
|
2085 |
-
};
|
2086 |
-
|
2087 |
-
_createClass(ReactConfirmAlert, null, [{
|
2088 |
-
key: 'propTypes',
|
2089 |
-
value: {
|
2090 |
-
title: _propTypes2['default'].string,
|
2091 |
-
message: _propTypes2['default'].string,
|
2092 |
-
confirmLabel: _propTypes2['default'].string,
|
2093 |
-
cancelLabel: _propTypes2['default'].string,
|
2094 |
-
onConfirm: _propTypes2['default'].func,
|
2095 |
-
onCancel: _propTypes2['default'].func,
|
2096 |
-
children: _propTypes2['default'].node
|
2097 |
-
},
|
2098 |
-
enumerable: true
|
2099 |
-
}, {
|
2100 |
-
key: 'defaultProps',
|
2101 |
-
value: {
|
2102 |
-
title: false,
|
2103 |
-
message: false,
|
2104 |
-
childrenElement: function childrenElement() {
|
2105 |
-
return null;
|
2106 |
-
},
|
2107 |
-
confirmLabel: false,
|
2108 |
-
cancelLabel: false,
|
2109 |
-
onConfirm: function onConfirm() {
|
2110 |
-
return null;
|
2111 |
-
},
|
2112 |
-
onCancel: function onCancel() {
|
2113 |
-
return null;
|
2114 |
-
}
|
2115 |
-
},
|
2116 |
-
enumerable: true
|
2117 |
-
}]);
|
2118 |
-
|
2119 |
-
return ReactConfirmAlert;
|
2120 |
-
})(_react.Component);
|
2121 |
-
|
2122 |
-
exports['default'] = ReactConfirmAlert;
|
2123 |
-
|
2124 |
-
function createSVGBlurReconfirm() {
|
2125 |
-
var svgNS = 'http://www.w3.org/2000/svg';
|
2126 |
-
var feGaussianBlur = document.createElementNS(svgNS, 'feGaussianBlur');
|
2127 |
-
feGaussianBlur.setAttribute('stdDeviation', '0.7');
|
2128 |
-
|
2129 |
-
var filter = document.createElementNS(svgNS, 'filter');
|
2130 |
-
filter.setAttribute('id', 'gaussian-blur');
|
2131 |
-
filter.appendChild(feGaussianBlur);
|
2132 |
-
|
2133 |
-
var svgElem = document.createElementNS(svgNS, 'svg');
|
2134 |
-
svgElem.setAttribute('id', 'react-confirm-alert-firm-svg');
|
2135 |
-
svgElem.setAttribute('class', 'react-confirm-alert-svg');
|
2136 |
-
svgElem.appendChild(filter);
|
2137 |
-
|
2138 |
-
document.body.appendChild(svgElem);
|
2139 |
-
}
|
2140 |
-
|
2141 |
-
function removeSVGBlurReconfirm() {
|
2142 |
-
var svg = document.getElementById('react-confirm-alert-firm-svg');
|
2143 |
-
svg.parentNode.removeChild(svg);
|
2144 |
-
document.body.children[0].classList.remove('react-confirm-alert-blur');
|
2145 |
-
}
|
2146 |
-
|
2147 |
-
function createElementReconfirm(properties) {
|
2148 |
-
document.body.children[0].classList.add('react-confirm-alert-blur');
|
2149 |
-
var divTarget = document.createElement('div');
|
2150 |
-
divTarget.id = 'react-confirm-alert';
|
2151 |
-
document.body.appendChild(divTarget);
|
2152 |
-
_reactDom.render(_react2['default'].createElement(ReactConfirmAlert, properties), divTarget);
|
2153 |
-
}
|
2154 |
-
|
2155 |
-
function removeElementReconfirm() {
|
2156 |
-
var target = document.getElementById('react-confirm-alert');
|
2157 |
-
_reactDom.unmountComponentAtNode(target);
|
2158 |
-
target.parentNode.removeChild(target);
|
2159 |
-
}
|
2160 |
-
|
2161 |
-
function confirmAlert(properties) {
|
2162 |
-
createSVGBlurReconfirm();
|
2163 |
-
createElementReconfirm(properties);
|
2164 |
-
}
|
2165 |
-
|
2166 |
-
/***/ },
|
2167 |
-
|
2168 |
-
/***/ 462:
|
2169 |
-
/***/ function(module, exports, __webpack_require__) {
|
2170 |
-
|
2171 |
-
'use strict';
|
2172 |
-
|
2173 |
-
Object.defineProperty(exports, '__esModule', {
|
2174 |
-
value: true
|
2175 |
-
});
|
2176 |
-
|
2177 |
-
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
|
2178 |
-
|
2179 |
-
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
|
2180 |
-
|
2181 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
2182 |
-
|
2183 |
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
|
2184 |
-
|
2185 |
-
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
2186 |
-
|
2187 |
-
var _react = __webpack_require__(2);
|
2188 |
-
|
2189 |
-
var _react2 = _interopRequireDefault(_react);
|
2190 |
-
|
2191 |
-
var _underscore = __webpack_require__(281);
|
2192 |
-
|
2193 |
-
var _underscore2 = _interopRequireDefault(_underscore);
|
2194 |
-
|
2195 |
-
var _mailpoet = __webpack_require__(276);
|
2196 |
-
|
2197 |
-
var _mailpoet2 = _interopRequireDefault(_mailpoet);
|
2198 |
-
|
2199 |
-
var _helpTooltipJsx = __webpack_require__(463);
|
2200 |
-
|
2201 |
-
var _helpTooltipJsx2 = _interopRequireDefault(_helpTooltipJsx);
|
2202 |
-
|
2203 |
-
var _propTypes = __webpack_require__(185);
|
2204 |
-
|
2205 |
-
var _propTypes2 = _interopRequireDefault(_propTypes);
|
2206 |
-
|
2207 |
-
var ImportTemplate = (function (_React$Component) {
|
2208 |
-
_inherits(ImportTemplate, _React$Component);
|
2209 |
-
|
2210 |
-
function ImportTemplate(props) {
|
2211 |
-
_classCallCheck(this, ImportTemplate);
|
2212 |
-
|
2213 |
-
_get(Object.getPrototypeOf(ImportTemplate.prototype), 'constructor', this).call(this, props);
|
2214 |
-
this.handleSubmit = this.handleSubmit.bind(this);
|
2215 |
-
}
|
2216 |
-
|
2217 |
-
_createClass(ImportTemplate, [{
|
2218 |
-
key: 'saveTemplate',
|
2219 |
-
value: function saveTemplate(_saveTemplate) {
|
2220 |
-
var template = _saveTemplate;
|
2221 |
-
var _props = this.props;
|
2222 |
-
var beforeImport = _props.beforeImport;
|
2223 |
-
var afterImport = _props.afterImport;
|
2224 |
-
|
2225 |
-
// Stringify to enable transmission of primitive non-string value types
|
2226 |
-
if (!_underscore2['default'].isUndefined(template.body)) {
|
2227 |
-
template.body = JSON.stringify(template.body);
|
2228 |
-
}
|
2229 |
-
|
2230 |
-
try {
|
2231 |
-
template.categories = JSON.parse(template.categories);
|
2232 |
-
} catch (err) {
|
2233 |
-
template.categories = [];
|
2234 |
-
}
|
2235 |
-
|
2236 |
-
if (template.categories.indexOf('saved') === -1) {
|
2237 |
-
template.categories.push('saved');
|
2238 |
-
}
|
2239 |
-
|
2240 |
-
if (template.categories.indexOf('standard') === -1 && template.categories.indexOf('welcome') === -1 && template.categories.indexOf('notification') === -1) {
|
2241 |
-
template.categories.push('standard');
|
2242 |
-
}
|
2243 |
-
|
2244 |
-
template.categories = JSON.stringify(template.categories);
|
2245 |
-
|
2246 |
-
beforeImport();
|
2247 |
-
_mailpoet2['default'].Ajax.post({
|
2248 |
-
api_version: window.mailpoet_api_version,
|
2249 |
-
endpoint: 'newsletterTemplates',
|
2250 |
-
action: 'save',
|
2251 |
-
data: template
|
2252 |
-
}).done(function (response) {
|
2253 |
-
afterImport(true, response.data);
|
2254 |
-
}).fail(function (response) {
|
2255 |
-
if (response.errors.length > 0) {
|
2256 |
-
_mailpoet2['default'].Notice.error(response.errors.map(function (error) {
|
2257 |
-
return error.message;
|
2258 |
-
}), { scroll: true });
|
2259 |
-
}
|
2260 |
-
afterImport(false);
|
2261 |
-
});
|
2262 |
-
}
|
2263 |
-
}, {
|
2264 |
-
key: 'handleSubmit',
|
2265 |
-
value: function handleSubmit(e) {
|
2266 |
-
var _this = this;
|
2267 |
-
|
2268 |
-
e.preventDefault();
|
2269 |
-
|
2270 |
-
if (_underscore2['default'].size(this.templateFile.files) <= 0) {
|
2271 |
-
return false;
|
2272 |
-
}
|
2273 |
-
|
2274 |
-
var file = _underscore2['default'].first(this.templateFile.files);
|
2275 |
-
var reader = new FileReader();
|
2276 |
-
|
2277 |
-
reader.onload = function (evt) {
|
2278 |
-
try {
|
2279 |
-
_this.saveTemplate(JSON.parse(evt.target.result));
|
2280 |
-
_mailpoet2['default'].trackEvent('Emails > Template imported', {
|
2281 |
-
'MailPoet Free version': window.mailpoet_version
|
2282 |
-
});
|
2283 |
-
} catch (err) {
|
2284 |
-
_mailpoet2['default'].Notice.error(_mailpoet2['default'].I18n.t('templateFileMalformedError'));
|
2285 |
-
}
|
2286 |
-
};
|
2287 |
-
|
2288 |
-
reader.readAsText(file);
|
2289 |
-
return true;
|
2290 |
-
}
|
2291 |
-
}, {
|
2292 |
-
key: 'render',
|
2293 |
-
value: function render() {
|
2294 |
-
var _this2 = this;
|
2295 |
-
|
2296 |
-
return _react2['default'].createElement(
|
2297 |
-
'div',
|
2298 |
-
null,
|
2299 |
-
_react2['default'].createElement(
|
2300 |
-
'h2',
|
2301 |
-
null,
|
2302 |
-
_mailpoet2['default'].I18n.t('importTemplateTitle'),
|
2303 |
-
_react2['default'].createElement(_helpTooltipJsx2['default'], {
|
2304 |
-
tooltip: _mailpoet2['default'].I18n.t('helpTooltipTemplateUpload'),
|
2305 |
-
place: 'right',
|
2306 |
-
className: 'tooltip-help-import-template'
|
2307 |
-
})
|
2308 |
-
),
|
2309 |
-
_react2['default'].createElement(
|
2310 |
-
'form',
|
2311 |
-
{ onSubmit: this.handleSubmit },
|
2312 |
-
_react2['default'].createElement('input', {
|
2313 |
-
type: 'file',
|
2314 |
-
placeholder: _mailpoet2['default'].I18n.t('selectJsonFileToUpload'),
|
2315 |
-
ref: function (c) {
|
2316 |
-
_this2.templateFile = c;
|
2317 |
-
}
|
2318 |
-
}),
|
2319 |
-
_react2['default'].createElement(
|
2320 |
-
'p',
|
2321 |
-
{ className: 'submit' },
|
2322 |
-
_react2['default'].createElement('input', {
|
2323 |
-
className: 'button button-primary',
|
2324 |
-
type: 'submit',
|
2325 |
-
value: _mailpoet2['default'].I18n.t('upload')
|
2326 |
-
})
|
2327 |
-
)
|
2328 |
-
)
|
2329 |
-
);
|
2330 |
-
}
|
2331 |
-
}]);
|
2332 |
-
|
2333 |
-
return ImportTemplate;
|
2334 |
-
})(_react2['default'].Component);
|
2335 |
-
|
2336 |
-
ImportTemplate.propTypes = {
|
2337 |
-
beforeImport: _propTypes2['default'].func.isRequired,
|
2338 |
-
afterImport: _propTypes2['default'].func.isRequired
|
2339 |
-
};
|
2340 |
-
|
2341 |
-
exports['default'] = ImportTemplate;
|
2342 |
-
module.exports = exports['default'];
|
2343 |
-
|
2344 |
-
/***/ },
|
2345 |
-
|
2346 |
-
/***/ 463:
|
2347 |
-
/***/ function(module, exports, __webpack_require__) {
|
2348 |
-
|
2349 |
-
'use strict';
|
2350 |
-
|
2351 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
2352 |
-
|
2353 |
-
var _react = __webpack_require__(2);
|
2354 |
-
|
2355 |
-
var _react2 = _interopRequireDefault(_react);
|
2356 |
-
|
2357 |
-
var _reactTooltip = __webpack_require__(446);
|
2358 |
-
|
2359 |
-
var _reactTooltip2 = _interopRequireDefault(_reactTooltip);
|
2360 |
-
|
2361 |
-
var _reactHtmlParser = __webpack_require__(464);
|
2362 |
-
|
2363 |
-
var _reactHtmlParser2 = _interopRequireDefault(_reactHtmlParser);
|
2364 |
-
|
2365 |
-
function Tooltip(props) {
|
2366 |
-
var tooltipId = props.tooltipId;
|
2367 |
-
var tooltip = props.tooltip;
|
2368 |
-
// tooltip ID must be unique, defaults to tooltip text
|
2369 |
-
if (!props.tooltipId && typeof props.tooltip === 'string') {
|
2370 |
-
tooltipId = props.tooltip;
|
2371 |
-
}
|
2372 |
-
|
2373 |
-
if (typeof props.tooltip === 'string') {
|
2374 |
-
tooltip = _react2['default'].createElement(
|
2375 |
-
'span',
|
2376 |
-
{
|
2377 |
-
style: {
|
2378 |
-
pointerEvents: 'all',
|
2379 |
-
maxWidth: '400',
|
2380 |
-
display: 'inline-block'
|
2381 |
-
}
|
2382 |
-
},
|
2383 |
-
(0, _reactHtmlParser2['default'])(props.tooltip)
|
2384 |
-
);
|
2385 |
-
}
|
2386 |
-
|
2387 |
-
return _react2['default'].createElement(
|
2388 |
-
'span',
|
2389 |
-
{ className: props.className },
|
2390 |
-
_react2['default'].createElement('span', {
|
2391 |
-
style: {
|
2392 |
-
cursor: 'pointer'
|
2393 |
-
},
|
2394 |
-
className: 'tooltip dashicons dashicons-editor-help',
|
2395 |
-
'data-event': 'click',
|
2396 |
-
'data-tip': true,
|
2397 |
-
'data-for': tooltipId
|
2398 |
-
}),
|
2399 |
-
_react2['default'].createElement(
|
2400 |
-
_reactTooltip2['default'],
|
2401 |
-
{
|
2402 |
-
globalEventOff: 'click',
|
2403 |
-
multiline: true,
|
2404 |
-
id: tooltipId,
|
2405 |
-
efect: 'solid',
|
2406 |
-
place: props.place
|
2407 |
-
},
|
2408 |
-
tooltip
|
2409 |
-
)
|
2410 |
-
);
|
2411 |
-
}
|
2412 |
-
|
2413 |
-
Tooltip.propTypes = {
|
2414 |
-
tooltipId: _react2['default'].PropTypes.string,
|
2415 |
-
tooltip: _react2['default'].PropTypes.node.isRequired,
|
2416 |
-
place: _react2['default'].PropTypes.string,
|
2417 |
-
className: _react2['default'].PropTypes.string
|
2418 |
-
};
|
2419 |
-
|
2420 |
-
Tooltip.defaultProps = {
|
2421 |
-
tooltipId: undefined,
|
2422 |
-
place: undefined,
|
2423 |
-
className: undefined
|
2424 |
-
};
|
2425 |
-
|
2426 |
-
module.exports = Tooltip;
|
2427 |
-
|
2428 |
-
/***/ },
|
2429 |
-
|
2430 |
-
/***/ 464:
|
2431 |
-
/***/ function(module, exports, __webpack_require__) {
|
2432 |
-
|
2433 |
-
'use strict';
|
2434 |
-
|
2435 |
-
Object.defineProperty(exports, "__esModule", {
|
2436 |
-
value: true
|
2437 |
-
});
|
2438 |
-
|
2439 |
-
var _HtmlParser = __webpack_require__(465);
|
2440 |
-
|
2441 |
-
var _HtmlParser2 = _interopRequireDefault(_HtmlParser);
|
2442 |
-
|
2443 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2444 |
-
|
2445 |
-
exports.default = _HtmlParser2.default;
|
2446 |
-
|
2447 |
-
/***/ },
|
2448 |
-
|
2449 |
-
/***/ 465:
|
2450 |
-
/***/ function(module, exports, __webpack_require__) {
|
2451 |
-
|
2452 |
-
'use strict';
|
2453 |
-
|
2454 |
-
Object.defineProperty(exports, "__esModule", {
|
2455 |
-
value: true
|
2456 |
-
});
|
2457 |
-
exports.default = HtmlParser;
|
2458 |
-
|
2459 |
-
var _htmlparser = __webpack_require__(466);
|
2460 |
-
|
2461 |
-
var _htmlparser2 = _interopRequireDefault(_htmlparser);
|
2462 |
-
|
2463 |
-
var _ProcessNodes = __webpack_require__(519);
|
2464 |
-
|
2465 |
-
var _ProcessNodes2 = _interopRequireDefault(_ProcessNodes);
|
2466 |
-
|
2467 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2468 |
-
|
2469 |
-
/**
|
2470 |
-
* Parses a HTML string and returns a list of React components generated from it
|
2471 |
-
*
|
2472 |
-
* @param {String} html The HTML to convert into React components
|
2473 |
-
* @returns {Array} List of top level React elements
|
2474 |
-
*/
|
2475 |
-
function HtmlParser(html) {
|
2476 |
-
var nodes = _htmlparser2.default.parseDOM(html);
|
2477 |
-
return (0, _ProcessNodes2.default)(nodes);
|
2478 |
-
}
|
2479 |
-
|
2480 |
-
/***/ },
|
2481 |
-
|
2482 |
-
/***/ 466:
|
2483 |
-
/***/ function(module, exports, __webpack_require__) {
|
2484 |
-
|
2485 |
-
var Parser = __webpack_require__(467),
|
2486 |
-
DomHandler = __webpack_require__(476);
|
2487 |
-
|
2488 |
-
function defineProp(name, value){
|
2489 |
-
delete module.exports[name];
|
2490 |
-
module.exports[name] = value;
|
2491 |
-
return value;
|
2492 |
-
}
|
2493 |
-
|
2494 |
-
module.exports = {
|
2495 |
-
Parser: Parser,
|
2496 |
-
Tokenizer: __webpack_require__(468),
|
2497 |
-
ElementType: __webpack_require__(477),
|
2498 |
-
DomHandler: DomHandler,
|
2499 |
-
get FeedHandler(){
|
2500 |
-
return defineProp("FeedHandler", __webpack_require__(480));
|
2501 |
-
},
|
2502 |
-
get Stream(){
|
2503 |
-
return defineProp("Stream", __webpack_require__(481));
|
2504 |
-
},
|
2505 |
-
get WritableStream(){
|
2506 |
-
return defineProp("WritableStream", __webpack_require__(482));
|
2507 |
-
},
|
2508 |
-
get ProxyHandler(){
|
2509 |
-
return defineProp("ProxyHandler", __webpack_require__(505));
|
2510 |
-
},
|
2511 |
-
get DomUtils(){
|
2512 |
-
return defineProp("DomUtils", __webpack_require__(506));
|
2513 |
-
},
|
2514 |
-
get CollectingHandler(){
|
2515 |
-
return defineProp("CollectingHandler", __webpack_require__(518));
|
2516 |
-
},
|
2517 |
-
// For legacy support
|
2518 |
-
DefaultHandler: DomHandler,
|
2519 |
-
get RssHandler(){
|
2520 |
-
return defineProp("RssHandler", this.FeedHandler);
|
2521 |
-
},
|
2522 |
-
//helper methods
|
2523 |
-
parseDOM: function(data, options){
|
2524 |
-
var handler = new DomHandler(options);
|
2525 |
-
new Parser(handler, options).end(data);
|
2526 |
-
return handler.dom;
|
2527 |
-
},
|
2528 |
-
parseFeed: function(feed, options){
|
2529 |
-
var handler = new module.exports.FeedHandler(options);
|
2530 |
-
new Parser(handler, options).end(feed);
|
2531 |
-
return handler.dom;
|
2532 |
-
},
|
2533 |
-
createDomStream: function(cb, options, elementCb){
|
2534 |
-
var handler = new DomHandler(cb, options, elementCb);
|
2535 |
-
return new Parser(handler, options);
|
2536 |
-
},
|
2537 |
-
// List of all events that the parser emits
|
2538 |
-
EVENTS: { /* Format: eventname: number of arguments */
|
2539 |
-
attribute: 2,
|
2540 |
-
cdatastart: 0,
|
2541 |
-
cdataend: 0,
|
2542 |
-
text: 1,
|
2543 |
-
processinginstruction: 2,
|
2544 |
-
comment: 1,
|
2545 |
-
commentend: 0,
|
2546 |
-
closetag: 1,
|
2547 |
-
opentag: 2,
|
2548 |
-
opentagname: 1,
|
2549 |
-
error: 1,
|
2550 |
-
end: 0
|
2551 |
-
}
|
2552 |
-
};
|
2553 |
-
|
2554 |
-
|
2555 |
-
/***/ },
|
2556 |
-
|
2557 |
-
/***/ 467:
|
2558 |
-
/***/ function(module, exports, __webpack_require__) {
|
2559 |
-
|
2560 |
-
var Tokenizer = __webpack_require__(468);
|
2561 |
-
|
2562 |
-
/*
|
2563 |
-
Options:
|
2564 |
-
|
2565 |
-
xmlMode: Disables the special behavior for script/style tags (false by default)
|
2566 |
-
lowerCaseAttributeNames: call .toLowerCase for each attribute name (true if xmlMode is `false`)
|
2567 |
-
lowerCaseTags: call .toLowerCase for each tag name (true if xmlMode is `false`)
|
2568 |
-
*/
|
2569 |
-
|
2570 |
-
/*
|
2571 |
-
Callbacks:
|
2572 |
-
|
2573 |
-
oncdataend,
|
2574 |
-
oncdatastart,
|
2575 |
-
onclosetag,
|
2576 |
-
oncomment,
|
2577 |
-
oncommentend,
|
2578 |
-
onerror,
|
2579 |
-
onopentag,
|
2580 |
-
onprocessinginstruction,
|
2581 |
-
onreset,
|
2582 |
-
ontext
|
2583 |
-
*/
|
2584 |
-
|
2585 |
-
var formTags = {
|
2586 |
-
input: true,
|
2587 |
-
option: true,
|
2588 |
-
optgroup: true,
|
2589 |
-
select: true,
|
2590 |
-
button: true,
|
2591 |
-
datalist: true,
|
2592 |
-
textarea: true
|
2593 |
-
};
|
2594 |
-
|
2595 |
-
var openImpliesClose = {
|
2596 |
-
tr : { tr:true, th:true, td:true },
|
2597 |
-
th : { th:true },
|
2598 |
-
td : { thead:true, th:true, td:true },
|
2599 |
-
body : { head:true, link:true, script:true },
|
2600 |
-
li : { li:true },
|
2601 |
-
p : { p:true },
|
2602 |
-
h1 : { p:true },
|
2603 |
-
h2 : { p:true },
|
2604 |
-
h3 : { p:true },
|
2605 |
-
h4 : { p:true },
|
2606 |
-
h5 : { p:true },
|
2607 |
-
h6 : { p:true },
|
2608 |
-
select : formTags,
|
2609 |
-
input : formTags,
|
2610 |
-
output : formTags,
|
2611 |
-
button : formTags,
|
2612 |
-
datalist: formTags,
|
2613 |
-
textarea: formTags,
|
2614 |
-
option : { option:true },
|
2615 |
-
optgroup: { optgroup:true }
|
2616 |
-
};
|
2617 |
-
|
2618 |
-
var voidElements = {
|
2619 |
-
__proto__: null,
|
2620 |
-
area: true,
|
2621 |
-
base: true,
|
2622 |
-
basefont: true,
|
2623 |
-
br: true,
|
2624 |
-
col: true,
|
2625 |
-
command: true,
|
2626 |
-
embed: true,
|
2627 |
-
frame: true,
|
2628 |
-
hr: true,
|
2629 |
-
img: true,
|
2630 |
-
input: true,
|
2631 |
-
isindex: true,
|
2632 |
-
keygen: true,
|
2633 |
-
link: true,
|
2634 |
-
meta: true,
|
2635 |
-
param: true,
|
2636 |
-
source: true,
|
2637 |
-
track: true,
|
2638 |
-
wbr: true,
|
2639 |
-
|
2640 |
-
//common self closing svg elements
|
2641 |
-
path: true,
|
2642 |
-
circle: true,
|
2643 |
-
ellipse: true,
|
2644 |
-
line: true,
|
2645 |
-
rect: true,
|
2646 |
-
use: true,
|
2647 |
-
stop: true,
|
2648 |
-
polyline: true,
|
2649 |
-
polygon: true
|
2650 |
-
};
|
2651 |
-
|
2652 |
-
var re_nameEnd = /\s|\//;
|
2653 |
-
|
2654 |
-
function Parser(cbs, options){
|
2655 |
-
this._options = options || {};
|
2656 |
-
this._cbs = cbs || {};
|
2657 |
-
|
2658 |
-
this._tagname = "";
|
2659 |
-
this._attribname = "";
|
2660 |
-
this._attribvalue = "";
|
2661 |
-
this._attribs = null;
|
2662 |
-
this._stack = [];
|
2663 |
-
|
2664 |
-
this.startIndex = 0;
|
2665 |
-
this.endIndex = null;
|
2666 |
-
|
2667 |
-
this._lowerCaseTagNames = "lowerCaseTags" in this._options ?
|
2668 |
-
!!this._options.lowerCaseTags :
|
2669 |
-
!this._options.xmlMode;
|
2670 |
-
this._lowerCaseAttributeNames = "lowerCaseAttributeNames" in this._options ?
|
2671 |
-
!!this._options.lowerCaseAttributeNames :
|
2672 |
-
!this._options.xmlMode;
|
2673 |
-
|
2674 |
-
if(this._options.Tokenizer) {
|
2675 |
-
Tokenizer = this._options.Tokenizer;
|
2676 |
-
}
|
2677 |
-
this._tokenizer = new Tokenizer(this._options, this);
|
2678 |
-
|
2679 |
-
if(this._cbs.onparserinit) this._cbs.onparserinit(this);
|
2680 |
-
}
|
2681 |
-
|
2682 |
-
__webpack_require__(474)(Parser, __webpack_require__(475).EventEmitter);
|
2683 |
-
|
2684 |
-
Parser.prototype._updatePosition = function(initialOffset){
|
2685 |
-
if(this.endIndex === null){
|
2686 |
-
if(this._tokenizer._sectionStart <= initialOffset){
|
2687 |
-
this.startIndex = 0;
|
2688 |
-
} else {
|
2689 |
-
this.startIndex = this._tokenizer._sectionStart - initialOffset;
|
2690 |
-
}
|
2691 |
-
}
|
2692 |
-
else this.startIndex = this.endIndex + 1;
|
2693 |
-
this.endIndex = this._tokenizer.getAbsoluteIndex();
|
2694 |
-
};
|
2695 |
-
|
2696 |
-
//Tokenizer event handlers
|
2697 |
-
Parser.prototype.ontext = function(data){
|
2698 |
-
this._updatePosition(1);
|
2699 |
-
this.endIndex--;
|
2700 |
-
|
2701 |
-
if(this._cbs.ontext) this._cbs.ontext(data);
|
2702 |
-
};
|
2703 |
-
|
2704 |
-
Parser.prototype.onopentagname = function(name){
|
2705 |
-
if(this._lowerCaseTagNames){
|
2706 |
-
name = name.toLowerCase();
|
2707 |
-
}
|
2708 |
-
|
2709 |
-
this._tagname = name;
|
2710 |
-
|
2711 |
-
if(!this._options.xmlMode && name in openImpliesClose) {
|
2712 |
-
for(
|
2713 |
-
var el;
|
2714 |
-
(el = this._stack[this._stack.length - 1]) in openImpliesClose[name];
|
2715 |
-
this.onclosetag(el)
|
2716 |
-
);
|
2717 |
-
}
|
2718 |
-
|
2719 |
-
if(this._options.xmlMode || !(name in voidElements)){
|
2720 |
-
this._stack.push(name);
|
2721 |
-
}
|
2722 |
-
|
2723 |
-
if(this._cbs.onopentagname) this._cbs.onopentagname(name);
|
2724 |
-
if(this._cbs.onopentag) this._attribs = {};
|
2725 |
-
};
|
2726 |
-
|
2727 |
-
Parser.prototype.onopentagend = function(){
|
2728 |
-
this._updatePosition(1);
|
2729 |
-
|
2730 |
-
if(this._attribs){
|
2731 |
-
if(this._cbs.onopentag) this._cbs.onopentag(this._tagname, this._attribs);
|
2732 |
-
this._attribs = null;
|
2733 |
-
}
|
2734 |
-
|
2735 |
-
if(!this._options.xmlMode && this._cbs.onclosetag && this._tagname in voidElements){
|
2736 |
-
this._cbs.onclosetag(this._tagname);
|
2737 |
-
}
|
2738 |
-
|
2739 |
-
this._tagname = "";
|
2740 |
-
};
|
2741 |
-
|
2742 |
-
Parser.prototype.onclosetag = function(name){
|
2743 |
-
this._updatePosition(1);
|
2744 |
-
|
2745 |
-
if(this._lowerCaseTagNames){
|
2746 |
-
name = name.toLowerCase();
|
2747 |
-
}
|
2748 |
-
|
2749 |
-
if(this._stack.length && (!(name in voidElements) || this._options.xmlMode)){
|
2750 |
-
var pos = this._stack.lastIndexOf(name);
|
2751 |
-
if(pos !== -1){
|
2752 |
-
if(this._cbs.onclosetag){
|
2753 |
-
pos = this._stack.length - pos;
|
2754 |
-
while(pos--) this._cbs.onclosetag(this._stack.pop());
|
2755 |
-
}
|
2756 |
-
else this._stack.length = pos;
|
2757 |
-
} else if(name === "p" && !this._options.xmlMode){
|
2758 |
-
this.onopentagname(name);
|
2759 |
-
this._closeCurrentTag();
|
2760 |
-
}
|
2761 |
-
} else if(!this._options.xmlMode && (name === "br" || name === "p")){
|
2762 |
-
this.onopentagname(name);
|
2763 |
-
this._closeCurrentTag();
|
2764 |
-
}
|
2765 |
-
};
|
2766 |
-
|
2767 |
-
Parser.prototype.onselfclosingtag = function(){
|
2768 |
-
if(this._options.xmlMode || this._options.recognizeSelfClosing){
|
2769 |
-
this._closeCurrentTag();
|
2770 |
-
} else {
|
2771 |
-
this.onopentagend();
|
2772 |
-
}
|
2773 |
-
};
|
2774 |
-
|
2775 |
-
Parser.prototype._closeCurrentTag = function(){
|
2776 |
-
var name = this._tagname;
|
2777 |
-
|
2778 |
-
this.onopentagend();
|
2779 |
-
|
2780 |
-
//self-closing tags will be on the top of the stack
|
2781 |
-
//(cheaper check than in onclosetag)
|
2782 |
-
if(this._stack[this._stack.length - 1] === name){
|
2783 |
-
if(this._cbs.onclosetag){
|
2784 |
-
this._cbs.onclosetag(name);
|
2785 |
-
}
|
2786 |
-
this._stack.pop();
|
2787 |
-
}
|
2788 |
-
};
|
2789 |
-
|
2790 |
-
Parser.prototype.onattribname = function(name){
|
2791 |
-
if(this._lowerCaseAttributeNames){
|
2792 |
-
name = name.toLowerCase();
|
2793 |
-
}
|
2794 |
-
this._attribname = name;
|
2795 |
-
};
|
2796 |
-
|
2797 |
-
Parser.prototype.onattribdata = function(value){
|
2798 |
-
this._attribvalue += value;
|
2799 |
-
};
|
2800 |
-
|
2801 |
-
Parser.prototype.onattribend = function(){
|
2802 |
-
if(this._cbs.onattribute) this._cbs.onattribute(this._attribname, this._attribvalue);
|
2803 |
-
if(
|
2804 |
-
this._attribs &&
|
2805 |
-
!Object.prototype.hasOwnProperty.call(this._attribs, this._attribname)
|
2806 |
-
){
|
2807 |
-
this._attribs[this._attribname] = this._attribvalue;
|
2808 |
-
}
|
2809 |
-
this._attribname = "";
|
2810 |
-
this._attribvalue = "";
|
2811 |
-
};
|
2812 |
-
|
2813 |
-
Parser.prototype._getInstructionName = function(value){
|
2814 |
-
var idx = value.search(re_nameEnd),
|
2815 |
-
name = idx < 0 ? value : value.substr(0, idx);
|
2816 |
-
|
2817 |
-
if(this._lowerCaseTagNames){
|
2818 |
-
name = name.toLowerCase();
|
2819 |
-
}
|
2820 |
-
|
2821 |
-
return name;
|
2822 |
-
};
|
2823 |
-
|
2824 |
-
Parser.prototype.ondeclaration = function(value){
|
2825 |
-
if(this._cbs.onprocessinginstruction){
|
2826 |
-
var name = this._getInstructionName(value);
|
2827 |
-
this._cbs.onprocessinginstruction("!" + name, "!" + value);
|
2828 |
-
}
|
2829 |
-
};
|
2830 |
-
|
2831 |
-
Parser.prototype.onprocessinginstruction = function(value){
|
2832 |
-
if(this._cbs.onprocessinginstruction){
|
2833 |
-
var name = this._getInstructionName(value);
|
2834 |
-
this._cbs.onprocessinginstruction("?" + name, "?" + value);
|
2835 |
-
}
|
2836 |
-
};
|
2837 |
-
|
2838 |
-
Parser.prototype.oncomment = function(value){
|
2839 |
-
this._updatePosition(4);
|
2840 |
-
|
2841 |
-
if(this._cbs.oncomment) this._cbs.oncomment(value);
|
2842 |
-
if(this._cbs.oncommentend) this._cbs.oncommentend();
|
2843 |
-
};
|
2844 |
-
|
2845 |
-
Parser.prototype.oncdata = function(value){
|
2846 |
-
this._updatePosition(1);
|
2847 |
-
|
2848 |
-
if(this._options.xmlMode || this._options.recognizeCDATA){
|
2849 |
-
if(this._cbs.oncdatastart) this._cbs.oncdatastart();
|
2850 |
-
if(this._cbs.ontext) this._cbs.ontext(value);
|
2851 |
-
if(this._cbs.oncdataend) this._cbs.oncdataend();
|
2852 |
-
} else {
|
2853 |
-
this.oncomment("[CDATA[" + value + "]]");
|
2854 |
-
}
|
2855 |
-
};
|
2856 |
-
|
2857 |
-
Parser.prototype.onerror = function(err){
|
2858 |
-
if(this._cbs.onerror) this._cbs.onerror(err);
|
2859 |
-
};
|
2860 |
-
|
2861 |
-
Parser.prototype.onend = function(){
|
2862 |
-
if(this._cbs.onclosetag){
|
2863 |
-
for(
|
2864 |
-
var i = this._stack.length;
|
2865 |
-
i > 0;
|
2866 |
-
this._cbs.onclosetag(this._stack[--i])
|
2867 |
-
);
|
2868 |
-
}
|
2869 |
-
if(this._cbs.onend) this._cbs.onend();
|
2870 |
-
};
|
2871 |
-
|
2872 |
-
|
2873 |
-
//Resets the parser to a blank state, ready to parse a new HTML document
|
2874 |
-
Parser.prototype.reset = function(){
|
2875 |
-
if(this._cbs.onreset) this._cbs.onreset();
|
2876 |
-
this._tokenizer.reset();
|
2877 |
-
|
2878 |
-
this._tagname = "";
|
2879 |
-
this._attribname = "";
|
2880 |
-
this._attribs = null;
|
2881 |
-
this._stack = [];
|
2882 |
-
|
2883 |
-
if(this._cbs.onparserinit) this._cbs.onparserinit(this);
|
2884 |
-
};
|
2885 |
-
|
2886 |
-
//Parses a complete HTML document and pushes it to the handler
|
2887 |
-
Parser.prototype.parseComplete = function(data){
|
2888 |
-
this.reset();
|
2889 |
-
this.end(data);
|
2890 |
-
};
|
2891 |
-
|
2892 |
-
Parser.prototype.write = function(chunk){
|
2893 |
-
this._tokenizer.write(chunk);
|
2894 |
-
};
|
2895 |
-
|
2896 |
-
Parser.prototype.end = function(chunk){
|
2897 |
-
this._tokenizer.end(chunk);
|
2898 |
-
};
|
2899 |
-
|
2900 |
-
Parser.prototype.pause = function(){
|
2901 |
-
this._tokenizer.pause();
|
2902 |
-
};
|
2903 |
-
|
2904 |
-
Parser.prototype.resume = function(){
|
2905 |
-
this._tokenizer.resume();
|
2906 |
-
};
|
2907 |
-
|
2908 |
-
//alias for backwards compat
|
2909 |
-
Parser.prototype.parseChunk = Parser.prototype.write;
|
2910 |
-
Parser.prototype.done = Parser.prototype.end;
|
2911 |
-
|
2912 |
-
module.exports = Parser;
|
2913 |
-
|
2914 |
-
|
2915 |
-
/***/ },
|
2916 |
-
|
2917 |
-
/***/ 468:
|
2918 |
-
/***/ function(module, exports, __webpack_require__) {
|
2919 |
-
|
2920 |
-
module.exports = Tokenizer;
|
2921 |
-
|
2922 |
-
var decodeCodePoint = __webpack_require__(469),
|
2923 |
-
entityMap = __webpack_require__(471),
|
2924 |
-
legacyMap = __webpack_require__(472),
|
2925 |
-
xmlMap = __webpack_require__(473),
|
2926 |
-
|
2927 |
-
i = 0,
|
2928 |
-
|
2929 |
-
TEXT = i++,
|
2930 |
-
BEFORE_TAG_NAME = i++, //after <
|
2931 |
-
IN_TAG_NAME = i++,
|
2932 |
-
IN_SELF_CLOSING_TAG = i++,
|
2933 |
-
BEFORE_CLOSING_TAG_NAME = i++,
|
2934 |
-
IN_CLOSING_TAG_NAME = i++,
|
2935 |
-
AFTER_CLOSING_TAG_NAME = i++,
|
2936 |
-
|
2937 |
-
//attributes
|
2938 |
-
BEFORE_ATTRIBUTE_NAME = i++,
|
2939 |
-
IN_ATTRIBUTE_NAME = i++,
|
2940 |
-
AFTER_ATTRIBUTE_NAME = i++,
|
2941 |
-
BEFORE_ATTRIBUTE_VALUE = i++,
|
2942 |
-
IN_ATTRIBUTE_VALUE_DQ = i++, // "
|
2943 |
-
IN_ATTRIBUTE_VALUE_SQ = i++, // '
|
2944 |
-
IN_ATTRIBUTE_VALUE_NQ = i++,
|
2945 |
-
|
2946 |
-
//declarations
|
2947 |
-
BEFORE_DECLARATION = i++, // !
|
2948 |
-
IN_DECLARATION = i++,
|
2949 |
-
|
2950 |
-
//processing instructions
|
2951 |
-
IN_PROCESSING_INSTRUCTION = i++, // ?
|
2952 |
-
|
2953 |
-
//comments
|
2954 |
-
BEFORE_COMMENT = i++,
|
2955 |
-
IN_COMMENT = i++,
|
2956 |
-
AFTER_COMMENT_1 = i++,
|
2957 |
-
AFTER_COMMENT_2 = i++,
|
2958 |
-
|
2959 |
-
//cdata
|
2960 |
-
BEFORE_CDATA_1 = i++, // [
|
2961 |
-
BEFORE_CDATA_2 = i++, // C
|
2962 |
-
BEFORE_CDATA_3 = i++, // D
|
2963 |
-
BEFORE_CDATA_4 = i++, // A
|
2964 |
-
BEFORE_CDATA_5 = i++, // T
|
2965 |
-
BEFORE_CDATA_6 = i++, // A
|
2966 |
-
IN_CDATA = i++, // [
|
2967 |
-
AFTER_CDATA_1 = i++, // ]
|
2968 |
-
AFTER_CDATA_2 = i++, // ]
|
2969 |
-
|
2970 |
-
//special tags
|
2971 |
-
BEFORE_SPECIAL = i++, //S
|
2972 |
-
BEFORE_SPECIAL_END = i++, //S
|
2973 |
-
|
2974 |
-
BEFORE_SCRIPT_1 = i++, //C
|
2975 |
-
BEFORE_SCRIPT_2 = i++, //R
|
2976 |
-
BEFORE_SCRIPT_3 = i++, //I
|
2977 |
-
BEFORE_SCRIPT_4 = i++, //P
|
2978 |
-
BEFORE_SCRIPT_5 = i++, //T
|
2979 |
-
AFTER_SCRIPT_1 = i++, //C
|
2980 |
-
AFTER_SCRIPT_2 = i++, //R
|
2981 |
-
AFTER_SCRIPT_3 = i++, //I
|
2982 |
-
AFTER_SCRIPT_4 = i++, //P
|
2983 |
-
AFTER_SCRIPT_5 = i++, //T
|
2984 |
-
|
2985 |
-
BEFORE_STYLE_1 = i++, //T
|
2986 |
-
BEFORE_STYLE_2 = i++, //Y
|
2987 |
-
BEFORE_STYLE_3 = i++, //L
|
2988 |
-
BEFORE_STYLE_4 = i++, //E
|
2989 |
-
AFTER_STYLE_1 = i++, //T
|
2990 |
-
AFTER_STYLE_2 = i++, //Y
|
2991 |
-
AFTER_STYLE_3 = i++, //L
|
2992 |
-
AFTER_STYLE_4 = i++, //E
|
2993 |
-
|
2994 |
-
BEFORE_ENTITY = i++, //&
|
2995 |
-
BEFORE_NUMERIC_ENTITY = i++, //#
|
2996 |
-
IN_NAMED_ENTITY = i++,
|
2997 |
-
IN_NUMERIC_ENTITY = i++,
|
2998 |
-
IN_HEX_ENTITY = i++, //X
|
2999 |
-
|
3000 |
-
j = 0,
|
3001 |
-
|
3002 |
-
SPECIAL_NONE = j++,
|
3003 |
-
SPECIAL_SCRIPT = j++,
|
3004 |
-
SPECIAL_STYLE = j++;
|
3005 |
-
|
3006 |
-
function whitespace(c){
|
3007 |
-
return c === " " || c === "\n" || c === "\t" || c === "\f" || c === "\r";
|
3008 |
-
}
|
3009 |
-
|
3010 |
-
function characterState(char, SUCCESS){
|
3011 |
-
return function(c){
|
3012 |
-
if(c === char) this._state = SUCCESS;
|
3013 |
-
};
|
3014 |
-
}
|
3015 |
-
|
3016 |
-
function ifElseState(upper, SUCCESS, FAILURE){
|
3017 |
-
var lower = upper.toLowerCase();
|
3018 |
-
|
3019 |
-
if(upper === lower){
|
3020 |
-
return function(c){
|
3021 |
-
if(c === lower){
|
3022 |
-
this._state = SUCCESS;
|
3023 |
-
} else {
|
3024 |
-
this._state = FAILURE;
|
3025 |
-
this._index--;
|
3026 |
-
}
|
3027 |
-
};
|
3028 |
-
} else {
|
3029 |
-
return function(c){
|
3030 |
-
if(c === lower || c === upper){
|
3031 |
-
this._state = SUCCESS;
|
3032 |
-
} else {
|
3033 |
-
this._state = FAILURE;
|
3034 |
-
this._index--;
|
3035 |
-
}
|
3036 |
-
};
|
3037 |
-
}
|
3038 |
-
}
|
3039 |
-
|
3040 |
-
function consumeSpecialNameChar(upper, NEXT_STATE){
|
3041 |
-
var lower = upper.toLowerCase();
|
3042 |
-
|
3043 |
-
return function(c){
|
3044 |
-
if(c === lower || c === upper){
|
3045 |
-
this._state = NEXT_STATE;
|
3046 |
-
} else {
|
3047 |
-
this._state = IN_TAG_NAME;
|
3048 |
-
this._index--; //consume the token again
|
3049 |
-
}
|
3050 |
-
};
|
3051 |
-
}
|
3052 |
-
|
3053 |
-
function Tokenizer(options, cbs){
|
3054 |
-
this._state = TEXT;
|
3055 |
-
this._buffer = "";
|
3056 |
-
this._sectionStart = 0;
|
3057 |
-
this._index = 0;
|
3058 |
-
this._bufferOffset = 0; //chars removed from _buffer
|
3059 |
-
this._baseState = TEXT;
|
3060 |
-
this._special = SPECIAL_NONE;
|
3061 |
-
this._cbs = cbs;
|
3062 |
-
this._running = true;
|
3063 |
-
this._ended = false;
|
3064 |
-
this._xmlMode = !!(options && options.xmlMode);
|
3065 |
-
this._decodeEntities = !!(options && options.decodeEntities);
|
3066 |
-
}
|
3067 |
-
|
3068 |
-
Tokenizer.prototype._stateText = function(c){
|
3069 |
-
if(c === "<"){
|
3070 |
-
if(this._index > this._sectionStart){
|
3071 |
-
this._cbs.ontext(this._getSection());
|
3072 |
-
}
|
3073 |
-
this._state = BEFORE_TAG_NAME;
|
3074 |
-
this._sectionStart = this._index;
|
3075 |
-
} else if(this._decodeEntities && this._special === SPECIAL_NONE && c === "&"){
|
3076 |
-
if(this._index > this._sectionStart){
|
3077 |
-
this._cbs.ontext(this._getSection());
|
3078 |
-
}
|
3079 |
-
this._baseState = TEXT;
|
3080 |
-
this._state = BEFORE_ENTITY;
|
3081 |
-
this._sectionStart = this._index;
|
3082 |
-
}
|
3083 |
-
};
|
3084 |
-
|
3085 |
-
Tokenizer.prototype._stateBeforeTagName = function(c){
|
3086 |
-
if(c === "/"){
|
3087 |
-
this._state = BEFORE_CLOSING_TAG_NAME;
|
3088 |
-
} else if(c === "<"){
|
3089 |
-
this._cbs.ontext(this._getSection());
|
3090 |
-
this._sectionStart = this._index;
|
3091 |
-
} else if(c === ">" || this._special !== SPECIAL_NONE || whitespace(c)) {
|
3092 |
-
this._state = TEXT;
|
3093 |
-
} else if(c === "!"){
|
3094 |
-
this._state = BEFORE_DECLARATION;
|
3095 |
-
this._sectionStart = this._index + 1;
|
3096 |
-
} else if(c === "?"){
|
3097 |
-
this._state = IN_PROCESSING_INSTRUCTION;
|
3098 |
-
this._sectionStart = this._index + 1;
|
3099 |
-
} else {
|
3100 |
-
this._state = (!this._xmlMode && (c === "s" || c === "S")) ?
|
3101 |
-
BEFORE_SPECIAL : IN_TAG_NAME;
|
3102 |
-
this._sectionStart = this._index;
|
3103 |
-
}
|
3104 |
-
};
|
3105 |
-
|
3106 |
-
Tokenizer.prototype._stateInTagName = function(c){
|
3107 |
-
if(c === "/" || c === ">" || whitespace(c)){
|
3108 |
-
this._emitToken("onopentagname");
|
3109 |
-
this._state = BEFORE_ATTRIBUTE_NAME;
|
3110 |
-
this._index--;
|
3111 |
-
}
|
3112 |
-
};
|
3113 |
-
|
3114 |
-
Tokenizer.prototype._stateBeforeCloseingTagName = function(c){
|
3115 |
-
if(whitespace(c));
|
3116 |
-
else if(c === ">"){
|
3117 |
-
this._state = TEXT;
|
3118 |
-
} else if(this._special !== SPECIAL_NONE){
|
3119 |
-
if(c === "s" || c === "S"){
|
3120 |
-
this._state = BEFORE_SPECIAL_END;
|
3121 |
-
} else {
|
3122 |
-
this._state = TEXT;
|
3123 |
-
this._index--;
|
3124 |
-
}
|
3125 |
-
} else {
|
3126 |
-
this._state = IN_CLOSING_TAG_NAME;
|
3127 |
-
this._sectionStart = this._index;
|
3128 |
-
}
|
3129 |
-
};
|
3130 |
-
|
3131 |
-
Tokenizer.prototype._stateInCloseingTagName = function(c){
|
3132 |
-
if(c === ">" || whitespace(c)){
|
3133 |
-
this._emitToken("onclosetag");
|
3134 |
-
this._state = AFTER_CLOSING_TAG_NAME;
|
3135 |
-
this._index--;
|
3136 |
-
}
|
3137 |
-
};
|
3138 |
-
|
3139 |
-
Tokenizer.prototype._stateAfterCloseingTagName = function(c){
|
3140 |
-
//skip everything until ">"
|
3141 |
-
if(c === ">"){
|
3142 |
-
this._state = TEXT;
|
3143 |
-
this._sectionStart = this._index + 1;
|
3144 |
-
}
|
3145 |
-
};
|
3146 |
-
|
3147 |
-
Tokenizer.prototype._stateBeforeAttributeName = function(c){
|
3148 |
-
if(c === ">"){
|
3149 |
-
this._cbs.onopentagend();
|
3150 |
-
this._state = TEXT;
|
3151 |
-
this._sectionStart = this._index + 1;
|
3152 |
-
} else if(c === "/"){
|
3153 |
-
this._state = IN_SELF_CLOSING_TAG;
|
3154 |
-
} else if(!whitespace(c)){
|
3155 |
-
this._state = IN_ATTRIBUTE_NAME;
|
3156 |
-
this._sectionStart = this._index;
|
3157 |
-
}
|
3158 |
-
};
|
3159 |
-
|
3160 |
-
Tokenizer.prototype._stateInSelfClosingTag = function(c){
|
3161 |
-
if(c === ">"){
|
3162 |
-
this._cbs.onselfclosingtag();
|
3163 |
-
this._state = TEXT;
|
3164 |
-
this._sectionStart = this._index + 1;
|
3165 |
-
} else if(!whitespace(c)){
|
3166 |
-
this._state = BEFORE_ATTRIBUTE_NAME;
|
3167 |
-
this._index--;
|
3168 |
-
}
|
3169 |
-
};
|
3170 |
-
|
3171 |
-
Tokenizer.prototype._stateInAttributeName = function(c){
|
3172 |
-
if(c === "=" || c === "/" || c === ">" || whitespace(c)){
|
3173 |
-
this._cbs.onattribname(this._getSection());
|
3174 |
-
this._sectionStart = -1;
|
3175 |
-
this._state = AFTER_ATTRIBUTE_NAME;
|
3176 |
-
this._index--;
|
3177 |
-
}
|
3178 |
-
};
|
3179 |
-
|
3180 |
-
Tokenizer.prototype._stateAfterAttributeName = function(c){
|
3181 |
-
if(c === "="){
|
3182 |
-
this._state = BEFORE_ATTRIBUTE_VALUE;
|
3183 |
-
} else if(c === "/" || c === ">"){
|
3184 |
-
this._cbs.onattribend();
|
3185 |
-
this._state = BEFORE_ATTRIBUTE_NAME;
|
3186 |
-
this._index--;
|
3187 |
-
} else if(!whitespace(c)){
|
3188 |
-
this._cbs.onattribend();
|
3189 |
-
this._state = IN_ATTRIBUTE_NAME;
|
3190 |
-
this._sectionStart = this._index;
|
3191 |
-
}
|
3192 |
-
};
|
3193 |
-
|
3194 |
-
Tokenizer.prototype._stateBeforeAttributeValue = function(c){
|
3195 |
-
if(c === "\""){
|
3196 |
-
this._state = IN_ATTRIBUTE_VALUE_DQ;
|
3197 |
-
this._sectionStart = this._index + 1;
|
3198 |
-
} else if(c === "'"){
|
3199 |
-
this._state = IN_ATTRIBUTE_VALUE_SQ;
|
3200 |
-
this._sectionStart = this._index + 1;
|
3201 |
-
} else if(!whitespace(c)){
|
3202 |
-
this._state = IN_ATTRIBUTE_VALUE_NQ;
|
3203 |
-
this._sectionStart = this._index;
|
3204 |
-
this._index--; //reconsume token
|
3205 |
-
}
|
3206 |
-
};
|
3207 |
-
|
3208 |
-
Tokenizer.prototype._stateInAttributeValueDoubleQuotes = function(c){
|
3209 |
-
if(c === "\""){
|
3210 |
-
this._emitToken("onattribdata");
|
3211 |
-
this._cbs.onattribend();
|
3212 |
-
this._state = BEFORE_ATTRIBUTE_NAME;
|
3213 |
-
} else if(this._decodeEntities && c === "&"){
|
3214 |
-
this._emitToken("onattribdata");
|
3215 |
-
this._baseState = this._state;
|
3216 |
-
this._state = BEFORE_ENTITY;
|
3217 |
-
this._sectionStart = this._index;
|
3218 |
-
}
|
3219 |
-
};
|
3220 |
-
|
3221 |
-
Tokenizer.prototype._stateInAttributeValueSingleQuotes = function(c){
|
3222 |
-
if(c === "'"){
|
3223 |
-
this._emitToken("onattribdata");
|
3224 |
-
this._cbs.onattribend();
|
3225 |
-
this._state = BEFORE_ATTRIBUTE_NAME;
|
3226 |
-
} else if(this._decodeEntities && c === "&"){
|
3227 |
-
this._emitToken("onattribdata");
|
3228 |
-
this._baseState = this._state;
|
3229 |
-
this._state = BEFORE_ENTITY;
|
3230 |
-
this._sectionStart = this._index;
|
3231 |
-
}
|
3232 |
-
};
|
3233 |
-
|
3234 |
-
Tokenizer.prototype._stateInAttributeValueNoQuotes = function(c){
|
3235 |
-
if(whitespace(c) || c === ">"){
|
3236 |
-
this._emitToken("onattribdata");
|
3237 |
-
this._cbs.onattribend();
|
3238 |
-
this._state = BEFORE_ATTRIBUTE_NAME;
|
3239 |
-
this._index--;
|
3240 |
-
} else if(this._decodeEntities && c === "&"){
|
3241 |
-
this._emitToken("onattribdata");
|
3242 |
-
this._baseState = this._state;
|
3243 |
-
this._state = BEFORE_ENTITY;
|
3244 |
-
this._sectionStart = this._index;
|
3245 |
-
}
|
3246 |
-
};
|
3247 |
-
|
3248 |
-
Tokenizer.prototype._stateBeforeDeclaration = function(c){
|
3249 |
-
this._state = c === "[" ? BEFORE_CDATA_1 :
|
3250 |
-
c === "-" ? BEFORE_COMMENT :
|
3251 |
-
IN_DECLARATION;
|
3252 |
-
};
|
3253 |
-
|
3254 |
-
Tokenizer.prototype._stateInDeclaration = function(c){
|
3255 |
-
if(c === ">"){
|
3256 |
-
this._cbs.ondeclaration(this._getSection());
|
3257 |
-
this._state = TEXT;
|
3258 |
-
this._sectionStart = this._index + 1;
|
3259 |
-
}
|
3260 |
-
};
|
3261 |
-
|
3262 |
-
Tokenizer.prototype._stateInProcessingInstruction = function(c){
|
3263 |
-
if(c === ">"){
|
3264 |
-
this._cbs.onprocessinginstruction(this._getSection());
|
3265 |
-
this._state = TEXT;
|
3266 |
-
this._sectionStart = this._index + 1;
|
3267 |
-
}
|
3268 |
-
};
|
3269 |
-
|
3270 |
-
Tokenizer.prototype._stateBeforeComment = function(c){
|
3271 |
-
if(c === "-"){
|
3272 |
-
this._state = IN_COMMENT;
|
3273 |
-
this._sectionStart = this._index + 1;
|
3274 |
-
} else {
|
3275 |
-
this._state = IN_DECLARATION;
|
3276 |
-
}
|
3277 |
-
};
|
3278 |
-
|
3279 |
-
Tokenizer.prototype._stateInComment = function(c){
|
3280 |
-
if(c === "-") this._state = AFTER_COMMENT_1;
|
3281 |
-
};
|
3282 |
-
|
3283 |
-
Tokenizer.prototype._stateAfterComment1 = function(c){
|
3284 |
-
if(c === "-"){
|
3285 |
-
this._state = AFTER_COMMENT_2;
|
3286 |
-
} else {
|
3287 |
-
this._state = IN_COMMENT;
|
3288 |
-
}
|
3289 |
-
};
|
3290 |
-
|
3291 |
-
Tokenizer.prototype._stateAfterComment2 = function(c){
|
3292 |
-
if(c === ">"){
|
3293 |
-
//remove 2 trailing chars
|
3294 |
-
this._cbs.oncomment(this._buffer.substring(this._sectionStart, this._index - 2));
|
3295 |
-
this._state = TEXT;
|
3296 |
-
this._sectionStart = this._index + 1;
|
3297 |
-
} else if(c !== "-"){
|
3298 |
-
this._state = IN_COMMENT;
|
3299 |
-
}
|
3300 |
-
// else: stay in AFTER_COMMENT_2 (`--->`)
|
3301 |
-
};
|
3302 |
-
|
3303 |
-
Tokenizer.prototype._stateBeforeCdata1 = ifElseState("C", BEFORE_CDATA_2, IN_DECLARATION);
|
3304 |
-
Tokenizer.prototype._stateBeforeCdata2 = ifElseState("D", BEFORE_CDATA_3, IN_DECLARATION);
|
3305 |
-
Tokenizer.prototype._stateBeforeCdata3 = ifElseState("A", BEFORE_CDATA_4, IN_DECLARATION);
|
3306 |
-
Tokenizer.prototype._stateBeforeCdata4 = ifElseState("T", BEFORE_CDATA_5, IN_DECLARATION);
|
3307 |
-
Tokenizer.prototype._stateBeforeCdata5 = ifElseState("A", BEFORE_CDATA_6, IN_DECLARATION);
|
3308 |
-
|
3309 |
-
Tokenizer.prototype._stateBeforeCdata6 = function(c){
|
3310 |
-
if(c === "["){
|
3311 |
-
this._state = IN_CDATA;
|
3312 |
-
this._sectionStart = this._index + 1;
|
3313 |
-
} else {
|
3314 |
-
this._state = IN_DECLARATION;
|
3315 |
-
this._index--;
|
3316 |
-
}
|
3317 |
-
};
|
3318 |
-
|
3319 |
-
Tokenizer.prototype._stateInCdata = function(c){
|
3320 |
-
if(c === "]") this._state = AFTER_CDATA_1;
|
3321 |
-
};
|
3322 |
-
|
3323 |
-
Tokenizer.prototype._stateAfterCdata1 = characterState("]", AFTER_CDATA_2);
|
3324 |
-
|
3325 |
-
Tokenizer.prototype._stateAfterCdata2 = function(c){
|
3326 |
-
if(c === ">"){
|
3327 |
-
//remove 2 trailing chars
|
3328 |
-
this._cbs.oncdata(this._buffer.substring(this._sectionStart, this._index - 2));
|
3329 |
-
this._state = TEXT;
|
3330 |
-
this._sectionStart = this._index + 1;
|
3331 |
-
} else if(c !== "]") {
|
3332 |
-
this._state = IN_CDATA;
|
3333 |
-
}
|
3334 |
-
//else: stay in AFTER_CDATA_2 (`]]]>`)
|
3335 |
-
};
|
3336 |
-
|
3337 |
-
Tokenizer.prototype._stateBeforeSpecial = function(c){
|
3338 |
-
if(c === "c" || c === "C"){
|
3339 |
-
this._state = BEFORE_SCRIPT_1;
|
3340 |
-
} else if(c === "t" || c === "T"){
|
3341 |
-
this._state = BEFORE_STYLE_1;
|
3342 |
-
} else {
|
3343 |
-
this._state = IN_TAG_NAME;
|
3344 |
-
this._index--; //consume the token again
|
3345 |
-
}
|
3346 |
-
};
|
3347 |
-
|
3348 |
-
Tokenizer.prototype._stateBeforeSpecialEnd = function(c){
|
3349 |
-
if(this._special === SPECIAL_SCRIPT && (c === "c" || c === "C")){
|
3350 |
-
this._state = AFTER_SCRIPT_1;
|
3351 |
-
} else if(this._special === SPECIAL_STYLE && (c === "t" || c === "T")){
|
3352 |
-
this._state = AFTER_STYLE_1;
|
3353 |
-
}
|
3354 |
-
else this._state = TEXT;
|
3355 |
-
};
|
3356 |
-
|
3357 |
-
Tokenizer.prototype._stateBeforeScript1 = consumeSpecialNameChar("R", BEFORE_SCRIPT_2);
|
3358 |
-
Tokenizer.prototype._stateBeforeScript2 = consumeSpecialNameChar("I", BEFORE_SCRIPT_3);
|
3359 |
-
Tokenizer.prototype._stateBeforeScript3 = consumeSpecialNameChar("P", BEFORE_SCRIPT_4);
|
3360 |
-
Tokenizer.prototype._stateBeforeScript4 = consumeSpecialNameChar("T", BEFORE_SCRIPT_5);
|
3361 |
-
|
3362 |
-
Tokenizer.prototype._stateBeforeScript5 = function(c){
|
3363 |
-
if(c === "/" || c === ">" || whitespace(c)){
|
3364 |
-
this._special = SPECIAL_SCRIPT;
|
3365 |
-
}
|
3366 |
-
this._state = IN_TAG_NAME;
|
3367 |
-
this._index--; //consume the token again
|
3368 |
-
};
|
3369 |
-
|
3370 |
-
Tokenizer.prototype._stateAfterScript1 = ifElseState("R", AFTER_SCRIPT_2, TEXT);
|
3371 |
-
Tokenizer.prototype._stateAfterScript2 = ifElseState("I", AFTER_SCRIPT_3, TEXT);
|
3372 |
-
Tokenizer.prototype._stateAfterScript3 = ifElseState("P", AFTER_SCRIPT_4, TEXT);
|
3373 |
-
Tokenizer.prototype._stateAfterScript4 = ifElseState("T", AFTER_SCRIPT_5, TEXT);
|
3374 |
-
|
3375 |
-
Tokenizer.prototype._stateAfterScript5 = function(c){
|
3376 |
-
if(c === ">" || whitespace(c)){
|
3377 |
-
this._special = SPECIAL_NONE;
|
3378 |
-
this._state = IN_CLOSING_TAG_NAME;
|
3379 |
-
this._sectionStart = this._index - 6;
|
3380 |
-
this._index--; //reconsume the token
|
3381 |
-
}
|
3382 |
-
else this._state = TEXT;
|
3383 |
-
};
|
3384 |
-
|
3385 |
-
Tokenizer.prototype._stateBeforeStyle1 = consumeSpecialNameChar("Y", BEFORE_STYLE_2);
|
3386 |
-
Tokenizer.prototype._stateBeforeStyle2 = consumeSpecialNameChar("L", BEFORE_STYLE_3);
|
3387 |
-
Tokenizer.prototype._stateBeforeStyle3 = consumeSpecialNameChar("E", BEFORE_STYLE_4);
|
3388 |
-
|
3389 |
-
Tokenizer.prototype._stateBeforeStyle4 = function(c){
|
3390 |
-
if(c === "/" || c === ">" || whitespace(c)){
|
3391 |
-
this._special = SPECIAL_STYLE;
|
3392 |
-
}
|
3393 |
-
this._state = IN_TAG_NAME;
|
3394 |
-
this._index--; //consume the token again
|
3395 |
-
};
|
3396 |
-
|
3397 |
-
Tokenizer.prototype._stateAfterStyle1 = ifElseState("Y", AFTER_STYLE_2, TEXT);
|
3398 |
-
Tokenizer.prototype._stateAfterStyle2 = ifElseState("L", AFTER_STYLE_3, TEXT);
|
3399 |
-
Tokenizer.prototype._stateAfterStyle3 = ifElseState("E", AFTER_STYLE_4, TEXT);
|
3400 |
-
|
3401 |
-
Tokenizer.prototype._stateAfterStyle4 = function(c){
|
3402 |
-
if(c === ">" || whitespace(c)){
|
3403 |
-
this._special = SPECIAL_NONE;
|
3404 |
-
this._state = IN_CLOSING_TAG_NAME;
|
3405 |
-
this._sectionStart = this._index - 5;
|
3406 |
-
this._index--; //reconsume the token
|
3407 |
-
}
|
3408 |
-
else this._state = TEXT;
|
3409 |
-
};
|
3410 |
-
|
3411 |
-
Tokenizer.prototype._stateBeforeEntity = ifElseState("#", BEFORE_NUMERIC_ENTITY, IN_NAMED_ENTITY);
|
3412 |
-
Tokenizer.prototype._stateBeforeNumericEntity = ifElseState("X", IN_HEX_ENTITY, IN_NUMERIC_ENTITY);
|
3413 |
-
|
3414 |
-
//for entities terminated with a semicolon
|
3415 |
-
Tokenizer.prototype._parseNamedEntityStrict = function(){
|
3416 |
-
//offset = 1
|
3417 |
-
if(this._sectionStart + 1 < this._index){
|
3418 |
-
var entity = this._buffer.substring(this._sectionStart + 1, this._index),
|
3419 |
-
map = this._xmlMode ? xmlMap : entityMap;
|
3420 |
-
|
3421 |
-
if(map.hasOwnProperty(entity)){
|
3422 |
-
this._emitPartial(map[entity]);
|
3423 |
-
this._sectionStart = this._index + 1;
|
3424 |
-
}
|
3425 |
-
}
|
3426 |
-
};
|
3427 |
-
|
3428 |
-
|
3429 |
-
//parses legacy entities (without trailing semicolon)
|
3430 |
-
Tokenizer.prototype._parseLegacyEntity = function(){
|
3431 |
-
var start = this._sectionStart + 1,
|
3432 |
-
limit = this._index - start;
|
3433 |
-
|
3434 |
-
if(limit > 6) limit = 6; //the max length of legacy entities is 6
|
3435 |
-
|
3436 |
-
while(limit >= 2){ //the min length of legacy entities is 2
|
3437 |
-
var entity = this._buffer.substr(start, limit);
|
3438 |
-
|
3439 |
-
if(legacyMap.hasOwnProperty(entity)){
|
3440 |
-
this._emitPartial(legacyMap[entity]);
|
3441 |
-
this._sectionStart += limit + 1;
|
3442 |
-
return;
|
3443 |
-
} else {
|
3444 |
-
limit--;
|
3445 |
-
}
|
3446 |
-
}
|
3447 |
-
};
|
3448 |
-
|
3449 |
-
Tokenizer.prototype._stateInNamedEntity = function(c){
|
3450 |
-
if(c === ";"){
|
3451 |
-
this._parseNamedEntityStrict();
|
3452 |
-
if(this._sectionStart + 1 < this._index && !this._xmlMode){
|
3453 |
-
this._parseLegacyEntity();
|
3454 |
-
}
|
3455 |
-
this._state = this._baseState;
|
3456 |
-
} else if((c < "a" || c > "z") && (c < "A" || c > "Z") && (c < "0" || c > "9")){
|
3457 |
-
if(this._xmlMode);
|
3458 |
-
else if(this._sectionStart + 1 === this._index);
|
3459 |
-
else if(this._baseState !== TEXT){
|
3460 |
-
if(c !== "="){
|
3461 |
-
this._parseNamedEntityStrict();
|
3462 |
-
}
|
3463 |
-
} else {
|
3464 |
-
this._parseLegacyEntity();
|
3465 |
-
}
|
3466 |
-
|
3467 |
-
this._state = this._baseState;
|
3468 |
-
this._index--;
|
3469 |
-
}
|
3470 |
-
};
|
3471 |
-
|
3472 |
-
Tokenizer.prototype._decodeNumericEntity = function(offset, base){
|
3473 |
-
var sectionStart = this._sectionStart + offset;
|
3474 |
-
|
3475 |
-
if(sectionStart !== this._index){
|
3476 |
-
//parse entity
|
3477 |
-
var entity = this._buffer.substring(sectionStart, this._index);
|
3478 |
-
var parsed = parseInt(entity, base);
|
3479 |
-
|
3480 |
-
this._emitPartial(decodeCodePoint(parsed));
|
3481 |
-
this._sectionStart = this._index;
|
3482 |
-
} else {
|
3483 |
-
this._sectionStart--;
|
3484 |
-
}
|
3485 |
-
|
3486 |
-
this._state = this._baseState;
|
3487 |
-
};
|
3488 |
-
|
3489 |
-
Tokenizer.prototype._stateInNumericEntity = function(c){
|
3490 |
-
if(c === ";"){
|
3491 |
-
this._decodeNumericEntity(2, 10);
|
3492 |
-
this._sectionStart++;
|
3493 |
-
} else if(c < "0" || c > "9"){
|
3494 |
-
if(!this._xmlMode){
|
3495 |
-
this._decodeNumericEntity(2, 10);
|
3496 |
-
} else {
|
3497 |
-
this._state = this._baseState;
|
3498 |
-
}
|
3499 |
-
this._index--;
|
3500 |
-
}
|
3501 |
-
};
|
3502 |
-
|
3503 |
-
Tokenizer.prototype._stateInHexEntity = function(c){
|
3504 |
-
if(c === ";"){
|
3505 |
-
this._decodeNumericEntity(3, 16);
|
3506 |
-
this._sectionStart++;
|
3507 |
-
} else if((c < "a" || c > "f") && (c < "A" || c > "F") && (c < "0" || c > "9")){
|
3508 |
-
if(!this._xmlMode){
|
3509 |
-
this._decodeNumericEntity(3, 16);
|
3510 |
-
} else {
|
3511 |
-
this._state = this._baseState;
|
3512 |
-
}
|
3513 |
-
this._index--;
|
3514 |
-
}
|
3515 |
-
};
|
3516 |
-
|
3517 |
-
Tokenizer.prototype._cleanup = function (){
|
3518 |
-
if(this._sectionStart < 0){
|
3519 |
-
this._buffer = "";
|
3520 |
-
this._bufferOffset += this._index;
|
3521 |
-
this._index = 0;
|
3522 |
-
} else if(this._running){
|
3523 |
-
if(this._state === TEXT){
|
3524 |
-
if(this._sectionStart !== this._index){
|
3525 |
-
this._cbs.ontext(this._buffer.substr(this._sectionStart));
|
3526 |
-
}
|
3527 |
-
this._buffer = "";
|
3528 |
-
this._bufferOffset += this._index;
|
3529 |
-
this._index = 0;
|
3530 |
-
} else if(this._sectionStart === this._index){
|
3531 |
-
//the section just started
|
3532 |
-
this._buffer = "";
|
3533 |
-
this._bufferOffset += this._index;
|
3534 |
-
this._index = 0;
|
3535 |
-
} else {
|
3536 |
-
//remove everything unnecessary
|
3537 |
-
this._buffer = this._buffer.substr(this._sectionStart);
|
3538 |
-
this._index -= this._sectionStart;
|
3539 |
-
this._bufferOffset += this._sectionStart;
|
3540 |
-
}
|
3541 |
-
|
3542 |
-
this._sectionStart = 0;
|
3543 |
-
}
|
3544 |
-
};
|
3545 |
-
|
3546 |
-
//TODO make events conditional
|
3547 |
-
Tokenizer.prototype.write = function(chunk){
|
3548 |
-
if(this._ended) this._cbs.onerror(Error(".write() after done!"));
|
3549 |
-
|
3550 |
-
this._buffer += chunk;
|
3551 |
-
this._parse();
|
3552 |
-
};
|
3553 |
-
|
3554 |
-
Tokenizer.prototype._parse = function(){
|
3555 |
-
while(this._index < this._buffer.length && this._running){
|
3556 |
-
var c = this._buffer.charAt(this._index);
|
3557 |
-
if(this._state === TEXT) {
|
3558 |
-
this._stateText(c);
|
3559 |
-
} else if(this._state === BEFORE_TAG_NAME){
|
3560 |
-
this._stateBeforeTagName(c);
|
3561 |
-
} else if(this._state === IN_TAG_NAME) {
|
3562 |
-
this._stateInTagName(c);
|
3563 |
-
} else if(this._state === BEFORE_CLOSING_TAG_NAME){
|
3564 |
-
this._stateBeforeCloseingTagName(c);
|
3565 |
-
} else if(this._state === IN_CLOSING_TAG_NAME){
|
3566 |
-
this._stateInCloseingTagName(c);
|
3567 |
-
} else if(this._state === AFTER_CLOSING_TAG_NAME){
|
3568 |
-
this._stateAfterCloseingTagName(c);
|
3569 |
-
} else if(this._state === IN_SELF_CLOSING_TAG){
|
3570 |
-
this._stateInSelfClosingTag(c);
|
3571 |
-
}
|
3572 |
-
|
3573 |
-
/*
|
3574 |
-
* attributes
|
3575 |
-
*/
|
3576 |
-
else if(this._state === BEFORE_ATTRIBUTE_NAME){
|
3577 |
-
this._stateBeforeAttributeName(c);
|
3578 |
-
} else if(this._state === IN_ATTRIBUTE_NAME){
|
3579 |
-
this._stateInAttributeName(c);
|
3580 |
-
} else if(this._state === AFTER_ATTRIBUTE_NAME){
|
3581 |
-
this._stateAfterAttributeName(c);
|
3582 |
-
} else if(this._state === BEFORE_ATTRIBUTE_VALUE){
|
3583 |
-
this._stateBeforeAttributeValue(c);
|
3584 |
-
} else if(this._state === IN_ATTRIBUTE_VALUE_DQ){
|
3585 |
-
this._stateInAttributeValueDoubleQuotes(c);
|
3586 |
-
} else if(this._state === IN_ATTRIBUTE_VALUE_SQ){
|
3587 |
-
this._stateInAttributeValueSingleQuotes(c);
|
3588 |
-
} else if(this._state === IN_ATTRIBUTE_VALUE_NQ){
|
3589 |
-
this._stateInAttributeValueNoQuotes(c);
|
3590 |
-
}
|
3591 |
-
|
3592 |
-
/*
|
3593 |
-
* declarations
|
3594 |
-
*/
|
3595 |
-
else if(this._state === BEFORE_DECLARATION){
|
3596 |
-
this._stateBeforeDeclaration(c);
|
3597 |
-
} else if(this._state === IN_DECLARATION){
|
3598 |
-
this._stateInDeclaration(c);
|
3599 |
-
}
|
3600 |
-
|
3601 |
-
/*
|
3602 |
-
* processing instructions
|
3603 |
-
*/
|
3604 |
-
else if(this._state === IN_PROCESSING_INSTRUCTION){
|
3605 |
-
this._stateInProcessingInstruction(c);
|
3606 |
-
}
|
3607 |
-
|
3608 |
-
/*
|
3609 |
-
* comments
|
3610 |
-
*/
|
3611 |
-
else if(this._state === BEFORE_COMMENT){
|
3612 |
-
this._stateBeforeComment(c);
|
3613 |
-
} else if(this._state === IN_COMMENT){
|
3614 |
-
this._stateInComment(c);
|
3615 |
-
} else if(this._state === AFTER_COMMENT_1){
|
3616 |
-
this._stateAfterComment1(c);
|
3617 |
-
} else if(this._state === AFTER_COMMENT_2){
|
3618 |
-
this._stateAfterComment2(c);
|
3619 |
-
}
|
3620 |
-
|
3621 |
-
/*
|
3622 |
-
* cdata
|
3623 |
-
*/
|
3624 |
-
else if(this._state === BEFORE_CDATA_1){
|
3625 |
-
this._stateBeforeCdata1(c);
|
3626 |
-
} else if(this._state === BEFORE_CDATA_2){
|
3627 |
-
this._stateBeforeCdata2(c);
|
3628 |
-
} else if(this._state === BEFORE_CDATA_3){
|
3629 |
-
this._stateBeforeCdata3(c);
|
3630 |
-
} else if(this._state === BEFORE_CDATA_4){
|
3631 |
-
this._stateBeforeCdata4(c);
|
3632 |
-
} else if(this._state === BEFORE_CDATA_5){
|
3633 |
-
this._stateBeforeCdata5(c);
|
3634 |
-
} else if(this._state === BEFORE_CDATA_6){
|
3635 |
-
this._stateBeforeCdata6(c);
|
3636 |
-
} else if(this._state === IN_CDATA){
|
3637 |
-
this._stateInCdata(c);
|
3638 |
-
} else if(this._state === AFTER_CDATA_1){
|
3639 |
-
this._stateAfterCdata1(c);
|
3640 |
-
} else if(this._state === AFTER_CDATA_2){
|
3641 |
-
this._stateAfterCdata2(c);
|
3642 |
-
}
|
3643 |
-
|
3644 |
-
/*
|
3645 |
-
* special tags
|
3646 |
-
*/
|
3647 |
-
else if(this._state === BEFORE_SPECIAL){
|
3648 |
-
this._stateBeforeSpecial(c);
|
3649 |
-
} else if(this._state === BEFORE_SPECIAL_END){
|
3650 |
-
this._stateBeforeSpecialEnd(c);
|
3651 |
-
}
|
3652 |
-
|
3653 |
-
/*
|
3654 |
-
* script
|
3655 |
-
*/
|
3656 |
-
else if(this._state === BEFORE_SCRIPT_1){
|
3657 |
-
this._stateBeforeScript1(c);
|
3658 |
-
} else if(this._state === BEFORE_SCRIPT_2){
|
3659 |
-
this._stateBeforeScript2(c);
|
3660 |
-
} else if(this._state === BEFORE_SCRIPT_3){
|
3661 |
-
this._stateBeforeScript3(c);
|
3662 |
-
} else if(this._state === BEFORE_SCRIPT_4){
|
3663 |
-
this._stateBeforeScript4(c);
|
3664 |
-
} else if(this._state === BEFORE_SCRIPT_5){
|
3665 |
-
this._stateBeforeScript5(c);
|
3666 |
-
}
|
3667 |
-
|
3668 |
-
else if(this._state === AFTER_SCRIPT_1){
|
3669 |
-
this._stateAfterScript1(c);
|
3670 |
-
} else if(this._state === AFTER_SCRIPT_2){
|
3671 |
-
this._stateAfterScript2(c);
|
3672 |
-
} else if(this._state === AFTER_SCRIPT_3){
|
3673 |
-
this._stateAfterScript3(c);
|
3674 |
-
} else if(this._state === AFTER_SCRIPT_4){
|
3675 |
-
this._stateAfterScript4(c);
|
3676 |
-
} else if(this._state === AFTER_SCRIPT_5){
|
3677 |
-
this._stateAfterScript5(c);
|
3678 |
-
}
|
3679 |
-
|
3680 |
-
/*
|
3681 |
-
* style
|
3682 |
-
*/
|
3683 |
-
else if(this._state === BEFORE_STYLE_1){
|
3684 |
-
this._stateBeforeStyle1(c);
|
3685 |
-
} else if(this._state === BEFORE_STYLE_2){
|
3686 |
-
this._stateBeforeStyle2(c);
|
3687 |
-
} else if(this._state === BEFORE_STYLE_3){
|
3688 |
-
this._stateBeforeStyle3(c);
|
3689 |
-
} else if(this._state === BEFORE_STYLE_4){
|
3690 |
-
this._stateBeforeStyle4(c);
|
3691 |
-
}
|
3692 |
-
|
3693 |
-
else if(this._state === AFTER_STYLE_1){
|
3694 |
-
this._stateAfterStyle1(c);
|
3695 |
-
} else if(this._state === AFTER_STYLE_2){
|
3696 |
-
this._stateAfterStyle2(c);
|
3697 |
-
} else if(this._state === AFTER_STYLE_3){
|
3698 |
-
this._stateAfterStyle3(c);
|
3699 |
-
} else if(this._state === AFTER_STYLE_4){
|
3700 |
-
this._stateAfterStyle4(c);
|
3701 |
-
}
|
3702 |
-
|
3703 |
-
/*
|
3704 |
-
* entities
|
3705 |
-
*/
|
3706 |
-
else if(this._state === BEFORE_ENTITY){
|
3707 |
-
this._stateBeforeEntity(c);
|
3708 |
-
} else if(this._state === BEFORE_NUMERIC_ENTITY){
|
3709 |
-
this._stateBeforeNumericEntity(c);
|
3710 |
-
} else if(this._state === IN_NAMED_ENTITY){
|
3711 |
-
this._stateInNamedEntity(c);
|
3712 |
-
} else if(this._state === IN_NUMERIC_ENTITY){
|
3713 |
-
this._stateInNumericEntity(c);
|
3714 |
-
} else if(this._state === IN_HEX_ENTITY){
|
3715 |
-
this._stateInHexEntity(c);
|
3716 |
-
}
|
3717 |
-
|
3718 |
-
else {
|
3719 |
-
this._cbs.onerror(Error("unknown _state"), this._state);
|
3720 |
-
}
|
3721 |
-
|
3722 |
-
this._index++;
|
3723 |
-
}
|
3724 |
-
|
3725 |
-
this._cleanup();
|
3726 |
-
};
|
3727 |
-
|
3728 |
-
Tokenizer.prototype.pause = function(){
|
3729 |
-
this._running = false;
|
3730 |
-
};
|
3731 |
-
Tokenizer.prototype.resume = function(){
|
3732 |
-
this._running = true;
|
3733 |
-
|
3734 |
-
if(this._index < this._buffer.length){
|
3735 |
-
this._parse();
|
3736 |
-
}
|
3737 |
-
if(this._ended){
|
3738 |
-
this._finish();
|
3739 |
-
}
|
3740 |
-
};
|
3741 |
-
|
3742 |
-
Tokenizer.prototype.end = function(chunk){
|
3743 |
-
if(this._ended) this._cbs.onerror(Error(".end() after done!"));
|
3744 |
-
if(chunk) this.write(chunk);
|
3745 |
-
|
3746 |
-
this._ended = true;
|
3747 |
-
|
3748 |
-
if(this._running) this._finish();
|
3749 |
-
};
|
3750 |
-
|
3751 |
-
Tokenizer.prototype._finish = function(){
|
3752 |
-
//if there is remaining data, emit it in a reasonable way
|
3753 |
-
if(this._sectionStart < this._index){
|
3754 |
-
this._handleTrailingData();
|
3755 |
-
}
|
3756 |
-
|
3757 |
-
this._cbs.onend();
|
3758 |
-
};
|
3759 |
-
|
3760 |
-
Tokenizer.prototype._handleTrailingData = function(){
|
3761 |
-
var data = this._buffer.substr(this._sectionStart);
|
3762 |
-
|
3763 |
-
if(this._state === IN_CDATA || this._state === AFTER_CDATA_1 || this._state === AFTER_CDATA_2){
|
3764 |
-
this._cbs.oncdata(data);
|
3765 |
-
} else if(this._state === IN_COMMENT || this._state === AFTER_COMMENT_1 || this._state === AFTER_COMMENT_2){
|
3766 |
-
this._cbs.oncomment(data);
|
3767 |
-
} else if(this._state === IN_NAMED_ENTITY && !this._xmlMode){
|
3768 |
-
this._parseLegacyEntity();
|
3769 |
-
if(this._sectionStart < this._index){
|
3770 |
-
this._state = this._baseState;
|
3771 |
-
this._handleTrailingData();
|
3772 |
-
}
|
3773 |
-
} else if(this._state === IN_NUMERIC_ENTITY && !this._xmlMode){
|
3774 |
-
this._decodeNumericEntity(2, 10);
|
3775 |
-
if(this._sectionStart < this._index){
|
3776 |
-
this._state = this._baseState;
|
3777 |
-
this._handleTrailingData();
|
3778 |
-
}
|
3779 |
-
} else if(this._state === IN_HEX_ENTITY && !this._xmlMode){
|
3780 |
-
this._decodeNumericEntity(3, 16);
|
3781 |
-
if(this._sectionStart < this._index){
|
3782 |
-
this._state = this._baseState;
|
3783 |
-
this._handleTrailingData();
|
3784 |
-
}
|
3785 |
-
} else if(
|
3786 |
-
this._state !== IN_TAG_NAME &&
|
3787 |
-
this._state !== BEFORE_ATTRIBUTE_NAME &&
|
3788 |
-
this._state !== BEFORE_ATTRIBUTE_VALUE &&
|
3789 |
-
this._state !== AFTER_ATTRIBUTE_NAME &&
|
3790 |
-
this._state !== IN_ATTRIBUTE_NAME &&
|
3791 |
-
this._state !== IN_ATTRIBUTE_VALUE_SQ &&
|
3792 |
-
this._state !== IN_ATTRIBUTE_VALUE_DQ &&
|
3793 |
-
this._state !== IN_ATTRIBUTE_VALUE_NQ &&
|
3794 |
-
this._state !== IN_CLOSING_TAG_NAME
|
3795 |
-
){
|
3796 |
-
this._cbs.ontext(data);
|
3797 |
-
}
|
3798 |
-
//else, ignore remaining data
|
3799 |
-
//TODO add a way to remove current tag
|
3800 |
-
};
|
3801 |
-
|
3802 |
-
Tokenizer.prototype.reset = function(){
|
3803 |
-
Tokenizer.call(this, {xmlMode: this._xmlMode, decodeEntities: this._decodeEntities}, this._cbs);
|
3804 |
-
};
|
3805 |
-
|
3806 |
-
Tokenizer.prototype.getAbsoluteIndex = function(){
|
3807 |
-
return this._bufferOffset + this._index;
|
3808 |
-
};
|
3809 |
-
|
3810 |
-
Tokenizer.prototype._getSection = function(){
|
3811 |
-
return this._buffer.substring(this._sectionStart, this._index);
|
3812 |
-
};
|
3813 |
-
|
3814 |
-
Tokenizer.prototype._emitToken = function(name){
|
3815 |
-
this._cbs[name](this._getSection());
|
3816 |
-
this._sectionStart = -1;
|
3817 |
-
};
|
3818 |
-
|
3819 |
-
Tokenizer.prototype._emitPartial = function(value){
|
3820 |
-
if(this._baseState !== TEXT){
|
3821 |
-
this._cbs.onattribdata(value); //TODO implement the new event
|
3822 |
-
} else {
|
3823 |
-
this._cbs.ontext(value);
|
3824 |
-
}
|
3825 |
-
};
|
3826 |
-
|
3827 |
-
|
3828 |
-
/***/ },
|
3829 |
-
|
3830 |
-
/***/ 469:
|
3831 |
-
/***/ function(module, exports, __webpack_require__) {
|
3832 |
-
|
3833 |
-
var decodeMap = __webpack_require__(470);
|
3834 |
-
|
3835 |
-
module.exports = decodeCodePoint;
|
3836 |
-
|
3837 |
-
// modified version of https://github.com/mathiasbynens/he/blob/master/src/he.js#L94-L119
|
3838 |
-
function decodeCodePoint(codePoint){
|
3839 |
-
|
3840 |
-
if((codePoint >= 0xD800 && codePoint <= 0xDFFF) || codePoint > 0x10FFFF){
|
3841 |
-
return "\uFFFD";
|
3842 |
-
}
|
3843 |
-
|
3844 |
-
if(codePoint in decodeMap){
|
3845 |
-
codePoint = decodeMap[codePoint];
|
3846 |
-
}
|
3847 |
-
|
3848 |
-
var output = "";
|
3849 |
-
|
3850 |
-
if(codePoint > 0xFFFF){
|
3851 |
-
codePoint -= 0x10000;
|
3852 |
-
output += String.fromCharCode(codePoint >>> 10 & 0x3FF | 0xD800);
|
3853 |
-
codePoint = 0xDC00 | codePoint & 0x3FF;
|
3854 |
-
}
|
3855 |
-
|
3856 |
-
output += String.fromCharCode(codePoint);
|
3857 |
-
return output;
|
3858 |
-
}
|
3859 |
-
|
3860 |
-
|
3861 |
-
/***/ },
|
3862 |
-
|
3863 |
-
/***/ 470:
|
3864 |
-
/***/ function(module, exports) {
|
3865 |
-
|
3866 |
-
module.exports = {"0":65533,"128":8364,"130":8218,"131":402,"132":8222,"133":8230,"134":8224,"135":8225,"136":710,"137":8240,"138":352,"139":8249,"140":338,"142":381,"145":8216,"146":8217,"147":8220,"148":8221,"149":8226,"150":8211,"151":8212,"152":732,"153":8482,"154":353,"155":8250,"156":339,"158":382,"159":376}
|
3867 |
-
|
3868 |
-
/***/ },
|
3869 |
-
|
3870 |
-
/***/ 471:
|
3871 |
-
/***/ function(module, exports) {
|
3872 |
-
|
3873 |
-
module.exports = {"Aacute":"Á","aacute":"á","Abreve":"Ă","abreve":"ă","ac":"∾","acd":"∿","acE":"∾̳","Acirc":"Â","acirc":"â","acute":"´","Acy":"А","acy":"а","AElig":"Æ","aelig":"æ","af":"","Afr":"𝔄","afr":"𝔞","Agrave":"À","agrave":"à","alefsym":"ℵ","aleph":"ℵ","Alpha":"Α","alpha":"α","Amacr":"Ā","amacr":"ā","amalg":"⨿","amp":"&","AMP":"&","andand":"⩕","And":"⩓","and":"∧","andd":"⩜","andslope":"⩘","andv":"⩚","ang":"∠","ange":"⦤","angle":"∠","angmsdaa":"⦨","angmsdab":"⦩","angmsdac":"⦪","angmsdad":"⦫","angmsdae":"⦬","angmsdaf":"⦭","angmsdag":"⦮","angmsdah":"⦯","angmsd":"∡","angrt":"∟","angrtvb":"⊾","angrtvbd":"⦝","angsph":"∢","angst":"Å","angzarr":"⍼","Aogon":"Ą","aogon":"ą","Aopf":"𝔸","aopf":"𝕒","apacir":"⩯","ap":"≈","apE":"⩰","ape":"≊","apid":"≋","apos":"'","ApplyFunction":"","approx":"≈","approxeq":"≊","Aring":"Å","aring":"å","Ascr":"𝒜","ascr":"𝒶","Assign":"≔","ast":"*","asymp":"≈","asympeq":"≍","Atilde":"Ã","atilde":"ã","Auml":"Ä","auml":"ä","awconint":"∳","awint":"⨑","backcong":"≌","backepsilon":"϶","backprime":"‵","backsim":"∽","backsimeq":"⋍","Backslash":"∖","Barv":"⫧","barvee":"⊽","barwed":"⌅","Barwed":"⌆","barwedge":"⌅","bbrk":"⎵","bbrktbrk":"⎶","bcong":"≌","Bcy":"Б","bcy":"б","bdquo":"„","becaus":"∵","because":"∵","Because":"∵","bemptyv":"⦰","bepsi":"϶","bernou":"ℬ","Bernoullis":"ℬ","Beta":"Β","beta":"β","beth":"ℶ","between":"≬","Bfr":"𝔅","bfr":"𝔟","bigcap":"⋂","bigcirc":"◯","bigcup":"⋃","bigodot":"⨀","bigoplus":"⨁","bigotimes":"⨂","bigsqcup":"⨆","bigstar":"★","bigtriangledown":"▽","bigtriangleup":"△","biguplus":"⨄","bigvee":"⋁","bigwedge":"⋀","bkarow":"⤍","blacklozenge":"⧫","blacksquare":"▪","blacktriangle":"▴","blacktriangledown":"▾","blacktriangleleft":"◂","blacktriangleright":"▸","blank":"␣","blk12":"▒","blk14":"░","blk34":"▓","block":"█","bne":"=⃥","bnequiv":"≡⃥","bNot":"⫭","bnot":"⌐","Bopf":"𝔹","bopf":"𝕓","bot":"⊥","bottom":"⊥","bowtie":"⋈","boxbox":"⧉","boxdl":"┐","boxdL":"╕","boxDl":"╖","boxDL":"╗","boxdr":"┌","boxdR":"╒","boxDr":"╓","boxDR":"╔","boxh":"─","boxH":"═","boxhd":"┬","boxHd":"╤","boxhD":"╥","boxHD":"╦","boxhu":"┴","boxHu":"╧","boxhU":"╨","boxHU":"╩","boxminus":"⊟","boxplus":"⊞","boxtimes":"⊠","boxul":"┘","boxuL":"╛","boxUl":"╜","boxUL":"╝","boxur":"└","boxuR":"╘","boxUr":"╙","boxUR":"╚","boxv":"│","boxV":"║","boxvh":"┼","boxvH":"╪","boxVh":"╫","boxVH":"╬","boxvl":"┤","boxvL":"╡","boxVl":"╢","boxVL":"╣","boxvr":"├","boxvR":"╞","boxVr":"╟","boxVR":"╠","bprime":"‵","breve":"˘","Breve":"˘","brvbar":"¦","bscr":"𝒷","Bscr":"ℬ","bsemi":"⁏","bsim":"∽","bsime":"⋍","bsolb":"⧅","bsol":"\\","bsolhsub":"⟈","bull":"•","bullet":"•","bump":"≎","bumpE":"⪮","bumpe":"≏","Bumpeq":"≎","bumpeq":"≏","Cacute":"Ć","cacute":"ć","capand":"⩄","capbrcup":"⩉","capcap":"⩋","cap":"∩","Cap":"⋒","capcup":"⩇","capdot":"⩀","CapitalDifferentialD":"ⅅ","caps":"∩︀","caret":"⁁","caron":"ˇ","Cayleys":"ℭ","ccaps":"⩍","Ccaron":"Č","ccaron":"č","Ccedil":"Ç","ccedil":"ç","Ccirc":"Ĉ","ccirc":"ĉ","Cconint":"∰","ccups":"⩌","ccupssm":"⩐","Cdot":"Ċ","cdot":"ċ","cedil":"¸","Cedilla":"¸","cemptyv":"⦲","cent":"¢","centerdot":"·","CenterDot":"·","cfr":"𝔠","Cfr":"ℭ","CHcy":"Ч","chcy":"ч","check":"✓","checkmark":"✓","Chi":"Χ","chi":"χ","circ":"ˆ","circeq":"≗","circlearrowleft":"↺","circlearrowright":"↻","circledast":"⊛","circledcirc":"⊚","circleddash":"⊝","CircleDot":"⊙","circledR":"®","circledS":"Ⓢ","CircleMinus":"⊖","CirclePlus":"⊕","CircleTimes":"⊗","cir":"○","cirE":"⧃","cire":"≗","cirfnint":"⨐","cirmid":"⫯","cirscir":"⧂","ClockwiseContourIntegral":"∲","CloseCurlyDoubleQuote":"”","CloseCurlyQuote":"’","clubs":"♣","clubsuit":"♣","colon":":","Colon":"∷","Colone":"⩴","colone":"≔","coloneq":"≔","comma":",","commat":"@","comp":"∁","compfn":"∘","complement":"∁","complexes":"ℂ","cong":"≅","congdot":"⩭","Congruent":"≡","conint":"∮","Conint":"∯","ContourIntegral":"∮","copf":"𝕔","Copf":"ℂ","coprod":"∐","Coproduct":"∐","copy":"©","COPY":"©","copysr":"℗","CounterClockwiseContourIntegral":"∳","crarr":"↵","cross":"✗","Cross":"⨯","Cscr":"𝒞","cscr":"𝒸","csub":"⫏","csube":"⫑","csup":"⫐","csupe":"⫒","ctdot":"⋯","cudarrl":"⤸","cudarrr":"⤵","cuepr":"⋞","cuesc":"⋟","cularr":"↶","cularrp":"⤽","cupbrcap":"⩈","cupcap":"⩆","CupCap":"≍","cup":"∪","Cup":"⋓","cupcup":"⩊","cupdot":"⊍","cupor":"⩅","cups":"∪︀","curarr":"↷","curarrm":"⤼","curlyeqprec":"⋞","curlyeqsucc":"⋟","curlyvee":"⋎","curlywedge":"⋏","curren":"¤","curvearrowleft":"↶","curvearrowright":"↷","cuvee":"⋎","cuwed":"⋏","cwconint":"∲","cwint":"∱","cylcty":"⌭","dagger":"†","Dagger":"‡","daleth":"ℸ","darr":"↓","Darr":"↡","dArr":"⇓","dash":"‐","Dashv":"⫤","dashv":"⊣","dbkarow":"⤏","dblac":"˝","Dcaron":"Ď","dcaron":"ď","Dcy":"Д","dcy":"д","ddagger":"‡","ddarr":"⇊","DD":"ⅅ","dd":"ⅆ","DDotrahd":"⤑","ddotseq":"⩷","deg":"°","Del":"∇","Delta":"Δ","delta":"δ","demptyv":"⦱","dfisht":"⥿","Dfr":"𝔇","dfr":"𝔡","dHar":"⥥","dharl":"⇃","dharr":"⇂","DiacriticalAcute":"´","DiacriticalDot":"˙","DiacriticalDoubleAcute":"˝","DiacriticalGrave":"`","DiacriticalTilde":"˜","diam":"⋄","diamond":"⋄","Diamond":"⋄","diamondsuit":"♦","diams":"♦","die":"¨","DifferentialD":"ⅆ","digamma":"ϝ","disin":"⋲","div":"÷","divide":"÷","divideontimes":"⋇","divonx":"⋇","DJcy":"Ђ","djcy":"ђ","dlcorn":"⌞","dlcrop":"⌍","dollar":"$","Dopf":"𝔻","dopf":"𝕕","Dot":"¨","dot":"˙","DotDot":"⃜","doteq":"≐","doteqdot":"≑","DotEqual":"≐","dotminus":"∸","dotplus":"∔","dotsquare":"⊡","doublebarwedge":"⌆","DoubleContourIntegral":"∯","DoubleDot":"¨","DoubleDownArrow":"⇓","DoubleLeftArrow":"⇐","DoubleLeftRightArrow":"⇔","DoubleLeftTee":"⫤","DoubleLongLeftArrow":"⟸","DoubleLongLeftRightArrow":"⟺","DoubleLongRightArrow":"⟹","DoubleRightArrow":"⇒","DoubleRightTee":"⊨","DoubleUpArrow":"⇑","DoubleUpDownArrow":"⇕","DoubleVerticalBar":"∥","DownArrowBar":"⤓","downarrow":"↓","DownArrow":"↓","Downarrow":"⇓","DownArrowUpArrow":"⇵","DownBreve":"̑","downdownarrows":"⇊","downharpoonleft":"⇃","downharpoonright":"⇂","DownLeftRightVector":"⥐","DownLeftTeeVector":"⥞","DownLeftVectorBar":"⥖","DownLeftVector":"↽","DownRightTeeVector":"⥟","DownRightVectorBar":"⥗","DownRightVector":"⇁","DownTeeArrow":"↧","DownTee":"⊤","drbkarow":"⤐","drcorn":"⌟","drcrop":"⌌","Dscr":"𝒟","dscr":"𝒹","DScy":"Ѕ","dscy":"ѕ","dsol":"⧶","Dstrok":"Đ","dstrok":"đ","dtdot":"⋱","dtri":"▿","dtrif":"▾","duarr":"⇵","duhar":"⥯","dwangle":"⦦","DZcy":"Џ","dzcy":"џ","dzigrarr":"⟿","Eacute":"É","eacute":"é","easter":"⩮","Ecaron":"Ě","ecaron":"ě","Ecirc":"Ê","ecirc":"ê","ecir":"≖","ecolon":"≕","Ecy":"Э","ecy":"э","eDDot":"⩷","Edot":"Ė","edot":"ė","eDot":"≑","ee":"ⅇ","efDot":"≒","Efr":"𝔈","efr":"𝔢","eg":"⪚","Egrave":"È","egrave":"è","egs":"⪖","egsdot":"⪘","el":"⪙","Element":"∈","elinters":"⏧","ell":"ℓ","els":"⪕","elsdot":"⪗","Emacr":"Ē","emacr":"ē","empty":"∅","emptyset":"∅","EmptySmallSquare":"◻","emptyv":"∅","EmptyVerySmallSquare":"▫","emsp13":" ","emsp14":" ","emsp":" ","ENG":"Ŋ","eng":"ŋ","ensp":" ","Eogon":"Ę","eogon":"ę","Eopf":"𝔼","eopf":"𝕖","epar":"⋕","eparsl":"⧣","eplus":"⩱","epsi":"ε","Epsilon":"Ε","epsilon":"ε","epsiv":"ϵ","eqcirc":"≖","eqcolon":"≕","eqsim":"≂","eqslantgtr":"⪖","eqslantless":"⪕","Equal":"⩵","equals":"=","EqualTilde":"≂","equest":"≟","Equilibrium":"⇌","equiv":"≡","equivDD":"⩸","eqvparsl":"⧥","erarr":"⥱","erDot":"≓","escr":"ℯ","Escr":"ℰ","esdot":"≐","Esim":"⩳","esim":"≂","Eta":"Η","eta":"η","ETH":"Ð","eth":"ð","Euml":"Ë","euml":"ë","euro":"€","excl":"!","exist":"∃","Exists":"∃","expectation":"ℰ","exponentiale":"ⅇ","ExponentialE":"ⅇ","fallingdotseq":"≒","Fcy":"Ф","fcy":"ф","female":"♀","ffilig":"ffi","fflig":"ff","ffllig":"ffl","Ffr":"𝔉","ffr":"𝔣","filig":"fi","FilledSmallSquare":"◼","FilledVerySmallSquare":"▪","fjlig":"fj","flat":"♭","fllig":"fl","fltns":"▱","fnof":"ƒ","Fopf":"𝔽","fopf":"𝕗","forall":"∀","ForAll":"∀","fork":"⋔","forkv":"⫙","Fouriertrf":"ℱ","fpartint":"⨍","frac12":"½","frac13":"⅓","frac14":"¼","frac15":"⅕","frac16":"⅙","frac18":"⅛","frac23":"⅔","frac25":"⅖","frac34":"¾","frac35":"⅗","frac38":"⅜","frac45":"⅘","frac56":"⅚","frac58":"⅝","frac78":"⅞","frasl":"⁄","frown":"⌢","fscr":"𝒻","Fscr":"ℱ","gacute":"ǵ","Gamma":"Γ","gamma":"γ","Gammad":"Ϝ","gammad":"ϝ","gap":"⪆","Gbreve":"Ğ","gbreve":"ğ","Gcedil":"Ģ","Gcirc":"Ĝ","gcirc":"ĝ","Gcy":"Г","gcy":"г","Gdot":"Ġ","gdot":"ġ","ge":"≥","gE":"≧","gEl":"⪌","gel":"⋛","geq":"≥","geqq":"≧","geqslant":"⩾","gescc":"⪩","ges":"⩾","gesdot":"⪀","gesdoto":"⪂","gesdotol":"⪄","gesl":"⋛︀","gesles":"⪔","Gfr":"𝔊","gfr":"𝔤","gg":"≫","Gg":"⋙","ggg":"⋙","gimel":"ℷ","GJcy":"Ѓ","gjcy":"ѓ","gla":"⪥","gl":"≷","glE":"⪒","glj":"⪤","gnap":"⪊","gnapprox":"⪊","gne":"⪈","gnE":"≩","gneq":"⪈","gneqq":"≩","gnsim":"⋧","Gopf":"𝔾","gopf":"𝕘","grave":"`","GreaterEqual":"≥","GreaterEqualLess":"⋛","GreaterFullEqual":"≧","GreaterGreater":"⪢","GreaterLess":"≷","GreaterSlantEqual":"⩾","GreaterTilde":"≳","Gscr":"𝒢","gscr":"ℊ","gsim":"≳","gsime":"⪎","gsiml":"⪐","gtcc":"⪧","gtcir":"⩺","gt":">","GT":">","Gt":"≫","gtdot":"⋗","gtlPar":"⦕","gtquest":"⩼","gtrapprox":"⪆","gtrarr":"⥸","gtrdot":"⋗","gtreqless":"⋛","gtreqqless":"⪌","gtrless":"≷","gtrsim":"≳","gvertneqq":"≩︀","gvnE":"≩︀","Hacek":"ˇ","hairsp":" ","half":"½","hamilt":"ℋ","HARDcy":"Ъ","hardcy":"ъ","harrcir":"⥈","harr":"↔","hArr":"⇔","harrw":"↭","Hat":"^","hbar":"ℏ","Hcirc":"Ĥ","hcirc":"ĥ","hearts":"♥","heartsuit":"♥","hellip":"…","hercon":"⊹","hfr":"𝔥","Hfr":"ℌ","HilbertSpace":"ℋ","hksearow":"⤥","hkswarow":"⤦","hoarr":"⇿","homtht":"∻","hookleftarrow":"↩","hookrightarrow":"↪","hopf":"𝕙","Hopf":"ℍ","horbar":"―","HorizontalLine":"─","hscr":"𝒽","Hscr":"ℋ","hslash":"ℏ","Hstrok":"Ħ","hstrok":"ħ","HumpDownHump":"≎","HumpEqual":"≏","hybull":"⁃","hyphen":"‐","Iacute":"Í","iacute":"í","ic":"","Icirc":"Î","icirc":"î","Icy":"И","icy":"и","Idot":"İ","IEcy":"Е","iecy":"е","iexcl":"¡","iff":"⇔","ifr":"𝔦","Ifr":"ℑ","Igrave":"Ì","igrave":"ì","ii":"ⅈ","iiiint":"⨌","iiint":"∭","iinfin":"⧜","iiota":"℩","IJlig":"IJ","ijlig":"ij","Imacr":"Ī","imacr":"ī","image":"ℑ","ImaginaryI":"ⅈ","imagline":"ℐ","imagpart":"ℑ","imath":"ı","Im":"ℑ","imof":"⊷","imped":"Ƶ","Implies":"⇒","incare":"℅","in":"∈","infin":"∞","infintie":"⧝","inodot":"ı","intcal":"⊺","int":"∫","Int":"∬","integers":"ℤ","Integral":"∫","intercal":"⊺","Intersection":"⋂","intlarhk":"⨗","intprod":"⨼","InvisibleComma":"","InvisibleTimes":"","IOcy":"Ё","iocy":"ё","Iogon":"Į","iogon":"į","Iopf":"𝕀","iopf":"𝕚","Iota":"Ι","iota":"ι","iprod":"⨼","iquest":"¿","iscr":"𝒾","Iscr":"ℐ","isin":"∈","isindot":"⋵","isinE":"⋹","isins":"⋴","isinsv":"⋳","isinv":"∈","it":"","Itilde":"Ĩ","itilde":"ĩ","Iukcy":"І","iukcy":"і","Iuml":"Ï","iuml":"ï","Jcirc":"Ĵ","jcirc":"ĵ","Jcy":"Й","jcy":"й","Jfr":"𝔍","jfr":"𝔧","jmath":"ȷ","Jopf":"𝕁","jopf":"𝕛","Jscr":"𝒥","jscr":"𝒿","Jsercy":"Ј","jsercy":"ј","Jukcy":"Є","jukcy":"є","Kappa":"Κ","kappa":"κ","kappav":"ϰ","Kcedil":"Ķ","kcedil":"ķ","Kcy":"К","kcy":"к","Kfr":"𝔎","kfr":"𝔨","kgreen":"ĸ","KHcy":"Х","khcy":"х","KJcy":"Ќ","kjcy":"ќ","Kopf":"𝕂","kopf":"𝕜","Kscr":"𝒦","kscr":"𝓀","lAarr":"⇚","Lacute":"Ĺ","lacute":"ĺ","laemptyv":"⦴","lagran":"ℒ","Lambda":"Λ","lambda":"λ","lang":"⟨","Lang":"⟪","langd":"⦑","langle":"⟨","lap":"⪅","Laplacetrf":"ℒ","laquo":"«","larrb":"⇤","larrbfs":"⤟","larr":"←","Larr":"↞","lArr":"⇐","larrfs":"⤝","larrhk":"↩","larrlp":"↫","larrpl":"⤹","larrsim":"⥳","larrtl":"↢","latail":"⤙","lAtail":"⤛","lat":"⪫","late":"⪭","lates":"⪭︀","lbarr":"⤌","lBarr":"⤎","lbbrk":"❲","lbrace":"{","lbrack":"[","lbrke":"⦋","lbrksld":"⦏","lbrkslu":"⦍","Lcaron":"Ľ","lcaron":"ľ","Lcedil":"Ļ","lcedil":"ļ","lceil":"⌈","lcub":"{","Lcy":"Л","lcy":"л","ldca":"⤶","ldquo":"“","ldquor":"„","ldrdhar":"⥧","ldrushar":"⥋","ldsh":"↲","le":"≤","lE":"≦","LeftAngleBracket":"⟨","LeftArrowBar":"⇤","leftarrow":"←","LeftArrow":"←","Leftarrow":"⇐","LeftArrowRightArrow":"⇆","leftarrowtail":"↢","LeftCeiling":"⌈","LeftDoubleBracket":"⟦","LeftDownTeeVector":"⥡","LeftDownVectorBar":"⥙","LeftDownVector":"⇃","LeftFloor":"⌊","leftharpoondown":"↽","leftharpoonup":"↼","leftleftarrows":"⇇","leftrightarrow":"↔","LeftRightArrow":"↔","Leftrightarrow":"⇔","leftrightarrows":"⇆","leftrightharpoons":"⇋","leftrightsquigarrow":"↭","LeftRightVector":"⥎","LeftTeeArrow":"↤","LeftTee":"⊣","LeftTeeVector":"⥚","leftthreetimes":"⋋","LeftTriangleBar":"⧏","LeftTriangle":"⊲","LeftTriangleEqual":"⊴","LeftUpDownVector":"⥑","LeftUpTeeVector":"⥠","LeftUpVectorBar":"⥘","LeftUpVector":"↿","LeftVectorBar":"⥒","LeftVector":"↼","lEg":"⪋","leg":"⋚","leq":"≤","leqq":"≦","leqslant":"⩽","lescc":"⪨","les":"⩽","lesdot":"⩿","lesdoto":"⪁","lesdotor":"⪃","lesg":"⋚︀","lesges":"⪓","lessapprox":"⪅","lessdot":"⋖","lesseqgtr":"⋚","lesseqqgtr":"⪋","LessEqualGreater":"⋚","LessFullEqual":"≦","LessGreater":"≶","lessgtr":"≶","LessLess":"⪡","lesssim":"≲","LessSlantEqual":"⩽","LessTilde":"≲","lfisht":"⥼","lfloor":"⌊","Lfr":"𝔏","lfr":"𝔩","lg":"≶","lgE":"⪑","lHar":"⥢","lhard":"↽","lharu":"↼","lharul":"⥪","lhblk":"▄","LJcy":"Љ","ljcy":"љ","llarr":"⇇","ll":"≪","Ll":"⋘","llcorner":"⌞","Lleftarrow":"⇚","llhard":"⥫","lltri":"◺","Lmidot":"Ŀ","lmidot":"ŀ","lmoustache":"⎰","lmoust":"⎰","lnap":"⪉","lnapprox":"⪉","lne":"⪇","lnE":"≨","lneq":"⪇","lneqq":"≨","lnsim":"⋦","loang":"⟬","loarr":"⇽","lobrk":"⟦","longleftarrow":"⟵","LongLeftArrow":"⟵","Longleftarrow":"⟸","longleftrightarrow":"⟷","LongLeftRightArrow":"⟷","Longleftrightarrow":"⟺","longmapsto":"⟼","longrightarrow":"⟶","LongRightArrow":"⟶","Longrightarrow":"⟹","looparrowleft":"↫","looparrowright":"↬","lopar":"⦅","Lopf":"𝕃","lopf":"𝕝","loplus":"⨭","lotimes":"⨴","lowast":"∗","lowbar":"_","LowerLeftArrow":"↙","LowerRightArrow":"↘","loz":"◊","lozenge":"◊","lozf":"⧫","lpar":"(","lparlt":"⦓","lrarr":"⇆","lrcorner":"⌟","lrhar":"⇋","lrhard":"⥭","lrm":"","lrtri":"⊿","lsaquo":"‹","lscr":"𝓁","Lscr":"ℒ","lsh":"↰","Lsh":"↰","lsim":"≲","lsime":"⪍","lsimg":"⪏","lsqb":"[","lsquo":"‘","lsquor":"‚","Lstrok":"Ł","lstrok":"ł","ltcc":"⪦","ltcir":"⩹","lt":"<","LT":"<","Lt":"≪","ltdot":"⋖","lthree":"⋋","ltimes":"⋉","ltlarr":"⥶","ltquest":"⩻","ltri":"◃","ltrie":"⊴","ltrif":"◂","ltrPar":"⦖","lurdshar":"⥊","luruhar":"⥦","lvertneqq":"≨︀","lvnE":"≨︀","macr":"¯","male":"♂","malt":"✠","maltese":"✠","Map":"⤅","map":"↦","mapsto":"↦","mapstodown":"↧","mapstoleft":"↤","mapstoup":"↥","marker":"▮","mcomma":"⨩","Mcy":"М","mcy":"м","mdash":"—","mDDot":"∺","measuredangle":"∡","MediumSpace":" ","Mellintrf":"ℳ","Mfr":"𝔐","mfr":"𝔪","mho":"℧","micro":"µ","midast":"*","midcir":"⫰","mid":"∣","middot":"·","minusb":"⊟","minus":"−","minusd":"∸","minusdu":"⨪","MinusPlus":"∓","mlcp":"⫛","mldr":"…","mnplus":"∓","models":"⊧","Mopf":"𝕄","mopf":"𝕞","mp":"∓","mscr":"𝓂","Mscr":"ℳ","mstpos":"∾","Mu":"Μ","mu":"μ","multimap":"⊸","mumap":"⊸","nabla":"∇","Nacute":"Ń","nacute":"ń","nang":"∠⃒","nap":"≉","napE":"⩰̸","napid":"≋̸","napos":"ʼn","napprox":"≉","natural":"♮","naturals":"ℕ","natur":"♮","nbsp":" ","nbump":"≎̸","nbumpe":"≏̸","ncap":"⩃","Ncaron":"Ň","ncaron":"ň","Ncedil":"Ņ","ncedil":"ņ","ncong":"≇","ncongdot":"⩭̸","ncup":"⩂","Ncy":"Н","ncy":"н","ndash":"–","nearhk":"⤤","nearr":"↗","neArr":"⇗","nearrow":"↗","ne":"≠","nedot":"≐̸","NegativeMediumSpace":"","NegativeThickSpace":"","NegativeThinSpace":"","NegativeVeryThinSpace":"","nequiv":"≢","nesear":"⤨","nesim":"≂̸","NestedGreaterGreater":"≫","NestedLessLess":"≪","NewLine":"\n","nexist":"∄","nexists":"∄","Nfr":"𝔑","nfr":"𝔫","ngE":"≧̸","nge":"≱","ngeq":"≱","ngeqq":"≧̸","ngeqslant":"⩾̸","nges":"⩾̸","nGg":"⋙̸","ngsim":"≵","nGt":"≫⃒","ngt":"≯","ngtr":"≯","nGtv":"≫̸","nharr":"↮","nhArr":"⇎","nhpar":"⫲","ni":"∋","nis":"⋼","nisd":"⋺","niv":"∋","NJcy":"Њ","njcy":"њ","nlarr":"↚","nlArr":"⇍","nldr":"‥","nlE":"≦̸","nle":"≰","nleftarrow":"↚","nLeftarrow":"⇍","nleftrightarrow":"↮","nLeftrightarrow":"⇎","nleq":"≰","nleqq":"≦̸","nleqslant":"⩽̸","nles":"⩽̸","nless":"≮","nLl":"⋘̸","nlsim":"≴","nLt":"≪⃒","nlt":"≮","nltri":"⋪","nltrie":"⋬","nLtv":"≪̸","nmid":"∤","NoBreak":"","NonBreakingSpace":" ","nopf":"𝕟","Nopf":"ℕ","Not":"⫬","not":"¬","NotCongruent":"≢","NotCupCap":"≭","NotDoubleVerticalBar":"∦","NotElement":"∉","NotEqual":"≠","NotEqualTilde":"≂̸","NotExists":"∄","NotGreater":"≯","NotGreaterEqual":"≱","NotGreaterFullEqual":"≧̸","NotGreaterGreater":"≫̸","NotGreaterLess":"≹","NotGreaterSlantEqual":"⩾̸","NotGreaterTilde":"≵","NotHumpDownHump":"≎̸","NotHumpEqual":"≏̸","notin":"∉","notindot":"⋵̸","notinE":"⋹̸","notinva":"∉","notinvb":"⋷","notinvc":"⋶","NotLeftTriangleBar":"⧏̸","NotLeftTriangle":"⋪","NotLeftTriangleEqual":"⋬","NotLess":"≮","NotLessEqual":"≰","NotLessGreater":"≸","NotLessLess":"≪̸","NotLessSlantEqual":"⩽̸","NotLessTilde":"≴","NotNestedGreaterGreater":"⪢̸","NotNestedLessLess":"⪡̸","notni":"∌","notniva":"∌","notnivb":"⋾","notnivc":"⋽","NotPrecedes":"⊀","NotPrecedesEqual":"⪯̸","NotPrecedesSlantEqual":"⋠","NotReverseElement":"∌","NotRightTriangleBar":"⧐̸","NotRightTriangle":"⋫","NotRightTriangleEqual":"⋭","NotSquareSubset":"⊏̸","NotSquareSubsetEqual":"⋢","NotSquareSuperset":"⊐̸","NotSquareSupersetEqual":"⋣","NotSubset":"⊂⃒","NotSubsetEqual":"⊈","NotSucceeds":"⊁","NotSucceedsEqual":"⪰̸","NotSucceedsSlantEqual":"⋡","NotSucceedsTilde":"≿̸","NotSuperset":"⊃⃒","NotSupersetEqual":"⊉","NotTilde":"≁","NotTildeEqual":"≄","NotTildeFullEqual":"≇","NotTildeTilde":"≉","NotVerticalBar":"∤","nparallel":"∦","npar":"∦","nparsl":"⫽⃥","npart":"∂̸","npolint":"⨔","npr":"⊀","nprcue":"⋠","nprec":"⊀","npreceq":"⪯̸","npre":"⪯̸","nrarrc":"⤳̸","nrarr":"↛","nrArr":"⇏","nrarrw":"↝̸","nrightarrow":"↛","nRightarrow":"⇏","nrtri":"⋫","nrtrie":"⋭","nsc":"⊁","nsccue":"⋡","nsce":"⪰̸","Nscr":"𝒩","nscr":"𝓃","nshortmid":"∤","nshortparallel":"∦","nsim":"≁","nsime":"≄","nsimeq":"≄","nsmid":"∤","nspar":"∦","nsqsube":"⋢","nsqsupe":"⋣","nsub":"⊄","nsubE":"⫅̸","nsube":"⊈","nsubset":"⊂⃒","nsubseteq":"⊈","nsubseteqq":"⫅̸","nsucc":"⊁","nsucceq":"⪰̸","nsup":"⊅","nsupE":"⫆̸","nsupe":"⊉","nsupset":"⊃⃒","nsupseteq":"⊉","nsupseteqq":"⫆̸","ntgl":"≹","Ntilde":"Ñ","ntilde":"ñ","ntlg":"≸","ntriangleleft":"⋪","ntrianglelefteq":"⋬","ntriangleright":"⋫","ntrianglerighteq":"⋭","Nu":"Ν","nu":"ν","num":"#","numero":"№","numsp":" ","nvap":"≍⃒","nvdash":"⊬","nvDash":"⊭","nVdash":"⊮","nVDash":"⊯","nvge":"≥⃒","nvgt":">⃒","nvHarr":"⤄","nvinfin":"⧞","nvlArr":"⤂","nvle":"≤⃒","nvlt":"<⃒","nvltrie":"⊴⃒","nvrArr":"⤃","nvrtrie":"⊵⃒","nvsim":"∼⃒","nwarhk":"⤣","nwarr":"↖","nwArr":"⇖","nwarrow":"↖","nwnear":"⤧","Oacute":"Ó","oacute":"ó","oast":"⊛","Ocirc":"Ô","ocirc":"ô","ocir":"⊚","Ocy":"О","ocy":"о","odash":"⊝","Odblac":"Ő","odblac":"ő","odiv":"⨸","odot":"⊙","odsold":"⦼","OElig":"Œ","oelig":"œ","ofcir":"⦿","Ofr":"𝔒","ofr":"𝔬","ogon":"˛","Ograve":"Ò","ograve":"ò","ogt":"⧁","ohbar":"⦵","ohm":"Ω","oint":"∮","olarr":"↺","olcir":"⦾","olcross":"⦻","oline":"‾","olt":"⧀","Omacr":"Ō","omacr":"ō","Omega":"Ω","omega":"ω","Omicron":"Ο","omicron":"ο","omid":"⦶","ominus":"⊖","Oopf":"𝕆","oopf":"𝕠","opar":"⦷","OpenCurlyDoubleQuote":"“","OpenCurlyQuote":"‘","operp":"⦹","oplus":"⊕","orarr":"↻","Or":"⩔","or":"∨","ord":"⩝","order":"ℴ","orderof":"ℴ","ordf":"ª","ordm":"º","origof":"⊶","oror":"⩖","orslope":"⩗","orv":"⩛","oS":"Ⓢ","Oscr":"𝒪","oscr":"ℴ","Oslash":"Ø","oslash":"ø","osol":"⊘","Otilde":"Õ","otilde":"õ","otimesas":"⨶","Otimes":"⨷","otimes":"⊗","Ouml":"Ö","ouml":"ö","ovbar":"⌽","OverBar":"‾","OverBrace":"⏞","OverBracket":"⎴","OverParenthesis":"⏜","para":"¶","parallel":"∥","par":"∥","parsim":"⫳","parsl":"⫽","part":"∂","PartialD":"∂","Pcy":"П","pcy":"п","percnt":"%","period":".","permil":"‰","perp":"⊥","pertenk":"‱","Pfr":"𝔓","pfr":"𝔭","Phi":"Φ","phi":"φ","phiv":"ϕ","phmmat":"ℳ","phone":"☎","Pi":"Π","pi":"π","pitchfork":"⋔","piv":"ϖ","planck":"ℏ","planckh":"ℎ","plankv":"ℏ","plusacir":"⨣","plusb":"⊞","pluscir":"⨢","plus":"+","plusdo":"∔","plusdu":"⨥","pluse":"⩲","PlusMinus":"±","plusmn":"±","plussim":"⨦","plustwo":"⨧","pm":"±","Poincareplane":"ℌ","pointint":"⨕","popf":"𝕡","Popf":"ℙ","pound":"£","prap":"⪷","Pr":"⪻","pr":"≺","prcue":"≼","precapprox":"⪷","prec":"≺","preccurlyeq":"≼","Precedes":"≺","PrecedesEqual":"⪯","PrecedesSlantEqual":"≼","PrecedesTilde":"≾","preceq":"⪯","precnapprox":"⪹","precneqq":"⪵","precnsim":"⋨","pre":"⪯","prE":"⪳","precsim":"≾","prime":"′","Prime":"″","primes":"ℙ","prnap":"⪹","prnE":"⪵","prnsim":"⋨","prod":"∏","Product":"∏","profalar":"⌮","profline":"⌒","profsurf":"⌓","prop":"∝","Proportional":"∝","Proportion":"∷","propto":"∝","prsim":"≾","prurel":"⊰","Pscr":"𝒫","pscr":"𝓅","Psi":"Ψ","psi":"ψ","puncsp":" ","Qfr":"𝔔","qfr":"𝔮","qint":"⨌","qopf":"𝕢","Qopf":"ℚ","qprime":"⁗","Qscr":"𝒬","qscr":"𝓆","quaternions":"ℍ","quatint":"⨖","quest":"?","questeq":"≟","quot":"\"","QUOT":"\"","rAarr":"⇛","race":"∽̱","Racute":"Ŕ","racute":"ŕ","radic":"√","raemptyv":"⦳","rang":"⟩","Rang":"⟫","rangd":"⦒","range":"⦥","rangle":"⟩","raquo":"»","rarrap":"⥵","rarrb":"⇥","rarrbfs":"⤠","rarrc":"⤳","rarr":"→","Rarr":"↠","rArr":"⇒","rarrfs":"⤞","rarrhk":"↪","rarrlp":"↬","rarrpl":"⥅","rarrsim":"⥴","Rarrtl":"⤖","rarrtl":"↣","rarrw":"↝","ratail":"⤚","rAtail":"⤜","ratio":"∶","rationals":"ℚ","rbarr":"⤍","rBarr":"⤏","RBarr":"⤐","rbbrk":"❳","rbrace":"}","rbrack":"]","rbrke":"⦌","rbrksld":"⦎","rbrkslu":"⦐","Rcaron":"Ř","rcaron":"ř","Rcedil":"Ŗ","rcedil":"ŗ","rceil":"⌉","rcub":"}","Rcy":"Р","rcy":"р","rdca":"⤷","rdldhar":"⥩","rdquo":"”","rdquor":"”","rdsh":"↳","real":"ℜ","realine":"ℛ","realpart":"ℜ","reals":"ℝ","Re":"ℜ","rect":"▭","reg":"®","REG":"®","ReverseElement":"∋","ReverseEquilibrium":"⇋","ReverseUpEquilibrium":"⥯","rfisht":"⥽","rfloor":"⌋","rfr":"𝔯","Rfr":"ℜ","rHar":"⥤","rhard":"⇁","rharu":"⇀","rharul":"⥬","Rho":"Ρ","rho":"ρ","rhov":"ϱ","RightAngleBracket":"⟩","RightArrowBar":"⇥","rightarrow":"→","RightArrow":"→","Rightarrow":"⇒","RightArrowLeftArrow":"⇄","rightarrowtail":"↣","RightCeiling":"⌉","RightDoubleBracket":"⟧","RightDownTeeVector":"⥝","RightDownVectorBar":"⥕","RightDownVector":"⇂","RightFloor":"⌋","rightharpoondown":"⇁","rightharpoonup":"⇀","rightleftarrows":"⇄","rightleftharpoons":"⇌","rightrightarrows":"⇉","rightsquigarrow":"↝","RightTeeArrow":"↦","RightTee":"⊢","RightTeeVector":"⥛","rightthreetimes":"⋌","RightTriangleBar":"⧐","RightTriangle":"⊳","RightTriangleEqual":"⊵","RightUpDownVector":"⥏","RightUpTeeVector":"⥜","RightUpVectorBar":"⥔","RightUpVector":"↾","RightVectorBar":"⥓","RightVector":"⇀","ring":"˚","risingdotseq":"≓","rlarr":"⇄","rlhar":"⇌","rlm":"","rmoustache":"⎱","rmoust":"⎱","rnmid":"⫮","roang":"⟭","roarr":"⇾","robrk":"⟧","ropar":"⦆","ropf":"𝕣","Ropf":"ℝ","roplus":"⨮","rotimes":"⨵","RoundImplies":"⥰","rpar":")","rpargt":"⦔","rppolint":"⨒","rrarr":"⇉","Rrightarrow":"⇛","rsaquo":"›","rscr":"𝓇","Rscr":"ℛ","rsh":"↱","Rsh":"↱","rsqb":"]","rsquo":"’","rsquor":"’","rthree":"⋌","rtimes":"⋊","rtri":"▹","rtrie":"⊵","rtrif":"▸","rtriltri":"⧎","RuleDelayed":"⧴","ruluhar":"⥨","rx":"℞","Sacute":"Ś","sacute":"ś","sbquo":"‚","scap":"⪸","Scaron":"Š","scaron":"š","Sc":"⪼","sc":"≻","sccue":"≽","sce":"⪰","scE":"⪴","Scedil":"Ş","scedil":"ş","Scirc":"Ŝ","scirc":"ŝ","scnap":"⪺","scnE":"⪶","scnsim":"⋩","scpolint":"⨓","scsim":"≿","Scy":"С","scy":"с","sdotb":"⊡","sdot":"⋅","sdote":"⩦","searhk":"⤥","searr":"↘","seArr":"⇘","searrow":"↘","sect":"§","semi":";","seswar":"⤩","setminus":"∖","setmn":"∖","sext":"✶","Sfr":"𝔖","sfr":"𝔰","sfrown":"⌢","sharp":"♯","SHCHcy":"Щ","shchcy":"щ","SHcy":"Ш","shcy":"ш","ShortDownArrow":"↓","ShortLeftArrow":"←","shortmid":"∣","shortparallel":"∥","ShortRightArrow":"→","ShortUpArrow":"↑","shy":"","Sigma":"Σ","sigma":"σ","sigmaf":"ς","sigmav":"ς","sim":"∼","simdot":"⩪","sime":"≃","simeq":"≃","simg":"⪞","simgE":"⪠","siml":"⪝","simlE":"⪟","simne":"≆","simplus":"⨤","simrarr":"⥲","slarr":"←","SmallCircle":"∘","smallsetminus":"∖","smashp":"⨳","smeparsl":"⧤","smid":"∣","smile":"⌣","smt":"⪪","smte":"⪬","smtes":"⪬︀","SOFTcy":"Ь","softcy":"ь","solbar":"⌿","solb":"⧄","sol":"/","Sopf":"𝕊","sopf":"𝕤","spades":"♠","spadesuit":"♠","spar":"∥","sqcap":"⊓","sqcaps":"⊓︀","sqcup":"⊔","sqcups":"⊔︀","Sqrt":"√","sqsub":"⊏","sqsube":"⊑","sqsubset":"⊏","sqsubseteq":"⊑","sqsup":"⊐","sqsupe":"⊒","sqsupset":"⊐","sqsupseteq":"⊒","square":"□","Square":"□","SquareIntersection":"⊓","SquareSubset":"⊏","SquareSubsetEqual":"⊑","SquareSuperset":"⊐","SquareSupersetEqual":"⊒","SquareUnion":"⊔","squarf":"▪","squ":"□","squf":"▪","srarr":"→","Sscr":"𝒮","sscr":"𝓈","ssetmn":"∖","ssmile":"⌣","sstarf":"⋆","Star":"⋆","star":"☆","starf":"★","straightepsilon":"ϵ","straightphi":"ϕ","strns":"¯","sub":"⊂","Sub":"⋐","subdot":"⪽","subE":"⫅","sube":"⊆","subedot":"⫃","submult":"⫁","subnE":"⫋","subne":"⊊","subplus":"⪿","subrarr":"⥹","subset":"⊂","Subset":"⋐","subseteq":"⊆","subseteqq":"⫅","SubsetEqual":"⊆","subsetneq":"⊊","subsetneqq":"⫋","subsim":"⫇","subsub":"⫕","subsup":"⫓","succapprox":"⪸","succ":"≻","succcurlyeq":"≽","Succeeds":"≻","SucceedsEqual":"⪰","SucceedsSlantEqual":"≽","SucceedsTilde":"≿","succeq":"⪰","succnapprox":"⪺","succneqq":"⪶","succnsim":"⋩","succsim":"≿","SuchThat":"∋","sum":"∑","Sum":"∑","sung":"♪","sup1":"¹","sup2":"²","sup3":"³","sup":"⊃","Sup":"⋑","supdot":"⪾","supdsub":"⫘","supE":"⫆","supe":"⊇","supedot":"⫄","Superset":"⊃","SupersetEqual":"⊇","suphsol":"⟉","suphsub":"⫗","suplarr":"⥻","supmult":"⫂","supnE":"⫌","supne":"⊋","supplus":"⫀","supset":"⊃","Supset":"⋑","supseteq":"⊇","supseteqq":"⫆","supsetneq":"⊋","supsetneqq":"⫌","supsim":"⫈","supsub":"⫔","supsup":"⫖","swarhk":"⤦","swarr":"↙","swArr":"⇙","swarrow":"↙","swnwar":"⤪","szlig":"ß","Tab":"\t","target":"⌖","Tau":"Τ","tau":"τ","tbrk":"⎴","Tcaron":"Ť","tcaron":"ť","Tcedil":"Ţ","tcedil":"ţ","Tcy":"Т","tcy":"т","tdot":"⃛","telrec":"⌕","Tfr":"𝔗","tfr":"𝔱","there4":"∴","therefore":"∴","Therefore":"∴","Theta":"Θ","theta":"θ","thetasym":"ϑ","thetav":"ϑ","thickapprox":"≈","thicksim":"∼","ThickSpace":" ","ThinSpace":" ","thinsp":" ","thkap":"≈","thksim":"∼","THORN":"Þ","thorn":"þ","tilde":"˜","Tilde":"∼","TildeEqual":"≃","TildeFullEqual":"≅","TildeTilde":"≈","timesbar":"⨱","timesb":"⊠","times":"×","timesd":"⨰","tint":"∭","toea":"⤨","topbot":"⌶","topcir":"⫱","top":"⊤","Topf":"𝕋","topf":"𝕥","topfork":"⫚","tosa":"⤩","tprime":"‴","trade":"™","TRADE":"™","triangle":"▵","triangledown":"▿","triangleleft":"◃","trianglelefteq":"⊴","triangleq":"≜","triangleright":"▹","trianglerighteq":"⊵","tridot":"◬","trie":"≜","triminus":"⨺","TripleDot":"⃛","triplus":"⨹","trisb":"⧍","tritime":"⨻","trpezium":"⏢","Tscr":"𝒯","tscr":"𝓉","TScy":"Ц","tscy":"ц","TSHcy":"Ћ","tshcy":"ћ","Tstrok":"Ŧ","tstrok":"ŧ","twixt":"≬","twoheadleftarrow":"↞","twoheadrightarrow":"↠","Uacute":"Ú","uacute":"ú","uarr":"↑","Uarr":"↟","uArr":"⇑","Uarrocir":"⥉","Ubrcy":"Ў","ubrcy":"ў","Ubreve":"Ŭ","ubreve":"ŭ","Ucirc":"Û","ucirc":"û","Ucy":"У","ucy":"у","udarr":"⇅","Udblac":"Ű","udblac":"ű","udhar":"⥮","ufisht":"⥾","Ufr":"𝔘","ufr":"𝔲","Ugrave":"Ù","ugrave":"ù","uHar":"⥣","uharl":"↿","uharr":"↾","uhblk":"▀","ulcorn":"⌜","ulcorner":"⌜","ulcrop":"⌏","ultri":"◸","Umacr":"Ū","umacr":"ū","uml":"¨","UnderBar":"_","UnderBrace":"⏟","UnderBracket":"⎵","UnderParenthesis":"⏝","Union":"⋃","UnionPlus":"⊎","Uogon":"Ų","uogon":"ų","Uopf":"𝕌","uopf":"𝕦","UpArrowBar":"⤒","uparrow":"↑","UpArrow":"↑","Uparrow":"⇑","UpArrowDownArrow":"⇅","updownarrow":"↕","UpDownArrow":"↕","Updownarrow":"⇕","UpEquilibrium":"⥮","upharpoonleft":"↿","upharpoonright":"↾","uplus":"⊎","UpperLeftArrow":"↖","UpperRightArrow":"↗","upsi":"υ","Upsi":"ϒ","upsih":"ϒ","Upsilon":"Υ","upsilon":"υ","UpTeeArrow":"↥","UpTee":"⊥","upuparrows":"⇈","urcorn":"⌝","urcorner":"⌝","urcrop":"⌎","Uring":"Ů","uring":"ů","urtri":"◹","Uscr":"𝒰","uscr":"𝓊","utdot":"⋰","Utilde":"Ũ","utilde":"ũ","utri":"▵","utrif":"▴","uuarr":"⇈","Uuml":"Ü","uuml":"ü","uwangle":"⦧","vangrt":"⦜","varepsilon":"ϵ","varkappa":"ϰ","varnothing":"∅","varphi":"ϕ","varpi":"ϖ","varpropto":"∝","varr":"↕","vArr":"⇕","varrho":"ϱ","varsigma":"ς","varsubsetneq":"⊊︀","varsubsetneqq":"⫋︀","varsupsetneq":"⊋︀","varsupsetneqq":"⫌︀","vartheta":"ϑ","vartriangleleft":"⊲","vartriangleright":"⊳","vBar":"⫨","Vbar":"⫫","vBarv":"⫩","Vcy":"В","vcy":"в","vdash":"⊢","vDash":"⊨","Vdash":"⊩","VDash":"⊫","Vdashl":"⫦","veebar":"⊻","vee":"∨","Vee":"⋁","veeeq":"≚","vellip":"⋮","verbar":"|","Verbar":"‖","vert":"|","Vert":"‖","VerticalBar":"∣","VerticalLine":"|","VerticalSeparator":"❘","VerticalTilde":"≀","VeryThinSpace":" ","Vfr":"𝔙","vfr":"𝔳","vltri":"⊲","vnsub":"⊂⃒","vnsup":"⊃⃒","Vopf":"𝕍","vopf":"𝕧","vprop":"∝","vrtri":"⊳","Vscr":"𝒱","vscr":"𝓋","vsubnE":"⫋︀","vsubne":"⊊︀","vsupnE":"⫌︀","vsupne":"⊋︀","Vvdash":"⊪","vzigzag":"⦚","Wcirc":"Ŵ","wcirc":"ŵ","wedbar":"⩟","wedge":"∧","Wedge":"⋀","wedgeq":"≙","weierp":"℘","Wfr":"𝔚","wfr":"𝔴","Wopf":"𝕎","wopf":"𝕨","wp":"℘","wr":"≀","wreath":"≀","Wscr":"𝒲","wscr":"𝓌","xcap":"⋂","xcirc":"◯","xcup":"⋃","xdtri":"▽","Xfr":"𝔛","xfr":"𝔵","xharr":"⟷","xhArr":"⟺","Xi":"Ξ","xi":"ξ","xlarr":"⟵","xlArr":"⟸","xmap":"⟼","xnis":"⋻","xodot":"⨀","Xopf":"𝕏","xopf":"𝕩","xoplus":"⨁","xotime":"⨂","xrarr":"⟶","xrArr":"⟹","Xscr":"𝒳","xscr":"𝓍","xsqcup":"⨆","xuplus":"⨄","xutri":"△","xvee":"⋁","xwedge":"⋀","Yacute":"Ý","yacute":"ý","YAcy":"Я","yacy":"я","Ycirc":"Ŷ","ycirc":"ŷ","Ycy":"Ы","ycy":"ы","yen":"¥","Yfr":"𝔜","yfr":"𝔶","YIcy":"Ї","yicy":"ї","Yopf":"𝕐","yopf":"𝕪","Yscr":"𝒴","yscr":"𝓎","YUcy":"Ю","yucy":"ю","yuml":"ÿ","Yuml":"Ÿ","Zacute":"Ź","zacute":"ź","Zcaron":"Ž","zcaron":"ž","Zcy":"З","zcy":"з","Zdot":"Ż","zdot":"ż","zeetrf":"ℨ","ZeroWidthSpace":"","Zeta":"Ζ","zeta":"ζ","zfr":"𝔷","Zfr":"ℨ","ZHcy":"Ж","zhcy":"ж","zigrarr":"⇝","zopf":"𝕫","Zopf":"ℤ","Zscr":"𝒵","zscr":"𝓏","zwj":"","zwnj":""}
|
3874 |
-
|
3875 |
-
/***/ },
|
3876 |
-
|
3877 |
-
/***/ 472:
|
3878 |
-
/***/ function(module, exports) {
|
3879 |
-
|
3880 |
-
module.exports = {"Aacute":"Á","aacute":"á","Acirc":"Â","acirc":"â","acute":"´","AElig":"Æ","aelig":"æ","Agrave":"À","agrave":"à","amp":"&","AMP":"&","Aring":"Å","aring":"å","Atilde":"Ã","atilde":"ã","Auml":"Ä","auml":"ä","brvbar":"¦","Ccedil":"Ç","ccedil":"ç","cedil":"¸","cent":"¢","copy":"©","COPY":"©","curren":"¤","deg":"°","divide":"÷","Eacute":"É","eacute":"é","Ecirc":"Ê","ecirc":"ê","Egrave":"È","egrave":"è","ETH":"Ð","eth":"ð","Euml":"Ë","euml":"ë","frac12":"½","frac14":"¼","frac34":"¾","gt":">","GT":">","Iacute":"Í","iacute":"í","Icirc":"Î","icirc":"î","iexcl":"¡","Igrave":"Ì","igrave":"ì","iquest":"¿","Iuml":"Ï","iuml":"ï","laquo":"«","lt":"<","LT":"<","macr":"¯","micro":"µ","middot":"·","nbsp":" ","not":"¬","Ntilde":"Ñ","ntilde":"ñ","Oacute":"Ó","oacute":"ó","Ocirc":"Ô","ocirc":"ô","Ograve":"Ò","ograve":"ò","ordf":"ª","ordm":"º","Oslash":"Ø","oslash":"ø","Otilde":"Õ","otilde":"õ","Ouml":"Ö","ouml":"ö","para":"¶","plusmn":"±","pound":"£","quot":"\"","QUOT":"\"","raquo":"»","reg":"®","REG":"®","sect":"§","shy":"","sup1":"¹","sup2":"²","sup3":"³","szlig":"ß","THORN":"Þ","thorn":"þ","times":"×","Uacute":"Ú","uacute":"ú","Ucirc":"Û","ucirc":"û","Ugrave":"Ù","ugrave":"ù","uml":"¨","Uuml":"Ü","uuml":"ü","Yacute":"Ý","yacute":"ý","yen":"¥","yuml":"ÿ"}
|
3881 |
-
|
3882 |
-
/***/ },
|
3883 |
-
|
3884 |
-
/***/ 473:
|
3885 |
-
/***/ function(module, exports) {
|
3886 |
-
|
3887 |
-
module.exports = {"amp":"&","apos":"'","gt":">","lt":"<","quot":"\""}
|
3888 |
-
|
3889 |
-
/***/ },
|
3890 |
-
|
3891 |
-
/***/ 474:
|
3892 |
-
/***/ function(module, exports) {
|
3893 |
-
|
3894 |
-
if (typeof Object.create === 'function') {
|
3895 |
-
// implementation from standard node.js 'util' module
|
3896 |
-
module.exports = function inherits(ctor, superCtor) {
|
3897 |
-
ctor.super_ = superCtor
|
3898 |
-
ctor.prototype = Object.create(superCtor.prototype, {
|
3899 |
-
constructor: {
|
3900 |
-
value: ctor,
|
3901 |
-
enumerable: false,
|
3902 |
-
writable: true,
|
3903 |
-
configurable: true
|
3904 |
-
}
|
3905 |
-
});
|
3906 |
-
};
|
3907 |
-
} else {
|
3908 |
-
// old school shim for old browsers
|
3909 |
-
module.exports = function inherits(ctor, superCtor) {
|
3910 |
-
ctor.super_ = superCtor
|
3911 |
-
var TempCtor = function () {}
|
3912 |
-
TempCtor.prototype = superCtor.prototype
|
3913 |
-
ctor.prototype = new TempCtor()
|
3914 |
-
ctor.prototype.constructor = ctor
|
3915 |
-
}
|
3916 |
-
}
|
3917 |
-
|
3918 |
-
|
3919 |
-
/***/ },
|
3920 |
-
|
3921 |
-
/***/ 475:
|
3922 |
-
/***/ function(module, exports) {
|
3923 |
-
|
3924 |
-
// Copyright Joyent, Inc. and other Node contributors.
|
3925 |
-
//
|
3926 |
-
// Permission is hereby granted, free of charge, to any person obtaining a
|
3927 |
-
// copy of this software and associated documentation files (the
|
3928 |
-
// "Software"), to deal in the Software without restriction, including
|
3929 |
-
// without limitation the rights to use, copy, modify, merge, publish,
|
3930 |
-
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
3931 |
-
// persons to whom the Software is furnished to do so, subject to the
|
3932 |
-
// following conditions:
|
3933 |
-
//
|
3934 |
-
// The above copyright notice and this permission notice shall be included
|
3935 |
-
// in all copies or substantial portions of the Software.
|
3936 |
-
//
|
3937 |
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
3938 |
-
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
3939 |
-
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
3940 |
-
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
3941 |
-
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
3942 |
-
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
3943 |
-
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
3944 |
-
|
3945 |
-
function EventEmitter() {
|
3946 |
-
this._events = this._events || {};
|
3947 |
-
this._maxListeners = this._maxListeners || undefined;
|
3948 |
-
}
|
3949 |
-
module.exports = EventEmitter;
|
3950 |
-
|
3951 |
-
// Backwards-compat with node 0.10.x
|
3952 |
-
EventEmitter.EventEmitter = EventEmitter;
|
3953 |
-
|
3954 |
-
EventEmitter.prototype._events = undefined;
|
3955 |
-
EventEmitter.prototype._maxListeners = undefined;
|
3956 |
-
|
3957 |
-
// By default EventEmitters will print a warning if more than 10 listeners are
|
3958 |
-
// added to it. This is a useful default which helps finding memory leaks.
|
3959 |
-
EventEmitter.defaultMaxListeners = 10;
|
3960 |
-
|
3961 |
-
// Obviously not all Emitters should be limited to 10. This function allows
|
3962 |
-
// that to be increased. Set to zero for unlimited.
|
3963 |
-
EventEmitter.prototype.setMaxListeners = function(n) {
|
3964 |
-
if (!isNumber(n) || n < 0 || isNaN(n))
|
3965 |
-
throw TypeError('n must be a positive number');
|
3966 |
-
this._maxListeners = n;
|
3967 |
-
return this;
|
3968 |
-
};
|
3969 |
-
|
3970 |
-
EventEmitter.prototype.emit = function(type) {
|
3971 |
-
var er, handler, len, args, i, listeners;
|
3972 |
-
|
3973 |
-
if (!this._events)
|
3974 |
-
this._events = {};
|
3975 |
-
|
3976 |
-
// If there is no 'error' event listener then throw.
|
3977 |
-
if (type === 'error') {
|
3978 |
-
if (!this._events.error ||
|
3979 |
-
(isObject(this._events.error) && !this._events.error.length)) {
|
3980 |
-
er = arguments[1];
|
3981 |
-
if (er instanceof Error) {
|
3982 |
-
throw er; // Unhandled 'error' event
|
3983 |
-
} else {
|
3984 |
-
// At least give some kind of context to the user
|
3985 |
-
var err = new Error('Uncaught, unspecified "error" event. (' + er + ')');
|
3986 |
-
err.context = er;
|
3987 |
-
throw err;
|
3988 |
-
}
|
3989 |
-
}
|
3990 |
-
}
|
3991 |
-
|
3992 |
-
handler = this._events[type];
|
3993 |
-
|
3994 |
-
if (isUndefined(handler))
|
3995 |
-
return false;
|
3996 |
-
|
3997 |
-
if (isFunction(handler)) {
|
3998 |
-
switch (arguments.length) {
|
3999 |
-
// fast cases
|
4000 |
-
case 1:
|
4001 |
-
handler.call(this);
|
4002 |
-
break;
|
4003 |
-
case 2:
|
4004 |
-
handler.call(this, arguments[1]);
|
4005 |
-
break;
|
4006 |
-
case 3:
|
4007 |
-
handler.call(this, arguments[1], arguments[2]);
|
4008 |
-
break;
|
4009 |
-
// slower
|
4010 |
-
default:
|
4011 |
-
args = Array.prototype.slice.call(arguments, 1);
|
4012 |
-
handler.apply(this, args);
|
4013 |
-
}
|
4014 |
-
} else if (isObject(handler)) {
|
4015 |
-
args = Array.prototype.slice.call(arguments, 1);
|
4016 |
-
listeners = handler.slice();
|
4017 |
-
len = listeners.length;
|
4018 |
-
for (i = 0; i < len; i++)
|
4019 |
-
listeners[i].apply(this, args);
|
4020 |
-
}
|
4021 |
-
|
4022 |
-
return true;
|
4023 |
-
};
|
4024 |
-
|
4025 |
-
EventEmitter.prototype.addListener = function(type, listener) {
|
4026 |
-
var m;
|
4027 |
-
|
4028 |
-
if (!isFunction(listener))
|
4029 |
-
throw TypeError('listener must be a function');
|
4030 |
-
|
4031 |
-
if (!this._events)
|
4032 |
-
this._events = {};
|
4033 |
-
|
4034 |
-
// To avoid recursion in the case that type === "newListener"! Before
|
4035 |
-
// adding it to the listeners, first emit "newListener".
|
4036 |
-
if (this._events.newListener)
|
4037 |
-
this.emit('newListener', type,
|
4038 |
-
isFunction(listener.listener) ?
|
4039 |
-
listener.listener : listener);
|
4040 |
-
|
4041 |
-
if (!this._events[type])
|
4042 |
-
// Optimize the case of one listener. Don't need the extra array object.
|
4043 |
-
this._events[type] = listener;
|
4044 |
-
else if (isObject(this._events[type]))
|
4045 |
-
// If we've already got an array, just append.
|
4046 |
-
this._events[type].push(listener);
|
4047 |
-
else
|
4048 |
-
// Adding the second element, need to change to array.
|
4049 |
-
this._events[type] = [this._events[type], listener];
|
4050 |
-
|
4051 |
-
// Check for listener leak
|
4052 |
-
if (isObject(this._events[type]) && !this._events[type].warned) {
|
4053 |
-
if (!isUndefined(this._maxListeners)) {
|
4054 |
-
m = this._maxListeners;
|
4055 |
-
} else {
|
4056 |
-
m = EventEmitter.defaultMaxListeners;
|
4057 |
-
}
|
4058 |
-
|
4059 |
-
if (m && m > 0 && this._events[type].length > m) {
|
4060 |
-
this._events[type].warned = true;
|
4061 |
-
console.error('(node) warning: possible EventEmitter memory ' +
|
4062 |
-
'leak detected. %d listeners added. ' +
|
4063 |
-
'Use emitter.setMaxListeners() to increase limit.',
|
4064 |
-
this._events[type].length);
|
4065 |
-
if (typeof console.trace === 'function') {
|
4066 |
-
// not supported in IE 10
|
4067 |
-
console.trace();
|
4068 |
-
}
|
4069 |
-
}
|
4070 |
-
}
|
4071 |
-
|
4072 |
-
return this;
|
4073 |
-
};
|
4074 |
-
|
4075 |
-
EventEmitter.prototype.on = EventEmitter.prototype.addListener;
|
4076 |
-
|
4077 |
-
EventEmitter.prototype.once = function(type, listener) {
|
4078 |
-
if (!isFunction(listener))
|
4079 |
-
throw TypeError('listener must be a function');
|
4080 |
-
|
4081 |
-
var fired = false;
|
4082 |
-
|
4083 |
-
function g() {
|
4084 |
-
this.removeListener(type, g);
|
4085 |
-
|
4086 |
-
if (!fired) {
|
4087 |
-
fired = true;
|
4088 |
-
listener.apply(this, arguments);
|
4089 |
-
}
|
4090 |
-
}
|
4091 |
-
|
4092 |
-
g.listener = listener;
|
4093 |
-
this.on(type, g);
|
4094 |
-
|
4095 |
-
return this;
|
4096 |
-
};
|
4097 |
-
|
4098 |
-
// emits a 'removeListener' event iff the listener was removed
|
4099 |
-
EventEmitter.prototype.removeListener = function(type, listener) {
|
4100 |
-
var list, position, length, i;
|
4101 |
-
|
4102 |
-
if (!isFunction(listener))
|
4103 |
-
throw TypeError('listener must be a function');
|
4104 |
-
|
4105 |
-
if (!this._events || !this._events[type])
|
4106 |
-
return this;
|
4107 |
-
|
4108 |
-
list = this._events[type];
|
4109 |
-
length = list.length;
|
4110 |
-
position = -1;
|
4111 |
-
|
4112 |
-
if (list === listener ||
|
4113 |
-
(isFunction(list.listener) && list.listener === listener)) {
|
4114 |
-
delete this._events[type];
|
4115 |
-
if (this._events.removeListener)
|
4116 |
-
this.emit('removeListener', type, listener);
|
4117 |
-
|
4118 |
-
} else if (isObject(list)) {
|
4119 |
-
for (i = length; i-- > 0;) {
|
4120 |
-
if (list[i] === listener ||
|
4121 |
-
(list[i].listener && list[i].listener === listener)) {
|
4122 |
-
position = i;
|
4123 |
-
break;
|
4124 |
-
}
|
4125 |
-
}
|
4126 |
-
|
4127 |
-
if (position < 0)
|
4128 |
-
return this;
|
4129 |
-
|
4130 |
-
if (list.length === 1) {
|
4131 |
-
list.length = 0;
|
4132 |
-
delete this._events[type];
|
4133 |
-
} else {
|
4134 |
-
list.splice(position, 1);
|
4135 |
-
}
|
4136 |
-
|
4137 |
-
if (this._events.removeListener)
|
4138 |
-
this.emit('removeListener', type, listener);
|
4139 |
-
}
|
4140 |
-
|
4141 |
-
return this;
|
4142 |
-
};
|
4143 |
-
|
4144 |
-
EventEmitter.prototype.removeAllListeners = function(type) {
|
4145 |
-
var key, listeners;
|
4146 |
-
|
4147 |
-
if (!this._events)
|
4148 |
-
return this;
|
4149 |
-
|
4150 |
-
// not listening for removeListener, no need to emit
|
4151 |
-
if (!this._events.removeListener) {
|
4152 |
-
if (arguments.length === 0)
|
4153 |
-
this._events = {};
|
4154 |
-
else if (this._events[type])
|
4155 |
-
delete this._events[type];
|
4156 |
-
return this;
|
4157 |
-
}
|
4158 |
-
|
4159 |
-
// emit removeListener for all listeners on all events
|
4160 |
-
if (arguments.length === 0) {
|
4161 |
-
for (key in this._events) {
|
4162 |
-
if (key === 'removeListener') continue;
|
4163 |
-
this.removeAllListeners(key);
|
4164 |
-
}
|
4165 |
-
this.removeAllListeners('removeListener');
|
4166 |
-
this._events = {};
|
4167 |
-
return this;
|
4168 |
-
}
|
4169 |
-
|
4170 |
-
listeners = this._events[type];
|
4171 |
-
|
4172 |
-
if (isFunction(listeners)) {
|
4173 |
-
this.removeListener(type, listeners);
|
4174 |
-
} else if (listeners) {
|
4175 |
-
// LIFO order
|
4176 |
-
while (listeners.length)
|
4177 |
-
this.removeListener(type, listeners[listeners.length - 1]);
|
4178 |
-
}
|
4179 |
-
delete this._events[type];
|
4180 |
-
|
4181 |
-
return this;
|
4182 |
-
};
|
4183 |
-
|
4184 |
-
EventEmitter.prototype.listeners = function(type) {
|
4185 |
-
var ret;
|
4186 |
-
if (!this._events || !this._events[type])
|
4187 |
-
ret = [];
|
4188 |
-
else if (isFunction(this._events[type]))
|
4189 |
-
ret = [this._events[type]];
|
4190 |
-
else
|
4191 |
-
ret = this._events[type].slice();
|
4192 |
-
return ret;
|
4193 |
-
};
|
4194 |
-
|
4195 |
-
EventEmitter.prototype.listenerCount = function(type) {
|
4196 |
-
if (this._events) {
|
4197 |
-
var evlistener = this._events[type];
|
4198 |
-
|
4199 |
-
if (isFunction(evlistener))
|
4200 |
-
return 1;
|
4201 |
-
else if (evlistener)
|
4202 |
-
return evlistener.length;
|
4203 |
-
}
|
4204 |
-
return 0;
|
4205 |
-
};
|
4206 |
-
|
4207 |
-
EventEmitter.listenerCount = function(emitter, type) {
|
4208 |
-
return emitter.listenerCount(type);
|
4209 |
-
};
|
4210 |
-
|
4211 |
-
function isFunction(arg) {
|
4212 |
-
return typeof arg === 'function';
|
4213 |
-
}
|
4214 |
-
|
4215 |
-
function isNumber(arg) {
|
4216 |
-
return typeof arg === 'number';
|
4217 |
-
}
|
4218 |
-
|
4219 |
-
function isObject(arg) {
|
4220 |
-
return typeof arg === 'object' && arg !== null;
|
4221 |
-
}
|
4222 |
-
|
4223 |
-
function isUndefined(arg) {
|
4224 |
-
return arg === void 0;
|
4225 |
-
}
|
4226 |
-
|
4227 |
-
|
4228 |
-
/***/ },
|
4229 |
-
|
4230 |
-
/***/ 476:
|
4231 |
-
/***/ function(module, exports, __webpack_require__) {
|
4232 |
-
|
4233 |
-
var ElementType = __webpack_require__(477);
|
4234 |
-
|
4235 |
-
var re_whitespace = /\s+/g;
|
4236 |
-
var NodePrototype = __webpack_require__(478);
|
4237 |
-
var ElementPrototype = __webpack_require__(479);
|
4238 |
-
|
4239 |
-
function DomHandler(callback, options, elementCB){
|
4240 |
-
if(typeof callback === "object"){
|
4241 |
-
elementCB = options;
|
4242 |
-
options = callback;
|
4243 |
-
callback = null;
|
4244 |
-
} else if(typeof options === "function"){
|
4245 |
-
elementCB = options;
|
4246 |
-
options = defaultOpts;
|
4247 |
-
}
|
4248 |
-
this._callback = callback;
|
4249 |
-
this._options = options || defaultOpts;
|
4250 |
-
this._elementCB = elementCB;
|
4251 |
-
this.dom = [];
|
4252 |
-
this._done = false;
|
4253 |
-
this._tagStack = [];
|
4254 |
-
this._parser = this._parser || null;
|
4255 |
-
}
|
4256 |
-
|
4257 |
-
//default options
|
4258 |
-
var defaultOpts = {
|
4259 |
-
normalizeWhitespace: false, //Replace all whitespace with single spaces
|
4260 |
-
withStartIndices: false, //Add startIndex properties to nodes
|
4261 |
-
withEndIndices: false, //Add endIndex properties to nodes
|
4262 |
-
};
|
4263 |
-
|
4264 |
-
DomHandler.prototype.onparserinit = function(parser){
|
4265 |
-
this._parser = parser;
|
4266 |
-
};
|
4267 |
-
|
4268 |
-
//Resets the handler back to starting state
|
4269 |
-
DomHandler.prototype.onreset = function(){
|
4270 |
-
DomHandler.call(this, this._callback, this._options, this._elementCB);
|
4271 |
-
};
|
4272 |
-
|
4273 |
-
//Signals the handler that parsing is done
|
4274 |
-
DomHandler.prototype.onend = function(){
|
4275 |
-
if(this._done) return;
|
4276 |
-
this._done = true;
|
4277 |
-
this._parser = null;
|
4278 |
-
this._handleCallback(null);
|
4279 |
-
};
|
4280 |
-
|
4281 |
-
DomHandler.prototype._handleCallback =
|
4282 |
-
DomHandler.prototype.onerror = function(error){
|
4283 |
-
if(typeof this._callback === "function"){
|
4284 |
-
this._callback(error, this.dom);
|
4285 |
-
} else {
|
4286 |
-
if(error) throw error;
|
4287 |
-
}
|
4288 |
-
};
|
4289 |
-
|
4290 |
-
DomHandler.prototype.onclosetag = function(){
|
4291 |
-
//if(this._tagStack.pop().name !== name) this._handleCallback(Error("Tagname didn't match!"));
|
4292 |
-
|
4293 |
-
var elem = this._tagStack.pop();
|
4294 |
-
|
4295 |
-
if(this._options.withEndIndices){
|
4296 |
-
elem.endIndex = this._parser.endIndex;
|
4297 |
-
}
|
4298 |
-
|
4299 |
-
if(this._elementCB) this._elementCB(elem);
|
4300 |
-
};
|
4301 |
-
|
4302 |
-
DomHandler.prototype._createDomElement = function(properties){
|
4303 |
-
if (!this._options.withDomLvl1) return properties;
|
4304 |
-
|
4305 |
-
var element;
|
4306 |
-
if (properties.type === "tag") {
|
4307 |
-
element = Object.create(ElementPrototype);
|
4308 |
-
} else {
|
4309 |
-
element = Object.create(NodePrototype);
|
4310 |
-
}
|
4311 |
-
|
4312 |
-
for (var key in properties) {
|
4313 |
-
if (properties.hasOwnProperty(key)) {
|
4314 |
-
element[key] = properties[key];
|
4315 |
-
}
|
4316 |
-
}
|
4317 |
-
|
4318 |
-
return element;
|
4319 |
-
};
|
4320 |
-
|
4321 |
-
DomHandler.prototype._addDomElement = function(element){
|
4322 |
-
var parent = this._tagStack[this._tagStack.length - 1];
|
4323 |
-
var siblings = parent ? parent.children : this.dom;
|
4324 |
-
var previousSibling = siblings[siblings.length - 1];
|
4325 |
-
|
4326 |
-
element.next = null;
|
4327 |
-
|
4328 |
-
if(this._options.withStartIndices){
|
4329 |
-
element.startIndex = this._parser.startIndex;
|
4330 |
-
}
|
4331 |
-
if(this._options.withEndIndices){
|
4332 |
-
element.endIndex = this._parser.endIndex;
|
4333 |
-
}
|
4334 |
-
|
4335 |
-
if(previousSibling){
|
4336 |
-
element.prev = previousSibling;
|
4337 |
-
previousSibling.next = element;
|
4338 |
-
} else {
|
4339 |
-
element.prev = null;
|
4340 |
-
}
|
4341 |
-
|
4342 |
-
siblings.push(element);
|
4343 |
-
element.parent = parent || null;
|
4344 |
-
};
|
4345 |
-
|
4346 |
-
DomHandler.prototype.onopentag = function(name, attribs){
|
4347 |
-
var properties = {
|
4348 |
-
type: name === "script" ? ElementType.Script : name === "style" ? ElementType.Style : ElementType.Tag,
|
4349 |
-
name: name,
|
4350 |
-
attribs: attribs,
|
4351 |
-
children: []
|
4352 |
-
};
|
4353 |
-
|
4354 |
-
var element = this._createDomElement(properties);
|
4355 |
-
|
4356 |
-
this._addDomElement(element);
|
4357 |
-
|
4358 |
-
this._tagStack.push(element);
|
4359 |
-
};
|
4360 |
-
|
4361 |
-
DomHandler.prototype.ontext = function(data){
|
4362 |
-
//the ignoreWhitespace is officially dropped, but for now,
|
4363 |
-
//it's an alias for normalizeWhitespace
|
4364 |
-
var normalize = this._options.normalizeWhitespace || this._options.ignoreWhitespace;
|
4365 |
-
|
4366 |
-
var lastTag;
|
4367 |
-
|
4368 |
-
if(!this._tagStack.length && this.dom.length && (lastTag = this.dom[this.dom.length-1]).type === ElementType.Text){
|
4369 |
-
if(normalize){
|
4370 |
-
lastTag.data = (lastTag.data + data).replace(re_whitespace, " ");
|
4371 |
-
} else {
|
4372 |
-
lastTag.data += data;
|
4373 |
-
}
|
4374 |
-
} else {
|
4375 |
-
if(
|
4376 |
-
this._tagStack.length &&
|
4377 |
-
(lastTag = this._tagStack[this._tagStack.length - 1]) &&
|
4378 |
-
(lastTag = lastTag.children[lastTag.children.length - 1]) &&
|
4379 |
-
lastTag.type === ElementType.Text
|
4380 |
-
){
|
4381 |
-
if(normalize){
|
4382 |
-
lastTag.data = (lastTag.data + data).replace(re_whitespace, " ");
|
4383 |
-
} else {
|
4384 |
-
lastTag.data += data;
|
4385 |
-
}
|
4386 |
-
} else {
|
4387 |
-
if(normalize){
|
4388 |
-
data = data.replace(re_whitespace, " ");
|
4389 |
-
}
|
4390 |
-
|
4391 |
-
var element = this._createDomElement({
|
4392 |
-
data: data,
|
4393 |
-
type: ElementType.Text
|
4394 |
-
});
|
4395 |
-
|
4396 |
-
this._addDomElement(element);
|
4397 |
-
}
|
4398 |
-
}
|
4399 |
-
};
|
4400 |
-
|
4401 |
-
DomHandler.prototype.oncomment = function(data){
|
4402 |
-
var lastTag = this._tagStack[this._tagStack.length - 1];
|
4403 |
-
|
4404 |
-
if(lastTag && lastTag.type === ElementType.Comment){
|
4405 |
-
lastTag.data += data;
|
4406 |
-
return;
|
4407 |
-
}
|
4408 |
-
|
4409 |
-
var properties = {
|
4410 |
-
data: data,
|
4411 |
-
type: ElementType.Comment
|
4412 |
-
};
|
4413 |
-
|
4414 |
-
var element = this._createDomElement(properties);
|
4415 |
-
|
4416 |
-
this._addDomElement(element);
|
4417 |
-
this._tagStack.push(element);
|
4418 |
-
};
|
4419 |
-
|
4420 |
-
DomHandler.prototype.oncdatastart = function(){
|
4421 |
-
var properties = {
|
4422 |
-
children: [{
|
4423 |
-
data: "",
|
4424 |
-
type: ElementType.Text
|
4425 |
-
}],
|
4426 |
-
type: ElementType.CDATA
|
4427 |
-
};
|
4428 |
-
|
4429 |
-
var element = this._createDomElement(properties);
|
4430 |
-
|
4431 |
-
this._addDomElement(element);
|
4432 |
-
this._tagStack.push(element);
|
4433 |
-
};
|
4434 |
-
|
4435 |
-
DomHandler.prototype.oncommentend = DomHandler.prototype.oncdataend = function(){
|
4436 |
-
this._tagStack.pop();
|
4437 |
-
};
|
4438 |
-
|
4439 |
-
DomHandler.prototype.onprocessinginstruction = function(name, data){
|
4440 |
-
var element = this._createDomElement({
|
4441 |
-
name: name,
|
4442 |
-
data: data,
|
4443 |
-
type: ElementType.Directive
|
4444 |
-
});
|
4445 |
-
|
4446 |
-
this._addDomElement(element);
|
4447 |
-
};
|
4448 |
-
|
4449 |
-
module.exports = DomHandler;
|
4450 |
-
|
4451 |
-
|
4452 |
-
/***/ },
|
4453 |
-
|
4454 |
-
/***/ 477:
|
4455 |
-
/***/ function(module, exports) {
|
4456 |
-
|
4457 |
-
//Types of elements found in the DOM
|
4458 |
-
module.exports = {
|
4459 |
-
Text: "text", //Text
|
4460 |
-
Directive: "directive", //<? ... ?>
|
4461 |
-
Comment: "comment", //<!-- ... -->
|
4462 |
-
Script: "script", //<script> tags
|
4463 |
-
Style: "style", //<style> tags
|
4464 |
-
Tag: "tag", //Any tag
|
4465 |
-
CDATA: "cdata", //<![CDATA[ ... ]]>
|
4466 |
-
Doctype: "doctype",
|
4467 |
-
|
4468 |
-
isTag: function(elem){
|
4469 |
-
return elem.type === "tag" || elem.type === "script" || elem.type === "style";
|
4470 |
-
}
|
4471 |
-
};
|
4472 |
-
|
4473 |
-
|
4474 |
-
/***/ },
|
4475 |
-
|
4476 |
-
/***/ 478:
|
4477 |
-
/***/ function(module, exports) {
|
4478 |
-
|
4479 |
-
// This object will be used as the prototype for Nodes when creating a
|
4480 |
-
// DOM-Level-1-compliant structure.
|
4481 |
-
var NodePrototype = module.exports = {
|
4482 |
-
get firstChild() {
|
4483 |
-
var children = this.children;
|
4484 |
-
return children && children[0] || null;
|
4485 |
-
},
|
4486 |
-
get lastChild() {
|
4487 |
-
var children = this.children;
|
4488 |
-
return children && children[children.length - 1] || null;
|
4489 |
-
},
|
4490 |
-
get nodeType() {
|
4491 |
-
return nodeTypes[this.type] || nodeTypes.element;
|
4492 |
-
}
|
4493 |
-
};
|
4494 |
-
|
4495 |
-
var domLvl1 = {
|
4496 |
-
tagName: "name",
|
4497 |
-
childNodes: "children",
|
4498 |
-
parentNode: "parent",
|
4499 |
-
previousSibling: "prev",
|
4500 |
-
nextSibling: "next",
|
4501 |
-
nodeValue: "data"
|
4502 |
-
};
|
4503 |
-
|
4504 |
-
var nodeTypes = {
|
4505 |
-
element: 1,
|
4506 |
-
text: 3,
|
4507 |
-
cdata: 4,
|
4508 |
-
comment: 8
|
4509 |
-
};
|
4510 |
-
|
4511 |
-
Object.keys(domLvl1).forEach(function(key) {
|
4512 |
-
var shorthand = domLvl1[key];
|
4513 |
-
Object.defineProperty(NodePrototype, key, {
|
4514 |
-
get: function() {
|
4515 |
-
return this[shorthand] || null;
|
4516 |
-
},
|
4517 |
-
set: function(val) {
|
4518 |
-
this[shorthand] = val;
|
4519 |
-
return val;
|
4520 |
-
}
|
4521 |
-
});
|
4522 |
-
});
|
4523 |
-
|
4524 |
-
|
4525 |
-
/***/ },
|
4526 |
-
|
4527 |
-
/***/ 479:
|
4528 |
-
/***/ function(module, exports, __webpack_require__) {
|
4529 |
-
|
4530 |
-
// DOM-Level-1-compliant structure
|
4531 |
-
var NodePrototype = __webpack_require__(478);
|
4532 |
-
var ElementPrototype = module.exports = Object.create(NodePrototype);
|
4533 |
-
|
4534 |
-
var domLvl1 = {
|
4535 |
-
tagName: "name"
|
4536 |
-
};
|
4537 |
-
|
4538 |
-
Object.keys(domLvl1).forEach(function(key) {
|
4539 |
-
var shorthand = domLvl1[key];
|
4540 |
-
Object.defineProperty(ElementPrototype, key, {
|
4541 |
-
get: function() {
|
4542 |
-
return this[shorthand] || null;
|
4543 |
-
},
|
4544 |
-
set: function(val) {
|
4545 |
-
this[shorthand] = val;
|
4546 |
-
return val;
|
4547 |
-
}
|
4548 |
-
});
|
4549 |
-
});
|
4550 |
-
|
4551 |
-
|
4552 |
-
/***/ },
|
4553 |
-
|
4554 |
-
/***/ 480:
|
4555 |
-
/***/ function(module, exports, __webpack_require__) {
|
4556 |
-
|
4557 |
-
var index = __webpack_require__(466),
|
4558 |
-
DomHandler = index.DomHandler,
|
4559 |
-
DomUtils = index.DomUtils;
|
4560 |
-
|
4561 |
-
//TODO: make this a streamable handler
|
4562 |
-
function FeedHandler(callback, options){
|
4563 |
-
this.init(callback, options);
|
4564 |
-
}
|
4565 |
-
|
4566 |
-
__webpack_require__(474)(FeedHandler, DomHandler);
|
4567 |
-
|
4568 |
-
FeedHandler.prototype.init = DomHandler;
|
4569 |
-
|
4570 |
-
function getElements(what, where){
|
4571 |
-
return DomUtils.getElementsByTagName(what, where, true);
|
4572 |
-
}
|
4573 |
-
function getOneElement(what, where){
|
4574 |
-
return DomUtils.getElementsByTagName(what, where, true, 1)[0];
|
4575 |
-
}
|
4576 |
-
function fetch(what, where, recurse){
|
4577 |
-
return DomUtils.getText(
|
4578 |
-
DomUtils.getElementsByTagName(what, where, recurse, 1)
|
4579 |
-
).trim();
|
4580 |
-
}
|
4581 |
-
|
4582 |
-
function addConditionally(obj, prop, what, where, recurse){
|
4583 |
-
var tmp = fetch(what, where, recurse);
|
4584 |
-
if(tmp) obj[prop] = tmp;
|
4585 |
-
}
|
4586 |
-
|
4587 |
-
var isValidFeed = function(value){
|
4588 |
-
return value === "rss" || value === "feed" || value === "rdf:RDF";
|
4589 |
-
};
|
4590 |
-
|
4591 |
-
FeedHandler.prototype.onend = function(){
|
4592 |
-
var feed = {},
|
4593 |
-
feedRoot = getOneElement(isValidFeed, this.dom),
|
4594 |
-
tmp, childs;
|
4595 |
-
|
4596 |
-
if(feedRoot){
|
4597 |
-
if(feedRoot.name === "feed"){
|
4598 |
-
childs = feedRoot.children;
|
4599 |
-
|
4600 |
-
feed.type = "atom";
|
4601 |
-
addConditionally(feed, "id", "id", childs);
|
4602 |
-
addConditionally(feed, "title", "title", childs);
|
4603 |
-
if((tmp = getOneElement("link", childs)) && (tmp = tmp.attribs) && (tmp = tmp.href)) feed.link = tmp;
|
4604 |
-
addConditionally(feed, "description", "subtitle", childs);
|
4605 |
-
if((tmp = fetch("updated", childs))) feed.updated = new Date(tmp);
|
4606 |
-
addConditionally(feed, "author", "email", childs, true);
|
4607 |
-
|
4608 |
-
feed.items = getElements("entry", childs).map(function(item){
|
4609 |
-
var entry = {}, tmp;
|
4610 |
-
|
4611 |
-
item = item.children;
|
4612 |
-
|
4613 |
-
addConditionally(entry, "id", "id", item);
|
4614 |
-
addConditionally(entry, "title", "title", item);
|
4615 |
-
if((tmp = getOneElement("link", item)) && (tmp = tmp.attribs) && (tmp = tmp.href)) entry.link = tmp;
|
4616 |
-
if((tmp = fetch("summary", item) || fetch("content", item))) entry.description = tmp;
|
4617 |
-
if((tmp = fetch("updated", item))) entry.pubDate = new Date(tmp);
|
4618 |
-
return entry;
|
4619 |
-
});
|
4620 |
-
} else {
|
4621 |
-
childs = getOneElement("channel", feedRoot.children).children;
|
4622 |
-
|
4623 |
-
feed.type = feedRoot.name.substr(0, 3);
|
4624 |
-
feed.id = "";
|
4625 |
-
addConditionally(feed, "title", "title", childs);
|
4626 |
-
addConditionally(feed, "link", "link", childs);
|
4627 |
-
addConditionally(feed, "description", "description", childs);
|
4628 |
-
if((tmp = fetch("lastBuildDate", childs))) feed.updated = new Date(tmp);
|
4629 |
-
addConditionally(feed, "author", "managingEditor", childs, true);
|
4630 |
-
|
4631 |
-
feed.items = getElements("item", feedRoot.children).map(function(item){
|
4632 |
-
var entry = {}, tmp;
|
4633 |
-
|
4634 |
-
item = item.children;
|
4635 |
-
|
4636 |
-
addConditionally(entry, "id", "guid", item);
|
4637 |
-
addConditionally(entry, "title", "title", item);
|
4638 |
-
addConditionally(entry, "link", "link", item);
|
4639 |
-
addConditionally(entry, "description", "description", item);
|
4640 |
-
if((tmp = fetch("pubDate", item))) entry.pubDate = new Date(tmp);
|
4641 |
-
return entry;
|
4642 |
-
});
|
4643 |
-
}
|
4644 |
-
}
|
4645 |
-
this.dom = feed;
|
4646 |
-
DomHandler.prototype._handleCallback.call(
|
4647 |
-
this, feedRoot ? null : Error("couldn't find root of feed")
|
4648 |
-
);
|
4649 |
-
};
|
4650 |
-
|
4651 |
-
module.exports = FeedHandler;
|
4652 |
-
|
4653 |
-
|
4654 |
-
/***/ },
|
4655 |
-
|
4656 |
-
/***/ 481:
|
4657 |
-
/***/ function(module, exports, __webpack_require__) {
|
4658 |
-
|
4659 |
-
module.exports = Stream;
|
4660 |
-
|
4661 |
-
var Parser = __webpack_require__(482);
|
4662 |
-
|
4663 |
-
function Stream(options){
|
4664 |
-
Parser.call(this, new Cbs(this), options);
|
4665 |
-
}
|
4666 |
-
|
4667 |
-
__webpack_require__(474)(Stream, Parser);
|
4668 |
-
|
4669 |
-
Stream.prototype.readable = true;
|
4670 |
-
|
4671 |
-
function Cbs(scope){
|
4672 |
-
this.scope = scope;
|
4673 |
-
}
|
4674 |
-
|
4675 |
-
var EVENTS = __webpack_require__(466).EVENTS;
|
4676 |
-
|
4677 |
-
Object.keys(EVENTS).forEach(function(name){
|
4678 |
-
if(EVENTS[name] === 0){
|
4679 |
-
Cbs.prototype["on" + name] = function(){
|
4680 |
-
this.scope.emit(name);
|
4681 |
-
};
|
4682 |
-
} else if(EVENTS[name] === 1){
|
4683 |
-
Cbs.prototype["on" + name] = function(a){
|
4684 |
-
this.scope.emit(name, a);
|
4685 |
-
};
|
4686 |
-
} else if(EVENTS[name] === 2){
|
4687 |
-
Cbs.prototype["on" + name] = function(a, b){
|
4688 |
-
this.scope.emit(name, a, b);
|
4689 |
-
};
|
4690 |
-
} else {
|
4691 |
-
throw Error("wrong number of arguments!");
|
4692 |
-
}
|
4693 |
-
});
|
4694 |
-
|
4695 |
-
/***/ },
|
4696 |
-
|
4697 |
-
/***/ 482:
|
4698 |
-
/***/ function(module, exports, __webpack_require__) {
|
4699 |
-
|
4700 |
-
module.exports = Stream;
|
4701 |
-
|
4702 |
-
var Parser = __webpack_require__(467),
|
4703 |
-
WritableStream = __webpack_require__(483).Writable || __webpack_require__(502).Writable,
|
4704 |
-
StringDecoder = __webpack_require__(503).StringDecoder,
|
4705 |
-
Buffer = __webpack_require__(487).Buffer;
|
4706 |
-
|
4707 |
-
function Stream(cbs, options){
|
4708 |
-
var parser = this._parser = new Parser(cbs, options);
|
4709 |
-
var decoder = this._decoder = new StringDecoder();
|
4710 |
-
|
4711 |
-
WritableStream.call(this, {decodeStrings: false});
|
4712 |
-
|
4713 |
-
this.once("finish", function(){
|
4714 |
-
parser.end(decoder.end());
|
4715 |
-
});
|
4716 |
-
}
|
4717 |
-
|
4718 |
-
__webpack_require__(474)(Stream, WritableStream);
|
4719 |
-
|
4720 |
-
WritableStream.prototype._write = function(chunk, encoding, cb){
|
4721 |
-
if(chunk instanceof Buffer) chunk = this._decoder.write(chunk);
|
4722 |
-
this._parser.write(chunk);
|
4723 |
-
cb();
|
4724 |
-
};
|
4725 |
-
|
4726 |
-
/***/ },
|
4727 |
-
|
4728 |
-
/***/ 483:
|
4729 |
-
/***/ function(module, exports, __webpack_require__) {
|
4730 |
-
|
4731 |
-
// Copyright Joyent, Inc. and other Node contributors.
|
4732 |
-
//
|
4733 |
-
// Permission is hereby granted, free of charge, to any person obtaining a
|
4734 |
-
// copy of this software and associated documentation files (the
|
4735 |
-
// "Software"), to deal in the Software without restriction, including
|
4736 |
-
// without limitation the rights to use, copy, modify, merge, publish,
|
4737 |
-
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
4738 |
-
// persons to whom the Software is furnished to do so, subject to the
|
4739 |
-
// following conditions:
|
4740 |
-
//
|
4741 |
-
// The above copyright notice and this permission notice shall be included
|
4742 |
-
// in all copies or substantial portions of the Software.
|
4743 |
-
//
|
4744 |
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
4745 |
-
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
4746 |
-
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
4747 |
-
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
4748 |
-
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
4749 |
-
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
4750 |
-
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
4751 |
-
|
4752 |
-
module.exports = Stream;
|
4753 |
-
|
4754 |
-
var EE = __webpack_require__(475).EventEmitter;
|
4755 |
-
var inherits = __webpack_require__(474);
|
4756 |
-
|
4757 |
-
inherits(Stream, EE);
|
4758 |
-
Stream.Readable = __webpack_require__(484);
|
4759 |
-
Stream.Writable = __webpack_require__(498);
|
4760 |
-
Stream.Duplex = __webpack_require__(499);
|
4761 |
-
Stream.Transform = __webpack_require__(500);
|
4762 |
-
Stream.PassThrough = __webpack_require__(501);
|
4763 |
-
|
4764 |
-
// Backwards-compat with node 0.4.x
|
4765 |
-
Stream.Stream = Stream;
|
4766 |
-
|
4767 |
-
|
4768 |
-
|
4769 |
-
// old-style streams. Note that the pipe method (the only relevant
|
4770 |
-
// part of this class) is overridden in the Readable class.
|
4771 |
-
|
4772 |
-
function Stream() {
|
4773 |
-
EE.call(this);
|
4774 |
-
}
|
4775 |
-
|
4776 |
-
Stream.prototype.pipe = function(dest, options) {
|
4777 |
-
var source = this;
|
4778 |
-
|
4779 |
-
function ondata(chunk) {
|
4780 |
-
if (dest.writable) {
|
4781 |
-
if (false === dest.write(chunk) && source.pause) {
|
4782 |
-
source.pause();
|
4783 |
-
}
|
4784 |
-
}
|
4785 |
-
}
|
4786 |
-
|
4787 |
-
source.on('data', ondata);
|
4788 |
-
|
4789 |
-
function ondrain() {
|
4790 |
-
if (source.readable && source.resume) {
|
4791 |
-
source.resume();
|
4792 |
-
}
|
4793 |
-
}
|
4794 |
-
|
4795 |
-
dest.on('drain', ondrain);
|
4796 |
-
|
4797 |
-
// If the 'end' option is not supplied, dest.end() will be called when
|
4798 |
-
// source gets the 'end' or 'close' events. Only dest.end() once.
|
4799 |
-
if (!dest._isStdio && (!options || options.end !== false)) {
|
4800 |
-
source.on('end', onend);
|
4801 |
-
source.on('close', onclose);
|
4802 |
-
}
|
4803 |
-
|
4804 |
-
var didOnEnd = false;
|
4805 |
-
function onend() {
|
4806 |
-
if (didOnEnd) return;
|
4807 |
-
didOnEnd = true;
|
4808 |
-
|
4809 |
-
dest.end();
|
4810 |
-
}
|
4811 |
-
|
4812 |
-
|
4813 |
-
function onclose() {
|
4814 |
-
if (didOnEnd) return;
|
4815 |
-
didOnEnd = true;
|
4816 |
-
|
4817 |
-
if (typeof dest.destroy === 'function') dest.destroy();
|
4818 |
-
}
|
4819 |
-
|
4820 |
-
// don't leave dangling pipes when there are errors.
|
4821 |
-
function onerror(er) {
|
4822 |
-
cleanup();
|
4823 |
-
if (EE.listenerCount(this, 'error') === 0) {
|
4824 |
-
throw er; // Unhandled stream error in pipe.
|
4825 |
-
}
|
4826 |
-
}
|
4827 |
-
|
4828 |
-
source.on('error', onerror);
|
4829 |
-
dest.on('error', onerror);
|
4830 |
-
|
4831 |
-
// remove all the event listeners that were added.
|
4832 |
-
function cleanup() {
|
4833 |
-
source.removeListener('data', ondata);
|
4834 |
-
dest.removeListener('drain', ondrain);
|
4835 |
-
|
4836 |
-
source.removeListener('end', onend);
|
4837 |
-
source.removeListener('close', onclose);
|
4838 |
-
|
4839 |
-
source.removeListener('error', onerror);
|
4840 |
-
dest.removeListener('error', onerror);
|
4841 |
-
|
4842 |
-
source.removeListener('end', cleanup);
|
4843 |
-
source.removeListener('close', cleanup);
|
4844 |
-
|
4845 |
-
dest.removeListener('close', cleanup);
|
4846 |
-
}
|
4847 |
-
|
4848 |
-
source.on('end', cleanup);
|
4849 |
-
source.on('close', cleanup);
|
4850 |
-
|
4851 |
-
dest.on('close', cleanup);
|
4852 |
-
|
4853 |
-
dest.emit('pipe', source);
|
4854 |
-
|
4855 |
-
// Allow for unix-like usage: A.pipe(B).pipe(C)
|
4856 |
-
return dest;
|
4857 |
-
};
|
4858 |
-
|
4859 |
-
|
4860 |
-
/***/ },
|
4861 |
-
|
4862 |
-
/***/ 484:
|
4863 |
-
/***/ function(module, exports, __webpack_require__) {
|
4864 |
-
|
4865 |
-
/* WEBPACK VAR INJECTION */(function(process) {exports = module.exports = __webpack_require__(485);
|
4866 |
-
exports.Stream = __webpack_require__(483);
|
4867 |
-
exports.Readable = exports;
|
4868 |
-
exports.Writable = __webpack_require__(494);
|
4869 |
-
exports.Duplex = __webpack_require__(493);
|
4870 |
-
exports.Transform = __webpack_require__(496);
|
4871 |
-
exports.PassThrough = __webpack_require__(497);
|
4872 |
-
if (!process.browser && process.env.READABLE_STREAM === 'disable') {
|
4873 |
-
module.exports = __webpack_require__(483);
|
4874 |
-
}
|
4875 |
-
|
4876 |
-
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
|
4877 |
-
|
4878 |
-
/***/ },
|
4879 |
-
|
4880 |
-
/***/ 485:
|
4881 |
-
/***/ function(module, exports, __webpack_require__) {
|
4882 |
-
|
4883 |
-
/* WEBPACK VAR INJECTION */(function(process) {// Copyright Joyent, Inc. and other Node contributors.
|
4884 |
-
//
|
4885 |
-
// Permission is hereby granted, free of charge, to any person obtaining a
|
4886 |
-
// copy of this software and associated documentation files (the
|
4887 |
-
// "Software"), to deal in the Software without restriction, including
|
4888 |
-
// without limitation the rights to use, copy, modify, merge, publish,
|
4889 |
-
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
4890 |
-
// persons to whom the Software is furnished to do so, subject to the
|
4891 |
-
// following conditions:
|
4892 |
-
//
|
4893 |
-
// The above copyright notice and this permission notice shall be included
|
4894 |
-
// in all copies or substantial portions of the Software.
|
4895 |
-
//
|
4896 |
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
4897 |
-
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
4898 |
-
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
4899 |
-
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
4900 |
-
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
4901 |
-
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
4902 |
-
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
4903 |
-
|
4904 |
-
module.exports = Readable;
|
4905 |
-
|
4906 |
-
/*<replacement>*/
|
4907 |
-
var isArray = __webpack_require__(486);
|
4908 |
-
/*</replacement>*/
|
4909 |
-
|
4910 |
-
|
4911 |
-
/*<replacement>*/
|
4912 |
-
var Buffer = __webpack_require__(487).Buffer;
|
4913 |
-
/*</replacement>*/
|
4914 |
-
|
4915 |
-
Readable.ReadableState = ReadableState;
|
4916 |
-
|
4917 |
-
var EE = __webpack_require__(475).EventEmitter;
|
4918 |
-
|
4919 |
-
/*<replacement>*/
|
4920 |
-
if (!EE.listenerCount) EE.listenerCount = function(emitter, type) {
|
4921 |
-
return emitter.listeners(type).length;
|
4922 |
-
};
|
4923 |
-
/*</replacement>*/
|
4924 |
-
|
4925 |
-
var Stream = __webpack_require__(483);
|
4926 |
-
|
4927 |
-
/*<replacement>*/
|
4928 |
-
var util = __webpack_require__(491);
|
4929 |
-
util.inherits = __webpack_require__(474);
|
4930 |
-
/*</replacement>*/
|
4931 |
-
|
4932 |
-
var StringDecoder;
|
4933 |
-
|
4934 |
-
|
4935 |
-
/*<replacement>*/
|
4936 |
-
var debug = __webpack_require__(492);
|
4937 |
-
if (debug && debug.debuglog) {
|
4938 |
-
debug = debug.debuglog('stream');
|
4939 |
-
} else {
|
4940 |
-
debug = function () {};
|
4941 |
-
}
|
4942 |
-
/*</replacement>*/
|
4943 |
-
|
4944 |
-
|
4945 |
-
util.inherits(Readable, Stream);
|
4946 |
-
|
4947 |
-
function ReadableState(options, stream) {
|
4948 |
-
var Duplex = __webpack_require__(493);
|
4949 |
-
|
4950 |
-
options = options || {};
|
4951 |
-
|
4952 |
-
// the point at which it stops calling _read() to fill the buffer
|
4953 |
-
// Note: 0 is a valid value, means "don't call _read preemptively ever"
|
4954 |
-
var hwm = options.highWaterMark;
|
4955 |
-
var defaultHwm = options.objectMode ? 16 : 16 * 1024;
|
4956 |
-
this.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm;
|
4957 |
-
|
4958 |
-
// cast to ints.
|
4959 |
-
this.highWaterMark = ~~this.highWaterMark;
|
4960 |
-
|
4961 |
-
this.buffer = [];
|
4962 |
-
this.length = 0;
|
4963 |
-
this.pipes = null;
|
4964 |
-
this.pipesCount = 0;
|
4965 |
-
this.flowing = null;
|
4966 |
-
this.ended = false;
|
4967 |
-
this.endEmitted = false;
|
4968 |
-
this.reading = false;
|
4969 |
-
|
4970 |
-
// a flag to be able to tell if the onwrite cb is called immediately,
|
4971 |
-
// or on a later tick. We set this to true at first, because any
|
4972 |
-
// actions that shouldn't happen until "later" should generally also
|
4973 |
-
// not happen before the first write call.
|
4974 |
-
this.sync = true;
|
4975 |
-
|
4976 |
-
// whenever we return null, then we set a flag to say
|
4977 |
-
// that we're awaiting a 'readable' event emission.
|
4978 |
-
this.needReadable = false;
|
4979 |
-
this.emittedReadable = false;
|
4980 |
-
this.readableListening = false;
|
4981 |
-
|
4982 |
-
|
4983 |
-
// object stream flag. Used to make read(n) ignore n and to
|
4984 |
-
// make all the buffer merging and length checks go away
|
4985 |
-
this.objectMode = !!options.objectMode;
|
4986 |
-
|
4987 |
-
if (stream instanceof Duplex)
|
4988 |
-
this.objectMode = this.objectMode || !!options.readableObjectMode;
|
4989 |
-
|
4990 |
-
// Crypto is kind of old and crusty. Historically, its default string
|
4991 |
-
// encoding is 'binary' so we have to make this configurable.
|
4992 |
-
// Everything else in the universe uses 'utf8', though.
|
4993 |
-
this.defaultEncoding = options.defaultEncoding || 'utf8';
|
4994 |
-
|
4995 |
-
// when piping, we only care about 'readable' events that happen
|
4996 |
-
// after read()ing all the bytes and not getting any pushback.
|
4997 |
-
this.ranOut = false;
|
4998 |
-
|
4999 |
-
// the number of writers that are awaiting a drain event in .pipe()s
|
5000 |
-
this.awaitDrain = 0;
|
5001 |
-
|
5002 |
-
// if true, a maybeReadMore has been scheduled
|
5003 |
-
this.readingMore = false;
|
5004 |
-
|
5005 |
-
this.decoder = null;
|
5006 |
-
this.encoding = null;
|
5007 |
-
if (options.encoding) {
|
5008 |
-
if (!StringDecoder)
|
5009 |
-
StringDecoder = __webpack_require__(495).StringDecoder;
|
5010 |
-
this.decoder = new StringDecoder(options.encoding);
|
5011 |
-
this.encoding = options.encoding;
|
5012 |
-
}
|
5013 |
-
}
|
5014 |
-
|
5015 |
-
function Readable(options) {
|
5016 |
-
var Duplex = __webpack_require__(493);
|
5017 |
-
|
5018 |
-
if (!(this instanceof Readable))
|
5019 |
-
return new Readable(options);
|
5020 |
-
|
5021 |
-
this._readableState = new ReadableState(options, this);
|
5022 |
-
|
5023 |
-
// legacy
|
5024 |
-
this.readable = true;
|
5025 |
-
|
5026 |
-
Stream.call(this);
|
5027 |
-
}
|
5028 |
-
|
5029 |
-
// Manually shove something into the read() buffer.
|
5030 |
-
// This returns true if the highWaterMark has not been hit yet,
|
5031 |
-
// similar to how Writable.write() returns true if you should
|
5032 |
-
// write() some more.
|
5033 |
-
Readable.prototype.push = function(chunk, encoding) {
|
5034 |
-
var state = this._readableState;
|
5035 |
-
|
5036 |
-
if (util.isString(chunk) && !state.objectMode) {
|
5037 |
-
encoding = encoding || state.defaultEncoding;
|
5038 |
-
if (encoding !== state.encoding) {
|
5039 |
-
chunk = new Buffer(chunk, encoding);
|
5040 |
-
encoding = '';
|
5041 |
-
}
|
5042 |
-
}
|
5043 |
-
|
5044 |
-
return readableAddChunk(this, state, chunk, encoding, false);
|
5045 |
-
};
|
5046 |
-
|
5047 |
-
// Unshift should *always* be something directly out of read()
|
5048 |
-
Readable.prototype.unshift = function(chunk) {
|
5049 |
-
var state = this._readableState;
|
5050 |
-
return readableAddChunk(this, state, chunk, '', true);
|
5051 |
-
};
|
5052 |
-
|
5053 |
-
function readableAddChunk(stream, state, chunk, encoding, addToFront) {
|
5054 |
-
var er = chunkInvalid(state, chunk);
|
5055 |
-
if (er) {
|
5056 |
-
stream.emit('error', er);
|
5057 |
-
} else if (util.isNullOrUndefined(chunk)) {
|
5058 |
-
state.reading = false;
|
5059 |
-
if (!state.ended)
|
5060 |
-
onEofChunk(stream, state);
|
5061 |
-
} else if (state.objectMode || chunk && chunk.length > 0) {
|
5062 |
-
if (state.ended && !addToFront) {
|
5063 |
-
var e = new Error('stream.push() after EOF');
|
5064 |
-
stream.emit('error', e);
|
5065 |
-
} else if (state.endEmitted && addToFront) {
|
5066 |
-
var e = new Error('stream.unshift() after end event');
|
5067 |
-
stream.emit('error', e);
|
5068 |
-
} else {
|
5069 |
-
if (state.decoder && !addToFront && !encoding)
|
5070 |
-
chunk = state.decoder.write(chunk);
|
5071 |
-
|
5072 |
-
if (!addToFront)
|
5073 |
-
state.reading = false;
|
5074 |
-
|
5075 |
-
// if we want the data now, just emit it.
|
5076 |
-
if (state.flowing && state.length === 0 && !state.sync) {
|
5077 |
-
stream.emit('data', chunk);
|
5078 |
-
stream.read(0);
|
5079 |
-
} else {
|
5080 |
-
// update the buffer info.
|
5081 |
-
state.length += state.objectMode ? 1 : chunk.length;
|
5082 |
-
if (addToFront)
|
5083 |
-
state.buffer.unshift(chunk);
|
5084 |
-
else
|
5085 |
-
state.buffer.push(chunk);
|
5086 |
-
|
5087 |
-
if (state.needReadable)
|
5088 |
-
emitReadable(stream);
|
5089 |
-
}
|
5090 |
-
|
5091 |
-
maybeReadMore(stream, state);
|
5092 |
-
}
|
5093 |
-
} else if (!addToFront) {
|
5094 |
-
state.reading = false;
|
5095 |
-
}
|
5096 |
-
|
5097 |
-
return needMoreData(state);
|
5098 |
-
}
|
5099 |
-
|
5100 |
-
|
5101 |
-
|
5102 |
-
// if it's past the high water mark, we can push in some more.
|
5103 |
-
// Also, if we have no data yet, we can stand some
|
5104 |
-
// more bytes. This is to work around cases where hwm=0,
|
5105 |
-
// such as the repl. Also, if the push() triggered a
|
5106 |
-
// readable event, and the user called read(largeNumber) such that
|
5107 |
-
// needReadable was set, then we ought to push more, so that another
|
5108 |
-
// 'readable' event will be triggered.
|
5109 |
-
function needMoreData(state) {
|
5110 |
-
return !state.ended &&
|
5111 |
-
(state.needReadable ||
|
5112 |
-
state.length < state.highWaterMark ||
|
5113 |
-
state.length === 0);
|
5114 |
-
}
|
5115 |
-
|
5116 |
-
// backwards compatibility.
|
5117 |
-
Readable.prototype.setEncoding = function(enc) {
|
5118 |
-
if (!StringDecoder)
|
5119 |
-
StringDecoder = __webpack_require__(495).StringDecoder;
|
5120 |
-
this._readableState.decoder = new StringDecoder(enc);
|
5121 |
-
this._readableState.encoding = enc;
|
5122 |
-
return this;
|
5123 |
-
};
|
5124 |
-
|
5125 |
-
// Don't raise the hwm > 128MB
|
5126 |
-
var MAX_HWM = 0x800000;
|
5127 |
-
function roundUpToNextPowerOf2(n) {
|
5128 |
-
if (n >= MAX_HWM) {
|
5129 |
-
n = MAX_HWM;
|
5130 |
-
} else {
|
5131 |
-
// Get the next highest power of 2
|
5132 |
-
n--;
|
5133 |
-
for (var p = 1; p < 32; p <<= 1) n |= n >> p;
|
5134 |
-
n++;
|
5135 |
-
}
|
5136 |
-
return n;
|
5137 |
-
}
|
5138 |
-
|
5139 |
-
function howMuchToRead(n, state) {
|
5140 |
-
if (state.length === 0 && state.ended)
|
5141 |
-
return 0;
|
5142 |
-
|
5143 |
-
if (state.objectMode)
|
5144 |
-
return n === 0 ? 0 : 1;
|
5145 |
-
|
5146 |
-
if (isNaN(n) || util.isNull(n)) {
|
5147 |
-
// only flow one buffer at a time
|
5148 |
-
if (state.flowing && state.buffer.length)
|
5149 |
-
return state.buffer[0].length;
|
5150 |
-
else
|
5151 |
-
return state.length;
|
5152 |
-
}
|
5153 |
-
|
5154 |
-
if (n <= 0)
|
5155 |
-
return 0;
|
5156 |
-
|
5157 |
-
// If we're asking for more than the target buffer level,
|
5158 |
-
// then raise the water mark. Bump up to the next highest
|
5159 |
-
// power of 2, to prevent increasing it excessively in tiny
|
5160 |
-
// amounts.
|
5161 |
-
if (n > state.highWaterMark)
|
5162 |
-
state.highWaterMark = roundUpToNextPowerOf2(n);
|
5163 |
-
|
5164 |
-
// don't have that much. return null, unless we've ended.
|
5165 |
-
if (n > state.length) {
|
5166 |
-
if (!state.ended) {
|
5167 |
-
state.needReadable = true;
|
5168 |
-
return 0;
|
5169 |
-
} else
|
5170 |
-
return state.length;
|
5171 |
-
}
|
5172 |
-
|
5173 |
-
return n;
|
5174 |
-
}
|
5175 |
-
|
5176 |
-
// you can override either this method, or the async _read(n) below.
|
5177 |
-
Readable.prototype.read = function(n) {
|
5178 |
-
debug('read', n);
|
5179 |
-
var state = this._readableState;
|
5180 |
-
var nOrig = n;
|
5181 |
-
|
5182 |
-
if (!util.isNumber(n) || n > 0)
|
5183 |
-
state.emittedReadable = false;
|
5184 |
-
|
5185 |
-
// if we're doing read(0) to trigger a readable event, but we
|
5186 |
-
// already have a bunch of data in the buffer, then just trigger
|
5187 |
-
// the 'readable' event and move on.
|
5188 |
-
if (n === 0 &&
|
5189 |
-
state.needReadable &&
|
5190 |
-
(state.length >= state.highWaterMark || state.ended)) {
|
5191 |
-
debug('read: emitReadable', state.length, state.ended);
|
5192 |
-
if (state.length === 0 && state.ended)
|
5193 |
-
endReadable(this);
|
5194 |
-
else
|
5195 |
-
emitReadable(this);
|
5196 |
-
return null;
|
5197 |
-
}
|
5198 |
-
|
5199 |
-
n = howMuchToRead(n, state);
|
5200 |
-
|
5201 |
-
// if we've ended, and we're now clear, then finish it up.
|
5202 |
-
if (n === 0 && state.ended) {
|
5203 |
-
if (state.length === 0)
|
5204 |
-
endReadable(this);
|
5205 |
-
return null;
|
5206 |
-
}
|
5207 |
-
|
5208 |
-
// All the actual chunk generation logic needs to be
|
5209 |
-
// *below* the call to _read. The reason is that in certain
|
5210 |
-
// synthetic stream cases, such as passthrough streams, _read
|
5211 |
-
// may be a completely synchronous operation which may change
|
5212 |
-
// the state of the read buffer, providing enough data when
|
5213 |
-
// before there was *not* enough.
|
5214 |
-
//
|
5215 |
-
// So, the steps are:
|
5216 |
-
// 1. Figure out what the state of things will be after we do
|
5217 |
-
// a read from the buffer.
|
5218 |
-
//
|
5219 |
-
// 2. If that resulting state will trigger a _read, then call _read.
|
5220 |
-
// Note that this may be asynchronous, or synchronous. Yes, it is
|
5221 |
-
// deeply ugly to write APIs this way, but that still doesn't mean
|
5222 |
-
// that the Readable class should behave improperly, as streams are
|
5223 |
-
// designed to be sync/async agnostic.
|
5224 |
-
// Take note if the _read call is sync or async (ie, if the read call
|
5225 |
-
// has returned yet), so that we know whether or not it's safe to emit
|
5226 |
-
// 'readable' etc.
|
5227 |
-
//
|
5228 |
-
// 3. Actually pull the requested chunks out of the buffer and return.
|
5229 |
-
|
5230 |
-
// if we need a readable event, then we need to do some reading.
|
5231 |
-
var doRead = state.needReadable;
|
5232 |
-
debug('need readable', doRead);
|
5233 |
-
|
5234 |
-
// if we currently have less than the highWaterMark, then also read some
|
5235 |
-
if (state.length === 0 || state.length - n < state.highWaterMark) {
|
5236 |
-
doRead = true;
|
5237 |
-
debug('length less than watermark', doRead);
|
5238 |
-
}
|
5239 |
-
|
5240 |
-
// however, if we've ended, then there's no point, and if we're already
|
5241 |
-
// reading, then it's unnecessary.
|
5242 |
-
if (state.ended || state.reading) {
|
5243 |
-
doRead = false;
|
5244 |
-
debug('reading or ended', doRead);
|
5245 |
-
}
|
5246 |
-
|
5247 |
-
if (doRead) {
|
5248 |
-
debug('do read');
|
5249 |
-
state.reading = true;
|
5250 |
-
state.sync = true;
|
5251 |
-
// if the length is currently zero, then we *need* a readable event.
|
5252 |
-
if (state.length === 0)
|
5253 |
-
state.needReadable = true;
|
5254 |
-
// call internal read method
|
5255 |
-
this._read(state.highWaterMark);
|
5256 |
-
state.sync = false;
|
5257 |
-
}
|
5258 |
-
|
5259 |
-
// If _read pushed data synchronously, then `reading` will be false,
|
5260 |
-
// and we need to re-evaluate how much data we can return to the user.
|
5261 |
-
if (doRead && !state.reading)
|
5262 |
-
n = howMuchToRead(nOrig, state);
|
5263 |
-
|
5264 |
-
var ret;
|
5265 |
-
if (n > 0)
|
5266 |
-
ret = fromList(n, state);
|
5267 |
-
else
|
5268 |
-
ret = null;
|
5269 |
-
|
5270 |
-
if (util.isNull(ret)) {
|
5271 |
-
state.needReadable = true;
|
5272 |
-
n = 0;
|
5273 |
-
}
|
5274 |
-
|
5275 |
-
state.length -= n;
|
5276 |
-
|
5277 |
-
// If we have nothing in the buffer, then we want to know
|
5278 |
-
// as soon as we *do* get something into the buffer.
|
5279 |
-
if (state.length === 0 && !state.ended)
|
5280 |
-
state.needReadable = true;
|
5281 |
-
|
5282 |
-
// If we tried to read() past the EOF, then emit end on the next tick.
|
5283 |
-
if (nOrig !== n && state.ended && state.length === 0)
|
5284 |
-
endReadable(this);
|
5285 |
-
|
5286 |
-
if (!util.isNull(ret))
|
5287 |
-
this.emit('data', ret);
|
5288 |
-
|
5289 |
-
return ret;
|
5290 |
-
};
|
5291 |
-
|
5292 |
-
function chunkInvalid(state, chunk) {
|
5293 |
-
var er = null;
|
5294 |
-
if (!util.isBuffer(chunk) &&
|
5295 |
-
!util.isString(chunk) &&
|
5296 |
-
!util.isNullOrUndefined(chunk) &&
|
5297 |
-
!state.objectMode) {
|
5298 |
-
er = new TypeError('Invalid non-string/buffer chunk');
|
5299 |
-
}
|
5300 |
-
return er;
|
5301 |
-
}
|
5302 |
-
|
5303 |
-
|
5304 |
-
function onEofChunk(stream, state) {
|
5305 |
-
if (state.decoder && !state.ended) {
|
5306 |
-
var chunk = state.decoder.end();
|
5307 |
-
if (chunk && chunk.length) {
|
5308 |
-
state.buffer.push(chunk);
|
5309 |
-
state.length += state.objectMode ? 1 : chunk.length;
|
5310 |
-
}
|
5311 |
-
}
|
5312 |
-
state.ended = true;
|
5313 |
-
|
5314 |
-
// emit 'readable' now to make sure it gets picked up.
|
5315 |
-
emitReadable(stream);
|
5316 |
-
}
|
5317 |
-
|
5318 |
-
// Don't emit readable right away in sync mode, because this can trigger
|
5319 |
-
// another read() call => stack overflow. This way, it might trigger
|
5320 |
-
// a nextTick recursion warning, but that's not so bad.
|
5321 |
-
function emitReadable(stream) {
|
5322 |
-
var state = stream._readableState;
|
5323 |
-
state.needReadable = false;
|
5324 |
-
if (!state.emittedReadable) {
|
5325 |
-
debug('emitReadable', state.flowing);
|
5326 |
-
state.emittedReadable = true;
|
5327 |
-
if (state.sync)
|
5328 |
-
process.nextTick(function() {
|
5329 |
-
emitReadable_(stream);
|
5330 |
-
});
|
5331 |
-
else
|
5332 |
-
emitReadable_(stream);
|
5333 |
-
}
|
5334 |
-
}
|
5335 |
-
|
5336 |
-
function emitReadable_(stream) {
|
5337 |
-
debug('emit readable');
|
5338 |
-
stream.emit('readable');
|
5339 |
-
flow(stream);
|
5340 |
-
}
|
5341 |
-
|
5342 |
-
|
5343 |
-
// at this point, the user has presumably seen the 'readable' event,
|
5344 |
-
// and called read() to consume some data. that may have triggered
|
5345 |
-
// in turn another _read(n) call, in which case reading = true if
|
5346 |
-
// it's in progress.
|
5347 |
-
// However, if we're not ended, or reading, and the length < hwm,
|
5348 |
-
// then go ahead and try to read some more preemptively.
|
5349 |
-
function maybeReadMore(stream, state) {
|
5350 |
-
if (!state.readingMore) {
|
5351 |
-
state.readingMore = true;
|
5352 |
-
process.nextTick(function() {
|
5353 |
-
maybeReadMore_(stream, state);
|
5354 |
-
});
|
5355 |
-
}
|
5356 |
-
}
|
5357 |
-
|
5358 |
-
function maybeReadMore_(stream, state) {
|
5359 |
-
var len = state.length;
|
5360 |
-
while (!state.reading && !state.flowing && !state.ended &&
|
5361 |
-
state.length < state.highWaterMark) {
|
5362 |
-
debug('maybeReadMore read 0');
|
5363 |
-
stream.read(0);
|
5364 |
-
if (len === state.length)
|
5365 |
-
// didn't get any data, stop spinning.
|
5366 |
-
break;
|
5367 |
-
else
|
5368 |
-
len = state.length;
|
5369 |
-
}
|
5370 |
-
state.readingMore = false;
|
5371 |
-
}
|
5372 |
-
|
5373 |
-
// abstract method. to be overridden in specific implementation classes.
|
5374 |
-
// call cb(er, data) where data is <= n in length.
|
5375 |
-
// for virtual (non-string, non-buffer) streams, "length" is somewhat
|
5376 |
-
// arbitrary, and perhaps not very meaningful.
|
5377 |
-
Readable.prototype._read = function(n) {
|
5378 |
-
this.emit('error', new Error('not implemented'));
|
5379 |
-
};
|
5380 |
-
|
5381 |
-
Readable.prototype.pipe = function(dest, pipeOpts) {
|
5382 |
-
var src = this;
|
5383 |
-
var state = this._readableState;
|
5384 |
-
|
5385 |
-
switch (state.pipesCount) {
|
5386 |
-
case 0:
|
5387 |
-
state.pipes = dest;
|
5388 |
-
break;
|
5389 |
-
case 1:
|
5390 |
-
state.pipes = [state.pipes, dest];
|
5391 |
-
break;
|
5392 |
-
default:
|
5393 |
-
state.pipes.push(dest);
|
5394 |
-
break;
|
5395 |
-
}
|
5396 |
-
state.pipesCount += 1;
|
5397 |
-
debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);
|
5398 |
-
|
5399 |
-
var doEnd = (!pipeOpts || pipeOpts.end !== false) &&
|
5400 |
-
dest !== process.stdout &&
|
5401 |
-
dest !== process.stderr;
|
5402 |
-
|
5403 |
-
var endFn = doEnd ? onend : cleanup;
|
5404 |
-
if (state.endEmitted)
|
5405 |
-
process.nextTick(endFn);
|
5406 |
-
else
|
5407 |
-
src.once('end', endFn);
|
5408 |
-
|
5409 |
-
dest.on('unpipe', onunpipe);
|
5410 |
-
function onunpipe(readable) {
|
5411 |
-
debug('onunpipe');
|
5412 |
-
if (readable === src) {
|
5413 |
-
cleanup();
|
5414 |
-
}
|
5415 |
-
}
|
5416 |
-
|
5417 |
-
function onend() {
|
5418 |
-
debug('onend');
|
5419 |
-
dest.end();
|
5420 |
-
}
|
5421 |
-
|
5422 |
-
// when the dest drains, it reduces the awaitDrain counter
|
5423 |
-
// on the source. This would be more elegant with a .once()
|
5424 |
-
// handler in flow(), but adding and removing repeatedly is
|
5425 |
-
// too slow.
|
5426 |
-
var ondrain = pipeOnDrain(src);
|
5427 |
-
dest.on('drain', ondrain);
|
5428 |
-
|
5429 |
-
function cleanup() {
|
5430 |
-
debug('cleanup');
|
5431 |
-
// cleanup event handlers once the pipe is broken
|
5432 |
-
dest.removeListener('close', onclose);
|
5433 |
-
dest.removeListener('finish', onfinish);
|
5434 |
-
dest.removeListener('drain', ondrain);
|
5435 |
-
dest.removeListener('error', onerror);
|
5436 |
-
dest.removeListener('unpipe', onunpipe);
|
5437 |
-
src.removeListener('end', onend);
|
5438 |
-
src.removeListener('end', cleanup);
|
5439 |
-
src.removeListener('data', ondata);
|
5440 |
-
|
5441 |
-
// if the reader is waiting for a drain event from this
|
5442 |
-
// specific writer, then it would cause it to never start
|
5443 |
-
// flowing again.
|
5444 |
-
// So, if this is awaiting a drain, then we just call it now.
|
5445 |
-
// If we don't know, then assume that we are waiting for one.
|
5446 |
-
if (state.awaitDrain &&
|
5447 |
-
(!dest._writableState || dest._writableState.needDrain))
|
5448 |
-
ondrain();
|
5449 |
-
}
|
5450 |
-
|
5451 |
-
src.on('data', ondata);
|
5452 |
-
function ondata(chunk) {
|
5453 |
-
debug('ondata');
|
5454 |
-
var ret = dest.write(chunk);
|
5455 |
-
if (false === ret) {
|
5456 |
-
debug('false write response, pause',
|
5457 |
-
src._readableState.awaitDrain);
|
5458 |
-
src._readableState.awaitDrain++;
|
5459 |
-
src.pause();
|
5460 |
-
}
|
5461 |
-
}
|
5462 |
-
|
5463 |
-
// if the dest has an error, then stop piping into it.
|
5464 |
-
// however, don't suppress the throwing behavior for this.
|
5465 |
-
function onerror(er) {
|
5466 |
-
debug('onerror', er);
|
5467 |
-
unpipe();
|
5468 |
-
dest.removeListener('error', onerror);
|
5469 |
-
if (EE.listenerCount(dest, 'error') === 0)
|
5470 |
-
dest.emit('error', er);
|
5471 |
-
}
|
5472 |
-
// This is a brutally ugly hack to make sure that our error handler
|
5473 |
-
// is attached before any userland ones. NEVER DO THIS.
|
5474 |
-
if (!dest._events || !dest._events.error)
|
5475 |
-
dest.on('error', onerror);
|
5476 |
-
else if (isArray(dest._events.error))
|
5477 |
-
dest._events.error.unshift(onerror);
|
5478 |
-
else
|
5479 |
-
dest._events.error = [onerror, dest._events.error];
|
5480 |
-
|
5481 |
-
|
5482 |
-
|
5483 |
-
// Both close and finish should trigger unpipe, but only once.
|
5484 |
-
function onclose() {
|
5485 |
-
dest.removeListener('finish', onfinish);
|
5486 |
-
unpipe();
|
5487 |
-
}
|
5488 |
-
dest.once('close', onclose);
|
5489 |
-
function onfinish() {
|
5490 |
-
debug('onfinish');
|
5491 |
-
dest.removeListener('close', onclose);
|
5492 |
-
unpipe();
|
5493 |
-
}
|
5494 |
-
dest.once('finish', onfinish);
|
5495 |
-
|
5496 |
-
function unpipe() {
|
5497 |
-
debug('unpipe');
|
5498 |
-
src.unpipe(dest);
|
5499 |
-
}
|
5500 |
-
|
5501 |
-
// tell the dest that it's being piped to
|
5502 |
-
dest.emit('pipe', src);
|
5503 |
-
|
5504 |
-
// start the flow if it hasn't been started already.
|
5505 |
-
if (!state.flowing) {
|
5506 |
-
debug('pipe resume');
|
5507 |
-
src.resume();
|
5508 |
-
}
|
5509 |
-
|
5510 |
-
return dest;
|
5511 |
-
};
|
5512 |
-
|
5513 |
-
function pipeOnDrain(src) {
|
5514 |
-
return function() {
|
5515 |
-
var state = src._readableState;
|
5516 |
-
debug('pipeOnDrain', state.awaitDrain);
|
5517 |
-
if (state.awaitDrain)
|
5518 |
-
state.awaitDrain--;
|
5519 |
-
if (state.awaitDrain === 0 && EE.listenerCount(src, 'data')) {
|
5520 |
-
state.flowing = true;
|
5521 |
-
flow(src);
|
5522 |
-
}
|
5523 |
-
};
|
5524 |
-
}
|
5525 |
-
|
5526 |
-
|
5527 |
-
Readable.prototype.unpipe = function(dest) {
|
5528 |
-
var state = this._readableState;
|
5529 |
-
|
5530 |
-
// if we're not piping anywhere, then do nothing.
|
5531 |
-
if (state.pipesCount === 0)
|
5532 |
-
return this;
|
5533 |
-
|
5534 |
-
// just one destination. most common case.
|
5535 |
-
if (state.pipesCount === 1) {
|
5536 |
-
// passed in one, but it's not the right one.
|
5537 |
-
if (dest && dest !== state.pipes)
|
5538 |
-
return this;
|
5539 |
-
|
5540 |
-
if (!dest)
|
5541 |
-
dest = state.pipes;
|
5542 |
-
|
5543 |
-
// got a match.
|
5544 |
-
state.pipes = null;
|
5545 |
-
state.pipesCount = 0;
|
5546 |
-
state.flowing = false;
|
5547 |
-
if (dest)
|
5548 |
-
dest.emit('unpipe', this);
|
5549 |
-
return this;
|
5550 |
-
}
|
5551 |
-
|
5552 |
-
// slow case. multiple pipe destinations.
|
5553 |
-
|
5554 |
-
if (!dest) {
|
5555 |
-
// remove all.
|
5556 |
-
var dests = state.pipes;
|
5557 |
-
var len = state.pipesCount;
|
5558 |
-
state.pipes = null;
|
5559 |
-
state.pipesCount = 0;
|
5560 |
-
state.flowing = false;
|
5561 |
-
|
5562 |
-
for (var i = 0; i < len; i++)
|
5563 |
-
dests[i].emit('unpipe', this);
|
5564 |
-
return this;
|
5565 |
-
}
|
5566 |
-
|
5567 |
-
// try to find the right one.
|
5568 |
-
var i = indexOf(state.pipes, dest);
|
5569 |
-
if (i === -1)
|
5570 |
-
return this;
|
5571 |
-
|
5572 |
-
state.pipes.splice(i, 1);
|
5573 |
-
state.pipesCount -= 1;
|
5574 |
-
if (state.pipesCount === 1)
|
5575 |
-
state.pipes = state.pipes[0];
|
5576 |
-
|
5577 |
-
dest.emit('unpipe', this);
|
5578 |
-
|
5579 |
-
return this;
|
5580 |
-
};
|
5581 |
-
|
5582 |
-
// set up data events if they are asked for
|
5583 |
-
// Ensure readable listeners eventually get something
|
5584 |
-
Readable.prototype.on = function(ev, fn) {
|
5585 |
-
var res = Stream.prototype.on.call(this, ev, fn);
|
5586 |
-
|
5587 |
-
// If listening to data, and it has not explicitly been paused,
|
5588 |
-
// then call resume to start the flow of data on the next tick.
|
5589 |
-
if (ev === 'data' && false !== this._readableState.flowing) {
|
5590 |
-
this.resume();
|
5591 |
-
}
|
5592 |
-
|
5593 |
-
if (ev === 'readable' && this.readable) {
|
5594 |
-
var state = this._readableState;
|
5595 |
-
if (!state.readableListening) {
|
5596 |
-
state.readableListening = true;
|
5597 |
-
state.emittedReadable = false;
|
5598 |
-
state.needReadable = true;
|
5599 |
-
if (!state.reading) {
|
5600 |
-
var self = this;
|
5601 |
-
process.nextTick(function() {
|
5602 |
-
debug('readable nexttick read 0');
|
5603 |
-
self.read(0);
|
5604 |
-
});
|
5605 |
-
} else if (state.length) {
|
5606 |
-
emitReadable(this, state);
|
5607 |
-
}
|
5608 |
-
}
|
5609 |
-
}
|
5610 |
-
|
5611 |
-
return res;
|
5612 |
-
};
|
5613 |
-
Readable.prototype.addListener = Readable.prototype.on;
|
5614 |
-
|
5615 |
-
// pause() and resume() are remnants of the legacy readable stream API
|
5616 |
-
// If the user uses them, then switch into old mode.
|
5617 |
-
Readable.prototype.resume = function() {
|
5618 |
-
var state = this._readableState;
|
5619 |
-
if (!state.flowing) {
|
5620 |
-
debug('resume');
|
5621 |
-
state.flowing = true;
|
5622 |
-
if (!state.reading) {
|
5623 |
-
debug('resume read 0');
|
5624 |
-
this.read(0);
|
5625 |
-
}
|
5626 |
-
resume(this, state);
|
5627 |
-
}
|
5628 |
-
return this;
|
5629 |
-
};
|
5630 |
-
|
5631 |
-
function resume(stream, state) {
|
5632 |
-
if (!state.resumeScheduled) {
|
5633 |
-
state.resumeScheduled = true;
|
5634 |
-
process.nextTick(function() {
|
5635 |
-
resume_(stream, state);
|
5636 |
-
});
|
5637 |
-
}
|
5638 |
-
}
|
5639 |
-
|
5640 |
-
function resume_(stream, state) {
|
5641 |
-
state.resumeScheduled = false;
|
5642 |
-
stream.emit('resume');
|
5643 |
-
flow(stream);
|
5644 |
-
if (state.flowing && !state.reading)
|
5645 |
-
stream.read(0);
|
5646 |
-
}
|
5647 |
-
|
5648 |
-
Readable.prototype.pause = function() {
|
5649 |
-
debug('call pause flowing=%j', this._readableState.flowing);
|
5650 |
-
if (false !== this._readableState.flowing) {
|
5651 |
-
debug('pause');
|
5652 |
-
this._readableState.flowing = false;
|
5653 |
-
this.emit('pause');
|
5654 |
-
}
|
5655 |
-
return this;
|
5656 |
-
};
|
5657 |
-
|
5658 |
-
function flow(stream) {
|
5659 |
-
var state = stream._readableState;
|
5660 |
-
debug('flow', state.flowing);
|
5661 |
-
if (state.flowing) {
|
5662 |
-
do {
|
5663 |
-
var chunk = stream.read();
|
5664 |
-
} while (null !== chunk && state.flowing);
|
5665 |
-
}
|
5666 |
-
}
|
5667 |
-
|
5668 |
-
// wrap an old-style stream as the async data source.
|
5669 |
-
// This is *not* part of the readable stream interface.
|
5670 |
-
// It is an ugly unfortunate mess of history.
|
5671 |
-
Readable.prototype.wrap = function(stream) {
|
5672 |
-
var state = this._readableState;
|
5673 |
-
var paused = false;
|
5674 |
-
|
5675 |
-
var self = this;
|
5676 |
-
stream.on('end', function() {
|
5677 |
-
debug('wrapped end');
|
5678 |
-
if (state.decoder && !state.ended) {
|
5679 |
-
var chunk = state.decoder.end();
|
5680 |
-
if (chunk && chunk.length)
|
5681 |
-
self.push(chunk);
|
5682 |
-
}
|
5683 |
-
|
5684 |
-
self.push(null);
|
5685 |
-
});
|
5686 |
-
|
5687 |
-
stream.on('data', function(chunk) {
|
5688 |
-
debug('wrapped data');
|
5689 |
-
if (state.decoder)
|
5690 |
-
chunk = state.decoder.write(chunk);
|
5691 |
-
if (!chunk || !state.objectMode && !chunk.length)
|
5692 |
-
return;
|
5693 |
-
|
5694 |
-
var ret = self.push(chunk);
|
5695 |
-
if (!ret) {
|
5696 |
-
paused = true;
|
5697 |
-
stream.pause();
|
5698 |
-
}
|
5699 |
-
});
|
5700 |
-
|
5701 |
-
// proxy all the other methods.
|
5702 |
-
// important when wrapping filters and duplexes.
|
5703 |
-
for (var i in stream) {
|
5704 |
-
if (util.isFunction(stream[i]) && util.isUndefined(this[i])) {
|
5705 |
-
this[i] = function(method) { return function() {
|
5706 |
-
return stream[method].apply(stream, arguments);
|
5707 |
-
}}(i);
|
5708 |
-
}
|
5709 |
-
}
|
5710 |
-
|
5711 |
-
// proxy certain important events.
|
5712 |
-
var events = ['error', 'close', 'destroy', 'pause', 'resume'];
|
5713 |
-
forEach(events, function(ev) {
|
5714 |
-
stream.on(ev, self.emit.bind(self, ev));
|
5715 |
-
});
|
5716 |
-
|
5717 |
-
// when we try to consume some more bytes, simply unpause the
|
5718 |
-
// underlying stream.
|
5719 |
-
self._read = function(n) {
|
5720 |
-
debug('wrapped _read', n);
|
5721 |
-
if (paused) {
|
5722 |
-
paused = false;
|
5723 |
-
stream.resume();
|
5724 |
-
}
|
5725 |
-
};
|
5726 |
-
|
5727 |
-
return self;
|
5728 |
-
};
|
5729 |
-
|
5730 |
-
|
5731 |
-
|
5732 |
-
// exposed for testing purposes only.
|
5733 |
-
Readable._fromList = fromList;
|
5734 |
-
|
5735 |
-
// Pluck off n bytes from an array of buffers.
|
5736 |
-
// Length is the combined lengths of all the buffers in the list.
|
5737 |
-
function fromList(n, state) {
|
5738 |
-
var list = state.buffer;
|
5739 |
-
var length = state.length;
|
5740 |
-
var stringMode = !!state.decoder;
|
5741 |
-
var objectMode = !!state.objectMode;
|
5742 |
-
var ret;
|
5743 |
-
|
5744 |
-
// nothing in the list, definitely empty.
|
5745 |
-
if (list.length === 0)
|
5746 |
-
return null;
|
5747 |
-
|
5748 |
-
if (length === 0)
|
5749 |
-
ret = null;
|
5750 |
-
else if (objectMode)
|
5751 |
-
ret = list.shift();
|
5752 |
-
else if (!n || n >= length) {
|
5753 |
-
// read it all, truncate the array.
|
5754 |
-
if (stringMode)
|
5755 |
-
ret = list.join('');
|
5756 |
-
else
|
5757 |
-
ret = Buffer.concat(list, length);
|
5758 |
-
list.length = 0;
|
5759 |
-
} else {
|
5760 |
-
// read just some of it.
|
5761 |
-
if (n < list[0].length) {
|
5762 |
-
// just take a part of the first list item.
|
5763 |
-
// slice is the same for buffers and strings.
|
5764 |
-
var buf = list[0];
|
5765 |
-
ret = buf.slice(0, n);
|
5766 |
-
list[0] = buf.slice(n);
|
5767 |
-
} else if (n === list[0].length) {
|
5768 |
-
// first list is a perfect match
|
5769 |
-
ret = list.shift();
|
5770 |
-
} else {
|
5771 |
-
// complex case.
|
5772 |
-
// we have enough to cover it, but it spans past the first buffer.
|
5773 |
-
if (stringMode)
|
5774 |
-
ret = '';
|
5775 |
-
else
|
5776 |
-
ret = new Buffer(n);
|
5777 |
-
|
5778 |
-
var c = 0;
|
5779 |
-
for (var i = 0, l = list.length; i < l && c < n; i++) {
|
5780 |
-
var buf = list[0];
|
5781 |
-
var cpy = Math.min(n - c, buf.length);
|
5782 |
-
|
5783 |
-
if (stringMode)
|
5784 |
-
ret += buf.slice(0, cpy);
|
5785 |
-
else
|
5786 |
-
buf.copy(ret, c, 0, cpy);
|
5787 |
-
|
5788 |
-
if (cpy < buf.length)
|
5789 |
-
list[0] = buf.slice(cpy);
|
5790 |
-
else
|
5791 |
-
list.shift();
|
5792 |
-
|
5793 |
-
c += cpy;
|
5794 |
-
}
|
5795 |
-
}
|
5796 |
-
}
|
5797 |
-
|
5798 |
-
return ret;
|
5799 |
-
}
|
5800 |
-
|
5801 |
-
function endReadable(stream) {
|
5802 |
-
var state = stream._readableState;
|
5803 |
-
|
5804 |
-
// If we get here before consuming all the bytes, then that is a
|
5805 |
-
// bug in node. Should never happen.
|
5806 |
-
if (state.length > 0)
|
5807 |
-
throw new Error('endReadable called on non-empty stream');
|
5808 |
-
|
5809 |
-
if (!state.endEmitted) {
|
5810 |
-
state.ended = true;
|
5811 |
-
process.nextTick(function() {
|
5812 |
-
// Check that we didn't get one last unshift.
|
5813 |
-
if (!state.endEmitted && state.length === 0) {
|
5814 |
-
state.endEmitted = true;
|
5815 |
-
stream.readable = false;
|
5816 |
-
stream.emit('end');
|
5817 |
-
}
|
5818 |
-
});
|
5819 |
-
}
|
5820 |
-
}
|
5821 |
-
|
5822 |
-
function forEach (xs, f) {
|
5823 |
-
for (var i = 0, l = xs.length; i < l; i++) {
|
5824 |
-
f(xs[i], i);
|
5825 |
-
}
|
5826 |
-
}
|
5827 |
-
|
5828 |
-
function indexOf (xs, x) {
|
5829 |
-
for (var i = 0, l = xs.length; i < l; i++) {
|
5830 |
-
if (xs[i] === x) return i;
|
5831 |
-
}
|
5832 |
-
return -1;
|
5833 |
-
}
|
5834 |
-
|
5835 |
-
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
|
5836 |
-
|
5837 |
-
/***/ },
|
5838 |
-
|
5839 |
-
/***/ 486:
|
5840 |
-
/***/ function(module, exports) {
|
5841 |
-
|
5842 |
-
module.exports = Array.isArray || function (arr) {
|
5843 |
-
return Object.prototype.toString.call(arr) == '[object Array]';
|
5844 |
-
};
|
5845 |
-
|
5846 |
-
|
5847 |
-
/***/ },
|
5848 |
-
|
5849 |
-
/***/ 487:
|
5850 |
-
/***/ function(module, exports, __webpack_require__) {
|
5851 |
-
|
5852 |
-
/* WEBPACK VAR INJECTION */(function(Buffer, global) {/*!
|
5853 |
-
* The buffer module from node.js, for the browser.
|
5854 |
-
*
|
5855 |
-
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
|
5856 |
-
* @license MIT
|
5857 |
-
*/
|
5858 |
-
/* eslint-disable no-proto */
|
5859 |
-
|
5860 |
-
'use strict'
|
5861 |
-
|
5862 |
-
var base64 = __webpack_require__(488)
|
5863 |
-
var ieee754 = __webpack_require__(489)
|
5864 |
-
var isArray = __webpack_require__(490)
|
5865 |
-
|
5866 |
-
exports.Buffer = Buffer
|
5867 |
-
exports.SlowBuffer = SlowBuffer
|
5868 |
-
exports.INSPECT_MAX_BYTES = 50
|
5869 |
-
|
5870 |
-
/**
|
5871 |
-
* If `Buffer.TYPED_ARRAY_SUPPORT`:
|
5872 |
-
* === true Use Uint8Array implementation (fastest)
|
5873 |
-
* === false Use Object implementation (most compatible, even IE6)
|
5874 |
-
*
|
5875 |
-
* Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
|
5876 |
-
* Opera 11.6+, iOS 4.2+.
|
5877 |
-
*
|
5878 |
-
* Due to various browser bugs, sometimes the Object implementation will be used even
|
5879 |
-
* when the browser supports typed arrays.
|
5880 |
-
*
|
5881 |
-
* Note:
|
5882 |
-
*
|
5883 |
-
* - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
|
5884 |
-
* See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
|
5885 |
-
*
|
5886 |
-
* - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
|
5887 |
-
*
|
5888 |
-
* - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
|
5889 |
-
* incorrect length in some situations.
|
5890 |
-
|
5891 |
-
* We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
|
5892 |
-
* get the Object implementation, which is slower but behaves correctly.
|
5893 |
-
*/
|
5894 |
-
Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
|
5895 |
-
? global.TYPED_ARRAY_SUPPORT
|
5896 |
-
: typedArraySupport()
|
5897 |
-
|
5898 |
-
/*
|
5899 |
-
* Export kMaxLength after typed array support is determined.
|
5900 |
-
*/
|
5901 |
-
exports.kMaxLength = kMaxLength()
|
5902 |
-
|
5903 |
-
function typedArraySupport () {
|
5904 |
-
try {
|
5905 |
-
var arr = new Uint8Array(1)
|
5906 |
-
arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
|
5907 |
-
return arr.foo() === 42 && // typed array instances can be augmented
|
5908 |
-
typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
|
5909 |
-
arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
|
5910 |
-
} catch (e) {
|
5911 |
-
return false
|
5912 |
-
}
|
5913 |
-
}
|
5914 |
-
|
5915 |
-
function kMaxLength () {
|
5916 |
-
return Buffer.TYPED_ARRAY_SUPPORT
|
5917 |
-
? 0x7fffffff
|
5918 |
-
: 0x3fffffff
|
5919 |
-
}
|
5920 |
-
|
5921 |
-
function createBuffer (that, length) {
|
5922 |
-
if (kMaxLength() < length) {
|
5923 |
-
throw new RangeError('Invalid typed array length')
|
5924 |
-
}
|
5925 |
-
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
5926 |
-
// Return an augmented `Uint8Array` instance, for best performance
|
5927 |
-
that = new Uint8Array(length)
|
5928 |
-
that.__proto__ = Buffer.prototype
|
5929 |
-
} else {
|
5930 |
-
// Fallback: Return an object instance of the Buffer class
|
5931 |
-
if (that === null) {
|
5932 |
-
that = new Buffer(length)
|
5933 |
-
}
|
5934 |
-
that.length = length
|
5935 |
-
}
|
5936 |
-
|
5937 |
-
return that
|
5938 |
-
}
|
5939 |
-
|
5940 |
-
/**
|
5941 |
-
* The Buffer constructor returns instances of `Uint8Array` that have their
|
5942 |
-
* prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
|
5943 |
-
* `Uint8Array`, so the returned instances will have all the node `Buffer` methods
|
5944 |
-
* and the `Uint8Array` methods. Square bracket notation works as expected -- it
|
5945 |
-
* returns a single octet.
|
5946 |
-
*
|
5947 |
-
* The `Uint8Array` prototype remains unmodified.
|
5948 |
-
*/
|
5949 |
-
|
5950 |
-
function Buffer (arg, encodingOrOffset, length) {
|
5951 |
-
if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
|
5952 |
-
return new Buffer(arg, encodingOrOffset, length)
|
5953 |
-
}
|
5954 |
-
|
5955 |
-
// Common case.
|
5956 |
-
if (typeof arg === 'number') {
|
5957 |
-
if (typeof encodingOrOffset === 'string') {
|
5958 |
-
throw new Error(
|
5959 |
-
'If encoding is specified then the first argument must be a string'
|
5960 |
-
)
|
5961 |
-
}
|
5962 |
-
return allocUnsafe(this, arg)
|
5963 |
-
}
|
5964 |
-
return from(this, arg, encodingOrOffset, length)
|
5965 |
-
}
|
5966 |
-
|
5967 |
-
Buffer.poolSize = 8192 // not used by this implementation
|
5968 |
-
|
5969 |
-
// TODO: Legacy, not needed anymore. Remove in next major version.
|
5970 |
-
Buffer._augment = function (arr) {
|
5971 |
-
arr.__proto__ = Buffer.prototype
|
5972 |
-
return arr
|
5973 |
-
}
|
5974 |
-
|
5975 |
-
function from (that, value, encodingOrOffset, length) {
|
5976 |
-
if (typeof value === 'number') {
|
5977 |
-
throw new TypeError('"value" argument must not be a number')
|
5978 |
-
}
|
5979 |
-
|
5980 |
-
if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
|
5981 |
-
return fromArrayBuffer(that, value, encodingOrOffset, length)
|
5982 |
-
}
|
5983 |
-
|
5984 |
-
if (typeof value === 'string') {
|
5985 |
-
return fromString(that, value, encodingOrOffset)
|
5986 |
-
}
|
5987 |
-
|
5988 |
-
return fromObject(that, value)
|
5989 |
-
}
|
5990 |
-
|
5991 |
-
/**
|
5992 |
-
* Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
|
5993 |
-
* if value is a number.
|
5994 |
-
* Buffer.from(str[, encoding])
|
5995 |
-
* Buffer.from(array)
|
5996 |
-
* Buffer.from(buffer)
|
5997 |
-
* Buffer.from(arrayBuffer[, byteOffset[, length]])
|
5998 |
-
**/
|
5999 |
-
Buffer.from = function (value, encodingOrOffset, length) {
|
6000 |
-
return from(null, value, encodingOrOffset, length)
|
6001 |
-
}
|
6002 |
-
|
6003 |
-
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
6004 |
-
Buffer.prototype.__proto__ = Uint8Array.prototype
|
6005 |
-
Buffer.__proto__ = Uint8Array
|
6006 |
-
if (typeof Symbol !== 'undefined' && Symbol.species &&
|
6007 |
-
Buffer[Symbol.species] === Buffer) {
|
6008 |
-
// Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
|
6009 |
-
Object.defineProperty(Buffer, Symbol.species, {
|
6010 |
-
value: null,
|
6011 |
-
configurable: true
|
6012 |
-
})
|
6013 |
-
}
|
6014 |
-
}
|
6015 |
-
|
6016 |
-
function assertSize (size) {
|
6017 |
-
if (typeof size !== 'number') {
|
6018 |
-
throw new TypeError('"size" argument must be a number')
|
6019 |
-
} else if (size < 0) {
|
6020 |
-
throw new RangeError('"size" argument must not be negative')
|
6021 |
-
}
|
6022 |
-
}
|
6023 |
-
|
6024 |
-
function alloc (that, size, fill, encoding) {
|
6025 |
-
assertSize(size)
|
6026 |
-
if (size <= 0) {
|
6027 |
-
return createBuffer(that, size)
|
6028 |
-
}
|
6029 |
-
if (fill !== undefined) {
|
6030 |
-
// Only pay attention to encoding if it's a string. This
|
6031 |
-
// prevents accidentally sending in a number that would
|
6032 |
-
// be interpretted as a start offset.
|
6033 |
-
return typeof encoding === 'string'
|
6034 |
-
? createBuffer(that, size).fill(fill, encoding)
|
6035 |
-
: createBuffer(that, size).fill(fill)
|
6036 |
-
}
|
6037 |
-
return createBuffer(that, size)
|
6038 |
-
}
|
6039 |
-
|
6040 |
-
/**
|
6041 |
-
* Creates a new filled Buffer instance.
|
6042 |
-
* alloc(size[, fill[, encoding]])
|
6043 |
-
**/
|
6044 |
-
Buffer.alloc = function (size, fill, encoding) {
|
6045 |
-
return alloc(null, size, fill, encoding)
|
6046 |
-
}
|
6047 |
-
|
6048 |
-
function allocUnsafe (that, size) {
|
6049 |
-
assertSize(size)
|
6050 |
-
that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
|
6051 |
-
if (!Buffer.TYPED_ARRAY_SUPPORT) {
|
6052 |
-
for (var i = 0; i < size; ++i) {
|
6053 |
-
that[i] = 0
|
6054 |
-
}
|
6055 |
-
}
|
6056 |
-
return that
|
6057 |
-
}
|
6058 |
-
|
6059 |
-
/**
|
6060 |
-
* Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
|
6061 |
-
* */
|
6062 |
-
Buffer.allocUnsafe = function (size) {
|
6063 |
-
return allocUnsafe(null, size)
|
6064 |
-
}
|
6065 |
-
/**
|
6066 |
-
* Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
6067 |
-
*/
|
6068 |
-
Buffer.allocUnsafeSlow = function (size) {
|
6069 |
-
return allocUnsafe(null, size)
|
6070 |
-
}
|
6071 |
-
|
6072 |
-
function fromString (that, string, encoding) {
|
6073 |
-
if (typeof encoding !== 'string' || encoding === '') {
|
6074 |
-
encoding = 'utf8'
|
6075 |
-
}
|
6076 |
-
|
6077 |
-
if (!Buffer.isEncoding(encoding)) {
|
6078 |
-
throw new TypeError('"encoding" must be a valid string encoding')
|
6079 |
-
}
|
6080 |
-
|
6081 |
-
var length = byteLength(string, encoding) | 0
|
6082 |
-
that = createBuffer(that, length)
|
6083 |
-
|
6084 |
-
var actual = that.write(string, encoding)
|
6085 |
-
|
6086 |
-
if (actual !== length) {
|
6087 |
-
// Writing a hex string, for example, that contains invalid characters will
|
6088 |
-
// cause everything after the first invalid character to be ignored. (e.g.
|
6089 |
-
// 'abxxcd' will be treated as 'ab')
|
6090 |
-
that = that.slice(0, actual)
|
6091 |
-
}
|
6092 |
-
|
6093 |
-
return that
|
6094 |
-
}
|
6095 |
-
|
6096 |
-
function fromArrayLike (that, array) {
|
6097 |
-
var length = array.length < 0 ? 0 : checked(array.length) | 0
|
6098 |
-
that = createBuffer(that, length)
|
6099 |
-
for (var i = 0; i < length; i += 1) {
|
6100 |
-
that[i] = array[i] & 255
|
6101 |
-
}
|
6102 |
-
return that
|
6103 |
-
}
|
6104 |
-
|
6105 |
-
function fromArrayBuffer (that, array, byteOffset, length) {
|
6106 |
-
array.byteLength // this throws if `array` is not a valid ArrayBuffer
|
6107 |
-
|
6108 |
-
if (byteOffset < 0 || array.byteLength < byteOffset) {
|
6109 |
-
throw new RangeError('\'offset\' is out of bounds')
|
6110 |
-
}
|
6111 |
-
|
6112 |
-
if (array.byteLength < byteOffset + (length || 0)) {
|
6113 |
-
throw new RangeError('\'length\' is out of bounds')
|
6114 |
-
}
|
6115 |
-
|
6116 |
-
if (byteOffset === undefined && length === undefined) {
|
6117 |
-
array = new Uint8Array(array)
|
6118 |
-
} else if (length === undefined) {
|
6119 |
-
array = new Uint8Array(array, byteOffset)
|
6120 |
-
} else {
|
6121 |
-
array = new Uint8Array(array, byteOffset, length)
|
6122 |
-
}
|
6123 |
-
|
6124 |
-
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
6125 |
-
// Return an augmented `Uint8Array` instance, for best performance
|
6126 |
-
that = array
|
6127 |
-
that.__proto__ = Buffer.prototype
|
6128 |
-
} else {
|
6129 |
-
// Fallback: Return an object instance of the Buffer class
|
6130 |
-
that = fromArrayLike(that, array)
|
6131 |
-
}
|
6132 |
-
return that
|
6133 |
-
}
|
6134 |
-
|
6135 |
-
function fromObject (that, obj) {
|
6136 |
-
if (Buffer.isBuffer(obj)) {
|
6137 |
-
var len = checked(obj.length) | 0
|
6138 |
-
that = createBuffer(that, len)
|
6139 |
-
|
6140 |
-
if (that.length === 0) {
|
6141 |
-
return that
|
6142 |
-
}
|
6143 |
-
|
6144 |
-
obj.copy(that, 0, 0, len)
|
6145 |
-
return that
|
6146 |
-
}
|
6147 |
-
|
6148 |
-
if (obj) {
|
6149 |
-
if ((typeof ArrayBuffer !== 'undefined' &&
|
6150 |
-
obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
|
6151 |
-
if (typeof obj.length !== 'number' || isnan(obj.length)) {
|
6152 |
-
return createBuffer(that, 0)
|
6153 |
-
}
|
6154 |
-
return fromArrayLike(that, obj)
|
6155 |
-
}
|
6156 |
-
|
6157 |
-
if (obj.type === 'Buffer' && isArray(obj.data)) {
|
6158 |
-
return fromArrayLike(that, obj.data)
|
6159 |
-
}
|
6160 |
-
}
|
6161 |
-
|
6162 |
-
throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
|
6163 |
-
}
|
6164 |
-
|
6165 |
-
function checked (length) {
|
6166 |
-
// Note: cannot use `length < kMaxLength()` here because that fails when
|
6167 |
-
// length is NaN (which is otherwise coerced to zero.)
|
6168 |
-
if (length >= kMaxLength()) {
|
6169 |
-
throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
|
6170 |
-
'size: 0x' + kMaxLength().toString(16) + ' bytes')
|
6171 |
-
}
|
6172 |
-
return length | 0
|
6173 |
-
}
|
6174 |
-
|
6175 |
-
function SlowBuffer (length) {
|
6176 |
-
if (+length != length) { // eslint-disable-line eqeqeq
|
6177 |
-
length = 0
|
6178 |
-
}
|
6179 |
-
return Buffer.alloc(+length)
|
6180 |
-
}
|
6181 |
-
|
6182 |
-
Buffer.isBuffer = function isBuffer (b) {
|
6183 |
-
return !!(b != null && b._isBuffer)
|
6184 |
-
}
|
6185 |
-
|
6186 |
-
Buffer.compare = function compare (a, b) {
|
6187 |
-
if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
|
6188 |
-
throw new TypeError('Arguments must be Buffers')
|
6189 |
-
}
|
6190 |
-
|
6191 |
-
if (a === b) return 0
|
6192 |
-
|
6193 |
-
var x = a.length
|
6194 |
-
var y = b.length
|
6195 |
-
|
6196 |
-
for (var i = 0, len = Math.min(x, y); i < len; ++i) {
|
6197 |
-
if (a[i] !== b[i]) {
|
6198 |
-
x = a[i]
|
6199 |
-
y = b[i]
|
6200 |
-
break
|
6201 |
-
}
|
6202 |
-
}
|
6203 |
-
|
6204 |
-
if (x < y) return -1
|
6205 |
-
if (y < x) return 1
|
6206 |
-
return 0
|
6207 |
-
}
|
6208 |
-
|
6209 |
-
Buffer.isEncoding = function isEncoding (encoding) {
|
6210 |
-
switch (String(encoding).toLowerCase()) {
|
6211 |
-
case 'hex':
|
6212 |
-
case 'utf8':
|
6213 |
-
case 'utf-8':
|
6214 |
-
case 'ascii':
|
6215 |
-
case 'latin1':
|
6216 |
-
case 'binary':
|
6217 |
-
case 'base64':
|
6218 |
-
case 'ucs2':
|
6219 |
-
case 'ucs-2':
|
6220 |
-
case 'utf16le':
|
6221 |
-
case 'utf-16le':
|
6222 |
-
return true
|
6223 |
-
default:
|
6224 |
-
return false
|
6225 |
-
}
|
6226 |
-
}
|
6227 |
-
|
6228 |
-
Buffer.concat = function concat (list, length) {
|
6229 |
-
if (!isArray(list)) {
|
6230 |
-
throw new TypeError('"list" argument must be an Array of Buffers')
|
6231 |
-
}
|
6232 |
-
|
6233 |
-
if (list.length === 0) {
|
6234 |
-
return Buffer.alloc(0)
|
6235 |
-
}
|
6236 |
-
|
6237 |
-
var i
|
6238 |
-
if (length === undefined) {
|
6239 |
-
length = 0
|
6240 |
-
for (i = 0; i < list.length; ++i) {
|
6241 |
-
length += list[i].length
|
6242 |
-
}
|
6243 |
-
}
|
6244 |
-
|
6245 |
-
var buffer = Buffer.allocUnsafe(length)
|
6246 |
-
var pos = 0
|
6247 |
-
for (i = 0; i < list.length; ++i) {
|
6248 |
-
var buf = list[i]
|
6249 |
-
if (!Buffer.isBuffer(buf)) {
|
6250 |
-
throw new TypeError('"list" argument must be an Array of Buffers')
|
6251 |
-
}
|
6252 |
-
buf.copy(buffer, pos)
|
6253 |
-
pos += buf.length
|
6254 |
-
}
|
6255 |
-
return buffer
|
6256 |
-
}
|
6257 |
-
|
6258 |
-
function byteLength (string, encoding) {
|
6259 |
-
if (Buffer.isBuffer(string)) {
|
6260 |
-
return string.length
|
6261 |
-
}
|
6262 |
-
if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
|
6263 |
-
(ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
|
6264 |
-
return string.byteLength
|
6265 |
-
}
|
6266 |
-
if (typeof string !== 'string') {
|
6267 |
-
string = '' + string
|
6268 |
-
}
|
6269 |
-
|
6270 |
-
var len = string.length
|
6271 |
-
if (len === 0) return 0
|
6272 |
-
|
6273 |
-
// Use a for loop to avoid recursion
|
6274 |
-
var loweredCase = false
|
6275 |
-
for (;;) {
|
6276 |
-
switch (encoding) {
|
6277 |
-
case 'ascii':
|
6278 |
-
case 'latin1':
|
6279 |
-
case 'binary':
|
6280 |
-
return len
|
6281 |
-
case 'utf8':
|
6282 |
-
case 'utf-8':
|
6283 |
-
case undefined:
|
6284 |
-
return utf8ToBytes(string).length
|
6285 |
-
case 'ucs2':
|
6286 |
-
case 'ucs-2':
|
6287 |
-
case 'utf16le':
|
6288 |
-
case 'utf-16le':
|
6289 |
-
return len * 2
|
6290 |
-
case 'hex':
|
6291 |
-
return len >>> 1
|
6292 |
-
case 'base64':
|
6293 |
-
return base64ToBytes(string).length
|
6294 |
-
default:
|
6295 |
-
if (loweredCase) return utf8ToBytes(string).length // assume utf8
|
6296 |
-
encoding = ('' + encoding).toLowerCase()
|
6297 |
-
loweredCase = true
|
6298 |
-
}
|
6299 |
-
}
|
6300 |
-
}
|
6301 |
-
Buffer.byteLength = byteLength
|
6302 |
-
|
6303 |
-
function slowToString (encoding, start, end) {
|
6304 |
-
var loweredCase = false
|
6305 |
-
|
6306 |
-
// No need to verify that "this.length <= MAX_UINT32" since it's a read-only
|
6307 |
-
// property of a typed array.
|
6308 |
-
|
6309 |
-
// This behaves neither like String nor Uint8Array in that we set start/end
|
6310 |
-
// to their upper/lower bounds if the value passed is out of range.
|
6311 |
-
// undefined is handled specially as per ECMA-262 6th Edition,
|
6312 |
-
// Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
|
6313 |
-
if (start === undefined || start < 0) {
|
6314 |
-
start = 0
|
6315 |
-
}
|
6316 |
-
// Return early if start > this.length. Done here to prevent potential uint32
|
6317 |
-
// coercion fail below.
|
6318 |
-
if (start > this.length) {
|
6319 |
-
return ''
|
6320 |
-
}
|
6321 |
-
|
6322 |
-
if (end === undefined || end > this.length) {
|
6323 |
-
end = this.length
|
6324 |
-
}
|
6325 |
-
|
6326 |
-
if (end <= 0) {
|
6327 |
-
return ''
|
6328 |
-
}
|
6329 |
-
|
6330 |
-
// Force coersion to uint32. This will also coerce falsey/NaN values to 0.
|
6331 |
-
end >>>= 0
|
6332 |
-
start >>>= 0
|
6333 |
-
|
6334 |
-
if (end <= start) {
|
6335 |
-
return ''
|
6336 |
-
}
|
6337 |
-
|
6338 |
-
if (!encoding) encoding = 'utf8'
|
6339 |
-
|
6340 |
-
while (true) {
|
6341 |
-
switch (encoding) {
|
6342 |
-
case 'hex':
|
6343 |
-
return hexSlice(this, start, end)
|
6344 |
-
|
6345 |
-
case 'utf8':
|
6346 |
-
case 'utf-8':
|
6347 |
-
return utf8Slice(this, start, end)
|
6348 |
-
|
6349 |
-
case 'ascii':
|
6350 |
-
return asciiSlice(this, start, end)
|
6351 |
-
|
6352 |
-
case 'latin1':
|
6353 |
-
case 'binary':
|
6354 |
-
return latin1Slice(this, start, end)
|
6355 |
-
|
6356 |
-
case 'base64':
|
6357 |
-
return base64Slice(this, start, end)
|
6358 |
-
|
6359 |
-
case 'ucs2':
|
6360 |
-
case 'ucs-2':
|
6361 |
-
case 'utf16le':
|
6362 |
-
case 'utf-16le':
|
6363 |
-
return utf16leSlice(this, start, end)
|
6364 |
-
|
6365 |
-
default:
|
6366 |
-
if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
|
6367 |
-
encoding = (encoding + '').toLowerCase()
|
6368 |
-
loweredCase = true
|
6369 |
-
}
|
6370 |
-
}
|
6371 |
-
}
|
6372 |
-
|
6373 |
-
// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
|
6374 |
-
// Buffer instances.
|
6375 |
-
Buffer.prototype._isBuffer = true
|
6376 |
-
|
6377 |
-
function swap (b, n, m) {
|
6378 |
-
var i = b[n]
|
6379 |
-
b[n] = b[m]
|
6380 |
-
b[m] = i
|
6381 |
-
}
|
6382 |
-
|
6383 |
-
Buffer.prototype.swap16 = function swap16 () {
|
6384 |
-
var len = this.length
|
6385 |
-
if (len % 2 !== 0) {
|
6386 |
-
throw new RangeError('Buffer size must be a multiple of 16-bits')
|
6387 |
-
}
|
6388 |
-
for (var i = 0; i < len; i += 2) {
|
6389 |
-
swap(this, i, i + 1)
|
6390 |
-
}
|
6391 |
-
return this
|
6392 |
-
}
|
6393 |
-
|
6394 |
-
Buffer.prototype.swap32 = function swap32 () {
|
6395 |
-
var len = this.length
|
6396 |
-
if (len % 4 !== 0) {
|
6397 |
-
throw new RangeError('Buffer size must be a multiple of 32-bits')
|
6398 |
-
}
|
6399 |
-
for (var i = 0; i < len; i += 4) {
|
6400 |
-
swap(this, i, i + 3)
|
6401 |
-
swap(this, i + 1, i + 2)
|
6402 |
-
}
|
6403 |
-
return this
|
6404 |
-
}
|
6405 |
-
|
6406 |
-
Buffer.prototype.swap64 = function swap64 () {
|
6407 |
-
var len = this.length
|
6408 |
-
if (len % 8 !== 0) {
|
6409 |
-
throw new RangeError('Buffer size must be a multiple of 64-bits')
|
6410 |
-
}
|
6411 |
-
for (var i = 0; i < len; i += 8) {
|
6412 |
-
swap(this, i, i + 7)
|
6413 |
-
swap(this, i + 1, i + 6)
|
6414 |
-
swap(this, i + 2, i + 5)
|
6415 |
-
swap(this, i + 3, i + 4)
|
6416 |
-
}
|
6417 |
-
return this
|
6418 |
-
}
|
6419 |
-
|
6420 |
-
Buffer.prototype.toString = function toString () {
|
6421 |
-
var length = this.length | 0
|
6422 |
-
if (length === 0) return ''
|
6423 |
-
if (arguments.length === 0) return utf8Slice(this, 0, length)
|
6424 |
-
return slowToString.apply(this, arguments)
|
6425 |
-
}
|
6426 |
-
|
6427 |
-
Buffer.prototype.equals = function equals (b) {
|
6428 |
-
if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
|
6429 |
-
if (this === b) return true
|
6430 |
-
return Buffer.compare(this, b) === 0
|
6431 |
-
}
|
6432 |
-
|
6433 |
-
Buffer.prototype.inspect = function inspect () {
|
6434 |
-
var str = ''
|
6435 |
-
var max = exports.INSPECT_MAX_BYTES
|
6436 |
-
if (this.length > 0) {
|
6437 |
-
str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
|
6438 |
-
if (this.length > max) str += ' ... '
|
6439 |
-
}
|
6440 |
-
return '<Buffer ' + str + '>'
|
6441 |
-
}
|
6442 |
-
|
6443 |
-
Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
|
6444 |
-
if (!Buffer.isBuffer(target)) {
|
6445 |
-
throw new TypeError('Argument must be a Buffer')
|
6446 |
-
}
|
6447 |
-
|
6448 |
-
if (start === undefined) {
|
6449 |
-
start = 0
|
6450 |
-
}
|
6451 |
-
if (end === undefined) {
|
6452 |
-
end = target ? target.length : 0
|
6453 |
-
}
|
6454 |
-
if (thisStart === undefined) {
|
6455 |
-
thisStart = 0
|
6456 |
-
}
|
6457 |
-
if (thisEnd === undefined) {
|
6458 |
-
thisEnd = this.length
|
6459 |
-
}
|
6460 |
-
|
6461 |
-
if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
|
6462 |
-
throw new RangeError('out of range index')
|
6463 |
-
}
|
6464 |
-
|
6465 |
-
if (thisStart >= thisEnd && start >= end) {
|
6466 |
-
return 0
|
6467 |
-
}
|
6468 |
-
if (thisStart >= thisEnd) {
|
6469 |
-
return -1
|
6470 |
-
}
|
6471 |
-
if (start >= end) {
|
6472 |
-
return 1
|
6473 |
-
}
|
6474 |
-
|
6475 |
-
start >>>= 0
|
6476 |
-
end >>>= 0
|
6477 |
-
thisStart >>>= 0
|
6478 |
-
thisEnd >>>= 0
|
6479 |
-
|
6480 |
-
if (this === target) return 0
|
6481 |
-
|
6482 |
-
var x = thisEnd - thisStart
|
6483 |
-
var y = end - start
|
6484 |
-
var len = Math.min(x, y)
|
6485 |
-
|
6486 |
-
var thisCopy = this.slice(thisStart, thisEnd)
|
6487 |
-
var targetCopy = target.slice(start, end)
|
6488 |
-
|
6489 |
-
for (var i = 0; i < len; ++i) {
|
6490 |
-
if (thisCopy[i] !== targetCopy[i]) {
|
6491 |
-
x = thisCopy[i]
|
6492 |
-
y = targetCopy[i]
|
6493 |
-
break
|
6494 |
-
}
|
6495 |
-
}
|
6496 |
-
|
6497 |
-
if (x < y) return -1
|
6498 |
-
if (y < x) return 1
|
6499 |
-
return 0
|
6500 |
-
}
|
6501 |
-
|
6502 |
-
// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
|
6503 |
-
// OR the last index of `val` in `buffer` at offset <= `byteOffset`.
|
6504 |
-
//
|
6505 |
-
// Arguments:
|
6506 |
-
// - buffer - a Buffer to search
|
6507 |
-
// - val - a string, Buffer, or number
|
6508 |
-
// - byteOffset - an index into `buffer`; will be clamped to an int32
|
6509 |
-
// - encoding - an optional encoding, relevant is val is a string
|
6510 |
-
// - dir - true for indexOf, false for lastIndexOf
|
6511 |
-
function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
|
6512 |
-
// Empty buffer means no match
|
6513 |
-
if (buffer.length === 0) return -1
|
6514 |
-
|
6515 |
-
// Normalize byteOffset
|
6516 |
-
if (typeof byteOffset === 'string') {
|
6517 |
-
encoding = byteOffset
|
6518 |
-
byteOffset = 0
|
6519 |
-
} else if (byteOffset > 0x7fffffff) {
|
6520 |
-
byteOffset = 0x7fffffff
|
6521 |
-
} else if (byteOffset < -0x80000000) {
|
6522 |
-
byteOffset = -0x80000000
|
6523 |
-
}
|
6524 |
-
byteOffset = +byteOffset // Coerce to Number.
|
6525 |
-
if (isNaN(byteOffset)) {
|
6526 |
-
// byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
|
6527 |
-
byteOffset = dir ? 0 : (buffer.length - 1)
|
6528 |
-
}
|
6529 |
-
|
6530 |
-
// Normalize byteOffset: negative offsets start from the end of the buffer
|
6531 |
-
if (byteOffset < 0) byteOffset = buffer.length + byteOffset
|
6532 |
-
if (byteOffset >= buffer.length) {
|
6533 |
-
if (dir) return -1
|
6534 |
-
else byteOffset = buffer.length - 1
|
6535 |
-
} else if (byteOffset < 0) {
|
6536 |
-
if (dir) byteOffset = 0
|
6537 |
-
else return -1
|
6538 |
-
}
|
6539 |
-
|
6540 |
-
// Normalize val
|
6541 |
-
if (typeof val === 'string') {
|
6542 |
-
val = Buffer.from(val, encoding)
|
6543 |
-
}
|
6544 |
-
|
6545 |
-
// Finally, search either indexOf (if dir is true) or lastIndexOf
|
6546 |
-
if (Buffer.isBuffer(val)) {
|
6547 |
-
// Special case: looking for empty string/buffer always fails
|
6548 |
-
if (val.length === 0) {
|
6549 |
-
return -1
|
6550 |
-
}
|
6551 |
-
return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
|
6552 |
-
} else if (typeof val === 'number') {
|
6553 |
-
val = val & 0xFF // Search for a byte value [0-255]
|
6554 |
-
if (Buffer.TYPED_ARRAY_SUPPORT &&
|
6555 |
-
typeof Uint8Array.prototype.indexOf === 'function') {
|
6556 |
-
if (dir) {
|
6557 |
-
return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
|
6558 |
-
} else {
|
6559 |
-
return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
|
6560 |
-
}
|
6561 |
-
}
|
6562 |
-
return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
|
6563 |
-
}
|
6564 |
-
|
6565 |
-
throw new TypeError('val must be string, number or Buffer')
|
6566 |
-
}
|
6567 |
-
|
6568 |
-
function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
|
6569 |
-
var indexSize = 1
|
6570 |
-
var arrLength = arr.length
|
6571 |
-
var valLength = val.length
|
6572 |
-
|
6573 |
-
if (encoding !== undefined) {
|
6574 |
-
encoding = String(encoding).toLowerCase()
|
6575 |
-
if (encoding === 'ucs2' || encoding === 'ucs-2' ||
|
6576 |
-
encoding === 'utf16le' || encoding === 'utf-16le') {
|
6577 |
-
if (arr.length < 2 || val.length < 2) {
|
6578 |
-
return -1
|
6579 |
-
}
|
6580 |
-
indexSize = 2
|
6581 |
-
arrLength /= 2
|
6582 |
-
valLength /= 2
|
6583 |
-
byteOffset /= 2
|
6584 |
-
}
|
6585 |
-
}
|
6586 |
-
|
6587 |
-
function read (buf, i) {
|
6588 |
-
if (indexSize === 1) {
|
6589 |
-
return buf[i]
|
6590 |
-
} else {
|
6591 |
-
return buf.readUInt16BE(i * indexSize)
|
6592 |
-
}
|
6593 |
-
}
|
6594 |
-
|
6595 |
-
var i
|
6596 |
-
if (dir) {
|
6597 |
-
var foundIndex = -1
|
6598 |
-
for (i = byteOffset; i < arrLength; i++) {
|
6599 |
-
if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
|
6600 |
-
if (foundIndex === -1) foundIndex = i
|
6601 |
-
if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
|
6602 |
-
} else {
|
6603 |
-
if (foundIndex !== -1) i -= i - foundIndex
|
6604 |
-
foundIndex = -1
|
6605 |
-
}
|
6606 |
-
}
|
6607 |
-
} else {
|
6608 |
-
if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
|
6609 |
-
for (i = byteOffset; i >= 0; i--) {
|
6610 |
-
var found = true
|
6611 |
-
for (var j = 0; j < valLength; j++) {
|
6612 |
-
if (read(arr, i + j) !== read(val, j)) {
|
6613 |
-
found = false
|
6614 |
-
break
|
6615 |
-
}
|
6616 |
-
}
|
6617 |
-
if (found) return i
|
6618 |
-
}
|
6619 |
-
}
|
6620 |
-
|
6621 |
-
return -1
|
6622 |
-
}
|
6623 |
-
|
6624 |
-
Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
|
6625 |
-
return this.indexOf(val, byteOffset, encoding) !== -1
|
6626 |
-
}
|
6627 |
-
|
6628 |
-
Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
|
6629 |
-
return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
|
6630 |
-
}
|
6631 |
-
|
6632 |
-
Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
|
6633 |
-
return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
|
6634 |
-
}
|
6635 |
-
|
6636 |
-
function hexWrite (buf, string, offset, length) {
|
6637 |
-
offset = Number(offset) || 0
|
6638 |
-
var remaining = buf.length - offset
|
6639 |
-
if (!length) {
|
6640 |
-
length = remaining
|
6641 |
-
} else {
|
6642 |
-
length = Number(length)
|
6643 |
-
if (length > remaining) {
|
6644 |
-
length = remaining
|
6645 |
-
}
|
6646 |
-
}
|
6647 |
-
|
6648 |
-
// must be an even number of digits
|
6649 |
-
var strLen = string.length
|
6650 |
-
if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
|
6651 |
-
|
6652 |
-
if (length > strLen / 2) {
|
6653 |
-
length = strLen / 2
|
6654 |
-
}
|
6655 |
-
for (var i = 0; i < length; ++i) {
|
6656 |
-
var parsed = parseInt(string.substr(i * 2, 2), 16)
|
6657 |
-
if (isNaN(parsed)) return i
|
6658 |
-
buf[offset + i] = parsed
|
6659 |
-
}
|
6660 |
-
return i
|
6661 |
-
}
|
6662 |
-
|
6663 |
-
function utf8Write (buf, string, offset, length) {
|
6664 |
-
return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
|
6665 |
-
}
|
6666 |
-
|
6667 |
-
function asciiWrite (buf, string, offset, length) {
|
6668 |
-
return blitBuffer(asciiToBytes(string), buf, offset, length)
|
6669 |
-
}
|
6670 |
-
|
6671 |
-
function latin1Write (buf, string, offset, length) {
|
6672 |
-
return asciiWrite(buf, string, offset, length)
|
6673 |
-
}
|
6674 |
-
|
6675 |
-
function base64Write (buf, string, offset, length) {
|
6676 |
-
return blitBuffer(base64ToBytes(string), buf, offset, length)
|
6677 |
-
}
|
6678 |
-
|
6679 |
-
function ucs2Write (buf, string, offset, length) {
|
6680 |
-
return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
|
6681 |
-
}
|
6682 |
-
|
6683 |
-
Buffer.prototype.write = function write (string, offset, length, encoding) {
|
6684 |
-
// Buffer#write(string)
|
6685 |
-
if (offset === undefined) {
|
6686 |
-
encoding = 'utf8'
|
6687 |
-
length = this.length
|
6688 |
-
offset = 0
|
6689 |
-
// Buffer#write(string, encoding)
|
6690 |
-
} else if (length === undefined && typeof offset === 'string') {
|
6691 |
-
encoding = offset
|
6692 |
-
length = this.length
|
6693 |
-
offset = 0
|
6694 |
-
// Buffer#write(string, offset[, length][, encoding])
|
6695 |
-
} else if (isFinite(offset)) {
|
6696 |
-
offset = offset | 0
|
6697 |
-
if (isFinite(length)) {
|
6698 |
-
length = length | 0
|
6699 |
-
if (encoding === undefined) encoding = 'utf8'
|
6700 |
-
} else {
|
6701 |
-
encoding = length
|
6702 |
-
length = undefined
|
6703 |
-
}
|
6704 |
-
// legacy write(string, encoding, offset, length) - remove in v0.13
|
6705 |
-
} else {
|
6706 |
-
throw new Error(
|
6707 |
-
'Buffer.write(string, encoding, offset[, length]) is no longer supported'
|
6708 |
-
)
|
6709 |
-
}
|
6710 |
-
|
6711 |
-
var remaining = this.length - offset
|
6712 |
-
if (length === undefined || length > remaining) length = remaining
|
6713 |
-
|
6714 |
-
if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
|
6715 |
-
throw new RangeError('Attempt to write outside buffer bounds')
|
6716 |
-
}
|
6717 |
-
|
6718 |
-
if (!encoding) encoding = 'utf8'
|
6719 |
-
|
6720 |
-
var loweredCase = false
|
6721 |
-
for (;;) {
|
6722 |
-
switch (encoding) {
|
6723 |
-
case 'hex':
|
6724 |
-
return hexWrite(this, string, offset, length)
|
6725 |
-
|
6726 |
-
case 'utf8':
|
6727 |
-
case 'utf-8':
|
6728 |
-
return utf8Write(this, string, offset, length)
|
6729 |
-
|
6730 |
-
case 'ascii':
|
6731 |
-
return asciiWrite(this, string, offset, length)
|
6732 |
-
|
6733 |
-
case 'latin1':
|
6734 |
-
case 'binary':
|
6735 |
-
return latin1Write(this, string, offset, length)
|
6736 |
-
|
6737 |
-
case 'base64':
|
6738 |
-
// Warning: maxLength not taken into account in base64Write
|
6739 |
-
return base64Write(this, string, offset, length)
|
6740 |
-
|
6741 |
-
case 'ucs2':
|
6742 |
-
case 'ucs-2':
|
6743 |
-
case 'utf16le':
|
6744 |
-
case 'utf-16le':
|
6745 |
-
return ucs2Write(this, string, offset, length)
|
6746 |
-
|
6747 |
-
default:
|
6748 |
-
if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
|
6749 |
-
encoding = ('' + encoding).toLowerCase()
|
6750 |
-
loweredCase = true
|
6751 |
-
}
|
6752 |
-
}
|
6753 |
-
}
|
6754 |
-
|
6755 |
-
Buffer.prototype.toJSON = function toJSON () {
|
6756 |
-
return {
|
6757 |
-
type: 'Buffer',
|
6758 |
-
data: Array.prototype.slice.call(this._arr || this, 0)
|
6759 |
-
}
|
6760 |
-
}
|
6761 |
-
|
6762 |
-
function base64Slice (buf, start, end) {
|
6763 |
-
if (start === 0 && end === buf.length) {
|
6764 |
-
return base64.fromByteArray(buf)
|
6765 |
-
} else {
|
6766 |
-
return base64.fromByteArray(buf.slice(start, end))
|
6767 |
-
}
|
6768 |
-
}
|
6769 |
-
|
6770 |
-
function utf8Slice (buf, start, end) {
|
6771 |
-
end = Math.min(buf.length, end)
|
6772 |
-
var res = []
|
6773 |
-
|
6774 |
-
var i = start
|
6775 |
-
while (i < end) {
|
6776 |
-
var firstByte = buf[i]
|
6777 |
-
var codePoint = null
|
6778 |
-
var bytesPerSequence = (firstByte > 0xEF) ? 4
|
6779 |
-
: (firstByte > 0xDF) ? 3
|
6780 |
-
: (firstByte > 0xBF) ? 2
|
6781 |
-
: 1
|
6782 |
-
|
6783 |
-
if (i + bytesPerSequence <= end) {
|
6784 |
-
var secondByte, thirdByte, fourthByte, tempCodePoint
|
6785 |
-
|
6786 |
-
switch (bytesPerSequence) {
|
6787 |
-
case 1:
|
6788 |
-
if (firstByte < 0x80) {
|
6789 |
-
codePoint = firstByte
|
6790 |
-
}
|
6791 |
-
break
|
6792 |
-
case 2:
|
6793 |
-
secondByte = buf[i + 1]
|
6794 |
-
if ((secondByte & 0xC0) === 0x80) {
|
6795 |
-
tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
|
6796 |
-
if (tempCodePoint > 0x7F) {
|
6797 |
-
codePoint = tempCodePoint
|
6798 |
-
}
|
6799 |
-
}
|
6800 |
-
break
|
6801 |
-
case 3:
|
6802 |
-
secondByte = buf[i + 1]
|
6803 |
-
thirdByte = buf[i + 2]
|
6804 |
-
if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
|
6805 |
-
tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
|
6806 |
-
if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
|
6807 |
-
codePoint = tempCodePoint
|
6808 |
-
}
|
6809 |
-
}
|
6810 |
-
break
|
6811 |
-
case 4:
|
6812 |
-
secondByte = buf[i + 1]
|
6813 |
-
thirdByte = buf[i + 2]
|
6814 |
-
fourthByte = buf[i + 3]
|
6815 |
-
if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
|
6816 |
-
tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
|
6817 |
-
if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
|
6818 |
-
codePoint = tempCodePoint
|
6819 |
-
}
|
6820 |
-
}
|
6821 |
-
}
|
6822 |
-
}
|
6823 |
-
|
6824 |
-
if (codePoint === null) {
|
6825 |
-
// we did not generate a valid codePoint so insert a
|
6826 |
-
// replacement char (U+FFFD) and advance only 1 byte
|
6827 |
-
codePoint = 0xFFFD
|
6828 |
-
bytesPerSequence = 1
|
6829 |
-
} else if (codePoint > 0xFFFF) {
|
6830 |
-
// encode to utf16 (surrogate pair dance)
|
6831 |
-
codePoint -= 0x10000
|
6832 |
-
res.push(codePoint >>> 10 & 0x3FF | 0xD800)
|
6833 |
-
codePoint = 0xDC00 | codePoint & 0x3FF
|
6834 |
-
}
|
6835 |
-
|
6836 |
-
res.push(codePoint)
|
6837 |
-
i += bytesPerSequence
|
6838 |
-
}
|
6839 |
-
|
6840 |
-
return decodeCodePointsArray(res)
|
6841 |
-
}
|
6842 |
-
|
6843 |
-
// Based on http://stackoverflow.com/a/22747272/680742, the browser with
|
6844 |
-
// the lowest limit is Chrome, with 0x10000 args.
|
6845 |
-
// We go 1 magnitude less, for safety
|
6846 |
-
var MAX_ARGUMENTS_LENGTH = 0x1000
|
6847 |
-
|
6848 |
-
function decodeCodePointsArray (codePoints) {
|
6849 |
-
var len = codePoints.length
|
6850 |
-
if (len <= MAX_ARGUMENTS_LENGTH) {
|
6851 |
-
return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
|
6852 |
-
}
|
6853 |
-
|
6854 |
-
// Decode in chunks to avoid "call stack size exceeded".
|
6855 |
-
var res = ''
|
6856 |
-
var i = 0
|
6857 |
-
while (i < len) {
|
6858 |
-
res += String.fromCharCode.apply(
|
6859 |
-
String,
|
6860 |
-
codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
|
6861 |
-
)
|
6862 |
-
}
|
6863 |
-
return res
|
6864 |
-
}
|
6865 |
-
|
6866 |
-
function asciiSlice (buf, start, end) {
|
6867 |
-
var ret = ''
|
6868 |
-
end = Math.min(buf.length, end)
|
6869 |
-
|
6870 |
-
for (var i = start; i < end; ++i) {
|
6871 |
-
ret += String.fromCharCode(buf[i] & 0x7F)
|
6872 |
-
}
|
6873 |
-
return ret
|
6874 |
-
}
|
6875 |
-
|
6876 |
-
function latin1Slice (buf, start, end) {
|
6877 |
-
var ret = ''
|
6878 |
-
end = Math.min(buf.length, end)
|
6879 |
-
|
6880 |
-
for (var i = start; i < end; ++i) {
|
6881 |
-
ret += String.fromCharCode(buf[i])
|
6882 |
-
}
|
6883 |
-
return ret
|
6884 |
-
}
|
6885 |
-
|
6886 |
-
function hexSlice (buf, start, end) {
|
6887 |
-
var len = buf.length
|
6888 |
-
|
6889 |
-
if (!start || start < 0) start = 0
|
6890 |
-
if (!end || end < 0 || end > len) end = len
|
6891 |
-
|
6892 |
-
var out = ''
|
6893 |
-
for (var i = start; i < end; ++i) {
|
6894 |
-
out += toHex(buf[i])
|
6895 |
-
}
|
6896 |
-
return out
|
6897 |
-
}
|
6898 |
-
|
6899 |
-
function utf16leSlice (buf, start, end) {
|
6900 |
-
var bytes = buf.slice(start, end)
|
6901 |
-
var res = ''
|
6902 |
-
for (var i = 0; i < bytes.length; i += 2) {
|
6903 |
-
res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
|
6904 |
-
}
|
6905 |
-
return res
|
6906 |
-
}
|
6907 |
-
|
6908 |
-
Buffer.prototype.slice = function slice (start, end) {
|
6909 |
-
var len = this.length
|
6910 |
-
start = ~~start
|
6911 |
-
end = end === undefined ? len : ~~end
|
6912 |
-
|
6913 |
-
if (start < 0) {
|
6914 |
-
start += len
|
6915 |
-
if (start < 0) start = 0
|
6916 |
-
} else if (start > len) {
|
6917 |
-
start = len
|
6918 |
-
}
|
6919 |
-
|
6920 |
-
if (end < 0) {
|
6921 |
-
end += len
|
6922 |
-
if (end < 0) end = 0
|
6923 |
-
} else if (end > len) {
|
6924 |
-
end = len
|
6925 |
-
}
|
6926 |
-
|
6927 |
-
if (end < start) end = start
|
6928 |
-
|
6929 |
-
var newBuf
|
6930 |
-
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
6931 |
-
newBuf = this.subarray(start, end)
|
6932 |
-
newBuf.__proto__ = Buffer.prototype
|
6933 |
-
} else {
|
6934 |
-
var sliceLen = end - start
|
6935 |
-
newBuf = new Buffer(sliceLen, undefined)
|
6936 |
-
for (var i = 0; i < sliceLen; ++i) {
|
6937 |
-
newBuf[i] = this[i + start]
|
6938 |
-
}
|
6939 |
-
}
|
6940 |
-
|
6941 |
-
return newBuf
|
6942 |
-
}
|
6943 |
-
|
6944 |
-
/*
|
6945 |
-
* Need to make sure that buffer isn't trying to write out of bounds.
|
6946 |
-
*/
|
6947 |
-
function checkOffset (offset, ext, length) {
|
6948 |
-
if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
|
6949 |
-
if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
|
6950 |
-
}
|
6951 |
-
|
6952 |
-
Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
|
6953 |
-
offset = offset | 0
|
6954 |
-
byteLength = byteLength | 0
|
6955 |
-
if (!noAssert) checkOffset(offset, byteLength, this.length)
|
6956 |
-
|
6957 |
-
var val = this[offset]
|
6958 |
-
var mul = 1
|
6959 |
-
var i = 0
|
6960 |
-
while (++i < byteLength && (mul *= 0x100)) {
|
6961 |
-
val += this[offset + i] * mul
|
6962 |
-
}
|
6963 |
-
|
6964 |
-
return val
|
6965 |
-
}
|
6966 |
-
|
6967 |
-
Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
|
6968 |
-
offset = offset | 0
|
6969 |
-
byteLength = byteLength | 0
|
6970 |
-
if (!noAssert) {
|
6971 |
-
checkOffset(offset, byteLength, this.length)
|
6972 |
-
}
|
6973 |
-
|
6974 |
-
var val = this[offset + --byteLength]
|
6975 |
-
var mul = 1
|
6976 |
-
while (byteLength > 0 && (mul *= 0x100)) {
|
6977 |
-
val += this[offset + --byteLength] * mul
|
6978 |
-
}
|
6979 |
-
|
6980 |
-
return val
|
6981 |
-
}
|
6982 |
-
|
6983 |
-
Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
|
6984 |
-
if (!noAssert) checkOffset(offset, 1, this.length)
|
6985 |
-
return this[offset]
|
6986 |
-
}
|
6987 |
-
|
6988 |
-
Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
|
6989 |
-
if (!noAssert) checkOffset(offset, 2, this.length)
|
6990 |
-
return this[offset] | (this[offset + 1] << 8)
|
6991 |
-
}
|
6992 |
-
|
6993 |
-
Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
|
6994 |
-
if (!noAssert) checkOffset(offset, 2, this.length)
|
6995 |
-
return (this[offset] << 8) | this[offset + 1]
|
6996 |
-
}
|
6997 |
-
|
6998 |
-
Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
|
6999 |
-
if (!noAssert) checkOffset(offset, 4, this.length)
|
7000 |
-
|
7001 |
-
return ((this[offset]) |
|
7002 |
-
(this[offset + 1] << 8) |
|
7003 |
-
(this[offset + 2] << 16)) +
|
7004 |
-
(this[offset + 3] * 0x1000000)
|
7005 |
-
}
|
7006 |
-
|
7007 |
-
Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
|
7008 |
-
if (!noAssert) checkOffset(offset, 4, this.length)
|
7009 |
-
|
7010 |
-
return (this[offset] * 0x1000000) +
|
7011 |
-
((this[offset + 1] << 16) |
|
7012 |
-
(this[offset + 2] << 8) |
|
7013 |
-
this[offset + 3])
|
7014 |
-
}
|
7015 |
-
|
7016 |
-
Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
|
7017 |
-
offset = offset | 0
|
7018 |
-
byteLength = byteLength | 0
|
7019 |
-
if (!noAssert) checkOffset(offset, byteLength, this.length)
|
7020 |
-
|
7021 |
-
var val = this[offset]
|
7022 |
-
var mul = 1
|
7023 |
-
var i = 0
|
7024 |
-
while (++i < byteLength && (mul *= 0x100)) {
|
7025 |
-
val += this[offset + i] * mul
|
7026 |
-
}
|
7027 |
-
mul *= 0x80
|
7028 |
-
|
7029 |
-
if (val >= mul) val -= Math.pow(2, 8 * byteLength)
|
7030 |
-
|
7031 |
-
return val
|
7032 |
-
}
|
7033 |
-
|
7034 |
-
Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
|
7035 |
-
offset = offset | 0
|
7036 |
-
byteLength = byteLength | 0
|
7037 |
-
if (!noAssert) checkOffset(offset, byteLength, this.length)
|
7038 |
-
|
7039 |
-
var i = byteLength
|
7040 |
-
var mul = 1
|
7041 |
-
var val = this[offset + --i]
|
7042 |
-
while (i > 0 && (mul *= 0x100)) {
|
7043 |
-
val += this[offset + --i] * mul
|
7044 |
-
}
|
7045 |
-
mul *= 0x80
|
7046 |
-
|
7047 |
-
if (val >= mul) val -= Math.pow(2, 8 * byteLength)
|
7048 |
-
|
7049 |
-
return val
|
7050 |
-
}
|
7051 |
-
|
7052 |
-
Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
|
7053 |
-
if (!noAssert) checkOffset(offset, 1, this.length)
|
7054 |
-
if (!(this[offset] & 0x80)) return (this[offset])
|
7055 |
-
return ((0xff - this[offset] + 1) * -1)
|
7056 |
-
}
|
7057 |
-
|
7058 |
-
Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
|
7059 |
-
if (!noAssert) checkOffset(offset, 2, this.length)
|
7060 |
-
var val = this[offset] | (this[offset + 1] << 8)
|
7061 |
-
return (val & 0x8000) ? val | 0xFFFF0000 : val
|
7062 |
-
}
|
7063 |
-
|
7064 |
-
Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
|
7065 |
-
if (!noAssert) checkOffset(offset, 2, this.length)
|
7066 |
-
var val = this[offset + 1] | (this[offset] << 8)
|
7067 |
-
return (val & 0x8000) ? val | 0xFFFF0000 : val
|
7068 |
-
}
|
7069 |
-
|
7070 |
-
Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
|
7071 |
-
if (!noAssert) checkOffset(offset, 4, this.length)
|
7072 |
-
|
7073 |
-
return (this[offset]) |
|
7074 |
-
(this[offset + 1] << 8) |
|
7075 |
-
(this[offset + 2] << 16) |
|
7076 |
-
(this[offset + 3] << 24)
|
7077 |
-
}
|
7078 |
-
|
7079 |
-
Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
|
7080 |
-
if (!noAssert) checkOffset(offset, 4, this.length)
|
7081 |
-
|
7082 |
-
return (this[offset] << 24) |
|
7083 |
-
(this[offset + 1] << 16) |
|
7084 |
-
(this[offset + 2] << 8) |
|
7085 |
-
(this[offset + 3])
|
7086 |
-
}
|
7087 |
-
|
7088 |
-
Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
|
7089 |
-
if (!noAssert) checkOffset(offset, 4, this.length)
|
7090 |
-
return ieee754.read(this, offset, true, 23, 4)
|
7091 |
-
}
|
7092 |
-
|
7093 |
-
Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
|
7094 |
-
if (!noAssert) checkOffset(offset, 4, this.length)
|
7095 |
-
return ieee754.read(this, offset, false, 23, 4)
|
7096 |
-
}
|
7097 |
-
|
7098 |
-
Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
|
7099 |
-
if (!noAssert) checkOffset(offset, 8, this.length)
|
7100 |
-
return ieee754.read(this, offset, true, 52, 8)
|
7101 |
-
}
|
7102 |
-
|
7103 |
-
Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
|
7104 |
-
if (!noAssert) checkOffset(offset, 8, this.length)
|
7105 |
-
return ieee754.read(this, offset, false, 52, 8)
|
7106 |
-
}
|
7107 |
-
|
7108 |
-
function checkInt (buf, value, offset, ext, max, min) {
|
7109 |
-
if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
|
7110 |
-
if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
|
7111 |
-
if (offset + ext > buf.length) throw new RangeError('Index out of range')
|
7112 |
-
}
|
7113 |
-
|
7114 |
-
Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
|
7115 |
-
value = +value
|
7116 |
-
offset = offset | 0
|
7117 |
-
byteLength = byteLength | 0
|
7118 |
-
if (!noAssert) {
|
7119 |
-
var maxBytes = Math.pow(2, 8 * byteLength) - 1
|
7120 |
-
checkInt(this, value, offset, byteLength, maxBytes, 0)
|
7121 |
-
}
|
7122 |
-
|
7123 |
-
var mul = 1
|
7124 |
-
var i = 0
|
7125 |
-
this[offset] = value & 0xFF
|
7126 |
-
while (++i < byteLength && (mul *= 0x100)) {
|
7127 |
-
this[offset + i] = (value / mul) & 0xFF
|
7128 |
-
}
|
7129 |
-
|
7130 |
-
return offset + byteLength
|
7131 |
-
}
|
7132 |
-
|
7133 |
-
Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
|
7134 |
-
value = +value
|
7135 |
-
offset = offset | 0
|
7136 |
-
byteLength = byteLength | 0
|
7137 |
-
if (!noAssert) {
|
7138 |
-
var maxBytes = Math.pow(2, 8 * byteLength) - 1
|
7139 |
-
checkInt(this, value, offset, byteLength, maxBytes, 0)
|
7140 |
-
}
|
7141 |
-
|
7142 |
-
var i = byteLength - 1
|
7143 |
-
var mul = 1
|
7144 |
-
this[offset + i] = value & 0xFF
|
7145 |
-
while (--i >= 0 && (mul *= 0x100)) {
|
7146 |
-
this[offset + i] = (value / mul) & 0xFF
|
7147 |
-
}
|
7148 |
-
|
7149 |
-
return offset + byteLength
|
7150 |
-
}
|
7151 |
-
|
7152 |
-
Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
|
7153 |
-
value = +value
|
7154 |
-
offset = offset | 0
|
7155 |
-
if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
|
7156 |
-
if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
|
7157 |
-
this[offset] = (value & 0xff)
|
7158 |
-
return offset + 1
|
7159 |
-
}
|
7160 |
-
|
7161 |
-
function objectWriteUInt16 (buf, value, offset, littleEndian) {
|
7162 |
-
if (value < 0) value = 0xffff + value + 1
|
7163 |
-
for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
|
7164 |
-
buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
|
7165 |
-
(littleEndian ? i : 1 - i) * 8
|
7166 |
-
}
|
7167 |
-
}
|
7168 |
-
|
7169 |
-
Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
|
7170 |
-
value = +value
|
7171 |
-
offset = offset | 0
|
7172 |
-
if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
|
7173 |
-
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
7174 |
-
this[offset] = (value & 0xff)
|
7175 |
-
this[offset + 1] = (value >>> 8)
|
7176 |
-
} else {
|
7177 |
-
objectWriteUInt16(this, value, offset, true)
|
7178 |
-
}
|
7179 |
-
return offset + 2
|
7180 |
-
}
|
7181 |
-
|
7182 |
-
Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
|
7183 |
-
value = +value
|
7184 |
-
offset = offset | 0
|
7185 |
-
if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
|
7186 |
-
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
7187 |
-
this[offset] = (value >>> 8)
|
7188 |
-
this[offset + 1] = (value & 0xff)
|
7189 |
-
} else {
|
7190 |
-
objectWriteUInt16(this, value, offset, false)
|
7191 |
-
}
|
7192 |
-
return offset + 2
|
7193 |
-
}
|
7194 |
-
|
7195 |
-
function objectWriteUInt32 (buf, value, offset, littleEndian) {
|
7196 |
-
if (value < 0) value = 0xffffffff + value + 1
|
7197 |
-
for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
|
7198 |
-
buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
|
7199 |
-
}
|
7200 |
-
}
|
7201 |
-
|
7202 |
-
Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
|
7203 |
-
value = +value
|
7204 |
-
offset = offset | 0
|
7205 |
-
if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
|
7206 |
-
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
7207 |
-
this[offset + 3] = (value >>> 24)
|
7208 |
-
this[offset + 2] = (value >>> 16)
|
7209 |
-
this[offset + 1] = (value >>> 8)
|
7210 |
-
this[offset] = (value & 0xff)
|
7211 |
-
} else {
|
7212 |
-
objectWriteUInt32(this, value, offset, true)
|
7213 |
-
}
|
7214 |
-
return offset + 4
|
7215 |
-
}
|
7216 |
-
|
7217 |
-
Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
|
7218 |
-
value = +value
|
7219 |
-
offset = offset | 0
|
7220 |
-
if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
|
7221 |
-
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
7222 |
-
this[offset] = (value >>> 24)
|
7223 |
-
this[offset + 1] = (value >>> 16)
|
7224 |
-
this[offset + 2] = (value >>> 8)
|
7225 |
-
this[offset + 3] = (value & 0xff)
|
7226 |
-
} else {
|
7227 |
-
objectWriteUInt32(this, value, offset, false)
|
7228 |
-
}
|
7229 |
-
return offset + 4
|
7230 |
-
}
|
7231 |
-
|
7232 |
-
Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
|
7233 |
-
value = +value
|
7234 |
-
offset = offset | 0
|
7235 |
-
if (!noAssert) {
|
7236 |
-
var limit = Math.pow(2, 8 * byteLength - 1)
|
7237 |
-
|
7238 |
-
checkInt(this, value, offset, byteLength, limit - 1, -limit)
|
7239 |
-
}
|
7240 |
-
|
7241 |
-
var i = 0
|
7242 |
-
var mul = 1
|
7243 |
-
var sub = 0
|
7244 |
-
this[offset] = value & 0xFF
|
7245 |
-
while (++i < byteLength && (mul *= 0x100)) {
|
7246 |
-
if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
|
7247 |
-
sub = 1
|
7248 |
-
}
|
7249 |
-
this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
|
7250 |
-
}
|
7251 |
-
|
7252 |
-
return offset + byteLength
|
7253 |
-
}
|
7254 |
-
|
7255 |
-
Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
|
7256 |
-
value = +value
|
7257 |
-
offset = offset | 0
|
7258 |
-
if (!noAssert) {
|
7259 |
-
var limit = Math.pow(2, 8 * byteLength - 1)
|
7260 |
-
|
7261 |
-
checkInt(this, value, offset, byteLength, limit - 1, -limit)
|
7262 |
-
}
|
7263 |
-
|
7264 |
-
var i = byteLength - 1
|
7265 |
-
var mul = 1
|
7266 |
-
var sub = 0
|
7267 |
-
this[offset + i] = value & 0xFF
|
7268 |
-
while (--i >= 0 && (mul *= 0x100)) {
|
7269 |
-
if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
|
7270 |
-
sub = 1
|
7271 |
-
}
|
7272 |
-
this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
|
7273 |
-
}
|
7274 |
-
|
7275 |
-
return offset + byteLength
|
7276 |
-
}
|
7277 |
-
|
7278 |
-
Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
|
7279 |
-
value = +value
|
7280 |
-
offset = offset | 0
|
7281 |
-
if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
|
7282 |
-
if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
|
7283 |
-
if (value < 0) value = 0xff + value + 1
|
7284 |
-
this[offset] = (value & 0xff)
|
7285 |
-
return offset + 1
|
7286 |
-
}
|
7287 |
-
|
7288 |
-
Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
|
7289 |
-
value = +value
|
7290 |
-
offset = offset | 0
|
7291 |
-
if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
|
7292 |
-
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
7293 |
-
this[offset] = (value & 0xff)
|
7294 |
-
this[offset + 1] = (value >>> 8)
|
7295 |
-
} else {
|
7296 |
-
objectWriteUInt16(this, value, offset, true)
|
7297 |
-
}
|
7298 |
-
return offset + 2
|
7299 |
-
}
|
7300 |
-
|
7301 |
-
Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
|
7302 |
-
value = +value
|
7303 |
-
offset = offset | 0
|
7304 |
-
if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
|
7305 |
-
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
7306 |
-
this[offset] = (value >>> 8)
|
7307 |
-
this[offset + 1] = (value & 0xff)
|
7308 |
-
} else {
|
7309 |
-
objectWriteUInt16(this, value, offset, false)
|
7310 |
-
}
|
7311 |
-
return offset + 2
|
7312 |
-
}
|
7313 |
-
|
7314 |
-
Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
|
7315 |
-
value = +value
|
7316 |
-
offset = offset | 0
|
7317 |
-
if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
|
7318 |
-
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
7319 |
-
this[offset] = (value & 0xff)
|
7320 |
-
this[offset + 1] = (value >>> 8)
|
7321 |
-
this[offset + 2] = (value >>> 16)
|
7322 |
-
this[offset + 3] = (value >>> 24)
|
7323 |
-
} else {
|
7324 |
-
objectWriteUInt32(this, value, offset, true)
|
7325 |
-
}
|
7326 |
-
return offset + 4
|
7327 |
-
}
|
7328 |
-
|
7329 |
-
Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
|
7330 |
-
value = +value
|
7331 |
-
offset = offset | 0
|
7332 |
-
if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
|
7333 |
-
if (value < 0) value = 0xffffffff + value + 1
|
7334 |
-
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
7335 |
-
this[offset] = (value >>> 24)
|
7336 |
-
this[offset + 1] = (value >>> 16)
|
7337 |
-
this[offset + 2] = (value >>> 8)
|
7338 |
-
this[offset + 3] = (value & 0xff)
|
7339 |
-
} else {
|
7340 |
-
objectWriteUInt32(this, value, offset, false)
|
7341 |
-
}
|
7342 |
-
return offset + 4
|
7343 |
-
}
|
7344 |
-
|
7345 |
-
function checkIEEE754 (buf, value, offset, ext, max, min) {
|
7346 |
-
if (offset + ext > buf.length) throw new RangeError('Index out of range')
|
7347 |
-
if (offset < 0) throw new RangeError('Index out of range')
|
7348 |
-
}
|
7349 |
-
|
7350 |
-
function writeFloat (buf, value, offset, littleEndian, noAssert) {
|
7351 |
-
if (!noAssert) {
|
7352 |
-
checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
|
7353 |
-
}
|
7354 |
-
ieee754.write(buf, value, offset, littleEndian, 23, 4)
|
7355 |
-
return offset + 4
|
7356 |
-
}
|
7357 |
-
|
7358 |
-
Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
|
7359 |
-
return writeFloat(this, value, offset, true, noAssert)
|
7360 |
-
}
|
7361 |
-
|
7362 |
-
Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
|
7363 |
-
return writeFloat(this, value, offset, false, noAssert)
|
7364 |
-
}
|
7365 |
-
|
7366 |
-
function writeDouble (buf, value, offset, littleEndian, noAssert) {
|
7367 |
-
if (!noAssert) {
|
7368 |
-
checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
|
7369 |
-
}
|
7370 |
-
ieee754.write(buf, value, offset, littleEndian, 52, 8)
|
7371 |
-
return offset + 8
|
7372 |
-
}
|
7373 |
-
|
7374 |
-
Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
|
7375 |
-
return writeDouble(this, value, offset, true, noAssert)
|
7376 |
-
}
|
7377 |
-
|
7378 |
-
Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
|
7379 |
-
return writeDouble(this, value, offset, false, noAssert)
|
7380 |
-
}
|
7381 |
-
|
7382 |
-
// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
|
7383 |
-
Buffer.prototype.copy = function copy (target, targetStart, start, end) {
|
7384 |
-
if (!start) start = 0
|
7385 |
-
if (!end && end !== 0) end = this.length
|
7386 |
-
if (targetStart >= target.length) targetStart = target.length
|
7387 |
-
if (!targetStart) targetStart = 0
|
7388 |
-
if (end > 0 && end < start) end = start
|
7389 |
-
|
7390 |
-
// Copy 0 bytes; we're done
|
7391 |
-
if (end === start) return 0
|
7392 |
-
if (target.length === 0 || this.length === 0) return 0
|
7393 |
-
|
7394 |
-
// Fatal error conditions
|
7395 |
-
if (targetStart < 0) {
|
7396 |
-
throw new RangeError('targetStart out of bounds')
|
7397 |
-
}
|
7398 |
-
if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
|
7399 |
-
if (end < 0) throw new RangeError('sourceEnd out of bounds')
|
7400 |
-
|
7401 |
-
// Are we oob?
|
7402 |
-
if (end > this.length) end = this.length
|
7403 |
-
if (target.length - targetStart < end - start) {
|
7404 |
-
end = target.length - targetStart + start
|
7405 |
-
}
|
7406 |
-
|
7407 |
-
var len = end - start
|
7408 |
-
var i
|
7409 |
-
|
7410 |
-
if (this === target && start < targetStart && targetStart < end) {
|
7411 |
-
// descending copy from end
|
7412 |
-
for (i = len - 1; i >= 0; --i) {
|
7413 |
-
target[i + targetStart] = this[i + start]
|
7414 |
-
}
|
7415 |
-
} else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
|
7416 |
-
// ascending copy from start
|
7417 |
-
for (i = 0; i < len; ++i) {
|
7418 |
-
target[i + targetStart] = this[i + start]
|
7419 |
-
}
|
7420 |
-
} else {
|
7421 |
-
Uint8Array.prototype.set.call(
|
7422 |
-
target,
|
7423 |
-
this.subarray(start, start + len),
|
7424 |
-
targetStart
|
7425 |
-
)
|
7426 |
-
}
|
7427 |
-
|
7428 |
-
return len
|
7429 |
-
}
|
7430 |
-
|
7431 |
-
// Usage:
|
7432 |
-
// buffer.fill(number[, offset[, end]])
|
7433 |
-
// buffer.fill(buffer[, offset[, end]])
|
7434 |
-
// buffer.fill(string[, offset[, end]][, encoding])
|
7435 |
-
Buffer.prototype.fill = function fill (val, start, end, encoding) {
|
7436 |
-
// Handle string cases:
|
7437 |
-
if (typeof val === 'string') {
|
7438 |
-
if (typeof start === 'string') {
|
7439 |
-
encoding = start
|
7440 |
-
start = 0
|
7441 |
-
end = this.length
|
7442 |
-
} else if (typeof end === 'string') {
|
7443 |
-
encoding = end
|
7444 |
-
end = this.length
|
7445 |
-
}
|
7446 |
-
if (val.length === 1) {
|
7447 |
-
var code = val.charCodeAt(0)
|
7448 |
-
if (code < 256) {
|
7449 |
-
val = code
|
7450 |
-
}
|
7451 |
-
}
|
7452 |
-
if (encoding !== undefined && typeof encoding !== 'string') {
|
7453 |
-
throw new TypeError('encoding must be a string')
|
7454 |
-
}
|
7455 |
-
if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
|
7456 |
-
throw new TypeError('Unknown encoding: ' + encoding)
|
7457 |
-
}
|
7458 |
-
} else if (typeof val === 'number') {
|
7459 |
-
val = val & 255
|
7460 |
-
}
|
7461 |
-
|
7462 |
-
// Invalid ranges are not set to a default, so can range check early.
|
7463 |
-
if (start < 0 || this.length < start || this.length < end) {
|
7464 |
-
throw new RangeError('Out of range index')
|
7465 |
-
}
|
7466 |
-
|
7467 |
-
if (end <= start) {
|
7468 |
-
return this
|
7469 |
-
}
|
7470 |
-
|
7471 |
-
start = start >>> 0
|
7472 |
-
end = end === undefined ? this.length : end >>> 0
|
7473 |
-
|
7474 |
-
if (!val) val = 0
|
7475 |
-
|
7476 |
-
var i
|
7477 |
-
if (typeof val === 'number') {
|
7478 |
-
for (i = start; i < end; ++i) {
|
7479 |
-
this[i] = val
|
7480 |
-
}
|
7481 |
-
} else {
|
7482 |
-
var bytes = Buffer.isBuffer(val)
|
7483 |
-
? val
|
7484 |
-
: utf8ToBytes(new Buffer(val, encoding).toString())
|
7485 |
-
var len = bytes.length
|
7486 |
-
for (i = 0; i < end - start; ++i) {
|
7487 |
-
this[i + start] = bytes[i % len]
|
7488 |
-
}
|
7489 |
-
}
|
7490 |
-
|
7491 |
-
return this
|
7492 |
-
}
|
7493 |
-
|
7494 |
-
// HELPER FUNCTIONS
|
7495 |
-
// ================
|
7496 |
-
|
7497 |
-
var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
|
7498 |
-
|
7499 |
-
function base64clean (str) {
|
7500 |
-
// Node strips out invalid characters like \n and \t from the string, base64-js does not
|
7501 |
-
str = stringtrim(str).replace(INVALID_BASE64_RE, '')
|
7502 |
-
// Node converts strings with length < 2 to ''
|
7503 |
-
if (str.length < 2) return ''
|
7504 |
-
// Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
|
7505 |
-
while (str.length % 4 !== 0) {
|
7506 |
-
str = str + '='
|
7507 |
-
}
|
7508 |
-
return str
|
7509 |
-
}
|
7510 |
-
|
7511 |
-
function stringtrim (str) {
|
7512 |
-
if (str.trim) return str.trim()
|
7513 |
-
return str.replace(/^\s+|\s+$/g, '')
|
7514 |
-
}
|
7515 |
-
|
7516 |
-
function toHex (n) {
|
7517 |
-
if (n < 16) return '0' + n.toString(16)
|
7518 |
-
return n.toString(16)
|
7519 |
-
}
|
7520 |
-
|
7521 |
-
function utf8ToBytes (string, units) {
|
7522 |
-
units = units || Infinity
|
7523 |
-
var codePoint
|
7524 |
-
var length = string.length
|
7525 |
-
var leadSurrogate = null
|
7526 |
-
var bytes = []
|
7527 |
-
|
7528 |
-
for (var i = 0; i < length; ++i) {
|
7529 |
-
codePoint = string.charCodeAt(i)
|
7530 |
-
|
7531 |
-
// is surrogate component
|
7532 |
-
if (codePoint > 0xD7FF && codePoint < 0xE000) {
|
7533 |
-
// last char was a lead
|
7534 |
-
if (!leadSurrogate) {
|
7535 |
-
// no lead yet
|
7536 |
-
if (codePoint > 0xDBFF) {
|
7537 |
-
// unexpected trail
|
7538 |
-
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
|
7539 |
-
continue
|
7540 |
-
} else if (i + 1 === length) {
|
7541 |
-
// unpaired lead
|
7542 |
-
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
|
7543 |
-
continue
|
7544 |
-
}
|
7545 |
-
|
7546 |
-
// valid lead
|
7547 |
-
leadSurrogate = codePoint
|
7548 |
-
|
7549 |
-
continue
|
7550 |
-
}
|
7551 |
-
|
7552 |
-
// 2 leads in a row
|
7553 |
-
if (codePoint < 0xDC00) {
|
7554 |
-
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
|
7555 |
-
leadSurrogate = codePoint
|
7556 |
-
continue
|
7557 |
-
}
|
7558 |
-
|
7559 |
-
// valid surrogate pair
|
7560 |
-
codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
|
7561 |
-
} else if (leadSurrogate) {
|
7562 |
-
// valid bmp char, but last char was a lead
|
7563 |
-
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
|
7564 |
-
}
|
7565 |
-
|
7566 |
-
leadSurrogate = null
|
7567 |
-
|
7568 |
-
// encode utf8
|
7569 |
-
if (codePoint < 0x80) {
|
7570 |
-
if ((units -= 1) < 0) break
|
7571 |
-
bytes.push(codePoint)
|
7572 |
-
} else if (codePoint < 0x800) {
|
7573 |
-
if ((units -= 2) < 0) break
|
7574 |
-
bytes.push(
|
7575 |
-
codePoint >> 0x6 | 0xC0,
|
7576 |
-
codePoint & 0x3F | 0x80
|
7577 |
-
)
|
7578 |
-
} else if (codePoint < 0x10000) {
|
7579 |
-
if ((units -= 3) < 0) break
|
7580 |
-
bytes.push(
|
7581 |
-
codePoint >> 0xC | 0xE0,
|
7582 |
-
codePoint >> 0x6 & 0x3F | 0x80,
|
7583 |
-
codePoint & 0x3F | 0x80
|
7584 |
-
)
|
7585 |
-
} else if (codePoint < 0x110000) {
|
7586 |
-
if ((units -= 4) < 0) break
|
7587 |
-
bytes.push(
|
7588 |
-
codePoint >> 0x12 | 0xF0,
|
7589 |
-
codePoint >> 0xC & 0x3F | 0x80,
|
7590 |
-
codePoint >> 0x6 & 0x3F | 0x80,
|
7591 |
-
codePoint & 0x3F | 0x80
|
7592 |
-
)
|
7593 |
-
} else {
|
7594 |
-
throw new Error('Invalid code point')
|
7595 |
-
}
|
7596 |
-
}
|
7597 |
-
|
7598 |
-
return bytes
|
7599 |
-
}
|
7600 |
-
|
7601 |
-
function asciiToBytes (str) {
|
7602 |
-
var byteArray = []
|
7603 |
-
for (var i = 0; i < str.length; ++i) {
|
7604 |
-
// Node's code seems to be doing this and not & 0x7F..
|
7605 |
-
byteArray.push(str.charCodeAt(i) & 0xFF)
|
7606 |
-
}
|
7607 |
-
return byteArray
|
7608 |
-
}
|
7609 |
-
|
7610 |
-
function utf16leToBytes (str, units) {
|
7611 |
-
var c, hi, lo
|
7612 |
-
var byteArray = []
|
7613 |
-
for (var i = 0; i < str.length; ++i) {
|
7614 |
-
if ((units -= 2) < 0) break
|
7615 |
-
|
7616 |
-
c = str.charCodeAt(i)
|
7617 |
-
hi = c >> 8
|
7618 |
-
lo = c % 256
|
7619 |
-
byteArray.push(lo)
|
7620 |
-
byteArray.push(hi)
|
7621 |
-
}
|
7622 |
-
|
7623 |
-
return byteArray
|
7624 |
-
}
|
7625 |
-
|
7626 |
-
function base64ToBytes (str) {
|
7627 |
-
return base64.toByteArray(base64clean(str))
|
7628 |
-
}
|
7629 |
-
|
7630 |
-
function blitBuffer (src, dst, offset, length) {
|
7631 |
-
for (var i = 0; i < length; ++i) {
|
7632 |
-
if ((i + offset >= dst.length) || (i >= src.length)) break
|
7633 |
-
dst[i + offset] = src[i]
|
7634 |
-
}
|
7635 |
-
return i
|
7636 |
-
}
|
7637 |
-
|
7638 |
-
function isnan (val) {
|
7639 |
-
return val !== val // eslint-disable-line no-self-compare
|
7640 |
-
}
|
7641 |
-
|
7642 |
-
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(487).Buffer, (function() { return this; }())))
|
7643 |
-
|
7644 |
-
/***/ },
|
7645 |
-
|
7646 |
-
/***/ 488:
|
7647 |
-
/***/ function(module, exports) {
|
7648 |
-
|
7649 |
-
'use strict'
|
7650 |
-
|
7651 |
-
exports.byteLength = byteLength
|
7652 |
-
exports.toByteArray = toByteArray
|
7653 |
-
exports.fromByteArray = fromByteArray
|
7654 |
-
|
7655 |
-
var lookup = []
|
7656 |
-
var revLookup = []
|
7657 |
-
var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
|
7658 |
-
|
7659 |
-
var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
|
7660 |
-
for (var i = 0, len = code.length; i < len; ++i) {
|
7661 |
-
lookup[i] = code[i]
|
7662 |
-
revLookup[code.charCodeAt(i)] = i
|
7663 |
-
}
|
7664 |
-
|
7665 |
-
revLookup['-'.charCodeAt(0)] = 62
|
7666 |
-
revLookup['_'.charCodeAt(0)] = 63
|
7667 |
-
|
7668 |
-
function placeHoldersCount (b64) {
|
7669 |
-
var len = b64.length
|
7670 |
-
if (len % 4 > 0) {
|
7671 |
-
throw new Error('Invalid string. Length must be a multiple of 4')
|
7672 |
-
}
|
7673 |
-
|
7674 |
-
// the number of equal signs (place holders)
|
7675 |
-
// if there are two placeholders, than the two characters before it
|
7676 |
-
// represent one byte
|
7677 |
-
// if there is only one, then the three characters before it represent 2 bytes
|
7678 |
-
// this is just a cheap hack to not do indexOf twice
|
7679 |
-
return b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0
|
7680 |
-
}
|
7681 |
-
|
7682 |
-
function byteLength (b64) {
|
7683 |
-
// base64 is 4/3 + up to two characters of the original data
|
7684 |
-
return (b64.length * 3 / 4) - placeHoldersCount(b64)
|
7685 |
-
}
|
7686 |
-
|
7687 |
-
function toByteArray (b64) {
|
7688 |
-
var i, l, tmp, placeHolders, arr
|
7689 |
-
var len = b64.length
|
7690 |
-
placeHolders = placeHoldersCount(b64)
|
7691 |
-
|
7692 |
-
arr = new Arr((len * 3 / 4) - placeHolders)
|
7693 |
-
|
7694 |
-
// if there are placeholders, only get up to the last complete 4 chars
|
7695 |
-
l = placeHolders > 0 ? len - 4 : len
|
7696 |
-
|
7697 |
-
var L = 0
|
7698 |
-
|
7699 |
-
for (i = 0; i < l; i += 4) {
|
7700 |
-
tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)]
|
7701 |
-
arr[L++] = (tmp >> 16) & 0xFF
|
7702 |
-
arr[L++] = (tmp >> 8) & 0xFF
|
7703 |
-
arr[L++] = tmp & 0xFF
|
7704 |
-
}
|
7705 |
-
|
7706 |
-
if (placeHolders === 2) {
|
7707 |
-
tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4)
|
7708 |
-
arr[L++] = tmp & 0xFF
|
7709 |
-
} else if (placeHolders === 1) {
|
7710 |
-
tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2)
|
7711 |
-
arr[L++] = (tmp >> 8) & 0xFF
|
7712 |
-
arr[L++] = tmp & 0xFF
|
7713 |
-
}
|
7714 |
-
|
7715 |
-
return arr
|
7716 |
-
}
|
7717 |
-
|
7718 |
-
function tripletToBase64 (num) {
|
7719 |
-
return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F]
|
7720 |
-
}
|
7721 |
-
|
7722 |
-
function encodeChunk (uint8, start, end) {
|
7723 |
-
var tmp
|
7724 |
-
var output = []
|
7725 |
-
for (var i = start; i < end; i += 3) {
|
7726 |
-
tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])
|
7727 |
-
output.push(tripletToBase64(tmp))
|
7728 |
-
}
|
7729 |
-
return output.join('')
|
7730 |
-
}
|
7731 |
-
|
7732 |
-
function fromByteArray (uint8) {
|
7733 |
-
var tmp
|
7734 |
-
var len = uint8.length
|
7735 |
-
var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
|
7736 |
-
var output = ''
|
7737 |
-
var parts = []
|
7738 |
-
var maxChunkLength = 16383 // must be multiple of 3
|
7739 |
-
|
7740 |
-
// go through the array every three bytes, we'll deal with trailing stuff later
|
7741 |
-
for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
|
7742 |
-
parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))
|
7743 |
-
}
|
7744 |
-
|
7745 |
-
// pad the end with zeros, but make sure to not forget the extra bytes
|
7746 |
-
if (extraBytes === 1) {
|
7747 |
-
tmp = uint8[len - 1]
|
7748 |
-
output += lookup[tmp >> 2]
|
7749 |
-
output += lookup[(tmp << 4) & 0x3F]
|
7750 |
-
output += '=='
|
7751 |
-
} else if (extraBytes === 2) {
|
7752 |
-
tmp = (uint8[len - 2] << 8) + (uint8[len - 1])
|
7753 |
-
output += lookup[tmp >> 10]
|
7754 |
-
output += lookup[(tmp >> 4) & 0x3F]
|
7755 |
-
output += lookup[(tmp << 2) & 0x3F]
|
7756 |
-
output += '='
|
7757 |
-
}
|
7758 |
-
|
7759 |
-
parts.push(output)
|
7760 |
-
|
7761 |
-
return parts.join('')
|
7762 |
-
}
|
7763 |
-
|
7764 |
-
|
7765 |
-
/***/ },
|
7766 |
-
|
7767 |
-
/***/ 489:
|
7768 |
-
/***/ function(module, exports) {
|
7769 |
-
|
7770 |
-
exports.read = function (buffer, offset, isLE, mLen, nBytes) {
|
7771 |
-
var e, m
|
7772 |
-
var eLen = nBytes * 8 - mLen - 1
|
7773 |
-
var eMax = (1 << eLen) - 1
|
7774 |
-
var eBias = eMax >> 1
|
7775 |
-
var nBits = -7
|
7776 |
-
var i = isLE ? (nBytes - 1) : 0
|
7777 |
-
var d = isLE ? -1 : 1
|
7778 |
-
var s = buffer[offset + i]
|
7779 |
-
|
7780 |
-
i += d
|
7781 |
-
|
7782 |
-
e = s & ((1 << (-nBits)) - 1)
|
7783 |
-
s >>= (-nBits)
|
7784 |
-
nBits += eLen
|
7785 |
-
for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
|
7786 |
-
|
7787 |
-
m = e & ((1 << (-nBits)) - 1)
|
7788 |
-
e >>= (-nBits)
|
7789 |
-
nBits += mLen
|
7790 |
-
for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
|
7791 |
-
|
7792 |
-
if (e === 0) {
|
7793 |
-
e = 1 - eBias
|
7794 |
-
} else if (e === eMax) {
|
7795 |
-
return m ? NaN : ((s ? -1 : 1) * Infinity)
|
7796 |
-
} else {
|
7797 |
-
m = m + Math.pow(2, mLen)
|
7798 |
-
e = e - eBias
|
7799 |
-
}
|
7800 |
-
return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
|
7801 |
-
}
|
7802 |
-
|
7803 |
-
exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
|
7804 |
-
var e, m, c
|
7805 |
-
var eLen = nBytes * 8 - mLen - 1
|
7806 |
-
var eMax = (1 << eLen) - 1
|
7807 |
-
var eBias = eMax >> 1
|
7808 |
-
var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
|
7809 |
-
var i = isLE ? 0 : (nBytes - 1)
|
7810 |
-
var d = isLE ? 1 : -1
|
7811 |
-
var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
|
7812 |
-
|
7813 |
-
value = Math.abs(value)
|
7814 |
-
|
7815 |
-
if (isNaN(value) || value === Infinity) {
|
7816 |
-
m = isNaN(value) ? 1 : 0
|
7817 |
-
e = eMax
|
7818 |
-
} else {
|
7819 |
-
e = Math.floor(Math.log(value) / Math.LN2)
|
7820 |
-
if (value * (c = Math.pow(2, -e)) < 1) {
|
7821 |
-
e--
|
7822 |
-
c *= 2
|
7823 |
-
}
|
7824 |
-
if (e + eBias >= 1) {
|
7825 |
-
value += rt / c
|
7826 |
-
} else {
|
7827 |
-
value += rt * Math.pow(2, 1 - eBias)
|
7828 |
-
}
|
7829 |
-
if (value * c >= 2) {
|
7830 |
-
e++
|
7831 |
-
c /= 2
|
7832 |
-
}
|
7833 |
-
|
7834 |
-
if (e + eBias >= eMax) {
|
7835 |
-
m = 0
|
7836 |
-
e = eMax
|
7837 |
-
} else if (e + eBias >= 1) {
|
7838 |
-
m = (value * c - 1) * Math.pow(2, mLen)
|
7839 |
-
e = e + eBias
|
7840 |
-
} else {
|
7841 |
-
m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
|
7842 |
-
e = 0
|
7843 |
-
}
|
7844 |
-
}
|
7845 |
-
|
7846 |
-
for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
|
7847 |
-
|
7848 |
-
e = (e << mLen) | m
|
7849 |
-
eLen += mLen
|
7850 |
-
for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
|
7851 |
-
|
7852 |
-
buffer[offset + i - d] |= s * 128
|
7853 |
-
}
|
7854 |
-
|
7855 |
-
|
7856 |
-
/***/ },
|
7857 |
-
|
7858 |
-
/***/ 490:
|
7859 |
-
/***/ function(module, exports) {
|
7860 |
-
|
7861 |
-
var toString = {}.toString;
|
7862 |
-
|
7863 |
-
module.exports = Array.isArray || function (arr) {
|
7864 |
-
return toString.call(arr) == '[object Array]';
|
7865 |
-
};
|
7866 |
-
|
7867 |
-
|
7868 |
-
/***/ },
|
7869 |
-
|
7870 |
-
/***/ 491:
|
7871 |
-
/***/ function(module, exports, __webpack_require__) {
|
7872 |
-
|
7873 |
-
/* WEBPACK VAR INJECTION */(function(Buffer) {// Copyright Joyent, Inc. and other Node contributors.
|
7874 |
-
//
|
7875 |
-
// Permission is hereby granted, free of charge, to any person obtaining a
|
7876 |
-
// copy of this software and associated documentation files (the
|
7877 |
-
// "Software"), to deal in the Software without restriction, including
|
7878 |
-
// without limitation the rights to use, copy, modify, merge, publish,
|
7879 |
-
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
7880 |
-
// persons to whom the Software is furnished to do so, subject to the
|
7881 |
-
// following conditions:
|
7882 |
-
//
|
7883 |
-
// The above copyright notice and this permission notice shall be included
|
7884 |
-
// in all copies or substantial portions of the Software.
|
7885 |
-
//
|
7886 |
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
7887 |
-
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
7888 |
-
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
7889 |
-
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
7890 |
-
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
7891 |
-
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
7892 |
-
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
7893 |
-
|
7894 |
-
// NOTE: These type checking functions intentionally don't use `instanceof`
|
7895 |
-
// because it is fragile and can be easily faked with `Object.create()`.
|
7896 |
-
|
7897 |
-
function isArray(arg) {
|
7898 |
-
if (Array.isArray) {
|
7899 |
-
return Array.isArray(arg);
|
7900 |
-
}
|
7901 |
-
return objectToString(arg) === '[object Array]';
|
7902 |
-
}
|
7903 |
-
exports.isArray = isArray;
|
7904 |
-
|
7905 |
-
function isBoolean(arg) {
|
7906 |
-
return typeof arg === 'boolean';
|
7907 |
-
}
|
7908 |
-
exports.isBoolean = isBoolean;
|
7909 |
-
|
7910 |
-
function isNull(arg) {
|
7911 |
-
return arg === null;
|
7912 |
-
}
|
7913 |
-
exports.isNull = isNull;
|
7914 |
-
|
7915 |
-
function isNullOrUndefined(arg) {
|
7916 |
-
return arg == null;
|
7917 |
-
}
|
7918 |
-
exports.isNullOrUndefined = isNullOrUndefined;
|
7919 |
-
|
7920 |
-
function isNumber(arg) {
|
7921 |
-
return typeof arg === 'number';
|
7922 |
-
}
|
7923 |
-
exports.isNumber = isNumber;
|
7924 |
-
|
7925 |
-
function isString(arg) {
|
7926 |
-
return typeof arg === 'string';
|
7927 |
-
}
|
7928 |
-
exports.isString = isString;
|
7929 |
-
|
7930 |
-
function isSymbol(arg) {
|
7931 |
-
return typeof arg === 'symbol';
|
7932 |
-
}
|
7933 |
-
exports.isSymbol = isSymbol;
|
7934 |
-
|
7935 |
-
function isUndefined(arg) {
|
7936 |
-
return arg === void 0;
|
7937 |
-
}
|
7938 |
-
exports.isUndefined = isUndefined;
|
7939 |
-
|
7940 |
-
function isRegExp(re) {
|
7941 |
-
return objectToString(re) === '[object RegExp]';
|
7942 |
-
}
|
7943 |
-
exports.isRegExp = isRegExp;
|
7944 |
-
|
7945 |
-
function isObject(arg) {
|
7946 |
-
return typeof arg === 'object' && arg !== null;
|
7947 |
-
}
|
7948 |
-
exports.isObject = isObject;
|
7949 |
-
|
7950 |
-
function isDate(d) {
|
7951 |
-
return objectToString(d) === '[object Date]';
|
7952 |
-
}
|
7953 |
-
exports.isDate = isDate;
|
7954 |
-
|
7955 |
-
function isError(e) {
|
7956 |
-
return (objectToString(e) === '[object Error]' || e instanceof Error);
|
7957 |
-
}
|
7958 |
-
exports.isError = isError;
|
7959 |
-
|
7960 |
-
function isFunction(arg) {
|
7961 |
-
return typeof arg === 'function';
|
7962 |
-
}
|
7963 |
-
exports.isFunction = isFunction;
|
7964 |
-
|
7965 |
-
function isPrimitive(arg) {
|
7966 |
-
return arg === null ||
|
7967 |
-
typeof arg === 'boolean' ||
|
7968 |
-
typeof arg === 'number' ||
|
7969 |
-
typeof arg === 'string' ||
|
7970 |
-
typeof arg === 'symbol' || // ES6 symbol
|
7971 |
-
typeof arg === 'undefined';
|
7972 |
-
}
|
7973 |
-
exports.isPrimitive = isPrimitive;
|
7974 |
-
|
7975 |
-
exports.isBuffer = Buffer.isBuffer;
|
7976 |
-
|
7977 |
-
function objectToString(o) {
|
7978 |
-
return Object.prototype.toString.call(o);
|
7979 |
-
}
|
7980 |
-
|
7981 |
-
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(487).Buffer))
|
7982 |
-
|
7983 |
-
/***/ },
|
7984 |
-
|
7985 |
-
/***/ 492:
|
7986 |
-
/***/ function(module, exports) {
|
7987 |
-
|
7988 |
-
/* (ignored) */
|
7989 |
-
|
7990 |
-
/***/ },
|
7991 |
-
|
7992 |
-
/***/ 493:
|
7993 |
-
/***/ function(module, exports, __webpack_require__) {
|
7994 |
-
|
7995 |
-
/* WEBPACK VAR INJECTION */(function(process) {// Copyright Joyent, Inc. and other Node contributors.
|
7996 |
-
//
|
7997 |
-
// Permission is hereby granted, free of charge, to any person obtaining a
|
7998 |
-
// copy of this software and associated documentation files (the
|
7999 |
-
// "Software"), to deal in the Software without restriction, including
|
8000 |
-
// without limitation the rights to use, copy, modify, merge, publish,
|
8001 |
-
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
8002 |
-
// persons to whom the Software is furnished to do so, subject to the
|
8003 |
-
// following conditions:
|
8004 |
-
//
|
8005 |
-
// The above copyright notice and this permission notice shall be included
|
8006 |
-
// in all copies or substantial portions of the Software.
|
8007 |
-
//
|
8008 |
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
8009 |
-
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
8010 |
-
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
8011 |
-
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
8012 |
-
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
8013 |
-
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
8014 |
-
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
8015 |
-
|
8016 |
-
// a duplex stream is just a stream that is both readable and writable.
|
8017 |
-
// Since JS doesn't have multiple prototypal inheritance, this class
|
8018 |
-
// prototypally inherits from Readable, and then parasitically from
|
8019 |
-
// Writable.
|
8020 |
-
|
8021 |
-
module.exports = Duplex;
|
8022 |
-
|
8023 |
-
/*<replacement>*/
|
8024 |
-
var objectKeys = Object.keys || function (obj) {
|
8025 |
-
var keys = [];
|
8026 |
-
for (var key in obj) keys.push(key);
|
8027 |
-
return keys;
|
8028 |
-
}
|
8029 |
-
/*</replacement>*/
|
8030 |
-
|
8031 |
-
|
8032 |
-
/*<replacement>*/
|
8033 |
-
var util = __webpack_require__(491);
|
8034 |
-
util.inherits = __webpack_require__(474);
|
8035 |
-
/*</replacement>*/
|
8036 |
-
|
8037 |
-
var Readable = __webpack_require__(485);
|
8038 |
-
var Writable = __webpack_require__(494);
|
8039 |
-
|
8040 |
-
util.inherits(Duplex, Readable);
|
8041 |
-
|
8042 |
-
forEach(objectKeys(Writable.prototype), function(method) {
|
8043 |
-
if (!Duplex.prototype[method])
|
8044 |
-
Duplex.prototype[method] = Writable.prototype[method];
|
8045 |
-
});
|
8046 |
-
|
8047 |
-
function Duplex(options) {
|
8048 |
-
if (!(this instanceof Duplex))
|
8049 |
-
return new Duplex(options);
|
8050 |
-
|
8051 |
-
Readable.call(this, options);
|
8052 |
-
Writable.call(this, options);
|
8053 |
-
|
8054 |
-
if (options && options.readable === false)
|
8055 |
-
this.readable = false;
|
8056 |
-
|
8057 |
-
if (options && options.writable === false)
|
8058 |
-
this.writable = false;
|
8059 |
-
|
8060 |
-
this.allowHalfOpen = true;
|
8061 |
-
if (options && options.allowHalfOpen === false)
|
8062 |
-
this.allowHalfOpen = false;
|
8063 |
-
|
8064 |
-
this.once('end', onend);
|
8065 |
-
}
|
8066 |
-
|
8067 |
-
// the no-half-open enforcer
|
8068 |
-
function onend() {
|
8069 |
-
// if we allow half-open state, or if the writable side ended,
|
8070 |
-
// then we're ok.
|
8071 |
-
if (this.allowHalfOpen || this._writableState.ended)
|
8072 |
-
return;
|
8073 |
-
|
8074 |
-
// no more data can be written.
|
8075 |
-
// But allow more writes to happen in this tick.
|
8076 |
-
process.nextTick(this.end.bind(this));
|
8077 |
-
}
|
8078 |
-
|
8079 |
-
function forEach (xs, f) {
|
8080 |
-
for (var i = 0, l = xs.length; i < l; i++) {
|
8081 |
-
f(xs[i], i);
|
8082 |
-
}
|
8083 |
-
}
|
8084 |
-
|
8085 |
-
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
|
8086 |
-
|
8087 |
-
/***/ },
|
8088 |
-
|
8089 |
-
/***/ 494:
|
8090 |
-
/***/ function(module, exports, __webpack_require__) {
|
8091 |
-
|
8092 |
-
/* WEBPACK VAR INJECTION */(function(process) {// Copyright Joyent, Inc. and other Node contributors.
|
8093 |
-
//
|
8094 |
-
// Permission is hereby granted, free of charge, to any person obtaining a
|
8095 |
-
// copy of this software and associated documentation files (the
|
8096 |
-
// "Software"), to deal in the Software without restriction, including
|
8097 |
-
// without limitation the rights to use, copy, modify, merge, publish,
|
8098 |
-
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
8099 |
-
// persons to whom the Software is furnished to do so, subject to the
|
8100 |
-
// following conditions:
|
8101 |
-
//
|
8102 |
-
// The above copyright notice and this permission notice shall be included
|
8103 |
-
// in all copies or substantial portions of the Software.
|
8104 |
-
//
|
8105 |
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
8106 |
-
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
8107 |
-
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
8108 |
-
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
8109 |
-
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
8110 |
-
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
8111 |
-
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
8112 |
-
|
8113 |
-
// A bit simpler than readable streams.
|
8114 |
-
// Implement an async ._write(chunk, cb), and it'll handle all
|
8115 |
-
// the drain event emission and buffering.
|
8116 |
-
|
8117 |
-
module.exports = Writable;
|
8118 |
-
|
8119 |
-
/*<replacement>*/
|
8120 |
-
var Buffer = __webpack_require__(487).Buffer;
|
8121 |
-
/*</replacement>*/
|
8122 |
-
|
8123 |
-
Writable.WritableState = WritableState;
|
8124 |
-
|
8125 |
-
|
8126 |
-
/*<replacement>*/
|
8127 |
-
var util = __webpack_require__(491);
|
8128 |
-
util.inherits = __webpack_require__(474);
|
8129 |
-
/*</replacement>*/
|
8130 |
-
|
8131 |
-
var Stream = __webpack_require__(483);
|
8132 |
-
|
8133 |
-
util.inherits(Writable, Stream);
|
8134 |
-
|
8135 |
-
function WriteReq(chunk, encoding, cb) {
|
8136 |
-
this.chunk = chunk;
|
8137 |
-
this.encoding = encoding;
|
8138 |
-
this.callback = cb;
|
8139 |
-
}
|
8140 |
-
|
8141 |
-
function WritableState(options, stream) {
|
8142 |
-
var Duplex = __webpack_require__(493);
|
8143 |
-
|
8144 |
-
options = options || {};
|
8145 |
-
|
8146 |
-
// the point at which write() starts returning false
|
8147 |
-
// Note: 0 is a valid value, means that we always return false if
|
8148 |
-
// the entire buffer is not flushed immediately on write()
|
8149 |
-
var hwm = options.highWaterMark;
|
8150 |
-
var defaultHwm = options.objectMode ? 16 : 16 * 1024;
|
8151 |
-
this.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm;
|
8152 |
-
|
8153 |
-
// object stream flag to indicate whether or not this stream
|
8154 |
-
// contains buffers or objects.
|
8155 |
-
this.objectMode = !!options.objectMode;
|
8156 |
-
|
8157 |
-
if (stream instanceof Duplex)
|
8158 |
-
this.objectMode = this.objectMode || !!options.writableObjectMode;
|
8159 |
-
|
8160 |
-
// cast to ints.
|
8161 |
-
this.highWaterMark = ~~this.highWaterMark;
|
8162 |
-
|
8163 |
-
this.needDrain = false;
|
8164 |
-
// at the start of calling end()
|
8165 |
-
this.ending = false;
|
8166 |
-
// when end() has been called, and returned
|
8167 |
-
this.ended = false;
|
8168 |
-
// when 'finish' is emitted
|
8169 |
-
this.finished = false;
|
8170 |
-
|
8171 |
-
// should we decode strings into buffers before passing to _write?
|
8172 |
-
// this is here so that some node-core streams can optimize string
|
8173 |
-
// handling at a lower level.
|
8174 |
-
var noDecode = options.decodeStrings === false;
|
8175 |
-
this.decodeStrings = !noDecode;
|
8176 |
-
|
8177 |
-
// Crypto is kind of old and crusty. Historically, its default string
|
8178 |
-
// encoding is 'binary' so we have to make this configurable.
|
8179 |
-
// Everything else in the universe uses 'utf8', though.
|
8180 |
-
this.defaultEncoding = options.defaultEncoding || 'utf8';
|
8181 |
-
|
8182 |
-
// not an actual buffer we keep track of, but a measurement
|
8183 |
-
// of how much we're waiting to get pushed to some underlying
|
8184 |
-
// socket or file.
|
8185 |
-
this.length = 0;
|
8186 |
-
|
8187 |
-
// a flag to see when we're in the middle of a write.
|
8188 |
-
this.writing = false;
|
8189 |
-
|
8190 |
-
// when true all writes will be buffered until .uncork() call
|
8191 |
-
this.corked = 0;
|
8192 |
-
|
8193 |
-
// a flag to be able to tell if the onwrite cb is called immediately,
|
8194 |
-
// or on a later tick. We set this to true at first, because any
|
8195 |
-
// actions that shouldn't happen until "later" should generally also
|
8196 |
-
// not happen before the first write call.
|
8197 |
-
this.sync = true;
|
8198 |
-
|
8199 |
-
// a flag to know if we're processing previously buffered items, which
|
8200 |
-
// may call the _write() callback in the same tick, so that we don't
|
8201 |
-
// end up in an overlapped onwrite situation.
|
8202 |
-
this.bufferProcessing = false;
|
8203 |
-
|
8204 |
-
// the callback that's passed to _write(chunk,cb)
|
8205 |
-
this.onwrite = function(er) {
|
8206 |
-
onwrite(stream, er);
|
8207 |
-
};
|
8208 |
-
|
8209 |
-
// the callback that the user supplies to write(chunk,encoding,cb)
|
8210 |
-
this.writecb = null;
|
8211 |
-
|
8212 |
-
// the amount that is being written when _write is called.
|
8213 |
-
this.writelen = 0;
|
8214 |
-
|
8215 |
-
this.buffer = [];
|
8216 |
-
|
8217 |
-
// number of pending user-supplied write callbacks
|
8218 |
-
// this must be 0 before 'finish' can be emitted
|
8219 |
-
this.pendingcb = 0;
|
8220 |
-
|
8221 |
-
// emit prefinish if the only thing we're waiting for is _write cbs
|
8222 |
-
// This is relevant for synchronous Transform streams
|
8223 |
-
this.prefinished = false;
|
8224 |
-
|
8225 |
-
// True if the error was already emitted and should not be thrown again
|
8226 |
-
this.errorEmitted = false;
|
8227 |
-
}
|
8228 |
-
|
8229 |
-
function Writable(options) {
|
8230 |
-
var Duplex = __webpack_require__(493);
|
8231 |
-
|
8232 |
-
// Writable ctor is applied to Duplexes, though they're not
|
8233 |
-
// instanceof Writable, they're instanceof Readable.
|
8234 |
-
if (!(this instanceof Writable) && !(this instanceof Duplex))
|
8235 |
-
return new Writable(options);
|
8236 |
-
|
8237 |
-
this._writableState = new WritableState(options, this);
|
8238 |
-
|
8239 |
-
// legacy.
|
8240 |
-
this.writable = true;
|
8241 |
-
|
8242 |
-
Stream.call(this);
|
8243 |
-
}
|
8244 |
-
|
8245 |
-
// Otherwise people can pipe Writable streams, which is just wrong.
|
8246 |
-
Writable.prototype.pipe = function() {
|
8247 |
-
this.emit('error', new Error('Cannot pipe. Not readable.'));
|
8248 |
-
};
|
8249 |
-
|
8250 |
-
|
8251 |
-
function writeAfterEnd(stream, state, cb) {
|
8252 |
-
var er = new Error('write after end');
|
8253 |
-
// TODO: defer error events consistently everywhere, not just the cb
|
8254 |
-
stream.emit('error', er);
|
8255 |
-
process.nextTick(function() {
|
8256 |
-
cb(er);
|
8257 |
-
});
|
8258 |
-
}
|
8259 |
-
|
8260 |
-
// If we get something that is not a buffer, string, null, or undefined,
|
8261 |
-
// and we're not in objectMode, then that's an error.
|
8262 |
-
// Otherwise stream chunks are all considered to be of length=1, and the
|
8263 |
-
// watermarks determine how many objects to keep in the buffer, rather than
|
8264 |
-
// how many bytes or characters.
|
8265 |
-
function validChunk(stream, state, chunk, cb) {
|
8266 |
-
var valid = true;
|
8267 |
-
if (!util.isBuffer(chunk) &&
|
8268 |
-
!util.isString(chunk) &&
|
8269 |
-
!util.isNullOrUndefined(chunk) &&
|
8270 |
-
!state.objectMode) {
|
8271 |
-
var er = new TypeError('Invalid non-string/buffer chunk');
|
8272 |
-
stream.emit('error', er);
|
8273 |
-
process.nextTick(function() {
|
8274 |
-
cb(er);
|
8275 |
-
});
|
8276 |
-
valid = false;
|
8277 |
-
}
|
8278 |
-
return valid;
|
8279 |
-
}
|
8280 |
-
|
8281 |
-
Writable.prototype.write = function(chunk, encoding, cb) {
|
8282 |
-
var state = this._writableState;
|
8283 |
-
var ret = false;
|
8284 |
-
|
8285 |
-
if (util.isFunction(encoding)) {
|
8286 |
-
cb = encoding;
|
8287 |
-
encoding = null;
|
8288 |
-
}
|
8289 |
-
|
8290 |
-
if (util.isBuffer(chunk))
|
8291 |
-
encoding = 'buffer';
|
8292 |
-
else if (!encoding)
|
8293 |
-
encoding = state.defaultEncoding;
|
8294 |
-
|
8295 |
-
if (!util.isFunction(cb))
|
8296 |
-
cb = function() {};
|
8297 |
-
|
8298 |
-
if (state.ended)
|
8299 |
-
writeAfterEnd(this, state, cb);
|
8300 |
-
else if (validChunk(this, state, chunk, cb)) {
|
8301 |
-
state.pendingcb++;
|
8302 |
-
ret = writeOrBuffer(this, state, chunk, encoding, cb);
|
8303 |
-
}
|
8304 |
-
|
8305 |
-
return ret;
|
8306 |
-
};
|
8307 |
-
|
8308 |
-
Writable.prototype.cork = function() {
|
8309 |
-
var state = this._writableState;
|
8310 |
-
|
8311 |
-
state.corked++;
|
8312 |
-
};
|
8313 |
-
|
8314 |
-
Writable.prototype.uncork = function() {
|
8315 |
-
var state = this._writableState;
|
8316 |
-
|
8317 |
-
if (state.corked) {
|
8318 |
-
state.corked--;
|
8319 |
-
|
8320 |
-
if (!state.writing &&
|
8321 |
-
!state.corked &&
|
8322 |
-
!state.finished &&
|
8323 |
-
!state.bufferProcessing &&
|
8324 |
-
state.buffer.length)
|
8325 |
-
clearBuffer(this, state);
|
8326 |
-
}
|
8327 |
-
};
|
8328 |
-
|
8329 |
-
function decodeChunk(state, chunk, encoding) {
|
8330 |
-
if (!state.objectMode &&
|
8331 |
-
state.decodeStrings !== false &&
|
8332 |
-
util.isString(chunk)) {
|
8333 |
-
chunk = new Buffer(chunk, encoding);
|
8334 |
-
}
|
8335 |
-
return chunk;
|
8336 |
-
}
|
8337 |
-
|
8338 |
-
// if we're already writing something, then just put this
|
8339 |
-
// in the queue, and wait our turn. Otherwise, call _write
|
8340 |
-
// If we return false, then we need a drain event, so set that flag.
|
8341 |
-
function writeOrBuffer(stream, state, chunk, encoding, cb) {
|
8342 |
-
chunk = decodeChunk(state, chunk, encoding);
|
8343 |
-
if (util.isBuffer(chunk))
|
8344 |
-
encoding = 'buffer';
|
8345 |
-
var len = state.objectMode ? 1 : chunk.length;
|
8346 |
-
|
8347 |
-
state.length += len;
|
8348 |
-
|
8349 |
-
var ret = state.length < state.highWaterMark;
|
8350 |
-
// we must ensure that previous needDrain will not be reset to false.
|
8351 |
-
if (!ret)
|
8352 |
-
state.needDrain = true;
|
8353 |
-
|
8354 |
-
if (state.writing || state.corked)
|
8355 |
-
state.buffer.push(new WriteReq(chunk, encoding, cb));
|
8356 |
-
else
|
8357 |
-
doWrite(stream, state, false, len, chunk, encoding, cb);
|
8358 |
-
|
8359 |
-
return ret;
|
8360 |
-
}
|
8361 |
-
|
8362 |
-
function doWrite(stream, state, writev, len, chunk, encoding, cb) {
|
8363 |
-
state.writelen = len;
|
8364 |
-
state.writecb = cb;
|
8365 |
-
state.writing = true;
|
8366 |
-
state.sync = true;
|
8367 |
-
if (writev)
|
8368 |
-
stream._writev(chunk, state.onwrite);
|
8369 |
-
else
|
8370 |
-
stream._write(chunk, encoding, state.onwrite);
|
8371 |
-
state.sync = false;
|
8372 |
-
}
|
8373 |
-
|
8374 |
-
function onwriteError(stream, state, sync, er, cb) {
|
8375 |
-
if (sync)
|
8376 |
-
process.nextTick(function() {
|
8377 |
-
state.pendingcb--;
|
8378 |
-
cb(er);
|
8379 |
-
});
|
8380 |
-
else {
|
8381 |
-
state.pendingcb--;
|
8382 |
-
cb(er);
|
8383 |
-
}
|
8384 |
-
|
8385 |
-
stream._writableState.errorEmitted = true;
|
8386 |
-
stream.emit('error', er);
|
8387 |
-
}
|
8388 |
-
|
8389 |
-
function onwriteStateUpdate(state) {
|
8390 |
-
state.writing = false;
|
8391 |
-
state.writecb = null;
|
8392 |
-
state.length -= state.writelen;
|
8393 |
-
state.writelen = 0;
|
8394 |
-
}
|
8395 |
-
|
8396 |
-
function onwrite(stream, er) {
|
8397 |
-
var state = stream._writableState;
|
8398 |
-
var sync = state.sync;
|
8399 |
-
var cb = state.writecb;
|
8400 |
-
|
8401 |
-
onwriteStateUpdate(state);
|
8402 |
-
|
8403 |
-
if (er)
|
8404 |
-
onwriteError(stream, state, sync, er, cb);
|
8405 |
-
else {
|
8406 |
-
// Check if we're actually ready to finish, but don't emit yet
|
8407 |
-
var finished = needFinish(stream, state);
|
8408 |
-
|
8409 |
-
if (!finished &&
|
8410 |
-
!state.corked &&
|
8411 |
-
!state.bufferProcessing &&
|
8412 |
-
state.buffer.length) {
|
8413 |
-
clearBuffer(stream, state);
|
8414 |
-
}
|
8415 |
-
|
8416 |
-
if (sync) {
|
8417 |
-
process.nextTick(function() {
|
8418 |
-
afterWrite(stream, state, finished, cb);
|
8419 |
-
});
|
8420 |
-
} else {
|
8421 |
-
afterWrite(stream, state, finished, cb);
|
8422 |
-
}
|
8423 |
-
}
|
8424 |
-
}
|
8425 |
-
|
8426 |
-
function afterWrite(stream, state, finished, cb) {
|
8427 |
-
if (!finished)
|
8428 |
-
onwriteDrain(stream, state);
|
8429 |
-
state.pendingcb--;
|
8430 |
-
cb();
|
8431 |
-
finishMaybe(stream, state);
|
8432 |
-
}
|
8433 |
-
|
8434 |
-
// Must force callback to be called on nextTick, so that we don't
|
8435 |
-
// emit 'drain' before the write() consumer gets the 'false' return
|
8436 |
-
// value, and has a chance to attach a 'drain' listener.
|
8437 |
-
function onwriteDrain(stream, state) {
|
8438 |
-
if (state.length === 0 && state.needDrain) {
|
8439 |
-
state.needDrain = false;
|
8440 |
-
stream.emit('drain');
|
8441 |
-
}
|
8442 |
-
}
|
8443 |
-
|
8444 |
-
|
8445 |
-
// if there's something in the buffer waiting, then process it
|
8446 |
-
function clearBuffer(stream, state) {
|
8447 |
-
state.bufferProcessing = true;
|
8448 |
-
|
8449 |
-
if (stream._writev && state.buffer.length > 1) {
|
8450 |
-
// Fast case, write everything using _writev()
|
8451 |
-
var cbs = [];
|
8452 |
-
for (var c = 0; c < state.buffer.length; c++)
|
8453 |
-
cbs.push(state.buffer[c].callback);
|
8454 |
-
|
8455 |
-
// count the one we are adding, as well.
|
8456 |
-
// TODO(isaacs) clean this up
|
8457 |
-
state.pendingcb++;
|
8458 |
-
doWrite(stream, state, true, state.length, state.buffer, '', function(err) {
|
8459 |
-
for (var i = 0; i < cbs.length; i++) {
|
8460 |
-
state.pendingcb--;
|
8461 |
-
cbs[i](err);
|
8462 |
-
}
|
8463 |
-
});
|
8464 |
-
|
8465 |
-
// Clear buffer
|
8466 |
-
state.buffer = [];
|
8467 |
-
} else {
|
8468 |
-
// Slow case, write chunks one-by-one
|
8469 |
-
for (var c = 0; c < state.buffer.length; c++) {
|
8470 |
-
var entry = state.buffer[c];
|
8471 |
-
var chunk = entry.chunk;
|
8472 |
-
var encoding = entry.encoding;
|
8473 |
-
var cb = entry.callback;
|
8474 |
-
var len = state.objectMode ? 1 : chunk.length;
|
8475 |
-
|
8476 |
-
doWrite(stream, state, false, len, chunk, encoding, cb);
|
8477 |
-
|
8478 |
-
// if we didn't call the onwrite immediately, then
|
8479 |
-
// it means that we need to wait until it does.
|
8480 |
-
// also, that means that the chunk and cb are currently
|
8481 |
-
// being processed, so move the buffer counter past them.
|
8482 |
-
if (state.writing) {
|
8483 |
-
c++;
|
8484 |
-
break;
|
8485 |
-
}
|
8486 |
-
}
|
8487 |
-
|
8488 |
-
if (c < state.buffer.length)
|
8489 |
-
state.buffer = state.buffer.slice(c);
|
8490 |
-
else
|
8491 |
-
state.buffer.length = 0;
|
8492 |
-
}
|
8493 |
-
|
8494 |
-
state.bufferProcessing = false;
|
8495 |
-
}
|
8496 |
-
|
8497 |
-
Writable.prototype._write = function(chunk, encoding, cb) {
|
8498 |
-
cb(new Error('not implemented'));
|
8499 |
-
|
8500 |
-
};
|
8501 |
-
|
8502 |
-
Writable.prototype._writev = null;
|
8503 |
-
|
8504 |
-
Writable.prototype.end = function(chunk, encoding, cb) {
|
8505 |
-
var state = this._writableState;
|
8506 |
-
|
8507 |
-
if (util.isFunction(chunk)) {
|
8508 |
-
cb = chunk;
|
8509 |
-
chunk = null;
|
8510 |
-
encoding = null;
|
8511 |
-
} else if (util.isFunction(encoding)) {
|
8512 |
-
cb = encoding;
|
8513 |
-
encoding = null;
|
8514 |
-
}
|
8515 |
-
|
8516 |
-
if (!util.isNullOrUndefined(chunk))
|
8517 |
-
this.write(chunk, encoding);
|
8518 |
-
|
8519 |
-
// .end() fully uncorks
|
8520 |
-
if (state.corked) {
|
8521 |
-
state.corked = 1;
|
8522 |
-
this.uncork();
|
8523 |
-
}
|
8524 |
-
|
8525 |
-
// ignore unnecessary end() calls.
|
8526 |
-
if (!state.ending && !state.finished)
|
8527 |
-
endWritable(this, state, cb);
|
8528 |
-
};
|
8529 |
-
|
8530 |
-
|
8531 |
-
function needFinish(stream, state) {
|
8532 |
-
return (state.ending &&
|
8533 |
-
state.length === 0 &&
|
8534 |
-
!state.finished &&
|
8535 |
-
!state.writing);
|
8536 |
-
}
|
8537 |
-
|
8538 |
-
function prefinish(stream, state) {
|
8539 |
-
if (!state.prefinished) {
|
8540 |
-
state.prefinished = true;
|
8541 |
-
stream.emit('prefinish');
|
8542 |
-
}
|
8543 |
-
}
|
8544 |
-
|
8545 |
-
function finishMaybe(stream, state) {
|
8546 |
-
var need = needFinish(stream, state);
|
8547 |
-
if (need) {
|
8548 |
-
if (state.pendingcb === 0) {
|
8549 |
-
prefinish(stream, state);
|
8550 |
-
state.finished = true;
|
8551 |
-
stream.emit('finish');
|
8552 |
-
} else
|
8553 |
-
prefinish(stream, state);
|
8554 |
-
}
|
8555 |
-
return need;
|
8556 |
-
}
|
8557 |
-
|
8558 |
-
function endWritable(stream, state, cb) {
|
8559 |
-
state.ending = true;
|
8560 |
-
finishMaybe(stream, state);
|
8561 |
-
if (cb) {
|
8562 |
-
if (state.finished)
|
8563 |
-
process.nextTick(cb);
|
8564 |
-
else
|
8565 |
-
stream.once('finish', cb);
|
8566 |
-
}
|
8567 |
-
state.ended = true;
|
8568 |
-
}
|
8569 |
-
|
8570 |
-
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
|
8571 |
-
|
8572 |
-
/***/ },
|
8573 |
-
|
8574 |
-
/***/ 495:
|
8575 |
-
/***/ function(module, exports, __webpack_require__) {
|
8576 |
-
|
8577 |
-
// Copyright Joyent, Inc. and other Node contributors.
|
8578 |
-
//
|
8579 |
-
// Permission is hereby granted, free of charge, to any person obtaining a
|
8580 |
-
// copy of this software and associated documentation files (the
|
8581 |
-
// "Software"), to deal in the Software without restriction, including
|
8582 |
-
// without limitation the rights to use, copy, modify, merge, publish,
|
8583 |
-
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
8584 |
-
// persons to whom the Software is furnished to do so, subject to the
|
8585 |
-
// following conditions:
|
8586 |
-
//
|
8587 |
-
// The above copyright notice and this permission notice shall be included
|
8588 |
-
// in all copies or substantial portions of the Software.
|
8589 |
-
//
|
8590 |
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
8591 |
-
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
8592 |
-
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
8593 |
-
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
8594 |
-
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
8595 |
-
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
8596 |
-
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
8597 |
-
|
8598 |
-
var Buffer = __webpack_require__(487).Buffer;
|
8599 |
-
|
8600 |
-
var isBufferEncoding = Buffer.isEncoding
|
8601 |
-
|| function(encoding) {
|
8602 |
-
switch (encoding && encoding.toLowerCase()) {
|
8603 |
-
case 'hex': case 'utf8': case 'utf-8': case 'ascii': case 'binary': case 'base64': case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': case 'raw': return true;
|
8604 |
-
default: return false;
|
8605 |
-
}
|
8606 |
-
}
|
8607 |
-
|
8608 |
-
|
8609 |
-
function assertEncoding(encoding) {
|
8610 |
-
if (encoding && !isBufferEncoding(encoding)) {
|
8611 |
-
throw new Error('Unknown encoding: ' + encoding);
|
8612 |
-
}
|
8613 |
-
}
|
8614 |
-
|
8615 |
-
// StringDecoder provides an interface for efficiently splitting a series of
|
8616 |
-
// buffers into a series of JS strings without breaking apart multi-byte
|
8617 |
-
// characters. CESU-8 is handled as part of the UTF-8 encoding.
|
8618 |
-
//
|
8619 |
-
// @TODO Handling all encodings inside a single object makes it very difficult
|
8620 |
-
// to reason about this code, so it should be split up in the future.
|
8621 |
-
// @TODO There should be a utf8-strict encoding that rejects invalid UTF-8 code
|
8622 |
-
// points as used by CESU-8.
|
8623 |
-
var StringDecoder = exports.StringDecoder = function(encoding) {
|
8624 |
-
this.encoding = (encoding || 'utf8').toLowerCase().replace(/[-_]/, '');
|
8625 |
-
assertEncoding(encoding);
|
8626 |
-
switch (this.encoding) {
|
8627 |
-
case 'utf8':
|
8628 |
-
// CESU-8 represents each of Surrogate Pair by 3-bytes
|
8629 |
-
this.surrogateSize = 3;
|
8630 |
-
break;
|
8631 |
-
case 'ucs2':
|
8632 |
-
case 'utf16le':
|
8633 |
-
// UTF-16 represents each of Surrogate Pair by 2-bytes
|
8634 |
-
this.surrogateSize = 2;
|
8635 |
-
this.detectIncompleteChar = utf16DetectIncompleteChar;
|
8636 |
-
break;
|
8637 |
-
case 'base64':
|
8638 |
-
// Base-64 stores 3 bytes in 4 chars, and pads the remainder.
|
8639 |
-
this.surrogateSize = 3;
|
8640 |
-
this.detectIncompleteChar = base64DetectIncompleteChar;
|
8641 |
-
break;
|
8642 |
-
default:
|
8643 |
-
this.write = passThroughWrite;
|
8644 |
-
return;
|
8645 |
-
}
|
8646 |
-
|
8647 |
-
// Enough space to store all bytes of a single character. UTF-8 needs 4
|
8648 |
-
// bytes, but CESU-8 may require up to 6 (3 bytes per surrogate).
|
8649 |
-
this.charBuffer = new Buffer(6);
|
8650 |
-
// Number of bytes received for the current incomplete multi-byte character.
|
8651 |
-
this.charReceived = 0;
|
8652 |
-
// Number of bytes expected for the current incomplete multi-byte character.
|
8653 |
-
this.charLength = 0;
|
8654 |
-
};
|
8655 |
-
|
8656 |
-
|
8657 |
-
// write decodes the given buffer and returns it as JS string that is
|
8658 |
-
// guaranteed to not contain any partial multi-byte characters. Any partial
|
8659 |
-
// character found at the end of the buffer is buffered up, and will be
|
8660 |
-
// returned when calling write again with the remaining bytes.
|
8661 |
-
//
|
8662 |
-
// Note: Converting a Buffer containing an orphan surrogate to a String
|
8663 |
-
// currently works, but converting a String to a Buffer (via `new Buffer`, or
|
8664 |
-
// Buffer#write) will replace incomplete surrogates with the unicode
|
8665 |
-
// replacement character. See https://codereview.chromium.org/121173009/ .
|
8666 |
-
StringDecoder.prototype.write = function(buffer) {
|
8667 |
-
var charStr = '';
|
8668 |
-
// if our last write ended with an incomplete multibyte character
|
8669 |
-
while (this.charLength) {
|
8670 |
-
// determine how many remaining bytes this buffer has to offer for this char
|
8671 |
-
var available = (buffer.length >= this.charLength - this.charReceived) ?
|
8672 |
-
this.charLength - this.charReceived :
|
8673 |
-
buffer.length;
|
8674 |
-
|
8675 |
-
// add the new bytes to the char buffer
|
8676 |
-
buffer.copy(this.charBuffer, this.charReceived, 0, available);
|
8677 |
-
this.charReceived += available;
|
8678 |
-
|
8679 |
-
if (this.charReceived < this.charLength) {
|
8680 |
-
// still not enough chars in this buffer? wait for more ...
|
8681 |
-
return '';
|
8682 |
-
}
|
8683 |
-
|
8684 |
-
// remove bytes belonging to the current character from the buffer
|
8685 |
-
buffer = buffer.slice(available, buffer.length);
|
8686 |
-
|
8687 |
-
// get the character that was split
|
8688 |
-
charStr = this.charBuffer.slice(0, this.charLength).toString(this.encoding);
|
8689 |
-
|
8690 |
-
// CESU-8: lead surrogate (D800-DBFF) is also the incomplete character
|
8691 |
-
var charCode = charStr.charCodeAt(charStr.length - 1);
|
8692 |
-
if (charCode >= 0xD800 && charCode <= 0xDBFF) {
|
8693 |
-
this.charLength += this.surrogateSize;
|
8694 |
-
charStr = '';
|
8695 |
-
continue;
|
8696 |
-
}
|
8697 |
-
this.charReceived = this.charLength = 0;
|
8698 |
-
|
8699 |
-
// if there are no more bytes in this buffer, just emit our char
|
8700 |
-
if (buffer.length === 0) {
|
8701 |
-
return charStr;
|
8702 |
-
}
|
8703 |
-
break;
|
8704 |
-
}
|
8705 |
-
|
8706 |
-
// determine and set charLength / charReceived
|
8707 |
-
this.detectIncompleteChar(buffer);
|
8708 |
-
|
8709 |
-
var end = buffer.length;
|
8710 |
-
if (this.charLength) {
|
8711 |
-
// buffer the incomplete character bytes we got
|
8712 |
-
buffer.copy(this.charBuffer, 0, buffer.length - this.charReceived, end);
|
8713 |
-
end -= this.charReceived;
|
8714 |
-
}
|
8715 |
-
|
8716 |
-
charStr += buffer.toString(this.encoding, 0, end);
|
8717 |
-
|
8718 |
-
var end = charStr.length - 1;
|
8719 |
-
var charCode = charStr.charCodeAt(end);
|
8720 |
-
// CESU-8: lead surrogate (D800-DBFF) is also the incomplete character
|
8721 |
-
if (charCode >= 0xD800 && charCode <= 0xDBFF) {
|
8722 |
-
var size = this.surrogateSize;
|
8723 |
-
this.charLength += size;
|
8724 |
-
this.charReceived += size;
|
8725 |
-
this.charBuffer.copy(this.charBuffer, size, 0, size);
|
8726 |
-
buffer.copy(this.charBuffer, 0, 0, size);
|
8727 |
-
return charStr.substring(0, end);
|
8728 |
-
}
|
8729 |
-
|
8730 |
-
// or just emit the charStr
|
8731 |
-
return charStr;
|
8732 |
-
};
|
8733 |
-
|
8734 |
-
// detectIncompleteChar determines if there is an incomplete UTF-8 character at
|
8735 |
-
// the end of the given buffer. If so, it sets this.charLength to the byte
|
8736 |
-
// length that character, and sets this.charReceived to the number of bytes
|
8737 |
-
// that are available for this character.
|
8738 |
-
StringDecoder.prototype.detectIncompleteChar = function(buffer) {
|
8739 |
-
// determine how many bytes we have to check at the end of this buffer
|
8740 |
-
var i = (buffer.length >= 3) ? 3 : buffer.length;
|
8741 |
-
|
8742 |
-
// Figure out if one of the last i bytes of our buffer announces an
|
8743 |
-
// incomplete char.
|
8744 |
-
for (; i > 0; i--) {
|
8745 |
-
var c = buffer[buffer.length - i];
|
8746 |
-
|
8747 |
-
// See http://en.wikipedia.org/wiki/UTF-8#Description
|
8748 |
-
|
8749 |
-
// 110XXXXX
|
8750 |
-
if (i == 1 && c >> 5 == 0x06) {
|
8751 |
-
this.charLength = 2;
|
8752 |
-
break;
|
8753 |
-
}
|
8754 |
-
|
8755 |
-
// 1110XXXX
|
8756 |
-
if (i <= 2 && c >> 4 == 0x0E) {
|
8757 |
-
this.charLength = 3;
|
8758 |
-
break;
|
8759 |
-
}
|
8760 |
-
|
8761 |
-
// 11110XXX
|
8762 |
-
if (i <= 3 && c >> 3 == 0x1E) {
|
8763 |
-
this.charLength = 4;
|
8764 |
-
break;
|
8765 |
-
}
|
8766 |
-
}
|
8767 |
-
this.charReceived = i;
|
8768 |
-
};
|
8769 |
-
|
8770 |
-
StringDecoder.prototype.end = function(buffer) {
|
8771 |
-
var res = '';
|
8772 |
-
if (buffer && buffer.length)
|
8773 |
-
res = this.write(buffer);
|
8774 |
-
|
8775 |
-
if (this.charReceived) {
|
8776 |
-
var cr = this.charReceived;
|
8777 |
-
var buf = this.charBuffer;
|
8778 |
-
var enc = this.encoding;
|
8779 |
-
res += buf.slice(0, cr).toString(enc);
|
8780 |
-
}
|
8781 |
-
|
8782 |
-
return res;
|
8783 |
-
};
|
8784 |
-
|
8785 |
-
function passThroughWrite(buffer) {
|
8786 |
-
return buffer.toString(this.encoding);
|
8787 |
-
}
|
8788 |
-
|
8789 |
-
function utf16DetectIncompleteChar(buffer) {
|
8790 |
-
this.charReceived = buffer.length % 2;
|
8791 |
-
this.charLength = this.charReceived ? 2 : 0;
|
8792 |
-
}
|
8793 |
-
|
8794 |
-
function base64DetectIncompleteChar(buffer) {
|
8795 |
-
this.charReceived = buffer.length % 3;
|
8796 |
-
this.charLength = this.charReceived ? 3 : 0;
|
8797 |
-
}
|
8798 |
-
|
8799 |
-
|
8800 |
-
/***/ },
|
8801 |
-
|
8802 |
-
/***/ 496:
|
8803 |
-
/***/ function(module, exports, __webpack_require__) {
|
8804 |
-
|
8805 |
-
// Copyright Joyent, Inc. and other Node contributors.
|
8806 |
-
//
|
8807 |
-
// Permission is hereby granted, free of charge, to any person obtaining a
|
8808 |
-
// copy of this software and associated documentation files (the
|
8809 |
-
// "Software"), to deal in the Software without restriction, including
|
8810 |
-
// without limitation the rights to use, copy, modify, merge, publish,
|
8811 |
-
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
8812 |
-
// persons to whom the Software is furnished to do so, subject to the
|
8813 |
-
// following conditions:
|
8814 |
-
//
|
8815 |
-
// The above copyright notice and this permission notice shall be included
|
8816 |
-
// in all copies or substantial portions of the Software.
|
8817 |
-
//
|
8818 |
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
8819 |
-
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
8820 |
-
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
8821 |
-
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
8822 |
-
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
8823 |
-
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
8824 |
-
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
8825 |
-
|
8826 |
-
|
8827 |
-
// a transform stream is a readable/writable stream where you do
|
8828 |
-
// something with the data. Sometimes it's called a "filter",
|
8829 |
-
// but that's not a great name for it, since that implies a thing where
|
8830 |
-
// some bits pass through, and others are simply ignored. (That would
|
8831 |
-
// be a valid example of a transform, of course.)
|
8832 |
-
//
|
8833 |
-
// While the output is causally related to the input, it's not a
|
8834 |
-
// necessarily symmetric or synchronous transformation. For example,
|
8835 |
-
// a zlib stream might take multiple plain-text writes(), and then
|
8836 |
-
// emit a single compressed chunk some time in the future.
|
8837 |
-
//
|
8838 |
-
// Here's how this works:
|
8839 |
-
//
|
8840 |
-
// The Transform stream has all the aspects of the readable and writable
|
8841 |
-
// stream classes. When you write(chunk), that calls _write(chunk,cb)
|
8842 |
-
// internally, and returns false if there's a lot of pending writes
|
8843 |
-
// buffered up. When you call read(), that calls _read(n) until
|
8844 |
-
// there's enough pending readable data buffered up.
|
8845 |
-
//
|
8846 |
-
// In a transform stream, the written data is placed in a buffer. When
|
8847 |
-
// _read(n) is called, it transforms the queued up data, calling the
|
8848 |
-
// buffered _write cb's as it consumes chunks. If consuming a single
|
8849 |
-
// written chunk would result in multiple output chunks, then the first
|
8850 |
-
// outputted bit calls the readcb, and subsequent chunks just go into
|
8851 |
-
// the read buffer, and will cause it to emit 'readable' if necessary.
|
8852 |
-
//
|
8853 |
-
// This way, back-pressure is actually determined by the reading side,
|
8854 |
-
// since _read has to be called to start processing a new chunk. However,
|
8855 |
-
// a pathological inflate type of transform can cause excessive buffering
|
8856 |
-
// here. For example, imagine a stream where every byte of input is
|
8857 |
-
// interpreted as an integer from 0-255, and then results in that many
|
8858 |
-
// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in
|
8859 |
-
// 1kb of data being output. In this case, you could write a very small
|
8860 |
-
// amount of input, and end up with a very large amount of output. In
|
8861 |
-
// such a pathological inflating mechanism, there'd be no way to tell
|
8862 |
-
// the system to stop doing the transform. A single 4MB write could
|
8863 |
-
// cause the system to run out of memory.
|
8864 |
-
//
|
8865 |
-
// However, even in such a pathological case, only a single written chunk
|
8866 |
-
// would be consumed, and then the rest would wait (un-transformed) until
|
8867 |
-
// the results of the previous transformed chunk were consumed.
|
8868 |
-
|
8869 |
-
module.exports = Transform;
|
8870 |
-
|
8871 |
-
var Duplex = __webpack_require__(493);
|
8872 |
-
|
8873 |
-
/*<replacement>*/
|
8874 |
-
var util = __webpack_require__(491);
|
8875 |
-
util.inherits = __webpack_require__(474);
|
8876 |
-
/*</replacement>*/
|
8877 |
-
|
8878 |
-
util.inherits(Transform, Duplex);
|
8879 |
-
|
8880 |
-
|
8881 |
-
function TransformState(options, stream) {
|
8882 |
-
this.afterTransform = function(er, data) {
|
8883 |
-
return afterTransform(stream, er, data);
|
8884 |
-
};
|
8885 |
-
|
8886 |
-
this.needTransform = false;
|
8887 |
-
this.transforming = false;
|
8888 |
-
this.writecb = null;
|
8889 |
-
this.writechunk = null;
|
8890 |
-
}
|
8891 |
-
|
8892 |
-
function afterTransform(stream, er, data) {
|
8893 |
-
var ts = stream._transformState;
|
8894 |
-
ts.transforming = false;
|
8895 |
-
|
8896 |
-
var cb = ts.writecb;
|
8897 |
-
|
8898 |
-
if (!cb)
|
8899 |
-
return stream.emit('error', new Error('no writecb in Transform class'));
|
8900 |
-
|
8901 |
-
ts.writechunk = null;
|
8902 |
-
ts.writecb = null;
|
8903 |
-
|
8904 |
-
if (!util.isNullOrUndefined(data))
|
8905 |
-
stream.push(data);
|
8906 |
-
|
8907 |
-
if (cb)
|
8908 |
-
cb(er);
|
8909 |
-
|
8910 |
-
var rs = stream._readableState;
|
8911 |
-
rs.reading = false;
|
8912 |
-
if (rs.needReadable || rs.length < rs.highWaterMark) {
|
8913 |
-
stream._read(rs.highWaterMark);
|
8914 |
-
}
|
8915 |
-
}
|
8916 |
-
|
8917 |
-
|
8918 |
-
function Transform(options) {
|
8919 |
-
if (!(this instanceof Transform))
|
8920 |
-
return new Transform(options);
|
8921 |
-
|
8922 |
-
Duplex.call(this, options);
|
8923 |
-
|
8924 |
-
this._transformState = new TransformState(options, this);
|
8925 |
-
|
8926 |
-
// when the writable side finishes, then flush out anything remaining.
|
8927 |
-
var stream = this;
|
8928 |
-
|
8929 |
-
// start out asking for a readable event once data is transformed.
|
8930 |
-
this._readableState.needReadable = true;
|
8931 |
-
|
8932 |
-
// we have implemented the _read method, and done the other things
|
8933 |
-
// that Readable wants before the first _read call, so unset the
|
8934 |
-
// sync guard flag.
|
8935 |
-
this._readableState.sync = false;
|
8936 |
-
|
8937 |
-
this.once('prefinish', function() {
|
8938 |
-
if (util.isFunction(this._flush))
|
8939 |
-
this._flush(function(er) {
|
8940 |
-
done(stream, er);
|
8941 |
-
});
|
8942 |
-
else
|
8943 |
-
done(stream);
|
8944 |
-
});
|
8945 |
-
}
|
8946 |
-
|
8947 |
-
Transform.prototype.push = function(chunk, encoding) {
|
8948 |
-
this._transformState.needTransform = false;
|
8949 |
-
return Duplex.prototype.push.call(this, chunk, encoding);
|
8950 |
-
};
|
8951 |
-
|
8952 |
-
// This is the part where you do stuff!
|
8953 |
-
// override this function in implementation classes.
|
8954 |
-
// 'chunk' is an input chunk.
|
8955 |
-
//
|
8956 |
-
// Call `push(newChunk)` to pass along transformed output
|
8957 |
-
// to the readable side. You may call 'push' zero or more times.
|
8958 |
-
//
|
8959 |
-
// Call `cb(err)` when you are done with this chunk. If you pass
|
8960 |
-
// an error, then that'll put the hurt on the whole operation. If you
|
8961 |
-
// never call cb(), then you'll never get another chunk.
|
8962 |
-
Transform.prototype._transform = function(chunk, encoding, cb) {
|
8963 |
-
throw new Error('not implemented');
|
8964 |
-
};
|
8965 |
-
|
8966 |
-
Transform.prototype._write = function(chunk, encoding, cb) {
|
8967 |
-
var ts = this._transformState;
|
8968 |
-
ts.writecb = cb;
|
8969 |
-
ts.writechunk = chunk;
|
8970 |
-
ts.writeencoding = encoding;
|
8971 |
-
if (!ts.transforming) {
|
8972 |
-
var rs = this._readableState;
|
8973 |
-
if (ts.needTransform ||
|
8974 |
-
rs.needReadable ||
|
8975 |
-
rs.length < rs.highWaterMark)
|
8976 |
-
this._read(rs.highWaterMark);
|
8977 |
-
}
|
8978 |
-
};
|
8979 |
-
|
8980 |
-
// Doesn't matter what the args are here.
|
8981 |
-
// _transform does all the work.
|
8982 |
-
// That we got here means that the readable side wants more data.
|
8983 |
-
Transform.prototype._read = function(n) {
|
8984 |
-
var ts = this._transformState;
|
8985 |
-
|
8986 |
-
if (!util.isNull(ts.writechunk) && ts.writecb && !ts.transforming) {
|
8987 |
-
ts.transforming = true;
|
8988 |
-
this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
|
8989 |
-
} else {
|
8990 |
-
// mark that we need a transform, so that any data that comes in
|
8991 |
-
// will get processed, now that we've asked for it.
|
8992 |
-
ts.needTransform = true;
|
8993 |
-
}
|
8994 |
-
};
|
8995 |
-
|
8996 |
-
|
8997 |
-
function done(stream, er) {
|
8998 |
-
if (er)
|
8999 |
-
return stream.emit('error', er);
|
9000 |
-
|
9001 |
-
// if there's nothing in the write buffer, then that means
|
9002 |
-
// that nothing more will ever be provided
|
9003 |
-
var ws = stream._writableState;
|
9004 |
-
var ts = stream._transformState;
|
9005 |
-
|
9006 |
-
if (ws.length)
|
9007 |
-
throw new Error('calling transform done when ws.length != 0');
|
9008 |
-
|
9009 |
-
if (ts.transforming)
|
9010 |
-
throw new Error('calling transform done when still transforming');
|
9011 |
-
|
9012 |
-
return stream.push(null);
|
9013 |
-
}
|
9014 |
-
|
9015 |
-
|
9016 |
-
/***/ },
|
9017 |
-
|
9018 |
-
/***/ 497:
|
9019 |
-
/***/ function(module, exports, __webpack_require__) {
|
9020 |
-
|
9021 |
-
// Copyright Joyent, Inc. and other Node contributors.
|
9022 |
-
//
|
9023 |
-
// Permission is hereby granted, free of charge, to any person obtaining a
|
9024 |
-
// copy of this software and associated documentation files (the
|
9025 |
-
// "Software"), to deal in the Software without restriction, including
|
9026 |
-
// without limitation the rights to use, copy, modify, merge, publish,
|
9027 |
-
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
9028 |
-
// persons to whom the Software is furnished to do so, subject to the
|
9029 |
-
// following conditions:
|
9030 |
-
//
|
9031 |
-
// The above copyright notice and this permission notice shall be included
|
9032 |
-
// in all copies or substantial portions of the Software.
|
9033 |
-
//
|
9034 |
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
9035 |
-
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
9036 |
-
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
9037 |
-
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
9038 |
-
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
9039 |
-
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
9040 |
-
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
9041 |
-
|
9042 |
-
// a passthrough stream.
|
9043 |
-
// basically just the most minimal sort of Transform stream.
|
9044 |
-
// Every written chunk gets output as-is.
|
9045 |
-
|
9046 |
-
module.exports = PassThrough;
|
9047 |
-
|
9048 |
-
var Transform = __webpack_require__(496);
|
9049 |
-
|
9050 |
-
/*<replacement>*/
|
9051 |
-
var util = __webpack_require__(491);
|
9052 |
-
util.inherits = __webpack_require__(474);
|
9053 |
-
/*</replacement>*/
|
9054 |
-
|
9055 |
-
util.inherits(PassThrough, Transform);
|
9056 |
-
|
9057 |
-
function PassThrough(options) {
|
9058 |
-
if (!(this instanceof PassThrough))
|
9059 |
-
return new PassThrough(options);
|
9060 |
-
|
9061 |
-
Transform.call(this, options);
|
9062 |
-
}
|
9063 |
-
|
9064 |
-
PassThrough.prototype._transform = function(chunk, encoding, cb) {
|
9065 |
-
cb(null, chunk);
|
9066 |
-
};
|
9067 |
-
|
9068 |
-
|
9069 |
-
/***/ },
|
9070 |
-
|
9071 |
-
/***/ 498:
|
9072 |
-
/***/ function(module, exports, __webpack_require__) {
|
9073 |
-
|
9074 |
-
module.exports = __webpack_require__(494)
|
9075 |
-
|
9076 |
-
|
9077 |
-
/***/ },
|
9078 |
-
|
9079 |
-
/***/ 499:
|
9080 |
-
/***/ function(module, exports, __webpack_require__) {
|
9081 |
-
|
9082 |
-
module.exports = __webpack_require__(493)
|
9083 |
-
|
9084 |
-
|
9085 |
-
/***/ },
|
9086 |
-
|
9087 |
-
/***/ 500:
|
9088 |
-
/***/ function(module, exports, __webpack_require__) {
|
9089 |
-
|
9090 |
-
module.exports = __webpack_require__(496)
|
9091 |
-
|
9092 |
-
|
9093 |
-
/***/ },
|
9094 |
-
|
9095 |
-
/***/ 501:
|
9096 |
-
/***/ function(module, exports, __webpack_require__) {
|
9097 |
-
|
9098 |
-
module.exports = __webpack_require__(497)
|
9099 |
-
|
9100 |
-
|
9101 |
-
/***/ },
|
9102 |
-
|
9103 |
-
/***/ 502:
|
9104 |
-
/***/ function(module, exports) {
|
9105 |
-
|
9106 |
-
/* (ignored) */
|
9107 |
-
|
9108 |
-
/***/ },
|
9109 |
-
|
9110 |
-
/***/ 503:
|
9111 |
-
/***/ function(module, exports, __webpack_require__) {
|
9112 |
-
|
9113 |
-
'use strict';
|
9114 |
-
|
9115 |
-
var Buffer = __webpack_require__(504).Buffer;
|
9116 |
-
|
9117 |
-
var isEncoding = Buffer.isEncoding || function (encoding) {
|
9118 |
-
encoding = '' + encoding;
|
9119 |
-
switch (encoding && encoding.toLowerCase()) {
|
9120 |
-
case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw':
|
9121 |
-
return true;
|
9122 |
-
default:
|
9123 |
-
return false;
|
9124 |
-
}
|
9125 |
-
};
|
9126 |
-
|
9127 |
-
function _normalizeEncoding(enc) {
|
9128 |
-
if (!enc) return 'utf8';
|
9129 |
-
var retried;
|
9130 |
-
while (true) {
|
9131 |
-
switch (enc) {
|
9132 |
-
case 'utf8':
|
9133 |
-
case 'utf-8':
|
9134 |
-
return 'utf8';
|
9135 |
-
case 'ucs2':
|
9136 |
-
case 'ucs-2':
|
9137 |
-
case 'utf16le':
|
9138 |
-
case 'utf-16le':
|
9139 |
-
return 'utf16le';
|
9140 |
-
case 'latin1':
|
9141 |
-
case 'binary':
|
9142 |
-
return 'latin1';
|
9143 |
-
case 'base64':
|
9144 |
-
case 'ascii':
|
9145 |
-
case 'hex':
|
9146 |
-
return enc;
|
9147 |
-
default:
|
9148 |
-
if (retried) return; // undefined
|
9149 |
-
enc = ('' + enc).toLowerCase();
|
9150 |
-
retried = true;
|
9151 |
-
}
|
9152 |
-
}
|
9153 |
-
};
|
9154 |
-
|
9155 |
-
// Do not cache `Buffer.isEncoding` when checking encoding names as some
|
9156 |
-
// modules monkey-patch it to support additional encodings
|
9157 |
-
function normalizeEncoding(enc) {
|
9158 |
-
var nenc = _normalizeEncoding(enc);
|
9159 |
-
if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);
|
9160 |
-
return nenc || enc;
|
9161 |
-
}
|
9162 |
-
|
9163 |
-
// StringDecoder provides an interface for efficiently splitting a series of
|
9164 |
-
// buffers into a series of JS strings without breaking apart multi-byte
|
9165 |
-
// characters.
|
9166 |
-
exports.StringDecoder = StringDecoder;
|
9167 |
-
function StringDecoder(encoding) {
|
9168 |
-
this.encoding = normalizeEncoding(encoding);
|
9169 |
-
var nb;
|
9170 |
-
switch (this.encoding) {
|
9171 |
-
case 'utf16le':
|
9172 |
-
this.text = utf16Text;
|
9173 |
-
this.end = utf16End;
|
9174 |
-
nb = 4;
|
9175 |
-
break;
|
9176 |
-
case 'utf8':
|
9177 |
-
this.fillLast = utf8FillLast;
|
9178 |
-
nb = 4;
|
9179 |
-
break;
|
9180 |
-
case 'base64':
|
9181 |
-
this.text = base64Text;
|
9182 |
-
this.end = base64End;
|
9183 |
-
nb = 3;
|
9184 |
-
break;
|
9185 |
-
default:
|
9186 |
-
this.write = simpleWrite;
|
9187 |
-
this.end = simpleEnd;
|
9188 |
-
return;
|
9189 |
-
}
|
9190 |
-
this.lastNeed = 0;
|
9191 |
-
this.lastTotal = 0;
|
9192 |
-
this.lastChar = Buffer.allocUnsafe(nb);
|
9193 |
-
}
|
9194 |
-
|
9195 |
-
StringDecoder.prototype.write = function (buf) {
|
9196 |
-
if (buf.length === 0) return '';
|
9197 |
-
var r;
|
9198 |
-
var i;
|
9199 |
-
if (this.lastNeed) {
|
9200 |
-
r = this.fillLast(buf);
|
9201 |
-
if (r === undefined) return '';
|
9202 |
-
i = this.lastNeed;
|
9203 |
-
this.lastNeed = 0;
|
9204 |
-
} else {
|
9205 |
-
i = 0;
|
9206 |
-
}
|
9207 |
-
if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);
|
9208 |
-
return r || '';
|
9209 |
-
};
|
9210 |
-
|
9211 |
-
StringDecoder.prototype.end = utf8End;
|
9212 |
-
|
9213 |
-
// Returns only complete characters in a Buffer
|
9214 |
-
StringDecoder.prototype.text = utf8Text;
|
9215 |
-
|
9216 |
-
// Attempts to complete a partial non-UTF-8 character using bytes from a Buffer
|
9217 |
-
StringDecoder.prototype.fillLast = function (buf) {
|
9218 |
-
if (this.lastNeed <= buf.length) {
|
9219 |
-
buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);
|
9220 |
-
return this.lastChar.toString(this.encoding, 0, this.lastTotal);
|
9221 |
-
}
|
9222 |
-
buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);
|
9223 |
-
this.lastNeed -= buf.length;
|
9224 |
-
};
|
9225 |
-
|
9226 |
-
// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a
|
9227 |
-
// continuation byte.
|
9228 |
-
function utf8CheckByte(byte) {
|
9229 |
-
if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;
|
9230 |
-
return -1;
|
9231 |
-
}
|
9232 |
-
|
9233 |
-
// Checks at most 3 bytes at the end of a Buffer in order to detect an
|
9234 |
-
// incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4)
|
9235 |
-
// needed to complete the UTF-8 character (if applicable) are returned.
|
9236 |
-
function utf8CheckIncomplete(self, buf, i) {
|
9237 |
-
var j = buf.length - 1;
|
9238 |
-
if (j < i) return 0;
|
9239 |
-
var nb = utf8CheckByte(buf[j]);
|
9240 |
-
if (nb >= 0) {
|
9241 |
-
if (nb > 0) self.lastNeed = nb - 1;
|
9242 |
-
return nb;
|
9243 |
-
}
|
9244 |
-
if (--j < i) return 0;
|
9245 |
-
nb = utf8CheckByte(buf[j]);
|
9246 |
-
if (nb >= 0) {
|
9247 |
-
if (nb > 0) self.lastNeed = nb - 2;
|
9248 |
-
return nb;
|
9249 |
-
}
|
9250 |
-
if (--j < i) return 0;
|
9251 |
-
nb = utf8CheckByte(buf[j]);
|
9252 |
-
if (nb >= 0) {
|
9253 |
-
if (nb > 0) {
|
9254 |
-
if (nb === 2) nb = 0;else self.lastNeed = nb - 3;
|
9255 |
-
}
|
9256 |
-
return nb;
|
9257 |
-
}
|
9258 |
-
return 0;
|
9259 |
-
}
|
9260 |
-
|
9261 |
-
// Validates as many continuation bytes for a multi-byte UTF-8 character as
|
9262 |
-
// needed or are available. If we see a non-continuation byte where we expect
|
9263 |
-
// one, we "replace" the validated continuation bytes we've seen so far with
|
9264 |
-
// UTF-8 replacement characters ('\ufffd'), to match v8's UTF-8 decoding
|
9265 |
-
// behavior. The continuation byte check is included three times in the case
|
9266 |
-
// where all of the continuation bytes for a character exist in the same buffer.
|
9267 |
-
// It is also done this way as a slight performance increase instead of using a
|
9268 |
-
// loop.
|
9269 |
-
function utf8CheckExtraBytes(self, buf, p) {
|
9270 |
-
if ((buf[0] & 0xC0) !== 0x80) {
|
9271 |
-
self.lastNeed = 0;
|
9272 |
-
return '\ufffd'.repeat(p);
|
9273 |
-
}
|
9274 |
-
if (self.lastNeed > 1 && buf.length > 1) {
|
9275 |
-
if ((buf[1] & 0xC0) !== 0x80) {
|
9276 |
-
self.lastNeed = 1;
|
9277 |
-
return '\ufffd'.repeat(p + 1);
|
9278 |
-
}
|
9279 |
-
if (self.lastNeed > 2 && buf.length > 2) {
|
9280 |
-
if ((buf[2] & 0xC0) !== 0x80) {
|
9281 |
-
self.lastNeed = 2;
|
9282 |
-
return '\ufffd'.repeat(p + 2);
|
9283 |
-
}
|
9284 |
-
}
|
9285 |
-
}
|
9286 |
-
}
|
9287 |
-
|
9288 |
-
// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.
|
9289 |
-
function utf8FillLast(buf) {
|
9290 |
-
var p = this.lastTotal - this.lastNeed;
|
9291 |
-
var r = utf8CheckExtraBytes(this, buf, p);
|
9292 |
-
if (r !== undefined) return r;
|
9293 |
-
if (this.lastNeed <= buf.length) {
|
9294 |
-
buf.copy(this.lastChar, p, 0, this.lastNeed);
|
9295 |
-
return this.lastChar.toString(this.encoding, 0, this.lastTotal);
|
9296 |
-
}
|
9297 |
-
buf.copy(this.lastChar, p, 0, buf.length);
|
9298 |
-
this.lastNeed -= buf.length;
|
9299 |
-
}
|
9300 |
-
|
9301 |
-
// Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a
|
9302 |
-
// partial character, the character's bytes are buffered until the required
|
9303 |
-
// number of bytes are available.
|
9304 |
-
function utf8Text(buf, i) {
|
9305 |
-
var total = utf8CheckIncomplete(this, buf, i);
|
9306 |
-
if (!this.lastNeed) return buf.toString('utf8', i);
|
9307 |
-
this.lastTotal = total;
|
9308 |
-
var end = buf.length - (total - this.lastNeed);
|
9309 |
-
buf.copy(this.lastChar, 0, end);
|
9310 |
-
return buf.toString('utf8', i, end);
|
9311 |
-
}
|
9312 |
-
|
9313 |
-
// For UTF-8, a replacement character for each buffered byte of a (partial)
|
9314 |
-
// character needs to be added to the output.
|
9315 |
-
function utf8End(buf) {
|
9316 |
-
var r = buf && buf.length ? this.write(buf) : '';
|
9317 |
-
if (this.lastNeed) return r + '\ufffd'.repeat(this.lastTotal - this.lastNeed);
|
9318 |
-
return r;
|
9319 |
-
}
|
9320 |
-
|
9321 |
-
// UTF-16LE typically needs two bytes per character, but even if we have an even
|
9322 |
-
// number of bytes available, we need to check if we end on a leading/high
|
9323 |
-
// surrogate. In that case, we need to wait for the next two bytes in order to
|
9324 |
-
// decode the last character properly.
|
9325 |
-
function utf16Text(buf, i) {
|
9326 |
-
if ((buf.length - i) % 2 === 0) {
|
9327 |
-
var r = buf.toString('utf16le', i);
|
9328 |
-
if (r) {
|
9329 |
-
var c = r.charCodeAt(r.length - 1);
|
9330 |
-
if (c >= 0xD800 && c <= 0xDBFF) {
|
9331 |
-
this.lastNeed = 2;
|
9332 |
-
this.lastTotal = 4;
|
9333 |
-
this.lastChar[0] = buf[buf.length - 2];
|
9334 |
-
this.lastChar[1] = buf[buf.length - 1];
|
9335 |
-
return r.slice(0, -1);
|
9336 |
-
}
|
9337 |
-
}
|
9338 |
-
return r;
|
9339 |
-
}
|
9340 |
-
this.lastNeed = 1;
|
9341 |
-
this.lastTotal = 2;
|
9342 |
-
this.lastChar[0] = buf[buf.length - 1];
|
9343 |
-
return buf.toString('utf16le', i, buf.length - 1);
|
9344 |
-
}
|
9345 |
-
|
9346 |
-
// For UTF-16LE we do not explicitly append special replacement characters if we
|
9347 |
-
// end on a partial character, we simply let v8 handle that.
|
9348 |
-
function utf16End(buf) {
|
9349 |
-
var r = buf && buf.length ? this.write(buf) : '';
|
9350 |
-
if (this.lastNeed) {
|
9351 |
-
var end = this.lastTotal - this.lastNeed;
|
9352 |
-
return r + this.lastChar.toString('utf16le', 0, end);
|
9353 |
-
}
|
9354 |
-
return r;
|
9355 |
-
}
|
9356 |
-
|
9357 |
-
function base64Text(buf, i) {
|
9358 |
-
var n = (buf.length - i) % 3;
|
9359 |
-
if (n === 0) return buf.toString('base64', i);
|
9360 |
-
this.lastNeed = 3 - n;
|
9361 |
-
this.lastTotal = 3;
|
9362 |
-
if (n === 1) {
|
9363 |
-
this.lastChar[0] = buf[buf.length - 1];
|
9364 |
-
} else {
|
9365 |
-
this.lastChar[0] = buf[buf.length - 2];
|
9366 |
-
this.lastChar[1] = buf[buf.length - 1];
|
9367 |
-
}
|
9368 |
-
return buf.toString('base64', i, buf.length - n);
|
9369 |
-
}
|
9370 |
-
|
9371 |
-
function base64End(buf) {
|
9372 |
-
var r = buf && buf.length ? this.write(buf) : '';
|
9373 |
-
if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed);
|
9374 |
-
return r;
|
9375 |
-
}
|
9376 |
-
|
9377 |
-
// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex)
|
9378 |
-
function simpleWrite(buf) {
|
9379 |
-
return buf.toString(this.encoding);
|
9380 |
-
}
|
9381 |
-
|
9382 |
-
function simpleEnd(buf) {
|
9383 |
-
return buf && buf.length ? this.write(buf) : '';
|
9384 |
-
}
|
9385 |
-
|
9386 |
-
/***/ },
|
9387 |
-
|
9388 |
-
/***/ 504:
|
9389 |
-
/***/ function(module, exports, __webpack_require__) {
|
9390 |
-
|
9391 |
-
/* eslint-disable node/no-deprecated-api */
|
9392 |
-
var buffer = __webpack_require__(487)
|
9393 |
-
var Buffer = buffer.Buffer
|
9394 |
-
|
9395 |
-
// alternative to using Object.keys for old browsers
|
9396 |
-
function copyProps (src, dst) {
|
9397 |
-
for (var key in src) {
|
9398 |
-
dst[key] = src[key]
|
9399 |
-
}
|
9400 |
-
}
|
9401 |
-
if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
|
9402 |
-
module.exports = buffer
|
9403 |
-
} else {
|
9404 |
-
// Copy properties from require('buffer')
|
9405 |
-
copyProps(buffer, exports)
|
9406 |
-
exports.Buffer = SafeBuffer
|
9407 |
-
}
|
9408 |
-
|
9409 |
-
function SafeBuffer (arg, encodingOrOffset, length) {
|
9410 |
-
return Buffer(arg, encodingOrOffset, length)
|
9411 |
-
}
|
9412 |
-
|
9413 |
-
// Copy static methods from Buffer
|
9414 |
-
copyProps(Buffer, SafeBuffer)
|
9415 |
-
|
9416 |
-
SafeBuffer.from = function (arg, encodingOrOffset, length) {
|
9417 |
-
if (typeof arg === 'number') {
|
9418 |
-
throw new TypeError('Argument must not be a number')
|
9419 |
-
}
|
9420 |
-
return Buffer(arg, encodingOrOffset, length)
|
9421 |
-
}
|
9422 |
-
|
9423 |
-
SafeBuffer.alloc = function (size, fill, encoding) {
|
9424 |
-
if (typeof size !== 'number') {
|
9425 |
-
throw new TypeError('Argument must be a number')
|
9426 |
-
}
|
9427 |
-
var buf = Buffer(size)
|
9428 |
-
if (fill !== undefined) {
|
9429 |
-
if (typeof encoding === 'string') {
|
9430 |
-
buf.fill(fill, encoding)
|
9431 |
-
} else {
|
9432 |
-
buf.fill(fill)
|
9433 |
-
}
|
9434 |
-
} else {
|
9435 |
-
buf.fill(0)
|
9436 |
-
}
|
9437 |
-
return buf
|
9438 |
-
}
|
9439 |
-
|
9440 |
-
SafeBuffer.allocUnsafe = function (size) {
|
9441 |
-
if (typeof size !== 'number') {
|
9442 |
-
throw new TypeError('Argument must be a number')
|
9443 |
-
}
|
9444 |
-
return Buffer(size)
|
9445 |
-
}
|
9446 |
-
|
9447 |
-
SafeBuffer.allocUnsafeSlow = function (size) {
|
9448 |
-
if (typeof size !== 'number') {
|
9449 |
-
throw new TypeError('Argument must be a number')
|
9450 |
-
}
|
9451 |
-
return buffer.SlowBuffer(size)
|
9452 |
-
}
|
9453 |
-
|
9454 |
-
|
9455 |
-
/***/ },
|
9456 |
-
|
9457 |
-
/***/ 505:
|
9458 |
-
/***/ function(module, exports, __webpack_require__) {
|
9459 |
-
|
9460 |
-
module.exports = ProxyHandler;
|
9461 |
-
|
9462 |
-
function ProxyHandler(cbs){
|
9463 |
-
this._cbs = cbs || {};
|
9464 |
-
}
|
9465 |
-
|
9466 |
-
var EVENTS = __webpack_require__(466).EVENTS;
|
9467 |
-
Object.keys(EVENTS).forEach(function(name){
|
9468 |
-
if(EVENTS[name] === 0){
|
9469 |
-
name = "on" + name;
|
9470 |
-
ProxyHandler.prototype[name] = function(){
|
9471 |
-
if(this._cbs[name]) this._cbs[name]();
|
9472 |
-
};
|
9473 |
-
} else if(EVENTS[name] === 1){
|
9474 |
-
name = "on" + name;
|
9475 |
-
ProxyHandler.prototype[name] = function(a){
|
9476 |
-
if(this._cbs[name]) this._cbs[name](a);
|
9477 |
-
};
|
9478 |
-
} else if(EVENTS[name] === 2){
|
9479 |
-
name = "on" + name;
|
9480 |
-
ProxyHandler.prototype[name] = function(a, b){
|
9481 |
-
if(this._cbs[name]) this._cbs[name](a, b);
|
9482 |
-
};
|
9483 |
-
} else {
|
9484 |
-
throw Error("wrong number of arguments");
|
9485 |
-
}
|
9486 |
-
});
|
9487 |
-
|
9488 |
-
/***/ },
|
9489 |
-
|
9490 |
-
/***/ 506:
|
9491 |
-
/***/ function(module, exports, __webpack_require__) {
|
9492 |
-
|
9493 |
-
var DomUtils = module.exports;
|
9494 |
-
|
9495 |
-
[
|
9496 |
-
__webpack_require__(507),
|
9497 |
-
__webpack_require__(513),
|
9498 |
-
__webpack_require__(514),
|
9499 |
-
__webpack_require__(515),
|
9500 |
-
__webpack_require__(516),
|
9501 |
-
__webpack_require__(517)
|
9502 |
-
].forEach(function(ext){
|
9503 |
-
Object.keys(ext).forEach(function(key){
|
9504 |
-
DomUtils[key] = ext[key].bind(DomUtils);
|
9505 |
-
});
|
9506 |
-
});
|
9507 |
-
|
9508 |
-
|
9509 |
-
/***/ },
|
9510 |
-
|
9511 |
-
/***/ 507:
|
9512 |
-
/***/ function(module, exports, __webpack_require__) {
|
9513 |
-
|
9514 |
-
var ElementType = __webpack_require__(477),
|
9515 |
-
getOuterHTML = __webpack_require__(508),
|
9516 |
-
isTag = ElementType.isTag;
|
9517 |
-
|
9518 |
-
module.exports = {
|
9519 |
-
getInnerHTML: getInnerHTML,
|
9520 |
-
getOuterHTML: getOuterHTML,
|
9521 |
-
getText: getText
|
9522 |
-
};
|
9523 |
-
|
9524 |
-
function getInnerHTML(elem, opts){
|
9525 |
-
return elem.children ? elem.children.map(function(elem){
|
9526 |
-
return getOuterHTML(elem, opts);
|
9527 |
-
}).join("") : "";
|
9528 |
-
}
|
9529 |
-
|
9530 |
-
function getText(elem){
|
9531 |
-
if(Array.isArray(elem)) return elem.map(getText).join("");
|
9532 |
-
if(isTag(elem)) return elem.name === "br" ? "\n" : getText(elem.children);
|
9533 |
-
if(elem.type === ElementType.CDATA) return getText(elem.children);
|
9534 |
-
if(elem.type === ElementType.Text) return elem.data;
|
9535 |
-
return "";
|
9536 |
-
}
|
9537 |
-
|
9538 |
-
|
9539 |
-
/***/ },
|
9540 |
-
|
9541 |
-
/***/ 1:
|
9542 |
-
/***/ function(module, exports, __webpack_require__) {
|
9543 |
-
|
9544 |
-
'use strict';
|
9545 |
-
|
9546 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
9547 |
-
|
9548 |
-
var _react = __webpack_require__(2);
|
9549 |
-
|
9550 |
-
var _react2 = _interopRequireDefault(_react);
|
9551 |
-
|
9552 |
-
var _reactDom = __webpack_require__(34);
|
9553 |
-
|
9554 |
-
var _reactDom2 = _interopRequireDefault(_reactDom);
|
9555 |
-
|
9556 |
-
var _reactRouter = __webpack_require__(181);
|
9557 |
-
|
9558 |
-
var _history = __webpack_require__(244);
|
9559 |
-
|
9560 |
-
var _subscribersListJsx = __webpack_require__(274);
|
9561 |
-
|
9562 |
-
var _subscribersListJsx2 = _interopRequireDefault(_subscribersListJsx);
|
9563 |
-
|
9564 |
-
var _subscribersFormJsx = __webpack_require__(292);
|
9565 |
-
|
9566 |
-
var _subscribersFormJsx2 = _interopRequireDefault(_subscribersFormJsx);
|
9567 |
-
|
9568 |
-
var history = (0, _reactRouter.useRouterHistory)(_history.createHashHistory)({ queryKey: false });
|
9569 |
-
|
9570 |
-
var App = _react2['default'].createClass({
|
9571 |
-
displayName: 'App',
|
9572 |
-
|
9573 |
-
render: function render() {
|
9574 |
-
return this.props.children;
|
9575 |
-
}
|
9576 |
-
});
|
9577 |
-
|
9578 |
-
var container = document.getElementById('subscribers_container');
|
9579 |
-
|
9580 |
-
if (container) {
|
9581 |
-
_reactDom2['default'].render(_react2['default'].createElement(
|
9582 |
-
_reactRouter.Router,
|
9583 |
-
{ history: history },
|
9584 |
-
_react2['default'].createElement(
|
9585 |
-
_reactRouter.Route,
|
9586 |
-
{ path: '/', component: App },
|
9587 |
-
_react2['default'].createElement(_reactRouter.IndexRoute, { component: _subscribersListJsx2['default'] }),
|
9588 |
-
_react2['default'].createElement(_reactRouter.Route, { path: 'new', component: _subscribersFormJsx2['default'] }),
|
9589 |
-
_react2['default'].createElement(_reactRouter.Route, { path: 'edit/:id', component: _subscribersFormJsx2['default'] }),
|
9590 |
-
_react2['default'].createElement(_reactRouter.Route, { path: '*', component: _subscribersListJsx2['default'] })
|
9591 |
-
)
|
9592 |
-
), container);
|
9593 |
-
}
|
9594 |
-
|
9595 |
-
/***/ },
|
9596 |
-
|
9597 |
-
/***/ 509:
|
9598 |
-
/***/ function(module, exports) {
|
9599 |
-
|
9600 |
-
//Types of elements found in the DOM
|
9601 |
-
module.exports = {
|
9602 |
-
Text: "text", //Text
|
9603 |
-
Directive: "directive", //<? ... ?>
|
9604 |
-
Comment: "comment", //<!-- ... -->
|
9605 |
-
Script: "script", //<script> tags
|
9606 |
-
Style: "style", //<style> tags
|
9607 |
-
Tag: "tag", //Any tag
|
9608 |
-
CDATA: "cdata", //<![CDATA[ ... ]]>
|
9609 |
-
|
9610 |
-
isTag: function(elem){
|
9611 |
-
return elem.type === "tag" || elem.type === "script" || elem.type === "style";
|
9612 |
-
}
|
9613 |
-
};
|
9614 |
-
|
9615 |
-
/***/ },
|
9616 |
-
|
9617 |
-
/***/ 510:
|
9618 |
-
/***/ function(module, exports, __webpack_require__) {
|
9619 |
-
|
9620 |
-
var encode = __webpack_require__(511),
|
9621 |
-
decode = __webpack_require__(512);
|
9622 |
-
|
9623 |
-
exports.decode = function(data, level){
|
9624 |
-
return (!level || level <= 0 ? decode.XML : decode.HTML)(data);
|
9625 |
-
};
|
9626 |
-
|
9627 |
-
exports.decodeStrict = function(data, level){
|
9628 |
-
return (!level || level <= 0 ? decode.XML : decode.HTMLStrict)(data);
|
9629 |
-
};
|
9630 |
-
|
9631 |
-
exports.encode = function(data, level){
|
9632 |
-
return (!level || level <= 0 ? encode.XML : encode.HTML)(data);
|
9633 |
-
};
|
9634 |
-
|
9635 |
-
exports.encodeXML = encode.XML;
|
9636 |
-
|
9637 |
-
exports.encodeHTML4 =
|
9638 |
-
exports.encodeHTML5 =
|
9639 |
-
exports.encodeHTML = encode.HTML;
|
9640 |
-
|
9641 |
-
exports.decodeXML =
|
9642 |
-
exports.decodeXMLStrict = decode.XML;
|
9643 |
-
|
9644 |
-
exports.decodeHTML4 =
|
9645 |
-
exports.decodeHTML5 =
|
9646 |
-
exports.decodeHTML = decode.HTML;
|
9647 |
-
|
9648 |
-
exports.decodeHTML4Strict =
|
9649 |
-
exports.decodeHTML5Strict =
|
9650 |
-
exports.decodeHTMLStrict = decode.HTMLStrict;
|
9651 |
-
|
9652 |
-
exports.escape = encode.escape;
|
9653 |
-
|
9654 |
-
|
9655 |
-
/***/ },
|
9656 |
-
|
9657 |
-
/***/ 511:
|
9658 |
-
/***/ function(module, exports, __webpack_require__) {
|
9659 |
-
|
9660 |
-
var inverseXML = getInverseObj(__webpack_require__(473)),
|
9661 |
-
xmlReplacer = getInverseReplacer(inverseXML);
|
9662 |
-
|
9663 |
-
exports.XML = getInverse(inverseXML, xmlReplacer);
|
9664 |
-
|
9665 |
-
var inverseHTML = getInverseObj(__webpack_require__(471)),
|
9666 |
-
htmlReplacer = getInverseReplacer(inverseHTML);
|
9667 |
-
|
9668 |
-
exports.HTML = getInverse(inverseHTML, htmlReplacer);
|
9669 |
-
|
9670 |
-
function getInverseObj(obj){
|
9671 |
-
return Object.keys(obj).sort().reduce(function(inverse, name){
|
9672 |
-
inverse[obj[name]] = "&" + name + ";";
|
9673 |
-
return inverse;
|
9674 |
-
}, {});
|
9675 |
-
}
|
9676 |
-
|
9677 |
-
function getInverseReplacer(inverse){
|
9678 |
-
var single = [],
|
9679 |
-
multiple = [];
|
9680 |
-
|
9681 |
-
Object.keys(inverse).forEach(function(k){
|
9682 |
-
if(k.length === 1){
|
9683 |
-
single.push("\\" + k);
|
9684 |
-
} else {
|
9685 |
-
multiple.push(k);
|
9686 |
-
}
|
9687 |
-
});
|
9688 |
-
|
9689 |
-
//TODO add ranges
|
9690 |
-
multiple.unshift("[" + single.join("") + "]");
|
9691 |
-
|
9692 |
-
return new RegExp(multiple.join("|"), "g");
|
9693 |
-
}
|
9694 |
-
|
9695 |
-
var re_nonASCII = /[^\0-\x7F]/g,
|
9696 |
-
re_astralSymbols = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
|
9697 |
-
|
9698 |
-
function singleCharReplacer(c){
|
9699 |
-
return "&#x" + c.charCodeAt(0).toString(16).toUpperCase() + ";";
|
9700 |
-
}
|
9701 |
-
|
9702 |
-
function astralReplacer(c){
|
9703 |
-
// http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
|
9704 |
-
var high = c.charCodeAt(0);
|
9705 |
-
var low = c.charCodeAt(1);
|
9706 |
-
var codePoint = (high - 0xD800) * 0x400 + low - 0xDC00 + 0x10000;
|
9707 |
-
return "&#x" + codePoint.toString(16).toUpperCase() + ";";
|
9708 |
-
}
|
9709 |
-
|
9710 |
-
function getInverse(inverse, re){
|
9711 |
-
function func(name){
|
9712 |
-
return inverse[name];
|
9713 |
-
}
|
9714 |
-
|
9715 |
-
return function(data){
|
9716 |
-
return data
|
9717 |
-
.replace(re, func)
|
9718 |
-
.replace(re_astralSymbols, astralReplacer)
|
9719 |
-
.replace(re_nonASCII, singleCharReplacer);
|
9720 |
-
};
|
9721 |
-
}
|
9722 |
-
|
9723 |
-
var re_xmlChars = getInverseReplacer(inverseXML);
|
9724 |
-
|
9725 |
-
function escapeXML(data){
|
9726 |
-
return data
|
9727 |
-
.replace(re_xmlChars, singleCharReplacer)
|
9728 |
-
.replace(re_astralSymbols, astralReplacer)
|
9729 |
-
.replace(re_nonASCII, singleCharReplacer);
|
9730 |
-
}
|
9731 |
-
|
9732 |
-
exports.escape = escapeXML;
|
9733 |
-
|
9734 |
-
|
9735 |
-
/***/ },
|
9736 |
-
|
9737 |
-
/***/ 512:
|
9738 |
-
/***/ function(module, exports, __webpack_require__) {
|
9739 |
-
|
9740 |
-
var entityMap = __webpack_require__(471),
|
9741 |
-
legacyMap = __webpack_require__(472),
|
9742 |
-
xmlMap = __webpack_require__(473),
|
9743 |
-
decodeCodePoint = __webpack_require__(469);
|
9744 |
-
|
9745 |
-
var decodeXMLStrict = getStrictDecoder(xmlMap),
|
9746 |
-
decodeHTMLStrict = getStrictDecoder(entityMap);
|
9747 |
-
|
9748 |
-
function getStrictDecoder(map){
|
9749 |
-
var keys = Object.keys(map).join("|"),
|
9750 |
-
replace = getReplacer(map);
|
9751 |
-
|
9752 |
-
keys += "|#[xX][\\da-fA-F]+|#\\d+";
|
9753 |
-
|
9754 |
-
var re = new RegExp("&(?:" + keys + ");", "g");
|
9755 |
-
|
9756 |
-
return function(str){
|
9757 |
-
return String(str).replace(re, replace);
|
9758 |
-
};
|
9759 |
-
}
|
9760 |
-
|
9761 |
-
var decodeHTML = (function(){
|
9762 |
-
var legacy = Object.keys(legacyMap)
|
9763 |
-
.sort(sorter);
|
9764 |
-
|
9765 |
-
var keys = Object.keys(entityMap)
|
9766 |
-
.sort(sorter);
|
9767 |
-
|
9768 |
-
for(var i = 0, j = 0; i < keys.length; i++){
|
9769 |
-
if(legacy[j] === keys[i]){
|
9770 |
-
keys[i] += ";?";
|
9771 |
-
j++;
|
9772 |
-
} else {
|
9773 |
-
keys[i] += ";";
|
9774 |
-
}
|
9775 |
-
}
|
9776 |
-
|
9777 |
-
var re = new RegExp("&(?:" + keys.join("|") + "|#[xX][\\da-fA-F]+;?|#\\d+;?)", "g"),
|
9778 |
-
replace = getReplacer(entityMap);
|
9779 |
-
|
9780 |
-
function replacer(str){
|
9781 |
-
if(str.substr(-1) !== ";") str += ";";
|
9782 |
-
return replace(str);
|
9783 |
-
}
|
9784 |
-
|
9785 |
-
//TODO consider creating a merged map
|
9786 |
-
return function(str){
|
9787 |
-
return String(str).replace(re, replacer);
|
9788 |
-
};
|
9789 |
-
}());
|
9790 |
-
|
9791 |
-
function sorter(a, b){
|
9792 |
-
return a < b ? 1 : -1;
|
9793 |
-
}
|
9794 |
-
|
9795 |
-
function getReplacer(map){
|
9796 |
-
return function replace(str){
|
9797 |
-
if(str.charAt(1) === "#"){
|
9798 |
-
if(str.charAt(2) === "X" || str.charAt(2) === "x"){
|
9799 |
-
return decodeCodePoint(parseInt(str.substr(3), 16));
|
9800 |
-
}
|
9801 |
-
return decodeCodePoint(parseInt(str.substr(2), 10));
|
9802 |
-
}
|
9803 |
-
return map[str.slice(1, -1)];
|
9804 |
-
};
|
9805 |
-
}
|
9806 |
-
|
9807 |
-
module.exports = {
|
9808 |
-
XML: decodeXMLStrict,
|
9809 |
-
HTML: decodeHTML,
|
9810 |
-
HTMLStrict: decodeHTMLStrict
|
9811 |
-
};
|
9812 |
-
|
9813 |
-
/***/ },
|
9814 |
-
|
9815 |
-
/***/ 513:
|
9816 |
-
/***/ function(module, exports) {
|
9817 |
-
|
9818 |
-
var getChildren = exports.getChildren = function(elem){
|
9819 |
-
return elem.children;
|
9820 |
-
};
|
9821 |
-
|
9822 |
-
var getParent = exports.getParent = function(elem){
|
9823 |
-
return elem.parent;
|
9824 |
-
};
|
9825 |
-
|
9826 |
-
exports.getSiblings = function(elem){
|
9827 |
-
var parent = getParent(elem);
|
9828 |
-
return parent ? getChildren(parent) : [elem];
|
9829 |
-
};
|
9830 |
-
|
9831 |
-
exports.getAttributeValue = function(elem, name){
|
9832 |
-
return elem.attribs && elem.attribs[name];
|
9833 |
-
};
|
9834 |
-
|
9835 |
-
exports.hasAttrib = function(elem, name){
|
9836 |
-
return !!elem.attribs && hasOwnProperty.call(elem.attribs, name);
|
9837 |
-
};
|
9838 |
-
|
9839 |
-
exports.getName = function(elem){
|
9840 |
-
return elem.name;
|
9841 |
-
};
|
9842 |
-
|
9843 |
-
|
9844 |
-
/***/ },
|
9845 |
-
|
9846 |
-
/***/ 514:
|
9847 |
-
/***/ function(module, exports) {
|
9848 |
-
|
9849 |
-
exports.removeElement = function(elem){
|
9850 |
-
if(elem.prev) elem.prev.next = elem.next;
|
9851 |
-
if(elem.next) elem.next.prev = elem.prev;
|
9852 |
-
|
9853 |
-
if(elem.parent){
|
9854 |
-
var childs = elem.parent.children;
|
9855 |
-
childs.splice(childs.lastIndexOf(elem), 1);
|
9856 |
-
}
|
9857 |
-
};
|
9858 |
-
|
9859 |
-
exports.replaceElement = function(elem, replacement){
|
9860 |
-
var prev = replacement.prev = elem.prev;
|
9861 |
-
if(prev){
|
9862 |
-
prev.next = replacement;
|
9863 |
-
}
|
9864 |
-
|
9865 |
-
var next = replacement.next = elem.next;
|
9866 |
-
if(next){
|
9867 |
-
next.prev = replacement;
|
9868 |
-
}
|
9869 |
-
|
9870 |
-
var parent = replacement.parent = elem.parent;
|
9871 |
-
if(parent){
|
9872 |
-
var childs = parent.children;
|
9873 |
-
childs[childs.lastIndexOf(elem)] = replacement;
|
9874 |
-
}
|
9875 |
-
};
|
9876 |
-
|
9877 |
-
exports.appendChild = function(elem, child){
|
9878 |
-
child.parent = elem;
|
9879 |
-
|
9880 |
-
if(elem.children.push(child) !== 1){
|
9881 |
-
var sibling = elem.children[elem.children.length - 2];
|
9882 |
-
sibling.next = child;
|
9883 |
-
child.prev = sibling;
|
9884 |
-
child.next = null;
|
9885 |
-
}
|
9886 |
-
};
|
9887 |
-
|
9888 |
-
exports.append = function(elem, next){
|
9889 |
-
var parent = elem.parent,
|
9890 |
-
currNext = elem.next;
|
9891 |
-
|
9892 |
-
next.next = currNext;
|
9893 |
-
next.prev = elem;
|
9894 |
-
elem.next = next;
|
9895 |
-
next.parent = parent;
|
9896 |
-
|
9897 |
-
if(currNext){
|
9898 |
-
currNext.prev = next;
|
9899 |
-
if(parent){
|
9900 |
-
var childs = parent.children;
|
9901 |
-
childs.splice(childs.lastIndexOf(currNext), 0, next);
|
9902 |
-
}
|
9903 |
-
} else if(parent){
|
9904 |
-
parent.children.push(next);
|
9905 |
-
}
|
9906 |
-
};
|
9907 |
-
|
9908 |
-
exports.prepend = function(elem, prev){
|
9909 |
-
var parent = elem.parent;
|
9910 |
-
if(parent){
|
9911 |
-
var childs = parent.children;
|
9912 |
-
childs.splice(childs.lastIndexOf(elem), 0, prev);
|
9913 |
-
}
|
9914 |
-
|
9915 |
-
if(elem.prev){
|
9916 |
-
elem.prev.next = prev;
|
9917 |
-
}
|
9918 |
-
|
9919 |
-
prev.parent = parent;
|
9920 |
-
prev.prev = elem.prev;
|
9921 |
-
prev.next = elem;
|
9922 |
-
elem.prev = prev;
|
9923 |
-
};
|
9924 |
-
|
9925 |
-
|
9926 |
-
|
9927 |
-
|
9928 |
-
/***/ },
|
9929 |
-
|
9930 |
-
/***/ 515:
|
9931 |
-
/***/ function(module, exports, __webpack_require__) {
|
9932 |
-
|
9933 |
-
var isTag = __webpack_require__(477).isTag;
|
9934 |
-
|
9935 |
-
module.exports = {
|
9936 |
-
filter: filter,
|
9937 |
-
find: find,
|
9938 |
-
findOneChild: findOneChild,
|
9939 |
-
findOne: findOne,
|
9940 |
-
existsOne: existsOne,
|
9941 |
-
findAll: findAll
|
9942 |
-
};
|
9943 |
-
|
9944 |
-
function filter(test, element, recurse, limit){
|
9945 |
-
if(!Array.isArray(element)) element = [element];
|
9946 |
-
|
9947 |
-
if(typeof limit !== "number" || !isFinite(limit)){
|
9948 |
-
limit = Infinity;
|
9949 |
-
}
|
9950 |
-
return find(test, element, recurse !== false, limit);
|
9951 |
-
}
|
9952 |
-
|
9953 |
-
function find(test, elems, recurse, limit){
|
9954 |
-
var result = [], childs;
|
9955 |
-
|
9956 |
-
for(var i = 0, j = elems.length; i < j; i++){
|
9957 |
-
if(test(elems[i])){
|
9958 |
-
result.push(elems[i]);
|
9959 |
-
if(--limit <= 0) break;
|
9960 |
-
}
|
9961 |
-
|
9962 |
-
childs = elems[i].children;
|
9963 |
-
if(recurse && childs && childs.length > 0){
|
9964 |
-
childs = find(test, childs, recurse, limit);
|
9965 |
-
result = result.concat(childs);
|
9966 |
-
limit -= childs.length;
|
9967 |
-
if(limit <= 0) break;
|
9968 |
-
}
|
9969 |
-
}
|
9970 |
-
|
9971 |
-
return result;
|
9972 |
-
}
|
9973 |
-
|
9974 |
-
function findOneChild(test, elems){
|
9975 |
-
for(var i = 0, l = elems.length; i < l; i++){
|
9976 |
-
if(test(elems[i])) return elems[i];
|
9977 |
-
}
|
9978 |
-
|
9979 |
-
return null;
|
9980 |
-
}
|
9981 |
-
|
9982 |
-
function findOne(test, elems){
|
9983 |
-
var elem = null;
|
9984 |
-
|
9985 |
-
for(var i = 0, l = elems.length; i < l && !elem; i++){
|
9986 |
-
if(!isTag(elems[i])){
|
9987 |
-
continue;
|
9988 |
-
} else if(test(elems[i])){
|
9989 |
-
elem = elems[i];
|
9990 |
-
} else if(elems[i].children.length > 0){
|
9991 |
-
elem = findOne(test, elems[i].children);
|
9992 |
-
}
|
9993 |
-
}
|
9994 |
-
|
9995 |
-
return elem;
|
9996 |
-
}
|
9997 |
-
|
9998 |
-
function existsOne(test, elems){
|
9999 |
-
for(var i = 0, l = elems.length; i < l; i++){
|
10000 |
-
if(
|
10001 |
-
isTag(elems[i]) && (
|
10002 |
-
test(elems[i]) || (
|
10003 |
-
elems[i].children.length > 0 &&
|
10004 |
-
existsOne(test, elems[i].children)
|
10005 |
-
)
|
10006 |
-
)
|
10007 |
-
){
|
10008 |
-
return true;
|
10009 |
-
}
|
10010 |
-
}
|
10011 |
-
|
10012 |
-
return false;
|
10013 |
-
}
|
10014 |
-
|
10015 |
-
function findAll(test, rootElems){
|
10016 |
-
var result = [];
|
10017 |
-
var stack = [rootElems];
|
10018 |
-
while(stack.length){
|
10019 |
-
var elems = stack.pop();
|
10020 |
-
for(var i = 0, j = elems.length; i < j; i++){
|
10021 |
-
if(!isTag(elems[i])) continue;
|
10022 |
-
if(test(elems[i])) result.push(elems[i]);
|
10023 |
-
}
|
10024 |
-
while(j-- > 0){
|
10025 |
-
if(elems[j].children && elems[j].children.length > 0){
|
10026 |
-
stack.push(elems[j].children);
|
10027 |
-
}
|
10028 |
-
}
|
10029 |
-
}
|
10030 |
-
return result;
|
10031 |
-
}
|
10032 |
-
|
10033 |
-
|
10034 |
-
/***/ },
|
10035 |
-
|
10036 |
-
/***/ 516:
|
10037 |
-
/***/ function(module, exports, __webpack_require__) {
|
10038 |
-
|
10039 |
-
var ElementType = __webpack_require__(477);
|
10040 |
-
var isTag = exports.isTag = ElementType.isTag;
|
10041 |
-
|
10042 |
-
exports.testElement = function(options, element){
|
10043 |
-
for(var key in options){
|
10044 |
-
if(!options.hasOwnProperty(key));
|
10045 |
-
else if(key === "tag_name"){
|
10046 |
-
if(!isTag(element) || !options.tag_name(element.name)){
|
10047 |
-
return false;
|
10048 |
-
}
|
10049 |
-
} else if(key === "tag_type"){
|
10050 |
-
if(!options.tag_type(element.type)) return false;
|
10051 |
-
} else if(key === "tag_contains"){
|
10052 |
-
if(isTag(element) || !options.tag_contains(element.data)){
|
10053 |
-
return false;
|
10054 |
-
}
|
10055 |
-
} else if(!element.attribs || !options[key](element.attribs[key])){
|
10056 |
-
return false;
|
10057 |
-
}
|
10058 |
-
}
|
10059 |
-
return true;
|
10060 |
-
};
|
10061 |
-
|
10062 |
-
var Checks = {
|
10063 |
-
tag_name: function(name){
|
10064 |
-
if(typeof name === "function"){
|
10065 |
-
return function(elem){ return isTag(elem) && name(elem.name); };
|
10066 |
-
} else if(name === "*"){
|
10067 |
-
return isTag;
|
10068 |
-
} else {
|
10069 |
-
return function(elem){ return isTag(elem) && elem.name === name; };
|
10070 |
-
}
|
10071 |
-
},
|
10072 |
-
tag_type: function(type){
|
10073 |
-
if(typeof type === "function"){
|
10074 |
-
return function(elem){ return type(elem.type); };
|
10075 |
-
} else {
|
10076 |
-
return function(elem){ return elem.type === type; };
|
10077 |
-
}
|
10078 |
-
},
|
10079 |
-
tag_contains: function(data){
|
10080 |
-
if(typeof data === "function"){
|
10081 |
-
return function(elem){ return !isTag(elem) && data(elem.data); };
|
10082 |
-
} else {
|
10083 |
-
return function(elem){ return !isTag(elem) && elem.data === data; };
|
10084 |
-
}
|
10085 |
-
}
|
10086 |
-
};
|
10087 |
-
|
10088 |
-
function getAttribCheck(attrib, value){
|
10089 |
-
if(typeof value === "function"){
|
10090 |
-
return function(elem){ return elem.attribs && value(elem.attribs[attrib]); };
|
10091 |
-
} else {
|
10092 |
-
return function(elem){ return elem.attribs && elem.attribs[attrib] === value; };
|
10093 |
-
}
|
10094 |
-
}
|
10095 |
-
|
10096 |
-
function combineFuncs(a, b){
|
10097 |
-
return function(elem){
|
10098 |
-
return a(elem) || b(elem);
|
10099 |
-
};
|
10100 |
-
}
|
10101 |
-
|
10102 |
-
exports.getElements = function(options, element, recurse, limit){
|
10103 |
-
var funcs = Object.keys(options).map(function(key){
|
10104 |
-
var value = options[key];
|
10105 |
-
return key in Checks ? Checks[key](value) : getAttribCheck(key, value);
|
10106 |
-
});
|
10107 |
-
|
10108 |
-
return funcs.length === 0 ? [] : this.filter(
|
10109 |
-
funcs.reduce(combineFuncs),
|
10110 |
-
element, recurse, limit
|
10111 |
-
);
|
10112 |
-
};
|
10113 |
-
|
10114 |
-
exports.getElementById = function(id, element, recurse){
|
10115 |
-
if(!Array.isArray(element)) element = [element];
|
10116 |
-
return this.findOne(getAttribCheck("id", id), element, recurse !== false);
|
10117 |
-
};
|
10118 |
-
|
10119 |
-
exports.getElementsByTagName = function(name, element, recurse, limit){
|
10120 |
-
return this.filter(Checks.tag_name(name), element, recurse, limit);
|
10121 |
-
};
|
10122 |
-
|
10123 |
-
exports.getElementsByTagType = function(type, element, recurse, limit){
|
10124 |
-
return this.filter(Checks.tag_type(type), element, recurse, limit);
|
10125 |
-
};
|
10126 |
-
|
10127 |
-
|
10128 |
-
/***/ },
|
10129 |
-
|
10130 |
-
/***/ 517:
|
10131 |
-
/***/ function(module, exports) {
|
10132 |
-
|
10133 |
-
// removeSubsets
|
10134 |
-
// Given an array of nodes, remove any member that is contained by another.
|
10135 |
-
exports.removeSubsets = function(nodes) {
|
10136 |
-
var idx = nodes.length, node, ancestor, replace;
|
10137 |
-
|
10138 |
-
// Check if each node (or one of its ancestors) is already contained in the
|
10139 |
-
// array.
|
10140 |
-
while (--idx > -1) {
|
10141 |
-
node = ancestor = nodes[idx];
|
10142 |
-
|
10143 |
-
// Temporarily remove the node under consideration
|
10144 |
-
nodes[idx] = null;
|
10145 |
-
replace = true;
|
10146 |
-
|
10147 |
-
while (ancestor) {
|
10148 |
-
if (nodes.indexOf(ancestor) > -1) {
|
10149 |
-
replace = false;
|
10150 |
-
nodes.splice(idx, 1);
|
10151 |
-
break;
|
10152 |
-
}
|
10153 |
-
ancestor = ancestor.parent;
|
10154 |
-
}
|
10155 |
-
|
10156 |
-
// If the node has been found to be unique, re-insert it.
|
10157 |
-
if (replace) {
|
10158 |
-
nodes[idx] = node;
|
10159 |
-
}
|
10160 |
-
}
|
10161 |
-
|
10162 |
-
return nodes;
|
10163 |
-
};
|
10164 |
-
|
10165 |
-
// Source: http://dom.spec.whatwg.org/#dom-node-comparedocumentposition
|
10166 |
-
var POSITION = {
|
10167 |
-
DISCONNECTED: 1,
|
10168 |
-
PRECEDING: 2,
|
10169 |
-
FOLLOWING: 4,
|
10170 |
-
CONTAINS: 8,
|
10171 |
-
CONTAINED_BY: 16
|
10172 |
-
};
|
10173 |
-
|
10174 |
-
// Compare the position of one node against another node in any other document.
|
10175 |
-
// The return value is a bitmask with the following values:
|
10176 |
-
//
|
10177 |
-
// document order:
|
10178 |
-
// > There is an ordering, document order, defined on all the nodes in the
|
10179 |
-
// > document corresponding to the order in which the first character of the
|
10180 |
-
// > XML representation of each node occurs in the XML representation of the
|
10181 |
-
// > document after expansion of general entities. Thus, the document element
|
10182 |
-
// > node will be the first node. Element nodes occur before their children.
|
10183 |
-
// > Thus, document order orders element nodes in order of the occurrence of
|
10184 |
-
// > their start-tag in the XML (after expansion of entities). The attribute
|
10185 |
-
// > nodes of an element occur after the element and before its children. The
|
10186 |
-
// > relative order of attribute nodes is implementation-dependent./
|
10187 |
-
// Source:
|
10188 |
-
// http://www.w3.org/TR/DOM-Level-3-Core/glossary.html#dt-document-order
|
10189 |
-
//
|
10190 |
-
// @argument {Node} nodaA The first node to use in the comparison
|
10191 |
-
// @argument {Node} nodeB The second node to use in the comparison
|
10192 |
-
//
|
10193 |
-
// @return {Number} A bitmask describing the input nodes' relative position.
|
10194 |
-
// See http://dom.spec.whatwg.org/#dom-node-comparedocumentposition for
|
10195 |
-
// a description of these values.
|
10196 |
-
var comparePos = exports.compareDocumentPosition = function(nodeA, nodeB) {
|
10197 |
-
var aParents = [];
|
10198 |
-
var bParents = [];
|
10199 |
-
var current, sharedParent, siblings, aSibling, bSibling, idx;
|
10200 |
-
|
10201 |
-
if (nodeA === nodeB) {
|
10202 |
-
return 0;
|
10203 |
-
}
|
10204 |
-
|
10205 |
-
current = nodeA;
|
10206 |
-
while (current) {
|
10207 |
-
aParents.unshift(current);
|
10208 |
-
current = current.parent;
|
10209 |
-
}
|
10210 |
-
current = nodeB;
|
10211 |
-
while (current) {
|
10212 |
-
bParents.unshift(current);
|
10213 |
-
current = current.parent;
|
10214 |
-
}
|
10215 |
-
|
10216 |
-
idx = 0;
|
10217 |
-
while (aParents[idx] === bParents[idx]) {
|
10218 |
-
idx++;
|
10219 |
-
}
|
10220 |
-
|
10221 |
-
if (idx === 0) {
|
10222 |
-
return POSITION.DISCONNECTED;
|
10223 |
-
}
|
10224 |
-
|
10225 |
-
sharedParent = aParents[idx - 1];
|
10226 |
-
siblings = sharedParent.children;
|
10227 |
-
aSibling = aParents[idx];
|
10228 |
-
bSibling = bParents[idx];
|
10229 |
-
|
10230 |
-
if (siblings.indexOf(aSibling) > siblings.indexOf(bSibling)) {
|
10231 |
-
if (sharedParent === nodeB) {
|
10232 |
-
return POSITION.FOLLOWING | POSITION.CONTAINED_BY;
|
10233 |
-
}
|
10234 |
-
return POSITION.FOLLOWING;
|
10235 |
-
} else {
|
10236 |
-
if (sharedParent === nodeA) {
|
10237 |
-
return POSITION.PRECEDING | POSITION.CONTAINS;
|
10238 |
-
}
|
10239 |
-
return POSITION.PRECEDING;
|
10240 |
-
}
|
10241 |
-
};
|
10242 |
-
|
10243 |
-
// Sort an array of nodes based on their relative position in the document and
|
10244 |
-
// remove any duplicate nodes. If the array contains nodes that do not belong
|
10245 |
-
// to the same document, sort order is unspecified.
|
10246 |
-
//
|
10247 |
-
// @argument {Array} nodes Array of DOM nodes
|
10248 |
-
//
|
10249 |
-
// @returns {Array} collection of unique nodes, sorted in document order
|
10250 |
-
exports.uniqueSort = function(nodes) {
|
10251 |
-
var idx = nodes.length, node, position;
|
10252 |
-
|
10253 |
-
nodes = nodes.slice();
|
10254 |
-
|
10255 |
-
while (--idx > -1) {
|
10256 |
-
node = nodes[idx];
|
10257 |
-
position = nodes.indexOf(node);
|
10258 |
-
if (position > -1 && position < idx) {
|
10259 |
-
nodes.splice(idx, 1);
|
10260 |
-
}
|
10261 |
-
}
|
10262 |
-
nodes.sort(function(a, b) {
|
10263 |
-
var relative = comparePos(a, b);
|
10264 |
-
if (relative & POSITION.PRECEDING) {
|
10265 |
-
return -1;
|
10266 |
-
} else if (relative & POSITION.FOLLOWING) {
|
10267 |
-
return 1;
|
10268 |
-
}
|
10269 |
-
return 0;
|
10270 |
-
});
|
10271 |
-
|
10272 |
-
return nodes;
|
10273 |
-
};
|
10274 |
-
|
10275 |
-
|
10276 |
-
/***/ },
|
10277 |
-
|
10278 |
-
/***/ 518:
|
10279 |
-
/***/ function(module, exports, __webpack_require__) {
|
10280 |
-
|
10281 |
-
module.exports = CollectingHandler;
|
10282 |
-
|
10283 |
-
function CollectingHandler(cbs){
|
10284 |
-
this._cbs = cbs || {};
|
10285 |
-
this.events = [];
|
10286 |
-
}
|
10287 |
-
|
10288 |
-
var EVENTS = __webpack_require__(466).EVENTS;
|
10289 |
-
Object.keys(EVENTS).forEach(function(name){
|
10290 |
-
if(EVENTS[name] === 0){
|
10291 |
-
name = "on" + name;
|
10292 |
-
CollectingHandler.prototype[name] = function(){
|
10293 |
-
this.events.push([name]);
|
10294 |
-
if(this._cbs[name]) this._cbs[name]();
|
10295 |
-
};
|
10296 |
-
} else if(EVENTS[name] === 1){
|
10297 |
-
name = "on" + name;
|
10298 |
-
CollectingHandler.prototype[name] = function(a){
|
10299 |
-
this.events.push([name, a]);
|
10300 |
-
if(this._cbs[name]) this._cbs[name](a);
|
10301 |
-
};
|
10302 |
-
} else if(EVENTS[name] === 2){
|
10303 |
-
name = "on" + name;
|
10304 |
-
CollectingHandler.prototype[name] = function(a, b){
|
10305 |
-
this.events.push([name, a, b]);
|
10306 |
-
if(this._cbs[name]) this._cbs[name](a, b);
|
10307 |
-
};
|
10308 |
-
} else {
|
10309 |
-
throw Error("wrong number of arguments");
|
10310 |
-
}
|
10311 |
-
});
|
10312 |
-
|
10313 |
-
CollectingHandler.prototype.onreset = function(){
|
10314 |
-
this.events = [];
|
10315 |
-
if(this._cbs.onreset) this._cbs.onreset();
|
10316 |
-
};
|
10317 |
-
|
10318 |
-
CollectingHandler.prototype.restart = function(){
|
10319 |
-
if(this._cbs.onreset) this._cbs.onreset();
|
10320 |
-
|
10321 |
-
for(var i = 0, len = this.events.length; i < len; i++){
|
10322 |
-
if(this._cbs[this.events[i][0]]){
|
10323 |
-
|
10324 |
-
var num = this.events[i].length;
|
10325 |
-
|
10326 |
-
if(num === 1){
|
10327 |
-
this._cbs[this.events[i][0]]();
|
10328 |
-
} else if(num === 2){
|
10329 |
-
this._cbs[this.events[i][0]](this.events[i][1]);
|
10330 |
-
} else {
|
10331 |
-
this._cbs[this.events[i][0]](this.events[i][1], this.events[i][2]);
|
10332 |
-
}
|
10333 |
-
}
|
10334 |
-
}
|
10335 |
-
};
|
10336 |
-
|
10337 |
-
|
10338 |
-
/***/ },
|
10339 |
-
|
10340 |
-
/***/ 519:
|
10341 |
-
/***/ function(module, exports, __webpack_require__) {
|
10342 |
-
|
10343 |
-
'use strict';
|
10344 |
-
|
10345 |
-
Object.defineProperty(exports, "__esModule", {
|
10346 |
-
value: true
|
10347 |
-
});
|
10348 |
-
exports.default = ProcessNodes;
|
10349 |
-
|
10350 |
-
var _elementTypes = __webpack_require__(520);
|
10351 |
-
|
10352 |
-
var _elementTypes2 = _interopRequireDefault(_elementTypes);
|
10353 |
-
|
10354 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
10355 |
-
|
10356 |
-
/**
|
10357 |
-
* Tests a htmlparser2 node and returns whether is it a text node at the start and end of the line containing only
|
10358 |
-
* white space. This allows these node types to be excluded from the rendering because they are unnecessary.
|
10359 |
-
*
|
10360 |
-
* @param {Object} node The element object as created by htmlparser2
|
10361 |
-
* @returns {boolean} Whether
|
10362 |
-
*/
|
10363 |
-
var filterOutEmptyTextNodes = function filterOutEmptyTextNodes(node) {
|
10364 |
-
return !(node.type === 'text' && /\r?\n/.test(node.data) && node.data.trim() === '');
|
10365 |
-
};
|
10366 |
-
|
10367 |
-
/**
|
10368 |
-
* Converts a htmlparser2 node to a React element
|
10369 |
-
*
|
10370 |
-
* @param {Object} node The htmlparser2 node to convert
|
10371 |
-
* @param {Number} index The index of the current node
|
10372 |
-
* @returns {React.Element}
|
10373 |
-
*/
|
10374 |
-
var convertNodeToElement = function convertNodeToElement(node, index) {
|
10375 |
-
var key = 'rhp-' + index;
|
10376 |
-
return _elementTypes2.default[node.type](node, key);
|
10377 |
-
};
|
10378 |
-
|
10379 |
-
/**
|
10380 |
-
* Processes the nodes generated by htmlparser2 and convert them all into React elements
|
10381 |
-
*
|
10382 |
-
* @param {Object[]} nodes List of nodes to process
|
10383 |
-
* @returns {React.Element[]} The list of processed React elements
|
10384 |
-
*/
|
10385 |
-
function ProcessNodes(nodes) {
|
10386 |
-
|
10387 |
-
return nodes.filter(filterOutEmptyTextNodes).map(function (node, index) {
|
10388 |
-
return convertNodeToElement(node, index);
|
10389 |
-
});
|
10390 |
-
}
|
10391 |
-
|
10392 |
-
/***/ },
|
10393 |
-
|
10394 |
-
/***/ 520:
|
10395 |
-
/***/ function(module, exports, __webpack_require__) {
|
10396 |
-
|
10397 |
-
'use strict';
|
10398 |
-
|
10399 |
-
Object.defineProperty(exports, "__esModule", {
|
10400 |
-
value: true
|
10401 |
-
});
|
10402 |
-
|
10403 |
-
var _ElementType$Text$Ele;
|
10404 |
-
|
10405 |
-
var _htmlparser = __webpack_require__(466);
|
10406 |
-
|
10407 |
-
var _TextElementType = __webpack_require__(521);
|
10408 |
-
|
10409 |
-
var _TextElementType2 = _interopRequireDefault(_TextElementType);
|
10410 |
-
|
10411 |
-
var _TagElementType = __webpack_require__(522);
|
10412 |
-
|
10413 |
-
var _TagElementType2 = _interopRequireDefault(_TagElementType);
|
10414 |
-
|
10415 |
-
var _StyleElementType = __webpack_require__(530);
|
10416 |
-
|
10417 |
-
var _StyleElementType2 = _interopRequireDefault(_StyleElementType);
|
10418 |
-
|
10419 |
-
var _UnsupportedElementType = __webpack_require__(531);
|
10420 |
-
|
10421 |
-
var _UnsupportedElementType2 = _interopRequireDefault(_UnsupportedElementType);
|
10422 |
-
|
10423 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
10424 |
-
|
10425 |
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } /*
|
10426 |
-
* Map each htmlparser2 element type to a function which will convert that element type to a React element
|
10427 |
-
* Not all of the element types are supported so the UnsupportedElementType is used for them which will not return any
|
10428 |
-
* value
|
10429 |
-
*/
|
10430 |
-
|
10431 |
-
exports.default = (_ElementType$Text$Ele = {}, _defineProperty(_ElementType$Text$Ele, _htmlparser.ElementType.Text, _TextElementType2.default), _defineProperty(_ElementType$Text$Ele, _htmlparser.ElementType.Tag, _TagElementType2.default), _defineProperty(_ElementType$Text$Ele, _htmlparser.ElementType.Style, _StyleElementType2.default), _defineProperty(_ElementType$Text$Ele, _htmlparser.ElementType.Directive, _UnsupportedElementType2.default), _defineProperty(_ElementType$Text$Ele, _htmlparser.ElementType.Comment, _UnsupportedElementType2.default), _defineProperty(_ElementType$Text$Ele, _htmlparser.ElementType.Script, _UnsupportedElementType2.default), _defineProperty(_ElementType$Text$Ele, _htmlparser.ElementType.CDATA, _UnsupportedElementType2.default), _defineProperty(_ElementType$Text$Ele, _htmlparser.ElementType.Doctype, _UnsupportedElementType2.default), _ElementType$Text$Ele);
|
10432 |
-
|
10433 |
-
/***/ },
|
10434 |
-
|
10435 |
-
/***/ 521:
|
10436 |
-
/***/ function(module, exports) {
|
10437 |
-
|
10438 |
-
"use strict";
|
10439 |
-
|
10440 |
-
Object.defineProperty(exports, "__esModule", {
|
10441 |
-
value: true
|
10442 |
-
});
|
10443 |
-
exports.default = TextElementType;
|
10444 |
-
/**
|
10445 |
-
* Converts a text node to a React text element
|
10446 |
-
*
|
10447 |
-
* @param {Object} node The text node
|
10448 |
-
* @returns {String} The text
|
10449 |
-
*/
|
10450 |
-
function TextElementType(node) {
|
10451 |
-
|
10452 |
-
// React will accept plain text for rendering so just return the node data
|
10453 |
-
return node.data;
|
10454 |
-
}
|
10455 |
-
|
10456 |
-
/***/ },
|
10457 |
-
|
10458 |
-
/***/ 522:
|
10459 |
-
/***/ function(module, exports, __webpack_require__) {
|
10460 |
-
|
10461 |
-
'use strict';
|
10462 |
-
|
10463 |
-
Object.defineProperty(exports, "__esModule", {
|
10464 |
-
value: true
|
10465 |
-
});
|
10466 |
-
exports.default = TagElementType;
|
10467 |
-
|
10468 |
-
var _react = __webpack_require__(2);
|
10469 |
-
|
10470 |
-
var _react2 = _interopRequireDefault(_react);
|
10471 |
-
|
10472 |
-
var _ProcessNodes = __webpack_require__(519);
|
10473 |
-
|
10474 |
-
var _ProcessNodes2 = _interopRequireDefault(_ProcessNodes);
|
10475 |
-
|
10476 |
-
var _GeneratePropsFromAttributes = __webpack_require__(523);
|
10477 |
-
|
10478 |
-
var _GeneratePropsFromAttributes2 = _interopRequireDefault(_GeneratePropsFromAttributes);
|
10479 |
-
|
10480 |
-
var _TransformTagName = __webpack_require__(528);
|
10481 |
-
|
10482 |
-
var _TransformTagName2 = _interopRequireDefault(_TransformTagName);
|
10483 |
-
|
10484 |
-
var _VoidElements = __webpack_require__(529);
|
10485 |
-
|
10486 |
-
var _VoidElements2 = _interopRequireDefault(_VoidElements);
|
10487 |
-
|
10488 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
10489 |
-
|
10490 |
-
/**
|
10491 |
-
* Converts any element (excluding style - see StyleElementType - and script) to a react element.
|
10492 |
-
*
|
10493 |
-
* @param {Object} node The tag node
|
10494 |
-
* @param {String} key The key to give the React element
|
10495 |
-
* @returns {React.Element} The React tag element
|
10496 |
-
*/
|
10497 |
-
function TagElementType(node, key) {
|
10498 |
-
|
10499 |
-
// generate props
|
10500 |
-
var props = (0, _GeneratePropsFromAttributes2.default)(node.attribs, key);
|
10501 |
-
|
10502 |
-
// transform the tag name if needed
|
10503 |
-
var tagName = (0, _TransformTagName2.default)(node.name);
|
10504 |
-
|
10505 |
-
// If the node is not a void element and has children then process them
|
10506 |
-
var children = null;
|
10507 |
-
if (_VoidElements2.default.indexOf(tagName) === -1) {
|
10508 |
-
children = (0, _ProcessNodes2.default)(node.children);
|
10509 |
-
}
|
10510 |
-
|
10511 |
-
// create and return the element
|
10512 |
-
return _react2.default.createElement(tagName, props, children);
|
10513 |
-
}
|
10514 |
-
|
10515 |
-
/***/ },
|
10516 |
-
|
10517 |
-
/***/ 523:
|
10518 |
-
/***/ function(module, exports, __webpack_require__) {
|
10519 |
-
|
10520 |
-
'use strict';
|
10521 |
-
|
10522 |
-
Object.defineProperty(exports, "__esModule", {
|
10523 |
-
value: true
|
10524 |
-
});
|
10525 |
-
|
10526 |
-
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
10527 |
-
|
10528 |
-
exports.default = GeneratePropsFromAttributes;
|
10529 |
-
|
10530 |
-
var _HtmlAttributesToReact = __webpack_require__(524);
|
10531 |
-
|
10532 |
-
var _HtmlAttributesToReact2 = _interopRequireDefault(_HtmlAttributesToReact);
|
10533 |
-
|
10534 |
-
var _InlineStyleToObject = __webpack_require__(527);
|
10535 |
-
|
10536 |
-
var _InlineStyleToObject2 = _interopRequireDefault(_InlineStyleToObject);
|
10537 |
-
|
10538 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
10539 |
-
|
10540 |
-
/**
|
10541 |
-
* Generates props for a React element from an object of HTML attributes
|
10542 |
-
*
|
10543 |
-
* @param {Object} attributes The HTML attributes
|
10544 |
-
* @param {String} key The key to give the react element
|
10545 |
-
*/
|
10546 |
-
function GeneratePropsFromAttributes(attributes, key) {
|
10547 |
-
|
10548 |
-
// generate props
|
10549 |
-
var props = _extends({}, (0, _HtmlAttributesToReact2.default)(attributes), { key: key });
|
10550 |
-
|
10551 |
-
// if there is a style prop then convert it to a React style object
|
10552 |
-
if (props.style) {
|
10553 |
-
props.style = (0, _InlineStyleToObject2.default)(props.style);
|
10554 |
-
}
|
10555 |
-
|
10556 |
-
return props;
|
10557 |
-
}
|
10558 |
-
|
10559 |
-
/***/ },
|
10560 |
-
|
10561 |
-
/***/ 524:
|
10562 |
-
/***/ function(module, exports, __webpack_require__) {
|
10563 |
-
|
10564 |
-
'use strict';
|
10565 |
-
|
10566 |
-
Object.defineProperty(exports, "__esModule", {
|
10567 |
-
value: true
|
10568 |
-
});
|
10569 |
-
exports.default = HtmlAttributesToReact;
|
10570 |
-
|
10571 |
-
var _BooleanAttributes = __webpack_require__(525);
|
10572 |
-
|
10573 |
-
var _BooleanAttributes2 = _interopRequireDefault(_BooleanAttributes);
|
10574 |
-
|
10575 |
-
var _ReactAttributes = __webpack_require__(526);
|
10576 |
-
|
10577 |
-
var _ReactAttributes2 = _interopRequireDefault(_ReactAttributes);
|
10578 |
-
|
10579 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
10580 |
-
|
10581 |
-
/**
|
10582 |
-
* Returns the parsed attribute value taking into account things like boolean attributes
|
10583 |
-
*
|
10584 |
-
* @param {String} attribute The name of the attribute
|
10585 |
-
* @param {*} value The value of the attribute from the HTML
|
10586 |
-
* @returns {*} The parsed attribute value
|
10587 |
-
*/
|
10588 |
-
var getParsedAttributeValue = function getParsedAttributeValue(attribute, value) {
|
10589 |
-
|
10590 |
-
// if the attribute if a boolean then it's value should be the same as it's name
|
10591 |
-
// e.g. disabled="disabled"
|
10592 |
-
var lowerBooleanAttributes = _BooleanAttributes2.default.map(function (attr) {
|
10593 |
-
return attr.toLowerCase();
|
10594 |
-
});
|
10595 |
-
if (lowerBooleanAttributes.indexOf(attribute.toLowerCase()) >= 0) {
|
10596 |
-
value = attribute;
|
10597 |
-
}
|
10598 |
-
|
10599 |
-
return value;
|
10600 |
-
};
|
10601 |
-
|
10602 |
-
/**
|
10603 |
-
* Takes an object of standard HTML property names and converts them to their React counterpart. If the react
|
10604 |
-
* version does not exist for an attribute then just use it as it is
|
10605 |
-
*
|
10606 |
-
* @param {Object} attributes The HTML attributes to convert
|
10607 |
-
* @returns {Object} The React attributes
|
10608 |
-
*/
|
10609 |
-
function HtmlAttributesToReact(attributes) {
|
10610 |
-
|
10611 |
-
return Object.keys(attributes).reduce(function (mappedAttributes, attribute) {
|
10612 |
-
|
10613 |
-
// lowercase the attribute name and find it in the react attribute map
|
10614 |
-
var lowerCaseAttribute = attribute.toLowerCase();
|
10615 |
-
|
10616 |
-
// format the attribute name
|
10617 |
-
var name = _ReactAttributes2.default[lowerCaseAttribute] || lowerCaseAttribute;
|
10618 |
-
|
10619 |
-
// add the parsed attribute value to the mapped attributes
|
10620 |
-
mappedAttributes[name] = getParsedAttributeValue(name, attributes[attribute]);
|
10621 |
-
|
10622 |
-
return mappedAttributes;
|
10623 |
-
}, {});
|
10624 |
-
}
|
10625 |
-
|
10626 |
-
/***/ },
|
10627 |
-
|
10628 |
-
/***/ 525:
|
10629 |
-
/***/ function(module, exports) {
|
10630 |
-
|
10631 |
-
'use strict';
|
10632 |
-
|
10633 |
-
Object.defineProperty(exports, "__esModule", {
|
10634 |
-
value: true
|
10635 |
-
});
|
10636 |
-
/**
|
10637 |
-
* List of boolean attributes
|
10638 |
-
* These attributes should have their React attribute value set to be the same as their name
|
10639 |
-
* E.g. <input disabled> = <input disabled>
|
10640 |
-
* <input disabled=""> = <input disabled>
|
10641 |
-
* <input disabled="disabled"> = <input disabled>
|
10642 |
-
* @type {Array}
|
10643 |
-
*/
|
10644 |
-
exports.default = ['allowfullScreen', 'async', 'autoplay', 'capture', 'checked', 'controls', 'default', 'defer', 'disabled', 'formnovalidate', 'hidden', 'loop', 'multiple', 'muted', 'novalidate', 'open', 'readonly', 'required', 'reversed', 'scoped', 'seamless', 'selected', 'itemscope'];
|
10645 |
-
|
10646 |
-
/***/ },
|
10647 |
-
|
10648 |
-
/***/ 526:
|
10649 |
-
/***/ function(module, exports) {
|
10650 |
-
|
10651 |
-
'use strict';
|
10652 |
-
|
10653 |
-
Object.defineProperty(exports, "__esModule", {
|
10654 |
-
value: true
|
10655 |
-
});
|
10656 |
-
/**
|
10657 |
-
* Mapping of standard HTML attributes to their React counterparts
|
10658 |
-
* List taken and reversed from react/src/renderers/dom/shared/HTMLDOMPropertyConfig.js
|
10659 |
-
* https://github.com/facebook/react/blob/c9c3c339b757682f1154f1c915eb55e6a8766933/src/renderers/dom/shared/HTMLDOMPropertyConfig.js
|
10660 |
-
* @type {Object}
|
10661 |
-
*/
|
10662 |
-
exports.default = {
|
10663 |
-
/**
|
10664 |
-
* Standard Properties
|
10665 |
-
*/
|
10666 |
-
accept: 'accept',
|
10667 |
-
'accept-charset': 'acceptCharset',
|
10668 |
-
accesskey: 'accessKey',
|
10669 |
-
action: 'action',
|
10670 |
-
allowfullscreen: 'allowFullScreen',
|
10671 |
-
allowtransparency: 'allowTransparency',
|
10672 |
-
alt: 'alt',
|
10673 |
-
async: 'async',
|
10674 |
-
autocomplete: 'autoComplete',
|
10675 |
-
autoplay: 'autoPlay',
|
10676 |
-
capture: 'capture',
|
10677 |
-
cellpadding: 'cellPadding',
|
10678 |
-
cellspacing: 'cellSpacing',
|
10679 |
-
charset: 'charSet',
|
10680 |
-
challenge: 'challenge',
|
10681 |
-
checked: 'checked',
|
10682 |
-
classid: 'classID',
|
10683 |
-
class: 'className',
|
10684 |
-
cols: 'cols',
|
10685 |
-
colspan: 'colSpan',
|
10686 |
-
content: 'content',
|
10687 |
-
contenteditable: 'contentEditable',
|
10688 |
-
contextmenu: 'contextMenu',
|
10689 |
-
controls: 'controls',
|
10690 |
-
coords: 'coords',
|
10691 |
-
crossorigin: 'crossOrigin',
|
10692 |
-
data: 'data',
|
10693 |
-
datetime: 'dateTime',
|
10694 |
-
default: 'default',
|
10695 |
-
defer: 'defer',
|
10696 |
-
dir: 'dir',
|
10697 |
-
disabled: 'disabled',
|
10698 |
-
download: 'download',
|
10699 |
-
draggable: 'draggable',
|
10700 |
-
enctype: 'encType',
|
10701 |
-
form: 'form',
|
10702 |
-
formaction: 'formAction',
|
10703 |
-
formenctype: 'formEncType',
|
10704 |
-
formmethod: 'formMethod',
|
10705 |
-
formnovalidate: 'formNoValidate',
|
10706 |
-
formtarget: 'formTarget',
|
10707 |
-
frameborder: 'frameBorder',
|
10708 |
-
headers: 'headers',
|
10709 |
-
height: 'height',
|
10710 |
-
hidden: 'hidden',
|
10711 |
-
high: 'high',
|
10712 |
-
href: 'href',
|
10713 |
-
hreflang: 'hrefLang',
|
10714 |
-
for: 'htmlFor',
|
10715 |
-
'http-equiv': 'httpEquiv',
|
10716 |
-
icon: 'icon',
|
10717 |
-
id: 'id',
|
10718 |
-
inputmode: 'inputMode',
|
10719 |
-
integrity: 'integrity',
|
10720 |
-
is: 'is',
|
10721 |
-
keyparams: 'keyParams',
|
10722 |
-
keytype: 'keyType',
|
10723 |
-
kind: 'kind',
|
10724 |
-
label: 'label',
|
10725 |
-
lang: 'lang',
|
10726 |
-
list: 'list',
|
10727 |
-
loop: 'loop',
|
10728 |
-
low: 'low',
|
10729 |
-
manifest: 'manifest',
|
10730 |
-
marginheight: 'marginHeight',
|
10731 |
-
marginwidth: 'marginWidth',
|
10732 |
-
max: 'max',
|
10733 |
-
maxlength: 'maxLength',
|
10734 |
-
media: 'media',
|
10735 |
-
mediagroup: 'mediaGroup',
|
10736 |
-
method: 'method',
|
10737 |
-
min: 'min',
|
10738 |
-
minlength: 'minLength',
|
10739 |
-
multiple: 'multiple',
|
10740 |
-
muted: 'muted',
|
10741 |
-
name: 'name',
|
10742 |
-
nonce: 'nonce',
|
10743 |
-
novalidate: 'noValidate',
|
10744 |
-
open: 'open',
|
10745 |
-
optimum: 'optimum',
|
10746 |
-
pattern: 'pattern',
|
10747 |
-
placeholder: 'placeholder',
|
10748 |
-
poster: 'poster',
|
10749 |
-
preload: 'preload',
|
10750 |
-
radiogroup: 'radioGroup',
|
10751 |
-
readonly: 'readOnly',
|
10752 |
-
rel: 'rel',
|
10753 |
-
required: 'required',
|
10754 |
-
reversed: 'reversed',
|
10755 |
-
role: 'role',
|
10756 |
-
rows: 'rows',
|
10757 |
-
rowspan: 'rowSpan',
|
10758 |
-
sandbox: 'sandbox',
|
10759 |
-
scope: 'scope',
|
10760 |
-
scoped: 'scoped',
|
10761 |
-
scrolling: 'scrolling',
|
10762 |
-
seamless: 'seamless',
|
10763 |
-
selected: 'selected',
|
10764 |
-
shape: 'shape',
|
10765 |
-
size: 'size',
|
10766 |
-
sizes: 'sizes',
|
10767 |
-
span: 'span',
|
10768 |
-
spellcheck: 'spellCheck',
|
10769 |
-
src: 'src',
|
10770 |
-
srcdoc: 'srcDoc',
|
10771 |
-
srclang: 'srcLang',
|
10772 |
-
srcset: 'srcSet',
|
10773 |
-
start: 'start',
|
10774 |
-
step: 'step',
|
10775 |
-
style: 'style',
|
10776 |
-
summary: 'summary',
|
10777 |
-
tabindex: 'tabIndex',
|
10778 |
-
target: 'target',
|
10779 |
-
title: 'title',
|
10780 |
-
type: 'type',
|
10781 |
-
usemap: 'useMap',
|
10782 |
-
value: 'value',
|
10783 |
-
width: 'width',
|
10784 |
-
wmode: 'wmode',
|
10785 |
-
wrap: 'wrap',
|
10786 |
-
/**
|
10787 |
-
* RDFa Properties
|
10788 |
-
*/
|
10789 |
-
about: 'about',
|
10790 |
-
datatype: 'datatype',
|
10791 |
-
inlist: 'inlist',
|
10792 |
-
prefix: 'prefix',
|
10793 |
-
property: 'property',
|
10794 |
-
resource: 'resource',
|
10795 |
-
typeof: 'typeof',
|
10796 |
-
vocab: 'vocab',
|
10797 |
-
/**
|
10798 |
-
* Non-standard Properties
|
10799 |
-
*/
|
10800 |
-
autocapitalize: 'autoCapitalize',
|
10801 |
-
autocorrect: 'autoCorrect',
|
10802 |
-
autosave: 'autoSave',
|
10803 |
-
color: 'color',
|
10804 |
-
itemprop: 'itemProp',
|
10805 |
-
itemscope: 'itemScope',
|
10806 |
-
itemtype: 'itemType',
|
10807 |
-
itemid: 'itemID',
|
10808 |
-
itemref: 'itemRef',
|
10809 |
-
results: 'results',
|
10810 |
-
security: 'security',
|
10811 |
-
unselectable: 'unselectable',
|
10812 |
-
autofocus: 'autoFocus'
|
10813 |
-
};
|
10814 |
-
|
10815 |
-
/***/ },
|
10816 |
-
|
10817 |
-
/***/ 527:
|
10818 |
-
/***/ function(module, exports) {
|
10819 |
-
|
10820 |
-
'use strict';
|
10821 |
-
|
10822 |
-
Object.defineProperty(exports, "__esModule", {
|
10823 |
-
value: true
|
10824 |
-
});
|
10825 |
-
|
10826 |
-
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
|
10827 |
-
|
10828 |
-
exports.default = InlineStyleToObject;
|
10829 |
-
/**
|
10830 |
-
* Converts an inline style string into an object of React style properties
|
10831 |
-
*
|
10832 |
-
* @param {String} inlineStyle='' The inline style to convert
|
10833 |
-
* @returns {Object} The converted style
|
10834 |
-
*/
|
10835 |
-
function InlineStyleToObject() {
|
10836 |
-
var inlineStyle = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0];
|
10837 |
-
|
10838 |
-
|
10839 |
-
// just return empty object if the inlineStyle is empty
|
10840 |
-
if (inlineStyle === '') {
|
10841 |
-
return {};
|
10842 |
-
}
|
10843 |
-
|
10844 |
-
return inlineStyle.split(';').reduce(function (styleObject, stylePropertyValue) {
|
10845 |
-
|
10846 |
-
// extract the style property name and value
|
10847 |
-
|
10848 |
-
var _stylePropertyValue$s = stylePropertyValue.split(':').map(function (item) {
|
10849 |
-
return item.trim().toLowerCase();
|
10850 |
-
});
|
10851 |
-
|
10852 |
-
var _stylePropertyValue$s2 = _slicedToArray(_stylePropertyValue$s, 2);
|
10853 |
-
|
10854 |
-
var property = _stylePropertyValue$s2[0];
|
10855 |
-
var value = _stylePropertyValue$s2[1];
|
10856 |
-
|
10857 |
-
// if there is no value (i.e. no : in the style) then ignore it
|
10858 |
-
|
10859 |
-
if (value === undefined) {
|
10860 |
-
return styleObject;
|
10861 |
-
}
|
10862 |
-
|
10863 |
-
// convert the property name into the correct React format
|
10864 |
-
// remove all hyphens and convert the letter immediately after each hyphen to upper case
|
10865 |
-
// additionally don't uppercase any -ms- prefix
|
10866 |
-
// e.g. -ms-style-property = msStyleProperty
|
10867 |
-
// -webkit-style-property = WebkitStyleProperty
|
10868 |
-
property = property.replace(/^-ms-/, 'ms-').replace(/-(.)/g, function (_, character) {
|
10869 |
-
return character.toUpperCase();
|
10870 |
-
});
|
10871 |
-
|
10872 |
-
// add the new style property and value to the style object
|
10873 |
-
styleObject[property] = value;
|
10874 |
-
|
10875 |
-
return styleObject;
|
10876 |
-
}, {});
|
10877 |
-
}
|
10878 |
-
|
10879 |
-
/***/ },
|
10880 |
-
|
10881 |
-
/***/ 528:
|
10882 |
-
/***/ function(module, exports) {
|
10883 |
-
|
10884 |
-
'use strict';
|
10885 |
-
|
10886 |
-
Object.defineProperty(exports, "__esModule", {
|
10887 |
-
value: true
|
10888 |
-
});
|
10889 |
-
exports.default = TransformTagName;
|
10890 |
-
var TAGS_TO_TRANSFORM = {
|
10891 |
-
'html': 'div',
|
10892 |
-
'head': 'div',
|
10893 |
-
'body': 'div'
|
10894 |
-
};
|
10895 |
-
|
10896 |
-
/**
|
10897 |
-
* Transforms the specified tag name to another tag name if needed
|
10898 |
-
*
|
10899 |
-
* @param {String} tagName The name of the tag
|
10900 |
-
* @returns {String} The transformed tag name or the original if it doesn't need to be transformed
|
10901 |
-
*/
|
10902 |
-
function TransformTagName(tagName) {
|
10903 |
-
if (TAGS_TO_TRANSFORM.hasOwnProperty(tagName)) {
|
10904 |
-
return TAGS_TO_TRANSFORM[tagName];
|
10905 |
-
} else {
|
10906 |
-
return tagName;
|
10907 |
-
}
|
10908 |
-
}
|
10909 |
-
|
10910 |
-
/***/ },
|
10911 |
-
|
10912 |
-
/***/ 529:
|
10913 |
-
/***/ function(module, exports) {
|
10914 |
-
|
10915 |
-
'use strict';
|
10916 |
-
|
10917 |
-
Object.defineProperty(exports, "__esModule", {
|
10918 |
-
value: true
|
10919 |
-
});
|
10920 |
-
/**
|
10921 |
-
* List of void elements
|
10922 |
-
* These elements are not allowed to have children
|
10923 |
-
* @type {Array}
|
10924 |
-
*/
|
10925 |
-
exports.default = ['area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr'];
|
10926 |
-
|
10927 |
-
/***/ },
|
10928 |
-
|
10929 |
-
/***/ 530:
|
10930 |
-
/***/ function(module, exports, __webpack_require__) {
|
10931 |
-
|
10932 |
-
'use strict';
|
10933 |
-
|
10934 |
-
Object.defineProperty(exports, "__esModule", {
|
10935 |
-
value: true
|
10936 |
-
});
|
10937 |
-
exports.default = StyleElementType;
|
10938 |
-
|
10939 |
-
var _react = __webpack_require__(2);
|
10940 |
-
|
10941 |
-
var _react2 = _interopRequireDefault(_react);
|
10942 |
-
|
10943 |
-
var _GeneratePropsFromAttributes = __webpack_require__(523);
|
10944 |
-
|
10945 |
-
var _GeneratePropsFromAttributes2 = _interopRequireDefault(_GeneratePropsFromAttributes);
|
10946 |
-
|
10947 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
10948 |
-
|
10949 |
-
/**
|
10950 |
-
* Converts a <style> element to a React element
|
10951 |
-
*
|
10952 |
-
* @param {Object} node The style node
|
10953 |
-
* @param {String} key The key to give the React element
|
10954 |
-
* @returns {React.Element} The React style element
|
10955 |
-
*/
|
10956 |
-
function StyleElementType(node, key) {
|
10957 |
-
|
10958 |
-
// The style element only ever has a single child which is the styles so try and find this to add as
|
10959 |
-
// a child to the style element that will be created
|
10960 |
-
var styles = void 0;
|
10961 |
-
if (node.children.length > 0) {
|
10962 |
-
styles = node.children[0].data;
|
10963 |
-
}
|
10964 |
-
|
10965 |
-
// generate props
|
10966 |
-
var props = (0, _GeneratePropsFromAttributes2.default)(node.attribs, key);
|
10967 |
-
|
10968 |
-
// create and return the element
|
10969 |
-
return _react2.default.createElement('style', props, styles);
|
10970 |
-
}
|
10971 |
-
|
10972 |
-
/***/ },
|
10973 |
-
|
10974 |
-
/***/ 531:
|
10975 |
-
/***/ function(module, exports) {
|
10976 |
-
|
10977 |
-
"use strict";
|
10978 |
-
|
10979 |
-
Object.defineProperty(exports, "__esModule", {
|
10980 |
-
value: true
|
10981 |
-
});
|
10982 |
-
exports.default = UnsupportedElementType;
|
10983 |
-
/**
|
10984 |
-
* Handles an unsupported element type by returning null so nothing is rendered
|
10985 |
-
* @returns {null}
|
10986 |
-
*/
|
10987 |
-
function UnsupportedElementType() {
|
10988 |
-
|
10989 |
-
// do nothing because the element type is unsupported
|
10990 |
-
// comment, directive, script, cdata, doctype are all currently unsupported
|
10991 |
-
return null;
|
10992 |
-
}
|
10993 |
-
|
10994 |
-
/***/ },
|
10995 |
-
|
10996 |
-
/***/ 532:
|
10997 |
-
/***/ function(module, exports, __webpack_require__) {
|
10998 |
-
|
10999 |
-
'use strict';
|
11000 |
-
|
11001 |
-
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
11002 |
-
|
11003 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
11004 |
-
|
11005 |
-
var _react = __webpack_require__(2);
|
11006 |
-
|
11007 |
-
var _react2 = _interopRequireDefault(_react);
|
11008 |
-
|
11009 |
-
var _mailpoet = __webpack_require__(276);
|
11010 |
-
|
11011 |
-
var _mailpoet2 = _interopRequireDefault(_mailpoet);
|
11012 |
-
|
11013 |
-
var _underscore = __webpack_require__(281);
|
11014 |
-
|
11015 |
-
var _underscore2 = _interopRequireDefault(_underscore);
|
11016 |
-
|
11017 |
-
var _newslettersBreadcrumbJsx = __webpack_require__(441);
|
11018 |
-
|
11019 |
-
var _newslettersBreadcrumbJsx2 = _interopRequireDefault(_newslettersBreadcrumbJsx);
|
11020 |
-
|
11021 |
-
var _formFormJsx = __webpack_require__(294);
|
11022 |
-
|
11023 |
-
var _formFormJsx2 = _interopRequireDefault(_formFormJsx);
|
11024 |
-
|
11025 |
-
var _newslettersSendStandardJsx = __webpack_require__(533);
|
11026 |
-
|
11027 |
-
var _newslettersSendStandardJsx2 = _interopRequireDefault(_newslettersSendStandardJsx);
|
11028 |
-
|
11029 |
-
var _newslettersSendNotificationJsx = __webpack_require__(534);
|
11030 |
-
|
11031 |
-
var _newslettersSendNotificationJsx2 = _interopRequireDefault(_newslettersSendNotificationJsx);
|
11032 |
-
|
11033 |
-
var _newslettersSendWelcomeJsx = __webpack_require__(538);
|
11034 |
-
|
11035 |
-
var _newslettersSendWelcomeJsx2 = _interopRequireDefault(_newslettersSendWelcomeJsx);
|
11036 |
-
|
11037 |
-
var _helpTooltipJsx = __webpack_require__(463);
|
11038 |
-
|
11039 |
-
var _helpTooltipJsx2 = _interopRequireDefault(_helpTooltipJsx);
|
11040 |
-
|
11041 |
-
var _jquery = __webpack_require__(275);
|
11042 |
-
|
11043 |
-
var _jquery2 = _interopRequireDefault(_jquery);
|
11044 |
-
|
11045 |
-
var _commonThumbnailJsx = __webpack_require__(541);
|
11046 |
-
|
11047 |
-
var _wpJsHooks = __webpack_require__(438);
|
11048 |
-
|
11049 |
-
var _wpJsHooks2 = _interopRequireDefault(_wpJsHooks);
|
11050 |
-
|
11051 |
-
var NewsletterSend = _react2['default'].createClass({
|
11052 |
-
displayName: 'NewsletterSend',
|
11053 |
-
|
11054 |
-
contextTypes: {
|
11055 |
-
router: _react2['default'].PropTypes.object.isRequired
|
11056 |
-
},
|
11057 |
-
getInitialState: function getInitialState() {
|
11058 |
-
return {
|
11059 |
-
fields: [],
|
11060 |
-
item: {},
|
11061 |
-
loading: true
|
11062 |
-
};
|
11063 |
-
},
|
11064 |
-
getFieldsByNewsletter: function getFieldsByNewsletter(newsletter) {
|
11065 |
-
var type = this.getSubtype(newsletter);
|
11066 |
-
return type.getFields(newsletter);
|
11067 |
-
},
|
11068 |
-
getSendButtonOptions: function getSendButtonOptions() {
|
11069 |
-
var type = this.getSubtype(this.state.item);
|
11070 |
-
return type.getSendButtonOptions(this.state.item);
|
11071 |
-
},
|
11072 |
-
getSubtype: function getSubtype(newsletter) {
|
11073 |
-
switch (newsletter.type) {
|
11074 |
-
case 'notification':
|
11075 |
-
return _newslettersSendNotificationJsx2['default'];
|
11076 |
-
case 'welcome':
|
11077 |
-
return _newslettersSendWelcomeJsx2['default'];
|
11078 |
-
default:
|
11079 |
-
return _wpJsHooks2['default'].applyFilters('mailpoet_newsletters_send_newsletter_fields', _newslettersSendStandardJsx2['default'], newsletter);
|
11080 |
-
}
|
11081 |
-
},
|
11082 |
-
isValid: function isValid() {
|
11083 |
-
return (0, _jquery2['default'])('#mailpoet_newsletter').parsley().isValid();
|
11084 |
-
},
|
11085 |
-
componentDidMount: function componentDidMount() {
|
11086 |
-
this.loadItem(this.props.params.id);
|
11087 |
-
(0, _jquery2['default'])('#mailpoet_newsletter').parsley();
|
11088 |
-
},
|
11089 |
-
componentWillReceiveProps: function componentWillReceiveProps(props) {
|
11090 |
-
this.loadItem(props.params.id);
|
11091 |
-
},
|
11092 |
-
loadItem: function loadItem(id) {
|
11093 |
-
var _this = this;
|
11094 |
-
|
11095 |
-
this.setState({ loading: true });
|
11096 |
-
|
11097 |
-
_mailpoet2['default'].Ajax.post({
|
11098 |
-
api_version: window.mailpoet_api_version,
|
11099 |
-
endpoint: 'newsletters',
|
11100 |
-
action: 'get',
|
11101 |
-
data: {
|
11102 |
-
id: id
|
11103 |
-
}
|
11104 |
-
}).done(function (response) {
|
11105 |
-
_this.setState({
|
11106 |
-
loading: false,
|
11107 |
-
item: response.data,
|
11108 |
-
fields: _this.getFieldsByNewsletter(response.data)
|
11109 |
-
});
|
11110 |
-
}).fail(function () {
|
11111 |
-
_this.setState({
|
11112 |
-
loading: false,
|
11113 |
-
item: {}
|
11114 |
-
}, function () {
|
11115 |
-
_this.context.router.push('/new');
|
11116 |
-
});
|
11117 |
-
});
|
11118 |
-
},
|
11119 |
-
saveTemplate: function saveTemplate(response, done) {
|
11120 |
-
var _this2 = this;
|
11121 |
-
|
11122 |
-
(0, _commonThumbnailJsx.fromUrl)(response.meta.preview_url).then(function (thumbnail) {
|
11123 |
-
_mailpoet2['default'].Ajax.post({
|
11124 |
-
api_version: window.mailpoet_api_version,
|
11125 |
-
endpoint: 'newsletterTemplates',
|
11126 |
-
action: 'save',
|
11127 |
-
data: {
|
11128 |
-
newsletter_id: response.data.id,
|
11129 |
-
name: response.data.subject,
|
11130 |
-
thumbnail: thumbnail,
|
11131 |
-
body: JSON.stringify(response.data.body),
|
11132 |
-
categories: '["recent"]'
|
11133 |
-
}
|
11134 |
-
}).then(done).fail(function (err) {
|
11135 |
-
_this2.showError(err);
|
11136 |
-
_this2.setState({ loading: false });
|
11137 |
-
_mailpoet2['default'].Modal.loading(false);
|
11138 |
-
done();
|
11139 |
-
});
|
11140 |
-
})['catch'](function (err) {
|
11141 |
-
_this2.showError({ errors: [err] });
|
11142 |
-
});
|
11143 |
-
},
|
11144 |
-
handleSend: function handleSend(e) {
|
11145 |
-
var _this3 = this;
|
11146 |
-
|
11147 |
-
e.preventDefault();
|
11148 |
-
|
11149 |
-
if (!this.isValid()) {
|
11150 |
-
return (0, _jquery2['default'])('#mailpoet_newsletter').parsley().validate();
|
11151 |
-
}
|
11152 |
-
|
11153 |
-
_mailpoet2['default'].Modal.loading(true);
|
11154 |
-
|
11155 |
-
return this.saveNewsletter(e).done(function () {
|
11156 |
-
_this3.setState({ loading: true });
|
11157 |
-
}).done(function (response) {
|
11158 |
-
switch (response.data.type) {
|
11159 |
-
case 'notification':
|
11160 |
-
case 'welcome':
|
11161 |
-
return _this3.activateNewsletter(response);
|
11162 |
-
default:
|
11163 |
-
return _this3.sendNewsletter(response);
|
11164 |
-
}
|
11165 |
-
}).fail(function (err) {
|
11166 |
-
_this3.showError(err);
|
11167 |
-
_this3.setState({ loading: false });
|
11168 |
-
_mailpoet2['default'].Modal.loading(false);
|
11169 |
-
});
|
11170 |
-
},
|
11171 |
-
sendNewsletter: function sendNewsletter(newsletter) {
|
11172 |
-
var _this4 = this;
|
11173 |
-
|
11174 |
-
return _mailpoet2['default'].Ajax.post(_wpJsHooks2['default'].applyFilters('mailpoet_newsletters_send_server_request_parameters', {
|
11175 |
-
api_version: window.mailpoet_api_version,
|
11176 |
-
endpoint: 'sendingQueue',
|
11177 |
-
action: 'add',
|
11178 |
-
data: {
|
11179 |
-
newsletter_id: this.state.item.id
|
11180 |
-
}
|
11181 |
-
}, this.state.item)).done(function (response) {
|
11182 |
-
// save template in recently sent category
|
11183 |
-
_this4.saveTemplate(newsletter, function () {
|
11184 |
-
// redirect to listing based on newsletter type
|
11185 |
-
_this4.context.router.push(_wpJsHooks2['default'].applyFilters('mailpoet_newsletters_send_server_request_response_redirect', '/' + (_this4.state.item.type || ''), _this4.state.item));
|
11186 |
-
var customResponse = _wpJsHooks2['default'].applyFilters('mailpoet_newsletters_send_server_request_response', _this4.state.item, response);
|
11187 |
-
if (_underscore2['default'].isFunction(customResponse)) {
|
11188 |
-
customResponse();
|
11189 |
-
} else if (response.data.status === 'scheduled') {
|
11190 |
-
_mailpoet2['default'].Notice.success(_mailpoet2['default'].I18n.t('newsletterHasBeenScheduled'));
|
11191 |
-
_mailpoet2['default'].trackEvent('Emails > Newsletter sent', {
|
11192 |
-
scheduled: true,
|
11193 |
-
'MailPoet Free version': window.mailpoet_version
|
11194 |
-
});
|
11195 |
-
} else {
|
11196 |
-
_mailpoet2['default'].Notice.success(_mailpoet2['default'].I18n.t('newsletterBeingSent'));
|
11197 |
-
_mailpoet2['default'].trackEvent('Emails > Newsletter sent', {
|
11198 |
-
scheduled: false,
|
11199 |
-
'MailPoet Free version': window.mailpoet_version
|
11200 |
-
});
|
11201 |
-
}
|
11202 |
-
_mailpoet2['default'].Modal.loading(false);
|
11203 |
-
});
|
11204 |
-
}).fail(function (err) {
|
11205 |
-
_this4.showError(err);
|
11206 |
-
_this4.setState({ loading: false });
|
11207 |
-
_mailpoet2['default'].Modal.loading(false);
|
11208 |
-
});
|
11209 |
-
},
|
11210 |
-
activateNewsletter: function activateEmail(newsletter) {
|
11211 |
-
var _this5 = this;
|
11212 |
-
|
11213 |
-
return _mailpoet2['default'].Ajax.post({
|
11214 |
-
api_version: window.mailpoet_api_version,
|
11215 |
-
endpoint: 'newsletters',
|
11216 |
-
action: 'setStatus',
|
11217 |
-
data: {
|
11218 |
-
id: this.props.params.id,
|
11219 |
-
status: 'active'
|
11220 |
-
}
|
11221 |
-
}).done(function (response) {
|
11222 |
-
// save template in recently sent category
|
11223 |
-
_this5.saveTemplate(newsletter, function () {
|
11224 |
-
// redirect to listing based on newsletter type
|
11225 |
-
_this5.context.router.push('/' + (_this5.state.item.type || ''));
|
11226 |
-
var opts = _this5.state.item.options;
|
11227 |
-
// display success message depending on newsletter type
|
11228 |
-
if (response.data.type === 'welcome') {
|
11229 |
-
_mailpoet2['default'].Notice.success(_mailpoet2['default'].I18n.t('welcomeEmailActivated'));
|
11230 |
-
_mailpoet2['default'].trackEvent('Emails > Welcome email activated', {
|
11231 |
-
'MailPoet Free version': window.mailpoet_version,
|
11232 |
-
'List type': opts.event,
|
11233 |
-
Delay: opts.afterTimeNumber + ' ' + opts.afterTimeType
|
11234 |
-
});
|
11235 |
-
} else if (response.data.type === 'notification') {
|
11236 |
-
_mailpoet2['default'].Notice.success(_mailpoet2['default'].I18n.t('postNotificationActivated'));
|
11237 |
-
_mailpoet2['default'].trackEvent('Emails > Post notifications activated', {
|
11238 |
-
'MailPoet Free version': window.mailpoet_version,
|
11239 |
-
Frequency: opts.intervalType
|
11240 |
-
});
|
11241 |
-
}
|
11242 |
-
_mailpoet2['default'].Modal.loading(false);
|
11243 |
-
});
|
11244 |
-
}).fail(function (err) {
|
11245 |
-
_this5.showError(err);
|
11246 |
-
_this5.setState({ loading: false });
|
11247 |
-
_mailpoet2['default'].Modal.loading(false);
|
11248 |
-
});
|
11249 |
-
},
|
11250 |
-
handleResume: function handleResume(e) {
|
11251 |
-
var _this6 = this;
|
11252 |
-
|
11253 |
-
e.preventDefault();
|
11254 |
-
if (!this.isValid()) {
|
11255 |
-
(0, _jquery2['default'])('#mailpoet_newsletter').parsley().validate();
|
11256 |
-
} else {
|
11257 |
-
this.saveNewsletter(e).done(function () {
|
11258 |
-
_this6.setState({ loading: true });
|
11259 |
-
}).done(function () {
|
11260 |
-
_mailpoet2['default'].Ajax.post({
|
11261 |
-
api_version: window.mailpoet_api_version,
|
11262 |
-
endpoint: 'sendingQueue',
|
11263 |
-
action: 'resume',
|
11264 |
-
data: {
|
11265 |
-
newsletter_id: _this6.state.item.id
|
11266 |
-
}
|
11267 |
-
}).done(function () {
|
11268 |
-
_this6.context.router.push('/' + (_this6.state.item.type || ''));
|
11269 |
-
_mailpoet2['default'].Notice.success(_mailpoet2['default'].I18n.t('newsletterSendingHasBeenResumed'));
|
11270 |
-
}).fail(function (response) {
|
11271 |
-
if (response.errors.length > 0) {
|
11272 |
-
_mailpoet2['default'].Notice.error(response.errors.map(function (error) {
|
11273 |
-
return error.message;
|
11274 |
-
}), { scroll: true });
|
11275 |
-
}
|
11276 |
-
});
|
11277 |
-
}).fail(function (err) {
|
11278 |
-
_this6.showError(err);
|
11279 |
-
}).always(function () {
|
11280 |
-
_this6.setState({ loading: false });
|
11281 |
-
});
|
11282 |
-
}
|
11283 |
-
return false;
|
11284 |
-
},
|
11285 |
-
handleSave: function handleSave(e) {
|
11286 |
-
var _this7 = this;
|
11287 |
-
|
11288 |
-
e.preventDefault();
|
11289 |
-
|
11290 |
-
this.saveNewsletter(e).done(function () {
|
11291 |
-
_mailpoet2['default'].Notice.success(_mailpoet2['default'].I18n.t('newsletterUpdated'));
|
11292 |
-
}).done(function () {
|
11293 |
-
_this7.context.router.push('/' + (_this7.state.item.type || ''));
|
11294 |
-
}).fail(function (err) {
|
11295 |
-
_this7.showError(err);
|
11296 |
-
});
|
11297 |
-
},
|
11298 |
-
handleRedirectToDesign: function handleRedirectToDesign(e) {
|
11299 |
-
var _this8 = this;
|
11300 |
-
|
11301 |
-
e.preventDefault();
|
11302 |
-
var redirectTo = e.target.href;
|
11303 |
-
|
11304 |
-
this.saveNewsletter(e).done(function () {
|
11305 |
-
_mailpoet2['default'].Notice.success(_mailpoet2['default'].I18n.t('newsletterUpdated'));
|
11306 |
-
}).done(function () {
|
11307 |
-
window.location = redirectTo;
|
11308 |
-
}).fail(function (err) {
|
11309 |
-
_this8.showError(err);
|
11310 |
-
});
|
11311 |
-
},
|
11312 |
-
saveNewsletter: function saveNewsletter() {
|
11313 |
-
var _this9 = this;
|
11314 |
-
|
11315 |
-
var data = this.state.item;
|
11316 |
-
data.queue = undefined;
|
11317 |
-
this.setState({ loading: true });
|
11318 |
-
|
11319 |
-
// Store only properties that can be changed on this page
|
11320 |
-
var IGNORED_NEWSLETTER_PROPERTIES = ['preheader', 'body', 'created_at', 'deleted_at', 'hash', 'status', 'updated_at', 'type'];
|
11321 |
-
var newsletterData = _underscore2['default'].omit(data, IGNORED_NEWSLETTER_PROPERTIES);
|
11322 |
-
|
11323 |
-
return _mailpoet2['default'].Ajax.post({
|
11324 |
-
api_version: window.mailpoet_api_version,
|
11325 |
-
endpoint: 'newsletters',
|
11326 |
-
action: 'save',
|
11327 |
-
data: newsletterData
|
11328 |
-
}).always(function () {
|
11329 |
-
_this9.setState({ loading: false });
|
11330 |
-
});
|
11331 |
-
},
|
11332 |
-
showError: function showError(response) {
|
11333 |
-
if (response.errors.length > 0) {
|
11334 |
-
_mailpoet2['default'].Notice.error(response.errors.map(function (error) {
|
11335 |
-
return error.message;
|
11336 |
-
}), { scroll: true });
|
11337 |
-
}
|
11338 |
-
},
|
11339 |
-
handleFormChange: function handleFormChange(e) {
|
11340 |
-
var item = this.state.item;
|
11341 |
-
var field = e.target.name;
|
11342 |
-
|
11343 |
-
item[field] = e.target.value;
|
11344 |
-
|
11345 |
-
this.setState({
|
11346 |
-
item: item
|
11347 |
-
});
|
11348 |
-
return true;
|
11349 |
-
},
|
11350 |
-
render: function render() {
|
11351 |
-
var isPaused = this.state.item.status === 'sending' && this.state.item.queue && this.state.item.queue.status === 'paused';
|
11352 |
-
var fields = this.state.fields.map(function (field) {
|
11353 |
-
var newField = field;
|
11354 |
-
if (field.name === 'segments' || field.name === 'options') {
|
11355 |
-
newField.disabled = isPaused;
|
11356 |
-
}
|
11357 |
-
return newField;
|
11358 |
-
});
|
11359 |
-
var sendButtonOptions = this.getSendButtonOptions();
|
11360 |
-
var breadcrumb = _wpJsHooks2['default'].applyFilters('mailpoet_newsletters_send_breadcrumb', _react2['default'].createElement(_newslettersBreadcrumbJsx2['default'], { step: 'send' }), this.state.item.type, 'send');
|
11361 |
-
|
11362 |
-
return _react2['default'].createElement(
|
11363 |
-
'div',
|
11364 |
-
null,
|
11365 |
-
_react2['default'].createElement(
|
11366 |
-
'h1',
|
11367 |
-
null,
|
11368 |
-
_mailpoet2['default'].I18n.t('finalNewsletterStep')
|
11369 |
-
),
|
11370 |
-
breadcrumb,
|
11371 |
-
_react2['default'].createElement(
|
11372 |
-
_formFormJsx2['default'],
|
11373 |
-
{
|
11374 |
-
id: 'mailpoet_newsletter',
|
11375 |
-
fields: fields,
|
11376 |
-
item: this.state.item,
|
11377 |
-
loading: this.state.loading,
|
11378 |
-
onChange: this.handleFormChange,
|
11379 |
-
onSubmit: this.handleSave
|
11380 |
-
},
|
11381 |
-
_react2['default'].createElement(
|
11382 |
-
'p',
|
11383 |
-
{ className: 'submit' },
|
11384 |
-
isPaused ? _react2['default'].createElement('input', {
|
11385 |
-
className: 'button button-primary',
|
11386 |
-
type: 'button',
|
11387 |
-
onClick: this.handleResume,
|
11388 |
-
value: _mailpoet2['default'].I18n.t('resume')
|
11389 |
-
}) : _react2['default'].createElement('input', _extends({
|
11390 |
-
className: 'button button-primary',
|
11391 |
-
type: 'button',
|
11392 |
-
onClick: this.handleSend,
|
11393 |
-
value: _mailpoet2['default'].I18n.t('send')
|
11394 |
-
}, sendButtonOptions)),
|
11395 |
-
' ',
|
11396 |
-
_react2['default'].createElement('input', {
|
11397 |
-
className: 'button button-secondary',
|
11398 |
-
type: 'submit',
|
11399 |
-
value: _mailpoet2['default'].I18n.t('saveDraftAndClose')
|
11400 |
-
}),
|
11401 |
-
' ',
|
11402 |
-
_mailpoet2['default'].I18n.t('orSimply'),
|
11403 |
-
' ',
|
11404 |
-
_react2['default'].createElement(
|
11405 |
-
'a',
|
11406 |
-
{
|
11407 |
-
href: '?page=mailpoet-newsletter-editor&id=' + this.props.params.id,
|
11408 |
-
onClick: this.handleRedirectToDesign
|
11409 |
-
},
|
11410 |
-
_mailpoet2['default'].I18n.t('goBackToDesign')
|
11411 |
-
),
|
11412 |
-
'.'
|
11413 |
-
),
|
11414 |
-
!isPaused && sendButtonOptions.disabled && sendButtonOptions.disabled === 'disabled' && _react2['default'].createElement(_helpTooltipJsx2['default'], {
|
11415 |
-
tooltip: _mailpoet2['default'].I18n.t('helpTooltipSendEmail'),
|
11416 |
-
tooltipId: 'helpTooltipSendEmail'
|
11417 |
-
})
|
11418 |
-
)
|
11419 |
-
);
|
11420 |
-
}
|
11421 |
-
});
|
11422 |
-
|
11423 |
-
module.exports = NewsletterSend;
|
11424 |
-
|
11425 |
-
/***/ },
|
11426 |
-
|
11427 |
-
/***/ 533:
|
11428 |
-
/***/ function(module, exports, __webpack_require__) {
|
11429 |
-
|
11430 |
-
'use strict';
|
11431 |
-
|
11432 |
-
var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i['return']) _i['return'](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError('Invalid attempt to destructure non-iterable instance'); } }; })();
|
11433 |
-
|
11434 |
-
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
11435 |
-
|
11436 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
11437 |
-
|
11438 |
-
var _react = __webpack_require__(2);
|
11439 |
-
|
11440 |
-
var _react2 = _interopRequireDefault(_react);
|
11441 |
-
|
11442 |
-
var _jquery = __webpack_require__(275);
|
11443 |
-
|
11444 |
-
var _jquery2 = _interopRequireDefault(_jquery);
|
11445 |
-
|
11446 |
-
var _underscore = __webpack_require__(281);
|
11447 |
-
|
11448 |
-
var _underscore2 = _interopRequireDefault(_underscore);
|
11449 |
-
|
11450 |
-
var _mailpoet = __webpack_require__(276);
|
11451 |
-
|
11452 |
-
var _mailpoet2 = _interopRequireDefault(_mailpoet);
|
11453 |
-
|
11454 |
-
var _wpJsHooks = __webpack_require__(438);
|
11455 |
-
|
11456 |
-
var _wpJsHooks2 = _interopRequireDefault(_wpJsHooks);
|
11457 |
-
|
11458 |
-
var currentTime = window.mailpoet_current_time || '00:00';
|
11459 |
-
var defaultDateTime = window.mailpoet_current_date + ' 00:00:00';
|
11460 |
-
var timeOfDayItems = window.mailpoet_schedule_time_of_day;
|
11461 |
-
var dateDisplayFormat = window.mailpoet_date_display_format;
|
11462 |
-
var dateStorageFormat = window.mailpoet_date_storage_format;
|
11463 |
-
|
11464 |
-
var datepickerTranslations = {
|
11465 |
-
closeText: _mailpoet2['default'].I18n.t('close'),
|
11466 |
-
currentText: _mailpoet2['default'].I18n.t('today'),
|
11467 |
-
nextText: _mailpoet2['default'].I18n.t('next'),
|
11468 |
-
prevText: _mailpoet2['default'].I18n.t('previous'),
|
11469 |
-
monthNames: [_mailpoet2['default'].I18n.t('january'), _mailpoet2['default'].I18n.t('february'), _mailpoet2['default'].I18n.t('march'), _mailpoet2['default'].I18n.t('april'), _mailpoet2['default'].I18n.t('may'), _mailpoet2['default'].I18n.t('june'), _mailpoet2['default'].I18n.t('july'), _mailpoet2['default'].I18n.t('august'), _mailpoet2['default'].I18n.t('september'), _mailpoet2['default'].I18n.t('october'), _mailpoet2['default'].I18n.t('november'), _mailpoet2['default'].I18n.t('december')],
|
11470 |
-
monthNamesShort: [_mailpoet2['default'].I18n.t('januaryShort'), _mailpoet2['default'].I18n.t('februaryShort'), _mailpoet2['default'].I18n.t('marchShort'), _mailpoet2['default'].I18n.t('aprilShort'), _mailpoet2['default'].I18n.t('mayShort'), _mailpoet2['default'].I18n.t('juneShort'), _mailpoet2['default'].I18n.t('julyShort'), _mailpoet2['default'].I18n.t('augustShort'), _mailpoet2['default'].I18n.t('septemberShort'), _mailpoet2['default'].I18n.t('octoberShort'), _mailpoet2['default'].I18n.t('novemberShort'), _mailpoet2['default'].I18n.t('decemberShort')],
|
11471 |
-
dayNames: [_mailpoet2['default'].I18n.t('sunday'), _mailpoet2['default'].I18n.t('monday'), _mailpoet2['default'].I18n.t('tuesday'), _mailpoet2['default'].I18n.t('wednesday'), _mailpoet2['default'].I18n.t('thursday'), _mailpoet2['default'].I18n.t('friday'), _mailpoet2['default'].I18n.t('saturday')],
|
11472 |
-
dayNamesShort: [_mailpoet2['default'].I18n.t('sundayShort'), _mailpoet2['default'].I18n.t('mondayShort'), _mailpoet2['default'].I18n.t('tuesdayShort'), _mailpoet2['default'].I18n.t('wednesdayShort'), _mailpoet2['default'].I18n.t('thursdayShort'), _mailpoet2['default'].I18n.t('fridayShort'), _mailpoet2['default'].I18n.t('saturdayShort')],
|
11473 |
-
dayNamesMin: [_mailpoet2['default'].I18n.t('sundayMin'), _mailpoet2['default'].I18n.t('mondayMin'), _mailpoet2['default'].I18n.t('tuesdayMin'), _mailpoet2['default'].I18n.t('wednesdayMin'), _mailpoet2['default'].I18n.t('thursdayMin'), _mailpoet2['default'].I18n.t('fridayMin'), _mailpoet2['default'].I18n.t('saturdayMin')]
|
11474 |
-
};
|
11475 |
-
|
11476 |
-
var DateText = _react2['default'].createClass({
|
11477 |
-
displayName: 'DateText',
|
11478 |
-
|
11479 |
-
onChange: function onChange(event) {
|
11480 |
-
var changeEvent = event;
|
11481 |
-
// Swap display format to storage format
|
11482 |
-
var displayDate = changeEvent.target.value;
|
11483 |
-
var storageDate = this.getStorageDate(displayDate);
|
11484 |
-
|
11485 |
-
changeEvent.target.value = storageDate;
|
11486 |
-
this.props.onChange(changeEvent);
|
11487 |
-
},
|
11488 |
-
componentDidMount: function componentDidMount() {
|
11489 |
-
var $element = (0, _jquery2['default'])(this.dateInput);
|
11490 |
-
var that = this;
|
11491 |
-
if ($element.datepicker) {
|
11492 |
-
// Override jQuery UI datepicker Date parsing and formatting
|
11493 |
-
_jquery2['default'].datepicker.parseDate = function parseDate(format, value) {
|
11494 |
-
// Transform string format to Date object
|
11495 |
-
return _mailpoet2['default'].Date.toDate(value, {
|
11496 |
-
parseFormat: dateDisplayFormat,
|
11497 |
-
format: format
|
11498 |
-
});
|
11499 |
-
};
|
11500 |
-
_jquery2['default'].datepicker.formatDate = function formatDate(format, value) {
|
11501 |
-
// Transform Date object to string format
|
11502 |
-
var newValue = _mailpoet2['default'].Date.format(value, {
|
11503 |
-
format: format
|
11504 |
-
});
|
11505 |
-
return newValue;
|
11506 |
-
};
|
11507 |
-
|
11508 |
-
$element.datepicker(_underscore2['default'].extend({
|
11509 |
-
dateFormat: this.props.displayFormat,
|
11510 |
-
isRTL: false,
|
11511 |
-
onSelect: function onSelect(value) {
|
11512 |
-
that.onChange({
|
11513 |
-
target: {
|
11514 |
-
name: that.getFieldName(),
|
11515 |
-
value: value
|
11516 |
-
}
|
11517 |
-
});
|
11518 |
-
}
|
11519 |
-
}, datepickerTranslations));
|
11520 |
-
|
11521 |
-
this.datepickerInitialized = true;
|
11522 |
-
}
|
11523 |
-
},
|
11524 |
-
componentWillUnmount: function componentWillUnmount() {
|
11525 |
-
if (this.datepickerInitialized) {
|
11526 |
-
(0, _jquery2['default'])(this.dateInput).datepicker('destroy');
|
11527 |
-
}
|
11528 |
-
},
|
11529 |
-
getFieldName: function getFieldName() {
|
11530 |
-
return this.props.name || 'date';
|
11531 |
-
},
|
11532 |
-
getDisplayDate: function getDisplayDate(date) {
|
11533 |
-
return _mailpoet2['default'].Date.format(date, {
|
11534 |
-
parseFormat: this.props.storageFormat,
|
11535 |
-
format: this.props.displayFormat
|
11536 |
-
});
|
11537 |
-
},
|
11538 |
-
getStorageDate: function getStorageDate(date) {
|
11539 |
-
return _mailpoet2['default'].Date.format(date, {
|
11540 |
-
parseFormat: this.props.displayFormat,
|
11541 |
-
format: this.props.storageFormat
|
11542 |
-
});
|
11543 |
-
},
|
11544 |
-
render: function render() {
|
11545 |
-
var _this = this;
|
11546 |
-
|
11547 |
-
return _react2['default'].createElement('input', _extends({
|
11548 |
-
type: 'text',
|
11549 |
-
size: '10',
|
11550 |
-
name: this.getFieldName(),
|
11551 |
-
value: this.getDisplayDate(this.props.value),
|
11552 |
-
readOnly: true,
|
11553 |
-
disabled: this.props.disabled,
|
11554 |
-
onChange: this.onChange,
|
11555 |
-
ref: function (c) {
|
11556 |
-
_this.dateInput = c;
|
11557 |
-
}
|
11558 |
-
}, this.props.validation));
|
11559 |
-
}
|
11560 |
-
});
|
11561 |
-
|
11562 |
-
var TimeSelect = _react2['default'].createClass({
|
11563 |
-
displayName: 'TimeSelect',
|
11564 |
-
|
11565 |
-
render: function render() {
|
11566 |
-
var options = Object.keys(timeOfDayItems).map(function (value) {
|
11567 |
-
return _react2['default'].createElement(
|
11568 |
-
'option',
|
11569 |
-
{
|
11570 |
-
key: 'option-' + timeOfDayItems[value],
|
11571 |
-
value: value
|
11572 |
-
},
|
11573 |
-
timeOfDayItems[value]
|
11574 |
-
);
|
11575 |
-
});
|
11576 |
-
|
11577 |
-
return _react2['default'].createElement(
|
11578 |
-
'select',
|
11579 |
-
_extends({
|
11580 |
-
name: this.props.name || 'time',
|
11581 |
-
value: this.props.value,
|
11582 |
-
disabled: this.props.disabled,
|
11583 |
-
onChange: this.props.onChange
|
11584 |
-
}, this.props.validation),
|
11585 |
-
options
|
11586 |
-
);
|
11587 |
-
}
|
11588 |
-
});
|
11589 |
-
|
11590 |
-
var DateTime = _react2['default'].createClass({
|
11591 |
-
displayName: 'DateTime',
|
11592 |
-
|
11593 |
-
DATE_TIME_SEPARATOR: ' ',
|
11594 |
-
getInitialState: function getInitialState() {
|
11595 |
-
return this.buildStateFromProps(this.props);
|
11596 |
-
},
|
11597 |
-
componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
|
11598 |
-
this.setState(this.buildStateFromProps(nextProps));
|
11599 |
-
},
|
11600 |
-
buildStateFromProps: function buildStateFromProps(props) {
|
11601 |
-
var value = props.value || defaultDateTime;
|
11602 |
-
|
11603 |
-
var _value$split = value.split(this.DATE_TIME_SEPARATOR);
|
11604 |
-
|
11605 |
-
var _value$split2 = _slicedToArray(_value$split, 2);
|
11606 |
-
|
11607 |
-
var date = _value$split2[0];
|
11608 |
-
var time = _value$split2[1];
|
11609 |
-
|
11610 |
-
return {
|
11611 |
-
date: date,
|
11612 |
-
time: time
|
11613 |
-
};
|
11614 |
-
},
|
11615 |
-
handleChange: function handleChange(event) {
|
11616 |
-
var newState = {};
|
11617 |
-
newState[event.target.name] = event.target.value;
|
11618 |
-
|
11619 |
-
this.setState(newState, this.propagateChange);
|
11620 |
-
},
|
11621 |
-
propagateChange: function propagateChange() {
|
11622 |
-
if (this.props.onChange) {
|
11623 |
-
this.props.onChange({
|
11624 |
-
target: {
|
11625 |
-
name: this.props.name || '',
|
11626 |
-
value: this.getDateTime()
|
11627 |
-
}
|
11628 |
-
});
|
11629 |
-
}
|
11630 |
-
},
|
11631 |
-
getDateTime: function getDateTime() {
|
11632 |
-
return [this.state.date, this.state.time].join(this.DATE_TIME_SEPARATOR);
|
11633 |
-
},
|
11634 |
-
render: function render() {
|
11635 |
-
return _react2['default'].createElement(
|
11636 |
-
'span',
|
11637 |
-
null,
|
11638 |
-
_react2['default'].createElement(DateText, {
|
11639 |
-
name: 'date',
|
11640 |
-
value: this.state.date,
|
11641 |
-
onChange: this.handleChange,
|
11642 |
-
displayFormat: dateDisplayFormat,
|
11643 |
-
storageFormat: dateStorageFormat,
|
11644 |
-
disabled: this.props.disabled,
|
11645 |
-
validation: this.props.dateValidation
|
11646 |
-
}),
|
11647 |
-
_react2['default'].createElement(TimeSelect, {
|
11648 |
-
name: 'time',
|
11649 |
-
value: this.state.time,
|
11650 |
-
onChange: this.handleChange,
|
11651 |
-
disabled: this.props.disabled,
|
11652 |
-
validation: this.props.timeValidation
|
11653 |
-
})
|
11654 |
-
);
|
11655 |
-
}
|
11656 |
-
});
|
11657 |
-
|
11658 |
-
var StandardScheduling = _react2['default'].createClass({
|
11659 |
-
displayName: 'StandardScheduling',
|
11660 |
-
|
11661 |
-
getCurrentValue: function getCurrentValue() {
|
11662 |
-
return _underscore2['default'].defaults(this.props.item[this.props.field.name] || {}, {
|
11663 |
-
isScheduled: '0',
|
11664 |
-
scheduledAt: defaultDateTime
|
11665 |
-
});
|
11666 |
-
},
|
11667 |
-
handleValueChange: function handleValueChange(event) {
|
11668 |
-
var oldValue = this.getCurrentValue();
|
11669 |
-
var newValue = {};
|
11670 |
-
newValue[event.target.name] = event.target.value;
|
11671 |
-
|
11672 |
-
return this.props.onValueChange({
|
11673 |
-
target: {
|
11674 |
-
name: this.props.field.name,
|
11675 |
-
value: _underscore2['default'].extend({}, oldValue, newValue)
|
11676 |
-
}
|
11677 |
-
});
|
11678 |
-
},
|
11679 |
-
handleCheckboxChange: function handleCheckboxChange(event) {
|
11680 |
-
var changeEvent = event;
|
11681 |
-
changeEvent.target.value = this.isScheduledInput.checked ? '1' : '0';
|
11682 |
-
return this.handleValueChange(changeEvent);
|
11683 |
-
},
|
11684 |
-
isScheduled: function isScheduled() {
|
11685 |
-
return this.getCurrentValue().isScheduled === '1';
|
11686 |
-
},
|
11687 |
-
getDateValidation: function getDateValidation() {
|
11688 |
-
return {
|
11689 |
-
'data-parsley-required': true,
|
11690 |
-
'data-parsley-required-message': _mailpoet2['default'].I18n.t('noScheduledDateError'),
|
11691 |
-
'data-parsley-errors-container': '#mailpoet_scheduling'
|
11692 |
-
};
|
11693 |
-
},
|
11694 |
-
render: function render() {
|
11695 |
-
var _this2 = this;
|
11696 |
-
|
11697 |
-
var schedulingOptions = undefined;
|
11698 |
-
|
11699 |
-
if (this.isScheduled()) {
|
11700 |
-
schedulingOptions = _react2['default'].createElement(
|
11701 |
-
'span',
|
11702 |
-
{ id: 'mailpoet_scheduling' },
|
11703 |
-
_react2['default'].createElement(DateTime, {
|
11704 |
-
name: 'scheduledAt',
|
11705 |
-
value: this.getCurrentValue().scheduledAt,
|
11706 |
-
onChange: this.handleValueChange,
|
11707 |
-
disabled: this.props.field.disabled,
|
11708 |
-
dateValidation: this.getDateValidation()
|
11709 |
-
}),
|
11710 |
-
' ',
|
11711 |
-
_react2['default'].createElement(
|
11712 |
-
'span',
|
11713 |
-
null,
|
11714 |
-
_mailpoet2['default'].I18n.t('websiteTimeIs'),
|
11715 |
-
' ',
|
11716 |
-
_react2['default'].createElement(
|
11717 |
-
'code',
|
11718 |
-
null,
|
11719 |
-
currentTime
|
11720 |
-
)
|
11721 |
-
)
|
11722 |
-
);
|
11723 |
-
}
|
11724 |
-
return _react2['default'].createElement(
|
11725 |
-
'div',
|
11726 |
-
null,
|
11727 |
-
_react2['default'].createElement('input', {
|
11728 |
-
ref: function (c) {
|
11729 |
-
_this2.isScheduledInput = c;
|
11730 |
-
},
|
11731 |
-
type: 'checkbox',
|
11732 |
-
value: '1',
|
11733 |
-
checked: this.isScheduled(),
|
11734 |
-
disabled: this.props.field.disabled,
|
11735 |
-
name: 'isScheduled',
|
11736 |
-
onChange: this.handleCheckboxChange
|
11737 |
-
}),
|
11738 |
-
schedulingOptions
|
11739 |
-
);
|
11740 |
-
}
|
11741 |
-
});
|
11742 |
-
|
11743 |
-
var fields = [{
|
11744 |
-
name: 'subject',
|
11745 |
-
label: _mailpoet2['default'].I18n.t('subjectLine'),
|
11746 |
-
tip: _mailpoet2['default'].I18n.t('subjectLineTip'),
|
11747 |
-
type: 'text',
|
11748 |
-
validation: {
|
11749 |
-
'data-parsley-required': true,
|
11750 |
-
'data-parsley-required-message': _mailpoet2['default'].I18n.t('emptySubjectLineError')
|
11751 |
-
}
|
11752 |
-
}, {
|
11753 |
-
name: 'segments',
|
11754 |
-
label: _mailpoet2['default'].I18n.t('segments'),
|
11755 |
-
tip: _mailpoet2['default'].I18n.t('segmentsTip'),
|
11756 |
-
type: 'selection',
|
11757 |
-
placeholder: _mailpoet2['default'].I18n.t('selectSegmentPlaceholder'),
|
11758 |
-
id: 'mailpoet_segments',
|
11759 |
-
api_version: window.mailpoet_api_version,
|
11760 |
-
endpoint: 'segments',
|
11761 |
-
multiple: true,
|
11762 |
-
filter: function filter(segment) {
|
11763 |
-
return !segment.deleted_at;
|
11764 |
-
},
|
11765 |
-
getLabel: function getLabel(segment) {
|
11766 |
-
return segment.name + ' (' + parseInt(segment.subscribers, 10).toLocaleString() + ')';
|
11767 |
-
},
|
11768 |
-
transformChangedValue: function transformChangedValue(segmentIds) {
|
11769 |
-
var allSegments = this.getItems();
|
11770 |
-
return _underscore2['default'].map(segmentIds, function (id) {
|
11771 |
-
return _underscore2['default'].find(allSegments, function (segment) {
|
11772 |
-
return segment.id === id;
|
11773 |
-
});
|
11774 |
-
});
|
11775 |
-
},
|
11776 |
-
validation: {
|
11777 |
-
'data-parsley-required': true,
|
11778 |
-
'data-parsley-required-message': _mailpoet2['default'].I18n.t('noSegmentsSelectedError')
|
11779 |
-
}
|
11780 |
-
}, {
|
11781 |
-
name: 'sender',
|
11782 |
-
label: _mailpoet2['default'].I18n.t('sender'),
|
11783 |
-
tip: _mailpoet2['default'].I18n.t('senderTip'),
|
11784 |
-
fields: [{
|
11785 |
-
name: 'sender_name',
|
11786 |
-
type: 'text',
|
11787 |
-
placeholder: _mailpoet2['default'].I18n.t('senderNamePlaceholder'),
|
11788 |
-
validation: {
|
11789 |
-
'data-parsley-required': true
|
11790 |
-
}
|
11791 |
-
}, {
|
11792 |
-
name: 'sender_address',
|
11793 |
-
type: 'text',
|
11794 |
-
placeholder: _mailpoet2['default'].I18n.t('senderAddressPlaceholder'),
|
11795 |
-
validation: {
|
11796 |
-
'data-parsley-required': true,
|
11797 |
-
'data-parsley-type': 'email'
|
11798 |
-
}
|
11799 |
-
}]
|
11800 |
-
}, {
|
11801 |
-
name: 'reply-to',
|
11802 |
-
label: _mailpoet2['default'].I18n.t('replyTo'),
|
11803 |
-
tip: _mailpoet2['default'].I18n.t('replyToTip'),
|
11804 |
-
inline: true,
|
11805 |
-
fields: [{
|
11806 |
-
name: 'reply_to_name',
|
11807 |
-
type: 'text',
|
11808 |
-
placeholder: _mailpoet2['default'].I18n.t('replyToNamePlaceholder')
|
11809 |
-
}, {
|
11810 |
-
name: 'reply_to_address',
|
11811 |
-
type: 'text',
|
11812 |
-
placeholder: _mailpoet2['default'].I18n.t('replyToAddressPlaceholder'),
|
11813 |
-
validation: {
|
11814 |
-
'data-parsley-type': 'email'
|
11815 |
-
}
|
11816 |
-
}]
|
11817 |
-
}, {
|
11818 |
-
name: 'options',
|
11819 |
-
label: _mailpoet2['default'].I18n.t('scheduleIt'),
|
11820 |
-
type: 'reactComponent',
|
11821 |
-
component: StandardScheduling
|
11822 |
-
}];
|
11823 |
-
|
11824 |
-
fields = _wpJsHooks2['default'].applyFilters('mailpoet_newsletters_3rd_step_fields', fields);
|
11825 |
-
|
11826 |
-
module.exports = {
|
11827 |
-
getFields: function getFields() {
|
11828 |
-
return fields;
|
11829 |
-
},
|
11830 |
-
getSendButtonOptions: function getSendButtonOptions(newsletter) {
|
11831 |
-
var newsletterOptions = newsletter || {};
|
11832 |
-
|
11833 |
-
var isScheduled = typeof newsletterOptions.options === 'object' && newsletterOptions.options.isScheduled === '1';
|
11834 |
-
var options = {
|
11835 |
-
value: isScheduled ? _mailpoet2['default'].I18n.t('schedule') : _mailpoet2['default'].I18n.t('send')
|
11836 |
-
};
|
11837 |
-
|
11838 |
-
if (newsletterOptions.status === 'sent' || newsletterOptions.status === 'sending') {
|
11839 |
-
options.disabled = 'disabled';
|
11840 |
-
}
|
11841 |
-
|
11842 |
-
return options;
|
11843 |
-
}
|
11844 |
-
};
|
11845 |
-
|
11846 |
-
/***/ },
|
11847 |
-
|
11848 |
-
/***/ 534:
|
11849 |
-
/***/ function(module, exports, __webpack_require__) {
|
11850 |
-
|
11851 |
-
'use strict';
|
11852 |
-
|
11853 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
11854 |
-
|
11855 |
-
var _underscore = __webpack_require__(281);
|
11856 |
-
|
11857 |
-
var _underscore2 = _interopRequireDefault(_underscore);
|
11858 |
-
|
11859 |
-
var _mailpoet = __webpack_require__(276);
|
11860 |
-
|
11861 |
-
var _mailpoet2 = _interopRequireDefault(_mailpoet);
|
11862 |
-
|
11863 |
-
var _wpJsHooks = __webpack_require__(438);
|
11864 |
-
|
11865 |
-
var _wpJsHooks2 = _interopRequireDefault(_wpJsHooks);
|
11866 |
-
|
11867 |
-
var _newslettersTypesNotificationSchedulingJsx = __webpack_require__(535);
|
11868 |
-
|
11869 |
-
var _newslettersTypesNotificationSchedulingJsx2 = _interopRequireDefault(_newslettersTypesNotificationSchedulingJsx);
|
11870 |
-
|
11871 |
-
var fields = [{
|
11872 |
-
name: 'subject',
|
11873 |
-
label: _mailpoet2['default'].I18n.t('subjectLine'),
|
11874 |
-
tip: _mailpoet2['default'].I18n.t('postNotificationSubjectLineTip'),
|
11875 |
-
type: 'text',
|
11876 |
-
validation: {
|
11877 |
-
'data-parsley-required': true,
|
11878 |
-
'data-parsley-required-message': _mailpoet2['default'].I18n.t('emptySubjectLineError')
|
11879 |
-
}
|
11880 |
-
}, {
|
11881 |
-
name: 'options',
|
11882 |
-
label: _mailpoet2['default'].I18n.t('selectFrequency'),
|
11883 |
-
type: 'reactComponent',
|
11884 |
-
component: _newslettersTypesNotificationSchedulingJsx2['default']
|
11885 |
-
}, {
|
11886 |
-
name: 'segments',
|
11887 |
-
label: _mailpoet2['default'].I18n.t('segments'),
|
11888 |
-
tip: _mailpoet2['default'].I18n.t('segmentsTip'),
|
11889 |
-
type: 'selection',
|
11890 |
-
placeholder: _mailpoet2['default'].I18n.t('selectSegmentPlaceholder'),
|
11891 |
-
id: 'mailpoet_segments',
|
11892 |
-
api_version: window.mailpoet_api_version,
|
11893 |
-
endpoint: 'segments',
|
11894 |
-
multiple: true,
|
11895 |
-
filter: function filter(segment) {
|
11896 |
-
return !segment.deleted_at;
|
11897 |
-
},
|
11898 |
-
getLabel: function getLabel(segment) {
|
11899 |
-
return segment.name + ' (' + parseInt(segment.subscribers, 10).toLocaleString() + ')';
|
11900 |
-
},
|
11901 |
-
transformChangedValue: function transformChangedValue(segmentIds) {
|
11902 |
-
var allSegments = this.getItems();
|
11903 |
-
return _underscore2['default'].map(segmentIds, function (id) {
|
11904 |
-
return _underscore2['default'].find(allSegments, function (segment) {
|
11905 |
-
return segment.id === id;
|
11906 |
-
});
|
11907 |
-
});
|
11908 |
-
},
|
11909 |
-
validation: {
|
11910 |
-
'data-parsley-required': true,
|
11911 |
-
'data-parsley-required-message': _mailpoet2['default'].I18n.t('noSegmentsSelectedError')
|
11912 |
-
}
|
11913 |
-
}, {
|
11914 |
-
name: 'sender',
|
11915 |
-
label: _mailpoet2['default'].I18n.t('sender'),
|
11916 |
-
tip: _mailpoet2['default'].I18n.t('senderTip'),
|
11917 |
-
fields: [{
|
11918 |
-
name: 'sender_name',
|
11919 |
-
type: 'text',
|
11920 |
-
placeholder: _mailpoet2['default'].I18n.t('senderNamePlaceholder'),
|
11921 |
-
validation: {
|
11922 |
-
'data-parsley-required': true
|
11923 |
-
}
|
11924 |
-
}, {
|
11925 |
-
name: 'sender_address',
|
11926 |
-
type: 'text',
|
11927 |
-
placeholder: _mailpoet2['default'].I18n.t('senderAddressPlaceholder'),
|
11928 |
-
validation: {
|
11929 |
-
'data-parsley-required': true,
|
11930 |
-
'data-parsley-type': 'email'
|
11931 |
-
}
|
11932 |
-
}]
|
11933 |
-
}, {
|
11934 |
-
name: 'reply-to',
|
11935 |
-
label: _mailpoet2['default'].I18n.t('replyTo'),
|
11936 |
-
tip: _mailpoet2['default'].I18n.t('replyToTip'),
|
11937 |
-
inline: true,
|
11938 |
-
fields: [{
|
11939 |
-
name: 'reply_to_name',
|
11940 |
-
type: 'text',
|
11941 |
-
placeholder: _mailpoet2['default'].I18n.t('replyToNamePlaceholder')
|
11942 |
-
}, {
|
11943 |
-
name: 'reply_to_address',
|
11944 |
-
type: 'text',
|
11945 |
-
placeholder: _mailpoet2['default'].I18n.t('replyToAddressPlaceholder'),
|
11946 |
-
validation: {
|
11947 |
-
'data-parsley-type': 'email'
|
11948 |
-
}
|
11949 |
-
}]
|
11950 |
-
}];
|
11951 |
-
|
11952 |
-
fields = _wpJsHooks2['default'].applyFilters('mailpoet_newsletters_3rd_step_fields', fields);
|
11953 |
-
|
11954 |
-
module.exports = {
|
11955 |
-
getFields: function getFields() {
|
11956 |
-
return fields;
|
11957 |
-
},
|
11958 |
-
getSendButtonOptions: function getSendButtonOptions() {
|
11959 |
-
return {
|
11960 |
-
value: _mailpoet2['default'].I18n.t('activate')
|
11961 |
-
};
|
11962 |
-
}
|
11963 |
-
};
|
11964 |
-
|
11965 |
-
/***/ },
|
11966 |
-
|
11967 |
-
/***/ 535:
|
11968 |
-
/***/ function(module, exports, __webpack_require__) {
|
11969 |
-
|
11970 |
-
'use strict';
|
11971 |
-
|
11972 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
11973 |
-
|
11974 |
-
var _underscore = __webpack_require__(281);
|
11975 |
-
|
11976 |
-
var _underscore2 = _interopRequireDefault(_underscore);
|
11977 |
-
|
11978 |
-
var _react = __webpack_require__(2);
|
11979 |
-
|
11980 |
-
var _react2 = _interopRequireDefault(_react);
|
11981 |
-
|
11982 |
-
var _formFieldsSelectJsx = __webpack_require__(301);
|
11983 |
-
|
11984 |
-
var _formFieldsSelectJsx2 = _interopRequireDefault(_formFieldsSelectJsx);
|
11985 |
-
|
11986 |
-
var _newslettersSchedulingCommonJsx = __webpack_require__(536);
|
11987 |
-
|
11988 |
-
var intervalField = {
|
11989 |
-
name: 'intervalType',
|
11990 |
-
values: _newslettersSchedulingCommonJsx.intervalValues
|
11991 |
-
};
|
11992 |
-
|
11993 |
-
var timeOfDayField = {
|
11994 |
-
name: 'timeOfDay',
|
11995 |
-
values: _newslettersSchedulingCommonJsx.timeOfDayValues
|
11996 |
-
};
|
11997 |
-
|
11998 |
-
var weekDayField = {
|
11999 |
-
name: 'weekDay',
|
12000 |
-
values: _newslettersSchedulingCommonJsx.weekDayValues
|
12001 |
-
};
|
12002 |
-
|
12003 |
-
var monthDayField = {
|
12004 |
-
name: 'monthDay',
|
12005 |
-
values: _newslettersSchedulingCommonJsx.monthDayValues
|
12006 |
-
};
|
12007 |
-
|
12008 |
-
var nthWeekDayField = {
|
12009 |
-
name: 'nthWeekDay',
|
12010 |
-
values: _newslettersSchedulingCommonJsx.nthWeekDayValues
|
12011 |
-
};
|
12012 |
-
|
12013 |
-
var NotificationScheduling = _react2['default'].createClass({
|
12014 |
-
displayName: 'NotificationScheduling',
|
12015 |
-
|
12016 |
-
getCurrentValue: function getCurrentValue() {
|
12017 |
-
return this.props.item[this.props.field.name] || {};
|
12018 |
-
},
|
12019 |
-
handleValueChange: function handleValueChange(name, value) {
|
12020 |
-
var oldValue = this.getCurrentValue();
|
12021 |
-
var newValue = {};
|
12022 |
-
|
12023 |
-
newValue[name] = value;
|
12024 |
-
|
12025 |
-
return this.props.onValueChange({
|
12026 |
-
target: {
|
12027 |
-
name: this.props.field.name,
|
12028 |
-
value: _underscore2['default'].extend({}, oldValue, newValue)
|
12029 |
-
}
|
12030 |
-
});
|
12031 |
-
},
|
12032 |
-
handleIntervalChange: function handleIntervalChange(event) {
|
12033 |
-
return this.handleValueChange('intervalType', event.target.value);
|
12034 |
-
},
|
12035 |
-
handleTimeOfDayChange: function handleTimeOfDayChange(event) {
|
12036 |
-
return this.handleValueChange('timeOfDay', event.target.value);
|
12037 |
-
},
|
12038 |
-
handleWeekDayChange: function handleWeekDayChange(event) {
|
12039 |
-
return this.handleValueChange('weekDay', event.target.value);
|
12040 |
-
},
|
12041 |
-
handleMonthDayChange: function handleMonthDayChange(event) {
|
12042 |
-
return this.handleValueChange('monthDay', event.target.value);
|
12043 |
-
},
|
12044 |
-
handleNthWeekDayChange: function handleNthWeekDayChange(event) {
|
12045 |
-
return this.handleValueChange('nthWeekDay', event.target.value);
|
12046 |
-
},
|
12047 |
-
render: function render() {
|
12048 |
-
var value = this.getCurrentValue();
|
12049 |
-
var timeOfDaySelection = undefined;
|
12050 |
-
var weekDaySelection = undefined;
|
12051 |
-
var monthDaySelection = undefined;
|
12052 |
-
var nthWeekDaySelection = undefined;
|
12053 |
-
|
12054 |
-
if (value.intervalType !== 'immediately') {
|
12055 |
-
timeOfDaySelection = _react2['default'].createElement(_formFieldsSelectJsx2['default'], {
|
12056 |
-
field: timeOfDayField,
|
12057 |
-
item: this.getCurrentValue(),
|
12058 |
-
onValueChange: this.handleTimeOfDayChange
|
12059 |
-
});
|
12060 |
-
}
|
12061 |
-
|
12062 |
-
if (value.intervalType === 'weekly' || value.intervalType === 'nthWeekDay') {
|
12063 |
-
weekDaySelection = _react2['default'].createElement(_formFieldsSelectJsx2['default'], {
|
12064 |
-
field: weekDayField,
|
12065 |
-
item: this.getCurrentValue(),
|
12066 |
-
onValueChange: this.handleWeekDayChange
|
12067 |
-
});
|
12068 |
-
}
|
12069 |
-
|
12070 |
-
if (value.intervalType === 'monthly') {
|
12071 |
-
monthDaySelection = _react2['default'].createElement(_formFieldsSelectJsx2['default'], {
|
12072 |
-
field: monthDayField,
|
12073 |
-
item: this.getCurrentValue(),
|
12074 |
-
onValueChange: this.handleMonthDayChange
|
12075 |
-
});
|
12076 |
-
}
|
12077 |
-
|
12078 |
-
if (value.intervalType === 'nthWeekDay') {
|
12079 |
-
nthWeekDaySelection = _react2['default'].createElement(_formFieldsSelectJsx2['default'], {
|
12080 |
-
field: nthWeekDayField,
|
12081 |
-
item: this.getCurrentValue(),
|
12082 |
-
onValueChange: this.handleNthWeekDayChange
|
12083 |
-
});
|
12084 |
-
}
|
12085 |
-
|
12086 |
-
return _react2['default'].createElement(
|
12087 |
-
'div',
|
12088 |
-
null,
|
12089 |
-
_react2['default'].createElement(_formFieldsSelectJsx2['default'], {
|
12090 |
-
field: intervalField,
|
12091 |
-
item: this.getCurrentValue(),
|
12092 |
-
onValueChange: this.handleIntervalChange
|
12093 |
-
}),
|
12094 |
-
nthWeekDaySelection,
|
12095 |
-
monthDaySelection,
|
12096 |
-
weekDaySelection,
|
12097 |
-
timeOfDaySelection
|
12098 |
-
);
|
12099 |
-
}
|
12100 |
-
});
|
12101 |
-
|
12102 |
-
module.exports = NotificationScheduling;
|
12103 |
-
|
12104 |
-
/***/ },
|
12105 |
-
|
12106 |
-
/***/ 538:
|
12107 |
-
/***/ function(module, exports, __webpack_require__) {
|
12108 |
-
|
12109 |
-
'use strict';
|
12110 |
-
|
12111 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
12112 |
-
|
12113 |
-
var _mailpoet = __webpack_require__(276);
|
12114 |
-
|
12115 |
-
var _mailpoet2 = _interopRequireDefault(_mailpoet);
|
12116 |
-
|
12117 |
-
var _wpJsHooks = __webpack_require__(438);
|
12118 |
-
|
12119 |
-
var _wpJsHooks2 = _interopRequireDefault(_wpJsHooks);
|
12120 |
-
|
12121 |
-
var _newslettersTypesWelcomeSchedulingJsx = __webpack_require__(539);
|
12122 |
-
|
12123 |
-
var _newslettersTypesWelcomeSchedulingJsx2 = _interopRequireDefault(_newslettersTypesWelcomeSchedulingJsx);
|
12124 |
-
|
12125 |
-
var fields = [{
|
12126 |
-
name: 'subject',
|
12127 |
-
label: _mailpoet2['default'].I18n.t('subjectLine'),
|
12128 |
-
tip: _mailpoet2['default'].I18n.t('subjectLineTip'),
|
12129 |
-
type: 'text',
|
12130 |
-
validation: {
|
12131 |
-
'data-parsley-required': true,
|
12132 |
-
'data-parsley-required-message': _mailpoet2['default'].I18n.t('emptySubjectLineError')
|
12133 |
-
}
|
12134 |
-
}, {
|
12135 |
-
name: 'options',
|
12136 |
-
label: _mailpoet2['default'].I18n.t('sendWelcomeEmailWhen'),
|
12137 |
-
type: 'reactComponent',
|
12138 |
-
component: _newslettersTypesWelcomeSchedulingJsx2['default']
|
12139 |
-
}, {
|
12140 |
-
name: 'sender',
|
12141 |
-
label: _mailpoet2['default'].I18n.t('sender'),
|
12142 |
-
tip: _mailpoet2['default'].I18n.t('senderTip'),
|
12143 |
-
fields: [{
|
12144 |
-
name: 'sender_name',
|
12145 |
-
type: 'text',
|
12146 |
-
placeholder: _mailpoet2['default'].I18n.t('senderNamePlaceholder'),
|
12147 |
-
validation: {
|
12148 |
-
'data-parsley-required': true
|
12149 |
-
}
|
12150 |
-
}, {
|
12151 |
-
name: 'sender_address',
|
12152 |
-
type: 'text',
|
12153 |
-
placeholder: _mailpoet2['default'].I18n.t('senderAddressPlaceholder'),
|
12154 |
-
validation: {
|
12155 |
-
'data-parsley-required': true,
|
12156 |
-
'data-parsley-type': 'email'
|
12157 |
-
}
|
12158 |
-
}]
|
12159 |
-
}, {
|
12160 |
-
name: 'reply-to',
|
12161 |
-
label: _mailpoet2['default'].I18n.t('replyTo'),
|
12162 |
-
tip: _mailpoet2['default'].I18n.t('replyToTip'),
|
12163 |
-
inline: true,
|
12164 |
-
fields: [{
|
12165 |
-
name: 'reply_to_name',
|
12166 |
-
type: 'text',
|
12167 |
-
placeholder: _mailpoet2['default'].I18n.t('replyToNamePlaceholder')
|
12168 |
-
}, {
|
12169 |
-
name: 'reply_to_address',
|
12170 |
-
type: 'text',
|
12171 |
-
placeholder: _mailpoet2['default'].I18n.t('replyToAddressPlaceholder'),
|
12172 |
-
validation: {
|
12173 |
-
'data-parsley-type': 'email'
|
12174 |
-
}
|
12175 |
-
}]
|
12176 |
-
}];
|
12177 |
-
|
12178 |
-
fields = _wpJsHooks2['default'].applyFilters('mailpoet_newsletters_3rd_step_fields', fields);
|
12179 |
-
|
12180 |
-
module.exports = {
|
12181 |
-
getFields: function getFields() {
|
12182 |
-
return fields;
|
12183 |
-
},
|
12184 |
-
getSendButtonOptions: function getSendButtonOptions() {
|
12185 |
-
return {
|
12186 |
-
value: _mailpoet2['default'].I18n.t('activate')
|
12187 |
-
};
|
12188 |
-
}
|
12189 |
-
};
|
12190 |
-
|
12191 |
-
/***/ },
|
12192 |
-
|
12193 |
-
/***/ 541:
|
12194 |
-
/***/ function(module, exports, __webpack_require__) {
|
12195 |
-
|
12196 |
-
'use strict';
|
12197 |
-
|
12198 |
-
Object.defineProperty(exports, '__esModule', {
|
12199 |
-
value: true
|
12200 |
-
});
|
12201 |
-
|
12202 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
12203 |
-
|
12204 |
-
var _underscore = __webpack_require__(281);
|
12205 |
-
|
12206 |
-
var _underscore2 = _interopRequireDefault(_underscore);
|
12207 |
-
|
12208 |
-
var _mailpoet = __webpack_require__(276);
|
12209 |
-
|
12210 |
-
var _mailpoet2 = _interopRequireDefault(_mailpoet);
|
12211 |
-
|
12212 |
-
var _html2canvas = __webpack_require__(542);
|
12213 |
-
|
12214 |
-
var _html2canvas2 = _interopRequireDefault(_html2canvas);
|
12215 |
-
|
12216 |
-
/**
|
12217 |
-
* Generates a thumbnail from a DOM element.
|
12218 |
-
*
|
12219 |
-
* @param {DOMElement} element
|
12220 |
-
* @return {Promise<String>} DataURL of the generated image.
|
12221 |
-
*/
|
12222 |
-
var fromDom = function fromDom(element) {
|
12223 |
-
return (0, _html2canvas2['default'])(element, {
|
12224 |
-
logging: false
|
12225 |
-
}).then(function (canvas) {
|
12226 |
-
return canvas.toDataURL('image/jpeg');
|
12227 |
-
});
|
12228 |
-
};
|
12229 |
-
|
12230 |
-
exports.fromDom = fromDom;
|
12231 |
-
/**
|
12232 |
-
* Generates a thumbnail from an URL.
|
12233 |
-
*
|
12234 |
-
* @param {String} url
|
12235 |
-
* @return {Promise<String>} DataURL of the generated image.
|
12236 |
-
*/
|
12237 |
-
var fromUrl = function fromUrl(url) {
|
12238 |
-
return new Promise(function (resolve, reject) {
|
12239 |
-
var iframe = document.createElement('iframe');
|
12240 |
-
var protocol = location.href.startsWith('https://') ? 'https:' : 'http:';
|
12241 |
-
iframe.src = protocol + url.replace(/^https?:/, '');
|
12242 |
-
iframe.style.opacity = 0;
|
12243 |
-
iframe.scrolling = 'no';
|
12244 |
-
iframe.onload = function () {
|
12245 |
-
fromDom(iframe.contentDocument.documentElement).then(function (image) {
|
12246 |
-
document.body.removeChild(iframe);
|
12247 |
-
resolve(image);
|
12248 |
-
})['catch'](function () {
|
12249 |
-
document.body.removeChild(iframe);
|
12250 |
-
reject(_mailpoet2['default'].I18n.t('errorWhileTakingScreenshot'));
|
12251 |
-
});
|
12252 |
-
};
|
12253 |
-
var onError = function onError() {
|
12254 |
-
document.body.removeChild(iframe);
|
12255 |
-
reject(_mailpoet2['default'].I18n.t('errorWhileTakingScreenshot'));
|
12256 |
-
};
|
12257 |
-
iframe.onerror = onError;
|
12258 |
-
iframe.onError = onError;
|
12259 |
-
iframe.className = 'mailpoet_template_iframe';
|
12260 |
-
try {
|
12261 |
-
document.body.appendChild(iframe);
|
12262 |
-
} catch (err) {
|
12263 |
-
onError();
|
12264 |
-
}
|
12265 |
-
});
|
12266 |
-
};
|
12267 |
-
|
12268 |
-
exports.fromUrl = fromUrl;
|
12269 |
-
/**
|
12270 |
-
* Generates a thumbnail from a newsletter's data.
|
12271 |
-
*
|
12272 |
-
* @param {Object} data
|
12273 |
-
* @return {Promise<String>} DataURL of the generated image.
|
12274 |
-
*/
|
12275 |
-
var fromNewsletter = function fromNewsletter(data) {
|
12276 |
-
return new Promise(function (resolve, reject) {
|
12277 |
-
var json = data;
|
12278 |
-
if (!_underscore2['default'].isUndefined(json.body)) {
|
12279 |
-
json.body = JSON.stringify(json.body);
|
12280 |
-
}
|
12281 |
-
_mailpoet2['default'].Ajax.post({
|
12282 |
-
api_version: window.mailpoet_api_version,
|
12283 |
-
endpoint: 'newsletters',
|
12284 |
-
action: 'showPreview',
|
12285 |
-
data: json
|
12286 |
-
}).done(function (response) {
|
12287 |
-
return fromUrl(response.meta.preview_url).then(resolve)['catch'](reject);
|
12288 |
-
}).fail(function (response) {
|
12289 |
-
return reject(response.errors);
|
12290 |
-
});
|
12291 |
-
});
|
12292 |
-
};
|
12293 |
-
exports.fromNewsletter = fromNewsletter;
|
12294 |
-
|
12295 |
-
/***/ },
|
12296 |
-
|
12297 |
-
/***/ 542:
|
12298 |
-
/***/ function(module, exports, __webpack_require__) {
|
12299 |
-
|
12300 |
-
/* WEBPACK VAR INJECTION */(function(global) {module.exports = global["html2canvas"] = __webpack_require__(543);
|
12301 |
-
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
|
12302 |
-
|
12303 |
-
/***/ },
|
12304 |
-
|
12305 |
-
/***/ 543:
|
12306 |
-
/***/ function(module, exports, __webpack_require__) {
|
12307 |
-
|
12308 |
-
/*!
|
12309 |
-
* html2canvas 1.0.0-alpha.12 <https://html2canvas.hertzen.com>
|
12310 |
-
* Copyright (c) 2018 Niklas von Hertzen <https://hertzen.com>
|
12311 |
-
* Released under MIT License
|
12312 |
-
*/
|
12313 |
-
(function webpackUniversalModuleDefinition(root, factory) {
|
12314 |
-
if(true)
|
12315 |
-
module.exports = factory();
|
12316 |
-
else if(typeof define === 'function' && define.amd)
|
12317 |
-
define([], factory);
|
12318 |
-
else if(typeof exports === 'object')
|
12319 |
-
exports["html2canvas"] = factory();
|
12320 |
-
else
|
12321 |
-
root["html2canvas"] = factory();
|
12322 |
-
})(this, function() {
|
12323 |
-
return /******/ (function(modules) { // webpackBootstrap
|
12324 |
-
/******/ // The module cache
|
12325 |
-
/******/ var installedModules = {};
|
12326 |
-
/******/
|
12327 |
-
/******/ // The require function
|
12328 |
-
/******/ function __webpack_require__(moduleId) {
|
12329 |
-
/******/
|
12330 |
-
/******/ // Check if module is in cache
|
12331 |
-
/******/ if(installedModules[moduleId]) {
|
12332 |
-
/******/ return installedModules[moduleId].exports;
|
12333 |
-
/******/ }
|
12334 |
-
/******/ // Create a new module (and put it into the cache)
|
12335 |
-
/******/ var module = installedModules[moduleId] = {
|
12336 |
-
/******/ i: moduleId,
|
12337 |
-
/******/ l: false,
|
12338 |
-
/******/ exports: {}
|
12339 |
-
/******/ };
|
12340 |
-
/******/
|
12341 |
-
/******/ // Execute the module function
|
12342 |
-
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
12343 |
-
/******/
|
12344 |
-
/******/ // Flag the module as loaded
|
12345 |
-
/******/ module.l = true;
|
12346 |
-
/******/
|
12347 |
-
/******/ // Return the exports of the module
|
12348 |
-
/******/ return module.exports;
|
12349 |
-
/******/ }
|
12350 |
-
/******/
|
12351 |
-
/******/
|
12352 |
-
/******/ // expose the modules object (__webpack_modules__)
|
12353 |
-
/******/ __webpack_require__.m = modules;
|
12354 |
-
/******/
|
12355 |
-
/******/ // expose the module cache
|
12356 |
-
/******/ __webpack_require__.c = installedModules;
|
12357 |
-
/******/
|
12358 |
-
/******/ // define getter function for harmony exports
|
12359 |
-
/******/ __webpack_require__.d = function(exports, name, getter) {
|
12360 |
-
/******/ if(!__webpack_require__.o(exports, name)) {
|
12361 |
-
/******/ Object.defineProperty(exports, name, {
|
12362 |
-
/******/ configurable: false,
|
12363 |
-
/******/ enumerable: true,
|
12364 |
-
/******/ get: getter
|
12365 |
-
/******/ });
|
12366 |
-
/******/ }
|
12367 |
-
/******/ };
|
12368 |
-
/******/
|
12369 |
-
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
12370 |
-
/******/ __webpack_require__.n = function(module) {
|
12371 |
-
/******/ var getter = module && module.__esModule ?
|
12372 |
-
/******/ function getDefault() { return module['default']; } :
|
12373 |
-
/******/ function getModuleExports() { return module; };
|
12374 |
-
/******/ __webpack_require__.d(getter, 'a', getter);
|
12375 |
-
/******/ return getter;
|
12376 |
-
/******/ };
|
12377 |
-
/******/
|
12378 |
-
/******/ // Object.prototype.hasOwnProperty.call
|
12379 |
-
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
12380 |
-
/******/
|
12381 |
-
/******/ // __webpack_public_path__
|
12382 |
-
/******/ __webpack_require__.p = "";
|
12383 |
-
/******/
|
12384 |
-
/******/ // Load entry module and return exports
|
12385 |
-
/******/ return __webpack_require__(__webpack_require__.s = 27);
|
12386 |
-
/******/ })
|
12387 |
-
/************************************************************************/
|
12388 |
-
/******/ ([
|
12389 |
-
/* 0 */
|
12390 |
-
/***/ (function(module, exports, __webpack_require__) {
|
12391 |
-
|
12392 |
-
"use strict";
|
12393 |
-
|
12394 |
-
|
12395 |
-
// http://dev.w3.org/csswg/css-color/
|
12396 |
-
|
12397 |
-
Object.defineProperty(exports, "__esModule", {
|
12398 |
-
value: true
|
12399 |
-
});
|
12400 |
-
|
12401 |
-
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
|
12402 |
-
|
12403 |
-
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
12404 |
-
|
12405 |
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
12406 |
-
|
12407 |
-
var HEX3 = /^#([a-f0-9]{3})$/i;
|
12408 |
-
var hex3 = function hex3(value) {
|
12409 |
-
var match = value.match(HEX3);
|
12410 |
-
if (match) {
|
12411 |
-
return [parseInt(match[1][0] + match[1][0], 16), parseInt(match[1][1] + match[1][1], 16), parseInt(match[1][2] + match[1][2], 16), null];
|
12412 |
-
}
|
12413 |
-
return false;
|
12414 |
-
};
|
12415 |
-
|
12416 |
-
var HEX6 = /^#([a-f0-9]{6})$/i;
|
12417 |
-
var hex6 = function hex6(value) {
|
12418 |
-
var match = value.match(HEX6);
|
12419 |
-
if (match) {
|
12420 |
-
return [parseInt(match[1].substring(0, 2), 16), parseInt(match[1].substring(2, 4), 16), parseInt(match[1].substring(4, 6), 16), null];
|
12421 |
-
}
|
12422 |
-
return false;
|
12423 |
-
};
|
12424 |
-
|
12425 |
-
var RGB = /^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/;
|
12426 |
-
var rgb = function rgb(value) {
|
12427 |
-
var match = value.match(RGB);
|
12428 |
-
if (match) {
|
12429 |
-
return [Number(match[1]), Number(match[2]), Number(match[3]), null];
|
12430 |
-
}
|
12431 |
-
return false;
|
12432 |
-
};
|
12433 |
-
|
12434 |
-
var RGBA = /^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d?\.?\d+)\s*\)$/;
|
12435 |
-
var rgba = function rgba(value) {
|
12436 |
-
var match = value.match(RGBA);
|
12437 |
-
if (match && match.length > 4) {
|
12438 |
-
return [Number(match[1]), Number(match[2]), Number(match[3]), Number(match[4])];
|
12439 |
-
}
|
12440 |
-
return false;
|
12441 |
-
};
|
12442 |
-
|
12443 |
-
var fromArray = function fromArray(array) {
|
12444 |
-
return [Math.min(array[0], 255), Math.min(array[1], 255), Math.min(array[2], 255), array.length > 3 ? array[3] : null];
|
12445 |
-
};
|
12446 |
-
|
12447 |
-
var namedColor = function namedColor(name) {
|
12448 |
-
var color = NAMED_COLORS[name.toLowerCase()];
|
12449 |
-
return color ? color : false;
|
12450 |
-
};
|
12451 |
-
|
12452 |
-
var Color = function () {
|
12453 |
-
function Color(value) {
|
12454 |
-
_classCallCheck(this, Color);
|
12455 |
-
|
12456 |
-
var _ref = Array.isArray(value) ? fromArray(value) : hex3(value) || rgb(value) || rgba(value) || namedColor(value) || hex6(value) || [0, 0, 0, null],
|
12457 |
-
_ref2 = _slicedToArray(_ref, 4),
|
12458 |
-
r = _ref2[0],
|
12459 |
-
g = _ref2[1],
|
12460 |
-
b = _ref2[2],
|
12461 |
-
a = _ref2[3];
|
12462 |
-
|
12463 |
-
this.r = r;
|
12464 |
-
this.g = g;
|
12465 |
-
this.b = b;
|
12466 |
-
this.a = a;
|
12467 |
-
}
|
12468 |
-
|
12469 |
-
_createClass(Color, [{
|
12470 |
-
key: 'isTransparent',
|
12471 |
-
value: function isTransparent() {
|
12472 |
-
return this.a === 0;
|
12473 |
-
}
|
12474 |
-
}, {
|
12475 |
-
key: 'toString',
|
12476 |
-
value: function toString() {
|
12477 |
-
return this.a !== null && this.a !== 1 ? 'rgba(' + this.r + ',' + this.g + ',' + this.b + ',' + this.a + ')' : 'rgb(' + this.r + ',' + this.g + ',' + this.b + ')';
|
12478 |
-
}
|
12479 |
-
}]);
|
12480 |
-
|
12481 |
-
return Color;
|
12482 |
-
}();
|
12483 |
-
|
12484 |
-
exports.default = Color;
|
12485 |
-
|
12486 |
-
|
12487 |
-
var NAMED_COLORS = {
|
12488 |
-
transparent: [0, 0, 0, 0],
|
12489 |
-
aliceblue: [240, 248, 255, null],
|
12490 |
-
antiquewhite: [250, 235, 215, null],
|
12491 |
-
aqua: [0, 255, 255, null],
|
12492 |
-
aquamarine: [127, 255, 212, null],
|
12493 |
-
azure: [240, 255, 255, null],
|
12494 |
-
beige: [245, 245, 220, null],
|
12495 |
-
bisque: [255, 228, 196, null],
|
12496 |
-
black: [0, 0, 0, null],
|
12497 |
-
blanchedalmond: [255, 235, 205, null],
|
12498 |
-
blue: [0, 0, 255, null],
|
12499 |
-
blueviolet: [138, 43, 226, null],
|
12500 |
-
brown: [165, 42, 42, null],
|
12501 |
-
burlywood: [222, 184, 135, null],
|
12502 |
-
cadetblue: [95, 158, 160, null],
|
12503 |
-
chartreuse: [127, 255, 0, null],
|
12504 |
-
chocolate: [210, 105, 30, null],
|
12505 |
-
coral: [255, 127, 80, null],
|
12506 |
-
cornflowerblue: [100, 149, 237, null],
|
12507 |
-
cornsilk: [255, 248, 220, null],
|
12508 |
-
crimson: [220, 20, 60, null],
|
12509 |
-
cyan: [0, 255, 255, null],
|
12510 |
-
darkblue: [0, 0, 139, null],
|
12511 |
-
darkcyan: [0, 139, 139, null],
|
12512 |
-
darkgoldenrod: [184, 134, 11, null],
|
12513 |
-
darkgray: [169, 169, 169, null],
|
12514 |
-
darkgreen: [0, 100, 0, null],
|
12515 |
-
darkgrey: [169, 169, 169, null],
|
12516 |
-
darkkhaki: [189, 183, 107, null],
|
12517 |
-
darkmagenta: [139, 0, 139, null],
|
12518 |
-
darkolivegreen: [85, 107, 47, null],
|
12519 |
-
darkorange: [255, 140, 0, null],
|
12520 |
-
darkorchid: [153, 50, 204, null],
|
12521 |
-
darkred: [139, 0, 0, null],
|
12522 |
-
darksalmon: [233, 150, 122, null],
|
12523 |
-
darkseagreen: [143, 188, 143, null],
|
12524 |
-
darkslateblue: [72, 61, 139, null],
|
12525 |
-
darkslategray: [47, 79, 79, null],
|
12526 |
-
darkslategrey: [47, 79, 79, null],
|
12527 |
-
darkturquoise: [0, 206, 209, null],
|
12528 |
-
darkviolet: [148, 0, 211, null],
|
12529 |
-
deeppink: [255, 20, 147, null],
|
12530 |
-
deepskyblue: [0, 191, 255, null],
|
12531 |
-
dimgray: [105, 105, 105, null],
|
12532 |
-
dimgrey: [105, 105, 105, null],
|
12533 |
-
dodgerblue: [30, 144, 255, null],
|
12534 |
-
firebrick: [178, 34, 34, null],
|
12535 |
-
floralwhite: [255, 250, 240, null],
|
12536 |
-
forestgreen: [34, 139, 34, null],
|
12537 |
-
fuchsia: [255, 0, 255, null],
|
12538 |
-
gainsboro: [220, 220, 220, null],
|
12539 |
-
ghostwhite: [248, 248, 255, null],
|
12540 |
-
gold: [255, 215, 0, null],
|
12541 |
-
goldenrod: [218, 165, 32, null],
|
12542 |
-
gray: [128, 128, 128, null],
|
12543 |
-
green: [0, 128, 0, null],
|
12544 |
-
greenyellow: [173, 255, 47, null],
|
12545 |
-
grey: [128, 128, 128, null],
|
12546 |
-
honeydew: [240, 255, 240, null],
|
12547 |
-
hotpink: [255, 105, 180, null],
|
12548 |
-
indianred: [205, 92, 92, null],
|
12549 |
-
indigo: [75, 0, 130, null],
|
12550 |
-
ivory: [255, 255, 240, null],
|
12551 |
-
khaki: [240, 230, 140, null],
|
12552 |
-
lavender: [230, 230, 250, null],
|
12553 |
-
lavenderblush: [255, 240, 245, null],
|
12554 |
-
lawngreen: [124, 252, 0, null],
|
12555 |
-
lemonchiffon: [255, 250, 205, null],
|
12556 |
-
lightblue: [173, 216, 230, null],
|
12557 |
-
lightcoral: [240, 128, 128, null],
|
12558 |
-
lightcyan: [224, 255, 255, null],
|
12559 |
-
lightgoldenrodyellow: [250, 250, 210, null],
|
12560 |
-
lightgray: [211, 211, 211, null],
|
12561 |
-
lightgreen: [144, 238, 144, null],
|
12562 |
-
lightgrey: [211, 211, 211, null],
|
12563 |
-
lightpink: [255, 182, 193, null],
|
12564 |
-
lightsalmon: [255, 160, 122, null],
|
12565 |
-
lightseagreen: [32, 178, 170, null],
|
12566 |
-
lightskyblue: [135, 206, 250, null],
|
12567 |
-
lightslategray: [119, 136, 153, null],
|
12568 |
-
lightslategrey: [119, 136, 153, null],
|
12569 |
-
lightsteelblue: [176, 196, 222, null],
|
12570 |
-
lightyellow: [255, 255, 224, null],
|
12571 |
-
lime: [0, 255, 0, null],
|
12572 |
-
limegreen: [50, 205, 50, null],
|
12573 |
-
linen: [250, 240, 230, null],
|
12574 |
-
magenta: [255, 0, 255, null],
|
12575 |
-
maroon: [128, 0, 0, null],
|
12576 |
-
mediumaquamarine: [102, 205, 170, null],
|
12577 |
-
mediumblue: [0, 0, 205, null],
|
12578 |
-
mediumorchid: [186, 85, 211, null],
|
12579 |
-
mediumpurple: [147, 112, 219, null],
|
12580 |
-
mediumseagreen: [60, 179, 113, null],
|
12581 |
-
mediumslateblue: [123, 104, 238, null],
|
12582 |
-
mediumspringgreen: [0, 250, 154, null],
|
12583 |
-
mediumturquoise: [72, 209, 204, null],
|
12584 |
-
mediumvioletred: [199, 21, 133, null],
|
12585 |
-
midnightblue: [25, 25, 112, null],
|
12586 |
-
mintcream: [245, 255, 250, null],
|
12587 |
-
mistyrose: [255, 228, 225, null],
|
12588 |
-
moccasin: [255, 228, 181, null],
|
12589 |
-
navajowhite: [255, 222, 173, null],
|
12590 |
-
navy: [0, 0, 128, null],
|
12591 |
-
oldlace: [253, 245, 230, null],
|
12592 |
-
olive: [128, 128, 0, null],
|
12593 |
-
olivedrab: [107, 142, 35, null],
|
12594 |
-
orange: [255, 165, 0, null],
|
12595 |
-
orangered: [255, 69, 0, null],
|
12596 |
-
orchid: [218, 112, 214, null],
|
12597 |
-
palegoldenrod: [238, 232, 170, null],
|
12598 |
-
palegreen: [152, 251, 152, null],
|
12599 |
-
paleturquoise: [175, 238, 238, null],
|
12600 |
-
palevioletred: [219, 112, 147, null],
|
12601 |
-
papayawhip: [255, 239, 213, null],
|
12602 |
-
peachpuff: [255, 218, 185, null],
|
12603 |
-
peru: [205, 133, 63, null],
|
12604 |
-
pink: [255, 192, 203, null],
|
12605 |
-
plum: [221, 160, 221, null],
|
12606 |
-
powderblue: [176, 224, 230, null],
|
12607 |
-
purple: [128, 0, 128, null],
|
12608 |
-
rebeccapurple: [102, 51, 153, null],
|
12609 |
-
red: [255, 0, 0, null],
|
12610 |
-
rosybrown: [188, 143, 143, null],
|
12611 |
-
royalblue: [65, 105, 225, null],
|
12612 |
-
saddlebrown: [139, 69, 19, null],
|
12613 |
-
salmon: [250, 128, 114, null],
|
12614 |
-
sandybrown: [244, 164, 96, null],
|
12615 |
-
seagreen: [46, 139, 87, null],
|
12616 |
-
seashell: [255, 245, 238, null],
|
12617 |
-
sienna: [160, 82, 45, null],
|
12618 |
-
silver: [192, 192, 192, null],
|
12619 |
-
skyblue: [135, 206, 235, null],
|
12620 |
-
slateblue: [106, 90, 205, null],
|
12621 |
-
slategray: [112, 128, 144, null],
|
12622 |
-
slategrey: [112, 128, 144, null],
|
12623 |
-
snow: [255, 250, 250, null],
|
12624 |
-
springgreen: [0, 255, 127, null],
|
12625 |
-
steelblue: [70, 130, 180, null],
|
12626 |
-
tan: [210, 180, 140, null],
|
12627 |
-
teal: [0, 128, 128, null],
|
12628 |
-
thistle: [216, 191, 216, null],
|
12629 |
-
tomato: [255, 99, 71, null],
|
12630 |
-
turquoise: [64, 224, 208, null],
|
12631 |
-
violet: [238, 130, 238, null],
|
12632 |
-
wheat: [245, 222, 179, null],
|
12633 |
-
white: [255, 255, 255, null],
|
12634 |
-
whitesmoke: [245, 245, 245, null],
|
12635 |
-
yellow: [255, 255, 0, null],
|
12636 |
-
yellowgreen: [154, 205, 50, null]
|
12637 |
-
};
|
12638 |
-
|
12639 |
-
var TRANSPARENT = exports.TRANSPARENT = new Color([0, 0, 0, 0]);
|
12640 |
-
|
12641 |
-
/***/ }),
|
12642 |
-
/* 1 */
|
12643 |
-
/***/ (function(module, exports, __webpack_require__) {
|
12644 |
-
|
12645 |
-
"use strict";
|
12646 |
-
|
12647 |
-
|
12648 |
-
Object.defineProperty(exports, "__esModule", {
|
12649 |
-
value: true
|
12650 |
-
});
|
12651 |
-
exports.calculateLengthFromValueWithUnit = exports.LENGTH_TYPE = undefined;
|
12652 |
-
|
12653 |
-
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
12654 |
-
|
12655 |
-
var _NodeContainer = __webpack_require__(3);
|
12656 |
-
|
12657 |
-
var _NodeContainer2 = _interopRequireDefault(_NodeContainer);
|
12658 |
-
|
12659 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
12660 |
-
|
12661 |
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
12662 |
-
|
12663 |
-
var LENGTH_WITH_UNIT = /([\d.]+)(px|r?em|%)/i;
|
12664 |
-
|
12665 |
-
var LENGTH_TYPE = exports.LENGTH_TYPE = {
|
12666 |
-
PX: 0,
|
12667 |
-
PERCENTAGE: 1
|
12668 |
-
};
|
12669 |
-
|
12670 |
-
var Length = function () {
|
12671 |
-
function Length(value) {
|
12672 |
-
_classCallCheck(this, Length);
|
12673 |
-
|
12674 |
-
this.type = value.substr(value.length - 1) === '%' ? LENGTH_TYPE.PERCENTAGE : LENGTH_TYPE.PX;
|
12675 |
-
var parsedValue = parseFloat(value);
|
12676 |
-
if (true && isNaN(parsedValue)) {
|
12677 |
-
console.error('Invalid value given for Length: "' + value + '"');
|
12678 |
-
}
|
12679 |
-
this.value = isNaN(parsedValue) ? 0 : parsedValue;
|
12680 |
-
}
|
12681 |
-
|
12682 |
-
_createClass(Length, [{
|
12683 |
-
key: 'isPercentage',
|
12684 |
-
value: function isPercentage() {
|
12685 |
-
return this.type === LENGTH_TYPE.PERCENTAGE;
|
12686 |
-
}
|
12687 |
-
}, {
|
12688 |
-
key: 'getAbsoluteValue',
|
12689 |
-
value: function getAbsoluteValue(parentLength) {
|
12690 |
-
return this.isPercentage() ? parentLength * (this.value / 100) : this.value;
|
12691 |
-
}
|
12692 |
-
}], [{
|
12693 |
-
key: 'create',
|
12694 |
-
value: function create(v) {
|
12695 |
-
return new Length(v);
|
12696 |
-
}
|
12697 |
-
}]);
|
12698 |
-
|
12699 |
-
return Length;
|
12700 |
-
}();
|
12701 |
-
|
12702 |
-
exports.default = Length;
|
12703 |
-
|
12704 |
-
|
12705 |
-
var getRootFontSize = function getRootFontSize(container) {
|
12706 |
-
var parent = container.parent;
|
12707 |
-
return parent ? getRootFontSize(parent) : parseFloat(container.style.font.fontSize);
|
12708 |
-
};
|
12709 |
-
|
12710 |
-
var calculateLengthFromValueWithUnit = exports.calculateLengthFromValueWithUnit = function calculateLengthFromValueWithUnit(container, value, unit) {
|
12711 |
-
switch (unit) {
|
12712 |
-
case 'px':
|
12713 |
-
case '%':
|
12714 |
-
return new Length(value + unit);
|
12715 |
-
case 'em':
|
12716 |
-
case 'rem':
|
12717 |
-
var length = new Length(value);
|
12718 |
-
length.value *= unit === 'em' ? parseFloat(container.style.font.fontSize) : getRootFontSize(container);
|
12719 |
-
return length;
|
12720 |
-
default:
|
12721 |
-
// TODO: handle correctly if unknown unit is used
|
12722 |
-
return new Length('0');
|
12723 |
-
}
|
12724 |
-
};
|
12725 |
-
|
12726 |
-
/***/ }),
|
12727 |
-
/* 2 */
|
12728 |
-
/***/ (function(module, exports, __webpack_require__) {
|
12729 |
-
|
12730 |
-
"use strict";
|
12731 |
-
|
12732 |
-
|
12733 |
-
Object.defineProperty(exports, "__esModule", {
|
12734 |
-
value: true
|
12735 |
-
});
|
12736 |
-
exports.parseBoundCurves = exports.calculatePaddingBoxPath = exports.calculateBorderBoxPath = exports.parsePathForBorder = exports.parseDocumentSize = exports.calculateContentBox = exports.calculatePaddingBox = exports.parseBounds = exports.Bounds = undefined;
|
12737 |
-
|
12738 |
-
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
12739 |
-
|
12740 |
-
var _Vector = __webpack_require__(7);
|
12741 |
-
|
12742 |
-
var _Vector2 = _interopRequireDefault(_Vector);
|
12743 |
-
|
12744 |
-
var _BezierCurve = __webpack_require__(32);
|
12745 |
-
|
12746 |
-
var _BezierCurve2 = _interopRequireDefault(_BezierCurve);
|
12747 |
-
|
12748 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
12749 |
-
|
12750 |
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
12751 |
-
|
12752 |
-
var TOP = 0;
|
12753 |
-
var RIGHT = 1;
|
12754 |
-
var BOTTOM = 2;
|
12755 |
-
var LEFT = 3;
|
12756 |
-
|
12757 |
-
var H = 0;
|
12758 |
-
var V = 1;
|
12759 |
-
|
12760 |
-
var Bounds = exports.Bounds = function () {
|
12761 |
-
function Bounds(x, y, w, h) {
|
12762 |
-
_classCallCheck(this, Bounds);
|
12763 |
-
|
12764 |
-
this.left = x;
|
12765 |
-
this.top = y;
|
12766 |
-
this.width = w;
|
12767 |
-
this.height = h;
|
12768 |
-
}
|
12769 |
-
|
12770 |
-
_createClass(Bounds, null, [{
|
12771 |
-
key: 'fromClientRect',
|
12772 |
-
value: function fromClientRect(clientRect, scrollX, scrollY) {
|
12773 |
-
return new Bounds(clientRect.left + scrollX, clientRect.top + scrollY, clientRect.width, clientRect.height);
|
12774 |
-
}
|
12775 |
-
}]);
|
12776 |
-
|
12777 |
-
return Bounds;
|
12778 |
-
}();
|
12779 |
-
|
12780 |
-
var parseBounds = exports.parseBounds = function parseBounds(node, scrollX, scrollY) {
|
12781 |
-
return Bounds.fromClientRect(node.getBoundingClientRect(), scrollX, scrollY);
|
12782 |
-
};
|
12783 |
-
|
12784 |
-
var calculatePaddingBox = exports.calculatePaddingBox = function calculatePaddingBox(bounds, borders) {
|
12785 |
-
return new Bounds(bounds.left + borders[LEFT].borderWidth, bounds.top + borders[TOP].borderWidth, bounds.width - (borders[RIGHT].borderWidth + borders[LEFT].borderWidth), bounds.height - (borders[TOP].borderWidth + borders[BOTTOM].borderWidth));
|
12786 |
-
};
|
12787 |
-
|
12788 |
-
var calculateContentBox = exports.calculateContentBox = function calculateContentBox(bounds, padding, borders) {
|
12789 |
-
// TODO support percentage paddings
|
12790 |
-
var paddingTop = padding[TOP].value;
|
12791 |
-
var paddingRight = padding[RIGHT].value;
|
12792 |
-
var paddingBottom = padding[BOTTOM].value;
|
12793 |
-
var paddingLeft = padding[LEFT].value;
|
12794 |
-
|
12795 |
-
return new Bounds(bounds.left + paddingLeft + borders[LEFT].borderWidth, bounds.top + paddingTop + borders[TOP].borderWidth, bounds.width - (borders[RIGHT].borderWidth + borders[LEFT].borderWidth + paddingLeft + paddingRight), bounds.height - (borders[TOP].borderWidth + borders[BOTTOM].borderWidth + paddingTop + paddingBottom));
|
12796 |
-
};
|
12797 |
-
|
12798 |
-
var parseDocumentSize = exports.parseDocumentSize = function parseDocumentSize(document) {
|
12799 |
-
var body = document.body;
|
12800 |
-
var documentElement = document.documentElement;
|
12801 |
-
|
12802 |
-
if (!body || !documentElement) {
|
12803 |
-
throw new Error( true ? 'Unable to get document size' : '');
|
12804 |
-
}
|
12805 |
-
var width = Math.max(Math.max(body.scrollWidth, documentElement.scrollWidth), Math.max(body.offsetWidth, documentElement.offsetWidth), Math.max(body.clientWidth, documentElement.clientWidth));
|
12806 |
-
|
12807 |
-
var height = Math.max(Math.max(body.scrollHeight, documentElement.scrollHeight), Math.max(body.offsetHeight, documentElement.offsetHeight), Math.max(body.clientHeight, documentElement.clientHeight));
|
12808 |
-
|
12809 |
-
return new Bounds(0, 0, width, height);
|
12810 |
-
};
|
12811 |
-
|
12812 |
-
var parsePathForBorder = exports.parsePathForBorder = function parsePathForBorder(curves, borderSide) {
|
12813 |
-
switch (borderSide) {
|
12814 |
-
case TOP:
|
12815 |
-
return createPathFromCurves(curves.topLeftOuter, curves.topLeftInner, curves.topRightOuter, curves.topRightInner);
|
12816 |
-
case RIGHT:
|
12817 |
-
return createPathFromCurves(curves.topRightOuter, curves.topRightInner, curves.bottomRightOuter, curves.bottomRightInner);
|
12818 |
-
case BOTTOM:
|
12819 |
-
return createPathFromCurves(curves.bottomRightOuter, curves.bottomRightInner, curves.bottomLeftOuter, curves.bottomLeftInner);
|
12820 |
-
case LEFT:
|
12821 |
-
default:
|
12822 |
-
return createPathFromCurves(curves.bottomLeftOuter, curves.bottomLeftInner, curves.topLeftOuter, curves.topLeftInner);
|
12823 |
-
}
|
12824 |
-
};
|
12825 |
-
|
12826 |
-
var createPathFromCurves = function createPathFromCurves(outer1, inner1, outer2, inner2) {
|
12827 |
-
var path = [];
|
12828 |
-
if (outer1 instanceof _BezierCurve2.default) {
|
12829 |
-
path.push(outer1.subdivide(0.5, false));
|
12830 |
-
} else {
|
12831 |
-
path.push(outer1);
|
12832 |
-
}
|
12833 |
-
|
12834 |
-
if (outer2 instanceof _BezierCurve2.default) {
|
12835 |
-
path.push(outer2.subdivide(0.5, true));
|
12836 |
-
} else {
|
12837 |
-
path.push(outer2);
|
12838 |
-
}
|
12839 |
-
|
12840 |
-
if (inner2 instanceof _BezierCurve2.default) {
|
12841 |
-
path.push(inner2.subdivide(0.5, true).reverse());
|
12842 |
-
} else {
|
12843 |
-
path.push(inner2);
|
12844 |
-
}
|
12845 |
-
|
12846 |
-
if (inner1 instanceof _BezierCurve2.default) {
|
12847 |
-
path.push(inner1.subdivide(0.5, false).reverse());
|
12848 |
-
} else {
|
12849 |
-
path.push(inner1);
|
12850 |
-
}
|
12851 |
-
|
12852 |
-
return path;
|
12853 |
-
};
|
12854 |
-
|
12855 |
-
var calculateBorderBoxPath = exports.calculateBorderBoxPath = function calculateBorderBoxPath(curves) {
|
12856 |
-
return [curves.topLeftOuter, curves.topRightOuter, curves.bottomRightOuter, curves.bottomLeftOuter];
|
12857 |
-
};
|
12858 |
-
|
12859 |
-
var calculatePaddingBoxPath = exports.calculatePaddingBoxPath = function calculatePaddingBoxPath(curves) {
|
12860 |
-
return [curves.topLeftInner, curves.topRightInner, curves.bottomRightInner, curves.bottomLeftInner];
|
12861 |
-
};
|
12862 |
-
|
12863 |
-
var parseBoundCurves = exports.parseBoundCurves = function parseBoundCurves(bounds, borders, borderRadius) {
|
12864 |
-
var tlh = borderRadius[CORNER.TOP_LEFT][H].getAbsoluteValue(bounds.width);
|
12865 |
-
var tlv = borderRadius[CORNER.TOP_LEFT][V].getAbsoluteValue(bounds.height);
|
12866 |
-
var trh = borderRadius[CORNER.TOP_RIGHT][H].getAbsoluteValue(bounds.width);
|
12867 |
-
var trv = borderRadius[CORNER.TOP_RIGHT][V].getAbsoluteValue(bounds.height);
|
12868 |
-
var brh = borderRadius[CORNER.BOTTOM_RIGHT][H].getAbsoluteValue(bounds.width);
|
12869 |
-
var brv = borderRadius[CORNER.BOTTOM_RIGHT][V].getAbsoluteValue(bounds.height);
|
12870 |
-
var blh = borderRadius[CORNER.BOTTOM_LEFT][H].getAbsoluteValue(bounds.width);
|
12871 |
-
var blv = borderRadius[CORNER.BOTTOM_LEFT][V].getAbsoluteValue(bounds.height);
|
12872 |
-
|
12873 |
-
var factors = [];
|
12874 |
-
factors.push((tlh + trh) / bounds.width);
|
12875 |
-
factors.push((blh + brh) / bounds.width);
|
12876 |
-
factors.push((tlv + blv) / bounds.height);
|
12877 |
-
factors.push((trv + brv) / bounds.height);
|
12878 |
-
var maxFactor = Math.max.apply(Math, factors);
|
12879 |
-
|
12880 |
-
if (maxFactor > 1) {
|
12881 |
-
tlh /= maxFactor;
|
12882 |
-
tlv /= maxFactor;
|
12883 |
-
trh /= maxFactor;
|
12884 |
-
trv /= maxFactor;
|
12885 |
-
brh /= maxFactor;
|
12886 |
-
brv /= maxFactor;
|
12887 |
-
blh /= maxFactor;
|
12888 |
-
blv /= maxFactor;
|
12889 |
-
}
|
12890 |
-
|
12891 |
-
var topWidth = bounds.width - trh;
|
12892 |
-
var rightHeight = bounds.height - brv;
|
12893 |
-
var bottomWidth = bounds.width - brh;
|
12894 |
-
var leftHeight = bounds.height - blv;
|
12895 |
-
|
12896 |
-
return {
|
12897 |
-
topLeftOuter: tlh > 0 || tlv > 0 ? getCurvePoints(bounds.left, bounds.top, tlh, tlv, CORNER.TOP_LEFT) : new _Vector2.default(bounds.left, bounds.top),
|
12898 |
-
topLeftInner: tlh > 0 || tlv > 0 ? getCurvePoints(bounds.left + borders[LEFT].borderWidth, bounds.top + borders[TOP].borderWidth, Math.max(0, tlh - borders[LEFT].borderWidth), Math.max(0, tlv - borders[TOP].borderWidth), CORNER.TOP_LEFT) : new _Vector2.default(bounds.left + borders[LEFT].borderWidth, bounds.top + borders[TOP].borderWidth),
|
12899 |
-
topRightOuter: trh > 0 || trv > 0 ? getCurvePoints(bounds.left + topWidth, bounds.top, trh, trv, CORNER.TOP_RIGHT) : new _Vector2.default(bounds.left + bounds.width, bounds.top),
|
12900 |
-
topRightInner: trh > 0 || trv > 0 ? getCurvePoints(bounds.left + Math.min(topWidth, bounds.width + borders[LEFT].borderWidth), bounds.top + borders[TOP].borderWidth, topWidth > bounds.width + borders[LEFT].borderWidth ? 0 : trh - borders[LEFT].borderWidth, trv - borders[TOP].borderWidth, CORNER.TOP_RIGHT) : new _Vector2.default(bounds.left + bounds.width - borders[RIGHT].borderWidth, bounds.top + borders[TOP].borderWidth),
|
12901 |
-
bottomRightOuter: brh > 0 || brv > 0 ? getCurvePoints(bounds.left + bottomWidth, bounds.top + rightHeight, brh, brv, CORNER.BOTTOM_RIGHT) : new _Vector2.default(bounds.left + bounds.width, bounds.top + bounds.height),
|
12902 |
-
bottomRightInner: brh > 0 || brv > 0 ? getCurvePoints(bounds.left + Math.min(bottomWidth, bounds.width - borders[LEFT].borderWidth), bounds.top + Math.min(rightHeight, bounds.height + borders[TOP].borderWidth), Math.max(0, brh - borders[RIGHT].borderWidth), brv - borders[BOTTOM].borderWidth, CORNER.BOTTOM_RIGHT) : new _Vector2.default(bounds.left + bounds.width - borders[RIGHT].borderWidth, bounds.top + bounds.height - borders[BOTTOM].borderWidth),
|
12903 |
-
bottomLeftOuter: blh > 0 || blv > 0 ? getCurvePoints(bounds.left, bounds.top + leftHeight, blh, blv, CORNER.BOTTOM_LEFT) : new _Vector2.default(bounds.left, bounds.top + bounds.height),
|
12904 |
-
bottomLeftInner: blh > 0 || blv > 0 ? getCurvePoints(bounds.left + borders[LEFT].borderWidth, bounds.top + leftHeight, Math.max(0, blh - borders[LEFT].borderWidth), blv - borders[BOTTOM].borderWidth, CORNER.BOTTOM_LEFT) : new _Vector2.default(bounds.left + borders[LEFT].borderWidth, bounds.top + bounds.height - borders[BOTTOM].borderWidth)
|
12905 |
-
};
|
12906 |
-
};
|
12907 |
-
|
12908 |
-
var CORNER = {
|
12909 |
-
TOP_LEFT: 0,
|
12910 |
-
TOP_RIGHT: 1,
|
12911 |
-
BOTTOM_RIGHT: 2,
|
12912 |
-
BOTTOM_LEFT: 3
|
12913 |
-
};
|
12914 |
-
|
12915 |
-
var getCurvePoints = function getCurvePoints(x, y, r1, r2, position) {
|
12916 |
-
var kappa = 4 * ((Math.sqrt(2) - 1) / 3);
|
12917 |
-
var ox = r1 * kappa; // control point offset horizontal
|
12918 |
-
var oy = r2 * kappa; // control point offset vertical
|
12919 |
-
var xm = x + r1; // x-middle
|
12920 |
-
var ym = y + r2; // y-middle
|
12921 |
-
|
12922 |
-
switch (position) {
|
12923 |
-
case CORNER.TOP_LEFT:
|
12924 |
-
return new _BezierCurve2.default(new _Vector2.default(x, ym), new _Vector2.default(x, ym - oy), new _Vector2.default(xm - ox, y), new _Vector2.default(xm, y));
|
12925 |
-
case CORNER.TOP_RIGHT:
|
12926 |
-
return new _BezierCurve2.default(new _Vector2.default(x, y), new _Vector2.default(x + ox, y), new _Vector2.default(xm, ym - oy), new _Vector2.default(xm, ym));
|
12927 |
-
case CORNER.BOTTOM_RIGHT:
|
12928 |
-
return new _BezierCurve2.default(new _Vector2.default(xm, y), new _Vector2.default(xm, y + oy), new _Vector2.default(x + ox, ym), new _Vector2.default(x, ym));
|
12929 |
-
case CORNER.BOTTOM_LEFT:
|
12930 |
-
default:
|
12931 |
-
return new _BezierCurve2.default(new _Vector2.default(xm, ym), new _Vector2.default(xm - ox, ym), new _Vector2.default(x, y + oy), new _Vector2.default(x, y));
|
12932 |
-
}
|
12933 |
-
};
|
12934 |
-
|
12935 |
-
/***/ }),
|
12936 |
-
/* 3 */
|
12937 |
-
/***/ (function(module, exports, __webpack_require__) {
|
12938 |
-
|
12939 |
-
"use strict";
|
12940 |
-
|
12941 |
-
|
12942 |
-
Object.defineProperty(exports, "__esModule", {
|
12943 |
-
value: true
|
12944 |
-
});
|
12945 |
-
|
12946 |
-
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
12947 |
-
|
12948 |
-
var _Color = __webpack_require__(0);
|
12949 |
-
|
12950 |
-
var _Color2 = _interopRequireDefault(_Color);
|
12951 |
-
|
12952 |
-
var _Util = __webpack_require__(4);
|
12953 |
-
|
12954 |
-
var _background = __webpack_require__(5);
|
12955 |
-
|
12956 |
-
var _border = __webpack_require__(12);
|
12957 |
-
|
12958 |
-
var _borderRadius = __webpack_require__(33);
|
12959 |
-
|
12960 |
-
var _display = __webpack_require__(34);
|
12961 |
-
|
12962 |
-
var _float = __webpack_require__(35);
|
12963 |
-
|
12964 |
-
var _font = __webpack_require__(36);
|
12965 |
-
|
12966 |
-
var _letterSpacing = __webpack_require__(37);
|
12967 |
-
|
12968 |
-
var _lineBreak = __webpack_require__(38);
|
12969 |
-
|
12970 |
-
var _listStyle = __webpack_require__(8);
|
12971 |
-
|
12972 |
-
var _margin = __webpack_require__(39);
|
12973 |
-
|
12974 |
-
var _overflow = __webpack_require__(40);
|
12975 |
-
|
12976 |
-
var _overflowWrap = __webpack_require__(18);
|
12977 |
-
|
12978 |
-
var _padding = __webpack_require__(17);
|
12979 |
-
|
12980 |
-
var _position = __webpack_require__(19);
|
12981 |
-
|
12982 |
-
var _textDecoration = __webpack_require__(11);
|
12983 |
-
|
12984 |
-
var _textShadow = __webpack_require__(41);
|
12985 |
-
|
12986 |
-
var _textTransform = __webpack_require__(20);
|
12987 |
-
|
12988 |
-
var _transform = __webpack_require__(42);
|
12989 |
-
|
12990 |
-
var _visibility = __webpack_require__(43);
|
12991 |
-
|
12992 |
-
var _wordBreak = __webpack_require__(44);
|
12993 |
-
|
12994 |
-
var _zIndex = __webpack_require__(45);
|
12995 |
-
|
12996 |
-
var _Bounds = __webpack_require__(2);
|
12997 |
-
|
12998 |
-
var _Input = __webpack_require__(21);
|
12999 |
-
|
13000 |
-
var _ListItem = __webpack_require__(14);
|
13001 |
-
|
13002 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13003 |
-
|
13004 |
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
13005 |
-
|
13006 |
-
var INPUT_TAGS = ['INPUT', 'TEXTAREA', 'SELECT'];
|
13007 |
-
|
13008 |
-
var NodeContainer = function () {
|
13009 |
-
function NodeContainer(node, parent, resourceLoader, index) {
|
13010 |
-
var _this = this;
|
13011 |
-
|
13012 |
-
_classCallCheck(this, NodeContainer);
|
13013 |
-
|
13014 |
-
this.parent = parent;
|
13015 |
-
this.tagName = node.tagName;
|
13016 |
-
this.index = index;
|
13017 |
-
this.childNodes = [];
|
13018 |
-
this.listItems = [];
|
13019 |
-
if (typeof node.start === 'number') {
|
13020 |
-
this.listStart = node.start;
|
13021 |
-
}
|
13022 |
-
var defaultView = node.ownerDocument.defaultView;
|
13023 |
-
var scrollX = defaultView.pageXOffset;
|
13024 |
-
var scrollY = defaultView.pageYOffset;
|
13025 |
-
var style = defaultView.getComputedStyle(node, null);
|
13026 |
-
var display = (0, _display.parseDisplay)(style.display);
|
13027 |
-
|
13028 |
-
var IS_INPUT = node.type === 'radio' || node.type === 'checkbox';
|
13029 |
-
|
13030 |
-
var position = (0, _position.parsePosition)(style.position);
|
13031 |
-
|
13032 |
-
this.style = {
|
13033 |
-
background: IS_INPUT ? _Input.INPUT_BACKGROUND : (0, _background.parseBackground)(style, resourceLoader),
|
13034 |
-
border: IS_INPUT ? _Input.INPUT_BORDERS : (0, _border.parseBorder)(style),
|
13035 |
-
borderRadius: (node instanceof defaultView.HTMLInputElement || node instanceof HTMLInputElement) && IS_INPUT ? (0, _Input.getInputBorderRadius)(node) : (0, _borderRadius.parseBorderRadius)(style),
|
13036 |
-
color: IS_INPUT ? _Input.INPUT_COLOR : new _Color2.default(style.color),
|
13037 |
-
display: display,
|
13038 |
-
float: (0, _float.parseCSSFloat)(style.float),
|
13039 |
-
font: (0, _font.parseFont)(style),
|
13040 |
-
letterSpacing: (0, _letterSpacing.parseLetterSpacing)(style.letterSpacing),
|
13041 |
-
listStyle: display === _display.DISPLAY.LIST_ITEM ? (0, _listStyle.parseListStyle)(style) : null,
|
13042 |
-
lineBreak: (0, _lineBreak.parseLineBreak)(style.lineBreak),
|
13043 |
-
margin: (0, _margin.parseMargin)(style),
|
13044 |
-
opacity: parseFloat(style.opacity),
|
13045 |
-
overflow: INPUT_TAGS.indexOf(node.tagName) === -1 ? (0, _overflow.parseOverflow)(style.overflow) : _overflow.OVERFLOW.HIDDEN,
|
13046 |
-
overflowWrap: (0, _overflowWrap.parseOverflowWrap)(style.overflowWrap ? style.overflowWrap : style.wordWrap),
|
13047 |
-
padding: (0, _padding.parsePadding)(style),
|
13048 |
-
position: position,
|
13049 |
-
textDecoration: (0, _textDecoration.parseTextDecoration)(style),
|
13050 |
-
textShadow: (0, _textShadow.parseTextShadow)(style.textShadow),
|
13051 |
-
textTransform: (0, _textTransform.parseTextTransform)(style.textTransform),
|
13052 |
-
transform: (0, _transform.parseTransform)(style),
|
13053 |
-
visibility: (0, _visibility.parseVisibility)(style.visibility),
|
13054 |
-
wordBreak: (0, _wordBreak.parseWordBreak)(style.wordBreak),
|
13055 |
-
zIndex: (0, _zIndex.parseZIndex)(position !== _position.POSITION.STATIC ? style.zIndex : 'auto')
|
13056 |
-
};
|
13057 |
-
|
13058 |
-
if (this.isTransformed()) {
|
13059 |
-
// getBoundingClientRect provides values post-transform, we want them without the transformation
|
13060 |
-
node.style.transform = 'matrix(1,0,0,1,0,0)';
|
13061 |
-
}
|
13062 |
-
|
13063 |
-
if (display === _display.DISPLAY.LIST_ITEM) {
|
13064 |
-
var listOwner = (0, _ListItem.getListOwner)(this);
|
13065 |
-
if (listOwner) {
|
13066 |
-
var listIndex = listOwner.listItems.length;
|
13067 |
-
listOwner.listItems.push(this);
|
13068 |
-
this.listIndex = node.hasAttribute('value') && typeof node.value === 'number' ? node.value : listIndex === 0 ? typeof listOwner.listStart === 'number' ? listOwner.listStart : 1 : listOwner.listItems[listIndex - 1].listIndex + 1;
|
13069 |
-
}
|
13070 |
-
}
|
13071 |
-
|
13072 |
-
// TODO move bound retrieval for all nodes to a later stage?
|
13073 |
-
if (node.tagName === 'IMG') {
|
13074 |
-
node.addEventListener('load', function () {
|
13075 |
-
_this.bounds = (0, _Bounds.parseBounds)(node, scrollX, scrollY);
|
13076 |
-
_this.curvedBounds = (0, _Bounds.parseBoundCurves)(_this.bounds, _this.style.border, _this.style.borderRadius);
|
13077 |
-
});
|
13078 |
-
}
|
13079 |
-
this.image = getImage(node, resourceLoader);
|
13080 |
-
this.bounds = IS_INPUT ? (0, _Input.reformatInputBounds)((0, _Bounds.parseBounds)(node, scrollX, scrollY)) : (0, _Bounds.parseBounds)(node, scrollX, scrollY);
|
13081 |
-
this.curvedBounds = (0, _Bounds.parseBoundCurves)(this.bounds, this.style.border, this.style.borderRadius);
|
13082 |
-
|
13083 |
-
if (true) {
|
13084 |
-
this.name = '' + node.tagName.toLowerCase() + (node.id ? '#' + node.id : '') + node.className.toString().split(' ').map(function (s) {
|
13085 |
-
return s.length ? '.' + s : '';
|
13086 |
-
}).join('');
|
13087 |
-
}
|
13088 |
-
}
|
13089 |
-
|
13090 |
-
_createClass(NodeContainer, [{
|
13091 |
-
key: 'getClipPaths',
|
13092 |
-
value: function getClipPaths() {
|
13093 |
-
var parentClips = this.parent ? this.parent.getClipPaths() : [];
|
13094 |
-
var isClipped = this.style.overflow !== _overflow.OVERFLOW.VISIBLE;
|
13095 |
-
|
13096 |
-
return isClipped ? parentClips.concat([(0, _Bounds.calculatePaddingBoxPath)(this.curvedBounds)]) : parentClips;
|
13097 |
-
}
|
13098 |
-
}, {
|
13099 |
-
key: 'isInFlow',
|
13100 |
-
value: function isInFlow() {
|
13101 |
-
return this.isRootElement() && !this.isFloating() && !this.isAbsolutelyPositioned();
|
13102 |
-
}
|
13103 |
-
}, {
|
13104 |
-
key: 'isVisible',
|
13105 |
-
value: function isVisible() {
|
13106 |
-
return !(0, _Util.contains)(this.style.display, _display.DISPLAY.NONE) && this.style.opacity > 0 && this.style.visibility === _visibility.VISIBILITY.VISIBLE;
|
13107 |
-
}
|
13108 |
-
}, {
|
13109 |
-
key: 'isAbsolutelyPositioned',
|
13110 |
-
value: function isAbsolutelyPositioned() {
|
13111 |
-
return this.style.position !== _position.POSITION.STATIC && this.style.position !== _position.POSITION.RELATIVE;
|
13112 |
-
}
|
13113 |
-
}, {
|
13114 |
-
key: 'isPositioned',
|
13115 |
-
value: function isPositioned() {
|
13116 |
-
return this.style.position !== _position.POSITION.STATIC;
|
13117 |
-
}
|
13118 |
-
}, {
|
13119 |
-
key: 'isFloating',
|
13120 |
-
value: function isFloating() {
|
13121 |
-
return this.style.float !== _float.FLOAT.NONE;
|
13122 |
-
}
|
13123 |
-
}, {
|
13124 |
-
key: 'isRootElement',
|
13125 |
-
value: function isRootElement() {
|
13126 |
-
return this.parent === null;
|
13127 |
-
}
|
13128 |
-
}, {
|
13129 |
-
key: 'isTransformed',
|
13130 |
-
value: function isTransformed() {
|
13131 |
-
return this.style.transform !== null;
|
13132 |
-
}
|
13133 |
-
}, {
|
13134 |
-
key: 'isPositionedWithZIndex',
|
13135 |
-
value: function isPositionedWithZIndex() {
|
13136 |
-
return this.isPositioned() && !this.style.zIndex.auto;
|
13137 |
-
}
|
13138 |
-
}, {
|
13139 |
-
key: 'isInlineLevel',
|
13140 |
-
value: function isInlineLevel() {
|
13141 |
-
return (0, _Util.contains)(this.style.display, _display.DISPLAY.INLINE) || (0, _Util.contains)(this.style.display, _display.DISPLAY.INLINE_BLOCK) || (0, _Util.contains)(this.style.display, _display.DISPLAY.INLINE_FLEX) || (0, _Util.contains)(this.style.display, _display.DISPLAY.INLINE_GRID) || (0, _Util.contains)(this.style.display, _display.DISPLAY.INLINE_LIST_ITEM) || (0, _Util.contains)(this.style.display, _display.DISPLAY.INLINE_TABLE);
|
13142 |
-
}
|
13143 |
-
}, {
|
13144 |
-
key: 'isInlineBlockOrInlineTable',
|
13145 |
-
value: function isInlineBlockOrInlineTable() {
|
13146 |
-
return (0, _Util.contains)(this.style.display, _display.DISPLAY.INLINE_BLOCK) || (0, _Util.contains)(this.style.display, _display.DISPLAY.INLINE_TABLE);
|
13147 |
-
}
|
13148 |
-
}]);
|
13149 |
-
|
13150 |
-
return NodeContainer;
|
13151 |
-
}();
|
13152 |
-
|
13153 |
-
exports.default = NodeContainer;
|
13154 |
-
|
13155 |
-
|
13156 |
-
var getImage = function getImage(node, resourceLoader) {
|
13157 |
-
if (node instanceof node.ownerDocument.defaultView.SVGSVGElement || node instanceof SVGSVGElement) {
|
13158 |
-
var s = new XMLSerializer();
|
13159 |
-
return resourceLoader.loadImage('data:image/svg+xml,' + encodeURIComponent(s.serializeToString(node)));
|
13160 |
-
}
|
13161 |
-
switch (node.tagName) {
|
13162 |
-
case 'IMG':
|
13163 |
-
// $FlowFixMe
|
13164 |
-
var img = node;
|
13165 |
-
return resourceLoader.loadImage(img.currentSrc || img.src);
|
13166 |
-
case 'CANVAS':
|
13167 |
-
// $FlowFixMe
|
13168 |
-
var canvas = node;
|
13169 |
-
return resourceLoader.loadCanvas(canvas);
|
13170 |
-
case 'IFRAME':
|
13171 |
-
var iframeKey = node.getAttribute('data-html2canvas-internal-iframe-key');
|
13172 |
-
if (iframeKey) {
|
13173 |
-
return iframeKey;
|
13174 |
-
}
|
13175 |
-
break;
|
13176 |
-
}
|
13177 |
-
|
13178 |
-
return null;
|
13179 |
-
};
|
13180 |
-
|
13181 |
-
/***/ }),
|
13182 |
-
/* 4 */
|
13183 |
-
/***/ (function(module, exports, __webpack_require__) {
|
13184 |
-
|
13185 |
-
"use strict";
|
13186 |
-
|
13187 |
-
|
13188 |
-
Object.defineProperty(exports, "__esModule", {
|
13189 |
-
value: true
|
13190 |
-
});
|
13191 |
-
var contains = exports.contains = function contains(bit, value) {
|
13192 |
-
return (bit & value) !== 0;
|
13193 |
-
};
|
13194 |
-
|
13195 |
-
var distance = exports.distance = function distance(a, b) {
|
13196 |
-
return Math.sqrt(a * a + b * b);
|
13197 |
-
};
|
13198 |
-
|
13199 |
-
var copyCSSStyles = exports.copyCSSStyles = function copyCSSStyles(style, target) {
|
13200 |
-
// Edge does not provide value for cssText
|
13201 |
-
for (var i = style.length - 1; i >= 0; i--) {
|
13202 |
-
var property = style.item(i);
|
13203 |
-
// Safari shows pseudoelements if content is set
|
13204 |
-
if (property !== 'content') {
|
13205 |
-
target.style.setProperty(property, style.getPropertyValue(property));
|
13206 |
-
}
|
13207 |
-
}
|
13208 |
-
return target;
|
13209 |
-
};
|
13210 |
-
|
13211 |
-
var SMALL_IMAGE = exports.SMALL_IMAGE = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7';
|
13212 |
-
|
13213 |
-
/***/ }),
|
13214 |
-
/* 5 */
|
13215 |
-
/***/ (function(module, exports, __webpack_require__) {
|
13216 |
-
|
13217 |
-
"use strict";
|
13218 |
-
|
13219 |
-
|
13220 |
-
Object.defineProperty(exports, "__esModule", {
|
13221 |
-
value: true
|
13222 |
-
});
|
13223 |
-
exports.parseBackgroundImage = exports.parseBackground = exports.calculateBackgroundRepeatPath = exports.calculateBackgroundPosition = exports.calculateBackgroungPositioningArea = exports.calculateBackgroungPaintingArea = exports.calculateGradientBackgroundSize = exports.calculateBackgroundSize = exports.BACKGROUND_ORIGIN = exports.BACKGROUND_CLIP = exports.BACKGROUND_SIZE = exports.BACKGROUND_REPEAT = undefined;
|
13224 |
-
|
13225 |
-
var _Color = __webpack_require__(0);
|
13226 |
-
|
13227 |
-
var _Color2 = _interopRequireDefault(_Color);
|
13228 |
-
|
13229 |
-
var _Length = __webpack_require__(1);
|
13230 |
-
|
13231 |
-
var _Length2 = _interopRequireDefault(_Length);
|
13232 |
-
|
13233 |
-
var _Size = __webpack_require__(31);
|
13234 |
-
|
13235 |
-
var _Size2 = _interopRequireDefault(_Size);
|
13236 |
-
|
13237 |
-
var _Vector = __webpack_require__(7);
|
13238 |
-
|
13239 |
-
var _Vector2 = _interopRequireDefault(_Vector);
|
13240 |
-
|
13241 |
-
var _Bounds = __webpack_require__(2);
|
13242 |
-
|
13243 |
-
var _padding = __webpack_require__(17);
|
13244 |
-
|
13245 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13246 |
-
|
13247 |
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
13248 |
-
|
13249 |
-
var BACKGROUND_REPEAT = exports.BACKGROUND_REPEAT = {
|
13250 |
-
REPEAT: 0,
|
13251 |
-
NO_REPEAT: 1,
|
13252 |
-
REPEAT_X: 2,
|
13253 |
-
REPEAT_Y: 3
|
13254 |
-
};
|
13255 |
-
|
13256 |
-
var BACKGROUND_SIZE = exports.BACKGROUND_SIZE = {
|
13257 |
-
AUTO: 0,
|
13258 |
-
CONTAIN: 1,
|
13259 |
-
COVER: 2,
|
13260 |
-
LENGTH: 3
|
13261 |
-
};
|
13262 |
-
|
13263 |
-
var BACKGROUND_CLIP = exports.BACKGROUND_CLIP = {
|
13264 |
-
BORDER_BOX: 0,
|
13265 |
-
PADDING_BOX: 1,
|
13266 |
-
CONTENT_BOX: 2
|
13267 |
-
};
|
13268 |
-
|
13269 |
-
var BACKGROUND_ORIGIN = exports.BACKGROUND_ORIGIN = BACKGROUND_CLIP;
|
13270 |
-
|
13271 |
-
var AUTO = 'auto';
|
13272 |
-
|
13273 |
-
var BackgroundSize = function BackgroundSize(size) {
|
13274 |
-
_classCallCheck(this, BackgroundSize);
|
13275 |
-
|
13276 |
-
switch (size) {
|
13277 |
-
case 'contain':
|
13278 |
-
this.size = BACKGROUND_SIZE.CONTAIN;
|
13279 |
-
break;
|
13280 |
-
case 'cover':
|
13281 |
-
this.size = BACKGROUND_SIZE.COVER;
|
13282 |
-
break;
|
13283 |
-
case 'auto':
|
13284 |
-
this.size = BACKGROUND_SIZE.AUTO;
|
13285 |
-
break;
|
13286 |
-
default:
|
13287 |
-
this.value = new _Length2.default(size);
|
13288 |
-
}
|
13289 |
-
};
|
13290 |
-
|
13291 |
-
var calculateBackgroundSize = exports.calculateBackgroundSize = function calculateBackgroundSize(backgroundImage, image, bounds) {
|
13292 |
-
var width = 0;
|
13293 |
-
var height = 0;
|
13294 |
-
var size = backgroundImage.size;
|
13295 |
-
if (size[0].size === BACKGROUND_SIZE.CONTAIN || size[0].size === BACKGROUND_SIZE.COVER) {
|
13296 |
-
var targetRatio = bounds.width / bounds.height;
|
13297 |
-
var currentRatio = image.width / image.height;
|
13298 |
-
return targetRatio < currentRatio !== (size[0].size === BACKGROUND_SIZE.COVER) ? new _Size2.default(bounds.width, bounds.width / currentRatio) : new _Size2.default(bounds.height * currentRatio, bounds.height);
|
13299 |
-
}
|
13300 |
-
|
13301 |
-
if (size[0].value) {
|
13302 |
-
width = size[0].value.getAbsoluteValue(bounds.width);
|
13303 |
-
}
|
13304 |
-
|
13305 |
-
if (size[0].size === BACKGROUND_SIZE.AUTO && size[1].size === BACKGROUND_SIZE.AUTO) {
|
13306 |
-
height = image.height;
|
13307 |
-
} else if (size[1].size === BACKGROUND_SIZE.AUTO) {
|
13308 |
-
height = width / image.width * image.height;
|
13309 |
-
} else if (size[1].value) {
|
13310 |
-
height = size[1].value.getAbsoluteValue(bounds.height);
|
13311 |
-
}
|
13312 |
-
|
13313 |
-
if (size[0].size === BACKGROUND_SIZE.AUTO) {
|
13314 |
-
width = height / image.height * image.width;
|
13315 |
-
}
|
13316 |
-
|
13317 |
-
return new _Size2.default(width, height);
|
13318 |
-
};
|
13319 |
-
|
13320 |
-
var calculateGradientBackgroundSize = exports.calculateGradientBackgroundSize = function calculateGradientBackgroundSize(backgroundImage, bounds) {
|
13321 |
-
var size = backgroundImage.size;
|
13322 |
-
var width = size[0].value ? size[0].value.getAbsoluteValue(bounds.width) : bounds.width;
|
13323 |
-
var height = size[1].value ? size[1].value.getAbsoluteValue(bounds.height) : size[0].value ? width : bounds.height;
|
13324 |
-
|
13325 |
-
return new _Size2.default(width, height);
|
13326 |
-
};
|
13327 |
-
|
13328 |
-
var AUTO_SIZE = new BackgroundSize(AUTO);
|
13329 |
-
|
13330 |
-
var calculateBackgroungPaintingArea = exports.calculateBackgroungPaintingArea = function calculateBackgroungPaintingArea(curves, clip) {
|
13331 |
-
switch (clip) {
|
13332 |
-
case BACKGROUND_CLIP.BORDER_BOX:
|
13333 |
-
return (0, _Bounds.calculateBorderBoxPath)(curves);
|
13334 |
-
case BACKGROUND_CLIP.PADDING_BOX:
|
13335 |
-
default:
|
13336 |
-
return (0, _Bounds.calculatePaddingBoxPath)(curves);
|
13337 |
-
}
|
13338 |
-
};
|
13339 |
-
|
13340 |
-
var calculateBackgroungPositioningArea = exports.calculateBackgroungPositioningArea = function calculateBackgroungPositioningArea(backgroundOrigin, bounds, padding, border) {
|
13341 |
-
var paddingBox = (0, _Bounds.calculatePaddingBox)(bounds, border);
|
13342 |
-
|
13343 |
-
switch (backgroundOrigin) {
|
13344 |
-
case BACKGROUND_ORIGIN.BORDER_BOX:
|
13345 |
-
return bounds;
|
13346 |
-
case BACKGROUND_ORIGIN.CONTENT_BOX:
|
13347 |
-
var paddingLeft = padding[_padding.PADDING_SIDES.LEFT].getAbsoluteValue(bounds.width);
|
13348 |
-
var paddingRight = padding[_padding.PADDING_SIDES.RIGHT].getAbsoluteValue(bounds.width);
|
13349 |
-
var paddingTop = padding[_padding.PADDING_SIDES.TOP].getAbsoluteValue(bounds.width);
|
13350 |
-
var paddingBottom = padding[_padding.PADDING_SIDES.BOTTOM].getAbsoluteValue(bounds.width);
|
13351 |
-
return new _Bounds.Bounds(paddingBox.left + paddingLeft, paddingBox.top + paddingTop, paddingBox.width - paddingLeft - paddingRight, paddingBox.height - paddingTop - paddingBottom);
|
13352 |
-
case BACKGROUND_ORIGIN.PADDING_BOX:
|
13353 |
-
default:
|
13354 |
-
return paddingBox;
|
13355 |
-
}
|
13356 |
-
};
|
13357 |
-
|
13358 |
-
var calculateBackgroundPosition = exports.calculateBackgroundPosition = function calculateBackgroundPosition(position, size, bounds) {
|
13359 |
-
return new _Vector2.default(position[0].getAbsoluteValue(bounds.width - size.width), position[1].getAbsoluteValue(bounds.height - size.height));
|
13360 |
-
};
|
13361 |
-
|
13362 |
-
var calculateBackgroundRepeatPath = exports.calculateBackgroundRepeatPath = function calculateBackgroundRepeatPath(background, position, size, backgroundPositioningArea, bounds) {
|
13363 |
-
var repeat = background.repeat;
|
13364 |
-
switch (repeat) {
|
13365 |
-
case BACKGROUND_REPEAT.REPEAT_X:
|
13366 |
-
return [new _Vector2.default(Math.round(bounds.left), Math.round(backgroundPositioningArea.top + position.y)), new _Vector2.default(Math.round(bounds.left + bounds.width), Math.round(backgroundPositioningArea.top + position.y)), new _Vector2.default(Math.round(bounds.left + bounds.width), Math.round(size.height + backgroundPositioningArea.top + position.y)), new _Vector2.default(Math.round(bounds.left), Math.round(size.height + backgroundPositioningArea.top + position.y))];
|
13367 |
-
case BACKGROUND_REPEAT.REPEAT_Y:
|
13368 |
-
return [new _Vector2.default(Math.round(backgroundPositioningArea.left + position.x), Math.round(bounds.top)), new _Vector2.default(Math.round(backgroundPositioningArea.left + position.x + size.width), Math.round(bounds.top)), new _Vector2.default(Math.round(backgroundPositioningArea.left + position.x + size.width), Math.round(bounds.height + bounds.top)), new _Vector2.default(Math.round(backgroundPositioningArea.left + position.x), Math.round(bounds.height + bounds.top))];
|
13369 |
-
case BACKGROUND_REPEAT.NO_REPEAT:
|
13370 |
-
return [new _Vector2.default(Math.round(backgroundPositioningArea.left + position.x), Math.round(backgroundPositioningArea.top + position.y)), new _Vector2.default(Math.round(backgroundPositioningArea.left + position.x + size.width), Math.round(backgroundPositioningArea.top + position.y)), new _Vector2.default(Math.round(backgroundPositioningArea.left + position.x + size.width), Math.round(backgroundPositioningArea.top + position.y + size.height)), new _Vector2.default(Math.round(backgroundPositioningArea.left + position.x), Math.round(backgroundPositioningArea.top + position.y + size.height))];
|
13371 |
-
default:
|
13372 |
-
return [new _Vector2.default(Math.round(bounds.left), Math.round(bounds.top)), new _Vector2.default(Math.round(bounds.left + bounds.width), Math.round(bounds.top)), new _Vector2.default(Math.round(bounds.left + bounds.width), Math.round(bounds.height + bounds.top)), new _Vector2.default(Math.round(bounds.left), Math.round(bounds.height + bounds.top))];
|
13373 |
-
}
|
13374 |
-
};
|
13375 |
-
|
13376 |
-
var parseBackground = exports.parseBackground = function parseBackground(style, resourceLoader) {
|
13377 |
-
return {
|
13378 |
-
backgroundColor: new _Color2.default(style.backgroundColor),
|
13379 |
-
backgroundImage: parseBackgroundImages(style, resourceLoader),
|
13380 |
-
backgroundClip: parseBackgroundClip(style.backgroundClip),
|
13381 |
-
backgroundOrigin: parseBackgroundOrigin(style.backgroundOrigin)
|
13382 |
-
};
|
13383 |
-
};
|
13384 |
-
|
13385 |
-
var parseBackgroundClip = function parseBackgroundClip(backgroundClip) {
|
13386 |
-
switch (backgroundClip) {
|
13387 |
-
case 'padding-box':
|
13388 |
-
return BACKGROUND_CLIP.PADDING_BOX;
|
13389 |
-
case 'content-box':
|
13390 |
-
return BACKGROUND_CLIP.CONTENT_BOX;
|
13391 |
-
}
|
13392 |
-
return BACKGROUND_CLIP.BORDER_BOX;
|
13393 |
-
};
|
13394 |
-
|
13395 |
-
var parseBackgroundOrigin = function parseBackgroundOrigin(backgroundOrigin) {
|
13396 |
-
switch (backgroundOrigin) {
|
13397 |
-
case 'padding-box':
|
13398 |
-
return BACKGROUND_ORIGIN.PADDING_BOX;
|
13399 |
-
case 'content-box':
|
13400 |
-
return BACKGROUND_ORIGIN.CONTENT_BOX;
|
13401 |
-
}
|
13402 |
-
return BACKGROUND_ORIGIN.BORDER_BOX;
|
13403 |
-
};
|
13404 |
-
|
13405 |
-
var parseBackgroundRepeat = function parseBackgroundRepeat(backgroundRepeat) {
|
13406 |
-
switch (backgroundRepeat.trim()) {
|
13407 |
-
case 'no-repeat':
|
13408 |
-
return BACKGROUND_REPEAT.NO_REPEAT;
|
13409 |
-
case 'repeat-x':
|
13410 |
-
case 'repeat no-repeat':
|
13411 |
-
return BACKGROUND_REPEAT.REPEAT_X;
|
13412 |
-
case 'repeat-y':
|
13413 |
-
case 'no-repeat repeat':
|
13414 |
-
return BACKGROUND_REPEAT.REPEAT_Y;
|
13415 |
-
case 'repeat':
|
13416 |
-
return BACKGROUND_REPEAT.REPEAT;
|
13417 |
-
}
|
13418 |
-
|
13419 |
-
if (true) {
|
13420 |
-
console.error('Invalid background-repeat value "' + backgroundRepeat + '"');
|
13421 |
-
}
|
13422 |
-
|
13423 |
-
return BACKGROUND_REPEAT.REPEAT;
|
13424 |
-
};
|
13425 |
-
|
13426 |
-
var parseBackgroundImages = function parseBackgroundImages(style, resourceLoader) {
|
13427 |
-
var sources = parseBackgroundImage(style.backgroundImage).map(function (backgroundImage) {
|
13428 |
-
if (backgroundImage.method === 'url') {
|
13429 |
-
var key = resourceLoader.loadImage(backgroundImage.args[0]);
|
13430 |
-
backgroundImage.args = key ? [key] : [];
|
13431 |
-
}
|
13432 |
-
return backgroundImage;
|
13433 |
-
});
|
13434 |
-
var positions = style.backgroundPosition.split(',');
|
13435 |
-
var repeats = style.backgroundRepeat.split(',');
|
13436 |
-
var sizes = style.backgroundSize.split(',');
|
13437 |
-
|
13438 |
-
return sources.map(function (source, index) {
|
13439 |
-
var size = (sizes[index] || AUTO).trim().split(' ').map(parseBackgroundSize);
|
13440 |
-
var position = (positions[index] || AUTO).trim().split(' ').map(parseBackgoundPosition);
|
13441 |
-
|
13442 |
-
return {
|
13443 |
-
source: source,
|
13444 |
-
repeat: parseBackgroundRepeat(typeof repeats[index] === 'string' ? repeats[index] : repeats[0]),
|
13445 |
-
size: size.length < 2 ? [size[0], AUTO_SIZE] : [size[0], size[1]],
|
13446 |
-
position: position.length < 2 ? [position[0], position[0]] : [position[0], position[1]]
|
13447 |
-
};
|
13448 |
-
});
|
13449 |
-
};
|
13450 |
-
|
13451 |
-
var parseBackgroundSize = function parseBackgroundSize(size) {
|
13452 |
-
return size === 'auto' ? AUTO_SIZE : new BackgroundSize(size);
|
13453 |
-
};
|
13454 |
-
|
13455 |
-
var parseBackgoundPosition = function parseBackgoundPosition(position) {
|
13456 |
-
switch (position) {
|
13457 |
-
case 'bottom':
|
13458 |
-
case 'right':
|
13459 |
-
return new _Length2.default('100%');
|
13460 |
-
case 'left':
|
13461 |
-
case 'top':
|
13462 |
-
return new _Length2.default('0%');
|
13463 |
-
case 'auto':
|
13464 |
-
return new _Length2.default('0');
|
13465 |
-
}
|
13466 |
-
return new _Length2.default(position);
|
13467 |
-
};
|
13468 |
-
|
13469 |
-
var parseBackgroundImage = exports.parseBackgroundImage = function parseBackgroundImage(image) {
|
13470 |
-
var whitespace = /^\s$/;
|
13471 |
-
var results = [];
|
13472 |
-
|
13473 |
-
var args = [];
|
13474 |
-
var method = '';
|
13475 |
-
var quote = null;
|
13476 |
-
var definition = '';
|
13477 |
-
var mode = 0;
|
13478 |
-
var numParen = 0;
|
13479 |
-
|
13480 |
-
var appendResult = function appendResult() {
|
13481 |
-
var prefix = '';
|
13482 |
-
if (method) {
|
13483 |
-
if (definition.substr(0, 1) === '"') {
|
13484 |
-
definition = definition.substr(1, definition.length - 2);
|
13485 |
-
}
|
13486 |
-
|
13487 |
-
if (definition) {
|
13488 |
-
args.push(definition.trim());
|
13489 |
-
}
|
13490 |
-
|
13491 |
-
var prefix_i = method.indexOf('-', 1) + 1;
|
13492 |
-
if (method.substr(0, 1) === '-' && prefix_i > 0) {
|
13493 |
-
prefix = method.substr(0, prefix_i).toLowerCase();
|
13494 |
-
method = method.substr(prefix_i);
|
13495 |
-
}
|
13496 |
-
method = method.toLowerCase();
|
13497 |
-
if (method !== 'none') {
|
13498 |
-
results.push({
|
13499 |
-
prefix: prefix,
|
13500 |
-
method: method,
|
13501 |
-
args: args
|
13502 |
-
});
|
13503 |
-
}
|
13504 |
-
}
|
13505 |
-
args = [];
|
13506 |
-
method = definition = '';
|
13507 |
-
};
|
13508 |
-
|
13509 |
-
image.split('').forEach(function (c) {
|
13510 |
-
if (mode === 0 && whitespace.test(c)) {
|
13511 |
-
return;
|
13512 |
-
}
|
13513 |
-
switch (c) {
|
13514 |
-
case '"':
|
13515 |
-
if (!quote) {
|
13516 |
-
quote = c;
|
13517 |
-
} else if (quote === c) {
|
13518 |
-
quote = null;
|
13519 |
-
}
|
13520 |
-
break;
|
13521 |
-
case '(':
|
13522 |
-
if (quote) {
|
13523 |
-
break;
|
13524 |
-
} else if (mode === 0) {
|
13525 |
-
mode = 1;
|
13526 |
-
return;
|
13527 |
-
} else {
|
13528 |
-
numParen++;
|
13529 |
-
}
|
13530 |
-
break;
|
13531 |
-
case ')':
|
13532 |
-
if (quote) {
|
13533 |
-
break;
|
13534 |
-
} else if (mode === 1) {
|
13535 |
-
if (numParen === 0) {
|
13536 |
-
mode = 0;
|
13537 |
-
appendResult();
|
13538 |
-
return;
|
13539 |
-
} else {
|
13540 |
-
numParen--;
|
13541 |
-
}
|
13542 |
-
}
|
13543 |
-
break;
|
13544 |
-
|
13545 |
-
case ',':
|
13546 |
-
if (quote) {
|
13547 |
-
break;
|
13548 |
-
} else if (mode === 0) {
|
13549 |
-
appendResult();
|
13550 |
-
return;
|
13551 |
-
} else if (mode === 1) {
|
13552 |
-
if (numParen === 0 && !method.match(/^url$/i)) {
|
13553 |
-
args.push(definition.trim());
|
13554 |
-
definition = '';
|
13555 |
-
return;
|
13556 |
-
}
|
13557 |
-
}
|
13558 |
-
break;
|
13559 |
-
}
|
13560 |
-
|
13561 |
-
if (mode === 0) {
|
13562 |
-
method += c;
|
13563 |
-
} else {
|
13564 |
-
definition += c;
|
13565 |
-
}
|
13566 |
-
});
|
13567 |
-
|
13568 |
-
appendResult();
|
13569 |
-
return results;
|
13570 |
-
};
|
13571 |
-
|
13572 |
-
/***/ }),
|
13573 |
-
/* 6 */
|
13574 |
-
/***/ (function(module, exports, __webpack_require__) {
|
13575 |
-
|
13576 |
-
"use strict";
|
13577 |
-
|
13578 |
-
|
13579 |
-
Object.defineProperty(exports, "__esModule", {
|
13580 |
-
value: true
|
13581 |
-
});
|
13582 |
-
var PATH = exports.PATH = {
|
13583 |
-
VECTOR: 0,
|
13584 |
-
BEZIER_CURVE: 1,
|
13585 |
-
CIRCLE: 2
|
13586 |
-
};
|
13587 |
-
|
13588 |
-
/***/ }),
|
13589 |
-
/* 7 */
|
13590 |
-
/***/ (function(module, exports, __webpack_require__) {
|
13591 |
-
|
13592 |
-
"use strict";
|
13593 |
-
|
13594 |
-
|
13595 |
-
Object.defineProperty(exports, "__esModule", {
|
13596 |
-
value: true
|
13597 |
-
});
|
13598 |
-
|
13599 |
-
var _Path = __webpack_require__(6);
|
13600 |
-
|
13601 |
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
13602 |
-
|
13603 |
-
var Vector = function Vector(x, y) {
|
13604 |
-
_classCallCheck(this, Vector);
|
13605 |
-
|
13606 |
-
this.type = _Path.PATH.VECTOR;
|
13607 |
-
this.x = x;
|
13608 |
-
this.y = y;
|
13609 |
-
if (true) {
|
13610 |
-
if (isNaN(x)) {
|
13611 |
-
console.error('Invalid x value given for Vector');
|
13612 |
-
}
|
13613 |
-
if (isNaN(y)) {
|
13614 |
-
console.error('Invalid y value given for Vector');
|
13615 |
-
}
|
13616 |
-
}
|
13617 |
-
};
|
13618 |
-
|
13619 |
-
exports.default = Vector;
|
13620 |
-
|
13621 |
-
/***/ }),
|
13622 |
-
/* 8 */
|
13623 |
-
/***/ (function(module, exports, __webpack_require__) {
|
13624 |
-
|
13625 |
-
"use strict";
|
13626 |
-
|
13627 |
-
|
13628 |
-
Object.defineProperty(exports, "__esModule", {
|
13629 |
-
value: true
|
13630 |
-
});
|
13631 |
-
exports.parseListStyle = exports.parseListStyleType = exports.LIST_STYLE_TYPE = exports.LIST_STYLE_POSITION = undefined;
|
13632 |
-
|
13633 |
-
var _background = __webpack_require__(5);
|
13634 |
-
|
13635 |
-
var LIST_STYLE_POSITION = exports.LIST_STYLE_POSITION = {
|
13636 |
-
INSIDE: 0,
|
13637 |
-
OUTSIDE: 1
|
13638 |
-
};
|
13639 |
-
|
13640 |
-
var LIST_STYLE_TYPE = exports.LIST_STYLE_TYPE = {
|
13641 |
-
NONE: -1,
|
13642 |
-
DISC: 0,
|
13643 |
-
CIRCLE: 1,
|
13644 |
-
SQUARE: 2,
|
13645 |
-
DECIMAL: 3,
|
13646 |
-
CJK_DECIMAL: 4,
|
13647 |
-
DECIMAL_LEADING_ZERO: 5,
|
13648 |
-
LOWER_ROMAN: 6,
|
13649 |
-
UPPER_ROMAN: 7,
|
13650 |
-
LOWER_GREEK: 8,
|
13651 |
-
LOWER_ALPHA: 9,
|
13652 |
-
UPPER_ALPHA: 10,
|
13653 |
-
ARABIC_INDIC: 11,
|
13654 |
-
ARMENIAN: 12,
|
13655 |
-
BENGALI: 13,
|
13656 |
-
CAMBODIAN: 14,
|
13657 |
-
CJK_EARTHLY_BRANCH: 15,
|
13658 |
-
CJK_HEAVENLY_STEM: 16,
|
13659 |
-
CJK_IDEOGRAPHIC: 17,
|
13660 |
-
DEVANAGARI: 18,
|
13661 |
-
ETHIOPIC_NUMERIC: 19,
|
13662 |
-
GEORGIAN: 20,
|
13663 |
-
GUJARATI: 21,
|
13664 |
-
GURMUKHI: 22,
|
13665 |
-
HEBREW: 22,
|
13666 |
-
HIRAGANA: 23,
|
13667 |
-
HIRAGANA_IROHA: 24,
|
13668 |
-
JAPANESE_FORMAL: 25,
|
13669 |
-
JAPANESE_INFORMAL: 26,
|
13670 |
-
KANNADA: 27,
|
13671 |
-
KATAKANA: 28,
|
13672 |
-
KATAKANA_IROHA: 29,
|
13673 |
-
KHMER: 30,
|
13674 |
-
KOREAN_HANGUL_FORMAL: 31,
|
13675 |
-
KOREAN_HANJA_FORMAL: 32,
|
13676 |
-
KOREAN_HANJA_INFORMAL: 33,
|
13677 |
-
LAO: 34,
|
13678 |
-
LOWER_ARMENIAN: 35,
|
13679 |
-
MALAYALAM: 36,
|
13680 |
-
MONGOLIAN: 37,
|
13681 |
-
MYANMAR: 38,
|
13682 |
-
ORIYA: 39,
|
13683 |
-
PERSIAN: 40,
|
13684 |
-
SIMP_CHINESE_FORMAL: 41,
|
13685 |
-
SIMP_CHINESE_INFORMAL: 42,
|
13686 |
-
TAMIL: 43,
|
13687 |
-
TELUGU: 44,
|
13688 |
-
THAI: 45,
|
13689 |
-
TIBETAN: 46,
|
13690 |
-
TRAD_CHINESE_FORMAL: 47,
|
13691 |
-
TRAD_CHINESE_INFORMAL: 48,
|
13692 |
-
UPPER_ARMENIAN: 49,
|
13693 |
-
DISCLOSURE_OPEN: 50,
|
13694 |
-
DISCLOSURE_CLOSED: 51
|
13695 |
-
};
|
13696 |
-
|
13697 |
-
var parseListStyleType = exports.parseListStyleType = function parseListStyleType(type) {
|
13698 |
-
switch (type) {
|
13699 |
-
case 'disc':
|
13700 |
-
return LIST_STYLE_TYPE.DISC;
|
13701 |
-
case 'circle':
|
13702 |
-
return LIST_STYLE_TYPE.CIRCLE;
|
13703 |
-
case 'square':
|
13704 |
-
return LIST_STYLE_TYPE.SQUARE;
|
13705 |
-
case 'decimal':
|
13706 |
-
return LIST_STYLE_TYPE.DECIMAL;
|
13707 |
-
case 'cjk-decimal':
|
13708 |
-
return LIST_STYLE_TYPE.CJK_DECIMAL;
|
13709 |
-
case 'decimal-leading-zero':
|
13710 |
-
return LIST_STYLE_TYPE.DECIMAL_LEADING_ZERO;
|
13711 |
-
case 'lower-roman':
|
13712 |
-
return LIST_STYLE_TYPE.LOWER_ROMAN;
|
13713 |
-
case 'upper-roman':
|
13714 |
-
return LIST_STYLE_TYPE.UPPER_ROMAN;
|
13715 |
-
case 'lower-greek':
|
13716 |
-
return LIST_STYLE_TYPE.LOWER_GREEK;
|
13717 |
-
case 'lower-alpha':
|
13718 |
-
return LIST_STYLE_TYPE.LOWER_ALPHA;
|
13719 |
-
case 'upper-alpha':
|
13720 |
-
return LIST_STYLE_TYPE.UPPER_ALPHA;
|
13721 |
-
case 'arabic-indic':
|
13722 |
-
return LIST_STYLE_TYPE.ARABIC_INDIC;
|
13723 |
-
case 'armenian':
|
13724 |
-
return LIST_STYLE_TYPE.ARMENIAN;
|
13725 |
-
case 'bengali':
|
13726 |
-
return LIST_STYLE_TYPE.BENGALI;
|
13727 |
-
case 'cambodian':
|
13728 |
-
return LIST_STYLE_TYPE.CAMBODIAN;
|
13729 |
-
case 'cjk-earthly-branch':
|
13730 |
-
return LIST_STYLE_TYPE.CJK_EARTHLY_BRANCH;
|
13731 |
-
case 'cjk-heavenly-stem':
|
13732 |
-
return LIST_STYLE_TYPE.CJK_HEAVENLY_STEM;
|
13733 |
-
case 'cjk-ideographic':
|
13734 |
-
return LIST_STYLE_TYPE.CJK_IDEOGRAPHIC;
|
13735 |
-
case 'devanagari':
|
13736 |
-
return LIST_STYLE_TYPE.DEVANAGARI;
|
13737 |
-
case 'ethiopic-numeric':
|
13738 |
-
return LIST_STYLE_TYPE.ETHIOPIC_NUMERIC;
|
13739 |
-
case 'georgian':
|
13740 |
-
return LIST_STYLE_TYPE.GEORGIAN;
|
13741 |
-
case 'gujarati':
|
13742 |
-
return LIST_STYLE_TYPE.GUJARATI;
|
13743 |
-
case 'gurmukhi':
|
13744 |
-
return LIST_STYLE_TYPE.GURMUKHI;
|
13745 |
-
case 'hebrew':
|
13746 |
-
return LIST_STYLE_TYPE.HEBREW;
|
13747 |
-
case 'hiragana':
|
13748 |
-
return LIST_STYLE_TYPE.HIRAGANA;
|
13749 |
-
case 'hiragana-iroha':
|
13750 |
-
return LIST_STYLE_TYPE.HIRAGANA_IROHA;
|
13751 |
-
case 'japanese-formal':
|
13752 |
-
return LIST_STYLE_TYPE.JAPANESE_FORMAL;
|
13753 |
-
case 'japanese-informal':
|
13754 |
-
return LIST_STYLE_TYPE.JAPANESE_INFORMAL;
|
13755 |
-
case 'kannada':
|
13756 |
-
return LIST_STYLE_TYPE.KANNADA;
|
13757 |
-
case 'katakana':
|
13758 |
-
return LIST_STYLE_TYPE.KATAKANA;
|
13759 |
-
case 'katakana-iroha':
|
13760 |
-
return LIST_STYLE_TYPE.KATAKANA_IROHA;
|
13761 |
-
case 'khmer':
|
13762 |
-
return LIST_STYLE_TYPE.KHMER;
|
13763 |
-
case 'korean-hangul-formal':
|
13764 |
-
return LIST_STYLE_TYPE.KOREAN_HANGUL_FORMAL;
|
13765 |
-
case 'korean-hanja-formal':
|
13766 |
-
return LIST_STYLE_TYPE.KOREAN_HANJA_FORMAL;
|
13767 |
-
case 'korean-hanja-informal':
|
13768 |
-
return LIST_STYLE_TYPE.KOREAN_HANJA_INFORMAL;
|
13769 |
-
case 'lao':
|
13770 |
-
return LIST_STYLE_TYPE.LAO;
|
13771 |
-
case 'lower-armenian':
|
13772 |
-
return LIST_STYLE_TYPE.LOWER_ARMENIAN;
|
13773 |
-
case 'malayalam':
|
13774 |
-
return LIST_STYLE_TYPE.MALAYALAM;
|
13775 |
-
case 'mongolian':
|
13776 |
-
return LIST_STYLE_TYPE.MONGOLIAN;
|
13777 |
-
case 'myanmar':
|
13778 |
-
return LIST_STYLE_TYPE.MYANMAR;
|
13779 |
-
case 'oriya':
|
13780 |
-
return LIST_STYLE_TYPE.ORIYA;
|
13781 |
-
case 'persian':
|
13782 |
-
return LIST_STYLE_TYPE.PERSIAN;
|
13783 |
-
case 'simp-chinese-formal':
|
13784 |
-
return LIST_STYLE_TYPE.SIMP_CHINESE_FORMAL;
|
13785 |
-
case 'simp-chinese-informal':
|
13786 |
-
return LIST_STYLE_TYPE.SIMP_CHINESE_INFORMAL;
|
13787 |
-
case 'tamil':
|
13788 |
-
return LIST_STYLE_TYPE.TAMIL;
|
13789 |
-
case 'telugu':
|
13790 |
-
return LIST_STYLE_TYPE.TELUGU;
|
13791 |
-
case 'thai':
|
13792 |
-
return LIST_STYLE_TYPE.THAI;
|
13793 |
-
case 'tibetan':
|
13794 |
-
return LIST_STYLE_TYPE.TIBETAN;
|
13795 |
-
case 'trad-chinese-formal':
|
13796 |
-
return LIST_STYLE_TYPE.TRAD_CHINESE_FORMAL;
|
13797 |
-
case 'trad-chinese-informal':
|
13798 |
-
return LIST_STYLE_TYPE.TRAD_CHINESE_INFORMAL;
|
13799 |
-
case 'upper-armenian':
|
13800 |
-
return LIST_STYLE_TYPE.UPPER_ARMENIAN;
|
13801 |
-
case 'disclosure-open':
|
13802 |
-
return LIST_STYLE_TYPE.DISCLOSURE_OPEN;
|
13803 |
-
case 'disclosure-closed':
|
13804 |
-
return LIST_STYLE_TYPE.DISCLOSURE_CLOSED;
|
13805 |
-
case 'none':
|
13806 |
-
default:
|
13807 |
-
return LIST_STYLE_TYPE.NONE;
|
13808 |
-
}
|
13809 |
-
};
|
13810 |
-
|
13811 |
-
var parseListStyle = exports.parseListStyle = function parseListStyle(style) {
|
13812 |
-
var listStyleImage = (0, _background.parseBackgroundImage)(style.getPropertyValue('list-style-image'));
|
13813 |
-
return {
|
13814 |
-
listStyleType: parseListStyleType(style.getPropertyValue('list-style-type')),
|
13815 |
-
listStyleImage: listStyleImage.length ? listStyleImage[0] : null,
|
13816 |
-
listStylePosition: parseListStylePosition(style.getPropertyValue('list-style-position'))
|
13817 |
-
};
|
13818 |
-
};
|
13819 |
-
|
13820 |
-
var parseListStylePosition = function parseListStylePosition(position) {
|
13821 |
-
switch (position) {
|
13822 |
-
case 'inside':
|
13823 |
-
return LIST_STYLE_POSITION.INSIDE;
|
13824 |
-
case 'outside':
|
13825 |
-
default:
|
13826 |
-
return LIST_STYLE_POSITION.OUTSIDE;
|
13827 |
-
}
|
13828 |
-
};
|
13829 |
-
|
13830 |
-
/***/ }),
|
13831 |
-
/* 9 */
|
13832 |
-
/***/ (function(module, exports, __webpack_require__) {
|
13833 |
-
|
13834 |
-
"use strict";
|
13835 |
-
|
13836 |
-
|
13837 |
-
Object.defineProperty(exports, "__esModule", {
|
13838 |
-
value: true
|
13839 |
-
});
|
13840 |
-
|
13841 |
-
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
13842 |
-
|
13843 |
-
var _textTransform = __webpack_require__(20);
|
13844 |
-
|
13845 |
-
var _TextBounds = __webpack_require__(22);
|
13846 |
-
|
13847 |
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
13848 |
-
|
13849 |
-
var TextContainer = function () {
|
13850 |
-
function TextContainer(text, parent, bounds) {
|
13851 |
-
_classCallCheck(this, TextContainer);
|
13852 |
-
|
13853 |
-
this.text = text;
|
13854 |
-
this.parent = parent;
|
13855 |
-
this.bounds = bounds;
|
13856 |
-
}
|
13857 |
-
|
13858 |
-
_createClass(TextContainer, null, [{
|
13859 |
-
key: 'fromTextNode',
|
13860 |
-
value: function fromTextNode(node, parent) {
|
13861 |
-
var text = transform(node.data, parent.style.textTransform);
|
13862 |
-
return new TextContainer(text, parent, (0, _TextBounds.parseTextBounds)(text, parent, node));
|
13863 |
-
}
|
13864 |
-
}]);
|
13865 |
-
|
13866 |
-
return TextContainer;
|
13867 |
-
}();
|
13868 |
-
|
13869 |
-
exports.default = TextContainer;
|
13870 |
-
|
13871 |
-
|
13872 |
-
var CAPITALIZE = /(^|\s|:|-|\(|\))([a-z])/g;
|
13873 |
-
|
13874 |
-
var transform = function transform(text, _transform) {
|
13875 |
-
switch (_transform) {
|
13876 |
-
case _textTransform.TEXT_TRANSFORM.LOWERCASE:
|
13877 |
-
return text.toLowerCase();
|
13878 |
-
case _textTransform.TEXT_TRANSFORM.CAPITALIZE:
|
13879 |
-
return text.replace(CAPITALIZE, capitalize);
|
13880 |
-
case _textTransform.TEXT_TRANSFORM.UPPERCASE:
|
13881 |
-
return text.toUpperCase();
|
13882 |
-
default:
|
13883 |
-
return text;
|
13884 |
-
}
|
13885 |
-
};
|
13886 |
-
|
13887 |
-
function capitalize(m, p1, p2) {
|
13888 |
-
if (m.length > 0) {
|
13889 |
-
return p1 + p2.toUpperCase();
|
13890 |
-
}
|
13891 |
-
|
13892 |
-
return m;
|
13893 |
-
}
|
13894 |
-
|
13895 |
-
/***/ }),
|
13896 |
-
/* 10 */
|
13897 |
-
/***/ (function(module, exports, __webpack_require__) {
|
13898 |
-
|
13899 |
-
"use strict";
|
13900 |
-
|
13901 |
-
|
13902 |
-
Object.defineProperty(exports, "__esModule", {
|
13903 |
-
value: true
|
13904 |
-
});
|
13905 |
-
|
13906 |
-
var _ForeignObjectRenderer = __webpack_require__(23);
|
13907 |
-
|
13908 |
-
var testRangeBounds = function testRangeBounds(document) {
|
13909 |
-
var TEST_HEIGHT = 123;
|
13910 |
-
|
13911 |
-
if (document.createRange) {
|
13912 |
-
var range = document.createRange();
|
13913 |
-
if (range.getBoundingClientRect) {
|
13914 |
-
var testElement = document.createElement('boundtest');
|
13915 |
-
testElement.style.height = TEST_HEIGHT + 'px';
|
13916 |
-
testElement.style.display = 'block';
|
13917 |
-
document.body.appendChild(testElement);
|
13918 |
-
|
13919 |
-
range.selectNode(testElement);
|
13920 |
-
var rangeBounds = range.getBoundingClientRect();
|
13921 |
-
var rangeHeight = Math.round(rangeBounds.height);
|
13922 |
-
document.body.removeChild(testElement);
|
13923 |
-
if (rangeHeight === TEST_HEIGHT) {
|
13924 |
-
return true;
|
13925 |
-
}
|
13926 |
-
}
|
13927 |
-
}
|
13928 |
-
|
13929 |
-
return false;
|
13930 |
-
};
|
13931 |
-
|
13932 |
-
// iOS 10.3 taints canvas with base64 images unless crossOrigin = 'anonymous'
|
13933 |
-
var testBase64 = function testBase64(document, src) {
|
13934 |
-
var img = new Image();
|
13935 |
-
var canvas = document.createElement('canvas');
|
13936 |
-
var ctx = canvas.getContext('2d');
|
13937 |
-
|
13938 |
-
return new Promise(function (resolve) {
|
13939 |
-
// Single pixel base64 image renders fine on iOS 10.3???
|
13940 |
-
img.src = src;
|
13941 |
-
|
13942 |
-
var onload = function onload() {
|
13943 |
-
try {
|
13944 |
-
ctx.drawImage(img, 0, 0);
|
13945 |
-
canvas.toDataURL();
|
13946 |
-
} catch (e) {
|
13947 |
-
return resolve(false);
|
13948 |
-
}
|
13949 |
-
|
13950 |
-
return resolve(true);
|
13951 |
-
};
|
13952 |
-
|
13953 |
-
img.onload = onload;
|
13954 |
-
img.onerror = function () {
|
13955 |
-
return resolve(false);
|
13956 |
-
};
|
13957 |
-
|
13958 |
-
if (img.complete === true) {
|
13959 |
-
setTimeout(function () {
|
13960 |
-
onload();
|
13961 |
-
}, 500);
|
13962 |
-
}
|
13963 |
-
});
|
13964 |
-
};
|
13965 |
-
|
13966 |
-
var testCORS = function testCORS() {
|
13967 |
-
return typeof new Image().crossOrigin !== 'undefined';
|
13968 |
-
};
|
13969 |
-
|
13970 |
-
var testResponseType = function testResponseType() {
|
13971 |
-
return typeof new XMLHttpRequest().responseType === 'string';
|
13972 |
-
};
|
13973 |
-
|
13974 |
-
var testSVG = function testSVG(document) {
|
13975 |
-
var img = new Image();
|
13976 |
-
var canvas = document.createElement('canvas');
|
13977 |
-
var ctx = canvas.getContext('2d');
|
13978 |
-
img.src = 'data:image/svg+xml,<svg xmlns=\'http://www.w3.org/2000/svg\'></svg>';
|
13979 |
-
|
13980 |
-
try {
|
13981 |
-
ctx.drawImage(img, 0, 0);
|
13982 |
-
canvas.toDataURL();
|
13983 |
-
} catch (e) {
|
13984 |
-
return false;
|
13985 |
-
}
|
13986 |
-
return true;
|
13987 |
-
};
|
13988 |
-
|
13989 |
-
var isGreenPixel = function isGreenPixel(data) {
|
13990 |
-
return data[0] === 0 && data[1] === 255 && data[2] === 0 && data[3] === 255;
|
13991 |
-
};
|
13992 |
-
|
13993 |
-
var testForeignObject = function testForeignObject(document) {
|
13994 |
-
var canvas = document.createElement('canvas');
|
13995 |
-
var size = 100;
|
13996 |
-
canvas.width = size;
|
13997 |
-
canvas.height = size;
|
13998 |
-
var ctx = canvas.getContext('2d');
|
13999 |
-
ctx.fillStyle = 'rgb(0, 255, 0)';
|
14000 |
-
ctx.fillRect(0, 0, size, size);
|
14001 |
-
|
14002 |
-
var img = new Image();
|
14003 |
-
var greenImageSrc = canvas.toDataURL();
|
14004 |
-
img.src = greenImageSrc;
|
14005 |
-
var svg = (0, _ForeignObjectRenderer.createForeignObjectSVG)(size, size, 0, 0, img);
|
14006 |
-
ctx.fillStyle = 'red';
|
14007 |
-
ctx.fillRect(0, 0, size, size);
|
14008 |
-
|
14009 |
-
return (0, _ForeignObjectRenderer.loadSerializedSVG)(svg).then(function (img) {
|
14010 |
-
ctx.drawImage(img, 0, 0);
|
14011 |
-
var data = ctx.getImageData(0, 0, size, size).data;
|
14012 |
-
ctx.fillStyle = 'red';
|
14013 |
-
ctx.fillRect(0, 0, size, size);
|
14014 |
-
|
14015 |
-
var node = document.createElement('div');
|
14016 |
-
node.style.backgroundImage = 'url(' + greenImageSrc + ')';
|
14017 |
-
node.style.height = size + 'px';
|
14018 |
-
// Firefox 55 does not render inline <img /> tags
|
14019 |
-
return isGreenPixel(data) ? (0, _ForeignObjectRenderer.loadSerializedSVG)((0, _ForeignObjectRenderer.createForeignObjectSVG)(size, size, 0, 0, node)) : Promise.reject(false);
|
14020 |
-
}).then(function (img) {
|
14021 |
-
ctx.drawImage(img, 0, 0);
|
14022 |
-
// Edge does not render background-images
|
14023 |
-
return isGreenPixel(ctx.getImageData(0, 0, size, size).data);
|
14024 |
-
}).catch(function (e) {
|
14025 |
-
return false;
|
14026 |
-
});
|
14027 |
-
};
|
14028 |
-
|
14029 |
-
var FEATURES = {
|
14030 |
-
// $FlowFixMe - get/set properties not yet supported
|
14031 |
-
get SUPPORT_RANGE_BOUNDS() {
|
14032 |
-
'use strict';
|
14033 |
-
|
14034 |
-
var value = testRangeBounds(document);
|
14035 |
-
Object.defineProperty(FEATURES, 'SUPPORT_RANGE_BOUNDS', { value: value });
|
14036 |
-
return value;
|
14037 |
-
},
|
14038 |
-
// $FlowFixMe - get/set properties not yet supported
|
14039 |
-
get SUPPORT_SVG_DRAWING() {
|
14040 |
-
'use strict';
|
14041 |
-
|
14042 |
-
var value = testSVG(document);
|
14043 |
-
Object.defineProperty(FEATURES, 'SUPPORT_SVG_DRAWING', { value: value });
|
14044 |
-
return value;
|
14045 |
-
},
|
14046 |
-
// $FlowFixMe - get/set properties not yet supported
|
14047 |
-
get SUPPORT_BASE64_DRAWING() {
|
14048 |
-
'use strict';
|
14049 |
-
|
14050 |
-
return function (src) {
|
14051 |
-
var _value = testBase64(document, src);
|
14052 |
-
Object.defineProperty(FEATURES, 'SUPPORT_BASE64_DRAWING', { value: function value() {
|
14053 |
-
return _value;
|
14054 |
-
} });
|
14055 |
-
return _value;
|
14056 |
-
};
|
14057 |
-
},
|
14058 |
-
// $FlowFixMe - get/set properties not yet supported
|
14059 |
-
get SUPPORT_FOREIGNOBJECT_DRAWING() {
|
14060 |
-
'use strict';
|
14061 |
-
|
14062 |
-
var value = typeof Array.from === 'function' && typeof window.fetch === 'function' ? testForeignObject(document) : Promise.resolve(false);
|
14063 |
-
Object.defineProperty(FEATURES, 'SUPPORT_FOREIGNOBJECT_DRAWING', { value: value });
|
14064 |
-
return value;
|
14065 |
-
},
|
14066 |
-
// $FlowFixMe - get/set properties not yet supported
|
14067 |
-
get SUPPORT_CORS_IMAGES() {
|
14068 |
-
'use strict';
|
14069 |
-
|
14070 |
-
var value = testCORS();
|
14071 |
-
Object.defineProperty(FEATURES, 'SUPPORT_CORS_IMAGES', { value: value });
|
14072 |
-
return value;
|
14073 |
-
},
|
14074 |
-
// $FlowFixMe - get/set properties not yet supported
|
14075 |
-
get SUPPORT_RESPONSE_TYPE() {
|
14076 |
-
'use strict';
|
14077 |
-
|
14078 |
-
var value = testResponseType();
|
14079 |
-
Object.defineProperty(FEATURES, 'SUPPORT_RESPONSE_TYPE', { value: value });
|
14080 |
-
return value;
|
14081 |
-
},
|
14082 |
-
// $FlowFixMe - get/set properties not yet supported
|
14083 |
-
get SUPPORT_CORS_XHR() {
|
14084 |
-
'use strict';
|
14085 |
-
|
14086 |
-
var value = 'withCredentials' in new XMLHttpRequest();
|
14087 |
-
Object.defineProperty(FEATURES, 'SUPPORT_CORS_XHR', { value: value });
|
14088 |
-
return value;
|
14089 |
-
}
|
14090 |
-
};
|
14091 |
-
|
14092 |
-
exports.default = FEATURES;
|
14093 |
-
|
14094 |
-
/***/ }),
|
14095 |
-
/* 11 */
|
14096 |
-
/***/ (function(module, exports, __webpack_require__) {
|
14097 |
-
|
14098 |
-
"use strict";
|
14099 |
-
|
14100 |
-
|
14101 |
-
Object.defineProperty(exports, "__esModule", {
|
14102 |
-
value: true
|
14103 |
-
});
|
14104 |
-
exports.parseTextDecoration = exports.TEXT_DECORATION_LINE = exports.TEXT_DECORATION = exports.TEXT_DECORATION_STYLE = undefined;
|
14105 |
-
|
14106 |
-
var _Color = __webpack_require__(0);
|
14107 |
-
|
14108 |
-
var _Color2 = _interopRequireDefault(_Color);
|
14109 |
-
|
14110 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
14111 |
-
|
14112 |
-
var TEXT_DECORATION_STYLE = exports.TEXT_DECORATION_STYLE = {
|
14113 |
-
SOLID: 0,
|
14114 |
-
DOUBLE: 1,
|
14115 |
-
DOTTED: 2,
|
14116 |
-
DASHED: 3,
|
14117 |
-
WAVY: 4
|
14118 |
-
};
|
14119 |
-
|
14120 |
-
var TEXT_DECORATION = exports.TEXT_DECORATION = {
|
14121 |
-
NONE: null
|
14122 |
-
};
|
14123 |
-
|
14124 |
-
var TEXT_DECORATION_LINE = exports.TEXT_DECORATION_LINE = {
|
14125 |
-
UNDERLINE: 1,
|
14126 |
-
OVERLINE: 2,
|
14127 |
-
LINE_THROUGH: 3,
|
14128 |
-
BLINK: 4
|
14129 |
-
};
|
14130 |
-
|
14131 |
-
var parseLine = function parseLine(line) {
|
14132 |
-
switch (line) {
|
14133 |
-
case 'underline':
|
14134 |
-
return TEXT_DECORATION_LINE.UNDERLINE;
|
14135 |
-
case 'overline':
|
14136 |
-
return TEXT_DECORATION_LINE.OVERLINE;
|
14137 |
-
case 'line-through':
|
14138 |
-
return TEXT_DECORATION_LINE.LINE_THROUGH;
|
14139 |
-
}
|
14140 |
-
return TEXT_DECORATION_LINE.BLINK;
|
14141 |
-
};
|
14142 |
-
|
14143 |
-
var parseTextDecorationLine = function parseTextDecorationLine(line) {
|
14144 |
-
if (line === 'none') {
|
14145 |
-
return null;
|
14146 |
-
}
|
14147 |
-
|
14148 |
-
return line.split(' ').map(parseLine);
|
14149 |
-
};
|
14150 |
-
|
14151 |
-
var parseTextDecorationStyle = function parseTextDecorationStyle(style) {
|
14152 |
-
switch (style) {
|
14153 |
-
case 'double':
|
14154 |
-
return TEXT_DECORATION_STYLE.DOUBLE;
|
14155 |
-
case 'dotted':
|
14156 |
-
return TEXT_DECORATION_STYLE.DOTTED;
|
14157 |
-
case 'dashed':
|
14158 |
-
return TEXT_DECORATION_STYLE.DASHED;
|
14159 |
-
case 'wavy':
|
14160 |
-
return TEXT_DECORATION_STYLE.WAVY;
|
14161 |
-
}
|
14162 |
-
return TEXT_DECORATION_STYLE.SOLID;
|
14163 |
-
};
|
14164 |
-
|
14165 |
-
var parseTextDecoration = exports.parseTextDecoration = function parseTextDecoration(style) {
|
14166 |
-
var textDecorationLine = parseTextDecorationLine(style.textDecorationLine ? style.textDecorationLine : style.textDecoration);
|
14167 |
-
if (textDecorationLine === null) {
|
14168 |
-
return TEXT_DECORATION.NONE;
|
14169 |
-
}
|
14170 |
-
|
14171 |
-
var textDecorationColor = style.textDecorationColor ? new _Color2.default(style.textDecorationColor) : null;
|
14172 |
-
var textDecorationStyle = parseTextDecorationStyle(style.textDecorationStyle);
|
14173 |
-
|
14174 |
-
return {
|
14175 |
-
textDecorationLine: textDecorationLine,
|
14176 |
-
textDecorationColor: textDecorationColor,
|
14177 |
-
textDecorationStyle: textDecorationStyle
|
14178 |
-
};
|
14179 |
-
};
|
14180 |
-
|
14181 |
-
/***/ }),
|
14182 |
-
/* 12 */
|
14183 |
-
/***/ (function(module, exports, __webpack_require__) {
|
14184 |
-
|
14185 |
-
"use strict";
|
14186 |
-
|
14187 |
-
|
14188 |
-
Object.defineProperty(exports, "__esModule", {
|
14189 |
-
value: true
|
14190 |
-
});
|
14191 |
-
exports.parseBorder = exports.BORDER_SIDES = exports.BORDER_STYLE = undefined;
|
14192 |
-
|
14193 |
-
var _Color = __webpack_require__(0);
|
14194 |
-
|
14195 |
-
var _Color2 = _interopRequireDefault(_Color);
|
14196 |
-
|
14197 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
14198 |
-
|
14199 |
-
var BORDER_STYLE = exports.BORDER_STYLE = {
|
14200 |
-
NONE: 0,
|
14201 |
-
SOLID: 1
|
14202 |
-
};
|
14203 |
-
|
14204 |
-
var BORDER_SIDES = exports.BORDER_SIDES = {
|
14205 |
-
TOP: 0,
|
14206 |
-
RIGHT: 1,
|
14207 |
-
BOTTOM: 2,
|
14208 |
-
LEFT: 3
|
14209 |
-
};
|
14210 |
-
|
14211 |
-
var SIDES = Object.keys(BORDER_SIDES).map(function (s) {
|
14212 |
-
return s.toLowerCase();
|
14213 |
-
});
|
14214 |
-
|
14215 |
-
var parseBorderStyle = function parseBorderStyle(style) {
|
14216 |
-
switch (style) {
|
14217 |
-
case 'none':
|
14218 |
-
return BORDER_STYLE.NONE;
|
14219 |
-
}
|
14220 |
-
return BORDER_STYLE.SOLID;
|
14221 |
-
};
|
14222 |
-
|
14223 |
-
var parseBorder = exports.parseBorder = function parseBorder(style) {
|
14224 |
-
return SIDES.map(function (side) {
|
14225 |
-
var borderColor = new _Color2.default(style.getPropertyValue('border-' + side + '-color'));
|
14226 |
-
var borderStyle = parseBorderStyle(style.getPropertyValue('border-' + side + '-style'));
|
14227 |
-
var borderWidth = parseFloat(style.getPropertyValue('border-' + side + '-width'));
|
14228 |
-
return {
|
14229 |
-
borderColor: borderColor,
|
14230 |
-
borderStyle: borderStyle,
|
14231 |
-
borderWidth: isNaN(borderWidth) ? 0 : borderWidth
|
14232 |
-
};
|
14233 |
-
});
|
14234 |
-
};
|
14235 |
-
|
14236 |
-
/***/ }),
|
14237 |
-
/* 13 */
|
14238 |
-
/***/ (function(module, exports, __webpack_require__) {
|
14239 |
-
|
14240 |
-
"use strict";
|
14241 |
-
|
14242 |
-
|
14243 |
-
Object.defineProperty(exports, "__esModule", {
|
14244 |
-
value: true
|
14245 |
-
});
|
14246 |
-
var toCodePoints = exports.toCodePoints = function toCodePoints(str) {
|
14247 |
-
var codePoints = [];
|
14248 |
-
var i = 0;
|
14249 |
-
var length = str.length;
|
14250 |
-
while (i < length) {
|
14251 |
-
var value = str.charCodeAt(i++);
|
14252 |
-
if (value >= 0xd800 && value <= 0xdbff && i < length) {
|
14253 |
-
var extra = str.charCodeAt(i++);
|
14254 |
-
if ((extra & 0xfc00) === 0xdc00) {
|
14255 |
-
codePoints.push(((value & 0x3ff) << 10) + (extra & 0x3ff) + 0x10000);
|
14256 |
-
} else {
|
14257 |
-
codePoints.push(value);
|
14258 |
-
i--;
|
14259 |
-
}
|
14260 |
-
} else {
|
14261 |
-
codePoints.push(value);
|
14262 |
-
}
|
14263 |
-
}
|
14264 |
-
return codePoints;
|
14265 |
-
};
|
14266 |
-
|
14267 |
-
var fromCodePoint = exports.fromCodePoint = function fromCodePoint() {
|
14268 |
-
if (String.fromCodePoint) {
|
14269 |
-
return String.fromCodePoint.apply(String, arguments);
|
14270 |
-
}
|
14271 |
-
|
14272 |
-
var length = arguments.length;
|
14273 |
-
if (!length) {
|
14274 |
-
return '';
|
14275 |
-
}
|
14276 |
-
|
14277 |
-
var codeUnits = [];
|
14278 |
-
|
14279 |
-
var index = -1;
|
14280 |
-
var result = '';
|
14281 |
-
while (++index < length) {
|
14282 |
-
var codePoint = arguments.length <= index ? undefined : arguments[index];
|
14283 |
-
if (codePoint <= 0xffff) {
|
14284 |
-
codeUnits.push(codePoint);
|
14285 |
-
} else {
|
14286 |
-
codePoint -= 0x10000;
|
14287 |
-
codeUnits.push((codePoint >> 10) + 0xd800, codePoint % 0x400 + 0xdc00);
|
14288 |
-
}
|
14289 |
-
if (index + 1 === length || codeUnits.length > 0x4000) {
|
14290 |
-
result += String.fromCharCode.apply(String, codeUnits);
|
14291 |
-
codeUnits.length = 0;
|
14292 |
-
}
|
14293 |
-
}
|
14294 |
-
return result;
|
14295 |
-
};
|
14296 |
-
|
14297 |
-
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
14298 |
-
|
14299 |
-
// Use a lookup table to find the index.
|
14300 |
-
var lookup = typeof Uint8Array === 'undefined' ? [] : new Uint8Array(256);
|
14301 |
-
for (var i = 0; i < chars.length; i++) {
|
14302 |
-
lookup[chars.charCodeAt(i)] = i;
|
14303 |
-
}
|
14304 |
-
|
14305 |
-
var decode = exports.decode = function decode(base64) {
|
14306 |
-
var bufferLength = base64.length * 0.75,
|
14307 |
-
len = base64.length,
|
14308 |
-
i = void 0,
|
14309 |
-
p = 0,
|
14310 |
-
encoded1 = void 0,
|
14311 |
-
encoded2 = void 0,
|
14312 |
-
encoded3 = void 0,
|
14313 |
-
encoded4 = void 0;
|
14314 |
-
|
14315 |
-
if (base64[base64.length - 1] === '=') {
|
14316 |
-
bufferLength--;
|
14317 |
-
if (base64[base64.length - 2] === '=') {
|
14318 |
-
bufferLength--;
|
14319 |
-
}
|
14320 |
-
}
|
14321 |
-
|
14322 |
-
var buffer = typeof ArrayBuffer !== 'undefined' && typeof Uint8Array !== 'undefined' && typeof Uint8Array.prototype.slice !== 'undefined' ? new ArrayBuffer(bufferLength) : new Array(bufferLength);
|
14323 |
-
var bytes = Array.isArray(buffer) ? buffer : new Uint8Array(buffer);
|
14324 |
-
|
14325 |
-
for (i = 0; i < len; i += 4) {
|
14326 |
-
encoded1 = lookup[base64.charCodeAt(i)];
|
14327 |
-
encoded2 = lookup[base64.charCodeAt(i + 1)];
|
14328 |
-
encoded3 = lookup[base64.charCodeAt(i + 2)];
|
14329 |
-
encoded4 = lookup[base64.charCodeAt(i + 3)];
|
14330 |
-
|
14331 |
-
bytes[p++] = encoded1 << 2 | encoded2 >> 4;
|
14332 |
-
bytes[p++] = (encoded2 & 15) << 4 | encoded3 >> 2;
|
14333 |
-
bytes[p++] = (encoded3 & 3) << 6 | encoded4 & 63;
|
14334 |
-
}
|
14335 |
-
|
14336 |
-
return buffer;
|
14337 |
-
};
|
14338 |
-
|
14339 |
-
var polyUint16Array = exports.polyUint16Array = function polyUint16Array(buffer) {
|
14340 |
-
var length = buffer.length;
|
14341 |
-
var bytes = [];
|
14342 |
-
for (var _i = 0; _i < length; _i += 2) {
|
14343 |
-
bytes.push(buffer[_i + 1] << 8 | buffer[_i]);
|
14344 |
-
}
|
14345 |
-
return bytes;
|
14346 |
-
};
|
14347 |
-
|
14348 |
-
var polyUint32Array = exports.polyUint32Array = function polyUint32Array(buffer) {
|
14349 |
-
var length = buffer.length;
|
14350 |
-
var bytes = [];
|
14351 |
-
for (var _i2 = 0; _i2 < length; _i2 += 4) {
|
14352 |
-
bytes.push(buffer[_i2 + 3] << 24 | buffer[_i2 + 2] << 16 | buffer[_i2 + 1] << 8 | buffer[_i2]);
|
14353 |
-
}
|
14354 |
-
return bytes;
|
14355 |
-
};
|
14356 |
-
|
14357 |
-
/***/ }),
|
14358 |
-
/* 14 */
|
14359 |
-
/***/ (function(module, exports, __webpack_require__) {
|
14360 |
-
|
14361 |
-
"use strict";
|
14362 |
-
|
14363 |
-
|
14364 |
-
Object.defineProperty(exports, "__esModule", {
|
14365 |
-
value: true
|
14366 |
-
});
|
14367 |
-
exports.createCounterText = exports.inlineListItemElement = exports.getListOwner = undefined;
|
14368 |
-
|
14369 |
-
var _Util = __webpack_require__(4);
|
14370 |
-
|
14371 |
-
var _NodeContainer = __webpack_require__(3);
|
14372 |
-
|
14373 |
-
var _NodeContainer2 = _interopRequireDefault(_NodeContainer);
|
14374 |
-
|
14375 |
-
var _TextContainer = __webpack_require__(9);
|
14376 |
-
|
14377 |
-
var _TextContainer2 = _interopRequireDefault(_TextContainer);
|
14378 |
-
|
14379 |
-
var _listStyle = __webpack_require__(8);
|
14380 |
-
|
14381 |
-
var _Unicode = __webpack_require__(24);
|
14382 |
-
|
14383 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
14384 |
-
|
14385 |
-
// Margin between the enumeration and the list item content
|
14386 |
-
var MARGIN_RIGHT = 7;
|
14387 |
-
|
14388 |
-
var ancestorTypes = ['OL', 'UL', 'MENU'];
|
14389 |
-
|
14390 |
-
var getListOwner = exports.getListOwner = function getListOwner(container) {
|
14391 |
-
var parent = container.parent;
|
14392 |
-
if (!parent) {
|
14393 |
-
return null;
|
14394 |
-
}
|
14395 |
-
|
14396 |
-
do {
|
14397 |
-
var isAncestor = ancestorTypes.indexOf(parent.tagName) !== -1;
|
14398 |
-
if (isAncestor) {
|
14399 |
-
return parent;
|
14400 |
-
}
|
14401 |
-
parent = parent.parent;
|
14402 |
-
} while (parent);
|
14403 |
-
|
14404 |
-
return container.parent;
|
14405 |
-
};
|
14406 |
-
|
14407 |
-
var inlineListItemElement = exports.inlineListItemElement = function inlineListItemElement(node, container, resourceLoader) {
|
14408 |
-
var listStyle = container.style.listStyle;
|
14409 |
-
|
14410 |
-
if (!listStyle) {
|
14411 |
-
return;
|
14412 |
-
}
|
14413 |
-
|
14414 |
-
var style = node.ownerDocument.defaultView.getComputedStyle(node, null);
|
14415 |
-
var wrapper = node.ownerDocument.createElement('html2canvaswrapper');
|
14416 |
-
(0, _Util.copyCSSStyles)(style, wrapper);
|
14417 |
-
|
14418 |
-
wrapper.style.position = 'absolute';
|
14419 |
-
wrapper.style.bottom = 'auto';
|
14420 |
-
wrapper.style.display = 'block';
|
14421 |
-
wrapper.style.letterSpacing = 'normal';
|
14422 |
-
|
14423 |
-
switch (listStyle.listStylePosition) {
|
14424 |
-
case _listStyle.LIST_STYLE_POSITION.OUTSIDE:
|
14425 |
-
wrapper.style.left = 'auto';
|
14426 |
-
wrapper.style.right = node.ownerDocument.defaultView.innerWidth - container.bounds.left - container.style.margin[1].getAbsoluteValue(container.bounds.width) + MARGIN_RIGHT + 'px';
|
14427 |
-
wrapper.style.textAlign = 'right';
|
14428 |
-
break;
|
14429 |
-
case _listStyle.LIST_STYLE_POSITION.INSIDE:
|
14430 |
-
wrapper.style.left = container.bounds.left - container.style.margin[3].getAbsoluteValue(container.bounds.width) + 'px';
|
14431 |
-
wrapper.style.right = 'auto';
|
14432 |
-
wrapper.style.textAlign = 'left';
|
14433 |
-
break;
|
14434 |
-
}
|
14435 |
-
|
14436 |
-
var text = void 0;
|
14437 |
-
var MARGIN_TOP = container.style.margin[0].getAbsoluteValue(container.bounds.width);
|
14438 |
-
var styleImage = listStyle.listStyleImage;
|
14439 |
-
if (styleImage) {
|
14440 |
-
if (styleImage.method === 'url') {
|
14441 |
-
var image = node.ownerDocument.createElement('img');
|
14442 |
-
image.src = styleImage.args[0];
|
14443 |
-
wrapper.style.top = container.bounds.top - MARGIN_TOP + 'px';
|
14444 |
-
wrapper.style.width = 'auto';
|
14445 |
-
wrapper.style.height = 'auto';
|
14446 |
-
wrapper.appendChild(image);
|
14447 |
-
} else {
|
14448 |
-
var size = parseFloat(container.style.font.fontSize) * 0.5;
|
14449 |
-
wrapper.style.top = container.bounds.top - MARGIN_TOP + container.bounds.height - 1.5 * size + 'px';
|
14450 |
-
wrapper.style.width = size + 'px';
|
14451 |
-
wrapper.style.height = size + 'px';
|
14452 |
-
wrapper.style.backgroundImage = style.listStyleImage;
|
14453 |
-
}
|
14454 |
-
} else if (typeof container.listIndex === 'number') {
|
14455 |
-
text = node.ownerDocument.createTextNode(createCounterText(container.listIndex, listStyle.listStyleType, true));
|
14456 |
-
wrapper.appendChild(text);
|
14457 |
-
wrapper.style.top = container.bounds.top - MARGIN_TOP + 'px';
|
14458 |
-
}
|
14459 |
-
|
14460 |
-
// $FlowFixMe
|
14461 |
-
var body = node.ownerDocument.body;
|
14462 |
-
body.appendChild(wrapper);
|
14463 |
-
|
14464 |
-
if (text) {
|
14465 |
-
container.childNodes.push(_TextContainer2.default.fromTextNode(text, container));
|
14466 |
-
body.removeChild(wrapper);
|
14467 |
-
} else {
|
14468 |
-
// $FlowFixMe
|
14469 |
-
container.childNodes.push(new _NodeContainer2.default(wrapper, container, resourceLoader, 0));
|
14470 |
-
}
|
14471 |
-
};
|
14472 |
-
|
14473 |
-
var ROMAN_UPPER = {
|
14474 |
-
integers: [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1],
|
14475 |
-
values: ['M', 'CM', 'D', 'CD', 'C', 'XC', 'L', 'XL', 'X', 'IX', 'V', 'IV', 'I']
|
14476 |
-
};
|
14477 |
-
|
14478 |
-
var ARMENIAN = {
|
14479 |
-
integers: [9000, 8000, 7000, 6000, 5000, 4000, 3000, 2000, 1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1],
|
14480 |
-
values: ['Ք', 'Փ', 'Ւ', 'Ց', 'Ր', 'Տ', 'Վ', 'Ս', 'Ռ', 'Ջ', 'Պ', 'Չ', 'Ո', 'Շ', 'Ն', 'Յ', 'Մ', 'Ճ', 'Ղ', 'Ձ', 'Հ', 'Կ', 'Ծ', 'Խ', 'Լ', 'Ի', 'Ժ', 'Թ', 'Ը', 'Է', 'Զ', 'Ե', 'Դ', 'Գ', 'Բ', 'Ա']
|
14481 |
-
};
|
14482 |
-
|
14483 |
-
var HEBREW = {
|
14484 |
-
integers: [10000, 9000, 8000, 7000, 6000, 5000, 4000, 3000, 2000, 1000, 400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20, 19, 18, 17, 16, 15, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1],
|
14485 |
-
values: ['י׳', 'ט׳', 'ח׳', 'ז׳', 'ו׳', 'ה׳', 'ד׳', 'ג׳', 'ב׳', 'א׳', 'ת', 'ש', 'ר', 'ק', 'צ', 'פ', 'ע', 'ס', 'נ', 'מ', 'ל', 'כ', 'יט', 'יח', 'יז', 'טז', 'טו', 'י', 'ט', 'ח', 'ז', 'ו', 'ה', 'ד', 'ג', 'ב', 'א']
|
14486 |
-
};
|
14487 |
-
|
14488 |
-
var GEORGIAN = {
|
14489 |
-
integers: [10000, 9000, 8000, 7000, 6000, 5000, 4000, 3000, 2000, 1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1],
|
14490 |
-
values: ['ჵ', 'ჰ', 'ჯ', 'ჴ', 'ხ', 'ჭ', 'წ', 'ძ', 'ც', 'ჩ', 'შ', 'ყ', 'ღ', 'ქ', 'ფ', 'ჳ', 'ტ', 'ს', 'რ', 'ჟ', 'პ', 'ო', 'ჲ', 'ნ', 'მ', 'ლ', 'კ', 'ი', 'თ', 'ჱ', 'ზ', 'ვ', 'ე', 'დ', 'გ', 'ბ', 'ა']
|
14491 |
-
};
|
14492 |
-
|
14493 |
-
var createAdditiveCounter = function createAdditiveCounter(value, min, max, symbols, fallback, suffix) {
|
14494 |
-
if (value < min || value > max) {
|
14495 |
-
return createCounterText(value, fallback, suffix.length > 0);
|
14496 |
-
}
|
14497 |
-
|
14498 |
-
return symbols.integers.reduce(function (string, integer, index) {
|
14499 |
-
while (value >= integer) {
|
14500 |
-
value -= integer;
|
14501 |
-
string += symbols.values[index];
|
14502 |
-
}
|
14503 |
-
return string;
|
14504 |
-
}, '') + suffix;
|
14505 |
-
};
|
14506 |
-
|
14507 |
-
var createCounterStyleWithSymbolResolver = function createCounterStyleWithSymbolResolver(value, codePointRangeLength, isNumeric, resolver) {
|
14508 |
-
var string = '';
|
14509 |
-
|
14510 |
-
do {
|
14511 |
-
if (!isNumeric) {
|
14512 |
-
value--;
|
14513 |
-
}
|
14514 |
-
string = resolver(value) + string;
|
14515 |
-
value /= codePointRangeLength;
|
14516 |
-
} while (value * codePointRangeLength >= codePointRangeLength);
|
14517 |
-
|
14518 |
-
return string;
|
14519 |
-
};
|
14520 |
-
|
14521 |
-
var createCounterStyleFromRange = function createCounterStyleFromRange(value, codePointRangeStart, codePointRangeEnd, isNumeric, suffix) {
|
14522 |
-
var codePointRangeLength = codePointRangeEnd - codePointRangeStart + 1;
|
14523 |
-
|
14524 |
-
return (value < 0 ? '-' : '') + (createCounterStyleWithSymbolResolver(Math.abs(value), codePointRangeLength, isNumeric, function (codePoint) {
|
14525 |
-
return (0, _Unicode.fromCodePoint)(Math.floor(codePoint % codePointRangeLength) + codePointRangeStart);
|
14526 |
-
}) + suffix);
|
14527 |
-
};
|
14528 |
-
|
14529 |
-
var createCounterStyleFromSymbols = function createCounterStyleFromSymbols(value, symbols) {
|
14530 |
-
var suffix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '. ';
|
14531 |
-
|
14532 |
-
var codePointRangeLength = symbols.length;
|
14533 |
-
return createCounterStyleWithSymbolResolver(Math.abs(value), codePointRangeLength, false, function (codePoint) {
|
14534 |
-
return symbols[Math.floor(codePoint % codePointRangeLength)];
|
14535 |
-
}) + suffix;
|
14536 |
-
};
|
14537 |
-
|
14538 |
-
var CJK_ZEROS = 1 << 0;
|
14539 |
-
var CJK_TEN_COEFFICIENTS = 1 << 1;
|
14540 |
-
var CJK_TEN_HIGH_COEFFICIENTS = 1 << 2;
|
14541 |
-
var CJK_HUNDRED_COEFFICIENTS = 1 << 3;
|
14542 |
-
|
14543 |
-
var createCJKCounter = function createCJKCounter(value, numbers, multipliers, negativeSign, suffix, flags) {
|
14544 |
-
if (value < -9999 || value > 9999) {
|
14545 |
-
return createCounterText(value, _listStyle.LIST_STYLE_TYPE.CJK_DECIMAL, suffix.length > 0);
|
14546 |
-
}
|
14547 |
-
var tmp = Math.abs(value);
|
14548 |
-
var string = suffix;
|
14549 |
-
|
14550 |
-
if (tmp === 0) {
|
14551 |
-
return numbers[0] + string;
|
14552 |
-
}
|
14553 |
-
|
14554 |
-
for (var digit = 0; tmp > 0 && digit <= 4; digit++) {
|
14555 |
-
var coefficient = tmp % 10;
|
14556 |
-
|
14557 |
-
if (coefficient === 0 && (0, _Util.contains)(flags, CJK_ZEROS) && string !== '') {
|
14558 |
-
string = numbers[coefficient] + string;
|
14559 |
-
} else if (coefficient > 1 || coefficient === 1 && digit === 0 || coefficient === 1 && digit === 1 && (0, _Util.contains)(flags, CJK_TEN_COEFFICIENTS) || coefficient === 1 && digit === 1 && (0, _Util.contains)(flags, CJK_TEN_HIGH_COEFFICIENTS) && value > 100 || coefficient === 1 && digit > 1 && (0, _Util.contains)(flags, CJK_HUNDRED_COEFFICIENTS)) {
|
14560 |
-
string = numbers[coefficient] + (digit > 0 ? multipliers[digit - 1] : '') + string;
|
14561 |
-
} else if (coefficient === 1 && digit > 0) {
|
14562 |
-
string = multipliers[digit - 1] + string;
|
14563 |
-
}
|
14564 |
-
tmp = Math.floor(tmp / 10);
|
14565 |
-
}
|
14566 |
-
|
14567 |
-
return (value < 0 ? negativeSign : '') + string;
|
14568 |
-
};
|
14569 |
-
|
14570 |
-
var CHINESE_INFORMAL_MULTIPLIERS = '十百千萬';
|
14571 |
-
var CHINESE_FORMAL_MULTIPLIERS = '拾佰仟萬';
|
14572 |
-
var JAPANESE_NEGATIVE = 'マイナス';
|
14573 |
-
var KOREAN_NEGATIVE = '마이너스 ';
|
14574 |
-
|
14575 |
-
var createCounterText = exports.createCounterText = function createCounterText(value, type, appendSuffix) {
|
14576 |
-
var defaultSuffix = appendSuffix ? '. ' : '';
|
14577 |
-
var cjkSuffix = appendSuffix ? '、' : '';
|
14578 |
-
var koreanSuffix = appendSuffix ? ', ' : '';
|
14579 |
-
switch (type) {
|
14580 |
-
case _listStyle.LIST_STYLE_TYPE.DISC:
|
14581 |
-
return '•';
|
14582 |
-
case _listStyle.LIST_STYLE_TYPE.CIRCLE:
|
14583 |
-
return '◦';
|
14584 |
-
case _listStyle.LIST_STYLE_TYPE.SQUARE:
|
14585 |
-
return '◾';
|
14586 |
-
case _listStyle.LIST_STYLE_TYPE.DECIMAL_LEADING_ZERO:
|
14587 |
-
var string = createCounterStyleFromRange(value, 48, 57, true, defaultSuffix);
|
14588 |
-
return string.length < 4 ? '0' + string : string;
|
14589 |
-
case _listStyle.LIST_STYLE_TYPE.CJK_DECIMAL:
|
14590 |
-
return createCounterStyleFromSymbols(value, '〇一二三四五六七八九', cjkSuffix);
|
14591 |
-
case _listStyle.LIST_STYLE_TYPE.LOWER_ROMAN:
|
14592 |
-
return createAdditiveCounter(value, 1, 3999, ROMAN_UPPER, _listStyle.LIST_STYLE_TYPE.DECIMAL, defaultSuffix).toLowerCase();
|
14593 |
-
case _listStyle.LIST_STYLE_TYPE.UPPER_ROMAN:
|
14594 |
-
return createAdditiveCounter(value, 1, 3999, ROMAN_UPPER, _listStyle.LIST_STYLE_TYPE.DECIMAL, defaultSuffix);
|
14595 |
-
case _listStyle.LIST_STYLE_TYPE.LOWER_GREEK:
|
14596 |
-
return createCounterStyleFromRange(value, 945, 969, false, defaultSuffix);
|
14597 |
-
case _listStyle.LIST_STYLE_TYPE.LOWER_ALPHA:
|
14598 |
-
return createCounterStyleFromRange(value, 97, 122, false, defaultSuffix);
|
14599 |
-
case _listStyle.LIST_STYLE_TYPE.UPPER_ALPHA:
|
14600 |
-
return createCounterStyleFromRange(value, 65, 90, false, defaultSuffix);
|
14601 |
-
case _listStyle.LIST_STYLE_TYPE.ARABIC_INDIC:
|
14602 |
-
return createCounterStyleFromRange(value, 1632, 1641, true, defaultSuffix);
|
14603 |
-
case _listStyle.LIST_STYLE_TYPE.ARMENIAN:
|
14604 |
-
case _listStyle.LIST_STYLE_TYPE.UPPER_ARMENIAN:
|
14605 |
-
return createAdditiveCounter(value, 1, 9999, ARMENIAN, _listStyle.LIST_STYLE_TYPE.DECIMAL, defaultSuffix);
|
14606 |
-
case _listStyle.LIST_STYLE_TYPE.LOWER_ARMENIAN:
|
14607 |
-
return createAdditiveCounter(value, 1, 9999, ARMENIAN, _listStyle.LIST_STYLE_TYPE.DECIMAL, defaultSuffix).toLowerCase();
|
14608 |
-
case _listStyle.LIST_STYLE_TYPE.BENGALI:
|
14609 |
-
return createCounterStyleFromRange(value, 2534, 2543, true, defaultSuffix);
|
14610 |
-
case _listStyle.LIST_STYLE_TYPE.CAMBODIAN:
|
14611 |
-
case _listStyle.LIST_STYLE_TYPE.KHMER:
|
14612 |
-
return createCounterStyleFromRange(value, 6112, 6121, true, defaultSuffix);
|
14613 |
-
case _listStyle.LIST_STYLE_TYPE.CJK_EARTHLY_BRANCH:
|
14614 |
-
return createCounterStyleFromSymbols(value, '子丑寅卯辰巳午未申酉戌亥', cjkSuffix);
|
14615 |
-
case _listStyle.LIST_STYLE_TYPE.CJK_HEAVENLY_STEM:
|
14616 |
-
return createCounterStyleFromSymbols(value, '甲乙丙丁戊己庚辛壬癸', cjkSuffix);
|
14617 |
-
case _listStyle.LIST_STYLE_TYPE.CJK_IDEOGRAPHIC:
|
14618 |
-
case _listStyle.LIST_STYLE_TYPE.TRAD_CHINESE_INFORMAL:
|
14619 |
-
return createCJKCounter(value, '零一二三四五六七八九', CHINESE_INFORMAL_MULTIPLIERS, '負', cjkSuffix, CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS);
|
14620 |
-
case _listStyle.LIST_STYLE_TYPE.TRAD_CHINESE_FORMAL:
|
14621 |
-
return createCJKCounter(value, '零壹貳參肆伍陸柒捌玖', CHINESE_FORMAL_MULTIPLIERS, '負', cjkSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS);
|
14622 |
-
case _listStyle.LIST_STYLE_TYPE.SIMP_CHINESE_INFORMAL:
|
14623 |
-
return createCJKCounter(value, '零一二三四五六七八九', CHINESE_INFORMAL_MULTIPLIERS, '负', cjkSuffix, CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS);
|
14624 |
-
case _listStyle.LIST_STYLE_TYPE.SIMP_CHINESE_FORMAL:
|
14625 |
-
return createCJKCounter(value, '零壹贰叁肆伍陆柒捌玖', CHINESE_FORMAL_MULTIPLIERS, '负', cjkSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS);
|
14626 |
-
case _listStyle.LIST_STYLE_TYPE.JAPANESE_INFORMAL:
|
14627 |
-
return createCJKCounter(value, '〇一二三四五六七八九', '十百千万', JAPANESE_NEGATIVE, cjkSuffix, 0);
|
14628 |
-
case _listStyle.LIST_STYLE_TYPE.JAPANESE_FORMAL:
|
14629 |
-
return createCJKCounter(value, '零壱弐参四伍六七八九', '拾百千万', JAPANESE_NEGATIVE, cjkSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS);
|
14630 |
-
case _listStyle.LIST_STYLE_TYPE.KOREAN_HANGUL_FORMAL:
|
14631 |
-
return createCJKCounter(value, '영일이삼사오육칠팔구', '십백천만', KOREAN_NEGATIVE, koreanSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS);
|
14632 |
-
case _listStyle.LIST_STYLE_TYPE.KOREAN_HANJA_INFORMAL:
|
14633 |
-
return createCJKCounter(value, '零一二三四五六七八九', '十百千萬', KOREAN_NEGATIVE, koreanSuffix, 0);
|
14634 |
-
case _listStyle.LIST_STYLE_TYPE.KOREAN_HANJA_FORMAL:
|
14635 |
-
return createCJKCounter(value, '零壹貳參四五六七八九', '拾百千', KOREAN_NEGATIVE, koreanSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS);
|
14636 |
-
case _listStyle.LIST_STYLE_TYPE.DEVANAGARI:
|
14637 |
-
return createCounterStyleFromRange(value, 0x966, 0x96f, true, defaultSuffix);
|
14638 |
-
case _listStyle.LIST_STYLE_TYPE.GEORGIAN:
|
14639 |
-
return createAdditiveCounter(value, 1, 19999, GEORGIAN, _listStyle.LIST_STYLE_TYPE.DECIMAL, defaultSuffix);
|
14640 |
-
case _listStyle.LIST_STYLE_TYPE.GUJARATI:
|
14641 |
-
return createCounterStyleFromRange(value, 0xae6, 0xaef, true, defaultSuffix);
|
14642 |
-
case _listStyle.LIST_STYLE_TYPE.GURMUKHI:
|
14643 |
-
return createCounterStyleFromRange(value, 0xa66, 0xa6f, true, defaultSuffix);
|
14644 |
-
case _listStyle.LIST_STYLE_TYPE.HEBREW:
|
14645 |
-
return createAdditiveCounter(value, 1, 10999, HEBREW, _listStyle.LIST_STYLE_TYPE.DECIMAL, defaultSuffix);
|
14646 |
-
case _listStyle.LIST_STYLE_TYPE.HIRAGANA:
|
14647 |
-
return createCounterStyleFromSymbols(value, 'あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん');
|
14648 |
-
case _listStyle.LIST_STYLE_TYPE.HIRAGANA_IROHA:
|
14649 |
-
return createCounterStyleFromSymbols(value, 'いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす');
|
14650 |
-
case _listStyle.LIST_STYLE_TYPE.KANNADA:
|
14651 |
-
return createCounterStyleFromRange(value, 0xce6, 0xcef, true, defaultSuffix);
|
14652 |
-
case _listStyle.LIST_STYLE_TYPE.KATAKANA:
|
14653 |
-
return createCounterStyleFromSymbols(value, 'アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン', cjkSuffix);
|
14654 |
-
case _listStyle.LIST_STYLE_TYPE.KATAKANA_IROHA:
|
14655 |
-
return createCounterStyleFromSymbols(value, 'イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス', cjkSuffix);
|
14656 |
-
case _listStyle.LIST_STYLE_TYPE.LAO:
|
14657 |
-
return createCounterStyleFromRange(value, 0xed0, 0xed9, true, defaultSuffix);
|
14658 |
-
case _listStyle.LIST_STYLE_TYPE.MONGOLIAN:
|
14659 |
-
return createCounterStyleFromRange(value, 0x1810, 0x1819, true, defaultSuffix);
|
14660 |
-
case _listStyle.LIST_STYLE_TYPE.MYANMAR:
|
14661 |
-
return createCounterStyleFromRange(value, 0x1040, 0x1049, true, defaultSuffix);
|
14662 |
-
case _listStyle.LIST_STYLE_TYPE.ORIYA:
|
14663 |
-
return createCounterStyleFromRange(value, 0xb66, 0xb6f, true, defaultSuffix);
|
14664 |
-
case _listStyle.LIST_STYLE_TYPE.PERSIAN:
|
14665 |
-
return createCounterStyleFromRange(value, 0x6f0, 0x6f9, true, defaultSuffix);
|
14666 |
-
case _listStyle.LIST_STYLE_TYPE.TAMIL:
|
14667 |
-
return createCounterStyleFromRange(value, 0xbe6, 0xbef, true, defaultSuffix);
|
14668 |
-
case _listStyle.LIST_STYLE_TYPE.TELUGU:
|
14669 |
-
return createCounterStyleFromRange(value, 0xc66, 0xc6f, true, defaultSuffix);
|
14670 |
-
case _listStyle.LIST_STYLE_TYPE.THAI:
|
14671 |
-
return createCounterStyleFromRange(value, 0xe50, 0xe59, true, defaultSuffix);
|
14672 |
-
case _listStyle.LIST_STYLE_TYPE.TIBETAN:
|
14673 |
-
return createCounterStyleFromRange(value, 0xf20, 0xf29, true, defaultSuffix);
|
14674 |
-
case _listStyle.LIST_STYLE_TYPE.DECIMAL:
|
14675 |
-
default:
|
14676 |
-
return createCounterStyleFromRange(value, 48, 57, true, defaultSuffix);
|
14677 |
-
}
|
14678 |
-
};
|
14679 |
-
|
14680 |
-
/***/ }),
|
14681 |
-
/* 15 */
|
14682 |
-
/***/ (function(module, exports, __webpack_require__) {
|
14683 |
-
|
14684 |
-
"use strict";
|
14685 |
-
|
14686 |
-
|
14687 |
-
Object.defineProperty(exports, "__esModule", {
|
14688 |
-
value: true
|
14689 |
-
});
|
14690 |
-
|
14691 |
-
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
14692 |
-
|
14693 |
-
var _Path = __webpack_require__(6);
|
14694 |
-
|
14695 |
-
var _textDecoration = __webpack_require__(11);
|
14696 |
-
|
14697 |
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
14698 |
-
|
14699 |
-
var addColorStops = function addColorStops(gradient, canvasGradient) {
|
14700 |
-
var maxStop = Math.max.apply(null, gradient.colorStops.map(function (colorStop) {
|
14701 |
-
return colorStop.stop;
|
14702 |
-
}));
|
14703 |
-
var f = 1 / Math.max(1, maxStop);
|
14704 |
-
gradient.colorStops.forEach(function (colorStop) {
|
14705 |
-
canvasGradient.addColorStop(f * colorStop.stop, colorStop.color.toString());
|
14706 |
-
});
|
14707 |
-
};
|
14708 |
-
|
14709 |
-
var CanvasRenderer = function () {
|
14710 |
-
function CanvasRenderer(canvas) {
|
14711 |
-
_classCallCheck(this, CanvasRenderer);
|
14712 |
-
|
14713 |
-
this.canvas = canvas ? canvas : document.createElement('canvas');
|
14714 |
-
}
|
14715 |
-
|
14716 |
-
_createClass(CanvasRenderer, [{
|
14717 |
-
key: 'render',
|
14718 |
-
value: function render(options) {
|
14719 |
-
this.ctx = this.canvas.getContext('2d');
|
14720 |
-
this.options = options;
|
14721 |
-
this.canvas.width = Math.floor(options.width * options.scale);
|
14722 |
-
this.canvas.height = Math.floor(options.height * options.scale);
|
14723 |
-
this.canvas.style.width = options.width + 'px';
|
14724 |
-
this.canvas.style.height = options.height + 'px';
|
14725 |
-
|
14726 |
-
this.ctx.scale(this.options.scale, this.options.scale);
|
14727 |
-
this.ctx.translate(-options.x, -options.y);
|
14728 |
-
this.ctx.textBaseline = 'bottom';
|
14729 |
-
options.logger.log('Canvas renderer initialized (' + options.width + 'x' + options.height + ' at ' + options.x + ',' + options.y + ') with scale ' + this.options.scale);
|
14730 |
-
}
|
14731 |
-
}, {
|
14732 |
-
key: 'clip',
|
14733 |
-
value: function clip(clipPaths, callback) {
|
14734 |
-
var _this = this;
|
14735 |
-
|
14736 |
-
if (clipPaths.length) {
|
14737 |
-
this.ctx.save();
|
14738 |
-
clipPaths.forEach(function (path) {
|
14739 |
-
_this.path(path);
|
14740 |
-
_this.ctx.clip();
|
14741 |
-
});
|
14742 |
-
}
|
14743 |
-
|
14744 |
-
callback();
|
14745 |
-
|
14746 |
-
if (clipPaths.length) {
|
14747 |
-
this.ctx.restore();
|
14748 |
-
}
|
14749 |
-
}
|
14750 |
-
}, {
|
14751 |
-
key: 'drawImage',
|
14752 |
-
value: function drawImage(image, source, destination) {
|
14753 |
-
this.ctx.drawImage(image, source.left, source.top, source.width, source.height, destination.left, destination.top, destination.width, destination.height);
|
14754 |
-
}
|
14755 |
-
}, {
|
14756 |
-
key: 'drawShape',
|
14757 |
-
value: function drawShape(path, color) {
|
14758 |
-
this.path(path);
|
14759 |
-
this.ctx.fillStyle = color.toString();
|
14760 |
-
this.ctx.fill();
|
14761 |
-
}
|
14762 |
-
}, {
|
14763 |
-
key: 'fill',
|
14764 |
-
value: function fill(color) {
|
14765 |
-
this.ctx.fillStyle = color.toString();
|
14766 |
-
this.ctx.fill();
|
14767 |
-
}
|
14768 |
-
}, {
|
14769 |
-
key: 'getTarget',
|
14770 |
-
value: function getTarget() {
|
14771 |
-
this.canvas.getContext('2d').setTransform(1, 0, 0, 1, 0, 0);
|
14772 |
-
return Promise.resolve(this.canvas);
|
14773 |
-
}
|
14774 |
-
}, {
|
14775 |
-
key: 'path',
|
14776 |
-
value: function path(_path) {
|
14777 |
-
var _this2 = this;
|
14778 |
-
|
14779 |
-
this.ctx.beginPath();
|
14780 |
-
if (Array.isArray(_path)) {
|
14781 |
-
_path.forEach(function (point, index) {
|
14782 |
-
var start = point.type === _Path.PATH.VECTOR ? point : point.start;
|
14783 |
-
if (index === 0) {
|
14784 |
-
_this2.ctx.moveTo(start.x, start.y);
|
14785 |
-
} else {
|
14786 |
-
_this2.ctx.lineTo(start.x, start.y);
|
14787 |
-
}
|
14788 |
-
|
14789 |
-
if (point.type === _Path.PATH.BEZIER_CURVE) {
|
14790 |
-
_this2.ctx.bezierCurveTo(point.startControl.x, point.startControl.y, point.endControl.x, point.endControl.y, point.end.x, point.end.y);
|
14791 |
-
}
|
14792 |
-
});
|
14793 |
-
} else {
|
14794 |
-
this.ctx.arc(_path.x + _path.radius, _path.y + _path.radius, _path.radius, 0, Math.PI * 2, true);
|
14795 |
-
}
|
14796 |
-
|
14797 |
-
this.ctx.closePath();
|
14798 |
-
}
|
14799 |
-
}, {
|
14800 |
-
key: 'rectangle',
|
14801 |
-
value: function rectangle(x, y, width, height, color) {
|
14802 |
-
this.ctx.fillStyle = color.toString();
|
14803 |
-
this.ctx.fillRect(x, y, width, height);
|
14804 |
-
}
|
14805 |
-
}, {
|
14806 |
-
key: 'renderLinearGradient',
|
14807 |
-
value: function renderLinearGradient(bounds, gradient) {
|
14808 |
-
var linearGradient = this.ctx.createLinearGradient(bounds.left + gradient.direction.x1, bounds.top + gradient.direction.y1, bounds.left + gradient.direction.x0, bounds.top + gradient.direction.y0);
|
14809 |
-
|
14810 |
-
addColorStops(gradient, linearGradient);
|
14811 |
-
this.ctx.fillStyle = linearGradient;
|
14812 |
-
this.ctx.fillRect(bounds.left, bounds.top, bounds.width, bounds.height);
|
14813 |
-
}
|
14814 |
-
}, {
|
14815 |
-
key: 'renderRadialGradient',
|
14816 |
-
value: function renderRadialGradient(bounds, gradient) {
|
14817 |
-
var _this3 = this;
|
14818 |
-
|
14819 |
-
var x = bounds.left + gradient.center.x;
|
14820 |
-
var y = bounds.top + gradient.center.y;
|
14821 |
-
|
14822 |
-
var radialGradient = this.ctx.createRadialGradient(x, y, 0, x, y, gradient.radius.x);
|
14823 |
-
if (!radialGradient) {
|
14824 |
-
return;
|
14825 |
-
}
|
14826 |
-
|
14827 |
-
addColorStops(gradient, radialGradient);
|
14828 |
-
this.ctx.fillStyle = radialGradient;
|
14829 |
-
|
14830 |
-
if (gradient.radius.x !== gradient.radius.y) {
|
14831 |
-
// transforms for elliptical radial gradient
|
14832 |
-
var midX = bounds.left + 0.5 * bounds.width;
|
14833 |
-
var midY = bounds.top + 0.5 * bounds.height;
|
14834 |
-
var f = gradient.radius.y / gradient.radius.x;
|
14835 |
-
var invF = 1 / f;
|
14836 |
-
|
14837 |
-
this.transform(midX, midY, [1, 0, 0, f, 0, 0], function () {
|
14838 |
-
return _this3.ctx.fillRect(bounds.left, invF * (bounds.top - midY) + midY, bounds.width, bounds.height * invF);
|
14839 |
-
});
|
14840 |
-
} else {
|
14841 |
-
this.ctx.fillRect(bounds.left, bounds.top, bounds.width, bounds.height);
|
14842 |
-
}
|
14843 |
-
}
|
14844 |
-
}, {
|
14845 |
-
key: 'renderRepeat',
|
14846 |
-
value: function renderRepeat(path, image, imageSize, offsetX, offsetY) {
|
14847 |
-
this.path(path);
|
14848 |
-
this.ctx.fillStyle = this.ctx.createPattern(this.resizeImage(image, imageSize), 'repeat');
|
14849 |
-
this.ctx.translate(offsetX, offsetY);
|
14850 |
-
this.ctx.fill();
|
14851 |
-
this.ctx.translate(-offsetX, -offsetY);
|
14852 |
-
}
|
14853 |
-
}, {
|
14854 |
-
key: 'renderTextNode',
|
14855 |
-
value: function renderTextNode(textBounds, color, font, textDecoration, textShadows) {
|
14856 |
-
var _this4 = this;
|
14857 |
-
|
14858 |
-
this.ctx.font = [font.fontStyle, font.fontVariant, font.fontWeight, font.fontSize, font.fontFamily].join(' ');
|
14859 |
-
|
14860 |
-
textBounds.forEach(function (text) {
|
14861 |
-
_this4.ctx.fillStyle = color.toString();
|
14862 |
-
if (textShadows && text.text.trim().length) {
|
14863 |
-
textShadows.slice(0).reverse().forEach(function (textShadow) {
|
14864 |
-
_this4.ctx.shadowColor = textShadow.color.toString();
|
14865 |
-
_this4.ctx.shadowOffsetX = textShadow.offsetX * _this4.options.scale;
|
14866 |
-
_this4.ctx.shadowOffsetY = textShadow.offsetY * _this4.options.scale;
|
14867 |
-
_this4.ctx.shadowBlur = textShadow.blur;
|
14868 |
-
|
14869 |
-
_this4.ctx.fillText(text.text, text.bounds.left, text.bounds.top + text.bounds.height);
|
14870 |
-
});
|
14871 |
-
} else {
|
14872 |
-
_this4.ctx.fillText(text.text, text.bounds.left, text.bounds.top + text.bounds.height);
|
14873 |
-
}
|
14874 |
-
|
14875 |
-
if (textDecoration !== null) {
|
14876 |
-
var textDecorationColor = textDecoration.textDecorationColor || color;
|
14877 |
-
textDecoration.textDecorationLine.forEach(function (textDecorationLine) {
|
14878 |
-
switch (textDecorationLine) {
|
14879 |
-
case _textDecoration.TEXT_DECORATION_LINE.UNDERLINE:
|
14880 |
-
// Draws a line at the baseline of the font
|
14881 |
-
// TODO As some browsers display the line as more than 1px if the font-size is big,
|
14882 |
-
// need to take that into account both in position and size
|
14883 |
-
var _options$fontMetrics$ = _this4.options.fontMetrics.getMetrics(font),
|
14884 |
-
baseline = _options$fontMetrics$.baseline;
|
14885 |
-
|
14886 |
-
_this4.rectangle(text.bounds.left, Math.round(text.bounds.top + baseline), text.bounds.width, 1, textDecorationColor);
|
14887 |
-
break;
|
14888 |
-
case _textDecoration.TEXT_DECORATION_LINE.OVERLINE:
|
14889 |
-
_this4.rectangle(text.bounds.left, Math.round(text.bounds.top), text.bounds.width, 1, textDecorationColor);
|
14890 |
-
break;
|
14891 |
-
case _textDecoration.TEXT_DECORATION_LINE.LINE_THROUGH:
|
14892 |
-
// TODO try and find exact position for line-through
|
14893 |
-
var _options$fontMetrics$2 = _this4.options.fontMetrics.getMetrics(font),
|
14894 |
-
middle = _options$fontMetrics$2.middle;
|
14895 |
-
|
14896 |
-
_this4.rectangle(text.bounds.left, Math.ceil(text.bounds.top + middle), text.bounds.width, 1, textDecorationColor);
|
14897 |
-
break;
|
14898 |
-
}
|
14899 |
-
});
|
14900 |
-
}
|
14901 |
-
});
|
14902 |
-
}
|
14903 |
-
}, {
|
14904 |
-
key: 'resizeImage',
|
14905 |
-
value: function resizeImage(image, size) {
|
14906 |
-
if (image.width === size.width && image.height === size.height) {
|
14907 |
-
return image;
|
14908 |
-
}
|
14909 |
-
|
14910 |
-
var canvas = this.canvas.ownerDocument.createElement('canvas');
|
14911 |
-
canvas.width = size.width;
|
14912 |
-
canvas.height = size.height;
|
14913 |
-
var ctx = canvas.getContext('2d');
|
14914 |
-
ctx.drawImage(image, 0, 0, image.width, image.height, 0, 0, size.width, size.height);
|
14915 |
-
return canvas;
|
14916 |
-
}
|
14917 |
-
}, {
|
14918 |
-
key: 'setOpacity',
|
14919 |
-
value: function setOpacity(opacity) {
|
14920 |
-
this.ctx.globalAlpha = opacity;
|
14921 |
-
}
|
14922 |
-
}, {
|
14923 |
-
key: 'transform',
|
14924 |
-
value: function transform(offsetX, offsetY, matrix, callback) {
|
14925 |
-
this.ctx.save();
|
14926 |
-
this.ctx.translate(offsetX, offsetY);
|
14927 |
-
this.ctx.transform(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]);
|
14928 |
-
this.ctx.translate(-offsetX, -offsetY);
|
14929 |
-
|
14930 |
-
callback();
|
14931 |
-
|
14932 |
-
this.ctx.restore();
|
14933 |
-
}
|
14934 |
-
}]);
|
14935 |
-
|
14936 |
-
return CanvasRenderer;
|
14937 |
-
}();
|
14938 |
-
|
14939 |
-
exports.default = CanvasRenderer;
|
14940 |
-
|
14941 |
-
/***/ }),
|
14942 |
-
/* 16 */
|
14943 |
-
/***/ (function(module, exports, __webpack_require__) {
|
14944 |
-
|
14945 |
-
"use strict";
|
14946 |
-
|
14947 |
-
|
14948 |
-
Object.defineProperty(exports, "__esModule", {
|
14949 |
-
value: true
|
14950 |
-
});
|
14951 |
-
|
14952 |
-
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
14953 |
-
|
14954 |
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
14955 |
-
|
14956 |
-
var Logger = function () {
|
14957 |
-
function Logger(enabled, id, start) {
|
14958 |
-
_classCallCheck(this, Logger);
|
14959 |
-
|
14960 |
-
this.enabled = typeof window !== 'undefined' && enabled;
|
14961 |
-
this.start = start ? start : Date.now();
|
14962 |
-
this.id = id;
|
14963 |
-
}
|
14964 |
-
|
14965 |
-
_createClass(Logger, [{
|
14966 |
-
key: 'child',
|
14967 |
-
value: function child(id) {
|
14968 |
-
return new Logger(this.enabled, id, this.start);
|
14969 |
-
}
|
14970 |
-
|
14971 |
-
// eslint-disable-next-line flowtype/no-weak-types
|
14972 |
-
|
14973 |
-
}, {
|
14974 |
-
key: 'log',
|
14975 |
-
value: function log() {
|
14976 |
-
if (this.enabled && window.console && window.console.log) {
|
14977 |
-
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
14978 |
-
args[_key] = arguments[_key];
|
14979 |
-
}
|
14980 |
-
|
14981 |
-
Function.prototype.bind.call(window.console.log, window.console).apply(window.console, [Date.now() - this.start + 'ms', this.id ? 'html2canvas (' + this.id + '):' : 'html2canvas:'].concat([].slice.call(args, 0)));
|
14982 |
-
}
|
14983 |
-
}
|
14984 |
-
|
14985 |
-
// eslint-disable-next-line flowtype/no-weak-types
|
14986 |
-
|
14987 |
-
}, {
|
14988 |
-
key: 'error',
|
14989 |
-
value: function error() {
|
14990 |
-
if (this.enabled && window.console && window.console.error) {
|
14991 |
-
for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
14992 |
-
args[_key2] = arguments[_key2];
|
14993 |
-
}
|
14994 |
-
|
14995 |
-
Function.prototype.bind.call(window.console.error, window.console).apply(window.console, [Date.now() - this.start + 'ms', this.id ? 'html2canvas (' + this.id + '):' : 'html2canvas:'].concat([].slice.call(args, 0)));
|
14996 |
-
}
|
14997 |
-
}
|
14998 |
-
}]);
|
14999 |
-
|
15000 |
-
return Logger;
|
15001 |
-
}();
|
15002 |
-
|
15003 |
-
exports.default = Logger;
|
15004 |
-
|
15005 |
-
/***/ }),
|
15006 |
-
/* 17 */
|
15007 |
-
/***/ (function(module, exports, __webpack_require__) {
|
15008 |
-
|
15009 |
-
"use strict";
|
15010 |
-
|
15011 |
-
|
15012 |
-
Object.defineProperty(exports, "__esModule", {
|
15013 |
-
value: true
|
15014 |
-
});
|
15015 |
-
exports.parsePadding = exports.PADDING_SIDES = undefined;
|
15016 |
-
|
15017 |
-
var _Length = __webpack_require__(1);
|
15018 |
-
|
15019 |
-
var _Length2 = _interopRequireDefault(_Length);
|
15020 |
-
|
15021 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
15022 |
-
|
15023 |
-
var PADDING_SIDES = exports.PADDING_SIDES = {
|
15024 |
-
TOP: 0,
|
15025 |
-
RIGHT: 1,
|
15026 |
-
BOTTOM: 2,
|
15027 |
-
LEFT: 3
|
15028 |
-
};
|
15029 |
-
|
15030 |
-
var SIDES = ['top', 'right', 'bottom', 'left'];
|
15031 |
-
|
15032 |
-
var parsePadding = exports.parsePadding = function parsePadding(style) {
|
15033 |
-
return SIDES.map(function (side) {
|
15034 |
-
return new _Length2.default(style.getPropertyValue('padding-' + side));
|
15035 |
-
});
|
15036 |
-
};
|
15037 |
-
|
15038 |
-
/***/ }),
|
15039 |
-
/* 18 */
|
15040 |
-
/***/ (function(module, exports, __webpack_require__) {
|
15041 |
-
|
15042 |
-
"use strict";
|
15043 |
-
|
15044 |
-
|
15045 |
-
Object.defineProperty(exports, "__esModule", {
|
15046 |
-
value: true
|
15047 |
-
});
|
15048 |
-
var OVERFLOW_WRAP = exports.OVERFLOW_WRAP = {
|
15049 |
-
NORMAL: 0,
|
15050 |
-
BREAK_WORD: 1
|
15051 |
-
};
|
15052 |
-
|
15053 |
-
var parseOverflowWrap = exports.parseOverflowWrap = function parseOverflowWrap(overflow) {
|
15054 |
-
switch (overflow) {
|
15055 |
-
case 'break-word':
|
15056 |
-
return OVERFLOW_WRAP.BREAK_WORD;
|
15057 |
-
case 'normal':
|
15058 |
-
default:
|
15059 |
-
return OVERFLOW_WRAP.NORMAL;
|
15060 |
-
}
|
15061 |
-
};
|
15062 |
-
|
15063 |
-
/***/ }),
|
15064 |
-
/* 19 */
|
15065 |
-
/***/ (function(module, exports, __webpack_require__) {
|
15066 |
-
|
15067 |
-
"use strict";
|
15068 |
-
|
15069 |
-
|
15070 |
-
Object.defineProperty(exports, "__esModule", {
|
15071 |
-
value: true
|
15072 |
-
});
|
15073 |
-
var POSITION = exports.POSITION = {
|
15074 |
-
STATIC: 0,
|
15075 |
-
RELATIVE: 1,
|
15076 |
-
ABSOLUTE: 2,
|
15077 |
-
FIXED: 3,
|
15078 |
-
STICKY: 4
|
15079 |
-
};
|
15080 |
-
|
15081 |
-
var parsePosition = exports.parsePosition = function parsePosition(position) {
|
15082 |
-
switch (position) {
|
15083 |
-
case 'relative':
|
15084 |
-
return POSITION.RELATIVE;
|
15085 |
-
case 'absolute':
|
15086 |
-
return POSITION.ABSOLUTE;
|
15087 |
-
case 'fixed':
|
15088 |
-
return POSITION.FIXED;
|
15089 |
-
case 'sticky':
|
15090 |
-
return POSITION.STICKY;
|
15091 |
-
}
|
15092 |
-
|
15093 |
-
return POSITION.STATIC;
|
15094 |
-
};
|
15095 |
-
|
15096 |
-
/***/ }),
|
15097 |
-
/* 20 */
|
15098 |
-
/***/ (function(module, exports, __webpack_require__) {
|
15099 |
-
|
15100 |
-
"use strict";
|
15101 |
-
|
15102 |
-
|
15103 |
-
Object.defineProperty(exports, "__esModule", {
|
15104 |
-
value: true
|
15105 |
-
});
|
15106 |
-
var TEXT_TRANSFORM = exports.TEXT_TRANSFORM = {
|
15107 |
-
NONE: 0,
|
15108 |
-
LOWERCASE: 1,
|
15109 |
-
UPPERCASE: 2,
|
15110 |
-
CAPITALIZE: 3
|
15111 |
-
};
|
15112 |
-
|
15113 |
-
var parseTextTransform = exports.parseTextTransform = function parseTextTransform(textTransform) {
|
15114 |
-
switch (textTransform) {
|
15115 |
-
case 'uppercase':
|
15116 |
-
return TEXT_TRANSFORM.UPPERCASE;
|
15117 |
-
case 'lowercase':
|
15118 |
-
return TEXT_TRANSFORM.LOWERCASE;
|
15119 |
-
case 'capitalize':
|
15120 |
-
return TEXT_TRANSFORM.CAPITALIZE;
|
15121 |
-
}
|
15122 |
-
|
15123 |
-
return TEXT_TRANSFORM.NONE;
|
15124 |
-
};
|
15125 |
-
|
15126 |
-
/***/ }),
|
15127 |
-
/* 21 */
|
15128 |
-
/***/ (function(module, exports, __webpack_require__) {
|
15129 |
-
|
15130 |
-
"use strict";
|
15131 |
-
|
15132 |
-
|
15133 |
-
Object.defineProperty(exports, "__esModule", {
|
15134 |
-
value: true
|
15135 |
-
});
|
15136 |
-
exports.reformatInputBounds = exports.inlineSelectElement = exports.inlineTextAreaElement = exports.inlineInputElement = exports.getInputBorderRadius = exports.INPUT_BACKGROUND = exports.INPUT_BORDERS = exports.INPUT_COLOR = undefined;
|
15137 |
-
|
15138 |
-
var _TextContainer = __webpack_require__(9);
|
15139 |
-
|
15140 |
-
var _TextContainer2 = _interopRequireDefault(_TextContainer);
|
15141 |
-
|
15142 |
-
var _background = __webpack_require__(5);
|
15143 |
-
|
15144 |
-
var _border = __webpack_require__(12);
|
15145 |
-
|
15146 |
-
var _Circle = __webpack_require__(50);
|
15147 |
-
|
15148 |
-
var _Circle2 = _interopRequireDefault(_Circle);
|
15149 |
-
|
15150 |
-
var _Vector = __webpack_require__(7);
|
15151 |
-
|
15152 |
-
var _Vector2 = _interopRequireDefault(_Vector);
|
15153 |
-
|
15154 |
-
var _Color = __webpack_require__(0);
|
15155 |
-
|
15156 |
-
var _Color2 = _interopRequireDefault(_Color);
|
15157 |
-
|
15158 |
-
var _Length = __webpack_require__(1);
|
15159 |
-
|
15160 |
-
var _Length2 = _interopRequireDefault(_Length);
|
15161 |
-
|
15162 |
-
var _Bounds = __webpack_require__(2);
|
15163 |
-
|
15164 |
-
var _TextBounds = __webpack_require__(22);
|
15165 |
-
|
15166 |
-
var _Util = __webpack_require__(4);
|
15167 |
-
|
15168 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
15169 |
-
|
15170 |
-
var INPUT_COLOR = exports.INPUT_COLOR = new _Color2.default([42, 42, 42]);
|
15171 |
-
var INPUT_BORDER_COLOR = new _Color2.default([165, 165, 165]);
|
15172 |
-
var INPUT_BACKGROUND_COLOR = new _Color2.default([222, 222, 222]);
|
15173 |
-
var INPUT_BORDER = {
|
15174 |
-
borderWidth: 1,
|
15175 |
-
borderColor: INPUT_BORDER_COLOR,
|
15176 |
-
borderStyle: _border.BORDER_STYLE.SOLID
|
15177 |
-
};
|
15178 |
-
var INPUT_BORDERS = exports.INPUT_BORDERS = [INPUT_BORDER, INPUT_BORDER, INPUT_BORDER, INPUT_BORDER];
|
15179 |
-
var INPUT_BACKGROUND = exports.INPUT_BACKGROUND = {
|
15180 |
-
backgroundColor: INPUT_BACKGROUND_COLOR,
|
15181 |
-
backgroundImage: [],
|
15182 |
-
backgroundClip: _background.BACKGROUND_CLIP.PADDING_BOX,
|
15183 |
-
backgroundOrigin: _background.BACKGROUND_ORIGIN.PADDING_BOX
|
15184 |
-
};
|
15185 |
-
|
15186 |
-
var RADIO_BORDER_RADIUS = new _Length2.default('50%');
|
15187 |
-
var RADIO_BORDER_RADIUS_TUPLE = [RADIO_BORDER_RADIUS, RADIO_BORDER_RADIUS];
|
15188 |
-
var INPUT_RADIO_BORDER_RADIUS = [RADIO_BORDER_RADIUS_TUPLE, RADIO_BORDER_RADIUS_TUPLE, RADIO_BORDER_RADIUS_TUPLE, RADIO_BORDER_RADIUS_TUPLE];
|
15189 |
-
|
15190 |
-
var CHECKBOX_BORDER_RADIUS = new _Length2.default('3px');
|
15191 |
-
var CHECKBOX_BORDER_RADIUS_TUPLE = [CHECKBOX_BORDER_RADIUS, CHECKBOX_BORDER_RADIUS];
|
15192 |
-
var INPUT_CHECKBOX_BORDER_RADIUS = [CHECKBOX_BORDER_RADIUS_TUPLE, CHECKBOX_BORDER_RADIUS_TUPLE, CHECKBOX_BORDER_RADIUS_TUPLE, CHECKBOX_BORDER_RADIUS_TUPLE];
|
15193 |
-
|
15194 |
-
var getInputBorderRadius = exports.getInputBorderRadius = function getInputBorderRadius(node) {
|
15195 |
-
return node.type === 'radio' ? INPUT_RADIO_BORDER_RADIUS : INPUT_CHECKBOX_BORDER_RADIUS;
|
15196 |
-
};
|
15197 |
-
|
15198 |
-
var inlineInputElement = exports.inlineInputElement = function inlineInputElement(node, container) {
|
15199 |
-
if (node.type === 'radio' || node.type === 'checkbox') {
|
15200 |
-
if (node.checked) {
|
15201 |
-
var size = Math.min(container.bounds.width, container.bounds.height);
|
15202 |
-
container.childNodes.push(node.type === 'checkbox' ? [new _Vector2.default(container.bounds.left + size * 0.39363, container.bounds.top + size * 0.79), new _Vector2.default(container.bounds.left + size * 0.16, container.bounds.top + size * 0.5549), new _Vector2.default(container.bounds.left + size * 0.27347, container.bounds.top + size * 0.44071), new _Vector2.default(container.bounds.left + size * 0.39694, container.bounds.top + size * 0.5649), new _Vector2.default(container.bounds.left + size * 0.72983, container.bounds.top + size * 0.23), new _Vector2.default(container.bounds.left + size * 0.84, container.bounds.top + size * 0.34085), new _Vector2.default(container.bounds.left + size * 0.39363, container.bounds.top + size * 0.79)] : new _Circle2.default(container.bounds.left + size / 4, container.bounds.top + size / 4, size / 4));
|
15203 |
-
}
|
15204 |
-
} else {
|
15205 |
-
inlineFormElement(getInputValue(node), node, container, false);
|
15206 |
-
}
|
15207 |
-
};
|
15208 |
-
|
15209 |
-
var inlineTextAreaElement = exports.inlineTextAreaElement = function inlineTextAreaElement(node, container) {
|
15210 |
-
inlineFormElement(node.value, node, container, true);
|
15211 |
-
};
|
15212 |
-
|
15213 |
-
var inlineSelectElement = exports.inlineSelectElement = function inlineSelectElement(node, container) {
|
15214 |
-
var option = node.options[node.selectedIndex || 0];
|
15215 |
-
inlineFormElement(option ? option.text || '' : '', node, container, false);
|
15216 |
-
};
|
15217 |
-
|
15218 |
-
var reformatInputBounds = exports.reformatInputBounds = function reformatInputBounds(bounds) {
|
15219 |
-
if (bounds.width > bounds.height) {
|
15220 |
-
bounds.left += (bounds.width - bounds.height) / 2;
|
15221 |
-
bounds.width = bounds.height;
|
15222 |
-
} else if (bounds.width < bounds.height) {
|
15223 |
-
bounds.top += (bounds.height - bounds.width) / 2;
|
15224 |
-
bounds.height = bounds.width;
|
15225 |
-
}
|
15226 |
-
return bounds;
|
15227 |
-
};
|
15228 |
-
|
15229 |
-
var inlineFormElement = function inlineFormElement(value, node, container, allowLinebreak) {
|
15230 |
-
var body = node.ownerDocument.body;
|
15231 |
-
if (value.length > 0 && body) {
|
15232 |
-
var wrapper = node.ownerDocument.createElement('html2canvaswrapper');
|
15233 |
-
(0, _Util.copyCSSStyles)(node.ownerDocument.defaultView.getComputedStyle(node, null), wrapper);
|
15234 |
-
wrapper.style.position = 'absolute';
|
15235 |
-
wrapper.style.left = container.bounds.left + 'px';
|
15236 |
-
wrapper.style.top = container.bounds.top + 'px';
|
15237 |
-
if (!allowLinebreak) {
|
15238 |
-
wrapper.style.whiteSpace = 'nowrap';
|
15239 |
-
}
|
15240 |
-
var text = node.ownerDocument.createTextNode(value);
|
15241 |
-
wrapper.appendChild(text);
|
15242 |
-
body.appendChild(wrapper);
|
15243 |
-
container.childNodes.push(_TextContainer2.default.fromTextNode(text, container));
|
15244 |
-
body.removeChild(wrapper);
|
15245 |
-
}
|
15246 |
-
};
|
15247 |
-
|
15248 |
-
var getInputValue = function getInputValue(node) {
|
15249 |
-
var value = node.type === 'password' ? new Array(node.value.length + 1).join('\u2022') : node.value;
|
15250 |
-
|
15251 |
-
return value.length === 0 ? node.placeholder || '' : value;
|
15252 |
-
};
|
15253 |
-
|
15254 |
-
/***/ }),
|
15255 |
-
/* 22 */
|
15256 |
-
/***/ (function(module, exports, __webpack_require__) {
|
15257 |
-
|
15258 |
-
"use strict";
|
15259 |
-
|
15260 |
-
|
15261 |
-
Object.defineProperty(exports, "__esModule", {
|
15262 |
-
value: true
|
15263 |
-
});
|
15264 |
-
exports.parseTextBounds = exports.TextBounds = undefined;
|
15265 |
-
|
15266 |
-
var _Bounds = __webpack_require__(2);
|
15267 |
-
|
15268 |
-
var _textDecoration = __webpack_require__(11);
|
15269 |
-
|
15270 |
-
var _Feature = __webpack_require__(10);
|
15271 |
-
|
15272 |
-
var _Feature2 = _interopRequireDefault(_Feature);
|
15273 |
-
|
15274 |
-
var _Unicode = __webpack_require__(24);
|
15275 |
-
|
15276 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
15277 |
-
|
15278 |
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
15279 |
-
|
15280 |
-
var TextBounds = exports.TextBounds = function TextBounds(text, bounds) {
|
15281 |
-
_classCallCheck(this, TextBounds);
|
15282 |
-
|
15283 |
-
this.text = text;
|
15284 |
-
this.bounds = bounds;
|
15285 |
-
};
|
15286 |
-
|
15287 |
-
var parseTextBounds = exports.parseTextBounds = function parseTextBounds(value, parent, node) {
|
15288 |
-
var letterRendering = parent.style.letterSpacing !== 0;
|
15289 |
-
var textList = letterRendering ? (0, _Unicode.toCodePoints)(value).map(function (i) {
|
15290 |
-
return (0, _Unicode.fromCodePoint)(i);
|
15291 |
-
}) : (0, _Unicode.breakWords)(value, parent);
|
15292 |
-
var length = textList.length;
|
15293 |
-
var defaultView = node.parentNode ? node.parentNode.ownerDocument.defaultView : null;
|
15294 |
-
var scrollX = defaultView ? defaultView.pageXOffset : 0;
|
15295 |
-
var scrollY = defaultView ? defaultView.pageYOffset : 0;
|
15296 |
-
var textBounds = [];
|
15297 |
-
var offset = 0;
|
15298 |
-
for (var i = 0; i < length; i++) {
|
15299 |
-
var text = textList[i];
|
15300 |
-
if (parent.style.textDecoration !== _textDecoration.TEXT_DECORATION.NONE || text.trim().length > 0) {
|
15301 |
-
if (_Feature2.default.SUPPORT_RANGE_BOUNDS) {
|
15302 |
-
textBounds.push(new TextBounds(text, getRangeBounds(node, offset, text.length, scrollX, scrollY)));
|
15303 |
-
} else {
|
15304 |
-
var replacementNode = node.splitText(text.length);
|
15305 |
-
textBounds.push(new TextBounds(text, getWrapperBounds(node, scrollX, scrollY)));
|
15306 |
-
node = replacementNode;
|
15307 |
-
}
|
15308 |
-
} else if (!_Feature2.default.SUPPORT_RANGE_BOUNDS) {
|
15309 |
-
node = node.splitText(text.length);
|
15310 |
-
}
|
15311 |
-
offset += text.length;
|
15312 |
-
}
|
15313 |
-
return textBounds;
|
15314 |
-
};
|
15315 |
-
|
15316 |
-
var getWrapperBounds = function getWrapperBounds(node, scrollX, scrollY) {
|
15317 |
-
var wrapper = node.ownerDocument.createElement('html2canvaswrapper');
|
15318 |
-
wrapper.appendChild(node.cloneNode(true));
|
15319 |
-
var parentNode = node.parentNode;
|
15320 |
-
if (parentNode) {
|
15321 |
-
parentNode.replaceChild(wrapper, node);
|
15322 |
-
var bounds = (0, _Bounds.parseBounds)(wrapper, scrollX, scrollY);
|
15323 |
-
if (wrapper.firstChild) {
|
15324 |
-
parentNode.replaceChild(wrapper.firstChild, wrapper);
|
15325 |
-
}
|
15326 |
-
return bounds;
|
15327 |
-
}
|
15328 |
-
return new _Bounds.Bounds(0, 0, 0, 0);
|
15329 |
-
};
|
15330 |
-
|
15331 |
-
var getRangeBounds = function getRangeBounds(node, offset, length, scrollX, scrollY) {
|
15332 |
-
var range = node.ownerDocument.createRange();
|
15333 |
-
range.setStart(node, offset);
|
15334 |
-
range.setEnd(node, offset + length);
|
15335 |
-
return _Bounds.Bounds.fromClientRect(range.getBoundingClientRect(), scrollX, scrollY);
|
15336 |
-
};
|
15337 |
-
|
15338 |
-
/***/ }),
|
15339 |
-
/* 23 */
|
15340 |
-
/***/ (function(module, exports, __webpack_require__) {
|
15341 |
-
|
15342 |
-
"use strict";
|
15343 |
-
|
15344 |
-
|
15345 |
-
Object.defineProperty(exports, "__esModule", {
|
15346 |
-
value: true
|
15347 |
-
});
|
15348 |
-
|
15349 |
-
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
15350 |
-
|
15351 |
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
15352 |
-
|
15353 |
-
var ForeignObjectRenderer = function () {
|
15354 |
-
function ForeignObjectRenderer(element) {
|
15355 |
-
_classCallCheck(this, ForeignObjectRenderer);
|
15356 |
-
|
15357 |
-
this.element = element;
|
15358 |
-
}
|
15359 |
-
|
15360 |
-
_createClass(ForeignObjectRenderer, [{
|
15361 |
-
key: 'render',
|
15362 |
-
value: function render(options) {
|
15363 |
-
var _this = this;
|
15364 |
-
|
15365 |
-
this.options = options;
|
15366 |
-
this.canvas = document.createElement('canvas');
|
15367 |
-
this.ctx = this.canvas.getContext('2d');
|
15368 |
-
this.canvas.width = Math.floor(options.width) * options.scale;
|
15369 |
-
this.canvas.height = Math.floor(options.height) * options.scale;
|
15370 |
-
this.canvas.style.width = options.width + 'px';
|
15371 |
-
this.canvas.style.height = options.height + 'px';
|
15372 |
-
|
15373 |
-
options.logger.log('ForeignObject renderer initialized (' + options.width + 'x' + options.height + ' at ' + options.x + ',' + options.y + ') with scale ' + options.scale);
|
15374 |
-
var svg = createForeignObjectSVG(Math.max(options.windowWidth, options.width) * options.scale, Math.max(options.windowHeight, options.height) * options.scale, options.scrollX * options.scale, options.scrollY * options.scale, this.element);
|
15375 |
-
|
15376 |
-
return loadSerializedSVG(svg).then(function (img) {
|
15377 |
-
if (options.backgroundColor) {
|
15378 |
-
_this.ctx.fillStyle = options.backgroundColor.toString();
|
15379 |
-
_this.ctx.fillRect(0, 0, options.width * options.scale, options.height * options.scale);
|
15380 |
-
}
|
15381 |
-
|
15382 |
-
_this.ctx.drawImage(img, -options.x * options.scale, -options.y * options.scale);
|
15383 |
-
return _this.canvas;
|
15384 |
-
});
|
15385 |
-
}
|
15386 |
-
}]);
|
15387 |
-
|
15388 |
-
return ForeignObjectRenderer;
|
15389 |
-
}();
|
15390 |
-
|
15391 |
-
exports.default = ForeignObjectRenderer;
|
15392 |
-
var createForeignObjectSVG = exports.createForeignObjectSVG = function createForeignObjectSVG(width, height, x, y, node) {
|
15393 |
-
var xmlns = 'http://www.w3.org/2000/svg';
|
15394 |
-
var svg = document.createElementNS(xmlns, 'svg');
|
15395 |
-
var foreignObject = document.createElementNS(xmlns, 'foreignObject');
|
15396 |
-
svg.setAttributeNS(null, 'width', width);
|
15397 |
-
svg.setAttributeNS(null, 'height', height);
|
15398 |
-
|
15399 |
-
foreignObject.setAttributeNS(null, 'width', '100%');
|
15400 |
-
foreignObject.setAttributeNS(null, 'height', '100%');
|
15401 |
-
foreignObject.setAttributeNS(null, 'x', x);
|
15402 |
-
foreignObject.setAttributeNS(null, 'y', y);
|
15403 |
-
foreignObject.setAttributeNS(null, 'externalResourcesRequired', 'true');
|
15404 |
-
svg.appendChild(foreignObject);
|
15405 |
-
|
15406 |
-
foreignObject.appendChild(node);
|
15407 |
-
|
15408 |
-
return svg;
|
15409 |
-
};
|
15410 |
-
|
15411 |
-
var loadSerializedSVG = exports.loadSerializedSVG = function loadSerializedSVG(svg) {
|
15412 |
-
return new Promise(function (resolve, reject) {
|
15413 |
-
var img = new Image();
|
15414 |
-
img.onload = function () {
|
15415 |
-
return resolve(img);
|
15416 |
-
};
|
15417 |
-
img.onerror = reject;
|
15418 |
-
|
15419 |
-
img.src = 'data:image/svg+xml;charset=utf-8,' + encodeURIComponent(new XMLSerializer().serializeToString(svg));
|
15420 |
-
});
|
15421 |
-
};
|
15422 |
-
|
15423 |
-
/***/ }),
|
15424 |
-
/* 24 */
|
15425 |
-
/***/ (function(module, exports, __webpack_require__) {
|
15426 |
-
|
15427 |
-
"use strict";
|
15428 |
-
|
15429 |
-
|
15430 |
-
Object.defineProperty(exports, "__esModule", {
|
15431 |
-
value: true
|
15432 |
-
});
|
15433 |
-
exports.breakWords = exports.fromCodePoint = exports.toCodePoints = undefined;
|
15434 |
-
|
15435 |
-
var _cssLineBreak = __webpack_require__(46);
|
15436 |
-
|
15437 |
-
Object.defineProperty(exports, 'toCodePoints', {
|
15438 |
-
enumerable: true,
|
15439 |
-
get: function get() {
|
15440 |
-
return _cssLineBreak.toCodePoints;
|
15441 |
-
}
|
15442 |
-
});
|
15443 |
-
Object.defineProperty(exports, 'fromCodePoint', {
|
15444 |
-
enumerable: true,
|
15445 |
-
get: function get() {
|
15446 |
-
return _cssLineBreak.fromCodePoint;
|
15447 |
-
}
|
15448 |
-
});
|
15449 |
-
|
15450 |
-
var _NodeContainer = __webpack_require__(3);
|
15451 |
-
|
15452 |
-
var _NodeContainer2 = _interopRequireDefault(_NodeContainer);
|
15453 |
-
|
15454 |
-
var _overflowWrap = __webpack_require__(18);
|
15455 |
-
|
15456 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
15457 |
-
|
15458 |
-
var breakWords = exports.breakWords = function breakWords(str, parent) {
|
15459 |
-
var breaker = (0, _cssLineBreak.LineBreaker)(str, {
|
15460 |
-
lineBreak: parent.style.lineBreak,
|
15461 |
-
wordBreak: parent.style.overflowWrap === _overflowWrap.OVERFLOW_WRAP.BREAK_WORD ? 'break-word' : parent.style.wordBreak
|
15462 |
-
});
|
15463 |
-
|
15464 |
-
var words = [];
|
15465 |
-
var bk = void 0;
|
15466 |
-
|
15467 |
-
while (!(bk = breaker.next()).done) {
|
15468 |
-
words.push(bk.value.slice());
|
15469 |
-
}
|
15470 |
-
|
15471 |
-
return words;
|
15472 |
-
};
|
15473 |
-
|
15474 |
-
/***/ }),
|
15475 |
-
/* 25 */
|
15476 |
-
/***/ (function(module, exports, __webpack_require__) {
|
15477 |
-
|
15478 |
-
"use strict";
|
15479 |
-
|
15480 |
-
|
15481 |
-
Object.defineProperty(exports, "__esModule", {
|
15482 |
-
value: true
|
15483 |
-
});
|
15484 |
-
exports.FontMetrics = undefined;
|
15485 |
-
|
15486 |
-
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
15487 |
-
|
15488 |
-
var _Util = __webpack_require__(4);
|
15489 |
-
|
15490 |
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
15491 |
-
|
15492 |
-
var SAMPLE_TEXT = 'Hidden Text';
|
15493 |
-
|
15494 |
-
var FontMetrics = exports.FontMetrics = function () {
|
15495 |
-
function FontMetrics(document) {
|
15496 |
-
_classCallCheck(this, FontMetrics);
|
15497 |
-
|
15498 |
-
this._data = {};
|
15499 |
-
this._document = document;
|
15500 |
-
}
|
15501 |
-
|
15502 |
-
_createClass(FontMetrics, [{
|
15503 |
-
key: '_parseMetrics',
|
15504 |
-
value: function _parseMetrics(font) {
|
15505 |
-
var container = this._document.createElement('div');
|
15506 |
-
var img = this._document.createElement('img');
|
15507 |
-
var span = this._document.createElement('span');
|
15508 |
-
|
15509 |
-
var body = this._document.body;
|
15510 |
-
if (!body) {
|
15511 |
-
throw new Error( true ? 'No document found for font metrics' : '');
|
15512 |
-
}
|
15513 |
-
|
15514 |
-
container.style.visibility = 'hidden';
|
15515 |
-
container.style.fontFamily = font.fontFamily;
|
15516 |
-
container.style.fontSize = font.fontSize;
|
15517 |
-
container.style.margin = '0';
|
15518 |
-
container.style.padding = '0';
|
15519 |
-
|
15520 |
-
body.appendChild(container);
|
15521 |
-
|
15522 |
-
img.src = _Util.SMALL_IMAGE;
|
15523 |
-
img.width = 1;
|
15524 |
-
img.height = 1;
|
15525 |
-
|
15526 |
-
img.style.margin = '0';
|
15527 |
-
img.style.padding = '0';
|
15528 |
-
img.style.verticalAlign = 'baseline';
|
15529 |
-
|
15530 |
-
span.style.fontFamily = font.fontFamily;
|
15531 |
-
span.style.fontSize = font.fontSize;
|
15532 |
-
span.style.margin = '0';
|
15533 |
-
span.style.padding = '0';
|
15534 |
-
|
15535 |
-
span.appendChild(this._document.createTextNode(SAMPLE_TEXT));
|
15536 |
-
container.appendChild(span);
|
15537 |
-
container.appendChild(img);
|
15538 |
-
var baseline = img.offsetTop - span.offsetTop + 2;
|
15539 |
-
|
15540 |
-
container.removeChild(span);
|
15541 |
-
container.appendChild(this._document.createTextNode(SAMPLE_TEXT));
|
15542 |
-
|
15543 |
-
container.style.lineHeight = 'normal';
|
15544 |
-
img.style.verticalAlign = 'super';
|
15545 |
-
|
15546 |
-
var middle = img.offsetTop - container.offsetTop + 2;
|
15547 |
-
|
15548 |
-
body.removeChild(container);
|
15549 |
-
|
15550 |
-
return { baseline: baseline, middle: middle };
|
15551 |
-
}
|
15552 |
-
}, {
|
15553 |
-
key: 'getMetrics',
|
15554 |
-
value: function getMetrics(font) {
|
15555 |
-
var key = font.fontFamily + ' ' + font.fontSize;
|
15556 |
-
if (this._data[key] === undefined) {
|
15557 |
-
this._data[key] = this._parseMetrics(font);
|
15558 |
-
}
|
15559 |
-
|
15560 |
-
return this._data[key];
|
15561 |
-
}
|
15562 |
-
}]);
|
15563 |
-
|
15564 |
-
return FontMetrics;
|
15565 |
-
}();
|
15566 |
-
|
15567 |
-
/***/ }),
|
15568 |
-
/* 26 */
|
15569 |
-
/***/ (function(module, exports, __webpack_require__) {
|
15570 |
-
|
15571 |
-
"use strict";
|
15572 |
-
|
15573 |
-
|
15574 |
-
Object.defineProperty(exports, "__esModule", {
|
15575 |
-
value: true
|
15576 |
-
});
|
15577 |
-
exports.Proxy = undefined;
|
15578 |
-
|
15579 |
-
var _Feature = __webpack_require__(10);
|
15580 |
-
|
15581 |
-
var _Feature2 = _interopRequireDefault(_Feature);
|
15582 |
-
|
15583 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
15584 |
-
|
15585 |
-
var Proxy = exports.Proxy = function Proxy(src, options) {
|
15586 |
-
if (!options.proxy) {
|
15587 |
-
return Promise.reject( true ? 'No proxy defined' : null);
|
15588 |
-
}
|
15589 |
-
var proxy = options.proxy;
|
15590 |
-
|
15591 |
-
return new Promise(function (resolve, reject) {
|
15592 |
-
var responseType = _Feature2.default.SUPPORT_CORS_XHR && _Feature2.default.SUPPORT_RESPONSE_TYPE ? 'blob' : 'text';
|
15593 |
-
var xhr = _Feature2.default.SUPPORT_CORS_XHR ? new XMLHttpRequest() : new XDomainRequest();
|
15594 |
-
xhr.onload = function () {
|
15595 |
-
if (xhr instanceof XMLHttpRequest) {
|
15596 |
-
if (xhr.status === 200) {
|
15597 |
-
if (responseType === 'text') {
|
15598 |
-
resolve(xhr.response);
|
15599 |
-
} else {
|
15600 |
-
var reader = new FileReader();
|
15601 |
-
// $FlowFixMe
|
15602 |
-
reader.addEventListener('load', function () {
|
15603 |
-
return resolve(reader.result);
|
15604 |
-
}, false);
|
15605 |
-
// $FlowFixMe
|
15606 |
-
reader.addEventListener('error', function (e) {
|
15607 |
-
return reject(e);
|
15608 |
-
}, false);
|
15609 |
-
reader.readAsDataURL(xhr.response);
|
15610 |
-
}
|
15611 |
-
} else {
|
15612 |
-
reject( true ? 'Failed to proxy resource ' + src.substring(0, 256) + ' with status code ' + xhr.status : '');
|
15613 |
-
}
|
15614 |
-
} else {
|
15615 |
-
resolve(xhr.responseText);
|
15616 |
-
}
|
15617 |
-
};
|
15618 |
-
|
15619 |
-
xhr.onerror = reject;
|
15620 |
-
xhr.open('GET', proxy + '?url=' + encodeURIComponent(src) + '&responseType=' + responseType);
|
15621 |
-
|
15622 |
-
if (responseType !== 'text' && xhr instanceof XMLHttpRequest) {
|
15623 |
-
xhr.responseType = responseType;
|
15624 |
-
}
|
15625 |
-
|
15626 |
-
if (options.imageTimeout) {
|
15627 |
-
var timeout = options.imageTimeout;
|
15628 |
-
xhr.timeout = timeout;
|
15629 |
-
xhr.ontimeout = function () {
|
15630 |
-
return reject( true ? 'Timed out (' + timeout + 'ms) proxying ' + src.substring(0, 256) : '');
|
15631 |
-
};
|
15632 |
-
}
|
15633 |
-
|
15634 |
-
xhr.send();
|
15635 |
-
});
|
15636 |
-
};
|
15637 |
-
|
15638 |
-
/***/ }),
|
15639 |
-
/* 27 */
|
15640 |
-
/***/ (function(module, exports, __webpack_require__) {
|
15641 |
-
|
15642 |
-
"use strict";
|
15643 |
-
|
15644 |
-
|
15645 |
-
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
15646 |
-
|
15647 |
-
var _CanvasRenderer = __webpack_require__(15);
|
15648 |
-
|
15649 |
-
var _CanvasRenderer2 = _interopRequireDefault(_CanvasRenderer);
|
15650 |
-
|
15651 |
-
var _Logger = __webpack_require__(16);
|
15652 |
-
|
15653 |
-
var _Logger2 = _interopRequireDefault(_Logger);
|
15654 |
-
|
15655 |
-
var _Window = __webpack_require__(28);
|
15656 |
-
|
15657 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
15658 |
-
|
15659 |
-
var html2canvas = function html2canvas(element, conf) {
|
15660 |
-
var config = conf || {};
|
15661 |
-
var logger = new _Logger2.default(typeof config.logging === 'boolean' ? config.logging : true);
|
15662 |
-
logger.log('html2canvas ' + "1.0.0-alpha.12");
|
15663 |
-
|
15664 |
-
if (true && typeof config.onrendered === 'function') {
|
15665 |
-
logger.error('onrendered option is deprecated, html2canvas returns a Promise with the canvas as the value');
|
15666 |
-
}
|
15667 |
-
|
15668 |
-
var ownerDocument = element.ownerDocument;
|
15669 |
-
if (!ownerDocument) {
|
15670 |
-
return Promise.reject('Provided element is not within a Document');
|
15671 |
-
}
|
15672 |
-
var defaultView = ownerDocument.defaultView;
|
15673 |
-
|
15674 |
-
var defaultOptions = {
|
15675 |
-
async: true,
|
15676 |
-
allowTaint: false,
|
15677 |
-
backgroundColor: '#ffffff',
|
15678 |
-
imageTimeout: 15000,
|
15679 |
-
logging: true,
|
15680 |
-
proxy: null,
|
15681 |
-
removeContainer: true,
|
15682 |
-
foreignObjectRendering: false,
|
15683 |
-
scale: defaultView.devicePixelRatio || 1,
|
15684 |
-
target: new _CanvasRenderer2.default(config.canvas),
|
15685 |
-
useCORS: false,
|
15686 |
-
windowWidth: defaultView.innerWidth,
|
15687 |
-
windowHeight: defaultView.innerHeight,
|
15688 |
-
scrollX: defaultView.pageXOffset,
|
15689 |
-
scrollY: defaultView.pageYOffset
|
15690 |
-
};
|
15691 |
-
|
15692 |
-
var result = (0, _Window.renderElement)(element, _extends({}, defaultOptions, config), logger);
|
15693 |
-
|
15694 |
-
if (true) {
|
15695 |
-
return result.catch(function (e) {
|
15696 |
-
logger.error(e);
|
15697 |
-
throw e;
|
15698 |
-
});
|
15699 |
-
}
|
15700 |
-
return result;
|
15701 |
-
};
|
15702 |
-
|
15703 |
-
html2canvas.CanvasRenderer = _CanvasRenderer2.default;
|
15704 |
-
|
15705 |
-
module.exports = html2canvas;
|
15706 |
-
|
15707 |
-
/***/ }),
|
15708 |
-
/* 28 */
|
15709 |
-
/***/ (function(module, exports, __webpack_require__) {
|
15710 |
-
|
15711 |
-
"use strict";
|
15712 |
-
|
15713 |
-
|
15714 |
-
Object.defineProperty(exports, "__esModule", {
|
15715 |
-
value: true
|
15716 |
-
});
|
15717 |
-
exports.renderElement = undefined;
|
15718 |
-
|
15719 |
-
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
|
15720 |
-
|
15721 |
-
var _Logger = __webpack_require__(16);
|
15722 |
-
|
15723 |
-
var _Logger2 = _interopRequireDefault(_Logger);
|
15724 |
-
|
15725 |
-
var _NodeParser = __webpack_require__(29);
|
15726 |
-
|
15727 |
-
var _Renderer = __webpack_require__(51);
|
15728 |
-
|
15729 |
-
var _Renderer2 = _interopRequireDefault(_Renderer);
|
15730 |
-
|
15731 |
-
var _ForeignObjectRenderer = __webpack_require__(23);
|
15732 |
-
|
15733 |
-
var _ForeignObjectRenderer2 = _interopRequireDefault(_ForeignObjectRenderer);
|
15734 |
-
|
15735 |
-
var _Feature = __webpack_require__(10);
|
15736 |
-
|
15737 |
-
var _Feature2 = _interopRequireDefault(_Feature);
|
15738 |
-
|
15739 |
-
var _Bounds = __webpack_require__(2);
|
15740 |
-
|
15741 |
-
var _Clone = __webpack_require__(54);
|
15742 |
-
|
15743 |
-
var _Font = __webpack_require__(25);
|
15744 |
-
|
15745 |
-
var _Color = __webpack_require__(0);
|
15746 |
-
|
15747 |
-
var _Color2 = _interopRequireDefault(_Color);
|
15748 |
-
|
15749 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
15750 |
-
|
15751 |
-
var renderElement = exports.renderElement = function renderElement(element, options, logger) {
|
15752 |
-
var ownerDocument = element.ownerDocument;
|
15753 |
-
|
15754 |
-
var windowBounds = new _Bounds.Bounds(options.scrollX, options.scrollY, options.windowWidth, options.windowHeight);
|
15755 |
-
|
15756 |
-
// http://www.w3.org/TR/css3-background/#special-backgrounds
|
15757 |
-
var documentBackgroundColor = ownerDocument.documentElement ? new _Color2.default(getComputedStyle(ownerDocument.documentElement).backgroundColor) : _Color.TRANSPARENT;
|
15758 |
-
var bodyBackgroundColor = ownerDocument.body ? new _Color2.default(getComputedStyle(ownerDocument.body).backgroundColor) : _Color.TRANSPARENT;
|
15759 |
-
|
15760 |
-
var backgroundColor = element === ownerDocument.documentElement ? documentBackgroundColor.isTransparent() ? bodyBackgroundColor.isTransparent() ? options.backgroundColor ? new _Color2.default(options.backgroundColor) : null : bodyBackgroundColor : documentBackgroundColor : options.backgroundColor ? new _Color2.default(options.backgroundColor) : null;
|
15761 |
-
|
15762 |
-
return (options.foreignObjectRendering ? // $FlowFixMe
|
15763 |
-
_Feature2.default.SUPPORT_FOREIGNOBJECT_DRAWING : Promise.resolve(false)).then(function (supportForeignObject) {
|
15764 |
-
return supportForeignObject ? function (cloner) {
|
15765 |
-
if (true) {
|
15766 |
-
logger.log('Document cloned, using foreignObject rendering');
|
15767 |
-
}
|
15768 |
-
|
15769 |
-
return cloner.inlineFonts(ownerDocument).then(function () {
|
15770 |
-
return cloner.resourceLoader.ready();
|
15771 |
-
}).then(function () {
|
15772 |
-
var renderer = new _ForeignObjectRenderer2.default(cloner.documentElement);
|
15773 |
-
|
15774 |
-
var defaultView = ownerDocument.defaultView;
|
15775 |
-
var scrollX = defaultView.pageXOffset;
|
15776 |
-
var scrollY = defaultView.pageYOffset;
|
15777 |
-
|
15778 |
-
var isDocument = element.tagName === 'HTML' || element.tagName === 'BODY';
|
15779 |
-
|
15780 |
-
var _ref = isDocument ? (0, _Bounds.parseDocumentSize)(ownerDocument) : (0, _Bounds.parseBounds)(element, scrollX, scrollY),
|
15781 |
-
width = _ref.width,
|
15782 |
-
height = _ref.height,
|
15783 |
-
left = _ref.left,
|
15784 |
-
top = _ref.top;
|
15785 |
-
|
15786 |
-
return renderer.render({
|
15787 |
-
backgroundColor: backgroundColor,
|
15788 |
-
logger: logger,
|
15789 |
-
scale: options.scale,
|
15790 |
-
x: typeof options.x === 'number' ? options.x : left,
|
15791 |
-
y: typeof options.y === 'number' ? options.y : top,
|
15792 |
-
width: typeof options.width === 'number' ? options.width : Math.ceil(width),
|
15793 |
-
height: typeof options.height === 'number' ? options.height : Math.ceil(height),
|
15794 |
-
windowWidth: options.windowWidth,
|
15795 |
-
windowHeight: options.windowHeight,
|
15796 |
-
scrollX: options.scrollX,
|
15797 |
-
scrollY: options.scrollY
|
15798 |
-
});
|
15799 |
-
});
|
15800 |
-
}(new _Clone.DocumentCloner(element, options, logger, true, renderElement)) : (0, _Clone.cloneWindow)(ownerDocument, windowBounds, element, options, logger, renderElement).then(function (_ref2) {
|
15801 |
-
var _ref3 = _slicedToArray(_ref2, 3),
|
15802 |
-
container = _ref3[0],
|
15803 |
-
clonedElement = _ref3[1],
|
15804 |
-
resourceLoader = _ref3[2];
|
15805 |
-
|
15806 |
-
if (true) {
|
15807 |
-
logger.log('Document cloned, using computed rendering');
|
15808 |
-
}
|
15809 |
-
|
15810 |
-
var stack = (0, _NodeParser.NodeParser)(clonedElement, resourceLoader, logger);
|
15811 |
-
var clonedDocument = clonedElement.ownerDocument;
|
15812 |
-
|
15813 |
-
if (backgroundColor === stack.container.style.background.backgroundColor) {
|
15814 |
-
stack.container.style.background.backgroundColor = _Color.TRANSPARENT;
|
15815 |
-
}
|
15816 |
-
|
15817 |
-
return resourceLoader.ready().then(function (imageStore) {
|
15818 |
-
var fontMetrics = new _Font.FontMetrics(clonedDocument);
|
15819 |
-
if (true) {
|
15820 |
-
logger.log('Starting renderer');
|
15821 |
-
}
|
15822 |
-
|
15823 |
-
var defaultView = clonedDocument.defaultView;
|
15824 |
-
var scrollX = defaultView.pageXOffset;
|
15825 |
-
var scrollY = defaultView.pageYOffset;
|
15826 |
-
|
15827 |
-
var isDocument = clonedElement.tagName === 'HTML' || clonedElement.tagName === 'BODY';
|
15828 |
-
|
15829 |
-
var _ref4 = isDocument ? (0, _Bounds.parseDocumentSize)(ownerDocument) : (0, _Bounds.parseBounds)(clonedElement, scrollX, scrollY),
|
15830 |
-
width = _ref4.width,
|
15831 |
-
height = _ref4.height,
|
15832 |
-
left = _ref4.left,
|
15833 |
-
top = _ref4.top;
|
15834 |
-
|
15835 |
-
var renderOptions = {
|
15836 |
-
backgroundColor: backgroundColor,
|
15837 |
-
fontMetrics: fontMetrics,
|
15838 |
-
imageStore: imageStore,
|
15839 |
-
logger: logger,
|
15840 |
-
scale: options.scale,
|
15841 |
-
x: typeof options.x === 'number' ? options.x : left,
|
15842 |
-
y: typeof options.y === 'number' ? options.y : top,
|
15843 |
-
width: typeof options.width === 'number' ? options.width : Math.ceil(width),
|
15844 |
-
height: typeof options.height === 'number' ? options.height : Math.ceil(height)
|
15845 |
-
};
|
15846 |
-
|
15847 |
-
if (Array.isArray(options.target)) {
|
15848 |
-
return Promise.all(options.target.map(function (target) {
|
15849 |
-
var renderer = new _Renderer2.default(target, renderOptions);
|
15850 |
-
return renderer.render(stack);
|
15851 |
-
}));
|
15852 |
-
} else {
|
15853 |
-
var renderer = new _Renderer2.default(options.target, renderOptions);
|
15854 |
-
var canvas = renderer.render(stack);
|
15855 |
-
if (options.removeContainer === true) {
|
15856 |
-
if (container.parentNode) {
|
15857 |
-
container.parentNode.removeChild(container);
|
15858 |
-
} else if (true) {
|
15859 |
-
logger.log('Cannot detach cloned iframe as it is not in the DOM anymore');
|
15860 |
-
}
|
15861 |
-
}
|
15862 |
-
|
15863 |
-
return canvas;
|
15864 |
-
}
|
15865 |
-
});
|
15866 |
-
});
|
15867 |
-
});
|
15868 |
-
};
|
15869 |
-
|
15870 |
-
/***/ }),
|
15871 |
-
/* 29 */
|
15872 |
-
/***/ (function(module, exports, __webpack_require__) {
|
15873 |
-
|
15874 |
-
"use strict";
|
15875 |
-
|
15876 |
-
|
15877 |
-
Object.defineProperty(exports, "__esModule", {
|
15878 |
-
value: true
|
15879 |
-
});
|
15880 |
-
exports.NodeParser = undefined;
|
15881 |
-
|
15882 |
-
var _StackingContext = __webpack_require__(30);
|
15883 |
-
|
15884 |
-
var _StackingContext2 = _interopRequireDefault(_StackingContext);
|
15885 |
-
|
15886 |
-
var _NodeContainer = __webpack_require__(3);
|
15887 |
-
|
15888 |
-
var _NodeContainer2 = _interopRequireDefault(_NodeContainer);
|
15889 |
-
|
15890 |
-
var _TextContainer = __webpack_require__(9);
|
15891 |
-
|
15892 |
-
var _TextContainer2 = _interopRequireDefault(_TextContainer);
|
15893 |
-
|
15894 |
-
var _Input = __webpack_require__(21);
|
15895 |
-
|
15896 |
-
var _ListItem = __webpack_require__(14);
|
15897 |
-
|
15898 |
-
var _listStyle = __webpack_require__(8);
|
15899 |
-
|
15900 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
15901 |
-
|
15902 |
-
var NodeParser = exports.NodeParser = function NodeParser(node, resourceLoader, logger) {
|
15903 |
-
if (true) {
|
15904 |
-
logger.log('Starting node parsing');
|
15905 |
-
}
|
15906 |
-
|
15907 |
-
var index = 0;
|
15908 |
-
|
15909 |
-
var container = new _NodeContainer2.default(node, null, resourceLoader, index++);
|
15910 |
-
var stack = new _StackingContext2.default(container, null, true);
|
15911 |
-
|
15912 |
-
parseNodeTree(node, container, stack, resourceLoader, index);
|
15913 |
-
|
15914 |
-
if (true) {
|
15915 |
-
logger.log('Finished parsing node tree');
|
15916 |
-
}
|
15917 |
-
|
15918 |
-
return stack;
|
15919 |
-
};
|
15920 |
-
|
15921 |
-
var IGNORED_NODE_NAMES = ['SCRIPT', 'HEAD', 'TITLE', 'OBJECT', 'BR', 'OPTION'];
|
15922 |
-
|
15923 |
-
var parseNodeTree = function parseNodeTree(node, parent, stack, resourceLoader, index) {
|
15924 |
-
if (true && index > 50000) {
|
15925 |
-
throw new Error('Recursion error while parsing node tree');
|
15926 |
-
}
|
15927 |
-
|
15928 |
-
for (var childNode = node.firstChild, nextNode; childNode; childNode = nextNode) {
|
15929 |
-
nextNode = childNode.nextSibling;
|
15930 |
-
var defaultView = childNode.ownerDocument.defaultView;
|
15931 |
-
if (childNode instanceof defaultView.Text || childNode instanceof Text || defaultView.parent && childNode instanceof defaultView.parent.Text) {
|
15932 |
-
if (childNode.data.trim().length > 0) {
|
15933 |
-
parent.childNodes.push(_TextContainer2.default.fromTextNode(childNode, parent));
|
15934 |
-
}
|
15935 |
-
} else if (childNode instanceof defaultView.HTMLElement || childNode instanceof HTMLElement || defaultView.parent && childNode instanceof defaultView.parent.HTMLElement) {
|
15936 |
-
if (IGNORED_NODE_NAMES.indexOf(childNode.nodeName) === -1) {
|
15937 |
-
var container = new _NodeContainer2.default(childNode, parent, resourceLoader, index++);
|
15938 |
-
if (container.isVisible()) {
|
15939 |
-
if (childNode.tagName === 'INPUT') {
|
15940 |
-
// $FlowFixMe
|
15941 |
-
(0, _Input.inlineInputElement)(childNode, container);
|
15942 |
-
} else if (childNode.tagName === 'TEXTAREA') {
|
15943 |
-
// $FlowFixMe
|
15944 |
-
(0, _Input.inlineTextAreaElement)(childNode, container);
|
15945 |
-
} else if (childNode.tagName === 'SELECT') {
|
15946 |
-
// $FlowFixMe
|
15947 |
-
(0, _Input.inlineSelectElement)(childNode, container);
|
15948 |
-
} else if (container.style.listStyle && container.style.listStyle.listStyleType !== _listStyle.LIST_STYLE_TYPE.NONE) {
|
15949 |
-
(0, _ListItem.inlineListItemElement)(childNode, container, resourceLoader);
|
15950 |
-
}
|
15951 |
-
|
15952 |
-
var SHOULD_TRAVERSE_CHILDREN = childNode.tagName !== 'TEXTAREA';
|
15953 |
-
var treatAsRealStackingContext = createsRealStackingContext(container, childNode);
|
15954 |
-
if (treatAsRealStackingContext || createsStackingContext(container)) {
|
15955 |
-
// for treatAsRealStackingContext:false, any positioned descendants and descendants
|
15956 |
-
// which actually create a new stacking context should be considered part of the parent stacking context
|
15957 |
-
var parentStack = treatAsRealStackingContext || container.isPositioned() ? stack.getRealParentStackingContext() : stack;
|
15958 |
-
var childStack = new _StackingContext2.default(container, parentStack, treatAsRealStackingContext);
|
15959 |
-
parentStack.contexts.push(childStack);
|
15960 |
-
if (SHOULD_TRAVERSE_CHILDREN) {
|
15961 |
-
parseNodeTree(childNode, container, childStack, resourceLoader, index);
|
15962 |
-
}
|
15963 |
-
} else {
|
15964 |
-
stack.children.push(container);
|
15965 |
-
if (SHOULD_TRAVERSE_CHILDREN) {
|
15966 |
-
parseNodeTree(childNode, container, stack, resourceLoader, index);
|
15967 |
-
}
|
15968 |
-
}
|
15969 |
-
}
|
15970 |
-
}
|
15971 |
-
} else if (childNode instanceof defaultView.SVGSVGElement || childNode instanceof SVGSVGElement || defaultView.parent && childNode instanceof defaultView.parent.SVGSVGElement) {
|
15972 |
-
var _container = new _NodeContainer2.default(childNode, parent, resourceLoader, index++);
|
15973 |
-
var _treatAsRealStackingContext = createsRealStackingContext(_container, childNode);
|
15974 |
-
if (_treatAsRealStackingContext || createsStackingContext(_container)) {
|
15975 |
-
// for treatAsRealStackingContext:false, any positioned descendants and descendants
|
15976 |
-
// which actually create a new stacking context should be considered part of the parent stacking context
|
15977 |
-
var _parentStack = _treatAsRealStackingContext || _container.isPositioned() ? stack.getRealParentStackingContext() : stack;
|
15978 |
-
var _childStack = new _StackingContext2.default(_container, _parentStack, _treatAsRealStackingContext);
|
15979 |
-
_parentStack.contexts.push(_childStack);
|
15980 |
-
} else {
|
15981 |
-
stack.children.push(_container);
|
15982 |
-
}
|
15983 |
-
}
|
15984 |
-
}
|
15985 |
-
};
|
15986 |
-
|
15987 |
-
var createsRealStackingContext = function createsRealStackingContext(container, node) {
|
15988 |
-
return container.isRootElement() || container.isPositionedWithZIndex() || container.style.opacity < 1 || container.isTransformed() || isBodyWithTransparentRoot(container, node);
|
15989 |
-
};
|
15990 |
-
|
15991 |
-
var createsStackingContext = function createsStackingContext(container) {
|
15992 |
-
return container.isPositioned() || container.isFloating();
|
15993 |
-
};
|
15994 |
-
|
15995 |
-
var isBodyWithTransparentRoot = function isBodyWithTransparentRoot(container, node) {
|
15996 |
-
return node.nodeName === 'BODY' && container.parent instanceof _NodeContainer2.default && container.parent.style.background.backgroundColor.isTransparent();
|
15997 |
-
};
|
15998 |
-
|
15999 |
-
/***/ }),
|
16000 |
-
/* 30 */
|
16001 |
-
/***/ (function(module, exports, __webpack_require__) {
|
16002 |
-
|
16003 |
-
"use strict";
|
16004 |
-
|
16005 |
-
|
16006 |
-
Object.defineProperty(exports, "__esModule", {
|
16007 |
-
value: true
|
16008 |
-
});
|
16009 |
-
|
16010 |
-
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
16011 |
-
|
16012 |
-
var _NodeContainer = __webpack_require__(3);
|
16013 |
-
|
16014 |
-
var _NodeContainer2 = _interopRequireDefault(_NodeContainer);
|
16015 |
-
|
16016 |
-
var _position = __webpack_require__(19);
|
16017 |
-
|
16018 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
16019 |
-
|
16020 |
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
16021 |
-
|
16022 |
-
var StackingContext = function () {
|
16023 |
-
function StackingContext(container, parent, treatAsRealStackingContext) {
|
16024 |
-
_classCallCheck(this, StackingContext);
|
16025 |
-
|
16026 |
-
this.container = container;
|
16027 |
-
this.parent = parent;
|
16028 |
-
this.contexts = [];
|
16029 |
-
this.children = [];
|
16030 |
-
this.treatAsRealStackingContext = treatAsRealStackingContext;
|
16031 |
-
}
|
16032 |
-
|
16033 |
-
_createClass(StackingContext, [{
|
16034 |
-
key: 'getOpacity',
|
16035 |
-
value: function getOpacity() {
|
16036 |
-
return this.parent ? this.container.style.opacity * this.parent.getOpacity() : this.container.style.opacity;
|
16037 |
-
}
|
16038 |
-
}, {
|
16039 |
-
key: 'getRealParentStackingContext',
|
16040 |
-
value: function getRealParentStackingContext() {
|
16041 |
-
return !this.parent || this.treatAsRealStackingContext ? this : this.parent.getRealParentStackingContext();
|
16042 |
-
}
|
16043 |
-
}]);
|
16044 |
-
|
16045 |
-
return StackingContext;
|
16046 |
-
}();
|
16047 |
-
|
16048 |
-
exports.default = StackingContext;
|
16049 |
-
|
16050 |
-
/***/ }),
|
16051 |
-
/* 31 */
|
16052 |
-
/***/ (function(module, exports, __webpack_require__) {
|
16053 |
-
|
16054 |
-
"use strict";
|
16055 |
-
|
16056 |
-
|
16057 |
-
Object.defineProperty(exports, "__esModule", {
|
16058 |
-
value: true
|
16059 |
-
});
|
16060 |
-
|
16061 |
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
16062 |
-
|
16063 |
-
var Size = function Size(width, height) {
|
16064 |
-
_classCallCheck(this, Size);
|
16065 |
-
|
16066 |
-
this.width = width;
|
16067 |
-
this.height = height;
|
16068 |
-
};
|
16069 |
-
|
16070 |
-
exports.default = Size;
|
16071 |
-
|
16072 |
-
/***/ }),
|
16073 |
-
/* 32 */
|
16074 |
-
/***/ (function(module, exports, __webpack_require__) {
|
16075 |
-
|
16076 |
-
"use strict";
|
16077 |
-
|
16078 |
-
|
16079 |
-
Object.defineProperty(exports, "__esModule", {
|
16080 |
-
value: true
|
16081 |
-
});
|
16082 |
-
|
16083 |
-
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
16084 |
-
|
16085 |
-
var _Path = __webpack_require__(6);
|
16086 |
-
|
16087 |
-
var _Vector = __webpack_require__(7);
|
16088 |
-
|
16089 |
-
var _Vector2 = _interopRequireDefault(_Vector);
|
16090 |
-
|
16091 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
16092 |
-
|
16093 |
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
16094 |
-
|
16095 |
-
var lerp = function lerp(a, b, t) {
|
16096 |
-
return new _Vector2.default(a.x + (b.x - a.x) * t, a.y + (b.y - a.y) * t);
|
16097 |
-
};
|
16098 |
-
|
16099 |
-
var BezierCurve = function () {
|
16100 |
-
function BezierCurve(start, startControl, endControl, end) {
|
16101 |
-
_classCallCheck(this, BezierCurve);
|
16102 |
-
|
16103 |
-
this.type = _Path.PATH.BEZIER_CURVE;
|
16104 |
-
this.start = start;
|
16105 |
-
this.startControl = startControl;
|
16106 |
-
this.endControl = endControl;
|
16107 |
-
this.end = end;
|
16108 |
-
}
|
16109 |
-
|
16110 |
-
_createClass(BezierCurve, [{
|
16111 |
-
key: 'subdivide',
|
16112 |
-
value: function subdivide(t, firstHalf) {
|
16113 |
-
var ab = lerp(this.start, this.startControl, t);
|
16114 |
-
var bc = lerp(this.startControl, this.endControl, t);
|
16115 |
-
var cd = lerp(this.endControl, this.end, t);
|
16116 |
-
var abbc = lerp(ab, bc, t);
|
16117 |
-
var bccd = lerp(bc, cd, t);
|
16118 |
-
var dest = lerp(abbc, bccd, t);
|
16119 |
-
return firstHalf ? new BezierCurve(this.start, ab, abbc, dest) : new BezierCurve(dest, bccd, cd, this.end);
|
16120 |
-
}
|
16121 |
-
}, {
|
16122 |
-
key: 'reverse',
|
16123 |
-
value: function reverse() {
|
16124 |
-
return new BezierCurve(this.end, this.endControl, this.startControl, this.start);
|
16125 |
-
}
|
16126 |
-
}]);
|
16127 |
-
|
16128 |
-
return BezierCurve;
|
16129 |
-
}();
|
16130 |
-
|
16131 |
-
exports.default = BezierCurve;
|
16132 |
-
|
16133 |
-
/***/ }),
|
16134 |
-
/* 33 */
|
16135 |
-
/***/ (function(module, exports, __webpack_require__) {
|
16136 |
-
|
16137 |
-
"use strict";
|
16138 |
-
|
16139 |
-
|
16140 |
-
Object.defineProperty(exports, "__esModule", {
|
16141 |
-
value: true
|
16142 |
-
});
|
16143 |
-
exports.parseBorderRadius = undefined;
|
16144 |
-
|
16145 |
-
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
|
16146 |
-
|
16147 |
-
var _Length = __webpack_require__(1);
|
16148 |
-
|
16149 |
-
var _Length2 = _interopRequireDefault(_Length);
|
16150 |
-
|
16151 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
16152 |
-
|
16153 |
-
var SIDES = ['top-left', 'top-right', 'bottom-right', 'bottom-left'];
|
16154 |
-
|
16155 |
-
var parseBorderRadius = exports.parseBorderRadius = function parseBorderRadius(style) {
|
16156 |
-
return SIDES.map(function (side) {
|
16157 |
-
var value = style.getPropertyValue('border-' + side + '-radius');
|
16158 |
-
|
16159 |
-
var _value$split$map = value.split(' ').map(_Length2.default.create),
|
16160 |
-
_value$split$map2 = _slicedToArray(_value$split$map, 2),
|
16161 |
-
horizontal = _value$split$map2[0],
|
16162 |
-
vertical = _value$split$map2[1];
|
16163 |
-
|
16164 |
-
return typeof vertical === 'undefined' ? [horizontal, horizontal] : [horizontal, vertical];
|
16165 |
-
});
|
16166 |
-
};
|
16167 |
-
|
16168 |
-
/***/ }),
|
16169 |
-
/* 34 */
|
16170 |
-
/***/ (function(module, exports, __webpack_require__) {
|
16171 |
-
|
16172 |
-
"use strict";
|
16173 |
-
|
16174 |
-
|
16175 |
-
Object.defineProperty(exports, "__esModule", {
|
16176 |
-
value: true
|
16177 |
-
});
|
16178 |
-
var DISPLAY = exports.DISPLAY = {
|
16179 |
-
NONE: 1 << 0,
|
16180 |
-
BLOCK: 1 << 1,
|
16181 |
-
INLINE: 1 << 2,
|
16182 |
-
RUN_IN: 1 << 3,
|
16183 |
-
FLOW: 1 << 4,
|
16184 |
-
FLOW_ROOT: 1 << 5,
|
16185 |
-
TABLE: 1 << 6,
|
16186 |
-
FLEX: 1 << 7,
|
16187 |
-
GRID: 1 << 8,
|
16188 |
-
RUBY: 1 << 9,
|
16189 |
-
SUBGRID: 1 << 10,
|
16190 |
-
LIST_ITEM: 1 << 11,
|
16191 |
-
TABLE_ROW_GROUP: 1 << 12,
|
16192 |
-
TABLE_HEADER_GROUP: 1 << 13,
|
16193 |
-
TABLE_FOOTER_GROUP: 1 << 14,
|
16194 |
-
TABLE_ROW: 1 << 15,
|
16195 |
-
TABLE_CELL: 1 << 16,
|
16196 |
-
TABLE_COLUMN_GROUP: 1 << 17,
|
16197 |
-
TABLE_COLUMN: 1 << 18,
|
16198 |
-
TABLE_CAPTION: 1 << 19,
|
16199 |
-
RUBY_BASE: 1 << 20,
|
16200 |
-
RUBY_TEXT: 1 << 21,
|
16201 |
-
RUBY_BASE_CONTAINER: 1 << 22,
|
16202 |
-
RUBY_TEXT_CONTAINER: 1 << 23,
|
16203 |
-
CONTENTS: 1 << 24,
|
16204 |
-
INLINE_BLOCK: 1 << 25,
|
16205 |
-
INLINE_LIST_ITEM: 1 << 26,
|
16206 |
-
INLINE_TABLE: 1 << 27,
|
16207 |
-
INLINE_FLEX: 1 << 28,
|
16208 |
-
INLINE_GRID: 1 << 29
|
16209 |
-
};
|
16210 |
-
|
16211 |
-
var parseDisplayValue = function parseDisplayValue(display) {
|
16212 |
-
switch (display) {
|
16213 |
-
case 'block':
|
16214 |
-
return DISPLAY.BLOCK;
|
16215 |
-
case 'inline':
|
16216 |
-
return DISPLAY.INLINE;
|
16217 |
-
case 'run-in':
|
16218 |
-
return DISPLAY.RUN_IN;
|
16219 |
-
case 'flow':
|
16220 |
-
return DISPLAY.FLOW;
|
16221 |
-
case 'flow-root':
|
16222 |
-
return DISPLAY.FLOW_ROOT;
|
16223 |
-
case 'table':
|
16224 |
-
return DISPLAY.TABLE;
|
16225 |
-
case 'flex':
|
16226 |
-
return DISPLAY.FLEX;
|
16227 |
-
case 'grid':
|
16228 |
-
return DISPLAY.GRID;
|
16229 |
-
case 'ruby':
|
16230 |
-
return DISPLAY.RUBY;
|
16231 |
-
case 'subgrid':
|
16232 |
-
return DISPLAY.SUBGRID;
|
16233 |
-
case 'list-item':
|
16234 |
-
return DISPLAY.LIST_ITEM;
|
16235 |
-
case 'table-row-group':
|
16236 |
-
return DISPLAY.TABLE_ROW_GROUP;
|
16237 |
-
case 'table-header-group':
|
16238 |
-
return DISPLAY.TABLE_HEADER_GROUP;
|
16239 |
-
case 'table-footer-group':
|
16240 |
-
return DISPLAY.TABLE_FOOTER_GROUP;
|
16241 |
-
case 'table-row':
|
16242 |
-
return DISPLAY.TABLE_ROW;
|
16243 |
-
case 'table-cell':
|
16244 |
-
return DISPLAY.TABLE_CELL;
|
16245 |
-
case 'table-column-group':
|
16246 |
-
return DISPLAY.TABLE_COLUMN_GROUP;
|
16247 |
-
case 'table-column':
|
16248 |
-
return DISPLAY.TABLE_COLUMN;
|
16249 |
-
case 'table-caption':
|
16250 |
-
return DISPLAY.TABLE_CAPTION;
|
16251 |
-
case 'ruby-base':
|
16252 |
-
return DISPLAY.RUBY_BASE;
|
16253 |
-
case 'ruby-text':
|
16254 |
-
return DISPLAY.RUBY_TEXT;
|
16255 |
-
case 'ruby-base-container':
|
16256 |
-
return DISPLAY.RUBY_BASE_CONTAINER;
|
16257 |
-
case 'ruby-text-container':
|
16258 |
-
return DISPLAY.RUBY_TEXT_CONTAINER;
|
16259 |
-
case 'contents':
|
16260 |
-
return DISPLAY.CONTENTS;
|
16261 |
-
case 'inline-block':
|
16262 |
-
return DISPLAY.INLINE_BLOCK;
|
16263 |
-
case 'inline-list-item':
|
16264 |
-
return DISPLAY.INLINE_LIST_ITEM;
|
16265 |
-
case 'inline-table':
|
16266 |
-
return DISPLAY.INLINE_TABLE;
|
16267 |
-
case 'inline-flex':
|
16268 |
-
return DISPLAY.INLINE_FLEX;
|
16269 |
-
case 'inline-grid':
|
16270 |
-
return DISPLAY.INLINE_GRID;
|
16271 |
-
}
|
16272 |
-
|
16273 |
-
return DISPLAY.NONE;
|
16274 |
-
};
|
16275 |
-
|
16276 |
-
var setDisplayBit = function setDisplayBit(bit, display) {
|
16277 |
-
return bit | parseDisplayValue(display);
|
16278 |
-
};
|
16279 |
-
|
16280 |
-
var parseDisplay = exports.parseDisplay = function parseDisplay(display) {
|
16281 |
-
return display.split(' ').reduce(setDisplayBit, 0);
|
16282 |
-
};
|
16283 |
-
|
16284 |
-
/***/ }),
|
16285 |
-
/* 35 */
|
16286 |
-
/***/ (function(module, exports, __webpack_require__) {
|
16287 |
-
|
16288 |
-
"use strict";
|
16289 |
-
|
16290 |
-
|
16291 |
-
Object.defineProperty(exports, "__esModule", {
|
16292 |
-
value: true
|
16293 |
-
});
|
16294 |
-
var FLOAT = exports.FLOAT = {
|
16295 |
-
NONE: 0,
|
16296 |
-
LEFT: 1,
|
16297 |
-
RIGHT: 2,
|
16298 |
-
INLINE_START: 3,
|
16299 |
-
INLINE_END: 4
|
16300 |
-
};
|
16301 |
-
|
16302 |
-
var parseCSSFloat = exports.parseCSSFloat = function parseCSSFloat(float) {
|
16303 |
-
switch (float) {
|
16304 |
-
case 'left':
|
16305 |
-
return FLOAT.LEFT;
|
16306 |
-
case 'right':
|
16307 |
-
return FLOAT.RIGHT;
|
16308 |
-
case 'inline-start':
|
16309 |
-
return FLOAT.INLINE_START;
|
16310 |
-
case 'inline-end':
|
16311 |
-
return FLOAT.INLINE_END;
|
16312 |
-
}
|
16313 |
-
return FLOAT.NONE;
|
16314 |
-
};
|
16315 |
-
|
16316 |
-
/***/ }),
|
16317 |
-
/* 36 */
|
16318 |
-
/***/ (function(module, exports, __webpack_require__) {
|
16319 |
-
|
16320 |
-
"use strict";
|
16321 |
-
|
16322 |
-
|
16323 |
-
Object.defineProperty(exports, "__esModule", {
|
16324 |
-
value: true
|
16325 |
-
});
|
16326 |
-
|
16327 |
-
|
16328 |
-
var parseFontWeight = function parseFontWeight(weight) {
|
16329 |
-
switch (weight) {
|
16330 |
-
case 'normal':
|
16331 |
-
return 400;
|
16332 |
-
case 'bold':
|
16333 |
-
return 700;
|
16334 |
-
}
|
16335 |
-
|
16336 |
-
var value = parseInt(weight, 10);
|
16337 |
-
return isNaN(value) ? 400 : value;
|
16338 |
-
};
|
16339 |
-
|
16340 |
-
var parseFont = exports.parseFont = function parseFont(style) {
|
16341 |
-
var fontFamily = style.fontFamily;
|
16342 |
-
var fontSize = style.fontSize;
|
16343 |
-
var fontStyle = style.fontStyle;
|
16344 |
-
var fontVariant = style.fontVariant;
|
16345 |
-
var fontWeight = parseFontWeight(style.fontWeight);
|
16346 |
-
|
16347 |
-
return {
|
16348 |
-
fontFamily: fontFamily,
|
16349 |
-
fontSize: fontSize,
|
16350 |
-
fontStyle: fontStyle,
|
16351 |
-
fontVariant: fontVariant,
|
16352 |
-
fontWeight: fontWeight
|
16353 |
-
};
|
16354 |
-
};
|
16355 |
-
|
16356 |
-
/***/ }),
|
16357 |
-
/* 37 */
|
16358 |
-
/***/ (function(module, exports, __webpack_require__) {
|
16359 |
-
|
16360 |
-
"use strict";
|
16361 |
-
|
16362 |
-
|
16363 |
-
Object.defineProperty(exports, "__esModule", {
|
16364 |
-
value: true
|
16365 |
-
});
|
16366 |
-
var parseLetterSpacing = exports.parseLetterSpacing = function parseLetterSpacing(letterSpacing) {
|
16367 |
-
if (letterSpacing === 'normal') {
|
16368 |
-
return 0;
|
16369 |
-
}
|
16370 |
-
var value = parseFloat(letterSpacing);
|
16371 |
-
return isNaN(value) ? 0 : value;
|
16372 |
-
};
|
16373 |
-
|
16374 |
-
/***/ }),
|
16375 |
-
/* 38 */
|
16376 |
-
/***/ (function(module, exports, __webpack_require__) {
|
16377 |
-
|
16378 |
-
"use strict";
|
16379 |
-
|
16380 |
-
|
16381 |
-
Object.defineProperty(exports, "__esModule", {
|
16382 |
-
value: true
|
16383 |
-
});
|
16384 |
-
var LINE_BREAK = exports.LINE_BREAK = {
|
16385 |
-
NORMAL: 'normal',
|
16386 |
-
STRICT: 'strict'
|
16387 |
-
};
|
16388 |
-
|
16389 |
-
var parseLineBreak = exports.parseLineBreak = function parseLineBreak(wordBreak) {
|
16390 |
-
switch (wordBreak) {
|
16391 |
-
case 'strict':
|
16392 |
-
return LINE_BREAK.STRICT;
|
16393 |
-
case 'normal':
|
16394 |
-
default:
|
16395 |
-
return LINE_BREAK.NORMAL;
|
16396 |
-
}
|
16397 |
-
};
|
16398 |
-
|
16399 |
-
/***/ }),
|
16400 |
-
/* 39 */
|
16401 |
-
/***/ (function(module, exports, __webpack_require__) {
|
16402 |
-
|
16403 |
-
"use strict";
|
16404 |
-
|
16405 |
-
|
16406 |
-
Object.defineProperty(exports, "__esModule", {
|
16407 |
-
value: true
|
16408 |
-
});
|
16409 |
-
exports.parseMargin = undefined;
|
16410 |
-
|
16411 |
-
var _Length = __webpack_require__(1);
|
16412 |
-
|
16413 |
-
var _Length2 = _interopRequireDefault(_Length);
|
16414 |
-
|
16415 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
16416 |
-
|
16417 |
-
var SIDES = ['top', 'right', 'bottom', 'left'];
|
16418 |
-
|
16419 |
-
var parseMargin = exports.parseMargin = function parseMargin(style) {
|
16420 |
-
return SIDES.map(function (side) {
|
16421 |
-
return new _Length2.default(style.getPropertyValue('margin-' + side));
|
16422 |
-
});
|
16423 |
-
};
|
16424 |
-
|
16425 |
-
/***/ }),
|
16426 |
-
/* 40 */
|
16427 |
-
/***/ (function(module, exports, __webpack_require__) {
|
16428 |
-
|
16429 |
-
"use strict";
|
16430 |
-
|
16431 |
-
|
16432 |
-
Object.defineProperty(exports, "__esModule", {
|
16433 |
-
value: true
|
16434 |
-
});
|
16435 |
-
var OVERFLOW = exports.OVERFLOW = {
|
16436 |
-
VISIBLE: 0,
|
16437 |
-
HIDDEN: 1,
|
16438 |
-
SCROLL: 2,
|
16439 |
-
AUTO: 3
|
16440 |
-
};
|
16441 |
-
|
16442 |
-
var parseOverflow = exports.parseOverflow = function parseOverflow(overflow) {
|
16443 |
-
switch (overflow) {
|
16444 |
-
case 'hidden':
|
16445 |
-
return OVERFLOW.HIDDEN;
|
16446 |
-
case 'scroll':
|
16447 |
-
return OVERFLOW.SCROLL;
|
16448 |
-
case 'auto':
|
16449 |
-
return OVERFLOW.AUTO;
|
16450 |
-
case 'visible':
|
16451 |
-
default:
|
16452 |
-
return OVERFLOW.VISIBLE;
|
16453 |
-
}
|
16454 |
-
};
|
16455 |
-
|
16456 |
-
/***/ }),
|
16457 |
-
/* 41 */
|
16458 |
-
/***/ (function(module, exports, __webpack_require__) {
|
16459 |
-
|
16460 |
-
"use strict";
|
16461 |
-
|
16462 |
-
|
16463 |
-
Object.defineProperty(exports, "__esModule", {
|
16464 |
-
value: true
|
16465 |
-
});
|
16466 |
-
exports.parseTextShadow = undefined;
|
16467 |
-
|
16468 |
-
var _Color = __webpack_require__(0);
|
16469 |
-
|
16470 |
-
var _Color2 = _interopRequireDefault(_Color);
|
16471 |
-
|
16472 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
16473 |
-
|
16474 |
-
var NUMBER = /^([+-]|\d|\.)$/i;
|
16475 |
-
|
16476 |
-
var parseTextShadow = exports.parseTextShadow = function parseTextShadow(textShadow) {
|
16477 |
-
if (textShadow === 'none' || typeof textShadow !== 'string') {
|
16478 |
-
return null;
|
16479 |
-
}
|
16480 |
-
|
16481 |
-
var currentValue = '';
|
16482 |
-
var isLength = false;
|
16483 |
-
var values = [];
|
16484 |
-
var shadows = [];
|
16485 |
-
var numParens = 0;
|
16486 |
-
var color = null;
|
16487 |
-
|
16488 |
-
var appendValue = function appendValue() {
|
16489 |
-
if (currentValue.length) {
|
16490 |
-
if (isLength) {
|
16491 |
-
values.push(parseFloat(currentValue));
|
16492 |
-
} else {
|
16493 |
-
color = new _Color2.default(currentValue);
|
16494 |
-
}
|
16495 |
-
}
|
16496 |
-
isLength = false;
|
16497 |
-
currentValue = '';
|
16498 |
-
};
|
16499 |
-
|
16500 |
-
var appendShadow = function appendShadow() {
|
16501 |
-
if (values.length && color !== null) {
|
16502 |
-
shadows.push({
|
16503 |
-
color: color,
|
16504 |
-
offsetX: values[0] || 0,
|
16505 |
-
offsetY: values[1] || 0,
|
16506 |
-
blur: values[2] || 0
|
16507 |
-
});
|
16508 |
-
}
|
16509 |
-
values.splice(0, values.length);
|
16510 |
-
color = null;
|
16511 |
-
};
|
16512 |
-
|
16513 |
-
for (var i = 0; i < textShadow.length; i++) {
|
16514 |
-
var c = textShadow[i];
|
16515 |
-
switch (c) {
|
16516 |
-
case '(':
|
16517 |
-
currentValue += c;
|
16518 |
-
numParens++;
|
16519 |
-
break;
|
16520 |
-
case ')':
|
16521 |
-
currentValue += c;
|
16522 |
-
numParens--;
|
16523 |
-
break;
|
16524 |
-
case ',':
|
16525 |
-
if (numParens === 0) {
|
16526 |
-
appendValue();
|
16527 |
-
appendShadow();
|
16528 |
-
} else {
|
16529 |
-
currentValue += c;
|
16530 |
-
}
|
16531 |
-
break;
|
16532 |
-
case ' ':
|
16533 |
-
if (numParens === 0) {
|
16534 |
-
appendValue();
|
16535 |
-
} else {
|
16536 |
-
currentValue += c;
|
16537 |
-
}
|
16538 |
-
break;
|
16539 |
-
default:
|
16540 |
-
if (currentValue.length === 0 && NUMBER.test(c)) {
|
16541 |
-
isLength = true;
|
16542 |
-
}
|
16543 |
-
currentValue += c;
|
16544 |
-
}
|
16545 |
-
}
|
16546 |
-
|
16547 |
-
appendValue();
|
16548 |
-
appendShadow();
|
16549 |
-
|
16550 |
-
if (shadows.length === 0) {
|
16551 |
-
return null;
|
16552 |
-
}
|
16553 |
-
|
16554 |
-
return shadows;
|
16555 |
-
};
|
16556 |
-
|
16557 |
-
/***/ }),
|
16558 |
-
/* 42 */
|
16559 |
-
/***/ (function(module, exports, __webpack_require__) {
|
16560 |
-
|
16561 |
-
"use strict";
|
16562 |
-
|
16563 |
-
|
16564 |
-
Object.defineProperty(exports, "__esModule", {
|
16565 |
-
value: true
|
16566 |
-
});
|
16567 |
-
exports.parseTransform = undefined;
|
16568 |
-
|
16569 |
-
var _Length = __webpack_require__(1);
|
16570 |
-
|
16571 |
-
var _Length2 = _interopRequireDefault(_Length);
|
16572 |
-
|
16573 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
16574 |
-
|
16575 |
-
var toFloat = function toFloat(s) {
|
16576 |
-
return parseFloat(s.trim());
|
16577 |
-
};
|
16578 |
-
|
16579 |
-
var MATRIX = /(matrix|matrix3d)\((.+)\)/;
|
16580 |
-
|
16581 |
-
var parseTransform = exports.parseTransform = function parseTransform(style) {
|
16582 |
-
var transform = parseTransformMatrix(style.transform || style.webkitTransform || style.mozTransform ||
|
16583 |
-
// $FlowFixMe
|
16584 |
-
style.msTransform ||
|
16585 |
-
// $FlowFixMe
|
16586 |
-
style.oTransform);
|
16587 |
-
if (transform === null) {
|
16588 |
-
return null;
|
16589 |
-
}
|
16590 |
-
|
16591 |
-
return {
|
16592 |
-
transform: transform,
|
16593 |
-
transformOrigin: parseTransformOrigin(style.transformOrigin || style.webkitTransformOrigin || style.mozTransformOrigin ||
|
16594 |
-
// $FlowFixMe
|
16595 |
-
style.msTransformOrigin ||
|
16596 |
-
// $FlowFixMe
|
16597 |
-
style.oTransformOrigin)
|
16598 |
-
};
|
16599 |
-
};
|
16600 |
-
|
16601 |
-
// $FlowFixMe
|
16602 |
-
var parseTransformOrigin = function parseTransformOrigin(origin) {
|
16603 |
-
if (typeof origin !== 'string') {
|
16604 |
-
var v = new _Length2.default('0');
|
16605 |
-
return [v, v];
|
16606 |
-
}
|
16607 |
-
var values = origin.split(' ').map(_Length2.default.create);
|
16608 |
-
return [values[0], values[1]];
|
16609 |
-
};
|
16610 |
-
|
16611 |
-
// $FlowFixMe
|
16612 |
-
var parseTransformMatrix = function parseTransformMatrix(transform) {
|
16613 |
-
if (transform === 'none' || typeof transform !== 'string') {
|
16614 |
-
return null;
|
16615 |
-
}
|
16616 |
-
|
16617 |
-
var match = transform.match(MATRIX);
|
16618 |
-
if (match) {
|
16619 |
-
if (match[1] === 'matrix') {
|
16620 |
-
var matrix = match[2].split(',').map(toFloat);
|
16621 |
-
return [matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]];
|
16622 |
-
} else {
|
16623 |
-
var matrix3d = match[2].split(',').map(toFloat);
|
16624 |
-
return [matrix3d[0], matrix3d[1], matrix3d[4], matrix3d[5], matrix3d[12], matrix3d[13]];
|
16625 |
-
}
|
16626 |
-
}
|
16627 |
-
return null;
|
16628 |
-
};
|
16629 |
-
|
16630 |
-
/***/ }),
|
16631 |
-
/* 43 */
|
16632 |
-
/***/ (function(module, exports, __webpack_require__) {
|
16633 |
-
|
16634 |
-
"use strict";
|
16635 |
-
|
16636 |
-
|
16637 |
-
Object.defineProperty(exports, "__esModule", {
|
16638 |
-
value: true
|
16639 |
-
});
|
16640 |
-
var VISIBILITY = exports.VISIBILITY = {
|
16641 |
-
VISIBLE: 0,
|
16642 |
-
HIDDEN: 1,
|
16643 |
-
COLLAPSE: 2
|
16644 |
-
};
|
16645 |
-
|
16646 |
-
var parseVisibility = exports.parseVisibility = function parseVisibility(visibility) {
|
16647 |
-
switch (visibility) {
|
16648 |
-
case 'hidden':
|
16649 |
-
return VISIBILITY.HIDDEN;
|
16650 |
-
case 'collapse':
|
16651 |
-
return VISIBILITY.COLLAPSE;
|
16652 |
-
case 'visible':
|
16653 |
-
default:
|
16654 |
-
return VISIBILITY.VISIBLE;
|
16655 |
-
}
|
16656 |
-
};
|
16657 |
-
|
16658 |
-
/***/ }),
|
16659 |
-
/* 44 */
|
16660 |
-
/***/ (function(module, exports, __webpack_require__) {
|
16661 |
-
|
16662 |
-
"use strict";
|
16663 |
-
|
16664 |
-
|
16665 |
-
Object.defineProperty(exports, "__esModule", {
|
16666 |
-
value: true
|
16667 |
-
});
|
16668 |
-
var WORD_BREAK = exports.WORD_BREAK = {
|
16669 |
-
NORMAL: 'normal',
|
16670 |
-
BREAK_ALL: 'break-all',
|
16671 |
-
KEEP_ALL: 'keep-all'
|
16672 |
-
};
|
16673 |
-
|
16674 |
-
var parseWordBreak = exports.parseWordBreak = function parseWordBreak(wordBreak) {
|
16675 |
-
switch (wordBreak) {
|
16676 |
-
case 'break-all':
|
16677 |
-
return WORD_BREAK.BREAK_ALL;
|
16678 |
-
case 'keep-all':
|
16679 |
-
return WORD_BREAK.KEEP_ALL;
|
16680 |
-
case 'normal':
|
16681 |
-
default:
|
16682 |
-
return WORD_BREAK.NORMAL;
|
16683 |
-
}
|
16684 |
-
};
|
16685 |
-
|
16686 |
-
/***/ }),
|
16687 |
-
/* 45 */
|
16688 |
-
/***/ (function(module, exports, __webpack_require__) {
|
16689 |
-
|
16690 |
-
"use strict";
|
16691 |
-
|
16692 |
-
|
16693 |
-
Object.defineProperty(exports, "__esModule", {
|
16694 |
-
value: true
|
16695 |
-
});
|
16696 |
-
var parseZIndex = exports.parseZIndex = function parseZIndex(zIndex) {
|
16697 |
-
var auto = zIndex === 'auto';
|
16698 |
-
return {
|
16699 |
-
auto: auto,
|
16700 |
-
order: auto ? 0 : parseInt(zIndex, 10)
|
16701 |
-
};
|
16702 |
-
};
|
16703 |
-
|
16704 |
-
/***/ }),
|
16705 |
-
/* 46 */
|
16706 |
-
/***/ (function(module, exports, __webpack_require__) {
|
16707 |
-
|
16708 |
-
"use strict";
|
16709 |
-
|
16710 |
-
|
16711 |
-
Object.defineProperty(exports, "__esModule", {
|
16712 |
-
value: true
|
16713 |
-
});
|
16714 |
-
|
16715 |
-
var _Util = __webpack_require__(13);
|
16716 |
-
|
16717 |
-
Object.defineProperty(exports, 'toCodePoints', {
|
16718 |
-
enumerable: true,
|
16719 |
-
get: function get() {
|
16720 |
-
return _Util.toCodePoints;
|
16721 |
-
}
|
16722 |
-
});
|
16723 |
-
Object.defineProperty(exports, 'fromCodePoint', {
|
16724 |
-
enumerable: true,
|
16725 |
-
get: function get() {
|
16726 |
-
return _Util.fromCodePoint;
|
16727 |
-
}
|
16728 |
-
});
|
16729 |
-
|
16730 |
-
var _LineBreak = __webpack_require__(47);
|
16731 |
-
|
16732 |
-
Object.defineProperty(exports, 'LineBreaker', {
|
16733 |
-
enumerable: true,
|
16734 |
-
get: function get() {
|
16735 |
-
return _LineBreak.LineBreaker;
|
16736 |
-
}
|
16737 |
-
});
|
16738 |
-
|
16739 |
-
/***/ }),
|
16740 |
-
/* 47 */
|
16741 |
-
/***/ (function(module, exports, __webpack_require__) {
|
16742 |
-
|
16743 |
-
"use strict";
|
16744 |
-
|
16745 |
-
|
16746 |
-
Object.defineProperty(exports, "__esModule", {
|
16747 |
-
value: true
|
16748 |
-
});
|
16749 |
-
exports.LineBreaker = exports.inlineBreakOpportunities = exports.lineBreakAtIndex = exports.codePointsToCharacterClasses = exports.UnicodeTrie = exports.BREAK_ALLOWED = exports.BREAK_NOT_ALLOWED = exports.BREAK_MANDATORY = exports.classes = exports.LETTER_NUMBER_MODIFIER = undefined;
|
16750 |
-
|
16751 |
-
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
16752 |
-
|
16753 |
-
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
|
16754 |
-
|
16755 |
-
var _Trie = __webpack_require__(48);
|
16756 |
-
|
16757 |
-
var _linebreakTrie = __webpack_require__(49);
|
16758 |
-
|
16759 |
-
var _linebreakTrie2 = _interopRequireDefault(_linebreakTrie);
|
16760 |
-
|
16761 |
-
var _Util = __webpack_require__(13);
|
16762 |
-
|
16763 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
16764 |
-
|
16765 |
-
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
|
16766 |
-
|
16767 |
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
16768 |
-
|
16769 |
-
var LETTER_NUMBER_MODIFIER = exports.LETTER_NUMBER_MODIFIER = 50;
|
16770 |
-
|
16771 |
-
// Non-tailorable Line Breaking Classes
|
16772 |
-
var BK = 1; // Cause a line break (after)
|
16773 |
-
var CR = 2; // Cause a line break (after), except between CR and LF
|
16774 |
-
var LF = 3; // Cause a line break (after)
|
16775 |
-
var CM = 4; // Prohibit a line break between the character and the preceding character
|
16776 |
-
var NL = 5; // Cause a line break (after)
|
16777 |
-
var SG = 6; // Do not occur in well-formed text
|
16778 |
-
var WJ = 7; // Prohibit line breaks before and after
|
16779 |
-
var ZW = 8; // Provide a break opportunity
|
16780 |
-
var GL = 9; // Prohibit line breaks before and after
|
16781 |
-
var SP = 10; // Enable indirect line breaks
|
16782 |
-
var ZWJ = 11; // Prohibit line breaks within joiner sequences
|
16783 |
-
// Break Opportunities
|
16784 |
-
var B2 = 12; // Provide a line break opportunity before and after the character
|
16785 |
-
var BA = 13; // Generally provide a line break opportunity after the character
|
16786 |
-
var BB = 14; // Generally provide a line break opportunity before the character
|
16787 |
-
var HY = 15; // Provide a line break opportunity after the character, except in numeric context
|
16788 |
-
var CB = 16; // Provide a line break opportunity contingent on additional information
|
16789 |
-
// Characters Prohibiting Certain Breaks
|
16790 |
-
var CL = 17; // Prohibit line breaks before
|
16791 |
-
var CP = 18; // Prohibit line breaks before
|
16792 |
-
var EX = 19; // Prohibit line breaks before
|
16793 |
-
var IN = 20; // Allow only indirect line breaks between pairs
|
16794 |
-
var NS = 21; // Allow only indirect line breaks before
|
16795 |
-
var OP = 22; // Prohibit line breaks after
|
16796 |
-
var QU = 23; // Act like they are both opening and closing
|
16797 |
-
// Numeric Context
|
16798 |
-
var IS = 24; // Prevent breaks after any and before numeric
|
16799 |
-
var NU = 25; // Form numeric expressions for line breaking purposes
|
16800 |
-
var PO = 26; // Do not break following a numeric expression
|
16801 |
-
var PR = 27; // Do not break in front of a numeric expression
|
16802 |
-
var SY = 28; // Prevent a break before; and allow a break after
|
16803 |
-
// Other Characters
|
16804 |
-
var AI = 29; // Act like AL when the resolvedEAW is N; otherwise; act as ID
|
16805 |
-
var AL = 30; // Are alphabetic characters or symbols that are used with alphabetic characters
|
16806 |
-
var CJ = 31; // Treat as NS or ID for strict or normal breaking.
|
16807 |
-
var EB = 32; // Do not break from following Emoji Modifier
|
16808 |
-
var EM = 33; // Do not break from preceding Emoji Base
|
16809 |
-
var H2 = 34; // Form Korean syllable blocks
|
16810 |
-
var H3 = 35; // Form Korean syllable blocks
|
16811 |
-
var HL = 36; // Do not break around a following hyphen; otherwise act as Alphabetic
|
16812 |
-
var ID = 37; // Break before or after; except in some numeric context
|
16813 |
-
var JL = 38; // Form Korean syllable blocks
|
16814 |
-
var JV = 39; // Form Korean syllable blocks
|
16815 |
-
var JT = 40; // Form Korean syllable blocks
|
16816 |
-
var RI = 41; // Keep pairs together. For pairs; break before and after other classes
|
16817 |
-
var SA = 42; // Provide a line break opportunity contingent on additional, language-specific context analysis
|
16818 |
-
var XX = 43; // Have as yet unknown line breaking behavior or unassigned code positions
|
16819 |
-
|
16820 |
-
var classes = exports.classes = {
|
16821 |
-
BK: BK,
|
16822 |
-
CR: CR,
|
16823 |
-
LF: LF,
|
16824 |
-
CM: CM,
|
16825 |
-
NL: NL,
|
16826 |
-
SG: SG,
|
16827 |
-
WJ: WJ,
|
16828 |
-
ZW: ZW,
|
16829 |
-
GL: GL,
|
16830 |
-
SP: SP,
|
16831 |
-
ZWJ: ZWJ,
|
16832 |
-
B2: B2,
|
16833 |
-
BA: BA,
|
16834 |
-
BB: BB,
|
16835 |
-
HY: HY,
|
16836 |
-
CB: CB,
|
16837 |
-
CL: CL,
|
16838 |
-
CP: CP,
|
16839 |
-
EX: EX,
|
16840 |
-
IN: IN,
|
16841 |
-
NS: NS,
|
16842 |
-
OP: OP,
|
16843 |
-
QU: QU,
|
16844 |
-
IS: IS,
|
16845 |
-
NU: NU,
|
16846 |
-
PO: PO,
|
16847 |
-
PR: PR,
|
16848 |
-
SY: SY,
|
16849 |
-
AI: AI,
|
16850 |
-
AL: AL,
|
16851 |
-
CJ: CJ,
|
16852 |
-
EB: EB,
|
16853 |
-
EM: EM,
|
16854 |
-
H2: H2,
|
16855 |
-
H3: H3,
|
16856 |
-
HL: HL,
|
16857 |
-
ID: ID,
|
16858 |
-
JL: JL,
|
16859 |
-
JV: JV,
|
16860 |
-
JT: JT,
|
16861 |
-
RI: RI,
|
16862 |
-
SA: SA,
|
16863 |
-
XX: XX
|
16864 |
-
};
|
16865 |
-
|
16866 |
-
var BREAK_MANDATORY = exports.BREAK_MANDATORY = '!';
|
16867 |
-
var BREAK_NOT_ALLOWED = exports.BREAK_NOT_ALLOWED = '×';
|
16868 |
-
var BREAK_ALLOWED = exports.BREAK_ALLOWED = '÷';
|
16869 |
-
var UnicodeTrie = exports.UnicodeTrie = (0, _Trie.createTrieFromBase64)(_linebreakTrie2.default);
|
16870 |
-
|
16871 |
-
var ALPHABETICS = [AL, HL];
|
16872 |
-
var HARD_LINE_BREAKS = [BK, CR, LF, NL];
|
16873 |
-
var SPACE = [SP, ZW];
|
16874 |
-
var PREFIX_POSTFIX = [PR, PO];
|
16875 |
-
var LINE_BREAKS = HARD_LINE_BREAKS.concat(SPACE);
|
16876 |
-
var KOREAN_SYLLABLE_BLOCK = [JL, JV, JT, H2, H3];
|
16877 |
-
var HYPHEN = [HY, BA];
|
16878 |
-
|
16879 |
-
var codePointsToCharacterClasses = exports.codePointsToCharacterClasses = function codePointsToCharacterClasses(codePoints) {
|
16880 |
-
var lineBreak = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'strict';
|
16881 |
-
|
16882 |
-
var types = [];
|
16883 |
-
var indicies = [];
|
16884 |
-
var categories = [];
|
16885 |
-
codePoints.forEach(function (codePoint, index) {
|
16886 |
-
var classType = UnicodeTrie.get(codePoint);
|
16887 |
-
if (classType > LETTER_NUMBER_MODIFIER) {
|
16888 |
-
categories.push(true);
|
16889 |
-
classType -= LETTER_NUMBER_MODIFIER;
|
16890 |
-
} else {
|
16891 |
-
categories.push(false);
|
16892 |
-
}
|
16893 |
-
|
16894 |
-
if (['normal', 'auto', 'loose'].indexOf(lineBreak) !== -1) {
|
16895 |
-
// U+2010, – U+2013, 〜 U+301C, ゠ U+30A0
|
16896 |
-
if ([0x2010, 0x2013, 0x301c, 0x30a0].indexOf(codePoint) !== -1) {
|
16897 |
-
indicies.push(index);
|
16898 |
-
return types.push(CB);
|
16899 |
-
}
|
16900 |
-
}
|
16901 |
-
|
16902 |
-
if (classType === CM || classType === ZWJ) {
|
16903 |
-
// LB10 Treat any remaining combining mark or ZWJ as AL.
|
16904 |
-
if (index === 0) {
|
16905 |
-
indicies.push(index);
|
16906 |
-
return types.push(AL);
|
16907 |
-
}
|
16908 |
-
|
16909 |
-
// LB9 Do not break a combining character sequence; treat it as if it has the line breaking class of
|
16910 |
-
// the base character in all of the following rules. Treat ZWJ as if it were CM.
|
16911 |
-
var prev = types[index - 1];
|
16912 |
-
if (LINE_BREAKS.indexOf(prev) === -1) {
|
16913 |
-
indicies.push(indicies[index - 1]);
|
16914 |
-
return types.push(prev);
|
16915 |
-
}
|
16916 |
-
indicies.push(index);
|
16917 |
-
return types.push(AL);
|
16918 |
-
}
|
16919 |
-
|
16920 |
-
indicies.push(index);
|
16921 |
-
|
16922 |
-
if (classType === CJ) {
|
16923 |
-
return types.push(lineBreak === 'strict' ? NS : ID);
|
16924 |
-
}
|
16925 |
-
|
16926 |
-
if (classType === SA) {
|
16927 |
-
return types.push(AL);
|
16928 |
-
}
|
16929 |
-
|
16930 |
-
if (classType === AI) {
|
16931 |
-
return types.push(AL);
|
16932 |
-
}
|
16933 |
-
|
16934 |
-
// For supplementary characters, a useful default is to treat characters in the range 10000..1FFFD as AL
|
16935 |
-
// and characters in the ranges 20000..2FFFD and 30000..3FFFD as ID, until the implementation can be revised
|
16936 |
-
// to take into account the actual line breaking properties for these characters.
|
16937 |
-
if (classType === XX) {
|
16938 |
-
if (codePoint >= 0x20000 && codePoint <= 0x2fffd || codePoint >= 0x30000 && codePoint <= 0x3fffd) {
|
16939 |
-
return types.push(ID);
|
16940 |
-
} else {
|
16941 |
-
return types.push(AL);
|
16942 |
-
}
|
16943 |
-
}
|
16944 |
-
|
16945 |
-
types.push(classType);
|
16946 |
-
});
|
16947 |
-
|
16948 |
-
return [indicies, types, categories];
|
16949 |
-
};
|
16950 |
-
|
16951 |
-
var isAdjacentWithSpaceIgnored = function isAdjacentWithSpaceIgnored(a, b, currentIndex, classTypes) {
|
16952 |
-
var current = classTypes[currentIndex];
|
16953 |
-
if (Array.isArray(a) ? a.indexOf(current) !== -1 : a === current) {
|
16954 |
-
var i = currentIndex;
|
16955 |
-
while (i <= classTypes.length) {
|
16956 |
-
i++;
|
16957 |
-
var next = classTypes[i];
|
16958 |
-
|
16959 |
-
if (next === b) {
|
16960 |
-
return true;
|
16961 |
-
}
|
16962 |
-
|
16963 |
-
if (next !== SP) {
|
16964 |
-
break;
|
16965 |
-
}
|
16966 |
-
}
|
16967 |
-
}
|
16968 |
-
|
16969 |
-
if (current === SP) {
|
16970 |
-
var _i = currentIndex;
|
16971 |
-
|
16972 |
-
while (_i > 0) {
|
16973 |
-
_i--;
|
16974 |
-
var prev = classTypes[_i];
|
16975 |
-
|
16976 |
-
if (Array.isArray(a) ? a.indexOf(prev) !== -1 : a === prev) {
|
16977 |
-
var n = currentIndex;
|
16978 |
-
while (n <= classTypes.length) {
|
16979 |
-
n++;
|
16980 |
-
var _next = classTypes[n];
|
16981 |
-
|
16982 |
-
if (_next === b) {
|
16983 |
-
return true;
|
16984 |
-
}
|
16985 |
-
|
16986 |
-
if (_next !== SP) {
|
16987 |
-
break;
|
16988 |
-
}
|
16989 |
-
}
|
16990 |
-
}
|
16991 |
-
|
16992 |
-
if (prev !== SP) {
|
16993 |
-
break;
|
16994 |
-
}
|
16995 |
-
}
|
16996 |
-
}
|
16997 |
-
return false;
|
16998 |
-
};
|
16999 |
-
|
17000 |
-
var previousNonSpaceClassType = function previousNonSpaceClassType(currentIndex, classTypes) {
|
17001 |
-
var i = currentIndex;
|
17002 |
-
while (i >= 0) {
|
17003 |
-
var type = classTypes[i];
|
17004 |
-
if (type === SP) {
|
17005 |
-
i--;
|
17006 |
-
} else {
|
17007 |
-
return type;
|
17008 |
-
}
|
17009 |
-
}
|
17010 |
-
return 0;
|
17011 |
-
};
|
17012 |
-
|
17013 |
-
var _lineBreakAtIndex = function _lineBreakAtIndex(codePoints, classTypes, indicies, index, forbiddenBreaks) {
|
17014 |
-
if (indicies[index] === 0) {
|
17015 |
-
return BREAK_NOT_ALLOWED;
|
17016 |
-
}
|
17017 |
-
|
17018 |
-
var currentIndex = index - 1;
|
17019 |
-
if (Array.isArray(forbiddenBreaks) && forbiddenBreaks[currentIndex] === true) {
|
17020 |
-
return BREAK_NOT_ALLOWED;
|
17021 |
-
}
|
17022 |
-
|
17023 |
-
var beforeIndex = currentIndex - 1;
|
17024 |
-
var afterIndex = currentIndex + 1;
|
17025 |
-
var current = classTypes[currentIndex];
|
17026 |
-
|
17027 |
-
// LB4 Always break after hard line breaks.
|
17028 |
-
// LB5 Treat CR followed by LF, as well as CR, LF, and NL as hard line breaks.
|
17029 |
-
var before = beforeIndex >= 0 ? classTypes[beforeIndex] : 0;
|
17030 |
-
var next = classTypes[afterIndex];
|
17031 |
-
|
17032 |
-
if (current === CR && next === LF) {
|
17033 |
-
return BREAK_NOT_ALLOWED;
|
17034 |
-
}
|
17035 |
-
|
17036 |
-
if (HARD_LINE_BREAKS.indexOf(current) !== -1) {
|
17037 |
-
return BREAK_MANDATORY;
|
17038 |
-
}
|
17039 |
-
|
17040 |
-
// LB6 Do not break before hard line breaks.
|
17041 |
-
if (HARD_LINE_BREAKS.indexOf(next) !== -1) {
|
17042 |
-
return BREAK_NOT_ALLOWED;
|
17043 |
-
}
|
17044 |
-
|
17045 |
-
// LB7 Do not break before spaces or zero width space.
|
17046 |
-
if (SPACE.indexOf(next) !== -1) {
|
17047 |
-
return BREAK_NOT_ALLOWED;
|
17048 |
-
}
|
17049 |
-
|
17050 |
-
// LB8 Break before any character following a zero-width space, even if one or more spaces intervene.
|
17051 |
-
if (previousNonSpaceClassType(currentIndex, classTypes) === ZW) {
|
17052 |
-
return BREAK_ALLOWED;
|
17053 |
-
}
|
17054 |
-
|
17055 |
-
// LB8a Do not break between a zero width joiner and an ideograph, emoji base or emoji modifier.
|
17056 |
-
if (UnicodeTrie.get(codePoints[currentIndex]) === ZWJ && (next === ID || next === EB || next === EM)) {
|
17057 |
-
return BREAK_NOT_ALLOWED;
|
17058 |
-
}
|
17059 |
-
|
17060 |
-
// LB11 Do not break before or after Word joiner and related characters.
|
17061 |
-
if (current === WJ || next === WJ) {
|
17062 |
-
return BREAK_NOT_ALLOWED;
|
17063 |
-
}
|
17064 |
-
|
17065 |
-
// LB12 Do not break after NBSP and related characters.
|
17066 |
-
if (current === GL) {
|
17067 |
-
return BREAK_NOT_ALLOWED;
|
17068 |
-
}
|
17069 |
-
|
17070 |
-
// LB12a Do not break before NBSP and related characters, except after spaces and hyphens.
|
17071 |
-
if ([SP, BA, HY].indexOf(current) === -1 && next === GL) {
|
17072 |
-
return BREAK_NOT_ALLOWED;
|
17073 |
-
}
|
17074 |
-
|
17075 |
-
// LB13 Do not break before ‘]’ or ‘!’ or ‘;’ or ‘/’, even after spaces.
|
17076 |
-
if ([CL, CP, EX, IS, SY].indexOf(next) !== -1) {
|
17077 |
-
return BREAK_NOT_ALLOWED;
|
17078 |
-
}
|
17079 |
-
|
17080 |
-
// LB14 Do not break after ‘[’, even after spaces.
|
17081 |
-
if (previousNonSpaceClassType(currentIndex, classTypes) === OP) {
|
17082 |
-
return BREAK_NOT_ALLOWED;
|
17083 |
-
}
|
17084 |
-
|
17085 |
-
// LB15 Do not break within ‘”[’, even with intervening spaces.
|
17086 |
-
if (isAdjacentWithSpaceIgnored(QU, OP, currentIndex, classTypes)) {
|
17087 |
-
return BREAK_NOT_ALLOWED;
|
17088 |
-
}
|
17089 |
-
|
17090 |
-
// LB16 Do not break between closing punctuation and a nonstarter (lb=NS), even with intervening spaces.
|
17091 |
-
if (isAdjacentWithSpaceIgnored([CL, CP], NS, currentIndex, classTypes)) {
|
17092 |
-
return BREAK_NOT_ALLOWED;
|
17093 |
-
}
|
17094 |
-
|
17095 |
-
// LB17 Do not break within ‘——’, even with intervening spaces.
|
17096 |
-
if (isAdjacentWithSpaceIgnored(B2, B2, currentIndex, classTypes)) {
|
17097 |
-
return BREAK_NOT_ALLOWED;
|
17098 |
-
}
|
17099 |
-
|
17100 |
-
// LB18 Break after spaces.
|
17101 |
-
if (current === SP) {
|
17102 |
-
return BREAK_ALLOWED;
|
17103 |
-
}
|
17104 |
-
|
17105 |
-
// LB19 Do not break before or after quotation marks, such as ‘ ” ’.
|
17106 |
-
if (current === QU || next === QU) {
|
17107 |
-
return BREAK_NOT_ALLOWED;
|
17108 |
-
}
|
17109 |
-
|
17110 |
-
// LB20 Break before and after unresolved CB.
|
17111 |
-
if (next === CB || current === CB) {
|
17112 |
-
return BREAK_ALLOWED;
|
17113 |
-
}
|
17114 |
-
|
17115 |
-
// LB21 Do not break before hyphen-minus, other hyphens, fixed-width spaces, small kana, and other non-starters, or after acute accents.
|
17116 |
-
if ([BA, HY, NS].indexOf(next) !== -1 || current === BB) {
|
17117 |
-
return BREAK_NOT_ALLOWED;
|
17118 |
-
}
|
17119 |
-
|
17120 |
-
// LB21a Don't break after Hebrew + Hyphen.
|
17121 |
-
if (before === HL && HYPHEN.indexOf(current) !== -1) {
|
17122 |
-
return BREAK_NOT_ALLOWED;
|
17123 |
-
}
|
17124 |
-
|
17125 |
-
// LB21b Don’t break between Solidus and Hebrew letters.
|
17126 |
-
if (current === SY && next === HL) {
|
17127 |
-
return BREAK_NOT_ALLOWED;
|
17128 |
-
}
|
17129 |
-
|
17130 |
-
// LB22 Do not break between two ellipses, or between letters, numbers or exclamations and ellipsis.
|
17131 |
-
if (next === IN && ALPHABETICS.concat(IN, EX, NU, ID, EB, EM).indexOf(current) !== -1) {
|
17132 |
-
return BREAK_NOT_ALLOWED;
|
17133 |
-
}
|
17134 |
-
|
17135 |
-
// LB23 Do not break between digits and letters.
|
17136 |
-
if (ALPHABETICS.indexOf(next) !== -1 && current === NU || ALPHABETICS.indexOf(current) !== -1 && next === NU) {
|
17137 |
-
return BREAK_NOT_ALLOWED;
|
17138 |
-
}
|
17139 |
-
|
17140 |
-
// LB23a Do not break between numeric prefixes and ideographs, or between ideographs and numeric postfixes.
|
17141 |
-
if (current === PR && [ID, EB, EM].indexOf(next) !== -1 || [ID, EB, EM].indexOf(current) !== -1 && next === PO) {
|
17142 |
-
return BREAK_NOT_ALLOWED;
|
17143 |
-
}
|
17144 |
-
|
17145 |
-
// LB24 Do not break between numeric prefix/postfix and letters, or between letters and prefix/postfix.
|
17146 |
-
if (ALPHABETICS.indexOf(current) !== -1 && PREFIX_POSTFIX.indexOf(next) !== -1 || PREFIX_POSTFIX.indexOf(current) !== -1 && ALPHABETICS.indexOf(next) !== -1) {
|
17147 |
-
return BREAK_NOT_ALLOWED;
|
17148 |
-
}
|
17149 |
-
|
17150 |
-
// LB25 Do not break between the following pairs of classes relevant to numbers:
|
17151 |
-
if (
|
17152 |
-
// (PR | PO) × ( OP | HY )? NU
|
17153 |
-
[PR, PO].indexOf(current) !== -1 && (next === NU || [OP, HY].indexOf(next) !== -1 && classTypes[afterIndex + 1] === NU) ||
|
17154 |
-
// ( OP | HY ) × NU
|
17155 |
-
[OP, HY].indexOf(current) !== -1 && next === NU ||
|
17156 |
-
// NU × (NU | SY | IS)
|
17157 |
-
current === NU && [NU, SY, IS].indexOf(next) !== -1) {
|
17158 |
-
return BREAK_NOT_ALLOWED;
|
17159 |
-
}
|
17160 |
-
|
17161 |
-
// NU (NU | SY | IS)* × (NU | SY | IS | CL | CP)
|
17162 |
-
if ([NU, SY, IS, CL, CP].indexOf(next) !== -1) {
|
17163 |
-
var prevIndex = currentIndex;
|
17164 |
-
while (prevIndex >= 0) {
|
17165 |
-
var type = classTypes[prevIndex];
|
17166 |
-
if (type === NU) {
|
17167 |
-
return BREAK_NOT_ALLOWED;
|
17168 |
-
} else if ([SY, IS].indexOf(type) !== -1) {
|
17169 |
-
prevIndex--;
|
17170 |
-
} else {
|
17171 |
-
break;
|
17172 |
-
}
|
17173 |
-
}
|
17174 |
-
}
|
17175 |
-
|
17176 |
-
// NU (NU | SY | IS)* (CL | CP)? × (PO | PR))
|
17177 |
-
if ([PR, PO].indexOf(next) !== -1) {
|
17178 |
-
var _prevIndex = [CL, CP].indexOf(current) !== -1 ? beforeIndex : currentIndex;
|
17179 |
-
while (_prevIndex >= 0) {
|
17180 |
-
var _type = classTypes[_prevIndex];
|
17181 |
-
if (_type === NU) {
|
17182 |
-
return BREAK_NOT_ALLOWED;
|
17183 |
-
} else if ([SY, IS].indexOf(_type) !== -1) {
|
17184 |
-
_prevIndex--;
|
17185 |
-
} else {
|
17186 |
-
break;
|
17187 |
-
}
|
17188 |
-
}
|
17189 |
-
}
|
17190 |
-
|
17191 |
-
// LB26 Do not break a Korean syllable.
|
17192 |
-
if (JL === current && [JL, JV, H2, H3].indexOf(next) !== -1 || [JV, H2].indexOf(current) !== -1 && [JV, JT].indexOf(next) !== -1 || [JT, H3].indexOf(current) !== -1 && next === JT) {
|
17193 |
-
return BREAK_NOT_ALLOWED;
|
17194 |
-
}
|
17195 |
-
|
17196 |
-
// LB27 Treat a Korean Syllable Block the same as ID.
|
17197 |
-
if (KOREAN_SYLLABLE_BLOCK.indexOf(current) !== -1 && [IN, PO].indexOf(next) !== -1 || KOREAN_SYLLABLE_BLOCK.indexOf(next) !== -1 && current === PR) {
|
17198 |
-
return BREAK_NOT_ALLOWED;
|
17199 |
-
}
|
17200 |
-
|
17201 |
-
// LB28 Do not break between alphabetics (“at”).
|
17202 |
-
if (ALPHABETICS.indexOf(current) !== -1 && ALPHABETICS.indexOf(next) !== -1) {
|
17203 |
-
return BREAK_NOT_ALLOWED;
|
17204 |
-
}
|
17205 |
-
|
17206 |
-
// LB29 Do not break between numeric punctuation and alphabetics (“e.g.”).
|
17207 |
-
if (current === IS && ALPHABETICS.indexOf(next) !== -1) {
|
17208 |
-
return BREAK_NOT_ALLOWED;
|
17209 |
-
}
|
17210 |
-
|
17211 |
-
// LB30 Do not break between letters, numbers, or ordinary symbols and opening or closing parentheses.
|
17212 |
-
if (ALPHABETICS.concat(NU).indexOf(current) !== -1 && next === OP || ALPHABETICS.concat(NU).indexOf(next) !== -1 && current === CP) {
|
17213 |
-
return BREAK_NOT_ALLOWED;
|
17214 |
-
}
|
17215 |
-
|
17216 |
-
// LB30a Break between two regional indicator symbols if and only if there are an even number of regional
|
17217 |
-
// indicators preceding the position of the break.
|
17218 |
-
if (current === RI && next === RI) {
|
17219 |
-
var i = indicies[currentIndex];
|
17220 |
-
var count = 1;
|
17221 |
-
while (i > 0) {
|
17222 |
-
i--;
|
17223 |
-
if (classTypes[i] === RI) {
|
17224 |
-
count++;
|
17225 |
-
} else {
|
17226 |
-
break;
|
17227 |
-
}
|
17228 |
-
}
|
17229 |
-
if (count % 2 !== 0) {
|
17230 |
-
return BREAK_NOT_ALLOWED;
|
17231 |
-
}
|
17232 |
-
}
|
17233 |
-
|
17234 |
-
// LB30b Do not break between an emoji base and an emoji modifier.
|
17235 |
-
if (current === EB && next === EM) {
|
17236 |
-
return BREAK_NOT_ALLOWED;
|
17237 |
-
}
|
17238 |
-
|
17239 |
-
return BREAK_ALLOWED;
|
17240 |
-
};
|
17241 |
-
|
17242 |
-
var lineBreakAtIndex = exports.lineBreakAtIndex = function lineBreakAtIndex(codePoints, index) {
|
17243 |
-
// LB2 Never break at the start of text.
|
17244 |
-
if (index === 0) {
|
17245 |
-
return BREAK_NOT_ALLOWED;
|
17246 |
-
}
|
17247 |
-
|
17248 |
-
// LB3 Always break at the end of text.
|
17249 |
-
if (index >= codePoints.length) {
|
17250 |
-
return BREAK_MANDATORY;
|
17251 |
-
}
|
17252 |
-
|
17253 |
-
var _codePointsToCharacte = codePointsToCharacterClasses(codePoints),
|
17254 |
-
_codePointsToCharacte2 = _slicedToArray(_codePointsToCharacte, 2),
|
17255 |
-
indicies = _codePointsToCharacte2[0],
|
17256 |
-
classTypes = _codePointsToCharacte2[1];
|
17257 |
-
|
17258 |
-
return _lineBreakAtIndex(codePoints, classTypes, indicies, index);
|
17259 |
-
};
|
17260 |
-
|
17261 |
-
var cssFormattedClasses = function cssFormattedClasses(codePoints, options) {
|
17262 |
-
if (!options) {
|
17263 |
-
options = { lineBreak: 'normal', wordBreak: 'normal' };
|
17264 |
-
}
|
17265 |
-
|
17266 |
-
var _codePointsToCharacte3 = codePointsToCharacterClasses(codePoints, options.lineBreak),
|
17267 |
-
_codePointsToCharacte4 = _slicedToArray(_codePointsToCharacte3, 3),
|
17268 |
-
indicies = _codePointsToCharacte4[0],
|
17269 |
-
classTypes = _codePointsToCharacte4[1],
|
17270 |
-
isLetterNumber = _codePointsToCharacte4[2];
|
17271 |
-
|
17272 |
-
if (options.wordBreak === 'break-all' || options.wordBreak === 'break-word') {
|
17273 |
-
classTypes = classTypes.map(function (type) {
|
17274 |
-
return [NU, AL, SA].indexOf(type) !== -1 ? ID : type;
|
17275 |
-
});
|
17276 |
-
}
|
17277 |
-
|
17278 |
-
var forbiddenBreakpoints = options.wordBreak === 'keep-all' ? isLetterNumber.map(function (isLetterNumber, i) {
|
17279 |
-
return isLetterNumber && codePoints[i] >= 0x4e00 && codePoints[i] <= 0x9fff;
|
17280 |
-
}) : null;
|
17281 |
-
|
17282 |
-
return [indicies, classTypes, forbiddenBreakpoints];
|
17283 |
-
};
|
17284 |
-
|
17285 |
-
var inlineBreakOpportunities = exports.inlineBreakOpportunities = function inlineBreakOpportunities(str, options) {
|
17286 |
-
var codePoints = (0, _Util.toCodePoints)(str);
|
17287 |
-
var output = BREAK_NOT_ALLOWED;
|
17288 |
-
|
17289 |
-
var _cssFormattedClasses = cssFormattedClasses(codePoints, options),
|
17290 |
-
_cssFormattedClasses2 = _slicedToArray(_cssFormattedClasses, 3),
|
17291 |
-
indicies = _cssFormattedClasses2[0],
|
17292 |
-
classTypes = _cssFormattedClasses2[1],
|
17293 |
-
forbiddenBreakpoints = _cssFormattedClasses2[2];
|
17294 |
-
|
17295 |
-
codePoints.forEach(function (codePoint, i) {
|
17296 |
-
output += (0, _Util.fromCodePoint)(codePoint) + (i >= codePoints.length - 1 ? BREAK_MANDATORY : _lineBreakAtIndex(codePoints, classTypes, indicies, i + 1, forbiddenBreakpoints));
|
17297 |
-
});
|
17298 |
-
|
17299 |
-
return output;
|
17300 |
-
};
|
17301 |
-
|
17302 |
-
var Break = function () {
|
17303 |
-
function Break(codePoints, lineBreak, start, end) {
|
17304 |
-
_classCallCheck(this, Break);
|
17305 |
-
|
17306 |
-
this._codePoints = codePoints;
|
17307 |
-
this.required = lineBreak === BREAK_MANDATORY;
|
17308 |
-
this.start = start;
|
17309 |
-
this.end = end;
|
17310 |
-
}
|
17311 |
-
|
17312 |
-
_createClass(Break, [{
|
17313 |
-
key: 'slice',
|
17314 |
-
value: function slice() {
|
17315 |
-
return _Util.fromCodePoint.apply(undefined, _toConsumableArray(this._codePoints.slice(this.start, this.end)));
|
17316 |
-
}
|
17317 |
-
}]);
|
17318 |
-
|
17319 |
-
return Break;
|
17320 |
-
}();
|
17321 |
-
|
17322 |
-
var LineBreaker = exports.LineBreaker = function LineBreaker(str, options) {
|
17323 |
-
var codePoints = (0, _Util.toCodePoints)(str);
|
17324 |
-
|
17325 |
-
var _cssFormattedClasses3 = cssFormattedClasses(codePoints, options),
|
17326 |
-
_cssFormattedClasses4 = _slicedToArray(_cssFormattedClasses3, 3),
|
17327 |
-
indicies = _cssFormattedClasses4[0],
|
17328 |
-
classTypes = _cssFormattedClasses4[1],
|
17329 |
-
forbiddenBreakpoints = _cssFormattedClasses4[2];
|
17330 |
-
|
17331 |
-
var length = codePoints.length;
|
17332 |
-
var lastEnd = 0;
|
17333 |
-
var nextIndex = 0;
|
17334 |
-
|
17335 |
-
return {
|
17336 |
-
next: function next() {
|
17337 |
-
if (nextIndex >= length) {
|
17338 |
-
return { done: true };
|
17339 |
-
}
|
17340 |
-
var lineBreak = BREAK_NOT_ALLOWED;
|
17341 |
-
while (nextIndex < length && (lineBreak = _lineBreakAtIndex(codePoints, classTypes, indicies, ++nextIndex, forbiddenBreakpoints)) === BREAK_NOT_ALLOWED) {}
|
17342 |
-
|
17343 |
-
if (lineBreak !== BREAK_NOT_ALLOWED || nextIndex === length) {
|
17344 |
-
var value = new Break(codePoints, lineBreak, lastEnd, nextIndex);
|
17345 |
-
lastEnd = nextIndex;
|
17346 |
-
return { value: value, done: false };
|
17347 |
-
}
|
17348 |
-
|
17349 |
-
return { done: true };
|
17350 |
-
}
|
17351 |
-
};
|
17352 |
-
};
|
17353 |
-
|
17354 |
-
/***/ }),
|
17355 |
-
/* 48 */
|
17356 |
-
/***/ (function(module, exports, __webpack_require__) {
|
17357 |
-
|
17358 |
-
"use strict";
|
17359 |
-
|
17360 |
-
|
17361 |
-
Object.defineProperty(exports, "__esModule", {
|
17362 |
-
value: true
|
17363 |
-
});
|
17364 |
-
exports.Trie = exports.createTrieFromBase64 = exports.UTRIE2_INDEX_2_MASK = exports.UTRIE2_INDEX_2_BLOCK_LENGTH = exports.UTRIE2_OMITTED_BMP_INDEX_1_LENGTH = exports.UTRIE2_INDEX_1_OFFSET = exports.UTRIE2_UTF8_2B_INDEX_2_LENGTH = exports.UTRIE2_UTF8_2B_INDEX_2_OFFSET = exports.UTRIE2_INDEX_2_BMP_LENGTH = exports.UTRIE2_LSCP_INDEX_2_LENGTH = exports.UTRIE2_DATA_MASK = exports.UTRIE2_DATA_BLOCK_LENGTH = exports.UTRIE2_LSCP_INDEX_2_OFFSET = exports.UTRIE2_SHIFT_1_2 = exports.UTRIE2_INDEX_SHIFT = exports.UTRIE2_SHIFT_1 = exports.UTRIE2_SHIFT_2 = undefined;
|
17365 |
-
|
17366 |
-
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
17367 |
-
|
17368 |
-
var _Util = __webpack_require__(13);
|
17369 |
-
|
17370 |
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
17371 |
-
|
17372 |
-
/** Shift size for getting the index-2 table offset. */
|
17373 |
-
var UTRIE2_SHIFT_2 = exports.UTRIE2_SHIFT_2 = 5;
|
17374 |
-
|
17375 |
-
/** Shift size for getting the index-1 table offset. */
|
17376 |
-
var UTRIE2_SHIFT_1 = exports.UTRIE2_SHIFT_1 = 6 + 5;
|
17377 |
-
|
17378 |
-
/**
|
17379 |
-
* Shift size for shifting left the index array values.
|
17380 |
-
* Increases possible data size with 16-bit index values at the cost
|
17381 |
-
* of compactability.
|
17382 |
-
* This requires data blocks to be aligned by UTRIE2_DATA_GRANULARITY.
|
17383 |
-
*/
|
17384 |
-
var UTRIE2_INDEX_SHIFT = exports.UTRIE2_INDEX_SHIFT = 2;
|
17385 |
-
|
17386 |
-
/**
|
17387 |
-
* Difference between the two shift sizes,
|
17388 |
-
* for getting an index-1 offset from an index-2 offset. 6=11-5
|
17389 |
-
*/
|
17390 |
-
var UTRIE2_SHIFT_1_2 = exports.UTRIE2_SHIFT_1_2 = UTRIE2_SHIFT_1 - UTRIE2_SHIFT_2;
|
17391 |
-
|
17392 |
-
/**
|
17393 |
-
* The part of the index-2 table for U+D800..U+DBFF stores values for
|
17394 |
-
* lead surrogate code _units_ not code _points_.
|
17395 |
-
* Values for lead surrogate code _points_ are indexed with this portion of the table.
|
17396 |
-
* Length=32=0x20=0x400>>UTRIE2_SHIFT_2. (There are 1024=0x400 lead surrogates.)
|
17397 |
-
*/
|
17398 |
-
var UTRIE2_LSCP_INDEX_2_OFFSET = exports.UTRIE2_LSCP_INDEX_2_OFFSET = 0x10000 >> UTRIE2_SHIFT_2;
|
17399 |
-
|
17400 |
-
/** Number of entries in a data block. 32=0x20 */
|
17401 |
-
var UTRIE2_DATA_BLOCK_LENGTH = exports.UTRIE2_DATA_BLOCK_LENGTH = 1 << UTRIE2_SHIFT_2;
|
17402 |
-
/** Mask for getting the lower bits for the in-data-block offset. */
|
17403 |
-
var UTRIE2_DATA_MASK = exports.UTRIE2_DATA_MASK = UTRIE2_DATA_BLOCK_LENGTH - 1;
|
17404 |
-
|
17405 |
-
var UTRIE2_LSCP_INDEX_2_LENGTH = exports.UTRIE2_LSCP_INDEX_2_LENGTH = 0x400 >> UTRIE2_SHIFT_2;
|
17406 |
-
/** Count the lengths of both BMP pieces. 2080=0x820 */
|
17407 |
-
var UTRIE2_INDEX_2_BMP_LENGTH = exports.UTRIE2_INDEX_2_BMP_LENGTH = UTRIE2_LSCP_INDEX_2_OFFSET + UTRIE2_LSCP_INDEX_2_LENGTH;
|
17408 |
-
/**
|
17409 |
-
* The 2-byte UTF-8 version of the index-2 table follows at offset 2080=0x820.
|
17410 |
-
* Length 32=0x20 for lead bytes C0..DF, regardless of UTRIE2_SHIFT_2.
|
17411 |
-
*/
|
17412 |
-
var UTRIE2_UTF8_2B_INDEX_2_OFFSET = exports.UTRIE2_UTF8_2B_INDEX_2_OFFSET = UTRIE2_INDEX_2_BMP_LENGTH;
|
17413 |
-
var UTRIE2_UTF8_2B_INDEX_2_LENGTH = exports.UTRIE2_UTF8_2B_INDEX_2_LENGTH = 0x800 >> 6; /* U+0800 is the first code point after 2-byte UTF-8 */
|
17414 |
-
/**
|
17415 |
-
* The index-1 table, only used for supplementary code points, at offset 2112=0x840.
|
17416 |
-
* Variable length, for code points up to highStart, where the last single-value range starts.
|
17417 |
-
* Maximum length 512=0x200=0x100000>>UTRIE2_SHIFT_1.
|
17418 |
-
* (For 0x100000 supplementary code points U+10000..U+10ffff.)
|
17419 |
-
*
|
17420 |
-
* The part of the index-2 table for supplementary code points starts
|
17421 |
-
* after this index-1 table.
|
17422 |
-
*
|
17423 |
-
* Both the index-1 table and the following part of the index-2 table
|
17424 |
-
* are omitted completely if there is only BMP data.
|
17425 |
-
*/
|
17426 |
-
var UTRIE2_INDEX_1_OFFSET = exports.UTRIE2_INDEX_1_OFFSET = UTRIE2_UTF8_2B_INDEX_2_OFFSET + UTRIE2_UTF8_2B_INDEX_2_LENGTH;
|
17427 |
-
|
17428 |
-
/**
|
17429 |
-
* Number of index-1 entries for the BMP. 32=0x20
|
17430 |
-
* This part of the index-1 table is omitted from the serialized form.
|
17431 |
-
*/
|
17432 |
-
var UTRIE2_OMITTED_BMP_INDEX_1_LENGTH = exports.UTRIE2_OMITTED_BMP_INDEX_1_LENGTH = 0x10000 >> UTRIE2_SHIFT_1;
|
17433 |
-
|
17434 |
-
/** Number of entries in an index-2 block. 64=0x40 */
|
17435 |
-
var UTRIE2_INDEX_2_BLOCK_LENGTH = exports.UTRIE2_INDEX_2_BLOCK_LENGTH = 1 << UTRIE2_SHIFT_1_2;
|
17436 |
-
/** Mask for getting the lower bits for the in-index-2-block offset. */
|
17437 |
-
var UTRIE2_INDEX_2_MASK = exports.UTRIE2_INDEX_2_MASK = UTRIE2_INDEX_2_BLOCK_LENGTH - 1;
|
17438 |
-
|
17439 |
-
var createTrieFromBase64 = exports.createTrieFromBase64 = function createTrieFromBase64(base64) {
|
17440 |
-
var buffer = (0, _Util.decode)(base64);
|
17441 |
-
var view32 = Array.isArray(buffer) ? (0, _Util.polyUint32Array)(buffer) : new Uint32Array(buffer);
|
17442 |
-
var view16 = Array.isArray(buffer) ? (0, _Util.polyUint16Array)(buffer) : new Uint16Array(buffer);
|
17443 |
-
var headerLength = 24;
|
17444 |
-
|
17445 |
-
var index = view16.slice(headerLength / 2, view32[4] / 2);
|
17446 |
-
var data = view32[5] === 2 ? view16.slice((headerLength + view32[4]) / 2) : view32.slice(Math.ceil((headerLength + view32[4]) / 4));
|
17447 |
-
|
17448 |
-
return new Trie(view32[0], view32[1], view32[2], view32[3], index, data);
|
17449 |
-
};
|
17450 |
-
|
17451 |
-
var Trie = exports.Trie = function () {
|
17452 |
-
function Trie(initialValue, errorValue, highStart, highValueIndex, index, data) {
|
17453 |
-
_classCallCheck(this, Trie);
|
17454 |
-
|
17455 |
-
this.initialValue = initialValue;
|
17456 |
-
this.errorValue = errorValue;
|
17457 |
-
this.highStart = highStart;
|
17458 |
-
this.highValueIndex = highValueIndex;
|
17459 |
-
this.index = index;
|
17460 |
-
this.data = data;
|
17461 |
-
}
|
17462 |
-
|
17463 |
-
/**
|
17464 |
-
* Get the value for a code point as stored in the Trie.
|
17465 |
-
*
|
17466 |
-
* @param codePoint the code point
|
17467 |
-
* @return the value
|
17468 |
-
*/
|
17469 |
-
|
17470 |
-
|
17471 |
-
_createClass(Trie, [{
|
17472 |
-
key: 'get',
|
17473 |
-
value: function get(codePoint) {
|
17474 |
-
var ix = void 0;
|
17475 |
-
if (codePoint >= 0) {
|
17476 |
-
if (codePoint < 0x0d800 || codePoint > 0x0dbff && codePoint <= 0x0ffff) {
|
17477 |
-
// Ordinary BMP code point, excluding leading surrogates.
|
17478 |
-
// BMP uses a single level lookup. BMP index starts at offset 0 in the Trie2 index.
|
17479 |
-
// 16 bit data is stored in the index array itself.
|
17480 |
-
ix = this.index[codePoint >> UTRIE2_SHIFT_2];
|
17481 |
-
ix = (ix << UTRIE2_INDEX_SHIFT) + (codePoint & UTRIE2_DATA_MASK);
|
17482 |
-
return this.data[ix];
|
17483 |
-
}
|
17484 |
-
|
17485 |
-
if (codePoint <= 0xffff) {
|
17486 |
-
// Lead Surrogate Code Point. A Separate index section is stored for
|
17487 |
-
// lead surrogate code units and code points.
|
17488 |
-
// The main index has the code unit data.
|
17489 |
-
// For this function, we need the code point data.
|
17490 |
-
// Note: this expression could be refactored for slightly improved efficiency, but
|
17491 |
-
// surrogate code points will be so rare in practice that it's not worth it.
|
17492 |
-
ix = this.index[UTRIE2_LSCP_INDEX_2_OFFSET + (codePoint - 0xd800 >> UTRIE2_SHIFT_2)];
|
17493 |
-
ix = (ix << UTRIE2_INDEX_SHIFT) + (codePoint & UTRIE2_DATA_MASK);
|
17494 |
-
return this.data[ix];
|
17495 |
-
}
|
17496 |
-
|
17497 |
-
if (codePoint < this.highStart) {
|
17498 |
-
// Supplemental code point, use two-level lookup.
|
17499 |
-
ix = UTRIE2_INDEX_1_OFFSET - UTRIE2_OMITTED_BMP_INDEX_1_LENGTH + (codePoint >> UTRIE2_SHIFT_1);
|
17500 |
-
ix = this.index[ix];
|
17501 |
-
ix += codePoint >> UTRIE2_SHIFT_2 & UTRIE2_INDEX_2_MASK;
|
17502 |
-
ix = this.index[ix];
|
17503 |
-
ix = (ix << UTRIE2_INDEX_SHIFT) + (codePoint & UTRIE2_DATA_MASK);
|
17504 |
-
return this.data[ix];
|
17505 |
-
}
|
17506 |
-
if (codePoint <= 0x10ffff) {
|
17507 |
-
return this.data[this.highValueIndex];
|
17508 |
-
}
|
17509 |
-
}
|
17510 |
-
|
17511 |
-
// Fall through. The code point is outside of the legal range of 0..0x10ffff.
|
17512 |
-
return this.errorValue;
|
17513 |
-
}
|
17514 |
-
}]);
|
17515 |
-
|
17516 |
-
return Trie;
|
17517 |
-
}();
|
17518 |
-
|
17519 |
-
/***/ }),
|
17520 |
-
/* 49 */
|
17521 |
-
/***/ (function(module, exports, __webpack_require__) {
|
17522 |
-
|
17523 |
-
"use strict";
|
17524 |
-
|
17525 |
-
|
17526 |
-
module.exports = 'KwAAAAAAAAAACA4AIDoAAPAfAAACAAAAAAAIABAAGABAAEgAUABYAF4AZgBeAGYAYABoAHAAeABeAGYAfACEAIAAiACQAJgAoACoAK0AtQC9AMUAXgBmAF4AZgBeAGYAzQDVAF4AZgDRANkA3gDmAOwA9AD8AAQBDAEUARoBIgGAAIgAJwEvATcBPwFFAU0BTAFUAVwBZAFsAXMBewGDATAAiwGTAZsBogGkAawBtAG8AcIBygHSAdoB4AHoAfAB+AH+AQYCDgIWAv4BHgImAi4CNgI+AkUCTQJTAlsCYwJrAnECeQKBAk0CiQKRApkCoQKoArACuALAAsQCzAIwANQC3ALkAjAA7AL0AvwCAQMJAxADGAMwACADJgMuAzYDPgOAAEYDSgNSA1IDUgNaA1oDYANiA2IDgACAAGoDgAByA3YDfgOAAIQDgACKA5IDmgOAAIAAogOqA4AAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAK8DtwOAAIAAvwPHA88D1wPfAyAD5wPsA/QD/AOAAIAABAQMBBIEgAAWBB4EJgQuBDMEIAM7BEEEXgBJBCADUQRZBGEEaQQwADAAcQQ+AXkEgQSJBJEEgACYBIAAoASoBK8EtwQwAL8ExQSAAIAAgACAAIAAgACgAM0EXgBeAF4AXgBeAF4AXgBeANUEXgDZBOEEXgDpBPEE+QQBBQkFEQUZBSEFKQUxBTUFPQVFBUwFVAVcBV4AYwVeAGsFcwV7BYMFiwWSBV4AmgWgB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AwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAANQc1BzUHNQc1BzUHNQc1BzUHNQc1B54INQc1B6II2gaqCLIIugiAAIAAvgjGCIAAgACAAIAAgACAAIAAgACAAIAAywiHAYAA0wiAANkI3QjlCO0I9Aj8CIAAgACAAAIJCgkSCRoJIgknCTYHLwk3CZYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiAAIAAAAFAAXgBeAGAAcABeAHwAQACQAKAArQC9AJ4AXgBeAE0A3gBRAN4A7AD8AMwBGgEAAKcBNwEFAUwBXAF4QkhCmEKnArcCgAHHAsABz4LAAcABwAHAAd+C6ABoAG+C/4LAAcABwAHAAc+DF4MAAcAB54M3gweDV4Nng3eDaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAEeDqABVg6WDqABoQ6gAaABoAHXDvcONw/3DvcO9w73DvcO9w73DvcO9w73DvcO9w73DvcO9w73DvcO9w73DvcO9w73DvcO9w73DvcO9w73DvcO9w73DncPAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcAB7cPPwlGCU4JMACAAIAAgABWCV4JYQmAAGkJcAl4CXwJgAkwADAAMAAwAIgJgACLCZMJgACZCZ8JowmrCYAAswkwAF4AXgB8AIAAuwkABMMJyQmAAM4JgADVCTAAMAAwADAAgACAAIAAgACAAIAAgACAAIAAqwYWBNkIMAAwADAAMADdCeAJ6AnuCR4E9gkwAP4JBQoNCjAAMACAABUK0wiAAB0KJAosCjQKgAAwADwKQwqAAEsKvQmdCVMKWwowADAAgACAALcEMACAAGMKgABrCjAAMAAwADAAMAAwADAAMAAwADAAMAAeBDAAMAAwADAAMAAwADAAMAAwADAAMAAwAIkEPQFzCnoKiQSCCooKkAqJBJgKoAqkCokEGAGsCrQKvArBCjAAMADJCtEKFQHZCuEK/gHpCvEKMAAwADAAMACAAIwE+QowAIAAPwEBCzAAMAAwADAAMACAAAkLEQswAIAAPwEZCyELgAAOCCkLMAAxCzkLMAAwADAAMAAwADAAXgBeAEELMAAwADAAMAAwADAAMAAwAEkLTQtVC4AAXAtkC4AAiQkwADAAMAAwADAAMAAwADAAbAtxC3kLgAuFC4sLMAAwAJMLlwufCzAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAApwswADAAMACAAIAAgACvC4AAgACAAIAAgACAALcLMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAvwuAAMcLgACAAIAAgACAAIAAyguAAIAAgACAAIAA0QswADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAANkLgACAAIAA4AswADAAMAAwADAAMAAwADAAMAAwADAAMAAwAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACJCR4E6AswADAAhwHwC4AA+AsADAgMEAwwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMACAAIAAGAwdDCUMMAAwAC0MNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQw1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHPQwwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAA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2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gZJDtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBkkOeA6gAKAAoAAwADAAMAAwAKAAoACgAKAAoACgAKAAgA4wADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAD//wQABAAEAAQABAAEAAQABAAEAA0AAwABAAEAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAKABMAFwAeABsAGgAeABcAFgASAB4AGwAYAA8AGAAcAEsASwBLAEsASwBLAEsASwBLAEsAGAAYAB4AHgAeABMAHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAFgAbABIAHgAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABYADQARAB4ABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAAUABAAEAAQABA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EAAQABAAEAAQABAAEAAQABAAEAAQAEwAEACsAEwATAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABLAEsASwBLAEsASwBLAEsASwBLABoAGQAZAB4AUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABMAUAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABABQAFAABAAEAB4ABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUAAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAFAABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQAUABQAB4AHgAYABMAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAFAABAAEAAQABAAEAFAABAAEAAQAUAAEAAQABAAEAAQAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArACsAHgArAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAABAAEAAQABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAAQABAANAA0ASwBLAEsASwBLAEsASwBLAEsASwAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQAKwBQAFAAUABQAFAAUABQAFAAKwArAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUAArAFAAKwArACsAUABQAFAAUAArACsABABQAAQABAAEAAQABAAEAAQAKwArAAQABAArACsABAAEAAQAUAArACsAKwArACsAKwArACsABAArACsAKwArAFAAUAArAFAAUABQAAQABAArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAGgAaAFAAUABQAFAAUABMAB4AGwBQAB4AKwArACsABAAEAAQAKwBQAFAAUABQAFAAUAArACsAKwArAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUAArAFAAUAArAFAAUAArAFAAUAArACsABAArAAQABAAEAAQABAArACsAKwArAAQABAArACsABAAEAAQAKwArACsABAArACsAKwArACsAKwArAFAAUABQAFAAKwBQACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwAEAAQAUABQAFAABAArACsAKwArACsAKwArACsAKwArACsABAAEAAQAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUAArAFAAUAArAFAAUABQAFAAUAArACsABABQAAQABAAEAAQABAAEAAQABAArAAQABAAEACsABAAEAAQAKwArAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAAQABAArACsASwBLAEsASwBLAEsASwBLAEsASwAeABsAKwArACsAKwArACsAKwBQAAQABAAEAAQABAAEACsABAAEAAQAKwBQAFAAUABQAFAAUABQAFAAKwArAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQAKwArAAQABAArACsABAAEAAQAKwArACsAKwArACsAKwArAAQABAArACsAKwArAFAAUAArAFAAUABQAAQABAArACsASwBLAEsASwBLAEsASwBLAEsASwAeAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwAEAFAAKwBQAFAAUABQAFAAUAArACsAKwBQAFAAUAArAFAAUABQAFAAKwArACsAUABQACsAUAArAFAAUAArACsAKwBQAFAAKwArACsAUABQAFAAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAAQABAAEAAQAKwArACsABAAEAAQAKwAEAAQABAAEACsAKwBQACsAKwArACsAKwArAAQAKwArACsAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAB4AHgAeAB4AHgAeABsAHgArACsAKwArACsABAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAABAAEAAQABAAEAAQABAArAAQABAAEACsABAAEAAQABAArACsAKwArACsAKwArAAQABAArAFAAUABQACsAKwArACsAKwBQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAB4AUAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAArAAQABAAEACsABAAEAAQABAArACsAKwArACsAKwArAAQABAArACsAKwArACsAKwArAFAAKwBQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAFAABAAEAAQABAAEAAQABAArAAQABAAEACsABAAEAAQABABQAB4AKwArACsAKwBQAFAAUAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQABoAUABQAFAAUABQAFAAKwArAAQABAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQACsAUAArACsAUABQAFAAUABQAFAAUAArACsAKwAEACsAKwArACsABAAEAAQABAAEAAQAKwAEACsABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArAAQABAAeACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAXAAqACoAKgAqACoAKgAqACsAKwArACsAGwBcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAeAEsASwBLAEsASwBLAEsASwBLAEsADQANACsAKwArACsAKwBcAFwAKwBcACsAKwBcAFwAKwBcACsAKwBcACsAKwArACsAKwArAFwAXABcAFwAKwBcAFwAXABcAFwAXABcACsAXABcAFwAKwBcACsAXAArACsAXABcACsAXABcAFwAXAAqAFwAXAAqACoAKgAqACoAKgArACoAKgBcACsAKwBcAFwAXABcAFwAKwBcACsAKgAqACoAKgAqACoAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArAFwAXABcAFwAUAAOAA4ADgAOAB4ADgAOAAkADgAOAA0ACQATABMAEwATABMACQAeABMAHgAeAB4ABAAEAB4AHgAeAB4AHgAeAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUAANAAQAHgAEAB4ABAAWABEAFgARAAQABABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAANAAQABAAEAAQABAANAAQABABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsADQANAB4AHgAeAB4AHgAeAAQAHgAeAB4AHgAeAB4AKwAeAB4ADgAOAA0ADgAeAB4AHgAeAB4ACQAJACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqAFwASwBLAEsASwBLAEsASwBLAEsASwANAA0AHgAeAB4AHgBcAFwAXABcAFwAXAAqACoAKgAqAFwAXABcAFwAKgAqACoAXAAqACoAKgBcAFwAKgAqACoAKgAqACoAKgBcAFwAXAAqACoAKgAqAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAKgAqACoAKgAqACoAKgAqACoAXAAqAEsASwBLAEsASwBLAEsASwBLAEsAKgAqACoAKgAqACoAUABQAFAAUABQAFAAKwBQACsAKwArACsAKwBQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQACsAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwAEAAQABAAeAA0AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQACsAKwANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABYAEQArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAADQANAA0AUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAABAAEAAQAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAA0ADQArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQACsABAAEACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoADQANABUAXAANAB4ADQAbAFwAKgArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArAB4AHgATABMADQANAA4AHgATABMAHgAEAAQABAAJACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAUABQAFAAUABQAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABABQACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwAeACsAKwArABMAEwBLAEsASwBLAEsASwBLAEsASwBLAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAKwBcAFwAXABcAFwAKwArACsAKwArACsAKwArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBcACsAKwArACoAKgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEACsAKwAeAB4AXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAKgAqACoAKgAqACoAKgArACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgArACsABABLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKgAqACoAKgAqACoAKgBcACoAKgAqACoAKgAqACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQAUABQAFAAUABQAFAAUAArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsADQANAB4ADQANAA0ADQAeAB4AHgAeAB4AHgAeAB4AHgAeAAQABAAEAAQABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeACsAKwArAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAUABQAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAHgAeAB4AHgBQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwANAA0ADQANAA0ASwBLAEsASwBLAEsASwBLAEsASwArACsAKwBQAFAAUABLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAA0AUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsABAAEAAQAHgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAUABQAFAABABQAFAAUABQAAQABAAEAFAAUAAEAAQABAArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwAEAAQABAAEAAQAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUAArAFAAKwBQACsAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAHgAeAB4AHgAeAB4AHgAeAFAAHgAeAB4AUABQAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAKwArAB4AHgAeAB4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B4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAEAAQABAAeAB4AKwArACsAKwArABMADQANAA0AUAATAA0AUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUAANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAA0ADQANAA0ADQANAA0ADQAeAA0AFgANAB4AHgAXABcAHgAeABcAFwAWABEAFgARABYAEQAWABEADQANAA0ADQATAFAADQANAB4ADQANAB4AHgAeAB4AHgAMAAwADQANAA0AHgANAA0AFgANAA0ADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArAA0AEQARACUAJQBHAFcAVwAWABEAFgARABYAEQAWABEAFgARACUAJQ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AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAAQAUABQAFAABABQAFAAUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAeAB4AHgAeACsAKwArACsAUABQAFAAUABQAFAAHgAeABoAHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADgAOABMAEwArACsAKwArACsAKwArACsABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwANAA0ASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUAAeAB4AHgBQAA4AUAArACsAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArAB4AWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYACsAKwArAAQAHgAeAB4AHgAeAB4ADQANAA0AHgAeAB4AHgArAFAASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArAB4AHgBcAFwAXABcAFwAKgBcAFwAXABcAFwAXABcAFwAXABcAEsASwBLAEsASwBLAEsASwBLAEsAXABcAFwAXABcACsAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAFAAUABQAAQAUABQAFAAUABQAFAAUABQAAQABAArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAHgANAA0ADQBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAXAAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAKgAqACoAXABcACoAKgBcAFwAXABcAFwAKgAqAFwAKgBcACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcACoAKgBQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAA0ADQBQAFAAUAAEAAQAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQADQAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAVABVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBUAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVACsAKwArACsAKwArACsAKwArACsAKwArAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAKwArACsAKwBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAKwArACsAKwAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAKwArACsAKwArAFYABABWAFYAVgBWAFYAVgBWAFYAVgBWAB4AVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgArAFYAVgBWAFYAVgArAFYAKwBWAFYAKwBWAFYAKwBWAFYAVgBWAFYAVgBWAFYAVgBWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAEQAWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAaAB4AKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAGAARABEAGAAYABMAEwAWABEAFAArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACUAJQAlACUAJQAWABEAFgARABYAEQAWABEAFgARABYAEQAlACUAFgARACUAJQAlACUAJQAlACUAEQAlABEAKwAVABUAEwATACUAFgARABYAEQAWABEAJQAlACUAJQAlACUAJQAlACsAJQAbABoAJQArACsAKwArAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAcAKwATACUAJQAbABoAJQAlABYAEQAlAC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gAeAB4AHgArACsAKwArAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsADQBQAFAAUABQACsAKwArACsAUABQAFAAUABQAFAAUABQAA0AUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUAArACsAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQACsAKwArAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgBQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwBQAFAAUABQAFAABAAEAAQAKwAEAAQAKwArACsAKwArAAQABAAEAAQAUABQAFAAUAArAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsABAAEAAQAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsADQANAA0ADQANAA0ADQANAB4AKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AUABQAFAAUABQAFAAUABQAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwArACsAUABQAFAAUABQAA0ADQANAA0ADQANABQAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwANAA0ADQANAA0ADQANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwBQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAA0ADQAeAB4AHgAeAB4AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsASwBLAEsASwBLAEsASwBLAEsASwANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAeAA4AUAArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAADQANAB4ADQAeAAQABAAEAB4AKwArAEsASwBLAEsASwBLAEsASwBLAEsAUAAOAFAADQANAA0AKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAANAA0AHgANAA0AHgAEACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAA0AKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsABAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAUAArACsAKwArACsAKwAEACsAKwArACsAKwBQAFAAUABQAFAABAAEACsAKwAEAAQABAAEAAQABAAEACsAKwArAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAAQABABQAFAAUABQAA0ADQANAA0AHgBLAEsASwBLAEsASwBLAEsASwBLACsADQArAB4AKwArAAQABAAEAAQAUABQAB4AUAArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEACsAKwAEAAQABAAEAAQABAAEAAQABAAOAA0ADQATABMAHgAeAB4ADQANAA0ADQANAA0ADQANAA0ADQANAA0ADQANAA0AUABQAFAAUAAEAAQAKwArAAQADQANAB4AUAArACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAKwAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAXABcAA0ADQANACoASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAFAABAAEAAQABAAOAB4ADQANAA0ADQAOAB4ABAArACsAKwArACsAKwArACsAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAUABQAFAAUAArACsAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAA0ADQANACsADgAOAA4ADQANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAAQABAAEAFAADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAOABMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAArACsAKwAEACsABAAEACsABAAEAAQABAAEAAQABABQAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABIAEgAQwBDAEMAUABQAFAAUABDAFAAUABQAEgAQwBIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABDAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwANAA0AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAANACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAA0ADQANAB4AHgAeAB4AHgAeAFAAUABQAFAADQAeACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAEcARwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwArACsAKwArACsAKwArACsAKwArACsAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQACsAKwAeAAQABAANAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAB4AHgAeAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAHgAeAAQABAAEAAQABAAEAAQAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgA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B4AKwArAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAEAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAeAB4ADQANAA0ADQAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABAArAAQABAArAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAEAAQABAAEAAQABAAEACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAFgAWAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArAFAAKwArAFAAKwBQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUAArAFAAKwBQACsAKwArACsAKwArAFAAKwArACsAKwBQACsAUAArAFAAKwBQAFAAUAArAFAAUAArAFAAKwArAFAAKwBQACsAUAArAFAAKwBQACsAUABQACsAUAArACsAUABQAFAAUAArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQACsAUABQAFAAUAArAFAAKwBQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwBQAFAAUAArAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAlACUAJQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeACUAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeACUAJQAlACUAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQAlACUAJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeACUAJQAlACUAJQAeACUAJQAlACUAJQAgACAAIAAlACUAIAAlACUAIAAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAIQAhACEAIQAhACUAJQAgACAAJQAlACAAIAAgACAAIAAgACAAIAAgACAAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAIAAgACAAIAAlACUAJQAlACAAJQAgACAAIAAgACAAIAAgACAAIAAlACUAJQAgACUAJQAlACUAIAAgACAAJQAgACAAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeACUAHgAlAB4AJQAlACUAJQAlACAAJQAlACUAJQAeACUAHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJ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QAlACUAJQAlACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAIAAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACsAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsA';
|
17527 |
-
|
17528 |
-
/***/ }),
|
17529 |
-
/* 50 */
|
17530 |
-
/***/ (function(module, exports, __webpack_require__) {
|
17531 |
-
|
17532 |
-
"use strict";
|
17533 |
-
|
17534 |
-
|
17535 |
-
Object.defineProperty(exports, "__esModule", {
|
17536 |
-
value: true
|
17537 |
-
});
|
17538 |
-
|
17539 |
-
var _Path = __webpack_require__(6);
|
17540 |
-
|
17541 |
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
17542 |
-
|
17543 |
-
var Circle = function Circle(x, y, radius) {
|
17544 |
-
_classCallCheck(this, Circle);
|
17545 |
-
|
17546 |
-
this.type = _Path.PATH.CIRCLE;
|
17547 |
-
this.x = x;
|
17548 |
-
this.y = y;
|
17549 |
-
this.radius = radius;
|
17550 |
-
if (true) {
|
17551 |
-
if (isNaN(x)) {
|
17552 |
-
console.error('Invalid x value given for Circle');
|
17553 |
-
}
|
17554 |
-
if (isNaN(y)) {
|
17555 |
-
console.error('Invalid y value given for Circle');
|
17556 |
-
}
|
17557 |
-
if (isNaN(radius)) {
|
17558 |
-
console.error('Invalid radius value given for Circle');
|
17559 |
-
}
|
17560 |
-
}
|
17561 |
-
};
|
17562 |
-
|
17563 |
-
exports.default = Circle;
|
17564 |
-
|
17565 |
-
/***/ }),
|
17566 |
-
/* 51 */
|
17567 |
-
/***/ (function(module, exports, __webpack_require__) {
|
17568 |
-
|
17569 |
-
"use strict";
|
17570 |
-
|
17571 |
-
|
17572 |
-
Object.defineProperty(exports, "__esModule", {
|
17573 |
-
value: true
|
17574 |
-
});
|
17575 |
-
|
17576 |
-
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
|
17577 |
-
|
17578 |
-
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
17579 |
-
|
17580 |
-
var _Bounds = __webpack_require__(2);
|
17581 |
-
|
17582 |
-
var _Font = __webpack_require__(25);
|
17583 |
-
|
17584 |
-
var _Gradient = __webpack_require__(52);
|
17585 |
-
|
17586 |
-
var _TextContainer = __webpack_require__(9);
|
17587 |
-
|
17588 |
-
var _TextContainer2 = _interopRequireDefault(_TextContainer);
|
17589 |
-
|
17590 |
-
var _background = __webpack_require__(5);
|
17591 |
-
|
17592 |
-
var _border = __webpack_require__(12);
|
17593 |
-
|
17594 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
17595 |
-
|
17596 |
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
17597 |
-
|
17598 |
-
var Renderer = function () {
|
17599 |
-
function Renderer(target, options) {
|
17600 |
-
_classCallCheck(this, Renderer);
|
17601 |
-
|
17602 |
-
this.target = target;
|
17603 |
-
this.options = options;
|
17604 |
-
target.render(options);
|
17605 |
-
}
|
17606 |
-
|
17607 |
-
_createClass(Renderer, [{
|
17608 |
-
key: 'renderNode',
|
17609 |
-
value: function renderNode(container) {
|
17610 |
-
if (container.isVisible()) {
|
17611 |
-
this.renderNodeBackgroundAndBorders(container);
|
17612 |
-
this.renderNodeContent(container);
|
17613 |
-
}
|
17614 |
-
}
|
17615 |
-
}, {
|
17616 |
-
key: 'renderNodeContent',
|
17617 |
-
value: function renderNodeContent(container) {
|
17618 |
-
var _this = this;
|
17619 |
-
|
17620 |
-
var callback = function callback() {
|
17621 |
-
if (container.childNodes.length) {
|
17622 |
-
container.childNodes.forEach(function (child) {
|
17623 |
-
if (child instanceof _TextContainer2.default) {
|
17624 |
-
var style = child.parent.style;
|
17625 |
-
_this.target.renderTextNode(child.bounds, style.color, style.font, style.textDecoration, style.textShadow);
|
17626 |
-
} else {
|
17627 |
-
_this.target.drawShape(child, container.style.color);
|
17628 |
-
}
|
17629 |
-
});
|
17630 |
-
}
|
17631 |
-
|
17632 |
-
if (container.image) {
|
17633 |
-
var _image = _this.options.imageStore.get(container.image);
|
17634 |
-
if (_image) {
|
17635 |
-
var contentBox = (0, _Bounds.calculateContentBox)(container.bounds, container.style.padding, container.style.border);
|
17636 |
-
var _width = typeof _image.width === 'number' && _image.width > 0 ? _image.width : contentBox.width;
|
17637 |
-
var _height = typeof _image.height === 'number' && _image.height > 0 ? _image.height : contentBox.height;
|
17638 |
-
if (_width > 0 && _height > 0) {
|
17639 |
-
_this.target.clip([(0, _Bounds.calculatePaddingBoxPath)(container.curvedBounds)], function () {
|
17640 |
-
_this.target.drawImage(_image, new _Bounds.Bounds(0, 0, _width, _height), contentBox);
|
17641 |
-
});
|
17642 |
-
}
|
17643 |
-
}
|
17644 |
-
}
|
17645 |
-
};
|
17646 |
-
var paths = container.getClipPaths();
|
17647 |
-
if (paths.length) {
|
17648 |
-
this.target.clip(paths, callback);
|
17649 |
-
} else {
|
17650 |
-
callback();
|
17651 |
-
}
|
17652 |
-
}
|
17653 |
-
}, {
|
17654 |
-
key: 'renderNodeBackgroundAndBorders',
|
17655 |
-
value: function renderNodeBackgroundAndBorders(container) {
|
17656 |
-
var _this2 = this;
|
17657 |
-
|
17658 |
-
var HAS_BACKGROUND = !container.style.background.backgroundColor.isTransparent() || container.style.background.backgroundImage.length;
|
17659 |
-
|
17660 |
-
var hasRenderableBorders = container.style.border.some(function (border) {
|
17661 |
-
return border.borderStyle !== _border.BORDER_STYLE.NONE && !border.borderColor.isTransparent();
|
17662 |
-
});
|
17663 |
-
|
17664 |
-
var callback = function callback() {
|
17665 |
-
var backgroundPaintingArea = (0, _background.calculateBackgroungPaintingArea)(container.curvedBounds, container.style.background.backgroundClip);
|
17666 |
-
|
17667 |
-
if (HAS_BACKGROUND) {
|
17668 |
-
_this2.target.clip([backgroundPaintingArea], function () {
|
17669 |
-
if (!container.style.background.backgroundColor.isTransparent()) {
|
17670 |
-
_this2.target.fill(container.style.background.backgroundColor);
|
17671 |
-
}
|
17672 |
-
|
17673 |
-
_this2.renderBackgroundImage(container);
|
17674 |
-
});
|
17675 |
-
}
|
17676 |
-
|
17677 |
-
container.style.border.forEach(function (border, side) {
|
17678 |
-
if (border.borderStyle !== _border.BORDER_STYLE.NONE && !border.borderColor.isTransparent()) {
|
17679 |
-
_this2.renderBorder(border, side, container.curvedBounds);
|
17680 |
-
}
|
17681 |
-
});
|
17682 |
-
};
|
17683 |
-
|
17684 |
-
if (HAS_BACKGROUND || hasRenderableBorders) {
|
17685 |
-
var paths = container.parent ? container.parent.getClipPaths() : [];
|
17686 |
-
if (paths.length) {
|
17687 |
-
this.target.clip(paths, callback);
|
17688 |
-
} else {
|
17689 |
-
callback();
|
17690 |
-
}
|
17691 |
-
}
|
17692 |
-
}
|
17693 |
-
}, {
|
17694 |
-
key: 'renderBackgroundImage',
|
17695 |
-
value: function renderBackgroundImage(container) {
|
17696 |
-
var _this3 = this;
|
17697 |
-
|
17698 |
-
container.style.background.backgroundImage.slice(0).reverse().forEach(function (backgroundImage) {
|
17699 |
-
if (backgroundImage.source.method === 'url' && backgroundImage.source.args.length) {
|
17700 |
-
_this3.renderBackgroundRepeat(container, backgroundImage);
|
17701 |
-
} else if (/gradient/i.test(backgroundImage.source.method)) {
|
17702 |
-
_this3.renderBackgroundGradient(container, backgroundImage);
|
17703 |
-
}
|
17704 |
-
});
|
17705 |
-
}
|
17706 |
-
}, {
|
17707 |
-
key: 'renderBackgroundRepeat',
|
17708 |
-
value: function renderBackgroundRepeat(container, background) {
|
17709 |
-
var image = this.options.imageStore.get(background.source.args[0]);
|
17710 |
-
if (image) {
|
17711 |
-
var backgroundPositioningArea = (0, _background.calculateBackgroungPositioningArea)(container.style.background.backgroundOrigin, container.bounds, container.style.padding, container.style.border);
|
17712 |
-
var backgroundImageSize = (0, _background.calculateBackgroundSize)(background, image, backgroundPositioningArea);
|
17713 |
-
var position = (0, _background.calculateBackgroundPosition)(background.position, backgroundImageSize, backgroundPositioningArea);
|
17714 |
-
var _path = (0, _background.calculateBackgroundRepeatPath)(background, position, backgroundImageSize, backgroundPositioningArea, container.bounds);
|
17715 |
-
|
17716 |
-
var _offsetX = Math.round(backgroundPositioningArea.left + position.x);
|
17717 |
-
var _offsetY = Math.round(backgroundPositioningArea.top + position.y);
|
17718 |
-
this.target.renderRepeat(_path, image, backgroundImageSize, _offsetX, _offsetY);
|
17719 |
-
}
|
17720 |
-
}
|
17721 |
-
}, {
|
17722 |
-
key: 'renderBackgroundGradient',
|
17723 |
-
value: function renderBackgroundGradient(container, background) {
|
17724 |
-
var backgroundPositioningArea = (0, _background.calculateBackgroungPositioningArea)(container.style.background.backgroundOrigin, container.bounds, container.style.padding, container.style.border);
|
17725 |
-
var backgroundImageSize = (0, _background.calculateGradientBackgroundSize)(background, backgroundPositioningArea);
|
17726 |
-
var position = (0, _background.calculateBackgroundPosition)(background.position, backgroundImageSize, backgroundPositioningArea);
|
17727 |
-
var gradientBounds = new _Bounds.Bounds(Math.round(backgroundPositioningArea.left + position.x), Math.round(backgroundPositioningArea.top + position.y), backgroundImageSize.width, backgroundImageSize.height);
|
17728 |
-
|
17729 |
-
var gradient = (0, _Gradient.parseGradient)(container, background.source, gradientBounds);
|
17730 |
-
if (gradient) {
|
17731 |
-
switch (gradient.type) {
|
17732 |
-
case _Gradient.GRADIENT_TYPE.LINEAR_GRADIENT:
|
17733 |
-
// $FlowFixMe
|
17734 |
-
this.target.renderLinearGradient(gradientBounds, gradient);
|
17735 |
-
break;
|
17736 |
-
case _Gradient.GRADIENT_TYPE.RADIAL_GRADIENT:
|
17737 |
-
// $FlowFixMe
|
17738 |
-
this.target.renderRadialGradient(gradientBounds, gradient);
|
17739 |
-
break;
|
17740 |
-
}
|
17741 |
-
}
|
17742 |
-
}
|
17743 |
-
}, {
|
17744 |
-
key: 'renderBorder',
|
17745 |
-
value: function renderBorder(border, side, curvePoints) {
|
17746 |
-
this.target.drawShape((0, _Bounds.parsePathForBorder)(curvePoints, side), border.borderColor);
|
17747 |
-
}
|
17748 |
-
}, {
|
17749 |
-
key: 'renderStack',
|
17750 |
-
value: function renderStack(stack) {
|
17751 |
-
var _this4 = this;
|
17752 |
-
|
17753 |
-
if (stack.container.isVisible()) {
|
17754 |
-
var _opacity = stack.getOpacity();
|
17755 |
-
if (_opacity !== this._opacity) {
|
17756 |
-
this.target.setOpacity(stack.getOpacity());
|
17757 |
-
this._opacity = _opacity;
|
17758 |
-
}
|
17759 |
-
|
17760 |
-
var _transform = stack.container.style.transform;
|
17761 |
-
if (_transform !== null) {
|
17762 |
-
this.target.transform(stack.container.bounds.left + _transform.transformOrigin[0].value, stack.container.bounds.top + _transform.transformOrigin[1].value, _transform.transform, function () {
|
17763 |
-
return _this4.renderStackContent(stack);
|
17764 |
-
});
|
17765 |
-
} else {
|
17766 |
-
this.renderStackContent(stack);
|
17767 |
-
}
|
17768 |
-
}
|
17769 |
-
}
|
17770 |
-
}, {
|
17771 |
-
key: 'renderStackContent',
|
17772 |
-
value: function renderStackContent(stack) {
|
17773 |
-
var _splitStackingContext = splitStackingContexts(stack),
|
17774 |
-
_splitStackingContext2 = _slicedToArray(_splitStackingContext, 5),
|
17775 |
-
negativeZIndex = _splitStackingContext2[0],
|
17776 |
-
zeroOrAutoZIndexOrTransformedOrOpacity = _splitStackingContext2[1],
|
17777 |
-
positiveZIndex = _splitStackingContext2[2],
|
17778 |
-
nonPositionedFloats = _splitStackingContext2[3],
|
17779 |
-
nonPositionedInlineLevel = _splitStackingContext2[4];
|
17780 |
-
|
17781 |
-
var _splitDescendants = splitDescendants(stack),
|
17782 |
-
_splitDescendants2 = _slicedToArray(_splitDescendants, 2),
|
17783 |
-
inlineLevel = _splitDescendants2[0],
|
17784 |
-
nonInlineLevel = _splitDescendants2[1];
|
17785 |
-
|
17786 |
-
// https://www.w3.org/TR/css-position-3/#painting-order
|
17787 |
-
// 1. the background and borders of the element forming the stacking context.
|
17788 |
-
|
17789 |
-
|
17790 |
-
this.renderNodeBackgroundAndBorders(stack.container);
|
17791 |
-
// 2. the child stacking contexts with negative stack levels (most negative first).
|
17792 |
-
negativeZIndex.sort(sortByZIndex).forEach(this.renderStack, this);
|
17793 |
-
// 3. For all its in-flow, non-positioned, block-level descendants in tree order:
|
17794 |
-
this.renderNodeContent(stack.container);
|
17795 |
-
nonInlineLevel.forEach(this.renderNode, this);
|
17796 |
-
// 4. All non-positioned floating descendants, in tree order. For each one of these,
|
17797 |
-
// treat the element as if it created a new stacking context, but any positioned descendants and descendants
|
17798 |
-
// which actually create a new stacking context should be considered part of the parent stacking context,
|
17799 |
-
// not this new one.
|
17800 |
-
nonPositionedFloats.forEach(this.renderStack, this);
|
17801 |
-
// 5. the in-flow, inline-level, non-positioned descendants, including inline tables and inline blocks.
|
17802 |
-
nonPositionedInlineLevel.forEach(this.renderStack, this);
|
17803 |
-
inlineLevel.forEach(this.renderNode, this);
|
17804 |
-
// 6. All positioned, opacity or transform descendants, in tree order that fall into the following categories:
|
17805 |
-
// All positioned descendants with 'z-index: auto' or 'z-index: 0', in tree order.
|
17806 |
-
// For those with 'z-index: auto', treat the element as if it created a new stacking context,
|
17807 |
-
// but any positioned descendants and descendants which actually create a new stacking context should be
|
17808 |
-
// considered part of the parent stacking context, not this new one. For those with 'z-index: 0',
|
17809 |
-
// treat the stacking context generated atomically.
|
17810 |
-
//
|
17811 |
-
// All opacity descendants with opacity less than 1
|
17812 |
-
//
|
17813 |
-
// All transform descendants with transform other than none
|
17814 |
-
zeroOrAutoZIndexOrTransformedOrOpacity.forEach(this.renderStack, this);
|
17815 |
-
// 7. Stacking contexts formed by positioned descendants with z-indices greater than or equal to 1 in z-index
|
17816 |
-
// order (smallest first) then tree order.
|
17817 |
-
positiveZIndex.sort(sortByZIndex).forEach(this.renderStack, this);
|
17818 |
-
}
|
17819 |
-
}, {
|
17820 |
-
key: 'render',
|
17821 |
-
value: function render(stack) {
|
17822 |
-
var _this5 = this;
|
17823 |
-
|
17824 |
-
if (this.options.backgroundColor) {
|
17825 |
-
this.target.rectangle(this.options.x, this.options.y, this.options.width, this.options.height, this.options.backgroundColor);
|
17826 |
-
}
|
17827 |
-
this.renderStack(stack);
|
17828 |
-
var target = this.target.getTarget();
|
17829 |
-
if (true) {
|
17830 |
-
return target.then(function (output) {
|
17831 |
-
_this5.options.logger.log('Render completed');
|
17832 |
-
return output;
|
17833 |
-
});
|
17834 |
-
}
|
17835 |
-
return target;
|
17836 |
-
}
|
17837 |
-
}]);
|
17838 |
-
|
17839 |
-
return Renderer;
|
17840 |
-
}();
|
17841 |
-
|
17842 |
-
exports.default = Renderer;
|
17843 |
-
|
17844 |
-
|
17845 |
-
var splitDescendants = function splitDescendants(stack) {
|
17846 |
-
var inlineLevel = [];
|
17847 |
-
var nonInlineLevel = [];
|
17848 |
-
|
17849 |
-
var length = stack.children.length;
|
17850 |
-
for (var i = 0; i < length; i++) {
|
17851 |
-
var child = stack.children[i];
|
17852 |
-
if (child.isInlineLevel()) {
|
17853 |
-
inlineLevel.push(child);
|
17854 |
-
} else {
|
17855 |
-
nonInlineLevel.push(child);
|
17856 |
-
}
|
17857 |
-
}
|
17858 |
-
return [inlineLevel, nonInlineLevel];
|
17859 |
-
};
|
17860 |
-
|
17861 |
-
var splitStackingContexts = function splitStackingContexts(stack) {
|
17862 |
-
var negativeZIndex = [];
|
17863 |
-
var zeroOrAutoZIndexOrTransformedOrOpacity = [];
|
17864 |
-
var positiveZIndex = [];
|
17865 |
-
var nonPositionedFloats = [];
|
17866 |
-
var nonPositionedInlineLevel = [];
|
17867 |
-
var length = stack.contexts.length;
|
17868 |
-
for (var i = 0; i < length; i++) {
|
17869 |
-
var child = stack.contexts[i];
|
17870 |
-
if (child.container.isPositioned() || child.container.style.opacity < 1 || child.container.isTransformed()) {
|
17871 |
-
if (child.container.style.zIndex.order < 0) {
|
17872 |
-
negativeZIndex.push(child);
|
17873 |
-
} else if (child.container.style.zIndex.order > 0) {
|
17874 |
-
positiveZIndex.push(child);
|
17875 |
-
} else {
|
17876 |
-
zeroOrAutoZIndexOrTransformedOrOpacity.push(child);
|
17877 |
-
}
|
17878 |
-
} else {
|
17879 |
-
if (child.container.isFloating()) {
|
17880 |
-
nonPositionedFloats.push(child);
|
17881 |
-
} else {
|
17882 |
-
nonPositionedInlineLevel.push(child);
|
17883 |
-
}
|
17884 |
-
}
|
17885 |
-
}
|
17886 |
-
return [negativeZIndex, zeroOrAutoZIndexOrTransformedOrOpacity, positiveZIndex, nonPositionedFloats, nonPositionedInlineLevel];
|
17887 |
-
};
|
17888 |
-
|
17889 |
-
var sortByZIndex = function sortByZIndex(a, b) {
|
17890 |
-
if (a.container.style.zIndex.order > b.container.style.zIndex.order) {
|
17891 |
-
return 1;
|
17892 |
-
} else if (a.container.style.zIndex.order < b.container.style.zIndex.order) {
|
17893 |
-
return -1;
|
17894 |
-
}
|
17895 |
-
|
17896 |
-
return a.container.index > b.container.index ? 1 : -1;
|
17897 |
-
};
|
17898 |
-
|
17899 |
-
/***/ }),
|
17900 |
-
/* 52 */
|
17901 |
-
/***/ (function(module, exports, __webpack_require__) {
|
17902 |
-
|
17903 |
-
"use strict";
|
17904 |
-
|
17905 |
-
|
17906 |
-
Object.defineProperty(exports, "__esModule", {
|
17907 |
-
value: true
|
17908 |
-
});
|
17909 |
-
exports.transformWebkitRadialGradientArgs = exports.parseGradient = exports.RadialGradient = exports.LinearGradient = exports.RADIAL_GRADIENT_SHAPE = exports.GRADIENT_TYPE = undefined;
|
17910 |
-
|
17911 |
-
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
|
17912 |
-
|
17913 |
-
var _NodeContainer = __webpack_require__(3);
|
17914 |
-
|
17915 |
-
var _NodeContainer2 = _interopRequireDefault(_NodeContainer);
|
17916 |
-
|
17917 |
-
var _Angle = __webpack_require__(53);
|
17918 |
-
|
17919 |
-
var _Color = __webpack_require__(0);
|
17920 |
-
|
17921 |
-
var _Color2 = _interopRequireDefault(_Color);
|
17922 |
-
|
17923 |
-
var _Length = __webpack_require__(1);
|
17924 |
-
|
17925 |
-
var _Length2 = _interopRequireDefault(_Length);
|
17926 |
-
|
17927 |
-
var _Util = __webpack_require__(4);
|
17928 |
-
|
17929 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
17930 |
-
|
17931 |
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
17932 |
-
|
17933 |
-
var SIDE_OR_CORNER = /^(to )?(left|top|right|bottom)( (left|top|right|bottom))?$/i;
|
17934 |
-
var PERCENTAGE_ANGLES = /^([+-]?\d*\.?\d+)% ([+-]?\d*\.?\d+)%$/i;
|
17935 |
-
var ENDS_WITH_LENGTH = /(px)|%|( 0)$/i;
|
17936 |
-
var FROM_TO_COLORSTOP = /^(from|to|color-stop)\((?:([\d.]+)(%)?,\s*)?(.+?)\)$/i;
|
17937 |
-
var RADIAL_SHAPE_DEFINITION = /^\s*(circle|ellipse)?\s*((?:([\d.]+)(px|r?em|%)\s*(?:([\d.]+)(px|r?em|%))?)|closest-side|closest-corner|farthest-side|farthest-corner)?\s*(?:at\s*(?:(left|center|right)|([\d.]+)(px|r?em|%))\s+(?:(top|center|bottom)|([\d.]+)(px|r?em|%)))?(?:\s|$)/i;
|
17938 |
-
|
17939 |
-
var GRADIENT_TYPE = exports.GRADIENT_TYPE = {
|
17940 |
-
LINEAR_GRADIENT: 0,
|
17941 |
-
RADIAL_GRADIENT: 1
|
17942 |
-
};
|
17943 |
-
|
17944 |
-
var RADIAL_GRADIENT_SHAPE = exports.RADIAL_GRADIENT_SHAPE = {
|
17945 |
-
CIRCLE: 0,
|
17946 |
-
ELLIPSE: 1
|
17947 |
-
};
|
17948 |
-
|
17949 |
-
var LENGTH_FOR_POSITION = {
|
17950 |
-
left: new _Length2.default('0%'),
|
17951 |
-
top: new _Length2.default('0%'),
|
17952 |
-
center: new _Length2.default('50%'),
|
17953 |
-
right: new _Length2.default('100%'),
|
17954 |
-
bottom: new _Length2.default('100%')
|
17955 |
-
};
|
17956 |
-
|
17957 |
-
var LinearGradient = exports.LinearGradient = function LinearGradient(colorStops, direction) {
|
17958 |
-
_classCallCheck(this, LinearGradient);
|
17959 |
-
|
17960 |
-
this.type = GRADIENT_TYPE.LINEAR_GRADIENT;
|
17961 |
-
this.colorStops = colorStops;
|
17962 |
-
this.direction = direction;
|
17963 |
-
};
|
17964 |
-
|
17965 |
-
var RadialGradient = exports.RadialGradient = function RadialGradient(colorStops, shape, center, radius) {
|
17966 |
-
_classCallCheck(this, RadialGradient);
|
17967 |
-
|
17968 |
-
this.type = GRADIENT_TYPE.RADIAL_GRADIENT;
|
17969 |
-
this.colorStops = colorStops;
|
17970 |
-
this.shape = shape;
|
17971 |
-
this.center = center;
|
17972 |
-
this.radius = radius;
|
17973 |
-
};
|
17974 |
-
|
17975 |
-
var parseGradient = exports.parseGradient = function parseGradient(container, _ref, bounds) {
|
17976 |
-
var args = _ref.args,
|
17977 |
-
method = _ref.method,
|
17978 |
-
prefix = _ref.prefix;
|
17979 |
-
|
17980 |
-
if (method === 'linear-gradient') {
|
17981 |
-
return parseLinearGradient(args, bounds, !!prefix);
|
17982 |
-
} else if (method === 'gradient' && args[0] === 'linear') {
|
17983 |
-
// TODO handle correct angle
|
17984 |
-
return parseLinearGradient(['to bottom'].concat(transformObsoleteColorStops(args.slice(3))), bounds, !!prefix);
|
17985 |
-
} else if (method === 'radial-gradient') {
|
17986 |
-
return parseRadialGradient(container, prefix === '-webkit-' ? transformWebkitRadialGradientArgs(args) : args, bounds);
|
17987 |
-
} else if (method === 'gradient' && args[0] === 'radial') {
|
17988 |
-
return parseRadialGradient(container, transformObsoleteColorStops(transformWebkitRadialGradientArgs(args.slice(1))), bounds);
|
17989 |
-
}
|
17990 |
-
};
|
17991 |
-
|
17992 |
-
var parseColorStops = function parseColorStops(args, firstColorStopIndex, lineLength) {
|
17993 |
-
var colorStops = [];
|
17994 |
-
|
17995 |
-
for (var i = firstColorStopIndex; i < args.length; i++) {
|
17996 |
-
var value = args[i];
|
17997 |
-
var HAS_LENGTH = ENDS_WITH_LENGTH.test(value);
|
17998 |
-
var lastSpaceIndex = value.lastIndexOf(' ');
|
17999 |
-
var _color = new _Color2.default(HAS_LENGTH ? value.substring(0, lastSpaceIndex) : value);
|
18000 |
-
var _stop = HAS_LENGTH ? new _Length2.default(value.substring(lastSpaceIndex + 1)) : i === firstColorStopIndex ? new _Length2.default('0%') : i === args.length - 1 ? new _Length2.default('100%') : null;
|
18001 |
-
colorStops.push({ color: _color, stop: _stop });
|
18002 |
-
}
|
18003 |
-
|
18004 |
-
var absoluteValuedColorStops = colorStops.map(function (_ref2) {
|
18005 |
-
var color = _ref2.color,
|
18006 |
-
stop = _ref2.stop;
|
18007 |
-
|
18008 |
-
var absoluteStop = lineLength === 0 ? 0 : stop ? stop.getAbsoluteValue(lineLength) / lineLength : null;
|
18009 |
-
|
18010 |
-
return {
|
18011 |
-
color: color,
|
18012 |
-
// $FlowFixMe
|
18013 |
-
stop: absoluteStop
|
18014 |
-
};
|
18015 |
-
});
|
18016 |
-
|
18017 |
-
var previousColorStop = absoluteValuedColorStops[0].stop;
|
18018 |
-
for (var _i = 0; _i < absoluteValuedColorStops.length; _i++) {
|
18019 |
-
if (previousColorStop !== null) {
|
18020 |
-
var _stop2 = absoluteValuedColorStops[_i].stop;
|
18021 |
-
if (_stop2 === null) {
|
18022 |
-
var n = _i;
|
18023 |
-
while (absoluteValuedColorStops[n].stop === null) {
|
18024 |
-
n++;
|
18025 |
-
}
|
18026 |
-
var steps = n - _i + 1;
|
18027 |
-
var nextColorStep = absoluteValuedColorStops[n].stop;
|
18028 |
-
var stepSize = (nextColorStep - previousColorStop) / steps;
|
18029 |
-
for (; _i < n; _i++) {
|
18030 |
-
previousColorStop = absoluteValuedColorStops[_i].stop = previousColorStop + stepSize;
|
18031 |
-
}
|
18032 |
-
} else {
|
18033 |
-
previousColorStop = _stop2;
|
18034 |
-
}
|
18035 |
-
}
|
18036 |
-
}
|
18037 |
-
|
18038 |
-
return absoluteValuedColorStops;
|
18039 |
-
};
|
18040 |
-
|
18041 |
-
var parseLinearGradient = function parseLinearGradient(args, bounds, hasPrefix) {
|
18042 |
-
var angle = (0, _Angle.parseAngle)(args[0]);
|
18043 |
-
var HAS_SIDE_OR_CORNER = SIDE_OR_CORNER.test(args[0]);
|
18044 |
-
var HAS_DIRECTION = HAS_SIDE_OR_CORNER || angle !== null || PERCENTAGE_ANGLES.test(args[0]);
|
18045 |
-
var direction = HAS_DIRECTION ? angle !== null ? calculateGradientDirection(
|
18046 |
-
// if there is a prefix, the 0° angle points due East (instead of North per W3C)
|
18047 |
-
hasPrefix ? angle - Math.PI * 0.5 : angle, bounds) : HAS_SIDE_OR_CORNER ? parseSideOrCorner(args[0], bounds) : parsePercentageAngle(args[0], bounds) : calculateGradientDirection(Math.PI, bounds);
|
18048 |
-
var firstColorStopIndex = HAS_DIRECTION ? 1 : 0;
|
18049 |
-
|
18050 |
-
// TODO: Fix some inaccuracy with color stops with px values
|
18051 |
-
var lineLength = Math.min((0, _Util.distance)(Math.abs(direction.x0) + Math.abs(direction.x1), Math.abs(direction.y0) + Math.abs(direction.y1)), bounds.width * 2, bounds.height * 2);
|
18052 |
-
|
18053 |
-
return new LinearGradient(parseColorStops(args, firstColorStopIndex, lineLength), direction);
|
18054 |
-
};
|
18055 |
-
|
18056 |
-
var parseRadialGradient = function parseRadialGradient(container, args, bounds) {
|
18057 |
-
var m = args[0].match(RADIAL_SHAPE_DEFINITION);
|
18058 |
-
var shape = m && (m[1] === 'circle' || // explicit shape specification
|
18059 |
-
m[3] !== undefined && m[5] === undefined) // only one radius coordinate
|
18060 |
-
? RADIAL_GRADIENT_SHAPE.CIRCLE : RADIAL_GRADIENT_SHAPE.ELLIPSE;
|
18061 |
-
var radius = {};
|
18062 |
-
var center = {};
|
18063 |
-
|
18064 |
-
if (m) {
|
18065 |
-
// Radius
|
18066 |
-
if (m[3] !== undefined) {
|
18067 |
-
radius.x = (0, _Length.calculateLengthFromValueWithUnit)(container, m[3], m[4]).getAbsoluteValue(bounds.width);
|
18068 |
-
}
|
18069 |
-
|
18070 |
-
if (m[5] !== undefined) {
|
18071 |
-
radius.y = (0, _Length.calculateLengthFromValueWithUnit)(container, m[5], m[6]).getAbsoluteValue(bounds.height);
|
18072 |
-
}
|
18073 |
-
|
18074 |
-
// Position
|
18075 |
-
if (m[7]) {
|
18076 |
-
center.x = LENGTH_FOR_POSITION[m[7].toLowerCase()];
|
18077 |
-
} else if (m[8] !== undefined) {
|
18078 |
-
center.x = (0, _Length.calculateLengthFromValueWithUnit)(container, m[8], m[9]);
|
18079 |
-
}
|
18080 |
-
|
18081 |
-
if (m[10]) {
|
18082 |
-
center.y = LENGTH_FOR_POSITION[m[10].toLowerCase()];
|
18083 |
-
} else if (m[11] !== undefined) {
|
18084 |
-
center.y = (0, _Length.calculateLengthFromValueWithUnit)(container, m[11], m[12]);
|
18085 |
-
}
|
18086 |
-
}
|
18087 |
-
|
18088 |
-
var gradientCenter = {
|
18089 |
-
x: center.x === undefined ? bounds.width / 2 : center.x.getAbsoluteValue(bounds.width),
|
18090 |
-
y: center.y === undefined ? bounds.height / 2 : center.y.getAbsoluteValue(bounds.height)
|
18091 |
-
};
|
18092 |
-
var gradientRadius = calculateRadius(m && m[2] || 'farthest-corner', shape, gradientCenter, radius, bounds);
|
18093 |
-
|
18094 |
-
return new RadialGradient(parseColorStops(args, m ? 1 : 0, Math.min(gradientRadius.x, gradientRadius.y)), shape, gradientCenter, gradientRadius);
|
18095 |
-
};
|
18096 |
-
|
18097 |
-
var calculateGradientDirection = function calculateGradientDirection(radian, bounds) {
|
18098 |
-
var width = bounds.width;
|
18099 |
-
var height = bounds.height;
|
18100 |
-
var HALF_WIDTH = width * 0.5;
|
18101 |
-
var HALF_HEIGHT = height * 0.5;
|
18102 |
-
var lineLength = Math.abs(width * Math.sin(radian)) + Math.abs(height * Math.cos(radian));
|
18103 |
-
var HALF_LINE_LENGTH = lineLength / 2;
|
18104 |
-
|
18105 |
-
var x0 = HALF_WIDTH + Math.sin(radian) * HALF_LINE_LENGTH;
|
18106 |
-
var y0 = HALF_HEIGHT - Math.cos(radian) * HALF_LINE_LENGTH;
|
18107 |
-
var x1 = width - x0;
|
18108 |
-
var y1 = height - y0;
|
18109 |
-
|
18110 |
-
return { x0: x0, x1: x1, y0: y0, y1: y1 };
|
18111 |
-
};
|
18112 |
-
|
18113 |
-
var parseTopRight = function parseTopRight(bounds) {
|
18114 |
-
return Math.acos(bounds.width / 2 / ((0, _Util.distance)(bounds.width, bounds.height) / 2));
|
18115 |
-
};
|
18116 |
-
|
18117 |
-
var parseSideOrCorner = function parseSideOrCorner(side, bounds) {
|
18118 |
-
switch (side) {
|
18119 |
-
case 'bottom':
|
18120 |
-
case 'to top':
|
18121 |
-
return calculateGradientDirection(0, bounds);
|
18122 |
-
case 'left':
|
18123 |
-
case 'to right':
|
18124 |
-
return calculateGradientDirection(Math.PI / 2, bounds);
|
18125 |
-
case 'right':
|
18126 |
-
case 'to left':
|
18127 |
-
return calculateGradientDirection(3 * Math.PI / 2, bounds);
|
18128 |
-
case 'top right':
|
18129 |
-
case 'right top':
|
18130 |
-
case 'to bottom left':
|
18131 |
-
case 'to left bottom':
|
18132 |
-
return calculateGradientDirection(Math.PI + parseTopRight(bounds), bounds);
|
18133 |
-
case 'top left':
|
18134 |
-
case 'left top':
|
18135 |
-
case 'to bottom right':
|
18136 |
-
case 'to right bottom':
|
18137 |
-
return calculateGradientDirection(Math.PI - parseTopRight(bounds), bounds);
|
18138 |
-
case 'bottom left':
|
18139 |
-
case 'left bottom':
|
18140 |
-
case 'to top right':
|
18141 |
-
case 'to right top':
|
18142 |
-
return calculateGradientDirection(parseTopRight(bounds), bounds);
|
18143 |
-
case 'bottom right':
|
18144 |
-
case 'right bottom':
|
18145 |
-
case 'to top left':
|
18146 |
-
case 'to left top':
|
18147 |
-
return calculateGradientDirection(2 * Math.PI - parseTopRight(bounds), bounds);
|
18148 |
-
case 'top':
|
18149 |
-
case 'to bottom':
|
18150 |
-
default:
|
18151 |
-
return calculateGradientDirection(Math.PI, bounds);
|
18152 |
-
}
|
18153 |
-
};
|
18154 |
-
|
18155 |
-
var parsePercentageAngle = function parsePercentageAngle(angle, bounds) {
|
18156 |
-
var _angle$split$map = angle.split(' ').map(parseFloat),
|
18157 |
-
_angle$split$map2 = _slicedToArray(_angle$split$map, 2),
|
18158 |
-
left = _angle$split$map2[0],
|
18159 |
-
top = _angle$split$map2[1];
|
18160 |
-
|
18161 |
-
var ratio = left / 100 * bounds.width / (top / 100 * bounds.height);
|
18162 |
-
|
18163 |
-
return calculateGradientDirection(Math.atan(isNaN(ratio) ? 1 : ratio) + Math.PI / 2, bounds);
|
18164 |
-
};
|
18165 |
-
|
18166 |
-
var findCorner = function findCorner(bounds, x, y, closest) {
|
18167 |
-
var corners = [{ x: 0, y: 0 }, { x: 0, y: bounds.height }, { x: bounds.width, y: 0 }, { x: bounds.width, y: bounds.height }];
|
18168 |
-
|
18169 |
-
// $FlowFixMe
|
18170 |
-
return corners.reduce(function (stat, corner) {
|
18171 |
-
var d = (0, _Util.distance)(x - corner.x, y - corner.y);
|
18172 |
-
if (closest ? d < stat.optimumDistance : d > stat.optimumDistance) {
|
18173 |
-
return {
|
18174 |
-
optimumCorner: corner,
|
18175 |
-
optimumDistance: d
|
18176 |
-
};
|
18177 |
-
}
|
18178 |
-
|
18179 |
-
return stat;
|
18180 |
-
}, {
|
18181 |
-
optimumDistance: closest ? Infinity : -Infinity,
|
18182 |
-
optimumCorner: null
|
18183 |
-
}).optimumCorner;
|
18184 |
-
};
|
18185 |
-
|
18186 |
-
var calculateRadius = function calculateRadius(extent, shape, center, radius, bounds) {
|
18187 |
-
var x = center.x;
|
18188 |
-
var y = center.y;
|
18189 |
-
var rx = 0;
|
18190 |
-
var ry = 0;
|
18191 |
-
|
18192 |
-
switch (extent) {
|
18193 |
-
case 'closest-side':
|
18194 |
-
// The ending shape is sized so that that it exactly meets the side of the gradient box closest to the gradient’s center.
|
18195 |
-
// If the shape is an ellipse, it exactly meets the closest side in each dimension.
|
18196 |
-
if (shape === RADIAL_GRADIENT_SHAPE.CIRCLE) {
|
18197 |
-
rx = ry = Math.min(Math.abs(x), Math.abs(x - bounds.width), Math.abs(y), Math.abs(y - bounds.height));
|
18198 |
-
} else if (shape === RADIAL_GRADIENT_SHAPE.ELLIPSE) {
|
18199 |
-
rx = Math.min(Math.abs(x), Math.abs(x - bounds.width));
|
18200 |
-
ry = Math.min(Math.abs(y), Math.abs(y - bounds.height));
|
18201 |
-
}
|
18202 |
-
break;
|
18203 |
-
|
18204 |
-
case 'closest-corner':
|
18205 |
-
// The ending shape is sized so that that it passes through the corner of the gradient box closest to the gradient’s center.
|
18206 |
-
// If the shape is an ellipse, the ending shape is given the same aspect-ratio it would have if closest-side were specified.
|
18207 |
-
if (shape === RADIAL_GRADIENT_SHAPE.CIRCLE) {
|
18208 |
-
rx = ry = Math.min((0, _Util.distance)(x, y), (0, _Util.distance)(x, y - bounds.height), (0, _Util.distance)(x - bounds.width, y), (0, _Util.distance)(x - bounds.width, y - bounds.height));
|
18209 |
-
} else if (shape === RADIAL_GRADIENT_SHAPE.ELLIPSE) {
|
18210 |
-
// Compute the ratio ry/rx (which is to be the same as for "closest-side")
|
18211 |
-
var c = Math.min(Math.abs(y), Math.abs(y - bounds.height)) / Math.min(Math.abs(x), Math.abs(x - bounds.width));
|
18212 |
-
var corner = findCorner(bounds, x, y, true);
|
18213 |
-
rx = (0, _Util.distance)(corner.x - x, (corner.y - y) / c);
|
18214 |
-
ry = c * rx;
|
18215 |
-
}
|
18216 |
-
break;
|
18217 |
-
|
18218 |
-
case 'farthest-side':
|
18219 |
-
// Same as closest-side, except the ending shape is sized based on the farthest side(s)
|
18220 |
-
if (shape === RADIAL_GRADIENT_SHAPE.CIRCLE) {
|
18221 |
-
rx = ry = Math.max(Math.abs(x), Math.abs(x - bounds.width), Math.abs(y), Math.abs(y - bounds.height));
|
18222 |
-
} else if (shape === RADIAL_GRADIENT_SHAPE.ELLIPSE) {
|
18223 |
-
rx = Math.max(Math.abs(x), Math.abs(x - bounds.width));
|
18224 |
-
ry = Math.max(Math.abs(y), Math.abs(y - bounds.height));
|
18225 |
-
}
|
18226 |
-
break;
|
18227 |
-
|
18228 |
-
case 'farthest-corner':
|
18229 |
-
// Same as closest-corner, except the ending shape is sized based on the farthest corner.
|
18230 |
-
// If the shape is an ellipse, the ending shape is given the same aspect ratio it would have if farthest-side were specified.
|
18231 |
-
if (shape === RADIAL_GRADIENT_SHAPE.CIRCLE) {
|
18232 |
-
rx = ry = Math.max((0, _Util.distance)(x, y), (0, _Util.distance)(x, y - bounds.height), (0, _Util.distance)(x - bounds.width, y), (0, _Util.distance)(x - bounds.width, y - bounds.height));
|
18233 |
-
} else if (shape === RADIAL_GRADIENT_SHAPE.ELLIPSE) {
|
18234 |
-
// Compute the ratio ry/rx (which is to be the same as for "farthest-side")
|
18235 |
-
var _c = Math.max(Math.abs(y), Math.abs(y - bounds.height)) / Math.max(Math.abs(x), Math.abs(x - bounds.width));
|
18236 |
-
var _corner = findCorner(bounds, x, y, false);
|
18237 |
-
rx = (0, _Util.distance)(_corner.x - x, (_corner.y - y) / _c);
|
18238 |
-
ry = _c * rx;
|
18239 |
-
}
|
18240 |
-
break;
|
18241 |
-
|
18242 |
-
default:
|
18243 |
-
// pixel or percentage values
|
18244 |
-
rx = radius.x || 0;
|
18245 |
-
ry = radius.y !== undefined ? radius.y : rx;
|
18246 |
-
break;
|
18247 |
-
}
|
18248 |
-
|
18249 |
-
return {
|
18250 |
-
x: rx,
|
18251 |
-
y: ry
|
18252 |
-
};
|
18253 |
-
};
|
18254 |
-
|
18255 |
-
var transformWebkitRadialGradientArgs = exports.transformWebkitRadialGradientArgs = function transformWebkitRadialGradientArgs(args) {
|
18256 |
-
var shape = '';
|
18257 |
-
var radius = '';
|
18258 |
-
var extent = '';
|
18259 |
-
var position = '';
|
18260 |
-
var idx = 0;
|
18261 |
-
|
18262 |
-
var POSITION = /^(left|center|right|\d+(?:px|r?em|%)?)(?:\s+(top|center|bottom|\d+(?:px|r?em|%)?))?$/i;
|
18263 |
-
var SHAPE_AND_EXTENT = /^(circle|ellipse)?\s*(closest-side|closest-corner|farthest-side|farthest-corner|contain|cover)?$/i;
|
18264 |
-
var RADIUS = /^\d+(px|r?em|%)?(?:\s+\d+(px|r?em|%)?)?$/i;
|
18265 |
-
|
18266 |
-
var matchStartPosition = args[idx].match(POSITION);
|
18267 |
-
if (matchStartPosition) {
|
18268 |
-
idx++;
|
18269 |
-
}
|
18270 |
-
|
18271 |
-
var matchShapeExtent = args[idx].match(SHAPE_AND_EXTENT);
|
18272 |
-
if (matchShapeExtent) {
|
18273 |
-
shape = matchShapeExtent[1] || '';
|
18274 |
-
extent = matchShapeExtent[2] || '';
|
18275 |
-
if (extent === 'contain') {
|
18276 |
-
extent = 'closest-side';
|
18277 |
-
} else if (extent === 'cover') {
|
18278 |
-
extent = 'farthest-corner';
|
18279 |
-
}
|
18280 |
-
idx++;
|
18281 |
-
}
|
18282 |
-
|
18283 |
-
var matchStartRadius = args[idx].match(RADIUS);
|
18284 |
-
if (matchStartRadius) {
|
18285 |
-
idx++;
|
18286 |
-
}
|
18287 |
-
|
18288 |
-
var matchEndPosition = args[idx].match(POSITION);
|
18289 |
-
if (matchEndPosition) {
|
18290 |
-
idx++;
|
18291 |
-
}
|
18292 |
-
|
18293 |
-
var matchEndRadius = args[idx].match(RADIUS);
|
18294 |
-
if (matchEndRadius) {
|
18295 |
-
idx++;
|
18296 |
-
}
|
18297 |
-
|
18298 |
-
var matchPosition = matchEndPosition || matchStartPosition;
|
18299 |
-
if (matchPosition && matchPosition[1]) {
|
18300 |
-
position = matchPosition[1] + (/^\d+$/.test(matchPosition[1]) ? 'px' : '');
|
18301 |
-
if (matchPosition[2]) {
|
18302 |
-
position += ' ' + matchPosition[2] + (/^\d+$/.test(matchPosition[2]) ? 'px' : '');
|
18303 |
-
}
|
18304 |
-
}
|
18305 |
-
|
18306 |
-
var matchRadius = matchEndRadius || matchStartRadius;
|
18307 |
-
if (matchRadius) {
|
18308 |
-
radius = matchRadius[0];
|
18309 |
-
if (!matchRadius[1]) {
|
18310 |
-
radius += 'px';
|
18311 |
-
}
|
18312 |
-
}
|
18313 |
-
|
18314 |
-
if (position && !shape && !radius && !extent) {
|
18315 |
-
radius = position;
|
18316 |
-
position = '';
|
18317 |
-
}
|
18318 |
-
|
18319 |
-
if (position) {
|
18320 |
-
position = 'at ' + position;
|
18321 |
-
}
|
18322 |
-
|
18323 |
-
return [[shape, extent, radius, position].filter(function (s) {
|
18324 |
-
return !!s;
|
18325 |
-
}).join(' ')].concat(args.slice(idx));
|
18326 |
-
};
|
18327 |
-
|
18328 |
-
var transformObsoleteColorStops = function transformObsoleteColorStops(args) {
|
18329 |
-
return args.map(function (color) {
|
18330 |
-
return color.match(FROM_TO_COLORSTOP);
|
18331 |
-
})
|
18332 |
-
// $FlowFixMe
|
18333 |
-
.map(function (v, index) {
|
18334 |
-
if (!v) {
|
18335 |
-
return args[index];
|
18336 |
-
}
|
18337 |
-
|
18338 |
-
switch (v[1]) {
|
18339 |
-
case 'from':
|
18340 |
-
return v[4] + ' 0%';
|
18341 |
-
case 'to':
|
18342 |
-
return v[4] + ' 100%';
|
18343 |
-
case 'color-stop':
|
18344 |
-
if (v[3] === '%') {
|
18345 |
-
return v[4] + ' ' + v[2];
|
18346 |
-
}
|
18347 |
-
return v[4] + ' ' + parseFloat(v[2]) * 100 + '%';
|
18348 |
-
}
|
18349 |
-
});
|
18350 |
-
};
|
18351 |
-
|
18352 |
-
/***/ }),
|
18353 |
-
/* 53 */
|
18354 |
-
/***/ (function(module, exports, __webpack_require__) {
|
18355 |
-
|
18356 |
-
"use strict";
|
18357 |
-
|
18358 |
-
|
18359 |
-
Object.defineProperty(exports, "__esModule", {
|
18360 |
-
value: true
|
18361 |
-
});
|
18362 |
-
var ANGLE = /([+-]?\d*\.?\d+)(deg|grad|rad|turn)/i;
|
18363 |
-
|
18364 |
-
var parseAngle = exports.parseAngle = function parseAngle(angle) {
|
18365 |
-
var match = angle.match(ANGLE);
|
18366 |
-
|
18367 |
-
if (match) {
|
18368 |
-
var value = parseFloat(match[1]);
|
18369 |
-
switch (match[2].toLowerCase()) {
|
18370 |
-
case 'deg':
|
18371 |
-
return Math.PI * value / 180;
|
18372 |
-
case 'grad':
|
18373 |
-
return Math.PI / 200 * value;
|
18374 |
-
case 'rad':
|
18375 |
-
return value;
|
18376 |
-
case 'turn':
|
18377 |
-
return Math.PI * 2 * value;
|
18378 |
-
}
|
18379 |
-
}
|
18380 |
-
|
18381 |
-
return null;
|
18382 |
-
};
|
18383 |
-
|
18384 |
-
/***/ }),
|
18385 |
-
/* 54 */
|
18386 |
-
/***/ (function(module, exports, __webpack_require__) {
|
18387 |
-
|
18388 |
-
"use strict";
|
18389 |
-
|
18390 |
-
|
18391 |
-
Object.defineProperty(exports, "__esModule", {
|
18392 |
-
value: true
|
18393 |
-
});
|
18394 |
-
exports.cloneWindow = exports.DocumentCloner = undefined;
|
18395 |
-
|
18396 |
-
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
|
18397 |
-
|
18398 |
-
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
18399 |
-
|
18400 |
-
var _Bounds = __webpack_require__(2);
|
18401 |
-
|
18402 |
-
var _Proxy = __webpack_require__(26);
|
18403 |
-
|
18404 |
-
var _ResourceLoader = __webpack_require__(55);
|
18405 |
-
|
18406 |
-
var _ResourceLoader2 = _interopRequireDefault(_ResourceLoader);
|
18407 |
-
|
18408 |
-
var _Util = __webpack_require__(4);
|
18409 |
-
|
18410 |
-
var _background = __webpack_require__(5);
|
18411 |
-
|
18412 |
-
var _CanvasRenderer = __webpack_require__(15);
|
18413 |
-
|
18414 |
-
var _CanvasRenderer2 = _interopRequireDefault(_CanvasRenderer);
|
18415 |
-
|
18416 |
-
var _PseudoNodeContent = __webpack_require__(56);
|
18417 |
-
|
18418 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
18419 |
-
|
18420 |
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
18421 |
-
|
18422 |
-
var IGNORE_ATTRIBUTE = 'data-html2canvas-ignore';
|
18423 |
-
|
18424 |
-
var DocumentCloner = exports.DocumentCloner = function () {
|
18425 |
-
function DocumentCloner(element, options, logger, copyInline, renderer) {
|
18426 |
-
_classCallCheck(this, DocumentCloner);
|
18427 |
-
|
18428 |
-
this.referenceElement = element;
|
18429 |
-
this.scrolledElements = [];
|
18430 |
-
this.copyStyles = copyInline;
|
18431 |
-
this.inlineImages = copyInline;
|
18432 |
-
this.logger = logger;
|
18433 |
-
this.options = options;
|
18434 |
-
this.renderer = renderer;
|
18435 |
-
this.resourceLoader = new _ResourceLoader2.default(options, logger, window);
|
18436 |
-
this.pseudoContentData = {
|
18437 |
-
counters: {},
|
18438 |
-
quoteDepth: 0
|
18439 |
-
};
|
18440 |
-
// $FlowFixMe
|
18441 |
-
this.documentElement = this.cloneNode(element.ownerDocument.documentElement);
|
18442 |
-
}
|
18443 |
-
|
18444 |
-
_createClass(DocumentCloner, [{
|
18445 |
-
key: 'inlineAllImages',
|
18446 |
-
value: function inlineAllImages(node) {
|
18447 |
-
var _this = this;
|
18448 |
-
|
18449 |
-
if (this.inlineImages && node) {
|
18450 |
-
var style = node.style;
|
18451 |
-
Promise.all((0, _background.parseBackgroundImage)(style.backgroundImage).map(function (backgroundImage) {
|
18452 |
-
if (backgroundImage.method === 'url') {
|
18453 |
-
return _this.resourceLoader.inlineImage(backgroundImage.args[0]).then(function (img) {
|
18454 |
-
return img && typeof img.src === 'string' ? 'url("' + img.src + '")' : 'none';
|
18455 |
-
}).catch(function (e) {
|
18456 |
-
if (true) {
|
18457 |
-
_this.logger.log('Unable to load image', e);
|
18458 |
-
}
|
18459 |
-
});
|
18460 |
-
}
|
18461 |
-
return Promise.resolve('' + backgroundImage.prefix + backgroundImage.method + '(' + backgroundImage.args.join(',') + ')');
|
18462 |
-
})).then(function (backgroundImages) {
|
18463 |
-
if (backgroundImages.length > 1) {
|
18464 |
-
// TODO Multiple backgrounds somehow broken in Chrome
|
18465 |
-
style.backgroundColor = '';
|
18466 |
-
}
|
18467 |
-
style.backgroundImage = backgroundImages.join(',');
|
18468 |
-
});
|
18469 |
-
|
18470 |
-
if (node instanceof HTMLImageElement) {
|
18471 |
-
this.resourceLoader.inlineImage(node.src).then(function (img) {
|
18472 |
-
if (img && node instanceof HTMLImageElement && node.parentNode) {
|
18473 |
-
var parentNode = node.parentNode;
|
18474 |
-
var clonedChild = (0, _Util.copyCSSStyles)(node.style, img.cloneNode(false));
|
18475 |
-
parentNode.replaceChild(clonedChild, node);
|
18476 |
-
}
|
18477 |
-
}).catch(function (e) {
|
18478 |
-
if (true) {
|
18479 |
-
_this.logger.log('Unable to load image', e);
|
18480 |
-
}
|
18481 |
-
});
|
18482 |
-
}
|
18483 |
-
}
|
18484 |
-
}
|
18485 |
-
}, {
|
18486 |
-
key: 'inlineFonts',
|
18487 |
-
value: function inlineFonts(document) {
|
18488 |
-
var _this2 = this;
|
18489 |
-
|
18490 |
-
return Promise.all(Array.from(document.styleSheets).map(function (sheet) {
|
18491 |
-
if (sheet.href) {
|
18492 |
-
return fetch(sheet.href).then(function (res) {
|
18493 |
-
return res.text();
|
18494 |
-
}).then(function (text) {
|
18495 |
-
return createStyleSheetFontsFromText(text, sheet.href);
|
18496 |
-
}).catch(function (e) {
|
18497 |
-
if (true) {
|
18498 |
-
_this2.logger.log('Unable to load stylesheet', e);
|
18499 |
-
}
|
18500 |
-
return [];
|
18501 |
-
});
|
18502 |
-
}
|
18503 |
-
return getSheetFonts(sheet, document);
|
18504 |
-
})).then(function (fonts) {
|
18505 |
-
return fonts.reduce(function (acc, font) {
|
18506 |
-
return acc.concat(font);
|
18507 |
-
}, []);
|
18508 |
-
}).then(function (fonts) {
|
18509 |
-
return Promise.all(fonts.map(function (font) {
|
18510 |
-
return fetch(font.formats[0].src).then(function (response) {
|
18511 |
-
return response.blob();
|
18512 |
-
}).then(function (blob) {
|
18513 |
-
return new Promise(function (resolve, reject) {
|
18514 |
-
var reader = new FileReader();
|
18515 |
-
reader.onerror = reject;
|
18516 |
-
reader.onload = function () {
|
18517 |
-
// $FlowFixMe
|
18518 |
-
var result = reader.result;
|
18519 |
-
resolve(result);
|
18520 |
-
};
|
18521 |
-
reader.readAsDataURL(blob);
|
18522 |
-
});
|
18523 |
-
}).then(function (dataUri) {
|
18524 |
-
font.fontFace.setProperty('src', 'url("' + dataUri + '")');
|
18525 |
-
return '@font-face {' + font.fontFace.cssText + ' ';
|
18526 |
-
});
|
18527 |
-
}));
|
18528 |
-
}).then(function (fontCss) {
|
18529 |
-
var style = document.createElement('style');
|
18530 |
-
style.textContent = fontCss.join('\n');
|
18531 |
-
_this2.documentElement.appendChild(style);
|
18532 |
-
});
|
18533 |
-
}
|
18534 |
-
}, {
|
18535 |
-
key: 'createElementClone',
|
18536 |
-
value: function createElementClone(node) {
|
18537 |
-
var _this3 = this;
|
18538 |
-
|
18539 |
-
if (this.copyStyles && node instanceof HTMLCanvasElement) {
|
18540 |
-
var img = node.ownerDocument.createElement('img');
|
18541 |
-
try {
|
18542 |
-
img.src = node.toDataURL();
|
18543 |
-
return img;
|
18544 |
-
} catch (e) {
|
18545 |
-
if (true) {
|
18546 |
-
this.logger.log('Unable to clone canvas contents, canvas is tainted');
|
18547 |
-
}
|
18548 |
-
}
|
18549 |
-
}
|
18550 |
-
|
18551 |
-
if (node instanceof HTMLIFrameElement) {
|
18552 |
-
var tempIframe = node.cloneNode(false);
|
18553 |
-
var iframeKey = generateIframeKey();
|
18554 |
-
tempIframe.setAttribute('data-html2canvas-internal-iframe-key', iframeKey);
|
18555 |
-
|
18556 |
-
var _parseBounds = (0, _Bounds.parseBounds)(node, 0, 0),
|
18557 |
-
width = _parseBounds.width,
|
18558 |
-
height = _parseBounds.height;
|
18559 |
-
|
18560 |
-
this.resourceLoader.cache[iframeKey] = getIframeDocumentElement(node, this.options).then(function (documentElement) {
|
18561 |
-
return _this3.renderer(documentElement, {
|
18562 |
-
async: _this3.options.async,
|
18563 |
-
allowTaint: _this3.options.allowTaint,
|
18564 |
-
backgroundColor: '#ffffff',
|
18565 |
-
canvas: null,
|
18566 |
-
imageTimeout: _this3.options.imageTimeout,
|
18567 |
-
logging: _this3.options.logging,
|
18568 |
-
proxy: _this3.options.proxy,
|
18569 |
-
removeContainer: _this3.options.removeContainer,
|
18570 |
-
scale: _this3.options.scale,
|
18571 |
-
foreignObjectRendering: _this3.options.foreignObjectRendering,
|
18572 |
-
useCORS: _this3.options.useCORS,
|
18573 |
-
target: new _CanvasRenderer2.default(),
|
18574 |
-
width: width,
|
18575 |
-
height: height,
|
18576 |
-
x: 0,
|
18577 |
-
y: 0,
|
18578 |
-
windowWidth: documentElement.ownerDocument.defaultView.innerWidth,
|
18579 |
-
windowHeight: documentElement.ownerDocument.defaultView.innerHeight,
|
18580 |
-
scrollX: documentElement.ownerDocument.defaultView.pageXOffset,
|
18581 |
-
scrollY: documentElement.ownerDocument.defaultView.pageYOffset
|
18582 |
-
}, _this3.logger.child(iframeKey));
|
18583 |
-
}).then(function (canvas) {
|
18584 |
-
return new Promise(function (resolve, reject) {
|
18585 |
-
var iframeCanvas = document.createElement('img');
|
18586 |
-
iframeCanvas.onload = function () {
|
18587 |
-
return resolve(canvas);
|
18588 |
-
};
|
18589 |
-
iframeCanvas.onerror = reject;
|
18590 |
-
iframeCanvas.src = canvas.toDataURL();
|
18591 |
-
if (tempIframe.parentNode) {
|
18592 |
-
tempIframe.parentNode.replaceChild((0, _Util.copyCSSStyles)(node.ownerDocument.defaultView.getComputedStyle(node), iframeCanvas), tempIframe);
|
18593 |
-
}
|
18594 |
-
});
|
18595 |
-
});
|
18596 |
-
return tempIframe;
|
18597 |
-
}
|
18598 |
-
|
18599 |
-
if (node instanceof HTMLStyleElement && node.sheet && node.sheet.cssRules) {
|
18600 |
-
var css = [].slice.call(node.sheet.cssRules, 0).reduce(function (css, rule) {
|
18601 |
-
try {
|
18602 |
-
if (rule && rule.cssText) {
|
18603 |
-
return css + rule.cssText;
|
18604 |
-
}
|
18605 |
-
return css;
|
18606 |
-
} catch (err) {
|
18607 |
-
_this3.logger.log('Unable to access cssText property', rule.name);
|
18608 |
-
return css;
|
18609 |
-
}
|
18610 |
-
}, '');
|
18611 |
-
var style = node.cloneNode(false);
|
18612 |
-
style.textContent = css;
|
18613 |
-
return style;
|
18614 |
-
}
|
18615 |
-
|
18616 |
-
return node.cloneNode(false);
|
18617 |
-
}
|
18618 |
-
}, {
|
18619 |
-
key: 'cloneNode',
|
18620 |
-
value: function cloneNode(node) {
|
18621 |
-
var clone = node.nodeType === Node.TEXT_NODE ? document.createTextNode(node.nodeValue) : this.createElementClone(node);
|
18622 |
-
|
18623 |
-
var window = node.ownerDocument.defaultView;
|
18624 |
-
var style = node instanceof window.HTMLElement ? window.getComputedStyle(node) : null;
|
18625 |
-
var styleBefore = node instanceof window.HTMLElement ? window.getComputedStyle(node, ':before') : null;
|
18626 |
-
var styleAfter = node instanceof window.HTMLElement ? window.getComputedStyle(node, ':after') : null;
|
18627 |
-
|
18628 |
-
if (this.referenceElement === node && clone instanceof window.HTMLElement) {
|
18629 |
-
this.clonedReferenceElement = clone;
|
18630 |
-
}
|
18631 |
-
|
18632 |
-
if (clone instanceof window.HTMLBodyElement) {
|
18633 |
-
createPseudoHideStyles(clone);
|
18634 |
-
}
|
18635 |
-
|
18636 |
-
var counters = (0, _PseudoNodeContent.parseCounterReset)(style, this.pseudoContentData);
|
18637 |
-
var contentBefore = (0, _PseudoNodeContent.resolvePseudoContent)(node, styleBefore, this.pseudoContentData);
|
18638 |
-
|
18639 |
-
for (var child = node.firstChild; child; child = child.nextSibling) {
|
18640 |
-
if (child.nodeType !== Node.ELEMENT_NODE || child.nodeName !== 'SCRIPT' &&
|
18641 |
-
// $FlowFixMe
|
18642 |
-
!child.hasAttribute(IGNORE_ATTRIBUTE) && (typeof this.options.ignoreElements !== 'function' ||
|
18643 |
-
// $FlowFixMe
|
18644 |
-
!this.options.ignoreElements(child))) {
|
18645 |
-
if (!this.copyStyles || child.nodeName !== 'STYLE') {
|
18646 |
-
clone.appendChild(this.cloneNode(child));
|
18647 |
-
}
|
18648 |
-
}
|
18649 |
-
}
|
18650 |
-
|
18651 |
-
var contentAfter = (0, _PseudoNodeContent.resolvePseudoContent)(node, styleAfter, this.pseudoContentData);
|
18652 |
-
(0, _PseudoNodeContent.popCounters)(counters, this.pseudoContentData);
|
18653 |
-
|
18654 |
-
if (node instanceof window.HTMLElement && clone instanceof window.HTMLElement) {
|
18655 |
-
if (styleBefore) {
|
18656 |
-
this.inlineAllImages(inlinePseudoElement(node, clone, styleBefore, contentBefore, PSEUDO_BEFORE));
|
18657 |
-
}
|
18658 |
-
if (styleAfter) {
|
18659 |
-
this.inlineAllImages(inlinePseudoElement(node, clone, styleAfter, contentAfter, PSEUDO_AFTER));
|
18660 |
-
}
|
18661 |
-
if (style && this.copyStyles && !(node instanceof HTMLIFrameElement)) {
|
18662 |
-
(0, _Util.copyCSSStyles)(style, clone);
|
18663 |
-
}
|
18664 |
-
this.inlineAllImages(clone);
|
18665 |
-
if (node.scrollTop !== 0 || node.scrollLeft !== 0) {
|
18666 |
-
this.scrolledElements.push([clone, node.scrollLeft, node.scrollTop]);
|
18667 |
-
}
|
18668 |
-
switch (node.nodeName) {
|
18669 |
-
case 'CANVAS':
|
18670 |
-
if (!this.copyStyles) {
|
18671 |
-
cloneCanvasContents(node, clone);
|
18672 |
-
}
|
18673 |
-
break;
|
18674 |
-
case 'TEXTAREA':
|
18675 |
-
case 'SELECT':
|
18676 |
-
clone.value = node.value;
|
18677 |
-
break;
|
18678 |
-
}
|
18679 |
-
}
|
18680 |
-
return clone;
|
18681 |
-
}
|
18682 |
-
}]);
|
18683 |
-
|
18684 |
-
return DocumentCloner;
|
18685 |
-
}();
|
18686 |
-
|
18687 |
-
var getSheetFonts = function getSheetFonts(sheet, document) {
|
18688 |
-
// $FlowFixMe
|
18689 |
-
return (sheet.cssRules ? Array.from(sheet.cssRules) : []).filter(function (rule) {
|
18690 |
-
return rule.type === CSSRule.FONT_FACE_RULE;
|
18691 |
-
}).map(function (rule) {
|
18692 |
-
var src = (0, _background.parseBackgroundImage)(rule.style.getPropertyValue('src'));
|
18693 |
-
var formats = [];
|
18694 |
-
for (var i = 0; i < src.length; i++) {
|
18695 |
-
if (src[i].method === 'url' && src[i + 1] && src[i + 1].method === 'format') {
|
18696 |
-
var a = document.createElement('a');
|
18697 |
-
a.href = src[i].args[0];
|
18698 |
-
if (document.body) {
|
18699 |
-
document.body.appendChild(a);
|
18700 |
-
}
|
18701 |
-
|
18702 |
-
var font = {
|
18703 |
-
src: a.href,
|
18704 |
-
format: src[i + 1].args[0]
|
18705 |
-
};
|
18706 |
-
formats.push(font);
|
18707 |
-
}
|
18708 |
-
}
|
18709 |
-
|
18710 |
-
return {
|
18711 |
-
// TODO select correct format for browser),
|
18712 |
-
|
18713 |
-
formats: formats.filter(function (font) {
|
18714 |
-
return (/^woff/i.test(font.format)
|
18715 |
-
);
|
18716 |
-
}),
|
18717 |
-
fontFace: rule.style
|
18718 |
-
};
|
18719 |
-
}).filter(function (font) {
|
18720 |
-
return font.formats.length;
|
18721 |
-
});
|
18722 |
-
};
|
18723 |
-
|
18724 |
-
var createStyleSheetFontsFromText = function createStyleSheetFontsFromText(text, baseHref) {
|
18725 |
-
var doc = document.implementation.createHTMLDocument('');
|
18726 |
-
var base = document.createElement('base');
|
18727 |
-
// $FlowFixMe
|
18728 |
-
base.href = baseHref;
|
18729 |
-
var style = document.createElement('style');
|
18730 |
-
|
18731 |
-
style.textContent = text;
|
18732 |
-
if (doc.head) {
|
18733 |
-
doc.head.appendChild(base);
|
18734 |
-
}
|
18735 |
-
if (doc.body) {
|
18736 |
-
doc.body.appendChild(style);
|
18737 |
-
}
|
18738 |
-
|
18739 |
-
return style.sheet ? getSheetFonts(style.sheet, doc) : [];
|
18740 |
-
};
|
18741 |
-
|
18742 |
-
var restoreOwnerScroll = function restoreOwnerScroll(ownerDocument, x, y) {
|
18743 |
-
if (ownerDocument.defaultView && (x !== ownerDocument.defaultView.pageXOffset || y !== ownerDocument.defaultView.pageYOffset)) {
|
18744 |
-
ownerDocument.defaultView.scrollTo(x, y);
|
18745 |
-
}
|
18746 |
-
};
|
18747 |
-
|
18748 |
-
var cloneCanvasContents = function cloneCanvasContents(canvas, clonedCanvas) {
|
18749 |
-
try {
|
18750 |
-
if (clonedCanvas) {
|
18751 |
-
clonedCanvas.width = canvas.width;
|
18752 |
-
clonedCanvas.height = canvas.height;
|
18753 |
-
var ctx = canvas.getContext('2d');
|
18754 |
-
var clonedCtx = clonedCanvas.getContext('2d');
|
18755 |
-
if (ctx) {
|
18756 |
-
clonedCtx.putImageData(ctx.getImageData(0, 0, canvas.width, canvas.height), 0, 0);
|
18757 |
-
} else {
|
18758 |
-
clonedCtx.drawImage(canvas, 0, 0);
|
18759 |
-
}
|
18760 |
-
}
|
18761 |
-
} catch (e) {}
|
18762 |
-
};
|
18763 |
-
|
18764 |
-
var inlinePseudoElement = function inlinePseudoElement(node, clone, style, contentItems, pseudoElt) {
|
18765 |
-
if (!style || !style.content || style.content === 'none' || style.content === '-moz-alt-content' || style.display === 'none') {
|
18766 |
-
return;
|
18767 |
-
}
|
18768 |
-
|
18769 |
-
var anonymousReplacedElement = clone.ownerDocument.createElement('html2canvaspseudoelement');
|
18770 |
-
(0, _Util.copyCSSStyles)(style, anonymousReplacedElement);
|
18771 |
-
|
18772 |
-
if (contentItems) {
|
18773 |
-
var len = contentItems.length;
|
18774 |
-
for (var i = 0; i < len; i++) {
|
18775 |
-
var item = contentItems[i];
|
18776 |
-
switch (item.type) {
|
18777 |
-
case _PseudoNodeContent.PSEUDO_CONTENT_ITEM_TYPE.IMAGE:
|
18778 |
-
var img = clone.ownerDocument.createElement('img');
|
18779 |
-
img.src = (0, _background.parseBackgroundImage)('url(' + item.value + ')')[0].args[0];
|
18780 |
-
img.style.opacity = '1';
|
18781 |
-
anonymousReplacedElement.appendChild(img);
|
18782 |
-
break;
|
18783 |
-
case _PseudoNodeContent.PSEUDO_CONTENT_ITEM_TYPE.TEXT:
|
18784 |
-
anonymousReplacedElement.appendChild(clone.ownerDocument.createTextNode(item.value));
|
18785 |
-
break;
|
18786 |
-
}
|
18787 |
-
}
|
18788 |
-
}
|
18789 |
-
|
18790 |
-
anonymousReplacedElement.className = PSEUDO_HIDE_ELEMENT_CLASS_BEFORE + ' ' + PSEUDO_HIDE_ELEMENT_CLASS_AFTER;
|
18791 |
-
clone.className += pseudoElt === PSEUDO_BEFORE ? ' ' + PSEUDO_HIDE_ELEMENT_CLASS_BEFORE : ' ' + PSEUDO_HIDE_ELEMENT_CLASS_AFTER;
|
18792 |
-
if (pseudoElt === PSEUDO_BEFORE) {
|
18793 |
-
clone.insertBefore(anonymousReplacedElement, clone.firstChild);
|
18794 |
-
} else {
|
18795 |
-
clone.appendChild(anonymousReplacedElement);
|
18796 |
-
}
|
18797 |
-
|
18798 |
-
return anonymousReplacedElement;
|
18799 |
-
};
|
18800 |
-
|
18801 |
-
var URL_REGEXP = /^url\((.+)\)$/i;
|
18802 |
-
var PSEUDO_BEFORE = ':before';
|
18803 |
-
var PSEUDO_AFTER = ':after';
|
18804 |
-
var PSEUDO_HIDE_ELEMENT_CLASS_BEFORE = '___html2canvas___pseudoelement_before';
|
18805 |
-
var PSEUDO_HIDE_ELEMENT_CLASS_AFTER = '___html2canvas___pseudoelement_after';
|
18806 |
-
|
18807 |
-
var PSEUDO_HIDE_ELEMENT_STYLE = '{\n content: "" !important;\n display: none !important;\n}';
|
18808 |
-
|
18809 |
-
var createPseudoHideStyles = function createPseudoHideStyles(body) {
|
18810 |
-
createStyles(body, '.' + PSEUDO_HIDE_ELEMENT_CLASS_BEFORE + PSEUDO_BEFORE + PSEUDO_HIDE_ELEMENT_STYLE + '\n .' + PSEUDO_HIDE_ELEMENT_CLASS_AFTER + PSEUDO_AFTER + PSEUDO_HIDE_ELEMENT_STYLE);
|
18811 |
-
};
|
18812 |
-
|
18813 |
-
var createStyles = function createStyles(body, styles) {
|
18814 |
-
var style = body.ownerDocument.createElement('style');
|
18815 |
-
style.innerHTML = styles;
|
18816 |
-
body.appendChild(style);
|
18817 |
-
};
|
18818 |
-
|
18819 |
-
var initNode = function initNode(_ref) {
|
18820 |
-
var _ref2 = _slicedToArray(_ref, 3),
|
18821 |
-
element = _ref2[0],
|
18822 |
-
x = _ref2[1],
|
18823 |
-
y = _ref2[2];
|
18824 |
-
|
18825 |
-
element.scrollLeft = x;
|
18826 |
-
element.scrollTop = y;
|
18827 |
-
};
|
18828 |
-
|
18829 |
-
var generateIframeKey = function generateIframeKey() {
|
18830 |
-
return Math.ceil(Date.now() + Math.random() * 10000000).toString(16);
|
18831 |
-
};
|
18832 |
-
|
18833 |
-
var DATA_URI_REGEXP = /^data:text\/(.+);(base64)?,(.*)$/i;
|
18834 |
-
|
18835 |
-
var getIframeDocumentElement = function getIframeDocumentElement(node, options) {
|
18836 |
-
try {
|
18837 |
-
return Promise.resolve(node.contentWindow.document.documentElement);
|
18838 |
-
} catch (e) {
|
18839 |
-
return options.proxy ? (0, _Proxy.Proxy)(node.src, options).then(function (html) {
|
18840 |
-
var match = html.match(DATA_URI_REGEXP);
|
18841 |
-
if (!match) {
|
18842 |
-
return Promise.reject();
|
18843 |
-
}
|
18844 |
-
|
18845 |
-
return match[2] === 'base64' ? window.atob(decodeURIComponent(match[3])) : decodeURIComponent(match[3]);
|
18846 |
-
}).then(function (html) {
|
18847 |
-
return createIframeContainer(node.ownerDocument, (0, _Bounds.parseBounds)(node, 0, 0)).then(function (cloneIframeContainer) {
|
18848 |
-
var cloneWindow = cloneIframeContainer.contentWindow;
|
18849 |
-
var documentClone = cloneWindow.document;
|
18850 |
-
|
18851 |
-
documentClone.open();
|
18852 |
-
documentClone.write(html);
|
18853 |
-
var iframeLoad = iframeLoader(cloneIframeContainer).then(function () {
|
18854 |
-
return documentClone.documentElement;
|
18855 |
-
});
|
18856 |
-
|
18857 |
-
documentClone.close();
|
18858 |
-
return iframeLoad;
|
18859 |
-
});
|
18860 |
-
}) : Promise.reject();
|
18861 |
-
}
|
18862 |
-
};
|
18863 |
-
|
18864 |
-
var createIframeContainer = function createIframeContainer(ownerDocument, bounds) {
|
18865 |
-
var cloneIframeContainer = ownerDocument.createElement('iframe');
|
18866 |
-
|
18867 |
-
cloneIframeContainer.className = 'html2canvas-container';
|
18868 |
-
cloneIframeContainer.style.visibility = 'hidden';
|
18869 |
-
cloneIframeContainer.style.position = 'fixed';
|
18870 |
-
cloneIframeContainer.style.left = '-10000px';
|
18871 |
-
cloneIframeContainer.style.top = '0px';
|
18872 |
-
cloneIframeContainer.style.border = '0';
|
18873 |
-
cloneIframeContainer.width = bounds.width.toString();
|
18874 |
-
cloneIframeContainer.height = bounds.height.toString();
|
18875 |
-
cloneIframeContainer.scrolling = 'no'; // ios won't scroll without it
|
18876 |
-
cloneIframeContainer.setAttribute(IGNORE_ATTRIBUTE, 'true');
|
18877 |
-
if (!ownerDocument.body) {
|
18878 |
-
return Promise.reject( true ? 'Body element not found in Document that is getting rendered' : '');
|
18879 |
-
}
|
18880 |
-
|
18881 |
-
ownerDocument.body.appendChild(cloneIframeContainer);
|
18882 |
-
|
18883 |
-
return Promise.resolve(cloneIframeContainer);
|
18884 |
-
};
|
18885 |
-
|
18886 |
-
var iframeLoader = function iframeLoader(cloneIframeContainer) {
|
18887 |
-
var cloneWindow = cloneIframeContainer.contentWindow;
|
18888 |
-
var documentClone = cloneWindow.document;
|
18889 |
-
|
18890 |
-
return new Promise(function (resolve, reject) {
|
18891 |
-
cloneWindow.onload = cloneIframeContainer.onload = documentClone.onreadystatechange = function () {
|
18892 |
-
var interval = setInterval(function () {
|
18893 |
-
if (documentClone.body.childNodes.length > 0 && documentClone.readyState === 'complete') {
|
18894 |
-
clearInterval(interval);
|
18895 |
-
resolve(cloneIframeContainer);
|
18896 |
-
}
|
18897 |
-
}, 50);
|
18898 |
-
};
|
18899 |
-
});
|
18900 |
-
};
|
18901 |
-
|
18902 |
-
var cloneWindow = exports.cloneWindow = function cloneWindow(ownerDocument, bounds, referenceElement, options, logger, renderer) {
|
18903 |
-
var cloner = new DocumentCloner(referenceElement, options, logger, false, renderer);
|
18904 |
-
var scrollX = ownerDocument.defaultView.pageXOffset;
|
18905 |
-
var scrollY = ownerDocument.defaultView.pageYOffset;
|
18906 |
-
|
18907 |
-
return createIframeContainer(ownerDocument, bounds).then(function (cloneIframeContainer) {
|
18908 |
-
var cloneWindow = cloneIframeContainer.contentWindow;
|
18909 |
-
var documentClone = cloneWindow.document;
|
18910 |
-
|
18911 |
-
/* Chrome doesn't detect relative background-images assigned in inline <style> sheets when fetched through getComputedStyle
|
18912 |
-
if window url is about:blank, we can assign the url to current by writing onto the document
|
18913 |
-
*/
|
18914 |
-
|
18915 |
-
var iframeLoad = iframeLoader(cloneIframeContainer).then(function () {
|
18916 |
-
cloner.scrolledElements.forEach(initNode);
|
18917 |
-
cloneWindow.scrollTo(bounds.left, bounds.top);
|
18918 |
-
if (/(iPad|iPhone|iPod)/g.test(navigator.userAgent) && (cloneWindow.scrollY !== bounds.top || cloneWindow.scrollX !== bounds.left)) {
|
18919 |
-
documentClone.documentElement.style.top = -bounds.top + 'px';
|
18920 |
-
documentClone.documentElement.style.left = -bounds.left + 'px';
|
18921 |
-
documentClone.documentElement.style.position = 'absolute';
|
18922 |
-
}
|
18923 |
-
|
18924 |
-
var result = Promise.resolve([cloneIframeContainer, cloner.clonedReferenceElement, cloner.resourceLoader]);
|
18925 |
-
|
18926 |
-
var onclone = options.onclone;
|
18927 |
-
|
18928 |
-
return cloner.clonedReferenceElement instanceof cloneWindow.HTMLElement || cloner.clonedReferenceElement instanceof ownerDocument.defaultView.HTMLElement || cloner.clonedReferenceElement instanceof HTMLElement ? typeof onclone === 'function' ? Promise.resolve().then(function () {
|
18929 |
-
return onclone(documentClone);
|
18930 |
-
}).then(function () {
|
18931 |
-
return result;
|
18932 |
-
}) : result : Promise.reject( true ? 'Error finding the ' + referenceElement.nodeName + ' in the cloned document' : '');
|
18933 |
-
});
|
18934 |
-
|
18935 |
-
documentClone.open();
|
18936 |
-
documentClone.write(serializeDoctype(document.doctype) + '<html></html>');
|
18937 |
-
// Chrome scrolls the parent document for some reason after the write to the cloned window???
|
18938 |
-
restoreOwnerScroll(referenceElement.ownerDocument, scrollX, scrollY);
|
18939 |
-
documentClone.replaceChild(documentClone.adoptNode(cloner.documentElement), documentClone.documentElement);
|
18940 |
-
documentClone.close();
|
18941 |
-
|
18942 |
-
return iframeLoad;
|
18943 |
-
});
|
18944 |
-
};
|
18945 |
-
|
18946 |
-
var serializeDoctype = function serializeDoctype(doctype) {
|
18947 |
-
var str = '';
|
18948 |
-
if (doctype) {
|
18949 |
-
str += '<!DOCTYPE ';
|
18950 |
-
if (doctype.name) {
|
18951 |
-
str += doctype.name;
|
18952 |
-
}
|
18953 |
-
|
18954 |
-
if (doctype.internalSubset) {
|
18955 |
-
str += doctype.internalSubset;
|
18956 |
-
}
|
18957 |
-
|
18958 |
-
if (doctype.publicId) {
|
18959 |
-
str += '"' + doctype.publicId + '"';
|
18960 |
-
}
|
18961 |
-
|
18962 |
-
if (doctype.systemId) {
|
18963 |
-
str += '"' + doctype.systemId + '"';
|
18964 |
-
}
|
18965 |
-
|
18966 |
-
str += '>';
|
18967 |
-
}
|
18968 |
-
|
18969 |
-
return str;
|
18970 |
-
};
|
18971 |
-
|
18972 |
-
/***/ }),
|
18973 |
-
/* 55 */
|
18974 |
-
/***/ (function(module, exports, __webpack_require__) {
|
18975 |
-
|
18976 |
-
"use strict";
|
18977 |
-
|
18978 |
-
|
18979 |
-
Object.defineProperty(exports, "__esModule", {
|
18980 |
-
value: true
|
18981 |
-
});
|
18982 |
-
exports.ResourceStore = undefined;
|
18983 |
-
|
18984 |
-
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
18985 |
-
|
18986 |
-
var _Feature = __webpack_require__(10);
|
18987 |
-
|
18988 |
-
var _Feature2 = _interopRequireDefault(_Feature);
|
18989 |
-
|
18990 |
-
var _Proxy = __webpack_require__(26);
|
18991 |
-
|
18992 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
18993 |
-
|
18994 |
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
18995 |
-
|
18996 |
-
var ResourceLoader = function () {
|
18997 |
-
function ResourceLoader(options, logger, window) {
|
18998 |
-
_classCallCheck(this, ResourceLoader);
|
18999 |
-
|
19000 |
-
this.options = options;
|
19001 |
-
this._window = window;
|
19002 |
-
this.origin = this.getOrigin(window.location.href);
|
19003 |
-
this.cache = {};
|
19004 |
-
this.logger = logger;
|
19005 |
-
this._index = 0;
|
19006 |
-
}
|
19007 |
-
|
19008 |
-
_createClass(ResourceLoader, [{
|
19009 |
-
key: 'loadImage',
|
19010 |
-
value: function loadImage(src) {
|
19011 |
-
var _this = this;
|
19012 |
-
|
19013 |
-
if (this.hasResourceInCache(src)) {
|
19014 |
-
return src;
|
19015 |
-
}
|
19016 |
-
if (isBlobImage(src)) {
|
19017 |
-
this.cache[src] = _loadImage(src, this.options.imageTimeout || 0);
|
19018 |
-
return src;
|
19019 |
-
}
|
19020 |
-
|
19021 |
-
if (!isSVG(src) || _Feature2.default.SUPPORT_SVG_DRAWING) {
|
19022 |
-
if (this.options.allowTaint === true || isInlineImage(src) || this.isSameOrigin(src)) {
|
19023 |
-
return this.addImage(src, src, false);
|
19024 |
-
} else if (!this.isSameOrigin(src)) {
|
19025 |
-
if (typeof this.options.proxy === 'string') {
|
19026 |
-
this.cache[src] = (0, _Proxy.Proxy)(src, this.options).then(function (src) {
|
19027 |
-
return _loadImage(src, _this.options.imageTimeout || 0);
|
19028 |
-
});
|
19029 |
-
return src;
|
19030 |
-
} else if (this.options.useCORS === true && _Feature2.default.SUPPORT_CORS_IMAGES) {
|
19031 |
-
return this.addImage(src, src, true);
|
19032 |
-
}
|
19033 |
-
}
|
19034 |
-
}
|
19035 |
-
}
|
19036 |
-
}, {
|
19037 |
-
key: 'inlineImage',
|
19038 |
-
value: function inlineImage(src) {
|
19039 |
-
var _this2 = this;
|
19040 |
-
|
19041 |
-
if (isInlineImage(src)) {
|
19042 |
-
return _loadImage(src, this.options.imageTimeout || 0);
|
19043 |
-
}
|
19044 |
-
if (this.hasResourceInCache(src)) {
|
19045 |
-
return this.cache[src];
|
19046 |
-
}
|
19047 |
-
if (!this.isSameOrigin(src) && typeof this.options.proxy === 'string') {
|
19048 |
-
return this.cache[src] = (0, _Proxy.Proxy)(src, this.options).then(function (src) {
|
19049 |
-
return _loadImage(src, _this2.options.imageTimeout || 0);
|
19050 |
-
});
|
19051 |
-
}
|
19052 |
-
|
19053 |
-
return this.xhrImage(src);
|
19054 |
-
}
|
19055 |
-
}, {
|
19056 |
-
key: 'xhrImage',
|
19057 |
-
value: function xhrImage(src) {
|
19058 |
-
var _this3 = this;
|
19059 |
-
|
19060 |
-
this.cache[src] = new Promise(function (resolve, reject) {
|
19061 |
-
var xhr = new XMLHttpRequest();
|
19062 |
-
xhr.onreadystatechange = function () {
|
19063 |
-
if (xhr.readyState === 4) {
|
19064 |
-
if (xhr.status !== 200) {
|
19065 |
-
reject('Failed to fetch image ' + src.substring(0, 256) + ' with status code ' + xhr.status);
|
19066 |
-
} else {
|
19067 |
-
var reader = new FileReader();
|
19068 |
-
reader.addEventListener('load', function () {
|
19069 |
-
// $FlowFixMe
|
19070 |
-
var result = reader.result;
|
19071 |
-
resolve(result);
|
19072 |
-
}, false);
|
19073 |
-
reader.addEventListener('error', function (e) {
|
19074 |
-
return reject(e);
|
19075 |
-
}, false);
|
19076 |
-
reader.readAsDataURL(xhr.response);
|
19077 |
-
}
|
19078 |
-
}
|
19079 |
-
};
|
19080 |
-
xhr.responseType = 'blob';
|
19081 |
-
if (_this3.options.imageTimeout) {
|
19082 |
-
var timeout = _this3.options.imageTimeout;
|
19083 |
-
xhr.timeout = timeout;
|
19084 |
-
xhr.ontimeout = function () {
|
19085 |
-
return reject( true ? 'Timed out (' + timeout + 'ms) fetching ' + src.substring(0, 256) : '');
|
19086 |
-
};
|
19087 |
-
}
|
19088 |
-
xhr.open('GET', src, true);
|
19089 |
-
xhr.send();
|
19090 |
-
}).then(function (src) {
|
19091 |
-
return _loadImage(src, _this3.options.imageTimeout || 0);
|
19092 |
-
});
|
19093 |
-
|
19094 |
-
return this.cache[src];
|
19095 |
-
}
|
19096 |
-
}, {
|
19097 |
-
key: 'loadCanvas',
|
19098 |
-
value: function loadCanvas(node) {
|
19099 |
-
var key = String(this._index++);
|
19100 |
-
this.cache[key] = Promise.resolve(node);
|
19101 |
-
return key;
|
19102 |
-
}
|
19103 |
-
}, {
|
19104 |
-
key: 'hasResourceInCache',
|
19105 |
-
value: function hasResourceInCache(key) {
|
19106 |
-
return typeof this.cache[key] !== 'undefined';
|
19107 |
-
}
|
19108 |
-
}, {
|
19109 |
-
key: 'addImage',
|
19110 |
-
value: function addImage(key, src, useCORS) {
|
19111 |
-
var _this4 = this;
|
19112 |
-
|
19113 |
-
if (true) {
|
19114 |
-
this.logger.log('Added image ' + key.substring(0, 256));
|
19115 |
-
}
|
19116 |
-
|
19117 |
-
var imageLoadHandler = function imageLoadHandler(supportsDataImages) {
|
19118 |
-
return new Promise(function (resolve, reject) {
|
19119 |
-
var img = new Image();
|
19120 |
-
img.onload = function () {
|
19121 |
-
return resolve(img);
|
19122 |
-
};
|
19123 |
-
//ios safari 10.3 taints canvas with data urls unless crossOrigin is set to anonymous
|
19124 |
-
if (!supportsDataImages || useCORS) {
|
19125 |
-
img.crossOrigin = 'anonymous';
|
19126 |
-
}
|
19127 |
-
|
19128 |
-
img.onerror = reject;
|
19129 |
-
img.src = src;
|
19130 |
-
if (img.complete === true) {
|
19131 |
-
// Inline XML images may fail to parse, throwing an Error later on
|
19132 |
-
setTimeout(function () {
|
19133 |
-
resolve(img);
|
19134 |
-
}, 500);
|
19135 |
-
}
|
19136 |
-
if (_this4.options.imageTimeout) {
|
19137 |
-
var timeout = _this4.options.imageTimeout;
|
19138 |
-
setTimeout(function () {
|
19139 |
-
return reject( true ? 'Timed out (' + timeout + 'ms) fetching ' + src.substring(0, 256) : '');
|
19140 |
-
}, timeout);
|
19141 |
-
}
|
19142 |
-
});
|
19143 |
-
};
|
19144 |
-
|
19145 |
-
this.cache[key] = isInlineBase64Image(src) && !isSVG(src) ? // $FlowFixMe
|
19146 |
-
_Feature2.default.SUPPORT_BASE64_DRAWING(src).then(imageLoadHandler) : imageLoadHandler(true);
|
19147 |
-
return key;
|
19148 |
-
}
|
19149 |
-
}, {
|
19150 |
-
key: 'isSameOrigin',
|
19151 |
-
value: function isSameOrigin(url) {
|
19152 |
-
return this.getOrigin(url) === this.origin;
|
19153 |
-
}
|
19154 |
-
}, {
|
19155 |
-
key: 'getOrigin',
|
19156 |
-
value: function getOrigin(url) {
|
19157 |
-
var link = this._link || (this._link = this._window.document.createElement('a'));
|
19158 |
-
link.href = url;
|
19159 |
-
link.href = link.href; // IE9, LOL! - http://jsfiddle.net/niklasvh/2e48b/
|
19160 |
-
return link.protocol + link.hostname + link.port;
|
19161 |
-
}
|
19162 |
-
}, {
|
19163 |
-
key: 'ready',
|
19164 |
-
value: function ready() {
|
19165 |
-
var _this5 = this;
|
19166 |
-
|
19167 |
-
var keys = Object.keys(this.cache);
|
19168 |
-
var values = keys.map(function (str) {
|
19169 |
-
return _this5.cache[str].catch(function (e) {
|
19170 |
-
if (true) {
|
19171 |
-
_this5.logger.log('Unable to load image', e);
|
19172 |
-
}
|
19173 |
-
return null;
|
19174 |
-
});
|
19175 |
-
});
|
19176 |
-
return Promise.all(values).then(function (images) {
|
19177 |
-
if (true) {
|
19178 |
-
_this5.logger.log('Finished loading ' + images.length + ' images', images);
|
19179 |
-
}
|
19180 |
-
return new ResourceStore(keys, images);
|
19181 |
-
});
|
19182 |
-
}
|
19183 |
-
}]);
|
19184 |
-
|
19185 |
-
return ResourceLoader;
|
19186 |
-
}();
|
19187 |
-
|
19188 |
-
exports.default = ResourceLoader;
|
19189 |
-
|
19190 |
-
var ResourceStore = exports.ResourceStore = function () {
|
19191 |
-
function ResourceStore(keys, resources) {
|
19192 |
-
_classCallCheck(this, ResourceStore);
|
19193 |
-
|
19194 |
-
this._keys = keys;
|
19195 |
-
this._resources = resources;
|
19196 |
-
}
|
19197 |
-
|
19198 |
-
_createClass(ResourceStore, [{
|
19199 |
-
key: 'get',
|
19200 |
-
value: function get(key) {
|
19201 |
-
var index = this._keys.indexOf(key);
|
19202 |
-
return index === -1 ? null : this._resources[index];
|
19203 |
-
}
|
19204 |
-
}]);
|
19205 |
-
|
19206 |
-
return ResourceStore;
|
19207 |
-
}();
|
19208 |
-
|
19209 |
-
var INLINE_SVG = /^data:image\/svg\+xml/i;
|
19210 |
-
var INLINE_BASE64 = /^data:image\/.*;base64,/i;
|
19211 |
-
var INLINE_IMG = /^data:image\/.*/i;
|
19212 |
-
|
19213 |
-
var isInlineImage = function isInlineImage(src) {
|
19214 |
-
return INLINE_IMG.test(src);
|
19215 |
-
};
|
19216 |
-
var isInlineBase64Image = function isInlineBase64Image(src) {
|
19217 |
-
return INLINE_BASE64.test(src);
|
19218 |
-
};
|
19219 |
-
var isBlobImage = function isBlobImage(src) {
|
19220 |
-
return src.substr(0, 4) === 'blob';
|
19221 |
-
};
|
19222 |
-
|
19223 |
-
var isSVG = function isSVG(src) {
|
19224 |
-
return src.substr(-3).toLowerCase() === 'svg' || INLINE_SVG.test(src);
|
19225 |
-
};
|
19226 |
-
|
19227 |
-
var _loadImage = function _loadImage(src, timeout) {
|
19228 |
-
return new Promise(function (resolve, reject) {
|
19229 |
-
var img = new Image();
|
19230 |
-
img.onload = function () {
|
19231 |
-
return resolve(img);
|
19232 |
-
};
|
19233 |
-
img.onerror = reject;
|
19234 |
-
img.src = src;
|
19235 |
-
if (img.complete === true) {
|
19236 |
-
// Inline XML images may fail to parse, throwing an Error later on
|
19237 |
-
setTimeout(function () {
|
19238 |
-
resolve(img);
|
19239 |
-
}, 500);
|
19240 |
-
}
|
19241 |
-
if (timeout) {
|
19242 |
-
setTimeout(function () {
|
19243 |
-
return reject( true ? 'Timed out (' + timeout + 'ms) loading image' : '');
|
19244 |
-
}, timeout);
|
19245 |
-
}
|
19246 |
-
});
|
19247 |
-
};
|
19248 |
-
|
19249 |
-
/***/ }),
|
19250 |
-
/* 56 */
|
19251 |
-
/***/ (function(module, exports, __webpack_require__) {
|
19252 |
-
|
19253 |
-
"use strict";
|
19254 |
-
|
19255 |
-
|
19256 |
-
Object.defineProperty(exports, "__esModule", {
|
19257 |
-
value: true
|
19258 |
-
});
|
19259 |
-
exports.parseContent = exports.resolvePseudoContent = exports.popCounters = exports.parseCounterReset = exports.TOKEN_TYPE = exports.PSEUDO_CONTENT_ITEM_TYPE = undefined;
|
19260 |
-
|
19261 |
-
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
|
19262 |
-
|
19263 |
-
var _ListItem = __webpack_require__(14);
|
19264 |
-
|
19265 |
-
var _listStyle = __webpack_require__(8);
|
19266 |
-
|
19267 |
-
var PSEUDO_CONTENT_ITEM_TYPE = exports.PSEUDO_CONTENT_ITEM_TYPE = {
|
19268 |
-
TEXT: 0,
|
19269 |
-
IMAGE: 1
|
19270 |
-
};
|
19271 |
-
|
19272 |
-
var TOKEN_TYPE = exports.TOKEN_TYPE = {
|
19273 |
-
STRING: 0,
|
19274 |
-
ATTRIBUTE: 1,
|
19275 |
-
URL: 2,
|
19276 |
-
COUNTER: 3,
|
19277 |
-
COUNTERS: 4,
|
19278 |
-
OPENQUOTE: 5,
|
19279 |
-
CLOSEQUOTE: 6
|
19280 |
-
};
|
19281 |
-
|
19282 |
-
var parseCounterReset = exports.parseCounterReset = function parseCounterReset(style, data) {
|
19283 |
-
if (!style || !style.counterReset || style.counterReset === 'none') {
|
19284 |
-
return [];
|
19285 |
-
}
|
19286 |
-
|
19287 |
-
var counterNames = [];
|
19288 |
-
var counterResets = style.counterReset.split(/\s*,\s*/);
|
19289 |
-
var lenCounterResets = counterResets.length;
|
19290 |
-
|
19291 |
-
for (var i = 0; i < lenCounterResets; i++) {
|
19292 |
-
var _counterResets$i$spli = counterResets[i].split(/\s+/),
|
19293 |
-
_counterResets$i$spli2 = _slicedToArray(_counterResets$i$spli, 2),
|
19294 |
-
counterName = _counterResets$i$spli2[0],
|
19295 |
-
initialValue = _counterResets$i$spli2[1];
|
19296 |
-
|
19297 |
-
counterNames.push(counterName);
|
19298 |
-
var counter = data.counters[counterName];
|
19299 |
-
if (!counter) {
|
19300 |
-
counter = data.counters[counterName] = [];
|
19301 |
-
}
|
19302 |
-
counter.push(parseInt(initialValue || 0, 10));
|
19303 |
-
}
|
19304 |
-
|
19305 |
-
return counterNames;
|
19306 |
-
};
|
19307 |
-
|
19308 |
-
var popCounters = exports.popCounters = function popCounters(counterNames, data) {
|
19309 |
-
var lenCounters = counterNames.length;
|
19310 |
-
for (var i = 0; i < lenCounters; i++) {
|
19311 |
-
data.counters[counterNames[i]].pop();
|
19312 |
-
}
|
19313 |
-
};
|
19314 |
-
|
19315 |
-
var resolvePseudoContent = exports.resolvePseudoContent = function resolvePseudoContent(node, style, data) {
|
19316 |
-
if (!style || !style.content || style.content === 'none' || style.content === '-moz-alt-content' || style.display === 'none') {
|
19317 |
-
return null;
|
19318 |
-
}
|
19319 |
-
|
19320 |
-
var tokens = parseContent(style.content);
|
19321 |
-
|
19322 |
-
var len = tokens.length;
|
19323 |
-
var contentItems = [];
|
19324 |
-
var s = '';
|
19325 |
-
|
19326 |
-
// increment the counter (if there is a "counter-increment" declaration)
|
19327 |
-
var counterIncrement = style.counterIncrement;
|
19328 |
-
if (counterIncrement && counterIncrement !== 'none') {
|
19329 |
-
var _counterIncrement$spl = counterIncrement.split(/\s+/),
|
19330 |
-
_counterIncrement$spl2 = _slicedToArray(_counterIncrement$spl, 2),
|
19331 |
-
counterName = _counterIncrement$spl2[0],
|
19332 |
-
incrementValue = _counterIncrement$spl2[1];
|
19333 |
-
|
19334 |
-
var counter = data.counters[counterName];
|
19335 |
-
if (counter) {
|
19336 |
-
counter[counter.length - 1] += incrementValue === undefined ? 1 : parseInt(incrementValue, 10);
|
19337 |
-
}
|
19338 |
-
}
|
19339 |
-
|
19340 |
-
// build the content string
|
19341 |
-
for (var i = 0; i < len; i++) {
|
19342 |
-
var token = tokens[i];
|
19343 |
-
switch (token.type) {
|
19344 |
-
case TOKEN_TYPE.STRING:
|
19345 |
-
s += token.value || '';
|
19346 |
-
break;
|
19347 |
-
|
19348 |
-
case TOKEN_TYPE.ATTRIBUTE:
|
19349 |
-
if (node instanceof HTMLElement && token.value) {
|
19350 |
-
s += node.getAttribute(token.value) || '';
|
19351 |
-
}
|
19352 |
-
break;
|
19353 |
-
|
19354 |
-
case TOKEN_TYPE.COUNTER:
|
19355 |
-
var _counter = data.counters[token.name || ''];
|
19356 |
-
if (_counter) {
|
19357 |
-
s += formatCounterValue([_counter[_counter.length - 1]], '', token.format);
|
19358 |
-
}
|
19359 |
-
break;
|
19360 |
-
|
19361 |
-
case TOKEN_TYPE.COUNTERS:
|
19362 |
-
var _counters = data.counters[token.name || ''];
|
19363 |
-
if (_counters) {
|
19364 |
-
s += formatCounterValue(_counters, token.glue, token.format);
|
19365 |
-
}
|
19366 |
-
break;
|
19367 |
-
|
19368 |
-
case TOKEN_TYPE.OPENQUOTE:
|
19369 |
-
s += getQuote(style, true, data.quoteDepth);
|
19370 |
-
data.quoteDepth++;
|
19371 |
-
break;
|
19372 |
-
|
19373 |
-
case TOKEN_TYPE.CLOSEQUOTE:
|
19374 |
-
data.quoteDepth--;
|
19375 |
-
s += getQuote(style, false, data.quoteDepth);
|
19376 |
-
break;
|
19377 |
-
|
19378 |
-
case TOKEN_TYPE.URL:
|
19379 |
-
if (s) {
|
19380 |
-
contentItems.push({ type: PSEUDO_CONTENT_ITEM_TYPE.TEXT, value: s });
|
19381 |
-
s = '';
|
19382 |
-
}
|
19383 |
-
contentItems.push({ type: PSEUDO_CONTENT_ITEM_TYPE.IMAGE, value: token.value || '' });
|
19384 |
-
break;
|
19385 |
-
}
|
19386 |
-
}
|
19387 |
-
|
19388 |
-
if (s) {
|
19389 |
-
contentItems.push({ type: PSEUDO_CONTENT_ITEM_TYPE.TEXT, value: s });
|
19390 |
-
}
|
19391 |
-
|
19392 |
-
return contentItems;
|
19393 |
-
};
|
19394 |
-
|
19395 |
-
var parseContent = exports.parseContent = function parseContent(content, cache) {
|
19396 |
-
if (cache && cache[content]) {
|
19397 |
-
return cache[content];
|
19398 |
-
}
|
19399 |
-
|
19400 |
-
var tokens = [];
|
19401 |
-
var len = content.length;
|
19402 |
-
|
19403 |
-
var isString = false;
|
19404 |
-
var isEscaped = false;
|
19405 |
-
var isFunction = false;
|
19406 |
-
var str = '';
|
19407 |
-
var functionName = '';
|
19408 |
-
var args = [];
|
19409 |
-
|
19410 |
-
for (var i = 0; i < len; i++) {
|
19411 |
-
var c = content.charAt(i);
|
19412 |
-
|
19413 |
-
switch (c) {
|
19414 |
-
case "'":
|
19415 |
-
case '"':
|
19416 |
-
if (isEscaped) {
|
19417 |
-
str += c;
|
19418 |
-
} else {
|
19419 |
-
isString = !isString;
|
19420 |
-
if (!isFunction && !isString) {
|
19421 |
-
tokens.push({ type: TOKEN_TYPE.STRING, value: str });
|
19422 |
-
str = '';
|
19423 |
-
}
|
19424 |
-
}
|
19425 |
-
break;
|
19426 |
-
|
19427 |
-
case '\\':
|
19428 |
-
if (isEscaped) {
|
19429 |
-
str += c;
|
19430 |
-
isEscaped = false;
|
19431 |
-
} else {
|
19432 |
-
isEscaped = true;
|
19433 |
-
}
|
19434 |
-
break;
|
19435 |
-
|
19436 |
-
case '(':
|
19437 |
-
if (isString) {
|
19438 |
-
str += c;
|
19439 |
-
} else {
|
19440 |
-
isFunction = true;
|
19441 |
-
functionName = str;
|
19442 |
-
str = '';
|
19443 |
-
args = [];
|
19444 |
-
}
|
19445 |
-
break;
|
19446 |
-
|
19447 |
-
case ')':
|
19448 |
-
if (isString) {
|
19449 |
-
str += c;
|
19450 |
-
} else if (isFunction) {
|
19451 |
-
if (str) {
|
19452 |
-
args.push(str);
|
19453 |
-
}
|
19454 |
-
|
19455 |
-
switch (functionName) {
|
19456 |
-
case 'attr':
|
19457 |
-
if (args.length > 0) {
|
19458 |
-
tokens.push({ type: TOKEN_TYPE.ATTRIBUTE, value: args[0] });
|
19459 |
-
}
|
19460 |
-
break;
|
19461 |
-
|
19462 |
-
case 'counter':
|
19463 |
-
if (args.length > 0) {
|
19464 |
-
var counter = {
|
19465 |
-
type: TOKEN_TYPE.COUNTER,
|
19466 |
-
name: args[0]
|
19467 |
-
};
|
19468 |
-
if (args.length > 1) {
|
19469 |
-
counter.format = args[1];
|
19470 |
-
}
|
19471 |
-
tokens.push(counter);
|
19472 |
-
}
|
19473 |
-
break;
|
19474 |
-
|
19475 |
-
case 'counters':
|
19476 |
-
if (args.length > 0) {
|
19477 |
-
var _counters2 = {
|
19478 |
-
type: TOKEN_TYPE.COUNTERS,
|
19479 |
-
name: args[0]
|
19480 |
-
};
|
19481 |
-
if (args.length > 1) {
|
19482 |
-
_counters2.glue = args[1];
|
19483 |
-
}
|
19484 |
-
if (args.length > 2) {
|
19485 |
-
_counters2.format = args[2];
|
19486 |
-
}
|
19487 |
-
tokens.push(_counters2);
|
19488 |
-
}
|
19489 |
-
break;
|
19490 |
-
|
19491 |
-
case 'url':
|
19492 |
-
if (args.length > 0) {
|
19493 |
-
tokens.push({ type: TOKEN_TYPE.URL, value: args[0] });
|
19494 |
-
}
|
19495 |
-
break;
|
19496 |
-
}
|
19497 |
-
|
19498 |
-
isFunction = false;
|
19499 |
-
str = '';
|
19500 |
-
}
|
19501 |
-
break;
|
19502 |
-
|
19503 |
-
case ',':
|
19504 |
-
if (isString) {
|
19505 |
-
str += c;
|
19506 |
-
} else if (isFunction) {
|
19507 |
-
args.push(str);
|
19508 |
-
str = '';
|
19509 |
-
}
|
19510 |
-
break;
|
19511 |
-
|
19512 |
-
case ' ':
|
19513 |
-
case '\t':
|
19514 |
-
if (isString) {
|
19515 |
-
str += c;
|
19516 |
-
} else if (str) {
|
19517 |
-
addOtherToken(tokens, str);
|
19518 |
-
str = '';
|
19519 |
-
}
|
19520 |
-
break;
|
19521 |
-
|
19522 |
-
default:
|
19523 |
-
str += c;
|
19524 |
-
}
|
19525 |
-
|
19526 |
-
if (c !== '\\') {
|
19527 |
-
isEscaped = false;
|
19528 |
-
}
|
19529 |
-
}
|
19530 |
-
|
19531 |
-
if (str) {
|
19532 |
-
addOtherToken(tokens, str);
|
19533 |
-
}
|
19534 |
-
|
19535 |
-
if (cache) {
|
19536 |
-
cache[content] = tokens;
|
19537 |
-
}
|
19538 |
-
|
19539 |
-
return tokens;
|
19540 |
-
};
|
19541 |
-
|
19542 |
-
var addOtherToken = function addOtherToken(tokens, identifier) {
|
19543 |
-
switch (identifier) {
|
19544 |
-
case 'open-quote':
|
19545 |
-
tokens.push({ type: TOKEN_TYPE.OPENQUOTE });
|
19546 |
-
break;
|
19547 |
-
case 'close-quote':
|
19548 |
-
tokens.push({ type: TOKEN_TYPE.CLOSEQUOTE });
|
19549 |
-
break;
|
19550 |
-
}
|
19551 |
-
};
|
19552 |
-
|
19553 |
-
var getQuote = function getQuote(style, isOpening, quoteDepth) {
|
19554 |
-
var quotes = style.quotes ? style.quotes.split(/\s+/) : ["'\"'", "'\"'"];
|
19555 |
-
var idx = quoteDepth * 2;
|
19556 |
-
if (idx >= quotes.length) {
|
19557 |
-
idx = quotes.length - 2;
|
19558 |
-
}
|
19559 |
-
if (!isOpening) {
|
19560 |
-
++idx;
|
19561 |
-
}
|
19562 |
-
return quotes[idx].replace(/^["']|["']$/g, '');
|
19563 |
-
};
|
19564 |
-
|
19565 |
-
var formatCounterValue = function formatCounterValue(counter, glue, format) {
|
19566 |
-
var len = counter.length;
|
19567 |
-
var result = '';
|
19568 |
-
|
19569 |
-
for (var i = 0; i < len; i++) {
|
19570 |
-
if (i > 0) {
|
19571 |
-
result += glue || '';
|
19572 |
-
}
|
19573 |
-
result += (0, _ListItem.createCounterText)(counter[i], (0, _listStyle.parseListStyleType)(format || 'decimal'), false);
|
19574 |
-
}
|
19575 |
-
|
19576 |
-
return result;
|
19577 |
-
};
|
19578 |
-
|
19579 |
-
/***/ })
|
19580 |
-
/******/ ]);
|
19581 |
-
});
|
19582 |
-
|
19583 |
-
/***/ },
|
19584 |
-
|
19585 |
-
/***/ 544:
|
19586 |
-
/***/ function(module, exports, __webpack_require__) {
|
19587 |
-
|
19588 |
-
'use strict';
|
19589 |
-
|
19590 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
19591 |
-
|
19592 |
-
var _react = __webpack_require__(2);
|
19593 |
-
|
19594 |
-
var _react2 = _interopRequireDefault(_react);
|
19595 |
-
|
19596 |
-
var _mailpoet = __webpack_require__(276);
|
19597 |
-
|
19598 |
-
var _mailpoet2 = _interopRequireDefault(_mailpoet);
|
19599 |
-
|
19600 |
-
var _newslettersBreadcrumbJsx = __webpack_require__(441);
|
19601 |
-
|
19602 |
-
var _newslettersBreadcrumbJsx2 = _interopRequireDefault(_newslettersBreadcrumbJsx);
|
19603 |
-
|
19604 |
-
var NewsletterStandard = _react2['default'].createClass({
|
19605 |
-
displayName: 'NewsletterStandard',
|
19606 |
-
|
19607 |
-
contextTypes: {
|
19608 |
-
router: _react2['default'].PropTypes.object.isRequired
|
19609 |
-
},
|
19610 |
-
showTemplateSelection: function showTemplateSelection(newsletterId) {
|
19611 |
-
this.context.router.push('/template/' + newsletterId);
|
19612 |
-
},
|
19613 |
-
componentDidMount: function componentDidMount() {
|
19614 |
-
var _this = this;
|
19615 |
-
|
19616 |
-
// No options for this type, create a newsletter upon mounting
|
19617 |
-
_mailpoet2['default'].Ajax.post({
|
19618 |
-
api_version: window.mailpoet_api_version,
|
19619 |
-
endpoint: 'newsletters',
|
19620 |
-
action: 'create',
|
19621 |
-
data: {
|
19622 |
-
type: 'standard'
|
19623 |
-
}
|
19624 |
-
}).done(function (response) {
|
19625 |
-
_this.showTemplateSelection(response.data.id);
|
19626 |
-
}).fail(function (response) {
|
19627 |
-
if (response.errors.length > 0) {
|
19628 |
-
_mailpoet2['default'].Notice.error(response.errors.map(function (error) {
|
19629 |
-
return error.message;
|
19630 |
-
}), { scroll: true });
|
19631 |
-
}
|
19632 |
-
});
|
19633 |
-
},
|
19634 |
-
render: function render() {
|
19635 |
-
return _react2['default'].createElement(
|
19636 |
-
'div',
|
19637 |
-
null,
|
19638 |
-
_react2['default'].createElement(
|
19639 |
-
'h1',
|
19640 |
-
null,
|
19641 |
-
_mailpoet2['default'].I18n.t('regularNewsletterTypeTitle')
|
19642 |
-
),
|
19643 |
-
_react2['default'].createElement(_newslettersBreadcrumbJsx2['default'], { step: 'type' })
|
19644 |
-
);
|
19645 |
-
}
|
19646 |
-
});
|
19647 |
-
|
19648 |
-
module.exports = NewsletterStandard;
|
19649 |
-
|
19650 |
-
/***/ },
|
19651 |
-
|
19652 |
-
/***/ 545:
|
19653 |
-
/***/ function(module, exports, __webpack_require__) {
|
19654 |
-
|
19655 |
-
'use strict';
|
19656 |
-
|
19657 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
19658 |
-
|
19659 |
-
var _react = __webpack_require__(2);
|
19660 |
-
|
19661 |
-
var _react2 = _interopRequireDefault(_react);
|
19662 |
-
|
19663 |
-
var _mailpoet = __webpack_require__(276);
|
19664 |
-
|
19665 |
-
var _mailpoet2 = _interopRequireDefault(_mailpoet);
|
19666 |
-
|
19667 |
-
var _newslettersBreadcrumbJsx = __webpack_require__(441);
|
19668 |
-
|
19669 |
-
var _newslettersBreadcrumbJsx2 = _interopRequireDefault(_newslettersBreadcrumbJsx);
|
19670 |
-
|
19671 |
-
var _underscore = __webpack_require__(281);
|
19672 |
-
|
19673 |
-
var _underscore2 = _interopRequireDefault(_underscore);
|
19674 |
-
|
19675 |
-
var _newslettersTypesNotificationSchedulingJsx = __webpack_require__(535);
|
19676 |
-
|
19677 |
-
var _newslettersTypesNotificationSchedulingJsx2 = _interopRequireDefault(_newslettersTypesNotificationSchedulingJsx);
|
19678 |
-
|
19679 |
-
var field = {
|
19680 |
-
name: 'options',
|
19681 |
-
type: 'reactComponent',
|
19682 |
-
component: _newslettersTypesNotificationSchedulingJsx2['default']
|
19683 |
-
};
|
19684 |
-
|
19685 |
-
var NewsletterNotification = _react2['default'].createClass({
|
19686 |
-
displayName: 'NewsletterNotification',
|
19687 |
-
|
19688 |
-
contextTypes: {
|
19689 |
-
router: _react2['default'].PropTypes.object.isRequired
|
19690 |
-
},
|
19691 |
-
getInitialState: function getInitialState() {
|
19692 |
-
return {
|
19693 |
-
options: {
|
19694 |
-
intervalType: 'daily',
|
19695 |
-
timeOfDay: 0,
|
19696 |
-
weekDay: 1,
|
19697 |
-
monthDay: 0,
|
19698 |
-
nthWeekDay: 1
|
19699 |
-
}
|
19700 |
-
};
|
19701 |
-
},
|
19702 |
-
handleValueChange: function handleValueChange(event) {
|
19703 |
-
var state = this.state;
|
19704 |
-
state[event.target.name] = event.target.value;
|
19705 |
-
this.setState(state);
|
19706 |
-
},
|
19707 |
-
handleNext: function handleNext() {
|
19708 |
-
var _this = this;
|
19709 |
-
|
19710 |
-
_mailpoet2['default'].Ajax.post({
|
19711 |
-
api_version: window.mailpoet_api_version,
|
19712 |
-
endpoint: 'newsletters',
|
19713 |
-
action: 'create',
|
19714 |
-
data: _underscore2['default'].extend({}, this.state, {
|
19715 |
-
type: 'notification',
|
19716 |
-
subject: _mailpoet2['default'].I18n.t('draftNewsletterTitle')
|
19717 |
-
})
|
19718 |
-
}).done(function (response) {
|
19719 |
-
_this.showTemplateSelection(response.data.id);
|
19720 |
-
}).fail(function (response) {
|
19721 |
-
if (response.errors.length > 0) {
|
19722 |
-
_mailpoet2['default'].Notice.error(response.errors.map(function (error) {
|
19723 |
-
return error.message;
|
19724 |
-
}), { scroll: true });
|
19725 |
-
}
|
19726 |
-
});
|
19727 |
-
},
|
19728 |
-
showTemplateSelection: function showTemplateSelection(newsletterId) {
|
19729 |
-
this.context.router.push('/template/' + newsletterId);
|
19730 |
-
},
|
19731 |
-
render: function render() {
|
19732 |
-
return _react2['default'].createElement(
|
19733 |
-
'div',
|
19734 |
-
null,
|
19735 |
-
_react2['default'].createElement(
|
19736 |
-
'h1',
|
19737 |
-
null,
|
19738 |
-
_mailpoet2['default'].I18n.t('postNotificationNewsletterTypeTitle')
|
19739 |
-
),
|
19740 |
-
_react2['default'].createElement(_newslettersBreadcrumbJsx2['default'], { step: 'type' }),
|
19741 |
-
_react2['default'].createElement(
|
19742 |
-
'h3',
|
19743 |
-
null,
|
19744 |
-
_mailpoet2['default'].I18n.t('selectFrequency')
|
19745 |
-
),
|
19746 |
-
_react2['default'].createElement(_newslettersTypesNotificationSchedulingJsx2['default'], {
|
19747 |
-
item: this.state,
|
19748 |
-
field: field,
|
19749 |
-
onValueChange: this.handleValueChange
|
19750 |
-
}),
|
19751 |
-
_react2['default'].createElement(
|
19752 |
-
'p',
|
19753 |
-
{ className: 'submit' },
|
19754 |
-
_react2['default'].createElement('input', {
|
19755 |
-
className: 'button button-primary',
|
19756 |
-
type: 'button',
|
19757 |
-
onClick: this.handleNext,
|
19758 |
-
value: _mailpoet2['default'].I18n.t('next')
|
19759 |
-
})
|
19760 |
-
)
|
19761 |
-
);
|
19762 |
-
}
|
19763 |
-
});
|
19764 |
-
|
19765 |
-
module.exports = NewsletterNotification;
|
19766 |
-
|
19767 |
-
/***/ },
|
19768 |
-
|
19769 |
-
/***/ 551:
|
19770 |
-
/***/ function(module, exports, __webpack_require__) {
|
19771 |
-
|
19772 |
-
'use strict';
|
19773 |
-
|
19774 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
19775 |
-
|
19776 |
-
var _react = __webpack_require__(2);
|
19777 |
-
|
19778 |
-
var _react2 = _interopRequireDefault(_react);
|
19779 |
-
|
19780 |
-
var _reactConfirmAlert = __webpack_require__(461);
|
19781 |
-
|
19782 |
-
var _classnames = __webpack_require__(277);
|
19783 |
-
|
19784 |
-
var _classnames2 = _interopRequireDefault(_classnames);
|
19785 |
-
|
19786 |
-
var _mailpoet = __webpack_require__(276);
|
19787 |
-
|
19788 |
-
var _mailpoet2 = _interopRequireDefault(_mailpoet);
|
19789 |
-
|
19790 |
-
var _wpJsHooks = __webpack_require__(438);
|
19791 |
-
|
19792 |
-
var _wpJsHooks2 = _interopRequireDefault(_wpJsHooks);
|
19793 |
-
|
19794 |
-
var _listingListingJsx = __webpack_require__(279);
|
19795 |
-
|
19796 |
-
var _listingListingJsx2 = _interopRequireDefault(_listingListingJsx);
|
19797 |
-
|
19798 |
-
var _newslettersListingsTabsJsx = __webpack_require__(552);
|
19799 |
-
|
19800 |
-
var _newslettersListingsTabsJsx2 = _interopRequireDefault(_newslettersListingsTabsJsx);
|
19801 |
-
|
19802 |
-
var _newslettersListingsHeadingJsx = __webpack_require__(554);
|
19803 |
-
|
19804 |
-
var _newslettersListingsHeadingJsx2 = _interopRequireDefault(_newslettersListingsHeadingJsx);
|
19805 |
-
|
19806 |
-
var _newslettersListingsMixinsJsx = __webpack_require__(555);
|
19807 |
-
|
19808 |
-
var mailpoetTrackingEnabled = !!window.mailpoet_tracking_enabled;
|
19809 |
-
|
19810 |
-
var messages = {
|
19811 |
-
onTrash: function onTrash(response) {
|
19812 |
-
var count = Number(response.meta.count);
|
19813 |
-
var message = null;
|
19814 |
-
|
19815 |
-
if (count === 1) {
|
19816 |
-
message = _mailpoet2['default'].I18n.t('oneNewsletterTrashed');
|
19817 |
-
} else {
|
19818 |
-
message = _mailpoet2['default'].I18n.t('multipleNewslettersTrashed').replace('%$1d', count.toLocaleString());
|
19819 |
-
}
|
19820 |
-
_mailpoet2['default'].Notice.success(message);
|
19821 |
-
},
|
19822 |
-
onDelete: function onDelete(response) {
|
19823 |
-
var count = Number(response.meta.count);
|
19824 |
-
var message = null;
|
19825 |
-
|
19826 |
-
if (count === 1) {
|
19827 |
-
message = _mailpoet2['default'].I18n.t('oneNewsletterDeleted');
|
19828 |
-
} else {
|
19829 |
-
message = _mailpoet2['default'].I18n.t('multipleNewslettersDeleted').replace('%$1d', count.toLocaleString());
|
19830 |
-
}
|
19831 |
-
_mailpoet2['default'].Notice.success(message);
|
19832 |
-
},
|
19833 |
-
onRestore: function onRestore(response) {
|
19834 |
-
var count = Number(response.meta.count);
|
19835 |
-
var message = null;
|
19836 |
-
|
19837 |
-
if (count === 1) {
|
19838 |
-
message = _mailpoet2['default'].I18n.t('oneNewsletterRestored');
|
19839 |
-
} else {
|
19840 |
-
message = _mailpoet2['default'].I18n.t('multipleNewslettersRestored').replace('%$1d', count.toLocaleString());
|
19841 |
-
}
|
19842 |
-
_mailpoet2['default'].Notice.success(message);
|
19843 |
-
}
|
19844 |
-
};
|
19845 |
-
|
19846 |
-
var columns = [{
|
19847 |
-
name: 'subject',
|
19848 |
-
label: _mailpoet2['default'].I18n.t('subject'),
|
19849 |
-
sortable: true
|
19850 |
-
}, {
|
19851 |
-
name: 'status',
|
19852 |
-
label: _mailpoet2['default'].I18n.t('status')
|
19853 |
-
}, {
|
19854 |
-
name: 'segments',
|
19855 |
-
label: _mailpoet2['default'].I18n.t('lists')
|
19856 |
-
}, {
|
19857 |
-
name: 'statistics',
|
19858 |
-
label: _mailpoet2['default'].I18n.t('statistics'),
|
19859 |
-
display: mailpoetTrackingEnabled
|
19860 |
-
}, {
|
19861 |
-
name: 'sent_at',
|
19862 |
-
label: _mailpoet2['default'].I18n.t('sentOn'),
|
19863 |
-
sortable: true
|
19864 |
-
}];
|
19865 |
-
|
19866 |
-
var bulkActions = [{
|
19867 |
-
name: 'trash',
|
19868 |
-
label: _mailpoet2['default'].I18n.t('moveToTrash'),
|
19869 |
-
onSuccess: messages.onTrash
|
19870 |
-
}];
|
19871 |
-
|
19872 |
-
var confirmEdit = function confirmEdit(newsletter) {
|
19873 |
-
var redirectToEditing = function redirectToEditing() {
|
19874 |
-
window.location.href = '?page=mailpoet-newsletter-editor&id=' + newsletter.id;
|
19875 |
-
};
|
19876 |
-
if (!newsletter.queue || newsletter.status !== 'sending' || newsletter.queue.status !== null) {
|
19877 |
-
redirectToEditing();
|
19878 |
-
} else {
|
19879 |
-
(0, _reactConfirmAlert.confirmAlert)({
|
19880 |
-
title: _mailpoet2['default'].I18n.t('confirmTitle'),
|
19881 |
-
message: _mailpoet2['default'].I18n.t('confirmEdit'),
|
19882 |
-
confirmLabel: _mailpoet2['default'].I18n.t('confirmLabel'),
|
19883 |
-
cancelLabel: _mailpoet2['default'].I18n.t('cancelLabel'),
|
19884 |
-
onConfirm: redirectToEditing
|
19885 |
-
});
|
19886 |
-
}
|
19887 |
-
};
|
19888 |
-
|
19889 |
-
var newsletterActions = [{
|
19890 |
-
name: 'view',
|
19891 |
-
link: function link(newsletter) {
|
19892 |
-
return _react2['default'].createElement(
|
19893 |
-
'a',
|
19894 |
-
{ href: newsletter.preview_url, target: '_blank' },
|
19895 |
-
_mailpoet2['default'].I18n.t('preview')
|
19896 |
-
);
|
19897 |
-
}
|
19898 |
-
}, {
|
19899 |
-
name: 'edit',
|
19900 |
-
label: _mailpoet2['default'].I18n.t('edit'),
|
19901 |
-
onClick: confirmEdit
|
19902 |
-
}, {
|
19903 |
-
name: 'duplicate',
|
19904 |
-
label: _mailpoet2['default'].I18n.t('duplicate'),
|
19905 |
-
onClick: function onClick(newsletter, refresh) {
|
19906 |
-
return _mailpoet2['default'].Ajax.post({
|
19907 |
-
api_version: window.mailpoet_api_version,
|
19908 |
-
endpoint: 'newsletters',
|
19909 |
-
action: 'duplicate',
|
19910 |
-
data: {
|
19911 |
-
id: newsletter.id
|
19912 |
-
}
|
19913 |
-
}).done(function (response) {
|
19914 |
-
_mailpoet2['default'].Notice.success(_mailpoet2['default'].I18n.t('newsletterDuplicated').replace('%$1s', response.data.subject));
|
19915 |
-
refresh();
|
19916 |
-
}).fail(function (response) {
|
19917 |
-
if (response.errors.length > 0) {
|
19918 |
-
_mailpoet2['default'].Notice.error(response.errors.map(function (error) {
|
19919 |
-
return error.message;
|
19920 |
-
}), { scroll: true });
|
19921 |
-
}
|
19922 |
-
});
|
19923 |
-
}
|
19924 |
-
}, {
|
19925 |
-
name: 'trash'
|
19926 |
-
}];
|
19927 |
-
|
19928 |
-
_wpJsHooks2['default'].addFilter('mailpoet_newsletters_listings_standard_actions', _newslettersListingsMixinsJsx.StatisticsMixin.addStatsCTAAction);
|
19929 |
-
newsletterActions = _wpJsHooks2['default'].applyFilters('mailpoet_newsletters_listings_standard_actions', newsletterActions);
|
19930 |
-
|
19931 |
-
var NewsletterListStandard = _react2['default'].createClass({
|
19932 |
-
displayName: 'NewsletterListStandard',
|
19933 |
-
|
19934 |
-
mixins: [_newslettersListingsMixinsJsx.QueueMixin, _newslettersListingsMixinsJsx.StatisticsMixin, _newslettersListingsMixinsJsx.MailerMixin],
|
19935 |
-
renderItem: function renderItem(newsletter, actions, meta) {
|
19936 |
-
var rowClasses = (0, _classnames2['default'])('manage-column', 'column-primary', 'has-row-actions');
|
19937 |
-
|
19938 |
-
var segments = newsletter.segments.map(function (segment) {
|
19939 |
-
return segment.name;
|
19940 |
-
}).join(', ');
|
19941 |
-
|
19942 |
-
return _react2['default'].createElement(
|
19943 |
-
'div',
|
19944 |
-
null,
|
19945 |
-
_react2['default'].createElement(
|
19946 |
-
'td',
|
19947 |
-
{ className: rowClasses },
|
19948 |
-
_react2['default'].createElement(
|
19949 |
-
'strong',
|
19950 |
-
null,
|
19951 |
-
_react2['default'].createElement(
|
19952 |
-
'a',
|
19953 |
-
{
|
19954 |
-
className: 'row-title',
|
19955 |
-
href: 'javascript:;',
|
19956 |
-
onClick: function () {
|
19957 |
-
return confirmEdit(newsletter);
|
19958 |
-
}
|
19959 |
-
},
|
19960 |
-
newsletter.queue.newsletter_rendered_subject || newsletter.subject
|
19961 |
-
)
|
19962 |
-
),
|
19963 |
-
actions
|
19964 |
-
),
|
19965 |
-
_react2['default'].createElement(
|
19966 |
-
'td',
|
19967 |
-
{ className: 'column', 'data-colname': _mailpoet2['default'].I18n.t('status') },
|
19968 |
-
this.renderQueueStatus(newsletter, meta.mta_log)
|
19969 |
-
),
|
19970 |
-
_react2['default'].createElement(
|
19971 |
-
'td',
|
19972 |
-
{ className: 'column', 'data-colname': _mailpoet2['default'].I18n.t('lists') },
|
19973 |
-
segments
|
19974 |
-
),
|
19975 |
-
mailpoetTrackingEnabled === true ? _react2['default'].createElement(
|
19976 |
-
'td',
|
19977 |
-
{ className: 'column', 'data-colname': _mailpoet2['default'].I18n.t('statistics') },
|
19978 |
-
this.renderStatistics(newsletter, undefined, meta.current_time)
|
19979 |
-
) : null,
|
19980 |
-
_react2['default'].createElement(
|
19981 |
-
'td',
|
19982 |
-
{ className: 'column-date', 'data-colname': _mailpoet2['default'].I18n.t('sentOn') },
|
19983 |
-
_react2['default'].createElement(
|
19984 |
-
'abbr',
|
19985 |
-
null,
|
19986 |
-
newsletter.sent_at ? _mailpoet2['default'].Date.format(newsletter.sent_at) : _mailpoet2['default'].I18n.t('notSentYet')
|
19987 |
-
)
|
19988 |
-
)
|
19989 |
-
);
|
19990 |
-
},
|
19991 |
-
render: function render() {
|
19992 |
-
return _react2['default'].createElement(
|
19993 |
-
'div',
|
19994 |
-
null,
|
19995 |
-
_react2['default'].createElement(_newslettersListingsHeadingJsx2['default'], null),
|
19996 |
-
_react2['default'].createElement(_newslettersListingsTabsJsx2['default'], { tab: 'standard' }),
|
19997 |
-
_react2['default'].createElement(_listingListingJsx2['default'], {
|
19998 |
-
limit: window.mailpoet_listing_per_page,
|
19999 |
-
location: this.props.location,
|
20000 |
-
params: this.props.params,
|
20001 |
-
endpoint: 'newsletters',
|
20002 |
-
type: 'standard',
|
20003 |
-
base_url: 'standard',
|
20004 |
-
onRenderItem: this.renderItem,
|
20005 |
-
columns: columns,
|
20006 |
-
bulk_actions: bulkActions,
|
20007 |
-
item_actions: newsletterActions,
|
20008 |
-
messages: messages,
|
20009 |
-
auto_refresh: true,
|
20010 |
-
sort_by: 'sent_at',
|
20011 |
-
sort_order: 'desc',
|
20012 |
-
afterGetItems: this.checkMailerStatus
|
20013 |
-
})
|
20014 |
-
);
|
20015 |
-
}
|
20016 |
-
});
|
20017 |
-
|
20018 |
-
module.exports = NewsletterListStandard;
|
20019 |
-
|
20020 |
-
/***/ },
|
20021 |
-
|
20022 |
-
/***/ 554:
|
20023 |
-
/***/ function(module, exports, __webpack_require__) {
|
20024 |
-
|
20025 |
-
'use strict';
|
20026 |
-
|
20027 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
20028 |
-
|
20029 |
-
var _react = __webpack_require__(2);
|
20030 |
-
|
20031 |
-
var _react2 = _interopRequireDefault(_react);
|
20032 |
-
|
20033 |
-
var _reactRouter = __webpack_require__(181);
|
20034 |
-
|
20035 |
-
var _mailpoet = __webpack_require__(276);
|
20036 |
-
|
20037 |
-
var _mailpoet2 = _interopRequireDefault(_mailpoet);
|
20038 |
-
|
20039 |
-
var ListingHeading = function ListingHeading() {
|
20040 |
-
return _react2['default'].createElement(
|
20041 |
-
'h1',
|
20042 |
-
{ className: 'title' },
|
20043 |
-
_mailpoet2['default'].I18n.t('pageTitle'),
|
20044 |
-
_react2['default'].createElement(
|
20045 |
-
_reactRouter.Link,
|
20046 |
-
{
|
20047 |
-
className: 'page-title-action',
|
20048 |
-
to: '/new',
|
20049 |
-
onClick: function () {
|
20050 |
-
return _mailpoet2['default'].trackEvent('Emails > Add New', { 'MailPoet Free version': window.mailpoet_version });
|
20051 |
-
},
|
20052 |
-
'data-automation-id': 'new_email'
|
20053 |
-
},
|
20054 |
-
_mailpoet2['default'].I18n.t('new')
|
20055 |
-
)
|
20056 |
-
);
|
20057 |
-
};
|
20058 |
-
|
20059 |
-
module.exports = ListingHeading;
|
20060 |
-
|
20061 |
-
/***/ },
|
20062 |
-
|
20063 |
-
/***/ 560:
|
20064 |
-
/***/ function(module, exports, __webpack_require__) {
|
20065 |
-
|
20066 |
-
'use strict';
|
20067 |
-
|
20068 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
20069 |
-
|
20070 |
-
var _react = __webpack_require__(2);
|
20071 |
-
|
20072 |
-
var _react2 = _interopRequireDefault(_react);
|
20073 |
-
|
20074 |
-
var _listingListingJsx = __webpack_require__(279);
|
20075 |
-
|
20076 |
-
var _listingListingJsx2 = _interopRequireDefault(_listingListingJsx);
|
20077 |
-
|
20078 |
-
var _newslettersListingsTabsJsx = __webpack_require__(552);
|
20079 |
-
|
20080 |
-
var _newslettersListingsTabsJsx2 = _interopRequireDefault(_newslettersListingsTabsJsx);
|
20081 |
-
|
20082 |
-
var _newslettersListingsHeadingJsx = __webpack_require__(554);
|
20083 |
-
|
20084 |
-
var _newslettersListingsHeadingJsx2 = _interopRequireDefault(_newslettersListingsHeadingJsx);
|
20085 |
-
|
20086 |
-
var _newslettersListingsMixinsJsx = __webpack_require__(555);
|
20087 |
-
|
20088 |
-
var _classnames = __webpack_require__(277);
|
20089 |
-
|
20090 |
-
var _classnames2 = _interopRequireDefault(_classnames);
|
20091 |
-
|
20092 |
-
var _mailpoet = __webpack_require__(276);
|
20093 |
-
|
20094 |
-
var _mailpoet2 = _interopRequireDefault(_mailpoet);
|
20095 |
-
|
20096 |
-
var _underscore = __webpack_require__(281);
|
20097 |
-
|
20098 |
-
var _underscore2 = _interopRequireDefault(_underscore);
|
20099 |
-
|
20100 |
-
var _wpJsHooks = __webpack_require__(438);
|
20101 |
-
|
20102 |
-
var _wpJsHooks2 = _interopRequireDefault(_wpJsHooks);
|
20103 |
-
|
20104 |
-
var mailpoetRoles = window.mailpoet_roles || {};
|
20105 |
-
var mailpoetSegments = window.mailpoet_segments || {};
|
20106 |
-
var mailpoetTrackingEnabled = !!window.mailpoet_tracking_enabled;
|
20107 |
-
|
20108 |
-
var messages = {
|
20109 |
-
onTrash: function onTrash(response) {
|
20110 |
-
var count = Number(response.meta.count);
|
20111 |
-
var message = null;
|
20112 |
-
|
20113 |
-
if (count === 1) {
|
20114 |
-
message = _mailpoet2['default'].I18n.t('oneNewsletterTrashed');
|
20115 |
-
} else {
|
20116 |
-
message = _mailpoet2['default'].I18n.t('multipleNewslettersTrashed').replace('%$1d', count.toLocaleString());
|
20117 |
-
}
|
20118 |
-
_mailpoet2['default'].Notice.success(message);
|
20119 |
-
},
|
20120 |
-
onDelete: function onDelete(response) {
|
20121 |
-
var count = Number(response.meta.count);
|
20122 |
-
var message = null;
|
20123 |
-
|
20124 |
-
if (count === 1) {
|
20125 |
-
message = _mailpoet2['default'].I18n.t('oneNewsletterDeleted');
|
20126 |
-
} else {
|
20127 |
-
message = _mailpoet2['default'].I18n.t('multipleNewslettersDeleted').replace('%$1d', count.toLocaleString());
|
20128 |
-
}
|
20129 |
-
_mailpoet2['default'].Notice.success(message);
|
20130 |
-
},
|
20131 |
-
onRestore: function onRestore(response) {
|
20132 |
-
var count = Number(response.meta.count);
|
20133 |
-
var message = null;
|
20134 |
-
|
20135 |
-
if (count === 1) {
|
20136 |
-
message = _mailpoet2['default'].I18n.t('oneNewsletterRestored');
|
20137 |
-
} else {
|
20138 |
-
message = _mailpoet2['default'].I18n.t('multipleNewslettersRestored').replace('%$1d', count.toLocaleString());
|
20139 |
-
}
|
20140 |
-
_mailpoet2['default'].Notice.success(message);
|
20141 |
-
}
|
20142 |
-
};
|
20143 |
-
|
20144 |
-
var columns = [{
|
20145 |
-
name: 'subject',
|
20146 |
-
label: _mailpoet2['default'].I18n.t('subject'),
|
20147 |
-
sortable: true
|
20148 |
-
}, {
|
20149 |
-
name: 'status',
|
20150 |
-
label: _mailpoet2['default'].I18n.t('status'),
|
20151 |
-
width: 145
|
20152 |
-
}, {
|
20153 |
-
name: 'settings',
|
20154 |
-
label: _mailpoet2['default'].I18n.t('settings')
|
20155 |
-
}, {
|
20156 |
-
name: 'statistics',
|
20157 |
-
label: _mailpoet2['default'].I18n.t('statistics'),
|
20158 |
-
display: mailpoetTrackingEnabled
|
20159 |
-
}, {
|
20160 |
-
name: 'updated_at',
|
20161 |
-
label: _mailpoet2['default'].I18n.t('lastModifiedOn'),
|
20162 |
-
sortable: true
|
20163 |
-
}];
|
20164 |
-
|
20165 |
-
var bulkActions = [{
|
20166 |
-
name: 'trash',
|
20167 |
-
label: _mailpoet2['default'].I18n.t('moveToTrash'),
|
20168 |
-
onSuccess: messages.onTrash
|
20169 |
-
}];
|
20170 |
-
|
20171 |
-
var newsletterActions = [{
|
20172 |
-
name: 'view',
|
20173 |
-
link: function link(newsletter) {
|
20174 |
-
return _react2['default'].createElement(
|
20175 |
-
'a',
|
20176 |
-
{ href: newsletter.preview_url, target: '_blank' },
|
20177 |
-
_mailpoet2['default'].I18n.t('preview')
|
20178 |
-
);
|
20179 |
-
}
|
20180 |
-
}, {
|
20181 |
-
name: 'edit',
|
20182 |
-
link: function link(newsletter) {
|
20183 |
-
return _react2['default'].createElement(
|
20184 |
-
'a',
|
20185 |
-
{ href: '?page=mailpoet-newsletter-editor&id=' + newsletter.id },
|
20186 |
-
_mailpoet2['default'].I18n.t('edit')
|
20187 |
-
);
|
20188 |
-
}
|
20189 |
-
}, {
|
20190 |
-
name: 'trash'
|
20191 |
-
}];
|
20192 |
-
|
20193 |
-
_wpJsHooks2['default'].addFilter('mailpoet_newsletters_listings_welcome_notification_actions', _newslettersListingsMixinsJsx.StatisticsMixin.addStatsCTAAction);
|
20194 |
-
newsletterActions = _wpJsHooks2['default'].applyFilters('mailpoet_newsletters_listings_welcome_notification_actions', newsletterActions);
|
20195 |
-
|
20196 |
-
var NewsletterListWelcome = _react2['default'].createClass({
|
20197 |
-
displayName: 'NewsletterListWelcome',
|
20198 |
-
|
20199 |
-
mixins: [_newslettersListingsMixinsJsx.StatisticsMixin, _newslettersListingsMixinsJsx.MailerMixin],
|
20200 |
-
updateStatus: function updateStatus(e) {
|
20201 |
-
var _this = this;
|
20202 |
-
|
20203 |
-
// make the event persist so that we can still override the selected value
|
20204 |
-
// in the ajax callback
|
20205 |
-
e.persist();
|
20206 |
-
|
20207 |
-
_mailpoet2['default'].Ajax.post({
|
20208 |
-
api_version: window.mailpoet_api_version,
|
20209 |
-
endpoint: 'newsletters',
|
20210 |
-
action: 'setStatus',
|
20211 |
-
data: {
|
20212 |
-
id: Number(e.target.getAttribute('data-id')),
|
20213 |
-
status: e.target.value
|
20214 |
-
}
|
20215 |
-
}).done(function (response) {
|
20216 |
-
if (response.data.status === 'active') {
|
20217 |
-
_mailpoet2['default'].Notice.success(_mailpoet2['default'].I18n.t('welcomeEmailActivated'));
|
20218 |
-
}
|
20219 |
-
// force refresh of listing so that groups are updated
|
20220 |
-
_this.forceUpdate();
|
20221 |
-
}).fail(function (response) {
|
20222 |
-
_mailpoet2['default'].Notice.error(_mailpoet2['default'].I18n.t('welcomeEmailActivationFailed'));
|
20223 |
-
|
20224 |
-
// reset value to actual newsletter's status
|
20225 |
-
e.target.value = response.status;
|
20226 |
-
});
|
20227 |
-
},
|
20228 |
-
renderStatus: function renderStatus(newsletter) {
|
20229 |
-
var totalSent = parseInt(newsletter.total_sent, 10) ? _mailpoet2['default'].I18n.t('sentToXSubscribers').replace('%$1d', newsletter.total_sent.toLocaleString()) : _mailpoet2['default'].I18n.t('notSentYet');
|
20230 |
-
|
20231 |
-
return _react2['default'].createElement(
|
20232 |
-
'div',
|
20233 |
-
null,
|
20234 |
-
_react2['default'].createElement(
|
20235 |
-
'p',
|
20236 |
-
null,
|
20237 |
-
_react2['default'].createElement(
|
20238 |
-
'select',
|
20239 |
-
{
|
20240 |
-
'data-id': newsletter.id,
|
20241 |
-
defaultValue: newsletter.status,
|
20242 |
-
onChange: this.updateStatus
|
20243 |
-
},
|
20244 |
-
_react2['default'].createElement(
|
20245 |
-
'option',
|
20246 |
-
{ value: 'active' },
|
20247 |
-
_mailpoet2['default'].I18n.t('active')
|
20248 |
-
),
|
20249 |
-
_react2['default'].createElement(
|
20250 |
-
'option',
|
20251 |
-
{ value: 'draft' },
|
20252 |
-
_mailpoet2['default'].I18n.t('inactive')
|
20253 |
-
)
|
20254 |
-
)
|
20255 |
-
),
|
20256 |
-
_react2['default'].createElement(
|
20257 |
-
'p',
|
20258 |
-
null,
|
20259 |
-
totalSent
|
20260 |
-
)
|
20261 |
-
);
|
20262 |
-
},
|
20263 |
-
renderSettings: function renderSettings(newsletter) {
|
20264 |
-
var sendingEvent = undefined;
|
20265 |
-
var sendingDelay = undefined;
|
20266 |
-
var segment = undefined;
|
20267 |
-
|
20268 |
-
// set sending event
|
20269 |
-
switch (newsletter.options.event) {
|
20270 |
-
case 'user':
|
20271 |
-
// WP User
|
20272 |
-
if (newsletter.options.role === 'mailpoet_all') {
|
20273 |
-
sendingEvent = _mailpoet2['default'].I18n.t('welcomeEventWPUserAnyRole');
|
20274 |
-
} else {
|
20275 |
-
sendingEvent = _mailpoet2['default'].I18n.t('welcomeEventWPUserWithRole').replace('%$1s', mailpoetRoles[newsletter.options.role]);
|
20276 |
-
}
|
20277 |
-
break;
|
20278 |
-
|
20279 |
-
default:
|
20280 |
-
// get segment
|
20281 |
-
segment = _underscore2['default'].find(mailpoetSegments, function (seg) {
|
20282 |
-
return Number(seg.id) === Number(newsletter.options.segment);
|
20283 |
-
});
|
20284 |
-
|
20285 |
-
if (segment === undefined) {
|
20286 |
-
return _react2['default'].createElement(
|
20287 |
-
'span',
|
20288 |
-
{ className: 'mailpoet_error' },
|
20289 |
-
_mailpoet2['default'].I18n.t('sendingToSegmentsNotSpecified')
|
20290 |
-
);
|
20291 |
-
}
|
20292 |
-
sendingEvent = _mailpoet2['default'].I18n.t('welcomeEventSegment').replace('%$1s', segment.name);
|
20293 |
-
|
20294 |
-
break;
|
20295 |
-
}
|
20296 |
-
|
20297 |
-
// set sending delay
|
20298 |
-
if (sendingEvent) {
|
20299 |
-
if (newsletter.options.afterTimeType !== 'immediate') {
|
20300 |
-
switch (newsletter.options.afterTimeType) {
|
20301 |
-
case 'hours':
|
20302 |
-
sendingDelay = _mailpoet2['default'].I18n.t('sendingDelayHours').replace('%$1d', newsletter.options.afterTimeNumber);
|
20303 |
-
break;
|
20304 |
-
|
20305 |
-
case 'days':
|
20306 |
-
sendingDelay = _mailpoet2['default'].I18n.t('sendingDelayDays').replace('%$1d', newsletter.options.afterTimeNumber);
|
20307 |
-
break;
|
20308 |
-
|
20309 |
-
case 'weeks':
|
20310 |
-
sendingDelay = _mailpoet2['default'].I18n.t('sendingDelayWeeks').replace('%$1d', newsletter.options.afterTimeNumber);
|
20311 |
-
break;
|
20312 |
-
|
20313 |
-
default:
|
20314 |
-
sendingDelay = _mailpoet2['default'].I18n.t('sendingDelayInvalid');
|
20315 |
-
break;
|
20316 |
-
}
|
20317 |
-
sendingEvent += ' [' + sendingDelay + '].';
|
20318 |
-
}
|
20319 |
-
}
|
20320 |
-
|
20321 |
-
return _react2['default'].createElement(
|
20322 |
-
'span',
|
20323 |
-
null,
|
20324 |
-
sendingEvent
|
20325 |
-
);
|
20326 |
-
},
|
20327 |
-
renderItem: function renderItem(newsletter, actions) {
|
20328 |
-
var rowClasses = (0, _classnames2['default'])('manage-column', 'column-primary', 'has-row-actions');
|
20329 |
-
|
20330 |
-
return _react2['default'].createElement(
|
20331 |
-
'div',
|
20332 |
-
null,
|
20333 |
-
_react2['default'].createElement(
|
20334 |
-
'td',
|
20335 |
-
{ className: rowClasses },
|
20336 |
-
_react2['default'].createElement(
|
20337 |
-
'strong',
|
20338 |
-
null,
|
20339 |
-
_react2['default'].createElement(
|
20340 |
-
'a',
|
20341 |
-
{
|
20342 |
-
className: 'row-title',
|
20343 |
-
href: '?page=mailpoet-newsletter-editor&id=' + newsletter.id
|
20344 |
-
},
|
20345 |
-
newsletter.subject
|
20346 |
-
)
|
20347 |
-
),
|
20348 |
-
actions
|
20349 |
-
),
|
20350 |
-
_react2['default'].createElement(
|
20351 |
-
'td',
|
20352 |
-
{ className: 'column', 'data-colname': _mailpoet2['default'].I18n.t('status') },
|
20353 |
-
this.renderStatus(newsletter)
|
20354 |
-
),
|
20355 |
-
_react2['default'].createElement(
|
20356 |
-
'td',
|
20357 |
-
{ className: 'column', 'data-colname': _mailpoet2['default'].I18n.t('settings') },
|
20358 |
-
this.renderSettings(newsletter)
|
20359 |
-
),
|
20360 |
-
mailpoetTrackingEnabled === true ? _react2['default'].createElement(
|
20361 |
-
'td',
|
20362 |
-
{ className: 'column', 'data-colname': _mailpoet2['default'].I18n.t('statistics') },
|
20363 |
-
this.renderStatistics(newsletter, newsletter.total_sent > 0 && newsletter.statistics)
|
20364 |
-
) : null,
|
20365 |
-
_react2['default'].createElement(
|
20366 |
-
'td',
|
20367 |
-
{ className: 'column-date', 'data-colname': _mailpoet2['default'].I18n.t('lastModifiedOn') },
|
20368 |
-
_react2['default'].createElement(
|
20369 |
-
'abbr',
|
20370 |
-
null,
|
20371 |
-
_mailpoet2['default'].Date.format(newsletter.updated_at)
|
20372 |
-
)
|
20373 |
-
)
|
20374 |
-
);
|
20375 |
-
},
|
20376 |
-
render: function render() {
|
20377 |
-
return _react2['default'].createElement(
|
20378 |
-
'div',
|
20379 |
-
null,
|
20380 |
-
_react2['default'].createElement(_newslettersListingsHeadingJsx2['default'], null),
|
20381 |
-
_react2['default'].createElement(_newslettersListingsTabsJsx2['default'], { tab: 'welcome' }),
|
20382 |
-
_react2['default'].createElement(_listingListingJsx2['default'], {
|
20383 |
-
limit: window.mailpoet_listing_per_page,
|
20384 |
-
location: this.props.location,
|
20385 |
-
params: this.props.params,
|
20386 |
-
endpoint: 'newsletters',
|
20387 |
-
type: 'welcome',
|
20388 |
-
base_url: 'welcome',
|
20389 |
-
onRenderItem: this.renderItem,
|
20390 |
-
columns: columns,
|
20391 |
-
bulk_actions: bulkActions,
|
20392 |
-
item_actions: newsletterActions,
|
20393 |
-
messages: messages,
|
20394 |
-
auto_refresh: true,
|
20395 |
-
sort_by: 'updated_at',
|
20396 |
-
sort_order: 'desc',
|
20397 |
-
afterGetItems: this.checkMailerStatus
|
20398 |
-
})
|
20399 |
-
);
|
20400 |
-
}
|
20401 |
-
});
|
20402 |
-
|
20403 |
-
module.exports = NewsletterListWelcome;
|
20404 |
-
|
20405 |
-
/***/ },
|
20406 |
-
|
20407 |
-
/***/ 561:
|
20408 |
-
/***/ function(module, exports, __webpack_require__) {
|
20409 |
-
|
20410 |
-
'use strict';
|
20411 |
-
|
20412 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
20413 |
-
|
20414 |
-
var _react = __webpack_require__(2);
|
20415 |
-
|
20416 |
-
var _react2 = _interopRequireDefault(_react);
|
20417 |
-
|
20418 |
-
var _reactRouter = __webpack_require__(181);
|
20419 |
-
|
20420 |
-
var _listingListingJsx = __webpack_require__(279);
|
20421 |
-
|
20422 |
-
var _listingListingJsx2 = _interopRequireDefault(_listingListingJsx);
|
20423 |
-
|
20424 |
-
var _newslettersListingsTabsJsx = __webpack_require__(552);
|
20425 |
-
|
20426 |
-
var _newslettersListingsTabsJsx2 = _interopRequireDefault(_newslettersListingsTabsJsx);
|
20427 |
-
|
20428 |
-
var _newslettersListingsHeadingJsx = __webpack_require__(554);
|
20429 |
-
|
20430 |
-
var _newslettersListingsHeadingJsx2 = _interopRequireDefault(_newslettersListingsHeadingJsx);
|
20431 |
-
|
20432 |
-
var _newslettersListingsMixinsJsx = __webpack_require__(555);
|
20433 |
-
|
20434 |
-
var _classnames = __webpack_require__(277);
|
20435 |
-
|
20436 |
-
var _classnames2 = _interopRequireDefault(_classnames);
|
20437 |
-
|
20438 |
-
var _mailpoet = __webpack_require__(276);
|
20439 |
-
|
20440 |
-
var _mailpoet2 = _interopRequireDefault(_mailpoet);
|
20441 |
-
|
20442 |
-
var _newslettersSchedulingCommonJsx = __webpack_require__(536);
|
20443 |
-
|
20444 |
-
var messages = {
|
20445 |
-
onTrash: function onTrash(response) {
|
20446 |
-
var count = Number(response.meta.count);
|
20447 |
-
var message = null;
|
20448 |
-
|
20449 |
-
if (count === 1) {
|
20450 |
-
message = _mailpoet2['default'].I18n.t('oneNewsletterTrashed');
|
20451 |
-
} else {
|
20452 |
-
message = _mailpoet2['default'].I18n.t('multipleNewslettersTrashed').replace('%$1d', count.toLocaleString());
|
20453 |
-
}
|
20454 |
-
_mailpoet2['default'].Notice.success(message);
|
20455 |
-
},
|
20456 |
-
onDelete: function onDelete(response) {
|
20457 |
-
var count = Number(response.meta.count);
|
20458 |
-
var message = null;
|
20459 |
-
|
20460 |
-
if (count === 1) {
|
20461 |
-
message = _mailpoet2['default'].I18n.t('oneNewsletterDeleted');
|
20462 |
-
} else {
|
20463 |
-
message = _mailpoet2['default'].I18n.t('multipleNewslettersDeleted').replace('%$1d', count.toLocaleString());
|
20464 |
-
}
|
20465 |
-
_mailpoet2['default'].Notice.success(message);
|
20466 |
-
},
|
20467 |
-
onRestore: function onRestore(response) {
|
20468 |
-
var count = Number(response.meta.count);
|
20469 |
-
var message = null;
|
20470 |
-
|
20471 |
-
if (count === 1) {
|
20472 |
-
message = _mailpoet2['default'].I18n.t('oneNewsletterRestored');
|
20473 |
-
} else {
|
20474 |
-
message = _mailpoet2['default'].I18n.t('multipleNewslettersRestored').replace('%$1d', count.toLocaleString());
|
20475 |
-
}
|
20476 |
-
_mailpoet2['default'].Notice.success(message);
|
20477 |
-
}
|
20478 |
-
};
|
20479 |
-
|
20480 |
-
var columns = [{
|
20481 |
-
name: 'subject',
|
20482 |
-
label: _mailpoet2['default'].I18n.t('subject'),
|
20483 |
-
sortable: true
|
20484 |
-
}, {
|
20485 |
-
name: 'status',
|
20486 |
-
label: _mailpoet2['default'].I18n.t('status'),
|
20487 |
-
width: 100
|
20488 |
-
}, {
|
20489 |
-
name: 'settings',
|
20490 |
-
label: _mailpoet2['default'].I18n.t('settings')
|
20491 |
-
}, {
|
20492 |
-
name: 'history',
|
20493 |
-
label: _mailpoet2['default'].I18n.t('history'),
|
20494 |
-
width: 100
|
20495 |
-
}, {
|
20496 |
-
name: 'updated_at',
|
20497 |
-
label: _mailpoet2['default'].I18n.t('lastModifiedOn'),
|
20498 |
-
sortable: true
|
20499 |
-
}];
|
20500 |
-
|
20501 |
-
var bulkActions = [{
|
20502 |
-
name: 'trash',
|
20503 |
-
label: _mailpoet2['default'].I18n.t('moveToTrash'),
|
20504 |
-
onSuccess: messages.onTrash
|
20505 |
-
}];
|
20506 |
-
|
20507 |
-
var newsletterActions = [{
|
20508 |
-
name: 'view',
|
20509 |
-
link: function link(newsletter) {
|
20510 |
-
return _react2['default'].createElement(
|
20511 |
-
'a',
|
20512 |
-
{ href: newsletter.preview_url, target: '_blank' },
|
20513 |
-
_mailpoet2['default'].I18n.t('preview')
|
20514 |
-
);
|
20515 |
-
}
|
20516 |
-
}, {
|
20517 |
-
name: 'edit',
|
20518 |
-
link: function link(newsletter) {
|
20519 |
-
return _react2['default'].createElement(
|
20520 |
-
'a',
|
20521 |
-
{ href: '?page=mailpoet-newsletter-editor&id=' + newsletter.id },
|
20522 |
-
_mailpoet2['default'].I18n.t('edit')
|
20523 |
-
);
|
20524 |
-
}
|
20525 |
-
}, {
|
20526 |
-
name: 'duplicate',
|
20527 |
-
label: _mailpoet2['default'].I18n.t('duplicate'),
|
20528 |
-
onClick: function onClick(newsletter, refresh) {
|
20529 |
-
return _mailpoet2['default'].Ajax.post({
|
20530 |
-
api_version: window.mailpoet_api_version,
|
20531 |
-
endpoint: 'newsletters',
|
20532 |
-
action: 'duplicate',
|
20533 |
-
data: {
|
20534 |
-
id: newsletter.id
|
20535 |
-
}
|
20536 |
-
}).done(function (response) {
|
20537 |
-
_mailpoet2['default'].Notice.success(_mailpoet2['default'].I18n.t('newsletterDuplicated').replace('%$1s', response.data.subject));
|
20538 |
-
refresh();
|
20539 |
-
}).fail(function (response) {
|
20540 |
-
if (response.errors.length > 0) {
|
20541 |
-
_mailpoet2['default'].Notice.error(response.errors.map(function (error) {
|
20542 |
-
return error.message;
|
20543 |
-
}), { scroll: true });
|
20544 |
-
}
|
20545 |
-
});
|
20546 |
-
}
|
20547 |
-
}, {
|
20548 |
-
name: 'trash'
|
20549 |
-
}];
|
20550 |
-
|
20551 |
-
var NewsletterListNotification = _react2['default'].createClass({
|
20552 |
-
displayName: 'NewsletterListNotification',
|
20553 |
-
|
20554 |
-
mixins: [_newslettersListingsMixinsJsx.MailerMixin],
|
20555 |
-
updateStatus: function updateStatus(e) {
|
20556 |
-
var _this = this;
|
20557 |
-
|
20558 |
-
// make the event persist so that we can still override the selected value
|
20559 |
-
// in the ajax callback
|
20560 |
-
e.persist();
|
20561 |
-
|
20562 |
-
_mailpoet2['default'].Ajax.post({
|
20563 |
-
api_version: window.mailpoet_api_version,
|
20564 |
-
endpoint: 'newsletters',
|
20565 |
-
action: 'setStatus',
|
20566 |
-
data: {
|
20567 |
-
id: Number(e.target.getAttribute('data-id')),
|
20568 |
-
status: e.target.value
|
20569 |
-
}
|
20570 |
-
}).done(function (response) {
|
20571 |
-
if (response.data.status === 'active') {
|
20572 |
-
_mailpoet2['default'].Notice.success(_mailpoet2['default'].I18n.t('postNotificationActivated'));
|
20573 |
-
}
|
20574 |
-
// force refresh of listing so that groups are updated
|
20575 |
-
_this.forceUpdate();
|
20576 |
-
}).fail(function (response) {
|
20577 |
-
_mailpoet2['default'].Notice.error(_mailpoet2['default'].I18n.t('postNotificationActivationFailed'));
|
20578 |
-
|
20579 |
-
// reset value to actual newsletter's status
|
20580 |
-
e.target.value = response.status;
|
20581 |
-
});
|
20582 |
-
},
|
20583 |
-
renderStatus: function renderStatus(newsletter) {
|
20584 |
-
return _react2['default'].createElement(
|
20585 |
-
'select',
|
20586 |
-
{
|
20587 |
-
'data-id': newsletter.id,
|
20588 |
-
defaultValue: newsletter.status,
|
20589 |
-
onChange: this.updateStatus
|
20590 |
-
},
|
20591 |
-
_react2['default'].createElement(
|
20592 |
-
'option',
|
20593 |
-
{ value: 'active' },
|
20594 |
-
_mailpoet2['default'].I18n.t('active')
|
20595 |
-
),
|
20596 |
-
_react2['default'].createElement(
|
20597 |
-
'option',
|
20598 |
-
{ value: 'draft' },
|
20599 |
-
_mailpoet2['default'].I18n.t('inactive')
|
20600 |
-
)
|
20601 |
-
);
|
20602 |
-
},
|
20603 |
-
renderSettings: function renderSettings(newsletter) {
|
20604 |
-
var sendingFrequency = undefined;
|
20605 |
-
|
20606 |
-
// get list of segments' name
|
20607 |
-
var segments = newsletter.segments.map(function (segment) {
|
20608 |
-
return segment.name;
|
20609 |
-
});
|
20610 |
-
var sendingToSegments = _mailpoet2['default'].I18n.t('ifNewContentToSegments').replace('%$1s', segments.join(', '));
|
20611 |
-
|
20612 |
-
// check if the user has specified segments to send to
|
20613 |
-
if (segments.length === 0) {
|
20614 |
-
return _react2['default'].createElement(
|
20615 |
-
'span',
|
20616 |
-
{ className: 'mailpoet_error' },
|
20617 |
-
_mailpoet2['default'].I18n.t('sendingToSegmentsNotSpecified')
|
20618 |
-
);
|
20619 |
-
}
|
20620 |
-
|
20621 |
-
// set sending frequency
|
20622 |
-
switch (newsletter.options.intervalType) {
|
20623 |
-
case 'daily':
|
20624 |
-
sendingFrequency = _mailpoet2['default'].I18n.t('sendDaily').replace('%$1s', _newslettersSchedulingCommonJsx.timeOfDayValues[newsletter.options.timeOfDay]);
|
20625 |
-
break;
|
20626 |
-
|
20627 |
-
case 'weekly':
|
20628 |
-
sendingFrequency = _mailpoet2['default'].I18n.t('sendWeekly').replace('%$1s', _newslettersSchedulingCommonJsx.weekDayValues[newsletter.options.weekDay]).replace('%$2s', _newslettersSchedulingCommonJsx.timeOfDayValues[newsletter.options.timeOfDay]);
|
20629 |
-
break;
|
20630 |
-
|
20631 |
-
case 'monthly':
|
20632 |
-
sendingFrequency = _mailpoet2['default'].I18n.t('sendMonthly').replace('%$1s', _newslettersSchedulingCommonJsx.monthDayValues[newsletter.options.monthDay]).replace('%$2s', _newslettersSchedulingCommonJsx.timeOfDayValues[newsletter.options.timeOfDay]);
|
20633 |
-
break;
|
20634 |
-
|
20635 |
-
case 'nthWeekDay':
|
20636 |
-
sendingFrequency = _mailpoet2['default'].I18n.t('sendNthWeekDay').replace('%$1s', _newslettersSchedulingCommonJsx.nthWeekDayValues[newsletter.options.nthWeekDay]).replace('%$2s', _newslettersSchedulingCommonJsx.weekDayValues[newsletter.options.weekDay]).replace('%$3s', _newslettersSchedulingCommonJsx.timeOfDayValues[newsletter.options.timeOfDay]);
|
20637 |
-
break;
|
20638 |
-
|
20639 |
-
case 'immediately':
|
20640 |
-
sendingFrequency = _mailpoet2['default'].I18n.t('sendImmediately');
|
20641 |
-
break;
|
20642 |
-
|
20643 |
-
default:
|
20644 |
-
sendingFrequency = 'Invalid sending frequency';
|
20645 |
-
break;
|
20646 |
-
}
|
20647 |
-
|
20648 |
-
return _react2['default'].createElement(
|
20649 |
-
'span',
|
20650 |
-
null,
|
20651 |
-
sendingFrequency,
|
20652 |
-
' ',
|
20653 |
-
sendingToSegments
|
20654 |
-
);
|
20655 |
-
},
|
20656 |
-
renderHistoryLink: function renderHistoryLink(newsletter) {
|
20657 |
-
var childrenCount = Number(newsletter.children_count);
|
20658 |
-
if (childrenCount === 0) {
|
20659 |
-
return _mailpoet2['default'].I18n.t('notSentYet');
|
20660 |
-
}
|
20661 |
-
return _react2['default'].createElement(
|
20662 |
-
_reactRouter.Link,
|
20663 |
-
{
|
20664 |
-
to: '/notification/history/' + newsletter.id
|
20665 |
-
},
|
20666 |
-
_mailpoet2['default'].I18n.t('viewHistory')
|
20667 |
-
);
|
20668 |
-
},
|
20669 |
-
renderItem: function renderItem(newsletter, actions) {
|
20670 |
-
var rowClasses = (0, _classnames2['default'])('manage-column', 'column-primary', 'has-row-actions');
|
20671 |
-
|
20672 |
-
return _react2['default'].createElement(
|
20673 |
-
'div',
|
20674 |
-
null,
|
20675 |
-
_react2['default'].createElement(
|
20676 |
-
'td',
|
20677 |
-
{ className: rowClasses },
|
20678 |
-
_react2['default'].createElement(
|
20679 |
-
'strong',
|
20680 |
-
null,
|
20681 |
-
_react2['default'].createElement(
|
20682 |
-
'a',
|
20683 |
-
{
|
20684 |
-
className: 'row-title',
|
20685 |
-
href: '?page=mailpoet-newsletter-editor&id=' + newsletter.id
|
20686 |
-
},
|
20687 |
-
newsletter.subject
|
20688 |
-
)
|
20689 |
-
),
|
20690 |
-
actions
|
20691 |
-
),
|
20692 |
-
_react2['default'].createElement(
|
20693 |
-
'td',
|
20694 |
-
{ className: 'column', 'data-colname': _mailpoet2['default'].I18n.t('status') },
|
20695 |
-
this.renderStatus(newsletter)
|
20696 |
-
),
|
20697 |
-
_react2['default'].createElement(
|
20698 |
-
'td',
|
20699 |
-
{ className: 'column', 'data-colname': _mailpoet2['default'].I18n.t('settings') },
|
20700 |
-
this.renderSettings(newsletter)
|
20701 |
-
),
|
20702 |
-
_react2['default'].createElement(
|
20703 |
-
'td',
|
20704 |
-
{ className: 'column', 'data-colname': _mailpoet2['default'].I18n.t('history') },
|
20705 |
-
this.renderHistoryLink(newsletter)
|
20706 |
-
),
|
20707 |
-
_react2['default'].createElement(
|
20708 |
-
'td',
|
20709 |
-
{ className: 'column-date', 'data-colname': _mailpoet2['default'].I18n.t('lastModifiedOn') },
|
20710 |
-
_react2['default'].createElement(
|
20711 |
-
'abbr',
|
20712 |
-
null,
|
20713 |
-
_mailpoet2['default'].Date.format(newsletter.updated_at)
|
20714 |
-
)
|
20715 |
-
)
|
20716 |
-
);
|
20717 |
-
},
|
20718 |
-
render: function render() {
|
20719 |
-
return _react2['default'].createElement(
|
20720 |
-
'div',
|
20721 |
-
null,
|
20722 |
-
_react2['default'].createElement(_newslettersListingsHeadingJsx2['default'], null),
|
20723 |
-
_react2['default'].createElement(_newslettersListingsTabsJsx2['default'], { tab: 'notification' }),
|
20724 |
-
_react2['default'].createElement(_listingListingJsx2['default'], {
|
20725 |
-
limit: window.mailpoet_listing_per_page,
|
20726 |
-
location: this.props.location,
|
20727 |
-
params: this.props.params,
|
20728 |
-
endpoint: 'newsletters',
|
20729 |
-
type: 'notification',
|
20730 |
-
base_url: 'notification',
|
20731 |
-
onRenderItem: this.renderItem,
|
20732 |
-
columns: columns,
|
20733 |
-
bulk_actions: bulkActions,
|
20734 |
-
item_actions: newsletterActions,
|
20735 |
-
messages: messages,
|
20736 |
-
auto_refresh: true,
|
20737 |
-
sort_by: 'updated_at',
|
20738 |
-
sort_order: 'desc',
|
20739 |
-
afterGetItems: this.checkMailerStatus
|
20740 |
-
})
|
20741 |
-
);
|
20742 |
-
}
|
20743 |
-
});
|
20744 |
-
|
20745 |
-
module.exports = NewsletterListNotification;
|
20746 |
-
|
20747 |
-
/***/ },
|
20748 |
-
|
20749 |
-
/***/ 562:
|
20750 |
-
/***/ function(module, exports, __webpack_require__) {
|
20751 |
-
|
20752 |
-
'use strict';
|
20753 |
-
|
20754 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
20755 |
-
|
20756 |
-
var _react = __webpack_require__(2);
|
20757 |
-
|
20758 |
-
var _react2 = _interopRequireDefault(_react);
|
20759 |
-
|
20760 |
-
var _reactRouter = __webpack_require__(181);
|
20761 |
-
|
20762 |
-
var _classnames = __webpack_require__(277);
|
20763 |
-
|
20764 |
-
var _classnames2 = _interopRequireDefault(_classnames);
|
20765 |
-
|
20766 |
-
var _mailpoet = __webpack_require__(276);
|
20767 |
-
|
20768 |
-
var _mailpoet2 = _interopRequireDefault(_mailpoet);
|
20769 |
-
|
20770 |
-
var _wpJsHooks = __webpack_require__(438);
|
20771 |
-
|
20772 |
-
var _wpJsHooks2 = _interopRequireDefault(_wpJsHooks);
|
20773 |
-
|
20774 |
-
var _listingListingJsx = __webpack_require__(279);
|
20775 |
-
|
20776 |
-
var _listingListingJsx2 = _interopRequireDefault(_listingListingJsx);
|
20777 |
-
|
20778 |
-
var _newslettersListingsTabsJsx = __webpack_require__(552);
|
20779 |
-
|
20780 |
-
var _newslettersListingsTabsJsx2 = _interopRequireDefault(_newslettersListingsTabsJsx);
|
20781 |
-
|
20782 |
-
var _newslettersListingsHeadingJsx = __webpack_require__(554);
|
20783 |
-
|
20784 |
-
var _newslettersListingsHeadingJsx2 = _interopRequireDefault(_newslettersListingsHeadingJsx);
|
20785 |
-
|
20786 |
-
var _newslettersListingsMixinsJsx = __webpack_require__(555);
|
20787 |
-
|
20788 |
-
var mailpoetTrackingEnabled = !!window.mailpoet_tracking_enabled;
|
20789 |
-
|
20790 |
-
var columns = [{
|
20791 |
-
name: 'subject',
|
20792 |
-
label: _mailpoet2['default'].I18n.t('subject')
|
20793 |
-
}, {
|
20794 |
-
name: 'status',
|
20795 |
-
label: _mailpoet2['default'].I18n.t('status')
|
20796 |
-
}, {
|
20797 |
-
name: 'segments',
|
20798 |
-
label: _mailpoet2['default'].I18n.t('lists')
|
20799 |
-
}, {
|
20800 |
-
name: 'statistics',
|
20801 |
-
label: _mailpoet2['default'].I18n.t('statistics'),
|
20802 |
-
display: mailpoetTrackingEnabled
|
20803 |
-
}, {
|
20804 |
-
name: 'sent_at',
|
20805 |
-
label: _mailpoet2['default'].I18n.t('sentOn')
|
20806 |
-
}];
|
20807 |
-
|
20808 |
-
var newsletterActions = [{
|
20809 |
-
name: 'view',
|
20810 |
-
link: function link(newsletter) {
|
20811 |
-
return _react2['default'].createElement(
|
20812 |
-
'a',
|
20813 |
-
{ href: newsletter.preview_url, target: '_blank' },
|
20814 |
-
_mailpoet2['default'].I18n.t('preview')
|
20815 |
-
);
|
20816 |
-
}
|
20817 |
-
}];
|
20818 |
-
|
20819 |
-
_wpJsHooks2['default'].addFilter('mailpoet_newsletters_listings_notification_history_actions', _newslettersListingsMixinsJsx.StatisticsMixin.addStatsCTAAction);
|
20820 |
-
newsletterActions = _wpJsHooks2['default'].applyFilters('mailpoet_newsletters_listings_notification_history_actions', newsletterActions);
|
20821 |
-
|
20822 |
-
var NewsletterListNotificationHistory = _react2['default'].createClass({
|
20823 |
-
displayName: 'NewsletterListNotificationHistory',
|
20824 |
-
|
20825 |
-
mixins: [_newslettersListingsMixinsJsx.QueueMixin, _newslettersListingsMixinsJsx.StatisticsMixin, _newslettersListingsMixinsJsx.MailerMixin],
|
20826 |
-
renderItem: function renderItem(newsletter, actions, meta) {
|
20827 |
-
var rowClasses = (0, _classnames2['default'])('manage-column', 'column-primary', 'has-row-actions');
|
20828 |
-
|
20829 |
-
var segments = newsletter.segments.map(function (segment) {
|
20830 |
-
return segment.name;
|
20831 |
-
}).join(', ');
|
20832 |
-
|
20833 |
-
return _react2['default'].createElement(
|
20834 |
-
'div',
|
20835 |
-
null,
|
20836 |
-
_react2['default'].createElement(
|
20837 |
-
'td',
|
20838 |
-
{ className: rowClasses },
|
20839 |
-
_react2['default'].createElement(
|
20840 |
-
'strong',
|
20841 |
-
null,
|
20842 |
-
_react2['default'].createElement(
|
20843 |
-
'a',
|
20844 |
-
{
|
20845 |
-
href: newsletter.preview_url,
|
20846 |
-
target: '_blank'
|
20847 |
-
},
|
20848 |
-
newsletter.queue.newsletter_rendered_subject || newsletter.subject
|
20849 |
-
)
|
20850 |
-
),
|
20851 |
-
actions
|
20852 |
-
),
|
20853 |
-
_react2['default'].createElement(
|
20854 |
-
'td',
|
20855 |
-
{ className: 'column', 'data-colname': _mailpoet2['default'].I18n.t('status') },
|
20856 |
-
this.renderQueueStatus(newsletter, meta.mta_log)
|
20857 |
-
),
|
20858 |
-
_react2['default'].createElement(
|
20859 |
-
'td',
|
20860 |
-
{ className: 'column', 'data-colname': _mailpoet2['default'].I18n.t('lists') },
|
20861 |
-
segments
|
20862 |
-
),
|
20863 |
-
mailpoetTrackingEnabled === true ? _react2['default'].createElement(
|
20864 |
-
'td',
|
20865 |
-
{ className: 'column', 'data-colname': _mailpoet2['default'].I18n.t('statistics') },
|
20866 |
-
this.renderStatistics(newsletter, undefined, meta.current_time)
|
20867 |
-
) : null,
|
20868 |
-
_react2['default'].createElement(
|
20869 |
-
'td',
|
20870 |
-
{ className: 'column-date', 'data-colname': _mailpoet2['default'].I18n.t('sentOn') },
|
20871 |
-
newsletter.sent_at ? _mailpoet2['default'].Date.format(newsletter.sent_at) : _mailpoet2['default'].I18n.t('notSentYet')
|
20872 |
-
)
|
20873 |
-
);
|
20874 |
-
},
|
20875 |
-
render: function render() {
|
20876 |
-
return _react2['default'].createElement(
|
20877 |
-
'div',
|
20878 |
-
null,
|
20879 |
-
_react2['default'].createElement(_newslettersListingsHeadingJsx2['default'], null),
|
20880 |
-
_react2['default'].createElement(_newslettersListingsTabsJsx2['default'], { tab: 'notification' }),
|
20881 |
-
_react2['default'].createElement(
|
20882 |
-
_reactRouter.Link,
|
20883 |
-
{
|
20884 |
-
className: 'page-title-action',
|
20885 |
-
to: '/notification'
|
20886 |
-
},
|
20887 |
-
_mailpoet2['default'].I18n.t('backToPostNotifications')
|
20888 |
-
),
|
20889 |
-
_react2['default'].createElement(_listingListingJsx2['default'], {
|
20890 |
-
limit: window.mailpoet_listing_per_page,
|
20891 |
-
location: this.props.location,
|
20892 |
-
params: this.props.params,
|
20893 |
-
endpoint: 'newsletters',
|
20894 |
-
type: 'notification_history',
|
20895 |
-
base_url: 'notification/history/:parent_id',
|
20896 |
-
onRenderItem: this.renderItem,
|
20897 |
-
columns: columns,
|
20898 |
-
item_actions: newsletterActions,
|
20899 |
-
auto_refresh: true,
|
20900 |
-
sort_by: 'sent_at',
|
20901 |
-
sort_order: 'desc',
|
20902 |
-
afterGetItems: this.checkMailerStatus
|
20903 |
-
})
|
20904 |
-
);
|
20905 |
-
}
|
20906 |
-
});
|
20907 |
-
|
20908 |
-
module.exports = NewsletterListNotificationHistory;
|
20909 |
-
|
20910 |
-
/***/ },
|
20911 |
-
|
20912 |
-
/***/ 563:
|
20913 |
-
/***/ function(module, exports, __webpack_require__) {
|
20914 |
-
|
20915 |
-
'use strict';
|
20916 |
-
|
20917 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
20918 |
-
|
20919 |
-
var _react = __webpack_require__(2);
|
20920 |
-
|
20921 |
-
var _react2 = _interopRequireDefault(_react);
|
20922 |
-
|
20923 |
-
var _reactDom = __webpack_require__(34);
|
20924 |
-
|
20925 |
-
var _reactDom2 = _interopRequireDefault(_reactDom);
|
20926 |
-
|
20927 |
-
var _reactRouter = __webpack_require__(181);
|
20928 |
-
|
20929 |
-
var _history = __webpack_require__(244);
|
20930 |
-
|
20931 |
-
var _segmentsListJsx = __webpack_require__(564);
|
20932 |
-
|
20933 |
-
var _segmentsListJsx2 = _interopRequireDefault(_segmentsListJsx);
|
20934 |
-
|
20935 |
-
var _segmentsFormJsx = __webpack_require__(565);
|
20936 |
-
|
20937 |
-
var _segmentsFormJsx2 = _interopRequireDefault(_segmentsFormJsx);
|
20938 |
-
|
20939 |
-
var history = (0, _reactRouter.useRouterHistory)(_history.createHashHistory)({ queryKey: false });
|
20940 |
-
|
20941 |
-
var App = _react2['default'].createClass({
|
20942 |
-
displayName: 'App',
|
20943 |
-
|
20944 |
-
render: function render() {
|
20945 |
-
return this.props.children;
|
20946 |
-
}
|
20947 |
-
});
|
20948 |
-
|
20949 |
-
var container = document.getElementById('segments_container');
|
20950 |
-
|
20951 |
-
if (container) {
|
20952 |
-
_reactDom2['default'].render(_react2['default'].createElement(
|
20953 |
-
_reactRouter.Router,
|
20954 |
-
{ history: history },
|
20955 |
-
_react2['default'].createElement(
|
20956 |
-
_reactRouter.Route,
|
20957 |
-
{ path: '/', component: App },
|
20958 |
-
_react2['default'].createElement(_reactRouter.IndexRoute, { component: _segmentsListJsx2['default'] }),
|
20959 |
-
_react2['default'].createElement(_reactRouter.Route, { path: 'new', component: _segmentsFormJsx2['default'] }),
|
20960 |
-
_react2['default'].createElement(_reactRouter.Route, { path: 'edit/:id', component: _segmentsFormJsx2['default'] }),
|
20961 |
-
_react2['default'].createElement(_reactRouter.Route, { path: '*', component: _segmentsListJsx2['default'] })
|
20962 |
-
)
|
20963 |
-
), container);
|
20964 |
-
}
|
20965 |
-
|
20966 |
-
/***/ },
|
20967 |
-
|
20968 |
-
/***/ 564:
|
20969 |
-
/***/ function(module, exports, __webpack_require__) {
|
20970 |
-
|
20971 |
-
'use strict';
|
20972 |
-
|
20973 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
20974 |
-
|
20975 |
-
var _react = __webpack_require__(2);
|
20976 |
-
|
20977 |
-
var _react2 = _interopRequireDefault(_react);
|
20978 |
-
|
20979 |
-
var _reactRouter = __webpack_require__(181);
|
20980 |
-
|
20981 |
-
var _mailpoet = __webpack_require__(276);
|
20982 |
-
|
20983 |
-
var _mailpoet2 = _interopRequireDefault(_mailpoet);
|
20984 |
-
|
20985 |
-
var _classnames = __webpack_require__(277);
|
20986 |
-
|
20987 |
-
var _classnames2 = _interopRequireDefault(_classnames);
|
20988 |
-
|
20989 |
-
var _listingListingJsx = __webpack_require__(279);
|
20990 |
-
|
20991 |
-
var _listingListingJsx2 = _interopRequireDefault(_listingListingJsx);
|
20992 |
-
|
20993 |
-
var columns = [{
|
20994 |
-
name: 'name',
|
20995 |
-
label: _mailpoet2['default'].I18n.t('name'),
|
20996 |
-
sortable: true
|
20997 |
-
}, {
|
20998 |
-
name: 'description',
|
20999 |
-
label: _mailpoet2['default'].I18n.t('description')
|
21000 |
-
}, {
|
21001 |
-
name: 'subscribed',
|
21002 |
-
label: _mailpoet2['default'].I18n.t('subscribed')
|
21003 |
-
}, {
|
21004 |
-
name: 'unconfirmed',
|
21005 |
-
label: _mailpoet2['default'].I18n.t('unconfirmed')
|
21006 |
-
}, {
|
21007 |
-
name: 'unsubscribed',
|
21008 |
-
label: _mailpoet2['default'].I18n.t('unsubscribed')
|
21009 |
-
}, {
|
21010 |
-
name: 'bounced',
|
21011 |
-
label: _mailpoet2['default'].I18n.t('bounced')
|
21012 |
-
}, {
|
21013 |
-
name: 'created_at',
|
21014 |
-
label: _mailpoet2['default'].I18n.t('createdOn'),
|
21015 |
-
sortable: true
|
21016 |
-
}];
|
21017 |
-
|
21018 |
-
var messages = {
|
21019 |
-
onTrash: function onTrash(response) {
|
21020 |
-
var count = Number(response.meta.count);
|
21021 |
-
var message = null;
|
21022 |
-
|
21023 |
-
if (count === 1) {
|
21024 |
-
message = _mailpoet2['default'].I18n.t('oneSegmentTrashed');
|
21025 |
-
} else {
|
21026 |
-
message = _mailpoet2['default'].I18n.t('multipleSegmentsTrashed').replace('%$1d', count.toLocaleString());
|
21027 |
-
}
|
21028 |
-
_mailpoet2['default'].Notice.success(message);
|
21029 |
-
},
|
21030 |
-
onDelete: function onDelete(response) {
|
21031 |
-
var count = Number(response.meta.count);
|
21032 |
-
var message = null;
|
21033 |
-
|
21034 |
-
if (count === 1) {
|
21035 |
-
message = _mailpoet2['default'].I18n.t('oneSegmentDeleted');
|
21036 |
-
} else {
|
21037 |
-
message = _mailpoet2['default'].I18n.t('multipleSegmentsDeleted').replace('%$1d', count.toLocaleString());
|
21038 |
-
}
|
21039 |
-
_mailpoet2['default'].Notice.success(message);
|
21040 |
-
},
|
21041 |
-
onRestore: function onRestore(response) {
|
21042 |
-
var count = Number(response.meta.count);
|
21043 |
-
var message = null;
|
21044 |
-
|
21045 |
-
if (count === 1) {
|
21046 |
-
message = _mailpoet2['default'].I18n.t('oneSegmentRestored');
|
21047 |
-
} else {
|
21048 |
-
message = _mailpoet2['default'].I18n.t('multipleSegmentsRestored').replace('%$1d', count.toLocaleString());
|
21049 |
-
}
|
21050 |
-
_mailpoet2['default'].Notice.success(message);
|
21051 |
-
}
|
21052 |
-
};
|
21053 |
-
|
21054 |
-
var bulkActions = [{
|
21055 |
-
name: 'trash',
|
21056 |
-
label: _mailpoet2['default'].I18n.t('moveToTrash'),
|
21057 |
-
onSuccess: messages.onTrash
|
21058 |
-
}];
|
21059 |
-
|
21060 |
-
var itemActions = [{
|
21061 |
-
name: 'edit',
|
21062 |
-
link: function link(item) {
|
21063 |
-
return _react2['default'].createElement(
|
21064 |
-
_reactRouter.Link,
|
21065 |
-
{ to: '/edit/' + item.id },
|
21066 |
-
_mailpoet2['default'].I18n.t('edit')
|
21067 |
-
);
|
21068 |
-
},
|
21069 |
-
display: function display(segment) {
|
21070 |
-
return segment.type !== 'wp_users';
|
21071 |
-
}
|
21072 |
-
}, {
|
21073 |
-
name: 'duplicate_segment',
|
21074 |
-
label: _mailpoet2['default'].I18n.t('duplicate'),
|
21075 |
-
onClick: function onClick(item, refresh) {
|
21076 |
-
return _mailpoet2['default'].Ajax.post({
|
21077 |
-
api_version: window.mailpoet_api_version,
|
21078 |
-
endpoint: 'segments',
|
21079 |
-
action: 'duplicate',
|
21080 |
-
data: {
|
21081 |
-
id: item.id
|
21082 |
-
}
|
21083 |
-
}).done(function (response) {
|
21084 |
-
_mailpoet2['default'].Notice.success(_mailpoet2['default'].I18n.t('listDuplicated').replace('%$1s', response.data.name));
|
21085 |
-
refresh();
|
21086 |
-
}).fail(function (response) {
|
21087 |
-
_mailpoet2['default'].Notice.error(response.errors.map(function (error) {
|
21088 |
-
return error.message;
|
21089 |
-
}), { scroll: true });
|
21090 |
-
});
|
21091 |
-
},
|
21092 |
-
display: function display(segment) {
|
21093 |
-
return segment.type !== 'wp_users';
|
21094 |
-
}
|
21095 |
-
}, {
|
21096 |
-
name: 'read_more',
|
21097 |
-
link: function link() {
|
21098 |
-
return _react2['default'].createElement(
|
21099 |
-
'a',
|
21100 |
-
{
|
21101 |
-
href: 'http://docs.mailpoet.com/article/133-the-wordpress-users-list',
|
21102 |
-
target: '_blank',
|
21103 |
-
rel: 'noopener noreferrer'
|
21104 |
-
},
|
21105 |
-
_mailpoet2['default'].I18n.t('readMore')
|
21106 |
-
);
|
21107 |
-
},
|
21108 |
-
display: function display(segment) {
|
21109 |
-
return segment.type === 'wp_users';
|
21110 |
-
}
|
21111 |
-
}, {
|
21112 |
-
name: 'synchronize_segment',
|
21113 |
-
label: _mailpoet2['default'].I18n.t('forceSync'),
|
21114 |
-
onClick: function onClick(item, refresh) {
|
21115 |
-
_mailpoet2['default'].Modal.loading(true);
|
21116 |
-
_mailpoet2['default'].Ajax.post({
|
21117 |
-
api_version: window.mailpoet_api_version,
|
21118 |
-
endpoint: 'segments',
|
21119 |
-
action: 'synchronize'
|
21120 |
-
}).done(function () {
|
21121 |
-
_mailpoet2['default'].Modal.loading(false);
|
21122 |
-
_mailpoet2['default'].Notice.success(_mailpoet2['default'].I18n.t('listSynchronized').replace('%$1s', item.name));
|
21123 |
-
refresh();
|
21124 |
-
}).fail(function (response) {
|
21125 |
-
_mailpoet2['default'].Modal.loading(false);
|
21126 |
-
if (response.errors.length > 0) {
|
21127 |
-
_mailpoet2['default'].Notice.error(response.errors.map(function (error) {
|
21128 |
-
return error.message;
|
21129 |
-
}), { scroll: true });
|
21130 |
-
}
|
21131 |
-
});
|
21132 |
-
},
|
21133 |
-
display: function display(segment) {
|
21134 |
-
return segment.type === 'wp_users';
|
21135 |
-
}
|
21136 |
-
}, {
|
21137 |
-
name: 'view_subscribers',
|
21138 |
-
link: function link(item) {
|
21139 |
-
return _react2['default'].createElement(
|
21140 |
-
'a',
|
21141 |
-
{ href: item.subscribers_url },
|
21142 |
-
_mailpoet2['default'].I18n.t('viewSubscribers')
|
21143 |
-
);
|
21144 |
-
}
|
21145 |
-
}, {
|
21146 |
-
name: 'trash',
|
21147 |
-
display: function display(segment) {
|
21148 |
-
return segment.type !== 'wp_users';
|
21149 |
-
}
|
21150 |
-
}];
|
21151 |
-
|
21152 |
-
var SegmentList = _react2['default'].createClass({
|
21153 |
-
displayName: 'SegmentList',
|
21154 |
-
|
21155 |
-
renderItem: function renderItem(segment, actions) {
|
21156 |
-
var rowClasses = (0, _classnames2['default'])('manage-column', 'column-primary', 'has-row-actions');
|
21157 |
-
|
21158 |
-
var subscribed = Number(segment.subscribers_count.subscribed || 0);
|
21159 |
-
var unconfirmed = Number(segment.subscribers_count.unconfirmed || 0);
|
21160 |
-
var unsubscribed = Number(segment.subscribers_count.unsubscribed || 0);
|
21161 |
-
var bounced = Number(segment.subscribers_count.bounced || 0);
|
21162 |
-
|
21163 |
-
var segmentName = undefined;
|
21164 |
-
|
21165 |
-
if (segment.type === 'wp_users') {
|
21166 |
-
// the WP users segment is not editable so just display its name
|
21167 |
-
segmentName = _react2['default'].createElement(
|
21168 |
-
'span',
|
21169 |
-
{ className: 'row-title' },
|
21170 |
-
segment.name
|
21171 |
-
);
|
21172 |
-
} else {
|
21173 |
-
segmentName = _react2['default'].createElement(
|
21174 |
-
_reactRouter.Link,
|
21175 |
-
{
|
21176 |
-
className: 'row-title',
|
21177 |
-
to: '/edit/' + segment.id
|
21178 |
-
},
|
21179 |
-
segment.name
|
21180 |
-
);
|
21181 |
-
}
|
21182 |
-
|
21183 |
-
return _react2['default'].createElement(
|
21184 |
-
'div',
|
21185 |
-
null,
|
21186 |
-
_react2['default'].createElement(
|
21187 |
-
'td',
|
21188 |
-
{ className: rowClasses },
|
21189 |
-
_react2['default'].createElement(
|
21190 |
-
'strong',
|
21191 |
-
null,
|
21192 |
-
segmentName
|
21193 |
-
),
|
21194 |
-
actions
|
21195 |
-
),
|
21196 |
-
_react2['default'].createElement(
|
21197 |
-
'td',
|
21198 |
-
{ className: 'column-date', 'data-colname': _mailpoet2['default'].I18n.t('description') },
|
21199 |
-
_react2['default'].createElement(
|
21200 |
-
'abbr',
|
21201 |
-
null,
|
21202 |
-
segment.description
|
21203 |
-
)
|
21204 |
-
),
|
21205 |
-
_react2['default'].createElement(
|
21206 |
-
'td',
|
21207 |
-
{ className: 'column-date', 'data-colname': _mailpoet2['default'].I18n.t('subscribed') },
|
21208 |
-
_react2['default'].createElement(
|
21209 |
-
'abbr',
|
21210 |
-
null,
|
21211 |
-
subscribed.toLocaleString()
|
21212 |
-
)
|
21213 |
-
),
|
21214 |
-
_react2['default'].createElement(
|
21215 |
-
'td',
|
21216 |
-
{ className: 'column-date', 'data-colname': _mailpoet2['default'].I18n.t('unconfirmed') },
|
21217 |
-
_react2['default'].createElement(
|
21218 |
-
'abbr',
|
21219 |
-
null,
|
21220 |
-
unconfirmed.toLocaleString()
|
21221 |
-
)
|
21222 |
-
),
|
21223 |
-
_react2['default'].createElement(
|
21224 |
-
'td',
|
21225 |
-
{ className: 'column-date', 'data-colname': _mailpoet2['default'].I18n.t('unsubscribed') },
|
21226 |
-
_react2['default'].createElement(
|
21227 |
-
'abbr',
|
21228 |
-
null,
|
21229 |
-
unsubscribed.toLocaleString()
|
21230 |
-
)
|
21231 |
-
),
|
21232 |
-
_react2['default'].createElement(
|
21233 |
-
'td',
|
21234 |
-
{ className: 'column-date', 'data-colname': _mailpoet2['default'].I18n.t('bounced') },
|
21235 |
-
_react2['default'].createElement(
|
21236 |
-
'abbr',
|
21237 |
-
null,
|
21238 |
-
bounced.toLocaleString()
|
21239 |
-
)
|
21240 |
-
),
|
21241 |
-
_react2['default'].createElement(
|
21242 |
-
'td',
|
21243 |
-
{ className: 'column-date', 'data-colname': _mailpoet2['default'].I18n.t('createdOn') },
|
21244 |
-
_react2['default'].createElement(
|
21245 |
-
'abbr',
|
21246 |
-
null,
|
21247 |
-
_mailpoet2['default'].Date.format(segment.created_at)
|
21248 |
-
)
|
21249 |
-
)
|
21250 |
-
);
|
21251 |
-
},
|
21252 |
-
render: function render() {
|
21253 |
-
return _react2['default'].createElement(
|
21254 |
-
'div',
|
21255 |
-
null,
|
21256 |
-
_react2['default'].createElement(
|
21257 |
-
'h1',
|
21258 |
-
{ className: 'title' },
|
21259 |
-
_mailpoet2['default'].I18n.t('pageTitle'),
|
21260 |
-
' ',
|
21261 |
-
_react2['default'].createElement(
|
21262 |
-
_reactRouter.Link,
|
21263 |
-
{ className: 'page-title-action', to: '/new' },
|
21264 |
-
_mailpoet2['default'].I18n.t('new')
|
21265 |
-
)
|
21266 |
-
),
|
21267 |
-
_react2['default'].createElement(_listingListingJsx2['default'], {
|
21268 |
-
limit: window.mailpoet_listing_per_page,
|
21269 |
-
location: this.props.location,
|
21270 |
-
params: this.props.params,
|
21271 |
-
messages: messages,
|
21272 |
-
search: false,
|
21273 |
-
endpoint: 'segments',
|
21274 |
-
onRenderItem: this.renderItem,
|
21275 |
-
columns: columns,
|
21276 |
-
bulk_actions: bulkActions,
|
21277 |
-
item_actions: itemActions,
|
21278 |
-
sort_by: 'name',
|
21279 |
-
sort_order: 'asc'
|
21280 |
-
})
|
21281 |
-
);
|
21282 |
-
}
|
21283 |
-
});
|
21284 |
-
|
21285 |
-
module.exports = SegmentList;
|
21286 |
-
|
21287 |
-
/***/ },
|
21288 |
-
|
21289 |
-
/***/ 565:
|
21290 |
-
/***/ function(module, exports, __webpack_require__) {
|
21291 |
-
|
21292 |
-
/* WEBPACK VAR INJECTION */(function(global) {"use strict";
|
21293 |
-
|
21294 |
-
if (!global["MailPoetLib"]) global["MailPoetLib"] = {};
|
21295 |
-
module.exports = global["MailPoetLib"]["Form"] = __webpack_require__(566);
|
21296 |
-
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
|
21297 |
-
|
21298 |
-
/***/ },
|
21299 |
-
|
21300 |
-
/***/ 566:
|
21301 |
-
/***/ function(module, exports, __webpack_require__) {
|
21302 |
-
|
21303 |
-
'use strict';
|
21304 |
-
|
21305 |
-
Object.defineProperty(exports, '__esModule', {
|
21306 |
-
value: true
|
21307 |
-
});
|
21308 |
-
|
21309 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
21310 |
-
|
21311 |
-
var _react = __webpack_require__(2);
|
21312 |
-
|
21313 |
-
var _react2 = _interopRequireDefault(_react);
|
21314 |
-
|
21315 |
-
var _reactRouter = __webpack_require__(181);
|
21316 |
-
|
21317 |
-
var _mailpoet = __webpack_require__(276);
|
21318 |
-
|
21319 |
-
var _mailpoet2 = _interopRequireDefault(_mailpoet);
|
21320 |
-
|
21321 |
-
var _formFormJsx = __webpack_require__(294);
|
21322 |
-
|
21323 |
-
var _formFormJsx2 = _interopRequireDefault(_formFormJsx);
|
21324 |
-
|
21325 |
-
var _propTypes = __webpack_require__(185);
|
21326 |
-
|
21327 |
-
var _propTypes2 = _interopRequireDefault(_propTypes);
|
21328 |
-
|
21329 |
-
var fields = [{
|
21330 |
-
name: 'name',
|
21331 |
-
label: _mailpoet2['default'].I18n.t('name'),
|
21332 |
-
type: 'text'
|
21333 |
-
}, {
|
21334 |
-
name: 'description',
|
21335 |
-
label: _mailpoet2['default'].I18n.t('description'),
|
21336 |
-
type: 'textarea',
|
21337 |
-
tip: _mailpoet2['default'].I18n.t('segmentDescriptionTip')
|
21338 |
-
}];
|
21339 |
-
|
21340 |
-
var messages = {
|
21341 |
-
onUpdate: function onUpdate() {
|
21342 |
-
_mailpoet2['default'].Notice.success(_mailpoet2['default'].I18n.t('segmentUpdated'));
|
21343 |
-
},
|
21344 |
-
onCreate: function onCreate() {
|
21345 |
-
_mailpoet2['default'].Notice.success(_mailpoet2['default'].I18n.t('segmentAdded'));
|
21346 |
-
_mailpoet2['default'].trackEvent('Lists > Add new', {
|
21347 |
-
'MailPoet Free version': window.mailpoet_version
|
21348 |
-
});
|
21349 |
-
}
|
21350 |
-
};
|
21351 |
-
|
21352 |
-
var SegmentForm = function SegmentForm(_ref) {
|
21353 |
-
var params = _ref.params;
|
21354 |
-
return _react2['default'].createElement(
|
21355 |
-
'div',
|
21356 |
-
null,
|
21357 |
-
_react2['default'].createElement(
|
21358 |
-
'h1',
|
21359 |
-
{ className: 'title' },
|
21360 |
-
_mailpoet2['default'].I18n.t('segment'),
|
21361 |
-
_react2['default'].createElement(
|
21362 |
-
_reactRouter.Link,
|
21363 |
-
{ className: 'page-title-action', to: '/' },
|
21364 |
-
_mailpoet2['default'].I18n.t('backToList')
|
21365 |
-
)
|
21366 |
-
),
|
21367 |
-
_react2['default'].createElement(_formFormJsx2['default'], {
|
21368 |
-
endpoint: 'segments',
|
21369 |
-
fields: fields,
|
21370 |
-
params: params,
|
21371 |
-
messages: messages
|
21372 |
-
})
|
21373 |
-
);
|
21374 |
-
};
|
21375 |
-
|
21376 |
-
SegmentForm.propTypes = {
|
21377 |
-
params: _propTypes2['default'].shape({
|
21378 |
-
id: _propTypes2['default'].string
|
21379 |
-
}).isRequired
|
21380 |
-
};
|
21381 |
-
|
21382 |
-
exports['default'] = SegmentForm;
|
21383 |
-
module.exports = exports['default'];
|
21384 |
-
|
21385 |
-
/***/ },
|
21386 |
-
|
21387 |
-
/***/ 567:
|
21388 |
-
/***/ function(module, exports, __webpack_require__) {
|
21389 |
-
|
21390 |
-
'use strict';
|
21391 |
-
|
21392 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
21393 |
-
|
21394 |
-
var _react = __webpack_require__(2);
|
21395 |
-
|
21396 |
-
var _react2 = _interopRequireDefault(_react);
|
21397 |
-
|
21398 |
-
var _reactDom = __webpack_require__(34);
|
21399 |
-
|
21400 |
-
var _reactDom2 = _interopRequireDefault(_reactDom);
|
21401 |
-
|
21402 |
-
var _reactRouter = __webpack_require__(181);
|
21403 |
-
|
21404 |
-
var _history = __webpack_require__(244);
|
21405 |
-
|
21406 |
-
var _listJsx = __webpack_require__(568);
|
21407 |
-
|
21408 |
-
var _listJsx2 = _interopRequireDefault(_listJsx);
|
21409 |
-
|
21410 |
-
var history = (0, _reactRouter.useRouterHistory)(_history.createHashHistory)({ queryKey: false });
|
21411 |
-
|
21412 |
-
var App = _react2['default'].createClass({
|
21413 |
-
displayName: 'App',
|
21414 |
-
|
21415 |
-
render: function render() {
|
21416 |
-
return this.props.children;
|
21417 |
-
}
|
21418 |
-
});
|
21419 |
-
|
21420 |
-
var container = document.getElementById('forms_container');
|
21421 |
-
|
21422 |
-
if (container) {
|
21423 |
-
_reactDom2['default'].render(_react2['default'].createElement(
|
21424 |
-
_reactRouter.Router,
|
21425 |
-
{ history: history },
|
21426 |
-
_react2['default'].createElement(
|
21427 |
-
_reactRouter.Route,
|
21428 |
-
{ path: '/', component: App },
|
21429 |
-
_react2['default'].createElement(_reactRouter.IndexRoute, { component: _listJsx2['default'] }),
|
21430 |
-
_react2['default'].createElement(_reactRouter.Route, { path: '*', component: _listJsx2['default'] })
|
21431 |
-
)
|
21432 |
-
), container);
|
21433 |
-
}
|
21434 |
-
|
21435 |
-
/***/ },
|
21436 |
-
|
21437 |
-
/***/ 568:
|
21438 |
-
/***/ function(module, exports, __webpack_require__) {
|
21439 |
-
|
21440 |
-
'use strict';
|
21441 |
-
|
21442 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
21443 |
-
|
21444 |
-
var _react = __webpack_require__(2);
|
21445 |
-
|
21446 |
-
var _react2 = _interopRequireDefault(_react);
|
21447 |
-
|
21448 |
-
var _classnames = __webpack_require__(277);
|
21449 |
-
|
21450 |
-
var _classnames2 = _interopRequireDefault(_classnames);
|
21451 |
-
|
21452 |
-
var _mailpoet = __webpack_require__(276);
|
21453 |
-
|
21454 |
-
var _mailpoet2 = _interopRequireDefault(_mailpoet);
|
21455 |
-
|
21456 |
-
var _jquery = __webpack_require__(275);
|
21457 |
-
|
21458 |
-
var _jquery2 = _interopRequireDefault(_jquery);
|
21459 |
-
|
21460 |
-
var _listingListingJsx = __webpack_require__(279);
|
21461 |
-
|
21462 |
-
var _listingListingJsx2 = _interopRequireDefault(_listingListingJsx);
|
21463 |
-
|
21464 |
-
var columns = [{
|
21465 |
-
name: 'name',
|
21466 |
-
label: _mailpoet2['default'].I18n.t('formName'),
|
21467 |
-
sortable: true
|
21468 |
-
}, {
|
21469 |
-
name: 'segments',
|
21470 |
-
label: _mailpoet2['default'].I18n.t('segments')
|
21471 |
-
}, {
|
21472 |
-
name: 'signups',
|
21473 |
-
label: _mailpoet2['default'].I18n.t('signups')
|
21474 |
-
}, {
|
21475 |
-
name: 'created_at',
|
21476 |
-
label: _mailpoet2['default'].I18n.t('createdOn'),
|
21477 |
-
sortable: true
|
21478 |
-
}];
|
21479 |
-
|
21480 |
-
var messages = {
|
21481 |
-
onTrash: function onTrash(response) {
|
21482 |
-
var count = Number(response.meta.count);
|
21483 |
-
var message = null;
|
21484 |
-
|
21485 |
-
if (count === 1) {
|
21486 |
-
message = _mailpoet2['default'].I18n.t('oneFormTrashed');
|
21487 |
-
} else {
|
21488 |
-
message = _mailpoet2['default'].I18n.t('multipleFormsTrashed').replace('%$1d', count.toLocaleString());
|
21489 |
-
}
|
21490 |
-
_mailpoet2['default'].Notice.success(message);
|
21491 |
-
},
|
21492 |
-
onDelete: function onDelete(response) {
|
21493 |
-
var count = Number(response.meta.count);
|
21494 |
-
var message = null;
|
21495 |
-
|
21496 |
-
if (count === 1) {
|
21497 |
-
message = _mailpoet2['default'].I18n.t('oneFormDeleted');
|
21498 |
-
} else {
|
21499 |
-
message = _mailpoet2['default'].I18n.t('multipleFormsDeleted').replace('%$1d', count.toLocaleString());
|
21500 |
-
}
|
21501 |
-
_mailpoet2['default'].Notice.success(message);
|
21502 |
-
},
|
21503 |
-
onRestore: function onRestore(response) {
|
21504 |
-
var count = Number(response.meta.count);
|
21505 |
-
var message = null;
|
21506 |
-
|
21507 |
-
if (count === 1) {
|
21508 |
-
message = _mailpoet2['default'].I18n.t('oneFormRestored');
|
21509 |
-
} else {
|
21510 |
-
message = _mailpoet2['default'].I18n.t('multipleFormsRestored').replace('%$1d', count.toLocaleString());
|
21511 |
-
}
|
21512 |
-
_mailpoet2['default'].Notice.success(message);
|
21513 |
-
}
|
21514 |
-
};
|
21515 |
-
|
21516 |
-
var bulkActions = [{
|
21517 |
-
name: 'trash',
|
21518 |
-
label: _mailpoet2['default'].I18n.t('moveToTrash'),
|
21519 |
-
onSuccess: messages.onTrash
|
21520 |
-
}];
|
21521 |
-
|
21522 |
-
var itemActions = [{
|
21523 |
-
name: 'edit',
|
21524 |
-
label: _mailpoet2['default'].I18n.t('edit'),
|
21525 |
-
link: function link(item) {
|
21526 |
-
return _react2['default'].createElement(
|
21527 |
-
'a',
|
21528 |
-
{ href: 'admin.php?page=mailpoet-form-editor&id=' + item.id },
|
21529 |
-
_mailpoet2['default'].I18n.t('edit')
|
21530 |
-
);
|
21531 |
-
}
|
21532 |
-
}, {
|
21533 |
-
name: 'duplicate',
|
21534 |
-
label: _mailpoet2['default'].I18n.t('duplicate'),
|
21535 |
-
onClick: function onClick(item, refresh) {
|
21536 |
-
return _mailpoet2['default'].Ajax.post({
|
21537 |
-
api_version: window.mailpoet_api_version,
|
21538 |
-
endpoint: 'forms',
|
21539 |
-
action: 'duplicate',
|
21540 |
-
data: {
|
21541 |
-
id: item.id
|
21542 |
-
}
|
21543 |
-
}).done(function (response) {
|
21544 |
-
_mailpoet2['default'].Notice.success(_mailpoet2['default'].I18n.t('formDuplicated').replace('%$1s', response.data.name));
|
21545 |
-
refresh();
|
21546 |
-
}).fail(function (response) {
|
21547 |
-
if (response.errors.length > 0) {
|
21548 |
-
_mailpoet2['default'].Notice.error(response.errors.map(function (error) {
|
21549 |
-
return error.message;
|
21550 |
-
}), { scroll: true });
|
21551 |
-
}
|
21552 |
-
});
|
21553 |
-
}
|
21554 |
-
}, {
|
21555 |
-
name: 'trash'
|
21556 |
-
}];
|
21557 |
-
|
21558 |
-
var FormList = _react2['default'].createClass({
|
21559 |
-
displayName: 'FormList',
|
21560 |
-
|
21561 |
-
createForm: function createForm() {
|
21562 |
-
_mailpoet2['default'].Ajax.post({
|
21563 |
-
api_version: window.mailpoet_api_version,
|
21564 |
-
endpoint: 'forms',
|
21565 |
-
action: 'create'
|
21566 |
-
}).done(function (response) {
|
21567 |
-
window.location = window.mailpoet_form_edit_url + response.data.id;
|
21568 |
-
}).fail(function (response) {
|
21569 |
-
if (response.errors.length > 0) {
|
21570 |
-
_mailpoet2['default'].Notice.error(response.errors.map(function (error) {
|
21571 |
-
return error.message;
|
21572 |
-
}), { scroll: true });
|
21573 |
-
}
|
21574 |
-
});
|
21575 |
-
},
|
21576 |
-
renderItem: function renderItem(form, actions) {
|
21577 |
-
var rowClasses = (0, _classnames2['default'])('manage-column', 'column-primary', 'has-row-actions');
|
21578 |
-
|
21579 |
-
var segments = window.mailpoet_segments.filter(function (segment) {
|
21580 |
-
return _jquery2['default'].inArray(segment.id, form.segments) !== -1;
|
21581 |
-
}).map(function (segment) {
|
21582 |
-
return segment.name;
|
21583 |
-
}).join(', ');
|
21584 |
-
|
21585 |
-
if (form.settings.segments_selected_by === 'user') {
|
21586 |
-
segments = _mailpoet2['default'].I18n.t('userChoice') + ' ' + segments;
|
21587 |
-
}
|
21588 |
-
|
21589 |
-
return _react2['default'].createElement(
|
21590 |
-
'div',
|
21591 |
-
null,
|
21592 |
-
_react2['default'].createElement(
|
21593 |
-
'td',
|
21594 |
-
{ className: rowClasses },
|
21595 |
-
_react2['default'].createElement(
|
21596 |
-
'strong',
|
21597 |
-
null,
|
21598 |
-
_react2['default'].createElement(
|
21599 |
-
'a',
|
21600 |
-
{
|
21601 |
-
className: 'row-title',
|
21602 |
-
href: 'admin.php?page=mailpoet-form-editor&id=' + form.id
|
21603 |
-
},
|
21604 |
-
form.name
|
21605 |
-
)
|
21606 |
-
),
|
21607 |
-
actions
|
21608 |
-
),
|
21609 |
-
_react2['default'].createElement(
|
21610 |
-
'td',
|
21611 |
-
{ className: 'column', 'data-colname': _mailpoet2['default'].I18n.t('segments') },
|
21612 |
-
segments
|
21613 |
-
),
|
21614 |
-
_react2['default'].createElement(
|
21615 |
-
'td',
|
21616 |
-
{ className: 'column', 'data-colname': _mailpoet2['default'].I18n.t('signups') },
|
21617 |
-
form.signups
|
21618 |
-
),
|
21619 |
-
_react2['default'].createElement(
|
21620 |
-
'td',
|
21621 |
-
{ className: 'column-date', 'data-colname': _mailpoet2['default'].I18n.t('createdOn') },
|
21622 |
-
_react2['default'].createElement(
|
21623 |
-
'abbr',
|
21624 |
-
null,
|
21625 |
-
_mailpoet2['default'].Date.format(form.created_at)
|
21626 |
-
)
|
21627 |
-
)
|
21628 |
-
);
|
21629 |
-
},
|
21630 |
-
render: function render() {
|
21631 |
-
return _react2['default'].createElement(
|
21632 |
-
'div',
|
21633 |
-
null,
|
21634 |
-
_react2['default'].createElement(
|
21635 |
-
'h1',
|
21636 |
-
{ className: 'title' },
|
21637 |
-
_mailpoet2['default'].I18n.t('pageTitle'),
|
21638 |
-
' ',
|
21639 |
-
_react2['default'].createElement(
|
21640 |
-
'a',
|
21641 |
-
{
|
21642 |
-
className: 'page-title-action',
|
21643 |
-
href: 'javascript:;',
|
21644 |
-
onClick: this.createForm
|
21645 |
-
},
|
21646 |
-
_mailpoet2['default'].I18n.t('new')
|
21647 |
-
)
|
21648 |
-
),
|
21649 |
-
_react2['default'].createElement(_listingListingJsx2['default'], {
|
21650 |
-
limit: window.mailpoet_listing_per_page,
|
21651 |
-
location: this.props.location,
|
21652 |
-
params: this.props.params,
|
21653 |
-
messages: messages,
|
21654 |
-
search: false,
|
21655 |
-
endpoint: 'forms',
|
21656 |
-
onRenderItem: this.renderItem,
|
21657 |
-
columns: columns,
|
21658 |
-
bulk_actions: bulkActions,
|
21659 |
-
item_actions: itemActions
|
21660 |
-
})
|
21661 |
-
);
|
21662 |
-
}
|
21663 |
-
});
|
21664 |
-
|
21665 |
-
module.exports = FormList;
|
21666 |
-
|
21667 |
-
/***/ },
|
21668 |
-
|
21669 |
-
/***/ 569:
|
21670 |
-
/***/ function(module, exports, __webpack_require__) {
|
21671 |
-
|
21672 |
-
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
|
21673 |
-
__webpack_require__(570),
|
21674 |
-
__webpack_require__(275),
|
21675 |
-
__webpack_require__(276)
|
21676 |
-
], __WEBPACK_AMD_DEFINE_RESULT__ = function ( // eslint-disable-line func-names
|
21677 |
-
Backbone,
|
21678 |
-
jQuery,
|
21679 |
-
mp
|
21680 |
-
) {
|
21681 |
-
var MailPoet = mp;
|
21682 |
-
if (jQuery('#mailpoet_settings').length === 0) {
|
21683 |
-
return;
|
21684 |
-
}
|
21685 |
-
|
21686 |
-
MailPoet.Router = new (Backbone.Router.extend({
|
21687 |
-
routes: {
|
21688 |
-
'': 'sendingMethodGroup', // the default tab is currently mta, needs its own method
|
21689 |
-
'mta(/:group)': 'sendingMethodGroup',
|
21690 |
-
'(:tab)': 'tabs'
|
21691 |
-
},
|
21692 |
-
sendingMethodGroup: function (group) { // eslint-disable-line func-names
|
21693 |
-
// display mta tab
|
21694 |
-
this.tabs('mta');
|
21695 |
-
|
21696 |
-
// hide all sending methods' settings
|
21697 |
-
jQuery(
|
21698 |
-
'#mailpoet_sending_method_setup, .mailpoet_sending_method'
|
21699 |
-
).hide();
|
21700 |
-
|
21701 |
-
// hide "save settings" button
|
21702 |
-
jQuery('.mailpoet_settings_submit').hide();
|
21703 |
-
|
21704 |
-
if (group === null) {
|
21705 |
-
// show sending methods
|
21706 |
-
jQuery('.mailpoet_sending_methods, .mailpoet_sending_methods_help').fadeIn();
|
21707 |
-
} else {
|
21708 |
-
// toggle SPF (hidden if the sending method is MailPoet)
|
21709 |
-
jQuery('#mailpoet_mta_spf')[
|
21710 |
-
(group === 'mailpoet')
|
21711 |
-
? 'hide'
|
21712 |
-
: 'show'
|
21713 |
-
]();
|
21714 |
-
|
21715 |
-
// hide sending methods
|
21716 |
-
jQuery('.mailpoet_sending_methods, .mailpoet_sending_methods_help').hide();
|
21717 |
-
|
21718 |
-
// display selected sending method's settings
|
21719 |
-
jQuery('.mailpoet_sending_method[data-group="' + group + '"]').show();
|
21720 |
-
jQuery('#mailpoet_sending_method_setup').fadeIn();
|
21721 |
-
}
|
21722 |
-
},
|
21723 |
-
tabs: function (tabStr) { // eslint-disable-line func-names
|
21724 |
-
// set default tab
|
21725 |
-
var tab = tabStr || 'mta';
|
21726 |
-
|
21727 |
-
// reset all active tabs
|
21728 |
-
jQuery('.nav-tab-wrapper a').removeClass('nav-tab-active');
|
21729 |
-
|
21730 |
-
// hide panels & sections
|
21731 |
-
jQuery('.mailpoet_panel, .mailpoet_section').hide();
|
21732 |
-
|
21733 |
-
// set active tab
|
21734 |
-
jQuery('a.nav-tab[href="#' + tab + '"]').addClass('nav-tab-active').blur();
|
21735 |
-
|
21736 |
-
// show selected panel
|
21737 |
-
if (jQuery('.mailpoet_panel[data-tab="' + tab + '"]').length > 0) {
|
21738 |
-
jQuery('.mailpoet_panel[data-tab="' + tab + '"]').show();
|
21739 |
-
}
|
21740 |
-
|
21741 |
-
// show "save settings" button
|
21742 |
-
jQuery('.mailpoet_settings_submit').show();
|
21743 |
-
|
21744 |
-
MailPoet.trackEvent(
|
21745 |
-
'User has clicked a tab in Settings',
|
21746 |
-
{
|
21747 |
-
'MailPoet Free version': window.mailpoet_version,
|
21748 |
-
'Tab ID': tab
|
21749 |
-
}
|
21750 |
-
);
|
21751 |
-
}
|
21752 |
-
}))();
|
21753 |
-
|
21754 |
-
jQuery(document).ready(function () { // eslint-disable-line func-names
|
21755 |
-
if (!Backbone.History.started) Backbone.history.start();
|
21756 |
-
});
|
21757 |
-
}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
21758 |
-
|
21759 |
-
|
21760 |
-
/***/ },
|
21761 |
-
|
21762 |
-
/***/ 570:
|
21763 |
-
/***/ function(module, exports, __webpack_require__) {
|
21764 |
-
|
21765 |
-
/* WEBPACK VAR INJECTION */(function(global) {module.exports = global["Backbone"] = __webpack_require__(571);
|
21766 |
-
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
|
21767 |
-
|
21768 |
-
/***/ },
|
21769 |
-
|
21770 |
-
/***/ 571:
|
21771 |
-
/***/ function(module, exports, __webpack_require__) {
|
21772 |
-
|
21773 |
-
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(global) {// Backbone.js 1.3.3
|
21774 |
-
|
21775 |
-
// (c) 2010-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
21776 |
-
// Backbone may be freely distributed under the MIT license.
|
21777 |
-
// For all details and documentation:
|
21778 |
-
// http://backbonejs.org
|
21779 |
-
|
21780 |
-
(function(factory) {
|
21781 |
-
|
21782 |
-
// Establish the root object, `window` (`self`) in the browser, or `global` on the server.
|
21783 |
-
// We use `self` instead of `window` for `WebWorker` support.
|
21784 |
-
var root = (typeof self == 'object' && self.self === self && self) ||
|
21785 |
-
(typeof global == 'object' && global.global === global && global);
|
21786 |
-
|
21787 |
-
// Set up Backbone appropriately for the environment. Start with AMD.
|
21788 |
-
if (true) {
|
21789 |
-
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(281), __webpack_require__(275), exports], __WEBPACK_AMD_DEFINE_RESULT__ = function(_, $, exports) {
|
21790 |
-
// Export global even in AMD case in case this script is loaded with
|
21791 |
-
// others that may still expect a global Backbone.
|
21792 |
-
root.Backbone = factory(root, exports, _, $);
|
21793 |
-
}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
21794 |
-
|
21795 |
-
// Next for Node.js or CommonJS. jQuery may not be needed as a module.
|
21796 |
-
} else if (typeof exports !== 'undefined') {
|
21797 |
-
var _ = require('underscore'), $;
|
21798 |
-
try { $ = require('jquery'); } catch (e) {}
|
21799 |
-
factory(root, exports, _, $);
|
21800 |
-
|
21801 |
-
// Finally, as a browser global.
|
21802 |
-
} else {
|
21803 |
-
root.Backbone = factory(root, {}, root._, (root.jQuery || root.Zepto || root.ender || root.$));
|
21804 |
-
}
|
21805 |
-
|
21806 |
-
})(function(root, Backbone, _, $) {
|
21807 |
-
|
21808 |
-
// Initial Setup
|
21809 |
-
// -------------
|
21810 |
-
|
21811 |
-
// Save the previous value of the `Backbone` variable, so that it can be
|
21812 |
-
// restored later on, if `noConflict` is used.
|
21813 |
-
var previousBackbone = root.Backbone;
|
21814 |
-
|
21815 |
-
// Create a local reference to a common array method we'll want to use later.
|
21816 |
-
var slice = Array.prototype.slice;
|
21817 |
-
|
21818 |
-
// Current version of the library. Keep in sync with `package.json`.
|
21819 |
-
Backbone.VERSION = '1.3.3';
|
21820 |
-
|
21821 |
-
// For Backbone's purposes, jQuery, Zepto, Ender, or My Library (kidding) owns
|
21822 |
-
// the `$` variable.
|
21823 |
-
Backbone.$ = $;
|
21824 |
-
|
21825 |
-
// Runs Backbone.js in *noConflict* mode, returning the `Backbone` variable
|
21826 |
-
// to its previous owner. Returns a reference to this Backbone object.
|
21827 |
-
Backbone.noConflict = function() {
|
21828 |
-
root.Backbone = previousBackbone;
|
21829 |
-
return this;
|
21830 |
-
};
|
21831 |
-
|
21832 |
-
// Turn on `emulateHTTP` to support legacy HTTP servers. Setting this option
|
21833 |
-
// will fake `"PATCH"`, `"PUT"` and `"DELETE"` requests via the `_method` parameter and
|
21834 |
-
// set a `X-Http-Method-Override` header.
|
21835 |
-
Backbone.emulateHTTP = false;
|
21836 |
-
|
21837 |
-
// Turn on `emulateJSON` to support legacy servers that can't deal with direct
|
21838 |
-
// `application/json` requests ... this will encode the body as
|
21839 |
-
// `application/x-www-form-urlencoded` instead and will send the model in a
|
21840 |
-
// form param named `model`.
|
21841 |
-
Backbone.emulateJSON = false;
|
21842 |
-
|
21843 |
-
// Proxy Backbone class methods to Underscore functions, wrapping the model's
|
21844 |
-
// `attributes` object or collection's `models` array behind the scenes.
|
21845 |
-
//
|
21846 |
-
// collection.filter(function(model) { return model.get('age') > 10 });
|
21847 |
-
// collection.each(this.addView);
|
21848 |
-
//
|
21849 |
-
// `Function#apply` can be slow so we use the method's arg count, if we know it.
|
21850 |
-
var addMethod = function(length, method, attribute) {
|
21851 |
-
switch (length) {
|
21852 |
-
case 1: return function() {
|
21853 |
-
return _[method](this[attribute]);
|
21854 |
-
};
|
21855 |
-
case 2: return function(value) {
|
21856 |
-
return _[method](this[attribute], value);
|
21857 |
-
};
|
21858 |
-
case 3: return function(iteratee, context) {
|
21859 |
-
return _[method](this[attribute], cb(iteratee, this), context);
|
21860 |
-
};
|
21861 |
-
case 4: return function(iteratee, defaultVal, context) {
|
21862 |
-
return _[method](this[attribute], cb(iteratee, this), defaultVal, context);
|
21863 |
-
};
|
21864 |
-
default: return function() {
|
21865 |
-
var args = slice.call(arguments);
|
21866 |
-
args.unshift(this[attribute]);
|
21867 |
-
return _[method].apply(_, args);
|
21868 |
-
};
|
21869 |
-
}
|
21870 |
-
};
|
21871 |
-
var addUnderscoreMethods = function(Class, methods, attribute) {
|
21872 |
-
_.each(methods, function(length, method) {
|
21873 |
-
if (_[method]) Class.prototype[method] = addMethod(length, method, attribute);
|
21874 |
-
});
|
21875 |
-
};
|
21876 |
-
|
21877 |
-
// Support `collection.sortBy('attr')` and `collection.findWhere({id: 1})`.
|
21878 |
-
var cb = function(iteratee, instance) {
|
21879 |
-
if (_.isFunction(iteratee)) return iteratee;
|
21880 |
-
if (_.isObject(iteratee) && !instance._isModel(iteratee)) return modelMatcher(iteratee);
|
21881 |
-
if (_.isString(iteratee)) return function(model) { return model.get(iteratee); };
|
21882 |
-
return iteratee;
|
21883 |
-
};
|
21884 |
-
var modelMatcher = function(attrs) {
|
21885 |
-
var matcher = _.matches(attrs);
|
21886 |
-
return function(model) {
|
21887 |
-
return matcher(model.attributes);
|
21888 |
-
};
|
21889 |
-
};
|
21890 |
-
|
21891 |
-
// Backbone.Events
|
21892 |
-
// ---------------
|
21893 |
-
|
21894 |
-
// A module that can be mixed in to *any object* in order to provide it with
|
21895 |
-
// a custom event channel. You may bind a callback to an event with `on` or
|
21896 |
-
// remove with `off`; `trigger`-ing an event fires all callbacks in
|
21897 |
-
// succession.
|
21898 |
-
//
|
21899 |
-
// var object = {};
|
21900 |
-
// _.extend(object, Backbone.Events);
|
21901 |
-
// object.on('expand', function(){ alert('expanded'); });
|
21902 |
-
// object.trigger('expand');
|
21903 |
-
//
|
21904 |
-
var Events = Backbone.Events = {};
|
21905 |
-
|
21906 |
-
// Regular expression used to split event strings.
|
21907 |
-
var eventSplitter = /\s+/;
|
21908 |
-
|
21909 |
-
// Iterates over the standard `event, callback` (as well as the fancy multiple
|
21910 |
-
// space-separated events `"change blur", callback` and jQuery-style event
|
21911 |
-
// maps `{event: callback}`).
|
21912 |
-
var eventsApi = function(iteratee, events, name, callback, opts) {
|
21913 |
-
var i = 0, names;
|
21914 |
-
if (name && typeof name === 'object') {
|
21915 |
-
// Handle event maps.
|
21916 |
-
if (callback !== void 0 && 'context' in opts && opts.context === void 0) opts.context = callback;
|
21917 |
-
for (names = _.keys(name); i < names.length ; i++) {
|
21918 |
-
events = eventsApi(iteratee, events, names[i], name[names[i]], opts);
|
21919 |
-
}
|
21920 |
-
} else if (name && eventSplitter.test(name)) {
|
21921 |
-
// Handle space-separated event names by delegating them individually.
|
21922 |
-
for (names = name.split(eventSplitter); i < names.length; i++) {
|
21923 |
-
events = iteratee(events, names[i], callback, opts);
|
21924 |
-
}
|
21925 |
-
} else {
|
21926 |
-
// Finally, standard events.
|
21927 |
-
events = iteratee(events, name, callback, opts);
|
21928 |
-
}
|
21929 |
-
return events;
|
21930 |
-
};
|
21931 |
-
|
21932 |
-
// Bind an event to a `callback` function. Passing `"all"` will bind
|
21933 |
-
// the callback to all events fired.
|
21934 |
-
Events.on = function(name, callback, context) {
|
21935 |
-
return internalOn(this, name, callback, context);
|
21936 |
-
};
|
21937 |
-
|
21938 |
-
// Guard the `listening` argument from the public API.
|
21939 |
-
var internalOn = function(obj, name, callback, context, listening) {
|
21940 |
-
obj._events = eventsApi(onApi, obj._events || {}, name, callback, {
|
21941 |
-
context: context,
|
21942 |
-
ctx: obj,
|
21943 |
-
listening: listening
|
21944 |
-
});
|
21945 |
-
|
21946 |
-
if (listening) {
|
21947 |
-
var listeners = obj._listeners || (obj._listeners = {});
|
21948 |
-
listeners[listening.id] = listening;
|
21949 |
-
}
|
21950 |
-
|
21951 |
-
return obj;
|
21952 |
-
};
|
21953 |
-
|
21954 |
-
// Inversion-of-control versions of `on`. Tell *this* object to listen to
|
21955 |
-
// an event in another object... keeping track of what it's listening to
|
21956 |
-
// for easier unbinding later.
|
21957 |
-
Events.listenTo = function(obj, name, callback) {
|
21958 |
-
if (!obj) return this;
|
21959 |
-
var id = obj._listenId || (obj._listenId = _.uniqueId('l'));
|
21960 |
-
var listeningTo = this._listeningTo || (this._listeningTo = {});
|
21961 |
-
var listening = listeningTo[id];
|
21962 |
-
|
21963 |
-
// This object is not listening to any other events on `obj` yet.
|
21964 |
-
// Setup the necessary references to track the listening callbacks.
|
21965 |
-
if (!listening) {
|
21966 |
-
var thisId = this._listenId || (this._listenId = _.uniqueId('l'));
|
21967 |
-
listening = listeningTo[id] = {obj: obj, objId: id, id: thisId, listeningTo: listeningTo, count: 0};
|
21968 |
-
}
|
21969 |
-
|
21970 |
-
// Bind callbacks on obj, and keep track of them on listening.
|
21971 |
-
internalOn(obj, name, callback, this, listening);
|
21972 |
-
return this;
|
21973 |
-
};
|
21974 |
-
|
21975 |
-
// The reducing API that adds a callback to the `events` object.
|
21976 |
-
var onApi = function(events, name, callback, options) {
|
21977 |
-
if (callback) {
|
21978 |
-
var handlers = events[name] || (events[name] = []);
|
21979 |
-
var context = options.context, ctx = options.ctx, listening = options.listening;
|
21980 |
-
if (listening) listening.count++;
|
21981 |
-
|
21982 |
-
handlers.push({callback: callback, context: context, ctx: context || ctx, listening: listening});
|
21983 |
-
}
|
21984 |
-
return events;
|
21985 |
-
};
|
21986 |
-
|
21987 |
-
// Remove one or many callbacks. If `context` is null, removes all
|
21988 |
-
// callbacks with that function. If `callback` is null, removes all
|
21989 |
-
// callbacks for the event. If `name` is null, removes all bound
|
21990 |
-
// callbacks for all events.
|
21991 |
-
Events.off = function(name, callback, context) {
|
21992 |
-
if (!this._events) return this;
|
21993 |
-
this._events = eventsApi(offApi, this._events, name, callback, {
|
21994 |
-
context: context,
|
21995 |
-
listeners: this._listeners
|
21996 |
-
});
|
21997 |
-
return this;
|
21998 |
-
};
|
21999 |
-
|
22000 |
-
// Tell this object to stop listening to either specific events ... or
|
22001 |
-
// to every object it's currently listening to.
|
22002 |
-
Events.stopListening = function(obj, name, callback) {
|
22003 |
-
var listeningTo = this._listeningTo;
|
22004 |
-
if (!listeningTo) return this;
|
22005 |
-
|
22006 |
-
var ids = obj ? [obj._listenId] : _.keys(listeningTo);
|
22007 |
-
|
22008 |
-
for (var i = 0; i < ids.length; i++) {
|
22009 |
-
var listening = listeningTo[ids[i]];
|
22010 |
-
|
22011 |
-
// If listening doesn't exist, this object is not currently
|
22012 |
-
// listening to obj. Break out early.
|
22013 |
-
if (!listening) break;
|
22014 |
-
|
22015 |
-
listening.obj.off(name, callback, this);
|
22016 |
-
}
|
22017 |
-
|
22018 |
-
return this;
|
22019 |
-
};
|
22020 |
-
|
22021 |
-
// The reducing API that removes a callback from the `events` object.
|
22022 |
-
var offApi = function(events, name, callback, options) {
|
22023 |
-
if (!events) return;
|
22024 |
-
|
22025 |
-
var i = 0, listening;
|
22026 |
-
var context = options.context, listeners = options.listeners;
|
22027 |
-
|
22028 |
-
// Delete all events listeners and "drop" events.
|
22029 |
-
if (!name && !callback && !context) {
|
22030 |
-
var ids = _.keys(listeners);
|
22031 |
-
for (; i < ids.length; i++) {
|
22032 |
-
listening = listeners[ids[i]];
|
22033 |
-
delete listeners[listening.id];
|
22034 |
-
delete listening.listeningTo[listening.objId];
|
22035 |
-
}
|
22036 |
-
return;
|
22037 |
-
}
|
22038 |
-
|
22039 |
-
var names = name ? [name] : _.keys(events);
|
22040 |
-
for (; i < names.length; i++) {
|
22041 |
-
name = names[i];
|
22042 |
-
var handlers = events[name];
|
22043 |
-
|
22044 |
-
// Bail out if there are no events stored.
|
22045 |
-
if (!handlers) break;
|
22046 |
-
|
22047 |
-
// Replace events if there are any remaining. Otherwise, clean up.
|
22048 |
-
var remaining = [];
|
22049 |
-
for (var j = 0; j < handlers.length; j++) {
|
22050 |
-
var handler = handlers[j];
|
22051 |
-
if (
|
22052 |
-
callback && callback !== handler.callback &&
|
22053 |
-
callback !== handler.callback._callback ||
|
22054 |
-
context && context !== handler.context
|
22055 |
-
) {
|
22056 |
-
remaining.push(handler);
|
22057 |
-
} else {
|
22058 |
-
listening = handler.listening;
|
22059 |
-
if (listening && --listening.count === 0) {
|
22060 |
-
delete listeners[listening.id];
|
22061 |
-
delete listening.listeningTo[listening.objId];
|
22062 |
-
}
|
22063 |
-
}
|
22064 |
-
}
|
22065 |
-
|
22066 |
-
// Update tail event if the list has any events. Otherwise, clean up.
|
22067 |
-
if (remaining.length) {
|
22068 |
-
events[name] = remaining;
|
22069 |
-
} else {
|
22070 |
-
delete events[name];
|
22071 |
-
}
|
22072 |
-
}
|
22073 |
-
return events;
|
22074 |
-
};
|
22075 |
-
|
22076 |
-
// Bind an event to only be triggered a single time. After the first time
|
22077 |
-
// the callback is invoked, its listener will be removed. If multiple events
|
22078 |
-
// are passed in using the space-separated syntax, the handler will fire
|
22079 |
-
// once for each event, not once for a combination of all events.
|
22080 |
-
Events.once = function(name, callback, context) {
|
22081 |
-
// Map the event into a `{event: once}` object.
|
22082 |
-
var events = eventsApi(onceMap, {}, name, callback, _.bind(this.off, this));
|
22083 |
-
if (typeof name === 'string' && context == null) callback = void 0;
|
22084 |
-
return this.on(events, callback, context);
|
22085 |
-
};
|
22086 |
-
|
22087 |
-
// Inversion-of-control versions of `once`.
|
22088 |
-
Events.listenToOnce = function(obj, name, callback) {
|
22089 |
-
// Map the event into a `{event: once}` object.
|
22090 |
-
var events = eventsApi(onceMap, {}, name, callback, _.bind(this.stopListening, this, obj));
|
22091 |
-
return this.listenTo(obj, events);
|
22092 |
-
};
|
22093 |
-
|
22094 |
-
// Reduces the event callbacks into a map of `{event: onceWrapper}`.
|
22095 |
-
// `offer` unbinds the `onceWrapper` after it has been called.
|
22096 |
-
var onceMap = function(map, name, callback, offer) {
|
22097 |
-
if (callback) {
|
22098 |
-
var once = map[name] = _.once(function() {
|
22099 |
-
offer(name, once);
|
22100 |
-
callback.apply(this, arguments);
|
22101 |
-
});
|
22102 |
-
once._callback = callback;
|
22103 |
-
}
|
22104 |
-
return map;
|
22105 |
-
};
|
22106 |
-
|
22107 |
-
// Trigger one or many events, firing all bound callbacks. Callbacks are
|
22108 |
-
// passed the same arguments as `trigger` is, apart from the event name
|
22109 |
-
// (unless you're listening on `"all"`, which will cause your callback to
|
22110 |
-
// receive the true name of the event as the first argument).
|
22111 |
-
Events.trigger = function(name) {
|
22112 |
-
if (!this._events) return this;
|
22113 |
-
|
22114 |
-
var length = Math.max(0, arguments.length - 1);
|
22115 |
-
var args = Array(length);
|
22116 |
-
for (var i = 0; i < length; i++) args[i] = arguments[i + 1];
|
22117 |
-
|
22118 |
-
eventsApi(triggerApi, this._events, name, void 0, args);
|
22119 |
-
return this;
|
22120 |
-
};
|
22121 |
-
|
22122 |
-
// Handles triggering the appropriate event callbacks.
|
22123 |
-
var triggerApi = function(objEvents, name, callback, args) {
|
22124 |
-
if (objEvents) {
|
22125 |
-
var events = objEvents[name];
|
22126 |
-
var allEvents = objEvents.all;
|
22127 |
-
if (events && allEvents) allEvents = allEvents.slice();
|
22128 |
-
if (events) triggerEvents(events, args);
|
22129 |
-
if (allEvents) triggerEvents(allEvents, [name].concat(args));
|
22130 |
-
}
|
22131 |
-
return objEvents;
|
22132 |
-
};
|
22133 |
-
|
22134 |
-
// A difficult-to-believe, but optimized internal dispatch function for
|
22135 |
-
// triggering events. Tries to keep the usual cases speedy (most internal
|
22136 |
-
// Backbone events have 3 arguments).
|
22137 |
-
var triggerEvents = function(events, args) {
|
22138 |
-
var ev, i = -1, l = events.length, a1 = args[0], a2 = args[1], a3 = args[2];
|
22139 |
-
switch (args.length) {
|
22140 |
-
case 0: while (++i < l) (ev = events[i]).callback.call(ev.ctx); return;
|
22141 |
-
case 1: while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1); return;
|
22142 |
-
case 2: while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1, a2); return;
|
22143 |
-
case 3: while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1, a2, a3); return;
|
22144 |
-
default: while (++i < l) (ev = events[i]).callback.apply(ev.ctx, args); return;
|
22145 |
-
}
|
22146 |
-
};
|
22147 |
-
|
22148 |
-
// Aliases for backwards compatibility.
|
22149 |
-
Events.bind = Events.on;
|
22150 |
-
Events.unbind = Events.off;
|
22151 |
-
|
22152 |
-
// Allow the `Backbone` object to serve as a global event bus, for folks who
|
22153 |
-
// want global "pubsub" in a convenient place.
|
22154 |
-
_.extend(Backbone, Events);
|
22155 |
-
|
22156 |
-
// Backbone.Model
|
22157 |
-
// --------------
|
22158 |
-
|
22159 |
-
// Backbone **Models** are the basic data object in the framework --
|
22160 |
-
// frequently representing a row in a table in a database on your server.
|
22161 |
-
// A discrete chunk of data and a bunch of useful, related methods for
|
22162 |
-
// performing computations and transformations on that data.
|
22163 |
-
|
22164 |
-
// Create a new model with the specified attributes. A client id (`cid`)
|
22165 |
-
// is automatically generated and assigned for you.
|
22166 |
-
var Model = Backbone.Model = function(attributes, options) {
|
22167 |
-
var attrs = attributes || {};
|
22168 |
-
options || (options = {});
|
22169 |
-
this.cid = _.uniqueId(this.cidPrefix);
|
22170 |
-
this.attributes = {};
|
22171 |
-
if (options.collection) this.collection = options.collection;
|
22172 |
-
if (options.parse) attrs = this.parse(attrs, options) || {};
|
22173 |
-
var defaults = _.result(this, 'defaults');
|
22174 |
-
attrs = _.defaults(_.extend({}, defaults, attrs), defaults);
|
22175 |
-
this.set(attrs, options);
|
22176 |
-
this.changed = {};
|
22177 |
-
this.initialize.apply(this, arguments);
|
22178 |
-
};
|
22179 |
-
|
22180 |
-
// Attach all inheritable methods to the Model prototype.
|
22181 |
-
_.extend(Model.prototype, Events, {
|
22182 |
-
|
22183 |
-
// A hash of attributes whose current and previous value differ.
|
22184 |
-
changed: null,
|
22185 |
-
|
22186 |
-
// The value returned during the last failed validation.
|
22187 |
-
validationError: null,
|
22188 |
-
|
22189 |
-
// The default name for the JSON `id` attribute is `"id"`. MongoDB and
|
22190 |
-
// CouchDB users may want to set this to `"_id"`.
|
22191 |
-
idAttribute: 'id',
|
22192 |
-
|
22193 |
-
// The prefix is used to create the client id which is used to identify models locally.
|
22194 |
-
// You may want to override this if you're experiencing name clashes with model ids.
|
22195 |
-
cidPrefix: 'c',
|
22196 |
-
|
22197 |
-
// Initialize is an empty function by default. Override it with your own
|
22198 |
-
// initialization logic.
|
22199 |
-
initialize: function(){},
|
22200 |
-
|
22201 |
-
// Return a copy of the model's `attributes` object.
|
22202 |
-
toJSON: function(options) {
|
22203 |
-
return _.clone(this.attributes);
|
22204 |
-
},
|
22205 |
-
|
22206 |
-
// Proxy `Backbone.sync` by default -- but override this if you need
|
22207 |
-
// custom syncing semantics for *this* particular model.
|
22208 |
-
sync: function() {
|
22209 |
-
return Backbone.sync.apply(this, arguments);
|
22210 |
-
},
|
22211 |
-
|
22212 |
-
// Get the value of an attribute.
|
22213 |
-
get: function(attr) {
|
22214 |
-
return this.attributes[attr];
|
22215 |
-
},
|
22216 |
-
|
22217 |
-
// Get the HTML-escaped value of an attribute.
|
22218 |
-
escape: function(attr) {
|
22219 |
-
return _.escape(this.get(attr));
|
22220 |
-
},
|
22221 |
-
|
22222 |
-
// Returns `true` if the attribute contains a value that is not null
|
22223 |
-
// or undefined.
|
22224 |
-
has: function(attr) {
|
22225 |
-
return this.get(attr) != null;
|
22226 |
-
},
|
22227 |
-
|
22228 |
-
// Special-cased proxy to underscore's `_.matches` method.
|
22229 |
-
matches: function(attrs) {
|
22230 |
-
return !!_.iteratee(attrs, this)(this.attributes);
|
22231 |
-
},
|
22232 |
-
|
22233 |
-
// Set a hash of model attributes on the object, firing `"change"`. This is
|
22234 |
-
// the core primitive operation of a model, updating the data and notifying
|
22235 |
-
// anyone who needs to know about the change in state. The heart of the beast.
|
22236 |
-
set: function(key, val, options) {
|
22237 |
-
if (key == null) return this;
|
22238 |
-
|
22239 |
-
// Handle both `"key", value` and `{key: value}` -style arguments.
|
22240 |
-
var attrs;
|
22241 |
-
if (typeof key === 'object') {
|
22242 |
-
attrs = key;
|
22243 |
-
options = val;
|
22244 |
-
} else {
|
22245 |
-
(attrs = {})[key] = val;
|
22246 |
-
}
|
22247 |
-
|
22248 |
-
options || (options = {});
|
22249 |
-
|
22250 |
-
// Run validation.
|
22251 |
-
if (!this._validate(attrs, options)) return false;
|
22252 |
-
|
22253 |
-
// Extract attributes and options.
|
22254 |
-
var unset = options.unset;
|
22255 |
-
var silent = options.silent;
|
22256 |
-
var changes = [];
|
22257 |
-
var changing = this._changing;
|
22258 |
-
this._changing = true;
|
22259 |
-
|
22260 |
-
if (!changing) {
|
22261 |
-
this._previousAttributes = _.clone(this.attributes);
|
22262 |
-
this.changed = {};
|
22263 |
-
}
|
22264 |
-
|
22265 |
-
var current = this.attributes;
|
22266 |
-
var changed = this.changed;
|
22267 |
-
var prev = this._previousAttributes;
|
22268 |
-
|
22269 |
-
// For each `set` attribute, update or delete the current value.
|
22270 |
-
for (var attr in attrs) {
|
22271 |
-
val = attrs[attr];
|
22272 |
-
if (!_.isEqual(current[attr], val)) changes.push(attr);
|
22273 |
-
if (!_.isEqual(prev[attr], val)) {
|
22274 |
-
changed[attr] = val;
|
22275 |
-
} else {
|
22276 |
-
delete changed[attr];
|
22277 |
-
}
|
22278 |
-
unset ? delete current[attr] : current[attr] = val;
|
22279 |
-
}
|
22280 |
-
|
22281 |
-
// Update the `id`.
|
22282 |
-
if (this.idAttribute in attrs) this.id = this.get(this.idAttribute);
|
22283 |
-
|
22284 |
-
// Trigger all relevant attribute changes.
|
22285 |
-
if (!silent) {
|
22286 |
-
if (changes.length) this._pending = options;
|
22287 |
-
for (var i = 0; i < changes.length; i++) {
|
22288 |
-
this.trigger('change:' + changes[i], this, current[changes[i]], options);
|
22289 |
-
}
|
22290 |
-
}
|
22291 |
-
|
22292 |
-
// You might be wondering why there's a `while` loop here. Changes can
|
22293 |
-
// be recursively nested within `"change"` events.
|
22294 |
-
if (changing) return this;
|
22295 |
-
if (!silent) {
|
22296 |
-
while (this._pending) {
|
22297 |
-
options = this._pending;
|
22298 |
-
this._pending = false;
|
22299 |
-
this.trigger('change', this, options);
|
22300 |
-
}
|
22301 |
-
}
|
22302 |
-
this._pending = false;
|
22303 |
-
this._changing = false;
|
22304 |
-
return this;
|
22305 |
-
},
|
22306 |
-
|
22307 |
-
// Remove an attribute from the model, firing `"change"`. `unset` is a noop
|
22308 |
-
// if the attribute doesn't exist.
|
22309 |
-
unset: function(attr, options) {
|
22310 |
-
return this.set(attr, void 0, _.extend({}, options, {unset: true}));
|
22311 |
-
},
|
22312 |
-
|
22313 |
-
// Clear all attributes on the model, firing `"change"`.
|
22314 |
-
clear: function(options) {
|
22315 |
-
var attrs = {};
|
22316 |
-
for (var key in this.attributes) attrs[key] = void 0;
|
22317 |
-
return this.set(attrs, _.extend({}, options, {unset: true}));
|
22318 |
-
},
|
22319 |
-
|
22320 |
-
// Determine if the model has changed since the last `"change"` event.
|
22321 |
-
// If you specify an attribute name, determine if that attribute has changed.
|
22322 |
-
hasChanged: function(attr) {
|
22323 |
-
if (attr == null) return !_.isEmpty(this.changed);
|
22324 |
-
return _.has(this.changed, attr);
|
22325 |
-
},
|
22326 |
-
|
22327 |
-
// Return an object containing all the attributes that have changed, or
|
22328 |
-
// false if there are no changed attributes. Useful for determining what
|
22329 |
-
// parts of a view need to be updated and/or what attributes need to be
|
22330 |
-
// persisted to the server. Unset attributes will be set to undefined.
|
22331 |
-
// You can also pass an attributes object to diff against the model,
|
22332 |
-
// determining if there *would be* a change.
|
22333 |
-
changedAttributes: function(diff) {
|
22334 |
-
if (!diff) return this.hasChanged() ? _.clone(this.changed) : false;
|
22335 |
-
var old = this._changing ? this._previousAttributes : this.attributes;
|
22336 |
-
var changed = {};
|
22337 |
-
for (var attr in diff) {
|
22338 |
-
var val = diff[attr];
|
22339 |
-
if (_.isEqual(old[attr], val)) continue;
|
22340 |
-
changed[attr] = val;
|
22341 |
-
}
|
22342 |
-
return _.size(changed) ? changed : false;
|
22343 |
-
},
|
22344 |
-
|
22345 |
-
// Get the previous value of an attribute, recorded at the time the last
|
22346 |
-
// `"change"` event was fired.
|
22347 |
-
previous: function(attr) {
|
22348 |
-
if (attr == null || !this._previousAttributes) return null;
|
22349 |
-
return this._previousAttributes[attr];
|
22350 |
-
},
|
22351 |
-
|
22352 |
-
// Get all of the attributes of the model at the time of the previous
|
22353 |
-
// `"change"` event.
|
22354 |
-
previousAttributes: function() {
|
22355 |
-
return _.clone(this._previousAttributes);
|
22356 |
-
},
|
22357 |
-
|
22358 |
-
// Fetch the model from the server, merging the response with the model's
|
22359 |
-
// local attributes. Any changed attributes will trigger a "change" event.
|
22360 |
-
fetch: function(options) {
|
22361 |
-
options = _.extend({parse: true}, options);
|
22362 |
-
var model = this;
|
22363 |
-
var success = options.success;
|
22364 |
-
options.success = function(resp) {
|
22365 |
-
var serverAttrs = options.parse ? model.parse(resp, options) : resp;
|
22366 |
-
if (!model.set(serverAttrs, options)) return false;
|
22367 |
-
if (success) success.call(options.context, model, resp, options);
|
22368 |
-
model.trigger('sync', model, resp, options);
|
22369 |
-
};
|
22370 |
-
wrapError(this, options);
|
22371 |
-
return this.sync('read', this, options);
|
22372 |
-
},
|
22373 |
-
|
22374 |
-
// Set a hash of model attributes, and sync the model to the server.
|
22375 |
-
// If the server returns an attributes hash that differs, the model's
|
22376 |
-
// state will be `set` again.
|
22377 |
-
save: function(key, val, options) {
|
22378 |
-
// Handle both `"key", value` and `{key: value}` -style arguments.
|
22379 |
-
var attrs;
|
22380 |
-
if (key == null || typeof key === 'object') {
|
22381 |
-
attrs = key;
|
22382 |
-
options = val;
|
22383 |
-
} else {
|
22384 |
-
(attrs = {})[key] = val;
|
22385 |
-
}
|
22386 |
-
|
22387 |
-
options = _.extend({validate: true, parse: true}, options);
|
22388 |
-
var wait = options.wait;
|
22389 |
-
|
22390 |
-
// If we're not waiting and attributes exist, save acts as
|
22391 |
-
// `set(attr).save(null, opts)` with validation. Otherwise, check if
|
22392 |
-
// the model will be valid when the attributes, if any, are set.
|
22393 |
-
if (attrs && !wait) {
|
22394 |
-
if (!this.set(attrs, options)) return false;
|
22395 |
-
} else if (!this._validate(attrs, options)) {
|
22396 |
-
return false;
|
22397 |
-
}
|
22398 |
-
|
22399 |
-
// After a successful server-side save, the client is (optionally)
|
22400 |
-
// updated with the server-side state.
|
22401 |
-
var model = this;
|
22402 |
-
var success = options.success;
|
22403 |
-
var attributes = this.attributes;
|
22404 |
-
options.success = function(resp) {
|
22405 |
-
// Ensure attributes are restored during synchronous saves.
|
22406 |
-
model.attributes = attributes;
|
22407 |
-
var serverAttrs = options.parse ? model.parse(resp, options) : resp;
|
22408 |
-
if (wait) serverAttrs = _.extend({}, attrs, serverAttrs);
|
22409 |
-
if (serverAttrs && !model.set(serverAttrs, options)) return false;
|
22410 |
-
if (success) success.call(options.context, model, resp, options);
|
22411 |
-
model.trigger('sync', model, resp, options);
|
22412 |
-
};
|
22413 |
-
wrapError(this, options);
|
22414 |
-
|
22415 |
-
// Set temporary attributes if `{wait: true}` to properly find new ids.
|
22416 |
-
if (attrs && wait) this.attributes = _.extend({}, attributes, attrs);
|
22417 |
-
|
22418 |
-
var method = this.isNew() ? 'create' : (options.patch ? 'patch' : 'update');
|
22419 |
-
if (method === 'patch' && !options.attrs) options.attrs = attrs;
|
22420 |
-
var xhr = this.sync(method, this, options);
|
22421 |
-
|
22422 |
-
// Restore attributes.
|
22423 |
-
this.attributes = attributes;
|
22424 |
-
|
22425 |
-
return xhr;
|
22426 |
-
},
|
22427 |
-
|
22428 |
-
// Destroy this model on the server if it was already persisted.
|
22429 |
-
// Optimistically removes the model from its collection, if it has one.
|
22430 |
-
// If `wait: true` is passed, waits for the server to respond before removal.
|
22431 |
-
destroy: function(options) {
|
22432 |
-
options = options ? _.clone(options) : {};
|
22433 |
-
var model = this;
|
22434 |
-
var success = options.success;
|
22435 |
-
var wait = options.wait;
|
22436 |
-
|
22437 |
-
var destroy = function() {
|
22438 |
-
model.stopListening();
|
22439 |
-
model.trigger('destroy', model, model.collection, options);
|
22440 |
-
};
|
22441 |
-
|
22442 |
-
options.success = function(resp) {
|
22443 |
-
if (wait) destroy();
|
22444 |
-
if (success) success.call(options.context, model, resp, options);
|
22445 |
-
if (!model.isNew()) model.trigger('sync', model, resp, options);
|
22446 |
-
};
|
22447 |
-
|
22448 |
-
var xhr = false;
|
22449 |
-
if (this.isNew()) {
|
22450 |
-
_.defer(options.success);
|
22451 |
-
} else {
|
22452 |
-
wrapError(this, options);
|
22453 |
-
xhr = this.sync('delete', this, options);
|
22454 |
-
}
|
22455 |
-
if (!wait) destroy();
|
22456 |
-
return xhr;
|
22457 |
-
},
|
22458 |
-
|
22459 |
-
// Default URL for the model's representation on the server -- if you're
|
22460 |
-
// using Backbone's restful methods, override this to change the endpoint
|
22461 |
-
// that will be called.
|
22462 |
-
url: function() {
|
22463 |
-
var base =
|
22464 |
-
_.result(this, 'urlRoot') ||
|
22465 |
-
_.result(this.collection, 'url') ||
|
22466 |
-
urlError();
|
22467 |
-
if (this.isNew()) return base;
|
22468 |
-
var id = this.get(this.idAttribute);
|
22469 |
-
return base.replace(/[^\/]$/, '$&/') + encodeURIComponent(id);
|
22470 |
-
},
|
22471 |
-
|
22472 |
-
// **parse** converts a response into the hash of attributes to be `set` on
|
22473 |
-
// the model. The default implementation is just to pass the response along.
|
22474 |
-
parse: function(resp, options) {
|
22475 |
-
return resp;
|
22476 |
-
},
|
22477 |
-
|
22478 |
-
// Create a new model with identical attributes to this one.
|
22479 |
-
clone: function() {
|
22480 |
-
return new this.constructor(this.attributes);
|
22481 |
-
},
|
22482 |
-
|
22483 |
-
// A model is new if it has never been saved to the server, and lacks an id.
|
22484 |
-
isNew: function() {
|
22485 |
-
return !this.has(this.idAttribute);
|
22486 |
-
},
|
22487 |
-
|
22488 |
-
// Check if the model is currently in a valid state.
|
22489 |
-
isValid: function(options) {
|
22490 |
-
return this._validate({}, _.extend({}, options, {validate: true}));
|
22491 |
-
},
|
22492 |
-
|
22493 |
-
// Run validation against the next complete set of model attributes,
|
22494 |
-
// returning `true` if all is well. Otherwise, fire an `"invalid"` event.
|
22495 |
-
_validate: function(attrs, options) {
|
22496 |
-
if (!options.validate || !this.validate) return true;
|
22497 |
-
attrs = _.extend({}, this.attributes, attrs);
|
22498 |
-
var error = this.validationError = this.validate(attrs, options) || null;
|
22499 |
-
if (!error) return true;
|
22500 |
-
this.trigger('invalid', this, error, _.extend(options, {validationError: error}));
|
22501 |
-
return false;
|
22502 |
-
}
|
22503 |
-
|
22504 |
-
});
|
22505 |
-
|
22506 |
-
// Underscore methods that we want to implement on the Model, mapped to the
|
22507 |
-
// number of arguments they take.
|
22508 |
-
var modelMethods = {keys: 1, values: 1, pairs: 1, invert: 1, pick: 0,
|
22509 |
-
omit: 0, chain: 1, isEmpty: 1};
|
22510 |
-
|
22511 |
-
// Mix in each Underscore method as a proxy to `Model#attributes`.
|
22512 |
-
addUnderscoreMethods(Model, modelMethods, 'attributes');
|
22513 |
-
|
22514 |
-
// Backbone.Collection
|
22515 |
-
// -------------------
|
22516 |
-
|
22517 |
-
// If models tend to represent a single row of data, a Backbone Collection is
|
22518 |
-
// more analogous to a table full of data ... or a small slice or page of that
|
22519 |
-
// table, or a collection of rows that belong together for a particular reason
|
22520 |
-
// -- all of the messages in this particular folder, all of the documents
|
22521 |
-
// belonging to this particular author, and so on. Collections maintain
|
22522 |
-
// indexes of their models, both in order, and for lookup by `id`.
|
22523 |
-
|
22524 |
-
// Create a new **Collection**, perhaps to contain a specific type of `model`.
|
22525 |
-
// If a `comparator` is specified, the Collection will maintain
|
22526 |
-
// its models in sort order, as they're added and removed.
|
22527 |
-
var Collection = Backbone.Collection = function(models, options) {
|
22528 |
-
options || (options = {});
|
22529 |
-
if (options.model) this.model = options.model;
|
22530 |
-
if (options.comparator !== void 0) this.comparator = options.comparator;
|
22531 |
-
this._reset();
|
22532 |
-
this.initialize.apply(this, arguments);
|
22533 |
-
if (models) this.reset(models, _.extend({silent: true}, options));
|
22534 |
-
};
|
22535 |
-
|
22536 |
-
// Default options for `Collection#set`.
|
22537 |
-
var setOptions = {add: true, remove: true, merge: true};
|
22538 |
-
var addOptions = {add: true, remove: false};
|
22539 |
-
|
22540 |
-
// Splices `insert` into `array` at index `at`.
|
22541 |
-
var splice = function(array, insert, at) {
|
22542 |
-
at = Math.min(Math.max(at, 0), array.length);
|
22543 |
-
var tail = Array(array.length - at);
|
22544 |
-
var length = insert.length;
|
22545 |
-
var i;
|
22546 |
-
for (i = 0; i < tail.length; i++) tail[i] = array[i + at];
|
22547 |
-
for (i = 0; i < length; i++) array[i + at] = insert[i];
|
22548 |
-
for (i = 0; i < tail.length; i++) array[i + length + at] = tail[i];
|
22549 |
-
};
|
22550 |
-
|
22551 |
-
// Define the Collection's inheritable methods.
|
22552 |
-
_.extend(Collection.prototype, Events, {
|
22553 |
-
|
22554 |
-
// The default model for a collection is just a **Backbone.Model**.
|
22555 |
-
// This should be overridden in most cases.
|
22556 |
-
model: Model,
|
22557 |
-
|
22558 |
-
// Initialize is an empty function by default. Override it with your own
|
22559 |
-
// initialization logic.
|
22560 |
-
initialize: function(){},
|
22561 |
-
|
22562 |
-
// The JSON representation of a Collection is an array of the
|
22563 |
-
// models' attributes.
|
22564 |
-
toJSON: function(options) {
|
22565 |
-
return this.map(function(model) { return model.toJSON(options); });
|
22566 |
-
},
|
22567 |
-
|
22568 |
-
// Proxy `Backbone.sync` by default.
|
22569 |
-
sync: function() {
|
22570 |
-
return Backbone.sync.apply(this, arguments);
|
22571 |
-
},
|
22572 |
-
|
22573 |
-
// Add a model, or list of models to the set. `models` may be Backbone
|
22574 |
-
// Models or raw JavaScript objects to be converted to Models, or any
|
22575 |
-
// combination of the two.
|
22576 |
-
add: function(models, options) {
|
22577 |
-
return this.set(models, _.extend({merge: false}, options, addOptions));
|
22578 |
-
},
|
22579 |
-
|
22580 |
-
// Remove a model, or a list of models from the set.
|
22581 |
-
remove: function(models, options) {
|
22582 |
-
options = _.extend({}, options);
|
22583 |
-
var singular = !_.isArray(models);
|
22584 |
-
models = singular ? [models] : models.slice();
|
22585 |
-
var removed = this._removeModels(models, options);
|
22586 |
-
if (!options.silent && removed.length) {
|
22587 |
-
options.changes = {added: [], merged: [], removed: removed};
|
22588 |
-
this.trigger('update', this, options);
|
22589 |
-
}
|
22590 |
-
return singular ? removed[0] : removed;
|
22591 |
-
},
|
22592 |
-
|
22593 |
-
// Update a collection by `set`-ing a new list of models, adding new ones,
|
22594 |
-
// removing models that are no longer present, and merging models that
|
22595 |
-
// already exist in the collection, as necessary. Similar to **Model#set**,
|
22596 |
-
// the core operation for updating the data contained by the collection.
|
22597 |
-
set: function(models, options) {
|
22598 |
-
if (models == null) return;
|
22599 |
-
|
22600 |
-
options = _.extend({}, setOptions, options);
|
22601 |
-
if (options.parse && !this._isModel(models)) {
|
22602 |
-
models = this.parse(models, options) || [];
|
22603 |
-
}
|
22604 |
-
|
22605 |
-
var singular = !_.isArray(models);
|
22606 |
-
models = singular ? [models] : models.slice();
|
22607 |
-
|
22608 |
-
var at = options.at;
|
22609 |
-
if (at != null) at = +at;
|
22610 |
-
if (at > this.length) at = this.length;
|
22611 |
-
if (at < 0) at += this.length + 1;
|
22612 |
-
|
22613 |
-
var set = [];
|
22614 |
-
var toAdd = [];
|
22615 |
-
var toMerge = [];
|
22616 |
-
var toRemove = [];
|
22617 |
-
var modelMap = {};
|
22618 |
-
|
22619 |
-
var add = options.add;
|
22620 |
-
var merge = options.merge;
|
22621 |
-
var remove = options.remove;
|
22622 |
-
|
22623 |
-
var sort = false;
|
22624 |
-
var sortable = this.comparator && at == null && options.sort !== false;
|
22625 |
-
var sortAttr = _.isString(this.comparator) ? this.comparator : null;
|
22626 |
-
|
22627 |
-
// Turn bare objects into model references, and prevent invalid models
|
22628 |
-
// from being added.
|
22629 |
-
var model, i;
|
22630 |
-
for (i = 0; i < models.length; i++) {
|
22631 |
-
model = models[i];
|
22632 |
-
|
22633 |
-
// If a duplicate is found, prevent it from being added and
|
22634 |
-
// optionally merge it into the existing model.
|
22635 |
-
var existing = this.get(model);
|
22636 |
-
if (existing) {
|
22637 |
-
if (merge && model !== existing) {
|
22638 |
-
var attrs = this._isModel(model) ? model.attributes : model;
|
22639 |
-
if (options.parse) attrs = existing.parse(attrs, options);
|
22640 |
-
existing.set(attrs, options);
|
22641 |
-
toMerge.push(existing);
|
22642 |
-
if (sortable && !sort) sort = existing.hasChanged(sortAttr);
|
22643 |
-
}
|
22644 |
-
if (!modelMap[existing.cid]) {
|
22645 |
-
modelMap[existing.cid] = true;
|
22646 |
-
set.push(existing);
|
22647 |
-
}
|
22648 |
-
models[i] = existing;
|
22649 |
-
|
22650 |
-
// If this is a new, valid model, push it to the `toAdd` list.
|
22651 |
-
} else if (add) {
|
22652 |
-
model = models[i] = this._prepareModel(model, options);
|
22653 |
-
if (model) {
|
22654 |
-
toAdd.push(model);
|
22655 |
-
this._addReference(model, options);
|
22656 |
-
modelMap[model.cid] = true;
|
22657 |
-
set.push(model);
|
22658 |
-
}
|
22659 |
-
}
|
22660 |
-
}
|
22661 |
-
|
22662 |
-
// Remove stale models.
|
22663 |
-
if (remove) {
|
22664 |
-
for (i = 0; i < this.length; i++) {
|
22665 |
-
model = this.models[i];
|
22666 |
-
if (!modelMap[model.cid]) toRemove.push(model);
|
22667 |
-
}
|
22668 |
-
if (toRemove.length) this._removeModels(toRemove, options);
|
22669 |
-
}
|
22670 |
-
|
22671 |
-
// See if sorting is needed, update `length` and splice in new models.
|
22672 |
-
var orderChanged = false;
|
22673 |
-
var replace = !sortable && add && remove;
|
22674 |
-
if (set.length && replace) {
|
22675 |
-
orderChanged = this.length !== set.length || _.some(this.models, function(m, index) {
|
22676 |
-
return m !== set[index];
|
22677 |
-
});
|
22678 |
-
this.models.length = 0;
|
22679 |
-
splice(this.models, set, 0);
|
22680 |
-
this.length = this.models.length;
|
22681 |
-
} else if (toAdd.length) {
|
22682 |
-
if (sortable) sort = true;
|
22683 |
-
splice(this.models, toAdd, at == null ? this.length : at);
|
22684 |
-
this.length = this.models.length;
|
22685 |
-
}
|
22686 |
-
|
22687 |
-
// Silently sort the collection if appropriate.
|
22688 |
-
if (sort) this.sort({silent: true});
|
22689 |
-
|
22690 |
-
// Unless silenced, it's time to fire all appropriate add/sort/update events.
|
22691 |
-
if (!options.silent) {
|
22692 |
-
for (i = 0; i < toAdd.length; i++) {
|
22693 |
-
if (at != null) options.index = at + i;
|
22694 |
-
model = toAdd[i];
|
22695 |
-
model.trigger('add', model, this, options);
|
22696 |
-
}
|
22697 |
-
if (sort || orderChanged) this.trigger('sort', this, options);
|
22698 |
-
if (toAdd.length || toRemove.length || toMerge.length) {
|
22699 |
-
options.changes = {
|
22700 |
-
added: toAdd,
|
22701 |
-
removed: toRemove,
|
22702 |
-
merged: toMerge
|
22703 |
-
};
|
22704 |
-
this.trigger('update', this, options);
|
22705 |
-
}
|
22706 |
-
}
|
22707 |
-
|
22708 |
-
// Return the added (or merged) model (or models).
|
22709 |
-
return singular ? models[0] : models;
|
22710 |
-
},
|
22711 |
-
|
22712 |
-
// When you have more items than you want to add or remove individually,
|
22713 |
-
// you can reset the entire set with a new list of models, without firing
|
22714 |
-
// any granular `add` or `remove` events. Fires `reset` when finished.
|
22715 |
-
// Useful for bulk operations and optimizations.
|
22716 |
-
reset: function(models, options) {
|
22717 |
-
options = options ? _.clone(options) : {};
|
22718 |
-
for (var i = 0; i < this.models.length; i++) {
|
22719 |
-
this._removeReference(this.models[i], options);
|
22720 |
-
}
|
22721 |
-
options.previousModels = this.models;
|
22722 |
-
this._reset();
|
22723 |
-
models = this.add(models, _.extend({silent: true}, options));
|
22724 |
-
if (!options.silent) this.trigger('reset', this, options);
|
22725 |
-
return models;
|
22726 |
-
},
|
22727 |
-
|
22728 |
-
// Add a model to the end of the collection.
|
22729 |
-
push: function(model, options) {
|
22730 |
-
return this.add(model, _.extend({at: this.length}, options));
|
22731 |
-
},
|
22732 |
-
|
22733 |
-
// Remove a model from the end of the collection.
|
22734 |
-
pop: function(options) {
|
22735 |
-
var model = this.at(this.length - 1);
|
22736 |
-
return this.remove(model, options);
|
22737 |
-
},
|
22738 |
-
|
22739 |
-
// Add a model to the beginning of the collection.
|
22740 |
-
unshift: function(model, options) {
|
22741 |
-
return this.add(model, _.extend({at: 0}, options));
|
22742 |
-
},
|
22743 |
-
|
22744 |
-
// Remove a model from the beginning of the collection.
|
22745 |
-
shift: function(options) {
|
22746 |
-
var model = this.at(0);
|
22747 |
-
return this.remove(model, options);
|
22748 |
-
},
|
22749 |
-
|
22750 |
-
// Slice out a sub-array of models from the collection.
|
22751 |
-
slice: function() {
|
22752 |
-
return slice.apply(this.models, arguments);
|
22753 |
-
},
|
22754 |
-
|
22755 |
-
// Get a model from the set by id, cid, model object with id or cid
|
22756 |
-
// properties, or an attributes object that is transformed through modelId.
|
22757 |
-
get: function(obj) {
|
22758 |
-
if (obj == null) return void 0;
|
22759 |
-
return this._byId[obj] ||
|
22760 |
-
this._byId[this.modelId(obj.attributes || obj)] ||
|
22761 |
-
obj.cid && this._byId[obj.cid];
|
22762 |
-
},
|
22763 |
-
|
22764 |
-
// Returns `true` if the model is in the collection.
|
22765 |
-
has: function(obj) {
|
22766 |
-
return this.get(obj) != null;
|
22767 |
-
},
|
22768 |
-
|
22769 |
-
// Get the model at the given index.
|
22770 |
-
at: function(index) {
|
22771 |
-
if (index < 0) index += this.length;
|
22772 |
-
return this.models[index];
|
22773 |
-
},
|
22774 |
-
|
22775 |
-
// Return models with matching attributes. Useful for simple cases of
|
22776 |
-
// `filter`.
|
22777 |
-
where: function(attrs, first) {
|
22778 |
-
return this[first ? 'find' : 'filter'](attrs);
|
22779 |
-
},
|
22780 |
-
|
22781 |
-
// Return the first model with matching attributes. Useful for simple cases
|
22782 |
-
// of `find`.
|
22783 |
-
findWhere: function(attrs) {
|
22784 |
-
return this.where(attrs, true);
|
22785 |
-
},
|
22786 |
-
|
22787 |
-
// Force the collection to re-sort itself. You don't need to call this under
|
22788 |
-
// normal circumstances, as the set will maintain sort order as each item
|
22789 |
-
// is added.
|
22790 |
-
sort: function(options) {
|
22791 |
-
var comparator = this.comparator;
|
22792 |
-
if (!comparator) throw new Error('Cannot sort a set without a comparator');
|
22793 |
-
options || (options = {});
|
22794 |
-
|
22795 |
-
var length = comparator.length;
|
22796 |
-
if (_.isFunction(comparator)) comparator = _.bind(comparator, this);
|
22797 |
-
|
22798 |
-
// Run sort based on type of `comparator`.
|
22799 |
-
if (length === 1 || _.isString(comparator)) {
|
22800 |
-
this.models = this.sortBy(comparator);
|
22801 |
-
} else {
|
22802 |
-
this.models.sort(comparator);
|
22803 |
-
}
|
22804 |
-
if (!options.silent) this.trigger('sort', this, options);
|
22805 |
-
return this;
|
22806 |
-
},
|
22807 |
-
|
22808 |
-
// Pluck an attribute from each model in the collection.
|
22809 |
-
pluck: function(attr) {
|
22810 |
-
return this.map(attr + '');
|
22811 |
-
},
|
22812 |
-
|
22813 |
-
// Fetch the default set of models for this collection, resetting the
|
22814 |
-
// collection when they arrive. If `reset: true` is passed, the response
|
22815 |
-
// data will be passed through the `reset` method instead of `set`.
|
22816 |
-
fetch: function(options) {
|
22817 |
-
options = _.extend({parse: true}, options);
|
22818 |
-
var success = options.success;
|
22819 |
-
var collection = this;
|
22820 |
-
options.success = function(resp) {
|
22821 |
-
var method = options.reset ? 'reset' : 'set';
|
22822 |
-
collection[method](resp, options);
|
22823 |
-
if (success) success.call(options.context, collection, resp, options);
|
22824 |
-
collection.trigger('sync', collection, resp, options);
|
22825 |
-
};
|
22826 |
-
wrapError(this, options);
|
22827 |
-
return this.sync('read', this, options);
|
22828 |
-
},
|
22829 |
-
|
22830 |
-
// Create a new instance of a model in this collection. Add the model to the
|
22831 |
-
// collection immediately, unless `wait: true` is passed, in which case we
|
22832 |
-
// wait for the server to agree.
|
22833 |
-
create: function(model, options) {
|
22834 |
-
options = options ? _.clone(options) : {};
|
22835 |
-
var wait = options.wait;
|
22836 |
-
model = this._prepareModel(model, options);
|
22837 |
-
if (!model) return false;
|
22838 |
-
if (!wait) this.add(model, options);
|
22839 |
-
var collection = this;
|
22840 |
-
var success = options.success;
|
22841 |
-
options.success = function(m, resp, callbackOpts) {
|
22842 |
-
if (wait) collection.add(m, callbackOpts);
|
22843 |
-
if (success) success.call(callbackOpts.context, m, resp, callbackOpts);
|
22844 |
-
};
|
22845 |
-
model.save(null, options);
|
22846 |
-
return model;
|
22847 |
-
},
|
22848 |
-
|
22849 |
-
// **parse** converts a response into a list of models to be added to the
|
22850 |
-
// collection. The default implementation is just to pass it through.
|
22851 |
-
parse: function(resp, options) {
|
22852 |
-
return resp;
|
22853 |
-
},
|
22854 |
-
|
22855 |
-
// Create a new collection with an identical list of models as this one.
|
22856 |
-
clone: function() {
|
22857 |
-
return new this.constructor(this.models, {
|
22858 |
-
model: this.model,
|
22859 |
-
comparator: this.comparator
|
22860 |
-
});
|
22861 |
-
},
|
22862 |
-
|
22863 |
-
// Define how to uniquely identify models in the collection.
|
22864 |
-
modelId: function(attrs) {
|
22865 |
-
return attrs[this.model.prototype.idAttribute || 'id'];
|
22866 |
-
},
|
22867 |
-
|
22868 |
-
// Private method to reset all internal state. Called when the collection
|
22869 |
-
// is first initialized or reset.
|
22870 |
-
_reset: function() {
|
22871 |
-
this.length = 0;
|
22872 |
-
this.models = [];
|
22873 |
-
this._byId = {};
|
22874 |
-
},
|
22875 |
-
|
22876 |
-
// Prepare a hash of attributes (or other model) to be added to this
|
22877 |
-
// collection.
|
22878 |
-
_prepareModel: function(attrs, options) {
|
22879 |
-
if (this._isModel(attrs)) {
|
22880 |
-
if (!attrs.collection) attrs.collection = this;
|
22881 |
-
return attrs;
|
22882 |
-
}
|
22883 |
-
options = options ? _.clone(options) : {};
|
22884 |
-
options.collection = this;
|
22885 |
-
var model = new this.model(attrs, options);
|
22886 |
-
if (!model.validationError) return model;
|
22887 |
-
this.trigger('invalid', this, model.validationError, options);
|
22888 |
-
return false;
|
22889 |
-
},
|
22890 |
-
|
22891 |
-
// Internal method called by both remove and set.
|
22892 |
-
_removeModels: function(models, options) {
|
22893 |
-
var removed = [];
|
22894 |
-
for (var i = 0; i < models.length; i++) {
|
22895 |
-
var model = this.get(models[i]);
|
22896 |
-
if (!model) continue;
|
22897 |
-
|
22898 |
-
var index = this.indexOf(model);
|
22899 |
-
this.models.splice(index, 1);
|
22900 |
-
this.length--;
|
22901 |
-
|
22902 |
-
// Remove references before triggering 'remove' event to prevent an
|
22903 |
-
// infinite loop. #3693
|
22904 |
-
delete this._byId[model.cid];
|
22905 |
-
var id = this.modelId(model.attributes);
|
22906 |
-
if (id != null) delete this._byId[id];
|
22907 |
-
|
22908 |
-
if (!options.silent) {
|
22909 |
-
options.index = index;
|
22910 |
-
model.trigger('remove', model, this, options);
|
22911 |
-
}
|
22912 |
-
|
22913 |
-
removed.push(model);
|
22914 |
-
this._removeReference(model, options);
|
22915 |
-
}
|
22916 |
-
return removed;
|
22917 |
-
},
|
22918 |
-
|
22919 |
-
// Method for checking whether an object should be considered a model for
|
22920 |
-
// the purposes of adding to the collection.
|
22921 |
-
_isModel: function(model) {
|
22922 |
-
return model instanceof Model;
|
22923 |
-
},
|
22924 |
-
|
22925 |
-
// Internal method to create a model's ties to a collection.
|
22926 |
-
_addReference: function(model, options) {
|
22927 |
-
this._byId[model.cid] = model;
|
22928 |
-
var id = this.modelId(model.attributes);
|
22929 |
-
if (id != null) this._byId[id] = model;
|
22930 |
-
model.on('all', this._onModelEvent, this);
|
22931 |
-
},
|
22932 |
-
|
22933 |
-
// Internal method to sever a model's ties to a collection.
|
22934 |
-
_removeReference: function(model, options) {
|
22935 |
-
delete this._byId[model.cid];
|
22936 |
-
var id = this.modelId(model.attributes);
|
22937 |
-
if (id != null) delete this._byId[id];
|
22938 |
-
if (this === model.collection) delete model.collection;
|
22939 |
-
model.off('all', this._onModelEvent, this);
|
22940 |
-
},
|
22941 |
-
|
22942 |
-
// Internal method called every time a model in the set fires an event.
|
22943 |
-
// Sets need to update their indexes when models change ids. All other
|
22944 |
-
// events simply proxy through. "add" and "remove" events that originate
|
22945 |
-
// in other collections are ignored.
|
22946 |
-
_onModelEvent: function(event, model, collection, options) {
|
22947 |
-
if (model) {
|
22948 |
-
if ((event === 'add' || event === 'remove') && collection !== this) return;
|
22949 |
-
if (event === 'destroy') this.remove(model, options);
|
22950 |
-
if (event === 'change') {
|
22951 |
-
var prevId = this.modelId(model.previousAttributes());
|
22952 |
-
var id = this.modelId(model.attributes);
|
22953 |
-
if (prevId !== id) {
|
22954 |
-
if (prevId != null) delete this._byId[prevId];
|
22955 |
-
if (id != null) this._byId[id] = model;
|
22956 |
-
}
|
22957 |
-
}
|
22958 |
-
}
|
22959 |
-
this.trigger.apply(this, arguments);
|
22960 |
-
}
|
22961 |
-
|
22962 |
-
});
|
22963 |
-
|
22964 |
-
// Underscore methods that we want to implement on the Collection.
|
22965 |
-
// 90% of the core usefulness of Backbone Collections is actually implemented
|
22966 |
-
// right here:
|
22967 |
-
var collectionMethods = {forEach: 3, each: 3, map: 3, collect: 3, reduce: 0,
|
22968 |
-
foldl: 0, inject: 0, reduceRight: 0, foldr: 0, find: 3, detect: 3, filter: 3,
|
22969 |
-
select: 3, reject: 3, every: 3, all: 3, some: 3, any: 3, include: 3, includes: 3,
|
22970 |
-
contains: 3, invoke: 0, max: 3, min: 3, toArray: 1, size: 1, first: 3,
|
22971 |
-
head: 3, take: 3, initial: 3, rest: 3, tail: 3, drop: 3, last: 3,
|
22972 |
-
without: 0, difference: 0, indexOf: 3, shuffle: 1, lastIndexOf: 3,
|
22973 |
-
isEmpty: 1, chain: 1, sample: 3, partition: 3, groupBy: 3, countBy: 3,
|
22974 |
-
sortBy: 3, indexBy: 3, findIndex: 3, findLastIndex: 3};
|
22975 |
-
|
22976 |
-
// Mix in each Underscore method as a proxy to `Collection#models`.
|
22977 |
-
addUnderscoreMethods(Collection, collectionMethods, 'models');
|
22978 |
-
|
22979 |
-
// Backbone.View
|
22980 |
-
// -------------
|
22981 |
-
|
22982 |
-
// Backbone Views are almost more convention than they are actual code. A View
|
22983 |
-
// is simply a JavaScript object that represents a logical chunk of UI in the
|
22984 |
-
// DOM. This might be a single item, an entire list, a sidebar or panel, or
|
22985 |
-
// even the surrounding frame which wraps your whole app. Defining a chunk of
|
22986 |
-
// UI as a **View** allows you to define your DOM events declaratively, without
|
22987 |
-
// having to worry about render order ... and makes it easy for the view to
|
22988 |
-
// react to specific changes in the state of your models.
|
22989 |
-
|
22990 |
-
// Creating a Backbone.View creates its initial element outside of the DOM,
|
22991 |
-
// if an existing element is not provided...
|
22992 |
-
var View = Backbone.View = function(options) {
|
22993 |
-
this.cid = _.uniqueId('view');
|
22994 |
-
_.extend(this, _.pick(options, viewOptions));
|
22995 |
-
this._ensureElement();
|
22996 |
-
this.initialize.apply(this, arguments);
|
22997 |
-
};
|
22998 |
-
|
22999 |
-
// Cached regex to split keys for `delegate`.
|
23000 |
-
var delegateEventSplitter = /^(\S+)\s*(.*)$/;
|
23001 |
-
|
23002 |
-
// List of view options to be set as properties.
|
23003 |
-
var viewOptions = ['model', 'collection', 'el', 'id', 'attributes', 'className', 'tagName', 'events'];
|
23004 |
-
|
23005 |
-
// Set up all inheritable **Backbone.View** properties and methods.
|
23006 |
-
_.extend(View.prototype, Events, {
|
23007 |
-
|
23008 |
-
// The default `tagName` of a View's element is `"div"`.
|
23009 |
-
tagName: 'div',
|
23010 |
-
|
23011 |
-
// jQuery delegate for element lookup, scoped to DOM elements within the
|
23012 |
-
// current view. This should be preferred to global lookups where possible.
|
23013 |
-
$: function(selector) {
|
23014 |
-
return this.$el.find(selector);
|
23015 |
-
},
|
23016 |
-
|
23017 |
-
// Initialize is an empty function by default. Override it with your own
|
23018 |
-
// initialization logic.
|
23019 |
-
initialize: function(){},
|
23020 |
-
|
23021 |
-
// **render** is the core function that your view should override, in order
|
23022 |
-
// to populate its element (`this.el`), with the appropriate HTML. The
|
23023 |
-
// convention is for **render** to always return `this`.
|
23024 |
-
render: function() {
|
23025 |
-
return this;
|
23026 |
-
},
|
23027 |
-
|
23028 |
-
// Remove this view by taking the element out of the DOM, and removing any
|
23029 |
-
// applicable Backbone.Events listeners.
|
23030 |
-
remove: function() {
|
23031 |
-
this._removeElement();
|
23032 |
-
this.stopListening();
|
23033 |
-
return this;
|
23034 |
-
},
|
23035 |
-
|
23036 |
-
// Remove this view's element from the document and all event listeners
|
23037 |
-
// attached to it. Exposed for subclasses using an alternative DOM
|
23038 |
-
// manipulation API.
|
23039 |
-
_removeElement: function() {
|
23040 |
-
this.$el.remove();
|
23041 |
-
},
|
23042 |
-
|
23043 |
-
// Change the view's element (`this.el` property) and re-delegate the
|
23044 |
-
// view's events on the new element.
|
23045 |
-
setElement: function(element) {
|
23046 |
-
this.undelegateEvents();
|
23047 |
-
this._setElement(element);
|
23048 |
-
this.delegateEvents();
|
23049 |
-
return this;
|
23050 |
-
},
|
23051 |
-
|
23052 |
-
// Creates the `this.el` and `this.$el` references for this view using the
|
23053 |
-
// given `el`. `el` can be a CSS selector or an HTML string, a jQuery
|
23054 |
-
// context or an element. Subclasses can override this to utilize an
|
23055 |
-
// alternative DOM manipulation API and are only required to set the
|
23056 |
-
// `this.el` property.
|
23057 |
-
_setElement: function(el) {
|
23058 |
-
this.$el = el instanceof Backbone.$ ? el : Backbone.$(el);
|
23059 |
-
this.el = this.$el[0];
|
23060 |
-
},
|
23061 |
-
|
23062 |
-
// Set callbacks, where `this.events` is a hash of
|
23063 |
-
//
|
23064 |
-
// *{"event selector": "callback"}*
|
23065 |
-
//
|
23066 |
-
// {
|
23067 |
-
// 'mousedown .title': 'edit',
|
23068 |
-
// 'click .button': 'save',
|
23069 |
-
// 'click .open': function(e) { ... }
|
23070 |
-
// }
|
23071 |
-
//
|
23072 |
-
// pairs. Callbacks will be bound to the view, with `this` set properly.
|
23073 |
-
// Uses event delegation for efficiency.
|
23074 |
-
// Omitting the selector binds the event to `this.el`.
|
23075 |
-
delegateEvents: function(events) {
|
23076 |
-
events || (events = _.result(this, 'events'));
|
23077 |
-
if (!events) return this;
|
23078 |
-
this.undelegateEvents();
|
23079 |
-
for (var key in events) {
|
23080 |
-
var method = events[key];
|
23081 |
-
if (!_.isFunction(method)) method = this[method];
|
23082 |
-
if (!method) continue;
|
23083 |
-
var match = key.match(delegateEventSplitter);
|
23084 |
-
this.delegate(match[1], match[2], _.bind(method, this));
|
23085 |
-
}
|
23086 |
-
return this;
|
23087 |
-
},
|
23088 |
-
|
23089 |
-
// Add a single event listener to the view's element (or a child element
|
23090 |
-
// using `selector`). This only works for delegate-able events: not `focus`,
|
23091 |
-
// `blur`, and not `change`, `submit`, and `reset` in Internet Explorer.
|
23092 |
-
delegate: function(eventName, selector, listener) {
|
23093 |
-
this.$el.on(eventName + '.delegateEvents' + this.cid, selector, listener);
|
23094 |
-
return this;
|
23095 |
-
},
|
23096 |
-
|
23097 |
-
// Clears all callbacks previously bound to the view by `delegateEvents`.
|
23098 |
-
// You usually don't need to use this, but may wish to if you have multiple
|
23099 |
-
// Backbone views attached to the same DOM element.
|
23100 |
-
undelegateEvents: function() {
|
23101 |
-
if (this.$el) this.$el.off('.delegateEvents' + this.cid);
|
23102 |
-
return this;
|
23103 |
-
},
|
23104 |
-
|
23105 |
-
// A finer-grained `undelegateEvents` for removing a single delegated event.
|
23106 |
-
// `selector` and `listener` are both optional.
|
23107 |
-
undelegate: function(eventName, selector, listener) {
|
23108 |
-
this.$el.off(eventName + '.delegateEvents' + this.cid, selector, listener);
|
23109 |
-
return this;
|
23110 |
-
},
|
23111 |
-
|
23112 |
-
// Produces a DOM element to be assigned to your view. Exposed for
|
23113 |
-
// subclasses using an alternative DOM manipulation API.
|
23114 |
-
_createElement: function(tagName) {
|
23115 |
-
return document.createElement(tagName);
|
23116 |
-
},
|
23117 |
-
|
23118 |
-
// Ensure that the View has a DOM element to render into.
|
23119 |
-
// If `this.el` is a string, pass it through `$()`, take the first
|
23120 |
-
// matching element, and re-assign it to `el`. Otherwise, create
|
23121 |
-
// an element from the `id`, `className` and `tagName` properties.
|
23122 |
-
_ensureElement: function() {
|
23123 |
-
if (!this.el) {
|
23124 |
-
var attrs = _.extend({}, _.result(this, 'attributes'));
|
23125 |
-
if (this.id) attrs.id = _.result(this, 'id');
|
23126 |
-
if (this.className) attrs['class'] = _.result(this, 'className');
|
23127 |
-
this.setElement(this._createElement(_.result(this, 'tagName')));
|
23128 |
-
this._setAttributes(attrs);
|
23129 |
-
} else {
|
23130 |
-
this.setElement(_.result(this, 'el'));
|
23131 |
-
}
|
23132 |
-
},
|
23133 |
-
|
23134 |
-
// Set attributes from a hash on this view's element. Exposed for
|
23135 |
-
// subclasses using an alternative DOM manipulation API.
|
23136 |
-
_setAttributes: function(attributes) {
|
23137 |
-
this.$el.attr(attributes);
|
23138 |
-
}
|
23139 |
-
|
23140 |
-
});
|
23141 |
-
|
23142 |
-
// Backbone.sync
|
23143 |
-
// -------------
|
23144 |
-
|
23145 |
-
// Override this function to change the manner in which Backbone persists
|
23146 |
-
// models to the server. You will be passed the type of request, and the
|
23147 |
-
// model in question. By default, makes a RESTful Ajax request
|
23148 |
-
// to the model's `url()`. Some possible customizations could be:
|
23149 |
-
//
|
23150 |
-
// * Use `setTimeout` to batch rapid-fire updates into a single request.
|
23151 |
-
// * Send up the models as XML instead of JSON.
|
23152 |
-
// * Persist models via WebSockets instead of Ajax.
|
23153 |
-
//
|
23154 |
-
// Turn on `Backbone.emulateHTTP` in order to send `PUT` and `DELETE` requests
|
23155 |
-
// as `POST`, with a `_method` parameter containing the true HTTP method,
|
23156 |
-
// as well as all requests with the body as `application/x-www-form-urlencoded`
|
23157 |
-
// instead of `application/json` with the model in a param named `model`.
|
23158 |
-
// Useful when interfacing with server-side languages like **PHP** that make
|
23159 |
-
// it difficult to read the body of `PUT` requests.
|
23160 |
-
Backbone.sync = function(method, model, options) {
|
23161 |
-
var type = methodMap[method];
|
23162 |
-
|
23163 |
-
// Default options, unless specified.
|
23164 |
-
_.defaults(options || (options = {}), {
|
23165 |
-
emulateHTTP: Backbone.emulateHTTP,
|
23166 |
-
emulateJSON: Backbone.emulateJSON
|
23167 |
-
});
|
23168 |
-
|
23169 |
-
// Default JSON-request options.
|
23170 |
-
var params = {type: type, dataType: 'json'};
|
23171 |
-
|
23172 |
-
// Ensure that we have a URL.
|
23173 |
-
if (!options.url) {
|
23174 |
-
params.url = _.result(model, 'url') || urlError();
|
23175 |
-
}
|
23176 |
-
|
23177 |
-
// Ensure that we have the appropriate request data.
|
23178 |
-
if (options.data == null && model && (method === 'create' || method === 'update' || method === 'patch')) {
|
23179 |
-
params.contentType = 'application/json';
|
23180 |
-
params.data = JSON.stringify(options.attrs || model.toJSON(options));
|
23181 |
-
}
|
23182 |
-
|
23183 |
-
// For older servers, emulate JSON by encoding the request into an HTML-form.
|
23184 |
-
if (options.emulateJSON) {
|
23185 |
-
params.contentType = 'application/x-www-form-urlencoded';
|
23186 |
-
params.data = params.data ? {model: params.data} : {};
|
23187 |
-
}
|
23188 |
-
|
23189 |
-
// For older servers, emulate HTTP by mimicking the HTTP method with `_method`
|
23190 |
-
// And an `X-HTTP-Method-Override` header.
|
23191 |
-
if (options.emulateHTTP && (type === 'PUT' || type === 'DELETE' || type === 'PATCH')) {
|
23192 |
-
params.type = 'POST';
|
23193 |
-
if (options.emulateJSON) params.data._method = type;
|
23194 |
-
var beforeSend = options.beforeSend;
|
23195 |
-
options.beforeSend = function(xhr) {
|
23196 |
-
xhr.setRequestHeader('X-HTTP-Method-Override', type);
|
23197 |
-
if (beforeSend) return beforeSend.apply(this, arguments);
|
23198 |
-
};
|
23199 |
-
}
|
23200 |
-
|
23201 |
-
// Don't process data on a non-GET request.
|
23202 |
-
if (params.type !== 'GET' && !options.emulateJSON) {
|
23203 |
-
params.processData = false;
|
23204 |
-
}
|
23205 |
-
|
23206 |
-
// Pass along `textStatus` and `errorThrown` from jQuery.
|
23207 |
-
var error = options.error;
|
23208 |
-
options.error = function(xhr, textStatus, errorThrown) {
|
23209 |
-
options.textStatus = textStatus;
|
23210 |
-
options.errorThrown = errorThrown;
|
23211 |
-
if (error) error.call(options.context, xhr, textStatus, errorThrown);
|
23212 |
-
};
|
23213 |
-
|
23214 |
-
// Make the request, allowing the user to override any Ajax options.
|
23215 |
-
var xhr = options.xhr = Backbone.ajax(_.extend(params, options));
|
23216 |
-
model.trigger('request', model, xhr, options);
|
23217 |
-
return xhr;
|
23218 |
-
};
|
23219 |
-
|
23220 |
-
// Map from CRUD to HTTP for our default `Backbone.sync` implementation.
|
23221 |
-
var methodMap = {
|
23222 |
-
'create': 'POST',
|
23223 |
-
'update': 'PUT',
|
23224 |
-
'patch': 'PATCH',
|
23225 |
-
'delete': 'DELETE',
|
23226 |
-
'read': 'GET'
|
23227 |
-
};
|
23228 |
-
|
23229 |
-
// Set the default implementation of `Backbone.ajax` to proxy through to `$`.
|
23230 |
-
// Override this if you'd like to use a different library.
|
23231 |
-
Backbone.ajax = function() {
|
23232 |
-
return Backbone.$.ajax.apply(Backbone.$, arguments);
|
23233 |
-
};
|
23234 |
-
|
23235 |
-
// Backbone.Router
|
23236 |
-
// ---------------
|
23237 |
-
|
23238 |
-
// Routers map faux-URLs to actions, and fire events when routes are
|
23239 |
-
// matched. Creating a new one sets its `routes` hash, if not set statically.
|
23240 |
-
var Router = Backbone.Router = function(options) {
|
23241 |
-
options || (options = {});
|
23242 |
-
if (options.routes) this.routes = options.routes;
|
23243 |
-
this._bindRoutes();
|
23244 |
-
this.initialize.apply(this, arguments);
|
23245 |
-
};
|
23246 |
-
|
23247 |
-
// Cached regular expressions for matching named param parts and splatted
|
23248 |
-
// parts of route strings.
|
23249 |
-
var optionalParam = /\((.*?)\)/g;
|
23250 |
-
var namedParam = /(\(\?)?:\w+/g;
|
23251 |
-
var splatParam = /\*\w+/g;
|
23252 |
-
var escapeRegExp = /[\-{}\[\]+?.,\\\^$|#\s]/g;
|
23253 |
-
|
23254 |
-
// Set up all inheritable **Backbone.Router** properties and methods.
|
23255 |
-
_.extend(Router.prototype, Events, {
|
23256 |
-
|
23257 |
-
// Initialize is an empty function by default. Override it with your own
|
23258 |
-
// initialization logic.
|
23259 |
-
initialize: function(){},
|
23260 |
-
|
23261 |
-
// Manually bind a single named route to a callback. For example:
|
23262 |
-
//
|
23263 |
-
// this.route('search/:query/p:num', 'search', function(query, num) {
|
23264 |
-
// ...
|
23265 |
-
// });
|
23266 |
-
//
|
23267 |
-
route: function(route, name, callback) {
|
23268 |
-
if (!_.isRegExp(route)) route = this._routeToRegExp(route);
|
23269 |
-
if (_.isFunction(name)) {
|
23270 |
-
callback = name;
|
23271 |
-
name = '';
|
23272 |
-
}
|
23273 |
-
if (!callback) callback = this[name];
|
23274 |
-
var router = this;
|
23275 |
-
Backbone.history.route(route, function(fragment) {
|
23276 |
-
var args = router._extractParameters(route, fragment);
|
23277 |
-
if (router.execute(callback, args, name) !== false) {
|
23278 |
-
router.trigger.apply(router, ['route:' + name].concat(args));
|
23279 |
-
router.trigger('route', name, args);
|
23280 |
-
Backbone.history.trigger('route', router, name, args);
|
23281 |
-
}
|
23282 |
-
});
|
23283 |
-
return this;
|
23284 |
-
},
|
23285 |
-
|
23286 |
-
// Execute a route handler with the provided parameters. This is an
|
23287 |
-
// excellent place to do pre-route setup or post-route cleanup.
|
23288 |
-
execute: function(callback, args, name) {
|
23289 |
-
if (callback) callback.apply(this, args);
|
23290 |
-
},
|
23291 |
-
|
23292 |
-
// Simple proxy to `Backbone.history` to save a fragment into the history.
|
23293 |
-
navigate: function(fragment, options) {
|
23294 |
-
Backbone.history.navigate(fragment, options);
|
23295 |
-
return this;
|
23296 |
-
},
|
23297 |
-
|
23298 |
-
// Bind all defined routes to `Backbone.history`. We have to reverse the
|
23299 |
-
// order of the routes here to support behavior where the most general
|
23300 |
-
// routes can be defined at the bottom of the route map.
|
23301 |
-
_bindRoutes: function() {
|
23302 |
-
if (!this.routes) return;
|
23303 |
-
this.routes = _.result(this, 'routes');
|
23304 |
-
var route, routes = _.keys(this.routes);
|
23305 |
-
while ((route = routes.pop()) != null) {
|
23306 |
-
this.route(route, this.routes[route]);
|
23307 |
-
}
|
23308 |
-
},
|
23309 |
-
|
23310 |
-
// Convert a route string into a regular expression, suitable for matching
|
23311 |
-
// against the current location hash.
|
23312 |
-
_routeToRegExp: function(route) {
|
23313 |
-
route = route.replace(escapeRegExp, '\\$&')
|
23314 |
-
.replace(optionalParam, '(?:$1)?')
|
23315 |
-
.replace(namedParam, function(match, optional) {
|
23316 |
-
return optional ? match : '([^/?]+)';
|
23317 |
-
})
|
23318 |
-
.replace(splatParam, '([^?]*?)');
|
23319 |
-
return new RegExp('^' + route + '(?:\\?([\\s\\S]*))?$');
|
23320 |
-
},
|
23321 |
-
|
23322 |
-
// Given a route, and a URL fragment that it matches, return the array of
|
23323 |
-
// extracted decoded parameters. Empty or unmatched parameters will be
|
23324 |
-
// treated as `null` to normalize cross-browser behavior.
|
23325 |
-
_extractParameters: function(route, fragment) {
|
23326 |
-
var params = route.exec(fragment).slice(1);
|
23327 |
-
return _.map(params, function(param, i) {
|
23328 |
-
// Don't decode the search params.
|
23329 |
-
if (i === params.length - 1) return param || null;
|
23330 |
-
return param ? decodeURIComponent(param) : null;
|
23331 |
-
});
|
23332 |
-
}
|
23333 |
-
|
23334 |
-
});
|
23335 |
-
|
23336 |
-
// Backbone.History
|
23337 |
-
// ----------------
|
23338 |
-
|
23339 |
-
// Handles cross-browser history management, based on either
|
23340 |
-
// [pushState](http://diveintohtml5.info/history.html) and real URLs, or
|
23341 |
-
// [onhashchange](https://developer.mozilla.org/en-US/docs/DOM/window.onhashchange)
|
23342 |
-
// and URL fragments. If the browser supports neither (old IE, natch),
|
23343 |
-
// falls back to polling.
|
23344 |
-
var History = Backbone.History = function() {
|
23345 |
-
this.handlers = [];
|
23346 |
-
this.checkUrl = _.bind(this.checkUrl, this);
|
23347 |
-
|
23348 |
-
// Ensure that `History` can be used outside of the browser.
|
23349 |
-
if (typeof window !== 'undefined') {
|
23350 |
-
this.location = window.location;
|
23351 |
-
this.history = window.history;
|
23352 |
-
}
|
23353 |
-
};
|
23354 |
-
|
23355 |
-
// Cached regex for stripping a leading hash/slash and trailing space.
|
23356 |
-
var routeStripper = /^[#\/]|\s+$/g;
|
23357 |
-
|
23358 |
-
// Cached regex for stripping leading and trailing slashes.
|
23359 |
-
var rootStripper = /^\/+|\/+$/g;
|
23360 |
-
|
23361 |
-
// Cached regex for stripping urls of hash.
|
23362 |
-
var pathStripper = /#.*$/;
|
23363 |
-
|
23364 |
-
// Has the history handling already been started?
|
23365 |
-
History.started = false;
|
23366 |
-
|
23367 |
-
// Set up all inheritable **Backbone.History** properties and methods.
|
23368 |
-
_.extend(History.prototype, Events, {
|
23369 |
-
|
23370 |
-
// The default interval to poll for hash changes, if necessary, is
|
23371 |
-
// twenty times a second.
|
23372 |
-
interval: 50,
|
23373 |
-
|
23374 |
-
// Are we at the app root?
|
23375 |
-
atRoot: function() {
|
23376 |
-
var path = this.location.pathname.replace(/[^\/]$/, '$&/');
|
23377 |
-
return path === this.root && !this.getSearch();
|
23378 |
-
},
|
23379 |
-
|
23380 |
-
// Does the pathname match the root?
|
23381 |
-
matchRoot: function() {
|
23382 |
-
var path = this.decodeFragment(this.location.pathname);
|
23383 |
-
var rootPath = path.slice(0, this.root.length - 1) + '/';
|
23384 |
-
return rootPath === this.root;
|
23385 |
-
},
|
23386 |
-
|
23387 |
-
// Unicode characters in `location.pathname` are percent encoded so they're
|
23388 |
-
// decoded for comparison. `%25` should not be decoded since it may be part
|
23389 |
-
// of an encoded parameter.
|
23390 |
-
decodeFragment: function(fragment) {
|
23391 |
-
return decodeURI(fragment.replace(/%25/g, '%2525'));
|
23392 |
-
},
|
23393 |
-
|
23394 |
-
// In IE6, the hash fragment and search params are incorrect if the
|
23395 |
-
// fragment contains `?`.
|
23396 |
-
getSearch: function() {
|
23397 |
-
var match = this.location.href.replace(/#.*/, '').match(/\?.+/);
|
23398 |
-
return match ? match[0] : '';
|
23399 |
-
},
|
23400 |
-
|
23401 |
-
// Gets the true hash value. Cannot use location.hash directly due to bug
|
23402 |
-
// in Firefox where location.hash will always be decoded.
|
23403 |
-
getHash: function(window) {
|
23404 |
-
var match = (window || this).location.href.match(/#(.*)$/);
|
23405 |
-
return match ? match[1] : '';
|
23406 |
-
},
|
23407 |
-
|
23408 |
-
// Get the pathname and search params, without the root.
|
23409 |
-
getPath: function() {
|
23410 |
-
var path = this.decodeFragment(
|
23411 |
-
this.location.pathname + this.getSearch()
|
23412 |
-
).slice(this.root.length - 1);
|
23413 |
-
return path.charAt(0) === '/' ? path.slice(1) : path;
|
23414 |
-
},
|
23415 |
-
|
23416 |
-
// Get the cross-browser normalized URL fragment from the path or hash.
|
23417 |
-
getFragment: function(fragment) {
|
23418 |
-
if (fragment == null) {
|
23419 |
-
if (this._usePushState || !this._wantsHashChange) {
|
23420 |
-
fragment = this.getPath();
|
23421 |
-
} else {
|
23422 |
-
fragment = this.getHash();
|
23423 |
-
}
|
23424 |
-
}
|
23425 |
-
return fragment.replace(routeStripper, '');
|
23426 |
-
},
|
23427 |
-
|
23428 |
-
// Start the hash change handling, returning `true` if the current URL matches
|
23429 |
-
// an existing route, and `false` otherwise.
|
23430 |
-
start: function(options) {
|
23431 |
-
if (History.started) throw new Error('Backbone.history has already been started');
|
23432 |
-
History.started = true;
|
23433 |
-
|
23434 |
-
// Figure out the initial configuration. Do we need an iframe?
|
23435 |
-
// Is pushState desired ... is it available?
|
23436 |
-
this.options = _.extend({root: '/'}, this.options, options);
|
23437 |
-
this.root = this.options.root;
|
23438 |
-
this._wantsHashChange = this.options.hashChange !== false;
|
23439 |
-
this._hasHashChange = 'onhashchange' in window && (document.documentMode === void 0 || document.documentMode > 7);
|
23440 |
-
this._useHashChange = this._wantsHashChange && this._hasHashChange;
|
23441 |
-
this._wantsPushState = !!this.options.pushState;
|
23442 |
-
this._hasPushState = !!(this.history && this.history.pushState);
|
23443 |
-
this._usePushState = this._wantsPushState && this._hasPushState;
|
23444 |
-
this.fragment = this.getFragment();
|
23445 |
-
|
23446 |
-
// Normalize root to always include a leading and trailing slash.
|
23447 |
-
this.root = ('/' + this.root + '/').replace(rootStripper, '/');
|
23448 |
-
|
23449 |
-
// Transition from hashChange to pushState or vice versa if both are
|
23450 |
-
// requested.
|
23451 |
-
if (this._wantsHashChange && this._wantsPushState) {
|
23452 |
-
|
23453 |
-
// If we've started off with a route from a `pushState`-enabled
|
23454 |
-
// browser, but we're currently in a browser that doesn't support it...
|
23455 |
-
if (!this._hasPushState && !this.atRoot()) {
|
23456 |
-
var rootPath = this.root.slice(0, -1) || '/';
|
23457 |
-
this.location.replace(rootPath + '#' + this.getPath());
|
23458 |
-
// Return immediately as browser will do redirect to new url
|
23459 |
-
return true;
|
23460 |
-
|
23461 |
-
// Or if we've started out with a hash-based route, but we're currently
|
23462 |
-
// in a browser where it could be `pushState`-based instead...
|
23463 |
-
} else if (this._hasPushState && this.atRoot()) {
|
23464 |
-
this.navigate(this.getHash(), {replace: true});
|
23465 |
-
}
|
23466 |
-
|
23467 |
-
}
|
23468 |
-
|
23469 |
-
// Proxy an iframe to handle location events if the browser doesn't
|
23470 |
-
// support the `hashchange` event, HTML5 history, or the user wants
|
23471 |
-
// `hashChange` but not `pushState`.
|
23472 |
-
if (!this._hasHashChange && this._wantsHashChange && !this._usePushState) {
|
23473 |
-
this.iframe = document.createElement('iframe');
|
23474 |
-
this.iframe.src = 'javascript:0';
|
23475 |
-
this.iframe.style.display = 'none';
|
23476 |
-
this.iframe.tabIndex = -1;
|
23477 |
-
var body = document.body;
|
23478 |
-
// Using `appendChild` will throw on IE < 9 if the document is not ready.
|
23479 |
-
var iWindow = body.insertBefore(this.iframe, body.firstChild).contentWindow;
|
23480 |
-
iWindow.document.open();
|
23481 |
-
iWindow.document.close();
|
23482 |
-
iWindow.location.hash = '#' + this.fragment;
|
23483 |
-
}
|
23484 |
-
|
23485 |
-
// Add a cross-platform `addEventListener` shim for older browsers.
|
23486 |
-
var addEventListener = window.addEventListener || function(eventName, listener) {
|
23487 |
-
return attachEvent('on' + eventName, listener);
|
23488 |
-
};
|
23489 |
-
|
23490 |
-
// Depending on whether we're using pushState or hashes, and whether
|
23491 |
-
// 'onhashchange' is supported, determine how we check the URL state.
|
23492 |
-
if (this._usePushState) {
|
23493 |
-
addEventListener('popstate', this.checkUrl, false);
|
23494 |
-
} else if (this._useHashChange && !this.iframe) {
|
23495 |
-
addEventListener('hashchange', this.checkUrl, false);
|
23496 |
-
} else if (this._wantsHashChange) {
|
23497 |
-
this._checkUrlInterval = setInterval(this.checkUrl, this.interval);
|
23498 |
-
}
|
23499 |
-
|
23500 |
-
if (!this.options.silent) return this.loadUrl();
|
23501 |
-
},
|
23502 |
-
|
23503 |
-
// Disable Backbone.history, perhaps temporarily. Not useful in a real app,
|
23504 |
-
// but possibly useful for unit testing Routers.
|
23505 |
-
stop: function() {
|
23506 |
-
// Add a cross-platform `removeEventListener` shim for older browsers.
|
23507 |
-
var removeEventListener = window.removeEventListener || function(eventName, listener) {
|
23508 |
-
return detachEvent('on' + eventName, listener);
|
23509 |
-
};
|
23510 |
-
|
23511 |
-
// Remove window listeners.
|
23512 |
-
if (this._usePushState) {
|
23513 |
-
removeEventListener('popstate', this.checkUrl, false);
|
23514 |
-
} else if (this._useHashChange && !this.iframe) {
|
23515 |
-
removeEventListener('hashchange', this.checkUrl, false);
|
23516 |
-
}
|
23517 |
-
|
23518 |
-
// Clean up the iframe if necessary.
|
23519 |
-
if (this.iframe) {
|
23520 |
-
document.body.removeChild(this.iframe);
|
23521 |
-
this.iframe = null;
|
23522 |
-
}
|
23523 |
-
|
23524 |
-
// Some environments will throw when clearing an undefined interval.
|
23525 |
-
if (this._checkUrlInterval) clearInterval(this._checkUrlInterval);
|
23526 |
-
History.started = false;
|
23527 |
-
},
|
23528 |
-
|
23529 |
-
// Add a route to be tested when the fragment changes. Routes added later
|
23530 |
-
// may override previous routes.
|
23531 |
-
route: function(route, callback) {
|
23532 |
-
this.handlers.unshift({route: route, callback: callback});
|
23533 |
-
},
|
23534 |
-
|
23535 |
-
// Checks the current URL to see if it has changed, and if it has,
|
23536 |
-
// calls `loadUrl`, normalizing across the hidden iframe.
|
23537 |
-
checkUrl: function(e) {
|
23538 |
-
var current = this.getFragment();
|
23539 |
-
|
23540 |
-
// If the user pressed the back button, the iframe's hash will have
|
23541 |
-
// changed and we should use that for comparison.
|
23542 |
-
if (current === this.fragment && this.iframe) {
|
23543 |
-
current = this.getHash(this.iframe.contentWindow);
|
23544 |
-
}
|
23545 |
-
|
23546 |
-
if (current === this.fragment) return false;
|
23547 |
-
if (this.iframe) this.navigate(current);
|
23548 |
-
this.loadUrl();
|
23549 |
-
},
|
23550 |
-
|
23551 |
-
// Attempt to load the current URL fragment. If a route succeeds with a
|
23552 |
-
// match, returns `true`. If no defined routes matches the fragment,
|
23553 |
-
// returns `false`.
|
23554 |
-
loadUrl: function(fragment) {
|
23555 |
-
// If the root doesn't match, no routes can match either.
|
23556 |
-
if (!this.matchRoot()) return false;
|
23557 |
-
fragment = this.fragment = this.getFragment(fragment);
|
23558 |
-
return _.some(this.handlers, function(handler) {
|
23559 |
-
if (handler.route.test(fragment)) {
|
23560 |
-
handler.callback(fragment);
|
23561 |
-
return true;
|
23562 |
-
}
|
23563 |
-
});
|
23564 |
-
},
|
23565 |
-
|
23566 |
-
// Save a fragment into the hash history, or replace the URL state if the
|
23567 |
-
// 'replace' option is passed. You are responsible for properly URL-encoding
|
23568 |
-
// the fragment in advance.
|
23569 |
-
//
|
23570 |
-
// The options object can contain `trigger: true` if you wish to have the
|
23571 |
-
// route callback be fired (not usually desirable), or `replace: true`, if
|
23572 |
-
// you wish to modify the current URL without adding an entry to the history.
|
23573 |
-
navigate: function(fragment, options) {
|
23574 |
-
if (!History.started) return false;
|
23575 |
-
if (!options || options === true) options = {trigger: !!options};
|
23576 |
-
|
23577 |
-
// Normalize the fragment.
|
23578 |
-
fragment = this.getFragment(fragment || '');
|
23579 |
-
|
23580 |
-
// Don't include a trailing slash on the root.
|
23581 |
-
var rootPath = this.root;
|
23582 |
-
if (fragment === '' || fragment.charAt(0) === '?') {
|
23583 |
-
rootPath = rootPath.slice(0, -1) || '/';
|
23584 |
-
}
|
23585 |
-
var url = rootPath + fragment;
|
23586 |
-
|
23587 |
-
// Strip the hash and decode for matching.
|
23588 |
-
fragment = this.decodeFragment(fragment.replace(pathStripper, ''));
|
23589 |
-
|
23590 |
-
if (this.fragment === fragment) return;
|
23591 |
-
this.fragment = fragment;
|
23592 |
-
|
23593 |
-
// If pushState is available, we use it to set the fragment as a real URL.
|
23594 |
-
if (this._usePushState) {
|
23595 |
-
this.history[options.replace ? 'replaceState' : 'pushState']({}, document.title, url);
|
23596 |
-
|
23597 |
-
// If hash changes haven't been explicitly disabled, update the hash
|
23598 |
-
// fragment to store history.
|
23599 |
-
} else if (this._wantsHashChange) {
|
23600 |
-
this._updateHash(this.location, fragment, options.replace);
|
23601 |
-
if (this.iframe && fragment !== this.getHash(this.iframe.contentWindow)) {
|
23602 |
-
var iWindow = this.iframe.contentWindow;
|
23603 |
-
|
23604 |
-
// Opening and closing the iframe tricks IE7 and earlier to push a
|
23605 |
-
// history entry on hash-tag change. When replace is true, we don't
|
23606 |
-
// want this.
|
23607 |
-
if (!options.replace) {
|
23608 |
-
iWindow.document.open();
|
23609 |
-
iWindow.document.close();
|
23610 |
-
}
|
23611 |
-
|
23612 |
-
this._updateHash(iWindow.location, fragment, options.replace);
|
23613 |
-
}
|
23614 |
-
|
23615 |
-
// If you've told us that you explicitly don't want fallback hashchange-
|
23616 |
-
// based history, then `navigate` becomes a page refresh.
|
23617 |
-
} else {
|
23618 |
-
return this.location.assign(url);
|
23619 |
-
}
|
23620 |
-
if (options.trigger) return this.loadUrl(fragment);
|
23621 |
-
},
|
23622 |
-
|
23623 |
-
// Update the hash location, either replacing the current entry, or adding
|
23624 |
-
// a new one to the browser history.
|
23625 |
-
_updateHash: function(location, fragment, replace) {
|
23626 |
-
if (replace) {
|
23627 |
-
var href = location.href.replace(/(javascript:|#).*$/, '');
|
23628 |
-
location.replace(href + '#' + fragment);
|
23629 |
-
} else {
|
23630 |
-
// Some browsers require that `hash` contains a leading #.
|
23631 |
-
location.hash = '#' + fragment;
|
23632 |
-
}
|
23633 |
-
}
|
23634 |
-
|
23635 |
-
});
|
23636 |
-
|
23637 |
-
// Create the default Backbone.history.
|
23638 |
-
Backbone.history = new History;
|
23639 |
-
|
23640 |
-
// Helpers
|
23641 |
-
// -------
|
23642 |
-
|
23643 |
-
// Helper function to correctly set up the prototype chain for subclasses.
|
23644 |
-
// Similar to `goog.inherits`, but uses a hash of prototype properties and
|
23645 |
-
// class properties to be extended.
|
23646 |
-
var extend = function(protoProps, staticProps) {
|
23647 |
-
var parent = this;
|
23648 |
-
var child;
|
23649 |
-
|
23650 |
-
// The constructor function for the new subclass is either defined by you
|
23651 |
-
// (the "constructor" property in your `extend` definition), or defaulted
|
23652 |
-
// by us to simply call the parent constructor.
|
23653 |
-
if (protoProps && _.has(protoProps, 'constructor')) {
|
23654 |
-
child = protoProps.constructor;
|
23655 |
-
} else {
|
23656 |
-
child = function(){ return parent.apply(this, arguments); };
|
23657 |
-
}
|
23658 |
-
|
23659 |
-
// Add static properties to the constructor function, if supplied.
|
23660 |
-
_.extend(child, parent, staticProps);
|
23661 |
-
|
23662 |
-
// Set the prototype chain to inherit from `parent`, without calling
|
23663 |
-
// `parent`'s constructor function and add the prototype properties.
|
23664 |
-
child.prototype = _.create(parent.prototype, protoProps);
|
23665 |
-
child.prototype.constructor = child;
|
23666 |
-
|
23667 |
-
// Set a convenience property in case the parent's prototype is needed
|
23668 |
-
// later.
|
23669 |
-
child.__super__ = parent.prototype;
|
23670 |
-
|
23671 |
-
return child;
|
23672 |
-
};
|
23673 |
-
|
23674 |
-
// Set up inheritance for the model, collection, router, view and history.
|
23675 |
-
Model.extend = Collection.extend = Router.extend = View.extend = History.extend = extend;
|
23676 |
-
|
23677 |
-
// Throw an error when a URL is needed, and none is supplied.
|
23678 |
-
var urlError = function() {
|
23679 |
-
throw new Error('A "url" property or function must be specified');
|
23680 |
-
};
|
23681 |
-
|
23682 |
-
// Wrap an optional error callback with a fallback error event.
|
23683 |
-
var wrapError = function(model, options) {
|
23684 |
-
var error = options.error;
|
23685 |
-
options.error = function(resp) {
|
23686 |
-
if (error) error.call(options.context, model, resp, options);
|
23687 |
-
model.trigger('error', model, resp, options);
|
23688 |
-
};
|
23689 |
-
};
|
23690 |
-
|
23691 |
-
return Backbone;
|
23692 |
-
});
|
23693 |
-
|
23694 |
-
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
|
23695 |
-
|
23696 |
-
/***/ },
|
23697 |
-
|
23698 |
-
/***/ 572:
|
23699 |
-
/***/ function(module, exports, __webpack_require__) {
|
23700 |
-
|
23701 |
-
'use strict';
|
23702 |
-
|
23703 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
23704 |
-
|
23705 |
-
var _react = __webpack_require__(2);
|
23706 |
-
|
23707 |
-
var _react2 = _interopRequireDefault(_react);
|
23708 |
-
|
23709 |
-
var _reactDom = __webpack_require__(34);
|
23710 |
-
|
23711 |
-
var _reactDom2 = _interopRequireDefault(_reactDom);
|
23712 |
-
|
23713 |
-
var _reactRouter = __webpack_require__(181);
|
23714 |
-
|
23715 |
-
var _history = __webpack_require__(244);
|
23716 |
-
|
23717 |
-
var _helpSystem_statusJsx = __webpack_require__(573);
|
23718 |
-
|
23719 |
-
var _helpSystem_statusJsx2 = _interopRequireDefault(_helpSystem_statusJsx);
|
23720 |
-
|
23721 |
-
var _helpSystem_infoJsx = __webpack_require__(575);
|
23722 |
-
|
23723 |
-
var _helpSystem_infoJsx2 = _interopRequireDefault(_helpSystem_infoJsx);
|
23724 |
-
|
23725 |
-
var _helpKnowledge_baseJsx = __webpack_require__(576);
|
23726 |
-
|
23727 |
-
var _helpKnowledge_baseJsx2 = _interopRequireDefault(_helpKnowledge_baseJsx);
|
23728 |
-
|
23729 |
-
var history = (0, _reactRouter.useRouterHistory)(_history.createHashHistory)({ queryKey: false });
|
23730 |
-
|
23731 |
-
var App = _react2['default'].createClass({
|
23732 |
-
displayName: 'App',
|
23733 |
-
|
23734 |
-
render: function render() {
|
23735 |
-
return this.props.children;
|
23736 |
-
}
|
23737 |
-
});
|
23738 |
-
|
23739 |
-
var container = document.getElementById('help_container');
|
23740 |
-
|
23741 |
-
if (container) {
|
23742 |
-
_reactDom2['default'].render(_react2['default'].createElement(
|
23743 |
-
_reactRouter.Router,
|
23744 |
-
{ history: history },
|
23745 |
-
_react2['default'].createElement(
|
23746 |
-
_reactRouter.Route,
|
23747 |
-
{ path: '/', component: App },
|
23748 |
-
_react2['default'].createElement(_reactRouter.IndexRedirect, { to: 'systemStatus' }),
|
23749 |
-
_react2['default'].createElement(_reactRouter.Route, { path: 'systemStatus(/)**', params: { tab: 'systemStatus' }, component: _helpSystem_statusJsx2['default'] }),
|
23750 |
-
_react2['default'].createElement(_reactRouter.Route, { path: 'systemInfo(/)**', params: { tab: 'systemInfo' }, component: _helpSystem_infoJsx2['default'] }),
|
23751 |
-
_react2['default'].createElement(_reactRouter.Route, { path: 'knowledgeBase(/)**', params: { tab: 'knowledgeBase' }, component: _helpKnowledge_baseJsx2['default'] })
|
23752 |
-
)
|
23753 |
-
), container);
|
23754 |
-
}
|
23755 |
-
/* Pages */
|
23756 |
-
|
23757 |
-
/***/ },
|
23758 |
-
|
23759 |
-
/***/ 573:
|
23760 |
-
/***/ function(module, exports, __webpack_require__) {
|
23761 |
-
|
23762 |
-
'use strict';
|
23763 |
-
|
23764 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
23765 |
-
|
23766 |
-
var _mailpoet = __webpack_require__(276);
|
23767 |
-
|
23768 |
-
var _mailpoet2 = _interopRequireDefault(_mailpoet);
|
23769 |
-
|
23770 |
-
var _react = __webpack_require__(2);
|
23771 |
-
|
23772 |
-
var _react2 = _interopRequireDefault(_react);
|
23773 |
-
|
23774 |
-
var _reactStringReplace = __webpack_require__(431);
|
23775 |
-
|
23776 |
-
var _reactStringReplace2 = _interopRequireDefault(_reactStringReplace);
|
23777 |
-
|
23778 |
-
var _tabsJsx = __webpack_require__(574);
|
23779 |
-
|
23780 |
-
var _tabsJsx2 = _interopRequireDefault(_tabsJsx);
|
23781 |
-
|
23782 |
-
function renderStatusMessage(status, error, link) {
|
23783 |
-
var noticeType = status ? 'success' : 'error';
|
23784 |
-
var noticeMessage = status ? _mailpoet2['default'].I18n.t('systemStatusConnectionSuccessful') : _mailpoet2['default'].I18n.t('systemStatusConnectionUnsuccessful') + ' ' + error;
|
23785 |
-
|
23786 |
-
if (link) {
|
23787 |
-
noticeMessage = (0, _reactStringReplace2['default'])(noticeMessage, /\[link\](.*?)\[\/link\]/g, function (match) {
|
23788 |
-
return _react2['default'].createElement(
|
23789 |
-
'a',
|
23790 |
-
{ href: '' + link, key: 'kb-link' },
|
23791 |
-
match
|
23792 |
-
);
|
23793 |
-
});
|
23794 |
-
}
|
23795 |
-
|
23796 |
-
return _react2['default'].createElement(
|
23797 |
-
'div',
|
23798 |
-
{ className: 'mailpoet_notice notice inline notice-' + noticeType, style: { marginTop: '1em' } },
|
23799 |
-
_react2['default'].createElement(
|
23800 |
-
'p',
|
23801 |
-
null,
|
23802 |
-
noticeMessage
|
23803 |
-
)
|
23804 |
-
);
|
23805 |
-
}
|
23806 |
-
|
23807 |
-
function renderCronSection(data) {
|
23808 |
-
var status = data.cron.isReachable;
|
23809 |
-
var url = data.cron.url;
|
23810 |
-
|
23811 |
-
return _react2['default'].createElement(
|
23812 |
-
'div',
|
23813 |
-
null,
|
23814 |
-
_react2['default'].createElement(
|
23815 |
-
'h2',
|
23816 |
-
null,
|
23817 |
-
_mailpoet2['default'].I18n.t('systemStatusCronTitle')
|
23818 |
-
),
|
23819 |
-
_react2['default'].createElement(
|
23820 |
-
'p',
|
23821 |
-
null,
|
23822 |
-
_react2['default'].createElement(
|
23823 |
-
'a',
|
23824 |
-
{ href: url, target: '_blank' },
|
23825 |
-
url
|
23826 |
-
)
|
23827 |
-
),
|
23828 |
-
renderStatusMessage(status, _mailpoet2['default'].I18n.t('systemStatusCronConnectionUnsuccessfulInfo'), '//beta.docs.mailpoet.com/article/231-sending-does-not-work')
|
23829 |
-
);
|
23830 |
-
}
|
23831 |
-
|
23832 |
-
function renderMSSSection(data) {
|
23833 |
-
if (!data.mss.enabled) return undefined;
|
23834 |
-
|
23835 |
-
var status = data.mss.enabled.isReachable;
|
23836 |
-
|
23837 |
-
return _react2['default'].createElement(
|
23838 |
-
'div',
|
23839 |
-
null,
|
23840 |
-
_react2['default'].createElement(
|
23841 |
-
'h2',
|
23842 |
-
null,
|
23843 |
-
_mailpoet2['default'].I18n.t('systemStatusMSSTitle')
|
23844 |
-
),
|
23845 |
-
renderStatusMessage(status, _mailpoet2['default'].I18n.t('systemStatusMSSConnectionUnsuccessfulInfo'), false)
|
23846 |
-
);
|
23847 |
-
}
|
23848 |
-
|
23849 |
-
function SystemStatus() {
|
23850 |
-
var systemStatusData = window.systemStatusData;
|
23851 |
-
|
23852 |
-
return _react2['default'].createElement(
|
23853 |
-
'div',
|
23854 |
-
null,
|
23855 |
-
_react2['default'].createElement(_tabsJsx2['default'], { tab: 'systemStatus' }),
|
23856 |
-
_react2['default'].createElement(
|
23857 |
-
'div',
|
23858 |
-
{ className: 'mailpoet_notice notice inline', style: { marginTop: '1em' } },
|
23859 |
-
_react2['default'].createElement(
|
23860 |
-
'p',
|
23861 |
-
null,
|
23862 |
-
systemStatusData.mss.enabled ? _mailpoet2['default'].I18n.t('systemStatusIntroCronMSS') : _mailpoet2['default'].I18n.t('systemStatusIntroCron')
|
23863 |
-
)
|
23864 |
-
),
|
23865 |
-
renderCronSection(systemStatusData),
|
23866 |
-
renderMSSSection(systemStatusData)
|
23867 |
-
);
|
23868 |
-
}
|
23869 |
-
module.exports = SystemStatus;
|
23870 |
-
|
23871 |
-
/***/ },
|
23872 |
-
|
23873 |
-
/***/ 574:
|
23874 |
-
/***/ function(module, exports, __webpack_require__) {
|
23875 |
-
|
23876 |
-
'use strict';
|
23877 |
-
|
23878 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
23879 |
-
|
23880 |
-
var _react = __webpack_require__(2);
|
23881 |
-
|
23882 |
-
var _react2 = _interopRequireDefault(_react);
|
23883 |
-
|
23884 |
-
var _reactRouter = __webpack_require__(181);
|
23885 |
-
|
23886 |
-
var _classnames = __webpack_require__(277);
|
23887 |
-
|
23888 |
-
var _classnames2 = _interopRequireDefault(_classnames);
|
23889 |
-
|
23890 |
-
var _mailpoet = __webpack_require__(276);
|
23891 |
-
|
23892 |
-
var _mailpoet2 = _interopRequireDefault(_mailpoet);
|
23893 |
-
|
23894 |
-
var tabs = [{
|
23895 |
-
name: 'systemStatus',
|
23896 |
-
label: _mailpoet2['default'].I18n.t('tabSystemStatusTitle'),
|
23897 |
-
link: '/systemStatus'
|
23898 |
-
}, {
|
23899 |
-
name: 'systemInfo',
|
23900 |
-
label: _mailpoet2['default'].I18n.t('tabSystemInfoTitle'),
|
23901 |
-
link: '/systemInfo'
|
23902 |
-
}, {
|
23903 |
-
name: 'knowledgeBase',
|
23904 |
-
label: _mailpoet2['default'].I18n.t('tabKnowledgeBaseTitle'),
|
23905 |
-
link: '/knowledgeBase'
|
23906 |
-
}];
|
23907 |
-
|
23908 |
-
function Tabs(props) {
|
23909 |
-
var tabLinks = tabs.map(function (tab) {
|
23910 |
-
var tabClasses = (0, _classnames2['default'])('nav-tab', { 'nav-tab-active': props.tab === tab.name });
|
23911 |
-
|
23912 |
-
return _react2['default'].createElement(
|
23913 |
-
_reactRouter.Link,
|
23914 |
-
{
|
23915 |
-
key: 'tab-' + tab.name,
|
23916 |
-
className: tabClasses,
|
23917 |
-
to: tab.link
|
23918 |
-
},
|
23919 |
-
tab.label
|
23920 |
-
);
|
23921 |
-
});
|
23922 |
-
|
23923 |
-
return _react2['default'].createElement(
|
23924 |
-
'h2',
|
23925 |
-
{ className: 'nav-tab-wrapper' },
|
23926 |
-
tabLinks
|
23927 |
-
);
|
23928 |
-
}
|
23929 |
-
|
23930 |
-
Tabs.propTypes = { tab: _react2['default'].PropTypes.string };
|
23931 |
-
Tabs.defaultProps = { tab: 'systemStatus' };
|
23932 |
-
|
23933 |
-
module.exports = Tabs;
|
23934 |
-
|
23935 |
-
/***/ },
|
23936 |
-
|
23937 |
-
/***/ 575:
|
23938 |
-
/***/ function(module, exports, __webpack_require__) {
|
23939 |
-
|
23940 |
-
'use strict';
|
23941 |
-
|
23942 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
23943 |
-
|
23944 |
-
var _react = __webpack_require__(2);
|
23945 |
-
|
23946 |
-
var _react2 = _interopRequireDefault(_react);
|
23947 |
-
|
23948 |
-
var _mailpoet = __webpack_require__(276);
|
23949 |
-
|
23950 |
-
var _mailpoet2 = _interopRequireDefault(_mailpoet);
|
23951 |
-
|
23952 |
-
var _underscore = __webpack_require__(281);
|
23953 |
-
|
23954 |
-
var _underscore2 = _interopRequireDefault(_underscore);
|
23955 |
-
|
23956 |
-
var _tabsJsx = __webpack_require__(574);
|
23957 |
-
|
23958 |
-
var _tabsJsx2 = _interopRequireDefault(_tabsJsx);
|
23959 |
-
|
23960 |
-
function handleFocus(event) {
|
23961 |
-
event.target.select();
|
23962 |
-
}
|
23963 |
-
|
23964 |
-
function printData(data) {
|
23965 |
-
if (_underscore2['default'].isObject(data)) {
|
23966 |
-
var printableData = Object.keys(data).map(function (key) {
|
23967 |
-
return key + ': ' + data[key];
|
23968 |
-
});
|
23969 |
-
|
23970 |
-
return _react2['default'].createElement('textarea', {
|
23971 |
-
readOnly: true,
|
23972 |
-
onFocus: handleFocus,
|
23973 |
-
value: printableData.join('\n'),
|
23974 |
-
style: {
|
23975 |
-
width: '100%',
|
23976 |
-
height: '400px'
|
23977 |
-
}
|
23978 |
-
});
|
23979 |
-
}
|
23980 |
-
return _react2['default'].createElement(
|
23981 |
-
'p',
|
23982 |
-
null,
|
23983 |
-
_mailpoet2['default'].I18n.t('systemInfoDataError')
|
23984 |
-
);
|
23985 |
-
}
|
23986 |
-
|
23987 |
-
function SystemInfo() {
|
23988 |
-
var systemInfoData = window.systemInfoData;
|
23989 |
-
return _react2['default'].createElement(
|
23990 |
-
'div',
|
23991 |
-
null,
|
23992 |
-
_react2['default'].createElement(_tabsJsx2['default'], { tab: 'systemInfo' }),
|
23993 |
-
_react2['default'].createElement(
|
23994 |
-
'div',
|
23995 |
-
{ className: 'mailpoet_notice notice inline', style: { marginTop: '1em' } },
|
23996 |
-
_react2['default'].createElement(
|
23997 |
-
'p',
|
23998 |
-
null,
|
23999 |
-
_mailpoet2['default'].I18n.t('systemInfoIntro')
|
24000 |
-
)
|
24001 |
-
),
|
24002 |
-
printData(systemInfoData)
|
24003 |
-
);
|
24004 |
-
}
|
24005 |
-
|
24006 |
-
module.exports = SystemInfo;
|
24007 |
-
|
24008 |
-
/***/ },
|
24009 |
-
|
24010 |
-
/***/ 576:
|
24011 |
-
/***/ function(module, exports, __webpack_require__) {
|
24012 |
-
|
24013 |
-
'use strict';
|
24014 |
-
|
24015 |
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
24016 |
-
|
24017 |
-
var _react = __webpack_require__(2);
|
24018 |
-
|
24019 |
-
var _react2 = _interopRequireDefault(_react);
|
24020 |
-
|
24021 |
-
var _mailpoet = __webpack_require__(276);
|
24022 |
-
|
24023 |
-
var _mailpoet2 = _interopRequireDefault(_mailpoet);
|
24024 |
-
|
24025 |
-
var _tabsJsx = __webpack_require__(574);
|
24026 |
-
|
24027 |
-
var _tabsJsx2 = _interopRequireDefault(_tabsJsx);
|
24028 |
-
|
24029 |
-
function KnowledgeBase() {
|
24030 |
-
return _react2['default'].createElement(
|
24031 |
-
'div',
|
24032 |
-
null,
|
24033 |
-
_react2['default'].createElement(_tabsJsx2['default'], { tab: 'knowledgeBase' }),
|
24034 |
-
_react2['default'].createElement(
|
24035 |
-
'p',
|
24036 |
-
null,
|
24037 |
-
_mailpoet2['default'].I18n.t('knowledgeBaseIntro')
|
24038 |
-
),
|
24039 |
-
_react2['default'].createElement(
|
24040 |
-
'ul',
|
24041 |
-
null,
|
24042 |
-
_react2['default'].createElement(
|
24043 |
-
'li',
|
24044 |
-
null,
|
24045 |
-
_react2['default'].createElement(
|
24046 |
-
'a',
|
24047 |
-
{ target: '_blank', rel: 'noreferrer noopener', href: 'http://beta.docs.mailpoet.com/category/116-common-problems' },
|
24048 |
-
'Common Problems'
|
24049 |
-
)
|
24050 |
-
),
|
24051 |
-
_react2['default'].createElement(
|
24052 |
-
'li',
|
24053 |
-
null,
|
24054 |
-
_react2['default'].createElement(
|
24055 |
-
'a',
|
24056 |
-
{ target: '_blank', rel: 'noreferrer noopener', href: 'http://beta.docs.mailpoet.com/category/165-newsletters' },
|
24057 |
-
'Newsletters'
|
24058 |
-
)
|
24059 |
-
),
|
24060 |
-
_react2['default'].createElement(
|
24061 |
-
'li',
|
24062 |
-
null,
|
24063 |
-
_react2['default'].createElement(
|
24064 |
-
'a',
|
24065 |
-
{ target: '_blank', rel: 'noreferrer noopener', href: 'http://beta.docs.mailpoet.com/category/156-migration-questions' },
|
24066 |
-
'Migration Questions'
|
24067 |
-
)
|
24068 |
-
),
|
24069 |
-
_react2['default'].createElement(
|
24070 |
-
'li',
|
24071 |
-
null,
|
24072 |
-
_react2['default'].createElement(
|
24073 |
-
'a',
|
24074 |
-
{ target: '_blank', rel: 'noreferrer noopener', href: 'http://beta.docs.mailpoet.com/category/149-sending-methods' },
|
24075 |
-
'Sending Methods'
|
24076 |
-
)
|
24077 |
-
),
|
24078 |
-
_react2['default'].createElement(
|
24079 |
-
'li',
|
24080 |
-
null,
|
24081 |
-
_react2['default'].createElement(
|
24082 |
-
'a',
|
24083 |
-
{ target: '_blank', rel: 'noreferrer noopener', href: 'http://beta.docs.mailpoet.com/category/139-subscription-forms' },
|
24084 |
-
'Subscription Forms'
|
24085 |
-
)
|
24086 |
-
),
|
24087 |
-
_react2['default'].createElement(
|
24088 |
-
'li',
|
24089 |
-
null,
|
24090 |
-
_react2['default'].createElement(
|
24091 |
-
'a',
|
24092 |
-
{ target: '_blank', rel: 'noreferrer noopener', href: 'http://beta.docs.mailpoet.com/category/114-getting-started' },
|
24093 |
-
'Getting Started'
|
24094 |
-
)
|
24095 |
-
),
|
24096 |
-
_react2['default'].createElement(
|
24097 |
-
'li',
|
24098 |
-
null,
|
24099 |
-
_react2['default'].createElement(
|
24100 |
-
'a',
|
24101 |
-
{ target: '_blank', rel: 'noreferrer noopener', href: 'http://beta.docs.mailpoet.com/category/123-newsletter-designer' },
|
24102 |
-
'Newsletter Designer'
|
24103 |
-
)
|
24104 |
-
),
|
24105 |
-
_react2['default'].createElement(
|
24106 |
-
'li',
|
24107 |
-
null,
|
24108 |
-
_react2['default'].createElement(
|
24109 |
-
'a',
|
24110 |
-
{ target: '_blank', rel: 'noreferrer noopener', href: 'http://beta.docs.mailpoet.com/category/121-subscribers-and-lists' },
|
24111 |
-
'Subscribers and Lists'
|
24112 |
-
)
|
24113 |
-
)
|
24114 |
-
),
|
24115 |
-
_react2['default'].createElement(
|
24116 |
-
'a',
|
24117 |
-
{ target: '_blank', rel: 'noreferrer noopener', href: 'http://beta.docs.mailpoet.com/', className: 'button button-primary' },
|
24118 |
-
_mailpoet2['default'].I18n.t('knowledgeBaseButton')
|
24119 |
-
)
|
24120 |
-
);
|
24121 |
-
}
|
24122 |
-
|
24123 |
-
module.exports = KnowledgeBase;
|
24124 |
-
|
24125 |
-
/***/ },
|
24126 |
-
|
24127 |
-
/***/ 577:
|
24128 |
-
/***/ function(module, exports, __webpack_require__) {
|
24129 |
-
|
24130 |
-
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
|
24131 |
-
__webpack_require__(276)
|
24132 |
-
], __WEBPACK_AMD_DEFINE_RESULT__ = function reinstallFromScratch(
|
24133 |
-
MailPoet
|
24134 |
-
) {
|
24135 |
-
var element;
|
24136 |
-
function eventHandler() {
|
24137 |
-
if (confirm(MailPoet.I18n.t('reinstallConfirmation'))) { // eslint-disable-line no-alert
|
24138 |
-
MailPoet.trackEvent(
|
24139 |
-
'User has reinstalled MailPoet via Settings',
|
24140 |
-
{ 'MailPoet Free version': window.mailpoet_version }
|
24141 |
-
);
|
24142 |
-
|
24143 |
-
MailPoet.Modal.loading(true);
|
24144 |
-
MailPoet.Ajax.post({
|
24145 |
-
api_version: window.mailpoet_api_version,
|
24146 |
-
endpoint: 'setup',
|
24147 |
-
action: 'reset'
|
24148 |
-
}).always(function alwaysCb() {
|
24149 |
-
MailPoet.Modal.loading(false);
|
24150 |
-
}).done(function doneCb() {
|
24151 |
-
window.location = 'admin.php?page=mailpoet-newsletters';
|
24152 |
-
}).fail(function failCb(response) {
|
24153 |
-
if (response.errors.length > 0) {
|
24154 |
-
MailPoet.Notice.error(
|
24155 |
-
response.errors.map(function responseMapCb(error) {
|
24156 |
-
return error.message;
|
24157 |
-
}),
|
24158 |
-
{ scroll: true }
|
24159 |
-
);
|
24160 |
-
}
|
24161 |
-
});
|
24162 |
-
}
|
24163 |
-
return false;
|
24164 |
-
}
|
24165 |
-
|
24166 |
-
element = document.getElementById('mailpoet_reinstall');
|
24167 |
-
if (element) {
|
24168 |
-
element.addEventListener('click', eventHandler, false);
|
24169 |
-
}
|
24170 |
-
}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
24171 |
-
|
24172 |
-
|
24173 |
-
/***/ },
|
24174 |
-
|
24175 |
-
/***/ 578:
|
24176 |
-
/***/ function(module, exports, __webpack_require__) {
|
24177 |
-
|
24178 |
-
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disable func-names */
|
24179 |
-
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
|
24180 |
-
__webpack_require__(570),
|
24181 |
-
__webpack_require__(281),
|
24182 |
-
__webpack_require__(275),
|
24183 |
-
__webpack_require__(276),
|
24184 |
-
__webpack_require__(579),
|
24185 |
-
__webpack_require__(580),
|
24186 |
-
__webpack_require__(581),
|
24187 |
-
__webpack_require__(305)
|
24188 |
-
], __WEBPACK_AMD_DEFINE_RESULT__ = function (
|
24189 |
-
Backbone,
|
24190 |
-
_,
|
24191 |
-
jQuery,
|
24192 |
-
MailPoet,
|
24193 |
-
Handlebars,
|
24194 |
-
Papa,
|
24195 |
-
AsyncQueue,
|
24196 |
-
Moment
|
24197 |
-
) {
|
24198 |
-
if (!jQuery('#mailpoet_subscribers_import').length) {
|
24199 |
-
return;
|
24200 |
-
}
|
24201 |
-
jQuery(document).ready(function () {
|
24202 |
-
var router;
|
24203 |
-
jQuery('input[name="select_method"]').attr('checked', false);
|
24204 |
-
// configure router
|
24205 |
-
router = new (Backbone.Router.extend({
|
24206 |
-
routes: {
|
24207 |
-
'': 'home',
|
24208 |
-
step1: 'step1',
|
24209 |
-
step2: 'step2',
|
24210 |
-
step3: 'step3'
|
24211 |
-
},
|
24212 |
-
home: function () {
|
24213 |
-
this.navigate('step1', { trigger: true });
|
24214 |
-
}
|
24215 |
-
}))();
|
24216 |
-
|
24217 |
-
function showCurrentStep() {
|
24218 |
-
MailPoet.Notice.hide();
|
24219 |
-
MailPoet.Modal.loading(false);
|
24220 |
-
jQuery('#mailpoet_subscribers_import > div[id^="step"]').hide();
|
24221 |
-
jQuery(location.hash).show();
|
24222 |
-
}
|
24223 |
-
|
24224 |
-
/*
|
24225 |
-
* STEP 1 (upload or copy/paste)
|
24226 |
-
*/
|
24227 |
-
router.on('route:step1', function () {
|
24228 |
-
var methodProcessContainerTemplate;
|
24229 |
-
var currentStepE;
|
24230 |
-
var methodSelectionElement;
|
24231 |
-
var pasteInputElement;
|
24232 |
-
var pasteInputPlaceholderElement;
|
24233 |
-
var pasteProcessButtonElement;
|
24234 |
-
var mailChimpKeyInputElement;
|
24235 |
-
var mailChimpKeyVerifyButtonElement;
|
24236 |
-
var mailChimpListsContainerElement;
|
24237 |
-
var mailChimpProcessButtonElement;
|
24238 |
-
var uploadElement;
|
24239 |
-
var uploadProcessButtonElement;
|
24240 |
-
// set or reset temporary validation rule on all columns
|
24241 |
-
window.mailpoetColumns = jQuery.map(window.mailpoetColumns, function (column) {
|
24242 |
-
var col = column;
|
24243 |
-
col.validation_rule = false;
|
24244 |
-
return col;
|
24245 |
-
});
|
24246 |
-
|
24247 |
-
if (typeof (window.importData.step1) !== 'undefined') {
|
24248 |
-
showCurrentStep();
|
24249 |
-
return;
|
24250 |
-
}
|
24251 |
-
|
24252 |
-
// render process button for each method
|
24253 |
-
methodProcessContainerTemplate =
|
24254 |
-
Handlebars.compile(jQuery('#method_process_template').html());
|
24255 |
-
jQuery('.mailpoet_method_process').html(methodProcessContainerTemplate());
|
24256 |
-
|
24257 |
-
// define reusable variables
|
24258 |
-
currentStepE = jQuery(location.hash);
|
24259 |
-
methodSelectionElement = jQuery('#select_method');
|
24260 |
-
pasteInputElement = jQuery('#paste_input');
|
24261 |
-
pasteInputPlaceholderElement =
|
24262 |
-
pasteInputElement.data('placeholder').replace(/\\n/g, '\n');
|
24263 |
-
pasteProcessButtonElement =
|
24264 |
-
jQuery('#method_paste > div.mailpoet_method_process')
|
24265 |
-
.find('a.mailpoet_process');
|
24266 |
-
mailChimpKeyInputElement = jQuery('#mailchimp_key');
|
24267 |
-
mailChimpKeyVerifyButtonElement = jQuery('#mailchimp_key_verify');
|
24268 |
-
mailChimpListsContainerElement = jQuery('#mailchimp_lists');
|
24269 |
-
mailChimpProcessButtonElement = jQuery('#method_mailchimp > div.mailpoet_method_process')
|
24270 |
-
.find('a.mailpoet_process');
|
24271 |
-
uploadElement = jQuery('#file_local');
|
24272 |
-
uploadProcessButtonElement =
|
24273 |
-
jQuery('#method_file > div.mailpoet_method_process')
|
24274 |
-
.find('a.mailpoet_process');
|
24275 |
-
|
24276 |
-
// define method change behavior
|
24277 |
-
methodSelectionElement.change(function () {
|
24278 |
-
var availableMethods = jQuery(':radio[name="select_method"]');
|
24279 |
-
var selectedMethod = availableMethods.index(availableMethods.filter(':checked'));
|
24280 |
-
MailPoet.Notice.hide();
|
24281 |
-
// hide all methods
|
24282 |
-
currentStepE.find('.inside')
|
24283 |
-
.children('div[id^="method_"]')
|
24284 |
-
.hide();
|
24285 |
-
// show selected method
|
24286 |
-
currentStepE.find('.inside')
|
24287 |
-
.children('div[id^="method_"]:eq(' + selectedMethod + ')')
|
24288 |
-
.show()
|
24289 |
-
.find('table')
|
24290 |
-
.show();
|
24291 |
-
});
|
24292 |
-
|
24293 |
-
// start step 1
|
24294 |
-
showCurrentStep();
|
24295 |
-
|
24296 |
-
function toggleNextStepButton(element, condition) {
|
24297 |
-
var disabled = 'button-disabled';
|
24298 |
-
if (condition === 'on') {
|
24299 |
-
element.closest('table a').removeClass(disabled);
|
24300 |
-
return;
|
24301 |
-
}
|
24302 |
-
element.closest('table a').addClass(disabled);
|
24303 |
-
}
|
24304 |
-
|
24305 |
-
function parseCSV(isFile) {
|
24306 |
-
var processedSubscribers = [];
|
24307 |
-
var parsedEmails = [];
|
24308 |
-
var duplicateEmails = [];
|
24309 |
-
var invalidEmails = [];
|
24310 |
-
var emailColumnPosition = null;
|
24311 |
-
var columnCount = null;
|
24312 |
-
var isHeaderFound = false;
|
24313 |
-
var advancedOptionHeader = true;
|
24314 |
-
var advancedOptionDelimiter = '';
|
24315 |
-
var advancedOptionNewline = '';
|
24316 |
-
var advancedOptionComments = false;
|
24317 |
-
// trim spaces, commas, periods,
|
24318 |
-
// single/double quotes and convert to lowercase
|
24319 |
-
var detectAndCleanupEmail = function (emailString) {
|
24320 |
-
var test;
|
24321 |
-
// decode HTML entities
|
24322 |
-
var email = jQuery('<div />').html(emailString).text();
|
24323 |
-
email = email
|
24324 |
-
.toLowerCase()
|
24325 |
-
// left/right trim spaces, punctuation (e.g., " 'email@email.com'; ")
|
24326 |
-
// right trim non-printable characters (e.g., "email@email.com�")
|
24327 |
-
.replace(/^["';.,\s]+|[^\x20-\x7E]+$|["';.,_\s]+$/g, '')
|
24328 |
-
// remove spaces (e.g., "email @ email . com")
|
24329 |
-
// remove urlencoded characters
|
24330 |
-
.replace(/\s+|%\d+|,+/g, '');
|
24331 |
-
// detect e-mails that will be otherwise rejected by email regex
|
24332 |
-
test = /<(.*?)>/.exec(email);
|
24333 |
-
if (test) {
|
24334 |
-
// is the email inside angle brackets (e.g., 'some@email.com <some@email.com>')?
|
24335 |
-
email = test[1].trim();
|
24336 |
-
}
|
24337 |
-
test = /mailto:(?:\s+)?(.*)/.exec(email);
|
24338 |
-
if (test) {
|
24339 |
-
// is the email in 'mailto:email' format?
|
24340 |
-
email = test[1].trim();
|
24341 |
-
}
|
24342 |
-
|
24343 |
-
// validate email
|
24344 |
-
if (!window.mailpoet_email_regex.test(email)) {
|
24345 |
-
return false;
|
24346 |
-
}
|
24347 |
-
return email;
|
24348 |
-
};
|
24349 |
-
|
24350 |
-
return {
|
24351 |
-
skipEmptyLines: true,
|
24352 |
-
delimiter: advancedOptionDelimiter,
|
24353 |
-
newline: advancedOptionNewline,
|
24354 |
-
comments: advancedOptionComments,
|
24355 |
-
error: function () {
|
24356 |
-
MailPoet.Notice.hide();
|
24357 |
-
MailPoet.Notice.error(MailPoet.I18n.t('dataProcessingError'));
|
24358 |
-
},
|
24359 |
-
complete: function (CSV) {
|
24360 |
-
var email;
|
24361 |
-
var emailAddress;
|
24362 |
-
var rowData;
|
24363 |
-
var rowColumnCount;
|
24364 |
-
var errorNotice;
|
24365 |
-
Object.keys(CSV.data).forEach(function csvDataEach(rowCount) {
|
24366 |
-
rowData = CSV.data[rowCount].map(function (el) {
|
24367 |
-
return el.trim();
|
24368 |
-
});
|
24369 |
-
rowColumnCount = rowData.length;
|
24370 |
-
// set the number of row elements based on the first non-empty row
|
24371 |
-
if (columnCount === null) {
|
24372 |
-
columnCount = rowColumnCount;
|
24373 |
-
}
|
24374 |
-
// Process the row with the following assumptions:
|
24375 |
-
// 1. Each row should contain the same number of elements
|
24376 |
-
// 2. There should be at least 1 valid (as per HTML5 e-mail regex)
|
24377 |
-
// e-mail address on each row EXCEPT when the header option is set to true
|
24378 |
-
// 3. Duplicate addresses are skipped
|
24379 |
-
if (rowColumnCount === columnCount) {
|
24380 |
-
// determine position of email address inside an array; this is
|
24381 |
-
// done once and then email regex is run just on that element for each row
|
24382 |
-
if (emailColumnPosition === null) {
|
24383 |
-
Object.keys(rowData).forEach(function rowDataEach(column) {
|
24384 |
-
emailAddress = detectAndCleanupEmail(rowData[column]);
|
24385 |
-
if (emailColumnPosition === null
|
24386 |
-
&& window.mailpoet_email_regex.test(emailAddress)) {
|
24387 |
-
emailColumnPosition = column;
|
24388 |
-
// add current e-mail to an object index
|
24389 |
-
parsedEmails[emailAddress] = true;
|
24390 |
-
rowData[column] = emailAddress;
|
24391 |
-
processedSubscribers[emailAddress] = rowData;
|
24392 |
-
}
|
24393 |
-
});
|
24394 |
-
if (emailColumnPosition === null
|
24395 |
-
&& advancedOptionHeader
|
24396 |
-
&& parseInt(rowCount, 10) === 0) {
|
24397 |
-
isHeaderFound = true;
|
24398 |
-
processedSubscribers[0] = rowData;
|
24399 |
-
}
|
24400 |
-
} else if (rowData[emailColumnPosition] !== '') {
|
24401 |
-
email = detectAndCleanupEmail(rowData[emailColumnPosition]);
|
24402 |
-
if (_.has(parsedEmails, email)) {
|
24403 |
-
duplicateEmails.push(email);
|
24404 |
-
} else if (!window.mailpoet_email_regex.test(email)) {
|
24405 |
-
invalidEmails.push(rowData[emailColumnPosition]);
|
24406 |
-
} else {
|
24407 |
-
// if we haven't yet processed this e-mail and it passed
|
24408 |
-
// the regex test, then process the row
|
24409 |
-
parsedEmails[email] = true;
|
24410 |
-
rowData[emailColumnPosition] = email;
|
24411 |
-
processedSubscribers[email] = rowData;
|
24412 |
-
}
|
24413 |
-
}
|
24414 |
-
}
|
24415 |
-
});
|
24416 |
-
// reindex array to avoid non-numeric indices
|
24417 |
-
processedSubscribers = _.values(processedSubscribers);
|
24418 |
-
// if the header options is set, there should be at least
|
24419 |
-
// 2 data rows, otherwise at least 1 data row
|
24420 |
-
if (
|
24421 |
-
processedSubscribers &&
|
24422 |
-
(
|
24423 |
-
(isHeaderFound && processedSubscribers.length >= 2)
|
24424 |
-
||
|
24425 |
-
(!isHeaderFound && processedSubscribers.length >= 1)
|
24426 |
-
)
|
24427 |
-
) {
|
24428 |
-
// since we assume that the header line is always present, we need
|
24429 |
-
// to detect the header by checking if it contains a valid e-mail address
|
24430 |
-
window.importData.step1 = {
|
24431 |
-
header: (!window.mailpoet_email_regex.test(
|
24432 |
-
processedSubscribers[0][emailColumnPosition])
|
24433 |
-
) ? processedSubscribers.shift() : null,
|
24434 |
-
subscribers: processedSubscribers,
|
24435 |
-
subscribersCount: processedSubscribers.length,
|
24436 |
-
duplicate: duplicateEmails,
|
24437 |
-
invalid: invalidEmails
|
24438 |
-
};
|
24439 |
-
MailPoet.trackEvent('Subscribers import started', {
|
24440 |
-
source: isFile ? 'file upload' : 'pasted data',
|
24441 |
-
'MailPoet Free version': window.mailpoet_version
|
24442 |
-
});
|
24443 |
-
router.navigate('step2', { trigger: true });
|
24444 |
-
} else {
|
24445 |
-
MailPoet.Modal.loading(false);
|
24446 |
-
errorNotice = MailPoet.I18n.t('noValidRecords');
|
24447 |
-
errorNotice = errorNotice.replace('[link]', MailPoet.I18n.t('csvKBLink'));
|
24448 |
-
errorNotice = errorNotice.replace('[/link]', '</a>');
|
24449 |
-
MailPoet.Notice.error(errorNotice);
|
24450 |
-
}
|
24451 |
-
}
|
24452 |
-
};
|
24453 |
-
}
|
24454 |
-
|
24455 |
-
function displayMailChimpLists(data) {
|
24456 |
-
var listSelectElement = mailChimpListsContainerElement.find('select');
|
24457 |
-
if (listSelectElement.data('select2')) {
|
24458 |
-
listSelectElement.select2('data', data);
|
24459 |
-
listSelectElement.trigger('change');
|
24460 |
-
} else {
|
24461 |
-
listSelectElement
|
24462 |
-
.select2({
|
24463 |
-
data: data,
|
24464 |
-
width: '20em',
|
24465 |
-
templateResult: function (item) {
|
24466 |
-
return item.name;
|
24467 |
-
},
|
24468 |
-
templateSelection: function (item) {
|
24469 |
-
return item.name;
|
24470 |
-
}
|
24471 |
-
})
|
24472 |
-
.change(function () {
|
24473 |
-
if (jQuery(this).val() !== null) {
|
24474 |
-
toggleNextStepButton(mailChimpProcessButtonElement, 'on');
|
24475 |
-
} else {
|
24476 |
-
toggleNextStepButton(mailChimpProcessButtonElement, 'off');
|
24477 |
-
}
|
24478 |
-
})
|
24479 |
-
.trigger('change');
|
24480 |
-
}
|
24481 |
-
mailChimpListsContainerElement.show();
|
24482 |
-
}
|
24483 |
-
|
24484 |
-
/*
|
24485 |
-
* Paste
|
24486 |
-
*/
|
24487 |
-
pasteInputElement
|
24488 |
-
.attr('value', pasteInputPlaceholderElement).css('color', '#999')
|
24489 |
-
.focus(function () {
|
24490 |
-
if (jQuery(this).val() === pasteInputPlaceholderElement) {
|
24491 |
-
jQuery(this).attr('value', '').css('color', '#222');
|
24492 |
-
}
|
24493 |
-
})
|
24494 |
-
.blur(function () {
|
24495 |
-
if (jQuery(this).val() === '') {
|
24496 |
-
jQuery(this).attr('value', pasteInputPlaceholderElement).css('color', '#999');
|
24497 |
-
}
|
24498 |
-
})
|
24499 |
-
.keyup(function () {
|
24500 |
-
toggleNextStepButton(
|
24501 |
-
pasteProcessButtonElement,
|
24502 |
-
(this.value.trim() !== '') ? 'on' : 'off'
|
24503 |
-
);
|
24504 |
-
});
|
24505 |
-
|
24506 |
-
pasteProcessButtonElement.click(function () {
|
24507 |
-
var pasteSize = encodeURI(pasteInputElement.val()).split(/%..|./).length - 1;
|
24508 |
-
MailPoet.Notice.hide();
|
24509 |
-
// get an approximate size of textarea paste in bytes
|
24510 |
-
if (pasteSize > window.maxPostSizeBytes) {
|
24511 |
-
MailPoet.Notice.error(MailPoet.I18n.t('maxPostSizeNotice'));
|
24512 |
-
return;
|
24513 |
-
}
|
24514 |
-
// delay loading indicator for 10ms or else it's just too fast :)
|
24515 |
-
MailPoet.Modal.loading(true);
|
24516 |
-
setTimeout(function () {
|
24517 |
-
Papa.parse(pasteInputElement.val(), parseCSV(false));
|
24518 |
-
}, 10);
|
24519 |
-
});
|
24520 |
-
|
24521 |
-
/*
|
24522 |
-
* CSV file
|
24523 |
-
*/
|
24524 |
-
uploadElement.change(function () {
|
24525 |
-
var ext = this.value.match(/[^.]+$/);
|
24526 |
-
MailPoet.Notice.hide();
|
24527 |
-
if (ext === null || ext[0].toLowerCase() !== 'csv') {
|
24528 |
-
this.value = '';
|
24529 |
-
MailPoet.Notice.error(MailPoet.I18n.t('wrongFileFormat'));
|
24530 |
-
}
|
24531 |
-
|
24532 |
-
toggleNextStepButton(
|
24533 |
-
uploadProcessButtonElement,
|
24534 |
-
(this.value.trim() !== '') ? 'on' : 'off'
|
24535 |
-
);
|
24536 |
-
});
|
24537 |
-
|
24538 |
-
uploadProcessButtonElement.click(function () {
|
24539 |
-
if (uploadElement.val().trim() !== '') {
|
24540 |
-
// delay loading indicator for 10ms or else it's just too fast :)
|
24541 |
-
MailPoet.Modal.loading(true);
|
24542 |
-
setTimeout(function () {
|
24543 |
-
uploadElement.parse({
|
24544 |
-
config: parseCSV(true)
|
24545 |
-
});
|
24546 |
-
}, 10);
|
24547 |
-
}
|
24548 |
-
});
|
24549 |
-
|
24550 |
-
/*
|
24551 |
-
* MailChimp
|
24552 |
-
*/
|
24553 |
-
mailChimpKeyInputElement.keyup(function () {
|
24554 |
-
if (this.value.trim() === ''
|
24555 |
-
|| !/[a-zA-Z0-9]{32}-/.exec(this.value.trim())) {
|
24556 |
-
mailChimpListsContainerElement.hide();
|
24557 |
-
jQuery('.mailpoet_mailchimp-key-status')
|
24558 |
-
.html('')
|
24559 |
-
.removeClass('mailpoet_mailchimp-ok mailpoet_mailchimp-error');
|
24560 |
-
toggleNextStepButton(mailChimpProcessButtonElement, 'off');
|
24561 |
-
}
|
24562 |
-
});
|
24563 |
-
|
24564 |
-
mailChimpKeyVerifyButtonElement.click(function () {
|
24565 |
-
MailPoet.Modal.loading(true);
|
24566 |
-
MailPoet.Ajax.post({
|
24567 |
-
api_version: window.mailpoet_api_version,
|
24568 |
-
endpoint: 'importExport',
|
24569 |
-
action: 'getMailChimpLists',
|
24570 |
-
data: {
|
24571 |
-
api_key: mailChimpKeyInputElement.val()
|
24572 |
-
}
|
24573 |
-
}).always(function () {
|
24574 |
-
MailPoet.Modal.loading(false);
|
24575 |
-
}).done(function (response) {
|
24576 |
-
jQuery('.mailpoet_mailchimp-key-status')
|
24577 |
-
.html('')
|
24578 |
-
.removeClass()
|
24579 |
-
.addClass('mailpoet_mailchimp-key-status mailpoet_mailchimp-ok');
|
24580 |
-
if (response.data.length === 0) {
|
24581 |
-
jQuery('.mailpoet_mailchimp-key-status').html(MailPoet.I18n.t('noMailChimpLists'));
|
24582 |
-
mailChimpListsContainerElement.hide();
|
24583 |
-
toggleNextStepButton(mailChimpProcessButtonElement, 'off');
|
24584 |
-
} else {
|
24585 |
-
displayMailChimpLists(response.data);
|
24586 |
-
}
|
24587 |
-
}).fail(function (response) {
|
24588 |
-
if (response.errors.length > 0) {
|
24589 |
-
MailPoet.Notice.error(
|
24590 |
-
response.errors.map(function (error) { return error.message; }),
|
24591 |
-
{ scroll: true }
|
24592 |
-
);
|
24593 |
-
}
|
24594 |
-
});
|
24595 |
-
});
|
24596 |
-
|
24597 |
-
mailChimpProcessButtonElement.click(function () {
|
24598 |
-
if (mailChimpProcessButtonElement.closest('table a').hasClass('button-disabled')) {
|
24599 |
-
return;
|
24600 |
-
}
|
24601 |
-
MailPoet.Modal.loading(true);
|
24602 |
-
MailPoet.Ajax.post({
|
24603 |
-
api_version: window.mailpoet_api_version,
|
24604 |
-
endpoint: 'importExport',
|
24605 |
-
action: 'getMailChimpSubscribers',
|
24606 |
-
data: {
|
24607 |
-
api_key: mailChimpKeyInputElement.val(),
|
24608 |
-
lists: mailChimpListsContainerElement.find('select').val()
|
24609 |
-
}
|
24610 |
-
}).always(function () {
|
24611 |
-
MailPoet.Modal.loading(false);
|
24612 |
-
}).done(function (response) {
|
24613 |
-
window.importData.step1 = response.data;
|
24614 |
-
MailPoet.trackEvent('Subscribers import started', {
|
24615 |
-
source: 'MailChimp',
|
24616 |
-
'MailPoet Free version': window.mailpoet_version
|
24617 |
-
});
|
24618 |
-
router.navigate('step2', { trigger: true });
|
24619 |
-
}).fail(function (response) {
|
24620 |
-
if (response.errors.length > 0) {
|
24621 |
-
MailPoet.Notice.error(
|
24622 |
-
response.errors.map(function (error) { return error.message; }),
|
24623 |
-
{ scroll: true }
|
24624 |
-
);
|
24625 |
-
}
|
24626 |
-
});
|
24627 |
-
});
|
24628 |
-
});
|
24629 |
-
|
24630 |
-
router.on('route:step2', function () {
|
24631 |
-
var nextStepButton;
|
24632 |
-
var previousStepButton;
|
24633 |
-
var subscribers;
|
24634 |
-
var subscribersDataTemplate;
|
24635 |
-
var subscribersDataTemplatePartial;
|
24636 |
-
var subscribersDataParseResultsTemplate;
|
24637 |
-
var segmentSelectElement;
|
24638 |
-
var maxRowsToShow;
|
24639 |
-
var filler;
|
24640 |
-
var fillerArray;
|
24641 |
-
var fillerPosition;
|
24642 |
-
var importResults;
|
24643 |
-
var duplicates;
|
24644 |
-
if (typeof (window.importData.step1) === 'undefined') {
|
24645 |
-
router.navigate('step1', { trigger: true });
|
24646 |
-
return;
|
24647 |
-
}
|
24648 |
-
// define reusable variables
|
24649 |
-
nextStepButton = jQuery('#step2_process');
|
24650 |
-
previousStepButton = jQuery('#return_to_step1');
|
24651 |
-
// create a copy of subscribers object for further manipulation
|
24652 |
-
subscribers = jQuery.extend(true, {}, window.importData.step1);
|
24653 |
-
subscribersDataTemplate = Handlebars.compile(jQuery('#subscribers_data_template').html());
|
24654 |
-
subscribersDataTemplatePartial = Handlebars.compile(jQuery('#subscribers_data_template_partial').html());
|
24655 |
-
subscribersDataParseResultsTemplate = Handlebars.compile(jQuery('#subscribers_data_parse_results_template').html());
|
24656 |
-
segmentSelectElement = jQuery('#mailpoet_segments_select');
|
24657 |
-
maxRowsToShow = 10;
|
24658 |
-
filler = '. . .';
|
24659 |
-
// create an array of filler data with the same number of
|
24660 |
-
// elements as in the subscribers' data row
|
24661 |
-
fillerArray = Array.apply(
|
24662 |
-
null,
|
24663 |
-
new Array(subscribers.subscribers[0].length)
|
24664 |
-
).map(String.prototype.valueOf, filler);
|
24665 |
-
|
24666 |
-
showCurrentStep();
|
24667 |
-
|
24668 |
-
function toggleNextStepButton(condition) {
|
24669 |
-
var disabled = 'button-disabled';
|
24670 |
-
if (condition === 'on') {
|
24671 |
-
nextStepButton.removeClass(disabled);
|
24672 |
-
return;
|
24673 |
-
}
|
24674 |
-
nextStepButton.addClass(disabled);
|
24675 |
-
}
|
24676 |
-
|
24677 |
-
// hide previous statistics/import results
|
24678 |
-
jQuery('#subscribers_data_parse_results:visible').html('');
|
24679 |
-
jQuery('#subscribers_data_import_results:visible').hide();
|
24680 |
-
|
24681 |
-
// show parse statistics if any duplicate/invalid records were found
|
24682 |
-
if (subscribers.invalid.length || subscribers.duplicate.length) {
|
24683 |
-
// count repeating e-mails inside duplicate array and present them in
|
24684 |
-
// 'email (xN)' format
|
24685 |
-
duplicates = {};
|
24686 |
-
subscribers.duplicate.forEach(function (subscriberEmail) {
|
24687 |
-
duplicates[subscriberEmail] = (duplicates[subscriberEmail] || 0) + 1;
|
24688 |
-
});
|
24689 |
-
subscribers.duplicate = [];
|
24690 |
-
Object.keys(duplicates).forEach(function emailDuplicates(email) {
|
24691 |
-
if (duplicates[email] > 1) {
|
24692 |
-
subscribers.duplicate.push(email + ' (x' + duplicates[email] + ')');
|
24693 |
-
} else {
|
24694 |
-
subscribers.duplicate.push(email);
|
24695 |
-
}
|
24696 |
-
});
|
24697 |
-
|
24698 |
-
importResults = {
|
24699 |
-
notice: MailPoet.I18n.t('importNoticeSkipped').replace(
|
24700 |
-
'%1$s',
|
24701 |
-
'<strong>' + (subscribers.invalid.length + subscribers.duplicate.length) + '</strong>'
|
24702 |
-
),
|
24703 |
-
invalid: (subscribers.invalid.length)
|
24704 |
-
? MailPoet.I18n.t('importNoticeInvalid')
|
24705 |
-
.replace('%1$s', '<strong>' + subscribers.invalid.length.toLocaleString() + '</strong>')
|
24706 |
-
.replace('%2$s', subscribers.invalid.join(', '))
|
24707 |
-
: null,
|
24708 |
-
duplicate: (subscribers.duplicate.length)
|
24709 |
-
? MailPoet.I18n.t('importNoticeDuplicate')
|
24710 |
-
.replace('%1$s', '<strong>' + subscribers.duplicate.length + '</strong>')
|
24711 |
-
.replace('%2$s', subscribers.duplicate.join(', '))
|
24712 |
-
: null
|
24713 |
-
};
|
24714 |
-
jQuery('#subscribers_data_parse_results').html(
|
24715 |
-
subscribersDataParseResultsTemplate(importResults)
|
24716 |
-
);
|
24717 |
-
}
|
24718 |
-
|
24719 |
-
jQuery('.mailpoet_subscribers_data_parse_results_details_show')
|
24720 |
-
.click(function () {
|
24721 |
-
var details = jQuery('.mailpoet_subscribers_data_parse_results_details');
|
24722 |
-
jQuery(details).toggle();
|
24723 |
-
this.text =
|
24724 |
-
(jQuery(details).is(':visible'))
|
24725 |
-
? MailPoet.I18n.t('hideDetails')
|
24726 |
-
: MailPoet.I18n.t('showDetails');
|
24727 |
-
});
|
24728 |
-
|
24729 |
-
// show available segments
|
24730 |
-
if (window.mailpoetSegments.length) {
|
24731 |
-
jQuery('.mailpoet_segments').show();
|
24732 |
-
} else {
|
24733 |
-
jQuery('.mailpoet_no_segments').show();
|
24734 |
-
}
|
24735 |
-
|
24736 |
-
function enableSegmentSelection(segments) {
|
24737 |
-
if (segmentSelectElement.data('select2')) {
|
24738 |
-
segmentSelectElement
|
24739 |
-
.html('')
|
24740 |
-
.select2('destroy');
|
24741 |
-
toggleNextStepButton('off');
|
24742 |
-
}
|
24743 |
-
segmentSelectElement
|
24744 |
-
.select2({
|
24745 |
-
data: segments,
|
24746 |
-
width: '20em',
|
24747 |
-
templateResult: function (item) {
|
24748 |
-
var i = item;
|
24749 |
-
i.subscriberCount = parseInt(i.subscriberCount, 10);
|
24750 |
-
return i.name + ' (' + i.subscriberCount.toLocaleString() + ')';
|
24751 |
-
},
|
24752 |
-
templateSelection: function (item) {
|
24753 |
-
var i = item;
|
24754 |
-
i.subscriberCount = parseInt(i.subscriberCount, 10);
|
24755 |
-
return i.name + ' (' + i.subscriberCount.toLocaleString() + ')';
|
24756 |
-
}
|
24757 |
-
})
|
24758 |
-
.change(function () {
|
24759 |
-
var segmentSelectionNotice = jQuery('[data-id="notice_segmentSelection"]');
|
24760 |
-
if (!this.value) {
|
24761 |
-
if (!segmentSelectionNotice.length) {
|
24762 |
-
MailPoet.Notice.error(MailPoet.I18n.t('segmentSelectionRequired'), {
|
24763 |
-
static: true,
|
24764 |
-
scroll: true,
|
24765 |
-
id: 'notice_segmentSelection',
|
24766 |
-
hideClose: true
|
24767 |
-
});
|
24768 |
-
}
|
24769 |
-
toggleNextStepButton('off');
|
24770 |
-
} else {
|
24771 |
-
jQuery('[data-id="notice_segmentSelection"]').remove();
|
24772 |
-
if (!jQuery('.mailpoet_notice.error:visible').length) {
|
24773 |
-
toggleNextStepButton('on');
|
24774 |
-
}
|
24775 |
-
}
|
24776 |
-
});
|
24777 |
-
}
|
24778 |
-
|
24779 |
-
jQuery('.mailpoet_create_segment').click(function () {
|
24780 |
-
MailPoet.Modal.popup({
|
24781 |
-
title: MailPoet.I18n.t('addNewList'),
|
24782 |
-
template: jQuery('#new_segment_template').html()
|
24783 |
-
});
|
24784 |
-
jQuery('#new_segment_name').keypress(function (e) {
|
24785 |
-
if (e.which === 13) {
|
24786 |
-
jQuery('#new_segment_process').click();
|
24787 |
-
}
|
24788 |
-
});
|
24789 |
-
jQuery('#new_segment_process').click(function () {
|
24790 |
-
var segmentName = jQuery('#new_segment_name').val().trim();
|
24791 |
-
var segmentDescription = jQuery('#new_segment_description').val().trim();
|
24792 |
-
|
24793 |
-
MailPoet.Ajax.post({
|
24794 |
-
api_version: window.mailpoet_api_version,
|
24795 |
-
endpoint: 'ImportExport',
|
24796 |
-
action: 'addSegment',
|
24797 |
-
data: {
|
24798 |
-
name: segmentName,
|
24799 |
-
description: segmentDescription
|
24800 |
-
}
|
24801 |
-
}).done(function (response) {
|
24802 |
-
var selectedValues;
|
24803 |
-
window.mailpoetSegments.push({
|
24804 |
-
id: response.data.id,
|
24805 |
-
name: response.data.name,
|
24806 |
-
subscriberCount: 0
|
24807 |
-
});
|
24808 |
-
|
24809 |
-
selectedValues = segmentSelectElement.val();
|
24810 |
-
if (selectedValues === null) {
|
24811 |
-
selectedValues = [response.data.id];
|
24812 |
-
} else {
|
24813 |
-
selectedValues.push(response.data.id);
|
24814 |
-
}
|
24815 |
-
|
24816 |
-
enableSegmentSelection(window.mailpoetSegments);
|
24817 |
-
segmentSelectElement.val(selectedValues).trigger('change');
|
24818 |
-
jQuery('.mailpoet_segments:hidden').show();
|
24819 |
-
jQuery('.mailpoet_no_segments:visible').hide();
|
24820 |
-
MailPoet.Modal.close();
|
24821 |
-
}).fail(function (response) {
|
24822 |
-
if (response.errors.length > 0) {
|
24823 |
-
MailPoet.Notice.hide();
|
24824 |
-
MailPoet.Notice.error(
|
24825 |
-
response.errors.map(function (error) { return error.message; }),
|
24826 |
-
{ positionAfter: '#new_segment_name' }
|
24827 |
-
);
|
24828 |
-
}
|
24829 |
-
});
|
24830 |
-
});
|
24831 |
-
jQuery('#new_segment_cancel').click(function () {
|
24832 |
-
MailPoet.Modal.close();
|
24833 |
-
});
|
24834 |
-
});
|
24835 |
-
|
24836 |
-
// register partial template that will contain subscribers data
|
24837 |
-
Handlebars.registerPartial(
|
24838 |
-
'subscribers_data_template_partial',
|
24839 |
-
subscribersDataTemplatePartial
|
24840 |
-
);
|
24841 |
-
|
24842 |
-
// autodetect column types
|
24843 |
-
Handlebars.registerHelper(
|
24844 |
-
'show_and_match_columns',
|
24845 |
-
function (helperSubscribers, options) {
|
24846 |
-
var displayedColumns = [];
|
24847 |
-
var displayedColumnsIds = [];
|
24848 |
-
var columnData;
|
24849 |
-
var columnId;
|
24850 |
-
var headerName;
|
24851 |
-
var headerNameMatch;
|
24852 |
-
// go through all elements of the first row in subscribers data
|
24853 |
-
Object
|
24854 |
-
.keys(helperSubscribers.subscribers[0])
|
24855 |
-
.forEach(function helperSubscribersLoop(i) {
|
24856 |
-
columnData = helperSubscribers.subscribers[0][i];
|
24857 |
-
columnId = 'ignore'; // set default column type
|
24858 |
-
// if the column is not undefined and has a valid e-mail, set type as email
|
24859 |
-
if (columnData % 1 !== 0 && window.mailpoet_email_regex.test(columnData)) {
|
24860 |
-
columnId = 'email';
|
24861 |
-
} else if (helperSubscribers.header) {
|
24862 |
-
headerName = helperSubscribers.header[i];
|
24863 |
-
headerNameMatch = window.mailpoetColumns.map(function (el) {
|
24864 |
-
return el.name;
|
24865 |
-
}).indexOf(headerName);
|
24866 |
-
// set column type using header
|
24867 |
-
if (headerNameMatch !== -1) {
|
24868 |
-
columnId = window.mailpoetColumns[headerNameMatch].id;
|
24869 |
-
} else if (headerName) { // set column type using header name
|
24870 |
-
if (/first|first name|given name/i.test(headerName)) {
|
24871 |
-
columnId = 'first_name';
|
24872 |
-
} else if (/last|last name/i.test(headerName)) {
|
24873 |
-
columnId = 'last_name';
|
24874 |
-
}
|
24875 |
-
}
|
24876 |
-
}
|
24877 |
-
// make sure the column id has not been previously selected
|
24878 |
-
// (e.g., subscriber_first_name shouldn't be autodetected twice),
|
24879 |
-
// except for "ignore"
|
24880 |
-
columnId =
|
24881 |
-
(columnId !== 'ignore'
|
24882 |
-
&& displayedColumnsIds.indexOf(columnId) === -1)
|
24883 |
-
? columnId
|
24884 |
-
: 'ignore';
|
24885 |
-
displayedColumns[i] = { column_id: columnId };
|
24886 |
-
displayedColumnsIds.push(columnId);
|
24887 |
-
});
|
24888 |
-
return options.fn(displayedColumns);
|
24889 |
-
});
|
24890 |
-
|
24891 |
-
// sanitize unsafe data
|
24892 |
-
Handlebars.registerHelper('sanitize_data', function (data) {
|
24893 |
-
return (data instanceof Handlebars.SafeString) ?
|
24894 |
-
data :
|
24895 |
-
new Handlebars.SafeString(Handlebars.Utils.escapeExpression(data));
|
24896 |
-
});
|
24897 |
-
|
24898 |
-
// start array index from 1
|
24899 |
-
Handlebars.registerHelper('calculate_index', function (rawIndex) {
|
24900 |
-
var index = parseInt(rawIndex, 10);
|
24901 |
-
// display filler data (e.g., ellipsis) if we've reached the maximum number of rows and
|
24902 |
-
// subscribers count is greater than the maximum number of rows we're displaying
|
24903 |
-
if (index === maxRowsToShow && subscribers.subscribersCount > (maxRowsToShow + 1)) {
|
24904 |
-
fillerPosition = index;
|
24905 |
-
return filler;
|
24906 |
-
} else if (index === (subscribers.subscribers.length - 1)) {
|
24907 |
-
// if we're on the last line, show the total count of subscribers data
|
24908 |
-
return subscribers.subscribersCount.toLocaleString();
|
24909 |
-
}
|
24910 |
-
return index + 1;
|
24911 |
-
});
|
24912 |
-
|
24913 |
-
// reduce subscribers object if the total length is greater than the
|
24914 |
-
// maximum number of defined rows
|
24915 |
-
if (subscribers.subscribersCount > (maxRowsToShow + 1)) {
|
24916 |
-
subscribers.subscribers.splice(
|
24917 |
-
maxRowsToShow, subscribers.subscribersCount - (maxRowsToShow + 1),
|
24918 |
-
fillerArray
|
24919 |
-
);
|
24920 |
-
}
|
24921 |
-
|
24922 |
-
// filter subscribers' data to detect dates, emails, etc.
|
24923 |
-
function filterSubscribers() {
|
24924 |
-
var subscribersClone = jQuery.extend(true, {}, subscribers);
|
24925 |
-
var preventNextStep = false;
|
24926 |
-
var displayedColumns;
|
24927 |
-
jQuery(
|
24928 |
-
'[data-id="notice_invalidEmail"], [data-id="notice_invalidDate"]')
|
24929 |
-
.remove();
|
24930 |
-
displayedColumns = jQuery.map(
|
24931 |
-
jQuery('.mailpoet_subscribers_column_data_match'), function (element, elementIndex) {
|
24932 |
-
var columnId = jQuery(element).data('column-id');
|
24933 |
-
var validationRule = jQuery(element).data('validation-rule');
|
24934 |
-
jQuery(element).val(columnId).trigger('change');
|
24935 |
-
return {
|
24936 |
-
id: columnId,
|
24937 |
-
index: elementIndex,
|
24938 |
-
validationRule: validationRule,
|
24939 |
-
element: element
|
24940 |
-
};
|
24941 |
-
});
|
24942 |
-
// iterate through the object of mailpoet columns
|
24943 |
-
jQuery.map(window.mailpoetColumns, function (column) {
|
24944 |
-
var firstRowData;
|
24945 |
-
var validationRule;
|
24946 |
-
var testedFormat;
|
24947 |
-
var allowedDateFormats;
|
24948 |
-
// check if the column id matches the selected id of one of the
|
24949 |
-
// subscriber's data columns
|
24950 |
-
var matchedColumn = _.find(
|
24951 |
-
displayedColumns,
|
24952 |
-
function (data) { return data.id === column.id; }
|
24953 |
-
);
|
24954 |
-
// EMAIL filter: if the first value in the column doesn't have a valid
|
24955 |
-
// email, hide the next button
|
24956 |
-
if (column.id === 'email') {
|
24957 |
-
if (!window.mailpoet_email_regex.test(
|
24958 |
-
subscribersClone.subscribers[0][matchedColumn.index])
|
24959 |
-
) {
|
24960 |
-
preventNextStep = true;
|
24961 |
-
if (!jQuery('[data-id="notice_invalidEmail"]').length) {
|
24962 |
-
MailPoet.Notice.error(MailPoet.I18n.t('columnContainsInvalidElement'), {
|
24963 |
-
static: true,
|
24964 |
-
scroll: true,
|
24965 |
-
hideClose: true,
|
24966 |
-
id: 'invalidEmail'
|
24967 |
-
});
|
24968 |
-
}
|
24969 |
-
} else {
|
24970 |
-
MailPoet.Notice.hide('invalidEmail');
|
24971 |
-
}
|
24972 |
-
}
|
24973 |
-
// DATE filter: if column type is date, check if we can recognize it
|
24974 |
-
if (column.type === 'date' && matchedColumn) {
|
24975 |
-
allowedDateFormats = [
|
24976 |
-
Moment.ISO_8601,
|
24977 |
-
'YYYY/MM/DD',
|
24978 |
-
'MM/DD/YYYY',
|
24979 |
-
'DD/MM/YYYY',
|
24980 |
-
'YYYY/MM/DD',
|
24981 |
-
'YYYY/DD/MM',
|
24982 |
-
'MM/YYYY',
|
24983 |
-
'YYYY/MM',
|
24984 |
-
'YYYY'
|
24985 |
-
];
|
24986 |
-
firstRowData = subscribersClone.subscribers[0][matchedColumn.index];
|
24987 |
-
validationRule = false;
|
24988 |
-
// check if date exists
|
24989 |
-
if (firstRowData.trim() === '') {
|
24990 |
-
subscribersClone.subscribers[0][matchedColumn.index] =
|
24991 |
-
'<span class="mailpoet_data_match mailpoet_import_error" title="'
|
24992 |
-
+ MailPoet.I18n.t('noDateFieldMatch') + '">'
|
24993 |
-
+ MailPoet.I18n.t('emptyFirstRowDate')
|
24994 |
-
+ '</span> ';
|
24995 |
-
preventNextStep = true;
|
24996 |
-
} else {
|
24997 |
-
Object.keys(allowedDateFormats).forEach(function allowedDateFormatsLoop(format) {
|
24998 |
-
testedFormat = allowedDateFormats[format];
|
24999 |
-
if (Moment(firstRowData, testedFormat, true).isValid()) {
|
25000 |
-
validationRule = (typeof (testedFormat) === 'function') ?
|
25001 |
-
'datetime' :
|
25002 |
-
testedFormat;
|
25003 |
-
// set validation on the column element
|
25004 |
-
jQuery(matchedColumn.element).data('validation-rule', validationRule);
|
25005 |
-
return;
|
25006 |
-
}
|
25007 |
-
if (validationRule === 'datetime') {
|
25008 |
-
validationRule = Moment.ISO_8601;
|
25009 |
-
}
|
25010 |
-
});
|
25011 |
-
}
|
25012 |
-
jQuery.map(subscribersClone.subscribers, function (dataSubscribers, index) {
|
25013 |
-
var data = dataSubscribers;
|
25014 |
-
var rowData = data[matchedColumn.index];
|
25015 |
-
var date = Moment(rowData, testedFormat, true);
|
25016 |
-
if (index === fillerPosition || rowData.trim() === '') return;
|
25017 |
-
// validate date
|
25018 |
-
if (date.isValid()) {
|
25019 |
-
data[matchedColumn.index] = new Handlebars.SafeString(
|
25020 |
-
Handlebars.Utils.escapeExpression(data[matchedColumn.index])
|
25021 |
-
+ '<span class="mailpoet_data_match" title="'
|
25022 |
-
+ MailPoet.I18n.t('verifyDateMatch') + '">'
|
25023 |
-
+ MailPoet.Date.format(date)
|
25024 |
-
+ '</span> '
|
25025 |
-
);
|
25026 |
-
} else {
|
25027 |
-
data[matchedColumn.index] = new Handlebars.SafeString(
|
25028 |
-
Handlebars.Utils.escapeExpression(data[matchedColumn.index])
|
25029 |
-
+ '<span class="mailpoet_data_match mailpoet_import_error" title="'
|
25030 |
-
+ MailPoet.I18n.t('noDateFieldMatch') + '">'
|
25031 |
-
+ (new Handlebars.SafeString(MailPoet.I18n.t('dateMatchError')))
|
25032 |
-
+ '</span> '
|
25033 |
-
);
|
25034 |
-
preventNextStep = true;
|
25035 |
-
}
|
25036 |
-
});
|
25037 |
-
if (preventNextStep && !jQuery('.mailpoet_invalidDate').length) {
|
25038 |
-
MailPoet.Notice.error(MailPoet.I18n.t('columnContainsInvalidDate'), {
|
25039 |
-
static: true,
|
25040 |
-
scroll: true,
|
25041 |
-
hideClose: true,
|
25042 |
-
id: 'invalidDate'
|
25043 |
-
});
|
25044 |
-
}
|
25045 |
-
}
|
25046 |
-
});
|
25047 |
-
// refresh table with susbcribers' data
|
25048 |
-
jQuery('#subscribers_data > table > tbody')
|
25049 |
-
.html(subscribersDataTemplatePartial(subscribersClone));
|
25050 |
-
|
25051 |
-
if (preventNextStep) {
|
25052 |
-
toggleNextStepButton('off');
|
25053 |
-
} else if (!jQuery('.mailpoet_notice.error:visible').length
|
25054 |
-
&& segmentSelectElement.val()) {
|
25055 |
-
toggleNextStepButton('on');
|
25056 |
-
}
|
25057 |
-
}
|
25058 |
-
|
25059 |
-
// render template
|
25060 |
-
jQuery('#subscribers_data > table').html(subscribersDataTemplate(subscribers));
|
25061 |
-
|
25062 |
-
// filter displayed data
|
25063 |
-
jQuery('select.mailpoet_subscribers_column_data_match')
|
25064 |
-
.select2({
|
25065 |
-
data: window.mailpoetColumnsSelect2,
|
25066 |
-
width: '15em',
|
25067 |
-
templateResult: function (item) {
|
25068 |
-
return item.name;
|
25069 |
-
},
|
25070 |
-
templateSelection: function (item) {
|
25071 |
-
return item.name;
|
25072 |
-
}
|
25073 |
-
})
|
25074 |
-
.on('select2:selecting', function (selectEvent) {
|
25075 |
-
var selectElement = this;
|
25076 |
-
var selectedOptionId = selectEvent.params.args.data.id;
|
25077 |
-
// CREATE CUSTOM FIELD
|
25078 |
-
if (selectedOptionId === 'create') {
|
25079 |
-
selectEvent.preventDefault();
|
25080 |
-
jQuery(selectElement).select2('close');
|
25081 |
-
MailPoet.Modal.popup({
|
25082 |
-
title: MailPoet.I18n.t('addNewField'),
|
25083 |
-
template: jQuery('#form_template_field_form').html()
|
25084 |
-
});
|
25085 |
-
jQuery('#form_field_new').parsley().on('form:submit', function () {
|
25086 |
-
// get data
|
25087 |
-
var data = jQuery(this.$element).mailpoetSerializeObject();
|
25088 |
-
|
25089 |
-
// save custom field
|
25090 |
-
MailPoet.Ajax.post({
|
25091 |
-
api_version: window.mailpoet_api_version,
|
25092 |
-
endpoint: 'customFields',
|
25093 |
-
action: 'save',
|
25094 |
-
data: data
|
25095 |
-
}).done(function (response) {
|
25096 |
-
var newColumnData = {
|
25097 |
-
id: response.data.id,
|
25098 |
-
name: response.data.name,
|
25099 |
-
type: response.data.type,
|
25100 |
-
params: response.data.params,
|
25101 |
-
custom: true
|
25102 |
-
};
|
25103 |
-
// if this is the first custom column, create an "optgroup"
|
25104 |
-
if (window.mailpoetColumnsSelect2.length === 2) {
|
25105 |
-
window.mailpoetColumnsSelect2.push({
|
25106 |
-
name: MailPoet.I18n.t('userColumns'),
|
25107 |
-
children: []
|
25108 |
-
});
|
25109 |
-
}
|
25110 |
-
window.mailpoetColumnsSelect2[2].children.push(newColumnData);
|
25111 |
-
window.mailpoetColumns.push(newColumnData);
|
25112 |
-
jQuery('select.mailpoet_subscribers_column_data_match')
|
25113 |
-
.each(function () {
|
25114 |
-
jQuery(this)
|
25115 |
-
.html('')
|
25116 |
-
.select2('destroy')
|
25117 |
-
.select2({
|
25118 |
-
data: window.mailpoetColumnsSelect2,
|
25119 |
-
width: '15em',
|
25120 |
-
templateResult: function (item) {
|
25121 |
-
return item.name;
|
25122 |
-
},
|
25123 |
-
templateSelection: function (item) {
|
25124 |
-
return item.name;
|
25125 |
-
}
|
25126 |
-
});
|
25127 |
-
});
|
25128 |
-
jQuery(selectElement).data('column-id', newColumnData.id);
|
25129 |
-
jQuery(selectElement).data('validation-rule', false);
|
25130 |
-
filterSubscribers();
|
25131 |
-
// close popup
|
25132 |
-
MailPoet.Modal.close();
|
25133 |
-
}).fail(function (response) {
|
25134 |
-
if (response.errors.length > 0) {
|
25135 |
-
MailPoet.Notice.error(
|
25136 |
-
response.errors.map(function (error) { return error.message; }),
|
25137 |
-
{ positionAfter: '#field_name' }
|
25138 |
-
);
|
25139 |
-
}
|
25140 |
-
});
|
25141 |
-
return false;
|
25142 |
-
});
|
25143 |
-
} else {
|
25144 |
-
// CHANGE COLUMN
|
25145 |
-
// check for duplicate values in all select options
|
25146 |
-
jQuery('select.mailpoet_subscribers_column_data_match')
|
25147 |
-
.each(function () {
|
25148 |
-
var element = this;
|
25149 |
-
var elementId = jQuery(element).val();
|
25150 |
-
// if another column has the same value and it's not an 'ignore',
|
25151 |
-
// prompt user
|
25152 |
-
if (elementId === selectedOptionId
|
25153 |
-
&& elementId !== 'ignore') {
|
25154 |
-
if (confirm(MailPoet.I18n.t('selectedValueAlreadyMatched') + ' ' + MailPoet.I18n.t('confirmCorrespondingColumn'))) { // eslint-disable-line no-alert
|
25155 |
-
jQuery(element).data('column-id', 'ignore');
|
25156 |
-
} else {
|
25157 |
-
selectEvent.preventDefault();
|
25158 |
-
jQuery(selectElement).select2('close');
|
25159 |
-
}
|
25160 |
-
}
|
25161 |
-
});
|
25162 |
-
}
|
25163 |
-
})
|
25164 |
-
.on('select2:select', function (selectEvent) {
|
25165 |
-
var selectElement = this;
|
25166 |
-
var selectedOptionId = selectEvent.params.data.id;
|
25167 |
-
jQuery(selectElement).data('column-id', selectedOptionId);
|
25168 |
-
filterSubscribers();
|
25169 |
-
});
|
25170 |
-
|
25171 |
-
previousStepButton.off().on('click', function () {
|
25172 |
-
router.navigate('step1', { trigger: true });
|
25173 |
-
});
|
25174 |
-
|
25175 |
-
nextStepButton.off().on('click', function () {
|
25176 |
-
var columns = {};
|
25177 |
-
var queue = new jQuery.AsyncQueue();
|
25178 |
-
var batchNumber = 0;
|
25179 |
-
var batchSize = 2000;
|
25180 |
-
var timestamp = Date.now() / 1000;
|
25181 |
-
var clickImportResults = {
|
25182 |
-
created: 0,
|
25183 |
-
updated: 0,
|
25184 |
-
errors: [],
|
25185 |
-
segments: []
|
25186 |
-
};
|
25187 |
-
var clickSubscribers;
|
25188 |
-
var splitSubscribers;
|
25189 |
-
|
25190 |
-
if (jQuery(this).hasClass('button-disabled')) {
|
25191 |
-
return;
|
25192 |
-
}
|
25193 |
-
MailPoet.Modal.loading(true);
|
25194 |
-
splitSubscribers = function (localSubscribers, size) {
|
25195 |
-
return localSubscribers.reduce(function (res, item, index) {
|
25196 |
-
if (index % size === 0) {
|
25197 |
-
res.push([]);
|
25198 |
-
}
|
25199 |
-
res[res.length - 1].push(item);
|
25200 |
-
return res;
|
25201 |
-
}, []);
|
25202 |
-
};
|
25203 |
-
clickSubscribers = splitSubscribers(window.importData.step1.subscribers, batchSize);
|
25204 |
-
|
25205 |
-
_.each(jQuery('select.mailpoet_subscribers_column_data_match'),
|
25206 |
-
function (column, columnIndex) {
|
25207 |
-
var columnId = jQuery(column).data('column-id');
|
25208 |
-
var validationRule = jQuery(column).data('validation-rule');
|
25209 |
-
if (columnId === 'ignore') {
|
25210 |
-
return;
|
25211 |
-
}
|
25212 |
-
columns[columnId] = { index: columnIndex, validation_rule: validationRule };
|
25213 |
-
});
|
25214 |
-
|
25215 |
-
_.each(clickSubscribers, function () {
|
25216 |
-
queue.add(function (addQueue) {
|
25217 |
-
addQueue.pause();
|
25218 |
-
MailPoet.Ajax.post({
|
25219 |
-
api_version: window.mailpoet_api_version,
|
25220 |
-
endpoint: 'ImportExport',
|
25221 |
-
action: 'processImport',
|
25222 |
-
data: JSON.stringify({
|
25223 |
-
columns: columns,
|
25224 |
-
subscribers: clickSubscribers[batchNumber],
|
25225 |
-
timestamp: timestamp,
|
25226 |
-
segments: segmentSelectElement.val(),
|
25227 |
-
updateSubscribers: (jQuery(':radio[name="subscriber_update_option"]:checked').val() === 'yes')
|
25228 |
-
})
|
25229 |
-
}).done(function (response) {
|
25230 |
-
clickImportResults.created += response.data.created;
|
25231 |
-
clickImportResults.updated += response.data.updated;
|
25232 |
-
clickImportResults.segments = response.data.segments;
|
25233 |
-
clickImportResults.added_to_segment_with_welcome_notification =
|
25234 |
-
response.data.added_to_segment_with_welcome_notification;
|
25235 |
-
addQueue.run();
|
25236 |
-
}).fail(function (response) {
|
25237 |
-
MailPoet.Modal.loading(false);
|
25238 |
-
if (response.errors.length > 0) {
|
25239 |
-
MailPoet.Notice.error(
|
25240 |
-
response.errors.map(function (error) { return error.message; }),
|
25241 |
-
{ scroll: true }
|
25242 |
-
);
|
25243 |
-
}
|
25244 |
-
});
|
25245 |
-
batchNumber += 1;
|
25246 |
-
});
|
25247 |
-
});
|
25248 |
-
|
25249 |
-
queue.run();
|
25250 |
-
|
25251 |
-
queue.onComplete(function () {
|
25252 |
-
MailPoet.Modal.loading(false);
|
25253 |
-
if (
|
25254 |
-
clickImportResults.errors.length > 0
|
25255 |
-
&& !clickImportResults.updated
|
25256 |
-
&& !clickImportResults.created
|
25257 |
-
) {
|
25258 |
-
MailPoet.Notice.error(_.flatten(clickImportResults.errors)
|
25259 |
-
);
|
25260 |
-
} else {
|
25261 |
-
window.mailpoetSegments = clickImportResults.segments;
|
25262 |
-
clickImportResults.segments = _.map(segmentSelectElement.select2('data'),
|
25263 |
-
function (data) {
|
25264 |
-
return data.name;
|
25265 |
-
});
|
25266 |
-
window.importData.step2 = clickImportResults;
|
25267 |
-
enableSegmentSelection(window.mailpoetSegments);
|
25268 |
-
router.navigate('step3', { trigger: true });
|
25269 |
-
}
|
25270 |
-
});
|
25271 |
-
});
|
25272 |
-
|
25273 |
-
filterSubscribers();
|
25274 |
-
enableSegmentSelection(window.mailpoetSegments);
|
25275 |
-
});
|
25276 |
-
|
25277 |
-
router.on('route:step3', function () {
|
25278 |
-
var subscribersDataImportResultsTemplate;
|
25279 |
-
var exportMenuElement;
|
25280 |
-
var importResults;
|
25281 |
-
if (typeof (window.importData.step2) === 'undefined') {
|
25282 |
-
router.navigate('step2', { trigger: true });
|
25283 |
-
return;
|
25284 |
-
}
|
25285 |
-
|
25286 |
-
showCurrentStep();
|
25287 |
-
|
25288 |
-
if (window.importData.step2.errors.length > 0) {
|
25289 |
-
MailPoet.Notice.error(_.flatten(window.importData.step2.errors));
|
25290 |
-
}
|
25291 |
-
|
25292 |
-
MailPoet.trackEvent('Subscribers import finished', {
|
25293 |
-
'Subscribers created': window.importData.step2.created,
|
25294 |
-
'Subscribers updated': window.importData.step2.updated,
|
25295 |
-
'MailPoet Free version': window.mailpoet_version
|
25296 |
-
});
|
25297 |
-
|
25298 |
-
// display statistics
|
25299 |
-
subscribersDataImportResultsTemplate =
|
25300 |
-
Handlebars.compile(jQuery('#subscribers_data_import_results_template').html());
|
25301 |
-
exportMenuElement = jQuery('span.mailpoet_export');
|
25302 |
-
importResults = {
|
25303 |
-
created: (window.importData.step2.created)
|
25304 |
-
? MailPoet.I18n.t('subscribersCreated')
|
25305 |
-
.replace('%1$s', '<strong>' + window.importData.step2.created.toLocaleString() + '</strong>')
|
25306 |
-
.replace('%2$s', '"' + window.importData.step2.segments.join('", "') + '"')
|
25307 |
-
: false,
|
25308 |
-
updated: (window.importData.step2.updated)
|
25309 |
-
? MailPoet.I18n.t('subscribersUpdated')
|
25310 |
-
.replace('%1$s', '<strong>' + window.importData.step2.updated.toLocaleString() + '</strong>')
|
25311 |
-
.replace('%2$s', '"' + window.importData.step2.segments.join('", "') + '"')
|
25312 |
-
: false,
|
25313 |
-
no_action: (!window.importData.step2.created && !window.importData.step2.updated),
|
25314 |
-
added_to_segment_with_welcome_notification:
|
25315 |
-
window.importData.step2.added_to_segment_with_welcome_notification
|
25316 |
-
};
|
25317 |
-
|
25318 |
-
jQuery('#subscribers_data_import_results')
|
25319 |
-
.html(subscribersDataImportResultsTemplate(importResults))
|
25320 |
-
.show();
|
25321 |
-
|
25322 |
-
jQuery('a.mailpoet_import_again').off().click(function () {
|
25323 |
-
jQuery('#subscribers_data_import_results').hide();
|
25324 |
-
router.navigate('step1', { trigger: true });
|
25325 |
-
});
|
25326 |
-
|
25327 |
-
jQuery('a.mailpoet_view_subscribers').off().click(function () {
|
25328 |
-
window.location.href = 'admin.php?page=mailpoet-subscribers';
|
25329 |
-
});
|
25330 |
-
|
25331 |
-
// if new subscribers were created and the export menu item is hidden
|
25332 |
-
// (it's shown only when there are subscribers), display it
|
25333 |
-
if (importResults.created && exportMenuElement.not(':visible')) {
|
25334 |
-
exportMenuElement.show();
|
25335 |
-
}
|
25336 |
-
|
25337 |
-
// reset previous step's data so that coming back to this step is prevented
|
25338 |
-
window.importData.step2 = undefined;
|
25339 |
-
});
|
25340 |
-
|
25341 |
-
if (!Backbone.History.started) {
|
25342 |
-
Backbone.history.start();
|
25343 |
-
}
|
25344 |
-
});
|
25345 |
-
}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
25346 |
-
|
25347 |
-
|
25348 |
-
/***/ },
|
25349 |
-
|
25350 |
-
/***/ 580:
|
25351 |
-
/***/ function(module, exports) {
|
25352 |
-
|
25353 |
-
/*!
|
25354 |
-
Papa Parse
|
25355 |
-
v4.1.1
|
25356 |
-
https://github.com/mholt/PapaParse
|
25357 |
-
*/
|
25358 |
-
!function(e){"use strict";function t(t,r){if(r=r||{},r.worker&&w.WORKERS_SUPPORTED){var n=h();return n.userStep=r.step,n.userChunk=r.chunk,n.userComplete=r.complete,n.userError=r.error,r.step=m(r.step),r.chunk=m(r.chunk),r.complete=m(r.complete),r.error=m(r.error),delete r.worker,void n.postMessage({input:t,config:r,workerId:n.id})}var o=null;return"string"==typeof t?o=r.download?new i(r):new a(r):(e.File&&t instanceof File||t instanceof Object)&&(o=new s(r)),o.stream(t)}function r(e,t){function r(){"object"==typeof t&&("string"==typeof t.delimiter&&1==t.delimiter.length&&-1==w.BAD_DELIMITERS.indexOf(t.delimiter)&&(u=t.delimiter),("boolean"==typeof t.quotes||t.quotes instanceof Array)&&(o=t.quotes),"string"==typeof t.newline&&(f=t.newline))}function n(e){if("object"!=typeof e)return[];var t=[];for(var r in e)t.push(r);return t}function i(e,t){var r="";"string"==typeof e&&(e=JSON.parse(e)),"string"==typeof t&&(t=JSON.parse(t));var n=e instanceof Array&&e.length>0,i=!(t[0]instanceof Array);if(n){for(var a=0;a<e.length;a++)a>0&&(r+=u),r+=s(e[a],a);t.length>0&&(r+=f)}for(var o=0;o<t.length;o++){for(var h=n?e.length:t[o].length,d=0;h>d;d++){d>0&&(r+=u);var c=n&&i?e[d]:d;r+=s(t[o][c],d)}o<t.length-1&&(r+=f)}return r}function s(e,t){if("undefined"==typeof e||null===e)return"";e=e.toString().replace(/"/g,'""');var r="boolean"==typeof o&&o||o instanceof Array&&o[t]||a(e,w.BAD_DELIMITERS)||e.indexOf(u)>-1||" "==e.charAt(0)||" "==e.charAt(e.length-1);return r?'"'+e+'"':e}function a(e,t){for(var r=0;r<t.length;r++)if(e.indexOf(t[r])>-1)return!0;return!1}var o=!1,u=",",f="\r\n";if(r(),"string"==typeof e&&(e=JSON.parse(e)),e instanceof Array){if(!e.length||e[0]instanceof Array)return i(null,e);if("object"==typeof e[0])return i(n(e[0]),e)}else if("object"==typeof e)return"string"==typeof e.data&&(e.data=JSON.parse(e.data)),e.data instanceof Array&&(e.fields||(e.fields=e.data[0]instanceof Array?e.fields:n(e.data[0])),e.data[0]instanceof Array||"object"==typeof e.data[0]||(e.data=[e.data])),i(e.fields||[],e.data||[]);throw"exception: Unable to serialize unrecognized input"}function n(t){function r(e){var t=_(e);t.chunkSize=parseInt(t.chunkSize),this._handle=new o(t),this._handle.streamer=this,this._config=t}this._handle=null,this._paused=!1,this._finished=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this._completeResults={data:[],errors:[],meta:{}},r.call(this,t),this.parseChunk=function(t){var r=this._partialLine+t;this._partialLine="";var n=this._handle.parse(r,this._baseIndex,!this._finished);if(!this._handle.paused()&&!this._handle.aborted()){var i=n.meta.cursor;this._finished||(this._partialLine=r.substring(i-this._baseIndex),this._baseIndex=i),n&&n.data&&(this._rowCount+=n.data.length);var s=this._finished||this._config.preview&&this._rowCount>=this._config.preview;if(k)e.postMessage({results:n,workerId:w.WORKER_ID,finished:s});else if(m(this._config.chunk)){if(this._config.chunk(n,this._handle),this._paused)return;n=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(n.data),this._completeResults.errors=this._completeResults.errors.concat(n.errors),this._completeResults.meta=n.meta),!s||!m(this._config.complete)||n&&n.meta.aborted||this._config.complete(this._completeResults),s||n&&n.meta.paused||this._nextChunk(),n}},this._sendError=function(t){m(this._config.error)?this._config.error(t):k&&this._config.error&&e.postMessage({workerId:w.WORKER_ID,error:t,finished:!1})}}function i(e){function t(e){var t=e.getResponseHeader("Content-Range");return parseInt(t.substr(t.lastIndexOf("/")+1))}e=e||{},e.chunkSize||(e.chunkSize=w.RemoteChunkSize),n.call(this,e);var r;this._nextChunk=k?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(e){this._input=e,this._nextChunk()},this._readChunk=function(){if(this._finished)return void this._chunkLoaded();if(r=new XMLHttpRequest,k||(r.onload=g(this._chunkLoaded,this),r.onerror=g(this._chunkError,this)),r.open("GET",this._input,!k),this._config.chunkSize){var e=this._start+this._config.chunkSize-1;r.setRequestHeader("Range","bytes="+this._start+"-"+e),r.setRequestHeader("If-None-Match","webkit-no-cache")}try{r.send()}catch(t){this._chunkError(t.message)}k&&0==r.status?this._chunkError():this._start+=this._config.chunkSize},this._chunkLoaded=function(){if(4==r.readyState){if(r.status<200||r.status>=400)return void this._chunkError();this._finished=!this._config.chunkSize||this._start>t(r),this.parseChunk(r.responseText)}},this._chunkError=function(e){var t=r.statusText||e;this._sendError(t)}}function s(e){e=e||{},e.chunkSize||(e.chunkSize=w.LocalChunkSize),n.call(this,e);var t,r,i="undefined"!=typeof FileReader;this.stream=function(e){this._input=e,r=e.slice||e.webkitSlice||e.mozSlice,i?(t=new FileReader,t.onload=g(this._chunkLoaded,this),t.onerror=g(this._chunkError,this)):t=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var e=this._input;if(this._config.chunkSize){var n=Math.min(this._start+this._config.chunkSize,this._input.size);e=r.call(e,this._start,n)}var s=t.readAsText(e,this._config.encoding);i||this._chunkLoaded({target:{result:s}})},this._chunkLoaded=function(e){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(e.target.result)},this._chunkError=function(){this._sendError(t.error)}}function a(e){e=e||{},n.call(this,e);var t,r;this.stream=function(e){return t=e,r=e,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var e=this._config.chunkSize,t=e?r.substr(0,e):r;return r=e?r.substr(e):"",this._finished=!r,this.parseChunk(t)}}}function o(e){function t(){if(b&&c&&(f("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+w.DefaultDelimiter+"'"),c=!1),e.skipEmptyLines)for(var t=0;t<b.data.length;t++)1==b.data[t].length&&""==b.data[t][0]&&b.data.splice(t--,1);return r()&&n(),i()}function r(){return e.header&&0==y.length}function n(){if(b){for(var e=0;r()&&e<b.data.length;e++)for(var t=0;t<b.data[e].length;t++)y.push(b.data[e][t]);b.data.splice(0,1)}}function i(){if(!b||!e.header&&!e.dynamicTyping)return b;for(var t=0;t<b.data.length;t++){for(var r={},n=0;n<b.data[t].length;n++){if(e.dynamicTyping){var i=b.data[t][n];b.data[t][n]="true"==i||"TRUE"==i?!0:"false"==i||"FALSE"==i?!1:o(i)}e.header&&(n>=y.length?(r.__parsed_extra||(r.__parsed_extra=[]),r.__parsed_extra.push(b.data[t][n])):r[y[n]]=b.data[t][n])}e.header&&(b.data[t]=r,n>y.length?f("FieldMismatch","TooManyFields","Too many fields: expected "+y.length+" fields but parsed "+n,t):n<y.length&&f("FieldMismatch","TooFewFields","Too few fields: expected "+y.length+" fields but parsed "+n,t))}return e.header&&b.meta&&(b.meta.fields=y),b}function s(t){for(var r,n,i,s=[","," ","|",";",w.RECORD_SEP,w.UNIT_SEP],a=0;a<s.length;a++){var o=s[a],f=0,h=0;i=void 0;for(var d=new u({delimiter:o,preview:10}).parse(t),c=0;c<d.data.length;c++){var l=d.data[c].length;h+=l,"undefined"!=typeof i?l>1&&(f+=Math.abs(l-i),i=l):i=l}h/=d.data.length,("undefined"==typeof n||n>f)&&h>1.99&&(n=f,r=o)}return e.delimiter=r,{successful:!!r,bestDelimiter:r}}function a(e){e=e.substr(0,1048576);var t=e.split("\r");if(1==t.length)return"\n";for(var r=0,n=0;n<t.length;n++)"\n"==t[n][0]&&r++;return r>=t.length/2?"\r\n":"\r"}function o(e){var t=l.test(e);return t?parseFloat(e):e}function f(e,t,r,n){b.errors.push({type:e,code:t,message:r,row:n})}var h,d,c,l=/^\s*-?(\d*\.?\d+|\d+\.?\d*)(e[-+]?\d+)?\s*$/i,p=this,g=0,v=!1,k=!1,y=[],b={data:[],errors:[],meta:{}};if(m(e.step)){var R=e.step;e.step=function(n){if(b=n,r())t();else{if(t(),0==b.data.length)return;g+=n.data.length,e.preview&&g>e.preview?d.abort():R(b,p)}}}this.parse=function(r,n,i){if(e.newline||(e.newline=a(r)),c=!1,!e.delimiter){var o=s(r);o.successful?e.delimiter=o.bestDelimiter:(c=!0,e.delimiter=w.DefaultDelimiter),b.meta.delimiter=e.delimiter}var f=_(e);return e.preview&&e.header&&f.preview++,h=r,d=new u(f),b=d.parse(h,n,i),t(),v?{meta:{paused:!0}}:b||{meta:{paused:!1}}},this.paused=function(){return v},this.pause=function(){v=!0,d.abort(),h=h.substr(d.getCharIndex())},this.resume=function(){v=!1,p.streamer.parseChunk(h)},this.aborted=function(){return k},this.abort=function(){k=!0,d.abort(),b.meta.aborted=!0,m(e.complete)&&e.complete(b),h=""}}function u(e){e=e||{};var t=e.delimiter,r=e.newline,n=e.comments,i=e.step,s=e.preview,a=e.fastMode;if(("string"!=typeof t||w.BAD_DELIMITERS.indexOf(t)>-1)&&(t=","),n===t)throw"Comment character same as delimiter";n===!0?n="#":("string"!=typeof n||w.BAD_DELIMITERS.indexOf(n)>-1)&&(n=!1),"\n"!=r&&"\r"!=r&&"\r\n"!=r&&(r="\n");var o=0,u=!1;this.parse=function(e,f,h){function d(e){b.push(e),S=o}function c(t){return h?p():(t||(t=e.substr(o)),w.push(t),o=g,d(w),y&&_(),p())}function l(t){o=t,d(w),w=[],O=e.indexOf(r,o)}function p(e){return{data:b,errors:R,meta:{delimiter:t,linebreak:r,aborted:u,truncated:!!e,cursor:S+(f||0)}}}function _(){i(p()),b=[],R=[]}if("string"!=typeof e)throw"Input must be a string";var g=e.length,m=t.length,v=r.length,k=n.length,y="function"==typeof i;o=0;var b=[],R=[],w=[],S=0;if(!e)return p();if(a||a!==!1&&-1===e.indexOf('"')){for(var E=e.split(r),C=0;C<E.length;C++){var w=E[C];if(o+=w.length,C!==E.length-1)o+=r.length;else if(h)return p();if(!n||w.substr(0,k)!=n){if(y){if(b=[],d(w.split(t)),_(),u)return p()}else d(w.split(t));if(s&&C>=s)return b=b.slice(0,s),p(!0)}}return p()}for(var x=e.indexOf(t,o),O=e.indexOf(r,o);;)if('"'!=e[o])if(n&&0===w.length&&e.substr(o,k)===n){if(-1==O)return p();o=O+v,O=e.indexOf(r,o),x=e.indexOf(t,o)}else if(-1!==x&&(O>x||-1===O))w.push(e.substring(o,x)),o=x+m,x=e.indexOf(t,o);else{if(-1===O)break;if(w.push(e.substring(o,O)),l(O+v),y&&(_(),u))return p();if(s&&b.length>=s)return p(!0)}else{var I=o;for(o++;;){var I=e.indexOf('"',I+1);if(-1===I)return h||R.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:b.length,index:o}),c();if(I===g-1){var D=e.substring(o,I).replace(/""/g,'"');return c(D)}if('"'!=e[I+1]){if(e[I+1]==t){w.push(e.substring(o,I).replace(/""/g,'"')),o=I+1+m,x=e.indexOf(t,o),O=e.indexOf(r,o);break}if(e.substr(I+1,v)===r){if(w.push(e.substring(o,I).replace(/""/g,'"')),l(I+1+v),x=e.indexOf(t,o),y&&(_(),u))return p();if(s&&b.length>=s)return p(!0);break}}else I++}}return c()},this.abort=function(){u=!0},this.getCharIndex=function(){return o}}function f(){var e=document.getElementsByTagName("script");return e.length?e[e.length-1].src:""}function h(){if(!w.WORKERS_SUPPORTED)return!1;if(!y&&null===w.SCRIPT_PATH)throw new Error("Script path cannot be determined automatically when Papa Parse is loaded asynchronously. You need to set Papa.SCRIPT_PATH manually.");var t=new e.Worker(w.SCRIPT_PATH||v);return t.onmessage=d,t.id=R++,b[t.id]=t,t}function d(e){var t=e.data,r=b[t.workerId],n=!1;if(t.error)r.userError(t.error,t.file);else if(t.results&&t.results.data){var i=function(){n=!0,c(t.workerId,{data:[],errors:[],meta:{aborted:!0}})},s={abort:i,pause:l,resume:l};if(m(r.userStep)){for(var a=0;a<t.results.data.length&&(r.userStep({data:[t.results.data[a]],errors:t.results.errors,meta:t.results.meta},s),!n);a++);delete t.results}else m(r.userChunk)&&(r.userChunk(t.results,s,t.file),delete t.results)}t.finished&&!n&&c(t.workerId,t.results)}function c(e,t){var r=b[e];m(r.userComplete)&&r.userComplete(t),r.terminate(),delete b[e]}function l(){throw"Not implemented."}function p(t){var r=t.data;if("undefined"==typeof w.WORKER_ID&&r&&(w.WORKER_ID=r.workerId),"string"==typeof r.input)e.postMessage({workerId:w.WORKER_ID,results:w.parse(r.input,r.config),finished:!0});else if(e.File&&r.input instanceof File||r.input instanceof Object){var n=w.parse(r.input,r.config);n&&e.postMessage({workerId:w.WORKER_ID,results:n,finished:!0})}}function _(e){if("object"!=typeof e)return e;var t=e instanceof Array?[]:{};for(var r in e)t[r]=_(e[r]);return t}function g(e,t){return function(){e.apply(t,arguments)}}function m(e){return"function"==typeof e}var v,k=!e.document&&!!e.postMessage,y=!1,b={},R=0,w={};if(w.parse=t,w.unparse=r,w.RECORD_SEP=String.fromCharCode(30),w.UNIT_SEP=String.fromCharCode(31),w.BYTE_ORDER_MARK="",w.BAD_DELIMITERS=["\r","\n",'"',w.BYTE_ORDER_MARK],w.WORKERS_SUPPORTED=!!e.Worker,w.SCRIPT_PATH=null,w.LocalChunkSize=10485760,w.RemoteChunkSize=5242880,w.DefaultDelimiter=",",w.Parser=u,w.ParserHandle=o,w.NetworkStreamer=i,w.FileStreamer=s,w.StringStreamer=a,"undefined"!=typeof module&&module.exports?module.exports=w:m(e.define)&&e.define.amd?e.define(function(){return w}):e.Papa=w,e.jQuery){var S=e.jQuery;S.fn.parse=function(t){function r(){if(0==a.length)return void(m(t.complete)&&t.complete());var e=a[0];if(m(t.before)){var r=t.before(e.file,e.inputElem);if("object"==typeof r){if("abort"==r.action)return void n("AbortError",e.file,e.inputElem,r.reason);if("skip"==r.action)return void i();"object"==typeof r.config&&(e.instanceConfig=S.extend(e.instanceConfig,r.config))}else if("skip"==r)return void i()}var s=e.instanceConfig.complete;e.instanceConfig.complete=function(t){m(s)&&s(t,e.file,e.inputElem),i()},w.parse(e.file,e.instanceConfig)}function n(e,r,n,i){m(t.error)&&t.error({name:e},r,n,i)}function i(){a.splice(0,1),r()}var s=t.config||{},a=[];return this.each(function(){var t="INPUT"==S(this).prop("tagName").toUpperCase()&&"file"==S(this).attr("type").toLowerCase()&&e.FileReader;if(!t||!this.files||0==this.files.length)return!0;for(var r=0;r<this.files.length;r++)a.push({file:this.files[r],inputElem:this,instanceConfig:S.extend({},s)})}),r(),this}}k?e.onmessage=p:w.WORKERS_SUPPORTED&&(v=f(),document.body?document.addEventListener("DOMContentLoaded",function(){y=!0},!0):y=!0),i.prototype=Object.create(n.prototype),i.prototype.constructor=i,s.prototype=Object.create(n.prototype),s.prototype.constructor=s,a.prototype=Object.create(a.prototype),a.prototype.constructor=a}("undefined"!=typeof window?window:this);
|
25359 |
-
|
25360 |
-
/***/ },
|
25361 |
-
|
25362 |
-
/***/ 581:
|
25363 |
-
/***/ function(module, exports) {
|
25364 |
-
|
25365 |
-
/*
|
25366 |
-
* This file is part of the jquery plugin "asyncQueue".
|
25367 |
-
*
|
25368 |
-
* (c) Sebastien Roch <roch.sebastien@gmail.com>
|
25369 |
-
*
|
25370 |
-
* For the full copyright and license information, please view the LICENSE
|
25371 |
-
* file that was distributed with this source code.
|
25372 |
-
*/
|
25373 |
-
(function($){
|
25374 |
-
$.AsyncQueue = function() {
|
25375 |
-
var that = this,
|
25376 |
-
queue = [],
|
25377 |
-
failureFunc,
|
25378 |
-
completeFunc,
|
25379 |
-
paused = false,
|
25380 |
-
lastCallbackData,
|
25381 |
-
_run;
|
25382 |
-
|
25383 |
-
_run = function() {
|
25384 |
-
var f = queue.shift();
|
25385 |
-
|
25386 |
-
if (f) {
|
25387 |
-
f.apply(that, [that]);
|
25388 |
-
if (paused === false) {
|
25389 |
-
_run();
|
25390 |
-
}
|
25391 |
-
} else {
|
25392 |
-
if(completeFunc){
|
25393 |
-
completeFunc.apply(that);
|
25394 |
-
}
|
25395 |
-
}
|
25396 |
-
}
|
25397 |
-
|
25398 |
-
this.onFailure = function(func) {
|
25399 |
-
failureFunc = func;
|
25400 |
-
}
|
25401 |
-
|
25402 |
-
this.onComplete = function(func) {
|
25403 |
-
completeFunc = func;
|
25404 |
-
}
|
25405 |
-
|
25406 |
-
this.add = function(func) {
|
25407 |
-
queue.push(func);
|
25408 |
-
return this;
|
25409 |
-
}
|
25410 |
-
|
25411 |
-
this.storeData = function(dataObject) {
|
25412 |
-
lastCallbackData = dataObject;
|
25413 |
-
return this;
|
25414 |
-
}
|
25415 |
-
|
25416 |
-
this.lastCallbackData = function () {
|
25417 |
-
return lastCallbackData;
|
25418 |
-
}
|
25419 |
-
|
25420 |
-
this.run = function() {
|
25421 |
-
paused = false;
|
25422 |
-
_run();
|
25423 |
-
}
|
25424 |
-
|
25425 |
-
this.pause = function () {
|
25426 |
-
paused = true;
|
25427 |
-
return this;
|
25428 |
-
}
|
25429 |
-
|
25430 |
-
this.failure = function() {
|
25431 |
-
paused = true;
|
25432 |
-
if (failureFunc) {
|
25433 |
-
var args = [that];
|
25434 |
-
for(i = 0; i < arguments.length; i++) {
|
25435 |
-
args.push(arguments[i]);
|
25436 |
-
}
|
25437 |
-
failureFunc.apply(that, args);
|
25438 |
-
}
|
25439 |
-
}
|
25440 |
-
|
25441 |
-
return this;
|
25442 |
-
}
|
25443 |
-
})(jQuery);
|
25444 |
-
|
25445 |
-
|
25446 |
-
/***/ },
|
25447 |
-
|
25448 |
-
/***/ 582:
|
25449 |
-
/***/ function(module, exports, __webpack_require__) {
|
25450 |
-
|
25451 |
-
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
|
25452 |
-
__webpack_require__(281),
|
25453 |
-
__webpack_require__(275),
|
25454 |
-
__webpack_require__(276),
|
25455 |
-
__webpack_require__(579)
|
25456 |
-
], __WEBPACK_AMD_DEFINE_RESULT__ = function exportSubscribers(
|
25457 |
-
_,
|
25458 |
-
jQuery,
|
25459 |
-
MailPoet,
|
25460 |
-
Handlebars
|
25461 |
-
) {
|
25462 |
-
if (!jQuery('#mailpoet_subscribers_export').length) {
|
25463 |
-
return;
|
25464 |
-
}
|
25465 |
-
jQuery(document).ready(function documentReady() {
|
25466 |
-
var segmentsContainerElement;
|
25467 |
-
var subscriberFieldsContainerElement;
|
25468 |
-
var nextStepButton;
|
25469 |
-
var renderSegmentsAndFields;
|
25470 |
-
var subscribersExportTemplate;
|
25471 |
-
if (!window.exportData.segments) {
|
25472 |
-
return;
|
25473 |
-
}
|
25474 |
-
subscribersExportTemplate =
|
25475 |
-
Handlebars.compile(jQuery('#mailpoet_subscribers_export_template').html());
|
25476 |
-
|
25477 |
-
// render template
|
25478 |
-
jQuery('#mailpoet_subscribers_export > div.inside').html(subscribersExportTemplate(window.exportData));
|
25479 |
-
|
25480 |
-
function toggleNextStepButton(condition) {
|
25481 |
-
var disabled = 'button-disabled';
|
25482 |
-
if (condition === 'on') {
|
25483 |
-
nextStepButton.removeClass(disabled);
|
25484 |
-
} else {
|
25485 |
-
nextStepButton.addClass(disabled);
|
25486 |
-
}
|
25487 |
-
}
|
25488 |
-
|
25489 |
-
// define reusable variables
|
25490 |
-
segmentsContainerElement = jQuery('#export_lists');
|
25491 |
-
subscriberFieldsContainerElement = jQuery('#export_columns');
|
25492 |
-
nextStepButton = jQuery('a.mailpoet_export_process');
|
25493 |
-
renderSegmentsAndFields = function renderSegmentsFields(container, data) {
|
25494 |
-
if (container.data('select2')) {
|
25495 |
-
container
|
25496 |
-
.html('')
|
25497 |
-
.select2('destroy');
|
25498 |
-
}
|
25499 |
-
container
|
25500 |
-
.select2({
|
25501 |
-
data: data,
|
25502 |
-
width: '20em',
|
25503 |
-
templateResult: function templateResult(item) {
|
25504 |
-
return (item.subscriberCount > 0)
|
25505 |
-
? item.name + ' (' + parseInt(item.subscriberCount, 10).toLocaleString() + ')'
|
25506 |
-
: item.name;
|
25507 |
-
},
|
25508 |
-
templateSelection: function templateSelection(item) {
|
25509 |
-
return (item.subscriberCount > 0)
|
25510 |
-
? item.name + ' (' + parseInt(item.subscriberCount, 10).toLocaleString() + ')'
|
25511 |
-
: item.name;
|
25512 |
-
}
|
25513 |
-
})
|
25514 |
-
.on('select2:selecting', function onSelect2Selecting(selectEvent) {
|
25515 |
-
var selectElement = this;
|
25516 |
-
var selectedOptionId = selectEvent.params.args.data.id;
|
25517 |
-
var fieldsToExclude = [
|
25518 |
-
'select',
|
25519 |
-
'deselect'
|
25520 |
-
];
|
25521 |
-
var allOptions;
|
25522 |
-
if (_.contains(fieldsToExclude, selectedOptionId)) {
|
25523 |
-
selectEvent.preventDefault();
|
25524 |
-
if (selectedOptionId === 'deselect') {
|
25525 |
-
jQuery(selectElement).val('').trigger('change');
|
25526 |
-
} else {
|
25527 |
-
allOptions = [];
|
25528 |
-
_.each(container.find('option'), function eachOption(field) {
|
25529 |
-
if (!_.contains(fieldsToExclude, field.value)) {
|
25530 |
-
allOptions.push(field.value);
|
25531 |
-
}
|
25532 |
-
});
|
25533 |
-
jQuery(selectElement).val(allOptions).trigger('change');
|
25534 |
-
}
|
25535 |
-
jQuery(selectElement).select2('close');
|
25536 |
-
}
|
25537 |
-
})
|
25538 |
-
.on('change', function onCHange() {
|
25539 |
-
if ((window.exportData.segments && segmentsContainerElement.select2('data').length && subscriberFieldsContainerElement.select2('data').length)
|
25540 |
-
||
|
25541 |
-
(!window.exportData.segments && subscriberFieldsContainerElement.select2('data').length)
|
25542 |
-
) {
|
25543 |
-
toggleNextStepButton('on');
|
25544 |
-
} else {
|
25545 |
-
toggleNextStepButton('off');
|
25546 |
-
}
|
25547 |
-
});
|
25548 |
-
};
|
25549 |
-
|
25550 |
-
renderSegmentsAndFields(subscriberFieldsContainerElement, window.subscriberFieldsSelect2);
|
25551 |
-
renderSegmentsAndFields(segmentsContainerElement, window.segments);
|
25552 |
-
|
25553 |
-
subscriberFieldsContainerElement.val([
|
25554 |
-
'email',
|
25555 |
-
'first_name',
|
25556 |
-
'last_name',
|
25557 |
-
'list_status',
|
25558 |
-
'global_status'
|
25559 |
-
]).trigger('change');
|
25560 |
-
|
25561 |
-
nextStepButton.click(function nextClick() {
|
25562 |
-
var exportFormat;
|
25563 |
-
if (jQuery(this).hasClass('button-disabled')) {
|
25564 |
-
return;
|
25565 |
-
}
|
25566 |
-
MailPoet.Modal.loading(true);
|
25567 |
-
exportFormat = jQuery(':radio[name="option_format"]:checked').val();
|
25568 |
-
MailPoet.Ajax.post({
|
25569 |
-
api_version: window.mailpoet_api_version,
|
25570 |
-
endpoint: 'ImportExport',
|
25571 |
-
action: 'processExport',
|
25572 |
-
data: JSON.stringify({
|
25573 |
-
export_format_option: exportFormat,
|
25574 |
-
segments: (window.exportData.segments) ? segmentsContainerElement.val() : false,
|
25575 |
-
subscriber_fields: subscriberFieldsContainerElement.val()
|
25576 |
-
})
|
25577 |
-
}).always(function always() {
|
25578 |
-
MailPoet.Modal.loading(false);
|
25579 |
-
}).done(function done(response) {
|
25580 |
-
var resultMessage = MailPoet.I18n.t('exportMessage')
|
25581 |
-
.replace('%1$s', '<strong>' + parseInt(response.data.totalExported, 133).toLocaleString() + '</strong>')
|
25582 |
-
.replace('[link]', '<a href="' + response.data.exportFileURL + '" target="_blank" >')
|
25583 |
-
.replace('[/link]', '</a>');
|
25584 |
-
jQuery('#export_result_notice').html('<p>' + resultMessage + '</p>').show();
|
25585 |
-
window.location.href = response.data.exportFileURL;
|
25586 |
-
MailPoet.trackEvent('Subscribers export completed', {
|
25587 |
-
'Total exported': response.data.totalExported,
|
25588 |
-
'File Format': exportFormat,
|
25589 |
-
'MailPoet Free version': window.mailpoet_version
|
25590 |
-
});
|
25591 |
-
}).fail(function fail(response) {
|
25592 |
-
if (response.errors.length > 0) {
|
25593 |
-
MailPoet.Notice.error(
|
25594 |
-
response.errors.map(function mapError(error) { return error.message; }),
|
25595 |
-
{ scroll: true }
|
25596 |
-
);
|
25597 |
-
}
|
25598 |
-
});
|
25599 |
-
});
|
25600 |
-
});
|
25601 |
-
}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
25602 |
-
|
25603 |
-
|
25604 |
-
/***/ }
|
25605 |
-
|
25606 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
webpackJsonp([2],{
|
2 |
+
|
3 |
+
/***/ 21:
|
4 |
+
/***/ (function(module, exports) {
|
5 |
+
|
6 |
+
if (typeof Object.create === 'function') {
|
7 |
+
// implementation from standard node.js 'util' module
|
8 |
+
module.exports = function inherits(ctor, superCtor) {
|
9 |
+
ctor.super_ = superCtor
|
10 |
+
ctor.prototype = Object.create(superCtor.prototype, {
|
11 |
+
constructor: {
|
12 |
+
value: ctor,
|
13 |
+
enumerable: false,
|
14 |
+
writable: true,
|
15 |
+
configurable: true
|
16 |
+
}
|
17 |
+
});
|
18 |
+
};
|
19 |
+
} else {
|
20 |
+
// old school shim for old browsers
|
21 |
+
module.exports = function inherits(ctor, superCtor) {
|
22 |
+
ctor.super_ = superCtor
|
23 |
+
var TempCtor = function () {}
|
24 |
+
TempCtor.prototype = superCtor.prototype
|
25 |
+
ctor.prototype = new TempCtor()
|
26 |
+
ctor.prototype.constructor = ctor
|
27 |
+
}
|
28 |
+
}
|
29 |
+
|
30 |
+
|
31 |
+
/***/ }),
|
32 |
+
|
33 |
+
/***/ 226:
|
34 |
+
/***/ (function(module, exports, __webpack_require__) {
|
35 |
+
|
36 |
+
"use strict";
|
37 |
+
|
38 |
+
|
39 |
+
var _react = __webpack_require__(4);
|
40 |
+
|
41 |
+
var _react2 = _interopRequireDefault(_react);
|
42 |
+
|
43 |
+
var _reactTooltip = __webpack_require__(230);
|
44 |
+
|
45 |
+
var _reactTooltip2 = _interopRequireDefault(_reactTooltip);
|
46 |
+
|
47 |
+
var _reactHtmlParser = __webpack_require__(409);
|
48 |
+
|
49 |
+
var _reactHtmlParser2 = _interopRequireDefault(_reactHtmlParser);
|
50 |
+
|
51 |
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
52 |
+
|
53 |
+
function Tooltip(props) {
|
54 |
+
var tooltipId = props.tooltipId;
|
55 |
+
var tooltip = props.tooltip;
|
56 |
+
// tooltip ID must be unique, defaults to tooltip text
|
57 |
+
if (!props.tooltipId && typeof props.tooltip === 'string') {
|
58 |
+
tooltipId = props.tooltip;
|
59 |
+
}
|
60 |
+
|
61 |
+
if (typeof props.tooltip === 'string') {
|
62 |
+
tooltip = _react2.default.createElement(
|
63 |
+
'span',
|
64 |
+
{
|
65 |
+
style: {
|
66 |
+
pointerEvents: 'all',
|
67 |
+
maxWidth: '400px',
|
68 |
+
display: 'inline-block'
|
69 |
+
}
|
70 |
+
},
|
71 |
+
(0, _reactHtmlParser2.default)(props.tooltip)
|
72 |
+
);
|
73 |
+
}
|
74 |
+
|
75 |
+
return _react2.default.createElement(
|
76 |
+
'span',
|
77 |
+
{ className: props.className },
|
78 |
+
_react2.default.createElement('span', {
|
79 |
+
style: {
|
80 |
+
cursor: 'pointer'
|
81 |
+
},
|
82 |
+
className: 'tooltip dashicons dashicons-editor-help',
|
83 |
+
'data-event': 'click',
|
84 |
+
'data-tip': true,
|
85 |
+
'data-for': tooltipId
|
86 |
+
}),
|
87 |
+
_react2.default.createElement(
|
88 |
+
_reactTooltip2.default,
|
89 |
+
{
|
90 |
+
globalEventOff: 'click',
|
91 |
+
multiline: true,
|
92 |
+
id: tooltipId,
|
93 |
+
efect: 'solid',
|
94 |
+
place: props.place
|
95 |
+
},
|
96 |
+
tooltip
|
97 |
+
)
|
98 |
+
);
|
99 |
+
}
|
100 |
+
|
101 |
+
Tooltip.propTypes = {
|
102 |
+
tooltipId: _react2.default.PropTypes.string,
|
103 |
+
tooltip: _react2.default.PropTypes.node.isRequired,
|
104 |
+
place: _react2.default.PropTypes.string,
|
105 |
+
className: _react2.default.PropTypes.string
|
106 |
+
};
|
107 |
+
|
108 |
+
Tooltip.defaultProps = {
|
109 |
+
tooltipId: undefined,
|
110 |
+
place: undefined,
|
111 |
+
className: undefined
|
112 |
+
};
|
113 |
+
|
114 |
+
module.exports = Tooltip;
|
115 |
+
|
116 |
+
/***/ }),
|
117 |
+
|
118 |
+
/***/ 256:
|
119 |
+
/***/ (function(module, exports, __webpack_require__) {
|
120 |
+
|
121 |
+
var Tokenizer = __webpack_require__(257);
|
122 |
+
|
123 |
+
/*
|
124 |
+
Options:
|
125 |
+
|
126 |
+
xmlMode: Disables the special behavior for script/style tags (false by default)
|
127 |
+
lowerCaseAttributeNames: call .toLowerCase for each attribute name (true if xmlMode is `false`)
|
128 |
+
lowerCaseTags: call .toLowerCase for each tag name (true if xmlMode is `false`)
|
129 |
+
*/
|
130 |
+
|
131 |
+
/*
|
132 |
+
Callbacks:
|
133 |
+
|
134 |
+
oncdataend,
|
135 |
+
oncdatastart,
|
136 |
+
onclosetag,
|
137 |
+
oncomment,
|
138 |
+
oncommentend,
|
139 |
+
onerror,
|
140 |
+
onopentag,
|
141 |
+
onprocessinginstruction,
|
142 |
+
onreset,
|
143 |
+
ontext
|
144 |
+
*/
|
145 |
+
|
146 |
+
var formTags = {
|
147 |
+
input: true,
|
148 |
+
option: true,
|
149 |
+
optgroup: true,
|
150 |
+
select: true,
|
151 |
+
button: true,
|
152 |
+
datalist: true,
|
153 |
+
textarea: true
|
154 |
+
};
|
155 |
+
|
156 |
+
var openImpliesClose = {
|
157 |
+
tr : { tr:true, th:true, td:true },
|
158 |
+
th : { th:true },
|
159 |
+
td : { thead:true, th:true, td:true },
|
160 |
+
body : { head:true, link:true, script:true },
|
161 |
+
li : { li:true },
|
162 |
+
p : { p:true },
|
163 |
+
h1 : { p:true },
|
164 |
+
h2 : { p:true },
|
165 |
+
h3 : { p:true },
|
166 |
+
h4 : { p:true },
|
167 |
+
h5 : { p:true },
|
168 |
+
h6 : { p:true },
|
169 |
+
select : formTags,
|
170 |
+
input : formTags,
|
171 |
+
output : formTags,
|
172 |
+
button : formTags,
|
173 |
+
datalist: formTags,
|
174 |
+
textarea: formTags,
|
175 |
+
option : { option:true },
|
176 |
+
optgroup: { optgroup:true }
|
177 |
+
};
|
178 |
+
|
179 |
+
var voidElements = {
|
180 |
+
__proto__: null,
|
181 |
+
area: true,
|
182 |
+
base: true,
|
183 |
+
basefont: true,
|
184 |
+
br: true,
|
185 |
+
col: true,
|
186 |
+
command: true,
|
187 |
+
embed: true,
|
188 |
+
frame: true,
|
189 |
+
hr: true,
|
190 |
+
img: true,
|
191 |
+
input: true,
|
192 |
+
isindex: true,
|
193 |
+
keygen: true,
|
194 |
+
link: true,
|
195 |
+
meta: true,
|
196 |
+
param: true,
|
197 |
+
source: true,
|
198 |
+
track: true,
|
199 |
+
wbr: true,
|
200 |
+
|
201 |
+
//common self closing svg elements
|
202 |
+
path: true,
|
203 |
+
circle: true,
|
204 |
+
ellipse: true,
|
205 |
+
line: true,
|
206 |
+
rect: true,
|
207 |
+
use: true,
|
208 |
+
stop: true,
|
209 |
+
polyline: true,
|
210 |
+
polygon: true
|
211 |
+
};
|
212 |
+
|
213 |
+
var re_nameEnd = /\s|\//;
|
214 |
+
|
215 |
+
function Parser(cbs, options){
|
216 |
+
this._options = options || {};
|
217 |
+
this._cbs = cbs || {};
|
218 |
+
|
219 |
+
this._tagname = "";
|
220 |
+
this._attribname = "";
|
221 |
+
this._attribvalue = "";
|
222 |
+
this._attribs = null;
|
223 |
+
this._stack = [];
|
224 |
+
|
225 |
+
this.startIndex = 0;
|
226 |
+
this.endIndex = null;
|
227 |
+
|
228 |
+
this._lowerCaseTagNames = "lowerCaseTags" in this._options ?
|
229 |
+
!!this._options.lowerCaseTags :
|
230 |
+
!this._options.xmlMode;
|
231 |
+
this._lowerCaseAttributeNames = "lowerCaseAttributeNames" in this._options ?
|
232 |
+
!!this._options.lowerCaseAttributeNames :
|
233 |
+
!this._options.xmlMode;
|
234 |
+
|
235 |
+
if(this._options.Tokenizer) {
|
236 |
+
Tokenizer = this._options.Tokenizer;
|
237 |
+
}
|
238 |
+
this._tokenizer = new Tokenizer(this._options, this);
|
239 |
+
|
240 |
+
if(this._cbs.onparserinit) this._cbs.onparserinit(this);
|
241 |
+
}
|
242 |
+
|
243 |
+
__webpack_require__(21)(Parser, __webpack_require__(54).EventEmitter);
|
244 |
+
|
245 |
+
Parser.prototype._updatePosition = function(initialOffset){
|
246 |
+
if(this.endIndex === null){
|
247 |
+
if(this._tokenizer._sectionStart <= initialOffset){
|
248 |
+
this.startIndex = 0;
|
249 |
+
} else {
|
250 |
+
this.startIndex = this._tokenizer._sectionStart - initialOffset;
|
251 |
+
}
|
252 |
+
}
|
253 |
+
else this.startIndex = this.endIndex + 1;
|
254 |
+
this.endIndex = this._tokenizer.getAbsoluteIndex();
|
255 |
+
};
|
256 |
+
|
257 |
+
//Tokenizer event handlers
|
258 |
+
Parser.prototype.ontext = function(data){
|
259 |
+
this._updatePosition(1);
|
260 |
+
this.endIndex--;
|
261 |
+
|
262 |
+
if(this._cbs.ontext) this._cbs.ontext(data);
|
263 |
+
};
|
264 |
+
|
265 |
+
Parser.prototype.onopentagname = function(name){
|
266 |
+
if(this._lowerCaseTagNames){
|
267 |
+
name = name.toLowerCase();
|
268 |
+
}
|
269 |
+
|
270 |
+
this._tagname = name;
|
271 |
+
|
272 |
+
if(!this._options.xmlMode && name in openImpliesClose) {
|
273 |
+
for(
|
274 |
+
var el;
|
275 |
+
(el = this._stack[this._stack.length - 1]) in openImpliesClose[name];
|
276 |
+
this.onclosetag(el)
|
277 |
+
);
|
278 |
+
}
|
279 |
+
|
280 |
+
if(this._options.xmlMode || !(name in voidElements)){
|
281 |
+
this._stack.push(name);
|
282 |
+
}
|
283 |
+
|
284 |
+
if(this._cbs.onopentagname) this._cbs.onopentagname(name);
|
285 |
+
if(this._cbs.onopentag) this._attribs = {};
|
286 |
+
};
|
287 |
+
|
288 |
+
Parser.prototype.onopentagend = function(){
|
289 |
+
this._updatePosition(1);
|
290 |
+
|
291 |
+
if(this._attribs){
|
292 |
+
if(this._cbs.onopentag) this._cbs.onopentag(this._tagname, this._attribs);
|
293 |
+
this._attribs = null;
|
294 |
+
}
|
295 |
+
|
296 |
+
if(!this._options.xmlMode && this._cbs.onclosetag && this._tagname in voidElements){
|
297 |
+
this._cbs.onclosetag(this._tagname);
|
298 |
+
}
|
299 |
+
|
300 |
+
this._tagname = "";
|
301 |
+
};
|
302 |
+
|
303 |
+
Parser.prototype.onclosetag = function(name){
|
304 |
+
this._updatePosition(1);
|
305 |
+
|
306 |
+
if(this._lowerCaseTagNames){
|
307 |
+
name = name.toLowerCase();
|
308 |
+
}
|
309 |
+
|
310 |
+
if(this._stack.length && (!(name in voidElements) || this._options.xmlMode)){
|
311 |
+
var pos = this._stack.lastIndexOf(name);
|
312 |
+
if(pos !== -1){
|
313 |
+
if(this._cbs.onclosetag){
|
314 |
+
pos = this._stack.length - pos;
|
315 |
+
while(pos--) this._cbs.onclosetag(this._stack.pop());
|
316 |
+
}
|
317 |
+
else this._stack.length = pos;
|
318 |
+
} else if(name === "p" && !this._options.xmlMode){
|
319 |
+
this.onopentagname(name);
|
320 |
+
this._closeCurrentTag();
|
321 |
+
}
|
322 |
+
} else if(!this._options.xmlMode && (name === "br" || name === "p")){
|
323 |
+
this.onopentagname(name);
|
324 |
+
this._closeCurrentTag();
|
325 |
+
}
|
326 |
+
};
|
327 |
+
|
328 |
+
Parser.prototype.onselfclosingtag = function(){
|
329 |
+
if(this._options.xmlMode || this._options.recognizeSelfClosing){
|
330 |
+
this._closeCurrentTag();
|
331 |
+
} else {
|
332 |
+
this.onopentagend();
|
333 |
+
}
|
334 |
+
};
|
335 |
+
|
336 |
+
Parser.prototype._closeCurrentTag = function(){
|
337 |
+
var name = this._tagname;
|
338 |
+
|
339 |
+
this.onopentagend();
|
340 |
+
|
341 |
+
//self-closing tags will be on the top of the stack
|
342 |
+
//(cheaper check than in onclosetag)
|
343 |
+
if(this._stack[this._stack.length - 1] === name){
|
344 |
+
if(this._cbs.onclosetag){
|
345 |
+
this._cbs.onclosetag(name);
|
346 |
+
}
|
347 |
+
this._stack.pop();
|
348 |
+
}
|
349 |
+
};
|
350 |
+
|
351 |
+
Parser.prototype.onattribname = function(name){
|
352 |
+
if(this._lowerCaseAttributeNames){
|
353 |
+
name = name.toLowerCase();
|
354 |
+
}
|
355 |
+
this._attribname = name;
|
356 |
+
};
|
357 |
+
|
358 |
+
Parser.prototype.onattribdata = function(value){
|
359 |
+
this._attribvalue += value;
|
360 |
+
};
|
361 |
+
|
362 |
+
Parser.prototype.onattribend = function(){
|
363 |
+
if(this._cbs.onattribute) this._cbs.onattribute(this._attribname, this._attribvalue);
|
364 |
+
if(
|
365 |
+
this._attribs &&
|
366 |
+
!Object.prototype.hasOwnProperty.call(this._attribs, this._attribname)
|
367 |
+
){
|
368 |
+
this._attribs[this._attribname] = this._attribvalue;
|
369 |
+
}
|
370 |
+
this._attribname = "";
|
371 |
+
this._attribvalue = "";
|
372 |
+
};
|
373 |
+
|
374 |
+
Parser.prototype._getInstructionName = function(value){
|
375 |
+
var idx = value.search(re_nameEnd),
|
376 |
+
name = idx < 0 ? value : value.substr(0, idx);
|
377 |
+
|
378 |
+
if(this._lowerCaseTagNames){
|
379 |
+
name = name.toLowerCase();
|
380 |
+
}
|
381 |
+
|
382 |
+
return name;
|
383 |
+
};
|
384 |
+
|
385 |
+
Parser.prototype.ondeclaration = function(value){
|
386 |
+
if(this._cbs.onprocessinginstruction){
|
387 |
+
var name = this._getInstructionName(value);
|
388 |
+
this._cbs.onprocessinginstruction("!" + name, "!" + value);
|
389 |
+
}
|
390 |
+
};
|
391 |
+
|
392 |
+
Parser.prototype.onprocessinginstruction = function(value){
|
393 |
+
if(this._cbs.onprocessinginstruction){
|
394 |
+
var name = this._getInstructionName(value);
|
395 |
+
this._cbs.onprocessinginstruction("?" + name, "?" + value);
|
396 |
+
}
|
397 |
+
};
|
398 |
+
|
399 |
+
Parser.prototype.oncomment = function(value){
|
400 |
+
this._updatePosition(4);
|
401 |
+
|
402 |
+
if(this._cbs.oncomment) this._cbs.oncomment(value);
|
403 |
+
if(this._cbs.oncommentend) this._cbs.oncommentend();
|
404 |
+
};
|
405 |
+
|
406 |
+
Parser.prototype.oncdata = function(value){
|
407 |
+
this._updatePosition(1);
|
408 |
+
|
409 |
+
if(this._options.xmlMode || this._options.recognizeCDATA){
|
410 |
+
if(this._cbs.oncdatastart) this._cbs.oncdatastart();
|
411 |
+
if(this._cbs.ontext) this._cbs.ontext(value);
|
412 |
+
if(this._cbs.oncdataend) this._cbs.oncdataend();
|
413 |
+
} else {
|
414 |
+
this.oncomment("[CDATA[" + value + "]]");
|
415 |
+
}
|
416 |
+
};
|
417 |
+
|
418 |
+
Parser.prototype.onerror = function(err){
|
419 |
+
if(this._cbs.onerror) this._cbs.onerror(err);
|
420 |
+
};
|
421 |
+
|
422 |
+
Parser.prototype.onend = function(){
|
423 |
+
if(this._cbs.onclosetag){
|
424 |
+
for(
|
425 |
+
var i = this._stack.length;
|
426 |
+
i > 0;
|
427 |
+
this._cbs.onclosetag(this._stack[--i])
|
428 |
+
);
|
429 |
+
}
|
430 |
+
if(this._cbs.onend) this._cbs.onend();
|
431 |
+
};
|
432 |
+
|
433 |
+
|
434 |
+
//Resets the parser to a blank state, ready to parse a new HTML document
|
435 |
+
Parser.prototype.reset = function(){
|
436 |
+
if(this._cbs.onreset) this._cbs.onreset();
|
437 |
+
this._tokenizer.reset();
|
438 |
+
|
439 |
+
this._tagname = "";
|
440 |
+
this._attribname = "";
|
441 |
+
this._attribs = null;
|
442 |
+
this._stack = [];
|
443 |
+
|
444 |
+
if(this._cbs.onparserinit) this._cbs.onparserinit(this);
|
445 |
+
};
|
446 |
+
|
447 |
+
//Parses a complete HTML document and pushes it to the handler
|
448 |
+
Parser.prototype.parseComplete = function(data){
|
449 |
+
this.reset();
|
450 |
+
this.end(data);
|
451 |
+
};
|
452 |
+
|
453 |
+
Parser.prototype.write = function(chunk){
|
454 |
+
this._tokenizer.write(chunk);
|
455 |
+
};
|
456 |
+
|
457 |
+
Parser.prototype.end = function(chunk){
|
458 |
+
this._tokenizer.end(chunk);
|
459 |
+
};
|
460 |
+
|
461 |
+
Parser.prototype.pause = function(){
|
462 |
+
this._tokenizer.pause();
|
463 |
+
};
|
464 |
+
|
465 |
+
Parser.prototype.resume = function(){
|
466 |
+
this._tokenizer.resume();
|
467 |
+
};
|
468 |
+
|
469 |
+
//alias for backwards compat
|
470 |
+
Parser.prototype.parseChunk = Parser.prototype.write;
|
471 |
+
Parser.prototype.done = Parser.prototype.end;
|
472 |
+
|
473 |
+
module.exports = Parser;
|
474 |
+
|
475 |
+
|
476 |
+
/***/ }),
|
477 |
+
|
478 |
+
/***/ 257:
|
479 |
+
/***/ (function(module, exports, __webpack_require__) {
|
480 |
+
|
481 |
+
module.exports = Tokenizer;
|
482 |
+
|
483 |
+
var decodeCodePoint = __webpack_require__(258),
|
484 |
+
entityMap = __webpack_require__(87),
|
485 |
+
legacyMap = __webpack_require__(259),
|
486 |
+
xmlMap = __webpack_require__(88),
|
487 |
+
|
488 |
+
i = 0,
|
489 |
+
|
490 |
+
TEXT = i++,
|
491 |
+
BEFORE_TAG_NAME = i++, //after <
|
492 |
+
IN_TAG_NAME = i++,
|
493 |
+
IN_SELF_CLOSING_TAG = i++,
|
494 |
+
BEFORE_CLOSING_TAG_NAME = i++,
|
495 |
+
IN_CLOSING_TAG_NAME = i++,
|
496 |
+
AFTER_CLOSING_TAG_NAME = i++,
|
497 |
+
|
498 |
+
//attributes
|
499 |
+
BEFORE_ATTRIBUTE_NAME = i++,
|
500 |
+
IN_ATTRIBUTE_NAME = i++,
|
501 |
+
AFTER_ATTRIBUTE_NAME = i++,
|
502 |
+
BEFORE_ATTRIBUTE_VALUE = i++,
|
503 |
+
IN_ATTRIBUTE_VALUE_DQ = i++, // "
|
504 |
+
IN_ATTRIBUTE_VALUE_SQ = i++, // '
|
505 |
+
IN_ATTRIBUTE_VALUE_NQ = i++,
|
506 |
+
|
507 |
+
//declarations
|
508 |
+
BEFORE_DECLARATION = i++, // !
|
509 |
+
IN_DECLARATION = i++,
|
510 |
+
|
511 |
+
//processing instructions
|
512 |
+
IN_PROCESSING_INSTRUCTION = i++, // ?
|
513 |
+
|
514 |
+
//comments
|
515 |
+
BEFORE_COMMENT = i++,
|
516 |
+
IN_COMMENT = i++,
|
517 |
+
AFTER_COMMENT_1 = i++,
|
518 |
+
AFTER_COMMENT_2 = i++,
|
519 |
+
|
520 |
+
//cdata
|
521 |
+
BEFORE_CDATA_1 = i++, // [
|
522 |
+
BEFORE_CDATA_2 = i++, // C
|
523 |
+
BEFORE_CDATA_3 = i++, // D
|
524 |
+
BEFORE_CDATA_4 = i++, // A
|
525 |
+
BEFORE_CDATA_5 = i++, // T
|
526 |
+
BEFORE_CDATA_6 = i++, // A
|
527 |
+
IN_CDATA = i++, // [
|
528 |
+
AFTER_CDATA_1 = i++, // ]
|
529 |
+
AFTER_CDATA_2 = i++, // ]
|
530 |
+
|
531 |
+
//special tags
|
532 |
+
BEFORE_SPECIAL = i++, //S
|
533 |
+
BEFORE_SPECIAL_END = i++, //S
|
534 |
+
|
535 |
+
BEFORE_SCRIPT_1 = i++, //C
|
536 |
+
BEFORE_SCRIPT_2 = i++, //R
|
537 |
+
BEFORE_SCRIPT_3 = i++, //I
|
538 |
+
BEFORE_SCRIPT_4 = i++, //P
|
539 |
+
BEFORE_SCRIPT_5 = i++, //T
|
540 |
+
AFTER_SCRIPT_1 = i++, //C
|
541 |
+
AFTER_SCRIPT_2 = i++, //R
|
542 |
+
AFTER_SCRIPT_3 = i++, //I
|
543 |
+
AFTER_SCRIPT_4 = i++, //P
|
544 |
+
AFTER_SCRIPT_5 = i++, //T
|
545 |
+
|
546 |
+
BEFORE_STYLE_1 = i++, //T
|
547 |
+
BEFORE_STYLE_2 = i++, //Y
|
548 |
+
BEFORE_STYLE_3 = i++, //L
|
549 |
+
BEFORE_STYLE_4 = i++, //E
|
550 |
+
AFTER_STYLE_1 = i++, //T
|
551 |
+
AFTER_STYLE_2 = i++, //Y
|
552 |
+
AFTER_STYLE_3 = i++, //L
|
553 |
+
AFTER_STYLE_4 = i++, //E
|
554 |
+
|
555 |
+
BEFORE_ENTITY = i++, //&
|
556 |
+
BEFORE_NUMERIC_ENTITY = i++, //#
|
557 |
+
IN_NAMED_ENTITY = i++,
|
558 |
+
IN_NUMERIC_ENTITY = i++,
|
559 |
+
IN_HEX_ENTITY = i++, //X
|
560 |
+
|
561 |
+
j = 0,
|
562 |
+
|
563 |
+
SPECIAL_NONE = j++,
|
564 |
+
SPECIAL_SCRIPT = j++,
|
565 |
+
SPECIAL_STYLE = j++;
|
566 |
+
|
567 |
+
function whitespace(c){
|
568 |
+
return c === " " || c === "\n" || c === "\t" || c === "\f" || c === "\r";
|
569 |
+
}
|
570 |
+
|
571 |
+
function characterState(char, SUCCESS){
|
572 |
+
return function(c){
|
573 |
+
if(c === char) this._state = SUCCESS;
|
574 |
+
};
|
575 |
+
}
|
576 |
+
|
577 |
+
function ifElseState(upper, SUCCESS, FAILURE){
|
578 |
+
var lower = upper.toLowerCase();
|
579 |
+
|
580 |
+
if(upper === lower){
|
581 |
+
return function(c){
|
582 |
+
if(c === lower){
|
583 |
+
this._state = SUCCESS;
|
584 |
+
} else {
|
585 |
+
this._state = FAILURE;
|
586 |
+
this._index--;
|
587 |
+
}
|
588 |
+
};
|
589 |
+
} else {
|
590 |
+
return function(c){
|
591 |
+
if(c === lower || c === upper){
|
592 |
+
this._state = SUCCESS;
|
593 |
+
} else {
|
594 |
+
this._state = FAILURE;
|
595 |
+
this._index--;
|
596 |
+
}
|
597 |
+
};
|
598 |
+
}
|
599 |
+
}
|
600 |
+
|
601 |
+
function consumeSpecialNameChar(upper, NEXT_STATE){
|
602 |
+
var lower = upper.toLowerCase();
|
603 |
+
|
604 |
+
return function(c){
|
605 |
+
if(c === lower || c === upper){
|
606 |
+
this._state = NEXT_STATE;
|
607 |
+
} else {
|
608 |
+
this._state = IN_TAG_NAME;
|
609 |
+
this._index--; //consume the token again
|
610 |
+
}
|
611 |
+
};
|
612 |
+
}
|
613 |
+
|
614 |
+
function Tokenizer(options, cbs){
|
615 |
+
this._state = TEXT;
|
616 |
+
this._buffer = "";
|
617 |
+
this._sectionStart = 0;
|
618 |
+
this._index = 0;
|
619 |
+
this._bufferOffset = 0; //chars removed from _buffer
|
620 |
+
this._baseState = TEXT;
|
621 |
+
this._special = SPECIAL_NONE;
|
622 |
+
this._cbs = cbs;
|
623 |
+
this._running = true;
|
624 |
+
this._ended = false;
|
625 |
+
this._xmlMode = !!(options && options.xmlMode);
|
626 |
+
this._decodeEntities = !!(options && options.decodeEntities);
|
627 |
+
}
|
628 |
+
|
629 |
+
Tokenizer.prototype._stateText = function(c){
|
630 |
+
if(c === "<"){
|
631 |
+
if(this._index > this._sectionStart){
|
632 |
+
this._cbs.ontext(this._getSection());
|
633 |
+
}
|
634 |
+
this._state = BEFORE_TAG_NAME;
|
635 |
+
this._sectionStart = this._index;
|
636 |
+
} else if(this._decodeEntities && this._special === SPECIAL_NONE && c === "&"){
|
637 |
+
if(this._index > this._sectionStart){
|
638 |
+
this._cbs.ontext(this._getSection());
|
639 |
+
}
|
640 |
+
this._baseState = TEXT;
|
641 |
+
this._state = BEFORE_ENTITY;
|
642 |
+
this._sectionStart = this._index;
|
643 |
+
}
|
644 |
+
};
|
645 |
+
|
646 |
+
Tokenizer.prototype._stateBeforeTagName = function(c){
|
647 |
+
if(c === "/"){
|
648 |
+
this._state = BEFORE_CLOSING_TAG_NAME;
|
649 |
+
} else if(c === "<"){
|
650 |
+
this._cbs.ontext(this._getSection());
|
651 |
+
this._sectionStart = this._index;
|
652 |
+
} else if(c === ">" || this._special !== SPECIAL_NONE || whitespace(c)) {
|
653 |
+
this._state = TEXT;
|
654 |
+
} else if(c === "!"){
|
655 |
+
this._state = BEFORE_DECLARATION;
|
656 |
+
this._sectionStart = this._index + 1;
|
657 |
+
} else if(c === "?"){
|
658 |
+
this._state = IN_PROCESSING_INSTRUCTION;
|
659 |
+
this._sectionStart = this._index + 1;
|
660 |
+
} else {
|
661 |
+
this._state = (!this._xmlMode && (c === "s" || c === "S")) ?
|
662 |
+
BEFORE_SPECIAL : IN_TAG_NAME;
|
663 |
+
this._sectionStart = this._index;
|
664 |
+
}
|
665 |
+
};
|
666 |
+
|
667 |
+
Tokenizer.prototype._stateInTagName = function(c){
|
668 |
+
if(c === "/" || c === ">" || whitespace(c)){
|
669 |
+
this._emitToken("onopentagname");
|
670 |
+
this._state = BEFORE_ATTRIBUTE_NAME;
|
671 |
+
this._index--;
|
672 |
+
}
|
673 |
+
};
|
674 |
+
|
675 |
+
Tokenizer.prototype._stateBeforeCloseingTagName = function(c){
|
676 |
+
if(whitespace(c));
|
677 |
+
else if(c === ">"){
|
678 |
+
this._state = TEXT;
|
679 |
+
} else if(this._special !== SPECIAL_NONE){
|
680 |
+
if(c === "s" || c === "S"){
|
681 |
+
this._state = BEFORE_SPECIAL_END;
|
682 |
+
} else {
|
683 |
+
this._state = TEXT;
|
684 |
+
this._index--;
|
685 |
+
}
|
686 |
+
} else {
|
687 |
+
this._state = IN_CLOSING_TAG_NAME;
|
688 |
+
this._sectionStart = this._index;
|
689 |
+
}
|
690 |
+
};
|
691 |
+
|
692 |
+
Tokenizer.prototype._stateInCloseingTagName = function(c){
|
693 |
+
if(c === ">" || whitespace(c)){
|
694 |
+
this._emitToken("onclosetag");
|
695 |
+
this._state = AFTER_CLOSING_TAG_NAME;
|
696 |
+
this._index--;
|
697 |
+
}
|
698 |
+
};
|
699 |
+
|
700 |
+
Tokenizer.prototype._stateAfterCloseingTagName = function(c){
|
701 |
+
//skip everything until ">"
|
702 |
+
if(c === ">"){
|
703 |
+
this._state = TEXT;
|
704 |
+
this._sectionStart = this._index + 1;
|
705 |
+
}
|
706 |
+
};
|
707 |
+
|
708 |
+
Tokenizer.prototype._stateBeforeAttributeName = function(c){
|
709 |
+
if(c === ">"){
|
710 |
+
this._cbs.onopentagend();
|
711 |
+
this._state = TEXT;
|
712 |
+
this._sectionStart = this._index + 1;
|
713 |
+
} else if(c === "/"){
|
714 |
+
this._state = IN_SELF_CLOSING_TAG;
|
715 |
+
} else if(!whitespace(c)){
|
716 |
+
this._state = IN_ATTRIBUTE_NAME;
|
717 |
+
this._sectionStart = this._index;
|
718 |
+
}
|
719 |
+
};
|
720 |
+
|
721 |
+
Tokenizer.prototype._stateInSelfClosingTag = function(c){
|
722 |
+
if(c === ">"){
|
723 |
+
this._cbs.onselfclosingtag();
|
724 |
+
this._state = TEXT;
|
725 |
+
this._sectionStart = this._index + 1;
|
726 |
+
} else if(!whitespace(c)){
|
727 |
+
this._state = BEFORE_ATTRIBUTE_NAME;
|
728 |
+
this._index--;
|
729 |
+
}
|
730 |
+
};
|
731 |
+
|
732 |
+
Tokenizer.prototype._stateInAttributeName = function(c){
|
733 |
+
if(c === "=" || c === "/" || c === ">" || whitespace(c)){
|
734 |
+
this._cbs.onattribname(this._getSection());
|
735 |
+
this._sectionStart = -1;
|
736 |
+
this._state = AFTER_ATTRIBUTE_NAME;
|
737 |
+
this._index--;
|
738 |
+
}
|
739 |
+
};
|
740 |
+
|
741 |
+
Tokenizer.prototype._stateAfterAttributeName = function(c){
|
742 |
+
if(c === "="){
|
743 |
+
this._state = BEFORE_ATTRIBUTE_VALUE;
|
744 |
+
} else if(c === "/" || c === ">"){
|
745 |
+
this._cbs.onattribend();
|
746 |
+
this._state = BEFORE_ATTRIBUTE_NAME;
|
747 |
+
this._index--;
|
748 |
+
} else if(!whitespace(c)){
|
749 |
+
this._cbs.onattribend();
|
750 |
+
this._state = IN_ATTRIBUTE_NAME;
|
751 |
+
this._sectionStart = this._index;
|
752 |
+
}
|
753 |
+
};
|
754 |
+
|
755 |
+
Tokenizer.prototype._stateBeforeAttributeValue = function(c){
|
756 |
+
if(c === "\""){
|
757 |
+
this._state = IN_ATTRIBUTE_VALUE_DQ;
|
758 |
+
this._sectionStart = this._index + 1;
|
759 |
+
} else if(c === "'"){
|
760 |
+
this._state = IN_ATTRIBUTE_VALUE_SQ;
|
761 |
+
this._sectionStart = this._index + 1;
|
762 |
+
} else if(!whitespace(c)){
|
763 |
+
this._state = IN_ATTRIBUTE_VALUE_NQ;
|
764 |
+
this._sectionStart = this._index;
|
765 |
+
this._index--; //reconsume token
|
766 |
+
}
|
767 |
+
};
|
768 |
+
|
769 |
+
Tokenizer.prototype._stateInAttributeValueDoubleQuotes = function(c){
|
770 |
+
if(c === "\""){
|
771 |
+
this._emitToken("onattribdata");
|
772 |
+
this._cbs.onattribend();
|
773 |
+
this._state = BEFORE_ATTRIBUTE_NAME;
|
774 |
+
} else if(this._decodeEntities && c === "&"){
|
775 |
+
this._emitToken("onattribdata");
|
776 |
+
this._baseState = this._state;
|
777 |
+
this._state = BEFORE_ENTITY;
|
778 |
+
this._sectionStart = this._index;
|
779 |
+
}
|
780 |
+
};
|
781 |
+
|
782 |
+
Tokenizer.prototype._stateInAttributeValueSingleQuotes = function(c){
|
783 |
+
if(c === "'"){
|
784 |
+
this._emitToken("onattribdata");
|
785 |
+
this._cbs.onattribend();
|
786 |
+
this._state = BEFORE_ATTRIBUTE_NAME;
|
787 |
+
} else if(this._decodeEntities && c === "&"){
|
788 |
+
this._emitToken("onattribdata");
|
789 |
+
this._baseState = this._state;
|
790 |
+
this._state = BEFORE_ENTITY;
|
791 |
+
this._sectionStart = this._index;
|
792 |
+
}
|
793 |
+
};
|
794 |
+
|
795 |
+
Tokenizer.prototype._stateInAttributeValueNoQuotes = function(c){
|
796 |
+
if(whitespace(c) || c === ">"){
|
797 |
+
this._emitToken("onattribdata");
|
798 |
+
this._cbs.onattribend();
|
799 |
+
this._state = BEFORE_ATTRIBUTE_NAME;
|
800 |
+
this._index--;
|
801 |
+
} else if(this._decodeEntities && c === "&"){
|
802 |
+
this._emitToken("onattribdata");
|
803 |
+
this._baseState = this._state;
|
804 |
+
this._state = BEFORE_ENTITY;
|
805 |
+
this._sectionStart = this._index;
|
806 |
+
}
|
807 |
+
};
|
808 |
+
|
809 |
+
Tokenizer.prototype._stateBeforeDeclaration = function(c){
|
810 |
+
this._state = c === "[" ? BEFORE_CDATA_1 :
|
811 |
+
c === "-" ? BEFORE_COMMENT :
|
812 |
+
IN_DECLARATION;
|
813 |
+
};
|
814 |
+
|
815 |
+
Tokenizer.prototype._stateInDeclaration = function(c){
|
816 |
+
if(c === ">"){
|
817 |
+
this._cbs.ondeclaration(this._getSection());
|
818 |
+
this._state = TEXT;
|
819 |
+
this._sectionStart = this._index + 1;
|
820 |
+
}
|
821 |
+
};
|
822 |
+
|
823 |
+
Tokenizer.prototype._stateInProcessingInstruction = function(c){
|
824 |
+
if(c === ">"){
|
825 |
+
this._cbs.onprocessinginstruction(this._getSection());
|
826 |
+
this._state = TEXT;
|
827 |
+
this._sectionStart = this._index + 1;
|
828 |
+
}
|
829 |
+
};
|
830 |
+
|
831 |
+
Tokenizer.prototype._stateBeforeComment = function(c){
|
832 |
+
if(c === "-"){
|
833 |
+
this._state = IN_COMMENT;
|
834 |
+
this._sectionStart = this._index + 1;
|
835 |
+
} else {
|
836 |
+
this._state = IN_DECLARATION;
|
837 |
+
}
|
838 |
+
};
|
839 |
+
|
840 |
+
Tokenizer.prototype._stateInComment = function(c){
|
841 |
+
if(c === "-") this._state = AFTER_COMMENT_1;
|
842 |
+
};
|
843 |
+
|
844 |
+
Tokenizer.prototype._stateAfterComment1 = function(c){
|
845 |
+
if(c === "-"){
|
846 |
+
this._state = AFTER_COMMENT_2;
|
847 |
+
} else {
|
848 |
+
this._state = IN_COMMENT;
|
849 |
+
}
|
850 |
+
};
|
851 |
+
|
852 |
+
Tokenizer.prototype._stateAfterComment2 = function(c){
|
853 |
+
if(c === ">"){
|
854 |
+
//remove 2 trailing chars
|
855 |
+
this._cbs.oncomment(this._buffer.substring(this._sectionStart, this._index - 2));
|
856 |
+
this._state = TEXT;
|
857 |
+
this._sectionStart = this._index + 1;
|
858 |
+
} else if(c !== "-"){
|
859 |
+
this._state = IN_COMMENT;
|
860 |
+
}
|
861 |
+
// else: stay in AFTER_COMMENT_2 (`--->`)
|
862 |
+
};
|
863 |
+
|
864 |
+
Tokenizer.prototype._stateBeforeCdata1 = ifElseState("C", BEFORE_CDATA_2, IN_DECLARATION);
|
865 |
+
Tokenizer.prototype._stateBeforeCdata2 = ifElseState("D", BEFORE_CDATA_3, IN_DECLARATION);
|
866 |
+
Tokenizer.prototype._stateBeforeCdata3 = ifElseState("A", BEFORE_CDATA_4, IN_DECLARATION);
|
867 |
+
Tokenizer.prototype._stateBeforeCdata4 = ifElseState("T", BEFORE_CDATA_5, IN_DECLARATION);
|
868 |
+
Tokenizer.prototype._stateBeforeCdata5 = ifElseState("A", BEFORE_CDATA_6, IN_DECLARATION);
|
869 |
+
|
870 |
+
Tokenizer.prototype._stateBeforeCdata6 = function(c){
|
871 |
+
if(c === "["){
|
872 |
+
this._state = IN_CDATA;
|
873 |
+
this._sectionStart = this._index + 1;
|
874 |
+
} else {
|
875 |
+
this._state = IN_DECLARATION;
|
876 |
+
this._index--;
|
877 |
+
}
|
878 |
+
};
|
879 |
+
|
880 |
+
Tokenizer.prototype._stateInCdata = function(c){
|
881 |
+
if(c === "]") this._state = AFTER_CDATA_1;
|
882 |
+
};
|
883 |
+
|
884 |
+
Tokenizer.prototype._stateAfterCdata1 = characterState("]", AFTER_CDATA_2);
|
885 |
+
|
886 |
+
Tokenizer.prototype._stateAfterCdata2 = function(c){
|
887 |
+
if(c === ">"){
|
888 |
+
//remove 2 trailing chars
|
889 |
+
this._cbs.oncdata(this._buffer.substring(this._sectionStart, this._index - 2));
|
890 |
+
this._state = TEXT;
|
891 |
+
this._sectionStart = this._index + 1;
|
892 |
+
} else if(c !== "]") {
|
893 |
+
this._state = IN_CDATA;
|
894 |
+
}
|
895 |
+
//else: stay in AFTER_CDATA_2 (`]]]>`)
|
896 |
+
};
|
897 |
+
|
898 |
+
Tokenizer.prototype._stateBeforeSpecial = function(c){
|
899 |
+
if(c === "c" || c === "C"){
|
900 |
+
this._state = BEFORE_SCRIPT_1;
|
901 |
+
} else if(c === "t" || c === "T"){
|
902 |
+
this._state = BEFORE_STYLE_1;
|
903 |
+
} else {
|
904 |
+
this._state = IN_TAG_NAME;
|
905 |
+
this._index--; //consume the token again
|
906 |
+
}
|
907 |
+
};
|
908 |
+
|
909 |
+
Tokenizer.prototype._stateBeforeSpecialEnd = function(c){
|
910 |
+
if(this._special === SPECIAL_SCRIPT && (c === "c" || c === "C")){
|
911 |
+
this._state = AFTER_SCRIPT_1;
|
912 |
+
} else if(this._special === SPECIAL_STYLE && (c === "t" || c === "T")){
|
913 |
+
this._state = AFTER_STYLE_1;
|
914 |
+
}
|
915 |
+
else this._state = TEXT;
|
916 |
+
};
|
917 |
+
|
918 |
+
Tokenizer.prototype._stateBeforeScript1 = consumeSpecialNameChar("R", BEFORE_SCRIPT_2);
|
919 |
+
Tokenizer.prototype._stateBeforeScript2 = consumeSpecialNameChar("I", BEFORE_SCRIPT_3);
|
920 |
+
Tokenizer.prototype._stateBeforeScript3 = consumeSpecialNameChar("P", BEFORE_SCRIPT_4);
|
921 |
+
Tokenizer.prototype._stateBeforeScript4 = consumeSpecialNameChar("T", BEFORE_SCRIPT_5);
|
922 |
+
|
923 |
+
Tokenizer.prototype._stateBeforeScript5 = function(c){
|
924 |
+
if(c === "/" || c === ">" || whitespace(c)){
|
925 |
+
this._special = SPECIAL_SCRIPT;
|
926 |
+
}
|
927 |
+
this._state = IN_TAG_NAME;
|
928 |
+
this._index--; //consume the token again
|
929 |
+
};
|
930 |
+
|
931 |
+
Tokenizer.prototype._stateAfterScript1 = ifElseState("R", AFTER_SCRIPT_2, TEXT);
|
932 |
+
Tokenizer.prototype._stateAfterScript2 = ifElseState("I", AFTER_SCRIPT_3, TEXT);
|
933 |
+
Tokenizer.prototype._stateAfterScript3 = ifElseState("P", AFTER_SCRIPT_4, TEXT);
|
934 |
+
Tokenizer.prototype._stateAfterScript4 = ifElseState("T", AFTER_SCRIPT_5, TEXT);
|
935 |
+
|
936 |
+
Tokenizer.prototype._stateAfterScript5 = function(c){
|
937 |
+
if(c === ">" || whitespace(c)){
|
938 |
+
this._special = SPECIAL_NONE;
|
939 |
+
this._state = IN_CLOSING_TAG_NAME;
|
940 |
+
this._sectionStart = this._index - 6;
|
941 |
+
this._index--; //reconsume the token
|
942 |
+
}
|
943 |
+
else this._state = TEXT;
|
944 |
+
};
|
945 |
+
|
946 |
+
Tokenizer.prototype._stateBeforeStyle1 = consumeSpecialNameChar("Y", BEFORE_STYLE_2);
|
947 |
+
Tokenizer.prototype._stateBeforeStyle2 = consumeSpecialNameChar("L", BEFORE_STYLE_3);
|
948 |
+
Tokenizer.prototype._stateBeforeStyle3 = consumeSpecialNameChar("E", BEFORE_STYLE_4);
|
949 |
+
|
950 |
+
Tokenizer.prototype._stateBeforeStyle4 = function(c){
|
951 |
+
if(c === "/" || c === ">" || whitespace(c)){
|
952 |
+
this._special = SPECIAL_STYLE;
|
953 |
+
}
|
954 |
+
this._state = IN_TAG_NAME;
|
955 |
+
this._index--; //consume the token again
|
956 |
+
};
|
957 |
+
|
958 |
+
Tokenizer.prototype._stateAfterStyle1 = ifElseState("Y", AFTER_STYLE_2, TEXT);
|
959 |
+
Tokenizer.prototype._stateAfterStyle2 = ifElseState("L", AFTER_STYLE_3, TEXT);
|
960 |
+
Tokenizer.prototype._stateAfterStyle3 = ifElseState("E", AFTER_STYLE_4, TEXT);
|
961 |
+
|
962 |
+
Tokenizer.prototype._stateAfterStyle4 = function(c){
|
963 |
+
if(c === ">" || whitespace(c)){
|
964 |
+
this._special = SPECIAL_NONE;
|
965 |
+
this._state = IN_CLOSING_TAG_NAME;
|
966 |
+
this._sectionStart = this._index - 5;
|
967 |
+
this._index--; //reconsume the token
|
968 |
+
}
|
969 |
+
else this._state = TEXT;
|
970 |
+
};
|
971 |
+
|
972 |
+
Tokenizer.prototype._stateBeforeEntity = ifElseState("#", BEFORE_NUMERIC_ENTITY, IN_NAMED_ENTITY);
|
973 |
+
Tokenizer.prototype._stateBeforeNumericEntity = ifElseState("X", IN_HEX_ENTITY, IN_NUMERIC_ENTITY);
|
974 |
+
|
975 |
+
//for entities terminated with a semicolon
|
976 |
+
Tokenizer.prototype._parseNamedEntityStrict = function(){
|
977 |
+
//offset = 1
|
978 |
+
if(this._sectionStart + 1 < this._index){
|
979 |
+
var entity = this._buffer.substring(this._sectionStart + 1, this._index),
|
980 |
+
map = this._xmlMode ? xmlMap : entityMap;
|
981 |
+
|
982 |
+
if(map.hasOwnProperty(entity)){
|
983 |
+
this._emitPartial(map[entity]);
|
984 |
+
this._sectionStart = this._index + 1;
|
985 |
+
}
|
986 |
+
}
|
987 |
+
};
|
988 |
+
|
989 |
+
|
990 |
+
//parses legacy entities (without trailing semicolon)
|
991 |
+
Tokenizer.prototype._parseLegacyEntity = function(){
|
992 |
+
var start = this._sectionStart + 1,
|
993 |
+
limit = this._index - start;
|
994 |
+
|
995 |
+
if(limit > 6) limit = 6; //the max length of legacy entities is 6
|
996 |
+
|
997 |
+
while(limit >= 2){ //the min length of legacy entities is 2
|
998 |
+
var entity = this._buffer.substr(start, limit);
|
999 |
+
|
1000 |
+
if(legacyMap.hasOwnProperty(entity)){
|
1001 |
+
this._emitPartial(legacyMap[entity]);
|
1002 |
+
this._sectionStart += limit + 1;
|
1003 |
+
return;
|
1004 |
+
} else {
|
1005 |
+
limit--;
|
1006 |
+
}
|
1007 |
+
}
|
1008 |
+
};
|
1009 |
+
|
1010 |
+
Tokenizer.prototype._stateInNamedEntity = function(c){
|
1011 |
+
if(c === ";"){
|
1012 |
+
this._parseNamedEntityStrict();
|
1013 |
+
if(this._sectionStart + 1 < this._index && !this._xmlMode){
|
1014 |
+
this._parseLegacyEntity();
|
1015 |
+
}
|
1016 |
+
this._state = this._baseState;
|
1017 |
+
} else if((c < "a" || c > "z") && (c < "A" || c > "Z") && (c < "0" || c > "9")){
|
1018 |
+
if(this._xmlMode);
|
1019 |
+
else if(this._sectionStart + 1 === this._index);
|
1020 |
+
else if(this._baseState !== TEXT){
|
1021 |
+
if(c !== "="){
|
1022 |
+
this._parseNamedEntityStrict();
|
1023 |
+
}
|
1024 |
+
} else {
|
1025 |
+
this._parseLegacyEntity();
|
1026 |
+
}
|
1027 |
+
|
1028 |
+
this._state = this._baseState;
|
1029 |
+
this._index--;
|
1030 |
+
}
|
1031 |
+
};
|
1032 |
+
|
1033 |
+
Tokenizer.prototype._decodeNumericEntity = function(offset, base){
|
1034 |
+
var sectionStart = this._sectionStart + offset;
|
1035 |
+
|
1036 |
+
if(sectionStart !== this._index){
|
1037 |
+
//parse entity
|
1038 |
+
var entity = this._buffer.substring(sectionStart, this._index);
|
1039 |
+
var parsed = parseInt(entity, base);
|
1040 |
+
|
1041 |
+
this._emitPartial(decodeCodePoint(parsed));
|
1042 |
+
this._sectionStart = this._index;
|
1043 |
+
} else {
|
1044 |
+
this._sectionStart--;
|
1045 |
+
}
|
1046 |
+
|
1047 |
+
this._state = this._baseState;
|
1048 |
+
};
|
1049 |
+
|
1050 |
+
Tokenizer.prototype._stateInNumericEntity = function(c){
|
1051 |
+
if(c === ";"){
|
1052 |
+
this._decodeNumericEntity(2, 10);
|
1053 |
+
this._sectionStart++;
|
1054 |
+
} else if(c < "0" || c > "9"){
|
1055 |
+
if(!this._xmlMode){
|
1056 |
+
this._decodeNumericEntity(2, 10);
|
1057 |
+
} else {
|
1058 |
+
this._state = this._baseState;
|
1059 |
+
}
|
1060 |
+
this._index--;
|
1061 |
+
}
|
1062 |
+
};
|
1063 |
+
|
1064 |
+
Tokenizer.prototype._stateInHexEntity = function(c){
|
1065 |
+
if(c === ";"){
|
1066 |
+
this._decodeNumericEntity(3, 16);
|
1067 |
+
this._sectionStart++;
|
1068 |
+
} else if((c < "a" || c > "f") && (c < "A" || c > "F") && (c < "0" || c > "9")){
|
1069 |
+
if(!this._xmlMode){
|
1070 |
+
this._decodeNumericEntity(3, 16);
|
1071 |
+
} else {
|
1072 |
+
this._state = this._baseState;
|
1073 |
+
}
|
1074 |
+
this._index--;
|
1075 |
+
}
|
1076 |
+
};
|
1077 |
+
|
1078 |
+
Tokenizer.prototype._cleanup = function (){
|
1079 |
+
if(this._sectionStart < 0){
|
1080 |
+
this._buffer = "";
|
1081 |
+
this._bufferOffset += this._index;
|
1082 |
+
this._index = 0;
|
1083 |
+
} else if(this._running){
|
1084 |
+
if(this._state === TEXT){
|
1085 |
+
if(this._sectionStart !== this._index){
|
1086 |
+
this._cbs.ontext(this._buffer.substr(this._sectionStart));
|
1087 |
+
}
|
1088 |
+
this._buffer = "";
|
1089 |
+
this._bufferOffset += this._index;
|
1090 |
+
this._index = 0;
|
1091 |
+
} else if(this._sectionStart === this._index){
|
1092 |
+
//the section just started
|
1093 |
+
this._buffer = "";
|
1094 |
+
this._bufferOffset += this._index;
|
1095 |
+
this._index = 0;
|
1096 |
+
} else {
|
1097 |
+
//remove everything unnecessary
|
1098 |
+
this._buffer = this._buffer.substr(this._sectionStart);
|
1099 |
+
this._index -= this._sectionStart;
|
1100 |
+
this._bufferOffset += this._sectionStart;
|
1101 |
+
}
|
1102 |
+
|
1103 |
+
this._sectionStart = 0;
|
1104 |
+
}
|
1105 |
+
};
|
1106 |
+
|
1107 |
+
//TODO make events conditional
|
1108 |
+
Tokenizer.prototype.write = function(chunk){
|
1109 |
+
if(this._ended) this._cbs.onerror(Error(".write() after done!"));
|
1110 |
+
|
1111 |
+
this._buffer += chunk;
|
1112 |
+
this._parse();
|
1113 |
+
};
|
1114 |
+
|
1115 |
+
Tokenizer.prototype._parse = function(){
|
1116 |
+
while(this._index < this._buffer.length && this._running){
|
1117 |
+
var c = this._buffer.charAt(this._index);
|
1118 |
+
if(this._state === TEXT) {
|
1119 |
+
this._stateText(c);
|
1120 |
+
} else if(this._state === BEFORE_TAG_NAME){
|
1121 |
+
this._stateBeforeTagName(c);
|
1122 |
+
} else if(this._state === IN_TAG_NAME) {
|
1123 |
+
this._stateInTagName(c);
|
1124 |
+
} else if(this._state === BEFORE_CLOSING_TAG_NAME){
|
1125 |
+
this._stateBeforeCloseingTagName(c);
|
1126 |
+
} else if(this._state === IN_CLOSING_TAG_NAME){
|
1127 |
+
this._stateInCloseingTagName(c);
|
1128 |
+
} else if(this._state === AFTER_CLOSING_TAG_NAME){
|
1129 |
+
this._stateAfterCloseingTagName(c);
|
1130 |
+
} else if(this._state === IN_SELF_CLOSING_TAG){
|
1131 |
+
this._stateInSelfClosingTag(c);
|
1132 |
+
}
|
1133 |
+
|
1134 |
+
/*
|
1135 |
+
* attributes
|
1136 |
+
*/
|
1137 |
+
else if(this._state === BEFORE_ATTRIBUTE_NAME){
|
1138 |
+
this._stateBeforeAttributeName(c);
|
1139 |
+
} else if(this._state === IN_ATTRIBUTE_NAME){
|
1140 |
+
this._stateInAttributeName(c);
|
1141 |
+
} else if(this._state === AFTER_ATTRIBUTE_NAME){
|
1142 |
+
this._stateAfterAttributeName(c);
|
1143 |
+
} else if(this._state === BEFORE_ATTRIBUTE_VALUE){
|
1144 |
+
this._stateBeforeAttributeValue(c);
|
1145 |
+
} else if(this._state === IN_ATTRIBUTE_VALUE_DQ){
|
1146 |
+
this._stateInAttributeValueDoubleQuotes(c);
|
1147 |
+
} else if(this._state === IN_ATTRIBUTE_VALUE_SQ){
|
1148 |
+
this._stateInAttributeValueSingleQuotes(c);
|
1149 |
+
} else if(this._state === IN_ATTRIBUTE_VALUE_NQ){
|
1150 |
+
this._stateInAttributeValueNoQuotes(c);
|
1151 |
+
}
|
1152 |
+
|
1153 |
+
/*
|
1154 |
+
* declarations
|
1155 |
+
*/
|
1156 |
+
else if(this._state === BEFORE_DECLARATION){
|
1157 |
+
this._stateBeforeDeclaration(c);
|
1158 |
+
} else if(this._state === IN_DECLARATION){
|
1159 |
+
this._stateInDeclaration(c);
|
1160 |
+
}
|
1161 |
+
|
1162 |
+
/*
|
1163 |
+
* processing instructions
|
1164 |
+
*/
|
1165 |
+
else if(this._state === IN_PROCESSING_INSTRUCTION){
|
1166 |
+
this._stateInProcessingInstruction(c);
|
1167 |
+
}
|
1168 |
+
|
1169 |
+
/*
|
1170 |
+
* comments
|
1171 |
+
*/
|
1172 |
+
else if(this._state === BEFORE_COMMENT){
|
1173 |
+
this._stateBeforeComment(c);
|
1174 |
+
} else if(this._state === IN_COMMENT){
|
1175 |
+
this._stateInComment(c);
|
1176 |
+
} else if(this._state === AFTER_COMMENT_1){
|
1177 |
+
this._stateAfterComment1(c);
|
1178 |
+
} else if(this._state === AFTER_COMMENT_2){
|
1179 |
+
this._stateAfterComment2(c);
|
1180 |
+
}
|
1181 |
+
|
1182 |
+
/*
|
1183 |
+
* cdata
|
1184 |
+
*/
|
1185 |
+
else if(this._state === BEFORE_CDATA_1){
|
1186 |
+
this._stateBeforeCdata1(c);
|
1187 |
+
} else if(this._state === BEFORE_CDATA_2){
|
1188 |
+
this._stateBeforeCdata2(c);
|
1189 |
+
} else if(this._state === BEFORE_CDATA_3){
|
1190 |
+
this._stateBeforeCdata3(c);
|
1191 |
+
} else if(this._state === BEFORE_CDATA_4){
|
1192 |
+
this._stateBeforeCdata4(c);
|
1193 |
+
} else if(this._state === BEFORE_CDATA_5){
|
1194 |
+
this._stateBeforeCdata5(c);
|
1195 |
+
} else if(this._state === BEFORE_CDATA_6){
|
1196 |
+
this._stateBeforeCdata6(c);
|
1197 |
+
} else if(this._state === IN_CDATA){
|
1198 |
+
this._stateInCdata(c);
|
1199 |
+
} else if(this._state === AFTER_CDATA_1){
|
1200 |
+
this._stateAfterCdata1(c);
|
1201 |
+
} else if(this._state === AFTER_CDATA_2){
|
1202 |
+
this._stateAfterCdata2(c);
|
1203 |
+
}
|
1204 |
+
|
1205 |
+
/*
|
1206 |
+
* special tags
|
1207 |
+
*/
|
1208 |
+
else if(this._state === BEFORE_SPECIAL){
|
1209 |
+
this._stateBeforeSpecial(c);
|
1210 |
+
} else if(this._state === BEFORE_SPECIAL_END){
|
1211 |
+
this._stateBeforeSpecialEnd(c);
|
1212 |
+
}
|
1213 |
+
|
1214 |
+
/*
|
1215 |
+
* script
|
1216 |
+
*/
|
1217 |
+
else if(this._state === BEFORE_SCRIPT_1){
|
1218 |
+
this._stateBeforeScript1(c);
|
1219 |
+
} else if(this._state === BEFORE_SCRIPT_2){
|
1220 |
+
this._stateBeforeScript2(c);
|
1221 |
+
} else if(this._state === BEFORE_SCRIPT_3){
|
1222 |
+
this._stateBeforeScript3(c);
|
1223 |
+
} else if(this._state === BEFORE_SCRIPT_4){
|
1224 |
+
this._stateBeforeScript4(c);
|
1225 |
+
} else if(this._state === BEFORE_SCRIPT_5){
|
1226 |
+
this._stateBeforeScript5(c);
|
1227 |
+
}
|
1228 |
+
|
1229 |
+
else if(this._state === AFTER_SCRIPT_1){
|
1230 |
+
this._stateAfterScript1(c);
|
1231 |
+
} else if(this._state === AFTER_SCRIPT_2){
|
1232 |
+
this._stateAfterScript2(c);
|
1233 |
+
} else if(this._state === AFTER_SCRIPT_3){
|
1234 |
+
this._stateAfterScript3(c);
|
1235 |
+
} else if(this._state === AFTER_SCRIPT_4){
|
1236 |
+
this._stateAfterScript4(c);
|
1237 |
+
} else if(this._state === AFTER_SCRIPT_5){
|
1238 |
+
this._stateAfterScript5(c);
|
1239 |
+
}
|
1240 |
+
|
1241 |
+
/*
|
1242 |
+
* style
|
1243 |
+
*/
|
1244 |
+
else if(this._state === BEFORE_STYLE_1){
|
1245 |
+
this._stateBeforeStyle1(c);
|
1246 |
+
} else if(this._state === BEFORE_STYLE_2){
|
1247 |
+
this._stateBeforeStyle2(c);
|
1248 |
+
} else if(this._state === BEFORE_STYLE_3){
|
1249 |
+
this._stateBeforeStyle3(c);
|
1250 |
+
} else if(this._state === BEFORE_STYLE_4){
|
1251 |
+
this._stateBeforeStyle4(c);
|
1252 |
+
}
|
1253 |
+
|
1254 |
+
else if(this._state === AFTER_STYLE_1){
|
1255 |
+
this._stateAfterStyle1(c);
|
1256 |
+
} else if(this._state === AFTER_STYLE_2){
|
1257 |
+
this._stateAfterStyle2(c);
|
1258 |
+
} else if(this._state === AFTER_STYLE_3){
|
1259 |
+
this._stateAfterStyle3(c);
|
1260 |
+
} else if(this._state === AFTER_STYLE_4){
|
1261 |
+
this._stateAfterStyle4(c);
|
1262 |
+
}
|
1263 |
+
|
1264 |
+
/*
|
1265 |
+
* entities
|
1266 |
+
*/
|
1267 |
+
else if(this._state === BEFORE_ENTITY){
|
1268 |
+
this._stateBeforeEntity(c);
|
1269 |
+
} else if(this._state === BEFORE_NUMERIC_ENTITY){
|
1270 |
+
this._stateBeforeNumericEntity(c);
|
1271 |
+
} else if(this._state === IN_NAMED_ENTITY){
|
1272 |
+
this._stateInNamedEntity(c);
|
1273 |
+
} else if(this._state === IN_NUMERIC_ENTITY){
|
1274 |
+
this._stateInNumericEntity(c);
|
1275 |
+
} else if(this._state === IN_HEX_ENTITY){
|
1276 |
+
this._stateInHexEntity(c);
|
1277 |
+
}
|
1278 |
+
|
1279 |
+
else {
|
1280 |
+
this._cbs.onerror(Error("unknown _state"), this._state);
|
1281 |
+
}
|
1282 |
+
|
1283 |
+
this._index++;
|
1284 |
+
}
|
1285 |
+
|
1286 |
+
this._cleanup();
|
1287 |
+
};
|
1288 |
+
|
1289 |
+
Tokenizer.prototype.pause = function(){
|
1290 |
+
this._running = false;
|
1291 |
+
};
|
1292 |
+
Tokenizer.prototype.resume = function(){
|
1293 |
+
this._running = true;
|
1294 |
+
|
1295 |
+
if(this._index < this._buffer.length){
|
1296 |
+
this._parse();
|
1297 |
+
}
|
1298 |
+
if(this._ended){
|
1299 |
+
this._finish();
|
1300 |
+
}
|
1301 |
+
};
|
1302 |
+
|
1303 |
+
Tokenizer.prototype.end = function(chunk){
|
1304 |
+
if(this._ended) this._cbs.onerror(Error(".end() after done!"));
|
1305 |
+
if(chunk) this.write(chunk);
|
1306 |
+
|
1307 |
+
this._ended = true;
|
1308 |
+
|
1309 |
+
if(this._running) this._finish();
|
1310 |
+
};
|
1311 |
+
|
1312 |
+
Tokenizer.prototype._finish = function(){
|
1313 |
+
//if there is remaining data, emit it in a reasonable way
|
1314 |
+
if(this._sectionStart < this._index){
|
1315 |
+
this._handleTrailingData();
|
1316 |
+
}
|
1317 |
+
|
1318 |
+
this._cbs.onend();
|
1319 |
+
};
|
1320 |
+
|
1321 |
+
Tokenizer.prototype._handleTrailingData = function(){
|
1322 |
+
var data = this._buffer.substr(this._sectionStart);
|
1323 |
+
|
1324 |
+
if(this._state === IN_CDATA || this._state === AFTER_CDATA_1 || this._state === AFTER_CDATA_2){
|
1325 |
+
this._cbs.oncdata(data);
|
1326 |
+
} else if(this._state === IN_COMMENT || this._state === AFTER_COMMENT_1 || this._state === AFTER_COMMENT_2){
|
1327 |
+
this._cbs.oncomment(data);
|
1328 |
+
} else if(this._state === IN_NAMED_ENTITY && !this._xmlMode){
|
1329 |
+
this._parseLegacyEntity();
|
1330 |
+
if(this._sectionStart < this._index){
|
1331 |
+
this._state = this._baseState;
|
1332 |
+
this._handleTrailingData();
|
1333 |
+
}
|
1334 |
+
} else if(this._state === IN_NUMERIC_ENTITY && !this._xmlMode){
|
1335 |
+
this._decodeNumericEntity(2, 10);
|
1336 |
+
if(this._sectionStart < this._index){
|
1337 |
+
this._state = this._baseState;
|
1338 |
+
this._handleTrailingData();
|
1339 |
+
}
|
1340 |
+
} else if(this._state === IN_HEX_ENTITY && !this._xmlMode){
|
1341 |
+
this._decodeNumericEntity(3, 16);
|
1342 |
+
if(this._sectionStart < this._index){
|
1343 |
+
this._state = this._baseState;
|
1344 |
+
this._handleTrailingData();
|
1345 |
+
}
|
1346 |
+
} else if(
|
1347 |
+
this._state !== IN_TAG_NAME &&
|
1348 |
+
this._state !== BEFORE_ATTRIBUTE_NAME &&
|
1349 |
+
this._state !== BEFORE_ATTRIBUTE_VALUE &&
|
1350 |
+
this._state !== AFTER_ATTRIBUTE_NAME &&
|
1351 |
+
this._state !== IN_ATTRIBUTE_NAME &&
|
1352 |
+
this._state !== IN_ATTRIBUTE_VALUE_SQ &&
|
1353 |
+
this._state !== IN_ATTRIBUTE_VALUE_DQ &&
|
1354 |
+
this._state !== IN_ATTRIBUTE_VALUE_NQ &&
|
1355 |
+
this._state !== IN_CLOSING_TAG_NAME
|
1356 |
+
){
|
1357 |
+
this._cbs.ontext(data);
|
1358 |
+
}
|
1359 |
+
//else, ignore remaining data
|
1360 |
+
//TODO add a way to remove current tag
|
1361 |
+
};
|
1362 |
+
|
1363 |
+
Tokenizer.prototype.reset = function(){
|
1364 |
+
Tokenizer.call(this, {xmlMode: this._xmlMode, decodeEntities: this._decodeEntities}, this._cbs);
|
1365 |
+
};
|
1366 |
+
|
1367 |
+
Tokenizer.prototype.getAbsoluteIndex = function(){
|
1368 |
+
return this._bufferOffset + this._index;
|
1369 |
+
};
|
1370 |
+
|
1371 |
+
Tokenizer.prototype._getSection = function(){
|
1372 |
+
return this._buffer.substring(this._sectionStart, this._index);
|
1373 |
+
};
|
1374 |
+
|
1375 |
+
Tokenizer.prototype._emitToken = function(name){
|
1376 |
+
this._cbs[name](this._getSection());
|
1377 |
+
this._sectionStart = -1;
|
1378 |
+
};
|
1379 |
+
|
1380 |
+
Tokenizer.prototype._emitPartial = function(value){
|
1381 |
+
if(this._baseState !== TEXT){
|
1382 |
+
this._cbs.onattribdata(value); //TODO implement the new event
|
1383 |
+
} else {
|
1384 |
+
this._cbs.ontext(value);
|
1385 |
+
}
|
1386 |
+
};
|
1387 |
+
|
1388 |
+
|
1389 |
+
/***/ }),
|
1390 |
+
|
1391 |
+
/***/ 258:
|
1392 |
+
/***/ (function(module, exports, __webpack_require__) {
|
1393 |
+
|
1394 |
+
var decodeMap = __webpack_require__(411);
|
1395 |
+
|
1396 |
+
module.exports = decodeCodePoint;
|
1397 |
+
|
1398 |
+
// modified version of https://github.com/mathiasbynens/he/blob/master/src/he.js#L94-L119
|
1399 |
+
function decodeCodePoint(codePoint){
|
1400 |
+
|
1401 |
+
if((codePoint >= 0xD800 && codePoint <= 0xDFFF) || codePoint > 0x10FFFF){
|
1402 |
+
return "\uFFFD";
|
1403 |
+
}
|
1404 |
+
|
1405 |
+
if(codePoint in decodeMap){
|
1406 |
+
codePoint = decodeMap[codePoint];
|
1407 |
+
}
|
1408 |
+
|
1409 |
+
var output = "";
|
1410 |
+
|
1411 |
+
if(codePoint > 0xFFFF){
|
1412 |
+
codePoint -= 0x10000;
|
1413 |
+
output += String.fromCharCode(codePoint >>> 10 & 0x3FF | 0xD800);
|
1414 |
+
codePoint = 0xDC00 | codePoint & 0x3FF;
|
1415 |
+
}
|
1416 |
+
|
1417 |
+
output += String.fromCharCode(codePoint);
|
1418 |
+
return output;
|
1419 |
+
}
|
1420 |
+
|
1421 |
+
|
1422 |
+
/***/ }),
|
1423 |
+
|
1424 |
+
/***/ 259:
|
1425 |
+
/***/ (function(module, exports) {
|
1426 |
+
|
1427 |
+
module.exports = {"Aacute":"Á","aacute":"á","Acirc":"Â","acirc":"â","acute":"´","AElig":"Æ","aelig":"æ","Agrave":"À","agrave":"à","amp":"&","AMP":"&","Aring":"Å","aring":"å","Atilde":"Ã","atilde":"ã","Auml":"Ä","auml":"ä","brvbar":"¦","Ccedil":"Ç","ccedil":"ç","cedil":"¸","cent":"¢","copy":"©","COPY":"©","curren":"¤","deg":"°","divide":"÷","Eacute":"É","eacute":"é","Ecirc":"Ê","ecirc":"ê","Egrave":"È","egrave":"è","ETH":"Ð","eth":"ð","Euml":"Ë","euml":"ë","frac12":"½","frac14":"¼","frac34":"¾","gt":">","GT":">","Iacute":"Í","iacute":"í","Icirc":"Î","icirc":"î","iexcl":"¡","Igrave":"Ì","igrave":"ì","iquest":"¿","Iuml":"Ï","iuml":"ï","laquo":"«","lt":"<","LT":"<","macr":"¯","micro":"µ","middot":"·","nbsp":" ","not":"¬","Ntilde":"Ñ","ntilde":"ñ","Oacute":"Ó","oacute":"ó","Ocirc":"Ô","ocirc":"ô","Ograve":"Ò","ograve":"ò","ordf":"ª","ordm":"º","Oslash":"Ø","oslash":"ø","Otilde":"Õ","otilde":"õ","Ouml":"Ö","ouml":"ö","para":"¶","plusmn":"±","pound":"£","quot":"\"","QUOT":"\"","raquo":"»","reg":"®","REG":"®","sect":"§","shy":"","sup1":"¹","sup2":"²","sup3":"³","szlig":"ß","THORN":"Þ","thorn":"þ","times":"×","Uacute":"Ú","uacute":"ú","Ucirc":"Û","ucirc":"û","Ugrave":"Ù","ugrave":"ù","uml":"¨","Uuml":"Ü","uuml":"ü","Yacute":"Ý","yacute":"ý","yen":"¥","yuml":"ÿ"}
|
1428 |
+
|
1429 |
+
/***/ }),
|
1430 |
+
|
1431 |
+
/***/ 260:
|
1432 |
+
/***/ (function(module, exports) {
|
1433 |
+
|
1434 |
+
// This object will be used as the prototype for Nodes when creating a
|
1435 |
+
// DOM-Level-1-compliant structure.
|
1436 |
+
var NodePrototype = module.exports = {
|
1437 |
+
get firstChild() {
|
1438 |
+
var children = this.children;
|
1439 |
+
return children && children[0] || null;
|
1440 |
+
},
|
1441 |
+
get lastChild() {
|
1442 |
+
var children = this.children;
|
1443 |
+
return children && children[children.length - 1] || null;
|
1444 |
+
},
|
1445 |
+
get nodeType() {
|
1446 |
+
return nodeTypes[this.type] || nodeTypes.element;
|
1447 |
+
}
|
1448 |
+
};
|
1449 |
+
|
1450 |
+
var domLvl1 = {
|
1451 |
+
tagName: "name",
|
1452 |
+
childNodes: "children",
|
1453 |
+
parentNode: "parent",
|
1454 |
+
previousSibling: "prev",
|
1455 |
+
nextSibling: "next",
|
1456 |
+
nodeValue: "data"
|
1457 |
+
};
|
1458 |
+
|
1459 |
+
var nodeTypes = {
|
1460 |
+
element: 1,
|
1461 |
+
text: 3,
|
1462 |
+
cdata: 4,
|
1463 |
+
comment: 8
|
1464 |
+
};
|
1465 |
+
|
1466 |
+
Object.keys(domLvl1).forEach(function(key) {
|
1467 |
+
var shorthand = domLvl1[key];
|
1468 |
+
Object.defineProperty(NodePrototype, key, {
|
1469 |
+
get: function() {
|
1470 |
+
return this[shorthand] || null;
|
1471 |
+
},
|
1472 |
+
set: function(val) {
|
1473 |
+
this[shorthand] = val;
|
1474 |
+
return val;
|
1475 |
+
}
|
1476 |
+
});
|
1477 |
+
});
|
1478 |
+
|
1479 |
+
|
1480 |
+
/***/ }),
|
1481 |
+
|
1482 |
+
/***/ 261:
|
1483 |
+
/***/ (function(module, exports, __webpack_require__) {
|
1484 |
+
|
1485 |
+
module.exports = Stream;
|
1486 |
+
|
1487 |
+
var Parser = __webpack_require__(256),
|
1488 |
+
WritableStream = __webpack_require__(416).Writable || __webpack_require__(428).Writable,
|
1489 |
+
StringDecoder = __webpack_require__(92).StringDecoder,
|
1490 |
+
Buffer = __webpack_require__(90).Buffer;
|
1491 |
+
|
1492 |
+
function Stream(cbs, options){
|
1493 |
+
var parser = this._parser = new Parser(cbs, options);
|
1494 |
+
var decoder = this._decoder = new StringDecoder();
|
1495 |
+
|
1496 |
+
WritableStream.call(this, {decodeStrings: false});
|
1497 |
+
|
1498 |
+
this.once("finish", function(){
|
1499 |
+
parser.end(decoder.end());
|
1500 |
+
});
|
1501 |
+
}
|
1502 |
+
|
1503 |
+
__webpack_require__(21)(Stream, WritableStream);
|
1504 |
+
|
1505 |
+
WritableStream.prototype._write = function(chunk, encoding, cb){
|
1506 |
+
if(chunk instanceof Buffer) chunk = this._decoder.write(chunk);
|
1507 |
+
this._parser.write(chunk);
|
1508 |
+
cb();
|
1509 |
+
};
|
1510 |
+
|
1511 |
+
/***/ }),
|
1512 |
+
|
1513 |
+
/***/ 262:
|
1514 |
+
/***/ (function(module, exports, __webpack_require__) {
|
1515 |
+
|
1516 |
+
"use strict";
|
1517 |
+
/* WEBPACK VAR INJECTION */(function(global, process) {// Copyright Joyent, Inc. and other Node contributors.
|
1518 |
+
//
|
1519 |
+
// Permission is hereby granted, free of charge, to any person obtaining a
|
1520 |
+
// copy of this software and associated documentation files (the
|
1521 |
+
// "Software"), to deal in the Software without restriction, including
|
1522 |
+
// without limitation the rights to use, copy, modify, merge, publish,
|
1523 |
+
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
1524 |
+
// persons to whom the Software is furnished to do so, subject to the
|
1525 |
+
// following conditions:
|
1526 |
+
//
|
1527 |
+
// The above copyright notice and this permission notice shall be included
|
1528 |
+
// in all copies or substantial portions of the Software.
|
1529 |
+
//
|
1530 |
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
1531 |
+
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
1532 |
+
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
1533 |
+
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
1534 |
+
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
1535 |
+
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
1536 |
+
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
1537 |
+
|
1538 |
+
|
1539 |
+
|
1540 |
+
/*<replacement>*/
|
1541 |
+
|
1542 |
+
var processNextTick = __webpack_require__(55);
|
1543 |
+
/*</replacement>*/
|
1544 |
+
|
1545 |
+
module.exports = Readable;
|
1546 |
+
|
1547 |
+
/*<replacement>*/
|
1548 |
+
var isArray = __webpack_require__(263);
|
1549 |
+
/*</replacement>*/
|
1550 |
+
|
1551 |
+
/*<replacement>*/
|
1552 |
+
var Duplex;
|
1553 |
+
/*</replacement>*/
|
1554 |
+
|
1555 |
+
Readable.ReadableState = ReadableState;
|
1556 |
+
|
1557 |
+
/*<replacement>*/
|
1558 |
+
var EE = __webpack_require__(54).EventEmitter;
|
1559 |
+
|
1560 |
+
var EElistenerCount = function (emitter, type) {
|
1561 |
+
return emitter.listeners(type).length;
|
1562 |
+
};
|
1563 |
+
/*</replacement>*/
|
1564 |
+
|
1565 |
+
/*<replacement>*/
|
1566 |
+
var Stream = __webpack_require__(264);
|
1567 |
+
/*</replacement>*/
|
1568 |
+
|
1569 |
+
// TODO(bmeurer): Change this back to const once hole checks are
|
1570 |
+
// properly optimized away early in Ignition+TurboFan.
|
1571 |
+
/*<replacement>*/
|
1572 |
+
var Buffer = __webpack_require__(56).Buffer;
|
1573 |
+
var OurUint8Array = global.Uint8Array || function () {};
|
1574 |
+
function _uint8ArrayToBuffer(chunk) {
|
1575 |
+
return Buffer.from(chunk);
|
1576 |
+
}
|
1577 |
+
function _isUint8Array(obj) {
|
1578 |
+
return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
|
1579 |
+
}
|
1580 |
+
/*</replacement>*/
|
1581 |
+
|
1582 |
+
/*<replacement>*/
|
1583 |
+
var util = __webpack_require__(46);
|
1584 |
+
util.inherits = __webpack_require__(21);
|
1585 |
+
/*</replacement>*/
|
1586 |
+
|
1587 |
+
/*<replacement>*/
|
1588 |
+
var debugUtil = __webpack_require__(419);
|
1589 |
+
var debug = void 0;
|
1590 |
+
if (debugUtil && debugUtil.debuglog) {
|
1591 |
+
debug = debugUtil.debuglog('stream');
|
1592 |
+
} else {
|
1593 |
+
debug = function () {};
|
1594 |
+
}
|
1595 |
+
/*</replacement>*/
|
1596 |
+
|
1597 |
+
var BufferList = __webpack_require__(420);
|
1598 |
+
var destroyImpl = __webpack_require__(265);
|
1599 |
+
var StringDecoder;
|
1600 |
+
|
1601 |
+
util.inherits(Readable, Stream);
|
1602 |
+
|
1603 |
+
var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];
|
1604 |
+
|
1605 |
+
function prependListener(emitter, event, fn) {
|
1606 |
+
// Sadly this is not cacheable as some libraries bundle their own
|
1607 |
+
// event emitter implementation with them.
|
1608 |
+
if (typeof emitter.prependListener === 'function') {
|
1609 |
+
return emitter.prependListener(event, fn);
|
1610 |
+
} else {
|
1611 |
+
// This is a hack to make sure that our error handler is attached before any
|
1612 |
+
// userland ones. NEVER DO THIS. This is here only because this code needs
|
1613 |
+
// to continue to work with older versions of Node.js that do not include
|
1614 |
+
// the prependListener() method. The goal is to eventually remove this hack.
|
1615 |
+
if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];
|
1616 |
+
}
|
1617 |
+
}
|
1618 |
+
|
1619 |
+
function ReadableState(options, stream) {
|
1620 |
+
Duplex = Duplex || __webpack_require__(31);
|
1621 |
+
|
1622 |
+
options = options || {};
|
1623 |
+
|
1624 |
+
// object stream flag. Used to make read(n) ignore n and to
|
1625 |
+
// make all the buffer merging and length checks go away
|
1626 |
+
this.objectMode = !!options.objectMode;
|
1627 |
+
|
1628 |
+
if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.readableObjectMode;
|
1629 |
+
|
1630 |
+
// the point at which it stops calling _read() to fill the buffer
|
1631 |
+
// Note: 0 is a valid value, means "don't call _read preemptively ever"
|
1632 |
+
var hwm = options.highWaterMark;
|
1633 |
+
var defaultHwm = this.objectMode ? 16 : 16 * 1024;
|
1634 |
+
this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm;
|
1635 |
+
|
1636 |
+
// cast to ints.
|
1637 |
+
this.highWaterMark = Math.floor(this.highWaterMark);
|
1638 |
+
|
1639 |
+
// A linked list is used to store data chunks instead of an array because the
|
1640 |
+
// linked list can remove elements from the beginning faster than
|
1641 |
+
// array.shift()
|
1642 |
+
this.buffer = new BufferList();
|
1643 |
+
this.length = 0;
|
1644 |
+
this.pipes = null;
|
1645 |
+
this.pipesCount = 0;
|
1646 |
+
this.flowing = null;
|
1647 |
+
this.ended = false;
|
1648 |
+
this.endEmitted = false;
|
1649 |
+
this.reading = false;
|
1650 |
+
|
1651 |
+
// a flag to be able to tell if the event 'readable'/'data' is emitted
|
1652 |
+
// immediately, or on a later tick. We set this to true at first, because
|
1653 |
+
// any actions that shouldn't happen until "later" should generally also
|
1654 |
+
// not happen before the first read call.
|
1655 |
+
this.sync = true;
|
1656 |
+
|
1657 |
+
// whenever we return null, then we set a flag to say
|
1658 |
+
// that we're awaiting a 'readable' event emission.
|
1659 |
+
this.needReadable = false;
|
1660 |
+
this.emittedReadable = false;
|
1661 |
+
this.readableListening = false;
|
1662 |
+
this.resumeScheduled = false;
|
1663 |
+
|
1664 |
+
// has it been destroyed
|
1665 |
+
this.destroyed = false;
|
1666 |
+
|
1667 |
+
// Crypto is kind of old and crusty. Historically, its default string
|
1668 |
+
// encoding is 'binary' so we have to make this configurable.
|
1669 |
+
// Everything else in the universe uses 'utf8', though.
|
1670 |
+
this.defaultEncoding = options.defaultEncoding || 'utf8';
|
1671 |
+
|
1672 |
+
// the number of writers that are awaiting a drain event in .pipe()s
|
1673 |
+
this.awaitDrain = 0;
|
1674 |
+
|
1675 |
+
// if true, a maybeReadMore has been scheduled
|
1676 |
+
this.readingMore = false;
|
1677 |
+
|
1678 |
+
this.decoder = null;
|
1679 |
+
this.encoding = null;
|
1680 |
+
if (options.encoding) {
|
1681 |
+
if (!StringDecoder) StringDecoder = __webpack_require__(92).StringDecoder;
|
1682 |
+
this.decoder = new StringDecoder(options.encoding);
|
1683 |
+
this.encoding = options.encoding;
|
1684 |
+
}
|
1685 |
+
}
|
1686 |
+
|
1687 |
+
function Readable(options) {
|
1688 |
+
Duplex = Duplex || __webpack_require__(31);
|
1689 |
+
|
1690 |
+
if (!(this instanceof Readable)) return new Readable(options);
|
1691 |
+
|
1692 |
+
this._readableState = new ReadableState(options, this);
|
1693 |
+
|
1694 |
+
// legacy
|
1695 |
+
this.readable = true;
|
1696 |
+
|
1697 |
+
if (options) {
|
1698 |
+
if (typeof options.read === 'function') this._read = options.read;
|
1699 |
+
|
1700 |
+
if (typeof options.destroy === 'function') this._destroy = options.destroy;
|
1701 |
+
}
|
1702 |
+
|
1703 |
+
Stream.call(this);
|
1704 |
+
}
|
1705 |
+
|
1706 |
+
Object.defineProperty(Readable.prototype, 'destroyed', {
|
1707 |
+
get: function () {
|
1708 |
+
if (this._readableState === undefined) {
|
1709 |
+
return false;
|
1710 |
+
}
|
1711 |
+
return this._readableState.destroyed;
|
1712 |
+
},
|
1713 |
+
set: function (value) {
|
1714 |
+
// we ignore the value if the stream
|
1715 |
+
// has not been initialized yet
|
1716 |
+
if (!this._readableState) {
|
1717 |
+
return;
|
1718 |
+
}
|
1719 |
+
|
1720 |
+
// backward compatibility, the user is explicitly
|
1721 |
+
// managing destroyed
|
1722 |
+
this._readableState.destroyed = value;
|
1723 |
+
}
|
1724 |
+
});
|
1725 |
+
|
1726 |
+
Readable.prototype.destroy = destroyImpl.destroy;
|
1727 |
+
Readable.prototype._undestroy = destroyImpl.undestroy;
|
1728 |
+
Readable.prototype._destroy = function (err, cb) {
|
1729 |
+
this.push(null);
|
1730 |
+
cb(err);
|
1731 |
+
};
|
1732 |
+
|
1733 |
+
// Manually shove something into the read() buffer.
|
1734 |
+
// This returns true if the highWaterMark has not been hit yet,
|
1735 |
+
// similar to how Writable.write() returns true if you should
|
1736 |
+
// write() some more.
|
1737 |
+
Readable.prototype.push = function (chunk, encoding) {
|
1738 |
+
var state = this._readableState;
|
1739 |
+
var skipChunkCheck;
|
1740 |
+
|
1741 |
+
if (!state.objectMode) {
|
1742 |
+
if (typeof chunk === 'string') {
|
1743 |
+
encoding = encoding || state.defaultEncoding;
|
1744 |
+
if (encoding !== state.encoding) {
|
1745 |
+
chunk = Buffer.from(chunk, encoding);
|
1746 |
+
encoding = '';
|
1747 |
+
}
|
1748 |
+
skipChunkCheck = true;
|
1749 |
+
}
|
1750 |
+
} else {
|
1751 |
+
skipChunkCheck = true;
|
1752 |
+
}
|
1753 |
+
|
1754 |
+
return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);
|
1755 |
+
};
|
1756 |
+
|
1757 |
+
// Unshift should *always* be something directly out of read()
|
1758 |
+
Readable.prototype.unshift = function (chunk) {
|
1759 |
+
return readableAddChunk(this, chunk, null, true, false);
|
1760 |
+
};
|
1761 |
+
|
1762 |
+
function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
|
1763 |
+
var state = stream._readableState;
|
1764 |
+
if (chunk === null) {
|
1765 |
+
state.reading = false;
|
1766 |
+
onEofChunk(stream, state);
|
1767 |
+
} else {
|
1768 |
+
var er;
|
1769 |
+
if (!skipChunkCheck) er = chunkInvalid(state, chunk);
|
1770 |
+
if (er) {
|
1771 |
+
stream.emit('error', er);
|
1772 |
+
} else if (state.objectMode || chunk && chunk.length > 0) {
|
1773 |
+
if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {
|
1774 |
+
chunk = _uint8ArrayToBuffer(chunk);
|
1775 |
+
}
|
1776 |
+
|
1777 |
+
if (addToFront) {
|
1778 |
+
if (state.endEmitted) stream.emit('error', new Error('stream.unshift() after end event'));else addChunk(stream, state, chunk, true);
|
1779 |
+
} else if (state.ended) {
|
1780 |
+
stream.emit('error', new Error('stream.push() after EOF'));
|
1781 |
+
} else {
|
1782 |
+
state.reading = false;
|
1783 |
+
if (state.decoder && !encoding) {
|
1784 |
+
chunk = state.decoder.write(chunk);
|
1785 |
+
if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);
|
1786 |
+
} else {
|
1787 |
+
addChunk(stream, state, chunk, false);
|
1788 |
+
}
|
1789 |
+
}
|
1790 |
+
} else if (!addToFront) {
|
1791 |
+
state.reading = false;
|
1792 |
+
}
|
1793 |
+
}
|
1794 |
+
|
1795 |
+
return needMoreData(state);
|
1796 |
+
}
|
1797 |
+
|
1798 |
+
function addChunk(stream, state, chunk, addToFront) {
|
1799 |
+
if (state.flowing && state.length === 0 && !state.sync) {
|
1800 |
+
stream.emit('data', chunk);
|
1801 |
+
stream.read(0);
|
1802 |
+
} else {
|
1803 |
+
// update the buffer info.
|
1804 |
+
state.length += state.objectMode ? 1 : chunk.length;
|
1805 |
+
if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);
|
1806 |
+
|
1807 |
+
if (state.needReadable) emitReadable(stream);
|
1808 |
+
}
|
1809 |
+
maybeReadMore(stream, state);
|
1810 |
+
}
|
1811 |
+
|
1812 |
+
function chunkInvalid(state, chunk) {
|
1813 |
+
var er;
|
1814 |
+
if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
|
1815 |
+
er = new TypeError('Invalid non-string/buffer chunk');
|
1816 |
+
}
|
1817 |
+
return er;
|
1818 |
+
}
|
1819 |
+
|
1820 |
+
// if it's past the high water mark, we can push in some more.
|
1821 |
+
// Also, if we have no data yet, we can stand some
|
1822 |
+
// more bytes. This is to work around cases where hwm=0,
|
1823 |
+
// such as the repl. Also, if the push() triggered a
|
1824 |
+
// readable event, and the user called read(largeNumber) such that
|
1825 |
+
// needReadable was set, then we ought to push more, so that another
|
1826 |
+
// 'readable' event will be triggered.
|
1827 |
+
function needMoreData(state) {
|
1828 |
+
return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);
|
1829 |
+
}
|
1830 |
+
|
1831 |
+
Readable.prototype.isPaused = function () {
|
1832 |
+
return this._readableState.flowing === false;
|
1833 |
+
};
|
1834 |
+
|
1835 |
+
// backwards compatibility.
|
1836 |
+
Readable.prototype.setEncoding = function (enc) {
|
1837 |
+
if (!StringDecoder) StringDecoder = __webpack_require__(92).StringDecoder;
|
1838 |
+
this._readableState.decoder = new StringDecoder(enc);
|
1839 |
+
this._readableState.encoding = enc;
|
1840 |
+
return this;
|
1841 |
+
};
|
1842 |
+
|
1843 |
+
// Don't raise the hwm > 8MB
|
1844 |
+
var MAX_HWM = 0x800000;
|
1845 |
+
function computeNewHighWaterMark(n) {
|
1846 |
+
if (n >= MAX_HWM) {
|
1847 |
+
n = MAX_HWM;
|
1848 |
+
} else {
|
1849 |
+
// Get the next highest power of 2 to prevent increasing hwm excessively in
|
1850 |
+
// tiny amounts
|
1851 |
+
n--;
|
1852 |
+
n |= n >>> 1;
|
1853 |
+
n |= n >>> 2;
|
1854 |
+
n |= n >>> 4;
|
1855 |
+
n |= n >>> 8;
|
1856 |
+
n |= n >>> 16;
|
1857 |
+
n++;
|
1858 |
+
}
|
1859 |
+
return n;
|
1860 |
+
}
|
1861 |
+
|
1862 |
+
// This function is designed to be inlinable, so please take care when making
|
1863 |
+
// changes to the function body.
|
1864 |
+
function howMuchToRead(n, state) {
|
1865 |
+
if (n <= 0 || state.length === 0 && state.ended) return 0;
|
1866 |
+
if (state.objectMode) return 1;
|
1867 |
+
if (n !== n) {
|
1868 |
+
// Only flow one buffer at a time
|
1869 |
+
if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;
|
1870 |
+
}
|
1871 |
+
// If we're asking for more than the current hwm, then raise the hwm.
|
1872 |
+
if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
|
1873 |
+
if (n <= state.length) return n;
|
1874 |
+
// Don't have enough
|
1875 |
+
if (!state.ended) {
|
1876 |
+
state.needReadable = true;
|
1877 |
+
return 0;
|
1878 |
+
}
|
1879 |
+
return state.length;
|
1880 |
+
}
|
1881 |
+
|
1882 |
+
// you can override either this method, or the async _read(n) below.
|
1883 |
+
Readable.prototype.read = function (n) {
|
1884 |
+
debug('read', n);
|
1885 |
+
n = parseInt(n, 10);
|
1886 |
+
var state = this._readableState;
|
1887 |
+
var nOrig = n;
|
1888 |
+
|
1889 |
+
if (n !== 0) state.emittedReadable = false;
|
1890 |
+
|
1891 |
+
// if we're doing read(0) to trigger a readable event, but we
|
1892 |
+
// already have a bunch of data in the buffer, then just trigger
|
1893 |
+
// the 'readable' event and move on.
|
1894 |
+
if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {
|
1895 |
+
debug('read: emitReadable', state.length, state.ended);
|
1896 |
+
if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);
|
1897 |
+
return null;
|
1898 |
+
}
|
1899 |
+
|
1900 |
+
n = howMuchToRead(n, state);
|
1901 |
+
|
1902 |
+
// if we've ended, and we're now clear, then finish it up.
|
1903 |
+
if (n === 0 && state.ended) {
|
1904 |
+
if (state.length === 0) endReadable(this);
|
1905 |
+
return null;
|
1906 |
+
}
|
1907 |
+
|
1908 |
+
// All the actual chunk generation logic needs to be
|
1909 |
+
// *below* the call to _read. The reason is that in certain
|
1910 |
+
// synthetic stream cases, such as passthrough streams, _read
|
1911 |
+
// may be a completely synchronous operation which may change
|
1912 |
+
// the state of the read buffer, providing enough data when
|
1913 |
+
// before there was *not* enough.
|
1914 |
+
//
|
1915 |
+
// So, the steps are:
|
1916 |
+
// 1. Figure out what the state of things will be after we do
|
1917 |
+
// a read from the buffer.
|
1918 |
+
//
|
1919 |
+
// 2. If that resulting state will trigger a _read, then call _read.
|
1920 |
+
// Note that this may be asynchronous, or synchronous. Yes, it is
|
1921 |
+
// deeply ugly to write APIs this way, but that still doesn't mean
|
1922 |
+
// that the Readable class should behave improperly, as streams are
|
1923 |
+
// designed to be sync/async agnostic.
|
1924 |
+
// Take note if the _read call is sync or async (ie, if the read call
|
1925 |
+
// has returned yet), so that we know whether or not it's safe to emit
|
1926 |
+
// 'readable' etc.
|
1927 |
+
//
|
1928 |
+
// 3. Actually pull the requested chunks out of the buffer and return.
|
1929 |
+
|
1930 |
+
// if we need a readable event, then we need to do some reading.
|
1931 |
+
var doRead = state.needReadable;
|
1932 |
+
debug('need readable', doRead);
|
1933 |
+
|
1934 |
+
// if we currently have less than the highWaterMark, then also read some
|
1935 |
+
if (state.length === 0 || state.length - n < state.highWaterMark) {
|
1936 |
+
doRead = true;
|
1937 |
+
debug('length less than watermark', doRead);
|
1938 |
+
}
|
1939 |
+
|
1940 |
+
// however, if we've ended, then there's no point, and if we're already
|
1941 |
+
// reading, then it's unnecessary.
|
1942 |
+
if (state.ended || state.reading) {
|
1943 |
+
doRead = false;
|
1944 |
+
debug('reading or ended', doRead);
|
1945 |
+
} else if (doRead) {
|
1946 |
+
debug('do read');
|
1947 |
+
state.reading = true;
|
1948 |
+
state.sync = true;
|
1949 |
+
// if the length is currently zero, then we *need* a readable event.
|
1950 |
+
if (state.length === 0) state.needReadable = true;
|
1951 |
+
// call internal read method
|
1952 |
+
this._read(state.highWaterMark);
|
1953 |
+
state.sync = false;
|
1954 |
+
// If _read pushed data synchronously, then `reading` will be false,
|
1955 |
+
// and we need to re-evaluate how much data we can return to the user.
|
1956 |
+
if (!state.reading) n = howMuchToRead(nOrig, state);
|
1957 |
+
}
|
1958 |
+
|
1959 |
+
var ret;
|
1960 |
+
if (n > 0) ret = fromList(n, state);else ret = null;
|
1961 |
+
|
1962 |
+
if (ret === null) {
|
1963 |
+
state.needReadable = true;
|
1964 |
+
n = 0;
|
1965 |
+
} else {
|
1966 |
+
state.length -= n;
|
1967 |
+
}
|
1968 |
+
|
1969 |
+
if (state.length === 0) {
|
1970 |
+
// If we have nothing in the buffer, then we want to know
|
1971 |
+
// as soon as we *do* get something into the buffer.
|
1972 |
+
if (!state.ended) state.needReadable = true;
|
1973 |
+
|
1974 |
+
// If we tried to read() past the EOF, then emit end on the next tick.
|
1975 |
+
if (nOrig !== n && state.ended) endReadable(this);
|
1976 |
+
}
|
1977 |
+
|
1978 |
+
if (ret !== null) this.emit('data', ret);
|
1979 |
+
|
1980 |
+
return ret;
|
1981 |
+
};
|
1982 |
+
|
1983 |
+
function onEofChunk(stream, state) {
|
1984 |
+
if (state.ended) return;
|
1985 |
+
if (state.decoder) {
|
1986 |
+
var chunk = state.decoder.end();
|
1987 |
+
if (chunk && chunk.length) {
|
1988 |
+
state.buffer.push(chunk);
|
1989 |
+
state.length += state.objectMode ? 1 : chunk.length;
|
1990 |
+
}
|
1991 |
+
}
|
1992 |
+
state.ended = true;
|
1993 |
+
|
1994 |
+
// emit 'readable' now to make sure it gets picked up.
|
1995 |
+
emitReadable(stream);
|
1996 |
+
}
|
1997 |
+
|
1998 |
+
// Don't emit readable right away in sync mode, because this can trigger
|
1999 |
+
// another read() call => stack overflow. This way, it might trigger
|
2000 |
+
// a nextTick recursion warning, but that's not so bad.
|
2001 |
+
function emitReadable(stream) {
|
2002 |
+
var state = stream._readableState;
|
2003 |
+
state.needReadable = false;
|
2004 |
+
if (!state.emittedReadable) {
|
2005 |
+
debug('emitReadable', state.flowing);
|
2006 |
+
state.emittedReadable = true;
|
2007 |
+
if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream);
|
2008 |
+
}
|
2009 |
+
}
|
2010 |
+
|
2011 |
+
function emitReadable_(stream) {
|
2012 |
+
debug('emit readable');
|
2013 |
+
stream.emit('readable');
|
2014 |
+
flow(stream);
|
2015 |
+
}
|
2016 |
+
|
2017 |
+
// at this point, the user has presumably seen the 'readable' event,
|
2018 |
+
// and called read() to consume some data. that may have triggered
|
2019 |
+
// in turn another _read(n) call, in which case reading = true if
|
2020 |
+
// it's in progress.
|
2021 |
+
// However, if we're not ended, or reading, and the length < hwm,
|
2022 |
+
// then go ahead and try to read some more preemptively.
|
2023 |
+
function maybeReadMore(stream, state) {
|
2024 |
+
if (!state.readingMore) {
|
2025 |
+
state.readingMore = true;
|
2026 |
+
processNextTick(maybeReadMore_, stream, state);
|
2027 |
+
}
|
2028 |
+
}
|
2029 |
+
|
2030 |
+
function maybeReadMore_(stream, state) {
|
2031 |
+
var len = state.length;
|
2032 |
+
while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {
|
2033 |
+
debug('maybeReadMore read 0');
|
2034 |
+
stream.read(0);
|
2035 |
+
if (len === state.length)
|
2036 |
+
// didn't get any data, stop spinning.
|
2037 |
+
break;else len = state.length;
|
2038 |
+
}
|
2039 |
+
state.readingMore = false;
|
2040 |
+
}
|
2041 |
+
|
2042 |
+
// abstract method. to be overridden in specific implementation classes.
|
2043 |
+
// call cb(er, data) where data is <= n in length.
|
2044 |
+
// for virtual (non-string, non-buffer) streams, "length" is somewhat
|
2045 |
+
// arbitrary, and perhaps not very meaningful.
|
2046 |
+
Readable.prototype._read = function (n) {
|
2047 |
+
this.emit('error', new Error('_read() is not implemented'));
|
2048 |
+
};
|
2049 |
+
|
2050 |
+
Readable.prototype.pipe = function (dest, pipeOpts) {
|
2051 |
+
var src = this;
|
2052 |
+
var state = this._readableState;
|
2053 |
+
|
2054 |
+
switch (state.pipesCount) {
|
2055 |
+
case 0:
|
2056 |
+
state.pipes = dest;
|
2057 |
+
break;
|
2058 |
+
case 1:
|
2059 |
+
state.pipes = [state.pipes, dest];
|
2060 |
+
break;
|
2061 |
+
default:
|
2062 |
+
state.pipes.push(dest);
|
2063 |
+
break;
|
2064 |
+
}
|
2065 |
+
state.pipesCount += 1;
|
2066 |
+
debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);
|
2067 |
+
|
2068 |
+
var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
|
2069 |
+
|
2070 |
+
var endFn = doEnd ? onend : unpipe;
|
2071 |
+
if (state.endEmitted) processNextTick(endFn);else src.once('end', endFn);
|
2072 |
+
|
2073 |
+
dest.on('unpipe', onunpipe);
|
2074 |
+
function onunpipe(readable, unpipeInfo) {
|
2075 |
+
debug('onunpipe');
|
2076 |
+
if (readable === src) {
|
2077 |
+
if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
|
2078 |
+
unpipeInfo.hasUnpiped = true;
|
2079 |
+
cleanup();
|
2080 |
+
}
|
2081 |
+
}
|
2082 |
+
}
|
2083 |
+
|
2084 |
+
function onend() {
|
2085 |
+
debug('onend');
|
2086 |
+
dest.end();
|
2087 |
+
}
|
2088 |
+
|
2089 |
+
// when the dest drains, it reduces the awaitDrain counter
|
2090 |
+
// on the source. This would be more elegant with a .once()
|
2091 |
+
// handler in flow(), but adding and removing repeatedly is
|
2092 |
+
// too slow.
|
2093 |
+
var ondrain = pipeOnDrain(src);
|
2094 |
+
dest.on('drain', ondrain);
|
2095 |
+
|
2096 |
+
var cleanedUp = false;
|
2097 |
+
function cleanup() {
|
2098 |
+
debug('cleanup');
|
2099 |
+
// cleanup event handlers once the pipe is broken
|
2100 |
+
dest.removeListener('close', onclose);
|
2101 |
+
dest.removeListener('finish', onfinish);
|
2102 |
+
dest.removeListener('drain', ondrain);
|
2103 |
+
dest.removeListener('error', onerror);
|
2104 |
+
dest.removeListener('unpipe', onunpipe);
|
2105 |
+
src.removeListener('end', onend);
|
2106 |
+
src.removeListener('end', unpipe);
|
2107 |
+
src.removeListener('data', ondata);
|
2108 |
+
|
2109 |
+
cleanedUp = true;
|
2110 |
+
|
2111 |
+
// if the reader is waiting for a drain event from this
|
2112 |
+
// specific writer, then it would cause it to never start
|
2113 |
+
// flowing again.
|
2114 |
+
// So, if this is awaiting a drain, then we just call it now.
|
2115 |
+
// If we don't know, then assume that we are waiting for one.
|
2116 |
+
if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
|
2117 |
+
}
|
2118 |
+
|
2119 |
+
// If the user pushes more data while we're writing to dest then we'll end up
|
2120 |
+
// in ondata again. However, we only want to increase awaitDrain once because
|
2121 |
+
// dest will only emit one 'drain' event for the multiple writes.
|
2122 |
+
// => Introduce a guard on increasing awaitDrain.
|
2123 |
+
var increasedAwaitDrain = false;
|
2124 |
+
src.on('data', ondata);
|
2125 |
+
function ondata(chunk) {
|
2126 |
+
debug('ondata');
|
2127 |
+
increasedAwaitDrain = false;
|
2128 |
+
var ret = dest.write(chunk);
|
2129 |
+
if (false === ret && !increasedAwaitDrain) {
|
2130 |
+
// If the user unpiped during `dest.write()`, it is possible
|
2131 |
+
// to get stuck in a permanently paused state if that write
|
2132 |
+
// also returned false.
|
2133 |
+
// => Check whether `dest` is still a piping destination.
|
2134 |
+
if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
|
2135 |
+
debug('false write response, pause', src._readableState.awaitDrain);
|
2136 |
+
src._readableState.awaitDrain++;
|
2137 |
+
increasedAwaitDrain = true;
|
2138 |
+
}
|
2139 |
+
src.pause();
|
2140 |
+
}
|
2141 |
+
}
|
2142 |
+
|
2143 |
+
// if the dest has an error, then stop piping into it.
|
2144 |
+
// however, don't suppress the throwing behavior for this.
|
2145 |
+
function onerror(er) {
|
2146 |
+
debug('onerror', er);
|
2147 |
+
unpipe();
|
2148 |
+
dest.removeListener('error', onerror);
|
2149 |
+
if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);
|
2150 |
+
}
|
2151 |
+
|
2152 |
+
// Make sure our error handler is attached before userland ones.
|
2153 |
+
prependListener(dest, 'error', onerror);
|
2154 |
+
|
2155 |
+
// Both close and finish should trigger unpipe, but only once.
|
2156 |
+
function onclose() {
|
2157 |
+
dest.removeListener('finish', onfinish);
|
2158 |
+
unpipe();
|
2159 |
+
}
|
2160 |
+
dest.once('close', onclose);
|
2161 |
+
function onfinish() {
|
2162 |
+
debug('onfinish');
|
2163 |
+
dest.removeListener('close', onclose);
|
2164 |
+
unpipe();
|
2165 |
+
}
|
2166 |
+
dest.once('finish', onfinish);
|
2167 |
+
|
2168 |
+
function unpipe() {
|
2169 |
+
debug('unpipe');
|
2170 |
+
src.unpipe(dest);
|
2171 |
+
}
|
2172 |
+
|
2173 |
+
// tell the dest that it's being piped to
|
2174 |
+
dest.emit('pipe', src);
|
2175 |
+
|
2176 |
+
// start the flow if it hasn't been started already.
|
2177 |
+
if (!state.flowing) {
|
2178 |
+
debug('pipe resume');
|
2179 |
+
src.resume();
|
2180 |
+
}
|
2181 |
+
|
2182 |
+
return dest;
|
2183 |
+
};
|
2184 |
+
|
2185 |
+
function pipeOnDrain(src) {
|
2186 |
+
return function () {
|
2187 |
+
var state = src._readableState;
|
2188 |
+
debug('pipeOnDrain', state.awaitDrain);
|
2189 |
+
if (state.awaitDrain) state.awaitDrain--;
|
2190 |
+
if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {
|
2191 |
+
state.flowing = true;
|
2192 |
+
flow(src);
|
2193 |
+
}
|
2194 |
+
};
|
2195 |
+
}
|
2196 |
+
|
2197 |
+
Readable.prototype.unpipe = function (dest) {
|
2198 |
+
var state = this._readableState;
|
2199 |
+
var unpipeInfo = { hasUnpiped: false };
|
2200 |
+
|
2201 |
+
// if we're not piping anywhere, then do nothing.
|
2202 |
+
if (state.pipesCount === 0) return this;
|
2203 |
+
|
2204 |
+
// just one destination. most common case.
|
2205 |
+
if (state.pipesCount === 1) {
|
2206 |
+
// passed in one, but it's not the right one.
|
2207 |
+
if (dest && dest !== state.pipes) return this;
|
2208 |
+
|
2209 |
+
if (!dest) dest = state.pipes;
|
2210 |
+
|
2211 |
+
// got a match.
|
2212 |
+
state.pipes = null;
|
2213 |
+
state.pipesCount = 0;
|
2214 |
+
state.flowing = false;
|
2215 |
+
if (dest) dest.emit('unpipe', this, unpipeInfo);
|
2216 |
+
return this;
|
2217 |
+
}
|
2218 |
+
|
2219 |
+
// slow case. multiple pipe destinations.
|
2220 |
+
|
2221 |
+
if (!dest) {
|
2222 |
+
// remove all.
|
2223 |
+
var dests = state.pipes;
|
2224 |
+
var len = state.pipesCount;
|
2225 |
+
state.pipes = null;
|
2226 |
+
state.pipesCount = 0;
|
2227 |
+
state.flowing = false;
|
2228 |
+
|
2229 |
+
for (var i = 0; i < len; i++) {
|
2230 |
+
dests[i].emit('unpipe', this, unpipeInfo);
|
2231 |
+
}return this;
|
2232 |
+
}
|
2233 |
+
|
2234 |
+
// try to find the right one.
|
2235 |
+
var index = indexOf(state.pipes, dest);
|
2236 |
+
if (index === -1) return this;
|
2237 |
+
|
2238 |
+
state.pipes.splice(index, 1);
|
2239 |
+
state.pipesCount -= 1;
|
2240 |
+
if (state.pipesCount === 1) state.pipes = state.pipes[0];
|
2241 |
+
|
2242 |
+
dest.emit('unpipe', this, unpipeInfo);
|
2243 |
+
|
2244 |
+
return this;
|
2245 |
+
};
|
2246 |
+
|
2247 |
+
// set up data events if they are asked for
|
2248 |
+
// Ensure readable listeners eventually get something
|
2249 |
+
Readable.prototype.on = function (ev, fn) {
|
2250 |
+
var res = Stream.prototype.on.call(this, ev, fn);
|
2251 |
+
|
2252 |
+
if (ev === 'data') {
|
2253 |
+
// Start flowing on next tick if stream isn't explicitly paused
|
2254 |
+
if (this._readableState.flowing !== false) this.resume();
|
2255 |
+
} else if (ev === 'readable') {
|
2256 |
+
var state = this._readableState;
|
2257 |
+
if (!state.endEmitted && !state.readableListening) {
|
2258 |
+
state.readableListening = state
|