"use strict";function makeMap(e,t){const n=Object.create(null),a=e.split(",");for(let e=0;e<a.length;e++)n[a[e]]=!0;return t?e=>n[e.toLowerCase()]:e=>n[e]}function decodeAttr(e,t){const n=t?encodedAttrWithNewLines:encodedAttr;return e.replace(n,e=>decodingMap[e])}function parseHTML(e,t){function n(t){d+=t,e=e.substring(t)}function a(e,n,a){let o,s;if(null==n&&(n=d),null==a&&(a=d),e&&(s=e.toLowerCase()),e)for(o=r.length-1;o>=0&&r[o].lowerCasedTag!==s;o--);else o=0;if(o>=0){for(let s=r.length-1;s>=o;s--)"production"!==process.env.NODE_ENV&&(s>o||!e)&&t.warn&&t.warn(`tag <${r[s].tag}> has no matching end tag.`),t.end&&t.end(r[s].tag,n,a);r.length=o,l=o&&r[o-1].tag}else"br"===s?t.start&&t.start(e,[],!0,n,a):"p"===s&&(t.start&&t.start(e,[],!1,n,a),t.end&&t.end(e,n,a))}const r=[],o=t.expectHTML,s=t.isUnaryTag||no,c=t.canBeLeftOpenTag||no;let i,l,d=0;for(;e;){if(i=e,l&&isPlainTextElement(l)){let n=0;const r=l.toLowerCase(),o=reCache[r]||(reCache[r]=new RegExp("([\\s\\S]*?)(</"+r+"[^>]*>)","i")),s=e.replace(o,(e,a,o)=>(n=o.length,isPlainTextElement(r)||"noscript"===r||(a=a.replace(/<!--([\s\S]*?)-->/g,"$1").replace(/<!\[CDATA\[([\s\S]*?)]]>/g,"$1")),shouldIgnoreFirstNewline(r,a)&&(a=a.slice(1)),t.chars&&t.chars(a),""));d+=e.length-s.length,e=s,a(r,d-n,d)}else{let i=e.indexOf("<");if(0===i){if(comment.test(e)){const a=e.indexOf("--\x3e");if(a>=0){t.shouldKeepComment&&t.comment(e.substring(4,a)),n(a+3);continue}}if(conditionalComment.test(e)){const t=e.indexOf("]>");if(t>=0){n(t+2);continue}}const i=e.match(doctype);if(i){n(i[0].length);continue}const g=e.match(endTag);if(g){const e=d;n(g[0].length),a(g[1],e,d);continue}const h=function(){const t=e.match(startTagOpen);if(t){const a={tagName:t[1],attrs:[],start:d};n(t[0].length);let r,o;for(;!(r=e.match(startTagClose))&&(o=e.match(attribute));)n(o[0].length),a.attrs.push(o);if(r)return a.unarySlash=r[1],n(r[0].length),a.end=d,a}}();if(h){!function(e){const n=e.tagName,i=e.unarySlash;o&&("p"===l&&isNonPhrasingTag(n)&&a(l),c(n)&&l===n&&a(n));const d=s(n)||!!i,g=e.attrs.length,h=new Array(g);for(let a=0;a<g;a++){const r=e.attrs[a];IS_REGEX_CAPTURING_BROKEN&&-1===r[0].indexOf('""')&&(""===r[3]&&delete r[3],""===r[4]&&delete r[4],""===r[5]&&delete r[5]);const o=r[3]||r[4]||r[5]||"",s="a"===n&&"href"===r[1]?t.shouldDecodeNewlinesForHref:t.shouldDecodeNewlines;h[a]={name:r[1],value:decodeAttr(o,s)}}d||(r.push({tag:n,lowerCasedTag:n.toLowerCase(),attrs:h}),l=n),t.start&&t.start(n,h,d,e.start,e.end)}(h),shouldIgnoreFirstNewline(l,e)&&n(1);continue}}let g,h,u;if(i>=0){for(h=e.slice(i);!(endTag.test(h)||startTagOpen.test(h)||comment.test(h)||conditionalComment.test(h)||(u=h.indexOf("<",1))<0);)i+=u,h=e.slice(i);g=e.substring(0,i),n(i)}i<0&&(g=e,e=""),t.chars&&g&&t.chars(g)}if(e===i){t.chars&&t.chars(e),"production"!==process.env.NODE_ENV&&!r.length&&t.warn&&t.warn(`Mal-formatted tag at end of template: "${e}"`);break}}a()}function parse(e){const t={tag:"root",attrs:[],unary:!1,start:0,contentStart:0,contentEnd:e.length,end:e.length,children:[],comments:[]},n=[t];let a=t;return parseHTML(e,{start:function(e,t,r,o,s){const c={tag:e,attrs:t,unary:r,start:o,children:[]};a.children.push(c),r?c.end=s:(c.contentStart=s,n.push(c),a=c)},end:function(e,t,r){n.pop(),a.contentEnd=t,a.end=r,a=n[n.length-1]}}),t}const no=()=>!1,isNonPhrasingTag=makeMap("address,article,aside,base,blockquote,body,caption,col,colgroup,dd,details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,title,tr,track"),attribute=/^\s*([^\s"'<>/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/,ncname="[a-zA-Z_][\\w\\-\\.]*",qnameCapture=`((?:${ncname}\\:)?${ncname})`,startTagOpen=new RegExp(`^<${qnameCapture}`),startTagClose=/^\s*(\/?)>/,endTag=new RegExp(`^<\\/${qnameCapture}[^>]*>`),doctype=/^<!DOCTYPE [^>]+>/i,comment=/^<!--/,conditionalComment=/^<!\[/;let IS_REGEX_CAPTURING_BROKEN=!1;"x".replace(/x(.)?/g,(e,t)=>{IS_REGEX_CAPTURING_BROKEN=""===t});const isPlainTextElement=makeMap("script,style,textarea",!0),reCache={},decodingMap={"&lt;":"<","&gt;":">","&quot;":'"',"&amp;":"&","&#10;":"\n","&#9;":"\t"},encodedAttr=/&(?:lt|gt|quot|amp);/g,encodedAttrWithNewLines=/&(?:lt|gt|quot|amp|#10|#9);/g,isIgnoreNewlineTag=makeMap("pre,textarea",!0),shouldIgnoreFirstNewline=(e,t)=>e&&isIgnoreNewlineTag(e)&&"\n"===t[0];var parserVue=parse;module.exports=parserVue;
