html-react-parser
Advanced tools
Comparing version 1.4.3 to 1.4.4
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).HTMLReactParser=t(e.React)}(this,(function(e){"use strict";function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=t(e),r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},i={exports:{}},o={},a={};a.SAME=0;function l(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,i,o=[],a=!0,l=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);a=!0);}catch(e){l=!0,i=e}finally{try{a||null==n.return||n.return()}finally{if(l)throw i}}return o}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return s(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return s(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}a.CAMELCASE=1,a.possibleStandardNames={accept:0,acceptCharset:1,"accept-charset":"acceptCharset",accessKey:1,action:0,allowFullScreen:1,alt:0,as:0,async:0,autoCapitalize:1,autoComplete:1,autoCorrect:1,autoFocus:1,autoPlay:1,autoSave:1,capture:0,cellPadding:1,cellSpacing:1,challenge:0,charSet:1,checked:0,children:0,cite:0,class:"className",classID:1,className:1,cols:0,colSpan:1,content:0,contentEditable:1,contextMenu:1,controls:0,controlsList:1,coords:0,crossOrigin:1,dangerouslySetInnerHTML:1,data:0,dateTime:1,default:0,defaultChecked:1,defaultValue:1,defer:0,dir:0,disabled:0,disablePictureInPicture:1,disableRemotePlayback:1,download:0,draggable:0,encType:1,enterKeyHint:1,for:"htmlFor",form:0,formMethod:1,formAction:1,formEncType:1,formNoValidate:1,formTarget:1,frameBorder:1,headers:0,height:0,hidden:0,high:0,href:0,hrefLang:1,htmlFor:1,httpEquiv:1,"http-equiv":"httpEquiv",icon:0,id:0,innerHTML:1,inputMode:1,integrity:0,is:0,itemID:1,itemProp:1,itemRef:1,itemScope:1,itemType:1,keyParams:1,keyType:1,kind:0,label:0,lang:0,list:0,loop:0,low:0,manifest:0,marginWidth:1,marginHeight:1,max:0,maxLength:1,media:0,mediaGroup:1,method:0,min:0,minLength:1,multiple:0,muted:0,name:0,noModule:1,nonce:0,noValidate:1,open:0,optimum:0,pattern:0,placeholder:0,playsInline:1,poster:0,preload:0,profile:0,radioGroup:1,readOnly:1,referrerPolicy:1,rel:0,required:0,reversed:0,role:0,rows:0,rowSpan:1,sandbox:0,scope:0,scoped:0,scrolling:0,seamless:0,selected:0,shape:0,size:0,sizes:0,span:0,spellCheck:1,src:0,srcDoc:1,srcLang:1,srcSet:1,start:0,step:0,style:0,summary:0,tabIndex:1,target:0,title:0,type:0,useMap:1,value:0,width:0,wmode:0,wrap:0,about:0,accentHeight:1,"accent-height":"accentHeight",accumulate:0,additive:0,alignmentBaseline:1,"alignment-baseline":"alignmentBaseline",allowReorder:1,alphabetic:0,amplitude:0,arabicForm:1,"arabic-form":"arabicForm",ascent:0,attributeName:1,attributeType:1,autoReverse:1,azimuth:0,baseFrequency:1,baselineShift:1,"baseline-shift":"baselineShift",baseProfile:1,bbox:0,begin:0,bias:0,by:0,calcMode:1,capHeight:1,"cap-height":"capHeight",clip:0,clipPath:1,"clip-path":"clipPath",clipPathUnits:1,clipRule:1,"clip-rule":"clipRule",color:0,colorInterpolation:1,"color-interpolation":"colorInterpolation",colorInterpolationFilters:1,"color-interpolation-filters":"colorInterpolationFilters",colorProfile:1,"color-profile":"colorProfile",colorRendering:1,"color-rendering":"colorRendering",contentScriptType:1,contentStyleType:1,cursor:0,cx:0,cy:0,d:0,datatype:0,decelerate:0,descent:0,diffuseConstant:1,direction:0,display:0,divisor:0,dominantBaseline:1,"dominant-baseline":"dominantBaseline",dur:0,dx:0,dy:0,edgeMode:1,elevation:0,enableBackground:1,"enable-background":"enableBackground",end:0,exponent:0,externalResourcesRequired:1,fill:0,fillOpacity:1,"fill-opacity":"fillOpacity",fillRule:1,"fill-rule":"fillRule",filter:0,filterRes:1,filterUnits:1,floodOpacity:1,"flood-opacity":"floodOpacity",floodColor:1,"flood-color":"floodColor",focusable:0,fontFamily:1,"font-family":"fontFamily",fontSize:1,"font-size":"fontSize",fontSizeAdjust:1,"font-size-adjust":"fontSizeAdjust",fontStretch:1,"font-stretch":"fontStretch",fontStyle:1,"font-style":"fontStyle",fontVariant:1,"font-variant":"fontVariant",fontWeight:1,"font-weight":"fontWeight",format:0,from:0,fx:0,fy:0,g1:0,g2:0,glyphName:1,"glyph-name":"glyphName",glyphOrientationHorizontal:1,"glyph-orientation-horizontal":"glyphOrientationHorizontal",glyphOrientationVertical:1,"glyph-orientation-vertical":"glyphOrientationVertical",glyphRef:1,gradientTransform:1,gradientUnits:1,hanging:0,horizAdvX:1,"horiz-adv-x":"horizAdvX",horizOriginX:1,"horiz-origin-x":"horizOriginX",ideographic:0,imageRendering:1,"image-rendering":"imageRendering",in2:0,in:0,inlist:0,intercept:0,k1:0,k2:0,k3:0,k4:0,k:0,kernelMatrix:1,kernelUnitLength:1,kerning:0,keyPoints:1,keySplines:1,keyTimes:1,lengthAdjust:1,letterSpacing:1,"letter-spacing":"letterSpacing",lightingColor:1,"lighting-color":"lightingColor",limitingConeAngle:1,local:0,markerEnd:1,"marker-end":"markerEnd",markerHeight:1,markerMid:1,"marker-mid":"markerMid",markerStart:1,"marker-start":"markerStart",markerUnits:1,markerWidth:1,mask:0,maskContentUnits:1,maskUnits:1,mathematical:0,mode:0,numOctaves:1,offset:0,opacity:0,operator:0,order:0,orient:0,orientation:0,origin:0,overflow:0,overlinePosition:1,"overline-position":"overlinePosition",overlineThickness:1,"overline-thickness":"overlineThickness",paintOrder:1,"paint-order":"paintOrder",panose1:0,"panose-1":"panose1",pathLength:1,patternContentUnits:1,patternTransform:1,patternUnits:1,pointerEvents:1,"pointer-events":"pointerEvents",points:0,pointsAtX:1,pointsAtY:1,pointsAtZ:1,prefix:0,preserveAlpha:1,preserveAspectRatio:1,primitiveUnits:1,property:0,r:0,radius:0,refX:1,refY:1,renderingIntent:1,"rendering-intent":"renderingIntent",repeatCount:1,repeatDur:1,requiredExtensions:1,requiredFeatures:1,resource:0,restart:0,result:0,results:0,rotate:0,rx:0,ry:0,scale:0,security:0,seed:0,shapeRendering:1,"shape-rendering":"shapeRendering",slope:0,spacing:0,specularConstant:1,specularExponent:1,speed:0,spreadMethod:1,startOffset:1,stdDeviation:1,stemh:0,stemv:0,stitchTiles:1,stopColor:1,"stop-color":"stopColor",stopOpacity:1,"stop-opacity":"stopOpacity",strikethroughPosition:1,"strikethrough-position":"strikethroughPosition",strikethroughThickness:1,"strikethrough-thickness":"strikethroughThickness",string:0,stroke:0,strokeDasharray:1,"stroke-dasharray":"strokeDasharray",strokeDashoffset:1,"stroke-dashoffset":"strokeDashoffset",strokeLinecap:1,"stroke-linecap":"strokeLinecap",strokeLinejoin:1,"stroke-linejoin":"strokeLinejoin",strokeMiterlimit:1,"stroke-miterlimit":"strokeMiterlimit",strokeWidth:1,"stroke-width":"strokeWidth",strokeOpacity:1,"stroke-opacity":"strokeOpacity",suppressContentEditableWarning:1,suppressHydrationWarning:1,surfaceScale:1,systemLanguage:1,tableValues:1,targetX:1,targetY:1,textAnchor:1,"text-anchor":"textAnchor",textDecoration:1,"text-decoration":"textDecoration",textLength:1,textRendering:1,"text-rendering":"textRendering",to:0,transform:0,typeof:0,u1:0,u2:0,underlinePosition:1,"underline-position":"underlinePosition",underlineThickness:1,"underline-thickness":"underlineThickness",unicode:0,unicodeBidi:1,"unicode-bidi":"unicodeBidi",unicodeRange:1,"unicode-range":"unicodeRange",unitsPerEm:1,"units-per-em":"unitsPerEm",unselectable:0,vAlphabetic:1,"v-alphabetic":"vAlphabetic",values:0,vectorEffect:1,"vector-effect":"vectorEffect",version:0,vertAdvY:1,"vert-adv-y":"vertAdvY",vertOriginX:1,"vert-origin-x":"vertOriginX",vertOriginY:1,"vert-origin-y":"vertOriginY",vHanging:1,"v-hanging":"vHanging",vIdeographic:1,"v-ideographic":"vIdeographic",viewBox:1,viewTarget:1,visibility:0,vMathematical:1,"v-mathematical":"vMathematical",vocab:0,widths:0,wordSpacing:1,"word-spacing":"wordSpacing",writingMode:1,"writing-mode":"writingMode",x1:0,x2:0,x:0,xChannelSelector:1,xHeight:1,"x-height":"xHeight",xlinkActuate:1,"xlink:actuate":"xlinkActuate",xlinkArcrole:1,"xlink:arcrole":"xlinkArcrole",xlinkHref:1,"xlink:href":"xlinkHref",xlinkRole:1,"xlink:role":"xlinkRole",xlinkShow:1,"xlink:show":"xlinkShow",xlinkTitle:1,"xlink:title":"xlinkTitle",xlinkType:1,"xlink:type":"xlinkType",xmlBase:1,"xml:base":"xmlBase",xmlLang:1,"xml:lang":"xmlLang",xmlns:0,"xml:space":"xmlSpace",xmlnsXlink:1,"xmlns:xlink":"xmlnsXlink",xmlSpace:1,y1:0,y2:0,y:0,yChannelSelector:1,z:0,zoomAndPan:1},Object.defineProperty(o,"__esModule",{value:!0});function c(e,t,n,r,i,o,a){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=a}var u={};["children","dangerouslySetInnerHTML","defaultValue","defaultChecked","innerHTML","suppressContentEditableWarning","suppressHydrationWarning","style"].forEach((function(e){u[e]=new c(e,0,!1,e,null,!1,!1)})),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach((function(e){var t=l(e,2),n=t[0],r=t[1];u[n]=new c(n,1,!1,r,null,!1,!1)})),["contentEditable","draggable","spellCheck","value"].forEach((function(e){u[e]=new c(e,2,!1,e.toLowerCase(),null,!1,!1)})),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach((function(e){u[e]=new c(e,2,!1,e,null,!1,!1)})),["allowFullScreen","async","autoFocus","autoPlay","controls","default","defer","disabled","disablePictureInPicture","disableRemotePlayback","formNoValidate","hidden","loop","noModule","noValidate","open","playsInline","readOnly","required","reversed","scoped","seamless","itemScope"].forEach((function(e){u[e]=new c(e,3,!1,e.toLowerCase(),null,!1,!1)})),["checked","multiple","muted","selected"].forEach((function(e){u[e]=new c(e,3,!0,e,null,!1,!1)})),["capture","download"].forEach((function(e){u[e]=new c(e,4,!1,e,null,!1,!1)})),["cols","rows","size","span"].forEach((function(e){u[e]=new c(e,6,!1,e,null,!1,!1)})),["rowSpan","start"].forEach((function(e){u[e]=new c(e,5,!1,e.toLowerCase(),null,!1,!1)}));var p=/[\-\:]([a-z])/g,f=function(e){return e[1].toUpperCase()};["accent-height","alignment-baseline","arabic-form","baseline-shift","cap-height","clip-path","clip-rule","color-interpolation","color-interpolation-filters","color-profile","color-rendering","dominant-baseline","enable-background","fill-opacity","fill-rule","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","glyph-name","glyph-orientation-horizontal","glyph-orientation-vertical","horiz-adv-x","horiz-origin-x","image-rendering","letter-spacing","lighting-color","marker-end","marker-mid","marker-start","overline-position","overline-thickness","paint-order","panose-1","pointer-events","rendering-intent","shape-rendering","stop-color","stop-opacity","strikethrough-position","strikethrough-thickness","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-anchor","text-decoration","text-rendering","underline-position","underline-thickness","unicode-bidi","unicode-range","units-per-em","v-alphabetic","v-hanging","v-ideographic","v-mathematical","vector-effect","vert-adv-y","vert-origin-x","vert-origin-y","word-spacing","writing-mode","xmlns:xlink","x-height"].forEach((function(e){var t=e.replace(p,f);u[t]=new c(t,1,!1,e,null,!1,!1)})),["xlink:actuate","xlink:arcrole","xlink:role","xlink:show","xlink:title","xlink:type"].forEach((function(e){var t=e.replace(p,f);u[t]=new c(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)})),["xml:base","xml:lang","xml:space"].forEach((function(e){var t=e.replace(p,f);u[t]=new c(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)})),["tabIndex","crossOrigin"].forEach((function(e){u[e]=new c(e,1,!1,e.toLowerCase(),null,!1,!1)}));u.xlinkHref=new c("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach((function(e){u[e]=new c(e,1,!1,e.toLowerCase(),null,!0,!0)}));var d=a,h=d.CAMELCASE,m=d.SAME,g=d.possibleStandardNames,y=RegExp.prototype.test.bind(new RegExp("^(data|aria)-[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$")),v=Object.keys(g).reduce((function(e,t){var n=g[t];return n===m?e[t]=t:n===h?e[t.toLowerCase()]=t:e[t]=n,e}),{});o.BOOLEAN=3,o.BOOLEANISH_STRING=2,o.NUMERIC=5,o.OVERLOADED_BOOLEAN=4,o.POSITIVE_NUMERIC=6,o.RESERVED=0,o.STRING=1,o.getPropertyInfo=function(e){return u.hasOwnProperty(e)?u[e]:null},o.isCustomAttribute=y,o.possibleStandardNames=v;var b={},x=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,k=/\n/g,T=/^\s*/,E=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,w=/^:\s*/,C=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,S=/^[;\s]*/,A=/^\s+|\s+$/g,O="";function P(e){return e?e.replace(A,O):O}var D=function(e,t){if("string"!=typeof e)throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function i(e){var t=e.match(k);t&&(n+=t.length);var i=e.lastIndexOf("\n");r=~i?e.length-i:r+e.length}function o(){var e={line:n,column:r};return function(t){return t.position=new a(e),c(),t}}function a(e){this.start=e,this.end={line:n,column:r},this.source=t.source}function l(i){var o=new Error(t.source+":"+n+":"+r+": "+i);if(o.reason=i,o.filename=t.source,o.line=n,o.column=r,o.source=e,!t.silent)throw o}function s(t){var n=t.exec(e);if(n){var r=n[0];return i(r),e=e.slice(r.length),n}}function c(){s(T)}function u(e){var t;for(e=e||[];t=p();)!1!==t&&e.push(t);return e}function p(){var t=o();if("/"==e.charAt(0)&&"*"==e.charAt(1)){for(var n=2;O!=e.charAt(n)&&("*"!=e.charAt(n)||"/"!=e.charAt(n+1));)++n;if(n+=2,O===e.charAt(n-1))return l("End of comment missing");var a=e.slice(2,n-2);return r+=2,i(a),e=e.slice(n),r+=2,t({type:"comment",comment:a})}}function f(){var e=o(),t=s(E);if(t){if(p(),!s(w))return l("property missing ':'");var n=s(C),r=e({type:"declaration",property:P(t[0].replace(x,O)),value:n?P(n[0].replace(x,O)):O});return s(S),r}}return a.prototype.content=e,c(),function(){var e,t=[];for(u(t);e=f();)!1!==e&&(t.push(e),u(t));return t}()};var M=function(e,t){var n,r=null;if(!e||"string"!=typeof e)return r;for(var i,o,a=D(e),l="function"==typeof t,s=0,c=a.length;s<c;s++)i=(n=a[s]).property,o=n.value,l?t(i,o,n):o&&(r||(r={}),r[i]=o);return r},N={__esModule:!0,camelCase:void 0},R=/^--[a-zA-Z0-9-]+$/,L=/-([a-z])/g,I=/^[^-]+$/,F=/^-(webkit|moz|ms|o|khtml)-/,_=function(e,t){return t.toUpperCase()},j=function(e,t){return t+"-"};N.camelCase=function(e,t){return void 0===t&&(t={}),function(e){return!e||I.test(e)||R.test(e)}(e)?e:(e=e.toLowerCase(),t.reactCompat||(e=e.replace(F,j)),e.replace(L,_))},function(e){var t=r&&r.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};e.__esModule=!0;var n=t(M),i=N;e.default=function(e,t){var r={};return e&&"string"==typeof e?(n.default(e,(function(e,n){e&&n&&(r[i.camelCase(e,t)]=n)})),r):r}}(b);var z=n.default,B=b.default;var H={reactCompat:!0};var V={PRESERVE_CUSTOM_ATTRIBUTES:z.version.split(".")[0]>=16,invertObject:function(e,t){if(!e||"object"!=typeof e)throw new TypeError("First argument must be an object");var n,r,i="function"==typeof t,o={},a={};for(n in e)r=e[n],i&&(o=t(n,r))&&2===o.length?a[o[0]]=o[1]:"string"==typeof r&&(a[r]=n);return a},isCustomComponent:function(e,t){if(-1===e.indexOf("-"))return t&&"string"==typeof t.is;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}},setStyleProp:function(e,t){if(null!=e)try{t.style=B(e,H)}catch(e){t.style={}}}},U=o,q=V,W=function(e){var t,n,r,i,o;e=e||{};var a={};for(t in e)if(r=e[t],U.isCustomAttribute(t))a[t]=r;else if(i=X(n=t.toLowerCase()))switch(o=U.getPropertyInfo(i),"checked"!==i&&"value"!==i||(i=X("default"+n)),a[i]=r,o&&o.type){case U.BOOLEAN:a[i]=!0;break;case U.OVERLOADED_BOOLEAN:""===r&&(a[i]=!0)}else q.PRESERVE_CUSTOM_ATTRIBUTES&&(a[t]=r);return q.setStyleProp(e.style,a),a};function X(e){return U.possibleStandardNames[e]}var G=n.default,Y=W,Z=V,$=Z.setStyleProp;function K(e){return Z.PRESERVE_CUSTOM_ATTRIBUTES&&"tag"===e.type&&Z.isCustomComponent(e.name,e.attribs)}var J=function e(t,n){for(var r,i,o,a,l=(n=n||{}).library||G,s=l.cloneElement,c=l.createElement,u=l.isValidElement,p=[],f="function"==typeof n.replace,d=n.trim,h=0,m=t.length;h<m;h++)if(r=t[h],f&&u(i=n.replace(r)))m>1&&(i=s(i,{key:i.key||h})),p.push(i);else if("text"!==r.type){switch(o=r.attribs,K(r)?$(o.style,o):o&&(o=Y(o)),a=null,r.type){case"script":case"style":r.children[0]&&(o.dangerouslySetInnerHTML={__html:r.children[0].data});break;case"tag":"textarea"===r.name&&r.children[0]?o.defaultValue=r.children[0].data:r.children&&r.children.length&&(a=e(r.children,n));break;default:continue}m>1&&(o.key=h),p.push(c(r.name,o,a))}else d?r.data.trim()&&p.push(r.data):p.push(r.data);return 1===p.length?p[0]:p},Q={CASE_SENSITIVE_TAG_NAMES:["animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussainBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","linearGradient","radialGradient","textPath"]},ee={},te={};!function(e){var t;Object.defineProperty(e,"__esModule",{value:!0}),e.Doctype=e.CDATA=e.Tag=e.Style=e.Script=e.Comment=e.Directive=e.Text=e.Root=e.isTag=e.ElementType=void 0,function(e){e.Root="root",e.Text="text",e.Directive="directive",e.Comment="comment",e.Script="script",e.Style="style",e.Tag="tag",e.CDATA="cdata",e.Doctype="doctype"}(t=e.ElementType||(e.ElementType={})),e.isTag=function(e){return e.type===t.Tag||e.type===t.Script||e.type===t.Style},e.Root=t.Root,e.Text=t.Text,e.Directive=t.Directive,e.Comment=t.Comment,e.Script=t.Script,e.Style=t.Style,e.Tag=t.Tag,e.CDATA=t.CDATA,e.Doctype=t.Doctype}(te);var ne,re=r&&r.__extends||(ne=function(e,t){return ne=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},ne(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}ne(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),ie=r&&r.__assign||function(){return ie=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},ie.apply(this,arguments)};Object.defineProperty(ee,"__esModule",{value:!0}),ee.cloneNode=ee.hasChildren=ee.isDocument=ee.isDirective=ee.isComment=ee.isText=ee.isCDATA=ee.isTag=ee.Element=ee.Document=ee.NodeWithChildren=ee.ProcessingInstruction=ee.Comment=ee.Text=ee.DataNode=ee.Node=void 0;var oe=te,ae=new Map([[oe.ElementType.Tag,1],[oe.ElementType.Script,1],[oe.ElementType.Style,1],[oe.ElementType.Directive,1],[oe.ElementType.Text,3],[oe.ElementType.CDATA,4],[oe.ElementType.Comment,8],[oe.ElementType.Root,9]]),le=function(){function e(e){this.type=e,this.parent=null,this.prev=null,this.next=null,this.startIndex=null,this.endIndex=null}return Object.defineProperty(e.prototype,"nodeType",{get:function(){var e;return null!==(e=ae.get(this.type))&&void 0!==e?e:1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parentNode",{get:function(){return this.parent},set:function(e){this.parent=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"previousSibling",{get:function(){return this.prev},set:function(e){this.prev=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"nextSibling",{get:function(){return this.next},set:function(e){this.next=e},enumerable:!1,configurable:!0}),e.prototype.cloneNode=function(e){return void 0===e&&(e=!1),ke(this,e)},e}();ee.Node=le;var se=function(e){function t(t,n){var r=e.call(this,t)||this;return r.data=n,r}return re(t,e),Object.defineProperty(t.prototype,"nodeValue",{get:function(){return this.data},set:function(e){this.data=e},enumerable:!1,configurable:!0}),t}(le);ee.DataNode=se;var ce=function(e){function t(t){return e.call(this,oe.ElementType.Text,t)||this}return re(t,e),t}(se);ee.Text=ce;var ue=function(e){function t(t){return e.call(this,oe.ElementType.Comment,t)||this}return re(t,e),t}(se);ee.Comment=ue;var pe=function(e){function t(t,n){var r=e.call(this,oe.ElementType.Directive,n)||this;return r.name=t,r}return re(t,e),t}(se);ee.ProcessingInstruction=pe;var fe=function(e){function t(t,n){var r=e.call(this,t)||this;return r.children=n,r}return re(t,e),Object.defineProperty(t.prototype,"firstChild",{get:function(){var e;return null!==(e=this.children[0])&&void 0!==e?e:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastChild",{get:function(){return this.children.length>0?this.children[this.children.length-1]:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"childNodes",{get:function(){return this.children},set:function(e){this.children=e},enumerable:!1,configurable:!0}),t}(le);ee.NodeWithChildren=fe;var de=function(e){function t(t){return e.call(this,oe.ElementType.Root,t)||this}return re(t,e),t}(fe);ee.Document=de;var he=function(e){function t(t,n,r,i){void 0===r&&(r=[]),void 0===i&&(i="script"===t?oe.ElementType.Script:"style"===t?oe.ElementType.Style:oe.ElementType.Tag);var o=e.call(this,i,r)||this;return o.name=t,o.attribs=n,o}return re(t,e),Object.defineProperty(t.prototype,"tagName",{get:function(){return this.name},set:function(e){this.name=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"attributes",{get:function(){var e=this;return Object.keys(this.attribs).map((function(t){var n,r;return{name:t,value:e.attribs[t],namespace:null===(n=e["x-attribsNamespace"])||void 0===n?void 0:n[t],prefix:null===(r=e["x-attribsPrefix"])||void 0===r?void 0:r[t]}}))},enumerable:!1,configurable:!0}),t}(fe);function me(e){return(0,oe.isTag)(e)}function ge(e){return e.type===oe.ElementType.CDATA}function ye(e){return e.type===oe.ElementType.Text}function ve(e){return e.type===oe.ElementType.Comment}function be(e){return e.type===oe.ElementType.Directive}function xe(e){return e.type===oe.ElementType.Root}function ke(e,t){var n;if(void 0===t&&(t=!1),ye(e))n=new ce(e.data);else if(ve(e))n=new ue(e.data);else if(me(e)){var r=t?Te(e.children):[],i=new he(e.name,ie({},e.attribs),r);r.forEach((function(e){return e.parent=i})),null!=e.namespace&&(i.namespace=e.namespace),e["x-attribsNamespace"]&&(i["x-attribsNamespace"]=ie({},e["x-attribsNamespace"])),e["x-attribsPrefix"]&&(i["x-attribsPrefix"]=ie({},e["x-attribsPrefix"])),n=i}else if(ge(e)){r=t?Te(e.children):[];var o=new fe(oe.ElementType.CDATA,r);r.forEach((function(e){return e.parent=o})),n=o}else if(xe(e)){r=t?Te(e.children):[];var a=new de(r);r.forEach((function(e){return e.parent=a})),e["x-mode"]&&(a["x-mode"]=e["x-mode"]),n=a}else{if(!be(e))throw new Error("Not implemented yet: ".concat(e.type));var l=new pe(e.name,e.data);null!=e["x-name"]&&(l["x-name"]=e["x-name"],l["x-publicId"]=e["x-publicId"],l["x-systemId"]=e["x-systemId"]),n=l}return n.startIndex=e.startIndex,n.endIndex=e.endIndex,null!=e.sourceCodeLocation&&(n.sourceCodeLocation=e.sourceCodeLocation),n}function Te(e){for(var t=e.map((function(e){return ke(e,!0)})),n=1;n<t.length;n++)t[n].prev=t[n-1],t[n-1].next=t[n];return t}ee.Element=he,ee.isTag=me,ee.isCDATA=ge,ee.isText=ye,ee.isComment=ve,ee.isDirective=be,ee.isDocument=xe,ee.hasChildren=function(e){return Object.prototype.hasOwnProperty.call(e,"children")},ee.cloneNode=ke;for(var Ee,we=ee,Ce=Q.CASE_SENSITIVE_TAG_NAMES,Se=we.Comment,Ae=we.Element,Oe=we.ProcessingInstruction,Pe=we.Text,De={},Me=0,Ne=Ce.length;Me<Ne;Me++)Ee=Ce[Me],De[Ee.toLowerCase()]=Ee;function Re(e){for(var t,n={},r=0,i=e.length;r<i;r++)n[(t=e[r]).name]=t.value;return n}function Le(e){var t=function(e){return De[e]}(e=e.toLowerCase());return t||e}var Ie=function e(t,n,r){n=n||null;for(var i=[],o=0,a=t.length;o<a;o++){var l,s=t[o];switch(s.nodeType){case 1:(l=new Ae(Le(s.nodeName),Re(s.attributes))).children=e(s.childNodes,l);break;case 3:l=new Pe(s.nodeValue);break;case 8:l=new Se(s.nodeValue);break;default:continue}var c=i[o-1]||null;c&&(c.next=l),l.parent=n,l.prev=c,l.next=null,i.push(l)}return r&&((l=new Oe(r.substring(0,r.indexOf(" ")).toLowerCase(),r)).next=i[0]||null,l.parent=n,i.unshift(l),i[1]&&(i[1].prev=i[0])),i},Fe=function(){return/(MSIE |Trident\/|Edge\/)/.test(navigator.userAgent)},_e="html",je="head",ze="body",Be=/<([a-zA-Z]+[0-9]?)/,He=/<head.*>/i,Ve=/<body.*>/i,Ue=function(){throw new Error("This browser does not support `document.implementation.createHTMLDocument`")},qe=function(){throw new Error("This browser does not support `DOMParser.prototype.parseFromString`")};if("function"==typeof window.DOMParser){var We=new window.DOMParser;qe=function(e,t){return t&&(e="<"+t+">"+e+"</"+t+">"),We.parseFromString(e,"text/html")},Ue=qe}if(document.implementation){var Xe=Fe,Ge=document.implementation.createHTMLDocument(Xe()?"html-dom-parser":void 0);Ue=function(e,t){return t?(Ge.documentElement.getElementsByTagName(t)[0].innerHTML=e,Ge):(Ge.documentElement.innerHTML=e,Ge)}}var Ye,Ze=document.createElement("template");Ze.content&&(Ye=function(e){return Ze.innerHTML=e,Ze.content.childNodes});var $e=function(e){var t,n,r,i,o=e.match(Be);switch(o&&o[1]&&(t=o[1].toLowerCase()),t){case _e:return n=qe(e),He.test(e)||(r=n.getElementsByTagName(je)[0])&&r.parentNode.removeChild(r),Ve.test(e)||(r=n.getElementsByTagName(ze)[0])&&r.parentNode.removeChild(r),n.getElementsByTagName(_e);case je:case ze:return i=Ue(e).getElementsByTagName(t),Ve.test(e)&&He.test(e)?i[0].parentNode.childNodes:i;default:return Ye?Ye(e):Ue(e,ze).getElementsByTagName(ze)[0].childNodes}},Ke=$e,Je=Ie,Qe=/<(![a-zA-Z\s]+)>/;var et=J,tt=W,nt=function(e){if("string"!=typeof e)throw new TypeError("First argument must be a string");if(""===e)return[];var t,n=e.match(Qe);return n&&n[1]&&(t=n[1]),Je(Ke(e),null,t)},rt={lowerCaseAttributeNames:!1};function it(e,t){if("string"!=typeof e)throw new TypeError("First argument must be a string");return""===e?[]:et(nt(e,(t=t||{}).htmlparser2||rt),t)}return it.domToReact=et,it.htmlToDOM=nt,it.attributesToProps=tt,it.Element=ee.Element,i.exports=it,i.exports.default=it,i.exports})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).HTMLReactParser=t(e.React)}(this,(function(e){"use strict";function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=t(e),r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},i={exports:{}},o={},a={};a.SAME=0;function l(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,i,o=[],a=!0,l=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);a=!0);}catch(e){l=!0,i=e}finally{try{a||null==n.return||n.return()}finally{if(l)throw i}}return o}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return s(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return s(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}a.CAMELCASE=1,a.possibleStandardNames={accept:0,acceptCharset:1,"accept-charset":"acceptCharset",accessKey:1,action:0,allowFullScreen:1,alt:0,as:0,async:0,autoCapitalize:1,autoComplete:1,autoCorrect:1,autoFocus:1,autoPlay:1,autoSave:1,capture:0,cellPadding:1,cellSpacing:1,challenge:0,charSet:1,checked:0,children:0,cite:0,class:"className",classID:1,className:1,cols:0,colSpan:1,content:0,contentEditable:1,contextMenu:1,controls:0,controlsList:1,coords:0,crossOrigin:1,dangerouslySetInnerHTML:1,data:0,dateTime:1,default:0,defaultChecked:1,defaultValue:1,defer:0,dir:0,disabled:0,disablePictureInPicture:1,disableRemotePlayback:1,download:0,draggable:0,encType:1,enterKeyHint:1,for:"htmlFor",form:0,formMethod:1,formAction:1,formEncType:1,formNoValidate:1,formTarget:1,frameBorder:1,headers:0,height:0,hidden:0,high:0,href:0,hrefLang:1,htmlFor:1,httpEquiv:1,"http-equiv":"httpEquiv",icon:0,id:0,innerHTML:1,inputMode:1,integrity:0,is:0,itemID:1,itemProp:1,itemRef:1,itemScope:1,itemType:1,keyParams:1,keyType:1,kind:0,label:0,lang:0,list:0,loop:0,low:0,manifest:0,marginWidth:1,marginHeight:1,max:0,maxLength:1,media:0,mediaGroup:1,method:0,min:0,minLength:1,multiple:0,muted:0,name:0,noModule:1,nonce:0,noValidate:1,open:0,optimum:0,pattern:0,placeholder:0,playsInline:1,poster:0,preload:0,profile:0,radioGroup:1,readOnly:1,referrerPolicy:1,rel:0,required:0,reversed:0,role:0,rows:0,rowSpan:1,sandbox:0,scope:0,scoped:0,scrolling:0,seamless:0,selected:0,shape:0,size:0,sizes:0,span:0,spellCheck:1,src:0,srcDoc:1,srcLang:1,srcSet:1,start:0,step:0,style:0,summary:0,tabIndex:1,target:0,title:0,type:0,useMap:1,value:0,width:0,wmode:0,wrap:0,about:0,accentHeight:1,"accent-height":"accentHeight",accumulate:0,additive:0,alignmentBaseline:1,"alignment-baseline":"alignmentBaseline",allowReorder:1,alphabetic:0,amplitude:0,arabicForm:1,"arabic-form":"arabicForm",ascent:0,attributeName:1,attributeType:1,autoReverse:1,azimuth:0,baseFrequency:1,baselineShift:1,"baseline-shift":"baselineShift",baseProfile:1,bbox:0,begin:0,bias:0,by:0,calcMode:1,capHeight:1,"cap-height":"capHeight",clip:0,clipPath:1,"clip-path":"clipPath",clipPathUnits:1,clipRule:1,"clip-rule":"clipRule",color:0,colorInterpolation:1,"color-interpolation":"colorInterpolation",colorInterpolationFilters:1,"color-interpolation-filters":"colorInterpolationFilters",colorProfile:1,"color-profile":"colorProfile",colorRendering:1,"color-rendering":"colorRendering",contentScriptType:1,contentStyleType:1,cursor:0,cx:0,cy:0,d:0,datatype:0,decelerate:0,descent:0,diffuseConstant:1,direction:0,display:0,divisor:0,dominantBaseline:1,"dominant-baseline":"dominantBaseline",dur:0,dx:0,dy:0,edgeMode:1,elevation:0,enableBackground:1,"enable-background":"enableBackground",end:0,exponent:0,externalResourcesRequired:1,fill:0,fillOpacity:1,"fill-opacity":"fillOpacity",fillRule:1,"fill-rule":"fillRule",filter:0,filterRes:1,filterUnits:1,floodOpacity:1,"flood-opacity":"floodOpacity",floodColor:1,"flood-color":"floodColor",focusable:0,fontFamily:1,"font-family":"fontFamily",fontSize:1,"font-size":"fontSize",fontSizeAdjust:1,"font-size-adjust":"fontSizeAdjust",fontStretch:1,"font-stretch":"fontStretch",fontStyle:1,"font-style":"fontStyle",fontVariant:1,"font-variant":"fontVariant",fontWeight:1,"font-weight":"fontWeight",format:0,from:0,fx:0,fy:0,g1:0,g2:0,glyphName:1,"glyph-name":"glyphName",glyphOrientationHorizontal:1,"glyph-orientation-horizontal":"glyphOrientationHorizontal",glyphOrientationVertical:1,"glyph-orientation-vertical":"glyphOrientationVertical",glyphRef:1,gradientTransform:1,gradientUnits:1,hanging:0,horizAdvX:1,"horiz-adv-x":"horizAdvX",horizOriginX:1,"horiz-origin-x":"horizOriginX",ideographic:0,imageRendering:1,"image-rendering":"imageRendering",in2:0,in:0,inlist:0,intercept:0,k1:0,k2:0,k3:0,k4:0,k:0,kernelMatrix:1,kernelUnitLength:1,kerning:0,keyPoints:1,keySplines:1,keyTimes:1,lengthAdjust:1,letterSpacing:1,"letter-spacing":"letterSpacing",lightingColor:1,"lighting-color":"lightingColor",limitingConeAngle:1,local:0,markerEnd:1,"marker-end":"markerEnd",markerHeight:1,markerMid:1,"marker-mid":"markerMid",markerStart:1,"marker-start":"markerStart",markerUnits:1,markerWidth:1,mask:0,maskContentUnits:1,maskUnits:1,mathematical:0,mode:0,numOctaves:1,offset:0,opacity:0,operator:0,order:0,orient:0,orientation:0,origin:0,overflow:0,overlinePosition:1,"overline-position":"overlinePosition",overlineThickness:1,"overline-thickness":"overlineThickness",paintOrder:1,"paint-order":"paintOrder",panose1:0,"panose-1":"panose1",pathLength:1,patternContentUnits:1,patternTransform:1,patternUnits:1,pointerEvents:1,"pointer-events":"pointerEvents",points:0,pointsAtX:1,pointsAtY:1,pointsAtZ:1,prefix:0,preserveAlpha:1,preserveAspectRatio:1,primitiveUnits:1,property:0,r:0,radius:0,refX:1,refY:1,renderingIntent:1,"rendering-intent":"renderingIntent",repeatCount:1,repeatDur:1,requiredExtensions:1,requiredFeatures:1,resource:0,restart:0,result:0,results:0,rotate:0,rx:0,ry:0,scale:0,security:0,seed:0,shapeRendering:1,"shape-rendering":"shapeRendering",slope:0,spacing:0,specularConstant:1,specularExponent:1,speed:0,spreadMethod:1,startOffset:1,stdDeviation:1,stemh:0,stemv:0,stitchTiles:1,stopColor:1,"stop-color":"stopColor",stopOpacity:1,"stop-opacity":"stopOpacity",strikethroughPosition:1,"strikethrough-position":"strikethroughPosition",strikethroughThickness:1,"strikethrough-thickness":"strikethroughThickness",string:0,stroke:0,strokeDasharray:1,"stroke-dasharray":"strokeDasharray",strokeDashoffset:1,"stroke-dashoffset":"strokeDashoffset",strokeLinecap:1,"stroke-linecap":"strokeLinecap",strokeLinejoin:1,"stroke-linejoin":"strokeLinejoin",strokeMiterlimit:1,"stroke-miterlimit":"strokeMiterlimit",strokeWidth:1,"stroke-width":"strokeWidth",strokeOpacity:1,"stroke-opacity":"strokeOpacity",suppressContentEditableWarning:1,suppressHydrationWarning:1,surfaceScale:1,systemLanguage:1,tableValues:1,targetX:1,targetY:1,textAnchor:1,"text-anchor":"textAnchor",textDecoration:1,"text-decoration":"textDecoration",textLength:1,textRendering:1,"text-rendering":"textRendering",to:0,transform:0,typeof:0,u1:0,u2:0,underlinePosition:1,"underline-position":"underlinePosition",underlineThickness:1,"underline-thickness":"underlineThickness",unicode:0,unicodeBidi:1,"unicode-bidi":"unicodeBidi",unicodeRange:1,"unicode-range":"unicodeRange",unitsPerEm:1,"units-per-em":"unitsPerEm",unselectable:0,vAlphabetic:1,"v-alphabetic":"vAlphabetic",values:0,vectorEffect:1,"vector-effect":"vectorEffect",version:0,vertAdvY:1,"vert-adv-y":"vertAdvY",vertOriginX:1,"vert-origin-x":"vertOriginX",vertOriginY:1,"vert-origin-y":"vertOriginY",vHanging:1,"v-hanging":"vHanging",vIdeographic:1,"v-ideographic":"vIdeographic",viewBox:1,viewTarget:1,visibility:0,vMathematical:1,"v-mathematical":"vMathematical",vocab:0,widths:0,wordSpacing:1,"word-spacing":"wordSpacing",writingMode:1,"writing-mode":"writingMode",x1:0,x2:0,x:0,xChannelSelector:1,xHeight:1,"x-height":"xHeight",xlinkActuate:1,"xlink:actuate":"xlinkActuate",xlinkArcrole:1,"xlink:arcrole":"xlinkArcrole",xlinkHref:1,"xlink:href":"xlinkHref",xlinkRole:1,"xlink:role":"xlinkRole",xlinkShow:1,"xlink:show":"xlinkShow",xlinkTitle:1,"xlink:title":"xlinkTitle",xlinkType:1,"xlink:type":"xlinkType",xmlBase:1,"xml:base":"xmlBase",xmlLang:1,"xml:lang":"xmlLang",xmlns:0,"xml:space":"xmlSpace",xmlnsXlink:1,"xmlns:xlink":"xmlnsXlink",xmlSpace:1,y1:0,y2:0,y:0,yChannelSelector:1,z:0,zoomAndPan:1},Object.defineProperty(o,"__esModule",{value:!0});function c(e,t,n,r,i,o,a){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=a}var u={};["children","dangerouslySetInnerHTML","defaultValue","defaultChecked","innerHTML","suppressContentEditableWarning","suppressHydrationWarning","style"].forEach((function(e){u[e]=new c(e,0,!1,e,null,!1,!1)})),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach((function(e){var t=l(e,2),n=t[0],r=t[1];u[n]=new c(n,1,!1,r,null,!1,!1)})),["contentEditable","draggable","spellCheck","value"].forEach((function(e){u[e]=new c(e,2,!1,e.toLowerCase(),null,!1,!1)})),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach((function(e){u[e]=new c(e,2,!1,e,null,!1,!1)})),["allowFullScreen","async","autoFocus","autoPlay","controls","default","defer","disabled","disablePictureInPicture","disableRemotePlayback","formNoValidate","hidden","loop","noModule","noValidate","open","playsInline","readOnly","required","reversed","scoped","seamless","itemScope"].forEach((function(e){u[e]=new c(e,3,!1,e.toLowerCase(),null,!1,!1)})),["checked","multiple","muted","selected"].forEach((function(e){u[e]=new c(e,3,!0,e,null,!1,!1)})),["capture","download"].forEach((function(e){u[e]=new c(e,4,!1,e,null,!1,!1)})),["cols","rows","size","span"].forEach((function(e){u[e]=new c(e,6,!1,e,null,!1,!1)})),["rowSpan","start"].forEach((function(e){u[e]=new c(e,5,!1,e.toLowerCase(),null,!1,!1)}));var p=/[\-\:]([a-z])/g,f=function(e){return e[1].toUpperCase()};["accent-height","alignment-baseline","arabic-form","baseline-shift","cap-height","clip-path","clip-rule","color-interpolation","color-interpolation-filters","color-profile","color-rendering","dominant-baseline","enable-background","fill-opacity","fill-rule","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","glyph-name","glyph-orientation-horizontal","glyph-orientation-vertical","horiz-adv-x","horiz-origin-x","image-rendering","letter-spacing","lighting-color","marker-end","marker-mid","marker-start","overline-position","overline-thickness","paint-order","panose-1","pointer-events","rendering-intent","shape-rendering","stop-color","stop-opacity","strikethrough-position","strikethrough-thickness","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-anchor","text-decoration","text-rendering","underline-position","underline-thickness","unicode-bidi","unicode-range","units-per-em","v-alphabetic","v-hanging","v-ideographic","v-mathematical","vector-effect","vert-adv-y","vert-origin-x","vert-origin-y","word-spacing","writing-mode","xmlns:xlink","x-height"].forEach((function(e){var t=e.replace(p,f);u[t]=new c(t,1,!1,e,null,!1,!1)})),["xlink:actuate","xlink:arcrole","xlink:role","xlink:show","xlink:title","xlink:type"].forEach((function(e){var t=e.replace(p,f);u[t]=new c(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)})),["xml:base","xml:lang","xml:space"].forEach((function(e){var t=e.replace(p,f);u[t]=new c(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)})),["tabIndex","crossOrigin"].forEach((function(e){u[e]=new c(e,1,!1,e.toLowerCase(),null,!1,!1)}));u.xlinkHref=new c("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach((function(e){u[e]=new c(e,1,!1,e.toLowerCase(),null,!0,!0)}));var d=a,h=d.CAMELCASE,m=d.SAME,g=d.possibleStandardNames,y=RegExp.prototype.test.bind(new RegExp("^(data|aria)-[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$")),v=Object.keys(g).reduce((function(e,t){var n=g[t];return n===m?e[t]=t:n===h?e[t.toLowerCase()]=t:e[t]=n,e}),{});o.BOOLEAN=3,o.BOOLEANISH_STRING=2,o.NUMERIC=5,o.OVERLOADED_BOOLEAN=4,o.POSITIVE_NUMERIC=6,o.RESERVED=0,o.STRING=1,o.getPropertyInfo=function(e){return u.hasOwnProperty(e)?u[e]:null},o.isCustomAttribute=y,o.possibleStandardNames=v;var b={},x=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,k=/\n/g,T=/^\s*/,E=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,w=/^:\s*/,C=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,S=/^[;\s]*/,A=/^\s+|\s+$/g,O="";function P(e){return e?e.replace(A,O):O}var N=function(e,t){if("string"!=typeof e)throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function i(e){var t=e.match(k);t&&(n+=t.length);var i=e.lastIndexOf("\n");r=~i?e.length-i:r+e.length}function o(){var e={line:n,column:r};return function(t){return t.position=new a(e),c(),t}}function a(e){this.start=e,this.end={line:n,column:r},this.source=t.source}function l(i){var o=new Error(t.source+":"+n+":"+r+": "+i);if(o.reason=i,o.filename=t.source,o.line=n,o.column=r,o.source=e,!t.silent)throw o}function s(t){var n=t.exec(e);if(n){var r=n[0];return i(r),e=e.slice(r.length),n}}function c(){s(T)}function u(e){var t;for(e=e||[];t=p();)!1!==t&&e.push(t);return e}function p(){var t=o();if("/"==e.charAt(0)&&"*"==e.charAt(1)){for(var n=2;O!=e.charAt(n)&&("*"!=e.charAt(n)||"/"!=e.charAt(n+1));)++n;if(n+=2,O===e.charAt(n-1))return l("End of comment missing");var a=e.slice(2,n-2);return r+=2,i(a),e=e.slice(n),r+=2,t({type:"comment",comment:a})}}function f(){var e=o(),t=s(E);if(t){if(p(),!s(w))return l("property missing ':'");var n=s(C),r=e({type:"declaration",property:P(t[0].replace(x,O)),value:n?P(n[0].replace(x,O)):O});return s(S),r}}return a.prototype.content=e,c(),function(){var e,t=[];for(u(t);e=f();)!1!==e&&(t.push(e),u(t));return t}()};var D=function(e,t){var n,r=null;if(!e||"string"!=typeof e)return r;for(var i,o,a=N(e),l="function"==typeof t,s=0,c=a.length;s<c;s++)i=(n=a[s]).property,o=n.value,l?t(i,o,n):o&&(r||(r={}),r[i]=o);return r},M={__esModule:!0,camelCase:void 0},R=/^--[a-zA-Z0-9-]+$/,L=/-([a-z])/g,I=/^[^-]+$/,F=/^-(webkit|moz|ms|o|khtml)-/,_=function(e,t){return t.toUpperCase()},j=function(e,t){return t+"-"};M.camelCase=function(e,t){return void 0===t&&(t={}),function(e){return!e||I.test(e)||R.test(e)}(e)?e:(e=e.toLowerCase(),t.reactCompat||(e=e.replace(F,j)),e.replace(L,_))},function(e){var t=r&&r.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};e.__esModule=!0;var n=t(D),i=M;e.default=function(e,t){var r={};return e&&"string"==typeof e?(n.default(e,(function(e,n){e&&n&&(r[i.camelCase(e,t)]=n)})),r):r}}(b);var z=n.default,B=b.default;var H={reactCompat:!0};var V=z.version.split(".")[0]>=16,U=new Set(["tr","tbody","thead","tfoot","colgroup","table","head","html","frameset"]);var q={PRESERVE_CUSTOM_ATTRIBUTES:V,invertObject:function(e,t){if(!e||"object"!=typeof e)throw new TypeError("First argument must be an object");var n,r,i="function"==typeof t,o={},a={};for(n in e)r=e[n],i&&(o=t(n,r))&&2===o.length?a[o[0]]=o[1]:"string"==typeof r&&(a[r]=n);return a},isCustomComponent:function(e,t){if(-1===e.indexOf("-"))return t&&"string"==typeof t.is;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}},setStyleProp:function(e,t){if(null!=e)try{t.style=B(e,H)}catch(e){t.style={}}},canTextBeChildOfNode:function(e){return!U.has(e.name)},elementsWithNoTextChildren:U},W=o,X=q,G=function(e){var t,n,r,i,o;e=e||{};var a={};for(t in e)if(r=e[t],W.isCustomAttribute(t))a[t]=r;else if(i=Y(n=t.toLowerCase()))switch(o=W.getPropertyInfo(i),"checked"!==i&&"value"!==i||(i=Y("default"+n)),a[i]=r,o&&o.type){case W.BOOLEAN:a[i]=!0;break;case W.OVERLOADED_BOOLEAN:""===r&&(a[i]=!0)}else X.PRESERVE_CUSTOM_ATTRIBUTES&&(a[t]=r);return X.setStyleProp(e.style,a),a};function Y(e){return W.possibleStandardNames[e]}var Z=n.default,$=G,K=q,J=K.setStyleProp,Q=K.canTextBeChildOfNode;function ee(e){return K.PRESERVE_CUSTOM_ATTRIBUTES&&"tag"===e.type&&K.isCustomComponent(e.name,e.attribs)}var te=function e(t,n){for(var r,i,o,a,l,s=(n=n||{}).library||Z,c=s.cloneElement,u=s.createElement,p=s.isValidElement,f=[],d="function"==typeof n.replace,h=n.trim,m=0,g=t.length;m<g;m++)if(r=t[m],d&&p(o=n.replace(r)))g>1&&(o=c(o,{key:o.key||m})),f.push(o);else if("text"!==r.type){switch(a=r.attribs,ee(r)?J(a.style,a):a&&(a=$(a)),l=null,r.type){case"script":case"style":r.children[0]&&(a.dangerouslySetInnerHTML={__html:r.children[0].data});break;case"tag":"textarea"===r.name&&r.children[0]?a.defaultValue=r.children[0].data:r.children&&r.children.length&&(l=e(r.children,n));break;default:continue}g>1&&(a.key=m),f.push(u(r.name,a,l))}else{if((i=!r.data.trim().length)&&r.parent&&!Q(r.parent))continue;if(h&&i)continue;f.push(r.data)}return 1===f.length?f[0]:f},ne={CASE_SENSITIVE_TAG_NAMES:["animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussainBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","linearGradient","radialGradient","textPath"]},re={},ie={};!function(e){var t;Object.defineProperty(e,"__esModule",{value:!0}),e.Doctype=e.CDATA=e.Tag=e.Style=e.Script=e.Comment=e.Directive=e.Text=e.Root=e.isTag=e.ElementType=void 0,function(e){e.Root="root",e.Text="text",e.Directive="directive",e.Comment="comment",e.Script="script",e.Style="style",e.Tag="tag",e.CDATA="cdata",e.Doctype="doctype"}(t=e.ElementType||(e.ElementType={})),e.isTag=function(e){return e.type===t.Tag||e.type===t.Script||e.type===t.Style},e.Root=t.Root,e.Text=t.Text,e.Directive=t.Directive,e.Comment=t.Comment,e.Script=t.Script,e.Style=t.Style,e.Tag=t.Tag,e.CDATA=t.CDATA,e.Doctype=t.Doctype}(ie);var oe,ae=r&&r.__extends||(oe=function(e,t){return oe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},oe(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}oe(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),le=r&&r.__assign||function(){return le=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},le.apply(this,arguments)};Object.defineProperty(re,"__esModule",{value:!0}),re.cloneNode=re.hasChildren=re.isDocument=re.isDirective=re.isComment=re.isText=re.isCDATA=re.isTag=re.Element=re.Document=re.NodeWithChildren=re.ProcessingInstruction=re.Comment=re.Text=re.DataNode=re.Node=void 0;var se=ie,ce=new Map([[se.ElementType.Tag,1],[se.ElementType.Script,1],[se.ElementType.Style,1],[se.ElementType.Directive,1],[se.ElementType.Text,3],[se.ElementType.CDATA,4],[se.ElementType.Comment,8],[se.ElementType.Root,9]]),ue=function(){function e(e){this.type=e,this.parent=null,this.prev=null,this.next=null,this.startIndex=null,this.endIndex=null}return Object.defineProperty(e.prototype,"nodeType",{get:function(){var e;return null!==(e=ce.get(this.type))&&void 0!==e?e:1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parentNode",{get:function(){return this.parent},set:function(e){this.parent=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"previousSibling",{get:function(){return this.prev},set:function(e){this.prev=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"nextSibling",{get:function(){return this.next},set:function(e){this.next=e},enumerable:!1,configurable:!0}),e.prototype.cloneNode=function(e){return void 0===e&&(e=!1),we(this,e)},e}();re.Node=ue;var pe=function(e){function t(t,n){var r=e.call(this,t)||this;return r.data=n,r}return ae(t,e),Object.defineProperty(t.prototype,"nodeValue",{get:function(){return this.data},set:function(e){this.data=e},enumerable:!1,configurable:!0}),t}(ue);re.DataNode=pe;var fe=function(e){function t(t){return e.call(this,se.ElementType.Text,t)||this}return ae(t,e),t}(pe);re.Text=fe;var de=function(e){function t(t){return e.call(this,se.ElementType.Comment,t)||this}return ae(t,e),t}(pe);re.Comment=de;var he=function(e){function t(t,n){var r=e.call(this,se.ElementType.Directive,n)||this;return r.name=t,r}return ae(t,e),t}(pe);re.ProcessingInstruction=he;var me=function(e){function t(t,n){var r=e.call(this,t)||this;return r.children=n,r}return ae(t,e),Object.defineProperty(t.prototype,"firstChild",{get:function(){var e;return null!==(e=this.children[0])&&void 0!==e?e:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastChild",{get:function(){return this.children.length>0?this.children[this.children.length-1]:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"childNodes",{get:function(){return this.children},set:function(e){this.children=e},enumerable:!1,configurable:!0}),t}(ue);re.NodeWithChildren=me;var ge=function(e){function t(t){return e.call(this,se.ElementType.Root,t)||this}return ae(t,e),t}(me);re.Document=ge;var ye=function(e){function t(t,n,r,i){void 0===r&&(r=[]),void 0===i&&(i="script"===t?se.ElementType.Script:"style"===t?se.ElementType.Style:se.ElementType.Tag);var o=e.call(this,i,r)||this;return o.name=t,o.attribs=n,o}return ae(t,e),Object.defineProperty(t.prototype,"tagName",{get:function(){return this.name},set:function(e){this.name=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"attributes",{get:function(){var e=this;return Object.keys(this.attribs).map((function(t){var n,r;return{name:t,value:e.attribs[t],namespace:null===(n=e["x-attribsNamespace"])||void 0===n?void 0:n[t],prefix:null===(r=e["x-attribsPrefix"])||void 0===r?void 0:r[t]}}))},enumerable:!1,configurable:!0}),t}(me);function ve(e){return(0,se.isTag)(e)}function be(e){return e.type===se.ElementType.CDATA}function xe(e){return e.type===se.ElementType.Text}function ke(e){return e.type===se.ElementType.Comment}function Te(e){return e.type===se.ElementType.Directive}function Ee(e){return e.type===se.ElementType.Root}function we(e,t){var n;if(void 0===t&&(t=!1),xe(e))n=new fe(e.data);else if(ke(e))n=new de(e.data);else if(ve(e)){var r=t?Ce(e.children):[],i=new ye(e.name,le({},e.attribs),r);r.forEach((function(e){return e.parent=i})),null!=e.namespace&&(i.namespace=e.namespace),e["x-attribsNamespace"]&&(i["x-attribsNamespace"]=le({},e["x-attribsNamespace"])),e["x-attribsPrefix"]&&(i["x-attribsPrefix"]=le({},e["x-attribsPrefix"])),n=i}else if(be(e)){r=t?Ce(e.children):[];var o=new me(se.ElementType.CDATA,r);r.forEach((function(e){return e.parent=o})),n=o}else if(Ee(e)){r=t?Ce(e.children):[];var a=new ge(r);r.forEach((function(e){return e.parent=a})),e["x-mode"]&&(a["x-mode"]=e["x-mode"]),n=a}else{if(!Te(e))throw new Error("Not implemented yet: ".concat(e.type));var l=new he(e.name,e.data);null!=e["x-name"]&&(l["x-name"]=e["x-name"],l["x-publicId"]=e["x-publicId"],l["x-systemId"]=e["x-systemId"]),n=l}return n.startIndex=e.startIndex,n.endIndex=e.endIndex,null!=e.sourceCodeLocation&&(n.sourceCodeLocation=e.sourceCodeLocation),n}function Ce(e){for(var t=e.map((function(e){return we(e,!0)})),n=1;n<t.length;n++)t[n].prev=t[n-1],t[n-1].next=t[n];return t}re.Element=ye,re.isTag=ve,re.isCDATA=be,re.isText=xe,re.isComment=ke,re.isDirective=Te,re.isDocument=Ee,re.hasChildren=function(e){return Object.prototype.hasOwnProperty.call(e,"children")},re.cloneNode=we;for(var Se,Ae=re,Oe=ne.CASE_SENSITIVE_TAG_NAMES,Pe=Ae.Comment,Ne=Ae.Element,De=Ae.ProcessingInstruction,Me=Ae.Text,Re={},Le=0,Ie=Oe.length;Le<Ie;Le++)Se=Oe[Le],Re[Se.toLowerCase()]=Se;function Fe(e){for(var t,n={},r=0,i=e.length;r<i;r++)n[(t=e[r]).name]=t.value;return n}function _e(e){var t=function(e){return Re[e]}(e=e.toLowerCase());return t||e}var je=function e(t,n,r){n=n||null;for(var i=[],o=0,a=t.length;o<a;o++){var l,s=t[o];switch(s.nodeType){case 1:(l=new Ne(_e(s.nodeName),Fe(s.attributes))).children=e(s.childNodes,l);break;case 3:l=new Me(s.nodeValue);break;case 8:l=new Pe(s.nodeValue);break;default:continue}var c=i[o-1]||null;c&&(c.next=l),l.parent=n,l.prev=c,l.next=null,i.push(l)}return r&&((l=new De(r.substring(0,r.indexOf(" ")).toLowerCase(),r)).next=i[0]||null,l.parent=n,i.unshift(l),i[1]&&(i[1].prev=i[0])),i},ze=function(){return/(MSIE |Trident\/|Edge\/)/.test(navigator.userAgent)},Be="html",He="head",Ve="body",Ue=/<([a-zA-Z]+[0-9]?)/,qe=/<head.*>/i,We=/<body.*>/i,Xe=function(){throw new Error("This browser does not support `document.implementation.createHTMLDocument`")},Ge=function(){throw new Error("This browser does not support `DOMParser.prototype.parseFromString`")};if("function"==typeof window.DOMParser){var Ye=new window.DOMParser;Ge=function(e,t){return t&&(e="<"+t+">"+e+"</"+t+">"),Ye.parseFromString(e,"text/html")},Xe=Ge}if(document.implementation){var Ze=ze,$e=document.implementation.createHTMLDocument(Ze()?"html-dom-parser":void 0);Xe=function(e,t){return t?($e.documentElement.getElementsByTagName(t)[0].innerHTML=e,$e):($e.documentElement.innerHTML=e,$e)}}var Ke,Je=document.createElement("template");Je.content&&(Ke=function(e){return Je.innerHTML=e,Je.content.childNodes});var Qe=function(e){var t,n,r,i,o=e.match(Ue);switch(o&&o[1]&&(t=o[1].toLowerCase()),t){case Be:return n=Ge(e),qe.test(e)||(r=n.getElementsByTagName(He)[0])&&r.parentNode.removeChild(r),We.test(e)||(r=n.getElementsByTagName(Ve)[0])&&r.parentNode.removeChild(r),n.getElementsByTagName(Be);case He:case Ve:return i=Xe(e).getElementsByTagName(t),We.test(e)&&qe.test(e)?i[0].parentNode.childNodes:i;default:return Ke?Ke(e):Xe(e,Ve).getElementsByTagName(Ve)[0].childNodes}},et=Qe,tt=je,nt=/<(![a-zA-Z\s]+)>/;var rt=te,it=G,ot=function(e){if("string"!=typeof e)throw new TypeError("First argument must be a string");if(""===e)return[];var t,n=e.match(nt);return n&&n[1]&&(t=n[1]),tt(et(e),null,t)},at={lowerCaseAttributeNames:!1};function lt(e,t){if("string"!=typeof e)throw new TypeError("First argument must be a string");return""===e?[]:rt(ot(e,(t=t||{}).htmlparser2||at),t)}return lt.domToReact=rt,lt.htmlToDOM=ot,lt.attributesToProps=it,lt.Element=re.Element,i.exports=lt,i.exports.default=lt,i.exports})); | ||
//# sourceMappingURL=html-react-parser.min.js.map |
@@ -6,2 +6,3 @@ var React = require('react'); | ||
var setStyleProp = utilities.setStyleProp; | ||
var canTextBeChildOfNode = utilities.canTextBeChildOfNode; | ||
@@ -27,2 +28,3 @@ /** | ||
var node; | ||
var isWhitespace; | ||
var hasReplace = typeof options.replace === 'function'; | ||
@@ -32,3 +34,2 @@ var replaceElement; | ||
var children; | ||
var data; | ||
var trim = options.trim; | ||
@@ -57,11 +58,19 @@ | ||
if (node.type === 'text') { | ||
// if trim option is enabled, skip whitespace text nodes | ||
if (trim) { | ||
data = node.data.trim(); | ||
if (data) { | ||
result.push(node.data); | ||
} | ||
} else { | ||
result.push(node.data); | ||
isWhitespace = !node.data.trim().length; | ||
if (isWhitespace && node.parent && !canTextBeChildOfNode(node.parent)) { | ||
// We have a whitespace node that can't be nested in its parent | ||
// so skip it | ||
continue; | ||
} | ||
if (trim && isWhitespace) { | ||
// Trim is enabled and we have a whitespace node | ||
// so skip it | ||
continue; | ||
} | ||
// We have a text node that's not whitespace and it can be nested | ||
// in its parent so add it to the results | ||
result.push(node.data); | ||
continue; | ||
@@ -68,0 +77,0 @@ } |
@@ -99,2 +99,26 @@ var React = require('react'); | ||
// Taken from | ||
// https://github.com/facebook/react/blob/cae635054e17a6f107a39d328649137b83f25972/packages/react-dom/src/client/validateDOMNesting.js#L213 | ||
var elementsWithNoTextChildren = new Set([ | ||
'tr', | ||
'tbody', | ||
'thead', | ||
'tfoot', | ||
'colgroup', | ||
'table', | ||
'head', | ||
'html', | ||
'frameset' | ||
]); | ||
/** | ||
* Checks if the given node can contain text nodes | ||
* | ||
* @param {DomElement} node | ||
* @returns {boolean} | ||
*/ | ||
function canTextBeChildOfNode(node) { | ||
return !elementsWithNoTextChildren.has(node.name); | ||
} | ||
module.exports = { | ||
@@ -104,3 +128,5 @@ PRESERVE_CUSTOM_ATTRIBUTES: PRESERVE_CUSTOM_ATTRIBUTES, | ||
isCustomComponent: isCustomComponent, | ||
setStyleProp: setStyleProp | ||
setStyleProp: setStyleProp, | ||
canTextBeChildOfNode: canTextBeChildOfNode, | ||
elementsWithNoTextChildren: elementsWithNoTextChildren | ||
}; |
{ | ||
"name": "html-react-parser", | ||
"version": "1.4.3", | ||
"version": "1.4.4", | ||
"description": "HTML to React parser.", | ||
@@ -49,6 +49,6 @@ "author": "Mark <mark@remarkablemark.org>", | ||
"@rollup/plugin-commonjs": "21.0.1", | ||
"@rollup/plugin-node-resolve": "13.0.6", | ||
"@rollup/plugin-node-resolve": "13.1.1", | ||
"@size-limit/preset-big-lib": "7.0.4", | ||
"@types/react": "17.0.37", | ||
"@typescript-eslint/parser": "5.6.0", | ||
"@typescript-eslint/parser": "5.7.0", | ||
"benchmark": "2.1.4", | ||
@@ -59,3 +59,3 @@ "dtslint": "4.2.1", | ||
"husky": "7.0.4", | ||
"jest": "27.4.4", | ||
"jest": "27.4.5", | ||
"lint-staged": "12.1.2", | ||
@@ -71,3 +71,3 @@ "pinst": "2.1.6", | ||
"size-limit": "7.0.4", | ||
"typescript": "4.5.3" | ||
"typescript": "4.5.4" | ||
}, | ||
@@ -74,0 +74,0 @@ "peerDependencies": { |
@@ -53,3 +53,2 @@ # html-react-parser | ||
- [Elements aren't nested correctly](#elements-arent-nested-correctly) | ||
- [Warning: validateDOMNesting(...): Whitespace text nodes cannot appear as a child of table](#warning-validatedomnesting-whitespace-text-nodes-cannot-appear-as-a-child-of-table) | ||
- [Don't change case of tags](#dont-change-case-of-tags) | ||
@@ -355,13 +354,13 @@ - [TS Error: Property 'attribs' does not exist on type 'DOMNode'](#ts-error-property-attribs-does-not-exist-on-type-domnode) | ||
To remove whitespace, enable the `trim` option: | ||
But certain elements like `<table>` will strip out invalid whitespace: | ||
```js | ||
parse('<br>\n', { trim: true }); // React.createElement('br') | ||
parse('<table>\n</table>'); // React.createElement('table') | ||
``` | ||
This fixes the warning: | ||
To remove whitespace, enable the `trim` option: | ||
```js | ||
parse('<br>\n', { trim: true }); // React.createElement('br') | ||
``` | ||
Warning: validateDOMNesting(...): Whitespace text nodes cannot appear as a child of <table>. Make sure you don't have any extra whitespace between tags on each line of your source code. | ||
``` | ||
@@ -432,6 +431,2 @@ However, intentional whitespace may be stripped out: | ||
### Warning: validateDOMNesting(...): Whitespace text nodes cannot appear as a child of table | ||
Enable the [trim](#trim) option. See [#155](https://github.com/remarkablemark/html-react-parser/issues/155). | ||
### Don't change case of tags | ||
@@ -438,0 +433,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
375797
2764
546