diff --git a/changelog.md b/changelog.md index f80b021..bd7a5a4 100644 --- a/changelog.md +++ b/changelog.md @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) -## [Unreleased] +## [0.1.1] - 2023/05/03 ### Changed @@ -21,4 +21,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Setup first version of parser. - Setup first version of renderer. +[0.1.1]: https://github.com/ditrit/githubator-plugin/blob/main/changelog.md#0.1.1 [0.1.0]: https://github.com/ditrit/githubator-plugin/blob/main/changelog.md#0.1.0 diff --git a/dist/githubator-plugin.js b/dist/githubator-plugin.js index f2599ea..7a61157 100644 --- a/dist/githubator-plugin.js +++ b/dist/githubator-plugin.js @@ -1,2 +1,2 @@ /*! For license information please see githubator-plugin.js.LICENSE.txt */ -(()=>{var e={181:(e,t)=>{(()=>{var e={985:function(e){var t;"undefined"!=typeof self&&self,t=function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=11)}([function(e,t,n){"use strict";var r=Array.prototype,i=Object.prototype,o={"&":"&",'"':""","'":"'","<":"<",">":">"},s=/[&"'<>]/g;function a(e,t){return i.hasOwnProperty.call(e,t)}function c(e){return o[e]}function l(e,t,n){var r,i,o;if(e instanceof Error&&(e=(i=e).name+": "+i.message),Object.setPrototypeOf?(r=new Error(e),Object.setPrototypeOf(r,l.prototype)):(r=this,Object.defineProperty(r,"message",{enumerable:!1,writable:!0,value:e})),Object.defineProperty(r,"name",{value:"Template render error"}),Error.captureStackTrace&&Error.captureStackTrace(r,this.constructor),i){var s=Object.getOwnPropertyDescriptor(i,"stack");(o=s&&(s.get||function(){return s.value}))||(o=function(){return i.stack})}else{var a=new Error(e).stack;o=function(){return a}}return Object.defineProperty(r,"stack",{get:function(){return o.call(r)}}),Object.defineProperty(r,"cause",{value:i}),r.lineno=t,r.colno=n,r.firstUpdate=!0,r.Update=function(e){var t="("+(e||"unknown path")+")";return this.firstUpdate&&(this.lineno&&this.colno?t+=" [Line "+this.lineno+", Column "+this.colno+"]":this.lineno&&(t+=" [Line "+this.lineno+"]")),t+="\n ",this.firstUpdate&&(t+=" "),this.message=t+(this.message||""),this.firstUpdate=!1,this},r}function u(e){return"[object Function]"===i.toString.call(e)}function f(e){return"[object Array]"===i.toString.call(e)}function h(e){return"[object String]"===i.toString.call(e)}function p(e){return"[object Object]"===i.toString.call(e)}function d(e){var t,n=(t=e)?"string"==typeof t?t.split("."):[t]:[];return function(e){for(var t=e,r=0;re.length)s=i.slice(0,e.length),i.slice(s.length,a).forEach((function(e,n){n2?i-2:0),s=2;s0||!n)&&process.stdout.write(" ".repeat(t));var o=i===r.length-1?"":"\n";process.stdout.write(""+e+o)}))}e.exports={Node:c,Root:f,NodeList:u,Value:l,Literal:h,Symbol:p,Group:d,Array:m,Pair:y,Dict:v,Output:D,Capture:$,TemplateData:U,If:b,IfAsync:_,InlineIf:w,For:k,AsyncEach:E,AsyncAll:x,Macro:O,Caller:S,Import:T,FromImport:A,FunCall:L,Filter:N,FilterAsync:C,KeywordArgs:j,Block:P,Super:I,Extends:R,Include:B,Set:M,Switch:F,Case:K,LookupVal:g,BinOp:q,In:z,Is:G,Or:W,And:Y,Not:J,Add:H,Concat:X,Sub:Q,Mul:Z,Div:ee,FloorDiv:te,Mod:ne,Pow:re,Neg:ie,Pos:oe,Compare:se,CompareOperand:ae,CallExtension:ce,CallExtensionAsync:le,printNodes:function e(t,n){if(n=n||0,ue(t.typename+": ",n),t instanceof u)ue("\n"),t.children.forEach((function(t){e(t,n+2)}));else if(t instanceof ce)ue(t.extName+"."+t.prop+"\n"),t.args&&e(t.args,n+2),t.contentArgs&&t.contentArgs.forEach((function(t){e(t,n+2)}));else{var r=[],i=null;t.iterFields((function(e,t){e instanceof c?r.push([t,e]):(i=i||{})[t]=e})),i?ue(JSON.stringify(i,null,2)+"\n",null,!0):ue("\n"),r.forEach((function(t){var r=t[0],i=t[1];ue("["+r+"] =>",n+2),e(i,n+4)}))}}}},function(e,t){},function(e,t,n){"use strict";function r(e,t){return r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},r(e,t)}var i=n(8),o=n(17),s=n(3),a=n(0).TemplateError,c=n(2).Frame,l=n(1).Obj,u={"==":"==","===":"===","!=":"!=","!==":"!==","<":"<",">":">","<=":"<=",">=":">="},f=function(e){var t,n;function i(){return e.apply(this,arguments)||this}n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,r(t,n);var o=i.prototype;return o.init=function(e,t){this.templateName=e,this.codebuf=[],this.lastId=0,this.buffer=null,this.bufferStack=[],this._scopeClosers="",this.inBlock=!1,this.throwOnUndefined=t},o.fail=function(e,t,n){throw void 0!==t&&(t+=1),void 0!==n&&(n+=1),new a(e,t,n)},o._pushBuffer=function(){var e=this._tmpid();return this.bufferStack.push(this.buffer),this.buffer=e,this._emit("var "+this.buffer+' = "";'),e},o._popBuffer=function(){this.buffer=this.bufferStack.pop()},o._emit=function(e){this.codebuf.push(e)},o._emitLine=function(e){this._emit(e+"\n")},o._emitLines=function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r0&&i._emit(","),i.compile(e,t)})),r&&this._emit(r)},o._compileExpression=function(e,t){this.assertType(e,s.Literal,s.Symbol,s.Group,s.Array,s.Dict,s.FunCall,s.Caller,s.Filter,s.LookupVal,s.Compare,s.InlineIf,s.In,s.Is,s.And,s.Or,s.Not,s.Add,s.Concat,s.Sub,s.Mul,s.Div,s.FloorDiv,s.Mod,s.Pow,s.Neg,s.Pos,s.Compare,s.NodeList),this.compile(e,t)},o.assertType=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r0&&r._emit(","),e){r._emitLine("function(cb) {"),r._emitLine("if(!cb) { cb = function(err) { if(err) { throw err; }}}");var i=r._pushBuffer();r._withScopedSyntax((function(){r.compile(e,t),r._emitLine("cb(null, "+i+");")})),r._popBuffer(),r._emitLine("return "+i+";"),r._emitLine("}")}else r._emit("null")})),n){var c=this._tmpid();this._emitLine(", "+this._makeCallback(c)),this._emitLine(this.buffer+" += runtime.suppressValue("+c+", "+a+" && env.opts.autoescape);"),this._addScopeLevel()}else this._emit(")"),this._emit(", "+a+" && env.opts.autoescape);\n")},o.compileCallExtensionAsync=function(e,t){this.compileCallExtension(e,t,!0)},o.compileNodeList=function(e,t){this._compileChildren(e,t)},o.compileLiteral=function(e){if("string"==typeof e.value){var t=e.value.replace(/\\/g,"\\\\");t=(t=(t=(t=(t=t.replace(/"/g,'\\"')).replace(/\n/g,"\\n")).replace(/\r/g,"\\r")).replace(/\t/g,"\\t")).replace(/\u2028/g,"\\u2028"),this._emit('"'+t+'"')}else null===e.value?this._emit("null"):this._emit(e.value.toString())},o.compileSymbol=function(e,t){var n=e.value,r=t.lookup(n);r?this._emit(r):this._emit('runtime.contextOrFrameLookup(context, frame, "'+n+'")')},o.compileGroup=function(e,t){this._compileAggregate(e,t,"(",")")},o.compileArray=function(e,t){this._compileAggregate(e,t,"[","]")},o.compileDict=function(e,t){this._compileAggregate(e,t,"{","}")},o.compilePair=function(e,t){var n=e.key,r=e.value;n instanceof s.Symbol?n=new s.Literal(n.lineno,n.colno,n.value):n instanceof s.Literal&&"string"==typeof n.value||this.fail("compilePair: Dict keys must be strings or names",n.lineno,n.colno),this.compile(n,t),this._emit(": "),this._compileExpression(r,t)},o.compileInlineIf=function(e,t){this._emit("("),this.compile(e.cond,t),this._emit("?"),this.compile(e.body,t),this._emit(":"),null!==e.else_?this.compile(e.else_,t):this._emit('""'),this._emit(")")},o.compileIn=function(e,t){this._emit("runtime.inOperator("),this.compile(e.left,t),this._emit(","),this.compile(e.right,t),this._emit(")")},o.compileIs=function(e,t){var n=e.right.name?e.right.name.value:e.right.value;this._emit('env.getTest("'+n+'").call(context, '),this.compile(e.left,t),e.right.args&&(this._emit(","),this.compile(e.right.args,t)),this._emit(") === true")},o._binOpEmitter=function(e,t,n){this.compile(e.left,t),this._emit(n),this.compile(e.right,t)},o.compileOr=function(e,t){return this._binOpEmitter(e,t," || ")},o.compileAnd=function(e,t){return this._binOpEmitter(e,t," && ")},o.compileAdd=function(e,t){return this._binOpEmitter(e,t," + ")},o.compileConcat=function(e,t){return this._binOpEmitter(e,t,' + "" + ')},o.compileSub=function(e,t){return this._binOpEmitter(e,t," - ")},o.compileMul=function(e,t){return this._binOpEmitter(e,t," * ")},o.compileDiv=function(e,t){return this._binOpEmitter(e,t," / ")},o.compileMod=function(e,t){return this._binOpEmitter(e,t," % ")},o.compileNot=function(e,t){this._emit("!"),this.compile(e.target,t)},o.compileFloorDiv=function(e,t){this._emit("Math.floor("),this.compile(e.left,t),this._emit(" / "),this.compile(e.right,t),this._emit(")")},o.compilePow=function(e,t){this._emit("Math.pow("),this.compile(e.left,t),this._emit(", "),this.compile(e.right,t),this._emit(")")},o.compileNeg=function(e,t){this._emit("-"),this.compile(e.target,t)},o.compilePos=function(e,t){this._emit("+"),this.compile(e.target,t)},o.compileCompare=function(e,t){var n=this;this.compile(e.expr,t),e.ops.forEach((function(e){n._emit(" "+u[e.type]+" "),n.compile(e.expr,t)}))},o.compileLookupVal=function(e,t){this._emit("runtime.memberLookup(("),this._compileExpression(e.target,t),this._emit("),"),this._compileExpression(e.val,t),this._emit(")")},o._getNodeName=function(e){switch(e.typename){case"Symbol":return e.value;case"FunCall":return"the return value of ("+this._getNodeName(e.name)+")";case"LookupVal":return this._getNodeName(e.target)+'["'+this._getNodeName(e.val)+'"]';case"Literal":return e.value.toString();default:return"--expression--"}},o.compileFunCall=function(e,t){this._emit("(lineno = "+e.lineno+", colno = "+e.colno+", "),this._emit("runtime.callWrap("),this._compileExpression(e.name,t),this._emit(', "'+this._getNodeName(e.name).replace(/"/g,'\\"')+'", context, '),this._compileAggregate(e.args,t,"[","])"),this._emit(")")},o.compileFilter=function(e,t){var n=e.name;this.assertType(n,s.Symbol),this._emit('env.getFilter("'+n.value+'").call(context, '),this._compileAggregate(e.args,t),this._emit(")")},o.compileFilterAsync=function(e,t){var n=e.name,r=e.symbol.value;this.assertType(n,s.Symbol),t.set(r,r),this._emit('env.getFilter("'+n.value+'").call(context, '),this._compileAggregate(e.args,t),this._emitLine(", "+this._makeCallback(r)),this._addScopeLevel()},o.compileKeywordArgs=function(e,t){this._emit("runtime.makeKeywordArgs("),this.compileDict(e,t),this._emit(")")},o.compileSet=function(e,t){var n=this,r=[];e.targets.forEach((function(e){var i=e.value,o=t.lookup(i);null==o&&(o=n._tmpid(),n._emitLine("var "+o+";")),r.push(o)})),e.value?(this._emit(r.join(" = ")+" = "),this._compileExpression(e.value,t),this._emitLine(";")):(this._emit(r.join(" = ")+" = "),this.compile(e.body,t),this._emitLine(";")),e.targets.forEach((function(e,t){var i=r[t],o=e.value;n._emitLine('frame.set("'+o+'", '+i+", true);"),n._emitLine("if(frame.topLevel) {"),n._emitLine('context.setVariable("'+o+'", '+i+");"),n._emitLine("}"),"_"!==o.charAt(0)&&(n._emitLine("if(frame.topLevel) {"),n._emitLine('context.addExport("'+o+'", '+i+");"),n._emitLine("}"))}))},o.compileSwitch=function(e,t){var n=this;this._emit("switch ("),this.compile(e.expr,t),this._emit(") {"),e.cases.forEach((function(e,r){n._emit("case "),n.compile(e.cond,t),n._emit(": "),n.compile(e.body,t),e.body.children.length&&n._emitLine("break;")})),e.default&&(this._emit("default:"),this.compile(e.default,t)),this._emit("}")},o.compileIf=function(e,t,n){var r=this;this._emit("if("),this._compileExpression(e.cond,t),this._emitLine(") {"),this._withScopedSyntax((function(){r.compile(e.body,t),n&&r._emit("cb()")})),e.else_?(this._emitLine("}\nelse {"),this._withScopedSyntax((function(){r.compile(e.else_,t),n&&r._emit("cb()")}))):n&&(this._emitLine("}\nelse {"),this._emit("cb()")),this._emitLine("}")},o.compileIfAsync=function(e,t){this._emit("(function(cb) {"),this.compileIf(e,t,!0),this._emit("})("+this._makeCallback()),this._addScopeLevel()},o._emitLoopBindings=function(e,t,n,r){var i=this;[{name:"index",val:n+" + 1"},{name:"index0",val:n},{name:"revindex",val:r+" - "+n},{name:"revindex0",val:r+" - "+n+" - 1"},{name:"first",val:n+" === 0"},{name:"last",val:n+" === "+r+" - 1"},{name:"length",val:r}].forEach((function(e){i._emitLine('frame.set("loop.'+e.name+'", '+e.val+");")}))},o.compileFor=function(e,t){var n=this,r=this._tmpid(),i=this._tmpid(),o=this._tmpid();if(t=t.push(),this._emitLine("frame = frame.push();"),this._emit("var "+o+" = "),this._compileExpression(e.arr,t),this._emitLine(";"),this._emit("if("+o+") {"),this._emitLine(o+" = runtime.fromIterator("+o+");"),e.name instanceof s.Array){this._emitLine("var "+r+";"),this._emitLine("if(runtime.isArray("+o+")) {"),this._emitLine("var "+i+" = "+o+".length;"),this._emitLine("for("+r+"=0; "+r+" < "+o+".length; "+r+"++) {"),e.name.children.forEach((function(i,s){var a=n._tmpid();n._emitLine("var "+a+" = "+o+"["+r+"]["+s+"];"),n._emitLine('frame.set("'+i+'", '+o+"["+r+"]["+s+"]);"),t.set(e.name.children[s].value,a)})),this._emitLoopBindings(e,o,r,i),this._withScopedSyntax((function(){n.compile(e.body,t)})),this._emitLine("}"),this._emitLine("} else {");var a=e.name.children,c=a[0],l=a[1],u=this._tmpid(),f=this._tmpid();t.set(c.value,u),t.set(l.value,f),this._emitLine(r+" = -1;"),this._emitLine("var "+i+" = runtime.keys("+o+").length;"),this._emitLine("for(var "+u+" in "+o+") {"),this._emitLine(r+"++;"),this._emitLine("var "+f+" = "+o+"["+u+"];"),this._emitLine('frame.set("'+c.value+'", '+u+");"),this._emitLine('frame.set("'+l.value+'", '+f+");"),this._emitLoopBindings(e,o,r,i),this._withScopedSyntax((function(){n.compile(e.body,t)})),this._emitLine("}"),this._emitLine("}")}else{var h=this._tmpid();t.set(e.name.value,h),this._emitLine("var "+i+" = "+o+".length;"),this._emitLine("for(var "+r+"=0; "+r+" < "+o+".length; "+r+"++) {"),this._emitLine("var "+h+" = "+o+"["+r+"];"),this._emitLine('frame.set("'+e.name.value+'", '+h+");"),this._emitLoopBindings(e,o,r,i),this._withScopedSyntax((function(){n.compile(e.body,t)})),this._emitLine("}")}this._emitLine("}"),e.else_&&(this._emitLine("if (!"+i+") {"),this.compile(e.else_,t),this._emitLine("}")),this._emitLine("frame = frame.pop();")},o._compileAsyncLoop=function(e,t,n){var r=this,i=this._tmpid(),o=this._tmpid(),a=this._tmpid(),c=n?"asyncAll":"asyncEach";if(t=t.push(),this._emitLine("frame = frame.push();"),this._emit("var "+a+" = runtime.fromIterator("),this._compileExpression(e.arr,t),this._emitLine(");"),e.name instanceof s.Array){var l=e.name.children.length;this._emit("runtime."+c+"("+a+", "+l+", function("),e.name.children.forEach((function(e){r._emit(e.value+",")})),this._emit(i+","+o+",next) {"),e.name.children.forEach((function(e){var n=e.value;t.set(n,n),r._emitLine('frame.set("'+n+'", '+n+");")}))}else{var u=e.name.value;this._emitLine("runtime."+c+"("+a+", 1, function("+u+", "+i+", "+o+",next) {"),this._emitLine('frame.set("'+u+'", '+u+");"),t.set(u,u)}this._emitLoopBindings(e,a,i,o),this._withScopedSyntax((function(){var o;n&&(o=r._pushBuffer()),r.compile(e.body,t),r._emitLine("next("+i+(o?","+o:"")+");"),n&&r._popBuffer()}));var f=this._tmpid();this._emitLine("}, "+this._makeCallback(f)),this._addScopeLevel(),n&&this._emitLine(this.buffer+" += "+f+";"),e.else_&&(this._emitLine("if (!"+a+".length) {"),this.compile(e.else_,t),this._emitLine("}")),this._emitLine("frame = frame.pop();")},o.compileAsyncEach=function(e,t){this._compileAsyncLoop(e,t)},o.compileAsyncAll=function(e,t){this._compileAsyncLoop(e,t,!0)},o._compileMacro=function(e,t){var n=this,r=[],i=null,o="macro_"+this._tmpid(),a=void 0!==t;e.args.children.forEach((function(t,o){o===e.args.children.length-1&&t instanceof s.Dict?i=t:(n.assertType(t,s.Symbol),r.push(t))}));var l,u=[].concat(r.map((function(e){return"l_"+e.value})),["kwargs"]),f=r.map((function(e){return'"'+e.value+'"'})),h=(i&&i.children||[]).map((function(e){return'"'+e.key.value+'"'}));l=a?t.push(!0):new c,this._emitLines("var "+o+" = runtime.makeMacro(","["+f.join(", ")+"], ","["+h.join(", ")+"], ","function ("+u.join(", ")+") {","var callerFrame = frame;","frame = "+(a?"frame.push(true);":"new runtime.Frame();"),"kwargs = kwargs || {};",'if (Object.prototype.hasOwnProperty.call(kwargs, "caller")) {','frame.set("caller", kwargs.caller); }'),r.forEach((function(e){n._emitLine('frame.set("'+e.value+'", l_'+e.value+");"),l.set(e.value,"l_"+e.value)})),i&&i.children.forEach((function(e){var t=e.key.value;n._emit('frame.set("'+t+'", '),n._emit('Object.prototype.hasOwnProperty.call(kwargs, "'+t+'")'),n._emit(' ? kwargs["'+t+'"] : '),n._compileExpression(e.value,l),n._emit(");")}));var p=this._pushBuffer();return this._withScopedSyntax((function(){n.compile(e.body,l)})),this._emitLine("frame = "+(a?"frame.pop();":"callerFrame;")),this._emitLine("return new runtime.SafeString("+p+");"),this._emitLine("});"),this._popBuffer(),o},o.compileMacro=function(e,t){var n=this._compileMacro(e),r=e.name.value;t.set(r,n),t.parent?this._emitLine('frame.set("'+r+'", '+n+");"):("_"!==e.name.value.charAt(0)&&this._emitLine('context.addExport("'+r+'");'),this._emitLine('context.setVariable("'+r+'", '+n+");"))},o.compileCaller=function(e,t){this._emit("(function (){");var n=this._compileMacro(e,t);this._emit("return "+n+";})()")},o._compileGetTemplate=function(e,t,n,r){var i=this._tmpid(),o=this._templateName(),s=this._makeCallback(i),a=n?"true":"false",c=r?"true":"false";return this._emit("env.getTemplate("),this._compileExpression(e.template,t),this._emitLine(", "+a+", "+o+", "+c+", "+s),i},o.compileImport=function(e,t){var n=e.target.value,r=this._compileGetTemplate(e,t,!1,!1);this._addScopeLevel(),this._emitLine(r+".getExported("+(e.withContext?"context.getVariables(), frame, ":"")+this._makeCallback(r)),this._addScopeLevel(),t.set(n,r),t.parent?this._emitLine('frame.set("'+n+'", '+r+");"):this._emitLine('context.setVariable("'+n+'", '+r+");")},o.compileFromImport=function(e,t){var n=this,r=this._compileGetTemplate(e,t,!1,!1);this._addScopeLevel(),this._emitLine(r+".getExported("+(e.withContext?"context.getVariables(), frame, ":"")+this._makeCallback(r)),this._addScopeLevel(),e.names.children.forEach((function(e){var i,o,a=n._tmpid();e instanceof s.Pair?(i=e.key.value,o=e.value.value):o=i=e.value,n._emitLine("if(Object.prototype.hasOwnProperty.call("+r+', "'+i+'")) {'),n._emitLine("var "+a+" = "+r+"."+i+";"),n._emitLine("} else {"),n._emitLine("cb(new Error(\"cannot import '"+i+"'\")); return;"),n._emitLine("}"),t.set(o,a),t.parent?n._emitLine('frame.set("'+o+'", '+a+");"):n._emitLine('context.setVariable("'+o+'", '+a+");")}))},o.compileBlock=function(e){var t=this._tmpid();this.inBlock||this._emit('(parentTemplate ? function(e, c, f, r, cb) { cb(""); } : '),this._emit('context.getBlock("'+e.name.value+'")'),this.inBlock||this._emit(")"),this._emitLine("(env, context, frame, runtime, "+this._makeCallback(t)),this._emitLine(this.buffer+" += "+t+";"),this._addScopeLevel()},o.compileSuper=function(e,t){var n=e.blockName.value,r=e.symbol.value,i=this._makeCallback(r);this._emitLine('context.getSuper(env, "'+n+'", b_'+n+", frame, runtime, "+i),this._emitLine(r+" = runtime.markSafe("+r+");"),this._addScopeLevel(),t.set(r,r)},o.compileExtends=function(e,t){var n=this._tmpid(),r=this._compileGetTemplate(e,t,!0,!1);this._emitLine("parentTemplate = "+r),this._emitLine("for(var "+n+" in parentTemplate.blocks) {"),this._emitLine("context.addBlock("+n+", parentTemplate.blocks["+n+"]);"),this._emitLine("}"),this._addScopeLevel()},o.compileInclude=function(e,t){this._emitLine("var tasks = [];"),this._emitLine("tasks.push("),this._emitLine("function(callback) {");var n=this._compileGetTemplate(e,t,!1,e.ignoreMissing);this._emitLine("callback(null,"+n+");});"),this._emitLine("});");var r=this._tmpid();this._emitLine("tasks.push("),this._emitLine("function(template, callback){"),this._emitLine("template.render(context.getVariables(), frame, "+this._makeCallback(r)),this._emitLine("callback(null,"+r+");});"),this._emitLine("});"),this._emitLine("tasks.push("),this._emitLine("function(result, callback){"),this._emitLine(this.buffer+" += result;"),this._emitLine("callback(null);"),this._emitLine("});"),this._emitLine("env.waterfall(tasks, function(){"),this._addScopeLevel()},o.compileTemplateData=function(e,t){this.compileLiteral(e,t)},o.compileCapture=function(e,t){var n=this,r=this.buffer;this.buffer="output",this._emitLine("(function() {"),this._emitLine('var output = "";'),this._withScopedSyntax((function(){n.compile(e.body,t)})),this._emitLine("return output;"),this._emitLine("})()"),this.buffer=r},o.compileOutput=function(e,t){var n=this;e.children.forEach((function(r){r instanceof s.TemplateData?r.value&&(n._emit(n.buffer+" += "),n.compileLiteral(r,t),n._emitLine(";")):(n._emit(n.buffer+" += runtime.suppressValue("),n.throwOnUndefined&&n._emit("runtime.ensureDefined("),n.compile(r,t),n.throwOnUndefined&&n._emit(","+e.lineno+","+e.colno+")"),n._emit(", env.opts.autoescape);\n"))}))},o.compileRoot=function(e,t){var n=this;t&&this.fail("compileRoot: root node can't have frame"),t=new c,this._emitFuncBegin(e,"root"),this._emitLine("var parentTemplate = null;"),this._compileChildren(e,t),this._emitLine("if(parentTemplate) {"),this._emitLine("parentTemplate.rootRenderFunc(env, context, frame, runtime, cb);"),this._emitLine("} else {"),this._emitLine("cb(null, "+this.buffer+");"),this._emitLine("}"),this._emitFuncEnd(!0),this.inBlock=!0;var r=[],i=e.findAll(s.Block);i.forEach((function(e,t){var i=e.name.value;if(-1!==r.indexOf(i))throw new Error('Block "'+i+'" defined more than once.');r.push(i),n._emitFuncBegin(e,"b_"+i);var o=new c;n._emitLine("var frame = frame.push(true);"),n.compile(e.body,o),n._emitFuncEnd()})),this._emitLine("return {"),i.forEach((function(e,t){var r="b_"+e.name.value;n._emitLine(r+": "+r+",")})),this._emitLine("root: root\n};")},o.compile=function(e,t){var n=this["compile"+e.typename];n?n.call(this,e,t):this.fail("compile: Cannot compile node: "+e.typename,e.lineno,e.colno)},o.getCode=function(){return this.codebuf.join("")},i}(l);e.exports={compile:function(e,t,n,r,s){void 0===s&&(s={});var a=new f(r,s.throwOnUndefined),c=(n||[]).map((function(e){return e.preprocess})).filter((function(e){return!!e})).reduce((function(e,t){return t(e)}),e);return a.compile(o.transform(i.parse(c,n,s),t,r)),a.getCode()},Compiler:f}},function(e,t,n){"use strict";function r(e,t){return r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},r(e,t)}var i=n(4),o=n(1).EmitterObj;e.exports=function(e){var t,n;function o(){return e.apply(this,arguments)||this}n=e,(t=o).prototype=Object.create(n.prototype),t.prototype.constructor=t,r(t,n);var s=o.prototype;return s.resolve=function(e,t){return i.resolve(i.dirname(e),t)},s.isRelative=function(e){return 0===e.indexOf("./")||0===e.indexOf("../")},o}(o)},function(e,t,n){"use strict";function r(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,i(e,t)}function i(e,t){return i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},i(e,t)}var o=n(12),s=n(15),a=n(0),c=n(5),l=n(18),u=n(10),f=u.FileSystemLoader,h=u.WebLoader,p=u.PrecompiledLoader,d=n(20),m=n(21),y=n(1),v=y.Obj,g=y.EmitterObj,b=n(2),_=b.handleError,w=b.Frame,k=n(22);function E(e,t,n){o((function(){e(t,n)}))}var x={type:"code",obj:{root:function(e,t,n,r,i){try{i(null,"")}catch(e){i(_(e,null,null))}}}},O=function(e){function t(){return e.apply(this,arguments)||this}r(t,e);var n=t.prototype;return n.init=function(e,t){var n=this;t=this.opts=t||{},this.opts.dev=!!t.dev,this.opts.autoescape=null==t.autoescape||t.autoescape,this.opts.throwOnUndefined=!!t.throwOnUndefined,this.opts.trimBlocks=!!t.trimBlocks,this.opts.lstripBlocks=!!t.lstripBlocks,this.loaders=[],e?this.loaders=a.isArray(e)?e:[e]:f?this.loaders=[new f("views")]:h&&(this.loaders=[new h("/views")]),"undefined"!=typeof window&&window.nunjucksPrecompiled&&this.loaders.unshift(new p(window.nunjucksPrecompiled)),this._initLoaders(),this.globals=m(),this.filters={},this.tests={},this.asyncFilters=[],this.extensions={},this.extensionsList=[],a._entries(l).forEach((function(e){var t=e[0],r=e[1];return n.addFilter(t,r)})),a._entries(d).forEach((function(e){var t=e[0],r=e[1];return n.addTest(t,r)}))},n._initLoaders=function(){var e=this;this.loaders.forEach((function(t){t.cache={},"function"==typeof t.on&&(t.on("update",(function(n,r){t.cache[n]=null,e.emit("update",n,r,t)})),t.on("load",(function(n,r){e.emit("load",n,r,t)})))}))},n.invalidateCache=function(){this.loaders.forEach((function(e){e.cache={}}))},n.addExtension=function(e,t){return t.__name=e,this.extensions[e]=t,this.extensionsList.push(t),this},n.removeExtension=function(e){var t=this.getExtension(e);t&&(this.extensionsList=a.without(this.extensionsList,t),delete this.extensions[e])},n.getExtension=function(e){return this.extensions[e]},n.hasExtension=function(e){return!!this.extensions[e]},n.addGlobal=function(e,t){return this.globals[e]=t,this},n.getGlobal=function(e){if(void 0===this.globals[e])throw new Error("global not found: "+e);return this.globals[e]},n.addFilter=function(e,t,n){var r=t;return n&&this.asyncFilters.push(e),this.filters[e]=r,this},n.getFilter=function(e){if(!this.filters[e])throw new Error("filter not found: "+e);return this.filters[e]},n.addTest=function(e,t){return this.tests[e]=t,this},n.getTest=function(e){if(!this.tests[e])throw new Error("test not found: "+e);return this.tests[e]},n.resolveTemplate=function(e,t,n){return e.isRelative&&t&&e.isRelative(n)&&e.resolve?e.resolve(t,n):n},n.getTemplate=function(e,t,n,r,i){var o,s=this,c=this,l=null;if(e&&e.raw&&(e=e.raw),a.isFunction(n)&&(i=n,n=null,t=t||!1),a.isFunction(t)&&(i=t,t=!1),e instanceof T)l=e;else{if("string"!=typeof e)throw new Error("template names must be a string: "+e);for(var u=0;u0&&!this.skip(i.TOKEN_COMMA)&&this.fail("parseFrom: expected comma",e.lineno,e.colno);var a=this.parsePrimary();if("_"===a.value.charAt(0)&&this.fail("parseFrom: names starting with an underscore cannot be imported",a.lineno,a.colno),this.skipSymbol("as")){var c=this.parsePrimary();r.addChild(new o.Pair(a.lineno,a.colno,a,c))}else r.addChild(a);n=this.parseWithContext()}return new o.FromImport(e.lineno,e.colno,t,r,n)},c.parseBlock=function(){var e=this.peekToken();this.skipSymbol("block")||this.fail("parseBlock: expected block",e.lineno,e.colno);var t=new o.Block(e.lineno,e.colno);t.name=this.parsePrimary(),t.name instanceof o.Symbol||this.fail("parseBlock: variable name expected",e.lineno,e.colno),this.advanceAfterBlockEnd(e.value),t.body=this.parseUntilBlocks("endblock"),this.skipSymbol("endblock"),this.skipSymbol(t.name.value);var n=this.peekToken();return n||this.fail("parseBlock: expected endblock, got end of file"),this.advanceAfterBlockEnd(n.value),t},c.parseExtends=function(){var e=this.peekToken();this.skipSymbol("extends")||this.fail("parseTemplateRef: expected extends");var t=new o.Extends(e.lineno,e.colno);return t.template=this.parseExpression(),this.advanceAfterBlockEnd(e.value),t},c.parseInclude=function(){var e=this.peekToken();this.skipSymbol("include")||this.fail("parseInclude: expected include");var t=new o.Include(e.lineno,e.colno);return t.template=this.parseExpression(),this.skipSymbol("ignore")&&this.skipSymbol("missing")&&(t.ignoreMissing=!0),this.advanceAfterBlockEnd(e.value),t},c.parseIf=function(){var e,t=this.peekToken();this.skipSymbol("if")||this.skipSymbol("elif")||this.skipSymbol("elseif")?e=new o.If(t.lineno,t.colno):this.skipSymbol("ifAsync")?e=new o.IfAsync(t.lineno,t.colno):this.fail("parseIf: expected if, elif, or elseif",t.lineno,t.colno),e.cond=this.parseExpression(),this.advanceAfterBlockEnd(t.value),e.body=this.parseUntilBlocks("elif","elseif","else","endif");var n=this.peekToken();switch(n&&n.value){case"elseif":case"elif":e.else_=this.parseIf();break;case"else":this.advanceAfterBlockEnd(),e.else_=this.parseUntilBlocks("endif"),this.advanceAfterBlockEnd();break;case"endif":e.else_=null,this.advanceAfterBlockEnd();break;default:this.fail("parseIf: expected elif, else, or endif, got end of file")}return e},c.parseSet=function(){var e=this.peekToken();this.skipSymbol("set")||this.fail("parseSet: expected set",e.lineno,e.colno);for(var t,n=new o.Set(e.lineno,e.colno,[]);(t=this.parsePrimary())&&(n.targets.push(t),this.skip(i.TOKEN_COMMA)););return this.skipValue(i.TOKEN_OPERATOR,"=")?(n.value=this.parseExpression(),this.advanceAfterBlockEnd(e.value)):this.skip(i.TOKEN_BLOCK_END)?(n.body=new o.Capture(e.lineno,e.colno,this.parseUntilBlocks("endset")),n.value=null,this.advanceAfterBlockEnd()):this.fail("parseSet: expected = or block end in set tag",e.lineno,e.colno),n},c.parseSwitch=function(){var e="switch",t="endswitch",n="case",r="default",i=this.peekToken();this.skipSymbol(e)||this.skipSymbol(n)||this.skipSymbol(r)||this.fail('parseSwitch: expected "switch," "case" or "default"',i.lineno,i.colno);var s=this.parseExpression();this.advanceAfterBlockEnd(e),this.parseUntilBlocks(n,r,t);var a,c=this.peekToken(),l=[];do{this.skipSymbol(n);var u=this.parseExpression();this.advanceAfterBlockEnd(e);var f=this.parseUntilBlocks(n,r,t);l.push(new o.Case(c.line,c.col,u,f)),c=this.peekToken()}while(c&&c.value===n);switch(c.value){case r:this.advanceAfterBlockEnd(),a=this.parseUntilBlocks(t),this.advanceAfterBlockEnd();break;case t:this.advanceAfterBlockEnd();break;default:this.fail('parseSwitch: expected "case," "default" or "endswitch," got EOF.')}return new o.Switch(i.lineno,i.colno,s,l,a)},c.parseStatement=function(){var e=this.peekToken();if(e.type!==i.TOKEN_SYMBOL&&this.fail("tag name expected",e.lineno,e.colno),this.breakOnBlocks&&-1!==a.indexOf(this.breakOnBlocks,e.value))return null;switch(e.value){case"raw":return this.parseRaw();case"verbatim":return this.parseRaw("verbatim");case"if":case"ifAsync":return this.parseIf();case"for":case"asyncEach":case"asyncAll":return this.parseFor();case"block":return this.parseBlock();case"extends":return this.parseExtends();case"include":return this.parseInclude();case"set":return this.parseSet();case"macro":return this.parseMacro();case"call":return this.parseCall();case"import":return this.parseImport();case"from":return this.parseFrom();case"filter":return this.parseFilterStatement();case"switch":return this.parseSwitch();default:if(this.extensions.length)for(var t=0;t0;){var c=s[0],l=s[1],u=s[2];u===e?r+=1:u===t&&(r-=1),0===r?(i+=l,this.tokens.backN(c.length-l.length)):i+=c}return new o.Output(a.lineno,a.colno,[new o.TemplateData(a.lineno,a.colno,i)])},c.parsePostfix=function(e){for(var t,n=this.peekToken();n;){if(n.type===i.TOKEN_LEFT_PAREN)e=new o.FunCall(n.lineno,n.colno,e,this.parseSignature());else if(n.type===i.TOKEN_LEFT_BRACKET)(t=this.parseAggregate()).children.length>1&&this.fail("invalid index"),e=new o.LookupVal(n.lineno,n.colno,e,t.children[0]);else{if(n.type!==i.TOKEN_OPERATOR||"."!==n.value)break;this.nextToken();var r=this.nextToken();r.type!==i.TOKEN_SYMBOL&&this.fail("expected name as lookup value, got "+r.value,r.lineno,r.colno),t=new o.Literal(r.lineno,r.colno,r.value),e=new o.LookupVal(n.lineno,n.colno,e,t)}n=this.peekToken()}return e},c.parseExpression=function(){return this.parseInlineIf()},c.parseInlineIf=function(){var e=this.parseOr();if(this.skipSymbol("if")){var t=this.parseOr(),n=e;(e=new o.InlineIf(e.lineno,e.colno)).body=n,e.cond=t,this.skipSymbol("else")?e.else_=this.parseOr():e.else_=null}return e},c.parseOr=function(){for(var e=this.parseAnd();this.skipSymbol("or");){var t=this.parseAnd();e=new o.Or(e.lineno,e.colno,e,t)}return e},c.parseAnd=function(){for(var e=this.parseNot();this.skipSymbol("and");){var t=this.parseNot();e=new o.And(e.lineno,e.colno,e,t)}return e},c.parseNot=function(){var e=this.peekToken();return this.skipSymbol("not")?new o.Not(e.lineno,e.colno,this.parseNot()):this.parseIn()},c.parseIn=function(){for(var e=this.parseIs();;){var t=this.nextToken();if(!t)break;var n=t.type===i.TOKEN_SYMBOL&&"not"===t.value;if(n||this.pushToken(t),!this.skipSymbol("in")){n&&this.pushToken(t);break}var r=this.parseIs();e=new o.In(e.lineno,e.colno,e,r),n&&(e=new o.Not(e.lineno,e.colno,e))}return e},c.parseIs=function(){var e=this.parseCompare();if(this.skipSymbol("is")){var t=this.skipSymbol("not"),n=this.parseCompare();e=new o.Is(e.lineno,e.colno,e,n),t&&(e=new o.Not(e.lineno,e.colno,e))}return e},c.parseCompare=function(){for(var e=["==","===","!=","!==","<",">","<=",">="],t=this.parseConcat(),n=[];;){var r=this.nextToken();if(!r)break;if(-1===e.indexOf(r.value)){this.pushToken(r);break}n.push(new o.CompareOperand(r.lineno,r.colno,this.parseConcat(),r.value))}return n.length?new o.Compare(n[0].lineno,n[0].colno,t,n):t},c.parseConcat=function(){for(var e=this.parseAdd();this.skipValue(i.TOKEN_TILDE,"~");){var t=this.parseAdd();e=new o.Concat(e.lineno,e.colno,e,t)}return e},c.parseAdd=function(){for(var e=this.parseSub();this.skipValue(i.TOKEN_OPERATOR,"+");){var t=this.parseSub();e=new o.Add(e.lineno,e.colno,e,t)}return e},c.parseSub=function(){for(var e=this.parseMul();this.skipValue(i.TOKEN_OPERATOR,"-");){var t=this.parseMul();e=new o.Sub(e.lineno,e.colno,e,t)}return e},c.parseMul=function(){for(var e=this.parseDiv();this.skipValue(i.TOKEN_OPERATOR,"*");){var t=this.parseDiv();e=new o.Mul(e.lineno,e.colno,e,t)}return e},c.parseDiv=function(){for(var e=this.parseFloorDiv();this.skipValue(i.TOKEN_OPERATOR,"/");){var t=this.parseFloorDiv();e=new o.Div(e.lineno,e.colno,e,t)}return e},c.parseFloorDiv=function(){for(var e=this.parseMod();this.skipValue(i.TOKEN_OPERATOR,"//");){var t=this.parseMod();e=new o.FloorDiv(e.lineno,e.colno,e,t)}return e},c.parseMod=function(){for(var e=this.parsePow();this.skipValue(i.TOKEN_OPERATOR,"%");){var t=this.parsePow();e=new o.Mod(e.lineno,e.colno,e,t)}return e},c.parsePow=function(){for(var e=this.parseUnary();this.skipValue(i.TOKEN_OPERATOR,"**");){var t=this.parseUnary();e=new o.Pow(e.lineno,e.colno,e,t)}return e},c.parseUnary=function(e){var t,n=this.peekToken();return t=this.skipValue(i.TOKEN_OPERATOR,"-")?new o.Neg(n.lineno,n.colno,this.parseUnary(!0)):this.skipValue(i.TOKEN_OPERATOR,"+")?new o.Pos(n.lineno,n.colno,this.parseUnary(!0)):this.parsePrimary(),e||(t=this.parseFilter(t)),t},c.parsePrimary=function(e){var t,n=this.nextToken(),r=null;if(n?n.type===i.TOKEN_STRING?t=n.value:n.type===i.TOKEN_INT?t=parseInt(n.value,10):n.type===i.TOKEN_FLOAT?t=parseFloat(n.value):n.type===i.TOKEN_BOOLEAN?"true"===n.value?t=!0:"false"===n.value?t=!1:this.fail("invalid boolean: "+n.value,n.lineno,n.colno):n.type===i.TOKEN_NONE?t=null:n.type===i.TOKEN_REGEX&&(t=new RegExp(n.value.body,n.value.flags)):this.fail("expected expression, got end of file"),void 0!==t?r=new o.Literal(n.lineno,n.colno,t):n.type===i.TOKEN_SYMBOL?r=new o.Symbol(n.lineno,n.colno,n.value):(this.pushToken(n),r=this.parseAggregate()),e||(r=this.parsePostfix(r)),r)return r;throw this.error("unexpected token: "+n.value,n.lineno,n.colno)},c.parseFilterName=function(){for(var e=this.expect(i.TOKEN_SYMBOL),t=e.value;this.skipValue(i.TOKEN_OPERATOR,".");)t+="."+this.expect(i.TOKEN_SYMBOL).value;return new o.Symbol(e.lineno,e.colno,t)},c.parseFilterArgs=function(e){return this.peekToken().type===i.TOKEN_LEFT_PAREN?this.parsePostfix(e).args.children:[]},c.parseFilter=function(e){for(;this.skip(i.TOKEN_PIPE);){var t=this.parseFilterName();e=new o.Filter(t.lineno,t.colno,t,new o.NodeList(t.lineno,t.colno,[e].concat(this.parseFilterArgs(e))))}return e},c.parseFilterStatement=function(){var e=this.peekToken();this.skipSymbol("filter")||this.fail("parseFilterStatement: expected filter");var t=this.parseFilterName(),n=this.parseFilterArgs(t);this.advanceAfterBlockEnd(e.value);var r=new o.Capture(t.lineno,t.colno,this.parseUntilBlocks("endfilter"));this.advanceAfterBlockEnd();var i=new o.Filter(t.lineno,t.colno,t,new o.NodeList(t.lineno,t.colno,[r].concat(n)));return new o.Output(t.lineno,t.colno,[i])},c.parseAggregate=function(){var e,t=this.nextToken();switch(t.type){case i.TOKEN_LEFT_PAREN:e=new o.Group(t.lineno,t.colno);break;case i.TOKEN_LEFT_BRACKET:e=new o.Array(t.lineno,t.colno);break;case i.TOKEN_LEFT_CURLY:e=new o.Dict(t.lineno,t.colno);break;default:return null}for(;;){var n=this.peekToken().type;if(n===i.TOKEN_RIGHT_PAREN||n===i.TOKEN_RIGHT_BRACKET||n===i.TOKEN_RIGHT_CURLY){this.nextToken();break}if(e.children.length>0&&(this.skip(i.TOKEN_COMMA)||this.fail("parseAggregate: expected comma after expression",t.lineno,t.colno)),e instanceof o.Dict){var r=this.parsePrimary();this.skip(i.TOKEN_COLON)||this.fail("parseAggregate: expected colon after dict key",t.lineno,t.colno);var s=this.parseExpression();e.addChild(new o.Pair(r.lineno,r.colno,r,s))}else{var a=this.parseExpression();e.addChild(a)}}return e},c.parseSignature=function(e,t){var n=this.peekToken();if(!t&&n.type!==i.TOKEN_LEFT_PAREN){if(e)return null;this.fail("expected arguments",n.lineno,n.colno)}n.type===i.TOKEN_LEFT_PAREN&&(n=this.nextToken());for(var r=new o.NodeList(n.lineno,n.colno),s=new o.KeywordArgs(n.lineno,n.colno),a=!1;;){if(n=this.peekToken(),!t&&n.type===i.TOKEN_RIGHT_PAREN){this.nextToken();break}if(t&&n.type===i.TOKEN_BLOCK_END)break;if(a&&!this.skip(i.TOKEN_COMMA))this.fail("parseSignature: expected comma after expression",n.lineno,n.colno);else{var c=this.parseExpression();this.skipValue(i.TOKEN_OPERATOR,"=")?s.addChild(new o.Pair(c.lineno,c.colno,c,this.parseExpression())):r.addChild(c)}a=!0}return s.children.length&&r.addChild(s),r},c.parseUntilBlocks=function(){for(var e=this.breakOnBlocks,t=arguments.length,n=new Array(t),r=0;r=","//","**"],M=C+this.current();switch(-1!==r.indexOf(B,M)&&(this.forward(),C=M,-1!==r.indexOf(B,M+this.current())&&(C=M+this.current(),this.forward())),C){case"(":R=d;break;case")":R=m;break;case"[":R=y;break;case"]":R=v;break;case"{":R=g;break;case"}":R=b;break;case",":R=w;break;case":":R=k;break;case"~":R=E;break;case"|":R=x;break;default:R=_}return N(R,C,t,n)}if((e=this._extractUntil(i+o)).match(/^[-+]?[0-9]+$/)){if("."===this.current()){this.forward();var F=this._extract("0123456789");return N(O,e+"."+F,t,n)}return N("int",e,t,n)}if(e.match(/^(true|false)$/))return N(S,e,t,n);if("none"===e)return N(T,e,t,n);if("null"===e)return N(T,e,t,n);if(e)return N(A,e,t,n);throw new Error("Unexpected value while parsing: "+e)}var K,D=this.tags.BLOCK_START.charAt(0)+this.tags.VARIABLE_START.charAt(0)+this.tags.COMMENT_START.charAt(0)+this.tags.COMMENT_END.charAt(0);if(this.isFinished())return null;if((e=this._extractString(this.tags.BLOCK_START+"-"))||(e=this._extractString(this.tags.BLOCK_START)))return this.in_code=!0,N(l,e,t,n);if((e=this._extractString(this.tags.VARIABLE_START+"-"))||(e=this._extractString(this.tags.VARIABLE_START)))return this.in_code=!0,N(f,e,t,n);e="";var $=!1;for(this._matches(this.tags.COMMENT_START)&&($=!0,e=this._extractString(this.tags.COMMENT_START));null!==(K=this._extractUntil(D));){if(e+=K,(this._matches(this.tags.BLOCK_START)||this._matches(this.tags.VARIABLE_START)||this._matches(this.tags.COMMENT_START))&&!$){if(this.lstripBlocks&&this._matches(this.tags.BLOCK_START)&&this.colno>0&&this.colno<=e.length){var U=e.slice(-this.colno);if(/^\s+$/.test(U)&&!(e=e.slice(0,-this.colno)).length)return this.nextToken()}break}if(this._matches(this.tags.COMMENT_END)){if(!$)throw new Error("unexpected end of comment");e+=this._extractString(this.tags.COMMENT_END);break}e+=this.current(),this.forward()}if(null===K&&$)throw new Error("expected end of comment, got end of file");return N($?p:c,e,t,n)},t._parseString=function(e){this.forward();for(var t="";!this.isFinished()&&this.current()!==e;){var n=this.current();if("\\"===n){switch(this.forward(),this.current()){case"n":t+="\n";break;case"t":t+="\t";break;case"r":t+="\r";break;default:t+=this.current()}this.forward()}else t+=n,this.forward()}return this.forward(),t},t._matches=function(e){return this.index+e.length>this.len?null:this.str.slice(this.index,this.index+e.length)===e},t._extractString=function(e){return this._matches(e)?(this.forwardN(e.length),e):null},t._extractUntil=function(e){return this._extractMatching(!0,e||"")},t._extract=function(e){return this._extractMatching(!1,e)},t._extractMatching=function(e,t){if(this.isFinished())return null;var n=t.indexOf(this.current());if(e&&-1===n||!e&&-1!==n){var r=this.current();this.forward();for(var i=t.indexOf(this.current());(e&&-1===i||!e&&-1!==i)&&!this.isFinished();)r+=this.current(),this.forward(),i=t.indexOf(this.current());return r}return""},t._extractRegex=function(e){var t=this.currentStr().match(e);return t?(this.forwardN(t[0].length),t):null},t.isFinished=function(){return this.index>=this.len},t.forwardN=function(e){for(var t=0;t1024){for(var t=0,n=i.length-o;t0&&s.length>i&&!s.warned){s.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=s.length,a=c,console&&console.warn&&console.warn(a)}return e}function h(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=h.bind(r);return i.listener=n,r.wrapFn=i,i}function d(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=new Array(e.length),n=0;n0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var c=i[e];if(void 0===c)return!1;if("function"==typeof c)o(c,this,t);else{var l=c.length,u=y(c,l);for(n=0;n=0;o--)if(n[o]===t||n[o].listener===t){s=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(e,t){for(;t+1=0;r--)this.removeListener(e,t[r]);return this},a.prototype.listeners=function(e){return d(this,e,!0)},a.prototype.rawListeners=function(e){return d(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):m.call(e,t)},a.prototype.listenerCount=m,a.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(e,t,n){"use strict";var r=n(3),i=n(0),o=0;function s(){return"hole_"+o++}function a(e,t){for(var n=null,r=0;r=t)return e;var n=t-e.length,s=r.repeat(" ",n/2-n%2),a=r.repeat(" ",n/2);return i.copySafeness(e,s+e+a)},t.default=function(e,t,n){return n?e||t:void 0!==e?e:t},t.dictsort=function(e,t,n){if(!r.isObject(e))throw new r.TemplateError("dictsort filter: val must be an object");var i,o=[];for(var s in e)o.push([s,e[s]]);if(void 0===n||"key"===n)i=0;else{if("value"!==n)throw new r.TemplateError("dictsort filter: You can only sort by either key or value");i=1}return o.sort((function(e,n){var o=e[i],s=n[i];return t||(r.isString(o)&&(o=o.toUpperCase()),r.isString(s)&&(s=s.toUpperCase())),o>s?1:o===s?0:-1})),o},t.dump=function(e,t){return JSON.stringify(e,null,t)},t.escape=function(e){return e instanceof i.SafeString?e:(e=null==e?"":e,i.markSafe(r.escape(e.toString())))},t.safe=function(e){return e instanceof i.SafeString?e:(e=null==e?"":e,i.markSafe(e.toString()))},t.first=function(e){return e[0]},t.forceescape=function(e){return e=null==e?"":e,i.markSafe(r.escape(e.toString()))},t.groupby=function(e,t){return r.groupBy(e,t,this.env.opts.throwOnUndefined)},t.indent=function(e,t,n){if(""===(e=o(e,"")))return"";t=t||4;var s=e.split("\n"),a=r.repeat(" ",t),c=s.map((function(e,t){return 0!==t||n?""+a+e:e})).join("\n");return i.copySafeness(e,c)},t.join=function(e,t,n){return t=t||"",n&&(e=r.map(e,(function(e){return e[n]}))),e.join(t)},t.last=function(e){return e[e.length-1]},t.length=function(e){var t=o(e,"");return void 0!==t?"function"==typeof Map&&t instanceof Map||"function"==typeof Set&&t instanceof Set?t.size:!r.isObject(t)||t instanceof i.SafeString?t.length:r.keys(t).length:0},t.list=c,t.lower=function(e){return(e=o(e,"")).toLowerCase()},t.nl2br=function(e){return null==e?"":i.copySafeness(e,e.replace(/\r\n|\n/g,"
\n"))},t.random=function(e){return e[Math.floor(Math.random()*e.length)]},t.reject=l(!1),t.rejectattr=function(e,t){return e.filter((function(e){return!e[t]}))},t.select=l(!0),t.selectattr=function(e,t){return e.filter((function(e){return!!e[t]}))},t.replace=function(e,t,n,r){var o=e;if(t instanceof RegExp)return e.replace(t,n);void 0===r&&(r=-1);var s="";if("number"==typeof t)t=""+t;else if("string"!=typeof t)return e;if("number"==typeof e&&(e=""+e),"string"!=typeof e&&!(e instanceof i.SafeString))return e;if(""===t)return s=n+e.split("").join(n)+n,i.copySafeness(e,s);var a=e.indexOf(t);if(0===r||-1===a)return e;for(var c=0,l=0;a>-1&&(-1===r||l=i&&u.push(n),o.push(u)}return o},t.sum=function(e,t,n){return void 0===n&&(n=0),t&&(e=r.map(e,(function(e){return e[t]}))),n+e.reduce((function(e,t){return e+t}),0)},t.sort=i.makeMacro(["value","reverse","case_sensitive","attribute"],[],(function(e,t,n,i){var o=this,s=r.map(e,(function(e){return e})),a=r.getAttrGetter(i);return s.sort((function(e,s){var c=i?a(e):e,l=i?a(s):s;if(o.env.opts.throwOnUndefined&&i&&(void 0===c||void 0===l))throw new TypeError('sort: attribute "'+i+'" resolved to undefined');return!n&&r.isString(c)&&r.isString(l)&&(c=c.toLowerCase(),l=l.toLowerCase()),cl?t?-1:1:0})),s})),t.string=function(e){return i.copySafeness(e,e)},t.striptags=function(e,t){var n,r=u((e=o(e,"")).replace(/<\/?([a-z][a-z0-9]*)\b[^>]*>|/gi,""));return n=t?r.replace(/^ +| +$/gm,"").replace(/ +/g," ").replace(/(\r\n)/g,"\n").replace(/\n\n\n+/g,"\n\n"):r.replace(/\s+/gi," "),i.copySafeness(e,n)},t.title=function(e){var t=(e=o(e,"")).split(" ").map((function(e){return a(e)}));return i.copySafeness(e,t.join(" "))},t.trim=u,t.truncate=function(e,t,n,r){var s=e;if(t=t||255,(e=o(e,"")).length<=t)return e;if(n)e=e.substring(0,t);else{var a=e.lastIndexOf(" ",t);-1===a&&(a=t),e=e.substring(0,a)}return e+=null!=r?r:"...",i.copySafeness(s,e)},t.upper=function(e){return(e=o(e,"")).toUpperCase()},t.urlencode=function(e){var t=encodeURIComponent;return r.isString(e)?t(e):(r.isArray(e)?e:r._entries(e)).map((function(e){var n=e[0],r=e[1];return t(n)+"="+t(r)})).join("&")};var f=/^(?:\(|<|<)?(.*?)(?:\.|,|\)|\n|>)?$/,h=/^[\w.!#$%&'*+\-\/=?\^`{|}~]+@[a-z\d\-]+(\.[a-z\d\-]+)+$/i,p=/^https?:\/\/.*$/,d=/^www\./,m=/\.(?:org|net|com)(?:\:|\/|$)/;t.urlize=function(e,t,n){s(t)&&(t=1/0);var r=!0===n?' rel="nofollow"':"";return e.split(/(\s+)/).filter((function(e){return e&&e.length})).map((function(e){var n=e.match(f),i=n?n[1]:e,o=i.substr(0,t);return p.test(i)?'"+o+"":d.test(i)?'"+o+"":h.test(i)?''+i+"":m.test(i)?'"+o+"":e})).join("")},t.wordcount=function(e){var t=(e=o(e,""))?e.match(/\w+/g):null;return t?t.length:null},t.float=function(e,t){var n=parseFloat(e);return s(n)?t:n};var y=i.makeMacro(["value","default","base"],[],(function(e,t,n){void 0===n&&(n=10);var r=parseInt(e,n);return s(r)?t:r}));t.int=y,t.d=t.default,t.e=t.escape},function(e,t,n){"use strict";function r(e,t){return r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},r(e,t)}var i=function(e){var t,n;function i(t){var n;return(n=e.call(this)||this).precompiled=t||{},n}return n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,r(t,n),i.prototype.getSource=function(e){return this.precompiled[e]?{src:{type:"code",obj:this.precompiled[e]},path:e}:null},i}(n(6));e.exports={PrecompiledLoader:i}},function(e,t,n){"use strict";var r=n(2).SafeString;t.callable=function(e){return"function"==typeof e},t.defined=function(e){return void 0!==e},t.divisibleby=function(e,t){return e%t==0},t.escaped=function(e){return e instanceof r},t.equalto=function(e,t){return e===t},t.eq=t.equalto,t.sameas=t.equalto,t.even=function(e){return e%2==0},t.falsy=function(e){return!e},t.ge=function(e,t){return e>=t},t.greaterthan=function(e,t){return e>t},t.gt=t.greaterthan,t.le=function(e,t){return e<=t},t.lessthan=function(e,t){return e0)for(var i=e;it;o+=n)r.push(o);return r},cycler:function(){return function(e){var t=-1;return{current:null,reset:function(){t=-1,this.current=null},next:function(){return++t>=e.length&&(t=0),this.current=e[t],this.current}}}(Array.prototype.slice.call(arguments))},joiner:function(e){return function(e){e=e||",";var t=!0;return function(){var n=t?"":e;return t=!1,n}}(e)}}}},function(e,t,n){var r=n(4);e.exports=function(e,t){function n(e,t){if(this.name=e,this.path=e,this.defaultEngine=t.defaultEngine,this.ext=r.extname(e),!this.ext&&!this.defaultEngine)throw new Error("No default engine was specified and no extension was provided.");this.ext||(this.name+=this.ext=("."!==this.defaultEngine[0]?".":"")+this.defaultEngine)}return n.prototype.render=function(t,n){e.render(this.name,t,n)},t.set("view",n),t.set("nunjucksEnv",e),e}},function(e,t,n){"use strict";var r=n(4),i=n(4),o=n(0)._prettifyError,s=n(5),a=n(7).Environment,c=n(24);function l(e,t){return!!Array.isArray(t)&&t.some((function(t){return e.match(t)}))}function u(e,t){(t=t||{}).isString=!0;var n=t.env||new a([]),r=t.wrapper||c;if(!t.name)throw new Error('the "name" option is required when compiling a string');return r([f(e,t.name,n)],t)}function f(e,t,n){var r,i=(n=n||new a([])).asyncFilters,c=n.extensionsList;t=t.replace(/\\/g,"/");try{r=s.compile(e,i,c,t,n.opts)}catch(e){throw o(t,!1,e)}return{name:t,template:r}}e.exports={precompile:function(e,t){var n=(t=t||{}).env||new a([]),o=t.wrapper||c;if(t.isString)return u(e,t);var s=r.existsSync(e)&&r.statSync(e),h=[],p=[];if(s.isFile())h.push(f(r.readFileSync(e,"utf-8"),t.name||e,n));else if(s.isDirectory()){!function n(o){r.readdirSync(o).forEach((function(s){var a=i.join(o,s),c=a.substr(i.join(e,"/").length),u=r.statSync(a);u&&u.isDirectory()?l(c+="/",t.exclude)||n(a):l(c,t.include)&&p.push(a)}))}(e);for(var d=0;de.length||i>0&&s>=r||i<0&&s<=r);s+=i)o.push(n.memberLookup(e,s));return o}function p(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var d={pop:function(e){if(void 0===e)return this.pop();if(e>=this.length||e<0)throw new Error("KeyError");return this.splice(e,1)},append:function(e){return this.push(e)},remove:function(e){for(var t=0;t{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};(()=>{"use strict";r.r(i),r.d(i,{Component:()=>l,ComponentAttribute:()=>t,ComponentAttributeDefinition:()=>m,ComponentDefinition:()=>f,ComponentDrawOption:()=>y,ComponentLink:()=>_,ComponentLinkDefinition:()=>k,DefaultData:()=>_i,DefaultDrawer:()=>ai,DefaultMetadata:()=>ci,DefaultParser:()=>ui,DefaultPlugin:()=>ki,DefaultRender:()=>fi,FileInformation:()=>n,FileInput:()=>S,ParseError:()=>gi});var e=function(e,t,n){return Object.defineProperty(e,"prototype",{writable:!1}),e}((function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{name:null,value:null,type:null,definition:null};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);var n=t.name,r=t.value,i=t.type,o=t.definition;this.name=n||null,this.value=r||null,this.type=i||null,this.definition=o||null}));const t=e,n=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{path:null};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);var n=t.path;this.path=n||null}var t,n;return t=e,(n=[{key:"fileName",get:function(){return this.path?this.path.replace(/^.*[\\/]/,""):null}}])&&function(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{id:null,name:null,definition:null,drawOption:null,attributes:[]};(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,u),e=l.call(this,t);var n=t.id,r=t.name,i=t.definition,o=t.drawOption,s=t.attributes;return e.__class="Component",e.id=n||null,e.name=r||null,e.definition=i||null,e.drawOption=o||null,e.attributes=s||[],e}return n=u,r=[{key:"setReferenceAttribute",value:function(e){var n=this.definition.definedAttributes.find((function(t){return t.containerRef.includes(e.definition.type)}));if(n){var r=this.attributes.filter((function(e){return e.definition.name===n.name}));r.length>0?r.forEach((function(t){t.value=e.id})):this.attributes.push(new t({name:n.name,value:e.id,type:"String",definition:n}))}}},{key:"removeAllReferenceAttributes",value:function(e){this.attributes=e?this.attributes.filter((function(t){var n=t.definition,r=t.value;return!("Reference"===n.type&&n.containerRef===e.definition.type&&r===e.id)})):this.attributes.filter((function(e){return"Reference"!==e.definition.type}))}},{key:"setLinkAttribute",value:function(e){var n=this.definition.definedAttributes.find((function(t){return t.name===e.definition.attributeRef})),r=this.attributes.find((function(e){var t=e.definition;return"Link"===t.type&&n.name===t.name}));r&&!r.value.includes(e.target)?r.value.push(e.target):r||this.attributes.push(new t({name:n.name,definition:n,type:"Array",value:[e.target]}))}},{key:"removeLinkAttribute",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.attributes=this.attributes.filter((function(n){if(t&&n.name!==t)return!0;if(n.definition&&"Link"===n.definition.type){var r=n.value.findIndex((function(t){return t===e}));return r>=0&&n.value.splice(r,1),0!==n.value.length}return!0}))}},{key:"getAttributeByName",value:function(e){return this.__getAttributeByName(this.attributes,e)}},{key:"__getAttributeByName",value:function(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{type:null,icon:null,model:null,parentTypes:[],childrenTypes:[],definedAttributes:[],isContainer:!1};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);var n=t.type,r=t.icon,i=t.model,o=t.parentTypes,s=t.childrenTypes,a=t.definedAttributes,c=t.isContainer;this.type=n||null,this.icon=r||null,this.model=i||null,this.parentTypes=o||[],this.childrenTypes=s||[],this.definedAttributes=a||[],this.isContainer=void 0!==c&&c}));const f=u;function h(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function p(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var d=function(e,t,n){return Object.defineProperty(e,"prototype",{writable:!1}),e}((function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{name:null,type:null,linkType:null,linkRef:[],linkColor:"black",linkWidth:2,linkDashStyle:null,containerRef:[],required:!1,definedAttributes:[],rules:{values:null,min:null,max:null,regex:null}};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);var n=t.name,r=t.type,i=t.linkType,o=t.linkRef,s=t.linkColor,a=t.linkWidth,c=t.linkDashStyle,l=t.containerRef,u=t.definedAttributes,f=t.required,d=t.rules;this.name=n||null,this.type=r||null,this.linkType=i||null,this.linkRef=o||[],this.linkColor=s||"black",this.linkWidth=a||2,this.linkDashStyle=c||null,this.containerRef=l||[],this.definedAttributes=u||[],this.required=f||!1,this.rules=function(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:{x:null,y:null,width:null,height:null,needsResizing:!1};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);var n=t.x,r=t.y,i=t.width,o=t.height,s=t.needsResizing;this.x=n||null,this.y=r||null,this.width=i||null,this.height=o||null,this.needsResizing=s||!1}));function v(e){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},v(e)}function g(e,t){return g=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},g(e,t)}function b(e){return b=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},b(e)}const _=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&g(e,t)}(o,e);var t,n,r,i=(n=o,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=b(n);if(r){var i=b(this).constructor;e=Reflect.construct(t,arguments,i)}else e=t.apply(this,arguments);return function(e,t){if(t&&("object"===v(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,e)});function o(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{source:null,target:null,definition:null};(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,o),e=i.call(this);var n=t.source,r=t.target,s=t.definition;return e.__class="Link",e.source=n||null,e.target=r||null,e.definition=s||null,e}return t=o,Object.defineProperty(t,"prototype",{writable:!1}),t}(n);var w=function(e,t,n){return Object.defineProperty(e,"prototype",{writable:!1}),e}((function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{attributeRef:null,sourceRef:null,targetRef:null,type:null,color:"black",width:2,dashStyle:null};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);var n=t.attributeRef,r=t.sourceRef,i=t.targetRef,o=t.type,s=t.color,a=t.width,c=t.dashStyle;this.attributeRef=n||null,this.sourceRef=r||null,this.targetRef=i||null,this.type=o||null,this.color=s||"black",this.width=a||2,this.dashStyle=c||null}));const k=w;function E(e){return E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},E(e)}function x(e,t){return x=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},x(e,t)}function O(e){return O=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},O(e)}const S=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&x(e,t)}(o,e);var t,n,r,i=(n=o,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=O(n);if(r){var i=O(this).constructor;e=Reflect.construct(t,arguments,i)}else e=t.apply(this,arguments);return function(e,t){if(t&&("object"===E(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,e)});function o(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{path:null,name:null,content:null};(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,o),e=i.call(this,t);var n=t.content;return e.content=n||null,e}return t=o,Object.defineProperty(t,"prototype",{writable:!1}),t}(n);class T extends Map{constructor(e,t=j){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),null!=e)for(const[t,n]of e)this.set(t,n)}get(e){return super.get(L(this,e))}has(e){return super.has(L(this,e))}set(e,t){return super.set(N(this,e),t)}delete(e){return super.delete(C(this,e))}}class A extends Set{constructor(e,t=j){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),null!=e)for(const t of e)this.add(t)}has(e){return super.has(L(this,e))}add(e){return super.add(N(this,e))}delete(e){return super.delete(C(this,e))}}function L({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):n}function N({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function C({_intern:e,_key:t},n){const r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function j(e){return null!==e&&"object"==typeof e?e.valueOf():e}function P(e){return e}function I(){}function R(e){return null==e?I:function(){return this.querySelector(e)}}function B(e){return null==e?[]:Array.isArray(e)?e:Array.from(e)}function M(){return[]}function F(e){return null==e?M:function(){return this.querySelectorAll(e)}}function K(e){return function(){return this.matches(e)}}function D(e){return function(t){return t.matches(e)}}var $=Array.prototype.find;function U(){return this.firstElementChild}var V=Array.prototype.filter;function q(){return Array.from(this.children)}function z(e){return new Array(e.length)}function G(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}function W(e,t,n,r,i,o){for(var s,a=0,c=t.length,l=o.length;at?1:e>=t?0:NaN}G.prototype={constructor:G,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};var Q="http://www.w3.org/1999/xhtml";const Z={svg:"http://www.w3.org/2000/svg",xhtml:Q,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function ee(e){var t=e+="",n=t.indexOf(":");return n>=0&&"xmlns"!==(t=e.slice(0,n))&&(e=e.slice(n+1)),Z.hasOwnProperty(t)?{space:Z[t],local:e}:e}function te(e){return function(){this.removeAttribute(e)}}function ne(e){return function(){this.removeAttributeNS(e.space,e.local)}}function re(e,t){return function(){this.setAttribute(e,t)}}function ie(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function oe(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttribute(e):this.setAttribute(e,n)}}function se(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function ae(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function ce(e){return function(){this.style.removeProperty(e)}}function le(e,t,n){return function(){this.style.setProperty(e,t,n)}}function ue(e,t,n){return function(){var r=t.apply(this,arguments);null==r?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function fe(e,t){return e.style.getPropertyValue(t)||ae(e).getComputedStyle(e,null).getPropertyValue(t)}function he(e){return function(){delete this[e]}}function pe(e,t){return function(){this[e]=t}}function de(e,t){return function(){var n=t.apply(this,arguments);null==n?delete this[e]:this[e]=n}}function me(e){return e.trim().split(/^|\s+/)}function ye(e){return e.classList||new ve(e)}function ve(e){this._node=e,this._names=me(e.getAttribute("class")||"")}function ge(e,t){for(var n=ye(e),r=-1,i=t.length;++r=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};var Ve=[null];function qe(e,t){this._groups=e,this._parents=t}function ze(){return new qe([[document.documentElement]],Ve)}qe.prototype=ze.prototype={constructor:qe,select:function(e){"function"!=typeof e&&(e=R(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i=_&&(_=b+1);!(g=y[_])&&++_=0;)(r=i[o])&&(s&&4^r.compareDocumentPosition(s)&&s.parentNode.insertBefore(r,s),s=r);return this},sort:function(e){function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}e||(e=X);for(var n=this._groups,r=n.length,i=new Array(r),o=0;o1?this.each((null==t?ce:"function"==typeof t?ue:le)(e,t,null==n?"":n)):fe(this.node(),e)},property:function(e,t){return arguments.length>1?this.each((null==t?he:"function"==typeof t?de:pe)(e,t)):this.node()[e]},classed:function(e,t){var n=me(e+"");if(arguments.length<2){for(var r=ye(this.node()),i=-1,o=n.length;++i=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}}))}(e+""),s=o.length;if(!(arguments.length<2)){for(a=t?Ke:Fe,r=0;r{}};function Ye(){for(var e,t=0,n=arguments.length,r={};t=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:n}}))}(e+"",r),o=-1,s=i.length;if(!(arguments.length<2)){if(null!=t&&"function"!=typeof t)throw new Error("invalid callback: "+t);for(;++o0)for(var n,r,i=new Array(n),o=0;o=0&&t._call.call(void 0,e),t=t._next;--tt}()}finally{tt=0,function(){for(var e,t,n=Ze,r=1/0;n;)n._call?(r>n._time&&(r=n._time),e=n,n=n._next):(t=n._next,n._next=null,n=e?e._next=t:Ze=t);et=e,mt(r)}(),ot=0}}function dt(){var e=at.now(),t=e-it;t>1e3&&(st-=t,it=e)}function mt(e){tt||(nt&&(nt=clearTimeout(nt)),e-ot>24?(e<1/0&&(nt=setTimeout(pt,e-at.now()-st)),rt&&(rt=clearInterval(rt))):(rt||(it=at.now(),rt=setInterval(dt,1e3)),tt=1,ct(pt)))}function yt(e,t,n){var r=new ft;return t=null==t?0:+t,r.restart((n=>{r.stop(),e(n+t)}),t,n),r}ft.prototype=ht.prototype={constructor:ft,restart:function(e,t,n){if("function"!=typeof e)throw new TypeError("callback is not a function");n=(null==n?lt():+n)+(null==t?0:+t),this._next||et===this||(et?et._next=this:Ze=this,et=this),this._call=e,this._time=n,mt()},stop:function(){this._call&&(this._call=null,this._time=1/0,mt())}};var vt=Qe("start","end","cancel","interrupt"),gt=[];function bt(e,t,n,r,i,o){var s=e.__transition;if(s){if(n in s)return}else e.__transition={};!function(e,t,n){var r,i=e.__transition;function o(c){var l,u,f,h;if(1!==n.state)return a();for(l in i)if((h=i[l]).name===n.name){if(3===h.state)return yt(o);4===h.state?(h.state=6,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete i[l]):+l0)throw new Error("too late; already scheduled");return n}function wt(e,t){var n=kt(e,t);if(n.state>3)throw new Error("too late; already running");return n}function kt(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Et(e,t){var n,r,i,o=e.__transition,s=!0;if(o){for(i in t=null==t?null:t+"",o)(n=o[i]).name===t?(r=n.state>2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(r?"interrupt":"cancel",e,e.__data__,n.index,n.group),delete o[i]):s=!1;s&&delete e.__transition}}function xt(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var Ot,St=180/Math.PI,Tt={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function At(e,t,n,r,i,o){var s,a,c;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(a=Math.sqrt(n*n+r*r))&&(n/=a,r/=a,c/=a),e*r180?t+=360:t-e>180&&(e+=360),o.push({i:n.push(i(n)+"rotate(",null,r)-2,x:xt(e,t)})):t&&n.push(i(n)+"rotate("+t+r)}(o.rotate,s.rotate,a,c),function(e,t,n,o){e!==t?o.push({i:n.push(i(n)+"skewX(",null,r)-2,x:xt(e,t)}):t&&n.push(i(n)+"skewX("+t+r)}(o.skewX,s.skewX,a,c),function(e,t,n,r,o,s){if(e!==n||t!==r){var a=o.push(i(o)+"scale(",null,",",null,")");s.push({i:a-4,x:xt(e,n)},{i:a-2,x:xt(t,r)})}else 1===n&&1===r||o.push(i(o)+"scale("+n+","+r+")")}(o.scaleX,o.scaleY,s.scaleX,s.scaleY,a,c),o=s=null,function(e){for(var t,n=-1,r=c.length;++n>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?tn(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?tn(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=qt.exec(e))?new rn(t[1],t[2],t[3],1):(t=zt.exec(e))?new rn(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=Gt.exec(e))?tn(t[1],t[2],t[3],t[4]):(t=Wt.exec(e))?tn(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=Yt.exec(e))?un(t[1],t[2]/100,t[3]/100,1):(t=Jt.exec(e))?un(t[1],t[2]/100,t[3]/100,t[4]):Ht.hasOwnProperty(e)?en(Ht[e]):"transparent"===e?new rn(NaN,NaN,NaN,0):null}function en(e){return new rn(e>>16&255,e>>8&255,255&e,1)}function tn(e,t,n,r){return r<=0&&(e=t=n=NaN),new rn(e,t,n,r)}function nn(e,t,n,r){return 1===arguments.length?function(e){return e instanceof Mt||(e=Zt(e)),e?new rn((e=e.rgb()).r,e.g,e.b,e.opacity):new rn}(e):new rn(e,t,n,null==r?1:r)}function rn(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function on(){return`#${ln(this.r)}${ln(this.g)}${ln(this.b)}`}function sn(){const e=an(this.opacity);return`${1===e?"rgb(":"rgba("}${cn(this.r)}, ${cn(this.g)}, ${cn(this.b)}${1===e?")":`, ${e})`}`}function an(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function cn(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ln(e){return((e=cn(e))<16?"0":"")+e.toString(16)}function un(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new hn(e,t,n,r)}function fn(e){if(e instanceof hn)return new hn(e.h,e.s,e.l,e.opacity);if(e instanceof Mt||(e=Zt(e)),!e)return new hn;if(e instanceof hn)return e;var t=(e=e.rgb()).r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),o=Math.max(t,n,r),s=NaN,a=o-i,c=(o+i)/2;return a?(s=t===o?(n-r)/a+6*(n0&&c<1?0:s,new hn(s,a,c,e.opacity)}function hn(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function pn(e){return(e=(e||0)%360)<0?e+360:e}function dn(e){return Math.max(0,Math.min(1,e||0))}function mn(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}function yn(e,t,n,r,i){var o=e*e,s=o*e;return((1-3*e+3*o-s)*t+(4-6*o+3*s)*n+(1+3*e+3*o-3*s)*r+s*i)/6}Rt(Mt,Zt,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Xt,formatHex:Xt,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return fn(this).formatHsl()},formatRgb:Qt,toString:Qt}),Rt(rn,nn,Bt(Mt,{brighter(e){return e=null==e?Kt:Math.pow(Kt,e),new rn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?Ft:Math.pow(Ft,e),new rn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new rn(cn(this.r),cn(this.g),cn(this.b),an(this.opacity))},displayable(){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:on,formatHex:on,formatHex8:function(){return`#${ln(this.r)}${ln(this.g)}${ln(this.b)}${ln(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:sn,toString:sn})),Rt(hn,(function(e,t,n,r){return 1===arguments.length?fn(e):new hn(e,t,n,null==r?1:r)}),Bt(Mt,{brighter(e){return e=null==e?Kt:Math.pow(Kt,e),new hn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?Ft:Math.pow(Ft,e),new hn(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new rn(mn(e>=240?e-240:e+120,i,r),mn(e,i,r),mn(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new hn(pn(this.h),dn(this.s),dn(this.l),an(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=an(this.opacity);return`${1===e?"hsl(":"hsla("}${pn(this.h)}, ${100*dn(this.s)}%, ${100*dn(this.l)}%${1===e?")":`, ${e})`}`}}));const vn=e=>()=>e;function gn(e,t){var n=t-e;return n?function(e,t){return function(n){return e+n*t}}(e,n):vn(isNaN(e)?t:e)}const bn=function e(t){var n=function(e){return 1==(e=+e)?gn:function(t,n){return n-t?function(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}(t,n,e):vn(isNaN(t)?n:t)}}(t);function r(e,t){var r=n((e=nn(e)).r,(t=nn(t)).r),i=n(e.g,t.g),o=n(e.b,t.b),s=gn(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=o(t),e.opacity=s(t),e+""}}return r.gamma=e,r}(1);function _n(e){return function(t){var n,r,i=t.length,o=new Array(i),s=new Array(i),a=new Array(i);for(n=0;n=1?(n=1,t-1):Math.floor(n*t),i=e[r],o=e[r+1],s=r>0?e[r-1]:2*i-o,a=ro&&(i=t.slice(o,i),a[s]?a[s]+=i:a[++s]=i),(n=n[0])===(r=r[0])?a[s]?a[s]+=r:a[++s]=r:(a[++s]=null,c.push({i:s,x:xt(n,r)})),o=kn.lastIndex;return o=0&&(e=e.slice(0,t)),!e||"start"===e}))}(t)?_t:wt;return function(){var s=o(this,e),a=s.on;a!==r&&(i=(r=a).copy()).on(t,n),s.on=i}}(n,e,t))},attr:function(e,t){var n=ee(e),r="transform"===n?Ct:xn;return this.attrTween(e,"function"==typeof t?(n.local?Nn:Ln)(n,r,It(this,"attr."+e,t)):null==t?(n.local?Sn:On)(n):(n.local?An:Tn)(n,r,t))},attrTween:function(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==t)return this.tween(n,null);if("function"!=typeof t)throw new Error;var r=ee(e);return this.tween(n,(r.local?Cn:jn)(r,t))},style:function(e,t,n){var r="transform"==(e+="")?Nt:xn;return null==t?this.styleTween(e,function(e,t){var n,r,i;return function(){var o=fe(this,e),s=(this.style.removeProperty(e),fe(this,e));return o===s?null:o===n&&s===r?i:i=t(n=o,r=s)}}(e,r)).on("end.style."+e,Fn(e)):"function"==typeof t?this.styleTween(e,function(e,t,n){var r,i,o;return function(){var s=fe(this,e),a=n(this),c=a+"";return null==a&&(this.style.removeProperty(e),c=a=fe(this,e)),s===c?null:s===r&&c===i?o:(i=c,o=t(r=s,a))}}(e,r,It(this,"style."+e,t))).each(function(e,t){var n,r,i,o,s="style."+t,a="end."+s;return function(){var c=wt(this,e),l=c.on,u=null==c.value[s]?o||(o=Fn(t)):void 0;l===n&&i===u||(r=(n=l).copy()).on(a,i=u),c.on=r}}(this._id,e)):this.styleTween(e,function(e,t,n){var r,i,o=n+"";return function(){var s=fe(this,e);return s===o?null:s===r?i:i=t(r=s,n)}}(e,r,t),n).on("end.style."+e,null)},styleTween:function(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==t)return this.tween(r,null);if("function"!=typeof t)throw new Error;return this.tween(r,function(e,t,n){var r,i;function o(){var o=t.apply(this,arguments);return o!==i&&(r=(i=o)&&function(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}(e,o,n)),r}return o._value=t,o}(e,t,null==n?"":n))},text:function(e){return this.tween("text","function"==typeof e?function(e){return function(){var t=e(this);this.textContent=null==t?"":t}}(It(this,"text",e)):function(e){return function(){this.textContent=e}}(null==e?"":e+""))},textTween:function(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(null==e)return this.tween(t,null);if("function"!=typeof e)throw new Error;return this.tween(t,function(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&function(e){return function(t){this.textContent=e.call(this,t)}}(r)),t}return r._value=e,r}(e))},remove:function(){return this.on("end.remove",function(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}(this._id))},tween:function(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r,i=kt(this.node(),n).tween,o=0,s=i.length;o()=>e;function ir(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:o,x:s,y:a,dx:c,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}function or(e){return!e.ctrlKey&&!e.button}function sr(){return this.parentNode}function ar(e,t){return null==t?{x:e.x,y:e.y}:t}function cr(){return navigator.maxTouchPoints||"ontouchstart"in this}function lr(e){var t=0,n=e.children,r=n&&n.length;if(r)for(;--r>=0;)t+=n[r].value;else t=1;e.value=t}function ur(e,t){e instanceof Map?(e=[void 0,e],void 0===t&&(t=hr)):void 0===t&&(t=fr);for(var n,r,i,o,s,a=new mr(e),c=[a];n=c.pop();)if((i=t(n.data))&&(s=(i=Array.from(i)).length))for(n.children=i,o=s-1;o>=0;--o)c.push(r=i[o]=new mr(i[o])),r.parent=n,r.depth=n.depth+1;return a.eachBefore(dr)}function fr(e){return e.children}function hr(e){return Array.isArray(e)?e[1]:null}function pr(e){void 0!==e.data.value&&(e.value=e.data.value),e.data=e.data.data}function dr(e){var t=0;do{e.height=t}while((e=e.parent)&&e.height<++t)}function mr(e){this.data=e,this.depth=this.height=0,this.parent=null}function yr(e){e.x0=Math.round(e.x0),e.y0=Math.round(e.y0),e.x1=Math.round(e.x1),e.y1=Math.round(e.y1)}function vr(e,t,n,r,i){for(var o,s=e.children,a=-1,c=s.length,l=e.value&&(r-t)/e.value;++a=0;--r)o.push(n[r]);return this},find:function(e,t){let n=-1;for(const r of this)if(e.call(t,r,++n,this))return r},sum:function(e){return this.eachAfter((function(t){for(var n=+e(t.data)||0,r=t.children,i=r&&r.length;--i>=0;)n+=r[i].value;t.value=n}))},sort:function(e){return this.eachBefore((function(t){t.children&&t.children.sort(e)}))},path:function(e){for(var t=this,n=function(e,t){if(e===t)return e;var n=e.ancestors(),r=t.ancestors(),i=null;for(e=n.pop(),t=r.pop();e===t;)i=e,e=n.pop(),t=r.pop();return i}(t,e),r=[t];t!==n;)t=t.parent,r.push(t);for(var i=r.length;e!==n;)r.splice(i,0,e),e=e.parent;return r},ancestors:function(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t},descendants:function(){return Array.from(this)},leaves:function(){var e=[];return this.eachBefore((function(t){t.children||e.push(t)})),e},links:function(){var e=this,t=[];return e.each((function(n){n!==e&&t.push({source:n.parent,target:n})})),t},copy:function(){return ur(this).eachBefore(pr)},[Symbol.iterator]:function*(){var e,t,n,r,i=this,o=[i];do{for(e=o.reverse(),o=[];i=e.pop();)if(yield i,t=i.children)for(n=0,r=t.length;nh&&(h=a),y=u*u*m,(p=Math.max(h/y,y/f))>d){u-=a;break}d=p}v.push(s={value:u,dice:c1?t:1)},n}((1+Math.sqrt(5))/2);function _r(){return 0}function wr(e){return function(){return e}}function kr(e){return"string"==typeof e?new qe([document.querySelectorAll(e)],[document.documentElement]):new qe([B(e)],Ve)}const Er=Math.PI,xr=2*Er,Or=1e-6,Sr=xr-Or;function Tr(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function Ar(){return new Tr}Tr.prototype=Ar.prototype={constructor:Tr,moveTo:function(e,t){this._+="M"+(this._x0=this._x1=+e)+","+(this._y0=this._y1=+t)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(e,t){this._+="L"+(this._x1=+e)+","+(this._y1=+t)},quadraticCurveTo:function(e,t,n,r){this._+="Q"+ +e+","+ +t+","+(this._x1=+n)+","+(this._y1=+r)},bezierCurveTo:function(e,t,n,r,i,o){this._+="C"+ +e+","+ +t+","+ +n+","+ +r+","+(this._x1=+i)+","+(this._y1=+o)},arcTo:function(e,t,n,r,i){e=+e,t=+t,n=+n,r=+r,i=+i;var o=this._x1,s=this._y1,a=n-e,c=r-t,l=o-e,u=s-t,f=l*l+u*u;if(i<0)throw new Error("negative radius: "+i);if(null===this._x1)this._+="M"+(this._x1=e)+","+(this._y1=t);else if(f>Or)if(Math.abs(u*a-c*l)>Or&&i){var h=n-o,p=r-s,d=a*a+c*c,m=h*h+p*p,y=Math.sqrt(d),v=Math.sqrt(f),g=i*Math.tan((Er-Math.acos((d+f-m)/(2*y*v)))/2),b=g/v,_=g/y;Math.abs(b-1)>Or&&(this._+="L"+(e+b*l)+","+(t+b*u)),this._+="A"+i+","+i+",0,0,"+ +(u*h>l*p)+","+(this._x1=e+_*a)+","+(this._y1=t+_*c)}else this._+="L"+(this._x1=e)+","+(this._y1=t)},arc:function(e,t,n,r,i,o){e=+e,t=+t,o=!!o;var s=(n=+n)*Math.cos(r),a=n*Math.sin(r),c=e+s,l=t+a,u=1^o,f=o?r-i:i-r;if(n<0)throw new Error("negative radius: "+n);null===this._x1?this._+="M"+c+","+l:(Math.abs(this._x1-c)>Or||Math.abs(this._y1-l)>Or)&&(this._+="L"+c+","+l),n&&(f<0&&(f=f%xr+xr),f>Sr?this._+="A"+n+","+n+",0,1,"+u+","+(e-s)+","+(t-a)+"A"+n+","+n+",0,1,"+u+","+(this._x1=c)+","+(this._y1=l):f>Or&&(this._+="A"+n+","+n+",0,"+ +(f>=Er)+","+u+","+(this._x1=e+n*Math.cos(i))+","+(this._y1=t+n*Math.sin(i))))},rect:function(e,t,n,r){this._+="M"+(this._x0=this._x1=+e)+","+(this._y0=this._y1=+t)+"h"+ +n+"v"+ +r+"h"+-n+"Z"},toString:function(){return this._}};const Lr=Ar;var Nr=Array.prototype.slice;function Cr(e){return function(){return e}}function jr(e){return e[0]}function Pr(e){return e[1]}function Ir(e){return e.source}function Rr(e){return e.target}class Br{constructor(e,t){this._context=e,this._x=t}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line}point(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,t,e,t):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+t)/2,e,this._y0,e,t)}this._x0=e,this._y0=t}}function Mr(e){return new Br(e,!0)}function Fr(e){return new Br(e,!1)}function Kr(e){return((e=Math.exp(e))+1/e)/2}const Dr=function e(t,n,r){function i(e,i){var o,s,a=e[0],c=e[1],l=e[2],u=i[0],f=i[1],h=i[2],p=u-a,d=f-c,m=p*p+d*d;if(m<1e-12)s=Math.log(h/l)/t,o=function(e){return[a+e*p,c+e*d,l*Math.exp(t*e*s)]};else{var y=Math.sqrt(m),v=(h*h-l*l+r*m)/(2*l*n*y),g=(h*h-l*l-r*m)/(2*h*n*y),b=Math.log(Math.sqrt(v*v+1)-v),_=Math.log(Math.sqrt(g*g+1)-g);s=(_-b)/t,o=function(e){var r,i=e*s,o=Kr(b),u=l/(n*y)*(o*(r=t*i+b,((r=Math.exp(2*r))-1)/(r+1))-function(e){return((e=Math.exp(e))-1/e)/2}(b));return[a+u*p,c+u*d,l*o/Kr(t*i+b)]}}return o.duration=1e3*s*t/Math.SQRT2,o}return i.rho=function(t){var n=Math.max(.001,+t),r=n*n;return e(n,r,r*r)},i}(Math.SQRT2,2,4),$r=e=>()=>e;function Ur(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function Vr(e,t,n){this.k=e,this.x=t,this.y=n}Vr.prototype={constructor:Vr,scale:function(e){return 1===e?this:new Vr(this.k*e,this.x,this.y)},translate:function(e,t){return 0===e&0===t?this:new Vr(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var qr=new Vr(1,0,0);function zr(e){for(;!e.__zoom;)if(!(e=e.parentNode))return qr;return e.__zoom}function Gr(e){e.stopImmediatePropagation()}function Wr(e){e.preventDefault(),e.stopImmediatePropagation()}function Yr(e){return!(e.ctrlKey&&"wheel"!==e.type||e.button)}function Jr(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e).hasAttribute("viewBox")?[[(e=e.viewBox.baseVal).x,e.y],[e.x+e.width,e.y+e.height]]:[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]:[[0,0],[e.clientWidth,e.clientHeight]]}function Hr(){return this.__zoom||qr}function Xr(e){return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Qr(){return navigator.maxTouchPoints||"ontouchstart"in this}function Zr(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],o=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),s>o?(o+s)/2:Math.min(0,o)||Math.max(0,s))}zr.prototype=Vr.prototype;var ei=r(985),ti=r.n(ei);const ni='';function ri(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);s=!0);}catch(e){a=!0,i=e}finally{try{s||null==n.return||n.return()}finally{if(a)throw i}}return o}}(e,t)||ii(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ii(e,t){if(e){if("string"==typeof e)return oi(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?oi(e,t):void 0}}function oi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{SelectEvent:null,UpdateEvent:null},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"root",o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),this.pluginData=t,this.rootId=i,this.resources=n,this.width=void 0!==o.width?o.width:1280,this.height=void 0!==o.height?o.height:1280,this.minWidth=void 0!==o.minWidth?o.minWidth:230,this.minHeight=void 0!==o.minHeight?o.minHeight:50,this.padding=void 0!==o.padding?o.padding:30,this.margin=void 0!==o.margin?o.margin:6,this.lineLengthPerDepth=void 0!==o.lineLengthPerDepth?o.lineLengthPerDepth:[5,1],this.actionMenuButtonSize=o.actionMenuButtonSize||24,this.actions={selection:{current:null,style:"2px solid hsl(205, 100%, 50%)",offset:"3px"},linkCreation:{source:null,target:null,creating:!1},drag:{offsetX:0,offsetY:0,state:!1,target:null}},this.setEvents(r)}var t,n;return t=e,n=[{key:"screenToSVG",value:function(e,t){var n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:null)||this.svg.node();return new DOMPoint(e,t).matrixTransform(n.getScreenCTM().inverse())}},{key:"SVGToScreen",value:function(e,t){var n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:null)||this.svg.node();return new DOMPoint(e,t).matrixTransform(n.getScreenCTM())}},{key:"setEvents",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{SelectEvent:null,UpdateEvent:null};this.events={SelectEvent:e.SelectEvent||null,UpdateEvent:e.UpdateEvent||null}}},{key:"emitUpdateEvent",value:function(){this.events&&this.events.UpdateEvent&&this.events.UpdateEvent.next()}},{key:"__getVerticalCoefficient",value:function(e){var t=this;if(e.children&&e.children.length>0){var n=Math.ceil(e.children.filter((function(e){return e&&e.data&&e.data.definition&&e.data.definition.isContainer})).reduce((function(e,n){return e+t.__getVerticalCoefficient(n)}),0));return e.children.filter((function(e){return!(e&&e.data&&e.data.definition&&e.data.definition.isContainer)})).reduce((function(e,t){return e+t.value}),0)/this.getLineLengthForDepth(e.depth)+n+(e.data&&e.data.definition&&e.data.definition.isContainer?1:0)}return e.value/this.getLineLengthForDepth(e.depth)+(e.data&&e.data.definition&&e.data.definition.isContainer?1:0)}},{key:"getLineLengthForDepth",value:function(e){return this.lineLengthPerDepth[Math.min(e,this.lineLengthPerDepth.length-1)]}},{key:"setDisabledStyle",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:".component";kr("#".concat(this.rootId," ").concat(e||".component")).classed("disabled",!0)}},{key:"unsetAllDisabledStyles",value:function(){kr("#".concat(this.rootId," .disabled")).classed("disabled",!1)}},{key:"dragHandler",value:function(e,t){this.hideActionMenu();var n=document.elementsFromPoint(t.sourceEvent.x,t.sourceEvent.y).find((function(e){return t.subject.data.id!==e.dataset.parentId&&(e.classList.contains("container-background")||e.classList.contains("container"))})),r=Jn("#".concat(t.subject.data.id)).attr("cursor","grabbing");Jn("#root-components").append((function(){return r.node()}));var i=this.screenToSVG(t.sourceEvent.clientX,t.sourceEvent.clientY,this.svg.select(".container").node());if(Jn(e).attr("transform",t.subject.transform="translate(".concat(i.x-this.actions.drag.offsetX,",\n ").concat(i.y-this.actions.drag.offsetY,")")),t.subject.x=i.x-this.actions.drag.offsetX,t.subject.y=i.y-this.actions.drag.offsetY,t.subject.data.definition){var o=t.subject.data.definition.parentTypes.map((function(e){return":not(.".concat(e,")")})).join("");this.setDisabledStyle(".component:not(#".concat(t.subject.data.id,")").concat(o))}return this.drawLinks(),n}},{key:"setupDragBehavior",value:function(){var e=this,t=null,n=!1,r=this.dragHandler.bind(this);return function(){var e,t,n,r,i=or,o=sr,s=ar,a=cr,c={},l=Qe("start","drag","end"),u=0,f=0;function h(e){e.on("mousedown.drag",p).filter(a).on("touchstart.drag",y).on("touchmove.drag",v,Xn).on("touchend.drag touchcancel.drag",g).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(s,a){if(!r&&i.call(this,s,a)){var c=b(this,o.call(this,s,a),s,a,"mouse");c&&(Jn(s.view).on("mousemove.drag",d,Qn).on("mouseup.drag",m,Qn),tr(s.view),Zn(s),n=!1,e=s.clientX,t=s.clientY,c("start",s))}}function d(r){if(er(r),!n){var i=r.clientX-e,o=r.clientY-t;n=i*i+o*o>f}c.mouse("drag",r)}function m(e){Jn(e.view).on("mousemove.drag mouseup.drag",null),nr(e.view,n),er(e),c.mouse("end",e)}function y(e,t){if(i.call(this,e,t)){var n,r,s=e.changedTouches,a=o.call(this,e,t),c=s.length;for(n=0;nsvg")).empty()?(this.svg=Jn("#".concat(this.rootId)).append("svg").attr("viewBox",[0,0,this.width,this.height]).attr("preserveAspectRatio","xMinYMin meet").style("font","10px sans-serif"),this.svg.append("g").attr("class","container").attr("height","100%").attr("width","100%").attr("x",0).attr("y",0)):this.svg=Jn("#".concat(this.rootId)).select("svg")}},{key:"draw",value:function(e){this.rootId=e,this.createRenderingContext(),this.__unselectComponent(),this.drawComponents(),this.drawLinks(),this.setViewPortAction(Jn("#".concat(this.rootId)))}},{key:"clickHandler",value:function(e){e.stopPropagation(),this.__selectComponent(Jn(e.currentTarget))}},{key:"drawComponents",value:function(){var e=this;this.shadowRoot={children:this.pluginData.components,id:"__shadowRoot",name:""};var t=this.buildTree(),n=this.clickHandler.bind(this),r=this.setupDragBehavior(),i=this.svg.select(".container").selectAll("g").data(t,(function(e){return e})).join("g").attr("id",(function(e){return ri(e,1)[0]})).selectAll("g").data((function(e){return ri(e,2)[1]})).join("g").attr("id",(function(e){return e.data.id})).on("click",n).call(r).attr("x",(function(e){return e.x0})).attr("y",(function(e){return e.y0})).attr("transform",(function(e){var t=e.x0,n=e.y0;return"translate(".concat(t,",").concat(n,")")}));i.filter((function(e){return"__shadowRoot"!==e.data.id})).attr("class",(function(e){var t=e.data;return"component\n component-".concat(t.definition.model,"\n ").concat(t.definition.type)})).html((function(t){var n=t.data;return ti().renderString(e.resources.models[n.definition.model],n)})).select("svg").attr("id",(function(e){var t=e.data;return"svg-".concat(t.id)})).attr("height",(function(e){var t=e.y0;return e.y1-t})).attr("width",(function(e){var t=e.x0;return e.x1-t})),i.select(".component-icon").html((function(t){var n=t.data;return e.resources.icons[n.definition.icon]})),i.select("rect").filter((function(e){return e.data&&e.data.definition&&e.data.definition.isContainer})).attr("height",(function(e){var t=e.y0;return e.y1-t})).attr("width",(function(e){var t=e.x0;return e.x1-t})),i.select(".component-container").attr("height",(function(t){var n=t.y0,r=t.y1;return Math.max(r-(n+e.minHeight)-e.margin,e.minHeight)})).attr("width",(function(t){var n=t.x0,r=t.x1;return Math.max(r-n-2*e.margin,e.minWidth)})).attr("x",(function(){return e.margin})).attr("y",(function(){return e.minHeight})).filter((function(e){return e.children})).append((function(e){var t=e.data;return Jn("#group-".concat(t.id)).node()})),i.select(".component-container>rect").attr("data-parentId",(function(e){return e.data.id}))}},{key:"buildTree",value:function(){var e=this,t=function(){var e=br,t=!1,n=1,r=1,i=[0],o=_r,s=_r,a=_r,c=_r,l=_r;function u(e){return e.x0=e.y0=0,e.x1=n,e.y1=r,e.eachBefore(f),i=[0],t&&e.eachBefore(yr),e}function f(t){var n=i[t.depth],r=t.x0+n,u=t.y0+n,f=t.x1-n,h=t.y1-n;f=r.length)return n(i);const s=new T,a=r[o++];let c=-1;for(const e of i){const t=a(e,++c,i),n=s.get(t);n?n.push(e):s.set(t,[e])}for(const[t,n]of s)s.set(t,e(n,o));return t(s)}(e,0)}(e,Array.from,P,t)}(n,(function(e){var t=e.parent;return t&&"__shadowRoot"!==t.data.id?"group-".concat(t.data.id):"root-components"})).filter((function(e){return"root-__shadowRoot"!==ri(e,1)[0]}))}},{key:"getAnchorPoint",value:function(e,t){if(e.empty()||t.empty())return null;var n,r=e.node().getBoundingClientRect(),i=this.getSelectionCenter(e),o=this.getSelectionCenter(t),s=this.getBearing(this.screenToSVG(i.x,i.y,this.svg.select(".container").node()),this.screenToSVG(o.x,o.y,this.svg.select(".container").node())),a={y:r.top,x:r.x+r.width/2},c={y:r.bottom,x:r.x+r.width/2},l={x:r.left,y:r.top+r.height/2},u={x:r.right,y:r.top+r.height/2};n=s<45||s>=315?c:s>=45&&s<135?u:s>=135&&s<225?a:l;var f=this.screenToSVG(n.x,n.y);return[f.x,f.y]}},{key:"drawLinks",value:function(){var e=this,t=this.pluginData.getLinks();if(t){var n=this.svg.selectAll(".link");n.data(t,(function(e){return e})).join("path").filter((function(e){var t=e.source,n=e.target;return!Jn("#".concat(t)).empty()&&!Jn("#".concat(n)).empty()})).classed("link",!0).attr("d",(function(t){return e.getLinkGenerator(t)(t)})).attr("fill","none").attr("stroke",(function(e){return e.definition.color})).attr("stroke-width",(function(e){return e.definition.width})).attr("stroke-dasharray",(function(e){return e.definition.dashStyle||"none"})).attr("cursor","pointer").on("click",(function(t){return e.clickHandler(t)})),n.raise()}}},{key:"getSelectionCenter",value:function(e){var t=e.node().getBoundingClientRect();return{x:t.left+t.width/2,y:t.top+t.height/2}}},{key:"getBearing",value:function(e,t){var n=t.x-e.x,r=t.y-e.y,i=n/Math.sqrt(Math.pow(n,2)+Math.pow(r,2)),o=r/Math.sqrt(Math.pow(n,2)+Math.pow(r,2));return(Math.atan2(i,o)*(180/Math.PI)+360)%360}},{key:"getLinkGenerator",value:function(e){var t=Jn("#".concat(e.source)),n=Jn("#".concat(e.target)),r=this.getAnchorPoint(t,n),i=this.getAnchorPoint(n,t),o=this.getSelectionCenter(t),s=this.getSelectionCenter(n),a=this.getBearing(this.screenToSVG(o.x,o.y,this.svg.select(".container").node()),this.screenToSVG(s.x,s.y,this.svg.select(".container").node()));return function(e){let t=Ir,n=Rr,r=jr,i=Pr,o=null,s=null;function a(){let a;const c=Nr.call(arguments),l=t.apply(this,c),u=n.apply(this,c);if(null==o&&(s=e(a=Lr())),s.lineStart(),c[0]=l,s.point(+r.apply(this,c),+i.apply(this,c)),c[0]=u,s.point(+r.apply(this,c),+i.apply(this,c)),s.lineEnd(),a)return s=null,a+""||null}return a.source=function(e){return arguments.length?(t=e,a):t},a.target=function(e){return arguments.length?(n=e,a):n},a.x=function(e){return arguments.length?(r="function"==typeof e?e:Cr(+e),a):r},a.y=function(e){return arguments.length?(i="function"==typeof e?e:Cr(+e),a):i},a.context=function(t){return arguments.length?(null==t?o=s=null:s=e(o=t),a):o},a}(a<45||a>=315||a>=135&&a<225?Fr:Mr).source((function(){return r})).target((function(){return i}))}},{key:"setupTiles",value:function(e){var t=this,n={x1:0,y1:0};e.forEach((function(e,r){var i,o={x1:0,y0:r*t.minHeight+t.padding};if(e.items.forEach((function(e){if(e.data.drawOption?(e.x0=e.data.drawOption.x,e.y0=e.data.drawOption.y):(e.x0=o.x1+t.padding,e.y0=n.y1+t.padding,o=e),!e.data.drawOption||e.data.drawOption.needsResizing){var r=Math.min(e.value,t.getLineLengthForDepth(e.depth)),i=Math.ceil(t.__getVerticalCoefficient(e));e.x1=e.x0+r*(t.minWidth+2*t.margin)+2*e.height*t.padding+(r-1)*(t.padding+2*t.margin),e.y1=e.y0+i*t.minHeight+e.height*t.padding+(i-1)*(t.padding+t.margin),e.data.drawOption&&(e.data.drawOption.needsResizing=!1,e.data.drawOption.width=e.x1-e.x0,e.data.drawOption.height=e.y1-e.y0)}else e.x1=e.x0+e.data.drawOption.width,e.y1=e.y0+e.data.drawOption.height})),e.items.length>0){var s=Math.max.apply(Math,function(e){if(Array.isArray(e))return oi(e)}(i=e.items.map((function(e){return e.value})))||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(i)||ii(i)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}());n=e.items.find((function(e){return e.value===s}))}}))}},{key:"__buildLines",value:function(e){var t=this,n=e.children,r=e.depth,i=[{total:0,items:[]}],o=0,s=i[o];return n.forEach((function(e){s.items.length>=t.getLineLengthForDepth(r)&&(i.push({total:0,items:[]}),o+=1),(s=i[o]).total+=e.value,s.items.push(e)})),i}},{key:"setViewPortAction",value:function(e){var t=this;this.svg.on("click",(function(){t.__unselectComponent(),t.cancelLinkCreationInteraction()}));var n=this.drawLinks.bind(this);e.call(function(){var e,t,n,r=Yr,i=Jr,o=Zr,s=Xr,a=Qr,c=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],u=250,f=Dr,h=Qe("start","zoom","end"),p=500,d=0,m=10;function y(e){e.property("__zoom",Hr).on("wheel.zoom",E,{passive:!1}).on("mousedown.zoom",x).on("dblclick.zoom",O).filter(a).on("touchstart.zoom",S).on("touchmove.zoom",T).on("touchend.zoom touchcancel.zoom",A).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function v(e,t){return(t=Math.max(c[0],Math.min(c[1],t)))===e.k?e:new Vr(t,e.x,e.y)}function g(e,t,n){var r=t[0]-n[0]*e.k,i=t[1]-n[1]*e.k;return r===e.x&&i===e.y?e:new Vr(e.k,r,i)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function _(e,t,n,r){e.on("start.zoom",(function(){w(this,arguments).event(r).start()})).on("interrupt.zoom end.zoom",(function(){w(this,arguments).event(r).end()})).tween("zoom",(function(){var e=this,o=arguments,s=w(e,o).event(r),a=i.apply(e,o),c=null==n?b(a):"function"==typeof n?n.apply(e,o):n,l=Math.max(a[1][0]-a[0][0],a[1][1]-a[0][1]),u=e.__zoom,h="function"==typeof t?t.apply(e,o):t,p=f(u.invert(c).concat(l/u.k),h.invert(c).concat(l/h.k));return function(e){if(1===e)e=h;else{var t=p(e),n=l/t[2];e=new Vr(n,c[0]-t[0]*n,c[1]-t[1]*n)}s.zoom(null,e)}}))}function w(e,t,n){return!n&&e.__zooming||new k(e,t)}function k(e,t){this.that=e,this.args=t,this.active=0,this.sourceEvent=null,this.extent=i.apply(e,t),this.taps=0}function E(e,...t){if(r.apply(this,arguments)){var n=w(this,t).event(e),i=this.__zoom,a=Math.max(c[0],Math.min(c[1],i.k*Math.pow(2,s.apply(this,arguments)))),u=Hn(e);if(n.wheel)n.mouse[0][0]===u[0]&&n.mouse[0][1]===u[1]||(n.mouse[1]=i.invert(n.mouse[0]=u)),clearTimeout(n.wheel);else{if(i.k===a)return;n.mouse=[u,i.invert(u)],Et(this),n.start()}Wr(e),n.wheel=setTimeout((function(){n.wheel=null,n.end()}),150),n.zoom("mouse",o(g(v(i,a),n.mouse[0],n.mouse[1]),n.extent,l))}}function x(e,...t){if(!n&&r.apply(this,arguments)){var i=e.currentTarget,s=w(this,t,!0).event(e),a=Jn(e.view).on("mousemove.zoom",(function(e){if(Wr(e),!s.moved){var t=e.clientX-u,n=e.clientY-f;s.moved=t*t+n*n>d}s.event(e).zoom("mouse",o(g(s.that.__zoom,s.mouse[0]=Hn(e,i),s.mouse[1]),s.extent,l))}),!0).on("mouseup.zoom",(function(e){a.on("mousemove.zoom mouseup.zoom",null),nr(e.view,s.moved),Wr(e),s.event(e).end()}),!0),c=Hn(e,i),u=e.clientX,f=e.clientY;tr(e.view),Gr(e),s.mouse=[c,this.__zoom.invert(c)],Et(this),s.start()}}function O(e,...t){if(r.apply(this,arguments)){var n=this.__zoom,s=Hn(e.changedTouches?e.changedTouches[0]:e,this),a=n.invert(s),c=n.k*(e.shiftKey?.5:2),f=o(g(v(n,c),s,a),i.apply(this,t),l);Wr(e),u>0?Jn(this).transition().duration(u).call(_,f,s,e):Jn(this).call(y.transform,f,s,e)}}function S(n,...i){if(r.apply(this,arguments)){var o,s,a,c,l=n.touches,u=l.length,f=w(this,i,n.changedTouches.length===u).event(n);for(Gr(n),s=0;s',handler:function(){this.startLinkCreationInteraction()}},{id:"remove-component",icon:ni,handler:function(){this.pluginData.removeComponentById(this.actions.selection.current.id),this.emitUpdateEvent(),this.draw(this.rootId)}}]:[{id:"remove-link",icon:ni,handler:function(){this.pluginData.removeLink(this.actions.selection.current),this.emitUpdateEvent(),this.draw(this.rootId)}}]}},{key:"cancelLinkCreationInteraction",value:function(){this.actions.linkCreation.creating=!1,this.actions.linkCreation.source=null,this.actions.linkCreation.target=null,this.unsetAllDisabledStyles()}},{key:"hideActionMenu",value:function(){Jn("#action-menu").remove()}}],n&&function(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:[]).reduce((function(e,t){return e[t.path]="",e}),{});return this.renderFiles().forEach((function(t){e[t.path]=t.content})),Object.keys(e).map((function(t){return new S({path:t,content:e[t]})}))}},{key:"renderFiles",value:function(){return[]}},{key:"renderConfiguration",value:function(e){var t={};this.pluginData.components.filter((function(e){return e.drawOption})).forEach((function(e){t[e.id]=e.drawOption}));var n=JSON.parse(e.content)||{};n[this.pluginData.name]=t,e.content=JSON.stringify(n,(function(e,t){return null===t?void 0:t}))}}],n&&function(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:"Error happened when trying to parse.",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"Error";return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),(e=i.call(this,t)).name="ParseError",e.startLine=n,e.startColumn=r,e.endLine=s,e.endColumn=a,e.severity=c,e}return r=o,Object.defineProperty(r,"prototype",{writable:!1}),r}(pi(Error));var bi=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{name:null,version:null,components:[],definitions:{components:[],links:[]},parseErrors:[]};(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),this.name=t.name||null,this.version=t.version||null,this.components=t.components||[],this.definitions={components:[],links:[]},t.definitions&&(this.definitions.components=t.definitions.components||[],this.definitions.links=t.definitions.links||[]),this.parseErrors=t.parseErrors||[]}var t,n;return t=e,n=[{key:"coreVersion",get:function(){return"0.11.0"}},{key:"getComponentById",value:function(e){return this.components.find((function(t){return t.id===e}))||null}},{key:"getComponentsByType",value:function(e){return this.components.filter((function(t){var n=t.definition;return n&&n.type===e}))}},{key:"addComponent",value:function(e,t){this.components.push(new l({id:e,name:e,definition:t}))}},{key:"removeComponentById",value:function(e){var t=this;this.getChildren(e).forEach((function(e){return t.removeComponentById(e.id)})),this.components=this.components.filter((function(t){return t.id!==e})),this.components.forEach((function(t){t.removeLinkAttribute(e)}))}},{key:"removeLink",value:function(e){var t=e.source,n=e.target,r=e.definition.attributeRef;this.getComponentById(t).removeLinkAttribute(n,r)}},{key:"getLinks",value:function(){var e=this,t=[];return this.definitions.links.forEach((function(n){e.getComponentsByType(n.sourceRef).forEach((function(e){var r=e.getAttributeByName(n.attributeRef);r&&r.value.forEach((function(r){return t.push(new _({definition:n,source:e.id,target:r}))}))}))})),t}},{key:"initLinkDefinitions",value:function(){var e=this;this.definitions.links=[],this.definitions.components.forEach((function(t){var n=t.type,r=t.definedAttributes;e.__setLinkDefinitions(n,r)}))}},{key:"__setLinkDefinitions",value:function(e,t){var n=this;t.forEach((function(t){if("Link"===t.type){var r=new k({type:t.linkType,attributeRef:t.name,sourceRef:e,targetRef:t.linkRef,color:t.linkColor,width:t.linkWidth,dashStyle:t.linkDashStyle});n.definitions.links.push(r)}else"Object"===t.type&&n.__setLinkDefinitions(e,t.definedAttributes)}))}},{key:"getChildren",value:function(e){return this.components.filter((function(t){return t.getContainerId()===e}))}}],n&&function(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{pluginData:null,pluginDrawer:null,pluginMetadata:null,pluginParser:null,pluginRenderer:null};(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),this.data=t.pluginData||new _i,this.__drawer=t.pluginDrawer||new ai(this.data),this.__metadata=t.pluginMetadata||new ci(this.data),this.__parser=t.pluginParser||new ui(this.data),this.__renderer=t.pluginRenderer||new fi(this.data)}var t,n;return t=e,n=[{key:"init",value:function(e){this.__drawer.setEvents(e),this.__metadata.parse(),this.data.initLinkDefinitions()}},{key:"initResources",value:function(e){this.__drawer.resources=e}},{key:"draw",value:function(e){this.__drawer.draw(e)}},{key:"parse",value:function(e,t){this.__parser.parse(t),this.__parser.parseConfiguration(e)}},{key:"isParsable",value:function(e){return this.__parser.isParsable(e)}},{key:"render",value:function(e,t){return this.__renderer.renderConfiguration(e),this.__renderer.render(t)}}],n&&function(e,t){for(var n=0;n":">"},s=/[&"'<>]/g;function a(e,t){return i.hasOwnProperty.call(e,t)}function c(e){return o[e]}function l(e,t,n){var r,i,o;if(e instanceof Error&&(e=(i=e).name+": "+i.message),Object.setPrototypeOf?(r=new Error(e),Object.setPrototypeOf(r,l.prototype)):(r=this,Object.defineProperty(r,"message",{enumerable:!1,writable:!0,value:e})),Object.defineProperty(r,"name",{value:"Template render error"}),Error.captureStackTrace&&Error.captureStackTrace(r,this.constructor),i){var s=Object.getOwnPropertyDescriptor(i,"stack");(o=s&&(s.get||function(){return s.value}))||(o=function(){return i.stack})}else{var a=new Error(e).stack;o=function(){return a}}return Object.defineProperty(r,"stack",{get:function(){return o.call(r)}}),Object.defineProperty(r,"cause",{value:i}),r.lineno=t,r.colno=n,r.firstUpdate=!0,r.Update=function(e){var t="("+(e||"unknown path")+")";return this.firstUpdate&&(this.lineno&&this.colno?t+=" [Line "+this.lineno+", Column "+this.colno+"]":this.lineno&&(t+=" [Line "+this.lineno+"]")),t+="\n ",this.firstUpdate&&(t+=" "),this.message=t+(this.message||""),this.firstUpdate=!1,this},r}function u(e){return"[object Function]"===i.toString.call(e)}function f(e){return"[object Array]"===i.toString.call(e)}function h(e){return"[object String]"===i.toString.call(e)}function p(e){return"[object Object]"===i.toString.call(e)}function d(e){var t,n=(t=e)?"string"==typeof t?t.split("."):[t]:[];return function(e){for(var t=e,r=0;re.length)s=i.slice(0,e.length),i.slice(s.length,l).forEach((function(e,n){n2?i-2:0),s=2;s0||!n)&&process.stdout.write(" ".repeat(t));var o=i===r.length-1?"":"\n";process.stdout.write(""+e+o)}))}e.exports={Node:c,Root:f,NodeList:u,Value:l,Literal:h,Symbol:p,Group:d,Array:m,Pair:y,Dict:v,Output:D,Capture:$,TemplateData:U,If:b,IfAsync:_,InlineIf:w,For:k,AsyncEach:E,AsyncAll:x,Macro:O,Caller:S,Import:T,FromImport:A,FunCall:L,Filter:N,FilterAsync:C,KeywordArgs:j,Block:P,Super:I,Extends:R,Include:B,Set:M,Switch:F,Case:K,LookupVal:g,BinOp:q,In:z,Is:G,Or:W,And:Y,Not:J,Add:H,Concat:X,Sub:Q,Mul:Z,Div:ee,FloorDiv:te,Mod:ne,Pow:re,Neg:ie,Pos:oe,Compare:se,CompareOperand:ae,CallExtension:ce,CallExtensionAsync:le,printNodes:function e(t,n){if(n=n||0,ue(t.typename+": ",n),t instanceof u)ue("\n"),t.children.forEach((function(t){e(t,n+2)}));else if(t instanceof ce)ue(t.extName+"."+t.prop+"\n"),t.args&&e(t.args,n+2),t.contentArgs&&t.contentArgs.forEach((function(t){e(t,n+2)}));else{var r=[],i=null;t.iterFields((function(e,t){e instanceof c?r.push([t,e]):(i=i||{})[t]=e})),i?ue(JSON.stringify(i,null,2)+"\n",null,!0):ue("\n"),r.forEach((function(t){var r=t[0],i=t[1];ue("["+r+"] =>",n+2),e(i,n+4)}))}}}},function(e,t){},function(e,t,n){"use strict";function r(e,t){return r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},r(e,t)}var i=n(8),o=n(17),s=n(3),a=n(0).TemplateError,c=n(2).Frame,l=n(1).Obj,u={"==":"==","===":"===","!=":"!=","!==":"!==","<":"<",">":">","<=":"<=",">=":">="},f=function(e){var t,n;function i(){return e.apply(this,arguments)||this}n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,r(t,n);var o=i.prototype;return o.init=function(e,t){this.templateName=e,this.codebuf=[],this.lastId=0,this.buffer=null,this.bufferStack=[],this._scopeClosers="",this.inBlock=!1,this.throwOnUndefined=t},o.fail=function(e,t,n){throw void 0!==t&&(t+=1),void 0!==n&&(n+=1),new a(e,t,n)},o._pushBuffer=function(){var e=this._tmpid();return this.bufferStack.push(this.buffer),this.buffer=e,this._emit("var "+this.buffer+' = "";'),e},o._popBuffer=function(){this.buffer=this.bufferStack.pop()},o._emit=function(e){this.codebuf.push(e)},o._emitLine=function(e){this._emit(e+"\n")},o._emitLines=function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r0&&i._emit(","),i.compile(e,t)})),r&&this._emit(r)},o._compileExpression=function(e,t){this.assertType(e,s.Literal,s.Symbol,s.Group,s.Array,s.Dict,s.FunCall,s.Caller,s.Filter,s.LookupVal,s.Compare,s.InlineIf,s.In,s.Is,s.And,s.Or,s.Not,s.Add,s.Concat,s.Sub,s.Mul,s.Div,s.FloorDiv,s.Mod,s.Pow,s.Neg,s.Pos,s.Compare,s.NodeList),this.compile(e,t)},o.assertType=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r0&&r._emit(","),e){r._emitLine("function(cb) {"),r._emitLine("if(!cb) { cb = function(err) { if(err) { throw err; }}}");var i=r._pushBuffer();r._withScopedSyntax((function(){r.compile(e,t),r._emitLine("cb(null, "+i+");")})),r._popBuffer(),r._emitLine("return "+i+";"),r._emitLine("}")}else r._emit("null")})),n){var c=this._tmpid();this._emitLine(", "+this._makeCallback(c)),this._emitLine(this.buffer+" += runtime.suppressValue("+c+", "+a+" && env.opts.autoescape);"),this._addScopeLevel()}else this._emit(")"),this._emit(", "+a+" && env.opts.autoescape);\n")},o.compileCallExtensionAsync=function(e,t){this.compileCallExtension(e,t,!0)},o.compileNodeList=function(e,t){this._compileChildren(e,t)},o.compileLiteral=function(e){if("string"==typeof e.value){var t=e.value.replace(/\\/g,"\\\\");t=(t=(t=(t=(t=t.replace(/"/g,'\\"')).replace(/\n/g,"\\n")).replace(/\r/g,"\\r")).replace(/\t/g,"\\t")).replace(/\u2028/g,"\\u2028"),this._emit('"'+t+'"')}else null===e.value?this._emit("null"):this._emit(e.value.toString())},o.compileSymbol=function(e,t){var n=e.value,r=t.lookup(n);r?this._emit(r):this._emit('runtime.contextOrFrameLookup(context, frame, "'+n+'")')},o.compileGroup=function(e,t){this._compileAggregate(e,t,"(",")")},o.compileArray=function(e,t){this._compileAggregate(e,t,"[","]")},o.compileDict=function(e,t){this._compileAggregate(e,t,"{","}")},o.compilePair=function(e,t){var n=e.key,r=e.value;n instanceof s.Symbol?n=new s.Literal(n.lineno,n.colno,n.value):n instanceof s.Literal&&"string"==typeof n.value||this.fail("compilePair: Dict keys must be strings or names",n.lineno,n.colno),this.compile(n,t),this._emit(": "),this._compileExpression(r,t)},o.compileInlineIf=function(e,t){this._emit("("),this.compile(e.cond,t),this._emit("?"),this.compile(e.body,t),this._emit(":"),null!==e.else_?this.compile(e.else_,t):this._emit('""'),this._emit(")")},o.compileIn=function(e,t){this._emit("runtime.inOperator("),this.compile(e.left,t),this._emit(","),this.compile(e.right,t),this._emit(")")},o.compileIs=function(e,t){var n=e.right.name?e.right.name.value:e.right.value;this._emit('env.getTest("'+n+'").call(context, '),this.compile(e.left,t),e.right.args&&(this._emit(","),this.compile(e.right.args,t)),this._emit(") === true")},o._binOpEmitter=function(e,t,n){this.compile(e.left,t),this._emit(n),this.compile(e.right,t)},o.compileOr=function(e,t){return this._binOpEmitter(e,t," || ")},o.compileAnd=function(e,t){return this._binOpEmitter(e,t," && ")},o.compileAdd=function(e,t){return this._binOpEmitter(e,t," + ")},o.compileConcat=function(e,t){return this._binOpEmitter(e,t,' + "" + ')},o.compileSub=function(e,t){return this._binOpEmitter(e,t," - ")},o.compileMul=function(e,t){return this._binOpEmitter(e,t," * ")},o.compileDiv=function(e,t){return this._binOpEmitter(e,t," / ")},o.compileMod=function(e,t){return this._binOpEmitter(e,t," % ")},o.compileNot=function(e,t){this._emit("!"),this.compile(e.target,t)},o.compileFloorDiv=function(e,t){this._emit("Math.floor("),this.compile(e.left,t),this._emit(" / "),this.compile(e.right,t),this._emit(")")},o.compilePow=function(e,t){this._emit("Math.pow("),this.compile(e.left,t),this._emit(", "),this.compile(e.right,t),this._emit(")")},o.compileNeg=function(e,t){this._emit("-"),this.compile(e.target,t)},o.compilePos=function(e,t){this._emit("+"),this.compile(e.target,t)},o.compileCompare=function(e,t){var n=this;this.compile(e.expr,t),e.ops.forEach((function(e){n._emit(" "+u[e.type]+" "),n.compile(e.expr,t)}))},o.compileLookupVal=function(e,t){this._emit("runtime.memberLookup(("),this._compileExpression(e.target,t),this._emit("),"),this._compileExpression(e.val,t),this._emit(")")},o._getNodeName=function(e){switch(e.typename){case"Symbol":return e.value;case"FunCall":return"the return value of ("+this._getNodeName(e.name)+")";case"LookupVal":return this._getNodeName(e.target)+'["'+this._getNodeName(e.val)+'"]';case"Literal":return e.value.toString();default:return"--expression--"}},o.compileFunCall=function(e,t){this._emit("(lineno = "+e.lineno+", colno = "+e.colno+", "),this._emit("runtime.callWrap("),this._compileExpression(e.name,t),this._emit(', "'+this._getNodeName(e.name).replace(/"/g,'\\"')+'", context, '),this._compileAggregate(e.args,t,"[","])"),this._emit(")")},o.compileFilter=function(e,t){var n=e.name;this.assertType(n,s.Symbol),this._emit('env.getFilter("'+n.value+'").call(context, '),this._compileAggregate(e.args,t),this._emit(")")},o.compileFilterAsync=function(e,t){var n=e.name,r=e.symbol.value;this.assertType(n,s.Symbol),t.set(r,r),this._emit('env.getFilter("'+n.value+'").call(context, '),this._compileAggregate(e.args,t),this._emitLine(", "+this._makeCallback(r)),this._addScopeLevel()},o.compileKeywordArgs=function(e,t){this._emit("runtime.makeKeywordArgs("),this.compileDict(e,t),this._emit(")")},o.compileSet=function(e,t){var n=this,r=[];e.targets.forEach((function(e){var i=e.value,o=t.lookup(i);null==o&&(o=n._tmpid(),n._emitLine("var "+o+";")),r.push(o)})),e.value?(this._emit(r.join(" = ")+" = "),this._compileExpression(e.value,t),this._emitLine(";")):(this._emit(r.join(" = ")+" = "),this.compile(e.body,t),this._emitLine(";")),e.targets.forEach((function(e,t){var i=r[t],o=e.value;n._emitLine('frame.set("'+o+'", '+i+", true);"),n._emitLine("if(frame.topLevel) {"),n._emitLine('context.setVariable("'+o+'", '+i+");"),n._emitLine("}"),"_"!==o.charAt(0)&&(n._emitLine("if(frame.topLevel) {"),n._emitLine('context.addExport("'+o+'", '+i+");"),n._emitLine("}"))}))},o.compileSwitch=function(e,t){var n=this;this._emit("switch ("),this.compile(e.expr,t),this._emit(") {"),e.cases.forEach((function(e,r){n._emit("case "),n.compile(e.cond,t),n._emit(": "),n.compile(e.body,t),e.body.children.length&&n._emitLine("break;")})),e.default&&(this._emit("default:"),this.compile(e.default,t)),this._emit("}")},o.compileIf=function(e,t,n){var r=this;this._emit("if("),this._compileExpression(e.cond,t),this._emitLine(") {"),this._withScopedSyntax((function(){r.compile(e.body,t),n&&r._emit("cb()")})),e.else_?(this._emitLine("}\nelse {"),this._withScopedSyntax((function(){r.compile(e.else_,t),n&&r._emit("cb()")}))):n&&(this._emitLine("}\nelse {"),this._emit("cb()")),this._emitLine("}")},o.compileIfAsync=function(e,t){this._emit("(function(cb) {"),this.compileIf(e,t,!0),this._emit("})("+this._makeCallback()),this._addScopeLevel()},o._emitLoopBindings=function(e,t,n,r){var i=this;[{name:"index",val:n+" + 1"},{name:"index0",val:n},{name:"revindex",val:r+" - "+n},{name:"revindex0",val:r+" - "+n+" - 1"},{name:"first",val:n+" === 0"},{name:"last",val:n+" === "+r+" - 1"},{name:"length",val:r}].forEach((function(e){i._emitLine('frame.set("loop.'+e.name+'", '+e.val+");")}))},o.compileFor=function(e,t){var n=this,r=this._tmpid(),i=this._tmpid(),o=this._tmpid();if(t=t.push(),this._emitLine("frame = frame.push();"),this._emit("var "+o+" = "),this._compileExpression(e.arr,t),this._emitLine(";"),this._emit("if("+o+") {"),this._emitLine(o+" = runtime.fromIterator("+o+");"),e.name instanceof s.Array){this._emitLine("var "+r+";"),this._emitLine("if(runtime.isArray("+o+")) {"),this._emitLine("var "+i+" = "+o+".length;"),this._emitLine("for("+r+"=0; "+r+" < "+o+".length; "+r+"++) {"),e.name.children.forEach((function(i,s){var a=n._tmpid();n._emitLine("var "+a+" = "+o+"["+r+"]["+s+"];"),n._emitLine('frame.set("'+i+'", '+o+"["+r+"]["+s+"]);"),t.set(e.name.children[s].value,a)})),this._emitLoopBindings(e,o,r,i),this._withScopedSyntax((function(){n.compile(e.body,t)})),this._emitLine("}"),this._emitLine("} else {");var a=e.name.children,c=a[0],l=a[1],u=this._tmpid(),f=this._tmpid();t.set(c.value,u),t.set(l.value,f),this._emitLine(r+" = -1;"),this._emitLine("var "+i+" = runtime.keys("+o+").length;"),this._emitLine("for(var "+u+" in "+o+") {"),this._emitLine(r+"++;"),this._emitLine("var "+f+" = "+o+"["+u+"];"),this._emitLine('frame.set("'+c.value+'", '+u+");"),this._emitLine('frame.set("'+l.value+'", '+f+");"),this._emitLoopBindings(e,o,r,i),this._withScopedSyntax((function(){n.compile(e.body,t)})),this._emitLine("}"),this._emitLine("}")}else{var h=this._tmpid();t.set(e.name.value,h),this._emitLine("var "+i+" = "+o+".length;"),this._emitLine("for(var "+r+"=0; "+r+" < "+o+".length; "+r+"++) {"),this._emitLine("var "+h+" = "+o+"["+r+"];"),this._emitLine('frame.set("'+e.name.value+'", '+h+");"),this._emitLoopBindings(e,o,r,i),this._withScopedSyntax((function(){n.compile(e.body,t)})),this._emitLine("}")}this._emitLine("}"),e.else_&&(this._emitLine("if (!"+i+") {"),this.compile(e.else_,t),this._emitLine("}")),this._emitLine("frame = frame.pop();")},o._compileAsyncLoop=function(e,t,n){var r=this,i=this._tmpid(),o=this._tmpid(),a=this._tmpid(),c=n?"asyncAll":"asyncEach";if(t=t.push(),this._emitLine("frame = frame.push();"),this._emit("var "+a+" = runtime.fromIterator("),this._compileExpression(e.arr,t),this._emitLine(");"),e.name instanceof s.Array){var l=e.name.children.length;this._emit("runtime."+c+"("+a+", "+l+", function("),e.name.children.forEach((function(e){r._emit(e.value+",")})),this._emit(i+","+o+",next) {"),e.name.children.forEach((function(e){var n=e.value;t.set(n,n),r._emitLine('frame.set("'+n+'", '+n+");")}))}else{var u=e.name.value;this._emitLine("runtime."+c+"("+a+", 1, function("+u+", "+i+", "+o+",next) {"),this._emitLine('frame.set("'+u+'", '+u+");"),t.set(u,u)}this._emitLoopBindings(e,a,i,o),this._withScopedSyntax((function(){var o;n&&(o=r._pushBuffer()),r.compile(e.body,t),r._emitLine("next("+i+(o?","+o:"")+");"),n&&r._popBuffer()}));var f=this._tmpid();this._emitLine("}, "+this._makeCallback(f)),this._addScopeLevel(),n&&this._emitLine(this.buffer+" += "+f+";"),e.else_&&(this._emitLine("if (!"+a+".length) {"),this.compile(e.else_,t),this._emitLine("}")),this._emitLine("frame = frame.pop();")},o.compileAsyncEach=function(e,t){this._compileAsyncLoop(e,t)},o.compileAsyncAll=function(e,t){this._compileAsyncLoop(e,t,!0)},o._compileMacro=function(e,t){var n=this,r=[],i=null,o="macro_"+this._tmpid(),a=void 0!==t;e.args.children.forEach((function(t,o){o===e.args.children.length-1&&t instanceof s.Dict?i=t:(n.assertType(t,s.Symbol),r.push(t))}));var l,u=[].concat(r.map((function(e){return"l_"+e.value})),["kwargs"]),f=r.map((function(e){return'"'+e.value+'"'})),h=(i&&i.children||[]).map((function(e){return'"'+e.key.value+'"'}));l=a?t.push(!0):new c,this._emitLines("var "+o+" = runtime.makeMacro(","["+f.join(", ")+"], ","["+h.join(", ")+"], ","function ("+u.join(", ")+") {","var callerFrame = frame;","frame = "+(a?"frame.push(true);":"new runtime.Frame();"),"kwargs = kwargs || {};",'if (Object.prototype.hasOwnProperty.call(kwargs, "caller")) {','frame.set("caller", kwargs.caller); }'),r.forEach((function(e){n._emitLine('frame.set("'+e.value+'", l_'+e.value+");"),l.set(e.value,"l_"+e.value)})),i&&i.children.forEach((function(e){var t=e.key.value;n._emit('frame.set("'+t+'", '),n._emit('Object.prototype.hasOwnProperty.call(kwargs, "'+t+'")'),n._emit(' ? kwargs["'+t+'"] : '),n._compileExpression(e.value,l),n._emit(");")}));var p=this._pushBuffer();return this._withScopedSyntax((function(){n.compile(e.body,l)})),this._emitLine("frame = "+(a?"frame.pop();":"callerFrame;")),this._emitLine("return new runtime.SafeString("+p+");"),this._emitLine("});"),this._popBuffer(),o},o.compileMacro=function(e,t){var n=this._compileMacro(e),r=e.name.value;t.set(r,n),t.parent?this._emitLine('frame.set("'+r+'", '+n+");"):("_"!==e.name.value.charAt(0)&&this._emitLine('context.addExport("'+r+'");'),this._emitLine('context.setVariable("'+r+'", '+n+");"))},o.compileCaller=function(e,t){this._emit("(function (){");var n=this._compileMacro(e,t);this._emit("return "+n+";})()")},o._compileGetTemplate=function(e,t,n,r){var i=this._tmpid(),o=this._templateName(),s=this._makeCallback(i),a=n?"true":"false",c=r?"true":"false";return this._emit("env.getTemplate("),this._compileExpression(e.template,t),this._emitLine(", "+a+", "+o+", "+c+", "+s),i},o.compileImport=function(e,t){var n=e.target.value,r=this._compileGetTemplate(e,t,!1,!1);this._addScopeLevel(),this._emitLine(r+".getExported("+(e.withContext?"context.getVariables(), frame, ":"")+this._makeCallback(r)),this._addScopeLevel(),t.set(n,r),t.parent?this._emitLine('frame.set("'+n+'", '+r+");"):this._emitLine('context.setVariable("'+n+'", '+r+");")},o.compileFromImport=function(e,t){var n=this,r=this._compileGetTemplate(e,t,!1,!1);this._addScopeLevel(),this._emitLine(r+".getExported("+(e.withContext?"context.getVariables(), frame, ":"")+this._makeCallback(r)),this._addScopeLevel(),e.names.children.forEach((function(e){var i,o,a=n._tmpid();e instanceof s.Pair?(i=e.key.value,o=e.value.value):o=i=e.value,n._emitLine("if(Object.prototype.hasOwnProperty.call("+r+', "'+i+'")) {'),n._emitLine("var "+a+" = "+r+"."+i+";"),n._emitLine("} else {"),n._emitLine("cb(new Error(\"cannot import '"+i+"'\")); return;"),n._emitLine("}"),t.set(o,a),t.parent?n._emitLine('frame.set("'+o+'", '+a+");"):n._emitLine('context.setVariable("'+o+'", '+a+");")}))},o.compileBlock=function(e){var t=this._tmpid();this.inBlock||this._emit('(parentTemplate ? function(e, c, f, r, cb) { cb(""); } : '),this._emit('context.getBlock("'+e.name.value+'")'),this.inBlock||this._emit(")"),this._emitLine("(env, context, frame, runtime, "+this._makeCallback(t)),this._emitLine(this.buffer+" += "+t+";"),this._addScopeLevel()},o.compileSuper=function(e,t){var n=e.blockName.value,r=e.symbol.value,i=this._makeCallback(r);this._emitLine('context.getSuper(env, "'+n+'", b_'+n+", frame, runtime, "+i),this._emitLine(r+" = runtime.markSafe("+r+");"),this._addScopeLevel(),t.set(r,r)},o.compileExtends=function(e,t){var n=this._tmpid(),r=this._compileGetTemplate(e,t,!0,!1);this._emitLine("parentTemplate = "+r),this._emitLine("for(var "+n+" in parentTemplate.blocks) {"),this._emitLine("context.addBlock("+n+", parentTemplate.blocks["+n+"]);"),this._emitLine("}"),this._addScopeLevel()},o.compileInclude=function(e,t){this._emitLine("var tasks = [];"),this._emitLine("tasks.push("),this._emitLine("function(callback) {");var n=this._compileGetTemplate(e,t,!1,e.ignoreMissing);this._emitLine("callback(null,"+n+");});"),this._emitLine("});");var r=this._tmpid();this._emitLine("tasks.push("),this._emitLine("function(template, callback){"),this._emitLine("template.render(context.getVariables(), frame, "+this._makeCallback(r)),this._emitLine("callback(null,"+r+");});"),this._emitLine("});"),this._emitLine("tasks.push("),this._emitLine("function(result, callback){"),this._emitLine(this.buffer+" += result;"),this._emitLine("callback(null);"),this._emitLine("});"),this._emitLine("env.waterfall(tasks, function(){"),this._addScopeLevel()},o.compileTemplateData=function(e,t){this.compileLiteral(e,t)},o.compileCapture=function(e,t){var n=this,r=this.buffer;this.buffer="output",this._emitLine("(function() {"),this._emitLine('var output = "";'),this._withScopedSyntax((function(){n.compile(e.body,t)})),this._emitLine("return output;"),this._emitLine("})()"),this.buffer=r},o.compileOutput=function(e,t){var n=this;e.children.forEach((function(r){r instanceof s.TemplateData?r.value&&(n._emit(n.buffer+" += "),n.compileLiteral(r,t),n._emitLine(";")):(n._emit(n.buffer+" += runtime.suppressValue("),n.throwOnUndefined&&n._emit("runtime.ensureDefined("),n.compile(r,t),n.throwOnUndefined&&n._emit(","+e.lineno+","+e.colno+")"),n._emit(", env.opts.autoescape);\n"))}))},o.compileRoot=function(e,t){var n=this;t&&this.fail("compileRoot: root node can't have frame"),t=new c,this._emitFuncBegin(e,"root"),this._emitLine("var parentTemplate = null;"),this._compileChildren(e,t),this._emitLine("if(parentTemplate) {"),this._emitLine("parentTemplate.rootRenderFunc(env, context, frame, runtime, cb);"),this._emitLine("} else {"),this._emitLine("cb(null, "+this.buffer+");"),this._emitLine("}"),this._emitFuncEnd(!0),this.inBlock=!0;var r=[],i=e.findAll(s.Block);i.forEach((function(e,t){var i=e.name.value;if(-1!==r.indexOf(i))throw new Error('Block "'+i+'" defined more than once.');r.push(i),n._emitFuncBegin(e,"b_"+i);var o=new c;n._emitLine("var frame = frame.push(true);"),n.compile(e.body,o),n._emitFuncEnd()})),this._emitLine("return {"),i.forEach((function(e,t){var r="b_"+e.name.value;n._emitLine(r+": "+r+",")})),this._emitLine("root: root\n};")},o.compile=function(e,t){var n=this["compile"+e.typename];n?n.call(this,e,t):this.fail("compile: Cannot compile node: "+e.typename,e.lineno,e.colno)},o.getCode=function(){return this.codebuf.join("")},i}(l);e.exports={compile:function(e,t,n,r,s){void 0===s&&(s={});var a=new f(r,s.throwOnUndefined),c=(n||[]).map((function(e){return e.preprocess})).filter((function(e){return!!e})).reduce((function(e,t){return t(e)}),e);return a.compile(o.transform(i.parse(c,n,s),t,r)),a.getCode()},Compiler:f}},function(e,t,n){"use strict";function r(e,t){return r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},r(e,t)}var i=n(4),o=n(1).EmitterObj;e.exports=function(e){var t,n;function o(){return e.apply(this,arguments)||this}n=e,(t=o).prototype=Object.create(n.prototype),t.prototype.constructor=t,r(t,n);var s=o.prototype;return s.resolve=function(e,t){return i.resolve(i.dirname(e),t)},s.isRelative=function(e){return 0===e.indexOf("./")||0===e.indexOf("../")},o}(o)},function(e,t,n){"use strict";function r(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,i(e,t)}function i(e,t){return i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},i(e,t)}var o=n(12),s=n(15),a=n(0),c=n(5),l=n(18),u=n(10),f=u.FileSystemLoader,h=u.WebLoader,p=u.PrecompiledLoader,d=n(20),m=n(21),y=n(1),v=y.Obj,g=y.EmitterObj,b=n(2),_=b.handleError,w=b.Frame,k=n(22);function E(e,t,n){o((function(){e(t,n)}))}var x={type:"code",obj:{root:function(e,t,n,r,i){try{i(null,"")}catch(e){i(_(e,null,null))}}}},O=function(e){function t(){return e.apply(this,arguments)||this}r(t,e);var n=t.prototype;return n.init=function(e,t){var n=this;t=this.opts=t||{},this.opts.dev=!!t.dev,this.opts.autoescape=null==t.autoescape||t.autoescape,this.opts.throwOnUndefined=!!t.throwOnUndefined,this.opts.trimBlocks=!!t.trimBlocks,this.opts.lstripBlocks=!!t.lstripBlocks,this.loaders=[],e?this.loaders=a.isArray(e)?e:[e]:f?this.loaders=[new f("views")]:h&&(this.loaders=[new h("/views")]),"undefined"!=typeof window&&window.nunjucksPrecompiled&&this.loaders.unshift(new p(window.nunjucksPrecompiled)),this._initLoaders(),this.globals=m(),this.filters={},this.tests={},this.asyncFilters=[],this.extensions={},this.extensionsList=[],a._entries(l).forEach((function(e){var t=e[0],r=e[1];return n.addFilter(t,r)})),a._entries(d).forEach((function(e){var t=e[0],r=e[1];return n.addTest(t,r)}))},n._initLoaders=function(){var e=this;this.loaders.forEach((function(t){t.cache={},"function"==typeof t.on&&(t.on("update",(function(n,r){t.cache[n]=null,e.emit("update",n,r,t)})),t.on("load",(function(n,r){e.emit("load",n,r,t)})))}))},n.invalidateCache=function(){this.loaders.forEach((function(e){e.cache={}}))},n.addExtension=function(e,t){return t.__name=e,this.extensions[e]=t,this.extensionsList.push(t),this},n.removeExtension=function(e){var t=this.getExtension(e);t&&(this.extensionsList=a.without(this.extensionsList,t),delete this.extensions[e])},n.getExtension=function(e){return this.extensions[e]},n.hasExtension=function(e){return!!this.extensions[e]},n.addGlobal=function(e,t){return this.globals[e]=t,this},n.getGlobal=function(e){if(void 0===this.globals[e])throw new Error("global not found: "+e);return this.globals[e]},n.addFilter=function(e,t,n){var r=t;return n&&this.asyncFilters.push(e),this.filters[e]=r,this},n.getFilter=function(e){if(!this.filters[e])throw new Error("filter not found: "+e);return this.filters[e]},n.addTest=function(e,t){return this.tests[e]=t,this},n.getTest=function(e){if(!this.tests[e])throw new Error("test not found: "+e);return this.tests[e]},n.resolveTemplate=function(e,t,n){return e.isRelative&&t&&e.isRelative(n)&&e.resolve?e.resolve(t,n):n},n.getTemplate=function(e,t,n,r,i){var o,s=this,c=this,l=null;if(e&&e.raw&&(e=e.raw),a.isFunction(n)&&(i=n,n=null,t=t||!1),a.isFunction(t)&&(i=t,t=!1),e instanceof T)l=e;else{if("string"!=typeof e)throw new Error("template names must be a string: "+e);for(var u=0;u0&&!this.skip(i.TOKEN_COMMA)&&this.fail("parseFrom: expected comma",e.lineno,e.colno);var a=this.parsePrimary();if("_"===a.value.charAt(0)&&this.fail("parseFrom: names starting with an underscore cannot be imported",a.lineno,a.colno),this.skipSymbol("as")){var c=this.parsePrimary();r.addChild(new o.Pair(a.lineno,a.colno,a,c))}else r.addChild(a);n=this.parseWithContext()}return new o.FromImport(e.lineno,e.colno,t,r,n)},c.parseBlock=function(){var e=this.peekToken();this.skipSymbol("block")||this.fail("parseBlock: expected block",e.lineno,e.colno);var t=new o.Block(e.lineno,e.colno);t.name=this.parsePrimary(),t.name instanceof o.Symbol||this.fail("parseBlock: variable name expected",e.lineno,e.colno),this.advanceAfterBlockEnd(e.value),t.body=this.parseUntilBlocks("endblock"),this.skipSymbol("endblock"),this.skipSymbol(t.name.value);var n=this.peekToken();return n||this.fail("parseBlock: expected endblock, got end of file"),this.advanceAfterBlockEnd(n.value),t},c.parseExtends=function(){var e="extends",t=this.peekToken();this.skipSymbol(e)||this.fail("parseTemplateRef: expected "+e);var n=new o.Extends(t.lineno,t.colno);return n.template=this.parseExpression(),this.advanceAfterBlockEnd(t.value),n},c.parseInclude=function(){var e="include",t=this.peekToken();this.skipSymbol(e)||this.fail("parseInclude: expected "+e);var n=new o.Include(t.lineno,t.colno);return n.template=this.parseExpression(),this.skipSymbol("ignore")&&this.skipSymbol("missing")&&(n.ignoreMissing=!0),this.advanceAfterBlockEnd(t.value),n},c.parseIf=function(){var e,t=this.peekToken();this.skipSymbol("if")||this.skipSymbol("elif")||this.skipSymbol("elseif")?e=new o.If(t.lineno,t.colno):this.skipSymbol("ifAsync")?e=new o.IfAsync(t.lineno,t.colno):this.fail("parseIf: expected if, elif, or elseif",t.lineno,t.colno),e.cond=this.parseExpression(),this.advanceAfterBlockEnd(t.value),e.body=this.parseUntilBlocks("elif","elseif","else","endif");var n=this.peekToken();switch(n&&n.value){case"elseif":case"elif":e.else_=this.parseIf();break;case"else":this.advanceAfterBlockEnd(),e.else_=this.parseUntilBlocks("endif"),this.advanceAfterBlockEnd();break;case"endif":e.else_=null,this.advanceAfterBlockEnd();break;default:this.fail("parseIf: expected elif, else, or endif, got end of file")}return e},c.parseSet=function(){var e=this.peekToken();this.skipSymbol("set")||this.fail("parseSet: expected set",e.lineno,e.colno);for(var t,n=new o.Set(e.lineno,e.colno,[]);(t=this.parsePrimary())&&(n.targets.push(t),this.skip(i.TOKEN_COMMA)););return this.skipValue(i.TOKEN_OPERATOR,"=")?(n.value=this.parseExpression(),this.advanceAfterBlockEnd(e.value)):this.skip(i.TOKEN_BLOCK_END)?(n.body=new o.Capture(e.lineno,e.colno,this.parseUntilBlocks("endset")),n.value=null,this.advanceAfterBlockEnd()):this.fail("parseSet: expected = or block end in set tag",e.lineno,e.colno),n},c.parseSwitch=function(){var e="switch",t="endswitch",n="case",r="default",i=this.peekToken();this.skipSymbol(e)||this.skipSymbol(n)||this.skipSymbol(r)||this.fail('parseSwitch: expected "switch," "case" or "default"',i.lineno,i.colno);var s=this.parseExpression();this.advanceAfterBlockEnd(e),this.parseUntilBlocks(n,r,t);var a,c=this.peekToken(),l=[];do{this.skipSymbol(n);var u=this.parseExpression();this.advanceAfterBlockEnd(e);var f=this.parseUntilBlocks(n,r,t);l.push(new o.Case(c.line,c.col,u,f)),c=this.peekToken()}while(c&&c.value===n);switch(c.value){case r:this.advanceAfterBlockEnd(),a=this.parseUntilBlocks(t),this.advanceAfterBlockEnd();break;case t:this.advanceAfterBlockEnd();break;default:this.fail('parseSwitch: expected "case," "default" or "endswitch," got EOF.')}return new o.Switch(i.lineno,i.colno,s,l,a)},c.parseStatement=function(){var e=this.peekToken();if(e.type!==i.TOKEN_SYMBOL&&this.fail("tag name expected",e.lineno,e.colno),this.breakOnBlocks&&-1!==a.indexOf(this.breakOnBlocks,e.value))return null;switch(e.value){case"raw":return this.parseRaw();case"verbatim":return this.parseRaw("verbatim");case"if":case"ifAsync":return this.parseIf();case"for":case"asyncEach":case"asyncAll":return this.parseFor();case"block":return this.parseBlock();case"extends":return this.parseExtends();case"include":return this.parseInclude();case"set":return this.parseSet();case"macro":return this.parseMacro();case"call":return this.parseCall();case"import":return this.parseImport();case"from":return this.parseFrom();case"filter":return this.parseFilterStatement();case"switch":return this.parseSwitch();default:if(this.extensions.length)for(var t=0;t0;){var c=s[0],l=s[1],u=s[2];u===e?r+=1:u===t&&(r-=1),0===r?(i+=l,this.tokens.backN(c.length-l.length)):i+=c}return new o.Output(a.lineno,a.colno,[new o.TemplateData(a.lineno,a.colno,i)])},c.parsePostfix=function(e){for(var t,n=this.peekToken();n;){if(n.type===i.TOKEN_LEFT_PAREN)e=new o.FunCall(n.lineno,n.colno,e,this.parseSignature());else if(n.type===i.TOKEN_LEFT_BRACKET)(t=this.parseAggregate()).children.length>1&&this.fail("invalid index"),e=new o.LookupVal(n.lineno,n.colno,e,t.children[0]);else{if(n.type!==i.TOKEN_OPERATOR||"."!==n.value)break;this.nextToken();var r=this.nextToken();r.type!==i.TOKEN_SYMBOL&&this.fail("expected name as lookup value, got "+r.value,r.lineno,r.colno),t=new o.Literal(r.lineno,r.colno,r.value),e=new o.LookupVal(n.lineno,n.colno,e,t)}n=this.peekToken()}return e},c.parseExpression=function(){return this.parseInlineIf()},c.parseInlineIf=function(){var e=this.parseOr();if(this.skipSymbol("if")){var t=this.parseOr(),n=e;(e=new o.InlineIf(e.lineno,e.colno)).body=n,e.cond=t,this.skipSymbol("else")?e.else_=this.parseOr():e.else_=null}return e},c.parseOr=function(){for(var e=this.parseAnd();this.skipSymbol("or");){var t=this.parseAnd();e=new o.Or(e.lineno,e.colno,e,t)}return e},c.parseAnd=function(){for(var e=this.parseNot();this.skipSymbol("and");){var t=this.parseNot();e=new o.And(e.lineno,e.colno,e,t)}return e},c.parseNot=function(){var e=this.peekToken();return this.skipSymbol("not")?new o.Not(e.lineno,e.colno,this.parseNot()):this.parseIn()},c.parseIn=function(){for(var e=this.parseIs();;){var t=this.nextToken();if(!t)break;var n=t.type===i.TOKEN_SYMBOL&&"not"===t.value;if(n||this.pushToken(t),!this.skipSymbol("in")){n&&this.pushToken(t);break}var r=this.parseIs();e=new o.In(e.lineno,e.colno,e,r),n&&(e=new o.Not(e.lineno,e.colno,e))}return e},c.parseIs=function(){var e=this.parseCompare();if(this.skipSymbol("is")){var t=this.skipSymbol("not"),n=this.parseCompare();e=new o.Is(e.lineno,e.colno,e,n),t&&(e=new o.Not(e.lineno,e.colno,e))}return e},c.parseCompare=function(){for(var e=["==","===","!=","!==","<",">","<=",">="],t=this.parseConcat(),n=[];;){var r=this.nextToken();if(!r)break;if(-1===e.indexOf(r.value)){this.pushToken(r);break}n.push(new o.CompareOperand(r.lineno,r.colno,this.parseConcat(),r.value))}return n.length?new o.Compare(n[0].lineno,n[0].colno,t,n):t},c.parseConcat=function(){for(var e=this.parseAdd();this.skipValue(i.TOKEN_TILDE,"~");){var t=this.parseAdd();e=new o.Concat(e.lineno,e.colno,e,t)}return e},c.parseAdd=function(){for(var e=this.parseSub();this.skipValue(i.TOKEN_OPERATOR,"+");){var t=this.parseSub();e=new o.Add(e.lineno,e.colno,e,t)}return e},c.parseSub=function(){for(var e=this.parseMul();this.skipValue(i.TOKEN_OPERATOR,"-");){var t=this.parseMul();e=new o.Sub(e.lineno,e.colno,e,t)}return e},c.parseMul=function(){for(var e=this.parseDiv();this.skipValue(i.TOKEN_OPERATOR,"*");){var t=this.parseDiv();e=new o.Mul(e.lineno,e.colno,e,t)}return e},c.parseDiv=function(){for(var e=this.parseFloorDiv();this.skipValue(i.TOKEN_OPERATOR,"/");){var t=this.parseFloorDiv();e=new o.Div(e.lineno,e.colno,e,t)}return e},c.parseFloorDiv=function(){for(var e=this.parseMod();this.skipValue(i.TOKEN_OPERATOR,"//");){var t=this.parseMod();e=new o.FloorDiv(e.lineno,e.colno,e,t)}return e},c.parseMod=function(){for(var e=this.parsePow();this.skipValue(i.TOKEN_OPERATOR,"%");){var t=this.parsePow();e=new o.Mod(e.lineno,e.colno,e,t)}return e},c.parsePow=function(){for(var e=this.parseUnary();this.skipValue(i.TOKEN_OPERATOR,"**");){var t=this.parseUnary();e=new o.Pow(e.lineno,e.colno,e,t)}return e},c.parseUnary=function(e){var t,n=this.peekToken();return t=this.skipValue(i.TOKEN_OPERATOR,"-")?new o.Neg(n.lineno,n.colno,this.parseUnary(!0)):this.skipValue(i.TOKEN_OPERATOR,"+")?new o.Pos(n.lineno,n.colno,this.parseUnary(!0)):this.parsePrimary(),e||(t=this.parseFilter(t)),t},c.parsePrimary=function(e){var t,n=this.nextToken(),r=null;if(n?n.type===i.TOKEN_STRING?t=n.value:n.type===i.TOKEN_INT?t=parseInt(n.value,10):n.type===i.TOKEN_FLOAT?t=parseFloat(n.value):n.type===i.TOKEN_BOOLEAN?"true"===n.value?t=!0:"false"===n.value?t=!1:this.fail("invalid boolean: "+n.value,n.lineno,n.colno):n.type===i.TOKEN_NONE?t=null:n.type===i.TOKEN_REGEX&&(t=new RegExp(n.value.body,n.value.flags)):this.fail("expected expression, got end of file"),void 0!==t?r=new o.Literal(n.lineno,n.colno,t):n.type===i.TOKEN_SYMBOL?r=new o.Symbol(n.lineno,n.colno,n.value):(this.pushToken(n),r=this.parseAggregate()),e||(r=this.parsePostfix(r)),r)return r;throw this.error("unexpected token: "+n.value,n.lineno,n.colno)},c.parseFilterName=function(){for(var e=this.expect(i.TOKEN_SYMBOL),t=e.value;this.skipValue(i.TOKEN_OPERATOR,".");)t+="."+this.expect(i.TOKEN_SYMBOL).value;return new o.Symbol(e.lineno,e.colno,t)},c.parseFilterArgs=function(e){return this.peekToken().type===i.TOKEN_LEFT_PAREN?this.parsePostfix(e).args.children:[]},c.parseFilter=function(e){for(;this.skip(i.TOKEN_PIPE);){var t=this.parseFilterName();e=new o.Filter(t.lineno,t.colno,t,new o.NodeList(t.lineno,t.colno,[e].concat(this.parseFilterArgs(e))))}return e},c.parseFilterStatement=function(){var e=this.peekToken();this.skipSymbol("filter")||this.fail("parseFilterStatement: expected filter");var t=this.parseFilterName(),n=this.parseFilterArgs(t);this.advanceAfterBlockEnd(e.value);var r=new o.Capture(t.lineno,t.colno,this.parseUntilBlocks("endfilter"));this.advanceAfterBlockEnd();var i=new o.Filter(t.lineno,t.colno,t,new o.NodeList(t.lineno,t.colno,[r].concat(n)));return new o.Output(t.lineno,t.colno,[i])},c.parseAggregate=function(){var e,t=this.nextToken();switch(t.type){case i.TOKEN_LEFT_PAREN:e=new o.Group(t.lineno,t.colno);break;case i.TOKEN_LEFT_BRACKET:e=new o.Array(t.lineno,t.colno);break;case i.TOKEN_LEFT_CURLY:e=new o.Dict(t.lineno,t.colno);break;default:return null}for(;;){var n=this.peekToken().type;if(n===i.TOKEN_RIGHT_PAREN||n===i.TOKEN_RIGHT_BRACKET||n===i.TOKEN_RIGHT_CURLY){this.nextToken();break}if(e.children.length>0&&(this.skip(i.TOKEN_COMMA)||this.fail("parseAggregate: expected comma after expression",t.lineno,t.colno)),e instanceof o.Dict){var r=this.parsePrimary();this.skip(i.TOKEN_COLON)||this.fail("parseAggregate: expected colon after dict key",t.lineno,t.colno);var s=this.parseExpression();e.addChild(new o.Pair(r.lineno,r.colno,r,s))}else{var a=this.parseExpression();e.addChild(a)}}return e},c.parseSignature=function(e,t){var n=this.peekToken();if(!t&&n.type!==i.TOKEN_LEFT_PAREN){if(e)return null;this.fail("expected arguments",n.lineno,n.colno)}n.type===i.TOKEN_LEFT_PAREN&&(n=this.nextToken());for(var r=new o.NodeList(n.lineno,n.colno),s=new o.KeywordArgs(n.lineno,n.colno),a=!1;;){if(n=this.peekToken(),!t&&n.type===i.TOKEN_RIGHT_PAREN){this.nextToken();break}if(t&&n.type===i.TOKEN_BLOCK_END)break;if(a&&!this.skip(i.TOKEN_COMMA))this.fail("parseSignature: expected comma after expression",n.lineno,n.colno);else{var c=this.parseExpression();this.skipValue(i.TOKEN_OPERATOR,"=")?s.addChild(new o.Pair(c.lineno,c.colno,c,this.parseExpression())):r.addChild(c)}a=!0}return s.children.length&&r.addChild(s),r},c.parseUntilBlocks=function(){for(var e=this.breakOnBlocks,t=arguments.length,n=new Array(t),r=0;r=","//","**"],M=s+this.current();switch(-1!==r.indexOf(f,M)&&(this.forward(),s=M,-1!==r.indexOf(f,M+this.current())&&(s=M+this.current(),this.forward())),s){case"(":u=_;break;case")":u=w;break;case"[":u=k;break;case"]":u=E;break;case"{":u=x;break;case"}":u=O;break;case",":u=T;break;case":":u=A;break;case"~":u=L;break;case"|":u=N;break;default:u=S}return B(u,s,t,n)}if((e=this._extractUntil(i+o)).match(/^[-+]?[0-9]+$/)){if("."===this.current()){this.forward();var F=this._extract("0123456789");return B(C,e+"."+F,t,n)}return B("int",e,t,n)}if(e.match(/^(true|false)$/))return B(j,e,t,n);if("none"===e)return B(P,e,t,n);if("null"===e)return B(P,e,t,n);if(e)return B(I,e,t,n);throw new Error("Unexpected value while parsing: "+e)}var K,D=this.tags.BLOCK_START.charAt(0)+this.tags.VARIABLE_START.charAt(0)+this.tags.COMMENT_START.charAt(0)+this.tags.COMMENT_END.charAt(0);if(this.isFinished())return null;if((e=this._extractString(this.tags.BLOCK_START+"-"))||(e=this._extractString(this.tags.BLOCK_START)))return this.in_code=!0,B(m,e,t,n);if((e=this._extractString(this.tags.VARIABLE_START+"-"))||(e=this._extractString(this.tags.VARIABLE_START)))return this.in_code=!0,B(v,e,t,n);e="";var $=!1;for(this._matches(this.tags.COMMENT_START)&&($=!0,e=this._extractString(this.tags.COMMENT_START));null!==(K=this._extractUntil(D));){if(e+=K,(this._matches(this.tags.BLOCK_START)||this._matches(this.tags.VARIABLE_START)||this._matches(this.tags.COMMENT_START))&&!$){if(this.lstripBlocks&&this._matches(this.tags.BLOCK_START)&&this.colno>0&&this.colno<=e.length){var U=e.slice(-this.colno);if(/^\s+$/.test(U)&&!(e=e.slice(0,-this.colno)).length)return this.nextToken()}break}if(this._matches(this.tags.COMMENT_END)){if(!$)throw new Error("unexpected end of comment");e+=this._extractString(this.tags.COMMENT_END);break}e+=this.current(),this.forward()}if(null===K&&$)throw new Error("expected end of comment, got end of file");return B($?b:d,e,t,n)},t._parseString=function(e){this.forward();for(var t="";!this.isFinished()&&this.current()!==e;){var n=this.current();if("\\"===n){switch(this.forward(),this.current()){case"n":t+="\n";break;case"t":t+="\t";break;case"r":t+="\r";break;default:t+=this.current()}this.forward()}else t+=n,this.forward()}return this.forward(),t},t._matches=function(e){return this.index+e.length>this.len?null:this.str.slice(this.index,this.index+e.length)===e},t._extractString=function(e){return this._matches(e)?(this.forwardN(e.length),e):null},t._extractUntil=function(e){return this._extractMatching(!0,e||"")},t._extract=function(e){return this._extractMatching(!1,e)},t._extractMatching=function(e,t){if(this.isFinished())return null;var n=t.indexOf(this.current());if(e&&-1===n||!e&&-1!==n){var r=this.current();this.forward();for(var i=t.indexOf(this.current());(e&&-1===i||!e&&-1!==i)&&!this.isFinished();)r+=this.current(),this.forward(),i=t.indexOf(this.current());return r}return""},t._extractRegex=function(e){var t=this.currentStr().match(e);return t?(this.forwardN(t[0].length),t):null},t.isFinished=function(){return this.index>=this.len},t.forwardN=function(e){for(var t=0;ts){for(var t=0,n=i.length-o;t0&&s.length>i&&!s.warned){s.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=s.length,a=c,console&&console.warn&&console.warn(a)}return e}function h(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=h.bind(r);return i.listener=n,r.wrapFn=i,i}function d(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=new Array(e.length),n=0;n0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var c=i[e];if(void 0===c)return!1;if("function"==typeof c)o(c,this,t);else{var l=c.length,u=y(c,l);for(n=0;n=0;o--)if(n[o]===t||n[o].listener===t){s=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(e,t){for(;t+1=0;r--)this.removeListener(e,t[r]);return this},a.prototype.listeners=function(e){return d(this,e,!0)},a.prototype.rawListeners=function(e){return d(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):m.call(e,t)},a.prototype.listenerCount=m,a.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(e,t,n){"use strict";var r=n(3),i=n(0),o=0;function s(){return"hole_"+o++}function a(e,t){for(var n=null,r=0;r=t)return e;var n=t-e.length,s=r.repeat(" ",n/2-n%2),a=r.repeat(" ",n/2);return i.copySafeness(e,s+e+a)},t.default=function(e,t,n){return n?e||t:void 0!==e?e:t},t.dictsort=function(e,t,n){if(!r.isObject(e))throw new r.TemplateError("dictsort filter: val must be an object");var i,o=[];for(var s in e)o.push([s,e[s]]);if(void 0===n||"key"===n)i=0;else{if("value"!==n)throw new r.TemplateError("dictsort filter: You can only sort by either key or value");i=1}return o.sort((function(e,n){var o=e[i],s=n[i];return t||(r.isString(o)&&(o=o.toUpperCase()),r.isString(s)&&(s=s.toUpperCase())),o>s?1:o===s?0:-1})),o},t.dump=function(e,t){return JSON.stringify(e,null,t)},t.escape=function(e){return e instanceof i.SafeString?e:(e=null==e?"":e,i.markSafe(r.escape(e.toString())))},t.safe=function(e){return e instanceof i.SafeString?e:(e=null==e?"":e,i.markSafe(e.toString()))},t.first=function(e){return e[0]},t.forceescape=function(e){return e=null==e?"":e,i.markSafe(r.escape(e.toString()))},t.groupby=function(e,t){return r.groupBy(e,t,this.env.opts.throwOnUndefined)},t.indent=function(e,t,n){if(""===(e=o(e,"")))return"";t=t||4;var s=e.split("\n"),a=r.repeat(" ",t),c=s.map((function(e,t){return 0!==t||n?""+a+e:e})).join("\n");return i.copySafeness(e,c)},t.join=function(e,t,n){return t=t||"",n&&(e=r.map(e,(function(e){return e[n]}))),e.join(t)},t.last=function(e){return e[e.length-1]},t.length=function(e){var t=o(e,"");return void 0!==t?"function"==typeof Map&&t instanceof Map||"function"==typeof Set&&t instanceof Set?t.size:!r.isObject(t)||t instanceof i.SafeString?t.length:r.keys(t).length:0},t.list=c,t.lower=function(e){return(e=o(e,"")).toLowerCase()},t.nl2br=function(e){return null==e?"":i.copySafeness(e,e.replace(/\r\n|\n/g,"
\n"))},t.random=function(e){return e[Math.floor(Math.random()*e.length)]},t.reject=l(!1),t.rejectattr=function(e,t){return e.filter((function(e){return!e[t]}))},t.select=l(!0),t.selectattr=function(e,t){return e.filter((function(e){return!!e[t]}))},t.replace=function(e,t,n,r){var o=e;if(t instanceof RegExp)return e.replace(t,n);void 0===r&&(r=-1);var s="";if("number"==typeof t)t=""+t;else if("string"!=typeof t)return e;if("number"==typeof e&&(e=""+e),"string"!=typeof e&&!(e instanceof i.SafeString))return e;if(""===t)return s=n+e.split("").join(n)+n,i.copySafeness(e,s);var a=e.indexOf(t);if(0===r||-1===a)return e;for(var c=0,l=0;a>-1&&(-1===r||l=i&&u.push(n),o.push(u)}return o},t.sum=function(e,t,n){return void 0===n&&(n=0),t&&(e=r.map(e,(function(e){return e[t]}))),n+e.reduce((function(e,t){return e+t}),0)},t.sort=i.makeMacro(["value","reverse","case_sensitive","attribute"],[],(function(e,t,n,i){var o=this,s=r.map(e,(function(e){return e})),a=r.getAttrGetter(i);return s.sort((function(e,s){var c=i?a(e):e,l=i?a(s):s;if(o.env.opts.throwOnUndefined&&i&&(void 0===c||void 0===l))throw new TypeError('sort: attribute "'+i+'" resolved to undefined');return!n&&r.isString(c)&&r.isString(l)&&(c=c.toLowerCase(),l=l.toLowerCase()),cl?t?-1:1:0})),s})),t.string=function(e){return i.copySafeness(e,e)},t.striptags=function(e,t){var n,r=u((e=o(e,"")).replace(/<\/?([a-z][a-z0-9]*)\b[^>]*>|/gi,""));return n=t?r.replace(/^ +| +$/gm,"").replace(/ +/g," ").replace(/(\r\n)/g,"\n").replace(/\n\n\n+/g,"\n\n"):r.replace(/\s+/gi," "),i.copySafeness(e,n)},t.title=function(e){var t=(e=o(e,"")).split(" ").map((function(e){return a(e)}));return i.copySafeness(e,t.join(" "))},t.trim=u,t.truncate=function(e,t,n,r){var s=e;if(t=t||255,(e=o(e,"")).length<=t)return e;if(n)e=e.substring(0,t);else{var a=e.lastIndexOf(" ",t);-1===a&&(a=t),e=e.substring(0,a)}return e+=null!=r?r:"...",i.copySafeness(s,e)},t.upper=function(e){return(e=o(e,"")).toUpperCase()},t.urlencode=function(e){var t=encodeURIComponent;return r.isString(e)?t(e):(r.isArray(e)?e:r._entries(e)).map((function(e){var n=e[0],r=e[1];return t(n)+"="+t(r)})).join("&")};var f=/^(?:\(|<|<)?(.*?)(?:\.|,|\)|\n|>)?$/,h=/^[\w.!#$%&'*+\-\/=?\^`{|}~]+@[a-z\d\-]+(\.[a-z\d\-]+)+$/i,p=/^https?:\/\/.*$/,d=/^www\./,m=/\.(?:org|net|com)(?:\:|\/|$)/;t.urlize=function(e,t,n){s(t)&&(t=1/0);var r=!0===n?' rel="nofollow"':"";return e.split(/(\s+)/).filter((function(e){return e&&e.length})).map((function(e){var n=e.match(f),i=n?n[1]:e,o=i.substr(0,t);return p.test(i)?'"+o+"":d.test(i)?'"+o+"":h.test(i)?''+i+"":m.test(i)?'"+o+"":e})).join("")},t.wordcount=function(e){var t=(e=o(e,""))?e.match(/\w+/g):null;return t?t.length:null},t.float=function(e,t){var n=parseFloat(e);return s(n)?t:n};var y=i.makeMacro(["value","default","base"],[],(function(e,t,n){void 0===n&&(n=10);var r=parseInt(e,n);return s(r)?t:r}));t.int=y,t.d=t.default,t.e=t.escape},function(e,t,n){"use strict";function r(e,t){return r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},r(e,t)}var i=function(e){var t,n;function i(t){var n;return(n=e.call(this)||this).precompiled=t||{},n}return n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,r(t,n),i.prototype.getSource=function(e){return this.precompiled[e]?{src:{type:"code",obj:this.precompiled[e]},path:e}:null},i}(n(6));e.exports={PrecompiledLoader:i}},function(e,t,n){"use strict";var r=n(2).SafeString;t.callable=function(e){return"function"==typeof e},t.defined=function(e){return void 0!==e},t.divisibleby=function(e,t){return e%t==0},t.escaped=function(e){return e instanceof r},t.equalto=function(e,t){return e===t},t.eq=t.equalto,t.sameas=t.equalto,t.even=function(e){return e%2==0},t.falsy=function(e){return!e},t.ge=function(e,t){return e>=t},t.greaterthan=function(e,t){return e>t},t.gt=t.greaterthan,t.le=function(e,t){return e<=t},t.lessthan=function(e,t){return e0)for(var i=e;it;o+=n)r.push(o);return r},cycler:function(){return e=Array.prototype.slice.call(arguments),t=-1,{current:null,reset:function(){t=-1,this.current=null},next:function(){return++t>=e.length&&(t=0),this.current=e[t],this.current}};var e,t},joiner:function(e){return function(e){e=e||",";var t=!0;return function(){var n=t?"":e;return t=!1,n}}(e)}}}},function(e,t,n){var r=n(4);e.exports=function(e,t){function n(e,t){if(this.name=e,this.path=e,this.defaultEngine=t.defaultEngine,this.ext=r.extname(e),!this.ext&&!this.defaultEngine)throw new Error("No default engine was specified and no extension was provided.");this.ext||(this.name+=this.ext=("."!==this.defaultEngine[0]?".":"")+this.defaultEngine)}return n.prototype.render=function(t,n){e.render(this.name,t,n)},t.set("view",n),t.set("nunjucksEnv",e),e}},function(e,t,n){"use strict";var r=n(4),i=n(4),o=n(0)._prettifyError,s=n(5),a=n(7).Environment,c=n(24);function l(e,t){return!!Array.isArray(t)&&t.some((function(t){return e.match(t)}))}function u(e,t){(t=t||{}).isString=!0;var n=t.env||new a([]),r=t.wrapper||c;if(!t.name)throw new Error('the "name" option is required when compiling a string');return r([f(e,t.name,n)],t)}function f(e,t,n){var r,i=(n=n||new a([])).asyncFilters,c=n.extensionsList;t=t.replace(/\\/g,"/");try{r=s.compile(e,i,c,t,n.opts)}catch(e){throw o(t,!1,e)}return{name:t,template:r}}e.exports={precompile:function(e,t){var n=(t=t||{}).env||new a([]),o=t.wrapper||c;if(t.isString)return u(e,t);var s=r.existsSync(e)&&r.statSync(e),h=[],p=[];if(s.isFile())h.push(f(r.readFileSync(e,"utf-8"),t.name||e,n));else if(s.isDirectory()){!function n(o){r.readdirSync(o).forEach((function(s){var a=i.join(o,s),c=a.substr(i.join(e,"/").length),u=r.statSync(a);u&&u.isDirectory()?l(c+="/",t.exclude)||n(a):l(c,t.include)&&p.push(a)}))}(e);for(var d=0;de.length||i>0&&s>=r||i<0&&s<=r);s+=i)o.push(n.memberLookup(e,s));return o}function p(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var d={pop:function(e){if(void 0===e)return this.pop();if(e>=this.length||e<0)throw new Error("KeyError");return this.splice(e,1)},append:function(e){return this.push(e)},remove:function(e){for(var t=0;t{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};(()=>{"use strict";n.r(r),n.d(r,{default:()=>Ur});var e=n(181);function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:{available:!1};return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),(e=i.call(this,t)).available=!!t.available,e}return t=o,Object.defineProperty(t,"prototype",{writable:!1}),t}(e.ComponentDefinition);function y(e){return y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},y(e)}function v(e,t){return v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},v(e,t)}function g(e){return g=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},g(e)}const b=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&v(e,t)}(o,e);var t,n,r,i=(n=o,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=g(n);if(r){var i=g(this).constructor;e=Reflect.construct(t,arguments,i)}else e=t.apply(this,arguments);return function(e,t){if(t&&("object"===y(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,e)});function o(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{action:null};return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),(e=i.call(this,t)).action=t.action||null,e}return t=o,Object.defineProperty(t,"prototype",{writable:!1}),t}(e.ComponentDefinition);function _(e){return _="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_(e)}function w(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function k(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n!!e&&"object"==typeof e&&e[$]===R,V=e=>!!e&&"object"==typeof e&&e[$]===B,q=e=>!!e&&"object"==typeof e&&e[$]===M,z=e=>!!e&&"object"==typeof e&&e[$]===F,G=e=>!!e&&"object"==typeof e&&e[$]===K,W=e=>!!e&&"object"==typeof e&&e[$]===D;function Y(e){if(e&&"object"==typeof e)switch(e[$]){case M:case D:return!0}return!1}function J(e){if(e&&"object"==typeof e)switch(e[$]){case R:case M:case K:case D:return!0}return!1}const H=e=>(G(e)||Y(e))&&!!e.anchor;class X{constructor(e){Object.defineProperty(this,$,{value:e})}clone(){const e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}}const Q=Symbol("break visit"),Z=Symbol("skip children"),ee=Symbol("remove node");function te(e,t){const n=oe(t);V(e)?ne(null,e.contents,n,Object.freeze([e]))===ee&&(e.contents=null):ne(null,e,n,Object.freeze([]))}function ne(e,t,n,r){const i=se(e,t,n,r);if(J(i)||z(i))return ae(e,r,i),ne(e,i,n,r);if("symbol"!=typeof i)if(Y(t)){r=Object.freeze(r.concat(t));for(let e=0;e"!==e[e.length-1]&&t("Verbatim tags must end with a >"),n)}const[,n,r]=e.match(/^(.*!)([^!]*)$/);r||t(`The ${e} tag has no suffix`);const i=this.tags[n];return i?i+decodeURIComponent(r):"!"===n?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(const[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+e.substring(n.length).replace(/[!,[\]{}]/g,(e=>ce[e]));return"!"===e[0]?e:`!<${e}>`}toString(e){const t=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags);let r;if(e&&n.length>0&&J(e.contents)){const t={};te(e.contents,((e,n)=>{J(n)&&n.tag&&(t[n.tag]=!0)})),r=Object.keys(t)}else r=[];for(const[i,o]of n)"!!"===i&&"tag:yaml.org,2002:"===o||e&&!r.some((e=>e.startsWith(o)))||t.push(`%TAG ${i} ${o}`);return t.join("\n")}}function ue(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){const t=JSON.stringify(e);throw new Error(`Anchor must not contain whitespace or control characters: ${t}`)}return!0}function fe(e){const t=new Set;return te(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function he(e,t){for(let n=1;;++n){const r=`${e}${n}`;if(!t.has(r))return r}}le.defaultYaml={explicit:!1,version:"1.2"},le.defaultTags={"!!":"tag:yaml.org,2002:"};class pe extends X{constructor(e){super(R),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e){let t;return te(e,{Node:(e,n)=>{if(n===this)return te.BREAK;n.anchor===this.source&&(t=n)}}),t}toJSON(e,t){if(!t)return{source:this.source};const{anchors:n,doc:r,maxAliasCount:i}=t,o=this.resolve(r);if(!o){const e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(e)}const s=n.get(o);if(!s||void 0===s.res)throw new ReferenceError("This should not happen: Alias anchor was not resolved?");if(i>=0&&(s.count+=1,0===s.aliasCount&&(s.aliasCount=de(r,o,n)),s.count*s.aliasCount>i))throw new ReferenceError("Excessive alias count indicates a resource exhaustion attack");return s.res}toString(e,t,n){const r=`*${this.source}`;if(e){if(ue(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){const e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(e)}if(e.implicitKey)return`${r} `}return r}}function de(e,t,n){if(U(t)){const r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(Y(t)){let r=0;for(const i of t.items){const t=de(e,i,n);t>r&&(r=t)}return r}if(z(t)){const r=de(e,t.key,n),i=de(e,t.value,n);return Math.max(r,i)}return 1}function me(e,t,n){if(Array.isArray(e))return e.map(((e,t)=>me(e,String(t),n)));if(e&&"function"==typeof e.toJSON){if(!n||!H(e))return e.toJSON(t,n);const r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,delete n.onCreate};const i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return"bigint"!=typeof e||n?.keep?e:Number(e)}const ye=e=>!e||"function"!=typeof e&&"object"!=typeof e;class ve extends X{constructor(e){super(K),this.value=e}toJSON(e,t){return t?.keep?this.value:me(this.value,e,t)}toString(){return String(this.value)}}ve.BLOCK_FOLDED="BLOCK_FOLDED",ve.BLOCK_LITERAL="BLOCK_LITERAL",ve.PLAIN="PLAIN",ve.QUOTE_DOUBLE="QUOTE_DOUBLE",ve.QUOTE_SINGLE="QUOTE_SINGLE";const ge="tag:yaml.org,2002:";function be(e,t,n){if(V(e)&&(e=e.contents),J(e))return e;if(z(e)){const t=n.schema[M].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||"undefined"!=typeof BigInt&&e instanceof BigInt)&&(e=e.valueOf());const{aliasDuplicateObjects:r,onAnchor:i,onTagObj:o,schema:s,sourceObjects:a}=n;let c;if(r&&e&&"object"==typeof e){if(c=a.get(e),c)return c.anchor||(c.anchor=i(e)),new pe(c.anchor);c={anchor:null,node:null},a.set(e,c)}t?.startsWith("!!")&&(t=ge+t.slice(2));let l=function(e,t,n){if(t){const e=n.filter((e=>e.tag===t)),r=e.find((e=>!e.format))??e[0];if(!r)throw new Error(`Tag ${t} not found`);return r}return n.find((t=>t.identify?.(e)&&!t.format))}(e,t,s.tags);if(!l){if(e&&"function"==typeof e.toJSON&&(e=e.toJSON()),!e||"object"!=typeof e){const t=new ve(e);return c&&(c.node=t),t}l=e instanceof Map?s[M]:Symbol.iterator in Object(e)?s[D]:s[M]}o&&(o(l),delete n.onTagObj);const u=l?.createNode?l.createNode(n.schema,e,n):new ve(e);return t&&(u.tag=t),c&&(c.node=u),u}function _e(e,t,n){let r=n;for(let e=t.length-1;e>=0;--e){const n=t[e];if("number"==typeof n&&Number.isInteger(n)&&n>=0){const e=[];e[n]=r,r=e}else r=new Map([[n,r]])}return be(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}const we=e=>null==e||"object"==typeof e&&!!e[Symbol.iterator]().next().done;class ke extends X{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){const t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map((t=>J(t)||z(t)?t.clone(e):t)),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(we(e))this.add(t);else{const[n,...r]=e,i=this.get(n,!0);if(Y(i))i.addIn(r,t);else{if(void 0!==i||!this.schema)throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`);this.set(n,_e(this.schema,r,t))}}}deleteIn(e){const[t,...n]=e;if(0===n.length)return this.delete(t);const r=this.get(t,!0);if(Y(r))return r.deleteIn(n);throw new Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){const[n,...r]=e,i=this.get(n,!0);return 0===r.length?!t&&G(i)?i.value:i:Y(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every((t=>{if(!z(t))return!1;const n=t.value;return null==n||e&&G(n)&&null==n.value&&!n.commentBefore&&!n.comment&&!n.tag}))}hasIn(e){const[t,...n]=e;if(0===n.length)return this.has(t);const r=this.get(t,!0);return!!Y(r)&&r.hasIn(n)}setIn(e,t){const[n,...r]=e;if(0===r.length)this.set(n,t);else{const e=this.get(n,!0);if(Y(e))e.setIn(r,t);else{if(void 0!==e||!this.schema)throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`);this.set(n,_e(this.schema,r,t))}}}}ke.maxFlowStringSingleLineLength=60;const Ee=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function xe(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}const Oe=(e,t,n)=>e.endsWith("\n")?xe(n,t):n.includes("\n")?"\n"+xe(n,t):(e.endsWith(" ")?"":" ")+n,Se="flow",Te="block",Ae="quoted";function Le(e,t,n="flow",{indentAtStart:r,lineWidth:i=80,minContentWidth:o=20,onFold:s,onOverflow:a}={}){if(!i||i<0)return e;const c=Math.max(1+o,1+i-t.length);if(e.length<=c)return e;const l=[],u={};let f,h,p=i-t.length;"number"==typeof r&&(r>i-Math.max(2,o)?l.push(0):p=i-r);let d=!1,m=-1,y=-1,v=-1;n===Te&&(m=Ne(e,m),-1!==m&&(p=m+c));for(let t;t=e[m+=1];){if(n===Ae&&"\\"===t){switch(y=m,e[m+1]){case"x":m+=3;break;case"u":m+=5;break;case"U":m+=9;break;default:m+=1}v=m}if("\n"===t)n===Te&&(m=Ne(e,m)),p=m+c,f=void 0;else{if(" "===t&&h&&" "!==h&&"\n"!==h&&"\t"!==h){const t=e[m+1];t&&" "!==t&&"\n"!==t&&"\t"!==t&&(f=m)}if(m>=p)if(f)l.push(f),p=f+c,f=void 0;else if(n===Ae){for(;" "===h||"\t"===h;)h=t,t=e[m+=1],d=!0;const n=m>v+1?m-2:y-1;if(u[n])return e;l.push(n),u[n]=!0,p=n+c,f=void 0}else d=!0}h=t}if(d&&a&&a(),0===l.length)return e;s&&s();let g=e.slice(0,l[0]);for(let r=0;r({indentAtStart:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),je=e=>/^(%|---|\.\.\.)/m.test(e);function Pe(e,t){const n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;const{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,o=t.indent||(je(e)?" ":"");let s="",a=0;for(let e=0,t=n[e];t;t=n[++e])if(" "===t&&"\\"===n[e+1]&&"n"===n[e+2]&&(s+=n.slice(a,e)+"\\ ",e+=1,a=e,t="\\"),"\\"===t)switch(n[e+1]){case"u":{s+=n.slice(a,e);const t=n.substr(e+2,4);switch(t){case"0000":s+="\\0";break;case"0007":s+="\\a";break;case"000b":s+="\\v";break;case"001b":s+="\\e";break;case"0085":s+="\\N";break;case"00a0":s+="\\_";break;case"2028":s+="\\L";break;case"2029":s+="\\P";break;default:"00"===t.substr(0,2)?s+="\\x"+t.substr(2):s+=n.substr(e,6)}e+=5,a=e+1}break;case"n":if(r||'"'===n[e+2]||n.lengthr)return!0;if(n=t+1,i-n<=r)return!1}return!0}(n,c,l.length));if(!n)return u?"|\n":">\n";let f,h;for(h=n.length;h>0;--h){const e=n[h-1];if("\n"!==e&&"\t"!==e&&" "!==e)break}let p=n.substring(h);const d=p.indexOf("\n");-1===d?f="-":n===p||d!==p.length-1?(f="+",o&&o()):f="",p&&(n=n.slice(0,-p.length),"\n"===p[p.length-1]&&(p=p.slice(0,-1)),p=p.replace(/\n+(?!\n|$)/g,`$&${l}`));let m,y=!1,v=-1;for(m=0;m")+(y?l?"2":"1":"")+f;return e&&(b+=" "+a(e.replace(/ ?[\r\n]+/g," ")),i&&i()),u?`${b}\n${l}${g}${n=n.replace(/\n+/g,`$&${l}`)}${p}`:`${b}\n${l}${Le(`${g}${n=n.replace(/\n+/g,"\n$&").replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`)}${p}`,l,Te,Ce(r))}`}function Me(e,t,n,r){const{implicitKey:i,inFlow:o}=t,s="string"==typeof e.value?e:Object.assign({},e,{value:String(e.value)});let{type:a}=e;a!==ve.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=ve.QUOTE_DOUBLE);const c=e=>{switch(e){case ve.BLOCK_FOLDED:case ve.BLOCK_LITERAL:return i||o?Re(s.value,t):Be(s,t,n,r);case ve.QUOTE_DOUBLE:return Pe(s.value,t);case ve.QUOTE_SINGLE:return Ie(s.value,t);case ve.PLAIN:return function(e,t,n,r){const{type:i,value:o}=e,{actualString:s,implicitKey:a,indent:c,indentStep:l,inFlow:u}=t;if(a&&/[\n[\]{},]/.test(o)||u&&/[[\]{},]/.test(o))return Re(o,t);if(!o||/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||u||!o.includes("\n")?Re(o,t):Be(e,t,n,r);if(!a&&!u&&i!==ve.PLAIN&&o.includes("\n"))return Be(e,t,n,r);if(je(o)){if(""===c)return t.forceBlockIndent=!0,Be(e,t,n,r);if(a&&c===l)return Re(o,t)}const f=o.replace(/\n+/g,`$&\n${c}`);if(s){const e=e=>e.default&&"tag:yaml.org,2002:str"!==e.tag&&e.test?.test(f),{compat:n,tags:r}=t.doc.schema;if(r.some(e)||n?.some(e))return Re(o,t)}return a?f:Le(f,c,Se,Ce(t))}(s,t,n,r);default:return null}};let l=c(a);if(null===l){const{defaultKeyType:e,defaultStringType:n}=t.options,r=i&&e||n;if(l=c(r),null===l)throw new Error(`Unsupported default string type ${r}`)}return l}function Fe(e,t){const n=Object.assign({blockQuote:!0,commentString:Ee,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trueStr:"true",verifyAliasOrder:!0},e.schema.toStringOptions,t);let r;switch(n.collectionStyle){case"block":r=!1;break;case"flow":r=!0;break;default:r=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:"number"==typeof n.indent?" ".repeat(n.indent):" ",inFlow:r,options:n}}function Ke(e,t,n,r){if(z(e))return e.toString(t,n,r);if(U(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw new TypeError("Cannot stringify circular structure without alias nodes");t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let i;const o=J(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i||(i=function(e,t){if(t.tag){const n=e.filter((e=>e.tag===t.tag));if(n.length>0)return n.find((e=>e.format===t.format))??n[0]}let n,r;if(G(t)){r=t.value;const i=e.filter((e=>e.identify?.(r)));n=i.find((e=>e.format===t.format))??i.find((e=>!e.format))}else r=t,n=e.find((e=>e.nodeClass&&r instanceof e.nodeClass));if(!n)throw new Error(`Tag not resolved for ${r?.constructor?.name??typeof r} value`);return n}(t.doc.schema.tags,o));const s=function(e,t,{anchors:n,doc:r}){if(!r.directives)return"";const i=[],o=(G(e)||Y(e))&&e.anchor;o&&ue(o)&&(n.add(o),i.push(`&${o}`));const s=e.tag?e.tag:t.default?null:t.tag;return s&&i.push(r.directives.tagString(s)),i.join(" ")}(o,i,t);s.length>0&&(t.indentAtStart=(t.indentAtStart??0)+s.length+1);const a="function"==typeof i.stringify?i.stringify(o,t,n,r):G(o)?Me(o,t,n,r):o.toString(t,n,r);return s?G(o)||"{"===a[0]||"["===a[0]?`${s} ${a}`:`${s}\n${t.indent}${a}`:a}function De(e,t){"debug"!==e&&"warn"!==e||("undefined"!=typeof process&&process.emitWarning?process.emitWarning(t):console.warn(t))}function $e(e,t,{key:n,value:r}){if(e?.doc.schema.merge&&Ue(n))if(r=U(r)?r.resolve(e.doc):r,W(r))for(const n of r.items)Ve(e,t,n);else if(Array.isArray(r))for(const n of r)Ve(e,t,n);else Ve(e,t,r);else{const i=me(n,"",e);if(t instanceof Map)t.set(i,me(r,i,e));else if(t instanceof Set)t.add(i);else{const o=function(e,t,n){if(null===t)return"";if("object"!=typeof t)return String(t);if(J(e)&&n&&n.doc){const t=Fe(n.doc,{});t.anchors=new Set;for(const e of n.anchors.keys())t.anchors.add(e.anchor);t.inFlow=!0,t.inStringifyKey=!0;const r=e.toString(t);if(!n.mapKeyWarned){let e=JSON.stringify(r);e.length>40&&(e=e.substring(0,36)+'..."'),De(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${e}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return r}return JSON.stringify(t)}(n,i,e),s=me(r,o,e);o in t?Object.defineProperty(t,o,{value:s,writable:!0,enumerable:!0,configurable:!0}):t[o]=s}}return t}const Ue=e=>"<<"===e||G(e)&&"<<"===e.value&&(!e.type||e.type===ve.PLAIN);function Ve(e,t,n){const r=e&&U(n)?n.resolve(e.doc):n;if(!q(r))throw new Error("Merge sources must be maps or map aliases");const i=r.toJSON(null,e,Map);for(const[e,n]of i)t instanceof Map?t.has(e)||t.set(e,n):t instanceof Set?t.add(e):Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0});return t}function qe(e,t,n){const r=be(e,void 0,n),i=be(t,void 0,n);return new ze(r,i)}class ze{constructor(e,t=null){Object.defineProperty(this,$,{value:F}),this.key=e,this.value=t}clone(e){let{key:t,value:n}=this;return J(t)&&(t=t.clone(e)),J(n)&&(n=n.clone(e)),new ze(t,n)}toJSON(e,t){return $e(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?function({key:e,value:t},n,r,i){const{allNullValues:o,doc:s,indent:a,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:f}}=n;let h=J(e)&&e.comment||null;if(f){if(h)throw new Error("With simple keys, key nodes cannot have comments");if(Y(e))throw new Error("With simple keys, collection cannot be used as a key value")}let p=!f&&(!e||h&&null==t&&!n.inFlow||Y(e)||(G(e)?e.type===ve.BLOCK_FOLDED||e.type===ve.BLOCK_LITERAL:"object"==typeof e));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(f||!o),indent:a+c});let d,m,y,v=!1,g=!1,b=Ke(e,n,(()=>v=!0),(()=>g=!0));if(!p&&!n.inFlow&&b.length>1024){if(f)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(n.inFlow){if(o||null==t)return v&&r&&r(),""===b?"?":p?`? ${b}`:b}else if(o&&!f||null==t&&p)return b=`? ${b}`,h&&!v?b+=Oe(b,n.indent,l(h)):g&&i&&i(),b;v&&(h=null),p?(h&&(b+=Oe(b,n.indent,l(h))),b=`? ${b}\n${a}:`):(b=`${b}:`,h&&(b+=Oe(b,n.indent,l(h)))),J(t)?(d=!!t.spaceBefore,m=t.commentBefore,y=t.comment):(d=!1,m=null,y=null,t&&"object"==typeof t&&(t=s.createNode(t))),n.implicitKey=!1,p||h||!G(t)||(n.indentAtStart=b.length+1),g=!1,u||!(c.length>=2)||n.inFlow||p||!W(t)||t.flow||t.tag||t.anchor||(n.indent=n.indent.substring(2));let _=!1;const w=Ke(t,n,(()=>_=!0),(()=>g=!0));let k=" ";if(h||d||m)k=d?"\n":"",m&&(k+=`\n${xe(l(m),n.indent)}`),""!==w||n.inFlow?k+=`\n${n.indent}`:"\n"===k&&(k="\n\n");else if(!p&&Y(t)){const e=w[0],r=w.indexOf("\n"),i=-1!==r,o=n.inFlow??t.flow??0===t.items.length;if(i||!o){let t=!1;if(i&&("&"===e||"!"===e)){let n=w.indexOf(" ");"&"===e&&-1!==n&&ns=null),(()=>f=!0));s&&(a+=Oe(a,o,l(s))),f&&s&&(f=!1),h.push(r+a)}let p;if(0===h.length)p=i.start+i.end;else{p=h[0];for(let e=1;eo=null));eh||s.includes("\n"))&&(f=!0),p.push(s),h=p.length}let d;const{start:m,end:y}=r;if(0===p.length)d=m+y;else if(f||(f=p.reduce(((e,t)=>e+t.length+2),2)>ke.maxFlowStringSingleLineLength),f){d=m;for(const e of p)d+=e?`\n${a}${s}${e}`:"\n";d+=`\n${s}${y}`}else d=`${m}${c}${p.join(" ")}${c}${y}`;return e&&(d+=Oe(d,l(e),s),o&&o()),d}function Je({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,"")),r){const i=xe(t(r),e);n.push(i.trimStart())}}function He(e,t){const n=G(t)?t.value:t;for(const r of e)if(z(r)){if(r.key===t||r.key===n)return r;if(G(r.key)&&r.key.value===n)return r}}class Xe extends ke{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(M,e),this.items=[]}add(e,t){let n;n=z(e)?e:e&&"object"==typeof e&&"key"in e?new ze(e.key,e.value):new ze(e,e?.value);const r=He(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw new Error(`Key ${n.key} already set`);G(r.value)&&ye(n.value)?r.value.value=n.value:r.value=n.value}else if(i){const e=this.items.findIndex((e=>i(n,e)<0));-1===e?this.items.push(n):this.items.splice(e,0,n)}else this.items.push(n)}delete(e){const t=He(this.items,e);return!!t&&this.items.splice(this.items.indexOf(t),1).length>0}get(e,t){const n=He(this.items,e),r=n?.value;return(!t&&G(r)?r.value:r)??void 0}has(e){return!!He(this.items,e)}set(e,t){this.add(new ze(e,t),!0)}toJSON(e,t,n){const r=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(r);for(const e of this.items)$e(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(const e of this.items)if(!z(e))throw new Error(`Map items must all be pairs; found ${JSON.stringify(e)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Ge(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:t})}}const Qe={collection:"map",createNode:function(e,t,n){const{keepUndefined:r,replacer:i}=n,o=new Xe(e),s=(e,s)=>{if("function"==typeof i)s=i.call(t,e,s);else if(Array.isArray(i)&&!i.includes(e))return;(void 0!==s||r)&&o.items.push(qe(e,s,n))};if(t instanceof Map)for(const[e,n]of t)s(e,n);else if(t&&"object"==typeof t)for(const e of Object.keys(t))s(e,t[e]);return"function"==typeof e.sortMapEntries&&o.items.sort(e.sortMapEntries),o},default:!0,nodeClass:Xe,tag:"tag:yaml.org,2002:map",resolve:(e,t)=>(q(e)||t("Expected a mapping for this tag"),e)};class Ze extends ke{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(D,e),this.items=[]}add(e){this.items.push(e)}delete(e){const t=et(e);return"number"==typeof t&&this.items.splice(t,1).length>0}get(e,t){const n=et(e);if("number"!=typeof n)return;const r=this.items[n];return!t&&G(r)?r.value:r}has(e){const t=et(e);return"number"==typeof t&&t=0?t:null}const tt={collection:"seq",createNode:function(e,t,n){const{replacer:r}=n,i=new Ze(e);if(t&&Symbol.iterator in Object(t)){let e=0;for(let o of t){if("function"==typeof r){const n=t instanceof Set?o:String(e++);o=r.call(t,n,o)}i.items.push(be(o,void 0,n))}}return i},default:!0,nodeClass:Ze,tag:"tag:yaml.org,2002:seq",resolve:(e,t)=>(W(e)||t("Expected a sequence for this tag"),e)},nt={identify:e=>"string"==typeof e,default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:(e,t,n,r)=>Me(e,t=Object.assign({actualString:!0},t),n,r)},rt={identify:e=>null==e,createNode:()=>new ve(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new ve(null),stringify:({source:e},t)=>"string"==typeof e&&rt.test.test(e)?e:t.options.nullStr},it={identify:e=>"boolean"==typeof e,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new ve("t"===e[0]||"T"===e[0]),stringify:({source:e,value:t},n)=>e&&it.test.test(e)&&t===("t"===e[0]||"T"===e[0])?e:t?n.options.trueStr:n.options.falseStr};function ot({format:e,minFractionDigits:t,tag:n,value:r}){if("bigint"==typeof r)return String(r);const i="number"==typeof r?r:Number(r);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let o=JSON.stringify(r);if(!e&&t&&(!n||"tag:yaml.org,2002:float"===n)&&/^\d/.test(o)){let e=o.indexOf(".");e<0&&(e=o.length,o+=".");let n=t-(o.length-e-1);for(;n-- >0;)o+="0"}return o}const st={identify:e=>"number"==typeof e,default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF|nan|NaN|NAN))$/,resolve:e=>"nan"===e.slice(-3).toLowerCase()?NaN:"-"===e[0]?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:ot},at={identify:e=>"number"==typeof e,default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){const t=Number(e.value);return isFinite(t)?t.toExponential():ot(e)}},ct={identify:e=>"number"==typeof e,default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){const t=new ve(parseFloat(e)),n=e.indexOf(".");return-1!==n&&"0"===e[e.length-1]&&(t.minFractionDigits=e.length-n-1),t},stringify:ot},lt=e=>"bigint"==typeof e||Number.isInteger(e),ut=(e,t,n,{intAsBigInt:r})=>r?BigInt(e):parseInt(e.substring(t),n);function ft(e,t,n){const{value:r}=e;return lt(r)&&r>=0?n+r.toString(t):ot(e)}const ht={identify:e=>lt(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,n)=>ut(e,2,8,n),stringify:e=>ft(e,8,"0o")},pt={identify:lt,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>ut(e,0,10,n),stringify:ot},dt={identify:e=>lt(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>ut(e,2,16,n),stringify:e=>ft(e,16,"0x")},mt=[Qe,tt,nt,rt,it,ht,pt,dt,st,at,ct];function yt(e){return"bigint"==typeof e||Number.isInteger(e)}const vt=({value:e})=>JSON.stringify(e),gt=[Qe,tt].concat([{identify:e=>"string"==typeof e,default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:vt},{identify:e=>null==e,createNode:()=>new ve(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:vt},{identify:e=>"boolean"==typeof e,default:!0,tag:"tag:yaml.org,2002:bool",test:/^true|false$/,resolve:e=>"true"===e,stringify:vt},{identify:yt,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>yt(e)?e.toString():JSON.stringify(e)},{identify:e=>"number"==typeof e,default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:vt}],{default:!0,tag:"",test:/^/,resolve:(e,t)=>(t(`Unresolved plain scalar ${JSON.stringify(e)}`),e)}),bt={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if("function"==typeof Buffer)return Buffer.from(e,"base64");if("function"==typeof atob){const t=atob(e.replace(/[\n\r]/g,"")),n=new Uint8Array(t.length);for(let e=0;e1&&t("Each pair must have its own sequence indicator");const e=r.items[0]||new ze(new ve(null));if(r.commentBefore&&(e.key.commentBefore=e.key.commentBefore?`${r.commentBefore}\n${e.key.commentBefore}`:r.commentBefore),r.comment){const t=e.value??e.key;t.comment=t.comment?`${r.comment}\n${t.comment}`:r.comment}r=e}e.items[n]=z(r)?r:new ze(r)}}else t("Expected a sequence for this tag");return e}function wt(e,t,n){const{replacer:r}=n,i=new Ze(e);i.tag="tag:yaml.org,2002:pairs";let o=0;if(t&&Symbol.iterator in Object(t))for(let e of t){let s,a;if("function"==typeof r&&(e=r.call(t,String(o++),e)),Array.isArray(e)){if(2!==e.length)throw new TypeError(`Expected [key, value] tuple: ${e}`);s=e[0],a=e[1]}else if(e&&e instanceof Object){const t=Object.keys(e);if(1!==t.length)throw new TypeError(`Expected { key: value } tuple: ${e}`);s=t[0],a=e[s]}else s=e;i.items.push(qe(s,a,n))}return i}const kt={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:_t,createNode:wt};class Et extends Ze{constructor(){super(),this.add=Xe.prototype.add.bind(this),this.delete=Xe.prototype.delete.bind(this),this.get=Xe.prototype.get.bind(this),this.has=Xe.prototype.has.bind(this),this.set=Xe.prototype.set.bind(this),this.tag=Et.tag}toJSON(e,t){if(!t)return super.toJSON(e);const n=new Map;t?.onCreate&&t.onCreate(n);for(const e of this.items){let r,i;if(z(e)?(r=me(e.key,"",t),i=me(e.value,r,t)):r=me(e,"",t),n.has(r))throw new Error("Ordered maps must not include duplicate keys");n.set(r,i)}return n}}Et.tag="tag:yaml.org,2002:omap";const xt={collection:"seq",identify:e=>e instanceof Map,nodeClass:Et,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){const n=_t(e,t),r=[];for(const{key:e}of n.items)G(e)&&(r.includes(e.value)?t(`Ordered maps must not include duplicate keys: ${e.value}`):r.push(e.value));return Object.assign(new Et,n)},createNode(e,t,n){const r=wt(e,t,n),i=new Et;return i.items=r.items,i}};function Ot({value:e,source:t},n){return t&&(e?St:Tt).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}const St={identify:e=>!0===e,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new ve(!0),stringify:Ot},Tt={identify:e=>!1===e,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/i,resolve:()=>new ve(!1),stringify:Ot},At={identify:e=>"number"==typeof e,default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?\.(?:inf|Inf|INF|nan|NaN|NAN)$/,resolve:e=>"nan"===e.slice(-3).toLowerCase()?NaN:"-"===e[0]?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:ot},Lt={identify:e=>"number"==typeof e,default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify(e){const t=Number(e.value);return isFinite(t)?t.toExponential():ot(e)}},Nt={identify:e=>"number"==typeof e,default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){const t=new ve(parseFloat(e.replace(/_/g,""))),n=e.indexOf(".");if(-1!==n){const r=e.substring(n+1).replace(/_/g,"");"0"===r[r.length-1]&&(t.minFractionDigits=r.length)}return t},stringify:ot},Ct=e=>"bigint"==typeof e||Number.isInteger(e);function jt(e,t,n,{intAsBigInt:r}){const i=e[0];if("-"!==i&&"+"!==i||(t+=1),e=e.substring(t).replace(/_/g,""),r){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`}const t=BigInt(e);return"-"===i?BigInt(-1)*t:t}const o=parseInt(e,n);return"-"===i?-1*o:o}function Pt(e,t,n){const{value:r}=e;if(Ct(r)){const e=r.toString(t);return r<0?"-"+n+e.substr(1):n+e}return ot(e)}const It={identify:Ct,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>jt(e,2,2,n),stringify:e=>Pt(e,2,"0b")},Rt={identify:Ct,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>jt(e,1,8,n),stringify:e=>Pt(e,8,"0")},Bt={identify:Ct,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>jt(e,0,10,n),stringify:ot},Mt={identify:Ct,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>jt(e,2,16,n),stringify:e=>Pt(e,16,"0x")};class Ft extends Xe{constructor(e){super(e),this.tag=Ft.tag}add(e){let t;t=z(e)?e:e&&"object"==typeof e&&"key"in e&&"value"in e&&null===e.value?new ze(e.key,null):new ze(e,null),He(this.items,t.key)||this.items.push(t)}get(e,t){const n=He(this.items,e);return!t&&z(n)?G(n.key)?n.key.value:n.key:n}set(e,t){if("boolean"!=typeof t)throw new Error("Expected boolean value for set(key, value) in a YAML set, not "+typeof t);const n=He(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new ze(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw new Error("Set items must all have null values")}}Ft.tag="tag:yaml.org,2002:set";const Kt={collection:"map",identify:e=>e instanceof Set,nodeClass:Ft,default:!1,tag:"tag:yaml.org,2002:set",resolve(e,t){if(q(e)){if(e.hasAllNullValues(!0))return Object.assign(new Ft,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e},createNode(e,t,n){const{replacer:r}=n,i=new Ft(e);if(t&&Symbol.iterator in Object(t))for(let e of t)"function"==typeof r&&(e=r.call(t,e,e)),i.items.push(qe(e,null,n));return i}};function Dt(e,t){const n=e[0],r="-"===n||"+"===n?e.substring(1):e,i=e=>t?BigInt(e):Number(e),o=r.replace(/_/g,"").split(":").reduce(((e,t)=>e*i(60)+i(t)),i(0));return"-"===n?i(-1)*o:o}function $t(e){let{value:t}=e,n=e=>e;if("bigint"==typeof t)n=e=>BigInt(e);else if(isNaN(t)||!isFinite(t))return ot(e);let r="";t<0&&(r="-",t*=n(-1));const i=n(60),o=[t%i];return t<60?o.unshift(0):(t=(t-o[0])/i,o.unshift(t%i),t>=60&&(t=(t-o[0])/i,o.unshift(t))),r+o.map((e=>e<10?"0"+String(e):String(e))).join(":").replace(/000000\d*$/,"")}const Ut={identify:e=>"bigint"==typeof e||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>Dt(e,n),stringify:$t},Vt={identify:e=>"number"==typeof e,default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>Dt(e,!1),stringify:$t},qt={identify:e=>e instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(e){const t=e.match(qt.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");const[,n,r,i,o,s,a]=t.map(Number),c=t[7]?Number((t[7]+"00").substr(1,3)):0;let l=Date.UTC(n,r-1,i,o||0,s||0,a||0,c);const u=t[8];if(u&&"Z"!==u){let e=Dt(u,!1);Math.abs(e)<30&&(e*=60),l-=6e4*e}return new Date(l)},stringify:({value:e})=>e.toISOString().replace(/((T00:00)?:00)?\.000Z$/,"")},zt=[Qe,tt,nt,rt,St,Tt,It,Rt,Bt,Mt,At,Lt,Nt,bt,xt,kt,Kt,Ut,Vt,qt],Gt=new Map([["core",mt],["failsafe",[Qe,tt,nt]],["json",gt],["yaml11",zt],["yaml-1.1",zt]]),Wt={binary:bt,bool:it,float:ct,floatExp:at,floatNaN:st,floatTime:Vt,int:pt,intHex:dt,intOct:ht,intTime:Ut,map:Qe,null:rt,omap:xt,pairs:kt,seq:tt,set:Kt,timestamp:qt},Yt={"tag:yaml.org,2002:binary":bt,"tag:yaml.org,2002:omap":xt,"tag:yaml.org,2002:pairs":kt,"tag:yaml.org,2002:set":Kt,"tag:yaml.org,2002:timestamp":qt};function Jt(e,t){let n=Gt.get(t);if(!n){if(!Array.isArray(e)){const e=Array.from(Gt.keys()).filter((e=>"yaml11"!==e)).map((e=>JSON.stringify(e))).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${e} or define customTags array`)}n=[]}if(Array.isArray(e))for(const t of e)n=n.concat(t);else"function"==typeof e&&(n=e(n.slice()));return n.map((e=>{if("string"!=typeof e)return e;const t=Wt[e];if(t)return t;const n=Object.keys(Wt).map((e=>JSON.stringify(e))).join(", ");throw new Error(`Unknown custom tag "${e}"; use one of ${n}`)}))}const Ht=(e,t)=>e.keyt.key?1:0;class Xt{constructor({compat:e,customTags:t,merge:n,resolveKnownTags:r,schema:i,sortMapEntries:o,toStringDefaults:s}){this.compat=Array.isArray(e)?Jt(e,"compat"):e?Jt(null,e):null,this.merge=!!n,this.name="string"==typeof i&&i||"core",this.knownTags=r?Yt:{},this.tags=Jt(t,this.name),this.toStringOptions=s??null,Object.defineProperty(this,M,{value:Qe}),Object.defineProperty(this,K,{value:nt}),Object.defineProperty(this,D,{value:tt}),this.sortMapEntries="function"==typeof o?o:!0===o?Ht:null}clone(){const e=Object.create(Xt.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}}function Qt(e,t,n,r){if(r&&"object"==typeof r)if(Array.isArray(r))for(let t=0,n=r.length;t"number"==typeof e||e instanceof String||e instanceof Number,n=t.filter(e).map(String);n.length>0&&(t=t.concat(n)),r=t}else void 0===n&&t&&(n=t,t=void 0);const{aliasDuplicateObjects:i,anchorPrefix:o,flow:s,keepUndefined:a,onTagObj:c,tag:l}=n??{},{onAnchor:u,setAnchors:f,sourceObjects:h}=function(e,t){const n=[],r=new Map;let i=null;return{onAnchor:r=>{n.push(r),i||(i=fe(e));const o=he(t,i);return i.add(o),o},setAnchors:()=>{for(const e of n){const t=r.get(e);if("object"!=typeof t||!t.anchor||!G(t.node)&&!Y(t.node)){const t=new Error("Failed to resolve repeated object (this should not happen)");throw t.source=e,t}t.node.anchor=t.anchor}},sourceObjects:r}}(this,o||"a"),p=be(e,l,{aliasDuplicateObjects:i??!0,keepUndefined:a??!1,onAnchor:u,onTagObj:c,replacer:r,schema:this.schema,sourceObjects:h});return s&&Y(p)&&(p.flow=!0),f(),p}createPair(e,t,n={}){const r=this.createNode(e,null,n),i=this.createNode(t,null,n);return new ze(r,i)}delete(e){return!!en(this.contents)&&this.contents.delete(e)}deleteIn(e){return we(e)?null!=this.contents&&(this.contents=null,!0):!!en(this.contents)&&this.contents.deleteIn(e)}get(e,t){return Y(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return we(e)?!t&&G(this.contents)?this.contents.value:this.contents:Y(this.contents)?this.contents.getIn(e,t):void 0}has(e){return!!Y(this.contents)&&this.contents.has(e)}hasIn(e){return we(e)?void 0!==this.contents:!!Y(this.contents)&&this.contents.hasIn(e)}set(e,t){null==this.contents?this.contents=_e(this.schema,[e],t):en(this.contents)&&this.contents.set(e,t)}setIn(e,t){we(e)?this.contents=t:null==this.contents?this.contents=_e(this.schema,Array.from(e),t):en(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){let n;switch("number"==typeof e&&(e=String(e)),e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new le({version:"1.1"}),n={merge:!0,resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new le({version:e}),n={merge:!1,resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{const t=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${t}`)}}if(t.schema instanceof Object)this.schema=t.schema;else{if(!n)throw new Error("With a null YAML version, the { schema: Schema } option is required");this.schema=new Xt(Object.assign(n,t))}}toJS({json:e,jsonArg:t,mapAsMap:n,maxAliasCount:r,onAnchor:i,reviver:o}={}){const s={anchors:new Map,doc:this,keep:!e,mapAsMap:!0===n,mapKeyWarned:!1,maxAliasCount:"number"==typeof r?r:100,stringify:Ke},a=me(this.contents,t??"",s);if("function"==typeof i)for(const{count:e,res:t}of s.anchors.values())i(t,e);return"function"==typeof o?Qt(o,{"":a},"",a):a}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){const t=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${t}`)}return function(e,t){const n=[];let r=!0===t.directives;if(!1!==t.directives&&e.directives){const t=e.directives.toString(e);t?(n.push(t),r=!0):e.directives.docStart&&(r=!0)}r&&n.push("---");const i=Fe(e,t),{commentString:o}=i.options;if(e.commentBefore){1!==n.length&&n.unshift("");const t=o(e.commentBefore);n.unshift(xe(t,""))}let s=!1,a=null;if(e.contents){if(J(e.contents)){if(e.contents.spaceBefore&&r&&n.push(""),e.contents.commentBefore){const t=o(e.contents.commentBefore);n.push(xe(t,""))}i.forceBlockIndent=!!e.comment,a=e.contents.comment}const t=a?void 0:()=>s=!0;let c=Ke(e.contents,i,(()=>a=null),t);a&&(c+=Oe(c,"",o(a))),"|"!==c[0]&&">"!==c[0]||"---"!==n[n.length-1]?n.push(c):n[n.length-1]=`--- ${c}`}else n.push(Ke(e.contents,i));if(e.directives?.docEnd)if(e.comment){const t=o(e.comment);t.includes("\n")?(n.push("..."),n.push(xe(t,""))):n.push(`... ${t}`)}else n.push("...");else{let t=e.comment;t&&s&&(t=t.replace(/^\n+/,"")),t&&(s&&!a||""===n[n.length-1]||n.push(""),n.push(xe(o(t),"")))}return n.join("\n")+"\n"}(this,e)}}function en(e){if(Y(e))return!0;throw new Error("Expected a YAML collection as document contents")}class tn extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}}class nn extends tn{constructor(e,t,n){super("YAMLParseError",e,t,n)}}class rn extends tn{constructor(e,t,n){super("YAMLWarning",e,t,n)}}const on=(e,t)=>n=>{if(-1===n.pos[0])return;n.linePos=n.pos.map((e=>t.linePos(e)));const{line:r,col:i}=n.linePos[0];n.message+=` at line ${r}, column ${i}`;let o=i-1,s=e.substring(t.lineStarts[r-1],t.lineStarts[r]).replace(/[\n\r]+$/,"");if(o>=60&&s.length>80){const e=Math.min(o-39,s.length-79);s="…"+s.substring(e),o-=e-1}if(s.length>80&&(s=s.substring(0,79)+"…"),r>1&&/^ *$/.test(s.substring(0,o))){let n=e.substring(t.lineStarts[r-2],t.lineStarts[r-1]);n.length>80&&(n=n.substring(0,79)+"…\n"),s=n+s}if(/[^ ]/.test(s)){let e=1;const t=n.linePos[1];t&&t.line===r&&t.col>i&&(e=Math.min(t.col-i,80-o));const a=" ".repeat(o)+"^".repeat(e);n.message+=`:\n\n${s}\n${a}\n`}};function sn(e,{flow:t,indicator:n,next:r,offset:i,onError:o,startOnNewline:s}){let a=!1,c=s,l=s,u="",f="",h=!1,p=!1,d=!1,m=null,y=null,v=null,g=null,b=null;for(const r of e)switch(d&&("space"!==r.type&&"newline"!==r.type&&"comma"!==r.type&&o(r.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),d=!1),r.type){case"space":!t&&c&&"doc-start"!==n&&"\t"===r.source[0]&&o(r,"TAB_AS_INDENT","Tabs are not allowed as indentation"),l=!0;break;case"comment":{l||o(r,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const e=r.source.substring(1)||" ";u?u+=f+e:u=e,f="",c=!1;break}case"newline":c?u?u+=r.source:a=!0:f+=r.source,c=!0,h=!0,(m||y)&&(p=!0),l=!0;break;case"anchor":m&&o(r,"MULTIPLE_ANCHORS","A node can have at most one anchor"),r.source.endsWith(":")&&o(r.offset+r.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),m=r,null===b&&(b=r.offset),c=!1,l=!1,d=!0;break;case"tag":y&&o(r,"MULTIPLE_TAGS","A node can have at most one tag"),y=r,null===b&&(b=r.offset),c=!1,l=!1,d=!0;break;case n:(m||y)&&o(r,"BAD_PROP_ORDER",`Anchors and tags must be after the ${r.source} indicator`),g&&o(r,"UNEXPECTED_TOKEN",`Unexpected ${r.source} in ${t??"collection"}`),g=r,c=!1,l=!1;break;case"comma":if(t){v&&o(r,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),v=r,c=!1,l=!1;break}default:o(r,"UNEXPECTED_TOKEN",`Unexpected ${r.type} token`),c=!1,l=!1}const _=e[e.length-1],w=_?_.offset+_.source.length:i;return d&&r&&"space"!==r.type&&"newline"!==r.type&&"comma"!==r.type&&("scalar"!==r.type||""!==r.source)&&o(r.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),{comma:v,found:g,spaceBefore:a,comment:u,hasNewline:h,hasNewlineAfterProp:p,anchor:m,tag:y,end:w,start:b??w}}function an(e){if(!e)return null;switch(e.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(e.source.includes("\n"))return!0;if(e.end)for(const t of e.end)if("newline"===t.type)return!0;return!1;case"flow-collection":for(const t of e.items){for(const e of t.start)if("newline"===e.type)return!0;if(t.sep)for(const e of t.sep)if("newline"===e.type)return!0;if(an(t.key)||an(t.value))return!0}return!1;default:return!0}}function cn(e,t,n){if("flow-collection"===t?.type){const r=t.end[0];r.indent!==e||"]"!==r.source&&"}"!==r.source||!an(t)||n(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function ln(e,t,n){const{uniqueKeys:r}=e.options;if(!1===r)return!1;const i="function"==typeof r?r:(t,n)=>t===n||G(t)&&G(n)&&t.value===n.value&&!("<<"===t.value&&e.schema.merge);return t.some((e=>i(e.key,n)))}const un="All mapping items must start at the same column";function fn(e,t,n,r){let i="";if(e){let o=!1,s="";for(const a of e){const{source:e,type:c}=a;switch(c){case"space":o=!0;break;case"comment":{n&&!o&&r(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const t=e.substring(1)||" ";i?i+=s+t:i=t,s="";break}case"newline":i&&(s+=e),o=!0;break;default:r(a,"UNEXPECTED_TOKEN",`Unexpected ${c} at node end`)}t+=e.length}}return{comment:i,offset:t}}const hn="Block collections are not allowed within flow collections",pn=e=>e&&("block-map"===e.type||"block-seq"===e.type);function dn(e){let t,n;try{t=new RegExp("(.*?)(?"===i.mode?ve.BLOCK_FOLDED:ve.BLOCK_LITERAL,s=e.source?function(e){const t=e.split(/\n( *)/),n=t[0],r=n.match(/^( *)/),i=[r?.[1]?[r[1],n.slice(r[1].length)]:["",n]];for(let e=1;e=0;--e){const t=s[e][1];if(""!==t&&"\r"!==t)break;a=e}if(0===a){const t="+"===i.chomp&&s.length>0?"\n".repeat(Math.max(1,s.length-1)):"";let n=r+i.length;return e.source&&(n+=e.source.length),{value:t,type:o,comment:i.comment,range:[r,n,n]}}let c=e.indent+i.indent,l=e.offset+i.length,u=0;for(let e=0;ec&&(c=t.length),l+=t.length+r.length+1}for(let e=s.length-1;e>=a;--e)s[e][0].length>c&&(a=e+1);let f="",h="",p=!1;for(let e=0;ec||"\t"===r[0]?(" "===h?h="\n":p||"\n"!==h||(h="\n\n"),f+=h+t.slice(c)+r,h="\n",p=!0):""===r?"\n"===h?f+="\n":h="\n":(f+=h+r,h=" ",p=!1)}switch(i.chomp){case"-":break;case"+":for(let e=a;en(r+e,t,i);switch(i){case"scalar":a=ve.PLAIN,c=function(e,t){let n="";switch(e[0]){case"\t":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":n=`block scalar indicator ${e[0]}`;break;case"@":case"`":n=`reserved character ${e[0]}`}return n&&t(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),dn(e)}(o,l);break;case"single-quoted-scalar":a=ve.QUOTE_SINGLE,c=function(e,t){return"'"===e[e.length-1]&&1!==e.length||t(e.length,"MISSING_CHAR","Missing closing 'quote"),dn(e.slice(1,-1)).replace(/''/g,"'")}(o,l);break;case"double-quoted-scalar":a=ve.QUOTE_DOUBLE,c=function(e,t){let n="";for(let r=1;rt?e.slice(t,r+1):i)}else n+=i}return'"'===e[e.length-1]&&1!==e.length||t(e.length,"MISSING_CHAR",'Missing closing "quote'),n}(o,l);break;default:return n(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[r,r+o.length,r+o.length]}}const u=r+o.length,f=fn(s,u,t,n);return{value:c,type:a,comment:f.comment,range:[r,u,f.offset]}}(t,e.options.strict,r),c=n?e.directives.tagName(n.source,(e=>r(n,"TAG_RESOLVE_FAILED",e))):null,l=n&&c?function(e,t,n,r,i){if("!"===n)return e[K];const o=[];for(const t of e.tags)if(!t.collection&&t.tag===n){if(!t.default||!t.test)return t;o.push(t)}for(const e of o)if(e.test?.test(t))return e;const s=e.knownTags[n];return s&&!s.collection?(e.tags.push(Object.assign({},s,{default:!1,test:void 0})),s):(i(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,"tag:yaml.org,2002:str"!==n),e[K])}(e.schema,i,c,n,r):"scalar"===t.type?function({directives:e,schema:t},n,r,i){const o=t.tags.find((e=>e.default&&e.test?.test(n)))||t[K];if(t.compat){const s=t.compat.find((e=>e.default&&e.test?.test(n)))??t[K];o.tag!==s.tag&&i(r,"TAG_RESOLVE_FAILED",`Value may be parsed as either ${e.tagString(o.tag)} or ${e.tagString(s.tag)}`,!0)}return o}(e,i,t,r):e.schema[K];let u;try{const o=l.resolve(i,(e=>r(n??t,"TAG_RESOLVE_FAILED",e)),e.options);u=G(o)?o:new ve(o)}catch(e){const o=e instanceof Error?e.message:String(e);r(n??t,"TAG_RESOLVE_FAILED",o),u=new ve(i)}return u.range=a,u.source=i,o&&(u.type=o),c&&(u.tag=c),l.format&&(u.format=l.format),s&&(u.comment=s),u}function bn(e,t,n){if(t){null===n&&(n=t.length);for(let r=n-1;r>=0;--r){let n=t[r];switch(n.type){case"space":case"comment":case"newline":e-=n.source.length;continue}for(n=t[++r];"space"===n?.type;)e+=n.source.length,n=t[++r];break}}return e}const _n={composeNode:wn,composeEmptyNode:kn};function wn(e,t,n,r){const{spaceBefore:i,comment:o,anchor:s,tag:a}=n;let c,l=!0;switch(t.type){case"alias":c=function({options:e},{offset:t,source:n,end:r},i){const o=new pe(n.substring(1));""===o.source&&i(t,"BAD_ALIAS","Alias cannot be an empty string"),o.source.endsWith(":")&&i(t+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);const s=t+n.length,a=fn(r,s,e.strict,i);return o.range=[t,s,a.offset],a.comment&&(o.comment=a.comment),o}(e,t,r),(s||a)&&r(t,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":c=gn(e,t,a,r),s&&(c.anchor=s.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":c=function(e,t,n,r,i){let o;switch(n.type){case"block-map":o=function({composeNode:e,composeEmptyNode:t},n,r,i){const o=new Xe(n.schema);n.atRoot&&(n.atRoot=!1);let s=r.offset,a=null;for(const c of r.items){const{start:l,key:u,sep:f,value:h}=c,p=sn(l,{indicator:"explicit-key-ind",next:u??f?.[0],offset:s,onError:i,startOnNewline:!0}),d=!p.found;if(d){if(u&&("block-seq"===u.type?i(s,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in u&&u.indent!==r.indent&&i(s,"BAD_INDENT",un)),!p.anchor&&!p.tag&&!f){a=p.end,p.comment&&(o.comment?o.comment+="\n"+p.comment:o.comment=p.comment);continue}(p.hasNewlineAfterProp||an(u))&&i(u??l[l.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else p.found?.indent!==r.indent&&i(s,"BAD_INDENT",un);const m=p.end,y=u?e(n,u,p,i):t(n,m,l,null,p,i);n.schema.compat&&cn(r.indent,u,i),ln(n,o.items,y)&&i(m,"DUPLICATE_KEY","Map keys must be unique");const v=sn(f??[],{indicator:"map-value-ind",next:h,offset:y.range[2],onError:i,startOnNewline:!u||"block-scalar"===u.type});if(s=v.end,v.found){d&&("block-map"!==h?.type||v.hasNewline||i(s,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&p.start0){const e=fn(h,p,n.options.strict,i);e.comment&&(a.comment?a.comment+="\n"+e.comment:a.comment=e.comment),a.range=[r.offset,p,e.offset]}else a.range=[r.offset,p,p];return a}(e,t,n,i)}if(!r)return o;const s=t.directives.tagName(r.source,(e=>i(r,"TAG_RESOLVE_FAILED",e)));if(!s)return o;const a=o.constructor;if("!"===s||s===a.tagName)return o.tag=a.tagName,o;const c=q(o)?"map":"seq";let l=t.schema.tags.find((e=>e.collection===c&&e.tag===s));if(!l){const e=t.schema.knownTags[s];if(!e||e.collection!==c)return i(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,!0),o.tag=s,o;t.schema.tags.push(Object.assign({},e,{default:!1})),l=e}const u=l.resolve(o,(e=>i(r,"TAG_RESOLVE_FAILED",e)),t.options),f=J(u)?u:new ve(u);return f.range=o.range,f.tag=s,l?.format&&(f.format=l.format),f}(_n,e,t,a,r),s&&(c.anchor=s.source.substring(1));break;default:r(t,"UNEXPECTED_TOKEN","error"===t.type?t.message:`Unsupported token (type: ${t.type})`),c=kn(e,t.offset,void 0,null,n,r),l=!1}return s&&""===c.anchor&&r(s,"BAD_ALIAS","Anchor cannot be an empty string"),i&&(c.spaceBefore=!0),o&&("scalar"===t.type&&""===t.source?c.comment=o:c.commentBefore=o),e.options.keepSourceTokens&&l&&(c.srcToken=t),c}function kn(e,t,n,r,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){const u=gn(e,{type:"scalar",offset:bn(t,n,r),indent:-1,source:""},a,l);return s&&(u.anchor=s.source.substring(1),""===u.anchor&&l(s,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(u.spaceBefore=!0),o&&(u.comment=o,u.range[2]=c),u}function En(e){if("number"==typeof e)return[e,e+1];if(Array.isArray(e))return 2===e.length?e:[e[0],e[1]];const{offset:t,source:n}=e;return[t,t+("string"==typeof n?n.length:1)]}function xn(e){let t="",n=!1,r=!1;for(let i=0;i{const i=En(e);r?this.warnings.push(new rn(i,t,n)):this.errors.push(new nn(i,t,n))},this.directives=new le({version:e.version||"1.2"}),this.options=e}decorate(e,t){const{comment:n,afterEmptyLine:r}=xn(this.prelude);if(n){const i=e.contents;if(t)e.comment=e.comment?`${e.comment}\n${n}`:n;else if(r||e.directives.docStart||!i)e.commentBefore=n;else if(Y(i)&&!i.flow&&i.items.length>0){let e=i.items[0];z(e)&&(e=e.key);const t=e.commentBefore;e.commentBefore=t?`${n}\n${t}`:n}else{const e=i.commentBefore;i.commentBefore=e?`${n}\n${e}`:n}}t?(Array.prototype.push.apply(e.errors,this.errors),Array.prototype.push.apply(e.warnings,this.warnings)):(e.errors=this.errors,e.warnings=this.warnings),this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:xn(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,n=-1){for(const t of e)yield*this.next(t);yield*this.end(t,n)}*next(e){switch(e.type){case"directive":this.directives.add(e.source,((t,n,r)=>{const i=En(e);i[0]+=t,this.onError(i,"BAD_DIRECTIVE",n,r)})),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{const t=function(e,t,{offset:n,start:r,value:i,end:o},s){const a=Object.assign({_directives:t},e),c=new Zt(void 0,a),l={atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=sn(r,{indicator:"doc-start",next:i??o?.[0],offset:n,onError:s,startOnNewline:!0});u.found&&(c.directives.docStart=!0,!i||"block-map"!==i.type&&"block-seq"!==i.type||u.hasNewline||s(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=i?wn(l,i,u,s):kn(l,u.end,r,null,u,s);const f=c.contents.range[2],h=fn(o,f,!1,s);return h.comment&&(c.comment=h.comment),c.range=[n,f,h.offset],c}(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{const t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new nn(En(e),"UNEXPECTED_TOKEN",t);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case"doc-end":{if(!this.doc){const t="Unexpected doc-end without preceding document";this.errors.push(new nn(En(e),"UNEXPECTED_TOKEN",t));break}this.doc.directives.docEnd=!0;const t=fn(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){const e=this.doc.comment;this.doc.comment=e?`${e}\n${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new nn(En(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){const e=Object.assign({_directives:this.directives},this.options),n=new Zt(void 0,e);this.atDirectives&&this.onError(t,"MISSING_CHAR","Missing directives-end indicator line"),n.range=[0,t,t],this.decorate(n,!1),yield n}}}const Sn=Symbol("break visit"),Tn=Symbol("skip children"),An=Symbol("remove item");function Ln(e,t){"type"in e&&"document"===e.type&&(e={start:e.start,value:e.value}),Nn(Object.freeze([]),e,t)}function Nn(e,t,n){let r=n(t,e);if("symbol"==typeof r)return r;for(const i of["key","value"]){const o=t[i];if(o&&"items"in o){for(let t=0;t{let n=e;for(const[e,r]of t){const t=n?.[e];if(!t||!("items"in t))return;n=t.items[r]}return n},Ln.parentCollection=(e,t)=>{const n=Ln.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],i=n?.[r];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function Cn(e){switch(e){case void 0:case" ":case"\n":case"\r":case"\t":return!0;default:return!1}}const jn="0123456789ABCDEFabcdef".split(""),Pn="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()".split(""),In=",[]{}".split(""),Rn=" ,[]{}\n\r\t".split(""),Bn=e=>!e||Rn.includes(e);class Mn{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){e&&(this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null),this.atEnd=!t;let n=this.next??"stream";for(;n&&(t||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;" "===t||"\t"===t;)t=this.buffer[++e];return!t||"#"===t||"\n"===t||"\r"===t&&"\n"===this.buffer[e+1]}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let n=0;for(;" "===t;)t=this.buffer[++n+e];if("\r"===t){const t=this.buffer[n+e+1];if("\n"===t||!t&&!this.atEnd)return e+n+1}return"\n"===t||n>=this.indentNext||!t&&!this.atEnd?e+n:-1}if("-"===t||"."===t){const t=this.buffer.substr(e,3);if(("---"===t||"..."===t)&&Cn(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return("number"!=typeof e||-1!==e&&ethis.indentValue&&!Cn(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){const[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext("block-start");if(("-"===e||"?"===e||":"===e)&&Cn(t)){const e=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=e,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);const e=this.getLine();if(null===e)return this.setNext("doc");let t=yield*this.pushIndicators();switch(e[t]){case"#":yield*this.pushCount(e.length-t);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(Bn),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return t+=(yield*this.parseBlockScalarHeader()),t+=(yield*this.pushSpaces(!0)),yield*this.pushCount(e.length-t),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,t,n=-1;do{e=yield*this.pushNewline(),e>0?(t=yield*this.pushSpaces(!1),this.indentValue=n=t):t=0,t+=(yield*this.pushSpaces(!0))}while(e+t>0);const r=this.getLine();if(null===r)return this.setNext("flow");if((-1!==n&&n"0"&&t<="9")this.blockScalarIndent=Number(t)-1;else if("-"!==t)break}return yield*this.pushUntil((e=>Cn(e)||"#"===e))}*parseBlockScalar(){let e,t=this.pos-1,n=0;e:for(let r=this.pos;e=this.buffer[r];++r)switch(e){case" ":n+=1;break;case"\n":t=r,n=0;break;case"\r":{const e=this.buffer[r+1];if(!e&&!this.atEnd)return this.setNext("block-scalar");if("\n"===e)break}default:break e}if(!e&&!this.atEnd)return this.setNext("block-scalar");if(n>=this.indentNext){-1===this.blockScalarIndent?this.indentNext=n:this.indentNext+=this.blockScalarIndent;do{const e=this.continueScalar(t+1);if(-1===e)break;t=this.buffer.indexOf("\n",e)}while(-1!==t);if(-1===t){if(!this.atEnd)return this.setNext("block-scalar");t=this.buffer.length}}if(!this.blockScalarKeep)for(;;){let e=t-1,r=this.buffer[e];"\r"===r&&(r=this.buffer[--e]);const i=e;for(;" "===r||"\t"===r;)r=this.buffer[--e];if(!("\n"===r&&e>=this.pos&&e+1+n>i))break;t=e}return yield"",yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){const e=this.flowLevel>0;let t,n=this.pos-1,r=this.pos-1;for(;t=this.buffer[++r];)if(":"===t){const t=this.buffer[r+1];if(Cn(t)||e&&","===t)break;n=r}else if(Cn(t)){let i=this.buffer[r+1];if("\r"===t&&("\n"===i?(r+=1,t="\n",i=this.buffer[r+1]):n=r),"#"===i||e&&In.includes(i))break;if("\n"===t){const e=this.continueScalar(r+1);if(-1===e)break;r=Math.max(r,e-2)}}else{if(e&&In.includes(t))break;n=r}return t||this.atEnd?(yield"",yield*this.pushToIndex(n+1,!0),e?"flow":"doc"):this.setNext("plain-scalar")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){const n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(t&&(yield""),0)}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(Bn))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{const e=this.flowLevel>0,t=this.charAt(1);if(Cn(t)||e&&In.includes(t))return e?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,(yield*this.pushCount(1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators())}}return 0}*pushTag(){if("<"===this.charAt(1)){let e=this.pos+2,t=this.buffer[e];for(;!Cn(t)&&">"!==t;)t=this.buffer[++e];return yield*this.pushToIndex(">"===t?e+1:e,!1)}{let e=this.pos+1,t=this.buffer[e];for(;t;)if(Pn.includes(t))t=this.buffer[++e];else{if("%"!==t||!jn.includes(this.buffer[e+1])||!jn.includes(this.buffer[e+2]))break;t=this.buffer[e+=3]}return yield*this.pushToIndex(e,!1)}}*pushNewline(){const e=this.buffer[this.pos];return"\n"===e?yield*this.pushCount(1):"\r"===e&&"\n"===this.charAt(1)?yield*this.pushCount(2):0}*pushSpaces(e){let t,n=this.pos-1;do{t=this.buffer[++n]}while(" "===t||e&&"\t"===t);const r=n-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=n),r}*pushUntil(e){let t=this.pos,n=this.buffer[t];for(;!e(n);)n=this.buffer[++t];return yield*this.pushToIndex(t,!1)}}class Fn{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,n=this.lineStarts.length;for(;t>1;this.lineStarts[r]=0;)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;"space"===e[++t]?.type;);return e.splice(t,e.length)}function qn(e){if("flow-seq-start"===e.start.type)for(const t of e.items)!t.sep||t.value||Kn(t.start,"explicit-key-ind")||Kn(t.sep,"map-value-ind")||(t.key&&(t.value=t.key),delete t.key,$n(t.value)?t.value.end?Array.prototype.push.apply(t.value.end,t.sep):t.value.end=t.sep:Array.prototype.push.apply(t.start,t.sep),delete t.sep)}class zn{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new Mn,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&0===this.offset&&this.onNewLine(0);for(const n of this.lexer.lex(e,t))yield*this.next(n);t||(yield*this.end())}*next(e){if(this.source=e,this.atScalar)return this.atScalar=!1,yield*this.step(),void(this.offset+=e.length);const t=function(e){switch(e){case"\ufeff":return"byte-order-mark";case"":return"doc-mode";case"":return"flow-error-end";case"":return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case"\n":case"\r\n":return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(e[0]){case" ":case"\t":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}(e);if(t)if("scalar"===t)this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=t,yield*this.step(),t){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&" "===e[0]&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{const t=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:t,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){const e=this.peek(1);if("doc-end"!==this.type||e&&"doc-end"===e.type){if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}else{for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source})}}peek(e){return this.stack[this.stack.length-e]}*pop(e){const t=e??this.stack.pop();if(t)if(0===this.stack.length)yield t;else{const e=this.peek(1);switch("block-scalar"===t.type?t.indent="indent"in e?e.indent:0:"flow-collection"===t.type&&"document"===e.type&&(t.indent=0),"flow-collection"===t.type&&qn(t),e.type){case"document":e.value=t;break;case"block-scalar":e.props.push(t);break;case"block-map":{const n=e.items[e.items.length-1];if(n.value)return e.items.push({start:[],key:t,sep:[]}),void(this.onKeyLine=!0);if(!n.sep)return Object.assign(n,{key:t,sep:[]}),void(this.onKeyLine=!Kn(n.start,"explicit-key-ind"));n.value=t;break}case"block-seq":{const n=e.items[e.items.length-1];n.value?e.items.push({start:[],value:t}):n.value=t;break}case"flow-collection":{const n=e.items[e.items.length-1];return void(!n||n.value?e.items.push({start:[],key:t,sep:[]}):n.sep?n.value=t:Object.assign(n,{key:t,sep:[]}))}default:yield*this.pop(),yield*this.pop(t)}if(!("document"!==e.type&&"block-map"!==e.type&&"block-seq"!==e.type||"block-map"!==t.type&&"block-seq"!==t.type)){const n=t.items[t.items.length-1];n&&!n.sep&&!n.value&&n.start.length>0&&-1===Dn(n.start)&&(0===t.indent||n.start.every((e=>"comment"!==e.type||e.indent=e.indent){const n=!this.onKeyLine&&this.indent===e.indent&&t.sep;let r=[];if(n&&t.sep&&!t.value){const n=[];for(let r=0;re.indent&&(n.length=0);break;default:n.length=0}}n.length>=2&&(r=t.sep.splice(n[1]))}switch(this.type){case"anchor":case"tag":return void(n||t.value?(r.push(this.sourceToken),e.items.push({start:r}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken));case"explicit-key-ind":return t.sep||Kn(t.start,"explicit-key-ind")?n||t.value?(r.push(this.sourceToken),e.items.push({start:r})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]}):t.start.push(this.sourceToken),void(this.onKeyLine=!0);case"map-value-ind":if(Kn(t.start,"explicit-key-ind"))if(t.sep)if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Kn(t.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]});else if($n(t.key)&&!Kn(t.sep,"newline")){const e=Vn(t.start),n=t.key,r=t.sep;r.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:e,key:n,sep:r}]})}else r.length>0?t.sep=t.sep.concat(r,this.sourceToken):t.sep.push(this.sourceToken);else if(Kn(t.start,"newline"))Object.assign(t,{key:null,sep:[this.sourceToken]});else{const e=Vn(t.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:e,key:null,sep:[this.sourceToken]}]})}else t.sep?t.value||n?e.items.push({start:r,key:null,sep:[this.sourceToken]}):Kn(t.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return void(this.onKeyLine=!0);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const i=this.flowScalar(this.type);return void(n||t.value?(e.items.push({start:r,key:i,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(i):(Object.assign(t,{key:i,sep:[]}),this.onKeyLine=!0))}default:{const i=this.startBlockValue(e);if(i)return n&&"block-seq"!==i.type&&Kn(t.start,"explicit-key-ind")&&e.items.push({start:r}),void this.stack.push(i)}}}yield*this.pop(),yield*this.step()}*blockSequence(e){const t=e.items[e.items.length-1];switch(this.type){case"newline":if(t.value){const n="end"in t.value?t.value.end:void 0,r=Array.isArray(n)?n[n.length-1]:void 0;"comment"===r?.type?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){const n=e.items[e.items.length-2],r=n?.value?.end;if(Array.isArray(r))return Array.prototype.push.apply(r,t.start),r.push(this.sourceToken),void e.items.pop()}t.start.push(this.sourceToken)}return;case"anchor":case"tag":if(t.value||this.indent<=e.indent)break;return void t.start.push(this.sourceToken);case"seq-item-ind":if(this.indent!==e.indent)break;return void(t.value||Kn(t.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken))}if(this.indent>e.indent){const t=this.startBlockValue(e);if(t)return void this.stack.push(t)}yield*this.pop(),yield*this.step()}*flowCollection(e){const t=e.items[e.items.length-1];if("flow-error-end"===this.type){let e;do{yield*this.pop(),e=this.peek(1)}while(e&&"flow-collection"===e.type)}else if(0===e.end.length){switch(this.type){case"comma":case"explicit-key-ind":return void(!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken));case"map-value-ind":return void(!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]}));case"space":case"comment":case"newline":case"anchor":case"tag":return void(!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken));case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const n=this.flowScalar(this.type);return void(!t||t.value?e.items.push({start:[],key:n,sep:[]}):t.sep?this.stack.push(n):Object.assign(t,{key:n,sep:[]}))}case"flow-map-end":case"flow-seq-end":return void e.end.push(this.sourceToken)}const n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{const t=this.peek(2);if("block-map"===t.type&&("map-value-ind"===this.type&&t.indent===e.indent||"newline"===this.type&&!t.items[t.items.length-1].sep))yield*this.pop(),yield*this.step();else if("map-value-ind"===this.type&&"flow-collection"!==t.type){const n=Vn(Un(t));qn(e);const r=e.end.splice(1,e.end.length);r.push(this.sourceToken);const i={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=i}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let e=this.source.indexOf("\n")+1;for(;0!==e;)this.onNewLine(this.offset+e),e=this.source.indexOf("\n",e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;const t=Vn(Un(e));return t.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:t}]}}case"map-value-ind":{this.onKeyLine=!0;const t=Vn(Un(e));return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return"comment"===this.type&&!(this.indent<=t)&&e.every((e=>"newline"===e.type||"space"===e.type))}*documentEnd(e){"doc-mode"!==this.type&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],"newline"===this.type&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],"newline"===this.type&&(yield*this.pop())}}}function Gn(e,t={}){const{lineCounter:n,prettyErrors:r}=function(e){const t=!1!==e.prettyErrors;return{lineCounter:e.lineCounter||t&&new Fn||null,prettyErrors:t}}(t),i=new zn(n?.addNewLine),o=new On(t);let s=null;for(const t of o.compose(i.parse(e),!0,e.length))if(s){if("silent"!==s.options.logLevel){s.errors.push(new nn(t.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}}else s=t;return r&&n&&(s.errors.forEach(on(e,n)),s.warnings.forEach(on(e,n))),s}class Wn extends tn{constructor(e,t,n){super(e,t,"IMPOSSIBLE",n),this.name=e}pretty(e){this.linePos=e.lineCounter.linePos(this.pos);const{line:t,col:n}=this.linePos;this.message+=` at line ${t}, column ${n} ${e.file?" @"+e.file:""}`}}class Yn{constructor(){this.lineCounter=new Fn,this.src="",this.txt="",this.errors=[],this.warnings=[],this.yaml_ok=!1,this.contents=null,this.listener=null,this.prog={}}errors(e){this.errors=this.errors.concat(e)}warnings(e){this.warnings=this.warnings.concat(e)}fileError(e){let t=new Wn("FILE_ERROR",0,`FileError : ${e}`);return this.errors.push(t),t}syntaxError(e,t){let n=new Wn("SYNTAX_ERROR",e.range?e.range[0]:0,`SyntaxError : ${t}`);return this.errors.push(n),n}syntaxWarning(e,t){let n=new Wn("SYNTAX_WARNING",e.range?e.range[0]:0,`SyntaxWarning : ${t}`);return this.warnings.push(n),n}typeError(e,t){let n=new Wn("TYPE_ERROR",e.range?e.range[0]:0,`TypeError : ${t}`);return this.errors.push(n),n}grammarError(e){let t=new Wn("GRAMMAR_ERROR",0,`GrammarError : ${e}`);this.errors.push(t)}grammarWarning(e){let t=new Wn("GRAMMAR_WARNING",0,`GrammarWarning : ${e}`);return this.warnings.push(t),t}fails(){return this.errors.length>0}success(){return 0==this.errors.length&&0==this.warnings.length}result(){return this.contents}}class Jn{constructor(e,t,n){this.ctx=e,this.type=t,this.current=n,this.start=n.range[0],this.end=n.range[1],this.childs=[]}getChild(e){return this.childs[e]}getChildCount(){return this.childs.length}getValue(){return this.value}toString(){return this.value}}class Hn extends Jn{constructor(e,t,n){super(e,t,n)}equals(e){if(e instanceof Hn)return this.value==e.value;this.ctx.syntaxError(this.current,`Error can not compare values '${this.value}' and '${e.value}'`)}}class Xn extends Hn{constructor(e,t){if(super(e,"string",t),!Xn.checkCurrent(t))throw e.syntaxError(t,`Error: value '${t?t.value:""}' is not a string`);this.value=t.value}static checkCurrent(e){return G(e)&&"string"==typeof e.value}static parse(e,t){try{return new Xn(e,t)}catch(e){return null}}}class Qn extends Hn{constructor(e,t){if(super(e,"binary",t),!Qn.checkCurrent(t))throw e.syntaxError(t,`Error: value '${t?t.value:""}' is not a base64 string`);this.value=t.value}static checkCurrent(e){return G(e)&&"string"==typeof e.value&&/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/.test(e.value)}static parse(e,t){try{return new Qn(e,t)}catch(e){return null}}}class Zn extends Hn{constructor(e,t){if(super(e,"int",t),!Zn.checkCurrent(t))throw e.syntaxError(t,`Error: value '${t?t.value:""}' is not an integer`);this.value=t.value}static checkCurrent(e){return G(e)&&"number"==typeof e.value&&e.value==Math.floor(e.value)}static parse(e,t){try{return new Zn(e,t)}catch(e){return null}}}class er extends Hn{constructor(e,t){if(super(e,"float",t),!er.checkCurrent(t))throw e.syntaxError(t,`Error: value '${t?t.value:""}' is not a number`);this.value=t.value}static checkCurrent(e){return G(e)&&"number"==typeof e.value}static parse(e,t){try{return new er(e,t)}catch(e){return null}}}class tr extends Hn{constructor(e,t){if(super(e,"boolean",t),this.value=null,!tr.checkCurrent(t))throw e.syntaxError(t,`Error: value '${t.value}' is not a boolean`);this.value=t.value}static checkCurrent(e){return G(e)&&"boolean"==typeof e.value}static parse(e,t){try{return new tr(e,t)}catch(e){return null}}}class nr extends Hn{constructor(e,t){if(super(e,"null",t),this.value=null,!nr.checkCurrent(t))throw e.syntaxError(t,`Error: value '${t?t.value:""}' is not the null value`)}static checkCurrent(e){return G(e)&&(null==e.value||["Null","NULL","null","~"].includes(e.value))}static parse(e,t){try{return new nr(e,t)}catch(e){return null}}}class rr extends Hn{constructor(e,t,n){if(super(e,"timestamp",t),!rr.checkCurrent(t))throw e.syntaxError(t,`Error: value '${t?t.value:""}' is not a timestamp in ISO9601 format`);this.value=new Date(t.value)}static checkCurrent(e){let t=G(e)&&"string"==typeof e.value&&/\d{4}-\d{2}-\d{2}|\d{4}-\d{2}?-\d{2}?([Tt]|[ \t]+)\d{2}?:\d{2}:\d{2}(\.\d*)?(([ \t]*)Z|[-+]\d\d?(:\d{2})?)?/.test(e.value);if(1==t)try{new Date(e.value)}catch(e){t=!1}return t}static parse(e,t){try{return new rr(e,t)}catch(e){return null}}equals(e){return e instanceof rr?this.value.getTime()==e.value.getTime():this.ctx.syntaxError("Error : can not compare a timestamp with something else")}}class ir extends Jn{constructor(e,t,n){super(e,t,n)}length(){return this.childs.length}isEmpty(){return 0==this.length()}}class or extends ir{constructor(e,t,n){if(super(e,"map",t),"object"!=typeof n||n instanceof Array)throw e.syntaxError(t,"Erorr : MapNode must be initialized with a parsed map. This should not happen.");this.value=n;for(const e in n)this.childs.push(n[e])}static checkCurrent(e){return q(e)&&e.items.every((e=>e.key&&G(e.key)&&"string"==typeof e.key.value))}}class sr{static parse(e,t,n){"object"!=typeof t&&e.grammarError("Error: oneof rule can not be parsed'");let r=t._oneOf;if(r instanceof Array){let t=[].concat(e.errors),i=[].concat(e.warnings),o=e.errors.length;for(let s of r){let r=gr(e,null,s,n);if(o==e.errors.length)return e.errors=t,e.warnings=i,r;o=e.errors.length}return e.syntaxError(n,"Syntax Error : no valid alternative found during parsing"),null}e.grammarError("Error: _oneof rules expects a sequence of alternatives")}}var ar="undefined"!=typeof Symbol;function cr(e){var t=typeof e;return"string"===t||"number"===t||"boolean"===t||!0===ar&&"symbol"===t||null==e||!0===ar&&e instanceof Symbol||e instanceof String||e instanceof Number||e instanceof Boolean}class lr{static parse(e,t){if("object"==typeof t){if(t._oneOf){let n;!t._oneOf instanceof Array&&e.grammarError("Error : _oneof value have to be a list"),t._oneOf=t._oneOf.map((t=>lr.parse(e,t)));do{if(n=t._oneOf.findIndex((e=>e._oneOf)),n>=0){let e=t._oneOf[n]._oneOf;(t={_oneOf:[].concat(t._oneOf)})._oneOf.splice(n,1),t._oneOf=t._oneOf.concat(e)}}while(n>=0);return t}if(t._merge){if(!(t._merge instanceof Array))return e.grammarError("Error : _merge value have to be a map"),null;const{_merge:n,...r}=t;let i;t={_merge:t._merge},Object.keys(r).length&&t._merge.push(r),t._merge=t._merge.map((t=>cr(t)&&e.rules[t]?e.rules[t]:t)),t._merge=t._merge.map((t=>lr.parse(e,t)));do{if(i=t._merge.findIndex((e=>e._merge)),i>=0){let e=t.one._merge;(t={_merge:[].concat(t._merge)})._merge.splice(i,1),t._merge=t._merge.concat(e)}}while(i>=0);let o={_oneOf:[]};do{if(i=(t={_merge:[].concat(t._merge)})._merge.findIndex((e=>e._oneOf)),i>=0){let e=t._merge[i]._oneOf;(t={_merge:[].concat(t._merge)})._merge.splice(i,1),e.forEach((e=>{let n={_merge:[e].concat(t._merge)};o._oneOf.push(n)}))}}while(i>=0);if(o._oneOf.length>=1)return lr.parse(e,o);t._merge.some((e=>e._merge||e._oneOf))&&e.grammarError("Error : merge has not been processed successfully. This error should not occur.");let s={},a={},c=null,l=-1,u=-1,f=-1;t._merge.forEach((t=>{if(t._map){s={...s};for(let n in t._map)s.key&&e.grammarError("Error : can not merge two maps with some identical keys"),s[n]=t._map[n]}if(t._mapFacultative){a={...a};for(let n in t._mapFacultative)a.key&&e.grammarError("Error : can not merge two maps with some identical keys"),a[n]=t._mapFacultative[n]}if(t._mapOf){if(null!=c)return e.grammarError("Error : only one '_mapOf' is allowed in a '_merge' clause"),null;c=t._mapOf}t._nb&&(l<0||l==t._nb?l=t._nb:e.grammarError("Contradictory sizing in merge clause")),t._min&&(u=Math.max(t._min,u)),t._max&&(nax=l>0?Math.min(t._max,f):t._max)}));let h={};return l>=0&&(h._nb=l),u>=0&&(h._min=u),f>=0&&(h._max=f),Object.keys(s).length>0&&(h._map=s),Object.keys(a).length>0&&(h._mapFacultative=a),null!=c&&(h._mapOf=c),h}if(t._map){let n={};for(const r in t._map)n[r]=lr.parse(e,t._map[r]);t._map=n}if(t._mapFacultative){let n={};for(const r in t._mapFacultative)n[r]=lr.parse(e,t._mapFacultative[r]);t._mapFacultative=n}if(t._mapOf){let n={};for(const r in t._mapOf){let i=lr.parse(e,r),o=lr.parse(e,t._mapOf[r]);n[i]=o}t._mapOf=n}t._list&&(t._list=t._list.map((t=>lr.parse(e,t)))),t._listFacultative&&(t._listFacultative=t._listFacultative.map((t=>lr.parse(e,t)))),t._listOf&&(t._listOf=lr.parse(e,t._listOf))}return t}}class ur{static isPositiveInt(e){return"number"==typeof e&&e==Math.floor(e)&&e>0}static sizeChecker(e,t,n,r){if(ur.isPositiveInt(n))if(q(r)||W(r))switch(t){case"eq":return r.items.length==n;case"min":return r.items.length>=n;case"max":return r.items.length<=n}else e.syntaxError(r,"Error : a map is expected");else e.grammarError(`Error: the map checker '${t}' does not have a positive integer as value`);return!1}static sizeCheckers(e,t,n){return null==t._nb||ur.sizeChecker(e,"eq",t._nb,n)?null==t._min||ur.sizeChecker(e,"min",t._min,n)?!(null!=t._max&&!ur.sizeChecker(e,"max",t._max,n)&&(e.syntaxError(n,`Error : map expected with more than ${t._max} elements but ${n.items.length} are provided`),1)):(e.syntaxError(n,`Error : map expected with more than ${t._min} elements but ${n.items.length} are provided`),!1):(e.syntaxError(n,`Error : map expected with ${t._nb} elements but ${n.items.length} are provided`),!1)}}class fr{static parse(e,t,n){if(!or.checkCurrent(n))return e.syntaxError(n,"Error : a map whose keys are strings is expected "),null;if(t._merge&&(t=lr.parse(e,t))._oneOf)return sr.parse(e,t,n);let r=t._map,i=t._mapOf,o=t._mapFacultative;if(null!=i&&"object"!=typeof i||null!=o&&"object"!=typeof o)return e.grammarError("Error : error in map value definition"),null;if(!ur.sizeCheckers(e,t,n))return null;if(null!=r)for(let t in r){if("string"!=typeof t)return e.grammarError("Error : error in map definition"),null;if(!n.has(t))return e.syntaxError(n,`Error : key '${t}' not found in current value`),null}let s,a=null;if(i){let e=Object.entries(i);1==e.length&&([[s,a]]=e)}let c={};for(let i of n.items){let n=i.key.value,l=i.value,u=null;if(r&&r[n])u=gr(e,null,r[n],l);else if(o&&o[n])u=gr(e,null,o[n],l);else{if(!s||!a)return e.syntaxError(l,`Error : '${n}' is not a valid key (in rule : ${JSON.stringify(t)})`),null;{let t=gr(e,null,s,i.key);if(u=gr(e,null,a,l),t.value!=n)return e.syntaxError(n,`Error : '${n}' does not match expected '${s}' type`),null}}if(null==u)return e.syntaxError(l,`Error : bad value '${l}'found for '${n}' (mapparser.parse)`),null;let f=new Xn(e,i.key);if(u.key=f,null!=c[n])return e.syntaxError(l,`Error : more than one value provided in the map for the key '${n}'`),null;c[n]=u}return new or(e,n,c)}static parse_any(e,t){if(!or.checkCurrent(t))return e.syntaxError(t,"Error : a map whose keys are strings is expected "),null;let n={};return t.items.forEach((t=>{let r=t.key.value,i=t.value,o=dr.parse_any(e,i);if(null==o)return e.syntaxError(i,`Error : bad value '${i}' found for '${r}' (mapparser.parse_any)`),null;let s=new Xn(e,t.key);o.key=s,null!=n[r]&&e.syntaxError(i,`Error : more than one value provided in the map for the key '${r}'`),n[r]=o})),new or(e,t,n)}}class hr extends ir{constructor(e,t,n){if(super(e,"list",t),!n instanceof Array)throw e.syntaxError(t,"Erorr : ListNode must be initialized with an array. This should not happen.");this.value=n,this.childs=this.value}static checkCurrent(e){return W(e)}}class pr{static parse(e,t,n){if(!hr.checkCurrent(n))return e.syntaxError(n,"Error : a list is expected "),null;if(!ur.sizeCheckers(e,t,n))return null;let r=t._list,i=t._listOf,o=t._listFacultative;if(null!=r&&!(r instanceof Array)||null!=o&&!(o instanceof Array))return e.grammarError("Error : error in list value definition"),null;let s=0,a=n.items.length,c=[];r&&r.forEach((t=>{if(!(s{if(s{let r=dr.parse_any(e,t);if(null==r)return e.SyntaxError(value,`Error : bad value '${value}' found for '${key}' (listparser.parse_any)`),null;n.push(r)})),new hr(e,t,n)}}class dr{static parse(e,t,n){switch(t){case"string":return Xn.parse(e,n);case"binary":return Qn.parse(e,n);case"timestamp":return rr.parse(e,n);case"int":return Zn.parse(e,n);case"float":return er.parse(e,n);case"boolean":return tr.parse(e,n);case"null":return nr.parse(e,n);case"any":return dr.parse_any(e,n);default:return br(e,t,n)}}static parse_any(e,t){if(G(t)){switch(typeof t.value){case"number":return Zn.checkCurrent(t)?Zn.parse(e,t):er.parse(e,t);case"boolean":return tr.parse(e,t);case"string":return Xn.parse(e,t);case"object":if(null==t.value)return nr.parse(e,t);e.syntaxError(t,`Error: value '${t.value}' is not a scalar value`);default:e.syntaxError(t,`Error: value '${t.value}' is not a scalar value`)}return null}return q(t)?fr.parse_any(e,t):W(t)?pr.parse_any(e,t):null}}class mr{static parse(e,t,n){"object"==typeof t&&t._in||e.grammarError("Error: can not parse _in rule'");let r=t._in;if(!(r instanceof Array))return e.grammarError("Error: _in rules expects a sequence of alternatives"),null;for(let t of r)if(!cr(t))return e.grammarError("Error: _in rules expects each alternative to be a scalar"),null;if(!G(n))return e.syntaxError(n,"Syntax Error : scalar value expected by rule '_in'"),null;let i=dr.parse_any(e,n);if(i){let t=[].concat(e.errors),n=[].concat(e.warnings),o=e.errors.length,s=i.value;for(let a of r)if(a){let r=a==s?i:null;if(null!=r)return e.errors=t,e.warnings=n,r;o=e.errors.length}}return e.syntaxError(n,"Syntax Error : no valid alternative for '_in' rule found during parsing"),null}}class yr{static parse(e,t,n){if(!Xn.checkCurrent(n))return e.syntaxError(n,`Error: regular expressions match only strings, '${n?n.value:""}' is not a string`),null;let r=t._regex;if(null==r)return e.grammarError("Error : regep rule must have a value for key '_regex'"),null;let i=null;try{i=new RegExp(r)}catch(e){}return null==i?(e.grammarError(`Error: value '${i}' is not a valid regular expression`),null):i.test(n.value)?new Xn(e,n):(e.syntaxError(n,`Error: value '${n.value}' does not match the regular expression '${i}'`),null)}}class vr{static scalartypes=["string","int","float","null","boolean","binary","timestamp"];static keywords=["_map","_mapOf","_mapFacultative","_list","_listOf","_listFacultative","_oneOf","_regex","_nb","_min","_max","_in"];static parse(e,t,n,r){if(null==r)return e.fileError("No source to parse"),null;if(vr.scalartypes.includes(t)||vr.keywords.includes(t))return e.syntaxError(r,`'${t}' is not allowed as rule_name in Lidy Grammar (reserved keyword)`),null;let i="enter_"+t;r.ctx=e,e.listener&&e.listener[i]&&e.listener[i](r);let o=gr(e,null,n,r),s="exit_"+t;return"node_template"==t&&console.log("Sortie de node_template"),o&&e.listener&&e.listener[s]&&e.listener[s](o),o}}function gr(e,t,n,r){if(t)return vr.parse(e,t,n,r);if(cr(n))return dr.parse(e,n,r);if("object"==typeof n){if(n._map||n._mapOf||n._mapFacultative||n._merge)return fr.parse(e,n,r);if(n._list||n._listOf||n._listFacultative)return pr.parse(e,n,r);if(n._oneOf)return sr.parse(e,n,r);if(n._regex)return yr.parse(e,n,r);if(n._in)return mr.parse(e,n,r)}return e.grammarError("Error : grammar error : no valid keyword found"),null}function br(e,t,n){let r=e.rules[t];return void 0!==r?gr(e,t,r,n):(e.grammarError(`no rule named ${t} found.`),null)}function _r(e){e.keyword||(e.keyword="main");let t=new Yn;return t.prog=e.prog,e.rules?t.rules=e.rules:function(e,t,n){try{e.rules=function(e,t,n){let r;const i=Gn(e,n);if(!i)return null;if(i.warnings.forEach((e=>De(i.options.logLevel,e))),i.errors.length>0){if("silent"!==i.options.logLevel)throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:r},n))}(t)}catch(t){throw e.errors.push(t),e.grammarError("ERROR : can not parse dsl ")}if("object"==(e.rules,!1))throw e.grammarError("ERROR : can not parse dsl ");if(!e.rules[n])throw Error("ERROR : no rule labeled '"+n+"' in the grammar")}(t,e.dsl_data,e.keyword),t.listener=e.listener,function(e,t){e.lineCounter=new Fn;let n=Gn(t,{lineCounter:e.lineCounter});n||e.fileError("can not parse the provided source code."),e.src=n.contents,e.txt=t,e.errors=n.errors,e.warnings=n.warnings,e.yaml_ok=0==e.errors.length&&0==e.warnings.length}(t,e.src_data),function(e,t,n){let r=br(e,t,n);return e.errors.filter((e=>e instanceof Wn)).forEach((t=>t.pretty(e))),e.warnings.filter((e=>e instanceof Wn)).forEach((t=>t.pretty(e))),e.contents=r,e}(t,e.keyword,t.src)}var wr={main:"workflow",workflow:{_mapFacultative:{name:"WorkflowName",on:{_mapFacultative:{push:"PushTrigger",pull_request:"PullRequestTrigger"}},jobs:{_mapOf:{JobId:"Job"}}}},WorkflowName:"string",PushTrigger:{_map:{branches:"PushTriggerBranches"}},PushTriggerBranches:{_listOf:"string"},PullRequestTrigger:{_map:{types:"PullRequestTriggerTypes"}},PullRequestTriggerTypes:{_listOf:"string"},Job:{_map:{name:"JobName","runs-on":"JobRunsOn",steps:{_min:1,_listOf:"Step"}},_mapFacultative:{needs:"JobNeeds"}},JobId:"string",JobName:"string",JobRunsOn:"string",JobNeeds:{_listOf:"string"},Step:{_oneOf:["CommandStep","ReusableStep"]},ReusableStep:{_map:{uses:"StepUses"},_mapFacultative:{name:"StepName",with:"StepWith",env:"StepEnv"}},CommandStep:{_map:{run:"StepRun"},_mapFacultative:{name:"StepName",env:"StepEnv"}},StepUses:"string",StepName:"string",StepRun:"string",StepWith:{_mapOf:{StepMapKey:"StepMapValue"}},StepEnv:{_mapOf:{StepMapKey:"StepMapValue"}},StepMapKey:"string",StepMapValue:{_oneOf:["int","string"]}};function kr(e){return kr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},kr(e)}function Er(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:[];this.pluginData.components=[],this.pluginData.parseErrors=[],t.filter((function(e){return null!==e.content})).forEach((function(t,n){var r=new I(t,e.pluginData.definitions.components,"workflow_".concat(n+1));!function(e){e.rules=wr,_r(e)}({src_data:t.content,listener:r,path:t.path,prog:{errors:[],warnings:[],imports:[],alreadyImported:[],root:[]}}),r.components.forEach((function(t){return e.pluginData.components.push(t)}))}))}}],n&&Er(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),s}(e.DefaultParser);var Ar=n(985),Lr=n.n(Ar);const Nr={root:"name: {{ workflowName.value }}\n\n{% if triggers.length > 0 %}\non:\n{% for trigger in triggers %}\n{% if trigger.definition.action === 'push' %}{% set branches = getTriggerAttribute(trigger, 'branches').value %}\n push:\n branches:{% for branch in branches %}\n\n - {{ branch }}\n{% endfor %}\n{% else %}{% set types = getTriggerAttribute(trigger, 'types').value %}\n pull_request:\n types: [{{ types.join(', ') }}]\n{% endif %}\n{% endfor %}\n{% endif %}\n\njobs:\n{% for job in jobs %}\n {{ job.id }}:\n{% for attribute in getAttributes(job) %}\n {% if attribute.type === 'Array' %}\n {{attribute.name}}: [{{ attribute.value.join(', ')}}]\n {% else %}\n {{attribute.name}}: {{attribute.value }}\n {% endif %}\n{% endfor %}\n steps:\n{% for step in getSteps(job.id) %}\n{% for attribute in getAttributes(step) %}\n{% if attribute.type === 'Array' %}\n{% if loop.first %}{{\"- \" | indent(6, true)}}{{attribute.name}}{% else %}{{attribute.name | indent(8, true)}}{% endif %}: [{{ attribute.value.join(', ')}}]\n{% elif attribute.type === 'Object' %}\n{% if loop.first %}{{\"- \" | indent(6, true)}}{{attribute.name}}{% else %}{{attribute.name | indent(8, true)}}{% endif %}:\n{% for value in attribute.value %}\n{{value.name | indent(10,true)}}: {% if value.type == 'Number' and value.value == null %}0{% else %}{{ value.value }}{% endif %}\n\n{% endfor %}\n{% else %}\n{% if loop.first %}{{\"- \" | indent(6, true)}}{{attribute.name}}{% else %}{{attribute.name | indent(8, true)}}{% endif %}: {{ attribute.value }}\n{% endif %}\n{% endfor %}\n{% endfor %}\n\n{% endfor %}"};function Cr(e){return Cr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Cr(e)}function jr(e,t){for(var n=0;n{var t={181:(t,e)=>{(()=>{var t={985:function(t){var e;"undefined"!=typeof self&&self,e=function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:r})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=11)}([function(t,e,n){"use strict";var r=Array.prototype,i=Object.prototype,o={"&":"&",'"':""","'":"'","<":"<",">":">"},s=/[&"'<>]/g;function a(t,e){return i.hasOwnProperty.call(t,e)}function c(t){return o[t]}function l(t,e,n){var r,i,o;if(t instanceof Error&&(t=(i=t).name+": "+i.message),Object.setPrototypeOf?(r=new Error(t),Object.setPrototypeOf(r,l.prototype)):(r=this,Object.defineProperty(r,"message",{enumerable:!1,writable:!0,value:t})),Object.defineProperty(r,"name",{value:"Template render error"}),Error.captureStackTrace&&Error.captureStackTrace(r,this.constructor),i){var s=Object.getOwnPropertyDescriptor(i,"stack");(o=s&&(s.get||function(){return s.value}))||(o=function(){return i.stack})}else{var a=new Error(t).stack;o=function(){return a}}return Object.defineProperty(r,"stack",{get:function(){return o.call(r)}}),Object.defineProperty(r,"cause",{value:i}),r.lineno=e,r.colno=n,r.firstUpdate=!0,r.Update=function(t){var e="("+(t||"unknown path")+")";return this.firstUpdate&&(this.lineno&&this.colno?e+=" [Line "+this.lineno+", Column "+this.colno+"]":this.lineno&&(e+=" [Line "+this.lineno+"]")),e+="\n ",this.firstUpdate&&(e+=" "),this.message=e+(this.message||""),this.firstUpdate=!1,this},r}function u(t){return"[object Function]"===i.toString.call(t)}function f(t){return"[object Array]"===i.toString.call(t)}function h(t){return"[object String]"===i.toString.call(t)}function p(t){return"[object Object]"===i.toString.call(t)}function d(t){var e,n=(e=t)?"string"==typeof e?e.split("."):[e]:[];return function(t){for(var e=t,r=0;rt.length)s=i.slice(0,t.length),i.slice(s.length,l).forEach((function(t,n){n2?i-2:0),s=2;s0||!n)&&process.stdout.write(" ".repeat(e));var o=i===r.length-1?"":"\n";process.stdout.write(""+t+o)}))}t.exports={Node:c,Root:f,NodeList:u,Value:l,Literal:h,Symbol:p,Group:d,Array:m,Pair:y,Dict:v,Output:K,Capture:$,TemplateData:V,If:b,IfAsync:_,InlineIf:w,For:k,AsyncEach:E,AsyncAll:x,Macro:O,Caller:S,Import:T,FromImport:A,FunCall:L,Filter:N,FilterAsync:C,KeywordArgs:j,Block:P,Super:I,Extends:R,Include:M,Set:B,Switch:D,Case:F,LookupVal:g,BinOp:q,In:z,Is:W,Or:G,And:Y,Not:H,Add:J,Concat:X,Sub:Q,Mul:Z,Div:tt,FloorDiv:et,Mod:nt,Pow:rt,Neg:it,Pos:ot,Compare:st,CompareOperand:at,CallExtension:ct,CallExtensionAsync:lt,printNodes:function t(e,n){if(n=n||0,ut(e.typename+": ",n),e instanceof u)ut("\n"),e.children.forEach((function(e){t(e,n+2)}));else if(e instanceof ct)ut(e.extName+"."+e.prop+"\n"),e.args&&t(e.args,n+2),e.contentArgs&&e.contentArgs.forEach((function(e){t(e,n+2)}));else{var r=[],i=null;e.iterFields((function(t,e){t instanceof c?r.push([e,t]):(i=i||{})[e]=t})),i?ut(JSON.stringify(i,null,2)+"\n",null,!0):ut("\n"),r.forEach((function(e){var r=e[0],i=e[1];ut("["+r+"] =>",n+2),t(i,n+4)}))}}}},function(t,e){},function(t,e,n){"use strict";function r(t,e){return r=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},r(t,e)}var i=n(8),o=n(17),s=n(3),a=n(0).TemplateError,c=n(2).Frame,l=n(1).Obj,u={"==":"==","===":"===","!=":"!=","!==":"!==","<":"<",">":">","<=":"<=",">=":">="},f=function(t){var e,n;function i(){return t.apply(this,arguments)||this}n=t,(e=i).prototype=Object.create(n.prototype),e.prototype.constructor=e,r(e,n);var o=i.prototype;return o.init=function(t,e){this.templateName=t,this.codebuf=[],this.lastId=0,this.buffer=null,this.bufferStack=[],this._scopeClosers="",this.inBlock=!1,this.throwOnUndefined=e},o.fail=function(t,e,n){throw void 0!==e&&(e+=1),void 0!==n&&(n+=1),new a(t,e,n)},o._pushBuffer=function(){var t=this._tmpid();return this.bufferStack.push(this.buffer),this.buffer=t,this._emit("var "+this.buffer+' = "";'),t},o._popBuffer=function(){this.buffer=this.bufferStack.pop()},o._emit=function(t){this.codebuf.push(t)},o._emitLine=function(t){this._emit(t+"\n")},o._emitLines=function(){for(var t=this,e=arguments.length,n=new Array(e),r=0;r0&&i._emit(","),i.compile(t,e)})),r&&this._emit(r)},o._compileExpression=function(t,e){this.assertType(t,s.Literal,s.Symbol,s.Group,s.Array,s.Dict,s.FunCall,s.Caller,s.Filter,s.LookupVal,s.Compare,s.InlineIf,s.In,s.Is,s.And,s.Or,s.Not,s.Add,s.Concat,s.Sub,s.Mul,s.Div,s.FloorDiv,s.Mod,s.Pow,s.Neg,s.Pos,s.Compare,s.NodeList),this.compile(t,e)},o.assertType=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r0&&r._emit(","),t){r._emitLine("function(cb) {"),r._emitLine("if(!cb) { cb = function(err) { if(err) { throw err; }}}");var i=r._pushBuffer();r._withScopedSyntax((function(){r.compile(t,e),r._emitLine("cb(null, "+i+");")})),r._popBuffer(),r._emitLine("return "+i+";"),r._emitLine("}")}else r._emit("null")})),n){var c=this._tmpid();this._emitLine(", "+this._makeCallback(c)),this._emitLine(this.buffer+" += runtime.suppressValue("+c+", "+a+" && env.opts.autoescape);"),this._addScopeLevel()}else this._emit(")"),this._emit(", "+a+" && env.opts.autoescape);\n")},o.compileCallExtensionAsync=function(t,e){this.compileCallExtension(t,e,!0)},o.compileNodeList=function(t,e){this._compileChildren(t,e)},o.compileLiteral=function(t){if("string"==typeof t.value){var e=t.value.replace(/\\/g,"\\\\");e=(e=(e=(e=(e=e.replace(/"/g,'\\"')).replace(/\n/g,"\\n")).replace(/\r/g,"\\r")).replace(/\t/g,"\\t")).replace(/\u2028/g,"\\u2028"),this._emit('"'+e+'"')}else null===t.value?this._emit("null"):this._emit(t.value.toString())},o.compileSymbol=function(t,e){var n=t.value,r=e.lookup(n);r?this._emit(r):this._emit('runtime.contextOrFrameLookup(context, frame, "'+n+'")')},o.compileGroup=function(t,e){this._compileAggregate(t,e,"(",")")},o.compileArray=function(t,e){this._compileAggregate(t,e,"[","]")},o.compileDict=function(t,e){this._compileAggregate(t,e,"{","}")},o.compilePair=function(t,e){var n=t.key,r=t.value;n instanceof s.Symbol?n=new s.Literal(n.lineno,n.colno,n.value):n instanceof s.Literal&&"string"==typeof n.value||this.fail("compilePair: Dict keys must be strings or names",n.lineno,n.colno),this.compile(n,e),this._emit(": "),this._compileExpression(r,e)},o.compileInlineIf=function(t,e){this._emit("("),this.compile(t.cond,e),this._emit("?"),this.compile(t.body,e),this._emit(":"),null!==t.else_?this.compile(t.else_,e):this._emit('""'),this._emit(")")},o.compileIn=function(t,e){this._emit("runtime.inOperator("),this.compile(t.left,e),this._emit(","),this.compile(t.right,e),this._emit(")")},o.compileIs=function(t,e){var n=t.right.name?t.right.name.value:t.right.value;this._emit('env.getTest("'+n+'").call(context, '),this.compile(t.left,e),t.right.args&&(this._emit(","),this.compile(t.right.args,e)),this._emit(") === true")},o._binOpEmitter=function(t,e,n){this.compile(t.left,e),this._emit(n),this.compile(t.right,e)},o.compileOr=function(t,e){return this._binOpEmitter(t,e," || ")},o.compileAnd=function(t,e){return this._binOpEmitter(t,e," && ")},o.compileAdd=function(t,e){return this._binOpEmitter(t,e," + ")},o.compileConcat=function(t,e){return this._binOpEmitter(t,e,' + "" + ')},o.compileSub=function(t,e){return this._binOpEmitter(t,e," - ")},o.compileMul=function(t,e){return this._binOpEmitter(t,e," * ")},o.compileDiv=function(t,e){return this._binOpEmitter(t,e," / ")},o.compileMod=function(t,e){return this._binOpEmitter(t,e," % ")},o.compileNot=function(t,e){this._emit("!"),this.compile(t.target,e)},o.compileFloorDiv=function(t,e){this._emit("Math.floor("),this.compile(t.left,e),this._emit(" / "),this.compile(t.right,e),this._emit(")")},o.compilePow=function(t,e){this._emit("Math.pow("),this.compile(t.left,e),this._emit(", "),this.compile(t.right,e),this._emit(")")},o.compileNeg=function(t,e){this._emit("-"),this.compile(t.target,e)},o.compilePos=function(t,e){this._emit("+"),this.compile(t.target,e)},o.compileCompare=function(t,e){var n=this;this.compile(t.expr,e),t.ops.forEach((function(t){n._emit(" "+u[t.type]+" "),n.compile(t.expr,e)}))},o.compileLookupVal=function(t,e){this._emit("runtime.memberLookup(("),this._compileExpression(t.target,e),this._emit("),"),this._compileExpression(t.val,e),this._emit(")")},o._getNodeName=function(t){switch(t.typename){case"Symbol":return t.value;case"FunCall":return"the return value of ("+this._getNodeName(t.name)+")";case"LookupVal":return this._getNodeName(t.target)+'["'+this._getNodeName(t.val)+'"]';case"Literal":return t.value.toString();default:return"--expression--"}},o.compileFunCall=function(t,e){this._emit("(lineno = "+t.lineno+", colno = "+t.colno+", "),this._emit("runtime.callWrap("),this._compileExpression(t.name,e),this._emit(', "'+this._getNodeName(t.name).replace(/"/g,'\\"')+'", context, '),this._compileAggregate(t.args,e,"[","])"),this._emit(")")},o.compileFilter=function(t,e){var n=t.name;this.assertType(n,s.Symbol),this._emit('env.getFilter("'+n.value+'").call(context, '),this._compileAggregate(t.args,e),this._emit(")")},o.compileFilterAsync=function(t,e){var n=t.name,r=t.symbol.value;this.assertType(n,s.Symbol),e.set(r,r),this._emit('env.getFilter("'+n.value+'").call(context, '),this._compileAggregate(t.args,e),this._emitLine(", "+this._makeCallback(r)),this._addScopeLevel()},o.compileKeywordArgs=function(t,e){this._emit("runtime.makeKeywordArgs("),this.compileDict(t,e),this._emit(")")},o.compileSet=function(t,e){var n=this,r=[];t.targets.forEach((function(t){var i=t.value,o=e.lookup(i);null==o&&(o=n._tmpid(),n._emitLine("var "+o+";")),r.push(o)})),t.value?(this._emit(r.join(" = ")+" = "),this._compileExpression(t.value,e),this._emitLine(";")):(this._emit(r.join(" = ")+" = "),this.compile(t.body,e),this._emitLine(";")),t.targets.forEach((function(t,e){var i=r[e],o=t.value;n._emitLine('frame.set("'+o+'", '+i+", true);"),n._emitLine("if(frame.topLevel) {"),n._emitLine('context.setVariable("'+o+'", '+i+");"),n._emitLine("}"),"_"!==o.charAt(0)&&(n._emitLine("if(frame.topLevel) {"),n._emitLine('context.addExport("'+o+'", '+i+");"),n._emitLine("}"))}))},o.compileSwitch=function(t,e){var n=this;this._emit("switch ("),this.compile(t.expr,e),this._emit(") {"),t.cases.forEach((function(t,r){n._emit("case "),n.compile(t.cond,e),n._emit(": "),n.compile(t.body,e),t.body.children.length&&n._emitLine("break;")})),t.default&&(this._emit("default:"),this.compile(t.default,e)),this._emit("}")},o.compileIf=function(t,e,n){var r=this;this._emit("if("),this._compileExpression(t.cond,e),this._emitLine(") {"),this._withScopedSyntax((function(){r.compile(t.body,e),n&&r._emit("cb()")})),t.else_?(this._emitLine("}\nelse {"),this._withScopedSyntax((function(){r.compile(t.else_,e),n&&r._emit("cb()")}))):n&&(this._emitLine("}\nelse {"),this._emit("cb()")),this._emitLine("}")},o.compileIfAsync=function(t,e){this._emit("(function(cb) {"),this.compileIf(t,e,!0),this._emit("})("+this._makeCallback()),this._addScopeLevel()},o._emitLoopBindings=function(t,e,n,r){var i=this;[{name:"index",val:n+" + 1"},{name:"index0",val:n},{name:"revindex",val:r+" - "+n},{name:"revindex0",val:r+" - "+n+" - 1"},{name:"first",val:n+" === 0"},{name:"last",val:n+" === "+r+" - 1"},{name:"length",val:r}].forEach((function(t){i._emitLine('frame.set("loop.'+t.name+'", '+t.val+");")}))},o.compileFor=function(t,e){var n=this,r=this._tmpid(),i=this._tmpid(),o=this._tmpid();if(e=e.push(),this._emitLine("frame = frame.push();"),this._emit("var "+o+" = "),this._compileExpression(t.arr,e),this._emitLine(";"),this._emit("if("+o+") {"),this._emitLine(o+" = runtime.fromIterator("+o+");"),t.name instanceof s.Array){this._emitLine("var "+r+";"),this._emitLine("if(runtime.isArray("+o+")) {"),this._emitLine("var "+i+" = "+o+".length;"),this._emitLine("for("+r+"=0; "+r+" < "+o+".length; "+r+"++) {"),t.name.children.forEach((function(i,s){var a=n._tmpid();n._emitLine("var "+a+" = "+o+"["+r+"]["+s+"];"),n._emitLine('frame.set("'+i+'", '+o+"["+r+"]["+s+"]);"),e.set(t.name.children[s].value,a)})),this._emitLoopBindings(t,o,r,i),this._withScopedSyntax((function(){n.compile(t.body,e)})),this._emitLine("}"),this._emitLine("} else {");var a=t.name.children,c=a[0],l=a[1],u=this._tmpid(),f=this._tmpid();e.set(c.value,u),e.set(l.value,f),this._emitLine(r+" = -1;"),this._emitLine("var "+i+" = runtime.keys("+o+").length;"),this._emitLine("for(var "+u+" in "+o+") {"),this._emitLine(r+"++;"),this._emitLine("var "+f+" = "+o+"["+u+"];"),this._emitLine('frame.set("'+c.value+'", '+u+");"),this._emitLine('frame.set("'+l.value+'", '+f+");"),this._emitLoopBindings(t,o,r,i),this._withScopedSyntax((function(){n.compile(t.body,e)})),this._emitLine("}"),this._emitLine("}")}else{var h=this._tmpid();e.set(t.name.value,h),this._emitLine("var "+i+" = "+o+".length;"),this._emitLine("for(var "+r+"=0; "+r+" < "+o+".length; "+r+"++) {"),this._emitLine("var "+h+" = "+o+"["+r+"];"),this._emitLine('frame.set("'+t.name.value+'", '+h+");"),this._emitLoopBindings(t,o,r,i),this._withScopedSyntax((function(){n.compile(t.body,e)})),this._emitLine("}")}this._emitLine("}"),t.else_&&(this._emitLine("if (!"+i+") {"),this.compile(t.else_,e),this._emitLine("}")),this._emitLine("frame = frame.pop();")},o._compileAsyncLoop=function(t,e,n){var r=this,i=this._tmpid(),o=this._tmpid(),a=this._tmpid(),c=n?"asyncAll":"asyncEach";if(e=e.push(),this._emitLine("frame = frame.push();"),this._emit("var "+a+" = runtime.fromIterator("),this._compileExpression(t.arr,e),this._emitLine(");"),t.name instanceof s.Array){var l=t.name.children.length;this._emit("runtime."+c+"("+a+", "+l+", function("),t.name.children.forEach((function(t){r._emit(t.value+",")})),this._emit(i+","+o+",next) {"),t.name.children.forEach((function(t){var n=t.value;e.set(n,n),r._emitLine('frame.set("'+n+'", '+n+");")}))}else{var u=t.name.value;this._emitLine("runtime."+c+"("+a+", 1, function("+u+", "+i+", "+o+",next) {"),this._emitLine('frame.set("'+u+'", '+u+");"),e.set(u,u)}this._emitLoopBindings(t,a,i,o),this._withScopedSyntax((function(){var o;n&&(o=r._pushBuffer()),r.compile(t.body,e),r._emitLine("next("+i+(o?","+o:"")+");"),n&&r._popBuffer()}));var f=this._tmpid();this._emitLine("}, "+this._makeCallback(f)),this._addScopeLevel(),n&&this._emitLine(this.buffer+" += "+f+";"),t.else_&&(this._emitLine("if (!"+a+".length) {"),this.compile(t.else_,e),this._emitLine("}")),this._emitLine("frame = frame.pop();")},o.compileAsyncEach=function(t,e){this._compileAsyncLoop(t,e)},o.compileAsyncAll=function(t,e){this._compileAsyncLoop(t,e,!0)},o._compileMacro=function(t,e){var n=this,r=[],i=null,o="macro_"+this._tmpid(),a=void 0!==e;t.args.children.forEach((function(e,o){o===t.args.children.length-1&&e instanceof s.Dict?i=e:(n.assertType(e,s.Symbol),r.push(e))}));var l,u=[].concat(r.map((function(t){return"l_"+t.value})),["kwargs"]),f=r.map((function(t){return'"'+t.value+'"'})),h=(i&&i.children||[]).map((function(t){return'"'+t.key.value+'"'}));l=a?e.push(!0):new c,this._emitLines("var "+o+" = runtime.makeMacro(","["+f.join(", ")+"], ","["+h.join(", ")+"], ","function ("+u.join(", ")+") {","var callerFrame = frame;","frame = "+(a?"frame.push(true);":"new runtime.Frame();"),"kwargs = kwargs || {};",'if (Object.prototype.hasOwnProperty.call(kwargs, "caller")) {','frame.set("caller", kwargs.caller); }'),r.forEach((function(t){n._emitLine('frame.set("'+t.value+'", l_'+t.value+");"),l.set(t.value,"l_"+t.value)})),i&&i.children.forEach((function(t){var e=t.key.value;n._emit('frame.set("'+e+'", '),n._emit('Object.prototype.hasOwnProperty.call(kwargs, "'+e+'")'),n._emit(' ? kwargs["'+e+'"] : '),n._compileExpression(t.value,l),n._emit(");")}));var p=this._pushBuffer();return this._withScopedSyntax((function(){n.compile(t.body,l)})),this._emitLine("frame = "+(a?"frame.pop();":"callerFrame;")),this._emitLine("return new runtime.SafeString("+p+");"),this._emitLine("});"),this._popBuffer(),o},o.compileMacro=function(t,e){var n=this._compileMacro(t),r=t.name.value;e.set(r,n),e.parent?this._emitLine('frame.set("'+r+'", '+n+");"):("_"!==t.name.value.charAt(0)&&this._emitLine('context.addExport("'+r+'");'),this._emitLine('context.setVariable("'+r+'", '+n+");"))},o.compileCaller=function(t,e){this._emit("(function (){");var n=this._compileMacro(t,e);this._emit("return "+n+";})()")},o._compileGetTemplate=function(t,e,n,r){var i=this._tmpid(),o=this._templateName(),s=this._makeCallback(i),a=n?"true":"false",c=r?"true":"false";return this._emit("env.getTemplate("),this._compileExpression(t.template,e),this._emitLine(", "+a+", "+o+", "+c+", "+s),i},o.compileImport=function(t,e){var n=t.target.value,r=this._compileGetTemplate(t,e,!1,!1);this._addScopeLevel(),this._emitLine(r+".getExported("+(t.withContext?"context.getVariables(), frame, ":"")+this._makeCallback(r)),this._addScopeLevel(),e.set(n,r),e.parent?this._emitLine('frame.set("'+n+'", '+r+");"):this._emitLine('context.setVariable("'+n+'", '+r+");")},o.compileFromImport=function(t,e){var n=this,r=this._compileGetTemplate(t,e,!1,!1);this._addScopeLevel(),this._emitLine(r+".getExported("+(t.withContext?"context.getVariables(), frame, ":"")+this._makeCallback(r)),this._addScopeLevel(),t.names.children.forEach((function(t){var i,o,a=n._tmpid();t instanceof s.Pair?(i=t.key.value,o=t.value.value):o=i=t.value,n._emitLine("if(Object.prototype.hasOwnProperty.call("+r+', "'+i+'")) {'),n._emitLine("var "+a+" = "+r+"."+i+";"),n._emitLine("} else {"),n._emitLine("cb(new Error(\"cannot import '"+i+"'\")); return;"),n._emitLine("}"),e.set(o,a),e.parent?n._emitLine('frame.set("'+o+'", '+a+");"):n._emitLine('context.setVariable("'+o+'", '+a+");")}))},o.compileBlock=function(t){var e=this._tmpid();this.inBlock||this._emit('(parentTemplate ? function(e, c, f, r, cb) { cb(""); } : '),this._emit('context.getBlock("'+t.name.value+'")'),this.inBlock||this._emit(")"),this._emitLine("(env, context, frame, runtime, "+this._makeCallback(e)),this._emitLine(this.buffer+" += "+e+";"),this._addScopeLevel()},o.compileSuper=function(t,e){var n=t.blockName.value,r=t.symbol.value,i=this._makeCallback(r);this._emitLine('context.getSuper(env, "'+n+'", b_'+n+", frame, runtime, "+i),this._emitLine(r+" = runtime.markSafe("+r+");"),this._addScopeLevel(),e.set(r,r)},o.compileExtends=function(t,e){var n=this._tmpid(),r=this._compileGetTemplate(t,e,!0,!1);this._emitLine("parentTemplate = "+r),this._emitLine("for(var "+n+" in parentTemplate.blocks) {"),this._emitLine("context.addBlock("+n+", parentTemplate.blocks["+n+"]);"),this._emitLine("}"),this._addScopeLevel()},o.compileInclude=function(t,e){this._emitLine("var tasks = [];"),this._emitLine("tasks.push("),this._emitLine("function(callback) {");var n=this._compileGetTemplate(t,e,!1,t.ignoreMissing);this._emitLine("callback(null,"+n+");});"),this._emitLine("});");var r=this._tmpid();this._emitLine("tasks.push("),this._emitLine("function(template, callback){"),this._emitLine("template.render(context.getVariables(), frame, "+this._makeCallback(r)),this._emitLine("callback(null,"+r+");});"),this._emitLine("});"),this._emitLine("tasks.push("),this._emitLine("function(result, callback){"),this._emitLine(this.buffer+" += result;"),this._emitLine("callback(null);"),this._emitLine("});"),this._emitLine("env.waterfall(tasks, function(){"),this._addScopeLevel()},o.compileTemplateData=function(t,e){this.compileLiteral(t,e)},o.compileCapture=function(t,e){var n=this,r=this.buffer;this.buffer="output",this._emitLine("(function() {"),this._emitLine('var output = "";'),this._withScopedSyntax((function(){n.compile(t.body,e)})),this._emitLine("return output;"),this._emitLine("})()"),this.buffer=r},o.compileOutput=function(t,e){var n=this;t.children.forEach((function(r){r instanceof s.TemplateData?r.value&&(n._emit(n.buffer+" += "),n.compileLiteral(r,e),n._emitLine(";")):(n._emit(n.buffer+" += runtime.suppressValue("),n.throwOnUndefined&&n._emit("runtime.ensureDefined("),n.compile(r,e),n.throwOnUndefined&&n._emit(","+t.lineno+","+t.colno+")"),n._emit(", env.opts.autoescape);\n"))}))},o.compileRoot=function(t,e){var n=this;e&&this.fail("compileRoot: root node can't have frame"),e=new c,this._emitFuncBegin(t,"root"),this._emitLine("var parentTemplate = null;"),this._compileChildren(t,e),this._emitLine("if(parentTemplate) {"),this._emitLine("parentTemplate.rootRenderFunc(env, context, frame, runtime, cb);"),this._emitLine("} else {"),this._emitLine("cb(null, "+this.buffer+");"),this._emitLine("}"),this._emitFuncEnd(!0),this.inBlock=!0;var r=[],i=t.findAll(s.Block);i.forEach((function(t,e){var i=t.name.value;if(-1!==r.indexOf(i))throw new Error('Block "'+i+'" defined more than once.');r.push(i),n._emitFuncBegin(t,"b_"+i);var o=new c;n._emitLine("var frame = frame.push(true);"),n.compile(t.body,o),n._emitFuncEnd()})),this._emitLine("return {"),i.forEach((function(t,e){var r="b_"+t.name.value;n._emitLine(r+": "+r+",")})),this._emitLine("root: root\n};")},o.compile=function(t,e){var n=this["compile"+t.typename];n?n.call(this,t,e):this.fail("compile: Cannot compile node: "+t.typename,t.lineno,t.colno)},o.getCode=function(){return this.codebuf.join("")},i}(l);t.exports={compile:function(t,e,n,r,s){void 0===s&&(s={});var a=new f(r,s.throwOnUndefined),c=(n||[]).map((function(t){return t.preprocess})).filter((function(t){return!!t})).reduce((function(t,e){return e(t)}),t);return a.compile(o.transform(i.parse(c,n,s),e,r)),a.getCode()},Compiler:f}},function(t,e,n){"use strict";function r(t,e){return r=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},r(t,e)}var i=n(4),o=n(1).EmitterObj;t.exports=function(t){var e,n;function o(){return t.apply(this,arguments)||this}n=t,(e=o).prototype=Object.create(n.prototype),e.prototype.constructor=e,r(e,n);var s=o.prototype;return s.resolve=function(t,e){return i.resolve(i.dirname(t),e)},s.isRelative=function(t){return 0===t.indexOf("./")||0===t.indexOf("../")},o}(o)},function(t,e,n){"use strict";function r(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,i(t,e)}function i(t,e){return i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},i(t,e)}var o=n(12),s=n(15),a=n(0),c=n(5),l=n(18),u=n(10),f=u.FileSystemLoader,h=u.WebLoader,p=u.PrecompiledLoader,d=n(20),m=n(21),y=n(1),v=y.Obj,g=y.EmitterObj,b=n(2),_=b.handleError,w=b.Frame,k=n(22);function E(t,e,n){o((function(){t(e,n)}))}var x={type:"code",obj:{root:function(t,e,n,r,i){try{i(null,"")}catch(t){i(_(t,null,null))}}}},O=function(t){function e(){return t.apply(this,arguments)||this}r(e,t);var n=e.prototype;return n.init=function(t,e){var n=this;e=this.opts=e||{},this.opts.dev=!!e.dev,this.opts.autoescape=null==e.autoescape||e.autoescape,this.opts.throwOnUndefined=!!e.throwOnUndefined,this.opts.trimBlocks=!!e.trimBlocks,this.opts.lstripBlocks=!!e.lstripBlocks,this.loaders=[],t?this.loaders=a.isArray(t)?t:[t]:f?this.loaders=[new f("views")]:h&&(this.loaders=[new h("/views")]),"undefined"!=typeof window&&window.nunjucksPrecompiled&&this.loaders.unshift(new p(window.nunjucksPrecompiled)),this._initLoaders(),this.globals=m(),this.filters={},this.tests={},this.asyncFilters=[],this.extensions={},this.extensionsList=[],a._entries(l).forEach((function(t){var e=t[0],r=t[1];return n.addFilter(e,r)})),a._entries(d).forEach((function(t){var e=t[0],r=t[1];return n.addTest(e,r)}))},n._initLoaders=function(){var t=this;this.loaders.forEach((function(e){e.cache={},"function"==typeof e.on&&(e.on("update",(function(n,r){e.cache[n]=null,t.emit("update",n,r,e)})),e.on("load",(function(n,r){t.emit("load",n,r,e)})))}))},n.invalidateCache=function(){this.loaders.forEach((function(t){t.cache={}}))},n.addExtension=function(t,e){return e.__name=t,this.extensions[t]=e,this.extensionsList.push(e),this},n.removeExtension=function(t){var e=this.getExtension(t);e&&(this.extensionsList=a.without(this.extensionsList,e),delete this.extensions[t])},n.getExtension=function(t){return this.extensions[t]},n.hasExtension=function(t){return!!this.extensions[t]},n.addGlobal=function(t,e){return this.globals[t]=e,this},n.getGlobal=function(t){if(void 0===this.globals[t])throw new Error("global not found: "+t);return this.globals[t]},n.addFilter=function(t,e,n){var r=e;return n&&this.asyncFilters.push(t),this.filters[t]=r,this},n.getFilter=function(t){if(!this.filters[t])throw new Error("filter not found: "+t);return this.filters[t]},n.addTest=function(t,e){return this.tests[t]=e,this},n.getTest=function(t){if(!this.tests[t])throw new Error("test not found: "+t);return this.tests[t]},n.resolveTemplate=function(t,e,n){return t.isRelative&&e&&t.isRelative(n)&&t.resolve?t.resolve(e,n):n},n.getTemplate=function(t,e,n,r,i){var o,s=this,c=this,l=null;if(t&&t.raw&&(t=t.raw),a.isFunction(n)&&(i=n,n=null,e=e||!1),a.isFunction(e)&&(i=e,e=!1),t instanceof T)l=t;else{if("string"!=typeof t)throw new Error("template names must be a string: "+t);for(var u=0;u0&&!this.skip(i.TOKEN_COMMA)&&this.fail("parseFrom: expected comma",t.lineno,t.colno);var a=this.parsePrimary();if("_"===a.value.charAt(0)&&this.fail("parseFrom: names starting with an underscore cannot be imported",a.lineno,a.colno),this.skipSymbol("as")){var c=this.parsePrimary();r.addChild(new o.Pair(a.lineno,a.colno,a,c))}else r.addChild(a);n=this.parseWithContext()}return new o.FromImport(t.lineno,t.colno,e,r,n)},c.parseBlock=function(){var t=this.peekToken();this.skipSymbol("block")||this.fail("parseBlock: expected block",t.lineno,t.colno);var e=new o.Block(t.lineno,t.colno);e.name=this.parsePrimary(),e.name instanceof o.Symbol||this.fail("parseBlock: variable name expected",t.lineno,t.colno),this.advanceAfterBlockEnd(t.value),e.body=this.parseUntilBlocks("endblock"),this.skipSymbol("endblock"),this.skipSymbol(e.name.value);var n=this.peekToken();return n||this.fail("parseBlock: expected endblock, got end of file"),this.advanceAfterBlockEnd(n.value),e},c.parseExtends=function(){var t="extends",e=this.peekToken();this.skipSymbol(t)||this.fail("parseTemplateRef: expected "+t);var n=new o.Extends(e.lineno,e.colno);return n.template=this.parseExpression(),this.advanceAfterBlockEnd(e.value),n},c.parseInclude=function(){var t="include",e=this.peekToken();this.skipSymbol(t)||this.fail("parseInclude: expected "+t);var n=new o.Include(e.lineno,e.colno);return n.template=this.parseExpression(),this.skipSymbol("ignore")&&this.skipSymbol("missing")&&(n.ignoreMissing=!0),this.advanceAfterBlockEnd(e.value),n},c.parseIf=function(){var t,e=this.peekToken();this.skipSymbol("if")||this.skipSymbol("elif")||this.skipSymbol("elseif")?t=new o.If(e.lineno,e.colno):this.skipSymbol("ifAsync")?t=new o.IfAsync(e.lineno,e.colno):this.fail("parseIf: expected if, elif, or elseif",e.lineno,e.colno),t.cond=this.parseExpression(),this.advanceAfterBlockEnd(e.value),t.body=this.parseUntilBlocks("elif","elseif","else","endif");var n=this.peekToken();switch(n&&n.value){case"elseif":case"elif":t.else_=this.parseIf();break;case"else":this.advanceAfterBlockEnd(),t.else_=this.parseUntilBlocks("endif"),this.advanceAfterBlockEnd();break;case"endif":t.else_=null,this.advanceAfterBlockEnd();break;default:this.fail("parseIf: expected elif, else, or endif, got end of file")}return t},c.parseSet=function(){var t=this.peekToken();this.skipSymbol("set")||this.fail("parseSet: expected set",t.lineno,t.colno);for(var e,n=new o.Set(t.lineno,t.colno,[]);(e=this.parsePrimary())&&(n.targets.push(e),this.skip(i.TOKEN_COMMA)););return this.skipValue(i.TOKEN_OPERATOR,"=")?(n.value=this.parseExpression(),this.advanceAfterBlockEnd(t.value)):this.skip(i.TOKEN_BLOCK_END)?(n.body=new o.Capture(t.lineno,t.colno,this.parseUntilBlocks("endset")),n.value=null,this.advanceAfterBlockEnd()):this.fail("parseSet: expected = or block end in set tag",t.lineno,t.colno),n},c.parseSwitch=function(){var t="switch",e="endswitch",n="case",r="default",i=this.peekToken();this.skipSymbol(t)||this.skipSymbol(n)||this.skipSymbol(r)||this.fail('parseSwitch: expected "switch," "case" or "default"',i.lineno,i.colno);var s=this.parseExpression();this.advanceAfterBlockEnd(t),this.parseUntilBlocks(n,r,e);var a,c=this.peekToken(),l=[];do{this.skipSymbol(n);var u=this.parseExpression();this.advanceAfterBlockEnd(t);var f=this.parseUntilBlocks(n,r,e);l.push(new o.Case(c.line,c.col,u,f)),c=this.peekToken()}while(c&&c.value===n);switch(c.value){case r:this.advanceAfterBlockEnd(),a=this.parseUntilBlocks(e),this.advanceAfterBlockEnd();break;case e:this.advanceAfterBlockEnd();break;default:this.fail('parseSwitch: expected "case," "default" or "endswitch," got EOF.')}return new o.Switch(i.lineno,i.colno,s,l,a)},c.parseStatement=function(){var t=this.peekToken();if(t.type!==i.TOKEN_SYMBOL&&this.fail("tag name expected",t.lineno,t.colno),this.breakOnBlocks&&-1!==a.indexOf(this.breakOnBlocks,t.value))return null;switch(t.value){case"raw":return this.parseRaw();case"verbatim":return this.parseRaw("verbatim");case"if":case"ifAsync":return this.parseIf();case"for":case"asyncEach":case"asyncAll":return this.parseFor();case"block":return this.parseBlock();case"extends":return this.parseExtends();case"include":return this.parseInclude();case"set":return this.parseSet();case"macro":return this.parseMacro();case"call":return this.parseCall();case"import":return this.parseImport();case"from":return this.parseFrom();case"filter":return this.parseFilterStatement();case"switch":return this.parseSwitch();default:if(this.extensions.length)for(var e=0;e0;){var c=s[0],l=s[1],u=s[2];u===t?r+=1:u===e&&(r-=1),0===r?(i+=l,this.tokens.backN(c.length-l.length)):i+=c}return new o.Output(a.lineno,a.colno,[new o.TemplateData(a.lineno,a.colno,i)])},c.parsePostfix=function(t){for(var e,n=this.peekToken();n;){if(n.type===i.TOKEN_LEFT_PAREN)t=new o.FunCall(n.lineno,n.colno,t,this.parseSignature());else if(n.type===i.TOKEN_LEFT_BRACKET)(e=this.parseAggregate()).children.length>1&&this.fail("invalid index"),t=new o.LookupVal(n.lineno,n.colno,t,e.children[0]);else{if(n.type!==i.TOKEN_OPERATOR||"."!==n.value)break;this.nextToken();var r=this.nextToken();r.type!==i.TOKEN_SYMBOL&&this.fail("expected name as lookup value, got "+r.value,r.lineno,r.colno),e=new o.Literal(r.lineno,r.colno,r.value),t=new o.LookupVal(n.lineno,n.colno,t,e)}n=this.peekToken()}return t},c.parseExpression=function(){return this.parseInlineIf()},c.parseInlineIf=function(){var t=this.parseOr();if(this.skipSymbol("if")){var e=this.parseOr(),n=t;(t=new o.InlineIf(t.lineno,t.colno)).body=n,t.cond=e,this.skipSymbol("else")?t.else_=this.parseOr():t.else_=null}return t},c.parseOr=function(){for(var t=this.parseAnd();this.skipSymbol("or");){var e=this.parseAnd();t=new o.Or(t.lineno,t.colno,t,e)}return t},c.parseAnd=function(){for(var t=this.parseNot();this.skipSymbol("and");){var e=this.parseNot();t=new o.And(t.lineno,t.colno,t,e)}return t},c.parseNot=function(){var t=this.peekToken();return this.skipSymbol("not")?new o.Not(t.lineno,t.colno,this.parseNot()):this.parseIn()},c.parseIn=function(){for(var t=this.parseIs();;){var e=this.nextToken();if(!e)break;var n=e.type===i.TOKEN_SYMBOL&&"not"===e.value;if(n||this.pushToken(e),!this.skipSymbol("in")){n&&this.pushToken(e);break}var r=this.parseIs();t=new o.In(t.lineno,t.colno,t,r),n&&(t=new o.Not(t.lineno,t.colno,t))}return t},c.parseIs=function(){var t=this.parseCompare();if(this.skipSymbol("is")){var e=this.skipSymbol("not"),n=this.parseCompare();t=new o.Is(t.lineno,t.colno,t,n),e&&(t=new o.Not(t.lineno,t.colno,t))}return t},c.parseCompare=function(){for(var t=["==","===","!=","!==","<",">","<=",">="],e=this.parseConcat(),n=[];;){var r=this.nextToken();if(!r)break;if(-1===t.indexOf(r.value)){this.pushToken(r);break}n.push(new o.CompareOperand(r.lineno,r.colno,this.parseConcat(),r.value))}return n.length?new o.Compare(n[0].lineno,n[0].colno,e,n):e},c.parseConcat=function(){for(var t=this.parseAdd();this.skipValue(i.TOKEN_TILDE,"~");){var e=this.parseAdd();t=new o.Concat(t.lineno,t.colno,t,e)}return t},c.parseAdd=function(){for(var t=this.parseSub();this.skipValue(i.TOKEN_OPERATOR,"+");){var e=this.parseSub();t=new o.Add(t.lineno,t.colno,t,e)}return t},c.parseSub=function(){for(var t=this.parseMul();this.skipValue(i.TOKEN_OPERATOR,"-");){var e=this.parseMul();t=new o.Sub(t.lineno,t.colno,t,e)}return t},c.parseMul=function(){for(var t=this.parseDiv();this.skipValue(i.TOKEN_OPERATOR,"*");){var e=this.parseDiv();t=new o.Mul(t.lineno,t.colno,t,e)}return t},c.parseDiv=function(){for(var t=this.parseFloorDiv();this.skipValue(i.TOKEN_OPERATOR,"/");){var e=this.parseFloorDiv();t=new o.Div(t.lineno,t.colno,t,e)}return t},c.parseFloorDiv=function(){for(var t=this.parseMod();this.skipValue(i.TOKEN_OPERATOR,"//");){var e=this.parseMod();t=new o.FloorDiv(t.lineno,t.colno,t,e)}return t},c.parseMod=function(){for(var t=this.parsePow();this.skipValue(i.TOKEN_OPERATOR,"%");){var e=this.parsePow();t=new o.Mod(t.lineno,t.colno,t,e)}return t},c.parsePow=function(){for(var t=this.parseUnary();this.skipValue(i.TOKEN_OPERATOR,"**");){var e=this.parseUnary();t=new o.Pow(t.lineno,t.colno,t,e)}return t},c.parseUnary=function(t){var e,n=this.peekToken();return e=this.skipValue(i.TOKEN_OPERATOR,"-")?new o.Neg(n.lineno,n.colno,this.parseUnary(!0)):this.skipValue(i.TOKEN_OPERATOR,"+")?new o.Pos(n.lineno,n.colno,this.parseUnary(!0)):this.parsePrimary(),t||(e=this.parseFilter(e)),e},c.parsePrimary=function(t){var e,n=this.nextToken(),r=null;if(n?n.type===i.TOKEN_STRING?e=n.value:n.type===i.TOKEN_INT?e=parseInt(n.value,10):n.type===i.TOKEN_FLOAT?e=parseFloat(n.value):n.type===i.TOKEN_BOOLEAN?"true"===n.value?e=!0:"false"===n.value?e=!1:this.fail("invalid boolean: "+n.value,n.lineno,n.colno):n.type===i.TOKEN_NONE?e=null:n.type===i.TOKEN_REGEX&&(e=new RegExp(n.value.body,n.value.flags)):this.fail("expected expression, got end of file"),void 0!==e?r=new o.Literal(n.lineno,n.colno,e):n.type===i.TOKEN_SYMBOL?r=new o.Symbol(n.lineno,n.colno,n.value):(this.pushToken(n),r=this.parseAggregate()),t||(r=this.parsePostfix(r)),r)return r;throw this.error("unexpected token: "+n.value,n.lineno,n.colno)},c.parseFilterName=function(){for(var t=this.expect(i.TOKEN_SYMBOL),e=t.value;this.skipValue(i.TOKEN_OPERATOR,".");)e+="."+this.expect(i.TOKEN_SYMBOL).value;return new o.Symbol(t.lineno,t.colno,e)},c.parseFilterArgs=function(t){return this.peekToken().type===i.TOKEN_LEFT_PAREN?this.parsePostfix(t).args.children:[]},c.parseFilter=function(t){for(;this.skip(i.TOKEN_PIPE);){var e=this.parseFilterName();t=new o.Filter(e.lineno,e.colno,e,new o.NodeList(e.lineno,e.colno,[t].concat(this.parseFilterArgs(t))))}return t},c.parseFilterStatement=function(){var t=this.peekToken();this.skipSymbol("filter")||this.fail("parseFilterStatement: expected filter");var e=this.parseFilterName(),n=this.parseFilterArgs(e);this.advanceAfterBlockEnd(t.value);var r=new o.Capture(e.lineno,e.colno,this.parseUntilBlocks("endfilter"));this.advanceAfterBlockEnd();var i=new o.Filter(e.lineno,e.colno,e,new o.NodeList(e.lineno,e.colno,[r].concat(n)));return new o.Output(e.lineno,e.colno,[i])},c.parseAggregate=function(){var t,e=this.nextToken();switch(e.type){case i.TOKEN_LEFT_PAREN:t=new o.Group(e.lineno,e.colno);break;case i.TOKEN_LEFT_BRACKET:t=new o.Array(e.lineno,e.colno);break;case i.TOKEN_LEFT_CURLY:t=new o.Dict(e.lineno,e.colno);break;default:return null}for(;;){var n=this.peekToken().type;if(n===i.TOKEN_RIGHT_PAREN||n===i.TOKEN_RIGHT_BRACKET||n===i.TOKEN_RIGHT_CURLY){this.nextToken();break}if(t.children.length>0&&(this.skip(i.TOKEN_COMMA)||this.fail("parseAggregate: expected comma after expression",e.lineno,e.colno)),t instanceof o.Dict){var r=this.parsePrimary();this.skip(i.TOKEN_COLON)||this.fail("parseAggregate: expected colon after dict key",e.lineno,e.colno);var s=this.parseExpression();t.addChild(new o.Pair(r.lineno,r.colno,r,s))}else{var a=this.parseExpression();t.addChild(a)}}return t},c.parseSignature=function(t,e){var n=this.peekToken();if(!e&&n.type!==i.TOKEN_LEFT_PAREN){if(t)return null;this.fail("expected arguments",n.lineno,n.colno)}n.type===i.TOKEN_LEFT_PAREN&&(n=this.nextToken());for(var r=new o.NodeList(n.lineno,n.colno),s=new o.KeywordArgs(n.lineno,n.colno),a=!1;;){if(n=this.peekToken(),!e&&n.type===i.TOKEN_RIGHT_PAREN){this.nextToken();break}if(e&&n.type===i.TOKEN_BLOCK_END)break;if(a&&!this.skip(i.TOKEN_COMMA))this.fail("parseSignature: expected comma after expression",n.lineno,n.colno);else{var c=this.parseExpression();this.skipValue(i.TOKEN_OPERATOR,"=")?s.addChild(new o.Pair(c.lineno,c.colno,c,this.parseExpression())):r.addChild(c)}a=!0}return s.children.length&&r.addChild(s),r},c.parseUntilBlocks=function(){for(var t=this.breakOnBlocks,e=arguments.length,n=new Array(e),r=0;r=","//","**"],B=C+this.current();switch(-1!==r.indexOf(M,B)&&(this.forward(),C=B,-1!==r.indexOf(M,B+this.current())&&(C=B+this.current(),this.forward())),C){case"(":R=d;break;case")":R=m;break;case"[":R=y;break;case"]":R=v;break;case"{":R=g;break;case"}":R=b;break;case",":R=w;break;case":":R=k;break;case"~":R=E;break;case"|":R=x;break;default:R=_}return N(R,C,e,n)}if((t=this._extractUntil(i+o)).match(/^[-+]?[0-9]+$/)){if("."===this.current()){this.forward();var D=this._extract("0123456789");return N(O,t+"."+D,e,n)}return N("int",t,e,n)}if(t.match(/^(true|false)$/))return N(S,t,e,n);if("none"===t)return N(T,t,e,n);if("null"===t)return N(T,t,e,n);if(t)return N(A,t,e,n);throw new Error("Unexpected value while parsing: "+t)}var F,K=this.tags.BLOCK_START.charAt(0)+this.tags.VARIABLE_START.charAt(0)+this.tags.COMMENT_START.charAt(0)+this.tags.COMMENT_END.charAt(0);if(this.isFinished())return null;if((t=this._extractString(this.tags.BLOCK_START+"-"))||(t=this._extractString(this.tags.BLOCK_START)))return this.in_code=!0,N(l,t,e,n);if((t=this._extractString(this.tags.VARIABLE_START+"-"))||(t=this._extractString(this.tags.VARIABLE_START)))return this.in_code=!0,N(f,t,e,n);t="";var $=!1;for(this._matches(this.tags.COMMENT_START)&&($=!0,t=this._extractString(this.tags.COMMENT_START));null!==(F=this._extractUntil(K));){if(t+=F,(this._matches(this.tags.BLOCK_START)||this._matches(this.tags.VARIABLE_START)||this._matches(this.tags.COMMENT_START))&&!$){if(this.lstripBlocks&&this._matches(this.tags.BLOCK_START)&&this.colno>0&&this.colno<=t.length){var V=t.slice(-this.colno);if(/^\s+$/.test(V)&&!(t=t.slice(0,-this.colno)).length)return this.nextToken()}break}if(this._matches(this.tags.COMMENT_END)){if(!$)throw new Error("unexpected end of comment");t+=this._extractString(this.tags.COMMENT_END);break}t+=this.current(),this.forward()}if(null===F&&$)throw new Error("expected end of comment, got end of file");return N($?p:c,t,e,n)},e._parseString=function(t){this.forward();for(var e="";!this.isFinished()&&this.current()!==t;){var n=this.current();if("\\"===n){switch(this.forward(),this.current()){case"n":e+="\n";break;case"t":e+="\t";break;case"r":e+="\r";break;default:e+=this.current()}this.forward()}else e+=n,this.forward()}return this.forward(),e},e._matches=function(t){return this.index+t.length>this.len?null:this.str.slice(this.index,this.index+t.length)===t},e._extractString=function(t){return this._matches(t)?(this.forwardN(t.length),t):null},e._extractUntil=function(t){return this._extractMatching(!0,t||"")},e._extract=function(t){return this._extractMatching(!1,t)},e._extractMatching=function(t,e){if(this.isFinished())return null;var n=e.indexOf(this.current());if(t&&-1===n||!t&&-1!==n){var r=this.current();this.forward();for(var i=e.indexOf(this.current());(t&&-1===i||!t&&-1!==i)&&!this.isFinished();)r+=this.current(),this.forward(),i=e.indexOf(this.current());return r}return""},e._extractRegex=function(t){var e=this.currentStr().match(t);return e?(this.forwardN(e[0].length),e):null},e.isFinished=function(){return this.index>=this.len},e.forwardN=function(t){for(var e=0;e1024){for(var e=0,n=i.length-o;e0&&s.length>i&&!s.warned){s.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=t,c.type=e,c.count=s.length,a=c,console&&console.warn&&console.warn(a)}return t}function h(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},i=h.bind(r);return i.listener=n,r.wrapFn=i,i}function d(t,e,n){var r=t._events;if(void 0===r)return[];var i=r[e];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(t){for(var e=new Array(t.length),n=0;n0&&(s=e[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var c=i[t];if(void 0===c)return!1;if("function"==typeof c)o(c,this,e);else{var l=c.length,u=y(c,l);for(n=0;n=0;o--)if(n[o]===e||n[o].listener===e){s=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(t,e){for(;e+1=0;r--)this.removeListener(t,e[r]);return this},a.prototype.listeners=function(t){return d(this,t,!0)},a.prototype.rawListeners=function(t){return d(this,t,!1)},a.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):m.call(t,e)},a.prototype.listenerCount=m,a.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(t,e,n){"use strict";var r=n(3),i=n(0),o=0;function s(){return"hole_"+o++}function a(t,e){for(var n=null,r=0;r=e)return t;var n=e-t.length,s=r.repeat(" ",n/2-n%2),a=r.repeat(" ",n/2);return i.copySafeness(t,s+t+a)},e.default=function(t,e,n){return n?t||e:void 0!==t?t:e},e.dictsort=function(t,e,n){if(!r.isObject(t))throw new r.TemplateError("dictsort filter: val must be an object");var i,o=[];for(var s in t)o.push([s,t[s]]);if(void 0===n||"key"===n)i=0;else{if("value"!==n)throw new r.TemplateError("dictsort filter: You can only sort by either key or value");i=1}return o.sort((function(t,n){var o=t[i],s=n[i];return e||(r.isString(o)&&(o=o.toUpperCase()),r.isString(s)&&(s=s.toUpperCase())),o>s?1:o===s?0:-1})),o},e.dump=function(t,e){return JSON.stringify(t,null,e)},e.escape=function(t){return t instanceof i.SafeString?t:(t=null==t?"":t,i.markSafe(r.escape(t.toString())))},e.safe=function(t){return t instanceof i.SafeString?t:(t=null==t?"":t,i.markSafe(t.toString()))},e.first=function(t){return t[0]},e.forceescape=function(t){return t=null==t?"":t,i.markSafe(r.escape(t.toString()))},e.groupby=function(t,e){return r.groupBy(t,e,this.env.opts.throwOnUndefined)},e.indent=function(t,e,n){if(""===(t=o(t,"")))return"";e=e||4;var s=t.split("\n"),a=r.repeat(" ",e),c=s.map((function(t,e){return 0!==e||n?""+a+t:t})).join("\n");return i.copySafeness(t,c)},e.join=function(t,e,n){return e=e||"",n&&(t=r.map(t,(function(t){return t[n]}))),t.join(e)},e.last=function(t){return t[t.length-1]},e.length=function(t){var e=o(t,"");return void 0!==e?"function"==typeof Map&&e instanceof Map||"function"==typeof Set&&e instanceof Set?e.size:!r.isObject(e)||e instanceof i.SafeString?e.length:r.keys(e).length:0},e.list=c,e.lower=function(t){return(t=o(t,"")).toLowerCase()},e.nl2br=function(t){return null==t?"":i.copySafeness(t,t.replace(/\r\n|\n/g,"
\n"))},e.random=function(t){return t[Math.floor(Math.random()*t.length)]},e.reject=l(!1),e.rejectattr=function(t,e){return t.filter((function(t){return!t[e]}))},e.select=l(!0),e.selectattr=function(t,e){return t.filter((function(t){return!!t[e]}))},e.replace=function(t,e,n,r){var o=t;if(e instanceof RegExp)return t.replace(e,n);void 0===r&&(r=-1);var s="";if("number"==typeof e)e=""+e;else if("string"!=typeof e)return t;if("number"==typeof t&&(t=""+t),"string"!=typeof t&&!(t instanceof i.SafeString))return t;if(""===e)return s=n+t.split("").join(n)+n,i.copySafeness(t,s);var a=t.indexOf(e);if(0===r||-1===a)return t;for(var c=0,l=0;a>-1&&(-1===r||l=i&&u.push(n),o.push(u)}return o},e.sum=function(t,e,n){return void 0===n&&(n=0),e&&(t=r.map(t,(function(t){return t[e]}))),n+t.reduce((function(t,e){return t+e}),0)},e.sort=i.makeMacro(["value","reverse","case_sensitive","attribute"],[],(function(t,e,n,i){var o=this,s=r.map(t,(function(t){return t})),a=r.getAttrGetter(i);return s.sort((function(t,s){var c=i?a(t):t,l=i?a(s):s;if(o.env.opts.throwOnUndefined&&i&&(void 0===c||void 0===l))throw new TypeError('sort: attribute "'+i+'" resolved to undefined');return!n&&r.isString(c)&&r.isString(l)&&(c=c.toLowerCase(),l=l.toLowerCase()),cl?e?-1:1:0})),s})),e.string=function(t){return i.copySafeness(t,t)},e.striptags=function(t,e){var n,r=u((t=o(t,"")).replace(/<\/?([a-z][a-z0-9]*)\b[^>]*>|/gi,""));return n=e?r.replace(/^ +| +$/gm,"").replace(/ +/g," ").replace(/(\r\n)/g,"\n").replace(/\n\n\n+/g,"\n\n"):r.replace(/\s+/gi," "),i.copySafeness(t,n)},e.title=function(t){var e=(t=o(t,"")).split(" ").map((function(t){return a(t)}));return i.copySafeness(t,e.join(" "))},e.trim=u,e.truncate=function(t,e,n,r){var s=t;if(e=e||255,(t=o(t,"")).length<=e)return t;if(n)t=t.substring(0,e);else{var a=t.lastIndexOf(" ",e);-1===a&&(a=e),t=t.substring(0,a)}return t+=null!=r?r:"...",i.copySafeness(s,t)},e.upper=function(t){return(t=o(t,"")).toUpperCase()},e.urlencode=function(t){var e=encodeURIComponent;return r.isString(t)?e(t):(r.isArray(t)?t:r._entries(t)).map((function(t){var n=t[0],r=t[1];return e(n)+"="+e(r)})).join("&")};var f=/^(?:\(|<|<)?(.*?)(?:\.|,|\)|\n|>)?$/,h=/^[\w.!#$%&'*+\-\/=?\^`{|}~]+@[a-z\d\-]+(\.[a-z\d\-]+)+$/i,p=/^https?:\/\/.*$/,d=/^www\./,m=/\.(?:org|net|com)(?:\:|\/|$)/;e.urlize=function(t,e,n){s(e)&&(e=1/0);var r=!0===n?' rel="nofollow"':"";return t.split(/(\s+)/).filter((function(t){return t&&t.length})).map((function(t){var n=t.match(f),i=n?n[1]:t,o=i.substr(0,e);return p.test(i)?'"+o+"":d.test(i)?'"+o+"":h.test(i)?''+i+"":m.test(i)?'"+o+"":t})).join("")},e.wordcount=function(t){var e=(t=o(t,""))?t.match(/\w+/g):null;return e?e.length:null},e.float=function(t,e){var n=parseFloat(t);return s(n)?e:n};var y=i.makeMacro(["value","default","base"],[],(function(t,e,n){void 0===n&&(n=10);var r=parseInt(t,n);return s(r)?e:r}));e.int=y,e.d=e.default,e.e=e.escape},function(t,e,n){"use strict";function r(t,e){return r=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},r(t,e)}var i=function(t){var e,n;function i(e){var n;return(n=t.call(this)||this).precompiled=e||{},n}return n=t,(e=i).prototype=Object.create(n.prototype),e.prototype.constructor=e,r(e,n),i.prototype.getSource=function(t){return this.precompiled[t]?{src:{type:"code",obj:this.precompiled[t]},path:t}:null},i}(n(6));t.exports={PrecompiledLoader:i}},function(t,e,n){"use strict";var r=n(2).SafeString;e.callable=function(t){return"function"==typeof t},e.defined=function(t){return void 0!==t},e.divisibleby=function(t,e){return t%e==0},e.escaped=function(t){return t instanceof r},e.equalto=function(t,e){return t===e},e.eq=e.equalto,e.sameas=e.equalto,e.even=function(t){return t%2==0},e.falsy=function(t){return!t},e.ge=function(t,e){return t>=e},e.greaterthan=function(t,e){return t>e},e.gt=e.greaterthan,e.le=function(t,e){return t<=e},e.lessthan=function(t,e){return t0)for(var i=t;ie;o+=n)r.push(o);return r},cycler:function(){return t=Array.prototype.slice.call(arguments),e=-1,{current:null,reset:function(){e=-1,this.current=null},next:function(){return++e>=t.length&&(e=0),this.current=t[e],this.current}};var t,e},joiner:function(t){return function(t){t=t||",";var e=!0;return function(){var n=e?"":t;return e=!1,n}}(t)}}}},function(t,e,n){var r=n(4);t.exports=function(t,e){function n(t,e){if(this.name=t,this.path=t,this.defaultEngine=e.defaultEngine,this.ext=r.extname(t),!this.ext&&!this.defaultEngine)throw new Error("No default engine was specified and no extension was provided.");this.ext||(this.name+=this.ext=("."!==this.defaultEngine[0]?".":"")+this.defaultEngine)}return n.prototype.render=function(e,n){t.render(this.name,e,n)},e.set("view",n),e.set("nunjucksEnv",t),t}},function(t,e,n){"use strict";var r=n(4),i=n(4),o=n(0)._prettifyError,s=n(5),a=n(7).Environment,c=n(24);function l(t,e){return!!Array.isArray(e)&&e.some((function(e){return t.match(e)}))}function u(t,e){(e=e||{}).isString=!0;var n=e.env||new a([]),r=e.wrapper||c;if(!e.name)throw new Error('the "name" option is required when compiling a string');return r([f(t,e.name,n)],e)}function f(t,e,n){var r,i=(n=n||new a([])).asyncFilters,c=n.extensionsList;e=e.replace(/\\/g,"/");try{r=s.compile(t,i,c,e,n.opts)}catch(t){throw o(e,!1,t)}return{name:e,template:r}}t.exports={precompile:function(t,e){var n=(e=e||{}).env||new a([]),o=e.wrapper||c;if(e.isString)return u(t,e);var s=r.existsSync(t)&&r.statSync(t),h=[],p=[];if(s.isFile())h.push(f(r.readFileSync(t,"utf-8"),e.name||t,n));else if(s.isDirectory()){!function n(o){r.readdirSync(o).forEach((function(s){var a=i.join(o,s),c=a.substr(i.join(t,"/").length),u=r.statSync(a);u&&u.isDirectory()?l(c+="/",e.exclude)||n(a):l(c,e.include)&&p.push(a)}))}(t);for(var d=0;dt.length||i>0&&s>=r||i<0&&s<=r);s+=i)o.push(n.memberLookup(t,s));return o}function p(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var d={pop:function(t){if(void 0===t)return this.pop();if(t>=this.length||t<0)throw new Error("KeyError");return this.splice(t,1)},append:function(t){return this.push(t)},remove:function(t){for(var e=0;e{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var i={};(()=>{"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}r.r(i),r.d(i,{Component:()=>f,ComponentAttribute:()=>n,ComponentAttributeDefinition:()=>b,ComponentDefinition:()=>p,ComponentDrawOption:()=>_,ComponentLink:()=>x,ComponentLinkDefinition:()=>S,DefaultConfiguration:()=>Hi,DefaultData:()=>Ui,DefaultDrawer:()=>bi,DefaultMetadata:()=>wi,DefaultParser:()=>xi,DefaultPlugin:()=>Qi,DefaultRender:()=>Ti,FileInformation:()=>s,FileInput:()=>N,ParseError:()=>Ii});var e=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{name:null,value:null,type:null,definition:null};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var n=t.name,r=t.value,i=t.type,o=t.definition;this.name=n||null,this.value=null!=r?r:null,this.type=i||null,this.definition=o||null}var n,r;return n=e,r=[{key:"hasError",value:function(){return null===this.definition?null===this.value||("array"===this.type.toLowerCase()?!Array.isArray(this.value):t(this.value)!==this.type.toLowerCase()):null!==this.value&&void 0!==this.value&&(this.__typeOfValueValidation()||this.__ruleValueValidation()||this.__ruleMinAndMaxValidation()||this.__ruleRegexValidation())}},{key:"__typeOfValueValidation",value:function(){var e=this.type.toLowerCase();return"array"===e?"Link"===this.definition.type?!Array.isArray(this.value)||this.value.some((function(t){return"string"!=typeof t})):!Array.isArray(this.value):t(this.value)!==e}},{key:"__ruleValueValidation",value:function(){return this.definition.rules.values&&!this.definition.rules.values.includes(this.value)}},{key:"__ruleMinAndMaxValidation",value:function(){var t="number"==typeof this.value?this.value:this.value.length;return null!==this.definition.rules.min&&tthis.definition.rules.max}},{key:"__ruleRegexValidation",value:function(){return null!==this.definition.rules.regex&&!new RegExp(this.definition.rules.regex).test(this.value)}}],r&&function(e,n){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{path:null};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t);var n=e.path;this.path=n||null}var e,n;return e=t,(n=[{key:"fileName",get:function(){return this.path?this.path.replace(/^.*[\\/]/,""):null}}])&&function(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{id:null,name:null,definition:null,drawOption:null,attributes:[]};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,u),t=s.call(this,e);var n=e.id,r=e.name,i=e.definition,o=e.drawOption,a=e.attributes;return t.__class="Component",t.id=n||null,t.name=r||null,t.definition=i||null,t.drawOption=o||null,t.attributes=a||[],t}return e=u,r=[{key:"setReferenceAttribute",value:function(t){var e=this.definition.definedAttributes.find((function(e){return e.containerRef===t.definition.type}));if(e){var r=this.attributes.filter((function(t){var n=t.definition;return(null==n?void 0:n.name)===e.name}));r.length>0?r.forEach((function(e){e.value=t.id})):this.attributes.push(new n({name:e.name,value:t.id,type:"String",definition:e}))}}},{key:"removeAllReferenceAttributes",value:function(t){this.attributes=t?this.attributes.filter((function(e){var n=e.definition,r=e.value;return!("Reference"===n.type&&n.containerRef===t.definition.type&&r===t.id)})):this.attributes.filter((function(t){return"Reference"!==t.definition.type}))}},{key:"setLinkAttribute",value:function(t){var e=this.definition.definedAttributes.find((function(e){return e.name===t.definition.attributeRef})),r=this.attributes.find((function(t){var n=t.definition;return"Link"===n.type&&e.name===n.name}));r&&!r.value.includes(t.target)?r.value.push(t.target):r||this.attributes.push(new n({name:e.name,definition:e,type:"Array",value:[t.target]}))}},{key:"removeLinkAttribute",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.attributes=this.attributes.filter((function(n){if(e&&n.name!==e)return!0;if(n.definition&&"Link"===n.definition.type){var r=n.value.findIndex((function(e){return e===t}));return r>=0&&n.value.splice(r,1),0!==n.value.length}return!0}))}},{key:"getAttributeByName",value:function(t){return this.__getAttributeByName(this.attributes,t)}},{key:"__getAttributeByName",value:function(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{type:null,icon:null,model:null,displayName:null,description:null,url:null,parentTypes:[],childrenTypes:[],definedAttributes:[],isContainer:!1,displayType:null,preventChildrenMovement:!1,childrenPerLine:null};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t);var n=e.type,r=e.icon,i=e.model,o=e.displayName,s=e.description,a=e.url,c=e.parentTypes,l=e.childrenTypes,u=e.definedAttributes,f=e.isContainer,h=e.displayType,p=e.preventChildrenMovement,d=e.childrenPerLine;this.type=n||null,this.icon=r||null,this.model=i||null,this.displayName=o||null,this.description=s||null,this.url=a||null,this.parentTypes=c||[],this.childrenTypes=l||[],this.definedAttributes=u||[],this.isContainer=void 0!==f&&f,this.displayType=h||null,this.preventChildrenMovement=null!=p&&p,this.childrenPerLine=null!=d?d:null}));const p=h;function d(t){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},d(t)}function m(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function y(t,e,n){return(e=v(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function v(t){var e=function(t,e){if("object"!==d(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==d(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===d(e)?e:String(e)}var g=function(t,e,n){return Object.defineProperty(t,"prototype",{writable:!1}),t}((function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{name:null,type:null,displayName:null,description:null,url:null,linkType:null,linkRef:[],linkColor:"black",linkWidth:2,linkDashStyle:null,containerRef:null,required:!1,definedAttributes:[],rules:{values:null,min:null,max:null,regex:null}};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t);var n=e.name,r=e.type,i=e.displayName,o=e.description,s=e.url,a=e.linkType,c=e.linkRef,l=e.linkColor,u=e.linkWidth,f=e.linkDashStyle,h=e.containerRef,p=e.definedAttributes,d=e.required,v=e.rules;this.name=n||null,this.type=r||null,this.displayName=i||null,this.description=o||null,this.url=s||null,this.linkType=a||null,this.linkRef=c||[],this.linkColor=l||"black",this.linkWidth=u||2,this.linkDashStyle=f||null,this.containerRef=h||null,this.definedAttributes=p||[],this.required=d||!1,this.rules=function(t){for(var e=1;e0&&void 0!==arguments[0]?arguments[0]:{x:null,y:null,width:null,height:null,needsResizing:!1,needsPositioning:!1};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t);var n=e.x,r=e.y,i=e.width,o=e.height,s=e.needsResizing,a=e.needsPositioning;this.x=n||null,this.y=r||null,this.width=i||null,this.height=o||null,this.needsResizing=s||!1,this.needsPositioning=a||!1}));function w(t){return w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},w(t)}function k(t,e){return k=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},k(t,e)}function E(t){return E=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},E(t)}const x=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&k(t,e)}(o,t);var e,n,r,i=(n=o,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=E(n);if(r){var i=E(this).constructor;t=Reflect.construct(e,arguments,i)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===w(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function o(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{source:null,target:null,definition:null};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o),t=i.call(this);var n=e.source,r=e.target,s=e.definition;return t.__class="Link",t.source=n||null,t.target=r||null,t.definition=s||null,t}return e=o,Object.defineProperty(e,"prototype",{writable:!1}),e}(s);var O=function(t,e,n){return Object.defineProperty(t,"prototype",{writable:!1}),t}((function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{attributeRef:null,sourceRef:null,targetRef:null,type:null,color:"black",width:2,dashStyle:null,marker:{width:5,height:5,refX:4,refY:2.5,orient:"auto-start-reverse",path:"M 0 0 L 5 2.5 L 0 5"}};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t);var n=e.attributeRef,r=e.sourceRef,i=e.targetRef,o=e.type,s=e.color,a=e.width,c=e.dashStyle,l=e.marker;this.attributeRef=n||null,this.sourceRef=r||null,this.targetRef=i||null,this.type=o||null,this.color=s||"black",this.width=a||2,this.dashStyle=c||null,this.marker=l||{width:5,height:5,refX:4,refY:2.5,orient:"auto-start-reverse",path:"M 0 0 L 5 2.5 L 0 5"}}));const S=O;function T(t){return T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},T(t)}function A(t,e){return A=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},A(t,e)}function L(t){return L=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},L(t)}const N=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&A(t,e)}(o,t);var e,n,r,i=(n=o,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=L(n);if(r){var i=L(this).constructor;t=Reflect.construct(e,arguments,i)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===T(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function o(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{path:null,name:null,content:null};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o),t=i.call(this,e);var n=e.content;return t.content=n||null,t}return e=o,Object.defineProperty(e,"prototype",{writable:!1}),e}(s);class C extends Map{constructor(t,e=M){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(P(this,t))}has(t){return super.has(P(this,t))}set(t,e){return super.set(I(this,t),e)}delete(t){return super.delete(R(this,t))}}class j extends Set{constructor(t,e=M){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:e}}),null!=t)for(const e of t)this.add(e)}has(t){return super.has(P(this,t))}add(t){return super.add(I(this,t))}delete(t){return super.delete(R(this,t))}}function P({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):n}function I({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):(t.set(r,n),n)}function R({_intern:t,_key:e},n){const r=e(n);return t.has(r)&&(n=t.get(r),t.delete(r)),n}function M(t){return null!==t&&"object"==typeof t?t.valueOf():t}function B(t){return t}function D(){}function F(t){return null==t?D:function(){return this.querySelector(t)}}function K(t){return null==t?[]:Array.isArray(t)?t:Array.from(t)}function $(){return[]}function V(t){return null==t?$:function(){return this.querySelectorAll(t)}}function U(t){return function(){return this.matches(t)}}function q(t){return function(e){return e.matches(t)}}var z=Array.prototype.find;function W(){return this.firstElementChild}var G=Array.prototype.filter;function Y(){return Array.from(this.children)}function H(t){return new Array(t.length)}function J(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function X(t,e,n,r,i,o){for(var s,a=0,c=e.length,l=o.length;ae?1:t>=e?0:NaN}J.prototype={constructor:J,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 nt="http://www.w3.org/1999/xhtml";const rt={svg:"http://www.w3.org/2000/svg",xhtml:nt,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function it(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),rt.hasOwnProperty(e)?{space:rt[e],local:t}:t}function ot(t){return function(){this.removeAttribute(t)}}function st(t){return function(){this.removeAttributeNS(t.space,t.local)}}function at(t,e){return function(){this.setAttribute(t,e)}}function ct(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function lt(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function ut(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 ft(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function ht(t){return function(){this.style.removeProperty(t)}}function pt(t,e,n){return function(){this.style.setProperty(t,e,n)}}function dt(t,e,n){return function(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function mt(t,e){return t.style.getPropertyValue(e)||ft(t).getComputedStyle(t,null).getPropertyValue(e)}function yt(t){return function(){delete this[t]}}function vt(t,e){return function(){this[t]=e}}function gt(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function bt(t){return t.trim().split(/^|\s+/)}function _t(t){return t.classList||new wt(t)}function wt(t){this._node=t,this._names=bt(t.getAttribute("class")||"")}function kt(t,e){for(var n=_t(t),r=-1,i=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 Gt=[null];function Yt(t,e){this._groups=t,this._parents=e}function Ht(){return new Yt([[document.documentElement]],Gt)}Yt.prototype=Ht.prototype={constructor:Yt,select:function(t){"function"!=typeof t&&(t=F(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i=w&&(w=_+1);!(b=v[w])&&++w=0;)(r=i[o])&&(s&&4^r.compareDocumentPosition(s)&&s.parentNode.insertBefore(r,s),s=r);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=et);for(var n=this._groups,r=n.length,i=new Array(r),o=0;o1?this.each((null==e?ht:"function"==typeof e?dt:pt)(t,e,null==n?"":n)):mt(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?yt:"function"==typeof e?gt:vt)(t,e)):this.node()[t]},classed:function(t,e){var n=bt(t+"");if(arguments.length<2){for(var r=_t(this.node()),i=-1,o=n.length;++i=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}}))}(t+""),s=o.length;if(!(arguments.length<2)){for(a=e?Ut:Vt,r=0;r{}};function Qt(){for(var t,e=0,n=arguments.length,r={};e=0&&(e=t.slice(n+1),t=t.slice(0,n)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))),s=-1,a=o.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++s0)for(var n,r,i=new Array(n),o=0;o=0&&e._call.call(void 0,t),e=e._next;--oe}()}finally{oe=0,function(){for(var t,e,n=re,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:re=e);ie=t,_e(r)}(),ue=0}}function be(){var t=he.now(),e=t-le;e>ce&&(fe-=e,le=t)}function _e(t){oe||(se&&(se=clearTimeout(se)),t-ue>24?(t<1/0&&(se=setTimeout(ge,t-he.now()-fe)),ae&&(ae=clearInterval(ae))):(ae||(le=he.now(),ae=setInterval(be,ce)),oe=1,pe(ge)))}function we(t,e,n){var r=new ye;return e=null==e?0:+e,r.restart((n=>{r.stop(),t(n+e)}),e,n),r}ye.prototype=ve.prototype={constructor:ye,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?de():+n)+(null==e?0:+e),this._next||ie===this||(ie?ie._next=this:re=this,ie=this),this._call=t,this._time=n,_e()},stop:function(){this._call&&(this._call=null,this._time=1/0,_e())}};var ke=ne("start","end","cancel","interrupt"),Ee=[],xe=0,Oe=3;function Se(t,e,n,r,i,o){var s=t.__transition;if(s){if(n in s)return}else t.__transition={};!function(t,e,n){var r,i=t.__transition;function o(c){var l,u,f,h;if(1!==n.state)return a();for(l in i)if((h=i[l]).name===n.name){if(h.state===Oe)return we(o);4===h.state?(h.state=6,h.timer.stop(),h.on.call("interrupt",t,t.__data__,h.index,h.group),delete i[l]):+lxe)throw new Error("too late; already scheduled");return n}function Ae(t,e){var n=Le(t,e);if(n.state>Oe)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 Ne(t,e){var n,r,i,o=t.__transition,s=!0;if(o){for(i in e=null==e?null:e+"",o)(n=o[i]).name===e?(r=n.state>2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(r?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete o[i]):s=!1;s&&delete t.__transition}}function Ce(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}var je,Pe=180/Math.PI,Ie={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Re(t,e,n,r,i,o){var s,a,c;return(s=Math.sqrt(t*t+e*e))&&(t/=s,e/=s),(c=t*n+e*r)&&(n-=t*c,r-=e*c),(a=Math.sqrt(n*n+r*r))&&(n/=a,r/=a,c/=a),t*r180?e+=360:e-t>180&&(t+=360),o.push({i:n.push(i(n)+"rotate(",null,r)-2,x:Ce(t,e)})):e&&n.push(i(n)+"rotate("+e+r)}(o.rotate,s.rotate,a,c),function(t,e,n,o){t!==e?o.push({i:n.push(i(n)+"skewX(",null,r)-2,x:Ce(t,e)}):e&&n.push(i(n)+"skewX("+e+r)}(o.skewX,s.skewX,a,c),function(t,e,n,r,o,s){if(t!==n||e!==r){var a=o.push(i(o)+"scale(",null,",",null,")");s.push({i:a-4,x:Ce(t,n)},{i:a-2,x:Ce(e,r)})}else 1===n&&1===r||o.push(i(o)+"scale("+n+","+r+")")}(o.scaleX,o.scaleY,s.scaleX,s.scaleY,a,c),o=s=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?ln(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?ln(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=Xe.exec(t))?new fn(e[1],e[2],e[3],1):(e=Qe.exec(t))?new fn(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=Ze.exec(t))?ln(e[1],e[2],e[3],e[4]):(e=tn.exec(t))?ln(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=en.exec(t))?vn(e[1],e[2]/100,e[3]/100,1):(e=nn.exec(t))?vn(e[1],e[2]/100,e[3]/100,e[4]):rn.hasOwnProperty(t)?cn(rn[t]):"transparent"===t?new fn(NaN,NaN,NaN,0):null}function cn(t){return new fn(t>>16&255,t>>8&255,255&t,1)}function ln(t,e,n,r){return r<=0&&(t=e=n=NaN),new fn(t,e,n,r)}function un(t,e,n,r){return 1===arguments.length?((i=t)instanceof qe||(i=an(i)),i?new fn((i=i.rgb()).r,i.g,i.b,i.opacity):new fn):new fn(t,e,n,null==r?1:r);var i}function fn(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function hn(){return`#${yn(this.r)}${yn(this.g)}${yn(this.b)}`}function pn(){const t=dn(this.opacity);return`${1===t?"rgb(":"rgba("}${mn(this.r)}, ${mn(this.g)}, ${mn(this.b)}${1===t?")":`, ${t})`}`}function dn(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function mn(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function yn(t){return((t=mn(t))<16?"0":"")+t.toString(16)}function vn(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new bn(t,e,n,r)}function gn(t){if(t instanceof bn)return new bn(t.h,t.s,t.l,t.opacity);if(t instanceof qe||(t=an(t)),!t)return new bn;if(t instanceof bn)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),s=NaN,a=o-i,c=(o+i)/2;return a?(s=e===o?(n-r)/a+6*(n0&&c<1?0:s,new bn(s,a,c,t.opacity)}function bn(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function _n(t){return(t=(t||0)%360)<0?t+360:t}function wn(t){return Math.max(0,Math.min(1,t||0))}function kn(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 En(t,e,n,r,i){var o=t*t,s=o*t;return((1-3*t+3*o-s)*e+(4-6*o+3*s)*n+(1+3*t+3*o-3*s)*r+s*i)/6}Ve(qe,an,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:on,formatHex:on,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return gn(this).formatHsl()},formatRgb:sn,toString:sn}),Ve(fn,un,Ue(qe,{brighter(t){return t=null==t?We:Math.pow(We,t),new fn(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?ze:Math.pow(ze,t),new fn(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new fn(mn(this.r),mn(this.g),mn(this.b),dn(this.opacity))},displayable(){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:hn,formatHex:hn,formatHex8:function(){return`#${yn(this.r)}${yn(this.g)}${yn(this.b)}${yn(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:pn,toString:pn})),Ve(bn,(function(t,e,n,r){return 1===arguments.length?gn(t):new bn(t,e,n,null==r?1:r)}),Ue(qe,{brighter(t){return t=null==t?We:Math.pow(We,t),new bn(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?ze:Math.pow(ze,t),new bn(this.h,this.s,this.l*t,this.opacity)},rgb(){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 fn(kn(t>=240?t-240:t+120,i,r),kn(t,i,r),kn(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new bn(_n(this.h),wn(this.s),wn(this.l),dn(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=dn(this.opacity);return`${1===t?"hsl(":"hsla("}${_n(this.h)}, ${100*wn(this.s)}%, ${100*wn(this.l)}%${1===t?")":`, ${t})`}`}}));const xn=t=>()=>t;function On(t,e){var n=e-t;return n?function(t,e){return function(n){return t+n*e}}(t,n):xn(isNaN(t)?e:t)}const Sn=function t(e){var n=function(t){return 1==(t=+t)?On: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):xn(isNaN(e)?n:e)}}(e);function r(t,e){var r=n((t=un(t)).r,(e=un(e)).r),i=n(t.g,e.g),o=n(t.b,e.b),s=On(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=i(e),t.b=o(e),t.opacity=s(e),t+""}}return r.gamma=t,r}(1);function Tn(t){return function(e){var n,r,i=e.length,o=new Array(i),s=new Array(i),a=new Array(i);for(n=0;n=1?(n=1,e-1):Math.floor(n*e),i=t[r],o=t[r+1],s=r>0?t[r-1]:2*i-o,a=ro&&(i=e.slice(o,i),a[s]?a[s]+=i:a[++s]=i),(n=n[0])===(r=r[0])?a[s]?a[s]+=r:a[++s]=r:(a[++s]=null,c.push({i:s,x:Ce(n,r)})),o=Ln.lastIndex;return o=0&&(t=t.slice(0,e)),!t||"start"===t}))}(e)?Te:Ae;return function(){var s=o(this,t),a=s.on;a!==r&&(i=(r=a).copy()).on(e,n),s.on=i}}(n,t,e))},attr:function(t,e){var n=it(t),r="transform"===n?De:Cn;return this.attrTween(t,"function"==typeof e?(n.local?Bn:Mn)(n,r,$e(this,"attr."+t,e)):null==e?(n.local?Pn:jn)(n):(n.local?Rn:In)(n,r,e))},attrTween:function(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==e)return this.tween(n,null);if("function"!=typeof e)throw new Error;var r=it(t);return this.tween(n,(r.local?Dn:Fn)(r,e))},style:function(t,e,n){var r="transform"==(t+="")?Be:Cn;return null==e?this.styleTween(t,function(t,e){var n,r,i;return function(){var o=mt(this,t),s=(this.style.removeProperty(t),mt(this,t));return o===s?null:o===n&&s===r?i:i=e(n=o,r=s)}}(t,r)).on("end.style."+t,zn(t)):"function"==typeof e?this.styleTween(t,function(t,e,n){var r,i,o;return function(){var s=mt(this,t),a=n(this),c=a+"";return null==a&&(this.style.removeProperty(t),c=a=mt(this,t)),s===c?null:s===r&&c===i?o:(i=c,o=e(r=s,a))}}(t,r,$e(this,"style."+t,e))).each(function(t,e){var n,r,i,o,s="style."+e,a="end."+s;return function(){var c=Ae(this,t),l=c.on,u=null==c.value[s]?o||(o=zn(e)):void 0;l===n&&i===u||(r=(n=l).copy()).on(a,i=u),c.on=r}}(this._id,t)):this.styleTween(t,function(t,e,n){var r,i,o=n+"";return function(){var s=mt(this,t);return s===o?null:s===r?i:i=e(r=s,n)}}(t,r,e),n).on("end.style."+t,null)},styleTween:function(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==e)return this.tween(r,null);if("function"!=typeof e)throw new Error;return this.tween(r,function(t,e,n){var r,i;function o(){var o=e.apply(this,arguments);return o!==i&&(r=(i=o)&&function(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}(t,o,n)),r}return o._value=e,o}(t,e,null==n?"":n))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var e=t(this);this.textContent=null==e?"":e}}($e(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},textTween:function(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(null==t)return this.tween(e,null);if("function"!=typeof t)throw new Error;return this.tween(e,function(t){var e,n;function r(){var r=t.apply(this,arguments);return r!==n&&(e=(n=r)&&function(t){return function(e){this.textContent=t.call(this,e)}}(r)),e}return r._value=t,r}(t))},remove:function(){return this.on("end.remove",function(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}(this._id))},tween:function(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r,i=Le(this.node(),n).tween,o=0,s=i.length;o()=>t;function fr(t,{sourceEvent:e,subject:n,target:r,identifier:i,active:o,x:s,y:a,dx:c,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}function hr(t){return!t.ctrlKey&&!t.button}function pr(){return this.parentNode}function dr(t,e){return null==e?{x:t.x,y:t.y}:e}function mr(){return navigator.maxTouchPoints||"ontouchstart"in this}function yr(t){var e=0,n=t.children,r=n&&n.length;if(r)for(;--r>=0;)e+=n[r].value;else e=1;t.value=e}function vr(t,e){t instanceof Map?(t=[void 0,t],void 0===e&&(e=br)):void 0===e&&(e=gr);for(var n,r,i,o,s,a=new kr(t),c=[a];n=c.pop();)if((i=e(n.data))&&(s=(i=Array.from(i)).length))for(n.children=i,o=s-1;o>=0;--o)c.push(r=i[o]=new kr(i[o])),r.parent=n,r.depth=n.depth+1;return a.eachBefore(wr)}function gr(t){return t.children}function br(t){return Array.isArray(t)?t[1]:null}function _r(t){void 0!==t.data.value&&(t.value=t.data.value),t.data=t.data.data}function wr(t){var e=0;do{t.height=e}while((t=t.parent)&&t.height<++e)}function kr(t){this.data=t,this.depth=this.height=0,this.parent=null}function Er(t){t.x0=Math.round(t.x0),t.y0=Math.round(t.y0),t.x1=Math.round(t.x1),t.y1=Math.round(t.y1)}function xr(t,e,n,r,i){for(var o,s=t.children,a=-1,c=s.length,l=t.value&&(r-e)/t.value;++a=0;--r)o.push(n[r]);return this},find:function(t,e){let n=-1;for(const r of this)if(t.call(e,r,++n,this))return r},sum:function(t){return this.eachAfter((function(e){for(var n=+t(e.data)||0,r=e.children,i=r&&r.length;--i>=0;)n+=r[i].value;e.value=n}))},sort:function(t){return this.eachBefore((function(e){e.children&&e.children.sort(t)}))},path:function(t){for(var e=this,n=function(t,e){if(t===e)return t;var n=t.ancestors(),r=e.ancestors(),i=null;for(t=n.pop(),e=r.pop();t===e;)i=t,t=n.pop(),e=r.pop();return i}(e,t),r=[e];e!==n;)e=e.parent,r.push(e);for(var i=r.length;t!==n;)r.splice(i,0,t),t=t.parent;return r},ancestors:function(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e},descendants:function(){return Array.from(this)},leaves:function(){var t=[];return this.eachBefore((function(e){e.children||t.push(e)})),t},links:function(){var t=this,e=[];return t.each((function(n){n!==t&&e.push({source:n.parent,target:n})})),e},copy:function(){return vr(this).eachBefore(_r)},[Symbol.iterator]:function*(){var t,e,n,r,i=this,o=[i];do{for(t=o.reverse(),o=[];i=t.pop();)if(yield i,e=i.children)for(n=0,r=e.length;nh&&(h=a),y=u*u*m,(p=Math.max(h/y,y/f))>d){u-=a;break}d=p}v.push(s={value:u,dice:c1?e:1)},n}((1+Math.sqrt(5))/2);function Tr(){return 0}function Ar(t){return function(){return t}}function Lr(t){return"string"==typeof t?new Yt([document.querySelectorAll(t)],[document.documentElement]):new Yt([K(t)],Gt)}var Nr=Array.prototype.slice;function Cr(t){return function(){return t}}const jr=Math.PI,Pr=2*jr,Ir=1e-6,Rr=Pr-Ir;function Mr(t){this._+=t[0];for(let e=1,n=t.length;e=0))throw new Error(`invalid digits: ${t}`);if(e>15)return Mr;const n=10**e;return function(t){this._+=t[0];for(let e=1,r=t.length;eIr)if(Math.abs(u*a-c*l)>Ir&&i){let h=n-o,p=r-s,d=a*a+c*c,m=h*h+p*p,y=Math.sqrt(d),v=Math.sqrt(f),g=i*Math.tan((jr-Math.acos((d+f-m)/(2*y*v)))/2),b=g/v,_=g/y;Math.abs(b-1)>Ir&&this._append`L${t+b*l},${e+b*u}`,this._append`A${i},${i},0,0,${+(u*h>l*p)},${this._x1=t+_*a},${this._y1=e+_*c}`}else this._append`L${this._x1=t},${this._y1=e}`}arc(t,e,n,r,i,o){if(t=+t,e=+e,o=!!o,(n=+n)<0)throw new Error(`negative radius: ${n}`);let s=n*Math.cos(r),a=n*Math.sin(r),c=t+s,l=e+a,u=1^o,f=o?r-i:i-r;null===this._x1?this._append`M${c},${l}`:(Math.abs(this._x1-c)>Ir||Math.abs(this._y1-l)>Ir)&&this._append`L${c},${l}`,n&&(f<0&&(f=f%Pr+Pr),f>Rr?this._append`A${n},${n},0,1,${u},${t-s},${e-a}A${n},${n},0,1,${u},${this._x1=c},${this._y1=l}`:f>Ir&&this._append`A${n},${n},0,${+(f>=jr)},${u},${this._x1=t+n*Math.cos(i)},${this._y1=e+n*Math.sin(i)}`)}rect(t,e,n,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}}function Dr(t){return t[0]}function Fr(t){return t[1]}function Kr(t){return t.source}function $r(t){return t.target}class Vr{constructor(t,e){this._context=t,this._x=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line}point(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:this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,e,t,e):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+e)/2,t,this._y0,t,e)}this._x0=t,this._y0=e}}function Ur(t){return new Vr(t,!0)}function qr(t){return new Vr(t,!1)}function zr(t){return((t=Math.exp(t))+1/t)/2}const Wr=function t(e,n,r){function i(t,i){var o,s,a=t[0],c=t[1],l=t[2],u=i[0],f=i[1],h=i[2],p=u-a,d=f-c,m=p*p+d*d;if(m<1e-12)s=Math.log(h/l)/e,o=function(t){return[a+t*p,c+t*d,l*Math.exp(e*t*s)]};else{var y=Math.sqrt(m),v=(h*h-l*l+r*m)/(2*l*n*y),g=(h*h-l*l-r*m)/(2*h*n*y),b=Math.log(Math.sqrt(v*v+1)-v),_=Math.log(Math.sqrt(g*g+1)-g);s=(_-b)/e,o=function(t){var r,i=t*s,o=zr(b),u=l/(n*y)*(o*(r=e*i+b,((r=Math.exp(2*r))-1)/(r+1))-function(t){return((t=Math.exp(t))-1/t)/2}(b));return[a+u*p,c+u*d,l*o/zr(e*i+b)]}}return o.duration=1e3*s*e/Math.SQRT2,o}return i.rho=function(e){var n=Math.max(.001,+e),r=n*n;return t(n,r,r*r)},i}(Math.SQRT2,2,4),Gr=t=>()=>t;function Yr(t,{sourceEvent:e,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function Hr(t,e,n){this.k=t,this.x=e,this.y=n}Hr.prototype={constructor:Hr,scale:function(t){return 1===t?this:new Hr(this.k*t,this.x,this.y)},translate:function(t,e){return 0===t&0===e?this:new Hr(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Jr=new Hr(1,0,0);function Xr(t){for(;!t.__zoom;)if(!(t=t.parentNode))return Jr;return t.__zoom}function Qr(t){t.stopImmediatePropagation()}function Zr(t){t.preventDefault(),t.stopImmediatePropagation()}function ti(t){return!(t.ctrlKey&&"wheel"!==t.type||t.button)}function ei(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t).hasAttribute("viewBox")?[[(t=t.viewBox.baseVal).x,t.y],[t.x+t.width,t.y+t.height]]:[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]:[[0,0],[t.clientWidth,t.clientHeight]]}function ni(){return this.__zoom||Jr}function ri(t){return-t.deltaY*(1===t.deltaMode?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function ii(){return navigator.maxTouchPoints||"ontouchstart"in this}function oi(t,e,n){var r=t.invertX(e[0][0])-n[0][0],i=t.invertX(e[1][0])-n[1][0],o=t.invertY(e[0][1])-n[0][1],s=t.invertY(e[1][1])-n[1][1];return t.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),s>o?(o+s)/2:Math.min(0,o)||Math.max(0,s))}Xr.prototype=Hr.prototype;var si=r(985),ai=r.n(si);const ci='';function li(t){return li="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},li(t)}function ui(t){return function(t){if(Array.isArray(t))return yi(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||mi(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function fi(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function hi(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=new Array(e);n1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"root",i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.pluginData=e,this.rootId=r,this.resources=n,this.minWidth=void 0!==i.minWidth?i.minWidth:230,this.minHeight=void 0!==i.minHeight?i.minHeight:50,this.padding=void 0!==i.padding?i.padding:30,this.margin=void 0!==i.margin?i.margin:6,this.lineLengthPerDepth=void 0!==i.lineLengthPerDepth?i.lineLengthPerDepth:[5,1],this.actionMenuButtonSize=i.actionMenuButtonSize||24,this.actions={selection:{current:null,style:"2px solid hsl(205, 100%, 50%)",offset:"3px"},linkCreation:{source:null,target:null,creating:!1},drag:{offsetX:0,offsetY:0,state:!1,target:null},zoom:{scale:1,translate:{x:0,y:0}}}}var e,n;return e=t,n=[{key:"screenToSVG",value:function(t,e){var n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:null)||this.svg.node();return new DOMPoint(t,e).matrixTransform(n.getScreenCTM().inverse())}},{key:"SVGToScreen",value:function(t,e){var n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:null)||this.svg.node();return new DOMPoint(t,e).matrixTransform(n.getScreenCTM())}},{key:"__getVerticalCoefficient",value:function(t){var e,n,r,i,o,s,a=this,c=this.getLineLengthForDepth(t.depth,null===(e=t.parent)||void 0===e||null===(n=e.data)||void 0===n||null===(r=n.definition)||void 0===r?void 0:r.childrenPerLine);if((null===(i=t.children)||void 0===i?void 0:i.length)>0){var l,u,f=Math.ceil(t.children.filter((function(t){var e,n;return null==t||null===(e=t.data)||void 0===e||null===(n=e.definition)||void 0===n?void 0:n.isContainer})).reduce((function(t,e){return t+a.__getVerticalCoefficient(e)}),0));return t.children.filter((function(t){var e,n;return!(null!==(e=t.data)&&void 0!==e&&null!==(n=e.definition)&&void 0!==n&&n.isContainer)})).reduce((function(t,e){return t+e.value}),0)/c+f+(null!==(l=t.data)&&void 0!==l&&null!==(u=l.definition)&&void 0!==u&&u.isContainer?1:0)}return(c===1/0?1:t.value/c)+(null!==(o=t.data)&&void 0!==o&&null!==(s=o.definition)&&void 0!==s&&s.isContainer?1:0)}},{key:"getLineLengthForDepth",value:function(t){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:null)||this.lineLengthPerDepth[Math.min(t,this.lineLengthPerDepth.length-1)]}},{key:"setDisabledStyle",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:".component";Lr("#".concat(this.rootId," ").concat(t||".component")).classed("disabled",!0)}},{key:"unsetAllDisabledStyles",value:function(){Lr("#".concat(this.rootId," .disabled")).classed("disabled",!1)}},{key:"dragHandler",value:function(t,e){this.hideActionMenu();var n=document.elementsFromPoint(e.sourceEvent.x,e.sourceEvent.y).find((function(t){return e.subject.data.id!==t.dataset.parentId&&(t.classList.contains("container-background")||t.classList.contains("container"))})),r=nr("#".concat(e.subject.data.id)).attr("cursor","grabbing");nr("#root-components").append((function(){return r.node()}));var i=this.screenToSVG(e.sourceEvent.clientX,e.sourceEvent.clientY,this.svg.select(".container").node());if(nr(t).attr("transform",e.subject.transform="translate(".concat(i.x-this.actions.drag.offsetX,",\n ").concat(i.y-this.actions.drag.offsetY,")")),e.subject.x=i.x-this.actions.drag.offsetX,e.subject.y=i.y-this.actions.drag.offsetY,e.subject.data.definition){var o=e.subject.data.definition.parentTypes.map((function(t){return":not(.".concat(t,")")})).join("");this.setDisabledStyle(".component:not(#".concat(e.subject.data.id,")").concat(o))}return this.drawLinks(),n}},{key:"setupDragBehavior",value:function(){var t=this,e=null,n=!1,r=this.dragHandler.bind(this);return function(){var t,e,n,r,i=hr,o=pr,s=dr,a=mr,c={},l=ne("start","drag","end"),u=0,f=0;function h(t){t.on("mousedown.drag",p).filter(a).on("touchstart.drag",y).on("touchmove.drag",v,ir).on("touchend.drag touchcancel.drag",g).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(s,a){if(!r&&i.call(this,s,a)){var c=b(this,o.call(this,s,a),s,a,"mouse");c&&(nr(s.view).on("mousemove.drag",d,or).on("mouseup.drag",m,or),cr(s.view),sr(s),n=!1,t=s.clientX,e=s.clientY,c("start",s))}}function d(r){if(ar(r),!n){var i=r.clientX-t,o=r.clientY-e;n=i*i+o*o>f}c.mouse("drag",r)}function m(t){nr(t.view).on("mousemove.drag mouseup.drag",null),lr(t.view,n),ar(t),c.mouse("end",t)}function y(t,e){if(i.call(this,t,e)){var n,r,s=t.changedTouches,a=o.call(this,t,e),c=s.length;for(n=0;n0){var u;this.pluginData.insertComponentBefore(e.subject.data.id,null===(u=o.children[0].data)||void 0===u?void 0:u.id)}}this.pluginData.emitEvent({type:"Drawer",action:s?"update":"move",status:"success",components:[e.subject.data.id]})}},{key:"findInsertionPosition",value:function(t,e){var n=t.x0-e.subject.parent.x0,r=t.y0-e.subject.parent.y0,i=e.x-n,o=e.y-r;if(!t.children)return null;var s=t.children.filter((function(t){var n,r,i;return(null===(n=t.data)||void 0===n?void 0:n.id)!==(null===(r=e.subject)||void 0===r||null===(i=r.data)||void 0===i?void 0:i.id)})).filter((function(t){return t.y0<=o&&t.y1>=o}));if(s.length>0){var a=s.reduce((function(t,e){var n=i-e.x1;return n>0&&n0&&n<=t.distance&&(t={distance:n,component:e}),t}),{distance:1/0,component:null}).component}},{key:"__fillMissingBracket",value:function(t,e,n){var r;if((null===(r=t.children)||void 0===r?void 0:r.length)>1&&!e.componentLeft&&e.componentRight){var i=t.children.findIndex((function(t){var e,r;return(null===(e=t.data)||void 0===e?void 0:e.id)===(null==n||null===(r=n.data)||void 0===r?void 0:r.id)})),o=t.children.findIndex((function(t){var n,r;return(null===(n=t.data)||void 0===n?void 0:n.id)===(null===(r=e.componentRight.data)||void 0===r?void 0:r.id)})),s=i===o-1?o-2:o-1;s>=0&&(e.componentLeft=t.children[s])}}},{key:"__isInverted",value:function(t,e,n){var r=t.children.findIndex((function(t){var n;return t.data.id===(null==e||null===(n=e.data)||void 0===n?void 0:n.id)})),i=t.children.findIndex((function(t){var e;return t.data.id===(null==n||null===(e=n.data)||void 0===e?void 0:e.id)}));return!!(-1===r&&i===t.children.length-1||r>=0&&i>=0&&r>i)}},{key:"createRenderingContext",value:function(){nr("#".concat(this.rootId,">svg")).empty()?(this.svg=nr("#".concat(this.rootId)).append("svg").attr("preserveAspectRatio","xMinYMin meet").style("font","10px sans-serif").attr("height","100%").attr("width","100%"),this.svg.append("g").attr("class","container"),this.svg.append("defs"),this.__initializeArrowMarker()):this.svg=nr("#".concat(this.rootId)).select("svg")}},{key:"draw",value:function(t){var e=this.pluginData.emitEvent({type:"Drawer",action:"write",status:"running",data:{rootId:t}});this.rootId=t,this.createRenderingContext(),this.__unselectComponent(),this.drawComponents(),this.drawLinks(),this.setViewPortAction(),this.pluginData.emitEvent({id:e,status:"success"})}},{key:"clickHandler",value:function(t){t.stopPropagation(),this.__selectComponent(nr(t.currentTarget))}},{key:"drawComponents",value:function(){var t=this;this.shadowRoot={children:this.pluginData.components,id:"__shadowRoot",name:""};var e=this.buildTree(),n=this.clickHandler.bind(this),r=this.setupDragBehavior(),i=this.svg.select(".container").selectAll("g").data(e,(function(t){return t})).join("g").attr("id",(function(t){return di(t,1)[0]})).selectAll("g").data((function(t){return di(t,2)[1]})).join("g").attr("id",(function(t){return t.data.id})).on("click",n).call(r).attr("x",(function(t){return t.x0})).attr("y",(function(t){return t.y0})).attr("transform",(function(t){var e=t.x0,n=t.y0;return"translate(".concat(e,",").concat(n,")")}));i.filter((function(t){return"__shadowRoot"!==t.data.id})).attr("class",(function(t){var e=t.data;return"component\n component-".concat(e.definition.model,"\n ").concat(e.definition.type)})).html((function(e){var n=e.data;return ai().renderString(t.resources.models[n.definition.model],hi(hi({},n),{},{hasError:n.hasError(),getAttribute:function(t){return n.attributes.find((function(e){return e.name===t}))}}))})).select("svg").attr("id",(function(t){var e=t.data;return"svg-".concat(e.id)})).attr("height",(function(e){return t.getComponentHeight(e)})).attr("width",(function(e){return t.getComponentWidth(e)})),i.select(".component-icon").html((function(e){var n=e.data;return t.resources.icons[n.definition.icon]})),i.select("rect").filter((function(t){var e,n;return null===(e=t.data)||void 0===e||null===(n=e.definition)||void 0===n?void 0:n.isContainer})).attr("height",(function(e){return t.getComponentHeight(e)})).attr("width",(function(e){return t.getComponentWidth(e)})),i.select(".component-container").attr("height",(function(e){return t.getComponentHeight(e)-t.minHeight-t.margin})).attr("width",(function(e){return t.getComponentWidth(e)-2*t.margin})).attr("x",(function(){return t.margin})).filter((function(t){return t.children})).append((function(t){var e=t.data;return nr("#group-".concat(e.id)).node()})),i.select(".component-container>rect").attr("data-parentId",(function(t){return t.data.id}))}},{key:"initializeComponentDrawOptions",value:function(t){var e,n,r,i,o=Math.min(t.value,this.getLineLengthForDepth(t.depth,null===(e=t.data.definition)||void 0===e?void 0:e.childrenPerLine)),s=Math.ceil(this.__getVerticalCoefficient(t)),a=o*(this.minWidth+2*this.margin)+2*t.height*this.padding+(o-1)*(this.padding+2*this.margin),c=s*this.minHeight+t.height*this.padding+(s-1)*(this.padding+this.margin);!t.data.drawOption||null!==(n=t.parent)&&void 0!==n&&null!==(r=n.data)&&void 0!==r&&null!==(i=r.definition)&&void 0!==i&&i.preventChildrenMovement?t.data.drawOption=new _({needsPositioning:!0,width:a,height:c}):(t.data.drawOption.width=a,t.data.drawOption.height=c)}},{key:"buildTree",value:function(){var t=this,e=function(){var t=Sr,e=!1,n=1,r=1,i=[0],o=Tr,s=Tr,a=Tr,c=Tr,l=Tr;function u(t){return t.x0=t.y0=0,t.x1=n,t.y1=r,t.eachBefore(f),i=[0],e&&t.eachBefore(Er),t}function f(e){var n=i[e.depth],r=e.x0+n,u=e.y0+n,f=e.x1-n,h=e.y1-n;f=r.length)return n(i);const s=new C,a=r[o++];let c=-1;for(const t of i){const e=a(t,++c,i),n=s.get(e);n?n.push(t):s.set(e,[t])}for(const[e,n]of s)s.set(e,t(n,o));return e(s)}(t,0)}(t,Array.from,B,e)}(n,(function(t){var e=t.parent;return e&&"__shadowRoot"!==e.data.id?"group-".concat(e.data.id):"root-components"})).filter((function(t){return"root-__shadowRoot"!==di(t,1)[0]}))}},{key:"getAnchorPoint",value:function(t,e){if(t.empty()||e.empty())return null;var n,r=t.node().getBoundingClientRect(),i=this.getSelectionCenter(t),o=this.getSelectionCenter(e),s=this.getBearing(this.screenToSVG(i.x,i.y,this.svg.select(".container").node()),this.screenToSVG(o.x,o.y,this.svg.select(".container").node())),a={y:r.top,x:r.x+r.width/2},c={y:r.bottom,x:r.x+r.width/2},l={x:r.left,y:r.top+r.height/2},u={x:r.right,y:r.top+r.height/2};n=s<45||s>=315?c:s>=45&&s<135?u:s>=135&&s<225?a:l;var f=this.screenToSVG(n.x,n.y);return[f.x,f.y]}},{key:"__initializeArrowMarker",value:function(){var t=this.pluginData.getUsedLinkDefinitions();this.svg.select("defs").selectAll("arrow").data(t,(function(t){return"".concat(t.attributeRef,"-").concat(t.sourceRef,"-").concat(t.targetRef)})).join("marker").attr("class","arrow").attr("id",(function(t){return"".concat(t.attributeRef,"-").concat(t.sourceRef,"-").concat(t.targetRef,"-arrow")})).attr("refX",(function(t){return t.marker.refX})).attr("refY",(function(t){return t.marker.refY})).attr("markerWidth",(function(t){return t.marker.width})).attr("markerHeight",(function(t){return t.marker.height})).attr("orient",(function(t){return t.marker.orient})).append("path").attr("d",(function(t){return t.marker.path})).attr("fill",(function(t){return t.color}))}},{key:"drawLinks",value:function(){var t=this,e=this.pluginData.getLinks();if(e){var n=this.svg.selectAll(".link");n.data(e,(function(t){return t})).join("path").filter((function(t){var e=t.source,n=t.target;return!nr("#".concat(e)).empty()&&!nr("#".concat(n)).empty()})).classed("link",!0).attr("d",(function(e){return t.getLinkGenerator(e)(e)})).attr("id",(function(t){var e=t.definition,n=t.source,r=t.target;return"link-".concat(e.sourceRef,"-").concat(e.attributeRef,"-").concat(n,"-").concat(r)})).attr("fill","none").attr("stroke",(function(t){return t.definition.color})).attr("stroke-width",(function(e){return e.definition.width*t.actions.zoom.scale})).attr("stroke-dasharray",(function(e){return e.definition.dashStyle?e.definition.dashStyle.map((function(e){return e*t.actions.zoom.scale})):"none"})).attr("marker-start",(function(t){var e=t.definition,n=e.attributeRef,r=e.sourceRef,i=e.targetRef;return"Reverse"===t.definition.type?"url(#".concat(n,"-").concat(r,"-").concat(i,"-arrow)"):"none"})).attr("marker-end",(function(t){var e=t.definition,n=e.attributeRef,r=e.sourceRef,i=e.targetRef;return"Reverse"!==t.definition.type?"url(#".concat(n,"-").concat(r,"-").concat(i,"-arrow)"):"none"})).attr("cursor","pointer").on("click",(function(e){return t.clickHandler(e)})),n.raise()}}},{key:"getSelectionCenter",value:function(t){var e=t.node().getBoundingClientRect();return{x:e.left+e.width/2,y:e.top+e.height/2}}},{key:"getBearing",value:function(t,e){var n=e.x-t.x,r=e.y-t.y,i=n/Math.sqrt(Math.pow(n,2)+Math.pow(r,2)),o=r/Math.sqrt(Math.pow(n,2)+Math.pow(r,2));return(Math.atan2(i,o)*(180/Math.PI)+360)%360}},{key:"getLinkGenerator",value:function(t){var e=nr("#".concat(t.source)),n=nr("#".concat(t.target)),r=this.getAnchorPoint(e,n),i=this.getAnchorPoint(n,e),o=this.getSelectionCenter(e),s=this.getSelectionCenter(n),a=this.getBearing(this.screenToSVG(o.x,o.y,this.svg.select(".container").node()),this.screenToSVG(s.x,s.y,this.svg.select(".container").node()));return function(t){let e=Kr,n=$r,r=Dr,i=Fr,o=null,s=null,a=function(t){let e=3;return t.digits=function(n){if(!arguments.length)return e;if(null==n)e=null;else{const t=Math.floor(n);if(!(t>=0))throw new RangeError(`invalid digits: ${n}`);e=t}return t},()=>new Br(e)}(c);function c(){let c;const l=Nr.call(arguments),u=e.apply(this,l),f=n.apply(this,l);if(null==o&&(s=t(c=a())),s.lineStart(),l[0]=u,s.point(+r.apply(this,l),+i.apply(this,l)),l[0]=f,s.point(+r.apply(this,l),+i.apply(this,l)),s.lineEnd(),c)return s=null,c+""||null}return c.source=function(t){return arguments.length?(e=t,c):e},c.target=function(t){return arguments.length?(n=t,c):n},c.x=function(t){return arguments.length?(r="function"==typeof t?t:Cr(+t),c):r},c.y=function(t){return arguments.length?(i="function"==typeof t?t:Cr(+t),c):i},c.context=function(e){return arguments.length?(null==e?o=s=null:s=t(o=e),c):o},c}(a<45||a>=315||a>=135&&a<225?qr:Ur).source((function(){return r})).target((function(){return i}))}},{key:"getComponentHeight",value:function(t){if("__shadowRoot"===t.id)return 0;var e=this.minHeight+this.padding+this.margin,n=t.children?t.children.map((function(t){return t.y1+e})):[0];return t.data.drawOption.height=Math.max.apply(Math,[this.minHeight+t.data.definition.isContainer*e].concat(ui(n))),t.data.drawOption.height}},{key:"getComponentWidth",value:function(t){if("__shadowRoot"===t.id)return 0;var e=t.children?t.children.map((function(t){return t.x1})):[0];return t.data.drawOption.width=Math.max.apply(Math,[this.minWidth].concat(ui(e)))+!!t.children*(this.padding+this.margin),t.data.drawOption.width}},{key:"setupTiles",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r={x1:0,y1:0};t.forEach((function(t){t.items=t.items.map((function(t){return t.data.drawOption||(t.data.drawOption=new _({needsPositioning:!0,needsResizing:!0})),t})).map((function(t){return t.data.drawOption.needsResizing&&(e.initializeComponentDrawOptions(t),t.data.drawOption.needsResizing=!1),t})).sort((function(t,e){return t.data.drawOption.needsPositioning&&!e.data.drawOption.needsPositioning?1:t.data.drawOption.needsPositioning||e.data.drawOption.needsPositioning?0:t.data.drawOption.x-e.data.drawOption.x}))}));var i=Math.max.apply(Math,ui(t.map((function(t){return t.items.reduce((function(t,e){return t+e.data.drawOption.width}),0)+(t.items.length+1)*e.padding}))));t.forEach((function(t,o){var s={x1:0,x0:i,y0:t.band+e.padding};if(t.items.forEach((function(t){t.data.drawOption.needsPositioning&&(t.data.drawOption.x=n&&o%2?s.x0-t.data.drawOption.width-e.padding:s.x1+e.padding,t.data.drawOption.y=r.y1+e.padding,t.data.drawOption.needsPositioning=!1),t.x0=t.data.drawOption.x,t.y0=t.data.drawOption.y,s=t,t.x1=t.x0+t.data.drawOption.width,t.y1=t.y0+t.data.drawOption.height})),t.items.length>0){var a=Math.max.apply(Math,ui(t.items.map((function(t){return t.value}))));r=t.items.find((function(t){return t.value===a}))}}))}},{key:"__buildLines",value:function(t,e){var n=this,r=[],i=0,o=r[i];return t.forEach((function(t){if(r=r.sort((function(t,e){return t.band-e.band})),t.data.drawOption&&!t.data.drawOption.needsPositioning)-1===(i=r.findIndex((function(e){return e.band===100*Math.floor(t.data.drawOption.y/100)})))&&(r.push({total:0,band:100*Math.floor(t.data.drawOption.y/100),items:[]}),i=r.length-1);else{for(i=0;i=n.getLineLengthForDepth(e,null===(s=t.parent)||void 0===s||null===(a=s.data)||void 0===a||null===(c=a.definition)||void 0===c?void 0:c.childrenPerLine);){var s,a,c;i+=1}i===r.length&&r.push({total:0,band:i>0?r[i-1].band+100:0,items:[]})}(o=r[i]).total+=t.value,o.items.push(t)})),r.sort((function(t,e){return t.band-e.band}))}},{key:"setViewPortAction",value:function(){var t=this;this.svg.on("click",(function(){t.__unselectComponent(),t.cancelLinkCreationInteraction()}));var e=this.drawLinks.bind(this);this.svg.call(function(){var t,e,n,r=ti,i=ei,o=oi,s=ri,a=ii,c=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],u=250,f=Wr,h=ne("start","zoom","end"),p=500,d=150,m=0,y=10;function v(t){t.property("__zoom",ni).on("wheel.zoom",x,{passive:!1}).on("mousedown.zoom",O).on("dblclick.zoom",S).filter(a).on("touchstart.zoom",T).on("touchmove.zoom",A).on("touchend.zoom touchcancel.zoom",L).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(t,e){return(e=Math.max(c[0],Math.min(c[1],e)))===t.k?t:new Hr(e,t.x,t.y)}function b(t,e,n){var r=e[0]-n[0]*t.k,i=e[1]-n[1]*t.k;return r===t.x&&i===t.y?t:new Hr(t.k,r,i)}function _(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function w(t,e,n,r){t.on("start.zoom",(function(){k(this,arguments).event(r).start()})).on("interrupt.zoom end.zoom",(function(){k(this,arguments).event(r).end()})).tween("zoom",(function(){var t=this,o=arguments,s=k(t,o).event(r),a=i.apply(t,o),c=null==n?_(a):"function"==typeof n?n.apply(t,o):n,l=Math.max(a[1][0]-a[0][0],a[1][1]-a[0][1]),u=t.__zoom,h="function"==typeof e?e.apply(t,o):e,p=f(u.invert(c).concat(l/u.k),h.invert(c).concat(l/h.k));return function(t){if(1===t)t=h;else{var e=p(t),n=l/e[2];t=new Hr(n,c[0]-e[0]*n,c[1]-e[1]*n)}s.zoom(null,t)}}))}function k(t,e,n){return!n&&t.__zooming||new E(t,e)}function E(t,e){this.that=t,this.args=e,this.active=0,this.sourceEvent=null,this.extent=i.apply(t,e),this.taps=0}function x(t,...e){if(r.apply(this,arguments)){var n=k(this,e).event(t),i=this.__zoom,a=Math.max(c[0],Math.min(c[1],i.k*Math.pow(2,s.apply(this,arguments)))),u=rr(t);if(n.wheel)n.mouse[0][0]===u[0]&&n.mouse[0][1]===u[1]||(n.mouse[1]=i.invert(n.mouse[0]=u)),clearTimeout(n.wheel);else{if(i.k===a)return;n.mouse=[u,i.invert(u)],Ne(this),n.start()}Zr(t),n.wheel=setTimeout((function(){n.wheel=null,n.end()}),d),n.zoom("mouse",o(b(g(i,a),n.mouse[0],n.mouse[1]),n.extent,l))}}function O(t,...e){if(!n&&r.apply(this,arguments)){var i=t.currentTarget,s=k(this,e,!0).event(t),a=nr(t.view).on("mousemove.zoom",(function(t){if(Zr(t),!s.moved){var e=t.clientX-u,n=t.clientY-f;s.moved=e*e+n*n>m}s.event(t).zoom("mouse",o(b(s.that.__zoom,s.mouse[0]=rr(t,i),s.mouse[1]),s.extent,l))}),!0).on("mouseup.zoom",(function(t){a.on("mousemove.zoom mouseup.zoom",null),lr(t.view,s.moved),Zr(t),s.event(t).end()}),!0),c=rr(t,i),u=t.clientX,f=t.clientY;cr(t.view),Qr(t),s.mouse=[c,this.__zoom.invert(c)],Ne(this),s.start()}}function S(t,...e){if(r.apply(this,arguments)){var n=this.__zoom,s=rr(t.changedTouches?t.changedTouches[0]:t,this),a=n.invert(s),c=n.k*(t.shiftKey?.5:2),f=o(b(g(n,c),s,a),i.apply(this,e),l);Zr(t),u>0?nr(this).transition().duration(u).call(w,f,s,t):nr(this).call(v.transform,f,s,t)}}function T(n,...i){if(r.apply(this,arguments)){var o,s,a,c,l=n.touches,u=l.length,f=k(this,i,n.changedTouches.length===u).event(n);for(Qr(n),s=0;sr&&(r=t)})),o.attr("width",r+20+15).attr("height",30*t.length).attr("x",(function(){return parseInt(i.getAttribute("x"),10)+i.getBBox().width/2-parseInt(this.getAttribute("width"),10)/2})).attr("y",parseInt(i.getAttribute("y"),10)+i.getBBox().height+10),s.on("mouseenter",(function(){nr(this).select("rect").attr("fill","grey").attr("cursor","pointer")})).on("mouseleave",(function(){nr(this).select("rect").attr("fill","lightgrey").attr("cursor","default")})).on("click",(function(t,e){n.actions.linkCreation.source=n.actions.selection.current;var r=n.pluginData.addComponent(e);n.pluginData.getComponentById(r).path=n.actions.linkCreation.source.path,n.draw(n.rootId),n.actions.linkCreation.target=nr("#".concat(r)).datum().data,n.createLink(r)}))}},{key:"startLinkCreationInteraction",value:function(){if(this.actions.selection.current){var t=this.pluginData.getComponentById(this.actions.selection.current.id),e=t.definition.definedAttributes.filter((function(t){return"Link"===t.type})).map((function(t){return":not(.".concat(t.linkRef,")")})).join("");this.actions.linkCreation.creating=!0,this.actions.linkCreation.source=t,this.setDisabledStyle(".component:not(#".concat(t.id,")").concat(e))}}},{key:"getMenuActions",value:function(t){return t.classed("component")?[{id:"create-linkable-component",icon:'',handler:function(){var e,n=null===(e=t.datum().data)||void 0===e?void 0:e.getDefinedAttributesByType("Link").map((function(t){return t.linkRef})),r=this.pluginData.definitions.components.filter((function(t){return n.includes(t.type)}));r.length>0&&this.initializeCreateLinkableComponentMenu(r)}},{id:"create-link",icon:'',handler:function(){this.startLinkCreationInteraction()}},{id:"remove-component",icon:ci,handler:function(){this.pluginData.removeComponentById(this.actions.selection.current.id),this.pluginData.emitEvent({type:"Drawer",action:"delete",status:"success",components:[this.actions.selection.current.id]}),this.draw(this.rootId)}}]:[{id:"remove-link",icon:ci,handler:function(){this.pluginData.removeLink(this.actions.selection.current),this.pluginData.emitEvent({type:"Drawer",action:"delete",status:"success",components:[]}),this.draw(this.rootId)}}]}},{key:"cancelLinkCreationInteraction",value:function(){this.actions.linkCreation.creating=!1,this.actions.linkCreation.source=null,this.actions.linkCreation.target=null,this.unsetAllDisabledStyles()}},{key:"hideActionMenu",value:function(){nr("#action-menu").remove(),nr("#linkable-menu").remove()}}],n&&function(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:[]).map((function(t){return t.path}))}},{key:"parseConfiguration",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=this.pluginData.emitEvent({parent:n,type:"Parser",action:"read",status:"running",files:[t.path],data:{global:!1}});if(null!=t.content){var i=JSON.parse(t.content);i[this.pluginData.name]?(Object.keys(i[this.pluginData.name]).forEach((function(t){var n=e.pluginData.getComponentById(t);n&&i[e.pluginData.name][t]&&(n.drawOption=new _(i[e.pluginData.name][t]))})),this.pluginData.emitEvent({id:r,status:"success"})):this.pluginData.emitEvent({id:r,status:"warning",data:{code:"no_plugin_content",global:!1}})}else this.pluginData.emitEvent({id:r,status:"warning",data:{code:"no_content",global:!1}})}},{key:"isParsable",value:function(t){return null!=t}}],n&&function(t,e){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:null,e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).reduce((function(t,e){return t[e.path]="",t}),{});return this.renderFiles(t).forEach((function(t){e[t.path]=t.content})),Object.keys(e).map((function(t){return new N({path:t,content:e[t]})}))}},{key:"renderFiles",value:function(){return[]}},{key:"renderConfiguration",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=this.pluginData.emitEvent({parent:e,type:"Render",action:"write",status:"running",files:[t.path],data:{global:!1}}),r={};this.pluginData.components.filter((function(t){return t.drawOption})).forEach((function(t){r[t.id]=t.drawOption}));var i=JSON.parse(t.content)||{};i[this.pluginData.name]=r,t.content=JSON.stringify(i,(function(t,e){return null===e?void 0:e}),2),this.pluginData.emitEvent({id:n,status:"success"})}}],n&&function(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:"Error happened when trying to parse.",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"Error";return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o),(t=i.call(this,e)).name="ParseError",t.startLine=n,t.startColumn=r,t.endLine=s,t.endColumn=a,t.severity=c,t}return e=o,Object.defineProperty(e,"prototype",{writable:!1}),e}(Li(Error));var Ri=function(t,e,n){return Object.defineProperty(t,"prototype",{writable:!1}),t}((function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{id:null,parentId:null,files:null,components:null,links:null,type:null,action:null,status:null,data:null};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t);var n=e.id,r=e.parentId,i=e.files,o=e.components,s=e.links,a=e.type,c=e.action,l=e.status,u=e.data;this.id=n||null,this.parentId=r||null,this.startDate=null,this.endDate=null,this.files=i||null,this.components=o||null,this.links=s||null,this.type=a||null,this.action=c||null,this.status=l||null,this.data=u||null}));const Mi=Ri;function Bi(t){return Bi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Bi(t)}function Di(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Fi(t){for(var e=1;e0&&void 0!==arguments[0]?arguments[0]:{name:null,version:null,components:[],definitions:{components:[],links:[]},parseErrors:[],defaultFileName:null},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.name=e.name||null,this.version=e.version||null,this.components=e.components||[],this.definitions={components:[],links:[]},e.definitions&&(this.definitions.components=e.definitions.components||[],this.definitions.links=e.definitions.links||[]),this.parseErrors=e.parseErrors||[],this.defaultFileName=e.defaultFileName||null,this.__eventIndex=0,this.eventManager=n,this.eventLogs=[]}var e,n;return e=t,n=[{key:"coreVersion",get:function(){return"0.15.2"}},{key:"getComponentById",value:function(t){return this.components.find((function(e){return e.id===t}))||null}},{key:"getComponentsByType",value:function(t){return this.components.filter((function(e){var n=e.definition;return n&&n.type===t}))}},{key:"addComponent",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.defaultFileName||"",r=this.generateComponentId(t);return this.components.push(new f({id:r,name:r,definition:t,path:"".concat(e).concat(n)})),r}},{key:"generateComponentId",value:function(t){for(var e="".concat(t.type,"_"),n=this.components.map((function(t){return t.id})).filter((function(t){return new RegExp("".concat(e,"\\d+")).test(t)})).map((function(t){return parseInt(t.substring(e.length),10)})),r=1;n.includes(r);)r+=1;return"".concat(e).concat(r)}},{key:"removeComponentById",value:function(t){var e=this;this.getChildren(t).forEach((function(t){return e.removeComponentById(t.id)})),this.components=this.components.filter((function(e){return e.id!==t})),this.components.forEach((function(e){e.removeLinkAttribute(t)}))}},{key:"removeLink",value:function(t){var e=t.source,n=t.target,r=t.definition.attributeRef;this.getComponentById(e).removeLinkAttribute(n,r)}},{key:"getLinks",value:function(){var t=this,e=[];return this.definitions.links.forEach((function(n){t.getComponentsByType(n.sourceRef).forEach((function(t){var r=t.getAttributeByName(n.attributeRef);r&&r.value.forEach((function(r){return e.push(new x({definition:n,source:t.id,target:r}))}))}))})),e.concat(this.getWorkflowLinks())}},{key:"getWorkflowLinks",value:function(){var t=this;return this.components.filter((function(t){var e;return null===(e=t.definition.displayType)||void 0===e?void 0:e.match("workflow")})).reduce((function(e,n){var r=t.getChildren(n.id);if(r.length>1)for(var i=0;in,this.components.splice(i,0,r),this.components.splice(n+(it}))}},{key:"emitEvent",value:function(){var t,e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=n.id;return r?(e=this.getEventLogById(r),Object.keys(n).forEach((function(t){e[t]=n[t]}))):(this.__eventIndex+=1,r=this.__eventIndex,(e=new Mi(Fi(Fi({},n),{},{id:r}))).startDate=Date.now(),this.eventLogs.push(e)),["success","warning","error"].includes(e.status)&&(e.endDate=Date.now()),null!==(t=this.eventManager)&&void 0!==t&&t.next&&this.eventManager.next({plugin:this.name,event:Fi({},e)}),r}}],n&&function(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{editor:{syntax:null}};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.editor=function(t){for(var e=1;e0&&void 0!==arguments[0]?arguments[0]:{event:null,configuration:null,pluginData:null,pluginDrawer:null,pluginMetadata:null,pluginParser:null,pluginRenderer:null};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.configuration=e.configuration||new Hi,this.data=e.pluginData||new Ui({},e.event),this.__drawer=e.pluginDrawer||new bi(this.data),this.__metadata=e.pluginMetadata||new wi(this.data),this.__parser=e.pluginParser||new xi(this.data),this.__renderer=e.pluginRenderer||new Ti(this.data)}var e,n;return e=t,n=[{key:"init",value:function(){var t=this.data.emitEvent({type:"Plugin",action:"init",status:"running"});this.__metadata.parse(t),this.data.initLinkDefinitions(t),this.data.emitEvent({id:t,status:"success"})}},{key:"initResources",value:function(t){this.__drawer.resources=t}},{key:"draw",value:function(t){this.__drawer.draw(t)}},{key:"parse",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=this.data.emitEvent({type:"Parser",action:"read",status:"running",files:e.map((function(t){return t.path})).concat(null==t?void 0:t.path),data:{global:!0}});this.__parser.parse(e,n),this.__parser.parseConfiguration(t,n),this.data.emitEvent({id:n,status:"success"})}},{key:"isParsable",value:function(t){return this.__parser.isParsable(t)}},{key:"getModels",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return this.__parser.getModels(e.filter((function(e){return t.isParsable(e)})))}},{key:"render",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=this.data.emitEvent({type:"Render",action:"write",status:"running",files:e.map((function(t){return t.path})).concat(t.path),data:{global:!0}});this.__renderer.renderConfiguration(t,n);var r=this.__renderer.render(e,n).concat(t);return this.data.emitEvent({id:n,status:"success"}),r}}],n&&function(t,e){for(var n=0;n":">"},s=/[&"'<>]/g;function a(t,e){return i.hasOwnProperty.call(t,e)}function c(t){return o[t]}function l(t,e,n){var r,i,o;if(t instanceof Error&&(t=(i=t).name+": "+i.message),Object.setPrototypeOf?(r=new Error(t),Object.setPrototypeOf(r,l.prototype)):(r=this,Object.defineProperty(r,"message",{enumerable:!1,writable:!0,value:t})),Object.defineProperty(r,"name",{value:"Template render error"}),Error.captureStackTrace&&Error.captureStackTrace(r,this.constructor),i){var s=Object.getOwnPropertyDescriptor(i,"stack");(o=s&&(s.get||function(){return s.value}))||(o=function(){return i.stack})}else{var a=new Error(t).stack;o=function(){return a}}return Object.defineProperty(r,"stack",{get:function(){return o.call(r)}}),Object.defineProperty(r,"cause",{value:i}),r.lineno=e,r.colno=n,r.firstUpdate=!0,r.Update=function(t){var e="("+(t||"unknown path")+")";return this.firstUpdate&&(this.lineno&&this.colno?e+=" [Line "+this.lineno+", Column "+this.colno+"]":this.lineno&&(e+=" [Line "+this.lineno+"]")),e+="\n ",this.firstUpdate&&(e+=" "),this.message=e+(this.message||""),this.firstUpdate=!1,this},r}function u(t){return"[object Function]"===i.toString.call(t)}function f(t){return"[object Array]"===i.toString.call(t)}function h(t){return"[object String]"===i.toString.call(t)}function p(t){return"[object Object]"===i.toString.call(t)}function d(t){var e,n=(e=t)?"string"==typeof e?e.split("."):[e]:[];return function(t){for(var e=t,r=0;rt.length)s=i.slice(0,t.length),i.slice(s.length,l).forEach((function(t,n){n2?i-2:0),s=2;s0||!n)&&process.stdout.write(" ".repeat(e));var o=i===r.length-1?"":"\n";process.stdout.write(""+t+o)}))}t.exports={Node:c,Root:f,NodeList:u,Value:l,Literal:h,Symbol:p,Group:d,Array:m,Pair:y,Dict:v,Output:K,Capture:$,TemplateData:V,If:b,IfAsync:_,InlineIf:w,For:k,AsyncEach:E,AsyncAll:x,Macro:O,Caller:S,Import:T,FromImport:A,FunCall:L,Filter:N,FilterAsync:C,KeywordArgs:j,Block:P,Super:I,Extends:R,Include:M,Set:B,Switch:D,Case:F,LookupVal:g,BinOp:q,In:z,Is:W,Or:G,And:Y,Not:H,Add:J,Concat:X,Sub:Q,Mul:Z,Div:tt,FloorDiv:et,Mod:nt,Pow:rt,Neg:it,Pos:ot,Compare:st,CompareOperand:at,CallExtension:ct,CallExtensionAsync:lt,printNodes:function t(e,n){if(n=n||0,ut(e.typename+": ",n),e instanceof u)ut("\n"),e.children.forEach((function(e){t(e,n+2)}));else if(e instanceof ct)ut(e.extName+"."+e.prop+"\n"),e.args&&t(e.args,n+2),e.contentArgs&&e.contentArgs.forEach((function(e){t(e,n+2)}));else{var r=[],i=null;e.iterFields((function(t,e){t instanceof c?r.push([e,t]):(i=i||{})[e]=t})),i?ut(JSON.stringify(i,null,2)+"\n",null,!0):ut("\n"),r.forEach((function(e){var r=e[0],i=e[1];ut("["+r+"] =>",n+2),t(i,n+4)}))}}}},function(t,e){},function(t,e,n){"use strict";function r(t,e){return r=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},r(t,e)}var i=n(8),o=n(17),s=n(3),a=n(0).TemplateError,c=n(2).Frame,l=n(1).Obj,u={"==":"==","===":"===","!=":"!=","!==":"!==","<":"<",">":">","<=":"<=",">=":">="},f=function(t){var e,n;function i(){return t.apply(this,arguments)||this}n=t,(e=i).prototype=Object.create(n.prototype),e.prototype.constructor=e,r(e,n);var o=i.prototype;return o.init=function(t,e){this.templateName=t,this.codebuf=[],this.lastId=0,this.buffer=null,this.bufferStack=[],this._scopeClosers="",this.inBlock=!1,this.throwOnUndefined=e},o.fail=function(t,e,n){throw void 0!==e&&(e+=1),void 0!==n&&(n+=1),new a(t,e,n)},o._pushBuffer=function(){var t=this._tmpid();return this.bufferStack.push(this.buffer),this.buffer=t,this._emit("var "+this.buffer+' = "";'),t},o._popBuffer=function(){this.buffer=this.bufferStack.pop()},o._emit=function(t){this.codebuf.push(t)},o._emitLine=function(t){this._emit(t+"\n")},o._emitLines=function(){for(var t=this,e=arguments.length,n=new Array(e),r=0;r0&&i._emit(","),i.compile(t,e)})),r&&this._emit(r)},o._compileExpression=function(t,e){this.assertType(t,s.Literal,s.Symbol,s.Group,s.Array,s.Dict,s.FunCall,s.Caller,s.Filter,s.LookupVal,s.Compare,s.InlineIf,s.In,s.Is,s.And,s.Or,s.Not,s.Add,s.Concat,s.Sub,s.Mul,s.Div,s.FloorDiv,s.Mod,s.Pow,s.Neg,s.Pos,s.Compare,s.NodeList),this.compile(t,e)},o.assertType=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r0&&r._emit(","),t){r._emitLine("function(cb) {"),r._emitLine("if(!cb) { cb = function(err) { if(err) { throw err; }}}");var i=r._pushBuffer();r._withScopedSyntax((function(){r.compile(t,e),r._emitLine("cb(null, "+i+");")})),r._popBuffer(),r._emitLine("return "+i+";"),r._emitLine("}")}else r._emit("null")})),n){var c=this._tmpid();this._emitLine(", "+this._makeCallback(c)),this._emitLine(this.buffer+" += runtime.suppressValue("+c+", "+a+" && env.opts.autoescape);"),this._addScopeLevel()}else this._emit(")"),this._emit(", "+a+" && env.opts.autoescape);\n")},o.compileCallExtensionAsync=function(t,e){this.compileCallExtension(t,e,!0)},o.compileNodeList=function(t,e){this._compileChildren(t,e)},o.compileLiteral=function(t){if("string"==typeof t.value){var e=t.value.replace(/\\/g,"\\\\");e=(e=(e=(e=(e=e.replace(/"/g,'\\"')).replace(/\n/g,"\\n")).replace(/\r/g,"\\r")).replace(/\t/g,"\\t")).replace(/\u2028/g,"\\u2028"),this._emit('"'+e+'"')}else null===t.value?this._emit("null"):this._emit(t.value.toString())},o.compileSymbol=function(t,e){var n=t.value,r=e.lookup(n);r?this._emit(r):this._emit('runtime.contextOrFrameLookup(context, frame, "'+n+'")')},o.compileGroup=function(t,e){this._compileAggregate(t,e,"(",")")},o.compileArray=function(t,e){this._compileAggregate(t,e,"[","]")},o.compileDict=function(t,e){this._compileAggregate(t,e,"{","}")},o.compilePair=function(t,e){var n=t.key,r=t.value;n instanceof s.Symbol?n=new s.Literal(n.lineno,n.colno,n.value):n instanceof s.Literal&&"string"==typeof n.value||this.fail("compilePair: Dict keys must be strings or names",n.lineno,n.colno),this.compile(n,e),this._emit(": "),this._compileExpression(r,e)},o.compileInlineIf=function(t,e){this._emit("("),this.compile(t.cond,e),this._emit("?"),this.compile(t.body,e),this._emit(":"),null!==t.else_?this.compile(t.else_,e):this._emit('""'),this._emit(")")},o.compileIn=function(t,e){this._emit("runtime.inOperator("),this.compile(t.left,e),this._emit(","),this.compile(t.right,e),this._emit(")")},o.compileIs=function(t,e){var n=t.right.name?t.right.name.value:t.right.value;this._emit('env.getTest("'+n+'").call(context, '),this.compile(t.left,e),t.right.args&&(this._emit(","),this.compile(t.right.args,e)),this._emit(") === true")},o._binOpEmitter=function(t,e,n){this.compile(t.left,e),this._emit(n),this.compile(t.right,e)},o.compileOr=function(t,e){return this._binOpEmitter(t,e," || ")},o.compileAnd=function(t,e){return this._binOpEmitter(t,e," && ")},o.compileAdd=function(t,e){return this._binOpEmitter(t,e," + ")},o.compileConcat=function(t,e){return this._binOpEmitter(t,e,' + "" + ')},o.compileSub=function(t,e){return this._binOpEmitter(t,e," - ")},o.compileMul=function(t,e){return this._binOpEmitter(t,e," * ")},o.compileDiv=function(t,e){return this._binOpEmitter(t,e," / ")},o.compileMod=function(t,e){return this._binOpEmitter(t,e," % ")},o.compileNot=function(t,e){this._emit("!"),this.compile(t.target,e)},o.compileFloorDiv=function(t,e){this._emit("Math.floor("),this.compile(t.left,e),this._emit(" / "),this.compile(t.right,e),this._emit(")")},o.compilePow=function(t,e){this._emit("Math.pow("),this.compile(t.left,e),this._emit(", "),this.compile(t.right,e),this._emit(")")},o.compileNeg=function(t,e){this._emit("-"),this.compile(t.target,e)},o.compilePos=function(t,e){this._emit("+"),this.compile(t.target,e)},o.compileCompare=function(t,e){var n=this;this.compile(t.expr,e),t.ops.forEach((function(t){n._emit(" "+u[t.type]+" "),n.compile(t.expr,e)}))},o.compileLookupVal=function(t,e){this._emit("runtime.memberLookup(("),this._compileExpression(t.target,e),this._emit("),"),this._compileExpression(t.val,e),this._emit(")")},o._getNodeName=function(t){switch(t.typename){case"Symbol":return t.value;case"FunCall":return"the return value of ("+this._getNodeName(t.name)+")";case"LookupVal":return this._getNodeName(t.target)+'["'+this._getNodeName(t.val)+'"]';case"Literal":return t.value.toString();default:return"--expression--"}},o.compileFunCall=function(t,e){this._emit("(lineno = "+t.lineno+", colno = "+t.colno+", "),this._emit("runtime.callWrap("),this._compileExpression(t.name,e),this._emit(', "'+this._getNodeName(t.name).replace(/"/g,'\\"')+'", context, '),this._compileAggregate(t.args,e,"[","])"),this._emit(")")},o.compileFilter=function(t,e){var n=t.name;this.assertType(n,s.Symbol),this._emit('env.getFilter("'+n.value+'").call(context, '),this._compileAggregate(t.args,e),this._emit(")")},o.compileFilterAsync=function(t,e){var n=t.name,r=t.symbol.value;this.assertType(n,s.Symbol),e.set(r,r),this._emit('env.getFilter("'+n.value+'").call(context, '),this._compileAggregate(t.args,e),this._emitLine(", "+this._makeCallback(r)),this._addScopeLevel()},o.compileKeywordArgs=function(t,e){this._emit("runtime.makeKeywordArgs("),this.compileDict(t,e),this._emit(")")},o.compileSet=function(t,e){var n=this,r=[];t.targets.forEach((function(t){var i=t.value,o=e.lookup(i);null==o&&(o=n._tmpid(),n._emitLine("var "+o+";")),r.push(o)})),t.value?(this._emit(r.join(" = ")+" = "),this._compileExpression(t.value,e),this._emitLine(";")):(this._emit(r.join(" = ")+" = "),this.compile(t.body,e),this._emitLine(";")),t.targets.forEach((function(t,e){var i=r[e],o=t.value;n._emitLine('frame.set("'+o+'", '+i+", true);"),n._emitLine("if(frame.topLevel) {"),n._emitLine('context.setVariable("'+o+'", '+i+");"),n._emitLine("}"),"_"!==o.charAt(0)&&(n._emitLine("if(frame.topLevel) {"),n._emitLine('context.addExport("'+o+'", '+i+");"),n._emitLine("}"))}))},o.compileSwitch=function(t,e){var n=this;this._emit("switch ("),this.compile(t.expr,e),this._emit(") {"),t.cases.forEach((function(t,r){n._emit("case "),n.compile(t.cond,e),n._emit(": "),n.compile(t.body,e),t.body.children.length&&n._emitLine("break;")})),t.default&&(this._emit("default:"),this.compile(t.default,e)),this._emit("}")},o.compileIf=function(t,e,n){var r=this;this._emit("if("),this._compileExpression(t.cond,e),this._emitLine(") {"),this._withScopedSyntax((function(){r.compile(t.body,e),n&&r._emit("cb()")})),t.else_?(this._emitLine("}\nelse {"),this._withScopedSyntax((function(){r.compile(t.else_,e),n&&r._emit("cb()")}))):n&&(this._emitLine("}\nelse {"),this._emit("cb()")),this._emitLine("}")},o.compileIfAsync=function(t,e){this._emit("(function(cb) {"),this.compileIf(t,e,!0),this._emit("})("+this._makeCallback()),this._addScopeLevel()},o._emitLoopBindings=function(t,e,n,r){var i=this;[{name:"index",val:n+" + 1"},{name:"index0",val:n},{name:"revindex",val:r+" - "+n},{name:"revindex0",val:r+" - "+n+" - 1"},{name:"first",val:n+" === 0"},{name:"last",val:n+" === "+r+" - 1"},{name:"length",val:r}].forEach((function(t){i._emitLine('frame.set("loop.'+t.name+'", '+t.val+");")}))},o.compileFor=function(t,e){var n=this,r=this._tmpid(),i=this._tmpid(),o=this._tmpid();if(e=e.push(),this._emitLine("frame = frame.push();"),this._emit("var "+o+" = "),this._compileExpression(t.arr,e),this._emitLine(";"),this._emit("if("+o+") {"),this._emitLine(o+" = runtime.fromIterator("+o+");"),t.name instanceof s.Array){this._emitLine("var "+r+";"),this._emitLine("if(runtime.isArray("+o+")) {"),this._emitLine("var "+i+" = "+o+".length;"),this._emitLine("for("+r+"=0; "+r+" < "+o+".length; "+r+"++) {"),t.name.children.forEach((function(i,s){var a=n._tmpid();n._emitLine("var "+a+" = "+o+"["+r+"]["+s+"];"),n._emitLine('frame.set("'+i+'", '+o+"["+r+"]["+s+"]);"),e.set(t.name.children[s].value,a)})),this._emitLoopBindings(t,o,r,i),this._withScopedSyntax((function(){n.compile(t.body,e)})),this._emitLine("}"),this._emitLine("} else {");var a=t.name.children,c=a[0],l=a[1],u=this._tmpid(),f=this._tmpid();e.set(c.value,u),e.set(l.value,f),this._emitLine(r+" = -1;"),this._emitLine("var "+i+" = runtime.keys("+o+").length;"),this._emitLine("for(var "+u+" in "+o+") {"),this._emitLine(r+"++;"),this._emitLine("var "+f+" = "+o+"["+u+"];"),this._emitLine('frame.set("'+c.value+'", '+u+");"),this._emitLine('frame.set("'+l.value+'", '+f+");"),this._emitLoopBindings(t,o,r,i),this._withScopedSyntax((function(){n.compile(t.body,e)})),this._emitLine("}"),this._emitLine("}")}else{var h=this._tmpid();e.set(t.name.value,h),this._emitLine("var "+i+" = "+o+".length;"),this._emitLine("for(var "+r+"=0; "+r+" < "+o+".length; "+r+"++) {"),this._emitLine("var "+h+" = "+o+"["+r+"];"),this._emitLine('frame.set("'+t.name.value+'", '+h+");"),this._emitLoopBindings(t,o,r,i),this._withScopedSyntax((function(){n.compile(t.body,e)})),this._emitLine("}")}this._emitLine("}"),t.else_&&(this._emitLine("if (!"+i+") {"),this.compile(t.else_,e),this._emitLine("}")),this._emitLine("frame = frame.pop();")},o._compileAsyncLoop=function(t,e,n){var r=this,i=this._tmpid(),o=this._tmpid(),a=this._tmpid(),c=n?"asyncAll":"asyncEach";if(e=e.push(),this._emitLine("frame = frame.push();"),this._emit("var "+a+" = runtime.fromIterator("),this._compileExpression(t.arr,e),this._emitLine(");"),t.name instanceof s.Array){var l=t.name.children.length;this._emit("runtime."+c+"("+a+", "+l+", function("),t.name.children.forEach((function(t){r._emit(t.value+",")})),this._emit(i+","+o+",next) {"),t.name.children.forEach((function(t){var n=t.value;e.set(n,n),r._emitLine('frame.set("'+n+'", '+n+");")}))}else{var u=t.name.value;this._emitLine("runtime."+c+"("+a+", 1, function("+u+", "+i+", "+o+",next) {"),this._emitLine('frame.set("'+u+'", '+u+");"),e.set(u,u)}this._emitLoopBindings(t,a,i,o),this._withScopedSyntax((function(){var o;n&&(o=r._pushBuffer()),r.compile(t.body,e),r._emitLine("next("+i+(o?","+o:"")+");"),n&&r._popBuffer()}));var f=this._tmpid();this._emitLine("}, "+this._makeCallback(f)),this._addScopeLevel(),n&&this._emitLine(this.buffer+" += "+f+";"),t.else_&&(this._emitLine("if (!"+a+".length) {"),this.compile(t.else_,e),this._emitLine("}")),this._emitLine("frame = frame.pop();")},o.compileAsyncEach=function(t,e){this._compileAsyncLoop(t,e)},o.compileAsyncAll=function(t,e){this._compileAsyncLoop(t,e,!0)},o._compileMacro=function(t,e){var n=this,r=[],i=null,o="macro_"+this._tmpid(),a=void 0!==e;t.args.children.forEach((function(e,o){o===t.args.children.length-1&&e instanceof s.Dict?i=e:(n.assertType(e,s.Symbol),r.push(e))}));var l,u=[].concat(r.map((function(t){return"l_"+t.value})),["kwargs"]),f=r.map((function(t){return'"'+t.value+'"'})),h=(i&&i.children||[]).map((function(t){return'"'+t.key.value+'"'}));l=a?e.push(!0):new c,this._emitLines("var "+o+" = runtime.makeMacro(","["+f.join(", ")+"], ","["+h.join(", ")+"], ","function ("+u.join(", ")+") {","var callerFrame = frame;","frame = "+(a?"frame.push(true);":"new runtime.Frame();"),"kwargs = kwargs || {};",'if (Object.prototype.hasOwnProperty.call(kwargs, "caller")) {','frame.set("caller", kwargs.caller); }'),r.forEach((function(t){n._emitLine('frame.set("'+t.value+'", l_'+t.value+");"),l.set(t.value,"l_"+t.value)})),i&&i.children.forEach((function(t){var e=t.key.value;n._emit('frame.set("'+e+'", '),n._emit('Object.prototype.hasOwnProperty.call(kwargs, "'+e+'")'),n._emit(' ? kwargs["'+e+'"] : '),n._compileExpression(t.value,l),n._emit(");")}));var p=this._pushBuffer();return this._withScopedSyntax((function(){n.compile(t.body,l)})),this._emitLine("frame = "+(a?"frame.pop();":"callerFrame;")),this._emitLine("return new runtime.SafeString("+p+");"),this._emitLine("});"),this._popBuffer(),o},o.compileMacro=function(t,e){var n=this._compileMacro(t),r=t.name.value;e.set(r,n),e.parent?this._emitLine('frame.set("'+r+'", '+n+");"):("_"!==t.name.value.charAt(0)&&this._emitLine('context.addExport("'+r+'");'),this._emitLine('context.setVariable("'+r+'", '+n+");"))},o.compileCaller=function(t,e){this._emit("(function (){");var n=this._compileMacro(t,e);this._emit("return "+n+";})()")},o._compileGetTemplate=function(t,e,n,r){var i=this._tmpid(),o=this._templateName(),s=this._makeCallback(i),a=n?"true":"false",c=r?"true":"false";return this._emit("env.getTemplate("),this._compileExpression(t.template,e),this._emitLine(", "+a+", "+o+", "+c+", "+s),i},o.compileImport=function(t,e){var n=t.target.value,r=this._compileGetTemplate(t,e,!1,!1);this._addScopeLevel(),this._emitLine(r+".getExported("+(t.withContext?"context.getVariables(), frame, ":"")+this._makeCallback(r)),this._addScopeLevel(),e.set(n,r),e.parent?this._emitLine('frame.set("'+n+'", '+r+");"):this._emitLine('context.setVariable("'+n+'", '+r+");")},o.compileFromImport=function(t,e){var n=this,r=this._compileGetTemplate(t,e,!1,!1);this._addScopeLevel(),this._emitLine(r+".getExported("+(t.withContext?"context.getVariables(), frame, ":"")+this._makeCallback(r)),this._addScopeLevel(),t.names.children.forEach((function(t){var i,o,a=n._tmpid();t instanceof s.Pair?(i=t.key.value,o=t.value.value):o=i=t.value,n._emitLine("if(Object.prototype.hasOwnProperty.call("+r+', "'+i+'")) {'),n._emitLine("var "+a+" = "+r+"."+i+";"),n._emitLine("} else {"),n._emitLine("cb(new Error(\"cannot import '"+i+"'\")); return;"),n._emitLine("}"),e.set(o,a),e.parent?n._emitLine('frame.set("'+o+'", '+a+");"):n._emitLine('context.setVariable("'+o+'", '+a+");")}))},o.compileBlock=function(t){var e=this._tmpid();this.inBlock||this._emit('(parentTemplate ? function(e, c, f, r, cb) { cb(""); } : '),this._emit('context.getBlock("'+t.name.value+'")'),this.inBlock||this._emit(")"),this._emitLine("(env, context, frame, runtime, "+this._makeCallback(e)),this._emitLine(this.buffer+" += "+e+";"),this._addScopeLevel()},o.compileSuper=function(t,e){var n=t.blockName.value,r=t.symbol.value,i=this._makeCallback(r);this._emitLine('context.getSuper(env, "'+n+'", b_'+n+", frame, runtime, "+i),this._emitLine(r+" = runtime.markSafe("+r+");"),this._addScopeLevel(),e.set(r,r)},o.compileExtends=function(t,e){var n=this._tmpid(),r=this._compileGetTemplate(t,e,!0,!1);this._emitLine("parentTemplate = "+r),this._emitLine("for(var "+n+" in parentTemplate.blocks) {"),this._emitLine("context.addBlock("+n+", parentTemplate.blocks["+n+"]);"),this._emitLine("}"),this._addScopeLevel()},o.compileInclude=function(t,e){this._emitLine("var tasks = [];"),this._emitLine("tasks.push("),this._emitLine("function(callback) {");var n=this._compileGetTemplate(t,e,!1,t.ignoreMissing);this._emitLine("callback(null,"+n+");});"),this._emitLine("});");var r=this._tmpid();this._emitLine("tasks.push("),this._emitLine("function(template, callback){"),this._emitLine("template.render(context.getVariables(), frame, "+this._makeCallback(r)),this._emitLine("callback(null,"+r+");});"),this._emitLine("});"),this._emitLine("tasks.push("),this._emitLine("function(result, callback){"),this._emitLine(this.buffer+" += result;"),this._emitLine("callback(null);"),this._emitLine("});"),this._emitLine("env.waterfall(tasks, function(){"),this._addScopeLevel()},o.compileTemplateData=function(t,e){this.compileLiteral(t,e)},o.compileCapture=function(t,e){var n=this,r=this.buffer;this.buffer="output",this._emitLine("(function() {"),this._emitLine('var output = "";'),this._withScopedSyntax((function(){n.compile(t.body,e)})),this._emitLine("return output;"),this._emitLine("})()"),this.buffer=r},o.compileOutput=function(t,e){var n=this;t.children.forEach((function(r){r instanceof s.TemplateData?r.value&&(n._emit(n.buffer+" += "),n.compileLiteral(r,e),n._emitLine(";")):(n._emit(n.buffer+" += runtime.suppressValue("),n.throwOnUndefined&&n._emit("runtime.ensureDefined("),n.compile(r,e),n.throwOnUndefined&&n._emit(","+t.lineno+","+t.colno+")"),n._emit(", env.opts.autoescape);\n"))}))},o.compileRoot=function(t,e){var n=this;e&&this.fail("compileRoot: root node can't have frame"),e=new c,this._emitFuncBegin(t,"root"),this._emitLine("var parentTemplate = null;"),this._compileChildren(t,e),this._emitLine("if(parentTemplate) {"),this._emitLine("parentTemplate.rootRenderFunc(env, context, frame, runtime, cb);"),this._emitLine("} else {"),this._emitLine("cb(null, "+this.buffer+");"),this._emitLine("}"),this._emitFuncEnd(!0),this.inBlock=!0;var r=[],i=t.findAll(s.Block);i.forEach((function(t,e){var i=t.name.value;if(-1!==r.indexOf(i))throw new Error('Block "'+i+'" defined more than once.');r.push(i),n._emitFuncBegin(t,"b_"+i);var o=new c;n._emitLine("var frame = frame.push(true);"),n.compile(t.body,o),n._emitFuncEnd()})),this._emitLine("return {"),i.forEach((function(t,e){var r="b_"+t.name.value;n._emitLine(r+": "+r+",")})),this._emitLine("root: root\n};")},o.compile=function(t,e){var n=this["compile"+t.typename];n?n.call(this,t,e):this.fail("compile: Cannot compile node: "+t.typename,t.lineno,t.colno)},o.getCode=function(){return this.codebuf.join("")},i}(l);t.exports={compile:function(t,e,n,r,s){void 0===s&&(s={});var a=new f(r,s.throwOnUndefined),c=(n||[]).map((function(t){return t.preprocess})).filter((function(t){return!!t})).reduce((function(t,e){return e(t)}),t);return a.compile(o.transform(i.parse(c,n,s),e,r)),a.getCode()},Compiler:f}},function(t,e,n){"use strict";function r(t,e){return r=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},r(t,e)}var i=n(4),o=n(1).EmitterObj;t.exports=function(t){var e,n;function o(){return t.apply(this,arguments)||this}n=t,(e=o).prototype=Object.create(n.prototype),e.prototype.constructor=e,r(e,n);var s=o.prototype;return s.resolve=function(t,e){return i.resolve(i.dirname(t),e)},s.isRelative=function(t){return 0===t.indexOf("./")||0===t.indexOf("../")},o}(o)},function(t,e,n){"use strict";function r(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,i(t,e)}function i(t,e){return i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},i(t,e)}var o=n(12),s=n(15),a=n(0),c=n(5),l=n(18),u=n(10),f=u.FileSystemLoader,h=u.WebLoader,p=u.PrecompiledLoader,d=n(20),m=n(21),y=n(1),v=y.Obj,g=y.EmitterObj,b=n(2),_=b.handleError,w=b.Frame,k=n(22);function E(t,e,n){o((function(){t(e,n)}))}var x={type:"code",obj:{root:function(t,e,n,r,i){try{i(null,"")}catch(t){i(_(t,null,null))}}}},O=function(t){function e(){return t.apply(this,arguments)||this}r(e,t);var n=e.prototype;return n.init=function(t,e){var n=this;e=this.opts=e||{},this.opts.dev=!!e.dev,this.opts.autoescape=null==e.autoescape||e.autoescape,this.opts.throwOnUndefined=!!e.throwOnUndefined,this.opts.trimBlocks=!!e.trimBlocks,this.opts.lstripBlocks=!!e.lstripBlocks,this.loaders=[],t?this.loaders=a.isArray(t)?t:[t]:f?this.loaders=[new f("views")]:h&&(this.loaders=[new h("/views")]),"undefined"!=typeof window&&window.nunjucksPrecompiled&&this.loaders.unshift(new p(window.nunjucksPrecompiled)),this._initLoaders(),this.globals=m(),this.filters={},this.tests={},this.asyncFilters=[],this.extensions={},this.extensionsList=[],a._entries(l).forEach((function(t){var e=t[0],r=t[1];return n.addFilter(e,r)})),a._entries(d).forEach((function(t){var e=t[0],r=t[1];return n.addTest(e,r)}))},n._initLoaders=function(){var t=this;this.loaders.forEach((function(e){e.cache={},"function"==typeof e.on&&(e.on("update",(function(n,r){e.cache[n]=null,t.emit("update",n,r,e)})),e.on("load",(function(n,r){t.emit("load",n,r,e)})))}))},n.invalidateCache=function(){this.loaders.forEach((function(t){t.cache={}}))},n.addExtension=function(t,e){return e.__name=t,this.extensions[t]=e,this.extensionsList.push(e),this},n.removeExtension=function(t){var e=this.getExtension(t);e&&(this.extensionsList=a.without(this.extensionsList,e),delete this.extensions[t])},n.getExtension=function(t){return this.extensions[t]},n.hasExtension=function(t){return!!this.extensions[t]},n.addGlobal=function(t,e){return this.globals[t]=e,this},n.getGlobal=function(t){if(void 0===this.globals[t])throw new Error("global not found: "+t);return this.globals[t]},n.addFilter=function(t,e,n){var r=e;return n&&this.asyncFilters.push(t),this.filters[t]=r,this},n.getFilter=function(t){if(!this.filters[t])throw new Error("filter not found: "+t);return this.filters[t]},n.addTest=function(t,e){return this.tests[t]=e,this},n.getTest=function(t){if(!this.tests[t])throw new Error("test not found: "+t);return this.tests[t]},n.resolveTemplate=function(t,e,n){return t.isRelative&&e&&t.isRelative(n)&&t.resolve?t.resolve(e,n):n},n.getTemplate=function(t,e,n,r,i){var o,s=this,c=this,l=null;if(t&&t.raw&&(t=t.raw),a.isFunction(n)&&(i=n,n=null,e=e||!1),a.isFunction(e)&&(i=e,e=!1),t instanceof T)l=t;else{if("string"!=typeof t)throw new Error("template names must be a string: "+t);for(var u=0;u0&&!this.skip(i.TOKEN_COMMA)&&this.fail("parseFrom: expected comma",t.lineno,t.colno);var a=this.parsePrimary();if("_"===a.value.charAt(0)&&this.fail("parseFrom: names starting with an underscore cannot be imported",a.lineno,a.colno),this.skipSymbol("as")){var c=this.parsePrimary();r.addChild(new o.Pair(a.lineno,a.colno,a,c))}else r.addChild(a);n=this.parseWithContext()}return new o.FromImport(t.lineno,t.colno,e,r,n)},c.parseBlock=function(){var t=this.peekToken();this.skipSymbol("block")||this.fail("parseBlock: expected block",t.lineno,t.colno);var e=new o.Block(t.lineno,t.colno);e.name=this.parsePrimary(),e.name instanceof o.Symbol||this.fail("parseBlock: variable name expected",t.lineno,t.colno),this.advanceAfterBlockEnd(t.value),e.body=this.parseUntilBlocks("endblock"),this.skipSymbol("endblock"),this.skipSymbol(e.name.value);var n=this.peekToken();return n||this.fail("parseBlock: expected endblock, got end of file"),this.advanceAfterBlockEnd(n.value),e},c.parseExtends=function(){var t="extends",e=this.peekToken();this.skipSymbol(t)||this.fail("parseTemplateRef: expected "+t);var n=new o.Extends(e.lineno,e.colno);return n.template=this.parseExpression(),this.advanceAfterBlockEnd(e.value),n},c.parseInclude=function(){var t="include",e=this.peekToken();this.skipSymbol(t)||this.fail("parseInclude: expected "+t);var n=new o.Include(e.lineno,e.colno);return n.template=this.parseExpression(),this.skipSymbol("ignore")&&this.skipSymbol("missing")&&(n.ignoreMissing=!0),this.advanceAfterBlockEnd(e.value),n},c.parseIf=function(){var t,e=this.peekToken();this.skipSymbol("if")||this.skipSymbol("elif")||this.skipSymbol("elseif")?t=new o.If(e.lineno,e.colno):this.skipSymbol("ifAsync")?t=new o.IfAsync(e.lineno,e.colno):this.fail("parseIf: expected if, elif, or elseif",e.lineno,e.colno),t.cond=this.parseExpression(),this.advanceAfterBlockEnd(e.value),t.body=this.parseUntilBlocks("elif","elseif","else","endif");var n=this.peekToken();switch(n&&n.value){case"elseif":case"elif":t.else_=this.parseIf();break;case"else":this.advanceAfterBlockEnd(),t.else_=this.parseUntilBlocks("endif"),this.advanceAfterBlockEnd();break;case"endif":t.else_=null,this.advanceAfterBlockEnd();break;default:this.fail("parseIf: expected elif, else, or endif, got end of file")}return t},c.parseSet=function(){var t=this.peekToken();this.skipSymbol("set")||this.fail("parseSet: expected set",t.lineno,t.colno);for(var e,n=new o.Set(t.lineno,t.colno,[]);(e=this.parsePrimary())&&(n.targets.push(e),this.skip(i.TOKEN_COMMA)););return this.skipValue(i.TOKEN_OPERATOR,"=")?(n.value=this.parseExpression(),this.advanceAfterBlockEnd(t.value)):this.skip(i.TOKEN_BLOCK_END)?(n.body=new o.Capture(t.lineno,t.colno,this.parseUntilBlocks("endset")),n.value=null,this.advanceAfterBlockEnd()):this.fail("parseSet: expected = or block end in set tag",t.lineno,t.colno),n},c.parseSwitch=function(){var t="switch",e="endswitch",n="case",r="default",i=this.peekToken();this.skipSymbol(t)||this.skipSymbol(n)||this.skipSymbol(r)||this.fail('parseSwitch: expected "switch," "case" or "default"',i.lineno,i.colno);var s=this.parseExpression();this.advanceAfterBlockEnd(t),this.parseUntilBlocks(n,r,e);var a,c=this.peekToken(),l=[];do{this.skipSymbol(n);var u=this.parseExpression();this.advanceAfterBlockEnd(t);var f=this.parseUntilBlocks(n,r,e);l.push(new o.Case(c.line,c.col,u,f)),c=this.peekToken()}while(c&&c.value===n);switch(c.value){case r:this.advanceAfterBlockEnd(),a=this.parseUntilBlocks(e),this.advanceAfterBlockEnd();break;case e:this.advanceAfterBlockEnd();break;default:this.fail('parseSwitch: expected "case," "default" or "endswitch," got EOF.')}return new o.Switch(i.lineno,i.colno,s,l,a)},c.parseStatement=function(){var t=this.peekToken();if(t.type!==i.TOKEN_SYMBOL&&this.fail("tag name expected",t.lineno,t.colno),this.breakOnBlocks&&-1!==a.indexOf(this.breakOnBlocks,t.value))return null;switch(t.value){case"raw":return this.parseRaw();case"verbatim":return this.parseRaw("verbatim");case"if":case"ifAsync":return this.parseIf();case"for":case"asyncEach":case"asyncAll":return this.parseFor();case"block":return this.parseBlock();case"extends":return this.parseExtends();case"include":return this.parseInclude();case"set":return this.parseSet();case"macro":return this.parseMacro();case"call":return this.parseCall();case"import":return this.parseImport();case"from":return this.parseFrom();case"filter":return this.parseFilterStatement();case"switch":return this.parseSwitch();default:if(this.extensions.length)for(var e=0;e0;){var c=s[0],l=s[1],u=s[2];u===t?r+=1:u===e&&(r-=1),0===r?(i+=l,this.tokens.backN(c.length-l.length)):i+=c}return new o.Output(a.lineno,a.colno,[new o.TemplateData(a.lineno,a.colno,i)])},c.parsePostfix=function(t){for(var e,n=this.peekToken();n;){if(n.type===i.TOKEN_LEFT_PAREN)t=new o.FunCall(n.lineno,n.colno,t,this.parseSignature());else if(n.type===i.TOKEN_LEFT_BRACKET)(e=this.parseAggregate()).children.length>1&&this.fail("invalid index"),t=new o.LookupVal(n.lineno,n.colno,t,e.children[0]);else{if(n.type!==i.TOKEN_OPERATOR||"."!==n.value)break;this.nextToken();var r=this.nextToken();r.type!==i.TOKEN_SYMBOL&&this.fail("expected name as lookup value, got "+r.value,r.lineno,r.colno),e=new o.Literal(r.lineno,r.colno,r.value),t=new o.LookupVal(n.lineno,n.colno,t,e)}n=this.peekToken()}return t},c.parseExpression=function(){return this.parseInlineIf()},c.parseInlineIf=function(){var t=this.parseOr();if(this.skipSymbol("if")){var e=this.parseOr(),n=t;(t=new o.InlineIf(t.lineno,t.colno)).body=n,t.cond=e,this.skipSymbol("else")?t.else_=this.parseOr():t.else_=null}return t},c.parseOr=function(){for(var t=this.parseAnd();this.skipSymbol("or");){var e=this.parseAnd();t=new o.Or(t.lineno,t.colno,t,e)}return t},c.parseAnd=function(){for(var t=this.parseNot();this.skipSymbol("and");){var e=this.parseNot();t=new o.And(t.lineno,t.colno,t,e)}return t},c.parseNot=function(){var t=this.peekToken();return this.skipSymbol("not")?new o.Not(t.lineno,t.colno,this.parseNot()):this.parseIn()},c.parseIn=function(){for(var t=this.parseIs();;){var e=this.nextToken();if(!e)break;var n=e.type===i.TOKEN_SYMBOL&&"not"===e.value;if(n||this.pushToken(e),!this.skipSymbol("in")){n&&this.pushToken(e);break}var r=this.parseIs();t=new o.In(t.lineno,t.colno,t,r),n&&(t=new o.Not(t.lineno,t.colno,t))}return t},c.parseIs=function(){var t=this.parseCompare();if(this.skipSymbol("is")){var e=this.skipSymbol("not"),n=this.parseCompare();t=new o.Is(t.lineno,t.colno,t,n),e&&(t=new o.Not(t.lineno,t.colno,t))}return t},c.parseCompare=function(){for(var t=["==","===","!=","!==","<",">","<=",">="],e=this.parseConcat(),n=[];;){var r=this.nextToken();if(!r)break;if(-1===t.indexOf(r.value)){this.pushToken(r);break}n.push(new o.CompareOperand(r.lineno,r.colno,this.parseConcat(),r.value))}return n.length?new o.Compare(n[0].lineno,n[0].colno,e,n):e},c.parseConcat=function(){for(var t=this.parseAdd();this.skipValue(i.TOKEN_TILDE,"~");){var e=this.parseAdd();t=new o.Concat(t.lineno,t.colno,t,e)}return t},c.parseAdd=function(){for(var t=this.parseSub();this.skipValue(i.TOKEN_OPERATOR,"+");){var e=this.parseSub();t=new o.Add(t.lineno,t.colno,t,e)}return t},c.parseSub=function(){for(var t=this.parseMul();this.skipValue(i.TOKEN_OPERATOR,"-");){var e=this.parseMul();t=new o.Sub(t.lineno,t.colno,t,e)}return t},c.parseMul=function(){for(var t=this.parseDiv();this.skipValue(i.TOKEN_OPERATOR,"*");){var e=this.parseDiv();t=new o.Mul(t.lineno,t.colno,t,e)}return t},c.parseDiv=function(){for(var t=this.parseFloorDiv();this.skipValue(i.TOKEN_OPERATOR,"/");){var e=this.parseFloorDiv();t=new o.Div(t.lineno,t.colno,t,e)}return t},c.parseFloorDiv=function(){for(var t=this.parseMod();this.skipValue(i.TOKEN_OPERATOR,"//");){var e=this.parseMod();t=new o.FloorDiv(t.lineno,t.colno,t,e)}return t},c.parseMod=function(){for(var t=this.parsePow();this.skipValue(i.TOKEN_OPERATOR,"%");){var e=this.parsePow();t=new o.Mod(t.lineno,t.colno,t,e)}return t},c.parsePow=function(){for(var t=this.parseUnary();this.skipValue(i.TOKEN_OPERATOR,"**");){var e=this.parseUnary();t=new o.Pow(t.lineno,t.colno,t,e)}return t},c.parseUnary=function(t){var e,n=this.peekToken();return e=this.skipValue(i.TOKEN_OPERATOR,"-")?new o.Neg(n.lineno,n.colno,this.parseUnary(!0)):this.skipValue(i.TOKEN_OPERATOR,"+")?new o.Pos(n.lineno,n.colno,this.parseUnary(!0)):this.parsePrimary(),t||(e=this.parseFilter(e)),e},c.parsePrimary=function(t){var e,n=this.nextToken(),r=null;if(n?n.type===i.TOKEN_STRING?e=n.value:n.type===i.TOKEN_INT?e=parseInt(n.value,10):n.type===i.TOKEN_FLOAT?e=parseFloat(n.value):n.type===i.TOKEN_BOOLEAN?"true"===n.value?e=!0:"false"===n.value?e=!1:this.fail("invalid boolean: "+n.value,n.lineno,n.colno):n.type===i.TOKEN_NONE?e=null:n.type===i.TOKEN_REGEX&&(e=new RegExp(n.value.body,n.value.flags)):this.fail("expected expression, got end of file"),void 0!==e?r=new o.Literal(n.lineno,n.colno,e):n.type===i.TOKEN_SYMBOL?r=new o.Symbol(n.lineno,n.colno,n.value):(this.pushToken(n),r=this.parseAggregate()),t||(r=this.parsePostfix(r)),r)return r;throw this.error("unexpected token: "+n.value,n.lineno,n.colno)},c.parseFilterName=function(){for(var t=this.expect(i.TOKEN_SYMBOL),e=t.value;this.skipValue(i.TOKEN_OPERATOR,".");)e+="."+this.expect(i.TOKEN_SYMBOL).value;return new o.Symbol(t.lineno,t.colno,e)},c.parseFilterArgs=function(t){return this.peekToken().type===i.TOKEN_LEFT_PAREN?this.parsePostfix(t).args.children:[]},c.parseFilter=function(t){for(;this.skip(i.TOKEN_PIPE);){var e=this.parseFilterName();t=new o.Filter(e.lineno,e.colno,e,new o.NodeList(e.lineno,e.colno,[t].concat(this.parseFilterArgs(t))))}return t},c.parseFilterStatement=function(){var t=this.peekToken();this.skipSymbol("filter")||this.fail("parseFilterStatement: expected filter");var e=this.parseFilterName(),n=this.parseFilterArgs(e);this.advanceAfterBlockEnd(t.value);var r=new o.Capture(e.lineno,e.colno,this.parseUntilBlocks("endfilter"));this.advanceAfterBlockEnd();var i=new o.Filter(e.lineno,e.colno,e,new o.NodeList(e.lineno,e.colno,[r].concat(n)));return new o.Output(e.lineno,e.colno,[i])},c.parseAggregate=function(){var t,e=this.nextToken();switch(e.type){case i.TOKEN_LEFT_PAREN:t=new o.Group(e.lineno,e.colno);break;case i.TOKEN_LEFT_BRACKET:t=new o.Array(e.lineno,e.colno);break;case i.TOKEN_LEFT_CURLY:t=new o.Dict(e.lineno,e.colno);break;default:return null}for(;;){var n=this.peekToken().type;if(n===i.TOKEN_RIGHT_PAREN||n===i.TOKEN_RIGHT_BRACKET||n===i.TOKEN_RIGHT_CURLY){this.nextToken();break}if(t.children.length>0&&(this.skip(i.TOKEN_COMMA)||this.fail("parseAggregate: expected comma after expression",e.lineno,e.colno)),t instanceof o.Dict){var r=this.parsePrimary();this.skip(i.TOKEN_COLON)||this.fail("parseAggregate: expected colon after dict key",e.lineno,e.colno);var s=this.parseExpression();t.addChild(new o.Pair(r.lineno,r.colno,r,s))}else{var a=this.parseExpression();t.addChild(a)}}return t},c.parseSignature=function(t,e){var n=this.peekToken();if(!e&&n.type!==i.TOKEN_LEFT_PAREN){if(t)return null;this.fail("expected arguments",n.lineno,n.colno)}n.type===i.TOKEN_LEFT_PAREN&&(n=this.nextToken());for(var r=new o.NodeList(n.lineno,n.colno),s=new o.KeywordArgs(n.lineno,n.colno),a=!1;;){if(n=this.peekToken(),!e&&n.type===i.TOKEN_RIGHT_PAREN){this.nextToken();break}if(e&&n.type===i.TOKEN_BLOCK_END)break;if(a&&!this.skip(i.TOKEN_COMMA))this.fail("parseSignature: expected comma after expression",n.lineno,n.colno);else{var c=this.parseExpression();this.skipValue(i.TOKEN_OPERATOR,"=")?s.addChild(new o.Pair(c.lineno,c.colno,c,this.parseExpression())):r.addChild(c)}a=!0}return s.children.length&&r.addChild(s),r},c.parseUntilBlocks=function(){for(var t=this.breakOnBlocks,e=arguments.length,n=new Array(e),r=0;r=","//","**"],B=C+this.current();switch(-1!==r.indexOf(M,B)&&(this.forward(),C=B,-1!==r.indexOf(M,B+this.current())&&(C=B+this.current(),this.forward())),C){case"(":R=d;break;case")":R=m;break;case"[":R=y;break;case"]":R=v;break;case"{":R=g;break;case"}":R=b;break;case",":R=w;break;case":":R=k;break;case"~":R=E;break;case"|":R=x;break;default:R=_}return N(R,C,e,n)}if((t=this._extractUntil(i+o)).match(/^[-+]?[0-9]+$/)){if("."===this.current()){this.forward();var D=this._extract("0123456789");return N(O,t+"."+D,e,n)}return N("int",t,e,n)}if(t.match(/^(true|false)$/))return N(S,t,e,n);if("none"===t)return N(T,t,e,n);if("null"===t)return N(T,t,e,n);if(t)return N(A,t,e,n);throw new Error("Unexpected value while parsing: "+t)}var F,K=this.tags.BLOCK_START.charAt(0)+this.tags.VARIABLE_START.charAt(0)+this.tags.COMMENT_START.charAt(0)+this.tags.COMMENT_END.charAt(0);if(this.isFinished())return null;if((t=this._extractString(this.tags.BLOCK_START+"-"))||(t=this._extractString(this.tags.BLOCK_START)))return this.in_code=!0,N(l,t,e,n);if((t=this._extractString(this.tags.VARIABLE_START+"-"))||(t=this._extractString(this.tags.VARIABLE_START)))return this.in_code=!0,N(f,t,e,n);t="";var $=!1;for(this._matches(this.tags.COMMENT_START)&&($=!0,t=this._extractString(this.tags.COMMENT_START));null!==(F=this._extractUntil(K));){if(t+=F,(this._matches(this.tags.BLOCK_START)||this._matches(this.tags.VARIABLE_START)||this._matches(this.tags.COMMENT_START))&&!$){if(this.lstripBlocks&&this._matches(this.tags.BLOCK_START)&&this.colno>0&&this.colno<=t.length){var V=t.slice(-this.colno);if(/^\s+$/.test(V)&&!(t=t.slice(0,-this.colno)).length)return this.nextToken()}break}if(this._matches(this.tags.COMMENT_END)){if(!$)throw new Error("unexpected end of comment");t+=this._extractString(this.tags.COMMENT_END);break}t+=this.current(),this.forward()}if(null===F&&$)throw new Error("expected end of comment, got end of file");return N($?p:c,t,e,n)},e._parseString=function(t){this.forward();for(var e="";!this.isFinished()&&this.current()!==t;){var n=this.current();if("\\"===n){switch(this.forward(),this.current()){case"n":e+="\n";break;case"t":e+="\t";break;case"r":e+="\r";break;default:e+=this.current()}this.forward()}else e+=n,this.forward()}return this.forward(),e},e._matches=function(t){return this.index+t.length>this.len?null:this.str.slice(this.index,this.index+t.length)===t},e._extractString=function(t){return this._matches(t)?(this.forwardN(t.length),t):null},e._extractUntil=function(t){return this._extractMatching(!0,t||"")},e._extract=function(t){return this._extractMatching(!1,t)},e._extractMatching=function(t,e){if(this.isFinished())return null;var n=e.indexOf(this.current());if(t&&-1===n||!t&&-1!==n){var r=this.current();this.forward();for(var i=e.indexOf(this.current());(t&&-1===i||!t&&-1!==i)&&!this.isFinished();)r+=this.current(),this.forward(),i=e.indexOf(this.current());return r}return""},e._extractRegex=function(t){var e=this.currentStr().match(t);return e?(this.forwardN(e[0].length),e):null},e.isFinished=function(){return this.index>=this.len},e.forwardN=function(t){for(var e=0;e1024){for(var e=0,n=i.length-o;e0&&s.length>i&&!s.warned){s.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=t,c.type=e,c.count=s.length,a=c,console&&console.warn&&console.warn(a)}return t}function h(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},i=h.bind(r);return i.listener=n,r.wrapFn=i,i}function d(t,e,n){var r=t._events;if(void 0===r)return[];var i=r[e];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(t){for(var e=new Array(t.length),n=0;n0&&(s=e[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var c=i[t];if(void 0===c)return!1;if("function"==typeof c)o(c,this,e);else{var l=c.length,u=y(c,l);for(n=0;n=0;o--)if(n[o]===e||n[o].listener===e){s=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(t,e){for(;e+1=0;r--)this.removeListener(t,e[r]);return this},a.prototype.listeners=function(t){return d(this,t,!0)},a.prototype.rawListeners=function(t){return d(this,t,!1)},a.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):m.call(t,e)},a.prototype.listenerCount=m,a.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(t,e,n){"use strict";var r=n(3),i=n(0),o=0;function s(){return"hole_"+o++}function a(t,e){for(var n=null,r=0;r=e)return t;var n=e-t.length,s=r.repeat(" ",n/2-n%2),a=r.repeat(" ",n/2);return i.copySafeness(t,s+t+a)},e.default=function(t,e,n){return n?t||e:void 0!==t?t:e},e.dictsort=function(t,e,n){if(!r.isObject(t))throw new r.TemplateError("dictsort filter: val must be an object");var i,o=[];for(var s in t)o.push([s,t[s]]);if(void 0===n||"key"===n)i=0;else{if("value"!==n)throw new r.TemplateError("dictsort filter: You can only sort by either key or value");i=1}return o.sort((function(t,n){var o=t[i],s=n[i];return e||(r.isString(o)&&(o=o.toUpperCase()),r.isString(s)&&(s=s.toUpperCase())),o>s?1:o===s?0:-1})),o},e.dump=function(t,e){return JSON.stringify(t,null,e)},e.escape=function(t){return t instanceof i.SafeString?t:(t=null==t?"":t,i.markSafe(r.escape(t.toString())))},e.safe=function(t){return t instanceof i.SafeString?t:(t=null==t?"":t,i.markSafe(t.toString()))},e.first=function(t){return t[0]},e.forceescape=function(t){return t=null==t?"":t,i.markSafe(r.escape(t.toString()))},e.groupby=function(t,e){return r.groupBy(t,e,this.env.opts.throwOnUndefined)},e.indent=function(t,e,n){if(""===(t=o(t,"")))return"";e=e||4;var s=t.split("\n"),a=r.repeat(" ",e),c=s.map((function(t,e){return 0!==e||n?""+a+t:t})).join("\n");return i.copySafeness(t,c)},e.join=function(t,e,n){return e=e||"",n&&(t=r.map(t,(function(t){return t[n]}))),t.join(e)},e.last=function(t){return t[t.length-1]},e.length=function(t){var e=o(t,"");return void 0!==e?"function"==typeof Map&&e instanceof Map||"function"==typeof Set&&e instanceof Set?e.size:!r.isObject(e)||e instanceof i.SafeString?e.length:r.keys(e).length:0},e.list=c,e.lower=function(t){return(t=o(t,"")).toLowerCase()},e.nl2br=function(t){return null==t?"":i.copySafeness(t,t.replace(/\r\n|\n/g,"
\n"))},e.random=function(t){return t[Math.floor(Math.random()*t.length)]},e.reject=l(!1),e.rejectattr=function(t,e){return t.filter((function(t){return!t[e]}))},e.select=l(!0),e.selectattr=function(t,e){return t.filter((function(t){return!!t[e]}))},e.replace=function(t,e,n,r){var o=t;if(e instanceof RegExp)return t.replace(e,n);void 0===r&&(r=-1);var s="";if("number"==typeof e)e=""+e;else if("string"!=typeof e)return t;if("number"==typeof t&&(t=""+t),"string"!=typeof t&&!(t instanceof i.SafeString))return t;if(""===e)return s=n+t.split("").join(n)+n,i.copySafeness(t,s);var a=t.indexOf(e);if(0===r||-1===a)return t;for(var c=0,l=0;a>-1&&(-1===r||l=i&&u.push(n),o.push(u)}return o},e.sum=function(t,e,n){return void 0===n&&(n=0),e&&(t=r.map(t,(function(t){return t[e]}))),n+t.reduce((function(t,e){return t+e}),0)},e.sort=i.makeMacro(["value","reverse","case_sensitive","attribute"],[],(function(t,e,n,i){var o=this,s=r.map(t,(function(t){return t})),a=r.getAttrGetter(i);return s.sort((function(t,s){var c=i?a(t):t,l=i?a(s):s;if(o.env.opts.throwOnUndefined&&i&&(void 0===c||void 0===l))throw new TypeError('sort: attribute "'+i+'" resolved to undefined');return!n&&r.isString(c)&&r.isString(l)&&(c=c.toLowerCase(),l=l.toLowerCase()),cl?e?-1:1:0})),s})),e.string=function(t){return i.copySafeness(t,t)},e.striptags=function(t,e){var n,r=u((t=o(t,"")).replace(/<\/?([a-z][a-z0-9]*)\b[^>]*>|/gi,""));return n=e?r.replace(/^ +| +$/gm,"").replace(/ +/g," ").replace(/(\r\n)/g,"\n").replace(/\n\n\n+/g,"\n\n"):r.replace(/\s+/gi," "),i.copySafeness(t,n)},e.title=function(t){var e=(t=o(t,"")).split(" ").map((function(t){return a(t)}));return i.copySafeness(t,e.join(" "))},e.trim=u,e.truncate=function(t,e,n,r){var s=t;if(e=e||255,(t=o(t,"")).length<=e)return t;if(n)t=t.substring(0,e);else{var a=t.lastIndexOf(" ",e);-1===a&&(a=e),t=t.substring(0,a)}return t+=null!=r?r:"...",i.copySafeness(s,t)},e.upper=function(t){return(t=o(t,"")).toUpperCase()},e.urlencode=function(t){var e=encodeURIComponent;return r.isString(t)?e(t):(r.isArray(t)?t:r._entries(t)).map((function(t){var n=t[0],r=t[1];return e(n)+"="+e(r)})).join("&")};var f=/^(?:\(|<|<)?(.*?)(?:\.|,|\)|\n|>)?$/,h=/^[\w.!#$%&'*+\-\/=?\^`{|}~]+@[a-z\d\-]+(\.[a-z\d\-]+)+$/i,p=/^https?:\/\/.*$/,d=/^www\./,m=/\.(?:org|net|com)(?:\:|\/|$)/;e.urlize=function(t,e,n){s(e)&&(e=1/0);var r=!0===n?' rel="nofollow"':"";return t.split(/(\s+)/).filter((function(t){return t&&t.length})).map((function(t){var n=t.match(f),i=n?n[1]:t,o=i.substr(0,e);return p.test(i)?'"+o+"":d.test(i)?'"+o+"":h.test(i)?''+i+"":m.test(i)?'"+o+"":t})).join("")},e.wordcount=function(t){var e=(t=o(t,""))?t.match(/\w+/g):null;return e?e.length:null},e.float=function(t,e){var n=parseFloat(t);return s(n)?e:n};var y=i.makeMacro(["value","default","base"],[],(function(t,e,n){void 0===n&&(n=10);var r=parseInt(t,n);return s(r)?e:r}));e.int=y,e.d=e.default,e.e=e.escape},function(t,e,n){"use strict";function r(t,e){return r=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},r(t,e)}var i=function(t){var e,n;function i(e){var n;return(n=t.call(this)||this).precompiled=e||{},n}return n=t,(e=i).prototype=Object.create(n.prototype),e.prototype.constructor=e,r(e,n),i.prototype.getSource=function(t){return this.precompiled[t]?{src:{type:"code",obj:this.precompiled[t]},path:t}:null},i}(n(6));t.exports={PrecompiledLoader:i}},function(t,e,n){"use strict";var r=n(2).SafeString;e.callable=function(t){return"function"==typeof t},e.defined=function(t){return void 0!==t},e.divisibleby=function(t,e){return t%e==0},e.escaped=function(t){return t instanceof r},e.equalto=function(t,e){return t===e},e.eq=e.equalto,e.sameas=e.equalto,e.even=function(t){return t%2==0},e.falsy=function(t){return!t},e.ge=function(t,e){return t>=e},e.greaterthan=function(t,e){return t>e},e.gt=e.greaterthan,e.le=function(t,e){return t<=e},e.lessthan=function(t,e){return t0)for(var i=t;ie;o+=n)r.push(o);return r},cycler:function(){return t=Array.prototype.slice.call(arguments),e=-1,{current:null,reset:function(){e=-1,this.current=null},next:function(){return++e>=t.length&&(e=0),this.current=t[e],this.current}};var t,e},joiner:function(t){return function(t){t=t||",";var e=!0;return function(){var n=e?"":t;return e=!1,n}}(t)}}}},function(t,e,n){var r=n(4);t.exports=function(t,e){function n(t,e){if(this.name=t,this.path=t,this.defaultEngine=e.defaultEngine,this.ext=r.extname(t),!this.ext&&!this.defaultEngine)throw new Error("No default engine was specified and no extension was provided.");this.ext||(this.name+=this.ext=("."!==this.defaultEngine[0]?".":"")+this.defaultEngine)}return n.prototype.render=function(e,n){t.render(this.name,e,n)},e.set("view",n),e.set("nunjucksEnv",t),t}},function(t,e,n){"use strict";var r=n(4),i=n(4),o=n(0)._prettifyError,s=n(5),a=n(7).Environment,c=n(24);function l(t,e){return!!Array.isArray(e)&&e.some((function(e){return t.match(e)}))}function u(t,e){(e=e||{}).isString=!0;var n=e.env||new a([]),r=e.wrapper||c;if(!e.name)throw new Error('the "name" option is required when compiling a string');return r([f(t,e.name,n)],e)}function f(t,e,n){var r,i=(n=n||new a([])).asyncFilters,c=n.extensionsList;e=e.replace(/\\/g,"/");try{r=s.compile(t,i,c,e,n.opts)}catch(t){throw o(e,!1,t)}return{name:e,template:r}}t.exports={precompile:function(t,e){var n=(e=e||{}).env||new a([]),o=e.wrapper||c;if(e.isString)return u(t,e);var s=r.existsSync(t)&&r.statSync(t),h=[],p=[];if(s.isFile())h.push(f(r.readFileSync(t,"utf-8"),e.name||t,n));else if(s.isDirectory()){!function n(o){r.readdirSync(o).forEach((function(s){var a=i.join(o,s),c=a.substr(i.join(t,"/").length),u=r.statSync(a);u&&u.isDirectory()?l(c+="/",e.exclude)||n(a):l(c,e.include)&&p.push(a)}))}(t);for(var d=0;dt.length||i>0&&s>=r||i<0&&s<=r);s+=i)o.push(n.memberLookup(t,s));return o}function p(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var d={pop:function(t){if(void 0===t)return this.pop();if(t>=this.length||t<0)throw new Error("KeyError");return this.splice(t,1)},append:function(t){return this.push(t)},remove:function(t){for(var e=0;e{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var r={};(()=>{"use strict";n.r(r),n.d(r,{default:()=>Vr});var t=n(181);function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}function i(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function o(t){for(var e=1;e
Workflows are defined by a YAML file checked in to your repository and will run when triggered by an event in your repository, or they can be triggered manually, or at a defined schedule.","url":"https://docs.github.com/en/actions/using-workflows/about-workflows","childrenTypes":["trigger","job"],"isContainer":true,"available":true,"attributes":[{"name":"name","type":"String","required":true,"description":"The name of the workflow as it will appear in the \\"Actions\\" tab of the GitHub repository.","url":"https://docs.github.com/en/actions/using-workflows/about-workflows#understanding-the-workflow-file"}]},"trigger":{"type":"trigger","model":"trigger","icon":"DefaultTrigger","available":false,"parentTypes":["workflow"],"attributes":[{"name":"workflow_id","displayName":"Id of workflow","type":"Reference","containerRef":"workflow","required":true}]},"job":{"type":"job","model":"job","displayName":"Job","description":"A workflow run is made up of one or more jobs, which run in parallel by default.","url":"https://docs.github.com/en/actions/using-jobs/using-jobs-in-a-workflow","icon":"DefaultJob","available":true,"parentTypes":["workflow"],"childrenTypes":["step"],"isContainer":true,"displayType":"workflow","preventChildrenMovement":true,"childrenPerLine":10,"attributes":[{"name":"workflow_id","displayName":"Id of workflow","type":"Reference","containerRef":"workflow","required":true},{"name":"name","type":"String","description":"The name of the job as it will appear in the \\"Actions\\" tab of the GitHub repository.","url":"https://docs.github.com/en/actions/using-jobs/using-jobs-in-a-workflow#setting-a-name-for-a-job"},{"name":"runs-on","type":"String","displayName":"Type of runner","description":"The type of machine to run the job on.","url":"https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idruns-on"},{"name":"needs","displayName":"Previous job(s)","description":"Identify any jobs that must complete successfully before this job will run","url":"https://docs.github.com/en/actions/using-jobs/using-jobs-in-a-workflow#defining-prerequisite-jobs","type":"Link","linkType":"Reverse","linkRef":"job"}]},"step":{"type":"step","model":"step","icon":"DefaultStep","available":false,"parentTypes":["job"],"description":"Task of the job. Step can run commands, run setup tasks, or run an action in your repository, a public repository, or an action published in a Docker registry.","url":"https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idsteps","attributes":[{"name":"job_id","displayName":"Id of job","type":"Reference","containerRef":"job","required":true},{"name":"name","type":"String","description":"The name of the step as it will appear in the \\"Actions\\" tab of the GitHub repository.","url":"https://docs.github.com/en/actions/using-jobs/using-jobs-in-a-workflow#setting-a-name-for-a-job"},{"name":"env","type":"Object","displayName":"Environment variables","description":"Variables for steps to use in the runner environment.","url":"https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsenv"}]}}'),trigger:JSON.parse('[{"type":"trigger","icon":"PushTrigger","displayName":"Trigger - push","description":"Workflow trigger is an event that causes a workflow to run.

This event will trigger the workflow on a push event.","url":"https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#push","action":"push","attributes":[{"name":"branches","type":"Array","description":"Select branch name on push event.","url":"https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#running-your-workflow-only-when-a-push-to-specific-branches-occurs"}]},{"type":"trigger","icon":"PullRequestTrigger","displayName":"Trigger - pull request","description":"Workflow trigger is an event that causes a workflow to run.

This event will trigger the workflow on a pull request event.","action":"pull_request","attributes":[{"name":"types","type":"Array","displayName":"Activity types","description":"Run your workflow when an activity on a pull request occurs in the workflow\'s repository.","url":"https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request"}]}]'),step:JSON.parse('[{"type":"step","displayName":"Command step","icon":"CommandStep","name":"command-step","attributes":[{"name":"run","type":"String","required":true}]},{"type":"step","displayName":"Reusable step","icon":"ReusableStep","name":"reusable-step","attributes":[{"name":"uses","type":"String","required":true,"displayName":"External action","description":"Select an action to run as part of a step in your job. An action is a reusable unit of code. You can use an action defined in the same repository as the workflow, a public repository, or in a published Docker container image.","url":"https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsuses"},{"name":"with","type":"Object","displayName":"Input parameters","description":"Input parameters of the action defined by \\"uses\\" keyword.","url":"https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepswith"}]}]')};function h(t){return h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},h(t)}function p(t,e){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},p(t,e)}function d(t){return d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},d(t)}const m=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&p(t,e)}(o,t);var e,n,r,i=(n=o,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=d(n);if(r){var i=d(this).constructor;t=Reflect.construct(e,arguments,i)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===h(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function o(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{available:!1};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o),(t=i.call(this,e)).available=!!e.available,t}return e=o,Object.defineProperty(e,"prototype",{writable:!1}),e}(t.ComponentDefinition);function y(t){return y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},y(t)}function v(t,e){return v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},v(t,e)}function g(t){return g=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},g(t)}const b=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&v(t,e)}(o,t);var e,n,r,i=(n=o,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=g(n);if(r){var i=g(this).constructor;t=Reflect.construct(e,arguments,i)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===y(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function o(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{action:null};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o),(t=i.call(this,e)).action=e.action||null,t}return e=o,Object.defineProperty(e,"prototype",{writable:!1}),e}(t.ComponentDefinition);function _(t){return _="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_(t)}function w(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function k(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=new Array(e);n!!t&&"object"==typeof t&&t[$]===R,U=t=>!!t&&"object"==typeof t&&t[$]===M,q=t=>!!t&&"object"==typeof t&&t[$]===B,z=t=>!!t&&"object"==typeof t&&t[$]===D,W=t=>!!t&&"object"==typeof t&&t[$]===F,G=t=>!!t&&"object"==typeof t&&t[$]===K;function Y(t){if(t&&"object"==typeof t)switch(t[$]){case B:case K:return!0}return!1}function H(t){if(t&&"object"==typeof t)switch(t[$]){case R:case B:case F:case K:return!0}return!1}const J=t=>(W(t)||Y(t))&&!!t.anchor;class X{constructor(t){Object.defineProperty(this,$,{value:t})}clone(){const t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(t.range=this.range.slice()),t}}const Q=Symbol("break visit"),Z=Symbol("skip children"),tt=Symbol("remove node");function et(t,e){const n=ot(e);U(t)?nt(null,t.contents,n,Object.freeze([t]))===tt&&(t.contents=null):nt(null,t,n,Object.freeze([]))}function nt(t,e,n,r){const i=st(t,e,n,r);if(H(i)||z(i))return at(t,r,i),nt(t,i,n,r);if("symbol"!=typeof i)if(Y(e)){r=Object.freeze(r.concat(e));for(let t=0;t"!==t[t.length-1]&&e("Verbatim tags must end with a >"),n)}const[,n,r]=t.match(/^(.*!)([^!]*)$/);r||e(`The ${t} tag has no suffix`);const i=this.tags[n];return i?i+decodeURIComponent(r):"!"===n?t:(e(`Could not resolve tag: ${t}`),null)}tagString(t){for(const[e,n]of Object.entries(this.tags))if(t.startsWith(n))return e+t.substring(n.length).replace(/[!,[\]{}]/g,(t=>ct[t]));return"!"===t[0]?t:`!<${t}>`}toString(t){const e=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags);let r;if(t&&n.length>0&&H(t.contents)){const e={};et(t.contents,((t,n)=>{H(n)&&n.tag&&(e[n.tag]=!0)})),r=Object.keys(e)}else r=[];for(const[i,o]of n)"!!"===i&&"tag:yaml.org,2002:"===o||t&&!r.some((t=>t.startsWith(o)))||e.push(`%TAG ${i} ${o}`);return e.join("\n")}}function ut(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){const e=JSON.stringify(t);throw new Error(`Anchor must not contain whitespace or control characters: ${e}`)}return!0}function ft(t){const e=new Set;return et(t,{Value(t,n){n.anchor&&e.add(n.anchor)}}),e}function ht(t,e){for(let n=1;;++n){const r=`${t}${n}`;if(!e.has(r))return r}}lt.defaultYaml={explicit:!1,version:"1.2"},lt.defaultTags={"!!":"tag:yaml.org,2002:"};class pt extends X{constructor(t){super(R),this.source=t,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(t){let e;return et(t,{Node:(t,n)=>{if(n===this)return et.BREAK;n.anchor===this.source&&(e=n)}}),e}toJSON(t,e){if(!e)return{source:this.source};const{anchors:n,doc:r,maxAliasCount:i}=e,o=this.resolve(r);if(!o){const t=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(t)}const s=n.get(o);if(!s||void 0===s.res)throw new ReferenceError("This should not happen: Alias anchor was not resolved?");if(i>=0&&(s.count+=1,0===s.aliasCount&&(s.aliasCount=dt(r,o,n)),s.count*s.aliasCount>i))throw new ReferenceError("Excessive alias count indicates a resource exhaustion attack");return s.res}toString(t,e,n){const r=`*${this.source}`;if(t){if(ut(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){const t=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(t)}if(t.implicitKey)return`${r} `}return r}}function dt(t,e,n){if(V(e)){const r=e.resolve(t),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(Y(e)){let r=0;for(const i of e.items){const e=dt(t,i,n);e>r&&(r=e)}return r}if(z(e)){const r=dt(t,e.key,n),i=dt(t,e.value,n);return Math.max(r,i)}return 1}function mt(t,e,n){if(Array.isArray(t))return t.map(((t,e)=>mt(t,String(e),n)));if(t&&"function"==typeof t.toJSON){if(!n||!J(t))return t.toJSON(e,n);const r={aliasCount:0,count:1,res:void 0};n.anchors.set(t,r),n.onCreate=t=>{r.res=t,delete n.onCreate};const i=t.toJSON(e,n);return n.onCreate&&n.onCreate(i),i}return"bigint"!=typeof t||n?.keep?t:Number(t)}const yt=t=>!t||"function"!=typeof t&&"object"!=typeof t;class vt extends X{constructor(t){super(F),this.value=t}toJSON(t,e){return e?.keep?this.value:mt(this.value,t,e)}toString(){return String(this.value)}}vt.BLOCK_FOLDED="BLOCK_FOLDED",vt.BLOCK_LITERAL="BLOCK_LITERAL",vt.PLAIN="PLAIN",vt.QUOTE_DOUBLE="QUOTE_DOUBLE",vt.QUOTE_SINGLE="QUOTE_SINGLE";const gt="tag:yaml.org,2002:";function bt(t,e,n){if(U(t)&&(t=t.contents),H(t))return t;if(z(t)){const e=n.schema[B].createNode?.(n.schema,null,n);return e.items.push(t),e}(t instanceof String||t instanceof Number||t instanceof Boolean||"undefined"!=typeof BigInt&&t instanceof BigInt)&&(t=t.valueOf());const{aliasDuplicateObjects:r,onAnchor:i,onTagObj:o,schema:s,sourceObjects:a}=n;let c;if(r&&t&&"object"==typeof t){if(c=a.get(t),c)return c.anchor||(c.anchor=i(t)),new pt(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=gt+e.slice(2));let l=function(t,e,n){if(e){const t=n.filter((t=>t.tag===e)),r=t.find((t=>!t.format))??t[0];if(!r)throw new Error(`Tag ${e} not found`);return r}return n.find((e=>e.identify?.(t)&&!e.format))}(t,e,s.tags);if(!l){if(t&&"function"==typeof t.toJSON&&(t=t.toJSON()),!t||"object"!=typeof t){const e=new vt(t);return c&&(c.node=e),e}l=t instanceof Map?s[B]:Symbol.iterator in Object(t)?s[K]:s[B]}o&&(o(l),delete n.onTagObj);const u=l?.createNode?l.createNode(n.schema,t,n):new vt(t);return e&&(u.tag=e),c&&(c.node=u),u}function _t(t,e,n){let r=n;for(let t=e.length-1;t>=0;--t){const n=e[t];if("number"==typeof n&&Number.isInteger(n)&&n>=0){const t=[];t[n]=r,r=t}else r=new Map([[n,r]])}return bt(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}const wt=t=>null==t||"object"==typeof t&&!!t[Symbol.iterator]().next().done;class kt extends X{constructor(t,e){super(t),Object.defineProperty(this,"schema",{value:e,configurable:!0,enumerable:!1,writable:!0})}clone(t){const e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return t&&(e.schema=t),e.items=e.items.map((e=>H(e)||z(e)?e.clone(t):e)),this.range&&(e.range=this.range.slice()),e}addIn(t,e){if(wt(t))this.add(e);else{const[n,...r]=t,i=this.get(n,!0);if(Y(i))i.addIn(r,e);else{if(void 0!==i||!this.schema)throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`);this.set(n,_t(this.schema,r,e))}}}deleteIn(t){const[e,...n]=t;if(0===n.length)return this.delete(e);const r=this.get(e,!0);if(Y(r))return r.deleteIn(n);throw new Error(`Expected YAML collection at ${e}. Remaining path: ${n}`)}getIn(t,e){const[n,...r]=t,i=this.get(n,!0);return 0===r.length?!e&&W(i)?i.value:i:Y(i)?i.getIn(r,e):void 0}hasAllNullValues(t){return this.items.every((e=>{if(!z(e))return!1;const n=e.value;return null==n||t&&W(n)&&null==n.value&&!n.commentBefore&&!n.comment&&!n.tag}))}hasIn(t){const[e,...n]=t;if(0===n.length)return this.has(e);const r=this.get(e,!0);return!!Y(r)&&r.hasIn(n)}setIn(t,e){const[n,...r]=t;if(0===r.length)this.set(n,e);else{const t=this.get(n,!0);if(Y(t))t.setIn(r,e);else{if(void 0!==t||!this.schema)throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`);this.set(n,_t(this.schema,r,e))}}}}kt.maxFlowStringSingleLineLength=60;const Et=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function xt(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}const Ot=(t,e,n)=>t.endsWith("\n")?xt(n,e):n.includes("\n")?"\n"+xt(n,e):(t.endsWith(" ")?"":" ")+n,St="flow",Tt="block",At="quoted";function Lt(t,e,n="flow",{indentAtStart:r,lineWidth:i=80,minContentWidth:o=20,onFold:s,onOverflow:a}={}){if(!i||i<0)return t;const c=Math.max(1+o,1+i-e.length);if(t.length<=c)return t;const l=[],u={};let f,h,p=i-e.length;"number"==typeof r&&(r>i-Math.max(2,o)?l.push(0):p=i-r);let d=!1,m=-1,y=-1,v=-1;n===Tt&&(m=Nt(t,m),-1!==m&&(p=m+c));for(let e;e=t[m+=1];){if(n===At&&"\\"===e){switch(y=m,t[m+1]){case"x":m+=3;break;case"u":m+=5;break;case"U":m+=9;break;default:m+=1}v=m}if("\n"===e)n===Tt&&(m=Nt(t,m)),p=m+c,f=void 0;else{if(" "===e&&h&&" "!==h&&"\n"!==h&&"\t"!==h){const e=t[m+1];e&&" "!==e&&"\n"!==e&&"\t"!==e&&(f=m)}if(m>=p)if(f)l.push(f),p=f+c,f=void 0;else if(n===At){for(;" "===h||"\t"===h;)h=e,e=t[m+=1],d=!0;const n=m>v+1?m-2:y-1;if(u[n])return t;l.push(n),u[n]=!0,p=n+c,f=void 0}else d=!0}h=e}if(d&&a&&a(),0===l.length)return t;s&&s();let g=t.slice(0,l[0]);for(let r=0;r({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),jt=t=>/^(%|---|\.\.\.)/m.test(t);function Pt(t,e){const n=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return n;const{implicitKey:r}=e,i=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(jt(t)?" ":"");let s="",a=0;for(let t=0,e=n[t];e;e=n[++t])if(" "===e&&"\\"===n[t+1]&&"n"===n[t+2]&&(s+=n.slice(a,t)+"\\ ",t+=1,a=t,e="\\"),"\\"===e)switch(n[t+1]){case"u":{s+=n.slice(a,t);const e=n.substr(t+2,4);switch(e){case"0000":s+="\\0";break;case"0007":s+="\\a";break;case"000b":s+="\\v";break;case"001b":s+="\\e";break;case"0085":s+="\\N";break;case"00a0":s+="\\_";break;case"2028":s+="\\L";break;case"2029":s+="\\P";break;default:"00"===e.substr(0,2)?s+="\\x"+e.substr(2):s+=n.substr(t,6)}t+=5,a=t+1}break;case"n":if(r||'"'===n[t+2]||n.lengthr)return!0;if(n=e+1,i-n<=r)return!1}return!0}(n,c,l.length));if(!n)return u?"|\n":">\n";let f,h;for(h=n.length;h>0;--h){const t=n[h-1];if("\n"!==t&&"\t"!==t&&" "!==t)break}let p=n.substring(h);const d=p.indexOf("\n");-1===d?f="-":n===p||d!==p.length-1?(f="+",o&&o()):f="",p&&(n=n.slice(0,-p.length),"\n"===p[p.length-1]&&(p=p.slice(0,-1)),p=p.replace(/\n+(?!\n|$)/g,`$&${l}`));let m,y=!1,v=-1;for(m=0;m")+(y?l?"2":"1":"")+f;return t&&(b+=" "+a(t.replace(/ ?[\r\n]+/g," ")),i&&i()),u?`${b}\n${l}${g}${n=n.replace(/\n+/g,`$&${l}`)}${p}`:`${b}\n${l}${Lt(`${g}${n=n.replace(/\n+/g,"\n$&").replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`)}${p}`,l,Tt,Ct(r,!0))}`}function Bt(t,e,n,r){const{implicitKey:i,inFlow:o}=e,s="string"==typeof t.value?t:Object.assign({},t,{value:String(t.value)});let{type:a}=t;a!==vt.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=vt.QUOTE_DOUBLE);const c=t=>{switch(t){case vt.BLOCK_FOLDED:case vt.BLOCK_LITERAL:return i||o?Rt(s.value,e):Mt(s,e,n,r);case vt.QUOTE_DOUBLE:return Pt(s.value,e);case vt.QUOTE_SINGLE:return It(s.value,e);case vt.PLAIN:return function(t,e,n,r){const{type:i,value:o}=t,{actualString:s,implicitKey:a,indent:c,indentStep:l,inFlow:u}=e;if(a&&/[\n[\]{},]/.test(o)||u&&/[[\]{},]/.test(o))return Rt(o,e);if(!o||/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||u||!o.includes("\n")?Rt(o,e):Mt(t,e,n,r);if(!a&&!u&&i!==vt.PLAIN&&o.includes("\n"))return Mt(t,e,n,r);if(jt(o)){if(""===c)return e.forceBlockIndent=!0,Mt(t,e,n,r);if(a&&c===l)return Rt(o,e)}const f=o.replace(/\n+/g,`$&\n${c}`);if(s){const t=t=>t.default&&"tag:yaml.org,2002:str"!==t.tag&&t.test?.test(f),{compat:n,tags:r}=e.doc.schema;if(r.some(t)||n?.some(t))return Rt(o,e)}return a?f:Lt(f,c,St,Ct(e,!1))}(s,e,n,r);default:return null}};let l=c(a);if(null===l){const{defaultKeyType:t,defaultStringType:n}=e.options,r=i&&t||n;if(l=c(r),null===l)throw new Error(`Unsupported default string type ${r}`)}return l}function Dt(t,e){const n=Object.assign({blockQuote:!0,commentString:Et,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trueStr:"true",verifyAliasOrder:!0},t.schema.toStringOptions,e);let r;switch(n.collectionStyle){case"block":r=!1;break;case"flow":r=!0;break;default:r=null}return{anchors:new Set,doc:t,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:"number"==typeof n.indent?" ".repeat(n.indent):" ",inFlow:r,options:n}}function Ft(t,e,n,r){if(z(t))return t.toString(e,n,r);if(V(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let i;const o=H(t)?t:e.doc.createNode(t,{onTagObj:t=>i=t});i||(i=function(t,e){if(e.tag){const n=t.filter((t=>t.tag===e.tag));if(n.length>0)return n.find((t=>t.format===e.format))??n[0]}let n,r;if(W(e)){r=e.value;const i=t.filter((t=>t.identify?.(r)));n=i.find((t=>t.format===e.format))??i.find((t=>!t.format))}else r=e,n=t.find((t=>t.nodeClass&&r instanceof t.nodeClass));if(!n)throw new Error(`Tag not resolved for ${r?.constructor?.name??typeof r} value`);return n}(e.doc.schema.tags,o));const s=function(t,e,{anchors:n,doc:r}){if(!r.directives)return"";const i=[],o=(W(t)||Y(t))&&t.anchor;o&&ut(o)&&(n.add(o),i.push(`&${o}`));const s=t.tag?t.tag:e.default?null:e.tag;return s&&i.push(r.directives.tagString(s)),i.join(" ")}(o,i,e);s.length>0&&(e.indentAtStart=(e.indentAtStart??0)+s.length+1);const a="function"==typeof i.stringify?i.stringify(o,e,n,r):W(o)?Bt(o,e,n,r):o.toString(e,n,r);return s?W(o)||"{"===a[0]||"["===a[0]?`${s} ${a}`:`${s}\n${e.indent}${a}`:a}function Kt(t,e){"debug"!==t&&"warn"!==t||("undefined"!=typeof process&&process.emitWarning?process.emitWarning(e):console.warn(e))}function $t(t,e,{key:n,value:r}){if(t?.doc.schema.merge&&Vt(n))if(r=V(r)?r.resolve(t.doc):r,G(r))for(const n of r.items)Ut(t,e,n);else if(Array.isArray(r))for(const n of r)Ut(t,e,n);else Ut(t,e,r);else{const i=mt(n,"",t);if(e instanceof Map)e.set(i,mt(r,i,t));else if(e instanceof Set)e.add(i);else{const o=function(t,e,n){if(null===e)return"";if("object"!=typeof e)return String(e);if(H(t)&&n&&n.doc){const e=Dt(n.doc,{});e.anchors=new Set;for(const t of n.anchors.keys())e.anchors.add(t.anchor);e.inFlow=!0,e.inStringifyKey=!0;const r=t.toString(e);if(!n.mapKeyWarned){let t=JSON.stringify(r);t.length>40&&(t=t.substring(0,36)+'..."'),Kt(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${t}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return r}return JSON.stringify(e)}(n,i,t),s=mt(r,o,t);o in e?Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0}):e[o]=s}}return e}const Vt=t=>"<<"===t||W(t)&&"<<"===t.value&&(!t.type||t.type===vt.PLAIN);function Ut(t,e,n){const r=t&&V(n)?n.resolve(t.doc):n;if(!q(r))throw new Error("Merge sources must be maps or map aliases");const i=r.toJSON(null,t,Map);for(const[t,n]of i)e instanceof Map?e.has(t)||e.set(t,n):e instanceof Set?e.add(t):Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0});return e}function qt(t,e,n){const r=bt(t,void 0,n),i=bt(e,void 0,n);return new zt(r,i)}class zt{constructor(t,e=null){Object.defineProperty(this,$,{value:D}),this.key=t,this.value=e}clone(t){let{key:e,value:n}=this;return H(e)&&(e=e.clone(t)),H(n)&&(n=n.clone(t)),new zt(e,n)}toJSON(t,e){return $t(e,e?.mapAsMap?new Map:{},this)}toString(t,e,n){return t?.doc?function({key:t,value:e},n,r,i){const{allNullValues:o,doc:s,indent:a,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:f}}=n;let h=H(t)&&t.comment||null;if(f){if(h)throw new Error("With simple keys, key nodes cannot have comments");if(Y(t))throw new Error("With simple keys, collection cannot be used as a key value")}let p=!f&&(!t||h&&null==e&&!n.inFlow||Y(t)||(W(t)?t.type===vt.BLOCK_FOLDED||t.type===vt.BLOCK_LITERAL:"object"==typeof t));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(f||!o),indent:a+c});let d,m,y,v=!1,g=!1,b=Ft(t,n,(()=>v=!0),(()=>g=!0));if(!p&&!n.inFlow&&b.length>1024){if(f)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(n.inFlow){if(o||null==e)return v&&r&&r(),""===b?"?":p?`? ${b}`:b}else if(o&&!f||null==e&&p)return b=`? ${b}`,h&&!v?b+=Ot(b,n.indent,l(h)):g&&i&&i(),b;v&&(h=null),p?(h&&(b+=Ot(b,n.indent,l(h))),b=`? ${b}\n${a}:`):(b=`${b}:`,h&&(b+=Ot(b,n.indent,l(h)))),H(e)?(d=!!e.spaceBefore,m=e.commentBefore,y=e.comment):(d=!1,m=null,y=null,e&&"object"==typeof e&&(e=s.createNode(e))),n.implicitKey=!1,p||h||!W(e)||(n.indentAtStart=b.length+1),g=!1,u||!(c.length>=2)||n.inFlow||p||!G(e)||e.flow||e.tag||e.anchor||(n.indent=n.indent.substring(2));let _=!1;const w=Ft(e,n,(()=>_=!0),(()=>g=!0));let k=" ";if(h||d||m)k=d?"\n":"",m&&(k+=`\n${xt(l(m),n.indent)}`),""!==w||n.inFlow?k+=`\n${n.indent}`:"\n"===k&&(k="\n\n");else if(!p&&Y(e)){const t=w[0],r=w.indexOf("\n"),i=-1!==r,o=n.inFlow??e.flow??0===e.items.length;if(i||!o){let e=!1;if(i&&("&"===t||"!"===t)){let n=w.indexOf(" ");"&"===t&&-1!==n&&ns=null),(()=>f=!0));s&&(a+=Ot(a,o,l(s))),f&&s&&(f=!1),h.push(r+a)}let p;if(0===h.length)p=i.start+i.end;else{p=h[0];for(let t=1;to=null));th||s.includes("\n"))&&(f=!0),p.push(s),h=p.length}let d;const{start:m,end:y}=r;if(0===p.length)d=m+y;else if(f||(f=p.reduce(((t,e)=>t+e.length+2),2)>kt.maxFlowStringSingleLineLength),f){d=m;for(const t of p)d+=t?`\n${a}${s}${t}`:"\n";d+=`\n${s}${y}`}else d=`${m}${c}${p.join(" ")}${c}${y}`;return t&&(d+=Ot(d,s,l(t)),o&&o()),d}function Ht({indent:t,options:{commentString:e}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,"")),r){const i=xt(e(r),t);n.push(i.trimStart())}}function Jt(t,e){const n=W(e)?e.value:e;for(const r of t)if(z(r)){if(r.key===e||r.key===n)return r;if(W(r.key)&&r.key.value===n)return r}}class Xt extends kt{static get tagName(){return"tag:yaml.org,2002:map"}constructor(t){super(B,t),this.items=[]}add(t,e){let n;n=z(t)?t:t&&"object"==typeof t&&"key"in t?new zt(t.key,t.value):new zt(t,t?.value);const r=Jt(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!e)throw new Error(`Key ${n.key} already set`);W(r.value)&&yt(n.value)?r.value.value=n.value:r.value=n.value}else if(i){const t=this.items.findIndex((t=>i(n,t)<0));-1===t?this.items.push(n):this.items.splice(t,0,n)}else this.items.push(n)}delete(t){const e=Jt(this.items,t);return!!e&&this.items.splice(this.items.indexOf(e),1).length>0}get(t,e){const n=Jt(this.items,t),r=n?.value;return(!e&&W(r)?r.value:r)??void 0}has(t){return!!Jt(this.items,t)}set(t,e){this.add(new zt(t,e),!0)}toJSON(t,e,n){const r=n?new n:e?.mapAsMap?new Map:{};e?.onCreate&&e.onCreate(r);for(const t of this.items)$t(e,r,t);return r}toString(t,e,n){if(!t)return JSON.stringify(this);for(const t of this.items)if(!z(t))throw new Error(`Map items must all be pairs; found ${JSON.stringify(t)} instead`);return!t.allNullValues&&this.hasAllNullValues(!1)&&(t=Object.assign({},t,{allNullValues:!0})),Wt(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:n,onComment:e})}}const Qt={collection:"map",createNode:function(t,e,n){const{keepUndefined:r,replacer:i}=n,o=new Xt(t),s=(t,s)=>{if("function"==typeof i)s=i.call(e,t,s);else if(Array.isArray(i)&&!i.includes(t))return;(void 0!==s||r)&&o.items.push(qt(t,s,n))};if(e instanceof Map)for(const[t,n]of e)s(t,n);else if(e&&"object"==typeof e)for(const t of Object.keys(e))s(t,e[t]);return"function"==typeof t.sortMapEntries&&o.items.sort(t.sortMapEntries),o},default:!0,nodeClass:Xt,tag:"tag:yaml.org,2002:map",resolve:(t,e)=>(q(t)||e("Expected a mapping for this tag"),t)};class Zt extends kt{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(K,t),this.items=[]}add(t){this.items.push(t)}delete(t){const e=te(t);return"number"==typeof e&&this.items.splice(e,1).length>0}get(t,e){const n=te(t);if("number"!=typeof n)return;const r=this.items[n];return!e&&W(r)?r.value:r}has(t){const e=te(t);return"number"==typeof e&&e=0?e:null}const ee={collection:"seq",createNode:function(t,e,n){const{replacer:r}=n,i=new Zt(t);if(e&&Symbol.iterator in Object(e)){let t=0;for(let o of e){if("function"==typeof r){const n=e instanceof Set?o:String(t++);o=r.call(e,n,o)}i.items.push(bt(o,void 0,n))}}return i},default:!0,nodeClass:Zt,tag:"tag:yaml.org,2002:seq",resolve:(t,e)=>(G(t)||e("Expected a sequence for this tag"),t)},ne={identify:t=>"string"==typeof t,default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:(t,e,n,r)=>Bt(t,e=Object.assign({actualString:!0},e),n,r)},re={identify:t=>null==t,createNode:()=>new vt(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new vt(null),stringify:({source:t},e)=>"string"==typeof t&&re.test.test(t)?t:e.options.nullStr},ie={identify:t=>"boolean"==typeof t,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new vt("t"===t[0]||"T"===t[0]),stringify:({source:t,value:e},n)=>t&&ie.test.test(t)&&e===("t"===t[0]||"T"===t[0])?t:e?n.options.trueStr:n.options.falseStr};function oe({format:t,minFractionDigits:e,tag:n,value:r}){if("bigint"==typeof r)return String(r);const i="number"==typeof r?r:Number(r);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let o=JSON.stringify(r);if(!t&&e&&(!n||"tag:yaml.org,2002:float"===n)&&/^\d/.test(o)){let t=o.indexOf(".");t<0&&(t=o.length,o+=".");let n=e-(o.length-t-1);for(;n-- >0;)o+="0"}return o}const se={identify:t=>"number"==typeof t,default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF|nan|NaN|NAN))$/,resolve:t=>"nan"===t.slice(-3).toLowerCase()?NaN:"-"===t[0]?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:oe},ae={identify:t=>"number"==typeof t,default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t),stringify(t){const e=Number(t.value);return isFinite(e)?e.toExponential():oe(t)}},ce={identify:t=>"number"==typeof t,default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(t){const e=new vt(parseFloat(t)),n=t.indexOf(".");return-1!==n&&"0"===t[t.length-1]&&(e.minFractionDigits=t.length-n-1),e},stringify:oe},le=t=>"bigint"==typeof t||Number.isInteger(t),ue=(t,e,n,{intAsBigInt:r})=>r?BigInt(t):parseInt(t.substring(e),n);function fe(t,e,n){const{value:r}=t;return le(r)&&r>=0?n+r.toString(e):oe(t)}const he={identify:t=>le(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,n)=>ue(t,2,8,n),stringify:t=>fe(t,8,"0o")},pe={identify:le,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,n)=>ue(t,0,10,n),stringify:oe},de={identify:t=>le(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,n)=>ue(t,2,16,n),stringify:t=>fe(t,16,"0x")},me=[Qt,ee,ne,re,ie,he,pe,de,se,ae,ce];function ye(t){return"bigint"==typeof t||Number.isInteger(t)}const ve=({value:t})=>JSON.stringify(t),ge=[Qt,ee].concat([{identify:t=>"string"==typeof t,default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:ve},{identify:t=>null==t,createNode:()=>new vt(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:ve},{identify:t=>"boolean"==typeof t,default:!0,tag:"tag:yaml.org,2002:bool",test:/^true|false$/,resolve:t=>"true"===t,stringify:ve},{identify:ye,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:n})=>n?BigInt(t):parseInt(t,10),stringify:({value:t})=>ye(t)?t.toString():JSON.stringify(t)},{identify:t=>"number"==typeof t,default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:t=>parseFloat(t),stringify:ve}],{default:!0,tag:"",test:/^/,resolve:(t,e)=>(e(`Unresolved plain scalar ${JSON.stringify(t)}`),t)}),be={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if("function"==typeof Buffer)return Buffer.from(t,"base64");if("function"==typeof atob){const e=atob(t.replace(/[\n\r]/g,"")),n=new Uint8Array(e.length);for(let t=0;t1&&e("Each pair must have its own sequence indicator");const t=r.items[0]||new zt(new vt(null));if(r.commentBefore&&(t.key.commentBefore=t.key.commentBefore?`${r.commentBefore}\n${t.key.commentBefore}`:r.commentBefore),r.comment){const e=t.value??t.key;e.comment=e.comment?`${r.comment}\n${e.comment}`:r.comment}r=t}t.items[n]=z(r)?r:new zt(r)}}else e("Expected a sequence for this tag");return t}function we(t,e,n){const{replacer:r}=n,i=new Zt(t);i.tag="tag:yaml.org,2002:pairs";let o=0;if(e&&Symbol.iterator in Object(e))for(let t of e){let s,a;if("function"==typeof r&&(t=r.call(e,String(o++),t)),Array.isArray(t)){if(2!==t.length)throw new TypeError(`Expected [key, value] tuple: ${t}`);s=t[0],a=t[1]}else if(t&&t instanceof Object){const e=Object.keys(t);if(1!==e.length)throw new TypeError(`Expected { key: value } tuple: ${t}`);s=e[0],a=t[s]}else s=t;i.items.push(qt(s,a,n))}return i}const ke={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:_e,createNode:we};class Ee extends Zt{constructor(){super(),this.add=Xt.prototype.add.bind(this),this.delete=Xt.prototype.delete.bind(this),this.get=Xt.prototype.get.bind(this),this.has=Xt.prototype.has.bind(this),this.set=Xt.prototype.set.bind(this),this.tag=Ee.tag}toJSON(t,e){if(!e)return super.toJSON(t);const n=new Map;e?.onCreate&&e.onCreate(n);for(const t of this.items){let r,i;if(z(t)?(r=mt(t.key,"",e),i=mt(t.value,r,e)):r=mt(t,"",e),n.has(r))throw new Error("Ordered maps must not include duplicate keys");n.set(r,i)}return n}}Ee.tag="tag:yaml.org,2002:omap";const xe={collection:"seq",identify:t=>t instanceof Map,nodeClass:Ee,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){const n=_e(t,e),r=[];for(const{key:t}of n.items)W(t)&&(r.includes(t.value)?e(`Ordered maps must not include duplicate keys: ${t.value}`):r.push(t.value));return Object.assign(new Ee,n)},createNode(t,e,n){const r=we(t,e,n),i=new Ee;return i.items=r.items,i}};function Oe({value:t,source:e},n){return e&&(t?Se:Te).test.test(e)?e:t?n.options.trueStr:n.options.falseStr}const Se={identify:t=>!0===t,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new vt(!0),stringify:Oe},Te={identify:t=>!1===t,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/i,resolve:()=>new vt(!1),stringify:Oe},Ae={identify:t=>"number"==typeof t,default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?\.(?:inf|Inf|INF|nan|NaN|NAN)$/,resolve:t=>"nan"===t.slice(-3).toLowerCase()?NaN:"-"===t[0]?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:oe},Le={identify:t=>"number"==typeof t,default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){const e=Number(t.value);return isFinite(e)?e.toExponential():oe(t)}},Ne={identify:t=>"number"==typeof t,default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){const e=new vt(parseFloat(t.replace(/_/g,""))),n=t.indexOf(".");if(-1!==n){const r=t.substring(n+1).replace(/_/g,"");"0"===r[r.length-1]&&(e.minFractionDigits=r.length)}return e},stringify:oe},Ce=t=>"bigint"==typeof t||Number.isInteger(t);function je(t,e,n,{intAsBigInt:r}){const i=t[0];if("-"!==i&&"+"!==i||(e+=1),t=t.substring(e).replace(/_/g,""),r){switch(n){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`}const e=BigInt(t);return"-"===i?BigInt(-1)*e:e}const o=parseInt(t,n);return"-"===i?-1*o:o}function Pe(t,e,n){const{value:r}=t;if(Ce(r)){const t=r.toString(e);return r<0?"-"+n+t.substr(1):n+t}return oe(t)}const Ie={identify:Ce,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,n)=>je(t,2,2,n),stringify:t=>Pe(t,2,"0b")},Re={identify:Ce,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,n)=>je(t,1,8,n),stringify:t=>Pe(t,8,"0")},Me={identify:Ce,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,n)=>je(t,0,10,n),stringify:oe},Be={identify:Ce,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,n)=>je(t,2,16,n),stringify:t=>Pe(t,16,"0x")};class De extends Xt{constructor(t){super(t),this.tag=De.tag}add(t){let e;e=z(t)?t:t&&"object"==typeof t&&"key"in t&&"value"in t&&null===t.value?new zt(t.key,null):new zt(t,null),Jt(this.items,e.key)||this.items.push(e)}get(t,e){const n=Jt(this.items,t);return!e&&z(n)?W(n.key)?n.key.value:n.key:n}set(t,e){if("boolean"!=typeof e)throw new Error("Expected boolean value for set(key, value) in a YAML set, not "+typeof e);const n=Jt(this.items,t);n&&!e?this.items.splice(this.items.indexOf(n),1):!n&&e&&this.items.push(new zt(t))}toJSON(t,e){return super.toJSON(t,e,Set)}toString(t,e,n){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),e,n);throw new Error("Set items must all have null values")}}De.tag="tag:yaml.org,2002:set";const Fe={collection:"map",identify:t=>t instanceof Set,nodeClass:De,default:!1,tag:"tag:yaml.org,2002:set",resolve(t,e){if(q(t)){if(t.hasAllNullValues(!0))return Object.assign(new De,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t},createNode(t,e,n){const{replacer:r}=n,i=new De(t);if(e&&Symbol.iterator in Object(e))for(let t of e)"function"==typeof r&&(t=r.call(e,t,t)),i.items.push(qt(t,null,n));return i}};function Ke(t,e){const n=t[0],r="-"===n||"+"===n?t.substring(1):t,i=t=>e?BigInt(t):Number(t),o=r.replace(/_/g,"").split(":").reduce(((t,e)=>t*i(60)+i(e)),i(0));return"-"===n?i(-1)*o:o}function $e(t){let{value:e}=t,n=t=>t;if("bigint"==typeof e)n=t=>BigInt(t);else if(isNaN(e)||!isFinite(e))return oe(t);let r="";e<0&&(r="-",e*=n(-1));const i=n(60),o=[e%i];return e<60?o.unshift(0):(e=(e-o[0])/i,o.unshift(e%i),e>=60&&(e=(e-o[0])/i,o.unshift(e))),r+o.map((t=>t<10?"0"+String(t):String(t))).join(":").replace(/000000\d*$/,"")}const Ve={identify:t=>"bigint"==typeof t||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:n})=>Ke(t,n),stringify:$e},Ue={identify:t=>"number"==typeof t,default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>Ke(t,!1),stringify:$e},qe={identify:t=>t instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(t){const e=t.match(qe.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");const[,n,r,i,o,s,a]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0;let l=Date.UTC(n,r-1,i,o||0,s||0,a||0,c);const u=e[8];if(u&&"Z"!==u){let t=Ke(u,!1);Math.abs(t)<30&&(t*=60),l-=6e4*t}return new Date(l)},stringify:({value:t})=>t.toISOString().replace(/((T00:00)?:00)?\.000Z$/,"")},ze=[Qt,ee,ne,re,Se,Te,Ie,Re,Me,Be,Ae,Le,Ne,be,xe,ke,Fe,Ve,Ue,qe],We=new Map([["core",me],["failsafe",[Qt,ee,ne]],["json",ge],["yaml11",ze],["yaml-1.1",ze]]),Ge={binary:be,bool:ie,float:ce,floatExp:ae,floatNaN:se,floatTime:Ue,int:pe,intHex:de,intOct:he,intTime:Ve,map:Qt,null:re,omap:xe,pairs:ke,seq:ee,set:Fe,timestamp:qe},Ye={"tag:yaml.org,2002:binary":be,"tag:yaml.org,2002:omap":xe,"tag:yaml.org,2002:pairs":ke,"tag:yaml.org,2002:set":Fe,"tag:yaml.org,2002:timestamp":qe};function He(t,e){let n=We.get(e);if(!n){if(!Array.isArray(t)){const t=Array.from(We.keys()).filter((t=>"yaml11"!==t)).map((t=>JSON.stringify(t))).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${t} or define customTags array`)}n=[]}if(Array.isArray(t))for(const e of t)n=n.concat(e);else"function"==typeof t&&(n=t(n.slice()));return n.map((t=>{if("string"!=typeof t)return t;const e=Ge[t];if(e)return e;const n=Object.keys(Ge).map((t=>JSON.stringify(t))).join(", ");throw new Error(`Unknown custom tag "${t}"; use one of ${n}`)}))}const Je=(t,e)=>t.keye.key?1:0;class Xe{constructor({compat:t,customTags:e,merge:n,resolveKnownTags:r,schema:i,sortMapEntries:o,toStringDefaults:s}){this.compat=Array.isArray(t)?He(t,"compat"):t?He(null,t):null,this.merge=!!n,this.name="string"==typeof i&&i||"core",this.knownTags=r?Ye:{},this.tags=He(e,this.name),this.toStringOptions=s??null,Object.defineProperty(this,B,{value:Qt}),Object.defineProperty(this,F,{value:ne}),Object.defineProperty(this,K,{value:ee}),this.sortMapEntries="function"==typeof o?o:!0===o?Je:null}clone(){const t=Object.create(Xe.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}}function Qe(t,e,n,r){if(r&&"object"==typeof r)if(Array.isArray(r))for(let e=0,n=r.length;e"number"==typeof t||t instanceof String||t instanceof Number,n=e.filter(t).map(String);n.length>0&&(e=e.concat(n)),r=e}else void 0===n&&e&&(n=e,e=void 0);const{aliasDuplicateObjects:i,anchorPrefix:o,flow:s,keepUndefined:a,onTagObj:c,tag:l}=n??{},{onAnchor:u,setAnchors:f,sourceObjects:h}=function(t,e){const n=[],r=new Map;let i=null;return{onAnchor:r=>{n.push(r),i||(i=ft(t));const o=ht(e,i);return i.add(o),o},setAnchors:()=>{for(const t of n){const e=r.get(t);if("object"!=typeof e||!e.anchor||!W(e.node)&&!Y(e.node)){const e=new Error("Failed to resolve repeated object (this should not happen)");throw e.source=t,e}e.node.anchor=e.anchor}},sourceObjects:r}}(this,o||"a"),p=bt(t,l,{aliasDuplicateObjects:i??!0,keepUndefined:a??!1,onAnchor:u,onTagObj:c,replacer:r,schema:this.schema,sourceObjects:h});return s&&Y(p)&&(p.flow=!0),f(),p}createPair(t,e,n={}){const r=this.createNode(t,null,n),i=this.createNode(e,null,n);return new zt(r,i)}delete(t){return!!tn(this.contents)&&this.contents.delete(t)}deleteIn(t){return wt(t)?null!=this.contents&&(this.contents=null,!0):!!tn(this.contents)&&this.contents.deleteIn(t)}get(t,e){return Y(this.contents)?this.contents.get(t,e):void 0}getIn(t,e){return wt(t)?!e&&W(this.contents)?this.contents.value:this.contents:Y(this.contents)?this.contents.getIn(t,e):void 0}has(t){return!!Y(this.contents)&&this.contents.has(t)}hasIn(t){return wt(t)?void 0!==this.contents:!!Y(this.contents)&&this.contents.hasIn(t)}set(t,e){null==this.contents?this.contents=_t(this.schema,[t],e):tn(this.contents)&&this.contents.set(t,e)}setIn(t,e){wt(t)?this.contents=e:null==this.contents?this.contents=_t(this.schema,Array.from(t),e):tn(this.contents)&&this.contents.setIn(t,e)}setSchema(t,e={}){let n;switch("number"==typeof t&&(t=String(t)),t){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new lt({version:"1.1"}),n={merge:!0,resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=t:this.directives=new lt({version:t}),n={merge:!1,resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{const e=JSON.stringify(t);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${e}`)}}if(e.schema instanceof Object)this.schema=e.schema;else{if(!n)throw new Error("With a null YAML version, the { schema: Schema } option is required");this.schema=new Xe(Object.assign(n,e))}}toJS({json:t,jsonArg:e,mapAsMap:n,maxAliasCount:r,onAnchor:i,reviver:o}={}){const s={anchors:new Map,doc:this,keep:!t,mapAsMap:!0===n,mapKeyWarned:!1,maxAliasCount:"number"==typeof r?r:100,stringify:Ft},a=mt(this.contents,e??"",s);if("function"==typeof i)for(const{count:t,res:e}of s.anchors.values())i(e,t);return"function"==typeof o?Qe(o,{"":a},"",a):a}toJSON(t,e){return this.toJS({json:!0,jsonArg:t,mapAsMap:!1,onAnchor:e})}toString(t={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in t&&(!Number.isInteger(t.indent)||Number(t.indent)<=0)){const e=JSON.stringify(t.indent);throw new Error(`"indent" option must be a positive integer, not ${e}`)}return function(t,e){const n=[];let r=!0===e.directives;if(!1!==e.directives&&t.directives){const e=t.directives.toString(t);e?(n.push(e),r=!0):t.directives.docStart&&(r=!0)}r&&n.push("---");const i=Dt(t,e),{commentString:o}=i.options;if(t.commentBefore){1!==n.length&&n.unshift("");const e=o(t.commentBefore);n.unshift(xt(e,""))}let s=!1,a=null;if(t.contents){if(H(t.contents)){if(t.contents.spaceBefore&&r&&n.push(""),t.contents.commentBefore){const e=o(t.contents.commentBefore);n.push(xt(e,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}const e=a?void 0:()=>s=!0;let c=Ft(t.contents,i,(()=>a=null),e);a&&(c+=Ot(c,"",o(a))),"|"!==c[0]&&">"!==c[0]||"---"!==n[n.length-1]?n.push(c):n[n.length-1]=`--- ${c}`}else n.push(Ft(t.contents,i));if(t.directives?.docEnd)if(t.comment){const e=o(t.comment);e.includes("\n")?(n.push("..."),n.push(xt(e,""))):n.push(`... ${e}`)}else n.push("...");else{let e=t.comment;e&&s&&(e=e.replace(/^\n+/,"")),e&&(s&&!a||""===n[n.length-1]||n.push(""),n.push(xt(o(e),"")))}return n.join("\n")+"\n"}(this,t)}}function tn(t){if(Y(t))return!0;throw new Error("Expected a YAML collection as document contents")}class en extends Error{constructor(t,e,n,r){super(),this.name=t,this.code=n,this.message=r,this.pos=e}}class nn extends en{constructor(t,e,n){super("YAMLParseError",t,e,n)}}class rn extends en{constructor(t,e,n){super("YAMLWarning",t,e,n)}}const on=(t,e)=>n=>{if(-1===n.pos[0])return;n.linePos=n.pos.map((t=>e.linePos(t)));const{line:r,col:i}=n.linePos[0];n.message+=` at line ${r}, column ${i}`;let o=i-1,s=t.substring(e.lineStarts[r-1],e.lineStarts[r]).replace(/[\n\r]+$/,"");if(o>=60&&s.length>80){const t=Math.min(o-39,s.length-79);s="…"+s.substring(t),o-=t-1}if(s.length>80&&(s=s.substring(0,79)+"…"),r>1&&/^ *$/.test(s.substring(0,o))){let n=t.substring(e.lineStarts[r-2],e.lineStarts[r-1]);n.length>80&&(n=n.substring(0,79)+"…\n"),s=n+s}if(/[^ ]/.test(s)){let t=1;const e=n.linePos[1];e&&e.line===r&&e.col>i&&(t=Math.max(1,Math.min(e.col-i,80-o)));const a=" ".repeat(o)+"^".repeat(t);n.message+=`:\n\n${s}\n${a}\n`}};function sn(t,{flow:e,indicator:n,next:r,offset:i,onError:o,startOnNewline:s}){let a=!1,c=s,l=s,u="",f="",h=!1,p=!1,d=!1,m=null,y=null,v=null,g=null,b=null;for(const r of t)switch(d&&("space"!==r.type&&"newline"!==r.type&&"comma"!==r.type&&o(r.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),d=!1),r.type){case"space":!e&&c&&"doc-start"!==n&&"\t"===r.source[0]&&o(r,"TAB_AS_INDENT","Tabs are not allowed as indentation"),l=!0;break;case"comment":{l||o(r,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const t=r.source.substring(1)||" ";u?u+=f+t:u=t,f="",c=!1;break}case"newline":c?u?u+=r.source:a=!0:f+=r.source,c=!0,h=!0,(m||y)&&(p=!0),l=!0;break;case"anchor":m&&o(r,"MULTIPLE_ANCHORS","A node can have at most one anchor"),r.source.endsWith(":")&&o(r.offset+r.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),m=r,null===b&&(b=r.offset),c=!1,l=!1,d=!0;break;case"tag":y&&o(r,"MULTIPLE_TAGS","A node can have at most one tag"),y=r,null===b&&(b=r.offset),c=!1,l=!1,d=!0;break;case n:(m||y)&&o(r,"BAD_PROP_ORDER",`Anchors and tags must be after the ${r.source} indicator`),g&&o(r,"UNEXPECTED_TOKEN",`Unexpected ${r.source} in ${e??"collection"}`),g=r,c=!1,l=!1;break;case"comma":if(e){v&&o(r,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),v=r,c=!1,l=!1;break}default:o(r,"UNEXPECTED_TOKEN",`Unexpected ${r.type} token`),c=!1,l=!1}const _=t[t.length-1],w=_?_.offset+_.source.length:i;return d&&r&&"space"!==r.type&&"newline"!==r.type&&"comma"!==r.type&&("scalar"!==r.type||""!==r.source)&&o(r.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),{comma:v,found:g,spaceBefore:a,comment:u,hasNewline:h,hasNewlineAfterProp:p,anchor:m,tag:y,end:w,start:b??w}}function an(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes("\n"))return!0;if(t.end)for(const e of t.end)if("newline"===e.type)return!0;return!1;case"flow-collection":for(const e of t.items){for(const t of e.start)if("newline"===t.type)return!0;if(e.sep)for(const t of e.sep)if("newline"===t.type)return!0;if(an(e.key)||an(e.value))return!0}return!1;default:return!0}}function cn(t,e,n){if("flow-collection"===e?.type){const r=e.end[0];r.indent!==t||"]"!==r.source&&"}"!==r.source||!an(e)||n(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function ln(t,e,n){const{uniqueKeys:r}=t.options;if(!1===r)return!1;const i="function"==typeof r?r:(e,n)=>e===n||W(e)&&W(n)&&e.value===n.value&&!("<<"===e.value&&t.schema.merge);return e.some((t=>i(t.key,n)))}const un="All mapping items must start at the same column";function fn(t,e,n,r){let i="";if(t){let o=!1,s="";for(const a of t){const{source:t,type:c}=a;switch(c){case"space":o=!0;break;case"comment":{n&&!o&&r(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const e=t.substring(1)||" ";i?i+=s+e:i=e,s="";break}case"newline":i&&(s+=t),o=!0;break;default:r(a,"UNEXPECTED_TOKEN",`Unexpected ${c} at node end`)}e+=t.length}}return{comment:i,offset:e}}const hn="Block collections are not allowed within flow collections",pn=t=>t&&("block-map"===t.type||"block-seq"===t.type);function dn(t){let e,n;try{e=new RegExp("(.*?)(?"===i.mode?vt.BLOCK_FOLDED:vt.BLOCK_LITERAL,s=t.source?function(t){const e=t.split(/\n( *)/),n=e[0],r=n.match(/^( *)/),i=[r?.[1]?[r[1],n.slice(r[1].length)]:["",n]];for(let t=1;t=0;--t){const e=s[t][1];if(""!==e&&"\r"!==e)break;a=t}if(0===a){const e="+"===i.chomp&&s.length>0?"\n".repeat(Math.max(1,s.length-1)):"";let n=r+i.length;return t.source&&(n+=t.source.length),{value:e,type:o,comment:i.comment,range:[r,n,n]}}let c=t.indent+i.indent,l=t.offset+i.length,u=0;for(let t=0;tc&&(c=e.length),l+=e.length+r.length+1}for(let t=s.length-1;t>=a;--t)s[t][0].length>c&&(a=t+1);let f="",h="",p=!1;for(let t=0;tc||"\t"===r[0]?(" "===h?h="\n":p||"\n"!==h||(h="\n\n"),f+=h+e.slice(c)+r,h="\n",p=!0):""===r?"\n"===h?f+="\n":h="\n":(f+=h+r,h=" ",p=!1)}switch(i.chomp){case"-":break;case"+":for(let t=a;tn(r+t,e,i);switch(i){case"scalar":a=vt.PLAIN,c=function(t,e){let n="";switch(t[0]){case"\t":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":n=`block scalar indicator ${t[0]}`;break;case"@":case"`":n=`reserved character ${t[0]}`}return n&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),dn(t)}(o,l);break;case"single-quoted-scalar":a=vt.QUOTE_SINGLE,c=function(t,e){return"'"===t[t.length-1]&&1!==t.length||e(t.length,"MISSING_CHAR","Missing closing 'quote"),dn(t.slice(1,-1)).replace(/''/g,"'")}(o,l);break;case"double-quoted-scalar":a=vt.QUOTE_DOUBLE,c=function(t,e){let n="";for(let r=1;re?t.slice(e,r+1):i)}else n+=i}return'"'===t[t.length-1]&&1!==t.length||e(t.length,"MISSING_CHAR",'Missing closing "quote'),n}(o,l);break;default:return n(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[r,r+o.length,r+o.length]}}const u=r+o.length,f=fn(s,u,e,n);return{value:c,type:a,comment:f.comment,range:[r,u,f.offset]}}(e,t.options.strict,r),c=n?t.directives.tagName(n.source,(t=>r(n,"TAG_RESOLVE_FAILED",t))):null,l=n&&c?function(t,e,n,r,i){if("!"===n)return t[F];const o=[];for(const e of t.tags)if(!e.collection&&e.tag===n){if(!e.default||!e.test)return e;o.push(e)}for(const t of o)if(t.test?.test(e))return t;const s=t.knownTags[n];return s&&!s.collection?(t.tags.push(Object.assign({},s,{default:!1,test:void 0})),s):(i(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,"tag:yaml.org,2002:str"!==n),t[F])}(t.schema,i,c,n,r):"scalar"===e.type?function({directives:t,schema:e},n,r,i){const o=e.tags.find((t=>t.default&&t.test?.test(n)))||e[F];if(e.compat){const s=e.compat.find((t=>t.default&&t.test?.test(n)))??e[F];o.tag!==s.tag&&i(r,"TAG_RESOLVE_FAILED",`Value may be parsed as either ${t.tagString(o.tag)} or ${t.tagString(s.tag)}`,!0)}return o}(t,i,e,r):t.schema[F];let u;try{const o=l.resolve(i,(t=>r(n??e,"TAG_RESOLVE_FAILED",t)),t.options);u=W(o)?o:new vt(o)}catch(t){const o=t instanceof Error?t.message:String(t);r(n??e,"TAG_RESOLVE_FAILED",o),u=new vt(i)}return u.range=a,u.source=i,o&&(u.type=o),c&&(u.tag=c),l.format&&(u.format=l.format),s&&(u.comment=s),u}function bn(t,e,n){if(e){null===n&&(n=e.length);for(let r=n-1;r>=0;--r){let n=e[r];switch(n.type){case"space":case"comment":case"newline":t-=n.source.length;continue}for(n=e[++r];"space"===n?.type;)t+=n.source.length,n=e[++r];break}}return t}const _n={composeNode:wn,composeEmptyNode:kn};function wn(t,e,n,r){const{spaceBefore:i,comment:o,anchor:s,tag:a}=n;let c,l=!0;switch(e.type){case"alias":c=function({options:t},{offset:e,source:n,end:r},i){const o=new pt(n.substring(1));""===o.source&&i(e,"BAD_ALIAS","Alias cannot be an empty string"),o.source.endsWith(":")&&i(e+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);const s=e+n.length,a=fn(r,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}(t,e,r),(s||a)&&r(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":c=gn(t,e,a,r),s&&(c.anchor=s.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":c=function(t,e,n,r,i){let o;switch(n.type){case"block-map":o=function({composeNode:t,composeEmptyNode:e},n,r,i){const o=new Xt(n.schema);n.atRoot&&(n.atRoot=!1);let s=r.offset,a=null;for(const c of r.items){const{start:l,key:u,sep:f,value:h}=c,p=sn(l,{indicator:"explicit-key-ind",next:u??f?.[0],offset:s,onError:i,startOnNewline:!0}),d=!p.found;if(d){if(u&&("block-seq"===u.type?i(s,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in u&&u.indent!==r.indent&&i(s,"BAD_INDENT",un)),!p.anchor&&!p.tag&&!f){a=p.end,p.comment&&(o.comment?o.comment+="\n"+p.comment:o.comment=p.comment);continue}(p.hasNewlineAfterProp||an(u))&&i(u??l[l.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else p.found?.indent!==r.indent&&i(s,"BAD_INDENT",un);const m=p.end,y=u?t(n,u,p,i):e(n,m,l,null,p,i);n.schema.compat&&cn(r.indent,u,i),ln(n,o.items,y)&&i(m,"DUPLICATE_KEY","Map keys must be unique");const v=sn(f??[],{indicator:"map-value-ind",next:h,offset:y.range[2],onError:i,startOnNewline:!u||"block-scalar"===u.type});if(s=v.end,v.found){d&&("block-map"!==h?.type||v.hasNewline||i(s,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&p.start0){const t=fn(h,p,n.options.strict,i);t.comment&&(a.comment?a.comment+="\n"+t.comment:a.comment=t.comment),a.range=[r.offset,p,t.offset]}else a.range=[r.offset,p,p];return a}(t,e,n,i)}if(!r)return o;const s=e.directives.tagName(r.source,(t=>i(r,"TAG_RESOLVE_FAILED",t)));if(!s)return o;const a=o.constructor;if("!"===s||s===a.tagName)return o.tag=a.tagName,o;const c=q(o)?"map":"seq";let l=e.schema.tags.find((t=>t.collection===c&&t.tag===s));if(!l){const t=e.schema.knownTags[s];if(!t||t.collection!==c)return i(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,!0),o.tag=s,o;e.schema.tags.push(Object.assign({},t,{default:!1})),l=t}const u=l.resolve(o,(t=>i(r,"TAG_RESOLVE_FAILED",t)),e.options),f=H(u)?u:new vt(u);return f.range=o.range,f.tag=s,l?.format&&(f.format=l.format),f}(_n,t,e,a,r),s&&(c.anchor=s.source.substring(1));break;default:r(e,"UNEXPECTED_TOKEN","error"===e.type?e.message:`Unsupported token (type: ${e.type})`),c=kn(t,e.offset,void 0,null,n,r),l=!1}return s&&""===c.anchor&&r(s,"BAD_ALIAS","Anchor cannot be an empty string"),i&&(c.spaceBefore=!0),o&&("scalar"===e.type&&""===e.source?c.comment=o:c.commentBefore=o),t.options.keepSourceTokens&&l&&(c.srcToken=e),c}function kn(t,e,n,r,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){const u=gn(t,{type:"scalar",offset:bn(e,n,r),indent:-1,source:""},a,l);return s&&(u.anchor=s.source.substring(1),""===u.anchor&&l(s,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(u.spaceBefore=!0),o&&(u.comment=o,u.range[2]=c),u}function En(t){if("number"==typeof t)return[t,t+1];if(Array.isArray(t))return 2===t.length?t:[t[0],t[1]];const{offset:e,source:n}=t;return[e,e+("string"==typeof n?n.length:1)]}function xn(t){let e="",n=!1,r=!1;for(let i=0;i{const i=En(t);r?this.warnings.push(new rn(i,e,n)):this.errors.push(new nn(i,e,n))},this.directives=new lt({version:t.version||"1.2"}),this.options=t}decorate(t,e){const{comment:n,afterEmptyLine:r}=xn(this.prelude);if(n){const i=t.contents;if(e)t.comment=t.comment?`${t.comment}\n${n}`:n;else if(r||t.directives.docStart||!i)t.commentBefore=n;else if(Y(i)&&!i.flow&&i.items.length>0){let t=i.items[0];z(t)&&(t=t.key);const e=t.commentBefore;t.commentBefore=e?`${n}\n${e}`:n}else{const t=i.commentBefore;i.commentBefore=t?`${n}\n${t}`:n}}e?(Array.prototype.push.apply(t.errors,this.errors),Array.prototype.push.apply(t.warnings,this.warnings)):(t.errors=this.errors,t.warnings=this.warnings),this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:xn(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(t,e=!1,n=-1){for(const e of t)yield*this.next(e);yield*this.end(e,n)}*next(t){switch(t.type){case"directive":this.directives.add(t.source,((e,n,r)=>{const i=En(t);i[0]+=e,this.onError(i,"BAD_DIRECTIVE",n,r)})),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{const e=function(t,e,{offset:n,start:r,value:i,end:o},s){const a=Object.assign({_directives:e},t),c=new Ze(void 0,a),l={atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=sn(r,{indicator:"doc-start",next:i??o?.[0],offset:n,onError:s,startOnNewline:!0});u.found&&(c.directives.docStart=!0,!i||"block-map"!==i.type&&"block-seq"!==i.type||u.hasNewline||s(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=i?wn(l,i,u,s):kn(l,u.end,r,null,u,s);const f=c.contents.range[2],h=fn(o,f,!1,s);return h.comment&&(c.comment=h.comment),c.range=[n,f,h.offset],c}(this.options,this.directives,t,this.onError);this.atDirectives&&!e.directives.docStart&&this.onError(t,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(e,!1),this.doc&&(yield this.doc),this.doc=e,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(t.source);break;case"error":{const e=t.source?`${t.message}: ${JSON.stringify(t.source)}`:t.message,n=new nn(En(t),"UNEXPECTED_TOKEN",e);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case"doc-end":{if(!this.doc){const e="Unexpected doc-end without preceding document";this.errors.push(new nn(En(t),"UNEXPECTED_TOKEN",e));break}this.doc.directives.docEnd=!0;const e=fn(t.end,t.offset+t.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),e.comment){const t=this.doc.comment;this.doc.comment=t?`${t}\n${e.comment}`:e.comment}this.doc.range[2]=e.offset;break}default:this.errors.push(new nn(En(t),"UNEXPECTED_TOKEN",`Unsupported token ${t.type}`))}}*end(t=!1,e=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(t){const t=Object.assign({_directives:this.directives},this.options),n=new Ze(void 0,t);this.atDirectives&&this.onError(e,"MISSING_CHAR","Missing directives-end indicator line"),n.range=[0,e,e],this.decorate(n,!1),yield n}}}const Sn=Symbol("break visit"),Tn=Symbol("skip children"),An=Symbol("remove item");function Ln(t,e){"type"in t&&"document"===t.type&&(t={start:t.start,value:t.value}),Nn(Object.freeze([]),t,e)}function Nn(t,e,n){let r=n(e,t);if("symbol"==typeof r)return r;for(const i of["key","value"]){const o=e[i];if(o&&"items"in o){for(let e=0;e{let n=t;for(const[t,r]of e){const e=n?.[t];if(!e||!("items"in e))return;n=e.items[r]}return n},Ln.parentCollection=(t,e)=>{const n=Ln.itemAtPath(t,e.slice(0,-1)),r=e[e.length-1][0],i=n?.[r];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function Cn(t){switch(t){case void 0:case" ":case"\n":case"\r":case"\t":return!0;default:return!1}}const jn="0123456789ABCDEFabcdef".split(""),Pn="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()".split(""),In=",[]{}".split(""),Rn=" ,[]{}\n\r\t".split(""),Mn=t=>!t||Rn.includes(t);class Bn{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(t,e=!1){t&&(this.buffer=this.buffer?this.buffer+t:t,this.lineEndPos=null),this.atEnd=!e;let n=this.next??"stream";for(;n&&(e||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let t=this.pos,e=this.buffer[t];for(;" "===e||"\t"===e;)e=this.buffer[++t];return!e||"#"===e||"\n"===e||"\r"===e&&"\n"===this.buffer[t+1]}charAt(t){return this.buffer[this.pos+t]}continueScalar(t){let e=this.buffer[t];if(this.indentNext>0){let n=0;for(;" "===e;)e=this.buffer[++n+t];if("\r"===e){const e=this.buffer[n+t+1];if("\n"===e||!e&&!this.atEnd)return t+n+1}return"\n"===e||n>=this.indentNext||!e&&!this.atEnd?t+n:-1}if("-"===e||"."===e){const e=this.buffer.substr(t,3);if(("---"===e||"..."===e)&&Cn(this.buffer[t+3]))return-1}return t}getLine(){let t=this.lineEndPos;return("number"!=typeof t||-1!==t&&tthis.indentValue&&!Cn(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){const[t,e]=this.peek(2);if(!e&&!this.atEnd)return this.setNext("block-start");if(("-"===t||"?"===t||":"===t)&&Cn(e)){const t=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=t,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);const t=this.getLine();if(null===t)return this.setNext("doc");let e=yield*this.pushIndicators();switch(t[e]){case"#":yield*this.pushCount(t.length-e);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(Mn),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return e+=(yield*this.parseBlockScalarHeader()),e+=(yield*this.pushSpaces(!0)),yield*this.pushCount(t.length-e),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let t,e,n=-1;do{t=yield*this.pushNewline(),t>0?(e=yield*this.pushSpaces(!1),this.indentValue=n=e):e=0,e+=(yield*this.pushSpaces(!0))}while(t+e>0);const r=this.getLine();if(null===r)return this.setNext("flow");if((-1!==n&&n"0"&&e<="9")this.blockScalarIndent=Number(e)-1;else if("-"!==e)break}return yield*this.pushUntil((t=>Cn(t)||"#"===t))}*parseBlockScalar(){let t,e=this.pos-1,n=0;t:for(let r=this.pos;t=this.buffer[r];++r)switch(t){case" ":n+=1;break;case"\n":e=r,n=0;break;case"\r":{const t=this.buffer[r+1];if(!t&&!this.atEnd)return this.setNext("block-scalar");if("\n"===t)break}default:break t}if(!t&&!this.atEnd)return this.setNext("block-scalar");if(n>=this.indentNext){-1===this.blockScalarIndent?this.indentNext=n:this.indentNext+=this.blockScalarIndent;do{const t=this.continueScalar(e+1);if(-1===t)break;e=this.buffer.indexOf("\n",t)}while(-1!==e);if(-1===e){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}if(!this.blockScalarKeep)for(;;){let t=e-1,r=this.buffer[t];"\r"===r&&(r=this.buffer[--t]);const i=t;for(;" "===r||"\t"===r;)r=this.buffer[--t];if(!("\n"===r&&t>=this.pos&&t+1+n>i))break;e=t}return yield"",yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){const t=this.flowLevel>0;let e,n=this.pos-1,r=this.pos-1;for(;e=this.buffer[++r];)if(":"===e){const e=this.buffer[r+1];if(Cn(e)||t&&","===e)break;n=r}else if(Cn(e)){let i=this.buffer[r+1];if("\r"===e&&("\n"===i?(r+=1,e="\n",i=this.buffer[r+1]):n=r),"#"===i||t&&In.includes(i))break;if("\n"===e){const t=this.continueScalar(r+1);if(-1===t)break;r=Math.max(r,t-2)}}else{if(t&&In.includes(e))break;n=r}return e||this.atEnd?(yield"",yield*this.pushToIndex(n+1,!0),t?"flow":"doc"):this.setNext("plain-scalar")}*pushCount(t){return t>0?(yield this.buffer.substr(this.pos,t),this.pos+=t,t):0}*pushToIndex(t,e){const n=this.buffer.slice(this.pos,t);return n?(yield n,this.pos+=n.length,n.length):(e&&(yield""),0)}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(Mn))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{const t=this.flowLevel>0,e=this.charAt(1);if(Cn(e)||t&&In.includes(e))return t?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,(yield*this.pushCount(1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators())}}return 0}*pushTag(){if("<"===this.charAt(1)){let t=this.pos+2,e=this.buffer[t];for(;!Cn(e)&&">"!==e;)e=this.buffer[++t];return yield*this.pushToIndex(">"===e?t+1:t,!1)}{let t=this.pos+1,e=this.buffer[t];for(;e;)if(Pn.includes(e))e=this.buffer[++t];else{if("%"!==e||!jn.includes(this.buffer[t+1])||!jn.includes(this.buffer[t+2]))break;e=this.buffer[t+=3]}return yield*this.pushToIndex(t,!1)}}*pushNewline(){const t=this.buffer[this.pos];return"\n"===t?yield*this.pushCount(1):"\r"===t&&"\n"===this.charAt(1)?yield*this.pushCount(2):0}*pushSpaces(t){let e,n=this.pos-1;do{e=this.buffer[++n]}while(" "===e||t&&"\t"===e);const r=n-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=n),r}*pushUntil(t){let e=this.pos,n=this.buffer[e];for(;!t(n);)n=this.buffer[++e];return yield*this.pushToIndex(e,!1)}}class Dn{constructor(){this.lineStarts=[],this.addNewLine=t=>this.lineStarts.push(t),this.linePos=t=>{let e=0,n=this.lineStarts.length;for(;e>1;this.lineStarts[r]=0;)switch(t[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break t}for(;"space"===t[++e]?.type;);return t.splice(e,t.length)}function qn(t){if("flow-seq-start"===t.start.type)for(const e of t.items)!e.sep||e.value||Fn(e.start,"explicit-key-ind")||Fn(e.sep,"map-value-ind")||(e.key&&(e.value=e.key),delete e.key,$n(e.value)?e.value.end?Array.prototype.push.apply(e.value.end,e.sep):e.value.end=e.sep:Array.prototype.push.apply(e.start,e.sep),delete e.sep)}class zn{constructor(t){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new Bn,this.onNewLine=t}*parse(t,e=!1){this.onNewLine&&0===this.offset&&this.onNewLine(0);for(const n of this.lexer.lex(t,e))yield*this.next(n);e||(yield*this.end())}*next(t){if(this.source=t,this.atScalar)return this.atScalar=!1,yield*this.step(),void(this.offset+=t.length);const e=function(t){switch(t){case"\ufeff":return"byte-order-mark";case"":return"doc-mode";case"":return"flow-error-end";case"":return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case"\n":case"\r\n":return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(t[0]){case" ":case"\t":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}(t);if(e)if("scalar"===e)this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=e,yield*this.step(),e){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+t.length);break;case"space":this.atNewLine&&" "===t[0]&&(this.indent+=t.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=t.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=t.length}else{const e=`Not a YAML token: ${t}`;yield*this.pop({type:"error",offset:this.offset,message:e,source:t}),this.offset+=t.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){const t=this.peek(1);if("doc-end"!==this.type||t&&"doc-end"===t.type){if(!t)return yield*this.stream();switch(t.type){case"document":return yield*this.document(t);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(t);case"block-scalar":return yield*this.blockScalar(t);case"block-map":return yield*this.blockMap(t);case"block-seq":return yield*this.blockSequence(t);case"flow-collection":return yield*this.flowCollection(t);case"doc-end":return yield*this.documentEnd(t)}yield*this.pop()}else{for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source})}}peek(t){return this.stack[this.stack.length-t]}*pop(t){const e=t??this.stack.pop();if(e)if(0===this.stack.length)yield e;else{const t=this.peek(1);switch("block-scalar"===e.type?e.indent="indent"in t?t.indent:0:"flow-collection"===e.type&&"document"===t.type&&(e.indent=0),"flow-collection"===e.type&&qn(e),t.type){case"document":t.value=e;break;case"block-scalar":t.props.push(e);break;case"block-map":{const n=t.items[t.items.length-1];if(n.value)return t.items.push({start:[],key:e,sep:[]}),void(this.onKeyLine=!0);if(!n.sep)return Object.assign(n,{key:e,sep:[]}),void(this.onKeyLine=!Fn(n.start,"explicit-key-ind"));n.value=e;break}case"block-seq":{const n=t.items[t.items.length-1];n.value?t.items.push({start:[],value:e}):n.value=e;break}case"flow-collection":{const n=t.items[t.items.length-1];return void(!n||n.value?t.items.push({start:[],key:e,sep:[]}):n.sep?n.value=e:Object.assign(n,{key:e,sep:[]}))}default:yield*this.pop(),yield*this.pop(e)}if(!("document"!==t.type&&"block-map"!==t.type&&"block-seq"!==t.type||"block-map"!==e.type&&"block-seq"!==e.type)){const n=e.items[e.items.length-1];n&&!n.sep&&!n.value&&n.start.length>0&&-1===Kn(n.start)&&(0===e.indent||n.start.every((t=>"comment"!==t.type||t.indent=t.indent){const n=!this.onKeyLine&&this.indent===t.indent&&e.sep;let r=[];if(n&&e.sep&&!e.value){const n=[];for(let r=0;rt.indent&&(n.length=0);break;default:n.length=0}}n.length>=2&&(r=e.sep.splice(n[1]))}switch(this.type){case"anchor":case"tag":return void(n||e.value?(r.push(this.sourceToken),t.items.push({start:r}),this.onKeyLine=!0):e.sep?e.sep.push(this.sourceToken):e.start.push(this.sourceToken));case"explicit-key-ind":return e.sep||Fn(e.start,"explicit-key-ind")?n||e.value?(r.push(this.sourceToken),t.items.push({start:r})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]}):e.start.push(this.sourceToken),void(this.onKeyLine=!0);case"map-value-ind":if(Fn(e.start,"explicit-key-ind"))if(e.sep)if(e.value)t.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Fn(e.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]});else if($n(e.key)&&!Fn(e.sep,"newline")){const t=Un(e.start),n=e.key,r=e.sep;r.push(this.sourceToken),delete e.key,delete e.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:t,key:n,sep:r}]})}else r.length>0?e.sep=e.sep.concat(r,this.sourceToken):e.sep.push(this.sourceToken);else if(Fn(e.start,"newline"))Object.assign(e,{key:null,sep:[this.sourceToken]});else{const t=Un(e.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]})}else e.sep?e.value||n?t.items.push({start:r,key:null,sep:[this.sourceToken]}):Fn(e.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):e.sep.push(this.sourceToken):Object.assign(e,{key:null,sep:[this.sourceToken]});return void(this.onKeyLine=!0);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const i=this.flowScalar(this.type);return void(n||e.value?(t.items.push({start:r,key:i,sep:[]}),this.onKeyLine=!0):e.sep?this.stack.push(i):(Object.assign(e,{key:i,sep:[]}),this.onKeyLine=!0))}default:{const i=this.startBlockValue(t);if(i)return n&&"block-seq"!==i.type&&Fn(e.start,"explicit-key-ind")&&t.items.push({start:r}),void this.stack.push(i)}}}yield*this.pop(),yield*this.step()}*blockSequence(t){const e=t.items[t.items.length-1];switch(this.type){case"newline":if(e.value){const n="end"in e.value?e.value.end:void 0,r=Array.isArray(n)?n[n.length-1]:void 0;"comment"===r?.type?n?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else e.start.push(this.sourceToken);return;case"space":case"comment":if(e.value)t.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(e.start,t.indent)){const n=t.items[t.items.length-2],r=n?.value?.end;if(Array.isArray(r))return Array.prototype.push.apply(r,e.start),r.push(this.sourceToken),void t.items.pop()}e.start.push(this.sourceToken)}return;case"anchor":case"tag":if(e.value||this.indent<=t.indent)break;return void e.start.push(this.sourceToken);case"seq-item-ind":if(this.indent!==t.indent)break;return void(e.value||Fn(e.start,"seq-item-ind")?t.items.push({start:[this.sourceToken]}):e.start.push(this.sourceToken))}if(this.indent>t.indent){const e=this.startBlockValue(t);if(e)return void this.stack.push(e)}yield*this.pop(),yield*this.step()}*flowCollection(t){const e=t.items[t.items.length-1];if("flow-error-end"===this.type){let t;do{yield*this.pop(),t=this.peek(1)}while(t&&"flow-collection"===t.type)}else if(0===t.end.length){switch(this.type){case"comma":case"explicit-key-ind":return void(!e||e.sep?t.items.push({start:[this.sourceToken]}):e.start.push(this.sourceToken));case"map-value-ind":return void(!e||e.value?t.items.push({start:[],key:null,sep:[this.sourceToken]}):e.sep?e.sep.push(this.sourceToken):Object.assign(e,{key:null,sep:[this.sourceToken]}));case"space":case"comment":case"newline":case"anchor":case"tag":return void(!e||e.value?t.items.push({start:[this.sourceToken]}):e.sep?e.sep.push(this.sourceToken):e.start.push(this.sourceToken));case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const n=this.flowScalar(this.type);return void(!e||e.value?t.items.push({start:[],key:n,sep:[]}):e.sep?this.stack.push(n):Object.assign(e,{key:n,sep:[]}))}case"flow-map-end":case"flow-seq-end":return void t.end.push(this.sourceToken)}const n=this.startBlockValue(t);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{const e=this.peek(2);if("block-map"===e.type&&("map-value-ind"===this.type&&e.indent===t.indent||"newline"===this.type&&!e.items[e.items.length-1].sep))yield*this.pop(),yield*this.step();else if("map-value-ind"===this.type&&"flow-collection"!==e.type){const n=Un(Vn(e));qn(t);const r=t.end.splice(1,t.end.length);r.push(this.sourceToken);const i={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:n,key:t,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=i}else yield*this.lineEnd(t)}}flowScalar(t){if(this.onNewLine){let t=this.source.indexOf("\n")+1;for(;0!==t;)this.onNewLine(this.offset+t),t=this.source.indexOf("\n",t)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;const e=Un(Vn(t));return e.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:e}]}}case"map-value-ind":{this.onKeyLine=!0;const e=Un(Vn(t));return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:e,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,e){return"comment"===this.type&&!(this.indent<=e)&&t.every((t=>"newline"===t.type||"space"===t.type))}*documentEnd(t){"doc-mode"!==this.type&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],"newline"===this.type&&(yield*this.pop()))}*lineEnd(t){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],"newline"===this.type&&(yield*this.pop())}}}function Wn(t,e={}){const{lineCounter:n,prettyErrors:r}=function(t){const e=!1!==t.prettyErrors;return{lineCounter:t.lineCounter||e&&new Dn||null,prettyErrors:e}}(e),i=new zn(n?.addNewLine),o=new On(e);let s=null;for(const e of o.compose(i.parse(t),!0,t.length))if(s){if("silent"!==s.options.logLevel){s.errors.push(new nn(e.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}}else s=e;return r&&n&&(s.errors.forEach(on(t,n)),s.warnings.forEach(on(t,n))),s}class Gn extends en{constructor(t,e,n){super(t,e,"IMPOSSIBLE",n),this.name=t}pretty(t){this.linePos=t.lineCounter.linePos(this.pos);const{line:e,col:n}=this.linePos;this.message+=` at line ${e}, column ${n} ${t.file?" @"+t.file:""}`}}class Yn{constructor(){this.lineCounter=new Dn,this.src="",this.txt="",this.errors=[],this.warnings=[],this.yaml_ok=!1,this.contents=null,this.listener=null,this.prog={}}errors(t){this.errors=this.errors.concat(t)}warnings(t){this.warnings=this.warnings.concat(t)}fileError(t){let e=new Gn("FILE_ERROR",0,`FileError : ${t}`);return this.errors.push(e),e}syntaxError(t,e){let n=new Gn("SYNTAX_ERROR",t.range?t.range[0]:0,`SyntaxError : ${e}`);return this.errors.push(n),n}syntaxWarning(t,e){let n=new Gn("SYNTAX_WARNING",t.range?t.range[0]:0,`SyntaxWarning : ${e}`);return this.warnings.push(n),n}typeError(t,e){let n=new Gn("TYPE_ERROR",t.range?t.range[0]:0,`TypeError : ${e}`);return this.errors.push(n),n}grammarError(t){let e=new Gn("GRAMMAR_ERROR",0,`GrammarError : ${t}`);this.errors.push(e)}grammarWarning(t){let e=new Gn("GRAMMAR_WARNING",0,`GrammarWarning : ${t}`);return this.warnings.push(e),e}fails(){return this.errors.length>0}success(){return 0==this.errors.length&&0==this.warnings.length}result(){return this.contents}}class Hn{constructor(t,e,n){this.ctx=t,this.type=e,this.current=n,this.start=n.range[0],this.end=n.range[1],this.childs=[]}getChild(t){return this.childs[t]}getChildCount(){return this.childs.length}getValue(){return this.value}toString(){return this.value}}class Jn extends Hn{constructor(t,e,n){super(t,e,n)}equals(t){if(t instanceof Jn)return this.value==t.value;this.ctx.syntaxError(this.current,`Error can not compare values '${this.value}' and '${t.value}'`)}}class Xn extends Jn{constructor(t,e){if(super(t,"string",e),!Xn.checkCurrent(e))throw t.syntaxError(e,`Error: value '${e?e.value:""}' is not a string`);this.value=e.value}static checkCurrent(t){return W(t)&&"string"==typeof t.value}static parse(t,e){try{return new Xn(t,e)}catch(t){return null}}}class Qn extends Jn{constructor(t,e){if(super(t,"binary",e),!Qn.checkCurrent(e))throw t.syntaxError(e,`Error: value '${e?e.value:""}' is not a base64 string`);this.value=e.value}static checkCurrent(t){return W(t)&&"string"==typeof t.value&&/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/.test(t.value)}static parse(t,e){try{return new Qn(t,e)}catch(t){return null}}}class Zn extends Jn{constructor(t,e){if(super(t,"int",e),!Zn.checkCurrent(e))throw t.syntaxError(e,`Error: value '${e?e.value:""}' is not an integer`);this.value=e.value}static checkCurrent(t){return W(t)&&"number"==typeof t.value&&t.value==Math.floor(t.value)}static parse(t,e){try{return new Zn(t,e)}catch(t){return null}}}class tr extends Jn{constructor(t,e){if(super(t,"float",e),!tr.checkCurrent(e))throw t.syntaxError(e,`Error: value '${e?e.value:""}' is not a number`);this.value=e.value}static checkCurrent(t){return W(t)&&"number"==typeof t.value}static parse(t,e){try{return new tr(t,e)}catch(t){return null}}}class er extends Jn{constructor(t,e){if(super(t,"boolean",e),this.value=null,!er.checkCurrent(e))throw t.syntaxError(e,`Error: value '${e.value}' is not a boolean`);this.value=e.value}static checkCurrent(t){return W(t)&&"boolean"==typeof t.value}static parse(t,e){try{return new er(t,e)}catch(t){return null}}}class nr extends Jn{constructor(t,e){if(super(t,"null",e),this.value=null,!nr.checkCurrent(e))throw t.syntaxError(e,`Error: value '${e?e.value:""}' is not the null value`)}static checkCurrent(t){return W(t)&&(null==t.value||["Null","NULL","null","~"].includes(t.value))}static parse(t,e){try{return new nr(t,e)}catch(t){return null}}}class rr extends Jn{constructor(t,e,n){if(super(t,"timestamp",e),!rr.checkCurrent(e))throw t.syntaxError(e,`Error: value '${e?e.value:""}' is not a timestamp in ISO9601 format`);this.value=new Date(e.value)}static checkCurrent(t){let e=W(t)&&"string"==typeof t.value&&/\d{4}-\d{2}-\d{2}|\d{4}-\d{2}?-\d{2}?([Tt]|[ \t]+)\d{2}?:\d{2}:\d{2}(\.\d*)?(([ \t]*)Z|[-+]\d\d?(:\d{2})?)?/.test(t.value);if(1==e)try{new Date(t.value)}catch(t){e=!1}return e}static parse(t,e){try{return new rr(t,e)}catch(t){return null}}equals(t){return t instanceof rr?this.value.getTime()==t.value.getTime():this.ctx.syntaxError("Error : can not compare a timestamp with something else")}}class ir extends Hn{constructor(t,e,n){super(t,e,n)}length(){return this.childs.length}isEmpty(){return 0==this.length()}}class or extends ir{constructor(t,e,n){if(super(t,"map",e),"object"!=typeof n||n instanceof Array)throw t.syntaxError(e,"Erorr : MapNode must be initialized with a parsed map. This should not happen.");this.value=n;for(const t in n)this.childs.push(n[t])}static checkCurrent(t){return q(t)&&t.items.every((t=>t.key&&W(t.key)&&"string"==typeof t.key.value))}}class sr{static parse(t,e,n){"object"!=typeof e&&t.grammarError("Error: oneof rule can not be parsed'");let r=e._oneOf;if(r instanceof Array){let e=[].concat(t.errors),i=[].concat(t.warnings),o=t.errors.length;for(let s of r){let r=gr(t,null,s,n);if(o==t.errors.length)return t.errors=e,t.warnings=i,r;o=t.errors.length}return t.syntaxError(n,"Syntax Error : no valid alternative found during parsing"),null}t.grammarError("Error: _oneof rules expects a sequence of alternatives")}}var ar="undefined"!=typeof Symbol;function cr(t){var e=typeof t;return"string"===e||"number"===e||"boolean"===e||!0===ar&&"symbol"===e||null==t||!0===ar&&t instanceof Symbol||t instanceof String||t instanceof Number||t instanceof Boolean}class lr{static parse(t,e){if("object"==typeof e){if(e._oneOf){let n;!e._oneOf instanceof Array&&t.grammarError("Error : _oneof value have to be a list"),e._oneOf=e._oneOf.map((e=>lr.parse(t,e)));do{if(n=e._oneOf.findIndex((t=>t._oneOf)),n>=0){let t=e._oneOf[n]._oneOf;(e={_oneOf:[].concat(e._oneOf)})._oneOf.splice(n,1),e._oneOf=e._oneOf.concat(t)}}while(n>=0);return e}if(e._merge){if(!(e._merge instanceof Array))return t.grammarError("Error : _merge value have to be a map"),null;const{_merge:n,...r}=e;let i;e={_merge:e._merge},Object.keys(r).length&&e._merge.push(r),e._merge=e._merge.map((e=>cr(e)&&t.rules[e]?t.rules[e]:e)),e._merge=e._merge.map((e=>lr.parse(t,e)));do{if(i=e._merge.findIndex((t=>t._merge)),i>=0){let t=e.one._merge;(e={_merge:[].concat(e._merge)})._merge.splice(i,1),e._merge=e._merge.concat(t)}}while(i>=0);let o={_oneOf:[]};do{if(i=(e={_merge:[].concat(e._merge)})._merge.findIndex((t=>t._oneOf)),i>=0){let t=e._merge[i]._oneOf;(e={_merge:[].concat(e._merge)})._merge.splice(i,1),t.forEach((t=>{let n={_merge:[t].concat(e._merge)};o._oneOf.push(n)}))}}while(i>=0);if(o._oneOf.length>=1)return lr.parse(t,o);e._merge.some((t=>t._merge||t._oneOf))&&t.grammarError("Error : merge has not been processed successfully. This error should not occur.");let s={},a={},c=null,l=-1,u=-1,f=-1;e._merge.forEach((e=>{if(e._map){s={...s};for(let n in e._map)s.key&&t.grammarError("Error : can not merge two maps with some identical keys"),s[n]=e._map[n]}if(e._mapFacultative){a={...a};for(let n in e._mapFacultative)a.key&&t.grammarError("Error : can not merge two maps with some identical keys"),a[n]=e._mapFacultative[n]}if(e._mapOf){if(null!=c)return t.grammarError("Error : only one '_mapOf' is allowed in a '_merge' clause"),null;c=e._mapOf}e._nb&&(l<0||l==e._nb?l=e._nb:t.grammarError("Contradictory sizing in merge clause")),e._min&&(u=Math.max(e._min,u)),e._max&&(nax=l>0?Math.min(e._max,f):e._max)}));let h={};return l>=0&&(h._nb=l),u>=0&&(h._min=u),f>=0&&(h._max=f),Object.keys(s).length>0&&(h._map=s),Object.keys(a).length>0&&(h._mapFacultative=a),null!=c&&(h._mapOf=c),h}if(e._map){let n={};for(const r in e._map)n[r]=lr.parse(t,e._map[r]);e._map=n}if(e._mapFacultative){let n={};for(const r in e._mapFacultative)n[r]=lr.parse(t,e._mapFacultative[r]);e._mapFacultative=n}if(e._mapOf){let n={};for(const r in e._mapOf){let i=lr.parse(t,r),o=lr.parse(t,e._mapOf[r]);n[i]=o}e._mapOf=n}e._list&&(e._list=e._list.map((e=>lr.parse(t,e)))),e._listFacultative&&(e._listFacultative=e._listFacultative.map((e=>lr.parse(t,e)))),e._listOf&&(e._listOf=lr.parse(t,e._listOf))}return e}}class ur{static isPositiveInt(t){return"number"==typeof t&&t==Math.floor(t)&&t>0}static sizeChecker(t,e,n,r){if(ur.isPositiveInt(n))if(q(r)||G(r))switch(e){case"eq":return r.items.length==n;case"min":return r.items.length>=n;case"max":return r.items.length<=n}else t.syntaxError(r,"Error : a map is expected");else t.grammarError(`Error: the map checker '${e}' does not have a positive integer as value`);return!1}static sizeCheckers(t,e,n){return null==e._nb||ur.sizeChecker(t,"eq",e._nb,n)?null==e._min||ur.sizeChecker(t,"min",e._min,n)?!(null!=e._max&&!ur.sizeChecker(t,"max",e._max,n)&&(t.syntaxError(n,`Error : map expected with more than ${e._max} elements but ${n.items.length} are provided`),1)):(t.syntaxError(n,`Error : map expected with more than ${e._min} elements but ${n.items.length} are provided`),!1):(t.syntaxError(n,`Error : map expected with ${e._nb} elements but ${n.items.length} are provided`),!1)}}class fr{static parse(t,e,n){if(!or.checkCurrent(n))return t.syntaxError(n,"Error : a map whose keys are strings is expected "),null;if(e._merge&&(e=lr.parse(t,e))._oneOf)return sr.parse(t,e,n);let r=e._map,i=e._mapOf,o=e._mapFacultative;if(null!=i&&"object"!=typeof i||null!=o&&"object"!=typeof o)return t.grammarError("Error : error in map value definition"),null;if(!ur.sizeCheckers(t,e,n))return null;if(null!=r)for(let e in r){if("string"!=typeof e)return t.grammarError("Error : error in map definition"),null;if(!n.has(e))return t.syntaxError(n,`Error : key '${e}' not found in current value`),null}let s,a=null;if(i){let t=Object.entries(i);1==t.length&&([[s,a]]=t)}let c={};for(let i of n.items){let n=i.key.value,l=i.value,u=null;if(r&&r[n])u=gr(t,null,r[n],l);else if(o&&o[n])u=gr(t,null,o[n],l);else{if(!s||!a)return t.syntaxError(l,`Error : '${n}' is not a valid key (in rule : ${JSON.stringify(e)})`),null;{let e=gr(t,null,s,i.key);if(u=gr(t,null,a,l),e.value!=n)return t.syntaxError(n,`Error : '${n}' does not match expected '${s}' type`),null}}if(null==u)return t.syntaxError(l,`Error : bad value '${l}'found for '${n}' (mapparser.parse)`),null;let f=new Xn(t,i.key);if(u.key=f,null!=c[n])return t.syntaxError(l,`Error : more than one value provided in the map for the key '${n}'`),null;c[n]=u}return new or(t,n,c)}static parse_any(t,e){if(!or.checkCurrent(e))return t.syntaxError(e,"Error : a map whose keys are strings is expected "),null;let n={};return e.items.forEach((e=>{let r=e.key.value,i=e.value,o=dr.parse_any(t,i);if(null==o)return t.syntaxError(i,`Error : bad value '${i}' found for '${r}' (mapparser.parse_any)`),null;let s=new Xn(t,e.key);o.key=s,null!=n[r]&&t.syntaxError(i,`Error : more than one value provided in the map for the key '${r}'`),n[r]=o})),new or(t,e,n)}}class hr extends ir{constructor(t,e,n){if(super(t,"list",e),!n instanceof Array)throw t.syntaxError(e,"Erorr : ListNode must be initialized with an array. This should not happen.");this.value=n,this.childs=this.value}static checkCurrent(t){return G(t)}}class pr{static parse(t,e,n){if(!hr.checkCurrent(n))return t.syntaxError(n,"Error : a list is expected "),null;if(!ur.sizeCheckers(t,e,n))return null;let r=e._list,i=e._listOf,o=e._listFacultative;if(null!=r&&!(r instanceof Array)||null!=o&&!(o instanceof Array))return t.grammarError("Error : error in list value definition"),null;let s=0,a=n.items.length,c=[];r&&r.forEach((e=>{if(!(s{if(s{let r=dr.parse_any(t,e);if(null==r)return t.SyntaxError(value,`Error : bad value '${value}' found for '${key}' (listparser.parse_any)`),null;n.push(r)})),new hr(t,e,n)}}class dr{static parse(t,e,n){switch(e){case"string":return Xn.parse(t,n);case"binary":return Qn.parse(t,n);case"timestamp":return rr.parse(t,n);case"int":return Zn.parse(t,n);case"float":return tr.parse(t,n);case"boolean":return er.parse(t,n);case"null":return nr.parse(t,n);case"any":return dr.parse_any(t,n);default:return br(t,e,n)}}static parse_any(t,e){if(W(e)){switch(typeof e.value){case"number":return Zn.checkCurrent(e)?Zn.parse(t,e):tr.parse(t,e);case"boolean":return er.parse(t,e);case"string":return Xn.parse(t,e);case"object":if(null==e.value)return nr.parse(t,e);t.syntaxError(e,`Error: value '${e.value}' is not a scalar value`);default:t.syntaxError(e,`Error: value '${e.value}' is not a scalar value`)}return null}return q(e)?fr.parse_any(t,e):G(e)?pr.parse_any(t,e):null}}class mr{static parse(t,e,n){"object"==typeof e&&e._in||t.grammarError("Error: can not parse _in rule'");let r=e._in;if(!(r instanceof Array))return t.grammarError("Error: _in rules expects a sequence of alternatives"),null;for(let e of r)if(!cr(e))return t.grammarError("Error: _in rules expects each alternative to be a scalar"),null;if(!W(n))return t.syntaxError(n,"Syntax Error : scalar value expected by rule '_in'"),null;let i=dr.parse_any(t,n);if(i){let e=[].concat(t.errors),n=[].concat(t.warnings),o=t.errors.length,s=i.value;for(let a of r)if(a){let r=a==s?i:null;if(null!=r)return t.errors=e,t.warnings=n,r;o=t.errors.length}}return t.syntaxError(n,"Syntax Error : no valid alternative for '_in' rule found during parsing"),null}}class yr{static parse(t,e,n){if(!Xn.checkCurrent(n))return t.syntaxError(n,`Error: regular expressions match only strings, '${n?n.value:""}' is not a string`),null;let r=e._regex;if(null==r)return t.grammarError("Error : regep rule must have a value for key '_regex'"),null;let i=null;try{i=new RegExp(r)}catch(t){}return null==i?(t.grammarError(`Error: value '${i}' is not a valid regular expression`),null):i.test(n.value)?new Xn(t,n):(t.syntaxError(n,`Error: value '${n.value}' does not match the regular expression '${i}'`),null)}}class vr{static scalartypes=["string","int","float","null","boolean","binary","timestamp"];static keywords=["_map","_mapOf","_mapFacultative","_list","_listOf","_listFacultative","_oneOf","_regex","_nb","_min","_max","_in"];static parse(t,e,n,r){if(null==r)return t.fileError("No source to parse"),null;if(vr.scalartypes.includes(e)||vr.keywords.includes(e))return t.syntaxError(r,`'${e}' is not allowed as rule_name in Lidy Grammar (reserved keyword)`),null;let i="enter_"+e;r.ctx=t,t.listener&&t.listener[i]&&t.listener[i](r);let o=gr(t,null,n,r),s="exit_"+e;return"node_template"==e&&console.log("Sortie de node_template"),t.listener&&t.listener[s]&&t.listener[s](o),o}}function gr(t,e,n,r){if(e)return vr.parse(t,e,n,r);if(cr(n))return dr.parse(t,n,r);if("object"==typeof n){if(n._map||n._mapOf||n._mapFacultative||n._merge)return fr.parse(t,n,r);if(n._list||n._listOf||n._listFacultative)return pr.parse(t,n,r);if(n._oneOf)return sr.parse(t,n,r);if(n._regex)return yr.parse(t,n,r);if(n._in)return mr.parse(t,n,r)}return t.grammarError("Error : grammar error : no valid keyword found"),null}function br(t,e,n){let r=t.rules[e];return void 0!==r?gr(t,e,r,n):(t.grammarError(`no rule named ${e} found.`),null)}function _r(t){t.keyword||(t.keyword="main");let e=new Yn;return e.prog=t.prog,t.rules?e.rules=t.rules:function(t,e,n){try{t.rules=function(t,e,n){let r;const i=Wn(t,n);if(!i)return null;if(i.warnings.forEach((t=>Kt(i.options.logLevel,t))),i.errors.length>0){if("silent"!==i.options.logLevel)throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:r},n))}(e)}catch(e){throw t.errors.push(e),t.grammarError("ERROR : can not parse dsl ")}if("object"==(t.rules,!1))throw t.grammarError("ERROR : can not parse dsl ");if(!t.rules[n])throw Error("ERROR : no rule labeled '"+n+"' in the grammar")}(e,t.dsl_data,t.keyword),e.listener=t.listener,function(t,e){t.lineCounter=new Dn;let n=Wn(e,{lineCounter:t.lineCounter});n||t.fileError("can not parse the provided source code."),t.src=n.contents,t.txt=e,t.errors=n.errors,t.warnings=n.warnings,t.yaml_ok=0==t.errors.length&&0==t.warnings.length}(e,t.src_data),function(t,e,n){let r=br(t,e,n);return t.errors.filter((t=>t instanceof Gn)).forEach((e=>e.pretty(t))),t.warnings.filter((t=>t instanceof Gn)).forEach((e=>e.pretty(t))),t.contents=r,t}(e,t.keyword,e.src)}var wr={main:"workflow",workflow:{_mapFacultative:{name:"WorkflowName",on:{_mapFacultative:{push:"PushTrigger",pull_request:"PullRequestTrigger"}},jobs:{_mapOf:{JobId:"Job"}}}},WorkflowName:"string",PushTrigger:{_map:{branches:"PushTriggerBranches"}},PushTriggerBranches:{_listOf:"string"},PullRequestTrigger:{_map:{types:"PullRequestTriggerTypes"}},PullRequestTriggerTypes:{_listOf:"string"},Job:{_mapFacultative:{name:"JobName","runs-on":"JobRunsOn",needs:"JobNeeds",steps:{_listOf:"Step"}}},JobId:"string",JobName:"string",JobRunsOn:"string",JobNeeds:{_listOf:"string"},Step:{_oneOf:["CommandStep","ReusableStep"]},ReusableStep:{_map:{uses:"StepUses"},_mapFacultative:{name:"StepName",with:"StepWith",env:"StepEnv"}},CommandStep:{_map:{run:"StepRun"},_mapFacultative:{name:"StepName",env:"StepEnv"}},StepUses:"string",StepName:"string",StepRun:"string",StepWith:{_mapOf:{StepMapKey:"StepMapValue"}},StepEnv:{_mapOf:{StepMapKey:"StepMapValue"}},StepMapKey:"string",StepMapValue:{_oneOf:["int","float","string"]}};function kr(t){return kr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},kr(t)}function Er(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.pluginData.components=[],this.pluginData.parseErrors=[],e.filter((function(e){var r=e.path,i=e.content;return!(!i||""===i.trim())||(t.pluginData.emitEvent({parent:n,type:"Parser",action:"read",status:"warning",files:[r],data:{code:"no_content",global:!1}}),!1)})).forEach((function(e,r){var i=t.pluginData.emitEvent({parent:n,type:"Parser",action:"read",status:"running",files:[e.path],data:{global:!1}}),o=new I(e,t.pluginData.definitions.components,"workflow_".concat(r+1));!function(t){t.rules=wr,_r(t)}({src_data:e.content,listener:o,path:e.path,prog:{errors:[],warnings:[],imports:[],alreadyImported:[],root:[]}}),o.components.forEach((function(e){return t.pluginData.components.push(e)})),t.pluginData.emitEvent({id:i,status:"success"})}))}}],n&&Er(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),s}(t.DefaultParser);var Ar=n(985),Lr=n.n(Ar);const Nr={root:"name: {{ workflowName.value }}\n\n{% if triggers.length > 0 %}\non:\n{% for trigger in triggers %}\n{% if trigger.definition.action === 'push' %}{% set branches = getTriggerAttribute(trigger, 'branches').value %}\n push:\n branches: [{% if branches.length > 0 %}{{ branches.join(', ') }}{% endif %}]\n{% else %}{% set types = getTriggerAttribute(trigger, 'types').value %}\n pull_request:\n types: [{% if types.length > 0 %}{{ types.join(', ') }}{% endif %}]\n{% endif %}\n{% endfor %}\n{% endif %}\n\njobs:\n{% for job in jobs %}\n {{ job.id }}:\n{% for attribute in getAttributes(job) %}\n {% if attribute.type === 'Array' %}\n {{attribute.name}}: [{{ attribute.value.join(', ')}}]\n {% else %}\n {{attribute.name}}: {{attribute.value }}\n {% endif %}\n{% endfor %}\n{% if getSteps(job.id).length > 0 %}\n steps:\n{% for step in getSteps(job.id) %}\n{% for attribute in getAttributes(step) %}\n{% if attribute.type === 'Array' %}\n{% if loop.first %}{{\"- \" | indent(6, true)}}{{attribute.name}}{% else %}{{attribute.name | indent(8, true)}}{% endif %}: [{{ attribute.value.join(', ')}}]\n{% elif attribute.type === 'Object' %}\n{% if loop.first %}{{\"- \" | indent(6, true)}}{{attribute.name}}{% else %}{{attribute.name | indent(8, true)}}{% endif %}:\n{% for value in attribute.value %}\n{{value.name | indent(10,true)}}: {% if value.type == 'Number' and value.value == null %}0{% else %}{{ value.value }}{% endif %}\n\n{% endfor %}\n{% else %}\n{% if loop.first %}{{\"- \" | indent(6, true)}}{{attribute.name}}{% else %}{{attribute.name | indent(8, true)}}{% endif %}: {{ attribute.value }}\n{% endif %}\n{% endfor %}\n{% endfor %}\n\n{% endif %}\n{% endfor %}"};function Cr(t){return Cr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Cr(t)}function jr(t,e){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:null,i=[];return e.forEach((function(e,o){var s=n.pluginData.emitEvent({parent:r,type:"Render",action:"write",status:"running",files:[o],data:{global:!1}}),a=e.find((function(t){return"workflow"===t.definition.type})),c=e.filter((function(t){return"trigger"===t.definition.type})),l=e.filter((function(t){return"step"===t.definition.type})),u="".concat(n.template.render({workflow:a,workflowName:null==a?void 0:a.attributes.find((function(t){return"name"===t.name})),triggers:c,jobs:e.filter((function(t){return"job"===t.definition.type})),getAttributes:function(t){return t.attributes.filter((function(t){var e=t.name;return"workflow_id"!==e&&"job_id"!==e}))},getTriggerAttribute:function(t,e){return t.attributes.find((function(t){return t.name===e}))},getSteps:function(t){return l.filter((function(e){return e.attributes.some((function(e){var n=e.name,r=e.value;return"job_id"===n&&r===t}))}))}}).trim(),"\n");i.push(new t.FileInput({path:o,content:u})),n.pluginData.emitEvent({id:s,status:"success"})})),i}}],r&&jr(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),a}(t.DefaultRender);const Br=Mr,Dr=JSON.parse('{"u2":"githubator-plugin","i8":"0.1.1"}');function Fr(t){return Fr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Fr(t)}function Kr(t,e){return Kr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Kr(t,e)}function $r(t){return $r=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},$r(t)}const Vr=function(e){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Kr(t,e)}(s,e);var n,r,i,o=(r=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=$r(r);if(i){var n=$r(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===Fr(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function s(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{event:null};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s);var n=new t.DefaultData({name:Dr.u2,version:Dr.i8,defaultFileName:"new_workflow.yml"},e.event);return o.call(this,{pluginData:n,pluginDrawer:new u(n),pluginMetadata:new N(n),pluginParser:new Tr(n),pluginRenderer:new Br(n)})}return n=s,Object.defineProperty(n,"prototype",{writable:!1}),n}(t.DefaultPlugin)})();var i=exports;for(var o in r)i[o]=r[o];r.__esModule&&Object.defineProperty(i,"__esModule",{value:!0})})(); \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 1defa09..f48c92c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "githubator-plugin", - "version": "0.1.0", + "version": "0.1.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "githubator-plugin", - "version": "0.1.0", + "version": "0.1.1", "license": "Mozilla Public License 2.0", "dependencies": { "leto-modelizer-plugin-core": "github:ditrit/leto-modelizer-plugin-core#0.15.2", diff --git a/package.json b/package.json index 5f64211..97f2111 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "githubator-plugin", - "version": "0.1.0", + "version": "0.1.1", "description": "Github action plugin for Leto modelizer.", "main": "dist/githubator-plugin.js", "exports": "./dist/githubator-plugin.js",