react-xml-viewer
Version:
Simple xml viewer component for React
11 lines (10 loc) • 36.3 kB
JavaScript
(function(d,g){typeof exports=="object"&&typeof module<"u"?module.exports=g(require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["react/jsx-runtime","react"],g):(d=typeof globalThis<"u"?globalThis:d||self,d.ReactXmlViewer=g(d.ReactJsxRuntime,d.React))})(this,function(d,g){"use strict";function ue(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const s=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,s.get?s:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const X=ue(g),B=":@",P="#text",V="#comment",L="#cdata",G="DECLARATION_TAG",fe="TAG",I={tagColor:"#d43900",textColor:"#333",attributeKeyColor:"#2a7ab0",attributeValueColor:"#008000",separatorColor:"#333",commentColor:"#aaa",cdataColor:"#1d781d",fontFamily:"monospace",lineNumberBackground:"#eee",lineNumberColor:"#222"},ce={lines:{},push:()=>{}},K=g.createContext(ce),de=({children:e})=>{const[t,n]=g.useState({}),s=g.useCallback((r,a)=>{n(l=>{var o;return((o=l[r])==null?void 0:o.element)===a.element?l:{...l,[r]:a}})},[]),i=g.useMemo(()=>({lines:t,push:s}),[t,s]);return d.jsx(K.Provider,{value:i,children:e})},U=()=>g.useContext(K),he={theme:I,collapsible:!1,indentSize:2},Z=g.createContext(he),m=()=>g.useContext(Z);function pe(e,t){return new Array(t*e+1).join(" ")}function j(e){return typeof e=="string"&&e.includes(`
`)}function ge(e){return typeof e=="string"?!1:e.length===1&&P in e[0]&&!j(e[0][P])}function Ne(e){switch(e){case P:case L:case V:return e;default:return e.startsWith("?")?G:fe}}function be(e,t){const n={};for(const s in e)s!==t&&(n[s]=e[s]);return n}function Te(e){const t=e[B],n=be(e,B),[[s,i]]=Object.entries(n),r=Ne(s);return{attributes:t,tagKey:s,subElements:i,type:r}}function ye(e,t){return Object.keys(I).every(s=>e[s]===t[s])}var S={},$={};(function(e){const t=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",n=t+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",s="["+t+"]["+n+"]*",i=new RegExp("^"+s+"$"),r=function(l,o){const f=[];let u=o.exec(l);for(;u;){const c=[];c.startIndex=o.lastIndex-u[0].length;const h=u.length;for(let N=0;N<h;N++)c.push(u[N]);f.push(c),u=o.exec(l)}return f},a=function(l){const o=i.exec(l);return!(o===null||typeof o>"u")};e.isExist=function(l){return typeof l<"u"},e.isEmptyObject=function(l){return Object.keys(l).length===0},e.merge=function(l,o,f){if(o){const u=Object.keys(o),c=u.length;for(let h=0;h<c;h++)f==="strict"?l[u[h]]=[o[u[h]]]:l[u[h]]=o[u[h]]}},e.getValue=function(l){return e.isExist(l)?l:""},e.isName=a,e.getAllMatches=r,e.nameRegexp=s})($);const F=$,Ee={allowBooleanAttributes:!1,unpairedTags:[]};S.validate=function(e,t){t=Object.assign({},Ee,t);const n=[];let s=!1,i=!1;e[0]==="\uFEFF"&&(e=e.substr(1));for(let r=0;r<e.length;r++)if(e[r]==="<"&&e[r+1]==="?"){if(r+=2,r=q(e,r),r.err)return r}else if(e[r]==="<"){let a=r;if(r++,e[r]==="!"){r=z(e,r);continue}else{let l=!1;e[r]==="/"&&(l=!0,r++);let o="";for(;r<e.length&&e[r]!==">"&&e[r]!==" "&&e[r]!==" "&&e[r]!==`
`&&e[r]!=="\r";r++)o+=e[r];if(o=o.trim(),o[o.length-1]==="/"&&(o=o.substring(0,o.length-1),r--),!Ie(o)){let c;return o.trim().length===0?c="Invalid space after '<'.":c="Tag '"+o+"' is an invalid name.",b("InvalidTag",c,T(e,r))}const f=Ae(e,r);if(f===!1)return b("InvalidAttr","Attributes for '"+o+"' have open quote.",T(e,r));let u=f.value;if(r=f.index,u[u.length-1]==="/"){const c=r-u.length;u=u.substring(0,u.length-1);const h=Y(u,t);if(h===!0)s=!0;else return b(h.err.code,h.err.msg,T(e,c+h.err.line))}else if(l)if(f.tagClosed){if(u.trim().length>0)return b("InvalidTag","Closing tag '"+o+"' can't have attributes or invalid starting.",T(e,a));if(n.length===0)return b("InvalidTag","Closing tag '"+o+"' has not been opened.",T(e,a));{const c=n.pop();if(o!==c.tagName){let h=T(e,c.tagStartPos);return b("InvalidTag","Expected closing tag '"+c.tagName+"' (opened in line "+h.line+", col "+h.col+") instead of closing tag '"+o+"'.",T(e,a))}n.length==0&&(i=!0)}}else return b("InvalidTag","Closing tag '"+o+"' doesn't have proper closing.",T(e,r));else{const c=Y(u,t);if(c!==!0)return b(c.err.code,c.err.msg,T(e,r-u.length+c.err.line));if(i===!0)return b("InvalidXml","Multiple possible root nodes found.",T(e,r));t.unpairedTags.indexOf(o)!==-1||n.push({tagName:o,tagStartPos:a}),s=!0}for(r++;r<e.length;r++)if(e[r]==="<")if(e[r+1]==="!"){r++,r=z(e,r);continue}else if(e[r+1]==="?"){if(r=q(e,++r),r.err)return r}else break;else if(e[r]==="&"){const c=Oe(e,r);if(c==-1)return b("InvalidChar","char '&' is not expected.",T(e,r));r=c}else if(i===!0&&!W(e[r]))return b("InvalidXml","Extra text at the end",T(e,r));e[r]==="<"&&r--}}else{if(W(e[r]))continue;return b("InvalidChar","char '"+e[r]+"' is not expected.",T(e,r))}if(s){if(n.length==1)return b("InvalidTag","Unclosed tag '"+n[0].tagName+"'.",T(e,n[0].tagStartPos));if(n.length>0)return b("InvalidXml","Invalid '"+JSON.stringify(n.map(r=>r.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return b("InvalidXml","Start tag expected.",1);return!0};function W(e){return e===" "||e===" "||e===`
`||e==="\r"}function q(e,t){const n=t;for(;t<e.length;t++)if(e[t]=="?"||e[t]==" "){const s=e.substr(n,t-n);if(t>5&&s==="xml")return b("InvalidXml","XML declaration allowed only at the start of the document.",T(e,t));if(e[t]=="?"&&e[t+1]==">"){t++;break}else continue}return t}function z(e,t){if(e.length>t+5&&e[t+1]==="-"&&e[t+2]==="-"){for(t+=3;t<e.length;t++)if(e[t]==="-"&&e[t+1]==="-"&&e[t+2]===">"){t+=2;break}}else if(e.length>t+8&&e[t+1]==="D"&&e[t+2]==="O"&&e[t+3]==="C"&&e[t+4]==="T"&&e[t+5]==="Y"&&e[t+6]==="P"&&e[t+7]==="E"){let n=1;for(t+=8;t<e.length;t++)if(e[t]==="<")n++;else if(e[t]===">"&&(n--,n===0))break}else if(e.length>t+9&&e[t+1]==="["&&e[t+2]==="C"&&e[t+3]==="D"&&e[t+4]==="A"&&e[t+5]==="T"&&e[t+6]==="A"&&e[t+7]==="["){for(t+=8;t<e.length;t++)if(e[t]==="]"&&e[t+1]==="]"&&e[t+2]===">"){t+=2;break}}return t}const me='"',Ce="'";function Ae(e,t){let n="",s="",i=!1;for(;t<e.length;t++){if(e[t]===me||e[t]===Ce)s===""?s=e[t]:s!==e[t]||(s="");else if(e[t]===">"&&s===""){i=!0;break}n+=e[t]}return s!==""?!1:{value:n,index:t,tagClosed:i}}const we=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function Y(e,t){const n=F.getAllMatches(e,we),s={};for(let i=0;i<n.length;i++){if(n[i][1].length===0)return b("InvalidAttr","Attribute '"+n[i][2]+"' has no space in starting.",v(n[i]));if(n[i][3]!==void 0&&n[i][4]===void 0)return b("InvalidAttr","Attribute '"+n[i][2]+"' is without value.",v(n[i]));if(n[i][3]===void 0&&!t.allowBooleanAttributes)return b("InvalidAttr","boolean attribute '"+n[i][2]+"' is not allowed.",v(n[i]));const r=n[i][2];if(!Pe(r))return b("InvalidAttr","Attribute '"+r+"' is an invalid name.",v(n[i]));if(!s.hasOwnProperty(r))s[r]=1;else return b("InvalidAttr","Attribute '"+r+"' is repeated.",v(n[i]))}return!0}function ve(e,t){let n=/\d/;for(e[t]==="x"&&(t++,n=/[\da-fA-F]/);t<e.length;t++){if(e[t]===";")return t;if(!e[t].match(n))break}return-1}function Oe(e,t){if(t++,e[t]===";")return-1;if(e[t]==="#")return t++,ve(e,t);let n=0;for(;t<e.length;t++,n++)if(!(e[t].match(/\w/)&&n<20)){if(e[t]===";")break;return-1}return t}function b(e,t,n){return{err:{code:e,msg:t,line:n.line||n,col:n.col}}}function Pe(e){return F.isName(e)}function Ie(e){return F.isName(e)}function T(e,t){const n=e.substring(0,t).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function v(e){return e.startIndex+e[1].length}var _={};const J={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(e,t,n){return e}},$e=function(e){return Object.assign({},J,e)};_.buildOptions=$e,_.defaultOptions=J;class xe{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,n){t==="__proto__"&&(t="#__proto__"),this.child.push({[t]:n})}addChild(t){t.tagname==="__proto__"&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}var Ve=xe;const Le=$;function Se(e,t){const n={};if(e[t+3]==="O"&&e[t+4]==="C"&&e[t+5]==="T"&&e[t+6]==="Y"&&e[t+7]==="P"&&e[t+8]==="E"){t=t+9;let s=1,i=!1,r=!1,a="";for(;t<e.length;t++)if(e[t]==="<"&&!r){if(i&&ke(e,t))t+=7,[entityName,val,t]=Fe(e,t+1),val.indexOf("&")===-1&&(n[Ge(entityName)]={regx:RegExp(`&${entityName};`,"g"),val});else if(i&&Me(e,t))t+=8;else if(i&&Xe(e,t))t+=8;else if(i&&Be(e,t))t+=9;else if(_e)r=!0;else throw new Error("Invalid DOCTYPE");s++,a=""}else if(e[t]===">"){if(r?e[t-1]==="-"&&e[t-2]==="-"&&(r=!1,s--):s--,s===0)break}else e[t]==="["?i=!0:a+=e[t];if(s!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:n,i:t}}function Fe(e,t){let n="";for(;t<e.length&&e[t]!=="'"&&e[t]!=='"';t++)n+=e[t];if(n=n.trim(),n.indexOf(" ")!==-1)throw new Error("External entites are not supported");const s=e[t++];let i="";for(;t<e.length&&e[t]!==s;t++)i+=e[t];return[n,i,t]}function _e(e,t){return e[t+1]==="!"&&e[t+2]==="-"&&e[t+3]==="-"}function ke(e,t){return e[t+1]==="!"&&e[t+2]==="E"&&e[t+3]==="N"&&e[t+4]==="T"&&e[t+5]==="I"&&e[t+6]==="T"&&e[t+7]==="Y"}function Me(e,t){return e[t+1]==="!"&&e[t+2]==="E"&&e[t+3]==="L"&&e[t+4]==="E"&&e[t+5]==="M"&&e[t+6]==="E"&&e[t+7]==="N"&&e[t+8]==="T"}function Xe(e,t){return e[t+1]==="!"&&e[t+2]==="A"&&e[t+3]==="T"&&e[t+4]==="T"&&e[t+5]==="L"&&e[t+6]==="I"&&e[t+7]==="S"&&e[t+8]==="T"}function Be(e,t){return e[t+1]==="!"&&e[t+2]==="N"&&e[t+3]==="O"&&e[t+4]==="T"&&e[t+5]==="A"&&e[t+6]==="T"&&e[t+7]==="I"&&e[t+8]==="O"&&e[t+9]==="N"}function Ge(e){if(Le.isName(e))return e;throw new Error(`Invalid entity name ${e}`)}var Ke=Se;const Ue=/^[-+]?0x[a-fA-F0-9]+$/,Ze=/^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt),!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat);const je={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function We(e,t={}){if(t=Object.assign({},je,t),!e||typeof e!="string")return e;let n=e.trim();if(t.skipLike!==void 0&&t.skipLike.test(n))return e;if(t.hex&&Ue.test(n))return Number.parseInt(n,16);{const s=Ze.exec(n);if(s){const i=s[1],r=s[2];let a=qe(s[3]);const l=s[4]||s[6];if(!t.leadingZeros&&r.length>0&&i&&n[2]!==".")return e;if(!t.leadingZeros&&r.length>0&&!i&&n[1]!==".")return e;{const o=Number(n),f=""+o;return f.search(/[eE]/)!==-1||l?t.eNotation?o:e:n.indexOf(".")!==-1?f==="0"&&a===""||f===a||i&&f==="-"+a?o:e:r?a===f||i+a===f?o:e:n===f||n===i+f?o:e}}else return e}}function qe(e){return e&&e.indexOf(".")!==-1&&(e=e.replace(/0+$/,""),e==="."?e="0":e[0]==="."?e="0"+e:e[e.length-1]==="."&&(e=e.substr(0,e.length-1))),e}var ze=We;function Ye(e){return typeof e=="function"?e:Array.isArray(e)?t=>{for(const n of e)if(typeof n=="string"&&t===n||n instanceof RegExp&&n.test(t))return!0}:()=>!1}var Q=Ye;const H=$,O=Ve,Je=Ke,Qe=ze,He=Q;let Re=class{constructor(t){this.options=t,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(n,s)=>String.fromCharCode(Number.parseInt(s,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(n,s)=>String.fromCharCode(Number.parseInt(s,16))}},this.addExternalEntities=De,this.parseXml=rt,this.parseTextData=et,this.resolveNameSpace=tt,this.buildAttributesMap=st,this.isItStopNode=at,this.replaceEntitiesValue=ot,this.readStopNodeData=ft,this.saveTextToParentTag=lt,this.addChild=it,this.ignoreAttributesFn=He(this.options.ignoreAttributes)}};function De(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const s=t[n];this.lastEntities[s]={regex:new RegExp("&"+s+";","g"),val:e[s]}}}function et(e,t,n,s,i,r,a){if(e!==void 0&&(this.options.trimValues&&!s&&(e=e.trim()),e.length>0)){a||(e=this.replaceEntitiesValue(e));const l=this.options.tagValueProcessor(t,e,n,i,r);return l==null?e:typeof l!=typeof e||l!==e?l:this.options.trimValues?M(e,this.options.parseTagValue,this.options.numberParseOptions):e.trim()===e?M(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function tt(e){if(this.options.removeNSPrefix){const t=e.split(":"),n=e.charAt(0)==="/"?"/":"";if(t[0]==="xmlns")return"";t.length===2&&(e=n+t[1])}return e}const nt=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function st(e,t,n){if(this.options.ignoreAttributes!==!0&&typeof e=="string"){const s=H.getAllMatches(e,nt),i=s.length,r={};for(let a=0;a<i;a++){const l=this.resolveNameSpace(s[a][1]);if(this.ignoreAttributesFn(l,t))continue;let o=s[a][4],f=this.options.attributeNamePrefix+l;if(l.length)if(this.options.transformAttributeName&&(f=this.options.transformAttributeName(f)),f==="__proto__"&&(f="#__proto__"),o!==void 0){this.options.trimValues&&(o=o.trim()),o=this.replaceEntitiesValue(o);const u=this.options.attributeValueProcessor(l,o,t);u==null?r[f]=o:typeof u!=typeof o||u!==o?r[f]=u:r[f]=M(o,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(r[f]=!0)}if(!Object.keys(r).length)return;if(this.options.attributesGroupName){const a={};return a[this.options.attributesGroupName]=r,a}return r}}const rt=function(e){e=e.replace(/\r\n?/g,`
`);const t=new O("!xml");let n=t,s="",i="";for(let r=0;r<e.length;r++)if(e[r]==="<")if(e[r+1]==="/"){const l=w(e,">",r,"Closing Tag is not closed.");let o=e.substring(r+2,l).trim();if(this.options.removeNSPrefix){const c=o.indexOf(":");c!==-1&&(o=o.substr(c+1))}this.options.transformTagName&&(o=this.options.transformTagName(o)),n&&(s=this.saveTextToParentTag(s,n,i));const f=i.substring(i.lastIndexOf(".")+1);if(o&&this.options.unpairedTags.indexOf(o)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${o}>`);let u=0;f&&this.options.unpairedTags.indexOf(f)!==-1?(u=i.lastIndexOf(".",i.lastIndexOf(".")-1),this.tagsNodeStack.pop()):u=i.lastIndexOf("."),i=i.substring(0,u),n=this.tagsNodeStack.pop(),s="",r=l}else if(e[r+1]==="?"){let l=k(e,r,!1,"?>");if(!l)throw new Error("Pi Tag is not closed.");if(s=this.saveTextToParentTag(s,n,i),!(this.options.ignoreDeclaration&&l.tagName==="?xml"||this.options.ignorePiTags)){const o=new O(l.tagName);o.add(this.options.textNodeName,""),l.tagName!==l.tagExp&&l.attrExpPresent&&(o[":@"]=this.buildAttributesMap(l.tagExp,i,l.tagName)),this.addChild(n,o,i)}r=l.closeIndex+1}else if(e.substr(r+1,3)==="!--"){const l=w(e,"-->",r+4,"Comment is not closed.");if(this.options.commentPropName){const o=e.substring(r+4,l-2);s=this.saveTextToParentTag(s,n,i),n.add(this.options.commentPropName,[{[this.options.textNodeName]:o}])}r=l}else if(e.substr(r+1,2)==="!D"){const l=Je(e,r);this.docTypeEntities=l.entities,r=l.i}else if(e.substr(r+1,2)==="!["){const l=w(e,"]]>",r,"CDATA is not closed.")-2,o=e.substring(r+9,l);s=this.saveTextToParentTag(s,n,i);let f=this.parseTextData(o,n.tagname,i,!0,!1,!0,!0);f==null&&(f=""),this.options.cdataPropName?n.add(this.options.cdataPropName,[{[this.options.textNodeName]:o}]):n.add(this.options.textNodeName,f),r=l+2}else{let l=k(e,r,this.options.removeNSPrefix),o=l.tagName;const f=l.rawTagName;let u=l.tagExp,c=l.attrExpPresent,h=l.closeIndex;this.options.transformTagName&&(o=this.options.transformTagName(o)),n&&s&&n.tagname!=="!xml"&&(s=this.saveTextToParentTag(s,n,i,!1));const N=n;if(N&&this.options.unpairedTags.indexOf(N.tagname)!==-1&&(n=this.tagsNodeStack.pop(),i=i.substring(0,i.lastIndexOf("."))),o!==t.tagname&&(i+=i?"."+o:o),this.isItStopNode(this.options.stopNodes,i,o)){let p="";if(u.length>0&&u.lastIndexOf("/")===u.length-1)o[o.length-1]==="/"?(o=o.substr(0,o.length-1),i=i.substr(0,i.length-1),u=o):u=u.substr(0,u.length-1),r=l.closeIndex;else if(this.options.unpairedTags.indexOf(o)!==-1)r=l.closeIndex;else{const E=this.readStopNodeData(e,f,h+1);if(!E)throw new Error(`Unexpected end of ${f}`);r=E.i,p=E.tagContent}const y=new O(o);o!==u&&c&&(y[":@"]=this.buildAttributesMap(u,i,o)),p&&(p=this.parseTextData(p,o,i,!0,c,!0,!0)),i=i.substr(0,i.lastIndexOf(".")),y.add(this.options.textNodeName,p),this.addChild(n,y,i)}else{if(u.length>0&&u.lastIndexOf("/")===u.length-1){o[o.length-1]==="/"?(o=o.substr(0,o.length-1),i=i.substr(0,i.length-1),u=o):u=u.substr(0,u.length-1),this.options.transformTagName&&(o=this.options.transformTagName(o));const p=new O(o);o!==u&&c&&(p[":@"]=this.buildAttributesMap(u,i,o)),this.addChild(n,p,i),i=i.substr(0,i.lastIndexOf("."))}else{const p=new O(o);this.tagsNodeStack.push(n),o!==u&&c&&(p[":@"]=this.buildAttributesMap(u,i,o)),this.addChild(n,p,i),n=p}s="",r=h}}else s+=e[r];return t.child};function it(e,t,n){const s=this.options.updateTag(t.tagname,n,t[":@"]);s===!1||(typeof s=="string"&&(t.tagname=s),e.addChild(t))}const ot=function(e){if(this.options.processEntities){for(let t in this.docTypeEntities){const n=this.docTypeEntities[t];e=e.replace(n.regx,n.val)}for(let t in this.lastEntities){const n=this.lastEntities[t];e=e.replace(n.regex,n.val)}if(this.options.htmlEntities)for(let t in this.htmlEntities){const n=this.htmlEntities[t];e=e.replace(n.regex,n.val)}e=e.replace(this.ampEntity.regex,this.ampEntity.val)}return e};function lt(e,t,n,s){return e&&(s===void 0&&(s=Object.keys(t.child).length===0),e=this.parseTextData(e,t.tagname,n,!1,t[":@"]?Object.keys(t[":@"]).length!==0:!1,s),e!==void 0&&e!==""&&t.add(this.options.textNodeName,e),e=""),e}function at(e,t,n){const s="*."+n;for(const i in e){const r=e[i];if(s===r||t===r)return!0}return!1}function ut(e,t,n=">"){let s,i="";for(let r=t;r<e.length;r++){let a=e[r];if(s)a===s&&(s="");else if(a==='"'||a==="'")s=a;else if(a===n[0])if(n[1]){if(e[r+1]===n[1])return{data:i,index:r}}else return{data:i,index:r};else a===" "&&(a=" ");i+=a}}function w(e,t,n,s){const i=e.indexOf(t,n);if(i===-1)throw new Error(s);return i+t.length-1}function k(e,t,n,s=">"){const i=ut(e,t+1,s);if(!i)return;let r=i.data;const a=i.index,l=r.search(/\s/);let o=r,f=!0;l!==-1&&(o=r.substring(0,l),r=r.substring(l+1).trimStart());const u=o;if(n){const c=o.indexOf(":");c!==-1&&(o=o.substr(c+1),f=o!==i.data.substr(c+1))}return{tagName:o,tagExp:r,closeIndex:a,attrExpPresent:f,rawTagName:u}}function ft(e,t,n){const s=n;let i=1;for(;n<e.length;n++)if(e[n]==="<")if(e[n+1]==="/"){const r=w(e,">",n,`${t} is not closed`);if(e.substring(n+2,r).trim()===t&&(i--,i===0))return{tagContent:e.substring(s,n),i:r};n=r}else if(e[n+1]==="?")n=w(e,"?>",n+1,"StopNode is not closed.");else if(e.substr(n+1,3)==="!--")n=w(e,"-->",n+3,"StopNode is not closed.");else if(e.substr(n+1,2)==="![")n=w(e,"]]>",n,"StopNode is not closed.")-2;else{const r=k(e,n,">");r&&((r&&r.tagName)===t&&r.tagExp[r.tagExp.length-1]!=="/"&&i++,n=r.closeIndex)}}function M(e,t,n){if(t&&typeof e=="string"){const s=e.trim();return s==="true"?!0:s==="false"?!1:Qe(e,n)}else return H.isExist(e)?e:""}var ct=Re,R={};function dt(e,t){return D(e,t)}function D(e,t,n){let s;const i={};for(let r=0;r<e.length;r++){const a=e[r],l=ht(a);let o="";if(n===void 0?o=l:o=n+"."+l,l===t.textNodeName)s===void 0?s=a[l]:s+=""+a[l];else{if(l===void 0)continue;if(a[l]){let f=D(a[l],t,o);const u=gt(f,t);a[":@"]?pt(f,a[":@"],o,t):Object.keys(f).length===1&&f[t.textNodeName]!==void 0&&!t.alwaysCreateTextNode?f=f[t.textNodeName]:Object.keys(f).length===0&&(t.alwaysCreateTextNode?f[t.textNodeName]="":f=""),i[l]!==void 0&&i.hasOwnProperty(l)?(Array.isArray(i[l])||(i[l]=[i[l]]),i[l].push(f)):t.isArray(l,o,u)?i[l]=[f]:i[l]=f}}}return typeof s=="string"?s.length>0&&(i[t.textNodeName]=s):s!==void 0&&(i[t.textNodeName]=s),i}function ht(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const s=t[n];if(s!==":@")return s}}function pt(e,t,n,s){if(t){const i=Object.keys(t),r=i.length;for(let a=0;a<r;a++){const l=i[a];s.isArray(l,n+"."+l,!0,!0)?e[l]=[t[l]]:e[l]=t[l]}}}function gt(e,t){const{textNodeName:n}=t,s=Object.keys(e).length;return!!(s===0||s===1&&(e[n]||typeof e[n]=="boolean"||e[n]===0))}R.prettify=dt;const{buildOptions:Nt}=_,bt=ct,{prettify:Tt}=R,yt=S;var Et=class{constructor(t){this.externalEntities={},this.options=Nt(t)}parse(t,n){if(typeof t!="string")if(t.toString)t=t.toString();else throw new Error("XML data is accepted in String or Bytes[] form.");if(n){n===!0&&(n={});const r=yt.validate(t,n);if(r!==!0)throw Error(`${r.err.msg}:${r.err.line}:${r.err.col}`)}const s=new bt(this.options);s.addExternalEntities(this.externalEntities);const i=s.parseXml(t);return this.options.preserveOrder||i===void 0?i:Tt(i,this.options)}addEntity(t,n){if(n.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(t.indexOf("&")!==-1||t.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");if(n==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=n}};const mt=`
`;function Ct(e,t){let n="";return t.format&&t.indentBy.length>0&&(n=mt),ee(e,t,"",n)}function ee(e,t,n,s){let i="",r=!1;for(let a=0;a<e.length;a++){const l=e[a],o=At(l);if(o===void 0)continue;let f="";if(n.length===0?f=o:f=`${n}.${o}`,o===t.textNodeName){let p=l[o];wt(f,t)||(p=t.tagValueProcessor(o,p),p=ne(p,t)),r&&(i+=s),i+=p,r=!1;continue}else if(o===t.cdataPropName){r&&(i+=s),i+=`<![CDATA[${l[o][0][t.textNodeName]}]]>`,r=!1;continue}else if(o===t.commentPropName){i+=s+`<!--${l[o][0][t.textNodeName]}-->`,r=!0;continue}else if(o[0]==="?"){const p=te(l[":@"],t),y=o==="?xml"?"":s;let E=l[o][0][t.textNodeName];E=E.length!==0?" "+E:"",i+=y+`<${o}${E}${p}?>`,r=!0;continue}let u=s;u!==""&&(u+=t.indentBy);const c=te(l[":@"],t),h=s+`<${o}${c}`,N=ee(l[o],t,f,u);t.unpairedTags.indexOf(o)!==-1?t.suppressUnpairedNode?i+=h+">":i+=h+"/>":(!N||N.length===0)&&t.suppressEmptyNode?i+=h+"/>":N&&N.endsWith(">")?i+=h+`>${N}${s}</${o}>`:(i+=h+">",N&&s!==""&&(N.includes("/>")||N.includes("</"))?i+=s+t.indentBy+N+s:i+=N,i+=`</${o}>`),r=!0}return i}function At(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const s=t[n];if(e.hasOwnProperty(s)&&s!==":@")return s}}function te(e,t){let n="";if(e&&!t.ignoreAttributes)for(let s in e){if(!e.hasOwnProperty(s))continue;let i=t.attributeValueProcessor(s,e[s]);i=ne(i,t),i===!0&&t.suppressBooleanAttributes?n+=` ${s.substr(t.attributeNamePrefix.length)}`:n+=` ${s.substr(t.attributeNamePrefix.length)}="${i}"`}return n}function wt(e,t){e=e.substr(0,e.length-t.textNodeName.length-1);let n=e.substr(e.lastIndexOf(".")+1);for(let s in t.stopNodes)if(t.stopNodes[s]===e||t.stopNodes[s]==="*."+n)return!0;return!1}function ne(e,t){if(e&&e.length>0&&t.processEntities)for(let n=0;n<t.entities.length;n++){const s=t.entities[n];e=e.replace(s.regex,s.val)}return e}var vt=Ct;const Ot=vt,Pt=Q,It={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&"},{regex:new RegExp(">","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1};function C(e){this.options=Object.assign({},It,e),this.options.ignoreAttributes===!0||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=Pt(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=Vt),this.processTextOrObjNode=$t,this.options.format?(this.indentate=xt,this.tagEndChar=`>
`,this.newLine=`
`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}C.prototype.build=function(e){return this.options.preserveOrder?Ot(e,this.options):(Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e}),this.j2x(e,0,[]).val)},C.prototype.j2x=function(e,t,n){let s="",i="";const r=n.join(".");for(let a in e)if(Object.prototype.hasOwnProperty.call(e,a))if(typeof e[a]>"u")this.isAttribute(a)&&(i+="");else if(e[a]===null)this.isAttribute(a)?i+="":a[0]==="?"?i+=this.indentate(t)+"<"+a+"?"+this.tagEndChar:i+=this.indentate(t)+"<"+a+"/"+this.tagEndChar;else if(e[a]instanceof Date)i+=this.buildTextValNode(e[a],a,"",t);else if(typeof e[a]!="object"){const l=this.isAttribute(a);if(l&&!this.ignoreAttributesFn(l,r))s+=this.buildAttrPairStr(l,""+e[a]);else if(!l)if(a===this.options.textNodeName){let o=this.options.tagValueProcessor(a,""+e[a]);i+=this.replaceEntitiesValue(o)}else i+=this.buildTextValNode(e[a],a,"",t)}else if(Array.isArray(e[a])){const l=e[a].length;let o="",f="";for(let u=0;u<l;u++){const c=e[a][u];if(!(typeof c>"u"))if(c===null)a[0]==="?"?i+=this.indentate(t)+"<"+a+"?"+this.tagEndChar:i+=this.indentate(t)+"<"+a+"/"+this.tagEndChar;else if(typeof c=="object")if(this.options.oneListGroup){const h=this.j2x(c,t+1,n.concat(a));o+=h.val,this.options.attributesGroupName&&c.hasOwnProperty(this.options.attributesGroupName)&&(f+=h.attrStr)}else o+=this.processTextOrObjNode(c,a,t,n);else if(this.options.oneListGroup){let h=this.options.tagValueProcessor(a,c);h=this.replaceEntitiesValue(h),o+=h}else o+=this.buildTextValNode(c,a,"",t)}this.options.oneListGroup&&(o=this.buildObjectNode(o,a,f,t)),i+=o}else if(this.options.attributesGroupName&&a===this.options.attributesGroupName){const l=Object.keys(e[a]),o=l.length;for(let f=0;f<o;f++)s+=this.buildAttrPairStr(l[f],""+e[a][l[f]])}else i+=this.processTextOrObjNode(e[a],a,t,n);return{attrStr:s,val:i}},C.prototype.buildAttrPairStr=function(e,t){return t=this.options.attributeValueProcessor(e,""+t),t=this.replaceEntitiesValue(t),this.options.suppressBooleanAttributes&&t==="true"?" "+e:" "+e+'="'+t+'"'};function $t(e,t,n,s){const i=this.j2x(e,n+1,s.concat(t));return e[this.options.textNodeName]!==void 0&&Object.keys(e).length===1?this.buildTextValNode(e[this.options.textNodeName],t,i.attrStr,n):this.buildObjectNode(i.val,t,i.attrStr,n)}C.prototype.buildObjectNode=function(e,t,n,s){if(e==="")return t[0]==="?"?this.indentate(s)+"<"+t+n+"?"+this.tagEndChar:this.indentate(s)+"<"+t+n+this.closeTag(t)+this.tagEndChar;{let i="</"+t+this.tagEndChar,r="";return t[0]==="?"&&(r="?",i=""),(n||n==="")&&e.indexOf("<")===-1?this.indentate(s)+"<"+t+n+r+">"+e+i:this.options.commentPropName!==!1&&t===this.options.commentPropName&&r.length===0?this.indentate(s)+`<!--${e}-->`+this.newLine:this.indentate(s)+"<"+t+n+r+this.tagEndChar+e+this.indentate(s)+i}},C.prototype.closeTag=function(e){let t="";return this.options.unpairedTags.indexOf(e)!==-1?this.options.suppressUnpairedNode||(t="/"):this.options.suppressEmptyNode?t="/":t=`></${e}`,t},C.prototype.buildTextValNode=function(e,t,n,s){if(this.options.cdataPropName!==!1&&t===this.options.cdataPropName)return this.indentate(s)+`<![CDATA[${e}]]>`+this.newLine;if(this.options.commentPropName!==!1&&t===this.options.commentPropName)return this.indentate(s)+`<!--${e}-->`+this.newLine;if(t[0]==="?")return this.indentate(s)+"<"+t+n+"?"+this.tagEndChar;{let i=this.options.tagValueProcessor(t,e);return i=this.replaceEntitiesValue(i),i===""?this.indentate(s)+"<"+t+n+this.closeTag(t)+this.tagEndChar:this.indentate(s)+"<"+t+n+">"+i+"</"+t+this.tagEndChar}},C.prototype.replaceEntitiesValue=function(e){if(e&&e.length>0&&this.options.processEntities)for(let t=0;t<this.options.entities.length;t++){const n=this.options.entities[t];e=e.replace(n.regex,n.val)}return e};function xt(e){return this.options.indentBy.repeat(e)}function Vt(e){return e.startsWith(this.options.attributeNamePrefix)&&e!==this.options.textNodeName?e.substr(this.attrPrefixLen):!1}var Lt=C,se={XMLParser:Et,XMLValidator:S,XMLBuilder:Lt};const St=new se.XMLParser({preserveOrder:!0,ignoreAttributes:!1,attributeNamePrefix:"",allowBooleanAttributes:!0,commentPropName:V,cdataPropName:L,parseTagValue:!1});function Ft(e){return g.useMemo(()=>{try{if(!se.XMLValidator.validate(e))throw new Error("Invalid XML!");const t=St.parse(e);if(typeof e=="string"&&e.trim().length>0&&t.length===0)throw new Error("Invalid XML!");return{json:t,valid:!0}}catch(t){return{json:null,valid:!1,errorMessage:`Fail to parse: ${t.message}`}}},[e])}function A(e,t=!0){const{push:n}=U(),s=g.useRef(null);return g.useEffect(()=>{t&&s.current&&e&&n(e,{element:s.current})},[s.current,n,e,t]),s}function _t(e){const{indentation:t,children:n,isInline:s,keyValue:i}=e,{theme:r}=m(),a=A(i),l=A(`${i}-close`,!s);return d.jsxs("div",{style:{color:r.cdataColor},children:[d.jsx("span",{ref:a,children:`${t}<![CDATA[`}),n,d.jsx("span",{ref:l,children:`${s?"":t}]]>`})]})}const kt=e=>X.createElement("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",...e},X.createElement("path",{d:"M9 17.898C9 18.972 10.2649 19.546 11.0731 18.8388L17.3838 13.3169C18.1806 12.6197 18.1806 11.3801 17.3838 10.6829L11.0731 5.16108C10.2649 4.45388 9 5.02785 9 6.1018V17.898Z"}));function re(e){const{collapsible:t,theme:n}=m(),{collapsed:s}=e;return t?d.jsx("span",{style:{position:"relative"},children:d.jsx("span",{style:{position:"absolute",right:"0",border:0,padding:0,background:"none"},children:d.jsx(kt,{fill:n.separatorColor,style:{transform:`rotate(${s?0:90}deg)`,transition:"transform 0.2s"}})})}):null}function ie(e){const{collapsible:t,initialCollapsedDepth:n}=m(),s=n!=null,[i,r]=g.useState(()=>!s||!t?!1:e>=n),a=()=>r(l=>!l);return g.useEffect(()=>{r(!s||!t?!1:e>=n)},[n,e,t]),{collapsed:i,buttonProps:t?{onClick:a,role:"button",style:{cursor:"pointer"}}:{}}}function Mt(e){const{indentation:t,children:n,isInline:s,level:i,keyValue:r}=e,{theme:a}=m(),{collapsed:l,buttonProps:o}=ie(i),f=A(r),u=A(`${r}-close`,!s),c=l?"none":void 0;return d.jsxs("div",{style:{color:a.commentColor},children:[d.jsxs("span",{...o,children:[d.jsx("span",{children:t}),d.jsx(re,{collapsed:l}),d.jsx("span",{ref:f,children:"<!-- "})]}),d.jsx("span",{style:{display:c},children:n}),l&&"...",d.jsx("span",{style:{display:c},ref:u,children:`${s||l?" ":t}-->`})]})}function oe(e){const{attributes:t}=e,{theme:n}=m();return t?d.jsx("span",{children:Object.entries(t).map(([s,i])=>d.jsxs("span",{children:[d.jsx("span",{style:{color:n.attributeKeyColor},children:` ${s}`}),d.jsx("span",{style:{color:n.separatorColor},children:"="}),d.jsx("span",{style:{color:n.attributeValueColor},children:`"${i}"`})]},`attribute-${s}`))}):null}function Xt(e){const{indentation:t,tagKey:n,attributes:s,keyValue:i}=e,{theme:r}=m(),a=A(i);return d.jsxs("div",{ref:a,children:[d.jsx("span",{style:{color:r.separatorColor},children:`${t}<?`}),d.jsx("span",{style:{color:r.tagColor},children:`${n.slice(1)}`}),d.jsx(oe,{attributes:s}),d.jsx("span",{style:{color:r.separatorColor},children:"?>"})]})}function Bt(e){const{indentation:t,tagKey:n,attributes:s,children:i,isInline:r,hasChildren:a,level:l,keyValue:o}=e,{collapsed:f,buttonProps:u}=ie(l),{theme:c}=m(),h=A(o),N=A(`${o}-close`,!r),p=f?"none":void 0;return d.jsxs("div",{ref:h,children:[d.jsxs("span",{...u,children:[d.jsx("span",{children:t}),d.jsx(re,{collapsed:f}),d.jsx("span",{style:{color:c.separatorColor},children:"<"}),d.jsx("span",{style:{color:c.tagColor},children:`${n}`}),!f&&d.jsx(oe,{attributes:s}),!f&&d.jsx("span",{style:{color:c.separatorColor},children:a?">":" />"})]}),a&&d.jsxs(d.Fragment,{children:[d.jsx("span",{style:{display:p},children:i}),f&&d.jsx("span",{style:{color:"#777"},children:"..."}),d.jsx("span",{style:{color:c.separatorColor,display:p},children:`${r||f?"":t}</`}),d.jsx("span",{style:{color:c.tagColor,display:p},children:`${n}`}),d.jsx("span",{style:{color:c.separatorColor,display:p},ref:N,children:">"})]})]})}function Gt(e){const{children:t,keyValue:n}=e,s=A(n);return d.jsx("div",{ref:s,children:t})}function Kt(e){const{hasSiblings:t,text:n,indentation:s,isText:i,keyValue:r}=e,{theme:a}=m(),l=i?{color:a.textColor}:void 0;return j(n)||t?d.jsx("div",{style:l,children:n.split(`
`).filter(o=>!!o.trim()).map((o,f)=>d.jsx(Gt,{keyValue:`${r}${f}`,children:`${s}${o.trim()}`},`${r}${f}`))}):d.jsx("span",{style:l,children:n})}function x(e){const{elements:t,level:n=0,isText:s=!0,parentKey:i=""}=e,{indentSize:r}=m();return!Array.isArray(t)||t.length===0?null:d.jsx(d.Fragment,{children:t.map((a,l)=>{const{tagKey:o,attributes:f,subElements:u,type:c}=Te(a),h=t.length>1,N=pe(r,n),p=`${i}-${n+1}-${l+1}`,y=ge(u);switch(c){case P:return d.jsx(Kt,{text:u,indentation:N,hasSiblings:h,isText:s,keyValue:p},p);case V:return d.jsx(Mt,{keyValue:p,isInline:y,indentation:N,level:n,children:d.jsx(x,{elements:u,level:n+1,parentKey:p,isText:!1})},p);case L:return d.jsx(_t,{keyValue:p,indentation:N,isInline:y,children:d.jsx(x,{elements:u,level:n+1,parentKey:p,isText:!1})},p);case G:return d.jsx(Xt,{indentation:N,tagKey:o,attributes:f,keyValue:p},p);default:return d.jsx(Bt,{indentation:N,tagKey:o,attributes:f,isInline:y,hasChildren:u.length>0,level:n,keyValue:p,children:d.jsx(x,{elements:u,level:n+1,parentKey:p})},p)}})})}function Ut(){return d.jsx("div",{children:"Invalid XML!"})}function le(e){return e?e.checkVisibility?e.checkVisibility():!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length):!1}function ae(e){return!e||!e.parentElement?0:le(e.parentElement)?e.parentElement.offsetTop:ae(e.parentElement)}function Zt({viewerContainer:e}){const{lines:t}=U(),{theme:n}=m(),[s,i]=g.useState({width:0,height:0}),r=g.useRef(null),{sortedLines:a,numberOfLines:l}=g.useMemo(()=>{const f=Object.values(t).map(u=>{var h;const c=le(u.element);return{...u,offset:c?(h=u.element)==null?void 0:h.offsetTop:ae(u.element),visible:c}}).sort((u,c)=>u.offset===c.offset?u.visible===c.visible?0:u.visible?-1:1:u.offset-c.offset).map((u,c)=>({...u,lineNumber:c+1}));return{sortedLines:f.filter(u=>u.visible),numberOfLines:f.length+1}},[t,s.width,s.height]),o=g.useMemo(()=>new ResizeObserver(function(f){const{width:u,height:c}=f[0].contentRect;i({width:u,height:c})}),[]);return g.useEffect(()=>{e&&o.observe(e)},[e,o]),g.useEffect(()=>()=>{o.disconnect()},[]),d.jsx("div",{ref:r,style:{width:16+8*String(l).length,height:"auto",backgroundColor:n.lineNumberBackground,color:n.lineNumberColor,marginRight:16,paddingTop:8,position:"relative"},children:a.map(f=>{var u;return d.jsx("div",{style:{position:"absolute",top:f.offset-(((u=r.current)==null?void 0:u.offsetTop)??0),right:8},children:f.lineNumber},f.lineNumber)})})}function jt(e){const{theme:t,xml:n,collapsible:s=!1,indentSize:i=2,invalidXml:r,initialCollapsedDepth:a,showLineNumbers:l=!1}=e,[o,f]=g.useState(()=>({...I,...t})),{json:u,valid:c}=Ft(n),[h,N]=g.useState(null),p=g.useMemo(()=>({theme:o,collapsible:s,indentSize:i,initialCollapsedDepth:a}),[o,s,i,a]);return g.useEffect(()=>{f(y=>{const E={...I,...t};return ye(E,y)?y:E})},[t]),c?d.jsx(Z.Provider,{value:p,children:d.jsx(de,{children:d.jsxs("div",{className:"rxv-container",style:{fontFamily:o.fontFamily,display:"flex",flexDirection:"row"},children:[l&&d.jsx(Zt,{viewerContainer:h}),d.jsx("div",{ref:N,style:{flex:1,whiteSpace:"pre-wrap",overflowWrap:"break-word",overflow:"auto",paddingTop:4,paddingBottom:4,paddingLeft:s?10:0},children:d.jsx(x,{elements:u})})]})},n)}):r||d.jsx(Ut,{})}return jt});
//# sourceMappingURL=index.umd.js.map