1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,964827,e=>{"use strict";let t,n;var r=e.i(410331),s=e.i(942956),i=e.i(595239),o=e.i(629803),a=e.i(754219);let l=Symbol.for("yaml.alias"),c=Symbol.for("yaml.document"),u=Symbol.for("yaml.map"),d=Symbol.for("yaml.pair"),f=Symbol.for("yaml.scalar"),p=Symbol.for("yaml.seq"),h=Symbol.for("yaml.node.type"),m=e=>!!e&&"object"==typeof e&&e[h]===l,g=e=>!!e&&"object"==typeof e&&e[h]===c,y=e=>!!e&&"object"==typeof e&&e[h]===u,b=e=>!!e&&"object"==typeof e&&e[h]===d,v=e=>!!e&&"object"==typeof e&&e[h]===f,x=e=>!!e&&"object"==typeof e&&e[h]===p;function k(e){if(e&&"object"==typeof e)switch(e[h]){case u:case p:return!0}return!1}function w(e){if(e&&"object"==typeof e)switch(e[h]){case l:case u:case f:case p:return!0}return!1}let j=e=>(v(e)||k(e))&&!!e.anchor,S=Symbol("break visit"),N=Symbol("skip children"),E=Symbol("remove node");function C(e,t){let n=T(t);g(e)?I(null,e.contents,n,Object.freeze([e]))===E&&(e.contents=null):I(null,e,n,Object.freeze([]))}function I(e,t,n,r){let s=A(e,t,n,r);if(w(s)||b(s))return $(e,r,s),I(e,s,n,r);if("symbol"!=typeof s){if(k(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let s=I(e,t.items[e],n,r);if("number"==typeof s)e=s-1;else{if(s===S)return S;s===E&&(t.items.splice(e,1),e-=1)}}}else if(b(t)){r=Object.freeze(r.concat(t));let e=I("key",t.key,n,r);if(e===S)return S;e===E&&(t.key=null);let s=I("value",t.value,n,r);if(s===S)return S;s===E&&(t.value=null)}}return s}async function L(e,t){let n=T(t);g(e)?await O(null,e.contents,n,Object.freeze([e]))===E&&(e.contents=null):await O(null,e,n,Object.freeze([]))}async function O(e,t,n,r){let s=await A(e,t,n,r);if(w(s)||b(s))return $(e,r,s),O(e,s,n,r);if("symbol"!=typeof s){if(k(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let s=await O(e,t.items[e],n,r);if("number"==typeof s)e=s-1;else{if(s===S)return S;s===E&&(t.items.splice(e,1),e-=1)}}}else if(b(t)){r=Object.freeze(r.concat(t));let e=await O("key",t.key,n,r);if(e===S)return S;e===E&&(t.key=null);let s=await O("value",t.value,n,r);if(s===S)return S;s===E&&(t.value=null)}}return s}function T(e){return"object"==typeof e&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function A(e,t,n,r){return"function"==typeof n?n(e,t,r):y(t)?n.Map?.(e,t,r):x(t)?n.Seq?.(e,t,r):b(t)?n.Pair?.(e,t,r):v(t)?n.Scalar?.(e,t,r):m(t)?n.Alias?.(e,t,r):void 0}function $(e,t,n){let r=t[t.length-1];if(k(r))r.items[e]=n;else if(b(r))"key"===e?r.key=n:r.value=n;else if(g(r))r.contents=n;else{let e=m(r)?"alias":"scalar";throw Error(`Cannot replace node with ${e} parent`)}}C.BREAK=S,C.SKIP=N,C.REMOVE=E,L.BREAK=S,L.SKIP=N,L.REMOVE=E;let M={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},D=e=>e.replace(/[!,[\]{}]/g,e=>M[e]);class P{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},P.defaultYaml,e),this.tags=Object.assign({},P.defaultTags,t)}clone(){let e=new P(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new P(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:P.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},P.defaultTags)}return e}add(e,t){this.atNextDocument&&(this.yaml={explicit:P.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},P.defaultTags),this.atNextDocument=!1);let n=e.trim().split(/[ \t]+/),r=n.shift();switch(r){case"%TAG":{if(2!==n.length&&(t(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;let[e,r]=n;return this.tags[e]=r,!0}case"%YAML":{if(this.yaml.explicit=!0,1!==n.length)return t(0,"%YAML directive should contain exactly one part"),!1;let[e]=n;if("1.1"===e||"1.2"===e)return this.yaml.version=e,!0;{let n=/^\d+\.\d+$/.test(e);return t(6,`Unsupported YAML version ${e}`,n),!1}}default:return t(0,`Unknown directive ${r}`,!0),!1}}tagName(e,t){if("!"===e)return"!";if("!"!==e[0])return t(`Not a valid tag: ${e}`),null;if("<"===e[1]){let n=e.slice(2,-1);return"!"===n||"!!"===n?(t(`Verbatim tags aren't resolved, so ${e}
1 is invalid.`),null):(">"!==e[e.length-1]&&t("Verbatim tags must end with a >"),n)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);let s=this.tags[n];if(s)try{return s+decodeURIComponent(r)}catch(e){return t(String(e)),null}return"!"===n?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+D(e.substring(n.length));return"!"===e[0]?e:`!<${e}>`}toString(e){let t,n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags);if(e&&r.length>0&&w(e.contents)){let n={};C(e.contents,(e,t)=>{w(t)&&t.tag&&(n[t.tag]=!0)}),t=Object.keys(n)}else t=[];for(let[s,i]of r)("!!"!==s||"tag:yaml.org,2002:"!==i)&&(!e||t.some(e=>e.startsWith(i)))&&n.push(`%TAG ${s} ${i}`);return n.join("\n")}}function B(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=JSON.stringify(e);throw Error(`Anchor must not contain whitespace or control characters: ${t}`)}return!0}function R(e){let t=new Set;return C(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function z(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function _(e,t,n,r){if(r&&"object"==typeof r)if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],s=_(e,r,String(t),n);void 0===s?delete r[t]:s!==n&&(r[t]=s)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),s=_(e,r,t,n);void 0===s?r.delete(t):s!==n&&r.set(t,s)}else if(r instanceof Set)for(let t of Array.from(r)){let n=_(e,r,t,t);void 0===n?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let s=_(e,r,t,n);void 0===s?delete r[t]:s!==n&&(r[t]=s)}return e.call(t,n,r)}function F(e,t,n){if(Array.isArray(e))return e.map((e,t)=>F(e,String(t),n));if(e&&"function"==typeof e.toJSON){if(!n||!j(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,delete n.onCreate};let s=e.toJSON(t,n);return n.onCreate&&n.onCreate(s),s}return"bigint"!=typeof e||n?.keep?e:Number(e)}P.defaultYaml={explicit:!1,version:"1.2"},P.defaultTags={"!!":"tag:yaml.org,2002:"};class K{constructor(e){Object.defineProperty(this,h,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:s}={}){if(!g(e))throw TypeError("A document argument is required");let i={anchors:new Map,doc:e,keep:!0,mapAsMap:!0===t,mapKeyWarned:!1,maxAliasCount:"number"==typeof n?n:100},o=F(this,"",i);if("function"==typeof r)for(let{count:e,res:t}of i.anchors.values())r(t,e);return"function"==typeof s?_(s,{"":o},"",o):o}}class q extends K{constructor(e){super(l),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error("Alias nodes cannot have tags")}})}resolve(e,t){let n,r;for(let s of(t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],C(e,{Node:(e,t)=>{(m(t)||j(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n)),n)){if(s===this)break;s.anchor===this.source&&(r=s)}return r}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:r,maxAliasCount:s}=t,i=this.resolve(r,t);if(!i)throw ReferenceError(`Unresolved alias (the anchor must be set before the alias): ${this.source}`);let o=n.get(i);if(o||(F(i,null,t),o=n.get(i)),o?.res===void 0)throw ReferenceError("This should not happen: Alias anchor was not resolved?");if(s>=0&&(o.count+=1,0===o.aliasCount&&(o.aliasCount=function e(t,n,r){if(m(n)){let e=n.resolve(t),s=r&&e&&r.get(e);return s?s.count*s.aliasCount:0}if(k(n)){let s=0;for(let i of n.items){let n=e(t,i,r);n>s&&(s=n)}return s}return b(n)?Math.max(e(t,n.key,r),e(t,n.value,r)):1}(r,i,n)),o.count*o.aliasCount>s))throw ReferenceError("Excessive alias count indicates a resource exh
1austion attack");return o.res}toString(e,t,n){let r=`*${this.source}`;if(e){if(B(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source))throw Error(`Unresolved alias (the anchor must be set before the alias): ${this.source}`);if(e.implicitKey)return`${r} `}return r}}let U=e=>!e||"function"!=typeof e&&"object"!=typeof e;class W extends K{constructor(e){super(f),this.value=e}toJSON(e,t){return t?.keep?this.value:F(this.value,e,t)}toString(){return String(this.value)}}function G(e,t,n){let r;if(g(e)&&(e=e.contents),w(e))return e;if(b(e)){let t=n.schema[u].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||"u">typeof BigInt&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:s,onAnchor:i,onTagObj:o,schema:a,sourceObjects:l}=n;if(s&&e&&"object"==typeof e){if(r=l.get(e))return r.anchor??(r.anchor=i(e)),new q(r.anchor);r={anchor:null,node:null},l.set(e,r)}t?.startsWith("!!")&&(t="tag:yaml.org,2002:"+t.slice(2));let c=function(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}(e,t,a.tags);if(!c){if(e&&"function"==typeof e.toJSON&&(e=e.toJSON()),!e||"object"!=typeof e){let t=new W(e);return r&&(r.node=t),t}c=e instanceof Map?a[u]:Symbol.iterator in Object(e)?a[p]:a[u]}o&&(o(c),delete n.onTagObj);let d=c?.createNode?c.createNode(n.schema,e,n):"function"==typeof c?.nodeClass?.from?c.nodeClass.from(n.schema,e,n):new W(e);return t?d.tag=t:c.default||(d.tag=c.tag),r&&(r.node=d),d}function V(e,t,n){let r=n;for(let e=t.length-1;e>=0;--e){let n=t[e];if("number"==typeof n&&Number.isInteger(n)&&n>=0){let e=[];e[n]=r,r=e}else r=new Map([[n,r]])}return G(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}W.BLOCK_FOLDED="BLOCK_FOLDED",W.BLOCK_LITERAL="BLOCK_LITERAL",W.PLAIN="PLAIN",W.QUOTE_DOUBLE="QUOTE_DOUBLE",W.QUOTE_SINGLE="QUOTE_SINGLE";let H=e=>null==e||"object"==typeof e&&!!e[Symbol.iterator]().next().done;class J extends K{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>w(t)||b(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(H(e))this.add(t);else{let[n,...r]=e,s=this.get(n,!0);if(k(s))s.addIn(r,t);else if(void 0===s&&this.schema)this.set(n,V(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[t,...n]=e;if(0===n.length)return this.delete(t);let r=this.get(t,!0);if(k(r))return r.deleteIn(n);throw Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...r]=e,s=this.get(n,!0);return 0===r.length?!t&&v(s)?s.value:s:k(s)?s.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!b(t))return!1;let n=t.value;return null==n||e&&v(n)&&null==n.value&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(0===n.length)return this.has(t);let r=this.get(t,!0);return!!k(r)&&r.hasIn(n)}setIn(e,t){let[n,...r]=e;if(0===r.length)this.set(n,t);else{let e=this.get(n,!0);if(k(e))e.setIn(r,t);else if(void 0===e&&this.schema)this.set(n,V(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}}let Y=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function Q(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}let X=(e,t,n)=>e.endsWith("\n")?Q(n,t):n.includes("\n")?"\n"+Q(n,t):(e.endsWith(" ")?"":" ")+n,Z="flow",ee="block",et="quoted";function en(e,t,n="flow",{indentAtStart:r,lineWidth:s=80,minContentWidth:i=20,onFold:o,onOverflow:a}={}){let l,c,u;if(!s||s<0)return e;s<i&&(i=0);let d=Math.max(1+i,1+s-t.length);if(e.length<=d)return e;let f=[],p={},h=s-t.length;"number"==typeof r&&(r>s-Math.max(2,i)?f.push(0):h=s-r);let m=!1,g=-1,y=-1,b=-1;for(n===ee&&-1!==(g=er(e,g,t.length))&&(h=g+d);u=e[g+=1];){if(n===et&&"\\"===u){switch(y=g,e[g+1]){case"x":g+=3;break;case"u":g+=5;break;case"U":g+=9;break;default:g+=1}b=g}if("\n"===u)n===ee&&(g=er(e,g,t.length)),h=g+t.length+d,l=void 0;else{if(" "===u&&c&&" "!==c&&"\n"!==c&&" "!==c){let t=e[g+1];t&&" "!==t&&"\n"!==t&&" "!==t&&(l=g)}if(g>=h)if(l)f.push(l),h=l+d,l=void 0;else if(n===et){for(;" "===c||" "===c;)c=u,u=e[g+=1],m=!0;let t=g>b+1?g-2:y-1;if(p[t])return e;
1f.push(t),p[t]=!0,h=t+d,l=void 0}else m=!0}c=u}if(m&&a&&a(),0===f.length)return e;o&&o();let v=e.slice(0,f[0]);for(let r=0;r<f.length;++r){let s=f[r],i=f[r+1]||e.length;0===s?v=` 2${t}${e.slice(0,i)}`:(n===et&&p[s]&&(v+=`${e[s]}\\`),v+=` 3${t}${e.slice(s+1,i)}`)}return v}function er(e,t,n){let r=t,s=t+1,i=e[s];for(;" "===i||" "===i;)if(t<s+n)i=e[++t];else{do i=e[++t];while(i&&"\n"!==i)r=t,i=e[s=t+1]}return r}let es=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth});function ei(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,s=t.options.doubleQuotedMinMultiLineLength,i=t.indent||(/^(%|---|\.\.\.)/m.test(e)?" ":""),o="",a=0;for(let e=0,t=n[e];t;t=n[++e])if(" "===t&&"\\"===n[e+1]&&"n"===n[e+2]&&(o+=n.slice(a,e)+"\\ ",e+=1,a=e,t="\\"),"\\"===t)switch(n[e+1]){case"u":{o+=n.slice(a,e);let t=n.substr(e+2,4);switch(t){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:"00"===t.substr(0,2)?o+="\\x"+t.substr(2):o+=n.substr(e,6)}e+=5,a=e+1}break;case"n":if(r||'"'===n[e+2]||n.length<s)e+=1;else{for(o+=n.slice(a,e)+"\n\n";"\\"===n[e+2]&&"n"===n[e+3]&&'"'!==n[e+4];)o+="\n",e+=2;o+=i," "===n[e+2]&&(o+="\\"),e+=1,a=e+1}break;default:e+=1}return o=a?o+n.slice(a):n,r?o:en(o,i,et,es(t,!1))}function eo(e,t){if(!1===t.options.singleQuote||t.implicitKey&&e.includes("\n")||/[ \t]\n|\n[ \t]/.test(e))return ei(e,t);let n=t.indent||(/^(%|---|\.\.\.)/m.test(e)?" ":""),r="'"+e.replace(/'/g,"''").replace(/\n+/g,`$& 4${n}`)+"'";return t.implicitKey?r:en(r,n,Z,es(t,!1))}function ea(e,t){let n,{singleQuote:r}=t.options;if(!1===r)n=ei;else{let t=e.includes('"'),s=e.includes("'");n=t&&!s?eo:s&&!t?ei:r?eo:ei}return n(e,t)}try{t=RegExp("(^|(?<!\n))\n+(?!\n|$)","g")}catch{t=/\n+(?!\n|$)/g}function el({comment:e,type:n,value:r},s,i,o){let a,l,c,u,{blockQuote:d,commentString:f,lineWidth:p}=s.options;if(!d||/\n[\t ]+$/.test(r))return ea(r,s);let h=s.indent||(s.forceBlockIndent||(u=r,/^(%|---|\.\.\.)/m.test(u))?" ":""),m="literal"===d||"folded"!==d&&n!==W.BLOCK_FOLDED&&(n===W.BLOCK_LITERAL||!function(e,t,n){if(!t||t<0)return!1;let r=t-n,s=e.length;if(s<=r)return!1;for(let t=0,n=0;t<s;++t)if("\n"===e[t]){if(t-n>r)return!0;if(s-(n=t+1)<=r)return!1}return!0}(r,p,h.length));if(!r)return m?"|\n":">\n";for(l=r.length;l>0;--l){let e=r[l-1];if("\n"!==e&&" "!==e&&" "!==e)break}let g=r.substring(l),y=g.indexOf("\n");-1===y?a="-":r===g||y!==g.length-1?(a="+",o&&o()):a="",g&&(r=r.slice(0,-g.length),"\n"===g[g.length-1]&&(g=g.slice(0,-1)),g=g.replace(t,`$&${h}`));let b=!1,v=-1;for(c=0;c<r.length;++c){let e=r[c];if(" "===e)b=!0;else if("\n"===e)v=c;else break}let x=r.substring(0,v<c?v+1:c);x&&(r=r.substring(x.length),x=x.replace(/\n+/g,`$&${h}`));let k=h?"2":"1",w=(b?k:"")+a;if(e&&(w+=" "+f(e.replace(/ ?[\r\n]+/g," ")),i&&i()),!m){let e=r.replace(/\n+/g,"\n$&").replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${h}`),t=!1,i=es(s,!0);"folded"!==d&&n!==W.BLOCK_FOLDED&&(i.onOverflow=()=>{t=!0});let o=en(`${x}${e}${g}`,h,ee,i);if(!t)return`>${w} 5${h}${o}`}return r=r.replace(/\n+/g,`$&${h}`),`|${w} 6${h}${x}${r}${g}`}function ec(e,t,n,r){let{implicitKey:s,inFlow:i}=t,o="string"==typeof e.value?e:Object.assign({},e,{value:String(e.value)}),{type:a}=e;a!==W.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=W.QUOTE_DOUBLE);let l=e=>{switch(e){case W.BLOCK_FOLDED:case W.BLOCK_LITERAL:return s||i?ea(o.value,t):el(o,t,n,r);case W.QUOTE_DOUBLE:return ei(o.value,t);case W.QUOTE_SINGLE:return eo(o.value,t);case W.PLAIN:return function(e,t,n,r){let{type:s,value:i}=e,{actualString:o,implicitKey:a,indent:l,indentStep:c,inFlow:u}=t;if(a&&i.includes("\n")||u&&/[[\]{},]/.test(i))return ea(i,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(i))return a||u||!i.includes("\n")?ea(i,t):el(e,t,n,r);if(!a&&!u&&s!==W.PLAIN&&i.includes("\n"))return el(e,t,n,r);
6if(/^(%|---|\.\.\.)/m.test(i)){if(""===l)return t.forceBlockIndent=!0,el(e,t,n,r);else if(a&&l===c)return ea(i,t)}let d=i.replace(/\n+/g,`$& 7${l}`);if(o){let e=e=>e.default&&"tag:yaml.org,2002:str"!==e.tag&&e.test?.test(d),{compat:n,tags:r}=t.doc.schema;if(r.some(e)||n?.some(e))return ea(i,t)}return a?d:en(d,l,Z,es(t,!1))}(o,t,n,r);default:return null}},c=l(a);if(null===c){let{defaultKeyType:e,defaultStringType:n}=t.options,r=s&&e||n;if(null===(c=l(r)))throw Error(`Unsupported default string type ${r}`)}return c}function eu(e,t){let n,r=Object.assign({blockQuote:!0,commentString:Y,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);switch(r.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:e,flowCollectionPadding:r.flowCollectionPadding?" ":"",indent:"",indentStep:"number"==typeof r.indent?" ".repeat(r.indent):" ",inFlow:n,options:r}}function ed(e,t,n,r){let s;if(b(e))return e.toString(t,n,r);if(m(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw 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=w(e)?e:t.doc.createNode(e,{onTagObj:e=>s=e});s??(s=function(e,t){let n,r;if(t.tag){let n=e.filter(e=>e.tag===t.tag);if(n.length>0)return n.find(e=>e.format===t.format)??n[0]}if(v(t)){n=t.value;let s=e.filter(e=>e.identify?.(n));if(s.length>1){let e=s.filter(e=>e.test);e.length>0&&(s=e)}r=s.find(e=>e.format===t.format)??s.find(e=>!e.format)}else n=t,r=e.find(e=>e.nodeClass&&n instanceof e.nodeClass);if(!r){let e=n?.constructor?.name??(null===n?"null":typeof n);throw Error(`Tag not resolved for ${e} value`)}return r}(t.doc.schema.tags,i));let o=function(e,t,{anchors:n,doc:r}){if(!r.directives)return"";let s=[],i=(v(e)||k(e))&&e.anchor;i&&B(i)&&(n.add(i),s.push(`&${i}`));let o=e.tag??(t.default?null:t.tag);return o&&s.push(r.directives.tagString(o)),s.join(" ")}(i,s,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);let a="function"==typeof s.stringify?s.stringify(i,t,n,r):v(i)?ec(i,t,n,r):i.toString(t,n,r);
7return o?v(i)||"{"===a[0]||"["===a[0]?`${o} ${a}`:`${o} 8${t.indent}${a}`:a}function ef(e,t){("debug"===e||"warn"===e)&&console.warn(t)}let ep={identify:e=>"<<"===e||"symbol"==typeof e&&"<<"===e.description,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new W(Symbol("<<")),{addToJSMap:eh}),stringify:()=>"<<"};function eh(e,t,n){if(x(n=e&&m(n)?n.resolve(e.doc):n))for(let r of n.items)em(e,t,r);else if(Array.isArray(n))for(let r of n)em(e,t,r);else em(e,t,n)}function em(e,t,n){let r=e&&m(n)?n.resolve(e.doc):n;if(!y(r))throw Error("Merge sources must be maps or map aliases");for(let[n,s]of r.toJSON(null,e,Map))t instanceof Map?t.has(n)||t.set(n,s):t instanceof Set?t.add(n):Object.prototype.hasOwnProperty.call(t,n)||Object.defineProperty(t,n,{value:s,writable:!0,enumerable:!0,configurable:!0});return t}function eg(e,t,{key:n,value:r}){if(w(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if((ep.identify(n)||v(n)&&(!n.type||n.type===W.PLAIN)&&ep.identify(n.value))&&e?.doc.schema.tags.some(e=>e.tag===ep.tag&&e.default))eh(e,t,r);else{let s=F(n,"",e);if(t instanceof Map)t.set(s,F(r,s,e));else if(t instanceof Set)t.add(s);else{let i=function(e,t,n){if(null===t)return"";if("object"!=typeof t)return String(t);if(w(e)&&n?.doc){let t=eu(n.doc,{});for(let e of(t.anchors=new Set,n.anchors.keys()))t.anchors.add(e.anchor);t.inFlow=!0,t.inStringifyKey=!0;let r=e.toString(t);if(!n.mapKeyWarned){let e=JSON.stringify(r);e.length>40&&(e=e.substring(0,36)+'..."'),ef(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,s,e),o=F(r,i,e);i in t?Object.defineProperty(t,i,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[i]=o}}return t}function ey(e,t,n){return new eb(G(e,void 0,n),G(t,void 0,n))}class eb{constructor(e,t=null){Object.defineProperty(this,h,{value:d}),this.key=e,this.value=t}clone(e){let{key:t,value:n}=this;return w(t)&&(t=t.clone(e)),w(n)&&(n=n.clone(e)),new eb(t,n)}toJSON(e,t){let n=t?.mapAsMap?new Map:{};return eg(t,n,this)}toString(e,t,n){return e?.doc?function({key:e,value:t},n,r,s){let i,o,a,{allNullValues:l,doc:c,indent:u,indentStep:d,options:{commentString:f,indentSeq:p,simpleKeys:h}}=n,m=w(e)&&e.comment||null;if(h){if(m)throw Error("With simple keys, key nodes cannot have comments");if(k(e)||!w(e)&&"object"==typeof e)throw Error("With simple keys, collection cannot be used as a key value")}let g=!h&&(!e||m&&null==t&&!n.inFlow||k(e)||(v(e)?e.type===W.BLOCK_FOLDED||e.type===W.BLOCK_LITERAL:"object"==typeof e));n=Object.assign({},n,{allNullValues:!1,implicitKey:!g&&(h||!l),indent:u+d});let y=!1,b=!1,j=ed(e,n,()=>y=!0,()=>b=!0);if(!g&&!n.inFlow&&j.length>1024){if(h)throw Error("With simple keys, single line scalar must not span more than 1024 characters");g=!0}if(n.inFlow){if(l||null==t)return y&&r&&r(),""===j?"?":g?`? ${j}`:j}else if(l&&!h||null==t&&g)return j=`? ${j}`,m&&!y?j+=X(j,n.indent,f(m)):b&&s&&s(),j;y&&(m=null),g?(m&&(j+=X(j,n.indent,f(m))),j=`? ${j} 9${u}:`):(j=`${j}:`,m&&(j+=X(j,n.indent,f(m)))),w(t)?(i=!!t.spaceBefore,o=t.commentBefore,a=t.comment):(i=!1,o=null,a=null,t&&"object"==typeof t&&(t=c.createNode(t))),n.implicitKey=!1,!g&&!m&&v(t)&&(n.indentAtStart=j.length+1),b=!1,!(!p&&d.length>=2&&!n.inFlow&&!g&&x(t))||t.flow||t.tag||t.anchor||(n.indent=n.indent.substring(2));let S=!1,N=ed(t,n,()=>S=!0,()=>b=!0),E=" ";if(m||i||o){if(E=i?"\n":"",o){let e=f(o);E+=` 10${Q(e,n.indent)}`}""!==N||n.inFlow?E+=` 11${n.indent}`:"\n"===E&&a&&(E="\n\n")}else if(!g&&k(t)){let e=N[0],r=N.indexOf("\n"),s=-1!==r,i=n.inFlow??t.flow??0===t.items.length;if(s||!i){let t=!1;if(s&&("&"===e||"!"===e)){let n=N.indexOf(" ");"&"===e&&-1!==n&&n<r&&"!"===N[n+1]&&(n=N.indexOf(" ",n+1)),(-1===n||r<n)&&(t=!0)}t||(E=` 12${n.indent}`)}}else(""===N||"\n"===N[0])&&(E="");return j+=E+N,n.inFlow?S&&r&&r():a&&!S?j+=X(j,n.indent,f(a)):b&&s&&s(),j}(this,e,t,n):JSON.stringify(this)}}function ev(e,t,n){return(t.inFlow??e.flow?function({items:e},t,{flowChars:n,itemIndent:r}){let{indent:s,indentStep:i,flowCollectionPadding:o,options:{commentString:a}}=t,l=Object.assign({},t,{indent:r+=i,inFlow:!0,type:null}),c=!1,u=0,d=[];for(let n=0;n<e.length;++n){let s=e[n],i=null;if(w(s))s.spaceBefore&&d.push(""),ex(t,d,s.commentBefore,!1),s.comment&&(i=s.comment);else if(b(s)){let e=w(s.key)?s.key:null;e&&(e.spaceBefore&&d.push(""),ex(t,d,e.commentBefore,!1),e.comment&&(c=!0));let n=w(s.value)?s.value:null;n?(n.comment&&(i=n.comment),n.commentBefore&&(c=!0)):null==s.value&&e?.comment&&(i=e.comment)}i&&(c=!0);let o=ed(s,l,()=>i=null);n<e.length-1&&(o+=","),i&&(o+=X(o,r,a(i))),!c&&(d.length>u||o.includes("\n"))&&(c=!0),d.push(o),u=d.length}let{start:f,end:p}=n;
12if(0===d.length)return f+p;if(!c){let e=d.reduce((e,t)=>e+t.length+2,2);c=t.options.lineWidth>0&&e>t.options.lineWidth}if(!c)return`${f}${o}${d.join(" ")}${o}${p}`;{let e=f;for(let t of d)e+=t?` 13${i}${s}${t}`:"\n";return`${e} 14${s}${p}`}}:function({comment:e,items:t},n,{blockItemPrefix:r,flowChars:s,itemIndent:i,onChompKeep:o,onComment:a}){let l,{indent:c,options:{commentString:u}}=n,d=Object.assign({},n,{indent:i,type:null}),f=!1,p=[];for(let e=0;e<t.length;++e){let s=t[e],o=null;if(w(s))!f&&s.spaceBefore&&p.push(""),ex(n,p,s.commentBefore,f),s.comment&&(o=s.comment);else if(b(s)){let e=w(s.key)?s.key:null;e&&(!f&&e.spaceBefore&&p.push(""),ex(n,p,e.commentBefore,f))}f=!1;let a=ed(s,d,()=>o=null,()=>f=!0);o&&(a+=X(a,i,u(o))),f&&o&&(f=!1),p.push(r+a)}if(0===p.length)l=s.start+s.end;else{l=p[0];for(let e=1;e<p.length;++e){let t=p[e];l+=t?` 15${c}${t}`:"\n"}}return e?(l+="\n"+Q(u(e),c),a&&a()):f&&o&&o(),l})(e,t,n)}function ex({indent:e,options:{commentString:t}},n,r,s){if(r&&s&&(r=r.replace(/^\n+/,"")),r){let s=Q(t(r),e);n.push(s.trimStart())}}function ek(e,t){let n=v(t)?t.value:t;for(let r of e)if(b(r)&&(r.key===t||r.key===n||v(r.key)&&r.key.value===n))return r}class ew extends J{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(u,e),this.items=[]}static from(e,t,n){let{keepUndefined:r,replacer:s}=n,i=new this(e),o=(e,o)=>{if("function"==typeof s)o=s.call(t,e,o);else if(Array.isArray(s)&&!s.includes(e))return;(void 0!==o||r)&&i.items.push(ey(e,o,n))};if(t instanceof Map)for(let[e,n]of t)o(e,n);else if(t&&"object"==typeof t)for(let e of Object.keys(t))o(e,t[e]);return"function"==typeof e.sortMapEntries&&i.items.sort(e.sortMapEntries),i}add(e,t){let n;n=b(e)?e:e&&"object"==typeof e&&"key"in e?new eb(e.key,e.value):new eb(e,e?.value);let r=ek(this.items,n.key),s=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);v(r.value)&&U(n.value)?r.value.value=n.value:r.value=n.value}else if(s){let e=this.items.findIndex(e=>0>s(n,e));-1===e?this.items.push(n):this.items.splice(e,0,n)}else this.items.push(n)}delete(e){let t=ek(this.items,e);return!!t&&this.items.splice(this.items.indexOf(t),1).length>0}get(e,t){let n=ek(this.items,e),r=n?.value;return(!t&&v(r)?r.value:r)??void 0}has(e){return!!ek(this.items,e)}set(e,t){this.add(new eb(e,t),!0)}toJSON(e,t,n){let r=n?new n:t?.mapAsMap?new Map:{};for(let e of(t?.onCreate&&t.onCreate(r),this.items))eg(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!b(e))throw Error(`Map items must all be pairs; found ${JSON.stringify(e)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),ev(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:t})}}let ej={collection:"map",default:!0,nodeClass:ew,tag:"tag:yaml.org,2002:map",resolve:(e,t)=>(y(e)||t("Expected a mapping for this tag"),e),createNode:(e,t,n)=>ew.from(e,t,n)};class eS extends J{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(p,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=eN(e);return"number"==typeof t&&this.items.splice(t,1).length>0}get(e,t){let n=eN(e);if("number"!=typeof n)return;let r=this.items[n];return!t&&v(r)?r.value:r}has(e){let t=eN(e);return"number"==typeof t&&t<this.items.length}set(e,t){let n=eN(e);if("number"!=typeof n)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];v(r)&&U(t)?r.value=t:this.items[n]=t}toJSON(e,t){let n=[];t?.onCreate&&t.onCreate(n);let r=0;for(let e of this.items)n.push(F(e,String(r++),t));return n}toString(e,t,n){return e?ev(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:n,onComment:t}):JSON.stringify(this)}static from(e,t,n){let{replacer:r}=n,s=new this(e);if(t&&Symbol.iterator in Object(t)){let e=0;for(let i of t){if("function"==typeof r){let n=t instanceof Set?i:String(e++);i=r.call(t,n,i)}s.items.push(G(i,void 0,n))}}return s}}function eN(e){let t=v(e)?e.value:e;return t&&"string"==typeof t&&(t=Number(t)),"number"==typeof t&&Number.isInteger(t)&&t>=0?t:null}let eE={collection:"seq",default:!0,nodeClass:eS,tag:"tag:yaml.org,2002:seq",resolve:(e,t)=>
15(x(e)||t("Expected a sequence for this tag"),e),createNode:(e,t,n)=>eS.from(e,t,n)},eC={identify:e=>"string"==typeof e,default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:(e,t,n,r)=>ec(e,t=Object.assign({actualString:!0},t),n,r)},eI={identify:e=>null==e,createNode:()=>new W(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new W(null),stringify:({source:e},t)=>"string"==typeof e&&eI.test.test(e)?e:t.options.nullStr},eL={identify:e=>"boolean"==typeof e,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new W("t"===e[0]||"T"===e[0]),stringify:({source:e,value:t},n)=>e&&eL.test.test(e)&&t===("t"===e[0]||"T"===e[0])?e:t?n.options.trueStr:n.options.falseStr};function eO({format:e,minFractionDigits:t,tag:n,value:r}){if("bigint"==typeof r)return String(r);let s="number"==typeof r?r:Number(r);if(!isFinite(s))return isNaN(s)?".nan":s<0?"-.inf":".inf";let i=Object.is(r,-0)?"-0":JSON.stringify(r);if(!e&&t&&(!n||"tag:yaml.org,2002:float"===n)&&/^\d/.test(i)){let e=i.indexOf(".");e<0&&(e=i.length,i+=".");let n=t-(i.length-e-1);for(;n-- >0;)i+="0"}return i}let eT={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]?-1/0:1/0,stringify:eO},eA={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){let t=Number(e.value);return isFinite(t)?t.toExponential():eO(e)}},e$={identify:e=>"number"==typeof e,default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let t=new W(parseFloat(e)),n=e.indexOf(".");return -1!==n&&"0"===e[e.length-1]&&(t.minFractionDigits=e.length-n-1),t},stringify:eO},eM=e=>"bigint"==typeof e||Number.isInteger(e),eD=(e,t,n,{intAsBigInt:r})=>r?BigInt(e):parseInt(e.substring(t),n);function eP(e,t,n){let{value:r}=e;return eM(r)&&r>=0?n+r.toString(t):eO(e)}let eB={identify:e=>eM(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,n)=>eD(e,2,8,n),stringify:e=>eP(e,8,"0o")},eR={identify:eM,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>eD(e,0,10,n),stringify:eO},ez={identify:e=>eM(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>eD(e,2,16,n),stringify:e=>eP(e,16,"0x")},e_=[ej,eE,eC,eI,eL,eB,eR,ez,eT,eA,e$];function eF(e){return"bigint"==typeof e||Number.isInteger(e)}let eK=({value:e})=>JSON.stringify(e),eq=[ej,eE].concat([{identify:e=>"string"==typeof e,default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:eK},{identify:e=>null==e,createNode:()=>new W(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:eK},{identify:e=>"boolean"==typeof e,default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>"true"===e,stringify:eK},{identify:eF,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})=>eF(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:eK}],{default:!0,tag:"",test:/^/,resolve:(e,t)=>(t(`Unresolved plain scalar ${JSON.stringify(e)}`),e)}),eU={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if("function"!=typeof atob)return t("This environment does not support reading binary tags; either Buffer or atob is required"),e;{let t=atob(e.replace(/[\n\r]/g,"")),n=new Uint8Array(t.length);for(let e=0;e<t.length;++e)n[e]=t.charCodeAt(e);return n}},stringify({comment:e,type:t,value:n},r,s,i){let o;if(!n)return"";if("function"==typeof btoa){let e="";for(let t=0;t<n.length;++t)e+=String.fromCharCode(n[t]);o=btoa(e)}else throw Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(t??(t=W.BLOCK_LITERAL),t!==W.QUOTE_DOUBLE){let e=Math.max(r.options.lineWidth-r.indent.length,r.options.minContentWidth),n=Math.ceil(o.length/e),s=Array(n);for(let t=0,r=0;t<n;++t,r+=e)s[t]=o.substr(r,e);o=s.join(t===W.BLOCK_LITERAL?"\n":" ")}return ec({comment:e,type:t,value:o},r,s,i)}};function eW(e,t){if(x(e))for(let n=0;n<e.items.length;++n){let r=e.items[n];if(!b(r)){if(y(r)){r.items.length>1&&t("Each pair must have its own sequence indicator");
15let e=r.items[0]||new eb(new W(null));if(r.commentBefore&&(e.key.commentBefore=e.key.commentBefore?`${r.commentBefore} 16${e.key.commentBefore}`:r.commentBefore),r.comment){let t=e.value??e.key;t.comment=t.comment?`${r.comment} 17${t.comment}`:r.comment}r=e}e.items[n]=b(r)?r:new eb(r)}}else t("Expected a sequence for this tag");return e}function eG(e,t,n){let{replacer:r}=n,s=new eS(e);s.tag="tag:yaml.org,2002:pairs";let i=0;if(t&&Symbol.iterator in Object(t))for(let e of t){let o,a;if("function"==typeof r&&(e=r.call(t,String(i++),e)),Array.isArray(e))if(2===e.length)o=e[0],a=e[1];else throw TypeError(`Expected [key, value] tuple: ${e}`);else if(e&&e instanceof Object){let t=Object.keys(e);if(1===t.length)a=e[o=t[0]];else throw TypeError(`Expected tuple with one key, not ${t.length} keys`)}else o=e;s.items.push(ey(o,a,n))}return s}let eV={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:eW,createNode:eG};class eH extends eS{constructor(){super(),this.add=ew.prototype.add.bind(this),this.delete=ew.prototype.delete.bind(this),this.get=ew.prototype.get.bind(this),this.has=ew.prototype.has.bind(this),this.set=ew.prototype.set.bind(this),this.tag=eH.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;for(let e of(t?.onCreate&&t.onCreate(n),this.items)){let r,s;if(b(e)?(r=F(e.key,"",t),s=F(e.value,r,t)):r=F(e,"",t),n.has(r))throw Error("Ordered maps must not include duplicate keys");n.set(r,s)}return n}static from(e,t,n){let r=eG(e,t,n),s=new this;return s.items=r.items,s}}eH.tag="tag:yaml.org,2002:omap";let eJ={collection:"seq",identify:e=>e instanceof Map,nodeClass:eH,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){let n=eW(e,t),r=[];for(let{key:e}of n.items)v(e)&&(r.includes(e.value)?t(`Ordered maps must not include duplicate keys: ${e.value}`):r.push(e.value));return Object.assign(new eH,n)},createNode:(e,t,n)=>eH.from(e,t,n)};function eY({value:e,source:t},n){return t&&(e?eQ:eX).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}let eQ={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 W(!0),stringify:eY},eX={identify:e=>!1===e,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new W(!1),stringify:eY},eZ=e=>"bigint"==typeof e||Number.isInteger(e);function e0(e,t,n,{intAsBigInt:r}){let s=e[0];if(("-"===s||"+"===s)&&(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}`}let t=BigInt(e);return"-"===s?BigInt(-1)*t:t}let i=parseInt(e,n);return"-"===s?-1*i:i}function e1(e,t,n){let{value:r}=e;if(eZ(r)){let e=r.toString(t);return r<0?"-"+n+e.substr(1):n+e}return eO(e)}class e2 extends ew{constructor(e){super(e),this.tag=e2.tag}add(e){let t;t=b(e)?e:e&&"object"==typeof e&&"key"in e&&"value"in e&&null===e.value?new eb(e.key,null):new eb(e,null),ek(this.items,t.key)||this.items.push(t)}get(e,t){let n=ek(this.items,e);return!t&&b(n)?v(n.key)?n.key.value:n.key:n}set(e,t){if("boolean"!=typeof t)throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=ek(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new eb(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 Error("Set items must all have null values")}static from(e,t,n){let{replacer:r}=n,s=new this(e);if(t&&Symbol.iterator in Object(t))for(let e of t)"function"==typeof r&&(e=r.call(t,e,e)),s.items.push(ey(e,null,n));return s}}e2.tag="tag:yaml.org,2002:set";let e5={collection:"map",identify:e=>e instanceof Set,nodeClass:e2,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,n)=>e2.from(e,t,n),resolve(e,t){if(y(e))if(e.hasAllNullValues(!0))return Object.assign(new e2,e);else t("Set items must all have null values");else t("Expected a mapping for this tag");return e}};function e3(e,t){let n=e[0],r="-"===n||"+"===n?e.substring(1):e,s=e=>t?BigInt(e):Number(e),i=r.replace(/_/g,"").split(":").reduce((e,t)=>
17e*s(60)+s(t),s(0));return"-"===n?s(-1)*i:i}function e8(e){let{value:t}=e,n=e=>e;if("bigint"==typeof t)n=e=>BigInt(e);else if(isNaN(t)||!isFinite(t))return eO(e);let r="";t<0&&(r="-",t*=n(-1));let s=n(60),i=[t%s];return t<60?i.unshift(0):(t=(t-i[0])/s,i.unshift(t%s),t>=60&&(t=(t-i[0])/s,i.unshift(t))),r+i.map(e=>String(e).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}let e9={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})=>e3(e,n),stringify:e8},e4={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=>e3(e,!1),stringify:e8},e6={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){let t=e.match(e6.test);if(!t)throw Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,n,r,s,i,o,a]=t.map(Number),l=Date.UTC(n,r-1,s,i||0,o||0,a||0,t[7]?Number((t[7]+"00").substr(1,3)):0),c=t[8];if(c&&"Z"!==c){let e=e3(c,!1);30>Math.abs(e)&&(e*=60),l-=6e4*e}return new Date(l)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""},e7=[ej,eE,eC,eI,eQ,eX,{identify:eZ,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>e0(e,2,2,n),stringify:e=>e1(e,2,"0b")},{identify:eZ,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>e0(e,1,8,n),stringify:e=>e1(e,8,"0")},{identify:eZ,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>e0(e,0,10,n),stringify:eO},{identify:eZ,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>e0(e,2,16,n),stringify:e=>e1(e,16,"0x")},{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]?-1/0:1/0,stringify:eO},{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){let t=Number(e.value);return isFinite(t)?t.toExponential():eO(e)}},{identify:e=>"number"==typeof e,default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new W(parseFloat(e.replace(/_/g,""))),n=e.indexOf(".");if(-1!==n){let r=e.substring(n+1).replace(/_/g,"");"0"===r[r.length-1]&&(t.minFractionDigits=r.length)}return t},stringify:eO},eU,ep,eJ,eV,e5,e9,e4,e6],te=new Map([["core",e_],["failsafe",[ej,eE,eC]],["json",eq],["yaml11",e7],["yaml-1.1",e7]]),tt={binary:eU,bool:eL,float:e$,floatExp:eA,floatNaN:eT,floatTime:e4,int:eR,intHex:ez,intOct:eB,intTime:e9,map:ej,merge:ep,null:eI,omap:eJ,pairs:eV,seq:eE,set:e5,timestamp:e6},tn={"tag:yaml.org,2002:binary":eU,"tag:yaml.org,2002:merge":ep,"tag:yaml.org,2002:omap":eJ,"tag:yaml.org,2002:pairs":eV,"tag:yaml.org,2002:set":e5,"tag:yaml.org,2002:timestamp":e6};function tr(e,t,n){let r=te.get(t);if(r&&!e)return n&&!r.includes(ep)?r.concat(ep):r.slice();let s=r;if(!s)if(Array.isArray(e))s=[];else{let e=Array.from(te.keys()).filter(e=>"yaml11"!==e).map(e=>JSON.stringify(e)).join(", ");throw Error(`Unknown schema "${t}"; use one of ${e} or define customTags array`)}if(Array.isArray(e))for(let t of e)s=s.concat(t);else"function"==typeof e&&(s=e(s.slice()));return n&&(s=s.concat(ep)),s.reduce((e,t)=>{let n="string"==typeof t?tt[t]:t;if(!n){let e=JSON.stringify(t),n=Object.keys(tt).map(e=>JSON.stringify(e)).join(", ");throw Error(`Unknown custom tag ${e}; use one of ${n}`)}return e.includes(n)||e.push(n),e},[])}let ts=(e,t)=>e.key<t.key?-1:+(e.key>t.key);class ti{constructor({compat:e,customTags:t,merge:n,resolveKnownTags:r,schema:s,sortMapEntries:i,toStringDefaults:o}){this.compat=Array.isArray(e)?tr(e,"compat"):e?tr(null,e):null,this.name="string"==typeof s&&s||"core",this.knownTags=r?tn:{},this.tags=tr(t,this.name,n),this.toStringOptions=o??null,Object.defineProperty(this,u,{value:ej}),Object.defineProperty(this,f,{value:eC}),Object.defineProperty(this,p,{value:eE}),this.sortMapEntries="function"==typeof i?i:!0===i?ts:null}clone(){let e=Object.create(ti.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}}class to{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,h,{value:c});let r=null;"function"==typeof t||Array.isArray(t)?r=t:void 0===n&&t&&(n=t,t=void 0);const s=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},n);this.options=s;let{version:i}=s;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(i=this.directives.yaml.version)):this.directives=new P({ver
17sion:i}),this.setSchema(i,n),this.contents=void 0===e?null:this.createNode(e,r,n)}clone(){let e=Object.create(to.prototype,{[h]:{value:c}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=w(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){ta(this.contents)&&this.contents.add(e)}addIn(e,t){ta(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=R(this);e.anchor=!t||n.has(t)?z(t||"a",n):t}return new q(e.anchor)}createNode(e,t,n){var r,s;let i,o,a,l;if("function"==typeof t)e=t.call({"":e},"",e),i=t;else if(Array.isArray(t)){let e=t.filter(e=>"number"==typeof e||e instanceof String||e instanceof Number).map(String);e.length>0&&(t=t.concat(e)),i=t}else void 0===n&&t&&(n=t,t=void 0);let{aliasDuplicateObjects:c,anchorPrefix:u,flow:d,keepUndefined:f,onTagObj:p,tag:h}=n??{},{onAnchor:m,setAnchors:g,sourceObjects:y}=(r=this,s=u||"a",o=[],a=new Map,l=null,{onAnchor:e=>{o.push(e),l??(l=R(r));let t=z(s,l);return l.add(t),t},setAnchors:()=>{for(let e of o){let t=a.get(e);if("object"==typeof t&&t.anchor&&(v(t.node)||k(t.node)))t.node.anchor=t.anchor;else{let t=Error("Failed to resolve repeated object (this should not happen)");throw t.source=e,t}}},sourceObjects:a}),b={aliasDuplicateObjects:c??!0,keepUndefined:f??!1,onAnchor:m,onTagObj:p,replacer:i,schema:this.schema,sourceObjects:y},x=G(e,h,b);return d&&k(x)&&(x.flow=!0),g(),x}createPair(e,t,n={}){return new eb(this.createNode(e,null,n),this.createNode(t,null,n))}delete(e){return!!ta(this.contents)&&this.contents.delete(e)}deleteIn(e){return H(e)?null!=this.contents&&(this.contents=null,!0):!!ta(this.contents)&&this.contents.deleteIn(e)}get(e,t){return k(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return H(e)?!t&&v(this.contents)?this.contents.value:this.contents:k(this.contents)?this.contents.getIn(e,t):void 0}has(e){return!!k(this.contents)&&this.contents.has(e)}hasIn(e){return H(e)?void 0!==this.contents:!!k(this.contents)&&this.contents.hasIn(e)}set(e,t){null==this.contents?this.contents=V(this.schema,[e],t):ta(this.contents)&&this.contents.set(e,t)}setIn(e,t){H(e)?this.contents=t:null==this.contents?this.contents=V(this.schema,Array.from(e),t):ta(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 P({version:"1.1"}),n={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new P({version:e}),n={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{let t=JSON.stringify(e);throw 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)this.schema=new ti(Object.assign(n,t));else throw Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:t,mapAsMap:n,maxAliasCount:r,onAnchor:s,reviver:i}={}){let o={anchors:new Map,doc:this,keep:!e,mapAsMap:!0===n,mapKeyWarned:!1,maxAliasCount:"number"==typeof r?r:100},a=F(this.contents,t??"",o);if("function"==typeof s)for(let{count:e,res:t}
17of o.anchors.values())s(t,e);return"function"==typeof i?_(i,{"":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 Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||0>=Number(e.indent))){let t=JSON.stringify(e.indent);throw Error(`"indent" option must be a positive integer, not ${t}`)}return function(e,t){let n=[],r=!0===t.directives;if(!1!==t.directives&&e.directives){let t=e.directives.toString(e);t?(n.push(t),r=!0):e.directives.docStart&&(r=!0)}r&&n.push("---");let s=eu(e,t),{commentString:i}=s.options;if(e.commentBefore){1!==n.length&&n.unshift("");let t=i(e.commentBefore);n.unshift(Q(t,""))}let o=!1,a=null;if(e.contents){if(w(e.contents)){if(e.contents.spaceBefore&&r&&n.push(""),e.contents.commentBefore){let t=i(e.contents.commentBefore);n.push(Q(t,""))}s.forceBlockIndent=!!e.comment,a=e.contents.comment}let t=a?void 0:()=>o=!0,l=ed(e.contents,s,()=>a=null,t);a&&(l+=X(l,"",i(a))),("|"===l[0]||">"===l[0])&&"---"===n[n.length-1]?n[n.length-1]=`--- ${l}`:n.push(l)}else n.push(ed(e.contents,s));if(e.directives?.docEnd)if(e.comment){let t=i(e.comment);t.includes("\n")?(n.push("..."),n.push(Q(t,""))):n.push(`... ${t}`)}else n.push("...");else{let t=e.comment;t&&o&&(t=t.replace(/^\n+/,"")),t&&((!o||a)&&""!==n[n.length-1]&&n.push(""),n.push(Q(i(t),"")))}return n.join("\n")+"\n"}(this,e)}}function ta(e){if(k(e))return!0;throw Error("Expected a YAML collection as document contents")}class tl extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}}class tc extends tl{constructor(e,t,n){super("YAMLParseError",e,t,n)}}class tu extends tl{constructor(e,t,n){super("YAMLWarning",e,t,n)}}let td=(e,t)=>n=>{if(-1===n.pos[0])return;n.linePos=n.pos.map(e=>t.linePos(e));let{line:r,col:s}=n.linePos[0];n.message+=` at line ${r}, column ${s}`;let i=s-1,o=e.substring(t.lineStarts[r-1],t.lineStarts[r]).replace(/[\n\r]+$/,"");if(i>=60&&o.length>80){let e=Math.min(i-39,o.length-79);o="â¦"+o.substring(e),i-=e-1}if(o.length>80&&(o=o.substring(0,79)+"â¦"),r>1&&/^ *$/.test(o.substring(0,i))){let n=e.substring(t.lineStarts[r-2],t.lineStarts[r-1]);n.length>80&&(n=n.substring(0,79)+"â¦\n"),o=n+o}if(/[^ ]/.test(o)){let e=1,t=n.linePos[1];t?.line===r&&t.col>s&&(e=Math.max(1,Math.min(t.col-s,80-i)));let a=" ".repeat(i)+"^".repeat(e);n.message+=`: 18 19${o} 20${a} 21`}};function tf(e,{flow:t,indicator:n,next:r,offset:s,onError:i,parentIndent:o,startOnNewline:a}){let l=!1,c=a,u=a,d="",f="",p=!1,h=!1,m=null,g=null,y=null,b=null,v=null,x=null,k=null;for(let s of e)switch(h&&("space"!==s.type&&"newline"!==s.type&&"comma"!==s.type&&i(s.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h=!1),m&&(c&&"comment"!==s.type&&"newline"!==s.type&&i(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),m=null),s.type){case"space":!t&&("doc-start"!==n||r?.type!=="flow-collection")&&s.source.includes(" ")&&(m=s),u=!0;break;case"comment":{u||i(s,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let e=s.source.substring(1)||" ";d?d+=f+e:d=e,f="",c=!1;break}case"newline":c?d?d+=s.source:x&&"seq-item-ind"===n||(l=!0):f+=s.source,c=!0,p=!0,(g||y)&&(b=s),u=!0;break;case"anchor":g&&i(s,"MULTIPLE_ANCHORS","A node can have at most one anchor"),s.source.endsWith(":")&&i(s.offset+s.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=s,k??(k=s.offset),c=!1,u=!1,h=!0;break;case"tag":y&&i(s,"MULTIPLE_TAGS","A node can have at most one tag"),y=s,k??(k=s.offset),c=!1,u=!1,h=!0;break;case n:(g||y)&&i(s,"BAD_PROP_ORDER",`Anchors and tags must be after the ${s.source} indicator`),x&&i(s,"UNEXPECTED_TOKEN",`Unexpected ${s.source} in ${t??"collection"}`),x=s,c="seq-item-ind"===n||"explicit-key-ind"===n,u=!1;break;case"comma":if(t){v&&i(s,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),v=s,c=!1,u=!1;break}default:i(s,"UNEXPECTED_TOKEN",`Unexpected ${s.type} token`),c=!1,u=!1}let w=e[e.length-1],j=w?w.offset+w.source.length:s;return h&&r&&"space"!==r.type&&"newline"!==r.type&&"comma"!==r.type&&("scalar"!==r.type||""!==r.source)&&i(r.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m&&(c&&m.
21indent<=o||r?.type==="block-map"||r?.type==="block-seq")&&i(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:v,found:x,spaceBefore:l,comment:d,hasNewline:p,anchor:g,tag:y,newlineAfterProp:b,end:j,start:k??j}}function tp(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(let t of e.end)if("newline"===t.type)return!0}return!1;case"flow-collection":for(let t of e.items){for(let e of t.start)if("newline"===e.type)return!0;if(t.sep){for(let e of t.sep)if("newline"===e.type)return!0}if(tp(t.key)||tp(t.value))return!0}return!1;default:return!0}}function th(e,t,n){if(t?.type==="flow-collection"){let r=t.end[0];r.indent===e&&("]"===r.source||"}"===r.source)&&tp(t)&&n(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function tm(e,t,n){let{uniqueKeys:r}=e.options;if(!1===r)return!1;let s="function"==typeof r?r:(e,t)=>e===t||v(e)&&v(t)&&e.value===t.value;return t.some(e=>s(e.key,n))}let tg="All mapping items must start at the same column";function ty(e,t,n,r){let s="";if(e){let i=!1,o="";for(let a of e){let{source:e,type:l}=a;switch(l){case"space":i=!0;break;case"comment":{n&&!i&&r(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let t=e.substring(1)||" ";s?s+=o+t:s=t,o="";break}case"newline":s&&(o+=e),i=!0;break;default:r(a,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}t+=e.length}}return{comment:s,offset:t}}let tb="Block collections are not allowed within flow collections",tv=e=>e&&("block-map"===e.type||"block-seq"===e.type);function tx(e,t,n,r,s,i){let o="block-map"===n.type?function({composeNode:e,composeEmptyNode:t},n,r,s,i){let o=new(i?.nodeClass??ew)(n.schema);n.atRoot&&(n.atRoot=!1);let a=r.offset,l=null;for(let i of r.items){let{start:c,key:u,sep:d,value:f}=i,p=tf(c,{indicator:"explicit-key-ind",next:u??d?.[0],offset:a,onError:s,parentIndent:r.indent,startOnNewline:!0}),h=!p.found;if(h){if(u&&("block-seq"===u.type?s(a,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in u&&u.indent!==r.indent&&s(a,"BAD_INDENT",tg)),!p.anchor&&!p.tag&&!d){l=p.end,p.comment&&(o.comment?o.comment+="\n"+p.comment:o.comment=p.comment);continue}(p.newlineAfterProp||tp(u))&&s(u??c[c.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else p.found?.indent!==r.indent&&s(a,"BAD_INDENT",tg);n.atKey=!0;let m=p.end,g=u?e(n,u,p,s):t(n,m,c,null,p,s);n.schema.compat&&th(r.indent,u,s),n.atKey=!1,tm(n,o.items,g)&&s(m,"DUPLICATE_KEY","Map keys must be unique");let y=tf(d??[],{indicator:"map-value-ind",next:f,offset:g.range[2],onError:s,parentIndent:r.indent,startOnNewline:!u||"block-scalar"===u.type});if(a=y.end,y.found){h&&(f?.type!=="block-map"||y.hasNewline||s(a,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&p.start<y.found.offset-1024&&s(g.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let l=f?e(n,f,y,s):t(n,a,d,null,y,s);n.schema.compat&&th(r.indent,f,s),a=l.range[2];let c=new eb(g,l);n.options.keepSourceTokens&&(c.srcToken=i),o.items.push(c)}else{h&&s(g.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),y.comment&&(g.comment?g.comment+="\n"+y.comment:g.comment=y.comment);let e=new eb(g);n.options.keepSourceTokens&&(e.srcToken=i),o.items.push(e)}}return l&&l<a&&s(l,"IMPOSSIBLE","Map comment with trailing content"),o.range=[r.offset,a,l??a],o}(e,t,n,r,i):"block-seq"===n.type?function({composeNode:e,composeEmptyNode:t},n,r,s,i){let o=new(i?.nodeClass??eS)(n.schema);n.atRoot&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let a=r.offset,l=null;for(let{start:i,value:c}of r.items){let u=tf(i,{indicator:"seq-item-ind",next:c,offset:a,onError:s,parentIndent:r.indent,startOnNewline:!0});if(!u.found)if(u.anchor||u.tag||c)c?.type==="block-seq"?s(u.end,"BAD_INDENT","All sequence items must start at the same column"):s(a,"MISSING_CHAR","Sequence item without - indicator");else{l=u.end,u.comment&&(o.comment=u.comment);continue}let d=c?e(n,c,u,s):t(n,u.end,i,null,u,s);n.schema.compat&&th(r.indent,c,s),a=d.range[2],o.items.push(d)}return o.range=[r.offset,a,l??a],o}(e,t,n,r,i):function({composeNode:e,composeEmptyNode:t},n,r,s,i){let o="{"===r.start.source,a=o?"flow map":"flow sequence",l=new(i?.nodeClass??
21(o?ew:eS))(n.schema);l.flow=!0;let c=n.atRoot;c&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let u=r.offset+r.start.source.length;for(let i=0;i<r.items.length;++i){let c=r.items[i],{start:d,key:f,sep:p,value:h}=c,m=tf(d,{flow:a,indicator:"explicit-key-ind",next:f??p?.[0],offset:u,onError:s,parentIndent:r.indent,startOnNewline:!1});if(!m.found){if(!m.anchor&&!m.tag&&!p&&!h){0===i&&m.comma?s(m.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):i<r.items.length-1&&s(m.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),m.comment&&(l.comment?l.comment+="\n"+m.comment:l.comment=m.comment),u=m.end;continue}!o&&n.options.strict&&tp(f)&&s(f,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(0===i)m.comma&&s(m.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(m.comma||s(m.start,"MISSING_CHAR",`Missing , between ${a} items`),m.comment){let e="";e:for(let t of d)switch(t.type){case"comma":case"space":break;case"comment":e=t.source.substring(1);break e;default:break e}if(e){let t=l.items[l.items.length-1];b(t)&&(t=t.value??t.key),t.comment?t.comment+="\n"+e:t.comment=e,m.comment=m.comment.substring(e.length+1)}}if(o||p||m.found){n.atKey=!0;let i=m.end,g=f?e(n,f,m,s):t(n,i,d,null,m,s);tv(f)&&s(g.range,"BLOCK_IN_FLOW",tb),n.atKey=!1;let y=tf(p??[],{flow:a,indicator:"map-value-ind",next:h,offset:g.range[2],onError:s,parentIndent:r.indent,startOnNewline:!1});if(y.found){if(!o&&!m.found&&n.options.strict){if(p)for(let e of p){if(e===y.found)break;if("newline"===e.type){s(e,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}m.start<y.found.offset-1024&&s(y.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else h&&("source"in h&&h.source?.[0]===":"?s(h,"MISSING_CHAR",`Missing space after : in ${a}`):s(y.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let b=h?e(n,h,y,s):y.found?t(n,y.end,p,null,y,s):null;b?tv(h)&&s(b.range,"BLOCK_IN_FLOW",tb):y.comment&&(g.comment?g.comment+="\n"+y.comment:g.comment=y.comment);let v=new eb(g,b);if(n.options.keepSourceTokens&&(v.srcToken=c),o)tm(n,l.items,g)&&s(i,"DUPLICATE_KEY","Map keys must be unique"),l.items.push(v);else{let e=new ew(n.schema);e.flow=!0,e.items.push(v);let t=(b??g).range;e.range=[g.range[0],t[1],t[2]],l.items.push(e)}u=b?b.range[2]:y.end}else{let r=h?e(n,h,m,s):t(n,m.end,p,null,m,s);l.items.push(r),u=r.range[2],tv(h)&&s(r.range,"BLOCK_IN_FLOW",tb)}}let d=o?"}":"]",[f,...p]=r.end,h=u;if(f?.source===d)h=f.offset+f.source.length;else{let e=a[0].toUpperCase()+a.substring(1),t=c?`${e} must end with a ${d}`:`${e} in block collection must be sufficiently indented and end with a ${d}`;s(u,c?"MISSING_CHAR":"BAD_INDENT",t),f&&1!==f.source.length&&p.unshift(f)}if(p.length>0){let e=ty(p,h,n.options.strict,s);e.comment&&(l.comment?l.comment+="\n"+e.comment:l.comment=e.comment),l.range=[r.offset,h,e.offset]}else l.range=[r.offset,h,h];return l}(e,t,n,r,i),a=o.constructor;return"!"===s||s===a.tagName?o.tag=a.tagName:s&&(o.tag=s),o}function tk(e,t,n){let r=t.offset,s=function({offset:e,props:t},n,r){if("block-scalar-header"!==t[0].type)return r(t[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:s}=t[0],i=s[0],o=0,a="",l=-1;for(let t=1;t<s.length;++t){let n=s[t];if(a||"-"!==n&&"+"!==n){let r=Number(n);!o&&r?o=r:-1===l&&(l=e+t)}else a=n}-1!==l&&r(l,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${s}`);let c=!1,u="",d=s.length;for(let e=1;e<t.length;++e){let s=t[e];switch(s.type){case"space":c=!0;case"newline":d+=s.source.length;break;case"comment":n&&!c&&r(s,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),d+=s.source.length,u=s.source.substring(1);break;case"error":r(s,"UNEXPECTED_TOKEN",s.message),d+=s.source.length;break;default:{let e=`Unexpected token in block scalar header: ${s.type}`;r(s,"UNEXPECTED_TOKEN",e);let t=s.source;t&&"string"==typeof t&&(d+=t.length)}}}return{mode:i,indent:o,chomp:a,comment:u,length:d}}(t,e.options.strict,n);if(!s)return{value:"",type:null,comment:"",range:[r,r,r]};let i=">"===s.mode?W.BLOCK_FOLDED:W.BLOCK_LITERAL,o=t.source?function(e){let t=e.split(/\n( *)/),n=t[0],r=n.match(/^( *)/),s=[r?.[1]?[r[1],n.slice(r[1].length)]:["",n]];for(let e=1;e<t.length;e+=2)s.push([t[e],t[e+1]]);return s}(t.source):[],a=o.length;for(let e=o.length-1;e>=0;--e){let t=o[e][1];if(""===t||"\r"===t)a=e;else break}if(0===a){let e="+"===s.chomp&&o.length>0?"\n".repeat(Math.max(1,o.length-1)):"",n=r+s.length;return t.source&&(n+=t.source.length),{value:e,type:i,comment:s.comment,range:[r,n,n]}}let l=t.indent+s.indent,c=t.offset+s.length,u=0;for(let t=0;t<a;++t){let[r,i]=o[t];if(""===i||"\r"===i)0===s.indent&&r.length>l&&(l=r.length);else{r.length<l&&n(c+r.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),0===s.indent&&(l=r.length),u=t,0!==l||e.atRoot||n(c,"BAD_INDENT","Block scalar values in collections must be indented");break}c+=r.length+i.length+1}for(let e=o.length-1;e>=a;--e)o[e][0].length>l&&(a=e+1);let d="",f="",p=!1;for(let e=0;e<u;++e)d+=o[e][0].slice(l)+"\n";for(let e=u;e<a;++e){let[t,r]=o[e];c+=t.length+r.length+1;let a="\r"===r[r.length-1];if(a&&(r=r.slice(0,-1)),r&&t.length<l){let e=s.indent?"explicit indentation indicator":"first line",i=`Block scalar lines must not be less indented than their ${e}`;n(c-r.length-(a?2:1),"BAD_INDENT",i),t=""}i===W.BLOCK_LITERAL?(d+=f+t.slice(l)+r,f="\n"):t.length>l||" "===r[0]?(" "===f?f="\n":p||"\n"!==f||(f="\n\n"),d+=f+t.slice(l)+r,f="\n",p=!0):""===r?"\n"===f?d+="\n":f="\n":(d+=f+r,f=" ",p=!1)}switch(s.chomp){case"-":break;case"+":for(let e=a;
21e<o.length;++e)d+="\n"+o[e][0].slice(l);"\n"!==d[d.length-1]&&(d+="\n");break;default:d+="\n"}let h=r+s.length+t.source.length;return{value:d,type:i,comment:s.comment,range:[r,h,h]}}function tw(e,t,n){let r,s,{offset:i,type:o,source:a,end:l}=e,c=(e,t,r)=>n(i+e,t,r);switch(o){case"scalar":r=W.PLAIN,s=function(e,t){let n="";switch(e[0]){case" ":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}`),tj(e)}(a,c);break;case"single-quoted-scalar":var u,d;r=W.QUOTE_SINGLE,u=a,d=c,("'"!==u[u.length-1]||1===u.length)&&d(u.length,"MISSING_CHAR","Missing closing 'quote"),s=tj(u.slice(1,-1)).replace(/''/g,"'");break;case"double-quoted-scalar":r=W.QUOTE_DOUBLE,s=function(e,t){let n="";for(let r=1;r<e.length-1;++r){let s=e[r];if("\r"!==s||"\n"!==e[r+1])if("\n"===s){let{fold:t,offset:s}=function(e,t){let n="",r=e[t+1];for(;(" "===r||" "===r||"\n"===r||"\r"===r)&&("\r"!==r||"\n"===e[t+2]);)"\n"===r&&(n+="\n"),t+=1,r=e[t+1];return n||(n=" "),{fold:n,offset:t}}(e,r);n+=t,r=s}else if("\\"===s){let s=e[++r],i=tS[s];if(i)n+=i;else if("\n"===s)for(s=e[r+1];" "===s||" "===s;)s=e[++r+1];else if("\r"===s&&"\n"===e[r+1])for(s=e[++r+1];" "===s||" "===s;)s=e[++r+1];else if("x"===s||"u"===s||"U"===s){let i={x:2,u:4,U:8}[s];n+=function(e,t,n,r){let s=e.substr(t,n),i=s.length===n&&/^[0-9a-fA-F]+$/.test(s)?parseInt(s,16):NaN;if(isNaN(i)){let s=e.substr(t-2,n+2);return r(t-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${s}`),s}return String.fromCodePoint(i)}(e,r+1,i,t),r+=i}else{let s=e.substr(r-1,2);t(r-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${s}`),n+=s}}else if(" "===s||" "===s){let t=r,i=e[r+1];for(;" "===i||" "===i;)i=e[++r+1];"\n"!==i&&("\r"!==i||"\n"!==e[r+2])&&(n+=r>t?e.slice(t,r+1):s)}else n+=s}return('"'!==e[e.length-1]||1===e.length)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),n}(a,c);break;default:return n(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${o}`),{value:"",type:null,comment:"",range:[i,i+a.length,i+a.length]}}let f=i+a.length,p=ty(l,f,t,n);return{value:s,type:r,comment:p.comment,range:[i,f,p.offset]}}function tj(e){let t,n;try{t=RegExp("(.*?)(?<![ ])[ ]*\r?\n","sy"),n=RegExp("[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?\n","sy")}catch{t=/(.*?)[ \t]*\r?\n/sy,n=/[ \t]*(.*?)[ \t]*\r?\n/sy}let r=t.exec(e);if(!r)return e;let s=r[1],i=" ",o=t.lastIndex;for(n.lastIndex=o;r=n.exec(e);)""===r[1]?"\n"===i?s+=i:i="\n":(s+=i+r[1],i=" "),o=n.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=o,r=a.exec(e),s+i+(r?.[1]??"")}let tS={0:"\0",a:"\x07",b:"\b",e:"\x1b",f:"\f",n:"\n",r:"\r",t:" ",v:"\v",N:"Â
",_:"Â ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function tN(e,t,n,r){let s,i,{value:o,type:a,comment:l,range:c}="block-scalar"===t.type?tk(e,t,r):tw(t,e.options.strict,r),u=n?e.directives.tagName(n.source,e=>r(n,"TAG_RESOLVE_FAILED",e)):null;s=e.options.stringKeys&&e.atKey?e.schema[f]:u?function(e,t,n,r,s){if("!"===n)return e[f];let i=[];for(let t of e.tags)if(!t.collection&&t.tag===n)if(!t.default||!t.test)return t;else i.push(t);for(let e of i)if(e.test?.test(t))return e;let o=e.knownTags[n];return o&&!o.collection?(e.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(s(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,"tag:yaml.org,2002:str"!==n),e[f])}(e.schema,o,u,n,r):"scalar"===t.type?function({atKey:e,directives:t,schema:n},r,s,i){let o=n.tags.find(t=>(!0===t.default||e&&"key"===t.default)&&t.test?.test(r))||n[f];if(n.compat){let e=n.compat.find(e=>e.default&&e.test?.test(r))??n[f];if(o.tag!==e.tag){let n=t.tagString(o.tag),r=t.tagString(e.tag);i(s,"TAG_RESOLVE_FAILED",`Value may be parsed as either ${n} or ${r}`,!0)}}return o}(e,o,t,r):e.schema[f];try{let a=s.resolve(o,e=>r(n??t,"TAG_RESOLVE_FAILED",e),e.options);i=v(a)?a:new W(a)}catch(e){r(n??t,"TAG_RESOLVE_FAILED",e instanceof Error?e.message:String(e)),i=new W(o)}return i.range=c,i.source=o,a&&(i.type=a),u&&(i.tag=u),s.format&&(i.format=s.format),l&&(i.comment=l),i}let tE={composeNode:tC,composeEmptyNode:tI};function tC(e,t,n,r){let s,i=e.atKey,{spaceBefore:o,comment:a,anchor:l,tag:c}=n,u=!0;switch(t.type){case"alias":s=function({options:e},{offset:t,source:n,end:r},s){let i=new q(n.substring(1));""===i.source&&s(t,"BAD_ALIAS","Alias cannot be an empty string"),i.source.endsWith(":")&&s(t+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let o=t+n.length,a=ty(r,o,e.strict,s);return i.range=[t,o,a.offset],a.comment&&(i.comment=a.comment),i}
21(e,t,r),(l||c)&&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":s=tN(e,t,c,r),l&&(s.anchor=l.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":s=function(e,t,n,r,s){let i=r.tag,o=i?t.directives.tagName(i.source,e=>s(i,"TAG_RESOLVE_FAILED",e)):null;if("block-seq"===n.type){let{anchor:e,newlineAfterProp:t}=r,n=e&&i?e.offset>i.offset?e:i:e??i;n&&(!t||t.offset<n.offset)&&s(n,"MISSING_CHAR","Missing newline after block sequence props")}let a="block-map"===n.type?"map":"block-seq"===n.type?"seq":"{"===n.start.source?"map":"seq";if(!i||!o||"!"===o||o===ew.tagName&&"map"===a||o===eS.tagName&&"seq"===a)return tx(e,t,n,s,o);let l=t.schema.tags.find(e=>e.tag===o&&e.collection===a);if(!l){let r=t.schema.knownTags[o];if(r?.collection!==a)return r?s(i,"BAD_COLLECTION_TYPE",`${r.tag} used for ${a} collection, but expects ${r.collection??"scalar"}`,!0):s(i,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),tx(e,t,n,s,o);t.schema.tags.push(Object.assign({},r,{default:!1})),l=r}let c=tx(e,t,n,s,o,l),u=l.resolve?.(c,e=>s(i,"TAG_RESOLVE_FAILED",e),t.options)??c,d=w(u)?u:new W(u);return d.range=c.range,d.tag=o,l?.format&&(d.format=l.format),d}(tE,e,t,n,r),l&&(s.anchor=l.source.substring(1));break;default:{let i="error"===t.type?t.message:`Unsupported token (type: ${t.type})`;r(t,"UNEXPECTED_TOKEN",i),s=tI(e,t.offset,void 0,null,n,r),u=!1}}return l&&""===s.anchor&&r(l,"BAD_ALIAS","Anchor cannot be an empty string"),i&&e.options.stringKeys&&(!v(s)||"string"!=typeof s.value||s.tag&&"tag:yaml.org,2002:str"!==s.tag)&&r(c??t,"NON_STRING_KEY","With stringKeys, all keys must be strings"),o&&(s.spaceBefore=!0),a&&("scalar"===t.type&&""===t.source?s.comment=a:s.commentBefore=a),e.options.keepSourceTokens&&u&&(s.srcToken=t),s}function tI(e,t,n,r,{spaceBefore:s,comment:i,anchor:o,tag:a,end:l},c){let u=tN(e,{type:"scalar",offset:function(e,t,n){if(t){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];n?.type==="space";)e+=n.source.length,n=t[++r];break}}return e}(t,n,r),indent:-1,source:""},a,c);return o&&(u.anchor=o.source.substring(1),""===u.anchor&&c(o,"BAD_ALIAS","Anchor cannot be an empty string")),s&&(u.spaceBefore=!0),i&&(u.comment=i,u.range[2]=l),u}function tL(e){if("number"==typeof e)return[e,e+1];if(Array.isArray(e))return 2===e.length?e:[e[0],e[1]];let{offset:t,source:n}=e;return[t,t+("string"==typeof n?n.length:1)]}function tO(e){let t="",n=!1,r=!1;for(let s=0;s<e.length;++s){let i=e[s];switch(i[0]){case"#":t+=(""===t?"":r?"\n\n":"\n")+(i.substring(1)||" "),n=!0,r=!1;break;case"%":e[s+1]?.[0]!=="#"&&(s+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:t,afterEmptyLine:r}}class tT{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(e,t,n,r)=>{let s=tL(e);r?this.warnings.push(new tu(s,t,n)):this.errors.push(new tc(s,t,n))},this.directives=new P({version:e.version||"1.2"}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:r}=tO(this.prelude);if(n){let s=e.contents;if(t)e.comment=e.comment?`${e.comment} 22${n}`:n;else if(r||e.directives.docStart||!s)e.commentBefore=n;else if(k(s)&&!s.flow&&s.items.length>0){let e=s.items[0];b(e)&&(e=e.key);let t=e.commentBefore;e.commentBefore=t?`${n} 23${t}`:n}else{let e=s.commentBefore;s.commentBefore=e?`${n} 24${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:tO(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,n=-1){for(let 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)=>{let s=tL(e);s[0]+=t,this.onError(s,"BAD_DIRECTIVE",n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let t=function(e,t,{offset:n,start:r,value:s,end:i},o){let a=new to(void 0,Object.assign({_directives:t},e)),l={atKey:!1,atRoot:!0,directives:a.directives,options:a.options,schema:a.schema},c=tf(r,{indicator:"doc-start",next:s??i?.[0],offset:n,onError:o,parentIndent:0,startOnNewline:!0});c.found&&(a.directives.docStart=!0,s&&("block-map"===s.type||"block-seq"===s.type)&&!c.hasNewline&&o(c.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),a.contents=s?tC(l,s,c,o):tI(l,c.end,r,null,c,o);let u=a.contents.range[2],d=ty(i,u,!1,o);return d.comment&&(a.comment=d.comment),a.range=[n,u,d.offset],a}(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":{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new tc(tL(e),"UNEXPECTED_TOKEN",t);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case"doc-end":{if(!this.doc){this.errors.push(new tc(tL(e),"UNEXPECTED_TOKEN","Unexpected doc-end without preceding document"));break}this.doc.directives.docEnd=!0;let t=ty(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let e=this.doc.comment;this.doc.comment=e?`${e} 25${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new tc(tL(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){let e=new to(void 0,Object.assign({_directives:this.directives},this.options));this.atDirectives&&this.onError(t,"MISSING_CHAR","Missing directives-end indicator line"),e.range=[0,t,t],this.decorate(e,!1),yield e}}}function tA(e,t){if(t)for(let n of t)switch(n.type){case"space":case"comment":e.push(n);break;case"newline":return e.push(n),!0}return!1}function t$(e,t,n){switch(e.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":e.type=n,e.source=t;break;case"block-scalar":{let r=e.props.slice(1),s=t.length;for(let t of("block-scalar-header"===e.props[0].type&&(s-=e.props[0].source.length),r))t.offset+=s;delete e.props,Object.assign(e,{type:n,source:t,end:r});break}case"block-map":case"block-seq":{let r={type:"newline",offset:e.offset+t.length,indent:e.indent,source:"\n"};delete e.items,Object.assign(e,{type:n,source:t,end:[r]});break}default:{let r="indent"in e?e.indent:-1,s="end"in e&&Array.isArray(e.end)?e.end.filter(e=>
25"space"===e.type||"comment"===e.type||"newline"===e.type):[];for(let t of Object.keys(e))"type"!==t&&"offset"!==t&&delete e[t];Object.assign(e,{type:n,indent:r,source:t,end:s})}}}let tM=Symbol("break visit"),tD=Symbol("skip children"),tP=Symbol("remove item");function tB(e,t){"type"in e&&"document"===e.type&&(e={start:e.start,value:e.value}),function e(t,n,r){let s=r(n,t);if("symbol"==typeof s)return s;for(let i of["key","value"]){let o=n[i];if(o&&"items"in o){for(let n=0;n<o.items.length;++n){let s=e(Object.freeze(t.concat([[i,n]])),o.items[n],r);if("number"==typeof s)n=s-1;else{if(s===tM)return tM;s===tP&&(o.items.splice(n,1),n-=1)}}"function"==typeof s&&"key"===i&&(s=s(n,t))}}return"function"==typeof s?s(n,t):s}(Object.freeze([]),e,t)}tB.BREAK=tM,tB.SKIP=tD,tB.REMOVE=tP,tB.itemAtPath=(e,t)=>{let n=e;for(let[e,r]of t){let t=n?.[e];if(!t||!("items"in t))return;n=t.items[r]}return n},tB.parentCollection=(e,t)=>{let n=tB.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],s=n?.[r];if(s&&"items"in s)return s;throw Error("Parent collection not found")};let tR=e=>!!e&&"items"in e,tz=e=>!!e&&("scalar"===e.type||"single-quoted-scalar"===e.type||"double-quoted-scalar"===e.type||"block-scalar"===e.type);function t_(e){switch(e){case"\uFEFF":return"<BOM>";case"\x02":return"<DOC>";case"\x18":return"<FLOW_END>";case"\x1f":return"<SCALAR>";default:return JSON.stringify(e)}}function tF(e){switch(e){case"\uFEFF":return"byte-order-mark";case"\x02":return"doc-mode";case"\x18":return"flow-error-end";case"\x1f":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" ":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}function tK(e){switch(e.type){case"block-scalar":{let t="";for(let n of e.props)t+=tK(n);return t+e.source}case"block-map":case"block-seq":{let t="";for(let n of e.items)t+=tq(n);return t}case"flow-collection":{let t=e.start.source;for(let n of e.items)t+=tq(n);for(let n of e.end)t+=n.source;return t}case"document":{let t=tq(e);if(e.end)for(let n of e.end)t+=n.source;return t}default:{let t=e.source;if("end"in e&&e.end)for(let n of e.end)t+=n.source;return t}}}function tq({start:e,key:t,sep:n,value:r}){let s="";for(let t of e)s+=t.source;if(t&&(s+=tK(t)),n)for(let e of n)s+=e.source;return r&&(s+=tK(r)),s}e.s(["BOM",0,"\uFEFF","DOCUMENT",0,"\x02","FLOW_END",0,"\x18","SCALAR",0,"\x1f","isCollection",0,tR,"isScalar",0,tz,"prettyToken",0,t_,"tokenType",0,tF],111373),e.i(111373),e.s(["BOM",0,"\uFEFF","DOCUMENT",0,"\x02","FLOW_END",0,"\x18","SCALAR",0,"\x1f","createScalarToken",0,function(e,t){let{implicitKey:n=!1,indent:r,inFlow:s=!1,offset:i=-1,type:o="PLAIN"}=t,a=ec({type:o,value:e},{implicitKey:n,indent:r>0?" ".repeat(r):"",inFlow:s,options:{blockQuote:!0,lineWidth:-1}}),l=t.end??[{type:"newline",offset:-1,indent:r,source:"\n"}];switch(a[0]){case"|":case">":{let e=a.indexOf("\n"),t=a.substring(0,e),n=a.substring(e+1)+"\n",s=[{type:"block-scalar-header",offset:i,indent:r,source:t}];return tA(s,l)||s.push({type:"newline",offset:-1,indent:r,source:"\n"}),{type:"block-scalar",offset:i,indent:r,props:s,source:n}}case'"':return{type:"double-quoted-scalar",offset:i,indent:r,source:a,end:l};case"'":return{type:"single-quoted-scalar",offset:i,indent:r,source:a,end:l};default:return{type:"scalar",offset:i,indent:r,source:a,end:l}}},"isCollection",0,tR,"isScalar",0,tz,"prettyToken",0,t_,"resolveAsScalar",0,function(e,t=!0,n){if(e){let r=(e,t,r)=>{let s="number"==typeof e?e:Array.isArray(e)?e[0]:e.offset;if(n)n(s,t,r);else throw new tc([s,s+1],t,r)};switch(e.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return tw(e,t,r);case"block-scalar":return tk({options:{strict:t}},e,r)}}return null},"setScalarValue",0,function(e,t,n={}){let{afterKey:r=!1,implicitKey:s=!1,inFlow:i=!1,type:o}=n,a="indent"in e?e.indent:null;if(r&&"number"==typeof a&&(a+=2),!o)switch(e.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{let t=e.props[0];if("block-scalar-header"!==t.type)throw Error("Invalid block scalar header");o=">"===t.source[0]?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:o="PLAIN"}let l=ec({type:o,value:t},{implicitKey:s||null===a,indent:null!==a&&a>0?" ".repeat(a):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}});switch(l[0]){case"|":case">":!function(e,t){let n=t.indexOf("\n"),r=t.substring(0,n),s=t.substring(n+1)+"\n";if("block-scalar"===e.type){let t=e.props[0];if("block-scalar-header"!==t.type)throw Error("Invalid block scalar header");t.source=r,e.source=s}else{let{offset:t}=e,n="indent"in e?e.indent:-1,i=[{type:"block-scalar-header",offset:t,indent:n,source:r}];for(let t of(tA(i,"end"in e?e.end:void 0)||i.push({type:"newline",offset:-1,indent:n,source:"\n"}
25),Object.keys(e)))"type"!==t&&"offset"!==t&&delete e[t];Object.assign(e,{type:"block-scalar",indent:n,props:i,source:s})}}(e,l);break;case'"':t$(e,l,"double-quoted-scalar");break;case"'":t$(e,l,"single-quoted-scalar");break;default:t$(e,l,"scalar")}},"stringify",0,e=>"type"in e?tK(e):tq(e),"tokenType",0,tF,"visit",0,tB],935170);var tU=e.i(935170);function tW(e){switch(e){case void 0:case" ":case"\n":case"\r":case" ":return!0;default:return!1}}let tG=new Set("0123456789ABCDEFabcdef"),tV=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),tH=new Set(",[]{}"),tJ=new Set(" ,[]{}\n\r "),tY=e=>!e||tJ.has(e);class tQ{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){if(e){if("string"!=typeof e)throw TypeError("source is not a string");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=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){let 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)?-1:e+n}if("-"===t||"."===t){let t=this.buffer.substr(e,3);if(("---"===t||"..."===t)&&tW(this.buffer[e+3]))return -1}return e}getLine(){let e=this.lineEndPos;return(("number"!=typeof e||-1!==e&&e<this.pos)&&(e=this.buffer.indexOf("\n",this.pos),this.lineEndPos=e),-1===e)?this.atEnd?this.buffer.substring(this.pos):null:("\r"===this.buffer[e-1]&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(null===e)return this.setNext("stream");if("\uFEFF"===e[0]&&(yield*this.pushCount(1),e=e.substring(1)),"%"===e[0]){let t=e.length,n=e.indexOf("#");for(;-1!==n;){let r=e[n-1];if(" "===r||" "===r){t=n-1;break}n=e.indexOf("#",n+1)}for(;;){let n=e[t-1];if(" "===n||" "===n)t-=1;else break}let r=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-r),this.pushNewline(),"stream"}if(this.atLineEnd()){let t=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-t),yield*this.pushNewline(),"stream"}return yield"\x02",yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if("-"===e||"."===e){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let e=this.peek(3);if(("---"===e||"..."===e)&&tW(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,"---"===e?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!tW(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext("block-start");if(("-"===e||"?"===e||":"===e)&&tW(t)){let 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);let 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";
25case"*":return yield*this.pushUntil(tY),"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())>0?(t=yield*this.pushSpaces(!1),this.indentValue=n=t):t=0,t+=yield*this.pushSpaces(!0);while(e+t>0)let r=this.getLine();if(null===r)return this.setNext("flow");if((-1!==n&&n<this.indentNext&&"#"!==r[0]||0===n&&(r.startsWith("---")||r.startsWith("..."))&&tW(r[3]))&&(n!==this.indentNext-1||1!==this.flowLevel||"]"!==r[0]&&"}"!==r[0]))return this.flowLevel=0,yield"\x18",yield*this.parseLineStart();let s=0;for(;","===r[s];)s+=yield*this.pushCount(1),s+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(r[s+=yield*this.pushIndicators()]){case void 0:return"flow";case"#":return yield*this.pushCount(r.length-s),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(tY),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let e=this.charAt(1);if(this.flowKey||tW(e)||","===e)return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),t=this.buffer.indexOf(e,this.pos+1);if("'"===e)for(;-1!==t&&"'"===this.buffer[t+1];)t=this.buffer.indexOf("'",t+2);else for(;-1!==t;){let e=0;for(;"\\"===this.buffer[t-1-e];)e+=1;if(e%2==0)break;t=this.buffer.indexOf('"',t+1)}let n=this.buffer.substring(0,t),r=n.indexOf("\n",this.pos);if(-1!==r){for(;-1!==r;){let e=this.continueScalar(r+1);if(-1===e)break;r=n.indexOf("\n",e)}-1!==r&&(t=r-("\r"===n[r-1]?2:1))}if(-1===t){if(!this.atEnd)return this.setNext("quoted-scalar");t=this.buffer.length}return yield*this.pushToIndex(t+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let t=this.buffer[++e];if("+"===t)this.blockScalarKeep=!0;else if(t>"0"&&t<="9")this.blockScalarIndent=Number(t)-1;else if("-"!==t)break}return yield*this.pushUntil(e=>tW(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":{let 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+(0===this.indentNext?1:this.indentNext);do{let 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}}let r=t+1;for(e=this.buffer[r];" "===e;)e=this.buffer[++r];if(" "===e){for(;" "===e||" "===e||"\r"===e||"\n"===e;)e=this.buffer[++r];t=r-1}else if(!this.blockScalarKeep)for(;;){let e=t-1,r=this.buffer[e];"\r"===r&&(r=this.buffer[--e]);let s=e;for(;" "===r;)r=this.buffer[--e];if("\n"===r&&e>=this.pos&&e+1+n>s)t=e;else break}return yield"\x1f",yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e,t=this.flowLevel>0,n=this.pos-1,r=this.pos-1;for(;e=this.buffer[++r];)if(":"===e){let e=this.buffer[r+1];if(tW(e)||t&&tH.has(e))break;n=r}else if(tW(e)){let s=this.buffer[r+1];if("\r"===e&&("\n"===s?(r+=1,e="\n",s=this.buffer[r+1]):n=r),"#"===s||t&&tH.has(s))break;if("\n"===e){let e=this.continueScalar(r+1);if(-1===e)break;r=Math.max(r,e-2)}}else{if(t&&tH.has(e))break;n=r}return e||this.atEnd?(yield"\x1f",yield*this.pushToIndex(n+1,!0),t?"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){let 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(tY))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{let e=this.flowLevel>0,t=this.charAt(1);if(tW(t)||e&&tH.has(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(;!tW(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(tV.has(t))t=this.buffer[++e];else if("%"===t&&tG.has(this.buffer[e+1])&&tG.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let 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)let 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)}}function tX(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function tZ(e){for(let t=0;t<e.length;++t)switch(e[t].type){case"space":case"comment":case"newline":break;default:return t}return -1}function t0(e){switch(e?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function t1(e){switch(e.type){case"document":return e.start;case"block-map":{let t=e.items[e.items.length-1];return t.sep??t.start}case"block-seq":return e.items[e.items.length-1].start;default:return[]}}function t2(e){if(0===e.length)return[];let t=e.length;e:for(;--t>=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(;e[++t]?.type==="space";);return e.splice(t,e.length)}function t5(e){if("flow-seq-start"===e.start.type)for(let t of e.items)!t.sep||t.value||tX(t.start,"explicit-key-ind")||tX(t.sep,"map-value-ind")||(t.key&&(t.value=t.key),delete t.key,t0(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 t3{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 tQ,this.onNewLine=e}*parse(e,t=!1){for(let n of(this.onNewLine&&0===this.offset&&this.onNewLine(0),this.lexer.lex(e,t)))yield*this.next(n);t||(yield*this.end())}*next(e){if(this.source=e,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let t=tF(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{let 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()}
25get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if("doc-end"===this.type&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}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()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let t=e??this.stack.pop();if(t)if(0===this.stack.length)yield t;else{let 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&&t5(t),e.type){case"document":e.value=t;break;case"block-scalar":e.props.push(t);break;case"block-map":{let n=e.items[e.items.length-1];if(n.value){e.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}if(n.sep)n.value=t;else{Object.assign(n,{key:t,sep:[]}),this.onKeyLine=!n.explicitKey;return}break}case"block-seq":{let n=e.items[e.items.length-1];n.value?e.items.push({start:[],value:t}):n.value=t;break}case"flow-collection":{let n=e.items[e.items.length-1];!n||n.value?e.items.push({start:[],key:t,sep:[]}):n.sep?n.value=t:Object.assign(n,{key:t,sep:[]});return}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)){let n=t.items[t.items.length-1];n&&!n.sep&&!n.value&&n.start.length>0&&-1===tZ(n.start)&&(0===t.indent||n.start.every(e=>"comment"!==e.type||e.indent<t.indent))&&("document"===e.type?e.end=n.start:e.items.push({start:n.start}),t.items.splice(-1,1))}}else yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let e={type:"document",offset:this.offset,start:[]};"doc-start"===this.type&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":-1!==tZ(e.start)?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken);return;case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}let t=this.startBlockValue(e);t?this.stack.push(t):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if("map-value-ind"===this.type){let t,n=t2(t1(this.peek(2)));e.end?((t=e.end).push(this.sourceToken),delete e.end):t=[this.sourceToken];let r={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:t}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=r}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let e=this.source.indexOf("\n")+1;for(;0!==e;)this.onNewLine(this.offset+e),e=this.source.indexOf("\n",e)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,t.value){let n="end"in t.value?t.value.end:void 0,r=Array.isArray(n)?n[n.length-1]:void 0;r?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2],r=n?.value?.end;if(Array.isArray(r)){Array.prototype.push.apply(r,t.start),r.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,r=n&&(t.sep||t.explicitKey)&&"seq-item-ind"!==this.type,s=[];if(r&&t.sep&&!t.value){let n=[];for(let r=0;r<t.sep.length;++r){let s=t.sep[r];switch(s.type){case"newline":n.push(r);break;case"space":break;case"comment":s.indent>e.indent&&(n.length=0);break;default:n.length=0}}n.length>=2&&(s=t.sep.splice(n[1]))}switch(this.type){case"anchor":case"tag":r||t.value?(s.push(this.sourceToken),e.items.push({start:s}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"explicit-key-ind":t.sep||t.explicitKey?r||t.value?(s.push(this.sourceToken),e.items.push({start:s,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}):(t.start.push(this.sourceToken),t.explicitKey=!0),this.onKeyLine=!0;return;case"map-value-ind":if(t.explicitKey)if(t.sep)if(t.value)e.items.push({start:[],key:null,
25sep:[this.sourceToken]});else if(tX(t.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]});else if(t0(t.key)&&!tX(t.sep,"newline")){let e=t2(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 s.length>0?t.sep=t.sep.concat(s,this.sourceToken):t.sep.push(this.sourceToken);else if(tX(t.start,"newline"))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=t2(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||r?e.items.push({start:s,key:null,sep:[this.sourceToken]}):tX(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]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let n=this.flowScalar(this.type);r||t.value?(e.items.push({start:s,key:n,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(n):(Object.assign(t,{key:n,sep:[]}),this.onKeyLine=!0);return}default:{let r=this.startBlockValue(e);if(r){if("block-seq"===r.type){if(!t.explicitKey&&t.sep&&!tX(t.sep,"newline"))return void(yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source}))}else n&&e.items.push({start:s});this.stack.push(r);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(t.value){let n="end"in t.value?t.value.end:void 0,r=Array.isArray(n)?n[n.length-1]:void 0;r?.type==="comment"?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)){let n=e.items[e.items.length-2],r=n?.value?.end;if(Array.isArray(r)){Array.prototype.push.apply(r,t.start),r.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case"anchor":case"tag":if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;t.value||tX(t.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let t=this.startBlockValue(e);if(t)return void this.stack.push(t)}yield*this.pop(),yield*this.step()}*flowCollection(e){let 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?.type==="flow-collection")}else if(0===e.end.length){switch(this.type){case"comma":case"explicit-key-ind":!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case"map-value-ind":!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]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let n=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:n,sep:[]}):t.sep?this.stack.push(n):Object.assign(t,{key:n,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let 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))if("map-value-ind"===this.type&&"flow-collection"!==t.type){let n=t2(t1(t));t5(e);let r=e.end.splice(1,e.end.length);r.push(this.sourceToken);let s={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]=s}else yield*this.lineEnd(e);else yield*this.pop(),yield*this.step()}}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.t
25ype);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;let t=t2(t1(e));return t.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let t=t2(t1(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())}}}class t8{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,n=this.lineStarts.length;for(;t<n;){let r=t+n>>1;this.lineStarts[r]<e?t=r+1:n=r}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(0===t)return{line:0,col:e};let r=this.lineStarts[t-1];return{line:t,col:e-r+1}}}}function t9(e){let t=!1!==e.prettyErrors;return{lineCounter:e.lineCounter||t&&new t8||null,prettyErrors:t}}function t4(e,t={}){let{lineCounter:n,prettyErrors:r}=t9(t),s=new t3(n?.addNewLine),i=new tT(t),o=null;for(let t of i.compose(s.parse(e),!0,e.length))if(o){if("silent"!==o.options.logLevel){o.errors.push(new tc(t.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}}else o=t;
25return r&&n&&(o.errors.forEach(td(e,n)),o.warnings.forEach(td(e,n))),o}function t6(e,t,n){let r;"function"==typeof t?r=t:void 0===n&&t&&"object"==typeof t&&(n=t);let s=t4(e,n);if(!s)return null;if(s.warnings.forEach(e=>ef(s.options.logLevel,e)),s.errors.length>0)if("silent"!==s.options.logLevel)throw s.errors[0];else s.errors=[];return s.toJS(Object.assign({reviver:r},n))}function t7(e,t,n){let r=null;if("function"==typeof t||Array.isArray(t)?r=t:void 0===n&&t&&(n=t),"string"==typeof n&&(n=n.length),"number"==typeof n){let e=Math.round(n);n=e<1?void 0:e>8?{indent:8}:{indent:e}}if(void 0===e){let{keepUndefined:e}=n??t??{};if(!e)return}return g(e)&&!r?e.toString(n):new to(e,r,n).toString(n)}e.s([],770269),e.i(770269),e.s(["Alias",0,q,"CST",0,tU,"Composer",0,tT,"Document",0,to,"Lexer",0,tQ,"LineCounter",0,t8,"Pair",0,eb,"Parser",0,t3,"Scalar",0,W,"Schema",0,ti,"YAMLError",0,tl,"YAMLMap",0,ew,"YAMLParseError",0,tc,"YAMLSeq",0,eS,"YAMLWarning",0,tu,"isAlias",0,m,"isCollection",0,k,"isDocument",0,g,"isMap",0,y,"isNode",0,w,"isPair",0,b,"isScalar",0,v,"isSeq",0,x,"parse",0,t6,"parseAllDocuments",0,function(e,t={}){let{lineCounter:n,prettyErrors:r}=t9(t),s=new t3(n?.addNewLine),i=new tT(t),o=Array.from(i.compose(s.parse(e)));if(r&&n)for(let t of o)t.errors.forEach(td(e,n)),t.warnings.forEac
25h(td(e,n));return o.length>0?o:Object.assign([],{empty:!0},i.streamInfo())},"parseDocument",0,t4,"stringify",0,t7,"visit",0,C,"visitAsync",0,L],216510),e.i(216510);var ne=e.i(214523);function nt(e,t,n={}){let r;if((r="string"==typeof t?function(e){let t=e.split(/\n/),n=[],r=0;function s(e){let n=/^(---|\+\+\+)\s+/.exec(t[r]);if(n){let s=n[1],i=t[r].substring(3).trim().split(" ",2),o=(i[1]||"").trim(),a=i[0].replace(/\\\\/g,"\\");a.startsWith('"')&&a.endsWith('"')&&(a=a.substr(1,a.length-2)),"---"===s?(e.oldFileName=a,e.oldHeader=o):(e.newFileName=a,e.newHeader=o),r++}}for(;r<t.length;)!function(){let e={};for(n.push(e);r<t.length;){let n=t[r];if(/^(---|\+\+\+|@@)\s/.test(n))break;let s=/^(?:Index:|diff(?: -r \w+)+)\s+/.exec(n);s&&(e.index=n.substring(s[0].length).trim()),r++}for(s(e),s(e),e.hunks=[];r<t.length;){let n=t[r];if(/^(Index:\s|diff\s|---\s|\+\+\+\s|===================================================================)/.test(n))break;if(/^@@/.test(n))e.hunks.push(function(){var e;let n=r,s=t[r++].split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/),i={oldStart:+s[1],oldLines:void 0===s[2]?1:+s[2],newStart:+s[3],newLines:void 0===s[4]?1:+s[4],lines:[]};0===i.oldLines&&(i.oldStart+=1),0===i.newLines&&(i.newStart+=1);let o=0,a=0;for(;r<t.length&&(a<i.oldLines||o<i.newLines||(null==(e=t[r])?void 0:e.startsWith("\\")));r++){let e=0==t[r].length&&r!=t.length-1?" ":t[r][0];if("+"===e||"-"===e||" "===e||"\\"===e)i.lines.push(t[r]),"+"===e?o++:"-"===e?a++:" "===e&&(o++,a++);else throw Error(`Hunk at line ${n+1} contained invalid line ${t[r]}`)}if(o||1!==i.newLines||(i.newLines=0),a||1!==i.oldLines||(i.oldLines=0),o!==i.newLines)throw Error("Added line count did not match for hunk at line "+(n+1));if(a!==i.oldLines)throw Error("Removed line count did not match for hunk at line "+(n+1));return i}());else if(n)throw Error("Unknown line "+(r+1)+" "+JSON.stringify(n));else r++}}();return n}(t):Array.isArray(t)?t:[t]).length>1)throw Error("applyPatch only works with a single input.");return function(e,t,n={}){if(n.autoConvertLineEndings||null==n.autoConvertLineEndings){var r,s;!e.includes("\r\n")||e.startsWith("\n")||e.match(/[^\r]\n/)||(Array.isArray(r=t)||(r=[r]),r.some(e=>e.hunks.some(e=>e.lines.some(e=>!e.startsWith("\\")&&e.endsWith("\r")))))?!e.includes("\r\n")&&e.includes("\n")&&(Array.isArray(s=t)||(s=[s]),s.some(e=>e.hunks.some(e=>e.lines.some(e=>e.endsWith("\r"))))&&s.every(e=>e.hunks.every(e=>e.lines.every((t,n)=>{var r;return t.startsWith("\\")||t.endsWith("\r")||(null==(r=e.lines[n+1])?void 0:r.startsWith("\\"))}))))&&(t=function e(t){return Array.isArray(t)?t.map(t=>e(t)):Object.assign(Object.assign({},t),{hunks:t.hunks.map(e=>Object.assign(Object.assign({},e),{lines:e.lines.map(e=>e.endsWith("\r")?e.substring(0,e.length-1):e)}))})}(t)):t=function e(t){return Array.isArray(t)?t.map(t=>e(t)):Object.assign(Object.assign({},t),{hunks:t.hunks.map(e=>Object.assign(Object.assign({},e),{lines:e.lines.map((t,n)=>{var r;return t.startsWith("\\")||t.endsWith("\r")||(null==(r=e.lines[n+1])?void 0:r.startsWith("\\"))?t:t+"\r"})}))})}(t)}let i=e.split("\n"),o=t.hunks,a=n.compareLine||((e,t,n,r)=>t===r),l=n.fuzzFactor||0,c=0;if(l<0||!Number.isInteger(l))throw Error("fuzzFactor must be a non-negative integer");if(!o.length)return e;let u="",d=!1,f=!1;for(let e=0;e<o[o.length-1].lines.length;e++){let t=o[o.length-1].lines[e];"\\"==t[0]&&("+"==u[0]?d=!0:"-"==u[0]&&(f=!0)),u=t}if(d){if(f){if(!l&&""==i[i.length-1])return!1}else if(""==i[i.length-1])i.pop();else if(!l)return!1}else if(f){if(""!=i[i.length-1])i.push("");else if(!l)return!1}let p=[],h=0;for(let e=0;e<o.length;e++){let t,n,r=o[e],s=i.length-r.oldLines+l;for(let e=0;e<=l;e++){let o=function(e,t,n){let r=!0,s=!1,i=!1,o=1;return function a(){if(r&&!i){if(s?o++:r=!1,e+o<=n)return e+o;i=!0}if(!s)return(i||(r=!0),t<=e-o)?e-o++:(s=!0,a())}}(n=r.oldStart+h-1,c,s);for(;void 0!==n&&!(t=function e(t,n,r,s=0,o=!0,l=[],c=0){let u=0,d=!1;for(;s<t.length;s++){let f=t[s],p=f.length>0?f[0]:" ",h=f.length>0?f.substr(1):f;if("-"===p)if(a(n+1,i[n],p,h))n++,u=0;else{if(!r||null==i[n])return null;return l[c]=i[n],e(t,n+1,r-1,s,!1,l,c+1)}if("+"===p){if(!o)return null;l[c]=h,c++,u=0,d=!0}if(" "===p)if(u++,l[c]=i[n],a(n+1,i[n],p,h))c++,o=!0,d=!1,n++;else{if(d||!r)return null;return i[n]&&(e(t,n+1,r-1,s+1,!1,l,c+1)||e(t,n+1,r-1,s,!1,l,c+1))||e(t,n,r-1,s+1,!1,l,c)}}return c-=u,n-=u,l.length=c,{patchedLines:l,oldLineLastI:n-1}}(r.lines,n,e));n=o());if(t)break}if(!t)return!1;for(let e=c;e<n;e++)p.push(i[e]);for(let e=0;e<t.patchedLines.length;e++){let n=t.patchedLines[e];p.push(n)}c=t.oldLineLastI+1,h=n+1-r.oldStart}for(let e=c;e<i.length;e++)p.push(i[e]);return p.join("\n")}(e,r[0],n)}var nn=e.i(38720),nr="```yaml-spec",ns="```yaml-edit",ni="```yaml-patch",no="```diff";function na(e,t,n){if("/root"===t){e.root=n;return}if("/state"===t){e.state=n;return}if(t.startsWith("/state/")){e.state||(e.state={}),(0,nn.setByPath)(e.state,t.slice(6),n);return}if(t.startsWith("/elements/")){let r=t.slice(10).split("/"),s=r[0];if(!s)return;if(1===r.length){if(null==n||"object"!=typeof n)return;e.elements[s]={...n,type:"string"==typeof n.type?n.type:"",props:null!=n.props&&"object"==typeof n.props?n.props:{},children:Array.isArray(n.children)?n.children:[],slots:null!=n.slots&&"object"==typeof n.slots?n.slots:void 0}}else{let t=e.elements[s];if(t){let i={...t};(0,nn.setByPath)(i,"/"+r.slice(1).join("/"),n),e.elements[s]=i}}}}function nl(e,t){if("/state"===t)return void delete e.state;if(t.startsWith("/state/")&&e.state)return void(0,nn.removeByPath)(e.state,t.slice(6));if(t.startsWith("/elements/")){let n=t.slice(10).split("/"),r=n[0];if(!r)return;if(1===n.length)delete e.elements[r];else{let t=e.elements[r];if(t){let s={...t};(0,nn.removeByPath)(s,"/"+n.slice(1).join("/")),e.elements[r]=s}}}}function nc(e,t){return"/root"===t?e.root:"/state"===t?e.state:t.startsWith("/state/")&&e.state?(0,nn.getByPath)(e.state,t.slice(6)):(0,nn.getByPath)(e,t)}function nu(e,t){let n={...e,elements:{...e.elements},...e.state?{state:{...e.state}}:{}};switch(t.op){case"add":case"replace":na(n,t.path,t.value);break;case"remove":nl(n,t.path);break;case"move":if(t.from){let e=nc(n,t.from);nl(n,t.from),na(n,t.path,e)}break;case"copy":t.from&&na(n,t.path,nc(n,t.from))}for(let e of((null===n.state||void 0!==n.state&&"object"!=typeof n.state)&&(n.state=void 0),Object.keys(n.elements))){let t=n.elements[e];if(!t||"object"!=typeof t){delete n.elements[e];continue}(null==t.props||"object"!=typeof t.props)&&(n.elements[e]={...t,props:{}}),Array.isArray(n.elements[e].children)||(n.elements[e]={...n.elements[e],children:[]})}return n}
25function nd(e){try{let t=e.trim();if(!t||t.startsWith("//"))return null;let n=JSON.parse(t);if("composition"===n.__meta)return{type:"composition",summary:n};if("decision"===n.__meta)return{type:"decision"};if("error"===n.__meta)return{type:"error",message:n.message};if("usage"===n.__meta)return{type:"usage",usage:{promptTokens:n.promptTokens??0,completionTokens:n.completionTokens??0,totalTokens:n.totalTokens??0,cachedTokens:n.cachedTokens??0,cacheWriteTokens:n.cacheWriteTokens??0}};if(!0===n.__json_edit){let e={...n};return delete e.__json_edit,{type:"json-edit",mergeObj:e}}return{type:"patch",patch:n}}catch{return null}}var nf=e.i(597390),nf=nf;function np(e,t="Assertion error"){if(!e)throw Error(t)}function nh({group:e}){let{orientation:t,panels:n}=e;return n.reduce((e,n)=>e+="horizontal"===t?n.element.offsetWidth:n.element.offsetHeight,0)}function nm(e,t){return t.sort("horizontal"===e?ng:ny)}function ng(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return 0!==n?n:e.element.offsetWidth-t.element.offsetWidth}function ny(e,t){let n=e.element.offsetTop-t.element.offsetTop;return 0!==n?n:e.element.offsetHeight-t.element.offsetHeight}function nb(e){return null!==e&&"object"==typeof e&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function nv(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function nx(e){let{element:t,orientation:n,panels:r,separators:s}=e,i=nm(n,Array.from(t.children).filter(nb).map(e=>({element:e}))).map(({element:e})=>e),o=[],a=!1,l,c=[];for(let t of i)if(t.hasAttribute("data-panel")){let s=r.find(e=>e.element===t);if(s){if(l){let r,i=l.element.getBoundingClientRect(),u=t.getBoundingClientRect();if(a){let e="horizontal"===n?new DOMRect(i.right,i.top,0,i.height):new DOMRect(i.left,i.bottom,i.width,0),t="horizontal"===n?new DOMRect(u.left,u.top,0,u.height):new DOMRect(u.left,u.top,u.width,0);switch(c.length){case 0:r=[e,t];break;case 1:{let s=c[0],o=function({orientation:e,rects:t,targetRect:n}){let r={x:n.x+n.width/2,y:n.y+n.height/2},s,i=Number.MAX_VALUE;for(let n of t){let{x:t,y:o}=nv(r,n),a="horizontal"===e?t:o;a<i&&(i=a,s=n)}return np(s,"No rect found"),s}({orientation:n,rects:[i,u],targetRect:s.element.getBoundingClientRect()});r=[s,o===i?t:e];break}default:r=c}}else r=c.length?c:["horizontal"===n?new DOMRect(i.right,u.top,u.left-i.right,u.height):new DOMRect(u.left,i.bottom,u.width,u.top-i.bottom)];for(let t of r)o.push({group:e,groupSize:nh({group:e}),panels:[l,s],separator:"width"in t?void 0:t,rect:"width"in t?t:t.element.getBoundingClientRect()})}a=!1,l=s,c=[]}}else if(t.hasAttribute("data-separator")){let e=s.find(e=>e.element===t);e?c.push(e):(l=void 0,c=[])}else a=!0;return o}function nk({groupSize:e,panelElement:t,styleProp:n}){let r,[s,i]=function(e){switch(typeof e){case"number":return[e,"px"];case"string":{let t=parseFloat(e);return e.endsWith("%")?[t,"%"]:e.endsWith("px")?[t,"px"]:e.endsWith("rem")?[t,"rem"]:e.endsWith("em")?[t,"em"]:e.endsWith("vh")?[t,"vh"]:e.endsWith("vw")?[t,"vw"]:[t,"%"]}}}(n);switch(i){case"%":r=s/100*e;break;case"px":r=s;break;case"rem":r=s*parseFloat(getComputedStyle(t.ownerDocument.body).fontSize);break;case"em":r=s*parseFloat(getComputedStyle(t).fontSize);break;case"vh":r=s/100*window.innerHeight;break;case"vw":r=s/100*window.innerWidth}return r}function nw(e){return parseFloat(e.toFixed(3))}function nj(e){let{panels:t}=e,n=nh({group:e});return 0===n?t.map(e=>({collapsedSize:0,collapsible:!0===e.panelConstraints.collapsible,defaultSize:void 0,minSize:0,maxSize:100,panelId:e.id})):t.map(e=>{let t,{element:r,panelConstraints:s}=e,i=0;void 0!==s.collapsedSize&&(i=nw(nk({groupSize:n,panelElement:r,styleProp:s.collapsedSize})/n*100)),void 0!==s.defaultSize&&(t=nw(nk({groupSize:n,panelElement:r,styleProp:s.defaultSize})/n*100));let o=0;void 0!==s.minSize&&(o=nw(nk({groupSize:n,panelElement:r,styleProp:s.minSize})/n*100));let a=100;return void 0!==s.maxSize&&(a=nw(nk({groupSize:n,panelElement:r,styleProp:s.maxSize}
25)/n*100)),{collapsedSize:i,collapsible:!0===s.collapsible,defaultSize:t,minSize:o,maxSize:a,panelId:e.id}})}function nS(e,t,n=0){return Math.abs(nw(e)-nw(t))<=n}let nN={cursorFlags:0,interactionState:{state:"inactive"},mountedGroups:new Map},nE=new class{#e={};addListener(e,t){let n=this.#e[e];return void 0===n?this.#e[e]=[t]:n.includes(t)||n.push(t),()=>{this.removeListener(e,t)}}emit(e,t){let n=this.#e[e];if(void 0!==n)if(1===n.length)n[0].call(null,t);else{let e=!1,r=null,s=Array.from(n);for(let n=0;n<s.length;n++){let i=s[n];try{i.call(null,t)}catch(t){null===r&&(e=!0,r=t)}}if(e)throw r}}removeAllListeners(){this.#e={}}removeListener(e,t){let n=this.#e[e];if(void 0!==n){let e=n.indexOf(t);e>=0&&n.splice(e,1)}}};function nC(e){let t="function"==typeof e?e(nN):e;if(nN===t)return nN;let n=nN;return nN={...nN,...t},void 0!==t.cursorFlags&&nE.emit("cursorFlagsChange",nN.cursorFlags),void 0!==t.interactionState&&nE.emit("interactionStateChange",nN.interactionState),void 0!==t.mountedGroups&&(nN.mountedGroups.forEach((e,t)=>{e.derivedPanelConstraints.forEach(r=>{if(r.collapsible){let{layout:s}=n.mountedGroups.get(t)??{};if(s){let n=nS(r.collapsedSize,e.layout[r.panelId]),i=nS(r.collapsedSize,s[r.panelId]);n&&!i&&(t.inMemoryLastExpandedPanelSizes[r.panelId]=s[r.panelId])}}})}),nE.emit("mountedGroupsChange",nN.mountedGroups)),nN}function nI(e,t){return nS(e,t)?0:e>t?1:-1}function nL({panelConstraints:e,size:t}){let{collapsedSize:n=0,collapsible:r,maxSize:s=100,minSize:i=0}=e;return 0>nI(t,i)&&(t=r&&0>nI(t,(n+i)/2)?n:i),nw(t=Math.min(s,t))}function nO({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:s,trigger:i}){if(nS(e,0))return t;let o=Object.values(t),a=Object.values(s),l=[...o],[c,u]=r;np(null!=c,"Invalid first pivot index"),np(null!=u,"Invalid second pivot index");let d=0;if("keyboard"===i){{let t=e<0?u:c,r=n[t];np(r,`Panel constraints not found for index ${t}`);let{collapsedSize:s=0,collapsible:i,minSize:a=0}=r;if(i){let n=o[t];if(np(null!=n,`Previous layout not found for panel index ${t}`),nS(n,s)){let t=a-n;nI(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?c:u,r=n[t];np(r,`No panel constraints found for index ${t}`);let{collapsedSize:s=0,collapsible:i,minSize:a=0}=r;if(i){let n=o[t];if(np(null!=n,`Previous layout not found for panel index ${t}`),nS(n,a)){let t=n-s;nI(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}}{let t=e<0?1:-1,r=e<0?u:c,s=0;for(;;){let e=o[r];if(np(null!=e,`Previous layout not found for panel index ${r}`),s+=nL({panelConstraints:n[r],size:100})-e,(r+=t)<0||r>=n.length)break}let i=Math.min(Math.abs(e),Math.abs(s));e=e<0?0-i:i}{let t=e<0?c:u;for(;t>=0&&t<n.length;){let r=Math.abs(e)-Math.abs(d),s=o[t];np(null!=s,`Previous layout not found for panel index ${t}`);let i=s-r,a=nL({panelConstraints:n[t],size:i});if(!nS(s,a)&&(d+=s-a,l[t]=a,d.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?t--:t++}}if(function(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}(a,l))return s;{let t=e<0?u:c,r=o[t];np(null!=r,`Previous layout not found for panel index ${t}`);let s=r+d,i=nL({panelConstraints:n[t],size:s});if(l[t]=i,!nS(i,s)){let t=s-i,r=e<0?u:c;for(;r>=0&&r<n.length;){let s=l[r];np(null!=s,`Previous layout not found for panel index ${r}`);let i=s+t,o=nL({panelConstraints:n[r],size:i});if(nS(s,o)||(t-=o-s,l[r]=o),nS(t,0))break;e>0?r--:r++}}}if(!nS(Object.values(l).reduce((e,t)=>t+e,0),100,.1))return s;let f=Object.keys(s);return l.reduce((e,t,n)=>(e[f[n]]=t,e),{})}function nT(e){let{mountedGroups:t}=nN;for(let[n]of t)if(n.separators.some(t=>t.element===e))return n;throw Error("Could not find parent Group for separator element")}function nA(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(void 0===t[n]||0!==nI(e[n],t[n]))return!1;return!0}function n$({layout:e,panelConstraints:t}){let n=[...Object.values(e)],r=n.reduce((e,t)=>e+t,0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map(e=>`${e}%`).join(", ")}`);if(!nS(r,100)&&n.length>0)for(let e=0;e<t.length;e++){let t=n[e];np(null!=t,`No layout data found for index ${e}`);let s=100/r*t;n[e]=s}let s=0;for(let e=0;e<t.length;e++){let r=n[e];np(null!=r,`No layout data found for index ${e}`);let i=nL({panelConstraints:t[e],size:r});r!=i&&(s+=r-i,n[e]=i)}if(!nS(s,0))for(let e=0;e<t.length;e++){let r=n[e];np(null!=r,`No layout data found for index ${e}`);let i=r+s,o=nL({panelConstraints:t[e],size:i});if(r!==o&&(s-=o-r,n[e]=o,nS(s,0)))break}let i=Object.keys(e);
25return n.reduce((e,t,n)=>(e[i[n]]=t,e),{})}function nM({groupId:e}){let t=()=>{let{mountedGroups:t}=nN;for(let[n,r]of t)if(n.id===e)return{group:n,...r};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){let{defaultLayoutDeferred:e,layout:n}=t();return e?{}:n},setLayout(e){let{defaultLayoutDeferred:n,derivedPanelConstraints:r,group:s,layout:i,separatorToPanels:o}=t(),a=n$({layout:e,panelConstraints:r});return n?i:(nA(i,a)||nC(e=>({mountedGroups:new Map(e.mountedGroups).set(s,{defaultLayoutDeferred:n,derivedPanelConstraints:r,layout:a,separatorToPanels:o})})),a)}}}function nD(e){let{mountedGroups:t}=nN,n=t.get(e);return np(n,`Mounted Group ${e.id} not found`),n}function nP(e,t){let n=nT(e),r=nD(n),s=n.separators.find(t=>t.element===e);np(s,"Matching separator not found");let i=r.separatorToPanels.get(s);np(i,"Matching panels not found");let o=i.map(e=>n.panels.indexOf(e)),a=nM({groupId:n.id}).getLayout(),l=n$({layout:nO({delta:t,initialLayout:a,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:a,trigger:"keyboard"}),panelConstraints:r.derivedPanelConstraints});nA(a,l)||nC(e=>({mountedGroups:new Map(e.mountedGroups).set(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,layout:l,separatorToPanels:r.separatorToPanels})}))}function nB(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=nT(t);if(!n.disabled)switch(e.key){case"ArrowDown":e.preventDefault(),"vertical"===n.orientation&&nP(t,5);break;case"ArrowLeft":e.preventDefault(),"horizontal"===n.orientation&&nP(t,-5);break;case"ArrowRight":e.preventDefault(),"horizontal"===n.orientation&&nP(t,5);break;case"ArrowUp":e.preventDefault(),"vertical"===n.orientation&&nP(t,-5);break;case"End":e.preventDefault(),nP(t,100);break;case"Enter":{e.preventDefault();let n=nT(t),{derivedPanelConstraints:r,layout:s,separatorToPanels:i}=nD(n),o=n.separators.find(e=>e.element===t);np(o,"Matching separator not found");let a=i.get(o);np(a,"Matching panels not found");let l=a[0],c=r.find(e=>e.panelId===l.id);if(np(c,"Panel metadata not found"),c.collapsible){let e=s[l.id];nP(t,(c.collapsedSize===e?n.inMemoryLastExpandedPanelSizes[l.id]??c.minSize:c.collapsedSize)-e)}break}case"F6":{e.preventDefault();let n=nT(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);np(null!==r,"Index not found");let s=e.shiftKey?r>0?r-1:n.length-1:r+1<n.length?r+1:0;n[s].focus();break}case"Home":e.preventDefault(),nP(t,-100)}}let nR=e=>e,nz=()=>{},n_=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function nF(e){let t=e.length;for(;t--;){let n=e[t];if(np(n,"Missing node"),function(e){let t,n=getComputedStyle(e);return!!("fixed"===n.position||"auto"!==n.zIndex&&("static"!==n.position||"flex"===(t=getComputedStyle(nU(e)??e).display)||"inline-flex"===t)||1>+n.opacity||"transform"in n&&"none"!==n.transform||"webkitTransform"in n&&"none"!==n.webkitTransform||"mixBlendMode"in n&&"normal"!==n.mixBlendMode||"filter"in n&&"none"!==n.filter||"webkitFilter"in n&&"none"!==n.webkitFilter||"isolation"in n&&"isolate"===n.isolation||n_.test(n.willChange)||"touch"===n.webkitOverflowScrolling)}(n))return n}return null}function nK(e){return e&&Number(getComputedStyle(e).zIndex)||0}function nq(e){let t=[];for(;e;)t.push(e),e=nU(e);return t}function nU(e){let{parentNode:t}=e;return null!==t&&"object"==typeof t&&"nodeType"in t&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE?t.host:t}function nW(e,t){let r=[];return t.forEach((t,s)=>{if(s.disabled)return;let i=(void 0===n&&(n="function"==typeof matchMedia&&!!matchMedia("(pointer:coarse)").matches),n)?10:5,o=nx(s),a=function(e,t,n){let r,s={x:1/0,y:1/0};for(let i of t){let t=nv(n,i.rect);switch(e){case"horizontal":t.x<=s.x&&(r=i,s=t);break;case"vertical":t.y<=s.y&&(r=i,s=t)}}return r?{distance:s,hitRegion:r}:void 0}(s.orientation,o,{x:e.clientX,y:e.clientY});a&&a.distance.x<=i&&a.distance.y<=i&&function({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!nb(n)||n.contains(e)||e.contains(n))return!0;if(function(e,t){let n;if(e===t)throw Error("Cannot compare node with itself");let r={a:nq(e),b:nq(t)};for(;r.a.at(-1)===r.b.at(-1);)e=r.a.pop(),t=r.b.pop(),n=e;np(n,"Stacking order can only be calculated for elements with a common ancestor");let s={a:nK(nF(r.a)),b:nK(nF(r.b))};if(s.a===s.b){let e=n.childNodes,t={a:r.a.at(-1),b:r.b.at(-1)},s=e.length;for(;s--;){let n=e[s];if(n===t.a)return 1;if(n===t.b)return -1}}return Math.sign(s.a-s.b)}(n,e)>0){let s=n;for(;s;){var r;if(s.contains(e))break;if(r=s.getBoundingClientRect(),r.x<t.x+t.width&&r.x+r.width>t.x&&r.y<t.y+t.height&&r.y+r.height>t.y)return!1;s=s.parentElement}}return!0}({groupElement:s.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&r.push(a.hitRegion)}),r}function nG(e){if(e.defaultPrevented||"mouse"===e.pointerType&&e.button>0)return;let{mountedGroups:t}=nN,n=nW(e,t),r=new Set,s=new Set,i=new Set,o=new Map,a=!1;
25n.forEach(e=>{r.add(e.group),e.panels.forEach(e=>{s.add(e)}),e.separator&&(i.add(e.separator),a||(a=!0,e.separator.element.focus()));let n=t.get(e.group);n&&o.set(e.group,n.layout)}),nC({interactionState:{hitRegions:n,initialLayoutMap:o,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}}),n.length&&e.preventDefault()}let nV=new WeakMap;function nH(e){if(null===e.defaultView||void 0===e.defaultView)return;let{prevStyle:t,styleSheet:n}=nV.get(e)??{};void 0===n&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets=[n]);let{cursorFlags:r,interactionState:s}=nN;switch(s.state){case"active":case"hover":{let e=function({cursorFlags:e,groups:t,state:n}){let r=0,s=0;switch(n){case"active":case"hover":t.forEach(e=>{if(!e.disableCursor)switch(e.orientation){case"horizontal":r++;break;case"vertical":s++}})}if(0===r&&0===s)return null;if("active"===n){let t=(4&e)!=0,n=(8&e)!=0;if(e){if((1&e)!=0)return t?"se-resize":n?"ne-resize":"e-resize";if((2&e)!=0)return t?"sw-resize":n?"nw-resize":"w-resize";if(t)return"s-resize";if(n)return"n-resize"}}return r>0&&s>0?"move":r>0?"ew-resize":"ns-resize"}({cursorFlags:r,groups:s.hitRegions.map(e=>e.group),state:s.state}),i=`*{cursor: ${e} !important; ${"active"===s.state?"touch-action: none;":""} }`;if(t===i)return;t=i,e?0===n.cssRules.length?n.insertRule(i):n.replaceSync(i):1===n.cssRules.length&&n.deleteRule(0);break}case"inactive":t=void 0,1===n.cssRules.length&&n.deleteRule(0)}nV.set(e,{prevStyle:t,styleSheet:n})}function nJ({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:s,pointerDownAtPoint:i}){let o=0,a=new Map(s);n.forEach(e=>{let{group:n,groupSize:l}=e,{disableCursor:c,orientation:u,panels:d}=n,f=0;f=i?"horizontal"===u?(t.clientX-i.x)/l*100:(t.clientY-i.y)/l*100:"horizontal"===u?t.clientX<0?-100:100:t.clientY<0?-100:100;let p=r.get(n),{defaultLayoutDeferred:h,derivedPanelConstraints:m,layout:g,separatorToPanels:y}=s.get(n)??{defaultLayoutDeferred:!1};if(m&&p&&g&&y){let t=nO({delta:f,initialLayout:p,panelConstraints:m,pivotIndices:e.panels.map(e=>d.indexOf(e)),prevLayout:g,trigger:"mouse-or-touch"});if(nA(t,g)){if(0!==f&&!c)switch(u){case"horizontal":o|=f<0?1:2;break;case"vertical":o|=f<0?4:8}}else{a.set(e.group,{defaultLayoutDeferred:h,derivedPanelConstraints:m,layout:t,separatorToPanels:y});let n=e.group.panels.map(({id:e})=>e).join(",");e.group.inMemoryLayouts[n]=t}}}),nC({cursorFlags:o,mountedGroups:a}),nH(e)}function nY(e){let{interactionState:t,mountedGroups:n}=nN;"active"===t.state&&nJ({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n})}function nQ(e){if(e.defaultPrevented)return;let{interactionState:t,mountedGroups:n}=nN;if("active"===t.state){if(0===e.buttons){nC(e=>"inactive"===e.interactionState.state?e:{cursorFlags:0,interactionState:{state:"inactive"}}),nC(e=>({mountedGroups:new Map(e.mountedGroups)}));return}nJ({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint})}else{let r=nW(e,n);0===r.length?"inactive"!==t.state&&nC({interactionState:{state:"inactive"}}):nC({interactionState:{hitRegions:r,state:"hover"}}),nH(e.currentTarget)}}function nX(e){if(e.defaultPrevented||"mouse"===e.pointerType&&e.button>0)return;let{interactionState:t}=nN;"active"===t.state&&(nC({cursorFlags:0,interactionState:{state:"inactive"}}),t.hitRegions.length>0&&(nH(e.currentTarget),nC(e=>({mountedGroups:new Map(e.mountedGroups)})),e.preventDefault()))}function nZ(e){let t=0,n=0,r={};for(let s of e)if(void 0!==s.defaultSize){t++;let e=nw(s.defaultSize);n+=e,r[s.panelId]=e}else r[s.panelId]=void 0;let s=e.length-t;if(0!==s){let t=nw((100-n)/s);for(let n of e)void 0===n.defaultSize&&(r[n.panelId]=t)}return r}let n0=new Map;function n1(){let[e,t]=(0,s.useState)({});return[e,(0,s.useCallback)(()=>t({}),[])]}function n2(e){let t=(0,s.useId)();return`${e??t}`}let n5="u">typeof window?s.useLayoutEffect:s.useEffect;function n3(e){let t=(0,s.useRef)(e);return n5(()=>{t.current=e},[e]),(0,s.useCallback)((...e)=>t.current?.(...e),[t])}function n8(...e){return n3(t=>
25{e.forEach(e=>{if(e)switch(typeof e){case"function":e(t);break;case"object":e.current=t}})})}let n9=(0,s.createContext)(null);function n4({children:e,className:t,defaultLayout:n,disableCursor:i,disabled:o,elementRef:a,groupRef:l,id:c,onLayoutChange:u,onLayoutChanged:d,orientation:f="horizontal",style:p,...h}){var m;let g,y,b=(0,s.useRef)({onLayoutChange:{},onLayoutChanged:{}}),v=n3(e=>{nA(b.current.onLayoutChange,e)||(b.current.onLayoutChange=e,u?.(e))}),x=n3(e=>{nA(b.current.onLayoutChanged,e)||(b.current.onLayoutChanged=e,d?.(e))}),k=n2(c),w=(0,s.useRef)(null),[j,S]=n1(),N=(0,s.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],separators:[]}),E=n8(w,a);g=(0,s.useRef)({getLayout:()=>({}),setLayout:nR}),(0,s.useImperativeHandle)(l,()=>g.current,[]),n5(()=>{Object.assign(g.current,nM({groupId:k}))});let C=n3((e,t)=>{let{interactionState:r,mountedGroups:s}=nN;for(let n of s.keys())if(n.id===e){let e=s.get(n);if(e){let s=!1;return"active"===r.state&&(s=r.hitRegions.some(e=>e.group===n)),{flexGrow:e.layout[t]??1,pointerEvents:s?"none":void 0}}}return{flexGrow:n?.[t]??1}}),I=(0,s.useMemo)(()=>({getPanelStyles:C,id:k,orientation:f,registerPanel:e=>{let t=N.current;return t.panels=nm(f,[...t.panels,e]),S(),()=>{t.panels=t.panels.filter(t=>t!==e),S()}},registerSeparator:e=>{let t=N.current;return t.separators=nm(f,[...t.separators,e]),S(),()=>{t.separators=t.separators.filter(t=>t!==e),S()}}}),[C,k,S,f]),L=(m={defaultLayout:n,disableCursor:i},y=(0,s.useRef)({...m}),n5(()=>{for(let e in m)y.current[e]=m[e]},[m]),y.current),O=(0,s.useRef)(null);return n5(()=>{let e,t,n,r,s,i,a,l,c,u,d,p,h=w.current;if(null===h)return;let m=N.current,g={defaultLayout:L.defaultLayout,disableCursor:!!L.disableCursor,disabled:!!o,element:h,id:k,inMemoryLastExpandedPanelSizes:N.current.lastExpandedPanelSizes,inMemoryLayouts:N.current.layouts,orientation:f,panels:m.panels,separators:m.separators};O.current=g;let y=(e=!0,np(g.element.ownerDocument.defaultView,"Cannot register an unmounted Group"),t=g.element.ownerDocument.defaultView.ResizeObserver,n=new Set,r=new Set,(s=new t(t=>{for(let n of t){let{borderBoxSize:t,target:r}=n;if(r===g.element){if(e){if(0===nh({group:g}))return;nC(e=>{let t=e.mountedGroups.get(g);if(t){let n=nj(g),r=t.defaultLayoutDeferred?nZ(n):t.layout,s=n$({layout:r,panelConstraints:n});return!t.defaultLayoutDeferred&&nA(r,s)&&function(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}(t.derivedPanelConstraints,n)?e:{mountedGroups:new Map(e.mountedGroups).set(g,{defaultLayoutDeferred:!1,derivedPanelConstraints:n,layout:s,separatorToPanels:t.separatorToPanels})}}return e})}}else!function(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let s=nh({group:e}),i="horizontal"===e.orientation?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,a={asPercentage:nw(i/s*100),inPixels:i};r.mutableValues.prevSize=a,r.onResize(a,r.id,o)}(g,r,t)}})).observe(g.element),g.panels.forEach(e=>{np(!n.has(e.id),`Panel ids must be unique; id "${e.id}" was used more than once`),n.add(e.id),e.onResize&&s.observe(e.element)}),i=nh({group:g}),a=nj(g),l=g.panels.map(({id:e})=>e).join(","),(c=g.defaultLayout)&&(function(e,t){let n=e.map(e=>e.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(let e of n)if(!r.includes(e))return!1;return!0}(g.panels,c)||(c=void 0)),u=n$({layout:g.inMemoryLayouts[l]??c??nZ(a),panelConstraints:a}),d=nx(g),p=g.element.ownerDocument,nC(e=>{let t=new Map;return n0.set(p,(n0.get(p)??0)+1),d.forEach(e=>{e.separator&&t.set(e.separator,e.panels)}),{mountedGroups:new Map(e.mountedGroups).set(g,{defaultLayoutDeferred:0===i,derivedPanelConstraints:a,layout:u,separatorToPanels:t})}}),g.separators.forEach(e=>{np(!r.has(e.id),`Separator ids must be unique; id "${e.id}" was used more than once`),r.add(e.id),e.element.addEventListener("keydown",nB)}),1===n0.get(p)&&(p.addEventListener("pointerdown",nG,!0),p.addEventListener("pointerleave",nY),p.addEventListener("pointermove",nQ),p.addEventListener("pointerup",nX,!0)),function(){e=!1,n0.set(p,Math.max(0,(n0.get(p)??0)-1)),nC(e=>{let t=new Map(e.mountedGroups);return t.delete(g),{mountedGroups:t}}
25),g.separators.forEach(e=>{e.element.removeEventListener("keydown",nB)}),n0.get(p)||(p.removeEventListener("pointerdown",nG,!0),p.removeEventListener("pointerleave",nY),p.removeEventListener("pointermove",nQ),p.removeEventListener("pointerup",nX,!0)),s.disconnect()}),b=nN.mountedGroups.get(g);if(b){let{defaultLayoutDeferred:e,derivedPanelConstraints:t,layout:n}=b;!e&&t.length>0&&(v(n),x(n),m.panels.forEach(e=>{e.scheduleUpdate()}))}let j=nE.addListener("interactionStateChange",()=>{m.panels.forEach(e=>{e.scheduleUpdate()})}),S=nE.addListener("mountedGroupsChange",e=>{let t=e.get(g);if(t){let{defaultLayoutDeferred:e,derivedPanelConstraints:n,layout:r}=t;if(e||0===n.length)return;let{interactionState:s}=nN,i="active"!==s.state;v(r),i&&x(r),m.panels.forEach(e=>{e.scheduleUpdate()})}});return()=>{O.current=null,y(),j(),S()}},[o,k,x,v,f,j,L]),(0,s.useEffect)(()=>{let e=O.current;e&&(e.defaultLayout=n,e.disableCursor=!!i)}),(0,r.jsx)(n9.Provider,{value:I,children:(0,r.jsx)("div",{...h,"aria-orientation":f,className:t,"data-group":!0,"data-testid":k,id:k,ref:E,style:{height:"100%",width:"100%",overflow:"hidden",...p,display:"flex",flexDirection:"horizontal"===f?"row":"column",flexWrap:"nowrap"},children:e})})}function n6(){let e=(0,s.useContext)(n9);return np(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function n7({children:e,className:t,collapsedSize:n="0%",collapsible:i=!1,defaultSize:o,elementRef:a,id:l,maxSize:c="100%",minSize:u="0%",onResize:d,panelRef:f,style:p,...h}){let m=!!l,g=n2(l),y=(0,s.useRef)(null),b=n8(y,a),[,v]=n1(),{getPanelStyles:x,id:k,registerPanel:w}=n6(),j=null!==d,S=n3((e,t,n)=>{d?.(e,l,n)});n5(()=>{let e=y.current;if(null!==e)return w({element:e,id:g,idIsStable:m,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:j?S:void 0,panelConstraints:{collapsedSize:n,collapsible:i,defaultSize:o,maxSize:c,minSize:u},scheduleUpdate:v})},[n,i,o,v,j,g,m,c,u,S,w]),function(e,t){let{id:n}=n6(),r=(0,s.useRef)({collapse:nz,expand:nz,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:nz});(0,s.useImperativeHandle)(t,()=>r.current,[]),n5(()=>{Object.assign(r.current,function({groupId:e,panelId:t}){let n=()=>{let{mountedGroups:t}=nN;for(let[n,{defaultLayoutDeferred:r,derivedPanelConstraints:s,layout:i,separatorToPanels:o}]of t)if(n.id===e)return{defaultLayoutDeferred:r,derivedPanelConstraints:s,group:n,layout:i,separatorToPanels:o};throw Error(`Group ${e} not found`)},r=()=>{let e=n().derivedPanelConstraints.find(e=>e.panelId===t);if(void 0!==e)return e;throw Error(`Panel constraints not found for Panel ${t}`)},s=()=>{let e=n().group.panels.find(e=>e.id===t);if(void 0!==e)return e;throw Error(`Layout not found for Panel ${t}`)},i=()=>{let e=n().layout[t];if(void 0!==e)return e;throw Error(`Layout not found for Panel ${t}`)},o=e=>{let r=i();if(e===r)return;let{defaultLayoutDeferred:s,derivedPanelConstraints:o,group:a,layout:l,separatorToPanels:c}=n(),u=a.panels.findIndex(e=>e.id===t),d=u===a.panels.length-1,f=n$({layout:nO({delta:d?r-e:e-r,initialLayout:l,panelConstraints:o,pivotIndices:d?[u-1,u]:[u,u+1],prevLayout:l,trigger:"imperative-api"}),panelConstraints:o});nA(l,f)||nC(e=>({mountedGroups:new Map(e.mountedGroups).set(a,{defaultLayoutDeferred:s,derivedPanelConstraints:o,layout:f,separatorToPanels:c})}))};return{collapse:()=>{let{collapsible:e,collapsedSize:t}=r(),{mutableValues:n}=s(),a=i();e&&a!==t&&(n.expandToSize=a,o(t))},expand:()=>{let{collapsible:e,collapsedSize:t,minSize:n}=r(),{mutableValues:a}=s(),l=i();if(e&&l===t){let e=a.expandToSize??n;0===e&&(e=1),o(e)}},getSize:()=>{let{group:e}=n(),t=i(),{element:r}=s();return{asPercentage:t,inPixels:"horizontal"===e.orientation?r.offsetWidth:r.offsetHeight}},isCollapsed:()=>{let{collapsible:e,collapsedSize:t}=r(),n=i();return e&&nS(t,n)},resize:e=>{if(i()!==e){let t;switch(typeof e){case"number":{let{group:r}=n();t=nw(e/nh({group:r})*100);break}case"string":t=parseFloat(e)}o(t)}}}}({groupId:n,panelId:e}))})}(g,f);let N=x(k,g);return(0,r.jsx)("div",{...h,"data-panel":!0,"data-testid":g,id:g,ref:b,style:{...re,flexBasis:0,flexShrink:1,overflow:"hidden",...N},children:(0,r.jsx)("div",{className:t,style:{width:"100%",height:"100%",...p},children:e})})}n4.displayName="Group",n7.displayName="Panel";let re={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function rt({children:e,className:t,elementRef:n,id:i,style:o,...a}
25){let l=n2(i),[c,u]=(0,s.useState)({}),[d,f]=(0,s.useState)("inactive"),p=(0,s.useRef)(null),h=n8(p,n),{id:m,orientation:g,registerSeparator:y}=n6();return n5(()=>{let e=p.current;if(null!==e){let t={element:e,id:l},n=y(t),r=nE.addListener("interactionStateChange",e=>{f("inactive"!==e.state&&e.hitRegions.some(e=>e.separator===t)?e.state:"inactive")}),s=nE.addListener("mountedGroupsChange",e=>{e.forEach(({derivedPanelConstraints:e,layout:n,separatorToPanels:r},s)=>{if(s.id===m){let i=r.get(t);if(i){let t=i[0],r=s.panels.indexOf(t);u(function({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let s,i,o=e[n],a=t.find(e=>e.panelId===n);if(a){let l=a.maxSize,c=i=a.collapsible?a.collapsedSize:a.minSize,u=[r,r+1];i=n$({layout:nO({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e,trigger:"keyboard"}),panelConstraints:t})[n],s=n$({layout:nO({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e,trigger:"keyboard"}),panelConstraints:t})[n]}return{valueControls:n,valueMax:s,valueMin:i,valueNow:o}}({layout:n,panelConstraints:e,panelId:t.id,panelIndex:r}))}}})});return()=>{r(),s(),n()}}},[m,l,y]),(0,r.jsx)("div",{...a,"aria-controls":c.valueControls,"aria-orientation":"horizontal"===g?"vertical":"horizontal","aria-valuemax":c.valueMax,"aria-valuemin":c.valueMin,"aria-valuenow":c.valueNow,children:e,className:t,"data-separator":d,"data-testid":l,id:l,ref:h,role:"separator",style:{flexBasis:"auto",...o,flexGrow:0,flexShrink:0},tabIndex:0})}rt.displayName="Separator";var rn=e.i(152236);function rr({className:e,...t}){return(0,r.jsx)(n4,{"data-slot":"resizable-panel-group",className:(0,rn.cn)("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...t})}function rs({...e}){return(0,r.jsx)(n7,{"data-slot":"resizable-panel",...e})}function ri({withHandle:e,className:t,...n}){return(0,r.jsx)(rt,{"data-slot":"resizable-handle",className:(0,rn.cn)("bg-border focus-visible:ring-ring relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-hidden data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:translate-x-0 data-[panel-group-direction=vertical]:after:-translate-y-1/2 [&[data-panel-group-direction=vertical]>div]:rotate-90",t),...n,children:e&&(0,r.jsx)("div",{className:"bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border",children:(0,r.jsx)(nf.default,{className:"size-2.5"})})})}var ro=e.i(855264),ra=e.i(62746),rl=e.i(7012),rc=e.i(125280),ru=e.i(839717),rd=e.i(146012),rf=0;function rp(){return`node_${++rf}`}function rh(e){return null===e?"null":Array.isArray(e)?"array":typeof e}function rm(e,t,n,r,s){let i=rp(),o=n?`${n}/${e}`:`/${e}`,a=rh(t),l={id:i,key:e,path:o,type:a,value:"object"===a||"array"===a?void 0:t,children:[],parentId:r};return s.set(i,l),"object"===a&&null!==t?l.children=Object.keys(t).map(e=>rm(e,t[e],o,i,s)):"array"===a&&(l.children=t.map((e,t)=>rm(String(t),e,o,i,s))),l}function rg(e){let t=new Map,n=rh(e),r={id:rp(),key:"",path:"/",type:n,value:"object"===n||"array"===n?void 0:e,children:[],parentId:null};return t.set(r.id,r),"object"===n&&null!==e?r.children=Object.keys(e).map(n=>rm(n,e[n],"",r.id,t)):"array"===n&&(r.children=e.map((e,n)=>rm(String(n),e,"",r.id,t))),{root:r,nodesById:t}}function ry(e){switch(e.type){case"object":{let t={};for(let n of e.children)t[n.key]=ry(n);return t}case"array":return e.children.map(e=>ry(e));default:return e.value}}function rb(e,t){let n=t?`${t}/${e.key}`:`/${e.key}`;return e.path===n&&0===e.children.length?e:{...e,path:n,children:e.children.map(e=>rb(e,n))}}function rv(e,t,n){let r,s=[],i=e.nodesById.get(t);for(;i;)s.unshift(i.id),i=i.parentId?e.nodesById.get(i.parentId):void 0;if(0===s.length)return e;let o=function e(t,r){if(r===s.length-1)return n(t);let i=s[r+1];return{...t,children:t.children.map(t=>
25t.id===i?e(t,r+1):t)}}(e.root,0);return{root:o,nodesById:(r=new Map,!function e(t){for(let n of(r.set(t.id,t),t.children))e(n)}(o),r)}}function rx(e){if("array"!==e.type)return e;let t="/"===e.path?"":e.path;return{...e,children:e.children.map((e,n)=>{let r=String(n);return e.key===r?e:rb({...e,key:r},t)})}}function rk(e,t,n){if(!e.nodesById.get(t))return e;let r=rh(n);return"object"!==r&&"array"!==r?rv(e,t,e=>({...e,type:r,value:n,children:[]})):rv(e,t,e=>{let t=e.path.split("/").slice(0,-1).join("/")||"",r=new Map;return{...rm(e.key,n,t,e.parentId,r),id:e.id}})}function rw(e,t){let n=e.nodesById.get(t);return n&&n.parentId?rv(e,n.parentId,e=>{let n=e.children.filter(e=>e.id!==t);return rx({...e,children:n})}):e}var rj=class{constructor(){this.stack=[],this.cursor=-1}push(e){this.stack=this.stack.slice(0,this.cursor+1),this.stack.push(e),this.stack.length>100?this.stack.shift():this.cursor++}undo(){return this.canUndo?(this.cursor--,this.stack[this.cursor]):null}redo(){return this.canRedo?(this.cursor++,this.stack[this.cursor]):null}get canUndo(){return this.cursor>0}get canRedo(){return this.cursor<this.stack.length-1}get current(){return this.stack[this.cursor]??null}};function rS(e,t,n){let r=n??new Set;if(e.$ref){if(r.has(e.$ref))return e;r.add(e.$ref);let n=function(e,t){if(!t.startsWith("#/"))return;let n=t.slice(2).split("/"),r=e;for(let e of n){if(null===r||"object"!=typeof r)return;r=r[e]}return r}(t,e.$ref);return n?rS(n,t,r):e}return e.allOf&&e.allOf.length>0?function(e,t,n){let r={...e};for(let s of(delete r.allOf,e.allOf)){let e=rS(s,t,new Set(n));e.type&&!r.type&&(r.type=e.type),e.properties&&(r.properties={...r.properties,...e.properties}),e.required&&(r.required=[...new Set([...r.required??[],...e.required])]),void 0!==e.additionalProperties&&void 0===r.additionalProperties&&(r.additionalProperties=e.additionalProperties),e.items&&!r.items&&(r.items=e.items),e.description&&!r.description&&(r.description=e.description),e.title&&!r.title&&(r.title=e.title),e.enum&&!r.enum&&(r.enum=e.enum),void 0!==e.minimum&&void 0===r.minimum&&(r.minimum=e.minimum),void 0!==e.maximum&&void 0===r.maximum&&(r.maximum=e.maximum),void 0!==e.minLength&&void 0===r.minLength&&(r.minLength=e.minLength),void 0!==e.maxLength&&void 0===r.maxLength&&(r.maxLength=e.maxLength),e.pattern&&!r.pattern&&(r.pattern=e.pattern),e.format&&!r.format&&(r.format=e.format)}return r}(e,t,r):e}function rN(e,t,n){let r=n??e,s=t.split("/").filter(Boolean),i=rS(e,r);for(let e of s){if(!i)return;if(i=rS(i,r),i.properties?.[e]){i=rS(i.properties[e],r);continue}if(i.patternProperties){let t=Object.entries(i.patternProperties).find(([t])=>{try{return new RegExp(t).test(e)}catch{return!1}});if(t){i=rS(t[1],r);continue}}if(i.additionalProperties&&"object"==typeof i.additionalProperties){i=rS(i.additionalProperties,r);continue}if(i.items)if(Array.isArray(i.items)){let t=Number(e);if(!isNaN(t)&&i.items[t]){i=rS(i.items[t],r);continue}}else{i=rS(i.items,r);continue}if(i.anyOf||i.oneOf){let t;for(let n of i.anyOf??i.oneOf??[])if(t=rN(rS(n,r),e,r))break;if(t){i=t;continue}}return}return i}var rE={email:/^[^\s@]+@[^\s@]+\.[^\s@]+$/,uri:/^https?:\/\/.+/,"ur
25i-reference":/^(https?:\/\/|\/|\.\.?\/|#).*/,"date-time":/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/,date:/^\d{4}-\d{2}-\d{2}$/,time:/^\d{2}:\d{2}:\d{2}/,ipv4:/^(\d{1,3}\.){3}\d{1,3}$/,ipv6:/^([0-9a-fA-F]{0,4}:){2,7}[0-9a-fA-F]{0,4}$/,uuid:/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,hostname:/^[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?)*$/};function rC(e,t){if(!t.trim())return[];let n=[],r=t.toLowerCase();return!function e(t){for(let s of(t.key&&t.key.toLowerCase().includes(r)&&n.push({nodeId:t.id,field:"key"}),void 0!==t.value&&null!==t.value&&String(t.value).toLowerCase().includes(r)&&n.push({nodeId:t.id,field:"value"}),t.children))e(s)}(e.root),n}var rI=(0,s.createContext)(null);function rL(){let e=(0,s.useContext)(rI);if(!e)throw Error("useStudio must be used within a <VisualJson> provider");return e}function rO({value:e,onChange:t,schema:n,children:i}){let[o,a]=(0,s.useState)(()=>rg(e)),[l,c]=(0,s.useState)(null),[u,d]=(0,s.useState)(()=>new Set([o.root.id])),f=(0,s.useRef)(new rj),p=(0,s.useRef)(!1),h=(0,s.useRef)(!1),[m,g]=(0,s.useState)(!1),[y,b]=(0,s.useState)(!1),[v,x]=(0,s.use
25State)(""),[k,w]=(0,s.useState)([]),[j,S]=(0,s.useState)(0),[N,E]=(0,s.useState)(new Set);(0,s.useEffect)(()=>{f.current.push(o),g(f.current.canUndo),b(f.current.canRedo)},[]),(0,s.useEffect)(()=>{if(!h.current){h.current=!0;return}if(p.current){p.current=!1;return}let t=rg(e);a(t),d(new Set([t.root.id])),c(null),f.current=new rj,f.current.push(t),g(!1),b(!1),x(""),w([]),S(0),E(new Set)},[e]);let C=(0,s.useCallback)(e=>{a(e),f.current.push(e),g(f.current.canUndo),b(f.current.canRedo),p.current=!0,t?.(ry(e.root))},[t]),I=(0,s.useCallback)(()=>{let e=f.current.undo();e&&(a(e),g(f.current.canUndo),b(f.current.canRedo),p.current=!0,t?.(ry(e.root)))},[t]),L=(0,s.useCallback)(()=>{let e=f.current.redo();e&&(a(e),g(f.current.canUndo),b(f.current.canRedo),p.current=!0,t?.(ry(e.root)))},[t]);(0,s.useEffect)(()=>{function e(e){let t=e.metaKey||e.ctrlKey;t&&"z"===e.key&&!e.shiftKey?(e.preventDefault(),I()):t&&"z"===e.key&&e.shiftKey?(e.preventDefault(),L()):t&&"y"===e.key&&(e.preventDefault(),L())}return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[I,L]);let O=(0,s.useCallback)(e=>{c(e)},[]),T=(0,s.useCallback)(e=>{d(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),A=(0,s.useCallback)(e=>{d(t=>{let n=new Set(t);return n.add(e),n})},[]),$=(0,s.useCallback)(e=>{d(t=>{let n=new Set(t);return n.delete(e),n})},[]),M=(0,s.useCallback)(()=>{d(new Set(function e(t){let n=[t.id];for(let r of t.children)n.push(...e(r));return n}(o.root)))},[o]),D=(0,s.useCallback)(()=>{d(new Set([o.root.id]))},[o]),P=(0,s.useCallback)(e=>
25{if(x(e),!e.trim()){w([]),S(0),E(new Set);return}let t=rC(o,e);if(w(t),S(0),E(new Set(t.map(e=>e.nodeId))),t.length>0){let e=function(e,t){let n=new Set;for(let r of t){let t=e.nodesById.get(r);for(;t&&t.parentId;)n.add(t.parentId),t=e.nodesById.get(t.parentId)}return n}(o,t.map(e=>e.nodeId));d(t=>{let n=new Set(t);for(let t of e)n.add(t);return n}),c(t[0].nodeId)}},[o]),B=(0,s.useCallback)(()=>{if(0===k.length)return;let e=(j+1)%k.length;S(e),c(k[e].nodeId)},[k,j]),R=(0,s.useCallback)(()=>{if(0===k.length)return;let e=(j-1+k.length)%k.length;S(e),c(k[e].nodeId)},[k,j]);(0,s.useEffect)(()=>{if(!v.trim())return;let e=rC(o,v);w(e),S(t=>Math.min(t,Math.max(e.length-1,0))),E(new Set(e.map(e=>e.nodeId)))},[o]);let z=(0,s.useMemo)(()=>({tree:o,selectedNodeId:l,expandedNodeIds:u,schema:n??null,searchQuery:v,searchMatches:k,searchMatchIndex:j,searchMatchNodeIds:N}),[o,l,u,n,v,k,j,N]),_=(0,s.useMemo)(()=>({setTree:C,selectNode:O,toggleExpand:T,expandNode:A,collapseNode:$,expandAll:M,collapseAll:D,undo:I,redo:L,canUndo:m,canRedo:y,setSearchQuery:P,nextSearchMatch:B,prevSearchMatch:R}),[C,O,T,A,$,M,D,I,L,m,y,P,B,R]),F=(0,s.useMemo)(()=>({state:z,actions:_}),[z,_]);return(0,r.jsx)(rI.Provider,{value:F,children:i})}function rT({x:e,y:t,items:n,onClose:i}){let o=(0,s.useRef)(null),[a,l]=(0,s.useState)({left:e,top:t});return(0,s.useEffect)(()=>{if(!o.current)return;let n=o.current.getBoundingClientRect(),r=window.innerWidth,s=window.innerHeight;l({left:n.right>r?Math.max(0,e-n.width):e,top:n.bottom>s?Math.max(0,t-n.height):t})},[e,t]),(0,s.useEffect)(()=>{function e(e){o.current&&!o.current.contains(e.target)&&i()}function t(e){"Escape"===e.key&&i()}return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)}},[i]),(0,r.jsx)("div",{ref:o,style:{position:"fixed",left:a.left,top:a.top,zIndex:1e4,backgroundColor:"var(--vj-bg-panel, #252526)",border:"1px solid var(--vj-border, #454545)",borderRadius:4,boxShadow:"0 4px 12px rgba(0,0,0,0.5)",padding:"4px 0",minWidth:160},children:n.map((e,t)=>e.separator?(0,r.jsx)("div",{style:{height:1,backgroundColor:"var(--vj-border, #454545)",margin:"4px 0"}},t):(0,r.jsx)("button",{onClick:()=>{e.disabled||(e.action(),i())},disabled:e.disabled,style:{display:"block",width:"100%",textAlign:"left",background:"none",border:"none",color:e.disabled?"var(--vj-text-dimmer, #555555)":"var(--vj-text, #cccccc)",cursor:e.disabled?"default":"pointer",padding:"4px 16px",fontSize:12,fontFamily:"var(--vj-font, monospace)"},onMouseEnter:t=>{e.disabled||(t.target.style.backgroundColor="var(--vj-accent-muted, #094771)")},onMouseLeave:e=>{e.target.style.backgroundColor="transparent"},children:e.label},t))})}var rA=["name","type","title","id","label","key"];function r$(e,t){if(null===e.parentId)return"/";let n=t.nodesById.get(e.parentId);if(n?.type!=="array"||"object"!==e.type)return e.key;for(let t of rA){let n=e.children.find(e=>e.key===t);if(n?.value!=null&&""!==n.value)return String(n.value)}return e.key}function rM(e,t){let n=[];return!function e(r){if(n.push(r),t(r.id)&&("object"===r.type||"array"===r.type))for(let t of r.children)e(t)}(e),n}var rD={draggedNodeId:null,dropTargetNodeId:null,dropPosition:null};function rP(){let{state:e,actions:t}=rL(),[n,r]=(0,s.useState)(rD),i=(0,s.useRef)(n);i.current=n;let o=(0,s.useCallback)(e=>{r({draggedNodeId:e,dropTargetNodeId:null,dropPosition:null})},[]),a=(0,s.useCallback)((e,t)=>{r(n=>({...n,dropTargetNodeId:e,dropPosition:t}))},[]);return{dragState:n,handleDragStart:o,handleDragOver:a,handleDragEnd:(0,s.useCallback)(()=>{r(rD)},[]),handleDrop:(0,s.useCallback)(()=>{let{draggedNodeId:n,dropTargetNodeId:s,dropPosition:o}=i.current;if(!n||!s||!o)return;let a=e.tree.nodesById.get(n),l=e.tree.nodesById.get(s);if(a&&l){if(a.parentId&&a.parentId===l.parentId){let r=e.tree.nodesById.get(a.parentId);if(r){let i=r.children.findIndex(e=>e.id===n),a=r.children.findIndex(e=>e.id===s);if("after"===o&&a++,i<a&&a--,i!==a&&i>=0&&a>=0){var c,u,d;let n=(c=e.tree,u=r.id,d=a,c.nodesById.get(u)?rv(c,u,e=>{let t=[...e.children],[n]=t.splice(i,1);return t.splice(d,0,n),rx({...e,children:t})}):c);t.setTree(n)}}}else if(l.parentId){let r=e.tree.nodesById.get(l.parentId);if(r){let i=r.children.findIndex(e=>e.id===s);"after"===o&&i++;let a=function(e,t,n,r){let s=e.nodesById.get(t);if(!s||!s.parentId)return e;
25let i=e.nodesById.get(s.parentId),o=e.nodesById.get(n);if(!i||!o)return e;let a=ry(s),l=rv(e,s.parentId,e=>{let n=e.children.filter(e=>e.id!==t);return rx({...e,children:n})});return rv(l,n,e=>{let t="/"===e.path?"":e.path,n=new Map,i=rm("array"===e.type?String(r??e.children.length):s.key,a,t,e.id,n),o=[...e.children],l=r??o.length;return o.splice(l,0,i),rx({...e,children:o})})}(e.tree,n,r.id,i);t.setTree(a)}}r(rD)}},[e.tree,t])}}function rB({node:e,depth:t,dragState:n,showValues:i,showCounts:o,isFocused:a,onDragStart:l,onDragOver:c,onDragEnd:u,onDrop:d,onContextMenu:f}){let{state:p,actions:h}=rL(),m=p.selectedNodeId===e.id,g=p.expandedNodeIds.has(e.id),y="object"===e.type||"array"===e.type,[b,v]=(0,s.useState)(!1),x=null===e.parentId,k=p.searchMatchNodeIds.has(e.id),w=p.searchMatches.length>0&&p.searchMatches[p.searchMatchIndex]?.nodeId===e.id,j=p.schema,S=j?rN(j,e.path):void 0,N=S?function(e,t){let n=[];if(!t)return{valid:!0,errors:n};if(t.type&&!function(e,t){if(!t)return!0;let n=Array.isArray(t)?t:[t];return!!("number"===e&&n.includes("integer"))||n.includes(e)}(e.type,t.type)){let r=Array.isArray(t.type)?t.type.join(" | "):t.type;n.push(`Expected type "${r}", got "${e.type}"`)}if(t.enum&&t.enum.length>0&&void 0!==e.value&&(t.enum.some(t=>JSON.stringify(t)===JSON.stringify(e.value))||n.push(`Value must be one of: ${t.enum.map(e=>JSON.stringify(e)).join(", ")}`)),void 0!==t.const&&void 0!==e.value&&JSON.stringify(e.value)!==JSON.stringify(t.const)&&n.push(`Value must be ${JSON.stringify(t.const)}`),t.required&&("object"===e.type||"array"===e.type)){let r=new Set(e.children.map(e=>e.key));for(let e of t.required)r.has(e)||n.push(`Missing required property "${e}"`)}if("number"===e.type&&"number"==typeof e.value){let r=e.value;if(void 0!==t.minimum&&r<t.minimum&&n.push(`Value must be >= ${t.minimum}`),void 0!==t.maximum&&r>t.maximum&&n.push(`Value must be <= ${t.maximum}`),void 0!==t.exclusiveMinimum){let e="number"==typeof t.exclusiveMinimum?t.exclusiveMinimum:t.minimum;void 0!==e&&r<=e&&n.push(`Value must be > ${e}`)}if(void 0!==t.exclusiveMaximum){let e="number"==typeof t.exclusiveMaximum?t.exclusiveMaximum:t.maximum;void 0!==e&&r>=e&&n.push(`Value must be < ${e}`)}if(void 0!==t.multipleOf){let e=Math.abs(r%t.multipleOf);e>1e-10&&Math.abs(e-t.multipleOf)>1e-10&&n.push(`Value must be a multiple of ${t.multipleOf}`)}}if("string"===e.type&&"string"==typeof e.value){let r=e.value;if(void 0!==t.minLength&&r.length<t.minLength&&n.push(`Must be at least ${t.minLength} characters`),void 0!==t.maxLength&&r.length>t.maxLength&&n.push(`Must be at most ${t.maxLength} characters`),t.pattern)try{new RegExp(t.pattern).test(r)||n.push(`Must match pattern: ${t.pattern}`)}catch{}t.format&&rE[t.format]&&!rE[t.format].test(r)&&n.push(`Invalid ${t.format} format`)}return"array"===e.type&&(void 0!==t.minItems&&e.children.length<t.minItems&&n.push(`Must have at least ${t.minItems} items`),void 0!==t.maxItems&&e.children.length>t.maxItems&&n.push(`Must have at most ${t.maxItems} items`)),"object"===e.type&&(void 0!==t.minProperties&&e.children.length<t.minProperties&&n.push(`Must have at least ${t.minProperties} properties`),void 0!==t.maxProperties&&e.children.length>t.maxProperties&&n.push(`Must have at most ${t.maxProperties} properties`)),{valid:0===n.length,errors:n}}(e,S):null;N&&N.valid;let E=n.dropTargetNodeId===e.id,C=n.draggedNodeId===e.id;function I(){return y?"array"===e.type?`[${e.children.length}]`:`{${e.children.length}}`:null===e.value?"null":"string"==typeof e.value?e.value:String(e.value)}let L="none",O="none";return E&&"before"===n.dropPosition?L="2px solid var(--vj-accent, #007acc)":E&&"after"===n.dropPosition&&(O="2px solid var(--vj-accent, #007acc)"),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{role:"treeitem","aria-selected":m,"aria-expanded":y?g:void 0,onClick:()=>h.selectNode(e.id),onMouseEnter:()=>v(!0),onMouseLeave:()=>v(!1),onContextMenu:t=>f(t,e),draggable:!x,onDragStart:t=>{t.dataTransfer.effectAllowed="move",l(e.id)},onDragOver:function(t){t.preventDefault();let n=t.currentTarget.getBoundingClientRect(),r=n.top+n.height/2,s=t.clientY
25<r?"before":"after";c(e.id,s)},onDragEnd:u,onDrop:e=>{e.preventDefault(),d()},"data-node-id":e.id,style:{display:"flex",alignItems:"center",gap:6,padding:"3px 8px",paddingLeft:8+16*t,cursor:"pointer",backgroundColor:m?a?"var(--vj-bg-selected, #2a5a1e)":"var(--vj-bg-selected-muted, var(--vj-bg-hover, #2a2d2e))":w?"var(--vj-bg-match-active, #51502b)":k?"var(--vj-bg-match, #3a3520)":b?"var(--vj-bg-hover, #2a2d2e)":"transparent",minHeight:28,userSelect:"none",opacity:C?.4:1,borderTop:L,borderBottom:O,color:m&&a?"var(--vj-text-selected, var(--vj-text, #cccccc))":"var(--vj-text, #cccccc)"},children:[y?(0,r.jsx)("button",{onClick:t=>{t.stopPropagation(),h.toggleExpand(e.id)},"aria-label":g?"Collapse":"Expand",style:{background:"none",border:"none",color:"inherit",cursor:"pointer",padding:0,width:16,fontSize:9,flexShrink:0,display:"inline-flex",alignItems:"center",justifyContent:"center",transition:"transform 0.15s",transform:g?"rotate(90deg)":"rotate(0deg)"},children:"â¶"}):(0,r.jsx)("span",{style:{width:16,flexShrink:0}}),(0,r.jsx)("span",{style:{color:"inherit",fontSize:13,fontFamily:"var(--vj-font, monospace)",flexShrink:0,fontWeight:x?600:400},children:x?"/":r$(e,p.tree)}),!x&&y&&o&&(0,r.jsx)("span",{style:{color:m?"inherit":"var(--vj-text-muted, #888888)",fontSize:13,fontFamily:"var(--vj-font, monospace)",whiteSpace:"nowrap",marginLeft:"auto"},children:I()}),!x&&!y&&i&&(0,r.jsx)("span",{style:{color:"string"===e.type?"var(--vj-string, #ce9178)":"var(--vj-number, #b5cea8)",fontSize:13,fontFamily:"var(--vj-font, monospace)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginLeft:"auto"},children:I()})]}),g&&e.children.map(e=>(0,r.jsx)(rB,{node:e,depth:t+1,dragState:n,showValues:i,showCounts:o,isFocused:a,onDragStart:l,onDragOver:c,onDragEnd:u,onDrop:d,onContextMenu:f},e.id))]})}function rR({className:e,showValues:t=!0,showCounts:n=!1}){let{state:i,actions:o}=rL(),a=(0,s.useRef)(null),{dragState:l,handleDragStart:c,handleDragOver:u,handleDragEnd:d,handleDrop:f}
25=rP(),[p,h]=(0,s.useState)(null),m=(0,s.useMemo)(()=>rM(i.tree.root,e=>i.expandedNodeIds.has(e)),[i.tree.root,i.expandedNodeIds]),g=(0,s.useCallback)((e,t)=>{e.preventDefault(),o.selectNode(t.id),h({x:e.clientX,y:e.clientY,node:t})},[o]),y=(0,s.useCallback)(e=>{let t=[];if(("object"===e.type||"array"===e.type)&&(t.push({label:"Expand all children",action:()=>{for(let t of function e(t){let n=[t.id];for(let r of t.children)n.push(...e(r));return n}(e))o.expandNode(t)}}),t.push({label:"Collapse all children",action:()=>{for(let t of function e(t){let n=[];for(let r of t.children)n.push(r.id),n.push(...e(r));return n}(e))o.collapseNode(t)}}),t.push({separator:!0})),t.push({label:"Copy path",action:()=>navigator.clipboard.writeText(e.path).catch(()=>{})}),t.push({label:"Copy value as JSON",action:()=>{let t=ry(e),n="string"==typeof t?t:JSON.stringify(t,null,2);navigator.clipboard.writeText(n).catch(()=>{})}}),e.parentId){t.push({separator:!0}),t.push({label:"Duplicate",action:()=>{let t=function(e,t){let n=e.nodesById.get(t);if(!n||!n.parentId||!e.nodesById.get(n.parentId))return e;let r=ry(n);return rv(e,n.parentId,e=>{let s=e.children.findIndex(e=>e.id===t),i="/"===e.path?"":e.path,o="array"===e.type?String(s+1):`${n.key}_copy`,a=new Map,l=rm(o,structuredClone(r),i,e.id,a),c=[...e.children];return c.splice(s+1,0,l),rx({...e,children:c})})}(i.tree,e.id);o.setTree(t)}});let n=["string","number","boolean","null","object","array"].filter(t=>t!==e.type).map(t=>({label:`Change to ${t}`,action:()=>{var n,r;let s,a=(n=i.tree,r=e.id,(s=n.nodesById.get(r))?rk(n,r,function(e,t){switch(t){case"string":if(null==e)return"";if("object"==typeof e)return JSON.stringify(e);return String(e);case"number":{let t=Number(e);return isNaN(t)?0:t}case"boolean":return!!e;case"null":return null;case"object":if(null!==e&&"object"==typeof e&&!Array.isArray(e))return e;if(Array.isArray(e)){let t={};return e.forEach((e,n)=>{t[String(n)]=e}),t}return{};case"array":if(Array.isArray(e))return e;if(null!==e&&"object"==typeof e)return Object.values(e);return null==e?[]:[e];default:return e}}(ry(s),t)):n);o.setTree(a)}}));t.push({separator:!0}),t.push(...n),t.push({separator:!0}),t.push({label:"Delete",action:()=>{let t=rw(i.tree,e.id);o.setTree(t)}})}return t},[i.tree,o]),b=(0,s.useCallback)(e=>{let t=m.findIndex(e=>e.id===i.selectedNodeId);switch(e.key){case"ArrowDown":{e.preventDefault();let n=m[t+1];n&&o.selectNode(n.id);break}case"ArrowUp":{e.preventDefault();let n=m[t-1];n&&o.selectNode(n.id);break}case"ArrowRight":{e.preventDefault();let n=t>=0?m[t]:null;n&&("object"===n.type||"array"===n.type)&&(i.expandedNodeIds.has(n.id)?n.children.length>0&&o.selectNode(n.children[0].id):o.expandNode(n.id));break}case"ArrowLeft":{e.preventDefault();let n=t>=0?m[t]:null;if(!n)break;("object"===n.type||"array"===n.type)&&i.expandedNodeIds.has(n.id)?o.collapseNode(n.id):n.parentId&&o.selectNode(n.parentId);break}case"Delete":case"Backspace":{e.preventDefault();let n=t>=0?m[t]:null;if(n&&n.parentId){let e=m[t+1]??m[t-1],r=rw(i.tree,n.id);o.setTree(r),e&&e.id!==n.id&&o.selectNode(e.id)}}}},[m,i.selectedNodeId,i.expandedNodeIds,i.tree,o]),[v,x]=(0,s.use
25State)(!1);return(0,s.useEffect)(()=>{if(i.selectedNodeId&&a.current){let e=a.current.querySelector(`[data-node-id="${i.selectedNodeId}"]`);e&&e.scrollIntoView({block:"nearest"})}},[i.selectedNodeId]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{ref:a,className:e,role:"tree",tabIndex:0,onKeyDown:b,onFocus:()=>x(!0),onBlur:()=>x(!1),style:{overflow:"auto",backgroundColor:"var(--vj-bg, #1e1e1e)",color:"var(--vj-text, #cccccc)",fontFamily:"var(--vj-font, monospace)",fontSize:13,outline:"none",flex:1},children:(0,r.jsx)(rB,{node:i.tree.root,depth:0,dragState:l,showValues:t,showCounts:n,isFocused:v,onDragStart:c,onDragOver:u,onDragEnd:d,onDrop:f,onContextMenu:g})}),p&&(0,r.jsx)(rT,{x:p.x,y:p.y,items:y(p.node),onClose:()=>h(null)})]})}function rz({className:e}){let{state:t,actions:n}=rL(),i=t.selectedNodeId?t.tree.nodesById.get(t.selectedNodeId):null,o=i?.path??"/",[a,l]=(0,s.useState)(o),[c,u]=(0,s.useState)(!1),[d,f]=(0,s.useState)(0),p=(0,s.useRef)(null),h=(0,s.useRef)(null),m=(0,s.useRef)(null);(0,s.useEffect)(()=>{l(o)},[o]);let g=(0,s.useMemo)(()=>{if(!c)return[];let e=a.toLowerCase(),n=[];for(let[r,s]of t.tree.nodesById)if(s.path.toLowerCase().startsWith(e)&&n.push({id:r,path:s.path}),n.length>=20)break;return n.sort((e,t)=>e.path.localeCompare(t.path)),n},[c,a,t.tree.nodesById]);(0,s.useEffect)(()=>{f(0)},[g]);let y=(0,s.useCallback)(e=>{for(let[r,s]of t.tree.nodesById)if(s.path===e){n.selectNode(r);break}u(!1),p.current?.blur()},[t.tree.nodesById,n]),b=(0,s.useCallback)(e=>{if(!c){("ArrowDown"===e.key||"Enter"===e.key)&&(u(!0),e.preventDefault());return}switch(e.key){case"ArrowDown":e.preventDefault(),f(e=>Math.min(e+1,g.length-1));break;case"ArrowUp":e.preventDefault(),f(e=>Math.max(e-1,0));break;case"Enter":e.preventDefault(),g.length>0&&d<g.length?y(g[d].path):y(a.trim()||"/");break;case"Escape":e.preventDefault(),l(o),u(!1),p.current?.blur()}},[c,g,d,a,o,y]);return(0,s.useEffect)(()=>{let e=h.current;if(!e||!c)return;let t=e.children[d];t?.scrollIntoView({block:"nearest"})},[d,c]),(0,s.useEffect)(()=>{function e(e){m.current&&!m.current.contains(e.target)&&(l(o),u(!1))}return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[o]),(0,r.jsxs)("div",{ref:m,className:e,style:{position:"relative",flex:1,minWidth:0},children:[(0,r.jsx)("input",{ref:p,value:a,onChange:e=>{l(e.target.value),c||u(!0)},onFocus:e=>{e.target.select(),u(!0)},onKeyDown:b,spellCheck:!1,autoComplete:"off",style:{width:"100%",boxSizing:"border-box",padding:"2px 0",fontSize:"var(--vj-input-font-size, 13px)",fontFamily:"var(--vj-font, monospace)",color:"var(--vj-text-muted, #999999)",background:"transparent",border:"none",outline:"none"}}),c&&g.length>0&&(0,r.jsx)("div",{ref:h,style:{position:"absolute",top:"100%",left:-12,right:-12,zIndex:50,maxHeight:200,overflowY:"auto",backgroundColor:"var(--vj-bg-panel, #252526)",border:"1px solid var(--vj-border, #333333)",boxShadow:"0 4px 12px rgba(0,0,0,0.3)"},children:g.map((e,t)=>(0,r.jsx)("div",{onMouseDown:t=>{t.preventDefault(),y(e.path)},onMouseEnter:()=>f(t),style:{padding:"4px 12px",fontSize:13,fontFamily:"var(--vj-font, monospace)",color:t===d?"var(--vj-text, #cccccc)":"var(--vj-text-muted, #888888)",backgroundColor:t===d?"var(--vj-bg-hover, #2a2d2e)":"transparent",cursor:"pointer",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e.path},e.id))})]})}function r_({enumValues:e,value:t,onValueChange:n,inputRef:i,inputStyle:o}){let[a,l]=(0,s.useState)(t),[c,u]=(0,s.useState)(!1),[d,f]=(0,s.useState)(0),p=(0,s.useRef)(null),h=(0,s.useRef)(null);(0,s.useEffect)(()=>
25{l(t)},[t]);let m=(0,s.useMemo)(()=>e.map(e=>String(e)),[e]);(0,s.useEffect)(()=>{f(0)},[m]);let g=(0,s.useCallback)(e=>{n(e),l(e),u(!1)},[n]),y=(0,s.useCallback)(e=>{if(!c){("ArrowDown"===e.key||"ArrowUp"===e.key)&&(e.preventDefault(),e.stopPropagation(),u(!0));return}switch(e.key){case"ArrowDown":e.preventDefault(),e.stopPropagation(),f(e=>Math.min(e+1,m.length-1));break;case"ArrowUp":e.preventDefault(),e.stopPropagation(),f(e=>Math.max(e-1,0));break;case"Enter":e.preventDefault(),e.stopPropagation(),m.length>0&&d<m.length&&g(m[d]);break;case"Escape":e.preventDefault(),e.stopPropagation(),l(t),u(!1);break;case"Tab":l(t),u(!1)}},[c,m,d,t,g]);return(0,s.useEffect)(()=>{let e=p.current;if(!e||!c)return;let t=e.children[d];t?.scrollIntoView({block:"nearest"})},[d,c]),(0,s.useEffect)(()=>{function e(e){h.current&&!h.current.contains(e.target)&&(l(t),u(!1))}return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[t]),(0,r.jsxs)("div",{ref:h,style:{position:"relative",flex:1,minWidth:0},children:[(0,r.jsx)("input",{ref:i,value:a,onChange:e=>{l(e.target.value),c||u(!0)},onFocus:()=>u(!0),onKeyDown:y,onClick:e=>e.stopPropagation(),spellCheck:!1,autoComplete:"off",style:o}),c&&m.length>0&&(0,r.jsx)("div",{ref:p,style:{position:"absolute",top:"calc(100% + 4px)",left:-32,right:0,zIndex:50,maxHeight:200,overflowY:"auto",backgroundColor:"var(--vj-bg-panel, #252526)",border:"1px solid var(--vj-border, #333333)",boxShadow:"0 4px 12px rgba(0,0,0,0.3)"},children:m.map((e,n)=>(0,r.jsxs)("div",{onMouseDown:t=>{t.preventDefault(),g(e)},onMouseEnter:()=>f(n),style:{padding:"4px 12px",fontSize:13,fontFamily:"var(--vj-font, monospace)",display:"flex",alignItems:"center",gap:6,color:n===d?"var(--vj-text, #cccccc)":"var(--vj-text-muted, #888888)",backgroundColor:n===d?"var(--vj-bg-hover, #2a2d2e)":"transparent",cursor:"pointer",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:[(0,r.jsx)("span",{style:{width:14,flexShrink:0,fontSize:12},children:e===t?"â":""}),e]},e))})]})}function rF(e,t,n){if(!e)return;let r=rN(e,n,t);if(r)return rS(r,t??e)}function rK({node:e,schema:t,rootSchema:n,depth:i,showDescriptions:o,showCounts:a,formSelectedNodeId:l,editingNodeId:c,collapsedIds:u,maxKeyLength:d,maxDepth:f,isFocused:p,dragState:h,onSelect:m,onToggleCollapse:g,onStartEditing:y,onDragStart:b,onDragOver:v,onDragEnd:x,onDrop:k}){var w,j,S,N,E,C;let I,L,{state:O,actions:T}=rL(),A="object"===e.type||"array"===e.type,$=u.has(e.id),M=l===e.id,D=c===e.id,P=rF(t,n,e.path),B=function(e,t,n){if(!t||!e.parentId)return!1;let r=rF(t,n,e.path.split("/").slice(0,-1).join("/")||"/");return r?.required?.includes(e.key)??!1}(e,t,n),[R,z]=(0,s.useState)(!1),_=null===e.parentId,F=h.dropTargetNodeId===e.id,K=h.draggedNodeId===e.id;function q(t){t.preventDefault();let n=t.currentTarget.getBoundingClientRect(),r=n.top+n.height/2;v(e.id,t.clientY<r?"before":"after")}let U="none",W="none";F&&"before"===h.dropPosition?U="2px solid var(--vj-accent, #007acc)":F&&"after"===h.dropPosition&&(W="2px solid var(--vj-accent, #007acc)");let G=(0,s.useRef)(null),V=(0,s.useRef)(null);(0,s.useEffect)(()=>{D&&(A?V.current&&V.current.focus():null!==e.value&&void 0!==e.value&&""!==e.value&&G.current?G.current.focus():V.current&&V.current.focus())},[D,A,e.value]);let H=(0,s.useCallback)(t=>{let n;if(P?.type==="boolean"||"true"===t||"false"===t)n="true"===t;else if("null"===t)n=null;else if(P?.type==="number"||P?.type==="integer"||"number"===e.type){let e=Number(t);n=isNaN(e)?t:e}else n=t;let r=rk(O.tree,e.id,n);T.setTree(r)},[O.tree,e.id,e.type,T,P]),J=(0,s.useCallback)(t=>{let n=function(e,t,n){let r=e.nodesById.get(t);if(!r||!r.parentId)return e;let s=e.nodesById.get(r.parentId);return s&&"object"===s.type?rv(e,t,e=>{let t="/"===s.path?"":s.path,r=`${t}/${n}`,i={...e,key:n,path:r};return i.children.length>0&&(i.children=i.children.map(e=>rb(e,r))),i}):e}(O.tree,e.id,t);T.setTree(n)},[O.tree,e.id,T]),Y=(0,s.useCallback)(()=>{let t=rw(O.tree,e.id);T.setTree(t)},[O.tree,e.id,T]),Q=(0,s.useCallback)(()=>{var t,n;let r="array"===e.type?String(e.children.length):`newKey${e.children.length}`,s=(t=O.tree,n=e.id,t.nodesById.get(n)?rv(t,n,e=>
25{let t="/"===e.path?"":e.path,n=new Map,s=rm(r,"",t,e.id,n);return{...e,children:[...e.children,s]}}):t);T.setTree(s)},[O.tree,e.id,e.type,e.children.length,T]),X=P?.description;P?.default;let Z=P?.deprecated,ee=P?.title,et=e.parentId&&O.tree.nodesById.get(e.parentId)?.type==="object",en=M?p?"var(--vj-bg-selected, #2a5a1e)":"var(--vj-bg-selected-muted, var(--vj-bg-hover, #2a2d2e))":R?"var(--vj-bg-hover, #2a2d2e)":"transparent",er=M&&p?"var(--vj-text-selected, var(--vj-text, #cccccc))":"var(--vj-text, #cccccc)";if(A)return(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{"data-form-node-id":e.id,draggable:!_,onDragStart:t=>{t.dataTransfer.effectAllowed="move",b(e.id)},onDragOver:q,onDragEnd:x,onDrop:e=>{e.preventDefault(),k()},style:{display:"flex",alignItems:"center",gap:6,padding:"3px 8px",paddingLeft:8+16*i,cursor:"pointer",backgroundColor:en,color:er,height:28,userSelect:"none",opacity:Z?.5:K?.4:1,borderTop:U,borderBottom:W},onClick:t=>{t.stopPropagation(),m(e.id)},onDoubleClick:()=>g(e.id),onMouseEnter:()=>z(!0),onMouseLeave:()=>z(!1),children:[(0,r.jsx)("button",{onClick:t=>{t.stopPropagation(),g(e.id)},style:{background:"none",border:"none",color:"inherit",cursor:"pointer",padding:0,width:16,fontSize:9,flexShrink:0,display:"inline-flex",alignItems:"center",justifyContent:"center",transition:"transform 0.15s",transform:$?"rotate(0deg)":"rotate(90deg)"},children:"â¶"}),D&&!_?(0,r.jsx)("input",{ref:V,value:e.key,onChange:e=>J(e.target.value),onClick:e=>e.stopPropagation(),style:{background:"none",border:"none",color:"inherit",fontFamily:"var(--vj-font, monospace)",fontSize:"var(--vj-input-font-size, 13px)",fontWeight:500,padding:0,outline:"none",flexShrink:0,width:`calc(${(f-i)*16}px + ${d}ch)`}}):(0,r.jsx)("span",{style:{color:_||et||M?"inherit":"var(--vj-text-muted, #888888)",fontSize:13,fontFamily:"var(--vj-font, monospace)",fontWeight:500,flexShrink:0,display:"inline-block",width:`calc(${(f-i)*16}px + ${d}ch)`},children:_?"/":r$(e,O.tree)}),o&&ee&&!M&&(0,r.jsx)("span",{style:{color:"var(--vj-text-muted, #888888)",fontSize:11,fontFamily:"var(--vj-font, monospace)"},children:ee}),R&&(0,r.jsxs)("button",{onClick:e=>{e.stopPropagation(),Q()},style:{background:"none",border:"none",color:M?"inherit":"var(--vj-text-muted, #888888)",cursor:"pointer",padding:0,fontSize:12,fontFamily:"var(--vj-font, monospace)"},children:["+ Add ","array"===e.type?"item":"property"]}),a&&(0,r.jsx)("span",{style:{color:M?"inherit":"var(--vj-text-dim, #666666)",fontSize:12,fontFamily:"var(--vj-font, monospace)",marginLeft:"auto"},children:"array"===e.type?`${e.children.length} items`:`${e.children.length} properties`}),!_&&D&&(0,r.jsx)("button",{onClick:e=>{e.stopPropagation(),Y()},style:{background:"none",border:"none",color:M?"inherit":"var(--vj-text-muted, #888888)",cursor:"pointer",padding:"2px 4px",fontSize:14,fontFamily:"var(--vj-font, monospace)",...!a?{marginLeft:"auto"}:{}},title:"Remove",children:"Ã"})]}),o&&X&&(0,r.jsx)("div",{style:{padding:"2px 12px 4px",paddingLeft:8+16*i+22,fontSize:11,color:"var(--vj-text-dim, #666666)",fontFamily:"var(--vj-font, monospace)"},children:X}),!$&&(0,r.jsx)("div",{children:e.children.map(e=>(0,r.jsx)(rK,{node:e,schema:t,rootSchema:n,depth:i+1,showDescriptions:o,showCounts:a,formSelectedNodeId:l,editingNodeId:c,collapsedIds:u,maxKeyLength:d,maxDepth:f,isFocused:p,dragState:h,onSelect:m,onToggleCollapse:g,onStartEditing:y,onDragStart:b,onDragOver:v,onDragEnd:x,onDrop:k},e.id))})]});let es="null"===e.type?"null":"boolean"===e.type?String(e.value):null===e.value||void 0===e.value?"":String(e.value),ei="boolean"===e.type||"null"===e.type?"var(--vj-boolean, #569cd6)":"number"===e.type?"var(--vj-number, #b5cea8)":"var(--vj-string, #ce9178)";return(0,r.jsxs)("div",{"data-form-node-id":e.id,draggable:!_,onDragStart:t=>{t.dataTransfer.effectAllowed="move",b(e.id)},onDragOver:q,onDragEnd:x,onDrop:e=>{e.preventDefault(),k()},style:{display:"flex",alignItems:"center",gap:6,padding:"3px 8px",paddingLeft:8+16*i,cursor:"pointer",backgroundColor:en,color:er,height:28,userSelect:"none",opacity:Z?.5:K?.4:1,borderTop:U,borderBottom:W},onClick:t=>{t.stopPropagation(),m(e.id)},onDoubleClick:()=>y(e.id),onMouseEnter:()=>z(!0),onMouseLeave:()=>z(!1),children:[(0,r.jsx)("span",{style:{width:16,flexShrink:0}}),D&&et?(0,r.jsx)("input",{ref:V,value:e.key,onChange:e=>J(e.target.value),onClick:e=>e.stopPropagation(),onKeyDown:e=>{"Tab"===e.key&&!e.shiftKey&&G.current&&(e.preventDefault(),G.current.focus())},style:{background:"none",border:"none",color:"inherit",fontFamily:"var(--vj-font, monospace)",fontSize:"var(--vj-input-font-size, 13px)",padding:0,flexShrink:0,outline:"none",width:`calc(${(f-i)*16}px + ${d}ch)`}}):(0,r.jsx)("span",{style:{color:et||M?"inherit":"var(--vj-text-muted, #888888)",fontSize:13,fontFamily:"var(--vj-font, monospace)",flexShrink:0,display:"inline-block",width:`calc(${(f-i)*16}px + ${d}ch)`},children:r$(e,O.tree)}),B&&!M&&(0,r.jsx)("span",{style:{color:"var(--vj-error, #f48771)",fontSize:10,fontFamily:"var(--vj-font, monospace)"},children:"*"}),D?(0,r.jsx)("div",{style:{flex:1,display:"flex",alignItems:"center",gap:6,minWidth:0},children:(w=e,j=P,S=es,N=H,E=G,C=ei,I=j?.enum&&j.enum.length>0,L={background:"none",border:"none",fontFamily:"var(--vj-font, monospace)",fontSize:"var(--vj-input-font-size, 13px)",padding:0,flex:1,outline:"none",color:C},"boolean"===w.type?(0,r.jsx)(r_,{enumValues:["true","false"],value:String(w.value),onValueChange:N,inputRef:E,inputStyle:L}):I&&j?.enum?(0,r.jsx)(r_,{enumValues:j.enum,value:S,onValueChange:N,inputRef:E,inputStyle:L}):"null"===w.type?(0,r.jsx)("span",{style:{color:"var(--vj-boolean, #569cd6)",fontFamily:"var(--vj-font, monospace)",fontSize:13,fontStyle:"italic",flex:1},children:"null"}):(0,r.jsx)("input",{ref:E,value:S,onChange:e=>N(e.target.value),onClick:e=>e.stopPropagation(),placeholder:j?.default!==void 0?String(j.default):"<value>",style:L}))}):(0,r.jsx)("span",{style:{color:ei,fontSize:13,fontFamily:"var(--vj-font, monospace)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontStyle:"null"===e.type?"italic":void 0},children:es}),D&&(0,r.jsx)("button",{onClick:e=>{e.stopPropagation(),Y()},style:{background:"none",border:"none",color:M?"inherit":"var(--vj-text-muted, #888888)",cursor:"pointer",padding:"2px 4px",fontSize:14,fontFamily:"var(--vj-font, monospace)",flexShrink:0},title:"Remove",children:"Ã"})]})}function rq({className:e,showDescriptions:t=!1,showCounts:n=!1}){let{state:i,actions:o}=rL(),a=i.schema??void 0,l=(i.selectedNodeId?i.tree.nodesById.get(i.selectedNodeId):null)??i.tree.root,[c,u]=(0,s.use
25State)(null),[d,f]=(0,s.useState)(null),p=(0,s.useRef)(null),[h,m]=(0,s.useState)(()=>new Set),g=(0,s.useRef)(null),[y,b]=(0,s.useState)(!1),{dragState:v,handleDragStart:x,handleDragOver:k,handleDragEnd:w,handleDrop:j}=rP();(0,s.useEffect)(()=>{u(null),f(null),m(new Set)},[l.id]);let S=(0,s.useMemo)(()=>rM(l,e=>!h.has(e)),[l,h]),{maxKeyLength:N,maxDepth:E}=(0,s.useMemo)(()=>{let e=1,t=0,n="/"===l.path?0:l.path.split("/").filter(Boolean).length;for(let r of S){let s=null===r.parentId?"/":r$(r,i.tree);s.length>e&&(e=s.length);let o=("/"===r.path?0:r.path.split("/").filter(Boolean).length)-n;o>t&&(t=o)}return{maxKeyLength:e,maxDepth:t}},[S,l.path,i.tree]),C=(0,s.useCallback)(e=>{u(e),f(null)},[]),I=(0,s.useCallback)(e=>{m(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),L=(0,s.useCallback)(e=>{p.current=i.tree,f(e)},[i.tree]),O=(0,s.useCallback)(e=>{requestAnimationFrame(()=>{let t=g.current?.querySelector(`[data-form-node-id="${e}"]`);t?.scrollIntoView({block:"nearest"})})},[]),T=(0,s.useCallback)(e=>{if(d)return void("Escape"===e.key?(e.preventDefault(),e.stopPropagation(),p.current&&(o.setTree(p.current),p.current=null),f(null),g.current?.focus()):"Enter"===e.key&&(e.preventDefault(),e.stopPropagation(),p.current=null,f(null),g.current?.focus()));let t=S.findIndex(e=>e.id===c);switch(e.key){case"ArrowDown":{e.preventDefault();let n=S[t+1];n&&(u(n.id),O(n.id));break}case"ArrowUp":{e.preventDefault();let n=S[t-1];n&&(u(n.id),O(n.id));break}case"ArrowRight":{e.preventDefault();let n=t>=0?S[t]:null;n&&("object"===n.type||"array"===n.type)&&(h.has(n.id)?m(e=>{let t=new Set(e);return t.delete(n.id),t}):n.children.length>0&&(u(n.children[0].id),O(n.children[0].id)));break}case"ArrowLeft":{e.preventDefault();let n=t>=0?S[t]:null;if(!n)break;if("object"!==n.type&&"array"!==n.type||h.has(n.id)){if(n.parentId){let e=S.find(e=>e.id===n.parentId);e&&(u(e.id),O(e.id))}}else m(e=>{let t=new Set(e);return t.add(n.id),t});break}case"Enter":e.preventDefault(),c&&(p.current=i.tree,f(c));break;case"Escape":e.preventDefault(),f(null);break;case"Delete":case"Backspace":{e.preventDefault();let n=t>=0?S[t]:null;if(n&&n.parentId){let e=S[t+1]??S[t-1],r=rw(i.tree,n.id);o.setTree(r),e&&e.id!==n.id?u(e.id):u(null)}}}},[S,c,d,h,O,i.tree,o]);return(0,r.jsxs)("div",{className:e,style:{backgroundColor:"var(--vj-bg, #1e1e1e)",color:"var(--vj-text, #cccccc)",height:"100%",fontFamily:"var(--vj-font, monospace)",display:"flex",flexDirection:"column"},children:[(0,r.jsx)("div",{style:{padding:"4px 8px",borderBottom:"1px solid var(--vj-border, #333333)",backgroundColor:"var(--vj-bg-panel, #252526)",flexShrink:0},children:(0,r.jsx)(rz,{})}),(0,r.jsx)("div",{ref:g,"data-form-container":!0,tabIndex:0,onKeyDown:T,onFocus:()=>b(!0),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||b(!1)},style:{flex:1,overflow:"auto",outline:"none"},children:(0,r.jsx)(rK,{node:l,schema:i.schema,rootSchema:a,depth:0,showDescriptions:t,showCounts:n,formSelectedNodeId:c,editingNodeId:d,collapsedIds:h,maxKeyLength:N,maxDepth:E,isFocused:y,dragState:v,onSelect:C,onToggleCollapse:I,onStartEditing:L,onDragStart:x,onDragOver:k,onDragEnd:w,onDrop:j})})]})}function rU({className:e}){let{state:t,actions:n}=rL(),i=(0,s.useRef)(null),o=(0,s.useCallback)(e=>{"Enter"===e.key&&(e.preventDefault(),e.shiftKey?n.prevSearchMatch():n.nextSearchMatch()),"Escape"===e.key&&(e.preventDefault(),n.setSearchQuery(""),i.current?.blur())},[n]);(0,s.useEffect)(()=>{function e(e){(e.metaKey||e.ctrlKey)&&"f"===e.key&&(e.preventDefault(),i.current?.focus(),i.current?.select())}return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[]);let a=t.searchMatches.length,l=a>0?t.searchMatchIndex+1:0;return(0,r.jsxs)("div",{className:e,style:{display:"flex",alignItems:"center",gap:6,padding:"4px 8px",backgroundColor:"var(--vj-bg-panel, #252526)",borderBottom:"1px solid var(--vj-border, #333333)"},children:[(0,r.jsx)("input",{ref:i,type:"text",value:t.searchQuery,onChange:e=>n.setSearchQuery(e.target.value),onKeyDown:o,placeholder:"Search...",style:{flex:1,background:"none",border:"none",borderRadius:3,color:"var(--vj-text, #cccccc)",fontFamily:"var(--vj-font, monospace)",fontSize:"var(--vj-input-font-size, 13px)",padding:"3px 8px",outline:"none",minWidth:0}}),(0,r.jsx)("div",{style:{display:"flex",alignItems:"center",gap:2,flexShrink:0,height:18},children:t.searchQuery?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{style:{fontSize:11,lineHeight:1,color:a>0?"var(--vj-text-muted, #999999)":"var(--vj-error, #f48771)",fontFamily:"var(--vj-font, monospace)",whiteSpace:"nowrap"},children:a>0?`${l}/${a}`:"0/0"}),(0,r.jsx)("button",{onClick:n.prevSearchMatch,disabled:0===a,"aria-label":"Previous match (Shift+Enter)",style:{background:"none",border:"none",color:a>0?"var(--vj-text, #cccccc)":"var(--vj-text-dimmer, #555555)",cursor:a>0?"pointer":"default",padding:0,fontSize:10,lineHeight:1,display:"inline-flex",alignItems:"center",justifyContent:"center",width:18,height:18},title:"Previous match (Shift+Enter)",children:"â²"}),(0,r.jsx)("button",{onClick:n.nextSearchMatch,disabled:0===a,"aria-label":"Next match (Enter)",style:{background:"none",border:"none",color:a>0?"var(--vj-text, #cccccc)":"var(--vj-text-dimmer, #555555)",cursor:a>0?"pointer":"default",padding:0,fontSize:10,lineHeight:1,display:"inline-flex",alignItems:"center",justifyContent:"center",width:18,height:18},title:"Next match (Enter)",children:"â¼"}),(0,r.jsx)("button",{onClick:()=>n.setSearchQuery(""),"aria-label":"Clear search (Esc)",style:{background:"none",border:"none",color:"var(--vj-text, #cccccc)",cursor:"pointer",padding:0,fontSize:14,lineHeight:1,display:"inline-flex",alignItems:"center",justifyContent:"center",width:18,height:18},title:"Clear search (Esc)",children:"Ã"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{onClick:n.expandAll,"aria-label":"Expand all",style:{background:"none",border:"none",color:"var(--vj-text-muted, #888888)",cursor:"pointer",padding:"2px",fontSize:12,lineHeight:1,display:"inline-flex",alignItems:"center"},title:"Expand all",children:(0,r.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("path",{d:"M8 2v4M5 4l3-2 3 2"}),(0,r.jsx)("path",{d:"M8 14v-4M5 12l3 2 3-2"}),(0,r.jsx)("path",{d:"M2 8h12"})]})}),(0,r.jsx)("button",{onClick:n.collapseAll,"aria-label":"Collapse all",style:{background:"none",border:"none",color:"var(--vj-text-muted, #888888)",cursor:"pointer",padding:"2px",fontSize:12,lineHeight:1,display:"inline-flex",alignItems:"center"},title:"Collapse all",children:(0,r.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("path",{d:"M8 5V1M5 3l3 2 3-2"}),(0,r.jsx)("path",{d:"M8 11v4M5 13l3-2 3 2"}),(0,r.jsx)("path",{d:"M2 8h12"})]})})]})})]})}var rW={"--vj-bg":"#1e1e1e","--vj-bg-panel":"#252526","--vj-bg-hover":"#2a2d2e","--vj-bg-selected":"#2a5a1e","--vj-bg-selected-muted":"#2a2d2e","--vj-bg-match":"#3a3520","--vj-bg-match-active":"#51502b","--vj-border":"#333333","--vj-border-subtle":"#2a2a2a","--vj-text":"#cccccc","--vj-text-muted":"#888888","--vj-text-dim":"#666666","--vj-text-dimmer"
25:"#555555","--vj-string":"#ce9178","--vj-number":"#b5cea8","--vj-boolean":"#569cd6","--vj-accent":"#007acc","--vj-accent-muted":"#094771","--vj-input-bg":"#3c3c3c","--vj-input-border":"#555555","--vj-error":"#f48771","--vj-font":"monospace","--vj-input-font-size":"13px"};function rG({value:e,defaultValue:t,onChange:n,schema:i,height:o="100%",width:a="100%",className:l,style:c,readOnly:u,treeShowValues:d=!0,treeShowCounts:f=!1,editorShowDescriptions:p=!1,editorShowCounts:h=!1,sidebarOpen:m=!0}){let g=void 0!==e,[y,b]=(0,s.useState)(0),v=(0,s.useRef)(g?e:t??{});(0,s.useEffect)(()=>{g&&e!==v.current&&(v.current=e,b(e=>e+1))},[e,g]);let x=(0,s.useCallback)(e=>{v.current=e,u||n?.(e)},[n,u]),k={height:"number"==typeof o?`${o}px`:o,width:"number"==typeof a?`${a}px`:a,display:"flex",flexDirection:"column",overflow:"hidden",...rW,...c};return(0,r.jsxs)("div",{className:l,"data-vj-root":"",style:k,children:[(0,r.jsx)("style",{dangerouslySetInnerHTML:{__html:"@media(pointer:coarse){[data-vj-root]{--vj-input-font-size:16px}}"}}),(0,r.jsx)(rO,{value:v.current,onChange:u?void 0:x,schema:i,children:(0,r.jsx)(rV,{treeShowValues:d,treeShowCounts:f,editorShowDescriptions:p,editorShowCounts:h,sidebarOpen:m})},y)]})}function rV({treeShowValues:e,treeShowCounts:t,editorShowDescriptions:n,editorShowCounts:i,sidebarOpen:o}){let[a,l]=(0,s.useState)(280),[c,u]=(0,s.useState)(!1),[d,f]=(0,s.useState)("tree"),p=(0,s.useRef)(null),h=(0,s.useRef)(!1),m=(0,s.useRef)(0),g=(0,s.useRef)(0);(0,s.useEffect)(()=>{function e(){p.current&&u(p.current.offsetWidth<500)}e();let t=new ResizeObserver(e);return p.current&&t.observe(p.current),()=>t.disconnect()},[]);let y=(0,s.useCallback)(e=>{h.current=!0,m.current=e.clientX,g.current=a,document.body.style.cursor="col-resize",document.body.style.userSelect="none";let t=e=>{if(!h.current)return;let t=e.clientX-m.current;l(Math.max(180,Math.min(600,g.current+t)))},n=()=>{h.current=!1,document.body.style.cursor="",document.body.style.userSelect="",document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",n)};document.addEventListener("mousemove",t),document.addEventListener("mouseup",n)},[a]);return c?o?(0,r.jsxs)("div",{ref:p,style:{display:"flex",flexDirection:"column",flex:1,minHeight:0},children:[(0,r.jsxs)("div",{style:{display:"flex",flexShrink:0,borderBottom:"1px solid var(--vj-border, #333333)",backgroundColor:"var(--vj-bg-panel, #252526)"},children:[(0,r.jsx)("button",{onClick:()=>f("tree"),style:{flex:1,fontSize:11,padding:"4px 0",cursor:"pointer",fontFamily:"var(--vj-font, monospace)",border:"none",background:"tree"===d?"var(--vj-accent-muted, #094771)":"transparent",color:"tree"===d?"var(--vj-text, #cccccc)":"var(--vj-text-muted, #999999)"},children:"Tree"}),(0,r.jsx)("button",{onClick:()=>f("form"),style:{flex:1,fontSize:11,padding:"4px 0",cursor:"pointer",fontFamily:"var(--vj-font, monospace)",border:"none",background:"form"===d?"var(--vj-accent-muted, #094771)":"transparent",color:"form"===d?"var(--vj-text, #cccccc)":"var(--vj-text-muted, #999999)"},children:"Form"})]}),(0,r.jsx)("div",{style:{flex:1,minHeight:0,overflow:"hidden"},children:"tree"===d?(0,r.jsxs)("div",{style:{display:"flex",flexDirection:"column",height:"100%"},children:[(0,r.jsx)(rU,{}),(0,r.jsx)("div",{style:{flex:1,minHeight:0,overflow:"auto"},children:(0,r.jsx)(rR,{showValues:e,showCounts:t})})]}):(0,r.jsx)("div",{style:{display:"flex",flexDirection:"column",height:"100%"},children:(0,r.jsx)("div",{style:{flex:1,minHeight:0},children:(0,r.jsx)(rq,{showDescriptions:n,showCounts:i})})})})]}):(0,r.jsx)("div",{ref:p,style:{display:"flex",flexDirection:"column",flex:1,minHeight:0},children:(0,r.jsx)("div",{style:{flex:1,minHeight:0},children:(0,r.jsx)(rq,{showDescriptions:n,showCounts:i})})}):(0,r.jsxs)("div",{ref:p,style:{display:"flex",flex:1,minHeight:0},children:[(0,r.jsxs)("div",{style:{flexShrink:0,overflow:"hidden",display:"flex",flexDirection:"column",width:o?a:0,transition:"width 0.2s ease"},children:[(0,r.jsx)(rU,{}),(0,r.jsx)("div",{style:{flex:1,minHeight:0,overflow:"auto"},children:(0,r.jsx)(rR,{showValues:e,showCounts:t})})]}),o&&(0,r.jsx)("div",{style:{width:1,flexShrink:0,backgroundColor:"var(--vj-border, #333333)",position:"relative",transition:"background-color 0.15s"},children:(0,r.jsx)("div",{onMouseDown:y,onMouseEnter:e=>{let t=e.currentTarget.parentElement;t&&(t.style.backgroundColor="var(--vj-accent, #007acc)")},onMouseLeave:e=>{if(!h.current){let t=e.currentTarget.parentElement;t&&(t.style.backgroundColor="var(--vj-border, #333333)")}},style:{position:"absolute",top:0,bottom:0,left:-3,width:7,cursor:"col-resize",zIndex:10}})}),(0,r.jsx)("div",{style:{display:"flex",flexDirection:"column",flex:1,minWidth:0,overflow:"hidden"},children:(0,r.jsx)("div",{style:{flex:1,minHeight:0},children:(0,r.jsx)(rq,{showDescriptions:n,showCounts:i})})})]})}var rH=e.i(828319),rJ=e.i(290947),rY=e.i(567969);function rQ(e){return e>=1e3?`${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:String(e)}
25function rX({model:e,onChange:t,disabled:n}){return(0,r.jsx)(ru.TooltipProvider,{delayDuration:200,children:(0,r.jsxs)("div",{role:"group","aria-label":"Model",className:"flex shrink-0 items-center rounded border border-border text-[10px] font-mono overflow-hidden",children:[(0,r.jsx)("button",{type:"button","aria-label":"Default model","aria-pressed":"default"===e,disabled:n,onClick:()=>t("default"),className:`px-1.5 py-0.5 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset disabled:opacity-50 ${"default"===e?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,children:"default"}),(0,r.jsxs)(ru.Tooltip,{children:[(0,r.jsx)(ru.TooltipTrigger,{asChild:!0,children:(0,r.jsxs)("button",{type:"button","aria-label":"Jev (experimental)","aria-pressed":"typesafe-ai/jev"===e,disabled:n,onClick:()=>t("typesafe-ai/jev"),className:`flex items-center gap-1 px-1.5 py-0.5 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset disabled:opacity-50 ${"typesafe-ai/jev"===e?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,children:["jev",(0,r.jsx)(rc.InfoIcon,{className:"size-2.5","aria-hidden":"true"})]})}),(0,r.jsxs)(ru.TooltipContent,{side:"top",align:"start",sideOffset:6,className:"max-w-64 space-y-1",children:[(0,r.jsx)("p",{className:"font-medium",children:"Experimental"}),(0,r.jsx)("p",{children:"Jev composes and edits UI from prepared fields, data, and actions. Results may be incomplete."})]})]})]})})}function rZ({version:e}){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"mt-1 ml-6 text-[10px] font-mono text-muted-foreground/60",children:["typesafe-ai/jev"===e.model?"Jev · Experimental":"Default model",e.composition&&` \xb7 ${(e.composition.elapsedMs/1e3).toFixed(2)} s \xb7 ${e.composition.calls} calls`,"partial"===e.status&&" · partial","unavailable"===e.status&&" · unavailable"]}),e.message&&(0,r.jsx)("p",{className:"mt-1 ml-6 text-xs text-muted-foreground",children:e.message})]})}function r0({model:e,setModel:t,disabled:n,format:s,setFormat:i,editModes:o,setEditModes:a,showClear:l,onClear:c}){return(0,r.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,r.jsx)(rX,{model:e,onCh
25ange:t,disabled:n}),"typesafe-ai/jev"!==e&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"flex shrink-0 items-center rounded border border-border text-[10px] font-mono overflow-hidden",children:["jsonl","yaml"].map(e=>(0,r.jsx)("button",{disabled:n,onClick:()=>i(e),className:`px-1.5 py-0.5 transition-colors ${s===e?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,children:e},e))}),(0,r.jsx)("div",{className:"flex shrink-0 items-center rounded border border-border text-[10px] font-mono overflow-hidden",children:["patch","merge","diff"].map(e=>(0,r.jsx)("button",{disabled:n,onClick:()=>{a(t=>t.includes(e)?t.length>1?t.filter(t=>t!==e):t:[...t,e])},className:`px-1.5 py-0.5 transition-colors ${o.includes(e)?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,children:e},e))})]}),l&&!n&&(0,r.jsx)("button",{onClick:c,className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:"Clear"})]})}let r1=["Create a login form","Build a pricing page","Design a user profile card","Make a contact form"],r2=[{label:"Create a login form",prompt:'Create a login card titled "Sign in" with email, password, remember me, and a sign in button.'},{label:"Create account settings",prompt:'Create an account settings card titled "Preferences" with full name, email, an email notifications switch, save and reset buttons side by side, and visible save status.'},{label:"Design a user profile card",prompt:"Design a user profile card"},{label:"Build a sales dashboard",prompt:'Build a sales dashboard: heading "Sales overview", revenue, orders and new customers metrics in a three-column grid, then a weekly revenue chart and an order-status table.'},{label:"Make a contact form",prompt:'Create a contact card titled "Contact us" with full name, email, topic, a message box, and a send message button.'}];e.s(["Playground",0,function(){let[e,t]=(0,s.useState)([]),[n,l]=(0,s.useState)(null),[c,u]=(0,s.useState)(""),[d,f]=(0,s.useState)("spec"),[p,h]=(0,s.use
25State)("components"),[m,g]=(0,s.useState)("preview"),[y,b]=(0,s.useState)("preview"),[v,x]=(0,s.useState)(!1),[k,w]=(0,s.useState)("jsonl"),[j,S]=(0,s.useState)("default"),N="typesafe-ai/jev"===j?"jsonl":k,E="typesafe-ai/jev"===j?r2:r1.map(e=>({label:e,prompt:e})),[C,I]=(0,s.useState)(["patch"]),L=(0,s.useRef)(null),O=(0,s.useRef)(null),T=(0,s.useRef)(null);(0,s.useEffect)(()=>{let e=L.current;e?.getClientRects().length&&e.focus({preventScroll:!0})},[]);let A=(0,s.useRef)(null),$=(0,s.useRef)(null),{spec:M,isStreaming:D,usage:P,composition:B,error:R,rawLines:z,send:_,clear:F,stop:K}=function({api:e,model:t="default",format:n,editModes:r,onError:i,onComplete:o}){let[a,l]=(0,s.useState)(null),[c,u]=(0,s.useState)(!1),[d,f]=(0,s.useState)(null),[p,h]=(0,s.useState)(null),[m,g]=(0,s.useState)(null),[y,b]=(0,s.useState)([]),v=(0,s.useRef)([]),x=(0,s.useRef)(null),k=(0,s.useRef)(o);k.current=o;let w=(0,s.useRef)(i);w.current=i;let j=(0,s.useRef)(t);j.current=t;let S=(0,s.useRef)(n);S.current=n;let N=(0,s.useRef)(r);N.current=r;let E=(0,s.useCallback)(()=>x.current?.abort(),[]),C=(0,s.useCallback)(()=>{x.current?.abort(),l(null),f(null),h(null),g(null),v.current=[],b([])},[]),I=(0,s.useCallback)(async(t,n)=>{if(x.current)return;let r=new AbortController;x.current=r;let s=j.current,i="typesafe-ai/jev"===s?"jsonl":S.current,o=!1;u(!0),f(null),h(null),g(null),v.current=[],b([]);let a=n?.previousSpec,c=a&&a.root?structuredClone(a):{root:"",elements:{}};l(c);try{let a=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:t,context:n,model:s,format:i,editModes:N.current}),signal:r.signal});if(!a.ok){let e=`HTTP error: ${a.status}`;try{let t=await a.json();t.message?e=t.message:t.error&&(e=t.error)}catch{}throw Error(e)}let u=a.body?.getReader();if(!u)throw Error("No response body");let d=new TextDecoder,f="";if("yaml"===i){let e="outside",t=function(){let e="",t={},n={...t},r=[];function s(){let s=[];try{let i=t6(e);if(i&&"object"==typeof i&&!Array.isArray(i)){let e=(0,ne.diffToPatches)(t,i);e.length>0&&(n={...t=structuredClone(i)},r.push(...e),s.push(...e))}}catch{}return{result:n,newPatches:s}}return{push:t=>(e+=t,t.includes("\n"))?s():{result:n,newPatches:[]},flush:()=>s(),getResult:()=>n,getPatches:()=>[...r],reset(s){e="",n={...t=s?{...s}:{}},r.length=0}}}(),n="",r="",s="";for(;;){let{done:i,value:o}=await u.read();if(i)break;let a=(f+=d.decode(o,{stream:!0})).split("\n");for(let i of(f=a.pop()??"",a)){let o=i.trim();if(o.startsWith("{")&&o.includes('"__meta"'))try{let e=JSON.parse(o);if("usage"===e.__meta){h({promptTokens:e.promptTokens??0,completionTokens:e.completionTokens??0,totalTokens:e.totalTokens??0,cachedTokens:e.cachedTokens??0,cacheWriteTokens:e.cacheWriteTokens??0});continue}}catch{}if(v.current.push(i),"outside"===e)o===nr||o.startsWith(nr+" ")?(e="yaml-spec",t.reset()):o===ns||o.startsWith(ns+" ")?(e="yaml-edit",n=""):o===ni||o.startsWith(ni+" ")?(e="yaml-patch",r=""):(o===no||o.startsWith(no+" "))&&(e="diff",s="");else if("```"===o||"````"===o){if("yaml-spec"===e){let{result:e,newPatches:n}=t.flush();if(e&&"object"==typeof e&&e.root){for(let e of n)c=nu(c,e);l({...c})}}else if("yaml-edit"===e)try{let e=t6(n);if(e&&"object"==typeof e){let t=(0,ne.deepMergeSpec)(c,e);for(let e of(0,ne.diffToPatches)(c,t))c=nu(c,e);l({...c})}}catch{}else if("yaml-patch"===e){for(let e of r.split("\n")){let t=e.trim();if(t)try{let e=JSON.parse(t);e.op&&(c=nu(c,e))}catch{}}l({...c})}else if("diff"===e)try{let e=t7(c,{indent:2}),t=nt(e,s);if("string"==typeof t){let e=t6(t);if(e&&"object"==typeof e){for(let t of(0,ne.diffToPatches)(c,e))c=nu(c,t);l({...c})}}}catch{}e="outside"}else if("yaml-spec"===e){let{newPatches:e}=t.push(i+"\n");if(e.length>0){for(let t of e)c=nu(c,t);l({...c})}}else"yaml-edit"===e?n+=i+"\n":"yaml-patch"===e?r+=i+"\n":"diff"===e&&(s+=i+"\n")}b([...v.current])}if(f.trim()){let n=f.trim();if(n.startsWith("{")&&n.includes('"__meta"'))try{let e=JSON.parse(n);"usage"===e.__meta&&h({promptTokens:e.promptTokens??0,completionTokens:e.completionTokens??0,totalTokens:e.totalTokens??0,cachedTokens:e.cachedTokens??0,cacheWriteTokens:e.cacheWriteTokens??0})}catch{}else if("yaml-spec"===e){t.push(f);let{result:e,newPatches:n}=t.flush();if(e&&"object"==typeof e&&e.root){for(let e of n)c=nu(c,e);l({...c})}}}}else{let e="outside",t="";for(;;){let{done:n,value:r}=await u.read();if(n)break;let s=(f+=d.decode(r,{stream:!0})).split("\n");for(let n of(f=s.pop()??"",s)){let r=n.trim();if(!r)continue;if("outside"===e){if(r===no||r.startsWith(no+" ")){e="diff",t="";continue}}else if("diff"===e&&("```"===r||"````"===r)){try{let e=JSON.stringify(c,null,2),n=nt(e,t);if("string"==typeof n){let e=JSON.parse(n);if(e&&"object"==typeof e){for(let t of(0,ne.diffToPatches)(c,e))c=nu(c,t);l({...c})}}}catch{}e="outside";continue}if("diff"===e){t+=n+"\n",v.current.push(n);continue}let s=nd(r);if(s)if("usage"===s.type)h(s.usage);else if("error"===s.type)throw Error(s.message);else if("composition"===s.type)o=!0,g(s.summary),v.current.push(r);else if("decision"===s.type)v.current.push(r);else if("json-edit"===s.type){let e=(0,ne.deepMergeSpec)(c,s.mergeObj);for(let t of(0,ne.diffToPatches)(c,e))c=nu(c,t);v.current.push(r),l({...c})}else v.current.push(r),c=nu(c,s.patch),l({...c})}b([...v.current])}if(f.trim()){let e=f.trim(),t=nd(e);if(t)if("usage"===t.type)h(t.usage);else if("error"===t.type)throw Error(t.message);else if("composition"===t.type)o=!0,g(t.summary),v.current.push(e);else if("decision"===t.type)v.current.push(e);else if("json-edit"===t.type){let n=(0,ne.deepMergeSpec)(c,t.mergeObj);for(let e of(0,ne.diffToPatches)(c,n))c=nu(c,e);v.current.push(e),l({...c})}else v.current.push(e),c=nu(c,t.patch),l({...c})}}if(b([...v.current]),"typesafe-ai/jev"===s&&!o)throw Error("Composition ended early. The preview is partial.");k.current?.(c)}catch(t){if(b([...v.current]),"AbortError"===t.name)return void f(Error("Stopped. The preview is partial."));r.abort();let e=t instanceof Error?t:Error(String(t));f(e),w.current?.(e)}finally{x.current=null,u(!1)}},[e]);return(0,s.useEffect)(()=>()=>{x.current?.abort()},[]),{spec:a,isStreaming:c,error:d,usage:p,composition:m,rawLines:y,send:I,clear:C,stop:E}}({api:"/api/generate",model:j,format:N,editModes:C,onError:e=>{console.error("Generation error:",e),a.toast.error(e.message||"Generation failed. Please try again.")}}),q=e.find(e=>e.id===n),U=n===A.current&&D,W=M&&M.root&&Object.keys(M.elements).length>0,G=U&&W?M:q?.tree??(U?M:null),V=U?z:q?.rawLines??[];$.current=G?.root?G:null,(0,s.useEffect)(()=>{let e=T.current?.parentElement;e?.scrollTo({top:e.scrollHeight,behavior:"smooth"})},[e]),(0,s.useEffect)(()=>
25{if(!D&&A.current){let e=A.current;t(t=>t.map(t=>t.id===e?{...t,tree:M,status:R?M?.root?"partial":"error":B?.stopReason==="limit"?"partial":B?.stopReason==="unavailable"?"unavailable":"complete",message:R?.message??(B?.stopReason==="limit"?"Composition limit reached. The preview is partial.":B?.stopReason==="unavailable"?"This request needs content or capabilities outside the prepared options.":void 0),composition:B,usage:P,rawLines:z}:t)),A.current=null}},[D,M,P,z,B,R]);let H=(0,s.useCallback)(async()=>{if(!c.trim()||D||A.current)return;let e=Date.now().toString(),n={id:e,prompt:c.trim(),tree:null,status:"generating",usage:null,rawLines:[],format:N,model:j,composition:null};A.current=e,t(e=>[...e,n]),l(e),u(""),await _(c.trim(),{previousSpec:$.current})},[c,D,_,N,j]),J=(0,s.useCallback)(e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),H())},[H]),Y=(0,s.useCallback)(e=>{n&&!D&&t(t=>t.map(t=>t.id===n?{...t,tree:e}:t))},[n,D]),Q=(0,s.useMemo)(()=>G?"yaml"===N?t7(G,{indent:2}).trimEnd():JSON.stringify(G,null,2):"yaml"===N?"# waiting...":"// waiting...",[G,N]),X="yaml"===N?"yaml":"json",Z=(0,s.useMemo)(()=>{let e;return G&&G.root?JSON.stringify((e={},G.state&&Object.keys(G.state).length>0&&(e.state=G.state),e.elements=function e(t){let n=G.elements[t];if(!n)return{_key:t,_missing:!0};let r={type:n.type};return n.props&&Object.keys(n.props).length>0&&(r.props=n.props),void 0!==n.visible&&(r.visible=n.visible),n.on&&Object.keys(n.on).length>0&&(r.on=n.on),n.repeat&&(r.repeat=n.repeat),n.children&&n.children.length>0&&(r.children=n.children.map(e)),n.slots&&Object.keys(n.slots).length>0&&(r.slots=Object.fromEntries(Object.entries(n.slots).map(([t,n])=>[t,n.map(e)]))),r}(G.root),e),null,2):"// waiting..."},[G]),ee=(0,s.useMemo)(()=>{if(!G||!G.root)return"// Generate a UI to see the code";let e=(0,o.collectUsedComponents)(G),t=function e(t,n){let r=G.elements[t];if(!r)return"";let s=" ".repeat(n),i=r.type,a={};for(let[e,t]of Object.entries(r.props??{}))null!=t&&(a[e]=t);let l=(0,o.serializeProps)(a),c=r.children&&r.children.length>0,u=r.slots&&Object.keys(r.slots).length>0;if(!c&&!u)return l?`${s}<${i} ${l} />`:`${s}<${i} />`;let d=[];if(u){for(let[t,o]of(d.push(`${s}<${i}`),l&&d.push(`${s} ${l}`),Object.entries(r.slots))){let r=o.map(t=>e(t,n+2)).filter(Boolean);0!==r.length&&(d.push(`${s} ${t}={`),r.length>1&&d.push(`${s} <>`),d.push(...r),r.length>1&&d.push(`${s} </>`),d.push(`${s} }`))}d.push(`${s}>`)}else d.push(l?`${s}<${i} ${l}>`:`${s}<${i}>`);for(let t of r.children??[])d.push(e(t,n+1));return d.push(`${s}</${i}>`),d.join("\n")}(G.root,2),n=Array.from(e).sort().join(", ");return`"use client"; 26 27import { ${n} } from "@/components/ui"; 28 29export default function Page() { 30 return ( 31 <div className="min-h-screen p-8 flex items-center justify-center"> 32${t} 33 </div> 34 ); 35}`},[G]),et=U?"yaml"===N?"yaml":"json":q?.format==="yaml"?"yaml":"json",en=(0,r.jsxs)("div",{className:"h-full flex flex-col border-t border-border",children:[(0,r.jsx)("div",{className:"border-b border-border px-3 h-9 flex items-center",children:(0,r.jsx)("span",{className:"text-xs font-mono text-muted-foreground",children:"versions"})}),(0,r.jsxs)("div",{className:`flex-1 p-2 min-h-0 ${e.length>0?"overflow-y-auto space-y-1":"flex"}`,children:[0===e.length?(0,r.jsxs)("div",{className:"flex-1 flex flex-col items-center justify-center text-center px-4",children:[(0,r.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"typesafe-ai/jev"===j?"Describe a UI to compose from the prepared options.":"Describe what you want to build, then iterate on it."}),(0,r.jsx)("div",{className:"flex flex-wrap gap-2 justify-center",children:E.map(({label:e,prompt:t})=>(0,r.jsx)("button",{onMouseDown:e=>{e.preventDefault(),(0,i.flushSync)(()=>u(t));let n=e.currentTarget.closest(".h-full.flex.flex-col"),r=n?.querySelector("textarea")??L.current;r&&(r.focus(),r.setSelectionRange(t.length,t.length))},className:"text-xs px-2 py-1 rounded border border-border text-muted-foreground hover:text-foreground hover:border-foreground
35/30 transition-colors",children:e},t))})]}):e.map((e,t)=>(0,r.jsxs)("button",{onClick:()=>l(e.id),className:`w-full text-left px-3 py-2 rounded text-sm transition-colors ${n===e.id?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/50 hover:text-foreground"}`,children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsxs)("span",{className:"text-xs font-mono text-muted-foreground/70 shrink-0",children:["v",t+1]}),(0,r.jsx)("span",{className:"truncate flex-1",children:e.prompt}),"generating"===e.status&&(0,r.jsx)("span",{className:"text-xs text-muted-foreground shrink-0 animate-pulse",children:"..."}),"error"===e.status&&(0,r.jsx)("span",{className:"text-xs text-red-500 shrink-0",children:"failed"})]}),(0,r.jsx)(rZ,{version:e}),e.usage&&(0,r.jsx)("div",{className:"mt-1 ml-6",children:(0,r.jsxs)("span",{className:"text-[10px] font-mono text-muted-foreground/60",children:[rQ(e.usage.promptTokens-e.usage.cachedTokens)," ","in · ",rQ(e.usage.completionTokens)," out",e.usage.cachedTokens>0?` \xb7 ${rQ(e.usage.cachedTokens)} cached`:""]})})]},e.id)),(0,r.jsx)("div",{ref:T})]}),(0,r.jsxs)("div",{className:"border-t border-border p-3 cursor-text",onMouseDown:e=>{let t=e.target;t.closest("button, a, [role=combobox]")||"TEXTAREA"===t.tagName||(e.preventDefault(),L.current?.focus())},children:[(0,r.jsx)("textarea",{ref:L,value:c,onChange:e=>u(e.target.value),onKeyDown:J,placeholder:"Describe changes...",maxLength:"typesafe-ai/jev"===j?1e3:void 0,className:"w-full bg-background text-base sm:text-sm resize-none outline-none placeholder:text-muted-foreground/50",rows:2}),(0,r.jsxs)("div",{className:"flex justify-between items-end gap-2 mt-2",children:[(0,r.jsx)(r0,{model:j,setModel:S,disabled:D,format:N,setFormat:w,editModes:C,setEditModes:I,showClear:e.length>0,onClear:()=>{t([]),l(null),A.current=null,$.current=null,F()}}),D?(0,r.jsx)("button",{onClick:K,className:"w-7 h-7 shrink-0 rounded-full bg-primary text-primary-foreground flex items-center justify-center hover:bg-primary/90 transition-colors","aria-label":"Stop",children:(0,r.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor",stroke:"none",children:(0,r.jsx)("rect",{x:"6",y:"6",width:"12",height:"12"})})}):(0,r.jsx)("button",{onClick:H,disabled:!c.trim(),className:"w-7 h-7 shrink-0 rounded-full bg-primary text-primary-foreground flex items-center justify-center hover:bg-primary/90 transition-colors disabled:opacity-30","aria-label":"Send",children:(0,r.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("path",{d:"M5 12h14"}),(0,r.jsx)("path",{d:"m12 5 7 7-7 7"})]})})]})]})]}),er=(0,s.useMemo)(()=>(0,rY.buildCatalogDisplayData)(rJ.playgroundCatalog.data),[]),es="stream"===d?V.join("\n"):"spec"===d?Q:"nested"===d?Z:"visual"===d?Q:"",ei=(0,r.jsxs)("div",{className:"h-full flex flex-col border-t border-border",children:[(0,r.jsxs)("div",{className:"border-b border-border px-3 h-9 flex items-center gap-3",children:[["spec","visual","nested","stream","catalog"].map(e=>(0,r.jsx)("button",{onClick:()=>f(e),className:`text-xs font-mono transition-colors ${d===e?"text-foreground":"text-muted-foreground hover:text-foreground"}`,children:"spec"===e?"yaml"===N?"yaml":"json":e},e)),(0,r.jsx)("div",{className:"flex-1"}),"catalog"!==d&&"visual"!==d&&(0,r.jsx)(ra.CopyButton,{text:es,className:"text-muted-foreground"})]}),(0,r.jsx)("div",{className:"flex-1 overflow-auto",children:"visual"===d?G?(0,r.jsx)(rG,{value:G,onChange:Y,readOnly:D,sidebarOpen:!1,height:"100%",className:"h-full",style:{"--vj-bg":"var(--background)","--vj-bg-panel":"var(--background)","--vj-bg-hover":"var(--muted)","--vj-bg-selected":"var(--primary)","--vj-bg-selected-muted":"var(--muted)","--vj-text":"var(--foreground)","--vj-text-selected":"var(--primary-foreground)","--vj-text-muted":"var(--muted-foreground)","--vj-text-dim":"var(--muted-foreground)","--vj-border":"var(--border)","--vj-border-subtle":"var(--border)","--vj-accent":"var(--primary)","--vj-accent-muted":"var(--muted)","--vj-input-bg":"var(--secondary)","--vj-input-border":"var(--border)"}}
35):(0,r.jsx)("div",{className:"text-muted-foreground/50 p-3 text-sm font-mono",children:"// generate a spec to edit visually"}):"catalog"===d?(0,r.jsxs)("div",{className:"h-full flex flex-col text-sm",children:[(0,r.jsx)("div",{className:"flex items-center gap-3 px-3 h-9 border-b border-border",children:[{key:"components",label:`components (${er.components.length})`},{key:"actions",label:`actions (${er.actions.length})`}].map(({key:e,label:t})=>(0,r.jsx)("button",{onClick:()=>h(e),className:`text-xs font-mono transition-colors ${p===e?"text-foreground":"text-muted-foreground hover:text-foreground"}`,children:t},e))}),(0,r.jsx)("div",{className:"flex-1 overflow-auto p-3",children:"components"===p?(0,r.jsx)("div",{className:"space-y-3",children:er.components.map(e=>(0,r.jsxs)("div",{className:"pb-3 border-b border-border last:border-b-0",children:[(0,r.jsxs)("div",{className:"flex items-baseline gap-2 mb-1",children:[(0,r.jsx)("span",{className:"font-mono font-medium text-foreground",children:e.name}),e.slots.length>0&&(0,r.jsxs)("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:["slots: ",e.slots.join(", ")]})]}),e.description&&(0,r.jsx)("p",{className:"text-xs text-muted-foreground mb-2",children:e.description}),e.props.length>0&&(0,r.jsx)("div",{className:"flex flex-wrap gap-1 mb-1",children:e.props.map(e=>(0,r.jsxs)("span",{className:"text-[11px] font-mono px-1.5 py-0.5 rounded bg-green-500/10 text-green-700 dark:text-green-400",children:[e.name,(0,r.jsxs)("span",{className:"text-green-700/50 dark:text-green-400/50",children:[": ",e.type]})]},e.name))}),e.events.length>0&&(0,r.jsx)("div",{className:"flex flex-wrap gap-1 mt-1.5",children:e.events.map(e=>(0,r.jsxs)("span",{className:"text-[11px] font-mono px-1.5 py-0.5 rounded bg-blue-500/10 text-blue-600 dark:text-blue-400",children:["on.",e]},e))})]},e.name))}):(0,r.jsx)("div",{className:"space-y-3",children:er.actions.map(e=>(0,r.jsxs)("div",{className:"pb-3 border-b border-border last:border-b-0",children:[(0,r.jsx)("span",{className:"font-mono font-medium text-foreground",children:e.name}),e.description&&(0,r.jsx)("p",{className:"text-xs text-muted-foreground mt-1 mb-2",children:e.description}),e.params.length>0&&(0,r.jsx)("div",{className:"flex flex-wrap gap-1",children:e.params.map(e=>(0,r.jsxs)("span",{className:"text-[11px] font-mono px-1.5 py-0.5 rounded bg-green-500/10 text-green-700 dark:text-green-400",children:[e.name,(0,r.jsxs)("span",{className:"text-green-700/50 dark:text-green-400/50",children:[": ",e.type]})]},e.name))})]},e.name))})})]}):"stream"===d?V.length>0?(0,r.jsx)(ro.CodeBlock,{code:V.join("\n"),lang:et,fillHeight:!0,hideCopyButton:!0}):(0,r.jsx)("div",{className:"text-muted-foreground/50 p-3 text-sm font-mono",children:D?"streaming...":"// waiting for generation"}):"nested"===d?(0,r.jsx)(ro.CodeBlock,{code:Z,lang:"json",fillHeight:!0,hideCopyButton:!0}):(0,r.jsx)(ro.CodeBlock,{code:Q,lang:X,fillHeight:!0,hideCopyButton:!0})})]}),eo=(0,r.jsxs)("div",{className:"h-full flex flex-col border-t border-border",children:[(0,r.jsxs)("div",{className:"border-b border-border px-3 h-9 flex items-center gap-3",children:[[{key:"preview",label:"preview"},{key:"code",label:"code"}].map(({key:e,label:t})=>(0,r.jsx)("button",{onClick:()=>g(e),className:`text-xs font-mono transition-colors ${m===e?"text-foreground":"text-muted-foreground hover:text-foreground"}`,children:t},e)),(0,r.jsx)("div",{className:"flex-1"}),"code"===m&&(0,r.jsx)(ra.CopyButton,{text:ee,className:"text-muted-foreground"})]}),(0,r.jsx)("div",{className:"flex-1 overflow-auto",children:"preview"===m?G&&G.root?(0,r.jsx)("div",{className:"w-full min-h-full flex items-center justify-center p-6",inert:D,children:(0,r.jsx)(rH.PlaygroundRenderer,{spec:G,data:G.state,loading:D},n)}):(0,r.jsx)("div",{className:"h-full flex items-center justify-center text-muted-foreground/50 text-sm",children:D?"generating...":"// enter a prompt to generate UI"}):(0,r.jsx)(ro.CodeBlock,{code:ee,lang:"tsx",fillHeight:!0,hideCopyButton:!0})})]});return(0,r.jsxs)("div",{className:"h-full flex flex-col",children:[(0,r.jsx)("div",{className:"hidden lg:flex flex-1 min-h-0",children:(0,r.jsxs)(rr,{className:"flex-1",children:[(0,r.jsx)(rs,{defaultSize:25,minSize:15,children:en}),(0,r.jsx)(ri,{}),(0,r.jsx)(rs,{defaultSize:35,minSize:20,children:ei}),(0,r.jsx)(ri,{}),(0,r.jsx)(rs,{defaultSize:40,minSize:20,children:eo})]})}),(0,r.jsxs)("div",{className:"flex lg:hidden flex-col flex-1 min-h-0",children:[(0,r.jsxs)("div",{className:"border-b border-border px-3 h-9 flex items-center gap-3 shrink-0 overflow-x-auto",children:[(0,r.jsxs)("button",{onClick:()=>x(!0),className:"text-xs font-mono font-medium px-1.5 py-0.5 rounded bg-muted text-foreground shrink-0",children:["v",e.length>0?e.findIndex(e=>e.id===n)+1||e.length:0]}),["spec","visual","nested","stream","catalog"].map(e=>(0,r.jsx)("button",{onClick:()=>b(e),className:`text-xs font-mono transition-colors shrink-0 ${y===e?"text-foreground":"text-muted-foreground hover:text-foreground"}`,children:"spec"===e?"yaml"===N?"yaml":"json":e},e)),(0,r.jsx)("div",{className:"flex-1"}),[{key:"preview",label:"preview"}
35,{key:"generated-code",label:"code"}].map(({key:e,label:t})=>(0,r.jsx)("button",{onClick:()=>b(e),className:`text-xs font-mono transition-colors shrink-0 ${y===e?"text-foreground":"text-muted-foreground hover:text-foreground"}`,children:t},e))]}),(0,r.jsx)("div",{className:"flex-1 min-h-0 overflow-auto",children:"visual"===y?G?(0,r.jsx)(rG,{value:G,onChange:Y,readOnly:D,sidebarOpen:!1,height:"100%",className:"h-full",style:{"--vj-bg":"var(--background)","--vj-bg-panel":"var(--background)","--vj-bg-hover":"var(--muted)","--vj-bg-selected":"var(--primary)","--vj-bg-selected-muted":"var(--muted)","--vj-text":"var(--foreground)","--vj-text-selected":"var(--primary-foreground)","--vj-text-muted":"var(--muted-foreground)","--vj-text-dim":"var(--muted-foreground)","--vj-border":"var(--border)","--vj-border-subtle":"var(--border)","--vj-accent":"var(--primary)","--vj-accent-muted":"var(--muted)","--vj-input-bg":"var(--secondary)","--vj-input-border":"var(--border)"}}):(0,r.jsx)("div",{className:"text-muted-foreground/50 p-3 text-sm font-mono",children:"// generate a spec to edit visually"}):"catalog"===y?(0,r.jsxs)("div",{className:"h-full flex flex-col text-sm",children:[(0,r.jsx)("div",{className:"flex items-center gap-3 px-3 h-9 border-b border-border",children:[{key:"components",label:`components (${er.components.length})`},{key:"actions",label:`actions (${er.actions.length})`}].map(({key:e,label:t})=>(0,r.jsx)("button",{onClick:()=>h(e),className:`text-xs font-mono transition-colors ${p===e?"text-foreground":"text-muted-foreground hover:text-foreground"}`,children:t},e))}),(0,r.jsx)("div",{className:"flex-1 overflow-auto p-3",children:"components"===p?(0,r.jsx)("div",{className:"space-y-3",children:er.components.map(e=>(0,r.jsxs)("div",{className:"pb-3 border-b border-border last:border-b-0",children:[(0,r.jsxs)("div",{className:"flex items-baseline gap-2 mb-1",children:[(0,r.jsx)("span",{className:"font-mono font-medium text-foreground",children:e.name}),e.slots.length>0&&(0,r.jsxs)("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:["slots: ",e.slots.join(", ")]})]}),e.description&&(0,r.jsx)("p",{className:"text-xs text-muted-foreground mb-2",children:e.description}),e.props.length>0&&(0,r.jsx)("div",{className:"flex flex-wrap gap-1 mb-1",children:e.props.map(e=>(0,r.jsxs)("span",{className:"text-[11px] font-mono px-1.5 py-0.5 rounded bg-green-500/10 text-green-700 dark:text-green-400",children:[e.name,(0,r.jsxs)("span",{className:"text-green-700/50 dark:text-green-400/50",children:[": ",e.type]})]},e.name))}),e.events.length>0&&(0,r.jsx)("div",{className:"flex flex-wrap gap-1 mt-1.5",children:e.events.map(e=>(0,r.jsxs)("span",{className:"text-[11px] font-mono px-1.5 py-0.5 rounded bg-blue-500/10 text-blue-600 dark:text-blue-400",children:["on.",e]},e))})]},e.name))}):(0,r.jsx)("div",{className:"space-y-3",children:er.actions.map(e=>(0,r.jsxs)("div",{className:"pb-3 border-b border-border last:border-b-0",children:[(0,r.jsx)("span",{className:"font-mono font-medium text-foreground",children:e.name}),e.description&&(0,r.jsx)("p",{className:"text-xs text-muted-foreground mt-1 mb-2",children:e.description}),e.params.length>0&&(0,r.jsx)("div",{className:"flex flex-wrap gap-1",children:e.params.map(e=>(0,r.jsxs)("span",{className:"text-[11px] font-mono px-1.5 py-0.5 rounded bg-green-500/10 text-green-700 dark:text-green-400",children:[e.name,(0,r.jsxs)("span",{className:"text-green-700/50 dark:text-green-400/50",children:[": ",e.type]})]},e.name))})]},e.name))})})]}):"stream"===y?V.length>0?(0,r.jsx)(ro.CodeBlock,{code:V.join("\n"),lang:et,fillHeight:!0,hideCopyButton:!0}):(0,r.jsx)("div",{className:"text-muted-foreground/50 p-3 text-sm font-mono",children:D?"streaming...":"// waiting for generation"}):"nested"===y?(0,r.jsx)(ro.CodeBlock,{code:Z,lang:"json",fillHeight:!0,hideCopyButton:!0}):"spec"===y?(0,r.jsx)(ro.CodeBlock,{code:Q,lang:X,fillHeight:!0,hideCopyButton:!0}):"preview"===y?G&&G.root?(0,r.jsx)("div",{className:"w-full min-h-full flex items-center justify-center p-6",inert:D,children:(0,r.jsx)(rH.PlaygroundRenderer,{spec:G,data:G.state,loading:D},n)}):(0,r.jsx)("div",{className:"h-full flex flex-col items-center justify-center text-center px-4",children:D?(0,r.jsx)("p",{className:"text-sm text-muted-foreground
35/50",children:"generating..."}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"typesafe-ai/jev"===j?"Describe a UI to compose from the prepared options.":"Describe what you want to build, then iterate on it."}),(0,r.jsx)("div",{className:"flex flex-wrap gap-2 justify-center",children:E.map(({label:e,prompt:t})=>(0,r.jsx)("button",{onMouseDown:e=>{e.preventDefault(),(0,i.flushSync)(()=>u(t)),O.current?.focus(),O.current?.setSelectionRange(t.length,t.length)},className:"text-xs px-2 py-1 rounded border border-border text-muted-foreground hover:text-foreground hover:border-foreground/30 transition-colors",children:e},t))})]})}):(0,r.jsx)(ro.CodeBlock,{code:ee,lang:"tsx",fillHeight:!0,hideCopyButton:!0})}),(0,r.jsxs)("div",{className:"border-t border-border p-3 pb-16 shrink-0 cursor-text",onMouseDown:e=>{let t=e.target;t.closest("button, a, [role=combobox]")||"TEXTAREA"===t.tagName||(e.preventDefault(),O.current?.focus())},children:[(0,r.jsx)("textarea",{ref:O,value:c,onChange:e=>u(e.target.value),onKeyDown:J,placeholder:"Describe changes...",maxLength:"typesafe-ai/jev"===j?1e3:void 0,className:"w-full bg-background text-base resize-none outline-none placeholder:text-muted-foreground/50",rows:2}),(0,r.jsxs)("div",{className:"flex justify-between items-end gap-2 mt-2",children:[(0,r.jsx)(r0,{model:j,setModel:S,disabled:D,format:N,setFormat:w,editModes:C,setEditModes:I,showClear:e.length>0,onClear:()=>{t([]),l(null),A.current=null,$.current=null,F()}}),D?(0,r.jsx)("button",{onClick:K,className:"w-7 h-7 shrink-0 rounded-full bg-primary text-primary-foreground flex items-center justify-center hover:bg-primary/90 transition-colors","aria-label":"Stop",children:(0,r.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor",stroke:"none",children:(0,r.jsx)("rect",{x:"6",y:"6",width:"12",height:"12"})})}):(0,r.jsx)("button",{onClick:H,disabled:!c.trim(),className:"w-7 h-7 shrink-0 rounded-full bg-primary text-primary-foreground flex items-center justify-center hover:bg-primary/90 transition-colors disabled:opacity-30","aria-label":"Send",children:(0,r.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("path",{d:"M5 12h14"}),(0,r.jsx)("path",{d:"m12 5 7 7-7 7"})]})})]})]}),(0,r.jsx)(rd.Sheet,{open:v,onOpenChange:x,children:(0,r.jsxs)(rd.SheetContent,{children:[(0,r.jsx)(rd.SheetTitle,{className:"text-sm font-mono mb-4",children:"Versions"}),(0,r.jsxs)("div",{className:"flex-1 overflow-y-auto space-y-1",children:[e.map((e,t)=>(0,r.jsxs)("button",{onClick:()=>{l(e.id),x(!1)},className:`w-full text-left px-3 py-2 rounded text-sm transition-colors ${n===e.id?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/50 hover:text-foreground"}`,children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsxs)("span",{className:"text-xs font-mono text-muted-foreground/70 shrink-0",children:["v",t+1]}),(0,r.jsx)("span",{className:"truncate flex-1",children:e.prompt}),"generating"===e.status&&(0,r.jsx)("span",{className:"text-xs text-muted-foreground shrink-0 animate-pulse",children:"..."}),"error"===e.status&&(0,r.jsx)("span",{className:"text-xs text-red-500 shrink-0",children:"failed"})]}),(0,r.jsx)(rZ,{version:e}),e.usage&&(0,r.jsx)("div",{className:"mt-1 ml-6",children:(0,r.jsxs)("span",{className:"text-[10px] font-mono text-muted-foreground/60",children:[rQ(e.usage.promptTokens-e.usage.cachedTokens)," ","in · ",rQ(e.usage.completionTokens)," out",e.usage.cachedTokens>0?` \xb7 ${rQ(e.usage.cachedTokens)} cached`:""]})})]},e.id)),0===e.length&&(0,r.jsx)("p",{className:"text-sm text-muted-foreground px-3",children:"No versions yet. Enter a prompt to get started."})]})]})})]}),(0,r.jsx)(rl.Toaster,{position:"bottom-right"})]})}],964827)}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.