amis.define("a83731c",function(e,n){"use strict";function t(e,n){e=e.sort(function(e,n){var t=e.startLine-n.startLine;return 0===t&&(t=e.endLine-n.endLine),t});for(var t=void 0,a=[],i=[],r=[],o=function(e,n){i[e]=n,30>n&&(r[n]=(r[n]||0)+1)},s=0;s<e.length;s++){var g=e[s];if(t){if(g.startLine>t.startLine)if(g.endLine<=t.endLine)a.push(t),t=g,o(s,a.length);else if(g.startLine>t.endLine){do t=a.pop();while(t&&g.startLine>t.endLine);t&&a.push(t),t=g,o(s,a.length)}}else t=g,o(s,0)}for(var f=0,l=0,s=0;s<r.length;s++){var T=r[s];if(T){if(T+f>n){l=s;break}f+=T}}for(var d=[],s=0;s<e.length;s++){var L=i[s];"number"==typeof L&&(l>L||L===l&&f++<n)&&d.push(e[s])}return d}function a(e,n){function a(e){l.push(e),L=e.startLine}for(var g=o.createScanner(e.getText()),f=g.scan(),l=[],T=[],d=null,L=-1;f!==r.TokenType.EOS;){switch(f){case r.TokenType.StartTag:var c=g.getTokenText(),k=e.positionAt(g.getTokenOffset()).line;T.push({startLine:k,tagName:c}),d=c;break;case r.TokenType.EndTag:d=g.getTokenText();break;case r.TokenType.StartTagClose:if(!d||!s.isVoidElement(d))break;case r.TokenType.EndTagClose:case r.TokenType.StartTagSelfClose:for(var h=T.length-1;h>=0&&T[h].tagName!==d;)h--;if(h>=0){var p=T[h];T.length=h;var u=e.positionAt(g.getTokenOffset()).line,k=p.startLine,v=u-1;v>k&&L!==k&&a({startLine:k,endLine:v})}break;case r.TokenType.Comment:var k=e.positionAt(g.getTokenOffset()).line,m=g.getTokenText(),b=m.match(/^\s*#(region\b)|(endregion\b)/);if(b)if(b[1])T.push({startLine:k,tagName:""});else{for(var h=T.length-1;h>=0&&T[h].tagName.length;)h--;if(h>=0){var p=T[h];T.length=h;var v=k;k=p.startLine,v>k&&L!==k&&a({startLine:k,endLine:v,kind:i.FoldingRangeKind.Region})}}else{var v=e.positionAt(g.getTokenOffset()+g.getTokenLength()).line;v>k&&a({startLine:k,endLine:v,kind:i.FoldingRangeKind.Comment})}}f=g.scan()}var y=n&&n.rangeLimit||Number.MAX_VALUE;return l.length>y?t(l,y):l}Object.defineProperty(n,"__esModule",{value:!0});var i=e("c1fd486"),r=e("d8847af"),o=e("3dfa3cb"),s=e("0da881f");n.getFoldingRanges=a});