diff --git a/CHANGELOG.md b/CHANGELOG.md index e01d8716..b603c13f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +### [0.8.1](https://github.com/Tencent/cherry-markdown/compare/v0.8.0...v0.8.1) (2022-09-06) + + +### Bug Fixes + +* 懒加载逻辑不能幂等 ([a2198cb](https://github.com/Tencent/cherry-markdown/commit/a2198cb9f6b0ecb720be3e2c26a4385e9b49e7d7)) + ## [0.8.0](https://github.com/Tencent/cherry-markdown/compare/v0.7.9...v0.8.0) (2022-09-01) diff --git a/dist/cherry-markdown.core.common.js b/dist/cherry-markdown.core.common.js index 79b3cfa0..c7d98195 100644 --- a/dist/cherry-markdown.core.common.js +++ b/dist/cherry-markdown.core.common.js @@ -1 +1 @@ -"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("jsdom"),t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function r(e,t){return e(t={exports:{}},t.exports),t.exports}var A,i,o=function(e){return e&&e.Math==Math&&e},a=o("object"==typeof globalThis&&globalThis)||o("object"==typeof window&&window)||o("object"==typeof self&&self)||o("object"==typeof t&&t)||function(){return this}()||Function("return this")(),s=function(e){try{return!!e()}catch(e){return!0}},c=!s((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),l=Function.prototype,u=l.apply,f=l.call,h="object"==typeof Reflect&&Reflect.apply||(c?f.bind(u):function(){return f.apply(u,arguments)}),d=Function.prototype,p=d.bind,g=d.call,m=c&&p.bind(g,g),v=c?function(e){return e&&m(e)}:function(e){return e&&function(){return g.apply(e,arguments)}},B=function(e){return"function"==typeof e},E=!s((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),y=Function.prototype.call,C=c?y.bind(y):function(){return y.apply(y,arguments)},b={}.propertyIsEnumerable,w=Object.getOwnPropertyDescriptor,T={f:w&&!b.call({1:2},1)?function(e){var t=w(this,e);return!!t&&t.enumerable}:b},_=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},I=v({}.toString),S=v("".slice),k=function(e){return S(I(e),8,-1)},F=a.Object,x=v("".split),L=s((function(){return!F("z").propertyIsEnumerable(0)}))?function(e){return"String"==k(e)?x(e,""):F(e)}:F,U=a.TypeError,N=function(e){if(null==e)throw U("Can't call method on "+e);return e},D=function(e){return L(N(e))},O=function(e){return"object"==typeof e?null!==e:B(e)},Q={},R=function(e){return B(e)?e:void 0},M=function(e,t){return arguments.length<2?R(Q[e])||R(a[e]):Q[e]&&Q[e][t]||a[e]&&a[e][t]},H=v({}.isPrototypeOf),P=M("navigator","userAgent")||"",K=a.process,G=a.Deno,$=K&&K.versions||G&&G.version,V=$&&$.v8;V&&(i=(A=V.split("."))[0]>0&&A[0]<4?1:+(A[0]+A[1])),!i&&P&&(!(A=P.match(/Edge\/(\d+)/))||A[1]>=74)&&(A=P.match(/Chrome\/(\d+)/))&&(i=+A[1]);var W=i,j=!!Object.getOwnPropertySymbols&&!s((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&W&&W<41})),Y=j&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,X=a.Object,z=Y?function(e){return"symbol"==typeof e}:function(e){var t=M("Symbol");return B(t)&&H(t.prototype,X(e))},q=a.String,J=function(e){try{return q(e)}catch(e){return"Object"}},Z=a.TypeError,ee=function(e){if(B(e))return e;throw Z(J(e)+" is not a function")},te=function(e,t){var n=e[t];return null==n?void 0:ee(n)},ne=a.TypeError,re=Object.defineProperty,Ae=a["__core-js_shared__"]||function(e,t){try{re(a,e,{value:t,configurable:!0,writable:!0})}catch(n){a[e]=t}return t}("__core-js_shared__",{}),ie=r((function(e){(e.exports=function(e,t){return Ae[e]||(Ae[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.22.6",mode:"pure",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.22.6/LICENSE",source:"https://github.com/zloirock/core-js"})})),oe=a.Object,ae=function(e){return oe(N(e))},se=v({}.hasOwnProperty),ce=Object.hasOwn||function(e,t){return se(ae(e),t)},le=0,ue=Math.random(),fe=v(1..toString),he=function(e){return"Symbol("+(void 0===e?"":e)+")_"+fe(++le+ue,36)},de=ie("wks"),pe=a.Symbol,ge=pe&&pe.for,me=Y?pe:pe&&pe.withoutSetter||he,ve=function(e){if(!ce(de,e)||!j&&"string"!=typeof de[e]){var t="Symbol."+e;j&&ce(pe,e)?de[e]=pe[e]:de[e]=Y&&ge?ge(t):me(t)}return de[e]},Be=a.TypeError,Ee=ve("toPrimitive"),ye=function(e,t){if(!O(e)||z(e))return e;var n,r=te(e,Ee);if(r){if(void 0===t&&(t="default"),n=C(r,e,t),!O(n)||z(n))return n;throw Be("Can't convert object to primitive value")}return void 0===t&&(t="number"),function(e,t){var n,r;if("string"===t&&B(n=e.toString)&&!O(r=C(n,e)))return r;if(B(n=e.valueOf)&&!O(r=C(n,e)))return r;if("string"!==t&&B(n=e.toString)&&!O(r=C(n,e)))return r;throw ne("Can't convert object to primitive value")}(e,t)},Ce=function(e){var t=ye(e,"string");return z(t)?t:t+""},be=a.document,we=O(be)&&O(be.createElement),Te=function(e){return we?be.createElement(e):{}},_e=!E&&!s((function(){return 7!=Object.defineProperty(Te("div"),"a",{get:function(){return 7}}).a})),Ie=Object.getOwnPropertyDescriptor,Se={f:E?Ie:function(e,t){if(e=D(e),t=Ce(t),_e)try{return Ie(e,t)}catch(e){}if(ce(e,t))return _(!C(T.f,e,t),e[t])}},ke=/#|\.prototype\./,Fe=function(e,t){var n=Le[xe(e)];return n==Ne||n!=Ue&&(B(t)?s(t):!!t)},xe=Fe.normalize=function(e){return String(e).replace(ke,".").toLowerCase()},Le=Fe.data={},Ue=Fe.NATIVE="N",Ne=Fe.POLYFILL="P",De=Fe,Oe=v(v.bind),Qe=function(e,t){return ee(e),void 0===t?e:c?Oe(e,t):function(){return e.apply(t,arguments)}},Re=E&&s((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Me=a.String,He=a.TypeError,Pe=function(e){if(O(e))return e;throw He(Me(e)+" is not an object")},Ke=a.TypeError,Ge=Object.defineProperty,$e=Object.getOwnPropertyDescriptor,Ve={f:E?Re?function(e,t,n){if(Pe(e),t=Ce(t),Pe(n),"function"==typeof e&&"prototype"===t&&"value"in n&&"writable"in n&&!n.writable){var r=$e(e,t);r&&r.writable&&(e[t]=n.value,n={configurable:"configurable"in n?n.configurable:r.configurable,enumerable:"enumerable"in n?n.enumerable:r.enumerable,writable:!1})}return Ge(e,t,n)}:Ge:function(e,t,n){if(Pe(e),t=Ce(t),Pe(n),_e)try{return Ge(e,t,n)}catch(e){}if("get"in n||"set"in n)throw Ke("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},We=E?function(e,t,n){return Ve.f(e,t,_(1,n))}:function(e,t,n){return e[t]=n,e},je=Se.f,Ye=function(e){var t=function(n,r,A){if(this instanceof t){switch(arguments.length){case 0:return new e;case 1:return new e(n);case 2:return new e(n,r)}return new e(n,r,A)}return h(e,this,arguments)};return t.prototype=e.prototype,t},Xe=function(e,t){var n,r,A,i,o,s,c,l,u=e.target,f=e.global,h=e.stat,d=e.proto,p=f?a:h?a[u]:(a[u]||{}).prototype,g=f?Q:Q[u]||We(Q,u,{})[u],m=g.prototype;for(A in t)n=!De(f?A:u+(h?".":"#")+A,e.forced)&&p&&ce(p,A),o=g[A],n&&(s=e.dontCallGetSet?(l=je(p,A))&&l.value:p[A]),i=n&&s?s:t[A],n&&typeof o==typeof i||(c=e.bind&&n?Qe(i,a):e.wrap&&n?Ye(i):d&&B(i)?v(i):i,(e.sham||i&&i.sham||o&&o.sham)&&We(c,"sham",!0),We(g,A,c),d&&(ce(Q,r=u+"Prototype")||We(Q,r,{}),We(Q[r],A,i),e.real&&m&&!m[A]&&We(m,A,i)))},ze=v([].slice),qe=a.Function,Je=v([].concat),Ze=v([].join),et={},tt=function(e,t,n){if(!ce(et,t)){for(var r=[],A=0;A0?wt:bt)(t)},_t=function(e){var t=+e;return t!=t||0===t?0:Tt(t)},It=Math.max,St=Math.min,kt=function(e,t){var n=_t(e);return n<0?It(n+t,0):St(n,t)},Ft=Math.min,xt=function(e){return e>0?Ft(_t(e),9007199254740991):0},Lt=function(e){return xt(e.length)},Ut=function(e){return function(t,n,r){var A,i=D(t),o=Lt(i),a=kt(r,o);if(e&&n!=n){for(;o>a;)if((A=i[a++])!=A)return!0}else for(;o>a;a++)if((e||a in i)&&i[a]===n)return e||a||0;return!e&&-1}},Nt={includes:Ut(!0),indexOf:Ut(!1)},Dt={},Ot=Nt.indexOf,Qt=v([].push),Rt=function(e,t){var n,r=D(e),A=0,i=[];for(n in r)!ce(Dt,n)&&ce(r,n)&&Qt(i,n);for(;t.length>A;)ce(r,n=t[A++])&&(~Ot(i,n)||Qt(i,n));return i},Mt=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Ht=Object.keys||function(e){return Rt(e,Mt)},Pt={f:E&&!Re?Object.defineProperties:function(e,t){Pe(e);for(var n,r=D(t),A=Ht(t),i=A.length,o=0;i>o;)Ve.f(e,n=A[o++],r[n]);return e}},Kt=M("document","documentElement"),Gt=ie("keys"),$t=function(e){return Gt[e]||(Gt[e]=he(e))},Vt=$t("IE_PROTO"),Wt=function(){},jt=function(e){return"`.\n this.sequenceIndex = Number(c === CharCodes.Lt);\n }\n }\n stateCDATASequence(c) {\n if (c === Sequences.Cdata[this.sequenceIndex]) {\n if (++this.sequenceIndex === Sequences.Cdata.length) {\n this.state = State.InCommentLike;\n this.currentSequence = Sequences.CdataEnd;\n this.sequenceIndex = 0;\n this.sectionStart = this.index + 1;\n }\n }\n else {\n this.sequenceIndex = 0;\n this.state = State.InDeclaration;\n this.stateInDeclaration(c); // Reconsume the character\n }\n }\n /**\n * When we wait for one specific character, we can speed things up\n * by skipping through the buffer until we find it.\n *\n * @returns Whether the character was found.\n */\n fastForwardTo(c) {\n while (++this.index < this.buffer.length + this.offset) {\n if (this.buffer.charCodeAt(this.index - this.offset) === c) {\n return true;\n }\n }\n /*\n * We increment the index at the end of the `parse` loop,\n * so set it to `buffer.length - 1` here.\n *\n * TODO: Refactor `parse` to increment index before calling states.\n */\n this.index = this.buffer.length + this.offset - 1;\n return false;\n }\n /**\n * Comments and CDATA end with `-->` and `]]>`.\n *\n * Their common qualities are:\n * - Their end sequences have a distinct character they start with.\n * - That character is then repeated, so we have to check multiple repeats.\n * - All characters but the start character of the sequence can be skipped.\n */\n stateInCommentLike(c) {\n if (c === this.currentSequence[this.sequenceIndex]) {\n if (++this.sequenceIndex === this.currentSequence.length) {\n if (this.currentSequence === Sequences.CdataEnd) {\n this.cbs.oncdata(this.sectionStart, this.index, 2);\n }\n else {\n this.cbs.oncomment(this.sectionStart, this.index, 2);\n }\n this.sequenceIndex = 0;\n this.sectionStart = this.index + 1;\n this.state = State.Text;\n }\n }\n else if (this.sequenceIndex === 0) {\n // Fast-forward to the first character of the sequence\n if (this.fastForwardTo(this.currentSequence[0])) {\n this.sequenceIndex = 1;\n }\n }\n else if (c !== this.currentSequence[this.sequenceIndex - 1]) {\n // Allow long sequences, eg. --->, ]]]>\n this.sequenceIndex = 0;\n }\n }\n /**\n * HTML only allows ASCII alpha characters (a-z and A-Z) at the beginning of a tag name.\n *\n * XML allows a lot more characters here (@see https://www.w3.org/TR/REC-xml/#NT-NameStartChar).\n * We allow anything that wouldn't end the tag.\n */\n isTagStartChar(c) {\n return this.xmlMode ? !isEndOfTagSection(c) : isASCIIAlpha(c);\n }\n startSpecial(sequence, offset) {\n this.isSpecial = true;\n this.currentSequence = sequence;\n this.sequenceIndex = offset;\n this.state = State.SpecialStartSequence;\n }\n stateBeforeTagName(c) {\n if (c === CharCodes.ExclamationMark) {\n this.state = State.BeforeDeclaration;\n this.sectionStart = this.index + 1;\n }\n else if (c === CharCodes.Questionmark) {\n this.state = State.InProcessingInstruction;\n this.sectionStart = this.index + 1;\n }\n else if (this.isTagStartChar(c)) {\n const lower = c | 0x20;\n this.sectionStart = this.index;\n if (!this.xmlMode && lower === Sequences.TitleEnd[2]) {\n this.startSpecial(Sequences.TitleEnd, 3);\n }\n else {\n this.state =\n !this.xmlMode && lower === Sequences.ScriptEnd[2]\n ? State.BeforeSpecialS\n : State.InTagName;\n }\n }\n else if (c === CharCodes.Slash) {\n this.state = State.BeforeClosingTagName;\n }\n else {\n this.state = State.Text;\n this.stateText(c);\n }\n }\n stateInTagName(c) {\n if (isEndOfTagSection(c)) {\n this.cbs.onopentagname(this.sectionStart, this.index);\n this.sectionStart = -1;\n this.state = State.BeforeAttributeName;\n this.stateBeforeAttributeName(c);\n }\n }\n stateBeforeClosingTagName(c) {\n if (isWhitespace(c)) {\n // Ignore\n }\n else if (c === CharCodes.Gt) {\n this.state = State.Text;\n }\n else {\n this.state = this.isTagStartChar(c)\n ? State.InClosingTagName\n : State.InSpecialComment;\n this.sectionStart = this.index;\n }\n }\n stateInClosingTagName(c) {\n if (c === CharCodes.Gt || isWhitespace(c)) {\n this.cbs.onclosetag(this.sectionStart, this.index);\n this.sectionStart = -1;\n this.state = State.AfterClosingTagName;\n this.stateAfterClosingTagName(c);\n }\n }\n stateAfterClosingTagName(c) {\n // Skip everything until \">\"\n if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {\n this.state = State.Text;\n this.sectionStart = this.index + 1;\n }\n }\n stateBeforeAttributeName(c) {\n if (c === CharCodes.Gt) {\n this.cbs.onopentagend(this.index);\n if (this.isSpecial) {\n this.state = State.InSpecialTag;\n this.sequenceIndex = 0;\n }\n else {\n this.state = State.Text;\n }\n this.baseState = this.state;\n this.sectionStart = this.index + 1;\n }\n else if (c === CharCodes.Slash) {\n this.state = State.InSelfClosingTag;\n }\n else if (!isWhitespace(c)) {\n this.state = State.InAttributeName;\n this.sectionStart = this.index;\n }\n }\n stateInSelfClosingTag(c) {\n if (c === CharCodes.Gt) {\n this.cbs.onselfclosingtag(this.index);\n this.state = State.Text;\n this.baseState = State.Text;\n this.sectionStart = this.index + 1;\n this.isSpecial = false; // Reset special state, in case of self-closing special tags\n }\n else if (!isWhitespace(c)) {\n this.state = State.BeforeAttributeName;\n this.stateBeforeAttributeName(c);\n }\n }\n stateInAttributeName(c) {\n if (c === CharCodes.Eq || isEndOfTagSection(c)) {\n this.cbs.onattribname(this.sectionStart, this.index);\n this.sectionStart = -1;\n this.state = State.AfterAttributeName;\n this.stateAfterAttributeName(c);\n }\n }\n stateAfterAttributeName(c) {\n if (c === CharCodes.Eq) {\n this.state = State.BeforeAttributeValue;\n }\n else if (c === CharCodes.Slash || c === CharCodes.Gt) {\n this.cbs.onattribend(QuoteType.NoValue, this.index);\n this.state = State.BeforeAttributeName;\n this.stateBeforeAttributeName(c);\n }\n else if (!isWhitespace(c)) {\n this.cbs.onattribend(QuoteType.NoValue, this.index);\n this.state = State.InAttributeName;\n this.sectionStart = this.index;\n }\n }\n stateBeforeAttributeValue(c) {\n if (c === CharCodes.DoubleQuote) {\n this.state = State.InAttributeValueDq;\n this.sectionStart = this.index + 1;\n }\n else if (c === CharCodes.SingleQuote) {\n this.state = State.InAttributeValueSq;\n this.sectionStart = this.index + 1;\n }\n else if (!isWhitespace(c)) {\n this.sectionStart = this.index;\n this.state = State.InAttributeValueNq;\n this.stateInAttributeValueNoQuotes(c); // Reconsume token\n }\n }\n handleInAttributeValue(c, quote) {\n if (c === quote ||\n (!this.decodeEntities && this.fastForwardTo(quote))) {\n this.cbs.onattribdata(this.sectionStart, this.index);\n this.sectionStart = -1;\n this.cbs.onattribend(quote === CharCodes.DoubleQuote\n ? QuoteType.Double\n : QuoteType.Single, this.index);\n this.state = State.BeforeAttributeName;\n }\n else if (this.decodeEntities && c === CharCodes.Amp) {\n this.baseState = this.state;\n this.state = State.BeforeEntity;\n }\n }\n stateInAttributeValueDoubleQuotes(c) {\n this.handleInAttributeValue(c, CharCodes.DoubleQuote);\n }\n stateInAttributeValueSingleQuotes(c) {\n this.handleInAttributeValue(c, CharCodes.SingleQuote);\n }\n stateInAttributeValueNoQuotes(c) {\n if (isWhitespace(c) || c === CharCodes.Gt) {\n this.cbs.onattribdata(this.sectionStart, this.index);\n this.sectionStart = -1;\n this.cbs.onattribend(QuoteType.Unquoted, this.index);\n this.state = State.BeforeAttributeName;\n this.stateBeforeAttributeName(c);\n }\n else if (this.decodeEntities && c === CharCodes.Amp) {\n this.baseState = this.state;\n this.state = State.BeforeEntity;\n }\n }\n stateBeforeDeclaration(c) {\n if (c === CharCodes.OpeningSquareBracket) {\n this.state = State.CDATASequence;\n this.sequenceIndex = 0;\n }\n else {\n this.state =\n c === CharCodes.Dash\n ? State.BeforeComment\n : State.InDeclaration;\n }\n }\n stateInDeclaration(c) {\n if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {\n this.cbs.ondeclaration(this.sectionStart, this.index);\n this.state = State.Text;\n this.sectionStart = this.index + 1;\n }\n }\n stateInProcessingInstruction(c) {\n if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {\n this.cbs.onprocessinginstruction(this.sectionStart, this.index);\n this.state = State.Text;\n this.sectionStart = this.index + 1;\n }\n }\n stateBeforeComment(c) {\n if (c === CharCodes.Dash) {\n this.state = State.InCommentLike;\n this.currentSequence = Sequences.CommentEnd;\n // Allow short comments (eg. )\n this.sequenceIndex = 2;\n this.sectionStart = this.index + 1;\n }\n else {\n this.state = State.InDeclaration;\n }\n }\n stateInSpecialComment(c) {\n if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {\n this.cbs.oncomment(this.sectionStart, this.index, 0);\n this.state = State.Text;\n this.sectionStart = this.index + 1;\n }\n }\n stateBeforeSpecialS(c) {\n const lower = c | 0x20;\n if (lower === Sequences.ScriptEnd[3]) {\n this.startSpecial(Sequences.ScriptEnd, 4);\n }\n else if (lower === Sequences.StyleEnd[3]) {\n this.startSpecial(Sequences.StyleEnd, 4);\n }\n else {\n this.state = State.InTagName;\n this.stateInTagName(c); // Consume the token again\n }\n }\n stateBeforeEntity(c) {\n // Start excess with 1 to include the '&'\n this.entityExcess = 1;\n this.entityResult = 0;\n if (c === CharCodes.Num) {\n this.state = State.BeforeNumericEntity;\n }\n else if (c === CharCodes.Amp) {\n // We have two `&` characters in a row. Stay in the current state.\n }\n else {\n this.trieIndex = 0;\n this.trieCurrent = this.entityTrie[0];\n this.state = State.InNamedEntity;\n this.stateInNamedEntity(c);\n }\n }\n stateInNamedEntity(c) {\n this.entityExcess += 1;\n this.trieIndex = determineBranch(this.entityTrie, this.trieCurrent, this.trieIndex + 1, c);\n if (this.trieIndex < 0) {\n this.emitNamedEntity();\n this.index--;\n return;\n }\n this.trieCurrent = this.entityTrie[this.trieIndex];\n const masked = this.trieCurrent & BinTrieFlags.VALUE_LENGTH;\n // If the branch is a value, store it and continue\n if (masked) {\n // The mask is the number of bytes of the value, including the current byte.\n const valueLength = (masked >> 14) - 1;\n // If we have a legacy entity while parsing strictly, just skip the number of bytes\n if (!this.allowLegacyEntity() && c !== CharCodes.Semi) {\n this.trieIndex += valueLength;\n }\n else {\n // Add 1 as we have already incremented the excess\n const entityStart = this.index - this.entityExcess + 1;\n if (entityStart > this.sectionStart) {\n this.emitPartial(this.sectionStart, entityStart);\n }\n // If this is a surrogate pair, consume the next two bytes\n this.entityResult = this.trieIndex;\n this.trieIndex += valueLength;\n this.entityExcess = 0;\n this.sectionStart = this.index + 1;\n if (valueLength === 0) {\n this.emitNamedEntity();\n }\n }\n }\n }\n emitNamedEntity() {\n this.state = this.baseState;\n if (this.entityResult === 0) {\n return;\n }\n const valueLength = (this.entityTrie[this.entityResult] & BinTrieFlags.VALUE_LENGTH) >>\n 14;\n switch (valueLength) {\n case 1:\n this.emitCodePoint(this.entityTrie[this.entityResult] &\n ~BinTrieFlags.VALUE_LENGTH);\n break;\n case 2:\n this.emitCodePoint(this.entityTrie[this.entityResult + 1]);\n break;\n case 3: {\n this.emitCodePoint(this.entityTrie[this.entityResult + 1]);\n this.emitCodePoint(this.entityTrie[this.entityResult + 2]);\n }\n }\n }\n stateBeforeNumericEntity(c) {\n if ((c | 0x20) === CharCodes.LowerX) {\n this.entityExcess++;\n this.state = State.InHexEntity;\n }\n else {\n this.state = State.InNumericEntity;\n this.stateInNumericEntity(c);\n }\n }\n emitNumericEntity(strict) {\n const entityStart = this.index - this.entityExcess - 1;\n const numberStart = entityStart + 2 + Number(this.state === State.InHexEntity);\n if (numberStart !== this.index) {\n // Emit leading data if any\n if (entityStart > this.sectionStart) {\n this.emitPartial(this.sectionStart, entityStart);\n }\n this.sectionStart = this.index + Number(strict);\n this.emitCodePoint(replaceCodePoint(this.entityResult));\n }\n this.state = this.baseState;\n }\n stateInNumericEntity(c) {\n if (c === CharCodes.Semi) {\n this.emitNumericEntity(true);\n }\n else if (isNumber(c)) {\n this.entityResult = this.entityResult * 10 + (c - CharCodes.Zero);\n this.entityExcess++;\n }\n else {\n if (this.allowLegacyEntity()) {\n this.emitNumericEntity(false);\n }\n else {\n this.state = this.baseState;\n }\n this.index--;\n }\n }\n stateInHexEntity(c) {\n if (c === CharCodes.Semi) {\n this.emitNumericEntity(true);\n }\n else if (isNumber(c)) {\n this.entityResult = this.entityResult * 16 + (c - CharCodes.Zero);\n this.entityExcess++;\n }\n else if (isHexDigit(c)) {\n this.entityResult =\n this.entityResult * 16 + ((c | 0x20) - CharCodes.LowerA + 10);\n this.entityExcess++;\n }\n else {\n if (this.allowLegacyEntity()) {\n this.emitNumericEntity(false);\n }\n else {\n this.state = this.baseState;\n }\n this.index--;\n }\n }\n allowLegacyEntity() {\n return (!this.xmlMode &&\n (this.baseState === State.Text ||\n this.baseState === State.InSpecialTag));\n }\n /**\n * Remove data that has already been consumed from the buffer.\n */\n cleanup() {\n // If we are inside of text or attributes, emit what we already have.\n if (this.running && this.sectionStart !== this.index) {\n if (this.state === State.Text ||\n (this.state === State.InSpecialTag && this.sequenceIndex === 0)) {\n this.cbs.ontext(this.sectionStart, this.index);\n this.sectionStart = this.index;\n }\n else if (this.state === State.InAttributeValueDq ||\n this.state === State.InAttributeValueSq ||\n this.state === State.InAttributeValueNq) {\n this.cbs.onattribdata(this.sectionStart, this.index);\n this.sectionStart = this.index;\n }\n }\n }\n shouldContinue() {\n return this.index < this.buffer.length + this.offset && this.running;\n }\n /**\n * Iterates through the buffer, calling the function corresponding to the current state.\n *\n * States that are more likely to be hit are higher up, as a performance improvement.\n */\n parse() {\n while (this.shouldContinue()) {\n const c = this.buffer.charCodeAt(this.index - this.offset);\n if (this.state === State.Text) {\n this.stateText(c);\n }\n else if (this.state === State.SpecialStartSequence) {\n this.stateSpecialStartSequence(c);\n }\n else if (this.state === State.InSpecialTag) {\n this.stateInSpecialTag(c);\n }\n else if (this.state === State.CDATASequence) {\n this.stateCDATASequence(c);\n }\n else if (this.state === State.InAttributeValueDq) {\n this.stateInAttributeValueDoubleQuotes(c);\n }\n else if (this.state === State.InAttributeName) {\n this.stateInAttributeName(c);\n }\n else if (this.state === State.InCommentLike) {\n this.stateInCommentLike(c);\n }\n else if (this.state === State.InSpecialComment) {\n this.stateInSpecialComment(c);\n }\n else if (this.state === State.BeforeAttributeName) {\n this.stateBeforeAttributeName(c);\n }\n else if (this.state === State.InTagName) {\n this.stateInTagName(c);\n }\n else if (this.state === State.InClosingTagName) {\n this.stateInClosingTagName(c);\n }\n else if (this.state === State.BeforeTagName) {\n this.stateBeforeTagName(c);\n }\n else if (this.state === State.AfterAttributeName) {\n this.stateAfterAttributeName(c);\n }\n else if (this.state === State.InAttributeValueSq) {\n this.stateInAttributeValueSingleQuotes(c);\n }\n else if (this.state === State.BeforeAttributeValue) {\n this.stateBeforeAttributeValue(c);\n }\n else if (this.state === State.BeforeClosingTagName) {\n this.stateBeforeClosingTagName(c);\n }\n else if (this.state === State.AfterClosingTagName) {\n this.stateAfterClosingTagName(c);\n }\n else if (this.state === State.BeforeSpecialS) {\n this.stateBeforeSpecialS(c);\n }\n else if (this.state === State.InAttributeValueNq) {\n this.stateInAttributeValueNoQuotes(c);\n }\n else if (this.state === State.InSelfClosingTag) {\n this.stateInSelfClosingTag(c);\n }\n else if (this.state === State.InDeclaration) {\n this.stateInDeclaration(c);\n }\n else if (this.state === State.BeforeDeclaration) {\n this.stateBeforeDeclaration(c);\n }\n else if (this.state === State.BeforeComment) {\n this.stateBeforeComment(c);\n }\n else if (this.state === State.InProcessingInstruction) {\n this.stateInProcessingInstruction(c);\n }\n else if (this.state === State.InNamedEntity) {\n this.stateInNamedEntity(c);\n }\n else if (this.state === State.BeforeEntity) {\n this.stateBeforeEntity(c);\n }\n else if (this.state === State.InHexEntity) {\n this.stateInHexEntity(c);\n }\n else if (this.state === State.InNumericEntity) {\n this.stateInNumericEntity(c);\n }\n else {\n // `this._state === State.BeforeNumericEntity`\n this.stateBeforeNumericEntity(c);\n }\n this.index++;\n }\n this.cleanup();\n }\n finish() {\n if (this.state === State.InNamedEntity) {\n this.emitNamedEntity();\n }\n // If there is remaining data, emit it in a reasonable way\n if (this.sectionStart < this.index) {\n this.handleTrailingData();\n }\n this.cbs.onend();\n }\n /** Handle any trailing data. */\n handleTrailingData() {\n const endIndex = this.buffer.length + this.offset;\n if (this.state === State.InCommentLike) {\n if (this.currentSequence === Sequences.CdataEnd) {\n this.cbs.oncdata(this.sectionStart, endIndex, 0);\n }\n else {\n this.cbs.oncomment(this.sectionStart, endIndex, 0);\n }\n }\n else if (this.state === State.InNumericEntity &&\n this.allowLegacyEntity()) {\n this.emitNumericEntity(false);\n // All trailing data will have been consumed\n }\n else if (this.state === State.InHexEntity &&\n this.allowLegacyEntity()) {\n this.emitNumericEntity(false);\n // All trailing data will have been consumed\n }\n else if (this.state === State.InTagName ||\n this.state === State.BeforeAttributeName ||\n this.state === State.BeforeAttributeValue ||\n this.state === State.AfterAttributeName ||\n this.state === State.InAttributeName ||\n this.state === State.InAttributeValueSq ||\n this.state === State.InAttributeValueDq ||\n this.state === State.InAttributeValueNq ||\n this.state === State.InClosingTagName) {\n /*\n * If we are currently in an opening or closing tag, us not calling the\n * respective callback signals that the tag should be ignored.\n */\n }\n else {\n this.cbs.ontext(this.sectionStart, endIndex);\n }\n }\n emitPartial(start, endIndex) {\n if (this.baseState !== State.Text &&\n this.baseState !== State.InSpecialTag) {\n this.cbs.onattribdata(start, endIndex);\n }\n else {\n this.cbs.ontext(start, endIndex);\n }\n }\n emitCodePoint(cp) {\n if (this.baseState !== State.Text &&\n this.baseState !== State.InSpecialTag) {\n this.cbs.onattribentity(cp);\n }\n else {\n this.cbs.ontextentity(cp);\n }\n }\n}\n//# sourceMappingURL=Tokenizer.js.map","import Tokenizer, { QuoteType } from \"./Tokenizer.js\";\nimport { fromCodePoint } from \"entities/lib/decode.js\";\nconst formTags = new Set([\n \"input\",\n \"option\",\n \"optgroup\",\n \"select\",\n \"button\",\n \"datalist\",\n \"textarea\",\n]);\nconst pTag = new Set([\"p\"]);\nconst tableSectionTags = new Set([\"thead\", \"tbody\"]);\nconst ddtTags = new Set([\"dd\", \"dt\"]);\nconst rtpTags = new Set([\"rt\", \"rp\"]);\nconst openImpliesClose = new Map([\n [\"tr\", new Set([\"tr\", \"th\", \"td\"])],\n [\"th\", new Set([\"th\"])],\n [\"td\", new Set([\"thead\", \"th\", \"td\"])],\n [\"body\", new Set([\"head\", \"link\", \"script\"])],\n [\"li\", new Set([\"li\"])],\n [\"p\", pTag],\n [\"h1\", pTag],\n [\"h2\", pTag],\n [\"h3\", pTag],\n [\"h4\", pTag],\n [\"h5\", pTag],\n [\"h6\", pTag],\n [\"select\", formTags],\n [\"input\", formTags],\n [\"output\", formTags],\n [\"button\", formTags],\n [\"datalist\", formTags],\n [\"textarea\", formTags],\n [\"option\", new Set([\"option\"])],\n [\"optgroup\", new Set([\"optgroup\", \"option\"])],\n [\"dd\", ddtTags],\n [\"dt\", ddtTags],\n [\"address\", pTag],\n [\"article\", pTag],\n [\"aside\", pTag],\n [\"blockquote\", pTag],\n [\"details\", pTag],\n [\"div\", pTag],\n [\"dl\", pTag],\n [\"fieldset\", pTag],\n [\"figcaption\", pTag],\n [\"figure\", pTag],\n [\"footer\", pTag],\n [\"form\", pTag],\n [\"header\", pTag],\n [\"hr\", pTag],\n [\"main\", pTag],\n [\"nav\", pTag],\n [\"ol\", pTag],\n [\"pre\", pTag],\n [\"section\", pTag],\n [\"table\", pTag],\n [\"ul\", pTag],\n [\"rt\", rtpTags],\n [\"rp\", rtpTags],\n [\"tbody\", tableSectionTags],\n [\"tfoot\", tableSectionTags],\n]);\nconst voidElements = new Set([\n \"area\",\n \"base\",\n \"basefont\",\n \"br\",\n \"col\",\n \"command\",\n \"embed\",\n \"frame\",\n \"hr\",\n \"img\",\n \"input\",\n \"isindex\",\n \"keygen\",\n \"link\",\n \"meta\",\n \"param\",\n \"source\",\n \"track\",\n \"wbr\",\n]);\nconst foreignContextElements = new Set([\"math\", \"svg\"]);\nconst htmlIntegrationElements = new Set([\n \"mi\",\n \"mo\",\n \"mn\",\n \"ms\",\n \"mtext\",\n \"annotation-xml\",\n \"foreignobject\",\n \"desc\",\n \"title\",\n]);\nconst reNameEnd = /\\s|\\//;\nexport class Parser {\n constructor(cbs, options = {}) {\n var _a, _b, _c, _d, _e;\n this.options = options;\n /** The start index of the last event. */\n this.startIndex = 0;\n /** The end index of the last event. */\n this.endIndex = 0;\n /**\n * Store the start index of the current open tag,\n * so we can update the start index for attributes.\n */\n this.openTagStart = 0;\n this.tagname = \"\";\n this.attribname = \"\";\n this.attribvalue = \"\";\n this.attribs = null;\n this.stack = [];\n this.foreignContext = [];\n this.buffers = [];\n this.bufferOffset = 0;\n /** The index of the last written buffer. Used when resuming after a `pause()`. */\n this.writeIndex = 0;\n /** Indicates whether the parser has finished running / `.end` has been called. */\n this.ended = false;\n this.cbs = cbs !== null && cbs !== void 0 ? cbs : {};\n this.lowerCaseTagNames = (_a = options.lowerCaseTags) !== null && _a !== void 0 ? _a : !options.xmlMode;\n this.lowerCaseAttributeNames =\n (_b = options.lowerCaseAttributeNames) !== null && _b !== void 0 ? _b : !options.xmlMode;\n this.tokenizer = new ((_c = options.Tokenizer) !== null && _c !== void 0 ? _c : Tokenizer)(this.options, this);\n (_e = (_d = this.cbs).onparserinit) === null || _e === void 0 ? void 0 : _e.call(_d, this);\n }\n // Tokenizer event handlers\n /** @internal */\n ontext(start, endIndex) {\n var _a, _b;\n const data = this.getSlice(start, endIndex);\n this.endIndex = endIndex - 1;\n (_b = (_a = this.cbs).ontext) === null || _b === void 0 ? void 0 : _b.call(_a, data);\n this.startIndex = endIndex;\n }\n /** @internal */\n ontextentity(cp) {\n var _a, _b;\n /*\n * Entities can be emitted on the character, or directly after.\n * We use the section start here to get accurate indices.\n */\n const idx = this.tokenizer.getSectionStart();\n this.endIndex = idx - 1;\n (_b = (_a = this.cbs).ontext) === null || _b === void 0 ? void 0 : _b.call(_a, fromCodePoint(cp));\n this.startIndex = idx;\n }\n isVoidElement(name) {\n return !this.options.xmlMode && voidElements.has(name);\n }\n /** @internal */\n onopentagname(start, endIndex) {\n this.endIndex = endIndex;\n let name = this.getSlice(start, endIndex);\n if (this.lowerCaseTagNames) {\n name = name.toLowerCase();\n }\n this.emitOpenTag(name);\n }\n emitOpenTag(name) {\n var _a, _b, _c, _d;\n this.openTagStart = this.startIndex;\n this.tagname = name;\n const impliesClose = !this.options.xmlMode && openImpliesClose.get(name);\n if (impliesClose) {\n while (this.stack.length > 0 &&\n impliesClose.has(this.stack[this.stack.length - 1])) {\n const el = this.stack.pop();\n (_b = (_a = this.cbs).onclosetag) === null || _b === void 0 ? void 0 : _b.call(_a, el, true);\n }\n }\n if (!this.isVoidElement(name)) {\n this.stack.push(name);\n if (foreignContextElements.has(name)) {\n this.foreignContext.push(true);\n }\n else if (htmlIntegrationElements.has(name)) {\n this.foreignContext.push(false);\n }\n }\n (_d = (_c = this.cbs).onopentagname) === null || _d === void 0 ? void 0 : _d.call(_c, name);\n if (this.cbs.onopentag)\n this.attribs = {};\n }\n endOpenTag(isImplied) {\n var _a, _b;\n this.startIndex = this.openTagStart;\n if (this.attribs) {\n (_b = (_a = this.cbs).onopentag) === null || _b === void 0 ? void 0 : _b.call(_a, this.tagname, this.attribs, isImplied);\n this.attribs = null;\n }\n if (this.cbs.onclosetag && this.isVoidElement(this.tagname)) {\n this.cbs.onclosetag(this.tagname, true);\n }\n this.tagname = \"\";\n }\n /** @internal */\n onopentagend(endIndex) {\n this.endIndex = endIndex;\n this.endOpenTag(false);\n // Set `startIndex` for next node\n this.startIndex = endIndex + 1;\n }\n /** @internal */\n onclosetag(start, endIndex) {\n var _a, _b, _c, _d, _e, _f;\n this.endIndex = endIndex;\n let name = this.getSlice(start, endIndex);\n if (this.lowerCaseTagNames) {\n name = name.toLowerCase();\n }\n if (foreignContextElements.has(name) ||\n htmlIntegrationElements.has(name)) {\n this.foreignContext.pop();\n }\n if (!this.isVoidElement(name)) {\n const pos = this.stack.lastIndexOf(name);\n if (pos !== -1) {\n if (this.cbs.onclosetag) {\n let count = this.stack.length - pos;\n while (count--) {\n // We know the stack has sufficient elements.\n this.cbs.onclosetag(this.stack.pop(), count !== 0);\n }\n }\n else\n this.stack.length = pos;\n }\n else if (!this.options.xmlMode && name === \"p\") {\n // Implicit open before close\n this.emitOpenTag(\"p\");\n this.closeCurrentTag(true);\n }\n }\n else if (!this.options.xmlMode && name === \"br\") {\n // We can't use `emitOpenTag` for implicit open, as `br` would be implicitly closed.\n (_b = (_a = this.cbs).onopentagname) === null || _b === void 0 ? void 0 : _b.call(_a, \"br\");\n (_d = (_c = this.cbs).onopentag) === null || _d === void 0 ? void 0 : _d.call(_c, \"br\", {}, true);\n (_f = (_e = this.cbs).onclosetag) === null || _f === void 0 ? void 0 : _f.call(_e, \"br\", false);\n }\n // Set `startIndex` for next node\n this.startIndex = endIndex + 1;\n }\n /** @internal */\n onselfclosingtag(endIndex) {\n this.endIndex = endIndex;\n if (this.options.xmlMode ||\n this.options.recognizeSelfClosing ||\n this.foreignContext[this.foreignContext.length - 1]) {\n this.closeCurrentTag(false);\n // Set `startIndex` for next node\n this.startIndex = endIndex + 1;\n }\n else {\n // Ignore the fact that the tag is self-closing.\n this.onopentagend(endIndex);\n }\n }\n closeCurrentTag(isOpenImplied) {\n var _a, _b;\n const name = this.tagname;\n this.endOpenTag(isOpenImplied);\n // Self-closing tags will be on the top of the stack\n if (this.stack[this.stack.length - 1] === name) {\n // If the opening tag isn't implied, the closing tag has to be implied.\n (_b = (_a = this.cbs).onclosetag) === null || _b === void 0 ? void 0 : _b.call(_a, name, !isOpenImplied);\n this.stack.pop();\n }\n }\n /** @internal */\n onattribname(start, endIndex) {\n this.startIndex = start;\n const name = this.getSlice(start, endIndex);\n this.attribname = this.lowerCaseAttributeNames\n ? name.toLowerCase()\n : name;\n }\n /** @internal */\n onattribdata(start, endIndex) {\n this.attribvalue += this.getSlice(start, endIndex);\n }\n /** @internal */\n onattribentity(cp) {\n this.attribvalue += fromCodePoint(cp);\n }\n /** @internal */\n onattribend(quote, endIndex) {\n var _a, _b;\n this.endIndex = endIndex;\n (_b = (_a = this.cbs).onattribute) === null || _b === void 0 ? void 0 : _b.call(_a, this.attribname, this.attribvalue, quote === QuoteType.Double\n ? '\"'\n : quote === QuoteType.Single\n ? \"'\"\n : quote === QuoteType.NoValue\n ? undefined\n : null);\n if (this.attribs &&\n !Object.prototype.hasOwnProperty.call(this.attribs, this.attribname)) {\n this.attribs[this.attribname] = this.attribvalue;\n }\n this.attribvalue = \"\";\n }\n getInstructionName(value) {\n const idx = value.search(reNameEnd);\n let name = idx < 0 ? value : value.substr(0, idx);\n if (this.lowerCaseTagNames) {\n name = name.toLowerCase();\n }\n return name;\n }\n /** @internal */\n ondeclaration(start, endIndex) {\n this.endIndex = endIndex;\n const value = this.getSlice(start, endIndex);\n if (this.cbs.onprocessinginstruction) {\n const name = this.getInstructionName(value);\n this.cbs.onprocessinginstruction(`!${name}`, `!${value}`);\n }\n // Set `startIndex` for next node\n this.startIndex = endIndex + 1;\n }\n /** @internal */\n onprocessinginstruction(start, endIndex) {\n this.endIndex = endIndex;\n const value = this.getSlice(start, endIndex);\n if (this.cbs.onprocessinginstruction) {\n const name = this.getInstructionName(value);\n this.cbs.onprocessinginstruction(`?${name}`, `?${value}`);\n }\n // Set `startIndex` for next node\n this.startIndex = endIndex + 1;\n }\n /** @internal */\n oncomment(start, endIndex, offset) {\n var _a, _b, _c, _d;\n this.endIndex = endIndex;\n (_b = (_a = this.cbs).oncomment) === null || _b === void 0 ? void 0 : _b.call(_a, this.getSlice(start, endIndex - offset));\n (_d = (_c = this.cbs).oncommentend) === null || _d === void 0 ? void 0 : _d.call(_c);\n // Set `startIndex` for next node\n this.startIndex = endIndex + 1;\n }\n /** @internal */\n oncdata(start, endIndex, offset) {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;\n this.endIndex = endIndex;\n const value = this.getSlice(start, endIndex - offset);\n if (this.options.xmlMode || this.options.recognizeCDATA) {\n (_b = (_a = this.cbs).oncdatastart) === null || _b === void 0 ? void 0 : _b.call(_a);\n (_d = (_c = this.cbs).ontext) === null || _d === void 0 ? void 0 : _d.call(_c, value);\n (_f = (_e = this.cbs).oncdataend) === null || _f === void 0 ? void 0 : _f.call(_e);\n }\n else {\n (_h = (_g = this.cbs).oncomment) === null || _h === void 0 ? void 0 : _h.call(_g, `[CDATA[${value}]]`);\n (_k = (_j = this.cbs).oncommentend) === null || _k === void 0 ? void 0 : _k.call(_j);\n }\n // Set `startIndex` for next node\n this.startIndex = endIndex + 1;\n }\n /** @internal */\n onend() {\n var _a, _b;\n if (this.cbs.onclosetag) {\n // Set the end index for all remaining tags\n this.endIndex = this.startIndex;\n for (let i = this.stack.length; i > 0; this.cbs.onclosetag(this.stack[--i], true))\n ;\n }\n (_b = (_a = this.cbs).onend) === null || _b === void 0 ? void 0 : _b.call(_a);\n }\n /**\n * Resets the parser to a blank state, ready to parse a new HTML document\n */\n reset() {\n var _a, _b, _c, _d;\n (_b = (_a = this.cbs).onreset) === null || _b === void 0 ? void 0 : _b.call(_a);\n this.tokenizer.reset();\n this.tagname = \"\";\n this.attribname = \"\";\n this.attribs = null;\n this.stack.length = 0;\n this.startIndex = 0;\n this.endIndex = 0;\n (_d = (_c = this.cbs).onparserinit) === null || _d === void 0 ? void 0 : _d.call(_c, this);\n this.buffers.length = 0;\n this.bufferOffset = 0;\n this.writeIndex = 0;\n this.ended = false;\n }\n /**\n * Resets the parser, then parses a complete document and\n * pushes it to the handler.\n *\n * @param data Document to parse.\n */\n parseComplete(data) {\n this.reset();\n this.end(data);\n }\n getSlice(start, end) {\n while (start - this.bufferOffset >= this.buffers[0].length) {\n this.shiftBuffer();\n }\n let str = this.buffers[0].slice(start - this.bufferOffset, end - this.bufferOffset);\n while (end - this.bufferOffset > this.buffers[0].length) {\n this.shiftBuffer();\n str += this.buffers[0].slice(0, end - this.bufferOffset);\n }\n return str;\n }\n shiftBuffer() {\n this.bufferOffset += this.buffers[0].length;\n this.writeIndex--;\n this.buffers.shift();\n }\n /**\n * Parses a chunk of data and calls the corresponding callbacks.\n *\n * @param chunk Chunk to parse.\n */\n write(chunk) {\n var _a, _b;\n if (this.ended) {\n (_b = (_a = this.cbs).onerror) === null || _b === void 0 ? void 0 : _b.call(_a, new Error(\".write() after done!\"));\n return;\n }\n this.buffers.push(chunk);\n if (this.tokenizer.running) {\n this.tokenizer.write(chunk);\n this.writeIndex++;\n }\n }\n /**\n * Parses the end of the buffer and clears the stack, calls onend.\n *\n * @param chunk Optional final chunk to parse.\n */\n end(chunk) {\n var _a, _b;\n if (this.ended) {\n (_b = (_a = this.cbs).onerror) === null || _b === void 0 ? void 0 : _b.call(_a, Error(\".end() after done!\"));\n return;\n }\n if (chunk)\n this.write(chunk);\n this.ended = true;\n this.tokenizer.end();\n }\n /**\n * Pauses parsing. The parser won't emit events until `resume` is called.\n */\n pause() {\n this.tokenizer.pause();\n }\n /**\n * Resumes parsing after `pause` was called.\n */\n resume() {\n this.tokenizer.resume();\n while (this.tokenizer.running &&\n this.writeIndex < this.buffers.length) {\n this.tokenizer.write(this.buffers[this.writeIndex++]);\n }\n if (this.ended)\n this.tokenizer.end();\n }\n /**\n * Alias of `write`, for backwards compatibility.\n *\n * @param chunk Chunk to parse.\n * @deprecated\n */\n parseChunk(chunk) {\n this.write(chunk);\n }\n /**\n * Alias of `end`, for backwards compatibility.\n *\n * @param chunk Optional final chunk to parse.\n * @deprecated\n */\n done(chunk) {\n this.end(chunk);\n }\n}\n//# sourceMappingURL=Parser.js.map","import { Parser } from \"./Parser.js\";\nexport { Parser };\nimport { DomHandler, } from \"domhandler\";\nexport { DomHandler };\n// Helper methods\n/**\n * Parses the data, returns the resulting document.\n *\n * @param data The data that should be parsed.\n * @param options Optional options for the parser and DOM builder.\n */\nexport function parseDocument(data, options) {\n const handler = new DomHandler(undefined, options);\n new Parser(handler, options).end(data);\n return handler.root;\n}\n/**\n * Parses data, returns an array of the root nodes.\n *\n * Note that the root nodes still have a `Document` node as their parent.\n * Use `parseDocument` to get the `Document` node instead.\n *\n * @param data The data that should be parsed.\n * @param options Optional options for the parser and DOM builder.\n * @deprecated Use `parseDocument` instead.\n */\nexport function parseDOM(data, options) {\n return parseDocument(data, options).children;\n}\n/**\n * Creates a parser instance, with an attached DOM handler.\n *\n * @param cb A callback that will be called once parsing has been completed.\n * @param options Optional options for the parser and DOM builder.\n * @param elementCb An optional callback that will be called every time a tag has been completed inside of the DOM.\n */\nexport function createDomStream(cb, options, elementCb) {\n const handler = new DomHandler(cb, options, elementCb);\n return new Parser(handler, options);\n}\nexport { default as Tokenizer, } from \"./Tokenizer.js\";\n/*\n * All of the following exports exist for backwards-compatibility.\n * They should probably be removed eventually.\n */\nimport * as ElementType from \"domelementtype\";\nexport { ElementType };\nimport { getFeed } from \"domutils\";\nexport { getFeed };\n/**\n * Parse a feed.\n *\n * @param feed The feed that should be parsed, as a string.\n * @param options Optionally, options for parsing. When using this, you should set `xmlMode` to `true`.\n */\nexport function parseFeed(feed, options = { xmlMode: true }) {\n return getFeed(parseDOM(feed, options));\n}\nexport * as DomUtils from \"domutils\";\n// Old name for DomHandler\nexport { DomHandler as DefaultHandler };\n//# sourceMappingURL=index.js.map","/**\n * Types used in signatures of Cheerio methods.\n *\n * @category Cheerio\n */\nexport * from './types.js';\nimport { getLoad } from './load.js';\nimport { getParse } from './parse.js';\nimport { renderWithParse5, parseWithParse5 } from './parsers/parse5-adapter.js';\nimport renderWithHtmlparser2 from 'dom-serializer';\nimport { parseDocument as parseWithHtmlparser2 } from 'htmlparser2';\nconst parse = getParse((content, options, isDocument, context) => options.xmlMode || options._useHtmlParser2\n ? parseWithHtmlparser2(content, options)\n : parseWithParse5(content, options, isDocument, context));\n// Duplicate docs due to https://github.com/TypeStrong/typedoc/issues/1616\n/**\n * Create a querying function, bound to a document created from the provided markup.\n *\n * Note that similar to web browser contexts, this operation may introduce\n * ``, ``, and `` elements; set `isDocument` to `false` to\n * switch to fragment mode and disable this.\n *\n * @param content - Markup to be loaded.\n * @param options - Options for the created instance.\n * @param isDocument - Allows parser to be switched to fragment mode.\n * @returns The loaded document.\n * @see {@link https://cheerio.js.org#loading} for additional usage information.\n */\nexport const load = getLoad(parse, (dom, options) => options.xmlMode || options._useHtmlParser2\n ? renderWithHtmlparser2(dom, options)\n : renderWithParse5(dom));\n/**\n * The default cheerio instance.\n *\n * @deprecated Use the function returned by `load` instead.\n */\nexport default load([]);\nexport { html, xml, text } from './static.js';\nimport * as staticMethods from './static.js';\n/**\n * In order to promote consistency with the jQuery library, users are encouraged\n * to instead use the static method of the same name.\n *\n * @deprecated\n * @example\n *\n * ```js\n * const $ = cheerio.load('

');\n *\n * $.contains($('div').get(0), $('p').get(0));\n * //=> true\n *\n * $.contains($('p').get(0), $('div').get(0));\n * //=> false\n * ```\n *\n * @returns {boolean}\n */\nexport const { contains } = staticMethods;\n/**\n * In order to promote consistency with the jQuery library, users are encouraged\n * to instead use the static method of the same name.\n *\n * @deprecated\n * @example\n *\n * ```js\n * const $ = cheerio.load('');\n *\n * $.merge([1, 2], [3, 4]);\n * //=> [1, 2, 3, 4]\n * ```\n */\nexport const { merge } = staticMethods;\n/**\n * In order to promote consistency with the jQuery library, users are encouraged\n * to instead use the static method of the same name as it is defined on the\n * \"loaded\" Cheerio factory function.\n *\n * @deprecated See {@link static/parseHTML}.\n * @example\n *\n * ```js\n * const $ = cheerio.load('');\n * $.parseHTML('markup');\n * ```\n */\nexport const { parseHTML } = staticMethods;\n/**\n * Users seeking to access the top-level element of a parsed document should\n * instead use the `root` static method of a \"loaded\" Cheerio function.\n *\n * @deprecated\n * @example\n *\n * ```js\n * const $ = cheerio.load('');\n * $.root();\n * ```\n */\nexport const { root } = staticMethods;\n//# sourceMappingURL=index.js.map","exports = module.exports = debug;\n\nfunction debug(label) {\n return _debug.bind(null, label);\n}\n\nfunction _debug(label) {\n var args = [].slice.call(arguments, 1);\n args.unshift('[' + label + ']');\n process.stderr.write(args.join(' ') + '\\n');\n}","var DEBUG = false; // `true` to print debugging info.\nvar TIMER = false; // `true` to time calls to `lex()` and print the results.\n\nvar debug = require('./debug')('lex');\n\nexports = module.exports = lex;\n\n/**\n * Convert a CSS string into an array of lexical tokens.\n *\n * @param {String} css CSS\n * @returns {Array} lexical tokens\n */\nfunction lex(css) {\n var start; // Debug timer start.\n\n var buffer = ''; // Character accumulator\n var ch; // Current character\n var column = 0; // Current source column number\n var cursor = -1; // Current source cursor position\n var depth = 0; // Current nesting depth\n var line = 1; // Current source line number\n var state = 'before-selector'; // Current state\n var stack = [state]; // State stack\n var token = {}; // Current token\n var tokens = []; // Token accumulator\n\n // Supported @-rules, in roughly descending order of usage probability.\n var atRules = [\n 'media',\n 'keyframes',\n { name: '-webkit-keyframes', type: 'keyframes', prefix: '-webkit-' },\n { name: '-moz-keyframes', type: 'keyframes', prefix: '-moz-' },\n { name: '-ms-keyframes', type: 'keyframes', prefix: '-ms-' },\n { name: '-o-keyframes', type: 'keyframes', prefix: '-o-' },\n 'font-face',\n { name: 'import', state: 'before-at-value' },\n { name: 'charset', state: 'before-at-value' },\n 'supports',\n 'viewport',\n { name: 'namespace', state: 'before-at-value' },\n 'document',\n { name: '-moz-document', type: 'document', prefix: '-moz-' },\n 'page'\n ];\n\n // -- Functions ------------------------------------------------------------\n\n /**\n * Advance the character cursor and return the next character.\n *\n * @returns {String} The next character.\n */\n function getCh() {\n skip();\n return css[cursor];\n }\n\n /**\n * Return the state at the given index in the stack.\n * The stack is LIFO so indexing is from the right.\n *\n * @param {Number} [index=0] Index to return.\n * @returns {String} state\n */\n function getState(index) {\n return index ? stack[stack.length - 1 - index] : state;\n }\n\n /**\n * Look ahead for a string beginning from the next position. The string\n * being looked for must start at the next position.\n *\n * @param {String} str The string to look for.\n * @returns {Boolean} Whether the string was found.\n */\n function isNextString(str) {\n var start = cursor + 1;\n return (str === css.slice(start, start + str.length));\n }\n\n /**\n * Find the start position of a substring beginning from the next\n * position. The string being looked for may begin anywhere.\n *\n * @param {String} str The substring to look for.\n * @returns {Number|false} The position, or `false` if not found.\n */\n function find(str) {\n var pos = css.slice(cursor).indexOf(str);\n\n return pos > 0 ? pos : false;\n }\n\n /**\n * Determine whether a character is next.\n *\n * @param {String} ch Character.\n * @returns {Boolean} Whether the character is next.\n */\n function isNextChar(ch) {\n return ch === peek(1);\n }\n\n /**\n * Return the character at the given cursor offset. The offset is relative\n * to the cursor, so negative values move backwards.\n *\n * @param {Number} [offset=1] Cursor offset.\n * @returns {String} Character.\n */\n function peek(offset) {\n return css[cursor + (offset || 1)];\n }\n\n /**\n * Remove the current state from the stack and set the new current state.\n *\n * @returns {String} The removed state.\n */\n function popState() {\n var removed = stack.pop();\n state = stack[stack.length - 1];\n\n return removed;\n }\n\n /**\n * Set the current state and add it to the stack.\n *\n * @param {String} newState The new state.\n * @returns {Number} The new stack length.\n */\n function pushState(newState) {\n state = newState;\n stack.push(state);\n\n return stack.length;\n }\n\n /**\n * Replace the current state with a new state.\n *\n * @param {String} newState The new state.\n * @returns {String} The replaced state.\n */\n function replaceState(newState) {\n var previousState = state;\n stack[stack.length - 1] = state = newState;\n\n return previousState;\n }\n\n /**\n * Move the character cursor. Positive numbers move the cursor forward.\n * Negative numbers are not supported!\n *\n * @param {Number} [n=1] Number of characters to skip.\n */\n function skip(n) {\n if ((n || 1) == 1) {\n if (css[cursor] == '\\n') {\n line++;\n column = 1;\n } else {\n column++;\n }\n cursor++;\n } else {\n var skipStr = css.slice(cursor, cursor + n).split('\\n');\n if (skipStr.length > 1) {\n line += skipStr.length - 1;\n column = 1;\n }\n column += skipStr[skipStr.length - 1].length;\n cursor = cursor + n;\n }\n }\n\n /**\n * Add the current token to the pile and reset the buffer.\n */\n function addToken() {\n token.end = {\n line: line,\n col: column\n };\n\n DEBUG && debug('addToken:', JSON.stringify(token, null, 2));\n\n tokens.push(token);\n\n buffer = '';\n token = {};\n }\n\n /**\n * Set the current token.\n *\n * @param {String} type Token type.\n */\n function initializeToken(type) {\n token = {\n type: type,\n start: {\n line: line,\n col : column\n }\n };\n }\n\n // -- Main Loop ------------------------------------------------------------\n\n /*\n The main loop is a state machine that reads in one character at a time,\n and determines what to do based on the current state and character.\n This is implemented as a series of nested `switch` statements and the\n case orders have been mildly optimized based on rough probabilities\n calculated by processing a small sample of real-world CSS.\n\n Further optimization (such as a dispatch table) shouldn't be necessary\n since the total number of cases is very low.\n */\n\n TIMER && (start = Date.now());\n\n while (ch = getCh()) {\n DEBUG && debug(ch, getState());\n\n // column += 1;\n\n switch (ch) {\n // Space\n case ' ':\n switch (getState()) {\n case 'selector':\n case 'value':\n case 'value-paren':\n case 'at-group':\n case 'at-value':\n case 'comment':\n case 'double-string':\n case 'single-string':\n buffer += ch;\n break;\n }\n break;\n\n // Newline or tab\n case '\\n':\n case '\\t':\n case '\\r':\n case '\\f':\n switch (getState()) {\n case 'value':\n case 'value-paren':\n case 'at-group':\n case 'comment':\n case 'single-string':\n case 'double-string':\n case 'selector':\n buffer += ch;\n break;\n\n case 'at-value':\n // Tokenize an @-rule if a semi-colon was omitted.\n if ('\\n' === ch) {\n token.value = buffer.trim();\n addToken();\n popState();\n }\n break;\n }\n\n // if ('\\n' === ch) {\n // column = 0;\n // line += 1;\n // }\n break;\n\n case ':':\n switch (getState()) {\n case 'name':\n token.name = buffer.trim();\n buffer = '';\n\n replaceState('before-value');\n break;\n\n case 'before-selector':\n buffer += ch;\n\n initializeToken('selector');\n pushState('selector');\n break;\n\n case 'before-value':\n replaceState('value');\n buffer += ch;\n break;\n\n default:\n buffer += ch;\n break;\n }\n break;\n\n case ';':\n switch (getState()) {\n case 'name':\n case 'before-value':\n case 'value':\n // Tokenize a declaration\n // if value is empty skip the declaration\n if (buffer.trim().length > 0) {\n token.value = buffer.trim(),\n addToken();\n }\n replaceState('before-name');\n break;\n\n case 'value-paren':\n // Insignificant semi-colon\n buffer += ch;\n break;\n\n case 'at-value':\n // Tokenize an @-rule\n token.value = buffer.trim();\n addToken();\n popState();\n break;\n\n case 'before-name':\n // Extraneous semi-colon\n break;\n\n default:\n buffer += ch;\n break;\n }\n break;\n\n case '{':\n switch (getState()) {\n case 'selector':\n // If the sequence is `\\{` then assume that the brace should be escaped.\n if (peek(-1) === '\\\\') {\n buffer += ch;\n break;\n }\n\n // Tokenize a selector\n token.text = buffer.trim();\n addToken();\n replaceState('before-name');\n depth = depth + 1;\n break;\n\n case 'at-group':\n // Tokenize an @-group\n token.name = buffer.trim();\n\n // XXX: @-rules are starting to get hairy\n switch (token.type) {\n case 'font-face':\n case 'viewport' :\n case 'page' :\n pushState('before-name');\n break;\n\n default:\n pushState('before-selector');\n }\n\n addToken();\n depth = depth + 1;\n break;\n\n case 'name':\n case 'at-rule':\n // Tokenize a declaration or an @-rule\n token.name = buffer.trim();\n addToken();\n pushState('before-name');\n depth = depth + 1;\n break;\n\n case 'comment':\n case 'double-string':\n case 'single-string':\n // Ignore braces in comments and strings\n buffer += ch;\n break;\n case 'before-value':\n replaceState('value');\n buffer += ch;\n break;\n }\n\n break;\n\n case '}':\n switch (getState()) {\n case 'before-name':\n case 'name':\n case 'before-value':\n case 'value':\n // If the buffer contains anything, it is a value\n if (buffer) {\n token.value = buffer.trim();\n }\n\n // If the current token has a name and a value it should be tokenized.\n if (token.name && token.value) {\n addToken();\n }\n\n // Leave the block\n initializeToken('end');\n addToken();\n popState();\n\n // We might need to leave again.\n // XXX: What about 3 levels deep?\n if ('at-group' === getState()) {\n initializeToken('at-group-end');\n addToken();\n popState();\n }\n \n if (depth > 0) {\n depth = depth - 1;\n }\n\n break;\n\n case 'at-group':\n case 'before-selector':\n case 'selector':\n // If the sequence is `\\}` then assume that the brace should be escaped.\n if (peek(-1) === '\\\\') {\n buffer += ch;\n break;\n }\n\n if (depth > 0) {\n // Leave block if in an at-group\n if ('at-group' === getState(1)) {\n initializeToken('at-group-end');\n addToken();\n }\n }\n\n if (depth > 1) {\n popState();\n }\n\n if (depth > 0) {\n depth = depth - 1;\n }\n break;\n\n case 'double-string':\n case 'single-string':\n case 'comment':\n // Ignore braces in comments and strings.\n buffer += ch;\n break;\n }\n\n break;\n\n // Strings\n case '\"':\n case \"'\":\n switch (getState()) {\n case 'double-string':\n if ('\"' === ch && '\\\\' !== peek(-1)) {\n popState();\n }\n break;\n\n case 'single-string':\n if (\"'\" === ch && '\\\\' !== peek(-1)) {\n popState();\n }\n break;\n\n case 'before-at-value':\n replaceState('at-value');\n pushState('\"' === ch ? 'double-string' : 'single-string');\n break;\n\n case 'before-value':\n replaceState('value');\n pushState('\"' === ch ? 'double-string' : 'single-string');\n break;\n\n case 'comment':\n // Ignore strings within comments.\n break;\n\n default:\n if ('\\\\' !== peek(-1)) {\n pushState('\"' === ch ? 'double-string' : 'single-string');\n }\n }\n\n buffer += ch;\n break;\n\n // Comments\n case '/':\n switch (getState()) {\n case 'comment':\n case 'double-string':\n case 'single-string':\n // Ignore\n buffer += ch;\n break;\n\n case 'before-value':\n case 'selector':\n case 'name':\n case 'value':\n if (isNextChar('*')) {\n // Ignore comments in selectors, properties and values. They are\n // difficult to represent in the AST.\n var pos = find('*/');\n\n if (pos) {\n skip(pos + 1);\n }\n } else {\n if (getState() == 'before-value') replaceState('value');\n buffer += ch;\n }\n break;\n\n default:\n if (isNextChar('*')) {\n // Create a comment token\n initializeToken('comment');\n pushState('comment');\n skip();\n }\n else {\n buffer += ch;\n }\n break;\n }\n break;\n\n // Comment end or universal selector\n case '*':\n switch (getState()) {\n case 'comment':\n if (isNextChar('/')) {\n // Tokenize a comment\n token.text = buffer; // Don't trim()!\n skip();\n addToken();\n popState();\n }\n else {\n buffer += ch;\n }\n break;\n\n case 'before-selector':\n buffer += ch;\n initializeToken('selector');\n pushState('selector');\n break;\n\n case 'before-value':\n replaceState('value');\n buffer += ch;\n break;\n\n default:\n buffer += ch;\n }\n break;\n\n // @-rules\n case '@':\n switch (getState()) {\n case 'comment':\n case 'double-string':\n case 'single-string':\n buffer += ch;\n break;\n case 'before-value':\n replaceState('value');\n buffer += ch;\n break;\n\n default:\n // Iterate over the supported @-rules and attempt to tokenize one.\n var tokenized = false;\n var name;\n var rule;\n\n for (var j = 0, len = atRules.length; !tokenized && j < len; ++j) {\n rule = atRules[j];\n name = rule.name || rule;\n\n if (!isNextString(name)) { continue; }\n\n tokenized = true;\n\n initializeToken(name);\n pushState(rule.state || 'at-group');\n skip(name.length);\n\n if (rule.prefix) {\n token.prefix = rule.prefix;\n }\n\n if (rule.type) {\n token.type = rule.type;\n }\n }\n\n if (!tokenized) {\n // Keep on truckin' America!\n buffer += ch;\n }\n break;\n }\n break;\n\n // Parentheses are tracked to disambiguate semi-colons, such as within a\n // data URI.\n case '(':\n switch (getState()) {\n case 'value':\n pushState('value-paren');\n break;\n case 'before-value':\n replaceState('value');\n break;\n }\n\n buffer += ch;\n break;\n\n case ')':\n switch (getState()) {\n case 'value-paren':\n popState();\n break;\n case 'before-value':\n replaceState('value');\n break;\n }\n\n buffer += ch;\n break;\n\n default:\n switch (getState()) {\n case 'before-selector':\n initializeToken('selector');\n pushState('selector');\n break;\n\n case 'before-name':\n initializeToken('property');\n replaceState('name');\n break;\n\n case 'before-value':\n replaceState('value');\n break;\n\n case 'before-at-value':\n replaceState('at-value');\n break;\n }\n\n buffer += ch;\n break;\n }\n }\n\n TIMER && debug('ran in', (Date.now() - start) + 'ms');\n\n return tokens;\n}\n","var DEBUG = false; // `true` to print debugging info.\nvar TIMER = false; // `true` to time calls to `parse()` and print the results.\n\nvar debug = require('./debug')('parse');\nvar lex = require('./lexer');\n\nexports = module.exports = parse;\n\nvar _comments; // Whether comments are allowed.\nvar _depth; // Current block nesting depth.\nvar _position; // Whether to include line/column position.\nvar _tokens; // Array of lexical tokens.\n\n/**\n * Convert a CSS string or array of lexical tokens into a `stringify`-able AST.\n *\n * @param {String} css CSS string or array of lexical token\n * @param {Object} [options]\n * @param {Boolean} [options.comments=false] allow comment nodes in the AST\n * @returns {Object} `stringify`-able AST\n */\nfunction parse(css, options) {\n var start; // Debug timer start.\n\n options || (options = {});\n _comments = !!options.comments;\n _position = !!options.position;\n\n _depth = 0;\n\n // Operate on a copy of the given tokens, or the lex()'d CSS string.\n _tokens = Array.isArray(css) ? css.slice() : lex(css);\n\n var rule;\n var rules = [];\n var token;\n\n TIMER && (start = Date.now());\n\n while ((token = next())) {\n rule = parseToken(token);\n rule && rules.push(rule);\n }\n\n TIMER && debug('ran in', (Date.now() - start) + 'ms');\n\n return {\n type: \"stylesheet\",\n stylesheet: {\n rules: rules\n }\n };\n}\n\n// -- Functions --------------------------------------------------------------\n\n/**\n * Build an AST node from a lexical token.\n *\n * @param {Object} token lexical token\n * @param {Object} [override] object hash of properties that override those\n * already in the token, or that will be added to the token.\n * @returns {Object} AST node\n */\nfunction astNode(token, override) {\n override || (override = {});\n\n var key;\n var keys = ['type', 'name', 'value'];\n var node = {};\n\n // Avoiding [].forEach for performance reasons.\n for (var i = 0; i < keys.length; ++i) {\n key = keys[i];\n\n if (token[key]) {\n node[key] = override[key] || token[key];\n }\n }\n\n keys = Object.keys(override);\n\n for (i = 0; i < keys.length; ++i) {\n key = keys[i];\n\n if (!node[key]) {\n node[key] = override[key];\n }\n }\n\n if (_position) {\n node.position = {\n start: token.start,\n end: token.end\n };\n }\n\n DEBUG && debug('astNode:', JSON.stringify(node, null, 2));\n\n return node;\n}\n\n/**\n * Remove a lexical token from the stack and return the removed token.\n *\n * @returns {Object} lexical token\n */\nfunction next() {\n var token = _tokens.shift();\n DEBUG && debug('next:', JSON.stringify(token, null, 2));\n return token;\n}\n\n// -- Parse* Functions ---------------------------------------------------------\n\n/**\n * Convert an @-group lexical token to an AST node.\n *\n * @param {Object} token @-group lexical token\n * @returns {Object} @-group AST node\n */\nfunction parseAtGroup(token) {\n _depth = _depth + 1;\n\n // As the @-group token is assembled, relevant token values are captured here\n // temporarily. They will later be used as `tokenize()` overrides.\n var overrides = {};\n\n switch (token.type) {\n case 'font-face':\n case 'viewport' :\n overrides.declarations = parseDeclarations();\n break;\n\n case 'page':\n overrides.prefix = token.prefix;\n overrides.declarations = parseDeclarations();\n break;\n\n default:\n overrides.prefix = token.prefix;\n overrides.rules = parseRules();\n }\n\n return astNode(token, overrides);\n}\n\n/**\n * Convert an @import lexical token to an AST node.\n *\n * @param {Object} token @import lexical token\n * @returns {Object} @import AST node\n */\nfunction parseAtImport(token) {\n return astNode(token);\n}\n\n/**\n * Convert an @charset token to an AST node.\n *\n * @param {Object} token @charset lexical token\n * @returns {Object} @charset node\n */\nfunction parseCharset(token) {\n return astNode(token);\n}\n\n/**\n * Convert a comment token to an AST Node.\n *\n * @param {Object} token comment lexical token\n * @returns {Object} comment node\n */\nfunction parseComment(token) {\n return astNode(token, {text: token.text});\n}\n\nfunction parseNamespace(token) {\n return astNode(token);\n}\n\n/**\n * Convert a property lexical token to a property AST node.\n *\n * @returns {Object} property node\n */\nfunction parseProperty(token) {\n return astNode(token);\n}\n\n/**\n * Convert a selector lexical token to a selector AST node.\n *\n * @param {Object} token selector lexical token\n * @returns {Object} selector node\n */\nfunction parseSelector(token) {\n function trim(str) {\n return str.trim();\n }\n\n return astNode(token, {\n type: 'rule',\n selectors: token.text.split(',').map(trim),\n declarations: parseDeclarations(token)\n });\n}\n\n/**\n * Convert a lexical token to an AST node.\n *\n * @returns {Object|undefined} AST node\n */\nfunction parseToken(token) {\n switch (token.type) {\n // Cases are listed in roughly descending order of probability.\n case 'property': return parseProperty(token);\n\n case 'selector': return parseSelector(token);\n\n case 'at-group-end': _depth = _depth - 1; return;\n\n case 'media' :\n case 'keyframes' :return parseAtGroup(token);\n\n case 'comment': if (_comments) { return parseComment(token); } break;\n\n case 'charset': return parseCharset(token);\n case 'import': return parseAtImport(token);\n\n case 'namespace': return parseNamespace(token);\n\n case 'font-face':\n case 'supports' :\n case 'viewport' :\n case 'document' :\n case 'page' : return parseAtGroup(token);\n }\n\n DEBUG && debug('parseToken: unexpected token:', JSON.stringify(token));\n}\n\n// -- Parse Helper Functions ---------------------------------------------------\n\n/**\n * Iteratively parses lexical tokens from the stack into AST nodes until a\n * conditional function returns `false`, at which point iteration terminates\n * and any AST nodes collected are returned.\n *\n * @param {Function} conditionFn\n * @param {Object} token the lexical token being parsed\n * @returns {Boolean} `true` if the token should be parsed, `false` otherwise\n * @return {Array} AST nodes\n */\nfunction parseTokensWhile(conditionFn) {\n var node;\n var nodes = [];\n var token;\n\n while ((token = next()) && (conditionFn && conditionFn(token))) {\n node = parseToken(token);\n node && nodes.push(node);\n }\n\n // Place an unused non-`end` lexical token back onto the stack.\n if (token && token.type !== 'end') {\n _tokens.unshift(token);\n }\n\n return nodes;\n}\n\n/**\n * Convert a series of tokens into a sequence of declaration AST nodes.\n *\n * @returns {Array} declaration nodes\n */\nfunction parseDeclarations() {\n return parseTokensWhile(function (token) {\n return (token.type === 'property' || token.type === 'comment');\n });\n}\n\n/**\n * Convert a series of tokens into a sequence of rule nodes.\n *\n * @returns {Array} rule nodes\n */\nfunction parseRules() {\n return parseTokensWhile(function () { return _depth; });\n}\n","var DEBUG = false; // `true` to print debugging info.\nvar TIMER = false; // `true` to time calls to `stringify()` and print the results.\n\nvar debug = require('./debug')('stringify');\n\nvar _comments; // Whether comments are allowed in the stringified CSS.\nvar _compress; // Whether the stringified CSS should be compressed.\nvar _indentation; // Indentation option value.\nvar _level; // Current indentation level.\nvar _n; // Compression-aware newline character.\nvar _s; // Compression-aware space character.\n\nexports = module.exports = stringify;\n\n/**\n * Convert a `stringify`-able AST into a CSS string.\n *\n * @param {Object} `stringify`-able AST\n * @param {Object} [options]\n * @param {Boolean} [options.comments=false] allow comments in the CSS\n * @param {Boolean} [options.compress=false] compress whitespace\n * @param {String} [options.indentation=''] indentation sequence\n * @returns {String} CSS\n */\nfunction stringify(ast, options) {\n var start; // Debug timer start.\n\n options || (options = {});\n _indentation = options.indentation || '';\n _compress = !!options.compress;\n _comments = !!options.comments;\n _level = 1;\n\n if (_compress) {\n _n = _s = '';\n } else {\n _n = '\\n';\n _s = ' ';\n }\n\n TIMER && (start = Date.now());\n\n var css = reduce(ast.stylesheet.rules, stringifyNode).join('\\n').trim();\n\n TIMER && debug('ran in', (Date.now() - start) + 'ms');\n\n return css;\n}\n\n// -- Functions --------------------------------------------------------------\n\n/**\n * Modify the indentation level, or return a compression-aware sequence of\n * spaces equal to the current indentation level.\n *\n * @param {Number} [level=undefined] indentation level modifier\n * @returns {String} sequence of spaces\n */\nfunction indent(level) {\n if (level) {\n _level += level;\n return;\n }\n\n if (_compress) { return ''; }\n\n return Array(_level).join(_indentation || '');\n}\n\n// -- Stringify Functions ------------------------------------------------------\n\n/**\n * Stringify an @-rule AST node.\n *\n * Use `stringifyAtGroup()` when dealing with @-groups that may contain blocks\n * such as @media.\n *\n * @param {String} type @-rule type. E.g., import, charset\n * @returns {String} Stringified @-rule\n */\nfunction stringifyAtRule(node) {\n return '@' + node.type + ' ' + node.value + ';' + _n;\n}\n\n/**\n * Stringify an @-group AST node.\n *\n * Use `stringifyAtRule()` when dealing with @-rules that may not contain blocks\n * such as @import.\n *\n * @param {Object} node @-group AST node\n * @returns {String}\n */\nfunction stringifyAtGroup(node) {\n var label = '';\n var prefix = node.prefix || '';\n\n if (node.name) {\n label = ' ' + node.name;\n }\n\n // FIXME: @-rule conditional logic is leaking everywhere.\n var chomp = node.type !== 'page';\n\n return '@' + prefix + node.type + label + _s + stringifyBlock(node, chomp) + _n;\n}\n\n/**\n * Stringify a comment AST node.\n *\n * @param {Object} node comment AST node\n * @returns {String}\n */\nfunction stringifyComment(node) {\n if (!_comments) { return ''; }\n\n return '/*' + (node.text || '') + '*/' + _n;\n}\n\n/**\n * Stringify a rule AST node.\n *\n * @param {Object} node rule AST node\n * @returns {String}\n */\nfunction stringifyRule(node) {\n var label;\n\n if (node.selectors) {\n label = node.selectors.join(',' + _n);\n } else {\n label = '@' + node.type;\n label += node.name ? ' ' + node.name : '';\n }\n\n return indent() + label + _s + stringifyBlock(node) + _n;\n}\n\n\n// -- Stringify Helper Functions -----------------------------------------------\n\n/**\n * Reduce an array by applying a function to each item and retaining the truthy\n * results.\n *\n * When `item.type` is `'comment'` `stringifyComment` will be applied instead.\n *\n * @param {Array} items array to reduce\n * @param {Function} fn function to call for each item in the array\n * @returns {Mixed} Truthy values will be retained, falsy values omitted\n * @returns {Array} retained results\n */\nfunction reduce(items, fn) {\n return items.reduce(function (results, item) {\n var result = (item.type === 'comment') ? stringifyComment(item) : fn(item);\n result && results.push(result);\n return results;\n }, []);\n}\n\n/**\n * Stringify an AST node with the assumption that it represents a block of\n * declarations or other @-group contents.\n *\n * @param {Object} node AST node\n * @returns {String}\n */\n// FIXME: chomp should not be a magic boolean parameter\nfunction stringifyBlock(node, chomp) {\n var children = node.declarations;\n var fn = stringifyDeclaration;\n\n if (node.rules) {\n children = node.rules;\n fn = stringifyRule;\n }\n\n children = stringifyChildren(children, fn);\n children && (children = _n + children + (chomp ? '' : _n));\n\n return '{' + children + indent() + '}';\n}\n\n/**\n * Stringify an array of child AST nodes by calling the given stringify function\n * once for each child, and concatenating the results.\n *\n * @param {Array} children `node.rules` or `node.declarations`\n * @param {Function} fn stringify function\n * @returns {String}\n */\nfunction stringifyChildren(children, fn) {\n if (!children) { return ''; }\n\n indent(1);\n var results = reduce(children, fn);\n indent(-1);\n\n if (!results.length) { return ''; }\n\n return results.join(_n);\n}\n\n/**\n * Stringify a declaration AST node.\n *\n * @param {Object} node declaration AST node\n * @returns {String}\n */\nfunction stringifyDeclaration(node) {\n if (node.type === 'property') {\n return stringifyProperty(node);\n }\n\n DEBUG && debug('stringifyDeclaration: unexpected node:', JSON.stringify(node));\n}\n\n/**\n * Stringify an AST node.\n *\n * @param {Object} node AST node\n * @returns {String}\n */\nfunction stringifyNode(node) {\n switch (node.type) {\n // Cases are listed in roughly descending order of probability.\n case 'rule': return stringifyRule(node);\n\n case 'media' :\n case 'keyframes': return stringifyAtGroup(node);\n\n case 'comment': return stringifyComment(node);\n\n case 'import' :\n case 'charset' :\n case 'namespace': return stringifyAtRule(node);\n\n case 'font-face':\n case 'supports' :\n case 'viewport' :\n case 'document' :\n case 'page' : return stringifyAtGroup(node);\n }\n\n DEBUG && debug('stringifyNode: unexpected node: ' + JSON.stringify(node));\n}\n\n/**\n * Stringify an AST property node.\n *\n * @param {Object} node AST property node\n * @returns {String}\n */\nfunction stringifyProperty(node) {\n var name = node.name ? node.name + ':' + _s : '';\n\n return indent() + name + node.value + ';';\n}\n","module.exports = {\n lex : require('./lib/lexer'),\n parse: require('./lib/parser'),\n stringify: require('./lib/stringify')\n};\n","/*\r\nSlick Parser\r\n - originally created by the almighty Thomas Aylott <@subtlegradient> (http://subtlegradient.com)\r\n*/\"use strict\"\r\n\r\n// Notable changes from Slick.Parser 1.0.x\r\n\r\n// The parser now uses 2 classes: Expressions and Expression\r\n// `new Expressions` produces an array-like object containing a list of Expression objects\r\n// - Expressions::toString() produces a cleaned up expressions string\r\n// `new Expression` produces an array-like object\r\n// - Expression::toString() produces a cleaned up expression string\r\n// The only exposed method is parse, which produces a (cached) `new Expressions` instance\r\n// parsed.raw is no longer present, use .toString()\r\n// parsed.expression is now useless, just use the indices\r\n// parsed.reverse() has been removed for now, due to its apparent uselessness\r\n// Other changes in the Expressions object:\r\n// - classNames are now unique, and save both escaped and unescaped values\r\n// - attributes now save both escaped and unescaped values\r\n// - pseudos now save both escaped and unescaped values\r\n\r\nvar escapeRe = /([-.*+?^${}()|[\\]\\/\\\\])/g,\r\n unescapeRe = /\\\\/g\r\n\r\nvar escape = function(string){\r\n // XRegExp v2.0.0-beta-3\r\n // « https://github.com/slevithan/XRegExp/blob/master/src/xregexp.js\r\n return (string + \"\").replace(escapeRe, '\\\\$1')\r\n}\r\n\r\nvar unescape = function(string){\r\n return (string + \"\").replace(unescapeRe, '')\r\n}\r\n\r\nvar slickRe = RegExp(\r\n/*\r\n#!/usr/bin/env ruby\r\nputs \"\\t\\t\" + DATA.read.gsub(/\\(\\?x\\)|\\s+#.*$|\\s+|\\\\$|\\\\n/,'')\r\n__END__\r\n \"(?x)^(?:\\\r\n \\\\s* ( , ) \\\\s* # Separator \\n\\\r\n | \\\\s* ( + ) \\\\s* # Combinator \\n\\\r\n | ( \\\\s+ ) # CombinatorChildren \\n\\\r\n | ( + | \\\\* ) # Tag \\n\\\r\n | \\\\# ( + ) # ID \\n\\\r\n | \\\\. ( + ) # ClassName \\n\\\r\n | # Attribute \\n\\\r\n \\\\[ \\\r\n \\\\s* (+) (?: \\\r\n \\\\s* ([*^$!~|]?=) (?: \\\r\n \\\\s* (?:\\\r\n ([\\\"']?)(.*?)\\\\9 \\\r\n )\\\r\n ) \\\r\n )? \\\\s* \\\r\n \\\\](?!\\\\]) \\n\\\r\n | :+ ( + )(?:\\\r\n \\\\( (?:\\\r\n (?:([\\\"'])([^\\\\12]*)\\\\12)|((?:\\\\([^)]+\\\\)|[^()]*)+)\\\r\n ) \\\\)\\\r\n )?\\\r\n )\"\r\n*/\r\n\"^(?:\\\\s*(,)\\\\s*|\\\\s*(+)\\\\s*|(\\\\s+)|(+|\\\\*)|\\\\#(+)|\\\\.(+)|\\\\[\\\\s*(+)(?:\\\\s*([*^$!~|]?=)(?:\\\\s*(?:([\\\"']?)(.*?)\\\\9)))?\\\\s*\\\\](?!\\\\])|(:+)(+)(?:\\\\((?:(?:([\\\"'])([^\\\\13]*)\\\\13)|((?:\\\\([^)]+\\\\)|[^()]*)+))\\\\))?)\"\r\n .replace(//, '[' + escape(\">+~`!@$%^&={}\\\\;/g, '(?:[\\\\w\\\\u00a1-\\\\uFFFF-]|\\\\\\\\[^\\\\s0-9a-f])')\r\n .replace(//g, '(?:[:\\\\w\\\\u00a1-\\\\uFFFF-]|\\\\\\\\[^\\\\s0-9a-f])')\r\n)\r\n\r\n// Part\r\n\r\nvar Part = function Part(combinator){\r\n this.combinator = combinator || \" \"\r\n this.tag = \"*\"\r\n}\r\n\r\nPart.prototype.toString = function(){\r\n\r\n if (!this.raw){\r\n\r\n var xpr = \"\", k, part\r\n\r\n xpr += this.tag || \"*\"\r\n if (this.id) xpr += \"#\" + this.id\r\n if (this.classes) xpr += \".\" + this.classList.join(\".\")\r\n if (this.attributes) for (k = 0; part = this.attributes[k++];){\r\n xpr += \"[\" + part.name + (part.operator ? part.operator + '\"' + part.value + '\"' : '') + \"]\"\r\n }\r\n if (this.pseudos) for (k = 0; part = this.pseudos[k++];){\r\n xpr += \":\" + part.name\r\n if (part.value) xpr += \"(\" + part.value + \")\"\r\n }\r\n\r\n this.raw = xpr\r\n\r\n }\r\n\r\n return this.raw\r\n}\r\n\r\n// Expression\r\n\r\nvar Expression = function Expression(){\r\n this.length = 0\r\n}\r\n\r\nExpression.prototype.toString = function(){\r\n\r\n if (!this.raw){\r\n\r\n var xpr = \"\"\r\n\r\n for (var j = 0, bit; bit = this[j++];){\r\n if (j !== 1) xpr += \" \"\r\n if (bit.combinator !== \" \") xpr += bit.combinator + \" \"\r\n xpr += bit\r\n }\r\n\r\n this.raw = xpr\r\n\r\n }\r\n\r\n return this.raw\r\n}\r\n\r\nvar replacer = function(\r\n rawMatch,\r\n\r\n separator,\r\n combinator,\r\n combinatorChildren,\r\n\r\n tagName,\r\n id,\r\n className,\r\n\r\n attributeKey,\r\n attributeOperator,\r\n attributeQuote,\r\n attributeValue,\r\n\r\n pseudoMarker,\r\n pseudoClass,\r\n pseudoQuote,\r\n pseudoClassQuotedValue,\r\n pseudoClassValue\r\n){\r\n\r\n var expression, current\r\n\r\n if (separator || !this.length){\r\n expression = this[this.length++] = new Expression\r\n if (separator) return ''\r\n }\r\n\r\n if (!expression) expression = this[this.length - 1]\r\n\r\n if (combinator || combinatorChildren || !expression.length){\r\n current = expression[expression.length++] = new Part(combinator)\r\n }\r\n\r\n if (!current) current = expression[expression.length - 1]\r\n\r\n if (tagName){\r\n\r\n current.tag = unescape(tagName)\r\n\r\n } else if (id){\r\n\r\n current.id = unescape(id)\r\n\r\n } else if (className){\r\n\r\n var unescaped = unescape(className)\r\n\r\n var classes = current.classes || (current.classes = {})\r\n if (!classes[unescaped]){\r\n classes[unescaped] = escape(className)\r\n var classList = current.classList || (current.classList = [])\r\n classList.push(unescaped)\r\n classList.sort()\r\n }\r\n\r\n } else if (pseudoClass){\r\n\r\n pseudoClassValue = pseudoClassValue || pseudoClassQuotedValue\r\n\r\n ;(current.pseudos || (current.pseudos = [])).push({\r\n type : pseudoMarker.length == 1 ? 'class' : 'element',\r\n name : unescape(pseudoClass),\r\n escapedName : escape(pseudoClass),\r\n value : pseudoClassValue ? unescape(pseudoClassValue) : null,\r\n escapedValue : pseudoClassValue ? escape(pseudoClassValue) : null\r\n })\r\n\r\n } else if (attributeKey){\r\n\r\n attributeValue = attributeValue ? escape(attributeValue) : null\r\n\r\n ;(current.attributes || (current.attributes = [])).push({\r\n operator : attributeOperator,\r\n name : unescape(attributeKey),\r\n escapedName : escape(attributeKey),\r\n value : attributeValue ? unescape(attributeValue) : null,\r\n escapedValue : attributeValue ? escape(attributeValue) : null\r\n })\r\n\r\n }\r\n\r\n return ''\r\n\r\n}\r\n\r\n// Expressions\r\n\r\nvar Expressions = function Expressions(expression){\r\n this.length = 0\r\n\r\n var self = this\r\n\r\n var original = expression, replaced\r\n\r\n while (expression){\r\n replaced = expression.replace(slickRe, function(){\r\n return replacer.apply(self, arguments)\r\n })\r\n if (replaced === expression) throw new Error(original + ' is an invalid expression')\r\n expression = replaced\r\n }\r\n}\r\n\r\nExpressions.prototype.toString = function(){\r\n if (!this.raw){\r\n var expressions = []\r\n for (var i = 0, expression; expression = this[i++];) expressions.push(expression)\r\n this.raw = expressions.join(\", \")\r\n }\r\n\r\n return this.raw\r\n}\r\n\r\nvar cache = {}\r\n\r\nvar parse = function(expression){\r\n if (expression == null) return null\r\n expression = ('' + expression).replace(/^\\s+|\\s+$/g, '')\r\n return cache[expression] || (cache[expression] = new Expressions(expression))\r\n}\r\n\r\nmodule.exports = parse\r\n","'use strict';\n\nvar parser = require('slick/parser');\n\nmodule.exports = exports = Selector;\n\n/**\n * CSS selector constructor.\n *\n * @param {String} selector text\n * @param {Array} optionally, precalculated specificity\n * @api public\n */\n\nfunction Selector(text, styleAttribute) {\n this.text = text;\n this.spec = undefined;\n this.styleAttribute = styleAttribute || false;\n}\n\n/**\n * Get parsed selector.\n *\n * @api public\n */\n\nSelector.prototype.parsed = function() {\n if (!this.tokens) { this.tokens = parse(this.text); }\n return this.tokens;\n};\n\n/**\n * Lazy specificity getter\n *\n * @api public\n */\n\nSelector.prototype.specificity = function() {\n var styleAttribute = this.styleAttribute;\n if (!this.spec) { this.spec = specificity(this.text, this.parsed()); }\n return this.spec;\n\n function specificity(text, parsed) {\n var expressions = parsed || parse(text);\n var spec = [styleAttribute ? 1 : 0, 0, 0, 0];\n var nots = [];\n\n for (var i = 0; i < expressions.length; i++) {\n var expression = expressions[i];\n var pseudos = expression.pseudos;\n\n // id awards a point in the second column\n if (expression.id) { spec[1]++; }\n\n // classes and attributes award a point each in the third column\n if (expression.attributes) { spec[2] += expression.attributes.length; }\n if (expression.classList) { spec[2] += expression.classList.length; }\n\n // tag awards a point in the fourth column\n if (expression.tag && expression.tag !== '*') { spec[3]++; }\n\n // pseudos award a point each in the fourth column\n if (pseudos) {\n spec[3] += pseudos.length;\n\n for (var p = 0; p < pseudos.length; p++) {\n if (pseudos[p].name === 'not') {\n nots.push(pseudos[p].value);\n spec[3]--;\n }\n }\n }\n }\n\n for (var ii = nots.length; ii--;) {\n var not = specificity(nots[ii]);\n for (var jj = 4; jj--;) { spec[jj] += not[jj]; }\n }\n\n return spec;\n }\n};\n\n/**\n * Parses a selector and returns the tokens.\n *\n * @param {String} selector\n * @api private.\n */\n\nfunction parse(text) {\n try {\n return parser(text)[0];\n } catch (e) {\n return [];\n }\n}\n","'use strict';\n\nmodule.exports = exports = Property;\n\n/**\n * Module dependencies.\n */\n\nvar utils = require('./utils');\n\n/**\n * CSS property constructor.\n *\n * @param {String} property\n * @param {String} value\n * @param {Selector} selector the property originates from\n * @param {Integer} priority 0 for normal properties, 2 for !important properties.\n * @param {Array} additional array of integers representing more detailed priorities (sorting)\n * @api public\n */\n\nfunction Property(prop, value, selector, priority, additionalPriority) {\n this.prop = prop;\n this.value = value;\n this.selector = selector;\n this.priority = priority || 0;\n this.additionalPriority = additionalPriority || [];\n}\n\n/**\n * Compares with another Property based on Selector#specificity.\n *\n * @api public\n */\n\nProperty.prototype.compareFunc = function(property) {\n var a = [];\n a.push.apply(a, this.selector.specificity());\n a.push.apply(a, this.additionalPriority);\n a[0] += this.priority;\n var b = [];\n b.push.apply(b, property.selector.specificity());\n b.push.apply(b, property.additionalPriority);\n b[0] += property.priority;\n return utils.compareFunc(a, b);\n};\n\nProperty.prototype.compare = function(property) {\n var winner = this.compareFunc(property);\n if (winner === 1) {\n return this;\n }\n return property;\n};\n\n\n/**\n * Returns CSS property\n *\n * @api public\n */\n\nProperty.prototype.toString = function() {\n return this.prop + ': ' + this.value.replace(/['\"]+/g, '') + ';';\n};\n","'use strict';\n\n/**\n * Module dependencies.\n */\n\nvar mensch = require('mensch');\nvar Selector = require('./selector');\nvar Property = require('./property');\n\nexports.Selector = Selector;\nexports.Property = Property;\n\n/**\n * Returns an array of the selectors.\n *\n * @license Sizzle CSS Selector Engine - MIT\n * @param {String} selectorText from mensch\n * @api public\n */\n\nexports.extract = function extract(selectorText) {\n var attr = 0;\n var sels = [];\n var sel = '';\n\n for (var i = 0, l = selectorText.length; i < l; i++) {\n var c = selectorText.charAt(i);\n\n if (attr) {\n if (']' === c || ')' === c) { attr--; }\n sel += c;\n } else {\n if (',' === c) {\n sels.push(sel);\n sel = '';\n } else {\n if ('[' === c || '(' === c) { attr++; }\n if (sel.length || (c !== ',' && c !== '\\n' && c !== ' ')) { sel += c; }\n }\n }\n }\n\n if (sel.length) {\n sels.push(sel);\n }\n\n return sels;\n};\n\n/**\n * Returns a parse tree for a CSS source.\n * If it encounters multiple selectors separated by a comma, it splits the\n * tree.\n *\n * @param {String} css source\n * @api public\n */\n\nexports.parseCSS = function(css) {\n var parsed = mensch.parse(css, {position: true, comments: true});\n var rules = typeof parsed.stylesheet != 'undefined' && parsed.stylesheet.rules ? parsed.stylesheet.rules : [];\n var ret = [];\n\n for (var i = 0, l = rules.length; i < l; i++) {\n if (rules[i].type == 'rule') {\n var rule = rules[i];\n var selectors = rule.selectors;\n\n for (var ii = 0, ll = selectors.length; ii < ll; ii++) {\n ret.push([selectors[ii], rule.declarations]);\n }\n }\n }\n\n return ret;\n};\n\n/**\n * Returns preserved text for a CSS source.\n *\n * @param {String} css source\n * @param {Object} options\n * @api public\n */\n\nexports.getPreservedText = function(css, options, ignoredPseudos) {\n var parsed = mensch.parse(css, {position: true, comments: true});\n var rules = typeof parsed.stylesheet != 'undefined' && parsed.stylesheet.rules ? parsed.stylesheet.rules : [];\n var preserved = [];\n var lastStart = null;\n\n for (var i = rules.length - 1; i >= 0; i--) {\n if ((options.fontFaces && rules[i].type === 'font-face') ||\n (options.mediaQueries && rules[i].type === 'media') ||\n (options.keyFrames && rules[i].type === 'keyframes') ||\n (options.pseudos && rules[i].selectors && this.matchesPseudo(rules[i].selectors[0], ignoredPseudos))) {\n preserved.unshift(\n mensch.stringify(\n { stylesheet: { rules: [ rules[i] ] }},\n { comments: false, indentation: ' ' }\n )\n );\n }\n lastStart = rules[i].position.start;\n }\n\n if (preserved.length === 0) {\n return false;\n }\n return '\\n' + preserved.join('\\n') + '\\n';\n};\n\nexports.normalizeLineEndings = function(text) {\n return text.replace(/\\r\\n/g, '\\n').replace(/\\n/g, '\\r\\n');\n};\n\nexports.matchesPseudo = function(needle, haystack) {\n return haystack.find(function (element) {\n return needle.indexOf(element) > -1;\n })\n}\n\n/**\n * Compares two specificity vectors, returning the winning one.\n *\n * @param {Array} vector a\n * @param {Array} vector b\n * @return {Array}\n * @api public\n */\n\nexports.compareFunc = function(a, b) {\n var min = Math.min(a.length, b.length);\n for (var i = 0; i < min; i++) {\n if (a[i] === b[i]) { continue; }\n if (a[i] > b[i]) { return 1; }\n return -1;\n }\n\n return a.length - b.length;\n};\n\nexports.compare = function(a, b) {\n return exports.compareFunc(a, b) == 1 ? a : b;\n};\n\nexports.getDefaultOptions = function(options) {\n var result = Object.assign({\n extraCss: '',\n insertPreservedExtraCss: true,\n applyStyleTags: true,\n removeStyleTags: true,\n preserveMediaQueries: true,\n preserveFontFaces: true,\n preserveKeyFrames: true,\n preservePseudos: true,\n applyWidthAttributes: true,\n applyHeightAttributes: true,\n applyAttributesTableElements: true,\n url: ''\n }, options);\n\n result.webResources = result.webResources || {};\n\n return result;\n};\n","'use strict';\n\n/**\n * Module dependencies.\n */\nvar cheerio = require('cheerio');\nvar utils = require('./utils');\n\nvar cheerioLoad = function(html, options, encodeEntities) {\n options = Object.assign({decodeEntities: false, _useHtmlParser2:true}, options);\n html = encodeEntities(html);\n return cheerio.load(html, options);\n};\n\nvar createEntityConverters = function () {\n var codeBlockLookup = [];\n\n var encodeCodeBlocks = function(html) {\n var blocks = module.exports.codeBlocks;\n Object.keys(blocks).forEach(function(key) {\n var re = new RegExp(blocks[key].start + '([\\\\S\\\\s]*?)' + blocks[key].end, 'g');\n html = html.replace(re, function(match, subMatch) {\n codeBlockLookup.push(match);\n return 'JUICE_CODE_BLOCK_' + (codeBlockLookup.length - 1) + '_';\n });\n });\n return html;\n };\n\n var decodeCodeBlocks = function(html) {\n for(var index = 0; index < codeBlockLookup.length; index++) {\n var re = new RegExp('JUICE_CODE_BLOCK_' + index + '_(=\"\")?', 'gi');\n html = html.replace(re, function() {\n return codeBlockLookup[index];\n });\n }\n return html;\n };\n\n return {\n encodeEntities: encodeCodeBlocks,\n decodeEntities: decodeCodeBlocks,\n };\n};\n\n/**\n * Parses the input, calls the callback on the parsed DOM, and generates the output\n *\n * @param {String} html input html to be processed\n * @param {Object} options for the parser\n * @param {Function} callback to be invoked on the DOM\n * @param {Array} callbackExtraArguments to be passed to the callback\n * @return {String} resulting html\n */\nmodule.exports = function(html, options, callback, callbackExtraArguments) {\n var entityConverters = createEntityConverters();\n\n var $ = cheerioLoad(html, options, entityConverters.encodeEntities);\n var args = [ $ ];\n args.push.apply(args, callbackExtraArguments);\n var doc = callback.apply(undefined, args) || $;\n\n if (options && options.xmlMode) {\n return entityConverters.decodeEntities(doc.xml());\n }\n return entityConverters.decodeEntities(doc.html());\n};\n\nmodule.exports.codeBlocks = {\n EJS: { start: '<%', end: '%>' },\n HBS: { start: '{{', end: '}}' }\n};\n","'use strict';\n\n/**\n * Converts a decimal number to roman numeral.\n * https://stackoverflow.com/questions/9083037/convert-a-number-into-a-roman-numeral-in-javascript\n *\n * @param {Number} number\n * @api private.\n */\nexports.romanize = function(num) {\n if (isNaN(num))\n return NaN;\n var digits = String(+num).split(\"\"),\n key = [\"\",\"C\",\"CC\",\"CCC\",\"CD\",\"D\",\"DC\",\"DCC\",\"DCCC\",\"CM\",\n \"\",\"X\",\"XX\",\"XXX\",\"XL\",\"L\",\"LX\",\"LXX\",\"LXXX\",\"XC\",\n \"\",\"I\",\"II\",\"III\",\"IV\",\"V\",\"VI\",\"VII\",\"VIII\",\"IX\"],\n roman = \"\",\n i = 3;\n while (i--)\n roman = (key[+digits.pop() + (i * 10)] || \"\") + roman;\n return Array(+digits.join(\"\") + 1).join(\"M\") + roman;\n}\n\n/**\n * Converts a decimal number to alphanumeric numeral.\n * https://stackoverflow.com/questions/45787459/convert-number-to-alphabet-string-javascript\n *\n * @param {Number} number\n * @api private.\n */\nexports.alphanumeric = function(num) {\n var s = '', t;\n\n while (num > 0) {\n t = (num - 1) % 26;\n s = String.fromCharCode(65 + t) + s;\n num = (num - t)/26 | 0;\n }\n return s || undefined;\n}","'use strict';\n\nvar utils = require('./utils');\nvar numbers = require('./numbers');\n\nmodule.exports = function makeJuiceClient(juiceClient) {\n\njuiceClient.ignoredPseudos = ['hover', 'active', 'focus', 'visited', 'link'];\njuiceClient.widthElements = ['TABLE', 'TD', 'TH', 'IMG'];\njuiceClient.heightElements = ['TABLE', 'TD', 'TH', 'IMG'];\njuiceClient.tableElements = ['TABLE', 'TH', 'TR', 'TD', 'CAPTION', 'COLGROUP', 'COL', 'THEAD', 'TBODY', 'TFOOT'];\njuiceClient.nonVisualElements = [ 'HEAD', 'TITLE', 'BASE', 'LINK', 'STYLE', 'META', 'SCRIPT', 'NOSCRIPT' ];\njuiceClient.styleToAttribute = {\n 'background-color': 'bgcolor',\n 'background-image': 'background',\n 'text-align': 'align',\n 'vertical-align': 'valign'\n};\njuiceClient.excludedProperties = [];\n\njuiceClient.juiceDocument = juiceDocument;\njuiceClient.inlineDocument = inlineDocument;\n\nfunction inlineDocument($, css, options) {\n\n options = options || {};\n var rules = utils.parseCSS(css);\n var editedElements = [];\n var styleAttributeName = 'style';\n var counters = {};\n\n if (options.styleAttributeName) {\n styleAttributeName = options.styleAttributeName;\n }\n\n rules.forEach(handleRule);\n editedElements.forEach(setStyleAttrs);\n\n if (options.inlinePseudoElements) {\n editedElements.forEach(inlinePseudoElements);\n }\n\n if (options.applyWidthAttributes) {\n editedElements.forEach(function(el) {\n setDimensionAttrs(el, 'width');\n });\n }\n\n if (options.applyHeightAttributes) {\n editedElements.forEach(function(el) {\n setDimensionAttrs(el, 'height');\n });\n }\n\n if (options.applyAttributesTableElements) {\n editedElements.forEach(setAttributesOnTableElements);\n }\n\n if (options.insertPreservedExtraCss && options.extraCss) {\n var preservedText = utils.getPreservedText(options.extraCss, {\n mediaQueries: options.preserveMediaQueries,\n fontFaces: options.preserveFontFaces,\n keyFrames: options.preserveKeyFrames\n });\n if (preservedText) {\n var $appendTo = null;\n if (options.insertPreservedExtraCss !== true) {\n $appendTo = $(options.insertPreservedExtraCss);\n } else {\n $appendTo = $('head');\n if (!$appendTo.length) { $appendTo = $('body'); }\n if (!$appendTo.length) { $appendTo = $.root(); }\n }\n\n $appendTo.first().append('');\n }\n }\n\n function handleRule(rule) {\n var sel = rule[0];\n var style = rule[1];\n var selector = new utils.Selector(sel);\n var parsedSelector = selector.parsed();\n\n if (!parsedSelector) {\n return;\n }\n\n var pseudoElementType = getPseudoElementType(parsedSelector);\n\n // skip rule if the selector has any pseudos which are ignored\n for (var i = 0; i < parsedSelector.length; ++i) {\n var subSel = parsedSelector[i];\n if (subSel.pseudos) {\n for (var j = 0; j < subSel.pseudos.length; ++j) {\n var subSelPseudo = subSel.pseudos[j];\n if (juiceClient.ignoredPseudos.indexOf(subSelPseudo.name) >= 0) {\n return;\n }\n }\n }\n }\n\n if (pseudoElementType) {\n var last = parsedSelector[parsedSelector.length - 1];\n var pseudos = last.pseudos;\n last.pseudos = filterElementPseudos(last.pseudos);\n sel = parsedSelector.toString();\n last.pseudos = pseudos;\n }\n\n var els;\n try {\n els = $(sel);\n } catch (err) {\n // skip invalid selector\n return;\n }\n\n els.each(function() {\n var el = this;\n\n if (el.name && juiceClient.nonVisualElements.indexOf(el.name.toUpperCase()) >= 0) {\n return;\n }\n\n if (pseudoElementType) {\n var pseudoElPropName = 'pseudo' + pseudoElementType;\n var pseudoEl = el[pseudoElPropName];\n if (!pseudoEl) {\n pseudoEl = el[pseudoElPropName] = $('').get(0);\n pseudoEl.pseudoElementType = pseudoElementType;\n pseudoEl.pseudoElementParent = el;\n pseudoEl.counterProps = el.counterProps;\n el[pseudoElPropName] = pseudoEl;\n }\n el = pseudoEl;\n }\n\n if (!el.styleProps) {\n el.styleProps = {};\n\n // if the element has inline styles, fake selector with topmost specificity\n if ($(el).attr(styleAttributeName)) {\n var cssText = '* { ' + $(el).attr(styleAttributeName) + ' } ';\n addProps(utils.parseCSS(cssText)[0][1], new utils.Selector('`;\n }\n\n computeStyle() {\n // 计算需要append进富文本的style\n const mathStyle = this.getStyleFromSheets('mjx-container');\n const cherryStyle = this.getStyleFromSheets('cherry');\n const echartStyle =\n '';\n return {\n mathStyle,\n echartStyle,\n cherryStyle,\n };\n }\n\n /**\n * 由于复制操作会随着预览区域的内容增加而耗时变长,所以需要增加“正在复制”的状态回显\n * 同时该状态也用于限频\n */\n toggleLoading() {\n // 切换loading状态\n if (this.isLoading) {\n const loadingButton = document.querySelector('.icon-loading');\n loadingButton.outerHTML = '';\n } else {\n const copyButton = document.querySelector('.ch-icon-copy');\n copyButton.outerHTML = '
';\n }\n this.isLoading = !this.isLoading;\n }\n\n /**\n * 响应点击事件\n * 该按钮不会引发编辑区域的内容改动,所以不用处理用户在编辑区域的选中内容\n * @param {Event} e 点击事件\n */\n onClick(e) {\n this.toggleLoading();\n const inlineCodeTheme = document.querySelector('.cherry').getAttribute('data-inline-code-theme');\n const codeBlockTheme = document.querySelector('.cherry').getAttribute('data-code-block-theme');\n const { mathStyle, echartStyle, cherryStyle } = this.computeStyle();\n const html = this.previewer.isPreviewerHidden()\n ? this.previewer.options.previewerCache.html\n : this.previewer.getValue();\n // 将css样式以行内样式的形式插入到html内容里\n this.adaptWechat(html).then((html) => {\n copyToClip(\n juice(\n `
\n
${html}
\n
${mathStyle + echartStyle + cherryStyle}`,\n ),\n );\n this.toggleLoading();\n });\n }\n}\n\n/**\n * 将图片转成base64,防止出现由于图片防盗链功能导致图裂的情况\n * @param {string} url 图片的地址\n * @param {Function} [callback] 回调函数,本函数不处理该参数\n * @param {string} [outputFormat]\n * @returns {Promise} img node\n */\nfunction convertImgToBase64(url, callback, outputFormat) {\n return new Promise((resolve) => {\n let canvas = /** @type {HTMLCanvasElement}*/ (document.createElement('CANVAS'));\n const ctx = canvas.getContext('2d');\n const img = new Image();\n img.crossOrigin = 'Anonymous';\n img.onload = function () {\n canvas.height = img.height;\n canvas.width = img.width;\n ctx.drawImage(img, 0, 0);\n const dataURL = canvas.toDataURL(outputFormat || 'image/png');\n resolve(dataURL);\n canvas = null;\n };\n img.src = url;\n });\n}\n","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * 工具栏各个实例的注册中心\n */\nimport Bold from './hooks/Bold';\nimport Italic from './hooks/Italic';\nimport Split from './hooks/Split';\nimport Strikethrough from './hooks/Strikethrough';\nimport Sub from './hooks/Sub';\nimport Sup from './hooks/Sup';\nimport Color from './hooks/Color';\nimport Header from './hooks/Header';\nimport Insert from './hooks/Insert';\nimport List from './hooks/List';\nimport Graph from './hooks/Graph';\nimport Size from './hooks/Size';\nimport CheckList from './hooks/CheckList';\nimport H1 from './hooks/H1';\nimport H2 from './hooks/H2';\nimport H3 from './hooks/H3';\nimport Quote from './hooks/Quote';\nimport QuickTable from './hooks/QuickTable';\nimport TogglePreview from './hooks/TogglePreview';\nimport FullScreen from './hooks/FullScreen';\nimport Undo from './hooks/Undo';\nimport Redo from './hooks/Redo';\nimport Code from './hooks/Code';\nimport CodeTheme from './hooks/CodeTheme';\nimport Export from './hooks/Export';\nimport Settings from './hooks/Settings';\nimport Underline from './hooks/Underline';\nimport SwitchModel from './hooks/SwitchModel';\nimport Image from './hooks/Image';\nimport Audio from './hooks/Audio';\nimport Video from './hooks/Video';\nimport Br from './hooks/Br';\nimport Hr from './hooks/Hr';\nimport Formula from './hooks/Formula';\nimport Link from './hooks/Link';\nimport Table from './hooks/Table';\nimport Toc from './hooks/Toc';\nimport LineTable from './hooks/LineTable';\nimport BarTable from './hooks/BarTable';\nimport Pdf from './hooks/Pdf';\nimport Word from './hooks/Word';\nimport Ruby from './hooks/Ruby';\n// Sidebar\nimport MobilePreview from './hooks/MobilePreview';\nimport Copy from './hooks/Copy';\n\n// 定义默认支持的工具栏\n// 目前不支持按需动态加载\n// 如果对CherryMarkdown构建后的文件大小有比较严格的要求,可以根据实际情况删减hook\nconst HookList = {\n bold: Bold,\n italic: Italic,\n '|': Split,\n strikethrough: Strikethrough,\n sub: Sub,\n sup: Sup,\n header: Header,\n insert: Insert,\n list: List,\n graph: Graph,\n size: Size,\n checklist: CheckList,\n h1: H1,\n h2: H2,\n h3: H3,\n color: Color,\n quote: Quote,\n quickTable: QuickTable,\n togglePreview: TogglePreview,\n code: Code,\n codeTheme: CodeTheme,\n export: Export,\n settings: Settings,\n fullScreen: FullScreen,\n mobilePreview: MobilePreview,\n copy: Copy,\n undo: Undo,\n redo: Redo,\n underline: Underline,\n switchModel: SwitchModel,\n image: Image,\n audio: Audio,\n video: Video,\n br: Br,\n hr: Hr,\n formula: Formula,\n link: Link,\n table: Table,\n toc: Toc,\n lineTable: LineTable,\n barTable: BarTable,\n pdf: Pdf,\n word: Word,\n ruby: Ruby,\n};\n\nexport default class HookCenter {\n constructor(toolbar) {\n this.toolbar = toolbar;\n // 保存所有菜单实例\n this.hooks = {};\n // 所有注册的菜单名称\n this.allMenusName = [];\n // 一级菜单的名称\n this.level1MenusName = [];\n // 二级菜单的名称 {一级菜单名称: [二级菜单名称1, 二级菜单名称2]}\n this.level2MenusName = {};\n this.init();\n }\n\n $newMenu(name) {\n if (this.hooks[name]) {\n return;\n }\n const { $cherry, customMenu } = this.toolbar.options;\n if (HookList[name]) {\n this.allMenusName.push(name);\n this.hooks[name] = new HookList[name]($cherry);\n } else if (customMenu !== undefined && customMenu !== null && customMenu[name]) {\n this.allMenusName.push(name);\n // 如果是自定义菜单,传参兼容旧版\n this.hooks[name] = new customMenu[name]($cherry.editor, $cherry.engine, $cherry.toolbar, $cherry);\n }\n }\n\n /**\n * 根据配置动态渲染、绑定工具栏\n * @returns\n */\n init() {\n const { buttonConfig } = this.toolbar.options;\n buttonConfig.forEach((item) => {\n if (typeof item === 'string') {\n this.level1MenusName.push(item);\n this.$newMenu(item);\n } else if (typeof item === 'object') {\n const keys = Object.keys(item);\n if (keys.length === 1) {\n // 只接受形如{ name: [ subMenu ] }的参数\n const [name] = keys;\n this.level1MenusName.push(name);\n this.$newMenu(name);\n this.level2MenusName[name] = item[name];\n item[name].forEach((subItem) => {\n this.$newMenu(subItem);\n });\n }\n }\n });\n }\n}\n","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { mac } from 'codemirror/src/util/browser';\nimport HookCenter from './HookCenter';\nimport Event from '@/Event';\nimport { createElement } from '@/utils/dom';\n\nexport default class Toolbar {\n constructor(options) {\n // 存储所有菜单的实例\n this.menus = {};\n // 存储所有快捷键的影射 {快捷键: 菜单名称}\n this.shortcutKeyMap = {};\n // 存储所有二级菜单面板\n this.subMenus = {};\n // 默认的菜单配置\n this.options = {\n dom: document.createElement('div'),\n buttonConfig: ['bold'],\n customMenu: [],\n };\n\n Object.assign(this.options, options);\n this.$cherry = this.options.$cherry;\n this.instanceId = this.$cherry.instanceId;\n this.menus = new HookCenter(this);\n this.drawMenus();\n this.init();\n }\n\n init() {\n this.collectShortcutKey();\n Event.on(this.instanceId, Event.Events.cleanAllSubMenus, () => this.hidAlleSubMenu());\n }\n\n previewOnly() {\n this.options.dom.classList.add('preview-only');\n Event.emit(this.instanceId, Event.Events.toolbarHide);\n }\n\n showToolbar() {\n this.options.dom.classList.remove('preview-only');\n Event.emit(this.instanceId, Event.Events.toolbarShow);\n }\n\n isHasLevel2Menu(name) {\n return this.menus.level2MenusName[name];\n }\n\n isHasConfigMenu(name) {\n return this.menus.hooks[name].subMenuConfig || [];\n }\n\n /**\n * 判断是否有子菜单,目前有两种子菜单配置方式:1、通过`subMenuConfig`属性 2、通过`buttonConfig`配置属性\n * @param {String} name\n * @returns {boolean} 是否有子菜单\n */\n isHasSubMenu(name) {\n return this.isHasLevel2Menu(name) || this.isHasConfigMenu(name).length > 0;\n }\n\n /**\n * 根据配置画出来一级工具栏\n */\n drawMenus() {\n const frag = document.createDocumentFragment();\n this.menus.level1MenusName.forEach((name) => {\n const btn = this.menus.hooks[name].createBtn();\n btn.addEventListener(\n 'click',\n (event) => {\n this.onClick(event, name);\n },\n false,\n );\n if (this.isHasSubMenu(name)) {\n btn.classList.add('cherry-toolbar-dropdown');\n }\n frag.appendChild(btn);\n });\n this.options.dom.appendChild(frag);\n }\n\n drawSubMenus(name) {\n const menu = this.menus.hooks[name];\n const pos = menu.getMenuPosition();\n this.subMenus[name] = createElement('div', 'cherry-dropdown', { name });\n this.subMenus[name].style.left = `${pos.left + pos.width / 2}px`;\n this.subMenus[name].style.top = `${pos.top + pos.height}px`;\n this.subMenus[name].style.position = menu.positionModel;\n // 如果有配置的二级菜单\n const level2MenusName = this.isHasLevel2Menu(name);\n if (level2MenusName) {\n level2MenusName.forEach((level2Name) => {\n const subMenu = this.menus.hooks[level2Name];\n if (subMenu !== undefined && typeof subMenu.createBtn === 'function') {\n const btn = subMenu.createBtn(true);\n // 二级菜单的dom认定为一级菜单的\n subMenu.dom = subMenu.dom ? subMenu.dom : this.menus.hooks[name].dom;\n btn.addEventListener('click', (event) => this.onClick(event, level2Name, true), false);\n this.subMenus[name].appendChild(btn);\n }\n });\n }\n // 兼容旧版本配置的二级菜单\n const subMenuConfig = this.isHasConfigMenu(name);\n if (subMenuConfig.length > 0) {\n subMenuConfig.forEach((config) => {\n const btn = this.menus.hooks[name].createSubBtnByConfig(config);\n btn.addEventListener('click', () => this.hidAlleSubMenu(), false);\n this.subMenus[name].appendChild(btn);\n });\n }\n this.$cherry.wrapperDom.appendChild(this.subMenus[name]);\n }\n\n onClick(event, name, focusEvent = false) {\n const menu = this.menus.hooks[name];\n if (!menu) {\n return;\n }\n if (this.isHasSubMenu(name) && !focusEvent) {\n this.toggleSubMenu(name);\n } else {\n this.hidAlleSubMenu();\n menu.fire(event, name);\n }\n }\n\n toggleSubMenu(name) {\n if (this.subMenus[name]) {\n const test = this.subMenus[name].style.display;\n this.hidAlleSubMenu();\n this.subMenus[name].style.display = test === 'none' ? 'block' : 'none';\n } else {\n this.drawSubMenus(name);\n }\n }\n\n /**\n * 隐藏所有的二级菜单\n */\n hidAlleSubMenu() {\n this.$cherry.wrapperDom.querySelectorAll('.cherry-dropdown').forEach((dom) => {\n dom.style.display = 'none';\n });\n }\n\n /**\n * 收集快捷键\n */\n collectShortcutKey() {\n this.menus.allMenusName.forEach((name) => {\n this.menus.hooks[name].shortcutKeys?.forEach((key) => {\n this.shortcutKeyMap[key] = name;\n });\n });\n }\n\n /**\n * 监测是否有对应的快捷键\n * @param {KeyboardEvent} evt keydown 事件\n * @returns {boolean} 是否有对应的快捷键\n */\n matchShortcutKey(evt) {\n return !!this.shortcutKeyMap[this.getCurrentKey(evt)];\n }\n\n /**\n * 触发对应快捷键的事件\n * @param {KeyboardEvent} evt\n */\n fireShortcutKey(evt) {\n const currentKey = this.getCurrentKey(evt);\n this.menus.hooks[this.shortcutKeyMap[currentKey]]?.fire(evt, currentKey);\n }\n\n /**\n * 格式化当前按键,mac下的command按键转换为ctrl\n * @param {KeyboardEvent} event\n * @returns\n */\n getCurrentKey(event) {\n let key = '';\n if (event.ctrlKey) {\n key += 'Ctrl-';\n }\n\n if (event.altKey) {\n key += 'Alt-';\n }\n\n if (event.metaKey && mac) {\n key += 'Ctrl-';\n }\n\n // 如果存在shift键\n if (event.shiftKey) {\n key += `Shift-`;\n }\n\n // 如果还有第三个键 且不是 shift键\n if (event.key && event.key.toLowerCase() !== 'shift') {\n key += event.key.toLowerCase();\n }\n\n return key;\n }\n}\n","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport Toolbar from './Toolbar';\nimport Event from '@/Event';\n/**\n * 在编辑区域选中文本时浮现的bubble工具栏\n */\nexport default class Bubble extends Toolbar {\n /**\n * @type {'flex' | 'block'}\n */\n static displayType = 'flex';\n // constructor(options) {\n // super(options);\n // }\n\n set visible(visible) {\n const bubbleStyle = window.getComputedStyle(this.bubbleDom);\n if (visible) {\n bubbleStyle.display === 'none' && (this.bubbleDom.style.display = Bubble.displayType);\n // bubbleStyle.visibility !== 'visible' && (this.bubbleBottom.style.visibility = 'visible');\n } else {\n bubbleStyle.display !== 'none' && (this.bubbleDom.style.display = 'none');\n // bubbleStyle.visibility !== 'hidden' && (this.bubbleBottom.style.visibility = 'hidden');\n }\n }\n\n get visible() {\n const bubbleStyle = window.getComputedStyle(this.bubbleDom);\n return bubbleStyle.display !== 'none' && bubbleStyle.visibility !== 'hidden';\n }\n\n init() {\n this.options.editor = this.$cherry.editor;\n this.addSelectionChangeListener();\n this.bubbleDom = this.options.dom;\n this.editorDom = this.options.editor.getEditorDom();\n this.initBubbleDom();\n this.editorDom.querySelector('.CodeMirror').appendChild(this.bubbleDom);\n }\n\n /**\n * 计算编辑区域的偏移量\n * @returns {number} 编辑区域的滚动区域\n */\n getScrollTop() {\n return this.options.editor.editor.getScrollInfo().top;\n }\n\n /**\n * 当编辑区域滚动的时候自动隐藏bubble工具栏和子工具栏\n */\n updatePositionWhenScroll() {\n if (this.bubbleDom.style.display === Bubble.displayType) {\n this.bubbleDom.style.marginTop = `${parseFloat(this.bubbleDom.dataset.scrollTop) - this.getScrollTop()}px`;\n Event.emit(this.instanceId, Event.Events.cleanAllSubMenus);\n }\n }\n\n /**\n * 根据高度计算bubble工具栏出现的位置的高度\n * 根据宽度计算bubble工具栏出现的位置的left值,以及bubble工具栏三角箭头的left值\n * @param {number} top 高度\n * @param {number} width 选中文本内容的宽度\n */\n showBubble(top, width) {\n if (!this.visible) {\n this.visible = true;\n this.bubbleDom.style.marginTop = '0';\n this.bubbleDom.dataset.scrollTop = String(this.getScrollTop());\n }\n const positionLimit = this.editorDom.querySelector('.CodeMirror-lines').firstChild.getBoundingClientRect();\n const editorPosition = this.editorDom.getBoundingClientRect();\n const minLeft = positionLimit.left - editorPosition.left;\n const maxLeft = positionLimit.width + minLeft;\n const minTop = this.bubbleDom.offsetHeight * 2;\n let $top = top;\n if ($top < minTop) {\n // 如果高度小于编辑器的顶部,则让bubble工具栏出现在选中文本的下放\n $top += this.bubbleDom.offsetHeight - this.bubbleTop.getBoundingClientRect().height;\n this.bubbleTop.style.display = 'block';\n this.bubbleBottom.style.display = 'none';\n } else {\n // 反之出现在选中文本内容的上方\n $top -= this.bubbleDom.offsetHeight + 2 * this.bubbleBottom.getBoundingClientRect().height;\n this.bubbleTop.style.display = 'none';\n this.bubbleBottom.style.display = 'block';\n }\n this.bubbleDom.style.top = `${$top}px`;\n let left = width - this.bubbleDom.offsetWidth / 2;\n if (left < minLeft) {\n // 如果位置超过了编辑器的最左边,则控制bubble工具栏不超出编辑器最左边\n // 同时bubble工具栏上的箭头尽量指向选中文本内容的中间位置\n left = minLeft;\n this.$setBubbleCursorPosition(`${width - minLeft}px`);\n } else if (left + this.bubbleDom.offsetWidth > maxLeft) {\n // 如果位置超过了编辑器的最右边,则控制bubble工具栏不超出编辑器最右边\n // 同时bubble工具栏上的箭头尽量指向选中文本内容的中间位置\n left = maxLeft - this.bubbleDom.offsetWidth;\n this.$setBubbleCursorPosition(`${width - left}px`);\n } else {\n // 让bubble工具栏的箭头处于工具栏的中间位置\n this.$setBubbleCursorPosition('50%');\n }\n // 安全边距 20px\n this.bubbleDom.style.left = `${Math.max(20, left)}px`;\n }\n\n hideBubble() {\n this.visible = false;\n }\n\n /**\n * 控制bubble工具栏的箭头的位置\n * @param {string} left 左偏移量\n */\n $setBubbleCursorPosition(left = '50%') {\n if (left === '50%') {\n this.bubbleTop.style.left = '50%';\n this.bubbleBottom.style.left = '50%';\n } else {\n const $left = parseFloat(left) < 10 ? '10px' : left;\n this.bubbleTop.style.left = $left;\n this.bubbleBottom.style.left = $left;\n }\n }\n\n initBubbleDom() {\n const top = document.createElement('div');\n top.className = 'cherry-bubble-top';\n const bottom = document.createElement('div');\n bottom.className = 'cherry-bubble-bottom';\n this.bubbleTop = top;\n this.bubbleBottom = bottom;\n this.bubbleDom.appendChild(top);\n this.bubbleDom.appendChild(bottom);\n // 默认不可见\n this.visible = false;\n }\n\n getBubbleDom() {\n return this.bubbleDom;\n }\n\n addSelectionChangeListener() {\n this.options.editor.addListener('change', (codemirror) => {\n // 当编辑区内容变更时自动隐藏bubble工具栏\n this.hideBubble();\n Event.emit(this.instanceId, Event.Events.cleanAllSubMenus);\n });\n this.options.editor.addListener('refresh', (codemirror) => {\n // 当编辑区内容刷新时自动隐藏bubble工具栏\n this.hideBubble();\n Event.emit(this.instanceId, Event.Events.cleanAllSubMenus);\n });\n this.options.editor.addListener('scroll', (codemirror) => {\n // 当编辑区滚动时,需要实时同步bubble工具栏的位置\n this.updatePositionWhenScroll();\n });\n this.options.editor.addListener('beforeSelectionChange', (codemirror, info) => {\n // 当编辑区选中内容改变时,需要展示/隐藏bubble工具栏,并计算工具栏位置\n if (info.origin !== '*mouse' && (info.origin !== null || typeof info.origin === 'undefined')) {\n return true;\n }\n if (!info.ranges[0]) {\n return true;\n }\n const anchor = info.ranges[0].anchor.line * 1000000 + info.ranges[0].anchor.ch;\n const head = info.ranges[0].head.line * 1000000 + info.ranges[0].head.ch;\n let direction = 'asc';\n if (anchor > head) {\n direction = 'desc';\n }\n Event.emit(this.instanceId, Event.Events.cleanAllSubMenus);\n setTimeout(() => {\n const selections = codemirror.getSelections();\n if (selections.join('').length <= 0) {\n this.hideBubble();\n return;\n }\n const selectedObjs = codemirror.getWrapperElement().getElementsByClassName('CodeMirror-selected');\n const editorPosition = this.editorDom.getBoundingClientRect();\n let width = 0;\n let top = 0;\n if (typeof selectedObjs !== 'object' || selectedObjs.length <= 0) {\n this.hideBubble();\n return;\n }\n for (let key = 0; key < selectedObjs.length; key++) {\n const one = selectedObjs[key];\n const position = one.getBoundingClientRect();\n const targetTop = position.top - editorPosition.top;\n if (direction === 'asc') {\n if (targetTop >= top) {\n top = targetTop;\n width = position.left - editorPosition.left + position.width / 2;\n }\n } else {\n if (targetTop <= top || top <= 0) {\n top = targetTop;\n width = position.left - editorPosition.left + position.width / 2;\n }\n }\n }\n this.showBubble(top, width);\n }, 10);\n });\n }\n}\n","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport Toolbar from './Toolbar';\n/**\n * 当光标处于编辑器新行起始位置时出现的浮动工具栏\n */\nexport default class FloatMenu extends Toolbar {\n // constructor(options) {\n // super(options);\n // }\n\n init() {\n this.editor = this.$cherry.editor;\n this.editorDom = this.editor.getEditorDom();\n this.editorDom.querySelector('.CodeMirror-scroll').appendChild(this.options.dom);\n this.initAction();\n }\n\n initAction() {\n const self = this;\n this.editor.addListener('cursorActivity', (codemirror, evt) => {\n // 当编辑区光标位置改变时触发\n self.cursorActivity(evt, codemirror);\n });\n\n this.editor.addListener('update', (codemirror, evt) => {\n // 当编辑区内容改变时触发\n self.cursorActivity(evt, codemirror);\n });\n\n this.editor.addListener('refresh', (codemirror, evt) => {\n // 当编辑器刷新时触发\n setTimeout(() => {\n self.cursorActivity(evt, codemirror);\n }, 0);\n });\n }\n\n update(evt, codeMirror) {\n const pos = codeMirror.getCursor();\n if (this.isHidden(pos.line, codeMirror)) {\n this.options.dom.style.display = 'none';\n return false;\n }\n this.options.dom.style.display = 'inline-block';\n }\n\n /**\n * 当光标激活时触发,当光标处于行起始位置时展示float工具栏;反之隐藏\n * @param {Event} evt\n * @param {CodeMirror.Editor} codeMirror\n * @returns\n */\n cursorActivity(evt, codeMirror) {\n const pos = codeMirror.getCursor();\n const codeMirrorLines = document.querySelector('.cherry-editor .CodeMirror-lines');\n if (!codeMirrorLines) {\n return false;\n }\n const computedLinesStyle = getComputedStyle(codeMirrorLines);\n const codeWrapPaddingLeft = parseFloat(computedLinesStyle.paddingLeft);\n const codeWrapPaddingTop = parseFloat(computedLinesStyle.paddingTop);\n // const cursorHandle = codeMirror.getLineHandle(pos.line);\n // const verticalMiddle = cursorHandle.height * 1 / 2;\n\n if (this.isHidden(pos.line, codeMirror)) {\n this.options.dom.style.display = 'none';\n return false;\n }\n this.options.dom.style.display = 'inline-block';\n this.options.dom.style.left = `${codeWrapPaddingLeft}px`;\n this.options.dom.style.top = `${this.getLineHeight(pos.line, codeMirror) + codeWrapPaddingTop}px`;\n }\n\n /**\n * 判断是否需要隐藏Float工具栏\n * 有选中内容,或者光标所在行有内容时隐藏float 工具栏\n * @param {number} line\n * @param {CodeMirror.Editor} codeMirror\n * @returns {boolean} 是否需要隐藏float工具栏,true:需要隐藏\n */\n isHidden(line, codeMirror) {\n const selections = codeMirror.getSelections();\n if (selections.length > 1) {\n return true;\n }\n const selection = codeMirror.getSelection();\n if (selection.length > 0) {\n return true;\n }\n if (codeMirror.getLine(line)) {\n return true;\n }\n return false;\n }\n\n /**\n * 获取对应行的行高度,用来让float 工具栏在该行保持垂直居中\n * @param {number} line\n * @param {CodeMirror.Editor} codeMirror\n * @returns\n */\n getLineHeight(line, codeMirror) {\n let height = 0;\n codeMirror.getDoc().eachLine(0, line, (line) => {\n height += line.height;\n });\n\n return height;\n }\n}\n","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport Toolbar from './Toolbar';\n/**\n * 预览区域右侧悬浮的工具栏\n * 推荐放置跟编辑区域完全无关的工具栏\n * 比如复制预览区域内容、修改预览区域主题等\n */\nexport default class Sidebar extends Toolbar {\n // constructor(options) {\n // super(options);\n // }\n}\n","/**\r\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * 用于lodash.mergeWith的customizer\r\n * @param {any} objValue\r\n * @param {any} srcValue\r\n * @returns\r\n */\r\nexport function customizer(objValue, srcValue) {\r\n if (Array.isArray(srcValue)) {\r\n return srcValue;\r\n }\r\n}\r\n","/**\n * This library modifies the diff-patch-match library by Neil Fraser\n * by removing the patch and match functionality and certain advanced\n * options in the diff function. The original license is as follows:\n *\n * ===\n *\n * Diff Match and Patch\n *\n * Copyright 2006 Google Inc.\n * http://code.google.com/p/google-diff-match-patch/\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\n/**\n * The data structure representing a diff is an array of tuples:\n * [[DIFF_DELETE, 'Hello'], [DIFF_INSERT, 'Goodbye'], [DIFF_EQUAL, ' world.']]\n * which means: delete 'Hello', add 'Goodbye' and keep ' world.'\n */\nvar DIFF_DELETE = -1;\nvar DIFF_INSERT = 1;\nvar DIFF_EQUAL = 0;\n\n\n/**\n * Find the differences between two texts. Simplifies the problem by stripping\n * any common prefix or suffix off the texts before diffing.\n * @param {string} text1 Old string to be diffed.\n * @param {string} text2 New string to be diffed.\n * @param {Int|Object} [cursor_pos] Edit position in text1 or object with more info\n * @return {Array} Array of diff tuples.\n */\nfunction diff_main(text1, text2, cursor_pos, _fix_unicode) {\n // Check for equality\n if (text1 === text2) {\n if (text1) {\n return [[DIFF_EQUAL, text1]];\n }\n return [];\n }\n\n if (cursor_pos != null) {\n var editdiff = find_cursor_edit_diff(text1, text2, cursor_pos);\n if (editdiff) {\n return editdiff;\n }\n }\n\n // Trim off common prefix (speedup).\n var commonlength = diff_commonPrefix(text1, text2);\n var commonprefix = text1.substring(0, commonlength);\n text1 = text1.substring(commonlength);\n text2 = text2.substring(commonlength);\n\n // Trim off common suffix (speedup).\n commonlength = diff_commonSuffix(text1, text2);\n var commonsuffix = text1.substring(text1.length - commonlength);\n text1 = text1.substring(0, text1.length - commonlength);\n text2 = text2.substring(0, text2.length - commonlength);\n\n // Compute the diff on the middle block.\n var diffs = diff_compute_(text1, text2);\n\n // Restore the prefix and suffix.\n if (commonprefix) {\n diffs.unshift([DIFF_EQUAL, commonprefix]);\n }\n if (commonsuffix) {\n diffs.push([DIFF_EQUAL, commonsuffix]);\n }\n diff_cleanupMerge(diffs, _fix_unicode);\n return diffs;\n};\n\n\n/**\n * Find the differences between two texts. Assumes that the texts do not\n * have any common prefix or suffix.\n * @param {string} text1 Old string to be diffed.\n * @param {string} text2 New string to be diffed.\n * @return {Array} Array of diff tuples.\n */\nfunction diff_compute_(text1, text2) {\n var diffs;\n\n if (!text1) {\n // Just add some text (speedup).\n return [[DIFF_INSERT, text2]];\n }\n\n if (!text2) {\n // Just delete some text (speedup).\n return [[DIFF_DELETE, text1]];\n }\n\n var longtext = text1.length > text2.length ? text1 : text2;\n var shorttext = text1.length > text2.length ? text2 : text1;\n var i = longtext.indexOf(shorttext);\n if (i !== -1) {\n // Shorter text is inside the longer text (speedup).\n diffs = [\n [DIFF_INSERT, longtext.substring(0, i)],\n [DIFF_EQUAL, shorttext],\n [DIFF_INSERT, longtext.substring(i + shorttext.length)]\n ];\n // Swap insertions for deletions if diff is reversed.\n if (text1.length > text2.length) {\n diffs[0][0] = diffs[2][0] = DIFF_DELETE;\n }\n return diffs;\n }\n\n if (shorttext.length === 1) {\n // Single character string.\n // After the previous speedup, the character can't be an equality.\n return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]];\n }\n\n // Check to see if the problem can be split in two.\n var hm = diff_halfMatch_(text1, text2);\n if (hm) {\n // A half-match was found, sort out the return data.\n var text1_a = hm[0];\n var text1_b = hm[1];\n var text2_a = hm[2];\n var text2_b = hm[3];\n var mid_common = hm[4];\n // Send both pairs off for separate processing.\n var diffs_a = diff_main(text1_a, text2_a);\n var diffs_b = diff_main(text1_b, text2_b);\n // Merge the results.\n return diffs_a.concat([[DIFF_EQUAL, mid_common]], diffs_b);\n }\n\n return diff_bisect_(text1, text2);\n};\n\n\n/**\n * Find the 'middle snake' of a diff, split the problem in two\n * and return the recursively constructed diff.\n * See Myers 1986 paper: An O(ND) Difference Algorithm and Its Variations.\n * @param {string} text1 Old string to be diffed.\n * @param {string} text2 New string to be diffed.\n * @return {Array} Array of diff tuples.\n * @private\n */\nfunction diff_bisect_(text1, text2) {\n // Cache the text lengths to prevent multiple calls.\n var text1_length = text1.length;\n var text2_length = text2.length;\n var max_d = Math.ceil((text1_length + text2_length) / 2);\n var v_offset = max_d;\n var v_length = 2 * max_d;\n var v1 = new Array(v_length);\n var v2 = new Array(v_length);\n // Setting all elements to -1 is faster in Chrome & Firefox than mixing\n // integers and undefined.\n for (var x = 0; x < v_length; x++) {\n v1[x] = -1;\n v2[x] = -1;\n }\n v1[v_offset + 1] = 0;\n v2[v_offset + 1] = 0;\n var delta = text1_length - text2_length;\n // If the total number of characters is odd, then the front path will collide\n // with the reverse path.\n var front = (delta % 2 !== 0);\n // Offsets for start and end of k loop.\n // Prevents mapping of space beyond the grid.\n var k1start = 0;\n var k1end = 0;\n var k2start = 0;\n var k2end = 0;\n for (var d = 0; d < max_d; d++) {\n // Walk the front path one step.\n for (var k1 = -d + k1start; k1 <= d - k1end; k1 += 2) {\n var k1_offset = v_offset + k1;\n var x1;\n if (k1 === -d || (k1 !== d && v1[k1_offset - 1] < v1[k1_offset + 1])) {\n x1 = v1[k1_offset + 1];\n } else {\n x1 = v1[k1_offset - 1] + 1;\n }\n var y1 = x1 - k1;\n while (\n x1 < text1_length && y1 < text2_length &&\n text1.charAt(x1) === text2.charAt(y1)\n ) {\n x1++;\n y1++;\n }\n v1[k1_offset] = x1;\n if (x1 > text1_length) {\n // Ran off the right of the graph.\n k1end += 2;\n } else if (y1 > text2_length) {\n // Ran off the bottom of the graph.\n k1start += 2;\n } else if (front) {\n var k2_offset = v_offset + delta - k1;\n if (k2_offset >= 0 && k2_offset < v_length && v2[k2_offset] !== -1) {\n // Mirror x2 onto top-left coordinate system.\n var x2 = text1_length - v2[k2_offset];\n if (x1 >= x2) {\n // Overlap detected.\n return diff_bisectSplit_(text1, text2, x1, y1);\n }\n }\n }\n }\n\n // Walk the reverse path one step.\n for (var k2 = -d + k2start; k2 <= d - k2end; k2 += 2) {\n var k2_offset = v_offset + k2;\n var x2;\n if (k2 === -d || (k2 !== d && v2[k2_offset - 1] < v2[k2_offset + 1])) {\n x2 = v2[k2_offset + 1];\n } else {\n x2 = v2[k2_offset - 1] + 1;\n }\n var y2 = x2 - k2;\n while (\n x2 < text1_length && y2 < text2_length &&\n text1.charAt(text1_length - x2 - 1) === text2.charAt(text2_length - y2 - 1)\n ) {\n x2++;\n y2++;\n }\n v2[k2_offset] = x2;\n if (x2 > text1_length) {\n // Ran off the left of the graph.\n k2end += 2;\n } else if (y2 > text2_length) {\n // Ran off the top of the graph.\n k2start += 2;\n } else if (!front) {\n var k1_offset = v_offset + delta - k2;\n if (k1_offset >= 0 && k1_offset < v_length && v1[k1_offset] !== -1) {\n var x1 = v1[k1_offset];\n var y1 = v_offset + x1 - k1_offset;\n // Mirror x2 onto top-left coordinate system.\n x2 = text1_length - x2;\n if (x1 >= x2) {\n // Overlap detected.\n return diff_bisectSplit_(text1, text2, x1, y1);\n }\n }\n }\n }\n }\n // Diff took too long and hit the deadline or\n // number of diffs equals number of characters, no commonality at all.\n return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]];\n};\n\n\n/**\n * Given the location of the 'middle snake', split the diff in two parts\n * and recurse.\n * @param {string} text1 Old string to be diffed.\n * @param {string} text2 New string to be diffed.\n * @param {number} x Index of split point in text1.\n * @param {number} y Index of split point in text2.\n * @return {Array} Array of diff tuples.\n */\nfunction diff_bisectSplit_(text1, text2, x, y) {\n var text1a = text1.substring(0, x);\n var text2a = text2.substring(0, y);\n var text1b = text1.substring(x);\n var text2b = text2.substring(y);\n\n // Compute both diffs serially.\n var diffs = diff_main(text1a, text2a);\n var diffsb = diff_main(text1b, text2b);\n\n return diffs.concat(diffsb);\n};\n\n\n/**\n * Determine the common prefix of two strings.\n * @param {string} text1 First string.\n * @param {string} text2 Second string.\n * @return {number} The number of characters common to the start of each\n * string.\n */\nfunction diff_commonPrefix(text1, text2) {\n // Quick check for common null cases.\n if (!text1 || !text2 || text1.charAt(0) !== text2.charAt(0)) {\n return 0;\n }\n // Binary search.\n // Performance analysis: http://neil.fraser.name/news/2007/10/09/\n var pointermin = 0;\n var pointermax = Math.min(text1.length, text2.length);\n var pointermid = pointermax;\n var pointerstart = 0;\n while (pointermin < pointermid) {\n if (\n text1.substring(pointerstart, pointermid) ==\n text2.substring(pointerstart, pointermid)\n ) {\n pointermin = pointermid;\n pointerstart = pointermin;\n } else {\n pointermax = pointermid;\n }\n pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);\n }\n\n if (is_surrogate_pair_start(text1.charCodeAt(pointermid - 1))) {\n pointermid--;\n }\n\n return pointermid;\n};\n\n\n/**\n * Determine the common suffix of two strings.\n * @param {string} text1 First string.\n * @param {string} text2 Second string.\n * @return {number} The number of characters common to the end of each string.\n */\nfunction diff_commonSuffix(text1, text2) {\n // Quick check for common null cases.\n if (!text1 || !text2 || text1.slice(-1) !== text2.slice(-1)) {\n return 0;\n }\n // Binary search.\n // Performance analysis: http://neil.fraser.name/news/2007/10/09/\n var pointermin = 0;\n var pointermax = Math.min(text1.length, text2.length);\n var pointermid = pointermax;\n var pointerend = 0;\n while (pointermin < pointermid) {\n if (\n text1.substring(text1.length - pointermid, text1.length - pointerend) ==\n text2.substring(text2.length - pointermid, text2.length - pointerend)\n ) {\n pointermin = pointermid;\n pointerend = pointermin;\n } else {\n pointermax = pointermid;\n }\n pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);\n }\n\n if (is_surrogate_pair_end(text1.charCodeAt(text1.length - pointermid))) {\n pointermid--;\n }\n\n return pointermid;\n};\n\n\n/**\n * Do the two texts share a substring which is at least half the length of the\n * longer text?\n * This speedup can produce non-minimal diffs.\n * @param {string} text1 First string.\n * @param {string} text2 Second string.\n * @return {Array.} Five element Array, containing the prefix of\n * text1, the suffix of text1, the prefix of text2, the suffix of\n * text2 and the common middle. Or null if there was no match.\n */\nfunction diff_halfMatch_(text1, text2) {\n var longtext = text1.length > text2.length ? text1 : text2;\n var shorttext = text1.length > text2.length ? text2 : text1;\n if (longtext.length < 4 || shorttext.length * 2 < longtext.length) {\n return null; // Pointless.\n }\n\n /**\n * Does a substring of shorttext exist within longtext such that the substring\n * is at least half the length of longtext?\n * Closure, but does not reference any external variables.\n * @param {string} longtext Longer string.\n * @param {string} shorttext Shorter string.\n * @param {number} i Start index of quarter length substring within longtext.\n * @return {Array.} Five element Array, containing the prefix of\n * longtext, the suffix of longtext, the prefix of shorttext, the suffix\n * of shorttext and the common middle. Or null if there was no match.\n * @private\n */\n function diff_halfMatchI_(longtext, shorttext, i) {\n // Start with a 1/4 length substring at position i as a seed.\n var seed = longtext.substring(i, i + Math.floor(longtext.length / 4));\n var j = -1;\n var best_common = '';\n var best_longtext_a, best_longtext_b, best_shorttext_a, best_shorttext_b;\n while ((j = shorttext.indexOf(seed, j + 1)) !== -1) {\n var prefixLength = diff_commonPrefix(\n longtext.substring(i), shorttext.substring(j));\n var suffixLength = diff_commonSuffix(\n longtext.substring(0, i), shorttext.substring(0, j));\n if (best_common.length < suffixLength + prefixLength) {\n best_common = shorttext.substring(\n j - suffixLength, j) + shorttext.substring(j, j + prefixLength);\n best_longtext_a = longtext.substring(0, i - suffixLength);\n best_longtext_b = longtext.substring(i + prefixLength);\n best_shorttext_a = shorttext.substring(0, j - suffixLength);\n best_shorttext_b = shorttext.substring(j + prefixLength);\n }\n }\n if (best_common.length * 2 >= longtext.length) {\n return [\n best_longtext_a, best_longtext_b,\n best_shorttext_a, best_shorttext_b, best_common\n ];\n } else {\n return null;\n }\n }\n\n // First check if the second quarter is the seed for a half-match.\n var hm1 = diff_halfMatchI_(longtext, shorttext, Math.ceil(longtext.length / 4));\n // Check again based on the third quarter.\n var hm2 = diff_halfMatchI_(longtext, shorttext, Math.ceil(longtext.length / 2));\n var hm;\n if (!hm1 && !hm2) {\n return null;\n } else if (!hm2) {\n hm = hm1;\n } else if (!hm1) {\n hm = hm2;\n } else {\n // Both matched. Select the longest.\n hm = hm1[4].length > hm2[4].length ? hm1 : hm2;\n }\n\n // A half-match was found, sort out the return data.\n var text1_a, text1_b, text2_a, text2_b;\n if (text1.length > text2.length) {\n text1_a = hm[0];\n text1_b = hm[1];\n text2_a = hm[2];\n text2_b = hm[3];\n } else {\n text2_a = hm[0];\n text2_b = hm[1];\n text1_a = hm[2];\n text1_b = hm[3];\n }\n var mid_common = hm[4];\n return [text1_a, text1_b, text2_a, text2_b, mid_common];\n};\n\n\n/**\n * Reorder and merge like edit sections. Merge equalities.\n * Any edit section can move as long as it doesn't cross an equality.\n * @param {Array} diffs Array of diff tuples.\n * @param {boolean} fix_unicode Whether to normalize to a unicode-correct diff\n */\nfunction diff_cleanupMerge(diffs, fix_unicode) {\n diffs.push([DIFF_EQUAL, '']); // Add a dummy entry at the end.\n var pointer = 0;\n var count_delete = 0;\n var count_insert = 0;\n var text_delete = '';\n var text_insert = '';\n var commonlength;\n while (pointer < diffs.length) {\n if (pointer < diffs.length - 1 && !diffs[pointer][1]) {\n diffs.splice(pointer, 1);\n continue;\n }\n switch (diffs[pointer][0]) {\n case DIFF_INSERT:\n\n count_insert++;\n text_insert += diffs[pointer][1];\n pointer++;\n break;\n case DIFF_DELETE:\n count_delete++;\n text_delete += diffs[pointer][1];\n pointer++;\n break;\n case DIFF_EQUAL:\n var previous_equality = pointer - count_insert - count_delete - 1;\n if (fix_unicode) {\n // prevent splitting of unicode surrogate pairs. when fix_unicode is true,\n // we assume that the old and new text in the diff are complete and correct\n // unicode-encoded JS strings, but the tuple boundaries may fall between\n // surrogate pairs. we fix this by shaving off stray surrogates from the end\n // of the previous equality and the beginning of this equality. this may create\n // empty equalities or a common prefix or suffix. for example, if AB and AC are\n // emojis, `[[0, 'A'], [-1, 'BA'], [0, 'C']]` would turn into deleting 'ABAC' and\n // inserting 'AC', and then the common suffix 'AC' will be eliminated. in this\n // particular case, both equalities go away, we absorb any previous inequalities,\n // and we keep scanning for the next equality before rewriting the tuples.\n if (previous_equality >= 0 && ends_with_pair_start(diffs[previous_equality][1])) {\n var stray = diffs[previous_equality][1].slice(-1);\n diffs[previous_equality][1] = diffs[previous_equality][1].slice(0, -1);\n text_delete = stray + text_delete;\n text_insert = stray + text_insert;\n if (!diffs[previous_equality][1]) {\n // emptied out previous equality, so delete it and include previous delete/insert\n diffs.splice(previous_equality, 1);\n pointer--;\n var k = previous_equality - 1;\n if (diffs[k] && diffs[k][0] === DIFF_INSERT) {\n count_insert++;\n text_insert = diffs[k][1] + text_insert;\n k--;\n }\n if (diffs[k] && diffs[k][0] === DIFF_DELETE) {\n count_delete++;\n text_delete = diffs[k][1] + text_delete;\n k--;\n }\n previous_equality = k;\n }\n }\n if (starts_with_pair_end(diffs[pointer][1])) {\n var stray = diffs[pointer][1].charAt(0);\n diffs[pointer][1] = diffs[pointer][1].slice(1);\n text_delete += stray;\n text_insert += stray;\n }\n }\n if (pointer < diffs.length - 1 && !diffs[pointer][1]) {\n // for empty equality not at end, wait for next equality\n diffs.splice(pointer, 1);\n break;\n }\n if (text_delete.length > 0 || text_insert.length > 0) {\n // note that diff_commonPrefix and diff_commonSuffix are unicode-aware\n if (text_delete.length > 0 && text_insert.length > 0) {\n // Factor out any common prefixes.\n commonlength = diff_commonPrefix(text_insert, text_delete);\n if (commonlength !== 0) {\n if (previous_equality >= 0) {\n diffs[previous_equality][1] += text_insert.substring(0, commonlength);\n } else {\n diffs.splice(0, 0, [DIFF_EQUAL, text_insert.substring(0, commonlength)]);\n pointer++;\n }\n text_insert = text_insert.substring(commonlength);\n text_delete = text_delete.substring(commonlength);\n }\n // Factor out any common suffixes.\n commonlength = diff_commonSuffix(text_insert, text_delete);\n if (commonlength !== 0) {\n diffs[pointer][1] =\n text_insert.substring(text_insert.length - commonlength) + diffs[pointer][1];\n text_insert = text_insert.substring(0, text_insert.length - commonlength);\n text_delete = text_delete.substring(0, text_delete.length - commonlength);\n }\n }\n // Delete the offending records and add the merged ones.\n var n = count_insert + count_delete;\n if (text_delete.length === 0 && text_insert.length === 0) {\n diffs.splice(pointer - n, n);\n pointer = pointer - n;\n } else if (text_delete.length === 0) {\n diffs.splice(pointer - n, n, [DIFF_INSERT, text_insert]);\n pointer = pointer - n + 1;\n } else if (text_insert.length === 0) {\n diffs.splice(pointer - n, n, [DIFF_DELETE, text_delete]);\n pointer = pointer - n + 1;\n } else {\n diffs.splice(pointer - n, n, [DIFF_DELETE, text_delete], [DIFF_INSERT, text_insert]);\n pointer = pointer - n + 2;\n }\n }\n if (pointer !== 0 && diffs[pointer - 1][0] === DIFF_EQUAL) {\n // Merge this equality with the previous one.\n diffs[pointer - 1][1] += diffs[pointer][1];\n diffs.splice(pointer, 1);\n } else {\n pointer++;\n }\n count_insert = 0;\n count_delete = 0;\n text_delete = '';\n text_insert = '';\n break;\n }\n }\n if (diffs[diffs.length - 1][1] === '') {\n diffs.pop(); // Remove the dummy entry at the end.\n }\n\n // Second pass: look for single edits surrounded on both sides by equalities\n // which can be shifted sideways to eliminate an equality.\n // e.g: ABAC -> ABAC\n var changes = false;\n pointer = 1;\n // Intentionally ignore the first and last element (don't need checking).\n while (pointer < diffs.length - 1) {\n if (diffs[pointer - 1][0] === DIFF_EQUAL &&\n diffs[pointer + 1][0] === DIFF_EQUAL) {\n // This is a single edit surrounded by equalities.\n if (diffs[pointer][1].substring(diffs[pointer][1].length -\n diffs[pointer - 1][1].length) === diffs[pointer - 1][1]) {\n // Shift the edit over the previous equality.\n diffs[pointer][1] = diffs[pointer - 1][1] +\n diffs[pointer][1].substring(0, diffs[pointer][1].length -\n diffs[pointer - 1][1].length);\n diffs[pointer + 1][1] = diffs[pointer - 1][1] + diffs[pointer + 1][1];\n diffs.splice(pointer - 1, 1);\n changes = true;\n } else if (diffs[pointer][1].substring(0, diffs[pointer + 1][1].length) ==\n diffs[pointer + 1][1]) {\n // Shift the edit over the next equality.\n diffs[pointer - 1][1] += diffs[pointer + 1][1];\n diffs[pointer][1] =\n diffs[pointer][1].substring(diffs[pointer + 1][1].length) +\n diffs[pointer + 1][1];\n diffs.splice(pointer + 1, 1);\n changes = true;\n }\n }\n pointer++;\n }\n // If shifts were made, the diff needs reordering and another shift sweep.\n if (changes) {\n diff_cleanupMerge(diffs, fix_unicode);\n }\n};\n\nfunction is_surrogate_pair_start(charCode) {\n return charCode >= 0xD800 && charCode <= 0xDBFF;\n}\n\nfunction is_surrogate_pair_end(charCode) {\n return charCode >= 0xDC00 && charCode <= 0xDFFF;\n}\n\nfunction starts_with_pair_end(str) {\n return is_surrogate_pair_end(str.charCodeAt(0));\n}\n\nfunction ends_with_pair_start(str) {\n return is_surrogate_pair_start(str.charCodeAt(str.length - 1));\n}\n\nfunction remove_empty_tuples(tuples) {\n var ret = [];\n for (var i = 0; i < tuples.length; i++) {\n if (tuples[i][1].length > 0) {\n ret.push(tuples[i]);\n }\n }\n return ret;\n}\n\nfunction make_edit_splice(before, oldMiddle, newMiddle, after) {\n if (ends_with_pair_start(before) || starts_with_pair_end(after)) {\n return null;\n }\n return remove_empty_tuples([\n [DIFF_EQUAL, before],\n [DIFF_DELETE, oldMiddle],\n [DIFF_INSERT, newMiddle],\n [DIFF_EQUAL, after]\n ]);\n}\n\nfunction find_cursor_edit_diff(oldText, newText, cursor_pos) {\n // note: this runs after equality check has ruled out exact equality\n var oldRange = typeof cursor_pos === 'number' ?\n { index: cursor_pos, length: 0 } : cursor_pos.oldRange;\n var newRange = typeof cursor_pos === 'number' ?\n null : cursor_pos.newRange;\n // take into account the old and new selection to generate the best diff\n // possible for a text edit. for example, a text change from \"xxx\" to \"xx\"\n // could be a delete or forwards-delete of any one of the x's, or the\n // result of selecting two of the x's and typing \"x\".\n var oldLength = oldText.length;\n var newLength = newText.length;\n if (oldRange.length === 0 && (newRange === null || newRange.length === 0)) {\n // see if we have an insert or delete before or after cursor\n var oldCursor = oldRange.index;\n var oldBefore = oldText.slice(0, oldCursor);\n var oldAfter = oldText.slice(oldCursor);\n var maybeNewCursor = newRange ? newRange.index : null;\n editBefore: {\n // is this an insert or delete right before oldCursor?\n var newCursor = oldCursor + newLength - oldLength;\n if (maybeNewCursor !== null && maybeNewCursor !== newCursor) {\n break editBefore;\n }\n if (newCursor < 0 || newCursor > newLength) {\n break editBefore;\n }\n var newBefore = newText.slice(0, newCursor);\n var newAfter = newText.slice(newCursor);\n if (newAfter !== oldAfter) {\n break editBefore;\n }\n var prefixLength = Math.min(oldCursor, newCursor);\n var oldPrefix = oldBefore.slice(0, prefixLength);\n var newPrefix = newBefore.slice(0, prefixLength);\n if (oldPrefix !== newPrefix) {\n break editBefore;\n }\n var oldMiddle = oldBefore.slice(prefixLength);\n var newMiddle = newBefore.slice(prefixLength);\n return make_edit_splice(oldPrefix, oldMiddle, newMiddle, oldAfter);\n }\n editAfter: {\n // is this an insert or delete right after oldCursor?\n if (maybeNewCursor !== null && maybeNewCursor !== oldCursor) {\n break editAfter;\n }\n var cursor = oldCursor;\n var newBefore = newText.slice(0, cursor);\n var newAfter = newText.slice(cursor);\n if (newBefore !== oldBefore) {\n break editAfter;\n }\n var suffixLength = Math.min(oldLength - cursor, newLength - cursor);\n var oldSuffix = oldAfter.slice(oldAfter.length - suffixLength);\n var newSuffix = newAfter.slice(newAfter.length - suffixLength);\n if (oldSuffix !== newSuffix) {\n break editAfter;\n }\n var oldMiddle = oldAfter.slice(0, oldAfter.length - suffixLength);\n var newMiddle = newAfter.slice(0, newAfter.length - suffixLength);\n return make_edit_splice(oldBefore, oldMiddle, newMiddle, oldSuffix);\n }\n }\n if (oldRange.length > 0 && newRange && newRange.length === 0) {\n replaceRange: {\n // see if diff could be a splice of the old selection range\n var oldPrefix = oldText.slice(0, oldRange.index);\n var oldSuffix = oldText.slice(oldRange.index + oldRange.length);\n var prefixLength = oldPrefix.length;\n var suffixLength = oldSuffix.length;\n if (newLength < prefixLength + suffixLength) {\n break replaceRange;\n }\n var newPrefix = newText.slice(0, prefixLength);\n var newSuffix = newText.slice(newLength - suffixLength);\n if (oldPrefix !== newPrefix || oldSuffix !== newSuffix) {\n break replaceRange;\n }\n var oldMiddle = oldText.slice(prefixLength, oldLength - suffixLength);\n var newMiddle = newText.slice(prefixLength, newLength - suffixLength);\n return make_edit_splice(oldPrefix, oldMiddle, newMiddle, oldSuffix);\n }\n }\n\n return null;\n}\n\nfunction diff(text1, text2, cursor_pos) {\n // only pass fix_unicode=true at the top level, not when diff_main is\n // recursively invoked\n return diff_main(text1, text2, cursor_pos, true);\n}\n\ndiff.INSERT = DIFF_INSERT;\ndiff.DELETE = DIFF_DELETE;\ndiff.EQUAL = DIFF_EQUAL;\n\nmodule.exports = diff;\n","/**\r\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\nimport diff from 'fast-diff';\r\n/**\r\n * 更新内容时保持光标不变\r\n * @param {Number} pos 光标相对文档开头的偏移量\r\n * @param {String} oldContent 变更前的内容\r\n * @param {String} newContent 变更后的内容\r\n * @returns {Number} newPos 新的光标偏移量\r\n */\r\nexport default function getPosBydiffs(pos, oldContent, newContent) {\r\n const diffs = diff(oldContent, newContent);\r\n let newPos = pos;\r\n let tmpPos = pos;\r\n for (let i = 0; i < diffs.length; i++) {\r\n const val = diffs[i];\r\n if (tmpPos <= 0) {\r\n return newPos;\r\n }\r\n const opType = val[0];\r\n const opLength = val[1].length;\r\n switch (opType) {\r\n // 没有改变的内容\r\n case diff.EQUAL:\r\n if (tmpPos <= opLength) {\r\n return newPos;\r\n }\r\n tmpPos -= opLength;\r\n break;\r\n // 删除的内容\r\n case diff.DELETE:\r\n if (tmpPos <= opLength) {\r\n return newPos - opLength + tmpPos;\r\n }\r\n tmpPos -= opLength;\r\n newPos -= opLength;\r\n break;\r\n // 新增的内容\r\n case diff.INSERT:\r\n newPos += opLength;\r\n break;\r\n }\r\n }\r\n return newPos;\r\n}\r\n","/**\n * A specialized version of `_.forEach` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns `array`.\n */\nfunction arrayEach(array, iteratee) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (iteratee(array[index], index, array) === false) {\n break;\n }\n }\n return array;\n}\n\nmodule.exports = arrayEach;\n","var overArg = require('./_overArg');\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeKeys = overArg(Object.keys, Object);\n\nmodule.exports = nativeKeys;\n","var isPrototype = require('./_isPrototype'),\n nativeKeys = require('./_nativeKeys');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeys(object) {\n if (!isPrototype(object)) {\n return nativeKeys(object);\n }\n var result = [];\n for (var key in Object(object)) {\n if (hasOwnProperty.call(object, key) && key != 'constructor') {\n result.push(key);\n }\n }\n return result;\n}\n\nmodule.exports = baseKeys;\n","var arrayLikeKeys = require('./_arrayLikeKeys'),\n baseKeys = require('./_baseKeys'),\n isArrayLike = require('./isArrayLike');\n\n/**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\nfunction keys(object) {\n return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);\n}\n\nmodule.exports = keys;\n","var copyObject = require('./_copyObject'),\n keys = require('./keys');\n\n/**\n * The base implementation of `_.assign` without support for multiple sources\n * or `customizer` functions.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @returns {Object} Returns `object`.\n */\nfunction baseAssign(object, source) {\n return object && copyObject(source, keys(source), object);\n}\n\nmodule.exports = baseAssign;\n","var copyObject = require('./_copyObject'),\n keysIn = require('./keysIn');\n\n/**\n * The base implementation of `_.assignIn` without support for multiple sources\n * or `customizer` functions.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @returns {Object} Returns `object`.\n */\nfunction baseAssignIn(object, source) {\n return object && copyObject(source, keysIn(source), object);\n}\n\nmodule.exports = baseAssignIn;\n","/**\n * A specialized version of `_.filter` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n */\nfunction arrayFilter(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length,\n resIndex = 0,\n result = [];\n\n while (++index < length) {\n var value = array[index];\n if (predicate(value, index, array)) {\n result[resIndex++] = value;\n }\n }\n return result;\n}\n\nmodule.exports = arrayFilter;\n","/**\n * This method returns a new empty array.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {Array} Returns the new empty array.\n * @example\n *\n * var arrays = _.times(2, _.stubArray);\n *\n * console.log(arrays);\n * // => [[], []]\n *\n * console.log(arrays[0] === arrays[1]);\n * // => false\n */\nfunction stubArray() {\n return [];\n}\n\nmodule.exports = stubArray;\n","var arrayFilter = require('./_arrayFilter'),\n stubArray = require('./stubArray');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Built-in value references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeGetSymbols = Object.getOwnPropertySymbols;\n\n/**\n * Creates an array of the own enumerable symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of symbols.\n */\nvar getSymbols = !nativeGetSymbols ? stubArray : function(object) {\n if (object == null) {\n return [];\n }\n object = Object(object);\n return arrayFilter(nativeGetSymbols(object), function(symbol) {\n return propertyIsEnumerable.call(object, symbol);\n });\n};\n\nmodule.exports = getSymbols;\n","var copyObject = require('./_copyObject'),\n getSymbols = require('./_getSymbols');\n\n/**\n * Copies own symbols of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy symbols from.\n * @param {Object} [object={}] The object to copy symbols to.\n * @returns {Object} Returns `object`.\n */\nfunction copySymbols(source, object) {\n return copyObject(source, getSymbols(source), object);\n}\n\nmodule.exports = copySymbols;\n","/**\n * Appends the elements of `values` to `array`.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {Array} values The values to append.\n * @returns {Array} Returns `array`.\n */\nfunction arrayPush(array, values) {\n var index = -1,\n length = values.length,\n offset = array.length;\n\n while (++index < length) {\n array[offset + index] = values[index];\n }\n return array;\n}\n\nmodule.exports = arrayPush;\n","var arrayPush = require('./_arrayPush'),\n getPrototype = require('./_getPrototype'),\n getSymbols = require('./_getSymbols'),\n stubArray = require('./stubArray');\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeGetSymbols = Object.getOwnPropertySymbols;\n\n/**\n * Creates an array of the own and inherited enumerable symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of symbols.\n */\nvar getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {\n var result = [];\n while (object) {\n arrayPush(result, getSymbols(object));\n object = getPrototype(object);\n }\n return result;\n};\n\nmodule.exports = getSymbolsIn;\n","var copyObject = require('./_copyObject'),\n getSymbolsIn = require('./_getSymbolsIn');\n\n/**\n * Copies own and inherited symbols of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy symbols from.\n * @param {Object} [object={}] The object to copy symbols to.\n * @returns {Object} Returns `object`.\n */\nfunction copySymbolsIn(source, object) {\n return copyObject(source, getSymbolsIn(source), object);\n}\n\nmodule.exports = copySymbolsIn;\n","var arrayPush = require('./_arrayPush'),\n isArray = require('./isArray');\n\n/**\n * The base implementation of `getAllKeys` and `getAllKeysIn` which uses\n * `keysFunc` and `symbolsFunc` to get the enumerable property names and\n * symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @param {Function} symbolsFunc The function to get the symbols of `object`.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction baseGetAllKeys(object, keysFunc, symbolsFunc) {\n var result = keysFunc(object);\n return isArray(object) ? result : arrayPush(result, symbolsFunc(object));\n}\n\nmodule.exports = baseGetAllKeys;\n","var baseGetAllKeys = require('./_baseGetAllKeys'),\n getSymbols = require('./_getSymbols'),\n keys = require('./keys');\n\n/**\n * Creates an array of own enumerable property names and symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction getAllKeys(object) {\n return baseGetAllKeys(object, keys, getSymbols);\n}\n\nmodule.exports = getAllKeys;\n","var baseGetAllKeys = require('./_baseGetAllKeys'),\n getSymbolsIn = require('./_getSymbolsIn'),\n keysIn = require('./keysIn');\n\n/**\n * Creates an array of own and inherited enumerable property names and\n * symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction getAllKeysIn(object) {\n return baseGetAllKeys(object, keysIn, getSymbolsIn);\n}\n\nmodule.exports = getAllKeysIn;\n","var getNative = require('./_getNative'),\n root = require('./_root');\n\n/* Built-in method references that are verified to be native. */\nvar DataView = getNative(root, 'DataView');\n\nmodule.exports = DataView;\n","var getNative = require('./_getNative'),\n root = require('./_root');\n\n/* Built-in method references that are verified to be native. */\nvar Promise = getNative(root, 'Promise');\n\nmodule.exports = Promise;\n","var getNative = require('./_getNative'),\n root = require('./_root');\n\n/* Built-in method references that are verified to be native. */\nvar Set = getNative(root, 'Set');\n\nmodule.exports = Set;\n","var getNative = require('./_getNative'),\n root = require('./_root');\n\n/* Built-in method references that are verified to be native. */\nvar WeakMap = getNative(root, 'WeakMap');\n\nmodule.exports = WeakMap;\n","var DataView = require('./_DataView'),\n Map = require('./_Map'),\n Promise = require('./_Promise'),\n Set = require('./_Set'),\n WeakMap = require('./_WeakMap'),\n baseGetTag = require('./_baseGetTag'),\n toSource = require('./_toSource');\n\n/** `Object#toString` result references. */\nvar mapTag = '[object Map]',\n objectTag = '[object Object]',\n promiseTag = '[object Promise]',\n setTag = '[object Set]',\n weakMapTag = '[object WeakMap]';\n\nvar dataViewTag = '[object DataView]';\n\n/** Used to detect maps, sets, and weakmaps. */\nvar dataViewCtorString = toSource(DataView),\n mapCtorString = toSource(Map),\n promiseCtorString = toSource(Promise),\n setCtorString = toSource(Set),\n weakMapCtorString = toSource(WeakMap);\n\n/**\n * Gets the `toStringTag` of `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nvar getTag = baseGetTag;\n\n// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.\nif ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||\n (Map && getTag(new Map) != mapTag) ||\n (Promise && getTag(Promise.resolve()) != promiseTag) ||\n (Set && getTag(new Set) != setTag) ||\n (WeakMap && getTag(new WeakMap) != weakMapTag)) {\n getTag = function(value) {\n var result = baseGetTag(value),\n Ctor = result == objectTag ? value.constructor : undefined,\n ctorString = Ctor ? toSource(Ctor) : '';\n\n if (ctorString) {\n switch (ctorString) {\n case dataViewCtorString: return dataViewTag;\n case mapCtorString: return mapTag;\n case promiseCtorString: return promiseTag;\n case setCtorString: return setTag;\n case weakMapCtorString: return weakMapTag;\n }\n }\n return result;\n };\n}\n\nmodule.exports = getTag;\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Initializes an array clone.\n *\n * @private\n * @param {Array} array The array to clone.\n * @returns {Array} Returns the initialized clone.\n */\nfunction initCloneArray(array) {\n var length = array.length,\n result = new array.constructor(length);\n\n // Add properties assigned by `RegExp#exec`.\n if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {\n result.index = array.index;\n result.input = array.input;\n }\n return result;\n}\n\nmodule.exports = initCloneArray;\n","var cloneArrayBuffer = require('./_cloneArrayBuffer');\n\n/**\n * Creates a clone of `dataView`.\n *\n * @private\n * @param {Object} dataView The data view to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned data view.\n */\nfunction cloneDataView(dataView, isDeep) {\n var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;\n return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);\n}\n\nmodule.exports = cloneDataView;\n","/** Used to match `RegExp` flags from their coerced string values. */\nvar reFlags = /\\w*$/;\n\n/**\n * Creates a clone of `regexp`.\n *\n * @private\n * @param {Object} regexp The regexp to clone.\n * @returns {Object} Returns the cloned regexp.\n */\nfunction cloneRegExp(regexp) {\n var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));\n result.lastIndex = regexp.lastIndex;\n return result;\n}\n\nmodule.exports = cloneRegExp;\n","var Symbol = require('./_Symbol');\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;\n\n/**\n * Creates a clone of the `symbol` object.\n *\n * @private\n * @param {Object} symbol The symbol object to clone.\n * @returns {Object} Returns the cloned symbol object.\n */\nfunction cloneSymbol(symbol) {\n return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};\n}\n\nmodule.exports = cloneSymbol;\n","var cloneArrayBuffer = require('./_cloneArrayBuffer'),\n cloneDataView = require('./_cloneDataView'),\n cloneRegExp = require('./_cloneRegExp'),\n cloneSymbol = require('./_cloneSymbol'),\n cloneTypedArray = require('./_cloneTypedArray');\n\n/** `Object#toString` result references. */\nvar boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n symbolTag = '[object Symbol]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/**\n * Initializes an object clone based on its `toStringTag`.\n *\n * **Note:** This function only supports cloning values with tags of\n * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.\n *\n * @private\n * @param {Object} object The object to clone.\n * @param {string} tag The `toStringTag` of the object to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the initialized clone.\n */\nfunction initCloneByTag(object, tag, isDeep) {\n var Ctor = object.constructor;\n switch (tag) {\n case arrayBufferTag:\n return cloneArrayBuffer(object);\n\n case boolTag:\n case dateTag:\n return new Ctor(+object);\n\n case dataViewTag:\n return cloneDataView(object, isDeep);\n\n case float32Tag: case float64Tag:\n case int8Tag: case int16Tag: case int32Tag:\n case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:\n return cloneTypedArray(object, isDeep);\n\n case mapTag:\n return new Ctor;\n\n case numberTag:\n case stringTag:\n return new Ctor(object);\n\n case regexpTag:\n return cloneRegExp(object);\n\n case setTag:\n return new Ctor;\n\n case symbolTag:\n return cloneSymbol(object);\n }\n}\n\nmodule.exports = initCloneByTag;\n","var getTag = require('./_getTag'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar mapTag = '[object Map]';\n\n/**\n * The base implementation of `_.isMap` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a map, else `false`.\n */\nfunction baseIsMap(value) {\n return isObjectLike(value) && getTag(value) == mapTag;\n}\n\nmodule.exports = baseIsMap;\n","var baseIsMap = require('./_baseIsMap'),\n baseUnary = require('./_baseUnary'),\n nodeUtil = require('./_nodeUtil');\n\n/* Node.js helper references. */\nvar nodeIsMap = nodeUtil && nodeUtil.isMap;\n\n/**\n * Checks if `value` is classified as a `Map` object.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a map, else `false`.\n * @example\n *\n * _.isMap(new Map);\n * // => true\n *\n * _.isMap(new WeakMap);\n * // => false\n */\nvar isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;\n\nmodule.exports = isMap;\n","var getTag = require('./_getTag'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar setTag = '[object Set]';\n\n/**\n * The base implementation of `_.isSet` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a set, else `false`.\n */\nfunction baseIsSet(value) {\n return isObjectLike(value) && getTag(value) == setTag;\n}\n\nmodule.exports = baseIsSet;\n","var baseIsSet = require('./_baseIsSet'),\n baseUnary = require('./_baseUnary'),\n nodeUtil = require('./_nodeUtil');\n\n/* Node.js helper references. */\nvar nodeIsSet = nodeUtil && nodeUtil.isSet;\n\n/**\n * Checks if `value` is classified as a `Set` object.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a set, else `false`.\n * @example\n *\n * _.isSet(new Set);\n * // => true\n *\n * _.isSet(new WeakSet);\n * // => false\n */\nvar isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;\n\nmodule.exports = isSet;\n","var Stack = require('./_Stack'),\n arrayEach = require('./_arrayEach'),\n assignValue = require('./_assignValue'),\n baseAssign = require('./_baseAssign'),\n baseAssignIn = require('./_baseAssignIn'),\n cloneBuffer = require('./_cloneBuffer'),\n copyArray = require('./_copyArray'),\n copySymbols = require('./_copySymbols'),\n copySymbolsIn = require('./_copySymbolsIn'),\n getAllKeys = require('./_getAllKeys'),\n getAllKeysIn = require('./_getAllKeysIn'),\n getTag = require('./_getTag'),\n initCloneArray = require('./_initCloneArray'),\n initCloneByTag = require('./_initCloneByTag'),\n initCloneObject = require('./_initCloneObject'),\n isArray = require('./isArray'),\n isBuffer = require('./isBuffer'),\n isMap = require('./isMap'),\n isObject = require('./isObject'),\n isSet = require('./isSet'),\n keys = require('./keys'),\n keysIn = require('./keysIn');\n\n/** Used to compose bitmasks for cloning. */\nvar CLONE_DEEP_FLAG = 1,\n CLONE_FLAT_FLAG = 2,\n CLONE_SYMBOLS_FLAG = 4;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n objectTag = '[object Object]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n symbolTag = '[object Symbol]',\n weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/** Used to identify `toStringTag` values supported by `_.clone`. */\nvar cloneableTags = {};\ncloneableTags[argsTag] = cloneableTags[arrayTag] =\ncloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =\ncloneableTags[boolTag] = cloneableTags[dateTag] =\ncloneableTags[float32Tag] = cloneableTags[float64Tag] =\ncloneableTags[int8Tag] = cloneableTags[int16Tag] =\ncloneableTags[int32Tag] = cloneableTags[mapTag] =\ncloneableTags[numberTag] = cloneableTags[objectTag] =\ncloneableTags[regexpTag] = cloneableTags[setTag] =\ncloneableTags[stringTag] = cloneableTags[symbolTag] =\ncloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =\ncloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;\ncloneableTags[errorTag] = cloneableTags[funcTag] =\ncloneableTags[weakMapTag] = false;\n\n/**\n * The base implementation of `_.clone` and `_.cloneDeep` which tracks\n * traversed objects.\n *\n * @private\n * @param {*} value The value to clone.\n * @param {boolean} bitmask The bitmask flags.\n * 1 - Deep clone\n * 2 - Flatten inherited properties\n * 4 - Clone symbols\n * @param {Function} [customizer] The function to customize cloning.\n * @param {string} [key] The key of `value`.\n * @param {Object} [object] The parent object of `value`.\n * @param {Object} [stack] Tracks traversed objects and their clone counterparts.\n * @returns {*} Returns the cloned value.\n */\nfunction baseClone(value, bitmask, customizer, key, object, stack) {\n var result,\n isDeep = bitmask & CLONE_DEEP_FLAG,\n isFlat = bitmask & CLONE_FLAT_FLAG,\n isFull = bitmask & CLONE_SYMBOLS_FLAG;\n\n if (customizer) {\n result = object ? customizer(value, key, object, stack) : customizer(value);\n }\n if (result !== undefined) {\n return result;\n }\n if (!isObject(value)) {\n return value;\n }\n var isArr = isArray(value);\n if (isArr) {\n result = initCloneArray(value);\n if (!isDeep) {\n return copyArray(value, result);\n }\n } else {\n var tag = getTag(value),\n isFunc = tag == funcTag || tag == genTag;\n\n if (isBuffer(value)) {\n return cloneBuffer(value, isDeep);\n }\n if (tag == objectTag || tag == argsTag || (isFunc && !object)) {\n result = (isFlat || isFunc) ? {} : initCloneObject(value);\n if (!isDeep) {\n return isFlat\n ? copySymbolsIn(value, baseAssignIn(result, value))\n : copySymbols(value, baseAssign(result, value));\n }\n } else {\n if (!cloneableTags[tag]) {\n return object ? value : {};\n }\n result = initCloneByTag(value, tag, isDeep);\n }\n }\n // Check for circular references and return its corresponding clone.\n stack || (stack = new Stack);\n var stacked = stack.get(value);\n if (stacked) {\n return stacked;\n }\n stack.set(value, result);\n\n if (isSet(value)) {\n value.forEach(function(subValue) {\n result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));\n });\n } else if (isMap(value)) {\n value.forEach(function(subValue, key) {\n result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));\n });\n }\n\n var keysFunc = isFull\n ? (isFlat ? getAllKeysIn : getAllKeys)\n : (isFlat ? keysIn : keys);\n\n var props = isArr ? undefined : keysFunc(value);\n arrayEach(props || value, function(subValue, key) {\n if (props) {\n key = subValue;\n subValue = value[key];\n }\n // Recursively populate clone (susceptible to call stack limits).\n assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));\n });\n return result;\n}\n\nmodule.exports = baseClone;\n","var baseClone = require('./_baseClone');\n\n/** Used to compose bitmasks for cloning. */\nvar CLONE_DEEP_FLAG = 1,\n CLONE_SYMBOLS_FLAG = 4;\n\n/**\n * This method is like `_.clone` except that it recursively clones `value`.\n *\n * @static\n * @memberOf _\n * @since 1.0.0\n * @category Lang\n * @param {*} value The value to recursively clone.\n * @returns {*} Returns the deep cloned value.\n * @see _.clone\n * @example\n *\n * var objects = [{ 'a': 1 }, { 'b': 2 }];\n *\n * var deep = _.cloneDeep(objects);\n * console.log(deep[0] === objects[0]);\n * // => false\n */\nfunction cloneDeep(value) {\n return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);\n}\n\nmodule.exports = cloneDeep;\n","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport cloneDeep from 'lodash/cloneDeep';\n\nconst callbacks = {\n /**\n * 全局的URL处理器\n * @param {string} url 来源url\n * @param {'image'|'audio'|'video'|'autolink'|'link'} srcType 来源类型\n * @returns\n */\n urlProcessor: (url, srcType) => url,\n fileUpload(file, callback) {\n callback('images/demo-dog.png');\n },\n afterChange: (text, html) => {},\n afterInit: (text, html) => {},\n beforeImageMounted: (srcProp, src) => ({ srcProp, src }),\n onClickPreview: (event) => {},\n onCopyCode: (event, code) => {\n // 阻止默认的粘贴事件\n // return false;\n // 对复制内容进行额外处理\n return code;\n },\n // 获取中文的拼音\n changeString2Pinyin: (string) => {\n /**\n * 推荐使用这个组件:https://github.com/liu11hao11/pinyin_js\n *\n * 可以在 ../scripts/pinyin/pinyin_dist.js 里直接引用\n */\n return string;\n },\n};\n\n/** @type {Partial} */\nconst defaultConfig = {\n // 第三方包\n externals: {\n // externals\n },\n // 解析引擎配置\n engine: {\n // 全局配置\n global: {\n // 是否启用经典换行逻辑\n // true:一个换行会被忽略,两个以上连续换行会分割成段落,\n // false: 一个换行会转成
,两个连续换行会分割成段落,三个以上连续换行会转成
并分割段落\n classicBr: false,\n /**\n * 全局的URL处理器\n * @param {string} url 来源url\n * @param {'image'|'audio'|'video'|'autolink'|'link'} srcType 来源类型\n * @returns\n */\n urlProcessor: callbacks.urlProcessor,\n /**\n * 额外允许渲染的html标签\n * 标签以英文竖线分隔,如:htmlWhiteList: 'iframe|script|style'\n * 默认为空,默认允许渲染的html见src/utils/sanitize.js whiteList 属性\n * 需要注意:\n * - 启用iframe、script等标签后,会产生xss注入,请根据实际场景判断是否需要启用\n * - 一般编辑权限可控的场景(如api文档系统)可以允许iframe、script等标签\n */\n htmlWhiteList: '',\n },\n // 内置语法配置\n syntax: {\n // 语法开关\n // 'hookName': false,\n // 语法配置\n // 'hookName': {\n //\n // }\n list: {\n listNested: false, // 同级列表类型转换后变为子级\n indentSpace: 2, // 默认2个空格缩进\n },\n table: {\n enableChart: false,\n // chartRenderEngine: EChartsTableEngine,\n // externals: ['echarts'],\n },\n inlineCode: {\n theme: 'red',\n },\n codeBlock: {\n theme: 'dark', // 默认为深色主题\n wrap: true, // 超出长度是否换行,false则显示滚动条\n lineNumber: true, // 默认显示行号\n customRenderer: {\n // 自定义语法渲染器\n },\n /**\n * indentedCodeBlock是缩进代码块是否启用的开关\n *\n * 在6.X之前的版本中默认不支持该语法。\n * 因为cherry的开发团队认为该语法太丑了(容易误触)\n * 开发团队希望用```代码块语法来彻底取代该语法\n * 但在后续的沟通中,开发团队发现在某些场景下该语法有更好的显示效果\n * 因此开发团队在6.X版本中才引入了该语法\n * 已经引用6.x以下版本的业务如果想做到用户无感知升级,可以去掉该语法:\n * indentedCodeBlock:false\n */\n indentedCodeBlock: true,\n },\n emoji: {\n useUnicode: true, // 是否使用unicode进行渲染\n },\n fontEmphasis: {\n /**\n * 是否允许首尾空格\n * 首尾、前后的定义: 语法前**语法首+内容+语法尾**语法后\n * 例:\n * true:\n * __ hello __ ====> hello \n * __hello__ ====> hello\n * false:\n * __ hello __ ====> _ hello _\n * __hello__ ====> hello\n */\n allowWhitespace: false,\n },\n strikethrough: {\n /**\n * 是否必须有前后空格\n * 首尾、前后的定义: 语法前**语法首+内容+语法尾**语法后\n * 例:\n * true:\n * hello wor~~l~~d ====> hello wor~~l~~d\n * hello wor ~~l~~ d ====> hello wor l d\n * false:\n * hello wor~~l~~d ====> hello world\n * hello wor ~~l~~ d ====> hello wor l d\n */\n needWhitespace: false,\n },\n mathBlock: {\n engine: 'MathJax', // katex或MathJax\n src: '',\n plugins: true, // 默认加载插件\n },\n inlineMath: {\n engine: 'MathJax', // katex或MathJax\n src: '',\n },\n toc: {\n /** 默认只渲染一个目录 */\n allowMultiToc: false,\n },\n header: {\n /**\n * 标题的样式:\n * - default 默认样式,标题前面有锚点\n * - autonumber 标题前面有自增序号锚点\n * - none 标题没有锚点\n */\n anchorStyle: 'default',\n },\n },\n },\n editor: {\n theme: 'default', // depend on codemirror theme name: https://codemirror.net/demo/theme.htm\n // 编辑器的高度,默认100%,如果挂载点存在内联设置的height则以内联样式为主\n height: '100%',\n // defaultModel 编辑器初始化后的默认模式,一共有三种模式:1、双栏编辑预览模式;2、纯编辑模式;3、预览模式\n // edit&preview: 双栏编辑预览模式\n // editOnly: 纯编辑模式(没有预览,可通过toolbar切换成双栏或预览模式)\n // previewOnly: 预览模式(没有编辑框,toolbar只显示“返回编辑”按钮,可通过toolbar切换成编辑模式)\n defaultModel: 'edit&preview',\n // 粘贴时是否自动将html转成markdown\n convertWhenPaste: true,\n codemirror: {\n // 是否自动focus 默认为true\n autofocus: true,\n },\n },\n toolbars: {\n theme: 'dark', // light or dark\n showToolbar: true, // false:不展示顶部工具栏; true:展示工具栏; toolbars.showToolbar=false 与 toolbars.toolbar=false 等效\n toolbar: [\n 'bold',\n 'italic',\n 'strikethrough',\n '|',\n 'color',\n 'header',\n 'ruby',\n '|',\n 'list',\n {\n insert: [\n 'image',\n 'audio',\n 'video',\n 'link',\n 'hr',\n 'br',\n 'code',\n 'formula',\n 'toc',\n 'table',\n 'line-table',\n 'bar-table',\n 'pdf',\n 'word',\n ],\n },\n 'graph',\n 'settings',\n ],\n sidebar: [],\n bubble: ['bold', 'italic', 'underline', 'strikethrough', 'sub', 'sup', 'quote', '|', 'size', 'color'], // array or false\n float: ['h1', 'h2', 'h3', '|', 'checklist', 'quote', 'quickTable', 'code'], // array or false\n },\n fileUpload: callbacks.fileUpload,\n callback: {\n afterChange: callbacks.afterChange,\n afterInit: callbacks.afterInit,\n beforeImageMounted: callbacks.beforeImageMounted,\n // 预览区域点击事件,previewer.enablePreviewerBubble = true 时生效\n onClickPreview: callbacks.onClickPreview,\n // 复制代码块代码时的回调\n onCopyCode: callbacks.onCopyCode,\n // 把中文变成拼音的回调,当然也可以把中文变成英文、英文变成中文\n changeString2Pinyin: callbacks.changeString2Pinyin,\n },\n previewer: {\n dom: false,\n className: 'cherry-markdown',\n // 是否启用预览区域编辑能力(目前支持编辑图片尺寸、编辑表格内容)\n enablePreviewerBubble: true,\n /**\n * 配置图片懒加载的逻辑\n * - 如果不希望图片懒加载,可配置成 lazyLoadImg = {noLoadImgNum: -1}\n * - 如果希望所有图片都无脑懒加载,可配置成 lazyLoadImg = {noLoadImgNum: 0, autoLoadImgNum: -1}\n * - 如果一共有15张图片,希望:\n * 1、前5张图片(1~5)直接加载;\n * 2、后5张图片(6~10)不论在不在视区内,都无脑懒加载;\n * 3、其他图片(11~15)在视区内时,进行懒加载;\n * 则配置应该为:lazyLoadImg = {noLoadImgNum: 5, autoLoadImgNum: 5}\n */\n lazyLoadImg: {\n // 加载图片时如果需要展示loading图,则配置loading图的地址\n loadingImgPath: '',\n // 同一时间最多有几个图片请求,最大同时加载6张图片\n maxNumPerTime: 2,\n // 不进行懒加载处理的图片数量,如果为0,即所有图片都进行懒加载处理, 如果设置为-1,则所有图片都不进行懒加载处理\n noLoadImgNum: 5,\n // 首次自动加载几张图片(不论图片是否滚动到视野内),autoLoadImgNum = -1 表示会自动加载完所有图片\n autoLoadImgNum: 5,\n // 针对加载失败的图片 或 beforeLoadOneImgCallback 返回false 的图片,最多尝试加载几次,为了防止死循环,最多5次。以图片的src为纬度统计重试次数\n maxTryTimesPerSrc: 2,\n // 加载一张图片之前的回调函数,函数return false 会终止加载操作\n beforeLoadOneImgCallback: (img) => {\n return true;\n },\n // 加载一张图片失败之后的回调函数\n failLoadOneImgCallback: (img) => {},\n // 加载一张图片之后的回调函数,如果图片加载失败,则不会回调该函数\n afterLoadOneImgCallback: (img) => {},\n // 加载完所有图片后调用的回调函数\n afterLoadAllImgCallback: () => {},\n },\n },\n // 预览页面不需要绑定事件\n isPreviewOnly: false,\n // 预览区域跟随编辑器光标自动滚动\n autoScrollByCursor: true,\n // 外层容器不存在时,是否强制输出到body上\n forceAppend: true,\n};\n\nexport default cloneDeep(defaultConfig);\n","/**\r\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nimport SyntaxBase, { HOOKS_TYPE_LIST } from './core/SyntaxBase';\r\nimport ParagraphBase from './core/ParagraphBase';\r\nimport MenuBase from './toolbars/MenuBase';\r\n\r\nfunction filterOptions(options, whiteList, propTypes) {\r\n const filteredOptions = {};\r\n Object.keys(options).forEach((key) => {\r\n if (whiteList.indexOf(key) === -1) {\r\n return;\r\n }\r\n if (typeof propTypes === 'object') {\r\n if (typeof propTypes[key] === 'string') {\r\n if (typeof options[key] === propTypes[key]) {\r\n filteredOptions[key] = options[key];\r\n }\r\n } else {\r\n if (options[key] instanceof propTypes[key]) {\r\n filteredOptions[key] = options[key];\r\n }\r\n }\r\n } else if (typeof propTypes === 'string') {\r\n if (typeof options[key] === propTypes) {\r\n filteredOptions[key] = options[key];\r\n }\r\n }\r\n });\r\n return filteredOptions;\r\n}\r\n\r\nexport function createSyntaxHook(name, type, options) {\r\n const BaseClass = type === HOOKS_TYPE_LIST.PAR ? ParagraphBase : SyntaxBase;\r\n const optionsWhiteList = ['beforeMakeHtml', 'makeHtml', 'afterMakeHtml', 'rule', 'test'];\r\n const filteredOptions = filterOptions(options, optionsWhiteList, 'function');\r\n const paragraphConfig = { needCache: options.needCache, defaultCache: options.defaultCache };\r\n return class CustomSyntax extends BaseClass {\r\n static HOOK_NAME = name;\r\n\r\n constructor(editorConfig = {}) {\r\n if (type === HOOKS_TYPE_LIST.PAR) {\r\n super({ needCache: !!paragraphConfig.needCache, defaultCache: paragraphConfig.defaultCache });\r\n } else {\r\n super();\r\n }\r\n\r\n this.config = editorConfig.config;\r\n }\r\n\r\n beforeMakeHtml(...args) {\r\n if (filteredOptions.beforeMakeHtml) {\r\n return filteredOptions.beforeMakeHtml.apply(this, args);\r\n }\r\n return super.beforeMakeHtml(...args);\r\n }\r\n\r\n makeHtml(...args) {\r\n if (filteredOptions.makeHtml) {\r\n return filteredOptions.makeHtml.apply(this, args);\r\n }\r\n return super.makeHtml(...args);\r\n }\r\n\r\n afterMakeHtml(...args) {\r\n if (filteredOptions.afterMakeHtml) {\r\n return filteredOptions.afterMakeHtml.apply(this, args);\r\n }\r\n return super.afterMakeHtml(...args);\r\n }\r\n\r\n test(...args) {\r\n if (filteredOptions.test) {\r\n return filteredOptions.test.apply(this, args);\r\n }\r\n return super.test(...args);\r\n }\r\n\r\n rule(...args) {\r\n if (filteredOptions.rule) {\r\n return filteredOptions.rule.apply(this, args);\r\n }\r\n return super.rule(...args);\r\n }\r\n };\r\n}\r\n\r\nexport function createMenuHook(name, options) {\r\n const optionsWhiteList = ['subMenuConfig', 'onClick', 'shortcutKeys', 'iconName'];\r\n const propTypes = {\r\n subMenuConfig: Array,\r\n onClick: 'function',\r\n shortcutKeys: Array,\r\n iconName: 'string',\r\n };\r\n const filteredOptions = filterOptions(options, optionsWhiteList, propTypes);\r\n return class CustomMenu extends MenuBase {\r\n constructor(editorInstance) {\r\n super(editorInstance);\r\n this.setName(name, filteredOptions.iconName);\r\n this.subMenuConfig = filteredOptions.subMenuConfig || [];\r\n }\r\n\r\n onClick(...args) {\r\n if (filteredOptions.onClick) {\r\n return filteredOptions.onClick.apply(this, args);\r\n }\r\n return super.onClick(...args);\r\n }\r\n\r\n get shortcutKeys() {\r\n if (filteredOptions.shortcutKeys) {\r\n return filteredOptions.shortcutKeys;\r\n }\r\n return [];\r\n }\r\n };\r\n}\r\n","/**\r\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * 本文件主要维护导出Cherry时需要附加在Cherry对象上的静态属性集合\r\n * 所有的具名导出都会挂载在Cherry或CherryEngine上\r\n */\r\nimport { HOOKS_TYPE_LIST } from './core/SyntaxBase';\r\nimport { createSyntaxHook, createMenuHook } from './Factory';\r\nimport { isBrowser } from './utils/env';\r\n\r\nconst constants = { HOOKS_TYPE_LIST };\r\n\r\nconst plugins = {};\r\nconst nodeIgnorePlugin = [];\r\n\r\nif (!isBrowser()) {\r\n nodeIgnorePlugin.forEach((key) => {\r\n delete plugins[key];\r\n });\r\n}\r\n\r\nconst VERSION = `${process.env.BUILD_VERSION}`;\r\n\r\nexport class CherryStatic {\r\n static createSyntaxHook = createSyntaxHook;\r\n static createMenuHook = createMenuHook;\r\n static constants = constants;\r\n static VERSION = VERSION;\r\n /**\r\n * @this {typeof import('./Cherry').default | typeof CherryStatic}\r\n * @param {{ install: (defaultConfig: any, ...args: any[]) => void }} PluginClass 插件Class\r\n * @param {...any} args 初始化插件的参数\r\n * @returns\r\n */\r\n static usePlugin(PluginClass, ...args) {\r\n if (this === CherryStatic) {\r\n throw new Error('`usePlugin` is not allowed to called through CherryStatic class.');\r\n }\r\n // @ts-ignore\r\n if (this.initialized) {\r\n throw new Error('The function `usePlugin` should be called before Cherry is instantiated.');\r\n }\r\n // @ts-ignore\r\n if (PluginClass.$cherry$mounted === true) {\r\n return;\r\n }\r\n // @ts-ignore\r\n PluginClass.install.apply(PluginClass, [this.config.defaults, ...args]);\r\n // @ts-ignore\r\n PluginClass.$cherry$mounted = true;\r\n }\r\n}\r\n","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport mergeWith from 'lodash/mergeWith';\nimport Editor from './Editor';\nimport Engine from './Engine';\nimport Previewer from './Previewer';\nimport Bubble from './toolbars/Bubble';\nimport FloatMenu from './toolbars/FloatMenu';\nimport Toolbar from './toolbars/Toolbar';\nimport { createElement } from './utils/dom';\nimport Sidebar from './toolbars/Sidebar';\nimport { customizer } from './utils/config';\nimport NestedError, { $expectTarget } from './utils/error';\nimport getPosBydiffs from './utils/recount-pos';\nimport defaultConfig from './Cherry.config';\nimport './sass/cherry.scss';\nimport cloneDeep from 'lodash/cloneDeep';\nimport Event from './Event';\n\nimport { urlProcessorProxy } from './UrlCache';\nimport { CherryStatic } from './CherryStatic';\n\n/** @typedef {import('~types/cherry').CherryOptions} CherryOptions */\nexport default class Cherry extends CherryStatic {\n /**\n * @protected\n */\n static initialized = false;\n /**\n * @readonly\n */\n static config = {\n /** @type {Partial} */\n defaults: defaultConfig,\n };\n\n /**\n * @param {Partial} options\n */\n constructor(options) {\n super();\n Cherry.initialized = true;\n const defaultConfigCopy = cloneDeep(Cherry.config.defaults);\n this.defaultToolbar = defaultConfigCopy.toolbars.toolbar;\n $expectTarget(options, Object);\n /**\n * @property\n * @type {Partial}\n */\n this.options = mergeWith({}, defaultConfigCopy, options, customizer);\n\n if (typeof this.options.engine.global.urlProcessor === 'function') {\n this.options.engine.global.urlProcessor = urlProcessorProxy(this.options.engine.global.urlProcessor);\n }\n\n this.status = {\n toolbar: 'show',\n previewer: 'show',\n editor: 'show',\n };\n\n if (this.options.isPreviewOnly || this.options.editor.defaultModel === 'previewOnly') {\n this.options.toolbars.showToolbar = false;\n this.options.editor.defaultModel = 'previewOnly';\n this.status.editor = 'hide';\n this.status.toolbar = 'hide';\n }\n\n /**\n * @property\n * @type {string} 实例ID\n */\n this.instanceId = `cherry-${new Date().getTime()}${Math.random()}`;\n this.options.instanceId = this.instanceId;\n\n /**\n * @private\n * @type {Engine}\n */\n this.engine = new Engine(this.options, this);\n this.init();\n }\n\n /**\n * 初始化工具栏、编辑区、预览区等\n * @private\n */\n init() {\n let mountEl = this.options.id ? document.getElementById(this.options.id) : this.options.el;\n\n if (!mountEl) {\n if (!this.options.forceAppend) {\n return false;\n }\n mountEl = document.createElement('div');\n mountEl.id = this.options.id || 'cherry-markdown';\n document.body.appendChild(mountEl);\n }\n\n if (!mountEl.style.height) {\n mountEl.style.height = this.options.editor.height;\n }\n this.cherryDom = mountEl;\n\n // 蒙层dom,用来拖拽编辑区&预览区宽度时展示蒙层\n const wrapperDom = this.createWrapper();\n // 创建编辑区\n const editor = this.createEditor();\n // 创建预览区\n const previewer = this.createPreviewer();\n\n if (this.options.toolbars.showToolbar === false || this.options.toolbars.toolbar === false) {\n // 即便配置了不展示工具栏,也要让工具栏加载对应的语法hook\n wrapperDom.classList.add('cherry--no-toolbar');\n this.options.toolbars.toolbar = this.defaultToolbar;\n }\n $expectTarget(this.options.toolbars.toolbar, Array);\n // 创建顶部工具栏\n this.toolbar = this.createToolbar();\n // 创建预览区域的侧边工具栏\n this.sidebar = this.createSidebar();\n\n const wrapperFragment = document.createDocumentFragment();\n wrapperFragment.appendChild(this.toolbar.options.dom);\n wrapperFragment.appendChild(editor.options.editorDom);\n wrapperFragment.appendChild(this.sidebar.options.dom);\n if (!this.options.previewer.dom) {\n wrapperFragment.appendChild(previewer.options.previewerDom);\n }\n wrapperFragment.appendChild(previewer.options.virtualDragLineDom);\n wrapperFragment.appendChild(previewer.options.editorMaskDom);\n wrapperFragment.appendChild(previewer.options.previewerMaskDom);\n\n wrapperDom.appendChild(wrapperFragment);\n mountEl.appendChild(wrapperDom);\n\n editor.init(previewer);\n // 创建bubble工具栏,所谓bubble工具栏,是指在编辑区选中文本时悬浮出现的工具栏\n this.createBubble();\n // 创建float工具栏,所谓float工具栏,是指当编辑区光标处于新行时,在行内联想出的工具栏\n this.createFloatMenu();\n previewer.init(editor);\n\n previewer.registerAfterUpdate(this.engine.mounted.bind(this.engine));\n\n // default value init\n this.initText(editor.editor);\n\n // 切换模式,有纯预览模式、纯编辑模式、双栏编辑模式\n this.switchModel(this.options.editor.defaultModel);\n\n this.cherryDomResize();\n\n Event.on(this.instanceId, Event.Events.toolbarHide, () => {\n this.status.toolbar = 'hide';\n });\n Event.on(this.instanceId, Event.Events.toolbarShow, () => {\n this.status.toolbar = 'show';\n });\n Event.on(this.instanceId, Event.Events.previewerClose, () => {\n this.status.previewer = 'hide';\n });\n Event.on(this.instanceId, Event.Events.previewerOpen, () => {\n this.status.previewer = 'show';\n });\n Event.on(this.instanceId, Event.Events.editorClose, () => {\n this.status.editor = 'hide';\n });\n Event.on(this.instanceId, Event.Events.editorOpen, () => {\n this.status.editor = 'show';\n });\n }\n\n /**\n * 监听 cherry 高度变化,高度改变触发 codemirror 内容刷新\n * @private\n */\n cherryDomResize() {\n const observer = new ResizeObserver((entries) => {\n for (const {} of entries) {\n setTimeout(() => this.editor.editor.refresh(), 10);\n }\n });\n\n observer.observe(this.cherryDom);\n\n this.cherryDomReiszeObserver = observer;\n }\n\n /**\n * 切换编辑模式\n * @param {'edit&preview'|'editOnly'|'previewOnly'} model 模式类型\n * 一般纯预览模式和纯编辑模式适合在屏幕较小的终端使用,比如手机移动端\n *\n * @returns\n */\n switchModel(model = 'edit&preview') {\n switch (model) {\n case 'edit&preview':\n if (this.previewer) {\n this.previewer.editOnly(true);\n this.previewer.recoverPreviewer();\n }\n if (this.toolbar) {\n this.toolbar.showToolbar();\n }\n break;\n case 'editOnly':\n if (!this.previewer.isPreviewerHidden()) {\n this.previewer.editOnly(true);\n }\n if (this.toolbar) {\n this.toolbar.showToolbar();\n }\n break;\n case 'previewOnly':\n this.previewer.previewOnly();\n this.toolbar && this.toolbar.previewOnly();\n break;\n }\n }\n\n /**\n * 获取实例id\n * @returns {string}\n * @public\n */\n getInstanceId() {\n return this.instanceId;\n }\n\n /**\n * 获取编辑器状态\n * @returns {Object}\n */\n getStatus() {\n return this.status;\n }\n\n /**\n * 获取编辑区内的markdown源码内容\n * @returns markdown源码内容\n */\n getValue() {\n return this.editor.editor.getValue();\n }\n\n /**\n * 获取编辑区内的markdown源码内容\n * @returns markdown源码内容\n */\n getMarkdown() {\n return this.getValue();\n }\n\n /**\n * 获取CodeMirror实例\n * @returns CodeMirror实例\n */\n getCodeMirror() {\n return this.editor.editor;\n }\n\n /**\n * 获取预览区内的html内容\n * @param {boolean} wrapTheme 是否在外层包裹主题class\n * @returns html内容\n */\n getHtml(wrapTheme = true) {\n return this.previewer.getValue(wrapTheme);\n }\n\n getPreviewer() {\n return this.previewer;\n }\n\n /**\n * 获取目录,目录由head1~6组成\n * @returns 标题head数组\n */\n getToc() {\n const str = this.getHtml();\n /** @type {({level: number;id: string;text: string})[]} */\n const headerList = [];\n const headerRegex = /(.+?)<\\/h[0-6]>/g;\n str.replace(headerRegex, (match, level, id, text) => {\n headerList.push({ level: +level, id, text });\n return match;\n });\n return headerList;\n }\n\n /**\n * 覆盖编辑区的内容\n * @param {string} content markdown内容\n * @param {boolean} keepCursor 是否保持光标位置\n * @returns\n */\n setValue(content, keepCursor = false) {\n if (keepCursor === false) {\n return this.editor.editor.setValue(content);\n }\n const codemirror = this.editor.editor;\n const old = this.getValue();\n const pos = codemirror.getDoc().indexFromPos(codemirror.getCursor());\n const newPos = getPosBydiffs(pos, old, content);\n const ret = codemirror.setValue(content);\n const cursor = codemirror.getDoc().posFromIndex(newPos);\n codemirror.setCursor(cursor);\n return ret;\n }\n\n /**\n * 在光标处或者指定行+偏移量插入内容\n * @param {string} content 被插入的文本\n * @param {boolean} [isSelect=false] 是否选中刚插入的内容\n * @param {[number, number]|false} [anchor=false] [x,y] 代表x+1行,y+1字符偏移量,默认false 会从光标处插入\n * @param {boolean} [focus=true] 保持编辑器处于focus状态\n * @returns\n */\n insert(content, isSelect = false, anchor = false, focus = true) {\n if (anchor) {\n this.editor.editor.setSelection({ line: anchor[0], ch: anchor[1] }, { line: anchor[0], ch: anchor[1] });\n }\n const ret = this.editor.editor.replaceSelection(content, isSelect ? 'around' : 'end');\n focus && this.editor.editor.focus();\n return ret;\n }\n\n /**\n * 在光标处或者指定行+偏移量插入内容\n * @param {string} content 被插入的文本\n * @param {boolean} [isSelect=false] 是否选中刚插入的内容\n * @param {[number, number]|false} [anchor=false] [x,y] 代表x+1行,y+1字符偏移量,默认false 会从光标处插入\n * @param {boolean} [focus=true] 保持编辑器处于focus状态\n * @returns\n */\n insertValue(content, isSelect = false, anchor = false, focus = true) {\n return this.insert(content, isSelect, anchor, focus);\n }\n\n /**\n * 覆盖编辑区的内容\n * @param {string} content markdown内容\n * @param {boolean} keepCursor 是否保持光标位置\n * @returns\n */\n setMarkdown(content, keepCursor = false) {\n return this.setValue(content, keepCursor);\n }\n\n /**\n * @private\n * @returns\n */\n createWrapper() {\n const toolbarTheme = this.options.toolbars.theme === 'dark' ? 'dark' : '';\n // TODO: 完善类型\n const inlineCodeTheme = /** @type {{theme?: string;}} */ (this.options.engine.syntax.inlineCode).theme;\n let codeBlockTheme = /** @type {{theme?: string;}} */ (this.options.engine.syntax.codeBlock).theme;\n if (codeBlockTheme === 'dark') codeBlockTheme = 'tomorrow-night';\n else if (codeBlockTheme === 'light') codeBlockTheme = 'solarized-light';\n const wrapperDom = createElement('div', 'cherry clearfix', {\n 'data-toolbarTheme': toolbarTheme,\n 'data-inlineCodeTheme': inlineCodeTheme,\n 'data-codeBlockTheme': codeBlockTheme,\n });\n this.wrapperDom = wrapperDom;\n return wrapperDom;\n }\n\n /**\n * @private\n * @returns\n */\n createToolbar() {\n const dom = createElement('div', 'cherry-toolbar');\n this.toolbar = new Toolbar({\n dom,\n $cherry: this,\n buttonConfig: this.options.toolbars.toolbar,\n customMenu: this.options.toolbars.customMenu,\n });\n return this.toolbar;\n }\n\n /**\n * @private\n * @returns\n */\n createSidebar() {\n const externalClass = this.options.toolbars.theme === 'dark' ? 'dark' : '';\n const dom = createElement('div', `cherry-sidebar ${externalClass}`);\n this.sidebar = new Sidebar({\n dom,\n $cherry: this,\n buttonConfig: this.options.toolbars.sidebar,\n customMenu: this.options.toolbars.customMenu,\n });\n return this.sidebar;\n }\n\n /**\n * @private\n * @returns\n */\n createFloatMenu() {\n const dom = createElement('div', 'cherry-floatmenu');\n if (this.options.toolbars.float) {\n $expectTarget(this.options.toolbars.float, Array);\n this.floatMenu = new FloatMenu({\n dom,\n $cherry: this,\n buttonConfig: this.options.toolbars.float,\n });\n }\n }\n\n /**\n * @private\n * @returns\n */\n createBubble() {\n const dom = createElement('div', 'cherry-bubble');\n if (this.options.toolbars.bubble) {\n $expectTarget(this.options.toolbars.bubble, Array);\n this.bubble = new Bubble({\n dom,\n $cherry: this,\n buttonConfig: this.options.toolbars.bubble,\n engine: this.engine,\n });\n }\n }\n\n /**\n * @private\n * @returns {import('@/Editor').default}\n */\n createEditor() {\n const textArea = createElement('textarea', '', { id: 'code', name: 'code' });\n textArea.textContent = this.options.value;\n const editor = createElement('div', 'cherry-editor');\n editor.appendChild(textArea);\n\n this.editor = new Editor({\n $cherry: this,\n editorDom: editor,\n wrapperDom: this.wrapperDom,\n value: this.options.value,\n onKeydown: this.fireShortcutKey.bind(this),\n onChange: this.editText.bind(this),\n toolbars: this.options.toolbars,\n fileUpload: this.options.fileUpload,\n autoScrollByCursor: this.options.autoScrollByCursor,\n ...this.options.editor,\n });\n return this.editor;\n }\n\n /**\n * @private\n * @returns {import('@/Previewer').default}\n */\n createPreviewer() {\n /** @type {HTMLDivElement} */\n let previewer;\n const anchorStyle =\n (this.options.engine.syntax.header && this.options.engine.syntax.header.anchorStyle) || 'default';\n const autonumberClass = anchorStyle === 'autonumber' ? ' head-num' : '';\n const { className, dom, enablePreviewerBubble } = this.options.previewer;\n const previewerClassName = ['cherry-previewer', className || '', autonumberClass].join(' ');\n if (dom) {\n previewer = dom;\n previewer.className += ` ${previewerClassName}`;\n } else {\n previewer = createElement('div', previewerClassName);\n }\n const virtualDragLine = createElement('div', 'cherry-drag');\n const editorMask = createElement('div', 'cherry-editor-mask');\n const previewerMask = createElement('div', 'cherry-previewer-mask');\n\n this.previewer = new Previewer({\n $cherry: this,\n virtualDragLineDom: virtualDragLine,\n editorMaskDom: editorMask,\n previewerMaskDom: previewerMask,\n previewerDom: previewer,\n value: this.options.value,\n isPreviewOnly: this.options.isPreviewOnly,\n enablePreviewerBubble,\n lazyLoadImg: this.options.previewer.lazyLoadImg,\n });\n\n return this.previewer;\n }\n\n /**\n * @private\n * @param {import('codemirror').Editor} codemirror\n */\n initText(codemirror) {\n try {\n const markdownText = codemirror.getValue();\n const html = this.engine.makeHtml(markdownText);\n this.previewer.update(html);\n if (this.options.callback.afterInit) {\n this.options.callback.afterInit(markdownText, html);\n }\n } catch (e) {\n throw new NestedError(e);\n }\n }\n\n /**\n * @private\n * @param {Event} _evt\n * @param {import('codemirror').Editor} codemirror\n */\n editText(_evt, codemirror) {\n try {\n if (this.timer) {\n clearTimeout(this.timer);\n this.timer = null;\n }\n this.timer = setTimeout(() => {\n const markdownText = codemirror.getValue();\n const html = this.engine.makeHtml(markdownText);\n this.previewer.update(html);\n if (this.options.callback.afterChange) {\n this.options.callback.afterChange(markdownText, html);\n }\n // 强制每次编辑(包括undo、redo)编辑器都会自动滚动到光标位置\n codemirror.scrollIntoView(null);\n }, 50);\n } catch (e) {\n throw new NestedError(e);\n }\n }\n\n /**\n * @private\n * @param {any} cb\n */\n onChange(cb) {\n this.editor.editor.on('change', (codeMirror) => {\n cb({\n markdown: codeMirror.getValue(), // 后续可以按需增加html或其他状态\n });\n });\n }\n\n /**\n * @private\n * @param {*} evt\n */\n fireShortcutKey(evt) {\n if (this.toolbar.matchShortcutKey(evt)) {\n // 快捷键\n evt.preventDefault();\n this.toolbar.fireShortcutKey(evt);\n }\n }\n\n /**\n * 导出预览区域内容\n * @public\n * @param {String} type 'pdf':导出成pdf文件; 'img':导出成图片\n */\n export(type = 'pdf') {\n this.previewer.export(type);\n }\n}\n","/**\r\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nimport Cherry from './Cherry';\r\n\r\nimport SyntaxHookBase from './core/SyntaxBase';\r\nimport MenuHookBase from './toolbars/MenuBase';\r\n\r\n// in browser\r\nif (window) {\r\n // @ts-ignore\r\n window.Cherry = Cherry;\r\n}\r\n\r\nexport { SyntaxHookBase, MenuHookBase };\r\n\r\nexport default Cherry;\r\n","/**\r\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nimport mergeWith from 'lodash/mergeWith';\r\n\r\nconst DEFAULT_OPTIONS = {\r\n // TODO: themes\r\n theme: 'default',\r\n altFontFamily: 'sans-serif',\r\n fontFamily: 'sans-serif',\r\n themeCSS: '.label foreignObject { font-size: 90%; overflow: visible; } .label { font-family: sans-serif; }',\r\n flowchart: {\r\n useMaxWidth: false,\r\n },\r\n sequence: {\r\n useMaxWidth: false,\r\n },\r\n startOnLoad: false,\r\n logLevel: 5,\r\n // fontFamily: 'Arial, monospace'\r\n};\r\n\r\nexport default class MermaidCodeEngine {\r\n static TYPE = 'figure';\r\n\r\n static install(cherryOptions, ...args) {\r\n mergeWith(cherryOptions, {\r\n engine: {\r\n syntax: {\r\n codeBlock: {\r\n customRenderer: {\r\n mermaid: new MermaidCodeEngine(...args),\r\n },\r\n },\r\n },\r\n },\r\n });\r\n }\r\n\r\n mermaidAPIRefs = null;\r\n options = DEFAULT_OPTIONS;\r\n dom = null;\r\n mermaidCanvas = null;\r\n\r\n constructor(mermaidOptions = {}) {\r\n const { mermaid, mermaidAPI } = mermaidOptions;\r\n if (\r\n !mermaidAPI &&\r\n !window.mermaidAPI &&\r\n (!mermaid || !mermaid.mermaidAPI) &&\r\n (!window.mermaid || !window.mermaid.mermaidAPI)\r\n ) {\r\n throw new Error('code-block-mermaid-plugin[init]: Package mermaid or mermaidAPI not found.');\r\n }\r\n this.options = { ...DEFAULT_OPTIONS, ...(mermaidOptions || {}) };\r\n this.mermaidAPIRefs = mermaidAPI || window.mermaidAPI || mermaid.mermaidAPI || window.mermaid.mermaidAPI;\r\n delete this.options.mermaid;\r\n delete this.options.mermaidAPI;\r\n this.mermaidAPIRefs.initialize(this.options);\r\n }\r\n\r\n mountMermaidCanvas($engine) {\r\n if (this.mermaidCanvas && document.body.contains(this.mermaidCanvas)) {\r\n return;\r\n }\r\n this.mermaidCanvas = document.createElement('div');\r\n this.mermaidCanvas.style = 'width:1024px;opacity:0;position:fixed;top:100%;';\r\n const container = $engine.$cherry.wrapperDom || document.body;\r\n container.appendChild(this.mermaidCanvas);\r\n }\r\n\r\n /**\r\n * 转换svg为img,如果出错则直出svg\r\n * @param {string} svgCode\r\n * @param {string} graphId\r\n * @returns {string}\r\n */\r\n convertMermaidSvgToImg(svgCode, graphId) {\r\n const domParser = new DOMParser();\r\n let svgHtml;\r\n const injectSvgFallback = (svg) =>\r\n svg.replace('`;\r\n } else {\r\n svgHtml = injectSvgFallback(svgCode);\r\n }\r\n } catch (e) {\r\n svgHtml = injectSvgFallback(svgCode);\r\n }\r\n return svgHtml;\r\n }\r\n\r\n render(src, sign, $engine) {\r\n let $sign = sign;\r\n if (!$sign) {\r\n $sign = Math.round(Math.random() * 100000000);\r\n }\r\n this.mountMermaidCanvas($engine);\r\n let html;\r\n // 多实例的情况下相同的内容ID相同会导致mermaid渲染异常\r\n // 需要通过添加时间戳使得多次渲染相同内容的图像ID唯一\r\n // 图像渲染节流在CodeBlock Hook内部控制\r\n const graphId = `mermaid-${$sign}-${new Date().getTime()}`;\r\n try {\r\n this.mermaidAPIRefs.render(\r\n graphId,\r\n src,\r\n (svgCode) => {\r\n const fixedSvg = svgCode\r\n .replace(/\\s*markerUnits=\"0\"/g, '')\r\n .replace(/\\s*x=\"NaN\"/g, '')\r\n .replace(/
/g, '
');\r\n html = this.convertMermaidSvgToImg(fixedSvg, graphId);\r\n },\r\n this.mermaidCanvas,\r\n );\r\n } catch (e) {\r\n return false;\r\n }\r\n return html;\r\n }\r\n}\r\n","// @ts-nocheck\r\n/*\r\n * $Id: rawdeflate.js,v 0.3 2009/03/01 19:05:05 dankogai Exp dankogai $\r\n *\r\n * Original:\r\n * http://www.onicos.com/staff/iz/amuse/javascript/expert/deflate.txt\r\n */\r\n\r\n// if run as a web worker, respond to messages by deflating them\r\nconst deflate = (function () {\r\n /* Copyright (C) 1999 Masanao Izumo \r\n * Version: 1.0.1\r\n * LastModified: Dec 25 1999\r\n */\r\n\r\n /* Interface:\r\n * data = deflate(src);\r\n */\r\n\r\n /* constant parameters */\r\n const zip_WSIZE = 32768; // Sliding Window size\r\n const zip_STORED_BLOCK = 0;\r\n const zip_STATIC_TREES = 1;\r\n const zip_DYN_TREES = 2;\r\n\r\n /* for deflate */\r\n const zip_DEFAULT_LEVEL = 6;\r\n const zip_FULL_SEARCH = true;\r\n const zip_INBUFSIZ = 32768; // Input buffer size\r\n const zip_INBUF_EXTRA = 64; // Extra buffer\r\n const zip_OUTBUFSIZ = 1024 * 8;\r\n const zip_window_size = 2 * zip_WSIZE;\r\n const zip_MIN_MATCH = 3;\r\n const zip_MAX_MATCH = 258;\r\n const zip_BITS = 16;\r\n // for SMALL_MEM\r\n const zip_LIT_BUFSIZE = 0x2000;\r\n const zip_HASH_BITS = 13;\r\n // for MEDIUM_MEM\r\n // var zip_LIT_BUFSIZE = 0x4000;\r\n // var zip_HASH_BITS = 14;\r\n // for BIG_MEM\r\n // var zip_LIT_BUFSIZE = 0x8000;\r\n // var zip_HASH_BITS = 15;\r\n // if(zip_LIT_BUFSIZE > zip_INBUFSIZ)\r\n // alert(\"error: zip_INBUFSIZ is too small\");\r\n // if((zip_WSIZE<<1) > (1< zip_BITS-1)\r\n // alert(\"error: zip_HASH_BITS is too large\");\r\n // if(zip_HASH_BITS < 8 || zip_MAX_MATCH != 258)\r\n // alert(\"error: Code too clever\");\r\n const zip_DIST_BUFSIZE = zip_LIT_BUFSIZE;\r\n const zip_HASH_SIZE = 1 << zip_HASH_BITS;\r\n const zip_HASH_MASK = zip_HASH_SIZE - 1;\r\n const zip_WMASK = zip_WSIZE - 1;\r\n const zip_NIL = 0; // Tail of hash chains\r\n const zip_TOO_FAR = 4096;\r\n const zip_MIN_LOOKAHEAD = zip_MAX_MATCH + zip_MIN_MATCH + 1;\r\n const zip_MAX_DIST = zip_WSIZE - zip_MIN_LOOKAHEAD;\r\n const zip_SMALLEST = 1;\r\n const zip_MAX_BITS = 15;\r\n const zip_MAX_BL_BITS = 7;\r\n const zip_LENGTH_CODES = 29;\r\n const zip_LITERALS = 256;\r\n const zip_END_BLOCK = 256;\r\n const zip_L_CODES = zip_LITERALS + 1 + zip_LENGTH_CODES;\r\n const zip_D_CODES = 30;\r\n const zip_BL_CODES = 19;\r\n const zip_REP_3_6 = 16;\r\n const zip_REPZ_3_10 = 17;\r\n const zip_REPZ_11_138 = 18;\r\n const zip_HEAP_SIZE = 2 * zip_L_CODES + 1;\r\n const zip_H_SHIFT = parseInt((zip_HASH_BITS + zip_MIN_MATCH - 1) / zip_MIN_MATCH);\r\n\r\n /* variables */\r\n let zip_free_queue;\r\n let zip_qhead;\r\n let zip_qtail;\r\n let zip_initflag;\r\n let zip_outbuf = null;\r\n let zip_outcnt;\r\n let zip_outoff;\r\n let zip_complete;\r\n let zip_window;\r\n let zip_d_buf;\r\n let zip_l_buf;\r\n let zip_prev;\r\n let zip_bi_buf;\r\n let zip_bi_valid;\r\n let zip_block_start;\r\n let zip_ins_h;\r\n let zip_hash_head;\r\n let zip_prev_match;\r\n let zip_match_available;\r\n let zip_match_length;\r\n let zip_prev_length;\r\n let zip_strstart;\r\n let zip_match_start;\r\n let zip_eofile;\r\n let zip_lookahead;\r\n let zip_max_chain_length;\r\n let zip_max_lazy_match;\r\n let zip_compr_level;\r\n let zip_good_match;\r\n let zip_nice_match;\r\n let zip_dyn_ltree;\r\n let zip_dyn_dtree;\r\n let zip_static_ltree;\r\n let zip_static_dtree;\r\n let zip_bl_tree;\r\n let zip_l_desc;\r\n let zip_d_desc;\r\n let zip_bl_desc;\r\n let zip_bl_count;\r\n let zip_heap;\r\n let zip_heap_len;\r\n let zip_heap_max;\r\n let zip_depth;\r\n let zip_length_code;\r\n let zip_dist_code;\r\n let zip_base_length;\r\n let zip_base_dist;\r\n let zip_flag_buf;\r\n let zip_last_lit;\r\n let zip_last_dist;\r\n let zip_last_flags;\r\n let zip_flags;\r\n let zip_flag_bit;\r\n let zip_opt_len;\r\n let zip_static_len;\r\n let zip_deflate_data;\r\n let zip_deflate_pos;\r\n\r\n /* objects (deflate) */\r\n\r\n function zip_DeflateCT() {\r\n this.fc = 0; // frequency count or bit string\r\n this.dl = 0; // father node in Huffman tree or length of bit string\r\n }\r\n\r\n function zip_DeflateTreeDesc() {\r\n this.dyn_tree = null; // the dynamic tree\r\n this.static_tree = null; // corresponding static tree or NULL\r\n this.extra_bits = null; // extra bits for each code or NULL\r\n this.extra_base = 0; // base index for extra_bits\r\n this.elems = 0; // max number of elements in the tree\r\n this.max_length = 0; // max bit length for the codes\r\n this.max_code = 0; // largest code with non zero frequency\r\n }\r\n\r\n /* Values for max_lazy_match, good_match and max_chain_length, depending on\r\n * the desired pack level (0..9). The values given below have been tuned to\r\n * exclude worst case performance for pathological files. Better values may be\r\n * found for specific files.\r\n */\r\n function zip_DeflateConfiguration(a, b, c, d) {\r\n this.good_length = a; // reduce lazy search above this match length\r\n this.max_lazy = b; // do not perform lazy search above this match length\r\n this.nice_length = c; // quit search above this match length\r\n this.max_chain = d;\r\n }\r\n\r\n function zip_DeflateBuffer() {\r\n this.next = null;\r\n this.len = 0;\r\n this.ptr = new Array(zip_OUTBUFSIZ);\r\n this.off = 0;\r\n }\r\n\r\n /* constant tables */\r\n const zip_extra_lbits = [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0];\r\n const zip_extra_dbits = [\r\n 0,\r\n 0,\r\n 0,\r\n 0,\r\n 1,\r\n 1,\r\n 2,\r\n 2,\r\n 3,\r\n 3,\r\n 4,\r\n 4,\r\n 5,\r\n 5,\r\n 6,\r\n 6,\r\n 7,\r\n 7,\r\n 8,\r\n 8,\r\n 9,\r\n 9,\r\n 10,\r\n 10,\r\n 11,\r\n 11,\r\n 12,\r\n 12,\r\n 13,\r\n 13,\r\n ];\r\n const zip_extra_blbits = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7];\r\n const zip_bl_order = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15];\r\n const zip_configuration_table = [\r\n new zip_DeflateConfiguration(0, 0, 0, 0),\r\n new zip_DeflateConfiguration(4, 4, 8, 4),\r\n new zip_DeflateConfiguration(4, 5, 16, 8),\r\n new zip_DeflateConfiguration(4, 6, 32, 32),\r\n new zip_DeflateConfiguration(4, 4, 16, 16),\r\n new zip_DeflateConfiguration(8, 16, 32, 32),\r\n new zip_DeflateConfiguration(8, 16, 128, 128),\r\n new zip_DeflateConfiguration(8, 32, 128, 256),\r\n new zip_DeflateConfiguration(32, 128, 258, 1024),\r\n new zip_DeflateConfiguration(32, 258, 258, 4096),\r\n ];\r\n\r\n /* routines (deflate) */\r\n\r\n function zip_deflate_start(level) {\r\n let i;\r\n\r\n if (!level) level = zip_DEFAULT_LEVEL;\r\n else if (level < 1) level = 1;\r\n else if (level > 9) level = 9;\r\n\r\n zip_compr_level = level;\r\n zip_initflag = false;\r\n zip_eofile = false;\r\n if (zip_outbuf != null) return;\r\n\r\n zip_free_queue = zip_qhead = zip_qtail = null;\r\n zip_outbuf = new Array(zip_OUTBUFSIZ);\r\n zip_window = new Array(zip_window_size);\r\n zip_d_buf = new Array(zip_DIST_BUFSIZE);\r\n zip_l_buf = new Array(zip_INBUFSIZ + zip_INBUF_EXTRA);\r\n zip_prev = new Array(1 << zip_BITS);\r\n zip_dyn_ltree = new Array(zip_HEAP_SIZE);\r\n for (i = 0; i < zip_HEAP_SIZE; i++) zip_dyn_ltree[i] = new zip_DeflateCT();\r\n zip_dyn_dtree = new Array(2 * zip_D_CODES + 1);\r\n for (i = 0; i < 2 * zip_D_CODES + 1; i++) zip_dyn_dtree[i] = new zip_DeflateCT();\r\n zip_static_ltree = new Array(zip_L_CODES + 2);\r\n for (i = 0; i < zip_L_CODES + 2; i++) zip_static_ltree[i] = new zip_DeflateCT();\r\n zip_static_dtree = new Array(zip_D_CODES);\r\n for (i = 0; i < zip_D_CODES; i++) zip_static_dtree[i] = new zip_DeflateCT();\r\n zip_bl_tree = new Array(2 * zip_BL_CODES + 1);\r\n for (i = 0; i < 2 * zip_BL_CODES + 1; i++) zip_bl_tree[i] = new zip_DeflateCT();\r\n zip_l_desc = new zip_DeflateTreeDesc();\r\n zip_d_desc = new zip_DeflateTreeDesc();\r\n zip_bl_desc = new zip_DeflateTreeDesc();\r\n zip_bl_count = new Array(zip_MAX_BITS + 1);\r\n zip_heap = new Array(2 * zip_L_CODES + 1);\r\n zip_depth = new Array(2 * zip_L_CODES + 1);\r\n zip_length_code = new Array(zip_MAX_MATCH - zip_MIN_MATCH + 1);\r\n zip_dist_code = new Array(512);\r\n zip_base_length = new Array(zip_LENGTH_CODES);\r\n zip_base_dist = new Array(zip_D_CODES);\r\n zip_flag_buf = new Array(parseInt(zip_LIT_BUFSIZE / 8));\r\n }\r\n\r\n function zip_deflate_end() {\r\n zip_free_queue = zip_qhead = zip_qtail = null;\r\n zip_outbuf = null;\r\n zip_window = null;\r\n zip_d_buf = null;\r\n zip_l_buf = null;\r\n zip_prev = null;\r\n zip_dyn_ltree = null;\r\n zip_dyn_dtree = null;\r\n zip_static_ltree = null;\r\n zip_static_dtree = null;\r\n zip_bl_tree = null;\r\n zip_l_desc = null;\r\n zip_d_desc = null;\r\n zip_bl_desc = null;\r\n zip_bl_count = null;\r\n zip_heap = null;\r\n zip_depth = null;\r\n zip_length_code = null;\r\n zip_dist_code = null;\r\n zip_base_length = null;\r\n zip_base_dist = null;\r\n zip_flag_buf = null;\r\n }\r\n\r\n function zip_reuse_queue(p) {\r\n p.next = zip_free_queue;\r\n zip_free_queue = p;\r\n }\r\n\r\n function zip_new_queue() {\r\n let p;\r\n\r\n if (zip_free_queue != null) {\r\n p = zip_free_queue;\r\n zip_free_queue = zip_free_queue.next;\r\n } else p = new zip_DeflateBuffer();\r\n p.next = null;\r\n p.len = p.off = 0;\r\n\r\n return p;\r\n }\r\n\r\n function zip_head1(i) {\r\n return zip_prev[zip_WSIZE + i];\r\n }\r\n\r\n function zip_head2(i, val) {\r\n return (zip_prev[zip_WSIZE + i] = val);\r\n }\r\n\r\n /* put_byte is used for the compressed output, put_ubyte for the\r\n * uncompressed output. However unlzw() uses window for its\r\n * suffix table instead of its output buffer, so it does not use put_ubyte\r\n * (to be cleaned up).\r\n */\r\n function zip_put_byte(c) {\r\n zip_outbuf[zip_outoff + zip_outcnt++] = c;\r\n if (zip_outoff + zip_outcnt == zip_OUTBUFSIZ) zip_qoutbuf();\r\n }\r\n\r\n /* Output a 16 bit value, lsb first */\r\n function zip_put_short(w) {\r\n w &= 0xffff;\r\n if (zip_outoff + zip_outcnt < zip_OUTBUFSIZ - 2) {\r\n zip_outbuf[zip_outoff + zip_outcnt++] = w & 0xff;\r\n zip_outbuf[zip_outoff + zip_outcnt++] = w >>> 8;\r\n } else {\r\n zip_put_byte(w & 0xff);\r\n zip_put_byte(w >>> 8);\r\n }\r\n }\r\n\r\n /* ==========================================================================\r\n * Insert string s in the dictionary and set match_head to the previous head\r\n * of the hash chain (the most recent string with same hash key). Return\r\n * the previous length of the hash chain.\r\n * IN assertion: all calls to to INSERT_STRING are made with consecutive\r\n * input characters and the first MIN_MATCH bytes of s are valid\r\n * (except for the last MIN_MATCH-1 bytes of the input file).\r\n */\r\n function zip_INSERT_STRING() {\r\n zip_ins_h = ((zip_ins_h << zip_H_SHIFT) ^ (zip_window[zip_strstart + zip_MIN_MATCH - 1] & 0xff)) & zip_HASH_MASK;\r\n zip_hash_head = zip_head1(zip_ins_h);\r\n zip_prev[zip_strstart & zip_WMASK] = zip_hash_head;\r\n zip_head2(zip_ins_h, zip_strstart);\r\n }\r\n\r\n /* Send a code of the given tree. c and tree must not have side effects */\r\n function zip_SEND_CODE(c, tree) {\r\n zip_send_bits(tree[c].fc, tree[c].dl);\r\n }\r\n\r\n /* Mapping from a distance to a distance code. dist is the distance - 1 and\r\n * must not have side effects. dist_code[256] and dist_code[257] are never\r\n * used.\r\n */\r\n function zip_D_CODE(dist) {\r\n return (dist < 256 ? zip_dist_code[dist] : zip_dist_code[256 + (dist >> 7)]) & 0xff;\r\n }\r\n\r\n /* ==========================================================================\r\n * Compares to subtrees, using the tree depth as tie breaker when\r\n * the subtrees have equal frequency. This minimizes the worst case length.\r\n */\r\n function zip_SMALLER(tree, n, m) {\r\n return tree[n].fc < tree[m].fc || (tree[n].fc == tree[m].fc && zip_depth[n] <= zip_depth[m]);\r\n }\r\n\r\n /* ==========================================================================\r\n * read string data\r\n */\r\n function zip_read_buff(buff, offset, n) {\r\n let i;\r\n for (i = 0; i < n && zip_deflate_pos < zip_deflate_data.length; i++)\r\n buff[offset + i] = zip_deflate_data.charCodeAt(zip_deflate_pos++) & 0xff;\r\n return i;\r\n }\r\n\r\n /* ==========================================================================\r\n * Initialize the \"longest match\" routines for a new file\r\n */\r\n function zip_lm_init() {\r\n let j;\r\n\r\n /* Initialize the hash table. */\r\n for (j = 0; j < zip_HASH_SIZE; j++)\r\n //\tzip_head2(j, zip_NIL);\r\n zip_prev[zip_WSIZE + j] = 0;\r\n /* prev will be initialized on the fly */\r\n\r\n /* Set the default configuration parameters:\r\n */\r\n zip_max_lazy_match = zip_configuration_table[zip_compr_level].max_lazy;\r\n zip_good_match = zip_configuration_table[zip_compr_level].good_length;\r\n if (!zip_FULL_SEARCH) zip_nice_match = zip_configuration_table[zip_compr_level].nice_length;\r\n zip_max_chain_length = zip_configuration_table[zip_compr_level].max_chain;\r\n\r\n zip_strstart = 0;\r\n zip_block_start = 0;\r\n\r\n zip_lookahead = zip_read_buff(zip_window, 0, 2 * zip_WSIZE);\r\n if (zip_lookahead <= 0) {\r\n zip_eofile = true;\r\n zip_lookahead = 0;\r\n return;\r\n }\r\n zip_eofile = false;\r\n /* Make sure that we always have enough lookahead. This is important\r\n * if input comes from a device such as a tty.\r\n */\r\n while (zip_lookahead < zip_MIN_LOOKAHEAD && !zip_eofile) zip_fill_window();\r\n\r\n /* If lookahead < MIN_MATCH, ins_h is garbage, but this is\r\n * not important since only literal bytes will be emitted.\r\n */\r\n zip_ins_h = 0;\r\n for (j = 0; j < zip_MIN_MATCH - 1; j++) {\r\n // UPDATE_HASH(ins_h, window[j]);\r\n zip_ins_h = ((zip_ins_h << zip_H_SHIFT) ^ (zip_window[j] & 0xff)) & zip_HASH_MASK;\r\n }\r\n }\r\n\r\n /* ==========================================================================\r\n * Set match_start to the longest match starting at the given string and\r\n * return its length. Matches shorter or equal to prev_length are discarded,\r\n * in which case the result is equal to prev_length and match_start is\r\n * garbage.\r\n * IN assertions: cur_match is the head of the hash chain for the current\r\n * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1\r\n */\r\n function zip_longest_match(cur_match) {\r\n let chain_length = zip_max_chain_length; // max hash chain length\r\n let scanp = zip_strstart; // current string\r\n let matchp; // matched string\r\n let len; // length of current match\r\n let best_len = zip_prev_length; // best match length so far\r\n\r\n /* Stop when cur_match becomes <= limit. To simplify the code,\r\n * we prevent matches with the string of window index 0.\r\n */\r\n const limit = zip_strstart > zip_MAX_DIST ? zip_strstart - zip_MAX_DIST : zip_NIL;\r\n\r\n const strendp = zip_strstart + zip_MAX_MATCH;\r\n let scan_end1 = zip_window[scanp + best_len - 1];\r\n let scan_end = zip_window[scanp + best_len];\r\n\r\n /* Do not waste too much time if we already have a good match: */\r\n if (zip_prev_length >= zip_good_match) chain_length >>= 2;\r\n\r\n // Assert(encoder->strstart <= window_size-MIN_LOOKAHEAD, \"insufficient lookahead\");\r\n\r\n do {\r\n // Assert(cur_match < encoder->strstart, \"no future\");\r\n matchp = cur_match;\r\n\r\n /* Skip to next match if the match length cannot increase\r\n * or if the match length is less than 2:\r\n */\r\n if (\r\n zip_window[matchp + best_len] != scan_end ||\r\n zip_window[matchp + best_len - 1] != scan_end1 ||\r\n zip_window[matchp] != zip_window[scanp] ||\r\n zip_window[++matchp] != zip_window[scanp + 1]\r\n ) {\r\n continue;\r\n }\r\n\r\n /* The check at best_len-1 can be removed because it will be made\r\n * again later. (This heuristic is not always a win.)\r\n * It is not necessary to compare scan[2] and match[2] since they\r\n * are always equal when the other bytes match, given that\r\n * the hash keys are equal and that HASH_BITS >= 8.\r\n */\r\n scanp += 2;\r\n matchp++;\r\n\r\n /* We check for insufficient lookahead only every 8th comparison;\r\n * the 256th check will be made at strstart+258.\r\n */\r\n do {} while (\r\n zip_window[++scanp] == zip_window[++matchp] &&\r\n zip_window[++scanp] == zip_window[++matchp] &&\r\n zip_window[++scanp] == zip_window[++matchp] &&\r\n zip_window[++scanp] == zip_window[++matchp] &&\r\n zip_window[++scanp] == zip_window[++matchp] &&\r\n zip_window[++scanp] == zip_window[++matchp] &&\r\n zip_window[++scanp] == zip_window[++matchp] &&\r\n zip_window[++scanp] == zip_window[++matchp] &&\r\n scanp < strendp\r\n );\r\n\r\n len = zip_MAX_MATCH - (strendp - scanp);\r\n scanp = strendp - zip_MAX_MATCH;\r\n\r\n if (len > best_len) {\r\n zip_match_start = cur_match;\r\n best_len = len;\r\n if (zip_FULL_SEARCH) {\r\n if (len >= zip_MAX_MATCH) break;\r\n } else {\r\n if (len >= zip_nice_match) break;\r\n }\r\n\r\n scan_end1 = zip_window[scanp + best_len - 1];\r\n scan_end = zip_window[scanp + best_len];\r\n }\r\n } while ((cur_match = zip_prev[cur_match & zip_WMASK]) > limit && --chain_length != 0);\r\n\r\n return best_len;\r\n }\r\n\r\n /* ==========================================================================\r\n * Fill the window when the lookahead becomes insufficient.\r\n * Updates strstart and lookahead, and sets eofile if end of input file.\r\n * IN assertion: lookahead < MIN_LOOKAHEAD && strstart + lookahead > 0\r\n * OUT assertions: at least one byte has been read, or eofile is set;\r\n * file reads are performed for at least two bytes (required for the\r\n * translate_eol option).\r\n */\r\n function zip_fill_window() {\r\n let n;\r\n let m;\r\n\r\n // Amount of free space at the end of the window.\r\n let more = zip_window_size - zip_lookahead - zip_strstart;\r\n\r\n /* If the window is almost full and there is insufficient lookahead,\r\n * move the upper half to the lower one to make room in the upper half.\r\n */\r\n if (more == -1) {\r\n /* Very unlikely, but possible on 16 bit machine if strstart == 0\r\n * and lookahead == 1 (input done one byte at time)\r\n */\r\n more--;\r\n } else if (zip_strstart >= zip_WSIZE + zip_MAX_DIST) {\r\n /* By the IN assertion, the window is not empty so we can't confuse\r\n * more == 0 with more == 64K on a 16 bit machine.\r\n */\r\n //\tAssert(window_size == (ulg)2*WSIZE, \"no sliding with BIG_MEM\");\r\n\r\n //\tSystem.arraycopy(window, WSIZE, window, 0, WSIZE);\r\n for (n = 0; n < zip_WSIZE; n++) zip_window[n] = zip_window[n + zip_WSIZE];\r\n\r\n zip_match_start -= zip_WSIZE;\r\n zip_strstart -= zip_WSIZE; /* we now have strstart >= MAX_DIST: */\r\n zip_block_start -= zip_WSIZE;\r\n\r\n for (n = 0; n < zip_HASH_SIZE; n++) {\r\n m = zip_head1(n);\r\n zip_head2(n, m >= zip_WSIZE ? m - zip_WSIZE : zip_NIL);\r\n }\r\n for (n = 0; n < zip_WSIZE; n++) {\r\n /* If n is not on any hash chain, prev[n] is garbage but\r\n * its value will never be used.\r\n */\r\n m = zip_prev[n];\r\n zip_prev[n] = m >= zip_WSIZE ? m - zip_WSIZE : zip_NIL;\r\n }\r\n more += zip_WSIZE;\r\n }\r\n // At this point, more >= 2\r\n if (!zip_eofile) {\r\n n = zip_read_buff(zip_window, zip_strstart + zip_lookahead, more);\r\n if (n <= 0) zip_eofile = true;\r\n else zip_lookahead += n;\r\n }\r\n }\r\n\r\n /* ==========================================================================\r\n * Processes a new input file and return its compressed length. This\r\n * function does not perform lazy evaluationof matches and inserts\r\n * new strings in the dictionary only for unmatched strings or for short\r\n * matches. It is used only for the fast compression options.\r\n */\r\n function zip_deflate_fast() {\r\n while (zip_lookahead != 0 && zip_qhead == null) {\r\n var flush; // set if current block must be flushed\r\n\r\n /* Insert the string window[strstart .. strstart+2] in the\r\n * dictionary, and set hash_head to the head of the hash chain:\r\n */\r\n zip_INSERT_STRING();\r\n\r\n /* Find the longest match, discarding those <= prev_length.\r\n * At this point we have always match_length < MIN_MATCH\r\n */\r\n if (zip_hash_head != zip_NIL && zip_strstart - zip_hash_head <= zip_MAX_DIST) {\r\n /* To simplify the code, we prevent matches with the string\r\n * of window index 0 (in particular we have to avoid a match\r\n * of the string with itself at the start of the input file).\r\n */\r\n zip_match_length = zip_longest_match(zip_hash_head);\r\n /* longest_match() sets match_start */\r\n if (zip_match_length > zip_lookahead) zip_match_length = zip_lookahead;\r\n }\r\n if (zip_match_length >= zip_MIN_MATCH) {\r\n //\t check_match(strstart, match_start, match_length);\r\n\r\n flush = zip_ct_tally(zip_strstart - zip_match_start, zip_match_length - zip_MIN_MATCH);\r\n zip_lookahead -= zip_match_length;\r\n\r\n /* Insert new strings in the hash table only if the match length\r\n * is not too large. This saves time but degrades compression.\r\n */\r\n if (zip_match_length <= zip_max_lazy_match) {\r\n zip_match_length--; // string at strstart already in hash table\r\n do {\r\n zip_strstart++;\r\n zip_INSERT_STRING();\r\n /* strstart never exceeds WSIZE-MAX_MATCH, so there are\r\n * always MIN_MATCH bytes ahead. If lookahead < MIN_MATCH\r\n * these bytes are garbage, but it does not matter since\r\n * the next lookahead bytes will be emitted as literals.\r\n */\r\n } while (--zip_match_length != 0);\r\n zip_strstart++;\r\n } else {\r\n zip_strstart += zip_match_length;\r\n zip_match_length = 0;\r\n zip_ins_h = zip_window[zip_strstart] & 0xff;\r\n //\t\tUPDATE_HASH(ins_h, window[strstart + 1]);\r\n zip_ins_h = ((zip_ins_h << zip_H_SHIFT) ^ (zip_window[zip_strstart + 1] & 0xff)) & zip_HASH_MASK;\r\n\r\n // #if MIN_MATCH != 3\r\n //\t\tCall UPDATE_HASH() MIN_MATCH-3 more times\r\n // #endif\r\n }\r\n } else {\r\n /* No match, output a literal byte */\r\n flush = zip_ct_tally(0, zip_window[zip_strstart] & 0xff);\r\n zip_lookahead--;\r\n zip_strstart++;\r\n }\r\n if (flush) {\r\n zip_flush_block(0);\r\n zip_block_start = zip_strstart;\r\n }\r\n\r\n /* Make sure that we always have enough lookahead, except\r\n * at the end of the input file. We need MAX_MATCH bytes\r\n * for the next match, plus MIN_MATCH bytes to insert the\r\n * string following the next match.\r\n */\r\n while (zip_lookahead < zip_MIN_LOOKAHEAD && !zip_eofile) zip_fill_window();\r\n }\r\n }\r\n\r\n function zip_deflate_better() {\r\n /* Process the input block. */\r\n while (zip_lookahead != 0 && zip_qhead == null) {\r\n /* Insert the string window[strstart .. strstart+2] in the\r\n * dictionary, and set hash_head to the head of the hash chain:\r\n */\r\n zip_INSERT_STRING();\r\n\r\n /* Find the longest match, discarding those <= prev_length.\r\n */\r\n zip_prev_length = zip_match_length;\r\n zip_prev_match = zip_match_start;\r\n zip_match_length = zip_MIN_MATCH - 1;\r\n\r\n if (\r\n zip_hash_head != zip_NIL &&\r\n zip_prev_length < zip_max_lazy_match &&\r\n zip_strstart - zip_hash_head <= zip_MAX_DIST\r\n ) {\r\n /* To simplify the code, we prevent matches with the string\r\n * of window index 0 (in particular we have to avoid a match\r\n * of the string with itself at the start of the input file).\r\n */\r\n zip_match_length = zip_longest_match(zip_hash_head);\r\n /* longest_match() sets match_start */\r\n if (zip_match_length > zip_lookahead) zip_match_length = zip_lookahead;\r\n\r\n /* Ignore a length 3 match if it is too distant: */\r\n if (zip_match_length == zip_MIN_MATCH && zip_strstart - zip_match_start > zip_TOO_FAR) {\r\n /* If prev_match is also MIN_MATCH, match_start is garbage\r\n * but we will ignore the current match anyway.\r\n */\r\n zip_match_length--;\r\n }\r\n }\r\n /* If there was a match at the previous step and the current\r\n * match is not better, output the previous match:\r\n */\r\n if (zip_prev_length >= zip_MIN_MATCH && zip_match_length <= zip_prev_length) {\r\n var flush; // set if current block must be flushed\r\n\r\n //\t check_match(strstart - 1, prev_match, prev_length);\r\n flush = zip_ct_tally(zip_strstart - 1 - zip_prev_match, zip_prev_length - zip_MIN_MATCH);\r\n\r\n /* Insert in hash table all strings up to the end of the match.\r\n * strstart-1 and strstart are already inserted.\r\n */\r\n zip_lookahead -= zip_prev_length - 1;\r\n zip_prev_length -= 2;\r\n do {\r\n zip_strstart++;\r\n zip_INSERT_STRING();\r\n /* strstart never exceeds WSIZE-MAX_MATCH, so there are\r\n * always MIN_MATCH bytes ahead. If lookahead < MIN_MATCH\r\n * these bytes are garbage, but it does not matter since the\r\n * next lookahead bytes will always be emitted as literals.\r\n */\r\n } while (--zip_prev_length != 0);\r\n zip_match_available = 0;\r\n zip_match_length = zip_MIN_MATCH - 1;\r\n zip_strstart++;\r\n if (flush) {\r\n zip_flush_block(0);\r\n zip_block_start = zip_strstart;\r\n }\r\n } else if (zip_match_available != 0) {\r\n /* If there was no match at the previous position, output a\r\n * single literal. If there was a match but the current match\r\n * is longer, truncate the previous match to a single literal.\r\n */\r\n if (zip_ct_tally(0, zip_window[zip_strstart - 1] & 0xff)) {\r\n zip_flush_block(0);\r\n zip_block_start = zip_strstart;\r\n }\r\n zip_strstart++;\r\n zip_lookahead--;\r\n } else {\r\n /* There is no previous match to compare with, wait for\r\n * the next step to decide.\r\n */\r\n zip_match_available = 1;\r\n zip_strstart++;\r\n zip_lookahead--;\r\n }\r\n\r\n /* Make sure that we always have enough lookahead, except\r\n * at the end of the input file. We need MAX_MATCH bytes\r\n * for the next match, plus MIN_MATCH bytes to insert the\r\n * string following the next match.\r\n */\r\n while (zip_lookahead < zip_MIN_LOOKAHEAD && !zip_eofile) zip_fill_window();\r\n }\r\n }\r\n\r\n function zip_init_deflate() {\r\n if (zip_eofile) return;\r\n zip_bi_buf = 0;\r\n zip_bi_valid = 0;\r\n zip_ct_init();\r\n zip_lm_init();\r\n\r\n zip_qhead = null;\r\n zip_outcnt = 0;\r\n zip_outoff = 0;\r\n\r\n if (zip_compr_level <= 3) {\r\n zip_prev_length = zip_MIN_MATCH - 1;\r\n zip_match_length = 0;\r\n } else {\r\n zip_match_length = zip_MIN_MATCH - 1;\r\n zip_match_available = 0;\r\n }\r\n\r\n zip_complete = false;\r\n }\r\n\r\n /* ==========================================================================\r\n * Same as above, but achieves better compression. We use a lazy\r\n * evaluation for matches: a match is finally adopted only if there is\r\n * no better match at the next window position.\r\n */\r\n function zip_deflate_internal(buff, off, buff_size) {\r\n let n;\r\n\r\n if (!zip_initflag) {\r\n zip_init_deflate();\r\n zip_initflag = true;\r\n if (zip_lookahead == 0) {\r\n // empty\r\n zip_complete = true;\r\n return 0;\r\n }\r\n }\r\n\r\n if ((n = zip_qcopy(buff, off, buff_size)) == buff_size) return buff_size;\r\n\r\n if (zip_complete) return n;\r\n\r\n if (zip_compr_level <= 3)\r\n // optimized for speed\r\n zip_deflate_fast();\r\n else zip_deflate_better();\r\n if (zip_lookahead == 0) {\r\n if (zip_match_available != 0) zip_ct_tally(0, zip_window[zip_strstart - 1] & 0xff);\r\n zip_flush_block(1);\r\n zip_complete = true;\r\n }\r\n return n + zip_qcopy(buff, n + off, buff_size - n);\r\n }\r\n\r\n function zip_qcopy(buff, off, buff_size) {\r\n let n;\r\n let i;\r\n let j;\r\n\r\n n = 0;\r\n while (zip_qhead != null && n < buff_size) {\r\n i = buff_size - n;\r\n if (i > zip_qhead.len) i = zip_qhead.len;\r\n // System.arraycopy(qhead.ptr, qhead.off, buff, off + n, i);\r\n for (j = 0; j < i; j++) buff[off + n + j] = zip_qhead.ptr[zip_qhead.off + j];\r\n\r\n zip_qhead.off += i;\r\n zip_qhead.len -= i;\r\n n += i;\r\n if (zip_qhead.len == 0) {\r\n var p;\r\n p = zip_qhead;\r\n zip_qhead = zip_qhead.next;\r\n zip_reuse_queue(p);\r\n }\r\n }\r\n\r\n if (n == buff_size) return n;\r\n\r\n if (zip_outoff < zip_outcnt) {\r\n i = buff_size - n;\r\n if (i > zip_outcnt - zip_outoff) i = zip_outcnt - zip_outoff;\r\n // System.arraycopy(outbuf, outoff, buff, off + n, i);\r\n for (j = 0; j < i; j++) buff[off + n + j] = zip_outbuf[zip_outoff + j];\r\n zip_outoff += i;\r\n n += i;\r\n if (zip_outcnt == zip_outoff) zip_outcnt = zip_outoff = 0;\r\n }\r\n return n;\r\n }\r\n\r\n /* ==========================================================================\r\n * Allocate the match buffer, initialize the various tables and save the\r\n * location of the internal file attribute (ascii/binary) and method\r\n * (DEFLATE/STORE).\r\n */\r\n function zip_ct_init() {\r\n let n; // iterates over tree elements\r\n let bits; // bit counter\r\n let length; // length value\r\n let code; // code value\r\n let dist; // distance index\r\n\r\n if (zip_static_dtree[0].dl != 0) return; // ct_init already called\r\n\r\n zip_l_desc.dyn_tree = zip_dyn_ltree;\r\n zip_l_desc.static_tree = zip_static_ltree;\r\n zip_l_desc.extra_bits = zip_extra_lbits;\r\n zip_l_desc.extra_base = zip_LITERALS + 1;\r\n zip_l_desc.elems = zip_L_CODES;\r\n zip_l_desc.max_length = zip_MAX_BITS;\r\n zip_l_desc.max_code = 0;\r\n\r\n zip_d_desc.dyn_tree = zip_dyn_dtree;\r\n zip_d_desc.static_tree = zip_static_dtree;\r\n zip_d_desc.extra_bits = zip_extra_dbits;\r\n zip_d_desc.extra_base = 0;\r\n zip_d_desc.elems = zip_D_CODES;\r\n zip_d_desc.max_length = zip_MAX_BITS;\r\n zip_d_desc.max_code = 0;\r\n\r\n zip_bl_desc.dyn_tree = zip_bl_tree;\r\n zip_bl_desc.static_tree = null;\r\n zip_bl_desc.extra_bits = zip_extra_blbits;\r\n zip_bl_desc.extra_base = 0;\r\n zip_bl_desc.elems = zip_BL_CODES;\r\n zip_bl_desc.max_length = zip_MAX_BL_BITS;\r\n zip_bl_desc.max_code = 0;\r\n\r\n // Initialize the mapping length (0..255) -> length code (0..28)\r\n length = 0;\r\n for (code = 0; code < zip_LENGTH_CODES - 1; code++) {\r\n zip_base_length[code] = length;\r\n for (n = 0; n < 1 << zip_extra_lbits[code]; n++) zip_length_code[length++] = code;\r\n }\r\n // Assert (length == 256, \"ct_init: length != 256\");\r\n\r\n /* Note that the length 255 (match length 258) can be represented\r\n * in two different ways: code 284 + 5 bits or code 285, so we\r\n * overwrite length_code[255] to use the best encoding:\r\n */\r\n zip_length_code[length - 1] = code;\r\n\r\n /* Initialize the mapping dist (0..32K) -> dist code (0..29) */\r\n dist = 0;\r\n for (code = 0; code < 16; code++) {\r\n zip_base_dist[code] = dist;\r\n for (n = 0; n < 1 << zip_extra_dbits[code]; n++) {\r\n zip_dist_code[dist++] = code;\r\n }\r\n }\r\n // Assert (dist == 256, \"ct_init: dist != 256\");\r\n dist >>= 7; // from now on, all distances are divided by 128\r\n for (; code < zip_D_CODES; code++) {\r\n zip_base_dist[code] = dist << 7;\r\n for (n = 0; n < 1 << (zip_extra_dbits[code] - 7); n++) zip_dist_code[256 + dist++] = code;\r\n }\r\n // Assert (dist == 256, \"ct_init: 256+dist != 512\");\r\n\r\n // Construct the codes of the static literal tree\r\n for (bits = 0; bits <= zip_MAX_BITS; bits++) zip_bl_count[bits] = 0;\r\n n = 0;\r\n while (n <= 143) {\r\n zip_static_ltree[n++].dl = 8;\r\n zip_bl_count[8]++;\r\n }\r\n while (n <= 255) {\r\n zip_static_ltree[n++].dl = 9;\r\n zip_bl_count[9]++;\r\n }\r\n while (n <= 279) {\r\n zip_static_ltree[n++].dl = 7;\r\n zip_bl_count[7]++;\r\n }\r\n while (n <= 287) {\r\n zip_static_ltree[n++].dl = 8;\r\n zip_bl_count[8]++;\r\n }\r\n /* Codes 286 and 287 do not exist, but we must include them in the\r\n * tree construction to get a canonical Huffman tree (longest code\r\n * all ones)\r\n */\r\n zip_gen_codes(zip_static_ltree, zip_L_CODES + 1);\r\n\r\n /* The static distance tree is trivial: */\r\n for (n = 0; n < zip_D_CODES; n++) {\r\n zip_static_dtree[n].dl = 5;\r\n zip_static_dtree[n].fc = zip_bi_reverse(n, 5);\r\n }\r\n\r\n // Initialize the first block of the first file:\r\n zip_init_block();\r\n }\r\n\r\n /* ==========================================================================\r\n * Initialize a new block.\r\n */\r\n function zip_init_block() {\r\n let n; // iterates over tree elements\r\n\r\n // Initialize the trees.\r\n for (n = 0; n < zip_L_CODES; n++) zip_dyn_ltree[n].fc = 0;\r\n for (n = 0; n < zip_D_CODES; n++) zip_dyn_dtree[n].fc = 0;\r\n for (n = 0; n < zip_BL_CODES; n++) zip_bl_tree[n].fc = 0;\r\n\r\n zip_dyn_ltree[zip_END_BLOCK].fc = 1;\r\n zip_opt_len = zip_static_len = 0;\r\n zip_last_lit = zip_last_dist = zip_last_flags = 0;\r\n zip_flags = 0;\r\n zip_flag_bit = 1;\r\n }\r\n\r\n /* ==========================================================================\r\n * Restore the heap property by moving down the tree starting at node k,\r\n * exchanging a node with the smallest of its two sons if necessary, stopping\r\n * when the heap property is re-established (each father smaller than its\r\n * two sons).\r\n */\r\n function zip_pqdownheap(\r\n tree, // the tree to restore\r\n k,\r\n ) {\r\n // node to move down\r\n const v = zip_heap[k];\r\n let j = k << 1; // left son of k\r\n\r\n while (j <= zip_heap_len) {\r\n // Set j to the smallest of the two sons:\r\n if (j < zip_heap_len && zip_SMALLER(tree, zip_heap[j + 1], zip_heap[j])) j++;\r\n\r\n // Exit if v is smaller than both sons\r\n if (zip_SMALLER(tree, v, zip_heap[j])) break;\r\n\r\n // Exchange v with the smallest son\r\n zip_heap[k] = zip_heap[j];\r\n k = j;\r\n\r\n // And continue down the tree, setting j to the left son of k\r\n j <<= 1;\r\n }\r\n zip_heap[k] = v;\r\n }\r\n\r\n /* ==========================================================================\r\n * Compute the optimal bit lengths for a tree and update the total bit length\r\n * for the current block.\r\n * IN assertion: the fields freq and dad are set, heap[heap_max] and\r\n * above are the tree nodes sorted by increasing frequency.\r\n * OUT assertions: the field len is set to the optimal bit length, the\r\n * array bl_count contains the frequencies for each bit length.\r\n * The length opt_len is updated; static_len is also updated if stree is\r\n * not null.\r\n */\r\n function zip_gen_bitlen(desc) {\r\n // the tree descriptor\r\n const tree = desc.dyn_tree;\r\n const extra = desc.extra_bits;\r\n const base = desc.extra_base;\r\n const { max_code } = desc;\r\n const { max_length } = desc;\r\n const stree = desc.static_tree;\r\n let h; // heap index\r\n let n;\r\n let m; // iterate over the tree elements\r\n let bits; // bit length\r\n let xbits; // extra bits\r\n let f; // frequency\r\n let overflow = 0; // number of elements with bit length too large\r\n\r\n for (bits = 0; bits <= zip_MAX_BITS; bits++) zip_bl_count[bits] = 0;\r\n\r\n /* In a first pass, compute the optimal bit lengths (which may\r\n * overflow in the case of the bit length tree).\r\n */\r\n tree[zip_heap[zip_heap_max]].dl = 0; // root of the heap\r\n\r\n for (h = zip_heap_max + 1; h < zip_HEAP_SIZE; h++) {\r\n n = zip_heap[h];\r\n bits = tree[tree[n].dl].dl + 1;\r\n if (bits > max_length) {\r\n bits = max_length;\r\n overflow++;\r\n }\r\n tree[n].dl = bits;\r\n // We overwrite tree[n].dl which is no longer needed\r\n\r\n if (n > max_code) continue; // not a leaf node\r\n\r\n zip_bl_count[bits]++;\r\n xbits = 0;\r\n if (n >= base) xbits = extra[n - base];\r\n f = tree[n].fc;\r\n zip_opt_len += f * (bits + xbits);\r\n if (stree != null) zip_static_len += f * (stree[n].dl + xbits);\r\n }\r\n if (overflow == 0) return;\r\n\r\n // This happens for example on obj2 and pic of the Calgary corpus\r\n\r\n // Find the first bit length which could increase:\r\n do {\r\n bits = max_length - 1;\r\n while (zip_bl_count[bits] == 0) bits--;\r\n zip_bl_count[bits]--; // move one leaf down the tree\r\n zip_bl_count[bits + 1] += 2; // move one overflow item as its brother\r\n zip_bl_count[max_length]--;\r\n /* The brother of the overflow item also moves one step up,\r\n * but this does not affect bl_count[max_length]\r\n */\r\n overflow -= 2;\r\n } while (overflow > 0);\r\n\r\n /* Now recompute all bit lengths, scanning in increasing frequency.\r\n * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all\r\n * lengths instead of fixing only the wrong ones. This idea is taken\r\n * from 'ar' written by Haruhiko Okumura.)\r\n */\r\n for (bits = max_length; bits != 0; bits--) {\r\n n = zip_bl_count[bits];\r\n while (n != 0) {\r\n m = zip_heap[--h];\r\n if (m > max_code) continue;\r\n if (tree[m].dl != bits) {\r\n zip_opt_len += (bits - tree[m].dl) * tree[m].fc;\r\n tree[m].fc = bits;\r\n }\r\n n--;\r\n }\r\n }\r\n }\r\n\r\n /* ==========================================================================\r\n * Generate the codes for a given tree and bit counts (which need not be\r\n * optimal).\r\n * IN assertion: the array bl_count contains the bit length statistics for\r\n * the given tree and the field len is set for all tree elements.\r\n * OUT assertion: the field code is set for all tree elements of non\r\n * zero code length.\r\n */\r\n function zip_gen_codes(\r\n tree, // the tree to decorate\r\n max_code,\r\n ) {\r\n // largest code with non zero frequency\r\n const next_code = new Array(zip_MAX_BITS + 1); // next code value for each bit length\r\n let code = 0; // running code value\r\n let bits; // bit index\r\n let n; // code index\r\n\r\n /* The distribution counts are first used to generate the code values\r\n * without bit reversal.\r\n */\r\n for (bits = 1; bits <= zip_MAX_BITS; bits++) {\r\n code = (code + zip_bl_count[bits - 1]) << 1;\r\n next_code[bits] = code;\r\n }\r\n\r\n /* Check that the bit counts in bl_count are consistent. The last code\r\n * must be all ones.\r\n */\r\n // Assert (code + encoder->bl_count[MAX_BITS]-1 == (1<> 1; n >= 1; n--) zip_pqdownheap(tree, n);\r\n\r\n /* Construct the Huffman tree by repeatedly combining the least two\r\n * frequent nodes.\r\n */\r\n do {\r\n n = zip_heap[zip_SMALLEST];\r\n zip_heap[zip_SMALLEST] = zip_heap[zip_heap_len--];\r\n zip_pqdownheap(tree, zip_SMALLEST);\r\n\r\n m = zip_heap[zip_SMALLEST]; // m = node of next least frequency\r\n\r\n // keep the nodes sorted by frequency\r\n zip_heap[--zip_heap_max] = n;\r\n zip_heap[--zip_heap_max] = m;\r\n\r\n // Create a new node father of n and m\r\n tree[node].fc = tree[n].fc + tree[m].fc;\r\n //\tdepth[node] = (char)(MAX(depth[n], depth[m]) + 1);\r\n if (zip_depth[n] > zip_depth[m] + 1) zip_depth[node] = zip_depth[n];\r\n else zip_depth[node] = zip_depth[m] + 1;\r\n tree[n].dl = tree[m].dl = node;\r\n\r\n // and insert the new node in the heap\r\n zip_heap[zip_SMALLEST] = node++;\r\n zip_pqdownheap(tree, zip_SMALLEST);\r\n } while (zip_heap_len >= 2);\r\n\r\n zip_heap[--zip_heap_max] = zip_heap[zip_SMALLEST];\r\n\r\n /* At this point, the fields freq and dad are set. We can now\r\n * generate the bit lengths.\r\n */\r\n zip_gen_bitlen(desc);\r\n\r\n // The field len is now set, we can generate the bit codes\r\n zip_gen_codes(tree, max_code);\r\n }\r\n\r\n /* ==========================================================================\r\n * Scan a literal or distance tree to determine the frequencies of the codes\r\n * in the bit length tree. Updates opt_len to take into account the repeat\r\n * counts. (The contribution of the bit length codes will be added later\r\n * during the construction of bl_tree.)\r\n */\r\n function zip_scan_tree(\r\n tree, // the tree to be scanned\r\n max_code,\r\n ) {\r\n // and its largest code of non zero frequency\r\n let n; // iterates over all tree elements\r\n let prevlen = -1; // last emitted length\r\n let curlen; // length of current code\r\n let nextlen = tree[0].dl; // length of next code\r\n let count = 0; // repeat count of the current code\r\n let max_count = 7; // max repeat count\r\n let min_count = 4; // min repeat count\r\n\r\n if (nextlen == 0) {\r\n max_count = 138;\r\n min_count = 3;\r\n }\r\n tree[max_code + 1].dl = 0xffff; // guard\r\n\r\n for (n = 0; n <= max_code; n++) {\r\n curlen = nextlen;\r\n nextlen = tree[n + 1].dl;\r\n if (++count < max_count && curlen == nextlen) continue;\r\n else if (count < min_count) zip_bl_tree[curlen].fc += count;\r\n else if (curlen != 0) {\r\n if (curlen != prevlen) zip_bl_tree[curlen].fc++;\r\n zip_bl_tree[zip_REP_3_6].fc++;\r\n } else if (count <= 10) zip_bl_tree[zip_REPZ_3_10].fc++;\r\n else zip_bl_tree[zip_REPZ_11_138].fc++;\r\n count = 0;\r\n prevlen = curlen;\r\n if (nextlen == 0) {\r\n max_count = 138;\r\n min_count = 3;\r\n } else if (curlen == nextlen) {\r\n max_count = 6;\r\n min_count = 3;\r\n } else {\r\n max_count = 7;\r\n min_count = 4;\r\n }\r\n }\r\n }\r\n\r\n /* ==========================================================================\r\n * Send a literal or distance tree in compressed form, using the codes in\r\n * bl_tree.\r\n */\r\n function zip_send_tree(\r\n tree, // the tree to be scanned\r\n max_code,\r\n ) {\r\n // and its largest code of non zero frequency\r\n let n; // iterates over all tree elements\r\n let prevlen = -1; // last emitted length\r\n let curlen; // length of current code\r\n let nextlen = tree[0].dl; // length of next code\r\n let count = 0; // repeat count of the current code\r\n let max_count = 7; // max repeat count\r\n let min_count = 4; /* guard already set */ // min repeat count\r\n\r\n /* tree[max_code+1].dl = -1; */ if (nextlen == 0) {\r\n max_count = 138;\r\n min_count = 3;\r\n }\r\n\r\n for (n = 0; n <= max_code; n++) {\r\n curlen = nextlen;\r\n nextlen = tree[n + 1].dl;\r\n if (++count < max_count && curlen == nextlen) {\r\n continue;\r\n } else if (count < min_count) {\r\n do {\r\n zip_SEND_CODE(curlen, zip_bl_tree);\r\n } while (--count != 0);\r\n } else if (curlen != 0) {\r\n if (curlen != prevlen) {\r\n zip_SEND_CODE(curlen, zip_bl_tree);\r\n count--;\r\n }\r\n // Assert(count >= 3 && count <= 6, \" 3_6?\");\r\n zip_SEND_CODE(zip_REP_3_6, zip_bl_tree);\r\n zip_send_bits(count - 3, 2);\r\n } else if (count <= 10) {\r\n zip_SEND_CODE(zip_REPZ_3_10, zip_bl_tree);\r\n zip_send_bits(count - 3, 3);\r\n } else {\r\n zip_SEND_CODE(zip_REPZ_11_138, zip_bl_tree);\r\n zip_send_bits(count - 11, 7);\r\n }\r\n count = 0;\r\n prevlen = curlen;\r\n if (nextlen == 0) {\r\n max_count = 138;\r\n min_count = 3;\r\n } else if (curlen == nextlen) {\r\n max_count = 6;\r\n min_count = 3;\r\n } else {\r\n max_count = 7;\r\n min_count = 4;\r\n }\r\n }\r\n }\r\n\r\n /* ==========================================================================\r\n * Construct the Huffman tree for the bit lengths and return the index in\r\n * bl_order of the last bit length code to send.\r\n */\r\n function zip_build_bl_tree() {\r\n let max_blindex; // index of last bit length code of non zero freq\r\n\r\n // Determine the bit length frequencies for literal and distance trees\r\n zip_scan_tree(zip_dyn_ltree, zip_l_desc.max_code);\r\n zip_scan_tree(zip_dyn_dtree, zip_d_desc.max_code);\r\n\r\n // Build the bit length tree:\r\n zip_build_tree(zip_bl_desc);\r\n /* opt_len now includes the length of the tree representations, except\r\n * the lengths of the bit lengths codes and the 5+5+4 bits for the counts.\r\n */\r\n\r\n /* Determine the number of bit length codes to send. The pkzip format\r\n * requires that at least 4 bit length codes be sent. (appnote.txt says\r\n * 3 but the actual value used is 4.)\r\n */\r\n for (max_blindex = zip_BL_CODES - 1; max_blindex >= 3; max_blindex--) {\r\n if (zip_bl_tree[zip_bl_order[max_blindex]].dl != 0) break;\r\n }\r\n /* Update opt_len to include the bit length tree and counts */\r\n zip_opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4;\r\n // Tracev((stderr, \"\\ndyn trees: dyn %ld, stat %ld\",\r\n //\t encoder->opt_len, encoder->static_len));\r\n\r\n return max_blindex;\r\n }\r\n\r\n /* ==========================================================================\r\n * Send the header for a block using dynamic Huffman trees: the counts, the\r\n * lengths of the bit length codes, the literal tree and the distance tree.\r\n * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.\r\n */\r\n function zip_send_all_trees(lcodes, dcodes, blcodes) {\r\n // number of codes for each tree\r\n let rank; // index in bl_order\r\n\r\n // Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, \"not enough codes\");\r\n // Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,\r\n //\t \"too many codes\");\r\n // Tracev((stderr, \"\\nbl counts: \"));\r\n zip_send_bits(lcodes - 257, 5); // not +255 as stated in appnote.txt\r\n zip_send_bits(dcodes - 1, 5);\r\n zip_send_bits(blcodes - 4, 4); // not -3 as stated in appnote.txt\r\n for (rank = 0; rank < blcodes; rank++) {\r\n // Tracev((stderr, \"\\nbl code %2d \", bl_order[rank]));\r\n zip_send_bits(zip_bl_tree[zip_bl_order[rank]].dl, 3);\r\n }\r\n\r\n // send the literal tree\r\n zip_send_tree(zip_dyn_ltree, lcodes - 1);\r\n\r\n // send the distance tree\r\n zip_send_tree(zip_dyn_dtree, dcodes - 1);\r\n }\r\n\r\n /* ==========================================================================\r\n * Determine the best encoding for the current block: dynamic trees, static\r\n * trees or store, and output the encoded block to the zip file.\r\n */\r\n function zip_flush_block(eof) {\r\n // true if this is the last block for a file\r\n let opt_lenb;\r\n let static_lenb; // opt_len and static_len in bytes\r\n let max_blindex; // index of last bit length code of non zero freq\r\n let stored_len; // length of input block\r\n\r\n stored_len = zip_strstart - zip_block_start;\r\n zip_flag_buf[zip_last_flags] = zip_flags; // Save the flags for the last 8 items\r\n\r\n // Construct the literal and distance trees\r\n zip_build_tree(zip_l_desc);\r\n // Tracev((stderr, \"\\nlit data: dyn %ld, stat %ld\",\r\n //\t encoder->opt_len, encoder->static_len));\r\n\r\n zip_build_tree(zip_d_desc);\r\n // Tracev((stderr, \"\\ndist data: dyn %ld, stat %ld\",\r\n //\t encoder->opt_len, encoder->static_len));\r\n /* At this point, opt_len and static_len are the total bit lengths of\r\n * the compressed block data, excluding the tree representations.\r\n */\r\n\r\n /* Build the bit length tree for the above two trees, and get the index\r\n * in bl_order of the last bit length code to send.\r\n */\r\n max_blindex = zip_build_bl_tree();\r\n\r\n // Determine the best encoding. Compute first the block length in bytes\r\n opt_lenb = (zip_opt_len + 3 + 7) >> 3;\r\n static_lenb = (zip_static_len + 3 + 7) >> 3;\r\n\r\n // Trace((stderr, \"\\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u dist %u \",\r\n //\t opt_lenb, encoder->opt_len,\r\n //\t static_lenb, encoder->static_len, stored_len,\r\n //\t encoder->last_lit, encoder->last_dist));\r\n\r\n if (static_lenb <= opt_lenb) opt_lenb = static_lenb;\r\n if (\r\n stored_len + 4 <= opt_lenb && // 4: two words for the lengths\r\n zip_block_start >= 0\r\n ) {\r\n let i;\r\n\r\n /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.\r\n * Otherwise we can't have processed more than WSIZE input bytes since\r\n * the last block flush, because compression would have been\r\n * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to\r\n * transform a block into a stored block.\r\n */\r\n zip_send_bits((zip_STORED_BLOCK << 1) + eof, 3); /* send block type */\r\n zip_bi_windup(); /* align on byte boundary */\r\n zip_put_short(stored_len);\r\n zip_put_short(~stored_len);\r\n\r\n // copy block\r\n /*\r\n p = &window[block_start];\r\n for(i = 0; i < stored_len; i++)\r\n\tput_byte(p[i]);\r\n*/\r\n for (i = 0; i < stored_len; i++) zip_put_byte(zip_window[zip_block_start + i]);\r\n } else if (static_lenb == opt_lenb) {\r\n zip_send_bits((zip_STATIC_TREES << 1) + eof, 3);\r\n zip_compress_block(zip_static_ltree, zip_static_dtree);\r\n } else {\r\n zip_send_bits((zip_DYN_TREES << 1) + eof, 3);\r\n zip_send_all_trees(zip_l_desc.max_code + 1, zip_d_desc.max_code + 1, max_blindex + 1);\r\n zip_compress_block(zip_dyn_ltree, zip_dyn_dtree);\r\n }\r\n\r\n zip_init_block();\r\n\r\n if (eof != 0) zip_bi_windup();\r\n }\r\n\r\n /* ==========================================================================\r\n * Save the match info and tally the frequency counts. Return true if\r\n * the current block must be flushed.\r\n */\r\n function zip_ct_tally(\r\n dist, // distance of matched string\r\n lc,\r\n ) {\r\n // match length-MIN_MATCH or unmatched char (if dist==0)\r\n zip_l_buf[zip_last_lit++] = lc;\r\n if (dist == 0) {\r\n // lc is the unmatched char\r\n zip_dyn_ltree[lc].fc++;\r\n } else {\r\n // Here, lc is the match length - MIN_MATCH\r\n dist--; // dist = match distance - 1\r\n // Assert((ush)dist < (ush)MAX_DIST &&\r\n //\t (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) &&\r\n //\t (ush)D_CODE(dist) < (ush)D_CODES, \"ct_tally: bad match\");\r\n\r\n zip_dyn_ltree[zip_length_code[lc] + zip_LITERALS + 1].fc++;\r\n zip_dyn_dtree[zip_D_CODE(dist)].fc++;\r\n\r\n zip_d_buf[zip_last_dist++] = dist;\r\n zip_flags |= zip_flag_bit;\r\n }\r\n zip_flag_bit <<= 1;\r\n\r\n // Output the flags if they fill a byte\r\n if ((zip_last_lit & 7) == 0) {\r\n zip_flag_buf[zip_last_flags++] = zip_flags;\r\n zip_flags = 0;\r\n zip_flag_bit = 1;\r\n }\r\n // Try to guess if it is profitable to stop the current block here\r\n if (zip_compr_level > 2 && (zip_last_lit & 0xfff) == 0) {\r\n // Compute an upper bound for the compressed length\r\n let out_length = zip_last_lit * 8;\r\n const in_length = zip_strstart - zip_block_start;\r\n let dcode;\r\n\r\n for (dcode = 0; dcode < zip_D_CODES; dcode++) {\r\n out_length += zip_dyn_dtree[dcode].fc * (5 + zip_extra_dbits[dcode]);\r\n }\r\n out_length >>= 3;\r\n // Trace((stderr,\"\\nlast_lit %u, last_dist %u, in %ld, out ~%ld(%ld%%) \",\r\n //\t encoder->last_lit, encoder->last_dist, in_length, out_length,\r\n //\t 100L - out_length*100L/in_length));\r\n if (zip_last_dist < parseInt(zip_last_lit / 2) && out_length < parseInt(in_length / 2)) return true;\r\n }\r\n return zip_last_lit == zip_LIT_BUFSIZE - 1 || zip_last_dist == zip_DIST_BUFSIZE;\r\n /* We avoid equality with LIT_BUFSIZE because of wraparound at 64K\r\n * on 16 bit machines and because stored blocks are restricted to\r\n * 64K-1 bytes.\r\n */\r\n }\r\n\r\n /* ==========================================================================\r\n * Send the block data compressed using the given Huffman trees\r\n */\r\n function zip_compress_block(\r\n ltree, // literal tree\r\n dtree,\r\n ) {\r\n // distance tree\r\n let dist; // distance of matched string\r\n let lc; // match length or unmatched char (if dist == 0)\r\n let lx = 0; // running index in l_buf\r\n let dx = 0; // running index in d_buf\r\n let fx = 0; // running index in flag_buf\r\n let flag = 0; // current flags\r\n let code; // the code to send\r\n let extra; // number of extra bits to send\r\n\r\n if (zip_last_lit != 0)\r\n do {\r\n if ((lx & 7) == 0) flag = zip_flag_buf[fx++];\r\n lc = zip_l_buf[lx++] & 0xff;\r\n if ((flag & 1) == 0) {\r\n zip_SEND_CODE(lc, ltree); /* send a literal byte */\r\n //\tTracecv(isgraph(lc), (stderr,\" '%c' \", lc));\r\n } else {\r\n // Here, lc is the match length - MIN_MATCH\r\n code = zip_length_code[lc];\r\n zip_SEND_CODE(code + zip_LITERALS + 1, ltree); // send the length code\r\n extra = zip_extra_lbits[code];\r\n if (extra != 0) {\r\n lc -= zip_base_length[code];\r\n zip_send_bits(lc, extra); // send the extra length bits\r\n }\r\n dist = zip_d_buf[dx++];\r\n // Here, dist is the match distance - 1\r\n code = zip_D_CODE(dist);\r\n //\tAssert (code < D_CODES, \"bad d_code\");\r\n\r\n zip_SEND_CODE(code, dtree); // send the distance code\r\n extra = zip_extra_dbits[code];\r\n if (extra != 0) {\r\n dist -= zip_base_dist[code];\r\n zip_send_bits(dist, extra); // send the extra distance bits\r\n }\r\n } // literal or match pair ?\r\n flag >>= 1;\r\n } while (lx < zip_last_lit);\r\n\r\n zip_SEND_CODE(zip_END_BLOCK, ltree);\r\n }\r\n\r\n /* ==========================================================================\r\n * Send a value on a given number of bits.\r\n * IN assertion: length <= 16 and value fits in length bits.\r\n */\r\n const zip_Buf_size = 16; // bit size of bi_buf\r\n function zip_send_bits(\r\n value, // value to send\r\n length,\r\n ) {\r\n // number of bits\r\n /* If not enough room in bi_buf, use (valid) bits from bi_buf and\r\n * (16 - bi_valid) bits from value, leaving (width - (16-bi_valid))\r\n * unused bits in value.\r\n */\r\n if (zip_bi_valid > zip_Buf_size - length) {\r\n zip_bi_buf |= value << zip_bi_valid;\r\n zip_put_short(zip_bi_buf);\r\n zip_bi_buf = value >> (zip_Buf_size - zip_bi_valid);\r\n zip_bi_valid += length - zip_Buf_size;\r\n } else {\r\n zip_bi_buf |= value << zip_bi_valid;\r\n zip_bi_valid += length;\r\n }\r\n }\r\n\r\n /* ==========================================================================\r\n * Reverse the first len bits of a code, using straightforward code (a faster\r\n * method would use a table)\r\n * IN assertion: 1 <= len <= 15\r\n */\r\n function zip_bi_reverse(\r\n code, // the value to invert\r\n len,\r\n ) {\r\n // its bit length\r\n let res = 0;\r\n do {\r\n res |= code & 1;\r\n code >>= 1;\r\n res <<= 1;\r\n } while (--len > 0);\r\n return res >> 1;\r\n }\r\n\r\n /* ==========================================================================\r\n * Write out any remaining bits in an incomplete byte.\r\n */\r\n function zip_bi_windup() {\r\n if (zip_bi_valid > 8) {\r\n zip_put_short(zip_bi_buf);\r\n } else if (zip_bi_valid > 0) {\r\n zip_put_byte(zip_bi_buf);\r\n }\r\n zip_bi_buf = 0;\r\n zip_bi_valid = 0;\r\n }\r\n\r\n function zip_qoutbuf() {\r\n if (zip_outcnt != 0) {\r\n let q;\r\n let i;\r\n q = zip_new_queue();\r\n if (zip_qhead == null) zip_qhead = zip_qtail = q;\r\n else zip_qtail = zip_qtail.next = q;\r\n q.len = zip_outcnt - zip_outoff;\r\n // System.arraycopy(zip_outbuf, zip_outoff, q.ptr, 0, q.len);\r\n for (i = 0; i < q.len; i++) q.ptr[i] = zip_outbuf[zip_outoff + i];\r\n zip_outcnt = zip_outoff = 0;\r\n }\r\n }\r\n\r\n return function deflate(str, level) {\r\n let i;\r\n let j;\r\n\r\n zip_deflate_data = str;\r\n zip_deflate_pos = 0;\r\n if (typeof level === 'undefined') level = zip_DEFAULT_LEVEL;\r\n zip_deflate_start(level);\r\n\r\n const buff = new Array(1024);\r\n const aout = [];\r\n while ((i = zip_deflate_internal(buff, 0, buff.length)) > 0) {\r\n const cbuf = new Array(i);\r\n for (j = 0; j < i; j++) {\r\n cbuf[j] = String.fromCharCode(buff[j]);\r\n }\r\n aout[aout.length] = cbuf.join('');\r\n }\r\n zip_deflate_data = null; // G.C.\r\n return aout.join('');\r\n };\r\n})();\r\n\r\nexport default deflate;\r\n","// @ts-nocheck\r\n/**\r\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nimport mergeWith from 'lodash/mergeWith';\r\nimport deflate from '@/libs/rawdeflate';\r\n\r\nfunction encode64(data) {\r\n let r = '';\r\n for (let i = 0; i < data.length; i += 3) {\r\n if (i + 2 === data.length) {\r\n r += append3bytes(data.charCodeAt(i), data.charCodeAt(i + 1), 0);\r\n } else if (i + 1 === data.length) {\r\n r += append3bytes(data.charCodeAt(i), 0, 0);\r\n } else {\r\n r += append3bytes(data.charCodeAt(i), data.charCodeAt(i + 1), data.charCodeAt(i + 2));\r\n }\r\n }\r\n return r;\r\n}\r\n\r\nfunction append3bytes(b1, b2, b3) {\r\n const c1 = b1 >> 2;\r\n const c2 = ((b1 & 0x3) << 4) | (b2 >> 4);\r\n const c3 = ((b2 & 0xf) << 2) | (b3 >> 6);\r\n const c4 = b3 & 0x3f;\r\n let r = '';\r\n r += encode6bit(c1 & 0x3f);\r\n r += encode6bit(c2 & 0x3f);\r\n r += encode6bit(c3 & 0x3f);\r\n r += encode6bit(c4 & 0x3f);\r\n return r;\r\n}\r\n\r\nfunction encode6bit(b1) {\r\n let b = b1;\r\n if (b < 10) {\r\n return String.fromCharCode(48 + b);\r\n }\r\n b -= 10;\r\n if (b < 26) {\r\n return String.fromCharCode(65 + b);\r\n }\r\n b -= 26;\r\n if (b < 26) {\r\n return String.fromCharCode(97 + b);\r\n }\r\n b -= 26;\r\n if (b === 0) {\r\n return '-';\r\n }\r\n if (b === 1) {\r\n return '_';\r\n }\r\n return '?';\r\n}\r\n\r\nfunction compress(s1, url) {\r\n const s = unescape(encodeURIComponent(s1));\r\n return `${url}/svg/${encode64(deflate(s, 9))}`;\r\n}\r\n\r\nexport default class PlantUMLCodeEngine {\r\n static install(cherryOptions, args) {\r\n mergeWith(cherryOptions, {\r\n engine: {\r\n syntax: {\r\n codeBlock: {\r\n customRenderer: {\r\n plantuml: new PlantUMLCodeEngine({\r\n ...args,\r\n ...(cherryOptions.engine.syntax.plantuml ?? {}),\r\n }),\r\n },\r\n },\r\n },\r\n },\r\n });\r\n }\r\n\r\n constructor(plantUMLOptions = {}) {\r\n const defaultUrl = 'http://www.plantuml.com/plantuml';\r\n this.baseUrl = plantUMLOptions.baseUrl ?? defaultUrl;\r\n }\r\n\r\n render(src, sign) {\r\n let $sign = sign;\r\n if (!$sign) {\r\n $sign = Math.round(Math.random() * 100000000);\r\n }\r\n const graphId = `plantuml-${$sign}-${new Date().getTime()}`;\r\n return ``;\r\n }\r\n}\r\n","/*! For license information please see mermaid.esm.min.mjs.LICENSE.txt */\nvar t={1362:(t,e,n)=>{t=n.nmd(t);var r=function(){var t=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},e=[1,6],n=[1,7],r=[1,8],i=[1,9],a=[1,12],o=[1,11],s=[1,15,24],c=[1,19],u=[1,31],l=[1,34],h=[1,32],f=[1,33],d=[1,35],p=[1,36],y=[1,37],g=[1,38],m=[1,41],v=[1,42],b=[1,43],_=[1,44],x=[15,24],w=[1,56],k=[1,57],T=[1,58],E=[1,59],C=[1,60],S=[1,61],A=[15,24,31,38,39,47,50,51,52,53,54,55,60,62],M=[15,24,29,31,38,39,43,47,50,51,52,53,54,55,60,62,77,78,79,80],N=[7,8,9,10,15,18,22,24],D=[47,77,78,79,80],O=[47,54,55,77,78,79,80],B=[47,50,51,52,53,77,78,79,80],L=[15,24,31],I=[1,93],R={trace:function(){},yy:{},symbols_:{error:2,start:3,mermaidDoc:4,direction:5,directive:6,direction_tb:7,direction_bt:8,direction_rl:9,direction_lr:10,graphConfig:11,openDirective:12,typeDirective:13,closeDirective:14,NEWLINE:15,\":\":16,argDirective:17,open_directive:18,type_directive:19,arg_directive:20,close_directive:21,CLASS_DIAGRAM:22,statements:23,EOF:24,statement:25,className:26,alphaNumToken:27,classLiteralName:28,GENERICTYPE:29,relationStatement:30,LABEL:31,classStatement:32,methodStatement:33,annotationStatement:34,clickStatement:35,cssClassStatement:36,CLASS:37,STYLE_SEPARATOR:38,STRUCT_START:39,members:40,STRUCT_STOP:41,ANNOTATION_START:42,ANNOTATION_END:43,MEMBER:44,SEPARATOR:45,relation:46,STR:47,relationType:48,lineType:49,AGGREGATION:50,EXTENSION:51,COMPOSITION:52,DEPENDENCY:53,LINE:54,DOTTED_LINE:55,CALLBACK:56,LINK:57,LINK_TARGET:58,CLICK:59,CALLBACK_NAME:60,CALLBACK_ARGS:61,HREF:62,CSSCLASS:63,commentToken:64,textToken:65,graphCodeTokens:66,textNoTagsToken:67,TAGSTART:68,TAGEND:69,\"==\":70,\"--\":71,PCT:72,DEFAULT:73,SPACE:74,MINUS:75,keywords:76,UNICODE_TEXT:77,NUM:78,ALPHA:79,BQUOTE_STR:80,$accept:0,$end:1},terminals_:{2:\"error\",7:\"direction_tb\",8:\"direction_bt\",9:\"direction_rl\",10:\"direction_lr\",15:\"NEWLINE\",16:\":\",18:\"open_directive\",19:\"type_directive\",20:\"arg_directive\",21:\"close_directive\",22:\"CLASS_DIAGRAM\",24:\"EOF\",29:\"GENERICTYPE\",31:\"LABEL\",37:\"CLASS\",38:\"STYLE_SEPARATOR\",39:\"STRUCT_START\",41:\"STRUCT_STOP\",42:\"ANNOTATION_START\",43:\"ANNOTATION_END\",44:\"MEMBER\",45:\"SEPARATOR\",47:\"STR\",50:\"AGGREGATION\",51:\"EXTENSION\",52:\"COMPOSITION\",53:\"DEPENDENCY\",54:\"LINE\",55:\"DOTTED_LINE\",56:\"CALLBACK\",57:\"LINK\",58:\"LINK_TARGET\",59:\"CLICK\",60:\"CALLBACK_NAME\",61:\"CALLBACK_ARGS\",62:\"HREF\",63:\"CSSCLASS\",66:\"graphCodeTokens\",68:\"TAGSTART\",69:\"TAGEND\",70:\"==\",71:\"--\",72:\"PCT\",73:\"DEFAULT\",74:\"SPACE\",75:\"MINUS\",76:\"keywords\",77:\"UNICODE_TEXT\",78:\"NUM\",79:\"ALPHA\",80:\"BQUOTE_STR\"},productions_:[0,[3,1],[3,1],[3,2],[5,1],[5,1],[5,1],[5,1],[4,1],[6,4],[6,6],[12,1],[13,1],[17,1],[14,1],[11,4],[23,1],[23,2],[23,3],[26,1],[26,1],[26,2],[26,2],[26,2],[25,1],[25,2],[25,1],[25,1],[25,1],[25,1],[25,1],[25,1],[25,1],[32,2],[32,4],[32,5],[32,7],[34,4],[40,1],[40,2],[33,1],[33,2],[33,1],[33,1],[30,3],[30,4],[30,4],[30,5],[46,3],[46,2],[46,2],[46,1],[48,1],[48,1],[48,1],[48,1],[49,1],[49,1],[35,3],[35,4],[35,3],[35,4],[35,4],[35,5],[35,3],[35,4],[35,4],[35,5],[35,3],[35,4],[35,4],[35,5],[36,3],[64,1],[64,1],[65,1],[65,1],[65,1],[65,1],[65,1],[65,1],[65,1],[67,1],[67,1],[67,1],[67,1],[27,1],[27,1],[27,1],[28,1]],performAction:function(t,e,n,r,i,a,o){var s=a.length-1;switch(i){case 4:r.setDirection(\"TB\");break;case 5:r.setDirection(\"BT\");break;case 6:r.setDirection(\"RL\");break;case 7:r.setDirection(\"LR\");break;case 11:r.parseDirective(\"%%{\",\"open_directive\");break;case 12:r.parseDirective(a[s],\"type_directive\");break;case 13:a[s]=a[s].trim().replace(/'/g,'\"'),r.parseDirective(a[s],\"arg_directive\");break;case 14:r.parseDirective(\"}%%\",\"close_directive\",\"class\");break;case 19:case 20:this.$=a[s];break;case 21:this.$=a[s-1]+a[s];break;case 22:case 23:this.$=a[s-1]+\"~\"+a[s];break;case 24:r.addRelation(a[s]);break;case 25:a[s-1].title=r.cleanupLabel(a[s]),r.addRelation(a[s-1]);break;case 33:r.addClass(a[s]);break;case 34:r.addClass(a[s-2]),r.setCssClass(a[s-2],a[s]);break;case 35:r.addClass(a[s-3]),r.addMembers(a[s-3],a[s-1]);break;case 36:r.addClass(a[s-5]),r.setCssClass(a[s-5],a[s-3]),r.addMembers(a[s-5],a[s-1]);break;case 37:r.addAnnotation(a[s],a[s-2]);break;case 38:this.$=[a[s]];break;case 39:a[s].push(a[s-1]),this.$=a[s];break;case 40:case 42:case 43:break;case 41:r.addMember(a[s-1],r.cleanupLabel(a[s]));break;case 44:this.$={id1:a[s-2],id2:a[s],relation:a[s-1],relationTitle1:\"none\",relationTitle2:\"none\"};break;case 45:this.$={id1:a[s-3],id2:a[s],relation:a[s-1],relationTitle1:a[s-2],relationTitle2:\"none\"};break;case 46:this.$={id1:a[s-3],id2:a[s],relation:a[s-2],relationTitle1:\"none\",relationTitle2:a[s-1]};break;case 47:this.$={id1:a[s-4],id2:a[s],relation:a[s-2],relationTitle1:a[s-3],relationTitle2:a[s-1]};break;case 48:this.$={type1:a[s-2],type2:a[s],lineType:a[s-1]};break;case 49:this.$={type1:\"none\",type2:a[s],lineType:a[s-1]};break;case 50:this.$={type1:a[s-1],type2:\"none\",lineType:a[s]};break;case 51:this.$={type1:\"none\",type2:\"none\",lineType:a[s]};break;case 52:this.$=r.relationType.AGGREGATION;break;case 53:this.$=r.relationType.EXTENSION;break;case 54:this.$=r.relationType.COMPOSITION;break;case 55:this.$=r.relationType.DEPENDENCY;break;case 56:this.$=r.lineType.LINE;break;case 57:this.$=r.lineType.DOTTED_LINE;break;case 58:case 64:this.$=a[s-2],r.setClickEvent(a[s-1],a[s]);break;case 59:case 65:this.$=a[s-3],r.setClickEvent(a[s-2],a[s-1]),r.setTooltip(a[s-2],a[s]);break;case 60:case 68:this.$=a[s-2],r.setLink(a[s-1],a[s]);break;case 61:case 69:this.$=a[s-3],r.setLink(a[s-2],a[s-1],a[s]);break;case 62:case 70:this.$=a[s-3],r.setLink(a[s-2],a[s-1]),r.setTooltip(a[s-2],a[s]);break;case 63:case 71:this.$=a[s-4],r.setLink(a[s-3],a[s-2],a[s]),r.setTooltip(a[s-3],a[s-1]);break;case 66:this.$=a[s-3],r.setClickEvent(a[s-2],a[s-1],a[s]);break;case 67:this.$=a[s-4],r.setClickEvent(a[s-3],a[s-2],a[s-1]),r.setTooltip(a[s-3],a[s]);break;case 72:r.setCssClass(a[s-1],a[s])}},table:[{3:1,4:2,5:3,6:4,7:e,8:n,9:r,10:i,11:5,12:10,18:a,22:o},{1:[3]},{1:[2,1]},{1:[2,2]},{3:13,4:2,5:3,6:4,7:e,8:n,9:r,10:i,11:5,12:10,18:a,22:o},{1:[2,8]},t(s,[2,4]),t(s,[2,5]),t(s,[2,6]),t(s,[2,7]),{13:14,19:[1,15]},{15:[1,16]},{19:[2,11]},{1:[2,3]},{14:17,16:[1,18],21:c},t([16,21],[2,12]),{5:29,6:28,7:e,8:n,9:r,10:i,12:10,18:a,23:20,25:21,26:30,27:39,28:40,30:22,32:23,33:24,34:25,35:26,36:27,37:u,42:l,44:h,45:f,56:d,57:p,59:y,63:g,77:m,78:v,79:b,80:_},{15:[1,45]},{17:46,20:[1,47]},{15:[2,14]},{24:[1,48]},{15:[1,49],24:[2,16]},t(x,[2,24],{31:[1,50]}),t(x,[2,26]),t(x,[2,27]),t(x,[2,28]),t(x,[2,29]),t(x,[2,30]),t(x,[2,31]),t(x,[2,32]),t(x,[2,40],{46:51,48:54,49:55,31:[1,53],47:[1,52],50:w,51:k,52:T,53:E,54:C,55:S}),{26:62,27:39,28:40,77:m,78:v,79:b,80:_},t(x,[2,42]),t(x,[2,43]),{27:63,77:m,78:v,79:b},{26:64,27:39,28:40,77:m,78:v,79:b,80:_},{26:65,27:39,28:40,77:m,78:v,79:b,80:_},{26:66,27:39,28:40,77:m,78:v,79:b,80:_},{47:[1,67]},t(A,[2,19],{27:39,28:40,26:68,29:[1,69],77:m,78:v,79:b,80:_}),t(A,[2,20],{29:[1,70]}),t(M,[2,86]),t(M,[2,87]),t(M,[2,88]),t([15,24,29,31,38,39,47,50,51,52,53,54,55,60,62],[2,89]),t(N,[2,9]),{14:71,21:c},{21:[2,13]},{1:[2,15]},{5:29,6:28,7:e,8:n,9:r,10:i,12:10,18:a,23:72,24:[2,17],25:21,26:30,27:39,28:40,30:22,32:23,33:24,34:25,35:26,36:27,37:u,42:l,44:h,45:f,56:d,57:p,59:y,63:g,77:m,78:v,79:b,80:_},t(x,[2,25]),{26:73,27:39,28:40,47:[1,74],77:m,78:v,79:b,80:_},{46:75,48:54,49:55,50:w,51:k,52:T,53:E,54:C,55:S},t(x,[2,41]),{49:76,54:C,55:S},t(D,[2,51],{48:77,50:w,51:k,52:T,53:E}),t(O,[2,52]),t(O,[2,53]),t(O,[2,54]),t(O,[2,55]),t(B,[2,56]),t(B,[2,57]),t(x,[2,33],{38:[1,78],39:[1,79]}),{43:[1,80]},{47:[1,81]},{47:[1,82]},{60:[1,83],62:[1,84]},{27:85,77:m,78:v,79:b},t(A,[2,21]),t(A,[2,22]),t(A,[2,23]),{15:[1,86]},{24:[2,18]},t(L,[2,44]),{26:87,27:39,28:40,77:m,78:v,79:b,80:_},{26:88,27:39,28:40,47:[1,89],77:m,78:v,79:b,80:_},t(D,[2,50],{48:90,50:w,51:k,52:T,53:E}),t(D,[2,49]),{27:91,77:m,78:v,79:b},{40:92,44:I},{26:94,27:39,28:40,77:m,78:v,79:b,80:_},t(x,[2,58],{47:[1,95]}),t(x,[2,60],{47:[1,97],58:[1,96]}),t(x,[2,64],{47:[1,98],61:[1,99]}),t(x,[2,68],{47:[1,101],58:[1,100]}),t(x,[2,72]),t(N,[2,10]),t(L,[2,46]),t(L,[2,45]),{26:102,27:39,28:40,77:m,78:v,79:b,80:_},t(D,[2,48]),t(x,[2,34],{39:[1,103]}),{41:[1,104]},{40:105,41:[2,38],44:I},t(x,[2,37]),t(x,[2,59]),t(x,[2,61]),t(x,[2,62],{58:[1,106]}),t(x,[2,65]),t(x,[2,66],{47:[1,107]}),t(x,[2,69]),t(x,[2,70],{58:[1,108]}),t(L,[2,47]),{40:109,44:I},t(x,[2,35]),{41:[2,39]},t(x,[2,63]),t(x,[2,67]),t(x,[2,71]),{41:[1,110]},t(x,[2,36])],defaultActions:{2:[2,1],3:[2,2],5:[2,8],12:[2,11],13:[2,3],19:[2,14],47:[2,13],48:[2,15],72:[2,18],105:[2,39]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],o=this.table,s=\"\",c=0,u=0,l=0,h=2,f=1,d=a.slice.call(arguments,1),p=Object.create(this.lexer),y={yy:{}};for(var g in this.yy)Object.prototype.hasOwnProperty.call(this.yy,g)&&(y.yy[g]=this.yy[g]);p.setInput(t,y.yy),y.yy.lexer=p,y.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var m=p.yylloc;a.push(m);var v=p.options&&p.options.ranges;function b(){var t;return\"number\"!=typeof(t=r.pop()||p.lex()||f)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}\"function\"==typeof y.yy.parseError?this.parseError=y.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var _,x,w,k,T,E,C,S,A,M={};;){if(w=n[n.length-1],this.defaultActions[w]?k=this.defaultActions[w]:(null==_&&(_=b()),k=o[w]&&o[w][_]),void 0===k||!k.length||!k[0]){var N=\"\";for(E in A=[],o[w])this.terminals_[E]&&E>h&&A.push(\"'\"+this.terminals_[E]+\"'\");N=p.showPosition?\"Parse error on line \"+(c+1)+\":\\n\"+p.showPosition()+\"\\nExpecting \"+A.join(\", \")+\", got '\"+(this.terminals_[_]||_)+\"'\":\"Parse error on line \"+(c+1)+\": Unexpected \"+(_==f?\"end of input\":\"'\"+(this.terminals_[_]||_)+\"'\"),this.parseError(N,{text:p.match,token:this.terminals_[_]||_,line:p.yylineno,loc:m,expected:A})}if(k[0]instanceof Array&&k.length>1)throw new Error(\"Parse Error: multiple actions possible at state: \"+w+\", token: \"+_);switch(k[0]){case 1:n.push(_),i.push(p.yytext),a.push(p.yylloc),n.push(k[1]),_=null,x?(_=x,x=null):(u=p.yyleng,s=p.yytext,c=p.yylineno,m=p.yylloc,l>0&&l--);break;case 2:if(C=this.productions_[k[1]][1],M.$=i[i.length-C],M._$={first_line:a[a.length-(C||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(C||1)].first_column,last_column:a[a.length-1].last_column},v&&(M._$.range=[a[a.length-(C||1)].range[0],a[a.length-1].range[1]]),void 0!==(T=this.performAction.apply(M,[s,u,c,y.yy,k[1],i,a].concat(d))))return T;C&&(n=n.slice(0,-1*C*2),i=i.slice(0,-1*C),a=a.slice(0,-1*C)),n.push(this.productions_[k[1]][0]),i.push(M.$),a.push(M._$),S=o[n[n.length-2]][n[n.length-1]],n.push(S);break;case 3:return!0}}return!0}},F={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=\"\",this.conditionStack=[\"INITIAL\"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\\r\\n?|\\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\\r\\n?|\\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\\r\\n?|\\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?\"...\":\"\")+t.substr(-20).replace(/\\n/g,\"\")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?\"...\":\"\")).replace(/\\n/g,\"\")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join(\"-\");return t+this.upcomingInput()+\"\\n\"+e+\"^\"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\\r\\n?|\\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\\r?\\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext=\"\",this.match=\"\");for(var i=this._currentRules(),a=0;ae[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:\"\"===this._input?this.EOF:this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". Unrecognized text.\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},lex:function(){return this.next()||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:\"INITIAL\"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{},performAction:function(t,e,n,r){switch(n){case 0:return this.begin(\"open_directive\"),18;case 1:return 7;case 2:return 8;case 3:return 9;case 4:return 10;case 5:return this.begin(\"type_directive\"),19;case 6:return this.popState(),this.begin(\"arg_directive\"),16;case 7:return this.popState(),this.popState(),21;case 8:return 20;case 9:case 10:case 12:case 19:break;case 11:return 15;case 13:case 14:return 22;case 15:return this.begin(\"struct\"),39;case 16:return\"EOF_IN_STRUCT\";case 17:return\"OPEN_IN_STRUCT\";case 18:return this.popState(),41;case 20:return\"MEMBER\";case 21:return 37;case 22:return 63;case 23:return 56;case 24:return 57;case 25:return 59;case 26:return 42;case 27:return 43;case 28:this.begin(\"generic\");break;case 29:case 32:case 35:case 38:case 41:case 44:this.popState();break;case 30:return\"GENERICTYPE\";case 31:this.begin(\"string\");break;case 33:return\"STR\";case 34:this.begin(\"bqstring\");break;case 36:return\"BQUOTE_STR\";case 37:this.begin(\"href\");break;case 39:return 62;case 40:this.begin(\"callback_name\");break;case 42:this.popState(),this.begin(\"callback_args\");break;case 43:return 60;case 45:return 61;case 46:case 47:case 48:case 49:return 58;case 50:case 51:return 51;case 52:case 53:return 53;case 54:return 52;case 55:return 50;case 56:return 54;case 57:return 55;case 58:return 31;case 59:return 38;case 60:return 75;case 61:return\"DOT\";case 62:return\"PLUS\";case 63:return 72;case 64:case 65:return\"EQUALS\";case 66:return 79;case 67:return\"PUNCTUATION\";case 68:return 78;case 69:return 77;case 70:return 74;case 71:return 24}},rules:[/^(?:%%\\{)/,/^(?:.*direction\\s+TB[^\\n]*)/,/^(?:.*direction\\s+BT[^\\n]*)/,/^(?:.*direction\\s+RL[^\\n]*)/,/^(?:.*direction\\s+LR[^\\n]*)/,/^(?:((?:(?!\\}%%)[^:.])*))/,/^(?::)/,/^(?:\\}%%)/,/^(?:((?:(?!\\}%%).|\\n)*))/,/^(?:%%(?!\\{)*[^\\n]*(\\r?\\n?)+)/,/^(?:%%[^\\n]*(\\r?\\n)*)/,/^(?:\\s*(\\r?\\n)+)/,/^(?:\\s+)/,/^(?:classDiagram-v2\\b)/,/^(?:classDiagram\\b)/,/^(?:[{])/,/^(?:$)/,/^(?:[{])/,/^(?:[}])/,/^(?:[\\n])/,/^(?:[^{}\\n]*)/,/^(?:class\\b)/,/^(?:cssClass\\b)/,/^(?:callback\\b)/,/^(?:link\\b)/,/^(?:click\\b)/,/^(?:<<)/,/^(?:>>)/,/^(?:[~])/,/^(?:[~])/,/^(?:[^~]*)/,/^(?:[\"])/,/^(?:[\"])/,/^(?:[^\"]*)/,/^(?:[`])/,/^(?:[`])/,/^(?:[^`]+)/,/^(?:href[\\s]+[\"])/,/^(?:[\"])/,/^(?:[^\"]*)/,/^(?:call[\\s]+)/,/^(?:\\([\\s]*\\))/,/^(?:\\()/,/^(?:[^(]*)/,/^(?:\\))/,/^(?:[^)]*)/,/^(?:_self\\b)/,/^(?:_blank\\b)/,/^(?:_parent\\b)/,/^(?:_top\\b)/,/^(?:\\s*<\\|)/,/^(?:\\s*\\|>)/,/^(?:\\s*>)/,/^(?:\\s*<)/,/^(?:\\s*\\*)/,/^(?:\\s*o\\b)/,/^(?:--)/,/^(?:\\.\\.)/,/^(?::{1}[^:\\n;]+)/,/^(?::{3})/,/^(?:-)/,/^(?:\\.)/,/^(?:\\+)/,/^(?:%)/,/^(?:=)/,/^(?:=)/,/^(?:\\w+)/,/^(?:[!\"#$%&'*+,-.`?\\\\/])/,/^(?:[0-9]+)/,/^(?:[\\u00AA\\u00B5\\u00BA\\u00C0-\\u00D6\\u00D8-\\u00F6]|[\\u00F8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377]|[\\u037A-\\u037D\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5]|[\\u03F7-\\u0481\\u048A-\\u0527\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA]|[\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE]|[\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA]|[\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0]|[\\u08A2-\\u08AC\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0977]|[\\u0979-\\u097F\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2]|[\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A]|[\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39]|[\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8]|[\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C]|[\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C]|[\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99]|[\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0]|[\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C33\\u0C35-\\u0C39\\u0C3D]|[\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3]|[\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10]|[\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1]|[\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81]|[\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3]|[\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6]|[\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A]|[\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081]|[\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D]|[\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0]|[\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310]|[\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C]|[\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u1700-\\u170C\\u170E-\\u1711]|[\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7]|[\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191C]|[\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16]|[\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF]|[\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC]|[\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D]|[\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D]|[\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3]|[\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F]|[\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128]|[\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2183\\u2184]|[\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3]|[\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6]|[\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE]|[\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005\\u3006\\u3031-\\u3035\\u303B\\u303C]|[\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D]|[\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC]|[\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B]|[\\uA640-\\uA66E\\uA67F-\\uA697\\uA6A0-\\uA6E5\\uA717-\\uA71F\\uA722-\\uA788]|[\\uA78B-\\uA78E\\uA790-\\uA793\\uA7A0-\\uA7AA\\uA7F8-\\uA801\\uA803-\\uA805]|[\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB]|[\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uAA00-\\uAA28]|[\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA80-\\uAAAF\\uAAB1\\uAAB5]|[\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4]|[\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E]|[\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D]|[\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36]|[\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D]|[\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC]|[\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF]|[\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC])/,/^(?:\\s)/,/^(?:$)/],conditions:{arg_directive:{rules:[7,8],inclusive:!1},type_directive:{rules:[6,7],inclusive:!1},open_directive:{rules:[5],inclusive:!1},callback_args:{rules:[44,45],inclusive:!1},callback_name:{rules:[41,42,43],inclusive:!1},href:{rules:[38,39],inclusive:!1},struct:{rules:[16,17,18,19,20],inclusive:!1},generic:{rules:[29,30],inclusive:!1},bqstring:{rules:[35,36],inclusive:!1},string:{rules:[32,33],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,9,10,11,12,13,14,15,21,22,23,24,25,26,27,28,31,34,37,40,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71],inclusive:!0}}};function P(){this.yy={}}return R.lexer=F,P.prototype=R,R.Parser=P,new P}();e.parser=r,e.Parser=r.Parser,e.parse=function(){return r.parse.apply(r,arguments)},e.main=function(t){t[1]||(console.log(\"Usage: \"+t[0]+\" FILE\"),process.exit(1));var r=n(8218).readFileSync(n(6470).normalize(t[1]),\"utf8\");return e.parser.parse(r)},n.c[n.s]===t&&e.main(process.argv.slice(1))},5890:(t,e,n)=>{t=n.nmd(t);var r=function(){var t=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},e=[1,2],n=[1,5],r=[6,9,11,23,40],i=[1,17],a=[1,20],o=[1,25],s=[1,26],c=[1,27],u=[1,28],l=[1,37],h=[23,37,38],f=[4,6,9,11,23,40],d=[33,34,35,36],p=[22,29],y={trace:function(){},yy:{},symbols_:{error:2,start:3,ER_DIAGRAM:4,document:5,EOF:6,directive:7,line:8,SPACE:9,statement:10,NEWLINE:11,openDirective:12,typeDirective:13,closeDirective:14,\":\":15,argDirective:16,entityName:17,relSpec:18,role:19,BLOCK_START:20,attributes:21,BLOCK_STOP:22,ALPHANUM:23,attribute:24,attributeType:25,attributeName:26,attributeKeyType:27,COMMENT:28,ATTRIBUTE_WORD:29,ATTRIBUTE_KEY:30,cardinality:31,relType:32,ZERO_OR_ONE:33,ZERO_OR_MORE:34,ONE_OR_MORE:35,ONLY_ONE:36,NON_IDENTIFYING:37,IDENTIFYING:38,WORD:39,open_directive:40,type_directive:41,arg_directive:42,close_directive:43,$accept:0,$end:1},terminals_:{2:\"error\",4:\"ER_DIAGRAM\",6:\"EOF\",9:\"SPACE\",11:\"NEWLINE\",15:\":\",20:\"BLOCK_START\",22:\"BLOCK_STOP\",23:\"ALPHANUM\",28:\"COMMENT\",29:\"ATTRIBUTE_WORD\",30:\"ATTRIBUTE_KEY\",33:\"ZERO_OR_ONE\",34:\"ZERO_OR_MORE\",35:\"ONE_OR_MORE\",36:\"ONLY_ONE\",37:\"NON_IDENTIFYING\",38:\"IDENTIFYING\",39:\"WORD\",40:\"open_directive\",41:\"type_directive\",42:\"arg_directive\",43:\"close_directive\"},productions_:[0,[3,3],[3,2],[5,0],[5,2],[8,2],[8,1],[8,1],[8,1],[7,4],[7,6],[10,1],[10,5],[10,4],[10,3],[10,1],[17,1],[21,1],[21,2],[24,2],[24,3],[24,3],[24,4],[25,1],[26,1],[27,1],[18,3],[31,1],[31,1],[31,1],[31,1],[32,1],[32,1],[19,1],[19,1],[12,1],[13,1],[16,1],[14,1]],performAction:function(t,e,n,r,i,a,o){var s=a.length-1;switch(i){case 1:break;case 3:case 7:case 8:this.$=[];break;case 4:a[s-1].push(a[s]),this.$=a[s-1];break;case 5:case 6:case 16:case 23:case 24:case 25:case 34:this.$=a[s];break;case 12:r.addEntity(a[s-4]),r.addEntity(a[s-2]),r.addRelationship(a[s-4],a[s],a[s-2],a[s-3]);break;case 13:r.addEntity(a[s-3]),r.addAttributes(a[s-3],a[s-1]);break;case 14:r.addEntity(a[s-2]);break;case 15:r.addEntity(a[s]);break;case 17:this.$=[a[s]];break;case 18:a[s].push(a[s-1]),this.$=a[s];break;case 19:this.$={attributeType:a[s-1],attributeName:a[s]};break;case 20:this.$={attributeType:a[s-2],attributeName:a[s-1],attributeKeyType:a[s]};break;case 21:this.$={attributeType:a[s-2],attributeName:a[s-1],attributeComment:a[s]};break;case 22:this.$={attributeType:a[s-3],attributeName:a[s-2],attributeKeyType:a[s-1],attributeComment:a[s]};break;case 26:this.$={cardA:a[s],relType:a[s-1],cardB:a[s-2]};break;case 27:this.$=r.Cardinality.ZERO_OR_ONE;break;case 28:this.$=r.Cardinality.ZERO_OR_MORE;break;case 29:this.$=r.Cardinality.ONE_OR_MORE;break;case 30:this.$=r.Cardinality.ONLY_ONE;break;case 31:this.$=r.Identification.NON_IDENTIFYING;break;case 32:this.$=r.Identification.IDENTIFYING;break;case 33:this.$=a[s].replace(/\"/g,\"\");break;case 35:r.parseDirective(\"%%{\",\"open_directive\");break;case 36:r.parseDirective(a[s],\"type_directive\");break;case 37:a[s]=a[s].trim().replace(/'/g,'\"'),r.parseDirective(a[s],\"arg_directive\");break;case 38:r.parseDirective(\"}%%\",\"close_directive\",\"er\")}},table:[{3:1,4:e,7:3,12:4,40:n},{1:[3]},t(r,[2,3],{5:6}),{3:7,4:e,7:3,12:4,40:n},{13:8,41:[1,9]},{41:[2,35]},{6:[1,10],7:15,8:11,9:[1,12],10:13,11:[1,14],12:4,17:16,23:i,40:n},{1:[2,2]},{14:18,15:[1,19],43:a},t([15,43],[2,36]),t(r,[2,8],{1:[2,1]}),t(r,[2,4]),{7:15,10:21,12:4,17:16,23:i,40:n},t(r,[2,6]),t(r,[2,7]),t(r,[2,11]),t(r,[2,15],{18:22,31:24,20:[1,23],33:o,34:s,35:c,36:u}),t([6,9,11,15,20,23,33,34,35,36,40],[2,16]),{11:[1,29]},{16:30,42:[1,31]},{11:[2,38]},t(r,[2,5]),{17:32,23:i},{21:33,22:[1,34],24:35,25:36,29:l},{32:38,37:[1,39],38:[1,40]},t(h,[2,27]),t(h,[2,28]),t(h,[2,29]),t(h,[2,30]),t(f,[2,9]),{14:41,43:a},{43:[2,37]},{15:[1,42]},{22:[1,43]},t(r,[2,14]),{21:44,22:[2,17],24:35,25:36,29:l},{26:45,29:[1,46]},{29:[2,23]},{31:47,33:o,34:s,35:c,36:u},t(d,[2,31]),t(d,[2,32]),{11:[1,48]},{19:49,23:[1,51],39:[1,50]},t(r,[2,13]),{22:[2,18]},t(p,[2,19],{27:52,28:[1,53],30:[1,54]}),t([22,28,29,30],[2,24]),{23:[2,26]},t(f,[2,10]),t(r,[2,12]),t(r,[2,33]),t(r,[2,34]),t(p,[2,20],{28:[1,55]}),t(p,[2,21]),t([22,28,29],[2,25]),t(p,[2,22])],defaultActions:{5:[2,35],7:[2,2],20:[2,38],31:[2,37],37:[2,23],44:[2,18],47:[2,26]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],o=this.table,s=\"\",c=0,u=0,l=0,h=2,f=1,d=a.slice.call(arguments,1),p=Object.create(this.lexer),y={yy:{}};for(var g in this.yy)Object.prototype.hasOwnProperty.call(this.yy,g)&&(y.yy[g]=this.yy[g]);p.setInput(t,y.yy),y.yy.lexer=p,y.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var m=p.yylloc;a.push(m);var v=p.options&&p.options.ranges;function b(){var t;return\"number\"!=typeof(t=r.pop()||p.lex()||f)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}\"function\"==typeof y.yy.parseError?this.parseError=y.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var _,x,w,k,T,E,C,S,A,M={};;){if(w=n[n.length-1],this.defaultActions[w]?k=this.defaultActions[w]:(null==_&&(_=b()),k=o[w]&&o[w][_]),void 0===k||!k.length||!k[0]){var N=\"\";for(E in A=[],o[w])this.terminals_[E]&&E>h&&A.push(\"'\"+this.terminals_[E]+\"'\");N=p.showPosition?\"Parse error on line \"+(c+1)+\":\\n\"+p.showPosition()+\"\\nExpecting \"+A.join(\", \")+\", got '\"+(this.terminals_[_]||_)+\"'\":\"Parse error on line \"+(c+1)+\": Unexpected \"+(_==f?\"end of input\":\"'\"+(this.terminals_[_]||_)+\"'\"),this.parseError(N,{text:p.match,token:this.terminals_[_]||_,line:p.yylineno,loc:m,expected:A})}if(k[0]instanceof Array&&k.length>1)throw new Error(\"Parse Error: multiple actions possible at state: \"+w+\", token: \"+_);switch(k[0]){case 1:n.push(_),i.push(p.yytext),a.push(p.yylloc),n.push(k[1]),_=null,x?(_=x,x=null):(u=p.yyleng,s=p.yytext,c=p.yylineno,m=p.yylloc,l>0&&l--);break;case 2:if(C=this.productions_[k[1]][1],M.$=i[i.length-C],M._$={first_line:a[a.length-(C||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(C||1)].first_column,last_column:a[a.length-1].last_column},v&&(M._$.range=[a[a.length-(C||1)].range[0],a[a.length-1].range[1]]),void 0!==(T=this.performAction.apply(M,[s,u,c,y.yy,k[1],i,a].concat(d))))return T;C&&(n=n.slice(0,-1*C*2),i=i.slice(0,-1*C),a=a.slice(0,-1*C)),n.push(this.productions_[k[1]][0]),i.push(M.$),a.push(M._$),S=o[n[n.length-2]][n[n.length-1]],n.push(S);break;case 3:return!0}}return!0}},g={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=\"\",this.conditionStack=[\"INITIAL\"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\\r\\n?|\\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\\r\\n?|\\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\\r\\n?|\\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?\"...\":\"\")+t.substr(-20).replace(/\\n/g,\"\")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?\"...\":\"\")).replace(/\\n/g,\"\")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join(\"-\");return t+this.upcomingInput()+\"\\n\"+e+\"^\"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\\r\\n?|\\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\\r?\\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext=\"\",this.match=\"\");for(var i=this._currentRules(),a=0;ae[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:\"\"===this._input?this.EOF:this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". Unrecognized text.\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},lex:function(){return this.next()||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:\"INITIAL\"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{\"case-insensitive\":!0},performAction:function(t,e,n,r){switch(n){case 0:return this.begin(\"open_directive\"),40;case 1:return this.begin(\"type_directive\"),41;case 2:return this.popState(),this.begin(\"arg_directive\"),15;case 3:return this.popState(),this.popState(),43;case 4:return 42;case 5:case 6:case 8:case 13:case 17:break;case 7:return 11;case 9:return 9;case 10:return 39;case 11:return 4;case 12:return this.begin(\"block\"),20;case 14:return 30;case 15:return 29;case 16:return 28;case 18:return this.popState(),22;case 19:case 32:return e.yytext[0];case 20:case 24:return 33;case 21:case 25:return 34;case 22:case 26:return 35;case 23:return 36;case 27:case 29:case 30:return 37;case 28:return 38;case 31:return 23;case 33:return 6}},rules:[/^(?:%%\\{)/i,/^(?:((?:(?!\\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\\}%%)/i,/^(?:((?:(?!\\}%%).|\\n)*))/i,/^(?:%(?!\\{)[^\\n]*)/i,/^(?:[^\\}]%%[^\\n]*)/i,/^(?:[\\n]+)/i,/^(?:\\s+)/i,/^(?:[\\s]+)/i,/^(?:\"[^\"]*\")/i,/^(?:erDiagram\\b)/i,/^(?:\\{)/i,/^(?:\\s+)/i,/^(?:(?:PK)|(?:FK))/i,/^(?:[A-Za-z][A-Za-z0-9\\-_]*)/i,/^(?:\"[^\"]*\")/i,/^(?:[\\n]+)/i,/^(?:\\})/i,/^(?:.)/i,/^(?:\\|o\\b)/i,/^(?:\\}o\\b)/i,/^(?:\\}\\|)/i,/^(?:\\|\\|)/i,/^(?:o\\|)/i,/^(?:o\\{)/i,/^(?:\\|\\{)/i,/^(?:\\.\\.)/i,/^(?:--)/i,/^(?:\\.-)/i,/^(?:-\\.)/i,/^(?:[A-Za-z][A-Za-z0-9\\-_]*)/i,/^(?:.)/i,/^(?:$)/i],conditions:{open_directive:{rules:[1],inclusive:!1},type_directive:{rules:[2,3],inclusive:!1},arg_directive:{rules:[3,4],inclusive:!1},block:{rules:[13,14,15,16,17,18,19],inclusive:!1},INITIAL:{rules:[0,5,6,7,8,9,10,11,12,20,21,22,23,24,25,26,27,28,29,30,31,32,33],inclusive:!0}}};function m(){this.yy={}}return y.lexer=g,m.prototype=y,y.Parser=m,new m}();e.parser=r,e.Parser=r.Parser,e.parse=function(){return r.parse.apply(r,arguments)},e.main=function(t){t[1]||(console.log(\"Usage: \"+t[0]+\" FILE\"),process.exit(1));var r=n(8009).readFileSync(n(6470).normalize(t[1]),\"utf8\");return e.parser.parse(r)},n.c[n.s]===t&&e.main(process.argv.slice(1))},3602:(t,e,n)=>{t=n.nmd(t);var r=function(){var t=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},e=[1,9],n=[1,7],r=[1,6],i=[1,8],a=[1,20,21,22,23,38,47,59,60,79,80,81,82,83,84,88,98,99,102,104,105,111,112,113,114,115,116,117,118,119,120],o=[2,10],s=[1,20],c=[1,21],u=[1,22],l=[1,23],h=[1,30],f=[1,59],d=[1,45],p=[1,49],y=[1,33],g=[1,34],m=[1,35],v=[1,36],b=[1,37],_=[1,53],x=[1,60],w=[1,48],k=[1,50],T=[1,52],E=[1,56],C=[1,57],S=[1,38],A=[1,39],M=[1,40],N=[1,41],D=[1,58],O=[1,47],B=[1,51],L=[1,54],I=[1,55],R=[1,46],F=[1,63],P=[1,68],j=[1,20,21,22,23,38,42,47,59,60,79,80,81,82,83,84,88,98,99,102,104,105,111,112,113,114,115,116,117,118,119,120],Y=[1,72],z=[1,71],U=[1,73],q=[20,21,23,74,75],H=[1,94],$=[1,99],W=[1,102],V=[1,103],G=[1,96],X=[1,101],Z=[1,104],Q=[1,97],K=[1,109],J=[1,108],tt=[1,98],et=[1,100],nt=[1,105],rt=[1,106],it=[1,107],at=[1,110],ot=[20,21,22,23,74,75],st=[20,21,22,23,48,74,75],ct=[20,21,22,23,40,47,48,50,52,54,56,58,59,60,62,64,66,67,69,74,75,84,88,98,99,102,104,105,115,116,117,118,119,120],ut=[20,21,23],lt=[20,21,23,47,59,60,74,75,84,88,98,99,102,104,105,115,116,117,118,119,120],ht=[1,12,20,21,22,23,24,38,42,47,59,60,79,80,81,82,83,84,88,98,99,102,104,105,111,112,113,114,115,116,117,118,119,120],ft=[47,59,60,84,88,98,99,102,104,105,115,116,117,118,119,120],dt=[1,143],pt=[1,151],yt=[1,152],gt=[1,153],mt=[1,154],vt=[1,138],bt=[1,139],_t=[1,135],xt=[1,146],wt=[1,147],kt=[1,148],Tt=[1,149],Et=[1,150],Ct=[1,155],St=[1,156],At=[1,141],Mt=[1,144],Nt=[1,140],Dt=[1,137],Ot=[20,21,22,23,38,42,47,59,60,79,80,81,82,83,84,88,98,99,102,104,105,111,112,113,114,115,116,117,118,119,120],Bt=[1,159],Lt=[20,21,22,23,26,47,59,60,84,98,99,102,104,105,115,116,117,118,119,120],It=[20,21,22,23,24,26,38,40,41,42,47,51,53,55,57,59,60,61,63,65,66,68,70,74,75,79,80,81,82,83,84,85,88,98,99,102,104,105,106,107,115,116,117,118,119,120],Rt=[12,21,22,24],Ft=[22,99],Pt=[1,242],jt=[1,237],Yt=[1,238],zt=[1,246],Ut=[1,243],qt=[1,240],Ht=[1,239],$t=[1,241],Wt=[1,244],Vt=[1,245],Gt=[1,247],Xt=[1,265],Zt=[20,21,23,99],Qt=[20,21,22,23,59,60,79,95,98,99,102,103,104,105,106],Kt={trace:function(){},yy:{},symbols_:{error:2,start:3,mermaidDoc:4,directive:5,openDirective:6,typeDirective:7,closeDirective:8,separator:9,\":\":10,argDirective:11,open_directive:12,type_directive:13,arg_directive:14,close_directive:15,graphConfig:16,document:17,line:18,statement:19,SEMI:20,NEWLINE:21,SPACE:22,EOF:23,GRAPH:24,NODIR:25,DIR:26,FirstStmtSeperator:27,ending:28,endToken:29,spaceList:30,spaceListNewline:31,verticeStatement:32,styleStatement:33,linkStyleStatement:34,classDefStatement:35,classStatement:36,clickStatement:37,subgraph:38,text:39,SQS:40,SQE:41,end:42,direction:43,link:44,node:45,vertex:46,AMP:47,STYLE_SEPARATOR:48,idString:49,PS:50,PE:51,\"(-\":52,\"-)\":53,STADIUMSTART:54,STADIUMEND:55,SUBROUTINESTART:56,SUBROUTINEEND:57,VERTEX_WITH_PROPS_START:58,ALPHA:59,COLON:60,PIPE:61,CYLINDERSTART:62,CYLINDEREND:63,DIAMOND_START:64,DIAMOND_STOP:65,TAGEND:66,TRAPSTART:67,TRAPEND:68,INVTRAPSTART:69,INVTRAPEND:70,linkStatement:71,arrowText:72,TESTSTR:73,START_LINK:74,LINK:75,textToken:76,STR:77,keywords:78,STYLE:79,LINKSTYLE:80,CLASSDEF:81,CLASS:82,CLICK:83,DOWN:84,UP:85,textNoTags:86,textNoTagsToken:87,DEFAULT:88,stylesOpt:89,alphaNum:90,CALLBACKNAME:91,CALLBACKARGS:92,HREF:93,LINK_TARGET:94,HEX:95,numList:96,INTERPOLATE:97,NUM:98,COMMA:99,style:100,styleComponent:101,MINUS:102,UNIT:103,BRKT:104,DOT:105,PCT:106,TAGSTART:107,alphaNumToken:108,idStringToken:109,alphaNumStatement:110,direction_tb:111,direction_bt:112,direction_rl:113,direction_lr:114,PUNCTUATION:115,UNICODE_TEXT:116,PLUS:117,EQUALS:118,MULT:119,UNDERSCORE:120,graphCodeTokens:121,ARROW_CROSS:122,ARROW_POINT:123,ARROW_CIRCLE:124,ARROW_OPEN:125,QUOTE:126,$accept:0,$end:1},terminals_:{2:\"error\",10:\":\",12:\"open_directive\",13:\"type_directive\",14:\"arg_directive\",15:\"close_directive\",20:\"SEMI\",21:\"NEWLINE\",22:\"SPACE\",23:\"EOF\",24:\"GRAPH\",25:\"NODIR\",26:\"DIR\",38:\"subgraph\",40:\"SQS\",41:\"SQE\",42:\"end\",47:\"AMP\",48:\"STYLE_SEPARATOR\",50:\"PS\",51:\"PE\",52:\"(-\",53:\"-)\",54:\"STADIUMSTART\",55:\"STADIUMEND\",56:\"SUBROUTINESTART\",57:\"SUBROUTINEEND\",58:\"VERTEX_WITH_PROPS_START\",59:\"ALPHA\",60:\"COLON\",61:\"PIPE\",62:\"CYLINDERSTART\",63:\"CYLINDEREND\",64:\"DIAMOND_START\",65:\"DIAMOND_STOP\",66:\"TAGEND\",67:\"TRAPSTART\",68:\"TRAPEND\",69:\"INVTRAPSTART\",70:\"INVTRAPEND\",73:\"TESTSTR\",74:\"START_LINK\",75:\"LINK\",77:\"STR\",79:\"STYLE\",80:\"LINKSTYLE\",81:\"CLASSDEF\",82:\"CLASS\",83:\"CLICK\",84:\"DOWN\",85:\"UP\",88:\"DEFAULT\",91:\"CALLBACKNAME\",92:\"CALLBACKARGS\",93:\"HREF\",94:\"LINK_TARGET\",95:\"HEX\",97:\"INTERPOLATE\",98:\"NUM\",99:\"COMMA\",102:\"MINUS\",103:\"UNIT\",104:\"BRKT\",105:\"DOT\",106:\"PCT\",107:\"TAGSTART\",111:\"direction_tb\",112:\"direction_bt\",113:\"direction_rl\",114:\"direction_lr\",115:\"PUNCTUATION\",116:\"UNICODE_TEXT\",117:\"PLUS\",118:\"EQUALS\",119:\"MULT\",120:\"UNDERSCORE\",122:\"ARROW_CROSS\",123:\"ARROW_POINT\",124:\"ARROW_CIRCLE\",125:\"ARROW_OPEN\",126:\"QUOTE\"},productions_:[0,[3,1],[3,2],[5,4],[5,6],[6,1],[7,1],[11,1],[8,1],[4,2],[17,0],[17,2],[18,1],[18,1],[18,1],[18,1],[18,1],[16,2],[16,2],[16,2],[16,3],[28,2],[28,1],[29,1],[29,1],[29,1],[27,1],[27,1],[27,2],[31,2],[31,2],[31,1],[31,1],[30,2],[30,1],[19,2],[19,2],[19,2],[19,2],[19,2],[19,2],[19,9],[19,6],[19,4],[19,1],[9,1],[9,1],[9,1],[32,3],[32,4],[32,2],[32,1],[45,1],[45,5],[45,3],[46,4],[46,6],[46,4],[46,4],[46,4],[46,8],[46,4],[46,4],[46,4],[46,6],[46,4],[46,4],[46,4],[46,4],[46,4],[46,1],[44,2],[44,3],[44,3],[44,1],[44,3],[71,1],[72,3],[39,1],[39,2],[39,1],[78,1],[78,1],[78,1],[78,1],[78,1],[78,1],[78,1],[78,1],[78,1],[78,1],[78,1],[86,1],[86,2],[35,5],[35,5],[36,5],[37,2],[37,4],[37,3],[37,5],[37,2],[37,4],[37,4],[37,6],[37,2],[37,4],[37,2],[37,4],[37,4],[37,6],[33,5],[33,5],[34,5],[34,5],[34,9],[34,9],[34,7],[34,7],[96,1],[96,3],[89,1],[89,3],[100,1],[100,2],[101,1],[101,1],[101,1],[101,1],[101,1],[101,1],[101,1],[101,1],[101,1],[101,1],[101,1],[76,1],[76,1],[76,1],[76,1],[76,1],[76,1],[87,1],[87,1],[87,1],[87,1],[49,1],[49,2],[90,1],[90,2],[110,1],[110,1],[110,1],[110,1],[43,1],[43,1],[43,1],[43,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[109,1],[109,1],[109,1],[109,1],[109,1],[109,1],[109,1],[109,1],[109,1],[109,1],[109,1],[109,1],[109,1],[109,1],[109,1],[109,1],[121,1],[121,1],[121,1],[121,1],[121,1],[121,1],[121,1],[121,1],[121,1],[121,1],[121,1],[121,1],[121,1],[121,1],[121,1],[121,1],[121,1],[121,1],[121,1],[121,1],[121,1],[121,1],[121,1],[121,1],[121,1],[121,1]],performAction:function(t,e,n,r,i,a,o){var s=a.length-1;switch(i){case 5:r.parseDirective(\"%%{\",\"open_directive\");break;case 6:r.parseDirective(a[s],\"type_directive\");break;case 7:a[s]=a[s].trim().replace(/'/g,'\"'),r.parseDirective(a[s],\"arg_directive\");break;case 8:r.parseDirective(\"}%%\",\"close_directive\",\"flowchart\");break;case 10:case 36:case 37:case 38:case 39:case 40:this.$=[];break;case 11:a[s]!==[]&&a[s-1].push(a[s]),this.$=a[s-1];break;case 12:case 78:case 80:case 92:case 148:case 150:case 151:case 74:case 146:this.$=a[s];break;case 19:r.setDirection(\"TB\"),this.$=\"TB\";break;case 20:r.setDirection(a[s-1]),this.$=a[s-1];break;case 35:this.$=a[s-1].nodes;break;case 41:this.$=r.addSubGraph(a[s-6],a[s-1],a[s-4]);break;case 42:this.$=r.addSubGraph(a[s-3],a[s-1],a[s-3]);break;case 43:this.$=r.addSubGraph(void 0,a[s-1],void 0);break;case 48:r.addLink(a[s-2].stmt,a[s],a[s-1]),this.$={stmt:a[s],nodes:a[s].concat(a[s-2].nodes)};break;case 49:r.addLink(a[s-3].stmt,a[s-1],a[s-2]),this.$={stmt:a[s-1],nodes:a[s-1].concat(a[s-3].nodes)};break;case 50:this.$={stmt:a[s-1],nodes:a[s-1]};break;case 51:this.$={stmt:a[s],nodes:a[s]};break;case 52:case 119:case 121:this.$=[a[s]];break;case 53:this.$=a[s-4].concat(a[s]);break;case 54:this.$=[a[s-2]],r.setClass(a[s-2],a[s]);break;case 55:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],\"square\");break;case 56:this.$=a[s-5],r.addVertex(a[s-5],a[s-2],\"circle\");break;case 57:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],\"ellipse\");break;case 58:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],\"stadium\");break;case 59:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],\"subroutine\");break;case 60:this.$=a[s-7],r.addVertex(a[s-7],a[s-1],\"rect\",void 0,void 0,void 0,Object.fromEntries([[a[s-5],a[s-3]]]));break;case 61:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],\"cylinder\");break;case 62:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],\"round\");break;case 63:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],\"diamond\");break;case 64:this.$=a[s-5],r.addVertex(a[s-5],a[s-2],\"hexagon\");break;case 65:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],\"odd\");break;case 66:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],\"trapezoid\");break;case 67:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],\"inv_trapezoid\");break;case 68:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],\"lean_right\");break;case 69:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],\"lean_left\");break;case 70:this.$=a[s],r.addVertex(a[s]);break;case 71:a[s-1].text=a[s],this.$=a[s-1];break;case 72:case 73:a[s-2].text=a[s-1],this.$=a[s-2];break;case 75:var c=r.destructLink(a[s],a[s-2]);this.$={type:c.type,stroke:c.stroke,length:c.length,text:a[s-1]};break;case 76:c=r.destructLink(a[s]),this.$={type:c.type,stroke:c.stroke,length:c.length};break;case 77:this.$=a[s-1];break;case 79:case 93:case 149:case 147:this.$=a[s-1]+\"\"+a[s];break;case 94:case 95:this.$=a[s-4],r.addClass(a[s-2],a[s]);break;case 96:this.$=a[s-4],r.setClass(a[s-2],a[s]);break;case 97:case 105:this.$=a[s-1],r.setClickEvent(a[s-1],a[s]);break;case 98:case 106:this.$=a[s-3],r.setClickEvent(a[s-3],a[s-2]),r.setTooltip(a[s-3],a[s]);break;case 99:this.$=a[s-2],r.setClickEvent(a[s-2],a[s-1],a[s]);break;case 100:this.$=a[s-4],r.setClickEvent(a[s-4],a[s-3],a[s-2]),r.setTooltip(a[s-4],a[s]);break;case 101:case 107:this.$=a[s-1],r.setLink(a[s-1],a[s]);break;case 102:case 108:this.$=a[s-3],r.setLink(a[s-3],a[s-2]),r.setTooltip(a[s-3],a[s]);break;case 103:case 109:this.$=a[s-3],r.setLink(a[s-3],a[s-2],a[s]);break;case 104:case 110:this.$=a[s-5],r.setLink(a[s-5],a[s-4],a[s]),r.setTooltip(a[s-5],a[s-2]);break;case 111:this.$=a[s-4],r.addVertex(a[s-2],void 0,void 0,a[s]);break;case 112:case 114:this.$=a[s-4],r.updateLink(a[s-2],a[s]);break;case 113:this.$=a[s-4],r.updateLink([a[s-2]],a[s]);break;case 115:this.$=a[s-8],r.updateLinkInterpolate([a[s-6]],a[s-2]),r.updateLink([a[s-6]],a[s]);break;case 116:this.$=a[s-8],r.updateLinkInterpolate(a[s-6],a[s-2]),r.updateLink(a[s-6],a[s]);break;case 117:this.$=a[s-6],r.updateLinkInterpolate([a[s-4]],a[s]);break;case 118:this.$=a[s-6],r.updateLinkInterpolate(a[s-4],a[s]);break;case 120:case 122:a[s-2].push(a[s]),this.$=a[s-2];break;case 124:this.$=a[s-1]+a[s];break;case 152:this.$=\"v\";break;case 153:this.$=\"-\";break;case 154:this.$={stmt:\"dir\",value:\"TB\"};break;case 155:this.$={stmt:\"dir\",value:\"BT\"};break;case 156:this.$={stmt:\"dir\",value:\"RL\"};break;case 157:this.$={stmt:\"dir\",value:\"LR\"}}},table:[{3:1,4:2,5:3,6:5,12:e,16:4,21:n,22:r,24:i},{1:[3]},{1:[2,1]},{3:10,4:2,5:3,6:5,12:e,16:4,21:n,22:r,24:i},t(a,o,{17:11}),{7:12,13:[1,13]},{16:14,21:n,22:r,24:i},{16:15,21:n,22:r,24:i},{25:[1,16],26:[1,17]},{13:[2,5]},{1:[2,2]},{1:[2,9],18:18,19:19,20:s,21:c,22:u,23:l,32:24,33:25,34:26,35:27,36:28,37:29,38:h,43:31,45:32,46:42,47:f,49:43,59:d,60:p,79:y,80:g,81:m,82:v,83:b,84:_,88:x,98:w,99:k,102:T,104:E,105:C,109:44,111:S,112:A,113:M,114:N,115:D,116:O,117:B,118:L,119:I,120:R},{8:61,10:[1,62],15:F},t([10,15],[2,6]),t(a,[2,17]),t(a,[2,18]),t(a,[2,19]),{20:[1,65],21:[1,66],22:P,27:64,30:67},t(j,[2,11]),t(j,[2,12]),t(j,[2,13]),t(j,[2,14]),t(j,[2,15]),t(j,[2,16]),{9:69,20:Y,21:z,23:U,44:70,71:74,74:[1,75],75:[1,76]},{9:77,20:Y,21:z,23:U},{9:78,20:Y,21:z,23:U},{9:79,20:Y,21:z,23:U},{9:80,20:Y,21:z,23:U},{9:81,20:Y,21:z,23:U},{9:83,20:Y,21:z,22:[1,82],23:U},t(j,[2,44]),t(q,[2,51],{30:84,22:P}),{22:[1,85]},{22:[1,86]},{22:[1,87]},{22:[1,88]},{26:H,47:$,59:W,60:V,77:[1,92],84:G,90:91,91:[1,89],93:[1,90],98:X,99:Z,102:Q,104:K,105:J,108:95,110:93,115:tt,116:et,117:nt,118:rt,119:it,120:at},t(j,[2,154]),t(j,[2,155]),t(j,[2,156]),t(j,[2,157]),t(ot,[2,52],{48:[1,111]}),t(st,[2,70],{109:123,40:[1,112],47:f,50:[1,113],52:[1,114],54:[1,115],56:[1,116],58:[1,117],59:d,60:p,62:[1,118],64:[1,119],66:[1,120],67:[1,121],69:[1,122],84:_,88:x,98:w,99:k,102:T,104:E,105:C,115:D,116:O,117:B,118:L,119:I,120:R}),t(ct,[2,146]),t(ct,[2,171]),t(ct,[2,172]),t(ct,[2,173]),t(ct,[2,174]),t(ct,[2,175]),t(ct,[2,176]),t(ct,[2,177]),t(ct,[2,178]),t(ct,[2,179]),t(ct,[2,180]),t(ct,[2,181]),t(ct,[2,182]),t(ct,[2,183]),t(ct,[2,184]),t(ct,[2,185]),t(ct,[2,186]),{9:124,20:Y,21:z,23:U},{11:125,14:[1,126]},t(ut,[2,8]),t(a,[2,20]),t(a,[2,26]),t(a,[2,27]),{21:[1,127]},t(lt,[2,34],{30:128,22:P}),t(j,[2,35]),{45:129,46:42,47:f,49:43,59:d,60:p,84:_,88:x,98:w,99:k,102:T,104:E,105:C,109:44,115:D,116:O,117:B,118:L,119:I,120:R},t(ht,[2,45]),t(ht,[2,46]),t(ht,[2,47]),t(ft,[2,74],{72:130,61:[1,132],73:[1,131]}),{22:dt,24:pt,26:yt,38:gt,39:133,42:mt,47:$,59:W,60:V,66:vt,74:bt,76:134,77:_t,78:145,79:xt,80:wt,81:kt,82:Tt,83:Et,84:Ct,85:St,87:136,88:At,98:X,99:Z,102:Mt,104:K,105:J,106:Nt,107:Dt,108:142,115:tt,116:et,117:nt,118:rt,119:it,120:at},t([47,59,60,61,73,84,88,98,99,102,104,105,115,116,117,118,119,120],[2,76]),t(j,[2,36]),t(j,[2,37]),t(j,[2,38]),t(j,[2,39]),t(j,[2,40]),{22:dt,24:pt,26:yt,38:gt,39:157,42:mt,47:$,59:W,60:V,66:vt,74:bt,76:134,77:_t,78:145,79:xt,80:wt,81:kt,82:Tt,83:Et,84:Ct,85:St,87:136,88:At,98:X,99:Z,102:Mt,104:K,105:J,106:Nt,107:Dt,108:142,115:tt,116:et,117:nt,118:rt,119:it,120:at},t(Ot,o,{17:158}),t(q,[2,50],{47:Bt}),{26:H,47:$,59:W,60:V,84:G,90:160,95:[1,161],98:X,99:Z,102:Q,104:K,105:J,108:95,110:93,115:tt,116:et,117:nt,118:rt,119:it,120:at},{88:[1,162],96:163,98:[1,164]},{26:H,47:$,59:W,60:V,84:G,88:[1,165],90:166,98:X,99:Z,102:Q,104:K,105:J,108:95,110:93,115:tt,116:et,117:nt,118:rt,119:it,120:at},{26:H,47:$,59:W,60:V,84:G,90:167,98:X,99:Z,102:Q,104:K,105:J,108:95,110:93,115:tt,116:et,117:nt,118:rt,119:it,120:at},t(ut,[2,97],{22:[1,168],92:[1,169]}),t(ut,[2,101],{22:[1,170]}),t(ut,[2,105],{108:95,110:172,22:[1,171],26:H,47:$,59:W,60:V,84:G,98:X,99:Z,102:Q,104:K,105:J,115:tt,116:et,117:nt,118:rt,119:it,120:at}),t(ut,[2,107],{22:[1,173]}),t(Lt,[2,148]),t(Lt,[2,150]),t(Lt,[2,151]),t(Lt,[2,152]),t(Lt,[2,153]),t(It,[2,158]),t(It,[2,159]),t(It,[2,160]),t(It,[2,161]),t(It,[2,162]),t(It,[2,163]),t(It,[2,164]),t(It,[2,165]),t(It,[2,166]),t(It,[2,167]),t(It,[2,168]),t(It,[2,169]),t(It,[2,170]),{47:f,49:174,59:d,60:p,84:_,88:x,98:w,99:k,102:T,104:E,105:C,109:44,115:D,116:O,117:B,118:L,119:I,120:R},{22:dt,24:pt,26:yt,38:gt,39:175,42:mt,47:$,59:W,60:V,66:vt,74:bt,76:134,77:_t,78:145,79:xt,80:wt,81:kt,82:Tt,83:Et,84:Ct,85:St,87:136,88:At,98:X,99:Z,102:Mt,104:K,105:J,106:Nt,107:Dt,108:142,115:tt,116:et,117:nt,118:rt,119:it,120:at},{22:dt,24:pt,26:yt,38:gt,39:177,42:mt,47:$,50:[1,176],59:W,60:V,66:vt,74:bt,76:134,77:_t,78:145,79:xt,80:wt,81:kt,82:Tt,83:Et,84:Ct,85:St,87:136,88:At,98:X,99:Z,102:Mt,104:K,105:J,106:Nt,107:Dt,108:142,115:tt,116:et,117:nt,118:rt,119:it,120:at},{22:dt,24:pt,26:yt,38:gt,39:178,42:mt,47:$,59:W,60:V,66:vt,74:bt,76:134,77:_t,78:145,79:xt,80:wt,81:kt,82:Tt,83:Et,84:Ct,85:St,87:136,88:At,98:X,99:Z,102:Mt,104:K,105:J,106:Nt,107:Dt,108:142,115:tt,116:et,117:nt,118:rt,119:it,120:at},{22:dt,24:pt,26:yt,38:gt,39:179,42:mt,47:$,59:W,60:V,66:vt,74:bt,76:134,77:_t,78:145,79:xt,80:wt,81:kt,82:Tt,83:Et,84:Ct,85:St,87:136,88:At,98:X,99:Z,102:Mt,104:K,105:J,106:Nt,107:Dt,108:142,115:tt,116:et,117:nt,118:rt,119:it,120:at},{22:dt,24:pt,26:yt,38:gt,39:180,42:mt,47:$,59:W,60:V,66:vt,74:bt,76:134,77:_t,78:145,79:xt,80:wt,81:kt,82:Tt,83:Et,84:Ct,85:St,87:136,88:At,98:X,99:Z,102:Mt,104:K,105:J,106:Nt,107:Dt,108:142,115:tt,116:et,117:nt,118:rt,119:it,120:at},{59:[1,181]},{22:dt,24:pt,26:yt,38:gt,39:182,42:mt,47:$,59:W,60:V,66:vt,74:bt,76:134,77:_t,78:145,79:xt,80:wt,81:kt,82:Tt,83:Et,84:Ct,85:St,87:136,88:At,98:X,99:Z,102:Mt,104:K,105:J,106:Nt,107:Dt,108:142,115:tt,116:et,117:nt,118:rt,119:it,120:at},{22:dt,24:pt,26:yt,38:gt,39:183,42:mt,47:$,59:W,60:V,64:[1,184],66:vt,74:bt,76:134,77:_t,78:145,79:xt,80:wt,81:kt,82:Tt,83:Et,84:Ct,85:St,87:136,88:At,98:X,99:Z,102:Mt,104:K,105:J,106:Nt,107:Dt,108:142,115:tt,116:et,117:nt,118:rt,119:it,120:at},{22:dt,24:pt,26:yt,38:gt,39:185,42:mt,47:$,59:W,60:V,66:vt,74:bt,76:134,77:_t,78:145,79:xt,80:wt,81:kt,82:Tt,83:Et,84:Ct,85:St,87:136,88:At,98:X,99:Z,102:Mt,104:K,105:J,106:Nt,107:Dt,108:142,115:tt,116:et,117:nt,118:rt,119:it,120:at},{22:dt,24:pt,26:yt,38:gt,39:186,42:mt,47:$,59:W,60:V,66:vt,74:bt,76:134,77:_t,78:145,79:xt,80:wt,81:kt,82:Tt,83:Et,84:Ct,85:St,87:136,88:At,98:X,99:Z,102:Mt,104:K,105:J,106:Nt,107:Dt,108:142,115:tt,116:et,117:nt,118:rt,119:it,120:at},{22:dt,24:pt,26:yt,38:gt,39:187,42:mt,47:$,59:W,60:V,66:vt,74:bt,76:134,77:_t,78:145,79:xt,80:wt,81:kt,82:Tt,83:Et,84:Ct,85:St,87:136,88:At,98:X,99:Z,102:Mt,104:K,105:J,106:Nt,107:Dt,108:142,115:tt,116:et,117:nt,118:rt,119:it,120:at},t(ct,[2,147]),t(Rt,[2,3]),{8:188,15:F},{15:[2,7]},t(a,[2,28]),t(lt,[2,33]),t(q,[2,48],{30:189,22:P}),t(ft,[2,71],{22:[1,190]}),{22:[1,191]},{22:dt,24:pt,26:yt,38:gt,39:192,42:mt,47:$,59:W,60:V,66:vt,74:bt,76:134,77:_t,78:145,79:xt,80:wt,81:kt,82:Tt,83:Et,84:Ct,85:St,87:136,88:At,98:X,99:Z,102:Mt,104:K,105:J,106:Nt,107:Dt,108:142,115:tt,116:et,117:nt,118:rt,119:it,120:at},{22:dt,24:pt,26:yt,38:gt,42:mt,47:$,59:W,60:V,66:vt,74:bt,75:[1,193],76:194,78:145,79:xt,80:wt,81:kt,82:Tt,83:Et,84:Ct,85:St,87:136,88:At,98:X,99:Z,102:Mt,104:K,105:J,106:Nt,107:Dt,108:142,115:tt,116:et,117:nt,118:rt,119:it,120:at},t(It,[2,78]),t(It,[2,80]),t(It,[2,136]),t(It,[2,137]),t(It,[2,138]),t(It,[2,139]),t(It,[2,140]),t(It,[2,141]),t(It,[2,142]),t(It,[2,143]),t(It,[2,144]),t(It,[2,145]),t(It,[2,81]),t(It,[2,82]),t(It,[2,83]),t(It,[2,84]),t(It,[2,85]),t(It,[2,86]),t(It,[2,87]),t(It,[2,88]),t(It,[2,89]),t(It,[2,90]),t(It,[2,91]),{9:196,20:Y,21:z,22:dt,23:U,24:pt,26:yt,38:gt,40:[1,195],42:mt,47:$,59:W,60:V,66:vt,74:bt,76:194,78:145,79:xt,80:wt,81:kt,82:Tt,83:Et,84:Ct,85:St,87:136,88:At,98:X,99:Z,102:Mt,104:K,105:J,106:Nt,107:Dt,108:142,115:tt,116:et,117:nt,118:rt,119:it,120:at},{18:18,19:19,20:s,21:c,22:u,23:l,32:24,33:25,34:26,35:27,36:28,37:29,38:h,42:[1,197],43:31,45:32,46:42,47:f,49:43,59:d,60:p,79:y,80:g,81:m,82:v,83:b,84:_,88:x,98:w,99:k,102:T,104:E,105:C,109:44,111:S,112:A,113:M,114:N,115:D,116:O,117:B,118:L,119:I,120:R},{22:P,30:198},{22:[1,199],26:H,47:$,59:W,60:V,84:G,98:X,99:Z,102:Q,104:K,105:J,108:95,110:172,115:tt,116:et,117:nt,118:rt,119:it,120:at},{22:[1,200]},{22:[1,201]},{22:[1,202],99:[1,203]},t(Ft,[2,119]),{22:[1,204]},{22:[1,205],26:H,47:$,59:W,60:V,84:G,98:X,99:Z,102:Q,104:K,105:J,108:95,110:172,115:tt,116:et,117:nt,118:rt,119:it,120:at},{22:[1,206],26:H,47:$,59:W,60:V,84:G,98:X,99:Z,102:Q,104:K,105:J,108:95,110:172,115:tt,116:et,117:nt,118:rt,119:it,120:at},{77:[1,207]},t(ut,[2,99],{22:[1,208]}),{77:[1,209],94:[1,210]},{77:[1,211]},t(Lt,[2,149]),{77:[1,212],94:[1,213]},t(ot,[2,54],{109:123,47:f,59:d,60:p,84:_,88:x,98:w,99:k,102:T,104:E,105:C,115:D,116:O,117:B,118:L,119:I,120:R}),{22:dt,24:pt,26:yt,38:gt,41:[1,214],42:mt,47:$,59:W,60:V,66:vt,74:bt,76:194,78:145,79:xt,80:wt,81:kt,82:Tt,83:Et,84:Ct,85:St,87:136,88:At,98:X,99:Z,102:Mt,104:K,105:J,106:Nt,107:Dt,108:142,115:tt,116:et,117:nt,118:rt,119:it,120:at},{22:dt,24:pt,26:yt,38:gt,39:215,42:mt,47:$,59:W,60:V,66:vt,74:bt,76:134,77:_t,78:145,79:xt,80:wt,81:kt,82:Tt,83:Et,84:Ct,85:St,87:136,88:At,98:X,99:Z,102:Mt,104:K,105:J,106:Nt,107:Dt,108:142,115:tt,116:et,117:nt,118:rt,119:it,120:at},{22:dt,24:pt,26:yt,38:gt,42:mt,47:$,51:[1,216],59:W,60:V,66:vt,74:bt,76:194,78:145,79:xt,80:wt,81:kt,82:Tt,83:Et,84:Ct,85:St,87:136,88:At,98:X,99:Z,102:Mt,104:K,105:J,106:Nt,107:Dt,108:142,115:tt,116:et,117:nt,118:rt,119:it,120:at},{22:dt,24:pt,26:yt,38:gt,42:mt,47:$,53:[1,217],59:W,60:V,66:vt,74:bt,76:194,78:145,79:xt,80:wt,81:kt,82:Tt,83:Et,84:Ct,85:St,87:136,88:At,98:X,99:Z,102:Mt,104:K,105:J,106:Nt,107:Dt,108:142,115:tt,116:et,117:nt,118:rt,119:it,120:at},{22:dt,24:pt,26:yt,38:gt,42:mt,47:$,55:[1,218],59:W,60:V,66:vt,74:bt,76:194,78:145,79:xt,80:wt,81:kt,82:Tt,83:Et,84:Ct,85:St,87:136,88:At,98:X,99:Z,102:Mt,104:K,105:J,106:Nt,107:Dt,108:142,115:tt,116:et,117:nt,118:rt,119:it,120:at},{22:dt,24:pt,26:yt,38:gt,42:mt,47:$,57:[1,219],59:W,60:V,66:vt,74:bt,76:194,78:145,79:xt,80:wt,81:kt,82:Tt,83:Et,84:Ct,85:St,87:136,88:At,98:X,99:Z,102:Mt,104:K,105:J,106:Nt,107:Dt,108:142,115:tt,116:et,117:nt,118:rt,119:it,120:at},{60:[1,220]},{22:dt,24:pt,26:yt,38:gt,42:mt,47:$,59:W,60:V,63:[1,221],66:vt,74:bt,76:194,78:145,79:xt,80:wt,81:kt,82:Tt,83:Et,84:Ct,85:St,87:136,88:At,98:X,99:Z,102:Mt,104:K,105:J,106:Nt,107:Dt,108:142,115:tt,116:et,117:nt,118:rt,119:it,120:at},{22:dt,24:pt,26:yt,38:gt,42:mt,47:$,59:W,60:V,65:[1,222],66:vt,74:bt,76:194,78:145,79:xt,80:wt,81:kt,82:Tt,83:Et,84:Ct,85:St,87:136,88:At,98:X,99:Z,102:Mt,104:K,105:J,106:Nt,107:Dt,108:142,115:tt,116:et,117:nt,118:rt,119:it,120:at},{22:dt,24:pt,26:yt,38:gt,39:223,42:mt,47:$,59:W,60:V,66:vt,74:bt,76:134,77:_t,78:145,79:xt,80:wt,81:kt,82:Tt,83:Et,84:Ct,85:St,87:136,88:At,98:X,99:Z,102:Mt,104:K,105:J,106:Nt,107:Dt,108:142,115:tt,116:et,117:nt,118:rt,119:it,120:at},{22:dt,24:pt,26:yt,38:gt,41:[1,224],42:mt,47:$,59:W,60:V,66:vt,74:bt,76:194,78:145,79:xt,80:wt,81:kt,82:Tt,83:Et,84:Ct,85:St,87:136,88:At,98:X,99:Z,102:Mt,104:K,105:J,106:Nt,107:Dt,108:142,115:tt,116:et,117:nt,118:rt,119:it,120:at},{22:dt,24:pt,26:yt,38:gt,42:mt,47:$,59:W,60:V,66:vt,68:[1,225],70:[1,226],74:bt,76:194,78:145,79:xt,80:wt,81:kt,82:Tt,83:Et,84:Ct,85:St,87:136,88:At,98:X,99:Z,102:Mt,104:K,105:J,106:Nt,107:Dt,108:142,115:tt,116:et,117:nt,118:rt,119:it,120:at},{22:dt,24:pt,26:yt,38:gt,42:mt,47:$,59:W,60:V,66:vt,68:[1,228],70:[1,227],74:bt,76:194,78:145,79:xt,80:wt,81:kt,82:Tt,83:Et,84:Ct,85:St,87:136,88:At,98:X,99:Z,102:Mt,104:K,105:J,106:Nt,107:Dt,108:142,115:tt,116:et,117:nt,118:rt,119:it,120:at},{9:229,20:Y,21:z,23:U},t(q,[2,49],{47:Bt}),t(ft,[2,73]),t(ft,[2,72]),{22:dt,24:pt,26:yt,38:gt,42:mt,47:$,59:W,60:V,61:[1,230],66:vt,74:bt,76:194,78:145,79:xt,80:wt,81:kt,82:Tt,83:Et,84:Ct,85:St,87:136,88:At,98:X,99:Z,102:Mt,104:K,105:J,106:Nt,107:Dt,108:142,115:tt,116:et,117:nt,118:rt,119:it,120:at},t(ft,[2,75]),t(It,[2,79]),{22:dt,24:pt,26:yt,38:gt,39:231,42:mt,47:$,59:W,60:V,66:vt,74:bt,76:134,77:_t,78:145,79:xt,80:wt,81:kt,82:Tt,83:Et,84:Ct,85:St,87:136,88:At,98:X,99:Z,102:Mt,104:K,105:J,106:Nt,107:Dt,108:142,115:tt,116:et,117:nt,118:rt,119:it,120:at},t(Ot,o,{17:232}),t(j,[2,43]),{46:233,47:f,49:43,59:d,60:p,84:_,88:x,98:w,99:k,102:T,104:E,105:C,109:44,115:D,116:O,117:B,118:L,119:I,120:R},{22:Pt,59:jt,60:Yt,79:zt,89:234,95:Ut,98:qt,100:235,101:236,102:Ht,103:$t,104:Wt,105:Vt,106:Gt},{22:Pt,59:jt,60:Yt,79:zt,89:248,95:Ut,98:qt,100:235,101:236,102:Ht,103:$t,104:Wt,105:Vt,106:Gt},{22:Pt,59:jt,60:Yt,79:zt,89:249,95:Ut,97:[1,250],98:qt,100:235,101:236,102:Ht,103:$t,104:Wt,105:Vt,106:Gt},{22:Pt,59:jt,60:Yt,79:zt,89:251,95:Ut,97:[1,252],98:qt,100:235,101:236,102:Ht,103:$t,104:Wt,105:Vt,106:Gt},{98:[1,253]},{22:Pt,59:jt,60:Yt,79:zt,89:254,95:Ut,98:qt,100:235,101:236,102:Ht,103:$t,104:Wt,105:Vt,106:Gt},{22:Pt,59:jt,60:Yt,79:zt,89:255,95:Ut,98:qt,100:235,101:236,102:Ht,103:$t,104:Wt,105:Vt,106:Gt},{26:H,47:$,59:W,60:V,84:G,90:256,98:X,99:Z,102:Q,104:K,105:J,108:95,110:93,115:tt,116:et,117:nt,118:rt,119:it,120:at},t(ut,[2,98]),{77:[1,257]},t(ut,[2,102],{22:[1,258]}),t(ut,[2,103]),t(ut,[2,106]),t(ut,[2,108],{22:[1,259]}),t(ut,[2,109]),t(st,[2,55]),{22:dt,24:pt,26:yt,38:gt,42:mt,47:$,51:[1,260],59:W,60:V,66:vt,74:bt,76:194,78:145,79:xt,80:wt,81:kt,82:Tt,83:Et,84:Ct,85:St,87:136,88:At,98:X,99:Z,102:Mt,104:K,105:J,106:Nt,107:Dt,108:142,115:tt,116:et,117:nt,118:rt,119:it,120:at},t(st,[2,62]),t(st,[2,57]),t(st,[2,58]),t(st,[2,59]),{59:[1,261]},t(st,[2,61]),t(st,[2,63]),{22:dt,24:pt,26:yt,38:gt,42:mt,47:$,59:W,60:V,65:[1,262],66:vt,74:bt,76:194,78:145,79:xt,80:wt,81:kt,82:Tt,83:Et,84:Ct,85:St,87:136,88:At,98:X,99:Z,102:Mt,104:K,105:J,106:Nt,107:Dt,108:142,115:tt,116:et,117:nt,118:rt,119:it,120:at},t(st,[2,65]),t(st,[2,66]),t(st,[2,68]),t(st,[2,67]),t(st,[2,69]),t(Rt,[2,4]),t([22,47,59,60,84,88,98,99,102,104,105,115,116,117,118,119,120],[2,77]),{22:dt,24:pt,26:yt,38:gt,41:[1,263],42:mt,47:$,59:W,60:V,66:vt,74:bt,76:194,78:145,79:xt,80:wt,81:kt,82:Tt,83:Et,84:Ct,85:St,87:136,88:At,98:X,99:Z,102:Mt,104:K,105:J,106:Nt,107:Dt,108:142,115:tt,116:et,117:nt,118:rt,119:it,120:at},{18:18,19:19,20:s,21:c,22:u,23:l,32:24,33:25,34:26,35:27,36:28,37:29,38:h,42:[1,264],43:31,45:32,46:42,47:f,49:43,59:d,60:p,79:y,80:g,81:m,82:v,83:b,84:_,88:x,98:w,99:k,102:T,104:E,105:C,109:44,111:S,112:A,113:M,114:N,115:D,116:O,117:B,118:L,119:I,120:R},t(ot,[2,53]),t(ut,[2,111],{99:Xt}),t(Zt,[2,121],{101:266,22:Pt,59:jt,60:Yt,79:zt,95:Ut,98:qt,102:Ht,103:$t,104:Wt,105:Vt,106:Gt}),t(Qt,[2,123]),t(Qt,[2,125]),t(Qt,[2,126]),t(Qt,[2,127]),t(Qt,[2,128]),t(Qt,[2,129]),t(Qt,[2,130]),t(Qt,[2,131]),t(Qt,[2,132]),t(Qt,[2,133]),t(Qt,[2,134]),t(Qt,[2,135]),t(ut,[2,112],{99:Xt}),t(ut,[2,113],{99:Xt}),{22:[1,267]},t(ut,[2,114],{99:Xt}),{22:[1,268]},t(Ft,[2,120]),t(ut,[2,94],{99:Xt}),t(ut,[2,95],{99:Xt}),t(ut,[2,96],{108:95,110:172,26:H,47:$,59:W,60:V,84:G,98:X,99:Z,102:Q,104:K,105:J,115:tt,116:et,117:nt,118:rt,119:it,120:at}),t(ut,[2,100]),{94:[1,269]},{94:[1,270]},{51:[1,271]},{61:[1,272]},{65:[1,273]},{9:274,20:Y,21:z,23:U},t(j,[2,42]),{22:Pt,59:jt,60:Yt,79:zt,95:Ut,98:qt,100:275,101:236,102:Ht,103:$t,104:Wt,105:Vt,106:Gt},t(Qt,[2,124]),{26:H,47:$,59:W,60:V,84:G,90:276,98:X,99:Z,102:Q,104:K,105:J,108:95,110:93,115:tt,116:et,117:nt,118:rt,119:it,120:at},{26:H,47:$,59:W,60:V,84:G,90:277,98:X,99:Z,102:Q,104:K,105:J,108:95,110:93,115:tt,116:et,117:nt,118:rt,119:it,120:at},t(ut,[2,104]),t(ut,[2,110]),t(st,[2,56]),{22:dt,24:pt,26:yt,38:gt,39:278,42:mt,47:$,59:W,60:V,66:vt,74:bt,76:134,77:_t,78:145,79:xt,80:wt,81:kt,82:Tt,83:Et,84:Ct,85:St,87:136,88:At,98:X,99:Z,102:Mt,104:K,105:J,106:Nt,107:Dt,108:142,115:tt,116:et,117:nt,118:rt,119:it,120:at},t(st,[2,64]),t(Ot,o,{17:279}),t(Zt,[2,122],{101:266,22:Pt,59:jt,60:Yt,79:zt,95:Ut,98:qt,102:Ht,103:$t,104:Wt,105:Vt,106:Gt}),t(ut,[2,117],{108:95,110:172,22:[1,280],26:H,47:$,59:W,60:V,84:G,98:X,99:Z,102:Q,104:K,105:J,115:tt,116:et,117:nt,118:rt,119:it,120:at}),t(ut,[2,118],{108:95,110:172,22:[1,281],26:H,47:$,59:W,60:V,84:G,98:X,99:Z,102:Q,104:K,105:J,115:tt,116:et,117:nt,118:rt,119:it,120:at}),{22:dt,24:pt,26:yt,38:gt,41:[1,282],42:mt,47:$,59:W,60:V,66:vt,74:bt,76:194,78:145,79:xt,80:wt,81:kt,82:Tt,83:Et,84:Ct,85:St,87:136,88:At,98:X,99:Z,102:Mt,104:K,105:J,106:Nt,107:Dt,108:142,115:tt,116:et,117:nt,118:rt,119:it,120:at},{18:18,19:19,20:s,21:c,22:u,23:l,32:24,33:25,34:26,35:27,36:28,37:29,38:h,42:[1,283],43:31,45:32,46:42,47:f,49:43,59:d,60:p,79:y,80:g,81:m,82:v,83:b,84:_,88:x,98:w,99:k,102:T,104:E,105:C,109:44,111:S,112:A,113:M,114:N,115:D,116:O,117:B,118:L,119:I,120:R},{22:Pt,59:jt,60:Yt,79:zt,89:284,95:Ut,98:qt,100:235,101:236,102:Ht,103:$t,104:Wt,105:Vt,106:Gt},{22:Pt,59:jt,60:Yt,79:zt,89:285,95:Ut,98:qt,100:235,101:236,102:Ht,103:$t,104:Wt,105:Vt,106:Gt},t(st,[2,60]),t(j,[2,41]),t(ut,[2,115],{99:Xt}),t(ut,[2,116],{99:Xt})],defaultActions:{2:[2,1],9:[2,5],10:[2,2],126:[2,7]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],o=this.table,s=\"\",c=0,u=0,l=0,h=2,f=1,d=a.slice.call(arguments,1),p=Object.create(this.lexer),y={yy:{}};for(var g in this.yy)Object.prototype.hasOwnProperty.call(this.yy,g)&&(y.yy[g]=this.yy[g]);p.setInput(t,y.yy),y.yy.lexer=p,y.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var m=p.yylloc;a.push(m);var v=p.options&&p.options.ranges;function b(){var t;return\"number\"!=typeof(t=r.pop()||p.lex()||f)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}\"function\"==typeof y.yy.parseError?this.parseError=y.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var _,x,w,k,T,E,C,S,A,M={};;){if(w=n[n.length-1],this.defaultActions[w]?k=this.defaultActions[w]:(null==_&&(_=b()),k=o[w]&&o[w][_]),void 0===k||!k.length||!k[0]){var N=\"\";for(E in A=[],o[w])this.terminals_[E]&&E>h&&A.push(\"'\"+this.terminals_[E]+\"'\");N=p.showPosition?\"Parse error on line \"+(c+1)+\":\\n\"+p.showPosition()+\"\\nExpecting \"+A.join(\", \")+\", got '\"+(this.terminals_[_]||_)+\"'\":\"Parse error on line \"+(c+1)+\": Unexpected \"+(_==f?\"end of input\":\"'\"+(this.terminals_[_]||_)+\"'\"),this.parseError(N,{text:p.match,token:this.terminals_[_]||_,line:p.yylineno,loc:m,expected:A})}if(k[0]instanceof Array&&k.length>1)throw new Error(\"Parse Error: multiple actions possible at state: \"+w+\", token: \"+_);switch(k[0]){case 1:n.push(_),i.push(p.yytext),a.push(p.yylloc),n.push(k[1]),_=null,x?(_=x,x=null):(u=p.yyleng,s=p.yytext,c=p.yylineno,m=p.yylloc,l>0&&l--);break;case 2:if(C=this.productions_[k[1]][1],M.$=i[i.length-C],M._$={first_line:a[a.length-(C||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(C||1)].first_column,last_column:a[a.length-1].last_column},v&&(M._$.range=[a[a.length-(C||1)].range[0],a[a.length-1].range[1]]),void 0!==(T=this.performAction.apply(M,[s,u,c,y.yy,k[1],i,a].concat(d))))return T;C&&(n=n.slice(0,-1*C*2),i=i.slice(0,-1*C),a=a.slice(0,-1*C)),n.push(this.productions_[k[1]][0]),i.push(M.$),a.push(M._$),S=o[n[n.length-2]][n[n.length-1]],n.push(S);break;case 3:return!0}}return!0}},Jt={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=\"\",this.conditionStack=[\"INITIAL\"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\\r\\n?|\\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\\r\\n?|\\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\\r\\n?|\\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?\"...\":\"\")+t.substr(-20).replace(/\\n/g,\"\")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?\"...\":\"\")).replace(/\\n/g,\"\")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join(\"-\");return t+this.upcomingInput()+\"\\n\"+e+\"^\"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\\r\\n?|\\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\\r?\\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext=\"\",this.match=\"\");for(var i=this._currentRules(),a=0;ae[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:\"\"===this._input?this.EOF:this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". Unrecognized text.\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},lex:function(){return this.next()||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:\"INITIAL\"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{},performAction:function(t,e,n,r){switch(n){case 0:return this.begin(\"open_directive\"),12;case 1:return this.begin(\"type_directive\"),13;case 2:return this.popState(),this.begin(\"arg_directive\"),10;case 3:return this.popState(),this.popState(),15;case 4:return 14;case 5:case 6:break;case 7:this.begin(\"string\");break;case 8:case 17:case 20:case 23:case 26:this.popState();break;case 9:return\"STR\";case 10:return 79;case 11:return 88;case 12:return 80;case 13:return 97;case 14:return 81;case 15:return 82;case 16:this.begin(\"href\");break;case 18:return 93;case 19:this.begin(\"callbackname\");break;case 21:this.popState(),this.begin(\"callbackargs\");break;case 22:return 91;case 24:return 92;case 25:this.begin(\"click\");break;case 27:return 83;case 28:case 29:return t.lex.firstGraph()&&this.begin(\"dir\"),24;case 30:return 38;case 31:return 42;case 32:case 33:case 34:case 35:return 94;case 36:return this.popState(),25;case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:return this.popState(),26;case 47:return 111;case 48:return 112;case 49:return 113;case 50:return 114;case 51:return 98;case 52:return 104;case 53:return 48;case 54:return 60;case 55:return 47;case 56:return 20;case 57:return 99;case 58:return 119;case 59:case 60:case 61:return 75;case 62:case 63:case 64:return 74;case 65:return 52;case 66:return 53;case 67:return 54;case 68:return 55;case 69:return 56;case 70:return 57;case 71:return 58;case 72:return 62;case 73:return 63;case 74:return 102;case 75:return 105;case 76:return 120;case 77:return 117;case 78:return 106;case 79:case 80:return 118;case 81:return 107;case 82:return 66;case 83:return 85;case 84:return\"SEP\";case 85:return 84;case 86:return 59;case 87:return 68;case 88:return 67;case 89:return 70;case 90:return 69;case 91:return 115;case 92:return 116;case 93:return 61;case 94:return 50;case 95:return 51;case 96:return 40;case 97:return 41;case 98:return 64;case 99:return 65;case 100:return 126;case 101:return 21;case 102:return 22;case 103:return 23}},rules:[/^(?:%%\\{)/,/^(?:((?:(?!\\}%%)[^:.])*))/,/^(?::)/,/^(?:\\}%%)/,/^(?:((?:(?!\\}%%).|\\n)*))/,/^(?:%%(?!\\{)[^\\n]*)/,/^(?:[^\\}]%%[^\\n]*)/,/^(?:[\"])/,/^(?:[\"])/,/^(?:[^\"]*)/,/^(?:style\\b)/,/^(?:default\\b)/,/^(?:linkStyle\\b)/,/^(?:interpolate\\b)/,/^(?:classDef\\b)/,/^(?:class\\b)/,/^(?:href[\\s]+[\"])/,/^(?:[\"])/,/^(?:[^\"]*)/,/^(?:call[\\s]+)/,/^(?:\\([\\s]*\\))/,/^(?:\\()/,/^(?:[^(]*)/,/^(?:\\))/,/^(?:[^)]*)/,/^(?:click[\\s]+)/,/^(?:[\\s\\n])/,/^(?:[^\\s\\n]*)/,/^(?:graph\\b)/,/^(?:flowchart\\b)/,/^(?:subgraph\\b)/,/^(?:end\\b\\s*)/,/^(?:_self\\b)/,/^(?:_blank\\b)/,/^(?:_parent\\b)/,/^(?:_top\\b)/,/^(?:(\\r?\\n)*\\s*\\n)/,/^(?:\\s*LR\\b)/,/^(?:\\s*RL\\b)/,/^(?:\\s*TB\\b)/,/^(?:\\s*BT\\b)/,/^(?:\\s*TD\\b)/,/^(?:\\s*BR\\b)/,/^(?:\\s*<)/,/^(?:\\s*>)/,/^(?:\\s*\\^)/,/^(?:\\s*v\\b)/,/^(?:.*direction\\s+TB[^\\n]*)/,/^(?:.*direction\\s+BT[^\\n]*)/,/^(?:.*direction\\s+RL[^\\n]*)/,/^(?:.*direction\\s+LR[^\\n]*)/,/^(?:[0-9]+)/,/^(?:#)/,/^(?::::)/,/^(?::)/,/^(?:&)/,/^(?:;)/,/^(?:,)/,/^(?:\\*)/,/^(?:\\s*[xo<]?--+[-xo>]\\s*)/,/^(?:\\s*[xo<]?==+[=xo>]\\s*)/,/^(?:\\s*[xo<]?-?\\.+-[xo>]?\\s*)/,/^(?:\\s*[xo<]?--\\s*)/,/^(?:\\s*[xo<]?==\\s*)/,/^(?:\\s*[xo<]?-\\.\\s*)/,/^(?:\\(-)/,/^(?:-\\))/,/^(?:\\(\\[)/,/^(?:\\]\\))/,/^(?:\\[\\[)/,/^(?:\\]\\])/,/^(?:\\[\\|)/,/^(?:\\[\\()/,/^(?:\\)\\])/,/^(?:-)/,/^(?:\\.)/,/^(?:[\\_])/,/^(?:\\+)/,/^(?:%)/,/^(?:=)/,/^(?:=)/,/^(?:<)/,/^(?:>)/,/^(?:\\^)/,/^(?:\\\\\\|)/,/^(?:v\\b)/,/^(?:[A-Za-z]+)/,/^(?:\\\\\\])/,/^(?:\\[\\/)/,/^(?:\\/\\])/,/^(?:\\[\\\\)/,/^(?:[!\"#$%&'*+,-.`?\\\\_/])/,/^(?:[\\u00AA\\u00B5\\u00BA\\u00C0-\\u00D6\\u00D8-\\u00F6]|[\\u00F8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377]|[\\u037A-\\u037D\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5]|[\\u03F7-\\u0481\\u048A-\\u0527\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA]|[\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE]|[\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA]|[\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0]|[\\u08A2-\\u08AC\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0977]|[\\u0979-\\u097F\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2]|[\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A]|[\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39]|[\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8]|[\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C]|[\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C]|[\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99]|[\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0]|[\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C33\\u0C35-\\u0C39\\u0C3D]|[\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3]|[\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10]|[\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1]|[\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81]|[\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3]|[\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6]|[\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A]|[\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081]|[\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D]|[\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0]|[\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310]|[\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C]|[\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u1700-\\u170C\\u170E-\\u1711]|[\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7]|[\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191C]|[\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16]|[\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF]|[\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC]|[\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D]|[\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D]|[\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3]|[\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F]|[\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128]|[\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2183\\u2184]|[\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3]|[\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6]|[\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE]|[\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005\\u3006\\u3031-\\u3035\\u303B\\u303C]|[\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D]|[\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC]|[\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B]|[\\uA640-\\uA66E\\uA67F-\\uA697\\uA6A0-\\uA6E5\\uA717-\\uA71F\\uA722-\\uA788]|[\\uA78B-\\uA78E\\uA790-\\uA793\\uA7A0-\\uA7AA\\uA7F8-\\uA801\\uA803-\\uA805]|[\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB]|[\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uAA00-\\uAA28]|[\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA80-\\uAAAF\\uAAB1\\uAAB5]|[\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4]|[\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E]|[\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D]|[\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36]|[\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D]|[\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC]|[\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF]|[\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC])/,/^(?:\\|)/,/^(?:\\()/,/^(?:\\))/,/^(?:\\[)/,/^(?:\\])/,/^(?:\\{)/,/^(?:\\})/,/^(?:\")/,/^(?:(\\r?\\n)+)/,/^(?:\\s)/,/^(?:$)/],conditions:{close_directive:{rules:[],inclusive:!1},arg_directive:{rules:[3,4],inclusive:!1},type_directive:{rules:[2,3],inclusive:!1},open_directive:{rules:[1],inclusive:!1},callbackargs:{rules:[23,24],inclusive:!1},callbackname:{rules:[20,21,22],inclusive:!1},href:{rules:[17,18],inclusive:!1},click:{rules:[26,27],inclusive:!1},vertex:{rules:[],inclusive:!1},dir:{rules:[36,37,38,39,40,41,42,43,44,45,46],inclusive:!1},string:{rules:[8,9],inclusive:!1},INITIAL:{rules:[0,5,6,7,10,11,12,13,14,15,16,19,25,28,29,30,31,32,33,34,35,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103],inclusive:!0}}};function te(){this.yy={}}return Kt.lexer=Jt,te.prototype=Kt,Kt.Parser=te,new te}();e.parser=r,e.Parser=r.Parser,e.parse=function(){return r.parse.apply(r,arguments)},e.main=function(t){t[1]||(console.log(\"Usage: \"+t[0]+\" FILE\"),process.exit(1));var r=n(5354).readFileSync(n(6470).normalize(t[1]),\"utf8\");return e.parser.parse(r)},n.c[n.s]===t&&e.main(process.argv.slice(1))},9959:(t,e,n)=>{t=n.nmd(t);var r=function(){var t=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},e=[1,3],n=[1,5],r=[7,9,11,12,13,14,15,16,17,18,19,20,22,29,34],i=[1,15],a=[1,16],o=[1,17],s=[1,18],c=[1,19],u=[1,20],l=[1,21],h=[1,22],f=[1,23],d=[1,25],p=[1,27],y=[1,30],g=[5,7,9,11,12,13,14,15,16,17,18,19,20,22,29,34],m={trace:function(){},yy:{},symbols_:{error:2,start:3,directive:4,gantt:5,document:6,EOF:7,line:8,SPACE:9,statement:10,NL:11,dateFormat:12,inclusiveEndDates:13,topAxis:14,axisFormat:15,excludes:16,includes:17,todayMarker:18,title:19,section:20,clickStatement:21,taskTxt:22,taskData:23,openDirective:24,typeDirective:25,closeDirective:26,\":\":27,argDirective:28,click:29,callbackname:30,callbackargs:31,href:32,clickStatementDebug:33,open_directive:34,type_directive:35,arg_directive:36,close_directive:37,$accept:0,$end:1},terminals_:{2:\"error\",5:\"gantt\",7:\"EOF\",9:\"SPACE\",11:\"NL\",12:\"dateFormat\",13:\"inclusiveEndDates\",14:\"topAxis\",15:\"axisFormat\",16:\"excludes\",17:\"includes\",18:\"todayMarker\",19:\"title\",20:\"section\",22:\"taskTxt\",23:\"taskData\",27:\":\",29:\"click\",30:\"callbackname\",31:\"callbackargs\",32:\"href\",34:\"open_directive\",35:\"type_directive\",36:\"arg_directive\",37:\"close_directive\"},productions_:[0,[3,2],[3,3],[6,0],[6,2],[8,2],[8,1],[8,1],[8,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,2],[10,1],[4,4],[4,6],[21,2],[21,3],[21,3],[21,4],[21,3],[21,4],[21,2],[33,2],[33,3],[33,3],[33,4],[33,3],[33,4],[33,2],[24,1],[25,1],[28,1],[26,1]],performAction:function(t,e,n,r,i,a,o){var s=a.length-1;switch(i){case 2:return a[s-1];case 3:case 7:case 8:this.$=[];break;case 4:a[s-1].push(a[s]),this.$=a[s-1];break;case 5:case 6:this.$=a[s];break;case 9:r.setDateFormat(a[s].substr(11)),this.$=a[s].substr(11);break;case 10:r.enableInclusiveEndDates(),this.$=a[s].substr(18);break;case 11:r.TopAxis(),this.$=a[s].substr(8);break;case 12:r.setAxisFormat(a[s].substr(11)),this.$=a[s].substr(11);break;case 13:r.setExcludes(a[s].substr(9)),this.$=a[s].substr(9);break;case 14:r.setIncludes(a[s].substr(9)),this.$=a[s].substr(9);break;case 15:r.setTodayMarker(a[s].substr(12)),this.$=a[s].substr(12);break;case 16:r.setTitle(a[s].substr(6)),this.$=a[s].substr(6);break;case 17:r.addSection(a[s].substr(8)),this.$=a[s].substr(8);break;case 19:r.addTask(a[s-1],a[s]),this.$=\"task\";break;case 23:this.$=a[s-1],r.setClickEvent(a[s-1],a[s],null);break;case 24:this.$=a[s-2],r.setClickEvent(a[s-2],a[s-1],a[s]);break;case 25:this.$=a[s-2],r.setClickEvent(a[s-2],a[s-1],null),r.setLink(a[s-2],a[s]);break;case 26:this.$=a[s-3],r.setClickEvent(a[s-3],a[s-2],a[s-1]),r.setLink(a[s-3],a[s]);break;case 27:this.$=a[s-2],r.setClickEvent(a[s-2],a[s],null),r.setLink(a[s-2],a[s-1]);break;case 28:this.$=a[s-3],r.setClickEvent(a[s-3],a[s-1],a[s]),r.setLink(a[s-3],a[s-2]);break;case 29:this.$=a[s-1],r.setLink(a[s-1],a[s]);break;case 30:case 36:this.$=a[s-1]+\" \"+a[s];break;case 31:case 32:case 34:this.$=a[s-2]+\" \"+a[s-1]+\" \"+a[s];break;case 33:case 35:this.$=a[s-3]+\" \"+a[s-2]+\" \"+a[s-1]+\" \"+a[s];break;case 37:r.parseDirective(\"%%{\",\"open_directive\");break;case 38:r.parseDirective(a[s],\"type_directive\");break;case 39:a[s]=a[s].trim().replace(/'/g,'\"'),r.parseDirective(a[s],\"arg_directive\");break;case 40:r.parseDirective(\"}%%\",\"close_directive\",\"gantt\")}},table:[{3:1,4:2,5:e,24:4,34:n},{1:[3]},{3:6,4:2,5:e,24:4,34:n},t(r,[2,3],{6:7}),{25:8,35:[1,9]},{35:[2,37]},{1:[2,1]},{4:26,7:[1,10],8:11,9:[1,12],10:13,11:[1,14],12:i,13:a,14:o,15:s,16:c,17:u,18:l,19:h,20:f,21:24,22:d,24:4,29:p,34:n},{26:28,27:[1,29],37:y},t([27,37],[2,38]),t(r,[2,8],{1:[2,2]}),t(r,[2,4]),{4:26,10:31,12:i,13:a,14:o,15:s,16:c,17:u,18:l,19:h,20:f,21:24,22:d,24:4,29:p,34:n},t(r,[2,6]),t(r,[2,7]),t(r,[2,9]),t(r,[2,10]),t(r,[2,11]),t(r,[2,12]),t(r,[2,13]),t(r,[2,14]),t(r,[2,15]),t(r,[2,16]),t(r,[2,17]),t(r,[2,18]),{23:[1,32]},t(r,[2,20]),{30:[1,33],32:[1,34]},{11:[1,35]},{28:36,36:[1,37]},{11:[2,40]},t(r,[2,5]),t(r,[2,19]),t(r,[2,23],{31:[1,38],32:[1,39]}),t(r,[2,29],{30:[1,40]}),t(g,[2,21]),{26:41,37:y},{37:[2,39]},t(r,[2,24],{32:[1,42]}),t(r,[2,25]),t(r,[2,27],{31:[1,43]}),{11:[1,44]},t(r,[2,26]),t(r,[2,28]),t(g,[2,22])],defaultActions:{5:[2,37],6:[2,1],30:[2,40],37:[2,39]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],o=this.table,s=\"\",c=0,u=0,l=0,h=2,f=1,d=a.slice.call(arguments,1),p=Object.create(this.lexer),y={yy:{}};for(var g in this.yy)Object.prototype.hasOwnProperty.call(this.yy,g)&&(y.yy[g]=this.yy[g]);p.setInput(t,y.yy),y.yy.lexer=p,y.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var m=p.yylloc;a.push(m);var v=p.options&&p.options.ranges;function b(){var t;return\"number\"!=typeof(t=r.pop()||p.lex()||f)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}\"function\"==typeof y.yy.parseError?this.parseError=y.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var _,x,w,k,T,E,C,S,A,M={};;){if(w=n[n.length-1],this.defaultActions[w]?k=this.defaultActions[w]:(null==_&&(_=b()),k=o[w]&&o[w][_]),void 0===k||!k.length||!k[0]){var N=\"\";for(E in A=[],o[w])this.terminals_[E]&&E>h&&A.push(\"'\"+this.terminals_[E]+\"'\");N=p.showPosition?\"Parse error on line \"+(c+1)+\":\\n\"+p.showPosition()+\"\\nExpecting \"+A.join(\", \")+\", got '\"+(this.terminals_[_]||_)+\"'\":\"Parse error on line \"+(c+1)+\": Unexpected \"+(_==f?\"end of input\":\"'\"+(this.terminals_[_]||_)+\"'\"),this.parseError(N,{text:p.match,token:this.terminals_[_]||_,line:p.yylineno,loc:m,expected:A})}if(k[0]instanceof Array&&k.length>1)throw new Error(\"Parse Error: multiple actions possible at state: \"+w+\", token: \"+_);switch(k[0]){case 1:n.push(_),i.push(p.yytext),a.push(p.yylloc),n.push(k[1]),_=null,x?(_=x,x=null):(u=p.yyleng,s=p.yytext,c=p.yylineno,m=p.yylloc,l>0&&l--);break;case 2:if(C=this.productions_[k[1]][1],M.$=i[i.length-C],M._$={first_line:a[a.length-(C||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(C||1)].first_column,last_column:a[a.length-1].last_column},v&&(M._$.range=[a[a.length-(C||1)].range[0],a[a.length-1].range[1]]),void 0!==(T=this.performAction.apply(M,[s,u,c,y.yy,k[1],i,a].concat(d))))return T;C&&(n=n.slice(0,-1*C*2),i=i.slice(0,-1*C),a=a.slice(0,-1*C)),n.push(this.productions_[k[1]][0]),i.push(M.$),a.push(M._$),S=o[n[n.length-2]][n[n.length-1]],n.push(S);break;case 3:return!0}}return!0}},v={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=\"\",this.conditionStack=[\"INITIAL\"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\\r\\n?|\\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\\r\\n?|\\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\\r\\n?|\\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?\"...\":\"\")+t.substr(-20).replace(/\\n/g,\"\")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?\"...\":\"\")).replace(/\\n/g,\"\")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join(\"-\");return t+this.upcomingInput()+\"\\n\"+e+\"^\"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\\r\\n?|\\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\\r?\\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext=\"\",this.match=\"\");for(var i=this._currentRules(),a=0;ae[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:\"\"===this._input?this.EOF:this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". Unrecognized text.\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},lex:function(){return this.next()||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:\"INITIAL\"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{\"case-insensitive\":!0},performAction:function(t,e,n,r){switch(n){case 0:return this.begin(\"open_directive\"),34;case 1:return this.begin(\"type_directive\"),35;case 2:return this.popState(),this.begin(\"arg_directive\"),27;case 3:return this.popState(),this.popState(),37;case 4:return 36;case 5:case 6:case 7:case 9:case 10:case 11:break;case 8:return 11;case 12:this.begin(\"href\");break;case 13:case 16:case 19:case 22:this.popState();break;case 14:return 32;case 15:this.begin(\"callbackname\");break;case 17:this.popState(),this.begin(\"callbackargs\");break;case 18:return 30;case 20:return 31;case 21:this.begin(\"click\");break;case 23:return 29;case 24:return 5;case 25:return 12;case 26:return 13;case 27:return 14;case 28:return 15;case 29:return 17;case 30:return 16;case 31:return 18;case 32:return\"date\";case 33:return 19;case 34:return 20;case 35:return 22;case 36:return 23;case 37:return 27;case 38:return 7;case 39:return\"INVALID\"}},rules:[/^(?:%%\\{)/i,/^(?:((?:(?!\\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\\}%%)/i,/^(?:((?:(?!\\}%%).|\\n)*))/i,/^(?:%%(?!\\{)*[^\\n]*)/i,/^(?:[^\\}]%%*[^\\n]*)/i,/^(?:%%*[^\\n]*[\\n]*)/i,/^(?:[\\n]+)/i,/^(?:\\s+)/i,/^(?:#[^\\n]*)/i,/^(?:%[^\\n]*)/i,/^(?:href[\\s]+[\"])/i,/^(?:[\"])/i,/^(?:[^\"]*)/i,/^(?:call[\\s]+)/i,/^(?:\\([\\s]*\\))/i,/^(?:\\()/i,/^(?:[^(]*)/i,/^(?:\\))/i,/^(?:[^)]*)/i,/^(?:click[\\s]+)/i,/^(?:[\\s\\n])/i,/^(?:[^\\s\\n]*)/i,/^(?:gantt\\b)/i,/^(?:dateFormat\\s[^#\\n;]+)/i,/^(?:inclusiveEndDates\\b)/i,/^(?:topAxis\\b)/i,/^(?:axisFormat\\s[^#\\n;]+)/i,/^(?:includes\\s[^#\\n;]+)/i,/^(?:excludes\\s[^#\\n;]+)/i,/^(?:todayMarker\\s[^\\n;]+)/i,/^(?:\\d\\d\\d\\d-\\d\\d-\\d\\d\\b)/i,/^(?:title\\s[^#\\n;]+)/i,/^(?:section\\s[^#:\\n;]+)/i,/^(?:[^#:\\n;]+)/i,/^(?::[^#\\n;]+)/i,/^(?::)/i,/^(?:$)/i,/^(?:.)/i],conditions:{close_directive:{rules:[],inclusive:!1},arg_directive:{rules:[3,4],inclusive:!1},type_directive:{rules:[2,3],inclusive:!1},open_directive:{rules:[1],inclusive:!1},callbackargs:{rules:[19,20],inclusive:!1},callbackname:{rules:[16,17,18],inclusive:!1},href:{rules:[13,14],inclusive:!1},click:{rules:[22,23],inclusive:!1},INITIAL:{rules:[0,5,6,7,8,9,10,11,12,15,21,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39],inclusive:!0}}};function b(){this.yy={}}return m.lexer=v,b.prototype=m,m.Parser=b,new b}();e.parser=r,e.Parser=r.Parser,e.parse=function(){return r.parse.apply(r,arguments)},e.main=function(t){t[1]||(console.log(\"Usage: \"+t[0]+\" FILE\"),process.exit(1));var r=n(6878).readFileSync(n(6470).normalize(t[1]),\"utf8\");return e.parser.parse(r)},n.c[n.s]===t&&e.main(process.argv.slice(1))},2553:(t,e,n)=>{t=n.nmd(t);var r=function(){var t=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},e=[2,3],n=[1,7],r=[7,12,15,17,19,20,21],i=[7,11,12,15,17,19,20,21],a=[2,20],o=[1,32],s={trace:function(){},yy:{},symbols_:{error:2,start:3,GG:4,\":\":5,document:6,EOF:7,DIR:8,options:9,body:10,OPT:11,NL:12,line:13,statement:14,COMMIT:15,commit_arg:16,BRANCH:17,ID:18,CHECKOUT:19,MERGE:20,RESET:21,reset_arg:22,STR:23,HEAD:24,reset_parents:25,CARET:26,$accept:0,$end:1},terminals_:{2:\"error\",4:\"GG\",5:\":\",7:\"EOF\",8:\"DIR\",11:\"OPT\",12:\"NL\",15:\"COMMIT\",17:\"BRANCH\",18:\"ID\",19:\"CHECKOUT\",20:\"MERGE\",21:\"RESET\",23:\"STR\",24:\"HEAD\",26:\"CARET\"},productions_:[0,[3,4],[3,5],[6,0],[6,2],[9,2],[9,1],[10,0],[10,2],[13,2],[13,1],[14,2],[14,2],[14,2],[14,2],[14,2],[16,0],[16,1],[22,2],[22,2],[25,0],[25,2]],performAction:function(t,e,n,r,i,a,o){var s=a.length-1;switch(i){case 1:return a[s-1];case 2:return r.setDirection(a[s-3]),a[s-1];case 4:r.setOptions(a[s-1]),this.$=a[s];break;case 5:a[s-1]+=a[s],this.$=a[s-1];break;case 7:this.$=[];break;case 8:a[s-1].push(a[s]),this.$=a[s-1];break;case 9:this.$=a[s-1];break;case 11:r.commit(a[s]);break;case 12:r.branch(a[s]);break;case 13:r.checkout(a[s]);break;case 14:r.merge(a[s]);break;case 15:r.reset(a[s]);break;case 16:this.$=\"\";break;case 17:this.$=a[s];break;case 18:this.$=a[s-1]+\":\"+a[s];break;case 19:this.$=a[s-1]+\":\"+r.count,r.count=0;break;case 20:r.count=0;break;case 21:r.count+=1}},table:[{3:1,4:[1,2]},{1:[3]},{5:[1,3],8:[1,4]},{6:5,7:e,9:6,12:n},{5:[1,8]},{7:[1,9]},t(r,[2,7],{10:10,11:[1,11]}),t(i,[2,6]),{6:12,7:e,9:6,12:n},{1:[2,1]},{7:[2,4],12:[1,15],13:13,14:14,15:[1,16],17:[1,17],19:[1,18],20:[1,19],21:[1,20]},t(i,[2,5]),{7:[1,21]},t(r,[2,8]),{12:[1,22]},t(r,[2,10]),{12:[2,16],16:23,23:[1,24]},{18:[1,25]},{18:[1,26]},{18:[1,27]},{18:[1,30],22:28,24:[1,29]},{1:[2,2]},t(r,[2,9]),{12:[2,11]},{12:[2,17]},{12:[2,12]},{12:[2,13]},{12:[2,14]},{12:[2,15]},{12:a,25:31,26:o},{12:a,25:33,26:o},{12:[2,18]},{12:a,25:34,26:o},{12:[2,19]},{12:[2,21]}],defaultActions:{9:[2,1],21:[2,2],23:[2,11],24:[2,17],25:[2,12],26:[2,13],27:[2,14],28:[2,15],31:[2,18],33:[2,19],34:[2,21]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],o=this.table,s=\"\",c=0,u=0,l=0,h=2,f=1,d=a.slice.call(arguments,1),p=Object.create(this.lexer),y={yy:{}};for(var g in this.yy)Object.prototype.hasOwnProperty.call(this.yy,g)&&(y.yy[g]=this.yy[g]);p.setInput(t,y.yy),y.yy.lexer=p,y.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var m=p.yylloc;a.push(m);var v=p.options&&p.options.ranges;function b(){var t;return\"number\"!=typeof(t=r.pop()||p.lex()||f)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}\"function\"==typeof y.yy.parseError?this.parseError=y.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var _,x,w,k,T,E,C,S,A,M={};;){if(w=n[n.length-1],this.defaultActions[w]?k=this.defaultActions[w]:(null==_&&(_=b()),k=o[w]&&o[w][_]),void 0===k||!k.length||!k[0]){var N=\"\";for(E in A=[],o[w])this.terminals_[E]&&E>h&&A.push(\"'\"+this.terminals_[E]+\"'\");N=p.showPosition?\"Parse error on line \"+(c+1)+\":\\n\"+p.showPosition()+\"\\nExpecting \"+A.join(\", \")+\", got '\"+(this.terminals_[_]||_)+\"'\":\"Parse error on line \"+(c+1)+\": Unexpected \"+(_==f?\"end of input\":\"'\"+(this.terminals_[_]||_)+\"'\"),this.parseError(N,{text:p.match,token:this.terminals_[_]||_,line:p.yylineno,loc:m,expected:A})}if(k[0]instanceof Array&&k.length>1)throw new Error(\"Parse Error: multiple actions possible at state: \"+w+\", token: \"+_);switch(k[0]){case 1:n.push(_),i.push(p.yytext),a.push(p.yylloc),n.push(k[1]),_=null,x?(_=x,x=null):(u=p.yyleng,s=p.yytext,c=p.yylineno,m=p.yylloc,l>0&&l--);break;case 2:if(C=this.productions_[k[1]][1],M.$=i[i.length-C],M._$={first_line:a[a.length-(C||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(C||1)].first_column,last_column:a[a.length-1].last_column},v&&(M._$.range=[a[a.length-(C||1)].range[0],a[a.length-1].range[1]]),void 0!==(T=this.performAction.apply(M,[s,u,c,y.yy,k[1],i,a].concat(d))))return T;C&&(n=n.slice(0,-1*C*2),i=i.slice(0,-1*C),a=a.slice(0,-1*C)),n.push(this.productions_[k[1]][0]),i.push(M.$),a.push(M._$),S=o[n[n.length-2]][n[n.length-1]],n.push(S);break;case 3:return!0}}return!0}},c={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=\"\",this.conditionStack=[\"INITIAL\"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\\r\\n?|\\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\\r\\n?|\\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\\r\\n?|\\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?\"...\":\"\")+t.substr(-20).replace(/\\n/g,\"\")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?\"...\":\"\")).replace(/\\n/g,\"\")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join(\"-\");return t+this.upcomingInput()+\"\\n\"+e+\"^\"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\\r\\n?|\\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\\r?\\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext=\"\",this.match=\"\");for(var i=this._currentRules(),a=0;ae[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:\"\"===this._input?this.EOF:this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". Unrecognized text.\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},lex:function(){return this.next()||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:\"INITIAL\"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{\"case-insensitive\":!0},performAction:function(t,e,n,r){switch(n){case 0:return 12;case 1:case 2:case 3:break;case 4:return 4;case 5:return 15;case 6:return 17;case 7:return 20;case 8:return 21;case 9:return 19;case 10:case 11:return 8;case 12:return 5;case 13:return 26;case 14:this.begin(\"options\");break;case 15:case 18:this.popState();break;case 16:return 11;case 17:this.begin(\"string\");break;case 19:return 23;case 20:return 18;case 21:return 7}},rules:[/^(?:(\\r?\\n)+)/i,/^(?:\\s+)/i,/^(?:#[^\\n]*)/i,/^(?:%[^\\n]*)/i,/^(?:gitGraph\\b)/i,/^(?:commit\\b)/i,/^(?:branch\\b)/i,/^(?:merge\\b)/i,/^(?:reset\\b)/i,/^(?:checkout\\b)/i,/^(?:LR\\b)/i,/^(?:BT\\b)/i,/^(?::)/i,/^(?:\\^)/i,/^(?:options\\r?\\n)/i,/^(?:end\\r?\\n)/i,/^(?:[^\\n]+\\r?\\n)/i,/^(?:[\"])/i,/^(?:[\"])/i,/^(?:[^\"]*)/i,/^(?:[a-zA-Z][-_\\.a-zA-Z0-9]*[-_a-zA-Z0-9])/i,/^(?:$)/i],conditions:{options:{rules:[15,16],inclusive:!1},string:{rules:[18,19],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17,20,21],inclusive:!0}}};function u(){this.yy={}}return s.lexer=c,u.prototype=s,s.Parser=u,new u}();e.parser=r,e.Parser=r.Parser,e.parse=function(){return r.parse.apply(r,arguments)},e.main=function(t){t[1]||(console.log(\"Usage: \"+t[0]+\" FILE\"),process.exit(1));var r=n(8183).readFileSync(n(6470).normalize(t[1]),\"utf8\");return e.parser.parse(r)},n.c[n.s]===t&&e.main(process.argv.slice(1))},6765:(t,e,n)=>{t=n.nmd(t);var r=function(){var t=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},e=[6,9,10],n={trace:function(){},yy:{},symbols_:{error:2,start:3,info:4,document:5,EOF:6,line:7,statement:8,NL:9,showInfo:10,$accept:0,$end:1},terminals_:{2:\"error\",4:\"info\",6:\"EOF\",9:\"NL\",10:\"showInfo\"},productions_:[0,[3,3],[5,0],[5,2],[7,1],[7,1],[8,1]],performAction:function(t,e,n,r,i,a,o){switch(a.length,i){case 1:return r;case 4:break;case 6:r.setInfo(!0)}},table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:6,9:[1,7],10:[1,8]},{1:[2,1]},t(e,[2,3]),t(e,[2,4]),t(e,[2,5]),t(e,[2,6])],defaultActions:{4:[2,1]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],o=this.table,s=\"\",c=0,u=0,l=0,h=2,f=1,d=a.slice.call(arguments,1),p=Object.create(this.lexer),y={yy:{}};for(var g in this.yy)Object.prototype.hasOwnProperty.call(this.yy,g)&&(y.yy[g]=this.yy[g]);p.setInput(t,y.yy),y.yy.lexer=p,y.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var m=p.yylloc;a.push(m);var v=p.options&&p.options.ranges;function b(){var t;return\"number\"!=typeof(t=r.pop()||p.lex()||f)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}\"function\"==typeof y.yy.parseError?this.parseError=y.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var _,x,w,k,T,E,C,S,A,M={};;){if(w=n[n.length-1],this.defaultActions[w]?k=this.defaultActions[w]:(null==_&&(_=b()),k=o[w]&&o[w][_]),void 0===k||!k.length||!k[0]){var N=\"\";for(E in A=[],o[w])this.terminals_[E]&&E>h&&A.push(\"'\"+this.terminals_[E]+\"'\");N=p.showPosition?\"Parse error on line \"+(c+1)+\":\\n\"+p.showPosition()+\"\\nExpecting \"+A.join(\", \")+\", got '\"+(this.terminals_[_]||_)+\"'\":\"Parse error on line \"+(c+1)+\": Unexpected \"+(_==f?\"end of input\":\"'\"+(this.terminals_[_]||_)+\"'\"),this.parseError(N,{text:p.match,token:this.terminals_[_]||_,line:p.yylineno,loc:m,expected:A})}if(k[0]instanceof Array&&k.length>1)throw new Error(\"Parse Error: multiple actions possible at state: \"+w+\", token: \"+_);switch(k[0]){case 1:n.push(_),i.push(p.yytext),a.push(p.yylloc),n.push(k[1]),_=null,x?(_=x,x=null):(u=p.yyleng,s=p.yytext,c=p.yylineno,m=p.yylloc,l>0&&l--);break;case 2:if(C=this.productions_[k[1]][1],M.$=i[i.length-C],M._$={first_line:a[a.length-(C||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(C||1)].first_column,last_column:a[a.length-1].last_column},v&&(M._$.range=[a[a.length-(C||1)].range[0],a[a.length-1].range[1]]),void 0!==(T=this.performAction.apply(M,[s,u,c,y.yy,k[1],i,a].concat(d))))return T;C&&(n=n.slice(0,-1*C*2),i=i.slice(0,-1*C),a=a.slice(0,-1*C)),n.push(this.productions_[k[1]][0]),i.push(M.$),a.push(M._$),S=o[n[n.length-2]][n[n.length-1]],n.push(S);break;case 3:return!0}}return!0}},r={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=\"\",this.conditionStack=[\"INITIAL\"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\\r\\n?|\\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\\r\\n?|\\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\\r\\n?|\\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?\"...\":\"\")+t.substr(-20).replace(/\\n/g,\"\")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?\"...\":\"\")).replace(/\\n/g,\"\")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join(\"-\");return t+this.upcomingInput()+\"\\n\"+e+\"^\"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\\r\\n?|\\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\\r?\\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext=\"\",this.match=\"\");for(var i=this._currentRules(),a=0;ae[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:\"\"===this._input?this.EOF:this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". Unrecognized text.\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},lex:function(){return this.next()||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:\"INITIAL\"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{\"case-insensitive\":!0},performAction:function(t,e,n,r){switch(n){case 0:return 4;case 1:return 9;case 2:return\"space\";case 3:return 10;case 4:return 6;case 5:return\"TXT\"}},rules:[/^(?:info\\b)/i,/^(?:[\\s\\n\\r]+)/i,/^(?:[\\s]+)/i,/^(?:showInfo\\b)/i,/^(?:$)/i,/^(?:.)/i],conditions:{INITIAL:{rules:[0,1,2,3,4,5],inclusive:!0}}};function i(){this.yy={}}return n.lexer=r,i.prototype=n,n.Parser=i,new i}();e.parser=r,e.Parser=r.Parser,e.parse=function(){return r.parse.apply(r,arguments)},e.main=function(t){t[1]||(console.log(\"Usage: \"+t[0]+\" FILE\"),process.exit(1));var r=n(1428).readFileSync(n(6470).normalize(t[1]),\"utf8\");return e.parser.parse(r)},n.c[n.s]===t&&e.main(process.argv.slice(1))},7062:(t,e,n)=>{t=n.nmd(t);var r=function(){var t=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},e=[1,4],n=[1,5],r=[1,6],i=[1,7],a=[1,9],o=[1,11,13,20,21,22,23],s=[2,5],c=[1,6,11,13,20,21,22,23],u=[20,21,22],l=[2,8],h=[1,18],f=[1,19],d=[1,24],p=[6,20,21,22,23],y={trace:function(){},yy:{},symbols_:{error:2,start:3,eol:4,directive:5,PIE:6,document:7,showData:8,line:9,statement:10,txt:11,value:12,title:13,title_value:14,openDirective:15,typeDirective:16,closeDirective:17,\":\":18,argDirective:19,NEWLINE:20,\";\":21,EOF:22,open_directive:23,type_directive:24,arg_directive:25,close_directive:26,$accept:0,$end:1},terminals_:{2:\"error\",6:\"PIE\",8:\"showData\",11:\"txt\",12:\"value\",13:\"title\",14:\"title_value\",18:\":\",20:\"NEWLINE\",21:\";\",22:\"EOF\",23:\"open_directive\",24:\"type_directive\",25:\"arg_directive\",26:\"close_directive\"},productions_:[0,[3,2],[3,2],[3,2],[3,3],[7,0],[7,2],[9,2],[10,0],[10,2],[10,2],[10,1],[5,3],[5,5],[4,1],[4,1],[4,1],[15,1],[16,1],[19,1],[17,1]],performAction:function(t,e,n,r,i,a,o){var s=a.length-1;switch(i){case 4:r.setShowData(!0);break;case 7:this.$=a[s-1];break;case 9:r.addSection(a[s-1],r.cleanupValue(a[s]));break;case 10:this.$=a[s].trim(),r.setTitle(this.$);break;case 17:r.parseDirective(\"%%{\",\"open_directive\");break;case 18:r.parseDirective(a[s],\"type_directive\");break;case 19:a[s]=a[s].trim().replace(/'/g,'\"'),r.parseDirective(a[s],\"arg_directive\");break;case 20:r.parseDirective(\"}%%\",\"close_directive\",\"pie\")}},table:[{3:1,4:2,5:3,6:e,15:8,20:n,21:r,22:i,23:a},{1:[3]},{3:10,4:2,5:3,6:e,15:8,20:n,21:r,22:i,23:a},{3:11,4:2,5:3,6:e,15:8,20:n,21:r,22:i,23:a},t(o,s,{7:12,8:[1,13]}),t(c,[2,14]),t(c,[2,15]),t(c,[2,16]),{16:14,24:[1,15]},{24:[2,17]},{1:[2,1]},{1:[2,2]},t(u,l,{15:8,9:16,10:17,5:20,1:[2,3],11:h,13:f,23:a}),t(o,s,{7:21}),{17:22,18:[1,23],26:d},t([18,26],[2,18]),t(o,[2,6]),{4:25,20:n,21:r,22:i},{12:[1,26]},{14:[1,27]},t(u,[2,11]),t(u,l,{15:8,9:16,10:17,5:20,1:[2,4],11:h,13:f,23:a}),t(p,[2,12]),{19:28,25:[1,29]},t(p,[2,20]),t(o,[2,7]),t(u,[2,9]),t(u,[2,10]),{17:30,26:d},{26:[2,19]},t(p,[2,13])],defaultActions:{9:[2,17],10:[2,1],11:[2,2],29:[2,19]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],o=this.table,s=\"\",c=0,u=0,l=0,h=2,f=1,d=a.slice.call(arguments,1),p=Object.create(this.lexer),y={yy:{}};for(var g in this.yy)Object.prototype.hasOwnProperty.call(this.yy,g)&&(y.yy[g]=this.yy[g]);p.setInput(t,y.yy),y.yy.lexer=p,y.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var m=p.yylloc;a.push(m);var v=p.options&&p.options.ranges;function b(){var t;return\"number\"!=typeof(t=r.pop()||p.lex()||f)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}\"function\"==typeof y.yy.parseError?this.parseError=y.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var _,x,w,k,T,E,C,S,A,M={};;){if(w=n[n.length-1],this.defaultActions[w]?k=this.defaultActions[w]:(null==_&&(_=b()),k=o[w]&&o[w][_]),void 0===k||!k.length||!k[0]){var N=\"\";for(E in A=[],o[w])this.terminals_[E]&&E>h&&A.push(\"'\"+this.terminals_[E]+\"'\");N=p.showPosition?\"Parse error on line \"+(c+1)+\":\\n\"+p.showPosition()+\"\\nExpecting \"+A.join(\", \")+\", got '\"+(this.terminals_[_]||_)+\"'\":\"Parse error on line \"+(c+1)+\": Unexpected \"+(_==f?\"end of input\":\"'\"+(this.terminals_[_]||_)+\"'\"),this.parseError(N,{text:p.match,token:this.terminals_[_]||_,line:p.yylineno,loc:m,expected:A})}if(k[0]instanceof Array&&k.length>1)throw new Error(\"Parse Error: multiple actions possible at state: \"+w+\", token: \"+_);switch(k[0]){case 1:n.push(_),i.push(p.yytext),a.push(p.yylloc),n.push(k[1]),_=null,x?(_=x,x=null):(u=p.yyleng,s=p.yytext,c=p.yylineno,m=p.yylloc,l>0&&l--);break;case 2:if(C=this.productions_[k[1]][1],M.$=i[i.length-C],M._$={first_line:a[a.length-(C||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(C||1)].first_column,last_column:a[a.length-1].last_column},v&&(M._$.range=[a[a.length-(C||1)].range[0],a[a.length-1].range[1]]),void 0!==(T=this.performAction.apply(M,[s,u,c,y.yy,k[1],i,a].concat(d))))return T;C&&(n=n.slice(0,-1*C*2),i=i.slice(0,-1*C),a=a.slice(0,-1*C)),n.push(this.productions_[k[1]][0]),i.push(M.$),a.push(M._$),S=o[n[n.length-2]][n[n.length-1]],n.push(S);break;case 3:return!0}}return!0}},g={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=\"\",this.conditionStack=[\"INITIAL\"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\\r\\n?|\\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\\r\\n?|\\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\\r\\n?|\\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?\"...\":\"\")+t.substr(-20).replace(/\\n/g,\"\")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?\"...\":\"\")).replace(/\\n/g,\"\")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join(\"-\");return t+this.upcomingInput()+\"\\n\"+e+\"^\"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\\r\\n?|\\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\\r?\\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext=\"\",this.match=\"\");for(var i=this._currentRules(),a=0;ae[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:\"\"===this._input?this.EOF:this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". Unrecognized text.\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},lex:function(){return this.next()||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:\"INITIAL\"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{\"case-insensitive\":!0},performAction:function(t,e,n,r){switch(n){case 0:return this.begin(\"open_directive\"),23;case 1:return this.begin(\"type_directive\"),24;case 2:return this.popState(),this.begin(\"arg_directive\"),18;case 3:return this.popState(),this.popState(),26;case 4:return 25;case 5:case 6:case 8:case 9:break;case 7:return 20;case 10:return this.begin(\"title\"),13;case 11:return this.popState(),\"title_value\";case 12:this.begin(\"string\");break;case 13:this.popState();break;case 14:return\"txt\";case 15:return 6;case 16:return 8;case 17:return\"value\";case 18:return 22}},rules:[/^(?:%%\\{)/i,/^(?:((?:(?!\\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\\}%%)/i,/^(?:((?:(?!\\}%%).|\\n)*))/i,/^(?:%%(?!\\{)[^\\n]*)/i,/^(?:[^\\}]%%[^\\n]*)/i,/^(?:[\\n\\r]+)/i,/^(?:%%[^\\n]*)/i,/^(?:[\\s]+)/i,/^(?:title\\b)/i,/^(?:(?!\\n||)*[^\\n]*)/i,/^(?:[\"])/i,/^(?:[\"])/i,/^(?:[^\"]*)/i,/^(?:pie\\b)/i,/^(?:showData\\b)/i,/^(?::[\\s]*[\\d]+(?:\\.[\\d]+)?)/i,/^(?:$)/i],conditions:{close_directive:{rules:[],inclusive:!1},arg_directive:{rules:[3,4],inclusive:!1},type_directive:{rules:[2,3],inclusive:!1},open_directive:{rules:[1],inclusive:!1},title:{rules:[11],inclusive:!1},string:{rules:[13,14],inclusive:!1},INITIAL:{rules:[0,5,6,7,8,9,10,12,15,16,17,18],inclusive:!0}}};function m(){this.yy={}}return y.lexer=g,m.prototype=y,y.Parser=m,new m}();e.parser=r,e.Parser=r.Parser,e.parse=function(){return r.parse.apply(r,arguments)},e.main=function(t){t[1]||(console.log(\"Usage: \"+t[0]+\" FILE\"),process.exit(1));var r=n(4551).readFileSync(n(6470).normalize(t[1]),\"utf8\");return e.parser.parse(r)},n.c[n.s]===t&&e.main(process.argv.slice(1))},3176:(t,e,n)=>{t=n.nmd(t);var r=function(){var t=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},e=[1,3],n=[1,5],r=[1,17],i=[2,10],a=[1,21],o=[1,22],s=[1,23],c=[1,24],u=[1,25],l=[1,26],h=[1,19],f=[1,27],d=[1,28],p=[1,31],y=[66,67],g=[5,8,14,35,36,37,38,39,40,48,55,57,66,67],m=[5,6,8,14,35,36,37,38,39,40,48,66,67],v=[1,51],b=[1,52],_=[1,53],x=[1,54],w=[1,55],k=[1,56],T=[1,57],E=[57,58],C=[1,69],S=[1,65],A=[1,66],M=[1,67],N=[1,68],D=[1,70],O=[1,74],B=[1,75],L=[1,72],I=[1,73],R=[5,8,14,35,36,37,38,39,40,48,66,67],F={trace:function(){},yy:{},symbols_:{error:2,start:3,directive:4,NEWLINE:5,RD:6,diagram:7,EOF:8,openDirective:9,typeDirective:10,closeDirective:11,\":\":12,argDirective:13,open_directive:14,type_directive:15,arg_directive:16,close_directive:17,requirementDef:18,elementDef:19,relationshipDef:20,requirementType:21,requirementName:22,STRUCT_START:23,requirementBody:24,ID:25,COLONSEP:26,id:27,TEXT:28,text:29,RISK:30,riskLevel:31,VERIFYMTHD:32,verifyType:33,STRUCT_STOP:34,REQUIREMENT:35,FUNCTIONAL_REQUIREMENT:36,INTERFACE_REQUIREMENT:37,PERFORMANCE_REQUIREMENT:38,PHYSICAL_REQUIREMENT:39,DESIGN_CONSTRAINT:40,LOW_RISK:41,MED_RISK:42,HIGH_RISK:43,VERIFY_ANALYSIS:44,VERIFY_DEMONSTRATION:45,VERIFY_INSPECTION:46,VERIFY_TEST:47,ELEMENT:48,elementName:49,elementBody:50,TYPE:51,type:52,DOCREF:53,ref:54,END_ARROW_L:55,relationship:56,LINE:57,END_ARROW_R:58,CONTAINS:59,COPIES:60,DERIVES:61,SATISFIES:62,VERIFIES:63,REFINES:64,TRACES:65,unqString:66,qString:67,$accept:0,$end:1},terminals_:{2:\"error\",5:\"NEWLINE\",6:\"RD\",8:\"EOF\",12:\":\",14:\"open_directive\",15:\"type_directive\",16:\"arg_directive\",17:\"close_directive\",23:\"STRUCT_START\",25:\"ID\",26:\"COLONSEP\",28:\"TEXT\",30:\"RISK\",32:\"VERIFYMTHD\",34:\"STRUCT_STOP\",35:\"REQUIREMENT\",36:\"FUNCTIONAL_REQUIREMENT\",37:\"INTERFACE_REQUIREMENT\",38:\"PERFORMANCE_REQUIREMENT\",39:\"PHYSICAL_REQUIREMENT\",40:\"DESIGN_CONSTRAINT\",41:\"LOW_RISK\",42:\"MED_RISK\",43:\"HIGH_RISK\",44:\"VERIFY_ANALYSIS\",45:\"VERIFY_DEMONSTRATION\",46:\"VERIFY_INSPECTION\",47:\"VERIFY_TEST\",48:\"ELEMENT\",51:\"TYPE\",53:\"DOCREF\",55:\"END_ARROW_L\",57:\"LINE\",58:\"END_ARROW_R\",59:\"CONTAINS\",60:\"COPIES\",61:\"DERIVES\",62:\"SATISFIES\",63:\"VERIFIES\",64:\"REFINES\",65:\"TRACES\",66:\"unqString\",67:\"qString\"},productions_:[0,[3,3],[3,2],[3,4],[4,3],[4,5],[9,1],[10,1],[13,1],[11,1],[7,0],[7,2],[7,2],[7,2],[7,2],[7,2],[18,5],[24,5],[24,5],[24,5],[24,5],[24,2],[24,1],[21,1],[21,1],[21,1],[21,1],[21,1],[21,1],[31,1],[31,1],[31,1],[33,1],[33,1],[33,1],[33,1],[19,5],[50,5],[50,5],[50,2],[50,1],[20,5],[20,5],[56,1],[56,1],[56,1],[56,1],[56,1],[56,1],[56,1],[22,1],[22,1],[27,1],[27,1],[29,1],[29,1],[49,1],[49,1],[52,1],[52,1],[54,1],[54,1]],performAction:function(t,e,n,r,i,a,o){var s=a.length-1;switch(i){case 6:r.parseDirective(\"%%{\",\"open_directive\");break;case 7:r.parseDirective(a[s],\"type_directive\");break;case 8:a[s]=a[s].trim().replace(/'/g,'\"'),r.parseDirective(a[s],\"arg_directive\");break;case 9:r.parseDirective(\"}%%\",\"close_directive\",\"pie\");break;case 10:this.$=[];break;case 16:r.addRequirement(a[s-3],a[s-4]);break;case 17:r.setNewReqId(a[s-2]);break;case 18:r.setNewReqText(a[s-2]);break;case 19:r.setNewReqRisk(a[s-2]);break;case 20:r.setNewReqVerifyMethod(a[s-2]);break;case 23:this.$=r.RequirementType.REQUIREMENT;break;case 24:this.$=r.RequirementType.FUNCTIONAL_REQUIREMENT;break;case 25:this.$=r.RequirementType.INTERFACE_REQUIREMENT;break;case 26:this.$=r.RequirementType.PERFORMANCE_REQUIREMENT;break;case 27:this.$=r.RequirementType.PHYSICAL_REQUIREMENT;break;case 28:this.$=r.RequirementType.DESIGN_CONSTRAINT;break;case 29:this.$=r.RiskLevel.LOW_RISK;break;case 30:this.$=r.RiskLevel.MED_RISK;break;case 31:this.$=r.RiskLevel.HIGH_RISK;break;case 32:this.$=r.VerifyType.VERIFY_ANALYSIS;break;case 33:this.$=r.VerifyType.VERIFY_DEMONSTRATION;break;case 34:this.$=r.VerifyType.VERIFY_INSPECTION;break;case 35:this.$=r.VerifyType.VERIFY_TEST;break;case 36:r.addElement(a[s-3]);break;case 37:r.setNewElementType(a[s-2]);break;case 38:r.setNewElementDocRef(a[s-2]);break;case 41:r.addRelationship(a[s-2],a[s],a[s-4]);break;case 42:r.addRelationship(a[s-2],a[s-4],a[s]);break;case 43:this.$=r.Relationships.CONTAINS;break;case 44:this.$=r.Relationships.COPIES;break;case 45:this.$=r.Relationships.DERIVES;break;case 46:this.$=r.Relationships.SATISFIES;break;case 47:this.$=r.Relationships.VERIFIES;break;case 48:this.$=r.Relationships.REFINES;break;case 49:this.$=r.Relationships.TRACES}},table:[{3:1,4:2,6:e,9:4,14:n},{1:[3]},{3:7,4:2,5:[1,6],6:e,9:4,14:n},{5:[1,8]},{10:9,15:[1,10]},{15:[2,6]},{3:11,4:2,6:e,9:4,14:n},{1:[2,2]},{4:16,5:r,7:12,8:i,9:4,14:n,18:13,19:14,20:15,21:18,27:20,35:a,36:o,37:s,38:c,39:u,40:l,48:h,66:f,67:d},{11:29,12:[1,30],17:p},t([12,17],[2,7]),{1:[2,1]},{8:[1,32]},{4:16,5:r,7:33,8:i,9:4,14:n,18:13,19:14,20:15,21:18,27:20,35:a,36:o,37:s,38:c,39:u,40:l,48:h,66:f,67:d},{4:16,5:r,7:34,8:i,9:4,14:n,18:13,19:14,20:15,21:18,27:20,35:a,36:o,37:s,38:c,39:u,40:l,48:h,66:f,67:d},{4:16,5:r,7:35,8:i,9:4,14:n,18:13,19:14,20:15,21:18,27:20,35:a,36:o,37:s,38:c,39:u,40:l,48:h,66:f,67:d},{4:16,5:r,7:36,8:i,9:4,14:n,18:13,19:14,20:15,21:18,27:20,35:a,36:o,37:s,38:c,39:u,40:l,48:h,66:f,67:d},{4:16,5:r,7:37,8:i,9:4,14:n,18:13,19:14,20:15,21:18,27:20,35:a,36:o,37:s,38:c,39:u,40:l,48:h,66:f,67:d},{22:38,66:[1,39],67:[1,40]},{49:41,66:[1,42],67:[1,43]},{55:[1,44],57:[1,45]},t(y,[2,23]),t(y,[2,24]),t(y,[2,25]),t(y,[2,26]),t(y,[2,27]),t(y,[2,28]),t(g,[2,52]),t(g,[2,53]),t(m,[2,4]),{13:46,16:[1,47]},t(m,[2,9]),{1:[2,3]},{8:[2,11]},{8:[2,12]},{8:[2,13]},{8:[2,14]},{8:[2,15]},{23:[1,48]},{23:[2,50]},{23:[2,51]},{23:[1,49]},{23:[2,56]},{23:[2,57]},{56:50,59:v,60:b,61:_,62:x,63:w,64:k,65:T},{56:58,59:v,60:b,61:_,62:x,63:w,64:k,65:T},{11:59,17:p},{17:[2,8]},{5:[1,60]},{5:[1,61]},{57:[1,62]},t(E,[2,43]),t(E,[2,44]),t(E,[2,45]),t(E,[2,46]),t(E,[2,47]),t(E,[2,48]),t(E,[2,49]),{58:[1,63]},t(m,[2,5]),{5:C,24:64,25:S,28:A,30:M,32:N,34:D},{5:O,34:B,50:71,51:L,53:I},{27:76,66:f,67:d},{27:77,66:f,67:d},t(R,[2,16]),{26:[1,78]},{26:[1,79]},{26:[1,80]},{26:[1,81]},{5:C,24:82,25:S,28:A,30:M,32:N,34:D},t(R,[2,22]),t(R,[2,36]),{26:[1,83]},{26:[1,84]},{5:O,34:B,50:85,51:L,53:I},t(R,[2,40]),t(R,[2,41]),t(R,[2,42]),{27:86,66:f,67:d},{29:87,66:[1,88],67:[1,89]},{31:90,41:[1,91],42:[1,92],43:[1,93]},{33:94,44:[1,95],45:[1,96],46:[1,97],47:[1,98]},t(R,[2,21]),{52:99,66:[1,100],67:[1,101]},{54:102,66:[1,103],67:[1,104]},t(R,[2,39]),{5:[1,105]},{5:[1,106]},{5:[2,54]},{5:[2,55]},{5:[1,107]},{5:[2,29]},{5:[2,30]},{5:[2,31]},{5:[1,108]},{5:[2,32]},{5:[2,33]},{5:[2,34]},{5:[2,35]},{5:[1,109]},{5:[2,58]},{5:[2,59]},{5:[1,110]},{5:[2,60]},{5:[2,61]},{5:C,24:111,25:S,28:A,30:M,32:N,34:D},{5:C,24:112,25:S,28:A,30:M,32:N,34:D},{5:C,24:113,25:S,28:A,30:M,32:N,34:D},{5:C,24:114,25:S,28:A,30:M,32:N,34:D},{5:O,34:B,50:115,51:L,53:I},{5:O,34:B,50:116,51:L,53:I},t(R,[2,17]),t(R,[2,18]),t(R,[2,19]),t(R,[2,20]),t(R,[2,37]),t(R,[2,38])],defaultActions:{5:[2,6],7:[2,2],11:[2,1],32:[2,3],33:[2,11],34:[2,12],35:[2,13],36:[2,14],37:[2,15],39:[2,50],40:[2,51],42:[2,56],43:[2,57],47:[2,8],88:[2,54],89:[2,55],91:[2,29],92:[2,30],93:[2,31],95:[2,32],96:[2,33],97:[2,34],98:[2,35],100:[2,58],101:[2,59],103:[2,60],104:[2,61]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],o=this.table,s=\"\",c=0,u=0,l=0,h=2,f=1,d=a.slice.call(arguments,1),p=Object.create(this.lexer),y={yy:{}};for(var g in this.yy)Object.prototype.hasOwnProperty.call(this.yy,g)&&(y.yy[g]=this.yy[g]);p.setInput(t,y.yy),y.yy.lexer=p,y.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var m=p.yylloc;a.push(m);var v=p.options&&p.options.ranges;function b(){var t;return\"number\"!=typeof(t=r.pop()||p.lex()||f)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}\"function\"==typeof y.yy.parseError?this.parseError=y.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var _,x,w,k,T,E,C,S,A,M={};;){if(w=n[n.length-1],this.defaultActions[w]?k=this.defaultActions[w]:(null==_&&(_=b()),k=o[w]&&o[w][_]),void 0===k||!k.length||!k[0]){var N=\"\";for(E in A=[],o[w])this.terminals_[E]&&E>h&&A.push(\"'\"+this.terminals_[E]+\"'\");N=p.showPosition?\"Parse error on line \"+(c+1)+\":\\n\"+p.showPosition()+\"\\nExpecting \"+A.join(\", \")+\", got '\"+(this.terminals_[_]||_)+\"'\":\"Parse error on line \"+(c+1)+\": Unexpected \"+(_==f?\"end of input\":\"'\"+(this.terminals_[_]||_)+\"'\"),this.parseError(N,{text:p.match,token:this.terminals_[_]||_,line:p.yylineno,loc:m,expected:A})}if(k[0]instanceof Array&&k.length>1)throw new Error(\"Parse Error: multiple actions possible at state: \"+w+\", token: \"+_);switch(k[0]){case 1:n.push(_),i.push(p.yytext),a.push(p.yylloc),n.push(k[1]),_=null,x?(_=x,x=null):(u=p.yyleng,s=p.yytext,c=p.yylineno,m=p.yylloc,l>0&&l--);break;case 2:if(C=this.productions_[k[1]][1],M.$=i[i.length-C],M._$={first_line:a[a.length-(C||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(C||1)].first_column,last_column:a[a.length-1].last_column},v&&(M._$.range=[a[a.length-(C||1)].range[0],a[a.length-1].range[1]]),void 0!==(T=this.performAction.apply(M,[s,u,c,y.yy,k[1],i,a].concat(d))))return T;C&&(n=n.slice(0,-1*C*2),i=i.slice(0,-1*C),a=a.slice(0,-1*C)),n.push(this.productions_[k[1]][0]),i.push(M.$),a.push(M._$),S=o[n[n.length-2]][n[n.length-1]],n.push(S);break;case 3:return!0}}return!0}},P={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=\"\",this.conditionStack=[\"INITIAL\"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\\r\\n?|\\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\\r\\n?|\\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\\r\\n?|\\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?\"...\":\"\")+t.substr(-20).replace(/\\n/g,\"\")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?\"...\":\"\")).replace(/\\n/g,\"\")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join(\"-\");return t+this.upcomingInput()+\"\\n\"+e+\"^\"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\\r\\n?|\\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\\r?\\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext=\"\",this.match=\"\");for(var i=this._currentRules(),a=0;ae[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:\"\"===this._input?this.EOF:this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". Unrecognized text.\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},lex:function(){return this.next()||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:\"INITIAL\"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{\"case-insensitive\":!0},performAction:function(t,e,n,r){switch(n){case 0:return this.begin(\"open_directive\"),14;case 1:return this.begin(\"type_directive\"),15;case 2:return this.popState(),this.begin(\"arg_directive\"),12;case 3:return this.popState(),this.popState(),17;case 4:return 16;case 5:return 5;case 6:case 7:case 8:break;case 9:return 8;case 10:return 6;case 11:return 23;case 12:return 34;case 13:return 26;case 14:return 25;case 15:return 28;case 16:return 30;case 17:return 32;case 18:return 35;case 19:return 36;case 20:return 37;case 21:return 38;case 22:return 39;case 23:return 40;case 24:return 41;case 25:return 42;case 26:return 43;case 27:return 44;case 28:return 45;case 29:return 46;case 30:return 47;case 31:return 48;case 32:return 59;case 33:return 60;case 34:return 61;case 35:return 62;case 36:return 63;case 37:return 64;case 38:return 65;case 39:return 51;case 40:return 53;case 41:return 55;case 42:return 58;case 43:return 57;case 44:this.begin(\"string\");break;case 45:this.popState();break;case 46:return\"qString\";case 47:return e.yytext=e.yytext.trim(),66}},rules:[/^(?:%%\\{)/i,/^(?:((?:(?!\\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\\}%%)/i,/^(?:((?:(?!\\}%%).|\\n)*))/i,/^(?:(\\r?\\n)+)/i,/^(?:\\s+)/i,/^(?:#[^\\n]*)/i,/^(?:%[^\\n]*)/i,/^(?:$)/i,/^(?:requirementDiagram\\b)/i,/^(?:\\{)/i,/^(?:\\})/i,/^(?::)/i,/^(?:id\\b)/i,/^(?:text\\b)/i,/^(?:risk\\b)/i,/^(?:verifyMethod\\b)/i,/^(?:requirement\\b)/i,/^(?:functionalRequirement\\b)/i,/^(?:interfaceRequirement\\b)/i,/^(?:performanceRequirement\\b)/i,/^(?:physicalRequirement\\b)/i,/^(?:designConstraint\\b)/i,/^(?:low\\b)/i,/^(?:medium\\b)/i,/^(?:high\\b)/i,/^(?:analysis\\b)/i,/^(?:demonstration\\b)/i,/^(?:inspection\\b)/i,/^(?:test\\b)/i,/^(?:element\\b)/i,/^(?:contains\\b)/i,/^(?:copies\\b)/i,/^(?:derives\\b)/i,/^(?:satisfies\\b)/i,/^(?:verifies\\b)/i,/^(?:refines\\b)/i,/^(?:traces\\b)/i,/^(?:type\\b)/i,/^(?:docref\\b)/i,/^(?:<-)/i,/^(?:->)/i,/^(?:-)/i,/^(?:[\"])/i,/^(?:[\"])/i,/^(?:[^\"]*)/i,/^(?:[\\w][^\\r\\n\\{\\<\\>\\-\\=]*)/i],conditions:{close_directive:{rules:[],inclusive:!1},arg_directive:{rules:[3,4],inclusive:!1},type_directive:{rules:[2,3],inclusive:!1},open_directive:{rules:[1],inclusive:!1},unqString:{rules:[],inclusive:!1},token:{rules:[],inclusive:!1},string:{rules:[45,46],inclusive:!1},INITIAL:{rules:[0,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,47],inclusive:!0}}};function j(){this.yy={}}return F.lexer=P,j.prototype=F,F.Parser=j,new j}();e.parser=r,e.Parser=r.Parser,e.parse=function(){return r.parse.apply(r,arguments)},e.main=function(t){t[1]||(console.log(\"Usage: \"+t[0]+\" FILE\"),process.exit(1));var r=n(8800).readFileSync(n(6470).normalize(t[1]),\"utf8\");return e.parser.parse(r)},n.c[n.s]===t&&e.main(process.argv.slice(1))},6876:(t,e,n)=>{t=n.nmd(t);var r=function(){var t=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},e=[1,2],n=[1,3],r=[1,5],i=[1,7],a=[2,5],o=[1,15],s=[1,17],c=[1,18],u=[1,19],l=[1,21],h=[1,22],f=[1,23],d=[1,29],p=[1,30],y=[1,31],g=[1,32],m=[1,33],v=[1,34],b=[1,37],_=[1,38],x=[1,39],w=[1,40],k=[1,41],T=[1,42],E=[1,45],C=[1,4,5,16,20,22,23,24,30,32,33,34,35,36,38,40,41,42,46,47,48,49,57,67],S=[1,58],A=[4,5,16,20,22,23,24,30,32,33,34,35,36,38,42,46,47,48,49,57,67],M=[4,5,16,20,22,23,24,30,32,33,34,35,36,38,41,42,46,47,48,49,57,67],N=[4,5,16,20,22,23,24,30,32,33,34,35,36,38,40,42,46,47,48,49,57,67],D=[55,56,57],O=[1,4,5,7,16,20,22,23,24,30,32,33,34,35,36,38,40,41,42,46,47,48,49,57,67],B={trace:function(){},yy:{},symbols_:{error:2,start:3,SPACE:4,NEWLINE:5,directive:6,SD:7,document:8,line:9,statement:10,openDirective:11,typeDirective:12,closeDirective:13,\":\":14,argDirective:15,participant:16,actor:17,AS:18,restOfLine:19,participant_actor:20,signal:21,autonumber:22,activate:23,deactivate:24,note_statement:25,links_statement:26,link_statement:27,properties_statement:28,details_statement:29,title:30,text2:31,loop:32,end:33,rect:34,opt:35,alt:36,else_sections:37,par:38,par_sections:39,and:40,else:41,note:42,placement:43,over:44,actor_pair:45,links:46,link:47,properties:48,details:49,spaceList:50,\",\":51,left_of:52,right_of:53,signaltype:54,\"+\":55,\"-\":56,ACTOR:57,SOLID_OPEN_ARROW:58,DOTTED_OPEN_ARROW:59,SOLID_ARROW:60,DOTTED_ARROW:61,SOLID_CROSS:62,DOTTED_CROSS:63,SOLID_POINT:64,DOTTED_POINT:65,TXT:66,open_directive:67,type_directive:68,arg_directive:69,close_directive:70,$accept:0,$end:1},terminals_:{2:\"error\",4:\"SPACE\",5:\"NEWLINE\",7:\"SD\",14:\":\",16:\"participant\",18:\"AS\",19:\"restOfLine\",20:\"participant_actor\",22:\"autonumber\",23:\"activate\",24:\"deactivate\",30:\"title\",32:\"loop\",33:\"end\",34:\"rect\",35:\"opt\",36:\"alt\",38:\"par\",40:\"and\",41:\"else\",42:\"note\",44:\"over\",46:\"links\",47:\"link\",48:\"properties\",49:\"details\",51:\",\",52:\"left_of\",53:\"right_of\",55:\"+\",56:\"-\",57:\"ACTOR\",58:\"SOLID_OPEN_ARROW\",59:\"DOTTED_OPEN_ARROW\",60:\"SOLID_ARROW\",61:\"DOTTED_ARROW\",62:\"SOLID_CROSS\",63:\"DOTTED_CROSS\",64:\"SOLID_POINT\",65:\"DOTTED_POINT\",66:\"TXT\",67:\"open_directive\",68:\"type_directive\",69:\"arg_directive\",70:\"close_directive\"},productions_:[0,[3,2],[3,2],[3,2],[3,2],[8,0],[8,2],[9,2],[9,1],[9,1],[6,4],[6,6],[10,5],[10,3],[10,5],[10,3],[10,2],[10,1],[10,3],[10,3],[10,2],[10,2],[10,2],[10,2],[10,2],[10,3],[10,4],[10,4],[10,4],[10,4],[10,4],[10,1],[39,1],[39,4],[37,1],[37,4],[25,4],[25,4],[26,3],[27,3],[28,3],[29,3],[50,2],[50,1],[45,3],[45,1],[43,1],[43,1],[21,5],[21,5],[21,4],[17,1],[54,1],[54,1],[54,1],[54,1],[54,1],[54,1],[54,1],[54,1],[31,1],[11,1],[12,1],[15,1],[13,1]],performAction:function(t,e,n,r,i,a,o){var s=a.length-1;switch(i){case 4:return r.apply(a[s]),a[s];case 5:case 9:this.$=[];break;case 6:a[s-1].push(a[s]),this.$=a[s-1];break;case 7:case 8:case 45:this.$=a[s];break;case 12:a[s-3].type=\"addParticipant\",a[s-3].description=r.parseMessage(a[s-1]),this.$=a[s-3];break;case 13:a[s-1].type=\"addParticipant\",this.$=a[s-1];break;case 14:a[s-3].type=\"addActor\",a[s-3].description=r.parseMessage(a[s-1]),this.$=a[s-3];break;case 15:a[s-1].type=\"addActor\",this.$=a[s-1];break;case 17:r.enableSequenceNumbers();break;case 18:this.$={type:\"activeStart\",signalType:r.LINETYPE.ACTIVE_START,actor:a[s-1]};break;case 19:this.$={type:\"activeEnd\",signalType:r.LINETYPE.ACTIVE_END,actor:a[s-1]};break;case 25:this.$=[{type:\"setTitle\",text:a[s-1]}];break;case 26:a[s-1].unshift({type:\"loopStart\",loopText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.LOOP_START}),a[s-1].push({type:\"loopEnd\",loopText:a[s-2],signalType:r.LINETYPE.LOOP_END}),this.$=a[s-1];break;case 27:a[s-1].unshift({type:\"rectStart\",color:r.parseMessage(a[s-2]),signalType:r.LINETYPE.RECT_START}),a[s-1].push({type:\"rectEnd\",color:r.parseMessage(a[s-2]),signalType:r.LINETYPE.RECT_END}),this.$=a[s-1];break;case 28:a[s-1].unshift({type:\"optStart\",optText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.OPT_START}),a[s-1].push({type:\"optEnd\",optText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.OPT_END}),this.$=a[s-1];break;case 29:a[s-1].unshift({type:\"altStart\",altText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.ALT_START}),a[s-1].push({type:\"altEnd\",signalType:r.LINETYPE.ALT_END}),this.$=a[s-1];break;case 30:a[s-1].unshift({type:\"parStart\",parText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.PAR_START}),a[s-1].push({type:\"parEnd\",signalType:r.LINETYPE.PAR_END}),this.$=a[s-1];break;case 33:this.$=a[s-3].concat([{type:\"and\",parText:r.parseMessage(a[s-1]),signalType:r.LINETYPE.PAR_AND},a[s]]);break;case 35:this.$=a[s-3].concat([{type:\"else\",altText:r.parseMessage(a[s-1]),signalType:r.LINETYPE.ALT_ELSE},a[s]]);break;case 36:this.$=[a[s-1],{type:\"addNote\",placement:a[s-2],actor:a[s-1].actor,text:a[s]}];break;case 37:a[s-2]=[].concat(a[s-1],a[s-1]).slice(0,2),a[s-2][0]=a[s-2][0].actor,a[s-2][1]=a[s-2][1].actor,this.$=[a[s-1],{type:\"addNote\",placement:r.PLACEMENT.OVER,actor:a[s-2].slice(0,2),text:a[s]}];break;case 38:this.$=[a[s-1],{type:\"addLinks\",actor:a[s-1].actor,text:a[s]}];break;case 39:this.$=[a[s-1],{type:\"addALink\",actor:a[s-1].actor,text:a[s]}];break;case 40:this.$=[a[s-1],{type:\"addProperties\",actor:a[s-1].actor,text:a[s]}];break;case 41:this.$=[a[s-1],{type:\"addDetails\",actor:a[s-1].actor,text:a[s]}];break;case 44:this.$=[a[s-2],a[s]];break;case 46:this.$=r.PLACEMENT.LEFTOF;break;case 47:this.$=r.PLACEMENT.RIGHTOF;break;case 48:this.$=[a[s-4],a[s-1],{type:\"addMessage\",from:a[s-4].actor,to:a[s-1].actor,signalType:a[s-3],msg:a[s]},{type:\"activeStart\",signalType:r.LINETYPE.ACTIVE_START,actor:a[s-1]}];break;case 49:this.$=[a[s-4],a[s-1],{type:\"addMessage\",from:a[s-4].actor,to:a[s-1].actor,signalType:a[s-3],msg:a[s]},{type:\"activeEnd\",signalType:r.LINETYPE.ACTIVE_END,actor:a[s-4]}];break;case 50:this.$=[a[s-3],a[s-1],{type:\"addMessage\",from:a[s-3].actor,to:a[s-1].actor,signalType:a[s-2],msg:a[s]}];break;case 51:this.$={type:\"addParticipant\",actor:a[s]};break;case 52:this.$=r.LINETYPE.SOLID_OPEN;break;case 53:this.$=r.LINETYPE.DOTTED_OPEN;break;case 54:this.$=r.LINETYPE.SOLID;break;case 55:this.$=r.LINETYPE.DOTTED;break;case 56:this.$=r.LINETYPE.SOLID_CROSS;break;case 57:this.$=r.LINETYPE.DOTTED_CROSS;break;case 58:this.$=r.LINETYPE.SOLID_POINT;break;case 59:this.$=r.LINETYPE.DOTTED_POINT;break;case 60:this.$=r.parseMessage(a[s].trim().substring(1));break;case 61:r.parseDirective(\"%%{\",\"open_directive\");break;case 62:r.parseDirective(a[s],\"type_directive\");break;case 63:a[s]=a[s].trim().replace(/'/g,'\"'),r.parseDirective(a[s],\"arg_directive\");break;case 64:r.parseDirective(\"}%%\",\"close_directive\",\"sequence\")}},table:[{3:1,4:e,5:n,6:4,7:r,11:6,67:i},{1:[3]},{3:8,4:e,5:n,6:4,7:r,11:6,67:i},{3:9,4:e,5:n,6:4,7:r,11:6,67:i},{3:10,4:e,5:n,6:4,7:r,11:6,67:i},t([1,4,5,16,20,22,23,24,30,32,34,35,36,38,42,46,47,48,49,57,67],a,{8:11}),{12:12,68:[1,13]},{68:[2,61]},{1:[2,1]},{1:[2,2]},{1:[2,3]},{1:[2,4],4:o,5:s,6:35,9:14,10:16,11:6,16:c,17:36,20:u,21:20,22:l,23:h,24:f,25:24,26:25,27:26,28:27,29:28,30:d,32:p,34:y,35:g,36:m,38:v,42:b,46:_,47:x,48:w,49:k,57:T,67:i},{13:43,14:[1,44],70:E},t([14,70],[2,62]),t(C,[2,6]),{6:35,10:46,11:6,16:c,17:36,20:u,21:20,22:l,23:h,24:f,25:24,26:25,27:26,28:27,29:28,30:d,32:p,34:y,35:g,36:m,38:v,42:b,46:_,47:x,48:w,49:k,57:T,67:i},t(C,[2,8]),t(C,[2,9]),{17:47,57:T},{17:48,57:T},{5:[1,49]},t(C,[2,17]),{17:50,57:T},{17:51,57:T},{5:[1,52]},{5:[1,53]},{5:[1,54]},{5:[1,55]},{5:[1,56]},{31:57,66:S},{19:[1,59]},{19:[1,60]},{19:[1,61]},{19:[1,62]},{19:[1,63]},t(C,[2,31]),{54:64,58:[1,65],59:[1,66],60:[1,67],61:[1,68],62:[1,69],63:[1,70],64:[1,71],65:[1,72]},{43:73,44:[1,74],52:[1,75],53:[1,76]},{17:77,57:T},{17:78,57:T},{17:79,57:T},{17:80,57:T},t([5,18,51,58,59,60,61,62,63,64,65,66],[2,51]),{5:[1,81]},{15:82,69:[1,83]},{5:[2,64]},t(C,[2,7]),{5:[1,85],18:[1,84]},{5:[1,87],18:[1,86]},t(C,[2,16]),{5:[1,88]},{5:[1,89]},t(C,[2,20]),t(C,[2,21]),t(C,[2,22]),t(C,[2,23]),t(C,[2,24]),{5:[1,90]},{5:[2,60]},t(A,a,{8:91}),t(A,a,{8:92}),t(A,a,{8:93}),t(M,a,{37:94,8:95}),t(N,a,{39:96,8:97}),{17:100,55:[1,98],56:[1,99],57:T},t(D,[2,52]),t(D,[2,53]),t(D,[2,54]),t(D,[2,55]),t(D,[2,56]),t(D,[2,57]),t(D,[2,58]),t(D,[2,59]),{17:101,57:T},{17:103,45:102,57:T},{57:[2,46]},{57:[2,47]},{31:104,66:S},{31:105,66:S},{31:106,66:S},{31:107,66:S},t(O,[2,10]),{13:108,70:E},{70:[2,63]},{19:[1,109]},t(C,[2,13]),{19:[1,110]},t(C,[2,15]),t(C,[2,18]),t(C,[2,19]),t(C,[2,25]),{4:o,5:s,6:35,9:14,10:16,11:6,16:c,17:36,20:u,21:20,22:l,23:h,24:f,25:24,26:25,27:26,28:27,29:28,30:d,32:p,33:[1,111],34:y,35:g,36:m,38:v,42:b,46:_,47:x,48:w,49:k,57:T,67:i},{4:o,5:s,6:35,9:14,10:16,11:6,16:c,17:36,20:u,21:20,22:l,23:h,24:f,25:24,26:25,27:26,28:27,29:28,30:d,32:p,33:[1,112],34:y,35:g,36:m,38:v,42:b,46:_,47:x,48:w,49:k,57:T,67:i},{4:o,5:s,6:35,9:14,10:16,11:6,16:c,17:36,20:u,21:20,22:l,23:h,24:f,25:24,26:25,27:26,28:27,29:28,30:d,32:p,33:[1,113],34:y,35:g,36:m,38:v,42:b,46:_,47:x,48:w,49:k,57:T,67:i},{33:[1,114]},{4:o,5:s,6:35,9:14,10:16,11:6,16:c,17:36,20:u,21:20,22:l,23:h,24:f,25:24,26:25,27:26,28:27,29:28,30:d,32:p,33:[2,34],34:y,35:g,36:m,38:v,41:[1,115],42:b,46:_,47:x,48:w,49:k,57:T,67:i},{33:[1,116]},{4:o,5:s,6:35,9:14,10:16,11:6,16:c,17:36,20:u,21:20,22:l,23:h,24:f,25:24,26:25,27:26,28:27,29:28,30:d,32:p,33:[2,32],34:y,35:g,36:m,38:v,40:[1,117],42:b,46:_,47:x,48:w,49:k,57:T,67:i},{17:118,57:T},{17:119,57:T},{31:120,66:S},{31:121,66:S},{31:122,66:S},{51:[1,123],66:[2,45]},{5:[2,38]},{5:[2,39]},{5:[2,40]},{5:[2,41]},{5:[1,124]},{5:[1,125]},{5:[1,126]},t(C,[2,26]),t(C,[2,27]),t(C,[2,28]),t(C,[2,29]),{19:[1,127]},t(C,[2,30]),{19:[1,128]},{31:129,66:S},{31:130,66:S},{5:[2,50]},{5:[2,36]},{5:[2,37]},{17:131,57:T},t(O,[2,11]),t(C,[2,12]),t(C,[2,14]),t(M,a,{8:95,37:132}),t(N,a,{8:97,39:133}),{5:[2,48]},{5:[2,49]},{66:[2,44]},{33:[2,35]},{33:[2,33]}],defaultActions:{7:[2,61],8:[2,1],9:[2,2],10:[2,3],45:[2,64],58:[2,60],75:[2,46],76:[2,47],83:[2,63],104:[2,38],105:[2,39],106:[2,40],107:[2,41],120:[2,50],121:[2,36],122:[2,37],129:[2,48],130:[2,49],131:[2,44],132:[2,35],133:[2,33]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],o=this.table,s=\"\",c=0,u=0,l=0,h=2,f=1,d=a.slice.call(arguments,1),p=Object.create(this.lexer),y={yy:{}};for(var g in this.yy)Object.prototype.hasOwnProperty.call(this.yy,g)&&(y.yy[g]=this.yy[g]);p.setInput(t,y.yy),y.yy.lexer=p,y.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var m=p.yylloc;a.push(m);var v=p.options&&p.options.ranges;function b(){var t;return\"number\"!=typeof(t=r.pop()||p.lex()||f)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}\"function\"==typeof y.yy.parseError?this.parseError=y.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var _,x,w,k,T,E,C,S,A,M={};;){if(w=n[n.length-1],this.defaultActions[w]?k=this.defaultActions[w]:(null==_&&(_=b()),k=o[w]&&o[w][_]),void 0===k||!k.length||!k[0]){var N=\"\";for(E in A=[],o[w])this.terminals_[E]&&E>h&&A.push(\"'\"+this.terminals_[E]+\"'\");N=p.showPosition?\"Parse error on line \"+(c+1)+\":\\n\"+p.showPosition()+\"\\nExpecting \"+A.join(\", \")+\", got '\"+(this.terminals_[_]||_)+\"'\":\"Parse error on line \"+(c+1)+\": Unexpected \"+(_==f?\"end of input\":\"'\"+(this.terminals_[_]||_)+\"'\"),this.parseError(N,{text:p.match,token:this.terminals_[_]||_,line:p.yylineno,loc:m,expected:A})}if(k[0]instanceof Array&&k.length>1)throw new Error(\"Parse Error: multiple actions possible at state: \"+w+\", token: \"+_);switch(k[0]){case 1:n.push(_),i.push(p.yytext),a.push(p.yylloc),n.push(k[1]),_=null,x?(_=x,x=null):(u=p.yyleng,s=p.yytext,c=p.yylineno,m=p.yylloc,l>0&&l--);break;case 2:if(C=this.productions_[k[1]][1],M.$=i[i.length-C],M._$={first_line:a[a.length-(C||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(C||1)].first_column,last_column:a[a.length-1].last_column},v&&(M._$.range=[a[a.length-(C||1)].range[0],a[a.length-1].range[1]]),void 0!==(T=this.performAction.apply(M,[s,u,c,y.yy,k[1],i,a].concat(d))))return T;C&&(n=n.slice(0,-1*C*2),i=i.slice(0,-1*C),a=a.slice(0,-1*C)),n.push(this.productions_[k[1]][0]),i.push(M.$),a.push(M._$),S=o[n[n.length-2]][n[n.length-1]],n.push(S);break;case 3:return!0}}return!0}},L={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=\"\",this.conditionStack=[\"INITIAL\"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\\r\\n?|\\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\\r\\n?|\\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\\r\\n?|\\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?\"...\":\"\")+t.substr(-20).replace(/\\n/g,\"\")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?\"...\":\"\")).replace(/\\n/g,\"\")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join(\"-\");return t+this.upcomingInput()+\"\\n\"+e+\"^\"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\\r\\n?|\\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\\r?\\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext=\"\",this.match=\"\");for(var i=this._currentRules(),a=0;ae[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:\"\"===this._input?this.EOF:this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". Unrecognized text.\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},lex:function(){return this.next()||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:\"INITIAL\"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{\"case-insensitive\":!0},performAction:function(t,e,n,r){switch(n){case 0:return this.begin(\"open_directive\"),67;case 1:return this.begin(\"type_directive\"),68;case 2:return this.popState(),this.begin(\"arg_directive\"),14;case 3:return this.popState(),this.popState(),70;case 4:return 69;case 5:case 39:case 52:return 5;case 6:case 7:case 8:case 9:case 10:break;case 11:return this.begin(\"ID\"),16;case 12:return this.begin(\"ID\"),20;case 13:return e.yytext=e.yytext.trim(),this.begin(\"ALIAS\"),57;case 14:return this.popState(),this.popState(),this.begin(\"LINE\"),18;case 15:return this.popState(),this.popState(),5;case 16:return this.begin(\"LINE\"),32;case 17:return this.begin(\"LINE\"),34;case 18:return this.begin(\"LINE\"),35;case 19:return this.begin(\"LINE\"),36;case 20:return this.begin(\"LINE\"),41;case 21:return this.begin(\"LINE\"),38;case 22:return this.begin(\"LINE\"),40;case 23:return this.popState(),19;case 24:return 33;case 25:return 52;case 26:return 53;case 27:return 46;case 28:return 47;case 29:return 48;case 30:return 49;case 31:return 44;case 32:return 42;case 33:return this.begin(\"ID\"),23;case 34:return this.begin(\"ID\"),24;case 35:return 30;case 36:return 7;case 37:return 22;case 38:return 51;case 40:return e.yytext=e.yytext.trim(),57;case 41:return 60;case 42:return 61;case 43:return 58;case 44:return 59;case 45:return 62;case 46:return 63;case 47:return 64;case 48:return 65;case 49:return 66;case 50:return 55;case 51:return 56;case 53:return\"INVALID\"}},rules:[/^(?:%%\\{)/i,/^(?:((?:(?!\\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\\}%%)/i,/^(?:((?:(?!\\}%%).|\\n)*))/i,/^(?:[\\n]+)/i,/^(?:\\s+)/i,/^(?:((?!\\n)\\s)+)/i,/^(?:#[^\\n]*)/i,/^(?:%(?!\\{)[^\\n]*)/i,/^(?:[^\\}]%%[^\\n]*)/i,/^(?:participant\\b)/i,/^(?:actor\\b)/i,/^(?:[^\\->:\\n,;]+?(?=((?!\\n)\\s)+as(?!\\n)\\s|[#\\n;]|$))/i,/^(?:as\\b)/i,/^(?:(?:))/i,/^(?:loop\\b)/i,/^(?:rect\\b)/i,/^(?:opt\\b)/i,/^(?:alt\\b)/i,/^(?:else\\b)/i,/^(?:par\\b)/i,/^(?:and\\b)/i,/^(?:(?:[:]?(?:no)?wrap)?[^#\\n;]*)/i,/^(?:end\\b)/i,/^(?:left of\\b)/i,/^(?:right of\\b)/i,/^(?:links\\b)/i,/^(?:link\\b)/i,/^(?:properties\\b)/i,/^(?:details\\b)/i,/^(?:over\\b)/i,/^(?:note\\b)/i,/^(?:activate\\b)/i,/^(?:deactivate\\b)/i,/^(?:title\\b)/i,/^(?:sequenceDiagram\\b)/i,/^(?:autonumber\\b)/i,/^(?:,)/i,/^(?:;)/i,/^(?:[^\\+\\->:\\n,;]+((?!(-x|--x|-\\)|--\\)))[\\-]*[^\\+\\->:\\n,;]+)*)/i,/^(?:->>)/i,/^(?:-->>)/i,/^(?:->)/i,/^(?:-->)/i,/^(?:-[x])/i,/^(?:--[x])/i,/^(?:-[\\)])/i,/^(?:--[\\)])/i,/^(?::(?:(?:no)?wrap)?[^#\\n;]+)/i,/^(?:\\+)/i,/^(?:-)/i,/^(?:$)/i,/^(?:.)/i],conditions:{open_directive:{rules:[1,8],inclusive:!1},type_directive:{rules:[2,3,8],inclusive:!1},arg_directive:{rules:[3,4,8],inclusive:!1},ID:{rules:[7,8,13],inclusive:!1},ALIAS:{rules:[7,8,14,15],inclusive:!1},LINE:{rules:[7,8,23],inclusive:!1},INITIAL:{rules:[0,5,6,8,9,10,11,12,16,17,18,19,20,21,22,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53],inclusive:!0}}};function I(){this.yy={}}return B.lexer=L,I.prototype=B,B.Parser=I,new I}();e.parser=r,e.Parser=r.Parser,e.parse=function(){return r.parse.apply(r,arguments)},e.main=function(t){t[1]||(console.log(\"Usage: \"+t[0]+\" FILE\"),process.exit(1));var r=n(1993).readFileSync(n(6470).normalize(t[1]),\"utf8\");return e.parser.parse(r)},n.c[n.s]===t&&e.main(process.argv.slice(1))},3584:(t,e,n)=>{t=n.nmd(t);var r=function(){var t=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},e=[1,2],n=[1,3],r=[1,5],i=[1,7],a=[2,5],o=[1,15],s=[1,17],c=[1,19],u=[1,20],l=[1,21],h=[1,22],f=[1,30],d=[1,23],p=[1,24],y=[1,25],g=[1,26],m=[1,27],v=[1,32],b=[1,33],_=[1,34],x=[1,35],w=[1,31],k=[1,38],T=[1,4,5,14,15,17,19,20,22,23,24,25,26,27,36,37,38,39,42,45],E=[1,4,5,12,13,14,15,17,19,20,22,23,24,25,26,27,36,37,38,39,42,45],C=[1,4,5,7,14,15,17,19,20,22,23,24,25,26,27,36,37,38,39,42,45],S=[4,5,14,15,17,19,20,22,23,24,25,26,27,36,37,38,39,42,45],A={trace:function(){},yy:{},symbols_:{error:2,start:3,SPACE:4,NL:5,directive:6,SD:7,document:8,line:9,statement:10,idStatement:11,DESCR:12,\"--\\x3e\":13,HIDE_EMPTY:14,scale:15,WIDTH:16,COMPOSIT_STATE:17,STRUCT_START:18,STRUCT_STOP:19,STATE_DESCR:20,AS:21,ID:22,FORK:23,JOIN:24,CHOICE:25,CONCURRENT:26,note:27,notePosition:28,NOTE_TEXT:29,direction:30,openDirective:31,typeDirective:32,closeDirective:33,\":\":34,argDirective:35,direction_tb:36,direction_bt:37,direction_rl:38,direction_lr:39,eol:40,\";\":41,EDGE_STATE:42,left_of:43,right_of:44,open_directive:45,type_directive:46,arg_directive:47,close_directive:48,$accept:0,$end:1},terminals_:{2:\"error\",4:\"SPACE\",5:\"NL\",7:\"SD\",12:\"DESCR\",13:\"--\\x3e\",14:\"HIDE_EMPTY\",15:\"scale\",16:\"WIDTH\",17:\"COMPOSIT_STATE\",18:\"STRUCT_START\",19:\"STRUCT_STOP\",20:\"STATE_DESCR\",21:\"AS\",22:\"ID\",23:\"FORK\",24:\"JOIN\",25:\"CHOICE\",26:\"CONCURRENT\",27:\"note\",29:\"NOTE_TEXT\",34:\":\",36:\"direction_tb\",37:\"direction_bt\",38:\"direction_rl\",39:\"direction_lr\",41:\";\",42:\"EDGE_STATE\",43:\"left_of\",44:\"right_of\",45:\"open_directive\",46:\"type_directive\",47:\"arg_directive\",48:\"close_directive\"},productions_:[0,[3,2],[3,2],[3,2],[3,2],[8,0],[8,2],[9,2],[9,1],[9,1],[10,1],[10,2],[10,3],[10,4],[10,1],[10,2],[10,1],[10,4],[10,3],[10,6],[10,1],[10,1],[10,1],[10,1],[10,4],[10,4],[10,1],[10,1],[6,3],[6,5],[30,1],[30,1],[30,1],[30,1],[40,1],[40,1],[11,1],[11,1],[28,1],[28,1],[31,1],[32,1],[35,1],[33,1]],performAction:function(t,e,n,r,i,a,o){var s=a.length-1;switch(i){case 4:return r.setRootDoc(a[s]),a[s];case 5:this.$=[];break;case 6:\"nl\"!=a[s]&&(a[s-1].push(a[s]),this.$=a[s-1]);break;case 7:case 8:case 36:case 37:this.$=a[s];break;case 9:this.$=\"nl\";break;case 10:this.$={stmt:\"state\",id:a[s],type:\"default\",description:\"\"};break;case 11:this.$={stmt:\"state\",id:a[s-1],type:\"default\",description:r.trimColon(a[s])};break;case 12:this.$={stmt:\"relation\",state1:{stmt:\"state\",id:a[s-2],type:\"default\",description:\"\"},state2:{stmt:\"state\",id:a[s],type:\"default\",description:\"\"}};break;case 13:this.$={stmt:\"relation\",state1:{stmt:\"state\",id:a[s-3],type:\"default\",description:\"\"},state2:{stmt:\"state\",id:a[s-1],type:\"default\",description:\"\"},description:a[s].substr(1).trim()};break;case 17:this.$={stmt:\"state\",id:a[s-3],type:\"default\",description:\"\",doc:a[s-1]};break;case 18:var c=a[s],u=a[s-2].trim();if(a[s].match(\":\")){var l=a[s].split(\":\");c=l[0],u=[u,l[1]]}this.$={stmt:\"state\",id:c,type:\"default\",description:u};break;case 19:this.$={stmt:\"state\",id:a[s-3],type:\"default\",description:a[s-5],doc:a[s-1]};break;case 20:this.$={stmt:\"state\",id:a[s],type:\"fork\"};break;case 21:this.$={stmt:\"state\",id:a[s],type:\"join\"};break;case 22:this.$={stmt:\"state\",id:a[s],type:\"choice\"};break;case 23:this.$={stmt:\"state\",id:r.getDividerId(),type:\"divider\"};break;case 24:this.$={stmt:\"state\",id:a[s-1].trim(),note:{position:a[s-2].trim(),text:a[s].trim()}};break;case 30:r.setDirection(\"TB\"),this.$={stmt:\"dir\",value:\"TB\"};break;case 31:r.setDirection(\"BT\"),this.$={stmt:\"dir\",value:\"BT\"};break;case 32:r.setDirection(\"RL\"),this.$={stmt:\"dir\",value:\"RL\"};break;case 33:r.setDirection(\"LR\"),this.$={stmt:\"dir\",value:\"LR\"};break;case 40:r.parseDirective(\"%%{\",\"open_directive\");break;case 41:r.parseDirective(a[s],\"type_directive\");break;case 42:a[s]=a[s].trim().replace(/'/g,'\"'),r.parseDirective(a[s],\"arg_directive\");break;case 43:r.parseDirective(\"}%%\",\"close_directive\",\"state\")}},table:[{3:1,4:e,5:n,6:4,7:r,31:6,45:i},{1:[3]},{3:8,4:e,5:n,6:4,7:r,31:6,45:i},{3:9,4:e,5:n,6:4,7:r,31:6,45:i},{3:10,4:e,5:n,6:4,7:r,31:6,45:i},t([1,4,5,14,15,17,20,22,23,24,25,26,27,36,37,38,39,42,45],a,{8:11}),{32:12,46:[1,13]},{46:[2,40]},{1:[2,1]},{1:[2,2]},{1:[2,3]},{1:[2,4],4:o,5:s,6:28,9:14,10:16,11:18,14:c,15:u,17:l,20:h,22:f,23:d,24:p,25:y,26:g,27:m,30:29,31:6,36:v,37:b,38:_,39:x,42:w,45:i},{33:36,34:[1,37],48:k},t([34,48],[2,41]),t(T,[2,6]),{6:28,10:39,11:18,14:c,15:u,17:l,20:h,22:f,23:d,24:p,25:y,26:g,27:m,30:29,31:6,36:v,37:b,38:_,39:x,42:w,45:i},t(T,[2,8]),t(T,[2,9]),t(T,[2,10],{12:[1,40],13:[1,41]}),t(T,[2,14]),{16:[1,42]},t(T,[2,16],{18:[1,43]}),{21:[1,44]},t(T,[2,20]),t(T,[2,21]),t(T,[2,22]),t(T,[2,23]),{28:45,29:[1,46],43:[1,47],44:[1,48]},t(T,[2,26]),t(T,[2,27]),t(E,[2,36]),t(E,[2,37]),t(T,[2,30]),t(T,[2,31]),t(T,[2,32]),t(T,[2,33]),t(C,[2,28]),{35:49,47:[1,50]},t(C,[2,43]),t(T,[2,7]),t(T,[2,11]),{11:51,22:f,42:w},t(T,[2,15]),t(S,a,{8:52}),{22:[1,53]},{22:[1,54]},{21:[1,55]},{22:[2,38]},{22:[2,39]},{33:56,48:k},{48:[2,42]},t(T,[2,12],{12:[1,57]}),{4:o,5:s,6:28,9:14,10:16,11:18,14:c,15:u,17:l,19:[1,58],20:h,22:f,23:d,24:p,25:y,26:g,27:m,30:29,31:6,36:v,37:b,38:_,39:x,42:w,45:i},t(T,[2,18],{18:[1,59]}),{29:[1,60]},{22:[1,61]},t(C,[2,29]),t(T,[2,13]),t(T,[2,17]),t(S,a,{8:62}),t(T,[2,24]),t(T,[2,25]),{4:o,5:s,6:28,9:14,10:16,11:18,14:c,15:u,17:l,19:[1,63],20:h,22:f,23:d,24:p,25:y,26:g,27:m,30:29,31:6,36:v,37:b,38:_,39:x,42:w,45:i},t(T,[2,19])],defaultActions:{7:[2,40],8:[2,1],9:[2,2],10:[2,3],47:[2,38],48:[2,39],50:[2,42]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],o=this.table,s=\"\",c=0,u=0,l=0,h=2,f=1,d=a.slice.call(arguments,1),p=Object.create(this.lexer),y={yy:{}};for(var g in this.yy)Object.prototype.hasOwnProperty.call(this.yy,g)&&(y.yy[g]=this.yy[g]);p.setInput(t,y.yy),y.yy.lexer=p,y.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var m=p.yylloc;a.push(m);var v=p.options&&p.options.ranges;function b(){var t;return\"number\"!=typeof(t=r.pop()||p.lex()||f)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}\"function\"==typeof y.yy.parseError?this.parseError=y.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var _,x,w,k,T,E,C,S,A,M={};;){if(w=n[n.length-1],this.defaultActions[w]?k=this.defaultActions[w]:(null==_&&(_=b()),k=o[w]&&o[w][_]),void 0===k||!k.length||!k[0]){var N=\"\";for(E in A=[],o[w])this.terminals_[E]&&E>h&&A.push(\"'\"+this.terminals_[E]+\"'\");N=p.showPosition?\"Parse error on line \"+(c+1)+\":\\n\"+p.showPosition()+\"\\nExpecting \"+A.join(\", \")+\", got '\"+(this.terminals_[_]||_)+\"'\":\"Parse error on line \"+(c+1)+\": Unexpected \"+(_==f?\"end of input\":\"'\"+(this.terminals_[_]||_)+\"'\"),this.parseError(N,{text:p.match,token:this.terminals_[_]||_,line:p.yylineno,loc:m,expected:A})}if(k[0]instanceof Array&&k.length>1)throw new Error(\"Parse Error: multiple actions possible at state: \"+w+\", token: \"+_);switch(k[0]){case 1:n.push(_),i.push(p.yytext),a.push(p.yylloc),n.push(k[1]),_=null,x?(_=x,x=null):(u=p.yyleng,s=p.yytext,c=p.yylineno,m=p.yylloc,l>0&&l--);break;case 2:if(C=this.productions_[k[1]][1],M.$=i[i.length-C],M._$={first_line:a[a.length-(C||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(C||1)].first_column,last_column:a[a.length-1].last_column},v&&(M._$.range=[a[a.length-(C||1)].range[0],a[a.length-1].range[1]]),void 0!==(T=this.performAction.apply(M,[s,u,c,y.yy,k[1],i,a].concat(d))))return T;C&&(n=n.slice(0,-1*C*2),i=i.slice(0,-1*C),a=a.slice(0,-1*C)),n.push(this.productions_[k[1]][0]),i.push(M.$),a.push(M._$),S=o[n[n.length-2]][n[n.length-1]],n.push(S);break;case 3:return!0}}return!0}},M={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=\"\",this.conditionStack=[\"INITIAL\"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\\r\\n?|\\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\\r\\n?|\\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\\r\\n?|\\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?\"...\":\"\")+t.substr(-20).replace(/\\n/g,\"\")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?\"...\":\"\")).replace(/\\n/g,\"\")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join(\"-\");return t+this.upcomingInput()+\"\\n\"+e+\"^\"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\\r\\n?|\\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\\r?\\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext=\"\",this.match=\"\");for(var i=this._currentRules(),a=0;ae[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:\"\"===this._input?this.EOF:this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". Unrecognized text.\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},lex:function(){return this.next()||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:\"INITIAL\"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{\"case-insensitive\":!0},performAction:function(t,e,n,r){switch(n){case 0:case 26:return 36;case 1:case 27:return 37;case 2:case 28:return 38;case 3:case 29:return 39;case 4:return this.begin(\"open_directive\"),45;case 5:return this.begin(\"type_directive\"),46;case 6:return this.popState(),this.begin(\"arg_directive\"),34;case 7:return this.popState(),this.popState(),48;case 8:return 47;case 9:case 10:case 12:case 13:case 14:case 15:case 39:case 45:break;case 11:case 59:return 5;case 16:return this.pushState(\"SCALE\"),15;case 17:return 16;case 18:case 33:case 36:this.popState();break;case 19:this.pushState(\"STATE\");break;case 20:case 23:return this.popState(),e.yytext=e.yytext.slice(0,-8).trim(),23;case 21:case 24:return this.popState(),e.yytext=e.yytext.slice(0,-8).trim(),24;case 22:case 25:return this.popState(),e.yytext=e.yytext.slice(0,-10).trim(),25;case 30:this.begin(\"STATE_STRING\");break;case 31:return this.popState(),this.pushState(\"STATE_ID\"),\"AS\";case 32:case 47:return this.popState(),\"ID\";case 34:return\"STATE_DESCR\";case 35:return 17;case 37:return this.popState(),this.pushState(\"struct\"),18;case 38:return this.popState(),19;case 40:return this.begin(\"NOTE\"),27;case 41:return this.popState(),this.pushState(\"NOTE_ID\"),43;case 42:return this.popState(),this.pushState(\"NOTE_ID\"),44;case 43:this.popState(),this.pushState(\"FLOATING_NOTE\");break;case 44:return this.popState(),this.pushState(\"FLOATING_NOTE_ID\"),\"AS\";case 46:return\"NOTE_TEXT\";case 48:return this.popState(),this.pushState(\"NOTE_TEXT\"),22;case 49:return this.popState(),e.yytext=e.yytext.substr(2).trim(),29;case 50:return this.popState(),e.yytext=e.yytext.slice(0,-8).trim(),29;case 51:case 52:return 7;case 53:return 14;case 54:return 42;case 55:return 22;case 56:return e.yytext=e.yytext.trim(),12;case 57:return 13;case 58:return 26;case 60:return\"INVALID\"}},rules:[/^(?:.*direction\\s+TB[^\\n]*)/i,/^(?:.*direction\\s+BT[^\\n]*)/i,/^(?:.*direction\\s+RL[^\\n]*)/i,/^(?:.*direction\\s+LR[^\\n]*)/i,/^(?:%%\\{)/i,/^(?:((?:(?!\\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\\}%%)/i,/^(?:((?:(?!\\}%%).|\\n)*))/i,/^(?:%%(?!\\{)[^\\n]*)/i,/^(?:[^\\}]%%[^\\n]*)/i,/^(?:[\\n]+)/i,/^(?:[\\s]+)/i,/^(?:((?!\\n)\\s)+)/i,/^(?:#[^\\n]*)/i,/^(?:%[^\\n]*)/i,/^(?:scale\\s+)/i,/^(?:\\d+)/i,/^(?:\\s+width\\b)/i,/^(?:state\\s+)/i,/^(?:.*<>)/i,/^(?:.*<>)/i,/^(?:.*<>)/i,/^(?:.*\\[\\[fork\\]\\])/i,/^(?:.*\\[\\[join\\]\\])/i,/^(?:.*\\[\\[choice\\]\\])/i,/^(?:.*direction\\s+TB[^\\n]*)/i,/^(?:.*direction\\s+BT[^\\n]*)/i,/^(?:.*direction\\s+RL[^\\n]*)/i,/^(?:.*direction\\s+LR[^\\n]*)/i,/^(?:[\"])/i,/^(?:\\s*as\\s+)/i,/^(?:[^\\n\\{]*)/i,/^(?:[\"])/i,/^(?:[^\"]*)/i,/^(?:[^\\n\\s\\{]+)/i,/^(?:\\n)/i,/^(?:\\{)/i,/^(?:\\})/i,/^(?:[\\n])/i,/^(?:note\\s+)/i,/^(?:left of\\b)/i,/^(?:right of\\b)/i,/^(?:\")/i,/^(?:\\s*as\\s*)/i,/^(?:[\"])/i,/^(?:[^\"]*)/i,/^(?:[^\\n]*)/i,/^(?:\\s*[^:\\n\\s\\-]+)/i,/^(?:\\s*:[^:\\n;]+)/i,/^(?:[\\s\\S]*?end note\\b)/i,/^(?:stateDiagram\\s+)/i,/^(?:stateDiagram-v2\\s+)/i,/^(?:hide empty description\\b)/i,/^(?:\\[\\*\\])/i,/^(?:[^:\\n\\s\\-\\{]+)/i,/^(?:\\s*:[^:\\n;]+)/i,/^(?:-->)/i,/^(?:--)/i,/^(?:$)/i,/^(?:.)/i],conditions:{LINE:{rules:[13,14],inclusive:!1},close_directive:{rules:[13,14],inclusive:!1},arg_directive:{rules:[7,8,13,14],inclusive:!1},type_directive:{rules:[6,7,13,14],inclusive:!1},open_directive:{rules:[5,13,14],inclusive:!1},struct:{rules:[13,14,19,26,27,28,29,38,39,40,54,55,56,57,58],inclusive:!1},FLOATING_NOTE_ID:{rules:[47],inclusive:!1},FLOATING_NOTE:{rules:[44,45,46],inclusive:!1},NOTE_TEXT:{rules:[49,50],inclusive:!1},NOTE_ID:{rules:[48],inclusive:!1},NOTE:{rules:[41,42,43],inclusive:!1},SCALE:{rules:[17,18],inclusive:!1},ALIAS:{rules:[],inclusive:!1},STATE_ID:{rules:[32],inclusive:!1},STATE_STRING:{rules:[33,34],inclusive:!1},FORK_STATE:{rules:[],inclusive:!1},STATE:{rules:[13,14,20,21,22,23,24,25,30,31,35,36,37],inclusive:!1},ID:{rules:[13,14],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,9,10,11,12,14,15,16,19,37,40,51,52,53,54,55,56,57,59,60],inclusive:!0}}};function N(){this.yy={}}return A.lexer=M,N.prototype=A,A.Parser=N,new N}();e.parser=r,e.Parser=r.Parser,e.parse=function(){return r.parse.apply(r,arguments)},e.main=function(t){t[1]||(console.log(\"Usage: \"+t[0]+\" FILE\"),process.exit(1));var r=n(3069).readFileSync(n(6470).normalize(t[1]),\"utf8\");return e.parser.parse(r)},n.c[n.s]===t&&e.main(process.argv.slice(1))},9763:(t,e,n)=>{t=n.nmd(t);var r=function(){var t=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},e=[1,2],n=[1,5],r=[6,9,11,17,18,19,21],i=[1,15],a=[1,16],o=[1,17],s=[1,21],c=[4,6,9,11,17,18,19,21],u={trace:function(){},yy:{},symbols_:{error:2,start:3,journey:4,document:5,EOF:6,directive:7,line:8,SPACE:9,statement:10,NEWLINE:11,openDirective:12,typeDirective:13,closeDirective:14,\":\":15,argDirective:16,title:17,section:18,taskName:19,taskData:20,open_directive:21,type_directive:22,arg_directive:23,close_directive:24,$accept:0,$end:1},terminals_:{2:\"error\",4:\"journey\",6:\"EOF\",9:\"SPACE\",11:\"NEWLINE\",15:\":\",17:\"title\",18:\"section\",19:\"taskName\",20:\"taskData\",21:\"open_directive\",22:\"type_directive\",23:\"arg_directive\",24:\"close_directive\"},productions_:[0,[3,3],[3,2],[5,0],[5,2],[8,2],[8,1],[8,1],[8,1],[7,4],[7,6],[10,1],[10,1],[10,2],[10,1],[12,1],[13,1],[16,1],[14,1]],performAction:function(t,e,n,r,i,a,o){var s=a.length-1;switch(i){case 1:return a[s-1];case 3:case 7:case 8:this.$=[];break;case 4:a[s-1].push(a[s]),this.$=a[s-1];break;case 5:case 6:this.$=a[s];break;case 11:r.setTitle(a[s].substr(6)),this.$=a[s].substr(6);break;case 12:r.addSection(a[s].substr(8)),this.$=a[s].substr(8);break;case 13:r.addTask(a[s-1],a[s]),this.$=\"task\";break;case 15:r.parseDirective(\"%%{\",\"open_directive\");break;case 16:r.parseDirective(a[s],\"type_directive\");break;case 17:a[s]=a[s].trim().replace(/'/g,'\"'),r.parseDirective(a[s],\"arg_directive\");break;case 18:r.parseDirective(\"}%%\",\"close_directive\",\"journey\")}},table:[{3:1,4:e,7:3,12:4,21:n},{1:[3]},t(r,[2,3],{5:6}),{3:7,4:e,7:3,12:4,21:n},{13:8,22:[1,9]},{22:[2,15]},{6:[1,10],7:18,8:11,9:[1,12],10:13,11:[1,14],12:4,17:i,18:a,19:o,21:n},{1:[2,2]},{14:19,15:[1,20],24:s},t([15,24],[2,16]),t(r,[2,8],{1:[2,1]}),t(r,[2,4]),{7:18,10:22,12:4,17:i,18:a,19:o,21:n},t(r,[2,6]),t(r,[2,7]),t(r,[2,11]),t(r,[2,12]),{20:[1,23]},t(r,[2,14]),{11:[1,24]},{16:25,23:[1,26]},{11:[2,18]},t(r,[2,5]),t(r,[2,13]),t(c,[2,9]),{14:27,24:s},{24:[2,17]},{11:[1,28]},t(c,[2,10])],defaultActions:{5:[2,15],7:[2,2],21:[2,18],26:[2,17]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],o=this.table,s=\"\",c=0,u=0,l=0,h=2,f=1,d=a.slice.call(arguments,1),p=Object.create(this.lexer),y={yy:{}};for(var g in this.yy)Object.prototype.hasOwnProperty.call(this.yy,g)&&(y.yy[g]=this.yy[g]);p.setInput(t,y.yy),y.yy.lexer=p,y.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var m=p.yylloc;a.push(m);var v=p.options&&p.options.ranges;function b(){var t;return\"number\"!=typeof(t=r.pop()||p.lex()||f)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}\"function\"==typeof y.yy.parseError?this.parseError=y.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var _,x,w,k,T,E,C,S,A,M={};;){if(w=n[n.length-1],this.defaultActions[w]?k=this.defaultActions[w]:(null==_&&(_=b()),k=o[w]&&o[w][_]),void 0===k||!k.length||!k[0]){var N=\"\";for(E in A=[],o[w])this.terminals_[E]&&E>h&&A.push(\"'\"+this.terminals_[E]+\"'\");N=p.showPosition?\"Parse error on line \"+(c+1)+\":\\n\"+p.showPosition()+\"\\nExpecting \"+A.join(\", \")+\", got '\"+(this.terminals_[_]||_)+\"'\":\"Parse error on line \"+(c+1)+\": Unexpected \"+(_==f?\"end of input\":\"'\"+(this.terminals_[_]||_)+\"'\"),this.parseError(N,{text:p.match,token:this.terminals_[_]||_,line:p.yylineno,loc:m,expected:A})}if(k[0]instanceof Array&&k.length>1)throw new Error(\"Parse Error: multiple actions possible at state: \"+w+\", token: \"+_);switch(k[0]){case 1:n.push(_),i.push(p.yytext),a.push(p.yylloc),n.push(k[1]),_=null,x?(_=x,x=null):(u=p.yyleng,s=p.yytext,c=p.yylineno,m=p.yylloc,l>0&&l--);break;case 2:if(C=this.productions_[k[1]][1],M.$=i[i.length-C],M._$={first_line:a[a.length-(C||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(C||1)].first_column,last_column:a[a.length-1].last_column},v&&(M._$.range=[a[a.length-(C||1)].range[0],a[a.length-1].range[1]]),void 0!==(T=this.performAction.apply(M,[s,u,c,y.yy,k[1],i,a].concat(d))))return T;C&&(n=n.slice(0,-1*C*2),i=i.slice(0,-1*C),a=a.slice(0,-1*C)),n.push(this.productions_[k[1]][0]),i.push(M.$),a.push(M._$),S=o[n[n.length-2]][n[n.length-1]],n.push(S);break;case 3:return!0}}return!0}},l={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=\"\",this.conditionStack=[\"INITIAL\"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\\r\\n?|\\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\\r\\n?|\\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\\r\\n?|\\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?\"...\":\"\")+t.substr(-20).replace(/\\n/g,\"\")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?\"...\":\"\")).replace(/\\n/g,\"\")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join(\"-\");return t+this.upcomingInput()+\"\\n\"+e+\"^\"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\\r\\n?|\\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\\r?\\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext=\"\",this.match=\"\");for(var i=this._currentRules(),a=0;ae[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:\"\"===this._input?this.EOF:this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". Unrecognized text.\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},lex:function(){return this.next()||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:\"INITIAL\"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{\"case-insensitive\":!0},performAction:function(t,e,n,r){switch(n){case 0:return this.begin(\"open_directive\"),21;case 1:return this.begin(\"type_directive\"),22;case 2:return this.popState(),this.begin(\"arg_directive\"),15;case 3:return this.popState(),this.popState(),24;case 4:return 23;case 5:case 6:case 8:case 9:break;case 7:return 11;case 10:return 4;case 11:return 17;case 12:return 18;case 13:return 19;case 14:return 20;case 15:return 15;case 16:return 6;case 17:return\"INVALID\"}},rules:[/^(?:%%\\{)/i,/^(?:((?:(?!\\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\\}%%)/i,/^(?:((?:(?!\\}%%).|\\n)*))/i,/^(?:%(?!\\{)[^\\n]*)/i,/^(?:[^\\}]%%[^\\n]*)/i,/^(?:[\\n]+)/i,/^(?:\\s+)/i,/^(?:#[^\\n]*)/i,/^(?:journey\\b)/i,/^(?:title\\s[^#\\n;]+)/i,/^(?:section\\s[^#:\\n;]+)/i,/^(?:[^#:\\n;]+)/i,/^(?::[^#\\n;]+)/i,/^(?::)/i,/^(?:$)/i,/^(?:.)/i],conditions:{open_directive:{rules:[1],inclusive:!1},type_directive:{rules:[2,3],inclusive:!1},arg_directive:{rules:[3,4],inclusive:!1},INITIAL:{rules:[0,5,6,7,8,9,10,11,12,13,14,15,16,17],inclusive:!0}}};function h(){this.yy={}}return u.lexer=l,h.prototype=u,u.Parser=h,new h}();e.parser=r,e.Parser=r.Parser,e.parse=function(){return r.parse.apply(r,arguments)},e.main=function(t){t[1]||(console.log(\"Usage: \"+t[0]+\" FILE\"),process.exit(1));var r=n(9143).readFileSync(n(6470).normalize(t[1]),\"utf8\");return e.parser.parse(r)},n.c[n.s]===t&&e.main(process.argv.slice(1))},9609:t=>{var e=/^(%20|\\s)*(javascript|data)/im,n=/[^\\x20-\\x7E]/gim,r=/^([^:]+):/gm,i=[\".\",\"/\"];t.exports={sanitizeUrl:function(t){if(!t)return\"about:blank\";var a,o,s=t.replace(n,\"\").trim();return function(t){return i.indexOf(t[0])>-1}(s)?s:(o=s.match(r))?(a=o[0],e.test(a)?\"about:blank\":s):\"about:blank\"}}},3841:t=>{t.exports=function(t,e){return t.intersect(e)}},7458:(t,e,n)=>{n.d(e,{Z:()=>lC});var r=n(1941),i=n.n(r),a={debug:1,info:2,warn:3,error:4,fatal:5},o={debug:function(){},info:function(){},warn:function(){},error:function(){},fatal:function(){}},s=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:\"fatal\";isNaN(t)&&(t=t.toLowerCase(),void 0!==a[t]&&(t=a[t])),o.trace=function(){},o.debug=function(){},o.info=function(){},o.warn=function(){},o.error=function(){},o.fatal=function(){},t<=a.fatal&&(o.fatal=console.error?console.error.bind(console,c(\"FATAL\"),\"color: orange\"):console.log.bind(console,\"\u001b[35m\",c(\"FATAL\"))),t<=a.error&&(o.error=console.error?console.error.bind(console,c(\"ERROR\"),\"color: orange\"):console.log.bind(console,\"\u001b[31m\",c(\"ERROR\"))),t<=a.warn&&(o.warn=console.warn?console.warn.bind(console,c(\"WARN\"),\"color: orange\"):console.log.bind(console,\"\u001b[33m\",c(\"WARN\"))),t<=a.info&&(o.info=console.info?console.info.bind(console,c(\"INFO\"),\"color: lightblue\"):console.log.bind(console,\"\u001b[34m\",c(\"INFO\"))),t<=a.debug&&(o.debug=console.debug?console.debug.bind(console,c(\"DEBUG\"),\"color: lightgreen\"):console.log.bind(console,\"\u001b[32m\",c(\"DEBUG\")))},c=function(t){var e=i()().format(\"ss.SSS\");return\"%c\".concat(e,\" : \").concat(t,\" : \")};function u(t,e){let n;if(void 0===e)for(const e of t)null!=e&&(n=e)&&(n=e);else{let r=-1;for(let i of t)null!=(i=e(i,++r,t))&&(n=i)&&(n=i)}return n}function l(t,e){let n;if(void 0===e)for(const e of t)null!=e&&(n>e||void 0===n&&e>=e)&&(n=e);else{let r=-1;for(let i of t)null!=(i=e(i,++r,t))&&(n>i||void 0===n&&i>=i)&&(n=i)}return n}function h(t){return t}var f=1e-6;function d(t){return\"translate(\"+t+\",0)\"}function p(t){return\"translate(0,\"+t+\")\"}function y(t){return e=>+t(e)}function g(t,e){return e=Math.max(0,t.bandwidth()-2*e)/2,t.round()&&(e=Math.round(e)),n=>+t(n)+e}function m(){return!this.__axis}function v(t,e){var n=[],r=null,i=null,a=6,o=6,s=3,c=\"undefined\"!=typeof window&&window.devicePixelRatio>1?0:.5,u=1===t||4===t?-1:1,l=4===t||2===t?\"x\":\"y\",v=1===t||3===t?d:p;function b(d){var p=null==r?e.ticks?e.ticks.apply(e,n):e.domain():r,b=null==i?e.tickFormat?e.tickFormat.apply(e,n):h:i,_=Math.max(a,0)+s,x=e.range(),w=+x[0]+c,k=+x[x.length-1]+c,T=(e.bandwidth?g:y)(e.copy(),c),E=d.selection?d.selection():d,C=E.selectAll(\".domain\").data([null]),S=E.selectAll(\".tick\").data(p,e).order(),A=S.exit(),M=S.enter().append(\"g\").attr(\"class\",\"tick\"),N=S.select(\"line\"),D=S.select(\"text\");C=C.merge(C.enter().insert(\"path\",\".tick\").attr(\"class\",\"domain\").attr(\"stroke\",\"currentColor\")),S=S.merge(M),N=N.merge(M.append(\"line\").attr(\"stroke\",\"currentColor\").attr(l+\"2\",u*a)),D=D.merge(M.append(\"text\").attr(\"fill\",\"currentColor\").attr(l,u*_).attr(\"dy\",1===t?\"0em\":3===t?\"0.71em\":\"0.32em\")),d!==E&&(C=C.transition(d),S=S.transition(d),N=N.transition(d),D=D.transition(d),A=A.transition(d).attr(\"opacity\",f).attr(\"transform\",(function(t){return isFinite(t=T(t))?v(t+c):this.getAttribute(\"transform\")})),M.attr(\"opacity\",f).attr(\"transform\",(function(t){var e=this.parentNode.__axis;return v((e&&isFinite(e=e(t))?e:T(t))+c)}))),A.remove(),C.attr(\"d\",4===t||2===t?o?\"M\"+u*o+\",\"+w+\"H\"+c+\"V\"+k+\"H\"+u*o:\"M\"+c+\",\"+w+\"V\"+k:o?\"M\"+w+\",\"+u*o+\"V\"+c+\"H\"+k+\"V\"+u*o:\"M\"+w+\",\"+c+\"H\"+k),S.attr(\"opacity\",1).attr(\"transform\",(function(t){return v(T(t)+c)})),N.attr(l+\"2\",u*a),D.attr(l,u*_).text(b),E.filter(m).attr(\"fill\",\"none\").attr(\"font-size\",10).attr(\"font-family\",\"sans-serif\").attr(\"text-anchor\",2===t?\"start\":4===t?\"end\":\"middle\"),E.each((function(){this.__axis=T}))}return b.scale=function(t){return arguments.length?(e=t,b):e},b.ticks=function(){return n=Array.from(arguments),b},b.tickArguments=function(t){return arguments.length?(n=null==t?[]:Array.from(t),b):n.slice()},b.tickValues=function(t){return arguments.length?(r=null==t?null:Array.from(t),b):r&&r.slice()},b.tickFormat=function(t){return arguments.length?(i=t,b):i},b.tickSize=function(t){return arguments.length?(a=o=+t,b):a},b.tickSizeInner=function(t){return arguments.length?(a=+t,b):a},b.tickSizeOuter=function(t){return arguments.length?(o=+t,b):o},b.tickPadding=function(t){return arguments.length?(s=+t,b):s},b.offset=function(t){return arguments.length?(c=+t,b):c},b}function b(){}function _(t){return null==t?b:function(){return this.querySelector(t)}}function x(t){return null==t?[]:Array.isArray(t)?t:Array.from(t)}function w(){return[]}function k(t){return null==t?w:function(){return this.querySelectorAll(t)}}function T(t){return function(){return this.matches(t)}}function E(t){return function(e){return e.matches(t)}}var C=Array.prototype.find;function S(){return this.firstElementChild}var A=Array.prototype.filter;function M(){return Array.from(this.children)}function N(t){return new Array(t.length)}function D(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function O(t){return function(){return t}}function B(t,e,n,r,i,a){for(var o,s=0,c=e.length,u=a.length;se?1:t>=e?0:NaN}D.prototype={constructor:D,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var P=\"http://www.w3.org/1999/xhtml\";const j={svg:\"http://www.w3.org/2000/svg\",xhtml:P,xlink:\"http://www.w3.org/1999/xlink\",xml:\"http://www.w3.org/XML/1998/namespace\",xmlns:\"http://www.w3.org/2000/xmlns/\"};function Y(t){var e=t+=\"\",n=e.indexOf(\":\");return n>=0&&\"xmlns\"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),j.hasOwnProperty(e)?{space:j[e],local:t}:t}function z(t){return function(){this.removeAttribute(t)}}function U(t){return function(){this.removeAttributeNS(t.space,t.local)}}function q(t,e){return function(){this.setAttribute(t,e)}}function H(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function $(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function W(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function V(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function G(t){return function(){this.style.removeProperty(t)}}function X(t,e,n){return function(){this.style.setProperty(t,e,n)}}function Z(t,e,n){return function(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function Q(t,e){return t.style.getPropertyValue(e)||V(t).getComputedStyle(t,null).getPropertyValue(e)}function K(t){return function(){delete this[t]}}function J(t,e){return function(){this[t]=e}}function tt(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function et(t){return t.trim().split(/^|\\s+/)}function nt(t){return t.classList||new rt(t)}function rt(t){this._node=t,this._names=et(t.getAttribute(\"class\")||\"\")}function it(t,e){for(var n=nt(t),r=-1,i=e.length;++r=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}}))}function Et(t){return function(){var e=this.__on;if(e){for(var n,r=0,i=-1,a=e.length;r=0&&(this._names.splice(e,1),this._node.setAttribute(\"class\",this._names.join(\" \")))},contains:function(t){return this._names.indexOf(t)>=0}};var Nt=[null];function Dt(t,e){this._groups=t,this._parents=e}function Ot(){return new Dt([[document.documentElement]],Nt)}Dt.prototype=Ot.prototype={constructor:Dt,select:function(t){\"function\"!=typeof t&&(t=_(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i=x&&(x=_+1);!(b=g[x])&&++x=0;)(r=i[a])&&(o&&4^r.compareDocumentPosition(o)&&o.parentNode.insertBefore(r,o),o=r);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=F);for(var n=this._groups,r=n.length,i=new Array(r),a=0;a1?this.each((null==e?G:\"function\"==typeof e?Z:X)(t,e,null==n?\"\":n)):Q(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?K:\"function\"==typeof e?tt:J)(t,e)):this.node()[t]},classed:function(t,e){var n=et(t+\"\");if(arguments.length<2){for(var r=nt(this.node()),i=-1,a=n.length;++i{}};function It(){for(var t,e=0,n=arguments.length,r={};e=0&&(n=t.slice(r+1),t=t.slice(0,r)),t&&!e.hasOwnProperty(t))throw new Error(\"unknown type: \"+t);return{type:t,name:n}}))}function Pt(t,e){for(var n,r=0,i=t.length;r0)for(var n,r,i=new Array(n),a=0;a=0&&e._call.call(void 0,t),e=e._next;--qt}()}finally{qt=0,function(){for(var t,e,n=zt,r=1/0;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:zt=e);Ut=t,re(r)}(),Vt=0}}function ne(){var t=Xt.now(),e=t-Wt;e>1e3&&(Gt-=e,Wt=t)}function re(t){qt||(Ht&&(Ht=clearTimeout(Ht)),t-Vt>24?(t<1/0&&(Ht=setTimeout(ee,t-Xt.now()-Gt)),$t&&($t=clearInterval($t))):($t||(Wt=Xt.now(),$t=setInterval(ne,1e3)),qt=1,Zt(ee)))}function ie(t,e,n){var r=new Jt;return e=null==e?0:+e,r.restart((n=>{r.stop(),t(n+e)}),e,n),r}Jt.prototype=te.prototype={constructor:Jt,restart:function(t,e,n){if(\"function\"!=typeof t)throw new TypeError(\"callback is not a function\");n=(null==n?Qt():+n)+(null==e?0:+e),this._next||Ut===this||(Ut?Ut._next=this:zt=this,Ut=this),this._call=t,this._time=n,re()},stop:function(){this._call&&(this._call=null,this._time=1/0,re())}};var ae=Yt(\"start\",\"end\",\"cancel\",\"interrupt\"),oe=[];function se(t,e,n,r,i,a){var o=t.__transition;if(o){if(n in o)return}else t.__transition={};!function(t,e,n){var r,i=t.__transition;function a(c){var u,l,h,f;if(1!==n.state)return s();for(u in i)if((f=i[u]).name===n.name){if(3===f.state)return ie(a);4===f.state?(f.state=6,f.timer.stop(),f.on.call(\"interrupt\",t,t.__data__,f.index,f.group),delete i[u]):+u0)throw new Error(\"too late; already scheduled\");return n}function ue(t,e){var n=le(t,e);if(n.state>3)throw new Error(\"too late; already running\");return n}function le(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error(\"transition not found\");return n}function he(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}var fe,de=180/Math.PI,pe={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function ye(t,e,n,r,i,a){var o,s,c;return(o=Math.sqrt(t*t+e*e))&&(t/=o,e/=o),(c=t*n+e*r)&&(n-=t*c,r-=e*c),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,c/=s),t*r180?e+=360:e-t>180&&(t+=360),a.push({i:n.push(i(n)+\"rotate(\",null,r)-2,x:he(t,e)})):e&&n.push(i(n)+\"rotate(\"+e+r)}(a.rotate,o.rotate,s,c),function(t,e,n,a){t!==e?a.push({i:n.push(i(n)+\"skewX(\",null,r)-2,x:he(t,e)}):e&&n.push(i(n)+\"skewX(\"+e+r)}(a.skewX,o.skewX,s,c),function(t,e,n,r,a,o){if(t!==n||e!==r){var s=a.push(i(a)+\"scale(\",null,\",\",null,\")\");o.push({i:s-4,x:he(t,n)},{i:s-2,x:he(e,r)})}else 1===n&&1===r||a.push(i(a)+\"scale(\"+n+\",\"+r+\")\")}(a.scaleX,a.scaleY,o.scaleX,o.scaleY,s,c),a=o=null,function(t){for(var e,n=-1,r=c.length;++n>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?Ue(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?Ue(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=De.exec(t))?new $e(e[1],e[2],e[3],1):(e=Oe.exec(t))?new $e(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=Be.exec(t))?Ue(e[1],e[2],e[3],e[4]):(e=Le.exec(t))?Ue(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Ie.exec(t))?Xe(e[1],e[2]/100,e[3]/100,1):(e=Re.exec(t))?Xe(e[1],e[2]/100,e[3]/100,e[4]):Fe.hasOwnProperty(t)?ze(Fe[t]):\"transparent\"===t?new $e(NaN,NaN,NaN,0):null}function ze(t){return new $e(t>>16&255,t>>8&255,255&t,1)}function Ue(t,e,n,r){return r<=0&&(t=e=n=NaN),new $e(t,e,n,r)}function qe(t){return t instanceof Te||(t=Ye(t)),t?new $e((t=t.rgb()).r,t.g,t.b,t.opacity):new $e}function He(t,e,n,r){return 1===arguments.length?qe(t):new $e(t,e,n,null==r?1:r)}function $e(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function We(){return\"#\"+Ge(this.r)+Ge(this.g)+Ge(this.b)}function Ve(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?\"rgb(\":\"rgba(\")+Math.max(0,Math.min(255,Math.round(this.r)||0))+\", \"+Math.max(0,Math.min(255,Math.round(this.g)||0))+\", \"+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?\")\":\", \"+t+\")\")}function Ge(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?\"0\":\"\")+t.toString(16)}function Xe(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Qe(t,e,n,r)}function Ze(t){if(t instanceof Qe)return new Qe(t.h,t.s,t.l,t.opacity);if(t instanceof Te||(t=Ye(t)),!t)return new Qe;if(t instanceof Qe)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),a=Math.max(e,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=e===a?(n-r)/s+6*(n0&&c<1?0:o,new Qe(o,s,c,t.opacity)}function Qe(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function Ke(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}function Je(t,e,n,r,i){var a=t*t,o=a*t;return((1-3*t+3*a-o)*e+(4-6*a+3*o)*n+(1+3*t+3*a-3*o)*r+o*i)/6}we(Te,Ye,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:Pe,formatHex:Pe,formatHsl:function(){return Ze(this).formatHsl()},formatRgb:je,toString:je}),we($e,He,ke(Te,{brighter:function(t){return t=null==t?Ce:Math.pow(Ce,t),new $e(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?Ee:Math.pow(Ee,t),new $e(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:We,formatHex:We,formatRgb:Ve,toString:Ve})),we(Qe,(function(t,e,n,r){return 1===arguments.length?Ze(t):new Qe(t,e,n,null==r?1:r)}),ke(Te,{brighter:function(t){return t=null==t?Ce:Math.pow(Ce,t),new Qe(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?Ee:Math.pow(Ee,t),new Qe(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new $e(Ke(t>=240?t-240:t+120,i,r),Ke(t,i,r),Ke(t<120?t+240:t-120,i,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?\"hsl(\":\"hsla(\")+(this.h||0)+\", \"+100*(this.s||0)+\"%, \"+100*(this.l||0)+\"%\"+(1===t?\")\":\", \"+t+\")\")}}));const tn=t=>()=>t;function en(t,e){var n=e-t;return n?function(t,e){return function(n){return t+n*e}}(t,n):tn(isNaN(t)?e:t)}const nn=function t(e){var n=function(t){return 1==(t=+t)?en:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}(e,n,t):tn(isNaN(e)?n:e)}}(e);function r(t,e){var r=n((t=He(t)).r,(e=He(e)).r),i=n(t.g,e.g),a=n(t.b,e.b),o=en(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=i(e),t.b=a(e),t.opacity=o(e),t+\"\"}}return r.gamma=t,r}(1);function rn(t){return function(e){var n,r,i=e.length,a=new Array(i),o=new Array(i),s=new Array(i);for(n=0;n=1?(n=1,e-1):Math.floor(n*e),i=t[r],a=t[r+1],o=r>0?t[r-1]:2*i-a,s=ra&&(i=e.slice(a,i),s[o]?s[o]+=i:s[++o]=i),(n=n[0])===(r=r[0])?s[o]?s[o]+=r:s[++o]=r:(s[++o]=null,c.push({i:o,x:he(n,r)})),a=on.lastIndex;return a=0&&(t=t.slice(0,e)),!t||\"start\"===t}))}(e)?ce:ue;return function(){var o=a(this,t),s=o.on;s!==r&&(i=(r=s).copy()).on(e,n),o.on=i}}var En=Bt.prototype.constructor;function Cn(t){return function(){this.style.removeProperty(t)}}function Sn(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}function An(t,e,n){var r,i;function a(){var a=e.apply(this,arguments);return a!==i&&(r=(i=a)&&Sn(t,a,n)),r}return a._value=e,a}function Mn(t){return function(e){this.textContent=t.call(this,e)}}function Nn(t){var e,n;function r(){var r=t.apply(this,arguments);return r!==n&&(e=(n=r)&&Mn(r)),e}return r._value=t,r}var Dn=0;function On(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function Bn(){return++Dn}var Ln=Bt.prototype;On.prototype=function(t){return Bt().transition(t)}.prototype={constructor:On,select:function(t){var e=this._name,n=this._id;\"function\"!=typeof t&&(t=_(t));for(var r=this._groups,i=r.length,a=new Array(i),o=0;o2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(r?\"interrupt\":\"cancel\",t,t.__data__,n.index,n.group),delete a[i]):o=!1;o&&delete t.__transition}}(this,t)}))},Bt.prototype.transition=function(t){var e,n;t instanceof On?(e=t._id,t=t._name):(e=Bn(),(n=In).time=Qt(),t=null==t?null:t+\"\");for(var r=this._groups,i=r.length,a=0;a>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?sr(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?sr(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=Zn.exec(t))?new lr(e[1],e[2],e[3],1):(e=Qn.exec(t))?new lr(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=Kn.exec(t))?sr(e[1],e[2],e[3],e[4]):(e=Jn.exec(t))?sr(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=tr.exec(t))?pr(e[1],e[2]/100,e[3]/100,1):(e=er.exec(t))?pr(e[1],e[2]/100,e[3]/100,e[4]):nr.hasOwnProperty(t)?or(nr[t]):\"transparent\"===t?new lr(NaN,NaN,NaN,0):null}function or(t){return new lr(t>>16&255,t>>8&255,255&t,1)}function sr(t,e,n,r){return r<=0&&(t=e=n=NaN),new lr(t,e,n,r)}function cr(t){return t instanceof qn||(t=ar(t)),t?new lr((t=t.rgb()).r,t.g,t.b,t.opacity):new lr}function ur(t,e,n,r){return 1===arguments.length?cr(t):new lr(t,e,n,null==r?1:r)}function lr(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function hr(){return\"#\"+dr(this.r)+dr(this.g)+dr(this.b)}function fr(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?\"rgb(\":\"rgba(\")+Math.max(0,Math.min(255,Math.round(this.r)||0))+\", \"+Math.max(0,Math.min(255,Math.round(this.g)||0))+\", \"+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?\")\":\", \"+t+\")\")}function dr(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?\"0\":\"\")+t.toString(16)}function pr(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new gr(t,e,n,r)}function yr(t){if(t instanceof gr)return new gr(t.h,t.s,t.l,t.opacity);if(t instanceof qn||(t=ar(t)),!t)return new gr;if(t instanceof gr)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),a=Math.max(e,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=e===a?(n-r)/s+6*(n0&&c<1?0:o,new gr(o,s,c,t.opacity)}function gr(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function mr(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}zn(qn,ar,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:rr,formatHex:rr,formatHsl:function(){return yr(this).formatHsl()},formatRgb:ir,toString:ir}),zn(lr,ur,Un(qn,{brighter:function(t){return t=null==t?$n:Math.pow($n,t),new lr(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?Hn:Math.pow(Hn,t),new lr(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:hr,formatHex:hr,formatRgb:fr,toString:fr})),zn(gr,(function(t,e,n,r){return 1===arguments.length?yr(t):new gr(t,e,n,null==r?1:r)}),Un(qn,{brighter:function(t){return t=null==t?$n:Math.pow($n,t),new gr(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?Hn:Math.pow(Hn,t),new gr(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new lr(mr(t>=240?t-240:t+120,i,r),mr(t,i,r),mr(t<120?t+240:t-120,i,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?\"hsl(\":\"hsla(\")+(this.h||0)+\", \"+100*(this.s||0)+\"%, \"+100*(this.l||0)+\"%\"+(1===t?\")\":\", \"+t+\")\")}}));const vr=Math.PI/180,br=180/Math.PI,_r=.96422,xr=.82521,wr=4/29,kr=6/29,Tr=3*kr*kr;function Er(t){if(t instanceof Cr)return new Cr(t.l,t.a,t.b,t.opacity);if(t instanceof Br)return Lr(t);t instanceof lr||(t=cr(t));var e,n,r=Nr(t.r),i=Nr(t.g),a=Nr(t.b),o=Sr((.2225045*r+.7168786*i+.0606169*a)/1);return r===i&&i===a?e=n=o:(e=Sr((.4360747*r+.3850649*i+.1430804*a)/_r),n=Sr((.0139322*r+.0971045*i+.7141733*a)/xr)),new Cr(116*o-16,500*(e-o),200*(o-n),t.opacity)}function Cr(t,e,n,r){this.l=+t,this.a=+e,this.b=+n,this.opacity=+r}function Sr(t){return t>.008856451679035631?Math.pow(t,1/3):t/Tr+wr}function Ar(t){return t>kr?t*t*t:Tr*(t-wr)}function Mr(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function Nr(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Dr(t){if(t instanceof Br)return new Br(t.h,t.c,t.l,t.opacity);if(t instanceof Cr||(t=Er(t)),0===t.a&&0===t.b)return new Br(NaN,0()=>t;function Rr(t,e){return function(n){return t+n*e}}function Fr(t,e){var n=e-t;return n?Rr(t,n):Ir(isNaN(t)?e:t)}function Pr(t){return function(e,n){var r=t((e=Or(e)).h,(n=Or(n)).h),i=Fr(e.c,n.c),a=Fr(e.l,n.l),o=Fr(e.opacity,n.opacity);return function(t){return e.h=r(t),e.c=i(t),e.l=a(t),e.opacity=o(t),e+\"\"}}}const jr=Pr((function(t,e){var n=e-t;return n?Rr(t,n>180||n<-180?n-360*Math.round(n/360):n):Ir(isNaN(t)?e:t)}));Pr(Fr);var Yr=Math.sqrt(50),zr=Math.sqrt(10),Ur=Math.sqrt(2);function qr(t,e,n){var r=(e-t)/Math.max(0,n),i=Math.floor(Math.log(r)/Math.LN10),a=r/Math.pow(10,i);return i>=0?(a>=Yr?10:a>=zr?5:a>=Ur?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(a>=Yr?10:a>=zr?5:a>=Ur?2:1)}function Hr(t,e,n){var r=Math.abs(e-t)/Math.max(0,n),i=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),a=r/i;return a>=Yr?i*=10:a>=zr?i*=5:a>=Ur&&(i*=2),ee?1:t>=e?0:NaN}function Wr(t){let e=t,n=t,r=t;function i(t,e,i=0,a=t.length){if(i>>1;r(t[n],e)<0?i=n+1:a=n}while(it(e)-n,n=$r,r=(e,n)=>$r(t(e),n)),{left:i,center:function(t,n,r=0,a=t.length){const o=i(t,n,r,a-1);return o>r&&e(t[o-1],n)>-e(t[o],n)?o-1:o},right:function(t,e,i=0,a=t.length){if(i>>1;r(t[n],e)<=0?i=n+1:a=n}while(i>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?gi(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?gi(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=ai.exec(t))?new bi(e[1],e[2],e[3],1):(e=oi.exec(t))?new bi(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=si.exec(t))?gi(e[1],e[2],e[3],e[4]):(e=ci.exec(t))?gi(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=ui.exec(t))?ki(e[1],e[2]/100,e[3]/100,1):(e=li.exec(t))?ki(e[1],e[2]/100,e[3]/100,e[4]):hi.hasOwnProperty(t)?yi(hi[t]):\"transparent\"===t?new bi(NaN,NaN,NaN,0):null}function yi(t){return new bi(t>>16&255,t>>8&255,255&t,1)}function gi(t,e,n,r){return r<=0&&(t=e=n=NaN),new bi(t,e,n,r)}function mi(t){return t instanceof Kr||(t=pi(t)),t?new bi((t=t.rgb()).r,t.g,t.b,t.opacity):new bi}function vi(t,e,n,r){return 1===arguments.length?mi(t):new bi(t,e,n,null==r?1:r)}function bi(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function _i(){return\"#\"+wi(this.r)+wi(this.g)+wi(this.b)}function xi(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?\"rgb(\":\"rgba(\")+Math.max(0,Math.min(255,Math.round(this.r)||0))+\", \"+Math.max(0,Math.min(255,Math.round(this.g)||0))+\", \"+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?\")\":\", \"+t+\")\")}function wi(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?\"0\":\"\")+t.toString(16)}function ki(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Ei(t,e,n,r)}function Ti(t){if(t instanceof Ei)return new Ei(t.h,t.s,t.l,t.opacity);if(t instanceof Kr||(t=pi(t)),!t)return new Ei;if(t instanceof Ei)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),a=Math.max(e,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=e===a?(n-r)/s+6*(n0&&c<1?0:o,new Ei(o,s,c,t.opacity)}function Ei(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function Ci(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}function Si(t,e,n,r,i){var a=t*t,o=a*t;return((1-3*t+3*a-o)*e+(4-6*a+3*o)*n+(1+3*t+3*a-3*o)*r+o*i)/6}Zr(Kr,pi,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:fi,formatHex:fi,formatHsl:function(){return Ti(this).formatHsl()},formatRgb:di,toString:di}),Zr(bi,vi,Qr(Kr,{brighter:function(t){return t=null==t?ti:Math.pow(ti,t),new bi(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?Jr:Math.pow(Jr,t),new bi(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:_i,formatHex:_i,formatRgb:xi,toString:xi})),Zr(Ei,(function(t,e,n,r){return 1===arguments.length?Ti(t):new Ei(t,e,n,null==r?1:r)}),Qr(Kr,{brighter:function(t){return t=null==t?ti:Math.pow(ti,t),new Ei(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?Jr:Math.pow(Jr,t),new Ei(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new bi(Ci(t>=240?t-240:t+120,i,r),Ci(t,i,r),Ci(t<120?t+240:t-120,i,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?\"hsl(\":\"hsla(\")+(this.h||0)+\", \"+100*(this.s||0)+\"%, \"+100*(this.l||0)+\"%\"+(1===t?\")\":\", \"+t+\")\")}}));const Ai=t=>()=>t;function Mi(t,e){var n=e-t;return n?function(t,e){return function(n){return t+n*e}}(t,n):Ai(isNaN(t)?e:t)}const Ni=function t(e){var n=function(t){return 1==(t=+t)?Mi:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}(e,n,t):Ai(isNaN(e)?n:e)}}(e);function r(t,e){var r=n((t=vi(t)).r,(e=vi(e)).r),i=n(t.g,e.g),a=n(t.b,e.b),o=Mi(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=i(e),t.b=a(e),t.opacity=o(e),t+\"\"}}return r.gamma=t,r}(1);function Di(t){return function(e){var n,r,i=e.length,a=new Array(i),o=new Array(i),s=new Array(i);for(n=0;n=1?(n=1,e-1):Math.floor(n*e),i=t[r],a=t[r+1],o=r>0?t[r-1]:2*i-a,s=ra&&(i=e.slice(a,i),s[o]?s[o]+=i:s[++o]=i),(n=n[0])===(r=r[0])?s[o]?s[o]+=r:s[++o]=r:(s[++o]=null,c.push({i:o,x:Li(n,r)})),a=Fi.lastIndex;return ae&&(n=t,t=e,e=n),u=function(n){return Math.max(t,Math.min(e,n))}),r=c>2?Vi:Wi,i=a=null,h}function h(e){return null==e||isNaN(e=+e)?n:(i||(i=r(o.map(t),s,c)))(t(u(e)))}return h.invert=function(n){return u(e((a||(a=r(s,o.map(t),Li)))(n)))},h.domain=function(t){return arguments.length?(o=Array.from(t,Ui),l()):o.slice()},h.range=function(t){return arguments.length?(s=Array.from(t),l()):s.slice()},h.rangeRound=function(t){return s=Array.from(t),c=zi,l()},h.clamp=function(t){return arguments.length?(u=!!t||Hi,l()):u!==Hi},h.interpolate=function(t){return arguments.length?(c=t,l()):c},h.unknown=function(t){return arguments.length?(n=t,h):n},function(n,r){return t=n,e=r,l()}}()(Hi,Hi)}function Zi(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}var Qi,Ki=/^(?:(.)?([<>=^]))?([+\\-( ])?([$#])?(0)?(\\d+)?(,)?(\\.\\d+)?(~)?([a-z%])?$/i;function Ji(t){if(!(e=Ki.exec(t)))throw new Error(\"invalid format: \"+t);var e;return new ta({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function ta(t){this.fill=void 0===t.fill?\" \":t.fill+\"\",this.align=void 0===t.align?\">\":t.align+\"\",this.sign=void 0===t.sign?\"-\":t.sign+\"\",this.symbol=void 0===t.symbol?\"\":t.symbol+\"\",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?\"\":t.type+\"\"}function ea(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf(\"e\"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function na(t){return(t=ea(Math.abs(t)))?t[1]:NaN}function ra(t,e){var n=ea(t,e);if(!n)return t+\"\";var r=n[0],i=n[1];return i<0?\"0.\"+new Array(-i).join(\"0\")+r:r.length>i+1?r.slice(0,i+1)+\".\"+r.slice(i+1):r+new Array(i-r.length+2).join(\"0\")}Ji.prototype=ta.prototype,ta.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?\"0\":\"\")+(void 0===this.width?\"\":Math.max(1,0|this.width))+(this.comma?\",\":\"\")+(void 0===this.precision?\"\":\".\"+Math.max(0,0|this.precision))+(this.trim?\"~\":\"\")+this.type};const ia={\"%\":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+\"\",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString(\"en\").replace(/,/g,\"\"):t.toString(10)},e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>ra(100*t,e),r:ra,s:function(t,e){var n=ea(t,e);if(!n)return t+\"\";var r=n[0],i=n[1],a=i-(Qi=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,o=r.length;return a===o?r:a>o?r+new Array(a-o+1).join(\"0\"):a>0?r.slice(0,a)+\".\"+r.slice(a):\"0.\"+new Array(1-a).join(\"0\")+ea(t,Math.max(0,e+a-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function aa(t){return t}var oa,sa,ca,ua=Array.prototype.map,la=[\"y\",\"z\",\"a\",\"f\",\"p\",\"n\",\"µ\",\"m\",\"\",\"k\",\"M\",\"G\",\"T\",\"P\",\"E\",\"Z\",\"Y\"];function ha(t){var e=t.domain;return t.ticks=function(t){var n=e();return function(t,e,n){var r,i,a,o,s=-1;if(n=+n,(t=+t)==(e=+e)&&n>0)return[t];if((r=e0){let n=Math.round(t/o),r=Math.round(e/o);for(n*oe&&--r,a=new Array(i=r-n+1);++se&&--r,a=new Array(i=r-n+1);++s0;){if((i=qr(c,u,n))===r)return a[o]=c,a[s]=u,e(a);if(i>0)c=Math.floor(c/i)*i,u=Math.ceil(u/i)*i;else{if(!(i<0))break;c=Math.ceil(c*i)/i,u=Math.floor(u*i)/i}r=i}return t},t}function fa(){var t=Xi();return t.copy=function(){return Gi(t,fa())},Zi.apply(t,arguments),ha(t)}oa=function(t){var e,n,r=void 0===t.grouping||void 0===t.thousands?aa:(e=ua.call(t.grouping,Number),n=t.thousands+\"\",function(t,r){for(var i=t.length,a=[],o=0,s=e[0],c=0;i>0&&s>0&&(c+s+1>r&&(s=Math.max(1,r-c)),a.push(t.substring(i-=s,i+s)),!((c+=s+1)>r));)s=e[o=(o+1)%e.length];return a.reverse().join(n)}),i=void 0===t.currency?\"\":t.currency[0]+\"\",a=void 0===t.currency?\"\":t.currency[1]+\"\",o=void 0===t.decimal?\".\":t.decimal+\"\",s=void 0===t.numerals?aa:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(ua.call(t.numerals,String)),c=void 0===t.percent?\"%\":t.percent+\"\",u=void 0===t.minus?\"−\":t.minus+\"\",l=void 0===t.nan?\"NaN\":t.nan+\"\";function h(t){var e=(t=Ji(t)).fill,n=t.align,h=t.sign,f=t.symbol,d=t.zero,p=t.width,y=t.comma,g=t.precision,m=t.trim,v=t.type;\"n\"===v?(y=!0,v=\"g\"):ia[v]||(void 0===g&&(g=12),m=!0,v=\"g\"),(d||\"0\"===e&&\"=\"===n)&&(d=!0,e=\"0\",n=\"=\");var b=\"$\"===f?i:\"#\"===f&&/[boxX]/.test(v)?\"0\"+v.toLowerCase():\"\",_=\"$\"===f?a:/[%p]/.test(v)?c:\"\",x=ia[v],w=/[defgprs%]/.test(v);function k(t){var i,a,c,f=b,k=_;if(\"c\"===v)k=x(t)+k,t=\"\";else{var T=(t=+t)<0||1/t<0;if(t=isNaN(t)?l:x(Math.abs(t),g),m&&(t=function(t){t:for(var e,n=t.length,r=1,i=-1;r0&&(i=0)}return i>0?t.slice(0,i)+t.slice(e+1):t}(t)),T&&0==+t&&\"+\"!==h&&(T=!1),f=(T?\"(\"===h?h:u:\"-\"===h||\"(\"===h?\"\":h)+f,k=(\"s\"===v?la[8+Qi/3]:\"\")+k+(T&&\"(\"===h?\")\":\"\"),w)for(i=-1,a=t.length;++i(c=t.charCodeAt(i))||c>57){k=(46===c?o+t.slice(i+1):t.slice(i))+k,t=t.slice(0,i);break}}y&&!d&&(t=r(t,1/0));var E=f.length+t.length+k.length,C=E>1)+f+t+k+C.slice(E);break;default:t=C+f+t+k}return s(t)}return g=void 0===g?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g)),k.toString=function(){return t+\"\"},k}return{format:h,formatPrefix:function(t,e){var n=h(((t=Ji(t)).type=\"f\",t)),r=3*Math.max(-8,Math.min(8,Math.floor(na(e)/3))),i=Math.pow(10,-r),a=la[8+r/3];return function(t){return n(i*t)+a}}}}({thousands:\",\",grouping:[3],currency:[\"$\",\"\"]}),sa=oa.format,ca=oa.formatPrefix;class da extends Map{constructor(t,e=ya){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:e}}),null!=t)for(const[e,n]of t)this.set(e,n)}get(t){return super.get(pa(this,t))}has(t){return super.has(pa(this,t))}set(t,e){return super.set(function({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):(t.set(r,n),n)}(this,t),e)}delete(t){return super.delete(function({_intern:t,_key:e},n){const r=e(n);return t.has(r)&&(n=t.get(r),t.delete(r)),n}(this,t))}}function pa({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):n}function ya(t){return null!==t&&\"object\"==typeof t?t.valueOf():t}Set;const ga=Symbol(\"implicit\");function ma(){var t=new da,e=[],n=[],r=ga;function i(i){let a=t.get(i);if(void 0===a){if(r!==ga)return r;t.set(i,a=e.push(i)-1)}return n[a%n.length]}return i.domain=function(n){if(!arguments.length)return e.slice();e=[],t=new da;for(const r of n)t.has(r)||t.set(r,e.push(r)-1);return i},i.range=function(t){return arguments.length?(n=Array.from(t),i):n.slice()},i.unknown=function(t){return arguments.length?(r=t,i):r},i.copy=function(){return ma(e,n).unknown(r)},Zi.apply(i,arguments),i}const va=1e3,ba=6e4,_a=36e5,xa=864e5,wa=6048e5,ka=31536e6;var Ta=new Date,Ea=new Date;function Ca(t,e,n,r){function i(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return i.floor=function(e){return t(e=new Date(+e)),e},i.ceil=function(n){return t(n=new Date(n-1)),e(n,1),t(n),n},i.round=function(t){var e=i(t),n=i.ceil(t);return t-e0))return s;do{s.push(o=new Date(+n)),e(n,a),t(n)}while(o=e)for(;t(e),!n(e);)e.setTime(e-1)}),(function(t,r){if(t>=t)if(r<0)for(;++r<=0;)for(;e(t,-1),!n(t););else for(;--r>=0;)for(;e(t,1),!n(t););}))},n&&(i.count=function(e,r){return Ta.setTime(+e),Ea.setTime(+r),t(Ta),t(Ea),Math.floor(n(Ta,Ea))},i.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?function(e){return r(e)%t==0}:function(e){return i.count(0,e)%t==0}):i:null}),i}var Sa=Ca((function(){}),(function(t,e){t.setTime(+t+e)}),(function(t,e){return e-t}));Sa.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?Ca((function(e){e.setTime(Math.floor(e/t)*t)}),(function(e,n){e.setTime(+e+n*t)}),(function(e,n){return(n-e)/t})):Sa:null};const Aa=Sa;Sa.range;var Ma=Ca((function(t){t.setTime(t-t.getMilliseconds())}),(function(t,e){t.setTime(+t+e*va)}),(function(t,e){return(e-t)/va}),(function(t){return t.getUTCSeconds()}));const Na=Ma;Ma.range;var Da=Ca((function(t){t.setTime(t-t.getMilliseconds()-t.getSeconds()*va)}),(function(t,e){t.setTime(+t+e*ba)}),(function(t,e){return(e-t)/ba}),(function(t){return t.getMinutes()}));const Oa=Da;Da.range;var Ba=Ca((function(t){t.setTime(t-t.getMilliseconds()-t.getSeconds()*va-t.getMinutes()*ba)}),(function(t,e){t.setTime(+t+e*_a)}),(function(t,e){return(e-t)/_a}),(function(t){return t.getHours()}));const La=Ba;Ba.range;var Ia=Ca((t=>t.setHours(0,0,0,0)),((t,e)=>t.setDate(t.getDate()+e)),((t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*ba)/xa),(t=>t.getDate()-1));const Ra=Ia;function Fa(t){return Ca((function(e){e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+7*e)}),(function(t,e){return(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*ba)/wa}))}Ia.range;var Pa=Fa(0),ja=Fa(1),Ya=Fa(2),za=Fa(3),Ua=Fa(4),qa=Fa(5),Ha=Fa(6),$a=(Pa.range,ja.range,Ya.range,za.range,Ua.range,qa.range,Ha.range,Ca((function(t){t.setDate(1),t.setHours(0,0,0,0)}),(function(t,e){t.setMonth(t.getMonth()+e)}),(function(t,e){return e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear())}),(function(t){return t.getMonth()})));const Wa=$a;$a.range;var Va=Ca((function(t){t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,e){t.setFullYear(t.getFullYear()+e)}),(function(t,e){return e.getFullYear()-t.getFullYear()}),(function(t){return t.getFullYear()}));Va.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Ca((function(e){e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)}),(function(e,n){e.setFullYear(e.getFullYear()+n*t)})):null};const Ga=Va;Va.range;var Xa=Ca((function(t){t.setUTCSeconds(0,0)}),(function(t,e){t.setTime(+t+e*ba)}),(function(t,e){return(e-t)/ba}),(function(t){return t.getUTCMinutes()}));const Za=Xa;Xa.range;var Qa=Ca((function(t){t.setUTCMinutes(0,0,0)}),(function(t,e){t.setTime(+t+e*_a)}),(function(t,e){return(e-t)/_a}),(function(t){return t.getUTCHours()}));const Ka=Qa;Qa.range;var Ja=Ca((function(t){t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+e)}),(function(t,e){return(e-t)/xa}),(function(t){return t.getUTCDate()-1}));const to=Ja;function eo(t){return Ca((function(e){e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+7*e)}),(function(t,e){return(e-t)/wa}))}Ja.range;var no=eo(0),ro=eo(1),io=eo(2),ao=eo(3),oo=eo(4),so=eo(5),co=eo(6),uo=(no.range,ro.range,io.range,ao.range,oo.range,so.range,co.range,Ca((function(t){t.setUTCDate(1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCMonth(t.getUTCMonth()+e)}),(function(t,e){return e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear())}),(function(t){return t.getUTCMonth()})));const lo=uo;uo.range;var ho=Ca((function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e)}),(function(t,e){return e.getUTCFullYear()-t.getUTCFullYear()}),(function(t){return t.getUTCFullYear()}));ho.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Ca((function(e){e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),(function(e,n){e.setUTCFullYear(e.getUTCFullYear()+n*t)})):null};const fo=ho;function po(t,e,n,r,i,a){const o=[[Na,1,va],[Na,5,5e3],[Na,15,15e3],[Na,30,3e4],[a,1,ba],[a,5,3e5],[a,15,9e5],[a,30,18e5],[i,1,_a],[i,3,108e5],[i,6,216e5],[i,12,432e5],[r,1,xa],[r,2,1728e5],[n,1,wa],[e,1,2592e6],[e,3,7776e6],[t,1,ka]];function s(e,n,r){const i=Math.abs(n-e)/r,a=Wr((([,,t])=>t)).right(o,i);if(a===o.length)return t.every(Hr(e/ka,n/ka,r));if(0===a)return Aa.every(Math.max(Hr(e,n,r),1));const[s,c]=o[i/o[a-1][2][t.toLowerCase(),e])))}function Oo(t,e,n){var r=Eo.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function Bo(t,e,n){var r=Eo.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function Lo(t,e,n){var r=Eo.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function Io(t,e,n){var r=Eo.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function Ro(t,e,n){var r=Eo.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function Fo(t,e,n){var r=Eo.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function Po(t,e,n){var r=Eo.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function jo(t,e,n){var r=/^(Z)|([+-]\\d\\d)(?::?(\\d\\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||\"00\")),n+r[0].length):-1}function Yo(t,e,n){var r=Eo.exec(e.slice(n,n+1));return r?(t.q=3*r[0]-3,n+r[0].length):-1}function zo(t,e,n){var r=Eo.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function Uo(t,e,n){var r=Eo.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function qo(t,e,n){var r=Eo.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function Ho(t,e,n){var r=Eo.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function $o(t,e,n){var r=Eo.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function Wo(t,e,n){var r=Eo.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function Vo(t,e,n){var r=Eo.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function Go(t,e,n){var r=Eo.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Xo(t,e,n){var r=Co.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function Zo(t,e,n){var r=Eo.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function Qo(t,e,n){var r=Eo.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function Ko(t,e){return Ao(t.getDate(),e,2)}function Jo(t,e){return Ao(t.getHours(),e,2)}function ts(t,e){return Ao(t.getHours()%12||12,e,2)}function es(t,e){return Ao(1+Ra.count(Ga(t),t),e,3)}function ns(t,e){return Ao(t.getMilliseconds(),e,3)}function rs(t,e){return ns(t,e)+\"000\"}function is(t,e){return Ao(t.getMonth()+1,e,2)}function as(t,e){return Ao(t.getMinutes(),e,2)}function os(t,e){return Ao(t.getSeconds(),e,2)}function ss(t){var e=t.getDay();return 0===e?7:e}function cs(t,e){return Ao(Pa.count(Ga(t)-1,t),e,2)}function us(t){var e=t.getDay();return e>=4||0===e?Ua(t):Ua.ceil(t)}function ls(t,e){return t=us(t),Ao(Ua.count(Ga(t),t)+(4===Ga(t).getDay()),e,2)}function hs(t){return t.getDay()}function fs(t,e){return Ao(ja.count(Ga(t)-1,t),e,2)}function ds(t,e){return Ao(t.getFullYear()%100,e,2)}function ps(t,e){return Ao((t=us(t)).getFullYear()%100,e,2)}function ys(t,e){return Ao(t.getFullYear()%1e4,e,4)}function gs(t,e){var n=t.getDay();return Ao((t=n>=4||0===n?Ua(t):Ua.ceil(t)).getFullYear()%1e4,e,4)}function ms(t){var e=t.getTimezoneOffset();return(e>0?\"-\":(e*=-1,\"+\"))+Ao(e/60|0,\"0\",2)+Ao(e%60,\"0\",2)}function vs(t,e){return Ao(t.getUTCDate(),e,2)}function bs(t,e){return Ao(t.getUTCHours(),e,2)}function _s(t,e){return Ao(t.getUTCHours()%12||12,e,2)}function xs(t,e){return Ao(1+to.count(fo(t),t),e,3)}function ws(t,e){return Ao(t.getUTCMilliseconds(),e,3)}function ks(t,e){return ws(t,e)+\"000\"}function Ts(t,e){return Ao(t.getUTCMonth()+1,e,2)}function Es(t,e){return Ao(t.getUTCMinutes(),e,2)}function Cs(t,e){return Ao(t.getUTCSeconds(),e,2)}function Ss(t){var e=t.getUTCDay();return 0===e?7:e}function As(t,e){return Ao(no.count(fo(t)-1,t),e,2)}function Ms(t){var e=t.getUTCDay();return e>=4||0===e?oo(t):oo.ceil(t)}function Ns(t,e){return t=Ms(t),Ao(oo.count(fo(t),t)+(4===fo(t).getUTCDay()),e,2)}function Ds(t){return t.getUTCDay()}function Os(t,e){return Ao(ro.count(fo(t)-1,t),e,2)}function Bs(t,e){return Ao(t.getUTCFullYear()%100,e,2)}function Ls(t,e){return Ao((t=Ms(t)).getUTCFullYear()%100,e,2)}function Is(t,e){return Ao(t.getUTCFullYear()%1e4,e,4)}function Rs(t,e){var n=t.getUTCDay();return Ao((t=n>=4||0===n?oo(t):oo.ceil(t)).getUTCFullYear()%1e4,e,4)}function Fs(){return\"+0000\"}function Ps(){return\"%\"}function js(t){return+t}function Ys(t){return Math.floor(+t/1e3)}function zs(t){return new Date(t)}function Us(t){return t instanceof Date?+t:+new Date(+t)}function qs(t,e,n,r,i,a,o,s,c,u){var l=Xi(),h=l.invert,f=l.domain,d=u(\".%L\"),p=u(\":%S\"),y=u(\"%I:%M\"),g=u(\"%I %p\"),m=u(\"%a %d\"),v=u(\"%b %d\"),b=u(\"%B\"),_=u(\"%Y\");function x(t){return(c(t)=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:js,s:Ys,S:os,u:ss,U:cs,V:ls,w:hs,W:fs,x:null,X:null,y:ds,Y:ys,Z:ms,\"%\":Ps},_={a:function(t){return o[t.getUTCDay()]},A:function(t){return a[t.getUTCDay()]},b:function(t){return c[t.getUTCMonth()]},B:function(t){return s[t.getUTCMonth()]},c:null,d:vs,e:vs,f:ks,g:Ls,G:Rs,H:bs,I:_s,j:xs,L:ws,m:Ts,M:Es,p:function(t){return i[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:js,s:Ys,S:Cs,u:Ss,U:As,V:Ns,w:Ds,W:Os,x:null,X:null,y:Bs,Y:Is,Z:Fs,\"%\":Ps},x={a:function(t,e,n){var r=d.exec(e.slice(n));return r?(t.w=p.get(r[0].toLowerCase()),n+r[0].length):-1},A:function(t,e,n){var r=h.exec(e.slice(n));return r?(t.w=f.get(r[0].toLowerCase()),n+r[0].length):-1},b:function(t,e,n){var r=m.exec(e.slice(n));return r?(t.m=v.get(r[0].toLowerCase()),n+r[0].length):-1},B:function(t,e,n){var r=y.exec(e.slice(n));return r?(t.m=g.get(r[0].toLowerCase()),n+r[0].length):-1},c:function(t,n,r){return T(t,e,n,r)},d:Uo,e:Uo,f:Go,g:Po,G:Fo,H:Ho,I:Ho,j:qo,L:Vo,m:zo,M:$o,p:function(t,e,n){var r=u.exec(e.slice(n));return r?(t.p=l.get(r[0].toLowerCase()),n+r[0].length):-1},q:Yo,Q:Zo,s:Qo,S:Wo,u:Bo,U:Lo,V:Io,w:Oo,W:Ro,x:function(t,e,r){return T(t,n,e,r)},X:function(t,e,n){return T(t,r,e,n)},y:Po,Y:Fo,Z:jo,\"%\":Xo};function w(t,e){return function(n){var r,i,a,o=[],s=-1,c=0,u=t.length;for(n instanceof Date||(n=new Date(+n));++s53)return null;\"w\"in a||(a.w=1),\"Z\"in a?(i=(r=_o(xo(a.y,0,1))).getUTCDay(),r=i>4||0===i?ro.ceil(r):ro(r),r=to.offset(r,7*(a.V-1)),a.y=r.getUTCFullYear(),a.m=r.getUTCMonth(),a.d=r.getUTCDate()+(a.w+6)%7):(i=(r=bo(xo(a.y,0,1))).getDay(),r=i>4||0===i?ja.ceil(r):ja(r),r=Ra.offset(r,7*(a.V-1)),a.y=r.getFullYear(),a.m=r.getMonth(),a.d=r.getDate()+(a.w+6)%7)}else(\"W\"in a||\"U\"in a)&&(\"w\"in a||(a.w=\"u\"in a?a.u%7:\"W\"in a?1:0),i=\"Z\"in a?_o(xo(a.y,0,1)).getUTCDay():bo(xo(a.y,0,1)).getDay(),a.m=0,a.d=\"W\"in a?(a.w+6)%7+7*a.W-(i+5)%7:a.w+7*a.U-(i+6)%7);return\"Z\"in a?(a.H+=a.Z/100|0,a.M+=a.Z%100,_o(a)):bo(a)}}function T(t,e,n,r){for(var i,a,o=0,s=e.length,c=n.length;o=c)return-1;if(37===(i=e.charCodeAt(o++))){if(i=e.charAt(o++),!(a=x[i in To?e.charAt(o++):i])||(r=a(t,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}return b.x=w(n,b),b.X=w(r,b),b.c=w(e,b),_.x=w(n,_),_.X=w(r,_),_.c=w(e,_),{format:function(t){var e=w(t+=\"\",b);return e.toString=function(){return t},e},parse:function(t){var e=k(t+=\"\",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=w(t+=\"\",_);return e.toString=function(){return t},e},utcParse:function(t){var e=k(t+=\"\",!0);return e.toString=function(){return t},e}}}({dateTime:\"%x, %X\",date:\"%-m/%-d/%Y\",time:\"%-I:%M:%S %p\",periods:[\"AM\",\"PM\"],days:[\"Sunday\",\"Monday\",\"Tuesday\",\"Wednesday\",\"Thursday\",\"Friday\",\"Saturday\"],shortDays:[\"Sun\",\"Mon\",\"Tue\",\"Wed\",\"Thu\",\"Fri\",\"Sat\"],months:[\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"],shortMonths:[\"Jan\",\"Feb\",\"Mar\",\"Apr\",\"May\",\"Jun\",\"Jul\",\"Aug\",\"Sep\",\"Oct\",\"Nov\",\"Dec\"]}),ko=wo.format,wo.parse,wo.utcFormat,wo.utcParse;var Qs=Array.prototype.find;function Ks(){return this.firstElementChild}var Js=Array.prototype.filter;function tc(){return Array.from(this.children)}function ec(t){return new Array(t.length)}function nc(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function rc(t){return function(){return t}}function ic(t,e,n,r,i,a){for(var o,s=0,c=e.length,u=a.length;se?1:t>=e?0:NaN}nc.prototype={constructor:nc,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var uc=\"http://www.w3.org/1999/xhtml\";const lc={svg:\"http://www.w3.org/2000/svg\",xhtml:uc,xlink:\"http://www.w3.org/1999/xlink\",xml:\"http://www.w3.org/XML/1998/namespace\",xmlns:\"http://www.w3.org/2000/xmlns/\"};function hc(t){var e=t+=\"\",n=e.indexOf(\":\");return n>=0&&\"xmlns\"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),lc.hasOwnProperty(e)?{space:lc[e],local:t}:t}function fc(t){return function(){this.removeAttribute(t)}}function dc(t){return function(){this.removeAttributeNS(t.space,t.local)}}function pc(t,e){return function(){this.setAttribute(t,e)}}function yc(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function gc(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function mc(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function vc(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function bc(t){return function(){this.style.removeProperty(t)}}function _c(t,e,n){return function(){this.style.setProperty(t,e,n)}}function xc(t,e,n){return function(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function wc(t,e){return t.style.getPropertyValue(e)||vc(t).getComputedStyle(t,null).getPropertyValue(e)}function kc(t){return function(){delete this[t]}}function Tc(t,e){return function(){this[t]=e}}function Ec(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function Cc(t){return t.trim().split(/^|\\s+/)}function Sc(t){return t.classList||new Ac(t)}function Ac(t){this._node=t,this._names=Cc(t.getAttribute(\"class\")||\"\")}function Mc(t,e){for(var n=Sc(t),r=-1,i=e.length;++r=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}}))}function Zc(t){return function(){var e=this.__on;if(e){for(var n,r=0,i=-1,a=e.length;r=0&&(this._names.splice(e,1),this._node.setAttribute(\"class\",this._names.join(\" \")))},contains:function(t){return this._names.indexOf(t)>=0}};var eu=[null];function nu(t,e){this._groups=t,this._parents=e}function ru(){return new nu([[document.documentElement]],eu)}nu.prototype=ru.prototype={constructor:nu,select:function(t){\"function\"!=typeof t&&(t=$s(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i=x&&(x=_+1);!(b=g[x])&&++x=0;)(r=i[a])&&(o&&4^r.compareDocumentPosition(o)&&o.parentNode.insertBefore(r,o),o=r);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=cc);for(var n=this._groups,r=n.length,i=new Array(r),a=0;a1?this.each((null==e?bc:\"function\"==typeof e?xc:_c)(t,e,null==n?\"\":n)):wc(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?kc:\"function\"==typeof e?Ec:Tc)(t,e)):this.node()[t]},classed:function(t,e){var n=Cc(t+\"\");if(arguments.length<2){for(var r=Sc(this.node()),i=-1,a=n.length;++iuu)if(Math.abs(l*s-c*u)>uu&&i){var f=n-a,d=r-o,p=s*s+c*c,y=f*f+d*d,g=Math.sqrt(p),m=Math.sqrt(h),v=i*Math.tan((su-Math.acos((p+h-y)/(2*g*m)))/2),b=v/m,_=v/g;Math.abs(b-1)>uu&&(this._+=\"L\"+(t+b*u)+\",\"+(e+b*l)),this._+=\"A\"+i+\",\"+i+\",0,0,\"+ +(l*f>u*d)+\",\"+(this._x1=t+_*s)+\",\"+(this._y1=e+_*c)}else this._+=\"L\"+(this._x1=t)+\",\"+(this._y1=e)},arc:function(t,e,n,r,i,a){t=+t,e=+e,a=!!a;var o=(n=+n)*Math.cos(r),s=n*Math.sin(r),c=t+o,u=e+s,l=1^a,h=a?r-i:i-r;if(n<0)throw new Error(\"negative radius: \"+n);null===this._x1?this._+=\"M\"+c+\",\"+u:(Math.abs(this._x1-c)>uu||Math.abs(this._y1-u)>uu)&&(this._+=\"L\"+c+\",\"+u),n&&(h<0&&(h=h%cu+cu),h>lu?this._+=\"A\"+n+\",\"+n+\",0,1,\"+l+\",\"+(t-o)+\",\"+(e-s)+\"A\"+n+\",\"+n+\",0,1,\"+l+\",\"+(this._x1=c)+\",\"+(this._y1=u):h>uu&&(this._+=\"A\"+n+\",\"+n+\",0,\"+ +(h>=su)+\",\"+l+\",\"+(this._x1=t+n*Math.cos(i))+\",\"+(this._y1=e+n*Math.sin(i))))},rect:function(t,e,n,r){this._+=\"M\"+(this._x0=this._x1=+t)+\",\"+(this._y0=this._y1=+e)+\"h\"+ +n+\"v\"+ +r+\"h\"+-n+\"Z\"},toString:function(){return this._}};const du=fu;function pu(t){return function(){return t}}var yu=Math.abs,gu=Math.atan2,mu=Math.cos,vu=Math.max,bu=Math.min,_u=Math.sin,xu=Math.sqrt,wu=1e-12,ku=Math.PI,Tu=ku/2,Eu=2*ku;function Cu(t){return t>1?0:t<-1?ku:Math.acos(t)}function Su(t){return t>=1?Tu:t<=-1?-Tu:Math.asin(t)}function Au(t){return t.innerRadius}function Mu(t){return t.outerRadius}function Nu(t){return t.startAngle}function Du(t){return t.endAngle}function Ou(t){return t&&t.padAngle}function Bu(t,e,n,r,i,a,o,s){var c=n-t,u=r-e,l=o-i,h=s-a,f=h*c-l*u;if(!(f*fN*N+D*D&&(T=C,E=S),{cx:T,cy:E,x01:-l,y01:-h,x11:T*(i/x-1),y11:E*(i/x-1)}}function Iu(){var t=Au,e=Mu,n=pu(0),r=null,i=Nu,a=Du,o=Ou,s=null;function c(){var c,u,l=+t.apply(this,arguments),h=+e.apply(this,arguments),f=i.apply(this,arguments)-Tu,d=a.apply(this,arguments)-Tu,p=yu(d-f),y=d>f;if(s||(s=c=du()),hwu)if(p>Eu-wu)s.moveTo(h*mu(f),h*_u(f)),s.arc(0,0,h,f,d,!y),l>wu&&(s.moveTo(l*mu(d),l*_u(d)),s.arc(0,0,l,d,f,y));else{var g,m,v=f,b=d,_=f,x=d,w=p,k=p,T=o.apply(this,arguments)/2,E=T>wu&&(r?+r.apply(this,arguments):xu(l*l+h*h)),C=bu(yu(h-l)/2,+n.apply(this,arguments)),S=C,A=C;if(E>wu){var M=Su(E/l*_u(T)),N=Su(E/h*_u(T));(w-=2*M)>wu?(_+=M*=y?1:-1,x-=M):(w=0,_=x=(f+d)/2),(k-=2*N)>wu?(v+=N*=y?1:-1,b-=N):(k=0,v=b=(f+d)/2)}var D=h*mu(v),O=h*_u(v),B=l*mu(x),L=l*_u(x);if(C>wu){var I,R=h*mu(b),F=h*_u(b),P=l*mu(_),j=l*_u(_);if(pwu?A>wu?(g=Lu(P,j,D,O,h,A,y),m=Lu(R,F,B,L,h,A,y),s.moveTo(g.cx+g.x01,g.cy+g.y01),Awu&&w>wu?S>wu?(g=Lu(B,L,R,F,l,-S,y),m=Lu(D,O,P,j,l,-S,y),s.lineTo(g.cx+g.x01,g.cy+g.y01),St?1:e>=t?0:NaN}function qu(t){return t}function Hu(){}function $u(t,e,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+n)/6)}function Wu(t){this._context=t}function Vu(t){return new Wu(t)}function Gu(t){this._context=t}function Xu(t){this._context=t}function Zu(t){this._context=t}function Qu(t){return t<0?-1:1}function Ku(t,e,n){var r=t._x1-t._x0,i=e-t._x1,a=(t._y1-t._y0)/(r||i<0&&-0),o=(n-t._y1)/(i||r<0&&-0),s=(a*i+o*r)/(r+i);return(Qu(a)+Qu(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function Ju(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function tl(t,e,n){var r=t._x0,i=t._y0,a=t._x1,o=t._y1,s=(a-r)/3;t._context.bezierCurveTo(r+s,i+s*e,a-s,o-s*n,a,o)}function el(t){this._context=t}function nl(t){this._context=new rl(t)}function rl(t){this._context=t}function il(t){this._context=t}function al(t){var e,n,r=t.length-1,i=new Array(r),a=new Array(r),o=new Array(r);for(i[0]=0,a[0]=2,o[0]=t[0]+2*t[1],e=1;e=0;--e)i[e]=(o[e]-i[e+1])/a[e];for(a[r-1]=(t[r]+i[r-1])/2,e=0;e=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}}this._x=t,this._y=e}};var sl=new Date,cl=new Date;function ul(t,e,n,r){function i(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return i.floor=function(e){return t(e=new Date(+e)),e},i.ceil=function(n){return t(n=new Date(n-1)),e(n,1),t(n),n},i.round=function(t){var e=i(t),n=i.ceil(t);return t-e0))return s;do{s.push(o=new Date(+n)),e(n,a),t(n)}while(o=e)for(;t(e),!n(e);)e.setTime(e-1)}),(function(t,r){if(t>=t)if(r<0)for(;++r<=0;)for(;e(t,-1),!n(t););else for(;--r>=0;)for(;e(t,1),!n(t););}))},n&&(i.count=function(e,r){return sl.setTime(+e),cl.setTime(+r),t(sl),t(cl),Math.floor(n(sl,cl))},i.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?function(e){return r(e)%t==0}:function(e){return i.count(0,e)%t==0}):i:null}),i}const ll=864e5,hl=6048e5;function fl(t){return ul((function(e){e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+7*e)}),(function(t,e){return(e-t)/hl}))}var dl=fl(0),pl=fl(1),yl=fl(2),gl=fl(3),ml=fl(4),vl=fl(5),bl=fl(6),_l=(dl.range,pl.range,yl.range,gl.range,ml.range,vl.range,bl.range,ul((function(t){t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+e)}),(function(t,e){return(e-t)/ll}),(function(t){return t.getUTCDate()-1})));const xl=_l;function wl(t){return ul((function(e){e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+7*e)}),(function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/hl}))}_l.range;var kl=wl(0),Tl=wl(1),El=wl(2),Cl=wl(3),Sl=wl(4),Al=wl(5),Ml=wl(6),Nl=(kl.range,Tl.range,El.range,Cl.range,Sl.range,Al.range,Ml.range,ul((t=>t.setHours(0,0,0,0)),((t,e)=>t.setDate(t.getDate()+e)),((t,e)=>(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/ll),(t=>t.getDate()-1)));const Dl=Nl;Nl.range;var Ol=ul((function(t){t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,e){t.setFullYear(t.getFullYear()+e)}),(function(t,e){return e.getFullYear()-t.getFullYear()}),(function(t){return t.getFullYear()}));Ol.every=function(t){return isFinite(t=Math.floor(t))&&t>0?ul((function(e){e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)}),(function(e,n){e.setFullYear(e.getFullYear()+n*t)})):null};const Bl=Ol;Ol.range;var Ll=ul((function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e)}),(function(t,e){return e.getUTCFullYear()-t.getUTCFullYear()}),(function(t){return t.getUTCFullYear()}));Ll.every=function(t){return isFinite(t=Math.floor(t))&&t>0?ul((function(e){e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),(function(e,n){e.setUTCFullYear(e.getUTCFullYear()+n*t)})):null};const Il=Ll;function Rl(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function Fl(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function Pl(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}Ll.range;var jl,Yl,zl={\"-\":\"\",_:\" \",0:\"0\"},Ul=/^\\s*\\d+/,ql=/^%/,Hl=/[\\\\^$*+?|[\\]().{}]/g;function $l(t,e,n){var r=t<0?\"-\":\"\",i=(r?-t:t)+\"\",a=i.length;return r+(a[t.toLowerCase(),e])))}function Xl(t,e,n){var r=Ul.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function Zl(t,e,n){var r=Ul.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function Ql(t,e,n){var r=Ul.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function Kl(t,e,n){var r=Ul.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function Jl(t,e,n){var r=Ul.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function th(t,e,n){var r=Ul.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function eh(t,e,n){var r=Ul.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function nh(t,e,n){var r=/^(Z)|([+-]\\d\\d)(?::?(\\d\\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||\"00\")),n+r[0].length):-1}function rh(t,e,n){var r=Ul.exec(e.slice(n,n+1));return r?(t.q=3*r[0]-3,n+r[0].length):-1}function ih(t,e,n){var r=Ul.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function ah(t,e,n){var r=Ul.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function oh(t,e,n){var r=Ul.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function sh(t,e,n){var r=Ul.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function ch(t,e,n){var r=Ul.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function uh(t,e,n){var r=Ul.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function lh(t,e,n){var r=Ul.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function hh(t,e,n){var r=Ul.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function fh(t,e,n){var r=ql.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function dh(t,e,n){var r=Ul.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function ph(t,e,n){var r=Ul.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function yh(t,e){return $l(t.getDate(),e,2)}function gh(t,e){return $l(t.getHours(),e,2)}function mh(t,e){return $l(t.getHours()%12||12,e,2)}function vh(t,e){return $l(1+Dl.count(Bl(t),t),e,3)}function bh(t,e){return $l(t.getMilliseconds(),e,3)}function _h(t,e){return bh(t,e)+\"000\"}function xh(t,e){return $l(t.getMonth()+1,e,2)}function wh(t,e){return $l(t.getMinutes(),e,2)}function kh(t,e){return $l(t.getSeconds(),e,2)}function Th(t){var e=t.getDay();return 0===e?7:e}function Eh(t,e){return $l(kl.count(Bl(t)-1,t),e,2)}function Ch(t){var e=t.getDay();return e>=4||0===e?Sl(t):Sl.ceil(t)}function Sh(t,e){return t=Ch(t),$l(Sl.count(Bl(t),t)+(4===Bl(t).getDay()),e,2)}function Ah(t){return t.getDay()}function Mh(t,e){return $l(Tl.count(Bl(t)-1,t),e,2)}function Nh(t,e){return $l(t.getFullYear()%100,e,2)}function Dh(t,e){return $l((t=Ch(t)).getFullYear()%100,e,2)}function Oh(t,e){return $l(t.getFullYear()%1e4,e,4)}function Bh(t,e){var n=t.getDay();return $l((t=n>=4||0===n?Sl(t):Sl.ceil(t)).getFullYear()%1e4,e,4)}function Lh(t){var e=t.getTimezoneOffset();return(e>0?\"-\":(e*=-1,\"+\"))+$l(e/60|0,\"0\",2)+$l(e%60,\"0\",2)}function Ih(t,e){return $l(t.getUTCDate(),e,2)}function Rh(t,e){return $l(t.getUTCHours(),e,2)}function Fh(t,e){return $l(t.getUTCHours()%12||12,e,2)}function Ph(t,e){return $l(1+xl.count(Il(t),t),e,3)}function jh(t,e){return $l(t.getUTCMilliseconds(),e,3)}function Yh(t,e){return jh(t,e)+\"000\"}function zh(t,e){return $l(t.getUTCMonth()+1,e,2)}function Uh(t,e){return $l(t.getUTCMinutes(),e,2)}function qh(t,e){return $l(t.getUTCSeconds(),e,2)}function Hh(t){var e=t.getUTCDay();return 0===e?7:e}function $h(t,e){return $l(dl.count(Il(t)-1,t),e,2)}function Wh(t){var e=t.getUTCDay();return e>=4||0===e?ml(t):ml.ceil(t)}function Vh(t,e){return t=Wh(t),$l(ml.count(Il(t),t)+(4===Il(t).getUTCDay()),e,2)}function Gh(t){return t.getUTCDay()}function Xh(t,e){return $l(pl.count(Il(t)-1,t),e,2)}function Zh(t,e){return $l(t.getUTCFullYear()%100,e,2)}function Qh(t,e){return $l((t=Wh(t)).getUTCFullYear()%100,e,2)}function Kh(t,e){return $l(t.getUTCFullYear()%1e4,e,4)}function Jh(t,e){var n=t.getUTCDay();return $l((t=n>=4||0===n?ml(t):ml.ceil(t)).getUTCFullYear()%1e4,e,4)}function tf(){return\"+0000\"}function ef(){return\"%\"}function nf(t){return+t}function rf(t){return Math.floor(+t/1e3)}jl=function(t){var e=t.dateTime,n=t.date,r=t.time,i=t.periods,a=t.days,o=t.shortDays,s=t.months,c=t.shortMonths,u=Vl(i),l=Gl(i),h=Vl(a),f=Gl(a),d=Vl(o),p=Gl(o),y=Vl(s),g=Gl(s),m=Vl(c),v=Gl(c),b={a:function(t){return o[t.getDay()]},A:function(t){return a[t.getDay()]},b:function(t){return c[t.getMonth()]},B:function(t){return s[t.getMonth()]},c:null,d:yh,e:yh,f:_h,g:Dh,G:Bh,H:gh,I:mh,j:vh,L:bh,m:xh,M:wh,p:function(t){return i[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:nf,s:rf,S:kh,u:Th,U:Eh,V:Sh,w:Ah,W:Mh,x:null,X:null,y:Nh,Y:Oh,Z:Lh,\"%\":ef},_={a:function(t){return o[t.getUTCDay()]},A:function(t){return a[t.getUTCDay()]},b:function(t){return c[t.getUTCMonth()]},B:function(t){return s[t.getUTCMonth()]},c:null,d:Ih,e:Ih,f:Yh,g:Qh,G:Jh,H:Rh,I:Fh,j:Ph,L:jh,m:zh,M:Uh,p:function(t){return i[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:nf,s:rf,S:qh,u:Hh,U:$h,V:Vh,w:Gh,W:Xh,x:null,X:null,y:Zh,Y:Kh,Z:tf,\"%\":ef},x={a:function(t,e,n){var r=d.exec(e.slice(n));return r?(t.w=p.get(r[0].toLowerCase()),n+r[0].length):-1},A:function(t,e,n){var r=h.exec(e.slice(n));return r?(t.w=f.get(r[0].toLowerCase()),n+r[0].length):-1},b:function(t,e,n){var r=m.exec(e.slice(n));return r?(t.m=v.get(r[0].toLowerCase()),n+r[0].length):-1},B:function(t,e,n){var r=y.exec(e.slice(n));return r?(t.m=g.get(r[0].toLowerCase()),n+r[0].length):-1},c:function(t,n,r){return T(t,e,n,r)},d:ah,e:ah,f:hh,g:eh,G:th,H:sh,I:sh,j:oh,L:lh,m:ih,M:ch,p:function(t,e,n){var r=u.exec(e.slice(n));return r?(t.p=l.get(r[0].toLowerCase()),n+r[0].length):-1},q:rh,Q:dh,s:ph,S:uh,u:Zl,U:Ql,V:Kl,w:Xl,W:Jl,x:function(t,e,r){return T(t,n,e,r)},X:function(t,e,n){return T(t,r,e,n)},y:eh,Y:th,Z:nh,\"%\":fh};function w(t,e){return function(n){var r,i,a,o=[],s=-1,c=0,u=t.length;for(n instanceof Date||(n=new Date(+n));++s53)return null;\"w\"in a||(a.w=1),\"Z\"in a?(i=(r=Fl(Pl(a.y,0,1))).getUTCDay(),r=i>4||0===i?pl.ceil(r):pl(r),r=xl.offset(r,7*(a.V-1)),a.y=r.getUTCFullYear(),a.m=r.getUTCMonth(),a.d=r.getUTCDate()+(a.w+6)%7):(i=(r=Rl(Pl(a.y,0,1))).getDay(),r=i>4||0===i?Tl.ceil(r):Tl(r),r=Dl.offset(r,7*(a.V-1)),a.y=r.getFullYear(),a.m=r.getMonth(),a.d=r.getDate()+(a.w+6)%7)}else(\"W\"in a||\"U\"in a)&&(\"w\"in a||(a.w=\"u\"in a?a.u%7:\"W\"in a?1:0),i=\"Z\"in a?Fl(Pl(a.y,0,1)).getUTCDay():Rl(Pl(a.y,0,1)).getDay(),a.m=0,a.d=\"W\"in a?(a.w+6)%7+7*a.W-(i+5)%7:a.w+7*a.U-(i+6)%7);return\"Z\"in a?(a.H+=a.Z/100|0,a.M+=a.Z%100,Fl(a)):Rl(a)}}function T(t,e,n,r){for(var i,a,o=0,s=e.length,c=n.length;o=c)return-1;if(37===(i=e.charCodeAt(o++))){if(i=e.charAt(o++),!(a=x[i in zl?e.charAt(o++):i])||(r=a(t,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}return b.x=w(n,b),b.X=w(r,b),b.c=w(e,b),_.x=w(n,_),_.X=w(r,_),_.c=w(e,_),{format:function(t){var e=w(t+=\"\",b);return e.toString=function(){return t},e},parse:function(t){var e=k(t+=\"\",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=w(t+=\"\",_);return e.toString=function(){return t},e},utcParse:function(t){var e=k(t+=\"\",!0);return e.toString=function(){return t},e}}}({dateTime:\"%x, %X\",date:\"%-m/%-d/%Y\",time:\"%-I:%M:%S %p\",periods:[\"AM\",\"PM\"],days:[\"Sunday\",\"Monday\",\"Tuesday\",\"Wednesday\",\"Thursday\",\"Friday\",\"Saturday\"],shortDays:[\"Sun\",\"Mon\",\"Tue\",\"Wed\",\"Thu\",\"Fri\",\"Sat\"],months:[\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"],shortMonths:[\"Jan\",\"Feb\",\"Mar\",\"Apr\",\"May\",\"Jun\",\"Jul\",\"Aug\",\"Sep\",\"Oct\",\"Nov\",\"Dec\"]}),Yl=jl.format,jl.parse,jl.utcFormat,jl.utcParse;var af={value:()=>{}};function of(){for(var t,e=0,n=arguments.length,r={};e=0&&(n=t.slice(r+1),t=t.slice(0,r)),t&&!e.hasOwnProperty(t))throw new Error(\"unknown type: \"+t);return{type:t,name:n}}))}function uf(t,e){for(var n,r=0,i=t.length;r0)for(var n,r,i=new Array(n),a=0;a=0&&e._call.call(void 0,t),e=e._next;--pf}()}finally{pf=0,function(){for(var t,e,n=ff,r=1/0;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:ff=e);df=t,Af(r)}(),vf=0}}function Sf(){var t=_f.now(),e=t-mf;e>1e3&&(bf-=e,mf=t)}function Af(t){pf||(yf&&(yf=clearTimeout(yf)),t-vf>24?(t<1/0&&(yf=setTimeout(Cf,t-_f.now()-bf)),gf&&(gf=clearInterval(gf))):(gf||(mf=_f.now(),gf=setInterval(Sf,1e3)),pf=1,xf(Cf)))}function Mf(t,e,n){var r=new Tf;return e=null==e?0:+e,r.restart((n=>{r.stop(),t(n+e)}),e,n),r}Tf.prototype=Ef.prototype={constructor:Tf,restart:function(t,e,n){if(\"function\"!=typeof t)throw new TypeError(\"callback is not a function\");n=(null==n?wf():+n)+(null==e?0:+e),this._next||df===this||(df?df._next=this:ff=this,df=this),this._call=t,this._time=n,Af()},stop:function(){this._call&&(this._call=null,this._time=1/0,Af())}};var Nf=hf(\"start\",\"end\",\"cancel\",\"interrupt\"),Df=[];function Of(t,e,n,r,i,a){var o=t.__transition;if(o){if(n in o)return}else t.__transition={};!function(t,e,n){var r,i=t.__transition;function a(c){var u,l,h,f;if(1!==n.state)return s();for(u in i)if((f=i[u]).name===n.name){if(3===f.state)return Mf(a);4===f.state?(f.state=6,f.timer.stop(),f.on.call(\"interrupt\",t,t.__data__,f.index,f.group),delete i[u]):+u0)throw new Error(\"too late; already scheduled\");return n}function Lf(t,e){var n=If(t,e);if(n.state>3)throw new Error(\"too late; already running\");return n}function If(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error(\"transition not found\");return n}function Rf(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}var Ff,Pf=180/Math.PI,jf={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Yf(t,e,n,r,i,a){var o,s,c;return(o=Math.sqrt(t*t+e*e))&&(t/=o,e/=o),(c=t*n+e*r)&&(n-=t*c,r-=e*c),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,c/=s),t*r180?e+=360:e-t>180&&(t+=360),a.push({i:n.push(i(n)+\"rotate(\",null,r)-2,x:Rf(t,e)})):e&&n.push(i(n)+\"rotate(\"+e+r)}(a.rotate,o.rotate,s,c),function(t,e,n,a){t!==e?a.push({i:n.push(i(n)+\"skewX(\",null,r)-2,x:Rf(t,e)}):e&&n.push(i(n)+\"skewX(\"+e+r)}(a.skewX,o.skewX,s,c),function(t,e,n,r,a,o){if(t!==n||e!==r){var s=a.push(i(a)+\"scale(\",null,\",\",null,\")\");o.push({i:s-4,x:Rf(t,n)},{i:s-2,x:Rf(e,r)})}else 1===n&&1===r||a.push(i(a)+\"scale(\"+n+\",\"+r+\")\")}(a.scaleX,a.scaleY,o.scaleX,o.scaleY,s,c),a=o=null,function(t){for(var e,n=-1,r=c.length;++n=1?(n=1,e-1):Math.floor(n*e),i=t[r],a=t[r+1],o=r>0?t[r-1]:2*i-a,s=ra&&(i=e.slice(a,i),s[o]?s[o]+=i:s[++o]=i),(n=n[0])===(r=r[0])?s[o]?s[o]+=r:s[++o]=r:(s[++o]=null,c.push({i:o,x:Rf(n,r)})),a=Qf.lastIndex;return a=0&&(t=t.slice(0,e)),!t||\"start\"===t}))}(e)?Bf:Lf;return function(){var o=a(this,t),s=o.on;s!==r&&(i=(r=s).copy()).on(e,n),o.on=i}}var gd=iu.prototype.constructor;function md(t){return function(){this.style.removeProperty(t)}}function vd(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}function bd(t,e,n){var r,i;function a(){var a=e.apply(this,arguments);return a!==i&&(r=(i=a)&&vd(t,a,n)),r}return a._value=e,a}function _d(t){return function(e){this.textContent=t.call(this,e)}}function xd(t){var e,n;function r(){var r=t.apply(this,arguments);return r!==n&&(e=(n=r)&&_d(r)),e}return r._value=t,r}var wd=0;function kd(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function Td(){return++wd}var Ed=iu.prototype;kd.prototype=function(t){return iu().transition(t)}.prototype={constructor:kd,select:function(t){var e=this._name,n=this._id;\"function\"!=typeof t&&(t=$s(t));for(var r=this._groups,i=r.length,a=new Array(i),o=0;o2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(r?\"interrupt\":\"cancel\",t,t.__data__,n.index,n.group),delete a[i]):o=!1;o&&delete t.__transition}}(this,t)}))},iu.prototype.transition=function(t){var e,n;t instanceof kd?(e=t._id,t=t._name):(e=Td(),(n=Cd).time=wf(),t=null==t?null:t+\"\");for(var r=this._groups,i=r.length,a=0;ae?1:t>=e?0:NaN}Yd.prototype={constructor:Yd,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var Vd=\"http://www.w3.org/1999/xhtml\";const Gd={svg:\"http://www.w3.org/2000/svg\",xhtml:Vd,xlink:\"http://www.w3.org/1999/xlink\",xml:\"http://www.w3.org/XML/1998/namespace\",xmlns:\"http://www.w3.org/2000/xmlns/\"};function Xd(t){var e=t+=\"\",n=e.indexOf(\":\");return n>=0&&\"xmlns\"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),Gd.hasOwnProperty(e)?{space:Gd[e],local:t}:t}function Zd(t){return function(){this.removeAttribute(t)}}function Qd(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Kd(t,e){return function(){this.setAttribute(t,e)}}function Jd(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function tp(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function ep(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function np(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function rp(t){return function(){this.style.removeProperty(t)}}function ip(t,e,n){return function(){this.style.setProperty(t,e,n)}}function ap(t,e,n){return function(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function op(t,e){return t.style.getPropertyValue(e)||np(t).getComputedStyle(t,null).getPropertyValue(e)}function sp(t){return function(){delete this[t]}}function cp(t,e){return function(){this[t]=e}}function up(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function lp(t){return t.trim().split(/^|\\s+/)}function hp(t){return t.classList||new fp(t)}function fp(t){this._node=t,this._names=lp(t.getAttribute(\"class\")||\"\")}function dp(t,e){for(var n=hp(t),r=-1,i=e.length;++r=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}}))}function Lp(t){return function(){var e=this.__on;if(e){for(var n,r=0,i=-1,a=e.length;r=0&&(this._names.splice(e,1),this._node.setAttribute(\"class\",this._names.join(\" \")))},contains:function(t){return this._names.indexOf(t)>=0}};var jp=[null];function Yp(t,e){this._groups=t,this._parents=e}function zp(){return new Yp([[document.documentElement]],jp)}Yp.prototype=zp.prototype={constructor:Yp,select:function(t){\"function\"!=typeof t&&(t=Md(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i=x&&(x=_+1);!(b=g[x])&&++x=0;)(r=i[a])&&(o&&4^r.compareDocumentPosition(o)&&o.parentNode.insertBefore(r,o),o=r);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=Wd);for(var n=this._groups,r=n.length,i=new Array(r),a=0;a1?this.each((null==e?rp:\"function\"==typeof e?ap:ip)(t,e,null==n?\"\":n)):op(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?sp:\"function\"==typeof e?up:cp)(t,e)):this.node()[t]},classed:function(t,e){var n=lp(t+\"\");if(arguments.length<2){for(var r=hp(this.node()),i=-1,a=n.length;++i{}};function Hp(){for(var t,e=0,n=arguments.length,r={};e=0&&(n=t.slice(r+1),t=t.slice(0,r)),t&&!e.hasOwnProperty(t))throw new Error(\"unknown type: \"+t);return{type:t,name:n}}))}function Vp(t,e){for(var n,r=0,i=t.length;r0)for(var n,r,i=new Array(n),a=0;a=0&&e._call.call(void 0,t),e=e._next;--Kp}()}finally{Kp=0,function(){for(var t,e,n=Zp,r=1/0;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:Zp=e);Qp=t,fy(r)}(),ny=0}}function hy(){var t=iy.now(),e=t-ey;e>1e3&&(ry-=e,ey=t)}function fy(t){Kp||(Jp&&(Jp=clearTimeout(Jp)),t-ny>24?(t<1/0&&(Jp=setTimeout(ly,t-iy.now()-ry)),ty&&(ty=clearInterval(ty))):(ty||(ey=iy.now(),ty=setInterval(hy,1e3)),Kp=1,ay(ly)))}function dy(t,e,n){var r=new cy;return e=null==e?0:+e,r.restart((n=>{r.stop(),t(n+e)}),e,n),r}cy.prototype=uy.prototype={constructor:cy,restart:function(t,e,n){if(\"function\"!=typeof t)throw new TypeError(\"callback is not a function\");n=(null==n?oy():+n)+(null==e?0:+e),this._next||Qp===this||(Qp?Qp._next=this:Zp=this,Qp=this),this._call=t,this._time=n,fy()},stop:function(){this._call&&(this._call=null,this._time=1/0,fy())}};var py=Xp(\"start\",\"end\",\"cancel\",\"interrupt\"),yy=[];function gy(t,e,n,r,i,a){var o=t.__transition;if(o){if(n in o)return}else t.__transition={};!function(t,e,n){var r,i=t.__transition;function a(c){var u,l,h,f;if(1!==n.state)return s();for(u in i)if((f=i[u]).name===n.name){if(3===f.state)return dy(a);4===f.state?(f.state=6,f.timer.stop(),f.on.call(\"interrupt\",t,t.__data__,f.index,f.group),delete i[u]):+u0)throw new Error(\"too late; already scheduled\");return n}function vy(t,e){var n=by(t,e);if(n.state>3)throw new Error(\"too late; already running\");return n}function by(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error(\"transition not found\");return n}function _y(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}var xy,wy=180/Math.PI,ky={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Ty(t,e,n,r,i,a){var o,s,c;return(o=Math.sqrt(t*t+e*e))&&(t/=o,e/=o),(c=t*n+e*r)&&(n-=t*c,r-=e*c),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,c/=s),t*r180?e+=360:e-t>180&&(t+=360),a.push({i:n.push(i(n)+\"rotate(\",null,r)-2,x:_y(t,e)})):e&&n.push(i(n)+\"rotate(\"+e+r)}(a.rotate,o.rotate,s,c),function(t,e,n,a){t!==e?a.push({i:n.push(i(n)+\"skewX(\",null,r)-2,x:_y(t,e)}):e&&n.push(i(n)+\"skewX(\"+e+r)}(a.skewX,o.skewX,s,c),function(t,e,n,r,a,o){if(t!==n||e!==r){var s=a.push(i(a)+\"scale(\",null,\",\",null,\")\");o.push({i:s-4,x:_y(t,n)},{i:s-2,x:_y(e,r)})}else 1===n&&1===r||a.push(i(a)+\"scale(\"+n+\",\"+r+\")\")}(a.scaleX,a.scaleY,o.scaleX,o.scaleY,s,c),a=o=null,function(t){for(var e,n=-1,r=c.length;++n>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?Qy(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?Qy(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=Yy.exec(t))?new tg(e[1],e[2],e[3],1):(e=zy.exec(t))?new tg(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=Uy.exec(t))?Qy(e[1],e[2],e[3],e[4]):(e=qy.exec(t))?Qy(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Hy.exec(t))?ig(e[1],e[2]/100,e[3]/100,1):(e=$y.exec(t))?ig(e[1],e[2]/100,e[3]/100,e[4]):Wy.hasOwnProperty(t)?Zy(Wy[t]):\"transparent\"===t?new tg(NaN,NaN,NaN,0):null}function Zy(t){return new tg(t>>16&255,t>>8&255,255&t,1)}function Qy(t,e,n,r){return r<=0&&(t=e=n=NaN),new tg(t,e,n,r)}function Ky(t){return t instanceof By||(t=Xy(t)),t?new tg((t=t.rgb()).r,t.g,t.b,t.opacity):new tg}function Jy(t,e,n,r){return 1===arguments.length?Ky(t):new tg(t,e,n,null==r?1:r)}function tg(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function eg(){return\"#\"+rg(this.r)+rg(this.g)+rg(this.b)}function ng(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?\"rgb(\":\"rgba(\")+Math.max(0,Math.min(255,Math.round(this.r)||0))+\", \"+Math.max(0,Math.min(255,Math.round(this.g)||0))+\", \"+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?\")\":\", \"+t+\")\")}function rg(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?\"0\":\"\")+t.toString(16)}function ig(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new og(t,e,n,r)}function ag(t){if(t instanceof og)return new og(t.h,t.s,t.l,t.opacity);if(t instanceof By||(t=Xy(t)),!t)return new og;if(t instanceof og)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),a=Math.max(e,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=e===a?(n-r)/s+6*(n0&&c<1?0:o,new og(o,s,c,t.opacity)}function og(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function sg(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}function cg(t,e,n,r,i){var a=t*t,o=a*t;return((1-3*t+3*a-o)*e+(4-6*a+3*o)*n+(1+3*t+3*a-3*o)*r+o*i)/6}Dy(By,Xy,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:Vy,formatHex:Vy,formatHsl:function(){return ag(this).formatHsl()},formatRgb:Gy,toString:Gy}),Dy(tg,Jy,Oy(By,{brighter:function(t){return t=null==t?Iy:Math.pow(Iy,t),new tg(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?Ly:Math.pow(Ly,t),new tg(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:eg,formatHex:eg,formatRgb:ng,toString:ng})),Dy(og,(function(t,e,n,r){return 1===arguments.length?ag(t):new og(t,e,n,null==r?1:r)}),Oy(By,{brighter:function(t){return t=null==t?Iy:Math.pow(Iy,t),new og(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?Ly:Math.pow(Ly,t),new og(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new tg(sg(t>=240?t-240:t+120,i,r),sg(t,i,r),sg(t<120?t+240:t-120,i,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?\"hsl(\":\"hsla(\")+(this.h||0)+\", \"+100*(this.s||0)+\"%, \"+100*(this.l||0)+\"%\"+(1===t?\")\":\", \"+t+\")\")}}));const ug=t=>()=>t;function lg(t,e){var n=e-t;return n?function(t,e){return function(n){return t+n*e}}(t,n):ug(isNaN(t)?e:t)}const hg=function t(e){var n=function(t){return 1==(t=+t)?lg:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}(e,n,t):ug(isNaN(e)?n:e)}}(e);function r(t,e){var r=n((t=Jy(t)).r,(e=Jy(e)).r),i=n(t.g,e.g),a=n(t.b,e.b),o=lg(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=i(e),t.b=a(e),t.opacity=o(e),t+\"\"}}return r.gamma=t,r}(1);function fg(t){return function(e){var n,r,i=e.length,a=new Array(i),o=new Array(i),s=new Array(i);for(n=0;n=1?(n=1,e-1):Math.floor(n*e),i=t[r],a=t[r+1],o=r>0?t[r-1]:2*i-a,s=ra&&(i=e.slice(a,i),s[o]?s[o]+=i:s[++o]=i),(n=n[0])===(r=r[0])?s[o]?s[o]+=r:s[++o]=r:(s[++o]=null,c.push({i:o,x:_y(n,r)})),a=pg.lastIndex;return a=0&&(t=t.slice(0,e)),!t||\"start\"===t}))}(e)?my:vy;return function(){var o=a(this,t),s=o.on;s!==r&&(i=(r=s).copy()).on(e,n),o.on=i}}var Bg=Up.prototype.constructor;function Lg(t){return function(){this.style.removeProperty(t)}}function Ig(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}function Rg(t,e,n){var r,i;function a(){var a=e.apply(this,arguments);return a!==i&&(r=(i=a)&&Ig(t,a,n)),r}return a._value=e,a}function Fg(t){return function(e){this.textContent=t.call(this,e)}}function Pg(t){var e,n;function r(){var r=t.apply(this,arguments);return r!==n&&(e=(n=r)&&Fg(r)),e}return r._value=t,r}var jg=0;function Yg(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function zg(){return++jg}var Ug=Up.prototype;Yg.prototype=function(t){return Up().transition(t)}.prototype={constructor:Yg,select:function(t){var e=this._name,n=this._id;\"function\"!=typeof t&&(t=Md(t));for(var r=this._groups,i=r.length,a=new Array(i),o=0;o2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(r?\"interrupt\":\"cancel\",t,t.__data__,n.index,n.group),delete a[i]):o=!1;o&&delete t.__transition}}(this,t)}))},Up.prototype.transition=function(t){var e,n;t instanceof Yg?(e=t._id,t=t._name):(e=zg(),(n=qg).time=oy(),t=null==t?null:t+\"\");for(var r=this._groups,i=r.length,a=0;a0?tm(fm,--lm):0,cm--,10===hm&&(cm=1,sm--),hm}function ym(){return hm=lm2||bm(hm)>3?\"\":\" \"}function wm(t,e){for(;--e&&ym()&&!(hm<48||hm>102||hm>57&&hm<65||hm>70&&hm<97););return vm(t,mm()+(e<6&&32==gm()&&32==ym()))}function km(t){for(;ym();)switch(hm){case t:return lm;case 34:case 39:34!==t&&39!==t&&km(hm);break;case 40:41===t&&km(t);break;case 92:ym()}return lm}function Tm(t,e){for(;ym()&&t+hm!==57&&(t+hm!==84||47!==gm()););return\"/*\"+vm(e,lm-1)+\"*\"+Zg(47===t?t:ym())}function Em(t){for(;!bm(gm());)ym();return vm(t,lm)}function Cm(t){return function(t){return fm=\"\",t}(Sm(\"\",null,null,null,[\"\"],t=function(t){return sm=cm=1,um=nm(fm=t),lm=0,[]}(t),0,[0],t))}function Sm(t,e,n,r,i,a,o,s,c){for(var u=0,l=0,h=o,f=0,d=0,p=0,y=1,g=1,m=1,v=0,b=\"\",_=i,x=a,w=r,k=b;g;)switch(p=v,v=ym()){case 40:if(108!=p&&58==k.charCodeAt(h-1)){-1!=Jg(k+=Kg(_m(v),\"&\",\"&\\f\"),\"&\\f\")&&(m=-1);break}case 34:case 39:case 91:k+=_m(v);break;case 9:case 10:case 13:case 32:k+=xm(p);break;case 92:k+=wm(mm()-1,7);continue;case 47:switch(gm()){case 42:case 47:im(Mm(Tm(ym(),mm()),e,n),c);break;default:k+=\"/\"}break;case 123*y:s[u++]=nm(k)*m;case 125*y:case 59:case 0:switch(v){case 0:case 125:g=0;case 59+l:d>0&&nm(k)-h&&im(d>32?Nm(k+\";\",r,n,h-1):Nm(Kg(k,\" \",\"\")+\";\",r,n,h-2),c);break;case 59:k+=\";\";default:if(im(w=Am(k,e,n,u,l,i,s,b,_=[],x=[],h),a),123===v)if(0===l)Sm(k,e,w,w,_,a,h,s,x);else switch(f){case 100:case 109:case 115:Sm(t,w,w,r&&im(Am(t,w,w,0,0,i,s,b,i,_=[],h),x),i,x,h,s,r?_:x);break;default:Sm(k,w,w,w,[\"\"],x,0,s,x)}}u=l=d=0,y=m=1,b=k=\"\",h=o;break;case 58:h=1+nm(k),d=p;default:if(y<1)if(123==v)--y;else if(125==v&&0==y++&&125==pm())continue;switch(k+=Zg(v),v*y){case 38:m=l>0?1:(k+=\"\\f\",-1);break;case 44:s[u++]=(nm(k)-1)*m,m=1;break;case 64:45===gm()&&(k+=_m(ym())),f=gm(),l=h=nm(b=k+=Em(mm())),v++;break;case 45:45===p&&2==nm(k)&&(y=0)}}return a}function Am(t,e,n,r,i,a,o,s,c,u,l){for(var h=i-1,f=0===i?a:[\"\"],d=rm(f),p=0,y=0,g=0;p0?f[m]+\" \"+v:Kg(v,/&\\f/g,f[m])))&&(c[g++]=b);return dm(t,e,n,0===i?Vg:s,c,u,l)}function Mm(t,e,n){return dm(t,e,n,Wg,Zg(hm),em(t,2,-2),0)}function Nm(t,e,n,r){return dm(t,e,n,Gg,em(t,0,r),em(t,r+1,-1),r)}const Dm=\"8.13.8\";var Om=n(9609),Bm=n(7856),Lm=n.n(Bm),Im=function(t){var e=t.replace(/\\\\u[\\dA-F]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\\\u/g,\"\"),16))}));return console.log(e),e=(e=(e=e.replace(/\\\\x([0-9a-f]{2})/gi,(function(t,e){return String.fromCharCode(parseInt(e,16))}))).replace(/\\\\[\\d\\d\\d]{3}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\\\/g,\"\"),8))}))).replace(/\\\\[\\d\\d\\d]{2}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\\\/g,\"\"),8))}))},Rm=function(t){for(var e=\"\",n=0;n>=0;){if(!((n=t.indexOf(\"=0)){e+=t,n=-1;break}e+=t.substr(0,n),(n=(t=t.substr(n+1)).indexOf(\"<\\/script>\"))>=0&&(n+=9,t=t.substr(n))}var r=Im(e);return(r=(r=(r=r.replace(/script>/gi,\"#\")).replace(/javascript:/gi,\"#\")).replace(/onerror=/gi,\"onerror:\")).replace(/