1/* IMPORT */ 2/* MAIN */ 3const cloneDeep = (value) => { 4 return JSON.parse(JSON.stringify(value)); 5}; 6const isElement = (value) => { 7 return (value.nodeType === 1); 8}; 9const isElementFunky = (value) => { 10 return FUNKY_TAG_NAMES.has(value.tagName); 11}; 12const isElementAction = (value) => { 13 return ('action' in value); 14}; 15const isElementIframe = (value) => { 16 return (value.tagName === 'IFRAME'); 17}; 18const isElementFormAction = (value) => { 19 return ('formAction' in value); 20}; 21const isElementHyperlink = (value) => { 22 return ('protocol' in value); 23}; 24const isScriptOrDataUrl = (() => { 25 const re = /^(?:\w+script|data):/i; 26 return (url) => { 27 return re.test(url); 28 }; 29})(); 30const isScriptOrDataUrlLoose = (() => { 31 const re = /(?:script|data):/i; 32 return (url) => { 33 return re.test(url); 34 }; 35})(); 36const mergeMaps = (maps) => { 37 const merged = {}; 38 for (let i = 0, l = maps.length; i < l; i++) { 39 const map = maps[i]; 40 for (const key in map) { 41 if (!merged[key]) { 42 merged[key] = map[key]; 43 } 44 else { 45 merged[key] = merged[key].concat(map[key]); 46 } 47 } 48 } 49 return merged; 50}; 51const traverseElementsBasic = (parent, callback) => {
52 let current = parent.firstChild; 53 while (current) { 54 const next = current.nextSibling; 55 if (isElement(current)) { 56 callback(current, parent); 57 if (current.parentNode) { // Still connected, so recurse 58 traverseElementsBasic(current, callback); 59 } 60 } 61 current = next; 62 } 63}; 64const traverseElementsIterator = (parent, callback) => { 65 const iterator = document.createNodeIterator(parent, NodeFilter.SHOW_ELEMENT); 66 let current; 67 while (current = iterator.nextNode()) { 68 const parent = current.parentNode; 69 if (!parent) 70 continue; 71 callback(current, parent); //TSC 72 } 73}; 74const traverseElements = (parent, callback) => { 75 const hasIterator = !!globalThis.document && !!globalThis.document.createNodeIterator; // For better WebWorker support 76 if (hasIterator) { 77 return traverseElementsIterator(parent, callback); 78 } 79 else { 80 return traverseElementsBasic(parent, callback); 81 } 82}; 83 84/* IMPORT */ 85/* ELEMENTS */ 86const HTML_ELEMENTS_ALLOW = [ 87 'a', 88 'abbr', 89 'acronym', 90 'address', 91 'area', 92 'article', 93 'aside', 94 'audio', 95 'b', 96 'bdi', 97 'bdo', 98 'bgsound', 99 'big', 100 'blockquote', 101 'body', 102 'br', 103 'button', 104 'canvas', 105 'caption', 106 'center', 107 'cite', 108 'code', 109 'col', 110 'colgroup', 111 'datalist', 112 'dd', 113 'del', 114 'details', 115 'dfn', 116 'dialog', 117 'dir', 118 'div', 119 'dl', 120 'dt', 121 'em', 122 'fieldset', 123 'figcaption', 124 'figure', 125 'font', 126 'footer', 127 'form', 128 'h1', 129 'h2', 130 'h3', 131 'h4', 132 'h5', 133 'h6', 134 'head', 135 'header', 136 'hgroup', 137 'hr', 138 'html', 139 'i', 140 'img', 141 'input', 142 'ins', 143 'kbd', 144 'keygen', 145 'label', 146 'layer', 147 'legend', 148 'li', 149 'link', 150 'listing', 151 'main', 152 'map', 153 'mark', 154 'marquee', 155 'menu', 156 'meta', 157 'meter', 158 'nav', 159 'nobr', 160 'ol', 161 'optgroup', 162 'option', 163 'output', 164 'p', 165 'picture', 166 'popup', 167 'pre', 168 'progress', 169 'q', 170 'rb', 171 'rp', 172 'rt', 173 'rtc', 174 'ruby', 175 's', 176 'samp', 177 'section', 178 'select', 179 'selectmenu', 180 'small', 181 'source', 182 'span', 183 'strike', 184 'strong', 185 'style', 186 'sub', 187 'summary', 188 'sup', 189 'table', 190 'tbody', 191 'td', 192 'tfoot', 193 'th', 194 'thead', 195 'time', 196 'tr', 197 'track', 198 'tt', 199 'u', 200 'ul', 201 'var', 202 'video', 203 'wbr' 204]; 205const HTML_ELEMENTS_DISALLOW = [ 206 'basefont', 207 'command', 208 'data', 209 'iframe', 210 'image', 211 'plaintext', 212 'portal', 213 'slot', 214 // 'template', //TODO: Not exactly correct to never allow this, too strict 215 'textarea', 216 'title', 217 'xmp' 218]; 219const HTML_ELEMENTS = new Set([ 220 ...HTML_ELEMENTS_ALLOW, 221 ...HTML_ELEMENTS_DISALLOW 222]); 223const SVG_ELEMENTS_ALLOW = [ 224 'svg', 225 'a', 226 'altglyph', 227 'altglyphdef', 228 'altglyphitem', 229 'animatecolor', 230 'animatemotion', 231 'animatetransform', 232 'circle', 233 'clippath', 234 'defs', 235 'desc', 236 'ellipse', 237 'filter', 238 'font', 239 'g', 240 'glyph', 241 'glyphref', 242 'hkern', 243 'image', 244 'line', 245 'lineargradient', 246 'marker', 247 'mask', 248 'metadata', 249 'mpath', 250 'path', 251 'pattern', 252 'polygon', 253 'polyline', 254 'radialgradient', 255 'rect', 256 'stop', 257 'style', 258 'switch', 259 'symbol', 260 'text', 261 'textpath', 262 'title', 263 'tref', 264 'tspan', 265 'view', 266 'vkern', 267 /* FILTERS */ 268 'feBlend', 269 'feColorMatrix', 270 'feComponentTransfer', 271 'feComposite', 272 'feConvolveMatrix', 273 'feDiffuseLighting', 274 'feDisplacementMap', 275 'feDistantLight', 276 'feFlood', 277 'feFuncA', 278 'feFuncB', 279 'feFuncG', 280 'feFuncR', 281 'feGaussianBlur', 282 'feImage', 283 'feMerge', 284 'feMergeNode', 285 'feMorphology', 286 'feOffset', 287 'fePointLight', 288 'feSpecularLighting', 289 'feSpotLight', 290 'feTile', 291 'feTurbulence' 292]; 293const SVG_ELEMENTS_DISALLOW = [ 294 'animate', 295 'color-profile', 296 'cursor', 297 'discard', 298 'fedropshadow', 299 'font-face', 300 'font-face-format', 301 'font-face-name', 302 'font-face-src', 303 'font-face-uri', 304 'foreignobject', 305 'hatch', 306 'hatchpath', 307 'mesh', 308 'meshgradient', 309 'meshpatch', 310 'meshrow', 311 'missing-glyph', 312 'script', 313 'set', 314 'solidcolor', 315 'unknown', 316 'use' 317]; 318const SVG_ELEMENTS = new Set([ 319 ...SVG_ELEMENTS_ALLOW, 320 ...SVG_ELEMENTS_DISALLOW 321]); 322const MATH_ELEMENTS_ALLOW = [ 323 'math', 324 'menclose', 325 'merror', 326 'mfenced', 327 'mfrac', 328 'mglyph', 329 'mi', 330 'mlabeledtr', 331 'mmultiscripts', 332 'mn', 333 'mo', 334 'mover', 335 'mpadded', 336 'mphantom', 337 'mroot', 338 'mrow', 339 'ms', 340 'mspace', 341 'msqrt', 342 'mstyle', 343 'msub', 344 'msup', 345 'msubsup', 346 'mtable', 347 'mtd', 348 'mtext', 349 'mtr', 350 'munder', 351 'munderover' 352]; 353const MATH_ELEMENTS_DISALLOW = [ 354 'maction', 355 'maligngroup', 356 'malignmark', 357 'mlongdiv', 358 'mscarries', 359 'mscarry', 360 'msgroup', 361 'mstack', 362 'msline', 363 'msrow', 364 'semantics', 365 'annotation', 366 'annotation-xml', 367 'mprescripts', 368 'none' 369]; 370const MATH_ELEMENTS = new Set([ 371 ...MATH_ELEMENTS_ALLOW, 372 ...MATH_ELEMENTS_DISALLOW 373]); 374/* ATTRIBUTES */ 375const HTML_ATTRIBUTES_ALLOW = [ 376 'abbr', 377 'accept', 378 'accept-charset', 379 'accesskey', 380 'action', 381 'align', 382 'alink', 383 'allow', 384 'allowfullscreen', 385 'alt', 386 'anchor', 387 'archive', 388 'as', 389 'async', 390 'autocapitalize', 391 'autocomplete', 392 'autocorrect', 393 'autofocus', 394 'autopictureinpicture', 395 'autoplay', 396 'axis', 397 'background', 398 'behavior', 399 'bgcolor', 400 'border', 401 'bordercolor', 402 'capture', 403 'cellpadding', 404 'cellspacing', 405 'challenge', 406 'char', 407 'charoff', 408 'charset', 409 'checked', 410 'cite', 411 'class', 412 'classid', 413 'clear', 414 'code', 415 'codebase', 416 'codetype', 417 'color', 418 'cols', 419 'colspan', 420 'compact', 421 'content', 422 'contenteditable', 423 'controls', 424 'controlslist', 425 'conversiondestination', 426 'coords', 427 'crossorigin', 428 'csp', 429 'data', 430 'datetime', 431 'declare', 432 'decoding', 433 'default', 434 'defer', 435 'dir', 436 'direction', 437 'dirname', 438 'disabled', 439 'disablepictureinpicture', 440 'disableremoteplayback', 441 'disallowdocumentaccess', 442 'download', 443 'draggable', 444 'elementtiming', 445 'enctype', 446 'end', 447 'enterkeyhint', 448 'event', 449 'exportparts', 450 'face', 451 'for', 452 'form', 453 'formaction', 454 'formenctype', 455 'formmethod', 456 'formnovalidate', 457 'formtarget', 458 'frame', 459 'frameborder', 460 'headers', 461 'height', 462 'hidden', 463 'high', 464 'href', 465 'hreflang', 466 'hreftranslate', 467 'hspace', 468 'http-equiv', 469 'id', 470 'imagesizes', 471 'imagesrcset', 472 'importance', 473 'impressiondata', 474 'impressionexpiry', 475 'incremental', 476 'inert', 477 'inputmode', 478 'integrity', 479 'invisible', 480 'ismap', 481 'keytype', 482 'kind', 483 'label', 484 'lang', 485 'language', 486 'latencyhint', 487 'leftmargin', 488 'link', 489 'list', 490 'loading', 491 'longdesc', 492 'loop', 493 'low', 494 'lowsrc', 495 'manifest', 496 'marginheight', 497 'marginwidth', 498 'max', 499 'maxlength', 500 'mayscript', 501 'media', 502 'method', 503 'min', 504 'minlength', 505 'multiple', 506 'muted',
507 'name', 508 'nohref', 509 'nomodule', 510 'nonce', 511 'noresize', 512 'noshade', 513 'novalidate', 514 'nowrap', 515 'object', 516 'open', 517 'optimum', 518 'part', 519 'pattern', 520 'ping', 521 'placeholder', 522 'playsinline', 523 'policy', 524 'poster', 525 'preload', 526 'pseudo', 527 'readonly', 528 'referrerpolicy', 529 'rel', 530 'reportingorigin', 531 'required', 532 'resources', 533 'rev', 534 'reversed', 535 'role', 536 'rows', 537 'rowspan', 538 'rules', 539 'sandbox', 540 'scheme', 541 'scope', 542 'scopes', 543 'scrollamount', 544 'scrolldelay', 545 'scrolling', 546 'select', 547 'selected', 548 'shadowroot', 549 'shadowrootdelegatesfocus', 550 'shape', 551 'size', 552 'sizes', 553 'slot', 554 'span', 555 'spellcheck', 556 'src', 557 'srclang', 558 'srcset', 559 'standby', 560 'start', 561 'step', 562 'style', 563 'summary', 564 'tabindex', 565 'target', 566 'text', 567 'title', 568 'topmargin', 569 'translate', 570 'truespeed', 571 'trusttoken', 572 'type', 573 'usemap', 574 'valign', 575 'value', 576 'valuetype', 577 'version', 578 'virtualkeyboardpolicy', 579 'vlink', 580 'vspace', 581 'webkitdirectory', 582 'width', 583 'wrap' 584]; 585const SVG_ATTRIBUTES_ALLOW = [ 586 'accent-height', 587 'accumulate', 588 'additive', 589 'alignment-baseline', 590 'ascent', 591 'attributename', 592 'attributetype', 593 'azimuth', 594 'basefrequency', 595 'baseline-shift', 596 'begin', 597 'bias', 598 'by', 599 'class', 600 'clip', 601 'clippathunits', 602 'clip-path', 603 'clip-rule', 604 'color', 605 'color-interpolation', 606 'color-interpolation-filters', 607 'color-profile', 608 'color-rendering', 609 'cx', 610 'cy', 611 'd', 612 'dx', 613 'dy', 614 'diffuseconstant', 615 'direction', 616 'display', 617 'divisor', 618 'dominant-baseline', 619 'dur', 620 'edgemode', 621 'elevation', 622 'end', 623 'fill', 624 'fill-opacity', 625 'fill-rule', 626 'filter', 627 'filterunits', 628 'flood-color', 629 'flood-opacity', 630 'font-family', 631 'font-size', 632 'font-size-adjust', 633 'font-stretch', 634 'font-style', 635 'font-variant', 636 'font-weight', 637 'fx', 638 'fy', 639 'g1', 640 'g2', 641 'glyph-name', 642 'glyphref', 643 'gradientunits', 644 'gradienttransform', 645 'height', 646 'href', 647 'id', 648 'image-rendering', 649 'in', 650 'in2', 651 'k', 652 'k1', 653 'k2', 654 'k3', 655 'k4', 656 'kerning', 657 'keypoints', 658 'keysplines', 659 'keytimes', 660 'lang', 661 'lengthadjust', 662 'letter-spacing', 663 'kernelmatrix', 664 'kernelunitlength', 665 'lighting-color', 666 'local', 667 'marker-end', 668 'marker-mid', 669 'marker-start', 670 'markerheight', 671 'markerunits', 672 'markerwidth', 673 'maskcontentunits', 674 'maskunits', 675 'max', 676 'mask', 677 'media', 678 'method', 679 'mode', 680 'min', 681 'name', 682 'numoctaves', 683 'offset', 684 'operator', 685 'opacity', 686 'order', 687 'orient', 688 'orientation', 689 'origin', 690 'overflow', 691 'paint-order', 692 'path', 693 'pathlength', 694 'patterncontentunits', 695 'patterntransform', 696 'patternunits', 697 'points', 698 'preservealpha', 699 'preserveaspectratio', 700 'primitiveunits', 701 'r', 702 'rx', 703 'ry', 704 'radius', 705 'refx', 706 'refy', 707 'repeatcount', 708 'repeatdur', 709 'restart', 710 'result', 711 'rotate', 712 'scale', 713 'seed', 714 'shape-rendering', 715 'specularconstant', 716 'specularexponent', 717 'spreadmethod', 718 'startoffset', 719 'stddeviation', 720 'stitchtiles', 721 'stop-color', 722 'stop-opacity', 723 'stroke-dasharray', 724 'stroke-dashoffset', 725 'stroke-linecap', 726 'stroke-linejoin', 727 'stroke-miterlimit', 728 'stroke-opacity', 729 'stroke', 730 'stroke-width', 731 'style', 732 'surfacescale', 733 'systemlanguage', 734 'tabindex', 735 'targetx', 736 'targety', 737 'transform', 738 'transform-origin', 739 'text-anchor', 740 'text-decoration', 741 'text-rendering', 742 'textlength', 743 'type', 744 'u1', 745 'u2', 746 'unicode', 747 'values', 748 'viewbox', 749 'visibility', 750 'version', 751 'vert-adv-y', 752 'vert-origin-x', 753 'vert-origin-y', 754 'width', 755 'word-spacing', 756 'wrap', 757 'writing-mode', 758 'xchannelselector', 759 'ychannelselector', 760 'x', 761 'x1', 762 'x2', 763 'xmlns', 764 'y', 765 'y1', 766 'y2', 767 'z', 768 'zoomandpan' 769]; 770const MATH_ATTRIBUTES_ALLOW = [ 771 'accent', 772 'accentunder', 773 'align', 774 'bevelled', 775 'close', 776 'columnsalign', 777 'columnlines', 778 'columnspan', 779 'denomalign', 780 'depth', 781 'dir', 782 'display', 783 'displaystyle', 784 'encoding', 785 'fence', 786 'frame', 787 'height', 788 'href', 789 'id', 790 'largeop', 791 'length', 792 'linethickness', 793 'lspace', 794 'lquote', 795 'mathbackground', 796 'mathcolor', 797 'mathsize', 798 'mathvariant', 799 'maxsize', 800 'minsize', 801 'movablelimits', 802 'notation', 803 'numalign', 804 'open', 805 'rowalign', 806 'rowlines',
807 'rowspacing', 808 'rowspan', 809 'rspace', 810 'rquote', 811 'scriptlevel', 812 'scriptminsize', 813 'scriptsizemultiplier', 814 'selection', 815 'separator', 816 'separators', 817 'stretchy', 818 'subscriptshift', 819 'supscriptshift', 820 'symmetric', 821 'voffset', 822 'width', 823 'xmlns' 824]; 825/* NAMESPACES */ 826const NAMESPACES = { 827 HTML: 'http://www.w3.org/1999/xhtml', 828 SVG: 'http://www.w3.org/2000/svg', 829 MATH: 'http://www.w3.org/1998/Math/MathML' 830}; 831const NAMESPACES_ELEMENTS = { 832 [NAMESPACES.HTML]: HTML_ELEMENTS, 833 [NAMESPACES.SVG]: SVG_ELEMENTS, 834 [NAMESPACES.MATH]: MATH_ELEMENTS 835}; 836const NAMESPACES_ROOTS = { 837 [NAMESPACES.HTML]: 'html', 838 [NAMESPACES.SVG]: 'svg', 839 [NAMESPACES.MATH]: 'math' 840}; 841const NAMESPACES_PREFIXES = { 842 [NAMESPACES.HTML]: '', 843 [NAMESPACES.SVG]: 'svg:', 844 [NAMESPACES.MATH]: 'math:' 845}; 846/* TAG NAMES */ 847const FUNKY_TAG_NAMES = new Set([ 848 'A', 849 'AREA', 850 'BUTTON', 851 'FORM', 852 'IFRAME', 853 'INPUT' 854]); 855/* OTHERS */ 856const DEFAULTS = { 857 allowComments: true, 858 allowCustomElements: false, 859 allowUnknownMarkup: false, 860 allowElements: [ 861 ...HTML_ELEMENTS_ALLOW, 862 ...SVG_ELEMENTS_ALLOW.map(name => `svg:${name}`), 863 ...MATH_ELEMENTS_ALLOW.map(name => `math:${name}`) 864 ], 865 allowAttributes: mergeMaps([ 866 Object.fromEntries(HTML_ATTRIBUTES_ALLOW.map(name => [name, ['*']])), 867 Object.fromEntries(SVG_ATTRIBUTES_ALLOW.map(name => [name, ['svg:*']])), 868 Object.fromEntries(MATH_ATTRIBUTES_ALLOW.map(name => [name, ['math:*']])) 869 ]) 870}; 871 872/* IMPORT */ 873var __classPrivateFieldSet = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { 874 if (kind === "m") throw new TypeError("Private method is not writable"); 875 if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); 876 if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); 877 return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; 878}; 879var __classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) { 880 if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); 881 if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); 882 return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); 883}; 884var _Amuchina_configuration, _Amuchina_allowElements, _Amuchina_allowAttributes; 885/* MAIN */ 886//TODO: Add a decent test suite, possibly one from an existing trusted library 887class Amuchina { 888 /* CONSTRUCTOR */ 889 constructor(configuration = {}) { 890 /* VARIABLES */ 891 _Amuchina_configuration.set(this, void 0); 892 _Amuchina_allowElements.set(this, void 0); 893 _Amuchina_allowAttributes.set(this, void 0); 894 /* API */ 895 this.getConfiguration = () => { 896 return cloneDeep(__classPrivateFieldGet(this, _Amuchina_configuration, "f")); 897 }; 898 this.sanitize = (input) => { 899 //TODO: Support integration points (foreignObject and friends) 900 //TODO: Support xlink:href, xml:id, xlink:title, xml:space, xmlns:xlink 901 const allowElements = __classPrivateFieldGet(this, _Amuchina_allowElements, "f"); 902 const allowAttributes = __classPrivateFieldGet(this, _Amuchina_allowAttributes, "f"); 903 traverseElements(input, (node, parent) => { 904 const namespace = node.namespaceURI || NAMESPACES.HTML; 905 const namespaceParent = parent['namespaceURI'] || NAMESPACES.HTML; 906 const elements = NAMESPACES_ELEMENTS[namespace]; 907 const root = NAMESPACES_ROOTS[namespace]; 908 const prefix = NAMESPACES_PREFIXES[namespace]; 909 const tag = node.tagName.toLowerCase(); 910 const tagPrefixed = `${prefix}${tag}`; 911 const all = '*'; 912 const allPrefixed = `${prefix}${all}`; 913 if (!elements.has(tag) || !allowElements.has(tagPrefixed) || (namespace !== namespaceParent && tag !== root)) { 914 parent.removeChild(node); 915 } 916 else { 917 const attributes = node.getAttributeNames(); 918 const attributesLength = attributes.length; 919 if (attributesLength) { 920 for (let i = 0; i < attributesLength; i++) { 921 const attribute = attributes[i]; 922 const allowedValues = allowAttributes[attribute]; 923 if (!allowedValues || (!allowedValues.has(allPrefixed) && !allowedValues.has(tagPrefixed))) { 924 node.removeAttribute(attribute); 925 } 926 } 927 if (isElementFunky(node)) { 928 if (isElementHyperlink(node)) { 929 const href = node.getAttribute('href'); 930 if (href && isScriptOrDataUrlLoose(href) && isScriptOrDataUrl(node.protocol)) { 931 node.removeAttribute('href'); 932 } 933 } 934 else if (isElementAction(node)) { 935 if (isScriptOrDataUrl(node.action)) { 936 node.removeAttribute('action'); 937 } 938 } 939 else if (isElementFormAction(node)) { 940 if (isScriptOrDataUrl(node.formAction)) { 941 node.removeAttribute('formaction'); 942 } 943 } 944 else if (isElementIframe(node)) { 945 if (isScriptOrDataUrl(node.src)) { 946 node.removeAttribute('formaction'); 947 } 948 node.setAttribute('sandbox', 'allow-scripts'); //TODO: This is kinda arbitrary, it should be customizable and more flexible 949 } 950 } 951 } 952 } 953 }); 954 return input; 955 }; 956 this.sanitizeFor = (element, input) => { 957 throw new Error('"sanitizeFor" is not implemented yet'); 958 }; 959 const { allowComments, allowCustomElements, allowUnknownMarkup, blockElements, dropElements, dropAttributes } = configuration; 960 if (allowComments === false) 961 throw new Error('A false "allowComments" is not supported yet'); 962 if (allowCustomElements) 963 throw new Error('A true "allowCustomElements" is not supported yet'); 964 if (allowUnknownMarkup) 965 throw new Error('A true "allowUnknownMarkup" is not supported yet'); 966 if (blockElements) 967 throw new Error('"blockElements" is not supported yet, use "allowElements" instead'); 968 if (dropElements) 969 throw new Error('"dropElements" is not supported yet, use "allowElements" instead'); 970 if (dropAttributes) 971 throw new Error('"dropAttributes" is not supported yet, use "allowAttributes" instead'); 972 __classPrivateFieldSet(this, _Amuchina_configuration, cloneDeep(DEFAULTS), "f"); 973 const { allowElements, allowAttributes } = configuration; 974 if (allowElements) 975 __classPrivateFieldGet(this, _Amuchina_configuration, "f").allowElements = configuration.allowElements; 976 if (allowAttributes) 977 __classPrivateFieldGet(this, _Amuchina_configuration, "f").allowAttributes = configuration.allowAttributes; 978 __classPrivateFieldSet(this, _Amuchina_allowElements, new Set(__classPrivateFieldGet(this, _Amuchina_configuration, "f").allowElements), "f"); 979 __classPrivateFieldSet(this, _Amuchina_allowAttributes, Object.fromEntries(Object.entries(__classPrivateFieldGet(this, _Amuchina_configuration, "f").allowAttributes || {}).map(([element, attributes]) => [element, new Set(attributes)])), "f"); 980 } 981} 982_Amuchina_configuration = new WeakMap(), _Amuchina_allowElements = new WeakMap(), _Amuchina_allowAttributes = new WeakMap(); 983/* STATIC API */ 984Amuchina.getDefaultConfiguration = () => { 985 return cloneDeep(DEFAULTS); 986}; 987 988export { Amuchina as A }; 989//# sourceMappingURL=index-C7e-J7CF.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.