@meirblachman/azure-pipelines-visualizer 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.min.js +38 -0
- package/dist/web/assets/codicon-ngg6Pgfi.ttf +0 -0
- package/dist/web/assets/editor.worker-CKy7Pnvo.js +26 -0
- package/dist/web/assets/index-C9Zf3xe0.css +1 -0
- package/dist/web/assets/index-JpyNww-f.js +946 -0
- package/dist/web/assets/react-vendor-Bdswto6F.js +1 -0
- package/dist/web/assets/reactflow-BBgD8bXw.js +62 -0
- package/dist/web/assets/yaml-BVLUzZZ3.js +1 -0
- package/dist/web/index.html +18 -0
- package/package.json +31 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{existsSync as xt,readFileSync as vt}from"node:fs";import{extname as ma,join as kr}from"node:path";import{fileURLToPath as ga}from"node:url";import{createServer as Rt}from"http";import{Http2ServerRequest as Ir,constants as wt}from"http2";import{Http2ServerRequest as We}from"http2";import{Readable as Pr}from"stream";import Ft from"crypto";var N=class extends Error{constructor(e,r){super(e,r),this.name="RequestError"}},Ct=e=>e instanceof N?e:new N(e.message,{cause:e}),Et=global.Request,se=class extends Et{constructor(e,r){typeof e=="object"&&W in e&&(e=e[W]()),typeof r?.body?.getReader<"u"&&(r.duplex??="half"),super(e,r)}},kt=e=>{let r=[],n=e.rawHeaders;for(let t=0;t<n.length;t+=2){let{[t]:i,[t+1]:o}=n;i.charCodeAt(0)!==58&&r.push([i,o])}return new Headers(r)},_r=Symbol("wrapBodyStream"),St=(e,r,n,t,i)=>{let o={method:e,headers:n,signal:i.signal};if(e==="TRACE"){o.method="GET";let s=new se(r,o);return Object.defineProperty(s,"method",{get(){return"TRACE"}}),s}if(!(e==="GET"||e==="HEAD"))if("rawBody"in t&&t.rawBody instanceof Buffer)o.body=new ReadableStream({start(s){s.enqueue(t.rawBody),s.close()}});else if(t[_r]){let s;o.body=new ReadableStream({async pull(a){try{s||=Pr.toWeb(t).getReader();let{done:l,value:c}=await s.read();l?a.close():a.enqueue(c)}catch(l){a.error(l)}}})}else o.body=Pr.toWeb(t);return new se(r,o)},W=Symbol("getRequestCache"),jr=Symbol("requestCache"),Re=Symbol("incomingKey"),we=Symbol("urlKey"),Tt=Symbol("headersKey"),q=Symbol("abortControllerKey"),Pt=Symbol("getAbortController"),ae={get method(){return this[Re].method||"GET"},get url(){return this[we]},get headers(){return this[Tt]||=kt(this[Re])},[Pt](){return this[W](),this[q]},[W](){return this[q]||=new AbortController,this[jr]||=St(this.method,this[we],this.headers,this[Re],this[q])}};["body","bodyUsed","cache","credentials","destination","integrity","mode","redirect","referrer","referrerPolicy","signal","keepalive"].forEach(e=>{Object.defineProperty(ae,e,{get(){return this[W]()[e]}})});["arrayBuffer","blob","clone","formData","json","text"].forEach(e=>{Object.defineProperty(ae,e,{value:function(){return this[W]()[e]()}})});Object.defineProperty(ae,Symbol.for("nodejs.util.inspect.custom"),{value:function(e,r,n){let t={method:this.method,url:this.url,headers:this.headers,nativeRequest:this[jr]};return`Request (lightweight) ${n(t,{...r,depth:e==null?null:e-1})}`}});Object.setPrototypeOf(ae,se.prototype);var Ot=(e,r)=>{let n=Object.create(ae);n[Re]=e;let t=e.url||"";if(t[0]!=="/"&&(t.startsWith("http://")||t.startsWith("https://"))){if(e instanceof We)throw new N("Absolute URL for :path is not allowed in HTTP/2");try{let a=new URL(t);n[we]=a.href}catch(a){throw new N("Invalid absolute URL",{cause:a})}return n}let i=(e instanceof We?e.authority:e.headers.host)||r;if(!i)throw new N("Missing host header");let o;if(e instanceof We){if(o=e.scheme,!(o==="http"||o==="https"))throw new N("Unsupported scheme")}else o=e.socket&&e.socket.encrypted?"https":"http";let s=new URL(`${o}://${i}${t}`);if(s.hostname.length!==i.length&&s.hostname!==i.replace(/:\d+$/,""))throw new N("Invalid host header");return n[we]=s.href,n},Ke=Symbol("responseCache"),U=Symbol("getResponseCache"),L=Symbol("cache"),Je=global.Response,G=class Fr{#r;#e;[U](){return delete this[L],this[Ke]||=new Je(this.#r,this.#e)}constructor(r,n){let t;if(this.#r=r,n instanceof Fr){let i=n[Ke];if(i){this.#e=i,this[U]();return}else this.#e=n.#e,t=new Headers(n.#e.headers)}else this.#e=n;(typeof r=="string"||typeof r?.getReader<"u"||r instanceof Blob||r instanceof Uint8Array)&&(this[L]=[n?.status||200,r,t||n?.headers])}get headers(){let r=this[L];return r?(r[2]instanceof Headers||(r[2]=new Headers(r[2]||{"content-type":"text/plain; charset=UTF-8"})),r[2]):this[U]().headers}get status(){return this[L]?.[0]??this[U]().status}get ok(){let r=this.status;return r>=200&&r<300}};["body","bodyUsed","redirected","statusText","trailers","type","url"].forEach(e=>{Object.defineProperty(G.prototype,e,{get(){return this[U]()[e]}})});["arrayBuffer","blob","clone","formData","json","text"].forEach(e=>{Object.defineProperty(G.prototype,e,{value:function(){return this[U]()[e]()}})});Object.defineProperty(G.prototype,Symbol.for("nodejs.util.inspect.custom"),{value:function(e,r,n){let t={status:this.status,headers:this.headers,ok:this.ok,nativeResponse:this[Ke]};return`Response (lightweight) ${n(t,{...r,depth:e==null?null:e-1})}`}});Object.setPrototypeOf(G,Je);Object.setPrototypeOf(G.prototype,Je.prototype);async function It(e){return Promise.race([e,Promise.resolve().then(()=>Promise.resolve(void 0))])}function Nr(e,r,n){let t=a=>{e.cancel(a).catch(()=>{})};return r.on("close",t),r.on("error",t),(n??e.read()).then(s,i),e.closed.finally(()=>{r.off("close",t),r.off("error",t)});function i(a){a&&r.destroy(a)}function o(){e.read().then(s,i)}function s({done:a,value:l}){try{if(a)r.end();else if(!r.write(l))r.once("drain",o);else return e.read().then(s,i)}catch(c){i(c)}}}function _t(e,r){if(e.locked)throw new TypeError("ReadableStream is locked.");return r.destroyed?void 0:Nr(e.getReader(),r)}var Ye=e=>{let r={};e instanceof Headers||(e=new Headers(e??void 0));let n=[];for(let[t,i]of e)t==="set-cookie"?n.push(i):r[t]=i;return n.length>0&&(r["set-cookie"]=n),r["content-type"]??="text/plain; charset=UTF-8",r},jt="x-hono-already-sent";typeof global.crypto>"u"&&(global.crypto=Ft);var Qe=Symbol("outgoingEnded"),Or=Symbol("incomingDraining"),Nt=500,Lt=64*1024*1024,Ge=e=>{let r=e;if(e.destroyed||r[Or])return;if(r[Or]=!0,e instanceof Ir){try{e.stream?.close?.(wt.NGHTTP2_NO_ERROR)}catch{}return}let n=0,t=()=>{clearTimeout(o),e.off("data",s),e.off("end",t),e.off("error",t)},i=()=>{t();let a=e.socket;a&&!a.destroyed&&a.destroySoon()},o=setTimeout(i,Nt);o.unref?.();let s=a=>{n+=a.length,n>Lt&&i()};e.on("data",s),e.on("end",t),e.on("error",t),e.resume()},Dt=()=>new Response(null,{status:400}),Lr=e=>new Response(null,{status:e instanceof Error&&(e.name==="TimeoutError"||e.constructor.name==="TimeoutError")?504:500}),Ve=(e,r)=>{let n=e instanceof Error?e:new Error("unknown error",{cause:e});n.code==="ERR_STREAM_PREMATURE_CLOSE"?console.info("The user aborted a request."):(console.error(e),r.headersSent||r.writeHead(500,{"Content-Type":"text/plain"}),r.end(`Error: ${n.message}`),r.destroy(n))},Dr=e=>{"flushHeaders"in e&&e.writable&&e.flushHeaders()},Mr=async(e,r)=>{let[n,t,i]=e[L],o=!1;if(!i)i={"content-type":"text/plain; charset=UTF-8"};else if(i instanceof Headers)o=i.has("content-length"),i=Ye(i);else if(Array.isArray(i)){let s=new Headers(i);o=s.has("content-length"),i=Ye(s)}else for(let s in i)if(s.length===14&&s.toLowerCase()==="content-length"){o=!0;break}o||(typeof t=="string"?i["Content-Length"]=Buffer.byteLength(t):t instanceof Uint8Array?i["Content-Length"]=t.byteLength:t instanceof Blob&&(i["Content-Length"]=t.size)),r.writeHead(n,i),typeof t=="string"||t instanceof Uint8Array?r.end(t):t instanceof Blob?r.end(new Uint8Array(await t.arrayBuffer())):(Dr(r),await _t(t,r)?.catch(s=>Ve(s,r))),r[Qe]?.()},Mt=e=>typeof e.then=="function",$t=async(e,r,n={})=>{if(Mt(e))if(n.errorHandler)try{e=await e}catch(i){let o=await n.errorHandler(i);if(!o)return;e=o}else e=await e.catch(Lr);if(L in e)return Mr(e,r);let t=Ye(e.headers);if(e.body){let i=e.body.getReader(),o=[],s=!1,a;if(t["transfer-encoding"]!=="chunked"){let l=2;for(let c=0;c<l;c++){a||=i.read();let f=await It(a).catch(u=>{console.error(u),s=!0});if(!f){if(c===1){await new Promise(u=>setTimeout(u)),l=3;continue}break}if(a=void 0,f.value&&o.push(f.value),f.done){s=!0;break}}s&&!("content-length"in t)&&(t["content-length"]=o.reduce((c,f)=>c+f.length,0))}r.writeHead(e.status,t),o.forEach(l=>{r.write(l)}),s?r.end():(o.length===0&&Dr(r),await Nr(i,r,a))}else t[jt]||(r.writeHead(e.status,t),r.end());r[Qe]?.()},Ht=(e,r={})=>{let n=r.autoCleanupIncoming??!0;return r.overrideGlobalObjects!==!1&&global.Request!==se&&(Object.defineProperty(global,"Request",{value:se}),Object.defineProperty(global,"Response",{value:G})),async(t,i)=>{let o,s;try{s=Ot(t,r.hostname);let a=!n||t.method==="GET"||t.method==="HEAD";if(a||(t[_r]=!0,t.on("end",()=>{a=!0}),t instanceof Ir&&(i[Qe]=()=>{a||setTimeout(()=>{a||setTimeout(()=>{Ge(t)})})}),i.on("finish",()=>{a||Ge(t)})),i.on("close",()=>{s[q]&&(t.errored?s[q].abort(t.errored.toString()):i.writableFinished||s[q].abort("Client connection prematurely closed.")),a||setTimeout(()=>{a||setTimeout(()=>{Ge(t)})})}),o=e(s,{incoming:t,outgoing:i}),L in o)return Mr(o,i)}catch(a){if(o)return Ve(a,i);if(r.errorHandler){if(o=await r.errorHandler(s?a:Ct(a)),!o)return}else s?o=Lr(a):o=Dt()}try{return await $t(o,i,r)}catch(a){return Ve(a,i)}}},Bt=e=>{let r=e.fetch,n=Ht(r,{hostname:e.hostname,overrideGlobalObjects:e.overrideGlobalObjects,autoCleanupIncoming:e.autoCleanupIncoming});return(e.createServer||Rt)(e.serverOptions||{},n)},$r=(e,r)=>{let n=Bt(e);return n.listen(e?.port??3e3,e.hostname,()=>{let t=n.address();r&&r(t)}),n};var Xe=(e,r,n)=>(t,i)=>{let o=-1;return s(0);async function s(a){if(a<=o)throw new Error("next() called multiple times");o=a;let l,c=!1,f;if(e[a]?(f=e[a][0][0],t.req.routeIndex=a):f=a===e.length&&i||void 0,f)try{l=await f(t,()=>s(a+1))}catch(u){if(u instanceof Error&&r)t.error=u,l=await r(u,t),c=!0;else throw u}else t.finalized===!1&&n&&(l=await n(t));return l&&(t.finalized===!1||c)&&(t.res=l),t}};var Hr=Symbol();var Br=async(e,r=Object.create(null))=>{let{all:n=!1,dot:t=!1}=r,o=(e instanceof Ce?e.raw.headers:e.headers).get("Content-Type");return o?.startsWith("multipart/form-data")||o?.startsWith("application/x-www-form-urlencoded")?zt(e,{all:n,dot:t}):{}};async function zt(e,r){let n=await e.formData();return n?Ut(n,r):{}}function Ut(e,r){let n=Object.create(null);return e.forEach((t,i)=>{r.all||i.endsWith("[]")?qt(n,i,t):n[i]=t}),r.dot&&Object.entries(n).forEach(([t,i])=>{t.includes(".")&&(Wt(n,t,i),delete n[t])}),n}var qt=(e,r,n)=>{e[r]!==void 0?Array.isArray(e[r])?e[r].push(n):e[r]=[e[r],n]:r.endsWith("[]")?e[r]=[n]:e[r]=n},Wt=(e,r,n)=>{if(/(?:^|\.)__proto__\./.test(r))return;let t=e,i=r.split(".");i.forEach((o,s)=>{s===i.length-1?t[o]=n:((!t[o]||typeof t[o]!="object"||Array.isArray(t[o])||t[o]instanceof File)&&(t[o]=Object.create(null)),t=t[o])})};var er=e=>{let r=e.split("/");return r[0]===""&&r.shift(),r},zr=e=>{let{groups:r,path:n}=Gt(e),t=er(n);return Kt(t,r)},Gt=e=>{let r=[];return e=e.replace(/\{[^}]+\}/g,(n,t)=>{let i=`@${t}`;return r.push([i,n]),i}),{groups:r,path:e}},Kt=(e,r)=>{for(let n=r.length-1;n>=0;n--){let[t]=r[n];for(let i=e.length-1;i>=0;i--)if(e[i].includes(t)){e[i]=e[i].replace(t,r[n][1]);break}}return e},Ee={},Ur=(e,r)=>{if(e==="*")return"*";let n=e.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);if(n){let t=`${e}#${r}`;return Ee[t]||(n[2]?Ee[t]=r&&r[0]!==":"&&r[0]!=="*"?[t,n[1],new RegExp(`^${n[2]}(?=/${r})`)]:[e,n[1],new RegExp(`^${n[2]}$`)]:Ee[t]=[e,n[1],!0]),Ee[t]}return null},ke=(e,r)=>{try{return r(e)}catch{return e.replace(/(?:%[0-9A-Fa-f]{2})+/g,n=>{try{return r(n)}catch{return n}})}},Yt=e=>ke(e,decodeURI),rr=e=>{let r=e.url,n=r.indexOf("/",r.indexOf(":")+4),t=n;for(;t<r.length;t++){let i=r.charCodeAt(t);if(i===37){let o=r.indexOf("?",t),s=r.indexOf("#",t),a=o===-1?s===-1?void 0:s:s===-1?o:Math.min(o,s),l=r.slice(n,a);return Yt(l.includes("%25")?l.replace(/%25/g,"%2525"):l)}else if(i===63||i===35)break}return r.slice(n,t)};var qr=e=>{let r=rr(e);return r.length>1&&r.at(-1)==="/"?r.slice(0,-1):r},D=(e,r,...n)=>(n.length&&(r=D(r,...n)),`${e?.[0]==="/"?"":"/"}${e}${r==="/"?"":`${e?.at(-1)==="/"?"":"/"}${r?.[0]==="/"?r.slice(1):r}`}`),Se=e=>{if(e.charCodeAt(e.length-1)!==63||!e.includes(":"))return null;let r=e.split("/"),n=[],t="";return r.forEach(i=>{if(i!==""&&!/\:/.test(i))t+="/"+i;else if(/\:/.test(i))if(/\?/.test(i)){n.length===0&&t===""?n.push("/"):n.push(t);let o=i.replace("?","");t+="/"+o,n.push(t)}else t+="/"+i}),n.filter((i,o,s)=>s.indexOf(i)===o)},Ze=e=>/[%+]/.test(e)?(e.indexOf("+")!==-1&&(e=e.replace(/\+/g," ")),e.indexOf("%")!==-1?ke(e,nr):e):e,Wr=(e,r,n)=>{let t;if(!n&&r&&!/[%+]/.test(r)){let s=e.indexOf("?",8);if(s===-1)return;for(e.startsWith(r,s+1)||(s=e.indexOf(`&${r}`,s+1));s!==-1;){let a=e.charCodeAt(s+r.length+1);if(a===61){let l=s+r.length+2,c=e.indexOf("&",l);return Ze(e.slice(l,c===-1?void 0:c))}else if(a==38||isNaN(a))return"";s=e.indexOf(`&${r}`,s+1)}if(t=/[%+]/.test(e),!t)return}let i={};t??=/[%+]/.test(e);let o=e.indexOf("?",8);for(;o!==-1;){let s=e.indexOf("&",o+1),a=e.indexOf("=",o);a>s&&s!==-1&&(a=-1);let l=e.slice(o+1,a===-1?s===-1?void 0:s:a);if(t&&(l=Ze(l)),o=s,l==="")continue;let c;a===-1?c="":(c=e.slice(a+1,s===-1?void 0:s),t&&(c=Ze(c))),n?(i[l]&&Array.isArray(i[l])||(i[l]=[]),i[l].push(c)):i[l]??=c}return r?i[r]:i},Gr=Wr,Kr=(e,r)=>Wr(e,r,!0),nr=decodeURIComponent;var Yr=e=>ke(e,nr),Ce=class{raw;#r;#e;routeIndex=0;path;bodyCache={};constructor(e,r="/",n=[[]]){this.raw=e,this.path=r,this.#e=n,this.#r={}}param(e){return e?this.#n(e):this.#o()}#n(e){let r=this.#e[0][this.routeIndex][1][e],n=this.#i(r);return n&&/\%/.test(n)?Yr(n):n}#o(){let e={},r=Object.keys(this.#e[0][this.routeIndex][1]);for(let n of r){let t=this.#i(this.#e[0][this.routeIndex][1][n]);t!==void 0&&(e[n]=/\%/.test(t)?Yr(t):t)}return e}#i(e){return this.#e[1]?this.#e[1][e]:e}query(e){return Gr(this.url,e)}queries(e){return Kr(this.url,e)}header(e){if(e)return this.raw.headers.get(e)??void 0;let r={};return this.raw.headers.forEach((n,t)=>{r[t]=n}),r}async parseBody(e){return this.bodyCache.parsedBody??=await Br(this,e)}#t=e=>{let{bodyCache:r,raw:n}=this,t=r[e];if(t)return t;let i=Object.keys(r)[0];return i?r[i].then(o=>(i==="json"&&(o=JSON.stringify(o)),new Response(o)[e]())):r[e]=n[e]()};json(){return this.#t("text").then(e=>JSON.parse(e))}text(){return this.#t("text")}arrayBuffer(){return this.#t("arrayBuffer")}blob(){return this.#t("blob")}formData(){return this.#t("formData")}addValidatedData(e,r){this.#r[e]=r}valid(e){return this.#r[e]}get url(){return this.raw.url}get method(){return this.raw.method}get[Hr](){return this.#e}get matchedRoutes(){return this.#e[0].map(([[,e]])=>e)}get routePath(){return this.#e[0].map(([[,e]])=>e)[this.routeIndex].path}};var Vr={Stringify:1,BeforeStream:2,Stream:3},Vt=(e,r)=>{let n=new String(e);return n.isEscaped=!0,n.callbacks=r,n};var tr=async(e,r,n,t,i)=>{typeof e=="object"&&!(e instanceof String)&&(e instanceof Promise||(e=e.toString()),e instanceof Promise&&(e=await e));let o=e.callbacks;if(!o?.length)return Promise.resolve(e);i?i[0]+=e:i=[e];let s=Promise.all(o.map(a=>a({phase:r,buffer:i,context:t}))).then(a=>Promise.all(a.filter(Boolean).map(l=>tr(l,r,!1,t,i))).then(()=>i[0]));return n?Vt(await s,o):s};var Jt="text/plain; charset=UTF-8",ir=(e,r)=>({"Content-Type":e,...r}),le=(e,r)=>new Response(e,r),Jr=class{#r;#e;env={};#n;finalized=!1;error;#o;#i;#t;#u;#l;#c;#a;#f;#p;constructor(e,r){this.#r=e,r&&(this.#i=r.executionCtx,this.env=r.env,this.#c=r.notFoundHandler,this.#p=r.path,this.#f=r.matchResult)}get req(){return this.#e??=new Ce(this.#r,this.#p,this.#f),this.#e}get event(){if(this.#i&&"respondWith"in this.#i)return this.#i;throw Error("This context has no FetchEvent")}get executionCtx(){if(this.#i)return this.#i;throw Error("This context has no ExecutionContext")}get res(){return this.#t||=le(null,{headers:this.#a??=new Headers})}set res(e){if(this.#t&&e){e=le(e.body,e);for(let[r,n]of this.#t.headers.entries())if(r!=="content-type")if(r==="set-cookie"){let t=this.#t.headers.getSetCookie();e.headers.delete("set-cookie");for(let i of t)e.headers.append("set-cookie",i)}else e.headers.set(r,n)}this.#t=e,this.finalized=!0}render=(...e)=>(this.#l??=r=>this.html(r),this.#l(...e));setLayout=e=>this.#u=e;getLayout=()=>this.#u;setRenderer=e=>{this.#l=e};header=(e,r,n)=>{this.finalized&&(this.#t=le(this.#t.body,this.#t));let t=this.#t?this.#t.headers:this.#a??=new Headers;r===void 0?t.delete(e):n?.append?t.append(e,r):t.set(e,r)};status=e=>{this.#o=e};set=(e,r)=>{this.#n??=new Map,this.#n.set(e,r)};get=e=>this.#n?this.#n.get(e):void 0;get var(){return this.#n?Object.fromEntries(this.#n):{}}#s(e,r,n){let t=this.#t?new Headers(this.#t.headers):this.#a??new Headers;if(typeof r=="object"&&"headers"in r){let o=r.headers instanceof Headers?r.headers:new Headers(r.headers);for(let[s,a]of o)s.toLowerCase()==="set-cookie"?t.append(s,a):t.set(s,a)}if(n)for(let[o,s]of Object.entries(n))if(typeof s=="string")t.set(o,s);else{t.delete(o);for(let a of s)t.append(o,a)}let i=typeof r=="number"?r:r?.status??this.#o;return le(e,{status:i,headers:t})}newResponse=(...e)=>this.#s(...e);body=(e,r,n)=>this.#s(e,r,n);text=(e,r,n)=>!this.#a&&!this.#o&&!r&&!n&&!this.finalized?new Response(e):this.#s(e,r,ir(Jt,n));json=(e,r,n)=>this.#s(JSON.stringify(e),r,ir("application/json",n));html=(e,r,n)=>{let t=i=>this.#s(i,r,ir("text/html; charset=UTF-8",n));return typeof e=="object"?tr(e,Vr.Stringify,!1,{}).then(t):t(e)};redirect=(e,r)=>{let n=String(e);return this.header("Location",/[^\x00-\xFF]/.test(n)?encodeURI(n):n),this.newResponse(null,r??302)};notFound=()=>(this.#c??=()=>le(),this.#c(this))};var A="ALL",Qr="all",Xr=["get","post","put","delete","options","patch"],Te="Can not add a route since the matcher is already built.",Pe=class extends Error{};var Zr="__COMPOSED_HANDLER";var Qt=e=>e.text("404 Not Found",404),en=(e,r)=>{if("getResponse"in e){let n=e.getResponse();return r.newResponse(n.body,n)}return console.error(e),r.text("Internal Server Error",500)},rn=class nn{get;post;put;delete;options;patch;all;on;use;router;getPath;_basePath="/";#r="/";routes=[];constructor(r={}){[...Xr,Qr].forEach(o=>{this[o]=(s,...a)=>(typeof s=="string"?this.#r=s:this.#o(o,this.#r,s),a.forEach(l=>{this.#o(o,this.#r,l)}),this)}),this.on=(o,s,...a)=>{for(let l of[s].flat()){this.#r=l;for(let c of[o].flat())a.map(f=>{this.#o(c.toUpperCase(),this.#r,f)})}return this},this.use=(o,...s)=>(typeof o=="string"?this.#r=o:(this.#r="*",s.unshift(o)),s.forEach(a=>{this.#o(A,this.#r,a)}),this);let{strict:t,...i}=r;Object.assign(this,i),this.getPath=t??!0?r.getPath??rr:qr}#e(){let r=new nn({router:this.router,getPath:this.getPath});return r.errorHandler=this.errorHandler,r.#n=this.#n,r.routes=this.routes,r}#n=Qt;errorHandler=en;route(r,n){let t=this.basePath(r);return n.routes.map(i=>{let o;n.errorHandler===en?o=i.handler:(o=async(s,a)=>(await Xe([],n.errorHandler)(s,()=>i.handler(s,a))).res,o[Zr]=i.handler),t.#o(i.method,i.path,o)}),this}basePath(r){let n=this.#e();return n._basePath=D(this._basePath,r),n}onError=r=>(this.errorHandler=r,this);notFound=r=>(this.#n=r,this);mount(r,n,t){let i,o;t&&(typeof t=="function"?o=t:(o=t.optionHandler,t.replaceRequest===!1?i=l=>l:i=t.replaceRequest));let s=o?l=>{let c=o(l);return Array.isArray(c)?c:[c]}:l=>{let c;try{c=l.executionCtx}catch{}return[l.env,c]};i||=(()=>{let l=D(this._basePath,r),c=l==="/"?0:l.length;return f=>{let u=new URL(f.url);return u.pathname=u.pathname.slice(c)||"/",new Request(u,f)}})();let a=async(l,c)=>{let f=await n(i(l.req.raw),...s(l));if(f)return f;await c()};return this.#o(A,D(r,"*"),a),this}#o(r,n,t){r=r.toUpperCase(),n=D(this._basePath,n);let i={basePath:this._basePath,path:n,method:r,handler:t};this.router.add(r,n,[t,i]),this.routes.push(i)}#i(r,n){if(r instanceof Error)return this.errorHandler(r,n);throw r}#t(r,n,t,i){if(i==="HEAD")return(async()=>new Response(null,await this.#t(r,n,t,"GET")))();let o=this.getPath(r,{env:t}),s=this.router.match(i,o),a=new Jr(r,{path:o,matchResult:s,env:t,executionCtx:n,notFoundHandler:this.#n});if(s[0].length===1){let c;try{c=s[0][0][0][0](a,async()=>{a.res=await this.#n(a)})}catch(f){return this.#i(f,a)}return c instanceof Promise?c.then(f=>f||(a.finalized?a.res:this.#n(a))).catch(f=>this.#i(f,a)):c??this.#n(a)}let l=Xe(s[0],this.errorHandler,this.#n);return(async()=>{try{let c=await l(a);if(!c.finalized)throw new Error("Context is not finalized. Did you forget to return a Response object or `await next()`?");return c.res}catch(c){return this.#i(c,a)}})()}fetch=(r,...n)=>this.#t(r,n[1],n[0],r.method);request=(r,n,t,i)=>r instanceof Request?this.fetch(n?new Request(r,n):r,t,i):(r=r.toString(),this.fetch(new Request(/^https?:\/\//.test(r)?r:`http://localhost${D("/",r)}`,n),t,i));fire=()=>{addEventListener("fetch",r=>{r.respondWith(this.#t(r.request,r,void 0,r.request.method))})}};var Oe=[];function or(e,r){let n=this.buildAllMatchers(),t=((i,o)=>{let s=n[i]||n[A],a=s[2][o];if(a)return a;let l=o.match(s[0]);if(!l)return[[],Oe];let c=l.indexOf("",1);return[s[1][c],l]});return this.match=t,t(e,r)}var Ie="[^/]+",ce=".*",ue="(?:|/.*)",M=Symbol(),Xt=new Set(".\\+*[^]$()");function Zt(e,r){return e.length===1?r.length===1?e<r?-1:1:-1:r.length===1||e===ce||e===ue?1:r===ce||r===ue?-1:e===Ie?1:r===Ie?-1:e.length===r.length?e<r?-1:1:r.length-e.length}var tn=class sr{#r;#e;#n=Object.create(null);insert(r,n,t,i,o){if(r.length===0){if(this.#r!==void 0)throw M;if(o)return;this.#r=n;return}let[s,...a]=r,l=s==="*"?a.length===0?["","",ce]:["","",Ie]:s==="/*"?["","",ue]:s.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/),c;if(l){let f=l[1],u=l[2]||Ie;if(f&&l[2]&&(u===".*"||(u=u.replace(/^\((?!\?:)(?=[^)]+\)$)/,"(?:"),/\((?!\?:)/.test(u))))throw M;if(c=this.#n[u],!c){if(Object.keys(this.#n).some(p=>p!==ce&&p!==ue))throw M;if(o)return;c=this.#n[u]=new sr,f!==""&&(c.#e=i.varIndex++)}!o&&f!==""&&t.push([f,c.#e])}else if(c=this.#n[s],!c){if(Object.keys(this.#n).some(f=>f.length>1&&f!==ce&&f!==ue))throw M;if(o)return;c=this.#n[s]=new sr}c.insert(a,n,t,i,o)}buildRegExpStr(){let n=Object.keys(this.#n).sort(Zt).map(t=>{let i=this.#n[t];return(typeof i.#e=="number"?`(${t})@${i.#e}`:Xt.has(t)?`\\${t}`:t)+i.buildRegExpStr()});return typeof this.#r=="number"&&n.unshift(`#${this.#r}`),n.length===0?"":n.length===1?n[0]:"(?:"+n.join("|")+")"}};var on=class{#r={varIndex:0};#e=new tn;insert(e,r,n){let t=[],i=[];for(let s=0;;){let a=!1;if(e=e.replace(/\{[^}]+\}/g,l=>{let c=`@\\${s}`;return i[s]=[c,l],s++,a=!0,c}),!a)break}let o=e.match(/(?::[^\/]+)|(?:\/\*$)|./g)||[];for(let s=i.length-1;s>=0;s--){let[a]=i[s];for(let l=o.length-1;l>=0;l--)if(o[l].indexOf(a)!==-1){o[l]=o[l].replace(a,i[s][1]);break}}return this.#e.insert(o,r,t,this.#r,n),t}buildRegExp(){let e=this.#e.buildRegExpStr();if(e==="")return[/^$/,[],[]];let r=0,n=[],t=[];return e=e.replace(/#(\d+)|@(\d+)|\.\*\$/g,(i,o,s)=>o!==void 0?(n[++r]=Number(o),"$()"):(s!==void 0&&(t[Number(s)]=++r),"")),[new RegExp(`^${e}`),n,t]}};var ei=[/^$/,[],Object.create(null)],sn=Object.create(null);function an(e){return sn[e]??=new RegExp(e==="*"?"":`^${e.replace(/\/\*$|([.\\+*[^\]$()])/g,(r,n)=>n?`\\${n}`:"(?:|/.*)")}$`)}function ri(){sn=Object.create(null)}function ni(e){let r=new on,n=[];if(e.length===0)return ei;let t=e.map(c=>[!/\*|\/:/.test(c[0]),...c]).sort(([c,f],[u,p])=>c?1:u?-1:f.length-p.length),i=Object.create(null);for(let c=0,f=-1,u=t.length;c<u;c++){let[p,d,m]=t[c];p?i[d]=[m.map(([x])=>[x,Object.create(null)]),Oe]:f++;let y;try{y=r.insert(d,f,p)}catch(x){throw x===M?new Pe(d):x}p||(n[f]=m.map(([x,v])=>{let g=Object.create(null);for(v-=1;v>=0;v--){let[te,Ue]=y[v];g[te]=Ue}return[x,g]}))}let[o,s,a]=r.buildRegExp();for(let c=0,f=n.length;c<f;c++)for(let u=0,p=n[c].length;u<p;u++){let d=n[c][u]?.[1];if(!d)continue;let m=Object.keys(d);for(let y=0,x=m.length;y<x;y++)d[m[y]]=a[d[m[y]]]}let l=[];for(let c in s)l[c]=n[s[c]];return[o,l,i]}function K(e,r){if(e){for(let n of Object.keys(e).sort((t,i)=>i.length-t.length))if(an(n).test(r))return[...e[n]]}}var _e=class{name="RegExpRouter";#r;#e;constructor(){this.#r={[A]:Object.create(null)},this.#e={[A]:Object.create(null)}}add(e,r,n){let t=this.#r,i=this.#e;if(!t||!i)throw new Error(Te);t[e]||[t,i].forEach(a=>{a[e]=Object.create(null),Object.keys(a[A]).forEach(l=>{a[e][l]=[...a[A][l]]})}),r==="/*"&&(r="*");let o=(r.match(/\/:/g)||[]).length;if(/\*$/.test(r)){let a=an(r);e===A?Object.keys(t).forEach(l=>{t[l][r]||=K(t[l],r)||K(t[A],r)||[]}):t[e][r]||=K(t[e],r)||K(t[A],r)||[],Object.keys(t).forEach(l=>{(e===A||e===l)&&Object.keys(t[l]).forEach(c=>{a.test(c)&&t[l][c].push([n,o])})}),Object.keys(i).forEach(l=>{(e===A||e===l)&&Object.keys(i[l]).forEach(c=>a.test(c)&&i[l][c].push([n,o]))});return}let s=Se(r)||[r];for(let a=0,l=s.length;a<l;a++){let c=s[a];Object.keys(i).forEach(f=>{(e===A||e===f)&&(i[f][c]||=[...K(t[f],c)||K(t[A],c)||[]],i[f][c].push([n,o-l+a+1]))})}}match=or;buildAllMatchers(){let e=Object.create(null);return Object.keys(this.#e).concat(Object.keys(this.#r)).forEach(r=>{e[r]||=this.#n(r)}),this.#r=this.#e=void 0,ri(),e}#n(e){let r=[],n=e===A;return[this.#r,this.#e].forEach(t=>{let i=t[e]?Object.keys(t[e]).map(o=>[o,t[e][o]]):[];i.length!==0?(n||=!0,r.push(...i)):e!==A&&r.push(...Object.keys(t[A]).map(o=>[o,t[A][o]]))}),n?ni(r):null}};var ar=class{name="SmartRouter";#r=[];#e=[];constructor(e){this.#r=e.routers}add(e,r,n){if(!this.#e)throw new Error(Te);this.#e.push([e,r,n])}match(e,r){if(!this.#e)throw new Error("Fatal error");let n=this.#r,t=this.#e,i=n.length,o=0,s;for(;o<i;o++){let a=n[o];try{for(let l=0,c=t.length;l<c;l++)a.add(...t[l]);s=a.match(e,r)}catch(l){if(l instanceof Pe)continue;throw l}this.match=a.match.bind(a),this.#r=[a],this.#e=void 0;break}if(o===i)throw new Error("Fatal error");return this.name=`SmartRouter + ${this.activeRouter.name}`,s}get activeRouter(){if(this.#e||this.#r.length!==1)throw new Error("No active router has been determined yet.");return this.#r[0]}};var fe=Object.create(null),ti=e=>{for(let r in e)return!0;return!1},ln=class cn{#r;#e;#n;#o=0;#i=fe;constructor(r,n,t){if(this.#e=t||Object.create(null),this.#r=[],r&&n){let i=Object.create(null);i[r]={handler:n,possibleKeys:[],score:0},this.#r=[i]}this.#n=[]}insert(r,n,t){this.#o=++this.#o;let i=this,o=zr(n),s=[];for(let a=0,l=o.length;a<l;a++){let c=o[a],f=o[a+1],u=Ur(c,f),p=Array.isArray(u)?u[0]:c;if(p in i.#e){i=i.#e[p],u&&s.push(u[1]);continue}i.#e[p]=new cn,u&&(i.#n.push(u),s.push(u[1])),i=i.#e[p]}return i.#r.push({[r]:{handler:t,possibleKeys:s.filter((a,l,c)=>c.indexOf(a)===l),score:this.#o}}),i}#t(r,n,t,i,o){for(let s=0,a=n.#r.length;s<a;s++){let l=n.#r[s],c=l[t]||l[A],f={};if(c!==void 0&&(c.params=Object.create(null),r.push(c),i!==fe||o&&o!==fe))for(let u=0,p=c.possibleKeys.length;u<p;u++){let d=c.possibleKeys[u],m=f[c.score];c.params[d]=o?.[d]&&!m?o[d]:i[d]??o?.[d],f[c.score]=!0}}}search(r,n){let t=[];this.#i=fe;let o=[this],s=er(n),a=[],l=s.length,c=null;for(let f=0;f<l;f++){let u=s[f],p=f===l-1,d=[];for(let y=0,x=o.length;y<x;y++){let v=o[y],g=v.#e[u];g&&(g.#i=v.#i,p?(g.#e["*"]&&this.#t(t,g.#e["*"],r,v.#i),this.#t(t,g,r,v.#i)):d.push(g));for(let te=0,Ue=v.#n.length;te<Ue;te++){let Sr=v.#n[te],_=v.#i===fe?{}:{...v.#i};if(Sr==="*"){let z=v.#e["*"];z&&(this.#t(t,z,r,v.#i),z.#i=_,d.push(z));continue}let[bt,Tr,ie]=Sr;if(!u&&!(ie instanceof RegExp))continue;let P=v.#e[bt];if(ie instanceof RegExp){if(c===null){c=new Array(l);let be=n[0]==="/"?1:0;for(let oe=0;oe<l;oe++)c[oe]=be,be+=s[oe].length+1}let z=n.substring(c[f]),qe=ie.exec(z);if(qe){if(_[Tr]=qe[0],this.#t(t,P,r,v.#i,_),ti(P.#e)){P.#i=_;let be=qe[0].match(/\//)?.length??0;(a[be]||=[]).push(P)}continue}}(ie===!0||ie.test(u))&&(_[Tr]=u,p?(this.#t(t,P,r,_,v.#i),P.#e["*"]&&this.#t(t,P.#e["*"],r,_,v.#i)):(P.#i=_,d.push(P)))}}let m=a.shift();o=m?d.concat(m):d}return t.length>1&&t.sort((f,u)=>f.score-u.score),[t.map(({handler:f,params:u})=>[f,u])]}};var lr=class{name="TrieRouter";#r;constructor(){this.#r=new ln}add(e,r,n){let t=Se(r);if(t){for(let i=0,o=t.length;i<o;i++)this.#r.insert(e,t[i],n);return}this.#r.insert(e,r,n)}match(e,r){return this.#r.search(e,r)}};var O=class extends rn{constructor(e={}){super(e),this.router=e.router??new ar({routers:[new _e,new lr]})}};var un=e=>{let n={...{origin:"*",allowMethods:["GET","HEAD","PUT","POST","DELETE","PATCH"],allowHeaders:[],exposeHeaders:[]},...e},t=(o=>typeof o=="string"?o==="*"?()=>o:s=>o===s?s:null:typeof o=="function"?o:s=>o.includes(s)?s:null)(n.origin),i=(o=>typeof o=="function"?o:Array.isArray(o)?()=>o:()=>[])(n.allowMethods);return async function(s,a){function l(f,u){s.res.headers.set(f,u)}let c=await t(s.req.header("origin")||"",s);if(c&&l("Access-Control-Allow-Origin",c),n.credentials&&l("Access-Control-Allow-Credentials","true"),n.exposeHeaders?.length&&l("Access-Control-Expose-Headers",n.exposeHeaders.join(",")),s.req.method==="OPTIONS"){n.origin!=="*"&&l("Vary","Origin"),n.maxAge!=null&&l("Access-Control-Max-Age",n.maxAge.toString());let f=await i(s.req.header("origin")||"",s);f.length&&l("Access-Control-Allow-Methods",f.join(","));let u=n.allowHeaders;if(!u?.length){let p=s.req.header("Access-Control-Request-Headers");p&&(u=p.split(/\s*,\s*/))}return u?.length&&(l("Access-Control-Allow-Headers",u.join(",")),s.res.headers.append("Vary","Access-Control-Request-Headers")),s.res.headers.delete("Content-Length"),s.res.headers.delete("Content-Type"),new Response(null,{headers:s.res.headers,status:204,statusText:"No Content"})}await a(),n.origin!=="*"&&s.header("Vary","Origin",{append:!0})}};function ii(){let{process:e,Deno:r}=globalThis;return!(typeof r?.noColor=="boolean"?r.noColor:e!==void 0?"NO_COLOR"in e?.env:!1)}async function fn(){let{navigator:e}=globalThis,r="cloudflare:workers";return!(e!==void 0&&e.userAgent==="Cloudflare-Workers"?await(async()=>{try{return"NO_COLOR"in((await import(r)).env??{})}catch{return!1}})():!ii())}var oi=e=>{let[r,n]=[",","."];return e.map(i=>i.replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+r)).join(n)},si=e=>{let r=Date.now()-e;return oi([r<1e3?r+"ms":Math.round(r/1e3)+"s"])},ai=async e=>{if(await fn())switch(e/100|0){case 5:return`\x1B[31m${e}\x1B[0m`;case 4:return`\x1B[33m${e}\x1B[0m`;case 3:return`\x1B[36m${e}\x1B[0m`;case 2:return`\x1B[32m${e}\x1B[0m`}return`${e}`};async function pn(e,r,n,t,i=0,o){let s=r==="<--"?`${r} ${n} ${t}`:`${r} ${n} ${t} ${await ai(i)} ${o}`;e(s)}var dn=(e=console.log)=>async function(n,t){let{method:i,url:o}=n.req,s=o.slice(o.indexOf("/",8));await pn(e,"<--",i,s);let a=Date.now();await t(),await pn(e,"-->",i,s,n.res.status,si(a))};import{existsSync as li,readFileSync as ci}from"node:fs";import{dirname as ui,resolve as hn}from"node:path";import{fileURLToPath as fi}from"node:url";var mn="apv.config.json",$=null;function Y(){if($)return $;let r=[process.env.APV_CONFIG,hn(process.cwd(),mn),hn(ui(fi(import.meta.url)),"..","..","..",mn)].filter(Boolean);for(let n of r)if(li(n))try{let t=ci(n,"utf-8"),i=JSON.parse(t);return $={cacheDir:i.cacheDir,localRepos:i.localRepos??{},customTaskDocs:i.customTaskDocs??{}},console.log(`Loaded config from ${n}`),pi($),$}catch(t){console.warn(`Failed to parse ${n}:`,t)}return $={localRepos:{},customTaskDocs:{}},$}function gn(e,r,n){let t=Y(),i=`${e}/${r}/${n}`;if(t.localRepos[i])return t.localRepos[i];let o=i.toLowerCase();for(let[s,a]of Object.entries(t.localRepos))if(s.toLowerCase()===o)return a}function pi(e){let r=Object.entries(e.localRepos);if(r.length===0){console.log(" No local repo mappings configured");return}console.log(` ${r.length} local repo mapping(s):`);for(let[n,t]of r)console.log(` ${n} \u2192 ${t}`)}function je(e){let r=e.startsWith("/"),n=e.split("/").filter(o=>o!==""&&o!=="."),t=[];for(let o of n)o===".."?t.length>0&&t[t.length-1]!==".."?t.pop():r||t.push(o):t.push(o);let i=t.join("/");return r?`/${i}`:i}function _n(e){return typeof e>"u"||e===null}function hi(e){return typeof e=="object"&&e!==null}function mi(e){return Array.isArray(e)?e:_n(e)?[]:[e]}function gi(e,r){var n,t,i,o;if(r)for(o=Object.keys(r),n=0,t=o.length;n<t;n+=1)i=o[n],e[i]=r[i];return e}function yi(e,r){var n="",t;for(t=0;t<r;t+=1)n+=e;return n}function xi(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var vi=_n,Ai=hi,bi=mi,Ri=yi,wi=xi,Ci=gi,R={isNothing:vi,isObject:Ai,toArray:bi,repeat:Ri,isNegativeZero:wi,extend:Ci};function jn(e,r){var n="",t=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(n+='in "'+e.mark.name+'" '),n+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!r&&e.mark.snippet&&(n+=`
|
|
3
|
+
|
|
4
|
+
`+e.mark.snippet),t+" "+n):t}function de(e,r){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=r,this.message=jn(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}de.prototype=Object.create(Error.prototype);de.prototype.constructor=de;de.prototype.toString=function(r){return this.name+": "+jn(this,r)};var E=de;function cr(e,r,n,t,i){var o="",s="",a=Math.floor(i/2)-1;return t-r>a&&(o=" ... ",r=t-a+o.length),n-t>a&&(s=" ...",n=t+a-s.length),{str:o+e.slice(r,n).replace(/\t/g,"\u2192")+s,pos:t-r+o.length}}function ur(e,r){return R.repeat(" ",r-e.length)+e}function Ei(e,r){if(r=Object.create(r||null),!e.buffer)return null;r.maxLength||(r.maxLength=79),typeof r.indent!="number"&&(r.indent=1),typeof r.linesBefore!="number"&&(r.linesBefore=3),typeof r.linesAfter!="number"&&(r.linesAfter=2);for(var n=/\r?\n|\r|\0/g,t=[0],i=[],o,s=-1;o=n.exec(e.buffer);)i.push(o.index),t.push(o.index+o[0].length),e.position<=o.index&&s<0&&(s=t.length-2);s<0&&(s=t.length-1);var a="",l,c,f=Math.min(e.line+r.linesAfter,i.length).toString().length,u=r.maxLength-(r.indent+f+3);for(l=1;l<=r.linesBefore&&!(s-l<0);l++)c=cr(e.buffer,t[s-l],i[s-l],e.position-(t[s]-t[s-l]),u),a=R.repeat(" ",r.indent)+ur((e.line-l+1).toString(),f)+" | "+c.str+`
|
|
5
|
+
`+a;for(c=cr(e.buffer,t[s],i[s],e.position,u),a+=R.repeat(" ",r.indent)+ur((e.line+1).toString(),f)+" | "+c.str+`
|
|
6
|
+
`,a+=R.repeat("-",r.indent+f+3+c.pos)+`^
|
|
7
|
+
`,l=1;l<=r.linesAfter&&!(s+l>=i.length);l++)c=cr(e.buffer,t[s+l],i[s+l],e.position-(t[s]-t[s+l]),u),a+=R.repeat(" ",r.indent)+ur((e.line+l+1).toString(),f)+" | "+c.str+`
|
|
8
|
+
`;return a.replace(/\n$/,"")}var ki=Ei,Si=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],Ti=["scalar","sequence","mapping"];function Pi(e){var r={};return e!==null&&Object.keys(e).forEach(function(n){e[n].forEach(function(t){r[String(t)]=n})}),r}function Oi(e,r){if(r=r||{},Object.keys(r).forEach(function(n){if(Si.indexOf(n)===-1)throw new E('Unknown option "'+n+'" is met in definition of "'+e+'" YAML type.')}),this.options=r,this.tag=e,this.kind=r.kind||null,this.resolve=r.resolve||function(){return!0},this.construct=r.construct||function(n){return n},this.instanceOf=r.instanceOf||null,this.predicate=r.predicate||null,this.represent=r.represent||null,this.representName=r.representName||null,this.defaultStyle=r.defaultStyle||null,this.multi=r.multi||!1,this.styleAliases=Pi(r.styleAliases||null),Ti.indexOf(this.kind)===-1)throw new E('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var w=Oi;function yn(e,r){var n=[];return e[r].forEach(function(t){var i=n.length;n.forEach(function(o,s){o.tag===t.tag&&o.kind===t.kind&&o.multi===t.multi&&(i=s)}),n[i]=t}),n}function Ii(){var e={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},r,n;function t(i){i.multi?(e.multi[i.kind].push(i),e.multi.fallback.push(i)):e[i.kind][i.tag]=e.fallback[i.tag]=i}for(r=0,n=arguments.length;r<n;r+=1)arguments[r].forEach(t);return e}function pr(e){return this.extend(e)}pr.prototype.extend=function(r){var n=[],t=[];if(r instanceof w)t.push(r);else if(Array.isArray(r))t=t.concat(r);else if(r&&(Array.isArray(r.implicit)||Array.isArray(r.explicit)))r.implicit&&(n=n.concat(r.implicit)),r.explicit&&(t=t.concat(r.explicit));else throw new E("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");n.forEach(function(o){if(!(o instanceof w))throw new E("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(o.loadKind&&o.loadKind!=="scalar")throw new E("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(o.multi)throw new E("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),t.forEach(function(o){if(!(o instanceof w))throw new E("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var i=Object.create(pr.prototype);return i.implicit=(this.implicit||[]).concat(n),i.explicit=(this.explicit||[]).concat(t),i.compiledImplicit=yn(i,"implicit"),i.compiledExplicit=yn(i,"explicit"),i.compiledTypeMap=Ii(i.compiledImplicit,i.compiledExplicit),i};var _i=pr,ji=new w("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),Fi=new w("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),Ni=new w("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),Li=new _i({explicit:[ji,Fi,Ni]});function Di(e){if(e===null)return!0;var r=e.length;return r===1&&e==="~"||r===4&&(e==="null"||e==="Null"||e==="NULL")}function Mi(){return null}function $i(e){return e===null}var Hi=new w("tag:yaml.org,2002:null",{kind:"scalar",resolve:Di,construct:Mi,predicate:$i,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function Bi(e){if(e===null)return!1;var r=e.length;return r===4&&(e==="true"||e==="True"||e==="TRUE")||r===5&&(e==="false"||e==="False"||e==="FALSE")}function zi(e){return e==="true"||e==="True"||e==="TRUE"}function Ui(e){return Object.prototype.toString.call(e)==="[object Boolean]"}var qi=new w("tag:yaml.org,2002:bool",{kind:"scalar",resolve:Bi,construct:zi,predicate:Ui,represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"});function Wi(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function Gi(e){return 48<=e&&e<=55}function Ki(e){return 48<=e&&e<=57}function Yi(e){if(e===null)return!1;var r=e.length,n=0,t=!1,i;if(!r)return!1;if(i=e[n],(i==="-"||i==="+")&&(i=e[++n]),i==="0"){if(n+1===r)return!0;if(i=e[++n],i==="b"){for(n++;n<r;n++)if(i=e[n],i!=="_"){if(i!=="0"&&i!=="1")return!1;t=!0}return t&&i!=="_"}if(i==="x"){for(n++;n<r;n++)if(i=e[n],i!=="_"){if(!Wi(e.charCodeAt(n)))return!1;t=!0}return t&&i!=="_"}if(i==="o"){for(n++;n<r;n++)if(i=e[n],i!=="_"){if(!Gi(e.charCodeAt(n)))return!1;t=!0}return t&&i!=="_"}}if(i==="_")return!1;for(;n<r;n++)if(i=e[n],i!=="_"){if(!Ki(e.charCodeAt(n)))return!1;t=!0}return!(!t||i==="_")}function Vi(e){var r=e,n=1,t;if(r.indexOf("_")!==-1&&(r=r.replace(/_/g,"")),t=r[0],(t==="-"||t==="+")&&(t==="-"&&(n=-1),r=r.slice(1),t=r[0]),r==="0")return 0;if(t==="0"){if(r[1]==="b")return n*parseInt(r.slice(2),2);if(r[1]==="x")return n*parseInt(r.slice(2),16);if(r[1]==="o")return n*parseInt(r.slice(2),8)}return n*parseInt(r,10)}function Ji(e){return Object.prototype.toString.call(e)==="[object Number]"&&e%1===0&&!R.isNegativeZero(e)}var Qi=new w("tag:yaml.org,2002:int",{kind:"scalar",resolve:Yi,construct:Vi,predicate:Ji,represent:{binary:function(e){return e>=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),Xi=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function Zi(e){return!(e===null||!Xi.test(e)||e[e.length-1]==="_")}function eo(e){var r,n;return r=e.replace(/_/g,"").toLowerCase(),n=r[0]==="-"?-1:1,"+-".indexOf(r[0])>=0&&(r=r.slice(1)),r===".inf"?n===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:r===".nan"?NaN:n*parseFloat(r,10)}var ro=/^[-+]?[0-9]+e/;function no(e,r){var n;if(isNaN(e))switch(r){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(r){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(r){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(R.isNegativeZero(e))return"-0.0";return n=e.toString(10),ro.test(n)?n.replace("e",".e"):n}function to(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||R.isNegativeZero(e))}var io=new w("tag:yaml.org,2002:float",{kind:"scalar",resolve:Zi,construct:eo,predicate:to,represent:no,defaultStyle:"lowercase"}),oo=Li.extend({implicit:[Hi,qi,Qi,io]}),so=oo,Fn=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),Nn=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function ao(e){return e===null?!1:Fn.exec(e)!==null||Nn.exec(e)!==null}function lo(e){var r,n,t,i,o,s,a,l=0,c=null,f,u,p;if(r=Fn.exec(e),r===null&&(r=Nn.exec(e)),r===null)throw new Error("Date resolve error");if(n=+r[1],t=+r[2]-1,i=+r[3],!r[4])return new Date(Date.UTC(n,t,i));if(o=+r[4],s=+r[5],a=+r[6],r[7]){for(l=r[7].slice(0,3);l.length<3;)l+="0";l=+l}return r[9]&&(f=+r[10],u=+(r[11]||0),c=(f*60+u)*6e4,r[9]==="-"&&(c=-c)),p=new Date(Date.UTC(n,t,i,o,s,a,l)),c&&p.setTime(p.getTime()-c),p}function co(e){return e.toISOString()}var uo=new w("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:ao,construct:lo,instanceOf:Date,represent:co});function fo(e){return e==="<<"||e===null}var po=new w("tag:yaml.org,2002:merge",{kind:"scalar",resolve:fo}),yr=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
9
|
+
\r`;function ho(e){if(e===null)return!1;var r,n,t=0,i=e.length,o=yr;for(n=0;n<i;n++)if(r=o.indexOf(e.charAt(n)),!(r>64)){if(r<0)return!1;t+=6}return t%8===0}function mo(e){var r,n,t=e.replace(/[\r\n=]/g,""),i=t.length,o=yr,s=0,a=[];for(r=0;r<i;r++)r%4===0&&r&&(a.push(s>>16&255),a.push(s>>8&255),a.push(s&255)),s=s<<6|o.indexOf(t.charAt(r));return n=i%4*6,n===0?(a.push(s>>16&255),a.push(s>>8&255),a.push(s&255)):n===18?(a.push(s>>10&255),a.push(s>>2&255)):n===12&&a.push(s>>4&255),new Uint8Array(a)}function go(e){var r="",n=0,t,i,o=e.length,s=yr;for(t=0;t<o;t++)t%3===0&&t&&(r+=s[n>>18&63],r+=s[n>>12&63],r+=s[n>>6&63],r+=s[n&63]),n=(n<<8)+e[t];return i=o%3,i===0?(r+=s[n>>18&63],r+=s[n>>12&63],r+=s[n>>6&63],r+=s[n&63]):i===2?(r+=s[n>>10&63],r+=s[n>>4&63],r+=s[n<<2&63],r+=s[64]):i===1&&(r+=s[n>>2&63],r+=s[n<<4&63],r+=s[64],r+=s[64]),r}function yo(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}var xo=new w("tag:yaml.org,2002:binary",{kind:"scalar",resolve:ho,construct:mo,predicate:yo,represent:go}),vo=Object.prototype.hasOwnProperty,Ao=Object.prototype.toString;function bo(e){if(e===null)return!0;var r=[],n,t,i,o,s,a=e;for(n=0,t=a.length;n<t;n+=1){if(i=a[n],s=!1,Ao.call(i)!=="[object Object]")return!1;for(o in i)if(vo.call(i,o))if(!s)s=!0;else return!1;if(!s)return!1;if(r.indexOf(o)===-1)r.push(o);else return!1}return!0}function Ro(e){return e!==null?e:[]}var wo=new w("tag:yaml.org,2002:omap",{kind:"sequence",resolve:bo,construct:Ro}),Co=Object.prototype.toString;function Eo(e){if(e===null)return!0;var r,n,t,i,o,s=e;for(o=new Array(s.length),r=0,n=s.length;r<n;r+=1){if(t=s[r],Co.call(t)!=="[object Object]"||(i=Object.keys(t),i.length!==1))return!1;o[r]=[i[0],t[i[0]]]}return!0}function ko(e){if(e===null)return[];var r,n,t,i,o,s=e;for(o=new Array(s.length),r=0,n=s.length;r<n;r+=1)t=s[r],i=Object.keys(t),o[r]=[i[0],t[i[0]]];return o}var So=new w("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:Eo,construct:ko}),To=Object.prototype.hasOwnProperty;function Po(e){if(e===null)return!0;var r,n=e;for(r in n)if(To.call(n,r)&&n[r]!==null)return!1;return!0}function Oo(e){return e!==null?e:{}}var Io=new w("tag:yaml.org,2002:set",{kind:"mapping",resolve:Po,construct:Oo}),Ln=so.extend({implicit:[uo,po],explicit:[xo,wo,So,Io]}),F=Object.prototype.hasOwnProperty,Fe=1,Dn=2,Mn=3,Ne=4,fr=1,_o=2,xn=3,jo=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,Fo=/[\x85\u2028\u2029]/,No=/[,\[\]\{\}]/,$n=/^(?:!|!!|![a-z\-]+!)$/i,Hn=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function vn(e){return Object.prototype.toString.call(e)}function T(e){return e===10||e===13}function B(e){return e===9||e===32}function k(e){return e===9||e===32||e===10||e===13}function J(e){return e===44||e===91||e===93||e===123||e===125}function Lo(e){var r;return 48<=e&&e<=57?e-48:(r=e|32,97<=r&&r<=102?r-97+10:-1)}function Do(e){return e===120?2:e===117?4:e===85?8:0}function Mo(e){return 48<=e&&e<=57?e-48:-1}function An(e){return e===48?"\0":e===97?"\x07":e===98?"\b":e===116||e===9?" ":e===110?`
|
|
10
|
+
`:e===118?"\v":e===102?"\f":e===114?"\r":e===101?"\x1B":e===32?" ":e===34?'"':e===47?"/":e===92?"\\":e===78?"\x85":e===95?"\xA0":e===76?"\u2028":e===80?"\u2029":""}function $o(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}function Bn(e,r,n){r==="__proto__"?Object.defineProperty(e,r,{configurable:!0,enumerable:!0,writable:!0,value:n}):e[r]=n}var zn=new Array(256),Un=new Array(256);for(H=0;H<256;H++)zn[H]=An(H)?1:0,Un[H]=An(H);var H;function Ho(e,r){this.input=e,this.filename=r.filename||null,this.schema=r.schema||Ln,this.onWarning=r.onWarning||null,this.legacy=r.legacy||!1,this.json=r.json||!1,this.listener=r.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function qn(e,r){var n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return n.snippet=ki(n),new E(r,n)}function h(e,r){throw qn(e,r)}function Le(e,r){e.onWarning&&e.onWarning.call(null,qn(e,r))}var bn={YAML:function(r,n,t){var i,o,s;r.version!==null&&h(r,"duplication of %YAML directive"),t.length!==1&&h(r,"YAML directive accepts exactly one argument"),i=/^([0-9]+)\.([0-9]+)$/.exec(t[0]),i===null&&h(r,"ill-formed argument of the YAML directive"),o=parseInt(i[1],10),s=parseInt(i[2],10),o!==1&&h(r,"unacceptable YAML version of the document"),r.version=t[0],r.checkLineBreaks=s<2,s!==1&&s!==2&&Le(r,"unsupported YAML version of the document")},TAG:function(r,n,t){var i,o;t.length!==2&&h(r,"TAG directive accepts exactly two arguments"),i=t[0],o=t[1],$n.test(i)||h(r,"ill-formed tag handle (first argument) of the TAG directive"),F.call(r.tagMap,i)&&h(r,'there is a previously declared suffix for "'+i+'" tag handle'),Hn.test(o)||h(r,"ill-formed tag prefix (second argument) of the TAG directive");try{o=decodeURIComponent(o)}catch{h(r,"tag prefix is malformed: "+o)}r.tagMap[i]=o}};function j(e,r,n,t){var i,o,s,a;if(r<n){if(a=e.input.slice(r,n),t)for(i=0,o=a.length;i<o;i+=1)s=a.charCodeAt(i),s===9||32<=s&&s<=1114111||h(e,"expected valid JSON character");else jo.test(a)&&h(e,"the stream contains non-printable characters");e.result+=a}}function Rn(e,r,n,t){var i,o,s,a;for(R.isObject(n)||h(e,"cannot merge mappings; the provided source object is unacceptable"),i=Object.keys(n),s=0,a=i.length;s<a;s+=1)o=i[s],F.call(r,o)||(Bn(r,o,n[o]),t[o]=!0)}function Q(e,r,n,t,i,o,s,a,l){var c,f;if(Array.isArray(i))for(i=Array.prototype.slice.call(i),c=0,f=i.length;c<f;c+=1)Array.isArray(i[c])&&h(e,"nested arrays are not supported inside keys"),typeof i=="object"&&vn(i[c])==="[object Object]"&&(i[c]="[object Object]");if(typeof i=="object"&&vn(i)==="[object Object]"&&(i="[object Object]"),i=String(i),r===null&&(r={}),t==="tag:yaml.org,2002:merge")if(Array.isArray(o))for(c=0,f=o.length;c<f;c+=1)Rn(e,r,o[c],n);else Rn(e,r,o,n);else!e.json&&!F.call(n,i)&&F.call(r,i)&&(e.line=s||e.line,e.lineStart=a||e.lineStart,e.position=l||e.position,h(e,"duplicated mapping key")),Bn(r,i,o),delete n[i];return r}function xr(e){var r;r=e.input.charCodeAt(e.position),r===10?e.position++:r===13?(e.position++,e.input.charCodeAt(e.position)===10&&e.position++):h(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function b(e,r,n){for(var t=0,i=e.input.charCodeAt(e.position);i!==0;){for(;B(i);)i===9&&e.firstTabInLine===-1&&(e.firstTabInLine=e.position),i=e.input.charCodeAt(++e.position);if(r&&i===35)do i=e.input.charCodeAt(++e.position);while(i!==10&&i!==13&&i!==0);if(T(i))for(xr(e),i=e.input.charCodeAt(e.position),t++,e.lineIndent=0;i===32;)e.lineIndent++,i=e.input.charCodeAt(++e.position);else break}return n!==-1&&t!==0&&e.lineIndent<n&&Le(e,"deficient indentation"),t}function $e(e){var r=e.position,n;return n=e.input.charCodeAt(r),!!((n===45||n===46)&&n===e.input.charCodeAt(r+1)&&n===e.input.charCodeAt(r+2)&&(r+=3,n=e.input.charCodeAt(r),n===0||k(n)))}function vr(e,r){r===1?e.result+=" ":r>1&&(e.result+=R.repeat(`
|
|
11
|
+
`,r-1))}function Bo(e,r,n){var t,i,o,s,a,l,c,f,u=e.kind,p=e.result,d;if(d=e.input.charCodeAt(e.position),k(d)||J(d)||d===35||d===38||d===42||d===33||d===124||d===62||d===39||d===34||d===37||d===64||d===96||(d===63||d===45)&&(i=e.input.charCodeAt(e.position+1),k(i)||n&&J(i)))return!1;for(e.kind="scalar",e.result="",o=s=e.position,a=!1;d!==0;){if(d===58){if(i=e.input.charCodeAt(e.position+1),k(i)||n&&J(i))break}else if(d===35){if(t=e.input.charCodeAt(e.position-1),k(t))break}else{if(e.position===e.lineStart&&$e(e)||n&&J(d))break;if(T(d))if(l=e.line,c=e.lineStart,f=e.lineIndent,b(e,!1,-1),e.lineIndent>=r){a=!0,d=e.input.charCodeAt(e.position);continue}else{e.position=s,e.line=l,e.lineStart=c,e.lineIndent=f;break}}a&&(j(e,o,s,!1),vr(e,e.line-l),o=s=e.position,a=!1),B(d)||(s=e.position+1),d=e.input.charCodeAt(++e.position)}return j(e,o,s,!1),e.result?!0:(e.kind=u,e.result=p,!1)}function zo(e,r){var n,t,i;if(n=e.input.charCodeAt(e.position),n!==39)return!1;for(e.kind="scalar",e.result="",e.position++,t=i=e.position;(n=e.input.charCodeAt(e.position))!==0;)if(n===39)if(j(e,t,e.position,!0),n=e.input.charCodeAt(++e.position),n===39)t=e.position,e.position++,i=e.position;else return!0;else T(n)?(j(e,t,i,!0),vr(e,b(e,!1,r)),t=i=e.position):e.position===e.lineStart&&$e(e)?h(e,"unexpected end of the document within a single quoted scalar"):(e.position++,i=e.position);h(e,"unexpected end of the stream within a single quoted scalar")}function Uo(e,r){var n,t,i,o,s,a;if(a=e.input.charCodeAt(e.position),a!==34)return!1;for(e.kind="scalar",e.result="",e.position++,n=t=e.position;(a=e.input.charCodeAt(e.position))!==0;){if(a===34)return j(e,n,e.position,!0),e.position++,!0;if(a===92){if(j(e,n,e.position,!0),a=e.input.charCodeAt(++e.position),T(a))b(e,!1,r);else if(a<256&&zn[a])e.result+=Un[a],e.position++;else if((s=Do(a))>0){for(i=s,o=0;i>0;i--)a=e.input.charCodeAt(++e.position),(s=Lo(a))>=0?o=(o<<4)+s:h(e,"expected hexadecimal character");e.result+=$o(o),e.position++}else h(e,"unknown escape sequence");n=t=e.position}else T(a)?(j(e,n,t,!0),vr(e,b(e,!1,r)),n=t=e.position):e.position===e.lineStart&&$e(e)?h(e,"unexpected end of the document within a double quoted scalar"):(e.position++,t=e.position)}h(e,"unexpected end of the stream within a double quoted scalar")}function qo(e,r){var n=!0,t,i,o,s=e.tag,a,l=e.anchor,c,f,u,p,d,m=Object.create(null),y,x,v,g;if(g=e.input.charCodeAt(e.position),g===91)f=93,d=!1,a=[];else if(g===123)f=125,d=!0,a={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=a),g=e.input.charCodeAt(++e.position);g!==0;){if(b(e,!0,r),g=e.input.charCodeAt(e.position),g===f)return e.position++,e.tag=s,e.anchor=l,e.kind=d?"mapping":"sequence",e.result=a,!0;n?g===44&&h(e,"expected the node content, but found ','"):h(e,"missed comma between flow collection entries"),x=y=v=null,u=p=!1,g===63&&(c=e.input.charCodeAt(e.position+1),k(c)&&(u=p=!0,e.position++,b(e,!0,r))),t=e.line,i=e.lineStart,o=e.position,X(e,r,Fe,!1,!0),x=e.tag,y=e.result,b(e,!0,r),g=e.input.charCodeAt(e.position),(p||e.line===t)&&g===58&&(u=!0,g=e.input.charCodeAt(++e.position),b(e,!0,r),X(e,r,Fe,!1,!0),v=e.result),d?Q(e,a,m,x,y,v,t,i,o):u?a.push(Q(e,null,m,x,y,v,t,i,o)):a.push(y),b(e,!0,r),g=e.input.charCodeAt(e.position),g===44?(n=!0,g=e.input.charCodeAt(++e.position)):n=!1}h(e,"unexpected end of the stream within a flow collection")}function Wo(e,r){var n,t,i=fr,o=!1,s=!1,a=r,l=0,c=!1,f,u;if(u=e.input.charCodeAt(e.position),u===124)t=!1;else if(u===62)t=!0;else return!1;for(e.kind="scalar",e.result="";u!==0;)if(u=e.input.charCodeAt(++e.position),u===43||u===45)fr===i?i=u===43?xn:_o:h(e,"repeat of a chomping mode identifier");else if((f=Mo(u))>=0)f===0?h(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):s?h(e,"repeat of an indentation width identifier"):(a=r+f-1,s=!0);else break;if(B(u)){do u=e.input.charCodeAt(++e.position);while(B(u));if(u===35)do u=e.input.charCodeAt(++e.position);while(!T(u)&&u!==0)}for(;u!==0;){for(xr(e),e.lineIndent=0,u=e.input.charCodeAt(e.position);(!s||e.lineIndent<a)&&u===32;)e.lineIndent++,u=e.input.charCodeAt(++e.position);if(!s&&e.lineIndent>a&&(a=e.lineIndent),T(u)){l++;continue}if(e.lineIndent<a){i===xn?e.result+=R.repeat(`
|
|
12
|
+
`,o?1+l:l):i===fr&&o&&(e.result+=`
|
|
13
|
+
`);break}for(t?B(u)?(c=!0,e.result+=R.repeat(`
|
|
14
|
+
`,o?1+l:l)):c?(c=!1,e.result+=R.repeat(`
|
|
15
|
+
`,l+1)):l===0?o&&(e.result+=" "):e.result+=R.repeat(`
|
|
16
|
+
`,l):e.result+=R.repeat(`
|
|
17
|
+
`,o?1+l:l),o=!0,s=!0,l=0,n=e.position;!T(u)&&u!==0;)u=e.input.charCodeAt(++e.position);j(e,n,e.position,!1)}return!0}function wn(e,r){var n,t=e.tag,i=e.anchor,o=[],s,a=!1,l;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=o),l=e.input.charCodeAt(e.position);l!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,h(e,"tab characters must not be used in indentation")),!(l!==45||(s=e.input.charCodeAt(e.position+1),!k(s))));){if(a=!0,e.position++,b(e,!0,-1)&&e.lineIndent<=r){o.push(null),l=e.input.charCodeAt(e.position);continue}if(n=e.line,X(e,r,Mn,!1,!0),o.push(e.result),b(e,!0,-1),l=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>r)&&l!==0)h(e,"bad indentation of a sequence entry");else if(e.lineIndent<r)break}return a?(e.tag=t,e.anchor=i,e.kind="sequence",e.result=o,!0):!1}function Go(e,r,n){var t,i,o,s,a,l,c=e.tag,f=e.anchor,u={},p=Object.create(null),d=null,m=null,y=null,x=!1,v=!1,g;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=u),g=e.input.charCodeAt(e.position);g!==0;){if(!x&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,h(e,"tab characters must not be used in indentation")),t=e.input.charCodeAt(e.position+1),o=e.line,(g===63||g===58)&&k(t))g===63?(x&&(Q(e,u,p,d,m,null,s,a,l),d=m=y=null),v=!0,x=!0,i=!0):x?(x=!1,i=!0):h(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,g=t;else{if(s=e.line,a=e.lineStart,l=e.position,!X(e,n,Dn,!1,!0))break;if(e.line===o){for(g=e.input.charCodeAt(e.position);B(g);)g=e.input.charCodeAt(++e.position);if(g===58)g=e.input.charCodeAt(++e.position),k(g)||h(e,"a whitespace character is expected after the key-value separator within a block mapping"),x&&(Q(e,u,p,d,m,null,s,a,l),d=m=y=null),v=!0,x=!1,i=!1,d=e.tag,m=e.result;else if(v)h(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=c,e.anchor=f,!0}else if(v)h(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return e.tag=c,e.anchor=f,!0}if((e.line===o||e.lineIndent>r)&&(x&&(s=e.line,a=e.lineStart,l=e.position),X(e,r,Ne,!0,i)&&(x?m=e.result:y=e.result),x||(Q(e,u,p,d,m,y,s,a,l),d=m=y=null),b(e,!0,-1),g=e.input.charCodeAt(e.position)),(e.line===o||e.lineIndent>r)&&g!==0)h(e,"bad indentation of a mapping entry");else if(e.lineIndent<r)break}return x&&Q(e,u,p,d,m,null,s,a,l),v&&(e.tag=c,e.anchor=f,e.kind="mapping",e.result=u),v}function Ko(e){var r,n=!1,t=!1,i,o,s;if(s=e.input.charCodeAt(e.position),s!==33)return!1;if(e.tag!==null&&h(e,"duplication of a tag property"),s=e.input.charCodeAt(++e.position),s===60?(n=!0,s=e.input.charCodeAt(++e.position)):s===33?(t=!0,i="!!",s=e.input.charCodeAt(++e.position)):i="!",r=e.position,n){do s=e.input.charCodeAt(++e.position);while(s!==0&&s!==62);e.position<e.length?(o=e.input.slice(r,e.position),s=e.input.charCodeAt(++e.position)):h(e,"unexpected end of the stream within a verbatim tag")}else{for(;s!==0&&!k(s);)s===33&&(t?h(e,"tag suffix cannot contain exclamation marks"):(i=e.input.slice(r-1,e.position+1),$n.test(i)||h(e,"named tag handle cannot contain such characters"),t=!0,r=e.position+1)),s=e.input.charCodeAt(++e.position);o=e.input.slice(r,e.position),No.test(o)&&h(e,"tag suffix cannot contain flow indicator characters")}o&&!Hn.test(o)&&h(e,"tag name cannot contain such characters: "+o);try{o=decodeURIComponent(o)}catch{h(e,"tag name is malformed: "+o)}return n?e.tag=o:F.call(e.tagMap,i)?e.tag=e.tagMap[i]+o:i==="!"?e.tag="!"+o:i==="!!"?e.tag="tag:yaml.org,2002:"+o:h(e,'undeclared tag handle "'+i+'"'),!0}function Yo(e){var r,n;if(n=e.input.charCodeAt(e.position),n!==38)return!1;for(e.anchor!==null&&h(e,"duplication of an anchor property"),n=e.input.charCodeAt(++e.position),r=e.position;n!==0&&!k(n)&&!J(n);)n=e.input.charCodeAt(++e.position);return e.position===r&&h(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(r,e.position),!0}function Vo(e){var r,n,t;if(t=e.input.charCodeAt(e.position),t!==42)return!1;for(t=e.input.charCodeAt(++e.position),r=e.position;t!==0&&!k(t)&&!J(t);)t=e.input.charCodeAt(++e.position);return e.position===r&&h(e,"name of an alias node must contain at least one character"),n=e.input.slice(r,e.position),F.call(e.anchorMap,n)||h(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],b(e,!0,-1),!0}function X(e,r,n,t,i){var o,s,a,l=1,c=!1,f=!1,u,p,d,m,y,x;if(e.listener!==null&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,o=s=a=Ne===n||Mn===n,t&&b(e,!0,-1)&&(c=!0,e.lineIndent>r?l=1:e.lineIndent===r?l=0:e.lineIndent<r&&(l=-1)),l===1)for(;Ko(e)||Yo(e);)b(e,!0,-1)?(c=!0,a=o,e.lineIndent>r?l=1:e.lineIndent===r?l=0:e.lineIndent<r&&(l=-1)):a=!1;if(a&&(a=c||i),(l===1||Ne===n)&&(Fe===n||Dn===n?y=r:y=r+1,x=e.position-e.lineStart,l===1?a&&(wn(e,x)||Go(e,x,y))||qo(e,y)?f=!0:(s&&Wo(e,y)||zo(e,y)||Uo(e,y)?f=!0:Vo(e)?(f=!0,(e.tag!==null||e.anchor!==null)&&h(e,"alias node should not have any properties")):Bo(e,y,Fe===n)&&(f=!0,e.tag===null&&(e.tag="?")),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):l===0&&(f=a&&wn(e,x))),e.tag===null)e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);else if(e.tag==="?"){for(e.result!==null&&e.kind!=="scalar"&&h(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),u=0,p=e.implicitTypes.length;u<p;u+=1)if(m=e.implicitTypes[u],m.resolve(e.result)){e.result=m.construct(e.result),e.tag=m.tag,e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);break}}else if(e.tag!=="!"){if(F.call(e.typeMap[e.kind||"fallback"],e.tag))m=e.typeMap[e.kind||"fallback"][e.tag];else for(m=null,d=e.typeMap.multi[e.kind||"fallback"],u=0,p=d.length;u<p;u+=1)if(e.tag.slice(0,d[u].tag.length)===d[u].tag){m=d[u];break}m||h(e,"unknown tag !<"+e.tag+">"),e.result!==null&&m.kind!==e.kind&&h(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+m.kind+'", not "'+e.kind+'"'),m.resolve(e.result,e.tag)?(e.result=m.construct(e.result,e.tag),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):h(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return e.listener!==null&&e.listener("close",e),e.tag!==null||e.anchor!==null||f}function Jo(e){var r=e.position,n,t,i,o=!1,s;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);(s=e.input.charCodeAt(e.position))!==0&&(b(e,!0,-1),s=e.input.charCodeAt(e.position),!(e.lineIndent>0||s!==37));){for(o=!0,s=e.input.charCodeAt(++e.position),n=e.position;s!==0&&!k(s);)s=e.input.charCodeAt(++e.position);for(t=e.input.slice(n,e.position),i=[],t.length<1&&h(e,"directive name must not be less than one character in length");s!==0;){for(;B(s);)s=e.input.charCodeAt(++e.position);if(s===35){do s=e.input.charCodeAt(++e.position);while(s!==0&&!T(s));break}if(T(s))break;for(n=e.position;s!==0&&!k(s);)s=e.input.charCodeAt(++e.position);i.push(e.input.slice(n,e.position))}s!==0&&xr(e),F.call(bn,t)?bn[t](e,t,i):Le(e,'unknown document directive "'+t+'"')}if(b(e,!0,-1),e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45?(e.position+=3,b(e,!0,-1)):o&&h(e,"directives end mark is expected"),X(e,e.lineIndent-1,Ne,!1,!0),b(e,!0,-1),e.checkLineBreaks&&Fo.test(e.input.slice(r,e.position))&&Le(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&$e(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,b(e,!0,-1));return}if(e.position<e.length-1)h(e,"end of the stream or a document separator is expected");else return}function Wn(e,r){e=String(e),r=r||{},e.length!==0&&(e.charCodeAt(e.length-1)!==10&&e.charCodeAt(e.length-1)!==13&&(e+=`
|
|
18
|
+
`),e.charCodeAt(0)===65279&&(e=e.slice(1)));var n=new Ho(e,r),t=e.indexOf("\0");for(t!==-1&&(n.position=t,h(n,"null byte is not allowed in input")),n.input+="\0";n.input.charCodeAt(n.position)===32;)n.lineIndent+=1,n.position+=1;for(;n.position<n.length-1;)Jo(n);return n.documents}function Qo(e,r,n){r!==null&&typeof r=="object"&&typeof n>"u"&&(n=r,r=null);var t=Wn(e,n);if(typeof r!="function")return t;for(var i=0,o=t.length;i<o;i+=1)r(t[i])}function Xo(e,r){var n=Wn(e,r);if(n.length!==0){if(n.length===1)return n[0];throw new E("expected a single document in the stream, but found more")}}var Zo=Qo,es=Xo,Gn={loadAll:Zo,load:es},Kn=Object.prototype.toString,Yn=Object.prototype.hasOwnProperty,Ar=65279,rs=9,he=10,ns=13,ts=32,is=33,os=34,dr=35,ss=37,as=38,ls=39,cs=42,Vn=44,us=45,De=58,fs=61,ps=62,ds=63,hs=64,Jn=91,Qn=93,ms=96,Xn=123,gs=124,Zn=125,C={};C[0]="\\0";C[7]="\\a";C[8]="\\b";C[9]="\\t";C[10]="\\n";C[11]="\\v";C[12]="\\f";C[13]="\\r";C[27]="\\e";C[34]='\\"';C[92]="\\\\";C[133]="\\N";C[160]="\\_";C[8232]="\\L";C[8233]="\\P";var ys=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],xs=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function vs(e,r){var n,t,i,o,s,a,l;if(r===null)return{};for(n={},t=Object.keys(r),i=0,o=t.length;i<o;i+=1)s=t[i],a=String(r[s]),s.slice(0,2)==="!!"&&(s="tag:yaml.org,2002:"+s.slice(2)),l=e.compiledTypeMap.fallback[s],l&&Yn.call(l.styleAliases,a)&&(a=l.styleAliases[a]),n[s]=a;return n}function As(e){var r,n,t;if(r=e.toString(16).toUpperCase(),e<=255)n="x",t=2;else if(e<=65535)n="u",t=4;else if(e<=4294967295)n="U",t=8;else throw new E("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+n+R.repeat("0",t-r.length)+r}var bs=1,me=2;function Rs(e){this.schema=e.schema||Ln,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=R.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=vs(this.schema,e.styles||null),this.sortKeys=e.sortKeys||!1,this.lineWidth=e.lineWidth||80,this.noRefs=e.noRefs||!1,this.noCompatMode=e.noCompatMode||!1,this.condenseFlow=e.condenseFlow||!1,this.quotingType=e.quotingType==='"'?me:bs,this.forceQuotes=e.forceQuotes||!1,this.replacer=typeof e.replacer=="function"?e.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function Cn(e,r){for(var n=R.repeat(" ",r),t=0,i=-1,o="",s,a=e.length;t<a;)i=e.indexOf(`
|
|
19
|
+
`,t),i===-1?(s=e.slice(t),t=a):(s=e.slice(t,i+1),t=i+1),s.length&&s!==`
|
|
20
|
+
`&&(o+=n),o+=s;return o}function hr(e,r){return`
|
|
21
|
+
`+R.repeat(" ",e.indent*r)}function ws(e,r){var n,t,i;for(n=0,t=e.implicitTypes.length;n<t;n+=1)if(i=e.implicitTypes[n],i.resolve(r))return!0;return!1}function Me(e){return e===ts||e===rs}function ge(e){return 32<=e&&e<=126||161<=e&&e<=55295&&e!==8232&&e!==8233||57344<=e&&e<=65533&&e!==Ar||65536<=e&&e<=1114111}function En(e){return ge(e)&&e!==Ar&&e!==ns&&e!==he}function kn(e,r,n){var t=En(e),i=t&&!Me(e);return(n?t:t&&e!==Vn&&e!==Jn&&e!==Qn&&e!==Xn&&e!==Zn)&&e!==dr&&!(r===De&&!i)||En(r)&&!Me(r)&&e===dr||r===De&&i}function Cs(e){return ge(e)&&e!==Ar&&!Me(e)&&e!==us&&e!==ds&&e!==De&&e!==Vn&&e!==Jn&&e!==Qn&&e!==Xn&&e!==Zn&&e!==dr&&e!==as&&e!==cs&&e!==is&&e!==gs&&e!==fs&&e!==ps&&e!==ls&&e!==os&&e!==ss&&e!==hs&&e!==ms}function Es(e){return!Me(e)&&e!==De}function pe(e,r){var n=e.charCodeAt(r),t;return n>=55296&&n<=56319&&r+1<e.length&&(t=e.charCodeAt(r+1),t>=56320&&t<=57343)?(n-55296)*1024+t-56320+65536:n}function et(e){var r=/^\n* /;return r.test(e)}var rt=1,mr=2,nt=3,tt=4,V=5;function ks(e,r,n,t,i,o,s,a){var l,c=0,f=null,u=!1,p=!1,d=t!==-1,m=-1,y=Cs(pe(e,0))&&Es(pe(e,e.length-1));if(r||s)for(l=0;l<e.length;c>=65536?l+=2:l++){if(c=pe(e,l),!ge(c))return V;y=y&&kn(c,f,a),f=c}else{for(l=0;l<e.length;c>=65536?l+=2:l++){if(c=pe(e,l),c===he)u=!0,d&&(p=p||l-m-1>t&&e[m+1]!==" ",m=l);else if(!ge(c))return V;y=y&&kn(c,f,a),f=c}p=p||d&&l-m-1>t&&e[m+1]!==" "}return!u&&!p?y&&!s&&!i(e)?rt:o===me?V:mr:n>9&&et(e)?V:s?o===me?V:mr:p?tt:nt}function Ss(e,r,n,t,i){e.dump=(function(){if(r.length===0)return e.quotingType===me?'""':"''";if(!e.noCompatMode&&(ys.indexOf(r)!==-1||xs.test(r)))return e.quotingType===me?'"'+r+'"':"'"+r+"'";var o=e.indent*Math.max(1,n),s=e.lineWidth===-1?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-o),a=t||e.flowLevel>-1&&n>=e.flowLevel;function l(c){return ws(e,c)}switch(ks(r,a,e.indent,s,l,e.quotingType,e.forceQuotes&&!t,i)){case rt:return r;case mr:return"'"+r.replace(/'/g,"''")+"'";case nt:return"|"+Sn(r,e.indent)+Tn(Cn(r,o));case tt:return">"+Sn(r,e.indent)+Tn(Cn(Ts(r,s),o));case V:return'"'+Ps(r)+'"';default:throw new E("impossible error: invalid scalar style")}})()}function Sn(e,r){var n=et(e)?String(r):"",t=e[e.length-1]===`
|
|
22
|
+
`,i=t&&(e[e.length-2]===`
|
|
23
|
+
`||e===`
|
|
24
|
+
`),o=i?"+":t?"":"-";return n+o+`
|
|
25
|
+
`}function Tn(e){return e[e.length-1]===`
|
|
26
|
+
`?e.slice(0,-1):e}function Ts(e,r){for(var n=/(\n+)([^\n]*)/g,t=(function(){var c=e.indexOf(`
|
|
27
|
+
`);return c=c!==-1?c:e.length,n.lastIndex=c,Pn(e.slice(0,c),r)})(),i=e[0]===`
|
|
28
|
+
`||e[0]===" ",o,s;s=n.exec(e);){var a=s[1],l=s[2];o=l[0]===" ",t+=a+(!i&&!o&&l!==""?`
|
|
29
|
+
`:"")+Pn(l,r),i=o}return t}function Pn(e,r){if(e===""||e[0]===" ")return e;for(var n=/ [^ ]/g,t,i=0,o,s=0,a=0,l="";t=n.exec(e);)a=t.index,a-i>r&&(o=s>i?s:a,l+=`
|
|
30
|
+
`+e.slice(i,o),i=o+1),s=a;return l+=`
|
|
31
|
+
`,e.length-i>r&&s>i?l+=e.slice(i,s)+`
|
|
32
|
+
`+e.slice(s+1):l+=e.slice(i),l.slice(1)}function Ps(e){for(var r="",n=0,t,i=0;i<e.length;n>=65536?i+=2:i++)n=pe(e,i),t=C[n],!t&&ge(n)?(r+=e[i],n>=65536&&(r+=e[i+1])):r+=t||As(n);return r}function Os(e,r,n){var t="",i=e.tag,o,s,a;for(o=0,s=n.length;o<s;o+=1)a=n[o],e.replacer&&(a=e.replacer.call(n,String(o),a)),(I(e,r,a,!1,!1)||typeof a>"u"&&I(e,r,null,!1,!1))&&(t!==""&&(t+=","+(e.condenseFlow?"":" ")),t+=e.dump);e.tag=i,e.dump="["+t+"]"}function On(e,r,n,t){var i="",o=e.tag,s,a,l;for(s=0,a=n.length;s<a;s+=1)l=n[s],e.replacer&&(l=e.replacer.call(n,String(s),l)),(I(e,r+1,l,!0,!0,!1,!0)||typeof l>"u"&&I(e,r+1,null,!0,!0,!1,!0))&&((!t||i!=="")&&(i+=hr(e,r)),e.dump&&he===e.dump.charCodeAt(0)?i+="-":i+="- ",i+=e.dump);e.tag=o,e.dump=i||"[]"}function Is(e,r,n){var t="",i=e.tag,o=Object.keys(n),s,a,l,c,f;for(s=0,a=o.length;s<a;s+=1)f="",t!==""&&(f+=", "),e.condenseFlow&&(f+='"'),l=o[s],c=n[l],e.replacer&&(c=e.replacer.call(n,l,c)),I(e,r,l,!1,!1)&&(e.dump.length>1024&&(f+="? "),f+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),I(e,r,c,!1,!1)&&(f+=e.dump,t+=f));e.tag=i,e.dump="{"+t+"}"}function _s(e,r,n,t){var i="",o=e.tag,s=Object.keys(n),a,l,c,f,u,p;if(e.sortKeys===!0)s.sort();else if(typeof e.sortKeys=="function")s.sort(e.sortKeys);else if(e.sortKeys)throw new E("sortKeys must be a boolean or a function");for(a=0,l=s.length;a<l;a+=1)p="",(!t||i!=="")&&(p+=hr(e,r)),c=s[a],f=n[c],e.replacer&&(f=e.replacer.call(n,c,f)),I(e,r+1,c,!0,!0,!0)&&(u=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,u&&(e.dump&&he===e.dump.charCodeAt(0)?p+="?":p+="? "),p+=e.dump,u&&(p+=hr(e,r)),I(e,r+1,f,!0,u)&&(e.dump&&he===e.dump.charCodeAt(0)?p+=":":p+=": ",p+=e.dump,i+=p));e.tag=o,e.dump=i||"{}"}function In(e,r,n){var t,i,o,s,a,l;for(i=n?e.explicitTypes:e.implicitTypes,o=0,s=i.length;o<s;o+=1)if(a=i[o],(a.instanceOf||a.predicate)&&(!a.instanceOf||typeof r=="object"&&r instanceof a.instanceOf)&&(!a.predicate||a.predicate(r))){if(n?a.multi&&a.representName?e.tag=a.representName(r):e.tag=a.tag:e.tag="?",a.represent){if(l=e.styleMap[a.tag]||a.defaultStyle,Kn.call(a.represent)==="[object Function]")t=a.represent(r,l);else if(Yn.call(a.represent,l))t=a.represent[l](r,l);else throw new E("!<"+a.tag+'> tag resolver accepts not "'+l+'" style');e.dump=t}return!0}return!1}function I(e,r,n,t,i,o,s){e.tag=null,e.dump=n,In(e,n,!1)||In(e,n,!0);var a=Kn.call(e.dump),l=t,c;t&&(t=e.flowLevel<0||e.flowLevel>r);var f=a==="[object Object]"||a==="[object Array]",u,p;if(f&&(u=e.duplicates.indexOf(n),p=u!==-1),(e.tag!==null&&e.tag!=="?"||p||e.indent!==2&&r>0)&&(i=!1),p&&e.usedDuplicates[u])e.dump="*ref_"+u;else{if(f&&p&&!e.usedDuplicates[u]&&(e.usedDuplicates[u]=!0),a==="[object Object]")t&&Object.keys(e.dump).length!==0?(_s(e,r,e.dump,i),p&&(e.dump="&ref_"+u+e.dump)):(Is(e,r,e.dump),p&&(e.dump="&ref_"+u+" "+e.dump));else if(a==="[object Array]")t&&e.dump.length!==0?(e.noArrayIndent&&!s&&r>0?On(e,r-1,e.dump,i):On(e,r,e.dump,i),p&&(e.dump="&ref_"+u+e.dump)):(Os(e,r,e.dump),p&&(e.dump="&ref_"+u+" "+e.dump));else if(a==="[object String]")e.tag!=="?"&&Ss(e,e.dump,r,o,l);else{if(a==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new E("unacceptable kind of an object to dump "+a)}e.tag!==null&&e.tag!=="?"&&(c=encodeURI(e.tag[0]==="!"?e.tag.slice(1):e.tag).replace(/!/g,"%21"),e.tag[0]==="!"?c="!"+c:c.slice(0,18)==="tag:yaml.org,2002:"?c="!!"+c.slice(18):c="!<"+c+">",e.dump=c+" "+e.dump)}return!0}function js(e,r){var n=[],t=[],i,o;for(gr(e,n,t),i=0,o=t.length;i<o;i+=1)r.duplicates.push(n[t[i]]);r.usedDuplicates=new Array(o)}function gr(e,r,n){var t,i,o;if(e!==null&&typeof e=="object")if(i=r.indexOf(e),i!==-1)n.indexOf(i)===-1&&n.push(i);else if(r.push(e),Array.isArray(e))for(i=0,o=e.length;i<o;i+=1)gr(e[i],r,n);else for(t=Object.keys(e),i=0,o=t.length;i<o;i+=1)gr(e[t[i]],r,n)}function Fs(e,r){r=r||{};var n=new Rs(r);n.noRefs||js(e,n);var t=e;return n.replacer&&(t=n.replacer.call({"":t},"",t)),I(n,0,t,!0,!0)?n.dump+`
|
|
33
|
+
`:""}var Ns=Fs,Ls={dump:Ns};function br(e,r){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+r+" instead, which is now safe by default.")}}var pc=Gn.load,dc=Gn.loadAll,hc=Ls.dump;var mc=br("safeLoad","load"),gc=br("safeLoadAll","loadAll"),yc=br("safeDump","dump");import{DefaultAzureCredential as zs}from"@azure/identity";var Us="499b84ac-1321-427f-aa17-267ca6975798/.default",Rr=null;function qs(){return Rr||(Rr=new zs),Rr}async function He(){return(await qs().getToken(Us)).token}var ye=class{store=new Map;ttlMs;maxSize;constructor(r,n=1e3){this.ttlMs=r*1e3,this.maxSize=n}get(r){let n=this.store.get(r);if(n){if(Date.now()>n.expiresAt){this.store.delete(r);return}return n.value}}set(r,n){if(this.store.size>=this.maxSize&&!this.store.has(r)){let t=this.store.keys().next().value;t!==void 0&&this.store.delete(t)}this.store.set(r,{value:n,expiresAt:Date.now()+this.ttlMs})}async getOrFetch(r,n){let t=this.get(r);if(t!==void 0)return t;let i=await n();return this.set(r,i),i}get size(){return this.store.size}clear(){this.store.clear()}};var Z="7.1",Ws=new ye(600),Gs=new ye(120),Ks=/^[0-9a-f]{7,40}$/i;async function ee(e){let r=await He(),n=await fetch(e,{headers:{Authorization:`Bearer ${r}`,"Content-Type":"application/json"}});if(!n.ok){let t=await n.text();throw new Error(`Azure DevOps API error (${n.status}): ${t}`)}return n}function re(e,r){return`https://dev.azure.com/${encodeURIComponent(e)}/${encodeURIComponent(r)}/_apis`}function Be(e){return e.startsWith("refs/")||Ks.test(e)?e:`refs/heads/${e}`}function ze(e){let r=Be(e);return r.startsWith("refs/heads/")?{version:r.slice(11),versionType:"branch"}:r.startsWith("refs/tags/")?{version:r.slice(10),versionType:"tag"}:{version:r,versionType:"commit"}}async function ot(e,r,n,t){let i=Be(t),o=ze(i);if(o.versionType==="commit")return o.version;let s=`${e}/${r}/${n}/${i}`.toLowerCase();return Gs.getOrFetch(s,async()=>{let a=i.replace(/^refs\//,""),l=`${re(e,r)}/git/repositories/${encodeURIComponent(n)}/refs?filter=${encodeURIComponent(a)}&api-version=${Z}`,u=(await(await ee(l)).json()).value?.find(p=>p.name===i);if(!u?.objectId)throw new Error(`Git ref not found: ${i}`);return u.objectId})}async function st(e,r){let n=`${re(e,r)}/pipelines?api-version=${Z}`;return(await(await ee(n)).json()).value}async function wr(e,r,n){let t=`${re(e,r)}/build/definitions/${n}?api-version=${Z}`,o=await(await ee(t)).json();return{id:o.id,name:o.name,path:o.process?.yamlFilename??o.path,repository:{id:o.repository?.id,name:o.repository?.name,type:o.repository?.type,defaultBranch:o.repository?.defaultBranch}}}async function at(e,r){let n=`${re(e,r)}/git/repositories?api-version=${Z}`;return(await(await ee(n)).json()).value}async function Cr(e,r,n){let t=`${e}/${r}/${n}`.toLowerCase();return Ws.getOrFetch(t,async()=>{let i=`${re(e,r)}/git/repositories/${encodeURIComponent(n)}?api-version=${Z}`;return(await ee(i)).json()})}async function lt(e,r,n,t,i){let o=t.startsWith("/")?t:`/${t}`,s=je(o),a=`${re(e,r)}/git/repositories/${encodeURIComponent(n)}/items?scopePath=${encodeURIComponent(s)}&api-version=${Z}&$format=text`;if(i){let c=ze(i);a+=`&versionDescriptor.version=${encodeURIComponent(c.version)}&versionDescriptor.versionType=${c.versionType}`}return(await ee(a)).text()}import{existsSync as Ys}from"node:fs";import{readFile as Vs}from"node:fs/promises";import{join as Js,normalize as ct}from"node:path";async function ut(e,r){let n=r.replace(/\\/g,"/").replace(/^\/+/,""),t=ct(Js(e,n)),i=ct(e);if(!t.startsWith(i))throw new Error(`Path traversal attempt: ${r}`);if(!Ys(t))throw new Error(`File not found locally: ${t}`);return Vs(t,"utf-8")}import{createHash as Qs}from"node:crypto";import{existsSync as ft}from"node:fs";import{mkdir as Xs,readFile as pt,writeFile as dt}from"node:fs/promises";import{dirname as Zs,resolve as ne}from"node:path";import{fileURLToPath as ea}from"node:url";function ra(e){if(e)return ne(e);let r=Y().cacheDir;return r?ne(r):ne(Zs(ea(import.meta.url)),"..","..","..",".cache","ado-file-cache")}function na(e){return Qs("sha256").update(JSON.stringify(e)).digest("hex")}function ta(e,r){let n=ne(e,r.slice(0,2),r.slice(2,4),r);return{dir:n,metadataPath:ne(n,"metadata.json"),contentPath:ne(n,"content.txt")}}async function ia(e){if(!ft(e.metadataPath)||!ft(e.contentPath))return null;let[r,n]=await Promise.all([pt(e.metadataPath,"utf-8"),pt(e.contentPath,"utf-8")]);return{metadata:JSON.parse(r),content:n}}async function oa(e,r,n){await Xs(e.dir,{recursive:!0}),await Promise.all([dt(e.metadataPath,JSON.stringify(r,null,2),"utf-8"),dt(e.contentPath,n,"utf-8")])}async function xe(e){let r=je(e.path.startsWith("/")?e.path:`/${e.path}`),n=Be(e.ref),t=ze(n).versionType,i=ra(e.cacheRoot),o=e.resolveCommitShaFn??ot,s=e.fetchFileContentFn??lt,a=await o(e.org,e.project,e.repoId,n),l={org:e.org,project:e.project,repoId:e.repoId,repoName:e.repoName,path:r,requestedRef:e.ref,normalizedRef:n,refType:t,commitSha:a},c=na(l),f=ta(i,c),u=await ia(f);if(u)return{content:u.content,path:r,repoId:e.repoId,repoName:e.repoName,requestedRef:u.metadata.requestedRef,normalizedRef:u.metadata.normalizedRef,refType:u.metadata.refType,commitSha:u.metadata.commitSha,cache:"hit"};let p=await s(e.org,e.project,e.repoId,r,a),d={...l,fetchedAt:new Date().toISOString()};return await oa(f,d,p),{content:p,path:r,repoId:e.repoId,repoName:e.repoName,requestedRef:e.ref,normalizedRef:n,refType:t,commitSha:a,cache:"miss"}}var ve=new O;ve.get("/:org/:project/repos",async e=>{let{org:r,project:n}=e.req.param(),t=await at(r,n);return e.json(t)});ve.get("/:org/:project/repos/:repoId/file",async e=>{let{org:r,project:n,repoId:t}=e.req.param(),i=e.req.query("path"),o=e.req.query("branch");if(!i)return e.json({error:"path query parameter is required"},400);let s=await Cr(r,n,t),a=await xe({org:r,project:n,repoId:s.id,repoName:s.name,path:i,ref:o||s.defaultBranch});return e.json({content:a.content,path:a.path,repoId:a.repoId,repoName:a.repoName,branch:a.requestedRef,commitSha:a.commitSha,cache:a.cache})});ve.get("/:org/:project/file-by-repo-name",async e=>{let{org:r,project:n}=e.req.param(),t=e.req.query("repo"),i=e.req.query("path"),o=e.req.query("branch");if(!t||!i)return e.json({error:"repo and path query parameters are required"},400);let s=gn(r,n,t);if(s)try{let c=await ut(s,i);return e.json({content:c,path:i,repoId:t,repoName:t,branch:o||"local",commitSha:"local",cache:"local"})}catch{}let a=await Cr(r,n,t);if(!a)return e.json({error:`Repository not found: ${t}`},404);let l=await xe({org:r,project:n,repoId:a.id,repoName:a.name,path:i,ref:o||a.defaultBranch});return e.json({content:l.content,path:l.path,repoId:l.repoId,repoName:l.repoName,branch:l.requestedRef,commitSha:l.commitSha,cache:l.cache})});var Ae=new O;Ae.get("/:org/:project/pipelines",async e=>{let{org:r,project:n}=e.req.param(),t=await st(r,n);return e.json(t)});Ae.get("/:org/:project/pipelines/:id",async e=>{let{org:r,project:n,id:t}=e.req.param(),i=await wr(r,n,Number(t));return e.json(i)});Ae.get("/:org/:project/pipelines/:id/yaml",async e=>{let{org:r,project:n,id:t}=e.req.param(),i=await wr(r,n,Number(t)),o=await xe({org:r,project:n,repoId:i.repository.id,repoName:i.repository.name,path:i.path,ref:i.repository.defaultBranch});return e.json({definition:i,yaml:o.content,branch:o.requestedRef,commitSha:o.commitSha,cache:o.cache})});import{existsSync as mt,mkdirSync as sa,readFileSync as aa,statSync as la,writeFileSync as ca}from"node:fs";import{dirname as gt,resolve as ht}from"node:path";import{fileURLToPath as ua}from"node:url";var Er=new O,fa=1440*60*1e3;function yt(e){let r=ht(gt(ua(import.meta.url)),"..","..","..","..");return ht(r,".cache",`task-schema-${e.toLowerCase()}.json`)}function pa(e){let r=yt(e);if(!mt(r))return null;try{let n=la(r);return Date.now()-n.mtimeMs>fa?null:JSON.parse(aa(r,"utf-8"))}catch{return null}}function da(e,r){let n=yt(e),t=gt(n);mt(t)||sa(t,{recursive:!0}),ca(n,JSON.stringify(r,null,2))}function ha(e){let r=e.definitions;if(!r)return[];let i=r.task?.properties?.task?.anyOf;if(!i)return[];let o=[];for(let s of i){let a=s.enum;if(!a?.length)continue;let l=a[0],c=typeof s.description=="string"?s.description:"",f=l.lastIndexOf("@"),u,p;f>0?(u=l.slice(0,f),p=parseInt(l.slice(f+1),10),Number.isNaN(p)&&(p=0)):(u=l,p=0),o.push({name:u,description:c,version:p,inputs:[]})}return o}Er.get("/:org/schema/tasks",async e=>{let{org:r}=e.req.param(),n=pa(r);if(n)return e.json({tasks:n,cached:!0});let t=await He(),i=`https://dev.azure.com/${encodeURIComponent(r)}/_apis/distributedtask/yamlschema?api-version=7.1`,o=await fetch(i,{headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"}});if(!o.ok){let l=await o.text();return e.json({error:`Failed to fetch schema: ${o.status} ${l}`},o.status)}let s=await o.json(),a=ha(s);return da(r,a),console.log(`Cached ${a.length} task definitions for org "${r}"`),e.json({tasks:a,cached:!1})});var ya=ga(new URL(".",import.meta.url)),At=kr(ya,"web"),xa={".html":"text/html; charset=utf-8",".js":"application/javascript",".css":"text/css",".ttf":"font/ttf",".woff":"font/woff",".woff2":"font/woff2",".svg":"image/svg+xml",".png":"image/png",".json":"application/json"};function va(e){let r=ma(e);return xa[r]??"application/octet-stream"}Y();var S=new O;S.use("/*",dn());S.use("/*",un({origin:"*"}));S.get("/health",e=>e.json({status:"ok"}));S.get("/api/config/task-docs",e=>{let r=Y();return e.json({customTaskDocs:r.customTaskDocs??{}})});S.route("/api",Ae);S.route("/api",ve);S.route("/api",Er);S.all("/api/*",e=>e.json({error:`Not found: ${e.req.path}`},404));S.onError((e,r)=>{if(console.error("Server error:",e.message),e.message.includes("DefaultAzureCredential")||e.message.includes("authentication"))return r.json({error:"Authentication failed. Ensure you are logged in via `az login`.",details:e.message},401);let n=e.message.match(/API error \((\d+)\)/);if(n){let t=Number(n[1]);return r.json({error:e.message},t)}return r.json({error:e.message},500)});S.get("/assets/*",e=>{let r=e.req.path,n=kr(At,r);if(!xt(n))return e.notFound();let t=vt(n);return e.body(t,200,{"Content-Type":va(r),"Cache-Control":"public, immutable, max-age=31536000"})});S.get("*",e=>{let r=kr(At,"index.html");if(!xt(r))return e.notFound();let n=vt(r,"utf-8");return e.html(n)});var Aa=Number(process.env.PORT)||3001;$r({fetch:S.fetch,port:Aa},e=>{console.log(`APV server listening on http://localhost:${e.port}`)});export{S as app};
|
|
34
|
+
/*! Bundled license information:
|
|
35
|
+
|
|
36
|
+
js-yaml/dist/js-yaml.mjs:
|
|
37
|
+
(*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT *)
|
|
38
|
+
*/
|
|
Binary file
|