PageSourceSearch

https://my.heron.gr/assets/html-parse-stringify-B32paJyZ.js

js heron.gr collected 2026-10-01 10:43:00 UTC 2,094 bytes, 1 lines download raw bytes

vendor: 2,094 bytes, line 1
1import{e as E}from"./void-elements-DD5y4_3Z.js";var O=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function v(e){var t={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},n=e.match(/<\/?([^\s]+?)[/\s>]/);if(n&&(t.name=n[1],(E[n[1]]||e.charAt(e.length-2)==="/")&&(t.voidElement=!0),t.name.startsWith("!--"))){var i=e.indexOf("-->");return{type:"comment",comment:i!==-1?e.slice(4,i):""}}for(var s=new RegExp(O),r=null;(r=s.exec(e))!==null;)if(r[0].trim())if(r[1]){var a=r[1].trim(),o=[a,""];a.indexOf("=")>-1&&(o=a.split("=")),t.attrs[o[0]]=o[1],s.lastIndex--}else r[2]&&(t.attrs[r[2]]=r[3].trim().substring(1,r[3].length-1));return t}var A=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,b=/^\s*$/,j=Object.create(null);function x(e,t){switch(t.type){case"text":return e+t.content;case"tag":return e+="<"+t.name+(t.attrs?(function(n){var i=[];for(var s in n)i.push(s+'="'+n[s]+'"');return i.length?" "+i.join(" "):""})(t.attrs):"")+(t.voidElement?"/>":">"),t.voidElement?e:e+t.children.reduce(x,"")+"</"+t.name+">";case"comment":return e+"<!--"+t.comment+"-->"}}var W={parse:function(e,t){t||(t={}),t.components||(t.components=j);var n,i=[],s=[],r=-1,a=!1;if(e.indexOf("<")!==0){var o=e.indexOf("<");i.push({type:"text",content:o===-1?e:e.substring(0,o)})}return e.replace(A,function(c,g){if(a){if(c!=="</"+n.name+">")return;a=!1}var u,p=c.charAt(1)!=="/",y=c.startsWith("<!--"),l=g+c.length,m=e.charAt(l);if(y){var d=v(c);return r<0?(i.push(d),i):((u=s[r]).children.push(d),i)}if(p&&(r++,(n=v(c)).type==="tag"&&t.components[n.name]&&(n.type="component",a=!0),n.voidElement||a||!m||m==="<"||n.children.push({type:"text",content:e.slice(l,e.indexOf("<",l))}),r===0&&i.push(n),(u=s[r-1])&&u.children.push(n),s[r]=n),(!p||n.voidElement)&&(r>-1&&(n.voidElement||n.name===c.slice(2,-1))&&(r--,n=r===-1?i:s[r]),!a&&m!=="<"&&m)){u=r===-1?i:s[r].children;var h=e.indexOf("<",l),f=e.slice(l,h===-1?void 0:h);b.test(f)&&(f=" "),(h>-1&&r+u.length>=0||f!==" ")&&u.push({type:"text",content:f})}}),i},stringify:function(e){return e.reduce(function(t,n){return t+x("",n)},"")}};export{W as c};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.