From e366aef7ca799645bf7305def70eb3fd9243eb95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vincent=20Moitti=C3=A9?= Date: Wed, 3 May 2023 10:43:58 +0200 Subject: [PATCH] Release version 0.1.0 --- changelog.md | 4 +++- dist/githubator-plugin.js | 2 ++ dist/githubator-plugin.js.LICENSE.txt | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 dist/githubator-plugin.js create mode 100644 dist/githubator-plugin.js.LICENSE.txt diff --git a/changelog.md b/changelog.md index 8c3ad17..73f7e8b 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.0] - 2023/05/03 ### Added @@ -14,3 +14,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Setup first version of metadata. - Setup first version of parser. - Setup first version of renderer. + +[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 new file mode 100644 index 0000000..f2599ea --- /dev/null +++ b/dist/githubator-plugin.js @@ -0,0 +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