forked from svgdotjs/svgdom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main-require.cjs
5040 lines (3934 loc) · 181 KB
/
main-require.cjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
(function(e, a) { for(var i in a) e[i] = a[i]; }(exports, /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = "./main-module.js");
/******/ })
/************************************************************************/
/******/ ({
/***/ "./dirname.cjs":
/*!******************************************!*\
!*** external "./src/utils/dirname.cjs" ***!
\******************************************/
/*! no static exports found */
/***/ (function(module, exports) {
module.exports = require("./src/utils/dirname.cjs");
/***/ }),
/***/ "./main-module.js":
/*!************************!*\
!*** ./main-module.js ***!
\************************/
/*! exports provided: Attr, CharacterData, Comment, CustomEvent, DOMImplementation, Document, DocumentFragment, Element, Event, EventTarget, Node, NodeFilter, Text, Window, HTMLElement, HTMLImageElement, HTMLLinkElement, HTMLParser, HTMLScriptElement, elementAccess, ParentNode, SVGElement, SVGGraphicsElement, matrixFactory, SVGMatrix, SVGPathElement, SVGPoint, SVGSVGElement, SVGTextContentElement, setFontDir, setFontFamilyMappings, preloadFonts, getConfig, getFonts, config, createDocument, createHTMLDocument, createSVGDocument, createWindow, createHTMLWindow, createSVGWindow, defaults */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _src_utils_defaults_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./src/utils/defaults.js */ "./src/utils/defaults.js");
/* harmony reexport (module object) */ __webpack_require__.d(__webpack_exports__, "defaults", function() { return _src_utils_defaults_js__WEBPACK_IMPORTED_MODULE_0__; });
/* harmony import */ var _src_dom_Attr_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./src/dom/Attr.js */ "./src/dom/Attr.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Attr", function() { return _src_dom_Attr_js__WEBPACK_IMPORTED_MODULE_1__["Attr"]; });
/* harmony import */ var _src_dom_CharacterData_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./src/dom/CharacterData.js */ "./src/dom/CharacterData.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CharacterData", function() { return _src_dom_CharacterData_js__WEBPACK_IMPORTED_MODULE_2__["CharacterData"]; });
/* harmony import */ var _src_dom_Comment_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./src/dom/Comment.js */ "./src/dom/Comment.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Comment", function() { return _src_dom_Comment_js__WEBPACK_IMPORTED_MODULE_3__["Comment"]; });
/* harmony import */ var _src_dom_CustomEvent_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./src/dom/CustomEvent.js */ "./src/dom/CustomEvent.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CustomEvent", function() { return _src_dom_CustomEvent_js__WEBPACK_IMPORTED_MODULE_4__["CustomEvent"]; });
/* harmony import */ var _src_dom_Document_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./src/dom/Document.js */ "./src/dom/Document.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DOMImplementation", function() { return _src_dom_Document_js__WEBPACK_IMPORTED_MODULE_5__["DOMImplementation"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Document", function() { return _src_dom_Document_js__WEBPACK_IMPORTED_MODULE_5__["Document"]; });
/* harmony import */ var _src_dom_DocumentFragment_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./src/dom/DocumentFragment.js */ "./src/dom/DocumentFragment.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DocumentFragment", function() { return _src_dom_DocumentFragment_js__WEBPACK_IMPORTED_MODULE_6__["DocumentFragment"]; });
/* harmony import */ var _src_dom_Element_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./src/dom/Element.js */ "./src/dom/Element.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Element", function() { return _src_dom_Element_js__WEBPACK_IMPORTED_MODULE_7__["Element"]; });
/* harmony import */ var _src_dom_Event_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./src/dom/Event.js */ "./src/dom/Event.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Event", function() { return _src_dom_Event_js__WEBPACK_IMPORTED_MODULE_8__["Event"]; });
/* harmony import */ var _src_dom_EventTarget_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./src/dom/EventTarget.js */ "./src/dom/EventTarget.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "EventTarget", function() { return _src_dom_EventTarget_js__WEBPACK_IMPORTED_MODULE_9__["EventTarget"]; });
/* harmony import */ var _src_dom_Node_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./src/dom/Node.js */ "./src/dom/Node.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Node", function() { return _src_dom_Node_js__WEBPACK_IMPORTED_MODULE_10__["Node"]; });
/* harmony import */ var _src_dom_NodeFilter_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./src/dom/NodeFilter.js */ "./src/dom/NodeFilter.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "NodeFilter", function() { return _src_dom_NodeFilter_js__WEBPACK_IMPORTED_MODULE_11__["NodeFilter"]; });
/* harmony import */ var _src_dom_Text_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./src/dom/Text.js */ "./src/dom/Text.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Text", function() { return _src_dom_Text_js__WEBPACK_IMPORTED_MODULE_12__["Text"]; });
/* harmony import */ var _src_dom_Window_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./src/dom/Window.js */ "./src/dom/Window.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Window", function() { return _src_dom_Window_js__WEBPACK_IMPORTED_MODULE_13__["Window"]; });
/* harmony import */ var _src_dom_html_HTMLElement_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./src/dom/html/HTMLElement.js */ "./src/dom/html/HTMLElement.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "HTMLElement", function() { return _src_dom_html_HTMLElement_js__WEBPACK_IMPORTED_MODULE_14__["HTMLElement"]; });
/* harmony import */ var _src_dom_html_HTMLImageElement_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./src/dom/html/HTMLImageElement.js */ "./src/dom/html/HTMLImageElement.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "HTMLImageElement", function() { return _src_dom_html_HTMLImageElement_js__WEBPACK_IMPORTED_MODULE_15__["HTMLImageElement"]; });
/* harmony import */ var _src_dom_html_HTMLLinkElement_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./src/dom/html/HTMLLinkElement.js */ "./src/dom/html/HTMLLinkElement.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "HTMLLinkElement", function() { return _src_dom_html_HTMLLinkElement_js__WEBPACK_IMPORTED_MODULE_16__["HTMLLinkElement"]; });
/* harmony import */ var _src_dom_html_HTMLParser_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./src/dom/html/HTMLParser.js */ "./src/dom/html/HTMLParser.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "HTMLParser", function() { return _src_dom_html_HTMLParser_js__WEBPACK_IMPORTED_MODULE_17__["HTMLParser"]; });
/* harmony import */ var _src_dom_html_HTMLScriptElement_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./src/dom/html/HTMLScriptElement.js */ "./src/dom/html/HTMLScriptElement.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "HTMLScriptElement", function() { return _src_dom_html_HTMLScriptElement_js__WEBPACK_IMPORTED_MODULE_18__["HTMLScriptElement"]; });
/* harmony import */ var _src_dom_mixins_elementAccess_js__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./src/dom/mixins/elementAccess.js */ "./src/dom/mixins/elementAccess.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "elementAccess", function() { return _src_dom_mixins_elementAccess_js__WEBPACK_IMPORTED_MODULE_19__["elementAccess"]; });
/* harmony import */ var _src_dom_mixins_ParentNode_js__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./src/dom/mixins/ParentNode.js */ "./src/dom/mixins/ParentNode.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ParentNode", function() { return _src_dom_mixins_ParentNode_js__WEBPACK_IMPORTED_MODULE_20__["ParentNode"]; });
/* harmony import */ var _src_dom_svg_SVGElement_js__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./src/dom/svg/SVGElement.js */ "./src/dom/svg/SVGElement.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SVGElement", function() { return _src_dom_svg_SVGElement_js__WEBPACK_IMPORTED_MODULE_21__["SVGElement"]; });
/* harmony import */ var _src_dom_svg_SVGGraphicsElement_js__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./src/dom/svg/SVGGraphicsElement.js */ "./src/dom/svg/SVGGraphicsElement.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SVGGraphicsElement", function() { return _src_dom_svg_SVGGraphicsElement_js__WEBPACK_IMPORTED_MODULE_22__["SVGGraphicsElement"]; });
/* harmony import */ var _src_dom_svg_SVGMatrix_js__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./src/dom/svg/SVGMatrix.js */ "./src/dom/svg/SVGMatrix.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "matrixFactory", function() { return _src_dom_svg_SVGMatrix_js__WEBPACK_IMPORTED_MODULE_23__["matrixFactory"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SVGMatrix", function() { return _src_dom_svg_SVGMatrix_js__WEBPACK_IMPORTED_MODULE_23__["SVGMatrix"]; });
/* harmony import */ var _src_dom_svg_SVGPathElement_js__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./src/dom/svg/SVGPathElement.js */ "./src/dom/svg/SVGPathElement.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SVGPathElement", function() { return _src_dom_svg_SVGPathElement_js__WEBPACK_IMPORTED_MODULE_24__["SVGPathElement"]; });
/* harmony import */ var _src_dom_svg_SVGPoint_js__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./src/dom/svg/SVGPoint.js */ "./src/dom/svg/SVGPoint.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SVGPoint", function() { return _src_dom_svg_SVGPoint_js__WEBPACK_IMPORTED_MODULE_25__["SVGPoint"]; });
/* harmony import */ var _src_dom_svg_SVGSVGElement_js__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./src/dom/svg/SVGSVGElement.js */ "./src/dom/svg/SVGSVGElement.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SVGSVGElement", function() { return _src_dom_svg_SVGSVGElement_js__WEBPACK_IMPORTED_MODULE_26__["SVGSVGElement"]; });
/* harmony import */ var _src_dom_svg_SVGTextContentElement_js__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./src/dom/svg/SVGTextContentElement.js */ "./src/dom/svg/SVGTextContentElement.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SVGTextContentElement", function() { return _src_dom_svg_SVGTextContentElement_js__WEBPACK_IMPORTED_MODULE_27__["SVGTextContentElement"]; });
/* harmony import */ var _src_config_js__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./src/config.js */ "./src/config.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "setFontDir", function() { return _src_config_js__WEBPACK_IMPORTED_MODULE_28__["setFontDir"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "setFontFamilyMappings", function() { return _src_config_js__WEBPACK_IMPORTED_MODULE_28__["setFontFamilyMappings"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "preloadFonts", function() { return _src_config_js__WEBPACK_IMPORTED_MODULE_28__["preloadFonts"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getConfig", function() { return _src_config_js__WEBPACK_IMPORTED_MODULE_28__["getConfig"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getFonts", function() { return _src_config_js__WEBPACK_IMPORTED_MODULE_28__["getFonts"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "config", function() { return _src_config_js__WEBPACK_IMPORTED_MODULE_28__["config"]; });
/* harmony import */ var _src_factories_js__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./src/factories.js */ "./src/factories.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "createDocument", function() { return _src_factories_js__WEBPACK_IMPORTED_MODULE_29__["createDocument"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "createHTMLDocument", function() { return _src_factories_js__WEBPACK_IMPORTED_MODULE_29__["createHTMLDocument"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "createSVGDocument", function() { return _src_factories_js__WEBPACK_IMPORTED_MODULE_29__["createSVGDocument"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "createWindow", function() { return _src_factories_js__WEBPACK_IMPORTED_MODULE_29__["createWindow"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "createHTMLWindow", function() { return _src_factories_js__WEBPACK_IMPORTED_MODULE_29__["createHTMLWindow"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "createSVGWindow", function() { return _src_factories_js__WEBPACK_IMPORTED_MODULE_29__["createSVGWindow"]; });
/***/ }),
/***/ "./src/config.js":
/*!***********************!*\
!*** ./src/config.js ***!
\***********************/
/*! exports provided: setFontDir, setFontFamilyMappings, preloadFonts, getConfig, getFonts, config */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setFontDir", function() { return setFontDir; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setFontFamilyMappings", function() { return setFontFamilyMappings; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "preloadFonts", function() { return preloadFonts; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getConfig", function() { return getConfig; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getFonts", function() { return getFonts; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "config", function() { return config; });
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! path */ "path");
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var fontkit__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! fontkit */ "fontkit");
/* harmony import */ var fontkit__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(fontkit__WEBPACK_IMPORTED_MODULE_1__);
const _config = {}
const fonts = {}
const setFontDir = function (dir) {
_config.fontDir = dir
return this
}
const setFontFamilyMappings = function (map) {
_config.fontFamilyMappings = map
return this
}
// TODO: make async
const preloadFonts = () => {
var map = _config.fontFamilyMappings
for (const [ font, file ] of Object.entries(map)) {
const filename = path__WEBPACK_IMPORTED_MODULE_0___default.a.join(_config.fontDir, file)
try {
fonts[font] = fontkit__WEBPACK_IMPORTED_MODULE_1___default.a.openSync(filename)
} catch (e) {
console.warn(`Could not load font file for ${font}`, e)
}
}
return undefined
}
const getConfig = () => _config
const getFonts = () => fonts
const config = {
setFontDir,
setFontFamilyMappings,
preloadFonts,
getConfig,
getFonts
}
/***/ }),
/***/ "./src/dom/Attr.js":
/*!*************************!*\
!*** ./src/dom/Attr.js ***!
\*************************/
/*! exports provided: Attr */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Attr", function() { return Attr; });
/* harmony import */ var _Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Node.js */ "./src/dom/Node.js");
/* harmony import */ var _utils_namespaces_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils/namespaces.js */ "./src/utils/namespaces.js");
class Attr extends _Node_js__WEBPACK_IMPORTED_MODULE_0__["Node"] {
constructor (name, props, ns) {
super(name, { nodeValue: '', ...props }, ns)
// Follow spec and lowercase nodeName for html
this.nodeName = ns === _utils_namespaces_js__WEBPACK_IMPORTED_MODULE_1__["html"] ? name.toLowerCase() : name
this.nodeType = _Node_js__WEBPACK_IMPORTED_MODULE_0__["Node"].ATTRIBUTE_NODE
this.ownerElement = null
}
get value () {
return this.nodeValue
}
set value (val) {
this.nodeValue = val
}
get name () {
return this.nodeName
}
}
/***/ }),
/***/ "./src/dom/CharacterData.js":
/*!**********************************!*\
!*** ./src/dom/CharacterData.js ***!
\**********************************/
/*! exports provided: CharacterData */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CharacterData", function() { return CharacterData; });
/* harmony import */ var _Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Node.js */ "./src/dom/Node.js");
/* harmony import */ var _utils_objectCreationUtils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils/objectCreationUtils.js */ "./src/utils/objectCreationUtils.js");
/* harmony import */ var _mixins_NonDocumentTypeChildNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./mixins/NonDocumentTypeChildNode.js */ "./src/dom/mixins/NonDocumentTypeChildNode.js");
/* harmony import */ var _mixins_ChildNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./mixins/ChildNode.js */ "./src/dom/mixins/ChildNode.js");
class CharacterData extends _Node_js__WEBPACK_IMPORTED_MODULE_0__["Node"] {
constructor (name, props) {
super(name, props)
this.data = this.nodeValue
}
appendData (data) {
this.data += data
}
deleteData (offset, count) {
this.data = this.data.slice(0, offset) + this.data.slice(0, offset + count)
}
insertData (offset, data) {
this.data = this.data.slice(0, offset) + data + this.data.slice(offset)
}
replaceData (offset, count, data) {
this.deleteData(offset, count)
this.insertData(offset, data)
}
substringData (offset, count) {
this.data = this.data.substr(offset, count)
}
get length () {
return this.data.length
}
}
Object(_utils_objectCreationUtils_js__WEBPACK_IMPORTED_MODULE_1__["mixin"])(_mixins_NonDocumentTypeChildNode_js__WEBPACK_IMPORTED_MODULE_2__["NonDocumentTypeChildNode"], CharacterData)
Object(_utils_objectCreationUtils_js__WEBPACK_IMPORTED_MODULE_1__["mixin"])(_mixins_ChildNode_js__WEBPACK_IMPORTED_MODULE_3__["ChildNode"], CharacterData)
/***/ }),
/***/ "./src/dom/Comment.js":
/*!****************************!*\
!*** ./src/dom/Comment.js ***!
\****************************/
/*! exports provided: Comment */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Comment", function() { return Comment; });
/* harmony import */ var _CharacterData_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./CharacterData.js */ "./src/dom/CharacterData.js");
/* harmony import */ var _Node_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Node.js */ "./src/dom/Node.js");
class Comment extends _CharacterData_js__WEBPACK_IMPORTED_MODULE_0__["CharacterData"] {
constructor (name, props) {
super(name, props)
this.nodeType = _Node_js__WEBPACK_IMPORTED_MODULE_1__["Node"].COMMENT_NODE
}
}
/***/ }),
/***/ "./src/dom/CustomEvent.js":
/*!********************************!*\
!*** ./src/dom/CustomEvent.js ***!
\********************************/
/*! exports provided: CustomEvent */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CustomEvent", function() { return CustomEvent; });
/* harmony import */ var _Event_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Event.js */ "./src/dom/Event.js");
class CustomEvent extends _Event_js__WEBPACK_IMPORTED_MODULE_0__["Event"] {
constructor (name, props = {}) {
super(name)
this.detail = props.detail || null
this.cancelable = props.cancelable || false
}
}
/***/ }),
/***/ "./src/dom/Document.js":
/*!*****************************!*\
!*** ./src/dom/Document.js ***!
\*****************************/
/*! exports provided: DOMImplementation, Document */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DOMImplementation", function() { return DOMImplementation; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Document", function() { return Document; });
/* harmony import */ var _Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Node.js */ "./src/dom/Node.js");
/* harmony import */ var _Comment_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Comment.js */ "./src/dom/Comment.js");
/* harmony import */ var _Text_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Text.js */ "./src/dom/Text.js");
/* harmony import */ var _Attr_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Attr.js */ "./src/dom/Attr.js");
/* harmony import */ var _DocumentFragment_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./DocumentFragment.js */ "./src/dom/DocumentFragment.js");
/* harmony import */ var _html_HTMLLinkElement_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./html/HTMLLinkElement.js */ "./src/dom/html/HTMLLinkElement.js");
/* harmony import */ var _html_HTMLScriptElement_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./html/HTMLScriptElement.js */ "./src/dom/html/HTMLScriptElement.js");
/* harmony import */ var _html_HTMLImageElement_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./html/HTMLImageElement.js */ "./src/dom/html/HTMLImageElement.js");
/* harmony import */ var _html_HTMLElement_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./html/HTMLElement.js */ "./src/dom/html/HTMLElement.js");
/* harmony import */ var _mixins_elementAccess_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./mixins/elementAccess.js */ "./src/dom/mixins/elementAccess.js");
/* harmony import */ var _utils_objectCreationUtils_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../utils/objectCreationUtils.js */ "./src/utils/objectCreationUtils.js");
/* harmony import */ var _svg_SVGSVGElement_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./svg/SVGSVGElement.js */ "./src/dom/svg/SVGSVGElement.js");
/* harmony import */ var _svg_SVGPathElement_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./svg/SVGPathElement.js */ "./src/dom/svg/SVGPathElement.js");
/* harmony import */ var _svg_SVGTextContentElement_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./svg/SVGTextContentElement.js */ "./src/dom/svg/SVGTextContentElement.js");
/* harmony import */ var _svg_SVGGraphicsElement_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./svg/SVGGraphicsElement.js */ "./src/dom/svg/SVGGraphicsElement.js");
/* harmony import */ var _mixins_ParentNode_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./mixins/ParentNode.js */ "./src/dom/mixins/ParentNode.js");
/* harmony import */ var _utils_namespaces_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../utils/namespaces.js */ "./src/utils/namespaces.js");
/* harmony import */ var _DocumentType_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./DocumentType.js */ "./src/dom/DocumentType.js");
/* harmony import */ var _mixins_NonElementParentNode_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./mixins/NonElementParentNode.js */ "./src/dom/mixins/NonElementParentNode.js");
function getChildByTagName (parent, name) {
for (var child = parent.firstChild; child != null; child = child.nextSibling) {
if (child.nodeType === _Node_js__WEBPACK_IMPORTED_MODULE_0__["Node"].ELEMENT_NODE && child.nodeName === name) {
return child
}
}
return null
}
const getSVGElementForName = (name) => {
switch (name.toLowerCase()) {
case 'svg':
return _svg_SVGSVGElement_js__WEBPACK_IMPORTED_MODULE_11__["SVGSVGElement"]
case 'path':
return _svg_SVGPathElement_js__WEBPACK_IMPORTED_MODULE_12__["SVGPathElement"]
case 'text':
case 'tspan':
case 'tref':
case 'altglyph':
case 'textpath':
return _svg_SVGTextContentElement_js__WEBPACK_IMPORTED_MODULE_13__["SVGTextContentElement"]
default:
return _svg_SVGGraphicsElement_js__WEBPACK_IMPORTED_MODULE_14__["SVGGraphicsElement"]
}
}
const getHTMLElementForName = (name) => {
switch (name.toLowerCase()) {
case 'img':
return _html_HTMLImageElement_js__WEBPACK_IMPORTED_MODULE_7__["HTMLImageElement"]
case 'link':
return _html_HTMLLinkElement_js__WEBPACK_IMPORTED_MODULE_5__["HTMLLinkElement"]
case 'script':
return _html_HTMLScriptElement_js__WEBPACK_IMPORTED_MODULE_6__["HTMLScriptElement"]
default:
return _html_HTMLElement_js__WEBPACK_IMPORTED_MODULE_8__["HTMLElement"]
}
}
const getElementForNamespace = (ns, name) => {
switch (ns) {
case _utils_namespaces_js__WEBPACK_IMPORTED_MODULE_16__["svg"]:
return getSVGElementForName(name)
case _utils_namespaces_js__WEBPACK_IMPORTED_MODULE_16__["html"]:
case null:
case '':
default:
return getHTMLElementForName(name)
}
}
// Feature/version pairs that DOMImplementation.hasFeature() returns true for. It returns false for anything else.
var supportedFeatures = {
xml: { '': true, '1.0': true, '2.0': true },
core: { '': true, '2.0': true },
html: { '': true, '1.0': true, '2.0': true },
xhtml: { '': true, '1.0': true, '2.0': true } // HTML
}
const DOMImplementation = {
hasFeature (feature, version) {
var f = supportedFeatures[(feature || '').toLowerCase()]
return (f && f[version || '']) || false
},
createDocumentType (qualifiedName, publicId, systemId) {
return new _DocumentType_js__WEBPACK_IMPORTED_MODULE_17__["DocumentType"](qualifiedName, { publicId, systemId, ownerDocument: this })
},
createDocument (namespace, qualifiedName, doctype) {
var doc = new Document(namespace)
if (doctype) {
if (doctype.ownerDocument) {
throw new Error('the object is in the wrong Document, a call to importNode is required')
}
doctype.ownerDocument = doc
doc.appendChild(doctype)
}
if (qualifiedName) {
doc.appendChild(doc.createElementNS(namespace, qualifiedName))
}
return doc
},
createHTMLDocument (titleText = '') {
const d = new Document(_utils_namespaces_js__WEBPACK_IMPORTED_MODULE_16__["html"])
const root = d.createElement('html')
const head = d.createElement('head')
const title = d.createElement('title')
title.appendChild(d.createTextNode(titleText))
head.appendChild(title)
root.appendChild(head)
root.appendChild(d.createElement('body'))
d.appendChild(root)
return d
}
}
class Document extends _Node_js__WEBPACK_IMPORTED_MODULE_0__["Node"] {
constructor (ns) {
super('#document', {}, ns)
this.nodeType = _Node_js__WEBPACK_IMPORTED_MODULE_0__["Node"].DOCUMENT_NODE
this.implementation = DOMImplementation
this.defaultView = null
}
// https://dom.spec.whatwg.org/#dom-document-createattribute
createAttribute (localName) {
if (this.namespaceURI === _utils_namespaces_js__WEBPACK_IMPORTED_MODULE_16__["html"]) {
localName = localName.toLowerCase()
}
return this.createAttributeNS(null, localName, true)
}
createAttributeNS (ns, qualifiedName, local = false) {
return new _Attr_js__WEBPACK_IMPORTED_MODULE_3__["Attr"](qualifiedName, { ownerDocument: this, local }, ns)
}
createComment (text) {
return new _Comment_js__WEBPACK_IMPORTED_MODULE_1__["Comment"]('#comment', { nodeValue: text, ownerDocument: this })
}
createDocumentFragment (name) {
return new _DocumentFragment_js__WEBPACK_IMPORTED_MODULE_4__["DocumentFragment"]('#document-fragment', { ownerDocument: this })
}
createElement (localName) {
return this.createElementNS(this.namespaceURI, localName, true)
}
createElementNS (ns, qualifiedName, local = false) {
const Element = getElementForNamespace(ns, qualifiedName)
return new Element(qualifiedName, {
ownerDocument: this,
local
}, ns)
}
createTextNode (text) {
return new _Text_js__WEBPACK_IMPORTED_MODULE_2__["Text"]('#text', { nodeValue: text, ownerDocument: this })
}
get compatMode () {
return 'CSS1Compat' // always be in standards-mode
}
get body () {
return getChildByTagName(this.documentElement, 'BODY')
}
get head () {
return getChildByTagName(this.documentElement, 'HEAD')
}
get documentElement () {
return this.lastChild
}
}
Object(_utils_objectCreationUtils_js__WEBPACK_IMPORTED_MODULE_10__["mixin"])(_mixins_elementAccess_js__WEBPACK_IMPORTED_MODULE_9__["elementAccess"], Document)
Object(_utils_objectCreationUtils_js__WEBPACK_IMPORTED_MODULE_10__["mixin"])(_mixins_ParentNode_js__WEBPACK_IMPORTED_MODULE_15__["ParentNode"], Document)
Object(_utils_objectCreationUtils_js__WEBPACK_IMPORTED_MODULE_10__["mixin"])(_mixins_NonElementParentNode_js__WEBPACK_IMPORTED_MODULE_18__["NonElementParentNode"], Document)
/***/ }),
/***/ "./src/dom/DocumentFragment.js":
/*!*************************************!*\
!*** ./src/dom/DocumentFragment.js ***!
\*************************************/
/*! exports provided: DocumentFragment */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DocumentFragment", function() { return DocumentFragment; });
/* harmony import */ var _Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Node.js */ "./src/dom/Node.js");
/* harmony import */ var _utils_objectCreationUtils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils/objectCreationUtils.js */ "./src/utils/objectCreationUtils.js");
/* harmony import */ var _mixins_elementAccess_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./mixins/elementAccess.js */ "./src/dom/mixins/elementAccess.js");
/* harmony import */ var _mixins_ParentNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./mixins/ParentNode.js */ "./src/dom/mixins/ParentNode.js");
/* harmony import */ var _mixins_NonElementParentNode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./mixins/NonElementParentNode.js */ "./src/dom/mixins/NonElementParentNode.js");
class DocumentFragment extends _Node_js__WEBPACK_IMPORTED_MODULE_0__["Node"] {
constructor (name, props) {
super(name, props)
this.nodeType = _Node_js__WEBPACK_IMPORTED_MODULE_0__["Node"].DOCUMENT_FRAGMENT_NODE
}
}
Object(_utils_objectCreationUtils_js__WEBPACK_IMPORTED_MODULE_1__["mixin"])(_mixins_elementAccess_js__WEBPACK_IMPORTED_MODULE_2__["elementAccess"], DocumentFragment)
Object(_utils_objectCreationUtils_js__WEBPACK_IMPORTED_MODULE_1__["mixin"])(_mixins_ParentNode_js__WEBPACK_IMPORTED_MODULE_3__["ParentNode"], DocumentFragment)
Object(_utils_objectCreationUtils_js__WEBPACK_IMPORTED_MODULE_1__["mixin"])(_mixins_NonElementParentNode_js__WEBPACK_IMPORTED_MODULE_4__["NonElementParentNode"], DocumentFragment)
/***/ }),
/***/ "./src/dom/DocumentType.js":
/*!*********************************!*\
!*** ./src/dom/DocumentType.js ***!
\*********************************/
/*! exports provided: DocumentType */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DocumentType", function() { return DocumentType; });
/* harmony import */ var _Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Node.js */ "./src/dom/Node.js");
/* harmony import */ var _utils_objectCreationUtils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils/objectCreationUtils.js */ "./src/utils/objectCreationUtils.js");
/* harmony import */ var _mixins_ChildNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./mixins/ChildNode.js */ "./src/dom/mixins/ChildNode.js");
class DocumentType extends _Node_js__WEBPACK_IMPORTED_MODULE_0__["Node"] {
constructor (name, props) {
super(name, props)
this.nodeType = _Node_js__WEBPACK_IMPORTED_MODULE_0__["Node"].DOCUMENT_TYPE_NODE
this.name = name
const { publicId, systemId } = props
this.publicId = publicId || ''
this.systemId = systemId || ''
}
}
Object(_utils_objectCreationUtils_js__WEBPACK_IMPORTED_MODULE_1__["mixin"])(_mixins_ChildNode_js__WEBPACK_IMPORTED_MODULE_2__["ChildNode"], DocumentType)
/***/ }),
/***/ "./src/dom/Element.js":
/*!****************************!*\
!*** ./src/dom/Element.js ***!
\****************************/
/*! exports provided: Element */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Element", function() { return Element; });
/* harmony import */ var _Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Node.js */ "./src/dom/Node.js");
/* harmony import */ var _mixins_ParentNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./mixins/ParentNode.js */ "./src/dom/mixins/ParentNode.js");
/* harmony import */ var _mixins_elementAccess_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./mixins/elementAccess.js */ "./src/dom/mixins/elementAccess.js");
/* harmony import */ var _html_HTMLParser_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./html/HTMLParser.js */ "./src/dom/html/HTMLParser.js");
/* harmony import */ var _DocumentFragment_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./DocumentFragment.js */ "./src/dom/DocumentFragment.js");
/* harmony import */ var _utils_objectCreationUtils_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../utils/objectCreationUtils.js */ "./src/utils/objectCreationUtils.js");
/* harmony import */ var _utils_tagUtils_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../utils/tagUtils.js */ "./src/utils/tagUtils.js");
/* harmony import */ var _utils_mapUtils_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../utils/mapUtils.js */ "./src/utils/mapUtils.js");
/* harmony import */ var _utils_strUtils_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../utils/strUtils.js */ "./src/utils/strUtils.js");
/* harmony import */ var _mixins_NonDocumentTypeChildNode_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./mixins/NonDocumentTypeChildNode.js */ "./src/dom/mixins/NonDocumentTypeChildNode.js");
/* harmony import */ var _mixins_ChildNode_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./mixins/ChildNode.js */ "./src/dom/mixins/ChildNode.js");
/* harmony import */ var _utils_namespaces_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../utils/namespaces.js */ "./src/utils/namespaces.js");
const validateAndExtract = (ns, name) => {
let prefix = null
let localname = name
if (!ns) ns = null
if (name.includes(':')) {
[ prefix, localname ] = name.split(':')
}
if (!ns && prefix) {
throw new Error('Namespace Error')
}
if (prefix === 'xml' && ns !== _utils_namespaces_js__WEBPACK_IMPORTED_MODULE_11__["xml"]) {
throw new Error('Namespace Error')
}
if ((prefix === 'xmlns' || name === 'xmlns') && ns !== _utils_namespaces_js__WEBPACK_IMPORTED_MODULE_11__["xmlns"]) {
throw new Error('Namespace Error')
}
if (prefix !== 'xmlns' && name !== 'xmlns' && ns === _utils_namespaces_js__WEBPACK_IMPORTED_MODULE_11__["xmlns"]) {
throw new Error('Namespace Error')
}
return [ ns, prefix, localname ]
}
const getAttributeByNsAndLocalName = (el, ns, localName) => {
if (!ns) ns = null
return [ ...el.attrs ].find((node) => node.localName === localName && node.namespaceURI === ns)
}
const getAttributeByQualifiedName = (el, qualifiedName) => {
if (el.namespaceURI === _utils_namespaces_js__WEBPACK_IMPORTED_MODULE_11__["html"] && el.ownerDocument.namespaceURI === _utils_namespaces_js__WEBPACK_IMPORTED_MODULE_11__["html"]) {
qualifiedName = qualifiedName.toLowerCase()
}
return [ ...el.attrs ].find((node) => node.name === qualifiedName)
}
// This Proxy proxies all access to node.style to the css saved in the attribute
const getStyleProxy = (node) => {
return new Proxy(node, {
get (target, key) {
const styles = target.getAttribute('style') || ''
const styleMap = Object(_utils_mapUtils_js__WEBPACK_IMPORTED_MODULE_7__["cssToMap"])(styles)
if (key === 'cssText') {
return styles
}
if (key === 'setProperty') {
return function (propertyName, value = '', priority = '') {
node.style[propertyName] = value + (priority ? ` !${priority}` : '')
}
}
key = Object(_utils_strUtils_js__WEBPACK_IMPORTED_MODULE_8__["decamelize"])(key)
if (!styleMap.has(key)) return ''
return styleMap.get(key)
},
set (target, key, value) {
key = Object(_utils_strUtils_js__WEBPACK_IMPORTED_MODULE_8__["decamelize"])(key)
if (key === 'css-text') {
// ensure correct spacing and syntax by converting back and forth
target.setAttribute('style', Object(_utils_mapUtils_js__WEBPACK_IMPORTED_MODULE_7__["mapToCss"])(Object(_utils_mapUtils_js__WEBPACK_IMPORTED_MODULE_7__["cssToMap"])(value)))
return true
} else {
value = Object(_utils_strUtils_js__WEBPACK_IMPORTED_MODULE_8__["hexToRGB"])(value.toString())
const styles = target.getAttribute('style') || ''
const styleMap = Object(_utils_mapUtils_js__WEBPACK_IMPORTED_MODULE_7__["cssToMap"])(styles)
styleMap.set(key, value)
target.setAttribute('style', Object(_utils_mapUtils_js__WEBPACK_IMPORTED_MODULE_7__["mapToCss"])(styleMap))
return true
}
}
})
}
// https://dom.spec.whatwg.org/#dom-element-setattributens
class Element extends _Node_js__WEBPACK_IMPORTED_MODULE_0__["Node"] {
constructor (name, props, ns) {
super(name, props, ns)
this.style = getStyleProxy(this)
this.tagName = this.nodeName
}
getAttribute (qualifiedName) {
const attr = this.getAttributeNode(qualifiedName)
return attr ? attr.value : null
}
getAttributeNode (qualifiedName) {
return getAttributeByQualifiedName(this, qualifiedName)
}
getAttributeNodeNS (ns, localName) {
return getAttributeByNsAndLocalName(this, ns, localName)
}
getAttributeNS (ns, localName) {
const attr = this.getAttributeNodeNS(ns, localName)
return attr ? attr.value : null
}
getBoundingClientRect () {
throw new Error('Only implemented for SVG Elements')
}
hasAttribute (qualifiedName) {
const attr = this.getAttributeNode(qualifiedName)
return !!attr
}
hasAttributeNS (ns, localName) {
const attr = this.getAttributeNodeNS(ns, localName)
return !!attr
}
matches (query) {
return this.matchWithScope(query, this)
}
removeAttribute (qualifiedName) {
const attr = this.getAttributeNode(qualifiedName)
if (attr) {
this.removeAttributeNode(attr)
}
return attr
}
removeAttributeNode (node) {
if (!this.attrs.delete(node)) throw new Error('Attribute cannot be removed because it was not found on the element')
return node
}
// call is: d.removeAttributeNS('http://www.mozilla.org/ns/specialspace', 'align', 'center');
removeAttributeNS (ns, name) {
const attr = this.getAttributeNode(ns, name)
if (attr) {
this.removeAttributeNode(attr)
}
return attr
}
/* The setAttribute(qualifiedName, value) method, when invoked, must run these steps:
If qualifiedName does not match the Name production in XML, then throw an "InvalidCharacterError" DOMException.
If this is in the HTML namespace and its node document is an HTML document, then set qualifiedName to qualifiedName in ASCII lowercase.
Let attribute be the first attribute in this’s attribute list whose qualified name is qualifiedName, and null otherwise.
If attribute is null, create an attribute whose local name is qualifiedName, value is value, and node document is this’s node document, then append this attribute to this, and then return.
Change attribute to value.
*/
setAttribute (qualifiedName, value) {
// We have to do that here because we cannot check if `this` is in the correct namespace
// when doing it in createAttribute
if (this.namespaceURI === _utils_namespaces_js__WEBPACK_IMPORTED_MODULE_11__["html"] && this.ownerDocument.namespaceURI === _utils_namespaces_js__WEBPACK_IMPORTED_MODULE_11__["html"]) {
qualifiedName = qualifiedName.toLowerCase()
}
let attr = this.getAttributeNode(qualifiedName)
if (!attr) {
// Because createAttribute lowercases the attribute in an html doc we have to use createAttributeNS
attr = this.ownerDocument.createAttributeNS(null, qualifiedName, true)
this.setAttributeNode(attr)
}
attr.value = value
}
/*
Let namespace, prefix, and localName be the result of passing namespace and qualifiedName to validate and extract.
Set an attribute value for this using localName, value, and also prefix and namespace.
If prefix is not given, set it to null.
If namespace is not given, set it to null.
Let attribute be the result of getting an attribute given namespace, localName, and element.
If attribute is null, create an attribute whose namespace is namespace, namespace prefix is prefix, local name is localName, value is value, and node document is element’s node document, then append this attribute to element, and then return.
Change attribute to value.
*/
setAttributeNode (node) {
this.attrs.add(node)
node.ownerElement = this
}
// call is: d.setAttributeNS('http://www.mozilla.org/ns/specialspace', 'spec:align', 'center');
setAttributeNS (namespace, name, value) {
// eslint-disable-next-line
const [ ns, prefix, localName ] = validateAndExtract(namespace, name)
let attr = this.getAttributeNodeNS(ns, localName)
if (!attr) {