@kitelev/exocortex-cli 17.17.0 → 17.17.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +24 -24
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- // @kitelev/exocortex-cli v17.17.0
2
+ // @kitelev/exocortex-cli v17.17.1
3
3
  // CLI tool for Exocortex knowledge management system - SPARQL queries, task management, and more
4
4
  // License: MIT
5
5
 
@@ -92,7 +92,7 @@ Expecting `+Py.join(", ")+", got '"+(this.terminals_[$t]||$t)+"'":hT="Parse erro
92
92
  `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:a(function(M){this.unput(this.match.slice(M))},"less"),pastInput:a(function(){var M=this.matched.substr(0,this.matched.length-this.match.length);return(M.length>20?"...":"")+M.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:a(function(){var M=this.match;return M.length<20&&(M+=this._input.substr(0,20-M.length)),(M.substr(0,20)+(M.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:a(function(){var M=this.pastInput(),W=new Array(M.length+1).join("-");return M+this.upcomingInput()+`
93
93
  `+W+"^"},"showPosition"),test_match:a(function(M,W){var se,ke,rt;if(this.options.backtrack_lexer&&(rt={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(rt.yylloc.range=this.yylloc.range.slice(0))),ke=M[0].match(/(?:\r\n?|\n).*/g),ke&&(this.yylineno+=ke.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:ke?ke[ke.length-1].length-ke[ke.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+M[0].length},this.yytext+=M[0],this.match+=M[0],this.matches=M,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(M[0].length),this.matched+=M[0],se=this.performAction.call(this,this.yy,this,W,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),se)return se;if(this._backtrack){for(var A in rt)this[A]=rt[A];return!1}return!1},"test_match"),next:a(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var M,W,se,ke;this._more||(this.yytext="",this.match="");for(var rt=this._currentRules(),A=0;A<rt.length;A++)if(se=this._input.match(this.rules[rt[A]]),se&&(!W||se[0].length>W[0].length)){if(W=se,ke=A,this.options.backtrack_lexer){if(M=this.test_match(se,rt[A]),M!==!1)return M;if(this._backtrack){W=!1;continue}else return!1}else if(!this.options.flex)break}return W?(M=this.test_match(W,rt[ke]),M!==!1?M:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
94
94
  `+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:a(function(){var W=this.next();return W||this.lex()},"lex"),begin:a(function(W){this.conditionStack.push(W)},"begin"),popState:a(function(){var W=this.conditionStack.length-1;return W>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:a(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:a(function(W){return W=this.conditionStack.length-1-Math.abs(W||0),W>=0?this.conditionStack[W]:"INITIAL"},"topState"),pushState:a(function(W){this.begin(W)},"pushState"),stateStackSize:a(function(){return this.conditionStack.length},"stateStackSize"),options:{flex:!0,"case-insensitive":!0},performAction:a(function(W,se,ke,rt){var A=rt;switch(ke){case 0:break;case 1:return 12;case 2:return 15;case 3:return 41;case 4:return 325;case 5:return 326;case 6:return 45;case 7:return 47;case 8:return 48;case 9:return 39;case 10:return 24;case 11:return 28;case 12:return 29;case 13:return 31;case 14:return 32;case 15:return 36;case 16:return 53;case 17:return 327;case 18:return 63;case 19:return 64;case 20:return 70;case 21:return 73;case 22:return 76;case 23:return 78;case 24:return 81;case 25:return 83;case 26:return 85;case 27:return 193;case 28:return 100;case 29:return 328;case 30:return 121;case 31:return 329;case 32:return 330;case 33:return 110;case 34:return 331;case 35:return 109;case 36:return 332;case 37:return 333;case 38:return 113;case 39:return 115;case 40:return 116;case 41:return 131;case 42:return 123;case 43:return 126;case 44:return 128;case 45:return 132;case 46:return 112;case 47:return 334;case 48:return 335;case 49:return 159;case 50:return 161;case 51:return 164;case 52:return 174;case 53:return 160;case 54:return 336;case 55:return 163;case 56:return 312;case 57:return 314;case 58:return 317;case 59:return 318;case 60:return 272;case 61:return 197;case 62:return 337;case 63:return 338;case 64:return 229;case 65:return 340;case 66:return 263;case 67:return 224;case 68:return 231;case 69:return 232;case 70:return 242;case 71:return 246;case 72:return 290;case 73:return 341;case 74:return 342;case 75:return 343;case 76:return 344;case 77:return 345;case 78:return 250;case 79:return 346;case 80:return 265;case 81:return 276;case 82:return 277;case 83:return 268;case 84:return 269;case 85:return 270;case 86:return 271;case 87:return 347;case 88:return 348;case 89:return 273;case 90:return 274;case 91:return 350;case 92:return 349;case 93:return 351;case 94:return 279;case 95:return 280;case 96:return 283;case 97:return 285;case 98:return 289;case 99:return 293;case 100:return 296;case 101:return 13;case 102:return 16;case 103:return 308;case 104:return 309;case 105:return 87;case 106:return 292;case 107:return 82;case 108:return 294;case 109:return 295;case 110:return 297;case 111:return 298;case 112:return 299;case 113:return 300;case 114:return 301;case 115:return 302;case 116:return"EXPONENT";case 117:return 303;case 118:return 304;case 119:return 305;case 120:return 306;case 121:return 89;case 122:return 310;case 123:return 6;case 124:return"INVALID";case 125:console.log(se.yytext);break}},"anonymous"),rules:[/^(?:\s+|(#[^\n\r]*))/i,/^(?:BASE)/i,/^(?:PREFIX)/i,/^(?:SELECT)/i,/^(?:DISTINCT)/i,/^(?:REDUCED)/i,/^(?:\()/i,/^(?:AS)/i,/^(?:\))/i,/^(?:\*)/i,/^(?:CONSTRUCT)/i,/^(?:WHERE)/i,/^(?:\{)/i,/^(?:\})/i,/^(?:DESCRIBE)/i,/^(?:ASK)/i,/^(?:FROM)/i,/^(?:NAMED)/i,/^(?:GROUP)/i,/^(?:BY)/i,/^(?:HAVING)/i,/^(?:ORDER)/i,/^(?:ASC)/i,/^(?:DESC)/i,/^(?:LIMIT)/i,/^(?:OFFSET)/i,/^(?:VALUES)/i,/^(?:;)/i,/^(?:LOAD)/i,/^(?:SILENT)/i,/^(?:INTO)/i,/^(?:CLEAR)/i,/^(?:DROP)/i,/^(?:CREATE)/i,/^(?:ADD)/i,/^(?:TO)/i,/^(?:MOVE)/i,/^(?:COPY)/i,/^(?:INSERT((\s+|(#[^\n\r]*)\n\r?)+)DATA)/i,/^(?:DELETE((\s+|(#[^\n\r]*)\n\r?)+)DATA)/i,/^(?:DELETE((\s+|(#[^\n\r]*)\n\r?)+)WHERE)/i,/^(?:WITH)/i,/^(?:DELETE)/i,/^(?:INSERT)/i,/^(?:USING)/i,/^(?:DEFAULT)/i,/^(?:GRAPH)/i,/^(?:ALL)/i,/^(?:\.)/i,/^(?:OPTIONAL)/i,/^(?:SERVICE)/i,/^(?:BIND)/i,/^(?:UNDEF)/i,/^(?:MINUS)/i,/^(?:UNION)/i,/^(?:FILTER)/i,/^(?:<<)/i,/^(?:>>)/i,/^(?:\{\|)/i,/^(?:\|\})/i,/^(?:,)/i,/^(?:a)/i,/^(?:\|)/i,/^(?:\/)/i,/^(?:\^)/i,/^(?:\?)/i,/^(?:\+)/i,/^(?:!)/i,/^(?:\[)/i,/^(?:\])/i,/^(?:\|\|)/i,/^(?:&&)/i,/^(?:=)/i,/^(?:!=)/i,/^(?:<)/i,/^(?:>)/i,/^(?:<=)/i,/^(?:>=)/i,/^(?:IN)/i,/^(?:NOT)/i,/^(?:-)/i,/^(?:BOUND)/i,/^(?:BNODE)/i,/^(?:(RAND|NOW|UUID|STRUUID))/i,/^(?:(LANG|DATATYPE|IRI|URI|ABS|CEIL|FLOOR|ROUND|STRLEN|STR|UCASE|LCASE|ENCODE_FOR_URI|YEAR|MONTH|DAY|HOURS|MINUTES|SECONDS|TIMEZONE|TZ|MD5|SHA1|SHA256|SHA384|SHA512|isIRI|isURI|isBLANK|isLITERAL|isNUMERIC))/i,/^(?:(SUBJECT|PREDICATE|OBJECT|isTRIPLE))/i,/^(?:(LANGMATCHES|CONTAINS|STRSTARTS|STRENDS|STRBEFORE|STRAFTER|STRLANG|STRDT|sameTerm))/i,/^(?:CONCAT)/i,/^(?:COALESCE)/i,/^(?:IF)/i,/^(?:TRIPLE)/i,/^(?:REGEX)/i,/^(?:SUBSTR)/i,/^(?:REPLACE)/i,/^(?:EXISTS)/i,/^(?:COUNT)/i,/^(?:SUM|MIN|MAX|AVG|SAMPLE)/i,/^(?:GROUP_CONCAT)/i,/^(?:SEPARATOR)/i,/^(?:\^\^)/i,/^(?:true|false)/i,/^(?:(<(?:[^<>\"\{\}\|\^`\\\u0000-\u0020])*>))/i,/^(?:((([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])(?:(?:(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])|\.)*(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040]))?)?:))/i,/^(?:(((([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])(?:(?:(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])|\.)*(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040]))?)?:)((?:((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|:|[0-9]|((%([0-9A-Fa-f])([0-9A-Fa-f]))|(\\(_|~|\.|-|!|\$|&|'|\(|\)|\*|\+|,|;|=|\/|\?|#|@|%))))(?:(?:(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])|\.|:|((%([0-9A-Fa-f])([0-9A-Fa-f]))|(\\(_|~|\.|-|!|\$|&|'|\(|\)|\*|\+|,|;|=|\/|\?|#|@|%))))*(?:(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])|:|((%([0-9A-Fa-f])([0-9A-Fa-f]))|(\\(_|~|\.|-|!|\$|&|'|\(|\)|\*|\+|,|;|=|\/|\?|#|@|%)))))?)))/i,/^(?:(_:(?:((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|[0-9])(?:(?:(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])|\.)*(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040]))?))/i,/^(?:([\?\$]((?:((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|[0-9])(?:((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])*)))/i,/^(?:(@[a-zA-Z]+(?:-[a-zA-Z0-9]+)*))/i,/^(?:([0-9]+))/i,/^(?:([0-9]*\.[0-9]+))/i,/^(?:([0-9]+\.[0-9]*([eE][+-]?[0-9]+)|\.([0-9])+([eE][+-]?[0-9]+)|([0-9])+([eE][+-]?[0-9]+)))/i,/^(?:(\+([0-9]+)))/i,/^(?:(\+([0-9]*\.[0-9]+)))/i,/^(?:(\+([0-9]+\.[0-9]*([eE][+-]?[0-9]+)|\.([0-9])+([eE][+-]?[0-9]+)|([0-9])+([eE][+-]?[0-9]+))))/i,/^(?:(-([0-9]+)))/i,/^(?:(-([0-9]*\.[0-9]+)))/i,/^(?:(-([0-9]+\.[0-9]*([eE][+-]?[0-9]+)|\.([0-9])+([eE][+-]?[0-9]+)|([0-9])+([eE][+-]?[0-9]+))))/i,/^(?:([eE][+-]?[0-9]+))/i,/^(?:('(?:(?:[^\u0027\u005C\u000A\u000D])|(\\[tbnrf\\\"']|\\u([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])|\\U([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])))*'))/i,/^(?:("(?:(?:[^\u0022\u005C\u000A\u000D])|(\\[tbnrf\\\"']|\\u([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])|\\U([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])))*"))/i,/^(?:('''(?:(?:'|'')?(?:[^'\\]|(\\[tbnrf\\\"']|\\u([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])|\\U([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f]))))*'''))/i,/^(?:("""(?:(?:"|"")?(?:[^\"\\]|(\\[tbnrf\\\"']|\\u([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])|\\U([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f]))))*"""))/i,/^(?:(\((\u0020|\u0009|\u000D|\u000A)*\)))/i,/^(?:(\[(\u0020|\u0009|\u000D|\u000A)*\]))/i,/^(?:$)/i,/^(?:.)/i,/^(?:.)/i],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125],inclusive:!0}}};return V})();tT.lexer=fK;function ut(){this.yy={}}return a(ut,"Parser"),ut.prototype=tT,tT.Parser=ut,new ut})();Yk.exports=iee});var eM=T((zOe,Zk)=>{var see="http://www.w3.org/2001/XMLSchema#integer",oee="http://www.w3.org/2001/XMLSchema#string";function ir(r){this._options=r=r||{};var e=r.prefixes||{};this._prefixByIri={};var t=[];for(var n in e){var i=e[n];jh(i)&&(this._prefixByIri[i]=n,t.push(i))}var s=t.join("|").replace(/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&");this._prefixRegex=new RegExp("^("+s+")([a-zA-Z][\\-_a-zA-Z0-9]*)$"),this._usedPrefixes={},this._sparqlStar=r.sparqlStar,this._indent=jh(r.indent)?r.indent:" ",this._newline=jh(r.newline)?r.newline:`
95
- `,this._explicitDatatype=!!r.explicitDatatype}a(ir,"Generator");ir.prototype.toQuery=function(r){var e="";return r.queryType&&(e+=r.queryType.toUpperCase()+" "),r.reduced&&(e+="REDUCED "),r.distinct&&(e+="DISTINCT "),r.variables?e+=Yi(r.variables,void 0,function(t){return/^[?$]/.test(t)?t:Rc(t)?this.toEntity(t):"("+this.toExpression(t.expression)+" AS "+Q0(t.variable)+")"},this)+" ":r.template&&(e+=this.group(r.template,!0)+this._newline),r.from&&(e+=this.graphs("FROM ",r.from.default)+this.graphs("FROM NAMED ",r.from.named)),r.where&&(e+="WHERE "+this.group(r.where,!0)+this._newline),r.updates&&(e+=Yi(r.updates,";"+this._newline,this.toUpdate,this)),r.group&&(e+="GROUP BY "+Yi(r.group,void 0,function(t){var n=Rc(t.expression)?this.toEntity(t.expression):"("+this.toExpression(t.expression)+")";return t.variable?"("+n+" AS "+Q0(t.variable)+")":n},this)+this._newline),r.having&&(e+="HAVING ("+Yi(r.having,void 0,this.toExpression,this)+")"+this._newline),r.order&&(e+="ORDER BY "+Yi(r.order,void 0,function(t){var n="("+this.toExpression(t.expression)+")";return t.descending?"DESC "+n:n},this)+this._newline),Number.isInteger(r.offset)&&(e+="OFFSET "+r.offset+this._newline),Number.isInteger(r.limit)&&(e+="LIMIT "+r.limit+this._newline),r.values&&(e+=this.values(r)),e=this.baseAndPrefixes(r)+e,e.trim()};ir.prototype.baseAndPrefixes=function(r){var e=r.base?"BASE <"+r.base+">"+this._newline:"",t="";for(var n in r.prefixes)(this._options.allPrefixes||this._usedPrefixes[n])&&(t+="PREFIX "+n+": <"+r.prefixes[n]+">"+this._newline);return e+t};ir.prototype.toPattern=function(r){var e=r.type||r instanceof Array&&"array"||(r.subject&&r.predicate&&r.object?"triple":"");if(!(e in this))throw new Error("Unknown entry type: "+e);return this[e](r)};ir.prototype.triple=function(r){return this.toEntity(r.subject)+" "+this.toEntity(r.predicate)+" "+this.toEntity(r.object)+"."};ir.prototype.array=function(r){return Yi(r,this._newline,this.toPattern,this)};ir.prototype.bgp=function(r){return this.encodeTriples(r.triples)};ir.prototype.encodeTriples=function(r){if(!r.length)return"";for(var e=[],t=void 0,n=void 0,i=0;i<r.length;i++){var s=r[i];eu(s.subject,t)?eu(s.predicate,n)?e.push(","):(n=s.predicate,e.push(";"+this._newline,this._indent,this.toEntity(n))):(t&&e.push("."+this._newline),t=s.subject,n=s.predicate,e.push(this.toEntity(t)," ",this.toEntity(n))),e.push(" ",this.toEntity(s.object))}return e.push("."),e.join("")};ir.prototype.graph=function(r){return"GRAPH "+this.toEntity(r.name)+" "+this.group(r)};ir.prototype.graphs=function(r,e){return!e||e.length===0?"":Yi(e,"",function(t){return r+this.toEntity(t)+this._newline},this)};ir.prototype.group=function(r,e){return r=e!==!0?this.array(r.patterns||r.triples):this.toPattern(r.type!=="group"?r:r.patterns),r.indexOf(this._newline)===-1?"{ "+r+" }":"{"+this._newline+this.indent(r)+this._newline+"}"};ir.prototype.query=function(r){return this.toQuery(r)};ir.prototype.filter=function(r){return"FILTER("+this.toExpression(r.expression)+")"};ir.prototype.bind=function(r){return"BIND("+this.toExpression(r.expression)+" AS "+Q0(r.variable)+")"};ir.prototype.optional=function(r){return"OPTIONAL "+this.group(r)};ir.prototype.union=function(r){return Yi(r.patterns,this._newline+"UNION"+this._newline,function(e){return this.group(e,!0)},this)};ir.prototype.minus=function(r){return"MINUS "+this.group(r)};ir.prototype.values=function(r){var e=Object.keys(r.values.reduce(function(i,s){for(var o in s)i[o]=!0;return i},{})),t,n;return e.length===1?t=n="":(t="(",n=")"),"VALUES "+t+e.join(" ")+n+" {"+this._newline+Yi(r.values,this._newline,function(i){return" "+t+Yi(e,void 0,function(s){return i[s]?this.toEntity(i[s]):"UNDEF"},this)+n},this)+this._newline+"}"};ir.prototype.service=function(r){return"SERVICE "+(r.silent?"SILENT ":"")+this.toEntity(r.name)+" "+this.group(r)};ir.prototype.toExpression=function(r){if(Rc(r))return this.toEntity(r);switch(r.type.toLowerCase()){case"aggregate":return r.aggregation.toUpperCase()+"("+(r.distinct?"DISTINCT ":"")+this.toExpression(r.expression)+(typeof r.separator=="string"?'; SEPARATOR = "'+r.separator.replace(Xk,Jk)+'"':"")+")";case"functioncall":return this.toEntity(r.function)+"("+Yi(r.args,", ",this.toExpression,this)+")";case"operation":var e=r.operator.toUpperCase(),t=r.args||[];switch(r.operator.toLowerCase()){case"<":case">":case">=":case"<=":case"&&":case"||":case"=":case"!=":case"+":case"-":case"*":case"/":return(Rc(t[0])?this.toEntity(t[0]):"("+this.toExpression(t[0])+")")+" "+e+" "+(Rc(t[1])?this.toEntity(t[1]):"("+this.toExpression(t[1])+")");case"!":return"!("+this.toExpression(t[0])+")";case"uplus":return"+("+this.toExpression(t[0])+")";case"uminus":return"-("+this.toExpression(t[0])+")";case"notin":e="NOT IN";case"in":return this.toExpression(t[0])+" "+e+"("+(jh(t[1])?t[1]:Yi(t[1],", ",this.toExpression,this))+")";case"notexists":e="NOT EXISTS";case"exists":return e+" "+this.group(t[0],!0);default:return e+"("+Yi(t,", ",this.toExpression,this)+")"}default:throw new Error("Unknown expression type: "+r.type)}};ir.prototype.toEntity=function(r){if(Rc(r))switch(r.termType){case"Wildcard":return"*";case"Variable":return Q0(r);case"BlankNode":return"_:"+r.value;case"Literal":var e=r.value||"",t=r.language||"",n=r.datatype;if(r='"'+e.replace(Xk,Jk)+'"',t)r+="@"+t;else if(n){if(!this._explicitDatatype)switch(n.value){case oee:return r;case see:if(/^\d+$/.test(e))return e+" "}r+="^^"+this.encodeIRI(n.value)}return r;case"Quad":if(!this._sparqlStar)throw new Error("SPARQL* support is not enabled");return r.graph&&r.graph.termType!=="DefaultGraph"?"<< GRAPH "+this.toEntity(r.graph)+" { "+this.toEntity(r.subject)+" "+this.toEntity(r.predicate)+" "+this.toEntity(r.object)+" } >>":"<< "+this.toEntity(r.subject)+" "+this.toEntity(r.predicate)+" "+this.toEntity(r.object)+" >>";default:return this.encodeIRI(r.value)}else{var i=r.items.map(this.toEntity,this),s=r.pathType;switch(s){case"^":case"!":return s+i[0];case"*":case"+":case"?":return"("+i[0]+s+")";default:return"("+i.join(s)+")"}}};var Xk=/["\\\t\n\r\b\f]/g,Jk=a(function(r){return aee[r]},"escapeReplacer"),aee={"\\":"\\\\",'"':'\\"'," ":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"};ir.prototype.encodeIRI=function(r){var e=this._prefixRegex.exec(r);if(e){var t=this._prefixByIri[e[1]];return this._usedPrefixes[t]=!0,t+":"+e[2]}return"<"+r+">"};ir.prototype.toUpdate=function(r){switch(r.type||r.updateType){case"load":return"LOAD"+(r.source?" "+this.toEntity(r.source):"")+(r.destination?" INTO GRAPH "+this.toEntity(r.destination):"");case"insert":return"INSERT DATA "+this.group(r.insert,!0);case"delete":return"DELETE DATA "+this.group(r.delete,!0);case"deletewhere":return"DELETE WHERE "+this.group(r.delete,!0);case"insertdelete":return(r.graph?"WITH "+this.toEntity(r.graph)+this._newline:"")+(r.delete.length?"DELETE "+this.group(r.delete,!0)+this._newline:"")+(r.insert.length?"INSERT "+this.group(r.insert,!0)+this._newline:"")+(r.using?this.graphs("USING ",r.using.default):"")+(r.using?this.graphs("USING NAMED ",r.using.named):"")+"WHERE "+this.group(r.where,!0);case"add":case"copy":case"move":return r.type.toUpperCase()+" "+(r.silent?"SILENT ":"")+(r.source.default?"DEFAULT":this.toEntity(r.source.name))+" TO "+this.toEntity(r.destination.name);case"create":case"clear":case"drop":return r.type.toUpperCase()+(r.silent?" SILENT ":" ")+(r.graph.default?"DEFAULT":r.graph.named?"NAMED":r.graph.all?"ALL":"GRAPH "+this.toEntity(r.graph.name));default:throw new Error("Unknown update query type: "+r.type)}};ir.prototype.indent=function(r){return r.replace(/^/gm,this._indent)};function Q0(r){return"?"+r.value}a(Q0,"variableToString");function jh(r){return typeof r=="string"}a(jh,"isString");function Rc(r){return typeof r.termType=="string"}a(Rc,"isTerm");function eu(r,e){if(!r||!Rc(r)||!e||!Rc(e)||r.termType!==e.termType)return!1;switch(r.termType){case"Literal":return r.value===e.value&&r.language===e.language&&eu(r.datatype,e.datatype);case"Quad":return eu(r.subject,e.subject)&&eu(r.predicate,e.predicate)&&eu(r.object,e.object)&&eu(r.graph,e.graph);default:return r.value===e.value}}a(eu,"equalTerms");function Yi(r,e,t,n){return r.map(t,n).join(jh(e)?e:" ")}a(Yi,"mapJoin");function cee(r={}){return{stringify:a(function(e){var t=Object.create(r);return t.prefixes=e.prefixes,new ir(t).toQuery(e)},"stringify"),createGenerator:a(function(){return new ir(r)},"createGenerator")}}a(cee,"_Generator");Zk.exports={Generator:cee}});var FA=T(X0=>{"use strict";Object.defineProperty(X0,"__esModule",{value:!0});X0.BlankNode=void 0;var PA=class{static{a(this,"BlankNode")}constructor(e){this.termType="BlankNode",this.value=e}equals(e){return!!e&&e.termType==="BlankNode"&&e.value===this.value}};X0.BlankNode=PA});var LA=T(J0=>{"use strict";Object.defineProperty(J0,"__esModule",{value:!0});J0.DefaultGraph=void 0;var Bh=class{static{a(this,"DefaultGraph")}constructor(){this.termType="DefaultGraph",this.value=""}equals(e){return!!e&&e.termType==="DefaultGraph"}};J0.DefaultGraph=Bh;Bh.INSTANCE=new Bh});var e_=T(Z0=>{"use strict";Object.defineProperty(Z0,"__esModule",{value:!0});Z0.NamedNode=void 0;var DA=class{static{a(this,"NamedNode")}constructor(e){this.termType="NamedNode",this.value=e}equals(e){return!!e&&e.termType==="NamedNode"&&e.value===this.value}};Z0.NamedNode=DA});var NA=T(t_=>{"use strict";Object.defineProperty(t_,"__esModule",{value:!0});t_.Literal=void 0;var tM=e_(),Uh=class r{static{a(this,"Literal")}constructor(e,t){this.termType="Literal",this.value=e,typeof t=="string"?(this.language=t,this.datatype=r.RDF_LANGUAGE_STRING):t?(this.language="",this.datatype=t):(this.language="",this.datatype=r.XSD_STRING)}equals(e){return!!e&&e.termType==="Literal"&&e.value===this.value&&e.language===this.language&&this.datatype.equals(e.datatype)}};t_.Literal=Uh;Uh.RDF_LANGUAGE_STRING=new tM.NamedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString");Uh.XSD_STRING=new tM.NamedNode("http://www.w3.org/2001/XMLSchema#string")});var MA=T(r_=>{"use strict";Object.defineProperty(r_,"__esModule",{value:!0});r_.Quad=void 0;var kA=class{static{a(this,"Quad")}constructor(e,t,n,i){this.termType="Quad",this.value="",this.subject=e,this.predicate=t,this.object=n,this.graph=i}equals(e){return!!e&&(e.termType==="Quad"||!e.termType)&&this.subject.equals(e.subject)&&this.predicate.equals(e.predicate)&&this.object.equals(e.object)&&this.graph.equals(e.graph)}};r_.Quad=kA});var jA=T(n_=>{"use strict";Object.defineProperty(n_,"__esModule",{value:!0});n_.Variable=void 0;var $A=class{static{a(this,"Variable")}constructor(e){this.termType="Variable",this.value=e}equals(e){return!!e&&e.termType==="Variable"&&e.value===this.value}};n_.Variable=$A});var nM=T(i_=>{"use strict";Object.defineProperty(i_,"__esModule",{value:!0});i_.DataFactory=void 0;var lee=FA(),uee=LA(),rM=NA(),fee=e_(),dee=MA(),pee=jA(),hee=0,BA=class{static{a(this,"DataFactory")}constructor(e){this.blankNodeCounter=0,e=e||{},this.blankNodePrefix=e.blankNodePrefix||`df_${hee++}_`}namedNode(e){return new fee.NamedNode(e)}blankNode(e){return new lee.BlankNode(e||`${this.blankNodePrefix}${this.blankNodeCounter++}`)}literal(e,t){return new rM.Literal(e,t)}variable(e){return new pee.Variable(e)}defaultGraph(){return uee.DefaultGraph.INSTANCE}quad(e,t,n,i){return new dee.Quad(e,t,n,i||this.defaultGraph())}fromTerm(e){switch(e.termType){case"NamedNode":return this.namedNode(e.value);case"BlankNode":return this.blankNode(e.value);case"Literal":return e.language?this.literal(e.value,e.language):e.datatype.equals(rM.Literal.XSD_STRING)?this.literal(e.value):this.literal(e.value,this.fromTerm(e.datatype));case"Variable":return this.variable(e.value);case"DefaultGraph":return this.defaultGraph();case"Quad":return this.quad(this.fromTerm(e.subject),this.fromTerm(e.predicate),this.fromTerm(e.object),this.fromTerm(e.graph))}}fromQuad(e){return this.fromTerm(e)}resetBlankNodeCounter(){this.blankNodeCounter=0}};i_.DataFactory=BA});var iM=T(Qi=>{"use strict";var mee=Qi&&Qi.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:a(function(){return e[t]},"get")}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),tu=Qi&&Qi.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&mee(e,r,t)};Object.defineProperty(Qi,"__esModule",{value:!0});tu(FA(),Qi);tu(nM(),Qi);tu(LA(),Qi);tu(NA(),Qi);tu(e_(),Qi);tu(MA(),Qi);tu(jA(),Qi)});var oM=T((f2e,sM)=>{var{Parser:Ea}=Qk(),{Generator:gee}=eM(),{Wildcard:yee}=xA(),{DataFactory:_ee}=iM();function bee({prefixes:r,baseIRI:e,factory:t,pathOnly:n,sparqlStar:i,skipValidation:s,skipUngroupedVariableCheck:o}={}){let c={};for(let u in r??{})c[u]=r[u];let l=new Ea;return l.parse=function(){return Ea.base=e||"",Ea.prefixes=Object.create(c),Ea.factory=t||new _ee,Ea.sparqlStar=!!i,Ea.pathOnly=!!n,Ea.skipValidation=!!s||!!o,Ea.prototype.parse.apply(l,arguments)},l._resetBlanks=Ea._resetBlanks,l}a(bee,"_Parser");sM.exports={Parser:bee,Generator:gee,Wildcard:yee}});var VA=T(Of=>{"use strict";Object.defineProperty(Of,"__esModule",{value:!0});Of.CaseWhenTransformerError=Of.CaseWhenTransformer=void 0;var UA=class{static{a(this,"CaseWhenTransformer")}transform(e){let t=this.stripLineComments(e),n,i=0,s=100;do if(n=t,t=this.transformSinglePass(t),i++,i>s)throw new va("Too many nested CASE expressions (max 100 iterations)");while(t!==n);return t}stripLineComments(e){let t="",n=0;for(;n<e.length;){let i=e[n];if(i==="'"||i==='"'){let s=i;for(t+=i,n++;n<e.length&&e[n]!==s;){if(e[n]==="\\"&&n+1<e.length){t+=e[n]+e[n+1],n+=2;continue}t+=e[n],n++}n<e.length&&(t+=e[n],n++);continue}if(i==="<"){let s=e.indexOf(">",n),o=e.indexOf(`
95
+ `,this._explicitDatatype=!!r.explicitDatatype}a(ir,"Generator");ir.prototype.toQuery=function(r){var e="";return r.queryType&&(e+=r.queryType.toUpperCase()+" "),r.reduced&&(e+="REDUCED "),r.distinct&&(e+="DISTINCT "),r.variables?e+=Yi(r.variables,void 0,function(t){return/^[?$]/.test(t)?t:Rc(t)?this.toEntity(t):"("+this.toExpression(t.expression)+" AS "+Q0(t.variable)+")"},this)+" ":r.template&&(e+=this.group(r.template,!0)+this._newline),r.from&&(e+=this.graphs("FROM ",r.from.default)+this.graphs("FROM NAMED ",r.from.named)),r.where&&(e+="WHERE "+this.group(r.where,!0)+this._newline),r.updates&&(e+=Yi(r.updates,";"+this._newline,this.toUpdate,this)),r.group&&(e+="GROUP BY "+Yi(r.group,void 0,function(t){var n=Rc(t.expression)?this.toEntity(t.expression):"("+this.toExpression(t.expression)+")";return t.variable?"("+n+" AS "+Q0(t.variable)+")":n},this)+this._newline),r.having&&(e+="HAVING ("+Yi(r.having,void 0,this.toExpression,this)+")"+this._newline),r.order&&(e+="ORDER BY "+Yi(r.order,void 0,function(t){var n="("+this.toExpression(t.expression)+")";return t.descending?"DESC "+n:n},this)+this._newline),Number.isInteger(r.offset)&&(e+="OFFSET "+r.offset+this._newline),Number.isInteger(r.limit)&&(e+="LIMIT "+r.limit+this._newline),r.values&&(e+=this.values(r)),e=this.baseAndPrefixes(r)+e,e.trim()};ir.prototype.baseAndPrefixes=function(r){var e=r.base?"BASE <"+r.base+">"+this._newline:"",t="";for(var n in r.prefixes)(this._options.allPrefixes||this._usedPrefixes[n])&&(t+="PREFIX "+n+": <"+r.prefixes[n]+">"+this._newline);return e+t};ir.prototype.toPattern=function(r){var e=r.type||r instanceof Array&&"array"||(r.subject&&r.predicate&&r.object?"triple":"");if(!(e in this))throw new Error("Unknown entry type: "+e);return this[e](r)};ir.prototype.triple=function(r){return this.toEntity(r.subject)+" "+this.toEntity(r.predicate)+" "+this.toEntity(r.object)+"."};ir.prototype.array=function(r){return Yi(r,this._newline,this.toPattern,this)};ir.prototype.bgp=function(r){return this.encodeTriples(r.triples)};ir.prototype.encodeTriples=function(r){if(!r.length)return"";for(var e=[],t=void 0,n=void 0,i=0;i<r.length;i++){var s=r[i];eu(s.subject,t)?eu(s.predicate,n)?e.push(","):(n=s.predicate,e.push(";"+this._newline,this._indent,this.toEntity(n))):(t&&e.push("."+this._newline),t=s.subject,n=s.predicate,e.push(this.toEntity(t)," ",this.toEntity(n))),e.push(" ",this.toEntity(s.object))}return e.push("."),e.join("")};ir.prototype.graph=function(r){return"GRAPH "+this.toEntity(r.name)+" "+this.group(r)};ir.prototype.graphs=function(r,e){return!e||e.length===0?"":Yi(e,"",function(t){return r+this.toEntity(t)+this._newline},this)};ir.prototype.group=function(r,e){return r=e!==!0?this.array(r.patterns||r.triples):this.toPattern(r.type!=="group"?r:r.patterns),r.indexOf(this._newline)===-1?"{ "+r+" }":"{"+this._newline+this.indent(r)+this._newline+"}"};ir.prototype.query=function(r){return this.toQuery(r)};ir.prototype.filter=function(r){return"FILTER("+this.toExpression(r.expression)+")"};ir.prototype.bind=function(r){return"BIND("+this.toExpression(r.expression)+" AS "+Q0(r.variable)+")"};ir.prototype.optional=function(r){return"OPTIONAL "+this.group(r)};ir.prototype.union=function(r){return Yi(r.patterns,this._newline+"UNION"+this._newline,function(e){return this.group(e,!0)},this)};ir.prototype.minus=function(r){return"MINUS "+this.group(r)};ir.prototype.values=function(r){var e=Object.keys(r.values.reduce(function(i,s){for(var o in s)i[o]=!0;return i},{})),t,n;return e.length===1?t=n="":(t="(",n=")"),"VALUES "+t+e.join(" ")+n+" {"+this._newline+Yi(r.values,this._newline,function(i){return" "+t+Yi(e,void 0,function(s){return i[s]?this.toEntity(i[s]):"UNDEF"},this)+n},this)+this._newline+"}"};ir.prototype.service=function(r){return"SERVICE "+(r.silent?"SILENT ":"")+this.toEntity(r.name)+" "+this.group(r)};ir.prototype.toExpression=function(r){if(Rc(r))return this.toEntity(r);switch(r.type.toLowerCase()){case"aggregate":return r.aggregation.toUpperCase()+"("+(r.distinct?"DISTINCT ":"")+this.toExpression(r.expression)+(typeof r.separator=="string"?'; SEPARATOR = "'+r.separator.replace(Xk,Jk)+'"':"")+")";case"functioncall":return this.toEntity(r.function)+"("+Yi(r.args,", ",this.toExpression,this)+")";case"operation":var e=r.operator.toUpperCase(),t=r.args||[];switch(r.operator.toLowerCase()){case"<":case">":case">=":case"<=":case"&&":case"||":case"=":case"!=":case"+":case"-":case"*":case"/":return(Rc(t[0])?this.toEntity(t[0]):"("+this.toExpression(t[0])+")")+" "+e+" "+(Rc(t[1])?this.toEntity(t[1]):"("+this.toExpression(t[1])+")");case"!":return"!("+this.toExpression(t[0])+")";case"uplus":return"+("+this.toExpression(t[0])+")";case"uminus":return"-("+this.toExpression(t[0])+")";case"notin":e="NOT IN";case"in":return this.toExpression(t[0])+" "+e+"("+(jh(t[1])?t[1]:Yi(t[1],", ",this.toExpression,this))+")";case"notexists":e="NOT EXISTS";case"exists":return e+" "+this.group(t[0],!0);default:return e+"("+Yi(t,", ",this.toExpression,this)+")"}default:throw new Error("Unknown expression type: "+r.type)}};ir.prototype.toEntity=function(r){if(Rc(r))switch(r.termType){case"Wildcard":return"*";case"Variable":return Q0(r);case"BlankNode":return"_:"+r.value;case"Literal":var e=r.value||"",t=r.language||"",n=r.datatype;if(r='"'+e.replace(Xk,Jk)+'"',t)r+="@"+t;else if(n){if(!this._explicitDatatype)switch(n.value){case oee:return r;case see:if(/^\d+$/.test(e))return e+" "}r+="^^"+this.encodeIRI(n.value)}return r;case"Quad":if(!this._sparqlStar)throw new Error("SPARQL* support is not enabled");return r.graph&&r.graph.termType!=="DefaultGraph"?"<< GRAPH "+this.toEntity(r.graph)+" { "+this.toEntity(r.subject)+" "+this.toEntity(r.predicate)+" "+this.toEntity(r.object)+" } >>":"<< "+this.toEntity(r.subject)+" "+this.toEntity(r.predicate)+" "+this.toEntity(r.object)+" >>";default:return this.encodeIRI(r.value)}else{var i=r.items.map(this.toEntity,this),s=r.pathType;switch(s){case"^":case"!":return s+i[0];case"*":case"+":case"?":return"("+i[0]+s+")";default:return"("+i.join(s)+")"}}};var Xk=/["\\\t\n\r\b\f]/g,Jk=a(function(r){return aee[r]},"escapeReplacer"),aee={"\\":"\\\\",'"':'\\"'," ":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"};ir.prototype.encodeIRI=function(r){var e=this._prefixRegex.exec(r);if(e){var t=this._prefixByIri[e[1]];return this._usedPrefixes[t]=!0,t+":"+e[2]}return"<"+r+">"};ir.prototype.toUpdate=function(r){switch(r.type||r.updateType){case"load":return"LOAD"+(r.source?" "+this.toEntity(r.source):"")+(r.destination?" INTO GRAPH "+this.toEntity(r.destination):"");case"insert":return"INSERT DATA "+this.group(r.insert,!0);case"delete":return"DELETE DATA "+this.group(r.delete,!0);case"deletewhere":return"DELETE WHERE "+this.group(r.delete,!0);case"insertdelete":return(r.graph?"WITH "+this.toEntity(r.graph)+this._newline:"")+(r.delete.length?"DELETE "+this.group(r.delete,!0)+this._newline:"")+(r.insert.length?"INSERT "+this.group(r.insert,!0)+this._newline:"")+(r.using?this.graphs("USING ",r.using.default):"")+(r.using?this.graphs("USING NAMED ",r.using.named):"")+"WHERE "+this.group(r.where,!0);case"add":case"copy":case"move":return r.type.toUpperCase()+" "+(r.silent?"SILENT ":"")+(r.source.default?"DEFAULT":this.toEntity(r.source.name))+" TO "+this.toEntity(r.destination.name);case"create":case"clear":case"drop":return r.type.toUpperCase()+(r.silent?" SILENT ":" ")+(r.graph.default?"DEFAULT":r.graph.named?"NAMED":r.graph.all?"ALL":"GRAPH "+this.toEntity(r.graph.name));default:throw new Error("Unknown update query type: "+r.type)}};ir.prototype.indent=function(r){return r.replace(/^/gm,this._indent)};function Q0(r){return"?"+r.value}a(Q0,"variableToString");function jh(r){return typeof r=="string"}a(jh,"isString");function Rc(r){return typeof r.termType=="string"}a(Rc,"isTerm");function eu(r,e){if(!r||!Rc(r)||!e||!Rc(e)||r.termType!==e.termType)return!1;switch(r.termType){case"Literal":return r.value===e.value&&r.language===e.language&&eu(r.datatype,e.datatype);case"Quad":return eu(r.subject,e.subject)&&eu(r.predicate,e.predicate)&&eu(r.object,e.object)&&eu(r.graph,e.graph);default:return r.value===e.value}}a(eu,"equalTerms");function Yi(r,e,t,n){return r.map(t,n).join(jh(e)?e:" ")}a(Yi,"mapJoin");function cee(r={}){return{stringify:a(function(e){var t=Object.create(r);return t.prefixes=e.prefixes,new ir(t).toQuery(e)},"stringify"),createGenerator:a(function(){return new ir(r)},"createGenerator")}}a(cee,"_Generator");Zk.exports={Generator:cee}});var FA=T(X0=>{"use strict";Object.defineProperty(X0,"__esModule",{value:!0});X0.BlankNode=void 0;var PA=class{static{a(this,"BlankNode")}constructor(e){this.termType="BlankNode",this.value=e}equals(e){return!!e&&e.termType==="BlankNode"&&e.value===this.value}};X0.BlankNode=PA});var LA=T(J0=>{"use strict";Object.defineProperty(J0,"__esModule",{value:!0});J0.DefaultGraph=void 0;var Bh=class{static{a(this,"DefaultGraph")}constructor(){this.termType="DefaultGraph",this.value=""}equals(e){return!!e&&e.termType==="DefaultGraph"}};J0.DefaultGraph=Bh;Bh.INSTANCE=new Bh});var e_=T(Z0=>{"use strict";Object.defineProperty(Z0,"__esModule",{value:!0});Z0.NamedNode=void 0;var DA=class{static{a(this,"NamedNode")}constructor(e){this.termType="NamedNode",this.value=e}equals(e){return!!e&&e.termType==="NamedNode"&&e.value===this.value}};Z0.NamedNode=DA});var NA=T(t_=>{"use strict";Object.defineProperty(t_,"__esModule",{value:!0});t_.Literal=void 0;var tM=e_(),Uh=class r{static{a(this,"Literal")}constructor(e,t){this.termType="Literal",this.value=e,typeof t=="string"?(this.language=t,this.datatype=r.RDF_LANGUAGE_STRING):t?(this.language="",this.datatype=t):(this.language="",this.datatype=r.XSD_STRING)}equals(e){return!!e&&e.termType==="Literal"&&e.value===this.value&&e.language===this.language&&this.datatype.equals(e.datatype)}};t_.Literal=Uh;Uh.RDF_LANGUAGE_STRING=new tM.NamedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString");Uh.XSD_STRING=new tM.NamedNode("http://www.w3.org/2001/XMLSchema#string")});var MA=T(r_=>{"use strict";Object.defineProperty(r_,"__esModule",{value:!0});r_.Quad=void 0;var kA=class{static{a(this,"Quad")}constructor(e,t,n,i){this.termType="Quad",this.value="",this.subject=e,this.predicate=t,this.object=n,this.graph=i}equals(e){return!!e&&(e.termType==="Quad"||!e.termType)&&this.subject.equals(e.subject)&&this.predicate.equals(e.predicate)&&this.object.equals(e.object)&&this.graph.equals(e.graph)}};r_.Quad=kA});var jA=T(n_=>{"use strict";Object.defineProperty(n_,"__esModule",{value:!0});n_.Variable=void 0;var $A=class{static{a(this,"Variable")}constructor(e){this.termType="Variable",this.value=e}equals(e){return!!e&&e.termType==="Variable"&&e.value===this.value}};n_.Variable=$A});var nM=T(i_=>{"use strict";Object.defineProperty(i_,"__esModule",{value:!0});i_.DataFactory=void 0;var lee=FA(),uee=LA(),rM=NA(),fee=e_(),dee=MA(),pee=jA(),hee=0,BA=class{static{a(this,"DataFactory")}constructor(e){this.blankNodeCounter=0,e=e||{},this.blankNodePrefix=e.blankNodePrefix||`df_${hee++}_`}namedNode(e){return new fee.NamedNode(e)}blankNode(e){return new lee.BlankNode(e||`${this.blankNodePrefix}${this.blankNodeCounter++}`)}literal(e,t){return new rM.Literal(e,t)}variable(e){return new pee.Variable(e)}defaultGraph(){return uee.DefaultGraph.INSTANCE}quad(e,t,n,i){return new dee.Quad(e,t,n,i||this.defaultGraph())}fromTerm(e){switch(e.termType){case"NamedNode":return this.namedNode(e.value);case"BlankNode":return this.blankNode(e.value);case"Literal":return e.language?this.literal(e.value,e.language):e.datatype.equals(rM.Literal.XSD_STRING)?this.literal(e.value):this.literal(e.value,this.fromTerm(e.datatype));case"Variable":return this.variable(e.value);case"DefaultGraph":return this.defaultGraph();case"Quad":return this.quad(this.fromTerm(e.subject),this.fromTerm(e.predicate),this.fromTerm(e.object),this.fromTerm(e.graph))}}fromQuad(e){return this.fromTerm(e)}resetBlankNodeCounter(){this.blankNodeCounter=0}};i_.DataFactory=BA});var iM=T(Qi=>{"use strict";var mee=Qi&&Qi.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:a(function(){return e[t]},"get")}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),tu=Qi&&Qi.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&mee(e,r,t)};Object.defineProperty(Qi,"__esModule",{value:!0});tu(FA(),Qi);tu(nM(),Qi);tu(LA(),Qi);tu(NA(),Qi);tu(e_(),Qi);tu(MA(),Qi);tu(jA(),Qi)});var oM=T((fxe,sM)=>{var{Parser:Ea}=Qk(),{Generator:gee}=eM(),{Wildcard:yee}=xA(),{DataFactory:_ee}=iM();function bee({prefixes:r,baseIRI:e,factory:t,pathOnly:n,sparqlStar:i,skipValidation:s,skipUngroupedVariableCheck:o}={}){let c={};for(let u in r??{})c[u]=r[u];let l=new Ea;return l.parse=function(){return Ea.base=e||"",Ea.prefixes=Object.create(c),Ea.factory=t||new _ee,Ea.sparqlStar=!!i,Ea.pathOnly=!!n,Ea.skipValidation=!!s||!!o,Ea.prototype.parse.apply(l,arguments)},l._resetBlanks=Ea._resetBlanks,l}a(bee,"_Parser");sM.exports={Parser:bee,Generator:gee,Wildcard:yee}});var VA=T(Of=>{"use strict";Object.defineProperty(Of,"__esModule",{value:!0});Of.CaseWhenTransformerError=Of.CaseWhenTransformer=void 0;var UA=class{static{a(this,"CaseWhenTransformer")}transform(e){let t=this.stripLineComments(e),n,i=0,s=100;do if(n=t,t=this.transformSinglePass(t),i++,i>s)throw new va("Too many nested CASE expressions (max 100 iterations)");while(t!==n);return t}stripLineComments(e){let t="",n=0;for(;n<e.length;){let i=e[n];if(i==="'"||i==='"'){let s=i;for(t+=i,n++;n<e.length&&e[n]!==s;){if(e[n]==="\\"&&n+1<e.length){t+=e[n]+e[n+1],n+=2;continue}t+=e[n],n++}n<e.length&&(t+=e[n],n++);continue}if(i==="<"){let s=e.indexOf(">",n),o=e.indexOf(`
96
96
  `,n);if(s!==-1&&(o===-1||s<o)){t+=e.substring(n,s+1),n=s+1;continue}}if(i==="#"){let s=e.indexOf(`
97
97
  `,n),o=s===-1?e.length:s;t+=" ".repeat(o-n),n=o;continue}t+=i,n++}return t}transformSinglePass(e){let t=this.findCasePositions(e);if(t.length===0)return e;let n=e;for(let i=t.length-1;i>=0;i--){let s=t[i],o=this.extractCaseExpression(n,s);if(o){let c=this.convertCaseToIf(o.content);n=n.substring(0,s)+c+n.substring(s+o.length)}}return n}findCasePositions(e){let t=[],n=e.toUpperCase(),i=0;for(;i<e.length;){if(e[i]==="'"||e[i]==='"'){let s=e[i];for(i++;i<e.length&&e[i]!==s;)e[i]==="\\"&&i++,i++;i++;continue}if(n.substring(i,i+4)==="CASE"&&this.isWordBoundary(e,i,4)){t.push(i),i+=4;continue}i++}return t}extractCaseExpression(e,t){let n=1,i=t+4,s=e.toUpperCase();for(;i<e.length&&n>0;){if(e[i]==="'"||e[i]==='"'){let o=e[i];for(i++;i<e.length&&e[i]!==o;)e[i]==="\\"&&i++,i++;i++;continue}if(s.substring(i,i+4)==="CASE"&&this.isWordBoundary(e,i,4)){n++,i+=4;continue}if(s.substring(i,i+3)==="END"&&this.isWordBoundary(e,i,3)){if(n--,n===0){let o=e.substring(t,i+3);return{content:o,length:o.length}}i+=3;continue}i++}if(n>0)throw new va(`Unclosed CASE expression at position ${t}`);return null}isWordBoundary(e,t,n){let i=t>0?e[t-1]:"",s=t===0||!/[a-zA-Z0-9_?$]/.test(i),o=t+n<e.length?e[t+n]:"",c=t+n>=e.length||!/[a-zA-Z0-9_]/.test(o);return s&&c}convertCaseToIf(e){let t=this.extractWhenClauses(e),n=this.extractElseClause(e);if(t.length===0)throw new va("CASE expression must have at least one WHEN clause");let i=n!==null?n:'""';for(let s=t.length-1;s>=0;s--){let{condition:o,result:c}=t[s];i=`IF(${o}, ${c}, ${i})`}return i}extractWhenClauses(e){let t=[],n=e.replace(/^\s*CASE\s+/i,"").replace(/\s*END\s*$/i,""),i=this.findKeywordPositions(n,"WHEN"),s=this.findKeywordPositions(n,"ELSE"),o=s.length>0?s[0]:n.length;for(let c=0;c<i.length;c++){let l=i[c]+4,u=c+1<i.length?i[c+1]:o,f=n.substring(l,u).trim(),d=this.parseWhenClause(f);d&&t.push(d)}return t}findKeywordPositions(e,t){let n=[],i=e.toUpperCase(),s=0,o=0;for(;s<e.length;){let c=e[s];if(c==="'"||c==='"'){let l=c;for(s++;s<e.length&&e[s]!==l;)e[s]==="\\"&&s++,s++;s++;continue}if(c==="("){o++,s++;continue}if(c===")"){o--,s++;continue}if(o===0&&i.substring(s,s+t.length)===t&&this.isWordBoundary(e,s,t.length)){n.push(s),s+=t.length;continue}s++}return n}parseWhenClause(e){let t=this.findKeywordPositions(e,"THEN");if(t.length===0)throw new va(`WHEN clause missing THEN keyword: ${e.substring(0,50)}...`);let n=t[0],i=e.substring(0,n).trim(),s=e.substring(n+4).trim();if(!i)throw new va("WHEN clause has empty condition");if(!s)throw new va("WHEN clause has empty result");return{condition:i,result:s}}extractElseClause(e){let t=e.replace(/^\s*CASE\s+/i,"").replace(/\s*END\s*$/i,""),n=this.findKeywordPositions(t,"ELSE");if(n.length>0){let i=n[0];return t.substring(i+4).trim()}return null}};Of.CaseWhenTransformer=UA;var va=class extends Error{static{a(this,"CaseWhenTransformerError")}constructor(e){super(`CASE WHEN transformation error: ${e}`),this.name="CaseWhenTransformerError"}};Of.CaseWhenTransformerError=va});var GA=T(xf=>{"use strict";Object.defineProperty(xf,"__esModule",{value:!0});xf.LateralTransformerError=xf.LateralTransformer=void 0;var s_=class r{static{a(this,"LateralTransformer")}transform(e){let t=e,n,i=0,s=100;do if(n=t,t=this.transformSinglePass(t),i++,i>s)throw new Cc("Too many nested LATERAL joins (max 100 iterations)");while(t!==n);return t}hasLateral(e){return this.findLateralPositions(e).length>0}static isLateralJoin(e){if(e.type==="group"&&e.patterns){for(let t of e.patterns)if(t.type==="query"&&t.queryType==="SELECT"&&t.variables&&Array.isArray(t.variables)){for(let n of t.variables)if(n.termType==="Variable"&&n.value===r.LATERAL_MARKER)return!0}}if(e.type==="query"&&e.queryType==="SELECT"&&e.variables&&Array.isArray(e.variables)){for(let t of e.variables)if(t.termType==="Variable"&&t.value===r.LATERAL_MARKER)return!0}return!1}transformSinglePass(e){let t=this.findLateralPositions(e);if(t.length===0)return e;let n=e;for(let i=t.length-1;i>=0;i--){let s=t[i],o=this.extractLateralExpression(n,s);if(o){let c=this.transformLateral(o.content);n=n.substring(0,s)+c+n.substring(s+o.length)}}return n}findLateralPositions(e){let t=[],n=e.toUpperCase(),i=0;for(;i<e.length;){if(e[i]==="'"||e[i]==='"'){let s=e[i];for(i++;i<e.length&&e[i]!==s;)e[i]==="\\"&&i++,i++;i++;continue}if(e[i]==="#"){for(;i<e.length&&e[i]!==`
98
98
  `;)i++;continue}if(n.substring(i,i+7)==="LATERAL"&&this.isWordBoundary(e,i,7)){t.push(i),i+=7;continue}i++}return t}extractLateralExpression(e,t){let n=t+7;for(;n<e.length&&/\s/.test(e[n]);)n++;if(e[n]!=="{")throw new Cc(`Expected '{' after LATERAL keyword at position ${t}`);let i=1;for(n++;n<e.length&&i>0;){if(e[n]==="'"||e[n]==='"'){let s=e[n];for(n++;n<e.length&&e[n]!==s;)e[n]==="\\"&&n++,n++;n++;continue}if(e[n]==="#"){for(;n<e.length&&e[n]!==`
@@ -100,7 +100,7 @@ Expecting `+Py.join(", ")+", got '"+(this.terminals_[$t]||$t)+"'":hT="Parse erro
100
100
  `)+`
101
101
  `+s.trimStart()),s}findPrefixStarDeclarations(e){let t=[],n=e.toUpperCase(),i=0;for(;i<e.length;){if(e[i]==="'"||e[i]==='"'){let s=e[i];for(i++;i<e.length&&e[i]!==s;)e[i]==="\\"&&i++,i++;i++;continue}if(n.substring(i,i+6)==="PREFIX"){let s=i;for(i+=6;i<e.length&&/\s/.test(e[i]);)i++;if(e[i]==="*"){for(i++;i<e.length&&/\s/.test(e[i]);)i++;if(e[i]==="<"){i++;let o=i;for(;i<e.length&&e[i]!==">";)i++;if(e[i]===">"){let c=e.substring(o,i);i++;let l=this.findDeclarationEnd(e,i);t.push({uri:c,startPos:s,endPos:l}),i=l;continue}else throw new Pf(`Unclosed IRI in PREFIX* declaration at position ${o}`)}else throw new Pf(`Expected IRI after PREFIX* at position ${i}`)}else continue}i++}return t}findDeclarationEnd(e,t){let n=t;for(;n<e.length;){let i=e[n];if(i===`
102
102
  `)return n+1;let s=e.substring(n).toUpperCase();if(s.startsWith("PREFIX")||s.startsWith("BASE")||s.startsWith("SELECT")||s.startsWith("CONSTRUCT")||s.startsWith("DESCRIBE")||s.startsWith("ASK"))return n;if(/\s/.test(i)){n++;continue}break}return n}extractPrefixFromUri(e){let t=e.replace(/^https?:\/\//,"");t=t.replace(/\/$/,"").replace(/#$/,"");let n=t.split(/[/.#]+/).filter(Boolean);if(n.length===0)return null;let i=n[n.length-1];return/^(ontology|vocab|schema|ns|core)$/i.test(i)&&n.length>1?n[n.length-2].toLowerCase():i.toLowerCase().replace(/[^a-z0-9]/g,"")}};Oc.PrefixStarTransformer=qA;var Pf=class extends Error{static{a(this,"PrefixStarTransformerError")}constructor(e){super(`PREFIX* transformation error: ${e}`),this.name="PrefixStarTransformerError"}};Oc.PrefixStarTransformerError=Pf});var WA=T(Lf=>{"use strict";Object.defineProperty(Lf,"__esModule",{value:!0});Lf.DescribeOptionsTransformer=Lf.DescribeOptionsTransformerError=void 0;var a_=class extends Error{static{a(this,"DescribeOptionsTransformerError")}constructor(e){super(e),this.name="DescribeOptionsTransformerError"}};Lf.DescribeOptionsTransformerError=a_;var Ff=class r{static{a(this,"DescribeOptionsTransformer")}transform(e){if(!r.DESCRIBE_QUERY_PATTERN.test(e))return{query:e};let t=e,n={},i=!1,s=r.DEPTH_PATTERN.exec(e);if(s){let o=parseInt(s[1],10);if(o<0)throw new a_(`DESCRIBE DEPTH must be a non-negative integer, got: ${o}`);n.depth=o,i=!0,r.DEPTH_PATTERN.lastIndex=0,t=t.replace(r.DEPTH_PATTERN,"")}return r.DEPTH_PATTERN.lastIndex=0,r.SYMMETRIC_PATTERN.test(e)&&(n.symmetric=!0,i=!0,r.SYMMETRIC_PATTERN.lastIndex=0,t=t.replace(r.SYMMETRIC_PATTERN,"")),r.SYMMETRIC_PATTERN.lastIndex=0,t=t.replace(/\s{2,}/g," ").trim(),{query:t,options:i?n:void 0}}hasDescribeOptions(e){let t=r.DEPTH_PATTERN.test(e);r.DEPTH_PATTERN.lastIndex=0;let n=r.SYMMETRIC_PATTERN.test(e);return r.SYMMETRIC_PATTERN.lastIndex=0,t||n}};Lf.DescribeOptionsTransformer=Ff;Ff.DEPTH_PATTERN=/\bDEPTH\s+(\d+)/gi;Ff.SYMMETRIC_PATTERN=/\bSYMMETRIC\b/gi;Ff.DESCRIBE_QUERY_PATTERN=/\bDESCRIBE\b/i});var cM=T(Df=>{"use strict";Object.defineProperty(Df,"__esModule",{value:!0});Df.DirectionalLangTagTransformerError=Df.DirectionalLangTagTransformer=void 0;var c_=class r{static{a(this,"DirectionalLangTagTransformer")}constructor(){this.directionMappings=new Map}transform(e){return this.directionMappings.clear(),e.replace(r.DIRECTIONAL_TAG_REGEX,(t,n,i,s,o)=>{let c=s.toLowerCase();return this.directionMappings.set(c,o),`${n}${i}${n}@${s}`})}getDirection(e){return this.directionMappings.get(e.toLowerCase())}getAllMappings(){return new Map(this.directionMappings)}hasDirectionalTags(e){return r.DIRECTIONAL_TAG_REGEX.lastIndex=0,r.DIRECTIONAL_TAG_REGEX.test(e)}clearMappings(){this.directionMappings.clear()}};Df.DirectionalLangTagTransformer=c_;c_.DIRECTIONAL_TAG_REGEX=/(["'])((?:[^\\]|\\.)*?)\1@([a-zA-Z]+(?:-[a-zA-Z0-9]+)*)--(ltr|rtl)/g;var KA=class extends Error{static{a(this,"DirectionalLangTagTransformerError")}constructor(e){super(`Directional language tag transformation error: ${e}`),this.name="DirectionalLangTagTransformerError"}};Df.DirectionalLangTagTransformerError=KA});var lM=T(kf=>{"use strict";Object.defineProperty(kf,"__esModule",{value:!0});kf.TripleTermTransformerError=kf.TripleTermTransformer=void 0;var zA=class{static{a(this,"TripleTermTransformer")}transform(e){let t=e,n,i=0,s=100;do if(n=t,t=this.transformSinglePass(t),i++,i>s)throw new Nf("Too many nested triple terms (max 100 iterations)");while(t!==n);return t}hasTripleTermSyntax(e){return this.findTripleTermPositions(e).length>0}transformSinglePass(e){let t=this.findTripleTermPositions(e);if(t.length===0)return e;let n=e;for(let i=t.length-1;i>=0;i--){let s=t[i],o=this.extractTripleTerm(n,s);if(o){let c=this.convertToStandardSyntax(o.content);n=n.substring(0,s)+c+n.substring(s+o.length)}}return n}findTripleTermPositions(e){let t=[],n=0;for(;n<e.length;){if(e[n]==="'"){n=this.skipStringLiteral(e,n,"'");continue}if(e[n]==='"'){n=this.skipStringLiteral(e,n,'"');continue}if(e.substring(n,n+2)==="<<"&&this.isParenthesizedTripleTerm(e,n)){t.push(n),n+=2;continue}n++}return t}skipStringLiteral(e,t,n){let i=n.repeat(3);if(e.substring(t,t+3)===i){for(t+=3;t<e.length;){if(e.substring(t,t+3)===i)return t+3;e[t]==="\\"&&t++,t++}return t}for(t++;t<e.length&&e[t]!==n;)e[t]==="\\"&&t++,t++;return t+1}isParenthesizedTripleTerm(e,t){let n=t+2;for(;n<e.length&&/\s/.test(e[n]);)n++;return e[n]==="("}extractTripleTerm(e,t){let n=t+2;for(;n<e.length&&/\s/.test(e[n]);)n++;if(e[n]!=="(")return null;n++;let i=1;for(;n<e.length&&i>0;){if(e[n]==="'"||e[n]==='"'){n=this.skipStringLiteral(e,n,e[n]);continue}if(e.substring(n,n+2)==="<<"&&this.isParenthesizedTripleTerm(e,n)){for(n+=2;n<e.length&&/\s/.test(e[n]);)n++;e[n]==="("&&(i++,n++);continue}if(e.substring(n,n+2)==="<<"){n+=2;let s=1;for(;n<e.length&&s>0;){if(e[n]==="'"||e[n]==='"'){n=this.skipStringLiteral(e,n,e[n]);continue}if(e.substring(n,n+2)==="<<"){s++,n+=2;continue}if(e.substring(n,n+2)===">>"){s--,n+=2;continue}n++}continue}if(e[n]==="("){i++,n++;continue}if(e[n]===")"){let s=n+1;for(;s<e.length&&/\s/.test(e[s]);)s++;if(e.substring(s,s+2)===">>"){if(i--,i===0){let o=e.substring(t,s+2);return{content:o,length:o.length}}n=s+2;continue}n++;continue}n++}if(i>0)throw new Nf(`Unclosed triple term at position ${t}: missing )>>`);return null}convertToStandardSyntax(e){let t=e.match(/^<<\s*\(\s*([\s\S]*?)\s*\)\s*>>$/);if(!t)throw new Nf(`Invalid triple term syntax: ${e.substring(0,50)}...`);return`<< ${t[1]} >>`}};kf.TripleTermTransformer=zA;var Nf=class extends Error{static{a(this,"TripleTermTransformerError")}constructor(e){super(`Triple term transformation error: ${e}`),this.name="TripleTermTransformerError"}};kf.TripleTermTransformerError=Nf});var YA=T(l_=>{"use strict";Object.defineProperty(l_,"__esModule",{value:!0});l_.VaultPrefixTransformer=void 0;var See=/PREFIX\s+(\w+)\s*:/gi,wee=new Set(["mailto","http","https","urn","ftp","prefix","base","select","construct","describe","ask","where","filter","optional","union","graph","order","group","having","limit","offset","values","bind","minus","service","insert","delete","load","clear","drop","create","move","copy","add"]),HA=class{static{a(this,"VaultPrefixTransformer")}constructor(){this.vaultPrefixes=new Map}setVaultPrefixes(e){this.vaultPrefixes=new Map(e)}getVaultPrefixes(){return new Map(this.vaultPrefixes)}transform(e){if(this.vaultPrefixes.size===0)return e;let t=this.findDeclaredPrefixes(e),n=[];for(let[o,c]of this.vaultPrefixes)!t.has(o.toLowerCase())&&!wee.has(o.toLowerCase())&&n.push({prefix:o,baseIRI:c});if(n.length===0)return e;let i="",s=0;for(;s<e.length;){let o=e[s];if(o==='"'||o==="'"){let l=this.skipLiteral(e,s);i+=e.substring(s,l),s=l;continue}if(o==="<"){let l=e.indexOf(">",s);l!==-1?(i+=e.substring(s,l+1),s=l+1):(i+=o,s++);continue}if(o==="#"){let l=e.indexOf(`
103
- `,s);l!==-1?(i+=e.substring(s,l),s=l):(i+=e.substring(s),s=e.length);continue}let c=this.tryReplacePrefixedName(e,s,n);if(c){i+=c.iri,s=c.endIndex;continue}i+=o,s++}return i}tryReplacePrefixedName(e,t,n){if(t>0&&/[a-zA-Z0-9_]/.test(e[t-1]))return null;for(let{prefix:i,baseIRI:s}of n){if(e.substring(t,t+i.length+1)!==i+":")continue;let o=t+i.length+1,c=o;for(;c<e.length&&/[a-zA-Z0-9_.%-]/.test(e[c]);)c++;if(c===o)continue;let l=e.substring(o,c);return{iri:`<${s}${l}.md>`,endIndex:c}}return null}findDeclaredPrefixes(e){let t=new Set,n=new RegExp(See.source,"gi"),i;for(;(i=n.exec(e))!==null;)t.add(i[1].toLowerCase());return t}skipLiteral(e,t){let n=e[t];if(t+2<e.length&&e.substring(t,t+3)===n+n+n){let s=e.indexOf(n+n+n,t+3);return s!==-1?s+3:e.length}let i=t+1;for(;i<e.length&&e[i]!==n;)e[i]==="\\"&&i++,i++;return i<e.length?i+1:e.length}};l_.VaultPrefixTransformer=HA});var Mf=T(Di=>{"use strict";var Eee=Di&&Di.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:a(function(){return e[t]},"get")}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),vee=Di&&Di.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Tee=Di&&Di.__importStar||(function(){var r=a(function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)},"ownKeys");return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Eee(t,e,n[i]);return vee(t,e),t}})();Object.defineProperty(Di,"__esModule",{value:!0});Di.SPARQLParser=Di.ExoQLParser=Di.SPARQLParseError=void 0;var uM=Tee(oM()),QA=VA(),XA=GA(),fM=aM(),JA=WA(),Aee=cM(),ZA=lM(),Iee=YA(),Yr=class extends Error{static{a(this,"SPARQLParseError")}constructor(e,t,n,i){super(e,i?{cause:i}:void 0),this.name="SPARQLParseError",this.line=t,this.column=n}};Di.SPARQLParseError=Yr;var u_=class{static{a(this,"ExoQLParser")}constructor(e){this.lastDirectionMappings=new Map,this.parser=new uM.Parser({sparqlStar:!0}),this.generator=new uM.Generator({sparqlStar:!0}),this.caseWhenTransformer=new QA.CaseWhenTransformer,this.lateralTransformer=new XA.LateralTransformer,this.prefixStarTransformer=new fM.PrefixStarTransformer(e?.vocabularyResolver),this.describeOptionsTransformer=new JA.DescribeOptionsTransformer,this.directionalLangTagTransformer=new Aee.DirectionalLangTagTransformer,this.tripleTermTransformer=new ZA.TripleTermTransformer,this.vaultPrefixTransformer=new Iee.VaultPrefixTransformer}setVaultPrefixes(e){this.vaultPrefixTransformer.setVaultPrefixes(e)}parse(e){try{let t=this.vaultPrefixTransformer.transform(e),n=this.describeOptionsTransformer.transform(t);this.lastDescribeOptions=n.options;let i=n.query;i=this.directionalLangTagTransformer.transform(i),this.lastDirectionMappings=this.directionalLangTagTransformer.getAllMappings(),i=this.lateralTransformer.transform(i),i=this.caseWhenTransformer.transform(i),i=this.tripleTermTransformer.transform(i);let s=this.parser.parse(i);return this.validateQuery(s),this.lastDescribeOptions&&this.isDescribeQuery(s)&&(s.describeOptions=this.lastDescribeOptions),s}catch(t){if(t instanceof JA.DescribeOptionsTransformerError)throw new Yr(t.message);if(t instanceof XA.LateralTransformerError)throw new Yr(t.message);if(t instanceof QA.CaseWhenTransformerError)throw new Yr(t.message);if(t instanceof ZA.TripleTermTransformerError)throw new Yr(t.message);if(t instanceof Error){let n=t.message.match(/line (\d+), column (\d+)/),i=n?parseInt(n[1],10):void 0,s=n?parseInt(n[2],10):void 0;throw new Yr(`SPARQL syntax error: ${t.message}`,i,s,t)}throw t}}parseWithOptions(e){return{query:this.parse(e),describeOptions:this.lastDescribeOptions}}getLastDescribeOptions(){return this.lastDescribeOptions}async parseAsync(e){try{let t=this.vaultPrefixTransformer.transform(e),n=this.describeOptionsTransformer.transform(t);this.lastDescribeOptions=n.options;let i=n.query;i=this.directionalLangTagTransformer.transform(i),this.lastDirectionMappings=this.directionalLangTagTransformer.getAllMappings(),i=await this.prefixStarTransformer.transform(i),i=this.lateralTransformer.transform(i),i=this.caseWhenTransformer.transform(i),i=this.tripleTermTransformer.transform(i);let s=this.parser.parse(i);return this.validateQuery(s),this.lastDescribeOptions&&this.isDescribeQuery(s)&&(s.describeOptions=this.lastDescribeOptions),s}catch(t){if(t instanceof JA.DescribeOptionsTransformerError)throw new Yr(t.message);if(t instanceof fM.PrefixStarTransformerError)throw new Yr(t.message);if(t instanceof XA.LateralTransformerError)throw new Yr(t.message);if(t instanceof QA.CaseWhenTransformerError)throw new Yr(t.message);if(t instanceof ZA.TripleTermTransformerError)throw new Yr(t.message);if(t instanceof Error){let n=t.message.match(/line (\d+), column (\d+)/),i=n?parseInt(n[1],10):void 0,s=n?parseInt(n[2],10):void 0;throw new Yr(`SPARQL syntax error: ${t.message}`,i,s,t)}throw t}}async parseAsyncWithOptions(e){return{query:await this.parseAsync(e),describeOptions:this.lastDescribeOptions}}hasPrefixStar(e){return/PREFIX\s*\*/i.test(e)}hasLateral(e){return this.lateralTransformer.hasLateral(e)}hasDescribeOptions(e){return this.describeOptionsTransformer.hasDescribeOptions(e)}hasDirectionalLangTags(e){return this.directionalLangTagTransformer.hasDirectionalTags(e)}hasTripleTermSyntax(e){return this.tripleTermTransformer.hasTripleTermSyntax(e)}getLastDirectionMappings(){return new Map(this.lastDirectionMappings)}getDirectionForLanguage(e){return this.lastDirectionMappings.get(e.toLowerCase())}toString(e){try{return this.generator.stringify(e)}catch(t){throw t instanceof Error?new Yr(`Failed to serialize SPARQL query: ${t.message}`,void 0,void 0,t):t}}getQueryType(e){if("queryType"in e&&e.type==="query")return e.queryType;throw new Yr("Query does not have a valid queryType property")}isSelectQuery(e){return"queryType"in e&&e.type==="query"&&e.queryType==="SELECT"}isConstructQuery(e){return"queryType"in e&&e.type==="query"&&e.queryType==="CONSTRUCT"}isAskQuery(e){return"queryType"in e&&e.type==="query"&&e.queryType==="ASK"}isDescribeQuery(e){return"queryType"in e&&e.type==="query"&&e.queryType==="DESCRIBE"}isUpdateQuery(e){return e.type==="update"}isInsertDataOperation(e){return"updateType"in e&&e.updateType==="insert"}isDeleteDataOperation(e){return"updateType"in e&&e.updateType==="delete"}validateQuery(e){if(!e||typeof e!="object")throw new Yr("Invalid query: not an object");if(e.type!=="query"&&e.type!=="update")throw new Yr(`Invalid type: expected "query" or "update", got "${e.type}"`);if(e.type==="query"){let t=["SELECT","CONSTRUCT","ASK","DESCRIBE"];if(!t.includes(e.queryType))throw new Yr(`Invalid query type: expected one of ${t.join(", ")}, got "${e.queryType}"`)}}};Di.ExoQLParser=u_;Di.SPARQLParser=u_});var ru=T(f_=>{"use strict";Object.defineProperty(f_,"__esModule",{value:!0});f_.AlgebraTranslatorError=void 0;var eI=class extends Error{static{a(this,"AlgebraTranslatorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="AlgebraTranslatorError"}};f_.AlgebraTranslatorError=eI});var d_=T(xo=>{"use strict";Object.defineProperty(xo,"__esModule",{value:!0});xo.isVariableExpression=Ree;xo.isVariableTerm=Cee;xo.isNamedNode=Oee;xo.isLiteral=xee;xo.isPropertyPath=Pee;xo.isAggregateExpression=Fee;xo.isOperationExpression=Lee;xo.isFunctionCallExpression=Dee;function Ree(r){return typeof r=="object"&&r!==null&&"expression"in r&&"variable"in r}a(Ree,"isVariableExpression");function Cee(r){return typeof r=="object"&&r!==null&&"termType"in r&&r.termType==="Variable"}a(Cee,"isVariableTerm");function Oee(r){return typeof r=="object"&&r!==null&&"termType"in r&&r.termType==="NamedNode"}a(Oee,"isNamedNode");function xee(r){return typeof r=="object"&&r!==null&&"termType"in r&&r.termType==="Literal"}a(xee,"isLiteral");function Pee(r){return typeof r=="object"&&r!==null&&"type"in r&&r.type==="path"}a(Pee,"isPropertyPath");function Fee(r){return typeof r=="object"&&r!==null&&"type"in r&&r.type==="aggregate"}a(Fee,"isAggregateExpression");function Lee(r){return typeof r=="object"&&r!==null&&"type"in r&&r.type==="operation"}a(Lee,"isOperationExpression");function Dee(r){return typeof r=="object"&&r!==null&&"type"in r&&(r.type==="functionCall"||r.type==="functioncall")}a(Dee,"isFunctionCallExpression")});var dM=T(p_=>{"use strict";Object.defineProperty(p_,"__esModule",{value:!0});p_.TripleTranslator=void 0;var ui=ru(),tI=class{static{a(this,"TripleTranslator")}constructor(){this.directionMappings=new Map}setDirectionMappings(e){this.directionMappings=e}translateBGP(e){if(!("triples"in e)||!Array.isArray(e.triples))throw new ui.AlgebraTranslatorError("BGP pattern must have triples array");return{type:"bgp",triples:e.triples.map(t=>this.translateTriple(t))}}translateTriple(e){if(!e.subject||!e.predicate||!e.object)throw new ui.AlgebraTranslatorError("Triple must have subject, predicate, and object");return{subject:this.translateTripleElement(e.subject),predicate:this.translatePredicate(e.predicate),object:this.translateTripleElement(e.object)}}translateConstructTemplate(e){return!e||!Array.isArray(e)?[]:e.map(t=>this.translateTriple(t))}translatePredicate(e){return"type"in e&&e.type==="path"?this.translatePropertyPath(e):this.translateTripleElement(e)}translatePropertyPath(e){if(!("pathType"in e)||!e.pathType)throw new ui.AlgebraTranslatorError("Property path must have pathType");if(!("items"in e)||!Array.isArray(e.items))throw new ui.AlgebraTranslatorError("Property path must have items array");let t=e.items.map(n=>this.translatePathItem(n));switch(e.pathType){case"/":return{type:"path",pathType:"/",items:t};case"|":return{type:"path",pathType:"|",items:t};case"^":if(t.length!==1)throw new ui.AlgebraTranslatorError("Inverse path must have exactly one item");return{type:"path",pathType:"^",items:[t[0]]};case"+":if(t.length!==1)throw new ui.AlgebraTranslatorError("OneOrMore path must have exactly one item");return{type:"path",pathType:"+",items:[t[0]]};case"*":if(t.length!==1)throw new ui.AlgebraTranslatorError("ZeroOrMore path must have exactly one item");return{type:"path",pathType:"*",items:[t[0]]};case"?":if(t.length!==1)throw new ui.AlgebraTranslatorError("ZeroOrOne path must have exactly one item");return{type:"path",pathType:"?",items:[t[0]]};default:throw new ui.AlgebraTranslatorError(`Unsupported property path type: ${e.pathType}`)}}translatePathItem(e){if("type"in e&&e.type==="path")return this.translatePropertyPath(e);if("termType"in e&&e.termType==="NamedNode")return{type:"iri",value:e.value};let t="type"in e?e.type:"termType"in e?e.termType:"unknown";throw new ui.AlgebraTranslatorError(`Unsupported path item type: ${String(t)}`)}translateTripleElement(e){if(!e||!("termType"in e))throw new ui.AlgebraTranslatorError("Triple element must have termType");switch(e.termType){case"Variable":return{type:"variable",value:e.value};case"NamedNode":return{type:"iri",value:e.value};case"Literal":{let t={type:"literal",value:e.value,datatype:e.datatype?.value,language:e.language};if(e.language){let n=this.directionMappings.get(e.language.toLowerCase());n&&(t.direction=n)}return t}case"BlankNode":return{type:"blank",value:e.value};case"Quad":return this.translateQuotedTriple(e);default:throw new ui.AlgebraTranslatorError(`Unsupported term type: ${e.termType}`)}}translateQuotedTriple(e){if(!e.subject||!e.predicate||!e.object)throw new ui.AlgebraTranslatorError("Quoted triple must have subject, predicate, and object");return{type:"quoted",subject:this.translateTripleElement(e.subject),predicate:this.translateQuotedTriplePredicate(e.predicate),object:this.translateTripleElement(e.object)}}translateQuotedTriplePredicate(e){if(!e||!("termType"in e))throw new ui.AlgebraTranslatorError("Quoted triple predicate must have termType");switch(e.termType){case"Variable":return{type:"variable",value:e.value};case"NamedNode":return{type:"iri",value:e.value};default:throw new ui.AlgebraTranslatorError(`Quoted triple predicate must be IRI or Variable, got: ${e.termType}`)}}};p_.TripleTranslator=tI});var pM=T(h_=>{"use strict";Object.defineProperty(h_,"__esModule",{value:!0});h_.ExpressionTranslator=void 0;var $f=ru(),rI=class{static{a(this,"ExpressionTranslator")}constructor(e){this.translateWhereFn=e.translateWhere,this.translateBGPFn=e.translateBGP,this.translatePatternFn=e.translatePattern}translateExpression(e){if(!e)throw new $f.AlgebraTranslatorError("Expression cannot be null or undefined");if("type"in e&&e.type==="operation")return this.translateOperationExpression(e);let t="type"in e?e.type:void 0;if(t==="functioncall"||t==="functionCall"){let n=e;return{type:"functionCall",function:n.function,args:n.args.map(i=>this.translateExpression(i))}}if("termType"in e)return this.translateTermExpression(e);throw new $f.AlgebraTranslatorError(`Unsupported expression structure: ${JSON.stringify(e)}`)}translateFilter(e){if(!e.expression)throw new $f.AlgebraTranslatorError("Filter pattern must have expression");let t={type:"bgp",triples:[]};return{type:"filter",expression:this.translateExpression(e.expression),input:t}}translateTermExpression(e){if(e.termType==="Variable")return{type:"variable",name:e.value};if(e.termType==="Literal"){let t=e.value;return e.datatype&&(e.datatype.value.includes("#integer")||e.datatype.value.includes("#decimal")?t=parseFloat(e.value):e.datatype.value.includes("#boolean")&&(t=e.value==="true")),{type:"literal",value:t,datatype:e.datatype?.value}}return{type:"literal",value:String(e.value||e)}}translateOperationExpression(e){let t=["=","!=","<",">","<=",">="],n=["&&","||","!"],i=["+","-","*","/"],s=e.args.filter(o=>!("patterns"in o)||"termType"in o);return t.includes(e.operator)?{type:"comparison",operator:e.operator,left:this.translateExpression(s[0]),right:this.translateExpression(s[1])}:n.includes(e.operator)?{type:"logical",operator:e.operator,operands:s.map(o=>this.translateExpression(o))}:i.includes(e.operator)?{type:"arithmetic",operator:e.operator,left:this.translateExpression(s[0]),right:this.translateExpression(s[1])}:e.operator==="exists"||e.operator==="notexists"?this.translateExistsExpression(e):e.operator==="in"||e.operator==="notin"?this.translateInExpression(e):{type:"function",function:e.operator,args:s.map(o=>this.translateExpression(o))}}translateExistsExpression(e){if(!e.args||e.args.length!==1)throw new $f.AlgebraTranslatorError("EXISTS/NOT EXISTS must have exactly one pattern argument");let t=e.args[0],n;return t.type==="group"&&"patterns"in t&&t.patterns?n=this.translateWhereFn(t.patterns):t.type==="bgp"?n=this.translateBGPFn(t):n=this.translatePatternFn(t),{type:"exists",negated:e.operator==="notexists",pattern:n}}translateInExpression(e){if(!e.args||e.args.length!==2)throw new $f.AlgebraTranslatorError("IN/NOT IN must have exactly 2 arguments (expression and list)");let t=e.args[0],n=e.args[1];if(!Array.isArray(n))throw new $f.AlgebraTranslatorError("IN/NOT IN second argument must be an array of values");return{type:"in",expression:this.translateExpression(t),list:n.map(i=>this.translateExpression(i)),negated:e.operator==="notin"}}};h_.ExpressionTranslator=rI});var gM=T(m_=>{"use strict";Object.defineProperty(m_,"__esModule",{value:!0});m_.PatternTranslator=void 0;var hM=GA(),En=ru(),mM=d_(),nI=class{static{a(this,"PatternTranslator")}constructor(e){this.directionMappings=new Map,this.translateExpressionFn=e.translateExpression,this.translateSelectFn=e.translateSelect,this.translateBGPFn=e.translateBGP}setDirectionMappings(e){this.directionMappings=e}translateWhere(e){if(e.length===0)throw new En.AlgebraTranslatorError("Empty WHERE clause");let t=e.filter(s=>s.type==="filter"),n=e.filter(s=>s.type!=="filter"),i;if(n.length===0)i={type:"bgp",triples:[]};else{let s=n[0];if(s.type==="bind")i=this.translateBind(s,{type:"bgp",triples:[]});else if(s.type==="optional"){let o=s.expression;i={type:"leftjoin",left:{type:"bgp",triples:[]},right:this.translateWhere(s.patterns),expression:o?this.translateExpressionFn(o):void 0}}else i=this.translatePattern(s);for(let o=1;o<n.length;o++){let c=n[o];if(c.type==="bind")i=this.translateBind(c,i);else if(this.isLateralPattern(c)){let l=this.extractLateralSubquery(c),u=this.removeLateralMarker(l),f=this.translateSelectFn(u);i={type:"lateraljoin",left:i,right:f}}else if(c.type==="optional"){let l=c.expression;i={type:"leftjoin",left:i,right:this.translateWhere(c.patterns),expression:l?this.translateExpressionFn(l):void 0}}else if(c.type==="minus")i={type:"minus",left:i,right:this.translateWhere(c.patterns)};else{let l=this.translatePattern(c);i={type:"join",left:i,right:l}}}}for(let s of t)i={type:"filter",expression:this.translateExpressionFn(s.expression),input:i};return i}translatePattern(e){if(!e||!e.type)throw new En.AlgebraTranslatorError("Invalid pattern: missing type");switch(e.type){case"bgp":return this.translateBGPFn(e);case"filter":return this.translateFilter(e);case"optional":return this.translateOptional(e);case"union":return this.translateUnion(e);case"minus":return this.translateMinus(e);case"values":return this.translateValues(e);case"group":return this.translateWhere(e.patterns);case"query":return this.translateSubquery(e);case"service":return this.translateService(e);case"graph":return this.translateGraph(e);default:throw new En.AlgebraTranslatorError(`Unsupported pattern type: ${e.type}`)}}translateFilter(e){if(!e.expression)throw new En.AlgebraTranslatorError("Filter pattern must have expression");let t={type:"bgp",triples:[]};return{type:"filter",expression:this.translateExpressionFn(e.expression),input:t}}translateOptional(e){if(!e.patterns||e.patterns.length===0)throw new En.AlgebraTranslatorError("OPTIONAL pattern must have patterns");let t=e.expression;return{type:"leftjoin",left:{type:"bgp",triples:[]},right:this.translateWhere(e.patterns),expression:t?this.translateExpressionFn(t):void 0}}translateUnion(e){if(!e.patterns||e.patterns.length<2)throw new En.AlgebraTranslatorError("UNION pattern must have at least 2 patterns");let t=a(i=>i.type==="graph"?this.translateGraph(i):i.type==="service"?this.translateService(i):"patterns"in i&&i.patterns&&Array.isArray(i.patterns)?this.translateWhere(i.patterns):this.translateWhere([i]),"translateBranch"),n={type:"union",left:t(e.patterns[0]),right:t(e.patterns[1])};for(let i=2;i<e.patterns.length;i++)n={type:"union",left:n,right:t(e.patterns[i])};return n}translateMinus(e){if(!e.patterns||e.patterns.length===0)throw new En.AlgebraTranslatorError("MINUS pattern must have patterns");return{type:"minus",left:{type:"bgp",triples:[]},right:this.translateWhere(e.patterns)}}translateValues(e){if(!e.values||!Array.isArray(e.values))throw new En.AlgebraTranslatorError("VALUES pattern must have values array");let t=new Set;for(let i of e.values)for(let s of Object.keys(i)){let o=s.startsWith("?")?s.slice(1):s;t.add(o)}let n=e.values.map(i=>this.translateValuesBinding(i));return{type:"values",variables:Array.from(t),bindings:n}}translateValuesBinding(e){let t={};for(let[n,i]of Object.entries(e)){let s=n.startsWith("?")?n.slice(1):n,o=i;if(o)if(o.termType==="NamedNode")t[s]={type:"iri",value:o.value};else if(o.termType==="Literal"){let c=o,l={type:"literal",value:c.value,datatype:c.datatype?.value,language:c.language||void 0};if(c.language){let u=this.directionMappings.get(c.language.toLowerCase());u&&(l.direction=u)}t[s]=l}else throw new En.AlgebraTranslatorError(`Unsupported VALUES term type: ${o.termType}`)}return t}translateBind(e,t){if(!e.variable||!e.expression)throw new En.AlgebraTranslatorError("BIND pattern must have variable and expression");let n=this.translateExpressionFn(e.expression),i=e.expression.termType==="NamedNode";return{type:"extend",variable:e.variable.value,expression:i&&n.type==="literal"?{...n,iri:!0}:n,input:t}}translateSubquery(e){if(e.queryType!=="SELECT")throw new En.AlgebraTranslatorError(`Only SELECT subqueries are supported, got: ${String(e.queryType)}`);let t=this.removeLateralMarker(e);return{type:"subquery",query:this.translateSelectFn(t)}}translateService(e){if(!e.name||e.name.termType!=="NamedNode")throw new En.AlgebraTranslatorError("SERVICE pattern must have a NamedNode endpoint");if(!e.patterns||!Array.isArray(e.patterns))throw new En.AlgebraTranslatorError("SERVICE pattern must have patterns array");return{type:"service",endpoint:e.name.value,pattern:this.translateWhere(e.patterns),silent:e.silent||!1}}translateGraph(e){if(!e.name)throw new En.AlgebraTranslatorError("GRAPH pattern must have a name (IRI or variable)");if(!e.patterns||!Array.isArray(e.patterns))throw new En.AlgebraTranslatorError("GRAPH pattern must have patterns array");let t;if(e.name.termType==="NamedNode")t={type:"iri",value:e.name.value};else if(e.name.termType==="Variable")t={type:"variable",value:e.name.value};else throw new En.AlgebraTranslatorError(`GRAPH pattern name must be NamedNode or Variable, got: ${e.name.termType}`);return{type:"graph",name:t,pattern:this.translateWhere(e.patterns)}}isLateralPattern(e){if(e.type==="query"&&this.isLateralSubquery(e))return!0;if(e.type==="group"&&e.patterns?.length===1){let t=e.patterns[0];if(t.type==="query"&&this.isLateralSubquery(t))return!0}return!1}extractLateralSubquery(e){if(e.type==="query")return e;if(e.type==="group"&&e.patterns?.length===1){let t=e.patterns[0];if(t.type==="query")return t}throw new En.AlgebraTranslatorError("Invalid lateral pattern structure")}isLateralSubquery(e){return!("queryType"in e)||e.queryType!=="SELECT"||!("variables"in e)||!e.variables?!1:e.variables.some(i=>(0,mM.isVariableTerm)(i)&&i.value===hM.LateralTransformer.LATERAL_MARKER)}removeLateralMarker(e){if(!("variables"in e)||!e.variables)return e;let t=e,n=t.variables;return{...t,variables:n.filter(i=>!((0,mM.isVariableTerm)(i)&&i.value===hM.LateralTransformer.LATERAL_MARKER))}}};m_.PatternTranslator=nI});var y_=T(Bf=>{"use strict";Object.defineProperty(Bf,"__esModule",{value:!0});Bf.CustomAggregateRegistry=Bf.CustomAggregateError=void 0;var jf=class extends Error{static{a(this,"CustomAggregateError")}constructor(e,t){super(e),this.iri=t,this.name="CustomAggregateError"}};Bf.CustomAggregateError=jf;var g_=class r{static{a(this,"CustomAggregateRegistry")}constructor(){this.aggregates=new Map}static getInstance(){return r.instance||(r.instance=new r),r.instance}static resetInstance(){r.instance&&r.instance.clear(),r.instance=null}register(e,t){if(!e||typeof e!="string")throw new jf("Aggregate IRI must be a non-empty string");if(!t||typeof t.init!="function"||typeof t.step!="function"||typeof t.finalize!="function")throw new jf("Aggregate must implement init(), step(), and finalize() methods",e);if(this.aggregates.has(e))throw new jf(`Aggregate with IRI "${e}" is already registered`,e);this.aggregates.set(e,t)}unregister(e){return this.aggregates.delete(e)}get(e){return this.aggregates.get(e)}has(e){return this.aggregates.has(e)}getRegisteredIris(){return Array.from(this.aggregates.keys())}clear(){this.aggregates.clear()}get size(){return this.aggregates.size}};Bf.CustomAggregateRegistry=g_;g_.instance=null});var b_=T(Ze=>{"use strict";Object.defineProperty(Ze,"__esModule",{value:!0});Ze.BUILT_IN_AGGREGATES=Ze.interceptAggregate=Ze.slopeAggregate=Ze.corrAggregate=Ze.modeAggregate=Ze.stddevAggregate=Ze.varianceAggregate=Ze.medianAggregate=Ze.EXO_AGGREGATE_NS=void 0;Ze.getNumericValue=Vf;Ze.createDecimalLiteral=Ds;Ze.createDoubleLiteral=Nee;Ze.createPercentileAggregate=nu;var Vn=Ye(),Uf=Me(),__=new Uf.IRI("http://www.w3.org/2001/XMLSchema#decimal"),iu=new Uf.IRI("http://www.w3.org/2001/XMLSchema#double");Ze.EXO_AGGREGATE_NS="https://exocortex.my/ontology/agg#";function Vf(r){return r==null?NaN:typeof r=="number"?r:typeof r=="string"?parseFloat(r):r instanceof Vn.Literal?parseFloat(r.value):r instanceof Uf.IRI?NaN:typeof r=="boolean"?r?1:0:NaN}a(Vf,"getNumericValue");function Ds(r){return new Vn.Literal(String(r),__)}a(Ds,"createDecimalLiteral");function Nee(r){return new Vn.Literal(String(r),iu)}a(Nee,"createDoubleLiteral");Ze.medianAggregate={init(){return{values:[]}},step(r,e){let t=r,n=Vf(e);isNaN(n)||t.values.push(n)},finalize(r){let e=r,{values:t}=e;if(t.length===0)return Ds(0);let n=[...t].sort((o,c)=>o-c),i=Math.floor(n.length/2),s=n.length%2!==0?n[i]:(n[i-1]+n[i])/2;return Ds(s)}};Ze.varianceAggregate={init(){return{values:[]}},step(r,e){let t=r,n=Vf(e);isNaN(n)||t.values.push(n)},finalize(r){let e=r,{values:t}=e;if(t.length===0)return Ds(0);let n=t.reduce((s,o)=>s+o,0)/t.length,i=t.reduce((s,o)=>s+Math.pow(o-n,2),0)/t.length;return Ds(i)}};Ze.stddevAggregate={init(){return{values:[]}},step(r,e){Ze.varianceAggregate.step(r,e)},finalize(r){let e=r,{values:t}=e;if(t.length===0)return Ds(0);let n=t.reduce((s,o)=>s+o,0)/t.length,i=t.reduce((s,o)=>s+Math.pow(o-n,2),0)/t.length;return Ds(Math.sqrt(i))}};Ze.modeAggregate={init(){return{counts:new Map,values:new Map}},step(r,e){if(e==null)return;let t=r,n=String(e instanceof Vn.Literal||e instanceof Uf.IRI?e.value:e),i=t.counts.get(n)||0;t.counts.set(n,i+1),t.values.set(n,e)},finalize(r){let e=r;if(e.counts.size===0)return new Vn.Literal(" ",new Uf.IRI("http://www.w3.org/2001/XMLSchema#string"));let t="",n=0;for(let[o,c]of e.counts)c>n&&(n=c,t=o);let i=e.values.get(t);if(i instanceof Vn.Literal)return i;let s=parseFloat(t);return isNaN(s)?new Vn.Literal(t,new Uf.IRI("http://www.w3.org/2001/XMLSchema#string")):Ds(s)}};function nu(r){let e=Math.max(0,Math.min(100,r))/100;return{init(){return{values:[],percentile:e}},step(t,n){let i=t,s=Vf(n);isNaN(s)||i.values.push(s)},finalize(t){let n=t,{values:i}=n;if(i.length===0)return Ds(0);let s=[...i].sort((d,p)=>d-p),o=n.percentile*(s.length-1),c=Math.floor(o),l=Math.ceil(o);if(c===l)return Ds(s[c]);let u=o-c,f=s[c]*(1-u)+s[l]*u;return Ds(f)}}}a(nu,"createPercentileAggregate");function iI(){return{n:0,sx:0,sy:0,sxx:0,syy:0,sxy:0}}a(iI,"bivariateInit");function sI(r,e,t){let n=r,i=Vf(e),s=Vf(t);isNaN(i)||isNaN(s)||(n.n+=1,n.sx+=i,n.sy+=s,n.sxx+=i*i,n.syy+=s*s,n.sxy+=i*s)}a(sI,"bivariateStep");Ze.corrAggregate={arity:2,init:iI,step:sI,finalize(r){let{n:e,sx:t,sy:n,sxx:i,syy:s,sxy:o}=r;if(e<2)return new Vn.Literal("NaN",iu);let c=e*o-t*n,l=e*i-t*t,u=e*s-n*n;return l<=0||u<=0?new Vn.Literal("NaN",iu):new Vn.Literal(String(c/Math.sqrt(l*u)),__)}};Ze.slopeAggregate={arity:2,init:iI,step:sI,finalize(r){let{n:e,sx:t,sy:n,sxx:i,sxy:s}=r;if(e<2)return new Vn.Literal("NaN",iu);let o=e*i-t*t;return o<=0?new Vn.Literal("NaN",iu):new Vn.Literal(String((e*s-t*n)/o),__)}};Ze.interceptAggregate={arity:2,init:iI,step:sI,finalize(r){let{n:e,sx:t,sy:n,sxx:i,sxy:s}=r;if(e<2)return new Vn.Literal("NaN",iu);let o=e*i-t*t;if(o<=0)return new Vn.Literal("NaN",iu);let c=(e*s-t*n)/o;return new Vn.Literal(String((n-c*t)/e),__)}};Ze.BUILT_IN_AGGREGATES={[`${Ze.EXO_AGGREGATE_NS}median`]:Ze.medianAggregate,[`${Ze.EXO_AGGREGATE_NS}variance`]:Ze.varianceAggregate,[`${Ze.EXO_AGGREGATE_NS}stddev`]:Ze.stddevAggregate,[`${Ze.EXO_AGGREGATE_NS}mode`]:Ze.modeAggregate,[`${Ze.EXO_AGGREGATE_NS}percentile25`]:nu(25),[`${Ze.EXO_AGGREGATE_NS}percentile50`]:nu(50),[`${Ze.EXO_AGGREGATE_NS}percentile75`]:nu(75),[`${Ze.EXO_AGGREGATE_NS}percentile90`]:nu(90),[`${Ze.EXO_AGGREGATE_NS}percentile95`]:nu(95),[`${Ze.EXO_AGGREGATE_NS}percentile99`]:nu(99),[`${Ze.EXO_AGGREGATE_NS}corr`]:Ze.corrAggregate,[`${Ze.EXO_AGGREGATE_NS}slope`]:Ze.slopeAggregate,[`${Ze.EXO_AGGREGATE_NS}intercept`]:Ze.interceptAggregate}});var bM=T(S_=>{"use strict";Object.defineProperty(S_,"__esModule",{value:!0});S_.AggregateTranslator=void 0;var yM=ru(),_M=d_(),oI=y_(),Ta=b_(),aI=class{static{a(this,"AggregateTranslator")}constructor(e){this.aggregateCounter=0,this.translateExpressionFn=e.translateExpression}resetCounter(){this.aggregateCounter=0}extractAggregatesWithMapping(e,t){if(!e)return[];let n=[];for(let i of e)if((0,_M.isVariableExpression)(i))if("type"in i.expression&&i.expression.type==="aggregate")n.push({variable:i.variable.value,expression:this.translateAggregateExpression(i.expression)}),t.set(i.expression,i.variable.value);else{let s=this.customAggregateIri(i.expression);s?(n.push({variable:i.variable.value,expression:this.translateCustomAggregateFunctionCall(i.expression,s)}),t.set(i.expression,i.variable.value)):this.collectNestedAggregates(i.expression,n,t)}return n}extractGroupVariables(e){return e?e.filter(t=>t.expression&&"termType"in t.expression&&t.expression.termType==="Variable").map(t=>t.expression.value):[]}extractHavingExpressions(e,t,n){if(!e||e.length===0)return[];for(let i of e)this.collectNestedAggregates(i,t,n);return e.map(i=>this.transformExpressionWithAggregateVars(i,n))}transformExpressionWithAggregateVars(e,t){let n=t.get(e);if(n!==void 0)return{type:"variable",name:n};if("type"in e&&e.type==="operation"&&"args"in e){let i=e,s=i.args.filter(u=>!Array.isArray(u)&&!("patterns"in u)).map(u=>this.transformExpressionWithAggregateVars(u,t)),o=["=","!=","<",">","<=",">="],c=["&&","||","!"],l=["+","-","*","/"];return o.includes(i.operator)?{type:"comparison",operator:i.operator,left:s[0],right:s[1]}:c.includes(i.operator)?{type:"logical",operator:i.operator,operands:s}:l.includes(i.operator)?{type:"arithmetic",operator:i.operator,left:s[0],right:s[1]}:{type:"function",function:i.operator,args:s}}return this.translateExpressionFn(e)}translateOrderComparator(e){return{expression:this.translateExpressionFn(e.expression),descending:e.descending||!1}}translateAggregateExpression(e){let t=e.aggregation,n=a(()=>{if(e.expression&&!("termType"in e.expression&&e.expression.termType==="Wildcard"))return this.translateExpressionFn(e.expression)},"translateInnerExpr");if(typeof t=="string"){let s=t.toLowerCase();return["count","sum","avg","min","max","group_concat","sample"].includes(s)?{type:"aggregate",aggregation:s,expression:n(),distinct:e.distinct||!1,separator:e.separator}:{type:"aggregate",aggregation:{type:"custom",iri:t},expression:n(),distinct:e.distinct||!1,separator:e.separator}}let i=t;if(i&&typeof i=="object"){let s,o=i;if(o.termType==="NamedNode"&&typeof o.value=="string")s=o.value;else if("value"in o)s=String(o.value);else throw new yM.AlgebraTranslatorError(`Invalid custom aggregate: expected IRI but got ${JSON.stringify(i)}`);return{type:"aggregate",aggregation:{type:"custom",iri:s},expression:n(),distinct:e.distinct||!1,separator:e.separator}}throw new yM.AlgebraTranslatorError(`Unknown aggregate format: ${JSON.stringify(t)}`)}customAggregateIri(e){if(!(0,_M.isFunctionCallExpression)(e))return null;let t=e.function,n=null;if(typeof t=="string"?n=t:t&&typeof t=="object"&&"value"in t&&(n=String(t.value)),!n)return null;if(n in Ta.BUILT_IN_AGGREGATES||oI.CustomAggregateRegistry.getInstance().get(n)!==void 0)return n;if(n.startsWith(Ta.EXO_AGGREGATE_NS)){let s=[...Object.keys(Ta.BUILT_IN_AGGREGATES),...oI.CustomAggregateRegistry.getInstance().getRegisteredIris()].filter(o=>o.startsWith(Ta.EXO_AGGREGATE_NS)).map(o=>o.slice(Ta.EXO_AGGREGATE_NS.length)).sort();throw new Error(`Unknown aggregate agg:${n.slice(Ta.EXO_AGGREGATE_NS.length)}. Registered: ${s.length>0?s.map(o=>`agg:${o}`).join(", "):"(none)"}.`)}return null}translateCustomAggregateFunctionCall(e,t){let n=e,s=(oI.CustomAggregateRegistry.getInstance().get(t)??Ta.BUILT_IN_AGGREGATES[t])?.arity??1,o=n.args?.length??0;if(o!==s){let u=t.startsWith(Ta.EXO_AGGREGATE_NS)?`agg:${t.slice(Ta.EXO_AGGREGATE_NS.length)}`:t;throw new Error(`${u} takes exactly ${s} argument${s===1?"":"s"}, got ${o}.`)}let c=o>0?n.args?.[0]:void 0,l=s===2?n.args?.[1]:void 0;return{type:"aggregate",aggregation:{type:"custom",iri:t},expression:c?this.translateExpressionFn(c):void 0,expression2:l?this.translateExpressionFn(l):void 0,distinct:n.distinct||!1}}collectNestedAggregates(e,t,n){if(!e)return;if("type"in e&&e.type==="aggregate"){let s=`__agg${this.aggregateCounter++}`;t.push({variable:s,expression:this.translateAggregateExpression(e)}),n.set(e,s);return}let i=this.customAggregateIri(e);if(i){let s=`__agg${this.aggregateCounter++}`;t.push({variable:s,expression:this.translateCustomAggregateFunctionCall(e,i)}),n.set(e,s);return}if("type"in e&&e.type==="operation"&&"args"in e){let s=e;for(let o of s.args)!Array.isArray(o)&&"type"in o&&!("patterns"in o)?this.collectNestedAggregates(o,t,n):"termType"in o&&this.collectNestedAggregates(o,t,n)}}};S_.AggregateTranslator=aI});var Gf=T(xc=>{"use strict";Object.defineProperty(xc,"__esModule",{value:!0});xc.AlgebraTranslator=xc.ExoQLAlgebraTranslator=xc.AlgebraTranslatorError=void 0;var w_=ru(),E_=d_(),kee=dM(),Mee=pM(),$ee=gM(),jee=bM(),Bee=ru();Object.defineProperty(xc,"AlgebraTranslatorError",{enumerable:!0,get:a(function(){return Bee.AlgebraTranslatorError},"get")});var v_=class{static{a(this,"ExoQLAlgebraTranslator")}constructor(){this.tripleTranslator=new kee.TripleTranslator,this.expressionTranslator=new Mee.ExpressionTranslator({translateWhere:a(e=>this.patternTranslator.translateWhere(e),"translateWhere"),translateBGP:a(e=>this.tripleTranslator.translateBGP(e),"translateBGP"),translatePattern:a(e=>this.patternTranslator.translatePattern(e),"translatePattern")}),this.patternTranslator=new $ee.PatternTranslator({translateExpression:a(e=>this.expressionTranslator.translateExpression(e),"translateExpression"),translateSelect:a(e=>this.translateSelect(e),"translateSelect"),translateBGP:a(e=>this.tripleTranslator.translateBGP(e),"translateBGP")}),this.aggregateTranslator=new jee.AggregateTranslator({translateExpression:a(e=>this.expressionTranslator.translateExpression(e),"translateExpression")})}setDirectionMappings(e){this.tripleTranslator.setDirectionMappings(e),this.patternTranslator.setDirectionMappings(e)}translate(e){if(e.type!=="query")throw new w_.AlgebraTranslatorError("Only query operations are supported (not updates)");if(e.queryType==="SELECT")return this.translateSelect(e);if(e.queryType==="CONSTRUCT")return this.translateConstruct(e);if(e.queryType==="ASK")return this.translateAsk(e);if(e.queryType==="DESCRIBE")return this.translateDescribe(e);throw new w_.AlgebraTranslatorError(`Query type ${String(e.queryType)} not yet supported`)}translateSelect(e){if(!e.where||e.where.length===0)throw new w_.AlgebraTranslatorError("SELECT query must have WHERE clause");let t=this.patternTranslator.translateWhere(e.where);this.aggregateTranslator.resetCounter();let n=new Map,i=Array.isArray(e.variables)?e.variables.filter(l=>!("termType"in l&&l.termType==="Wildcard")):[],s=this.aggregateTranslator.extractAggregatesWithMapping(i,n),o=this.aggregateTranslator.extractGroupVariables(e.group),c=this.aggregateTranslator.extractHavingExpressions(e.having,s,n);if((s.length>0||o.length>0||c.length>0)&&(t={type:"group",variables:o,aggregates:s,having:c.length>0?c:void 0,input:t}),i.length>0){for(let l of i)if((0,E_.isVariableExpression)(l)){if("type"in l.expression&&l.expression.type==="aggregate")continue;let u=this.aggregateTranslator.transformExpressionWithAggregateVars(l.expression,n);t={type:"extend",variable:l.variable.value,expression:u,input:t}}}if(e.order&&e.order.length>0&&(t={type:"orderby",comparators:e.order.map(l=>this.aggregateTranslator.translateOrderComparator(l)),input:t}),i.length>0){let l=i.filter(u=>(0,E_.isVariableTerm)(u)||(0,E_.isVariableExpression)(u)).map(u=>(0,E_.isVariableTerm)(u)?u.value:u.variable.value);l.length>0&&(t={type:"project",variables:l,input:t})}return e.distinct&&(t={type:"distinct",input:t}),e.reduced&&(t={type:"reduced",input:t}),(e.limit!==void 0||e.offset!==void 0)&&(t={type:"slice",limit:e.limit,offset:e.offset,input:t}),t}translateConstruct(e){let t=this.tripleTranslator.translateConstructTemplate(e.template??[]);if(!e.where||e.where.length===0)throw new w_.AlgebraTranslatorError("CONSTRUCT query must have WHERE clause");let n=this.patternTranslator.translateWhere(e.where),i=e;return(i.limit!==void 0||i.offset!==void 0)&&(n={type:"slice",limit:i.limit,offset:i.offset,input:n}),{type:"construct",template:t,where:n}}translateAsk(e){return{type:"ask",where:e.where&&e.where.length>0?this.patternTranslator.translateWhere(e.where):{type:"bgp",triples:[]}}}translateDescribe(e){let t=[];if(e.variables&&Array.isArray(e.variables)){let s=e.variables;for(let o of s)o.termType==="Wildcard"||o.value==="*"||(o.termType==="Variable"?t.push({type:"variable",value:o.value}):o.termType==="NamedNode"&&t.push({type:"iri",value:o.value}))}let n;e.where&&e.where.length>0&&(n=this.patternTranslator.translateWhere(e.where));let i=e.describeOptions;return{type:"describe",resources:t,where:n,depth:i?.depth,symmetric:i?.symmetric}}};xc.ExoQLAlgebraTranslator=v_;xc.AlgebraTranslator=v_});var Aa=T(T_=>{"use strict";Object.defineProperty(T_,"__esModule",{value:!0});T_.SolutionMapping=void 0;var SM=Ye(),wM=Me(),EM=lr(),cI=class r{static{a(this,"SolutionMapping")}constructor(e){this.bindings=e?new Map(e):new Map}get(e){return this.bindings.get(e)}set(e,t){this.bindings.set(e,t)}has(e){return this.bindings.has(e)}variables(){return Array.from(this.bindings.keys())}getBindings(){return new Map(this.bindings)}isCompatibleWith(e){for(let[t,n]of this.bindings.entries()){let i=e.get(t);if(i!==void 0&&!this.areEqual(n,i))return!1}return!0}merge(e){if(!this.isCompatibleWith(e))return null;let t=new r(this.bindings);for(let[n,i]of e.getBindings().entries())t.set(n,i);return t}clone(){return new r(this.bindings)}areEqual(e,t){return e instanceof SM.Literal&&t instanceof SM.Literal?e.equals(t):e instanceof wM.IRI&&t instanceof wM.IRI?e.value===t.value:e instanceof EM.BlankNode&&t instanceof EM.BlankNode?e.id===t.id:!1}toJSON(){let e={};for(let[t,n]of this.bindings.entries())e[t]=n.toString();return e}size(){return this.bindings.size}};T_.SolutionMapping=cI});var Ia=T(A_=>{"use strict";Object.defineProperty(A_,"__esModule",{value:!0});A_.LoggingService=void 0;var Vh=class{static{a(this,"LoggingService")}static setVerbose(e){this.isVerbose=e}static setDevelopmentMode(e){this.isDevelopment=e}static checkIsDevelopment(){return this.isDevelopment!==void 0?this.isDevelopment:typeof process<"u"?(this.isDevelopment=!1,this.isDevelopment):(this.isDevelopment=!1,this.isDevelopment)}static debug(e,t){this.isVerbose&&console.debug(`[Exocortex] ${e}`,t??"")}static info(e,t){console.log(`[Exocortex] ${e}`,t??"")}static warn(e,t){console.warn(`[Exocortex] ${e}`,t??"")}static error(e,t,n){let i=this.checkIsDevelopment(),s=n?` [${n}]`:"";if(i){let o=t?.stack?`
103
+ `,s);l!==-1?(i+=e.substring(s,l),s=l):(i+=e.substring(s),s=e.length);continue}let c=this.tryReplacePrefixedName(e,s,n);if(c){i+=c.iri,s=c.endIndex;continue}i+=o,s++}return i}tryReplacePrefixedName(e,t,n){if(t>0&&/[a-zA-Z0-9_]/.test(e[t-1]))return null;for(let{prefix:i,baseIRI:s}of n){if(e.substring(t,t+i.length+1)!==i+":")continue;let o=t+i.length+1,c=o;for(;c<e.length&&/[a-zA-Z0-9_.%-]/.test(e[c]);)c++;if(c===o)continue;let l=e.substring(o,c);return{iri:`<${s}${l}.md>`,endIndex:c}}return null}findDeclaredPrefixes(e){let t=new Set,n=new RegExp(See.source,"gi"),i;for(;(i=n.exec(e))!==null;)t.add(i[1].toLowerCase());return t}skipLiteral(e,t){let n=e[t];if(t+2<e.length&&e.substring(t,t+3)===n+n+n){let s=e.indexOf(n+n+n,t+3);return s!==-1?s+3:e.length}let i=t+1;for(;i<e.length&&e[i]!==n;)e[i]==="\\"&&i++,i++;return i<e.length?i+1:e.length}};l_.VaultPrefixTransformer=HA});var Mf=T(Di=>{"use strict";var Eee=Di&&Di.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:a(function(){return e[t]},"get")}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),vee=Di&&Di.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Tee=Di&&Di.__importStar||(function(){var r=a(function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)},"ownKeys");return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Eee(t,e,n[i]);return vee(t,e),t}})();Object.defineProperty(Di,"__esModule",{value:!0});Di.SPARQLParser=Di.ExoQLParser=Di.SPARQLParseError=void 0;var uM=Tee(oM()),QA=VA(),XA=GA(),fM=aM(),JA=WA(),Aee=cM(),ZA=lM(),Iee=YA(),Yr=class extends Error{static{a(this,"SPARQLParseError")}constructor(e,t,n,i){super(e,i?{cause:i}:void 0),this.name="SPARQLParseError",this.line=t,this.column=n}};Di.SPARQLParseError=Yr;var u_=class{static{a(this,"ExoQLParser")}constructor(e){this.lastDirectionMappings=new Map,this.parser=new uM.Parser({sparqlStar:!0}),this.generator=new uM.Generator({sparqlStar:!0}),this.caseWhenTransformer=new QA.CaseWhenTransformer,this.lateralTransformer=new XA.LateralTransformer,this.prefixStarTransformer=new fM.PrefixStarTransformer(e?.vocabularyResolver),this.describeOptionsTransformer=new JA.DescribeOptionsTransformer,this.directionalLangTagTransformer=new Aee.DirectionalLangTagTransformer,this.tripleTermTransformer=new ZA.TripleTermTransformer,this.vaultPrefixTransformer=new Iee.VaultPrefixTransformer}setVaultPrefixes(e){this.vaultPrefixTransformer.setVaultPrefixes(e)}parse(e){try{let t=this.vaultPrefixTransformer.transform(e),n=this.describeOptionsTransformer.transform(t);this.lastDescribeOptions=n.options;let i=n.query;i=this.directionalLangTagTransformer.transform(i),this.lastDirectionMappings=this.directionalLangTagTransformer.getAllMappings(),i=this.lateralTransformer.transform(i),i=this.caseWhenTransformer.transform(i),i=this.tripleTermTransformer.transform(i);let s=this.parser.parse(i);return this.validateQuery(s),this.lastDescribeOptions&&this.isDescribeQuery(s)&&(s.describeOptions=this.lastDescribeOptions),s}catch(t){if(t instanceof JA.DescribeOptionsTransformerError)throw new Yr(t.message);if(t instanceof XA.LateralTransformerError)throw new Yr(t.message);if(t instanceof QA.CaseWhenTransformerError)throw new Yr(t.message);if(t instanceof ZA.TripleTermTransformerError)throw new Yr(t.message);if(t instanceof Error){let n=t.message.match(/line (\d+), column (\d+)/),i=n?parseInt(n[1],10):void 0,s=n?parseInt(n[2],10):void 0;throw new Yr(`SPARQL syntax error: ${t.message}`,i,s,t)}throw t}}parseWithOptions(e){return{query:this.parse(e),describeOptions:this.lastDescribeOptions}}getLastDescribeOptions(){return this.lastDescribeOptions}async parseAsync(e){try{let t=this.vaultPrefixTransformer.transform(e),n=this.describeOptionsTransformer.transform(t);this.lastDescribeOptions=n.options;let i=n.query;i=this.directionalLangTagTransformer.transform(i),this.lastDirectionMappings=this.directionalLangTagTransformer.getAllMappings(),i=await this.prefixStarTransformer.transform(i),i=this.lateralTransformer.transform(i),i=this.caseWhenTransformer.transform(i),i=this.tripleTermTransformer.transform(i);let s=this.parser.parse(i);return this.validateQuery(s),this.lastDescribeOptions&&this.isDescribeQuery(s)&&(s.describeOptions=this.lastDescribeOptions),s}catch(t){if(t instanceof JA.DescribeOptionsTransformerError)throw new Yr(t.message);if(t instanceof fM.PrefixStarTransformerError)throw new Yr(t.message);if(t instanceof XA.LateralTransformerError)throw new Yr(t.message);if(t instanceof QA.CaseWhenTransformerError)throw new Yr(t.message);if(t instanceof ZA.TripleTermTransformerError)throw new Yr(t.message);if(t instanceof Error){let n=t.message.match(/line (\d+), column (\d+)/),i=n?parseInt(n[1],10):void 0,s=n?parseInt(n[2],10):void 0;throw new Yr(`SPARQL syntax error: ${t.message}`,i,s,t)}throw t}}async parseAsyncWithOptions(e){return{query:await this.parseAsync(e),describeOptions:this.lastDescribeOptions}}hasPrefixStar(e){return/PREFIX\s*\*/i.test(e)}hasLateral(e){return this.lateralTransformer.hasLateral(e)}hasDescribeOptions(e){return this.describeOptionsTransformer.hasDescribeOptions(e)}hasDirectionalLangTags(e){return this.directionalLangTagTransformer.hasDirectionalTags(e)}hasTripleTermSyntax(e){return this.tripleTermTransformer.hasTripleTermSyntax(e)}getLastDirectionMappings(){return new Map(this.lastDirectionMappings)}getDirectionForLanguage(e){return this.lastDirectionMappings.get(e.toLowerCase())}toString(e){try{return this.generator.stringify(e)}catch(t){throw t instanceof Error?new Yr(`Failed to serialize SPARQL query: ${t.message}`,void 0,void 0,t):t}}getQueryType(e){if("queryType"in e&&e.type==="query")return e.queryType;throw new Yr("Query does not have a valid queryType property")}isSelectQuery(e){return"queryType"in e&&e.type==="query"&&e.queryType==="SELECT"}isConstructQuery(e){return"queryType"in e&&e.type==="query"&&e.queryType==="CONSTRUCT"}isAskQuery(e){return"queryType"in e&&e.type==="query"&&e.queryType==="ASK"}isDescribeQuery(e){return"queryType"in e&&e.type==="query"&&e.queryType==="DESCRIBE"}isUpdateQuery(e){return e.type==="update"}isInsertDataOperation(e){return"updateType"in e&&e.updateType==="insert"}isDeleteDataOperation(e){return"updateType"in e&&e.updateType==="delete"}validateQuery(e){if(!e||typeof e!="object")throw new Yr("Invalid query: not an object");if(e.type!=="query"&&e.type!=="update")throw new Yr(`Invalid type: expected "query" or "update", got "${e.type}"`);if(e.type==="query"){let t=["SELECT","CONSTRUCT","ASK","DESCRIBE"];if(!t.includes(e.queryType))throw new Yr(`Invalid query type: expected one of ${t.join(", ")}, got "${e.queryType}"`)}}};Di.ExoQLParser=u_;Di.SPARQLParser=u_});var ru=T(f_=>{"use strict";Object.defineProperty(f_,"__esModule",{value:!0});f_.AlgebraTranslatorError=void 0;var eI=class extends Error{static{a(this,"AlgebraTranslatorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="AlgebraTranslatorError"}};f_.AlgebraTranslatorError=eI});var d_=T(xo=>{"use strict";Object.defineProperty(xo,"__esModule",{value:!0});xo.isVariableExpression=Ree;xo.isVariableTerm=Cee;xo.isNamedNode=Oee;xo.isLiteral=xee;xo.isPropertyPath=Pee;xo.isAggregateExpression=Fee;xo.isOperationExpression=Lee;xo.isFunctionCallExpression=Dee;function Ree(r){return typeof r=="object"&&r!==null&&"expression"in r&&"variable"in r}a(Ree,"isVariableExpression");function Cee(r){return typeof r=="object"&&r!==null&&"termType"in r&&r.termType==="Variable"}a(Cee,"isVariableTerm");function Oee(r){return typeof r=="object"&&r!==null&&"termType"in r&&r.termType==="NamedNode"}a(Oee,"isNamedNode");function xee(r){return typeof r=="object"&&r!==null&&"termType"in r&&r.termType==="Literal"}a(xee,"isLiteral");function Pee(r){return typeof r=="object"&&r!==null&&"type"in r&&r.type==="path"}a(Pee,"isPropertyPath");function Fee(r){return typeof r=="object"&&r!==null&&"type"in r&&r.type==="aggregate"}a(Fee,"isAggregateExpression");function Lee(r){return typeof r=="object"&&r!==null&&"type"in r&&r.type==="operation"}a(Lee,"isOperationExpression");function Dee(r){return typeof r=="object"&&r!==null&&"type"in r&&(r.type==="functionCall"||r.type==="functioncall")}a(Dee,"isFunctionCallExpression")});var dM=T(p_=>{"use strict";Object.defineProperty(p_,"__esModule",{value:!0});p_.TripleTranslator=void 0;var ui=ru(),tI=class{static{a(this,"TripleTranslator")}constructor(){this.directionMappings=new Map}setDirectionMappings(e){this.directionMappings=e}translateBGP(e){if(!("triples"in e)||!Array.isArray(e.triples))throw new ui.AlgebraTranslatorError("BGP pattern must have triples array");return{type:"bgp",triples:e.triples.map(t=>this.translateTriple(t))}}translateTriple(e){if(!e.subject||!e.predicate||!e.object)throw new ui.AlgebraTranslatorError("Triple must have subject, predicate, and object");return{subject:this.translateTripleElement(e.subject),predicate:this.translatePredicate(e.predicate),object:this.translateTripleElement(e.object)}}translateConstructTemplate(e){return!e||!Array.isArray(e)?[]:e.map(t=>this.translateTriple(t))}translatePredicate(e){return"type"in e&&e.type==="path"?this.translatePropertyPath(e):this.translateTripleElement(e)}translatePropertyPath(e){if(!("pathType"in e)||!e.pathType)throw new ui.AlgebraTranslatorError("Property path must have pathType");if(!("items"in e)||!Array.isArray(e.items))throw new ui.AlgebraTranslatorError("Property path must have items array");let t=e.items.map(n=>this.translatePathItem(n));switch(e.pathType){case"/":return{type:"path",pathType:"/",items:t};case"|":return{type:"path",pathType:"|",items:t};case"^":if(t.length!==1)throw new ui.AlgebraTranslatorError("Inverse path must have exactly one item");return{type:"path",pathType:"^",items:[t[0]]};case"+":if(t.length!==1)throw new ui.AlgebraTranslatorError("OneOrMore path must have exactly one item");return{type:"path",pathType:"+",items:[t[0]]};case"*":if(t.length!==1)throw new ui.AlgebraTranslatorError("ZeroOrMore path must have exactly one item");return{type:"path",pathType:"*",items:[t[0]]};case"?":if(t.length!==1)throw new ui.AlgebraTranslatorError("ZeroOrOne path must have exactly one item");return{type:"path",pathType:"?",items:[t[0]]};default:throw new ui.AlgebraTranslatorError(`Unsupported property path type: ${e.pathType}`)}}translatePathItem(e){if("type"in e&&e.type==="path")return this.translatePropertyPath(e);if("termType"in e&&e.termType==="NamedNode")return{type:"iri",value:e.value};let t="type"in e?e.type:"termType"in e?e.termType:"unknown";throw new ui.AlgebraTranslatorError(`Unsupported path item type: ${String(t)}`)}translateTripleElement(e){if(!e||!("termType"in e))throw new ui.AlgebraTranslatorError("Triple element must have termType");switch(e.termType){case"Variable":return{type:"variable",value:e.value};case"NamedNode":return{type:"iri",value:e.value};case"Literal":{let t={type:"literal",value:e.value,datatype:e.datatype?.value,language:e.language};if(e.language){let n=this.directionMappings.get(e.language.toLowerCase());n&&(t.direction=n)}return t}case"BlankNode":return{type:"blank",value:e.value};case"Quad":return this.translateQuotedTriple(e);default:throw new ui.AlgebraTranslatorError(`Unsupported term type: ${e.termType}`)}}translateQuotedTriple(e){if(!e.subject||!e.predicate||!e.object)throw new ui.AlgebraTranslatorError("Quoted triple must have subject, predicate, and object");return{type:"quoted",subject:this.translateTripleElement(e.subject),predicate:this.translateQuotedTriplePredicate(e.predicate),object:this.translateTripleElement(e.object)}}translateQuotedTriplePredicate(e){if(!e||!("termType"in e))throw new ui.AlgebraTranslatorError("Quoted triple predicate must have termType");switch(e.termType){case"Variable":return{type:"variable",value:e.value};case"NamedNode":return{type:"iri",value:e.value};default:throw new ui.AlgebraTranslatorError(`Quoted triple predicate must be IRI or Variable, got: ${e.termType}`)}}};p_.TripleTranslator=tI});var pM=T(h_=>{"use strict";Object.defineProperty(h_,"__esModule",{value:!0});h_.ExpressionTranslator=void 0;var $f=ru(),rI=class{static{a(this,"ExpressionTranslator")}constructor(e){this.translateWhereFn=e.translateWhere,this.translateBGPFn=e.translateBGP,this.translatePatternFn=e.translatePattern}translateExpression(e){if(!e)throw new $f.AlgebraTranslatorError("Expression cannot be null or undefined");if("type"in e&&e.type==="operation")return this.translateOperationExpression(e);let t="type"in e?e.type:void 0;if(t==="functioncall"||t==="functionCall"){let n=e;return{type:"functionCall",function:n.function,args:n.args.map(i=>this.translateExpression(i))}}if("termType"in e)return this.translateTermExpression(e);throw new $f.AlgebraTranslatorError(`Unsupported expression structure: ${JSON.stringify(e)}`)}translateFilter(e){if(!e.expression)throw new $f.AlgebraTranslatorError("Filter pattern must have expression");let t={type:"bgp",triples:[]};return{type:"filter",expression:this.translateExpression(e.expression),input:t}}translateTermExpression(e){if(e.termType==="Variable")return{type:"variable",name:e.value};if(e.termType==="Literal"){let t=e.value;return e.datatype&&(e.datatype.value.includes("#integer")||e.datatype.value.includes("#decimal")?t=parseFloat(e.value):e.datatype.value.includes("#boolean")&&(t=e.value==="true")),{type:"literal",value:t,datatype:e.datatype?.value}}return{type:"literal",value:String(e.value||e)}}translateOperationExpression(e){let t=["=","!=","<",">","<=",">="],n=["&&","||","!"],i=["+","-","*","/"],s=e.args.filter(o=>!("patterns"in o)||"termType"in o);return t.includes(e.operator)?{type:"comparison",operator:e.operator,left:this.translateExpression(s[0]),right:this.translateExpression(s[1])}:n.includes(e.operator)?{type:"logical",operator:e.operator,operands:s.map(o=>this.translateExpression(o))}:i.includes(e.operator)?{type:"arithmetic",operator:e.operator,left:this.translateExpression(s[0]),right:this.translateExpression(s[1])}:e.operator==="exists"||e.operator==="notexists"?this.translateExistsExpression(e):e.operator==="in"||e.operator==="notin"?this.translateInExpression(e):{type:"function",function:e.operator,args:s.map(o=>this.translateExpression(o))}}translateExistsExpression(e){if(!e.args||e.args.length!==1)throw new $f.AlgebraTranslatorError("EXISTS/NOT EXISTS must have exactly one pattern argument");let t=e.args[0],n;return t.type==="group"&&"patterns"in t&&t.patterns?n=this.translateWhereFn(t.patterns):t.type==="bgp"?n=this.translateBGPFn(t):n=this.translatePatternFn(t),{type:"exists",negated:e.operator==="notexists",pattern:n}}translateInExpression(e){if(!e.args||e.args.length!==2)throw new $f.AlgebraTranslatorError("IN/NOT IN must have exactly 2 arguments (expression and list)");let t=e.args[0],n=e.args[1];if(!Array.isArray(n))throw new $f.AlgebraTranslatorError("IN/NOT IN second argument must be an array of values");return{type:"in",expression:this.translateExpression(t),list:n.map(i=>this.translateExpression(i)),negated:e.operator==="notin"}}};h_.ExpressionTranslator=rI});var gM=T(m_=>{"use strict";Object.defineProperty(m_,"__esModule",{value:!0});m_.PatternTranslator=void 0;var hM=GA(),En=ru(),mM=d_(),nI=class{static{a(this,"PatternTranslator")}constructor(e){this.directionMappings=new Map,this.translateExpressionFn=e.translateExpression,this.translateSelectFn=e.translateSelect,this.translateBGPFn=e.translateBGP}setDirectionMappings(e){this.directionMappings=e}translateWhere(e){if(e.length===0)throw new En.AlgebraTranslatorError("Empty WHERE clause");let t=e.filter(s=>s.type==="filter"),n=e.filter(s=>s.type!=="filter"),i;if(n.length===0)i={type:"bgp",triples:[]};else{let s=n[0];if(s.type==="bind")i=this.translateBind(s,{type:"bgp",triples:[]});else if(s.type==="optional"){let o=s.expression;i={type:"leftjoin",left:{type:"bgp",triples:[]},right:this.translateWhere(s.patterns),expression:o?this.translateExpressionFn(o):void 0}}else i=this.translatePattern(s);for(let o=1;o<n.length;o++){let c=n[o];if(c.type==="bind")i=this.translateBind(c,i);else if(this.isLateralPattern(c)){let l=this.extractLateralSubquery(c),u=this.removeLateralMarker(l),f=this.translateSelectFn(u);i={type:"lateraljoin",left:i,right:f}}else if(c.type==="optional"){let l=c.expression;i={type:"leftjoin",left:i,right:this.translateWhere(c.patterns),expression:l?this.translateExpressionFn(l):void 0}}else if(c.type==="minus")i={type:"minus",left:i,right:this.translateWhere(c.patterns)};else{let l=this.translatePattern(c);i={type:"join",left:i,right:l}}}}for(let s of t)i={type:"filter",expression:this.translateExpressionFn(s.expression),input:i};return i}translatePattern(e){if(!e||!e.type)throw new En.AlgebraTranslatorError("Invalid pattern: missing type");switch(e.type){case"bgp":return this.translateBGPFn(e);case"filter":return this.translateFilter(e);case"optional":return this.translateOptional(e);case"union":return this.translateUnion(e);case"minus":return this.translateMinus(e);case"values":return this.translateValues(e);case"group":return this.translateWhere(e.patterns);case"query":return this.translateSubquery(e);case"service":return this.translateService(e);case"graph":return this.translateGraph(e);default:throw new En.AlgebraTranslatorError(`Unsupported pattern type: ${e.type}`)}}translateFilter(e){if(!e.expression)throw new En.AlgebraTranslatorError("Filter pattern must have expression");let t={type:"bgp",triples:[]};return{type:"filter",expression:this.translateExpressionFn(e.expression),input:t}}translateOptional(e){if(!e.patterns||e.patterns.length===0)throw new En.AlgebraTranslatorError("OPTIONAL pattern must have patterns");let t=e.expression;return{type:"leftjoin",left:{type:"bgp",triples:[]},right:this.translateWhere(e.patterns),expression:t?this.translateExpressionFn(t):void 0}}translateUnion(e){if(!e.patterns||e.patterns.length<2)throw new En.AlgebraTranslatorError("UNION pattern must have at least 2 patterns");let t=a(i=>i.type==="graph"?this.translateGraph(i):i.type==="service"?this.translateService(i):"patterns"in i&&i.patterns&&Array.isArray(i.patterns)?this.translateWhere(i.patterns):this.translateWhere([i]),"translateBranch"),n={type:"union",left:t(e.patterns[0]),right:t(e.patterns[1])};for(let i=2;i<e.patterns.length;i++)n={type:"union",left:n,right:t(e.patterns[i])};return n}translateMinus(e){if(!e.patterns||e.patterns.length===0)throw new En.AlgebraTranslatorError("MINUS pattern must have patterns");return{type:"minus",left:{type:"bgp",triples:[]},right:this.translateWhere(e.patterns)}}translateValues(e){if(!e.values||!Array.isArray(e.values))throw new En.AlgebraTranslatorError("VALUES pattern must have values array");let t=new Set;for(let i of e.values)for(let s of Object.keys(i)){let o=s.startsWith("?")?s.slice(1):s;t.add(o)}let n=e.values.map(i=>this.translateValuesBinding(i));return{type:"values",variables:Array.from(t),bindings:n}}translateValuesBinding(e){let t={};for(let[n,i]of Object.entries(e)){let s=n.startsWith("?")?n.slice(1):n,o=i;if(o)if(o.termType==="NamedNode")t[s]={type:"iri",value:o.value};else if(o.termType==="Literal"){let c=o,l={type:"literal",value:c.value,datatype:c.datatype?.value,language:c.language||void 0};if(c.language){let u=this.directionMappings.get(c.language.toLowerCase());u&&(l.direction=u)}t[s]=l}else throw new En.AlgebraTranslatorError(`Unsupported VALUES term type: ${o.termType}`)}return t}translateBind(e,t){if(!e.variable||!e.expression)throw new En.AlgebraTranslatorError("BIND pattern must have variable and expression");let n=this.translateExpressionFn(e.expression),i=e.expression.termType==="NamedNode";return{type:"extend",variable:e.variable.value,expression:i&&n.type==="literal"?{...n,iri:!0}:n,input:t}}translateSubquery(e){if(e.queryType!=="SELECT")throw new En.AlgebraTranslatorError(`Only SELECT subqueries are supported, got: ${String(e.queryType)}`);let t=this.removeLateralMarker(e);return{type:"subquery",query:this.translateSelectFn(t)}}translateService(e){if(!e.name||e.name.termType!=="NamedNode")throw new En.AlgebraTranslatorError("SERVICE pattern must have a NamedNode endpoint");if(!e.patterns||!Array.isArray(e.patterns))throw new En.AlgebraTranslatorError("SERVICE pattern must have patterns array");return{type:"service",endpoint:e.name.value,pattern:this.translateWhere(e.patterns),silent:e.silent||!1}}translateGraph(e){if(!e.name)throw new En.AlgebraTranslatorError("GRAPH pattern must have a name (IRI or variable)");if(!e.patterns||!Array.isArray(e.patterns))throw new En.AlgebraTranslatorError("GRAPH pattern must have patterns array");let t;if(e.name.termType==="NamedNode")t={type:"iri",value:e.name.value};else if(e.name.termType==="Variable")t={type:"variable",value:e.name.value};else throw new En.AlgebraTranslatorError(`GRAPH pattern name must be NamedNode or Variable, got: ${e.name.termType}`);return{type:"graph",name:t,pattern:this.translateWhere(e.patterns)}}isLateralPattern(e){if(e.type==="query"&&this.isLateralSubquery(e))return!0;if(e.type==="group"&&e.patterns?.length===1){let t=e.patterns[0];if(t.type==="query"&&this.isLateralSubquery(t))return!0}return!1}extractLateralSubquery(e){if(e.type==="query")return e;if(e.type==="group"&&e.patterns?.length===1){let t=e.patterns[0];if(t.type==="query")return t}throw new En.AlgebraTranslatorError("Invalid lateral pattern structure")}isLateralSubquery(e){return!("queryType"in e)||e.queryType!=="SELECT"||!("variables"in e)||!e.variables?!1:e.variables.some(i=>(0,mM.isVariableTerm)(i)&&i.value===hM.LateralTransformer.LATERAL_MARKER)}removeLateralMarker(e){if(!("variables"in e)||!e.variables)return e;let t=e,n=t.variables;return{...t,variables:n.filter(i=>!((0,mM.isVariableTerm)(i)&&i.value===hM.LateralTransformer.LATERAL_MARKER))}}};m_.PatternTranslator=nI});var y_=T(Bf=>{"use strict";Object.defineProperty(Bf,"__esModule",{value:!0});Bf.CustomAggregateRegistry=Bf.CustomAggregateError=void 0;var jf=class extends Error{static{a(this,"CustomAggregateError")}constructor(e,t){super(e),this.iri=t,this.name="CustomAggregateError"}};Bf.CustomAggregateError=jf;var g_=class r{static{a(this,"CustomAggregateRegistry")}constructor(){this.aggregates=new Map}static getInstance(){return r.instance||(r.instance=new r),r.instance}static resetInstance(){r.instance&&r.instance.clear(),r.instance=null}register(e,t){if(!e||typeof e!="string")throw new jf("Aggregate IRI must be a non-empty string");if(!t||typeof t.init!="function"||typeof t.step!="function"||typeof t.finalize!="function")throw new jf("Aggregate must implement init(), step(), and finalize() methods",e);if(this.aggregates.has(e))throw new jf(`Aggregate with IRI "${e}" is already registered`,e);this.aggregates.set(e,t)}unregister(e){return this.aggregates.delete(e)}get(e){return this.aggregates.get(e)}has(e){return this.aggregates.has(e)}getRegisteredIris(){return Array.from(this.aggregates.keys())}clear(){this.aggregates.clear()}get size(){return this.aggregates.size}};Bf.CustomAggregateRegistry=g_;g_.instance=null});var b_=T(Ze=>{"use strict";Object.defineProperty(Ze,"__esModule",{value:!0});Ze.BUILT_IN_AGGREGATES=Ze.interceptAggregate=Ze.slopeAggregate=Ze.corrAggregate=Ze.modeAggregate=Ze.stddevAggregate=Ze.varianceAggregate=Ze.medianAggregate=Ze.EXO_AGGREGATE_NS=void 0;Ze.getNumericValue=Vf;Ze.createDecimalLiteral=Ds;Ze.createDoubleLiteral=Nee;Ze.createPercentileAggregate=nu;var Vn=Ye(),Uf=Me(),__=new Uf.IRI("http://www.w3.org/2001/XMLSchema#decimal"),iu=new Uf.IRI("http://www.w3.org/2001/XMLSchema#double");Ze.EXO_AGGREGATE_NS="https://exocortex.my/ontology/agg#";function Vf(r){return r==null?NaN:typeof r=="number"?r:typeof r=="string"?parseFloat(r):r instanceof Vn.Literal?parseFloat(r.value):r instanceof Uf.IRI?NaN:typeof r=="boolean"?r?1:0:NaN}a(Vf,"getNumericValue");function Ds(r){return new Vn.Literal(String(r),__)}a(Ds,"createDecimalLiteral");function Nee(r){return new Vn.Literal(String(r),iu)}a(Nee,"createDoubleLiteral");Ze.medianAggregate={init(){return{values:[]}},step(r,e){let t=r,n=Vf(e);isNaN(n)||t.values.push(n)},finalize(r){let e=r,{values:t}=e;if(t.length===0)return Ds(0);let n=[...t].sort((o,c)=>o-c),i=Math.floor(n.length/2),s=n.length%2!==0?n[i]:(n[i-1]+n[i])/2;return Ds(s)}};Ze.varianceAggregate={init(){return{values:[]}},step(r,e){let t=r,n=Vf(e);isNaN(n)||t.values.push(n)},finalize(r){let e=r,{values:t}=e;if(t.length===0)return Ds(0);let n=t.reduce((s,o)=>s+o,0)/t.length,i=t.reduce((s,o)=>s+Math.pow(o-n,2),0)/t.length;return Ds(i)}};Ze.stddevAggregate={init(){return{values:[]}},step(r,e){Ze.varianceAggregate.step(r,e)},finalize(r){let e=r,{values:t}=e;if(t.length===0)return Ds(0);let n=t.reduce((s,o)=>s+o,0)/t.length,i=t.reduce((s,o)=>s+Math.pow(o-n,2),0)/t.length;return Ds(Math.sqrt(i))}};Ze.modeAggregate={init(){return{counts:new Map,values:new Map}},step(r,e){if(e==null)return;let t=r,n=String(e instanceof Vn.Literal||e instanceof Uf.IRI?e.value:e),i=t.counts.get(n)||0;t.counts.set(n,i+1),t.values.set(n,e)},finalize(r){let e=r;if(e.counts.size===0)return new Vn.Literal(" ",new Uf.IRI("http://www.w3.org/2001/XMLSchema#string"));let t="",n=0;for(let[o,c]of e.counts)c>n&&(n=c,t=o);let i=e.values.get(t);if(i instanceof Vn.Literal)return i;let s=parseFloat(t);return isNaN(s)?new Vn.Literal(t,new Uf.IRI("http://www.w3.org/2001/XMLSchema#string")):Ds(s)}};function nu(r){let e=Math.max(0,Math.min(100,r))/100;return{init(){return{values:[],percentile:e}},step(t,n){let i=t,s=Vf(n);isNaN(s)||i.values.push(s)},finalize(t){let n=t,{values:i}=n;if(i.length===0)return Ds(0);let s=[...i].sort((d,p)=>d-p),o=n.percentile*(s.length-1),c=Math.floor(o),l=Math.ceil(o);if(c===l)return Ds(s[c]);let u=o-c,f=s[c]*(1-u)+s[l]*u;return Ds(f)}}}a(nu,"createPercentileAggregate");function iI(){return{n:0,sx:0,sy:0,sxx:0,syy:0,sxy:0}}a(iI,"bivariateInit");function sI(r,e,t){let n=r,i=Vf(e),s=Vf(t);isNaN(i)||isNaN(s)||(n.n+=1,n.sx+=i,n.sy+=s,n.sxx+=i*i,n.syy+=s*s,n.sxy+=i*s)}a(sI,"bivariateStep");Ze.corrAggregate={arity:2,init:iI,step:sI,finalize(r){let{n:e,sx:t,sy:n,sxx:i,syy:s,sxy:o}=r;if(e<2)return new Vn.Literal("NaN",iu);let c=e*o-t*n,l=e*i-t*t,u=e*s-n*n;return l<=0||u<=0?new Vn.Literal("NaN",iu):new Vn.Literal(String(c/Math.sqrt(l*u)),__)}};Ze.slopeAggregate={arity:2,init:iI,step:sI,finalize(r){let{n:e,sx:t,sy:n,sxx:i,sxy:s}=r;if(e<2)return new Vn.Literal("NaN",iu);let o=e*i-t*t;return o<=0?new Vn.Literal("NaN",iu):new Vn.Literal(String((e*s-t*n)/o),__)}};Ze.interceptAggregate={arity:2,init:iI,step:sI,finalize(r){let{n:e,sx:t,sy:n,sxx:i,sxy:s}=r;if(e<2)return new Vn.Literal("NaN",iu);let o=e*i-t*t;if(o<=0)return new Vn.Literal("NaN",iu);let c=(e*s-t*n)/o;return new Vn.Literal(String((n-c*t)/e),__)}};Ze.BUILT_IN_AGGREGATES={[`${Ze.EXO_AGGREGATE_NS}median`]:Ze.medianAggregate,[`${Ze.EXO_AGGREGATE_NS}variance`]:Ze.varianceAggregate,[`${Ze.EXO_AGGREGATE_NS}stddev`]:Ze.stddevAggregate,[`${Ze.EXO_AGGREGATE_NS}mode`]:Ze.modeAggregate,[`${Ze.EXO_AGGREGATE_NS}percentile25`]:nu(25),[`${Ze.EXO_AGGREGATE_NS}percentile50`]:nu(50),[`${Ze.EXO_AGGREGATE_NS}percentile75`]:nu(75),[`${Ze.EXO_AGGREGATE_NS}percentile90`]:nu(90),[`${Ze.EXO_AGGREGATE_NS}percentile95`]:nu(95),[`${Ze.EXO_AGGREGATE_NS}percentile99`]:nu(99),[`${Ze.EXO_AGGREGATE_NS}corr`]:Ze.corrAggregate,[`${Ze.EXO_AGGREGATE_NS}slope`]:Ze.slopeAggregate,[`${Ze.EXO_AGGREGATE_NS}intercept`]:Ze.interceptAggregate}});var bM=T(S_=>{"use strict";Object.defineProperty(S_,"__esModule",{value:!0});S_.AggregateTranslator=void 0;var yM=ru(),_M=d_(),oI=y_(),Ta=b_(),aI=class{static{a(this,"AggregateTranslator")}constructor(e){this.aggregateCounter=0,this.translateExpressionFn=e.translateExpression}resetCounter(){this.aggregateCounter=0}extractAggregatesWithMapping(e,t){if(!e)return[];let n=[];for(let i of e)if((0,_M.isVariableExpression)(i))if("type"in i.expression&&i.expression.type==="aggregate")n.push({variable:i.variable.value,expression:this.translateAggregateExpression(i.expression)}),t.set(i.expression,i.variable.value);else{let s=this.customAggregateIri(i.expression);s?(n.push({variable:i.variable.value,expression:this.translateCustomAggregateFunctionCall(i.expression,s)}),t.set(i.expression,i.variable.value)):this.collectNestedAggregates(i.expression,n,t)}return n}extractGroupVariables(e){return e?e.filter(t=>t.expression&&"termType"in t.expression&&t.expression.termType==="Variable").map(t=>t.expression.value):[]}extractHavingExpressions(e,t,n){if(!e||e.length===0)return[];for(let i of e)this.collectNestedAggregates(i,t,n);return e.map(i=>this.transformExpressionWithAggregateVars(i,n))}transformExpressionWithAggregateVars(e,t){let n=t.get(e);if(n!==void 0)return{type:"variable",name:n};if("type"in e&&e.type==="operation"&&"args"in e){let i=e,s=i.args.filter(u=>!Array.isArray(u)&&!("patterns"in u)).map(u=>this.transformExpressionWithAggregateVars(u,t)),o=["=","!=","<",">","<=",">="],c=["&&","||","!"],l=["+","-","*","/"];return o.includes(i.operator)?{type:"comparison",operator:i.operator,left:s[0],right:s[1]}:c.includes(i.operator)?{type:"logical",operator:i.operator,operands:s}:l.includes(i.operator)?{type:"arithmetic",operator:i.operator,left:s[0],right:s[1]}:{type:"function",function:i.operator,args:s}}return this.translateExpressionFn(e)}translateOrderComparator(e){return{expression:this.translateExpressionFn(e.expression),descending:e.descending||!1}}translateAggregateExpression(e){let t=e.aggregation,n=a(()=>{if(e.expression&&!("termType"in e.expression&&e.expression.termType==="Wildcard"))return this.translateExpressionFn(e.expression)},"translateInnerExpr");if(typeof t=="string"){let s=t.toLowerCase();return["count","sum","avg","min","max","group_concat","sample"].includes(s)?{type:"aggregate",aggregation:s,expression:n(),distinct:e.distinct||!1,separator:e.separator}:{type:"aggregate",aggregation:{type:"custom",iri:t},expression:n(),distinct:e.distinct||!1,separator:e.separator}}let i=t;if(i&&typeof i=="object"){let s,o=i;if(o.termType==="NamedNode"&&typeof o.value=="string")s=o.value;else if("value"in o)s=String(o.value);else throw new yM.AlgebraTranslatorError(`Invalid custom aggregate: expected IRI but got ${JSON.stringify(i)}`);return{type:"aggregate",aggregation:{type:"custom",iri:s},expression:n(),distinct:e.distinct||!1,separator:e.separator}}throw new yM.AlgebraTranslatorError(`Unknown aggregate format: ${JSON.stringify(t)}`)}customAggregateIri(e){if(!(0,_M.isFunctionCallExpression)(e))return null;let t=e.function,n=null;if(typeof t=="string"?n=t:t&&typeof t=="object"&&"value"in t&&(n=String(t.value)),!n)return null;if(n in Ta.BUILT_IN_AGGREGATES||oI.CustomAggregateRegistry.getInstance().get(n)!==void 0)return n;if(n.startsWith(Ta.EXO_AGGREGATE_NS)){let s=[...Object.keys(Ta.BUILT_IN_AGGREGATES),...oI.CustomAggregateRegistry.getInstance().getRegisteredIris()].filter(o=>o.startsWith(Ta.EXO_AGGREGATE_NS)).map(o=>o.slice(Ta.EXO_AGGREGATE_NS.length)).sort();throw new Error(`Unknown aggregate agg:${n.slice(Ta.EXO_AGGREGATE_NS.length)}. Registered: ${s.length>0?s.map(o=>`agg:${o}`).join(", "):"(none)"}.`)}return null}translateCustomAggregateFunctionCall(e,t){let n=e,s=(oI.CustomAggregateRegistry.getInstance().get(t)??Ta.BUILT_IN_AGGREGATES[t])?.arity??1,o=n.args?.length??0;if(o!==s){let u=t.startsWith(Ta.EXO_AGGREGATE_NS)?`agg:${t.slice(Ta.EXO_AGGREGATE_NS.length)}`:t;throw new Error(`${u} takes exactly ${s} argument${s===1?"":"s"}, got ${o}.`)}let c=o>0?n.args?.[0]:void 0,l=s===2?n.args?.[1]:void 0;return{type:"aggregate",aggregation:{type:"custom",iri:t},expression:c?this.translateExpressionFn(c):void 0,expression2:l?this.translateExpressionFn(l):void 0,distinct:n.distinct||!1}}collectNestedAggregates(e,t,n){if(!e)return;if("type"in e&&e.type==="aggregate"){let s=`__agg${this.aggregateCounter++}`;t.push({variable:s,expression:this.translateAggregateExpression(e)}),n.set(e,s);return}let i=this.customAggregateIri(e);if(i){let s=`__agg${this.aggregateCounter++}`;t.push({variable:s,expression:this.translateCustomAggregateFunctionCall(e,i)}),n.set(e,s);return}if("type"in e&&e.type==="operation"&&"args"in e){let s=e;for(let o of s.args)!Array.isArray(o)&&"type"in o&&!("patterns"in o)?this.collectNestedAggregates(o,t,n):"termType"in o&&this.collectNestedAggregates(o,t,n)}}};S_.AggregateTranslator=aI});var Gf=T(xc=>{"use strict";Object.defineProperty(xc,"__esModule",{value:!0});xc.AlgebraTranslator=xc.ExoQLAlgebraTranslator=xc.AlgebraTranslatorError=void 0;var w_=ru(),E_=d_(),kee=dM(),Mee=pM(),$ee=gM(),jee=bM(),Bee=ru();Object.defineProperty(xc,"AlgebraTranslatorError",{enumerable:!0,get:a(function(){return Bee.AlgebraTranslatorError},"get")});var v_=class{static{a(this,"ExoQLAlgebraTranslator")}constructor(){this.tripleTranslator=new kee.TripleTranslator,this.expressionTranslator=new Mee.ExpressionTranslator({translateWhere:a(e=>this.patternTranslator.translateWhere(e),"translateWhere"),translateBGP:a(e=>this.tripleTranslator.translateBGP(e),"translateBGP"),translatePattern:a(e=>this.patternTranslator.translatePattern(e),"translatePattern")}),this.patternTranslator=new $ee.PatternTranslator({translateExpression:a(e=>this.expressionTranslator.translateExpression(e),"translateExpression"),translateSelect:a(e=>this.translateSelect(e),"translateSelect"),translateBGP:a(e=>this.tripleTranslator.translateBGP(e),"translateBGP")}),this.aggregateTranslator=new jee.AggregateTranslator({translateExpression:a(e=>this.expressionTranslator.translateExpression(e),"translateExpression")})}setDirectionMappings(e){this.tripleTranslator.setDirectionMappings(e),this.patternTranslator.setDirectionMappings(e)}translate(e){if(e.type!=="query")throw new w_.AlgebraTranslatorError("Only query operations are supported (not updates)");if(e.queryType==="SELECT")return this.translateSelect(e);if(e.queryType==="CONSTRUCT")return this.translateConstruct(e);if(e.queryType==="ASK")return this.translateAsk(e);if(e.queryType==="DESCRIBE")return this.translateDescribe(e);throw new w_.AlgebraTranslatorError(`Query type ${String(e.queryType)} not yet supported`)}translateSelect(e){if(!e.where||e.where.length===0)throw new w_.AlgebraTranslatorError("SELECT query must have WHERE clause");let t=this.patternTranslator.translateWhere(e.where);this.aggregateTranslator.resetCounter();let n=new Map,i=Array.isArray(e.variables)?e.variables.filter(l=>!("termType"in l&&l.termType==="Wildcard")):[],s=this.aggregateTranslator.extractAggregatesWithMapping(i,n),o=this.aggregateTranslator.extractGroupVariables(e.group),c=this.aggregateTranslator.extractHavingExpressions(e.having,s,n);if((s.length>0||o.length>0||c.length>0)&&(t={type:"group",variables:o,aggregates:s,having:c.length>0?c:void 0,input:t}),i.length>0){for(let l of i)if((0,E_.isVariableExpression)(l)){if("type"in l.expression&&l.expression.type==="aggregate")continue;let u=this.aggregateTranslator.transformExpressionWithAggregateVars(l.expression,n);t={type:"extend",variable:l.variable.value,expression:u,input:t}}}if(e.order&&e.order.length>0&&(t={type:"orderby",comparators:e.order.map(l=>this.aggregateTranslator.translateOrderComparator(l)),input:t}),i.length>0){let l=i.filter(u=>(0,E_.isVariableTerm)(u)||(0,E_.isVariableExpression)(u)).map(u=>(0,E_.isVariableTerm)(u)?u.value:u.variable.value);l.length>0&&(t={type:"project",variables:l,input:t})}return e.distinct&&(t={type:"distinct",input:t}),e.reduced&&(t={type:"reduced",input:t}),(e.limit!==void 0||e.offset!==void 0)&&(t={type:"slice",limit:e.limit,offset:e.offset,input:t}),t}translateConstruct(e){let t=this.tripleTranslator.translateConstructTemplate(e.template??[]);if(!e.where||e.where.length===0)throw new w_.AlgebraTranslatorError("CONSTRUCT query must have WHERE clause");let n=this.patternTranslator.translateWhere(e.where),i=e;return(i.limit!==void 0||i.offset!==void 0)&&(n={type:"slice",limit:i.limit,offset:i.offset,input:n}),{type:"construct",template:t,where:n}}translateAsk(e){let t=e.where&&e.where.length>0?this.patternTranslator.translateWhere(e.where):{type:"bgp",triples:[]},n=e;this.aggregateTranslator.resetCounter();let i=new Map,s=[],o=this.aggregateTranslator.extractGroupVariables(n.group),c=this.aggregateTranslator.extractHavingExpressions(n.having,s,i);return(s.length>0||o.length>0||c.length>0)&&(t={type:"group",variables:o,aggregates:s,having:c.length>0?c:void 0,input:t}),(n.limit!==void 0||n.offset!==void 0)&&(t={type:"slice",limit:n.limit,offset:n.offset,input:t}),{type:"ask",where:t}}translateDescribe(e){let t=[];if(e.variables&&Array.isArray(e.variables)){let s=e.variables;for(let o of s)o.termType==="Wildcard"||o.value==="*"||(o.termType==="Variable"?t.push({type:"variable",value:o.value}):o.termType==="NamedNode"&&t.push({type:"iri",value:o.value}))}let n;e.where&&e.where.length>0&&(n=this.patternTranslator.translateWhere(e.where));let i=e.describeOptions;return{type:"describe",resources:t,where:n,depth:i?.depth,symmetric:i?.symmetric}}};xc.ExoQLAlgebraTranslator=v_;xc.AlgebraTranslator=v_});var Aa=T(T_=>{"use strict";Object.defineProperty(T_,"__esModule",{value:!0});T_.SolutionMapping=void 0;var SM=Ye(),wM=Me(),EM=lr(),cI=class r{static{a(this,"SolutionMapping")}constructor(e){this.bindings=e?new Map(e):new Map}get(e){return this.bindings.get(e)}set(e,t){this.bindings.set(e,t)}has(e){return this.bindings.has(e)}variables(){return Array.from(this.bindings.keys())}getBindings(){return new Map(this.bindings)}isCompatibleWith(e){for(let[t,n]of this.bindings.entries()){let i=e.get(t);if(i!==void 0&&!this.areEqual(n,i))return!1}return!0}merge(e){if(!this.isCompatibleWith(e))return null;let t=new r(this.bindings);for(let[n,i]of e.getBindings().entries())t.set(n,i);return t}clone(){return new r(this.bindings)}areEqual(e,t){return e instanceof SM.Literal&&t instanceof SM.Literal?e.equals(t):e instanceof wM.IRI&&t instanceof wM.IRI?e.value===t.value:e instanceof EM.BlankNode&&t instanceof EM.BlankNode?e.id===t.id:!1}toJSON(){let e={};for(let[t,n]of this.bindings.entries())e[t]=n.toString();return e}size(){return this.bindings.size}};T_.SolutionMapping=cI});var Ia=T(A_=>{"use strict";Object.defineProperty(A_,"__esModule",{value:!0});A_.LoggingService=void 0;var Vh=class{static{a(this,"LoggingService")}static setVerbose(e){this.isVerbose=e}static setDevelopmentMode(e){this.isDevelopment=e}static checkIsDevelopment(){return this.isDevelopment!==void 0?this.isDevelopment:typeof process<"u"?(this.isDevelopment=!1,this.isDevelopment):(this.isDevelopment=!1,this.isDevelopment)}static debug(e,t){this.isVerbose&&console.debug(`[Exocortex] ${e}`,t??"")}static info(e,t){console.log(`[Exocortex] ${e}`,t??"")}static warn(e,t){console.warn(`[Exocortex] ${e}`,t??"")}static error(e,t,n){let i=this.checkIsDevelopment(),s=n?` [${n}]`:"";if(i){let o=t?.stack?`
104
104
  Stack trace:
105
105
  ${t.stack}`:"";console.error(`[Exocortex ERROR]${s} ${e}${o}`,t??"")}else{let o=t?.message?`
106
106
  Details: ${t.message}`:"";console.error(`[Exocortex ERROR]${s} ${e}${o}`)}}};A_.LoggingService=Vh;Vh.isVerbose=!1;Vh.isDevelopment=void 0});var TM=T(Wf=>{"use strict";Object.defineProperty(Wf,"__esModule",{value:!0});Wf.PropertyPathExecutor=Wf.PropertyPathExecutorError=void 0;var Uee=Aa(),Vee=Ia(),I_=Me(),vM=lr(),Gee=Ye(),qf=class extends Error{static{a(this,"PropertyPathExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="PropertyPathExecutorError"}};Wf.PropertyPathExecutorError=qf;var R_=class r{static{a(this,"PropertyPathExecutor")}constructor(e){this.tripleStore=e,this.MAX_DEPTH=100}static literalGuardDetail(e){return Object.assign(new Error(JSON.stringify(e)),e)}async*execute(e,t,n){if(this.isLiteralElement(e)||this.isLiteralElement(n)){let o=this.isLiteralElement(e)?"subject":"object",c=this.isLiteralElement(e)?e:n,l="value"in c?String(c.value):"<unknown>",u=l.length>80?`${l.slice(0,77)}...`:l,f=this.describePath(t),d={position:o,value:u,path:f,hint:"Wikilink could not be resolved to IRI (likely label-form wikilink with no matching basename/alias). Check whether the target file exists in the queried vault, or add an alias. See issue #3282."};if(Vee.LoggingService.error(`[PropertyPathExecutor] literal-safety guard fired: literal in ${o} position \u2014 yielding 0 solutions. value="${u}" path=${f}`,r.literalGuardDetail(d),r.LITERAL_GUARD_CODE),r.isStrictModeEnabled())throw new qf(`Literal subject in property path: "${u}" (path=${f}). Set EXOCORTEX_SPARQL_STRICT=0 or omit --strict to fall back to warn-and-empty behaviour.`);return}let i=await this.resolveElement(e),s=this.isVariable(n)?null:await this.resolveElement(n);for(let o of i){let c=await this.evaluatePath(o,t,s);for(let l of c){let u=new Uee.SolutionMapping;this.isVariable(e)&&u.set(e.value,o),this.isVariable(n)&&u.set(n.value,l),yield u}}}async*executeWithBindings(e,t){if(!this.isPropertyPath(e.predicate))throw new qf("Predicate is not a property path");let n=this.instantiateElement(e.subject,t),i=this.instantiateElement(e.object,t);for await(let s of this.execute(n,e.predicate,i)){let o=t.merge(s);o!==null&&(yield o)}}async evaluatePath(e,t,n){switch(t.pathType){case"/":return this.evaluateSequencePath(e,t.items,n);case"|":return this.evaluateAlternativePath(e,t.items,n);case"^":return this.evaluateInversePath(e,t.items[0],n);case"+":return this.evaluateOneOrMorePath(e,t.items[0],n);case"*":return this.evaluateZeroOrMorePath(e,t.items[0],n);case"?":return this.evaluateZeroOrOnePath(e,t.items[0],n)}}async evaluateSequencePath(e,t,n){let i=new Set([e]);for(let s=0;s<t.length;s++){let o=t[s],c=s===t.length-1,l=new Set;for(let u of i){let f=await this.evaluatePathItem(u,o,c?n:null);for(let d of f)l.add(d)}if(i=l,i.size===0)break}return i}async evaluateAlternativePath(e,t,n){let i=new Set;for(let s of t){let o=await this.evaluatePathItem(e,s,n);for(let c of o)i.add(c)}return i}async evaluateInversePath(e,t,n){if(t.type==="iri"){let i=new I_.IRI(t.value),s=await this.tripleStore.match(void 0,i,e),o=new Set;for(let c of s)(n===null||this.nodeInSet(c.subject,n))&&o.add(c.subject);return o}else return this.evaluatePath(e,this.invertPath(t),n)}async evaluateOneOrMorePath(e,t,n){let i=new Set,s=new Set,o=new Set,c=[{node:e,depth:0}];for(;c.length>0;){let l=c.shift();if(!l)break;let{node:u,depth:f}=l;if(f>=this.MAX_DEPTH)continue;let d=await this.evaluatePathItem(u,t,null);for(let p of d){let h=this.nodeToKey(p);!o.has(h)&&(n===null||this.nodeInSet(p,n))&&(o.add(h),s.add(p)),i.has(h)||(i.add(h),c.push({node:p,depth:f+1}))}}return s}async evaluateZeroOrMorePath(e,t,n){let i=await this.evaluateOneOrMorePath(e,t,n);return!this.nodeInSet(e,i)&&(n===null||this.nodeInSet(e,n))&&i.add(e),i}async evaluateZeroOrOnePath(e,t,n){let i=new Set,s=new Set;(n===null||this.nodeInSet(e,n))&&(i.add(e),s.add(this.nodeToKey(e)));let o=await this.evaluatePathItem(e,t,n);for(let c of o){let l=this.nodeToKey(c);s.has(l)||(s.add(l),i.add(c))}return i}async evaluatePathItem(e,t,n){if(t.type==="iri"){let i=new I_.IRI(t.value),s=await this.tripleStore.match(e,i,void 0),o=new Set;for(let c of s)(n===null||this.nodeInSet(c.object,n))&&o.add(c.object);return o}else return this.evaluatePath(e,t,n)}invertPath(e){switch(e.pathType){case"^":return e.items[0];case"/":return{type:"path",pathType:"/",items:[...e.items].reverse().map(t=>t.type==="iri"?{type:"path",pathType:"^",items:[t]}:this.invertPath(t))};case"|":return{type:"path",pathType:"|",items:e.items.map(t=>t.type==="iri"?{type:"path",pathType:"^",items:[t]}:this.invertPath(t))};case"+":case"*":case"?":{let t=e.items[0].type==="iri"?{type:"path",pathType:"^",items:[e.items[0]]}:this.invertPath(e.items[0]);return{type:"path",pathType:e.pathType,items:[t]}}}}async resolveElement(e){if(this.isVariable(e)){let n=new Set,i=new Set,s=await this.tripleStore.match(void 0,void 0,void 0);for(let o of s)for(let c of[o.subject,o.object]){let l=this.nodeToKey(c);i.has(l)||(i.add(l),n.add(c))}return n}let t=new Set;switch(e.type){case"iri":t.add(new I_.IRI(e.value));break;case"blank":t.add(new vM.BlankNode(e.value));break;default:throw new qf(`Unsupported element type in subject/object position: ${e.type}`)}return t}instantiateElement(e,t){if(this.isVariable(e)){let n=t.get(e.value);if(n){if(n instanceof I_.IRI)return{type:"iri",value:n.value};if(n instanceof vM.BlankNode)return{type:"blank",value:n.id};if(n instanceof Gee.Literal)return{type:"literal",value:n.value,datatype:n.datatype?.value,language:n.language,direction:n.direction}}}return e}isVariable(e){return e.type==="variable"}isLiteralElement(e){return e.type==="literal"}isPropertyPath(e){return e.type==="path"}nodeToKey(e){return e.toString()}nodeInSet(e,t){let n=this.nodeToKey(e);for(let i of t)if(this.nodeToKey(i)===n)return!0;return!1}describePath(e){try{let t=e.items,n=a(s=>{if(s&&typeof s=="object"&&"type"in s){let o=s;if(o.type==="iri")return`<${String(o.value)}>`;if(o.type==="path")return this.describePath(o)}return"?"},"renderItem");if(!Array.isArray(t)||t.length===0)return"(?)";if(t.length===1){let s=n(t[0]);return e.pathType==="^"?`(^${s})`:e.pathType==="+"||e.pathType==="*"||e.pathType==="?"?`(${s}${e.pathType})`:`(${s})`}return`(${t.map(n).join(` ${e.pathType} `)})`}catch{return"<unprintable-path>"}}static isStrictModeEnabled(){let t=(typeof process<"u"?process.env:void 0)?.EXOCORTEX_SPARQL_STRICT;if(!t)return!1;let n=t.trim().toLowerCase();return n==="1"||n==="true"||n==="yes"}};Wf.PropertyPathExecutor=R_;R_.LITERAL_GUARD_CODE="SPARQL_LITERAL_GUARD"});var fI=T(Kf=>{"use strict";Object.defineProperty(Kf,"__esModule",{value:!0});Kf.BGPExecutor=Kf.BGPExecutorError=void 0;var C_=Aa(),Pc=Me(),lI=Ye(),O_=lr(),x_=hh(),P_=TM(),qee=Ia(),vn=class extends Error{static{a(this,"BGPExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="BGPExecutorError"}};Kf.BGPExecutorError=vn;var uI=class{static{a(this,"BGPExecutor")}constructor(e){this.tripleStore=e,this.propertyPathExecutor=new P_.PropertyPathExecutor(e)}async*execute(e){if(e.triples.length===0){yield new C_.SolutionMapping;return}let t=this.matchTriplePattern(e.triples[0],this.isPredicateFromBinding(e.triples[0].predicate,!1));for(let n=1;n<e.triples.length;n++)t=this.joinWithPattern(t,e.triples[n]);for await(let n of t)yield n}isPredicateFromBinding(e,t){return this.isPropertyPath(e)?!1:this.isVariable(e)?t:e.type==="iri"&&e.fromBinding===!0}async executeAll(e){let t=[];for await(let n of this.execute(e))t.push(n);return t}async*executeInGraph(e,t){if(e.triples.length===0){yield new C_.SolutionMapping;return}let n=this.matchTriplePatternInGraph(e.triples[0],t);for(let i=1;i<e.triples.length;i++)n=this.joinWithPatternInGraph(n,e.triples[i],t);for await(let i of n)yield i}async*matchTriplePatternInGraph(e,t){if(this.isPropertyPath(e.predicate))throw new vn("Property paths within named graphs are not yet supported");let n=e.predicate;if(this.isLiteral(e.subject)||this.isLiteral(n)){this.warnLiteralGuard("matchTriplePatternInGraph",this.isLiteral(e.subject)?"subject":"predicate",this.isLiteral(e.subject)?e.subject:n);return}let i=this.isVariable(e.subject)?void 0:this.toRDFTermAsSubject(e.subject),s=this.isVariable(n)?void 0:this.toRDFTermAsPredicate(n),o=this.isVariable(e.object)?void 0:this.toRDFTerm(e.object);if(!this.tripleStore.matchInGraph)throw new vn("Triple store does not support named graph operations");let c=await this.tripleStore.matchInGraph(i,s,o,t);for(let l of c){let u=new C_.SolutionMapping;this.isVariable(e.subject)&&u.set(e.subject.value,l.subject),this.isVariable(n)&&u.set(n.value,l.predicate),this.isVariable(e.object)&&u.set(e.object.value,l.object),yield u}}async*joinWithPatternInGraph(e,t,n){let i=[];for await(let s of e)i.push(s);for(let s of i){let o=this.instantiatePattern(t,s);for await(let c of this.matchTriplePatternInGraph(o,n)){let l=s.merge(c);l!==null&&(yield l)}}}async*matchTriplePattern(e,t=!1){if(this.isPropertyPath(e.predicate)){if(this.isLiteral(e.subject)||this.isLiteral(e.object)){this.warnLiteralGuard("matchTriplePattern.propertyPath",this.isLiteral(e.subject)?"subject":"object",this.isLiteral(e.subject)?e.subject:e.object);return}yield*this.propertyPathExecutor.execute(e.subject,e.predicate,e.object);return}let n=e.predicate;if(this.isLiteral(e.subject)||this.isLiteral(n)){this.warnLiteralGuard("matchTriplePattern",this.isLiteral(e.subject)?"subject":"predicate",this.isLiteral(e.subject)?e.subject:n);return}let i=this.isVariable(e.subject)||this.isQuotedTriple(e.subject)&&this.hasVariablesInQuotedTriple(e.subject)?void 0:this.toRDFTermAsSubject(e.subject),s=this.isVariable(n)?void 0:this.toRDFTermAsPredicate(n),o=this.isVariable(e.object)||this.isQuotedTriple(e.object)&&this.hasVariablesInQuotedTriple(e.object)?void 0:this.toRDFTerm(e.object),c=t&&this.tripleStore.matchExactPredicate?await this.tripleStore.matchExactPredicate(i,s,o):await this.tripleStore.match(i,s,o);for(let l of c){let u=new C_.SolutionMapping;if(this.isVariable(e.subject))u.set(e.subject.value,l.subject);else if(this.isQuotedTriple(e.subject)){let f=this.matchQuotedTriplePattern(e.subject,l.subject);if(f===null)continue;for(let[d,p]of f.entries())u.set(d,p)}if(this.isVariable(n)&&u.set(n.value,l.predicate),this.isVariable(e.object))u.set(e.object.value,l.object);else if(this.isQuotedTriple(e.object)){let f=this.matchQuotedTriplePattern(e.object,l.object);if(f===null)continue;for(let[d,p]of f.entries())u.set(d,p)}yield u}}hasVariablesInQuotedTriple(e){return!!(this.isVariable(e.subject)||e.predicate.type==="variable"||this.isVariable(e.object)||this.isQuotedTriple(e.subject)&&this.hasVariablesInQuotedTriple(e.subject)||this.isQuotedTriple(e.object)&&this.hasVariablesInQuotedTriple(e.object))}matchQuotedTriplePattern(e,t){if(!(t instanceof x_.QuotedTriple))return null;let n=new Map;if(this.isVariable(e.subject))n.set(e.subject.value,t.subject);else if(this.isQuotedTriple(e.subject)){let i=this.matchQuotedTriplePattern(e.subject,t.subject);if(i===null)return null;for(let[s,o]of i)n.set(s,o)}else if(!this.elementsMatch(e.subject,t.subject))return null;if(e.predicate.type==="variable")n.set(e.predicate.value,t.predicate);else if(e.predicate.value!==t.predicate.value)return null;if(this.isVariable(e.object))n.set(e.object.value,t.object);else if(this.isQuotedTriple(e.object)){let i=this.matchQuotedTriplePattern(e.object,t.object);if(i===null)return null;for(let[s,o]of i)n.set(s,o)}else if(!this.elementsMatch(e.object,t.object))return null;return n}elementsMatch(e,t){switch(e.type){case"iri":return t instanceof Pc.IRI&&e.value===t.value;case"literal":return!(!(t instanceof lI.Literal)||e.value!==t.value||e.datatype!==t.datatype?.value||e.language!==t.language||e.direction!==t.direction);case"blank":return t instanceof O_.BlankNode&&e.value===t.id;case"quoted":return t instanceof x_.QuotedTriple?this.toRDFQuotedTriple(e).equals(t):!1;default:return!1}}isPropertyPath(e){return e.type==="path"}async*joinWithPattern(e,t){let n=[];for await(let s of e)n.push(s);let i=this.isPredicateFromBinding(t.predicate,!0);for(let s of n){let o=this.instantiatePattern(t,s);for await(let c of this.matchTriplePattern(o,i)){let l=s.merge(c);l!==null&&(yield l)}}}instantiatePattern(e,t){let n=this.isPropertyPath(e.predicate)?e.predicate:this.instantiateElement(e.predicate,t);return{subject:this.instantiateElement(e.subject,t),predicate:n,object:this.instantiateElement(e.object,t)}}instantiateElement(e,t){if(this.isVariable(e)){let n=t.get(e.value);if(n)return this.toAlgebraElement(n)}return this.isQuotedTriple(e)?this.instantiateQuotedTriple(e,t):e}instantiateQuotedTriple(e,t){let n=this.instantiateElement(e.subject,t),i=e.predicate.type==="variable"?this.instantiatePredicateVariable(e.predicate,t):e.predicate,s=this.instantiateElement(e.object,t);return{type:"quoted",subject:n,predicate:i,object:s}}instantiatePredicateVariable(e,t){let n=t.get(e.value);return n&&n instanceof Pc.IRI?{type:"iri",value:n.value}:e}isVariable(e){return e.type==="variable"}isQuotedTriple(e){return e.type==="quoted"}isLiteral(e){return e.type==="literal"}warnLiteralGuard(e,t,n){let i="value"in n?String(n.value):"<unknown>",s=i.length>80?`${i.slice(0,77)}...`:i,o={executor:"BGPExecutor",context:e,position:t,value:s,hint:"Wikilink could not be resolved to IRI (likely label-form wikilink with no matching basename/alias). Check whether the target file exists in the queried vault, or add an alias. See issue #3282."};if(qee.LoggingService.error(`[BGPExecutor] literal-safety guard fired in ${e}: literal in ${t} position \u2014 yielding 0 solutions. value="${s}"`,P_.PropertyPathExecutor.literalGuardDetail(o),P_.PropertyPathExecutor.LITERAL_GUARD_CODE),P_.PropertyPathExecutor.isStrictModeEnabled())throw new vn(`Literal in ${t} position (${e}): "${s}". Set EXOCORTEX_SPARQL_STRICT=0 or omit --strict to fall back to warn-and-empty behaviour.`)}toRDFTermAsSubject(e){switch(e.type){case"iri":return new Pc.IRI(e.value);case"blank":return new O_.BlankNode(e.value);case"literal":throw new vn("Literals cannot appear in subject position");case"variable":throw new vn(`Cannot convert variable to RDF term: ${e.value}`);case"quoted":return this.toRDFQuotedTriple(e);default:throw new vn(`Unknown element type: ${String(e)}`)}}toRDFQuotedTriple(e){let t=this.toRDFTermAsSubject(e.subject),n=e.predicate.type==="iri"?new Pc.IRI(e.predicate.value):(()=>{throw new vn("Quoted triple predicate must be IRI")})(),i=this.toRDFTerm(e.object);return new x_.QuotedTriple(t,n,i)}toRDFTermAsPredicate(e){switch(e.type){case"iri":return new Pc.IRI(e.value);case"literal":throw new vn("Literals cannot appear in predicate position");case"blank":throw new vn("Blank nodes cannot appear in predicate position");case"variable":throw new vn(`Cannot convert variable to RDF term: ${e.value}`);default:throw new vn(`Unknown element type: ${String(e)}`)}}toRDFTerm(e){switch(e.type){case"iri":return new Pc.IRI(e.value);case"literal":return new lI.Literal(e.value,e.datatype?new Pc.IRI(e.datatype):void 0,e.language,e.direction);case"blank":return new O_.BlankNode(e.value);case"variable":throw new vn(`Cannot convert variable to RDF term: ${e.value}`);case"quoted":return this.toRDFQuotedTriple(e);default:throw new vn(`Unknown element type: ${String(e)}`)}}toAlgebraElement(e){if(e instanceof Pc.IRI)return{type:"iri",value:e.value};if(e instanceof lI.Literal)return{type:"literal",value:e.value,datatype:e.datatype?.value,language:e.language,direction:e.direction};if(e instanceof O_.BlankNode)return{type:"blank",value:e.id};if(e instanceof x_.QuotedTriple)return this.toAlgebraQuotedTriple(e);throw new vn(`Unknown RDF term type: ${String(e)}`)}toAlgebraQuotedTriple(e){return{type:"quoted",subject:this.toAlgebraElement(e.subject),predicate:{type:"iri",value:e.predicate.value},object:this.toAlgebraElement(e.object)}}};Kf.BGPExecutor=uI});var AM=T(F_=>{"use strict";Object.defineProperty(F_,"__esModule",{value:!0});F_.StringFunctions=void 0;var zf=Me(),Fc=Ye(),dI=lr(),Gh=class r{static{a(this,"StringFunctions")}static str(e){if(e===void 0)throw new Error("STR: argument is undefined");return e instanceof zf.IRI||e instanceof Fc.Literal?e.value:e instanceof dI.BlankNode?e.id:String(e)}static lang(e){if(e===void 0)throw new Error("LANG: argument is undefined");return e instanceof Fc.Literal&&e.language?e.language:""}static langdir(e){if(e===void 0)throw new Error("LANGDIR: argument is undefined");return!(e instanceof Fc.Literal)||!e.language?"":e.direction?`${e.language}--${e.direction}`:e.language}static langMatches(e,t){let[n,i]=r.parseDirectionalLangTag(e),[s,o]=r.parseDirectionalLangTag(t),c=n.toLowerCase(),l=s.toLowerCase();return l==="*"?c!=="":c===""?l==="":o&&i!==o?!1:c===l?!0:c.startsWith(l+"-")}static parseDirectionalLangTag(e){let t=e.indexOf("--");if(t===-1)return[e,void 0];let n=e.substring(0,t),i=e.substring(t+2).toLowerCase();return[n,i]}static regex(e,t,n){try{let i=n?n.includes("u")?n:n+"u":"u";return new RegExp(t,i).test(e)}catch(i){throw new Error(`REGEX: invalid pattern '${t}': ${i.message}`)}}static contains(e,t){return e.includes(t)}static strStarts(e,t){return e.startsWith(t)}static strEnds(e,t){return e.endsWith(t)}static strlen(e){return e.length}static ucase(e){return e.toUpperCase()}static lcase(e){return e.toLowerCase()}static substr(e,t,n){let i=t-1;if(i<0){if(n!==void 0){let s=n+i;return s<=0?"":e.substring(0,s)}return e}return n!==void 0?e.substring(i,i+n):e.substring(i)}static strBefore(e,t){if(t==="")return"";let n=e.indexOf(t);return n===-1?"":e.substring(0,n)}static strAfter(e,t){if(t==="")return e;let n=e.indexOf(t);return n===-1?"":e.substring(n+t.length)}static concat(...e){return e.join("")}static replace(e,t,n,i){try{let s=i||"g",o=s.includes("u")?s:s+"u",c=new RegExp(t,o);return e.replace(c,n)}catch(s){throw new Error(`REPLACE: invalid pattern '${t}': ${s.message}`)}}static encodeForUri(e){return encodeURIComponent(e)}static normalize(e,t){if(e===void 0)throw new Error("NORMALIZE: string argument is undefined");let n;if(e instanceof Fc.Literal)n=e.value;else if(e instanceof zf.IRI)n=e.value;else if(e instanceof dI.BlankNode)n=e.id;else if(typeof e=="string")n=e;else throw new Error("NORMALIZE: first argument must be a string or literal");let i="NFC";if(t!==void 0)if(t instanceof Fc.Literal)i=t.value.toUpperCase();else if(typeof t=="string")i=t.toUpperCase();else if(t instanceof zf.IRI)i=t.value.toUpperCase();else throw new Error("NORMALIZE: second argument must be a string literal");if(!r.VALID_NORMALIZATION_FORMS.includes(i))throw new Error(`NORMALIZE: invalid normalization form '${i}'. Valid forms are: NFC, NFD, NFKC, NFKD`);let s=n.normalize(i);return new Fc.Literal(s,new zf.IRI("http://www.w3.org/2001/XMLSchema#string"))}static fold(e){if(e===void 0)throw new Error("FOLD: string argument is undefined");let t;if(e instanceof Fc.Literal)t=e.value;else if(e instanceof zf.IRI)t=e.value;else if(e instanceof dI.BlankNode)t=e.id;else if(typeof e=="string")t=e;else throw new Error("FOLD: argument must be a string or literal");let n=r.unicodeCaseFold(t);return new Fc.Literal(n,new zf.IRI("http://www.w3.org/2001/XMLSchema#string"))}static unicodeCaseFold(e){let t="";for(let n of e){let i=r.CASE_FOLDING_MAP.get(n);i!==void 0?t+=i:t+=n.toLowerCase()}return t}};F_.StringFunctions=Gh;Gh.VALID_NORMALIZATION_FORMS=["NFC","NFD","NFKC","NFKD"];Gh.CASE_FOLDING_MAP=new Map([["\xDF","ss"],["\u1E9E","ss"],["\u03A3","\u03C3"],["\u03C2","\u03C3"],["\u0130","i\u0307"],["I","i"],["\u0587","\u0565\u0582"],["\uFB00","ff"],["\uFB01","fi"],["\uFB02","fl"],["\uFB03","ffi"],["\uFB04","ffl"],["\uFB05","st"],["\uFB06","st"],["\u0390","\u03B9\u0308\u0301"],["\u03B0","\u03C5\u0308\u0301"],["\u017F","s"],["\u1E9B","\u1E61"],["\u212A","k"],["\u212B","\xE5"]])});var IM=T(L_=>{"use strict";Object.defineProperty(L_,"__esModule",{value:!0});L_.MathFunctions=void 0;var pI=class{static{a(this,"MathFunctions")}static msToMinutes(e){return Math.round(e/(1e3*60))}static msToHours(e){return Math.round(e/(1e3*60*60)*100)/100}static msToSeconds(e){return Math.round(e/1e3)}static abs(e){return Math.abs(e)}static round(e){return Math.round(e)}static ceil(e){return Math.ceil(e)}static floor(e){return Math.floor(e)}static rand(){return Math.random()}};L_.MathFunctions=pI});var qh=T(D_=>{"use strict";Object.defineProperty(D_,"__esModule",{value:!0});D_.DateTimeParsing=void 0;var Wee=Me(),Kee=Ye(),hI=class r{static{a(this,"DateTimeParsing")}static parseDate(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`PARSEDATE: invalid date string '${e}'`);return t.getTime()}static parseDayTimeDuration(e){if(!e)throw new Error("parseDayTimeDuration: duration string is empty");let t=!1,n=e.trim();if(n.startsWith("-")&&(t=!0,n=n.substring(1)),!n.startsWith("P"))throw new Error(`parseDayTimeDuration: invalid format, must start with 'P': '${e}'`);n=n.substring(1);let i=0,s=n.indexOf("T"),o="",c="";if(s===-1?o=n:(o=n.substring(0,s),c=n.substring(s+1)),o){let l=o.match(/^(\d+(?:\.\d+)?)D$/);if(l){let u=parseFloat(l[1]);i+=u*24*60*60*1e3}else if(o!=="")throw new Error(`parseDayTimeDuration: invalid day component: '${o}' in '${e}'`)}if(c){let l=c,u=l.match(/^(\d+(?:\.\d+)?)H/);if(u){let p=parseFloat(u[1]);i+=p*60*60*1e3,l=l.substring(u[0].length)}let f=l.match(/^(\d+(?:\.\d+)?)M/);if(f){let p=parseFloat(f[1]);i+=p*60*1e3,l=l.substring(f[0].length)}let d=l.match(/^(\d+(?:\.\d+)?)S$/);if(d){let p=parseFloat(d[1]);i+=p*1e3,l=l.substring(d[0].length)}if(l!=="")throw new Error(`parseDayTimeDuration: invalid time component: '${l}' in '${e}'`)}return t?-i:i}static formatDayTimeDuration(e){let t=e<0,n=Math.abs(e),i=Math.floor(n/(1440*60*1e3));n=n%(1440*60*1e3);let s=Math.floor(n/(3600*1e3));n=n%(3600*1e3);let o=Math.floor(n/(60*1e3));n=n%(60*1e3);let c=n/1e3,l=t?"-P":"P";return i>0&&(l+=`${i}D`),(s>0||o>0||c>0||i===0)&&(l+="T",s>0&&(l+=`${s}H`),o>0&&(l+=`${o}M`),(c>0||s===0&&o===0)&&(Number.isInteger(c)?l+=`${c}S`:l+=`${parseFloat(c.toFixed(3))}S`)),l}static xsdDayTimeDuration(e){return r.parseDayTimeDuration(e),new Kee.Literal(e,new Wee.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static parseXSDDate(e){let t=/^(-?\d{4})-(\d{2})-(\d{2})(Z|[+-]\d{2}:\d{2})?$/,n=e.match(t);if(!n){let u=new Date(e);return isNaN(u.getTime())?null:new Date(Date.UTC(u.getUTCFullYear(),u.getUTCMonth(),u.getUTCDate()))}let i=parseInt(n[1],10),s=parseInt(n[2],10)-1,o=parseInt(n[3],10),c=n[4],l=new Date(Date.UTC(i,s,o));if(c&&c!=="Z"){let u=c.match(/([+-])(\d{2}):(\d{2})/);if(u){let f=u[1]==="+"?1:-1,d=parseInt(u[2],10),p=parseInt(u[3],10),h=f*(d*60+p)*60*1e3;l=new Date(l.getTime()-h)}}return l}static parseXSDTime(e){let t=/^(\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(Z|[+-]\d{2}:\d{2})?$/,n=e.match(t);if(!n)return null;let i=parseInt(n[1],10),s=parseInt(n[2],10),o=parseInt(n[3],10),c=n[4],l=n[5];if(i<0||i>24||s<0||s>59||o<0||o>59||i===24&&(s!==0||o!==0))return null;let u=0;if(c){let d=c.padEnd(3,"0").slice(0,3);u=parseInt(d,10)}let f=i*60*60*1e3+s*60*1e3+o*1e3+u;if(i===24&&(f=1440*60*1e3),l&&l!=="Z"){let d=l.match(/([+-])(\d{2}):(\d{2})/);if(d){let p=d[1]==="+"?1:-1,h=parseInt(d[2],10),g=parseInt(d[3],10),m=p*(h*60+g)*60*1e3;f-=m}}return f}static formatDateDuration(e){if(e===0)return"P0D";let t=e<0,n=Math.abs(e);return t?`-P${n}D`:`P${n}D`}static parseYearMonthDuration(e){let t=/^(-)?P(?:(\d+)Y)?(?:(\d+)M)?$/,n=e.match(t);if(!n)throw new Error(`parseYearMonthDuration: invalid format: '${e}'`);let i=n[1]==="-",s=parseInt(n[2]||"0",10),o=parseInt(n[3]||"0",10);if(!n[2]&&!n[3])throw new Error(`parseYearMonthDuration: invalid format (no duration components): '${e}'`);let c=s*12+o;return i?-c:c}static formatYearMonthDuration(e){let t=e<0,n=Math.abs(e),i=Math.floor(n/12),s=n%12,o=t?"-P":"P";return i>0&&(o+=`${i}Y`),(s>0||i===0)&&(o+=`${s}M`),o}static parseYearMonthDurationComponents(e){let t=/^(-)?P(?:(\d+)Y)?(?:(\d+)M)?$/,n=e.match(t);if(!n)throw new Error(`parseYearMonthDurationComponents: invalid format: '${e}'`);let i=n[1]==="-",s=parseInt(n[2]||"0",10),o=parseInt(n[3]||"0",10);if(!n[2]&&!n[3])throw new Error(`parseYearMonthDurationComponents: invalid format (no duration components): '${e}'`);return{years:s,months:o,negative:i}}static parseDurationComponents(e){if(!e)throw new Error("parseDurationComponents: duration string is empty");let t=!1,n=e.trim();if(n.startsWith("-")&&(t=!0,n=n.substring(1)),!n.startsWith("P"))throw new Error(`parseDurationComponents: invalid format, must start with 'P': '${e}'`);n=n.substring(1);let i=0,s=0,o=0,c=0,l=n.indexOf("T"),u="",f="";if(l===-1?u=n:(u=n.substring(0,l),f=n.substring(l+1)),u){let d=u.match(/^(\d+(?:\.\d+)?)D$/);if(d)i=parseFloat(d[1]);else if(u!=="")throw new Error(`parseDurationComponents: invalid day component: '${u}' in '${e}'`)}if(f){let d=f,p=d.match(/^(\d+(?:\.\d+)?)H/);p&&(s=parseFloat(p[1]),d=d.substring(p[0].length));let h=d.match(/^(\d+(?:\.\d+)?)M/);h&&(o=parseFloat(h[1]),d=d.substring(h[0].length));let g=d.match(/^(\d+(?:\.\d+)?)S$/);if(g&&(c=parseFloat(g[1]),d=d.substring(g[0].length)),d!=="")throw new Error(`parseDurationComponents: invalid time component: '${d}' in '${e}'`)}return{negative:t,days:i,hours:s,minutes:o,seconds:c}}};D_.DateTimeParsing=hI});var RM=T(N_=>{"use strict";Object.defineProperty(N_,"__esModule",{value:!0});N_.DateTimeArithmetic=void 0;var fi=Me(),Qe=Ye(),St=qh(),mI=class{static{a(this,"DateTimeArithmetic")}static dateTimeDiff(e,t){let n=e instanceof Qe.Literal?e.value:e,i=t instanceof Qe.Literal?t.value:t,s=new Date(n),o=new Date(i);if(isNaN(s.getTime()))throw new Error(`dateTimeDiff: invalid first dateTime: '${n}'`);if(isNaN(o.getTime()))throw new Error(`dateTimeDiff: invalid second dateTime: '${i}'`);let c=s.getTime()-o.getTime(),l=St.DateTimeParsing.formatDayTimeDuration(c);return new Qe.Literal(l,new fi.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static dateTimeAdd(e,t){let n=e instanceof Qe.Literal?e.value:e,i=t instanceof Qe.Literal?t.value:t,s=new Date(n);if(isNaN(s.getTime()))throw new Error(`dateTimeAdd: invalid dateTime: '${n}'`);let o=St.DateTimeParsing.parseDayTimeDuration(i),c=s.getTime()+o,l=new Date(c);return new Qe.Literal(l.toISOString(),new fi.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateTimeSubtract(e,t){let n=e instanceof Qe.Literal?e.value:e,i=t instanceof Qe.Literal?t.value:t,s=new Date(n);if(isNaN(s.getTime()))throw new Error(`dateTimeSubtract: invalid dateTime: '${n}'`);let o=St.DateTimeParsing.parseDayTimeDuration(i),c=s.getTime()-o,l=new Date(c);return new Qe.Literal(l.toISOString(),new fi.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateAdd(e,t){let n=e instanceof Qe.Literal?e.value:e,i=t instanceof Qe.Literal?t.value:t,s=St.DateTimeParsing.parseXSDDate(n);if(s===null)throw new Error(`dateAdd: invalid date: '${n}'`);let o=St.DateTimeParsing.parseDayTimeDuration(i),c=s.getTime()+o,l=new Date(c),u=l.getUTCFullYear(),f=String(l.getUTCMonth()+1).padStart(2,"0"),d=String(l.getUTCDate()).padStart(2,"0"),p=`${u}-${f}-${d}`;return new Qe.Literal(p,new fi.IRI("http://www.w3.org/2001/XMLSchema#date"))}static dateSubtract(e,t){let n=e instanceof Qe.Literal?e.value:e,i=t instanceof Qe.Literal?t.value:t,s=St.DateTimeParsing.parseXSDDate(n);if(s===null)throw new Error(`dateSubtract: invalid date: '${n}'`);let o=St.DateTimeParsing.parseDayTimeDuration(i),c=s.getTime()-o,l=new Date(c),u=l.getUTCFullYear(),f=String(l.getUTCMonth()+1).padStart(2,"0"),d=String(l.getUTCDate()).padStart(2,"0"),p=`${u}-${f}-${d}`;return new Qe.Literal(p,new fi.IRI("http://www.w3.org/2001/XMLSchema#date"))}static dateTimeAddYearMonth(e,t){let n=e instanceof Qe.Literal?e.value:e,i=t instanceof Qe.Literal?t.value:t,s=new Date(n);if(isNaN(s.getTime()))throw new Error(`dateTimeAddYearMonth: invalid dateTime: '${n}'`);let o=St.DateTimeParsing.parseYearMonthDuration(i),c=s.getUTCDate();return s.setUTCMonth(s.getUTCMonth()+o),s.getUTCDate()!==c&&s.setUTCDate(0),new Qe.Literal(s.toISOString(),new fi.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateTimeSubtractYearMonth(e,t){let n=e instanceof Qe.Literal?e.value:e,i=t instanceof Qe.Literal?t.value:t,s=new Date(n);if(isNaN(s.getTime()))throw new Error(`dateTimeSubtractYearMonth: invalid dateTime: '${n}'`);let o=St.DateTimeParsing.parseYearMonthDuration(i),c=s.getUTCDate();return s.setUTCMonth(s.getUTCMonth()-o),s.getUTCDate()!==c&&s.setUTCDate(0),new Qe.Literal(s.toISOString(),new fi.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateAddYearMonth(e,t){let n=e instanceof Qe.Literal?e.value:e,i=t instanceof Qe.Literal?t.value:t,s=St.DateTimeParsing.parseXSDDate(n);if(s===null)throw new Error(`dateAddYearMonth: invalid date: '${n}'`);let o=St.DateTimeParsing.parseYearMonthDuration(i),c=s.getUTCDate();s.setUTCMonth(s.getUTCMonth()+o),s.getUTCDate()!==c&&s.setUTCDate(0);let l=s.getUTCFullYear(),u=String(s.getUTCMonth()+1).padStart(2,"0"),f=String(s.getUTCDate()).padStart(2,"0"),d=`${l}-${u}-${f}`;return new Qe.Literal(d,new fi.IRI("http://www.w3.org/2001/XMLSchema#date"))}static dateSubtractYearMonth(e,t){let n=e instanceof Qe.Literal?e.value:e,i=t instanceof Qe.Literal?t.value:t,s=St.DateTimeParsing.parseXSDDate(n);if(s===null)throw new Error(`dateSubtractYearMonth: invalid date: '${n}'`);let o=St.DateTimeParsing.parseYearMonthDuration(i),c=s.getUTCDate();s.setUTCMonth(s.getUTCMonth()-o),s.getUTCDate()!==c&&s.setUTCDate(0);let l=s.getUTCFullYear(),u=String(s.getUTCMonth()+1).padStart(2,"0"),f=String(s.getUTCDate()).padStart(2,"0"),d=`${l}-${u}-${f}`;return new Qe.Literal(d,new fi.IRI("http://www.w3.org/2001/XMLSchema#date"))}static durationAdd(e,t){let n=e instanceof Qe.Literal?e.value:e,i=t instanceof Qe.Literal?t.value:t,s=St.DateTimeParsing.parseDayTimeDuration(n),o=St.DateTimeParsing.parseDayTimeDuration(i),c=St.DateTimeParsing.formatDayTimeDuration(s+o);return new Qe.Literal(c,new fi.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static durationSubtract(e,t){let n=e instanceof Qe.Literal?e.value:e,i=t instanceof Qe.Literal?t.value:t,s=St.DateTimeParsing.parseDayTimeDuration(n),o=St.DateTimeParsing.parseDayTimeDuration(i),c=St.DateTimeParsing.formatDayTimeDuration(s-o);return new Qe.Literal(c,new fi.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static durationMultiply(e,t){let n=e instanceof Qe.Literal?e.value:e,i=St.DateTimeParsing.parseDayTimeDuration(n),s=St.DateTimeParsing.formatDayTimeDuration(i*t);return new Qe.Literal(s,new fi.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static durationDivide(e,t){if(t===0)throw new Error("durationDivide: division by zero");let n=e instanceof Qe.Literal?e.value:e,i=St.DateTimeParsing.parseDayTimeDuration(n),s=St.DateTimeParsing.formatDayTimeDuration(i/t);return new Qe.Literal(s,new fi.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static yearMonthDurationAdd(e,t){let n=e instanceof Qe.Literal?e.value:e,i=t instanceof Qe.Literal?t.value:t,s=St.DateTimeParsing.parseYearMonthDuration(n),o=St.DateTimeParsing.parseYearMonthDuration(i),c=St.DateTimeParsing.formatYearMonthDuration(s+o);return new Qe.Literal(c,new fi.IRI("http://www.w3.org/2001/XMLSchema#yearMonthDuration"))}static yearMonthDurationSubtract(e,t){let n=e instanceof Qe.Literal?e.value:e,i=t instanceof Qe.Literal?t.value:t,s=St.DateTimeParsing.parseYearMonthDuration(n),o=St.DateTimeParsing.parseYearMonthDuration(i),c=St.DateTimeParsing.formatYearMonthDuration(s-o);return new Qe.Literal(c,new fi.IRI("http://www.w3.org/2001/XMLSchema#yearMonthDuration"))}static durationToDays(e){let t=e instanceof Qe.Literal?e.value:e;return St.DateTimeParsing.parseDayTimeDuration(t)/(1440*60*1e3)}static durationToHours(e){let t=e instanceof Qe.Literal?e.value:e;return St.DateTimeParsing.parseDayTimeDuration(t)/(3600*1e3)}static durationToMinutes(e){let t=e instanceof Qe.Literal?e.value:e;return St.DateTimeParsing.parseDayTimeDuration(t)/(60*1e3)}static durationToSeconds(e){let t=e instanceof Qe.Literal?e.value:e;return St.DateTimeParsing.parseDayTimeDuration(t)/1e3}};N_.DateTimeArithmetic=mI});var CM=T(k_=>{"use strict";Object.defineProperty(k_,"__esModule",{value:!0});k_.DateTimeAccessors=void 0;var Wh=Me(),yr=Ye(),Zt=qh(),gI=class r{static{a(this,"DateTimeAccessors")}static lexicalComponents(e){let t=e.match(/^(-?\d{4,})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?)?(?:Z|[+-]\d{2}:?\d{2})?$/);if(!t)return null;let n=parseInt(t[1],10),i=parseInt(t[2],10),s=parseInt(t[3],10),o=t[4]!==void 0?parseInt(t[4],10):0,c=t[5]!==void 0?parseInt(t[5],10):0,l=t[6]!==void 0?parseInt(t[6],10):0,u=t[7]?l+parseFloat(`0.${t[7]}`):l;return i<1||i>12||s<1||s>31||o>24||c>59||l>60?null:{year:n,month:i,day:s,hours:o,minutes:c,seconds:u}}static year(e){let t=r.lexicalComponents(e);if(t)return t.year;let n=new Date(e);if(isNaN(n.getTime()))throw new Error(`YEAR: invalid date string '${e}'`);return n.getFullYear()}static month(e){let t=r.lexicalComponents(e);if(t)return t.month;let n=new Date(e);if(isNaN(n.getTime()))throw new Error(`MONTH: invalid date string '${e}'`);return n.getMonth()+1}static day(e){let t=r.lexicalComponents(e);if(t)return t.day;let n=new Date(e);if(isNaN(n.getTime()))throw new Error(`DAY: invalid date string '${e}'`);return n.getDate()}static hours(e){let t=r.lexicalComponents(e);if(t)return t.hours;let n=new Date(e);if(isNaN(n.getTime()))throw new Error(`HOURS: invalid date string '${e}'`);return n.getHours()}static minutes(e){let t=r.lexicalComponents(e);if(t)return t.minutes;let n=new Date(e);if(isNaN(n.getTime()))throw new Error(`MINUTES: invalid date string '${e}'`);return n.getMinutes()}static seconds(e){let t=r.lexicalComponents(e);if(t)return t.seconds;let n=new Date(e);if(isNaN(n.getTime()))throw new Error(`SECONDS: invalid date string '${e}'`);return n.getSeconds()+n.getMilliseconds()/1e3}static durationDays(e){let t=e instanceof yr.Literal?e.value:e,n=Zt.DateTimeParsing.parseDurationComponents(t),i=Math.floor(n.days);return n.negative?-i:i}static durationHours(e){let t=e instanceof yr.Literal?e.value:e,n=Zt.DateTimeParsing.parseDurationComponents(t),i=Math.floor(n.hours);return n.negative?-i:i}static durationMinutes(e){let t=e instanceof yr.Literal?e.value:e,n=Zt.DateTimeParsing.parseDurationComponents(t),i=Math.floor(n.minutes);return n.negative?-i:i}static durationSeconds(e){let t=e instanceof yr.Literal?e.value:e,n=Zt.DateTimeParsing.parseDurationComponents(t);return n.negative?-n.seconds:n.seconds}static durationYears(e){let t=e instanceof yr.Literal?e.value:e,n=Zt.DateTimeParsing.parseYearMonthDurationComponents(t);return n.negative?-n.years:n.years}static durationMonths(e){let t=e instanceof yr.Literal?e.value:e,n=Zt.DateTimeParsing.parseYearMonthDurationComponents(t);return n.negative?-n.months:n.months}static timezone(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`TIMEZONE: invalid date string '${e}'`);let n;if(e.endsWith("Z"))n="PT0S";else{let i=e.match(/([+-]\d{2}):?(\d{2})$/);if(i){let s=parseInt(i[1],10),o=parseInt(i[2],10),c=s>=0?"":"-",l=Math.abs(s);o===0?n=`${c}PT${l}H`:n=`${c}PT${l}H${o}M`}else{let s=-t.getTimezoneOffset(),o=Math.floor(Math.abs(s)/60),c=Math.abs(s)%60,l=s>=0?"":"-";c===0?n=`${l}PT${o}H`:n=`${l}PT${o}H${c}M`}}return new yr.Literal(n,new Wh.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static tz(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`TZ: invalid date string '${e}'`);if(e.endsWith("Z"))return"Z";let n=e.match(/([+-]\d{2}:\d{2})$/);if(n)return n[1];let i=e.match(/([+-])(\d{2})(\d{2})$/);return i?`${i[1]}${i[2]}:${i[3]}`:""}static adjust(e,t){let n=e instanceof yr.Literal?e.value:e,i=new Date(n);if(isNaN(i.getTime()))throw new Error(`ADJUST: invalid dateTime: '${n}'`);if(t==null){let R=i.getUTCFullYear(),C=String(i.getUTCMonth()+1).padStart(2,"0"),P=String(i.getUTCDate()).padStart(2,"0"),D=String(i.getUTCHours()).padStart(2,"0"),F=String(i.getUTCMinutes()).padStart(2,"0"),$=String(i.getUTCSeconds()).padStart(2,"0"),H=i.getUTCMilliseconds(),ee=`${R}-${C}-${P}T${D}:${F}:${$}`;return H>0&&(ee+=`.${String(H).padStart(3,"0")}`),new yr.Literal(ee,new Wh.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}let s=t instanceof yr.Literal?t.value:t,o=Zt.DateTimeParsing.parseDayTimeDuration(s),c=840*60*1e3;if(Math.abs(o)>c)throw new Error(`ADJUST: timezone offset out of range: '${s}'`);let l=i.getTime(),u=new Date(l+o),f=u.getUTCFullYear(),d=String(u.getUTCMonth()+1).padStart(2,"0"),p=String(u.getUTCDate()).padStart(2,"0"),h=String(u.getUTCHours()).padStart(2,"0"),g=String(u.getUTCMinutes()).padStart(2,"0"),m=String(u.getUTCSeconds()).padStart(2,"0"),_=u.getUTCMilliseconds(),b=o>=0?"+":"-",w=Math.floor(Math.abs(o)/(3600*1e3)),v=Math.floor(Math.abs(o)%(3600*1e3)/(60*1e3)),E=`${b}${String(w).padStart(2,"0")}:${String(v).padStart(2,"0")}`,S=`${f}-${d}-${p}T${h}:${g}:${m}`;return _>0&&(S+=`.${String(_).padStart(3,"0")}`),S+=E,new yr.Literal(S,new Wh.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static now(){return new Date().toISOString()}static dateBefore(e,t){let n=Zt.DateTimeParsing.parseDate(e),i=Zt.DateTimeParsing.parseDate(t);return n<i}static dateAfter(e,t){let n=Zt.DateTimeParsing.parseDate(e),i=Zt.DateTimeParsing.parseDate(t);return n>i}static dateInRange(e,t,n){let i=Zt.DateTimeParsing.parseDate(e),s=Zt.DateTimeParsing.parseDate(t),o=Zt.DateTimeParsing.parseDate(n);return i>=s&&i<=o}static compareDurations(e,t,n){let i=e instanceof yr.Literal?e.value:e,s=t instanceof yr.Literal?t.value:t,o=Zt.DateTimeParsing.parseDayTimeDuration(i),c=Zt.DateTimeParsing.parseDayTimeDuration(s);switch(n){case"=":return o===c;case"!=":return o!==c;case"<":return o<c;case">":return o>c;case"<=":return o<=c;case">=":return o>=c;default:throw new Error(`compareDurations: unknown operator: ${n}`)}}static dateDiffMinutes(e,t){let n=Zt.DateTimeParsing.parseDate(e),i=Zt.DateTimeParsing.parseDate(t),s=Math.abs(i-n);return Math.round(s/(1e3*60))}static dateDiffHours(e,t){let n=Zt.DateTimeParsing.parseDate(e),i=Zt.DateTimeParsing.parseDate(t),s=Math.abs(i-n);return Math.round(s/(1e3*60*60)*100)/100}static timeDiff(e,t){let n=e instanceof yr.Literal?e.value:e,i=t instanceof yr.Literal?t.value:t,s=Zt.DateTimeParsing.parseXSDTime(n),o=Zt.DateTimeParsing.parseXSDTime(i);if(s===null)throw new Error(`timeDiff: invalid first time: '${n}'`);if(o===null)throw new Error(`timeDiff: invalid second time: '${i}'`);let c=s-o,l=Zt.DateTimeParsing.formatDayTimeDuration(c);return new yr.Literal(l,new Wh.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static isDayTimeDuration(e){return e instanceof yr.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#dayTimeDuration":!1}static isDate(e){return e instanceof yr.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#date":!1}static isYearMonthDuration(e){return e instanceof yr.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#yearMonthDuration":!1}static isTime(e){return e instanceof yr.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#time":!1}static dateDiff(e,t){let n=e instanceof yr.Literal?e.value:e,i=t instanceof yr.Literal?t.value:t,s=Zt.DateTimeParsing.parseXSDDate(n),o=Zt.DateTimeParsing.parseXSDDate(i);if(s===null)throw new Error(`dateDiff: invalid first date: '${n}'`);if(o===null)throw new Error(`dateDiff: invalid second date: '${i}'`);let c=s.getTime()-o.getTime(),l=Math.round(c/(1440*60*1e3)),u=Zt.DateTimeParsing.formatDateDuration(l);return new yr.Literal(u,new Wh.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}};k_.DateTimeAccessors=gI});var $_=T(M_=>{"use strict";Object.defineProperty(M_,"__esModule",{value:!0});M_.DateTimeFunctions=void 0;var Hf=qh(),Qr=RM(),Wt=CM(),yI=class{static{a(this,"DateTimeFunctions")}static parseDate(e){return Hf.DateTimeParsing.parseDate(e)}static parseDayTimeDuration(e){return Hf.DateTimeParsing.parseDayTimeDuration(e)}static formatDayTimeDuration(e){return Hf.DateTimeParsing.formatDayTimeDuration(e)}static xsdDayTimeDuration(e){return Hf.DateTimeParsing.xsdDayTimeDuration(e)}static parseYearMonthDuration(e){return Hf.DateTimeParsing.parseYearMonthDuration(e)}static formatYearMonthDuration(e){return Hf.DateTimeParsing.formatYearMonthDuration(e)}static year(e){return Wt.DateTimeAccessors.year(e)}static month(e){return Wt.DateTimeAccessors.month(e)}static day(e){return Wt.DateTimeAccessors.day(e)}static hours(e){return Wt.DateTimeAccessors.hours(e)}static minutes(e){return Wt.DateTimeAccessors.minutes(e)}static seconds(e){return Wt.DateTimeAccessors.seconds(e)}static durationDays(e){return Wt.DateTimeAccessors.durationDays(e)}static durationHours(e){return Wt.DateTimeAccessors.durationHours(e)}static durationMinutes(e){return Wt.DateTimeAccessors.durationMinutes(e)}static durationSeconds(e){return Wt.DateTimeAccessors.durationSeconds(e)}static durationYears(e){return Wt.DateTimeAccessors.durationYears(e)}static durationMonths(e){return Wt.DateTimeAccessors.durationMonths(e)}static timezone(e){return Wt.DateTimeAccessors.timezone(e)}static tz(e){return Wt.DateTimeAccessors.tz(e)}static adjust(e,t){return Wt.DateTimeAccessors.adjust(e,t)}static now(){return Wt.DateTimeAccessors.now()}static dateBefore(e,t){return Wt.DateTimeAccessors.dateBefore(e,t)}static dateAfter(e,t){return Wt.DateTimeAccessors.dateAfter(e,t)}static dateInRange(e,t,n){return Wt.DateTimeAccessors.dateInRange(e,t,n)}static compareDurations(e,t,n){return Wt.DateTimeAccessors.compareDurations(e,t,n)}static dateDiffMinutes(e,t){return Wt.DateTimeAccessors.dateDiffMinutes(e,t)}static dateDiffHours(e,t){return Wt.DateTimeAccessors.dateDiffHours(e,t)}static timeDiff(e,t){return Wt.DateTimeAccessors.timeDiff(e,t)}static dateDiff(e,t){return Wt.DateTimeAccessors.dateDiff(e,t)}static isDayTimeDuration(e){return Wt.DateTimeAccessors.isDayTimeDuration(e)}static isDate(e){return Wt.DateTimeAccessors.isDate(e)}static isYearMonthDuration(e){return Wt.DateTimeAccessors.isYearMonthDuration(e)}static isTime(e){return Wt.DateTimeAccessors.isTime(e)}static dateTimeDiff(e,t){return Qr.DateTimeArithmetic.dateTimeDiff(e,t)}static dateTimeAdd(e,t){return Qr.DateTimeArithmetic.dateTimeAdd(e,t)}static dateTimeSubtract(e,t){return Qr.DateTimeArithmetic.dateTimeSubtract(e,t)}static dateAdd(e,t){return Qr.DateTimeArithmetic.dateAdd(e,t)}static dateSubtract(e,t){return Qr.DateTimeArithmetic.dateSubtract(e,t)}static dateTimeAddYearMonth(e,t){return Qr.DateTimeArithmetic.dateTimeAddYearMonth(e,t)}static dateTimeSubtractYearMonth(e,t){return Qr.DateTimeArithmetic.dateTimeSubtractYearMonth(e,t)}static dateAddYearMonth(e,t){return Qr.DateTimeArithmetic.dateAddYearMonth(e,t)}static dateSubtractYearMonth(e,t){return Qr.DateTimeArithmetic.dateSubtractYearMonth(e,t)}static durationAdd(e,t){return Qr.DateTimeArithmetic.durationAdd(e,t)}static durationSubtract(e,t){return Qr.DateTimeArithmetic.durationSubtract(e,t)}static durationMultiply(e,t){return Qr.DateTimeArithmetic.durationMultiply(e,t)}static durationDivide(e,t){return Qr.DateTimeArithmetic.durationDivide(e,t)}static yearMonthDurationAdd(e,t){return Qr.DateTimeArithmetic.yearMonthDurationAdd(e,t)}static yearMonthDurationSubtract(e,t){return Qr.DateTimeArithmetic.yearMonthDurationSubtract(e,t)}static durationToDays(e){return Qr.DateTimeArithmetic.durationToDays(e)}static durationToHours(e){return Qr.DateTimeArithmetic.durationToHours(e)}static durationToMinutes(e){return Qr.DateTimeArithmetic.durationToMinutes(e)}static durationToSeconds(e){return Qr.DateTimeArithmetic.durationToSeconds(e)}};M_.DateTimeFunctions=yI});var OM=T(B_=>{"use strict";Object.defineProperty(B_,"__esModule",{value:!0});B_.LogicalFunctions=void 0;var zee=Me(),Yf=Ye(),Hee=lr(),j_=$_(),_I=class r{static{a(this,"LogicalFunctions")}static compare(e,t,n){if(r.isDayTimeDurationValue(e)&&r.isDayTimeDurationValue(t))return j_.DateTimeFunctions.compareDurations(e instanceof Yf.Literal?e:String(e),t instanceof Yf.Literal?t:String(t),n);if(r.isDayTimeDurationValue(e)&&typeof t=="string"&&/^-?P/.test(t))return j_.DateTimeFunctions.compareDurations(e instanceof Yf.Literal?e:String(e),t,n);if(typeof e=="string"&&/^-?P/.test(e)&&r.isDayTimeDurationValue(t))return j_.DateTimeFunctions.compareDurations(e,t instanceof Yf.Literal?t:String(t),n);let i=r.toComparableValue(e),s=r.toComparableValue(t);switch(n){case"=":return i===s;case"!=":return i!==s;case"<":return i<s;case">":return i>s;case"<=":return i<=s;case">=":return i>=s;default:throw new Error(`Unknown comparison operator: ${n}`)}}static isDayTimeDurationValue(e){return e instanceof Yf.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#dayTimeDuration":!1}static toComparableValue(e){if(typeof e=="string"||typeof e=="number")return e;if(e instanceof Yf.Literal){let t=e.datatype?.value;if(t?.includes("#integer")||t?.includes("#decimal")||t?.includes("#double")){let n=parseFloat(e.value);if(!isNaN(n))return n}if(t==="http://www.w3.org/2001/XMLSchema#dayTimeDuration")try{return j_.DateTimeFunctions.parseDayTimeDuration(e.value)}catch{return e.value}return e.value}return e instanceof zee.IRI?e.value:e instanceof Hee.BlankNode?e.id:String(e)}static logicalAnd(e){return e.every(t=>t===!0)}static logicalOr(e){return e.some(t=>t===!0)}static logicalNot(e){return!e}static coalesce(e){for(let t of e)if(t!=null)return t}static if(e,t,n){return e?t:n}};B_.LogicalFunctions=_I});var xM=T(U_=>{"use strict";Object.defineProperty(U_,"__esModule",{value:!0});U_.RDFTermFunctions=void 0;var Tn=Me(),Qt=Ye(),Ns=lr(),Qf=hh(),bI=bf(),SI=class r{static{a(this,"RDFTermFunctions")}static datatype(e){if(e===void 0)throw new Error("DATATYPE: argument is undefined");if(e instanceof Qt.Literal)return e.datatype?e.datatype:e.language?new Tn.IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"):new Tn.IRI("http://www.w3.org/2001/XMLSchema#string");throw new Error("DATATYPE: argument must be a literal")}static bound(e){return e!==void 0}static isIRI(e){return e===void 0?!1:e instanceof Tn.IRI}static isBlank(e){return e===void 0?!1:e instanceof Ns.BlankNode}static isLiteral(e){return e===void 0?!1:e instanceof Qt.Literal}static isTriple(e){return e===void 0?!1:e instanceof Qf.QuotedTriple}static hasLangdir(e){return e===void 0||!(e instanceof Qt.Literal)?!1:!!e.language&&!!e.direction}static isNumeric(e){if(e===void 0||!(e instanceof Qt.Literal))return!1;let t=e.datatype?.value;return t?["http://www.w3.org/2001/XMLSchema#integer","http://www.w3.org/2001/XMLSchema#decimal","http://www.w3.org/2001/XMLSchema#float","http://www.w3.org/2001/XMLSchema#double","http://www.w3.org/2001/XMLSchema#nonPositiveInteger","http://www.w3.org/2001/XMLSchema#negativeInteger","http://www.w3.org/2001/XMLSchema#long","http://www.w3.org/2001/XMLSchema#int","http://www.w3.org/2001/XMLSchema#short","http://www.w3.org/2001/XMLSchema#byte","http://www.w3.org/2001/XMLSchema#nonNegativeInteger","http://www.w3.org/2001/XMLSchema#unsignedLong","http://www.w3.org/2001/XMLSchema#unsignedInt","http://www.w3.org/2001/XMLSchema#unsignedShort","http://www.w3.org/2001/XMLSchema#unsignedByte","http://www.w3.org/2001/XMLSchema#positiveInteger"].includes(t):!1}static xsdDateTime(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`xsd:dateTime: invalid date string '${e}'`);return new Qt.Literal(t.toISOString(),new Tn.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static xsdInteger(e){let t=parseInt(e,10);if(isNaN(t))throw new Error(`xsd:integer: cannot convert '${e}' to integer`);return new Qt.Literal(String(t),new Tn.IRI("http://www.w3.org/2001/XMLSchema#integer"))}static xsdDecimal(e){let t=parseFloat(e);if(isNaN(t))throw new Error(`xsd:decimal: cannot convert '${e}' to decimal`);return new Qt.Literal(String(t),new Tn.IRI("http://www.w3.org/2001/XMLSchema#decimal"))}static sameTerm(e,t){if(e===void 0&&t===void 0)return!0;if(e===void 0||t===void 0)return!1;if(typeof e!="object"&&typeof t!="object")return typeof e==typeof t&&e===t;if(e.constructor!==t.constructor)return!1;if(e instanceof Tn.IRI&&t instanceof Tn.IRI)return e.value===t.value;if(e instanceof Ns.BlankNode&&t instanceof Ns.BlankNode)return e.id===t.id;if(e instanceof Qt.Literal&&t instanceof Qt.Literal){if(e.value!==t.value||e.language!==t.language)return!1;let n=e.datatype?.value,i=t.datatype?.value;return n===i}return!1}static iri(e){if(e===void 0)throw new Error("IRI: argument is undefined");if(e instanceof Tn.IRI)return e;if(e instanceof Qt.Literal)return new Tn.IRI(e.value);throw e instanceof Ns.BlankNode?new Error("IRI: cannot convert blank node to IRI"):new Error("IRI: unsupported term type")}static uri(e){return r.iri(e)}static bnode(e){if(e===void 0){let t=`b${(0,bI.v4)().replace(/-/g,"").substring(0,12)}`;return new Ns.BlankNode(t)}if(e instanceof Qt.Literal)return new Ns.BlankNode(e.value);if(e instanceof Ns.BlankNode)return e;throw new Error("BNODE: argument must be a string literal or omitted")}static strdt(e,t){if(e===void 0)throw new Error("STRDT: lexical form is undefined");if(t===void 0)throw new Error("STRDT: datatype IRI is undefined");let n;if(e instanceof Qt.Literal){if(e.language)throw new Error("STRDT: lexical form must not have a language tag");n=e.value}else if(typeof e=="string")n=e;else throw new Error("STRDT: lexical form must be a string literal");let i;if(t instanceof Tn.IRI)i=t;else if(t instanceof Qt.Literal)i=new Tn.IRI(t.value);else throw new Error("STRDT: datatype must be an IRI");return new Qt.Literal(n,i)}static strlang(e,t){if(e===void 0)throw new Error("STRLANG: lexical form is undefined");if(t===void 0)throw new Error("STRLANG: language tag is undefined");let n;if(e instanceof Qt.Literal){if(e.language)throw new Error("STRLANG: lexical form must not already have a language tag");n=e.value}else if(typeof e=="string")n=e;else throw new Error("STRLANG: lexical form must be a string literal");let i;if(t instanceof Qt.Literal)i=t.value;else if(typeof t=="string")i=t;else throw new Error("STRLANG: language tag must be a string literal");if(i==="")throw new Error("STRLANG: language tag cannot be empty");return new Qt.Literal(n,void 0,i)}static strlangdir(e,t,n){if(e===void 0)throw new Error("STRLANGDIR: lexical form is undefined");if(t===void 0)throw new Error("STRLANGDIR: language tag is undefined");if(n===void 0)throw new Error("STRLANGDIR: direction is undefined");let i;if(e instanceof Qt.Literal){if(e.language)throw new Error("STRLANGDIR: lexical form must not already have a language tag");i=e.value}else if(typeof e=="string")i=e;else throw new Error("STRLANGDIR: lexical form must be a string literal");let s;if(t instanceof Qt.Literal)s=t.value;else if(typeof t=="string")s=t;else throw new Error("STRLANGDIR: language tag must be a string literal");if(s==="")throw new Error("STRLANGDIR: language tag cannot be empty");let o;if(n instanceof Qt.Literal)o=n.value.toLowerCase();else throw new Error("STRLANGDIR: direction must be a string literal");if(o!=="ltr"&&o!=="rtl")throw new Error(`STRLANGDIR: invalid direction '${o}'. Must be 'ltr' or 'rtl'`);return new Qt.Literal(i,void 0,s,o)}static uuid(){let e=(0,bI.v4)();return new Tn.IRI(`urn:uuid:${e}`)}static struuid(){let e=(0,bI.v4)();return new Qt.Literal(e)}static triple(e,t,n){if(e===void 0)throw new Error("TRIPLE: subject is undefined");if(t===void 0)throw new Error("TRIPLE: predicate is undefined");if(n===void 0)throw new Error("TRIPLE: object is undefined");if(e instanceof Qt.Literal)throw new Error("TRIPLE: subject must be IRI, BlankNode, or QuotedTriple, got Literal");if(!(t instanceof Tn.IRI)){let c=t instanceof Qt.Literal?"Literal":t instanceof Ns.BlankNode?"BlankNode":t instanceof Qf.QuotedTriple?"QuotedTriple":typeof t;throw new Error(`TRIPLE: predicate must be IRI, got ${c}`)}let i=e,s=t,o=n;return new Qf.QuotedTriple(i,s,o)}static subject(e){if(e===void 0)throw new Error("SUBJECT: argument is undefined");if(!(e instanceof Qf.QuotedTriple)){let t=e instanceof Tn.IRI?"IRI":e instanceof Qt.Literal?"Literal":e instanceof Ns.BlankNode?"BlankNode":typeof e;throw new Error(`SUBJECT: argument must be QuotedTriple, got ${t}`)}return e.subject}static predicate(e){if(e===void 0)throw new Error("PREDICATE: argument is undefined");if(!(e instanceof Qf.QuotedTriple)){let t=e instanceof Tn.IRI?"IRI":e instanceof Qt.Literal?"Literal":e instanceof Ns.BlankNode?"BlankNode":typeof e;throw new Error(`PREDICATE: argument must be QuotedTriple, got ${t}`)}return e.predicate}static object(e){if(e===void 0)throw new Error("OBJECT: argument is undefined");if(!(e instanceof Qf.QuotedTriple)){let t=e instanceof Tn.IRI?"IRI":e instanceof Qt.Literal?"Literal":e instanceof Ns.BlankNode?"BlankNode":typeof e;throw new Error(`OBJECT: argument must be QuotedTriple, got ${t}`)}return e.object}};U_.RDFTermFunctions=SI});var PM=T(V_=>{"use strict";Object.defineProperty(V_,"__esModule",{value:!0});V_.HashFunctions=void 0;var wI=class{static{a(this,"HashFunctions")}static md5(e){return require("crypto").createHash("md5").update(e).digest("hex")}static sha1(e){return require("crypto").createHash("sha1").update(e).digest("hex")}static sha256(e){return require("crypto").createHash("sha256").update(e).digest("hex")}static sha384(e){return require("crypto").createHash("sha384").update(e).digest("hex")}static sha512(e){return require("crypto").createHash("sha512").update(e).digest("hex")}};V_.HashFunctions=wI});var q_=T(G_=>{"use strict";Object.defineProperty(G_,"__esModule",{value:!0});G_.BuiltInFunctions=void 0;var Xr=AM(),Lc=IM(),We=$_(),Xf=OM(),ur=xM(),Kh=PM(),EI=class{static{a(this,"BuiltInFunctions")}static str(...e){return Xr.StringFunctions.str(...e)}static lang(...e){return Xr.StringFunctions.lang(...e)}static langdir(...e){return Xr.StringFunctions.langdir(...e)}static langMatches(...e){return Xr.StringFunctions.langMatches(...e)}static regex(...e){return Xr.StringFunctions.regex(...e)}static contains(...e){return Xr.StringFunctions.contains(...e)}static strStarts(...e){return Xr.StringFunctions.strStarts(...e)}static strEnds(...e){return Xr.StringFunctions.strEnds(...e)}static strlen(...e){return Xr.StringFunctions.strlen(...e)}static ucase(...e){return Xr.StringFunctions.ucase(...e)}static lcase(...e){return Xr.StringFunctions.lcase(...e)}static substr(...e){return Xr.StringFunctions.substr(...e)}static strBefore(...e){return Xr.StringFunctions.strBefore(...e)}static strAfter(...e){return Xr.StringFunctions.strAfter(...e)}static concat(...e){return Xr.StringFunctions.concat(...e)}static replace(...e){return Xr.StringFunctions.replace(...e)}static encodeForUri(...e){return Xr.StringFunctions.encodeForUri(...e)}static normalize(...e){return Xr.StringFunctions.normalize(...e)}static fold(...e){return Xr.StringFunctions.fold(...e)}static abs(...e){return Lc.MathFunctions.abs(...e)}static round(...e){return Lc.MathFunctions.round(...e)}static ceil(...e){return Lc.MathFunctions.ceil(...e)}static floor(...e){return Lc.MathFunctions.floor(...e)}static rand(){return Lc.MathFunctions.rand()}static msToMinutes(...e){return Lc.MathFunctions.msToMinutes(...e)}static msToHours(...e){return Lc.MathFunctions.msToHours(...e)}static msToSeconds(...e){return Lc.MathFunctions.msToSeconds(...e)}static parseDate(...e){return We.DateTimeFunctions.parseDate(...e)}static dateBefore(...e){return We.DateTimeFunctions.dateBefore(...e)}static dateAfter(...e){return We.DateTimeFunctions.dateAfter(...e)}static dateInRange(...e){return We.DateTimeFunctions.dateInRange(...e)}static dateDiffMinutes(...e){return We.DateTimeFunctions.dateDiffMinutes(...e)}static dateDiffHours(...e){return We.DateTimeFunctions.dateDiffHours(...e)}static year(...e){return We.DateTimeFunctions.year(...e)}static month(...e){return We.DateTimeFunctions.month(...e)}static day(...e){return We.DateTimeFunctions.day(...e)}static hours(...e){return We.DateTimeFunctions.hours(...e)}static minutes(...e){return We.DateTimeFunctions.minutes(...e)}static seconds(...e){return We.DateTimeFunctions.seconds(...e)}static timezone(...e){return We.DateTimeFunctions.timezone(...e)}static tz(...e){return We.DateTimeFunctions.tz(...e)}static now(){return We.DateTimeFunctions.now()}static parseDayTimeDuration(...e){return We.DateTimeFunctions.parseDayTimeDuration(...e)}static formatDayTimeDuration(...e){return We.DateTimeFunctions.formatDayTimeDuration(...e)}static xsdDayTimeDuration(...e){return We.DateTimeFunctions.xsdDayTimeDuration(...e)}static compareDurations(...e){return We.DateTimeFunctions.compareDurations(...e)}static isDayTimeDuration(...e){return We.DateTimeFunctions.isDayTimeDuration(...e)}static isDate(...e){return We.DateTimeFunctions.isDate(...e)}static dateDiff(...e){return We.DateTimeFunctions.dateDiff(...e)}static dateTimeDiff(...e){return We.DateTimeFunctions.dateTimeDiff(...e)}static dateTimeAdd(...e){return We.DateTimeFunctions.dateTimeAdd(...e)}static dateTimeSubtract(...e){return We.DateTimeFunctions.dateTimeSubtract(...e)}static dateAdd(...e){return We.DateTimeFunctions.dateAdd(...e)}static dateSubtract(...e){return We.DateTimeFunctions.dateSubtract(...e)}static parseYearMonthDuration(...e){return We.DateTimeFunctions.parseYearMonthDuration(...e)}static isYearMonthDuration(...e){return We.DateTimeFunctions.isYearMonthDuration(...e)}static dateTimeAddYearMonth(...e){return We.DateTimeFunctions.dateTimeAddYearMonth(...e)}static dateTimeSubtractYearMonth(...e){return We.DateTimeFunctions.dateTimeSubtractYearMonth(...e)}static dateAddYearMonth(...e){return We.DateTimeFunctions.dateAddYearMonth(...e)}static dateSubtractYearMonth(...e){return We.DateTimeFunctions.dateSubtractYearMonth(...e)}static durationAdd(...e){return We.DateTimeFunctions.durationAdd(...e)}static durationSubtract(...e){return We.DateTimeFunctions.durationSubtract(...e)}static durationMultiply(...e){return We.DateTimeFunctions.durationMultiply(...e)}static durationDivide(...e){return We.DateTimeFunctions.durationDivide(...e)}static formatYearMonthDuration(...e){return We.DateTimeFunctions.formatYearMonthDuration(...e)}static yearMonthDurationAdd(...e){return We.DateTimeFunctions.yearMonthDurationAdd(...e)}static yearMonthDurationSubtract(...e){return We.DateTimeFunctions.yearMonthDurationSubtract(...e)}static durationYears(...e){return We.DateTimeFunctions.durationYears(...e)}static durationMonths(...e){return We.DateTimeFunctions.durationMonths(...e)}static durationToDays(...e){return We.DateTimeFunctions.durationToDays(...e)}static durationToHours(...e){return We.DateTimeFunctions.durationToHours(...e)}static durationToMinutes(...e){return We.DateTimeFunctions.durationToMinutes(...e)}static durationToSeconds(...e){return We.DateTimeFunctions.durationToSeconds(...e)}static durationDays(...e){return We.DateTimeFunctions.durationDays(...e)}static durationHours(...e){return We.DateTimeFunctions.durationHours(...e)}static durationMinutes(...e){return We.DateTimeFunctions.durationMinutes(...e)}static durationSeconds(...e){return We.DateTimeFunctions.durationSeconds(...e)}static adjust(...e){return We.DateTimeFunctions.adjust(...e)}static isTime(...e){return We.DateTimeFunctions.isTime(...e)}static timeDiff(...e){return We.DateTimeFunctions.timeDiff(...e)}static compare(...e){return Xf.LogicalFunctions.compare(...e)}static logicalAnd(...e){return Xf.LogicalFunctions.logicalAnd(...e)}static logicalOr(...e){return Xf.LogicalFunctions.logicalOr(...e)}static logicalNot(...e){return Xf.LogicalFunctions.logicalNot(...e)}static coalesce(...e){return Xf.LogicalFunctions.coalesce(...e)}static if(...e){return Xf.LogicalFunctions.if(...e)}static datatype(...e){return ur.RDFTermFunctions.datatype(...e)}static bound(...e){return ur.RDFTermFunctions.bound(...e)}static isIRI(...e){return ur.RDFTermFunctions.isIRI(...e)}static isBlank(...e){return ur.RDFTermFunctions.isBlank(...e)}static isLiteral(...e){return ur.RDFTermFunctions.isLiteral(...e)}static isTriple(...e){return ur.RDFTermFunctions.isTriple(...e)}static isNumeric(...e){return ur.RDFTermFunctions.isNumeric(...e)}static hasLangdir(...e){return ur.RDFTermFunctions.hasLangdir(...e)}static sameTerm(...e){return ur.RDFTermFunctions.sameTerm(...e)}static iri(...e){return ur.RDFTermFunctions.iri(...e)}static uri(...e){return ur.RDFTermFunctions.uri(...e)}static bnode(...e){return ur.RDFTermFunctions.bnode(...e)}static strdt(...e){return ur.RDFTermFunctions.strdt(...e)}static strlang(...e){return ur.RDFTermFunctions.strlang(...e)}static strlangdir(...e){return ur.RDFTermFunctions.strlangdir(...e)}static uuid(){return ur.RDFTermFunctions.uuid()}static struuid(){return ur.RDFTermFunctions.struuid()}static xsdDateTime(...e){return ur.RDFTermFunctions.xsdDateTime(...e)}static xsdInteger(...e){return ur.RDFTermFunctions.xsdInteger(...e)}static xsdDecimal(...e){return ur.RDFTermFunctions.xsdDecimal(...e)}static triple(...e){return ur.RDFTermFunctions.triple(...e)}static subject(...e){return ur.RDFTermFunctions.subject(...e)}static predicate(...e){return ur.RDFTermFunctions.predicate(...e)}static object(...e){return ur.RDFTermFunctions.object(...e)}static md5(...e){return Kh.HashFunctions.md5(...e)}static sha1(...e){return Kh.HashFunctions.sha1(...e)}static sha256(...e){return Kh.HashFunctions.sha256(...e)}static sha384(...e){return Kh.HashFunctions.sha384(...e)}static sha512(...e){return Kh.HashFunctions.sha512(...e)}};G_.BuiltInFunctions=EI});var zh=T(Po=>{"use strict";Object.defineProperty(Po,"__esModule",{value:!0});Po.ExoQLBudgetExceededError=Po.ExoQLCycleError=Po.ExoQLEvalDisabledError=Po.ExoQLForbiddenKeywordError=void 0;var vI=class extends Error{static{a(this,"ExoQLForbiddenKeywordError")}constructor(e,t){super(t??`ExoQLForbiddenKeywordError: keyword "${e}" is not permitted by the exoql__Query AST allowlist`),this.name="ExoQLForbiddenKeywordError",this.keyword=e}};Po.ExoQLForbiddenKeywordError=vI;var TI=class extends Error{static{a(this,"ExoQLEvalDisabledError")}constructor(e){super(e??"ExoQLEvalDisabledError: exoql.eval.enabled is false (default). Flip the feature flag to opt in."),this.name="ExoQLEvalDisabledError"}};Po.ExoQLEvalDisabledError=TI;var AI=class extends Error{static{a(this,"ExoQLCycleError")}constructor(e,t){super(t??`ExoQLCycleError: cycle detected in nested exo:eval invocations: ${e.join(" \u2192 ")}`),this.name="ExoQLCycleError",this.path=e}};Po.ExoQLCycleError=AI;var II=class extends Error{static{a(this,"ExoQLBudgetExceededError")}constructor(e,t,n,i){super(i??`ExoQLBudgetExceededError: ${e} budget exceeded (limit=${t}, observed=${n})`),this.name="ExoQLBudgetExceededError",this.budget=e,this.limit=t,this.observed=n}};Po.ExoQLBudgetExceededError=II});var UM=T(ce=>{"use strict";Object.defineProperty(ce,"__esModule",{value:!0});ce.functionHandlers=void 0;var ae=q_(),Yee=Ye();ce.functionHandlers=new Map;ce.functionHandlers.set("str",(r,e)=>{let t=e.getTermFromExpression(r[0],e.solution);return ae.BuiltInFunctions.str(t)});ce.functionHandlers.set("lang",(r,e)=>{let t=e.getTermFromExpression(r[0],e.solution);return ae.BuiltInFunctions.lang(t)});ce.functionHandlers.set("langmatches",(r,e)=>{let t=e.getStringValue(e.evaluateExpression(r[0],e.solution)),n=e.getStringValue(e.evaluateExpression(r[1],e.solution));return ae.BuiltInFunctions.langMatches(t,n)});ce.functionHandlers.set("contains",(r,e)=>{let t=e.getStringValue(e.evaluateExpression(r[0],e.solution)),n=e.getStringValue(e.evaluateExpression(r[1],e.solution));return ae.BuiltInFunctions.contains(t,n)});ce.functionHandlers.set("strstarts",(r,e)=>{let t=e.getStringValue(e.evaluateExpression(r[0],e.solution)),n=e.getStringValue(e.evaluateExpression(r[1],e.solution));return ae.BuiltInFunctions.strStarts(t,n)});ce.functionHandlers.set("strends",(r,e)=>{let t=e.getStringValue(e.evaluateExpression(r[0],e.solution)),n=e.getStringValue(e.evaluateExpression(r[1],e.solution));return ae.BuiltInFunctions.strEnds(t,n)});ce.functionHandlers.set("strlen",(r,e)=>{let t=e.getStringValue(e.evaluateExpression(r[0],e.solution));return ae.BuiltInFunctions.strlen(t)});ce.functionHandlers.set("ucase",(r,e)=>{let t=e.getStringValue(e.evaluateExpression(r[0],e.solution));return ae.BuiltInFunctions.ucase(t)});ce.functionHandlers.set("lcase",(r,e)=>{let t=e.getStringValue(e.evaluateExpression(r[0],e.solution));return ae.BuiltInFunctions.lcase(t)});ce.functionHandlers.set("substr",(r,e)=>{let t=e.getStringValue(e.evaluateExpression(r[0],e.solution)),n=Number(e.evaluateExpression(r[1],e.solution));if(r[2]){let i=Number(e.evaluateExpression(r[2],e.solution));return ae.BuiltInFunctions.substr(t,n,i)}return ae.BuiltInFunctions.substr(t,n)});ce.functionHandlers.set("strbefore",(r,e)=>{let t=e.getStringValue(e.evaluateExpression(r[0],e.solution)),n=e.getStringValue(e.evaluateExpression(r[1],e.solution));return ae.BuiltInFunctions.strBefore(t,n)});ce.functionHandlers.set("strafter",(r,e)=>{let t=e.getStringValue(e.evaluateExpression(r[0],e.solution)),n=e.getStringValue(e.evaluateExpression(r[1],e.solution));return ae.BuiltInFunctions.strAfter(t,n)});ce.functionHandlers.set("concat",(r,e)=>{let t=r.map(n=>e.getStringValue(e.evaluateExpression(n,e.solution)));return ae.BuiltInFunctions.concat(...t)});ce.functionHandlers.set("replace",(r,e)=>{let t=e.getStringValue(e.evaluateExpression(r[0],e.solution)),n=e.getStringValue(e.evaluateExpression(r[1],e.solution)),i=e.getStringValue(e.evaluateExpression(r[2],e.solution)),s=r[3]?e.getStringValue(e.evaluateExpression(r[3],e.solution)):void 0;return ae.BuiltInFunctions.replace(t,n,i,s)});ce.functionHandlers.set("regex",(r,e)=>{let t=e.getStringValue(e.evaluateExpression(r[0],e.solution)),n=e.getStringValue(e.evaluateExpression(r[1],e.solution)),i=r[2]?e.getStringValue(e.evaluateExpression(r[2],e.solution)):void 0;return ae.BuiltInFunctions.regex(t,n,i)});ce.functionHandlers.set("encode_for_uri",(r,e)=>{let t=e.getStringValue(e.evaluateExpression(r[0],e.solution));return ae.BuiltInFunctions.encodeForUri(t)});ce.functionHandlers.set("datatype",(r,e)=>{let t=e.getTermFromExpression(r[0],e.solution);return ae.BuiltInFunctions.datatype(t).value});ce.functionHandlers.set("bound",(r,e)=>{let t=r[0];if(t.type==="variable"&&t.name){let n=e.solution.get(t.name);return ae.BuiltInFunctions.bound(n)}return!0});var FM=a((r,e)=>{let t=e.getTermFromExpression(r[0],e.solution);return ae.BuiltInFunctions.isIRI(t)},"isIriHandler");ce.functionHandlers.set("isiri",FM);ce.functionHandlers.set("isuri",FM);var LM=a((r,e)=>{let t=e.evaluateExpression(r[0],e.solution);return typeof t=="string"?ae.BuiltInFunctions.iri(new Yee.Literal(t)):ae.BuiltInFunctions.iri(t)},"iriHandler");ce.functionHandlers.set("iri",LM);ce.functionHandlers.set("uri",LM);ce.functionHandlers.set("isblank",(r,e)=>{let t=e.getTermFromExpression(r[0],e.solution);return ae.BuiltInFunctions.isBlank(t)});ce.functionHandlers.set("isliteral",(r,e)=>{let t=e.getTermFromExpression(r[0],e.solution);return ae.BuiltInFunctions.isLiteral(t)});ce.functionHandlers.set("isnumeric",(r,e)=>{let t=e.getTermFromExpression(r[0],e.solution);return ae.BuiltInFunctions.isNumeric(t)});ce.functionHandlers.set("haslangdir",(r,e)=>{let t=e.getTermFromExpression(r[0],e.solution);return ae.BuiltInFunctions.hasLangdir(t)});ce.functionHandlers.set("istriple",(r,e)=>{let t=e.getTermFromExpression(r[0],e.solution);return ae.BuiltInFunctions.isTriple(t)});ce.functionHandlers.set("sameterm",(r,e)=>{let t=e.getTermFromExpression(r[0],e.solution),n=e.getTermFromExpression(r[1],e.solution);return ae.BuiltInFunctions.sameTerm(t,n)});ce.functionHandlers.set("abs",(r,e)=>{let t=Number(e.getStringValue(e.evaluateExpression(r[0],e.solution)));return ae.BuiltInFunctions.abs(t)});ce.functionHandlers.set("round",(r,e)=>{let t=Number(e.getStringValue(e.evaluateExpression(r[0],e.solution)));return ae.BuiltInFunctions.round(t)});ce.functionHandlers.set("ceil",(r,e)=>{let t=Number(e.getStringValue(e.evaluateExpression(r[0],e.solution)));return ae.BuiltInFunctions.ceil(t)});ce.functionHandlers.set("floor",(r,e)=>{let t=Number(e.getStringValue(e.evaluateExpression(r[0],e.solution)));return ae.BuiltInFunctions.floor(t)});ce.functionHandlers.set("rand",()=>ae.BuiltInFunctions.rand());ce.functionHandlers.set("parsedate",(r,e)=>{let t=e.getStringValue(e.evaluateExpression(r[0],e.solution));return ae.BuiltInFunctions.parseDate(t)});ce.functionHandlers.set("datebefore",(r,e)=>{let t=e.getStringValue(e.evaluateExpression(r[0],e.solution)),n=e.getStringValue(e.evaluateExpression(r[1],e.solution));return ae.BuiltInFunctions.dateBefore(t,n)});ce.functionHandlers.set("dateafter",(r,e)=>{let t=e.getStringValue(e.evaluateExpression(r[0],e.solution)),n=e.getStringValue(e.evaluateExpression(r[1],e.solution));return ae.BuiltInFunctions.dateAfter(t,n)});ce.functionHandlers.set("dateinrange",(r,e)=>{let t=e.getStringValue(e.evaluateExpression(r[0],e.solution)),n=e.getStringValue(e.evaluateExpression(r[1],e.solution)),i=e.getStringValue(e.evaluateExpression(r[2],e.solution));return ae.BuiltInFunctions.dateInRange(t,n,i)});ce.functionHandlers.set("datediffminutes",(r,e)=>{let t=e.getStringValue(e.evaluateExpression(r[0],e.solution)),n=e.getStringValue(e.evaluateExpression(r[1],e.solution));return ae.BuiltInFunctions.dateDiffMinutes(t,n)});ce.functionHandlers.set("datediffhours",(r,e)=>{let t=e.getStringValue(e.evaluateExpression(r[0],e.solution)),n=e.getStringValue(e.evaluateExpression(r[1],e.solution));return ae.BuiltInFunctions.dateDiffHours(t,n)});var Jf=a((r,e,t)=>(n,i)=>{let s=i.evaluateExpression(n[0],i.solution);return e&&i.isYearMonthDurationValue(s)?e(s):t&&i.isDayTimeDurationValue(s)?t(s):r(i.getStringValue(s))},"createDateTimeAccessor"),DM=Jf(ae.BuiltInFunctions.year.bind(ae.BuiltInFunctions),ae.BuiltInFunctions.durationYears.bind(ae.BuiltInFunctions),null);ce.functionHandlers.set("year",DM);ce.functionHandlers.set("years",DM);var NM=Jf(ae.BuiltInFunctions.month.bind(ae.BuiltInFunctions),ae.BuiltInFunctions.durationMonths.bind(ae.BuiltInFunctions),null);ce.functionHandlers.set("month",NM);ce.functionHandlers.set("months",NM);var kM=Jf(ae.BuiltInFunctions.day.bind(ae.BuiltInFunctions),null,ae.BuiltInFunctions.durationDays.bind(ae.BuiltInFunctions));ce.functionHandlers.set("day",kM);ce.functionHandlers.set("days",kM);ce.functionHandlers.set("hours",Jf(ae.BuiltInFunctions.hours.bind(ae.BuiltInFunctions),null,ae.BuiltInFunctions.durationHours.bind(ae.BuiltInFunctions)));ce.functionHandlers.set("minutes",Jf(ae.BuiltInFunctions.minutes.bind(ae.BuiltInFunctions),null,ae.BuiltInFunctions.durationMinutes.bind(ae.BuiltInFunctions)));ce.functionHandlers.set("seconds",Jf(ae.BuiltInFunctions.seconds.bind(ae.BuiltInFunctions),null,ae.BuiltInFunctions.durationSeconds.bind(ae.BuiltInFunctions)));ce.functionHandlers.set("timezone",(r,e)=>{let t=e.getStringValue(e.evaluateExpression(r[0],e.solution));return ae.BuiltInFunctions.timezone(t)});ce.functionHandlers.set("tz",(r,e)=>{let t=e.getStringValue(e.evaluateExpression(r[0],e.solution));return ae.BuiltInFunctions.tz(t)});ce.functionHandlers.set("adjust",(r,e)=>{let t=e.evaluateExpression(r[0],e.solution),n=r.length>1?e.evaluateExpression(r[1],e.solution):void 0;return ae.BuiltInFunctions.adjust(t,n)});ce.functionHandlers.set("now",()=>ae.BuiltInFunctions.now());var MM=a((r,e)=>{let t=e.evaluateExpression(r[0],e.solution);return ae.BuiltInFunctions.xsdDateTime(e.getStringValue(t))},"dateTimeHandler");ce.functionHandlers.set("datetime",MM);ce.functionHandlers.set("xsd:datetime",MM);var $M=a((r,e)=>{let t=e.evaluateExpression(r[0],e.solution);return ae.BuiltInFunctions.xsdInteger(e.getStringValue(t))},"integerHandler");ce.functionHandlers.set("integer",$M);ce.functionHandlers.set("xsd:integer",$M);var jM=a((r,e)=>{let t=e.evaluateExpression(r[0],e.solution);return ae.BuiltInFunctions.xsdDecimal(e.getStringValue(t))},"decimalHandler");ce.functionHandlers.set("decimal",jM);ce.functionHandlers.set("xsd:decimal",jM);var BM=a((r,e)=>{let t=e.evaluateExpression(r[0],e.solution);return ae.BuiltInFunctions.xsdDayTimeDuration(e.getStringValue(t))},"dayTimeDurationHandler");ce.functionHandlers.set("daytimeduration",BM);ce.functionHandlers.set("xsd:daytimeduration",BM);ce.functionHandlers.set("durationtodays",(r,e)=>{let t=e.evaluateExpression(r[0],e.solution);return ae.BuiltInFunctions.durationToDays(t)});ce.functionHandlers.set("durationtohours",(r,e)=>{let t=e.evaluateExpression(r[0],e.solution);return ae.BuiltInFunctions.durationToHours(t)});ce.functionHandlers.set("durationtominutes",(r,e)=>{let t=e.evaluateExpression(r[0],e.solution);return ae.BuiltInFunctions.durationToMinutes(t)});ce.functionHandlers.set("durationtoseconds",(r,e)=>{let t=e.evaluateExpression(r[0],e.solution);return ae.BuiltInFunctions.durationToSeconds(t)});ce.functionHandlers.set("durationdays",(r,e)=>{let t=e.evaluateExpression(r[0],e.solution);return ae.BuiltInFunctions.durationDays(t)});ce.functionHandlers.set("durationhours",(r,e)=>{let t=e.evaluateExpression(r[0],e.solution);return ae.BuiltInFunctions.durationHours(t)});ce.functionHandlers.set("durationminutes",(r,e)=>{let t=e.evaluateExpression(r[0],e.solution);return ae.BuiltInFunctions.durationMinutes(t)});ce.functionHandlers.set("durationseconds",(r,e)=>{let t=e.evaluateExpression(r[0],e.solution);return ae.BuiltInFunctions.durationSeconds(t)});ce.functionHandlers.set("durationyears",(r,e)=>{let t=e.evaluateExpression(r[0],e.solution);return ae.BuiltInFunctions.durationYears(t)});ce.functionHandlers.set("durationmonths",(r,e)=>{let t=e.evaluateExpression(r[0],e.solution);return ae.BuiltInFunctions.durationMonths(t)});ce.functionHandlers.set("datetimediff",(r,e)=>{let t=e.evaluateExpression(r[0],e.solution),n=e.evaluateExpression(r[1],e.solution);return ae.BuiltInFunctions.dateTimeDiff(t,n)});ce.functionHandlers.set("datetimeadd",(r,e)=>{let t=e.evaluateExpression(r[0],e.solution),n=e.evaluateExpression(r[1],e.solution);return ae.BuiltInFunctions.dateTimeAdd(t,n)});ce.functionHandlers.set("datetimesubtract",(r,e)=>{let t=e.evaluateExpression(r[0],e.solution),n=e.evaluateExpression(r[1],e.solution);return ae.BuiltInFunctions.dateTimeSubtract(t,n)});ce.functionHandlers.set("mstominutes",(r,e)=>{let t=Number(e.evaluateExpression(r[0],e.solution));return ae.BuiltInFunctions.msToMinutes(t)});ce.functionHandlers.set("mstohours",(r,e)=>{let t=Number(e.evaluateExpression(r[0],e.solution));return ae.BuiltInFunctions.msToHours(t)});ce.functionHandlers.set("mstoseconds",(r,e)=>{let t=Number(e.evaluateExpression(r[0],e.solution));return ae.BuiltInFunctions.msToSeconds(t)});ce.functionHandlers.set("md5",(r,e)=>{let t=e.getStringValue(e.evaluateExpression(r[0],e.solution));return ae.BuiltInFunctions.md5(t)});ce.functionHandlers.set("sha1",(r,e)=>{let t=e.getStringValue(e.evaluateExpression(r[0],e.solution));return ae.BuiltInFunctions.sha1(t)});ce.functionHandlers.set("sha256",(r,e)=>{let t=e.getStringValue(e.evaluateExpression(r[0],e.solution));return ae.BuiltInFunctions.sha256(t)});ce.functionHandlers.set("sha384",(r,e)=>{let t=e.getStringValue(e.evaluateExpression(r[0],e.solution));return ae.BuiltInFunctions.sha384(t)});ce.functionHandlers.set("sha512",(r,e)=>{let t=e.getStringValue(e.evaluateExpression(r[0],e.solution));return ae.BuiltInFunctions.sha512(t)});ce.functionHandlers.set("subject",(r,e)=>{let t=e.getTermFromExpression(r[0],e.solution);return ae.BuiltInFunctions.subject(t)});ce.functionHandlers.set("predicate",(r,e)=>{let t=e.getTermFromExpression(r[0],e.solution);return ae.BuiltInFunctions.predicate(t)});ce.functionHandlers.set("object",(r,e)=>{let t=e.getTermFromExpression(r[0],e.solution);return ae.BuiltInFunctions.object(t)});ce.functionHandlers.set("triple",(r,e)=>{let t=e.getTermFromExpression(r[0],e.solution),n=e.getTermFromExpression(r[1],e.solution),i=e.getTermFromExpression(r[2],e.solution);return ae.BuiltInFunctions.triple(t,n,i)});ce.functionHandlers.set("days_between",(r,e)=>{let t=e.getStringValue(e.evaluateExpression(r[0],e.solution)),n=e.getStringValue(e.evaluateExpression(r[1],e.solution)),i=new Date(t),s=new Date(n);return Math.floor((s.getTime()-i.getTime())/(1440*60*1e3))});ce.functionHandlers.set("minutes_between",(r,e)=>{let t=e.getStringValue(e.evaluateExpression(r[0],e.solution)),n=e.getStringValue(e.evaluateExpression(r[1],e.solution)),i=new Date(t),s=new Date(n);return Math.floor((s.getTime()-i.getTime())/(60*1e3))});ce.functionHandlers.set("hours_between",(r,e)=>{let t=e.getStringValue(e.evaluateExpression(r[0],e.solution)),n=e.getStringValue(e.evaluateExpression(r[1],e.solution)),i=new Date(t);return(new Date(n).getTime()-i.getTime())/(3600*1e3)});ce.functionHandlers.set("age_days",(r,e)=>{let t=e.getStringValue(e.evaluateExpression(r[0],e.solution)),n=new Date(t);return Math.floor((new Date().getTime()-n.getTime())/(1440*60*1e3))});ce.functionHandlers.set("week_number",(r,e)=>{let t=e.getStringValue(e.evaluateExpression(r[0],e.solution)),n=new Date(t),i=new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate()));i.setUTCDate(i.getUTCDate()+4-(i.getUTCDay()||7));let s=new Date(Date.UTC(i.getUTCFullYear(),0,1));return Math.ceil(((i.getTime()-s.getTime())/(1440*60*1e3)+1)/7)});ce.functionHandlers.set("format_date",(r,e)=>{let t=e.getStringValue(e.evaluateExpression(r[0],e.solution)),n=e.getStringValue(e.evaluateExpression(r[1],e.solution)),i=new Date(t);return n.replace("YYYY",String(i.getFullYear())).replace("MM",String(i.getMonth()+1).padStart(2,"0")).replace("DD",String(i.getDate()).padStart(2,"0")).replace("HH",String(i.getHours()).padStart(2,"0")).replace("mm",String(i.getMinutes()).padStart(2,"0")).replace("ss",String(i.getSeconds()).padStart(2,"0"))});ce.functionHandlers.set("exo:eval",()=>{let{ExoQLEvalDisabledError:r}=zh();throw new r})});var K_=T(Zf=>{"use strict";Object.defineProperty(Zf,"__esModule",{value:!0});Zf.FilterExecutor=Zf.FilterExecutorError=void 0;var Kt=q_(),Qee=UM(),W_=Me(),Fo=Ye(),er=class extends Error{static{a(this,"FilterExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="FilterExecutorError"}};Zf.FilterExecutorError=er;var RI=class{static{a(this,"FilterExecutor")}constructor(){this.existsEvaluator=null,this.tripleStore=null,this.uuidCache=new Map}setExistsEvaluator(e){this.existsEvaluator=e}setTripleStore(e){this.tripleStore=e,this.uuidCache.clear()}async*execute(e,t){let n=this.expressionContainsExists(e.expression);for await(let i of t)try{let s;n?s=await this.evaluateExpressionAsync(e.expression,i):s=this.evaluateExpression(e.expression,i),s===!0&&(yield i)}catch{continue}}expressionContainsExists(e){if(!e||typeof e!="object")return!1;if(e.type==="exists")return!0;if(e.type==="logical")return e.operands.some(t=>this.expressionContainsExists(t));if(e.type==="comparison"){let t=e;return this.expressionContainsExists(t.left)||this.expressionContainsExists(t.right)}if(e.type==="arithmetic"){let t=e;return this.expressionContainsExists(t.left)||this.expressionContainsExists(t.right)}if(e.type==="in"){let t=e;return this.expressionContainsExists(t.expression)||t.list.some(n=>this.expressionContainsExists(n))}if(e.type==="function"||e.type==="functionCall"){let t=e;return Array.isArray(t.args)?t.args.some(n=>this.expressionContainsExists(n)):!1}return!1}async executeAll(e,t){let n=[];async function*i(){for(let s of t)yield s}a(i,"generator");for await(let s of this.execute(e,i()))n.push(s);return n}evaluateExpression(e,t){let n=e;if("termType"in e)switch(n.termType){case"Variable":return t.get(n.value);case"Literal":{let i=n.value,s=n.datatype,o=typeof s=="string"?s:s?.value;return o&&i.length>0&&this.shouldPreserveDatatype(o)?new Fo.Literal(i,new W_.IRI(o)):i}case"NamedNode":return n.value;default:throw new er(`Unsupported termType: ${String(n.termType)}`)}if(e.type==="iri")return new W_.IRI(e.value);switch(e.type){case"comparison":return this.evaluateComparison(e,t);case"logical":return this.evaluateLogical(e,t);case"arithmetic":return this.evaluateArithmetic(e,t);case"function":case"functionCall":return this.evaluateFunction(e,t);case"variable":return t.get(e.name);case"literal":{let i=e;return i.datatype&&i.value.length>0&&this.shouldPreserveDatatype(i.datatype)?new Fo.Literal(i.value,new W_.IRI(i.datatype)):i.value}case"in":return this.evaluateIn(e,t);case"exists":throw new er("EXISTS expressions require async evaluation. Use evaluateExpressionAsync instead.");default:throw new er(`Unsupported expression type: ${e.type}`)}}async evaluateExpressionAsync(e,t){if(!this.expressionContainsExists(e))return this.evaluateExpression(e,t);if(e.type==="exists")return this.evaluateExists(e,t);if(e.type==="logical")return this.evaluateLogicalAsync(e,t);if(e.type==="comparison"){let n=e,i=await this.evaluateExpressionAsync(n.left,t),s=await this.evaluateExpressionAsync(n.right,t);return Kt.BuiltInFunctions.compare(i,s,n.operator)}return e.type==="in"?this.evaluateInAsync(e,t):e.type==="function"||e.type==="functionCall"?this.evaluateFunctionAsync(e,t):this.evaluateExpression(e,t)}async evaluateExists(e,t){if(!this.existsEvaluator)throw new er("EXISTS evaluator not set. Call setExistsEvaluator before evaluating EXISTS expressions.");let n=await this.existsEvaluator(e.pattern,t);return e.negated?!n:n}async evaluateLogicalAsync(e,t){if(e.operator==="!"){let s=await this.evaluateExpressionAsync(e.operands[0],t);return Kt.BuiltInFunctions.logicalNot(s)}let n=[],i=!1;for(let s of e.operands)try{n.push(await this.evaluateExpressionAsync(s,t))}catch{i=!0}if(e.operator==="&&"){if(n.some(s=>s===!1))return!1;if(i)throw new er("&& operand raised and no false absorbed it");return Kt.BuiltInFunctions.logicalAnd(n)}if(e.operator==="||"){if(n.some(s=>s===!0))return!0;if(i)throw new er("|| operand raised and no true absorbed it");return Kt.BuiltInFunctions.logicalOr(n)}throw new er(`Unknown logical operator: ${String(e.operator)}`)}async evaluateInAsync(e,t){let n=await this.evaluateExpressionAsync(e.expression,t),i=!1,s=!1;for(let o of e.list)try{let c=await this.evaluateExpressionAsync(o,t);if(Kt.BuiltInFunctions.compare(n,c,"=")){i=!0;break}}catch{s=!0}if(!i&&s)throw new er("IN: an element raised and none matched");return e.negated?!i:i}async evaluateFunctionAsync(e,t){let n=e,i=this.extractFunctionName(n.function),s=n.args??[];if(i==="if"){if(s.length!==3)throw new er("IF requires exactly 3 arguments");let l=await this.evaluateExpressionAsync(s[0],t);return this.toBoolean(l)?this.evaluateExpressionAsync(s[1],t):this.evaluateExpressionAsync(s[2],t)}if(i==="coalesce"){for(let l of s)try{let u=await this.evaluateExpressionAsync(l,t);if(u!=null)return u}catch{continue}return}let o=[];for(let l of s){let u=await this.evaluateExpressionAsync(l,t);o.push(this.wrapAsLiteralExpression(u))}let c={...n,args:o};return this.evaluateFunction(c,t)}wrapAsLiteralExpression(e){return e==null?{type:"literal",value:void 0}:typeof e=="object"&&"termType"in e?e:e instanceof W_.IRI||e instanceof Fo.Literal?{type:"literal",value:e.value}:typeof e=="number"||typeof e=="boolean"||typeof e=="string"?{type:"literal",value:e}:{type:"literal",value:String(e)}}evaluateComparison(e,t){let n=this.evaluateExpression(e.left,t),i=this.evaluateExpression(e.right,t);return Kt.BuiltInFunctions.compare(n,i,e.operator)}evaluateLogical(e,t){if(e.operator==="!"){let s=this.evaluateExpression(e.operands[0],t);return Kt.BuiltInFunctions.logicalNot(s)}let n=[],i=!1;for(let s of e.operands)try{n.push(this.evaluateExpression(s,t))}catch{i=!0}if(e.operator==="&&"){if(n.some(s=>s===!1))return!1;if(i)throw new er("&& operand raised and no false absorbed it");return Kt.BuiltInFunctions.logicalAnd(n)}if(e.operator==="||"){if(n.some(s=>s===!0))return!0;if(i)throw new er("|| operand raised and no true absorbed it");return Kt.BuiltInFunctions.logicalOr(n)}throw new er(`Unknown logical operator: ${String(e.operator)}`)}evaluateIn(e,t){let n=this.evaluateExpression(e.expression,t),i=!1,s=!1;for(let o of e.list)try{if(Kt.BuiltInFunctions.compare(n,this.evaluateExpression(o,t),"=")){i=!0;break}}catch{s=!0}if(!i&&s)throw new er("IN: an element raised and none matched");return e.negated?!i:i}evaluateArithmetic(e,t){let n=this.evaluateExpression(e.left,t),i=this.evaluateExpression(e.right,t);if(e.operator==="-"&&this.isDateValue(n)&&this.isDateValue(i))return Kt.BuiltInFunctions.dateDiff(n,i);if(e.operator==="-"&&this.isTimeValue(n)&&this.isTimeValue(i))return Kt.BuiltInFunctions.timeDiff(n,i);if(e.operator==="-"&&this.isDateTimeValue(n)&&this.isDateTimeValue(i))return Kt.BuiltInFunctions.dateTimeDiff(n,i);if(e.operator==="+"&&this.isDateValue(n)&&this.isDayTimeDurationValue(i))return Kt.BuiltInFunctions.dateAdd(n,i);if(e.operator==="-"&&this.isDateValue(n)&&this.isDayTimeDurationValue(i))return Kt.BuiltInFunctions.dateSubtract(n,i);if(e.operator==="+"&&this.isDateValue(n)&&this.isYearMonthDurationValue(i))return Kt.BuiltInFunctions.dateAddYearMonth(n,i);if(e.operator==="-"&&this.isDateValue(n)&&this.isYearMonthDurationValue(i))return Kt.BuiltInFunctions.dateSubtractYearMonth(n,i);if(e.operator==="+"&&this.isDateTimeValue(n)&&this.isDayTimeDurationValue(i))return Kt.BuiltInFunctions.dateTimeAdd(n,i);if(e.operator==="-"&&this.isDateTimeValue(n)&&this.isDayTimeDurationValue(i))return Kt.BuiltInFunctions.dateTimeSubtract(n,i);if(e.operator==="+"&&this.isDateTimeValue(n)&&this.isYearMonthDurationValue(i))return Kt.BuiltInFunctions.dateTimeAddYearMonth(n,i);if(e.operator==="-"&&this.isDateTimeValue(n)&&this.isYearMonthDurationValue(i))return Kt.BuiltInFunctions.dateTimeSubtractYearMonth(n,i);if(e.operator==="+"&&this.isDayTimeDurationValue(n)&&this.isDayTimeDurationValue(i))return Kt.BuiltInFunctions.durationAdd(n,i);if(e.operator==="-"&&this.isDayTimeDurationValue(n)&&this.isDayTimeDurationValue(i))return Kt.BuiltInFunctions.durationSubtract(n,i);if(e.operator==="*"&&this.isDayTimeDurationValue(n)&&!this.isDayTimeDurationValue(i)){let c=this.toNumericValue(i);return Kt.BuiltInFunctions.durationMultiply(n,c)}if(e.operator==="*"&&!this.isDayTimeDurationValue(n)&&this.isDayTimeDurationValue(i)){let c=this.toNumericValue(n);return Kt.BuiltInFunctions.durationMultiply(i,c)}if(e.operator==="/"&&this.isDayTimeDurationValue(n)&&!this.isDayTimeDurationValue(i)){let c=this.toNumericValue(i);if(c===0)throw new er("Division by zero");return Kt.BuiltInFunctions.durationDivide(n,c)}if(e.operator==="+"&&this.isYearMonthDurationValue(n)&&this.isYearMonthDurationValue(i))return Kt.BuiltInFunctions.yearMonthDurationAdd(n,i);if(e.operator==="-"&&this.isYearMonthDurationValue(n)&&this.isYearMonthDurationValue(i))return Kt.BuiltInFunctions.yearMonthDurationSubtract(n,i);let s=this.toNumericValue(n),o=this.toNumericValue(i);switch(e.operator){case"+":return s+o;case"-":return s-o;case"*":return s*o;case"/":if(o===0)throw new er("Division by zero");return s/o;default:throw new er(`Unknown arithmetic operator: ${String(e.operator)}`)}}shouldPreserveDatatype(e){return e==="http://www.w3.org/2001/XMLSchema#dateTime"||e==="http://www.w3.org/2001/XMLSchema#date"||e==="http://www.w3.org/2001/XMLSchema#time"||e==="http://www.w3.org/2001/XMLSchema#dayTimeDuration"||e==="http://www.w3.org/2001/XMLSchema#yearMonthDuration"||e==="http://www.w3.org/2001/XMLSchema#duration"}isDayTimeDurationValue(e){return e instanceof Fo.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#dayTimeDuration":!1}isYearMonthDurationValue(e){return e instanceof Fo.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#yearMonthDuration":!1}toNumericValue(e){if(typeof e=="number")return e;if(e instanceof Fo.Literal){let t=e.datatype?.value||"";if(t.includes("#integer")||t.includes("#decimal")||t.includes("#double")||t.includes("#float")){let i=parseFloat(e.value);if(!isNaN(i))return i}let n=parseFloat(e.value);if(!isNaN(n))return n}if(typeof e=="string"){let t=parseFloat(e);if(!isNaN(t))return t}if(e&&typeof e=="object"&&"value"in e){let t=parseFloat(String(e.value));if(!isNaN(t))return t}throw new er(`Cannot convert to number: ${String(e)}`)}isDateTimeValue(e){if(e instanceof Fo.Literal){let t=e.datatype?.value||"";return t.includes("#dateTime")||t.includes("#date")?!0:/^\d{4}-\d{2}-\d{2}(T|\s)/.test(e.value)}return typeof e=="string"?/^\d{4}-\d{2}-\d{2}(T|\s)/.test(e):!1}isDateValue(e){return e instanceof Fo.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#date":!1}isTimeValue(e){return e instanceof Fo.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#time":!1}evaluateFunction(e,t){let n=e,i=this.extractFunctionName(n.function),s=this.evaluateSpecialFunction(i,n.args,t);if(s!==void 0)return s.value;let o=Qee.functionHandlers.get(i);if(!o)throw new er(`Unknown function: ${i}`);let c={evaluateExpression:a((l,u)=>this.evaluateExpression(l,u),"evaluateExpression"),getTermFromExpression:a((l,u)=>this.getTermFromExpression(l,u),"getTermFromExpression"),getStringValue:a(l=>this.getStringValue(l),"getStringValue"),solution:t,isYearMonthDurationValue:a(l=>this.isYearMonthDurationValue(l),"isYearMonthDurationValue"),isDayTimeDurationValue:a(l=>this.isDayTimeDurationValue(l),"isDayTimeDurationValue")};return o(n.args,c)}extractFunctionName(e){if(typeof e=="string")return e.toLowerCase();if(e&&typeof e=="object"&&"value"in e){let t=e.value;return((t.includes("#")?t.split("#").pop():t.split("/").pop())||t).toLowerCase()}throw new er(`Unknown function format: ${String(e)}`)}evaluateSpecialFunction(e,t,n){switch(e){case"coalesce":for(let i of t)try{let s=this.evaluateExpression(i,n);if(s!=null)return{value:s}}catch{continue}return{value:void 0};case"if":{if(!t||t.length!==3)throw new er("IF requires exactly 3 arguments");let i=this.evaluateExpression(t[0],n);return{value:this.toBoolean(i)?this.evaluateExpression(t[1],n):this.evaluateExpression(t[2],n)}}case"byuuid":return{value:this.evaluateByUUID({type:"function",function:"byuuid",args:t},n)};default:return}}getTermFromExpression(e,t){let n=e,i=n.type==="variable"&&n.name?t.get(n.name):this.evaluateExpression(e,t);if(i==null)throw new er("unbound argument");return i}getStringValue(e){if(e==null)throw new er("unbound argument");return typeof e=="object"&&"value"in e?String(e.value):String(e)}toBoolean(e){if(typeof e=="boolean")return e;if(typeof e=="number")return!isNaN(e)&&e!==0;if(typeof e=="string")return e.length>0;if(e instanceof Fo.Literal){let t=e.datatype?.value||"";if(t.includes("#boolean"))return e.value==="true"||e.value==="1";if(t.includes("#integer")||t.includes("#decimal")||t.includes("#double")||t.includes("#float")){let n=parseFloat(e.value);return!isNaN(n)&&n!==0}return e.value.length>0}return!!e}evaluateByUUID(e,t){if(!e.args||e.args.length!==1)throw new er("exo:byUUID requires exactly 1 argument (UUID string)");let n=this.evaluateExpression(e.args[0],t);if(n==null)return;let i=this.getStringValue(n);if(!i)return;let s=i.toLowerCase();if(this.uuidCache.has(s))return this.uuidCache.get(s)??void 0;if(!this.tripleStore){this.uuidCache.set(s,null);return}if(this.tripleStore.findSubjectsByUUIDSync){let o=this.tripleStore.findSubjectsByUUIDSync(s);if(o.length===0){this.uuidCache.set(s,null);return}let c=o[0];return this.uuidCache.set(s,c),c}this.uuidCache.set(s,null)}cacheUUIDResult(e,t){let n=e.toLowerCase();this.uuidCache.set(n,t)}getCachedUUID(e){let t=e.toLowerCase();if(this.uuidCache.has(t))return this.uuidCache.get(t)}};Zf.FilterExecutor=RI});var OI=T(z_=>{"use strict";Object.defineProperty(z_,"__esModule",{value:!0});z_.OptionalExecutor=void 0;var CI=class{static{a(this,"OptionalExecutor")}async*execute(e,t){let n=[];for await(let s of e)n.push(s);let i=[];for await(let s of t)i.push(s);yield*this.hashJoin(n,i)}async executeAll(e,t){let n=[];for(let i of this.hashJoin(e,t))n.push(i);return n}*hashJoin(e,t){if(e.length===0)return;if(t.length===0){yield*e;return}let n=new Set;for(let l of e)for(let u of l.variables())n.add(u);let i=new Set;for(let l of t)for(let u of l.variables())i.add(u);let s=[];for(let l of n)i.has(l)&&s.push(l);if(s.sort(),s.length===0){yield*this.nestedLoopJoin(e,t);return}let o="\0",c=new Map;for(let l of t){let u=this.computeHashKey(l,s,o),f=c.get(u);f||(f=[],c.set(u,f)),f.push(l)}for(let l of e){let u=this.computeHashKey(l,s,o),f=c.get(u),d=!1;if(f)for(let p of f){let h=l.merge(p);h!==null&&(yield h,d=!0)}d||(yield l)}}computeHashKey(e,t,n){let i=[];for(let s of t){let o=e.get(s);i.push(o!==void 0?o.toString():"UNBOUND")}return i.join(n)}*nestedLoopJoin(e,t){for(let n of e){let i=!1;for(let s of t){let o=n.merge(s);o!==null&&(yield o,i=!0)}i||(yield n)}}};z_.OptionalExecutor=CI});var PI=T(H_=>{"use strict";Object.defineProperty(H_,"__esModule",{value:!0});H_.UnionExecutor=void 0;var xI=class{static{a(this,"UnionExecutor")}async*execute(e,t){let n=new Set;for await(let i of e){let s=this.getSolutionKey(i);n.has(s)||(n.add(s),yield i)}for await(let i of t){let s=this.getSolutionKey(i);n.has(s)||(n.add(s),yield i)}}async executeAll(e,t){let n=[];async function*i(){for(let o of e)yield o}a(i,"generateLeft");async function*s(){for(let o of t)yield o}a(s,"generateRight");for await(let o of this.execute(i(),s()))n.push(o);return n}getSolutionKey(e){let t=e.toJSON();return Object.keys(t).sort().map(i=>`${i}=${t[i]}`).join("|")}};H_.UnionExecutor=xI});var VM=T(Y_=>{"use strict";Object.defineProperty(Y_,"__esModule",{value:!0});Y_.MinusExecutor=void 0;var FI=class{static{a(this,"MinusExecutor")}async*execute(e,t){let n=[];for await(let s of e)n.push(s);let i=[];for await(let s of t)i.push(s);for(let s of n){let o=!1;for(let c of i)if(this.areCompatible(s,c)){o=!0;break}o||(yield s)}}async executeAll(e,t){let n=[];async function*i(){for(let o of e)yield o}a(i,"generateLeft");async function*s(){for(let o of t)yield o}a(s,"generateRight");for await(let o of this.execute(i(),s()))n.push(o);return n}areCompatible(e,t){let n=e.variables(),i=new Set(t.variables()),s=n.filter(o=>i.has(o));if(s.length===0)return!1;for(let o of s){let c=e.get(o),l=t.get(o);if(c===void 0||l===void 0||c.toString()!==l.toString())return!1}return!0}};Y_.MinusExecutor=FI});var qM=T(ed=>{"use strict";Object.defineProperty(ed,"__esModule",{value:!0});ed.ValuesExecutor=ed.ValuesExecutorError=void 0;var Xee=Aa(),GM=Me(),Jee=Ye(),Q_=class extends Error{static{a(this,"ValuesExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="ValuesExecutorError"}};ed.ValuesExecutorError=Q_;var LI=class{static{a(this,"ValuesExecutor")}async*execute(e){if(e.bindings.length!==0)for(let t of e.bindings)yield this.createSolutionMapping(t)}async executeAll(e){let t=[];for await(let n of this.execute(e))t.push(n);return t}createSolutionMapping(e){let t=new Xee.SolutionMapping;for(let[n,i]of Object.entries(e)){let s=this.toRDFTerm(i);t.set(n,s)}return t}toRDFTerm(e){if(e.type==="iri")return new GM.IRI(e.value);if(e.type==="literal")return new Jee.Literal(e.value,e.datatype?new GM.IRI(e.datatype):void 0,e.language,e.direction);throw new Q_(`Unknown term type: ${e.type}`)}};ed.ValuesExecutor=LI});var HM=T(td=>{"use strict";Object.defineProperty(td,"__esModule",{value:!0});td.AggregateExecutor=td.AggregateExecutorError=void 0;var WM=Aa(),Gn=Ye(),NI=Me(),Zee=K_(),ete=y_(),tte=b_(),KM=new NI.IRI("http://www.w3.org/2001/XMLSchema#integer"),su=new NI.IRI("http://www.w3.org/2001/XMLSchema#decimal"),ou=new NI.IRI("http://www.w3.org/2001/XMLSchema#string");function zM(r){return typeof r=="object"&&r.type==="custom"}a(zM,"isCustomAggregation");var Hh=class extends Error{static{a(this,"AggregateExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="AggregateExecutorError"}};td.AggregateExecutorError=Hh;var DI=class{static{a(this,"AggregateExecutor")}constructor(){this.filterExecutor=new Zee.FilterExecutor}execute(e,t){let n=this.groupSolutions(t,e.variables),i=[];for(let[s,o]of n.entries()){let c=new Map;for(let u of e.variables)if(o.length>0){let f=o[0].get(u);f&&c.set(u,f)}for(let u of e.aggregates){let f=this.computeAggregate(u.expression,o);c.set(u.variable,f)}let l=new WM.SolutionMapping;for(let[u,f]of c.entries())f!==void 0&&l.set(u,f);i.push(l)}if(i.length===0&&e.aggregates.length>0){let s=this.createEmptyAggregateResult(e);s&&i.push(s)}return i}groupSolutions(e,t){let n=new Map;if(t.length===0)return n.set("",e),n;for(let i of e){let s=this.computeGroupKey(i,t),o=n.get(s);o?o.push(i):n.set(s,[i])}return n}computeGroupKey(e,t){return t.map(n=>{let i=e.get(n);return i?this.termToString(i):""}).join("|")}termToString(e){if(e&&typeof e=="object"){if("value"in e)return String(e.value);if("id"in e)return String(e.id)}return String(e)}computeAggregate(e,t){if(zM(e.aggregation))return this.computeCustomAggregate(e,t);let n=this.extractValues(e,t),i=e.aggregation;switch(i){case"count":{let s=this.computeCount(n,e.distinct);return new Gn.Literal(String(s),KM)}case"sum":{let s=this.computeSum(n);return new Gn.Literal(String(s),su)}case"avg":{let s=this.computeAvg(n);return new Gn.Literal(String(s),su)}case"min":{let s=this.computeMin(n);return s===void 0?void 0:typeof s=="number"?new Gn.Literal(String(s),su):new Gn.Literal(String(s),ou)}case"max":{let s=this.computeMax(n);return s===void 0?void 0:typeof s=="number"?new Gn.Literal(String(s),su):new Gn.Literal(String(s),ou)}case"group_concat":{let s=this.computeGroupConcat(n,e.separator||" ",e.distinct);return new Gn.Literal(s||" ",ou)}case"sample":{let s=this.computeSample(n,e.distinct);return s===void 0?new Gn.Literal(" ",ou):typeof s=="number"?new Gn.Literal(String(s),su):new Gn.Literal(String(s),ou)}default:{let s=i;throw new Hh(`Unknown aggregation function: ${s}`)}}}computeCustomAggregate(e,t){let i=e.aggregation.iri,o=ete.CustomAggregateRegistry.getInstance().get(i);if(o||(o=tte.BUILT_IN_AGGREGATES[i]),!o)throw new Hh(`Unknown custom aggregate function: ${i}. Register it with CustomAggregateRegistry.getInstance().register() or use a built-in aggregate.`);let c=o.init();for(let l of t){let u=null;if(e.expression){let d=this.evaluateExpression(e.expression,l);d!==void 0&&(u=d)}else u=1;let f;if(e.expression2){let d=this.evaluateExpression(e.expression2,l);f=d===void 0?null:d}o.step(c,u,f)}return o.finalize(c)}extractValues(e,t){if(!e.expression)return t.map(()=>1);let n=[];for(let i of t){let s=this.evaluateExpression(e.expression,i);s!=null&&n.push(s)}return n}evaluateExpression(e,t){if(e.type==="variable"){let n=t.get(e.name);return n==null?void 0:typeof n=="number"||typeof n=="string"||typeof n=="boolean"?n:typeof n=="object"&&"value"in n?n.value:n}if(e.type==="literal")return e.value;try{return this.filterExecutor.evaluateExpression(e,t)}catch{return}}computeCount(e,t){return t?new Set(e.map(n=>String(n))).size:e.length}computeSum(e){return e.map(n=>parseFloat(String(n))).filter(n=>!isNaN(n)).reduce((n,i)=>n+i,0)}computeAvg(e){let t=e.map(n=>parseFloat(String(n))).filter(n=>!isNaN(n));return t.length===0?0:t.reduce((n,i)=>n+i,0)/t.length}asAllNumeric(e){let t=[];for(let n of e){if(typeof n=="number"){t.push(n);continue}let i=String(n).trim();if(i==="")return null;let s=Number(i);if(Number.isNaN(s))return null;t.push(s)}return t.length>0?t:null}computeMin(e){if(e.length===0)return;let t=this.asAllNumeric(e);if(t)return Math.min(...t);let n=e.map(i=>String(i));return n.reduce((i,s)=>s<i?s:i,n[0])}computeMax(e){if(e.length===0)return;let t=this.asAllNumeric(e);if(t)return Math.max(...t);let n=e.map(i=>String(i));return n.reduce((i,s)=>s>i?s:i,n[0])}computeGroupConcat(e,t,n){let i=e.map(s=>String(s));return n&&(i=[...new Set(i)]),i.join(t)}computeSample(e,t){if(e.length===0)return;if(t){let s=[...new Set(e.map(l=>String(l)))];if(s.length===0)return;let o=s[0],c=parseFloat(o);return isNaN(c)?o:c}let n=e[0];if(typeof n=="number")return n;let i=parseFloat(String(n));return isNaN(i)?String(n):i}createEmptyAggregateResult(e){let t=new WM.SolutionMapping;for(let n of e.aggregates){let i=n.expression.aggregation;if(zM(i)){t.set(n.variable,new Gn.Literal("0",su));continue}switch(i){case"count":t.set(n.variable,new Gn.Literal("0",KM));break;case"sum":case"avg":t.set(n.variable,new Gn.Literal("0",su));break;case"group_concat":t.set(n.variable,new Gn.Literal(" ",ou));break;case"min":case"max":case"sample":break;default:t.set(n.variable,new Gn.Literal("",ou))}}return t}};td.AggregateExecutor=DI});var jI=T(X_=>{"use strict";Object.defineProperty(X_,"__esModule",{value:!0});X_.ConstructExecutor=void 0;var rte=oi(),au=Me(),kI=Ye(),MI=lr(),nte=hh(),$I=class{static{a(this,"ConstructExecutor")}async execute(e,t){let n=[],i=new Set;for(let s of t)for(let o of e)try{let c=this.instantiateTriple(o,s),l=`${c.subject.toString()}|${c.predicate.toString()}|${c.object.toString()}`;i.has(l)||(i.add(l),n.push(c))}catch{continue}return n}instantiateTriple(e,t){if(this.isPropertyPath(e.predicate))throw new Error("Property paths are not supported in CONSTRUCT templates");let n=this.instantiateElement(e.subject,t),i=this.instantiateElement(e.predicate,t),s=this.instantiateElement(e.object,t);return new rte.Triple(n,i,s)}isPropertyPath(e){return e.type==="path"}instantiateElement(e,t){if(e.type==="variable"){let n=t.get(e.value);if(!n)throw new Error(`Unbound variable: ${e.value}`);return n}if(e.type==="iri")return new au.IRI(e.value);if(e.type==="literal")return new kI.Literal(e.value,e.datatype?new au.IRI(e.datatype):void 0,e.language);if(e.type==="blank")return new MI.BlankNode(e.value);if(e.type==="quoted")return this.instantiateQuotedTriple(e,t);throw new Error(`Unknown element type: ${e.type}`)}instantiateQuotedTriple(e,t){let n=this.instantiateQuotedSubject(e.subject,t),i=this.instantiateQuotedPredicate(e.predicate,t),s=this.instantiateQuotedObject(e.object,t);return new nte.QuotedTriple(n,i,s)}instantiateQuotedSubject(e,t){if(e.type==="variable"){let n=t.get(e.value);if(!n)throw new Error(`Unbound variable in quoted triple subject: ${e.value}`);if(n instanceof kI.Literal)throw new Error("Literals cannot appear in quoted triple subject position");return n}if(e.type==="iri")return new au.IRI(e.value);if(e.type==="blank")return new MI.BlankNode(e.value);if(e.type==="quoted")return this.instantiateQuotedTriple(e,t);throw new Error(`Invalid element type for quoted triple subject: ${e.type}`)}instantiateQuotedPredicate(e,t){if(e.type==="variable"){let n=t.get(e.value);if(!n)throw new Error(`Unbound variable in quoted triple predicate: ${e.value}`);if(!(n instanceof au.IRI))throw new Error("Quoted triple predicate must be an IRI");return n}return new au.IRI(e.value)}instantiateQuotedObject(e,t){if(e.type==="variable"){let i=t.get(e.value);if(!i)throw new Error(`Unbound variable in quoted triple object: ${e.value}`);return i}if(e.type==="iri")return new au.IRI(e.value);if(e.type==="blank")return new MI.BlankNode(e.value);if(e.type==="literal")return new kI.Literal(e.value,e.datatype?new au.IRI(e.datatype):void 0,e.language);if(e.type==="quoted")return this.instantiateQuotedTriple(e,t);let n=e;throw new Error(`Invalid element type for quoted triple object: ${n.type}`)}};X_.ConstructExecutor=$I});var QM=T(rd=>{"use strict";Object.defineProperty(rd,"__esModule",{value:!0});rd.ServiceExecutor=rd.ServiceExecutorError=void 0;var ite=Aa(),YM=Me(),ste=Ye(),ote=lr(),cu=class extends Error{static{a(this,"ServiceExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="ServiceExecutorError"}};rd.ServiceExecutorError=cu;var BI=class{static{a(this,"ServiceExecutor")}constructor(e={}){this.timeout=e.timeout??3e4,this.httpClient=e.httpClient??((t,n)=>fetch(t,n)),this.maxRetries=e.maxRetries??2,this.retryDelay=e.retryDelay??1e3}async*execute(e,t){try{let n=t(e.pattern),i=await this.executeRemoteQuery(e.endpoint,n);for(let s of i)yield s}catch(n){if(e.silent)return;throw n}}async executeRemoteQuery(e,t){let n;for(let i=0;i<=this.maxRetries;i++)try{let s=new AbortController,o=setTimeout(()=>s.abort(),this.timeout);try{let c=await this.httpClient(e,{method:"POST",headers:{"Content-Type":"application/sparql-query",Accept:"application/sparql-results+json"},body:t,signal:s.signal});if(!c.ok)throw new cu(`Remote SPARQL endpoint returned ${c.status}: ${c.statusText}`);let l=await c.json();return this.parseJsonResults(l)}finally{clearTimeout(o)}}catch(s){if(n=s instanceof Error?s:new Error(String(s)),this.isRetryableError(n)&&i<this.maxRetries){await this.delay(this.retryDelay);continue}throw new cu(`Failed to query remote SPARQL endpoint ${e}: ${n.message}`,n)}throw new cu(`Failed to query remote SPARQL endpoint ${e} after ${this.maxRetries+1} attempts`,n)}parseJsonResults(e){return!e.results||!Array.isArray(e.results.bindings)?[]:e.results.bindings.map(t=>this.parseBinding(t))}parseBinding(e){let t=new ite.SolutionMapping;for(let[n,i]of Object.entries(e)){let s=this.parseRDFTerm(i);t.set(n,s)}return t}parseRDFTerm(e){switch(e.type){case"uri":return new YM.IRI(e.value);case"literal":{let t=e.datatype?new YM.IRI(e.datatype):void 0;return new ste.Literal(e.value,t,e["xml:lang"])}case"bnode":return new ote.BlankNode(e.value);default:throw new cu(`Unknown RDF term type: ${e.type}`)}}isRetryableError(e){let t=e.message.toLowerCase();return!!(e.name==="AbortError"||t.includes("network")||t.includes("econnreset")||t.includes("econnrefused")||t.includes("etimedout")||t.includes("returned 5"))}delay(e){return new Promise(t=>setTimeout(t,e))}};rd.ServiceExecutor=BI});var JM=T(nd=>{"use strict";Object.defineProperty(nd,"__esModule",{value:!0});nd.GraphExecutor=nd.GraphExecutorError=void 0;var XM=Me(),J_=class extends Error{static{a(this,"GraphExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="GraphExecutorError"}};nd.GraphExecutorError=J_;var UI=class{static{a(this,"GraphExecutor")}constructor(e){this.tripleStore=e}async*execute(e,t,n){let i=e.name;if(i.type==="iri")yield*this.executeWithGraph(e.pattern,i,t);else if(i.type==="variable")yield*this.executeWithGraphVariable(e,i,t,n);else throw new J_(`Invalid graph name type: ${i.type}`)}async*executeWithGraph(e,t,n){let i=new XM.IRI(t.value);this.tripleStore.hasGraph&&!await this.tripleStore.hasGraph(i)||(yield*n(e,i))}async*executeWithGraphVariable(e,t,n,i){if(i){let o=i.get(t.value);if(o&&o instanceof XM.IRI){yield*this.executeWithGraph(e.pattern,{type:"iri",value:o.value},n);return}}if(!this.tripleStore.getNamedGraphs)return;let s=await this.tripleStore.getNamedGraphs();for(let o of s)for await(let c of n(e.pattern,o)){let l=c.clone();l.set(t.value,o),yield l}}};nd.GraphExecutor=UI});var t$=T(id=>{"use strict";Object.defineProperty(id,"__esModule",{value:!0});id.ClassHierarchyResolvingStore=id.SymbolicClassAmbiguityError=void 0;var ZM=oi(),lu=Me(),uu=Tt(),e$="\0",Z_=class extends Error{static{a(this,"SymbolicClassAmbiguityError")}constructor(e){super(`Ambiguous class reference '${e}' \u2014 two or more class files derive this symbolic form (a prefix collision). The prefix is an alias, not identity: reference the class by its uid, or narrow the ontology.`),this.symbolic=e,this.name="SymbolicClassAmbiguityError"}};id.SymbolicClassAmbiguityError=Z_;var An=class r{static{a(this,"ClassHierarchyResolvingStore")}constructor(e){this.real=e,this.findSubjectsByUUID=e.findSubjectsByUUID?.bind(e),this.findSubjectsByUUIDSync=e.findSubjectsByUUIDSync?.bind(e),this.addToGraph=e.addToGraph?.bind(e),this.removeFromGraph=e.removeFromGraph?.bind(e),this.matchInGraph=e.matchInGraph?.bind(e),this.getNamedGraphs=e.getNamedGraphs?.bind(e),this.hasGraph=e.hasGraph?.bind(e),this.clearGraph=e.clearGraph?.bind(e),this.countInGraph=e.countInGraph?.bind(e)}async match(e,t,n){return t&&r.HIERARCHY_PREDICATES.has(t.value)&&e instanceof lu.IRI?this.matchHierarchySubject(e,t,n):t&&r.MEMBERSHIP_PREDICATES.has(t.value)&&n instanceof lu.IRI&&n.value.startsWith(r.ONTOLOGY_BASE)?this.matchMembershipObject(e,t,n):this.real.match(e,t,n)}async matchHierarchySubject(e,t,n){let i=await this.real.match(e,t,n),s=await this.resolveSymbolicToFileIri(e.value);if(!s)return i;let o=await this.real.match(s,t,n);if(o.length===0)return i;let c=o.map(l=>new ZM.Triple(e,l.predicate,l.object));return i.length===0?c:r.dedupTriples([...i,...c])}async matchMembershipObject(e,t,n){let i=await this.resolveSymbolicToFileIri(n.value),s=await this.real.match(e,t,n);if(!i)return s;let o=await this.real.match(e,t,i);if(o.length===0)return s;let c=o.map(l=>new ZM.Triple(l.subject,l.predicate,n));return r.dedupTriples([...s,...c])}static dedupTriples(e){let t=new Set,n=[];for(let i of e){let s=`${r.termKey(i.subject)}${e$}${r.termKey(i.predicate)}${e$}${r.termKey(i.object)}`;t.has(s)||(t.add(s),n.push(i))}return n}static termKey(e){if(e instanceof lu.IRI)return`I:${e.value}`;if(e&&typeof e=="object"&&"value"in e){let t=e.value,n=e.datatype?.value??"";return`L:${String(t)}^${n}`}return`?:${String(e)}`}async resolveSymbolicToFileIri(e){let{index:t,ambiguous:n}=await this.getIndex();if(n.has(e))throw new Z_(e);return t.get(e)??null}async getIndex(){let e=await this.real.count(),t=r.INDEX_CACHE.get(this.real);if(t&&t.count===e)return{index:t.index,ambiguous:t.ambiguous};let{index:n,ambiguous:i}=await this.buildIndex();return r.INDEX_CACHE.set(this.real,{count:e,index:n,ambiguous:i}),{index:n,ambiguous:i}}async buildIndex(){let e=new Map,t=new Set,n=[...await this.real.match(void 0,new lu.IRI(r.EXO_ASSET_LABEL),void 0),...await this.real.match(void 0,new lu.IRI(r.RDFS_LABEL),void 0)];for(let i of n){if(!(i.subject instanceof lu.IRI))continue;let s=r.literalValue(i.object);if(s===null)continue;let o=r.labelToSymbolicIRI(s);if(!o)continue;let c=e.get(o);c?c.value!==i.subject.value&&t.add(o):e.set(o,i.subject)}return{index:e,ambiguous:t}}static literalValue(e){return typeof e=="object"&&e!==null&&"value"in e&&!(e instanceof lu.IRI)&&typeof e.value=="string"?e.value:null}static labelToSymbolicIRI(e){let t=uu.Namespace.fromPropertyKey(e);return!t||/[\s()]/.test(t.localName)?null:t.namespace.term(t.localName).value}add(e){return this.real.add(e)}remove(e){return this.real.remove(e)}has(e){return this.real.has(e)}addAll(e){return this.real.addAll(e)}removeAll(e){return this.real.removeAll(e)}clear(){return this.real.clear()}count(){return this.real.count()}subjects(){return this.real.subjects()}predicates(){return this.real.predicates()}objects(){return this.real.objects()}beginTransaction(){return this.real.beginTransaction()}};id.ClassHierarchyResolvingStore=An;An.EXO_CLASS_SUPER_CLASS=uu.Namespace.EXO.term("Class_superClass").value;An.RDFS_SUBCLASS_OF=uu.Namespace.RDFS.term("subClassOf").value;An.RDFS_LABEL=uu.Namespace.RDFS.term("label").value;An.EXO_ASSET_LABEL=uu.Namespace.EXO.term("Asset_label").value;An.EXO_INSTANCE_CLASS=uu.Namespace.EXO.term("Instance_class").value;An.RDF_TYPE=uu.Namespace.RDF.term("type").value;An.ONTOLOGY_BASE="https://exocortex.my/ontology/";An.HIERARCHY_PREDICATES=new Set([An.EXO_CLASS_SUPER_CLASS,An.RDFS_SUBCLASS_OF]);An.MEMBERSHIP_PREDICATES=new Set([An.EXO_INSTANCE_CLASS,An.RDF_TYPE]);An.INDEX_CACHE=new WeakMap});var r$=T(eb=>{"use strict";Object.defineProperty(eb,"__esModule",{value:!0});eb.PropertyHierarchyResolvingStore=void 0;var ate=oi(),sd=Me(),cte=Ye(),lte=lr(),Yh=Tt(),ute="\0",Ra=class r{static{a(this,"PropertyHierarchyResolvingStore")}constructor(e,t=e){this.real=e,this.cacheKey=t,this.findSubjectsByUUID=e.findSubjectsByUUID?.bind(e),this.findSubjectsByUUIDSync=e.findSubjectsByUUIDSync?.bind(e),this.addToGraph=e.addToGraph?.bind(e),this.removeFromGraph=e.removeFromGraph?.bind(e),this.matchInGraph=e.matchInGraph?.bind(e),this.getNamedGraphs=e.getNamedGraphs?.bind(e),this.hasGraph=e.hasGraph?.bind(e),this.clearGraph=e.clearGraph?.bind(e),this.countInGraph=e.countInGraph?.bind(e)}async match(e,t,n){if(t&&t.value.startsWith(r.ONTOLOGY_BASE)&&!r.CLASS_BRIDGE_PREDICATES.has(t.value)){let i=(await this.getIndex()).get(t.value);if(i)return this.matchWithSubProperties(e,t,n,i)}return this.real.match(e,t,n)}matchExactPredicate(e,t,n){return this.real.match(e,t,n)}async matchWithSubProperties(e,t,n,i){let s=[...await this.real.match(e,t,n)];for(let o of i){let c=await this.real.match(e,o,n);for(let l of c)s.push(new ate.Triple(l.subject,t,l.object))}return r.dedupTriples(s)}static dedupTriples(e){let t=new Set,n=[];for(let i of e){let s=`${r.termKey(i.subject)}${ute}${r.termKey(i.object)}`;t.has(s)||(t.add(s),n.push(i))}return n}static termKey(e){if(e instanceof sd.IRI)return`I:${e.value}`;if(e instanceof cte.Literal){let t=e.datatype?.value,n=t===r.XSD_STRING?"":t??"";return`L:${e.value}^${n}@${e.language??""}`}return e instanceof lte.BlankNode?`B:${e.id}`:`?:${e.toString()}`}async getIndex(){let e=await this.real.count(),t=r.INDEX_CACHE.get(this.cacheKey);if(t&&t.count===e)return t.subProperties;let n=await this.buildIndex();return r.INDEX_CACHE.set(this.cacheKey,{count:e,subProperties:n}),n}async buildIndex(){let e=await this.real.match(void 0,new sd.IRI(r.EXO_PROPERTY_SUPER_PROPERTY),void 0),t=new Map;for(let i of e){let s=await this.toPredicateForm(i.subject),o=await this.toPredicateForm(i.object);if(!s||!o)continue;let c=t.get(o);c||(c=new Set,t.set(o,c)),c.add(s)}let n=new Map;for(let i of t.keys()){let s=[],o=new Set([i]),c=[...t.get(i)??[]];for(;c.length>0;){let l=c.shift();if(!o.has(l)){o.add(l),s.push(new sd.IRI(l));for(let u of t.get(l)??[])o.has(u)||c.push(u)}}n.set(i,s)}return n}async toPredicateForm(e){if(!(e instanceof sd.IRI))return null;if(!e.value.startsWith("obsidian://"))return e.value;let t=await this.real.match(e,new sd.IRI(r.EXO_ASSET_LABEL),void 0);for(let n of t)if(n.object instanceof sd.IRI)return n.object.value;return null}add(e){return this.real.add(e)}remove(e){return this.real.remove(e)}has(e){return this.real.has(e)}addAll(e){return this.real.addAll(e)}removeAll(e){return this.real.removeAll(e)}clear(){return this.real.clear()}count(){return this.real.count()}subjects(){return this.real.subjects()}predicates(){return this.real.predicates()}objects(){return this.real.objects()}beginTransaction(){return this.real.beginTransaction()}};eb.PropertyHierarchyResolvingStore=Ra;Ra.EXO_PROPERTY_SUPER_PROPERTY=Yh.Namespace.EXO.term("Property_superProperty").value;Ra.EXO_ASSET_LABEL=Yh.Namespace.EXO.term("Asset_label").value;Ra.XSD_STRING=Yh.Namespace.XSD.term("string").value;Ra.ONTOLOGY_BASE="https://exocortex.my/ontology/";Ra.CLASS_BRIDGE_PREDICATES=new Set([Yh.Namespace.EXO.term("Class_superClass").value,Yh.Namespace.EXO.term("Instance_class").value]);Ra.INDEX_CACHE=new WeakMap});var n$=T(ad=>{"use strict";Object.defineProperty(ad,"__esModule",{value:!0});ad.SPARQLGenerator=ad.SPARQLGeneratorError=void 0;var od=class extends Error{static{a(this,"SPARQLGeneratorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="SPARQLGeneratorError"}};ad.SPARQLGeneratorError=od;var VI=class{static{a(this,"SPARQLGenerator")}collectVariables(e){let t=new Set;return this.collectVariablesFromOperation(e,t),t}generateSelect(e){let t=this.collectVariables(e),n=t.size>0?Array.from(t).map(s=>`?${s}`).join(" "):"*",i=this.generateWhereClause(e);return`SELECT ${n} WHERE {
@@ -339,27 +339,27 @@ To resolve:
339
339
  path = ${e}
340
340
  url = ${t}
341
341
  `;return{content:r+i+s,added:!0}}a(nue,"appendGitmodulesEntry");function iue(r,e){let t=r.split(/\r?\n/),n=[],i=!1,s=new RegExp(`^\\[submodule\\s+"${YO(e)}"\\]\\s*$`);for(let l of t){if(i){if(/^\[.+\]\s*$/.test(l)){i=!1,n.push(l);continue}continue}if(s.test(l)){i=!0;continue}n.push(l)}let o=[],c=!1;for(let l of n){let u=l.trim().length===0;u&&c||(o.push(l),c=u)}return o.join(`
342
- `)}a(iue,"stripGitmodulesEntry")});var qc=T(QO=>{"use strict";Object.defineProperty(QO,"__esModule",{value:!0});QO.gitBlobSha=sue;async function sue(r,e){let t=new TextEncoder,n=typeof r=="string"?t.encode(r):r,i=t.encode(`blob ${n.byteLength}\0`),s=new Uint8Array(i.byteLength+n.byteLength);return s.set(i,0),s.set(n,i.byteLength),e(s)}a(sue,"gitBlobSha")});var Rm=T(XS=>{"use strict";Object.defineProperty(XS,"__esModule",{value:!0});XS.extractAssetUid=CB;XS.detectChanges=aue;var oue=qc();function CB(r){let e=/^---\r?\n([\s\S]*?)\r?\n---(?=\r?\n|$)/.exec(r);if(!e)return;let t=/^exo__Asset_uid:[ \t]*["']?([^\s"']+)["']?[ \t]*$/m.exec(e[1]);return t?t[1]:void 0}a(CB,"extractAssetUid");async function aue(r){let{localFiles:e,cachedEntries:t,watermark:n,actualBaseTreeSha:i,sha1:s}=r;if(n===null)return{kind:"full-conflict",reason:"first-sync"};if(i===null)return{kind:"full-conflict",reason:"base-mismatch",detail:`watermark commit ${n.lastSyncedSha} not resolvable on remote`};if(i!==n.rootTreeSha)return{kind:"full-conflict",reason:"base-mismatch",detail:`stored root tree ${n.rootTreeSha} != actual ${i} at ${n.lastSyncedSha}`};let o=[],c=new Map;for(let[E,S]of e){let R=await(0,oue.gitBlobSha)(S,s);c.set(E,R),o.push({path:E,blobSha:R,uid:typeof S=="string"?CB(S):void 0})}if(t!==void 0)for(let[E,S]of t)c.set(E,S.blobSha),o.push({path:E,blobSha:S.blobSha,uid:S.uid});let l=[],u=[],f=[],d=[],p=new Map;for(let E of o){if(E.uid===void 0)continue;let S=p.get(E.uid)??[];S.push(E.path),p.set(E.uid,S)}let h=new Map;for(let E of n.files){if(E.uid===void 0)continue;let S=h.get(E.uid)??[];S.push(E.path),h.set(E.uid,S)}let g=new Set;for(let[E,S]of p)S.length>1&&g.add(E);for(let[E,S]of h)S.length>1&&g.add(E);for(let E of[...g].sort()){let S=p.get(E)??[],R=S.length>1?`on disk (${S.join(", ")})`:`in the sync base (${(h.get(E)??[]).join(", ")})`;d.push(`duplicate uid ${E} ${R} \u2014 uid identity suppressed for the group; every path matched by path identity (#3477)`)}let m=new Map,_=[];for(let E of n.files)E.uid!==void 0&&!g.has(E.uid)?m.set(E.uid,E):_.push(E);let b=[],w=new Set;for(let E of o){let S=E.uid!==void 0&&!g.has(E.uid)?m.get(E.uid):void 0;E.uid!==void 0&&S!==void 0?(w.add(E.uid),(S.blobSha!==E.blobSha||S.path!==E.path)&&u.push({path:E.path,uid:E.uid,blobSha:E.blobSha,...S.path!==E.path?{basePath:S.path}:{}})):b.push(E)}let v=new Map;for(let E of _)v.set(E.path,E);for(let[E,S]of m)w.has(E)||v.set(S.path,S);for(let E of b){let S=v.get(E.path);S!==void 0?(v.delete(E.path),S.blobSha!==E.blobSha&&u.push({path:E.path,uid:E.uid,blobSha:E.blobSha})):l.push({path:E.path,uid:E.uid,blobSha:E.blobSha})}for(let E of v.values())f.push({path:E.path,uid:E.uid,blobSha:E.blobSha});return{kind:"changes",added:l,modified:u,deleted:f,warnings:d,diskBlobShas:c,duplicateUids:g}}a(aue,"detectChanges")});var OB=T(XO=>{"use strict";Object.defineProperty(XO,"__esModule",{value:!0});XO.promiseWithDeadline=cue;async function cue(r,e,t){if(e<=0)return r;let n,i=new Promise((s,o)=>{n=setTimeout(()=>o(t()),e),n.unref?.()});try{return await Promise.race([r,i])}finally{clearTimeout(n)}}a(cue,"promiseWithDeadline")});var LB=T(Wc=>{"use strict";Object.defineProperty(Wc,"__esModule",{value:!0});Wc.ConditionalRequestCache=Wc.CONDITIONAL_STORE_FILENAME=void 0;Wc.conditionalCacheKey=PB;Wc.withConditionalRequests=fue;Wc.CONDITIONAL_STORE_FILENAME="exosync-etags.local.json";var lue=4e3,uue=64*1024;function JS(r){if(r===null||typeof r!="object")return!1;let e=r;return typeof e.etag=="string"&&typeof e.body=="string"}a(JS,"isEntry");function PB(r){if(r.method!=="GET")return null;let e;try{e=new URL(r.url)}catch{return null}let t=e.pathname.split("/").filter(o=>o.length>0),n=t.lastIndexOf("repos");if(n<0)return null;let i=t.slice(n+1);if(i.length<4||i[2]!=="git")return null;let s=i[3];return s!=="refs"&&s!=="commits"&&s!=="trees"?null:r.url}a(PB,"conditionalCacheKey");var JO=class{static{a(this,"ConditionalRequestCache")}constructor(e){this.loaded=null,this.draining=!1,this.dirty=!1,this.drained=Promise.resolve(),this.counters={conditional:0,notModified:0,stored:0},this.io=e.io,this.maxEntries=e.maxEntries??lue,this.maxBodyBytes=e.maxBodyBytes??uue,this.now=e.now??(()=>Date.now())}stats(){return{...this.counters}}async etagFor(e){let n=(await this.load())[e];return JS(n)?n.etag:null}async bodyFor(e){let n=(await this.load())[e];if(!JS(n))return null;try{return JSON.parse(n.body)}catch{return null}}async remember(e,t,n){let i;try{i=JSON.stringify(n)}catch{return}if(i.length>this.maxBodyBytes)return;let s={etag:t,body:i,lastUsedMs:this.now()};await this.mutate(o=>{o[e]=s,this.evictIfNeeded(o)}),this.counters.stored+=1}async touch(e){let t=this.now();await this.mutate(n=>{let i=n[e];JS(i)&&(i.lastUsedMs=t)})}countConditional(){this.counters.conditional+=1}countNotModified(){this.counters.notModified+=1}evictIfNeeded(e){let t=Object.keys(e);t.length<=this.maxEntries||t.sort((n,i)=>(e[n]?.lastUsedMs??0)-(e[i]?.lastUsedMs??0)).slice(0,t.length-this.maxEntries).forEach(n=>delete e[n])}async flush(){for(;this.draining;)await this.drained}load(){return this.loaded===null&&(this.loaded=this.readEntries().then(e=>{for(let t of Object.keys(e)){let n=e[t];JS(n)&&n.body.length>this.maxBodyBytes&&delete e[t]}return e})),this.loaded}async mutate(e){let t=await this.load();e(t),this.dirty=!0,this.draining||(this.draining=!0,this.drained=this.drain(t))}async drain(e){try{for(;this.dirty;){this.dirty=!1;let t={version:1,entries:e};try{await this.io.writeAtomic(JSON.stringify(t))}catch{}}}finally{this.draining=!1}}async readEntries(){try{let e=await this.io.read();if(e===null)return{};let t=JSON.parse(e);if(t===null||typeof t!="object")return{};let n=t.entries;return n!==null&&typeof n=="object"?n:{}}catch{return{}}}};Wc.ConditionalRequestCache=JO;function fue(r,e){return async t=>{let n=PB(t);if(n===null)return r(t);let i=await e.etagFor(n);if(i===null)return xB(r,e,t,n);e.countConditional();let s=await r({...t,headers:{...t.headers??{},"If-None-Match":i},acceptNotModified:!0});if(s.status===304){let o=await e.bodyFor(n);return o!==null?(e.countNotModified(),await e.touch(n).catch(()=>{}),{status:200,json:o,...s.headers===void 0?{}:{headers:s.headers}}):xB(r,e,t,n)}return await FB(e,n,s),s}}a(fue,"withConditionalRequests");async function xB(r,e,t,n){let i=await r(t);return await FB(e,n,i),i}a(xB,"storeFresh");async function FB(r,e,t){let n=t.headers?.("etag");typeof n!="string"||n.length===0||t.json!==void 0&&await r.remember(e,n,t.json).catch(()=>{})}a(FB,"rememberFrom")});var MB=T(Bd=>{"use strict";Object.defineProperty(Bd,"__esModule",{value:!0});Bd.ImmutableObjectCache=void 0;Bd.parseImmutableObjectUrl=NB;Bd.withImmutableObjectCache=Eue;var due=Zl(),pue=qc(),hue=256*1024*1024,mue=/^[A-Za-z0-9._-]+$/;function gue(r){return r==="."||r===".."}a(gue,"isDotSegment");function DB(r){return mue.test(r)&&!gue(r)}a(DB,"isSafeSegment");var yue=/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/,_ue=/^[A-Za-z0-9=&_.-]*$/,bue=new Set(["commits","trees","blobs"]);function Sue(r){if(r.length===0)return"";let e=new URLSearchParams(r),t=[];for(let[n,i]of e.entries())t.push(`${n}=${i}`);return t.sort(),t.join("&")}a(Sue,"normaliseVariant");function NB(r){let e;try{e=new URL(r)}catch{return null}let t=e.pathname.split("/").filter(p=>p.length>0),n=t.lastIndexOf("repos");if(n<0)return null;let[i,s,o,c,l,...u]=t.slice(n+1);if(u.length>0||o!=="git"||i===void 0||s===void 0||c===void 0||l===void 0||!bue.has(c)||!DB(i)||!DB(s)||!yue.test(l))return null;let f=Sue(e.search.replace(/^\?/,""));if(!_ue.test(f))return null;let d=`${i}/${s}/${c}/${l}${f?`~${f}`:""}`;return{owner:i,repo:s,type:c,sha:l,variant:f,key:d}}a(NB,"parseImmutableObjectUrl");function kB(r){return r!==null&&typeof r=="object"?r:void 0}a(kB,"asRecord");function wue(r){let e=kB(r);return e!==void 0&&e.v===1&&typeof e.sha=="string"&&typeof e.digest=="string"&&typeof e.body=="string"}a(wue,"isEnvelope");function Kc(r,e){return new Error(`ExoSync: cached git object ${r.key} failed its integrity check (${e}) \u2014 refusing to apply it. Delete the cache entry to re-fetch.`)}a(Kc,"integrityError");var ZO=class{static{a(this,"ImmutableObjectCache")}constructor(e){this.writtenSinceSweep=0,this.sweptOnce=!1,this.counters={hits:0,misses:0,stores:0,evictions:0},this.io=e.io,this.sha1=e.sha1,this.maxBytes=e.maxBytes??hue,this.sweepIntervalBytes=e.sweepIntervalBytes??Math.max(1,Math.floor(this.maxBytes/8))}stats(){return{...this.counters}}async get(e){let t;try{t=await this.io.read(e.key)}catch{return this.counters.misses+=1,null}if(t===null)return this.counters.misses+=1,null;let n;try{n=JSON.parse(t)}catch{throw Kc(e,"stored payload is not valid JSON")}if(!wue(n))return this.counters.misses+=1,null;let i=await this.digestOf(n.body);if(i!==n.digest)throw Kc(e,`stored digest ${n.digest} does not match the payload (recomputed ${i})`);let s;try{s=JSON.parse(n.body)}catch{throw Kc(e,"stored body is not valid JSON")}return await this.assertIntegrity(e,s),this.counters.hits+=1,this.io.markUsed(e.key).catch(()=>{}),{status:200,json:s,text:n.body}}async put(e,t){if(t.json===void 0)return;let n;try{n=JSON.stringify(t.json)}catch{return}try{await this.assertIntegrity(e,t.json)}catch{return}let i;try{let s={v:1,sha:e.sha,digest:await this.digestOf(n),body:n};i=JSON.stringify(s)}catch{return}try{await this.io.write(e.key,i)}catch{return}this.counters.stores+=1,this.writtenSinceSweep+=i.length,(!this.sweptOnce||this.writtenSinceSweep>=this.sweepIntervalBytes)&&(this.sweptOnce=!0,this.writtenSinceSweep=0,await this.evict().catch(()=>{}))}async evict(){let e=await this.io.list(),t=0;for(let s of e)t+=s.size;if(t<=this.maxBytes)return 0;let n=[...e].sort((s,o)=>s.lastUsedMs-o.lastUsedMs),i=0;for(let s of n){if(t<=this.maxBytes)break;try{await this.io.remove(s.key)}catch{continue}t-=s.size,i+=1,this.counters.evictions+=1}return i}async digestOf(e){return this.sha1(new TextEncoder().encode(e))}async assertIntegrity(e,t){let n=kB(t);if(n===void 0)throw Kc(e,"stored payload is not an object");if(e.type!=="blobs"){let l=n.sha;if(typeof l!="string"||l!==e.sha)throw Kc(e,`response sha ${String(l)} does not match the requested sha`);return}let i=n.content,s=n.encoding;if(typeof i!="string")throw Kc(e,"blob payload has no content");let o;try{o=s==="utf-8"?new TextEncoder().encode(i):(0,due.base64ToBytes)(i)}catch{throw Kc(e,"blob content is not decodable")}let c=await(0,pue.gitBlobSha)(o,this.sha1);if(c!==e.sha)throw Kc(e,`recomputed blob sha ${c} does not match the requested sha`)}};Bd.ImmutableObjectCache=ZO;function Eue(r,e){return async t=>{if(t.method!=="GET")return r(t);let n=NB(t.url);if(n===null)return r(t);let i=await e.get(n);if(i!==null)return i;let s=await r(t);return await e.put(n,s),s}}a(Eue,"withImmutableObjectCache")});var BB=T(Cm=>{"use strict";Object.defineProperty(Cm,"__esModule",{value:!0});Cm.rewriteAssetUid=$B;Cm.findDuplicateUidGroups=jB;Cm.planDuplicateUidFix=Tue;var vue=Rm();function $B(r,e){let t=/^(---\r?\n)([\s\S]*?)(\r?\n---(?=\r?\n|$))/.exec(r);if(t===null)return r;let n=t[2].replace(/^(exo__Asset_uid:[ \t]*["']?)[^\s"']+(["']?[ \t]*)$/m,`$1${e}$2`);return n===t[2]?r:r.slice(0,t.index)+t[1]+n+t[3]+r.slice(t.index+t[0].length)}a($B,"rewriteAssetUid");function jB(r){let e=new Map;for(let t of r){let n=(0,vue.extractAssetUid)(t.content);if(n===void 0)continue;let i=e.get(n)??[];i.push(t.path),e.set(n,i)}return[...e.entries()].filter(([,t])=>t.length>1).sort(([t],[n])=>t.localeCompare(n)).map(([t,n])=>({uid:t,paths:n}))}a(jB,"findDuplicateUidGroups");function Tue(r,e){let t=new Map(r.map(i=>[i.path,i.content])),n=[];for(let i of jB(r)){let s=[...i.paths].sort((o,c)=>o.localeCompare(c));for(let o of s.slice(1)){let c=t.get(o);if(c===void 0)continue;let l=e(),u=$B(c,l);u!==c&&n.push({path:o,fromUid:i.uid,toUid:l,content:u})}}return n}a(Tue,"planDuplicateUidFix")});var Au=T(gs=>{"use strict";Object.defineProperty(gs,"__esModule",{value:!0});gs.EMPTY_TREE_SHA=void 0;gs.getHeadSha=Iue;gs.getCommitInfo=Rue;gs.getTree=Cue;gs.listPathCommitShas=xue;gs.getPathBlobShaAt=Pue;gs.getBlobText=Fue;gs.getBlobBytes=Lue;var UB=Zl(),Aue="https://api.github.com";function Tu(r){return(r??Aue).replace(/\/$/,"")}a(Tu,"api");function vu(r){return r!==null&&typeof r=="object"?r:void 0}a(vu,"asRecord");function ms(r,e){let n=vu(r)?.[e];return typeof n=="string"?n:void 0}a(ms,"readString");async function Iue(r,e,t,n,i){let s=await r({method:"GET",url:`${Tu(i)}/repos/${encodeURIComponent(e)}/${encodeURIComponent(t)}/git/refs/heads/${encodeURIComponent(n)}`}),o=ms(vu(s?.json)?.object,"sha");if(typeof o!="string"||o.length===0)throw new Error(`ExoSync: missing object.sha for ref heads/${n}`);return o}a(Iue,"getHeadSha");async function Rue(r,e,t,n,i){let s=await r({method:"GET",url:`${Tu(i)}/repos/${encodeURIComponent(e)}/${encodeURIComponent(t)}/git/commits/${encodeURIComponent(n)}`}),o=vu(s?.json),c=ms(o,"sha"),l=ms(o?.tree,"sha");if(!c||!l)throw new Error(`ExoSync: malformed commit response for ${n}`);let u=o?.parents,f=Array.isArray(u)?u.map(d=>ms(d,"sha")).filter(d=>typeof d=="string"):[];return{sha:c,treeSha:l,parents:f}}a(Rue,"getCommitInfo");gs.EMPTY_TREE_SHA="4b825dc642cb6eb9a060e54bf8d69288fbee4904";async function Cue(r,e,t,n,i){if(n===gs.EMPTY_TREE_SHA)return[];let s=await r({method:"GET",url:`${Tu(i)}/repos/${encodeURIComponent(e)}/${encodeURIComponent(t)}/git/trees/${encodeURIComponent(n)}?recursive=1`}),o=vu(s?.json);if(o?.truncated===!0)throw new Error(`ExoSync: tree ${n} is truncated by GitHub (repo too large for recursive listing) \u2014 refusing to diff`);let c=o?.tree;if(!Array.isArray(c))throw new Error(`ExoSync: malformed tree response for ${n}`);let l=[];for(let u of c){let f=vu(u);if(f?.type!=="blob")continue;let d=ms(f,"path"),p=ms(f,"sha"),h=typeof f.size=="number"?f.size:void 0;d&&p&&l.push({path:d,blobSha:p,...h!==void 0?{size:h}:{}})}return l}a(Cue,"getTree");function Oue(r){return r.split("/").map(encodeURIComponent).join("/")}a(Oue,"encodePath");async function xue(r,e,t,n,i,s,o){let l=(await r({method:"GET",url:`${Tu(o)}/repos/${encodeURIComponent(e)}/${encodeURIComponent(t)}/commits?sha=${encodeURIComponent(i)}&path=${encodeURIComponent(n)}&per_page=${s}`}))?.json;if(!Array.isArray(l))throw new Error(`ExoSync: malformed commit list for ${n}`);return l.map(u=>ms(u,"sha")).filter(u=>typeof u=="string"&&u.length>0)}a(xue,"listPathCommitShas");async function Pue(r,e,t,n,i,s){let o=await r({method:"GET",url:`${Tu(s)}/repos/${encodeURIComponent(e)}/${encodeURIComponent(t)}/contents/${Oue(n)}?ref=${encodeURIComponent(i)}`}),c=ms(o?.json,"sha");if(typeof c!="string"||c.length===0)throw new Error(`ExoSync: malformed contents response for ${n}@${i}`);return c}a(Pue,"getPathBlobShaAt");async function Fue(r,e,t,n,i){let s=await r({method:"GET",url:`${Tu(i)}/repos/${encodeURIComponent(e)}/${encodeURIComponent(t)}/git/blobs/${encodeURIComponent(n)}`}),o=vu(s?.json),c=ms(o,"content");if(typeof c!="string")throw new Error(`ExoSync: malformed blob response for ${n}`);return ms(o,"encoding")==="utf-8"?c:(0,UB.base64ToUtf8)(c)}a(Fue,"getBlobText");async function Lue(r,e,t,n,i){let s=await r({method:"GET",url:`${Tu(i)}/repos/${encodeURIComponent(e)}/${encodeURIComponent(t)}/git/blobs/${encodeURIComponent(n)}`}),o=vu(s?.json),c=ms(o,"content");if(typeof c!="string")throw new Error(`ExoSync: malformed blob response for ${n}`);return ms(o,"encoding")==="utf-8"?new TextEncoder().encode(c):(0,UB.base64ToBytes)(c)}a(Lue,"getBlobBytes")});var GB=T(e2=>{"use strict";Object.defineProperty(e2,"__esModule",{value:!0});e2.checkParkedStaleness=Nue;var Due=Au();async function Nue(r,e){let t={repoKey:r.repoKey,localPath:r.localPath},n=e.redact??(o=>o),i=null;try{let c=(await e.watermarks.get(r.repoKey))?.lastSyncedSha??"";c.length>0&&(i=c)}catch(o){return{...t,freshness:"unknown",lastSyncedSha:null,remoteHeadSha:null,reason:`watermark unreadable: ${n(VB(o))}`}}if(i===null)return{...t,freshness:"unknown",lastSyncedSha:null,remoteHeadSha:null,reason:"never synced on this device (no watermark)"};let s;try{s=await(0,Due.getHeadSha)(e.transport,r.owner,r.repo,r.branch,e.baseURL)}catch(o){return{...t,freshness:"unknown",lastSyncedSha:i,remoteHeadSha:null,reason:`remote unreachable: ${n(VB(o))}`}}return{...t,freshness:s===i?"current":"behind",lastSyncedSha:i,remoteHeadSha:s}}a(Nue,"checkParkedStaleness");function VB(r){return r instanceof Error?r.message:String(r)}a(VB,"errorText")});var i2=T(br=>{"use strict";Object.defineProperty(br,"__esModule",{value:!0});br.SyncPhaseTimer=br.SYNC_PHASES=void 0;br.classifyRestPhase=kue;br.emptyTimings=WB;br.totalMs=ZS;br.addTimings=KB;br.aggregateTimings=$ue;br.dominantPhase=jue;br.fmtMs=Om;br.formatQuota=n2;br.formatTimingsLine=Bue;br.formatRepoTimings=Uue;br.SYNC_PHASES=["localList","localRead","localWrite","hash","restHead","restCommit","restTree","restBlob","restPush"];function r2(){let r={};for(let e of br.SYNC_PHASES)r[e]=0;return r}a(r2,"zeroDurations");function qB(){return{filesRead:0,filesHashed:0,filesWritten:0,restCalls:0}}a(qB,"zeroCounts");function kue(r){if(r.method!=="GET")return"restPush";let e=r.url;return e.includes("/git/blobs/")?"restBlob":e.includes("/git/trees/")?"restTree":e.includes("/git/commits/")?"restCommit":e.includes("/git/refs/")?"restHead":"restCommit"}a(kue,"classifyRestPhase");var t2=class{static{a(this,"SyncPhaseTimer")}constructor(e){this.now=e,this.durations=r2(),this.counts=qB(),this.quota=void 0}async time(e,t){let n=this.now();try{return await t()}finally{this.durations[e]+=this.now()-n}}bumpRead(){this.counts.filesRead++}bumpHashed(){this.counts.filesHashed++}bumpWritten(){this.counts.filesWritten++}bumpRest(){this.counts.restCalls++}observeQuota(e){if(e===void 0)return;let t=a(c=>{let l;try{l=e(c)}catch{return null}if(l==null||l.trim()==="")return null;let u=Number(l);return Number.isFinite(u)?u:null},"num"),n=t("x-ratelimit-limit"),i=t("x-ratelimit-remaining"),s=t("x-ratelimit-used"),o=t("x-ratelimit-reset");n===null&&i===null&&s===null||(this.quota=zB(this.quota,{limit:n,remaining:i,used:s,resetEpoch:o,observedAt:this.now()}))}snapshot(){return{durations:{...this.durations},counts:{...this.counts},...this.quota===void 0?{}:{quota:{...this.quota}}}}};br.SyncPhaseTimer=t2;function WB(){return{durations:r2(),counts:qB()}}a(WB,"emptyTimings");function ZS(r){let e=0;for(let t of br.SYNC_PHASES)e+=r.durations[t];return e}a(ZS,"totalMs");function KB(r,e){let t=r2();for(let i of br.SYNC_PHASES)t[i]=r.durations[i]+e.durations[i];let n=Mue(r.quota,e.quota);return{durations:t,counts:{filesRead:r.counts.filesRead+e.counts.filesRead,filesHashed:r.counts.filesHashed+e.counts.filesHashed,filesWritten:r.counts.filesWritten+e.counts.filesWritten,restCalls:r.counts.restCalls+e.counts.restCalls},...n===void 0?{}:{quota:n}}}a(KB,"addTimings");function Mue(r,e){return r===void 0?e:e===void 0?r:zB(r,e)}a(Mue,"fresherQuota");function zB(r,e){if(r===void 0)return e;if(r.resetEpoch!==null&&e.resetEpoch!==null&&r.resetEpoch===e.resetEpoch){if(r.remaining!==null&&e.remaining!==null)return e.remaining<=r.remaining?e:r;if(r.used!==null&&e.used!==null)return e.used>=r.used?e:r}return e.observedAt>=r.observedAt?e:r}a(zB,"pickQuota");function $ue(r){let e=WB();for(let t of r)t.timings!==void 0&&(e=KB(e,t.timings));return e}a($ue,"aggregateTimings");function jue(r){let e=ZS(r);if(e<=0)return null;let t=br.SYNC_PHASES[0],n=-1;for(let i of br.SYNC_PHASES)r.durations[i]>n&&(n=r.durations[i],t=i);return{phase:t,ms:n,pct:n/e*100}}a(jue,"dominantPhase");function Om(r){return r>=1e3?`${(r/1e3).toFixed(1)}s`:`${Math.round(r)}ms`}a(Om,"fmtMs");function n2(r){if(r===void 0)return"quota n/a";let e=r.remaining===null?"?":String(r.remaining),t=r.limit===null?"?":String(r.limit);if(r.resetEpoch===null)return`quota ${e}/${t}`;let n=new Date(r.resetEpoch*1e3),i=String(n.getHours()).padStart(2,"0"),s=String(n.getMinutes()).padStart(2,"0");return`quota ${e}/${t}, reset ${i}:${s}`}a(n2,"formatQuota");function Bue(r){let e=ZS(r);if(e<=0)return"";let t=br.SYNC_PHASES.filter(n=>r.durations[n]>0).sort((n,i)=>r.durations[i]-r.durations[n]).map(n=>`${n} ${Om(r.durations[n])} ${Math.round(r.durations[n]/e*100)}%`);return`\u23F1 ExoSync ${Om(e)} \u2014 ${t.join(" \xB7 ")} (${r.counts.filesHashed} hashed, ${r.counts.filesRead} read, ${r.counts.restCalls} REST, ${n2(r.quota)})`}a(Bue,"formatTimingsLine");function Uue(r,e){let t=br.SYNC_PHASES.map(n=>`${n}=${Om(e.durations[n])}`);return`[ExoSync timings] ${r}: total ${Om(ZS(e))} \u2014 ${t.join(" ")} | hashed ${e.counts.filesHashed} read ${e.counts.filesRead} written ${e.counts.filesWritten} REST ${e.counts.restCalls} | ${n2(e.quota)}`}a(Uue,"formatRepoTimings")});var a2=T(zc=>{"use strict";Object.defineProperty(zc,"__esModule",{value:!0});zc.caseInsensitiveHeaderGetter=Vue;zc.parseRetryAfterMs=HB;zc.extractRateLimitFields=YB;zc.getRateLimitFields=Gue;zc.attachRateLimitFields=QB;zc.enrichRateLimitError=que;function Vue(r){let e=new Map;if(r&&typeof r=="object")for(let[t,n]of Object.entries(r))typeof n=="string"&&e.set(t.toLowerCase(),n);return t=>e.get(t.toLowerCase())}a(Vue,"caseInsensitiveHeaderGetter");function o2(r){if(r==null)return;let e=r.trim();if(!/^-?\d+$/.test(e))return;let t=Number(e);return Number.isFinite(t)?t:void 0}a(o2,"parseIntHeader");function HB(r,e=Date.now){if(r==null)return;let t=r.trim();if(t.length===0)return;let n=o2(t);if(n!==void 0)return Math.max(0,n*1e3);let i=Date.parse(t);if(!Number.isNaN(i))return Math.max(0,i-e())}a(HB,"parseRetryAfterMs");function YB(r,e=Date.now){let t={},n=HB(r("retry-after"),e);n!==void 0&&(t.retryAfterMs=n);let i=o2(r("x-ratelimit-reset"));i!==void 0&&(t.rateLimitReset=i);let s=o2(r("x-ratelimit-remaining"));return s!==void 0&&(t.rateLimitRemaining=s),t}a(YB,"extractRateLimitFields");function Gue(r){if(r===null||typeof r!="object")return{};let e=r,t={};return typeof e.retryAfterMs=="number"&&(t.retryAfterMs=e.retryAfterMs),typeof e.rateLimitReset=="number"&&(t.rateLimitReset=e.rateLimitReset),typeof e.rateLimitRemaining=="number"&&(t.rateLimitRemaining=e.rateLimitRemaining),t}a(Gue,"getRateLimitFields");function s2(r,e,t){Object.defineProperty(r,e,{value:t,enumerable:!1,writable:!0,configurable:!0})}a(s2,"defineHidden");function QB(r,e){return e.retryAfterMs!==void 0&&s2(r,"retryAfterMs",e.retryAfterMs),e.rateLimitReset!==void 0&&s2(r,"rateLimitReset",e.rateLimitReset),e.rateLimitRemaining!==void 0&&s2(r,"rateLimitRemaining",e.rateLimitRemaining),r}a(QB,"attachRateLimitFields");function que(r,e,t=Date.now){return QB(r,YB(e,t))}a(que,"enrichRateLimitError")});var xm=T(ys=>{"use strict";Object.defineProperty(ys,"__esModule",{value:!0});ys.DEFAULT_MAX_RETRIES=ys.MIN_RATE_LIMIT_WAIT_MS=void 0;ys.isRateLimitError=XB;ys.createRateLimitBudget=Kue;ys.withRateLimitBackoff=Yue;var Wue=a2();function XB(r){let e=r instanceof Error?r.message:String(r);return/HTTP 429/.test(e)?!0:/HTTP 403/.test(e)&&(/rate limit/i.test(e)||/abuse detection/i.test(e))}a(XB,"isRateLimitError");ys.MIN_RATE_LIMIT_WAIT_MS=6e4;ys.DEFAULT_MAX_RETRIES=6;function Kue(r){let e=!(r>0),t=e?Number.POSITIVE_INFINITY:r;return{reset(){t=e?Number.POSITIVE_INFINITY:r},tryReserve(n){return n<=0?!0:n<=t?(t-=n,!0):!1}}}a(Kue,"createRateLimitBudget");var zue=a(r=>new Promise(e=>setTimeout(e,r)),"defaultSleep");function Hue(r,e,t,n,i,s){let o=(0,Wue.getRateLimitFields)(r);if(typeof o.retryAfterMs=="number"&&o.retryAfterMs>=0)return o.retryAfterMs;if(o.rateLimitRemaining===0&&typeof o.rateLimitReset=="number"){let l=o.rateLimitReset*1e3-s();if(l>0)return l}let c=t*2**e*(1+i());return Math.max(n,c)}a(Hue,"computeRateLimitDelay");function Yue(r,e={}){let t=e.maxRetries??ys.DEFAULT_MAX_RETRIES,n=e.baseDelayMs??1e3,i=Math.max(ys.MIN_RATE_LIMIT_WAIT_MS,e.minRateLimitWaitMs??ys.MIN_RATE_LIMIT_WAIT_MS),s=e.budget,o=e.sleep??zue,c=e.random??Math.random,l=e.now??(()=>Date.now());return async u=>{let f=0;for(;;)try{return await r(u)}catch(d){if(!XB(d)||f>=t)throw d;let p=Hue(d,f,n,i,c,l);if(s!==void 0&&!s.tryReserve(p))throw d;f++,await o(p)}}}a(Yue,"withRateLimitBackoff")});var JB=T(Zs=>{"use strict";Object.defineProperty(Zs,"__esModule",{value:!0});Zs.HISTORY_BASE_MIN_SHARE=Zs.HISTORY_BASE_REQUEST_BUDGET=Zs.HISTORY_BASE_MAX_VERSIONS=void 0;Zs.recoverBaseFromHistory=Zue;var Que=qc(),c2=Au(),Xue=xm();Zs.HISTORY_BASE_MAX_VERSIONS=30;Zs.HISTORY_BASE_REQUEST_BUDGET=60;Zs.HISTORY_BASE_MIN_SHARE=4;function Jue(r){let e=r instanceof Error?r.message:String(r);return/→ HTTP 404\b/.test(e)}a(Jue,"isNotFoundError");function l2(r){if((0,Xue.isRateLimitError)(r))return{kind:"aborted",reason:"rate-limit"};if(!Jue(r))return{kind:"aborted",reason:"request-failure"}}a(l2,"abortUnlessNotFound");async function Zue(r){let e=a(()=>r.budget.remaining<=0?!1:(r.budget.remaining-=1,!0),"spend"),t=await(0,Que.gitBlobSha)(r.local,r.sha1);if(!e())return{kind:"budget-exhausted"};try{await(0,c2.getBlobText)(r.transport,r.owner,r.repo,t,r.baseURL)}catch(i){return l2(i)??{kind:"not-found"}}if(!e())return{kind:"budget-exhausted"};let n;try{n=await(0,c2.listPathCommitShas)(r.transport,r.owner,r.repo,r.path,r.head,Zs.HISTORY_BASE_MAX_VERSIONS,r.baseURL)}catch(i){return l2(i)??{kind:"not-found"}}for(let i of n.slice(0,Zs.HISTORY_BASE_MAX_VERSIONS)){if(!e())return{kind:"budget-exhausted"};let s;try{s=await(0,c2.getPathBlobShaAt)(r.transport,r.owner,r.repo,r.path,i,r.baseURL)}catch(o){let c=l2(o);if(c!==void 0)return c;continue}if(s===t)return{kind:"recovered",base:r.local,commitSha:i}}return{kind:"not-found"}}a(Zue,"recoverBaseFromHistory")});var ew=T(Hc=>{"use strict";Object.defineProperty(Hc,"__esModule",{value:!0});Hc.LocalOutboxStore=Hc.OUTBOX_REMOTE_ABSENT=Hc.OUTBOX_STORE_FILENAME=void 0;Hc.OUTBOX_STORE_FILENAME="exosync-outbox.local.json";Hc.OUTBOX_REMOTE_ABSENT=" absent";function u2(r,e){return`${r}\0${e}`}a(u2,"outboxKey");function ZB(r){if(r===null||typeof r!="object")return!1;let e=r;return typeof e.repoKey=="string"&&typeof e.path=="string"&&typeof e.chosenContent=="string"&&typeof e.baseRemoteSha=="string"}a(ZB,"isEntry");var f2=class{static{a(this,"LocalOutboxStore")}constructor(e){this.writeChain=Promise.resolve(),this.io=e.io,this.now=e.now??(()=>new Date().toISOString())}async enqueue(e){await this.mutate(t=>{t.entries[u2(e.repoKey,e.path)]={version:1,...e,resolvedAt:e.resolvedAt.length>0?e.resolvedAt:this.now()}})}async remove(e,t){await this.mutate(n=>{delete n.entries[u2(e,t)]})}async list(){let e=await this.read();return Object.values(e.entries).filter(ZB)}async listForRepo(e){return(await this.list()).filter(t=>t.repoKey===e)}async has(e,t){let i=(await this.read()).entries[u2(e,t)];return i!==void 0&&ZB(i)}async mutate(e){let t=this.writeChain.then(async()=>{let n=await this.read();e(n),await this.io.writeAtomic(JSON.stringify(n,null,2))});return this.writeChain=t.catch(()=>{}),t}async read(){try{let e=await this.io.read();if(e===null)return{version:1,entries:{}};let t=JSON.parse(e);if(t===null||typeof t!="object")return{version:1,entries:{}};let n=t.entries;return n===null||typeof n!="object"?{version:1,entries:{}}:{version:1,entries:{...n}}}catch{return{version:1,entries:{}}}}};Hc.LocalOutboxStore=f2});var Pm=T(fr=>{"use strict";Object.defineProperty(fr,"__esModule",{value:!0});fr.SpaceSpecAccumulator=fr.PullOnlyListError=fr.PULL_ONLY_LIST_PATH=fr.SYNC_BRANCH=fr.ASSET_SPACE_CLASS_UID=void 0;fr.isAssetSpaceFrontmatter=rU;fr.isFileSpaceFrontmatter=nU;fr.readSpaceSource=iU;fr.parseStrictGitHubRepoURL=sU;fr.classifySpaceDeclaration=nfe;fr.parsePullOnlyList=oU;fr.applyPullOnlyListText=sfe;var efe=vb(),tfe=Eb();fr.ASSET_SPACE_CLASS_UID="73bd00e4-ccc0-4f3f-b20d-c4388c4588fb";fr.SYNC_BRANCH="main";var eU=/\[\[([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})(?:\|[^\]]*)?\]\]/gi;function tU(r,e){let t=r.exo__Instance_class,n=Array.isArray(t)?t:[t];for(let i of n){if(typeof i!="string")continue;eU.lastIndex=0;let s;for(;(s=eU.exec(i))!==null;)if(s[1].toLowerCase()===e)return!0}return!1}a(tU,"instanceClassHasUid");function rU(r){return tU(r,fr.ASSET_SPACE_CLASS_UID)}a(rU,"isAssetSpaceFrontmatter");function nU(r){return tU(r,efe.FILE_SPACE_CLASS_UID)}a(nU,"isFileSpaceFrontmatter");function iU(r){let e=r.exo__AssetSpace_source;if(typeof e=="string"&&e.length>0)return e;let t=r.exo__AssetSpace_git;return typeof t=="string"&&t.length>0?t:null}a(iU,"readSpaceSource");var rfe=/^https:\/\/github\.com\/[a-zA-Z0-9_-]+\/[a-zA-Z0-9_.-]+$/;function sU(r){if(typeof r!="string"||r.length===0||r.length>256||!rfe.test(r))return null;let e=r.slice(19),[t,n,...i]=e.split("/");if(i.length>0||t===".."||n===".."||n.startsWith("."))return null;let s=n.replace(/\.git$/,"");return s.length===0?null:{owner:t,repo:s}}a(sU,"parseStrictGitHubRepoURL");function nfe(r,e){let t=rU(r),n=nU(r);if(!t&&!n)return{kind:"not-space"};let i;t&&n&&(i=`declaration at ${e} carries BOTH exo__AssetSpace and exo__FileSpace classes (disjoint) \u2014 treating as AssetSpace (conservative)`);let s=t?"asset":"file",o=iU(r);if(o===null)return s==="file"?{kind:"skip",warning:`skipped FileSpace at ${e}: no exo__AssetSpace_source/_git \u2014 mount path underivable`}:{kind:"skip"};let c=o.replace(/\.git$/i,""),l=sU(c);if(l===null)return{kind:"skip",warning:`skipped AssetSpace at ${e}: source is not a plain https://github.com/<owner>/<repo> URL`};let u=(0,tfe.derivePath)(c);if(u===null)return{kind:"skip",warning:`skipped AssetSpace at ${e}: cannot derive mount path from source`};let f=`${l.owner}/${l.repo}#${fr.SYNC_BRANCH}`,d=r.exo__Asset_uid,p=typeof d=="string"&&d.trim().length>0?d.trim():void 0;return{kind:"candidate",candidate:{spec:{owner:l.owner,repo:l.repo,branch:fr.SYNC_BRANCH,repoKey:f,localPath:u,...s==="file"?{spaceKind:s}:{}},spaceKind:s,...p!==void 0?{asUid:p}:{}},...i!==void 0?{warning:i}:{}}}a(nfe,"classifySpaceDeclaration");fr.PULL_ONLY_LIST_PATH=".exocortex/exosync-pull-only";var ife=/^([A-Za-z0-9_-]+)\/([A-Za-z0-9_.-]+)$/,tw=class extends Error{static{a(this,"PullOnlyListError")}constructor(e,t){super(`invalid pull-only list ${fr.PULL_ONLY_LIST_PATH} line ${e}: expected "owner/repo" (blank lines and # comments are ignored), got ${JSON.stringify(t)}`),this.name="PullOnlyListError",this.lineNumber=e,this.lineContent=t}};fr.PullOnlyListError=tw;function oU(r){let e=[],t=r.split(`
343
- `);for(let n=0;n<t.length;n++){let i=t[n].replace(/\r$/,""),s=i.trim();if(s.length===0||s.startsWith("#"))continue;let o=ife.exec(s),c=o===null?"":o[2].replace(/\.git$/i,"");if(o===null||c.length===0||c.startsWith("."))throw new tw(n+1,i);e.push({key:`${o[1]}/${c}`.toLowerCase(),line:n+1})}return e}a(oU,"parsePullOnlyList");function sfe(r,e){if(e===null)return[];let t=oU(e),n=[],i=new Map;for(let s of r){let o=`${s.owner}/${s.repo}`.toLowerCase(),c=i.get(o);c===void 0?i.set(o,[s]):c.push(s)}for(let s of t){let o=i.get(s.key);if(o===void 0){n.push(`pull-only list ${fr.PULL_ONLY_LIST_PATH} line ${s.line} names ${s.key}, which is not a materialized sync unit on this device \u2014 nothing to protect`);continue}for(let c of o)c.pullOnly=!0}return n}a(sfe,"applyPullOnlyListText");var d2=class{static{a(this,"SpaceSpecAccumulator")}constructor(){this.specs=[],this.warnings=[],this.asUidByRepoKey=new Map,this.seen=new Set,this.kindByRepoKey=new Map}offer(e){let{spec:t,spaceKind:n}=e;if(this.seen.has(t.repoKey)){let i=this.kindByRepoKey.get(t.repoKey);if(i!==void 0&&i!==n&&(this.warnings.push(`repo ${t.repoKey} is declared as BOTH AssetSpace and FileSpace by different assets \u2014 treating as AssetSpace (deterministic, conservative); fix the vault (disjoint subtypes)`),i==="file")){this.kindByRepoKey.set(t.repoKey,"asset");let s=this.specs.find(o=>o.repoKey===t.repoKey);s!==void 0&&delete s.spaceKind}return null}return this.seen.add(t.repoKey),this.kindByRepoKey.set(t.repoKey,n),t}commit(e){this.specs.push(e.spec),e.asUid!==void 0&&this.asUidByRepoKey.set(e.spec.repoKey,e.asUid)}};fr.SpaceSpecAccumulator=d2});var rw=T(Ud=>{"use strict";Object.defineProperty(Ud,"__esModule",{value:!0});Ud.REF_NOT_FOUND_HINT=void 0;Ud.isAuthError=ofe;Ud.isRefNotFoundError=afe;var aU=Pm();function ofe(r){let e=r instanceof Error?r.message:String(r);return/HTTP 401/.test(e)?!0:/HTTP 403/.test(e)&&!/rate limit/i.test(e)&&!/abuse detection/i.test(e)}a(ofe,"isAuthError");function afe(r){let e=r instanceof Error?r.message:String(r);return/\/git\/refs\/heads\/\S* → HTTP 404\b/.test(e)}a(afe,"isRefNotFoundError");Ud.REF_NOT_FOUND_HINT=`GitHub answers 404 for a private repo outside a fine-grained PAT's repository allowlist (existence-hiding), for a deleted/renamed repo, and for a visible repo that has no \`${aU.SYNC_BRANCH}\` branch (ExoSync syncs \`${aU.SYNC_BRANCH}\` only) \u2014 check the token's repository allowlist first (R8)`});var p2=T(nw=>{"use strict";Object.defineProperty(nw,"__esModule",{value:!0});nw.scanForSecrets=cfe;nw.redactSecrets=lfe;var cU=[{kind:"github-token",re:/gh[pousr]_[A-Za-z0-9_]{36,}/},{kind:"github-fine-grained-token",re:/github_pat_[A-Za-z0-9_]{22,}_[A-Za-z0-9_]{59,}/},{kind:"private-key",re:/-----BEGIN [A-Z ]*PRIVATE KEY-----/}];function cfe(r){let e=[];for(let[t,n]of r)for(let{kind:i,re:s}of cU)s.test(n)&&e.push({path:t,kind:i});return e}a(cfe,"scanForSecrets");function lfe(r){let e=r;for(let{kind:t,re:n}of cU)e=e.replace(new RegExp(n.source,"g"),`[REDACTED:${t}]`);return e}a(lfe,"redactSecrets")});var iw=T(Ha=>{"use strict";Object.defineProperty(Ha,"__esModule",{value:!0});Ha.DEFAULT_MAX_FILE_BYTES=Ha.InMemoryQuarantineStore=void 0;Ha.contentEquals=ufe;Ha.isSyncablePath=ffe;Ha.isFileSpaceSyncablePath=dfe;function ufe(r,e){if(r===void 0||e===void 0||typeof r=="string"&&typeof e=="string")return r===e;if(typeof r=="string"||typeof e=="string"||r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0}a(ufe,"contentEquals");var h2=class{static{a(this,"InMemoryQuarantineStore")}constructor(){this.entries=[]}async quarantine(e){this.entries.push(e)}};Ha.InMemoryQuarantineStore=h2;function ffe(r){return r.endsWith(".md")&&!r.includes(".local.")&&!r.includes(".conflict.")}a(ffe,"isSyncablePath");function dfe(r){return!r.includes(".local.")&&!r.includes(".conflict.")}a(dfe,"isFileSpaceSyncablePath");Ha.DEFAULT_MAX_FILE_BYTES=30*1024*1024});var _U=T(xn=>{"use strict";Object.defineProperty(xn,"__esModule",{value:!0});xn.SyncEngine=xn.DEFAULT_LOCAL_MANIFEST_REHASH_MS=xn.DEFAULT_MAX_TOTAL_RATELIMIT_WAIT_MS=xn.DEFAULT_MAX_PUSH_RETRIES=void 0;xn.syncProgressPhaseText=hfe;xn.isNonFastForwardError=yU;xn.orderChildrenFirst=Efe;var lU=YS(),uU=i2(),dt=Au(),eo=Rm(),pfe=Zl(),Yc=qc(),m2=JB(),g2=ew(),y2=rw(),fU=p2(),dU=Pm(),pU=xm(),to=iw();xn.DEFAULT_MAX_PUSH_RETRIES=3;xn.DEFAULT_MAX_TOTAL_RATELIMIT_WAIT_MS=3e5;xn.DEFAULT_LOCAL_MANIFEST_REHASH_MS=720*60*1e3;function hfe(r){switch(r.phase){case"reading-local":return r.detail!==void 0?`reading local files ${r.detail.done}\u2026`:"reading local files\u2026";case"detecting":return"detecting changes\u2026";case"pulling-remote":return"pulling remote tree\u2026";case"fetching-blobs":return r.detail!==void 0?`fetching remote files ${r.detail.done}/${r.detail.total}\u2026`:"fetching remote files\u2026";case"writing-files":return r.detail!==void 0?`writing files ${r.detail.done}\u2026`:"writing files\u2026";case"merging":return"merge layer firing\u2026";default:return r.phase}}a(hfe,"syncProgressPhaseText");var hU=25,mfe=10,gfe=6,yfe=500,_fe=25;function bfe(r){try{return new TextDecoder("utf-8",{fatal:!0}).decode(r)}catch{return null}}a(bfe,"decodeUtf8Strict");function Sfe(r){return typeof r=="string"?r:{base64:(0,pfe.bytesToBase64)(r)}}a(Sfe,"toCommitContent");async function _2(r,e){if(r.readBinary===void 0)throw new Error("LocalFilesPort.readBinary is required for file-mode sync (Phase C)");return r.readBinary(e)}a(_2,"readBinaryStrict");async function mU(r,e,t){if(r.writeBinary===void 0)throw new Error("LocalFilesPort.writeBinary is required for file-mode sync (Phase C)");return r.writeBinary(e,t)}a(mU,"writeBinaryStrict");function b2(r){return r.length===0||r.startsWith("/")||r.includes("\\")?!1:r.split("/").every(e=>e.length>0&&e!=="."&&e!=="..")}a(b2,"isSafeRepoRelativePath");function wfe(r){return r.length===0||r.startsWith("/")?!1:r.split("/").every(e=>e.length>0&&e!=="."&&e!=="..")}a(wfe,"isTraversalFreeLocalPath");function yU(r){let e=r instanceof Error?r.message:String(r);return/HTTP 422/.test(e)&&/git\/refs/.test(e)||/ref update mismatch/.test(e)||/HTTP 422/.test(e)&&/git\/trees/.test(e)&&/BadObjectState/.test(e)}a(yU,"isNonFastForwardError");function Efe(r){let e=a(t=>t.split("/").filter(n=>n.length>0).length,"depth");return[...r].sort((t,n)=>e(n.localPath)-e(t.localPath))}a(Efe,"orderChildrenFirst");function gU(r,e){let t=new Map(r.map(o=>[o.path,o])),n=new Set,i=[];for(let o of e){n.add(o.path);let c=t.get(o.path);(c===void 0||c.blobSha!==o.blobSha)&&i.push(o)}let s=r.filter(o=>!n.has(o.path));return{changed:i,deleted:s}}a(gU,"diffTrees");function vfe(r){let e=r instanceof Error?r.message:String(r);return/→ HTTP (?:404|422)\b/.test(e)}a(vfe,"isCommitUnknownError");function Ya(r){return r instanceof Error?r.message:String(r)}a(Ya,"errMsg");function Tfe(r,e,t){if(t.size===0)return r;let n=new Map(e.files.map(o=>[o.path,o])),i=new Set(r.map(o=>o.path)),s=[];for(let o of r){if(!t.has(o.path)){s.push(o);continue}let c=n.get(o.path);c!==void 0&&s.push(c)}for(let o of t){if(i.has(o))continue;let c=n.get(o);c!==void 0&&s.push(c)}return s}a(Tfe,"applyWatermarkPins");var S2={mergedFiles:new Map,mergedWrites:[],quarantineEntries:[],resolvedQuarantineEntries:[],mergedCount:0,mergedPaths:[],warnings:[]};function w2(r){return new Map(r.map(e=>[e.path,e.blobSha]))}a(w2,"treeByPath");function sw(r){return[...r.quarantineEntries.map(e=>e.path),...r.resolvedQuarantineEntries.map(e=>e.path)]}a(sw,"quarantinedPathsOf");var E2=class{static{a(this,"SyncEngine")}constructor(e){this.activeTimer=null,this.activeLocalIoProgress=null,this.opInProgress=!1,this.deps=e,this.now=e.now??(()=>Date.now()),this.rateLimitBudget=(0,pU.createRateLimitBudget)(e.backoff?.maxTotalRateLimitWaitMs??xn.DEFAULT_MAX_TOTAL_RATELIMIT_WAIT_MS),this.transport=this.instrumentTransport((0,pU.withRateLimitBackoff)(e.transport,{...e.backoff,budget:this.rateLimitBudget,now:this.now})),this.probeTransport=this.instrumentTransport(e.transport),this.sha1=this.instrumentSha1(e.sha1)}instrumentTransport(e){return async t=>{let n=this.activeTimer;return n===null?e(t):(n.bumpRest(),n.time((0,uU.classifyRestPhase)(t),async()=>{let i=await e(t);return n.observeQuota(i.headers),i}))}}instrumentSha1(e){return t=>{let n=this.activeTimer;return n===null?e(t):(n.bumpHashed(),n.time("hash",()=>e(t)))}}instrumentLocalFiles(e){let t=a((c,l)=>{let u=this.activeTimer;return u===null?l():u.time(c,l)},"timed"),n={list:a(()=>t("localList",()=>e.list()),"list"),read:a(c=>(this.activeTimer?.bumpRead(),this.bumpReadProgress(),t("localRead",()=>e.read(c))),"read"),write:a((c,l)=>t("localWrite",()=>(this.activeTimer?.bumpWritten(),this.bumpWriteProgress(),e.write(c,l))),"write"),delete:a(c=>e.delete(c),"delete")},i=e.readBinary?.bind(e);i!==void 0&&(n.readBinary=c=>(this.activeTimer?.bumpRead(),this.bumpReadProgress(),t("localRead",()=>i(c))));let s=e.writeBinary?.bind(e);s!==void 0&&(n.writeBinary=(c,l)=>t("localWrite",()=>(this.activeTimer?.bumpWritten(),this.bumpWriteProgress(),s(c,l))));let o=e.stat?.bind(e);return o!==void 0&&(n.stat=c=>t("localList",()=>o(c))),n}busyResult(e){return{repoKey:e.repoKey,status:"busy",pulledCount:0,pushedCount:0,mergedCount:0,quarantinedCount:0,warnings:[],deferredDeletes:[],detail:"another sync operation is in progress (D11 guard) \u2014 retry after it finishes"}}modeOps(e){let t=e.spaceKind==="file",n=t?to.isFileSpaceSyncablePath:to.isSyncablePath,i=this.deps.maxFileBytes??to.DEFAULT_MAX_FILE_BYTES;return{fileMode:t,syncable:n,treeFilter:a(s=>n(s.path)&&(!t||s.size===void 0||s.size<=i),"treeFilter")}}async buildFileModeFirstSyncBase(e,t,n,i){let s=await(0,dt.getHeadSha)(this.transport,e.owner,e.repo,e.branch,this.deps.baseURL),o=await(0,dt.getCommitInfo)(this.transport,e.owner,e.repo,s,this.deps.baseURL),c=(await(0,dt.getTree)(this.transport,e.owner,e.repo,o.treeSha,this.deps.baseURL)).filter(n.treeFilter),l=[];for(let u of c){let f=t.get(u.path);f!==void 0&&await(0,Yc.gitBlobSha)(f,this.sha1)===u.blobSha&&l.push({path:u.path,blobSha:u.blobSha})}return i.push(`first-sync (file mode): synthetic base from ${l.length} already-identical file(s) at head ${s} \u2014 divergence resolves through the remote-wins layer (D22)`),{lastSyncedSha:s,rootTreeSha:o.treeSha,files:l,spaceKind:"file"}}async syncAll(e,t="sync",n){if(this.opInProgress)return e.map(i=>this.busyResult(i));this.opInProgress=!0,this.rateLimitBudget.reset();try{let i=[];for(let s of e)i.push(await this.syncLocked(s,t,n));return i}finally{this.opInProgress=!1}}async sync(e,t="sync",n){if(this.opInProgress)return this.busyResult(e);this.opInProgress=!0,this.rateLimitBudget.reset();try{return await this.syncLocked(e,t,n)}finally{this.opInProgress=!1}}emitProgress(e,t,n,i){if(e!==void 0)try{e(i===void 0?{repoKey:t,phase:n}:{repoKey:t,phase:n,detail:i})}catch{}}bumpReadProgress(){let e=this.activeLocalIoProgress;e!==null&&(e.reads+=1,e.reads%yfe===0&&this.emitProgress(e.emit,e.repoKey,"reading-local",{done:e.reads}))}bumpWriteProgress(){let e=this.activeLocalIoProgress;e!==null&&(e.writes+=1,e.writes%_fe===0&&this.emitProgress(e.emit,e.repoKey,"writing-files",{done:e.writes}))}async syncLocked(e,t="sync",n){let i=new uU.SyncPhaseTimer(this.now),s=this.activeTimer;this.activeTimer=i;let o=this.activeLocalIoProgress;this.activeLocalIoProgress=n!==void 0?{emit:n,repoKey:e.repoKey,reads:0,writes:0}:null;let c=[],l=[],u=0,f=0,d=[],p=a((h,g={})=>({repoKey:e.repoKey,status:h,pulledCount:0,pushedCount:0,mergedCount:0,quarantinedCount:0,warnings:c,deferredDeletes:l,...u>0?{outboxPushedCount:u}:{},...f>0?{outboxReconflictedCount:f}:{},timings:i.snapshot(),...e.pullOnly===!0?{pullOnly:!0}:{},...g}),"result");try{if(e.pullOnly===!0&&t==="push")return p("skipped-pull-only",{detail:`pull-only repo (${dU.PULL_ONLY_LIST_PATH}): push skipped \u2014 local changes are never sent; pull mirrors the remote head`});let h=await this.deps.materializationCheck.check(e);if(!h.fullyMaterialized)return c.push(`skipped: repo not fully materialized${h.reason?` (${h.reason})`:""} \u2014 deletes NOT inferred (D19)`),p("skipped-not-materialized");let g=this.modeOps(e),m=this.instrumentLocalFiles(this.deps.localFilesFor(e));if(g.fileMode&&(m.readBinary===void 0||m.writeBinary===void 0))return p("error",{detail:"file-mode repo requires a LocalFilesPort with readBinary/writeBinary \u2014 refusing to sync through the text-only port (binary would corrupt)"});if(e.pullOnly===!0)return await this.mirrorPullOnly(e,t,m,g,c,p,n);if(g.fileMode&&this.deps.quarantine===void 0)return p("error",{detail:"file-mode repo requires a quarantine sink (D18 remote-wins preserves losing local bytes there) \u2014 configure the quarantine repo before syncing FileSpaces"});let _=this.deps.maxFileBytes??to.DEFAULT_MAX_FILE_BYTES;if(t!=="pull"&&this.deps.outbox!==void 0){let q=await this.flushOutbox(e,c);u=q.pushed,f=q.reconflicted}let b=await this.deps.watermarkStore.get(e.repoKey);if(b?.spaceKind==="file"&&!g.fileMode)return p("error",{detail:"watermark was written by a FILE-mode sync but the spec now resolves to asset mode \u2014 refusing (fix the conflicting Space declarations, or clear the watermark to restart)"});b!==null&&g.fileMode&&b.spaceKind!=="file"&&(c.push("watermark was written by an ASSET-mode sync \u2014 rebuilding the base through the file-mode first-sync layer (kind flip)"),b=null);let w=this.deps.localManifestStore!==void 0?m.stat?.bind(m):void 0,v=w!==void 0&&b!==null&&!g.fileMode,E=v&&this.deps.localManifestStore!==void 0?await this.deps.localManifestStore.get(e.repoKey):null,S=this.deps.localManifestFullRehashMs??xn.DEFAULT_LOCAL_MANIFEST_REHASH_MS,R=v&&(E===null||this.now()-E.lastFullRehashMs>=S),C=new Map,P=new Set,D=new Map,F=new Map,$=new Map,H=!1,ee=new Map;if(v&&b!==null)for(let q of b.files)ee.set(q.path,q.blobSha);for(let q of(await m.list()).filter(g.syncable)){if(g.fileMode){let de=await _2(m,q);if(de.byteLength>_){P.add(q),c.push(`skipped oversized file ${q} (${de.byteLength} bytes > ${_} cap) \u2014 excluded from sync symmetrically (Phase C size cap)`);continue}C.set(q,de);continue}if(!v||w===void 0){C.set(q,await m.read(q));continue}let N=await w(q),J=!R&&N!==null?E?.files[q]:void 0;if(N!==null&&J!==void 0&&J.mtimeMs===N.mtimeMs&&J.size===N.size&&J.blobSha===ee.get(q)){D.set(q,{blobSha:J.blobSha,...J.uid!==void 0?{uid:J.uid}:{}}),F.set(q,J.blobSha),$.set(q,N);continue}H=!0,C.set(q,await m.read(q)),N!==null&&$.set(q,N)}let G=!1;if(b===null)if(g.fileMode)G=!0,b=await this.buildFileModeFirstSyncBase(e,C,g,c);else{let q=await this.bootstrapWatermark(e,C,c,p);if(q.kind==="settled")return q.outcome;G=!0,b=q.base}let j=b;g.fileMode&&P.size>0&&(b={...b,files:b.files.filter(q=>!P.has(q.path))});let z,ie;v&&!R?(z=await(0,dt.getHeadSha)(this.transport,e.owner,e.repo,e.branch,this.deps.baseURL),ie=z===b.lastSyncedSha?b.rootTreeSha:await this.resolveBaseTreeSha(e,b,{headReachable:!0})):ie=await this.resolveBaseTreeSha(e,b),this.emitProgress(n,e.repoKey,"detecting");let O=await(0,eo.detectChanges)({localFiles:C,...v?{cachedEntries:D}:{},watermark:b,actualBaseTreeSha:ie,sha1:this.sha1});if(O.kind==="full-conflict")return p("full-conflict",{detail:`${O.reason}${O.detail?`: ${O.detail}`:""} \u2014 divergence must go through merge/quarantine (A2/A3), not overwrite`});if(c.push(...O.warnings),v&&this.deps.localManifestStore!==void 0){let q={};for(let[N,J]of C){let de=$.get(N),Te=O.diskBlobShas.get(N);if(de===void 0||Te===void 0)continue;let Fe=typeof J=="string"?(0,eo.extractAssetUid)(J):void 0;q[N]={mtimeMs:de.mtimeMs,size:de.size,blobSha:Te,...Fe!==void 0?{uid:Fe}:{}}}for(let[N,J]of D){let de=$.get(N);de!==void 0&&(q[N]={mtimeMs:de.mtimeMs,size:de.size,blobSha:J.blobSha,...J.uid!==void 0?{uid:J.uid}:{}})}if(E!==null&&Object.keys(E.files).some(N=>!(N in q))&&(H=!0),H||R||E===null){let N={version:1,files:q,lastFullRehashMs:R||E===null?this.now():E.lastFullRehashMs};await this.deps.localManifestStore.set(e.repoKey,N)}}let U=this.pinLocalChanges(O,C,c,l,t);d=[...U.pushDeletionsAll.keys()];let oe=await this.runPushLoop(e,b,U,C,c,g,G,P,t,n,z);if(d=[],oe.kind!=="done"&&U.pushDeletionsAll.size>0&&l.push(...U.pushDeletionsAll.keys()),oe.kind==="conflict")return p("conflict",{detail:oe.detail});if(oe.kind==="retry-exhausted"){c.push(...oe.merge.warnings);let q=await this.buildTerminalQuarantineEntries(e,b,oe.pushFiles,oe.merge.quarantineEntries,C),N=[...oe.merge.quarantineEntries,...oe.merge.resolvedQuarantineEntries,...q];return await this.flushQuarantine(N,c),p("retry-exhausted",{detail:oe.detail,quarantinedCount:N.length,...N.length>0?{quarantinedPaths:N.map(J=>J.path)}:{}})}let{examinedHead:we,pushedSha:X,applyWrites:te,applyDeletes:re,pushFiles:Z}=oe,le=oe.merge;c.push(...le.warnings),c.push(...oe.deferredWarnings),l.push(...oe.withheldDeletions);let he=oe.deferredPaths.size>0?{deferredPaths:[...oe.deferredPaths]}:{},B=oe.pushedDeletions.length>0?{pushedDeletes:oe.pushedDeletions}:{},ue=await this.flushQuarantine([...le.quarantineEntries,...le.resolvedQuarantineEntries],c);oe.secretQuarantineEntries.length>0&&await this.flushQuarantine(oe.secretQuarantineEntries,c);let ne=new Set;if(!ue&&le.resolvedQuarantineEntries.length>0){for(let q of le.resolvedQuarantineEntries)ne.add(q.path);c.push(`quarantine flush failed \u2014 remote-wins apply withheld for ${ne.size} path(s); local files untouched, conflict re-derives next sync (D18 durability gate)`)}if(X===void 0&&we===b.lastSyncedSha&&te.length===0&&re.length===0&&le.mergedWrites.length===0&&le.quarantineEntries.length===0&&le.resolvedQuarantineEntries.length===0&&(b.pinnedPaths?.length??0)===0&&oe.alreadyInHead.length===0&&oe.deferredPaths.size===0&&!G)return p("synced");let ve=X??we,ge=await(0,dt.getCommitInfo)(this.transport,e.owner,e.repo,ve,this.deps.baseURL);if(X!==void 0&&ge.parents[0]!==we)return await this.checkRaceWindow(e,b,we,ge.parents[0],Z,new Set(oe.pushedDeletions),c,g),c.push(`race-window: watermark NOT advanced (pushed commit's parent ${ge.parents[0]} != examined head ${we}) \u2014 next sync reconciles the concurrent change`),p("synced",{pushedSha:X,pushedCount:Z.size,mergedCount:le.mergedCount,quarantinedCount:le.quarantineEntries.length+le.resolvedQuarantineEntries.length,...le.mergedPaths.length>0?{mergedPaths:le.mergedPaths}:{},...sw(le).length>0?{quarantinedPaths:sw(le)}:{},...he,...B});let{pulledCount:Ce,pinnedPaths:xe,pulledPaths:me}=await this.applyRemoteChanges(m,C,[...te,...le.mergedWrites].filter(q=>!ne.has(q.path)),re.filter(q=>!ne.has(q.path)),c,F);for(let q of le.quarantineEntries)xe.add(q.path);for(let q of oe.deferredPaths)xe.add(q);for(let q of ne)xe.add(q);if(g.fileMode){for(let q of P)xe.add(q);for(let q of oe.remoteOversized)xe.add(q)}return await this.advanceWatermark(e,ve,ge.treeSha,C,[...te,...le.mergedWrites,...oe.deferredRemoteChanges],j,xe,O.diskBlobShas,g,P),await this.resolveClearedPins(e,j,xe,c,new Set(le.resolvedQuarantineEntries.map(q=>q.path))),p("synced",{pushedSha:X,pulledCount:Ce,pushedCount:Z.size,mergedCount:le.mergedCount,quarantinedCount:le.quarantineEntries.length+le.resolvedQuarantineEntries.length,...le.mergedPaths.length>0?{mergedPaths:le.mergedPaths}:{},...me.length>0?{pulledPaths:me}:{},...sw(le).length>0?{quarantinedPaths:sw(le)}:{},...he,...B})}catch(h){let g=this.deps.redact??(m=>m);if(d.length>0&&l.push(...d),(0,y2.isAuthError)(h))return p("auth-required",{detail:g(`authentication failed: ${Ya(h)} \u2014 the PAT is expired, revoked or under-scoped; update it in the per-device secure storage (R8). Never treated as success.`)});if((0,y2.isRefNotFoundError)(h)){let m=g(`${e.owner}/${e.repo}@${e.branch} is not reachable: ${Ya(h)} \u2014 ${y2.REF_NOT_FOUND_HINT}`);return c.push(`sync failed: ${m}`),p("error",{detail:m})}return c.push(`sync failed: ${g(Ya(h))}`),p("error",{detail:g(Ya(h))})}finally{this.activeTimer=s,this.activeLocalIoProgress=o}}async mirrorPullOnly(e,t,n,i,s,o,c){let l=this.deps.maxFileBytes??to.DEFAULT_MAX_FILE_BYTES;this.emitProgress(c,e.repoKey,"pulling-remote");let u=await(0,dt.getHeadSha)(this.transport,e.owner,e.repo,e.branch,this.deps.baseURL),f=await(0,dt.getCommitInfo)(this.transport,e.owner,e.repo,u,this.deps.baseURL),d=(await(0,dt.getTree)(this.transport,e.owner,e.repo,f.treeSha,this.deps.baseURL)).filter(F=>i.syncable(F.path)),p=new Set(d.map(F=>F.path)),h=(await n.list()).filter(i.syncable),g=new Set(h),m=a(F=>F.normalize("NFC"),"nfc"),_=new Map;for(let F of h)_.has(m(F))||_.set(m(F),F);let b=new Set,w=[],v=[],E=[],S=[],R=a(F=>typeof F=="string"?(0,eo.extractAssetUid)(F):void 0,"uidOf"),C=a((F,$,H)=>{let ee=R(H);S.push({path:F,blobSha:$,...ee?{uid:ee}:{}})},"pushEntry");for(let F of d){if(!b2(F.path)){s.push(`unsafe remote path skipped by the pull-only mirror: ${F.path}`);continue}if(i.fileMode&&F.size!==void 0&&F.size>l){s.push(`pull-only mirror skipped oversized remote file ${F.path} (${F.size} bytes > ${l} cap) \u2014 the local copy, if any, is left as is (Phase C size cap)`);continue}let $,H=g.has(F.path)?F.path:_.get(m(F.path));if(H!==void 0&&(b.add(H),$=i.fileMode?await _2(n,H):await n.read(H),await(0,Yc.gitBlobSha)($,this.sha1)===F.blobSha)){C(F.path,F.blobSha,$);continue}let ee;i.fileMode?(ee=await(0,dt.getBlobBytes)(this.transport,e.owner,e.repo,F.blobSha,this.deps.baseURL),await mU(n,F.path,ee)):(ee=await(0,dt.getBlobText)(this.transport,e.owner,e.repo,F.blobSha,this.deps.baseURL),await n.write(F.path,ee)),($===void 0?v:w).push(F.path),C(F.path,F.blobSha,ee)}for(let F of h)if(!(p.has(F)||b.has(F))){if(!wfe(F)){s.push(`unsafe local path left untouched by the pull-only mirror: ${F}`);continue}await n.delete(F),E.push(F)}let P=await this.deps.watermarkStore.get(e.repoKey);if(await this.deps.watermarkStore.set(e.repoKey,{lastSyncedSha:u,rootTreeSha:f.treeSha,files:S,...i.fileMode?{spaceKind:"file"}:{}}),P!==null&&await this.resolveClearedPins(e,P,new Set,s),this.deps.outbox!==void 0){let F=await this.deps.outbox.listForRepo(e.repoKey);for(let $ of F)await this.deps.outbox.remove(e.repoKey,$.path);F.length>0&&s.push(`pull-only repo: dropped ${F.length} queued conflict resolution(s) \u2014 a pull-only repo is never pushed`)}w.sort(),v.sort(),E.sort();let D=[...w,...v,...E];return o("synced",{pulledCount:D.length,...D.length>0?{pulledPaths:D}:{},mirrored:{restored:w,added:v,removed:E},...t==="sync"?{detail:`pull-only repo (${dU.PULL_ONLY_LIST_PATH}): push phase skipped-pull-only \u2014 mirrored to the remote head ${u.slice(0,7)}`}:{}})}async flushQuarantine(e,t){if(e.length===0)return!0;let n=this.deps.redact??(s=>s);for(let s of e)t.push(n(`quarantined ${s.path}: ${s.reason}`));let i=this.deps.quarantine;if(i===void 0)return!1;try{if(i.quarantineAll!==void 0)await i.quarantineAll(e);else for(let s of e)await i.quarantine(s);return!0}catch(s){let o=this.deps.redact??(c=>c);return t.push(`quarantine sink failed: ${o(Ya(s))} \u2014 files untouched on disk; the conflict re-derives next sync (D17 degradation)`),!1}}async flushOutbox(e,t){let n=this.deps.outbox;if(n===void 0)return{pushed:0,reconflicted:0};let i=await n.listForRepo(e.repoKey);if(i.length===0)return{pushed:0,reconflicted:0};let s=this.deps.redact??(g=>g),o,c;try{({head:o,shaByPath:c}=await this.outboxHeadTreeShas(e))}catch(g){return t.push(`outbox flush deferred (${i.length} resolution(s) awaiting push): ${s(Ya(g))}`),{pushed:0,reconflicted:0}}let l=0,u=[];for(let g of i){let m=c.get(g.path)??g2.OUTBOX_REMOTE_ABSENT,_=m===g2.OUTBOX_REMOTE_ABSENT&&g.baseRemoteSha!==g2.OUTBOX_REMOTE_ABSENT?[...c].filter(([b,w])=>b!==g.path&&w===g.baseRemoteSha).map(([b])=>b):[];if(m!==g.baseRemoteSha&&_.length===0){await n.remove(g.repoKey,g.path),l++,t.push(s(`outbox: remote moved for ${g.path} since you resolved it \u2014 NOT pushed; resolve again (your choice is preserved on disk)`));continue}u.push({entry:g,stalePaths:_})}if(u.length===0)return{pushed:0,reconflicted:l};let f=new Map;for(let{entry:g}of u)f.set(g.path,g.chosenContent);let d=new Set;for(let{stalePaths:g}of u)for(let m of g)f.has(m)||d.add(m);let p=[...d];try{await(0,lU.restCreateCommit)(this.transport,{owner:e.owner,repo:e.repo,branch:e.branch,files:f,...p.length>0?{deletions:p}:{},message:p.length>0?`chore(exosync): resolve ${u.length} keep-local conflict(s) (consolidate ${p.length} stale remote path(s))`:`chore(exosync): push ${u.length} resolved conflict(s)`,expectedHeadSha:o,...this.deps.baseURL!==void 0?{baseURL:this.deps.baseURL}:{},...this.deps.redact!==void 0?{redact:this.deps.redact}:{}})}catch(g){return t.push(`outbox: batch push deferred for ${u.length} resolution(s), will retry next sync: ${s(Ya(g))}`),{pushed:0,reconflicted:l}}let h=0;for(let{entry:g,stalePaths:m}of u){let _=m.filter(b=>!f.has(b));await this.snapOutboxWatermark(e,g.path,g.chosenContent,_),await this.deps.quarantine?.markResolved?.(g.repoKey,g.path);for(let b of _)await this.deps.quarantine?.markResolved?.(g.repoKey,b);await n.remove(g.repoKey,g.path),h++,_.length>0&&t.push(`consolidated cross-path conflict for ${g.path} \u2014 removed ${_.length} stale remote copy/copies (recoverable in git history)`)}return h>0&&t.push(`pushed ${h} resolved conflict(s)`),{pushed:h,reconflicted:l}}async outboxHeadTreeShas(e){let t=await(0,dt.getHeadSha)(this.transport,e.owner,e.repo,e.branch,this.deps.baseURL),n=await(0,dt.getCommitInfo)(this.transport,e.owner,e.repo,t,this.deps.baseURL),i=await(0,dt.getTree)(this.transport,e.owner,e.repo,n.treeSha,this.deps.baseURL),s=new Map;for(let o of i)s.set(o.path,o.blobSha);return{head:t,shaByPath:s}}async snapOutboxWatermark(e,t,n,i=[]){let s=await this.deps.watermarkStore.get(e.repoKey);if(s===null)return;let o=new Set([t,...i]),c=(s.pinnedPaths??[]).filter(m=>!o.has(m)),l=await(0,Yc.gitBlobSha)(n,this.sha1),u=(0,eo.extractAssetUid)(n),f={path:t,blobSha:l,...u!==void 0?{uid:u}:{}},d=new Set(i),p=s.files.filter(m=>!d.has(m.path)),h=p.findIndex(m=>m.path===t),g=h>=0?p.map((m,_)=>_===h?f:m):[...p,f];await this.deps.watermarkStore.set(e.repoKey,{...s,files:g,...c.length>0?{pinnedPaths:c}:{pinnedPaths:void 0}})}async buildTerminalQuarantineEntries(e,t,n,i,s){let o=new Set(i.map(u=>u.path)),c=new Map;try{let u=await(0,dt.getHeadSha)(this.transport,e.owner,e.repo,e.branch,this.deps.baseURL),f=(await(0,dt.getTree)(this.transport,e.owner,e.repo,(await(0,dt.getCommitInfo)(this.transport,e.owner,e.repo,u,this.deps.baseURL)).treeSha,this.deps.baseURL)).filter(d=>n.has(d.path));for(let d of f)c.set(d.path,await(0,dt.getBlobText)(this.transport,e.owner,e.repo,d.blobSha,this.deps.baseURL))}catch{}let l=[];for(let[u,f]of n){if(o.has(u))continue;let d=s.get(u),p=d??f,h=d!==void 0&&!(0,to.contentEquals)(d,f),g=typeof p=="string"?(0,eo.extractAssetUid)(p):void 0,m=c.get(u);l.push({repoKey:e.repoKey,path:u,...g!==void 0?{uid:g}:{},reason:`non-fast-forward push failed after ${this.deps.maxPushRetries??xn.DEFAULT_MAX_PUSH_RETRIES} retries (D16) \u2014 a concurrent writer keeps moving ${e.branch}; base recoverable from git history at ${t.lastSyncedSha}${h?"; the contended push payload was a merged proposal (never applied to disk) \u2014 the merge re-derives next sync":""}`,...typeof p=="string"?{localContent:p}:{localContentBytes:p},...m!==void 0?{remoteContent:m}:{}})}return l}async resolveClearedPins(e,t,n,i,s=new Set){let o=this.deps.quarantine;if(o===void 0||o.markResolved===void 0)return;let c=(t.pinnedPaths??[]).filter(l=>!n.has(l)&&!s.has(l));for(let l of c)try{await o.markResolved?.(e.repoKey,l)}catch(u){let f=this.deps.redact??(d=>d);i.push(`quarantine markResolved failed for ${l}: ${f(Ya(u))} \u2014 unresolved-count may overcount until the resolver UI reconciles (CQ4)`)}}async resolveBaseTreeSha(e,t,n={}){try{return(await(0,dt.getCommitInfo)(this.transport,e.owner,e.repo,t.lastSyncedSha,this.deps.baseURL)).treeSha}catch(i){if(!vfe(i))throw i;return n.headReachable===!0||await(0,dt.getHeadSha)(this.transport,e.owner,e.repo,e.branch,this.deps.baseURL),null}}pinLocalChanges(e,t,n,i,s){let o=e.modified.filter(p=>p.basePath!==void 0),c=[...e.added,...e.modified.filter(p=>p.basePath===void 0)],l=new Map;if(s==="pull"){for(let p of o)p.basePath!==void 0&&i.push(p.basePath),n.push(`pull-only: rename (uid ${p.uid??"?"}) ${p.basePath} \u2192 ${p.path} not pushed \u2014 propagates on the next push/Sync (#3473)`);for(let p of e.deleted)i.push(p.path),n.push(`pull-only: delete of ${p.path} not pushed \u2014 propagates on the next push/Sync (#3473)`)}else{for(let p of o)p.basePath!==void 0&&l.set(p.basePath,p.path);for(let p of e.deleted)l.set(p.path,p.path)}let u=[...c,...o,...e.deleted.map(p=>({...p}))],f=new Set(e.deleted.map(p=>p.path)),d=new Map;for(let p of[...c,...s==="pull"?[]:o]){let h=t.get(p.path);h!==void 0&&d.set(p.path,h)}return{localChanges:u,localDeletedPaths:f,pushFilesAll:d,pushDeletionsAll:l,dupUids:e.duplicateUids}}async runPushLoop(e,t,n,i,s,o,c=!1,l=new Set,u="sync",f,d){let{localChanges:p,localDeletedPaths:h,pushFilesAll:g,pushDeletionsAll:m,dupUids:_}=n,b=this.deps.maxPushRetries??xn.DEFAULT_MAX_PUSH_RETRIES,w=0,v="",E,S=[],R=[],C=new Map,P=new Set,D=[],F=S2,$=[],H=new Set,ee=[],G=[],j=new Set,z=[],ie=new Set;for(;;){v=w===0&&d!==void 0&&g.size===0&&m.size===0?d:await(0,dt.getHeadSha)(this.transport,e.owner,e.repo,e.branch,this.deps.baseURL),S=[],R=[],F=S2,$=[],H=new Set,ee=[],G=[];let O,U=new Set,oe=(t.pinnedPaths?.length??0)>0;if(v!==t.lastSyncedSha||oe||c){this.emitProgress(f,e.repoKey,"pulling-remote");let te=await this.collectRemoteChanges(e,t,v,o,l,s,j,f);O=te.headTreeByPath;let re=this.matchLocalVsRemote(p,h,i,te.changes,U,_,te.headTreeByPath);if(re.conflicts.length>0){if(u==="sync"&&this.emitProgress(f,e.repoKey,"merging"),u!=="sync"){for(let Z of re.conflicts){H.add(Z.local.path),Z.local.basePath!==void 0&&H.add(Z.local.basePath);for(let le of Z.remotes)H.add(le.path),le.kind==="change"&&ee.push(le)}G.push(`${u}-only: ${re.conflicts.length} conflict(s) deferred to a full Sync (${re.conflicts.map(Z=>Z.desc).join("; ")}) \u2014 paths pinned, nothing merged`)}else if(o.fileMode)F=this.resolveFileModeConflicts(e,re.conflicts,i,re.applyWrites,re.applyDeletes);else{if(this.deps.mergeLayer===void 0)return{kind:"conflict",detail:`overlapping change on ${re.conflicts[0].desc} \u2014 merge layer (A2/A3) required; nothing pushed, nothing written`};F=await this.resolveMergeConflicts(e,t,re.conflicts,i,v)}if(u==="sync")for(let Z of re.conflicts)for(let le of Z.remotes)le.path!==Z.local.path&&(H.add(le.path),le.kind==="change"&&ee.push(le),G.push(`conflict group ${Z.desc}: remote change at ${le.path} NOT applied \u2014 pinned to re-derive on the next sync (#3477)`))}if(S=re.applyWrites,R=re.applyDeletes,u==="push"&&(S.length>0||R.length>0)){for(let Z of S)H.add(Z.path),ee.push(Z);for(let Z of R)H.add(Z.path);G.push(`push-only: ${S.length+R.length} remote change(s) NOT applied \u2014 pinned to re-derive on the next pull/Sync`),S=[],R=[]}}C=u==="pull"?new Map:new Map([...[...g].filter(([te])=>!U.has(te)),...F.mergedFiles]),P=new Set,D=[];for(let[te,re]of m){if(U.has(re)){D.push(te);continue}C.has(te)||P.add(te)}if((C.size>0||P.size>0)&&O===void 0&&(O=w2(await(0,dt.getTree)(this.transport,e.owner,e.repo,t.rootTreeSha,this.deps.baseURL))),C.size>0&&O!==void 0){for(let[te,re]of C){let Z=O.get(te);Z!==void 0&&Z===await(0,Yc.gitBlobSha)(re,this.sha1)&&(C.delete(te),$.push(te))}$.length>0&&s.push(`phantom push skipped: ${$.length} file(s) already identical in remote HEAD (${$.join(", ")}) \u2014 excluded from the commit (#3475)`)}if(P.size>0&&O!==void 0){for(let te of[...P])O.has(te)||P.delete(te);C.size===0&&P.size>=O.size&&(D.push(...P),G.push(`deletion of ALL ${P.size} remaining file(s) deferred \u2014 GitHub cannot create an empty tree; the deletes re-derive and propagate once the repo has at least one surviving file`),P.clear())}if(C.size===0&&P.size===0)break;let we=new Map;for(let[te,re]of C)if(typeof re=="string")we.set(te,re);else{let Z=bfe(re);Z!==null&&we.set(te,Z)}let X=(0,fU.scanForSecrets)(we);if(X.length>0){let te=new Map;for(let re of X){let Z=te.get(re.path);Z===void 0?te.set(re.path,[re.kind]):Z.includes(re.kind)||Z.push(re.kind)}for(let[re,Z]of te){if(!ie.has(re)){ie.add(re);let le=we.get(re),he=le!==void 0?(0,fU.redactSecrets)(le):void 0,B=he!==void 0?(0,eo.extractAssetUid)(he):void 0;z.push({repoKey:e.repoKey,path:re,...B!==void 0?{uid:B}:{},reason:`secret-scan (R5): detected ${Z.join(", ")} \u2014 skipped from the push (the secret is NEVER shipped); a redacted copy is quarantined. REVOKE the credential, then re-sync once it is removed.`,...he!==void 0?{localContent:he}:{}})}C.delete(re)}s.push(`secret-scan (R5): skipped ${te.size} file(s) with a detected secret from the push \u2014 the rest of the changeset shipped; REVOKE the credential(s): ${[...te].map(([re,Z])=>`${re} (${Z.join(", ")})`).join(", ")}`);for(let[re,Z]of m)ie.has(Z)&&P.has(re)&&(P.delete(re),D.push(re));if(C.size===0&&P.size===0)break}try{E=await(0,lU.restCreateCommit)(this.transport,{owner:e.owner,repo:e.repo,branch:e.branch,files:new Map([...C].map(([te,re])=>[te,Sfe(re)])),deletions:[...P],message:this.deps.commitMessage?.(e,C.size,P.size)??`chore(exosync): sync ${C.size} file(s)${P.size>0?`, ${P.size} deletion(s)`:""}`,baseURL:this.deps.baseURL,redact:this.deps.redact});break}catch(te){if(!yU(te))throw te;if(w++,w>b)return{kind:"retry-exhausted",detail:`non-fast-forward push failed after ${b} retries (D16 cap) \u2014 contended files routed to quarantine (D17)`,pushFiles:C,merge:F};s.push(`non-fast-forward push (attempt ${w}/${b}) \u2014 re-pulling and retrying (D16)`)}}return{kind:"done",examinedHead:v,pushedSha:E,applyWrites:S,applyDeletes:R,pushFiles:C,pushedDeletions:E!==void 0?[...P]:[],withheldDeletions:D,merge:F,remoteOversized:j,alreadyInHead:$,deferredPaths:H,deferredRemoteChanges:ee,deferredWarnings:G,secretQuarantineEntries:z}}async resolveMergeConflicts(e,t,n,i,s){let o=this.deps.mergeLayer;if(o===void 0)return S2;let c=new Map(t.files.map(C=>[C.path,C])),l=new Map,u=[],f=[],d=[],p=[],h=0,g=a(C=>typeof C=="string"?C:void 0,"asText"),m=a((C,P,D)=>{let F=g(i.get(C.local.path)),$=g(C.remotes[0]?.content);return{repoKey:e.repoKey,path:C.local.path,...C.local.uid!==void 0?{uid:C.local.uid}:{},reason:P,...D!==void 0?{baseContent:D}:{},...F!==void 0?{localContent:F}:{},...$!==void 0?{remoteContent:$}:{}}},"entry"),_=a(C=>c.get(C.local.basePath??C.local.path)??c.get(C.remotes[0]?.path??""),"baseEntryOf"),b=a(C=>{let P=C.remotes.length===1?C.remotes[0]:void 0;if(!(P===void 0||P.kind!=="change")&&typeof P.content=="string"&&P.path===C.local.path)return g(i.get(C.local.path))},"historyLocal"),w=this.deps.historyBaseRequestBudget??m2.HISTORY_BASE_REQUEST_BUDGET,v=w,E=n.filter(C=>_(C)===void 0&&b(C)!==void 0).length,S=0,R;for(let C of n){let P=_(C),D;if(P!==void 0)D=await(0,dt.getBlobText)(this.transport,e.owner,e.repo,P.blobSha,this.deps.baseURL);else{let G=b(C);if(G!==void 0){if(v<=0)w>0&&S++;else{let j=Math.min(v,Math.max(m2.HISTORY_BASE_MIN_SHARE,Math.floor(v/E))),z={remaining:j},ie=await(0,m2.recoverBaseFromHistory)({transport:this.probeTransport,owner:e.owner,repo:e.repo,baseURL:this.deps.baseURL,sha1:this.sha1,path:C.local.path,head:s,local:G,budget:z});v-=j-z.remaining,ie.kind==="recovered"?(D=ie.base,d.push(`merge(${C.local.path}): no 3-way base recorded \u2014 the local copy matches the remote version at ${ie.commitSha.slice(0,7)}, treated as behind and used as the base`)):ie.kind==="budget-exhausted"?S++:ie.kind==="aborted"&&(v=0,R=ie.reason,S++)}E--}}if(C.remotes.length>1){f.push(m(C,`ambiguous conflict: local change overlaps ${C.remotes.length} remote changes (${C.remotes.map(G=>G.path).join(", ")})`,D));continue}let F=C.remotes[0],$=g(i.get(C.local.path)),H=await o.resolve({path:C.local.path,...C.local.uid!==void 0?{uid:C.local.uid}:{},...D!==void 0?{base:D}:{},...$!==void 0?{local:$}:{},...F.kind==="change"&&typeof F.content=="string"?{remote:F.content}:{}});if(H.action==="quarantine"){f.push(m(C,H.reason,D));continue}h++,p.push(C.local.path);for(let G of H.warnings??[])d.push(`merge(${C.local.path}): ${G}`);let ee=F.kind==="change"?F.content:void 0;if(H.content!==ee&&l.set(C.local.path,H.content),H.content!==i.get(C.local.path)){let G=(0,eo.extractAssetUid)(H.content)??C.local.uid;u.push({path:C.local.path,kind:"change",content:H.content,blobSha:await(0,Yc.gitBlobSha)(H.content,this.sha1),...G!==void 0?{uid:G}:{}})}}return S>0&&d.push(`history base recovery: ${S} no-base conflict(s) not fully checked this pass (${R==="rate-limit"?"GitHub rate limit":R==="request-failure"?"a probe request failed":"request budget"}) \u2014 merged without a base; they re-derive on the next sync`),{mergedFiles:l,mergedWrites:u,quarantineEntries:f,resolvedQuarantineEntries:[],mergedCount:h,mergedPaths:p,warnings:d}}resolveFileModeConflicts(e,t,n,i,s){let o=[],c=[];for(let l of t){l.remotes.length>1&&c.push(`file-mode conflict on ${l.local.path} unexpectedly overlaps ${l.remotes.length} remote changes \u2014 resolving against the first`);let u=l.remotes[0],f=n.get(l.local.path);u.kind==="change"?i.push(u):s.push(u),!(l.localIsDelete||f===void 0)&&o.push({repoKey:e.repoKey,path:l.local.path,reason:`file-mode remote-wins (D18): remote ${u.kind==="change"?`version ${u.blobSha}`:"delete"} wins; this is the losing LOCAL version, preserved byte-exact`,...typeof f=="string"?{localContent:f}:{localContentBytes:f}})}return{mergedFiles:new Map,mergedWrites:[],quarantineEntries:[],resolvedQuarantineEntries:o,mergedCount:0,mergedPaths:[],warnings:c}}async applyRemoteChanges(e,t,n,i,s,o=new Map){let c=0,l=new Set,u=[],f=a(async(h,g)=>{try{return g?await _2(e,h):await e.read(h)}catch{return}},"tryRead"),d=a(async(h,g)=>{typeof g=="string"?await e.write(h,g):await mU(e,h,g)},"writeContent"),p=a(async h=>{let g=await f(h,!1);return g===void 0?!0:await(0,Yc.gitBlobSha)(g,this.sha1)===o.get(h)},"cacheHitUnchanged");for(let h of n){if(h.content===void 0)continue;if(!b2(h.path)){s.push(`unsafe remote path skipped on pull-apply: ${h.path}`),l.add(h.path);continue}let g=t.get(h.path);if(g===void 0&&o.has(h.path)){if(!await p(h.path)){s.push(`pull-apply skipped: ${h.path} changed on disk mid-sync (TOCTOU) \u2014 remote change re-derives next sync`),l.add(h.path);continue}await d(h.path,h.content),c++,u.push(h.path);continue}let m=await f(h.path,typeof(g??h.content)!="string");if(!(0,to.contentEquals)(m,g)){s.push(`pull-apply skipped: ${h.path} changed on disk mid-sync (TOCTOU) \u2014 remote change re-derives next sync`),l.add(h.path);continue}await d(h.path,h.content),c++,u.push(h.path)}for(let h of i){if(!b2(h.path)){s.push(`unsafe remote path skipped on pull-delete: ${h.path}`),l.add(h.path);continue}let g=t.get(h.path);if(g===void 0&&o.has(h.path)){if(!await p(h.path)){s.push(`pull-delete skipped: ${h.path} changed on disk mid-sync (TOCTOU) \u2014 delete-vs-modify re-derives next sync`),l.add(h.path);continue}await e.delete(h.path),c++,u.push(h.path);continue}if(g!==void 0){let m=await f(h.path,typeof g!="string");if(m!==void 0&&!(0,to.contentEquals)(m,g)){s.push(`pull-delete skipped: ${h.path} changed on disk mid-sync (TOCTOU) \u2014 delete-vs-modify re-derives next sync`),l.add(h.path);continue}await e.delete(h.path),c++,u.push(h.path)}}return{pulledCount:c,pinnedPaths:l,pulledPaths:u}}async advanceWatermark(e,t,n,i,s,o,c,l,u,f=new Set){let d=(await(0,dt.getTree)(this.transport,e.owner,e.repo,n,this.deps.baseURL)).filter(h=>u.treeFilter(h)&&!f.has(h.path)),p=Tfe(await this.buildWatermarkFiles(e,d,i,s,o,l,u),o,c);await this.deps.watermarkStore.set(e.repoKey,{lastSyncedSha:t,rootTreeSha:n,files:p,...c.size>0?{pinnedPaths:[...c]}:{},...u.fileMode?{spaceKind:"file"}:{}})}async tryMountBaseBootstrap(e,t,n,i,s){let o=this.deps.mountBaseStore,c=null;if(o!==void 0)try{c=await o.get(e.repoKey)}catch{return null}let l=!1;if(c===null&&this.deps.localBaseShaProvider!==void 0)try{let _=await this.deps.localBaseShaProvider(e);typeof _=="string"&&_.length>0&&(c=_,l=!0)}catch{}if(c===null||t.startsWith(c))return null;let u=300,f=null;try{let _=t;for(let b=0;b<u;b++){let w=await(0,dt.getCommitInfo)(this.transport,e.owner,e.repo,_,this.deps.baseURL);if(w.sha===c||w.sha.startsWith(c)){f=w;break}if(w.parents.length===0)break;_=w.parents[0]}}catch{return null}if(f===null)return null;let d;try{d=(await(0,dt.getTree)(this.transport,e.owner,e.repo,f.treeSha,this.deps.baseURL)).filter(_=>(0,to.isSyncablePath)(_.path))}catch{return null}let p;try{let _=await(0,dt.getCommitInfo)(this.transport,e.owner,e.repo,t,this.deps.baseURL);p=w2((await(0,dt.getTree)(this.transport,e.owner,e.repo,_.treeSha,this.deps.baseURL)).filter(b=>(0,to.isSyncablePath)(b.path)))}catch{return null}let h=d.filter(_=>!n.has(_.path)&&p.get(_.path)===_.blobSha);if(h.length>0){let _=h.slice(0,3).map(b=>b.path).join(", ")+(h.length>3?", \u2026":"");return i.push(`first-sync (asset mode): base-tree\u2286working-tree sanity guard fired \u2014 ${h.length} base file(s) absent from the working tree but UNCHANGED on remote head (${_}); the verified-ancestor base may not match the working tree's derivation commit (out-of-band submodule manipulation) \u2192 routing to merge/quarantine instead of inferring a silent deletion (#3610)`),{kind:"settled",outcome:s("full-conflict",{detail:`first-sync: base-tree\u2286working-tree sanity guard \u2014 ${h.length} base file(s) absent from the working tree are unchanged on remote head (${_}); refusing to infer a silent deletion from a base that may not match the derivation commit \u2014 divergence must go through merge/quarantine (A2/A3), never a silent delete (#3610)`})}}let g=d.map(_=>({path:_.path,blobSha:_.blobSha})),m={lastSyncedSha:f.sha,rootTreeSha:f.treeSha,files:g};if(l&&o!==void 0)try{await o.set(e.repoKey,f.sha)}catch{}return i.push(l?`first-sync (asset mode): BACKFILLED the 3-way base from the locally checked-out commit ${f.sha} (no recorded mount base) \u2014 remote head ${t} advanced since; local edits 3-way merge against it instead of false-conflicting (#3590)`:`first-sync (asset mode): reconciling against the recorded mount base ${f.sha} \u2014 remote head ${t} advanced since mount; local edits 3-way merge against it instead of false-conflicting (#3590)`),{kind:"additive-base",base:m}}async bootstrapWatermark(e,t,n,i){let s=await(0,dt.getHeadSha)(this.transport,e.owner,e.repo,e.branch,this.deps.baseURL),o=await this.tryMountBaseBootstrap(e,s,t,n,i);if(o!==null)return o;let c=await(0,dt.getCommitInfo)(this.transport,e.owner,e.repo,s,this.deps.baseURL),l=(await(0,dt.getTree)(this.transport,e.owner,e.repo,c.treeSha,this.deps.baseURL)).filter(p=>(0,to.isSyncablePath)(p.path)),u=[],f;for(let p of l){let h=t.get(p.path);if(h===void 0||await(0,Yc.gitBlobSha)(h,this.sha1)!==p.blobSha){f===void 0&&(f=p.path);continue}let g=typeof h=="string"?(0,eo.extractAssetUid)(h):void 0;u.push({path:p.path,blobSha:p.blobSha,...g?{uid:g}:{}})}let d={lastSyncedSha:s,rootTreeSha:c.treeSha,files:u};return f!==void 0?this.deps.mergeLayer===void 0?{kind:"settled",outcome:i("full-conflict",{detail:`first-sync: no watermark and local content diverges from remote head at ${f} \u2014 A2/A3 scope`})}:(n.push(`first-sync (asset mode): no 3-way merge base and local diverges from remote head (first at ${f}) \u2014 reconciling ZERO-LOSS against ${u.length} byte-identical file(s) as a synthetic base: remote-only files pull, local-only files push, overlapping divergences route to the merge/quarantine layer (both versions preserved), never a silent overwrite or delete`),{kind:"additive-base",base:d}):t.size===l.length?(await this.deps.watermarkStore.set(e.repoKey,d),n.push(`watermark bootstrapped from head ${s} (local tree identical to remote)`),{kind:"settled",outcome:i("synced")}):(n.push(`first-sync (asset mode): local tree (${t.size} files) is a pure superset of remote head ${s} (${l.length} files) \u2014 ${t.size-l.length} local-only addition(s) derive as pushable adds (#3565)`),{kind:"additive-base",base:d})}async collectRemoteChanges(e,t,n,i,s=new Set,o=[],c=new Set,l){let u=await(0,dt.getCommitInfo)(this.transport,e.owner,e.repo,n,this.deps.baseURL),f=await(0,dt.getTree)(this.transport,e.owner,e.repo,u.treeSha,this.deps.baseURL);if(i.fileMode)for(let P of f)i.syncable(P.path)&&!i.treeFilter(P)&&!c.has(P.path)&&(c.add(P.path),o.push(`skipped oversized REMOTE file ${P.path} (${P.size??"?"} bytes over cap) \u2014 excluded from sync symmetrically (Phase C size cap)`));let d=f.filter(P=>i.treeFilter(P)&&!s.has(P.path)),p=t.files.filter(P=>!c.has(P.path)&&!s.has(P.path)),{changed:h,deleted:g}=gU(p,d),m=h.length;m>=hU&&this.emitProgress(l,e.repoKey,"fetching-blobs",{done:0,total:m});let _=new Array(h.length),b=0,w=0,v,E=a(async P=>{if(i.fileMode){let F=await(0,dt.getBlobBytes)(this.transport,e.owner,e.repo,P.blobSha,this.deps.baseURL);return{path:P.path,kind:"change",blobSha:P.blobSha,content:F}}let D=await(0,dt.getBlobText)(this.transport,e.owner,e.repo,P.blobSha,this.deps.baseURL);return{path:P.path,kind:"change",blobSha:P.blobSha,content:D,uid:(0,eo.extractAssetUid)(D)}},"fetchOne"),S=a(async()=>{for(;;){if(v!==void 0)return;let P=b++;if(P>=h.length)return;try{_[P]=await E(h[P])}catch(D){v===void 0&&(v=D);return}w+=1,m>=hU&&w%mfe===0&&w<m&&this.emitProgress(l,e.repoKey,"fetching-blobs",{done:w,total:m})}},"worker"),R=Math.min(gfe,h.length);if(await Promise.all(Array.from({length:R},()=>S())),v!==void 0)throw v instanceof Error?v:new Error(String(v));let C=_;for(let P of g)C.push({path:P.path,kind:"delete",uid:P.uid});return{changes:C,headTreeByPath:w2(f)}}matchLocalVsRemote(e,t,n,i,s,o=new Set,c){let l=new Set,u=[],f=new Map;for(let m of i)m.kind==="change"&&m.uid!==void 0&&f.set(m.uid,(f.get(m.uid)??0)+1);let d=new Set(o);for(let[m,_]of f)_>1&&d.add(m);let p=new Map,h=new Map;for(let m of i){if(m.uid!==void 0&&!d.has(m.uid)){let _=p.get(m.uid)??[];_.push(m),p.set(m.uid,_)}h.set(m.path,m)}for(let m of e){let _=new Set;if(m.uid!==void 0&&!d.has(m.uid))for(let E of p.get(m.uid)??[])E.kind==="change"&&E.path!==m.path&&(c?.has(m.path)===!0||m.basePath!==void 0&&c?.has(m.basePath)===!0)||_.add(E);let b=h.get(m.path);if(b!==void 0&&_.add(b),m.basePath!==void 0){let E=h.get(m.basePath);E!==void 0&&_.add(E)}let w=[],v=!1;for(let E of _){if(v=t.has(m.path)&&!n.has(m.path),v&&E.kind==="delete"){l.add(E);continue}if(!v&&E.kind==="change"&&E.path===m.path&&E.blobSha===m.blobSha){l.add(E),s.add(m.path);continue}if(E.kind==="delete"&&m.basePath!==void 0&&E.path===m.basePath){let S=h.get(m.path);if(S!==void 0&&S.kind==="change"&&(S.blobSha===m.blobSha||S.uid!==void 0&&S.uid===m.uid)){l.add(E);continue}}if(E.kind==="delete"&&E.path!==m.path&&E.path!==m.basePath&&!n.has(E.path)&&c?.has(E.path)!==!0){l.add(E);continue}w.push(E),l.add(E)}w.length>0&&(u.push({local:m,localIsDelete:v,remotes:w,desc:`${m.uid!==void 0&&!d.has(m.uid)?m.uid:m.path} (local ${v?"delete":"change"} vs remote ${w[0].kind} at ${w[0].path})`}),s.add(m.path))}let g=i.filter(m=>!l.has(m));return{conflicts:u,applyWrites:g.filter(m=>m.kind==="change"),applyDeletes:g.filter(m=>m.kind==="delete")}}async checkRaceWindow(e,t,n,i,s,o,c,l){try{let u=await(0,dt.getCommitInfo)(this.transport,e.owner,e.repo,i,this.deps.baseURL),f=(await(0,dt.getTree)(this.transport,e.owner,e.repo,u.treeSha,this.deps.baseURL)).filter(l.treeFilter),d=n===t.lastSyncedSha?t.files:(await(0,dt.getTree)(this.transport,e.owner,e.repo,(await(0,dt.getCommitInfo)(this.transport,e.owner,e.repo,n,this.deps.baseURL)).treeSha,this.deps.baseURL)).filter(l.treeFilter),{changed:p,deleted:h}=gU(d,f);for(let g of p)s.has(g.path)&&c.push(`race-window: concurrent commit ${i} changed ${g.path} between conflict check (head ${n}) and push \u2014 local version won; previous version recoverable from git history`),o.has(g.path)&&c.push(`race-window: concurrent commit ${i} changed ${g.path} which this push DELETED \u2014 the delete won; the concurrent version is recoverable from git history`);for(let g of h)s.has(g.path)&&c.push(`race-window: concurrent commit ${i} deleted ${g.path}; push re-created it`)}catch(u){let f=this.deps.redact??(d=>d);c.push(`race-window check failed: ${f(Ya(u))}`)}}async buildWatermarkFiles(e,t,n,i,s,o,c){if(c.fileMode)return t.map(f=>({path:f.path,blobSha:f.blobSha}));let l=new Map;for(let f of i)f.kind==="change"&&f.blobSha!==void 0&&l.set(f.blobSha,f.uid);for(let[f,d]of n){let p=o?.get(f)??await(0,Yc.gitBlobSha)(d,this.sha1);l.set(p,typeof d=="string"?(0,eo.extractAssetUid)(d):void 0)}for(let f of s.files)l.has(f.blobSha)||l.set(f.blobSha,f.uid);let u=[];for(let f of t){let d;if(l.has(f.blobSha))d=l.get(f.blobSha);else{let p=await(0,dt.getBlobText)(this.transport,e.owner,e.repo,f.blobSha,this.deps.baseURL);d=(0,eo.extractAssetUid)(p)}u.push({path:f.path,blobSha:f.blobSha,...d?{uid:d}:{}})}return u}};xn.SyncEngine=E2});var SU=T(Dm=>{"use strict";Object.defineProperty(Dm,"__esModule",{value:!0});Dm.QuarantineResolver=void 0;Dm.backupPathFor=bU;var Afe=YS(),ow=Au(),Fm=qc(),Lm=Rm(),Ife=ew(),Go="\0absent",v2=class{static{a(this,"QuarantineResolver")}constructor(e){this.deps=e}async listOpenConflicts(e){return(await this.classifyPins(e)).conflicts}async classifyPins(e){let t=[],n=[];for(let i of e){let s=await this.classifyRepoPins(i);t.push(...s.conflicts),n.push(...s.pinned)}return{conflicts:t,pinned:n}}async classifyRepoPins(e){let t={conflicts:[],pinned:[]},n=await this.deps.watermarkStore.get(e.repoKey),i=n?.pinnedPaths??[];if(i.length===0)return t;if(e.spaceKind==="file")return{conflicts:[],pinned:i.map(m=>({repoKey:e.repoKey,path:m,kind:"unclassified"}))};if(this.deps.outbox!==void 0){let m=await this.deps.outbox.listForRepo(e.repoKey);if(m.length>0){let _=new Set(m.map(b=>b.path));if(i=i.filter(b=>!_.has(b)),i.length===0)return t}}let s=new Map;for(let m of n?.files??[])s.set(m.path,m.blobSha);let o=this.deps.conflictCache!==void 0,c=await this.cachedRecordsFor(e,i),l=i.some(m=>!c.has(m)),u=new Map,f=!0;if(l)if(o)try{u=await this.remoteTreeShas(e)}catch{f=!1}else u=await this.remoteTreeShas(e);let d=this.deps.localFilesFor(e),p=new Set(await d.list()),h=[],g=[];for(let m of i){let _=c.get(m),b,w;if(_!==void 0)w=_.remoteContent!==void 0?await(0,Fm.gitBlobSha)(_.remoteContent,this.deps.sha1):Go,b=_.baseContent!==void 0?await(0,Fm.gitBlobSha)(_.baseContent,this.deps.sha1):s.get(m)??Go;else{if(!f){g.push({repoKey:e.repoKey,path:m,kind:"unclassified"});continue}w=u.get(m)??Go,b=s.get(m)??Go}let v=Go,E;if(p.has(m)&&(E=await d.read(m),v=await(0,Fm.gitBlobSha)(E,this.deps.sha1)),!(v!==w&&v!==b&&w!==b)){let C=v===w?"converged":v===b?"remote-pending":"local-withheld";g.push({repoKey:e.repoKey,path:m,kind:C});continue}let R=(E!==void 0?(0,Lm.extractAssetUid)(E):void 0)??_?.uid;h.push({repoKey:e.repoKey,path:m,...R!==void 0?{uid:R}:{},hasLocal:v!==Go,hasRemote:w!==Go})}return{conflicts:h,pinned:g}}async cachedRecordsFor(e,t){let n=new Map,i=this.deps.conflictCache;if(i===void 0)return n;for(let s of t){let o=await i.get(e.repoKey,s);o!==null&&n.set(s,o)}return n}async detectDuplicateUids(e){let t=new Map;for(let i of e){let s=this.deps.localFilesFor(i);for(let o of await s.list()){if(!o.endsWith(".md"))continue;let c;try{c=await s.read(o)}catch{continue}let l=(0,Lm.extractAssetUid)(c);l!==void 0&&t.set(l,(t.get(l)??0)+1)}}let n=0;for(let i of t.values())i>1&&n++;return n}async loadConflict(e,t){let n=this.deps.localFilesFor(e),s=new Set(await n.list()).has(t)?await n.read(t):void 0,o=await this.deps.conflictCache?.get(e.repoKey,t)??null,c,l;if(o!==null)c=o.remoteContent,l=o.baseContent;else{let d=(await this.remoteTreeShas(e)).get(t);c=d!==void 0?await this.blobText(e,d):void 0;let h=((await this.deps.watermarkStore.get(e.repoKey))?.files??[]).find(g=>g.path===t)?.blobSha;if(h!==void 0)try{l=await this.blobText(e,h)}catch{l=void 0}}let u=(s!==void 0?(0,Lm.extractAssetUid)(s):void 0)??(c!==void 0?(0,Lm.extractAssetUid)(c):void 0)??o?.uid;return{repoKey:e.repoKey,path:t,...u!==void 0?{uid:u}:{},hasLocal:s!==void 0,hasRemote:c!==void 0,...l!==void 0?{base:l}:{},...s!==void 0?{local:s}:{},...c!==void 0?{remote:c}:{}}}async resolve(e,t,n){let i=this.deps.localFilesFor(e),o=new Set(await i.list()).has(t)?await i.read(t):void 0,c=this.deps.outbox!==void 0,{remote:l,remoteSha:u}=c?await this.remoteForResolve(e,t):await this.liveRemoteForResolve(e,t),f=this.chosenContent(n,o,l),d;n.take!=="local"&&o!==void 0&&o!==f&&(d=bU(t),await i.write(d,o)),f===void 0?await i.delete(t):await i.write(t,f);let h=f===void 0&&l===void 0||f===l;if(c&&this.deps.outbox!==void 0&&!h&&f!==void 0)return await this.deps.outbox.enqueue({repoKey:e.repoKey,path:t,chosenContent:f,resolvedTo:n.take==="merged"?"merged":"local",baseRemoteSha:u===Go?Ife.OUTBOX_REMOTE_ABSENT:u,resolvedAt:""}),{repoKey:e.repoKey,path:t,resolvedTo:n.take,awaitingPush:!0,...d!==void 0?{discardedLocalBackupPath:d}:{}};let g;return h||(g=await this.commitChoice(e,t,f)),await this.snapWatermark(e,t,f),this.deps.quarantine?.markResolved!==void 0&&await this.deps.quarantine.markResolved(e.repoKey,t),{repoKey:e.repoKey,path:t,resolvedTo:n.take,...g!==void 0?{pushedSha:g}:{},...d!==void 0?{discardedLocalBackupPath:d}:{}}}async remoteForResolve(e,t){let n=await this.deps.conflictCache?.get(e.repoKey,t)??null;if(n!==null){let i=n.remoteContent,s=i!==void 0?await(0,Fm.gitBlobSha)(i,this.deps.sha1):Go;return{remote:i,remoteSha:s}}return this.liveRemoteForResolve(e,t)}async liveRemoteForResolve(e,t){let i=(await this.remoteTreeShas(e)).get(t);return{remote:i!==void 0?await this.blobText(e,i):void 0,remoteSha:i??Go}}chosenContent(e,t,n){switch(e.take){case"local":if(t===void 0)throw new Error("resolve: cannot keep local \u2014 no local version exists on disk");return t;case"remote":return n;case"merged":return e.content}}async commitChoice(e,t,n){let i=this.deps.commitMessage?.(e,t)??`chore(exosync): resolve conflict for ${t}`;if(n===void 0)throw new Error(`resolve: cannot push an empty resolution for ${t}`);return(0,Afe.restCreateCommit)(this.deps.transport,{owner:e.owner,repo:e.repo,branch:e.branch,files:new Map([[t,n]]),message:i,...this.deps.baseURL!==void 0?{baseURL:this.deps.baseURL}:{},...this.deps.redact!==void 0?{redact:this.deps.redact}:{}})}async snapWatermark(e,t,n){let i=await this.deps.watermarkStore.get(e.repoKey);if(i===null)return;let s=(i.pinnedPaths??[]).filter(c=>c!==t),o=i.files;if(n===void 0)o=o.filter(c=>c.path!==t);else{let c=await(0,Fm.gitBlobSha)(n,this.deps.sha1),l=(0,Lm.extractAssetUid)(n),u={path:t,blobSha:c,...l!==void 0?{uid:l}:{}},f=o.findIndex(d=>d.path===t);o=f>=0?o.map((d,p)=>p===f?u:d):[...o,u]}await this.deps.watermarkStore.set(e.repoKey,{...i,files:o,...s.length>0?{pinnedPaths:s}:{pinnedPaths:void 0}})}async remoteTreeShas(e){let t=await(0,ow.getHeadSha)(this.deps.transport,e.owner,e.repo,e.branch,this.deps.baseURL),n=await(0,ow.getCommitInfo)(this.deps.transport,e.owner,e.repo,t,this.deps.baseURL),i=await(0,ow.getTree)(this.deps.transport,e.owner,e.repo,n.treeSha,this.deps.baseURL),s=new Map;for(let o of i)s.set(o.path,o.blobSha);return s}async blobText(e,t){return(0,ow.getBlobText)(this.deps.transport,e.owner,e.repo,t,this.deps.baseURL)}};Dm.QuarantineResolver=v2;function bU(r){return`${r}.conflict.local.txt`}a(bU,"backupPathFor")});var wU=T(Vd=>{"use strict";Object.defineProperty(Vd,"__esModule",{value:!0});Vd.FileLocalManifestStore=Vd.LOCAL_MANIFEST_STORE_FILENAME=void 0;Vd.LOCAL_MANIFEST_STORE_FILENAME="exosync-localmanifest.local.json";function Rfe(r){if(r===null||typeof r!="object")return!1;let e=r;return e.version===1&&typeof e.lastFullRehashMs=="number"&&e.files!==null&&typeof e.files=="object"}a(Rfe,"isLocalManifestRecord");var T2=class{static{a(this,"FileLocalManifestStore")}constructor(e){this.io=e,this.writeChain=Promise.resolve()}async get(e){let n=(await this.readRepos())[e];return Rfe(n)?n:null}async set(e,t){let n=this.writeChain.then(async()=>{let i=await this.readRepos();i[e]=t;let s={version:1,repos:i};await this.io.writeAtomic(JSON.stringify(s))});return this.writeChain=n.catch(()=>{}),n}async readRepos(){try{let e=await this.io.read();if(e===null)return{};let t=JSON.parse(e);if(t===null||typeof t!="object")return{};let n=t.repos;return n===null||typeof n!="object"?{}:{...n}}catch{return{}}}};Vd.FileLocalManifestStore=T2});var R2=T(I2=>{"use strict";Object.defineProperty(I2,"__esModule",{value:!0});I2.diff3=Cfe;function EU(r,e){let t=r.length,n=e.length,i=Array.from({length:t+1},()=>new Int32Array(n+1));for(let l=t-1;l>=0;l--)for(let u=n-1;u>=0;u--)i[l][u]=r[l]===e[u]?i[l+1][u+1]+1:Math.max(i[l+1][u],i[l][u+1]);let s=new Map,o=0,c=0;for(;o<t&&c<n;)r[o]===e[c]?(s.set(o,c),o++,c++):i[o+1][c]>=i[o][c+1]?o++:c++;return s}a(EU,"lcsMatch");function A2(r,e){if(r.length!==e.length)return!1;for(let t=0;t<r.length;t++)if(r[t]!==e[t])return!1;return!0}a(A2,"sliceEq");function Cfe(r,e,t){let n=EU(r,e),i=EU(r,t),s=[],o=0,c=0,l=0;for(;;){let u=o;for(;u<r.length&&!(n.has(u)&&i.has(u));)u++;let f=u<r.length?n.get(u):e.length,d=u<r.length?i.get(u):t.length,p=r.slice(o,u),h=e.slice(c,f),g=t.slice(l,d),m=!A2(h,p),_=!A2(g,p);if(!m&&!_)s.push(...p);else if(!m)s.push(...g);else if(!_)s.push(...h);else if(A2(h,g))s.push(...h);else return{ok:!1,conflict:{base:p,local:h,remote:g}};if(u>=r.length)break;s.push(r[u]),o=u+1,c=f+1,l=d+1}return{ok:!0,merged:s}}a(Cfe,"diff3")});var AU=T(Gd=>{"use strict";Object.defineProperty(Gd,"__esModule",{value:!0});Gd.StructuredMerger=void 0;Gd.timestampToEpoch=P2;Gd.splitSections=km;var vU=R2(),Ofe=/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/,Nm="exo__Instance_class",xfe="exo__Asset_updatedAt",Pfe=a((r,e,t,n,i,s,o)=>{let c=new Date(0);return c.setFullYear(r,e,t),c.setHours(n,i,s,o),c.getTime()},"DEVICE_LOCAL_TIME"),Ffe=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,9}))?(Z|[+-]\d{2}:?\d{2})?$/;function TU(r,e,t,n,i,s,o){let c=new Date(0);return c.setUTCFullYear(r,e,t),c.setUTCHours(n,i,s,o),c.getTime()}a(TU,"utcEpoch");function P2(r,e){let t=Ffe.exec(r.trim());if(t===null)return;let[n,i,s,o,c,l]=[t[1],t[2],t[3],t[4],t[5],t[6]].map(Number);if(o>23||c>59||l>59)return;let u=new Date(TU(n,i-1,s,0,0,0,0));if(u.getUTCMonth()!==i-1||u.getUTCDate()!==s)return;let f=t[7]===void 0?0:Number(t[7].slice(0,3).padEnd(3,"0")),d=t[8];if(d===void 0){let b=e(n,i-1,s,o,c,l,f);return Number.isFinite(b)?b:void 0}let p=TU(n,i-1,s,o,c,l,f);if(d==="Z")return p;let h=d.replace(":",""),g=Number(h.slice(1,3)),m=Number(h.slice(3,5));if(g>14||m>59)return;let _=g*60+m;return p-(h[0]==="-"?-1:1)*_*6e4}a(P2,"timestampToEpoch");function Mm(r){if(r===null||typeof r!="object")return!0;if(Array.isArray(r))return r.every(Mm);let e=Object.getPrototypeOf(r);return e!==Object.prototype&&e!==null?!1:Object.values(r).every(Mm)}a(Mm,"isPlainValue");function Qc(r,e){if(r===e)return!0;if(r===null||e===null||r===void 0||e===void 0||typeof r!="object"||typeof e!="object"||Array.isArray(r)!==Array.isArray(e))return!1;if(Array.isArray(r)&&Array.isArray(e))return r.length!==e.length?!1:r.every((s,o)=>Qc(s,e[o]));let t=r,n=e,i=Object.keys(t);return i.length!==Object.keys(n).length?!1:i.every(s=>Qc(t[s],n[s]))}a(Qc,"deepEqual");function Iu(r){return typeof r=="string"?`s:${r}`:`j:${JSON.stringify(r)}`}a(Iu,"setKey");function _s(r){return r==null?[]:Array.isArray(r)?r:[r]}a(_s,"toElements");function Lfe(r,e,t){let n=new Set(_s(r).map(Iu)),i=_s(e),s=_s(t),o=new Set(i.map(Iu)),c=new Set(s.map(Iu)),l=a(d=>o.has(d)&&c.has(d)||o.has(d)&&!n.has(d)||c.has(d)&&!n.has(d),"keep"),u=[],f=new Set;for(let d of[...i,...s]){let p=Iu(d);f.has(p)||!l(p)||(f.add(p),u.push(d))}return u}a(Lfe,"mergeSet");function Dfe(r,e,t,n,i){let s=[],o=[],c=new Set;for(let u of[...Object.keys(r),...Object.keys(e),...Object.keys(t)])c.has(u)||(c.add(u),o.push(u));let l={};for(let u of o){let f=r[u],d=e[u],p=t[u];if(!Mm(f)||!Mm(d)||!Mm(p))return{ok:!1,reason:`frontmatter key "${u}" contains a non-plain value (Date?) \u2014 the codec must round-trip scalars as strings (CORE_SCHEMA contract)`};if(Array.isArray(f)||Array.isArray(d)||Array.isArray(p)){if(!(u in e)&&!(u in t))continue;let h=Lfe(f,d,p),g=new Set(_s(f).map(Iu)),m=_s(d).some(b=>!g.has(Iu(b))),_=_s(p).some(b=>!g.has(Iu(b)));m&&_&&!Qc(_s(d),_s(p))&&s.push(`both sides added values to multi-valued key "${u}" \u2014 union kept (D20)`),h.length>0&&(l[u]=h);continue}if(Qc(d,p)){d!==void 0&&(l[u]=d);continue}if(Qc(d,f)){p!==void 0&&(l[u]=p);continue}if(Qc(p,f)){d!==void 0&&(l[u]=d);continue}if(u===xfe&&i&&typeof d=="string"&&typeof p=="string"){let h=P2(d,n),g=P2(p,n);if(h!==void 0&&g!==void 0){l[u]=h>g?d:p,s.push(`"${u}" changed on both sides \u2014 the later stamp kept (${h>g?"local":"remote"})`);continue}}return{ok:!1,reason:`frontmatter key "${u}" changed differently on both sides`}}return{ok:!0,value:l,warnings:s}}a(Dfe,"mergeFrontmatter");var Nfe=/^(```|~~~)/,kfe=/^#{1,6}\s/;function km(r){let e=r.split(`
342
+ `)}a(iue,"stripGitmodulesEntry")});var qc=T(QO=>{"use strict";Object.defineProperty(QO,"__esModule",{value:!0});QO.gitBlobSha=sue;async function sue(r,e){let t=new TextEncoder,n=typeof r=="string"?t.encode(r):r,i=t.encode(`blob ${n.byteLength}\0`),s=new Uint8Array(i.byteLength+n.byteLength);return s.set(i,0),s.set(n,i.byteLength),e(s)}a(sue,"gitBlobSha")});var Rm=T(XS=>{"use strict";Object.defineProperty(XS,"__esModule",{value:!0});XS.extractAssetUid=CB;XS.detectChanges=aue;var oue=qc();function CB(r){let e=/^---\r?\n([\s\S]*?)\r?\n---(?=\r?\n|$)/.exec(r);if(!e)return;let t=/^exo__Asset_uid:[ \t]*["']?([^\s"']+)["']?[ \t]*$/m.exec(e[1]);return t?t[1]:void 0}a(CB,"extractAssetUid");async function aue(r){let{localFiles:e,cachedEntries:t,watermark:n,actualBaseTreeSha:i,sha1:s}=r;if(n===null)return{kind:"full-conflict",reason:"first-sync"};if(i===null)return{kind:"full-conflict",reason:"base-mismatch",detail:`watermark commit ${n.lastSyncedSha} not resolvable on remote`};if(i!==n.rootTreeSha)return{kind:"full-conflict",reason:"base-mismatch",detail:`stored root tree ${n.rootTreeSha} != actual ${i} at ${n.lastSyncedSha}`};let o=[],c=new Map;for(let[E,S]of e){let R=await(0,oue.gitBlobSha)(S,s);c.set(E,R),o.push({path:E,blobSha:R,uid:typeof S=="string"?CB(S):void 0})}if(t!==void 0)for(let[E,S]of t)c.set(E,S.blobSha),o.push({path:E,blobSha:S.blobSha,uid:S.uid});let l=[],u=[],f=[],d=[],p=new Map;for(let E of o){if(E.uid===void 0)continue;let S=p.get(E.uid)??[];S.push(E.path),p.set(E.uid,S)}let h=new Map;for(let E of n.files){if(E.uid===void 0)continue;let S=h.get(E.uid)??[];S.push(E.path),h.set(E.uid,S)}let g=new Set;for(let[E,S]of p)S.length>1&&g.add(E);for(let[E,S]of h)S.length>1&&g.add(E);for(let E of[...g].sort()){let S=p.get(E)??[],R=S.length>1?`on disk (${S.join(", ")})`:`in the sync base (${(h.get(E)??[]).join(", ")})`;d.push(`duplicate uid ${E} ${R} \u2014 uid identity suppressed for the group; every path matched by path identity (#3477)`)}let m=new Map,_=[];for(let E of n.files)E.uid!==void 0&&!g.has(E.uid)?m.set(E.uid,E):_.push(E);let b=[],w=new Set;for(let E of o){let S=E.uid!==void 0&&!g.has(E.uid)?m.get(E.uid):void 0;E.uid!==void 0&&S!==void 0?(w.add(E.uid),(S.blobSha!==E.blobSha||S.path!==E.path)&&u.push({path:E.path,uid:E.uid,blobSha:E.blobSha,...S.path!==E.path?{basePath:S.path}:{}})):b.push(E)}let v=new Map;for(let E of _)v.set(E.path,E);for(let[E,S]of m)w.has(E)||v.set(S.path,S);for(let E of b){let S=v.get(E.path);S!==void 0?(v.delete(E.path),S.blobSha!==E.blobSha&&u.push({path:E.path,uid:E.uid,blobSha:E.blobSha})):l.push({path:E.path,uid:E.uid,blobSha:E.blobSha})}for(let E of v.values())f.push({path:E.path,uid:E.uid,blobSha:E.blobSha});return{kind:"changes",added:l,modified:u,deleted:f,warnings:d,diskBlobShas:c,duplicateUids:g}}a(aue,"detectChanges")});var OB=T(XO=>{"use strict";Object.defineProperty(XO,"__esModule",{value:!0});XO.promiseWithDeadline=cue;async function cue(r,e,t){if(e<=0)return r;let n,i=new Promise((s,o)=>{n=setTimeout(()=>o(t()),e),n.unref?.()});try{return await Promise.race([r,i])}finally{clearTimeout(n)}}a(cue,"promiseWithDeadline")});var LB=T(Wc=>{"use strict";Object.defineProperty(Wc,"__esModule",{value:!0});Wc.ConditionalRequestCache=Wc.CONDITIONAL_STORE_FILENAME=void 0;Wc.conditionalCacheKey=PB;Wc.withConditionalRequests=fue;Wc.CONDITIONAL_STORE_FILENAME="exosync-etags.local.json";var lue=4e3,uue=64*1024;function JS(r){if(r===null||typeof r!="object")return!1;let e=r;return typeof e.etag=="string"&&typeof e.body=="string"}a(JS,"isEntry");function PB(r){if(r.method!=="GET")return null;let e;try{e=new URL(r.url)}catch{return null}let t=e.pathname.split("/").filter(o=>o.length>0),n=t.lastIndexOf("repos");if(n<0)return null;let i=t.slice(n+1);if(i.length<4||i[2]!=="git")return null;let s=i[3];return s!=="refs"&&s!=="commits"&&s!=="trees"?null:r.url}a(PB,"conditionalCacheKey");var JO=class{static{a(this,"ConditionalRequestCache")}constructor(e){this.loaded=null,this.draining=!1,this.dirty=!1,this.drained=Promise.resolve(),this.counters={conditional:0,notModified:0,stored:0},this.io=e.io,this.maxEntries=e.maxEntries??lue,this.maxBodyBytes=e.maxBodyBytes??uue,this.now=e.now??(()=>Date.now())}stats(){return{...this.counters}}async etagFor(e){let n=(await this.load())[e];return JS(n)?n.etag:null}async bodyFor(e){let n=(await this.load())[e];if(!JS(n))return null;try{return JSON.parse(n.body)}catch{return null}}async remember(e,t,n){let i;try{i=JSON.stringify(n)}catch{return}if(i.length>this.maxBodyBytes)return;let s={etag:t,body:i,lastUsedMs:this.now()};await this.mutate(o=>{o[e]=s,this.evictIfNeeded(o)}),this.counters.stored+=1}async touch(e){let t=this.now();await this.mutate(n=>{let i=n[e];JS(i)&&(i.lastUsedMs=t)})}countConditional(){this.counters.conditional+=1}countNotModified(){this.counters.notModified+=1}evictIfNeeded(e){let t=Object.keys(e);t.length<=this.maxEntries||t.sort((n,i)=>(e[n]?.lastUsedMs??0)-(e[i]?.lastUsedMs??0)).slice(0,t.length-this.maxEntries).forEach(n=>delete e[n])}async flush(){for(;this.draining;)await this.drained}load(){return this.loaded===null&&(this.loaded=this.readEntries().then(e=>{for(let t of Object.keys(e)){let n=e[t];JS(n)&&n.body.length>this.maxBodyBytes&&delete e[t]}return e})),this.loaded}async mutate(e){let t=await this.load();e(t),this.dirty=!0,this.draining||(this.draining=!0,this.drained=this.drain(t))}async drain(e){try{for(;this.dirty;){this.dirty=!1;let t={version:1,entries:e};try{await this.io.writeAtomic(JSON.stringify(t))}catch{}}}finally{this.draining=!1}}async readEntries(){try{let e=await this.io.read();if(e===null)return{};let t=JSON.parse(e);if(t===null||typeof t!="object")return{};let n=t.entries;return n!==null&&typeof n=="object"?n:{}}catch{return{}}}};Wc.ConditionalRequestCache=JO;function fue(r,e){return async t=>{let n=PB(t);if(n===null)return r(t);let i=await e.etagFor(n);if(i===null)return xB(r,e,t,n);e.countConditional();let s=await r({...t,headers:{...t.headers??{},"If-None-Match":i},acceptNotModified:!0});if(s.status===304){let o=await e.bodyFor(n);return o!==null?(e.countNotModified(),await e.touch(n).catch(()=>{}),{status:200,json:o,...s.headers===void 0?{}:{headers:s.headers}}):xB(r,e,t,n)}return await FB(e,n,s),s}}a(fue,"withConditionalRequests");async function xB(r,e,t,n){let i=await r(t);return await FB(e,n,i),i}a(xB,"storeFresh");async function FB(r,e,t){let n=t.headers?.("etag");typeof n!="string"||n.length===0||t.json!==void 0&&await r.remember(e,n,t.json).catch(()=>{})}a(FB,"rememberFrom")});var MB=T(Bd=>{"use strict";Object.defineProperty(Bd,"__esModule",{value:!0});Bd.ImmutableObjectCache=void 0;Bd.parseImmutableObjectUrl=NB;Bd.withImmutableObjectCache=Eue;var due=Zl(),pue=qc(),hue=256*1024*1024,mue=/^[A-Za-z0-9._-]+$/;function gue(r){return r==="."||r===".."}a(gue,"isDotSegment");function DB(r){return mue.test(r)&&!gue(r)}a(DB,"isSafeSegment");var yue=/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/,_ue=/^[A-Za-z0-9=&_.-]*$/,bue=new Set(["commits","trees","blobs"]);function Sue(r){if(r.length===0)return"";let e=new URLSearchParams(r),t=[];for(let[n,i]of e.entries())t.push(`${n}=${i}`);return t.sort(),t.join("&")}a(Sue,"normaliseVariant");function NB(r){let e;try{e=new URL(r)}catch{return null}let t=e.pathname.split("/").filter(p=>p.length>0),n=t.lastIndexOf("repos");if(n<0)return null;let[i,s,o,c,l,...u]=t.slice(n+1);if(u.length>0||o!=="git"||i===void 0||s===void 0||c===void 0||l===void 0||!bue.has(c)||!DB(i)||!DB(s)||!yue.test(l))return null;let f=Sue(e.search.replace(/^\?/,""));if(!_ue.test(f))return null;let d=`${i}/${s}/${c}/${l}${f?`~${f}`:""}`;return{owner:i,repo:s,type:c,sha:l,variant:f,key:d}}a(NB,"parseImmutableObjectUrl");function kB(r){return r!==null&&typeof r=="object"?r:void 0}a(kB,"asRecord");function wue(r){let e=kB(r);return e!==void 0&&e.v===1&&typeof e.sha=="string"&&typeof e.digest=="string"&&typeof e.body=="string"}a(wue,"isEnvelope");function Kc(r,e){return new Error(`ExoSync: cached git object ${r.key} failed its integrity check (${e}) \u2014 refusing to apply it. Delete the cache entry to re-fetch.`)}a(Kc,"integrityError");var ZO=class{static{a(this,"ImmutableObjectCache")}constructor(e){this.writtenSinceSweep=0,this.sweptOnce=!1,this.counters={hits:0,misses:0,stores:0,evictions:0},this.io=e.io,this.sha1=e.sha1,this.maxBytes=e.maxBytes??hue,this.sweepIntervalBytes=e.sweepIntervalBytes??Math.max(1,Math.floor(this.maxBytes/8))}stats(){return{...this.counters}}async get(e){let t;try{t=await this.io.read(e.key)}catch{return this.counters.misses+=1,null}if(t===null)return this.counters.misses+=1,null;let n;try{n=JSON.parse(t)}catch{throw Kc(e,"stored payload is not valid JSON")}if(!wue(n))return this.counters.misses+=1,null;let i=await this.digestOf(n.body);if(i!==n.digest)throw Kc(e,`stored digest ${n.digest} does not match the payload (recomputed ${i})`);let s;try{s=JSON.parse(n.body)}catch{throw Kc(e,"stored body is not valid JSON")}return await this.assertIntegrity(e,s),this.counters.hits+=1,this.io.markUsed(e.key).catch(()=>{}),{status:200,json:s,text:n.body}}async put(e,t){if(t.json===void 0)return;let n;try{n=JSON.stringify(t.json)}catch{return}try{await this.assertIntegrity(e,t.json)}catch{return}let i;try{let s={v:1,sha:e.sha,digest:await this.digestOf(n),body:n};i=JSON.stringify(s)}catch{return}try{await this.io.write(e.key,i)}catch{return}this.counters.stores+=1,this.writtenSinceSweep+=i.length,(!this.sweptOnce||this.writtenSinceSweep>=this.sweepIntervalBytes)&&(this.sweptOnce=!0,this.writtenSinceSweep=0,await this.evict().catch(()=>{}))}async evict(){let e=await this.io.list(),t=0;for(let s of e)t+=s.size;if(t<=this.maxBytes)return 0;let n=[...e].sort((s,o)=>s.lastUsedMs-o.lastUsedMs),i=0;for(let s of n){if(t<=this.maxBytes)break;try{await this.io.remove(s.key)}catch{continue}t-=s.size,i+=1,this.counters.evictions+=1}return i}async digestOf(e){return this.sha1(new TextEncoder().encode(e))}async assertIntegrity(e,t){let n=kB(t);if(n===void 0)throw Kc(e,"stored payload is not an object");if(e.type!=="blobs"){let l=n.sha;if(typeof l!="string"||l!==e.sha)throw Kc(e,`response sha ${String(l)} does not match the requested sha`);return}let i=n.content,s=n.encoding;if(typeof i!="string")throw Kc(e,"blob payload has no content");let o;try{o=s==="utf-8"?new TextEncoder().encode(i):(0,due.base64ToBytes)(i)}catch{throw Kc(e,"blob content is not decodable")}let c=await(0,pue.gitBlobSha)(o,this.sha1);if(c!==e.sha)throw Kc(e,`recomputed blob sha ${c} does not match the requested sha`)}};Bd.ImmutableObjectCache=ZO;function Eue(r,e){return async t=>{if(t.method!=="GET")return r(t);let n=NB(t.url);if(n===null)return r(t);let i=await e.get(n);if(i!==null)return i;let s=await r(t);return await e.put(n,s),s}}a(Eue,"withImmutableObjectCache")});var BB=T(Cm=>{"use strict";Object.defineProperty(Cm,"__esModule",{value:!0});Cm.rewriteAssetUid=$B;Cm.findDuplicateUidGroups=jB;Cm.planDuplicateUidFix=Tue;var vue=Rm();function $B(r,e){let t=/^(---\r?\n)([\s\S]*?)(\r?\n---(?=\r?\n|$))/.exec(r);if(t===null)return r;let n=t[2].replace(/^(exo__Asset_uid:[ \t]*["']?)[^\s"']+(["']?[ \t]*)$/m,`$1${e}$2`);return n===t[2]?r:r.slice(0,t.index)+t[1]+n+t[3]+r.slice(t.index+t[0].length)}a($B,"rewriteAssetUid");function jB(r){let e=new Map;for(let t of r){let n=(0,vue.extractAssetUid)(t.content);if(n===void 0)continue;let i=e.get(n)??[];i.push(t.path),e.set(n,i)}return[...e.entries()].filter(([,t])=>t.length>1).sort(([t],[n])=>t.localeCompare(n)).map(([t,n])=>({uid:t,paths:n}))}a(jB,"findDuplicateUidGroups");function Tue(r,e){let t=new Map(r.map(i=>[i.path,i.content])),n=[];for(let i of jB(r)){let s=[...i.paths].sort((o,c)=>o.localeCompare(c));for(let o of s.slice(1)){let c=t.get(o);if(c===void 0)continue;let l=e(),u=$B(c,l);u!==c&&n.push({path:o,fromUid:i.uid,toUid:l,content:u})}}return n}a(Tue,"planDuplicateUidFix")});var Au=T(gs=>{"use strict";Object.defineProperty(gs,"__esModule",{value:!0});gs.EMPTY_TREE_SHA=void 0;gs.getHeadSha=Iue;gs.getCommitInfo=Rue;gs.getTree=Cue;gs.listPathCommitShas=xue;gs.getPathBlobShaAt=Pue;gs.getBlobText=Fue;gs.getBlobBytes=Lue;var UB=Zl(),Aue="https://api.github.com";function Tu(r){return(r??Aue).replace(/\/$/,"")}a(Tu,"api");function vu(r){return r!==null&&typeof r=="object"?r:void 0}a(vu,"asRecord");function ms(r,e){let n=vu(r)?.[e];return typeof n=="string"?n:void 0}a(ms,"readString");async function Iue(r,e,t,n,i){let s=await r({method:"GET",url:`${Tu(i)}/repos/${encodeURIComponent(e)}/${encodeURIComponent(t)}/git/refs/heads/${encodeURIComponent(n)}`}),o=ms(vu(s?.json)?.object,"sha");if(typeof o!="string"||o.length===0)throw new Error(`ExoSync: missing object.sha for ref heads/${n}`);return o}a(Iue,"getHeadSha");async function Rue(r,e,t,n,i){let s=await r({method:"GET",url:`${Tu(i)}/repos/${encodeURIComponent(e)}/${encodeURIComponent(t)}/git/commits/${encodeURIComponent(n)}`}),o=vu(s?.json),c=ms(o,"sha"),l=ms(o?.tree,"sha");if(!c||!l)throw new Error(`ExoSync: malformed commit response for ${n}`);let u=o?.parents,f=Array.isArray(u)?u.map(d=>ms(d,"sha")).filter(d=>typeof d=="string"):[];return{sha:c,treeSha:l,parents:f}}a(Rue,"getCommitInfo");gs.EMPTY_TREE_SHA="4b825dc642cb6eb9a060e54bf8d69288fbee4904";async function Cue(r,e,t,n,i){if(n===gs.EMPTY_TREE_SHA)return[];let s=await r({method:"GET",url:`${Tu(i)}/repos/${encodeURIComponent(e)}/${encodeURIComponent(t)}/git/trees/${encodeURIComponent(n)}?recursive=1`}),o=vu(s?.json);if(o?.truncated===!0)throw new Error(`ExoSync: tree ${n} is truncated by GitHub (repo too large for recursive listing) \u2014 refusing to diff`);let c=o?.tree;if(!Array.isArray(c))throw new Error(`ExoSync: malformed tree response for ${n}`);let l=[];for(let u of c){let f=vu(u);if(f?.type!=="blob")continue;let d=ms(f,"path"),p=ms(f,"sha"),h=typeof f.size=="number"?f.size:void 0;d&&p&&l.push({path:d,blobSha:p,...h!==void 0?{size:h}:{}})}return l}a(Cue,"getTree");function Oue(r){return r.split("/").map(encodeURIComponent).join("/")}a(Oue,"encodePath");async function xue(r,e,t,n,i,s,o){let l=(await r({method:"GET",url:`${Tu(o)}/repos/${encodeURIComponent(e)}/${encodeURIComponent(t)}/commits?sha=${encodeURIComponent(i)}&path=${encodeURIComponent(n)}&per_page=${s}`}))?.json;if(!Array.isArray(l))throw new Error(`ExoSync: malformed commit list for ${n}`);return l.map(u=>ms(u,"sha")).filter(u=>typeof u=="string"&&u.length>0)}a(xue,"listPathCommitShas");async function Pue(r,e,t,n,i,s){let o=await r({method:"GET",url:`${Tu(s)}/repos/${encodeURIComponent(e)}/${encodeURIComponent(t)}/contents/${Oue(n)}?ref=${encodeURIComponent(i)}`}),c=ms(o?.json,"sha");if(typeof c!="string"||c.length===0)throw new Error(`ExoSync: malformed contents response for ${n}@${i}`);return c}a(Pue,"getPathBlobShaAt");async function Fue(r,e,t,n,i){let s=await r({method:"GET",url:`${Tu(i)}/repos/${encodeURIComponent(e)}/${encodeURIComponent(t)}/git/blobs/${encodeURIComponent(n)}`}),o=vu(s?.json),c=ms(o,"content");if(typeof c!="string")throw new Error(`ExoSync: malformed blob response for ${n}`);return ms(o,"encoding")==="utf-8"?c:(0,UB.base64ToUtf8)(c)}a(Fue,"getBlobText");async function Lue(r,e,t,n,i){let s=await r({method:"GET",url:`${Tu(i)}/repos/${encodeURIComponent(e)}/${encodeURIComponent(t)}/git/blobs/${encodeURIComponent(n)}`}),o=vu(s?.json),c=ms(o,"content");if(typeof c!="string")throw new Error(`ExoSync: malformed blob response for ${n}`);return ms(o,"encoding")==="utf-8"?new TextEncoder().encode(c):(0,UB.base64ToBytes)(c)}a(Lue,"getBlobBytes")});var GB=T(ex=>{"use strict";Object.defineProperty(ex,"__esModule",{value:!0});ex.checkParkedStaleness=Nue;var Due=Au();async function Nue(r,e){let t={repoKey:r.repoKey,localPath:r.localPath},n=e.redact??(o=>o),i=null;try{let c=(await e.watermarks.get(r.repoKey))?.lastSyncedSha??"";c.length>0&&(i=c)}catch(o){return{...t,freshness:"unknown",lastSyncedSha:null,remoteHeadSha:null,reason:`watermark unreadable: ${n(VB(o))}`}}if(i===null)return{...t,freshness:"unknown",lastSyncedSha:null,remoteHeadSha:null,reason:"never synced on this device (no watermark)"};let s;try{s=await(0,Due.getHeadSha)(e.transport,r.owner,r.repo,r.branch,e.baseURL)}catch(o){return{...t,freshness:"unknown",lastSyncedSha:i,remoteHeadSha:null,reason:`remote unreachable: ${n(VB(o))}`}}return{...t,freshness:s===i?"current":"behind",lastSyncedSha:i,remoteHeadSha:s}}a(Nue,"checkParkedStaleness");function VB(r){return r instanceof Error?r.message:String(r)}a(VB,"errorText")});var ix=T(br=>{"use strict";Object.defineProperty(br,"__esModule",{value:!0});br.SyncPhaseTimer=br.SYNC_PHASES=void 0;br.classifyRestPhase=kue;br.emptyTimings=WB;br.totalMs=ZS;br.addTimings=KB;br.aggregateTimings=$ue;br.dominantPhase=jue;br.fmtMs=Om;br.formatQuota=nx;br.formatTimingsLine=Bue;br.formatRepoTimings=Uue;br.SYNC_PHASES=["localList","localRead","localWrite","hash","restHead","restCommit","restTree","restBlob","restPush"];function rx(){let r={};for(let e of br.SYNC_PHASES)r[e]=0;return r}a(rx,"zeroDurations");function qB(){return{filesRead:0,filesHashed:0,filesWritten:0,restCalls:0}}a(qB,"zeroCounts");function kue(r){if(r.method!=="GET")return"restPush";let e=r.url;return e.includes("/git/blobs/")?"restBlob":e.includes("/git/trees/")?"restTree":e.includes("/git/commits/")?"restCommit":e.includes("/git/refs/")?"restHead":"restCommit"}a(kue,"classifyRestPhase");var tx=class{static{a(this,"SyncPhaseTimer")}constructor(e){this.now=e,this.durations=rx(),this.counts=qB(),this.quota=void 0}async time(e,t){let n=this.now();try{return await t()}finally{this.durations[e]+=this.now()-n}}bumpRead(){this.counts.filesRead++}bumpHashed(){this.counts.filesHashed++}bumpWritten(){this.counts.filesWritten++}bumpRest(){this.counts.restCalls++}observeQuota(e){if(e===void 0)return;let t=a(c=>{let l;try{l=e(c)}catch{return null}if(l==null||l.trim()==="")return null;let u=Number(l);return Number.isFinite(u)?u:null},"num"),n=t("x-ratelimit-limit"),i=t("x-ratelimit-remaining"),s=t("x-ratelimit-used"),o=t("x-ratelimit-reset");n===null&&i===null&&s===null||(this.quota=zB(this.quota,{limit:n,remaining:i,used:s,resetEpoch:o,observedAt:this.now()}))}snapshot(){return{durations:{...this.durations},counts:{...this.counts},...this.quota===void 0?{}:{quota:{...this.quota}}}}};br.SyncPhaseTimer=tx;function WB(){return{durations:rx(),counts:qB()}}a(WB,"emptyTimings");function ZS(r){let e=0;for(let t of br.SYNC_PHASES)e+=r.durations[t];return e}a(ZS,"totalMs");function KB(r,e){let t=rx();for(let i of br.SYNC_PHASES)t[i]=r.durations[i]+e.durations[i];let n=Mue(r.quota,e.quota);return{durations:t,counts:{filesRead:r.counts.filesRead+e.counts.filesRead,filesHashed:r.counts.filesHashed+e.counts.filesHashed,filesWritten:r.counts.filesWritten+e.counts.filesWritten,restCalls:r.counts.restCalls+e.counts.restCalls},...n===void 0?{}:{quota:n}}}a(KB,"addTimings");function Mue(r,e){return r===void 0?e:e===void 0?r:zB(r,e)}a(Mue,"fresherQuota");function zB(r,e){if(r===void 0)return e;if(r.resetEpoch!==null&&e.resetEpoch!==null&&r.resetEpoch===e.resetEpoch){if(r.remaining!==null&&e.remaining!==null)return e.remaining<=r.remaining?e:r;if(r.used!==null&&e.used!==null)return e.used>=r.used?e:r}return e.observedAt>=r.observedAt?e:r}a(zB,"pickQuota");function $ue(r){let e=WB();for(let t of r)t.timings!==void 0&&(e=KB(e,t.timings));return e}a($ue,"aggregateTimings");function jue(r){let e=ZS(r);if(e<=0)return null;let t=br.SYNC_PHASES[0],n=-1;for(let i of br.SYNC_PHASES)r.durations[i]>n&&(n=r.durations[i],t=i);return{phase:t,ms:n,pct:n/e*100}}a(jue,"dominantPhase");function Om(r){return r>=1e3?`${(r/1e3).toFixed(1)}s`:`${Math.round(r)}ms`}a(Om,"fmtMs");function nx(r){if(r===void 0)return"quota n/a";let e=r.remaining===null?"?":String(r.remaining),t=r.limit===null?"?":String(r.limit);if(r.resetEpoch===null)return`quota ${e}/${t}`;let n=new Date(r.resetEpoch*1e3),i=String(n.getHours()).padStart(2,"0"),s=String(n.getMinutes()).padStart(2,"0");return`quota ${e}/${t}, reset ${i}:${s}`}a(nx,"formatQuota");function Bue(r){let e=ZS(r);if(e<=0)return"";let t=br.SYNC_PHASES.filter(n=>r.durations[n]>0).sort((n,i)=>r.durations[i]-r.durations[n]).map(n=>`${n} ${Om(r.durations[n])} ${Math.round(r.durations[n]/e*100)}%`);return`\u23F1 ExoSync ${Om(e)} \u2014 ${t.join(" \xB7 ")} (${r.counts.filesHashed} hashed, ${r.counts.filesRead} read, ${r.counts.restCalls} REST, ${nx(r.quota)})`}a(Bue,"formatTimingsLine");function Uue(r,e){let t=br.SYNC_PHASES.map(n=>`${n}=${Om(e.durations[n])}`);return`[ExoSync timings] ${r}: total ${Om(ZS(e))} \u2014 ${t.join(" ")} | hashed ${e.counts.filesHashed} read ${e.counts.filesRead} written ${e.counts.filesWritten} REST ${e.counts.restCalls} | ${nx(e.quota)}`}a(Uue,"formatRepoTimings")});var ax=T(zc=>{"use strict";Object.defineProperty(zc,"__esModule",{value:!0});zc.caseInsensitiveHeaderGetter=Vue;zc.parseRetryAfterMs=HB;zc.extractRateLimitFields=YB;zc.getRateLimitFields=Gue;zc.attachRateLimitFields=QB;zc.enrichRateLimitError=que;function Vue(r){let e=new Map;if(r&&typeof r=="object")for(let[t,n]of Object.entries(r))typeof n=="string"&&e.set(t.toLowerCase(),n);return t=>e.get(t.toLowerCase())}a(Vue,"caseInsensitiveHeaderGetter");function ox(r){if(r==null)return;let e=r.trim();if(!/^-?\d+$/.test(e))return;let t=Number(e);return Number.isFinite(t)?t:void 0}a(ox,"parseIntHeader");function HB(r,e=Date.now){if(r==null)return;let t=r.trim();if(t.length===0)return;let n=ox(t);if(n!==void 0)return Math.max(0,n*1e3);let i=Date.parse(t);if(!Number.isNaN(i))return Math.max(0,i-e())}a(HB,"parseRetryAfterMs");function YB(r,e=Date.now){let t={},n=HB(r("retry-after"),e);n!==void 0&&(t.retryAfterMs=n);let i=ox(r("x-ratelimit-reset"));i!==void 0&&(t.rateLimitReset=i);let s=ox(r("x-ratelimit-remaining"));return s!==void 0&&(t.rateLimitRemaining=s),t}a(YB,"extractRateLimitFields");function Gue(r){if(r===null||typeof r!="object")return{};let e=r,t={};return typeof e.retryAfterMs=="number"&&(t.retryAfterMs=e.retryAfterMs),typeof e.rateLimitReset=="number"&&(t.rateLimitReset=e.rateLimitReset),typeof e.rateLimitRemaining=="number"&&(t.rateLimitRemaining=e.rateLimitRemaining),t}a(Gue,"getRateLimitFields");function sx(r,e,t){Object.defineProperty(r,e,{value:t,enumerable:!1,writable:!0,configurable:!0})}a(sx,"defineHidden");function QB(r,e){return e.retryAfterMs!==void 0&&sx(r,"retryAfterMs",e.retryAfterMs),e.rateLimitReset!==void 0&&sx(r,"rateLimitReset",e.rateLimitReset),e.rateLimitRemaining!==void 0&&sx(r,"rateLimitRemaining",e.rateLimitRemaining),r}a(QB,"attachRateLimitFields");function que(r,e,t=Date.now){return QB(r,YB(e,t))}a(que,"enrichRateLimitError")});var xm=T(ys=>{"use strict";Object.defineProperty(ys,"__esModule",{value:!0});ys.DEFAULT_MAX_RETRIES=ys.MIN_RATE_LIMIT_WAIT_MS=void 0;ys.isRateLimitError=XB;ys.createRateLimitBudget=Kue;ys.withRateLimitBackoff=Yue;var Wue=ax();function XB(r){let e=r instanceof Error?r.message:String(r);return/HTTP 429/.test(e)?!0:/HTTP 403/.test(e)&&(/rate limit/i.test(e)||/abuse detection/i.test(e))}a(XB,"isRateLimitError");ys.MIN_RATE_LIMIT_WAIT_MS=6e4;ys.DEFAULT_MAX_RETRIES=6;function Kue(r){let e=!(r>0),t=e?Number.POSITIVE_INFINITY:r;return{reset(){t=e?Number.POSITIVE_INFINITY:r},tryReserve(n){return n<=0?!0:n<=t?(t-=n,!0):!1}}}a(Kue,"createRateLimitBudget");var zue=a(r=>new Promise(e=>setTimeout(e,r)),"defaultSleep");function Hue(r,e,t,n,i,s){let o=(0,Wue.getRateLimitFields)(r);if(typeof o.retryAfterMs=="number"&&o.retryAfterMs>=0)return o.retryAfterMs;if(o.rateLimitRemaining===0&&typeof o.rateLimitReset=="number"){let l=o.rateLimitReset*1e3-s();if(l>0)return l}let c=t*2**e*(1+i());return Math.max(n,c)}a(Hue,"computeRateLimitDelay");function Yue(r,e={}){let t=e.maxRetries??ys.DEFAULT_MAX_RETRIES,n=e.baseDelayMs??1e3,i=Math.max(ys.MIN_RATE_LIMIT_WAIT_MS,e.minRateLimitWaitMs??ys.MIN_RATE_LIMIT_WAIT_MS),s=e.budget,o=e.sleep??zue,c=e.random??Math.random,l=e.now??(()=>Date.now());return async u=>{let f=0;for(;;)try{return await r(u)}catch(d){if(!XB(d)||f>=t)throw d;let p=Hue(d,f,n,i,c,l);if(s!==void 0&&!s.tryReserve(p))throw d;f++,await o(p)}}}a(Yue,"withRateLimitBackoff")});var JB=T(Zs=>{"use strict";Object.defineProperty(Zs,"__esModule",{value:!0});Zs.HISTORY_BASE_MIN_SHARE=Zs.HISTORY_BASE_REQUEST_BUDGET=Zs.HISTORY_BASE_MAX_VERSIONS=void 0;Zs.recoverBaseFromHistory=Zue;var Que=qc(),cx=Au(),Xue=xm();Zs.HISTORY_BASE_MAX_VERSIONS=30;Zs.HISTORY_BASE_REQUEST_BUDGET=60;Zs.HISTORY_BASE_MIN_SHARE=4;function Jue(r){let e=r instanceof Error?r.message:String(r);return/→ HTTP 404\b/.test(e)}a(Jue,"isNotFoundError");function lx(r){if((0,Xue.isRateLimitError)(r))return{kind:"aborted",reason:"rate-limit"};if(!Jue(r))return{kind:"aborted",reason:"request-failure"}}a(lx,"abortUnlessNotFound");async function Zue(r){let e=a(()=>r.budget.remaining<=0?!1:(r.budget.remaining-=1,!0),"spend"),t=await(0,Que.gitBlobSha)(r.local,r.sha1);if(!e())return{kind:"budget-exhausted"};try{await(0,cx.getBlobText)(r.transport,r.owner,r.repo,t,r.baseURL)}catch(i){return lx(i)??{kind:"not-found"}}if(!e())return{kind:"budget-exhausted"};let n;try{n=await(0,cx.listPathCommitShas)(r.transport,r.owner,r.repo,r.path,r.head,Zs.HISTORY_BASE_MAX_VERSIONS,r.baseURL)}catch(i){return lx(i)??{kind:"not-found"}}for(let i of n.slice(0,Zs.HISTORY_BASE_MAX_VERSIONS)){if(!e())return{kind:"budget-exhausted"};let s;try{s=await(0,cx.getPathBlobShaAt)(r.transport,r.owner,r.repo,r.path,i,r.baseURL)}catch(o){let c=lx(o);if(c!==void 0)return c;continue}if(s===t)return{kind:"recovered",base:r.local,commitSha:i}}return{kind:"not-found"}}a(Zue,"recoverBaseFromHistory")});var ew=T(Hc=>{"use strict";Object.defineProperty(Hc,"__esModule",{value:!0});Hc.LocalOutboxStore=Hc.OUTBOX_REMOTE_ABSENT=Hc.OUTBOX_STORE_FILENAME=void 0;Hc.OUTBOX_STORE_FILENAME="exosync-outbox.local.json";Hc.OUTBOX_REMOTE_ABSENT=" absent";function ux(r,e){return`${r}\0${e}`}a(ux,"outboxKey");function ZB(r){if(r===null||typeof r!="object")return!1;let e=r;return typeof e.repoKey=="string"&&typeof e.path=="string"&&typeof e.chosenContent=="string"&&typeof e.baseRemoteSha=="string"}a(ZB,"isEntry");var fx=class{static{a(this,"LocalOutboxStore")}constructor(e){this.writeChain=Promise.resolve(),this.io=e.io,this.now=e.now??(()=>new Date().toISOString())}async enqueue(e){await this.mutate(t=>{t.entries[ux(e.repoKey,e.path)]={version:1,...e,resolvedAt:e.resolvedAt.length>0?e.resolvedAt:this.now()}})}async remove(e,t){await this.mutate(n=>{delete n.entries[ux(e,t)]})}async list(){let e=await this.read();return Object.values(e.entries).filter(ZB)}async listForRepo(e){return(await this.list()).filter(t=>t.repoKey===e)}async has(e,t){let i=(await this.read()).entries[ux(e,t)];return i!==void 0&&ZB(i)}async mutate(e){let t=this.writeChain.then(async()=>{let n=await this.read();e(n),await this.io.writeAtomic(JSON.stringify(n,null,2))});return this.writeChain=t.catch(()=>{}),t}async read(){try{let e=await this.io.read();if(e===null)return{version:1,entries:{}};let t=JSON.parse(e);if(t===null||typeof t!="object")return{version:1,entries:{}};let n=t.entries;return n===null||typeof n!="object"?{version:1,entries:{}}:{version:1,entries:{...n}}}catch{return{version:1,entries:{}}}}};Hc.LocalOutboxStore=fx});var Pm=T(fr=>{"use strict";Object.defineProperty(fr,"__esModule",{value:!0});fr.SpaceSpecAccumulator=fr.PullOnlyListError=fr.PULL_ONLY_LIST_PATH=fr.SYNC_BRANCH=fr.ASSET_SPACE_CLASS_UID=void 0;fr.isAssetSpaceFrontmatter=rU;fr.isFileSpaceFrontmatter=nU;fr.readSpaceSource=iU;fr.parseStrictGitHubRepoURL=sU;fr.classifySpaceDeclaration=nfe;fr.parsePullOnlyList=oU;fr.applyPullOnlyListText=sfe;var efe=vb(),tfe=Eb();fr.ASSET_SPACE_CLASS_UID="73bd00e4-ccc0-4f3f-b20d-c4388c4588fb";fr.SYNC_BRANCH="main";var eU=/\[\[([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})(?:\|[^\]]*)?\]\]/gi;function tU(r,e){let t=r.exo__Instance_class,n=Array.isArray(t)?t:[t];for(let i of n){if(typeof i!="string")continue;eU.lastIndex=0;let s;for(;(s=eU.exec(i))!==null;)if(s[1].toLowerCase()===e)return!0}return!1}a(tU,"instanceClassHasUid");function rU(r){return tU(r,fr.ASSET_SPACE_CLASS_UID)}a(rU,"isAssetSpaceFrontmatter");function nU(r){return tU(r,efe.FILE_SPACE_CLASS_UID)}a(nU,"isFileSpaceFrontmatter");function iU(r){let e=r.exo__AssetSpace_source;if(typeof e=="string"&&e.length>0)return e;let t=r.exo__AssetSpace_git;return typeof t=="string"&&t.length>0?t:null}a(iU,"readSpaceSource");var rfe=/^https:\/\/github\.com\/[a-zA-Z0-9_-]+\/[a-zA-Z0-9_.-]+$/;function sU(r){if(typeof r!="string"||r.length===0||r.length>256||!rfe.test(r))return null;let e=r.slice(19),[t,n,...i]=e.split("/");if(i.length>0||t===".."||n===".."||n.startsWith("."))return null;let s=n.replace(/\.git$/,"");return s.length===0?null:{owner:t,repo:s}}a(sU,"parseStrictGitHubRepoURL");function nfe(r,e){let t=rU(r),n=nU(r);if(!t&&!n)return{kind:"not-space"};let i;t&&n&&(i=`declaration at ${e} carries BOTH exo__AssetSpace and exo__FileSpace classes (disjoint) \u2014 treating as AssetSpace (conservative)`);let s=t?"asset":"file",o=iU(r);if(o===null)return s==="file"?{kind:"skip",warning:`skipped FileSpace at ${e}: no exo__AssetSpace_source/_git \u2014 mount path underivable`}:{kind:"skip"};let c=o.replace(/\.git$/i,""),l=sU(c);if(l===null)return{kind:"skip",warning:`skipped AssetSpace at ${e}: source is not a plain https://github.com/<owner>/<repo> URL`};let u=(0,tfe.derivePath)(c);if(u===null)return{kind:"skip",warning:`skipped AssetSpace at ${e}: cannot derive mount path from source`};let f=`${l.owner}/${l.repo}#${fr.SYNC_BRANCH}`,d=r.exo__Asset_uid,p=typeof d=="string"&&d.trim().length>0?d.trim():void 0;return{kind:"candidate",candidate:{spec:{owner:l.owner,repo:l.repo,branch:fr.SYNC_BRANCH,repoKey:f,localPath:u,...s==="file"?{spaceKind:s}:{}},spaceKind:s,...p!==void 0?{asUid:p}:{}},...i!==void 0?{warning:i}:{}}}a(nfe,"classifySpaceDeclaration");fr.PULL_ONLY_LIST_PATH=".exocortex/exosync-pull-only";var ife=/^([A-Za-z0-9_-]+)\/([A-Za-z0-9_.-]+)$/,tw=class extends Error{static{a(this,"PullOnlyListError")}constructor(e,t){super(`invalid pull-only list ${fr.PULL_ONLY_LIST_PATH} line ${e}: expected "owner/repo" (blank lines and # comments are ignored), got ${JSON.stringify(t)}`),this.name="PullOnlyListError",this.lineNumber=e,this.lineContent=t}};fr.PullOnlyListError=tw;function oU(r){let e=[],t=r.split(`
343
+ `);for(let n=0;n<t.length;n++){let i=t[n].replace(/\r$/,""),s=i.trim();if(s.length===0||s.startsWith("#"))continue;let o=ife.exec(s),c=o===null?"":o[2].replace(/\.git$/i,"");if(o===null||c.length===0||c.startsWith("."))throw new tw(n+1,i);e.push({key:`${o[1]}/${c}`.toLowerCase(),line:n+1})}return e}a(oU,"parsePullOnlyList");function sfe(r,e){if(e===null)return[];let t=oU(e),n=[],i=new Map;for(let s of r){let o=`${s.owner}/${s.repo}`.toLowerCase(),c=i.get(o);c===void 0?i.set(o,[s]):c.push(s)}for(let s of t){let o=i.get(s.key);if(o===void 0){n.push(`pull-only list ${fr.PULL_ONLY_LIST_PATH} line ${s.line} names ${s.key}, which is not a materialized sync unit on this device \u2014 nothing to protect`);continue}for(let c of o)c.pullOnly=!0}return n}a(sfe,"applyPullOnlyListText");var dx=class{static{a(this,"SpaceSpecAccumulator")}constructor(){this.specs=[],this.warnings=[],this.asUidByRepoKey=new Map,this.seen=new Set,this.kindByRepoKey=new Map}offer(e){let{spec:t,spaceKind:n}=e;if(this.seen.has(t.repoKey)){let i=this.kindByRepoKey.get(t.repoKey);if(i!==void 0&&i!==n&&(this.warnings.push(`repo ${t.repoKey} is declared as BOTH AssetSpace and FileSpace by different assets \u2014 treating as AssetSpace (deterministic, conservative); fix the vault (disjoint subtypes)`),i==="file")){this.kindByRepoKey.set(t.repoKey,"asset");let s=this.specs.find(o=>o.repoKey===t.repoKey);s!==void 0&&delete s.spaceKind}return null}return this.seen.add(t.repoKey),this.kindByRepoKey.set(t.repoKey,n),t}commit(e){this.specs.push(e.spec),e.asUid!==void 0&&this.asUidByRepoKey.set(e.spec.repoKey,e.asUid)}};fr.SpaceSpecAccumulator=dx});var rw=T(Ud=>{"use strict";Object.defineProperty(Ud,"__esModule",{value:!0});Ud.REF_NOT_FOUND_HINT=void 0;Ud.isAuthError=ofe;Ud.isRefNotFoundError=afe;var aU=Pm();function ofe(r){let e=r instanceof Error?r.message:String(r);return/HTTP 401/.test(e)?!0:/HTTP 403/.test(e)&&!/rate limit/i.test(e)&&!/abuse detection/i.test(e)}a(ofe,"isAuthError");function afe(r){let e=r instanceof Error?r.message:String(r);return/\/git\/refs\/heads\/\S* → HTTP 404\b/.test(e)}a(afe,"isRefNotFoundError");Ud.REF_NOT_FOUND_HINT=`GitHub answers 404 for a private repo outside a fine-grained PAT's repository allowlist (existence-hiding), for a deleted/renamed repo, and for a visible repo that has no \`${aU.SYNC_BRANCH}\` branch (ExoSync syncs \`${aU.SYNC_BRANCH}\` only) \u2014 check the token's repository allowlist first (R8)`});var px=T(nw=>{"use strict";Object.defineProperty(nw,"__esModule",{value:!0});nw.scanForSecrets=cfe;nw.redactSecrets=lfe;var cU=[{kind:"github-token",re:/gh[pousr]_[A-Za-z0-9_]{36,}/},{kind:"github-fine-grained-token",re:/github_pat_[A-Za-z0-9_]{22,}_[A-Za-z0-9_]{59,}/},{kind:"private-key",re:/-----BEGIN [A-Z ]*PRIVATE KEY-----/}];function cfe(r){let e=[];for(let[t,n]of r)for(let{kind:i,re:s}of cU)s.test(n)&&e.push({path:t,kind:i});return e}a(cfe,"scanForSecrets");function lfe(r){let e=r;for(let{kind:t,re:n}of cU)e=e.replace(new RegExp(n.source,"g"),`[REDACTED:${t}]`);return e}a(lfe,"redactSecrets")});var iw=T(Ha=>{"use strict";Object.defineProperty(Ha,"__esModule",{value:!0});Ha.DEFAULT_MAX_FILE_BYTES=Ha.InMemoryQuarantineStore=void 0;Ha.contentEquals=ufe;Ha.isSyncablePath=ffe;Ha.isFileSpaceSyncablePath=dfe;function ufe(r,e){if(r===void 0||e===void 0||typeof r=="string"&&typeof e=="string")return r===e;if(typeof r=="string"||typeof e=="string"||r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0}a(ufe,"contentEquals");var hx=class{static{a(this,"InMemoryQuarantineStore")}constructor(){this.entries=[]}async quarantine(e){this.entries.push(e)}};Ha.InMemoryQuarantineStore=hx;function ffe(r){return r.endsWith(".md")&&!r.includes(".local.")&&!r.includes(".conflict.")}a(ffe,"isSyncablePath");function dfe(r){return!r.includes(".local.")&&!r.includes(".conflict.")}a(dfe,"isFileSpaceSyncablePath");Ha.DEFAULT_MAX_FILE_BYTES=30*1024*1024});var _U=T(xn=>{"use strict";Object.defineProperty(xn,"__esModule",{value:!0});xn.SyncEngine=xn.DEFAULT_LOCAL_MANIFEST_REHASH_MS=xn.DEFAULT_MAX_TOTAL_RATELIMIT_WAIT_MS=xn.DEFAULT_MAX_PUSH_RETRIES=void 0;xn.syncProgressPhaseText=hfe;xn.isNonFastForwardError=yU;xn.orderChildrenFirst=Efe;var lU=YS(),uU=ix(),dt=Au(),eo=Rm(),pfe=Zl(),Yc=qc(),mx=JB(),gx=ew(),yx=rw(),fU=px(),dU=Pm(),pU=xm(),to=iw();xn.DEFAULT_MAX_PUSH_RETRIES=3;xn.DEFAULT_MAX_TOTAL_RATELIMIT_WAIT_MS=3e5;xn.DEFAULT_LOCAL_MANIFEST_REHASH_MS=720*60*1e3;function hfe(r){switch(r.phase){case"reading-local":return r.detail!==void 0?`reading local files ${r.detail.done}\u2026`:"reading local files\u2026";case"detecting":return"detecting changes\u2026";case"pulling-remote":return"pulling remote tree\u2026";case"fetching-blobs":return r.detail!==void 0?`fetching remote files ${r.detail.done}/${r.detail.total}\u2026`:"fetching remote files\u2026";case"writing-files":return r.detail!==void 0?`writing files ${r.detail.done}\u2026`:"writing files\u2026";case"merging":return"merge layer firing\u2026";default:return r.phase}}a(hfe,"syncProgressPhaseText");var hU=25,mfe=10,gfe=6,yfe=500,_fe=25;function bfe(r){try{return new TextDecoder("utf-8",{fatal:!0}).decode(r)}catch{return null}}a(bfe,"decodeUtf8Strict");function Sfe(r){return typeof r=="string"?r:{base64:(0,pfe.bytesToBase64)(r)}}a(Sfe,"toCommitContent");async function _x(r,e){if(r.readBinary===void 0)throw new Error("LocalFilesPort.readBinary is required for file-mode sync (Phase C)");return r.readBinary(e)}a(_x,"readBinaryStrict");async function mU(r,e,t){if(r.writeBinary===void 0)throw new Error("LocalFilesPort.writeBinary is required for file-mode sync (Phase C)");return r.writeBinary(e,t)}a(mU,"writeBinaryStrict");function bx(r){return r.length===0||r.startsWith("/")||r.includes("\\")?!1:r.split("/").every(e=>e.length>0&&e!=="."&&e!=="..")}a(bx,"isSafeRepoRelativePath");function wfe(r){return r.length===0||r.startsWith("/")?!1:r.split("/").every(e=>e.length>0&&e!=="."&&e!=="..")}a(wfe,"isTraversalFreeLocalPath");function yU(r){let e=r instanceof Error?r.message:String(r);return/HTTP 422/.test(e)&&/git\/refs/.test(e)||/ref update mismatch/.test(e)||/HTTP 422/.test(e)&&/git\/trees/.test(e)&&/BadObjectState/.test(e)}a(yU,"isNonFastForwardError");function Efe(r){let e=a(t=>t.split("/").filter(n=>n.length>0).length,"depth");return[...r].sort((t,n)=>e(n.localPath)-e(t.localPath))}a(Efe,"orderChildrenFirst");function gU(r,e){let t=new Map(r.map(o=>[o.path,o])),n=new Set,i=[];for(let o of e){n.add(o.path);let c=t.get(o.path);(c===void 0||c.blobSha!==o.blobSha)&&i.push(o)}let s=r.filter(o=>!n.has(o.path));return{changed:i,deleted:s}}a(gU,"diffTrees");function vfe(r){let e=r instanceof Error?r.message:String(r);return/→ HTTP (?:404|422)\b/.test(e)}a(vfe,"isCommitUnknownError");function Ya(r){return r instanceof Error?r.message:String(r)}a(Ya,"errMsg");function Tfe(r,e,t){if(t.size===0)return r;let n=new Map(e.files.map(o=>[o.path,o])),i=new Set(r.map(o=>o.path)),s=[];for(let o of r){if(!t.has(o.path)){s.push(o);continue}let c=n.get(o.path);c!==void 0&&s.push(c)}for(let o of t){if(i.has(o))continue;let c=n.get(o);c!==void 0&&s.push(c)}return s}a(Tfe,"applyWatermarkPins");var Sx={mergedFiles:new Map,mergedWrites:[],quarantineEntries:[],resolvedQuarantineEntries:[],mergedCount:0,mergedPaths:[],warnings:[]};function wx(r){return new Map(r.map(e=>[e.path,e.blobSha]))}a(wx,"treeByPath");function sw(r){return[...r.quarantineEntries.map(e=>e.path),...r.resolvedQuarantineEntries.map(e=>e.path)]}a(sw,"quarantinedPathsOf");var Ex=class{static{a(this,"SyncEngine")}constructor(e){this.activeTimer=null,this.activeLocalIoProgress=null,this.opInProgress=!1,this.deps=e,this.now=e.now??(()=>Date.now()),this.rateLimitBudget=(0,pU.createRateLimitBudget)(e.backoff?.maxTotalRateLimitWaitMs??xn.DEFAULT_MAX_TOTAL_RATELIMIT_WAIT_MS),this.transport=this.instrumentTransport((0,pU.withRateLimitBackoff)(e.transport,{...e.backoff,budget:this.rateLimitBudget,now:this.now})),this.probeTransport=this.instrumentTransport(e.transport),this.sha1=this.instrumentSha1(e.sha1)}instrumentTransport(e){return async t=>{let n=this.activeTimer;return n===null?e(t):(n.bumpRest(),n.time((0,uU.classifyRestPhase)(t),async()=>{let i=await e(t);return n.observeQuota(i.headers),i}))}}instrumentSha1(e){return t=>{let n=this.activeTimer;return n===null?e(t):(n.bumpHashed(),n.time("hash",()=>e(t)))}}instrumentLocalFiles(e){let t=a((c,l)=>{let u=this.activeTimer;return u===null?l():u.time(c,l)},"timed"),n={list:a(()=>t("localList",()=>e.list()),"list"),read:a(c=>(this.activeTimer?.bumpRead(),this.bumpReadProgress(),t("localRead",()=>e.read(c))),"read"),write:a((c,l)=>t("localWrite",()=>(this.activeTimer?.bumpWritten(),this.bumpWriteProgress(),e.write(c,l))),"write"),delete:a(c=>e.delete(c),"delete")},i=e.readBinary?.bind(e);i!==void 0&&(n.readBinary=c=>(this.activeTimer?.bumpRead(),this.bumpReadProgress(),t("localRead",()=>i(c))));let s=e.writeBinary?.bind(e);s!==void 0&&(n.writeBinary=(c,l)=>t("localWrite",()=>(this.activeTimer?.bumpWritten(),this.bumpWriteProgress(),s(c,l))));let o=e.stat?.bind(e);return o!==void 0&&(n.stat=c=>t("localList",()=>o(c))),n}busyResult(e){return{repoKey:e.repoKey,status:"busy",pulledCount:0,pushedCount:0,mergedCount:0,quarantinedCount:0,warnings:[],deferredDeletes:[],detail:"another sync operation is in progress (D11 guard) \u2014 retry after it finishes"}}modeOps(e){let t=e.spaceKind==="file",n=t?to.isFileSpaceSyncablePath:to.isSyncablePath,i=this.deps.maxFileBytes??to.DEFAULT_MAX_FILE_BYTES;return{fileMode:t,syncable:n,treeFilter:a(s=>n(s.path)&&(!t||s.size===void 0||s.size<=i),"treeFilter")}}async buildFileModeFirstSyncBase(e,t,n,i){let s=await(0,dt.getHeadSha)(this.transport,e.owner,e.repo,e.branch,this.deps.baseURL),o=await(0,dt.getCommitInfo)(this.transport,e.owner,e.repo,s,this.deps.baseURL),c=(await(0,dt.getTree)(this.transport,e.owner,e.repo,o.treeSha,this.deps.baseURL)).filter(n.treeFilter),l=[];for(let u of c){let f=t.get(u.path);f!==void 0&&await(0,Yc.gitBlobSha)(f,this.sha1)===u.blobSha&&l.push({path:u.path,blobSha:u.blobSha})}return i.push(`first-sync (file mode): synthetic base from ${l.length} already-identical file(s) at head ${s} \u2014 divergence resolves through the remote-wins layer (D22)`),{lastSyncedSha:s,rootTreeSha:o.treeSha,files:l,spaceKind:"file"}}async syncAll(e,t="sync",n){if(this.opInProgress)return e.map(i=>this.busyResult(i));this.opInProgress=!0,this.rateLimitBudget.reset();try{let i=[];for(let s of e)i.push(await this.syncLocked(s,t,n));return i}finally{this.opInProgress=!1}}async sync(e,t="sync",n){if(this.opInProgress)return this.busyResult(e);this.opInProgress=!0,this.rateLimitBudget.reset();try{return await this.syncLocked(e,t,n)}finally{this.opInProgress=!1}}emitProgress(e,t,n,i){if(e!==void 0)try{e(i===void 0?{repoKey:t,phase:n}:{repoKey:t,phase:n,detail:i})}catch{}}bumpReadProgress(){let e=this.activeLocalIoProgress;e!==null&&(e.reads+=1,e.reads%yfe===0&&this.emitProgress(e.emit,e.repoKey,"reading-local",{done:e.reads}))}bumpWriteProgress(){let e=this.activeLocalIoProgress;e!==null&&(e.writes+=1,e.writes%_fe===0&&this.emitProgress(e.emit,e.repoKey,"writing-files",{done:e.writes}))}async syncLocked(e,t="sync",n){let i=new uU.SyncPhaseTimer(this.now),s=this.activeTimer;this.activeTimer=i;let o=this.activeLocalIoProgress;this.activeLocalIoProgress=n!==void 0?{emit:n,repoKey:e.repoKey,reads:0,writes:0}:null;let c=[],l=[],u=0,f=0,d=[],p=a((h,g={})=>({repoKey:e.repoKey,status:h,pulledCount:0,pushedCount:0,mergedCount:0,quarantinedCount:0,warnings:c,deferredDeletes:l,...u>0?{outboxPushedCount:u}:{},...f>0?{outboxReconflictedCount:f}:{},timings:i.snapshot(),...e.pullOnly===!0?{pullOnly:!0}:{},...g}),"result");try{if(e.pullOnly===!0&&t==="push")return p("skipped-pull-only",{detail:`pull-only repo (${dU.PULL_ONLY_LIST_PATH}): push skipped \u2014 local changes are never sent; pull mirrors the remote head`});let h=await this.deps.materializationCheck.check(e);if(!h.fullyMaterialized)return c.push(`skipped: repo not fully materialized${h.reason?` (${h.reason})`:""} \u2014 deletes NOT inferred (D19)`),p("skipped-not-materialized");let g=this.modeOps(e),m=this.instrumentLocalFiles(this.deps.localFilesFor(e));if(g.fileMode&&(m.readBinary===void 0||m.writeBinary===void 0))return p("error",{detail:"file-mode repo requires a LocalFilesPort with readBinary/writeBinary \u2014 refusing to sync through the text-only port (binary would corrupt)"});if(e.pullOnly===!0)return await this.mirrorPullOnly(e,t,m,g,c,p,n);if(g.fileMode&&this.deps.quarantine===void 0)return p("error",{detail:"file-mode repo requires a quarantine sink (D18 remote-wins preserves losing local bytes there) \u2014 configure the quarantine repo before syncing FileSpaces"});let _=this.deps.maxFileBytes??to.DEFAULT_MAX_FILE_BYTES;if(t!=="pull"&&this.deps.outbox!==void 0){let q=await this.flushOutbox(e,c);u=q.pushed,f=q.reconflicted}let b=await this.deps.watermarkStore.get(e.repoKey);if(b?.spaceKind==="file"&&!g.fileMode)return p("error",{detail:"watermark was written by a FILE-mode sync but the spec now resolves to asset mode \u2014 refusing (fix the conflicting Space declarations, or clear the watermark to restart)"});b!==null&&g.fileMode&&b.spaceKind!=="file"&&(c.push("watermark was written by an ASSET-mode sync \u2014 rebuilding the base through the file-mode first-sync layer (kind flip)"),b=null);let w=this.deps.localManifestStore!==void 0?m.stat?.bind(m):void 0,v=w!==void 0&&b!==null&&!g.fileMode,E=v&&this.deps.localManifestStore!==void 0?await this.deps.localManifestStore.get(e.repoKey):null,S=this.deps.localManifestFullRehashMs??xn.DEFAULT_LOCAL_MANIFEST_REHASH_MS,R=v&&(E===null||this.now()-E.lastFullRehashMs>=S),C=new Map,P=new Set,D=new Map,F=new Map,$=new Map,H=!1,ee=new Map;if(v&&b!==null)for(let q of b.files)ee.set(q.path,q.blobSha);for(let q of(await m.list()).filter(g.syncable)){if(g.fileMode){let de=await _x(m,q);if(de.byteLength>_){P.add(q),c.push(`skipped oversized file ${q} (${de.byteLength} bytes > ${_} cap) \u2014 excluded from sync symmetrically (Phase C size cap)`);continue}C.set(q,de);continue}if(!v||w===void 0){C.set(q,await m.read(q));continue}let N=await w(q),J=!R&&N!==null?E?.files[q]:void 0;if(N!==null&&J!==void 0&&J.mtimeMs===N.mtimeMs&&J.size===N.size&&J.blobSha===ee.get(q)){D.set(q,{blobSha:J.blobSha,...J.uid!==void 0?{uid:J.uid}:{}}),F.set(q,J.blobSha),$.set(q,N);continue}H=!0,C.set(q,await m.read(q)),N!==null&&$.set(q,N)}let G=!1;if(b===null)if(g.fileMode)G=!0,b=await this.buildFileModeFirstSyncBase(e,C,g,c);else{let q=await this.bootstrapWatermark(e,C,c,p);if(q.kind==="settled")return q.outcome;G=!0,b=q.base}let j=b;g.fileMode&&P.size>0&&(b={...b,files:b.files.filter(q=>!P.has(q.path))});let z,ie;v&&!R?(z=await(0,dt.getHeadSha)(this.transport,e.owner,e.repo,e.branch,this.deps.baseURL),ie=z===b.lastSyncedSha?b.rootTreeSha:await this.resolveBaseTreeSha(e,b,{headReachable:!0})):ie=await this.resolveBaseTreeSha(e,b),this.emitProgress(n,e.repoKey,"detecting");let O=await(0,eo.detectChanges)({localFiles:C,...v?{cachedEntries:D}:{},watermark:b,actualBaseTreeSha:ie,sha1:this.sha1});if(O.kind==="full-conflict")return p("full-conflict",{detail:`${O.reason}${O.detail?`: ${O.detail}`:""} \u2014 divergence must go through merge/quarantine (A2/A3), not overwrite`});if(c.push(...O.warnings),v&&this.deps.localManifestStore!==void 0){let q={};for(let[N,J]of C){let de=$.get(N),Te=O.diskBlobShas.get(N);if(de===void 0||Te===void 0)continue;let Fe=typeof J=="string"?(0,eo.extractAssetUid)(J):void 0;q[N]={mtimeMs:de.mtimeMs,size:de.size,blobSha:Te,...Fe!==void 0?{uid:Fe}:{}}}for(let[N,J]of D){let de=$.get(N);de!==void 0&&(q[N]={mtimeMs:de.mtimeMs,size:de.size,blobSha:J.blobSha,...J.uid!==void 0?{uid:J.uid}:{}})}if(E!==null&&Object.keys(E.files).some(N=>!(N in q))&&(H=!0),H||R||E===null){let N={version:1,files:q,lastFullRehashMs:R||E===null?this.now():E.lastFullRehashMs};await this.deps.localManifestStore.set(e.repoKey,N)}}let U=this.pinLocalChanges(O,C,c,l,t);d=[...U.pushDeletionsAll.keys()];let oe=await this.runPushLoop(e,b,U,C,c,g,G,P,t,n,z);if(d=[],oe.kind!=="done"&&U.pushDeletionsAll.size>0&&l.push(...U.pushDeletionsAll.keys()),oe.kind==="conflict")return p("conflict",{detail:oe.detail});if(oe.kind==="retry-exhausted"){c.push(...oe.merge.warnings);let q=await this.buildTerminalQuarantineEntries(e,b,oe.pushFiles,oe.merge.quarantineEntries,C),N=[...oe.merge.quarantineEntries,...oe.merge.resolvedQuarantineEntries,...q];return await this.flushQuarantine(N,c),p("retry-exhausted",{detail:oe.detail,quarantinedCount:N.length,...N.length>0?{quarantinedPaths:N.map(J=>J.path)}:{}})}let{examinedHead:we,pushedSha:X,applyWrites:te,applyDeletes:re,pushFiles:Z}=oe,le=oe.merge;c.push(...le.warnings),c.push(...oe.deferredWarnings),l.push(...oe.withheldDeletions);let he=oe.deferredPaths.size>0?{deferredPaths:[...oe.deferredPaths]}:{},B=oe.pushedDeletions.length>0?{pushedDeletes:oe.pushedDeletions}:{},ue=await this.flushQuarantine([...le.quarantineEntries,...le.resolvedQuarantineEntries],c);oe.secretQuarantineEntries.length>0&&await this.flushQuarantine(oe.secretQuarantineEntries,c);let ne=new Set;if(!ue&&le.resolvedQuarantineEntries.length>0){for(let q of le.resolvedQuarantineEntries)ne.add(q.path);c.push(`quarantine flush failed \u2014 remote-wins apply withheld for ${ne.size} path(s); local files untouched, conflict re-derives next sync (D18 durability gate)`)}if(X===void 0&&we===b.lastSyncedSha&&te.length===0&&re.length===0&&le.mergedWrites.length===0&&le.quarantineEntries.length===0&&le.resolvedQuarantineEntries.length===0&&(b.pinnedPaths?.length??0)===0&&oe.alreadyInHead.length===0&&oe.deferredPaths.size===0&&!G)return p("synced");let ve=X??we,ge=await(0,dt.getCommitInfo)(this.transport,e.owner,e.repo,ve,this.deps.baseURL);if(X!==void 0&&ge.parents[0]!==we)return await this.checkRaceWindow(e,b,we,ge.parents[0],Z,new Set(oe.pushedDeletions),c,g),c.push(`race-window: watermark NOT advanced (pushed commit's parent ${ge.parents[0]} != examined head ${we}) \u2014 next sync reconciles the concurrent change`),p("synced",{pushedSha:X,pushedCount:Z.size,mergedCount:le.mergedCount,quarantinedCount:le.quarantineEntries.length+le.resolvedQuarantineEntries.length,...le.mergedPaths.length>0?{mergedPaths:le.mergedPaths}:{},...sw(le).length>0?{quarantinedPaths:sw(le)}:{},...he,...B});let{pulledCount:Ce,pinnedPaths:xe,pulledPaths:me}=await this.applyRemoteChanges(m,C,[...te,...le.mergedWrites].filter(q=>!ne.has(q.path)),re.filter(q=>!ne.has(q.path)),c,F);for(let q of le.quarantineEntries)xe.add(q.path);for(let q of oe.deferredPaths)xe.add(q);for(let q of ne)xe.add(q);if(g.fileMode){for(let q of P)xe.add(q);for(let q of oe.remoteOversized)xe.add(q)}return await this.advanceWatermark(e,ve,ge.treeSha,C,[...te,...le.mergedWrites,...oe.deferredRemoteChanges],j,xe,O.diskBlobShas,g,P),await this.resolveClearedPins(e,j,xe,c,new Set(le.resolvedQuarantineEntries.map(q=>q.path))),p("synced",{pushedSha:X,pulledCount:Ce,pushedCount:Z.size,mergedCount:le.mergedCount,quarantinedCount:le.quarantineEntries.length+le.resolvedQuarantineEntries.length,...le.mergedPaths.length>0?{mergedPaths:le.mergedPaths}:{},...me.length>0?{pulledPaths:me}:{},...sw(le).length>0?{quarantinedPaths:sw(le)}:{},...he,...B})}catch(h){let g=this.deps.redact??(m=>m);if(d.length>0&&l.push(...d),(0,yx.isAuthError)(h))return p("auth-required",{detail:g(`authentication failed: ${Ya(h)} \u2014 the PAT is expired, revoked or under-scoped; update it in the per-device secure storage (R8). Never treated as success.`)});if((0,yx.isRefNotFoundError)(h)){let m=g(`${e.owner}/${e.repo}@${e.branch} is not reachable: ${Ya(h)} \u2014 ${yx.REF_NOT_FOUND_HINT}`);return c.push(`sync failed: ${m}`),p("error",{detail:m})}return c.push(`sync failed: ${g(Ya(h))}`),p("error",{detail:g(Ya(h))})}finally{this.activeTimer=s,this.activeLocalIoProgress=o}}async mirrorPullOnly(e,t,n,i,s,o,c){let l=this.deps.maxFileBytes??to.DEFAULT_MAX_FILE_BYTES;this.emitProgress(c,e.repoKey,"pulling-remote");let u=await(0,dt.getHeadSha)(this.transport,e.owner,e.repo,e.branch,this.deps.baseURL),f=await(0,dt.getCommitInfo)(this.transport,e.owner,e.repo,u,this.deps.baseURL),d=(await(0,dt.getTree)(this.transport,e.owner,e.repo,f.treeSha,this.deps.baseURL)).filter(F=>i.syncable(F.path)),p=new Set(d.map(F=>F.path)),h=(await n.list()).filter(i.syncable),g=new Set(h),m=a(F=>F.normalize("NFC"),"nfc"),_=new Map;for(let F of h)_.has(m(F))||_.set(m(F),F);let b=new Set,w=[],v=[],E=[],S=[],R=a(F=>typeof F=="string"?(0,eo.extractAssetUid)(F):void 0,"uidOf"),C=a((F,$,H)=>{let ee=R(H);S.push({path:F,blobSha:$,...ee?{uid:ee}:{}})},"pushEntry");for(let F of d){if(!bx(F.path)){s.push(`unsafe remote path skipped by the pull-only mirror: ${F.path}`);continue}if(i.fileMode&&F.size!==void 0&&F.size>l){s.push(`pull-only mirror skipped oversized remote file ${F.path} (${F.size} bytes > ${l} cap) \u2014 the local copy, if any, is left as is (Phase C size cap)`);continue}let $,H=g.has(F.path)?F.path:_.get(m(F.path));if(H!==void 0&&(b.add(H),$=i.fileMode?await _x(n,H):await n.read(H),await(0,Yc.gitBlobSha)($,this.sha1)===F.blobSha)){C(F.path,F.blobSha,$);continue}let ee;i.fileMode?(ee=await(0,dt.getBlobBytes)(this.transport,e.owner,e.repo,F.blobSha,this.deps.baseURL),await mU(n,F.path,ee)):(ee=await(0,dt.getBlobText)(this.transport,e.owner,e.repo,F.blobSha,this.deps.baseURL),await n.write(F.path,ee)),($===void 0?v:w).push(F.path),C(F.path,F.blobSha,ee)}for(let F of h)if(!(p.has(F)||b.has(F))){if(!wfe(F)){s.push(`unsafe local path left untouched by the pull-only mirror: ${F}`);continue}await n.delete(F),E.push(F)}let P=await this.deps.watermarkStore.get(e.repoKey);if(await this.deps.watermarkStore.set(e.repoKey,{lastSyncedSha:u,rootTreeSha:f.treeSha,files:S,...i.fileMode?{spaceKind:"file"}:{}}),P!==null&&await this.resolveClearedPins(e,P,new Set,s),this.deps.outbox!==void 0){let F=await this.deps.outbox.listForRepo(e.repoKey);for(let $ of F)await this.deps.outbox.remove(e.repoKey,$.path);F.length>0&&s.push(`pull-only repo: dropped ${F.length} queued conflict resolution(s) \u2014 a pull-only repo is never pushed`)}w.sort(),v.sort(),E.sort();let D=[...w,...v,...E];return o("synced",{pulledCount:D.length,...D.length>0?{pulledPaths:D}:{},mirrored:{restored:w,added:v,removed:E},...t==="sync"?{detail:`pull-only repo (${dU.PULL_ONLY_LIST_PATH}): push phase skipped-pull-only \u2014 mirrored to the remote head ${u.slice(0,7)}`}:{}})}async flushQuarantine(e,t){if(e.length===0)return!0;let n=this.deps.redact??(s=>s);for(let s of e)t.push(n(`quarantined ${s.path}: ${s.reason}`));let i=this.deps.quarantine;if(i===void 0)return!1;try{if(i.quarantineAll!==void 0)await i.quarantineAll(e);else for(let s of e)await i.quarantine(s);return!0}catch(s){let o=this.deps.redact??(c=>c);return t.push(`quarantine sink failed: ${o(Ya(s))} \u2014 files untouched on disk; the conflict re-derives next sync (D17 degradation)`),!1}}async flushOutbox(e,t){let n=this.deps.outbox;if(n===void 0)return{pushed:0,reconflicted:0};let i=await n.listForRepo(e.repoKey);if(i.length===0)return{pushed:0,reconflicted:0};let s=this.deps.redact??(g=>g),o,c;try{({head:o,shaByPath:c}=await this.outboxHeadTreeShas(e))}catch(g){return t.push(`outbox flush deferred (${i.length} resolution(s) awaiting push): ${s(Ya(g))}`),{pushed:0,reconflicted:0}}let l=0,u=[];for(let g of i){let m=c.get(g.path)??gx.OUTBOX_REMOTE_ABSENT,_=m===gx.OUTBOX_REMOTE_ABSENT&&g.baseRemoteSha!==gx.OUTBOX_REMOTE_ABSENT?[...c].filter(([b,w])=>b!==g.path&&w===g.baseRemoteSha).map(([b])=>b):[];if(m!==g.baseRemoteSha&&_.length===0){await n.remove(g.repoKey,g.path),l++,t.push(s(`outbox: remote moved for ${g.path} since you resolved it \u2014 NOT pushed; resolve again (your choice is preserved on disk)`));continue}u.push({entry:g,stalePaths:_})}if(u.length===0)return{pushed:0,reconflicted:l};let f=new Map;for(let{entry:g}of u)f.set(g.path,g.chosenContent);let d=new Set;for(let{stalePaths:g}of u)for(let m of g)f.has(m)||d.add(m);let p=[...d];try{await(0,lU.restCreateCommit)(this.transport,{owner:e.owner,repo:e.repo,branch:e.branch,files:f,...p.length>0?{deletions:p}:{},message:p.length>0?`chore(exosync): resolve ${u.length} keep-local conflict(s) (consolidate ${p.length} stale remote path(s))`:`chore(exosync): push ${u.length} resolved conflict(s)`,expectedHeadSha:o,...this.deps.baseURL!==void 0?{baseURL:this.deps.baseURL}:{},...this.deps.redact!==void 0?{redact:this.deps.redact}:{}})}catch(g){return t.push(`outbox: batch push deferred for ${u.length} resolution(s), will retry next sync: ${s(Ya(g))}`),{pushed:0,reconflicted:l}}let h=0;for(let{entry:g,stalePaths:m}of u){let _=m.filter(b=>!f.has(b));await this.snapOutboxWatermark(e,g.path,g.chosenContent,_),await this.deps.quarantine?.markResolved?.(g.repoKey,g.path);for(let b of _)await this.deps.quarantine?.markResolved?.(g.repoKey,b);await n.remove(g.repoKey,g.path),h++,_.length>0&&t.push(`consolidated cross-path conflict for ${g.path} \u2014 removed ${_.length} stale remote copy/copies (recoverable in git history)`)}return h>0&&t.push(`pushed ${h} resolved conflict(s)`),{pushed:h,reconflicted:l}}async outboxHeadTreeShas(e){let t=await(0,dt.getHeadSha)(this.transport,e.owner,e.repo,e.branch,this.deps.baseURL),n=await(0,dt.getCommitInfo)(this.transport,e.owner,e.repo,t,this.deps.baseURL),i=await(0,dt.getTree)(this.transport,e.owner,e.repo,n.treeSha,this.deps.baseURL),s=new Map;for(let o of i)s.set(o.path,o.blobSha);return{head:t,shaByPath:s}}async snapOutboxWatermark(e,t,n,i=[]){let s=await this.deps.watermarkStore.get(e.repoKey);if(s===null)return;let o=new Set([t,...i]),c=(s.pinnedPaths??[]).filter(m=>!o.has(m)),l=await(0,Yc.gitBlobSha)(n,this.sha1),u=(0,eo.extractAssetUid)(n),f={path:t,blobSha:l,...u!==void 0?{uid:u}:{}},d=new Set(i),p=s.files.filter(m=>!d.has(m.path)),h=p.findIndex(m=>m.path===t),g=h>=0?p.map((m,_)=>_===h?f:m):[...p,f];await this.deps.watermarkStore.set(e.repoKey,{...s,files:g,...c.length>0?{pinnedPaths:c}:{pinnedPaths:void 0}})}async buildTerminalQuarantineEntries(e,t,n,i,s){let o=new Set(i.map(u=>u.path)),c=new Map;try{let u=await(0,dt.getHeadSha)(this.transport,e.owner,e.repo,e.branch,this.deps.baseURL),f=(await(0,dt.getTree)(this.transport,e.owner,e.repo,(await(0,dt.getCommitInfo)(this.transport,e.owner,e.repo,u,this.deps.baseURL)).treeSha,this.deps.baseURL)).filter(d=>n.has(d.path));for(let d of f)c.set(d.path,await(0,dt.getBlobText)(this.transport,e.owner,e.repo,d.blobSha,this.deps.baseURL))}catch{}let l=[];for(let[u,f]of n){if(o.has(u))continue;let d=s.get(u),p=d??f,h=d!==void 0&&!(0,to.contentEquals)(d,f),g=typeof p=="string"?(0,eo.extractAssetUid)(p):void 0,m=c.get(u);l.push({repoKey:e.repoKey,path:u,...g!==void 0?{uid:g}:{},reason:`non-fast-forward push failed after ${this.deps.maxPushRetries??xn.DEFAULT_MAX_PUSH_RETRIES} retries (D16) \u2014 a concurrent writer keeps moving ${e.branch}; base recoverable from git history at ${t.lastSyncedSha}${h?"; the contended push payload was a merged proposal (never applied to disk) \u2014 the merge re-derives next sync":""}`,...typeof p=="string"?{localContent:p}:{localContentBytes:p},...m!==void 0?{remoteContent:m}:{}})}return l}async resolveClearedPins(e,t,n,i,s=new Set){let o=this.deps.quarantine;if(o===void 0||o.markResolved===void 0)return;let c=(t.pinnedPaths??[]).filter(l=>!n.has(l)&&!s.has(l));for(let l of c)try{await o.markResolved?.(e.repoKey,l)}catch(u){let f=this.deps.redact??(d=>d);i.push(`quarantine markResolved failed for ${l}: ${f(Ya(u))} \u2014 unresolved-count may overcount until the resolver UI reconciles (CQ4)`)}}async resolveBaseTreeSha(e,t,n={}){try{return(await(0,dt.getCommitInfo)(this.transport,e.owner,e.repo,t.lastSyncedSha,this.deps.baseURL)).treeSha}catch(i){if(!vfe(i))throw i;return n.headReachable===!0||await(0,dt.getHeadSha)(this.transport,e.owner,e.repo,e.branch,this.deps.baseURL),null}}pinLocalChanges(e,t,n,i,s){let o=e.modified.filter(p=>p.basePath!==void 0),c=[...e.added,...e.modified.filter(p=>p.basePath===void 0)],l=new Map;if(s==="pull"){for(let p of o)p.basePath!==void 0&&i.push(p.basePath),n.push(`pull-only: rename (uid ${p.uid??"?"}) ${p.basePath} \u2192 ${p.path} not pushed \u2014 propagates on the next push/Sync (#3473)`);for(let p of e.deleted)i.push(p.path),n.push(`pull-only: delete of ${p.path} not pushed \u2014 propagates on the next push/Sync (#3473)`)}else{for(let p of o)p.basePath!==void 0&&l.set(p.basePath,p.path);for(let p of e.deleted)l.set(p.path,p.path)}let u=[...c,...o,...e.deleted.map(p=>({...p}))],f=new Set(e.deleted.map(p=>p.path)),d=new Map;for(let p of[...c,...s==="pull"?[]:o]){let h=t.get(p.path);h!==void 0&&d.set(p.path,h)}return{localChanges:u,localDeletedPaths:f,pushFilesAll:d,pushDeletionsAll:l,dupUids:e.duplicateUids}}async runPushLoop(e,t,n,i,s,o,c=!1,l=new Set,u="sync",f,d){let{localChanges:p,localDeletedPaths:h,pushFilesAll:g,pushDeletionsAll:m,dupUids:_}=n,b=this.deps.maxPushRetries??xn.DEFAULT_MAX_PUSH_RETRIES,w=0,v="",E,S=[],R=[],C=new Map,P=new Set,D=[],F=Sx,$=[],H=new Set,ee=[],G=[],j=new Set,z=[],ie=new Set;for(;;){v=w===0&&d!==void 0&&g.size===0&&m.size===0?d:await(0,dt.getHeadSha)(this.transport,e.owner,e.repo,e.branch,this.deps.baseURL),S=[],R=[],F=Sx,$=[],H=new Set,ee=[],G=[];let O,U=new Set,oe=(t.pinnedPaths?.length??0)>0;if(v!==t.lastSyncedSha||oe||c){this.emitProgress(f,e.repoKey,"pulling-remote");let te=await this.collectRemoteChanges(e,t,v,o,l,s,j,f);O=te.headTreeByPath;let re=this.matchLocalVsRemote(p,h,i,te.changes,U,_,te.headTreeByPath);if(re.conflicts.length>0){if(u==="sync"&&this.emitProgress(f,e.repoKey,"merging"),u!=="sync"){for(let Z of re.conflicts){H.add(Z.local.path),Z.local.basePath!==void 0&&H.add(Z.local.basePath);for(let le of Z.remotes)H.add(le.path),le.kind==="change"&&ee.push(le)}G.push(`${u}-only: ${re.conflicts.length} conflict(s) deferred to a full Sync (${re.conflicts.map(Z=>Z.desc).join("; ")}) \u2014 paths pinned, nothing merged`)}else if(o.fileMode)F=this.resolveFileModeConflicts(e,re.conflicts,i,re.applyWrites,re.applyDeletes);else{if(this.deps.mergeLayer===void 0)return{kind:"conflict",detail:`overlapping change on ${re.conflicts[0].desc} \u2014 merge layer (A2/A3) required; nothing pushed, nothing written`};F=await this.resolveMergeConflicts(e,t,re.conflicts,i,v)}if(u==="sync")for(let Z of re.conflicts)for(let le of Z.remotes)le.path!==Z.local.path&&(H.add(le.path),le.kind==="change"&&ee.push(le),G.push(`conflict group ${Z.desc}: remote change at ${le.path} NOT applied \u2014 pinned to re-derive on the next sync (#3477)`))}if(S=re.applyWrites,R=re.applyDeletes,u==="push"&&(S.length>0||R.length>0)){for(let Z of S)H.add(Z.path),ee.push(Z);for(let Z of R)H.add(Z.path);G.push(`push-only: ${S.length+R.length} remote change(s) NOT applied \u2014 pinned to re-derive on the next pull/Sync`),S=[],R=[]}}C=u==="pull"?new Map:new Map([...[...g].filter(([te])=>!U.has(te)),...F.mergedFiles]),P=new Set,D=[];for(let[te,re]of m){if(U.has(re)){D.push(te);continue}C.has(te)||P.add(te)}if((C.size>0||P.size>0)&&O===void 0&&(O=wx(await(0,dt.getTree)(this.transport,e.owner,e.repo,t.rootTreeSha,this.deps.baseURL))),C.size>0&&O!==void 0){for(let[te,re]of C){let Z=O.get(te);Z!==void 0&&Z===await(0,Yc.gitBlobSha)(re,this.sha1)&&(C.delete(te),$.push(te))}$.length>0&&s.push(`phantom push skipped: ${$.length} file(s) already identical in remote HEAD (${$.join(", ")}) \u2014 excluded from the commit (#3475)`)}if(P.size>0&&O!==void 0){for(let te of[...P])O.has(te)||P.delete(te);C.size===0&&P.size>=O.size&&(D.push(...P),G.push(`deletion of ALL ${P.size} remaining file(s) deferred \u2014 GitHub cannot create an empty tree; the deletes re-derive and propagate once the repo has at least one surviving file`),P.clear())}if(C.size===0&&P.size===0)break;let we=new Map;for(let[te,re]of C)if(typeof re=="string")we.set(te,re);else{let Z=bfe(re);Z!==null&&we.set(te,Z)}let X=(0,fU.scanForSecrets)(we);if(X.length>0){let te=new Map;for(let re of X){let Z=te.get(re.path);Z===void 0?te.set(re.path,[re.kind]):Z.includes(re.kind)||Z.push(re.kind)}for(let[re,Z]of te){if(!ie.has(re)){ie.add(re);let le=we.get(re),he=le!==void 0?(0,fU.redactSecrets)(le):void 0,B=he!==void 0?(0,eo.extractAssetUid)(he):void 0;z.push({repoKey:e.repoKey,path:re,...B!==void 0?{uid:B}:{},reason:`secret-scan (R5): detected ${Z.join(", ")} \u2014 skipped from the push (the secret is NEVER shipped); a redacted copy is quarantined. REVOKE the credential, then re-sync once it is removed.`,...he!==void 0?{localContent:he}:{}})}C.delete(re)}s.push(`secret-scan (R5): skipped ${te.size} file(s) with a detected secret from the push \u2014 the rest of the changeset shipped; REVOKE the credential(s): ${[...te].map(([re,Z])=>`${re} (${Z.join(", ")})`).join(", ")}`);for(let[re,Z]of m)ie.has(Z)&&P.has(re)&&(P.delete(re),D.push(re));if(C.size===0&&P.size===0)break}try{E=await(0,lU.restCreateCommit)(this.transport,{owner:e.owner,repo:e.repo,branch:e.branch,files:new Map([...C].map(([te,re])=>[te,Sfe(re)])),deletions:[...P],message:this.deps.commitMessage?.(e,C.size,P.size)??`chore(exosync): sync ${C.size} file(s)${P.size>0?`, ${P.size} deletion(s)`:""}`,baseURL:this.deps.baseURL,redact:this.deps.redact});break}catch(te){if(!yU(te))throw te;if(w++,w>b)return{kind:"retry-exhausted",detail:`non-fast-forward push failed after ${b} retries (D16 cap) \u2014 contended files routed to quarantine (D17)`,pushFiles:C,merge:F};s.push(`non-fast-forward push (attempt ${w}/${b}) \u2014 re-pulling and retrying (D16)`)}}return{kind:"done",examinedHead:v,pushedSha:E,applyWrites:S,applyDeletes:R,pushFiles:C,pushedDeletions:E!==void 0?[...P]:[],withheldDeletions:D,merge:F,remoteOversized:j,alreadyInHead:$,deferredPaths:H,deferredRemoteChanges:ee,deferredWarnings:G,secretQuarantineEntries:z}}async resolveMergeConflicts(e,t,n,i,s){let o=this.deps.mergeLayer;if(o===void 0)return Sx;let c=new Map(t.files.map(C=>[C.path,C])),l=new Map,u=[],f=[],d=[],p=[],h=0,g=a(C=>typeof C=="string"?C:void 0,"asText"),m=a((C,P,D)=>{let F=g(i.get(C.local.path)),$=g(C.remotes[0]?.content);return{repoKey:e.repoKey,path:C.local.path,...C.local.uid!==void 0?{uid:C.local.uid}:{},reason:P,...D!==void 0?{baseContent:D}:{},...F!==void 0?{localContent:F}:{},...$!==void 0?{remoteContent:$}:{}}},"entry"),_=a(C=>c.get(C.local.basePath??C.local.path)??c.get(C.remotes[0]?.path??""),"baseEntryOf"),b=a(C=>{let P=C.remotes.length===1?C.remotes[0]:void 0;if(!(P===void 0||P.kind!=="change")&&typeof P.content=="string"&&P.path===C.local.path)return g(i.get(C.local.path))},"historyLocal"),w=this.deps.historyBaseRequestBudget??mx.HISTORY_BASE_REQUEST_BUDGET,v=w,E=n.filter(C=>_(C)===void 0&&b(C)!==void 0).length,S=0,R;for(let C of n){let P=_(C),D;if(P!==void 0)D=await(0,dt.getBlobText)(this.transport,e.owner,e.repo,P.blobSha,this.deps.baseURL);else{let G=b(C);if(G!==void 0){if(v<=0)w>0&&S++;else{let j=Math.min(v,Math.max(mx.HISTORY_BASE_MIN_SHARE,Math.floor(v/E))),z={remaining:j},ie=await(0,mx.recoverBaseFromHistory)({transport:this.probeTransport,owner:e.owner,repo:e.repo,baseURL:this.deps.baseURL,sha1:this.sha1,path:C.local.path,head:s,local:G,budget:z});v-=j-z.remaining,ie.kind==="recovered"?(D=ie.base,d.push(`merge(${C.local.path}): no 3-way base recorded \u2014 the local copy matches the remote version at ${ie.commitSha.slice(0,7)}, treated as behind and used as the base`)):ie.kind==="budget-exhausted"?S++:ie.kind==="aborted"&&(v=0,R=ie.reason,S++)}E--}}if(C.remotes.length>1){f.push(m(C,`ambiguous conflict: local change overlaps ${C.remotes.length} remote changes (${C.remotes.map(G=>G.path).join(", ")})`,D));continue}let F=C.remotes[0],$=g(i.get(C.local.path)),H=await o.resolve({path:C.local.path,...C.local.uid!==void 0?{uid:C.local.uid}:{},...D!==void 0?{base:D}:{},...$!==void 0?{local:$}:{},...F.kind==="change"&&typeof F.content=="string"?{remote:F.content}:{}});if(H.action==="quarantine"){f.push(m(C,H.reason,D));continue}h++,p.push(C.local.path);for(let G of H.warnings??[])d.push(`merge(${C.local.path}): ${G}`);let ee=F.kind==="change"?F.content:void 0;if(H.content!==ee&&l.set(C.local.path,H.content),H.content!==i.get(C.local.path)){let G=(0,eo.extractAssetUid)(H.content)??C.local.uid;u.push({path:C.local.path,kind:"change",content:H.content,blobSha:await(0,Yc.gitBlobSha)(H.content,this.sha1),...G!==void 0?{uid:G}:{}})}}return S>0&&d.push(`history base recovery: ${S} no-base conflict(s) not fully checked this pass (${R==="rate-limit"?"GitHub rate limit":R==="request-failure"?"a probe request failed":"request budget"}) \u2014 merged without a base; they re-derive on the next sync`),{mergedFiles:l,mergedWrites:u,quarantineEntries:f,resolvedQuarantineEntries:[],mergedCount:h,mergedPaths:p,warnings:d}}resolveFileModeConflicts(e,t,n,i,s){let o=[],c=[];for(let l of t){l.remotes.length>1&&c.push(`file-mode conflict on ${l.local.path} unexpectedly overlaps ${l.remotes.length} remote changes \u2014 resolving against the first`);let u=l.remotes[0],f=n.get(l.local.path);u.kind==="change"?i.push(u):s.push(u),!(l.localIsDelete||f===void 0)&&o.push({repoKey:e.repoKey,path:l.local.path,reason:`file-mode remote-wins (D18): remote ${u.kind==="change"?`version ${u.blobSha}`:"delete"} wins; this is the losing LOCAL version, preserved byte-exact`,...typeof f=="string"?{localContent:f}:{localContentBytes:f}})}return{mergedFiles:new Map,mergedWrites:[],quarantineEntries:[],resolvedQuarantineEntries:o,mergedCount:0,mergedPaths:[],warnings:c}}async applyRemoteChanges(e,t,n,i,s,o=new Map){let c=0,l=new Set,u=[],f=a(async(h,g)=>{try{return g?await _x(e,h):await e.read(h)}catch{return}},"tryRead"),d=a(async(h,g)=>{typeof g=="string"?await e.write(h,g):await mU(e,h,g)},"writeContent"),p=a(async h=>{let g=await f(h,!1);return g===void 0?!0:await(0,Yc.gitBlobSha)(g,this.sha1)===o.get(h)},"cacheHitUnchanged");for(let h of n){if(h.content===void 0)continue;if(!bx(h.path)){s.push(`unsafe remote path skipped on pull-apply: ${h.path}`),l.add(h.path);continue}let g=t.get(h.path);if(g===void 0&&o.has(h.path)){if(!await p(h.path)){s.push(`pull-apply skipped: ${h.path} changed on disk mid-sync (TOCTOU) \u2014 remote change re-derives next sync`),l.add(h.path);continue}await d(h.path,h.content),c++,u.push(h.path);continue}let m=await f(h.path,typeof(g??h.content)!="string");if(!(0,to.contentEquals)(m,g)){s.push(`pull-apply skipped: ${h.path} changed on disk mid-sync (TOCTOU) \u2014 remote change re-derives next sync`),l.add(h.path);continue}await d(h.path,h.content),c++,u.push(h.path)}for(let h of i){if(!bx(h.path)){s.push(`unsafe remote path skipped on pull-delete: ${h.path}`),l.add(h.path);continue}let g=t.get(h.path);if(g===void 0&&o.has(h.path)){if(!await p(h.path)){s.push(`pull-delete skipped: ${h.path} changed on disk mid-sync (TOCTOU) \u2014 delete-vs-modify re-derives next sync`),l.add(h.path);continue}await e.delete(h.path),c++,u.push(h.path);continue}if(g!==void 0){let m=await f(h.path,typeof g!="string");if(m!==void 0&&!(0,to.contentEquals)(m,g)){s.push(`pull-delete skipped: ${h.path} changed on disk mid-sync (TOCTOU) \u2014 delete-vs-modify re-derives next sync`),l.add(h.path);continue}await e.delete(h.path),c++,u.push(h.path)}}return{pulledCount:c,pinnedPaths:l,pulledPaths:u}}async advanceWatermark(e,t,n,i,s,o,c,l,u,f=new Set){let d=(await(0,dt.getTree)(this.transport,e.owner,e.repo,n,this.deps.baseURL)).filter(h=>u.treeFilter(h)&&!f.has(h.path)),p=Tfe(await this.buildWatermarkFiles(e,d,i,s,o,l,u),o,c);await this.deps.watermarkStore.set(e.repoKey,{lastSyncedSha:t,rootTreeSha:n,files:p,...c.size>0?{pinnedPaths:[...c]}:{},...u.fileMode?{spaceKind:"file"}:{}})}async tryMountBaseBootstrap(e,t,n,i,s){let o=this.deps.mountBaseStore,c=null;if(o!==void 0)try{c=await o.get(e.repoKey)}catch{return null}let l=!1;if(c===null&&this.deps.localBaseShaProvider!==void 0)try{let _=await this.deps.localBaseShaProvider(e);typeof _=="string"&&_.length>0&&(c=_,l=!0)}catch{}if(c===null||t.startsWith(c))return null;let u=300,f=null;try{let _=t;for(let b=0;b<u;b++){let w=await(0,dt.getCommitInfo)(this.transport,e.owner,e.repo,_,this.deps.baseURL);if(w.sha===c||w.sha.startsWith(c)){f=w;break}if(w.parents.length===0)break;_=w.parents[0]}}catch{return null}if(f===null)return null;let d;try{d=(await(0,dt.getTree)(this.transport,e.owner,e.repo,f.treeSha,this.deps.baseURL)).filter(_=>(0,to.isSyncablePath)(_.path))}catch{return null}let p;try{let _=await(0,dt.getCommitInfo)(this.transport,e.owner,e.repo,t,this.deps.baseURL);p=wx((await(0,dt.getTree)(this.transport,e.owner,e.repo,_.treeSha,this.deps.baseURL)).filter(b=>(0,to.isSyncablePath)(b.path)))}catch{return null}let h=d.filter(_=>!n.has(_.path)&&p.get(_.path)===_.blobSha);if(h.length>0){let _=h.slice(0,3).map(b=>b.path).join(", ")+(h.length>3?", \u2026":"");return i.push(`first-sync (asset mode): base-tree\u2286working-tree sanity guard fired \u2014 ${h.length} base file(s) absent from the working tree but UNCHANGED on remote head (${_}); the verified-ancestor base may not match the working tree's derivation commit (out-of-band submodule manipulation) \u2192 routing to merge/quarantine instead of inferring a silent deletion (#3610)`),{kind:"settled",outcome:s("full-conflict",{detail:`first-sync: base-tree\u2286working-tree sanity guard \u2014 ${h.length} base file(s) absent from the working tree are unchanged on remote head (${_}); refusing to infer a silent deletion from a base that may not match the derivation commit \u2014 divergence must go through merge/quarantine (A2/A3), never a silent delete (#3610)`})}}let g=d.map(_=>({path:_.path,blobSha:_.blobSha})),m={lastSyncedSha:f.sha,rootTreeSha:f.treeSha,files:g};if(l&&o!==void 0)try{await o.set(e.repoKey,f.sha)}catch{}return i.push(l?`first-sync (asset mode): BACKFILLED the 3-way base from the locally checked-out commit ${f.sha} (no recorded mount base) \u2014 remote head ${t} advanced since; local edits 3-way merge against it instead of false-conflicting (#3590)`:`first-sync (asset mode): reconciling against the recorded mount base ${f.sha} \u2014 remote head ${t} advanced since mount; local edits 3-way merge against it instead of false-conflicting (#3590)`),{kind:"additive-base",base:m}}async bootstrapWatermark(e,t,n,i){let s=await(0,dt.getHeadSha)(this.transport,e.owner,e.repo,e.branch,this.deps.baseURL),o=await this.tryMountBaseBootstrap(e,s,t,n,i);if(o!==null)return o;let c=await(0,dt.getCommitInfo)(this.transport,e.owner,e.repo,s,this.deps.baseURL),l=(await(0,dt.getTree)(this.transport,e.owner,e.repo,c.treeSha,this.deps.baseURL)).filter(p=>(0,to.isSyncablePath)(p.path)),u=[],f;for(let p of l){let h=t.get(p.path);if(h===void 0||await(0,Yc.gitBlobSha)(h,this.sha1)!==p.blobSha){f===void 0&&(f=p.path);continue}let g=typeof h=="string"?(0,eo.extractAssetUid)(h):void 0;u.push({path:p.path,blobSha:p.blobSha,...g?{uid:g}:{}})}let d={lastSyncedSha:s,rootTreeSha:c.treeSha,files:u};return f!==void 0?this.deps.mergeLayer===void 0?{kind:"settled",outcome:i("full-conflict",{detail:`first-sync: no watermark and local content diverges from remote head at ${f} \u2014 A2/A3 scope`})}:(n.push(`first-sync (asset mode): no 3-way merge base and local diverges from remote head (first at ${f}) \u2014 reconciling ZERO-LOSS against ${u.length} byte-identical file(s) as a synthetic base: remote-only files pull, local-only files push, overlapping divergences route to the merge/quarantine layer (both versions preserved), never a silent overwrite or delete`),{kind:"additive-base",base:d}):t.size===l.length?(await this.deps.watermarkStore.set(e.repoKey,d),n.push(`watermark bootstrapped from head ${s} (local tree identical to remote)`),{kind:"settled",outcome:i("synced")}):(n.push(`first-sync (asset mode): local tree (${t.size} files) is a pure superset of remote head ${s} (${l.length} files) \u2014 ${t.size-l.length} local-only addition(s) derive as pushable adds (#3565)`),{kind:"additive-base",base:d})}async collectRemoteChanges(e,t,n,i,s=new Set,o=[],c=new Set,l){let u=await(0,dt.getCommitInfo)(this.transport,e.owner,e.repo,n,this.deps.baseURL),f=await(0,dt.getTree)(this.transport,e.owner,e.repo,u.treeSha,this.deps.baseURL);if(i.fileMode)for(let P of f)i.syncable(P.path)&&!i.treeFilter(P)&&!c.has(P.path)&&(c.add(P.path),o.push(`skipped oversized REMOTE file ${P.path} (${P.size??"?"} bytes over cap) \u2014 excluded from sync symmetrically (Phase C size cap)`));let d=f.filter(P=>i.treeFilter(P)&&!s.has(P.path)),p=t.files.filter(P=>!c.has(P.path)&&!s.has(P.path)),{changed:h,deleted:g}=gU(p,d),m=h.length;m>=hU&&this.emitProgress(l,e.repoKey,"fetching-blobs",{done:0,total:m});let _=new Array(h.length),b=0,w=0,v,E=a(async P=>{if(i.fileMode){let F=await(0,dt.getBlobBytes)(this.transport,e.owner,e.repo,P.blobSha,this.deps.baseURL);return{path:P.path,kind:"change",blobSha:P.blobSha,content:F}}let D=await(0,dt.getBlobText)(this.transport,e.owner,e.repo,P.blobSha,this.deps.baseURL);return{path:P.path,kind:"change",blobSha:P.blobSha,content:D,uid:(0,eo.extractAssetUid)(D)}},"fetchOne"),S=a(async()=>{for(;;){if(v!==void 0)return;let P=b++;if(P>=h.length)return;try{_[P]=await E(h[P])}catch(D){v===void 0&&(v=D);return}w+=1,m>=hU&&w%mfe===0&&w<m&&this.emitProgress(l,e.repoKey,"fetching-blobs",{done:w,total:m})}},"worker"),R=Math.min(gfe,h.length);if(await Promise.all(Array.from({length:R},()=>S())),v!==void 0)throw v instanceof Error?v:new Error(String(v));let C=_;for(let P of g)C.push({path:P.path,kind:"delete",uid:P.uid});return{changes:C,headTreeByPath:wx(f)}}matchLocalVsRemote(e,t,n,i,s,o=new Set,c){let l=new Set,u=[],f=new Map;for(let m of i)m.kind==="change"&&m.uid!==void 0&&f.set(m.uid,(f.get(m.uid)??0)+1);let d=new Set(o);for(let[m,_]of f)_>1&&d.add(m);let p=new Map,h=new Map;for(let m of i){if(m.uid!==void 0&&!d.has(m.uid)){let _=p.get(m.uid)??[];_.push(m),p.set(m.uid,_)}h.set(m.path,m)}for(let m of e){let _=new Set;if(m.uid!==void 0&&!d.has(m.uid))for(let E of p.get(m.uid)??[])E.kind==="change"&&E.path!==m.path&&(c?.has(m.path)===!0||m.basePath!==void 0&&c?.has(m.basePath)===!0)||_.add(E);let b=h.get(m.path);if(b!==void 0&&_.add(b),m.basePath!==void 0){let E=h.get(m.basePath);E!==void 0&&_.add(E)}let w=[],v=!1;for(let E of _){if(v=t.has(m.path)&&!n.has(m.path),v&&E.kind==="delete"){l.add(E);continue}if(!v&&E.kind==="change"&&E.path===m.path&&E.blobSha===m.blobSha){l.add(E),s.add(m.path);continue}if(E.kind==="delete"&&m.basePath!==void 0&&E.path===m.basePath){let S=h.get(m.path);if(S!==void 0&&S.kind==="change"&&(S.blobSha===m.blobSha||S.uid!==void 0&&S.uid===m.uid)){l.add(E);continue}}if(E.kind==="delete"&&E.path!==m.path&&E.path!==m.basePath&&!n.has(E.path)&&c?.has(E.path)!==!0){l.add(E);continue}w.push(E),l.add(E)}w.length>0&&(u.push({local:m,localIsDelete:v,remotes:w,desc:`${m.uid!==void 0&&!d.has(m.uid)?m.uid:m.path} (local ${v?"delete":"change"} vs remote ${w[0].kind} at ${w[0].path})`}),s.add(m.path))}let g=i.filter(m=>!l.has(m));return{conflicts:u,applyWrites:g.filter(m=>m.kind==="change"),applyDeletes:g.filter(m=>m.kind==="delete")}}async checkRaceWindow(e,t,n,i,s,o,c,l){try{let u=await(0,dt.getCommitInfo)(this.transport,e.owner,e.repo,i,this.deps.baseURL),f=(await(0,dt.getTree)(this.transport,e.owner,e.repo,u.treeSha,this.deps.baseURL)).filter(l.treeFilter),d=n===t.lastSyncedSha?t.files:(await(0,dt.getTree)(this.transport,e.owner,e.repo,(await(0,dt.getCommitInfo)(this.transport,e.owner,e.repo,n,this.deps.baseURL)).treeSha,this.deps.baseURL)).filter(l.treeFilter),{changed:p,deleted:h}=gU(d,f);for(let g of p)s.has(g.path)&&c.push(`race-window: concurrent commit ${i} changed ${g.path} between conflict check (head ${n}) and push \u2014 local version won; previous version recoverable from git history`),o.has(g.path)&&c.push(`race-window: concurrent commit ${i} changed ${g.path} which this push DELETED \u2014 the delete won; the concurrent version is recoverable from git history`);for(let g of h)s.has(g.path)&&c.push(`race-window: concurrent commit ${i} deleted ${g.path}; push re-created it`)}catch(u){let f=this.deps.redact??(d=>d);c.push(`race-window check failed: ${f(Ya(u))}`)}}async buildWatermarkFiles(e,t,n,i,s,o,c){if(c.fileMode)return t.map(f=>({path:f.path,blobSha:f.blobSha}));let l=new Map;for(let f of i)f.kind==="change"&&f.blobSha!==void 0&&l.set(f.blobSha,f.uid);for(let[f,d]of n){let p=o?.get(f)??await(0,Yc.gitBlobSha)(d,this.sha1);l.set(p,typeof d=="string"?(0,eo.extractAssetUid)(d):void 0)}for(let f of s.files)l.has(f.blobSha)||l.set(f.blobSha,f.uid);let u=[];for(let f of t){let d;if(l.has(f.blobSha))d=l.get(f.blobSha);else{let p=await(0,dt.getBlobText)(this.transport,e.owner,e.repo,f.blobSha,this.deps.baseURL);d=(0,eo.extractAssetUid)(p)}u.push({path:f.path,blobSha:f.blobSha,...d?{uid:d}:{}})}return u}};xn.SyncEngine=Ex});var SU=T(Dm=>{"use strict";Object.defineProperty(Dm,"__esModule",{value:!0});Dm.QuarantineResolver=void 0;Dm.backupPathFor=bU;var Afe=YS(),ow=Au(),Fm=qc(),Lm=Rm(),Ife=ew(),Go="\0absent",vx=class{static{a(this,"QuarantineResolver")}constructor(e){this.deps=e}async listOpenConflicts(e){return(await this.classifyPins(e)).conflicts}async classifyPins(e){let t=[],n=[];for(let i of e){let s=await this.classifyRepoPins(i);t.push(...s.conflicts),n.push(...s.pinned)}return{conflicts:t,pinned:n}}async classifyRepoPins(e){let t={conflicts:[],pinned:[]},n=await this.deps.watermarkStore.get(e.repoKey),i=n?.pinnedPaths??[];if(i.length===0)return t;if(e.spaceKind==="file")return{conflicts:[],pinned:i.map(m=>({repoKey:e.repoKey,path:m,kind:"unclassified"}))};if(this.deps.outbox!==void 0){let m=await this.deps.outbox.listForRepo(e.repoKey);if(m.length>0){let _=new Set(m.map(b=>b.path));if(i=i.filter(b=>!_.has(b)),i.length===0)return t}}let s=new Map;for(let m of n?.files??[])s.set(m.path,m.blobSha);let o=this.deps.conflictCache!==void 0,c=await this.cachedRecordsFor(e,i),l=i.some(m=>!c.has(m)),u=new Map,f=!0;if(l)if(o)try{u=await this.remoteTreeShas(e)}catch{f=!1}else u=await this.remoteTreeShas(e);let d=this.deps.localFilesFor(e),p=new Set(await d.list()),h=[],g=[];for(let m of i){let _=c.get(m),b,w;if(_!==void 0)w=_.remoteContent!==void 0?await(0,Fm.gitBlobSha)(_.remoteContent,this.deps.sha1):Go,b=_.baseContent!==void 0?await(0,Fm.gitBlobSha)(_.baseContent,this.deps.sha1):s.get(m)??Go;else{if(!f){g.push({repoKey:e.repoKey,path:m,kind:"unclassified"});continue}w=u.get(m)??Go,b=s.get(m)??Go}let v=Go,E;if(p.has(m)&&(E=await d.read(m),v=await(0,Fm.gitBlobSha)(E,this.deps.sha1)),!(v!==w&&v!==b&&w!==b)){let C=v===w?"converged":v===b?"remote-pending":"local-withheld";g.push({repoKey:e.repoKey,path:m,kind:C});continue}let R=(E!==void 0?(0,Lm.extractAssetUid)(E):void 0)??_?.uid;h.push({repoKey:e.repoKey,path:m,...R!==void 0?{uid:R}:{},hasLocal:v!==Go,hasRemote:w!==Go})}return{conflicts:h,pinned:g}}async cachedRecordsFor(e,t){let n=new Map,i=this.deps.conflictCache;if(i===void 0)return n;for(let s of t){let o=await i.get(e.repoKey,s);o!==null&&n.set(s,o)}return n}async detectDuplicateUids(e){let t=new Map;for(let i of e){let s=this.deps.localFilesFor(i);for(let o of await s.list()){if(!o.endsWith(".md"))continue;let c;try{c=await s.read(o)}catch{continue}let l=(0,Lm.extractAssetUid)(c);l!==void 0&&t.set(l,(t.get(l)??0)+1)}}let n=0;for(let i of t.values())i>1&&n++;return n}async loadConflict(e,t){let n=this.deps.localFilesFor(e),s=new Set(await n.list()).has(t)?await n.read(t):void 0,o=await this.deps.conflictCache?.get(e.repoKey,t)??null,c,l;if(o!==null)c=o.remoteContent,l=o.baseContent;else{let d=(await this.remoteTreeShas(e)).get(t);c=d!==void 0?await this.blobText(e,d):void 0;let h=((await this.deps.watermarkStore.get(e.repoKey))?.files??[]).find(g=>g.path===t)?.blobSha;if(h!==void 0)try{l=await this.blobText(e,h)}catch{l=void 0}}let u=(s!==void 0?(0,Lm.extractAssetUid)(s):void 0)??(c!==void 0?(0,Lm.extractAssetUid)(c):void 0)??o?.uid;return{repoKey:e.repoKey,path:t,...u!==void 0?{uid:u}:{},hasLocal:s!==void 0,hasRemote:c!==void 0,...l!==void 0?{base:l}:{},...s!==void 0?{local:s}:{},...c!==void 0?{remote:c}:{}}}async resolve(e,t,n){let i=this.deps.localFilesFor(e),o=new Set(await i.list()).has(t)?await i.read(t):void 0,c=this.deps.outbox!==void 0,{remote:l,remoteSha:u}=c?await this.remoteForResolve(e,t):await this.liveRemoteForResolve(e,t),f=this.chosenContent(n,o,l),d;n.take!=="local"&&o!==void 0&&o!==f&&(d=bU(t),await i.write(d,o)),f===void 0?await i.delete(t):await i.write(t,f);let h=f===void 0&&l===void 0||f===l;if(c&&this.deps.outbox!==void 0&&!h&&f!==void 0)return await this.deps.outbox.enqueue({repoKey:e.repoKey,path:t,chosenContent:f,resolvedTo:n.take==="merged"?"merged":"local",baseRemoteSha:u===Go?Ife.OUTBOX_REMOTE_ABSENT:u,resolvedAt:""}),{repoKey:e.repoKey,path:t,resolvedTo:n.take,awaitingPush:!0,...d!==void 0?{discardedLocalBackupPath:d}:{}};let g;return h||(g=await this.commitChoice(e,t,f)),await this.snapWatermark(e,t,f),this.deps.quarantine?.markResolved!==void 0&&await this.deps.quarantine.markResolved(e.repoKey,t),{repoKey:e.repoKey,path:t,resolvedTo:n.take,...g!==void 0?{pushedSha:g}:{},...d!==void 0?{discardedLocalBackupPath:d}:{}}}async remoteForResolve(e,t){let n=await this.deps.conflictCache?.get(e.repoKey,t)??null;if(n!==null){let i=n.remoteContent,s=i!==void 0?await(0,Fm.gitBlobSha)(i,this.deps.sha1):Go;return{remote:i,remoteSha:s}}return this.liveRemoteForResolve(e,t)}async liveRemoteForResolve(e,t){let i=(await this.remoteTreeShas(e)).get(t);return{remote:i!==void 0?await this.blobText(e,i):void 0,remoteSha:i??Go}}chosenContent(e,t,n){switch(e.take){case"local":if(t===void 0)throw new Error("resolve: cannot keep local \u2014 no local version exists on disk");return t;case"remote":return n;case"merged":return e.content}}async commitChoice(e,t,n){let i=this.deps.commitMessage?.(e,t)??`chore(exosync): resolve conflict for ${t}`;if(n===void 0)throw new Error(`resolve: cannot push an empty resolution for ${t}`);return(0,Afe.restCreateCommit)(this.deps.transport,{owner:e.owner,repo:e.repo,branch:e.branch,files:new Map([[t,n]]),message:i,...this.deps.baseURL!==void 0?{baseURL:this.deps.baseURL}:{},...this.deps.redact!==void 0?{redact:this.deps.redact}:{}})}async snapWatermark(e,t,n){let i=await this.deps.watermarkStore.get(e.repoKey);if(i===null)return;let s=(i.pinnedPaths??[]).filter(c=>c!==t),o=i.files;if(n===void 0)o=o.filter(c=>c.path!==t);else{let c=await(0,Fm.gitBlobSha)(n,this.deps.sha1),l=(0,Lm.extractAssetUid)(n),u={path:t,blobSha:c,...l!==void 0?{uid:l}:{}},f=o.findIndex(d=>d.path===t);o=f>=0?o.map((d,p)=>p===f?u:d):[...o,u]}await this.deps.watermarkStore.set(e.repoKey,{...i,files:o,...s.length>0?{pinnedPaths:s}:{pinnedPaths:void 0}})}async remoteTreeShas(e){let t=await(0,ow.getHeadSha)(this.deps.transport,e.owner,e.repo,e.branch,this.deps.baseURL),n=await(0,ow.getCommitInfo)(this.deps.transport,e.owner,e.repo,t,this.deps.baseURL),i=await(0,ow.getTree)(this.deps.transport,e.owner,e.repo,n.treeSha,this.deps.baseURL),s=new Map;for(let o of i)s.set(o.path,o.blobSha);return s}async blobText(e,t){return(0,ow.getBlobText)(this.deps.transport,e.owner,e.repo,t,this.deps.baseURL)}};Dm.QuarantineResolver=vx;function bU(r){return`${r}.conflict.local.txt`}a(bU,"backupPathFor")});var wU=T(Vd=>{"use strict";Object.defineProperty(Vd,"__esModule",{value:!0});Vd.FileLocalManifestStore=Vd.LOCAL_MANIFEST_STORE_FILENAME=void 0;Vd.LOCAL_MANIFEST_STORE_FILENAME="exosync-localmanifest.local.json";function Rfe(r){if(r===null||typeof r!="object")return!1;let e=r;return e.version===1&&typeof e.lastFullRehashMs=="number"&&e.files!==null&&typeof e.files=="object"}a(Rfe,"isLocalManifestRecord");var Tx=class{static{a(this,"FileLocalManifestStore")}constructor(e){this.io=e,this.writeChain=Promise.resolve()}async get(e){let n=(await this.readRepos())[e];return Rfe(n)?n:null}async set(e,t){let n=this.writeChain.then(async()=>{let i=await this.readRepos();i[e]=t;let s={version:1,repos:i};await this.io.writeAtomic(JSON.stringify(s))});return this.writeChain=n.catch(()=>{}),n}async readRepos(){try{let e=await this.io.read();if(e===null)return{};let t=JSON.parse(e);if(t===null||typeof t!="object")return{};let n=t.repos;return n===null||typeof n!="object"?{}:{...n}}catch{return{}}}};Vd.FileLocalManifestStore=Tx});var Rx=T(Ix=>{"use strict";Object.defineProperty(Ix,"__esModule",{value:!0});Ix.diff3=Cfe;function EU(r,e){let t=r.length,n=e.length,i=Array.from({length:t+1},()=>new Int32Array(n+1));for(let l=t-1;l>=0;l--)for(let u=n-1;u>=0;u--)i[l][u]=r[l]===e[u]?i[l+1][u+1]+1:Math.max(i[l+1][u],i[l][u+1]);let s=new Map,o=0,c=0;for(;o<t&&c<n;)r[o]===e[c]?(s.set(o,c),o++,c++):i[o+1][c]>=i[o][c+1]?o++:c++;return s}a(EU,"lcsMatch");function Ax(r,e){if(r.length!==e.length)return!1;for(let t=0;t<r.length;t++)if(r[t]!==e[t])return!1;return!0}a(Ax,"sliceEq");function Cfe(r,e,t){let n=EU(r,e),i=EU(r,t),s=[],o=0,c=0,l=0;for(;;){let u=o;for(;u<r.length&&!(n.has(u)&&i.has(u));)u++;let f=u<r.length?n.get(u):e.length,d=u<r.length?i.get(u):t.length,p=r.slice(o,u),h=e.slice(c,f),g=t.slice(l,d),m=!Ax(h,p),_=!Ax(g,p);if(!m&&!_)s.push(...p);else if(!m)s.push(...g);else if(!_)s.push(...h);else if(Ax(h,g))s.push(...h);else return{ok:!1,conflict:{base:p,local:h,remote:g}};if(u>=r.length)break;s.push(r[u]),o=u+1,c=f+1,l=d+1}return{ok:!0,merged:s}}a(Cfe,"diff3")});var AU=T(Gd=>{"use strict";Object.defineProperty(Gd,"__esModule",{value:!0});Gd.StructuredMerger=void 0;Gd.timestampToEpoch=Px;Gd.splitSections=km;var vU=Rx(),Ofe=/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/,Nm="exo__Instance_class",xfe="exo__Asset_updatedAt",Pfe=a((r,e,t,n,i,s,o)=>{let c=new Date(0);return c.setFullYear(r,e,t),c.setHours(n,i,s,o),c.getTime()},"DEVICE_LOCAL_TIME"),Ffe=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,9}))?(Z|[+-]\d{2}:?\d{2})?$/;function TU(r,e,t,n,i,s,o){let c=new Date(0);return c.setUTCFullYear(r,e,t),c.setUTCHours(n,i,s,o),c.getTime()}a(TU,"utcEpoch");function Px(r,e){let t=Ffe.exec(r.trim());if(t===null)return;let[n,i,s,o,c,l]=[t[1],t[2],t[3],t[4],t[5],t[6]].map(Number);if(o>23||c>59||l>59)return;let u=new Date(TU(n,i-1,s,0,0,0,0));if(u.getUTCMonth()!==i-1||u.getUTCDate()!==s)return;let f=t[7]===void 0?0:Number(t[7].slice(0,3).padEnd(3,"0")),d=t[8];if(d===void 0){let b=e(n,i-1,s,o,c,l,f);return Number.isFinite(b)?b:void 0}let p=TU(n,i-1,s,o,c,l,f);if(d==="Z")return p;let h=d.replace(":",""),g=Number(h.slice(1,3)),m=Number(h.slice(3,5));if(g>14||m>59)return;let _=g*60+m;return p-(h[0]==="-"?-1:1)*_*6e4}a(Px,"timestampToEpoch");function Mm(r){if(r===null||typeof r!="object")return!0;if(Array.isArray(r))return r.every(Mm);let e=Object.getPrototypeOf(r);return e!==Object.prototype&&e!==null?!1:Object.values(r).every(Mm)}a(Mm,"isPlainValue");function Qc(r,e){if(r===e)return!0;if(r===null||e===null||r===void 0||e===void 0||typeof r!="object"||typeof e!="object"||Array.isArray(r)!==Array.isArray(e))return!1;if(Array.isArray(r)&&Array.isArray(e))return r.length!==e.length?!1:r.every((s,o)=>Qc(s,e[o]));let t=r,n=e,i=Object.keys(t);return i.length!==Object.keys(n).length?!1:i.every(s=>Qc(t[s],n[s]))}a(Qc,"deepEqual");function Iu(r){return typeof r=="string"?`s:${r}`:`j:${JSON.stringify(r)}`}a(Iu,"setKey");function _s(r){return r==null?[]:Array.isArray(r)?r:[r]}a(_s,"toElements");function Lfe(r,e,t){let n=new Set(_s(r).map(Iu)),i=_s(e),s=_s(t),o=new Set(i.map(Iu)),c=new Set(s.map(Iu)),l=a(d=>o.has(d)&&c.has(d)||o.has(d)&&!n.has(d)||c.has(d)&&!n.has(d),"keep"),u=[],f=new Set;for(let d of[...i,...s]){let p=Iu(d);f.has(p)||!l(p)||(f.add(p),u.push(d))}return u}a(Lfe,"mergeSet");function Dfe(r,e,t,n,i){let s=[],o=[],c=new Set;for(let u of[...Object.keys(r),...Object.keys(e),...Object.keys(t)])c.has(u)||(c.add(u),o.push(u));let l={};for(let u of o){let f=r[u],d=e[u],p=t[u];if(!Mm(f)||!Mm(d)||!Mm(p))return{ok:!1,reason:`frontmatter key "${u}" contains a non-plain value (Date?) \u2014 the codec must round-trip scalars as strings (CORE_SCHEMA contract)`};if(Array.isArray(f)||Array.isArray(d)||Array.isArray(p)){if(!(u in e)&&!(u in t))continue;let h=Lfe(f,d,p),g=new Set(_s(f).map(Iu)),m=_s(d).some(b=>!g.has(Iu(b))),_=_s(p).some(b=>!g.has(Iu(b)));m&&_&&!Qc(_s(d),_s(p))&&s.push(`both sides added values to multi-valued key "${u}" \u2014 union kept (D20)`),h.length>0&&(l[u]=h);continue}if(Qc(d,p)){d!==void 0&&(l[u]=d);continue}if(Qc(d,f)){p!==void 0&&(l[u]=p);continue}if(Qc(p,f)){d!==void 0&&(l[u]=d);continue}if(u===xfe&&i&&typeof d=="string"&&typeof p=="string"){let h=Px(d,n),g=Px(p,n);if(h!==void 0&&g!==void 0){l[u]=h>g?d:p,s.push(`"${u}" changed on both sides \u2014 the later stamp kept (${h>g?"local":"remote"})`);continue}}return{ok:!1,reason:`frontmatter key "${u}" changed differently on both sides`}}return{ok:!0,value:l,warnings:s}}a(Dfe,"mergeFrontmatter");var Nfe=/^(```|~~~)/,kfe=/^#{1,6}\s/;function km(r){let e=r.split(`
344
344
  `),t=[],n=null,i="",s=!1,o=a(()=>{n!==null&&t.push({heading:i,text:n.join(`
345
- `)})},"flush");for(let c of e){if(Nfe.test(c.trimStart())&&(s=!s),!s&&kfe.test(c)){o(),n=[c],i=c.trim();continue}n===null&&(n=[],i=""),n.push(c)}return o(),t}a(km,"splitSections");function C2(r){return r.split(/\n{2,}/)}a(C2,"splitParagraphs");function Mfe(r){return r.join(`
345
+ `)})},"flush");for(let c of e){if(Nfe.test(c.trimStart())&&(s=!s),!s&&kfe.test(c)){o(),n=[c],i=c.trim();continue}n===null&&(n=[],i=""),n.push(c)}return o(),t}a(km,"splitSections");function Cx(r){return r.split(/\n{2,}/)}a(Cx,"splitParagraphs");function Mfe(r){return r.join(`
346
346
 
347
- `)}a(Mfe,"joinParagraphs");function O2(r){let e=new Map,t=new Map,n=[];for(let i of r){let s=e.get(i.heading)??0;e.set(i.heading,s+1);let o=`${i.heading}\0${s}`;t.set(o,i),n.push(o)}return{keyed:t,order:n}}a(O2,"keySections");function x2(r){let e=new Map;for(let t of r)e.set(t.heading,(e.get(t.heading)??0)+1);return e}a(x2,"headingCounts");function $fe(r,e,t){if(e===t)return{ok:!0,body:e,warnings:[]};if(e===r)return{ok:!0,body:t,warnings:[]};if(t===r)return{ok:!0,body:e,warnings:[]};let n=[],i=km(r),s=km(e),o=km(t),c=x2(i),l=x2(s),u=x2(o),f=new Set([...c.keys(),...l.keys(),...u.keys()]);for(let O of f){let U=[c.get(O)??0,l.get(O)??0,u.get(O)??0];if(Math.max(...U)>1&&new Set(U).size>1)return{ok:!1,reason:`duplicate heading "${O||"(preamble)"}" count differs across versions \u2014 occurrence pairing unstable`}}let d=O2(i),p=O2(s),h=O2(o),g=a((O,U)=>O==="\x000"&&(U.get(O)?.text??"").trim()==="","blankPreamble"),m=d.order.filter(O=>!p.keyed.has(O)&&!h.keyed.has(O)&&!g(O,d.keyed));if(m.length>0){let O=p.order.filter(oe=>!d.keyed.has(oe)&&!h.keyed.has(oe)&&!g(oe,p.keyed)),U=h.order.filter(oe=>!d.keyed.has(oe)&&!p.keyed.has(oe)&&!g(oe,h.keyed));if(O.length>0&&U.length>0){let oe=a(we=>we.slice(0,3).map(X=>`"${X.slice(0,X.lastIndexOf("\0"))||"(preamble)"}"`).join(", ")+(we.length>3?` and ${we.length-3} more`:""),"names");return{ok:!1,reason:`sections removed on both sides ${oe(m)} while each side added its own (local ${oe(O)}, remote ${oe(U)}) \u2014 a heading renamed differently on each side cannot be told from an unrelated delete + add, refusing to keep both`}}}let _=new Map,b=[],w=new Set;for(let O of[...d.order,...p.order,...h.order])w.has(O)||(w.add(O),b.push(O));for(let O of b){let U=O.slice(0,O.lastIndexOf("\0")),oe=d.keyed.get(O)?.text,we=p.keyed.get(O)?.text,X=h.keyed.get(O)?.text;if(we===X){we!==void 0&&_.set(O,we);continue}if(we===oe){X!==void 0&&_.set(O,X);continue}if(X===oe){we!==void 0&&_.set(O,we);continue}if(we===void 0||X===void 0)return{ok:!1,reason:`section "${U||"(preamble)"}": deleted on one side, modified on the other`};if(oe===void 0)return{ok:!1,reason:`section "${U||"(preamble)"}": added differently on both sides`};let te=(0,vU.diff3)(C2(oe),C2(we),C2(X));if(te.ok){_.set(O,Mfe(te.merged));continue}let re=(0,vU.diff3)(oe.split(`
347
+ `)}a(Mfe,"joinParagraphs");function Ox(r){let e=new Map,t=new Map,n=[];for(let i of r){let s=e.get(i.heading)??0;e.set(i.heading,s+1);let o=`${i.heading}\0${s}`;t.set(o,i),n.push(o)}return{keyed:t,order:n}}a(Ox,"keySections");function xx(r){let e=new Map;for(let t of r)e.set(t.heading,(e.get(t.heading)??0)+1);return e}a(xx,"headingCounts");function $fe(r,e,t){if(e===t)return{ok:!0,body:e,warnings:[]};if(e===r)return{ok:!0,body:t,warnings:[]};if(t===r)return{ok:!0,body:e,warnings:[]};let n=[],i=km(r),s=km(e),o=km(t),c=xx(i),l=xx(s),u=xx(o),f=new Set([...c.keys(),...l.keys(),...u.keys()]);for(let O of f){let U=[c.get(O)??0,l.get(O)??0,u.get(O)??0];if(Math.max(...U)>1&&new Set(U).size>1)return{ok:!1,reason:`duplicate heading "${O||"(preamble)"}" count differs across versions \u2014 occurrence pairing unstable`}}let d=Ox(i),p=Ox(s),h=Ox(o),g=a((O,U)=>O==="\x000"&&(U.get(O)?.text??"").trim()==="","blankPreamble"),m=d.order.filter(O=>!p.keyed.has(O)&&!h.keyed.has(O)&&!g(O,d.keyed));if(m.length>0){let O=p.order.filter(oe=>!d.keyed.has(oe)&&!h.keyed.has(oe)&&!g(oe,p.keyed)),U=h.order.filter(oe=>!d.keyed.has(oe)&&!p.keyed.has(oe)&&!g(oe,h.keyed));if(O.length>0&&U.length>0){let oe=a(we=>we.slice(0,3).map(X=>`"${X.slice(0,X.lastIndexOf("\0"))||"(preamble)"}"`).join(", ")+(we.length>3?` and ${we.length-3} more`:""),"names");return{ok:!1,reason:`sections removed on both sides ${oe(m)} while each side added its own (local ${oe(O)}, remote ${oe(U)}) \u2014 a heading renamed differently on each side cannot be told from an unrelated delete + add, refusing to keep both`}}}let _=new Map,b=[],w=new Set;for(let O of[...d.order,...p.order,...h.order])w.has(O)||(w.add(O),b.push(O));for(let O of b){let U=O.slice(0,O.lastIndexOf("\0")),oe=d.keyed.get(O)?.text,we=p.keyed.get(O)?.text,X=h.keyed.get(O)?.text;if(we===X){we!==void 0&&_.set(O,we);continue}if(we===oe){X!==void 0&&_.set(O,X);continue}if(X===oe){we!==void 0&&_.set(O,we);continue}if(we===void 0||X===void 0)return{ok:!1,reason:`section "${U||"(preamble)"}": deleted on one side, modified on the other`};if(oe===void 0)return{ok:!1,reason:`section "${U||"(preamble)"}": added differently on both sides`};let te=(0,vU.diff3)(Cx(oe),Cx(we),Cx(X));if(te.ok){_.set(O,Mfe(te.merged));continue}let re=(0,vU.diff3)(oe.split(`
348
348
  `),we.split(`
349
349
  `),X.split(`
350
350
  `));if(!re.ok)return{ok:!1,reason:`section "${U||"(preamble)"}": overlapping paragraph edits`};_.set(O,re.merged.join(`
351
351
  `))}let v=a(O=>O.filter(U=>_.has(U)),"surviving"),E=v(d.order),S=v(p.order),R=v(h.order),C=a((O,U)=>O.length===U.length&&O.every((oe,we)=>oe===U[we]),"sameSeq"),P=S.filter(O=>E.includes(O)),D=R.filter(O=>E.includes(O)),F=E.filter(O=>S.includes(O)),$=E.filter(O=>R.includes(O)),H;C(P,F)?H=R:C(D,$)?H=S:(H=S,n.push("section order diverged on both sides \u2014 local order kept, remote additions appended"));let ee=[],G=new Set;for(let O of H)_.has(O)&&!G.has(O)&&(G.add(O),ee.push(O));for(let O of[...S,...R])_.has(O)&&!G.has(O)&&(G.add(O),ee.push(O));let j=ee.map(O=>_.get(O)).join(`
352
352
  `),z=ee.flatMap(O=>km(_.get(O))),ie=jfe(i,s,o,z);return ie!==null?{ok:!1,reason:ie}:{ok:!0,body:j,warnings:n}}a($fe,"mergeBody");function aw(r){let e=new Map;for(let t of r){let n=t.heading===""?t.text:t.text.split(`
353
353
  `).slice(1).join(`
354
- `);for(let i of n.split(/\n[ \t\r]*\n/)){let s=i.trim();s!==""&&e.set(s,(e.get(s)??0)+1)}}return e}a(aw,"textUnits");function jfe(r,e,t,n){let i=aw(r),s=aw(e),o=aw(t),c=aw(n);for(let[l,u]of i){let f=s.get(l)??0,d=o.get(l)??0,p=c.get(l)??0,h=u===1,g=h&&f===u?d:h&&d===u?f:Math.max(f,d,f+d-u);if(p<=g)continue;let m=JSON.stringify(l.length>60?`${l.slice(0,60)}\u2026`:l);return p>Math.max(f,d)?`paragraph ${m} would appear ${p===1?"once":`${p} times`}, more than on either side (local ${f}, remote ${d}) \u2014 the section keys cannot pair it (a heading change, a move, or a deletion re-written on both sides), refusing to duplicate text`:`paragraph ${m} was removed on one side (local ${f}, remote ${d}, base ${u}) but the merge keeps it under another heading \u2014 refusing to resurrect deleted text`}return null}a(jfe,"textCountViolation");var F2=class{static{a(this,"StructuredMerger")}constructor(e,t={}){this.codec=e,this.localTimeToEpoch=t.localTimeToEpoch??Pfe}mergeAsset(e){let{path:t,base:n,local:i,remote:s}=e;if(i===void 0&&s===void 0)return{status:"conflict",reason:`${t}: gone on both sides \u2014 nothing to merge`};if(i===void 0||s===void 0)return{status:"conflict",reason:`${t}: ${i===void 0?"deleted locally, modified remotely":"modified locally, deleted remotely"} (delete-vs-modify)`};if(i===s)return{status:"merged",content:i,warnings:[]};if(n!==void 0&&i===n)return{status:"merged",content:s,warnings:[]};if(n!==void 0&&s===n)return{status:"merged",content:i,warnings:[]};let o=this.splitDoc(n??""),c=this.splitDoc(i),l=this.splitDoc(s);if(o===null||c===null||l===null)return{status:"conflict",reason:`${t}: unparseable frontmatter on ${o===null?"base":c===null?"local":"remote"} side`};let u=Dfe(o.frontmatter,c.frontmatter,l.frontmatter,this.localTimeToEpoch,n!==void 0);if(!u.ok)return{status:"conflict",reason:`${t}: ${u.reason}`};let f=_s(o.frontmatter[Nm]),d=_s(c.frontmatter[Nm]),p=_s(l.frontmatter[Nm]),h=_s(u.value[Nm]);if(f.length>0&&d.length>0&&p.length>0&&h.length===0)return{status:"conflict",reason:`${t}: cross-tombstones removed all ${Nm} values \u2014 typeless merge refused`};let g=$fe(o.body,c.body,l.body);if(!g.ok)return{status:"conflict",reason:`${t}: ${g.reason}`};let m=[...u.warnings,...g.warnings];if(Qc(u.value,c.frontmatter)&&g.body===c.body)return{status:"merged",content:i,warnings:m};if(Qc(u.value,l.frontmatter)&&g.body===l.body)return{status:"merged",content:s,warnings:m};let _;try{_=this.codec.stringify(u.value)}catch(w){return{status:"conflict",reason:`${t}: merged frontmatter failed to serialize (${w instanceof Error?w.message:String(w)})`}}return _.endsWith(`
354
+ `);for(let i of n.split(/\n[ \t\r]*\n/)){let s=i.trim();s!==""&&e.set(s,(e.get(s)??0)+1)}}return e}a(aw,"textUnits");function jfe(r,e,t,n){let i=aw(r),s=aw(e),o=aw(t),c=aw(n);for(let[l,u]of i){let f=s.get(l)??0,d=o.get(l)??0,p=c.get(l)??0,h=u===1,g=h&&f===u?d:h&&d===u?f:Math.max(f,d,f+d-u);if(p<=g)continue;let m=JSON.stringify(l.length>60?`${l.slice(0,60)}\u2026`:l);return p>Math.max(f,d)?`paragraph ${m} would appear ${p===1?"once":`${p} times`}, more than on either side (local ${f}, remote ${d}) \u2014 the section keys cannot pair it (a heading change, a move, or a deletion re-written on both sides), refusing to duplicate text`:`paragraph ${m} was removed on one side (local ${f}, remote ${d}, base ${u}) but the merge keeps it under another heading \u2014 refusing to resurrect deleted text`}return null}a(jfe,"textCountViolation");var Fx=class{static{a(this,"StructuredMerger")}constructor(e,t={}){this.codec=e,this.localTimeToEpoch=t.localTimeToEpoch??Pfe}mergeAsset(e){let{path:t,base:n,local:i,remote:s}=e;if(i===void 0&&s===void 0)return{status:"conflict",reason:`${t}: gone on both sides \u2014 nothing to merge`};if(i===void 0||s===void 0)return{status:"conflict",reason:`${t}: ${i===void 0?"deleted locally, modified remotely":"modified locally, deleted remotely"} (delete-vs-modify)`};if(i===s)return{status:"merged",content:i,warnings:[]};if(n!==void 0&&i===n)return{status:"merged",content:s,warnings:[]};if(n!==void 0&&s===n)return{status:"merged",content:i,warnings:[]};let o=this.splitDoc(n??""),c=this.splitDoc(i),l=this.splitDoc(s);if(o===null||c===null||l===null)return{status:"conflict",reason:`${t}: unparseable frontmatter on ${o===null?"base":c===null?"local":"remote"} side`};let u=Dfe(o.frontmatter,c.frontmatter,l.frontmatter,this.localTimeToEpoch,n!==void 0);if(!u.ok)return{status:"conflict",reason:`${t}: ${u.reason}`};let f=_s(o.frontmatter[Nm]),d=_s(c.frontmatter[Nm]),p=_s(l.frontmatter[Nm]),h=_s(u.value[Nm]);if(f.length>0&&d.length>0&&p.length>0&&h.length===0)return{status:"conflict",reason:`${t}: cross-tombstones removed all ${Nm} values \u2014 typeless merge refused`};let g=$fe(o.body,c.body,l.body);if(!g.ok)return{status:"conflict",reason:`${t}: ${g.reason}`};let m=[...u.warnings,...g.warnings];if(Qc(u.value,c.frontmatter)&&g.body===c.body)return{status:"merged",content:i,warnings:m};if(Qc(u.value,l.frontmatter)&&g.body===l.body)return{status:"merged",content:s,warnings:m};let _;try{_=this.codec.stringify(u.value)}catch(w){return{status:"conflict",reason:`${t}: merged frontmatter failed to serialize (${w instanceof Error?w.message:String(w)})`}}return _.endsWith(`
355
355
  `)||(_+=`
356
356
  `),{status:"merged",content:`---
357
357
  ${_}---
358
- ${g.body}`,warnings:m}}splitDoc(e){let t=Ofe.exec(e);if(!t)return{frontmatter:{},body:e};let n=e.slice(t[0].length);try{let i=this.codec.parse(t[1]);return i==null?{frontmatter:{},body:n}:typeof i!="object"||Array.isArray(i)?null:{frontmatter:i,body:n}}catch{return null}}};Gd.StructuredMerger=F2});var IU=T(cw=>{"use strict";Object.defineProperty(cw,"__esModule",{value:!0});cw.MergeShaclGate=void 0;var L2=VO(),Bfe="http://www.w3.org/1999/02/22-rdf-syntax-ns#type";function Ufe(r,e){let t=new Set;for(let n of r){if(n.subject.type!=="iri"||!("type"in n.predicate)||n.predicate.type!=="iri"||n.object.type!=="iri"||n.predicate.value!==e&&n.predicate.value!==Bfe)continue;t.add(n.subject.value);let i=(0,L2.extractUidFromIRI)(n.subject.value);i&&t.add(`uid:${i}`)}return t}a(Ufe,"typedSubjects");var D2=class{static{a(this,"MergeShaclGate")}constructor(e){this.deps=e}async checkMergedAsset(e,t){let n=await this.deps.triplesFor(e,t),i=this.deps.contextTriples??[],s=[...n,...i],o=(0,L2.validate)(s,this.deps.registry,this.deps.hierarchy),c=new Set;for(let p of n)p.subject.type==="iri"&&c.add(p.subject.value);let l=Ufe(s,this.deps.registry.typePredicateIRI),u=this.deps.isMountedRef??(p=>{if(l.has(p))return!0;let h=(0,L2.extractUidFromIRI)(p);return h!==null&&l.has(`uid:${h}`)}),f=[],d=0;for(let p of o.violations)if(c.has(p.focusNode)){if(p.constraint==="class"){if(p.actualValue!==void 0&&!u(p.actualValue)){d++;continue}f.push(p);continue}p.severity==="sh:Violation"&&f.push(p)}return{ok:f.length===0,violations:f,skippedOpenWorld:d}}};cw.MergeShaclGate=D2});var RU=T(lw=>{"use strict";Object.defineProperty(lw,"__esModule",{value:!0});lw.GatedStructuredMerger=void 0;var N2=class{static{a(this,"GatedStructuredMerger")}constructor(e,t){this.merger=e,this.gate=t}async resolve(e){let t=this.merger.mergeAsset(e);if(t.status==="conflict")return{action:"quarantine",reason:t.reason};if(this.gate!==void 0){let n=await this.gate.checkMergedAsset(e.path,t.content);if(!n.ok)return{action:"quarantine",reason:`merged result is SHACL-invalid: ${n.violations.slice(0,3).map(s=>s.message).join("; ")}`}}return{action:"use-merged",content:t.content,warnings:t.warnings}}};lw.GatedStructuredMerger=N2});var OU=T(qd=>{"use strict";Object.defineProperty(qd,"__esModule",{value:!0});qd.FileWatermarkStore=qd.WATERMARK_STORE_FILENAME=void 0;qd.WATERMARK_STORE_FILENAME="exosync-watermarks.local.json";function CU(r){if(r===null||typeof r!="object")return!1;let e=r;return typeof e.lastSyncedSha=="string"&&typeof e.rootTreeSha=="string"&&Array.isArray(e.files)}a(CU,"isWatermarkRecord");var k2=class{static{a(this,"FileWatermarkStore")}constructor(e){this.io=e,this.writeChain=Promise.resolve()}async get(e){let n=(await this.readRepos())[e];return CU(n)?n:null}async getAll(){let e=await this.readRepos(),t={};for(let[n,i]of Object.entries(e))CU(i)&&(t[n]=i);return t}async set(e,t){let n=this.writeChain.then(async()=>{let i=await this.readRepos();i[e]=t;let s={version:1,repos:i};await this.io.writeAtomic(JSON.stringify(s,null,2))});return this.writeChain=n.catch(()=>{}),n}async readRepos(){try{let e=await this.io.read();if(e===null)return{};let t=JSON.parse(e);if(t===null||typeof t!="object")return{};let n=t.repos;return n===null||typeof n!="object"?{}:{...n}}catch{return{}}}};qd.FileWatermarkStore=k2});var xU=T(Wd=>{"use strict";Object.defineProperty(Wd,"__esModule",{value:!0});Wd.FileMountBaseStore=Wd.MOUNT_BASE_STORE_FILENAME=void 0;Wd.MOUNT_BASE_STORE_FILENAME="exosync-mountbase.local.json";var M2=class{static{a(this,"FileMountBaseStore")}constructor(e){this.io=e,this.writeChain=Promise.resolve()}async get(e){let n=(await this.readRepos())[e];return typeof n=="string"&&n.length>0?n:null}async set(e,t){let n=this.writeChain.then(async()=>{let i=await this.readRepos();i[e]=t;let s={version:1,repos:i};await this.io.writeAtomic(JSON.stringify(s,null,2))});return this.writeChain=n.catch(()=>{}),n}async readRepos(){try{let e=await this.io.read();if(e===null)return{};let t=JSON.parse(e);if(t===null||typeof t!="object")return{};let n=t.repos;if(n===null||typeof n!="object")return{};let i={};for(let[s,o]of Object.entries(n))typeof o=="string"&&(i[s]=o);return i}catch{return{}}}};Wd.FileMountBaseStore=M2});var PU=T(Kd=>{"use strict";Object.defineProperty(Kd,"__esModule",{value:!0});Kd.LocalConflictCacheStore=Kd.CONFLICT_CACHE_STORE_FILENAME=void 0;var Vfe=Zl();Kd.CONFLICT_CACHE_STORE_FILENAME="exosync-conflicts.local.json";function $2(r,e){return`${r}\0${e}`}a($2,"cacheKey");function j2(r){if(r===null||typeof r!="object")return!1;let e=r;return typeof e.repoKey=="string"&&typeof e.path=="string"&&typeof e.reason=="string"&&typeof e.quarantinedAt=="string"}a(j2,"isRecord");var B2=class{static{a(this,"LocalConflictCacheStore")}constructor(e){this.writeChain=Promise.resolve(),this.io=e.io,this.now=e.now??(()=>new Date().toISOString())}async quarantine(e){await this.quarantineAll([e])}async quarantineAll(e){e.length!==0&&await this.mutate(t=>{for(let n of e){let i=$2(n.repoKey,n.path),s=t.entries[i],o=s!==void 0&&j2(s)?s.quarantinedAt:this.now();t.entries[i]={version:1,repoKey:n.repoKey,path:n.path,...n.uid!==void 0?{uid:n.uid}:{},reason:n.reason,quarantinedAt:o,...n.baseContent!==void 0?{baseContent:n.baseContent}:{},...n.localContent!==void 0?{localContent:n.localContent}:{},...n.remoteContent!==void 0?{remoteContent:n.remoteContent}:{},...n.localContentBytes!==void 0?{localContentBytesBase64:(0,Vfe.bytesToBase64)(n.localContentBytes)}:{}}}})}async markResolved(e,t){let n=$2(e,t);await this.mutate(i=>{delete i.entries[n]})}async list(){let e=await this.read();return Object.values(e.entries).filter(j2)}async get(e,t){let i=(await this.read()).entries[$2(e,t)];return i!==void 0&&j2(i)?i:null}async mutate(e){let t=this.writeChain.then(async()=>{let n=await this.read();e(n),await this.io.writeAtomic(JSON.stringify(n,null,2))});return this.writeChain=t.catch(()=>{}),t}async read(){try{let e=await this.io.read();if(e===null)return{version:1,entries:{}};let t=JSON.parse(e);if(t===null||typeof t!="object")return{version:1,entries:{}};let n=t.entries;return n===null||typeof n!="object"?{version:1,entries:{}}:{version:1,entries:{...n}}}catch{return{version:1,entries:{}}}}};Kd.LocalConflictCacheStore=B2});var LU=T(uw=>{"use strict";Object.defineProperty(uw,"__esModule",{value:!0});uw.deriveAssetSpaceNamespace=FU;uw.buildAssetSpaceDescriptor=Gfe;var U2=Pm();function FU(r){if(typeof r!="string")return null;let e=(0,U2.parseStrictGitHubRepoURL)(r.replace(/\.git$/i,""));if(e===null)return null;let t=e.repo,n=t.startsWith("exoas-")?t.slice(6):t;return n.length>0?n:null}a(FU,"deriveAssetSpaceNamespace");function Gfe(r){let e=typeof r.uid=="string"?r.uid.trim():"";if(e.length===0)return null;let t=typeof r.sourceUrl=="string"?r.sourceUrl.replace(/\.git$/i,""):"",n=(0,U2.parseStrictGitHubRepoURL)(t);if(n===null)return null;let i=(typeof r.namespace=="string"&&r.namespace.trim().length>0?r.namespace.trim():FU(t))??"";if(i.length===0)return null;let s=`${n.owner}/${n.repo}`,o=typeof r.createdAt=="string"&&r.createdAt.length>0?r.createdAt:new Date(0).toISOString(),c={exo__Asset_uid:e,exo__Asset_isDefinedBy:`[[${e}]]`,exo__Asset_createdAt:o,exo__Asset_updatedAt:o,exo__Instance_class:[`[[${U2.ASSET_SPACE_CLASS_UID}]]`],exo__Asset_label:s,exo__AssetSpace_source:t,exo__AssetSpace_namespace:i,aliases:[`$${i} AssetSpace`]},l=`exo__AssetSpace descriptor for \`${s}\` \u2014 registered for ExoSync (#3707). Mount path \`assetspaces/${n.owner}/${n.repo}/\`.`;return{fileName:`${e}.md`,frontmatter:c,body:l}}a(Gfe,"buildAssetSpaceDescriptor")});var V2=T(dw=>{"use strict";Object.defineProperty(dw,"__esModule",{value:!0});dw.isFormatOnlyDrift=qfe;dw.compareAssetSemantics=Kfe;function qfe(r){return r.frontmatterEqual&&r.bodyEqual}a(qfe,"isFormatOnlyDrift");var Wfe=/^---\r?\n([\s\S]*?)\r?\n---(?=\r?\n|$)/;function DU(r){let e=Wfe.exec(r);return e?{fm:e[1],body:r.slice(e[0].length)}:{fm:null,body:r}}a(DU,"splitDoc");function fw(r){if(Array.isArray(r))return`[${r.map(fw).sort().join(",")}]`;if(r!==null&&typeof r=="object"){let e=r;return`{${Object.keys(e).sort().map(n=>`${JSON.stringify(n)}:${fw(e[n])}`).join(",")}}`}return JSON.stringify(r)??"undefined"}a(fw,"canonicalise");function NU(r){return r.replace(/\r\n/g,`
359
- `).replace(/\s+$/,"")}a(NU,"normaliseBody");function Kfe(r,e,t){let n=DU(r),i=DU(e),s;if(n.fm===null&&i.fm===null)s=!0;else if(n.fm===null||i.fm===null)s=!1;else try{s=fw(t.parse(n.fm))===fw(t.parse(i.fm))}catch{s=!1}return{frontmatterEqual:s,bodyEqual:NU(n.body)===NU(i.body)}}a(Kfe,"compareAssetSemantics")});var jU=T(jm=>{"use strict";Object.defineProperty(jm,"__esModule",{value:!0});jm.ParityValidator=void 0;jm.summarizeParityRound=Xfe;var $m=Au(),kU=qc(),G2=rw(),zfe=xm(),zd=iw(),MU=V2(),Hfe=50,Yfe=200,$U=new Set(["pending-local-edit","pending-remote-add","pending-remote-edit","pending-remote-delete","deferred-local-delete","pending-conflict","unverified-divergence"]),Qfe=new Set(["quarantine-pinned","format-only-drift"]);function Ru(r){return r instanceof Error?r.message:String(r)}a(Ru,"errMsg");var q2=class{static{a(this,"ParityValidator")}constructor(e){this.deps=e,this.transport=(0,zfe.withRateLimitBackoff)(e.transport,e.backoff)}async captureSnapshot(e){let t=new Map,n=[],i=this.deps.redact??(s=>s);for(let s of e)try{let o=await this.deps.watermarks.get(s.repoKey);if(o===null)continue;let c=new Map(o.files.map(f=>[f.path,f.blobSha])),l=await this.readLocalSnapshot(s,s.spaceKind==="file"),u=new Map;for(let[f,d]of l.shas)c.get(f)!==d&&u.set(f,d);u.size>0&&t.set(s.repoKey,u)}catch(o){n.push(`${s.repoKey}: conservation snapshot failed (${i(Ru(o))}) \u2014 no coverage this round`)}return{dirtyByRepo:t,warnings:n}}async runRound(e,t){let n=this.deps.now??(()=>new Date().toISOString()),i=this.deps.maxSemanticFetchesPerRun??Yfe,s=[];for(let u of e){let f=await this.checkRepo(u,t,{take:a(d=>i<d?!1:(i-=d,!0),"take")});s.push(f)}t.previousRound!=null&&t.trigger==="post-sync"&&this.escalatePersistentDivergence(s,t.previousRound,t.syncResults);let o=s.filter(u=>u.status==="checked").length,c=s.reduce((u,f)=>u+f.m1Violations.length,0),l=s.reduce((u,f)=>u+(f.status==="checked"?f.m2SemanticDiffs:0),0);return{version:1,ts:n(),trigger:t.trigger,repos:s,checkedRepos:o,m1Total:c,m2Total:l,ok:c===0&&l===0&&o>0,vacuous:o===0}}async checkRepo(e,t,n){let i=[],s=this.deps.redact??(l=>l),o=a((l,u={})=>({repoKey:e.repoKey,status:l,filesChecked:0,inParity:0,discrepancies:[],m2SemanticDiffs:0,accountedCount:0,m1Violations:[],...e.pullOnly===!0?{pullOnly:!0}:{},warnings:i,...u}),"report"),c=t.syncResults?.find(l=>l.repoKey===e.repoKey);if(c?.warnings.some(l=>l.startsWith("race-window")))return o("inconclusive",{detail:"sync hit its race window (watermark not advanced) \u2014 parity deferred to the next round"});if(c?.status==="skipped-not-materialized")return o("inconclusive",{detail:"repo not fully materialized (D19) \u2014 local absence is not divergence; parity deferred to the next round"});try{let l=e.spaceKind==="file",u=await(0,$m.getHeadSha)(this.transport,e.owner,e.repo,e.branch,this.deps.baseURL),f=await(0,$m.getCommitInfo)(this.transport,e.owner,e.repo,u,this.deps.baseURL),d=await(0,$m.getTree)(this.transport,e.owner,e.repo,f.treeSha,this.deps.baseURL),p=this.deps.maxFileBytes??zd.DEFAULT_MAX_FILE_BYTES,h=l?zd.isFileSpaceSyncablePath:zd.isSyncablePath,g=new Map;for(let $ of d)if(h($.path)){if($.size!==void 0&&$.size>p){i.push(`remote ${$.path} exceeds the ${p}-byte cap \u2014 excluded symmetrically`);continue}g.set($.path,$)}let m=await this.readLocalSnapshot(e,l);i.push(...m.warnings);let _=await this.deps.watermarks.get(e.repoKey);if(_===null){let $=0;for(let[ee,G]of m.shas)g.get(ee)?.blobSha===G&&$++;let H=new Set([...m.shas.keys(),...g.keys()]);return o("no-watermark",{filesChecked:H.size,inParity:$,headSha:u,detail:`repo has no sync watermark on this device (${H.size-$} raw diff(s)) \u2014 run a sync first; not counted toward M1/M2`})}let b=new Map(_.files.map($=>[$.path,$.blobSha])),w=new Set(_.pinnedPaths??[]),{discrepancies:v,inParity:E,filesChecked:S}=await this.classifyAll(e,m,g,b,w,l,{warnings:i,runBudget:n}),R=await(0,$m.getHeadSha)(this.transport,e.owner,e.repo,e.branch,this.deps.baseURL);if(R!==u)return o("inconclusive",{headSha:u,detail:`remote head moved during the check (${u.slice(0,7)} \u2192 ${R.slice(0,7)}) \u2014 parity deferred to the next round`});let C=this.checkConservation(e,t,m,g,w,c),P=v.filter($=>!Qfe.has($.cls)).length,D=v.length-P,F;if(l){let $=[...m.shas.values()].sort().join(`
358
+ ${g.body}`,warnings:m}}splitDoc(e){let t=Ofe.exec(e);if(!t)return{frontmatter:{},body:e};let n=e.slice(t[0].length);try{let i=this.codec.parse(t[1]);return i==null?{frontmatter:{},body:n}:typeof i!="object"||Array.isArray(i)?null:{frontmatter:i,body:n}}catch{return null}}};Gd.StructuredMerger=Fx});var IU=T(cw=>{"use strict";Object.defineProperty(cw,"__esModule",{value:!0});cw.MergeShaclGate=void 0;var Lx=VO(),Bfe="http://www.w3.org/1999/02/22-rdf-syntax-ns#type";function Ufe(r,e){let t=new Set;for(let n of r){if(n.subject.type!=="iri"||!("type"in n.predicate)||n.predicate.type!=="iri"||n.object.type!=="iri"||n.predicate.value!==e&&n.predicate.value!==Bfe)continue;t.add(n.subject.value);let i=(0,Lx.extractUidFromIRI)(n.subject.value);i&&t.add(`uid:${i}`)}return t}a(Ufe,"typedSubjects");var Dx=class{static{a(this,"MergeShaclGate")}constructor(e){this.deps=e}async checkMergedAsset(e,t){let n=await this.deps.triplesFor(e,t),i=this.deps.contextTriples??[],s=[...n,...i],o=(0,Lx.validate)(s,this.deps.registry,this.deps.hierarchy),c=new Set;for(let p of n)p.subject.type==="iri"&&c.add(p.subject.value);let l=Ufe(s,this.deps.registry.typePredicateIRI),u=this.deps.isMountedRef??(p=>{if(l.has(p))return!0;let h=(0,Lx.extractUidFromIRI)(p);return h!==null&&l.has(`uid:${h}`)}),f=[],d=0;for(let p of o.violations)if(c.has(p.focusNode)){if(p.constraint==="class"){if(p.actualValue!==void 0&&!u(p.actualValue)){d++;continue}f.push(p);continue}p.severity==="sh:Violation"&&f.push(p)}return{ok:f.length===0,violations:f,skippedOpenWorld:d}}};cw.MergeShaclGate=Dx});var RU=T(lw=>{"use strict";Object.defineProperty(lw,"__esModule",{value:!0});lw.GatedStructuredMerger=void 0;var Nx=class{static{a(this,"GatedStructuredMerger")}constructor(e,t){this.merger=e,this.gate=t}async resolve(e){let t=this.merger.mergeAsset(e);if(t.status==="conflict")return{action:"quarantine",reason:t.reason};if(this.gate!==void 0){let n=await this.gate.checkMergedAsset(e.path,t.content);if(!n.ok)return{action:"quarantine",reason:`merged result is SHACL-invalid: ${n.violations.slice(0,3).map(s=>s.message).join("; ")}`}}return{action:"use-merged",content:t.content,warnings:t.warnings}}};lw.GatedStructuredMerger=Nx});var OU=T(qd=>{"use strict";Object.defineProperty(qd,"__esModule",{value:!0});qd.FileWatermarkStore=qd.WATERMARK_STORE_FILENAME=void 0;qd.WATERMARK_STORE_FILENAME="exosync-watermarks.local.json";function CU(r){if(r===null||typeof r!="object")return!1;let e=r;return typeof e.lastSyncedSha=="string"&&typeof e.rootTreeSha=="string"&&Array.isArray(e.files)}a(CU,"isWatermarkRecord");var kx=class{static{a(this,"FileWatermarkStore")}constructor(e){this.io=e,this.writeChain=Promise.resolve()}async get(e){let n=(await this.readRepos())[e];return CU(n)?n:null}async getAll(){let e=await this.readRepos(),t={};for(let[n,i]of Object.entries(e))CU(i)&&(t[n]=i);return t}async set(e,t){let n=this.writeChain.then(async()=>{let i=await this.readRepos();i[e]=t;let s={version:1,repos:i};await this.io.writeAtomic(JSON.stringify(s,null,2))});return this.writeChain=n.catch(()=>{}),n}async readRepos(){try{let e=await this.io.read();if(e===null)return{};let t=JSON.parse(e);if(t===null||typeof t!="object")return{};let n=t.repos;return n===null||typeof n!="object"?{}:{...n}}catch{return{}}}};qd.FileWatermarkStore=kx});var xU=T(Wd=>{"use strict";Object.defineProperty(Wd,"__esModule",{value:!0});Wd.FileMountBaseStore=Wd.MOUNT_BASE_STORE_FILENAME=void 0;Wd.MOUNT_BASE_STORE_FILENAME="exosync-mountbase.local.json";var Mx=class{static{a(this,"FileMountBaseStore")}constructor(e){this.io=e,this.writeChain=Promise.resolve()}async get(e){let n=(await this.readRepos())[e];return typeof n=="string"&&n.length>0?n:null}async set(e,t){let n=this.writeChain.then(async()=>{let i=await this.readRepos();i[e]=t;let s={version:1,repos:i};await this.io.writeAtomic(JSON.stringify(s,null,2))});return this.writeChain=n.catch(()=>{}),n}async readRepos(){try{let e=await this.io.read();if(e===null)return{};let t=JSON.parse(e);if(t===null||typeof t!="object")return{};let n=t.repos;if(n===null||typeof n!="object")return{};let i={};for(let[s,o]of Object.entries(n))typeof o=="string"&&(i[s]=o);return i}catch{return{}}}};Wd.FileMountBaseStore=Mx});var PU=T(Kd=>{"use strict";Object.defineProperty(Kd,"__esModule",{value:!0});Kd.LocalConflictCacheStore=Kd.CONFLICT_CACHE_STORE_FILENAME=void 0;var Vfe=Zl();Kd.CONFLICT_CACHE_STORE_FILENAME="exosync-conflicts.local.json";function $x(r,e){return`${r}\0${e}`}a($x,"cacheKey");function jx(r){if(r===null||typeof r!="object")return!1;let e=r;return typeof e.repoKey=="string"&&typeof e.path=="string"&&typeof e.reason=="string"&&typeof e.quarantinedAt=="string"}a(jx,"isRecord");var Bx=class{static{a(this,"LocalConflictCacheStore")}constructor(e){this.writeChain=Promise.resolve(),this.io=e.io,this.now=e.now??(()=>new Date().toISOString())}async quarantine(e){await this.quarantineAll([e])}async quarantineAll(e){e.length!==0&&await this.mutate(t=>{for(let n of e){let i=$x(n.repoKey,n.path),s=t.entries[i],o=s!==void 0&&jx(s)?s.quarantinedAt:this.now();t.entries[i]={version:1,repoKey:n.repoKey,path:n.path,...n.uid!==void 0?{uid:n.uid}:{},reason:n.reason,quarantinedAt:o,...n.baseContent!==void 0?{baseContent:n.baseContent}:{},...n.localContent!==void 0?{localContent:n.localContent}:{},...n.remoteContent!==void 0?{remoteContent:n.remoteContent}:{},...n.localContentBytes!==void 0?{localContentBytesBase64:(0,Vfe.bytesToBase64)(n.localContentBytes)}:{}}}})}async markResolved(e,t){let n=$x(e,t);await this.mutate(i=>{delete i.entries[n]})}async list(){let e=await this.read();return Object.values(e.entries).filter(jx)}async get(e,t){let i=(await this.read()).entries[$x(e,t)];return i!==void 0&&jx(i)?i:null}async mutate(e){let t=this.writeChain.then(async()=>{let n=await this.read();e(n),await this.io.writeAtomic(JSON.stringify(n,null,2))});return this.writeChain=t.catch(()=>{}),t}async read(){try{let e=await this.io.read();if(e===null)return{version:1,entries:{}};let t=JSON.parse(e);if(t===null||typeof t!="object")return{version:1,entries:{}};let n=t.entries;return n===null||typeof n!="object"?{version:1,entries:{}}:{version:1,entries:{...n}}}catch{return{version:1,entries:{}}}}};Kd.LocalConflictCacheStore=Bx});var LU=T(uw=>{"use strict";Object.defineProperty(uw,"__esModule",{value:!0});uw.deriveAssetSpaceNamespace=FU;uw.buildAssetSpaceDescriptor=Gfe;var Ux=Pm();function FU(r){if(typeof r!="string")return null;let e=(0,Ux.parseStrictGitHubRepoURL)(r.replace(/\.git$/i,""));if(e===null)return null;let t=e.repo,n=t.startsWith("exoas-")?t.slice(6):t;return n.length>0?n:null}a(FU,"deriveAssetSpaceNamespace");function Gfe(r){let e=typeof r.uid=="string"?r.uid.trim():"";if(e.length===0)return null;let t=typeof r.sourceUrl=="string"?r.sourceUrl.replace(/\.git$/i,""):"",n=(0,Ux.parseStrictGitHubRepoURL)(t);if(n===null)return null;let i=(typeof r.namespace=="string"&&r.namespace.trim().length>0?r.namespace.trim():FU(t))??"";if(i.length===0)return null;let s=`${n.owner}/${n.repo}`,o=typeof r.createdAt=="string"&&r.createdAt.length>0?r.createdAt:new Date(0).toISOString(),c={exo__Asset_uid:e,exo__Asset_isDefinedBy:`[[${e}]]`,exo__Asset_createdAt:o,exo__Asset_updatedAt:o,exo__Instance_class:[`[[${Ux.ASSET_SPACE_CLASS_UID}]]`],exo__Asset_label:s,exo__AssetSpace_source:t,exo__AssetSpace_namespace:i,aliases:[`$${i} AssetSpace`]},l=`exo__AssetSpace descriptor for \`${s}\` \u2014 registered for ExoSync (#3707). Mount path \`assetspaces/${n.owner}/${n.repo}/\`.`;return{fileName:`${e}.md`,frontmatter:c,body:l}}a(Gfe,"buildAssetSpaceDescriptor")});var Vx=T(dw=>{"use strict";Object.defineProperty(dw,"__esModule",{value:!0});dw.isFormatOnlyDrift=qfe;dw.compareAssetSemantics=Kfe;function qfe(r){return r.frontmatterEqual&&r.bodyEqual}a(qfe,"isFormatOnlyDrift");var Wfe=/^---\r?\n([\s\S]*?)\r?\n---(?=\r?\n|$)/;function DU(r){let e=Wfe.exec(r);return e?{fm:e[1],body:r.slice(e[0].length)}:{fm:null,body:r}}a(DU,"splitDoc");function fw(r){if(Array.isArray(r))return`[${r.map(fw).sort().join(",")}]`;if(r!==null&&typeof r=="object"){let e=r;return`{${Object.keys(e).sort().map(n=>`${JSON.stringify(n)}:${fw(e[n])}`).join(",")}}`}return JSON.stringify(r)??"undefined"}a(fw,"canonicalise");function NU(r){return r.replace(/\r\n/g,`
359
+ `).replace(/\s+$/,"")}a(NU,"normaliseBody");function Kfe(r,e,t){let n=DU(r),i=DU(e),s;if(n.fm===null&&i.fm===null)s=!0;else if(n.fm===null||i.fm===null)s=!1;else try{s=fw(t.parse(n.fm))===fw(t.parse(i.fm))}catch{s=!1}return{frontmatterEqual:s,bodyEqual:NU(n.body)===NU(i.body)}}a(Kfe,"compareAssetSemantics")});var jU=T(jm=>{"use strict";Object.defineProperty(jm,"__esModule",{value:!0});jm.ParityValidator=void 0;jm.summarizeParityRound=Xfe;var $m=Au(),kU=qc(),Gx=rw(),zfe=xm(),zd=iw(),MU=Vx(),Hfe=50,Yfe=200,$U=new Set(["pending-local-edit","pending-remote-add","pending-remote-edit","pending-remote-delete","deferred-local-delete","pending-conflict","unverified-divergence"]),Qfe=new Set(["quarantine-pinned","format-only-drift"]);function Ru(r){return r instanceof Error?r.message:String(r)}a(Ru,"errMsg");var qx=class{static{a(this,"ParityValidator")}constructor(e){this.deps=e,this.transport=(0,zfe.withRateLimitBackoff)(e.transport,e.backoff)}async captureSnapshot(e){let t=new Map,n=[],i=this.deps.redact??(s=>s);for(let s of e)try{let o=await this.deps.watermarks.get(s.repoKey);if(o===null)continue;let c=new Map(o.files.map(f=>[f.path,f.blobSha])),l=await this.readLocalSnapshot(s,s.spaceKind==="file"),u=new Map;for(let[f,d]of l.shas)c.get(f)!==d&&u.set(f,d);u.size>0&&t.set(s.repoKey,u)}catch(o){n.push(`${s.repoKey}: conservation snapshot failed (${i(Ru(o))}) \u2014 no coverage this round`)}return{dirtyByRepo:t,warnings:n}}async runRound(e,t){let n=this.deps.now??(()=>new Date().toISOString()),i=this.deps.maxSemanticFetchesPerRun??Yfe,s=[];for(let u of e){let f=await this.checkRepo(u,t,{take:a(d=>i<d?!1:(i-=d,!0),"take")});s.push(f)}t.previousRound!=null&&t.trigger==="post-sync"&&this.escalatePersistentDivergence(s,t.previousRound,t.syncResults);let o=s.filter(u=>u.status==="checked").length,c=s.reduce((u,f)=>u+f.m1Violations.length,0),l=s.reduce((u,f)=>u+(f.status==="checked"?f.m2SemanticDiffs:0),0);return{version:1,ts:n(),trigger:t.trigger,repos:s,checkedRepos:o,m1Total:c,m2Total:l,ok:c===0&&l===0&&o>0,vacuous:o===0}}async checkRepo(e,t,n){let i=[],s=this.deps.redact??(l=>l),o=a((l,u={})=>({repoKey:e.repoKey,status:l,filesChecked:0,inParity:0,discrepancies:[],m2SemanticDiffs:0,accountedCount:0,m1Violations:[],...e.pullOnly===!0?{pullOnly:!0}:{},warnings:i,...u}),"report"),c=t.syncResults?.find(l=>l.repoKey===e.repoKey);if(c?.warnings.some(l=>l.startsWith("race-window")))return o("inconclusive",{detail:"sync hit its race window (watermark not advanced) \u2014 parity deferred to the next round"});if(c?.status==="skipped-not-materialized")return o("inconclusive",{detail:"repo not fully materialized (D19) \u2014 local absence is not divergence; parity deferred to the next round"});try{let l=e.spaceKind==="file",u=await(0,$m.getHeadSha)(this.transport,e.owner,e.repo,e.branch,this.deps.baseURL),f=await(0,$m.getCommitInfo)(this.transport,e.owner,e.repo,u,this.deps.baseURL),d=await(0,$m.getTree)(this.transport,e.owner,e.repo,f.treeSha,this.deps.baseURL),p=this.deps.maxFileBytes??zd.DEFAULT_MAX_FILE_BYTES,h=l?zd.isFileSpaceSyncablePath:zd.isSyncablePath,g=new Map;for(let $ of d)if(h($.path)){if($.size!==void 0&&$.size>p){i.push(`remote ${$.path} exceeds the ${p}-byte cap \u2014 excluded symmetrically`);continue}g.set($.path,$)}let m=await this.readLocalSnapshot(e,l);i.push(...m.warnings);let _=await this.deps.watermarks.get(e.repoKey);if(_===null){let $=0;for(let[ee,G]of m.shas)g.get(ee)?.blobSha===G&&$++;let H=new Set([...m.shas.keys(),...g.keys()]);return o("no-watermark",{filesChecked:H.size,inParity:$,headSha:u,detail:`repo has no sync watermark on this device (${H.size-$} raw diff(s)) \u2014 run a sync first; not counted toward M1/M2`})}let b=new Map(_.files.map($=>[$.path,$.blobSha])),w=new Set(_.pinnedPaths??[]),{discrepancies:v,inParity:E,filesChecked:S}=await this.classifyAll(e,m,g,b,w,l,{warnings:i,runBudget:n}),R=await(0,$m.getHeadSha)(this.transport,e.owner,e.repo,e.branch,this.deps.baseURL);if(R!==u)return o("inconclusive",{headSha:u,detail:`remote head moved during the check (${u.slice(0,7)} \u2192 ${R.slice(0,7)}) \u2014 parity deferred to the next round`});let C=this.checkConservation(e,t,m,g,w,c),P=v.filter($=>!Qfe.has($.cls)).length,D=v.length-P,F;if(l){let $=[...m.shas.values()].sort().join(`
360
360
  `),H=[...g.values()].map(ee=>ee.blobSha).sort().join(`
361
- `);F=$===H}return o("checked",{filesChecked:S,inParity:E,discrepancies:v,m2SemanticDiffs:P,accountedCount:D,m1Violations:C,headSha:u,...F!==void 0?{attachmentHashSetIdentical:F}:{}})}catch(l){if((0,G2.isAuthError)(l))return o("auth-required",{detail:s(`authentication failed: ${Ru(l)} \u2014 the PAT is expired, revoked or under-scoped; update it (R8)`)});if((0,G2.isRefNotFoundError)(l)){let u=s(`${e.owner}/${e.repo}@${e.branch} is not reachable: ${Ru(l)} \u2014 ${G2.REF_NOT_FOUND_HINT}`);return i.push("repo unreachable (HTTP 404) \u2014 skipped"),o("error",{detail:u})}return i.push(`parity check failed: ${s(Ru(l))}`),o("error",{detail:s(Ru(l))})}}async readLocalSnapshot(e,t){let n=this.deps.localFilesFor(e),i=t?zd.isFileSpaceSyncablePath:zd.isSyncablePath,s=this.deps.maxFileBytes??zd.DEFAULT_MAX_FILE_BYTES,o=new Map,c=new Map,l=[];if(t&&n.readBinary===void 0)throw new Error("file-mode repo requires a LocalFilesPort with readBinary \u2014 refusing to hash through the text-only port (binary would corrupt)");let u=new TextEncoder;for(let f of await n.list())if(i(f))try{if(t){let d=await n.readBinary(f);if(d.byteLength>s){l.push(`local ${f} exceeds the ${s}-byte cap \u2014 excluded symmetrically`);continue}o.set(f,await(0,kU.gitBlobSha)(d,this.deps.sha1))}else{let d=await n.read(f);if(u.encode(d).byteLength>s){l.push(`local ${f} exceeds the ${s}-byte cap \u2014 excluded symmetrically`);continue}c.set(f,d),o.set(f,await(0,kU.gitBlobSha)(d,this.deps.sha1))}}catch(d){let p=this.deps.redact??(h=>h);l.push(`local ${f} unreadable (${p(Ru(d))}) \u2014 skipped`)}return{shas:o,texts:c,warnings:l}}async classifyAll(e,t,n,i,s,o,c){let l=[],u=0,f=this.deps.maxSemanticFetchesPerRepo??Hfe,d=new Set([...t.shas.keys(),...n.keys()]);for(let p of[...d].sort()){let h=t.shas.get(p),m=n.get(p)?.blobSha,_=i.get(p);if(h!==void 0&&m!==void 0){if(h===m){u++;continue}l.push(await this.classifyContentDiff(e,p,h,m,_,s,o,t,{...c,takeRepoFetch:a(()=>f-- >0,"takeRepoFetch")}));continue}if(h!==void 0){let b;s.has(p)?b={path:p,presence:"local-only",cls:"quarantine-pinned",localSha:h}:_===void 0?b={path:p,presence:"local-only",cls:"pending-local-add",localSha:h}:_===h?b={path:p,presence:"local-only",cls:"pending-remote-delete",localSha:h,detail:"remote deleted it; the local copy is unchanged"}:b={path:p,presence:"local-only",cls:"pending-conflict",localSha:h,detail:"remote deleted it AND the local copy was edited"},l.push(b);continue}if(m!==void 0){let b;s.has(p)?b={path:p,presence:"remote-only",cls:"quarantine-pinned",remoteSha:m}:_===void 0?b={path:p,presence:"remote-only",cls:"pending-remote-add",remoteSha:m}:_===m?b={path:p,presence:"remote-only",cls:"deferred-local-delete",remoteSha:m,detail:"locally deleted; the delete propagates on the next sync (#3476) \u2014 escalates if it survives a converged round"}:b={path:p,presence:"remote-only",cls:"pending-conflict",remoteSha:m,detail:"locally deleted AND the remote copy was edited"},l.push(b)}}return{discrepancies:l,inParity:u,filesChecked:d.size}}async classifyContentDiff(e,t,n,i,s,o,c,l,u){let f={localSha:n,remoteSha:i};if(o.has(t))return{path:t,presence:"both",cls:"quarantine-pinned",...f};if(s!==void 0&&s===n)return{path:t,presence:"both",cls:"pending-remote-edit",...f};if(s!==void 0&&s===i)return{path:t,presence:"both",cls:"pending-local-edit",...f};if(c)return{path:t,presence:"both",cls:"pending-conflict",...f,detail:"binary content differs on both sides"};if(!u.takeRepoFetch()||!u.runBudget.take(1))return u.warnings.push(`semantic-fetch cap reached \u2014 ${t} left unverified (counted into M2)`),{path:t,presence:"both",cls:"unverified-divergence",...f};let d=l.texts.get(t),p;try{p=await(0,$m.getBlobText)(this.transport,e.owner,e.repo,i,this.deps.baseURL)}catch(g){let m=this.deps.redact??(_=>_);return u.warnings.push(`blob fetch for ${t} failed (${m(Ru(g))}) \u2014 left unverified`),{path:t,presence:"both",cls:"unverified-divergence",...f}}let h=(0,MU.compareAssetSemantics)(d??"",p,this.deps.yaml);return(0,MU.isFormatOnlyDrift)(h)?{path:t,presence:"both",cls:"format-only-drift",...f,frontmatterEqual:!0,bodyEqual:!0}:{path:t,presence:"both",cls:"pending-conflict",...f,frontmatterEqual:h.frontmatterEqual,bodyEqual:h.bodyEqual,detail:`semantic divergence (frontmatter ${h.frontmatterEqual?"equal":"differs"}, body ${h.bodyEqual?"equal":"differs"})`}}checkConservation(e,t,n,i,s,o){if(e.pullOnly===!0)return[];let c=t.snapshot?.dirtyByRepo.get(e.repoKey);if(c===void 0||c.size===0)return[];let l=new Set(o?.mergedPaths??[]),u=new Set(o?.quarantinedPaths??[]),f=[];for(let[d,p]of c)n.shas.get(d)!==p&&i.get(d)?.blobSha!==p&&(l.has(d)||u.has(d)||s.has(d)||f.push({repoKey:e.repoKey,path:d,kind:"conservation",detail:`pre-sync dirty content ${p.slice(0,7)} survived NOWHERE: disk now ${n.shas.get(d)?.slice(0,7)??"absent"}, not in head tree, not merged/quarantined/pinned \u2014 possible lost edit`}));return f}escalatePersistentDivergence(e,t,n){for(let i of e){if(i.status!=="checked")continue;let s=n?.find(u=>u.repoKey===i.repoKey);if(s!==void 0&&s.status!=="synced")continue;let o=new Set(s?.deferredDeletes??[]),c=t.repos.find(u=>u.repoKey===i.repoKey&&u.status==="checked");if(c===void 0)continue;let l=new Map(c.discrepancies.filter(u=>$U.has(u.cls)).map(u=>[u.path,u]));for(let u of i.discrepancies){if(!$U.has(u.cls)||u.cls==="deferred-local-delete"&&o.has(u.path))continue;let f=l.get(u.path);f!==void 0&&f.localSha===u.localSha&&f.remoteSha===u.remoteSha&&i.m1Violations.push({repoKey:i.repoKey,path:u.path,kind:"persistent-divergence",detail:`identical divergence (local ${u.localSha?.slice(0,7)??"absent"}, remote ${u.remoteSha?.slice(0,7)??"absent"}) survived a sync round unchanged (${f.cls} \u2192 ${u.cls}) \u2014 the engine failed to converge it`})}}}};jm.ParityValidator=q2;function Xfe(r){if(r.vacuous)return`ExoSync parity: VACUOUS \u2014 0 of ${r.repos.length} repo(s) checked (errors / never synced)`;let e=r.repos.length-r.checkedRepos,t=e>0?`, ${e} skipped`:"",n=r.repos.reduce((s,o)=>s+o.discrepancies.filter(c=>c.cls==="quarantine-pinned").length,0),i=n>0?`, ${n} pinned`:"";return r.ok?`ExoSync parity: M1=0, M2=\u2205 (${r.checkedRepos} repo(s) checked${t})${i}`:`ExoSync parity: M1=${r.m1Total}, M2=${r.m2Total} diff(s) (${r.checkedRepos} repo(s) checked${t})${i} \u2014 see log`}a(Xfe,"summarizeParityRound")});var UU=T(BU=>{"use strict";Object.defineProperty(BU,"__esModule",{value:!0})});var Bm=T(on=>{"use strict";Object.defineProperty(on,"__esModule",{value:!0});on.UID_UNIQUENESS_WHITELIST_CLASS_UIDS=on.KNOWN_CHECK_IDS=on.CHECK_ID_DAG_ONTOLOGY_IMPORTS=on.CHECK_ID_UID_UNIQUENESS=on.CHECK_ID_CO_LOCATION=on.CHECK_ID_SHACL=void 0;on.CHECK_ID_SHACL="f83ffedd-1f05-4ab5-839d-58873c69c4ba";on.CHECK_ID_CO_LOCATION="61f95c82-f6fc-4b20-b06d-19f3dc1b1f12";on.CHECK_ID_UID_UNIQUENESS="ac10db25-231c-4677-8cac-647d3cf15c64";on.CHECK_ID_DAG_ONTOLOGY_IMPORTS="a57f4a6b-a462-4c8d-b958-0dbee4674727";on.KNOWN_CHECK_IDS=new Set([on.CHECK_ID_SHACL,on.CHECK_ID_CO_LOCATION,on.CHECK_ID_UID_UNIQUENESS,on.CHECK_ID_DAG_ONTOLOGY_IMPORTS]);on.UID_UNIQUENESS_WHITELIST_CLASS_UIDS=new Set(["b04e7a3e-6b49-4984-9f8d-b74e9f36818b","2b754a16-cccf-49ee-af69-a18c6d1e3b63"])});var pw=T(Um=>{"use strict";Object.defineProperty(Um,"__esModule",{value:!0});Um.readUid=Jfe;Um.readIsDefinedByRef=Zfe;Um.readInstanceClassRefs=ede;var VU=hu();function Jfe(r){let e=r.exo__Asset_uid;if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}a(Jfe,"readUid");function Zfe(r){return(0,VU.extractAssetReference)(r.exo__Asset_isDefinedBy)}a(Zfe,"readIsDefinedByRef");function ede(r){let e=r.exo__Instance_class,t=Array.isArray(e)?e:e==null?[]:[e],n=[];for(let i of t){let s=(0,VU.extractAssetReference)(i);s&&n.push(s)}return n}a(ede,"readInstanceClassRefs")});var K2=T(W2=>{"use strict";Object.defineProperty(W2,"__esModule",{value:!0});W2.uidUniquenessCheck=rde;var GU=pw(),tde=Bm();function rde(r){let e=new Map;for(let n of r.assets){let i=(0,GU.readUid)(n.frontmatter);if(!i||(0,GU.readInstanceClassRefs)(n.frontmatter).some(c=>tde.UID_UNIQUENESS_WHITELIST_CLASS_UIDS.has(c)))continue;let o=e.get(i);o?o.push(n.path):e.set(i,[n.path])}let t=[];for(let[n,i]of e){if(i.length<2)continue;let s=[...i].sort();for(let o of s)t.push({path:o,message:`duplicate exo__Asset_uid "${n}" \u2014 also at ${s.filter(c=>c!==o).join(", ")}`})}return t}a(rde,"uidUniquenessCheck")});var H2=T(z2=>{"use strict";Object.defineProperty(z2,"__esModule",{value:!0});z2.coLocationCheck=ode;var qU=pw(),nde=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function WU(r){let e=r.lastIndexOf("/");return e<0?"":r.slice(0,e)}a(WU,"dirOf");function ide(r){let e=r.slice(r.lastIndexOf("/")+1);return e.endsWith(".md")?e.slice(0,-3):e}a(ide,"baseNameNoExt");function sde(r){return r.split("/").some(e=>e.toLowerCase()==="templates")}a(sde,"isTemplatesPath");function ode(r){let e=new Map,t=new Map;for(let s of r.assets){let o=(0,qU.readUid)(s.frontmatter);o&&!e.has(o)&&e.set(o,s.path);let c=ide(s.path);t.has(c)||t.set(c,s.path)}let n=a(s=>nde.test(s)?e.get(s)??t.get(s):t.get(s)??e.get(s),"resolve"),i=[];for(let s of r.assets){if(s.path.split("/").includes("node_modules")||sde(s.path))continue;let o=(0,qU.readIsDefinedByRef)(s.frontmatter);if(!o||o.startsWith("!"))continue;let c=n(o);if(!c)continue;let l=WU(c),u=WU(s.path);l!==u&&i.push({path:s.path,message:`co-location: isDefinedBy=${o} expects folder "${l}/" but asset is in "${u}/"`})}return i}a(ode,"coLocationCheck")});var Q2=T(Y2=>{"use strict";Object.defineProperty(Y2,"__esModule",{value:!0});Y2.shaclCheck=ade;async function ade(r){if(!r.runShacl)throw new Error("SHACL check is enabled but this context provides no triple-store (runShacl). Wire a warm getTripleStore()/runShapesValidation reader, or disable the check.");return(await r.runShacl()).map(t=>({path:t.focusNode??t.path,message:`SHACL: ${t.message}${t.path?` (path ${t.path})`:""}`}))}a(ade,"shaclCheck")});var J2=T(X2=>{"use strict";Object.defineProperty(X2,"__esModule",{value:!0});X2.dagOntologyImportsCheck=cde;async function cde(r){if(!r.runDag)throw new Error("DAG ontology-imports check is enabled but this context provides no graph derivation (runDag). Wire a reader that supplies it, or disable the check.");return[...await r.runDag()]}a(cde,"dagOntologyImportsCheck")});var Z2=T(Vm=>{"use strict";Object.defineProperty(Vm,"__esModule",{value:!0});Vm.CheckRegistry=void 0;Vm.createDefaultCheckRegistry=pde;var hw=Bm(),lde=K2(),ude=H2(),fde=Q2(),dde=J2(),mw=class{static{a(this,"CheckRegistry")}constructor(){this.entries=new Map}register(e){return this.entries.set(e.id,e),this}get(e){return this.entries.get(e)}has(e){return this.entries.has(e)}ids(){return[...this.entries.keys()]}};Vm.CheckRegistry=mw;function pde(){return new mw().register({id:hw.CHECK_ID_UID_UNIQUENESS,label:"uid-uniqueness",run:lde.uidUniquenessCheck}).register({id:hw.CHECK_ID_CO_LOCATION,label:"co-location",run:ude.coLocationCheck}).register({id:hw.CHECK_ID_SHACL,label:"shacl",run:fde.shaclCheck}).register({id:hw.CHECK_ID_DAG_ONTOLOGY_IMPORTS,label:"dag-ontology-imports",run:dde.dagOntologyImportsCheck})}a(pde,"createDefaultCheckRegistry")});var KU=T(gw=>{"use strict";Object.defineProperty(gw,"__esModule",{value:!0});gw.VaultCheckRunner=void 0;var hde=Z2(),ex=class{static{a(this,"VaultCheckRunner")}constructor(e=new hde.CheckRegistry){this.registry=e}async run(e,t){let n=await e.read();return this.runWithContext(n,t)}async runWithContext(e,t){let n=[];for(let i of t){let s=this.registry.get(i);if(!s){n.push({checkId:i,label:i,status:"error",findings:[],errorMessage:`fail-loud: enabled check-id "${i}" has no registered runner`});continue}try{let o=await s.run(e);n.push({checkId:i,label:s.label,status:o.length>0?"fail":"pass",findings:o})}catch(o){n.push({checkId:i,label:s.label,status:"error",findings:[],errorMessage:`fail-loud: check "${s.label}" threw \u2014 ${o instanceof Error?o.message:String(o)}`})}}return{totalAssets:e.assets.length,results:n,ok:n.every(i=>i.status==="pass")}}};gw.VaultCheckRunner=ex});var zU=T(tx=>{"use strict";Object.defineProperty(tx,"__esModule",{value:!0});tx.readEnabledCheckIds=yde;var mde=Bm(),gde=hu();function yde(r){let e=new Set;for(let t of r){let n=(0,gde.extractAssetReference)(t.frontmatter.setting__Setting_key);if(!n||!mde.KNOWN_CHECK_IDS.has(n))continue;let i=t.frontmatter.setting__Setting_value;(i===!0||i==="true")&&e.add(n)}return[...e]}a(yde,"readEnabledCheckIds")});var QU=T(Mt=>{"use strict";var _de=Mt&&Mt.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:a(function(){return e[t]},"get")}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),HU=Mt&&Mt.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&_de(e,r,t)};Object.defineProperty(Mt,"__esModule",{value:!0});Mt.readInstanceClassRefs=Mt.readIsDefinedByRef=Mt.readUid=Mt.dagOntologyImportsCheck=Mt.shaclCheck=Mt.coLocationCheck=Mt.uidUniquenessCheck=Mt.readEnabledCheckIds=Mt.VaultCheckRunner=Mt.createDefaultCheckRegistry=Mt.CheckRegistry=void 0;HU(UU(),Mt);HU(Bm(),Mt);var YU=Z2();Object.defineProperty(Mt,"CheckRegistry",{enumerable:!0,get:a(function(){return YU.CheckRegistry},"get")});Object.defineProperty(Mt,"createDefaultCheckRegistry",{enumerable:!0,get:a(function(){return YU.createDefaultCheckRegistry},"get")});var bde=KU();Object.defineProperty(Mt,"VaultCheckRunner",{enumerable:!0,get:a(function(){return bde.VaultCheckRunner},"get")});var Sde=zU();Object.defineProperty(Mt,"readEnabledCheckIds",{enumerable:!0,get:a(function(){return Sde.readEnabledCheckIds},"get")});var wde=K2();Object.defineProperty(Mt,"uidUniquenessCheck",{enumerable:!0,get:a(function(){return wde.uidUniquenessCheck},"get")});var Ede=H2();Object.defineProperty(Mt,"coLocationCheck",{enumerable:!0,get:a(function(){return Ede.coLocationCheck},"get")});var vde=Q2();Object.defineProperty(Mt,"shaclCheck",{enumerable:!0,get:a(function(){return vde.shaclCheck},"get")});var Tde=J2();Object.defineProperty(Mt,"dagOntologyImportsCheck",{enumerable:!0,get:a(function(){return Tde.dagOntologyImportsCheck},"get")});var rx=pw();Object.defineProperty(Mt,"readUid",{enumerable:!0,get:a(function(){return rx.readUid},"get")});Object.defineProperty(Mt,"readIsDefinedByRef",{enumerable:!0,get:a(function(){return rx.readIsDefinedByRef},"get")});Object.defineProperty(Mt,"readInstanceClassRefs",{enumerable:!0,get:a(function(){return rx.readInstanceClassRefs},"get")})});var JU=T(XU=>{"use strict";Object.defineProperty(XU,"__esModule",{value:!0})});var yw=T(dr=>{"use strict";Object.defineProperty(dr,"__esModule",{value:!0});dr.LEGACY_SETTING_VALUE_PROPS=dr.LEGACY_SETTING_KEY_PROPS=dr.SETTING_VALUE_PROP=dr.SETTING_KEY_PROP=void 0;dr.coerceSettingValue=Ade;dr.extractKeyRef=Ide;dr.readSettingValueRaw=Rde;dr.renderSettingAssetMarkdown=Ode;var ZU=hu();dr.SETTING_KEY_PROP="setting__Setting_key";dr.SETTING_VALUE_PROP="setting__Setting_value";dr.LEGACY_SETTING_KEY_PROPS=["exo__Setting_key"];dr.LEGACY_SETTING_VALUE_PROPS=["exo__Setting_value"];function Ade(r,e){switch(r){case"boolean":{if(typeof e=="boolean")return e;if(typeof e=="string"){let t=e.trim().toLowerCase();if(t==="true")return!0;if(t==="false")return!1}return}case"string":return typeof e=="string"?e:typeof e=="number"?String(e):void 0;case"stringList":{if(Array.isArray(e)){let t=e.filter(n=>typeof n=="string");return t.length===e.length?t:void 0}return typeof e=="string"?[e]:void 0}}}a(Ade,"coerceSettingValue");function e9(r){let e=r.indexOf("#");return e===-1?r:r.slice(0,e).trim()}a(e9,"stripAnchor");function Ide(r){let e=(0,ZU.extractAssetReference)(r[dr.SETTING_KEY_PROP]);if(e)return e9(e);for(let t of dr.LEGACY_SETTING_KEY_PROPS){let n=(0,ZU.extractAssetReference)(r[t]);if(n)return e9(n)}return null}a(Ide,"extractKeyRef");function Rde(r){if(dr.SETTING_VALUE_PROP in r)return r[dr.SETTING_VALUE_PROP];for(let e of dr.LEGACY_SETTING_VALUE_PROPS)if(e in r)return r[e]}a(Rde,"readSettingValueRaw");function Cde(r,e){switch(r){case"boolean":return[`${dr.SETTING_VALUE_PROP}: ${e===!0?"true":"false"}`];case"string":return[`${dr.SETTING_VALUE_PROP}: ${JSON.stringify(String(e??""))}`];case"stringList":{let t=Array.isArray(e)?e:[];return t.length===0?[`${dr.SETTING_VALUE_PROP}: []`]:[`${dr.SETTING_VALUE_PROP}:`,...t.map(n=>` - ${JSON.stringify(n)}`)]}}}a(Cde,"renderValueYaml");function Ode(r,e,t,n,i){return["---",`exo__Asset_uid: ${r.settingUid}`,`exo__Asset_isDefinedBy: "[[${n}]]"`,`exo__Asset_createdAt: ${i}`,"exo__Instance_class:",` - "[[${t}]]"`,`exo__Asset_label: "Setting: ${r.field}"`,`${dr.SETTING_KEY_PROP}: "[[${r.keyUid}]]"`,...Cde(r.datatype,e),"---","",`Distributable Exocortex setting \`${r.field}\` (${r.datatype}), exported by the Settings Distribution engine (RFC f402002b, M2). Edit \`setting__Setting_value\` here or re-export to overwrite.`,""].join(`
362
- `)}a(Ode,"renderSettingAssetMarkdown")});var t9=T(bw=>{"use strict";Object.defineProperty(bw,"__esModule",{value:!0});bw.exportSettings=xde;bw.importSettings=Pde;var _w=yw();function xde(r,e){return r.declaredKeys().map(t=>({field:t.field,fileName:`${t.settingUid}.md`,content:(0,_w.renderSettingAssetMarkdown)(t,r.readLiveValue(t),r.settingClassUid,e.ontologyUid,e.nowIso)}))}a(xde,"exportSettings");async function Pde(r,e){let t=new Map;for(let s of r.declaredKeys())t.set(s.keyUid,s),t.set(s.keyLabel,s);let n=[],i=[];for(let s of e){let o=(0,_w.extractKeyRef)(s.frontmatter),c=o!==null?t.get(o):void 0;if(c===void 0){i.push({path:s.path,reason:"unknown-key",detail:o??"<no setting key>"});continue}let l=(0,_w.coerceSettingValue)(c.datatype,(0,_w.readSettingValueRaw)(s.frontmatter));if(l===void 0){i.push({path:s.path,reason:"uncoercible",detail:`expected ${c.datatype}`});continue}await r.writeLiveValue(c,l),n.push(c.field)}return{applied:n,skipped:i}}a(Pde,"importSettings")});var r9=T(Gm=>{"use strict";Object.defineProperty(Gm,"__esModule",{value:!0});Gm.EXOCORTEX_DISTRIBUTION_ONTOLOGY_KEY_UID=void 0;Gm.resolveDistributionOntology=Fde;var nx=yw();Gm.EXOCORTEX_DISTRIBUTION_ONTOLOGY_KEY_UID="ea44f996-64e5-46ce-8953-b13d21ee750d";function Fde(r,e){for(let t of r){if((0,nx.extractKeyRef)(t.frontmatter)!==e)continue;let n=(0,nx.coerceSettingValue)("string",(0,nx.readSettingValueRaw)(t.frontmatter));if(typeof n=="string"){let i=n.trim();if(i.length>0)return i}}return null}a(Fde,"resolveDistributionOntology")});var s9=T(Pt=>{"use strict";var Lde=Pt&&Pt.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:a(function(){return e[t]},"get")}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Dde=Pt&&Pt.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Lde(e,r,t)};Object.defineProperty(Pt,"__esModule",{value:!0});Pt.resolveDistributionOntology=Pt.EXOCORTEX_DISTRIBUTION_ONTOLOGY_KEY_UID=Pt.importSettings=Pt.exportSettings=Pt.renderSettingAssetMarkdown=Pt.readSettingValueRaw=Pt.extractKeyRef=Pt.coerceSettingValue=Pt.LEGACY_SETTING_VALUE_PROPS=Pt.LEGACY_SETTING_KEY_PROPS=Pt.SETTING_VALUE_PROP=Pt.SETTING_KEY_PROP=void 0;Dde(JU(),Pt);var Xc=yw();Object.defineProperty(Pt,"SETTING_KEY_PROP",{enumerable:!0,get:a(function(){return Xc.SETTING_KEY_PROP},"get")});Object.defineProperty(Pt,"SETTING_VALUE_PROP",{enumerable:!0,get:a(function(){return Xc.SETTING_VALUE_PROP},"get")});Object.defineProperty(Pt,"LEGACY_SETTING_KEY_PROPS",{enumerable:!0,get:a(function(){return Xc.LEGACY_SETTING_KEY_PROPS},"get")});Object.defineProperty(Pt,"LEGACY_SETTING_VALUE_PROPS",{enumerable:!0,get:a(function(){return Xc.LEGACY_SETTING_VALUE_PROPS},"get")});Object.defineProperty(Pt,"coerceSettingValue",{enumerable:!0,get:a(function(){return Xc.coerceSettingValue},"get")});Object.defineProperty(Pt,"extractKeyRef",{enumerable:!0,get:a(function(){return Xc.extractKeyRef},"get")});Object.defineProperty(Pt,"readSettingValueRaw",{enumerable:!0,get:a(function(){return Xc.readSettingValueRaw},"get")});Object.defineProperty(Pt,"renderSettingAssetMarkdown",{enumerable:!0,get:a(function(){return Xc.renderSettingAssetMarkdown},"get")});var n9=t9();Object.defineProperty(Pt,"exportSettings",{enumerable:!0,get:a(function(){return n9.exportSettings},"get")});Object.defineProperty(Pt,"importSettings",{enumerable:!0,get:a(function(){return n9.importSettings},"get")});var i9=r9();Object.defineProperty(Pt,"EXOCORTEX_DISTRIBUTION_ONTOLOGY_KEY_UID",{enumerable:!0,get:a(function(){return i9.EXOCORTEX_DISTRIBUTION_ONTOLOGY_KEY_UID},"get")});Object.defineProperty(Pt,"resolveDistributionOntology",{enumerable:!0,get:a(function(){return i9.resolveDistributionOntology},"get")})});var sx=T(ix=>{"use strict";Object.defineProperty(ix,"__esModule",{value:!0});ix.resolvePreferenceList=Nde;function Nde(r,e){if(Array.isArray(r)&&r.length>1){let t=r.map(n=>e(n)).filter(n=>n!==null&&n.length>0);return t.length>0?t.join("|"):null}return Array.isArray(r)?r.length===0?null:e(r[0]):e(r)}a(Nde,"resolvePreferenceList")});var Sw=T(ox=>{"use strict";Object.defineProperty(ox,"__esModule",{value:!0});ox.unwrapLinkTarget=kde;function kde(r){let e=r.replace(/^\[\[|\]\]$/g,"").replace(/^"|"$/g,"").trim();return e.includes("|")?e.split("|")[0]?.trim()??"":e}a(kde,"unwrapLinkTarget")});var ax=T(ww=>{"use strict";Object.defineProperty(ww,"__esModule",{value:!0});ww.DEFAULT_DISPLAY_NAME_SETTINGS=void 0;ww.DEFAULT_DISPLAY_NAME_SETTINGS={defaultTemplate:"{{exo__Asset_label}}",classTemplates:{},projectTBoxNames:!0}});var Wm=T(qm=>{"use strict";Object.defineProperty(qm,"__esModule",{value:!0});qm.isWikilink=cx;qm.ownProperty=Ew;qm.resolveKeyPath=Mde;function cx(r){return r.startsWith("[[")&&r.endsWith("]]")}a(cx,"isWikilink");function Ew(r,e){if(!(r===null||typeof r!="object"))return Object.prototype.hasOwnProperty.call(r,e)?r[e]:void 0}a(Ew,"ownProperty");function Mde(r,e,t){let n=e.split("."),i=r;for(let s of n){if(i==null)return;if(Array.isArray(i)){let o=i[0];if(typeof o=="string"&&t&&cx(o)){let c=t(o);if(c){i=Ew(c,s);continue}return}}if(typeof i!="object"){if(typeof i=="string"&&t&&cx(i)){let o=t(i);if(o){i=Ew(o,s);continue}}return}i=Ew(i,s)}return i}a(Mde,"resolveKeyPath")});var vw=T(bs=>{"use strict";Object.defineProperty(bs,"__esModule",{value:!0});bs.DEFAULT_DISPLAY_NAME_TEMPLATE=bs.DISPLAY_NAME_PRESETS=bs.DisplayNameTemplateEngine=bs.COMPOSED_SOURCE_MARKER=void 0;var $de=Wm();bs.COMPOSED_SOURCE_MARKER="displayName";var lx=`!${bs.COMPOSED_SOURCE_MARKER}`,Hd=class r{static{a(this,"DisplayNameTemplateEngine")}constructor(e,t={}){this.template=e,this.options=t}render(e,t,n,i,s){if(!this.template||this.template.trim()==="")return null;let o=this.options.separator;if(o)return this.renderWithSeparator(o,e,t,n,i);let c=0,l=0,u=this.renderSegment(this.template,e,t,n,i,()=>{c+=1},()=>{l+=1});if(s?.({placeholders:c,nonEmpty:l}),c>0&&l===0&&r.hasReadableFallback(e,t))return null;let f=this.cleanupResult(u);return f===""?null:f}static hasReadableFallback(e,t){let n=e.exo__Asset_label;if(typeof n=="string"&&n.trim()!=="")return!0;let i=t.trim();return i===""?!1:!r.UUID_PATTERN.test(i)}renderSegment(e,t,n,i,s,o,c){return e.replace(r.PLACEHOLDER_PATTERN,(l,u)=>{let f=u.trim();o?.();let d=this.resolveValue(f,t,n,i,s);return d.trim()!==""&&c?.(),d})}renderWithSeparator(e,t,n,i,s){let o=this.template.indexOf("{{"),c=this.template.lastIndexOf("}}");if(o===-1||c===-1||c<o){let m=this.cleanupResult(this.renderSegment(this.template,t,n,i,s));return m===""?null:m}let l=this.template.slice(0,o),u=this.template.slice(o,c+2),f=this.template.slice(c+2),d=[];for(let m of r.splitOutsidePlaceholders(u,e)){let _=this.cleanupResult(this.renderSegment(m,t,n,i,s));_!==""&&d.push(_)}if(d.length===0)return null;let p=this.renderSegment(l,t,n,i,s),h=this.renderSegment(f,t,n,i,s),g=`${p}${d.join(e)}${h}`.trim();return g===""?null:g}static splitOutsidePlaceholders(e,t){if(t.length===0)return[e];let n=[],i="",s=0;for(;s<e.length;){if(e.startsWith("{{",s)){let o=e.indexOf("}}",s+2);if(o!==-1){i+=e.slice(s,o+2),s=o+2;continue}}if(e.startsWith(t,s)){n.push(i),i="",s+=t.length;continue}i+=e[s],s+=1}return n.push(i),n}cleanupResult(e){let t=e;return t=t.replace(/\s+\(\s*\)$/g,""),t=t.replace(/^\(\s*\)\s+/g,""),t==="()"&&(t=""),t=t.replace(/\s+\[\s*\]$/g,""),t=t.replace(/^\[\s*\]\s+/g,""),t==="[]"&&(t=""),t=t.replace(/\s+/g," "),t.trim()}resolveValue(e,t,n,i,s){if(e==="_basename")return n;if(e==="_created")return i?this.formatDate(i):"";let{path:o,format:c,preferComposed:l}=r.splitKeyAndFormat(e),u=o.includes("|")?o.split("|").map(d=>d.trim()).filter(d=>d.length>0):[o],f="";for(let d of u){let p=this.getNestedValue(t,d,s),h;if(c){let g=r.applyValueFormat(p,c);h=g!==null?g:this.formatValue(p,s,l)}else h=this.formatValue(p,s,l);if(h!=="")return h;f=h}return f}static splitKeyAndFormat(e){let t=e,n=!1,i=t.trimEnd();i.length>lx.length&&i.endsWith(lx)&&(n=!0,t=i.slice(0,-lx.length).trim());let s=t.indexOf("::");if(s<=0)return n?{path:t,preferComposed:n}:{path:t};let o=t.slice(0,s).trim(),c=t.slice(s+2).trim();return!o||!c?n?{path:t,preferComposed:n}:{path:t}:n?{path:o,format:c,preferComposed:n}:{path:o,format:c}}static applyValueFormat(e,t){let n=e;if(Array.isArray(n)){if(n.length===0)return null;n=n[0]}let i,s,o,c,l,u;if(n instanceof Date){if(Number.isNaN(n.getTime()))return null;let p=a(h=>String(h).padStart(2,"0"),"pad");i=String(n.getUTCFullYear()).padStart(4,"0"),s=p(n.getUTCMonth()+1),o=p(n.getUTCDate()),c=p(n.getUTCHours()),l=p(n.getUTCMinutes()),u=p(n.getUTCSeconds())}else if(typeof n=="string"){let p=/^\s*(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?)?/.exec(n);if(!p)return null;i=p[1],s=p[2],o=p[3],c=p[4],l=p[5],u=p[6]}else return null;let f=!1,d=t.replace(/YYYY|YY|MM|DD|HH|mm|ss/g,p=>{switch(p){case"YYYY":return i;case"YY":return i.slice(-2);case"MM":return s;case"DD":return o;case"HH":return c===void 0&&(f=!0),c??"";case"mm":return l===void 0&&(f=!0),l??"";case"ss":return u===void 0&&(f=!0),u??"";default:return p}});return f?null:d}getNestedValue(e,t,n){return(0,$de.resolveKeyPath)(e,t,n)}formatWikilinkValue(e,t,n=!1){let i=e.match(/^\[\[([^\]|]+?)(?:\|([^\]]+))?\]\]$/);if(!i)return e.replace(r.WIKILINK_PATTERN,"").trim();let s=i[1].trim(),o=i[2]?.trim();if(o)return o;let c=t?t(e):void 0,l=c?.exo__Asset_label,u=typeof l=="string"&&l.trim()?l.trim():null,f=a(()=>{let d=this.options.nestedDisplayName?.(e,c);return d!=null&&d.trim()!==""?d.trim():null},"composed");if(n){let d=f();if(d!==null)return d}if(u!==null)return u;if(!n){let d=f();if(d!==null)return d}return s}formatValue(e,t,n=!1){if(e==null)return"";if(typeof e=="string")return this.formatWikilinkValue(e,t,n);if(Array.isArray(e)){if(e.length===0)return"";if(this.options.joinArrayValues){let i=[];for(let s of e){let o=this.formatValue(s,t,n);o&&!r.UUID_PATTERN.test(o)&&i.push(o)}return i.join(" ")}return this.formatValue(e[0],t,n)}return typeof e=="object"?JSON.stringify(e):String(e)}formatDate(e){let t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),i=String(e.getDate()).padStart(2,"0");return`${t}-${n}-${i}`}getTemplate(){return this.template}isValid(){return!this.template||this.template.trim()===""?!1:/\{\{[^}]+\}\}/.test(this.template)}getPlaceholders(){let e=[],t=/\{\{([^}]+)\}\}/g,n;for(;(n=t.exec(this.template))!==null;)e.push(n[1].trim());return e}};bs.DisplayNameTemplateEngine=Hd;Hd.PLACEHOLDER_PATTERN=/\{\{([^}]+)\}\}/g;Hd.WIKILINK_PATTERN=/^\[\[|\]\]$/g;Hd.UUID_PATTERN=/^[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}$/;bs.DISPLAY_NAME_PRESETS={default:{name:"Label only (default)",template:"{{exo__Asset_label}}"},labelWithStatus:{name:"Label with status",template:"{{exo__Asset_label}}: {{ems__Effort_status}}"},classPrefix:{name:"Class prefix",template:"[{{exo__Instance_class}}] {{exo__Asset_label}}"},classSuffix:{name:"Class suffix",template:"{{exo__Asset_label}} ({{exo__Instance_class}})"},basenameWithLabel:{name:"Filename with label",template:"{{_basename}} - {{exo__Asset_label}}"},datePrefix:{name:"Date prefix",template:"{{_created}} - {{exo__Asset_label}}"}};bs.DEFAULT_DISPLAY_NAME_TEMPLATE=bs.DISPLAY_NAME_PRESETS.classSuffix.template});var c9=T(Tw=>{"use strict";Object.defineProperty(Tw,"__esModule",{value:!0});Tw.PrintNameRuleService=void 0;var jde=sx(),o9=Sw(),a9=Wm(),Bde=vw(),Ude="exo__DisplayNameSpec",Vde="07eab746-0874-4676-9d98-dbaad1bc6fb8",Gde=new Set(["8bc662e3-2984-4845-9593-d37e0db9b7e3","exo__PrintedPropertyValueSourceDisplayName"]),qde="exo__PrintedProperty",Wde="7d58de40-d941-4a66-88e2-13afc4fdc41d",Kde="exo__PrintedLiteral",zde="4d5437c9-788e-4a6d-9be0-4af3a84554f4",Hde=1e3,Yde=300,ux=class r{static{a(this,"PrintNameRuleService")}constructor(e,t={},n=void 0){this.vault=e,this.hostFunctions=t,this.host=n,this.rules=new Map,this.classHierarchy=new Map,this.initialized=!1,this.scanDebounceTimer=null}initialize(){this.scanVault(),this.initialized=!0}getTemplateForClass(e,t){if(!this.initialized)return null;let n=this.selectRule(this.rules.get(e),t);if(n)return{template:n.template,priority:n.priority};let i=this.getAncestorClasses(e);for(let s of i){let o=this.selectRule(this.rules.get(s),t);if(o)return{template:o.template,priority:o.priority}}return null}getParticipatingRules(e,t){if(!this.initialized)return[];let n=this.participatingOf(this.rules.get(e),t);if(n.length>0)return n;for(let i of this.getAncestorClasses(e)){let s=this.participatingOf(this.rules.get(i),t);if(s.length>0)return s}return[]}selectRule(e,t){if(!e||e.length===0)return null;for(let n of e)if(this.ruleParticipates(n,t))return n;return null}participatingOf(e,t){if(!e||e.length===0)return[];let n=[];for(let i of e)this.ruleParticipates(i,t)&&n.push({template:i.template,priority:i.priority,sourceFile:i.sourceFile,...i.separator?{separator:i.separator}:{}});return n}ruleParticipates(e,t){return e.matcher?t?this.matcherSatisfied(e.matcher,t):!1:!0}matcherSatisfied(e,t){if(e.kind==="hostFunction"){if(!Object.prototype.hasOwnProperty.call(this.hostFunctions,e.hostFunction))return!1;let s=this.hostFunctions[e.hostFunction];return typeof s!="function"?!1:s(this.host,t)}let n=e.matchKey.includes(".")?(0,a9.resolveKeyPath)(t,e.matchKey,this.createMetadataResolver()):(0,a9.ownProperty)(t,e.matchKey),i=this.extractClassKeys(n);return i.length===0?!1:i.some(s=>e.matchValues.includes(s))}resolveIdentityForms(e){let t=this.extractClassKeys(e);if(t.length===0)return[];let n=new Set(t);for(let i of t){let s=this.vault.resolveLinkpathFrontmatter(i);if(!s)continue;let o=s.exo__Asset_uid,c=s.exo__Asset_label;typeof o=="string"&&o.trim()&&n.add(o.trim()),typeof c=="string"&&c.trim()&&n.add(c.trim())}return[...n]}resolveMatchValues(e){return this.resolveIdentityForms(e)}resolveHostFunctionName(e){let t=e;if(Array.isArray(t)){if(t.length===0)return null;t=t[0]}return typeof t!="string"?null:t.replace(/^\[\[|\]\]$/g,"").replace(/^"|"$/g,"").trim()||null}static declaresComposedSource(e){let t=e;if(Array.isArray(t)){if(t.length===0)return!1;t=t[0]}if(typeof t!="string")return!1;let n=(0,o9.unwrapLinkTarget)(t).replace(/\.md$/,"");return!!Gde.has(n)}createMetadataResolver(){return e=>{let t=(0,o9.unwrapLinkTarget)(e);if(!t)return null;let n=this.vault.resolveLinkpathFrontmatter(t);return n?{...n}:null}}refresh(){this.scanVault()}scheduleRefresh(){this.scanDebounceTimer!==null&&window.clearTimeout(this.scanDebounceTimer),this.scanDebounceTimer=window.setTimeout(()=>{this.scanDebounceTimer=null,this.scanVault()},Yde)}scanVault(){this.rules.clear(),this.classHierarchy.clear();let e=new Map,t=[];for(let n of this.vault.listFrontmatter()){let i=this.cleanClassValue(n.exo__Instance_class);i===Ude||i===Vde?this.collectDisplayNameSpec(n,e):(i===qde||i===Wde||i===Kde||i===zde)&&this.collectDisplayNamePart(n,t);let s=this.cleanClassValue(n.exo__Class_superClass);if(s&&i){let o=this.cleanClassValue(n.exo__Asset_label)||i,c=this.classHierarchy.get(o);c?c.push(s):this.classHierarchy.set(o,[s])}}this.compileDisplayNameSpecs(e,t)}collectDisplayNameSpec(e,t){let n=typeof e.exo__Asset_uid=="string"?e.exo__Asset_uid.trim():"";if(!n)return;let i=this.resolveIdentityForms(e.exo__DisplayNameSpec_appliesToClass);if(i.length===0)return;let s=e.exo__DisplayNameSpec_priority,o=typeof s=="number"?s:typeof s=="string"&&s.trim()!==""?Number(s):0,c=this.resolvePropertyKey(e.exo__DisplayNameSpec_matchPath),l=this.resolveMatchValues(e.exo__DisplayNameSpec_matchValue),u=c!==null&&l.length>0,f=this.resolveHostFunctionName(e.exo__DisplayNameSpec_matchHostFunction),d=e.exo__DisplayNameSpec_separator,p=typeof d=="string"&&d!==""?d:void 0;t.set(n,{uid:n,classKeys:i,priority:Number.isFinite(o)?o:0,...u?{matchKey:c??void 0,matchValues:l}:{},...f?{hostFunction:f}:{},...p?{separator:p}:{}})}collectDisplayNamePart(e,t){let n=this.cleanClassValue(e.exo__DisplayNamePart_of);if(!n)return;let i=e.exo__DisplayNamePart_order,s=typeof i=="number"?i:typeof i=="string"&&i.trim()!==""?Number(i):NaN;if(!Number.isFinite(s))return;let o=this.resolvePropertyKeyList(e.exo__PrintedProperty_property),c=e.exo__PrintedLiteral_literal,l=typeof c=="string"?c:void 0,u=e.exo__PrintedProperty_format,f=typeof u=="string"&&u.trim()!==""?u.trim():void 0,d=r.declaresComposedSource(e.exo__PrintedProperty_valueSource);o?t.push({specUid:n,order:s,propertyKey:o,...f?{format:f}:{},...d?{preferComposed:d}:{}}):l!==void 0&&t.push({specUid:n,order:s,literal:l})}compileDisplayNameSpecs(e,t){let n=new Map;for(let i of t){let s=n.get(i.specUid);s?s.push(i):n.set(i.specUid,[i])}for(let i of e.values()){let s=(n.get(i.uid)??[]).slice().sort((u,f)=>u.order-f.order);if(s.length===0)continue;let o=s.map(u=>{if(!u.propertyKey)return u.literal??"";let f=u.preferComposed?`!${Bde.COMPOSED_SOURCE_MARKER}`:"";return u.format?`{{${u.propertyKey}::${u.format}${f}}}`:`{{${u.propertyKey}${f}}}`}).join(i.separator??"");if(!o.trim())continue;let c=Hde+i.priority,l;i.matchKey&&i.matchValues&&i.matchValues.length>0?l={kind:"value",matchKey:i.matchKey,matchValues:i.matchValues}:i.hostFunction&&(l={kind:"hostFunction",hostFunction:i.hostFunction});for(let u of i.classKeys){if(!u)continue;let f={className:u,template:o,priority:c,sourceFile:i.uid,...l?{matcher:l}:{},...i.separator?{separator:i.separator}:{}},d=this.rules.get(u);d?(d.push(f),d.sort((p,h)=>h.priority-p.priority)):this.rules.set(u,[f])}}}resolvePropertyKey(e){return Array.isArray(e)?e.length===0?null:this.resolveSinglePropertyKey(e[0]):this.resolveSinglePropertyKey(e)}resolvePropertyKeyList(e){return(0,jde.resolvePreferenceList)(e,t=>this.resolveSinglePropertyKey(t))}resolveSinglePropertyKey(e){if(typeof e!="string")return null;let t=e.replace(/^\[\[|\]\]$/g,"").replace(/^"|"$/g,"").trim();if(!t)return null;if(t.includes("|"))return t.split("|").pop()?.trim()||null;let n=t.replace(/\.md$/,"").trim();if(!n)return null;let i=this.vault.resolveLinkpathFrontmatter(n);if(i){let s=i.exo__Asset_label;if(typeof s=="string"&&s.trim())return s.trim()}return n}extractClassKeys(e){let t=e;if(Array.isArray(t)){if(t.length===0)return[];t=t[0]}if(typeof t!="string")return[];let n=t.replace(/^\[\[|\]\]$/g,"").replace(/^"|"$/g,"").trim();if(!n)return[];if(n.includes("|")){let[i,s]=n.split("|");return[i.trim().replace(/\.md$/,""),s.trim()].filter(o=>!!o)}return[n.replace(/\.md$/,"")]}getAncestorClasses(e){let t=[],n=new Set,i=[e];for(;i.length>0;){let s=i.shift();if(!s||n.has(s))continue;n.add(s);let o=this.classHierarchy.get(s);if(o)for(let c of o)n.has(c)||(t.push(c),i.push(c))}return t}cleanClassValue(e){if(!e)return null;if(Array.isArray(e))return e.length===0?null:this.cleanClassValue(e[0]);if(typeof e!="string")return null;let t=e.replace(/^\[\[|\]\]$/g,"").replace(/^"|"$/g,"").trim();return t.includes("|")&&(t=(t.split("|").pop()??t).trim()),t||null}getRulesCount(){let e=0;for(let t of this.rules.values())e+=t.length;return e}};Tw.PrintNameRuleService=ux});var l9=T(Km=>{"use strict";Object.defineProperty(Km,"__esModule",{value:!0});Km.DisplayNameResolver=void 0;Km.createDefaultResolver=rpe;var Qde=vw(),Xde=Wm(),Jde=Sw(),Zde=ax(),epe=3,tpe=new Set(["8619c4fc-64f1-4869-b17e-e34186cacca9","exo__Class","38277bfa-d7f9-4a75-b856-b23276ab0db3","exo__Property","9a1cf31c-9d41-4ef3-9023-584a8d087d16","exo__ObjectProperty","ae56ca4c-b610-42a4-a25d-058c23673296","exo__DatatypeProperty","84756998-3b4e-4989-91cc-a5d5c23664d4","exo__URLProperty"]),Aw=class{static{a(this,"DisplayNameResolver")}constructor(e,t,n){this.settings=e,this.ruleService=t,this.metadataResolver=n,this.nestedDepth=0,this.nestedTargets=new Set}resolve(e){return this.resolveWithProvenance(e).displayName}resolveWithProvenance(e){let{metadata:t,basename:n,createdDate:i}=e,s=this.extractAssetClasses(t),o=this.computeTBoxNamingProjection(s,t);if(o!==null)return{displayName:o,provenance:"tboxProjection"};let{template:c,separator:l,provenance:u}=this.resolveRenderSpec(s,t);return{displayName:new Qde.DisplayNameTemplateEngine(c,{...l?{separator:l}:{},nestedDisplayName:a((d,p)=>this.resolveNestedDisplayName(d,p),"nestedDisplayName")}).render(t,n,i,this.metadataResolver??void 0),provenance:u}}resolveNestedDisplayName(e,t){if(!this.metadataResolver)return null;let n=(0,Jde.unwrapLinkTarget)(e).replace(/\.md$/,"");if(this.nestedDepth>=epe||this.nestedTargets.has(n))return null;let i=t!==void 0?t:this.metadataResolver(e);if(!i)return null;this.nestedDepth+=1,this.nestedTargets.add(n);try{let s=this.resolveWithProvenance({metadata:i,basename:n});return s.provenance!=="spec"&&s.provenance!=="tboxProjection"?null:s.displayName}catch{return null}finally{this.nestedTargets.delete(n),this.nestedDepth-=1}}getTemplateForClasses(e,t){return this.resolveRenderSpec(e,t).template}resolveRenderSpec(e,t){if(this.ruleService&&e.length>0){let s=[],o=new Set;for(let c of e)for(let l of this.ruleService.getParticipatingRules(c,t))o.has(l.sourceFile)||(o.add(l.sourceFile),s.push(l));if(s.length>0)return s.sort((c,l)=>l.priority-c.priority||c.sourceFile.localeCompare(l.sourceFile)),s.length===1?{template:s[0].template,...s[0].separator?{separator:s[0].separator}:{},provenance:"spec"}:{...this.composeTemplates(s),provenance:"spec"}}let n=e[0],i=n?(0,Xde.ownProperty)(this.settings.classTemplates,n):void 0;return typeof i=="string"&&i?{template:i,provenance:"classTemplate"}:{template:this.settings.defaultTemplate,provenance:"default"}}composeTemplates(e){let t=new Set,n=new Set,i=[],s=[],o=null,c,l=a((p,h,g)=>{for(let m of p.trim().split(/\s+/))!m||h.has(m)||(h.add(m),g.push(m))},"collect");for(let p of e){let{prefix:h,core:g,suffix:m}=this.splitTemplate(p.template);o===null&&g!==""&&(o=g,c=p.separator),l(h,t,i),l(m,n,s)}let u=o??"",f=i.map(p=>`${p} `).join(""),d=s.length?` ${s.join(" ")}`:"";return{template:`${f}${u}${d}`,...c?{separator:c}:{}}}splitTemplate(e){let t=e.indexOf("{{"),n=e.lastIndexOf("}}");return t===-1||n===-1||n<t?{prefix:e,core:"",suffix:""}:{prefix:e.slice(0,t),core:e.slice(t,n+2),suffix:e.slice(n+2)}}getTemplateForClass(e,t){return this.getTemplateForClasses(e?[e]:[],t)}extractAssetClasses(e){let t=e.exo__Instance_class;if(!t)return[];let n=Array.isArray(t)?t:[t],i=[],s=new Set;for(let o of n){let c=this.cleanClassValue(o);c&&!s.has(c)&&(s.add(c),i.push(c))}return i}cleanClassValue(e){if(typeof e!="string")return null;let t=e.replace(/^\[\[|\]\]$/g,"").replace(/^"|"$/g,"").trim();return t.includes("|")&&(t=(t.split("|").pop()??t).trim()),t||null}computeTBoxNamingProjection(e,t){if(this.settings.projectTBoxNames===!1||!this.isTBoxNamingEntity(e))return null;if(this.ruleService){for(let u of e)if(this.ruleService.getParticipatingRules(u,t).length>0)return null}let n=typeof t.exo__Asset_label=="string"?t.exo__Asset_label.trim():"",[i,s]=this.splitPrefixedLabel(n),c=(typeof t.exo__Slugable_slug=="string"?t.exo__Slugable_slug.trim():"")||s;if(!c)return null;let l=this.resolveOntologyShortName(t)??i;return l?`${l}#${c}`:c}isTBoxNamingEntity(e){return e.some(t=>tpe.has(t))}resolveOntologyShortName(e){if(!this.metadataResolver)return null;let t=this.firstString(e.exo__Asset_isDefinedBy);if(!t)return null;let i=this.metadataResolver(t)?.exo__Ontology_shortName;return typeof i=="string"&&i.trim()?i.trim():null}splitPrefixedLabel(e){let t=e.indexOf("__");if(t<=0)return[null,null];let n=e.slice(0,t),i=e.slice(t+2);return i?[n,i]:[null,null]}firstString(e){let t=e;if(Array.isArray(t)){if(t.length===0)return null;t=t[0]}return typeof t!="string"?null:t.trim()||null}configuredClassEntries(){return Object.entries(this.settings.classTemplates).filter(e=>typeof e[1]=="string"&&e[1].length>0)}getConfiguredClasses(){return this.configuredClassEntries().map(([e])=>e)}hasClassTemplates(){return this.configuredClassEntries().length>0}};Km.DisplayNameResolver=Aw;async function rpe(){return new Aw(Zde.DEFAULT_DISPLAY_NAME_SETTINGS)}a(rpe,"createDefaultResolver")});var y9=T(Yd=>{"use strict";Object.defineProperty(Yd,"__esModule",{value:!0});Yd.isEffortBlocked=d9;Yd.localToday=px;Yd.isEpisodeOngoing=g9;Yd.createDisplayMatcherHostFunctions=upe;var u9=jl(),npe=yf(),ipe=10,spe=/^\d{4}-\d{2}-\d{2}$/,ope=/^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2}))?/;function d9(r,e){let t=e.ems__Effort_blocker;if(!t)return!1;let n=p9(String(t)).split("|")[0].trim();if(!n)return!1;let i=r.resolveLinkpathFrontmatter(n);if(!i)return!1;let s=ape(r,i.ems__Effort_status);return s!==u9.EffortStatus.DONE&&s!==u9.EffortStatus.TRASHED}a(d9,"isEffortBlocked");function p9(r){return r.trim().replace(/^["']/,"").replace(/["']$/,"").replace(/^\[\[/,"").replace(/\]\]$/,"").replace(/\.md$/,"").trim()}a(p9,"unwrapWikilink");function ape(r,e){let t=(0,npe.normalizeEffortStatus)(e);if(t!==null)return t;let n=e;if(n==null)return"";if(Array.isArray(n)){if(n.length!==1)return"";n=n[0]}let i=p9(String(n));if(i==="")return"";let s=i.indexOf("|"),o=s===-1?i:i.slice(0,s).trim(),l=r.resolveLinkpathFrontmatter(o)?.exo__Asset_label;return Array.isArray(l)&&(l=l[0]),typeof l=="string"&&l.trim()?l.trim():o}a(ape,"resolveStatusLabel");function px(r=new Date){let e=r.getFullYear(),t=String(r.getMonth()+1).padStart(2,"0"),n=String(r.getDate()).padStart(2,"0");return`${e}-${t}-${n}`}a(px,"localToday");function fx(r){let e=r;if(Array.isArray(e)){if(e.length===0)return null;e=e[0]}if(e instanceof Date){if(Number.isNaN(e.getTime()))return null;let c=a(l=>String(l).padStart(2,"0"),"pad");return`${String(e.getUTCFullYear()).padStart(4,"0")}-${c(e.getUTCMonth()+1)}-${c(e.getUTCDate())}`}if(typeof e!="string")return null;let n=h9(e).slice(0,ipe);if(!spe.test(n))return null;let[i,s,o]=n.split("-").map(Number);return m9(i,s,o)?n:null}a(fx,"toDayKey");function h9(r){return r.replace(/^\[\[|\]\]$/g,"").replace(/^"|"$/g,"").trim()}a(h9,"unwrapDateish");function m9(r,e,t){let n=new Date(Date.UTC(r,e-1,t));return n.getUTCFullYear()===r&&n.getUTCMonth()===e-1&&n.getUTCDate()===t}a(m9,"isRealCalendarDay");function dx(r){return r==null||Array.isArray(r)&&r.length===0||String(r).trim()===""}a(dx,"isAbsentValue");function f9(r){let e=r;if(Array.isArray(e)){if(e.length===0)return null;e=e[0]}if(e instanceof Date){if(Number.isNaN(e.getTime()))return null;let f=a(p=>String(p).padStart(2,"0"),"pad");return`${`${String(e.getUTCFullYear()).padStart(4,"0")}-${f(e.getUTCMonth()+1)}-${f(e.getUTCDate())}`}T${f(e.getUTCHours())}:${f(e.getUTCMinutes())}:${f(e.getUTCSeconds())}`}if(typeof e!="string")return null;let t=h9(e),n=ope.exec(t);if(n===null){let f=fx(t);return f===null?null:`${f}T00:00:00`}let[,i,s,o,c,l,u]=n;return!m9(Number(i),Number(s),Number(o))||Number(c)>23||Number(l)>59||Number(u??"0")>59?null:`${i}-${s}-${o}T${c}:${l}:${u??"00"}`}a(f9,"toWallClockKey");function cpe(r){let e=a(t=>String(t).padStart(2,"0"),"pad");return`${px(r)}T${e(r.getHours())}:${e(r.getMinutes())}:${e(r.getSeconds())}`}a(cpe,"localNowKey");function g9(r,e=new Date){let t=r.life__Episode_startTimestamp;if(!dx(t))return lpe(t,r.life__Episode_endTimestamp,e);let n=fx(r.life__Episode_start);if(n===null)return!1;let i=px(e);if(n>i)return!1;let s=r.life__Episode_end;if(dx(s))return!0;let o=fx(s);return o===null?!1:o>=i}a(g9,"isEpisodeOngoing");function lpe(r,e,t){let n=f9(r);if(n===null)return!1;let i=cpe(t);if(n>i)return!1;if(dx(e))return!0;let s=f9(e);return s===null?!1:s>=i}a(lpe,"isInstantPeriodOngoing");function upe(r){return{isEffortBlocked:a((e,t)=>d9(r,t),"isEffortBlocked"),isEpisodeOngoing:a((e,t)=>g9(t),"isEpisodeOngoing")}}a(upe,"createDisplayMatcherHostFunctions")});var Pe=T(y=>{"use strict";var fpe=y&&y.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:a(function(){return e[t]},"get")}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),pi=y&&y.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&fpe(e,r,t)};Object.defineProperty(y,"__esModule",{value:!0});y.CommandResolver=y.extractPropertyLabel=y.uriToPropertyName=y.propertyNameToUri=y.rangeToFieldType=y.PropertyFieldType=y.ParkedAssetIndex=y.resolveDependencyKind=y.parkedPathFor=y.classifyMountTransition=y.PARKED_ROOT=y.DEPENDENCY_KIND_REFERENCE_UID=y.DEPENDENCY_KIND_TBOX_UID=y.transitiveDependsOnClosure=y.isTsFloorMountPath=y.isTsFloorAssetSpace=y.assertTsFloorReconciled=y.assertTsFloor=y.TsFloorViolationError=y.CATALOG_KEEP_NAMESPACES=y.PLUGIN_UI_FLOOR=y.SDK_FLOOR=y.PLUGIN_UI_FLOOR_ASSETSPACE_UIDS=y.SDK_FLOOR_ASSETSPACE_UIDS=y.TS_FLOOR_AS_UID_SHARED_IDENTITIES=y.TS_FLOOR_AS_UID_EXOCMD=y.TS_FLOOR_AS_UID_EXO=y.parseGroundingDefinitionFromFrontmatter=y.isCommandBindingFrontmatter=y.isGroundingFrontmatter=y.isPreconditionFrontmatter=y.isCommandFrontmatter=y.isStyleSource=y.isLabelClass=y.isCommandVariant=y.STYLE_SOURCE_VALUES=y.LABEL_CLASS_VALUES=y.COMMAND_VARIANT_VALUES=y.CommandBindingStyleProperty=y.CommandBindingProperty=y.GroundingProperty=y.PreconditionProperty=y.CommandProperty=y.resolveGroundingTypeFromWikilinkLiteral=y.resolveGroundingTypeFromIRI=y.GROUNDING_TYPE_IRI_TO_ENUM=y.GROUNDING_TYPE_UID_TO_ENUM=y.GROUNDING_TYPE_UIDS=y.GroundingType=y.EFFORT_STATUS_OPTIONS=void 0;y.orderProperties=y.loadDefaultSpec=y.clearOrderSpecLoader=y.registerOrderSpecLoader=y.StatusTimestampService=y.RenameToUidService=y.PropertyCleanupService=y.LoggingService=y.extractAssetReference=y.FolderRepairService=y.WorkflowCommandAdapter=y.VisibilityGenerator=y.InstantiationRuleResolver=y.stripTemplateFrontmatter=y.resolveTemplateBody=y.getRegisteredResolverIds=y.clearResolvers=y.registerResolver=y.getResolver=y.installDefaultResolvers=y.WorkflowResolver=y.WorkflowEngine=y.EffortStatusWorkflow=y.ClassCreationService=y.AreaHierarchyBuilder=y.TaskStatusService=y.createTripleStoreDeclaredRanges=y.createTripleStoreClassPropertyResolver=y.createTripleStoreRequiredPropertyResolver=y.CommandExecutionFlow=y.stripFrontmatter=y.extractSparqlBlock=y.labelTermBearers=y.iriToObsidianName=y.findUnsetQueryTokens=y.UnsetQueryTokenError=y.NamedQueryRunner=y.createVaultFrontmatterRefToFrontmatterResolver=y.createVaultFrontmatterRefToFolderResolver=y.createVaultFrontmatterClassLabelResolver=y.missingRequiredInputError=y.findInputSchemaViolation=y.findMissingInput=y.missingInputError=y.ServiceRegistry=y.GroundingExecutor=y.registerDefaultHostFunctions=y.hasUidFilename=y.hasNonUidFilename=y.PreconditionEvaluator=void 0;y.deriveLegacyFlatPath=y.deriveUrl=y.derivePath=y.IRICanonicalizer=y.INFERRED_GRAPH=y.PrototypeChainMaterializer=y.PropertyCardinalityRegistry=y.NonInheritablePropertyRegistry=y.RDFSInferenceEngine=y.RDFVocabularyMapper=y.DomainTriple=y.DomainBlankNode=y.DomainLiteral=y.DomainIRI=y.InMemoryTripleStore=y.OBSIDIAN_VAULT_SCHEME=y.iriToVaultPath=y.vaultPathToIRI=y.NullLogger=y.RDFSerializer=y.FilenameValidator=y.EffortSortingHelpers=y.MetadataExtractor=y.MetadataHelpers=y.extractClassRefTarget=y.instanceClassMatches=y.resolveSubsumedClassKeys=y.WikiLinkHelpers=y.DateFormatter=y.leadingBomLength=y.frontmatterBlockBody=y.matchFrontmatterBlock=y.parseYamlFrontmatterTolerant=y.STRING_SCALAR_PROPERTIES=y.emptyPropertyValueForm=y.isEmptyPropertyValue=y.isUnquotedWikilink=y.scalarTypingForRange=y.serializeYamlScalar=y.quoteYamlString=y.FrontmatterService=y.SPARQL_PREFIXES=y.TypeRegistry=y.GraphQueryService=y.FixMissingLabelService=y.ArchiveAssetService=y.GenericAssetCreationService=y.EnumValueResolver=y.ClassHierarchyResolver=y.PropertySchemaResolver=void 0;y.QueryPlanCache=y.createDoubleLiteral=y.createDecimalLiteral=y.getNumericValue=y.createPercentileAggregate=y.modeAggregate=y.stddevAggregate=y.varianceAggregate=y.medianAggregate=y.EXO_AGGREGATE_NS=y.BUILT_IN_AGGREGATES=y.CustomAggregateError=y.CustomAggregateRegistry=y.AggregateFunctions=y.BuiltInFunctions=y.SolutionMapping=y.UpdateExecutorError=y.UpdateExecutor=y.QueryExecutor=y.ExoQLQueryExecutor=y.DescribeExecutor=y.ConstructExecutor=y.UnionExecutor=y.OptionalExecutor=y.FilterExecutor=y.BGPExecutor=y.AlgebraSerializer=y.AlgebraOptimizer=y.AlgebraTranslator=y.ExoQLAlgebraTranslator=y.DescribeOptionsTransformerError=y.DescribeOptionsTransformer=y.SPARQLParseError=y.SPARQLParser=y.ExoQLParser=y.isPosixBracketExpression=y.canonicalYamlKey=y.LEGACY_YAML_KEYS=y.LEGACY_UNPREFIXED_ASSET_FIELDS=y.UNPREFIXED_ASSET_FIELDS=y.isPathExcluded=y.normaliseExcludedFolders=y.NoteToRDFConverter=y.SOURCE_VARIABLE=y.SourceAnnotator=y.MAX_LAZY_DEPTH=y.LazyAssetGraphLoader=y.FILE_SPACE_CLASS_UID=y.frontmatterDeclaresFileSpace=y.discoverFileSpaceExclusions=void 0;y.PROPERTIES_BLOCK_CLASS_UID=y.PROPERTIES_BLOCK_CLASS_IRI=y.DAILY_EFFORTS_BY_CLASS_BLOCK_CLASS_UID=y.DAILY_EFFORTS_BY_CLASS_BLOCK_CLASS_IRI=y.BACKLINKS_TABLE_BLOCK_CLASS_UID=y.BACKLINKS_TABLE_BLOCK_CLASS_IRI=y.isLayoutFrontmatter=y.isLayout=y.createLayoutFromFrontmatter=y.LAYOUT_CLASS_UID=y.LAYOUT_CLASS_IRI=y.ExoQLError=y.ExoQL=y.createStreamingSource=y.StreamingLoader=y.resetGlobalPool=y.getGlobalPool=y.MemoryPool=y.CompactGraphStore=y.StringTable=y.DEFAULT_COLORS=y.NODE_FLAGS=y.container=y.resetContainer=y.getContainer=y.createChildContainer=y.registerCoreServices=y.DI_TOKENS=y.DEFAULT_FLEETING_NOTE_CLASS_UID=y.DEFAULT_INBOX_FOLDER=y.DEFAULT_OWNER_IDENTITY=y.VaultSettings=y.seededUidGenerator=y.liveUidGenerator=y.frozenClock=y.liveClock=y.TransactionError=y.TripleNotFoundError=y.TripleAlreadyExistsError=y.FileAlreadyExistsError=y.FileNotFoundError=y.FilterContainsOptimizer=y.VaultPrefixTransformer=y.CaseWhenTransformerError=y.CaseWhenTransformer=y.ResultSerializer=y.createIncrementalIndexer=y.IncrementalIndexer=y.createSPARQLResultCache=y.SPARQLResultCache=void 0;y.withImmutableObjectCache=y.parseImmutableObjectUrl=y.ImmutableObjectCache=y.withConditionalRequests=y.conditionalCacheKey=y.ConditionalRequestCache=y.CONDITIONAL_STORE_FILENAME=y.gitBlobSha=y.promiseWithDeadline=y.extractAssetUid=y.detectChanges=y.MATERIALIZE_PROGRESS_MIN_FILES=y.MATERIALIZE_PROGRESS_INTERVAL=y.escapeGitmodulesRegex=y.stripGitmodulesEntry=y.appendGitmodulesEntry=y.extractAssetSpaceSha=y.discoverAssetSpaceWrapperDir=y.mountAssetSpaceFiles=y.isBinaryPayload=y.restCreateCommit=y.parseTarballGzip=y.parseTarball=y.ShaclShapeRegistry=y.shaclValidate=y.Namespace=y.ShapeRegistry=y.ShapeLoader=y.selectByPriority=y.LayoutSelector=y.partitionDailyEffortsByClass=y.EMS_PROJECT_CLASS_UID=y.classListMatches=y.EMS_ACTION_CLASS_UID=y.resolveDailyEffortVisibility=y.resolveBlockVisibility=y.coerceVisibilityOverride=y.DAILY_EFFORTS_OVERRIDE_KEYS=y.BUILTIN_DAILY_EFFORTS_VISIBILITY=y.assembleLayoutBlocks=y.QUERY_TABLE_BLOCK_DEFAULT_LIMIT=y.QUERY_TABLE_BLOCK_DEFAULT_EMPTY_TEXT=y.QUERY_TABLE_BLOCK_CLASS_UID=y.QUERY_TABLE_BLOCK_CLASS_IRI=y.isQueryTableBlock=y.isPropertiesBlock=y.isLayoutBlockFrontmatter=y.isDailyEffortsByClassBlock=y.isBacklinksTableBlock=y.createLayoutBlockFromFrontmatter=void 0;y.MIN_RATE_LIMIT_WAIT_MS=y.createRateLimitBudget=y.withRateLimitBackoff=y.isRateLimitError=y.isAuthError=y.MOUNT_BASE_STORE_FILENAME=y.FileMountBaseStore=y.WATERMARK_STORE_FILENAME=y.FileWatermarkStore=y.GatedStructuredMerger=y.MergeShaclGate=y.splitSections=y.StructuredMerger=y.diff3=y.LOCAL_MANIFEST_STORE_FILENAME=y.FileLocalManifestStore=y.isSyncablePath=y.isFileSpaceSyncablePath=y.contentEquals=y.InMemoryQuarantineStore=y.DEFAULT_MAX_FILE_BYTES=y.backupPathFor=y.QuarantineResolver=y.formatQuota=y.formatRepoTimings=y.formatTimingsLine=y.fmtMs=y.dominantPhase=y.totalMs=y.aggregateTimings=y.addTimings=y.emptyTimings=y.classifyRestPhase=y.SYNC_PHASES=y.SyncPhaseTimer=y.syncProgressPhaseText=y.orderChildrenFirst=y.isNonFastForwardError=y.SyncEngine=y.DEFAULT_LOCAL_MANIFEST_REHASH_MS=y.DEFAULT_MAX_PUSH_RETRIES=y.checkParkedStaleness=y.getTree=y.getHeadSha=y.getCommitInfo=y.getBlobText=y.getBlobBytes=y.planDuplicateUidFix=y.findDuplicateUidGroups=y.rewriteAssetUid=void 0;y.createDisplayMatcherHostFunctions=y.localToday=y.isEpisodeOngoing=y.isEffortBlocked=y.isWikilink=y.resolveKeyPath=y.DEFAULT_DISPLAY_NAME_TEMPLATE=y.DISPLAY_NAME_PRESETS=y.DisplayNameTemplateEngine=y.createDefaultResolver=y.DisplayNameResolver=y.PrintNameRuleService=y.DEFAULT_DISPLAY_NAME_SETTINGS=y.normalizeEffortStatus=y.EFFORT_STATUS_BY_UID=y.EFFORT_STATUS_UID=y.unwrapLinkTarget=y.resolvePreferenceList=y.isFormatOnlyDrift=y.compareAssetSemantics=y.summarizeParityRound=y.ParityValidator=y.deriveAssetSpaceNamespace=y.buildAssetSpaceDescriptor=y.readSpaceSource=y.parseStrictGitHubRepoURL=y.parsePullOnlyList=y.isFileSpaceFrontmatter=y.isAssetSpaceFrontmatter=y.classifySpaceDeclaration=y.applyPullOnlyListText=y.SpaceSpecAccumulator=y.SYNC_BRANCH=y.PullOnlyListError=y.PULL_ONLY_LIST_PATH=y.ASSET_SPACE_CLASS_UID=y.OUTBOX_REMOTE_ABSENT=y.OUTBOX_STORE_FILENAME=y.LocalOutboxStore=y.CONFLICT_CACHE_STORE_FILENAME=y.LocalConflictCacheStore=y.scanForSecrets=y.redactSecrets=y.enrichRateLimitError=y.attachRateLimitFields=y.getRateLimitFields=y.extractRateLimitFields=y.parseRetryAfterMs=y.caseInsensitiveHeaderGetter=y.DEFAULT_MAX_RETRIES=void 0;pi($l(),y);pi(jl(),y);var dpe=ST();Object.defineProperty(y,"EFFORT_STATUS_OPTIONS",{enumerable:!0,get:a(function(){return dpe.EFFORT_STATUS_OPTIONS},"get")});var ppe=wc();Object.defineProperty(y,"GroundingType",{enumerable:!0,get:a(function(){return ppe.GroundingType},"get")});var zm=dh();Object.defineProperty(y,"GROUNDING_TYPE_UIDS",{enumerable:!0,get:a(function(){return zm.GROUNDING_TYPE_UIDS},"get")});Object.defineProperty(y,"GROUNDING_TYPE_UID_TO_ENUM",{enumerable:!0,get:a(function(){return zm.GROUNDING_TYPE_UID_TO_ENUM},"get")});Object.defineProperty(y,"GROUNDING_TYPE_IRI_TO_ENUM",{enumerable:!0,get:a(function(){return zm.GROUNDING_TYPE_IRI_TO_ENUM},"get")});Object.defineProperty(y,"resolveGroundingTypeFromIRI",{enumerable:!0,get:a(function(){return zm.resolveGroundingTypeFromIRI},"get")});Object.defineProperty(y,"resolveGroundingTypeFromWikilinkLiteral",{enumerable:!0,get:a(function(){return zm.resolveGroundingTypeFromWikilinkLiteral},"get")});var Hm=wT();Object.defineProperty(y,"CommandProperty",{enumerable:!0,get:a(function(){return Hm.CommandProperty},"get")});Object.defineProperty(y,"PreconditionProperty",{enumerable:!0,get:a(function(){return Hm.PreconditionProperty},"get")});Object.defineProperty(y,"GroundingProperty",{enumerable:!0,get:a(function(){return Hm.GroundingProperty},"get")});Object.defineProperty(y,"CommandBindingProperty",{enumerable:!0,get:a(function(){return Hm.CommandBindingProperty},"get")});Object.defineProperty(y,"CommandBindingStyleProperty",{enumerable:!0,get:a(function(){return Hm.CommandBindingStyleProperty},"get")});var Qd=ET();Object.defineProperty(y,"COMMAND_VARIANT_VALUES",{enumerable:!0,get:a(function(){return Qd.COMMAND_VARIANT_VALUES},"get")});Object.defineProperty(y,"LABEL_CLASS_VALUES",{enumerable:!0,get:a(function(){return Qd.LABEL_CLASS_VALUES},"get")});Object.defineProperty(y,"STYLE_SOURCE_VALUES",{enumerable:!0,get:a(function(){return Qd.STYLE_SOURCE_VALUES},"get")});Object.defineProperty(y,"isCommandVariant",{enumerable:!0,get:a(function(){return Qd.isCommandVariant},"get")});Object.defineProperty(y,"isLabelClass",{enumerable:!0,get:a(function(){return Qd.isLabelClass},"get")});Object.defineProperty(y,"isStyleSource",{enumerable:!0,get:a(function(){return Qd.isStyleSource},"get")});var Iw=zD();Object.defineProperty(y,"isCommandFrontmatter",{enumerable:!0,get:a(function(){return Iw.isCommandFrontmatter},"get")});Object.defineProperty(y,"isPreconditionFrontmatter",{enumerable:!0,get:a(function(){return Iw.isPreconditionFrontmatter},"get")});Object.defineProperty(y,"isGroundingFrontmatter",{enumerable:!0,get:a(function(){return Iw.isGroundingFrontmatter},"get")});Object.defineProperty(y,"isCommandBindingFrontmatter",{enumerable:!0,get:a(function(){return Iw.isCommandBindingFrontmatter},"get")});var hpe=HD();Object.defineProperty(y,"parseGroundingDefinitionFromFrontmatter",{enumerable:!0,get:a(function(){return hpe.parseGroundingDefinitionFromFrontmatter},"get")});pi(YD(),y);pi(QD(),y);pi(TT(),y);pi(AT(),y);pi(JD(),y);pi(tN(),y);pi(o1(),y);pi(DN(),y);var Zi=NN();Object.defineProperty(y,"TS_FLOOR_AS_UID_EXO",{enumerable:!0,get:a(function(){return Zi.TS_FLOOR_AS_UID_EXO},"get")});Object.defineProperty(y,"TS_FLOOR_AS_UID_EXOCMD",{enumerable:!0,get:a(function(){return Zi.TS_FLOOR_AS_UID_EXOCMD},"get")});Object.defineProperty(y,"TS_FLOOR_AS_UID_SHARED_IDENTITIES",{enumerable:!0,get:a(function(){return Zi.TS_FLOOR_AS_UID_SHARED_IDENTITIES},"get")});Object.defineProperty(y,"SDK_FLOOR_ASSETSPACE_UIDS",{enumerable:!0,get:a(function(){return Zi.SDK_FLOOR_ASSETSPACE_UIDS},"get")});Object.defineProperty(y,"PLUGIN_UI_FLOOR_ASSETSPACE_UIDS",{enumerable:!0,get:a(function(){return Zi.PLUGIN_UI_FLOOR_ASSETSPACE_UIDS},"get")});Object.defineProperty(y,"SDK_FLOOR",{enumerable:!0,get:a(function(){return Zi.SDK_FLOOR},"get")});Object.defineProperty(y,"PLUGIN_UI_FLOOR",{enumerable:!0,get:a(function(){return Zi.PLUGIN_UI_FLOOR},"get")});Object.defineProperty(y,"CATALOG_KEEP_NAMESPACES",{enumerable:!0,get:a(function(){return Zi.CATALOG_KEEP_NAMESPACES},"get")});Object.defineProperty(y,"TsFloorViolationError",{enumerable:!0,get:a(function(){return Zi.TsFloorViolationError},"get")});Object.defineProperty(y,"assertTsFloor",{enumerable:!0,get:a(function(){return Zi.assertTsFloor},"get")});Object.defineProperty(y,"assertTsFloorReconciled",{enumerable:!0,get:a(function(){return Zi.assertTsFloorReconciled},"get")});Object.defineProperty(y,"isTsFloorAssetSpace",{enumerable:!0,get:a(function(){return Zi.isTsFloorAssetSpace},"get")});Object.defineProperty(y,"isTsFloorMountPath",{enumerable:!0,get:a(function(){return Zi.isTsFloorMountPath},"get")});var mpe=kN();Object.defineProperty(y,"transitiveDependsOnClosure",{enumerable:!0,get:a(function(){return mpe.transitiveDependsOnClosure},"get")});var Xd=u1();Object.defineProperty(y,"DEPENDENCY_KIND_TBOX_UID",{enumerable:!0,get:a(function(){return Xd.DEPENDENCY_KIND_TBOX_UID},"get")});Object.defineProperty(y,"DEPENDENCY_KIND_REFERENCE_UID",{enumerable:!0,get:a(function(){return Xd.DEPENDENCY_KIND_REFERENCE_UID},"get")});Object.defineProperty(y,"PARKED_ROOT",{enumerable:!0,get:a(function(){return Xd.PARKED_ROOT},"get")});Object.defineProperty(y,"classifyMountTransition",{enumerable:!0,get:a(function(){return Xd.classifyMountTransition},"get")});Object.defineProperty(y,"parkedPathFor",{enumerable:!0,get:a(function(){return Xd.parkedPathFor},"get")});Object.defineProperty(y,"resolveDependencyKind",{enumerable:!0,get:a(function(){return Xd.resolveDependencyKind},"get")});var gpe=UN();Object.defineProperty(y,"ParkedAssetIndex",{enumerable:!0,get:a(function(){return gpe.ParkedAssetIndex},"get")});var _9=u0();Object.defineProperty(y,"PropertyFieldType",{enumerable:!0,get:a(function(){return _9.PropertyFieldType},"get")});Object.defineProperty(y,"rangeToFieldType",{enumerable:!0,get:a(function(){return _9.rangeToFieldType},"get")});var hx=h1();Object.defineProperty(y,"propertyNameToUri",{enumerable:!0,get:a(function(){return hx.propertyNameToUri},"get")});Object.defineProperty(y,"uriToPropertyName",{enumerable:!0,get:a(function(){return hx.uriToPropertyName},"get")});Object.defineProperty(y,"extractPropertyLabel",{enumerable:!0,get:a(function(){return hx.extractPropertyLabel},"get")});var ype=g$();Object.defineProperty(y,"CommandResolver",{enumerable:!0,get:a(function(){return ype.CommandResolver},"get")});var _pe=b$();Object.defineProperty(y,"PreconditionEvaluator",{enumerable:!0,get:a(function(){return _pe.PreconditionEvaluator},"get")});var mx=S$();Object.defineProperty(y,"hasNonUidFilename",{enumerable:!0,get:a(function(){return mx.hasNonUidFilename},"get")});Object.defineProperty(y,"hasUidFilename",{enumerable:!0,get:a(function(){return mx.hasUidFilename},"get")});Object.defineProperty(y,"registerDefaultHostFunctions",{enumerable:!0,get:a(function(){return mx.registerDefaultHostFunctions},"get")});var Jd=K$();Object.defineProperty(y,"GroundingExecutor",{enumerable:!0,get:a(function(){return Jd.GroundingExecutor},"get")});Object.defineProperty(y,"ServiceRegistry",{enumerable:!0,get:a(function(){return Jd.ServiceRegistry},"get")});Object.defineProperty(y,"missingInputError",{enumerable:!0,get:a(function(){return Jd.missingInputError},"get")});Object.defineProperty(y,"findMissingInput",{enumerable:!0,get:a(function(){return Jd.findMissingInput},"get")});Object.defineProperty(y,"findInputSchemaViolation",{enumerable:!0,get:a(function(){return Jd.findInputSchemaViolation},"get")});Object.defineProperty(y,"missingRequiredInputError",{enumerable:!0,get:a(function(){return Jd.missingRequiredInputError},"get")});var bpe=z$();Object.defineProperty(y,"createVaultFrontmatterClassLabelResolver",{enumerable:!0,get:a(function(){return bpe.createVaultFrontmatterClassLabelResolver},"get")});var Spe=H$();Object.defineProperty(y,"createVaultFrontmatterRefToFolderResolver",{enumerable:!0,get:a(function(){return Spe.createVaultFrontmatterRefToFolderResolver},"get")});var wpe=Y$();Object.defineProperty(y,"createVaultFrontmatterRefToFrontmatterResolver",{enumerable:!0,get:a(function(){return wpe.createVaultFrontmatterRefToFrontmatterResolver},"get")});pi(oj(),y);var b9=cj();Object.defineProperty(y,"NamedQueryRunner",{enumerable:!0,get:a(function(){return b9.NamedQueryRunner},"get")});Object.defineProperty(y,"UnsetQueryTokenError",{enumerable:!0,get:a(function(){return b9.UnsetQueryTokenError},"get")});var Epe=xR();Object.defineProperty(y,"findUnsetQueryTokens",{enumerable:!0,get:a(function(){return Epe.findUnsetQueryTokens},"get")});var vpe=Ic();Object.defineProperty(y,"iriToObsidianName",{enumerable:!0,get:a(function(){return vpe.iriToObsidianName},"get")});var Tpe=H0();Object.defineProperty(y,"labelTermBearers",{enumerable:!0,get:a(function(){return Tpe.labelTermBearers},"get")});var S9=lj();Object.defineProperty(y,"extractSparqlBlock",{enumerable:!0,get:a(function(){return S9.extractSparqlBlock},"get")});Object.defineProperty(y,"stripFrontmatter",{enumerable:!0,get:a(function(){return S9.stripFrontmatter},"get")});var Ape=fj();Object.defineProperty(y,"CommandExecutionFlow",{enumerable:!0,get:a(function(){return Ape.CommandExecutionFlow},"get")});var w9=yj();Object.defineProperty(y,"createTripleStoreRequiredPropertyResolver",{enumerable:!0,get:a(function(){return w9.createTripleStoreRequiredPropertyResolver},"get")});Object.defineProperty(y,"createTripleStoreClassPropertyResolver",{enumerable:!0,get:a(function(){return w9.createTripleStoreClassPropertyResolver},"get")});var Ipe=Sj();Object.defineProperty(y,"createTripleStoreDeclaredRanges",{enumerable:!0,get:a(function(){return Ipe.createTripleStoreDeclaredRanges},"get")});var Rpe=JR();Object.defineProperty(y,"TaskStatusService",{enumerable:!0,get:a(function(){return Rpe.TaskStatusService},"get")});var Cpe=eC();Object.defineProperty(y,"AreaHierarchyBuilder",{enumerable:!0,get:a(function(){return Cpe.AreaHierarchyBuilder},"get")});var Ope=sC();Object.defineProperty(y,"ClassCreationService",{enumerable:!0,get:a(function(){return Ope.ClassCreationService},"get")});var xpe=Hb();Object.defineProperty(y,"EffortStatusWorkflow",{enumerable:!0,get:a(function(){return xpe.EffortStatusWorkflow},"get")});var Ppe=lm();Object.defineProperty(y,"WorkflowEngine",{enumerable:!0,get:a(function(){return Ppe.WorkflowEngine},"get")});var Fpe=BR();Object.defineProperty(y,"WorkflowResolver",{enumerable:!0,get:a(function(){return Fpe.WorkflowResolver},"get")});var Ym=pb();Object.defineProperty(y,"installDefaultResolvers",{enumerable:!0,get:a(function(){return Ym.installDefaultResolvers},"get")});Object.defineProperty(y,"getResolver",{enumerable:!0,get:a(function(){return Ym.getResolver},"get")});Object.defineProperty(y,"registerResolver",{enumerable:!0,get:a(function(){return Ym.registerResolver},"get")});Object.defineProperty(y,"clearResolvers",{enumerable:!0,get:a(function(){return Ym.clearResolvers},"get")});Object.defineProperty(y,"getRegisteredResolverIds",{enumerable:!0,get:a(function(){return Ym.getRegisteredResolverIds},"get")});var E9=JI();Object.defineProperty(y,"resolveTemplateBody",{enumerable:!0,get:a(function(){return E9.resolveTemplateBody},"get")});Object.defineProperty(y,"stripTemplateFrontmatter",{enumerable:!0,get:a(function(){return E9.stripTemplateFrontmatter},"get")});var Lpe=Lj();Object.defineProperty(y,"InstantiationRuleResolver",{enumerable:!0,get:a(function(){return Lpe.InstantiationRuleResolver},"get")});var Dpe=Dj();Object.defineProperty(y,"VisibilityGenerator",{enumerable:!0,get:a(function(){return Dpe.VisibilityGenerator},"get")});var Npe=Nj();Object.defineProperty(y,"WorkflowCommandAdapter",{enumerable:!0,get:a(function(){return Npe.WorkflowCommandAdapter},"get")});var kpe=Xb();Object.defineProperty(y,"FolderRepairService",{enumerable:!0,get:a(function(){return kpe.FolderRepairService},"get")});var Mpe=hu();Object.defineProperty(y,"extractAssetReference",{enumerable:!0,get:a(function(){return Mpe.extractAssetReference},"get")});var $pe=Ia();Object.defineProperty(y,"LoggingService",{enumerable:!0,get:a(function(){return $pe.LoggingService},"get")});var jpe=pC();Object.defineProperty(y,"PropertyCleanupService",{enumerable:!0,get:a(function(){return jpe.PropertyCleanupService},"get")});var Bpe=mC();Object.defineProperty(y,"RenameToUidService",{enumerable:!0,get:a(function(){return Bpe.RenameToUidService},"get")});var Upe=Yb();Object.defineProperty(y,"StatusTimestampService",{enumerable:!0,get:a(function(){return Upe.StatusTimestampService},"get")});var Rw=yb();Object.defineProperty(y,"registerOrderSpecLoader",{enumerable:!0,get:a(function(){return Rw.registerOrderSpecLoader},"get")});Object.defineProperty(y,"clearOrderSpecLoader",{enumerable:!0,get:a(function(){return Rw.clearOrderSpecLoader},"get")});Object.defineProperty(y,"loadDefaultSpec",{enumerable:!0,get:a(function(){return Rw.loadDefaultSpec},"get")});Object.defineProperty(y,"orderProperties",{enumerable:!0,get:a(function(){return Rw.orderProperties},"get")});var Vpe=Vj();Object.defineProperty(y,"PropertySchemaResolver",{enumerable:!0,get:a(function(){return Vpe.PropertySchemaResolver},"get")});var Gpe=qj();Object.defineProperty(y,"ClassHierarchyResolver",{enumerable:!0,get:a(function(){return Gpe.ClassHierarchyResolver},"get")});var qpe=Wj();Object.defineProperty(y,"EnumValueResolver",{enumerable:!0,get:a(function(){return qpe.EnumValueResolver},"get")});var Wpe=wC();Object.defineProperty(y,"GenericAssetCreationService",{enumerable:!0,get:a(function(){return Wpe.GenericAssetCreationService},"get")});var Kpe=Yj();Object.defineProperty(y,"ArchiveAssetService",{enumerable:!0,get:a(function(){return Kpe.ArchiveAssetService},"get")});var zpe=Xj();Object.defineProperty(y,"FixMissingLabelService",{enumerable:!0,get:a(function(){return zpe.FixMissingLabelService},"get")});var Hpe=Jj();Object.defineProperty(y,"GraphQueryService",{enumerable:!0,get:a(function(){return Hpe.GraphQueryService},"get")});var Ype=e4();Object.defineProperty(y,"TypeRegistry",{enumerable:!0,get:a(function(){return Ype.TypeRegistry},"get")});var Qpe=t4();Object.defineProperty(y,"SPARQL_PREFIXES",{enumerable:!0,get:a(function(){return Qpe.SPARQL_PREFIXES},"get")});var Xpe=pu();Object.defineProperty(y,"FrontmatterService",{enumerable:!0,get:a(function(){return Xpe.FrontmatterService},"get")});var Cu=Ac();Object.defineProperty(y,"quoteYamlString",{enumerable:!0,get:a(function(){return Cu.quoteYamlString},"get")});Object.defineProperty(y,"serializeYamlScalar",{enumerable:!0,get:a(function(){return Cu.serializeYamlScalar},"get")});Object.defineProperty(y,"scalarTypingForRange",{enumerable:!0,get:a(function(){return Cu.scalarTypingForRange},"get")});Object.defineProperty(y,"isUnquotedWikilink",{enumerable:!0,get:a(function(){return Cu.isUnquotedWikilink},"get")});Object.defineProperty(y,"isEmptyPropertyValue",{enumerable:!0,get:a(function(){return Cu.isEmptyPropertyValue},"get")});Object.defineProperty(y,"emptyPropertyValueForm",{enumerable:!0,get:a(function(){return Cu.emptyPropertyValueForm},"get")});Object.defineProperty(y,"STRING_SCALAR_PROPERTIES",{enumerable:!0,get:a(function(){return Cu.STRING_SCALAR_PROPERTIES},"get")});var Jpe=wR();Object.defineProperty(y,"parseYamlFrontmatterTolerant",{enumerable:!0,get:a(function(){return Jpe.parseYamlFrontmatterTolerant},"get")});var gx=fd();Object.defineProperty(y,"matchFrontmatterBlock",{enumerable:!0,get:a(function(){return gx.matchFrontmatterBlock},"get")});Object.defineProperty(y,"frontmatterBlockBody",{enumerable:!0,get:a(function(){return gx.frontmatterBlockBody},"get")});Object.defineProperty(y,"leadingBomLength",{enumerable:!0,get:a(function(){return gx.leadingBomLength},"get")});var Zpe=Lo();Object.defineProperty(y,"DateFormatter",{enumerable:!0,get:a(function(){return Zpe.DateFormatter},"get")});var ehe=ga();Object.defineProperty(y,"WikiLinkHelpers",{enumerable:!0,get:a(function(){return ehe.WikiLinkHelpers},"get")});var yx=r4();Object.defineProperty(y,"resolveSubsumedClassKeys",{enumerable:!0,get:a(function(){return yx.resolveSubsumedClassKeys},"get")});Object.defineProperty(y,"instanceClassMatches",{enumerable:!0,get:a(function(){return yx.instanceClassMatches},"get")});Object.defineProperty(y,"extractClassRefTarget",{enumerable:!0,get:a(function(){return yx.extractClassRefTarget},"get")});var the=Mc();Object.defineProperty(y,"MetadataHelpers",{enumerable:!0,get:a(function(){return the.MetadataHelpers},"get")});var rhe=n4();Object.defineProperty(y,"MetadataExtractor",{enumerable:!0,get:a(function(){return rhe.MetadataExtractor},"get")});var nhe=i4();Object.defineProperty(y,"EffortSortingHelpers",{enumerable:!0,get:a(function(){return nhe.EffortSortingHelpers},"get")});var ihe=s4();Object.defineProperty(y,"FilenameValidator",{enumerable:!0,get:a(function(){return ihe.FilenameValidator},"get")});var she=d4();Object.defineProperty(y,"RDFSerializer",{enumerable:!0,get:a(function(){return she.RDFSerializer},"get")});var ohe=Ph();Object.defineProperty(y,"NullLogger",{enumerable:!0,get:a(function(){return ohe.NullLogger},"get")});var _x=Sb();Object.defineProperty(y,"vaultPathToIRI",{enumerable:!0,get:a(function(){return _x.vaultPathToIRI},"get")});Object.defineProperty(y,"iriToVaultPath",{enumerable:!0,get:a(function(){return _x.iriToVaultPath},"get")});Object.defineProperty(y,"OBSIDIAN_VAULT_SCHEME",{enumerable:!0,get:a(function(){return _x.OBSIDIAN_VAULT_SCHEME},"get")});var ahe=HR();Object.defineProperty(y,"InMemoryTripleStore",{enumerable:!0,get:a(function(){return ahe.InMemoryTripleStore},"get")});var che=Me();Object.defineProperty(y,"DomainIRI",{enumerable:!0,get:a(function(){return che.IRI},"get")});var lhe=Ye();Object.defineProperty(y,"DomainLiteral",{enumerable:!0,get:a(function(){return lhe.Literal},"get")});var uhe=lr();Object.defineProperty(y,"DomainBlankNode",{enumerable:!0,get:a(function(){return uhe.BlankNode},"get")});var fhe=oi();Object.defineProperty(y,"DomainTriple",{enumerable:!0,get:a(function(){return fhe.Triple},"get")});var dhe=eR();Object.defineProperty(y,"RDFVocabularyMapper",{enumerable:!0,get:a(function(){return dhe.RDFVocabularyMapper},"get")});var phe=p4();Object.defineProperty(y,"RDFSInferenceEngine",{enumerable:!0,get:a(function(){return phe.RDFSInferenceEngine},"get")});var hhe=VC();Object.defineProperty(y,"NonInheritablePropertyRegistry",{enumerable:!0,get:a(function(){return hhe.NonInheritablePropertyRegistry},"get")});var mhe=WC();Object.defineProperty(y,"PropertyCardinalityRegistry",{enumerable:!0,get:a(function(){return mhe.PropertyCardinalityRegistry},"get")});var v9=HC();Object.defineProperty(y,"PrototypeChainMaterializer",{enumerable:!0,get:a(function(){return v9.PrototypeChainMaterializer},"get")});Object.defineProperty(y,"INFERRED_GRAPH",{enumerable:!0,get:a(function(){return v9.INFERRED_GRAPH},"get")});var ghe=S4();Object.defineProperty(y,"IRICanonicalizer",{enumerable:!0,get:a(function(){return ghe.IRICanonicalizer},"get")});var bx=Eb();Object.defineProperty(y,"derivePath",{enumerable:!0,get:a(function(){return bx.derivePath},"get")});Object.defineProperty(y,"deriveUrl",{enumerable:!0,get:a(function(){return bx.deriveUrl},"get")});Object.defineProperty(y,"deriveLegacyFlatPath",{enumerable:!0,get:a(function(){return bx.deriveLegacyFlatPath},"get")});var Sx=vb();Object.defineProperty(y,"discoverFileSpaceExclusions",{enumerable:!0,get:a(function(){return Sx.discoverFileSpaceExclusions},"get")});Object.defineProperty(y,"frontmatterDeclaresFileSpace",{enumerable:!0,get:a(function(){return Sx.frontmatterDeclaresFileSpace},"get")});Object.defineProperty(y,"FILE_SPACE_CLASS_UID",{enumerable:!0,get:a(function(){return Sx.FILE_SPACE_CLASS_UID},"get")});var T9=w4();Object.defineProperty(y,"LazyAssetGraphLoader",{enumerable:!0,get:a(function(){return T9.LazyAssetGraphLoader},"get")});Object.defineProperty(y,"MAX_LAZY_DEPTH",{enumerable:!0,get:a(function(){return T9.MAX_LAZY_DEPTH},"get")});var A9=JC();Object.defineProperty(y,"SourceAnnotator",{enumerable:!0,get:a(function(){return A9.SourceAnnotator},"get")});Object.defineProperty(y,"SOURCE_VARIABLE",{enumerable:!0,get:a(function(){return A9.SOURCE_VARIABLE},"get")});var Jc=du();Object.defineProperty(y,"NoteToRDFConverter",{enumerable:!0,get:a(function(){return Jc.NoteToRDFConverter},"get")});Object.defineProperty(y,"normaliseExcludedFolders",{enumerable:!0,get:a(function(){return Jc.normaliseExcludedFolders},"get")});Object.defineProperty(y,"isPathExcluded",{enumerable:!0,get:a(function(){return Jc.isPathExcluded},"get")});Object.defineProperty(y,"UNPREFIXED_ASSET_FIELDS",{enumerable:!0,get:a(function(){return Jc.UNPREFIXED_ASSET_FIELDS},"get")});Object.defineProperty(y,"LEGACY_UNPREFIXED_ASSET_FIELDS",{enumerable:!0,get:a(function(){return Jc.LEGACY_UNPREFIXED_ASSET_FIELDS},"get")});Object.defineProperty(y,"LEGACY_YAML_KEYS",{enumerable:!0,get:a(function(){return Jc.LEGACY_YAML_KEYS},"get")});Object.defineProperty(y,"canonicalYamlKey",{enumerable:!0,get:a(function(){return Jc.canonicalYamlKey},"get")});Object.defineProperty(y,"isPosixBracketExpression",{enumerable:!0,get:a(function(){return Jc.isPosixBracketExpression},"get")});var wx=Mf();Object.defineProperty(y,"ExoQLParser",{enumerable:!0,get:a(function(){return wx.ExoQLParser},"get")});Object.defineProperty(y,"SPARQLParser",{enumerable:!0,get:a(function(){return wx.SPARQLParser},"get")});Object.defineProperty(y,"SPARQLParseError",{enumerable:!0,get:a(function(){return wx.SPARQLParseError},"get")});var I9=WA();Object.defineProperty(y,"DescribeOptionsTransformer",{enumerable:!0,get:a(function(){return I9.DescribeOptionsTransformer},"get")});Object.defineProperty(y,"DescribeOptionsTransformerError",{enumerable:!0,get:a(function(){return I9.DescribeOptionsTransformerError},"get")});var R9=Gf();Object.defineProperty(y,"ExoQLAlgebraTranslator",{enumerable:!0,get:a(function(){return R9.ExoQLAlgebraTranslator},"get")});Object.defineProperty(y,"AlgebraTranslator",{enumerable:!0,get:a(function(){return R9.AlgebraTranslator},"get")});var yhe=E4();Object.defineProperty(y,"AlgebraOptimizer",{enumerable:!0,get:a(function(){return yhe.AlgebraOptimizer},"get")});var _he=v4();Object.defineProperty(y,"AlgebraSerializer",{enumerable:!0,get:a(function(){return _he.AlgebraSerializer},"get")});var bhe=fI();Object.defineProperty(y,"BGPExecutor",{enumerable:!0,get:a(function(){return bhe.BGPExecutor},"get")});var She=K_();Object.defineProperty(y,"FilterExecutor",{enumerable:!0,get:a(function(){return She.FilterExecutor},"get")});var whe=OI();Object.defineProperty(y,"OptionalExecutor",{enumerable:!0,get:a(function(){return whe.OptionalExecutor},"get")});var Ehe=PI();Object.defineProperty(y,"UnionExecutor",{enumerable:!0,get:a(function(){return Ehe.UnionExecutor},"get")});var vhe=jI();Object.defineProperty(y,"ConstructExecutor",{enumerable:!0,get:a(function(){return vhe.ConstructExecutor},"get")});var The=A4();Object.defineProperty(y,"DescribeExecutor",{enumerable:!0,get:a(function(){return The.DescribeExecutor},"get")});var C9=ld();Object.defineProperty(y,"ExoQLQueryExecutor",{enumerable:!0,get:a(function(){return C9.ExoQLQueryExecutor},"get")});Object.defineProperty(y,"QueryExecutor",{enumerable:!0,get:a(function(){return C9.QueryExecutor},"get")});var O9=R4();Object.defineProperty(y,"UpdateExecutor",{enumerable:!0,get:a(function(){return O9.UpdateExecutor},"get")});Object.defineProperty(y,"UpdateExecutorError",{enumerable:!0,get:a(function(){return O9.UpdateExecutorError},"get")});var Ahe=Aa();Object.defineProperty(y,"SolutionMapping",{enumerable:!0,get:a(function(){return Ahe.SolutionMapping},"get")});var Ihe=q_();Object.defineProperty(y,"BuiltInFunctions",{enumerable:!0,get:a(function(){return Ihe.BuiltInFunctions},"get")});var Rhe=O4();Object.defineProperty(y,"AggregateFunctions",{enumerable:!0,get:a(function(){return Rhe.AggregateFunctions},"get")});var x9=y_();Object.defineProperty(y,"CustomAggregateRegistry",{enumerable:!0,get:a(function(){return x9.CustomAggregateRegistry},"get")});Object.defineProperty(y,"CustomAggregateError",{enumerable:!0,get:a(function(){return x9.CustomAggregateError},"get")});var qo=b_();Object.defineProperty(y,"BUILT_IN_AGGREGATES",{enumerable:!0,get:a(function(){return qo.BUILT_IN_AGGREGATES},"get")});Object.defineProperty(y,"EXO_AGGREGATE_NS",{enumerable:!0,get:a(function(){return qo.EXO_AGGREGATE_NS},"get")});Object.defineProperty(y,"medianAggregate",{enumerable:!0,get:a(function(){return qo.medianAggregate},"get")});Object.defineProperty(y,"varianceAggregate",{enumerable:!0,get:a(function(){return qo.varianceAggregate},"get")});Object.defineProperty(y,"stddevAggregate",{enumerable:!0,get:a(function(){return qo.stddevAggregate},"get")});Object.defineProperty(y,"modeAggregate",{enumerable:!0,get:a(function(){return qo.modeAggregate},"get")});Object.defineProperty(y,"createPercentileAggregate",{enumerable:!0,get:a(function(){return qo.createPercentileAggregate},"get")});Object.defineProperty(y,"getNumericValue",{enumerable:!0,get:a(function(){return qo.getNumericValue},"get")});Object.defineProperty(y,"createDecimalLiteral",{enumerable:!0,get:a(function(){return qo.createDecimalLiteral},"get")});Object.defineProperty(y,"createDoubleLiteral",{enumerable:!0,get:a(function(){return qo.createDoubleLiteral},"get")});var Che=x4();Object.defineProperty(y,"QueryPlanCache",{enumerable:!0,get:a(function(){return Che.QueryPlanCache},"get")});var P9=P4();Object.defineProperty(y,"SPARQLResultCache",{enumerable:!0,get:a(function(){return P9.SPARQLResultCache},"get")});Object.defineProperty(y,"createSPARQLResultCache",{enumerable:!0,get:a(function(){return P9.createSPARQLResultCache},"get")});var F9=F4();Object.defineProperty(y,"IncrementalIndexer",{enumerable:!0,get:a(function(){return F9.IncrementalIndexer},"get")});Object.defineProperty(y,"createIncrementalIndexer",{enumerable:!0,get:a(function(){return F9.createIncrementalIndexer},"get")});var Ohe=L4();Object.defineProperty(y,"ResultSerializer",{enumerable:!0,get:a(function(){return Ohe.ResultSerializer},"get")});var L9=VA();Object.defineProperty(y,"CaseWhenTransformer",{enumerable:!0,get:a(function(){return L9.CaseWhenTransformer},"get")});Object.defineProperty(y,"CaseWhenTransformerError",{enumerable:!0,get:a(function(){return L9.CaseWhenTransformerError},"get")});var xhe=YA();Object.defineProperty(y,"VaultPrefixTransformer",{enumerable:!0,get:a(function(){return xhe.VaultPrefixTransformer},"get")});var Phe=eO();Object.defineProperty(y,"FilterContainsOptimizer",{enumerable:!0,get:a(function(){return Phe.FilterContainsOptimizer},"get")});var D9=D4();Object.defineProperty(y,"FileNotFoundError",{enumerable:!0,get:a(function(){return D9.FileNotFoundError},"get")});Object.defineProperty(y,"FileAlreadyExistsError",{enumerable:!0,get:a(function(){return D9.FileAlreadyExistsError},"get")});var Ex=qR();Object.defineProperty(y,"TripleAlreadyExistsError",{enumerable:!0,get:a(function(){return Ex.TripleAlreadyExistsError},"get")});Object.defineProperty(y,"TripleNotFoundError",{enumerable:!0,get:a(function(){return Ex.TripleNotFoundError},"get")});Object.defineProperty(y,"TransactionError",{enumerable:!0,get:a(function(){return Ex.TransactionError},"get")});var N9=Qh();Object.defineProperty(y,"liveClock",{enumerable:!0,get:a(function(){return N9.liveClock},"get")});Object.defineProperty(y,"frozenClock",{enumerable:!0,get:a(function(){return N9.frozenClock},"get")});var k9=ub();Object.defineProperty(y,"liveUidGenerator",{enumerable:!0,get:a(function(){return k9.liveUidGenerator},"get")});Object.defineProperty(y,"seededUidGenerator",{enumerable:!0,get:a(function(){return k9.seededUidGenerator},"get")});var Cw=pO();Object.defineProperty(y,"VaultSettings",{enumerable:!0,get:a(function(){return Cw.VaultSettings},"get")});Object.defineProperty(y,"DEFAULT_OWNER_IDENTITY",{enumerable:!0,get:a(function(){return Cw.DEFAULT_OWNER_IDENTITY},"get")});Object.defineProperty(y,"DEFAULT_INBOX_FOLDER",{enumerable:!0,get:a(function(){return Cw.DEFAULT_INBOX_FOLDER},"get")});Object.defineProperty(y,"DEFAULT_FLEETING_NOTE_CLASS_UID",{enumerable:!0,get:a(function(){return Cw.DEFAULT_FLEETING_NOTE_CLASS_UID},"get")});var Fhe=ki();Object.defineProperty(y,"DI_TOKENS",{enumerable:!0,get:a(function(){return Fhe.DI_TOKENS},"get")});var Qm=N4();Object.defineProperty(y,"registerCoreServices",{enumerable:!0,get:a(function(){return Qm.registerCoreServices},"get")});Object.defineProperty(y,"createChildContainer",{enumerable:!0,get:a(function(){return Qm.createChildContainer},"get")});Object.defineProperty(y,"getContainer",{enumerable:!0,get:a(function(){return Qm.getContainer},"get")});Object.defineProperty(y,"resetContainer",{enumerable:!0,get:a(function(){return Qm.resetContainer},"get")});Object.defineProperty(y,"container",{enumerable:!0,get:a(function(){return Qm.container},"get")});var Qa=U4();Object.defineProperty(y,"NODE_FLAGS",{enumerable:!0,get:a(function(){return Qa.NODE_FLAGS},"get")});Object.defineProperty(y,"DEFAULT_COLORS",{enumerable:!0,get:a(function(){return Qa.DEFAULT_COLORS},"get")});Object.defineProperty(y,"StringTable",{enumerable:!0,get:a(function(){return Qa.StringTable},"get")});Object.defineProperty(y,"CompactGraphStore",{enumerable:!0,get:a(function(){return Qa.CompactGraphStore},"get")});Object.defineProperty(y,"MemoryPool",{enumerable:!0,get:a(function(){return Qa.MemoryPool},"get")});Object.defineProperty(y,"getGlobalPool",{enumerable:!0,get:a(function(){return Qa.getGlobalPool},"get")});Object.defineProperty(y,"resetGlobalPool",{enumerable:!0,get:a(function(){return Qa.resetGlobalPool},"get")});Object.defineProperty(y,"StreamingLoader",{enumerable:!0,get:a(function(){return Qa.StreamingLoader},"get")});Object.defineProperty(y,"createStreamingSource",{enumerable:!0,get:a(function(){return Qa.createStreamingSource},"get")});var M9=V4();Object.defineProperty(y,"ExoQL",{enumerable:!0,get:a(function(){return M9.ExoQL},"get")});Object.defineProperty(y,"ExoQLError",{enumerable:!0,get:a(function(){return M9.ExoQLError},"get")});var Xm=LS();Object.defineProperty(y,"LAYOUT_CLASS_IRI",{enumerable:!0,get:a(function(){return Xm.LAYOUT_CLASS_IRI},"get")});Object.defineProperty(y,"LAYOUT_CLASS_UID",{enumerable:!0,get:a(function(){return Xm.LAYOUT_CLASS_UID},"get")});Object.defineProperty(y,"createLayoutFromFrontmatter",{enumerable:!0,get:a(function(){return Xm.createLayoutFromFrontmatter},"get")});Object.defineProperty(y,"isLayout",{enumerable:!0,get:a(function(){return Xm.isLayout},"get")});Object.defineProperty(y,"isLayoutFrontmatter",{enumerable:!0,get:a(function(){return Xm.isLayoutFrontmatter},"get")});var Pn=LS();Object.defineProperty(y,"BACKLINKS_TABLE_BLOCK_CLASS_IRI",{enumerable:!0,get:a(function(){return Pn.BACKLINKS_TABLE_BLOCK_CLASS_IRI},"get")});Object.defineProperty(y,"BACKLINKS_TABLE_BLOCK_CLASS_UID",{enumerable:!0,get:a(function(){return Pn.BACKLINKS_TABLE_BLOCK_CLASS_UID},"get")});Object.defineProperty(y,"DAILY_EFFORTS_BY_CLASS_BLOCK_CLASS_IRI",{enumerable:!0,get:a(function(){return Pn.DAILY_EFFORTS_BY_CLASS_BLOCK_CLASS_IRI},"get")});Object.defineProperty(y,"DAILY_EFFORTS_BY_CLASS_BLOCK_CLASS_UID",{enumerable:!0,get:a(function(){return Pn.DAILY_EFFORTS_BY_CLASS_BLOCK_CLASS_UID},"get")});Object.defineProperty(y,"PROPERTIES_BLOCK_CLASS_IRI",{enumerable:!0,get:a(function(){return Pn.PROPERTIES_BLOCK_CLASS_IRI},"get")});Object.defineProperty(y,"PROPERTIES_BLOCK_CLASS_UID",{enumerable:!0,get:a(function(){return Pn.PROPERTIES_BLOCK_CLASS_UID},"get")});Object.defineProperty(y,"createLayoutBlockFromFrontmatter",{enumerable:!0,get:a(function(){return Pn.createLayoutBlockFromFrontmatter},"get")});Object.defineProperty(y,"isBacklinksTableBlock",{enumerable:!0,get:a(function(){return Pn.isBacklinksTableBlock},"get")});Object.defineProperty(y,"isDailyEffortsByClassBlock",{enumerable:!0,get:a(function(){return Pn.isDailyEffortsByClassBlock},"get")});Object.defineProperty(y,"isLayoutBlockFrontmatter",{enumerable:!0,get:a(function(){return Pn.isLayoutBlockFrontmatter},"get")});Object.defineProperty(y,"isPropertiesBlock",{enumerable:!0,get:a(function(){return Pn.isPropertiesBlock},"get")});Object.defineProperty(y,"isQueryTableBlock",{enumerable:!0,get:a(function(){return Pn.isQueryTableBlock},"get")});Object.defineProperty(y,"QUERY_TABLE_BLOCK_CLASS_IRI",{enumerable:!0,get:a(function(){return Pn.QUERY_TABLE_BLOCK_CLASS_IRI},"get")});Object.defineProperty(y,"QUERY_TABLE_BLOCK_CLASS_UID",{enumerable:!0,get:a(function(){return Pn.QUERY_TABLE_BLOCK_CLASS_UID},"get")});Object.defineProperty(y,"QUERY_TABLE_BLOCK_DEFAULT_EMPTY_TEXT",{enumerable:!0,get:a(function(){return Pn.QUERY_TABLE_BLOCK_DEFAULT_EMPTY_TEXT},"get")});Object.defineProperty(y,"QUERY_TABLE_BLOCK_DEFAULT_LIMIT",{enumerable:!0,get:a(function(){return Pn.QUERY_TABLE_BLOCK_DEFAULT_LIMIT},"get")});Object.defineProperty(y,"assembleLayoutBlocks",{enumerable:!0,get:a(function(){return Pn.assembleLayoutBlocks},"get")});var Xa=LS();Object.defineProperty(y,"BUILTIN_DAILY_EFFORTS_VISIBILITY",{enumerable:!0,get:a(function(){return Xa.BUILTIN_DAILY_EFFORTS_VISIBILITY},"get")});Object.defineProperty(y,"DAILY_EFFORTS_OVERRIDE_KEYS",{enumerable:!0,get:a(function(){return Xa.DAILY_EFFORTS_OVERRIDE_KEYS},"get")});Object.defineProperty(y,"coerceVisibilityOverride",{enumerable:!0,get:a(function(){return Xa.coerceVisibilityOverride},"get")});Object.defineProperty(y,"resolveBlockVisibility",{enumerable:!0,get:a(function(){return Xa.resolveBlockVisibility},"get")});Object.defineProperty(y,"resolveDailyEffortVisibility",{enumerable:!0,get:a(function(){return Xa.resolveDailyEffortVisibility},"get")});Object.defineProperty(y,"EMS_ACTION_CLASS_UID",{enumerable:!0,get:a(function(){return Xa.EMS_ACTION_CLASS_UID},"get")});Object.defineProperty(y,"classListMatches",{enumerable:!0,get:a(function(){return Xa.classListMatches},"get")});Object.defineProperty(y,"EMS_PROJECT_CLASS_UID",{enumerable:!0,get:a(function(){return Xa.EMS_PROJECT_CLASS_UID},"get")});Object.defineProperty(y,"partitionDailyEffortsByClass",{enumerable:!0,get:a(function(){return Xa.partitionDailyEffortsByClass},"get")});var $9=nB();Object.defineProperty(y,"LayoutSelector",{enumerable:!0,get:a(function(){return $9.LayoutSelector},"get")});Object.defineProperty(y,"selectByPriority",{enumerable:!0,get:a(function(){return $9.selectByPriority},"get")});pi(dB(),y);var Lhe=hB();Object.defineProperty(y,"ShapeLoader",{enumerable:!0,get:a(function(){return Lhe.ShapeLoader},"get")});var Dhe=MO();Object.defineProperty(y,"ShapeRegistry",{enumerable:!0,get:a(function(){return Dhe.ShapeRegistry},"get")});var Nhe=Tt();Object.defineProperty(y,"Namespace",{enumerable:!0,get:a(function(){return Nhe.Namespace},"get")});var j9=VO();Object.defineProperty(y,"shaclValidate",{enumerable:!0,get:a(function(){return j9.validate},"get")});Object.defineProperty(y,"ShaclShapeRegistry",{enumerable:!0,get:a(function(){return j9.ShapeRegistry},"get")});pi(SB(),y);var B9=WO();Object.defineProperty(y,"parseTarball",{enumerable:!0,get:a(function(){return B9.parseTarball},"get")});Object.defineProperty(y,"parseTarballGzip",{enumerable:!0,get:a(function(){return B9.parseTarballGzip},"get")});var U9=YS();Object.defineProperty(y,"restCreateCommit",{enumerable:!0,get:a(function(){return U9.restCreateCommit},"get")});Object.defineProperty(y,"isBinaryPayload",{enumerable:!0,get:a(function(){return U9.isBinaryPayload},"get")});var Zc=RB();Object.defineProperty(y,"mountAssetSpaceFiles",{enumerable:!0,get:a(function(){return Zc.mountAssetSpaceFiles},"get")});Object.defineProperty(y,"discoverAssetSpaceWrapperDir",{enumerable:!0,get:a(function(){return Zc.discoverWrapperDir},"get")});Object.defineProperty(y,"extractAssetSpaceSha",{enumerable:!0,get:a(function(){return Zc.extractShaFromWrapper},"get")});Object.defineProperty(y,"appendGitmodulesEntry",{enumerable:!0,get:a(function(){return Zc.appendGitmodulesEntry},"get")});Object.defineProperty(y,"stripGitmodulesEntry",{enumerable:!0,get:a(function(){return Zc.stripGitmodulesEntry},"get")});Object.defineProperty(y,"escapeGitmodulesRegex",{enumerable:!0,get:a(function(){return Zc.escapeGitmodulesRegex},"get")});Object.defineProperty(y,"MATERIALIZE_PROGRESS_INTERVAL",{enumerable:!0,get:a(function(){return Zc.MATERIALIZE_PROGRESS_INTERVAL},"get")});Object.defineProperty(y,"MATERIALIZE_PROGRESS_MIN_FILES",{enumerable:!0,get:a(function(){return Zc.MATERIALIZE_PROGRESS_MIN_FILES},"get")});var V9=Rm();Object.defineProperty(y,"detectChanges",{enumerable:!0,get:a(function(){return V9.detectChanges},"get")});Object.defineProperty(y,"extractAssetUid",{enumerable:!0,get:a(function(){return V9.extractAssetUid},"get")});var khe=OB();Object.defineProperty(y,"promiseWithDeadline",{enumerable:!0,get:a(function(){return khe.promiseWithDeadline},"get")});var Mhe=qc();Object.defineProperty(y,"gitBlobSha",{enumerable:!0,get:a(function(){return Mhe.gitBlobSha},"get")});var Ow=LB();Object.defineProperty(y,"CONDITIONAL_STORE_FILENAME",{enumerable:!0,get:a(function(){return Ow.CONDITIONAL_STORE_FILENAME},"get")});Object.defineProperty(y,"ConditionalRequestCache",{enumerable:!0,get:a(function(){return Ow.ConditionalRequestCache},"get")});Object.defineProperty(y,"conditionalCacheKey",{enumerable:!0,get:a(function(){return Ow.conditionalCacheKey},"get")});Object.defineProperty(y,"withConditionalRequests",{enumerable:!0,get:a(function(){return Ow.withConditionalRequests},"get")});var vx=MB();Object.defineProperty(y,"ImmutableObjectCache",{enumerable:!0,get:a(function(){return vx.ImmutableObjectCache},"get")});Object.defineProperty(y,"parseImmutableObjectUrl",{enumerable:!0,get:a(function(){return vx.parseImmutableObjectUrl},"get")});Object.defineProperty(y,"withImmutableObjectCache",{enumerable:!0,get:a(function(){return vx.withImmutableObjectCache},"get")});var Tx=BB();Object.defineProperty(y,"rewriteAssetUid",{enumerable:!0,get:a(function(){return Tx.rewriteAssetUid},"get")});Object.defineProperty(y,"findDuplicateUidGroups",{enumerable:!0,get:a(function(){return Tx.findDuplicateUidGroups},"get")});Object.defineProperty(y,"planDuplicateUidFix",{enumerable:!0,get:a(function(){return Tx.planDuplicateUidFix},"get")});var Jm=Au();Object.defineProperty(y,"getBlobBytes",{enumerable:!0,get:a(function(){return Jm.getBlobBytes},"get")});Object.defineProperty(y,"getBlobText",{enumerable:!0,get:a(function(){return Jm.getBlobText},"get")});Object.defineProperty(y,"getCommitInfo",{enumerable:!0,get:a(function(){return Jm.getCommitInfo},"get")});Object.defineProperty(y,"getHeadSha",{enumerable:!0,get:a(function(){return Jm.getHeadSha},"get")});Object.defineProperty(y,"getTree",{enumerable:!0,get:a(function(){return Jm.getTree},"get")});var $he=GB();Object.defineProperty(y,"checkParkedStaleness",{enumerable:!0,get:a(function(){return $he.checkParkedStaleness},"get")});var Zd=_U();Object.defineProperty(y,"DEFAULT_MAX_PUSH_RETRIES",{enumerable:!0,get:a(function(){return Zd.DEFAULT_MAX_PUSH_RETRIES},"get")});Object.defineProperty(y,"DEFAULT_LOCAL_MANIFEST_REHASH_MS",{enumerable:!0,get:a(function(){return Zd.DEFAULT_LOCAL_MANIFEST_REHASH_MS},"get")});Object.defineProperty(y,"SyncEngine",{enumerable:!0,get:a(function(){return Zd.SyncEngine},"get")});Object.defineProperty(y,"isNonFastForwardError",{enumerable:!0,get:a(function(){return Zd.isNonFastForwardError},"get")});Object.defineProperty(y,"orderChildrenFirst",{enumerable:!0,get:a(function(){return Zd.orderChildrenFirst},"get")});Object.defineProperty(y,"syncProgressPhaseText",{enumerable:!0,get:a(function(){return Zd.syncProgressPhaseText},"get")});var Ss=i2();Object.defineProperty(y,"SyncPhaseTimer",{enumerable:!0,get:a(function(){return Ss.SyncPhaseTimer},"get")});Object.defineProperty(y,"SYNC_PHASES",{enumerable:!0,get:a(function(){return Ss.SYNC_PHASES},"get")});Object.defineProperty(y,"classifyRestPhase",{enumerable:!0,get:a(function(){return Ss.classifyRestPhase},"get")});Object.defineProperty(y,"emptyTimings",{enumerable:!0,get:a(function(){return Ss.emptyTimings},"get")});Object.defineProperty(y,"addTimings",{enumerable:!0,get:a(function(){return Ss.addTimings},"get")});Object.defineProperty(y,"aggregateTimings",{enumerable:!0,get:a(function(){return Ss.aggregateTimings},"get")});Object.defineProperty(y,"totalMs",{enumerable:!0,get:a(function(){return Ss.totalMs},"get")});Object.defineProperty(y,"dominantPhase",{enumerable:!0,get:a(function(){return Ss.dominantPhase},"get")});Object.defineProperty(y,"fmtMs",{enumerable:!0,get:a(function(){return Ss.fmtMs},"get")});Object.defineProperty(y,"formatTimingsLine",{enumerable:!0,get:a(function(){return Ss.formatTimingsLine},"get")});Object.defineProperty(y,"formatRepoTimings",{enumerable:!0,get:a(function(){return Ss.formatRepoTimings},"get")});Object.defineProperty(y,"formatQuota",{enumerable:!0,get:a(function(){return Ss.formatQuota},"get")});var G9=SU();Object.defineProperty(y,"QuarantineResolver",{enumerable:!0,get:a(function(){return G9.QuarantineResolver},"get")});Object.defineProperty(y,"backupPathFor",{enumerable:!0,get:a(function(){return G9.backupPathFor},"get")});var Zm=iw();Object.defineProperty(y,"DEFAULT_MAX_FILE_BYTES",{enumerable:!0,get:a(function(){return Zm.DEFAULT_MAX_FILE_BYTES},"get")});Object.defineProperty(y,"InMemoryQuarantineStore",{enumerable:!0,get:a(function(){return Zm.InMemoryQuarantineStore},"get")});Object.defineProperty(y,"contentEquals",{enumerable:!0,get:a(function(){return Zm.contentEquals},"get")});Object.defineProperty(y,"isFileSpaceSyncablePath",{enumerable:!0,get:a(function(){return Zm.isFileSpaceSyncablePath},"get")});Object.defineProperty(y,"isSyncablePath",{enumerable:!0,get:a(function(){return Zm.isSyncablePath},"get")});var q9=wU();Object.defineProperty(y,"FileLocalManifestStore",{enumerable:!0,get:a(function(){return q9.FileLocalManifestStore},"get")});Object.defineProperty(y,"LOCAL_MANIFEST_STORE_FILENAME",{enumerable:!0,get:a(function(){return q9.LOCAL_MANIFEST_STORE_FILENAME},"get")});var jhe=R2();Object.defineProperty(y,"diff3",{enumerable:!0,get:a(function(){return jhe.diff3},"get")});var W9=AU();Object.defineProperty(y,"StructuredMerger",{enumerable:!0,get:a(function(){return W9.StructuredMerger},"get")});Object.defineProperty(y,"splitSections",{enumerable:!0,get:a(function(){return W9.splitSections},"get")});var Bhe=IU();Object.defineProperty(y,"MergeShaclGate",{enumerable:!0,get:a(function(){return Bhe.MergeShaclGate},"get")});var Uhe=RU();Object.defineProperty(y,"GatedStructuredMerger",{enumerable:!0,get:a(function(){return Uhe.GatedStructuredMerger},"get")});var K9=OU();Object.defineProperty(y,"FileWatermarkStore",{enumerable:!0,get:a(function(){return K9.FileWatermarkStore},"get")});Object.defineProperty(y,"WATERMARK_STORE_FILENAME",{enumerable:!0,get:a(function(){return K9.WATERMARK_STORE_FILENAME},"get")});var z9=xU();Object.defineProperty(y,"FileMountBaseStore",{enumerable:!0,get:a(function(){return z9.FileMountBaseStore},"get")});Object.defineProperty(y,"MOUNT_BASE_STORE_FILENAME",{enumerable:!0,get:a(function(){return z9.MOUNT_BASE_STORE_FILENAME},"get")});var Vhe=rw();Object.defineProperty(y,"isAuthError",{enumerable:!0,get:a(function(){return Vhe.isAuthError},"get")});var eg=xm();Object.defineProperty(y,"isRateLimitError",{enumerable:!0,get:a(function(){return eg.isRateLimitError},"get")});Object.defineProperty(y,"withRateLimitBackoff",{enumerable:!0,get:a(function(){return eg.withRateLimitBackoff},"get")});Object.defineProperty(y,"createRateLimitBudget",{enumerable:!0,get:a(function(){return eg.createRateLimitBudget},"get")});Object.defineProperty(y,"MIN_RATE_LIMIT_WAIT_MS",{enumerable:!0,get:a(function(){return eg.MIN_RATE_LIMIT_WAIT_MS},"get")});Object.defineProperty(y,"DEFAULT_MAX_RETRIES",{enumerable:!0,get:a(function(){return eg.DEFAULT_MAX_RETRIES},"get")});var ep=a2();Object.defineProperty(y,"caseInsensitiveHeaderGetter",{enumerable:!0,get:a(function(){return ep.caseInsensitiveHeaderGetter},"get")});Object.defineProperty(y,"parseRetryAfterMs",{enumerable:!0,get:a(function(){return ep.parseRetryAfterMs},"get")});Object.defineProperty(y,"extractRateLimitFields",{enumerable:!0,get:a(function(){return ep.extractRateLimitFields},"get")});Object.defineProperty(y,"getRateLimitFields",{enumerable:!0,get:a(function(){return ep.getRateLimitFields},"get")});Object.defineProperty(y,"attachRateLimitFields",{enumerable:!0,get:a(function(){return ep.attachRateLimitFields},"get")});Object.defineProperty(y,"enrichRateLimitError",{enumerable:!0,get:a(function(){return ep.enrichRateLimitError},"get")});var H9=p2();Object.defineProperty(y,"redactSecrets",{enumerable:!0,get:a(function(){return H9.redactSecrets},"get")});Object.defineProperty(y,"scanForSecrets",{enumerable:!0,get:a(function(){return H9.scanForSecrets},"get")});var Y9=PU();Object.defineProperty(y,"LocalConflictCacheStore",{enumerable:!0,get:a(function(){return Y9.LocalConflictCacheStore},"get")});Object.defineProperty(y,"CONFLICT_CACHE_STORE_FILENAME",{enumerable:!0,get:a(function(){return Y9.CONFLICT_CACHE_STORE_FILENAME},"get")});var Ax=ew();Object.defineProperty(y,"LocalOutboxStore",{enumerable:!0,get:a(function(){return Ax.LocalOutboxStore},"get")});Object.defineProperty(y,"OUTBOX_STORE_FILENAME",{enumerable:!0,get:a(function(){return Ax.OUTBOX_STORE_FILENAME},"get")});Object.defineProperty(y,"OUTBOX_REMOTE_ABSENT",{enumerable:!0,get:a(function(){return Ax.OUTBOX_REMOTE_ABSENT},"get")});var ws=Pm();Object.defineProperty(y,"ASSET_SPACE_CLASS_UID",{enumerable:!0,get:a(function(){return ws.ASSET_SPACE_CLASS_UID},"get")});Object.defineProperty(y,"PULL_ONLY_LIST_PATH",{enumerable:!0,get:a(function(){return ws.PULL_ONLY_LIST_PATH},"get")});Object.defineProperty(y,"PullOnlyListError",{enumerable:!0,get:a(function(){return ws.PullOnlyListError},"get")});Object.defineProperty(y,"SYNC_BRANCH",{enumerable:!0,get:a(function(){return ws.SYNC_BRANCH},"get")});Object.defineProperty(y,"SpaceSpecAccumulator",{enumerable:!0,get:a(function(){return ws.SpaceSpecAccumulator},"get")});Object.defineProperty(y,"applyPullOnlyListText",{enumerable:!0,get:a(function(){return ws.applyPullOnlyListText},"get")});Object.defineProperty(y,"classifySpaceDeclaration",{enumerable:!0,get:a(function(){return ws.classifySpaceDeclaration},"get")});Object.defineProperty(y,"isAssetSpaceFrontmatter",{enumerable:!0,get:a(function(){return ws.isAssetSpaceFrontmatter},"get")});Object.defineProperty(y,"isFileSpaceFrontmatter",{enumerable:!0,get:a(function(){return ws.isFileSpaceFrontmatter},"get")});Object.defineProperty(y,"parsePullOnlyList",{enumerable:!0,get:a(function(){return ws.parsePullOnlyList},"get")});Object.defineProperty(y,"parseStrictGitHubRepoURL",{enumerable:!0,get:a(function(){return ws.parseStrictGitHubRepoURL},"get")});Object.defineProperty(y,"readSpaceSource",{enumerable:!0,get:a(function(){return ws.readSpaceSource},"get")});var Q9=LU();Object.defineProperty(y,"buildAssetSpaceDescriptor",{enumerable:!0,get:a(function(){return Q9.buildAssetSpaceDescriptor},"get")});Object.defineProperty(y,"deriveAssetSpaceNamespace",{enumerable:!0,get:a(function(){return Q9.deriveAssetSpaceNamespace},"get")});var X9=jU();Object.defineProperty(y,"ParityValidator",{enumerable:!0,get:a(function(){return X9.ParityValidator},"get")});Object.defineProperty(y,"summarizeParityRound",{enumerable:!0,get:a(function(){return X9.summarizeParityRound},"get")});var J9=V2();Object.defineProperty(y,"compareAssetSemantics",{enumerable:!0,get:a(function(){return J9.compareAssetSemantics},"get")});Object.defineProperty(y,"isFormatOnlyDrift",{enumerable:!0,get:a(function(){return J9.isFormatOnlyDrift},"get")});pi(QU(),y);pi(s9(),y);var Ghe=sx();Object.defineProperty(y,"resolvePreferenceList",{enumerable:!0,get:a(function(){return Ghe.resolvePreferenceList},"get")});var qhe=Sw();Object.defineProperty(y,"unwrapLinkTarget",{enumerable:!0,get:a(function(){return qhe.unwrapLinkTarget},"get")});var Ix=yf();Object.defineProperty(y,"EFFORT_STATUS_UID",{enumerable:!0,get:a(function(){return Ix.EFFORT_STATUS_UID},"get")});Object.defineProperty(y,"EFFORT_STATUS_BY_UID",{enumerable:!0,get:a(function(){return Ix.EFFORT_STATUS_BY_UID},"get")});Object.defineProperty(y,"normalizeEffortStatus",{enumerable:!0,get:a(function(){return Ix.normalizeEffortStatus},"get")});var Whe=ax();Object.defineProperty(y,"DEFAULT_DISPLAY_NAME_SETTINGS",{enumerable:!0,get:a(function(){return Whe.DEFAULT_DISPLAY_NAME_SETTINGS},"get")});var Khe=c9();Object.defineProperty(y,"PrintNameRuleService",{enumerable:!0,get:a(function(){return Khe.PrintNameRuleService},"get")});var Z9=l9();Object.defineProperty(y,"DisplayNameResolver",{enumerable:!0,get:a(function(){return Z9.DisplayNameResolver},"get")});Object.defineProperty(y,"createDefaultResolver",{enumerable:!0,get:a(function(){return Z9.createDefaultResolver},"get")});var Rx=vw();Object.defineProperty(y,"DisplayNameTemplateEngine",{enumerable:!0,get:a(function(){return Rx.DisplayNameTemplateEngine},"get")});Object.defineProperty(y,"DISPLAY_NAME_PRESETS",{enumerable:!0,get:a(function(){return Rx.DISPLAY_NAME_PRESETS},"get")});Object.defineProperty(y,"DEFAULT_DISPLAY_NAME_TEMPLATE",{enumerable:!0,get:a(function(){return Rx.DEFAULT_DISPLAY_NAME_TEMPLATE},"get")});var e5=Wm();Object.defineProperty(y,"resolveKeyPath",{enumerable:!0,get:a(function(){return e5.resolveKeyPath},"get")});Object.defineProperty(y,"isWikilink",{enumerable:!0,get:a(function(){return e5.isWikilink},"get")});var xw=y9();Object.defineProperty(y,"isEffortBlocked",{enumerable:!0,get:a(function(){return xw.isEffortBlocked},"get")});Object.defineProperty(y,"isEpisodeOngoing",{enumerable:!0,get:a(function(){return xw.isEpisodeOngoing},"get")});Object.defineProperty(y,"localToday",{enumerable:!0,get:a(function(){return xw.localToday},"get")});Object.defineProperty(y,"createDisplayMatcherHostFunctions",{enumerable:!0,get:a(function(){return xw.createDisplayMatcherHostFunctions},"get")})});var or=Be(()=>{"use strict"});function t5(r){return r.startsWith("VALIDATION_")?"validation":r.startsWith("PERMISSION_")||r==="CREATION_GATE_REFUSED"?"permission":r.startsWith("STATE_")?"state":"internal"}var mt,r5=Be(()=>{"use strict";a(t5,"getErrorCategory");mt=class{static{a(this,"ResponseBuilder")}static success(e,t){return{success:!0,data:e,...t&&{meta:t}}}static error(e,t,n,i){return{success:!1,error:{code:e,category:t5(e),message:t,exitCode:n,...i?.recovery&&{recovery:i.recovery},...i?.context&&{context:i.context},...i?.stack&&{stack:i.stack}}}}}});var Ir=Be(()=>{"use strict";r5()});var pr,Ui=Be(()=>{"use strict";Ir();pr=class extends Error{static{a(this,"CLIError")}constructor(e,t,n){super(e),this.name=this.constructor.name,this.context=t,this.recoveryHint=n,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}format(){let e=`\u274C ${this.name}: ${this.message}`;if(this.guidance&&(e+=`
361
+ `);F=$===H}return o("checked",{filesChecked:S,inParity:E,discrepancies:v,m2SemanticDiffs:P,accountedCount:D,m1Violations:C,headSha:u,...F!==void 0?{attachmentHashSetIdentical:F}:{}})}catch(l){if((0,Gx.isAuthError)(l))return o("auth-required",{detail:s(`authentication failed: ${Ru(l)} \u2014 the PAT is expired, revoked or under-scoped; update it (R8)`)});if((0,Gx.isRefNotFoundError)(l)){let u=s(`${e.owner}/${e.repo}@${e.branch} is not reachable: ${Ru(l)} \u2014 ${Gx.REF_NOT_FOUND_HINT}`);return i.push("repo unreachable (HTTP 404) \u2014 skipped"),o("error",{detail:u})}return i.push(`parity check failed: ${s(Ru(l))}`),o("error",{detail:s(Ru(l))})}}async readLocalSnapshot(e,t){let n=this.deps.localFilesFor(e),i=t?zd.isFileSpaceSyncablePath:zd.isSyncablePath,s=this.deps.maxFileBytes??zd.DEFAULT_MAX_FILE_BYTES,o=new Map,c=new Map,l=[];if(t&&n.readBinary===void 0)throw new Error("file-mode repo requires a LocalFilesPort with readBinary \u2014 refusing to hash through the text-only port (binary would corrupt)");let u=new TextEncoder;for(let f of await n.list())if(i(f))try{if(t){let d=await n.readBinary(f);if(d.byteLength>s){l.push(`local ${f} exceeds the ${s}-byte cap \u2014 excluded symmetrically`);continue}o.set(f,await(0,kU.gitBlobSha)(d,this.deps.sha1))}else{let d=await n.read(f);if(u.encode(d).byteLength>s){l.push(`local ${f} exceeds the ${s}-byte cap \u2014 excluded symmetrically`);continue}c.set(f,d),o.set(f,await(0,kU.gitBlobSha)(d,this.deps.sha1))}}catch(d){let p=this.deps.redact??(h=>h);l.push(`local ${f} unreadable (${p(Ru(d))}) \u2014 skipped`)}return{shas:o,texts:c,warnings:l}}async classifyAll(e,t,n,i,s,o,c){let l=[],u=0,f=this.deps.maxSemanticFetchesPerRepo??Hfe,d=new Set([...t.shas.keys(),...n.keys()]);for(let p of[...d].sort()){let h=t.shas.get(p),m=n.get(p)?.blobSha,_=i.get(p);if(h!==void 0&&m!==void 0){if(h===m){u++;continue}l.push(await this.classifyContentDiff(e,p,h,m,_,s,o,t,{...c,takeRepoFetch:a(()=>f-- >0,"takeRepoFetch")}));continue}if(h!==void 0){let b;s.has(p)?b={path:p,presence:"local-only",cls:"quarantine-pinned",localSha:h}:_===void 0?b={path:p,presence:"local-only",cls:"pending-local-add",localSha:h}:_===h?b={path:p,presence:"local-only",cls:"pending-remote-delete",localSha:h,detail:"remote deleted it; the local copy is unchanged"}:b={path:p,presence:"local-only",cls:"pending-conflict",localSha:h,detail:"remote deleted it AND the local copy was edited"},l.push(b);continue}if(m!==void 0){let b;s.has(p)?b={path:p,presence:"remote-only",cls:"quarantine-pinned",remoteSha:m}:_===void 0?b={path:p,presence:"remote-only",cls:"pending-remote-add",remoteSha:m}:_===m?b={path:p,presence:"remote-only",cls:"deferred-local-delete",remoteSha:m,detail:"locally deleted; the delete propagates on the next sync (#3476) \u2014 escalates if it survives a converged round"}:b={path:p,presence:"remote-only",cls:"pending-conflict",remoteSha:m,detail:"locally deleted AND the remote copy was edited"},l.push(b)}}return{discrepancies:l,inParity:u,filesChecked:d.size}}async classifyContentDiff(e,t,n,i,s,o,c,l,u){let f={localSha:n,remoteSha:i};if(o.has(t))return{path:t,presence:"both",cls:"quarantine-pinned",...f};if(s!==void 0&&s===n)return{path:t,presence:"both",cls:"pending-remote-edit",...f};if(s!==void 0&&s===i)return{path:t,presence:"both",cls:"pending-local-edit",...f};if(c)return{path:t,presence:"both",cls:"pending-conflict",...f,detail:"binary content differs on both sides"};if(!u.takeRepoFetch()||!u.runBudget.take(1))return u.warnings.push(`semantic-fetch cap reached \u2014 ${t} left unverified (counted into M2)`),{path:t,presence:"both",cls:"unverified-divergence",...f};let d=l.texts.get(t),p;try{p=await(0,$m.getBlobText)(this.transport,e.owner,e.repo,i,this.deps.baseURL)}catch(g){let m=this.deps.redact??(_=>_);return u.warnings.push(`blob fetch for ${t} failed (${m(Ru(g))}) \u2014 left unverified`),{path:t,presence:"both",cls:"unverified-divergence",...f}}let h=(0,MU.compareAssetSemantics)(d??"",p,this.deps.yaml);return(0,MU.isFormatOnlyDrift)(h)?{path:t,presence:"both",cls:"format-only-drift",...f,frontmatterEqual:!0,bodyEqual:!0}:{path:t,presence:"both",cls:"pending-conflict",...f,frontmatterEqual:h.frontmatterEqual,bodyEqual:h.bodyEqual,detail:`semantic divergence (frontmatter ${h.frontmatterEqual?"equal":"differs"}, body ${h.bodyEqual?"equal":"differs"})`}}checkConservation(e,t,n,i,s,o){if(e.pullOnly===!0)return[];let c=t.snapshot?.dirtyByRepo.get(e.repoKey);if(c===void 0||c.size===0)return[];let l=new Set(o?.mergedPaths??[]),u=new Set(o?.quarantinedPaths??[]),f=[];for(let[d,p]of c)n.shas.get(d)!==p&&i.get(d)?.blobSha!==p&&(l.has(d)||u.has(d)||s.has(d)||f.push({repoKey:e.repoKey,path:d,kind:"conservation",detail:`pre-sync dirty content ${p.slice(0,7)} survived NOWHERE: disk now ${n.shas.get(d)?.slice(0,7)??"absent"}, not in head tree, not merged/quarantined/pinned \u2014 possible lost edit`}));return f}escalatePersistentDivergence(e,t,n){for(let i of e){if(i.status!=="checked")continue;let s=n?.find(u=>u.repoKey===i.repoKey);if(s!==void 0&&s.status!=="synced")continue;let o=new Set(s?.deferredDeletes??[]),c=t.repos.find(u=>u.repoKey===i.repoKey&&u.status==="checked");if(c===void 0)continue;let l=new Map(c.discrepancies.filter(u=>$U.has(u.cls)).map(u=>[u.path,u]));for(let u of i.discrepancies){if(!$U.has(u.cls)||u.cls==="deferred-local-delete"&&o.has(u.path))continue;let f=l.get(u.path);f!==void 0&&f.localSha===u.localSha&&f.remoteSha===u.remoteSha&&i.m1Violations.push({repoKey:i.repoKey,path:u.path,kind:"persistent-divergence",detail:`identical divergence (local ${u.localSha?.slice(0,7)??"absent"}, remote ${u.remoteSha?.slice(0,7)??"absent"}) survived a sync round unchanged (${f.cls} \u2192 ${u.cls}) \u2014 the engine failed to converge it`})}}}};jm.ParityValidator=qx;function Xfe(r){if(r.vacuous)return`ExoSync parity: VACUOUS \u2014 0 of ${r.repos.length} repo(s) checked (errors / never synced)`;let e=r.repos.length-r.checkedRepos,t=e>0?`, ${e} skipped`:"",n=r.repos.reduce((s,o)=>s+o.discrepancies.filter(c=>c.cls==="quarantine-pinned").length,0),i=n>0?`, ${n} pinned`:"";return r.ok?`ExoSync parity: M1=0, M2=\u2205 (${r.checkedRepos} repo(s) checked${t})${i}`:`ExoSync parity: M1=${r.m1Total}, M2=${r.m2Total} diff(s) (${r.checkedRepos} repo(s) checked${t})${i} \u2014 see log`}a(Xfe,"summarizeParityRound")});var UU=T(BU=>{"use strict";Object.defineProperty(BU,"__esModule",{value:!0})});var Bm=T(on=>{"use strict";Object.defineProperty(on,"__esModule",{value:!0});on.UID_UNIQUENESS_WHITELIST_CLASS_UIDS=on.KNOWN_CHECK_IDS=on.CHECK_ID_DAG_ONTOLOGY_IMPORTS=on.CHECK_ID_UID_UNIQUENESS=on.CHECK_ID_CO_LOCATION=on.CHECK_ID_SHACL=void 0;on.CHECK_ID_SHACL="f83ffedd-1f05-4ab5-839d-58873c69c4ba";on.CHECK_ID_CO_LOCATION="61f95c82-f6fc-4b20-b06d-19f3dc1b1f12";on.CHECK_ID_UID_UNIQUENESS="ac10db25-231c-4677-8cac-647d3cf15c64";on.CHECK_ID_DAG_ONTOLOGY_IMPORTS="a57f4a6b-a462-4c8d-b958-0dbee4674727";on.KNOWN_CHECK_IDS=new Set([on.CHECK_ID_SHACL,on.CHECK_ID_CO_LOCATION,on.CHECK_ID_UID_UNIQUENESS,on.CHECK_ID_DAG_ONTOLOGY_IMPORTS]);on.UID_UNIQUENESS_WHITELIST_CLASS_UIDS=new Set(["b04e7a3e-6b49-4984-9f8d-b74e9f36818b","2b754a16-cccf-49ee-af69-a18c6d1e3b63"])});var pw=T(Um=>{"use strict";Object.defineProperty(Um,"__esModule",{value:!0});Um.readUid=Jfe;Um.readIsDefinedByRef=Zfe;Um.readInstanceClassRefs=ede;var VU=hu();function Jfe(r){let e=r.exo__Asset_uid;if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}a(Jfe,"readUid");function Zfe(r){return(0,VU.extractAssetReference)(r.exo__Asset_isDefinedBy)}a(Zfe,"readIsDefinedByRef");function ede(r){let e=r.exo__Instance_class,t=Array.isArray(e)?e:e==null?[]:[e],n=[];for(let i of t){let s=(0,VU.extractAssetReference)(i);s&&n.push(s)}return n}a(ede,"readInstanceClassRefs")});var Kx=T(Wx=>{"use strict";Object.defineProperty(Wx,"__esModule",{value:!0});Wx.uidUniquenessCheck=rde;var GU=pw(),tde=Bm();function rde(r){let e=new Map;for(let n of r.assets){let i=(0,GU.readUid)(n.frontmatter);if(!i||(0,GU.readInstanceClassRefs)(n.frontmatter).some(c=>tde.UID_UNIQUENESS_WHITELIST_CLASS_UIDS.has(c)))continue;let o=e.get(i);o?o.push(n.path):e.set(i,[n.path])}let t=[];for(let[n,i]of e){if(i.length<2)continue;let s=[...i].sort();for(let o of s)t.push({path:o,message:`duplicate exo__Asset_uid "${n}" \u2014 also at ${s.filter(c=>c!==o).join(", ")}`})}return t}a(rde,"uidUniquenessCheck")});var Hx=T(zx=>{"use strict";Object.defineProperty(zx,"__esModule",{value:!0});zx.coLocationCheck=ode;var qU=pw(),nde=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function WU(r){let e=r.lastIndexOf("/");return e<0?"":r.slice(0,e)}a(WU,"dirOf");function ide(r){let e=r.slice(r.lastIndexOf("/")+1);return e.endsWith(".md")?e.slice(0,-3):e}a(ide,"baseNameNoExt");function sde(r){return r.split("/").some(e=>e.toLowerCase()==="templates")}a(sde,"isTemplatesPath");function ode(r){let e=new Map,t=new Map;for(let s of r.assets){let o=(0,qU.readUid)(s.frontmatter);o&&!e.has(o)&&e.set(o,s.path);let c=ide(s.path);t.has(c)||t.set(c,s.path)}let n=a(s=>nde.test(s)?e.get(s)??t.get(s):t.get(s)??e.get(s),"resolve"),i=[];for(let s of r.assets){if(s.path.split("/").includes("node_modules")||sde(s.path))continue;let o=(0,qU.readIsDefinedByRef)(s.frontmatter);if(!o||o.startsWith("!"))continue;let c=n(o);if(!c)continue;let l=WU(c),u=WU(s.path);l!==u&&i.push({path:s.path,message:`co-location: isDefinedBy=${o} expects folder "${l}/" but asset is in "${u}/"`})}return i}a(ode,"coLocationCheck")});var Qx=T(Yx=>{"use strict";Object.defineProperty(Yx,"__esModule",{value:!0});Yx.shaclCheck=ade;async function ade(r){if(!r.runShacl)throw new Error("SHACL check is enabled but this context provides no triple-store (runShacl). Wire a warm getTripleStore()/runShapesValidation reader, or disable the check.");return(await r.runShacl()).map(t=>({path:t.focusNode??t.path,message:`SHACL: ${t.message}${t.path?` (path ${t.path})`:""}`}))}a(ade,"shaclCheck")});var Jx=T(Xx=>{"use strict";Object.defineProperty(Xx,"__esModule",{value:!0});Xx.dagOntologyImportsCheck=cde;async function cde(r){if(!r.runDag)throw new Error("DAG ontology-imports check is enabled but this context provides no graph derivation (runDag). Wire a reader that supplies it, or disable the check.");return[...await r.runDag()]}a(cde,"dagOntologyImportsCheck")});var Zx=T(Vm=>{"use strict";Object.defineProperty(Vm,"__esModule",{value:!0});Vm.CheckRegistry=void 0;Vm.createDefaultCheckRegistry=pde;var hw=Bm(),lde=Kx(),ude=Hx(),fde=Qx(),dde=Jx(),mw=class{static{a(this,"CheckRegistry")}constructor(){this.entries=new Map}register(e){return this.entries.set(e.id,e),this}get(e){return this.entries.get(e)}has(e){return this.entries.has(e)}ids(){return[...this.entries.keys()]}};Vm.CheckRegistry=mw;function pde(){return new mw().register({id:hw.CHECK_ID_UID_UNIQUENESS,label:"uid-uniqueness",run:lde.uidUniquenessCheck}).register({id:hw.CHECK_ID_CO_LOCATION,label:"co-location",run:ude.coLocationCheck}).register({id:hw.CHECK_ID_SHACL,label:"shacl",run:fde.shaclCheck}).register({id:hw.CHECK_ID_DAG_ONTOLOGY_IMPORTS,label:"dag-ontology-imports",run:dde.dagOntologyImportsCheck})}a(pde,"createDefaultCheckRegistry")});var KU=T(gw=>{"use strict";Object.defineProperty(gw,"__esModule",{value:!0});gw.VaultCheckRunner=void 0;var hde=Zx(),e2=class{static{a(this,"VaultCheckRunner")}constructor(e=new hde.CheckRegistry){this.registry=e}async run(e,t){let n=await e.read();return this.runWithContext(n,t)}async runWithContext(e,t){let n=[];for(let i of t){let s=this.registry.get(i);if(!s){n.push({checkId:i,label:i,status:"error",findings:[],errorMessage:`fail-loud: enabled check-id "${i}" has no registered runner`});continue}try{let o=await s.run(e);n.push({checkId:i,label:s.label,status:o.length>0?"fail":"pass",findings:o})}catch(o){n.push({checkId:i,label:s.label,status:"error",findings:[],errorMessage:`fail-loud: check "${s.label}" threw \u2014 ${o instanceof Error?o.message:String(o)}`})}}return{totalAssets:e.assets.length,results:n,ok:n.every(i=>i.status==="pass")}}};gw.VaultCheckRunner=e2});var zU=T(t2=>{"use strict";Object.defineProperty(t2,"__esModule",{value:!0});t2.readEnabledCheckIds=yde;var mde=Bm(),gde=hu();function yde(r){let e=new Set;for(let t of r){let n=(0,gde.extractAssetReference)(t.frontmatter.setting__Setting_key);if(!n||!mde.KNOWN_CHECK_IDS.has(n))continue;let i=t.frontmatter.setting__Setting_value;(i===!0||i==="true")&&e.add(n)}return[...e]}a(yde,"readEnabledCheckIds")});var QU=T(Mt=>{"use strict";var _de=Mt&&Mt.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:a(function(){return e[t]},"get")}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),HU=Mt&&Mt.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&_de(e,r,t)};Object.defineProperty(Mt,"__esModule",{value:!0});Mt.readInstanceClassRefs=Mt.readIsDefinedByRef=Mt.readUid=Mt.dagOntologyImportsCheck=Mt.shaclCheck=Mt.coLocationCheck=Mt.uidUniquenessCheck=Mt.readEnabledCheckIds=Mt.VaultCheckRunner=Mt.createDefaultCheckRegistry=Mt.CheckRegistry=void 0;HU(UU(),Mt);HU(Bm(),Mt);var YU=Zx();Object.defineProperty(Mt,"CheckRegistry",{enumerable:!0,get:a(function(){return YU.CheckRegistry},"get")});Object.defineProperty(Mt,"createDefaultCheckRegistry",{enumerable:!0,get:a(function(){return YU.createDefaultCheckRegistry},"get")});var bde=KU();Object.defineProperty(Mt,"VaultCheckRunner",{enumerable:!0,get:a(function(){return bde.VaultCheckRunner},"get")});var Sde=zU();Object.defineProperty(Mt,"readEnabledCheckIds",{enumerable:!0,get:a(function(){return Sde.readEnabledCheckIds},"get")});var wde=Kx();Object.defineProperty(Mt,"uidUniquenessCheck",{enumerable:!0,get:a(function(){return wde.uidUniquenessCheck},"get")});var Ede=Hx();Object.defineProperty(Mt,"coLocationCheck",{enumerable:!0,get:a(function(){return Ede.coLocationCheck},"get")});var vde=Qx();Object.defineProperty(Mt,"shaclCheck",{enumerable:!0,get:a(function(){return vde.shaclCheck},"get")});var Tde=Jx();Object.defineProperty(Mt,"dagOntologyImportsCheck",{enumerable:!0,get:a(function(){return Tde.dagOntologyImportsCheck},"get")});var r2=pw();Object.defineProperty(Mt,"readUid",{enumerable:!0,get:a(function(){return r2.readUid},"get")});Object.defineProperty(Mt,"readIsDefinedByRef",{enumerable:!0,get:a(function(){return r2.readIsDefinedByRef},"get")});Object.defineProperty(Mt,"readInstanceClassRefs",{enumerable:!0,get:a(function(){return r2.readInstanceClassRefs},"get")})});var JU=T(XU=>{"use strict";Object.defineProperty(XU,"__esModule",{value:!0})});var yw=T(dr=>{"use strict";Object.defineProperty(dr,"__esModule",{value:!0});dr.LEGACY_SETTING_VALUE_PROPS=dr.LEGACY_SETTING_KEY_PROPS=dr.SETTING_VALUE_PROP=dr.SETTING_KEY_PROP=void 0;dr.coerceSettingValue=Ade;dr.extractKeyRef=Ide;dr.readSettingValueRaw=Rde;dr.renderSettingAssetMarkdown=Ode;var ZU=hu();dr.SETTING_KEY_PROP="setting__Setting_key";dr.SETTING_VALUE_PROP="setting__Setting_value";dr.LEGACY_SETTING_KEY_PROPS=["exo__Setting_key"];dr.LEGACY_SETTING_VALUE_PROPS=["exo__Setting_value"];function Ade(r,e){switch(r){case"boolean":{if(typeof e=="boolean")return e;if(typeof e=="string"){let t=e.trim().toLowerCase();if(t==="true")return!0;if(t==="false")return!1}return}case"string":return typeof e=="string"?e:typeof e=="number"?String(e):void 0;case"stringList":{if(Array.isArray(e)){let t=e.filter(n=>typeof n=="string");return t.length===e.length?t:void 0}return typeof e=="string"?[e]:void 0}}}a(Ade,"coerceSettingValue");function e9(r){let e=r.indexOf("#");return e===-1?r:r.slice(0,e).trim()}a(e9,"stripAnchor");function Ide(r){let e=(0,ZU.extractAssetReference)(r[dr.SETTING_KEY_PROP]);if(e)return e9(e);for(let t of dr.LEGACY_SETTING_KEY_PROPS){let n=(0,ZU.extractAssetReference)(r[t]);if(n)return e9(n)}return null}a(Ide,"extractKeyRef");function Rde(r){if(dr.SETTING_VALUE_PROP in r)return r[dr.SETTING_VALUE_PROP];for(let e of dr.LEGACY_SETTING_VALUE_PROPS)if(e in r)return r[e]}a(Rde,"readSettingValueRaw");function Cde(r,e){switch(r){case"boolean":return[`${dr.SETTING_VALUE_PROP}: ${e===!0?"true":"false"}`];case"string":return[`${dr.SETTING_VALUE_PROP}: ${JSON.stringify(String(e??""))}`];case"stringList":{let t=Array.isArray(e)?e:[];return t.length===0?[`${dr.SETTING_VALUE_PROP}: []`]:[`${dr.SETTING_VALUE_PROP}:`,...t.map(n=>` - ${JSON.stringify(n)}`)]}}}a(Cde,"renderValueYaml");function Ode(r,e,t,n,i){return["---",`exo__Asset_uid: ${r.settingUid}`,`exo__Asset_isDefinedBy: "[[${n}]]"`,`exo__Asset_createdAt: ${i}`,"exo__Instance_class:",` - "[[${t}]]"`,`exo__Asset_label: "Setting: ${r.field}"`,`${dr.SETTING_KEY_PROP}: "[[${r.keyUid}]]"`,...Cde(r.datatype,e),"---","",`Distributable Exocortex setting \`${r.field}\` (${r.datatype}), exported by the Settings Distribution engine (RFC f402002b, M2). Edit \`setting__Setting_value\` here or re-export to overwrite.`,""].join(`
362
+ `)}a(Ode,"renderSettingAssetMarkdown")});var t9=T(bw=>{"use strict";Object.defineProperty(bw,"__esModule",{value:!0});bw.exportSettings=xde;bw.importSettings=Pde;var _w=yw();function xde(r,e){return r.declaredKeys().map(t=>({field:t.field,fileName:`${t.settingUid}.md`,content:(0,_w.renderSettingAssetMarkdown)(t,r.readLiveValue(t),r.settingClassUid,e.ontologyUid,e.nowIso)}))}a(xde,"exportSettings");async function Pde(r,e){let t=new Map;for(let s of r.declaredKeys())t.set(s.keyUid,s),t.set(s.keyLabel,s);let n=[],i=[];for(let s of e){let o=(0,_w.extractKeyRef)(s.frontmatter),c=o!==null?t.get(o):void 0;if(c===void 0){i.push({path:s.path,reason:"unknown-key",detail:o??"<no setting key>"});continue}let l=(0,_w.coerceSettingValue)(c.datatype,(0,_w.readSettingValueRaw)(s.frontmatter));if(l===void 0){i.push({path:s.path,reason:"uncoercible",detail:`expected ${c.datatype}`});continue}await r.writeLiveValue(c,l),n.push(c.field)}return{applied:n,skipped:i}}a(Pde,"importSettings")});var r9=T(Gm=>{"use strict";Object.defineProperty(Gm,"__esModule",{value:!0});Gm.EXOCORTEX_DISTRIBUTION_ONTOLOGY_KEY_UID=void 0;Gm.resolveDistributionOntology=Fde;var n2=yw();Gm.EXOCORTEX_DISTRIBUTION_ONTOLOGY_KEY_UID="ea44f996-64e5-46ce-8953-b13d21ee750d";function Fde(r,e){for(let t of r){if((0,n2.extractKeyRef)(t.frontmatter)!==e)continue;let n=(0,n2.coerceSettingValue)("string",(0,n2.readSettingValueRaw)(t.frontmatter));if(typeof n=="string"){let i=n.trim();if(i.length>0)return i}}return null}a(Fde,"resolveDistributionOntology")});var s9=T(Pt=>{"use strict";var Lde=Pt&&Pt.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:a(function(){return e[t]},"get")}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Dde=Pt&&Pt.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Lde(e,r,t)};Object.defineProperty(Pt,"__esModule",{value:!0});Pt.resolveDistributionOntology=Pt.EXOCORTEX_DISTRIBUTION_ONTOLOGY_KEY_UID=Pt.importSettings=Pt.exportSettings=Pt.renderSettingAssetMarkdown=Pt.readSettingValueRaw=Pt.extractKeyRef=Pt.coerceSettingValue=Pt.LEGACY_SETTING_VALUE_PROPS=Pt.LEGACY_SETTING_KEY_PROPS=Pt.SETTING_VALUE_PROP=Pt.SETTING_KEY_PROP=void 0;Dde(JU(),Pt);var Xc=yw();Object.defineProperty(Pt,"SETTING_KEY_PROP",{enumerable:!0,get:a(function(){return Xc.SETTING_KEY_PROP},"get")});Object.defineProperty(Pt,"SETTING_VALUE_PROP",{enumerable:!0,get:a(function(){return Xc.SETTING_VALUE_PROP},"get")});Object.defineProperty(Pt,"LEGACY_SETTING_KEY_PROPS",{enumerable:!0,get:a(function(){return Xc.LEGACY_SETTING_KEY_PROPS},"get")});Object.defineProperty(Pt,"LEGACY_SETTING_VALUE_PROPS",{enumerable:!0,get:a(function(){return Xc.LEGACY_SETTING_VALUE_PROPS},"get")});Object.defineProperty(Pt,"coerceSettingValue",{enumerable:!0,get:a(function(){return Xc.coerceSettingValue},"get")});Object.defineProperty(Pt,"extractKeyRef",{enumerable:!0,get:a(function(){return Xc.extractKeyRef},"get")});Object.defineProperty(Pt,"readSettingValueRaw",{enumerable:!0,get:a(function(){return Xc.readSettingValueRaw},"get")});Object.defineProperty(Pt,"renderSettingAssetMarkdown",{enumerable:!0,get:a(function(){return Xc.renderSettingAssetMarkdown},"get")});var n9=t9();Object.defineProperty(Pt,"exportSettings",{enumerable:!0,get:a(function(){return n9.exportSettings},"get")});Object.defineProperty(Pt,"importSettings",{enumerable:!0,get:a(function(){return n9.importSettings},"get")});var i9=r9();Object.defineProperty(Pt,"EXOCORTEX_DISTRIBUTION_ONTOLOGY_KEY_UID",{enumerable:!0,get:a(function(){return i9.EXOCORTEX_DISTRIBUTION_ONTOLOGY_KEY_UID},"get")});Object.defineProperty(Pt,"resolveDistributionOntology",{enumerable:!0,get:a(function(){return i9.resolveDistributionOntology},"get")})});var s2=T(i2=>{"use strict";Object.defineProperty(i2,"__esModule",{value:!0});i2.resolvePreferenceList=Nde;function Nde(r,e){if(Array.isArray(r)&&r.length>1){let t=r.map(n=>e(n)).filter(n=>n!==null&&n.length>0);return t.length>0?t.join("|"):null}return Array.isArray(r)?r.length===0?null:e(r[0]):e(r)}a(Nde,"resolvePreferenceList")});var Sw=T(o2=>{"use strict";Object.defineProperty(o2,"__esModule",{value:!0});o2.unwrapLinkTarget=kde;function kde(r){let e=r.replace(/^\[\[|\]\]$/g,"").replace(/^"|"$/g,"").trim();return e.includes("|")?e.split("|")[0]?.trim()??"":e}a(kde,"unwrapLinkTarget")});var a2=T(ww=>{"use strict";Object.defineProperty(ww,"__esModule",{value:!0});ww.DEFAULT_DISPLAY_NAME_SETTINGS=void 0;ww.DEFAULT_DISPLAY_NAME_SETTINGS={defaultTemplate:"{{exo__Asset_label}}",classTemplates:{},projectTBoxNames:!0}});var Wm=T(qm=>{"use strict";Object.defineProperty(qm,"__esModule",{value:!0});qm.isWikilink=c2;qm.ownProperty=Ew;qm.resolveKeyPath=Mde;function c2(r){return r.startsWith("[[")&&r.endsWith("]]")}a(c2,"isWikilink");function Ew(r,e){if(!(r===null||typeof r!="object"))return Object.prototype.hasOwnProperty.call(r,e)?r[e]:void 0}a(Ew,"ownProperty");function Mde(r,e,t){let n=e.split("."),i=r;for(let s of n){if(i==null)return;if(Array.isArray(i)){let o=i[0];if(typeof o=="string"&&t&&c2(o)){let c=t(o);if(c){i=Ew(c,s);continue}return}}if(typeof i!="object"){if(typeof i=="string"&&t&&c2(i)){let o=t(i);if(o){i=Ew(o,s);continue}}return}i=Ew(i,s)}return i}a(Mde,"resolveKeyPath")});var vw=T(bs=>{"use strict";Object.defineProperty(bs,"__esModule",{value:!0});bs.DEFAULT_DISPLAY_NAME_TEMPLATE=bs.DISPLAY_NAME_PRESETS=bs.DisplayNameTemplateEngine=bs.COMPOSED_SOURCE_MARKER=void 0;var $de=Wm();bs.COMPOSED_SOURCE_MARKER="displayName";var l2=`!${bs.COMPOSED_SOURCE_MARKER}`,Hd=class r{static{a(this,"DisplayNameTemplateEngine")}constructor(e,t={}){this.template=e,this.options=t}render(e,t,n,i,s){if(!this.template||this.template.trim()==="")return null;let o=this.options.separator;if(o)return this.renderWithSeparator(o,e,t,n,i);let c=0,l=0,u=this.renderSegment(this.template,e,t,n,i,()=>{c+=1},()=>{l+=1});if(s?.({placeholders:c,nonEmpty:l}),c>0&&l===0&&r.hasReadableFallback(e,t))return null;let f=this.cleanupResult(u);return f===""?null:f}static hasReadableFallback(e,t){let n=e.exo__Asset_label;if(typeof n=="string"&&n.trim()!=="")return!0;let i=t.trim();return i===""?!1:!r.UUID_PATTERN.test(i)}renderSegment(e,t,n,i,s,o,c){return e.replace(r.PLACEHOLDER_PATTERN,(l,u)=>{let f=u.trim();o?.();let d=this.resolveValue(f,t,n,i,s);return d.trim()!==""&&c?.(),d})}renderWithSeparator(e,t,n,i,s){let o=this.template.indexOf("{{"),c=this.template.lastIndexOf("}}");if(o===-1||c===-1||c<o){let m=this.cleanupResult(this.renderSegment(this.template,t,n,i,s));return m===""?null:m}let l=this.template.slice(0,o),u=this.template.slice(o,c+2),f=this.template.slice(c+2),d=[];for(let m of r.splitOutsidePlaceholders(u,e)){let _=this.cleanupResult(this.renderSegment(m,t,n,i,s));_!==""&&d.push(_)}if(d.length===0)return null;let p=this.renderSegment(l,t,n,i,s),h=this.renderSegment(f,t,n,i,s),g=`${p}${d.join(e)}${h}`.trim();return g===""?null:g}static splitOutsidePlaceholders(e,t){if(t.length===0)return[e];let n=[],i="",s=0;for(;s<e.length;){if(e.startsWith("{{",s)){let o=e.indexOf("}}",s+2);if(o!==-1){i+=e.slice(s,o+2),s=o+2;continue}}if(e.startsWith(t,s)){n.push(i),i="",s+=t.length;continue}i+=e[s],s+=1}return n.push(i),n}cleanupResult(e){let t=e;return t=t.replace(/\s+\(\s*\)$/g,""),t=t.replace(/^\(\s*\)\s+/g,""),t==="()"&&(t=""),t=t.replace(/\s+\[\s*\]$/g,""),t=t.replace(/^\[\s*\]\s+/g,""),t==="[]"&&(t=""),t=t.replace(/\s+/g," "),t.trim()}resolveValue(e,t,n,i,s){if(e==="_basename")return n;if(e==="_created")return i?this.formatDate(i):"";let{path:o,format:c,preferComposed:l}=r.splitKeyAndFormat(e),u=o.includes("|")?o.split("|").map(d=>d.trim()).filter(d=>d.length>0):[o],f="";for(let d of u){let p=this.getNestedValue(t,d,s),h;if(c){let g=r.applyValueFormat(p,c);h=g!==null?g:this.formatValue(p,s,l)}else h=this.formatValue(p,s,l);if(h!=="")return h;f=h}return f}static splitKeyAndFormat(e){let t=e,n=!1,i=t.trimEnd();i.length>l2.length&&i.endsWith(l2)&&(n=!0,t=i.slice(0,-l2.length).trim());let s=t.indexOf("::");if(s<=0)return n?{path:t,preferComposed:n}:{path:t};let o=t.slice(0,s).trim(),c=t.slice(s+2).trim();return!o||!c?n?{path:t,preferComposed:n}:{path:t}:n?{path:o,format:c,preferComposed:n}:{path:o,format:c}}static applyValueFormat(e,t){let n=e;if(Array.isArray(n)){if(n.length===0)return null;n=n[0]}let i,s,o,c,l,u;if(n instanceof Date){if(Number.isNaN(n.getTime()))return null;let p=a(h=>String(h).padStart(2,"0"),"pad");i=String(n.getUTCFullYear()).padStart(4,"0"),s=p(n.getUTCMonth()+1),o=p(n.getUTCDate()),c=p(n.getUTCHours()),l=p(n.getUTCMinutes()),u=p(n.getUTCSeconds())}else if(typeof n=="string"){let p=/^\s*(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?)?/.exec(n);if(!p)return null;i=p[1],s=p[2],o=p[3],c=p[4],l=p[5],u=p[6]}else return null;let f=!1,d=t.replace(/YYYY|YY|MM|DD|HH|mm|ss/g,p=>{switch(p){case"YYYY":return i;case"YY":return i.slice(-2);case"MM":return s;case"DD":return o;case"HH":return c===void 0&&(f=!0),c??"";case"mm":return l===void 0&&(f=!0),l??"";case"ss":return u===void 0&&(f=!0),u??"";default:return p}});return f?null:d}getNestedValue(e,t,n){return(0,$de.resolveKeyPath)(e,t,n)}formatWikilinkValue(e,t,n=!1){let i=e.match(/^\[\[([^\]|]+?)(?:\|([^\]]+))?\]\]$/);if(!i)return e.replace(r.WIKILINK_PATTERN,"").trim();let s=i[1].trim(),o=i[2]?.trim();if(o)return o;let c=t?t(e):void 0,l=c?.exo__Asset_label,u=typeof l=="string"&&l.trim()?l.trim():null,f=a(()=>{let d=this.options.nestedDisplayName?.(e,c);return d!=null&&d.trim()!==""?d.trim():null},"composed");if(n){let d=f();if(d!==null)return d}if(u!==null)return u;if(!n){let d=f();if(d!==null)return d}return s}formatValue(e,t,n=!1){if(e==null)return"";if(typeof e=="string")return this.formatWikilinkValue(e,t,n);if(Array.isArray(e)){if(e.length===0)return"";if(this.options.joinArrayValues){let i=[];for(let s of e){let o=this.formatValue(s,t,n);o&&!r.UUID_PATTERN.test(o)&&i.push(o)}return i.join(" ")}return this.formatValue(e[0],t,n)}return typeof e=="object"?JSON.stringify(e):String(e)}formatDate(e){let t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),i=String(e.getDate()).padStart(2,"0");return`${t}-${n}-${i}`}getTemplate(){return this.template}isValid(){return!this.template||this.template.trim()===""?!1:/\{\{[^}]+\}\}/.test(this.template)}getPlaceholders(){let e=[],t=/\{\{([^}]+)\}\}/g,n;for(;(n=t.exec(this.template))!==null;)e.push(n[1].trim());return e}};bs.DisplayNameTemplateEngine=Hd;Hd.PLACEHOLDER_PATTERN=/\{\{([^}]+)\}\}/g;Hd.WIKILINK_PATTERN=/^\[\[|\]\]$/g;Hd.UUID_PATTERN=/^[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}$/;bs.DISPLAY_NAME_PRESETS={default:{name:"Label only (default)",template:"{{exo__Asset_label}}"},labelWithStatus:{name:"Label with status",template:"{{exo__Asset_label}}: {{ems__Effort_status}}"},classPrefix:{name:"Class prefix",template:"[{{exo__Instance_class}}] {{exo__Asset_label}}"},classSuffix:{name:"Class suffix",template:"{{exo__Asset_label}} ({{exo__Instance_class}})"},basenameWithLabel:{name:"Filename with label",template:"{{_basename}} - {{exo__Asset_label}}"},datePrefix:{name:"Date prefix",template:"{{_created}} - {{exo__Asset_label}}"}};bs.DEFAULT_DISPLAY_NAME_TEMPLATE=bs.DISPLAY_NAME_PRESETS.classSuffix.template});var c9=T(Tw=>{"use strict";Object.defineProperty(Tw,"__esModule",{value:!0});Tw.PrintNameRuleService=void 0;var jde=s2(),o9=Sw(),a9=Wm(),Bde=vw(),Ude="exo__DisplayNameSpec",Vde="07eab746-0874-4676-9d98-dbaad1bc6fb8",Gde=new Set(["8bc662e3-2984-4845-9593-d37e0db9b7e3","exo__PrintedPropertyValueSourceDisplayName"]),qde="exo__PrintedProperty",Wde="7d58de40-d941-4a66-88e2-13afc4fdc41d",Kde="exo__PrintedLiteral",zde="4d5437c9-788e-4a6d-9be0-4af3a84554f4",Hde=1e3,Yde=300,u2=class r{static{a(this,"PrintNameRuleService")}constructor(e,t={},n=void 0){this.vault=e,this.hostFunctions=t,this.host=n,this.rules=new Map,this.classHierarchy=new Map,this.initialized=!1,this.scanDebounceTimer=null}initialize(){this.scanVault(),this.initialized=!0}getTemplateForClass(e,t){if(!this.initialized)return null;let n=this.selectRule(this.rules.get(e),t);if(n)return{template:n.template,priority:n.priority};let i=this.getAncestorClasses(e);for(let s of i){let o=this.selectRule(this.rules.get(s),t);if(o)return{template:o.template,priority:o.priority}}return null}getParticipatingRules(e,t){if(!this.initialized)return[];let n=this.participatingOf(this.rules.get(e),t);if(n.length>0)return n;for(let i of this.getAncestorClasses(e)){let s=this.participatingOf(this.rules.get(i),t);if(s.length>0)return s}return[]}selectRule(e,t){if(!e||e.length===0)return null;for(let n of e)if(this.ruleParticipates(n,t))return n;return null}participatingOf(e,t){if(!e||e.length===0)return[];let n=[];for(let i of e)this.ruleParticipates(i,t)&&n.push({template:i.template,priority:i.priority,sourceFile:i.sourceFile,...i.separator?{separator:i.separator}:{}});return n}ruleParticipates(e,t){return e.matcher?t?this.matcherSatisfied(e.matcher,t):!1:!0}matcherSatisfied(e,t){if(e.kind==="hostFunction"){if(!Object.prototype.hasOwnProperty.call(this.hostFunctions,e.hostFunction))return!1;let s=this.hostFunctions[e.hostFunction];return typeof s!="function"?!1:s(this.host,t)}let n=e.matchKey.includes(".")?(0,a9.resolveKeyPath)(t,e.matchKey,this.createMetadataResolver()):(0,a9.ownProperty)(t,e.matchKey),i=this.extractClassKeys(n);return i.length===0?!1:i.some(s=>e.matchValues.includes(s))}resolveIdentityForms(e){let t=this.extractClassKeys(e);if(t.length===0)return[];let n=new Set(t);for(let i of t){let s=this.vault.resolveLinkpathFrontmatter(i);if(!s)continue;let o=s.exo__Asset_uid,c=s.exo__Asset_label;typeof o=="string"&&o.trim()&&n.add(o.trim()),typeof c=="string"&&c.trim()&&n.add(c.trim())}return[...n]}resolveMatchValues(e){return this.resolveIdentityForms(e)}resolveHostFunctionName(e){let t=e;if(Array.isArray(t)){if(t.length===0)return null;t=t[0]}return typeof t!="string"?null:t.replace(/^\[\[|\]\]$/g,"").replace(/^"|"$/g,"").trim()||null}static declaresComposedSource(e){let t=e;if(Array.isArray(t)){if(t.length===0)return!1;t=t[0]}if(typeof t!="string")return!1;let n=(0,o9.unwrapLinkTarget)(t).replace(/\.md$/,"");return!!Gde.has(n)}createMetadataResolver(){return e=>{let t=(0,o9.unwrapLinkTarget)(e);if(!t)return null;let n=this.vault.resolveLinkpathFrontmatter(t);return n?{...n}:null}}refresh(){this.scanVault()}scheduleRefresh(){this.scanDebounceTimer!==null&&window.clearTimeout(this.scanDebounceTimer),this.scanDebounceTimer=window.setTimeout(()=>{this.scanDebounceTimer=null,this.scanVault()},Yde)}scanVault(){this.rules.clear(),this.classHierarchy.clear();let e=new Map,t=[];for(let n of this.vault.listFrontmatter()){let i=this.cleanClassValue(n.exo__Instance_class);i===Ude||i===Vde?this.collectDisplayNameSpec(n,e):(i===qde||i===Wde||i===Kde||i===zde)&&this.collectDisplayNamePart(n,t);let s=this.cleanClassValue(n.exo__Class_superClass);if(s&&i){let o=this.cleanClassValue(n.exo__Asset_label)||i,c=this.classHierarchy.get(o);c?c.push(s):this.classHierarchy.set(o,[s])}}this.compileDisplayNameSpecs(e,t)}collectDisplayNameSpec(e,t){let n=typeof e.exo__Asset_uid=="string"?e.exo__Asset_uid.trim():"";if(!n)return;let i=this.resolveIdentityForms(e.exo__DisplayNameSpec_appliesToClass);if(i.length===0)return;let s=e.exo__DisplayNameSpec_priority,o=typeof s=="number"?s:typeof s=="string"&&s.trim()!==""?Number(s):0,c=this.resolvePropertyKey(e.exo__DisplayNameSpec_matchPath),l=this.resolveMatchValues(e.exo__DisplayNameSpec_matchValue),u=c!==null&&l.length>0,f=this.resolveHostFunctionName(e.exo__DisplayNameSpec_matchHostFunction),d=e.exo__DisplayNameSpec_separator,p=typeof d=="string"&&d!==""?d:void 0;t.set(n,{uid:n,classKeys:i,priority:Number.isFinite(o)?o:0,...u?{matchKey:c??void 0,matchValues:l}:{},...f?{hostFunction:f}:{},...p?{separator:p}:{}})}collectDisplayNamePart(e,t){let n=this.cleanClassValue(e.exo__DisplayNamePart_of);if(!n)return;let i=e.exo__DisplayNamePart_order,s=typeof i=="number"?i:typeof i=="string"&&i.trim()!==""?Number(i):NaN;if(!Number.isFinite(s))return;let o=this.resolvePropertyKeyList(e.exo__PrintedProperty_property),c=e.exo__PrintedLiteral_literal,l=typeof c=="string"?c:void 0,u=e.exo__PrintedProperty_format,f=typeof u=="string"&&u.trim()!==""?u.trim():void 0,d=r.declaresComposedSource(e.exo__PrintedProperty_valueSource);o?t.push({specUid:n,order:s,propertyKey:o,...f?{format:f}:{},...d?{preferComposed:d}:{}}):l!==void 0&&t.push({specUid:n,order:s,literal:l})}compileDisplayNameSpecs(e,t){let n=new Map;for(let i of t){let s=n.get(i.specUid);s?s.push(i):n.set(i.specUid,[i])}for(let i of e.values()){let s=(n.get(i.uid)??[]).slice().sort((u,f)=>u.order-f.order);if(s.length===0)continue;let o=s.map(u=>{if(!u.propertyKey)return u.literal??"";let f=u.preferComposed?`!${Bde.COMPOSED_SOURCE_MARKER}`:"";return u.format?`{{${u.propertyKey}::${u.format}${f}}}`:`{{${u.propertyKey}${f}}}`}).join(i.separator??"");if(!o.trim())continue;let c=Hde+i.priority,l;i.matchKey&&i.matchValues&&i.matchValues.length>0?l={kind:"value",matchKey:i.matchKey,matchValues:i.matchValues}:i.hostFunction&&(l={kind:"hostFunction",hostFunction:i.hostFunction});for(let u of i.classKeys){if(!u)continue;let f={className:u,template:o,priority:c,sourceFile:i.uid,...l?{matcher:l}:{},...i.separator?{separator:i.separator}:{}},d=this.rules.get(u);d?(d.push(f),d.sort((p,h)=>h.priority-p.priority)):this.rules.set(u,[f])}}}resolvePropertyKey(e){return Array.isArray(e)?e.length===0?null:this.resolveSinglePropertyKey(e[0]):this.resolveSinglePropertyKey(e)}resolvePropertyKeyList(e){return(0,jde.resolvePreferenceList)(e,t=>this.resolveSinglePropertyKey(t))}resolveSinglePropertyKey(e){if(typeof e!="string")return null;let t=e.replace(/^\[\[|\]\]$/g,"").replace(/^"|"$/g,"").trim();if(!t)return null;if(t.includes("|"))return t.split("|").pop()?.trim()||null;let n=t.replace(/\.md$/,"").trim();if(!n)return null;let i=this.vault.resolveLinkpathFrontmatter(n);if(i){let s=i.exo__Asset_label;if(typeof s=="string"&&s.trim())return s.trim()}return n}extractClassKeys(e){let t=e;if(Array.isArray(t)){if(t.length===0)return[];t=t[0]}if(typeof t!="string")return[];let n=t.replace(/^\[\[|\]\]$/g,"").replace(/^"|"$/g,"").trim();if(!n)return[];if(n.includes("|")){let[i,s]=n.split("|");return[i.trim().replace(/\.md$/,""),s.trim()].filter(o=>!!o)}return[n.replace(/\.md$/,"")]}getAncestorClasses(e){let t=[],n=new Set,i=[e];for(;i.length>0;){let s=i.shift();if(!s||n.has(s))continue;n.add(s);let o=this.classHierarchy.get(s);if(o)for(let c of o)n.has(c)||(t.push(c),i.push(c))}return t}cleanClassValue(e){if(!e)return null;if(Array.isArray(e))return e.length===0?null:this.cleanClassValue(e[0]);if(typeof e!="string")return null;let t=e.replace(/^\[\[|\]\]$/g,"").replace(/^"|"$/g,"").trim();return t.includes("|")&&(t=(t.split("|").pop()??t).trim()),t||null}getRulesCount(){let e=0;for(let t of this.rules.values())e+=t.length;return e}};Tw.PrintNameRuleService=u2});var l9=T(Km=>{"use strict";Object.defineProperty(Km,"__esModule",{value:!0});Km.DisplayNameResolver=void 0;Km.createDefaultResolver=rpe;var Qde=vw(),Xde=Wm(),Jde=Sw(),Zde=a2(),epe=3,tpe=new Set(["8619c4fc-64f1-4869-b17e-e34186cacca9","exo__Class","38277bfa-d7f9-4a75-b856-b23276ab0db3","exo__Property","9a1cf31c-9d41-4ef3-9023-584a8d087d16","exo__ObjectProperty","ae56ca4c-b610-42a4-a25d-058c23673296","exo__DatatypeProperty","84756998-3b4e-4989-91cc-a5d5c23664d4","exo__URLProperty"]),Aw=class{static{a(this,"DisplayNameResolver")}constructor(e,t,n){this.settings=e,this.ruleService=t,this.metadataResolver=n,this.nestedDepth=0,this.nestedTargets=new Set}resolve(e){return this.resolveWithProvenance(e).displayName}resolveWithProvenance(e){let{metadata:t,basename:n,createdDate:i}=e,s=this.extractAssetClasses(t),o=this.computeTBoxNamingProjection(s,t);if(o!==null)return{displayName:o,provenance:"tboxProjection"};let{template:c,separator:l,provenance:u}=this.resolveRenderSpec(s,t);return{displayName:new Qde.DisplayNameTemplateEngine(c,{...l?{separator:l}:{},nestedDisplayName:a((d,p)=>this.resolveNestedDisplayName(d,p),"nestedDisplayName")}).render(t,n,i,this.metadataResolver??void 0),provenance:u}}resolveNestedDisplayName(e,t){if(!this.metadataResolver)return null;let n=(0,Jde.unwrapLinkTarget)(e).replace(/\.md$/,"");if(this.nestedDepth>=epe||this.nestedTargets.has(n))return null;let i=t!==void 0?t:this.metadataResolver(e);if(!i)return null;this.nestedDepth+=1,this.nestedTargets.add(n);try{let s=this.resolveWithProvenance({metadata:i,basename:n});return s.provenance!=="spec"&&s.provenance!=="tboxProjection"?null:s.displayName}catch{return null}finally{this.nestedTargets.delete(n),this.nestedDepth-=1}}getTemplateForClasses(e,t){return this.resolveRenderSpec(e,t).template}resolveRenderSpec(e,t){if(this.ruleService&&e.length>0){let s=[],o=new Set;for(let c of e)for(let l of this.ruleService.getParticipatingRules(c,t))o.has(l.sourceFile)||(o.add(l.sourceFile),s.push(l));if(s.length>0)return s.sort((c,l)=>l.priority-c.priority||c.sourceFile.localeCompare(l.sourceFile)),s.length===1?{template:s[0].template,...s[0].separator?{separator:s[0].separator}:{},provenance:"spec"}:{...this.composeTemplates(s),provenance:"spec"}}let n=e[0],i=n?(0,Xde.ownProperty)(this.settings.classTemplates,n):void 0;return typeof i=="string"&&i?{template:i,provenance:"classTemplate"}:{template:this.settings.defaultTemplate,provenance:"default"}}composeTemplates(e){let t=new Set,n=new Set,i=[],s=[],o=null,c,l=a((p,h,g)=>{for(let m of p.trim().split(/\s+/))!m||h.has(m)||(h.add(m),g.push(m))},"collect");for(let p of e){let{prefix:h,core:g,suffix:m}=this.splitTemplate(p.template);o===null&&g!==""&&(o=g,c=p.separator),l(h,t,i),l(m,n,s)}let u=o??"",f=i.map(p=>`${p} `).join(""),d=s.length?` ${s.join(" ")}`:"";return{template:`${f}${u}${d}`,...c?{separator:c}:{}}}splitTemplate(e){let t=e.indexOf("{{"),n=e.lastIndexOf("}}");return t===-1||n===-1||n<t?{prefix:e,core:"",suffix:""}:{prefix:e.slice(0,t),core:e.slice(t,n+2),suffix:e.slice(n+2)}}getTemplateForClass(e,t){return this.getTemplateForClasses(e?[e]:[],t)}extractAssetClasses(e){let t=e.exo__Instance_class;if(!t)return[];let n=Array.isArray(t)?t:[t],i=[],s=new Set;for(let o of n){let c=this.cleanClassValue(o);c&&!s.has(c)&&(s.add(c),i.push(c))}return i}cleanClassValue(e){if(typeof e!="string")return null;let t=e.replace(/^\[\[|\]\]$/g,"").replace(/^"|"$/g,"").trim();return t.includes("|")&&(t=(t.split("|").pop()??t).trim()),t||null}computeTBoxNamingProjection(e,t){if(this.settings.projectTBoxNames===!1||!this.isTBoxNamingEntity(e))return null;if(this.ruleService){for(let u of e)if(this.ruleService.getParticipatingRules(u,t).length>0)return null}let n=typeof t.exo__Asset_label=="string"?t.exo__Asset_label.trim():"",[i,s]=this.splitPrefixedLabel(n),c=(typeof t.exo__Slugable_slug=="string"?t.exo__Slugable_slug.trim():"")||s;if(!c)return null;let l=this.resolveOntologyShortName(t)??i;return l?`${l}#${c}`:c}isTBoxNamingEntity(e){return e.some(t=>tpe.has(t))}resolveOntologyShortName(e){if(!this.metadataResolver)return null;let t=this.firstString(e.exo__Asset_isDefinedBy);if(!t)return null;let i=this.metadataResolver(t)?.exo__Ontology_shortName;return typeof i=="string"&&i.trim()?i.trim():null}splitPrefixedLabel(e){let t=e.indexOf("__");if(t<=0)return[null,null];let n=e.slice(0,t),i=e.slice(t+2);return i?[n,i]:[null,null]}firstString(e){let t=e;if(Array.isArray(t)){if(t.length===0)return null;t=t[0]}return typeof t!="string"?null:t.trim()||null}configuredClassEntries(){return Object.entries(this.settings.classTemplates).filter(e=>typeof e[1]=="string"&&e[1].length>0)}getConfiguredClasses(){return this.configuredClassEntries().map(([e])=>e)}hasClassTemplates(){return this.configuredClassEntries().length>0}};Km.DisplayNameResolver=Aw;async function rpe(){return new Aw(Zde.DEFAULT_DISPLAY_NAME_SETTINGS)}a(rpe,"createDefaultResolver")});var y9=T(Yd=>{"use strict";Object.defineProperty(Yd,"__esModule",{value:!0});Yd.isEffortBlocked=d9;Yd.localToday=p2;Yd.isEpisodeOngoing=g9;Yd.createDisplayMatcherHostFunctions=upe;var u9=jl(),npe=yf(),ipe=10,spe=/^\d{4}-\d{2}-\d{2}$/,ope=/^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2}))?/;function d9(r,e){let t=e.ems__Effort_blocker;if(!t)return!1;let n=p9(String(t)).split("|")[0].trim();if(!n)return!1;let i=r.resolveLinkpathFrontmatter(n);if(!i)return!1;let s=ape(r,i.ems__Effort_status);return s!==u9.EffortStatus.DONE&&s!==u9.EffortStatus.TRASHED}a(d9,"isEffortBlocked");function p9(r){return r.trim().replace(/^["']/,"").replace(/["']$/,"").replace(/^\[\[/,"").replace(/\]\]$/,"").replace(/\.md$/,"").trim()}a(p9,"unwrapWikilink");function ape(r,e){let t=(0,npe.normalizeEffortStatus)(e);if(t!==null)return t;let n=e;if(n==null)return"";if(Array.isArray(n)){if(n.length!==1)return"";n=n[0]}let i=p9(String(n));if(i==="")return"";let s=i.indexOf("|"),o=s===-1?i:i.slice(0,s).trim(),l=r.resolveLinkpathFrontmatter(o)?.exo__Asset_label;return Array.isArray(l)&&(l=l[0]),typeof l=="string"&&l.trim()?l.trim():o}a(ape,"resolveStatusLabel");function p2(r=new Date){let e=r.getFullYear(),t=String(r.getMonth()+1).padStart(2,"0"),n=String(r.getDate()).padStart(2,"0");return`${e}-${t}-${n}`}a(p2,"localToday");function f2(r){let e=r;if(Array.isArray(e)){if(e.length===0)return null;e=e[0]}if(e instanceof Date){if(Number.isNaN(e.getTime()))return null;let c=a(l=>String(l).padStart(2,"0"),"pad");return`${String(e.getUTCFullYear()).padStart(4,"0")}-${c(e.getUTCMonth()+1)}-${c(e.getUTCDate())}`}if(typeof e!="string")return null;let n=h9(e).slice(0,ipe);if(!spe.test(n))return null;let[i,s,o]=n.split("-").map(Number);return m9(i,s,o)?n:null}a(f2,"toDayKey");function h9(r){return r.replace(/^\[\[|\]\]$/g,"").replace(/^"|"$/g,"").trim()}a(h9,"unwrapDateish");function m9(r,e,t){let n=new Date(Date.UTC(r,e-1,t));return n.getUTCFullYear()===r&&n.getUTCMonth()===e-1&&n.getUTCDate()===t}a(m9,"isRealCalendarDay");function d2(r){return r==null||Array.isArray(r)&&r.length===0||String(r).trim()===""}a(d2,"isAbsentValue");function f9(r){let e=r;if(Array.isArray(e)){if(e.length===0)return null;e=e[0]}if(e instanceof Date){if(Number.isNaN(e.getTime()))return null;let f=a(p=>String(p).padStart(2,"0"),"pad");return`${`${String(e.getUTCFullYear()).padStart(4,"0")}-${f(e.getUTCMonth()+1)}-${f(e.getUTCDate())}`}T${f(e.getUTCHours())}:${f(e.getUTCMinutes())}:${f(e.getUTCSeconds())}`}if(typeof e!="string")return null;let t=h9(e),n=ope.exec(t);if(n===null){let f=f2(t);return f===null?null:`${f}T00:00:00`}let[,i,s,o,c,l,u]=n;return!m9(Number(i),Number(s),Number(o))||Number(c)>23||Number(l)>59||Number(u??"0")>59?null:`${i}-${s}-${o}T${c}:${l}:${u??"00"}`}a(f9,"toWallClockKey");function cpe(r){let e=a(t=>String(t).padStart(2,"0"),"pad");return`${p2(r)}T${e(r.getHours())}:${e(r.getMinutes())}:${e(r.getSeconds())}`}a(cpe,"localNowKey");function g9(r,e=new Date){let t=r.life__Episode_startTimestamp;if(!d2(t))return lpe(t,r.life__Episode_endTimestamp,e);let n=f2(r.life__Episode_start);if(n===null)return!1;let i=p2(e);if(n>i)return!1;let s=r.life__Episode_end;if(d2(s))return!0;let o=f2(s);return o===null?!1:o>=i}a(g9,"isEpisodeOngoing");function lpe(r,e,t){let n=f9(r);if(n===null)return!1;let i=cpe(t);if(n>i)return!1;if(d2(e))return!0;let s=f9(e);return s===null?!1:s>=i}a(lpe,"isInstantPeriodOngoing");function upe(r){return{isEffortBlocked:a((e,t)=>d9(r,t),"isEffortBlocked"),isEpisodeOngoing:a((e,t)=>g9(t),"isEpisodeOngoing")}}a(upe,"createDisplayMatcherHostFunctions")});var Pe=T(y=>{"use strict";var fpe=y&&y.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:a(function(){return e[t]},"get")}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),pi=y&&y.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&fpe(e,r,t)};Object.defineProperty(y,"__esModule",{value:!0});y.CommandResolver=y.extractPropertyLabel=y.uriToPropertyName=y.propertyNameToUri=y.rangeToFieldType=y.PropertyFieldType=y.ParkedAssetIndex=y.resolveDependencyKind=y.parkedPathFor=y.classifyMountTransition=y.PARKED_ROOT=y.DEPENDENCY_KIND_REFERENCE_UID=y.DEPENDENCY_KIND_TBOX_UID=y.transitiveDependsOnClosure=y.isTsFloorMountPath=y.isTsFloorAssetSpace=y.assertTsFloorReconciled=y.assertTsFloor=y.TsFloorViolationError=y.CATALOG_KEEP_NAMESPACES=y.PLUGIN_UI_FLOOR=y.SDK_FLOOR=y.PLUGIN_UI_FLOOR_ASSETSPACE_UIDS=y.SDK_FLOOR_ASSETSPACE_UIDS=y.TS_FLOOR_AS_UID_SHARED_IDENTITIES=y.TS_FLOOR_AS_UID_EXOCMD=y.TS_FLOOR_AS_UID_EXO=y.parseGroundingDefinitionFromFrontmatter=y.isCommandBindingFrontmatter=y.isGroundingFrontmatter=y.isPreconditionFrontmatter=y.isCommandFrontmatter=y.isStyleSource=y.isLabelClass=y.isCommandVariant=y.STYLE_SOURCE_VALUES=y.LABEL_CLASS_VALUES=y.COMMAND_VARIANT_VALUES=y.CommandBindingStyleProperty=y.CommandBindingProperty=y.GroundingProperty=y.PreconditionProperty=y.CommandProperty=y.resolveGroundingTypeFromWikilinkLiteral=y.resolveGroundingTypeFromIRI=y.GROUNDING_TYPE_IRI_TO_ENUM=y.GROUNDING_TYPE_UID_TO_ENUM=y.GROUNDING_TYPE_UIDS=y.GroundingType=y.EFFORT_STATUS_OPTIONS=void 0;y.orderProperties=y.loadDefaultSpec=y.clearOrderSpecLoader=y.registerOrderSpecLoader=y.StatusTimestampService=y.RenameToUidService=y.PropertyCleanupService=y.LoggingService=y.extractAssetReference=y.FolderRepairService=y.WorkflowCommandAdapter=y.VisibilityGenerator=y.InstantiationRuleResolver=y.stripTemplateFrontmatter=y.resolveTemplateBody=y.getRegisteredResolverIds=y.clearResolvers=y.registerResolver=y.getResolver=y.installDefaultResolvers=y.WorkflowResolver=y.WorkflowEngine=y.EffortStatusWorkflow=y.ClassCreationService=y.AreaHierarchyBuilder=y.TaskStatusService=y.createTripleStoreDeclaredRanges=y.createTripleStoreClassPropertyResolver=y.createTripleStoreRequiredPropertyResolver=y.CommandExecutionFlow=y.stripFrontmatter=y.extractSparqlBlock=y.labelTermBearers=y.iriToObsidianName=y.findUnsetQueryTokens=y.UnsetQueryTokenError=y.NamedQueryRunner=y.createVaultFrontmatterRefToFrontmatterResolver=y.createVaultFrontmatterRefToFolderResolver=y.createVaultFrontmatterClassLabelResolver=y.missingRequiredInputError=y.findInputSchemaViolation=y.findMissingInput=y.missingInputError=y.ServiceRegistry=y.GroundingExecutor=y.registerDefaultHostFunctions=y.hasUidFilename=y.hasNonUidFilename=y.PreconditionEvaluator=void 0;y.deriveLegacyFlatPath=y.deriveUrl=y.derivePath=y.IRICanonicalizer=y.INFERRED_GRAPH=y.PrototypeChainMaterializer=y.PropertyCardinalityRegistry=y.NonInheritablePropertyRegistry=y.RDFSInferenceEngine=y.RDFVocabularyMapper=y.DomainTriple=y.DomainBlankNode=y.DomainLiteral=y.DomainIRI=y.InMemoryTripleStore=y.OBSIDIAN_VAULT_SCHEME=y.iriToVaultPath=y.vaultPathToIRI=y.NullLogger=y.RDFSerializer=y.FilenameValidator=y.EffortSortingHelpers=y.MetadataExtractor=y.MetadataHelpers=y.extractClassRefTarget=y.instanceClassMatches=y.resolveSubsumedClassKeys=y.WikiLinkHelpers=y.DateFormatter=y.leadingBomLength=y.frontmatterBlockBody=y.matchFrontmatterBlock=y.parseYamlFrontmatterTolerant=y.STRING_SCALAR_PROPERTIES=y.emptyPropertyValueForm=y.isEmptyPropertyValue=y.isUnquotedWikilink=y.scalarTypingForRange=y.serializeYamlScalar=y.quoteYamlString=y.FrontmatterService=y.SPARQL_PREFIXES=y.TypeRegistry=y.GraphQueryService=y.FixMissingLabelService=y.ArchiveAssetService=y.GenericAssetCreationService=y.EnumValueResolver=y.ClassHierarchyResolver=y.PropertySchemaResolver=void 0;y.QueryPlanCache=y.createDoubleLiteral=y.createDecimalLiteral=y.getNumericValue=y.createPercentileAggregate=y.modeAggregate=y.stddevAggregate=y.varianceAggregate=y.medianAggregate=y.EXO_AGGREGATE_NS=y.BUILT_IN_AGGREGATES=y.CustomAggregateError=y.CustomAggregateRegistry=y.AggregateFunctions=y.BuiltInFunctions=y.SolutionMapping=y.UpdateExecutorError=y.UpdateExecutor=y.QueryExecutor=y.ExoQLQueryExecutor=y.DescribeExecutor=y.ConstructExecutor=y.UnionExecutor=y.OptionalExecutor=y.FilterExecutor=y.BGPExecutor=y.AlgebraSerializer=y.AlgebraOptimizer=y.AlgebraTranslator=y.ExoQLAlgebraTranslator=y.DescribeOptionsTransformerError=y.DescribeOptionsTransformer=y.SPARQLParseError=y.SPARQLParser=y.ExoQLParser=y.isPosixBracketExpression=y.canonicalYamlKey=y.LEGACY_YAML_KEYS=y.LEGACY_UNPREFIXED_ASSET_FIELDS=y.UNPREFIXED_ASSET_FIELDS=y.isPathExcluded=y.normaliseExcludedFolders=y.NoteToRDFConverter=y.SOURCE_VARIABLE=y.SourceAnnotator=y.MAX_LAZY_DEPTH=y.LazyAssetGraphLoader=y.FILE_SPACE_CLASS_UID=y.frontmatterDeclaresFileSpace=y.discoverFileSpaceExclusions=void 0;y.PROPERTIES_BLOCK_CLASS_UID=y.PROPERTIES_BLOCK_CLASS_IRI=y.DAILY_EFFORTS_BY_CLASS_BLOCK_CLASS_UID=y.DAILY_EFFORTS_BY_CLASS_BLOCK_CLASS_IRI=y.BACKLINKS_TABLE_BLOCK_CLASS_UID=y.BACKLINKS_TABLE_BLOCK_CLASS_IRI=y.isLayoutFrontmatter=y.isLayout=y.createLayoutFromFrontmatter=y.LAYOUT_CLASS_UID=y.LAYOUT_CLASS_IRI=y.ExoQLError=y.ExoQL=y.createStreamingSource=y.StreamingLoader=y.resetGlobalPool=y.getGlobalPool=y.MemoryPool=y.CompactGraphStore=y.StringTable=y.DEFAULT_COLORS=y.NODE_FLAGS=y.container=y.resetContainer=y.getContainer=y.createChildContainer=y.registerCoreServices=y.DI_TOKENS=y.DEFAULT_FLEETING_NOTE_CLASS_UID=y.DEFAULT_INBOX_FOLDER=y.DEFAULT_OWNER_IDENTITY=y.VaultSettings=y.seededUidGenerator=y.liveUidGenerator=y.frozenClock=y.liveClock=y.TransactionError=y.TripleNotFoundError=y.TripleAlreadyExistsError=y.FileAlreadyExistsError=y.FileNotFoundError=y.FilterContainsOptimizer=y.VaultPrefixTransformer=y.CaseWhenTransformerError=y.CaseWhenTransformer=y.ResultSerializer=y.createIncrementalIndexer=y.IncrementalIndexer=y.createSPARQLResultCache=y.SPARQLResultCache=void 0;y.withImmutableObjectCache=y.parseImmutableObjectUrl=y.ImmutableObjectCache=y.withConditionalRequests=y.conditionalCacheKey=y.ConditionalRequestCache=y.CONDITIONAL_STORE_FILENAME=y.gitBlobSha=y.promiseWithDeadline=y.extractAssetUid=y.detectChanges=y.MATERIALIZE_PROGRESS_MIN_FILES=y.MATERIALIZE_PROGRESS_INTERVAL=y.escapeGitmodulesRegex=y.stripGitmodulesEntry=y.appendGitmodulesEntry=y.extractAssetSpaceSha=y.discoverAssetSpaceWrapperDir=y.mountAssetSpaceFiles=y.isBinaryPayload=y.restCreateCommit=y.parseTarballGzip=y.parseTarball=y.ShaclShapeRegistry=y.shaclValidate=y.Namespace=y.ShapeRegistry=y.ShapeLoader=y.selectByPriority=y.LayoutSelector=y.partitionDailyEffortsByClass=y.EMS_PROJECT_CLASS_UID=y.classListMatches=y.EMS_ACTION_CLASS_UID=y.resolveDailyEffortVisibility=y.resolveBlockVisibility=y.coerceVisibilityOverride=y.DAILY_EFFORTS_OVERRIDE_KEYS=y.BUILTIN_DAILY_EFFORTS_VISIBILITY=y.assembleLayoutBlocks=y.QUERY_TABLE_BLOCK_DEFAULT_LIMIT=y.QUERY_TABLE_BLOCK_DEFAULT_EMPTY_TEXT=y.QUERY_TABLE_BLOCK_CLASS_UID=y.QUERY_TABLE_BLOCK_CLASS_IRI=y.isQueryTableBlock=y.isPropertiesBlock=y.isLayoutBlockFrontmatter=y.isDailyEffortsByClassBlock=y.isBacklinksTableBlock=y.createLayoutBlockFromFrontmatter=void 0;y.MIN_RATE_LIMIT_WAIT_MS=y.createRateLimitBudget=y.withRateLimitBackoff=y.isRateLimitError=y.isAuthError=y.MOUNT_BASE_STORE_FILENAME=y.FileMountBaseStore=y.WATERMARK_STORE_FILENAME=y.FileWatermarkStore=y.GatedStructuredMerger=y.MergeShaclGate=y.splitSections=y.StructuredMerger=y.diff3=y.LOCAL_MANIFEST_STORE_FILENAME=y.FileLocalManifestStore=y.isSyncablePath=y.isFileSpaceSyncablePath=y.contentEquals=y.InMemoryQuarantineStore=y.DEFAULT_MAX_FILE_BYTES=y.backupPathFor=y.QuarantineResolver=y.formatQuota=y.formatRepoTimings=y.formatTimingsLine=y.fmtMs=y.dominantPhase=y.totalMs=y.aggregateTimings=y.addTimings=y.emptyTimings=y.classifyRestPhase=y.SYNC_PHASES=y.SyncPhaseTimer=y.syncProgressPhaseText=y.orderChildrenFirst=y.isNonFastForwardError=y.SyncEngine=y.DEFAULT_LOCAL_MANIFEST_REHASH_MS=y.DEFAULT_MAX_PUSH_RETRIES=y.checkParkedStaleness=y.getTree=y.getHeadSha=y.getCommitInfo=y.getBlobText=y.getBlobBytes=y.planDuplicateUidFix=y.findDuplicateUidGroups=y.rewriteAssetUid=void 0;y.createDisplayMatcherHostFunctions=y.localToday=y.isEpisodeOngoing=y.isEffortBlocked=y.isWikilink=y.resolveKeyPath=y.DEFAULT_DISPLAY_NAME_TEMPLATE=y.DISPLAY_NAME_PRESETS=y.DisplayNameTemplateEngine=y.createDefaultResolver=y.DisplayNameResolver=y.PrintNameRuleService=y.DEFAULT_DISPLAY_NAME_SETTINGS=y.normalizeEffortStatus=y.EFFORT_STATUS_BY_UID=y.EFFORT_STATUS_UID=y.unwrapLinkTarget=y.resolvePreferenceList=y.isFormatOnlyDrift=y.compareAssetSemantics=y.summarizeParityRound=y.ParityValidator=y.deriveAssetSpaceNamespace=y.buildAssetSpaceDescriptor=y.readSpaceSource=y.parseStrictGitHubRepoURL=y.parsePullOnlyList=y.isFileSpaceFrontmatter=y.isAssetSpaceFrontmatter=y.classifySpaceDeclaration=y.applyPullOnlyListText=y.SpaceSpecAccumulator=y.SYNC_BRANCH=y.PullOnlyListError=y.PULL_ONLY_LIST_PATH=y.ASSET_SPACE_CLASS_UID=y.OUTBOX_REMOTE_ABSENT=y.OUTBOX_STORE_FILENAME=y.LocalOutboxStore=y.CONFLICT_CACHE_STORE_FILENAME=y.LocalConflictCacheStore=y.scanForSecrets=y.redactSecrets=y.enrichRateLimitError=y.attachRateLimitFields=y.getRateLimitFields=y.extractRateLimitFields=y.parseRetryAfterMs=y.caseInsensitiveHeaderGetter=y.DEFAULT_MAX_RETRIES=void 0;pi($l(),y);pi(jl(),y);var dpe=ST();Object.defineProperty(y,"EFFORT_STATUS_OPTIONS",{enumerable:!0,get:a(function(){return dpe.EFFORT_STATUS_OPTIONS},"get")});var ppe=wc();Object.defineProperty(y,"GroundingType",{enumerable:!0,get:a(function(){return ppe.GroundingType},"get")});var zm=dh();Object.defineProperty(y,"GROUNDING_TYPE_UIDS",{enumerable:!0,get:a(function(){return zm.GROUNDING_TYPE_UIDS},"get")});Object.defineProperty(y,"GROUNDING_TYPE_UID_TO_ENUM",{enumerable:!0,get:a(function(){return zm.GROUNDING_TYPE_UID_TO_ENUM},"get")});Object.defineProperty(y,"GROUNDING_TYPE_IRI_TO_ENUM",{enumerable:!0,get:a(function(){return zm.GROUNDING_TYPE_IRI_TO_ENUM},"get")});Object.defineProperty(y,"resolveGroundingTypeFromIRI",{enumerable:!0,get:a(function(){return zm.resolveGroundingTypeFromIRI},"get")});Object.defineProperty(y,"resolveGroundingTypeFromWikilinkLiteral",{enumerable:!0,get:a(function(){return zm.resolveGroundingTypeFromWikilinkLiteral},"get")});var Hm=wT();Object.defineProperty(y,"CommandProperty",{enumerable:!0,get:a(function(){return Hm.CommandProperty},"get")});Object.defineProperty(y,"PreconditionProperty",{enumerable:!0,get:a(function(){return Hm.PreconditionProperty},"get")});Object.defineProperty(y,"GroundingProperty",{enumerable:!0,get:a(function(){return Hm.GroundingProperty},"get")});Object.defineProperty(y,"CommandBindingProperty",{enumerable:!0,get:a(function(){return Hm.CommandBindingProperty},"get")});Object.defineProperty(y,"CommandBindingStyleProperty",{enumerable:!0,get:a(function(){return Hm.CommandBindingStyleProperty},"get")});var Qd=ET();Object.defineProperty(y,"COMMAND_VARIANT_VALUES",{enumerable:!0,get:a(function(){return Qd.COMMAND_VARIANT_VALUES},"get")});Object.defineProperty(y,"LABEL_CLASS_VALUES",{enumerable:!0,get:a(function(){return Qd.LABEL_CLASS_VALUES},"get")});Object.defineProperty(y,"STYLE_SOURCE_VALUES",{enumerable:!0,get:a(function(){return Qd.STYLE_SOURCE_VALUES},"get")});Object.defineProperty(y,"isCommandVariant",{enumerable:!0,get:a(function(){return Qd.isCommandVariant},"get")});Object.defineProperty(y,"isLabelClass",{enumerable:!0,get:a(function(){return Qd.isLabelClass},"get")});Object.defineProperty(y,"isStyleSource",{enumerable:!0,get:a(function(){return Qd.isStyleSource},"get")});var Iw=zD();Object.defineProperty(y,"isCommandFrontmatter",{enumerable:!0,get:a(function(){return Iw.isCommandFrontmatter},"get")});Object.defineProperty(y,"isPreconditionFrontmatter",{enumerable:!0,get:a(function(){return Iw.isPreconditionFrontmatter},"get")});Object.defineProperty(y,"isGroundingFrontmatter",{enumerable:!0,get:a(function(){return Iw.isGroundingFrontmatter},"get")});Object.defineProperty(y,"isCommandBindingFrontmatter",{enumerable:!0,get:a(function(){return Iw.isCommandBindingFrontmatter},"get")});var hpe=HD();Object.defineProperty(y,"parseGroundingDefinitionFromFrontmatter",{enumerable:!0,get:a(function(){return hpe.parseGroundingDefinitionFromFrontmatter},"get")});pi(YD(),y);pi(QD(),y);pi(TT(),y);pi(AT(),y);pi(JD(),y);pi(tN(),y);pi(o1(),y);pi(DN(),y);var Zi=NN();Object.defineProperty(y,"TS_FLOOR_AS_UID_EXO",{enumerable:!0,get:a(function(){return Zi.TS_FLOOR_AS_UID_EXO},"get")});Object.defineProperty(y,"TS_FLOOR_AS_UID_EXOCMD",{enumerable:!0,get:a(function(){return Zi.TS_FLOOR_AS_UID_EXOCMD},"get")});Object.defineProperty(y,"TS_FLOOR_AS_UID_SHARED_IDENTITIES",{enumerable:!0,get:a(function(){return Zi.TS_FLOOR_AS_UID_SHARED_IDENTITIES},"get")});Object.defineProperty(y,"SDK_FLOOR_ASSETSPACE_UIDS",{enumerable:!0,get:a(function(){return Zi.SDK_FLOOR_ASSETSPACE_UIDS},"get")});Object.defineProperty(y,"PLUGIN_UI_FLOOR_ASSETSPACE_UIDS",{enumerable:!0,get:a(function(){return Zi.PLUGIN_UI_FLOOR_ASSETSPACE_UIDS},"get")});Object.defineProperty(y,"SDK_FLOOR",{enumerable:!0,get:a(function(){return Zi.SDK_FLOOR},"get")});Object.defineProperty(y,"PLUGIN_UI_FLOOR",{enumerable:!0,get:a(function(){return Zi.PLUGIN_UI_FLOOR},"get")});Object.defineProperty(y,"CATALOG_KEEP_NAMESPACES",{enumerable:!0,get:a(function(){return Zi.CATALOG_KEEP_NAMESPACES},"get")});Object.defineProperty(y,"TsFloorViolationError",{enumerable:!0,get:a(function(){return Zi.TsFloorViolationError},"get")});Object.defineProperty(y,"assertTsFloor",{enumerable:!0,get:a(function(){return Zi.assertTsFloor},"get")});Object.defineProperty(y,"assertTsFloorReconciled",{enumerable:!0,get:a(function(){return Zi.assertTsFloorReconciled},"get")});Object.defineProperty(y,"isTsFloorAssetSpace",{enumerable:!0,get:a(function(){return Zi.isTsFloorAssetSpace},"get")});Object.defineProperty(y,"isTsFloorMountPath",{enumerable:!0,get:a(function(){return Zi.isTsFloorMountPath},"get")});var mpe=kN();Object.defineProperty(y,"transitiveDependsOnClosure",{enumerable:!0,get:a(function(){return mpe.transitiveDependsOnClosure},"get")});var Xd=u1();Object.defineProperty(y,"DEPENDENCY_KIND_TBOX_UID",{enumerable:!0,get:a(function(){return Xd.DEPENDENCY_KIND_TBOX_UID},"get")});Object.defineProperty(y,"DEPENDENCY_KIND_REFERENCE_UID",{enumerable:!0,get:a(function(){return Xd.DEPENDENCY_KIND_REFERENCE_UID},"get")});Object.defineProperty(y,"PARKED_ROOT",{enumerable:!0,get:a(function(){return Xd.PARKED_ROOT},"get")});Object.defineProperty(y,"classifyMountTransition",{enumerable:!0,get:a(function(){return Xd.classifyMountTransition},"get")});Object.defineProperty(y,"parkedPathFor",{enumerable:!0,get:a(function(){return Xd.parkedPathFor},"get")});Object.defineProperty(y,"resolveDependencyKind",{enumerable:!0,get:a(function(){return Xd.resolveDependencyKind},"get")});var gpe=UN();Object.defineProperty(y,"ParkedAssetIndex",{enumerable:!0,get:a(function(){return gpe.ParkedAssetIndex},"get")});var _9=u0();Object.defineProperty(y,"PropertyFieldType",{enumerable:!0,get:a(function(){return _9.PropertyFieldType},"get")});Object.defineProperty(y,"rangeToFieldType",{enumerable:!0,get:a(function(){return _9.rangeToFieldType},"get")});var h2=h1();Object.defineProperty(y,"propertyNameToUri",{enumerable:!0,get:a(function(){return h2.propertyNameToUri},"get")});Object.defineProperty(y,"uriToPropertyName",{enumerable:!0,get:a(function(){return h2.uriToPropertyName},"get")});Object.defineProperty(y,"extractPropertyLabel",{enumerable:!0,get:a(function(){return h2.extractPropertyLabel},"get")});var ype=g$();Object.defineProperty(y,"CommandResolver",{enumerable:!0,get:a(function(){return ype.CommandResolver},"get")});var _pe=b$();Object.defineProperty(y,"PreconditionEvaluator",{enumerable:!0,get:a(function(){return _pe.PreconditionEvaluator},"get")});var m2=S$();Object.defineProperty(y,"hasNonUidFilename",{enumerable:!0,get:a(function(){return m2.hasNonUidFilename},"get")});Object.defineProperty(y,"hasUidFilename",{enumerable:!0,get:a(function(){return m2.hasUidFilename},"get")});Object.defineProperty(y,"registerDefaultHostFunctions",{enumerable:!0,get:a(function(){return m2.registerDefaultHostFunctions},"get")});var Jd=K$();Object.defineProperty(y,"GroundingExecutor",{enumerable:!0,get:a(function(){return Jd.GroundingExecutor},"get")});Object.defineProperty(y,"ServiceRegistry",{enumerable:!0,get:a(function(){return Jd.ServiceRegistry},"get")});Object.defineProperty(y,"missingInputError",{enumerable:!0,get:a(function(){return Jd.missingInputError},"get")});Object.defineProperty(y,"findMissingInput",{enumerable:!0,get:a(function(){return Jd.findMissingInput},"get")});Object.defineProperty(y,"findInputSchemaViolation",{enumerable:!0,get:a(function(){return Jd.findInputSchemaViolation},"get")});Object.defineProperty(y,"missingRequiredInputError",{enumerable:!0,get:a(function(){return Jd.missingRequiredInputError},"get")});var bpe=z$();Object.defineProperty(y,"createVaultFrontmatterClassLabelResolver",{enumerable:!0,get:a(function(){return bpe.createVaultFrontmatterClassLabelResolver},"get")});var Spe=H$();Object.defineProperty(y,"createVaultFrontmatterRefToFolderResolver",{enumerable:!0,get:a(function(){return Spe.createVaultFrontmatterRefToFolderResolver},"get")});var wpe=Y$();Object.defineProperty(y,"createVaultFrontmatterRefToFrontmatterResolver",{enumerable:!0,get:a(function(){return wpe.createVaultFrontmatterRefToFrontmatterResolver},"get")});pi(oj(),y);var b9=cj();Object.defineProperty(y,"NamedQueryRunner",{enumerable:!0,get:a(function(){return b9.NamedQueryRunner},"get")});Object.defineProperty(y,"UnsetQueryTokenError",{enumerable:!0,get:a(function(){return b9.UnsetQueryTokenError},"get")});var Epe=xR();Object.defineProperty(y,"findUnsetQueryTokens",{enumerable:!0,get:a(function(){return Epe.findUnsetQueryTokens},"get")});var vpe=Ic();Object.defineProperty(y,"iriToObsidianName",{enumerable:!0,get:a(function(){return vpe.iriToObsidianName},"get")});var Tpe=H0();Object.defineProperty(y,"labelTermBearers",{enumerable:!0,get:a(function(){return Tpe.labelTermBearers},"get")});var S9=lj();Object.defineProperty(y,"extractSparqlBlock",{enumerable:!0,get:a(function(){return S9.extractSparqlBlock},"get")});Object.defineProperty(y,"stripFrontmatter",{enumerable:!0,get:a(function(){return S9.stripFrontmatter},"get")});var Ape=fj();Object.defineProperty(y,"CommandExecutionFlow",{enumerable:!0,get:a(function(){return Ape.CommandExecutionFlow},"get")});var w9=yj();Object.defineProperty(y,"createTripleStoreRequiredPropertyResolver",{enumerable:!0,get:a(function(){return w9.createTripleStoreRequiredPropertyResolver},"get")});Object.defineProperty(y,"createTripleStoreClassPropertyResolver",{enumerable:!0,get:a(function(){return w9.createTripleStoreClassPropertyResolver},"get")});var Ipe=Sj();Object.defineProperty(y,"createTripleStoreDeclaredRanges",{enumerable:!0,get:a(function(){return Ipe.createTripleStoreDeclaredRanges},"get")});var Rpe=JR();Object.defineProperty(y,"TaskStatusService",{enumerable:!0,get:a(function(){return Rpe.TaskStatusService},"get")});var Cpe=eC();Object.defineProperty(y,"AreaHierarchyBuilder",{enumerable:!0,get:a(function(){return Cpe.AreaHierarchyBuilder},"get")});var Ope=sC();Object.defineProperty(y,"ClassCreationService",{enumerable:!0,get:a(function(){return Ope.ClassCreationService},"get")});var xpe=Hb();Object.defineProperty(y,"EffortStatusWorkflow",{enumerable:!0,get:a(function(){return xpe.EffortStatusWorkflow},"get")});var Ppe=lm();Object.defineProperty(y,"WorkflowEngine",{enumerable:!0,get:a(function(){return Ppe.WorkflowEngine},"get")});var Fpe=BR();Object.defineProperty(y,"WorkflowResolver",{enumerable:!0,get:a(function(){return Fpe.WorkflowResolver},"get")});var Ym=pb();Object.defineProperty(y,"installDefaultResolvers",{enumerable:!0,get:a(function(){return Ym.installDefaultResolvers},"get")});Object.defineProperty(y,"getResolver",{enumerable:!0,get:a(function(){return Ym.getResolver},"get")});Object.defineProperty(y,"registerResolver",{enumerable:!0,get:a(function(){return Ym.registerResolver},"get")});Object.defineProperty(y,"clearResolvers",{enumerable:!0,get:a(function(){return Ym.clearResolvers},"get")});Object.defineProperty(y,"getRegisteredResolverIds",{enumerable:!0,get:a(function(){return Ym.getRegisteredResolverIds},"get")});var E9=JI();Object.defineProperty(y,"resolveTemplateBody",{enumerable:!0,get:a(function(){return E9.resolveTemplateBody},"get")});Object.defineProperty(y,"stripTemplateFrontmatter",{enumerable:!0,get:a(function(){return E9.stripTemplateFrontmatter},"get")});var Lpe=Lj();Object.defineProperty(y,"InstantiationRuleResolver",{enumerable:!0,get:a(function(){return Lpe.InstantiationRuleResolver},"get")});var Dpe=Dj();Object.defineProperty(y,"VisibilityGenerator",{enumerable:!0,get:a(function(){return Dpe.VisibilityGenerator},"get")});var Npe=Nj();Object.defineProperty(y,"WorkflowCommandAdapter",{enumerable:!0,get:a(function(){return Npe.WorkflowCommandAdapter},"get")});var kpe=Xb();Object.defineProperty(y,"FolderRepairService",{enumerable:!0,get:a(function(){return kpe.FolderRepairService},"get")});var Mpe=hu();Object.defineProperty(y,"extractAssetReference",{enumerable:!0,get:a(function(){return Mpe.extractAssetReference},"get")});var $pe=Ia();Object.defineProperty(y,"LoggingService",{enumerable:!0,get:a(function(){return $pe.LoggingService},"get")});var jpe=pC();Object.defineProperty(y,"PropertyCleanupService",{enumerable:!0,get:a(function(){return jpe.PropertyCleanupService},"get")});var Bpe=mC();Object.defineProperty(y,"RenameToUidService",{enumerable:!0,get:a(function(){return Bpe.RenameToUidService},"get")});var Upe=Yb();Object.defineProperty(y,"StatusTimestampService",{enumerable:!0,get:a(function(){return Upe.StatusTimestampService},"get")});var Rw=yb();Object.defineProperty(y,"registerOrderSpecLoader",{enumerable:!0,get:a(function(){return Rw.registerOrderSpecLoader},"get")});Object.defineProperty(y,"clearOrderSpecLoader",{enumerable:!0,get:a(function(){return Rw.clearOrderSpecLoader},"get")});Object.defineProperty(y,"loadDefaultSpec",{enumerable:!0,get:a(function(){return Rw.loadDefaultSpec},"get")});Object.defineProperty(y,"orderProperties",{enumerable:!0,get:a(function(){return Rw.orderProperties},"get")});var Vpe=Vj();Object.defineProperty(y,"PropertySchemaResolver",{enumerable:!0,get:a(function(){return Vpe.PropertySchemaResolver},"get")});var Gpe=qj();Object.defineProperty(y,"ClassHierarchyResolver",{enumerable:!0,get:a(function(){return Gpe.ClassHierarchyResolver},"get")});var qpe=Wj();Object.defineProperty(y,"EnumValueResolver",{enumerable:!0,get:a(function(){return qpe.EnumValueResolver},"get")});var Wpe=wC();Object.defineProperty(y,"GenericAssetCreationService",{enumerable:!0,get:a(function(){return Wpe.GenericAssetCreationService},"get")});var Kpe=Yj();Object.defineProperty(y,"ArchiveAssetService",{enumerable:!0,get:a(function(){return Kpe.ArchiveAssetService},"get")});var zpe=Xj();Object.defineProperty(y,"FixMissingLabelService",{enumerable:!0,get:a(function(){return zpe.FixMissingLabelService},"get")});var Hpe=Jj();Object.defineProperty(y,"GraphQueryService",{enumerable:!0,get:a(function(){return Hpe.GraphQueryService},"get")});var Ype=e4();Object.defineProperty(y,"TypeRegistry",{enumerable:!0,get:a(function(){return Ype.TypeRegistry},"get")});var Qpe=t4();Object.defineProperty(y,"SPARQL_PREFIXES",{enumerable:!0,get:a(function(){return Qpe.SPARQL_PREFIXES},"get")});var Xpe=pu();Object.defineProperty(y,"FrontmatterService",{enumerable:!0,get:a(function(){return Xpe.FrontmatterService},"get")});var Cu=Ac();Object.defineProperty(y,"quoteYamlString",{enumerable:!0,get:a(function(){return Cu.quoteYamlString},"get")});Object.defineProperty(y,"serializeYamlScalar",{enumerable:!0,get:a(function(){return Cu.serializeYamlScalar},"get")});Object.defineProperty(y,"scalarTypingForRange",{enumerable:!0,get:a(function(){return Cu.scalarTypingForRange},"get")});Object.defineProperty(y,"isUnquotedWikilink",{enumerable:!0,get:a(function(){return Cu.isUnquotedWikilink},"get")});Object.defineProperty(y,"isEmptyPropertyValue",{enumerable:!0,get:a(function(){return Cu.isEmptyPropertyValue},"get")});Object.defineProperty(y,"emptyPropertyValueForm",{enumerable:!0,get:a(function(){return Cu.emptyPropertyValueForm},"get")});Object.defineProperty(y,"STRING_SCALAR_PROPERTIES",{enumerable:!0,get:a(function(){return Cu.STRING_SCALAR_PROPERTIES},"get")});var Jpe=wR();Object.defineProperty(y,"parseYamlFrontmatterTolerant",{enumerable:!0,get:a(function(){return Jpe.parseYamlFrontmatterTolerant},"get")});var g2=fd();Object.defineProperty(y,"matchFrontmatterBlock",{enumerable:!0,get:a(function(){return g2.matchFrontmatterBlock},"get")});Object.defineProperty(y,"frontmatterBlockBody",{enumerable:!0,get:a(function(){return g2.frontmatterBlockBody},"get")});Object.defineProperty(y,"leadingBomLength",{enumerable:!0,get:a(function(){return g2.leadingBomLength},"get")});var Zpe=Lo();Object.defineProperty(y,"DateFormatter",{enumerable:!0,get:a(function(){return Zpe.DateFormatter},"get")});var ehe=ga();Object.defineProperty(y,"WikiLinkHelpers",{enumerable:!0,get:a(function(){return ehe.WikiLinkHelpers},"get")});var y2=r4();Object.defineProperty(y,"resolveSubsumedClassKeys",{enumerable:!0,get:a(function(){return y2.resolveSubsumedClassKeys},"get")});Object.defineProperty(y,"instanceClassMatches",{enumerable:!0,get:a(function(){return y2.instanceClassMatches},"get")});Object.defineProperty(y,"extractClassRefTarget",{enumerable:!0,get:a(function(){return y2.extractClassRefTarget},"get")});var the=Mc();Object.defineProperty(y,"MetadataHelpers",{enumerable:!0,get:a(function(){return the.MetadataHelpers},"get")});var rhe=n4();Object.defineProperty(y,"MetadataExtractor",{enumerable:!0,get:a(function(){return rhe.MetadataExtractor},"get")});var nhe=i4();Object.defineProperty(y,"EffortSortingHelpers",{enumerable:!0,get:a(function(){return nhe.EffortSortingHelpers},"get")});var ihe=s4();Object.defineProperty(y,"FilenameValidator",{enumerable:!0,get:a(function(){return ihe.FilenameValidator},"get")});var she=d4();Object.defineProperty(y,"RDFSerializer",{enumerable:!0,get:a(function(){return she.RDFSerializer},"get")});var ohe=Ph();Object.defineProperty(y,"NullLogger",{enumerable:!0,get:a(function(){return ohe.NullLogger},"get")});var _2=Sb();Object.defineProperty(y,"vaultPathToIRI",{enumerable:!0,get:a(function(){return _2.vaultPathToIRI},"get")});Object.defineProperty(y,"iriToVaultPath",{enumerable:!0,get:a(function(){return _2.iriToVaultPath},"get")});Object.defineProperty(y,"OBSIDIAN_VAULT_SCHEME",{enumerable:!0,get:a(function(){return _2.OBSIDIAN_VAULT_SCHEME},"get")});var ahe=HR();Object.defineProperty(y,"InMemoryTripleStore",{enumerable:!0,get:a(function(){return ahe.InMemoryTripleStore},"get")});var che=Me();Object.defineProperty(y,"DomainIRI",{enumerable:!0,get:a(function(){return che.IRI},"get")});var lhe=Ye();Object.defineProperty(y,"DomainLiteral",{enumerable:!0,get:a(function(){return lhe.Literal},"get")});var uhe=lr();Object.defineProperty(y,"DomainBlankNode",{enumerable:!0,get:a(function(){return uhe.BlankNode},"get")});var fhe=oi();Object.defineProperty(y,"DomainTriple",{enumerable:!0,get:a(function(){return fhe.Triple},"get")});var dhe=eR();Object.defineProperty(y,"RDFVocabularyMapper",{enumerable:!0,get:a(function(){return dhe.RDFVocabularyMapper},"get")});var phe=p4();Object.defineProperty(y,"RDFSInferenceEngine",{enumerable:!0,get:a(function(){return phe.RDFSInferenceEngine},"get")});var hhe=VC();Object.defineProperty(y,"NonInheritablePropertyRegistry",{enumerable:!0,get:a(function(){return hhe.NonInheritablePropertyRegistry},"get")});var mhe=WC();Object.defineProperty(y,"PropertyCardinalityRegistry",{enumerable:!0,get:a(function(){return mhe.PropertyCardinalityRegistry},"get")});var v9=HC();Object.defineProperty(y,"PrototypeChainMaterializer",{enumerable:!0,get:a(function(){return v9.PrototypeChainMaterializer},"get")});Object.defineProperty(y,"INFERRED_GRAPH",{enumerable:!0,get:a(function(){return v9.INFERRED_GRAPH},"get")});var ghe=S4();Object.defineProperty(y,"IRICanonicalizer",{enumerable:!0,get:a(function(){return ghe.IRICanonicalizer},"get")});var b2=Eb();Object.defineProperty(y,"derivePath",{enumerable:!0,get:a(function(){return b2.derivePath},"get")});Object.defineProperty(y,"deriveUrl",{enumerable:!0,get:a(function(){return b2.deriveUrl},"get")});Object.defineProperty(y,"deriveLegacyFlatPath",{enumerable:!0,get:a(function(){return b2.deriveLegacyFlatPath},"get")});var S2=vb();Object.defineProperty(y,"discoverFileSpaceExclusions",{enumerable:!0,get:a(function(){return S2.discoverFileSpaceExclusions},"get")});Object.defineProperty(y,"frontmatterDeclaresFileSpace",{enumerable:!0,get:a(function(){return S2.frontmatterDeclaresFileSpace},"get")});Object.defineProperty(y,"FILE_SPACE_CLASS_UID",{enumerable:!0,get:a(function(){return S2.FILE_SPACE_CLASS_UID},"get")});var T9=w4();Object.defineProperty(y,"LazyAssetGraphLoader",{enumerable:!0,get:a(function(){return T9.LazyAssetGraphLoader},"get")});Object.defineProperty(y,"MAX_LAZY_DEPTH",{enumerable:!0,get:a(function(){return T9.MAX_LAZY_DEPTH},"get")});var A9=JC();Object.defineProperty(y,"SourceAnnotator",{enumerable:!0,get:a(function(){return A9.SourceAnnotator},"get")});Object.defineProperty(y,"SOURCE_VARIABLE",{enumerable:!0,get:a(function(){return A9.SOURCE_VARIABLE},"get")});var Jc=du();Object.defineProperty(y,"NoteToRDFConverter",{enumerable:!0,get:a(function(){return Jc.NoteToRDFConverter},"get")});Object.defineProperty(y,"normaliseExcludedFolders",{enumerable:!0,get:a(function(){return Jc.normaliseExcludedFolders},"get")});Object.defineProperty(y,"isPathExcluded",{enumerable:!0,get:a(function(){return Jc.isPathExcluded},"get")});Object.defineProperty(y,"UNPREFIXED_ASSET_FIELDS",{enumerable:!0,get:a(function(){return Jc.UNPREFIXED_ASSET_FIELDS},"get")});Object.defineProperty(y,"LEGACY_UNPREFIXED_ASSET_FIELDS",{enumerable:!0,get:a(function(){return Jc.LEGACY_UNPREFIXED_ASSET_FIELDS},"get")});Object.defineProperty(y,"LEGACY_YAML_KEYS",{enumerable:!0,get:a(function(){return Jc.LEGACY_YAML_KEYS},"get")});Object.defineProperty(y,"canonicalYamlKey",{enumerable:!0,get:a(function(){return Jc.canonicalYamlKey},"get")});Object.defineProperty(y,"isPosixBracketExpression",{enumerable:!0,get:a(function(){return Jc.isPosixBracketExpression},"get")});var w2=Mf();Object.defineProperty(y,"ExoQLParser",{enumerable:!0,get:a(function(){return w2.ExoQLParser},"get")});Object.defineProperty(y,"SPARQLParser",{enumerable:!0,get:a(function(){return w2.SPARQLParser},"get")});Object.defineProperty(y,"SPARQLParseError",{enumerable:!0,get:a(function(){return w2.SPARQLParseError},"get")});var I9=WA();Object.defineProperty(y,"DescribeOptionsTransformer",{enumerable:!0,get:a(function(){return I9.DescribeOptionsTransformer},"get")});Object.defineProperty(y,"DescribeOptionsTransformerError",{enumerable:!0,get:a(function(){return I9.DescribeOptionsTransformerError},"get")});var R9=Gf();Object.defineProperty(y,"ExoQLAlgebraTranslator",{enumerable:!0,get:a(function(){return R9.ExoQLAlgebraTranslator},"get")});Object.defineProperty(y,"AlgebraTranslator",{enumerable:!0,get:a(function(){return R9.AlgebraTranslator},"get")});var yhe=E4();Object.defineProperty(y,"AlgebraOptimizer",{enumerable:!0,get:a(function(){return yhe.AlgebraOptimizer},"get")});var _he=v4();Object.defineProperty(y,"AlgebraSerializer",{enumerable:!0,get:a(function(){return _he.AlgebraSerializer},"get")});var bhe=fI();Object.defineProperty(y,"BGPExecutor",{enumerable:!0,get:a(function(){return bhe.BGPExecutor},"get")});var She=K_();Object.defineProperty(y,"FilterExecutor",{enumerable:!0,get:a(function(){return She.FilterExecutor},"get")});var whe=OI();Object.defineProperty(y,"OptionalExecutor",{enumerable:!0,get:a(function(){return whe.OptionalExecutor},"get")});var Ehe=PI();Object.defineProperty(y,"UnionExecutor",{enumerable:!0,get:a(function(){return Ehe.UnionExecutor},"get")});var vhe=jI();Object.defineProperty(y,"ConstructExecutor",{enumerable:!0,get:a(function(){return vhe.ConstructExecutor},"get")});var The=A4();Object.defineProperty(y,"DescribeExecutor",{enumerable:!0,get:a(function(){return The.DescribeExecutor},"get")});var C9=ld();Object.defineProperty(y,"ExoQLQueryExecutor",{enumerable:!0,get:a(function(){return C9.ExoQLQueryExecutor},"get")});Object.defineProperty(y,"QueryExecutor",{enumerable:!0,get:a(function(){return C9.QueryExecutor},"get")});var O9=R4();Object.defineProperty(y,"UpdateExecutor",{enumerable:!0,get:a(function(){return O9.UpdateExecutor},"get")});Object.defineProperty(y,"UpdateExecutorError",{enumerable:!0,get:a(function(){return O9.UpdateExecutorError},"get")});var Ahe=Aa();Object.defineProperty(y,"SolutionMapping",{enumerable:!0,get:a(function(){return Ahe.SolutionMapping},"get")});var Ihe=q_();Object.defineProperty(y,"BuiltInFunctions",{enumerable:!0,get:a(function(){return Ihe.BuiltInFunctions},"get")});var Rhe=O4();Object.defineProperty(y,"AggregateFunctions",{enumerable:!0,get:a(function(){return Rhe.AggregateFunctions},"get")});var x9=y_();Object.defineProperty(y,"CustomAggregateRegistry",{enumerable:!0,get:a(function(){return x9.CustomAggregateRegistry},"get")});Object.defineProperty(y,"CustomAggregateError",{enumerable:!0,get:a(function(){return x9.CustomAggregateError},"get")});var qo=b_();Object.defineProperty(y,"BUILT_IN_AGGREGATES",{enumerable:!0,get:a(function(){return qo.BUILT_IN_AGGREGATES},"get")});Object.defineProperty(y,"EXO_AGGREGATE_NS",{enumerable:!0,get:a(function(){return qo.EXO_AGGREGATE_NS},"get")});Object.defineProperty(y,"medianAggregate",{enumerable:!0,get:a(function(){return qo.medianAggregate},"get")});Object.defineProperty(y,"varianceAggregate",{enumerable:!0,get:a(function(){return qo.varianceAggregate},"get")});Object.defineProperty(y,"stddevAggregate",{enumerable:!0,get:a(function(){return qo.stddevAggregate},"get")});Object.defineProperty(y,"modeAggregate",{enumerable:!0,get:a(function(){return qo.modeAggregate},"get")});Object.defineProperty(y,"createPercentileAggregate",{enumerable:!0,get:a(function(){return qo.createPercentileAggregate},"get")});Object.defineProperty(y,"getNumericValue",{enumerable:!0,get:a(function(){return qo.getNumericValue},"get")});Object.defineProperty(y,"createDecimalLiteral",{enumerable:!0,get:a(function(){return qo.createDecimalLiteral},"get")});Object.defineProperty(y,"createDoubleLiteral",{enumerable:!0,get:a(function(){return qo.createDoubleLiteral},"get")});var Che=x4();Object.defineProperty(y,"QueryPlanCache",{enumerable:!0,get:a(function(){return Che.QueryPlanCache},"get")});var P9=P4();Object.defineProperty(y,"SPARQLResultCache",{enumerable:!0,get:a(function(){return P9.SPARQLResultCache},"get")});Object.defineProperty(y,"createSPARQLResultCache",{enumerable:!0,get:a(function(){return P9.createSPARQLResultCache},"get")});var F9=F4();Object.defineProperty(y,"IncrementalIndexer",{enumerable:!0,get:a(function(){return F9.IncrementalIndexer},"get")});Object.defineProperty(y,"createIncrementalIndexer",{enumerable:!0,get:a(function(){return F9.createIncrementalIndexer},"get")});var Ohe=L4();Object.defineProperty(y,"ResultSerializer",{enumerable:!0,get:a(function(){return Ohe.ResultSerializer},"get")});var L9=VA();Object.defineProperty(y,"CaseWhenTransformer",{enumerable:!0,get:a(function(){return L9.CaseWhenTransformer},"get")});Object.defineProperty(y,"CaseWhenTransformerError",{enumerable:!0,get:a(function(){return L9.CaseWhenTransformerError},"get")});var xhe=YA();Object.defineProperty(y,"VaultPrefixTransformer",{enumerable:!0,get:a(function(){return xhe.VaultPrefixTransformer},"get")});var Phe=eO();Object.defineProperty(y,"FilterContainsOptimizer",{enumerable:!0,get:a(function(){return Phe.FilterContainsOptimizer},"get")});var D9=D4();Object.defineProperty(y,"FileNotFoundError",{enumerable:!0,get:a(function(){return D9.FileNotFoundError},"get")});Object.defineProperty(y,"FileAlreadyExistsError",{enumerable:!0,get:a(function(){return D9.FileAlreadyExistsError},"get")});var E2=qR();Object.defineProperty(y,"TripleAlreadyExistsError",{enumerable:!0,get:a(function(){return E2.TripleAlreadyExistsError},"get")});Object.defineProperty(y,"TripleNotFoundError",{enumerable:!0,get:a(function(){return E2.TripleNotFoundError},"get")});Object.defineProperty(y,"TransactionError",{enumerable:!0,get:a(function(){return E2.TransactionError},"get")});var N9=Qh();Object.defineProperty(y,"liveClock",{enumerable:!0,get:a(function(){return N9.liveClock},"get")});Object.defineProperty(y,"frozenClock",{enumerable:!0,get:a(function(){return N9.frozenClock},"get")});var k9=ub();Object.defineProperty(y,"liveUidGenerator",{enumerable:!0,get:a(function(){return k9.liveUidGenerator},"get")});Object.defineProperty(y,"seededUidGenerator",{enumerable:!0,get:a(function(){return k9.seededUidGenerator},"get")});var Cw=pO();Object.defineProperty(y,"VaultSettings",{enumerable:!0,get:a(function(){return Cw.VaultSettings},"get")});Object.defineProperty(y,"DEFAULT_OWNER_IDENTITY",{enumerable:!0,get:a(function(){return Cw.DEFAULT_OWNER_IDENTITY},"get")});Object.defineProperty(y,"DEFAULT_INBOX_FOLDER",{enumerable:!0,get:a(function(){return Cw.DEFAULT_INBOX_FOLDER},"get")});Object.defineProperty(y,"DEFAULT_FLEETING_NOTE_CLASS_UID",{enumerable:!0,get:a(function(){return Cw.DEFAULT_FLEETING_NOTE_CLASS_UID},"get")});var Fhe=ki();Object.defineProperty(y,"DI_TOKENS",{enumerable:!0,get:a(function(){return Fhe.DI_TOKENS},"get")});var Qm=N4();Object.defineProperty(y,"registerCoreServices",{enumerable:!0,get:a(function(){return Qm.registerCoreServices},"get")});Object.defineProperty(y,"createChildContainer",{enumerable:!0,get:a(function(){return Qm.createChildContainer},"get")});Object.defineProperty(y,"getContainer",{enumerable:!0,get:a(function(){return Qm.getContainer},"get")});Object.defineProperty(y,"resetContainer",{enumerable:!0,get:a(function(){return Qm.resetContainer},"get")});Object.defineProperty(y,"container",{enumerable:!0,get:a(function(){return Qm.container},"get")});var Qa=U4();Object.defineProperty(y,"NODE_FLAGS",{enumerable:!0,get:a(function(){return Qa.NODE_FLAGS},"get")});Object.defineProperty(y,"DEFAULT_COLORS",{enumerable:!0,get:a(function(){return Qa.DEFAULT_COLORS},"get")});Object.defineProperty(y,"StringTable",{enumerable:!0,get:a(function(){return Qa.StringTable},"get")});Object.defineProperty(y,"CompactGraphStore",{enumerable:!0,get:a(function(){return Qa.CompactGraphStore},"get")});Object.defineProperty(y,"MemoryPool",{enumerable:!0,get:a(function(){return Qa.MemoryPool},"get")});Object.defineProperty(y,"getGlobalPool",{enumerable:!0,get:a(function(){return Qa.getGlobalPool},"get")});Object.defineProperty(y,"resetGlobalPool",{enumerable:!0,get:a(function(){return Qa.resetGlobalPool},"get")});Object.defineProperty(y,"StreamingLoader",{enumerable:!0,get:a(function(){return Qa.StreamingLoader},"get")});Object.defineProperty(y,"createStreamingSource",{enumerable:!0,get:a(function(){return Qa.createStreamingSource},"get")});var M9=V4();Object.defineProperty(y,"ExoQL",{enumerable:!0,get:a(function(){return M9.ExoQL},"get")});Object.defineProperty(y,"ExoQLError",{enumerable:!0,get:a(function(){return M9.ExoQLError},"get")});var Xm=LS();Object.defineProperty(y,"LAYOUT_CLASS_IRI",{enumerable:!0,get:a(function(){return Xm.LAYOUT_CLASS_IRI},"get")});Object.defineProperty(y,"LAYOUT_CLASS_UID",{enumerable:!0,get:a(function(){return Xm.LAYOUT_CLASS_UID},"get")});Object.defineProperty(y,"createLayoutFromFrontmatter",{enumerable:!0,get:a(function(){return Xm.createLayoutFromFrontmatter},"get")});Object.defineProperty(y,"isLayout",{enumerable:!0,get:a(function(){return Xm.isLayout},"get")});Object.defineProperty(y,"isLayoutFrontmatter",{enumerable:!0,get:a(function(){return Xm.isLayoutFrontmatter},"get")});var Pn=LS();Object.defineProperty(y,"BACKLINKS_TABLE_BLOCK_CLASS_IRI",{enumerable:!0,get:a(function(){return Pn.BACKLINKS_TABLE_BLOCK_CLASS_IRI},"get")});Object.defineProperty(y,"BACKLINKS_TABLE_BLOCK_CLASS_UID",{enumerable:!0,get:a(function(){return Pn.BACKLINKS_TABLE_BLOCK_CLASS_UID},"get")});Object.defineProperty(y,"DAILY_EFFORTS_BY_CLASS_BLOCK_CLASS_IRI",{enumerable:!0,get:a(function(){return Pn.DAILY_EFFORTS_BY_CLASS_BLOCK_CLASS_IRI},"get")});Object.defineProperty(y,"DAILY_EFFORTS_BY_CLASS_BLOCK_CLASS_UID",{enumerable:!0,get:a(function(){return Pn.DAILY_EFFORTS_BY_CLASS_BLOCK_CLASS_UID},"get")});Object.defineProperty(y,"PROPERTIES_BLOCK_CLASS_IRI",{enumerable:!0,get:a(function(){return Pn.PROPERTIES_BLOCK_CLASS_IRI},"get")});Object.defineProperty(y,"PROPERTIES_BLOCK_CLASS_UID",{enumerable:!0,get:a(function(){return Pn.PROPERTIES_BLOCK_CLASS_UID},"get")});Object.defineProperty(y,"createLayoutBlockFromFrontmatter",{enumerable:!0,get:a(function(){return Pn.createLayoutBlockFromFrontmatter},"get")});Object.defineProperty(y,"isBacklinksTableBlock",{enumerable:!0,get:a(function(){return Pn.isBacklinksTableBlock},"get")});Object.defineProperty(y,"isDailyEffortsByClassBlock",{enumerable:!0,get:a(function(){return Pn.isDailyEffortsByClassBlock},"get")});Object.defineProperty(y,"isLayoutBlockFrontmatter",{enumerable:!0,get:a(function(){return Pn.isLayoutBlockFrontmatter},"get")});Object.defineProperty(y,"isPropertiesBlock",{enumerable:!0,get:a(function(){return Pn.isPropertiesBlock},"get")});Object.defineProperty(y,"isQueryTableBlock",{enumerable:!0,get:a(function(){return Pn.isQueryTableBlock},"get")});Object.defineProperty(y,"QUERY_TABLE_BLOCK_CLASS_IRI",{enumerable:!0,get:a(function(){return Pn.QUERY_TABLE_BLOCK_CLASS_IRI},"get")});Object.defineProperty(y,"QUERY_TABLE_BLOCK_CLASS_UID",{enumerable:!0,get:a(function(){return Pn.QUERY_TABLE_BLOCK_CLASS_UID},"get")});Object.defineProperty(y,"QUERY_TABLE_BLOCK_DEFAULT_EMPTY_TEXT",{enumerable:!0,get:a(function(){return Pn.QUERY_TABLE_BLOCK_DEFAULT_EMPTY_TEXT},"get")});Object.defineProperty(y,"QUERY_TABLE_BLOCK_DEFAULT_LIMIT",{enumerable:!0,get:a(function(){return Pn.QUERY_TABLE_BLOCK_DEFAULT_LIMIT},"get")});Object.defineProperty(y,"assembleLayoutBlocks",{enumerable:!0,get:a(function(){return Pn.assembleLayoutBlocks},"get")});var Xa=LS();Object.defineProperty(y,"BUILTIN_DAILY_EFFORTS_VISIBILITY",{enumerable:!0,get:a(function(){return Xa.BUILTIN_DAILY_EFFORTS_VISIBILITY},"get")});Object.defineProperty(y,"DAILY_EFFORTS_OVERRIDE_KEYS",{enumerable:!0,get:a(function(){return Xa.DAILY_EFFORTS_OVERRIDE_KEYS},"get")});Object.defineProperty(y,"coerceVisibilityOverride",{enumerable:!0,get:a(function(){return Xa.coerceVisibilityOverride},"get")});Object.defineProperty(y,"resolveBlockVisibility",{enumerable:!0,get:a(function(){return Xa.resolveBlockVisibility},"get")});Object.defineProperty(y,"resolveDailyEffortVisibility",{enumerable:!0,get:a(function(){return Xa.resolveDailyEffortVisibility},"get")});Object.defineProperty(y,"EMS_ACTION_CLASS_UID",{enumerable:!0,get:a(function(){return Xa.EMS_ACTION_CLASS_UID},"get")});Object.defineProperty(y,"classListMatches",{enumerable:!0,get:a(function(){return Xa.classListMatches},"get")});Object.defineProperty(y,"EMS_PROJECT_CLASS_UID",{enumerable:!0,get:a(function(){return Xa.EMS_PROJECT_CLASS_UID},"get")});Object.defineProperty(y,"partitionDailyEffortsByClass",{enumerable:!0,get:a(function(){return Xa.partitionDailyEffortsByClass},"get")});var $9=nB();Object.defineProperty(y,"LayoutSelector",{enumerable:!0,get:a(function(){return $9.LayoutSelector},"get")});Object.defineProperty(y,"selectByPriority",{enumerable:!0,get:a(function(){return $9.selectByPriority},"get")});pi(dB(),y);var Lhe=hB();Object.defineProperty(y,"ShapeLoader",{enumerable:!0,get:a(function(){return Lhe.ShapeLoader},"get")});var Dhe=MO();Object.defineProperty(y,"ShapeRegistry",{enumerable:!0,get:a(function(){return Dhe.ShapeRegistry},"get")});var Nhe=Tt();Object.defineProperty(y,"Namespace",{enumerable:!0,get:a(function(){return Nhe.Namespace},"get")});var j9=VO();Object.defineProperty(y,"shaclValidate",{enumerable:!0,get:a(function(){return j9.validate},"get")});Object.defineProperty(y,"ShaclShapeRegistry",{enumerable:!0,get:a(function(){return j9.ShapeRegistry},"get")});pi(SB(),y);var B9=WO();Object.defineProperty(y,"parseTarball",{enumerable:!0,get:a(function(){return B9.parseTarball},"get")});Object.defineProperty(y,"parseTarballGzip",{enumerable:!0,get:a(function(){return B9.parseTarballGzip},"get")});var U9=YS();Object.defineProperty(y,"restCreateCommit",{enumerable:!0,get:a(function(){return U9.restCreateCommit},"get")});Object.defineProperty(y,"isBinaryPayload",{enumerable:!0,get:a(function(){return U9.isBinaryPayload},"get")});var Zc=RB();Object.defineProperty(y,"mountAssetSpaceFiles",{enumerable:!0,get:a(function(){return Zc.mountAssetSpaceFiles},"get")});Object.defineProperty(y,"discoverAssetSpaceWrapperDir",{enumerable:!0,get:a(function(){return Zc.discoverWrapperDir},"get")});Object.defineProperty(y,"extractAssetSpaceSha",{enumerable:!0,get:a(function(){return Zc.extractShaFromWrapper},"get")});Object.defineProperty(y,"appendGitmodulesEntry",{enumerable:!0,get:a(function(){return Zc.appendGitmodulesEntry},"get")});Object.defineProperty(y,"stripGitmodulesEntry",{enumerable:!0,get:a(function(){return Zc.stripGitmodulesEntry},"get")});Object.defineProperty(y,"escapeGitmodulesRegex",{enumerable:!0,get:a(function(){return Zc.escapeGitmodulesRegex},"get")});Object.defineProperty(y,"MATERIALIZE_PROGRESS_INTERVAL",{enumerable:!0,get:a(function(){return Zc.MATERIALIZE_PROGRESS_INTERVAL},"get")});Object.defineProperty(y,"MATERIALIZE_PROGRESS_MIN_FILES",{enumerable:!0,get:a(function(){return Zc.MATERIALIZE_PROGRESS_MIN_FILES},"get")});var V9=Rm();Object.defineProperty(y,"detectChanges",{enumerable:!0,get:a(function(){return V9.detectChanges},"get")});Object.defineProperty(y,"extractAssetUid",{enumerable:!0,get:a(function(){return V9.extractAssetUid},"get")});var khe=OB();Object.defineProperty(y,"promiseWithDeadline",{enumerable:!0,get:a(function(){return khe.promiseWithDeadline},"get")});var Mhe=qc();Object.defineProperty(y,"gitBlobSha",{enumerable:!0,get:a(function(){return Mhe.gitBlobSha},"get")});var Ow=LB();Object.defineProperty(y,"CONDITIONAL_STORE_FILENAME",{enumerable:!0,get:a(function(){return Ow.CONDITIONAL_STORE_FILENAME},"get")});Object.defineProperty(y,"ConditionalRequestCache",{enumerable:!0,get:a(function(){return Ow.ConditionalRequestCache},"get")});Object.defineProperty(y,"conditionalCacheKey",{enumerable:!0,get:a(function(){return Ow.conditionalCacheKey},"get")});Object.defineProperty(y,"withConditionalRequests",{enumerable:!0,get:a(function(){return Ow.withConditionalRequests},"get")});var v2=MB();Object.defineProperty(y,"ImmutableObjectCache",{enumerable:!0,get:a(function(){return v2.ImmutableObjectCache},"get")});Object.defineProperty(y,"parseImmutableObjectUrl",{enumerable:!0,get:a(function(){return v2.parseImmutableObjectUrl},"get")});Object.defineProperty(y,"withImmutableObjectCache",{enumerable:!0,get:a(function(){return v2.withImmutableObjectCache},"get")});var T2=BB();Object.defineProperty(y,"rewriteAssetUid",{enumerable:!0,get:a(function(){return T2.rewriteAssetUid},"get")});Object.defineProperty(y,"findDuplicateUidGroups",{enumerable:!0,get:a(function(){return T2.findDuplicateUidGroups},"get")});Object.defineProperty(y,"planDuplicateUidFix",{enumerable:!0,get:a(function(){return T2.planDuplicateUidFix},"get")});var Jm=Au();Object.defineProperty(y,"getBlobBytes",{enumerable:!0,get:a(function(){return Jm.getBlobBytes},"get")});Object.defineProperty(y,"getBlobText",{enumerable:!0,get:a(function(){return Jm.getBlobText},"get")});Object.defineProperty(y,"getCommitInfo",{enumerable:!0,get:a(function(){return Jm.getCommitInfo},"get")});Object.defineProperty(y,"getHeadSha",{enumerable:!0,get:a(function(){return Jm.getHeadSha},"get")});Object.defineProperty(y,"getTree",{enumerable:!0,get:a(function(){return Jm.getTree},"get")});var $he=GB();Object.defineProperty(y,"checkParkedStaleness",{enumerable:!0,get:a(function(){return $he.checkParkedStaleness},"get")});var Zd=_U();Object.defineProperty(y,"DEFAULT_MAX_PUSH_RETRIES",{enumerable:!0,get:a(function(){return Zd.DEFAULT_MAX_PUSH_RETRIES},"get")});Object.defineProperty(y,"DEFAULT_LOCAL_MANIFEST_REHASH_MS",{enumerable:!0,get:a(function(){return Zd.DEFAULT_LOCAL_MANIFEST_REHASH_MS},"get")});Object.defineProperty(y,"SyncEngine",{enumerable:!0,get:a(function(){return Zd.SyncEngine},"get")});Object.defineProperty(y,"isNonFastForwardError",{enumerable:!0,get:a(function(){return Zd.isNonFastForwardError},"get")});Object.defineProperty(y,"orderChildrenFirst",{enumerable:!0,get:a(function(){return Zd.orderChildrenFirst},"get")});Object.defineProperty(y,"syncProgressPhaseText",{enumerable:!0,get:a(function(){return Zd.syncProgressPhaseText},"get")});var Ss=ix();Object.defineProperty(y,"SyncPhaseTimer",{enumerable:!0,get:a(function(){return Ss.SyncPhaseTimer},"get")});Object.defineProperty(y,"SYNC_PHASES",{enumerable:!0,get:a(function(){return Ss.SYNC_PHASES},"get")});Object.defineProperty(y,"classifyRestPhase",{enumerable:!0,get:a(function(){return Ss.classifyRestPhase},"get")});Object.defineProperty(y,"emptyTimings",{enumerable:!0,get:a(function(){return Ss.emptyTimings},"get")});Object.defineProperty(y,"addTimings",{enumerable:!0,get:a(function(){return Ss.addTimings},"get")});Object.defineProperty(y,"aggregateTimings",{enumerable:!0,get:a(function(){return Ss.aggregateTimings},"get")});Object.defineProperty(y,"totalMs",{enumerable:!0,get:a(function(){return Ss.totalMs},"get")});Object.defineProperty(y,"dominantPhase",{enumerable:!0,get:a(function(){return Ss.dominantPhase},"get")});Object.defineProperty(y,"fmtMs",{enumerable:!0,get:a(function(){return Ss.fmtMs},"get")});Object.defineProperty(y,"formatTimingsLine",{enumerable:!0,get:a(function(){return Ss.formatTimingsLine},"get")});Object.defineProperty(y,"formatRepoTimings",{enumerable:!0,get:a(function(){return Ss.formatRepoTimings},"get")});Object.defineProperty(y,"formatQuota",{enumerable:!0,get:a(function(){return Ss.formatQuota},"get")});var G9=SU();Object.defineProperty(y,"QuarantineResolver",{enumerable:!0,get:a(function(){return G9.QuarantineResolver},"get")});Object.defineProperty(y,"backupPathFor",{enumerable:!0,get:a(function(){return G9.backupPathFor},"get")});var Zm=iw();Object.defineProperty(y,"DEFAULT_MAX_FILE_BYTES",{enumerable:!0,get:a(function(){return Zm.DEFAULT_MAX_FILE_BYTES},"get")});Object.defineProperty(y,"InMemoryQuarantineStore",{enumerable:!0,get:a(function(){return Zm.InMemoryQuarantineStore},"get")});Object.defineProperty(y,"contentEquals",{enumerable:!0,get:a(function(){return Zm.contentEquals},"get")});Object.defineProperty(y,"isFileSpaceSyncablePath",{enumerable:!0,get:a(function(){return Zm.isFileSpaceSyncablePath},"get")});Object.defineProperty(y,"isSyncablePath",{enumerable:!0,get:a(function(){return Zm.isSyncablePath},"get")});var q9=wU();Object.defineProperty(y,"FileLocalManifestStore",{enumerable:!0,get:a(function(){return q9.FileLocalManifestStore},"get")});Object.defineProperty(y,"LOCAL_MANIFEST_STORE_FILENAME",{enumerable:!0,get:a(function(){return q9.LOCAL_MANIFEST_STORE_FILENAME},"get")});var jhe=Rx();Object.defineProperty(y,"diff3",{enumerable:!0,get:a(function(){return jhe.diff3},"get")});var W9=AU();Object.defineProperty(y,"StructuredMerger",{enumerable:!0,get:a(function(){return W9.StructuredMerger},"get")});Object.defineProperty(y,"splitSections",{enumerable:!0,get:a(function(){return W9.splitSections},"get")});var Bhe=IU();Object.defineProperty(y,"MergeShaclGate",{enumerable:!0,get:a(function(){return Bhe.MergeShaclGate},"get")});var Uhe=RU();Object.defineProperty(y,"GatedStructuredMerger",{enumerable:!0,get:a(function(){return Uhe.GatedStructuredMerger},"get")});var K9=OU();Object.defineProperty(y,"FileWatermarkStore",{enumerable:!0,get:a(function(){return K9.FileWatermarkStore},"get")});Object.defineProperty(y,"WATERMARK_STORE_FILENAME",{enumerable:!0,get:a(function(){return K9.WATERMARK_STORE_FILENAME},"get")});var z9=xU();Object.defineProperty(y,"FileMountBaseStore",{enumerable:!0,get:a(function(){return z9.FileMountBaseStore},"get")});Object.defineProperty(y,"MOUNT_BASE_STORE_FILENAME",{enumerable:!0,get:a(function(){return z9.MOUNT_BASE_STORE_FILENAME},"get")});var Vhe=rw();Object.defineProperty(y,"isAuthError",{enumerable:!0,get:a(function(){return Vhe.isAuthError},"get")});var eg=xm();Object.defineProperty(y,"isRateLimitError",{enumerable:!0,get:a(function(){return eg.isRateLimitError},"get")});Object.defineProperty(y,"withRateLimitBackoff",{enumerable:!0,get:a(function(){return eg.withRateLimitBackoff},"get")});Object.defineProperty(y,"createRateLimitBudget",{enumerable:!0,get:a(function(){return eg.createRateLimitBudget},"get")});Object.defineProperty(y,"MIN_RATE_LIMIT_WAIT_MS",{enumerable:!0,get:a(function(){return eg.MIN_RATE_LIMIT_WAIT_MS},"get")});Object.defineProperty(y,"DEFAULT_MAX_RETRIES",{enumerable:!0,get:a(function(){return eg.DEFAULT_MAX_RETRIES},"get")});var ep=ax();Object.defineProperty(y,"caseInsensitiveHeaderGetter",{enumerable:!0,get:a(function(){return ep.caseInsensitiveHeaderGetter},"get")});Object.defineProperty(y,"parseRetryAfterMs",{enumerable:!0,get:a(function(){return ep.parseRetryAfterMs},"get")});Object.defineProperty(y,"extractRateLimitFields",{enumerable:!0,get:a(function(){return ep.extractRateLimitFields},"get")});Object.defineProperty(y,"getRateLimitFields",{enumerable:!0,get:a(function(){return ep.getRateLimitFields},"get")});Object.defineProperty(y,"attachRateLimitFields",{enumerable:!0,get:a(function(){return ep.attachRateLimitFields},"get")});Object.defineProperty(y,"enrichRateLimitError",{enumerable:!0,get:a(function(){return ep.enrichRateLimitError},"get")});var H9=px();Object.defineProperty(y,"redactSecrets",{enumerable:!0,get:a(function(){return H9.redactSecrets},"get")});Object.defineProperty(y,"scanForSecrets",{enumerable:!0,get:a(function(){return H9.scanForSecrets},"get")});var Y9=PU();Object.defineProperty(y,"LocalConflictCacheStore",{enumerable:!0,get:a(function(){return Y9.LocalConflictCacheStore},"get")});Object.defineProperty(y,"CONFLICT_CACHE_STORE_FILENAME",{enumerable:!0,get:a(function(){return Y9.CONFLICT_CACHE_STORE_FILENAME},"get")});var A2=ew();Object.defineProperty(y,"LocalOutboxStore",{enumerable:!0,get:a(function(){return A2.LocalOutboxStore},"get")});Object.defineProperty(y,"OUTBOX_STORE_FILENAME",{enumerable:!0,get:a(function(){return A2.OUTBOX_STORE_FILENAME},"get")});Object.defineProperty(y,"OUTBOX_REMOTE_ABSENT",{enumerable:!0,get:a(function(){return A2.OUTBOX_REMOTE_ABSENT},"get")});var ws=Pm();Object.defineProperty(y,"ASSET_SPACE_CLASS_UID",{enumerable:!0,get:a(function(){return ws.ASSET_SPACE_CLASS_UID},"get")});Object.defineProperty(y,"PULL_ONLY_LIST_PATH",{enumerable:!0,get:a(function(){return ws.PULL_ONLY_LIST_PATH},"get")});Object.defineProperty(y,"PullOnlyListError",{enumerable:!0,get:a(function(){return ws.PullOnlyListError},"get")});Object.defineProperty(y,"SYNC_BRANCH",{enumerable:!0,get:a(function(){return ws.SYNC_BRANCH},"get")});Object.defineProperty(y,"SpaceSpecAccumulator",{enumerable:!0,get:a(function(){return ws.SpaceSpecAccumulator},"get")});Object.defineProperty(y,"applyPullOnlyListText",{enumerable:!0,get:a(function(){return ws.applyPullOnlyListText},"get")});Object.defineProperty(y,"classifySpaceDeclaration",{enumerable:!0,get:a(function(){return ws.classifySpaceDeclaration},"get")});Object.defineProperty(y,"isAssetSpaceFrontmatter",{enumerable:!0,get:a(function(){return ws.isAssetSpaceFrontmatter},"get")});Object.defineProperty(y,"isFileSpaceFrontmatter",{enumerable:!0,get:a(function(){return ws.isFileSpaceFrontmatter},"get")});Object.defineProperty(y,"parsePullOnlyList",{enumerable:!0,get:a(function(){return ws.parsePullOnlyList},"get")});Object.defineProperty(y,"parseStrictGitHubRepoURL",{enumerable:!0,get:a(function(){return ws.parseStrictGitHubRepoURL},"get")});Object.defineProperty(y,"readSpaceSource",{enumerable:!0,get:a(function(){return ws.readSpaceSource},"get")});var Q9=LU();Object.defineProperty(y,"buildAssetSpaceDescriptor",{enumerable:!0,get:a(function(){return Q9.buildAssetSpaceDescriptor},"get")});Object.defineProperty(y,"deriveAssetSpaceNamespace",{enumerable:!0,get:a(function(){return Q9.deriveAssetSpaceNamespace},"get")});var X9=jU();Object.defineProperty(y,"ParityValidator",{enumerable:!0,get:a(function(){return X9.ParityValidator},"get")});Object.defineProperty(y,"summarizeParityRound",{enumerable:!0,get:a(function(){return X9.summarizeParityRound},"get")});var J9=Vx();Object.defineProperty(y,"compareAssetSemantics",{enumerable:!0,get:a(function(){return J9.compareAssetSemantics},"get")});Object.defineProperty(y,"isFormatOnlyDrift",{enumerable:!0,get:a(function(){return J9.isFormatOnlyDrift},"get")});pi(QU(),y);pi(s9(),y);var Ghe=s2();Object.defineProperty(y,"resolvePreferenceList",{enumerable:!0,get:a(function(){return Ghe.resolvePreferenceList},"get")});var qhe=Sw();Object.defineProperty(y,"unwrapLinkTarget",{enumerable:!0,get:a(function(){return qhe.unwrapLinkTarget},"get")});var I2=yf();Object.defineProperty(y,"EFFORT_STATUS_UID",{enumerable:!0,get:a(function(){return I2.EFFORT_STATUS_UID},"get")});Object.defineProperty(y,"EFFORT_STATUS_BY_UID",{enumerable:!0,get:a(function(){return I2.EFFORT_STATUS_BY_UID},"get")});Object.defineProperty(y,"normalizeEffortStatus",{enumerable:!0,get:a(function(){return I2.normalizeEffortStatus},"get")});var Whe=a2();Object.defineProperty(y,"DEFAULT_DISPLAY_NAME_SETTINGS",{enumerable:!0,get:a(function(){return Whe.DEFAULT_DISPLAY_NAME_SETTINGS},"get")});var Khe=c9();Object.defineProperty(y,"PrintNameRuleService",{enumerable:!0,get:a(function(){return Khe.PrintNameRuleService},"get")});var Z9=l9();Object.defineProperty(y,"DisplayNameResolver",{enumerable:!0,get:a(function(){return Z9.DisplayNameResolver},"get")});Object.defineProperty(y,"createDefaultResolver",{enumerable:!0,get:a(function(){return Z9.createDefaultResolver},"get")});var R2=vw();Object.defineProperty(y,"DisplayNameTemplateEngine",{enumerable:!0,get:a(function(){return R2.DisplayNameTemplateEngine},"get")});Object.defineProperty(y,"DISPLAY_NAME_PRESETS",{enumerable:!0,get:a(function(){return R2.DISPLAY_NAME_PRESETS},"get")});Object.defineProperty(y,"DEFAULT_DISPLAY_NAME_TEMPLATE",{enumerable:!0,get:a(function(){return R2.DEFAULT_DISPLAY_NAME_TEMPLATE},"get")});var e5=Wm();Object.defineProperty(y,"resolveKeyPath",{enumerable:!0,get:a(function(){return e5.resolveKeyPath},"get")});Object.defineProperty(y,"isWikilink",{enumerable:!0,get:a(function(){return e5.isWikilink},"get")});var xw=y9();Object.defineProperty(y,"isEffortBlocked",{enumerable:!0,get:a(function(){return xw.isEffortBlocked},"get")});Object.defineProperty(y,"isEpisodeOngoing",{enumerable:!0,get:a(function(){return xw.isEpisodeOngoing},"get")});Object.defineProperty(y,"localToday",{enumerable:!0,get:a(function(){return xw.localToday},"get")});Object.defineProperty(y,"createDisplayMatcherHostFunctions",{enumerable:!0,get:a(function(){return xw.createDisplayMatcherHostFunctions},"get")})});var or=Be(()=>{"use strict"});function t5(r){return r.startsWith("VALIDATION_")?"validation":r.startsWith("PERMISSION_")||r==="CREATION_GATE_REFUSED"?"permission":r.startsWith("STATE_")?"state":"internal"}var mt,r5=Be(()=>{"use strict";a(t5,"getErrorCategory");mt=class{static{a(this,"ResponseBuilder")}static success(e,t){return{success:!0,data:e,...t&&{meta:t}}}static error(e,t,n,i){return{success:!1,error:{code:e,category:t5(e),message:t,exitCode:n,...i?.recovery&&{recovery:i.recovery},...i?.context&&{context:i.context},...i?.stack&&{stack:i.stack}}}}}});var Ir=Be(()=>{"use strict";r5()});var pr,Ui=Be(()=>{"use strict";Ir();pr=class extends Error{static{a(this,"CLIError")}constructor(e,t,n){super(e),this.name=this.constructor.name,this.context=t,this.recoveryHint=n,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}format(){let e=`\u274C ${this.name}: ${this.message}`;if(this.guidance&&(e+=`
363
363
 
364
364
  \u{1F4A1} ${this.guidance}`),this.context&&Object.keys(this.context).length>0){e+=`
365
365
 
@@ -378,19 +378,19 @@ To fix this:
378
378
  3. Simplify query: reduce WHERE clauses or add LIMIT
379
379
  4. Use cache: --use-cache for faster vault loading${i!==void 0?`
380
380
 
381
- Partial results: ${i} result(s) were collected before timeout.`:""}`}static{a(this,"QueryTimeoutError")}}});var rg,Cx=Be(()=>{"use strict";or();Ui();Ir();rg=class extends pr{constructor(t,n){let i=n.length>0?` Did you mean '${n[0]}'?`:"",s=`Unknown property '${t}' \u2014 not in the mounted TBox.${i}`;super(s,{unknown:t,suggestions:n},{message:n.length>0?`Use '${n[0]}' (or another property that exists in the mounted TBox).`:"Use a property name that exists in the mounted TBox.",suggestion:"New properties are authored through the TBox (a new exo__Property asset), not via create."});this.exitCode=2;this.errorCode="VALIDATION_INVALID_ARGUMENTS";this.unknown=t,this.suggestions=n,this.guidance="The property name does not exist in the mounted TBox. Fix the spelling"+(n.length>0?` (e.g. '${n[0]}')`:"")+", or author the new property through the TBox path \u2014 `create` does not mint properties."}static{a(this,"UnknownPropertyError")}}});var ng,f5=Be(()=>{"use strict";or();Ui();Ir();ng=class extends pr{constructor(t){super(t.message,{policyUid:t.policyUid,policyLabel:t.policyLabel,candidatePath:t.candidatePath},{message:t.hint??"Satisfy the creation rule named in the message"});this.exitCode=4;this.errorCode="CREATION_GATE_REFUSED";this.guidance=t.hint??""}static{a(this,"CreationGateRefusedCliError")}format(){return this.message}}});var ig,d5=Be(()=>{"use strict";or();Ui();Ir();ig=class extends pr{constructor(t,n){let i=n.map(o=>` \u2022 ${o.propertyPath} (${o.constraint}): ${o.message}`+(o.expectedRange?` [expected: ${o.expectedRange}]`:"")+(o.actualValue?` [actual: ${o.actualValue}]`:"")).join(`
381
+ Partial results: ${i} result(s) were collected before timeout.`:""}`}static{a(this,"QueryTimeoutError")}}});var rg,C2=Be(()=>{"use strict";or();Ui();Ir();rg=class extends pr{constructor(t,n){let i=n.length>0?` Did you mean '${n[0]}'?`:"",s=`Unknown property '${t}' \u2014 not in the mounted TBox.${i}`;super(s,{unknown:t,suggestions:n},{message:n.length>0?`Use '${n[0]}' (or another property that exists in the mounted TBox).`:"Use a property name that exists in the mounted TBox.",suggestion:"New properties are authored through the TBox (a new exo__Property asset), not via create."});this.exitCode=2;this.errorCode="VALIDATION_INVALID_ARGUMENTS";this.unknown=t,this.suggestions=n,this.guidance="The property name does not exist in the mounted TBox. Fix the spelling"+(n.length>0?` (e.g. '${n[0]}')`:"")+", or author the new property through the TBox path \u2014 `create` does not mint properties."}static{a(this,"UnknownPropertyError")}}});var ng,f5=Be(()=>{"use strict";or();Ui();Ir();ng=class extends pr{constructor(t){super(t.message,{policyUid:t.policyUid,policyLabel:t.policyLabel,candidatePath:t.candidatePath},{message:t.hint??"Satisfy the creation rule named in the message"});this.exitCode=4;this.errorCode="CREATION_GATE_REFUSED";this.guidance=t.hint??""}static{a(this,"CreationGateRefusedCliError")}format(){return this.message}}});var ig,d5=Be(()=>{"use strict";or();Ui();Ir();ig=class extends pr{constructor(t,n){let i=n.map(o=>` \u2022 ${o.propertyPath} (${o.constraint}): ${o.message}`+(o.expectedRange?` [expected: ${o.expectedRange}]`:"")+(o.actualValue?` [actual: ${o.actualValue}]`:"")).join(`
382
382
  `),s=`SHACL-lite validation failed for the new asset \u2014 nothing was written.
383
383
  ${n.length} violation(s) in ${t}:
384
- ${i}`;super(s,{path:t,violations:n},{message:"Fix the frontmatter so the asset satisfies its class shapes, then re-run create.",suggestion:"Run `validate schema --shapes-mode` on the vault to see the same shapes the gate applied."});this.exitCode=2;this.errorCode="VALIDATION_INVALID_FORMAT";this.assetPath=t,this.violations=n,this.guidance="The asset does not conform to the SHACL-lite shapes declared for its class. Add the missing required properties (or correct the offending value's class/datatype) and re-run `create --validate`. Omitting `--validate` skips the gate entirely."}static{a(this,"ShaclConformanceError")}}});var Ft=Be(()=>{"use strict";Ui();n5();i5();s5();o5();a5();c5();l5();u5();Cx();f5();d5()});var an=T(Ox=>{"use strict";Ox.fromCallback=function(r){return Object.defineProperty(function(...e){if(typeof e[e.length-1]=="function")r.apply(this,e);else return new Promise((t,n)=>{e.push((i,s)=>i!=null?n(i):t(s)),r.apply(this,e)})},"name",{value:r.name})};Ox.fromPromise=function(r){return Object.defineProperty(function(...e){let t=e[e.length-1];if(typeof t!="function")return r.apply(this,e);e.pop(),r.apply(this,e).then(n=>t(null,n),t)},"name",{value:r.name})}});var h5=T((fje,p5)=>{var el=require("constants"),Hhe=process.cwd,Lw=null,Yhe=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return Lw||(Lw=Hhe.call(process)),Lw};try{process.cwd()}catch{}typeof process.chdir=="function"&&(xx=process.chdir,process.chdir=function(r){Lw=null,xx.call(process,r)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,xx));var xx;p5.exports=Qhe;function Qhe(r){el.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&e(r),r.lutimes||t(r),r.chown=s(r.chown),r.fchown=s(r.fchown),r.lchown=s(r.lchown),r.chmod=n(r.chmod),r.fchmod=n(r.fchmod),r.lchmod=n(r.lchmod),r.chownSync=o(r.chownSync),r.fchownSync=o(r.fchownSync),r.lchownSync=o(r.lchownSync),r.chmodSync=i(r.chmodSync),r.fchmodSync=i(r.fchmodSync),r.lchmodSync=i(r.lchmodSync),r.stat=c(r.stat),r.fstat=c(r.fstat),r.lstat=c(r.lstat),r.statSync=l(r.statSync),r.fstatSync=l(r.fstatSync),r.lstatSync=l(r.lstatSync),r.chmod&&!r.lchmod&&(r.lchmod=function(f,d,p){p&&process.nextTick(p)},r.lchmodSync=function(){}),r.chown&&!r.lchown&&(r.lchown=function(f,d,p,h){h&&process.nextTick(h)},r.lchownSync=function(){}),Yhe==="win32"&&(r.rename=typeof r.rename!="function"?r.rename:(function(f){function d(p,h,g){var m=Date.now(),_=0;f(p,h,a(function b(w){if(w&&(w.code==="EACCES"||w.code==="EPERM"||w.code==="EBUSY")&&Date.now()-m<6e4){setTimeout(function(){r.stat(h,function(v,E){v&&v.code==="ENOENT"?f(p,h,b):g(w)})},_),_<100&&(_+=10);return}g&&g(w)},"CB"))}return a(d,"rename"),Object.setPrototypeOf&&Object.setPrototypeOf(d,f),d})(r.rename)),r.read=typeof r.read!="function"?r.read:(function(f){function d(p,h,g,m,_,b){var w;if(b&&typeof b=="function"){var v=0;w=a(function(E,S,R){if(E&&E.code==="EAGAIN"&&v<10)return v++,f.call(r,p,h,g,m,_,w);b.apply(this,arguments)},"callback")}return f.call(r,p,h,g,m,_,w)}return a(d,"read"),Object.setPrototypeOf&&Object.setPrototypeOf(d,f),d})(r.read),r.readSync=typeof r.readSync!="function"?r.readSync:(function(f){return function(d,p,h,g,m){for(var _=0;;)try{return f.call(r,d,p,h,g,m)}catch(b){if(b.code==="EAGAIN"&&_<10){_++;continue}throw b}}})(r.readSync);function e(f){f.lchmod=function(d,p,h){f.open(d,el.O_WRONLY|el.O_SYMLINK,p,function(g,m){if(g){h&&h(g);return}f.fchmod(m,p,function(_){f.close(m,function(b){h&&h(_||b)})})})},f.lchmodSync=function(d,p){var h=f.openSync(d,el.O_WRONLY|el.O_SYMLINK,p),g=!0,m;try{m=f.fchmodSync(h,p),g=!1}finally{if(g)try{f.closeSync(h)}catch{}else f.closeSync(h)}return m}}a(e,"patchLchmod");function t(f){el.hasOwnProperty("O_SYMLINK")&&f.futimes?(f.lutimes=function(d,p,h,g){f.open(d,el.O_SYMLINK,function(m,_){if(m){g&&g(m);return}f.futimes(_,p,h,function(b){f.close(_,function(w){g&&g(b||w)})})})},f.lutimesSync=function(d,p,h){var g=f.openSync(d,el.O_SYMLINK),m,_=!0;try{m=f.futimesSync(g,p,h),_=!1}finally{if(_)try{f.closeSync(g)}catch{}else f.closeSync(g)}return m}):f.futimes&&(f.lutimes=function(d,p,h,g){g&&process.nextTick(g)},f.lutimesSync=function(){})}a(t,"patchLutimes");function n(f){return f&&function(d,p,h){return f.call(r,d,p,function(g){u(g)&&(g=null),h&&h.apply(this,arguments)})}}a(n,"chmodFix");function i(f){return f&&function(d,p){try{return f.call(r,d,p)}catch(h){if(!u(h))throw h}}}a(i,"chmodFixSync");function s(f){return f&&function(d,p,h,g){return f.call(r,d,p,h,function(m){u(m)&&(m=null),g&&g.apply(this,arguments)})}}a(s,"chownFix");function o(f){return f&&function(d,p,h){try{return f.call(r,d,p,h)}catch(g){if(!u(g))throw g}}}a(o,"chownFixSync");function c(f){return f&&function(d,p,h){typeof p=="function"&&(h=p,p=null);function g(m,_){_&&(_.uid<0&&(_.uid+=4294967296),_.gid<0&&(_.gid+=4294967296)),h&&h.apply(this,arguments)}return a(g,"callback"),p?f.call(r,d,p,g):f.call(r,d,g)}}a(c,"statFix");function l(f){return f&&function(d,p){var h=p?f.call(r,d,p):f.call(r,d);return h&&(h.uid<0&&(h.uid+=4294967296),h.gid<0&&(h.gid+=4294967296)),h}}a(l,"statFixSync");function u(f){if(!f||f.code==="ENOSYS")return!0;var d=!process.getuid||process.getuid()!==0;return!!(d&&(f.code==="EINVAL"||f.code==="EPERM"))}a(u,"chownErOk")}a(Qhe,"patch")});var y5=T((pje,g5)=>{var m5=require("stream").Stream;g5.exports=Xhe;function Xhe(r){return{ReadStream:e,WriteStream:t};function e(n,i){if(!(this instanceof e))return new e(n,i);m5.call(this);var s=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=64*1024,i=i||{};for(var o=Object.keys(i),c=0,l=o.length;c<l;c++){var u=o[c];this[u]=i[u]}if(this.encoding&&this.setEncoding(this.encoding),this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){s._read()});return}r.open(this.path,this.flags,this.mode,function(f,d){if(f){s.emit("error",f),s.readable=!1;return}s.fd=d,s.emit("open",d),s._read()})}function t(n,i){if(!(this instanceof t))return new t(n,i);m5.call(this),this.path=n,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,i=i||{};for(var s=Object.keys(i),o=0,c=s.length;o<c;o++){var l=s[o];this[l]=i[l]}if(this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=r.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}a(Xhe,"legacy")});var b5=T((mje,_5)=>{"use strict";_5.exports=Zhe;var Jhe=Object.getPrototypeOf||function(r){return r.__proto__};function Zhe(r){if(r===null||typeof r!="object")return r;if(r instanceof Object)var e={__proto__:Jhe(r)};else var e=Object.create(null);return Object.getOwnPropertyNames(r).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}),e}a(Zhe,"clone")});var ip=T((yje,Lx)=>{var wr=require("fs"),eme=h5(),tme=y5(),rme=b5(),Dw=require("util"),Fn,kw;typeof Symbol=="function"&&typeof Symbol.for=="function"?(Fn=Symbol.for("graceful-fs.queue"),kw=Symbol.for("graceful-fs.previous")):(Fn="___graceful-fs.queue",kw="___graceful-fs.previous");function nme(){}a(nme,"noop");function E5(r,e){Object.defineProperty(r,Fn,{get:a(function(){return e},"get")})}a(E5,"publishQueue");var Ou=nme;Dw.debuglog?Ou=Dw.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(Ou=a(function(){var r=Dw.format.apply(Dw,arguments);r="GFS4: "+r.split(/\n/).join(`
385
- GFS4: `),console.error(r)},"debug"));wr[Fn]||(S5=global[Fn]||[],E5(wr,S5),wr.close=(function(r){function e(t,n){return r.call(wr,t,function(i){i||w5(),typeof n=="function"&&n.apply(this,arguments)})}return a(e,"close"),Object.defineProperty(e,kw,{value:r}),e})(wr.close),wr.closeSync=(function(r){function e(t){r.apply(wr,arguments),w5()}return a(e,"closeSync"),Object.defineProperty(e,kw,{value:r}),e})(wr.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){Ou(wr[Fn]),require("assert").equal(wr[Fn].length,0)}));var S5;global[Fn]||E5(global,wr[Fn]);Lx.exports=Px(rme(wr));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!wr.__patched&&(Lx.exports=Px(wr),wr.__patched=!0);function Px(r){eme(r),r.gracefulify=Px,r.createReadStream=S,r.createWriteStream=R;var e=r.readFile;r.readFile=t;function t(D,F,$){return typeof F=="function"&&($=F,F=null),H(D,F,$);function H(ee,G,j,z){return e(ee,G,function(ie){ie&&(ie.code==="EMFILE"||ie.code==="ENFILE")?np([H,[ee,G,j],ie,z||Date.now(),Date.now()]):typeof j=="function"&&j.apply(this,arguments)})}a(H,"go$readFile")}a(t,"readFile");var n=r.writeFile;r.writeFile=i;function i(D,F,$,H){return typeof $=="function"&&(H=$,$=null),ee(D,F,$,H);function ee(G,j,z,ie,O){return n(G,j,z,function(U){U&&(U.code==="EMFILE"||U.code==="ENFILE")?np([ee,[G,j,z,ie],U,O||Date.now(),Date.now()]):typeof ie=="function"&&ie.apply(this,arguments)})}a(ee,"go$writeFile")}a(i,"writeFile");var s=r.appendFile;s&&(r.appendFile=o);function o(D,F,$,H){return typeof $=="function"&&(H=$,$=null),ee(D,F,$,H);function ee(G,j,z,ie,O){return s(G,j,z,function(U){U&&(U.code==="EMFILE"||U.code==="ENFILE")?np([ee,[G,j,z,ie],U,O||Date.now(),Date.now()]):typeof ie=="function"&&ie.apply(this,arguments)})}a(ee,"go$appendFile")}a(o,"appendFile");var c=r.copyFile;c&&(r.copyFile=l);function l(D,F,$,H){return typeof $=="function"&&(H=$,$=0),ee(D,F,$,H);function ee(G,j,z,ie,O){return c(G,j,z,function(U){U&&(U.code==="EMFILE"||U.code==="ENFILE")?np([ee,[G,j,z,ie],U,O||Date.now(),Date.now()]):typeof ie=="function"&&ie.apply(this,arguments)})}a(ee,"go$copyFile")}a(l,"copyFile");var u=r.readdir;r.readdir=d;var f=/^v[0-5]\./;function d(D,F,$){typeof F=="function"&&($=F,F=null);var H=f.test(process.version)?a(function(j,z,ie,O){return u(j,ee(j,z,ie,O))},"go$readdir"):a(function(j,z,ie,O){return u(j,z,ee(j,z,ie,O))},"go$readdir");return H(D,F,$);function ee(G,j,z,ie){return function(O,U){O&&(O.code==="EMFILE"||O.code==="ENFILE")?np([H,[G,j,z],O,ie||Date.now(),Date.now()]):(U&&U.sort&&U.sort(),typeof z=="function"&&z.call(this,O,U))}}}if(a(d,"readdir"),process.version.substr(0,4)==="v0.8"){var p=tme(r);b=p.ReadStream,v=p.WriteStream}var h=r.ReadStream;h&&(b.prototype=Object.create(h.prototype),b.prototype.open=w);var g=r.WriteStream;g&&(v.prototype=Object.create(g.prototype),v.prototype.open=E),Object.defineProperty(r,"ReadStream",{get:a(function(){return b},"get"),set:a(function(D){b=D},"set"),enumerable:!0,configurable:!0}),Object.defineProperty(r,"WriteStream",{get:a(function(){return v},"get"),set:a(function(D){v=D},"set"),enumerable:!0,configurable:!0});var m=b;Object.defineProperty(r,"FileReadStream",{get:a(function(){return m},"get"),set:a(function(D){m=D},"set"),enumerable:!0,configurable:!0});var _=v;Object.defineProperty(r,"FileWriteStream",{get:a(function(){return _},"get"),set:a(function(D){_=D},"set"),enumerable:!0,configurable:!0});function b(D,F){return this instanceof b?(h.apply(this,arguments),this):b.apply(Object.create(b.prototype),arguments)}a(b,"ReadStream");function w(){var D=this;P(D.path,D.flags,D.mode,function(F,$){F?(D.autoClose&&D.destroy(),D.emit("error",F)):(D.fd=$,D.emit("open",$),D.read())})}a(w,"ReadStream$open");function v(D,F){return this instanceof v?(g.apply(this,arguments),this):v.apply(Object.create(v.prototype),arguments)}a(v,"WriteStream");function E(){var D=this;P(D.path,D.flags,D.mode,function(F,$){F?(D.destroy(),D.emit("error",F)):(D.fd=$,D.emit("open",$))})}a(E,"WriteStream$open");function S(D,F){return new r.ReadStream(D,F)}a(S,"createReadStream");function R(D,F){return new r.WriteStream(D,F)}a(R,"createWriteStream");var C=r.open;r.open=P;function P(D,F,$,H){return typeof $=="function"&&(H=$,$=null),ee(D,F,$,H);function ee(G,j,z,ie,O){return C(G,j,z,function(U,oe){U&&(U.code==="EMFILE"||U.code==="ENFILE")?np([ee,[G,j,z,ie],U,O||Date.now(),Date.now()]):typeof ie=="function"&&ie.apply(this,arguments)})}a(ee,"go$open")}return a(P,"open"),r}a(Px,"patch");function np(r){Ou("ENQUEUE",r[0].name,r[1]),wr[Fn].push(r),Fx()}a(np,"enqueue");var Nw;function w5(){for(var r=Date.now(),e=0;e<wr[Fn].length;++e)wr[Fn][e].length>2&&(wr[Fn][e][3]=r,wr[Fn][e][4]=r);Fx()}a(w5,"resetQueue");function Fx(){if(clearTimeout(Nw),Nw=void 0,wr[Fn].length!==0){var r=wr[Fn].shift(),e=r[0],t=r[1],n=r[2],i=r[3],s=r[4];if(i===void 0)Ou("RETRY",e.name,t),e.apply(null,t);else if(Date.now()-i>=6e4){Ou("TIMEOUT",e.name,t);var o=t.pop();typeof o=="function"&&o.call(null,n)}else{var c=Date.now()-s,l=Math.max(s-i,1),u=Math.min(l*1.2,100);c>=u?(Ou("RETRY",e.name,t),e.apply(null,t.concat([i]))):wr[Fn].push(r)}Nw===void 0&&(Nw=setTimeout(Fx,0))}}a(Fx,"retry")});var mi=T(Ja=>{"use strict";var v5=an().fromCallback,hi=ip(),ime=["access","appendFile","chmod","chown","close","copyFile","cp","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","glob","lchmod","lchown","lutimes","link","lstat","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","statfs","symlink","truncate","unlink","utimes","writeFile"].filter(r=>typeof hi[r]=="function");Object.assign(Ja,hi);ime.forEach(r=>{Ja[r]=v5(hi[r])});Ja.exists=function(r,e){return typeof e=="function"?hi.exists(r,e):new Promise(t=>hi.exists(r,t))};Ja.read=function(r,e,t,n,i,s){return typeof s=="function"?hi.read(r,e,t,n,i,s):new Promise((o,c)=>{hi.read(r,e,t,n,i,(l,u,f)=>{if(l)return c(l);o({bytesRead:u,buffer:f})})})};Ja.write=function(r,e,...t){return typeof t[t.length-1]=="function"?hi.write(r,e,...t):new Promise((n,i)=>{hi.write(r,e,...t,(s,o,c)=>{if(s)return i(s);n({bytesWritten:o,buffer:c})})})};Ja.readv=function(r,e,...t){return typeof t[t.length-1]=="function"?hi.readv(r,e,...t):new Promise((n,i)=>{hi.readv(r,e,...t,(s,o,c)=>{if(s)return i(s);n({bytesRead:o,buffers:c})})})};Ja.writev=function(r,e,...t){return typeof t[t.length-1]=="function"?hi.writev(r,e,...t):new Promise((n,i)=>{hi.writev(r,e,...t,(s,o,c)=>{if(s)return i(s);n({bytesWritten:o,buffers:c})})})};typeof hi.realpath.native=="function"?Ja.realpath.native=v5(hi.realpath.native):process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?","Warning","fs-extra-WARN0003")});var A5=T((Sje,T5)=>{"use strict";var sme=require("path");T5.exports.checkPath=a(function(e){if(process.platform==="win32"&&/[<>:"|?*]/.test(e.replace(sme.parse(e).root,""))){let n=new Error(`Path contains invalid characters: ${e}`);throw n.code="EINVAL",n}},"checkPath")});var O5=T((Eje,Dx)=>{"use strict";var I5=mi(),{checkPath:R5}=A5(),C5=a(r=>{let e={mode:511};return typeof r=="number"?r:{...e,...r}.mode},"getMode");Dx.exports.makeDir=async(r,e)=>(R5(r),I5.mkdir(r,{mode:C5(e),recursive:!0}));Dx.exports.makeDirSync=(r,e)=>(R5(r),I5.mkdirSync(r,{mode:C5(e),recursive:!0}))});var ro=T((Tje,x5)=>{"use strict";var ome=an().fromPromise,{makeDir:ame,makeDirSync:Nx}=O5(),kx=ome(ame);x5.exports={mkdirs:kx,mkdirsSync:Nx,mkdirp:kx,mkdirpSync:Nx,ensureDir:kx,ensureDirSync:Nx}});var tl=T((Aje,F5)=>{"use strict";var cme=an().fromPromise,P5=mi();function lme(r){return P5.access(r).then(()=>!0).catch(()=>!1)}a(lme,"pathExists");F5.exports={pathExists:cme(lme),pathExistsSync:P5.existsSync}});var Mx=T((Rje,L5)=>{"use strict";var sp=mi(),ume=an().fromPromise;async function fme(r,e,t){let n=await sp.open(r,"r+"),i=null;try{await sp.futimes(n,e,t)}catch(s){i=s}finally{try{await sp.close(n)}catch(s){i||(i=s)}}if(i)throw i}a(fme,"utimesMillis");function dme(r,e,t){let n=sp.openSync(r,"r+"),i=null;try{sp.futimesSync(n,e,t)}catch(s){i=s}finally{try{sp.closeSync(n)}catch(s){i||(i=s)}}if(i)throw i}a(dme,"utimesMillisSync");L5.exports={utimesMillis:ume(fme),utimesMillisSync:dme}});var xu=T((Oje,k5)=>{"use strict";var op=mi(),cn=require("path"),D5=an().fromPromise;function pme(r,e,t){let n=t.dereference?i=>op.stat(i,{bigint:!0}):i=>op.lstat(i,{bigint:!0});return Promise.all([n(r),n(e).catch(i=>{if(i.code==="ENOENT")return null;throw i})]).then(([i,s])=>({srcStat:i,destStat:s}))}a(pme,"getStats");function hme(r,e,t){let n,i=t.dereference?o=>op.statSync(o,{bigint:!0}):o=>op.lstatSync(o,{bigint:!0}),s=i(r);try{n=i(e)}catch(o){if(o.code==="ENOENT")return{srcStat:s,destStat:null};throw o}return{srcStat:s,destStat:n}}a(hme,"getStatsSync");async function mme(r,e,t,n){let{srcStat:i,destStat:s}=await pme(r,e,n);if(s){if(sg(i,s)){let o=cn.basename(r),c=cn.basename(e);if(t==="move"&&o!==c&&N5(o,c))return{srcStat:i,destStat:s,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(i.isDirectory()&&!s.isDirectory())throw new Error(`Cannot overwrite non-directory '${e}' with directory '${r}'.`);if(!i.isDirectory()&&s.isDirectory())throw new Error(`Cannot overwrite directory '${e}' with non-directory '${r}'.`)}if(i.isDirectory()&&Bx(r,e))throw new Error(Mw(r,e,t));return{srcStat:i,destStat:s}}a(mme,"checkPaths");function gme(r,e,t,n){let{srcStat:i,destStat:s}=hme(r,e,n);if(s){if(sg(i,s)){let o=cn.basename(r),c=cn.basename(e);if(t==="move"&&o!==c&&N5(o,c))return{srcStat:i,destStat:s,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(i.isDirectory()&&!s.isDirectory())throw new Error(`Cannot overwrite non-directory '${e}' with directory '${r}'.`);if(!i.isDirectory()&&s.isDirectory())throw new Error(`Cannot overwrite directory '${e}' with non-directory '${r}'.`)}if(i.isDirectory()&&Bx(r,e))throw new Error(Mw(r,e,t));return{srcStat:i,destStat:s}}a(gme,"checkPathsSync");function N5(r,e){return r.toLowerCase().normalize("NFC")===e.toLowerCase().normalize("NFC")}a(N5,"isCosmeticRename");async function $x(r,e,t,n){let i=cn.resolve(cn.dirname(r)),s=cn.resolve(cn.dirname(t));if(s===i||s===cn.parse(s).root)return;let o;try{o=await op.stat(s,{bigint:!0})}catch(c){if(c.code==="ENOENT")return $x(r,e,s,n);throw c}if(sg(e,o))throw new Error(Mw(r,t,n));return $x(r,e,s,n)}a($x,"checkParentPaths");function jx(r,e,t,n){let i=cn.resolve(cn.dirname(r)),s=cn.resolve(cn.dirname(t));if(s===i||s===cn.parse(s).root)return;let o;try{o=op.statSync(s,{bigint:!0})}catch(c){if(c.code==="ENOENT")return jx(r,e,s,n);throw c}if(sg(e,o))throw new Error(Mw(r,t,n));return jx(r,e,s,n)}a(jx,"checkParentPathsSync");function sg(r,e){return e.ino!==void 0&&e.dev!==void 0&&e.ino===r.ino&&e.dev===r.dev}a(sg,"areIdentical");function Bx(r,e){let t=cn.resolve(r).split(cn.sep).filter(i=>i),n=cn.resolve(e).split(cn.sep).filter(i=>i);return t.every((i,s)=>n[s]===i)}a(Bx,"isSrcSubdir");function Mw(r,e,t){return`Cannot ${t} '${r}' to a subdirectory of itself, '${e}'.`}a(Mw,"errMsg");k5.exports={checkPaths:D5(mme),checkPathsSync:gme,checkParentPaths:D5($x),checkParentPathsSync:jx,isSrcSubdir:Bx,areIdentical:sg}});var $5=T((Pje,M5)=>{"use strict";async function yme(r,e){let t=[];for await(let n of r)t.push(e(n).then(()=>null,i=>i??new Error("unknown error")));await Promise.all(t.map(n=>n.then(i=>{if(i!==null)throw i})))}a(yme,"asyncIteratorConcurrentProcess");M5.exports={asyncIteratorConcurrentProcess:yme}});var G5=T((Lje,V5)=>{"use strict";var Qn=mi(),og=require("path"),{mkdirs:_me}=ro(),{pathExists:bme}=tl(),{utimesMillis:Sme}=Mx(),ag=xu(),{asyncIteratorConcurrentProcess:wme}=$5();async function Eme(r,e,t={}){typeof t=="function"&&(t={filter:t}),t.clobber="clobber"in t?!!t.clobber:!0,t.overwrite="overwrite"in t?!!t.overwrite:t.clobber,t.preserveTimestamps&&process.arch==="ia32"&&process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended;
384
+ ${i}`;super(s,{path:t,violations:n},{message:"Fix the frontmatter so the asset satisfies its class shapes, then re-run create.",suggestion:"Run `validate schema --shapes-mode` on the vault to see the same shapes the gate applied."});this.exitCode=2;this.errorCode="VALIDATION_INVALID_FORMAT";this.assetPath=t,this.violations=n,this.guidance="The asset does not conform to the SHACL-lite shapes declared for its class. Add the missing required properties (or correct the offending value's class/datatype) and re-run `create --validate`. Omitting `--validate` skips the gate entirely."}static{a(this,"ShaclConformanceError")}}});var Ft=Be(()=>{"use strict";Ui();n5();i5();s5();o5();a5();c5();l5();u5();C2();f5();d5()});var an=T(O2=>{"use strict";O2.fromCallback=function(r){return Object.defineProperty(function(...e){if(typeof e[e.length-1]=="function")r.apply(this,e);else return new Promise((t,n)=>{e.push((i,s)=>i!=null?n(i):t(s)),r.apply(this,e)})},"name",{value:r.name})};O2.fromPromise=function(r){return Object.defineProperty(function(...e){let t=e[e.length-1];if(typeof t!="function")return r.apply(this,e);e.pop(),r.apply(this,e).then(n=>t(null,n),t)},"name",{value:r.name})}});var h5=T((fje,p5)=>{var el=require("constants"),Hhe=process.cwd,Lw=null,Yhe=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return Lw||(Lw=Hhe.call(process)),Lw};try{process.cwd()}catch{}typeof process.chdir=="function"&&(x2=process.chdir,process.chdir=function(r){Lw=null,x2.call(process,r)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,x2));var x2;p5.exports=Qhe;function Qhe(r){el.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&e(r),r.lutimes||t(r),r.chown=s(r.chown),r.fchown=s(r.fchown),r.lchown=s(r.lchown),r.chmod=n(r.chmod),r.fchmod=n(r.fchmod),r.lchmod=n(r.lchmod),r.chownSync=o(r.chownSync),r.fchownSync=o(r.fchownSync),r.lchownSync=o(r.lchownSync),r.chmodSync=i(r.chmodSync),r.fchmodSync=i(r.fchmodSync),r.lchmodSync=i(r.lchmodSync),r.stat=c(r.stat),r.fstat=c(r.fstat),r.lstat=c(r.lstat),r.statSync=l(r.statSync),r.fstatSync=l(r.fstatSync),r.lstatSync=l(r.lstatSync),r.chmod&&!r.lchmod&&(r.lchmod=function(f,d,p){p&&process.nextTick(p)},r.lchmodSync=function(){}),r.chown&&!r.lchown&&(r.lchown=function(f,d,p,h){h&&process.nextTick(h)},r.lchownSync=function(){}),Yhe==="win32"&&(r.rename=typeof r.rename!="function"?r.rename:(function(f){function d(p,h,g){var m=Date.now(),_=0;f(p,h,a(function b(w){if(w&&(w.code==="EACCES"||w.code==="EPERM"||w.code==="EBUSY")&&Date.now()-m<6e4){setTimeout(function(){r.stat(h,function(v,E){v&&v.code==="ENOENT"?f(p,h,b):g(w)})},_),_<100&&(_+=10);return}g&&g(w)},"CB"))}return a(d,"rename"),Object.setPrototypeOf&&Object.setPrototypeOf(d,f),d})(r.rename)),r.read=typeof r.read!="function"?r.read:(function(f){function d(p,h,g,m,_,b){var w;if(b&&typeof b=="function"){var v=0;w=a(function(E,S,R){if(E&&E.code==="EAGAIN"&&v<10)return v++,f.call(r,p,h,g,m,_,w);b.apply(this,arguments)},"callback")}return f.call(r,p,h,g,m,_,w)}return a(d,"read"),Object.setPrototypeOf&&Object.setPrototypeOf(d,f),d})(r.read),r.readSync=typeof r.readSync!="function"?r.readSync:(function(f){return function(d,p,h,g,m){for(var _=0;;)try{return f.call(r,d,p,h,g,m)}catch(b){if(b.code==="EAGAIN"&&_<10){_++;continue}throw b}}})(r.readSync);function e(f){f.lchmod=function(d,p,h){f.open(d,el.O_WRONLY|el.O_SYMLINK,p,function(g,m){if(g){h&&h(g);return}f.fchmod(m,p,function(_){f.close(m,function(b){h&&h(_||b)})})})},f.lchmodSync=function(d,p){var h=f.openSync(d,el.O_WRONLY|el.O_SYMLINK,p),g=!0,m;try{m=f.fchmodSync(h,p),g=!1}finally{if(g)try{f.closeSync(h)}catch{}else f.closeSync(h)}return m}}a(e,"patchLchmod");function t(f){el.hasOwnProperty("O_SYMLINK")&&f.futimes?(f.lutimes=function(d,p,h,g){f.open(d,el.O_SYMLINK,function(m,_){if(m){g&&g(m);return}f.futimes(_,p,h,function(b){f.close(_,function(w){g&&g(b||w)})})})},f.lutimesSync=function(d,p,h){var g=f.openSync(d,el.O_SYMLINK),m,_=!0;try{m=f.futimesSync(g,p,h),_=!1}finally{if(_)try{f.closeSync(g)}catch{}else f.closeSync(g)}return m}):f.futimes&&(f.lutimes=function(d,p,h,g){g&&process.nextTick(g)},f.lutimesSync=function(){})}a(t,"patchLutimes");function n(f){return f&&function(d,p,h){return f.call(r,d,p,function(g){u(g)&&(g=null),h&&h.apply(this,arguments)})}}a(n,"chmodFix");function i(f){return f&&function(d,p){try{return f.call(r,d,p)}catch(h){if(!u(h))throw h}}}a(i,"chmodFixSync");function s(f){return f&&function(d,p,h,g){return f.call(r,d,p,h,function(m){u(m)&&(m=null),g&&g.apply(this,arguments)})}}a(s,"chownFix");function o(f){return f&&function(d,p,h){try{return f.call(r,d,p,h)}catch(g){if(!u(g))throw g}}}a(o,"chownFixSync");function c(f){return f&&function(d,p,h){typeof p=="function"&&(h=p,p=null);function g(m,_){_&&(_.uid<0&&(_.uid+=4294967296),_.gid<0&&(_.gid+=4294967296)),h&&h.apply(this,arguments)}return a(g,"callback"),p?f.call(r,d,p,g):f.call(r,d,g)}}a(c,"statFix");function l(f){return f&&function(d,p){var h=p?f.call(r,d,p):f.call(r,d);return h&&(h.uid<0&&(h.uid+=4294967296),h.gid<0&&(h.gid+=4294967296)),h}}a(l,"statFixSync");function u(f){if(!f||f.code==="ENOSYS")return!0;var d=!process.getuid||process.getuid()!==0;return!!(d&&(f.code==="EINVAL"||f.code==="EPERM"))}a(u,"chownErOk")}a(Qhe,"patch")});var y5=T((pje,g5)=>{var m5=require("stream").Stream;g5.exports=Xhe;function Xhe(r){return{ReadStream:e,WriteStream:t};function e(n,i){if(!(this instanceof e))return new e(n,i);m5.call(this);var s=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=64*1024,i=i||{};for(var o=Object.keys(i),c=0,l=o.length;c<l;c++){var u=o[c];this[u]=i[u]}if(this.encoding&&this.setEncoding(this.encoding),this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){s._read()});return}r.open(this.path,this.flags,this.mode,function(f,d){if(f){s.emit("error",f),s.readable=!1;return}s.fd=d,s.emit("open",d),s._read()})}function t(n,i){if(!(this instanceof t))return new t(n,i);m5.call(this),this.path=n,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,i=i||{};for(var s=Object.keys(i),o=0,c=s.length;o<c;o++){var l=s[o];this[l]=i[l]}if(this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=r.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}a(Xhe,"legacy")});var b5=T((mje,_5)=>{"use strict";_5.exports=Zhe;var Jhe=Object.getPrototypeOf||function(r){return r.__proto__};function Zhe(r){if(r===null||typeof r!="object")return r;if(r instanceof Object)var e={__proto__:Jhe(r)};else var e=Object.create(null);return Object.getOwnPropertyNames(r).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}),e}a(Zhe,"clone")});var ip=T((yje,L2)=>{var wr=require("fs"),eme=h5(),tme=y5(),rme=b5(),Dw=require("util"),Fn,kw;typeof Symbol=="function"&&typeof Symbol.for=="function"?(Fn=Symbol.for("graceful-fs.queue"),kw=Symbol.for("graceful-fs.previous")):(Fn="___graceful-fs.queue",kw="___graceful-fs.previous");function nme(){}a(nme,"noop");function E5(r,e){Object.defineProperty(r,Fn,{get:a(function(){return e},"get")})}a(E5,"publishQueue");var Ou=nme;Dw.debuglog?Ou=Dw.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(Ou=a(function(){var r=Dw.format.apply(Dw,arguments);r="GFS4: "+r.split(/\n/).join(`
385
+ GFS4: `),console.error(r)},"debug"));wr[Fn]||(S5=global[Fn]||[],E5(wr,S5),wr.close=(function(r){function e(t,n){return r.call(wr,t,function(i){i||w5(),typeof n=="function"&&n.apply(this,arguments)})}return a(e,"close"),Object.defineProperty(e,kw,{value:r}),e})(wr.close),wr.closeSync=(function(r){function e(t){r.apply(wr,arguments),w5()}return a(e,"closeSync"),Object.defineProperty(e,kw,{value:r}),e})(wr.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){Ou(wr[Fn]),require("assert").equal(wr[Fn].length,0)}));var S5;global[Fn]||E5(global,wr[Fn]);L2.exports=P2(rme(wr));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!wr.__patched&&(L2.exports=P2(wr),wr.__patched=!0);function P2(r){eme(r),r.gracefulify=P2,r.createReadStream=S,r.createWriteStream=R;var e=r.readFile;r.readFile=t;function t(D,F,$){return typeof F=="function"&&($=F,F=null),H(D,F,$);function H(ee,G,j,z){return e(ee,G,function(ie){ie&&(ie.code==="EMFILE"||ie.code==="ENFILE")?np([H,[ee,G,j],ie,z||Date.now(),Date.now()]):typeof j=="function"&&j.apply(this,arguments)})}a(H,"go$readFile")}a(t,"readFile");var n=r.writeFile;r.writeFile=i;function i(D,F,$,H){return typeof $=="function"&&(H=$,$=null),ee(D,F,$,H);function ee(G,j,z,ie,O){return n(G,j,z,function(U){U&&(U.code==="EMFILE"||U.code==="ENFILE")?np([ee,[G,j,z,ie],U,O||Date.now(),Date.now()]):typeof ie=="function"&&ie.apply(this,arguments)})}a(ee,"go$writeFile")}a(i,"writeFile");var s=r.appendFile;s&&(r.appendFile=o);function o(D,F,$,H){return typeof $=="function"&&(H=$,$=null),ee(D,F,$,H);function ee(G,j,z,ie,O){return s(G,j,z,function(U){U&&(U.code==="EMFILE"||U.code==="ENFILE")?np([ee,[G,j,z,ie],U,O||Date.now(),Date.now()]):typeof ie=="function"&&ie.apply(this,arguments)})}a(ee,"go$appendFile")}a(o,"appendFile");var c=r.copyFile;c&&(r.copyFile=l);function l(D,F,$,H){return typeof $=="function"&&(H=$,$=0),ee(D,F,$,H);function ee(G,j,z,ie,O){return c(G,j,z,function(U){U&&(U.code==="EMFILE"||U.code==="ENFILE")?np([ee,[G,j,z,ie],U,O||Date.now(),Date.now()]):typeof ie=="function"&&ie.apply(this,arguments)})}a(ee,"go$copyFile")}a(l,"copyFile");var u=r.readdir;r.readdir=d;var f=/^v[0-5]\./;function d(D,F,$){typeof F=="function"&&($=F,F=null);var H=f.test(process.version)?a(function(j,z,ie,O){return u(j,ee(j,z,ie,O))},"go$readdir"):a(function(j,z,ie,O){return u(j,z,ee(j,z,ie,O))},"go$readdir");return H(D,F,$);function ee(G,j,z,ie){return function(O,U){O&&(O.code==="EMFILE"||O.code==="ENFILE")?np([H,[G,j,z],O,ie||Date.now(),Date.now()]):(U&&U.sort&&U.sort(),typeof z=="function"&&z.call(this,O,U))}}}if(a(d,"readdir"),process.version.substr(0,4)==="v0.8"){var p=tme(r);b=p.ReadStream,v=p.WriteStream}var h=r.ReadStream;h&&(b.prototype=Object.create(h.prototype),b.prototype.open=w);var g=r.WriteStream;g&&(v.prototype=Object.create(g.prototype),v.prototype.open=E),Object.defineProperty(r,"ReadStream",{get:a(function(){return b},"get"),set:a(function(D){b=D},"set"),enumerable:!0,configurable:!0}),Object.defineProperty(r,"WriteStream",{get:a(function(){return v},"get"),set:a(function(D){v=D},"set"),enumerable:!0,configurable:!0});var m=b;Object.defineProperty(r,"FileReadStream",{get:a(function(){return m},"get"),set:a(function(D){m=D},"set"),enumerable:!0,configurable:!0});var _=v;Object.defineProperty(r,"FileWriteStream",{get:a(function(){return _},"get"),set:a(function(D){_=D},"set"),enumerable:!0,configurable:!0});function b(D,F){return this instanceof b?(h.apply(this,arguments),this):b.apply(Object.create(b.prototype),arguments)}a(b,"ReadStream");function w(){var D=this;P(D.path,D.flags,D.mode,function(F,$){F?(D.autoClose&&D.destroy(),D.emit("error",F)):(D.fd=$,D.emit("open",$),D.read())})}a(w,"ReadStream$open");function v(D,F){return this instanceof v?(g.apply(this,arguments),this):v.apply(Object.create(v.prototype),arguments)}a(v,"WriteStream");function E(){var D=this;P(D.path,D.flags,D.mode,function(F,$){F?(D.destroy(),D.emit("error",F)):(D.fd=$,D.emit("open",$))})}a(E,"WriteStream$open");function S(D,F){return new r.ReadStream(D,F)}a(S,"createReadStream");function R(D,F){return new r.WriteStream(D,F)}a(R,"createWriteStream");var C=r.open;r.open=P;function P(D,F,$,H){return typeof $=="function"&&(H=$,$=null),ee(D,F,$,H);function ee(G,j,z,ie,O){return C(G,j,z,function(U,oe){U&&(U.code==="EMFILE"||U.code==="ENFILE")?np([ee,[G,j,z,ie],U,O||Date.now(),Date.now()]):typeof ie=="function"&&ie.apply(this,arguments)})}a(ee,"go$open")}return a(P,"open"),r}a(P2,"patch");function np(r){Ou("ENQUEUE",r[0].name,r[1]),wr[Fn].push(r),F2()}a(np,"enqueue");var Nw;function w5(){for(var r=Date.now(),e=0;e<wr[Fn].length;++e)wr[Fn][e].length>2&&(wr[Fn][e][3]=r,wr[Fn][e][4]=r);F2()}a(w5,"resetQueue");function F2(){if(clearTimeout(Nw),Nw=void 0,wr[Fn].length!==0){var r=wr[Fn].shift(),e=r[0],t=r[1],n=r[2],i=r[3],s=r[4];if(i===void 0)Ou("RETRY",e.name,t),e.apply(null,t);else if(Date.now()-i>=6e4){Ou("TIMEOUT",e.name,t);var o=t.pop();typeof o=="function"&&o.call(null,n)}else{var c=Date.now()-s,l=Math.max(s-i,1),u=Math.min(l*1.2,100);c>=u?(Ou("RETRY",e.name,t),e.apply(null,t.concat([i]))):wr[Fn].push(r)}Nw===void 0&&(Nw=setTimeout(F2,0))}}a(F2,"retry")});var mi=T(Ja=>{"use strict";var v5=an().fromCallback,hi=ip(),ime=["access","appendFile","chmod","chown","close","copyFile","cp","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","glob","lchmod","lchown","lutimes","link","lstat","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","statfs","symlink","truncate","unlink","utimes","writeFile"].filter(r=>typeof hi[r]=="function");Object.assign(Ja,hi);ime.forEach(r=>{Ja[r]=v5(hi[r])});Ja.exists=function(r,e){return typeof e=="function"?hi.exists(r,e):new Promise(t=>hi.exists(r,t))};Ja.read=function(r,e,t,n,i,s){return typeof s=="function"?hi.read(r,e,t,n,i,s):new Promise((o,c)=>{hi.read(r,e,t,n,i,(l,u,f)=>{if(l)return c(l);o({bytesRead:u,buffer:f})})})};Ja.write=function(r,e,...t){return typeof t[t.length-1]=="function"?hi.write(r,e,...t):new Promise((n,i)=>{hi.write(r,e,...t,(s,o,c)=>{if(s)return i(s);n({bytesWritten:o,buffer:c})})})};Ja.readv=function(r,e,...t){return typeof t[t.length-1]=="function"?hi.readv(r,e,...t):new Promise((n,i)=>{hi.readv(r,e,...t,(s,o,c)=>{if(s)return i(s);n({bytesRead:o,buffers:c})})})};Ja.writev=function(r,e,...t){return typeof t[t.length-1]=="function"?hi.writev(r,e,...t):new Promise((n,i)=>{hi.writev(r,e,...t,(s,o,c)=>{if(s)return i(s);n({bytesWritten:o,buffers:c})})})};typeof hi.realpath.native=="function"?Ja.realpath.native=v5(hi.realpath.native):process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?","Warning","fs-extra-WARN0003")});var A5=T((Sje,T5)=>{"use strict";var sme=require("path");T5.exports.checkPath=a(function(e){if(process.platform==="win32"&&/[<>:"|?*]/.test(e.replace(sme.parse(e).root,""))){let n=new Error(`Path contains invalid characters: ${e}`);throw n.code="EINVAL",n}},"checkPath")});var O5=T((Eje,D2)=>{"use strict";var I5=mi(),{checkPath:R5}=A5(),C5=a(r=>{let e={mode:511};return typeof r=="number"?r:{...e,...r}.mode},"getMode");D2.exports.makeDir=async(r,e)=>(R5(r),I5.mkdir(r,{mode:C5(e),recursive:!0}));D2.exports.makeDirSync=(r,e)=>(R5(r),I5.mkdirSync(r,{mode:C5(e),recursive:!0}))});var ro=T((Tje,x5)=>{"use strict";var ome=an().fromPromise,{makeDir:ame,makeDirSync:N2}=O5(),k2=ome(ame);x5.exports={mkdirs:k2,mkdirsSync:N2,mkdirp:k2,mkdirpSync:N2,ensureDir:k2,ensureDirSync:N2}});var tl=T((Aje,F5)=>{"use strict";var cme=an().fromPromise,P5=mi();function lme(r){return P5.access(r).then(()=>!0).catch(()=>!1)}a(lme,"pathExists");F5.exports={pathExists:cme(lme),pathExistsSync:P5.existsSync}});var M2=T((Rje,L5)=>{"use strict";var sp=mi(),ume=an().fromPromise;async function fme(r,e,t){let n=await sp.open(r,"r+"),i=null;try{await sp.futimes(n,e,t)}catch(s){i=s}finally{try{await sp.close(n)}catch(s){i||(i=s)}}if(i)throw i}a(fme,"utimesMillis");function dme(r,e,t){let n=sp.openSync(r,"r+"),i=null;try{sp.futimesSync(n,e,t)}catch(s){i=s}finally{try{sp.closeSync(n)}catch(s){i||(i=s)}}if(i)throw i}a(dme,"utimesMillisSync");L5.exports={utimesMillis:ume(fme),utimesMillisSync:dme}});var xu=T((Oje,k5)=>{"use strict";var op=mi(),cn=require("path"),D5=an().fromPromise;function pme(r,e,t){let n=t.dereference?i=>op.stat(i,{bigint:!0}):i=>op.lstat(i,{bigint:!0});return Promise.all([n(r),n(e).catch(i=>{if(i.code==="ENOENT")return null;throw i})]).then(([i,s])=>({srcStat:i,destStat:s}))}a(pme,"getStats");function hme(r,e,t){let n,i=t.dereference?o=>op.statSync(o,{bigint:!0}):o=>op.lstatSync(o,{bigint:!0}),s=i(r);try{n=i(e)}catch(o){if(o.code==="ENOENT")return{srcStat:s,destStat:null};throw o}return{srcStat:s,destStat:n}}a(hme,"getStatsSync");async function mme(r,e,t,n){let{srcStat:i,destStat:s}=await pme(r,e,n);if(s){if(sg(i,s)){let o=cn.basename(r),c=cn.basename(e);if(t==="move"&&o!==c&&N5(o,c))return{srcStat:i,destStat:s,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(i.isDirectory()&&!s.isDirectory())throw new Error(`Cannot overwrite non-directory '${e}' with directory '${r}'.`);if(!i.isDirectory()&&s.isDirectory())throw new Error(`Cannot overwrite directory '${e}' with non-directory '${r}'.`)}if(i.isDirectory()&&B2(r,e))throw new Error(Mw(r,e,t));return{srcStat:i,destStat:s}}a(mme,"checkPaths");function gme(r,e,t,n){let{srcStat:i,destStat:s}=hme(r,e,n);if(s){if(sg(i,s)){let o=cn.basename(r),c=cn.basename(e);if(t==="move"&&o!==c&&N5(o,c))return{srcStat:i,destStat:s,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(i.isDirectory()&&!s.isDirectory())throw new Error(`Cannot overwrite non-directory '${e}' with directory '${r}'.`);if(!i.isDirectory()&&s.isDirectory())throw new Error(`Cannot overwrite directory '${e}' with non-directory '${r}'.`)}if(i.isDirectory()&&B2(r,e))throw new Error(Mw(r,e,t));return{srcStat:i,destStat:s}}a(gme,"checkPathsSync");function N5(r,e){return r.toLowerCase().normalize("NFC")===e.toLowerCase().normalize("NFC")}a(N5,"isCosmeticRename");async function $2(r,e,t,n){let i=cn.resolve(cn.dirname(r)),s=cn.resolve(cn.dirname(t));if(s===i||s===cn.parse(s).root)return;let o;try{o=await op.stat(s,{bigint:!0})}catch(c){if(c.code==="ENOENT")return $2(r,e,s,n);throw c}if(sg(e,o))throw new Error(Mw(r,t,n));return $2(r,e,s,n)}a($2,"checkParentPaths");function j2(r,e,t,n){let i=cn.resolve(cn.dirname(r)),s=cn.resolve(cn.dirname(t));if(s===i||s===cn.parse(s).root)return;let o;try{o=op.statSync(s,{bigint:!0})}catch(c){if(c.code==="ENOENT")return j2(r,e,s,n);throw c}if(sg(e,o))throw new Error(Mw(r,t,n));return j2(r,e,s,n)}a(j2,"checkParentPathsSync");function sg(r,e){return e.ino!==void 0&&e.dev!==void 0&&e.ino===r.ino&&e.dev===r.dev}a(sg,"areIdentical");function B2(r,e){let t=cn.resolve(r).split(cn.sep).filter(i=>i),n=cn.resolve(e).split(cn.sep).filter(i=>i);return t.every((i,s)=>n[s]===i)}a(B2,"isSrcSubdir");function Mw(r,e,t){return`Cannot ${t} '${r}' to a subdirectory of itself, '${e}'.`}a(Mw,"errMsg");k5.exports={checkPaths:D5(mme),checkPathsSync:gme,checkParentPaths:D5($2),checkParentPathsSync:j2,isSrcSubdir:B2,areIdentical:sg}});var $5=T((Pje,M5)=>{"use strict";async function yme(r,e){let t=[];for await(let n of r)t.push(e(n).then(()=>null,i=>i??new Error("unknown error")));await Promise.all(t.map(n=>n.then(i=>{if(i!==null)throw i})))}a(yme,"asyncIteratorConcurrentProcess");M5.exports={asyncIteratorConcurrentProcess:yme}});var G5=T((Lje,V5)=>{"use strict";var Qn=mi(),og=require("path"),{mkdirs:_me}=ro(),{pathExists:bme}=tl(),{utimesMillis:Sme}=M2(),ag=xu(),{asyncIteratorConcurrentProcess:wme}=$5();async function Eme(r,e,t={}){typeof t=="function"&&(t={filter:t}),t.clobber="clobber"in t?!!t.clobber:!0,t.overwrite="overwrite"in t?!!t.overwrite:t.clobber,t.preserveTimestamps&&process.arch==="ia32"&&process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended;
386
386
 
387
- see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0001");let{srcStat:n,destStat:i}=await ag.checkPaths(r,e,"copy",t);if(await ag.checkParentPaths(r,n,e,"copy"),!await B5(r,e,t))return;let o=og.dirname(e);await bme(o)||await _me(o),await U5(i,r,e,t)}a(Eme,"copy");async function B5(r,e,t){return t.filter?t.filter(r,e):!0}a(B5,"runFilter");async function U5(r,e,t,n){let s=await(n.dereference?Qn.stat:Qn.lstat)(e);if(s.isDirectory())return Ime(s,r,e,t,n);if(s.isFile()||s.isCharacterDevice()||s.isBlockDevice())return vme(s,r,e,t,n);if(s.isSymbolicLink())return Rme(r,e,t,n);throw s.isSocket()?new Error(`Cannot copy a socket file: ${e}`):s.isFIFO()?new Error(`Cannot copy a FIFO pipe: ${e}`):new Error(`Unknown file: ${e}`)}a(U5,"getStatsAndPerformCopy");async function vme(r,e,t,n,i){if(!e)return j5(r,t,n,i);if(i.overwrite)return await Qn.unlink(n),j5(r,t,n,i);if(i.errorOnExist)throw new Error(`'${n}' already exists`)}a(vme,"onFile");async function j5(r,e,t,n){if(await Qn.copyFile(e,t),n.preserveTimestamps){Tme(r.mode)&&await Ame(t,r.mode);let i=await Qn.stat(e);await Sme(t,i.atime,i.mtime)}return Qn.chmod(t,r.mode)}a(j5,"copyFile");function Tme(r){return(r&128)===0}a(Tme,"fileIsNotWritable");function Ame(r,e){return Qn.chmod(r,e|128)}a(Ame,"makeFileWritable");async function Ime(r,e,t,n,i){e||await Qn.mkdir(n),await wme(await Qn.opendir(t),async s=>{let o=og.join(t,s.name),c=og.join(n,s.name);if(await B5(o,c,i)){let{destStat:u}=await ag.checkPaths(o,c,"copy",i);await U5(u,o,c,i)}}),e||await Qn.chmod(n,r.mode)}a(Ime,"onDir");async function Rme(r,e,t,n){let i=await Qn.readlink(e);if(n.dereference&&(i=og.resolve(process.cwd(),i)),!r)return Qn.symlink(i,t);let s=null;try{s=await Qn.readlink(t)}catch(o){if(o.code==="EINVAL"||o.code==="UNKNOWN")return Qn.symlink(i,t);throw o}if(n.dereference&&(s=og.resolve(process.cwd(),s)),i!==s){if(ag.isSrcSubdir(i,s))throw new Error(`Cannot copy '${i}' to a subdirectory of itself, '${s}'.`);if(ag.isSrcSubdir(s,i))throw new Error(`Cannot overwrite '${s}' with '${i}'.`)}return await Qn.unlink(t),Qn.symlink(i,t)}a(Rme,"onLink");V5.exports=Eme});var H5=T((Nje,z5)=>{"use strict";var gi=ip(),cg=require("path"),Cme=ro().mkdirsSync,Ome=Mx().utimesMillisSync,lg=xu();function xme(r,e,t){typeof t=="function"&&(t={filter:t}),t=t||{},t.clobber="clobber"in t?!!t.clobber:!0,t.overwrite="overwrite"in t?!!t.overwrite:t.clobber,t.preserveTimestamps&&process.arch==="ia32"&&process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended;
387
+ see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0001");let{srcStat:n,destStat:i}=await ag.checkPaths(r,e,"copy",t);if(await ag.checkParentPaths(r,n,e,"copy"),!await B5(r,e,t))return;let o=og.dirname(e);await bme(o)||await _me(o),await U5(i,r,e,t)}a(Eme,"copy");async function B5(r,e,t){return t.filter?t.filter(r,e):!0}a(B5,"runFilter");async function U5(r,e,t,n){let s=await(n.dereference?Qn.stat:Qn.lstat)(e);if(s.isDirectory())return Ime(s,r,e,t,n);if(s.isFile()||s.isCharacterDevice()||s.isBlockDevice())return vme(s,r,e,t,n);if(s.isSymbolicLink())return Rme(r,e,t,n);throw s.isSocket()?new Error(`Cannot copy a socket file: ${e}`):s.isFIFO()?new Error(`Cannot copy a FIFO pipe: ${e}`):new Error(`Unknown file: ${e}`)}a(U5,"getStatsAndPerformCopy");async function vme(r,e,t,n,i){if(!e)return j5(r,t,n,i);if(i.overwrite)return await Qn.unlink(n),j5(r,t,n,i);if(i.errorOnExist)throw new Error(`'${n}' already exists`)}a(vme,"onFile");async function j5(r,e,t,n){if(await Qn.copyFile(e,t),n.preserveTimestamps){Tme(r.mode)&&await Ame(t,r.mode);let i=await Qn.stat(e);await Sme(t,i.atime,i.mtime)}return Qn.chmod(t,r.mode)}a(j5,"copyFile");function Tme(r){return(r&128)===0}a(Tme,"fileIsNotWritable");function Ame(r,e){return Qn.chmod(r,e|128)}a(Ame,"makeFileWritable");async function Ime(r,e,t,n,i){e||await Qn.mkdir(n),await wme(await Qn.opendir(t),async s=>{let o=og.join(t,s.name),c=og.join(n,s.name);if(await B5(o,c,i)){let{destStat:u}=await ag.checkPaths(o,c,"copy",i);await U5(u,o,c,i)}}),e||await Qn.chmod(n,r.mode)}a(Ime,"onDir");async function Rme(r,e,t,n){let i=await Qn.readlink(e);if(n.dereference&&(i=og.resolve(process.cwd(),i)),!r)return Qn.symlink(i,t);let s=null;try{s=await Qn.readlink(t)}catch(o){if(o.code==="EINVAL"||o.code==="UNKNOWN")return Qn.symlink(i,t);throw o}if(n.dereference&&(s=og.resolve(process.cwd(),s)),i!==s){if(ag.isSrcSubdir(i,s))throw new Error(`Cannot copy '${i}' to a subdirectory of itself, '${s}'.`);if(ag.isSrcSubdir(s,i))throw new Error(`Cannot overwrite '${s}' with '${i}'.`)}return await Qn.unlink(t),Qn.symlink(i,t)}a(Rme,"onLink");V5.exports=Eme});var H5=T((Nje,z5)=>{"use strict";var gi=ip(),cg=require("path"),Cme=ro().mkdirsSync,Ome=M2().utimesMillisSync,lg=xu();function xme(r,e,t){typeof t=="function"&&(t={filter:t}),t=t||{},t.clobber="clobber"in t?!!t.clobber:!0,t.overwrite="overwrite"in t?!!t.overwrite:t.clobber,t.preserveTimestamps&&process.arch==="ia32"&&process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended;
388
388
 
389
- see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0002");let{srcStat:n,destStat:i}=lg.checkPathsSync(r,e,"copy",t);if(lg.checkParentPathsSync(r,n,e,"copy"),t.filter&&!t.filter(r,e))return;let s=cg.dirname(e);return gi.existsSync(s)||Cme(s),q5(i,r,e,t)}a(xme,"copySync");function q5(r,e,t,n){let s=(n.dereference?gi.statSync:gi.lstatSync)(e);if(s.isDirectory())return Mme(s,r,e,t,n);if(s.isFile()||s.isCharacterDevice()||s.isBlockDevice())return Pme(s,r,e,t,n);if(s.isSymbolicLink())return Bme(r,e,t,n);throw s.isSocket()?new Error(`Cannot copy a socket file: ${e}`):s.isFIFO()?new Error(`Cannot copy a FIFO pipe: ${e}`):new Error(`Unknown file: ${e}`)}a(q5,"getStats");function Pme(r,e,t,n,i){return e?Fme(r,t,n,i):W5(r,t,n,i)}a(Pme,"onFile");function Fme(r,e,t,n){if(n.overwrite)return gi.unlinkSync(t),W5(r,e,t,n);if(n.errorOnExist)throw new Error(`'${t}' already exists`)}a(Fme,"mayCopyFile");function W5(r,e,t,n){return gi.copyFileSync(e,t),n.preserveTimestamps&&Lme(r.mode,e,t),Ux(t,r.mode)}a(W5,"copyFile");function Lme(r,e,t){return Dme(r)&&Nme(t,r),kme(e,t)}a(Lme,"handleTimestamps");function Dme(r){return(r&128)===0}a(Dme,"fileIsNotWritable");function Nme(r,e){return Ux(r,e|128)}a(Nme,"makeFileWritable");function Ux(r,e){return gi.chmodSync(r,e)}a(Ux,"setDestMode");function kme(r,e){let t=gi.statSync(r);return Ome(e,t.atime,t.mtime)}a(kme,"setDestTimestamps");function Mme(r,e,t,n,i){return e?K5(t,n,i):$me(r.mode,t,n,i)}a(Mme,"onDir");function $me(r,e,t,n){return gi.mkdirSync(t),K5(e,t,n),Ux(t,r)}a($me,"mkDirAndCopy");function K5(r,e,t){let n=gi.opendirSync(r);try{let i;for(;(i=n.readSync())!==null;)jme(i.name,r,e,t)}finally{n.closeSync()}}a(K5,"copyDir");function jme(r,e,t,n){let i=cg.join(e,r),s=cg.join(t,r);if(n.filter&&!n.filter(i,s))return;let{destStat:o}=lg.checkPathsSync(i,s,"copy",n);return q5(o,i,s,n)}a(jme,"copyDirItem");function Bme(r,e,t,n){let i=gi.readlinkSync(e);if(n.dereference&&(i=cg.resolve(process.cwd(),i)),r){let s;try{s=gi.readlinkSync(t)}catch(o){if(o.code==="EINVAL"||o.code==="UNKNOWN")return gi.symlinkSync(i,t);throw o}if(n.dereference&&(s=cg.resolve(process.cwd(),s)),i!==s){if(lg.isSrcSubdir(i,s))throw new Error(`Cannot copy '${i}' to a subdirectory of itself, '${s}'.`);if(lg.isSrcSubdir(s,i))throw new Error(`Cannot overwrite '${s}' with '${i}'.`)}return Ume(i,t)}else return gi.symlinkSync(i,t)}a(Bme,"onLink");function Ume(r,e){return gi.unlinkSync(e),gi.symlinkSync(r,e)}a(Ume,"copyLink");z5.exports=xme});var $w=T((Mje,Y5)=>{"use strict";var Vme=an().fromPromise;Y5.exports={copy:Vme(G5()),copySync:H5()}});var ug=T(($je,X5)=>{"use strict";var Q5=ip(),Gme=an().fromCallback;function qme(r,e){Q5.rm(r,{recursive:!0,force:!0},e)}a(qme,"remove");function Wme(r){Q5.rmSync(r,{recursive:!0,force:!0})}a(Wme,"removeSync");X5.exports={remove:Gme(qme),removeSync:Wme}});var s6=T((Bje,i6)=>{"use strict";var Kme=an().fromPromise,e6=mi(),t6=require("path"),r6=ro(),n6=ug(),J5=Kme(a(async function(e){let t;try{t=await e6.readdir(e)}catch(n){if(n.code!=="ENOENT")throw n;return r6.mkdirs(e)}return Promise.all(t.map(n=>n6.remove(t6.join(e,n))))},"emptyDir"));function Z5(r){let e;try{e=e6.readdirSync(r)}catch(t){if(t.code!=="ENOENT")throw t;return r6.mkdirsSync(r)}e.forEach(t=>{t=t6.join(r,t),n6.removeSync(t)})}a(Z5,"emptyDirSync");i6.exports={emptyDirSync:Z5,emptydirSync:Z5,emptyDir:J5,emptydir:J5}});var l6=T((Vje,c6)=>{"use strict";var zme=an().fromPromise,o6=require("path"),Za=mi(),a6=ro();async function Hme(r){let e;try{e=await Za.stat(r)}catch{}if(e&&e.isFile())return;let t=o6.dirname(r),n=null;try{n=await Za.stat(t)}catch(i){if(i.code==="ENOENT"){await a6.mkdirs(t),await Za.writeFile(r,"");return}else throw i}n.isDirectory()?await Za.writeFile(r,""):await Za.readdir(t)}a(Hme,"createFile");function Yme(r){let e;try{e=Za.statSync(r)}catch{}if(e&&e.isFile())return;let t=o6.dirname(r);try{Za.statSync(t).isDirectory()||Za.readdirSync(t)}catch(n){if(n&&n.code==="ENOENT")a6.mkdirsSync(t);else throw n}Za.writeFileSync(r,"")}a(Yme,"createFileSync");c6.exports={createFile:zme(Hme),createFileSync:Yme}});var h6=T((qje,p6)=>{"use strict";var Qme=an().fromPromise,u6=require("path"),rl=mi(),f6=ro(),{pathExists:Xme}=tl(),{areIdentical:d6}=xu();async function Jme(r,e){let t;try{t=await rl.lstat(e,{bigint:!0})}catch{}let n;try{n=await rl.lstat(r,{bigint:!0})}catch(o){throw o.message=o.message.replace("lstat","ensureLink"),o}if(t&&d6(n,t))return;let i=u6.dirname(e);await Xme(i)||await f6.mkdirs(i),await rl.link(r,e)}a(Jme,"createLink");function Zme(r,e){let t;try{t=rl.lstatSync(e,{bigint:!0})}catch{}try{let s=rl.lstatSync(r,{bigint:!0});if(t&&d6(s,t))return}catch(s){throw s.message=s.message.replace("lstat","ensureLink"),s}let n=u6.dirname(e);return rl.existsSync(n)||f6.mkdirsSync(n),rl.linkSync(r,e)}a(Zme,"createLinkSync");p6.exports={createLink:Qme(Jme),createLinkSync:Zme}});var g6=T((Kje,m6)=>{"use strict";var nl=require("path"),fg=mi(),{pathExists:ege}=tl(),tge=an().fromPromise;async function rge(r,e){if(nl.isAbsolute(r)){try{await fg.lstat(r)}catch(s){throw s.message=s.message.replace("lstat","ensureSymlink"),s}return{toCwd:r,toDst:r}}let t=nl.dirname(e),n=nl.join(t,r);if(await ege(n))return{toCwd:n,toDst:r};try{await fg.lstat(r)}catch(s){throw s.message=s.message.replace("lstat","ensureSymlink"),s}return{toCwd:r,toDst:nl.relative(t,r)}}a(rge,"symlinkPaths");function nge(r,e){if(nl.isAbsolute(r)){if(!fg.existsSync(r))throw new Error("absolute srcpath does not exist");return{toCwd:r,toDst:r}}let t=nl.dirname(e),n=nl.join(t,r);if(fg.existsSync(n))return{toCwd:n,toDst:r};if(!fg.existsSync(r))throw new Error("relative srcpath does not exist");return{toCwd:r,toDst:nl.relative(t,r)}}a(nge,"symlinkPathsSync");m6.exports={symlinkPaths:tge(rge),symlinkPathsSync:nge}});var b6=T((Hje,_6)=>{"use strict";var y6=mi(),ige=an().fromPromise;async function sge(r,e){if(e)return e;let t;try{t=await y6.lstat(r)}catch{return"file"}return t&&t.isDirectory()?"dir":"file"}a(sge,"symlinkType");function oge(r,e){if(e)return e;let t;try{t=y6.lstatSync(r)}catch{return"file"}return t&&t.isDirectory()?"dir":"file"}a(oge,"symlinkTypeSync");_6.exports={symlinkType:ige(sge),symlinkTypeSync:oge}});var E6=T((Qje,w6)=>{"use strict";var age=an().fromPromise,il=require("path"),Vi=mi(),{mkdirs:cge,mkdirsSync:lge}=ro(),{symlinkPaths:uge,symlinkPathsSync:fge}=g6(),{symlinkType:dge,symlinkTypeSync:pge}=b6(),{pathExists:hge}=tl(),{areIdentical:S6}=xu();async function mge(r,e,t){let n;try{n=await Vi.lstat(e)}catch{}if(n&&n.isSymbolicLink()){let c;if(il.isAbsolute(r))c=await Vi.stat(r,{bigint:!0});else{let u=il.dirname(e),f=il.join(u,r);try{c=await Vi.stat(f,{bigint:!0})}catch{c=await Vi.stat(r,{bigint:!0})}}let l;try{l=await Vi.stat(e,{bigint:!0})}catch(u){if(u.code!=="ENOENT")throw u}if(l&&S6(c,l))return}let i=await uge(r,e);r=i.toDst;let s=await dge(i.toCwd,t),o=il.dirname(e);return await hge(o)||await cge(o),Vi.symlink(r,e,s)}a(mge,"createSymlink");function gge(r,e,t){let n;try{n=Vi.lstatSync(e)}catch{}if(n&&n.isSymbolicLink()){let c;if(il.isAbsolute(r))c=Vi.statSync(r,{bigint:!0});else{let u=il.dirname(e),f=il.join(u,r);try{c=Vi.statSync(f,{bigint:!0})}catch{c=Vi.statSync(r,{bigint:!0})}}let l;try{l=Vi.statSync(e,{bigint:!0})}catch(u){if(u.code!=="ENOENT")throw u}if(l&&S6(c,l))return}let i=fge(r,e);r=i.toDst,t=pge(i.toCwd,t);let s=il.dirname(e);return Vi.existsSync(s)||lge(s),Vi.symlinkSync(r,e,t)}a(gge,"createSymlinkSync");w6.exports={createSymlink:age(mge),createSymlinkSync:gge}});var x6=T((Jje,O6)=>{"use strict";var{createFile:v6,createFileSync:T6}=l6(),{createLink:A6,createLinkSync:I6}=h6(),{createSymlink:R6,createSymlinkSync:C6}=E6();O6.exports={createFile:v6,createFileSync:T6,ensureFile:v6,ensureFileSync:T6,createLink:A6,createLinkSync:I6,ensureLink:A6,ensureLinkSync:I6,createSymlink:R6,createSymlinkSync:C6,ensureSymlink:R6,ensureSymlinkSync:C6}});var jw=T((Zje,P6)=>{function yge(r,{EOL:e=`
390
- `,finalEOL:t=!0,replacer:n=null,spaces:i}={}){let s=t?e:"";return JSON.stringify(r,n,i).replace(/\n/g,e)+s}a(yge,"stringify");function _ge(r){return Buffer.isBuffer(r)&&(r=r.toString("utf8")),r.replace(/^\uFEFF/,"")}a(_ge,"stripBom");P6.exports={stringify:yge,stripBom:_ge}});var N6=T((t4e,D6)=>{var ap;try{ap=ip()}catch{ap=require("fs")}var Bw=an(),{stringify:F6,stripBom:L6}=jw();async function bge(r,e={}){typeof e=="string"&&(e={encoding:e});let t=e.fs||ap,n="throws"in e?e.throws:!0,i=await Bw.fromCallback(t.readFile)(r,e);i=L6(i);let s;try{s=JSON.parse(i,e?e.reviver:null)}catch(o){if(n)throw o.message=`${r}: ${o.message}`,o;return null}return s}a(bge,"_readFile");var Sge=Bw.fromPromise(bge);function wge(r,e={}){typeof e=="string"&&(e={encoding:e});let t=e.fs||ap,n="throws"in e?e.throws:!0;try{let i=t.readFileSync(r,e);return i=L6(i),JSON.parse(i,e.reviver)}catch(i){if(n)throw i.message=`${r}: ${i.message}`,i;return null}}a(wge,"readFileSync");async function Ege(r,e,t={}){let n=t.fs||ap,i=F6(e,t);await Bw.fromCallback(n.writeFile)(r,i,t)}a(Ege,"_writeFile");var vge=Bw.fromPromise(Ege);function Tge(r,e,t={}){let n=t.fs||ap,i=F6(e,t);return n.writeFileSync(r,i,t)}a(Tge,"writeFileSync");D6.exports={readFile:Sge,readFileSync:wge,writeFile:vge,writeFileSync:Tge}});var M6=T((n4e,k6)=>{"use strict";var Uw=N6();k6.exports={readJson:Uw.readFile,readJsonSync:Uw.readFileSync,writeJson:Uw.writeFile,writeJsonSync:Uw.writeFileSync}});var Vw=T((i4e,B6)=>{"use strict";var Age=an().fromPromise,Vx=mi(),$6=require("path"),j6=ro(),Ige=tl().pathExists;async function Rge(r,e,t="utf-8"){let n=$6.dirname(r);return await Ige(n)||await j6.mkdirs(n),Vx.writeFile(r,e,t)}a(Rge,"outputFile");function Cge(r,...e){let t=$6.dirname(r);Vx.existsSync(t)||j6.mkdirsSync(t),Vx.writeFileSync(r,...e)}a(Cge,"outputFileSync");B6.exports={outputFile:Age(Rge),outputFileSync:Cge}});var V6=T((o4e,U6)=>{"use strict";var{stringify:Oge}=jw(),{outputFile:xge}=Vw();async function Pge(r,e,t={}){let n=Oge(e,t);await xge(r,n,t)}a(Pge,"outputJson");U6.exports=Pge});var q6=T((c4e,G6)=>{"use strict";var{stringify:Fge}=jw(),{outputFileSync:Lge}=Vw();function Dge(r,e,t){let n=Fge(e,t);Lge(r,n,t)}a(Dge,"outputJsonSync");G6.exports=Dge});var K6=T((u4e,W6)=>{"use strict";var Nge=an().fromPromise,yi=M6();yi.outputJson=Nge(V6());yi.outputJsonSync=q6();yi.outputJSON=yi.outputJson;yi.outputJSONSync=yi.outputJsonSync;yi.writeJSON=yi.writeJson;yi.writeJSONSync=yi.writeJsonSync;yi.readJSON=yi.readJson;yi.readJSONSync=yi.readJsonSync;W6.exports=yi});var X6=T((f4e,Q6)=>{"use strict";var kge=mi(),z6=require("path"),{copy:Mge}=$w(),{remove:Y6}=ug(),{mkdirp:$ge}=ro(),{pathExists:jge}=tl(),H6=xu();async function Bge(r,e,t={}){let n=t.overwrite||t.clobber||!1,{srcStat:i,isChangingCase:s=!1}=await H6.checkPaths(r,e,"move",t);await H6.checkParentPaths(r,i,e,"move");let o=z6.dirname(e);return z6.parse(o).root!==o&&await $ge(o),Uge(r,e,n,s)}a(Bge,"move");async function Uge(r,e,t,n){if(!n){if(t)await Y6(e);else if(await jge(e))throw new Error("dest already exists.")}try{await kge.rename(r,e)}catch(i){if(i.code!=="EXDEV")throw i;await Vge(r,e,t)}}a(Uge,"doRename");async function Vge(r,e,t){return await Mge(r,e,{overwrite:t,errorOnExist:!0,preserveTimestamps:!0}),Y6(r)}a(Vge,"moveAcrossDevice");Q6.exports=Bge});var r8=T((p4e,t8)=>{"use strict";var Z6=ip(),qx=require("path"),Gge=$w().copySync,e8=ug().removeSync,qge=ro().mkdirpSync,J6=xu();function Wge(r,e,t){t=t||{};let n=t.overwrite||t.clobber||!1,{srcStat:i,isChangingCase:s=!1}=J6.checkPathsSync(r,e,"move",t);return J6.checkParentPathsSync(r,i,e,"move"),Kge(e)||qge(qx.dirname(e)),zge(r,e,n,s)}a(Wge,"moveSync");function Kge(r){let e=qx.dirname(r);return qx.parse(e).root===e}a(Kge,"isParentRoot");function zge(r,e,t,n){if(n)return Gx(r,e,t);if(t)return e8(e),Gx(r,e,t);if(Z6.existsSync(e))throw new Error("dest already exists.");return Gx(r,e,t)}a(zge,"doRename");function Gx(r,e,t){try{Z6.renameSync(r,e)}catch(n){if(n.code!=="EXDEV")throw n;return Hge(r,e,t)}}a(Gx,"rename");function Hge(r,e,t){return Gge(r,e,{overwrite:t,errorOnExist:!0,preserveTimestamps:!0}),e8(r)}a(Hge,"moveAcrossDevice");t8.exports=Wge});var i8=T((m4e,n8)=>{"use strict";var Yge=an().fromPromise;n8.exports={move:Yge(X6()),moveSync:r8()}});var Wo=T((g4e,s8)=>{"use strict";s8.exports={...mi(),...$w(),...s6(),...x6(),...K6(),...ro(),...i8(),...Vw(),...tl(),...ug()}});function Jn(r,e){return{tagName:r,nodeKind:"scalar",implicit:e.implicit??!1,matchByTagPrefix:e.matchByTagPrefix??!1,implicitFirstChars:e.implicitFirstChars??null,resolve:e.resolve,identify:e.identify,represent:e.represent??(t=>String(t)),representTagName:e.representTagName??(()=>r)}}function lP(r,e){let t=e.finalize===void 0;return{tagName:r,nodeKind:"sequence",implicit:!1,matchByTagPrefix:e.matchByTagPrefix??!1,create:e.create,addItem:e.addItem,finalize:e.finalize??(n=>n),carrierIsResult:t,identify:e.identify,represent:e.represent??(n=>n),representTagName:e.representTagName??(()=>r)}}function Hw(r,e){let t=e.finalize===void 0;return{tagName:r,nodeKind:"mapping",implicit:!1,matchByTagPrefix:e.matchByTagPrefix??!1,create:e.create,addPair:e.addPair,has:e.has,keys:e.keys,get:e.get,finalize:e.finalize??(n=>n),carrierIsResult:t,identify:e.identify,represent:e.represent??(n=>n),representTagName:e.representTagName??(()=>r)}}function pye(r){let e=r,t=1;return(e[0]==="-"||e[0]==="+")&&(e[0]==="-"&&(t=-1),e=e.slice(1)),e.startsWith("0b")?t*parseInt(e.slice(2),2):e.startsWith("0o")?t*parseInt(e.slice(2),8):e.startsWith("0x")?t*parseInt(e.slice(2),16):t*parseInt(e,10)}function hye(r,e){if(e){if(!dye.test(r))return Et}else if(!fye.test(r))return Et;let t=pye(r);return Number.isFinite(t)?t:Et}function yye(r){let e=r,t=1;return(e[0]==="-"||e[0]==="+")&&(e[0]==="-"&&(t=-1),e=e.slice(1)),e.startsWith("0b")?t*parseInt(e.slice(2),2):e.startsWith("0o")?t*parseInt(e.slice(2),8):e.startsWith("0x")?t*parseInt(e.slice(2),16):t*parseInt(e,10)}function _ye(r,e){if(e){if(!gye.test(r))return Et}else if(!mye.test(r))return Et;let t=yye(r);return Number.isFinite(t)?t:Et}function wye(r){let e=r.replace(/_/g,""),t=1;if((e[0]==="-"||e[0]==="+")&&(e[0]==="-"&&(t=-1),e=e.slice(1)),e.startsWith("0b"))return t*parseInt(e.slice(2),2);if(e.startsWith("0x"))return t*parseInt(e.slice(2),16);if(e.includes(":")){let n=0;for(let i of e.split(":"))n=n*60+Number(i);return t*n}return e!=="0"&&e[0]==="0"?t*parseInt(e,8):t*parseInt(e,10)}function Eye(r){if(!Sye.test(r))return Et;let e=wye(r);return Number.isFinite(e)?e:Et}function Aye(r){if(!vye.test(r))return Et;let e=r.toLowerCase(),t=e[0]==="-"?-1:1;if("+-".includes(e[0])&&(e=e.slice(1)),e===".inf")return t===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY;if(e===".nan")return NaN;let n=t*parseFloat(e);return Number.isFinite(n)||Tye.test(r)?n:Et}function Iye(r){if(isNaN(r))return".nan";if(r===Number.POSITIVE_INFINITY)return".inf";if(r===Number.NEGATIVE_INFINITY)return"-.inf";if(Object.is(r,-0))return"-0.0";let e=r.toString(10);return/^[-+]?[0-9]+e/.test(e)?e.replace("e",".e"):e}function Oye(r,e){if(e){if(!Cye.test(r))return Et;let n=r.toLowerCase(),i=n[0]==="-"?-1:1;if("+-".includes(n[0])&&(n=n.slice(1)),n===".inf")return i===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY;if(n===".nan")return NaN;let s=i*parseFloat(n);return Number.isFinite(s)?s:Et}if(!Rye.test(r))return Et;let t=Number(r);return Number.isFinite(t)?t:Et}function xye(r){if(isNaN(r))return".nan";if(r===Number.POSITIVE_INFINITY)return".inf";if(r===Number.NEGATIVE_INFINITY)return"-.inf";if(Object.is(r,-0))return"-0.0";let e=r.toString(10);return/^[-+]?[0-9]+e/.test(e)?e.replace("e",".e"):e}function Dye(r){if(!Fye.test(r))return Et;let e=r.toLowerCase().replace(/_/g,""),t=e[0]==="-"?-1:1;if("+-".includes(e[0])&&(e=e.slice(1)),e===".inf")return t===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY;if(e===".nan")return NaN;let n=0;if(e.includes(":")){for(let i of e.split(":"))n=n*60+Number(i);n*=t}else n=t*parseFloat(e);return Number.isFinite(n)||Lye.test(r)?n:Et}function Nye(r){if(isNaN(r))return".nan";if(r===Number.POSITIVE_INFINITY)return".inf";if(r===Number.NEGATIVE_INFINITY)return"-.inf";if(Object.is(r,-0))return"-0.0";let e=r.toString(10);return/^[-+]?[0-9]+e/.test(e)?e.replace("e",".e"):e}function $ye(r){let e=r.replace(/\s/g,"");if(e.length%4!==0||!Mye.test(e))return Et;let t=atob(e),n=new Uint8Array(t.length);for(let i=0;i<t.length;i++)n[i]=t.charCodeAt(i);return n}function jye(r){let e="";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return btoa(e)}function o8(r,e,t,n=0,i=0,s=0,o=0){let c=new Date(Date.UTC(r,e,t,n,i,s,o));return c.setUTCFullYear(r,e,t),c}function Gye(r){let e=Uye.exec(r);if(e===null&&(e=Vye.exec(r)),e===null)return Et;let t=+e[1],n=+e[2]-1,i=+e[3];if(!e[4]){let f=o8(t,n,i);return f.getUTCFullYear()!==t||f.getUTCMonth()!==n||f.getUTCDate()!==i?Et:f}let s=+e[4],o=+e[5],c=+e[6],l=0;if(s>23||o>59||c>59)return Et;if(e[7]){let f=e[7].slice(0,3);for(;f.length<3;)f+="0";l=+f}let u=o8(t,n,i,s,o,c,l);if(u.getUTCFullYear()!==t||u.getUTCMonth()!==n||u.getUTCDate()!==i)return Et;if(e[9]){let f=+e[10],d=+(e[11]||0);if(f>23||d>59)return Et;let p=(f*60+d)*6e4;u.setTime(u.getTime()-(e[9]==="-"?-p:p))}return u}function Yw(r){if(r===null||typeof r!="object"||Array.isArray(r))return!1;let e=Object.getPrototypeOf(r);return e===null||e===Object.prototype}function Zx(r,e){let t={};for(let n of e)r[n]!==void 0&&(t[n]=r[n]);return t}function Qye(){return{scalar:Object.create(null),sequence:Object.create(null),mapping:Object.create(null)}}function Xye(){return{scalar:[],sequence:[],mapping:[]}}function Jye(r){let e=[];for(let t of r){let n=e.length;for(let i=0;i<e.length;i++){let s=e[i];if(s.nodeKind===t.nodeKind&&s.tagName===t.tagName&&s.matchByTagPrefix===t.matchByTagPrefix){n=i;break}}e[n]=t}return e}function a8(r){if(Array.isArray(r)){let e=Array.prototype.slice.call(r);for(let t=0;t<e.length;t++){if(Array.isArray(e[t]))return null;typeof e[t]=="object"&&Object.prototype.toString.call(e[t])==="[object Object]"&&(e[t]="[object Object]")}return String(e)}return typeof r=="object"&&Object.prototype.toString.call(r)==="[object Object]"?"[object Object]":String(r)}function Wx(r,e,t,n,i){let s="",o="",c=Math.floor(i/2)-1;return n-e>c&&(s=" ... ",e=n-c+s.length),t-n>c&&(o=" ...",t=n+c-o.length),{str:s+r.slice(e,t).replace(/\t/g,"\u2192")+o,pos:n-e+s.length}}function Kx(r,e){return" ".repeat(Math.max(e-r.length,0))+r}function t0e(r,e){if(!r.buffer)return null;let t={...e0e,...e},n=/\r?\n|\r|\0/g,i=[0],s=[],o,c=-1;for(;o=n.exec(r.buffer);)s.push(o.index),i.push(o.index+o[0].length),r.position<=o.index&&c<0&&(c=i.length-2);c<0&&(c=i.length-1);let l="",u=Math.min(r.line+t.linesAfter,s.length).toString().length,f=t.maxLength-(t.indent+u+3);for(let p=1;p<=t.linesBefore&&!(c-p<0);p++){let h=Wx(r.buffer,i[c-p],s[c-p],r.position-(i[c]-i[c-p]),f);l=`${" ".repeat(t.indent)}${Kx((r.line-p+1).toString(),u)} | ${h.str}
391
- ${l}`}let d=Wx(r.buffer,i[c],s[c],r.position,f);l+=`${" ".repeat(t.indent)}${Kx((r.line+1).toString(),u)} | ${d.str}
389
+ see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0002");let{srcStat:n,destStat:i}=lg.checkPathsSync(r,e,"copy",t);if(lg.checkParentPathsSync(r,n,e,"copy"),t.filter&&!t.filter(r,e))return;let s=cg.dirname(e);return gi.existsSync(s)||Cme(s),q5(i,r,e,t)}a(xme,"copySync");function q5(r,e,t,n){let s=(n.dereference?gi.statSync:gi.lstatSync)(e);if(s.isDirectory())return Mme(s,r,e,t,n);if(s.isFile()||s.isCharacterDevice()||s.isBlockDevice())return Pme(s,r,e,t,n);if(s.isSymbolicLink())return Bme(r,e,t,n);throw s.isSocket()?new Error(`Cannot copy a socket file: ${e}`):s.isFIFO()?new Error(`Cannot copy a FIFO pipe: ${e}`):new Error(`Unknown file: ${e}`)}a(q5,"getStats");function Pme(r,e,t,n,i){return e?Fme(r,t,n,i):W5(r,t,n,i)}a(Pme,"onFile");function Fme(r,e,t,n){if(n.overwrite)return gi.unlinkSync(t),W5(r,e,t,n);if(n.errorOnExist)throw new Error(`'${t}' already exists`)}a(Fme,"mayCopyFile");function W5(r,e,t,n){return gi.copyFileSync(e,t),n.preserveTimestamps&&Lme(r.mode,e,t),U2(t,r.mode)}a(W5,"copyFile");function Lme(r,e,t){return Dme(r)&&Nme(t,r),kme(e,t)}a(Lme,"handleTimestamps");function Dme(r){return(r&128)===0}a(Dme,"fileIsNotWritable");function Nme(r,e){return U2(r,e|128)}a(Nme,"makeFileWritable");function U2(r,e){return gi.chmodSync(r,e)}a(U2,"setDestMode");function kme(r,e){let t=gi.statSync(r);return Ome(e,t.atime,t.mtime)}a(kme,"setDestTimestamps");function Mme(r,e,t,n,i){return e?K5(t,n,i):$me(r.mode,t,n,i)}a(Mme,"onDir");function $me(r,e,t,n){return gi.mkdirSync(t),K5(e,t,n),U2(t,r)}a($me,"mkDirAndCopy");function K5(r,e,t){let n=gi.opendirSync(r);try{let i;for(;(i=n.readSync())!==null;)jme(i.name,r,e,t)}finally{n.closeSync()}}a(K5,"copyDir");function jme(r,e,t,n){let i=cg.join(e,r),s=cg.join(t,r);if(n.filter&&!n.filter(i,s))return;let{destStat:o}=lg.checkPathsSync(i,s,"copy",n);return q5(o,i,s,n)}a(jme,"copyDirItem");function Bme(r,e,t,n){let i=gi.readlinkSync(e);if(n.dereference&&(i=cg.resolve(process.cwd(),i)),r){let s;try{s=gi.readlinkSync(t)}catch(o){if(o.code==="EINVAL"||o.code==="UNKNOWN")return gi.symlinkSync(i,t);throw o}if(n.dereference&&(s=cg.resolve(process.cwd(),s)),i!==s){if(lg.isSrcSubdir(i,s))throw new Error(`Cannot copy '${i}' to a subdirectory of itself, '${s}'.`);if(lg.isSrcSubdir(s,i))throw new Error(`Cannot overwrite '${s}' with '${i}'.`)}return Ume(i,t)}else return gi.symlinkSync(i,t)}a(Bme,"onLink");function Ume(r,e){return gi.unlinkSync(e),gi.symlinkSync(r,e)}a(Ume,"copyLink");z5.exports=xme});var $w=T((Mje,Y5)=>{"use strict";var Vme=an().fromPromise;Y5.exports={copy:Vme(G5()),copySync:H5()}});var ug=T(($je,X5)=>{"use strict";var Q5=ip(),Gme=an().fromCallback;function qme(r,e){Q5.rm(r,{recursive:!0,force:!0},e)}a(qme,"remove");function Wme(r){Q5.rmSync(r,{recursive:!0,force:!0})}a(Wme,"removeSync");X5.exports={remove:Gme(qme),removeSync:Wme}});var s6=T((Bje,i6)=>{"use strict";var Kme=an().fromPromise,e6=mi(),t6=require("path"),r6=ro(),n6=ug(),J5=Kme(a(async function(e){let t;try{t=await e6.readdir(e)}catch(n){if(n.code!=="ENOENT")throw n;return r6.mkdirs(e)}return Promise.all(t.map(n=>n6.remove(t6.join(e,n))))},"emptyDir"));function Z5(r){let e;try{e=e6.readdirSync(r)}catch(t){if(t.code!=="ENOENT")throw t;return r6.mkdirsSync(r)}e.forEach(t=>{t=t6.join(r,t),n6.removeSync(t)})}a(Z5,"emptyDirSync");i6.exports={emptyDirSync:Z5,emptydirSync:Z5,emptyDir:J5,emptydir:J5}});var l6=T((Vje,c6)=>{"use strict";var zme=an().fromPromise,o6=require("path"),Za=mi(),a6=ro();async function Hme(r){let e;try{e=await Za.stat(r)}catch{}if(e&&e.isFile())return;let t=o6.dirname(r),n=null;try{n=await Za.stat(t)}catch(i){if(i.code==="ENOENT"){await a6.mkdirs(t),await Za.writeFile(r,"");return}else throw i}n.isDirectory()?await Za.writeFile(r,""):await Za.readdir(t)}a(Hme,"createFile");function Yme(r){let e;try{e=Za.statSync(r)}catch{}if(e&&e.isFile())return;let t=o6.dirname(r);try{Za.statSync(t).isDirectory()||Za.readdirSync(t)}catch(n){if(n&&n.code==="ENOENT")a6.mkdirsSync(t);else throw n}Za.writeFileSync(r,"")}a(Yme,"createFileSync");c6.exports={createFile:zme(Hme),createFileSync:Yme}});var h6=T((qje,p6)=>{"use strict";var Qme=an().fromPromise,u6=require("path"),rl=mi(),f6=ro(),{pathExists:Xme}=tl(),{areIdentical:d6}=xu();async function Jme(r,e){let t;try{t=await rl.lstat(e,{bigint:!0})}catch{}let n;try{n=await rl.lstat(r,{bigint:!0})}catch(o){throw o.message=o.message.replace("lstat","ensureLink"),o}if(t&&d6(n,t))return;let i=u6.dirname(e);await Xme(i)||await f6.mkdirs(i),await rl.link(r,e)}a(Jme,"createLink");function Zme(r,e){let t;try{t=rl.lstatSync(e,{bigint:!0})}catch{}try{let s=rl.lstatSync(r,{bigint:!0});if(t&&d6(s,t))return}catch(s){throw s.message=s.message.replace("lstat","ensureLink"),s}let n=u6.dirname(e);return rl.existsSync(n)||f6.mkdirsSync(n),rl.linkSync(r,e)}a(Zme,"createLinkSync");p6.exports={createLink:Qme(Jme),createLinkSync:Zme}});var g6=T((Kje,m6)=>{"use strict";var nl=require("path"),fg=mi(),{pathExists:ege}=tl(),tge=an().fromPromise;async function rge(r,e){if(nl.isAbsolute(r)){try{await fg.lstat(r)}catch(s){throw s.message=s.message.replace("lstat","ensureSymlink"),s}return{toCwd:r,toDst:r}}let t=nl.dirname(e),n=nl.join(t,r);if(await ege(n))return{toCwd:n,toDst:r};try{await fg.lstat(r)}catch(s){throw s.message=s.message.replace("lstat","ensureSymlink"),s}return{toCwd:r,toDst:nl.relative(t,r)}}a(rge,"symlinkPaths");function nge(r,e){if(nl.isAbsolute(r)){if(!fg.existsSync(r))throw new Error("absolute srcpath does not exist");return{toCwd:r,toDst:r}}let t=nl.dirname(e),n=nl.join(t,r);if(fg.existsSync(n))return{toCwd:n,toDst:r};if(!fg.existsSync(r))throw new Error("relative srcpath does not exist");return{toCwd:r,toDst:nl.relative(t,r)}}a(nge,"symlinkPathsSync");m6.exports={symlinkPaths:tge(rge),symlinkPathsSync:nge}});var b6=T((Hje,_6)=>{"use strict";var y6=mi(),ige=an().fromPromise;async function sge(r,e){if(e)return e;let t;try{t=await y6.lstat(r)}catch{return"file"}return t&&t.isDirectory()?"dir":"file"}a(sge,"symlinkType");function oge(r,e){if(e)return e;let t;try{t=y6.lstatSync(r)}catch{return"file"}return t&&t.isDirectory()?"dir":"file"}a(oge,"symlinkTypeSync");_6.exports={symlinkType:ige(sge),symlinkTypeSync:oge}});var E6=T((Qje,w6)=>{"use strict";var age=an().fromPromise,il=require("path"),Vi=mi(),{mkdirs:cge,mkdirsSync:lge}=ro(),{symlinkPaths:uge,symlinkPathsSync:fge}=g6(),{symlinkType:dge,symlinkTypeSync:pge}=b6(),{pathExists:hge}=tl(),{areIdentical:S6}=xu();async function mge(r,e,t){let n;try{n=await Vi.lstat(e)}catch{}if(n&&n.isSymbolicLink()){let c;if(il.isAbsolute(r))c=await Vi.stat(r,{bigint:!0});else{let u=il.dirname(e),f=il.join(u,r);try{c=await Vi.stat(f,{bigint:!0})}catch{c=await Vi.stat(r,{bigint:!0})}}let l;try{l=await Vi.stat(e,{bigint:!0})}catch(u){if(u.code!=="ENOENT")throw u}if(l&&S6(c,l))return}let i=await uge(r,e);r=i.toDst;let s=await dge(i.toCwd,t),o=il.dirname(e);return await hge(o)||await cge(o),Vi.symlink(r,e,s)}a(mge,"createSymlink");function gge(r,e,t){let n;try{n=Vi.lstatSync(e)}catch{}if(n&&n.isSymbolicLink()){let c;if(il.isAbsolute(r))c=Vi.statSync(r,{bigint:!0});else{let u=il.dirname(e),f=il.join(u,r);try{c=Vi.statSync(f,{bigint:!0})}catch{c=Vi.statSync(r,{bigint:!0})}}let l;try{l=Vi.statSync(e,{bigint:!0})}catch(u){if(u.code!=="ENOENT")throw u}if(l&&S6(c,l))return}let i=fge(r,e);r=i.toDst,t=pge(i.toCwd,t);let s=il.dirname(e);return Vi.existsSync(s)||lge(s),Vi.symlinkSync(r,e,t)}a(gge,"createSymlinkSync");w6.exports={createSymlink:age(mge),createSymlinkSync:gge}});var x6=T((Jje,O6)=>{"use strict";var{createFile:v6,createFileSync:T6}=l6(),{createLink:A6,createLinkSync:I6}=h6(),{createSymlink:R6,createSymlinkSync:C6}=E6();O6.exports={createFile:v6,createFileSync:T6,ensureFile:v6,ensureFileSync:T6,createLink:A6,createLinkSync:I6,ensureLink:A6,ensureLinkSync:I6,createSymlink:R6,createSymlinkSync:C6,ensureSymlink:R6,ensureSymlinkSync:C6}});var jw=T((Zje,P6)=>{function yge(r,{EOL:e=`
390
+ `,finalEOL:t=!0,replacer:n=null,spaces:i}={}){let s=t?e:"";return JSON.stringify(r,n,i).replace(/\n/g,e)+s}a(yge,"stringify");function _ge(r){return Buffer.isBuffer(r)&&(r=r.toString("utf8")),r.replace(/^\uFEFF/,"")}a(_ge,"stripBom");P6.exports={stringify:yge,stripBom:_ge}});var N6=T((t4e,D6)=>{var ap;try{ap=ip()}catch{ap=require("fs")}var Bw=an(),{stringify:F6,stripBom:L6}=jw();async function bge(r,e={}){typeof e=="string"&&(e={encoding:e});let t=e.fs||ap,n="throws"in e?e.throws:!0,i=await Bw.fromCallback(t.readFile)(r,e);i=L6(i);let s;try{s=JSON.parse(i,e?e.reviver:null)}catch(o){if(n)throw o.message=`${r}: ${o.message}`,o;return null}return s}a(bge,"_readFile");var Sge=Bw.fromPromise(bge);function wge(r,e={}){typeof e=="string"&&(e={encoding:e});let t=e.fs||ap,n="throws"in e?e.throws:!0;try{let i=t.readFileSync(r,e);return i=L6(i),JSON.parse(i,e.reviver)}catch(i){if(n)throw i.message=`${r}: ${i.message}`,i;return null}}a(wge,"readFileSync");async function Ege(r,e,t={}){let n=t.fs||ap,i=F6(e,t);await Bw.fromCallback(n.writeFile)(r,i,t)}a(Ege,"_writeFile");var vge=Bw.fromPromise(Ege);function Tge(r,e,t={}){let n=t.fs||ap,i=F6(e,t);return n.writeFileSync(r,i,t)}a(Tge,"writeFileSync");D6.exports={readFile:Sge,readFileSync:wge,writeFile:vge,writeFileSync:Tge}});var M6=T((n4e,k6)=>{"use strict";var Uw=N6();k6.exports={readJson:Uw.readFile,readJsonSync:Uw.readFileSync,writeJson:Uw.writeFile,writeJsonSync:Uw.writeFileSync}});var Vw=T((i4e,B6)=>{"use strict";var Age=an().fromPromise,V2=mi(),$6=require("path"),j6=ro(),Ige=tl().pathExists;async function Rge(r,e,t="utf-8"){let n=$6.dirname(r);return await Ige(n)||await j6.mkdirs(n),V2.writeFile(r,e,t)}a(Rge,"outputFile");function Cge(r,...e){let t=$6.dirname(r);V2.existsSync(t)||j6.mkdirsSync(t),V2.writeFileSync(r,...e)}a(Cge,"outputFileSync");B6.exports={outputFile:Age(Rge),outputFileSync:Cge}});var V6=T((o4e,U6)=>{"use strict";var{stringify:Oge}=jw(),{outputFile:xge}=Vw();async function Pge(r,e,t={}){let n=Oge(e,t);await xge(r,n,t)}a(Pge,"outputJson");U6.exports=Pge});var q6=T((c4e,G6)=>{"use strict";var{stringify:Fge}=jw(),{outputFileSync:Lge}=Vw();function Dge(r,e,t){let n=Fge(e,t);Lge(r,n,t)}a(Dge,"outputJsonSync");G6.exports=Dge});var K6=T((u4e,W6)=>{"use strict";var Nge=an().fromPromise,yi=M6();yi.outputJson=Nge(V6());yi.outputJsonSync=q6();yi.outputJSON=yi.outputJson;yi.outputJSONSync=yi.outputJsonSync;yi.writeJSON=yi.writeJson;yi.writeJSONSync=yi.writeJsonSync;yi.readJSON=yi.readJson;yi.readJSONSync=yi.readJsonSync;W6.exports=yi});var X6=T((f4e,Q6)=>{"use strict";var kge=mi(),z6=require("path"),{copy:Mge}=$w(),{remove:Y6}=ug(),{mkdirp:$ge}=ro(),{pathExists:jge}=tl(),H6=xu();async function Bge(r,e,t={}){let n=t.overwrite||t.clobber||!1,{srcStat:i,isChangingCase:s=!1}=await H6.checkPaths(r,e,"move",t);await H6.checkParentPaths(r,i,e,"move");let o=z6.dirname(e);return z6.parse(o).root!==o&&await $ge(o),Uge(r,e,n,s)}a(Bge,"move");async function Uge(r,e,t,n){if(!n){if(t)await Y6(e);else if(await jge(e))throw new Error("dest already exists.")}try{await kge.rename(r,e)}catch(i){if(i.code!=="EXDEV")throw i;await Vge(r,e,t)}}a(Uge,"doRename");async function Vge(r,e,t){return await Mge(r,e,{overwrite:t,errorOnExist:!0,preserveTimestamps:!0}),Y6(r)}a(Vge,"moveAcrossDevice");Q6.exports=Bge});var r8=T((p4e,t8)=>{"use strict";var Z6=ip(),q2=require("path"),Gge=$w().copySync,e8=ug().removeSync,qge=ro().mkdirpSync,J6=xu();function Wge(r,e,t){t=t||{};let n=t.overwrite||t.clobber||!1,{srcStat:i,isChangingCase:s=!1}=J6.checkPathsSync(r,e,"move",t);return J6.checkParentPathsSync(r,i,e,"move"),Kge(e)||qge(q2.dirname(e)),zge(r,e,n,s)}a(Wge,"moveSync");function Kge(r){let e=q2.dirname(r);return q2.parse(e).root===e}a(Kge,"isParentRoot");function zge(r,e,t,n){if(n)return G2(r,e,t);if(t)return e8(e),G2(r,e,t);if(Z6.existsSync(e))throw new Error("dest already exists.");return G2(r,e,t)}a(zge,"doRename");function G2(r,e,t){try{Z6.renameSync(r,e)}catch(n){if(n.code!=="EXDEV")throw n;return Hge(r,e,t)}}a(G2,"rename");function Hge(r,e,t){return Gge(r,e,{overwrite:t,errorOnExist:!0,preserveTimestamps:!0}),e8(r)}a(Hge,"moveAcrossDevice");t8.exports=Wge});var i8=T((m4e,n8)=>{"use strict";var Yge=an().fromPromise;n8.exports={move:Yge(X6()),moveSync:r8()}});var Wo=T((g4e,s8)=>{"use strict";s8.exports={...mi(),...$w(),...s6(),...x6(),...K6(),...ro(),...i8(),...Vw(),...tl(),...ug()}});function Jn(r,e){return{tagName:r,nodeKind:"scalar",implicit:e.implicit??!1,matchByTagPrefix:e.matchByTagPrefix??!1,implicitFirstChars:e.implicitFirstChars??null,resolve:e.resolve,identify:e.identify,represent:e.represent??(t=>String(t)),representTagName:e.representTagName??(()=>r)}}function lP(r,e){let t=e.finalize===void 0;return{tagName:r,nodeKind:"sequence",implicit:!1,matchByTagPrefix:e.matchByTagPrefix??!1,create:e.create,addItem:e.addItem,finalize:e.finalize??(n=>n),carrierIsResult:t,identify:e.identify,represent:e.represent??(n=>n),representTagName:e.representTagName??(()=>r)}}function Hw(r,e){let t=e.finalize===void 0;return{tagName:r,nodeKind:"mapping",implicit:!1,matchByTagPrefix:e.matchByTagPrefix??!1,create:e.create,addPair:e.addPair,has:e.has,keys:e.keys,get:e.get,finalize:e.finalize??(n=>n),carrierIsResult:t,identify:e.identify,represent:e.represent??(n=>n),representTagName:e.representTagName??(()=>r)}}function pye(r){let e=r,t=1;return(e[0]==="-"||e[0]==="+")&&(e[0]==="-"&&(t=-1),e=e.slice(1)),e.startsWith("0b")?t*parseInt(e.slice(2),2):e.startsWith("0o")?t*parseInt(e.slice(2),8):e.startsWith("0x")?t*parseInt(e.slice(2),16):t*parseInt(e,10)}function hye(r,e){if(e){if(!dye.test(r))return Et}else if(!fye.test(r))return Et;let t=pye(r);return Number.isFinite(t)?t:Et}function yye(r){let e=r,t=1;return(e[0]==="-"||e[0]==="+")&&(e[0]==="-"&&(t=-1),e=e.slice(1)),e.startsWith("0b")?t*parseInt(e.slice(2),2):e.startsWith("0o")?t*parseInt(e.slice(2),8):e.startsWith("0x")?t*parseInt(e.slice(2),16):t*parseInt(e,10)}function _ye(r,e){if(e){if(!gye.test(r))return Et}else if(!mye.test(r))return Et;let t=yye(r);return Number.isFinite(t)?t:Et}function wye(r){let e=r.replace(/_/g,""),t=1;if((e[0]==="-"||e[0]==="+")&&(e[0]==="-"&&(t=-1),e=e.slice(1)),e.startsWith("0b"))return t*parseInt(e.slice(2),2);if(e.startsWith("0x"))return t*parseInt(e.slice(2),16);if(e.includes(":")){let n=0;for(let i of e.split(":"))n=n*60+Number(i);return t*n}return e!=="0"&&e[0]==="0"?t*parseInt(e,8):t*parseInt(e,10)}function Eye(r){if(!Sye.test(r))return Et;let e=wye(r);return Number.isFinite(e)?e:Et}function Aye(r){if(!vye.test(r))return Et;let e=r.toLowerCase(),t=e[0]==="-"?-1:1;if("+-".includes(e[0])&&(e=e.slice(1)),e===".inf")return t===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY;if(e===".nan")return NaN;let n=t*parseFloat(e);return Number.isFinite(n)||Tye.test(r)?n:Et}function Iye(r){if(isNaN(r))return".nan";if(r===Number.POSITIVE_INFINITY)return".inf";if(r===Number.NEGATIVE_INFINITY)return"-.inf";if(Object.is(r,-0))return"-0.0";let e=r.toString(10);return/^[-+]?[0-9]+e/.test(e)?e.replace("e",".e"):e}function Oye(r,e){if(e){if(!Cye.test(r))return Et;let n=r.toLowerCase(),i=n[0]==="-"?-1:1;if("+-".includes(n[0])&&(n=n.slice(1)),n===".inf")return i===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY;if(n===".nan")return NaN;let s=i*parseFloat(n);return Number.isFinite(s)?s:Et}if(!Rye.test(r))return Et;let t=Number(r);return Number.isFinite(t)?t:Et}function xye(r){if(isNaN(r))return".nan";if(r===Number.POSITIVE_INFINITY)return".inf";if(r===Number.NEGATIVE_INFINITY)return"-.inf";if(Object.is(r,-0))return"-0.0";let e=r.toString(10);return/^[-+]?[0-9]+e/.test(e)?e.replace("e",".e"):e}function Dye(r){if(!Fye.test(r))return Et;let e=r.toLowerCase().replace(/_/g,""),t=e[0]==="-"?-1:1;if("+-".includes(e[0])&&(e=e.slice(1)),e===".inf")return t===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY;if(e===".nan")return NaN;let n=0;if(e.includes(":")){for(let i of e.split(":"))n=n*60+Number(i);n*=t}else n=t*parseFloat(e);return Number.isFinite(n)||Lye.test(r)?n:Et}function Nye(r){if(isNaN(r))return".nan";if(r===Number.POSITIVE_INFINITY)return".inf";if(r===Number.NEGATIVE_INFINITY)return"-.inf";if(Object.is(r,-0))return"-0.0";let e=r.toString(10);return/^[-+]?[0-9]+e/.test(e)?e.replace("e",".e"):e}function $ye(r){let e=r.replace(/\s/g,"");if(e.length%4!==0||!Mye.test(e))return Et;let t=atob(e),n=new Uint8Array(t.length);for(let i=0;i<t.length;i++)n[i]=t.charCodeAt(i);return n}function jye(r){let e="";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return btoa(e)}function o8(r,e,t,n=0,i=0,s=0,o=0){let c=new Date(Date.UTC(r,e,t,n,i,s,o));return c.setUTCFullYear(r,e,t),c}function Gye(r){let e=Uye.exec(r);if(e===null&&(e=Vye.exec(r)),e===null)return Et;let t=+e[1],n=+e[2]-1,i=+e[3];if(!e[4]){let f=o8(t,n,i);return f.getUTCFullYear()!==t||f.getUTCMonth()!==n||f.getUTCDate()!==i?Et:f}let s=+e[4],o=+e[5],c=+e[6],l=0;if(s>23||o>59||c>59)return Et;if(e[7]){let f=e[7].slice(0,3);for(;f.length<3;)f+="0";l=+f}let u=o8(t,n,i,s,o,c,l);if(u.getUTCFullYear()!==t||u.getUTCMonth()!==n||u.getUTCDate()!==i)return Et;if(e[9]){let f=+e[10],d=+(e[11]||0);if(f>23||d>59)return Et;let p=(f*60+d)*6e4;u.setTime(u.getTime()-(e[9]==="-"?-p:p))}return u}function Yw(r){if(r===null||typeof r!="object"||Array.isArray(r))return!1;let e=Object.getPrototypeOf(r);return e===null||e===Object.prototype}function Z2(r,e){let t={};for(let n of e)r[n]!==void 0&&(t[n]=r[n]);return t}function Qye(){return{scalar:Object.create(null),sequence:Object.create(null),mapping:Object.create(null)}}function Xye(){return{scalar:[],sequence:[],mapping:[]}}function Jye(r){let e=[];for(let t of r){let n=e.length;for(let i=0;i<e.length;i++){let s=e[i];if(s.nodeKind===t.nodeKind&&s.tagName===t.tagName&&s.matchByTagPrefix===t.matchByTagPrefix){n=i;break}}e[n]=t}return e}function a8(r){if(Array.isArray(r)){let e=Array.prototype.slice.call(r);for(let t=0;t<e.length;t++){if(Array.isArray(e[t]))return null;typeof e[t]=="object"&&Object.prototype.toString.call(e[t])==="[object Object]"&&(e[t]="[object Object]")}return String(e)}return typeof r=="object"&&Object.prototype.toString.call(r)==="[object Object]"?"[object Object]":String(r)}function W2(r,e,t,n,i){let s="",o="",c=Math.floor(i/2)-1;return n-e>c&&(s=" ... ",e=n-c+s.length),t-n>c&&(o=" ...",t=n+c-o.length),{str:s+r.slice(e,t).replace(/\t/g,"\u2192")+o,pos:n-e+s.length}}function K2(r,e){return" ".repeat(Math.max(e-r.length,0))+r}function t0e(r,e){if(!r.buffer)return null;let t={...e0e,...e},n=/\r?\n|\r|\0/g,i=[0],s=[],o,c=-1;for(;o=n.exec(r.buffer);)s.push(o.index),i.push(o.index+o[0].length),r.position<=o.index&&c<0&&(c=i.length-2);c<0&&(c=i.length-1);let l="",u=Math.min(r.line+t.linesAfter,s.length).toString().length,f=t.maxLength-(t.indent+u+3);for(let p=1;p<=t.linesBefore&&!(c-p<0);p++){let h=W2(r.buffer,i[c-p],s[c-p],r.position-(i[c]-i[c-p]),f);l=`${" ".repeat(t.indent)}${K2((r.line-p+1).toString(),u)} | ${h.str}
391
+ ${l}`}let d=W2(r.buffer,i[c],s[c],r.position,f);l+=`${" ".repeat(t.indent)}${K2((r.line+1).toString(),u)} | ${d.str}
392
392
  `,l+=`${"-".repeat(t.indent+u+3+d.pos)}^
393
- `;for(let p=1;p<=t.linesAfter&&!(c+p>=s.length);p++){let h=Wx(r.buffer,i[c+p],s[c+p],r.position-(i[c]-i[c+p]),f);l+=`${" ".repeat(t.indent)}${Kx((r.line+p+1).toString(),u)} | ${h.str}
393
+ `;for(let p=1;p<=t.linesAfter&&!(c+p>=s.length);p++){let h=W2(r.buffer,i[c+p],s[c+p],r.position-(i[c]-i[c+p]),f);l+=`${" ".repeat(t.indent)}${K2((r.line+p+1).toString(),u)} | ${h.str}
394
394
  `}return l.replace(/\n$/,"")}function c8(r,e){let t="";return r.mark?(r.mark.name&&(t+=`in "${r.mark.name}" `),t+=`(${r.mark.line+1}:${r.mark.column+1})`,!e&&r.mark.snippet&&(t+=`
395
395
 
396
396
  ${r.mark.snippet}`),`${r.reason} ${t}`):r.reason}function l8(r){switch(r){case 48:return"\0";case 97:return"\x07";case 98:return"\b";case 116:return" ";case 9:return" ";case 110:return`
@@ -404,7 +404,7 @@ ${r.mark.snippet}`),`${r.reason} ${t}`):r.reason}function l8(r){switch(r){case 4
404
404
  `.repeat(d):u+=`
405
405
  `.repeat(f?1+d:d),u+=m,f=!0,d=0}return i===es.KEEP?u+=`
406
406
  `.repeat(f?1+d:d):i!==es.STRIP&&f&&(u+=`
407
- `),u}function l0e(r,e){if(e.valueStart===r0e)return"";let{valueStart:t,valueEnd:n}=e;if(e.fast)return r.slice(t,n);switch(e.style){case Ke.SINGLE_QUOTED:return a0e(r,t,n);case Ke.DOUBLE_QUOTED:return c0e(r,t,n);case Ke.LITERAL_BLOCK:return u8(r,t,n,e.indent,e.chomping,!1);case Ke.FOLDED_BLOCK:return u8(r,t,n,e.indent,e.chomping,!0);default:return o0e(r,t,n)}}function zx(r){return encodeURI(r).replace(/!/g,"%21")}function C8(r,e){if(r.startsWith("!<")&&r.endsWith(">"))return decodeURIComponent(r.slice(2,-1));let t=r.indexOf("!",1),n=t===-1?"!":r.slice(0,t+1),i=e?.[n]??u0e[n]??n;return decodeURIComponent(i)+decodeURIComponent(r.slice(n.length))}function O8(r){let e=r;return e.charCodeAt(0)===33?(e=e.slice(1),`!${zx(e)}`):e.slice(0,18)==="tag:yaml.org,2002:"?`!!${zx(e.slice(18))}`:`!<${zx(e)}>`}function d0e(r){return"tagStart"in r&&r.tagStart!==cp?r.tagStart:"anchorStart"in r&&r.anchorStart!==cp?r.anchorStart:"valueStart"in r&&r.valueStart!==cp?r.valueStart:"start"in r?r.start:0}function Ln(r,e){sl.throwAt(r.source,r.position,e,r.filename)}function x8(r,e,t,n){try{return t.finalize(n)}catch(i){if(i instanceof sl)throw i;sl.throwAt(r.source,e,i instanceof Error?i.message:String(i),r.filename)}}function p0e(r,e){let t=l0e(r.source,e),n=e.tagStart===cp?"":r.source.slice(e.tagStart,e.tagEnd),i=r.schema.defaultScalarTag;if(n!==""){if(n==="!")return{value:t,tag:i};let s=C8(n,r.tagHandlers),o=r.schema.lookupScalarTag(s);if(o){let l=o.resolve(t,!0,s);return l===Et&&Ln(r,`cannot resolve a node with !<${s}> explicit tag`),{value:l,tag:o}}let c=r.schema.lookupMappingTag(s)??r.schema.lookupSequenceTag(s);if(c){t!==""&&Ln(r,`cannot resolve a node with !<${s}> explicit tag`);let l=c.create(s);return{value:c.carrierIsResult?l:x8(r,r.position,c,l),tag:c}}Ln(r,`unknown scalar tag !<${s}>`)}return e.style===Ke.PLAIN?r.schema.resolveImplicitScalarTag(t):{value:i.resolve(t,!1,i.tagName),tag:i}}function f8(r,e,t){let n=e.tagStart===cp?"":r.source.slice(e.tagStart,e.tagEnd);return n===""||n==="!"?t:C8(n,r.tagHandlers)}function P8(r){return r.nodeKind==="mapping"}function d8(r){r.totalMergeKeys++,r.maxTotalMergeKeys!==-1&&r.totalMergeKeys>r.maxTotalMergeKeys&&Ln(r,`merge keys exceeded maxTotalMergeKeys (${r.maxTotalMergeKeys})`)}function p8(r,e,t,n){d8(r);for(let i of n.keys(t)){if(d8(r),e.tag.has(e.value,i))continue;let s=e.tag.addPair(e.value,i,n.get(t,i));s&&Ln(r,s),e.overridable??=new Set,e.overridable.add(i)}}function h0e(r,e,t,n){if(r.position=e.keyPosition,P8(n))p8(r,e,t,n);else if(n.nodeKind==="sequence"&&Array.isArray(t)){t.length>100&&Ln(r,"abnormal merge sequence size");for(let i of t){let s=r.nodeTags.get(i);s||Ln(r,"cannot merge mappings; the provided source object is unacceptable"),p8(r,e,i,s)}}else Ln(r,"cannot merge mappings; the provided source object is unacceptable")}function m0e(r,e,t,n,i){if(r.position=e.keyPosition,e.keyIsMerge){h0e(r,e,n,i);return}!r.json&&e.tag.has(e.value,t)&&!e.overridable?.has(t)&&Ln(r,"duplicated mapping key");let s=e.tag.addPair(e.value,t,n);s&&Ln(r,s),e.overridable?.delete(t)}function Hx(r,e,t){let n=r.frames[r.frames.length-1];if(n.kind==="document")n.value=e,n.hasValue=!0;else if(n.kind==="sequence"){P8(t)&&r.nodeTags.set(e,t);let i=n.tag.addItem(n.value,e,n.index++);i&&Ln(r,i)}else if(n.hasKey){let i=n.key;n.key=void 0,n.hasKey=!1,m0e(r,n,i,e,t)}else n.key=e,n.keyPosition=r.position,n.hasKey=!0,n.keyIsMerge=t.tagName===f0e}function Yx(r,e,t,n,i){if(e.anchorStart!==cp){let s={value:t,tag:n,isValueFinal:i};return r.anchors.set(r.source.slice(e.anchorStart,e.anchorEnd),s),s}return null}function g0e(r,e){let t={...dP,...e,events:r,documents:[],eventIndex:0,position:0,frames:[],anchors:new Map,nodeTags:new Map,tagHandlers:Object.create(null),totalMergeKeys:0,aliasCount:0};for(;t.eventIndex<t.events.length;){let n=t.events[t.eventIndex++];switch(t.position=d0e(n),n.type){case Rr.DOCUMENT:t.anchors=new Map,t.nodeTags=new Map,t.aliasCount=0,t.tagHandlers=Object.create(null);for(let i of n.directives)i.kind==="tag"&&(t.tagHandlers[i.handle]=i.prefix);t.frames.push({kind:"document",position:t.position,value:void 0,hasValue:!1});break;case Rr.SCALAR:{let{value:i,tag:s}=p0e(t,n);Yx(t,n,i,s,!0),Hx(t,i,s);break}case Rr.SEQUENCE:{let i=f8(t,n,"tag:yaml.org,2002:seq"),s=t.schema.lookupSequenceTag(i);s||Ln(t,`unknown sequence tag !<${i}>`);let o=s.create(i),c=Yx(t,n,o,s,s.carrierIsResult);t.frames.push({kind:"sequence",position:t.position,value:o,tag:s,anchor:c,index:0});break}case Rr.MAPPING:{let i=f8(t,n,"tag:yaml.org,2002:map"),s=t.schema.lookupMappingTag(i);s||Ln(t,`unknown mapping tag !<${i}>`);let o=s.create(i),c=Yx(t,n,o,s,s.carrierIsResult);t.frames.push({kind:"mapping",position:t.position,value:o,tag:s,anchor:c,key:void 0,keyPosition:t.position,hasKey:!1,keyIsMerge:!1,overridable:null});break}case Rr.ALIAS:{t.maxAliases!==-1&&++t.aliasCount>t.maxAliases&&Ln(t,`aliases exceeded maxAliases (${t.maxAliases})`);let i=t.source.slice(n.anchorStart,n.anchorEnd),s=t.anchors.get(i);s||Ln(t,`unidentified alias "${i}"`),s.isValueFinal||Ln(t,`recursive alias "${i}" is not supported for tag ${s.tag.tagName} because it uses finalize()`),Hx(t,s.value,s.tag);break}case Rr.POP:{let i=t.frames.pop();if(i.kind==="mapping"&&i.hasKey&&(t.position=i.keyPosition,Ln(t,"incomplete mapping pair in event stream")),i.kind==="document")t.documents.push(i.value);else{let s=i.tag.carrierIsResult?i.value:x8(t,i.position,i.tag,i.value);i.anchor&&(i.anchor.value=s,i.anchor.isValueFinal=!0),Hx(t,s,i.tag)}break}}}return t.documents}function E0e(r,e,t){r.events.push({type:Rr.DOCUMENT,explicitStart:e,explicitEnd:t,directives:r.directives})}function k8(r,e,t,n,i,s,o){r.events.push({type:Rr.SEQUENCE,start:e,anchorStart:t,anchorEnd:n,tagStart:i,tagEnd:s,style:o})}function rP(r,e,t,n,i,s,o){r.events.push({type:Rr.MAPPING,start:e,anchorStart:t,anchorEnd:n,tagStart:i,tagEnd:s,style:o})}function h8(r,e){r.events.splice(e.eventsLength,0,{type:Rr.MAPPING,start:e.position,anchorStart:It,anchorEnd:It,tagStart:It,tagEnd:It,style:Gi.FLOW})}function pp(r,e,t,n,i,s,o,c,l=es.CLIP,u=-1,f=!1){r.events.push({type:Rr.SCALAR,valueStart:e,valueEnd:t,anchorStart:n,anchorEnd:i,tagStart:s,tagEnd:o,style:c,chomping:l,indent:u,fast:f})}function v0e(r,e,t){r.events.push({type:Rr.ALIAS,anchorStart:e,anchorEnd:t})}function lp(r){r.events.push({type:Rr.POP})}function _i(r){pp(r,It,It,It,It,It,It,Ke.PLAIN)}function m8(){return{anchorStart:It,anchorEnd:It,tagStart:It,tagEnd:It}}function up(r){return{position:r.position,line:r.line,lineStart:r.lineStart,lineIndent:r.lineIndent,firstTabInLine:r.firstTabInLine,eventsLength:r.events.length}}function Fu(r,e){r.position=e.position,r.line=e.line,r.lineStart=e.lineStart,r.lineIndent=e.lineIndent,r.firstTabInLine=e.firstTabInLine,r.events.length=e.eventsLength}function Ge(r,e){sl.throwAt(r.input.slice(0,r.length),r.position,e,r.filename)}function ln(r){return r===10||r===13}function Du(r){return r===9||r===32}function no(r){return Du(r)||ln(r)}function ec(r){return r===0||no(r)}function Nu(r){return r===44||r===91||r===93||r===123||r===125}function T0e(r){return r>=48&&r<=57?r-48:-1}function A0e(r){if(r>=48&&r<=57)return r-48;let e=r|32;return e>=97&&e<=102?e-97+10:-1}function I0e(r){return r===120?2:r===117?4:r===85?8:0}function R0e(r){return r===48||r===97||r===98||r===116||r===9||r===110||r===118||r===102||r===114||r===101||r===32||r===34||r===47||r===92||r===78||r===95||r===76||r===80}function Kw(r){r.input.charCodeAt(r.position)===10?r.position++:(r.position++,r.input.charCodeAt(r.position)===10&&r.position++),r.line++,r.lineStart=r.position,r.lineIndent=0,r.firstTabInLine=-1}function Xn(r,e){let t=0,n=r.input.charCodeAt(r.position),i=r.position===r.lineStart||no(r.input.charCodeAt(r.position-1));for(;n!==0;){for(;Du(n);)i=!0,n===9&&r.firstTabInLine===-1&&(r.firstTabInLine=r.position),n=r.input.charCodeAt(++r.position);if(e&&i&&n===35)do n=r.input.charCodeAt(++r.position);while(!ln(n)&&n!==0);if(!ln(n))break;for(Kw(r),t++,i=!0,n=r.input.charCodeAt(r.position);n===32;)r.lineIndent++,n=r.input.charCodeAt(++r.position)}return t}function dp(r,e=r.position){let t=r.input.charCodeAt(e);if((t===45||t===46)&&t===r.input.charCodeAt(e+1)&&t===r.input.charCodeAt(e+2)){let n=r.input.charCodeAt(e+3);return n===0||no(n)}return!1}function M8(r){r.position===r.lineStart&&r.input.charCodeAt(r.position)===65279&&(r.position++,r.lineStart=r.position)}function hP(r){if(r.position!==r.lineStart)return!1;if(dp(r))return!0;if(r.input.charCodeAt(r.position)!==65279)return!1;let e=up(r);M8(r),Xn(r,!0);let t=r.input.charCodeAt(r.position),n=r.position===r.lineStart&&(t===37||t===45&&dp(r));return Fu(r,e),n}function g8(r){let e=r.input.charCodeAt(r.position);for(;e!==0&&!ln(e);)e=r.input.charCodeAt(++r.position)}function $8(r,e,t){y0e.test(r.input.slice(e,t))&&Ge(r,"the stream contains non-printable characters")}function C0e(r,e,t){if(r.input.charCodeAt(r.position)!==33)return!1;e.tagStart!==It&&Ge(r,"duplication of a tag property");let n=r.position,i=!1,s=!1,o="!",c=r.input.charCodeAt(++r.position);c===60?(i=!0,c=r.input.charCodeAt(++r.position)):c===33&&(s=!0,o="!!",c=r.input.charCodeAt(++r.position));let l=r.position,u;if(i){for(;c!==0&&c!==62;)c=r.input.charCodeAt(++r.position);c!==62&&Ge(r,"unexpected end of the stream within a verbatim tag"),u=r.input.slice(l,r.position),r.position++}else{for(;c!==0&&!no(c)&&!(t&&Nu(c));)c===33&&(s?Ge(r,"tag suffix cannot contain exclamation marks"):(o=r.input.slice(l-1,r.position+1),D8.test(o)||Ge(r,"named tag handle cannot contain such characters"),s=!0,l=r.position+1)),c=r.input.charCodeAt(++r.position);u=r.input.slice(l,r.position),_0e.test(u)&&Ge(r,"tag suffix cannot contain flow indicator characters")}return u&&!(i?b0e.test(u):S0e.test(u))&&Ge(r,`tag name cannot contain such characters: ${u}`),!i&&o!=="!"&&o!=="!!"&&!F8.call(r.tagHandlers,o)&&Ge(r,`undeclared tag handle "${o}"`),e.tagStart=n,e.tagEnd=r.position,!0}function O0e(r,e){if(r.input.charCodeAt(r.position)!==38)return!1;e.anchorStart!==It&&Ge(r,"duplication of an anchor property"),r.position++;let t=r.position;for(;r.input.charCodeAt(r.position)!==0&&!no(r.input.charCodeAt(r.position))&&!Nu(r.input.charCodeAt(r.position));)r.position++;return r.position===t&&Ge(r,"name of an anchor node must contain at least one character"),e.anchorStart=t,e.anchorEnd=r.position,!0}function x0e(r,e){if(r.input.charCodeAt(r.position)!==42)return!1;(e.anchorStart!==It||e.tagStart!==It)&&Ge(r,"alias node should not have any properties"),r.position++;let t=r.position;for(;r.input.charCodeAt(r.position)!==0&&!no(r.input.charCodeAt(r.position))&&!Nu(r.input.charCodeAt(r.position));)r.position++;return r.position===t&&Ge(r,"name of an alias node must contain at least one character"),v0e(r,t,r.position),!0}function nP(r,e){Xn(r,!1),r.lineIndent<e&&Ge(r,"deficient indentation")}function P0e(r,e,t){if(r.input.charCodeAt(r.position)!==39)return!1;r.position++;let n=r.position,i=!0;for(;r.input.charCodeAt(r.position)!==0;){let s=r.input.charCodeAt(r.position);if(s===39){if(r.input.charCodeAt(r.position+1)===39){i=!1,r.position+=2;continue}let o=r.position;return r.position++,pp(r,n,o,t.anchorStart,t.anchorEnd,t.tagStart,t.tagEnd,Ke.SINGLE_QUOTED,es.CLIP,-1,i),!0}ln(s)?(i=!1,nP(r,e)):r.position===r.lineStart&&dp(r)?Ge(r,"unexpected end of the document within a single quoted scalar"):s!==9&&s<32?Ge(r,"expected valid JSON character"):r.position++}Ge(r,"unexpected end of the stream within a single quoted scalar")}function F0e(r,e,t){if(r.input.charCodeAt(r.position)!==34)return!1;r.position++;let n=r.position,i=!0;for(;r.input.charCodeAt(r.position)!==0;){let s=r.input.charCodeAt(r.position);if(s===34){let o=r.position;return r.position++,pp(r,n,o,t.anchorStart,t.anchorEnd,t.tagStart,t.tagEnd,Ke.DOUBLE_QUOTED,es.CLIP,-1,i),!0}if(s===92){i=!1;let o=r.input.charCodeAt(++r.position);if(ln(o))nP(r,e);else if(R0e(o))r.position++;else{let c=I0e(o);for(c===0&&Ge(r,"unknown escape sequence");c-- >0;)r.position++,A0e(r.input.charCodeAt(r.position))<0&&Ge(r,"expected hexadecimal character");r.position++}}else ln(s)?(i=!1,nP(r,e)):r.position===r.lineStart&&dp(r)?Ge(r,"unexpected end of the document within a double quoted scalar"):s!==9&&s<32?Ge(r,"expected valid JSON character"):r.position++}Ge(r,"unexpected end of the stream within a double quoted scalar")}function L0e(r,e,t){let n=r.input.charCodeAt(r.position),i=es.CLIP,s=-1,o=!1;if(n!==124&&n!==62)return!1;let c=n===124?Ke.LITERAL_BLOCK:Ke.FOLDED_BLOCK;for(r.position++;r.input.charCodeAt(r.position)!==0;){let h=r.input.charCodeAt(r.position),g=T0e(h);if(h===43||h===45)i!==es.CLIP&&Ge(r,"repeat of a chomping mode identifier"),i=h===43?es.KEEP:es.STRIP,r.position++;else if(g>=0)g===0&&Ge(r,"bad explicit indentation width of a block scalar; it cannot be less than one"),o&&Ge(r,"repeat of an indentation width identifier"),s=e+g-1,o=!0,r.position++;else break}let l=!1;for(;Du(r.input.charCodeAt(r.position));)l=!0,r.position++;l&&r.input.charCodeAt(r.position)===35&&g8(r),ln(r.input.charCodeAt(r.position))?Kw(r):r.input.charCodeAt(r.position)!==0&&Ge(r,"a line break is expected");let u=o?s:-1,f=0,d=r.position,p=r.position;for(;r.input.charCodeAt(r.position)!==0;){let h=r.position,g=0;for(;r.input.charCodeAt(h+g)===32;)g++;let m=r.input.charCodeAt(h+g);if(m===0){u>=0?g>u&&(p=h+g):g>0&&(p=h+g);break}if(hP(r))break;if(!o&&u===-1&&ln(m)&&(f=Math.max(f,g)),!o&&u===-1&&!ln(m)&&(m===9&&g<e&&(r.position=h+g,Ge(r,"tab characters must not be used in indentation")),g<f&&(r.position=h+g,Ge(r,"bad indentation of a mapping entry"))),u===-1&&m!==0&&!ln(m)&&g<e){r.lineIndent=g,r.position=h+g;break}!o&&m!==0&&!ln(m)&&u===-1&&(u=g);let _=u===-1?e+1:u;if(m!==0&&!ln(m)&&g<_){r.lineIndent=g,r.position=h+g;break}g8(r),p=r.position,ln(r.input.charCodeAt(r.position))&&(Kw(r),p=r.position)}return $8(r,d,p),pp(r,d,p,t.anchorStart,t.anchorEnd,t.tagStart,t.tagEnd,c,i,u),!0}function D0e(r,e){let t=r.input.charCodeAt(r.position),n=e===fp;if(t===0||no(t)||t===35||t===38||t===42||t===33||t===124||t===62||t===39||t===34||t===37||t===64||t===96||n&&Nu(t))return!1;if(t===63||t===45){let i=r.input.charCodeAt(r.position+1);if(ec(i)||n&&Nu(i))return!1}return!0}function N0e(r,e,t,n){if(!D0e(r,t))return!1;let i=r.position,s=r.position,o=r.input.charCodeAt(r.position),c=t===fp,l=!1;for(;o!==0&&!hP(r);){if(o===58){let u=r.input.charCodeAt(r.position+1);if(ec(u)||c&&Nu(u))break}else if(o===35){if(no(r.input.charCodeAt(r.position-1)))break}else{if(c&&Nu(o))break;if(ln(o)){let u=r.position,f=r.line,d=r.lineStart,p=r.lineIndent;if(Xn(r,!1),r.lineIndent>=e){l=!0,o=r.input.charCodeAt(r.position);continue}r.position=u,r.line=f,r.lineStart=d,r.lineIndent=p;break}}Du(o)||(s=r.position+1),o=r.input.charCodeAt(++r.position)}return s===i?!1:($8(r,i,s),pp(r,i,s,n.anchorStart,n.anchorEnd,n.tagStart,n.tagEnd,Ke.PLAIN,es.CLIP,-1,!l),!0)}function dg(r,e){let t=r.line;Xn(r,!0),(r.line>t&&r.lineIndent<e||r.firstTabInLine!==-1&&r.lineIndent<e)&&Ge(r,"deficient indentation")}function k0e(r,e,t){let n=r.input.charCodeAt(r.position),i=n===123,s=r.position,o=!0;if(n!==91&&n!==123)return!1;let c=i?125:93;for(i?rP(r,s,t.anchorStart,t.anchorEnd,t.tagStart,t.tagEnd,Gi.FLOW):k8(r,s,t.anchorStart,t.anchorEnd,t.tagStart,t.tagEnd,Gi.FLOW),r.position++;r.input.charCodeAt(r.position)!==0;){dg(r,e);let l=r.input.charCodeAt(r.position);if(l===c)return r.position++,lp(r),!0;o?l===44&&Ge(r,"expected the node content, but found ','"):Ge(r,"missed comma between flow collection entries");let u=!1,f=!1;l===63&&no(r.input.charCodeAt(r.position+1))&&(u=f=!0,r.position+=1,dg(r,e));let d=r.line,p=up(r),h=Lu(r,e,fp,!1,!0);dg(r,e),l=r.input.charCodeAt(r.position),(i||f||r.line===d)&&l===58?(u=!0,r.position++,dg(r,e),i||h8(r,p),h||_i(r),Lu(r,e,fp,!1,!0)||_i(r),dg(r,e),i||lp(r)):i&&u?(h||_i(r),_i(r)):i?_i(r):u&&(h8(r,p),h||_i(r),_i(r),lp(r)),l=r.input.charCodeAt(r.position),l===44?(o=!0,r.position++):o=!1}Ge(r,"unexpected end of the stream within a flow collection")}function y8(r,e,t){if(r.firstTabInLine!==-1||r.input.charCodeAt(r.position)!==45||!ec(r.input.charCodeAt(r.position+1)))return!1;for(k8(r,r.position,t.anchorStart,t.anchorEnd,t.tagStart,t.tagEnd,Gi.BLOCK);r.input.charCodeAt(r.position)===45&&ec(r.input.charCodeAt(r.position+1));){r.firstTabInLine!==-1&&(r.position=r.firstTabInLine,Ge(r,"tab characters must not be used in indentation"));let n=r.line;r.position++;let i=Xn(r,!0)>0;if(r.firstTabInLine!==-1&&r.input.charCodeAt(r.position)===45&&ec(r.input.charCodeAt(r.position+1))&&Ge(r,"bad indentation of a sequence entry"),i&&r.lineIndent<=e?_i(r):Lu(r,e,L8,!1,!0),Xn(r,!0),r.lineIndent<e||r.position>=r.length)break;r.lineIndent>e&&Ge(r,"bad indentation of a sequence entry"),r.line===n&&r.input.charCodeAt(r.position)===45&&ec(r.input.charCodeAt(r.position+1))&&Ge(r,"bad indentation of a sequence entry")}return lp(r),!0}function Qx(r,e,t,n){let i=!1,s=!1,o=!1,c=!1;if(r.firstTabInLine!==-1)return!1;let l=r.input.charCodeAt(r.position);for(;l!==0;){!i&&r.firstTabInLine!==-1&&(r.position=r.firstTabInLine,Ge(r,"tab characters must not be used in indentation"));let u=r.input.charCodeAt(r.position+1),f=r.line;if((l===63||l===58)&&ec(u))o||(rP(r,r.position,n.anchorStart,n.anchorEnd,n.tagStart,n.tagEnd,Gi.BLOCK),o=!0),l===63?(i&&_i(r),s=!0,i=!0):(i||(_i(r),s=!0),i=!1),r.position+=1,c=!0;else{i&&(_i(r),i=!1);let d=up(r);if(!Lu(r,t,eP,!1,!0))break;if(r.line===f){for(l=r.input.charCodeAt(r.position);Du(l);)l=r.input.charCodeAt(++r.position);if(l===58){if(l=r.input.charCodeAt(++r.position),ec(l)||Ge(r,"a whitespace character is expected after the key-value separator within a block mapping"),!o){for(Fu(r,d),rP(r,d.position,n.anchorStart,n.anchorEnd,n.tagStart,n.tagEnd,Gi.BLOCK),o=!0,Lu(r,t,eP,!1,!0),l=r.input.charCodeAt(r.position);Du(l);)l=r.input.charCodeAt(++r.position);r.position++}s=!0,i=!1,c=!1}else if(s)Ge(r,"expected ':' after a mapping key");else return n.anchorStart!==It||n.tagStart!==It?(Fu(r,d),!1):!0}else if(s)Ge(r,"can not read a block mapping entry; a multiline key may not be an implicit key");else return n.anchorStart!==It||n.tagStart!==It?(Fu(r,d),!1):!0}if(Lu(r,e,Ww,!0,c)&&(c=!1),i||c&&(_i(r),c=!1),Xn(r,!0),l=r.input.charCodeAt(r.position),(r.line===f||r.lineIndent>e)&&l!==0)Ge(r,"bad indentation of a mapping entry");else if(r.lineIndent<e)break}return s?(i&&_i(r),o&&lp(r),!0):!1}function Lu(r,e,t,n,i,s=!0){r.depth>=r.maxDepth&&Ge(r,`nesting exceeded maxDepth (${r.maxDepth})`),r.depth++;let o=1,c=!1,l=!1,u=null,f=m8(),d=t===Ww||t===L8,p=d,h=d;if(n&&Xn(r,!0)&&(c=!0,r.lineIndent>e?o=1:r.lineIndent===e?o=0:o=-1),o===1)for(;;){let g=r.input.charCodeAt(r.position),m=up(r);if(c&&o!==1&&(g===33||g===38))break;if(c&&h&&(f.tagStart!==It||f.anchorStart!==It)&&(g===33||g===38)){let _=up(r),b=e+1;if(Qx(r,r.position-r.lineStart,b,f)&&r.events[_.eventsLength]?.type===Rr.MAPPING)return r.depth--,!0;Fu(r,_)}if(c&&(g===33&&f.tagStart!==It||g===38&&f.anchorStart!==It)||!C0e(r,f,t===fp)&&!O0e(r,f))break;u===null&&(u=m),Xn(r,!0)?(c=!0,p=h,r.lineIndent>e?o=1:r.lineIndent===e?o=0:o=-1):p=!1}if(p&&(p=c||i),o===1||t===Ww){let g=t===fp||t===eP?e:e+1,m=r.position-r.lineStart;if(o===1)if(p&&(y8(r,m,f)||Qx(r,m,g,f))||k0e(r,g,f))l=!0;else{let _=r.input.charCodeAt(r.position);if(u!==null&&s&&h&&!p&&_!==124&&_!==62){let b=up(r),w=u.position-u.lineStart;Fu(r,u),Qx(r,w,g,m8())&&r.events[b.eventsLength]?.type===Rr.MAPPING?l=!0:Fu(r,b)}!l&&(d&&L0e(r,g,f)||P0e(r,g,f)||F0e(r,g,f)||x0e(r,f)||N0e(r,g,t,f))&&(l=!0)}else o===0&&(l=p&&y8(r,m,f))}return d=d&&!l,!l&&(f.anchorStart!==It||f.tagStart!==It||d)&&(pp(r,It,It,f.anchorStart,f.anchorEnd,f.tagStart,f.tagEnd,Ke.PLAIN),l=!0),r.depth--,l||f.anchorStart!==It||f.tagStart!==It}function M0e(r){if(r.lineIndent>0||r.input.charCodeAt(r.position)!==37)return!1;r.position++;let e=r.position;for(;r.input.charCodeAt(r.position)!==0&&!no(r.input.charCodeAt(r.position));)r.position++;let t=r.input.slice(e,r.position),n=[];for(t.length===0&&Ge(r,"directive name must not be less than one character in length");r.input.charCodeAt(r.position)!==0&&!ln(r.input.charCodeAt(r.position));){for(;Du(r.input.charCodeAt(r.position));)r.position++;if(r.input.charCodeAt(r.position)===35||ln(r.input.charCodeAt(r.position))||r.input.charCodeAt(r.position)===0)break;let i=r.position;for(;r.input.charCodeAt(r.position)!==0&&!no(r.input.charCodeAt(r.position));)r.position++;n.push(r.input.slice(i,r.position))}if(ln(r.input.charCodeAt(r.position))&&Kw(r),t==="YAML"){r.directives.some(s=>s.kind==="yaml")&&Ge(r,"duplication of %YAML directive"),n.length!==1&&Ge(r,"YAML directive accepts exactly one argument");let i=/^([0-9]+)\.([0-9]+)$/.exec(n[0]);i===null&&Ge(r,"ill-formed argument of the YAML directive"),parseInt(i[1],10)!==1&&Ge(r,"unacceptable YAML version of the document"),r.directives.push({kind:"yaml",version:n[0]})}else if(t==="TAG"){n.length!==2&&Ge(r,"TAG directive accepts exactly two arguments");let[i,s]=n;D8.test(i)||Ge(r,"ill-formed tag handle (first argument) of the TAG directive"),F8.call(r.tagHandlers,i)&&Ge(r,`there is a previously declared suffix for "${i}" tag handle`),w0e.test(s)||Ge(r,"ill-formed tag prefix (second argument) of the TAG directive"),r.tagHandlers[i]=s,r.directives.push({kind:"tag",handle:i,prefix:s})}return!0}function $0e(r){r.directives=[],r.tagHandlers=Object.create(null);let e=!1;for(Xn(r,!0);M0e(r);)e=!0,Xn(r,!0);let t=!1,n=!1,i=!0;if(r.lineIndent===0&&r.input.charCodeAt(r.position)===45&&r.input.charCodeAt(r.position+1)===45&&r.input.charCodeAt(r.position+2)===45&&ec(r.input.charCodeAt(r.position+3))){t=!0;let c=r.line;r.position+=3,Xn(r,!0),i=r.line>c}else e&&Ge(r,"directives end mark is expected");let s=r.events.length;if(!t&&r.position===r.lineStart&&r.input.charCodeAt(r.position)===46&&dp(r)){r.position+=3,Xn(r,!0);return}if(E0e(r,t,!1),Lu(r,r.lineIndent-1,Ww,!1,i,i)||_i(r),Xn(r,!0),r.position===r.lineStart&&dp(r)&&(n=r.input.charCodeAt(r.position)===46,n)){let c=r.line;r.position+=3,Xn(r,!0),r.line===c&&r.position<r.length&&Ge(r,"end of the stream or a document separator is expected")}let o=r.events[s];o?.type===Rr.DOCUMENT&&(o.explicitEnd=n),lp(r),!n&&r.position<r.length&&!hP(r)&&Ge(r,"end of the stream or a document separator is expected")}function j0e(r,e){let t=r.length,n={...pP,...e,input:`${r}\0`,length:t,position:0,line:0,lineStart:0,lineIndent:0,firstTabInLine:-1,depth:0,directives:[],tagHandlers:Object.create(null),events:[]},i=r.indexOf("\0");for(i!==-1&&sl.throwAt(r,i,"null byte is not allowed in input",n.filename);n.position<n.length&&(M8(n),Xn(n,!0),!(n.position>=n.length));){let s=n.position;$0e(n),n.position===s&&Ge(n,"can not read a document")}return n.events}function U0e(r,e={}){let t={...B0e,...e},n=String(r),i=Object.keys(pP),s=Object.keys(dP);return g0e(j0e(n,Zx(t,i)),{...Zx(t,s),source:n})}function ol(r,e){let t=U0e(r,e);if(t.length===0)throw new sl("expected a document, but the input is empty");if(t.length===1)return t[0];throw new sl("expected a single document in the stream, but found more")}function V0e(r){let e=new Set([r.defaultScalarTag,r.defaultSequenceTag,r.defaultMappingTag].filter(s=>s!==void 0)),t=r.implicitScalarTags,n=r.tags.filter(s=>!(s.nodeKind==="scalar"&&s.implicit)&&!e.has(s)),i=r.tags.filter(s=>e.has(s));return[...t.map(s=>({tag:s,implicitTag:!0})),...n.map(s=>({tag:s,implicitTag:!1})),...i.map(s=>({tag:s,implicitTag:!0}))]}function G0e(r,e){for(let t=0,n=r.representTypes.length;t<n;t+=1){let{tag:i,implicitTag:s}=r.representTypes[t];if(i.identify(e)){let o;return i.matchByTagPrefix?o=i.representTagName(e):o=i.tagName,{tag:i,tagName:o,implicitTag:s}}}return null}function hg(r,e){if(!r.noRefs&&e!==null&&typeof e=="object"){let u=r.refs.get(e);if(u)return u.anchor===void 0&&(u.anchor=`ref_${r.refCounter++}`),{kind:"alias",anchor:u.anchor}}let t=G0e(r,e);if(!t){if(e===void 0||r.skipInvalid)return Pu;throw new sl(`unacceptable kind of an object to dump ${Object.prototype.toString.call(e)}`)}let{tag:n,tagName:i,implicitTag:s}=t,o=s?i:O8(i);if(n.nodeKind==="scalar")return{kind:"scalar",tag:o,tagged:!s,style:Ke.PLAIN,value:n.represent(e)};if(n.nodeKind==="sequence"){let u=n.represent(e),f={kind:"sequence",tag:o,tagged:!s,style:Gi.BLOCK,items:[]};r.noRefs||r.refs.set(e,f);for(let d=0,p=u.length;d<p;d+=1){let h=hg(r,u[d]);h===Pu&&u[d]===void 0&&(h=hg(r,null)),h!==Pu&&f.items.push(h)}return f}let c=n.represent(e),l={kind:"mapping",tag:o,tagged:!s,style:Gi.BLOCK,items:[]};r.noRefs||r.refs.set(e,l);for(let[u,f]of c){let d=hg(r,u);if(d===Pu)continue;let p=hg(r,f);p!==Pu&&l.items.push({key:d,value:p})}return l}function q0e(r,e,t={}){let n=hg({representTypes:V0e(e),noRefs:t.noRefs??!1,skipInvalid:t.skipInvalid??!1,refs:new Map,refCounter:0},r);return[{contents:n===Pu?null:n,directives:[]}]}function Gw(r,e,t){let n=e(r,t);if(n===W0e)return!0;if(n===j8)return!1;let i=t.depth+1;switch(r.kind){case"sequence":for(let s of r.items)if(Gw(s,e,{depth:i,parent:r,isKey:!1}))return!0;break;case"mapping":for(let{key:s,value:o}of r.items)if(Gw(s,e,{depth:i,parent:r,isKey:!0})||Gw(o,e,{depth:i,parent:r,isKey:!1}))return!0;break}return!1}function _8(r,e){for(let t of r)if(t.contents&&Gw(t.contents,e,{depth:0,parent:null,isKey:!1}))return}function Xw(r,e){return(r&1<<e)!==0}function B8(r){return r.presenterOptions.quoteStyle==="single"&&Xw(r.allowedStylesMask,Ke.SINGLE_QUOTED)?Ke.SINGLE_QUOTED:Ke.DOUBLE_QUOTED}function K0e(r){r.presenterOptions.quoteFlowKeys&&(!r.isKey||!r.flowOnly||r.style!==Ke.PLAIN||(r.style=Ke.DOUBLE_QUOTED))}function z0e(r){r.style===Ke.PLAIN&&/[\t\x7F-\xA0\u2028\u2029\uFEFF\uFFFE\uFFFF]/.test(r.node.value)&&(r.style=Ke.DOUBLE_QUOTED)}function H0e(r){r.style===Ke.PLAIN&&/^\s+$/.test(r.node.value)&&(r.style=Ke.DOUBLE_QUOTED)}function Y0e(r){r.presenterOptions.forceQuotes&&(r.isKey||r.style!==Ke.PLAIN||r.node.tag===r.presenterOptions.schema.defaultScalarTag.tagName&&(r.style=r.node.value.includes(`
407
+ `),u}function l0e(r,e){if(e.valueStart===r0e)return"";let{valueStart:t,valueEnd:n}=e;if(e.fast)return r.slice(t,n);switch(e.style){case Ke.SINGLE_QUOTED:return a0e(r,t,n);case Ke.DOUBLE_QUOTED:return c0e(r,t,n);case Ke.LITERAL_BLOCK:return u8(r,t,n,e.indent,e.chomping,!1);case Ke.FOLDED_BLOCK:return u8(r,t,n,e.indent,e.chomping,!0);default:return o0e(r,t,n)}}function z2(r){return encodeURI(r).replace(/!/g,"%21")}function C8(r,e){if(r.startsWith("!<")&&r.endsWith(">"))return decodeURIComponent(r.slice(2,-1));let t=r.indexOf("!",1),n=t===-1?"!":r.slice(0,t+1),i=e?.[n]??u0e[n]??n;return decodeURIComponent(i)+decodeURIComponent(r.slice(n.length))}function O8(r){let e=r;return e.charCodeAt(0)===33?(e=e.slice(1),`!${z2(e)}`):e.slice(0,18)==="tag:yaml.org,2002:"?`!!${z2(e.slice(18))}`:`!<${z2(e)}>`}function d0e(r){return"tagStart"in r&&r.tagStart!==cp?r.tagStart:"anchorStart"in r&&r.anchorStart!==cp?r.anchorStart:"valueStart"in r&&r.valueStart!==cp?r.valueStart:"start"in r?r.start:0}function Ln(r,e){sl.throwAt(r.source,r.position,e,r.filename)}function x8(r,e,t,n){try{return t.finalize(n)}catch(i){if(i instanceof sl)throw i;sl.throwAt(r.source,e,i instanceof Error?i.message:String(i),r.filename)}}function p0e(r,e){let t=l0e(r.source,e),n=e.tagStart===cp?"":r.source.slice(e.tagStart,e.tagEnd),i=r.schema.defaultScalarTag;if(n!==""){if(n==="!")return{value:t,tag:i};let s=C8(n,r.tagHandlers),o=r.schema.lookupScalarTag(s);if(o){let l=o.resolve(t,!0,s);return l===Et&&Ln(r,`cannot resolve a node with !<${s}> explicit tag`),{value:l,tag:o}}let c=r.schema.lookupMappingTag(s)??r.schema.lookupSequenceTag(s);if(c){t!==""&&Ln(r,`cannot resolve a node with !<${s}> explicit tag`);let l=c.create(s);return{value:c.carrierIsResult?l:x8(r,r.position,c,l),tag:c}}Ln(r,`unknown scalar tag !<${s}>`)}return e.style===Ke.PLAIN?r.schema.resolveImplicitScalarTag(t):{value:i.resolve(t,!1,i.tagName),tag:i}}function f8(r,e,t){let n=e.tagStart===cp?"":r.source.slice(e.tagStart,e.tagEnd);return n===""||n==="!"?t:C8(n,r.tagHandlers)}function P8(r){return r.nodeKind==="mapping"}function d8(r){r.totalMergeKeys++,r.maxTotalMergeKeys!==-1&&r.totalMergeKeys>r.maxTotalMergeKeys&&Ln(r,`merge keys exceeded maxTotalMergeKeys (${r.maxTotalMergeKeys})`)}function p8(r,e,t,n){d8(r);for(let i of n.keys(t)){if(d8(r),e.tag.has(e.value,i))continue;let s=e.tag.addPair(e.value,i,n.get(t,i));s&&Ln(r,s),e.overridable??=new Set,e.overridable.add(i)}}function h0e(r,e,t,n){if(r.position=e.keyPosition,P8(n))p8(r,e,t,n);else if(n.nodeKind==="sequence"&&Array.isArray(t)){t.length>100&&Ln(r,"abnormal merge sequence size");for(let i of t){let s=r.nodeTags.get(i);s||Ln(r,"cannot merge mappings; the provided source object is unacceptable"),p8(r,e,i,s)}}else Ln(r,"cannot merge mappings; the provided source object is unacceptable")}function m0e(r,e,t,n,i){if(r.position=e.keyPosition,e.keyIsMerge){h0e(r,e,n,i);return}!r.json&&e.tag.has(e.value,t)&&!e.overridable?.has(t)&&Ln(r,"duplicated mapping key");let s=e.tag.addPair(e.value,t,n);s&&Ln(r,s),e.overridable?.delete(t)}function H2(r,e,t){let n=r.frames[r.frames.length-1];if(n.kind==="document")n.value=e,n.hasValue=!0;else if(n.kind==="sequence"){P8(t)&&r.nodeTags.set(e,t);let i=n.tag.addItem(n.value,e,n.index++);i&&Ln(r,i)}else if(n.hasKey){let i=n.key;n.key=void 0,n.hasKey=!1,m0e(r,n,i,e,t)}else n.key=e,n.keyPosition=r.position,n.hasKey=!0,n.keyIsMerge=t.tagName===f0e}function Y2(r,e,t,n,i){if(e.anchorStart!==cp){let s={value:t,tag:n,isValueFinal:i};return r.anchors.set(r.source.slice(e.anchorStart,e.anchorEnd),s),s}return null}function g0e(r,e){let t={...dP,...e,events:r,documents:[],eventIndex:0,position:0,frames:[],anchors:new Map,nodeTags:new Map,tagHandlers:Object.create(null),totalMergeKeys:0,aliasCount:0};for(;t.eventIndex<t.events.length;){let n=t.events[t.eventIndex++];switch(t.position=d0e(n),n.type){case Rr.DOCUMENT:t.anchors=new Map,t.nodeTags=new Map,t.aliasCount=0,t.tagHandlers=Object.create(null);for(let i of n.directives)i.kind==="tag"&&(t.tagHandlers[i.handle]=i.prefix);t.frames.push({kind:"document",position:t.position,value:void 0,hasValue:!1});break;case Rr.SCALAR:{let{value:i,tag:s}=p0e(t,n);Y2(t,n,i,s,!0),H2(t,i,s);break}case Rr.SEQUENCE:{let i=f8(t,n,"tag:yaml.org,2002:seq"),s=t.schema.lookupSequenceTag(i);s||Ln(t,`unknown sequence tag !<${i}>`);let o=s.create(i),c=Y2(t,n,o,s,s.carrierIsResult);t.frames.push({kind:"sequence",position:t.position,value:o,tag:s,anchor:c,index:0});break}case Rr.MAPPING:{let i=f8(t,n,"tag:yaml.org,2002:map"),s=t.schema.lookupMappingTag(i);s||Ln(t,`unknown mapping tag !<${i}>`);let o=s.create(i),c=Y2(t,n,o,s,s.carrierIsResult);t.frames.push({kind:"mapping",position:t.position,value:o,tag:s,anchor:c,key:void 0,keyPosition:t.position,hasKey:!1,keyIsMerge:!1,overridable:null});break}case Rr.ALIAS:{t.maxAliases!==-1&&++t.aliasCount>t.maxAliases&&Ln(t,`aliases exceeded maxAliases (${t.maxAliases})`);let i=t.source.slice(n.anchorStart,n.anchorEnd),s=t.anchors.get(i);s||Ln(t,`unidentified alias "${i}"`),s.isValueFinal||Ln(t,`recursive alias "${i}" is not supported for tag ${s.tag.tagName} because it uses finalize()`),H2(t,s.value,s.tag);break}case Rr.POP:{let i=t.frames.pop();if(i.kind==="mapping"&&i.hasKey&&(t.position=i.keyPosition,Ln(t,"incomplete mapping pair in event stream")),i.kind==="document")t.documents.push(i.value);else{let s=i.tag.carrierIsResult?i.value:x8(t,i.position,i.tag,i.value);i.anchor&&(i.anchor.value=s,i.anchor.isValueFinal=!0),H2(t,s,i.tag)}break}}}return t.documents}function E0e(r,e,t){r.events.push({type:Rr.DOCUMENT,explicitStart:e,explicitEnd:t,directives:r.directives})}function k8(r,e,t,n,i,s,o){r.events.push({type:Rr.SEQUENCE,start:e,anchorStart:t,anchorEnd:n,tagStart:i,tagEnd:s,style:o})}function rP(r,e,t,n,i,s,o){r.events.push({type:Rr.MAPPING,start:e,anchorStart:t,anchorEnd:n,tagStart:i,tagEnd:s,style:o})}function h8(r,e){r.events.splice(e.eventsLength,0,{type:Rr.MAPPING,start:e.position,anchorStart:It,anchorEnd:It,tagStart:It,tagEnd:It,style:Gi.FLOW})}function pp(r,e,t,n,i,s,o,c,l=es.CLIP,u=-1,f=!1){r.events.push({type:Rr.SCALAR,valueStart:e,valueEnd:t,anchorStart:n,anchorEnd:i,tagStart:s,tagEnd:o,style:c,chomping:l,indent:u,fast:f})}function v0e(r,e,t){r.events.push({type:Rr.ALIAS,anchorStart:e,anchorEnd:t})}function lp(r){r.events.push({type:Rr.POP})}function _i(r){pp(r,It,It,It,It,It,It,Ke.PLAIN)}function m8(){return{anchorStart:It,anchorEnd:It,tagStart:It,tagEnd:It}}function up(r){return{position:r.position,line:r.line,lineStart:r.lineStart,lineIndent:r.lineIndent,firstTabInLine:r.firstTabInLine,eventsLength:r.events.length}}function Fu(r,e){r.position=e.position,r.line=e.line,r.lineStart=e.lineStart,r.lineIndent=e.lineIndent,r.firstTabInLine=e.firstTabInLine,r.events.length=e.eventsLength}function Ge(r,e){sl.throwAt(r.input.slice(0,r.length),r.position,e,r.filename)}function ln(r){return r===10||r===13}function Du(r){return r===9||r===32}function no(r){return Du(r)||ln(r)}function ec(r){return r===0||no(r)}function Nu(r){return r===44||r===91||r===93||r===123||r===125}function T0e(r){return r>=48&&r<=57?r-48:-1}function A0e(r){if(r>=48&&r<=57)return r-48;let e=r|32;return e>=97&&e<=102?e-97+10:-1}function I0e(r){return r===120?2:r===117?4:r===85?8:0}function R0e(r){return r===48||r===97||r===98||r===116||r===9||r===110||r===118||r===102||r===114||r===101||r===32||r===34||r===47||r===92||r===78||r===95||r===76||r===80}function Kw(r){r.input.charCodeAt(r.position)===10?r.position++:(r.position++,r.input.charCodeAt(r.position)===10&&r.position++),r.line++,r.lineStart=r.position,r.lineIndent=0,r.firstTabInLine=-1}function Xn(r,e){let t=0,n=r.input.charCodeAt(r.position),i=r.position===r.lineStart||no(r.input.charCodeAt(r.position-1));for(;n!==0;){for(;Du(n);)i=!0,n===9&&r.firstTabInLine===-1&&(r.firstTabInLine=r.position),n=r.input.charCodeAt(++r.position);if(e&&i&&n===35)do n=r.input.charCodeAt(++r.position);while(!ln(n)&&n!==0);if(!ln(n))break;for(Kw(r),t++,i=!0,n=r.input.charCodeAt(r.position);n===32;)r.lineIndent++,n=r.input.charCodeAt(++r.position)}return t}function dp(r,e=r.position){let t=r.input.charCodeAt(e);if((t===45||t===46)&&t===r.input.charCodeAt(e+1)&&t===r.input.charCodeAt(e+2)){let n=r.input.charCodeAt(e+3);return n===0||no(n)}return!1}function M8(r){r.position===r.lineStart&&r.input.charCodeAt(r.position)===65279&&(r.position++,r.lineStart=r.position)}function hP(r){if(r.position!==r.lineStart)return!1;if(dp(r))return!0;if(r.input.charCodeAt(r.position)!==65279)return!1;let e=up(r);M8(r),Xn(r,!0);let t=r.input.charCodeAt(r.position),n=r.position===r.lineStart&&(t===37||t===45&&dp(r));return Fu(r,e),n}function g8(r){let e=r.input.charCodeAt(r.position);for(;e!==0&&!ln(e);)e=r.input.charCodeAt(++r.position)}function $8(r,e,t){y0e.test(r.input.slice(e,t))&&Ge(r,"the stream contains non-printable characters")}function C0e(r,e,t){if(r.input.charCodeAt(r.position)!==33)return!1;e.tagStart!==It&&Ge(r,"duplication of a tag property");let n=r.position,i=!1,s=!1,o="!",c=r.input.charCodeAt(++r.position);c===60?(i=!0,c=r.input.charCodeAt(++r.position)):c===33&&(s=!0,o="!!",c=r.input.charCodeAt(++r.position));let l=r.position,u;if(i){for(;c!==0&&c!==62;)c=r.input.charCodeAt(++r.position);c!==62&&Ge(r,"unexpected end of the stream within a verbatim tag"),u=r.input.slice(l,r.position),r.position++}else{for(;c!==0&&!no(c)&&!(t&&Nu(c));)c===33&&(s?Ge(r,"tag suffix cannot contain exclamation marks"):(o=r.input.slice(l-1,r.position+1),D8.test(o)||Ge(r,"named tag handle cannot contain such characters"),s=!0,l=r.position+1)),c=r.input.charCodeAt(++r.position);u=r.input.slice(l,r.position),_0e.test(u)&&Ge(r,"tag suffix cannot contain flow indicator characters")}return u&&!(i?b0e.test(u):S0e.test(u))&&Ge(r,`tag name cannot contain such characters: ${u}`),!i&&o!=="!"&&o!=="!!"&&!F8.call(r.tagHandlers,o)&&Ge(r,`undeclared tag handle "${o}"`),e.tagStart=n,e.tagEnd=r.position,!0}function O0e(r,e){if(r.input.charCodeAt(r.position)!==38)return!1;e.anchorStart!==It&&Ge(r,"duplication of an anchor property"),r.position++;let t=r.position;for(;r.input.charCodeAt(r.position)!==0&&!no(r.input.charCodeAt(r.position))&&!Nu(r.input.charCodeAt(r.position));)r.position++;return r.position===t&&Ge(r,"name of an anchor node must contain at least one character"),e.anchorStart=t,e.anchorEnd=r.position,!0}function x0e(r,e){if(r.input.charCodeAt(r.position)!==42)return!1;(e.anchorStart!==It||e.tagStart!==It)&&Ge(r,"alias node should not have any properties"),r.position++;let t=r.position;for(;r.input.charCodeAt(r.position)!==0&&!no(r.input.charCodeAt(r.position))&&!Nu(r.input.charCodeAt(r.position));)r.position++;return r.position===t&&Ge(r,"name of an alias node must contain at least one character"),v0e(r,t,r.position),!0}function nP(r,e){Xn(r,!1),r.lineIndent<e&&Ge(r,"deficient indentation")}function P0e(r,e,t){if(r.input.charCodeAt(r.position)!==39)return!1;r.position++;let n=r.position,i=!0;for(;r.input.charCodeAt(r.position)!==0;){let s=r.input.charCodeAt(r.position);if(s===39){if(r.input.charCodeAt(r.position+1)===39){i=!1,r.position+=2;continue}let o=r.position;return r.position++,pp(r,n,o,t.anchorStart,t.anchorEnd,t.tagStart,t.tagEnd,Ke.SINGLE_QUOTED,es.CLIP,-1,i),!0}ln(s)?(i=!1,nP(r,e)):r.position===r.lineStart&&dp(r)?Ge(r,"unexpected end of the document within a single quoted scalar"):s!==9&&s<32?Ge(r,"expected valid JSON character"):r.position++}Ge(r,"unexpected end of the stream within a single quoted scalar")}function F0e(r,e,t){if(r.input.charCodeAt(r.position)!==34)return!1;r.position++;let n=r.position,i=!0;for(;r.input.charCodeAt(r.position)!==0;){let s=r.input.charCodeAt(r.position);if(s===34){let o=r.position;return r.position++,pp(r,n,o,t.anchorStart,t.anchorEnd,t.tagStart,t.tagEnd,Ke.DOUBLE_QUOTED,es.CLIP,-1,i),!0}if(s===92){i=!1;let o=r.input.charCodeAt(++r.position);if(ln(o))nP(r,e);else if(R0e(o))r.position++;else{let c=I0e(o);for(c===0&&Ge(r,"unknown escape sequence");c-- >0;)r.position++,A0e(r.input.charCodeAt(r.position))<0&&Ge(r,"expected hexadecimal character");r.position++}}else ln(s)?(i=!1,nP(r,e)):r.position===r.lineStart&&dp(r)?Ge(r,"unexpected end of the document within a double quoted scalar"):s!==9&&s<32?Ge(r,"expected valid JSON character"):r.position++}Ge(r,"unexpected end of the stream within a double quoted scalar")}function L0e(r,e,t){let n=r.input.charCodeAt(r.position),i=es.CLIP,s=-1,o=!1;if(n!==124&&n!==62)return!1;let c=n===124?Ke.LITERAL_BLOCK:Ke.FOLDED_BLOCK;for(r.position++;r.input.charCodeAt(r.position)!==0;){let h=r.input.charCodeAt(r.position),g=T0e(h);if(h===43||h===45)i!==es.CLIP&&Ge(r,"repeat of a chomping mode identifier"),i=h===43?es.KEEP:es.STRIP,r.position++;else if(g>=0)g===0&&Ge(r,"bad explicit indentation width of a block scalar; it cannot be less than one"),o&&Ge(r,"repeat of an indentation width identifier"),s=e+g-1,o=!0,r.position++;else break}let l=!1;for(;Du(r.input.charCodeAt(r.position));)l=!0,r.position++;l&&r.input.charCodeAt(r.position)===35&&g8(r),ln(r.input.charCodeAt(r.position))?Kw(r):r.input.charCodeAt(r.position)!==0&&Ge(r,"a line break is expected");let u=o?s:-1,f=0,d=r.position,p=r.position;for(;r.input.charCodeAt(r.position)!==0;){let h=r.position,g=0;for(;r.input.charCodeAt(h+g)===32;)g++;let m=r.input.charCodeAt(h+g);if(m===0){u>=0?g>u&&(p=h+g):g>0&&(p=h+g);break}if(hP(r))break;if(!o&&u===-1&&ln(m)&&(f=Math.max(f,g)),!o&&u===-1&&!ln(m)&&(m===9&&g<e&&(r.position=h+g,Ge(r,"tab characters must not be used in indentation")),g<f&&(r.position=h+g,Ge(r,"bad indentation of a mapping entry"))),u===-1&&m!==0&&!ln(m)&&g<e){r.lineIndent=g,r.position=h+g;break}!o&&m!==0&&!ln(m)&&u===-1&&(u=g);let _=u===-1?e+1:u;if(m!==0&&!ln(m)&&g<_){r.lineIndent=g,r.position=h+g;break}g8(r),p=r.position,ln(r.input.charCodeAt(r.position))&&(Kw(r),p=r.position)}return $8(r,d,p),pp(r,d,p,t.anchorStart,t.anchorEnd,t.tagStart,t.tagEnd,c,i,u),!0}function D0e(r,e){let t=r.input.charCodeAt(r.position),n=e===fp;if(t===0||no(t)||t===35||t===38||t===42||t===33||t===124||t===62||t===39||t===34||t===37||t===64||t===96||n&&Nu(t))return!1;if(t===63||t===45){let i=r.input.charCodeAt(r.position+1);if(ec(i)||n&&Nu(i))return!1}return!0}function N0e(r,e,t,n){if(!D0e(r,t))return!1;let i=r.position,s=r.position,o=r.input.charCodeAt(r.position),c=t===fp,l=!1;for(;o!==0&&!hP(r);){if(o===58){let u=r.input.charCodeAt(r.position+1);if(ec(u)||c&&Nu(u))break}else if(o===35){if(no(r.input.charCodeAt(r.position-1)))break}else{if(c&&Nu(o))break;if(ln(o)){let u=r.position,f=r.line,d=r.lineStart,p=r.lineIndent;if(Xn(r,!1),r.lineIndent>=e){l=!0,o=r.input.charCodeAt(r.position);continue}r.position=u,r.line=f,r.lineStart=d,r.lineIndent=p;break}}Du(o)||(s=r.position+1),o=r.input.charCodeAt(++r.position)}return s===i?!1:($8(r,i,s),pp(r,i,s,n.anchorStart,n.anchorEnd,n.tagStart,n.tagEnd,Ke.PLAIN,es.CLIP,-1,!l),!0)}function dg(r,e){let t=r.line;Xn(r,!0),(r.line>t&&r.lineIndent<e||r.firstTabInLine!==-1&&r.lineIndent<e)&&Ge(r,"deficient indentation")}function k0e(r,e,t){let n=r.input.charCodeAt(r.position),i=n===123,s=r.position,o=!0;if(n!==91&&n!==123)return!1;let c=i?125:93;for(i?rP(r,s,t.anchorStart,t.anchorEnd,t.tagStart,t.tagEnd,Gi.FLOW):k8(r,s,t.anchorStart,t.anchorEnd,t.tagStart,t.tagEnd,Gi.FLOW),r.position++;r.input.charCodeAt(r.position)!==0;){dg(r,e);let l=r.input.charCodeAt(r.position);if(l===c)return r.position++,lp(r),!0;o?l===44&&Ge(r,"expected the node content, but found ','"):Ge(r,"missed comma between flow collection entries");let u=!1,f=!1;l===63&&no(r.input.charCodeAt(r.position+1))&&(u=f=!0,r.position+=1,dg(r,e));let d=r.line,p=up(r),h=Lu(r,e,fp,!1,!0);dg(r,e),l=r.input.charCodeAt(r.position),(i||f||r.line===d)&&l===58?(u=!0,r.position++,dg(r,e),i||h8(r,p),h||_i(r),Lu(r,e,fp,!1,!0)||_i(r),dg(r,e),i||lp(r)):i&&u?(h||_i(r),_i(r)):i?_i(r):u&&(h8(r,p),h||_i(r),_i(r),lp(r)),l=r.input.charCodeAt(r.position),l===44?(o=!0,r.position++):o=!1}Ge(r,"unexpected end of the stream within a flow collection")}function y8(r,e,t){if(r.firstTabInLine!==-1||r.input.charCodeAt(r.position)!==45||!ec(r.input.charCodeAt(r.position+1)))return!1;for(k8(r,r.position,t.anchorStart,t.anchorEnd,t.tagStart,t.tagEnd,Gi.BLOCK);r.input.charCodeAt(r.position)===45&&ec(r.input.charCodeAt(r.position+1));){r.firstTabInLine!==-1&&(r.position=r.firstTabInLine,Ge(r,"tab characters must not be used in indentation"));let n=r.line;r.position++;let i=Xn(r,!0)>0;if(r.firstTabInLine!==-1&&r.input.charCodeAt(r.position)===45&&ec(r.input.charCodeAt(r.position+1))&&Ge(r,"bad indentation of a sequence entry"),i&&r.lineIndent<=e?_i(r):Lu(r,e,L8,!1,!0),Xn(r,!0),r.lineIndent<e||r.position>=r.length)break;r.lineIndent>e&&Ge(r,"bad indentation of a sequence entry"),r.line===n&&r.input.charCodeAt(r.position)===45&&ec(r.input.charCodeAt(r.position+1))&&Ge(r,"bad indentation of a sequence entry")}return lp(r),!0}function Q2(r,e,t,n){let i=!1,s=!1,o=!1,c=!1;if(r.firstTabInLine!==-1)return!1;let l=r.input.charCodeAt(r.position);for(;l!==0;){!i&&r.firstTabInLine!==-1&&(r.position=r.firstTabInLine,Ge(r,"tab characters must not be used in indentation"));let u=r.input.charCodeAt(r.position+1),f=r.line;if((l===63||l===58)&&ec(u))o||(rP(r,r.position,n.anchorStart,n.anchorEnd,n.tagStart,n.tagEnd,Gi.BLOCK),o=!0),l===63?(i&&_i(r),s=!0,i=!0):(i||(_i(r),s=!0),i=!1),r.position+=1,c=!0;else{i&&(_i(r),i=!1);let d=up(r);if(!Lu(r,t,eP,!1,!0))break;if(r.line===f){for(l=r.input.charCodeAt(r.position);Du(l);)l=r.input.charCodeAt(++r.position);if(l===58){if(l=r.input.charCodeAt(++r.position),ec(l)||Ge(r,"a whitespace character is expected after the key-value separator within a block mapping"),!o){for(Fu(r,d),rP(r,d.position,n.anchorStart,n.anchorEnd,n.tagStart,n.tagEnd,Gi.BLOCK),o=!0,Lu(r,t,eP,!1,!0),l=r.input.charCodeAt(r.position);Du(l);)l=r.input.charCodeAt(++r.position);r.position++}s=!0,i=!1,c=!1}else if(s)Ge(r,"expected ':' after a mapping key");else return n.anchorStart!==It||n.tagStart!==It?(Fu(r,d),!1):!0}else if(s)Ge(r,"can not read a block mapping entry; a multiline key may not be an implicit key");else return n.anchorStart!==It||n.tagStart!==It?(Fu(r,d),!1):!0}if(Lu(r,e,Ww,!0,c)&&(c=!1),i||c&&(_i(r),c=!1),Xn(r,!0),l=r.input.charCodeAt(r.position),(r.line===f||r.lineIndent>e)&&l!==0)Ge(r,"bad indentation of a mapping entry");else if(r.lineIndent<e)break}return s?(i&&_i(r),o&&lp(r),!0):!1}function Lu(r,e,t,n,i,s=!0){r.depth>=r.maxDepth&&Ge(r,`nesting exceeded maxDepth (${r.maxDepth})`),r.depth++;let o=1,c=!1,l=!1,u=null,f=m8(),d=t===Ww||t===L8,p=d,h=d;if(n&&Xn(r,!0)&&(c=!0,r.lineIndent>e?o=1:r.lineIndent===e?o=0:o=-1),o===1)for(;;){let g=r.input.charCodeAt(r.position),m=up(r);if(c&&o!==1&&(g===33||g===38))break;if(c&&h&&(f.tagStart!==It||f.anchorStart!==It)&&(g===33||g===38)){let _=up(r),b=e+1;if(Q2(r,r.position-r.lineStart,b,f)&&r.events[_.eventsLength]?.type===Rr.MAPPING)return r.depth--,!0;Fu(r,_)}if(c&&(g===33&&f.tagStart!==It||g===38&&f.anchorStart!==It)||!C0e(r,f,t===fp)&&!O0e(r,f))break;u===null&&(u=m),Xn(r,!0)?(c=!0,p=h,r.lineIndent>e?o=1:r.lineIndent===e?o=0:o=-1):p=!1}if(p&&(p=c||i),o===1||t===Ww){let g=t===fp||t===eP?e:e+1,m=r.position-r.lineStart;if(o===1)if(p&&(y8(r,m,f)||Q2(r,m,g,f))||k0e(r,g,f))l=!0;else{let _=r.input.charCodeAt(r.position);if(u!==null&&s&&h&&!p&&_!==124&&_!==62){let b=up(r),w=u.position-u.lineStart;Fu(r,u),Q2(r,w,g,m8())&&r.events[b.eventsLength]?.type===Rr.MAPPING?l=!0:Fu(r,b)}!l&&(d&&L0e(r,g,f)||P0e(r,g,f)||F0e(r,g,f)||x0e(r,f)||N0e(r,g,t,f))&&(l=!0)}else o===0&&(l=p&&y8(r,m,f))}return d=d&&!l,!l&&(f.anchorStart!==It||f.tagStart!==It||d)&&(pp(r,It,It,f.anchorStart,f.anchorEnd,f.tagStart,f.tagEnd,Ke.PLAIN),l=!0),r.depth--,l||f.anchorStart!==It||f.tagStart!==It}function M0e(r){if(r.lineIndent>0||r.input.charCodeAt(r.position)!==37)return!1;r.position++;let e=r.position;for(;r.input.charCodeAt(r.position)!==0&&!no(r.input.charCodeAt(r.position));)r.position++;let t=r.input.slice(e,r.position),n=[];for(t.length===0&&Ge(r,"directive name must not be less than one character in length");r.input.charCodeAt(r.position)!==0&&!ln(r.input.charCodeAt(r.position));){for(;Du(r.input.charCodeAt(r.position));)r.position++;if(r.input.charCodeAt(r.position)===35||ln(r.input.charCodeAt(r.position))||r.input.charCodeAt(r.position)===0)break;let i=r.position;for(;r.input.charCodeAt(r.position)!==0&&!no(r.input.charCodeAt(r.position));)r.position++;n.push(r.input.slice(i,r.position))}if(ln(r.input.charCodeAt(r.position))&&Kw(r),t==="YAML"){r.directives.some(s=>s.kind==="yaml")&&Ge(r,"duplication of %YAML directive"),n.length!==1&&Ge(r,"YAML directive accepts exactly one argument");let i=/^([0-9]+)\.([0-9]+)$/.exec(n[0]);i===null&&Ge(r,"ill-formed argument of the YAML directive"),parseInt(i[1],10)!==1&&Ge(r,"unacceptable YAML version of the document"),r.directives.push({kind:"yaml",version:n[0]})}else if(t==="TAG"){n.length!==2&&Ge(r,"TAG directive accepts exactly two arguments");let[i,s]=n;D8.test(i)||Ge(r,"ill-formed tag handle (first argument) of the TAG directive"),F8.call(r.tagHandlers,i)&&Ge(r,`there is a previously declared suffix for "${i}" tag handle`),w0e.test(s)||Ge(r,"ill-formed tag prefix (second argument) of the TAG directive"),r.tagHandlers[i]=s,r.directives.push({kind:"tag",handle:i,prefix:s})}return!0}function $0e(r){r.directives=[],r.tagHandlers=Object.create(null);let e=!1;for(Xn(r,!0);M0e(r);)e=!0,Xn(r,!0);let t=!1,n=!1,i=!0;if(r.lineIndent===0&&r.input.charCodeAt(r.position)===45&&r.input.charCodeAt(r.position+1)===45&&r.input.charCodeAt(r.position+2)===45&&ec(r.input.charCodeAt(r.position+3))){t=!0;let c=r.line;r.position+=3,Xn(r,!0),i=r.line>c}else e&&Ge(r,"directives end mark is expected");let s=r.events.length;if(!t&&r.position===r.lineStart&&r.input.charCodeAt(r.position)===46&&dp(r)){r.position+=3,Xn(r,!0);return}if(E0e(r,t,!1),Lu(r,r.lineIndent-1,Ww,!1,i,i)||_i(r),Xn(r,!0),r.position===r.lineStart&&dp(r)&&(n=r.input.charCodeAt(r.position)===46,n)){let c=r.line;r.position+=3,Xn(r,!0),r.line===c&&r.position<r.length&&Ge(r,"end of the stream or a document separator is expected")}let o=r.events[s];o?.type===Rr.DOCUMENT&&(o.explicitEnd=n),lp(r),!n&&r.position<r.length&&!hP(r)&&Ge(r,"end of the stream or a document separator is expected")}function j0e(r,e){let t=r.length,n={...pP,...e,input:`${r}\0`,length:t,position:0,line:0,lineStart:0,lineIndent:0,firstTabInLine:-1,depth:0,directives:[],tagHandlers:Object.create(null),events:[]},i=r.indexOf("\0");for(i!==-1&&sl.throwAt(r,i,"null byte is not allowed in input",n.filename);n.position<n.length&&(M8(n),Xn(n,!0),!(n.position>=n.length));){let s=n.position;$0e(n),n.position===s&&Ge(n,"can not read a document")}return n.events}function U0e(r,e={}){let t={...B0e,...e},n=String(r),i=Object.keys(pP),s=Object.keys(dP);return g0e(j0e(n,Z2(t,i)),{...Z2(t,s),source:n})}function ol(r,e){let t=U0e(r,e);if(t.length===0)throw new sl("expected a document, but the input is empty");if(t.length===1)return t[0];throw new sl("expected a single document in the stream, but found more")}function V0e(r){let e=new Set([r.defaultScalarTag,r.defaultSequenceTag,r.defaultMappingTag].filter(s=>s!==void 0)),t=r.implicitScalarTags,n=r.tags.filter(s=>!(s.nodeKind==="scalar"&&s.implicit)&&!e.has(s)),i=r.tags.filter(s=>e.has(s));return[...t.map(s=>({tag:s,implicitTag:!0})),...n.map(s=>({tag:s,implicitTag:!1})),...i.map(s=>({tag:s,implicitTag:!0}))]}function G0e(r,e){for(let t=0,n=r.representTypes.length;t<n;t+=1){let{tag:i,implicitTag:s}=r.representTypes[t];if(i.identify(e)){let o;return i.matchByTagPrefix?o=i.representTagName(e):o=i.tagName,{tag:i,tagName:o,implicitTag:s}}}return null}function hg(r,e){if(!r.noRefs&&e!==null&&typeof e=="object"){let u=r.refs.get(e);if(u)return u.anchor===void 0&&(u.anchor=`ref_${r.refCounter++}`),{kind:"alias",anchor:u.anchor}}let t=G0e(r,e);if(!t){if(e===void 0||r.skipInvalid)return Pu;throw new sl(`unacceptable kind of an object to dump ${Object.prototype.toString.call(e)}`)}let{tag:n,tagName:i,implicitTag:s}=t,o=s?i:O8(i);if(n.nodeKind==="scalar")return{kind:"scalar",tag:o,tagged:!s,style:Ke.PLAIN,value:n.represent(e)};if(n.nodeKind==="sequence"){let u=n.represent(e),f={kind:"sequence",tag:o,tagged:!s,style:Gi.BLOCK,items:[]};r.noRefs||r.refs.set(e,f);for(let d=0,p=u.length;d<p;d+=1){let h=hg(r,u[d]);h===Pu&&u[d]===void 0&&(h=hg(r,null)),h!==Pu&&f.items.push(h)}return f}let c=n.represent(e),l={kind:"mapping",tag:o,tagged:!s,style:Gi.BLOCK,items:[]};r.noRefs||r.refs.set(e,l);for(let[u,f]of c){let d=hg(r,u);if(d===Pu)continue;let p=hg(r,f);p!==Pu&&l.items.push({key:d,value:p})}return l}function q0e(r,e,t={}){let n=hg({representTypes:V0e(e),noRefs:t.noRefs??!1,skipInvalid:t.skipInvalid??!1,refs:new Map,refCounter:0},r);return[{contents:n===Pu?null:n,directives:[]}]}function Gw(r,e,t){let n=e(r,t);if(n===W0e)return!0;if(n===j8)return!1;let i=t.depth+1;switch(r.kind){case"sequence":for(let s of r.items)if(Gw(s,e,{depth:i,parent:r,isKey:!1}))return!0;break;case"mapping":for(let{key:s,value:o}of r.items)if(Gw(s,e,{depth:i,parent:r,isKey:!0})||Gw(o,e,{depth:i,parent:r,isKey:!1}))return!0;break}return!1}function _8(r,e){for(let t of r)if(t.contents&&Gw(t.contents,e,{depth:0,parent:null,isKey:!1}))return}function Xw(r,e){return(r&1<<e)!==0}function B8(r){return r.presenterOptions.quoteStyle==="single"&&Xw(r.allowedStylesMask,Ke.SINGLE_QUOTED)?Ke.SINGLE_QUOTED:Ke.DOUBLE_QUOTED}function K0e(r){r.presenterOptions.quoteFlowKeys&&(!r.isKey||!r.flowOnly||r.style!==Ke.PLAIN||(r.style=Ke.DOUBLE_QUOTED))}function z0e(r){r.style===Ke.PLAIN&&/[\t\x7F-\xA0\u2028\u2029\uFEFF\uFFFE\uFFFF]/.test(r.node.value)&&(r.style=Ke.DOUBLE_QUOTED)}function H0e(r){r.style===Ke.PLAIN&&/^\s+$/.test(r.node.value)&&(r.style=Ke.DOUBLE_QUOTED)}function Y0e(r){r.presenterOptions.forceQuotes&&(r.isKey||r.style!==Ke.PLAIN||r.node.tag===r.presenterOptions.schema.defaultScalarTag.tagName&&(r.style=r.node.value.includes(`
408
408
  `)?Ke.DOUBLE_QUOTED:B8(r)))}function Q0e(r){if(r.style!==Ke.PLAIN||r.isKey)return;let e=r.node.value,t=e.indexOf(`
409
409
  `)!==-1;if(!Xw(r.allowedStylesMask,Ke.LITERAL_BLOCK)){t&&(r.style=Ke.DOUBLE_QUOTED);return}let n=r.presenterOptions.lineWidth;if(n===-1){t&&(r.style=Ke.LITERAL_BLOCK);return}let i=Math.max(Math.min(n,40),n-r.shiftOfContent),s=0,o=!1;for(;s<=e.length;){let c=e.length,l=e.indexOf(`
410
410
  `,s);l!==-1&&(c=l);let u=e.slice(s,c);if(u.length>i&&u[0]!==" "&&/ [^ \t]/.test(u)&&(o=!0),l===-1)break;s=l+1}o?r.style=Ke.FOLDED_BLOCK:t&&(r.style=Ke.LITERAL_BLOCK)}function X0e(r){r.style===Ke.PLAIN&&!Xw(r.allowedStylesMask,Ke.PLAIN)&&(r.style=B8(r))}function J0e(r){Xw(r.allowedStylesMask,r.style)||(r.style=Ke.DOUBLE_QUOTED)}function pg(r,e){return r|1<<e}function b_e(r){let e=r.node.value;if(e!==""){if(!(r.isKey?r.flowOnly?h_e:p_e:r.flowOnly?d_e:f_e).test(e)||r.shiftOfFirstLine===0&&__e.test(e))return!1;if(r.shiftOfContent===0){let n=e.indexOf(`
@@ -437,7 +437,7 @@ ${" ".repeat(r.indent*e)}`}function k_e(r,e,t,n,i,s){return{node:e,parent:t,leve
437
437
  `:" ";n+=`---${d}${f}
438
438
  `}else n+=tc(t,0,o.contents,null,{block:!0,compact:!0}).text+`
439
439
  `;i=o.explicitEnd||t.openEnded,i&&(n+=`...
440
- `)}return n}function q_e(r,e){let t=String(r),n=String(e);return t<n?-1:t>n?1:0}function hp(r,e={}){let t={...G_e,...e},n=q0e(r,t.schema,{noRefs:t.noRefs,skipInvalid:t.skipInvalid});if(t.flowLevel>=0&&_8(n,(i,s)=>{if(!(s.depth<t.flowLevel))return(i.kind==="sequence"||i.kind==="mapping")&&(i.style=Gi.FLOW),j8}),t.sortKeys){let i=t.sortKeys===!0?q_e:t.sortKeys;_8(n,s=>{s.kind==="mapping"&&s.items.sort((o,c)=>i(o.key.kind==="scalar"?o.key.value:"",c.key.kind==="scalar"?c.key.value:""))})}return t.transform(n),V_e(n,{...Zx(t,Object.keys(yP)),schema:t.schema})}var Et,Qge,Xge,Jge,Zge,eye,tye,rye,nye,iye,sye,oye,aye,cye,lye,uye,fye,dye,E8,mye,gye,bye,Sye,Xx,vye,Tye,v8,Rye,Cye,Pye,Fye,Lye,Jx,kye,Mye,Bye,Uye,Vye,qye,Wye,Kye,zye,Hye,Yye,Qw,uP,y4e,ku,mg,Zye,_4e,b4e,e0e,sl,Rr,Ke,Gi,es,r0e,I8,R8,u0e,cp,f0e,dP,It,F8,fp,eP,L8,Ww,y0e,_0e,D8,tP,N8,b0e,S0e,w0e,pP,B0e,Pu,W0e,j8,b8,Z0e,e_e,t_e,mP,U8,Jw,V8,G8,r_e,iP,sP,n_e,i_e,q8,W8,K8,z8,H8,Y8,s_e,o_e,a_e,c_e,l_e,u_e,f_e,d_e,p_e,h_e,m_e,g_e,y_e,__e,gP,P_e,zw,yP,G_e,S4e,w4e,E4e,v4e,T4e,A4e,I4e,R4e,C4e,O4e,x4e,P4e,F4e,L4e,D4e,N4e,gg=Be(()=>{Et=Symbol("NOT_RESOLVED");a(Jn,"defineScalarTag");a(lP,"defineSequenceTag");a(Hw,"defineMappingTag");Qge=Jn("tag:yaml.org,2002:str",{resolve:a(r=>r,"resolve"),identify:a(r=>typeof r=="string","identify")}),Xge=["","~","null","Null","NULL"],Jge=Jn("tag:yaml.org,2002:null",{implicit:!0,implicitFirstChars:["","~","n","N"],resolve:a(r=>Xge.indexOf(r)!==-1?null:Et,"resolve"),identify:a(r=>r===null,"identify"),represent:a(()=>"null","represent")}),Zge=Jn("tag:yaml.org,2002:null",{implicit:!0,implicitFirstChars:["n"],resolve:a((r,e)=>r==="null"||e&&r===""?null:Et,"resolve"),identify:a(r=>r===null,"identify"),represent:a(()=>"null","represent")}),eye=["","~","null","Null","NULL"],tye=Jn("tag:yaml.org,2002:null",{implicit:!0,implicitFirstChars:["","~","n","N"],resolve:a(r=>eye.indexOf(r)!==-1?null:Et,"resolve"),identify:a(r=>r===null,"identify"),represent:a(()=>"null","represent")}),rye=["true","True","TRUE"],nye=["false","False","FALSE"],iye=Jn("tag:yaml.org,2002:bool",{implicit:!0,implicitFirstChars:["t","T","f","F"],resolve:a(r=>rye.indexOf(r)!==-1?!0:nye.indexOf(r)!==-1?!1:Et,"resolve"),identify:a(r=>Object.prototype.toString.call(r)==="[object Boolean]","identify"),represent:a(r=>r?"true":"false","represent")}),sye=["true"],oye=["false"],aye=Jn("tag:yaml.org,2002:bool",{implicit:!0,implicitFirstChars:["t","f"],resolve:a(r=>sye.indexOf(r)!==-1?!0:oye.indexOf(r)!==-1?!1:Et,"resolve"),identify:a(r=>Object.prototype.toString.call(r)==="[object Boolean]","identify"),represent:a(r=>r?"true":"false","represent")}),cye=["true","True","TRUE","y","Y","yes","Yes","YES","on","On","ON"],lye=["false","False","FALSE","n","N","no","No","NO","off","Off","OFF"],uye=Jn("tag:yaml.org,2002:bool",{implicit:!0,implicitFirstChars:["y","Y","n","N","t","T","f","F","o","O"],resolve:a(r=>cye.indexOf(r)!==-1?!0:lye.indexOf(r)!==-1?!1:Et,"resolve"),identify:a(r=>Object.prototype.toString.call(r)==="[object Boolean]","identify"),represent:a(r=>r?"true":"false","represent")}),fye=new RegExp("^(?:0o[0-7]+|0x[0-9a-fA-F]+|[-+]?[0-9]+)$"),dye=new RegExp("^(?:[-+]?0b[0-1]+|[-+]?0o[0-7]+|[-+]?0x[0-9a-fA-F]+|[-+]?[0-9]+)$");a(pye,"parseYamlInteger$2");a(hye,"resolveYamlInteger$2");E8=Jn("tag:yaml.org,2002:int",{implicit:!0,implicitFirstChars:["-","+",..."0123456789"],resolve:hye,identify:a(r=>Number.isInteger(r)&&!Object.is(r,-0)&&r.toString(10).indexOf("e")<0,"identify"),represent:a(r=>r.toString(10),"represent")}),mye=new RegExp("^-?(?:0|[1-9][0-9]*)$"),gye=new RegExp("^(?:[-+]?0b[0-1]+|[-+]?0o[0-7]+|[-+]?0x[0-9a-fA-F]+|[-+]?[0-9]+)$");a(yye,"parseYamlInteger$1");a(_ye,"resolveYamlInteger$1");bye=Jn("tag:yaml.org,2002:int",{implicit:!0,implicitFirstChars:["-",..."0123456789"],resolve:_ye,identify:a(r=>Number.isInteger(r)&&!Object.is(r,-0)&&r.toString(10).indexOf("e")<0,"identify"),represent:a(r=>r.toString(10),"represent")}),Sye=new RegExp("^(?:[-+]?0b[0-1_]+|[-+]?0[0-7_]+|[-+]?0x[0-9a-fA-F_]+|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+|[-+]?(?:0|[1-9][0-9_]*))$");a(wye,"parseYamlInteger");a(Eye,"resolveYamlInteger");Xx=Jn("tag:yaml.org,2002:int",{implicit:!0,implicitFirstChars:["-","+",..."0123456789"],resolve:Eye,identify:a(r=>Number.isInteger(r)&&!Object.is(r,-0)&&r.toString(10).indexOf("e")<0,"identify"),represent:a(r=>r.toString(10),"represent")}),vye=new RegExp("^(?:[-+]?[0-9]+(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|[-+]?\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),Tye=new RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");a(Aye,"resolveYamlFloat$2");a(Iye,"representYamlFloat$2");v8=Jn("tag:yaml.org,2002:float",{implicit:!0,implicitFirstChars:["-","+",".",..."0123456789"],resolve:Aye,identify:a(r=>typeof r=="number"&&(!Number.isInteger(r)||Object.is(r,-0)||r.toString(10).indexOf("e")>=0),"identify"),represent:Iye}),Rye=new RegExp("^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$"),Cye=new RegExp("^(?:[-+]?[0-9]+(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|[-+]?\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");a(Oye,"resolveYamlFloat$1");a(xye,"representYamlFloat$1");Pye=Jn("tag:yaml.org,2002:float",{implicit:!0,implicitFirstChars:["-",..."0123456789"],resolve:Oye,identify:a(r=>typeof r=="number"&&(!Number.isInteger(r)||Object.is(r,-0)||r.toString(10).indexOf("e")>=0),"identify"),represent:xye}),Fye=new RegExp("^(?:[-+]?(?:(?:[0-9][0-9_]*)?\\.[0-9_]*)(?:[eE][-+][0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),Lye=new RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");a(Dye,"resolveYamlFloat");a(Nye,"representYamlFloat");Jx=Jn("tag:yaml.org,2002:float",{implicit:!0,implicitFirstChars:["-","+",".",..."0123456789"],resolve:Dye,identify:a(r=>typeof r=="number"&&(!Number.isInteger(r)||Object.is(r,-0)||r.toString(10).indexOf("e")>=0),"identify"),represent:Nye}),kye=Jn("tag:yaml.org,2002:merge",{implicit:!0,implicitFirstChars:["<"],resolve:a((r,e)=>r==="<<"||e&&r===""?"<<":Et,"resolve"),identify:a(()=>!1,"identify")}),Mye=/^[A-Za-z0-9+/]*={0,2}$/;a($ye,"resolveYamlBinary");a(jye,"representYamlBinary");Bye=Jn("tag:yaml.org,2002:binary",{resolve:$ye,identify:a(r=>Object.prototype.toString.call(r)==="[object Uint8Array]","identify"),represent:jye}),Uye=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),Vye=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");a(o8,"makeUtcDate");a(Gye,"resolveYamlTimestamp");qye=Jn("tag:yaml.org,2002:timestamp",{implicit:!0,implicitFirstChars:[..."0123456789"],resolve:Gye,identify:a(r=>r instanceof Date,"identify"),represent:a(r=>r.toISOString(),"represent")}),Wye=lP("tag:yaml.org,2002:seq",{create:a(()=>[],"create"),addItem:a((r,e)=>{r.push(e)},"addItem"),identify:Array.isArray});a(Yw,"isPlainObject");a(Zx,"pick");Kye=lP("tag:yaml.org,2002:omap",{create:a(()=>({list:[],seen:new Set}),"create"),addItem:a((r,e)=>{let t;if(e instanceof Map){if(e.size!==1)return"cannot resolve an ordered map item";t=e.keys().next().value}else if(Yw(e)){let n=Object.keys(e);if(n.length!==1)return"cannot resolve an ordered map item";t=n[0]}else return"cannot resolve an ordered map item";return r.seen.has(t)?"duplicate key in ordered map":(r.seen.add(t),r.list.push(e),"")},"addItem"),finalize:a(r=>r.list,"finalize"),identify:a(()=>!1,"identify")}),zye=lP("tag:yaml.org,2002:pairs",{create:a(()=>[],"create"),addItem:a((r,e)=>{if(e instanceof Map)return e.size!==1?"cannot resolve a pairs item":(r.push(e.entries().next().value),"");if(Object.prototype.toString.call(e)!=="[object Object]")return"cannot resolve a pairs item";let t=e,n=Object.keys(t);return n.length!==1?"cannot resolve a pairs item":(r.push([n[0],t[n[0]]]),"")},"addItem"),identify:a(()=>!1,"identify")}),Hye=Hw("tag:yaml.org,2002:map",{create:a(()=>({}),"create"),identify:Yw,represent:a(r=>{let e=new Map;for(let t of Object.keys(r))e.set(t,r[t]);return e},"represent"),addPair:a((r,e,t)=>{if(e!==null&&typeof e=="object")return"object-based map does not support complex keys";let n=String(e);return n==="__proto__"?Object.defineProperty(r,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[n]=t,""},"addPair"),has:a((r,e)=>e!==null&&typeof e=="object"?!1:Object.prototype.hasOwnProperty.call(r,String(e)),"has"),keys:a(r=>Object.keys(r),"keys"),get:a((r,e)=>{let t=String(e);return Object.prototype.hasOwnProperty.call(r,t)?r[t]:null},"get")}),Yye=Hw("tag:yaml.org,2002:set",{create:a(()=>new Set,"create"),identify:a(r=>r instanceof Set,"identify"),represent:a(r=>{let e=new Map;for(let t of r)e.set(t,null);return e},"represent"),addPair:a((r,e,t)=>t!==null?"cannot resolve a set item":(r.add(e),""),"addPair"),has:a((r,e)=>r.has(e),"has"),keys:a(r=>r.keys(),"keys"),get:a(()=>null,"get")});a(Qye,"createTagDefinitionMap");a(Xye,"createTagDefinitionListMap");a(Jye,"compileTags");Qw=class T8{static{a(this,"Schema")}tags;implicitScalarTags;implicitScalarByFirstChar;implicitScalarAnyFirstChar;defaultScalarTag;defaultSequenceTag;defaultMappingTag;exact;prefix;constructor(e){let t=Jye(e),n=[],i=Qye(),s=Xye();for(let f of t){if(f.nodeKind==="scalar"&&f.implicit){if(f.matchByTagPrefix)throw new Error("Implicit scalar tags cannot match by tag prefix");n.push(f)}switch(f.nodeKind){case"scalar":f.matchByTagPrefix?s.scalar.push(f):i.scalar[f.tagName]=f;break;case"sequence":f.matchByTagPrefix?s.sequence.push(f):i.sequence[f.tagName]=f;break;case"mapping":f.matchByTagPrefix?s.mapping.push(f):i.mapping[f.tagName]=f;break}}let o=n.filter(f=>f.implicitFirstChars===null),c=new Set;for(let f of n)if(f.implicitFirstChars!==null)for(let d of f.implicitFirstChars)c.add(d);let l=new Map;for(let f of c)l.set(f,n.filter(d=>d.implicitFirstChars===null||d.implicitFirstChars.indexOf(f)!==-1));let u=i.scalar["tag:yaml.org,2002:str"];if(!u)throw new Error("schema does not define the default scalar tag (tag:yaml.org,2002:str)");this.tags=t,this.implicitScalarTags=n,this.implicitScalarByFirstChar=l,this.implicitScalarAnyFirstChar=o,this.defaultScalarTag=u,this.defaultSequenceTag=i.sequence["tag:yaml.org,2002:seq"],this.defaultMappingTag=i.mapping["tag:yaml.org,2002:map"],this.exact=i,this.prefix=s}lookupScalarTag(e){let t=this.exact.scalar[e];if(t)return t;for(let n of this.prefix.scalar)if(e.startsWith(n.tagName))return n}lookupSequenceTag(e){let t=this.exact.sequence[e];if(t)return t;for(let n of this.prefix.sequence)if(e.startsWith(n.tagName))return n}lookupMappingTag(e){let t=this.exact.mapping[e];if(t)return t;for(let n of this.prefix.mapping)if(e.startsWith(n.tagName))return n}resolveImplicitScalarTag(e){let t=this.implicitScalarByFirstChar.get(e.charAt(0))??this.implicitScalarAnyFirstChar;for(let i of t){let s=i.resolve(e,!1,i.tagName);if(s!==Et)return{value:s,tag:i}}let n=this.defaultScalarTag;return{value:n.resolve(e,!1,n.tagName),tag:n}}withTags(...e){let t=[];for(let n of e)t=t.concat(n);return new T8([...this.tags,...t])}},uP=new Qw([Qge,Wye,Hye]),y4e=new Qw([...uP.tags,Zge,aye,bye,Pye]),ku=new Qw([...uP.tags,Jge,iye,E8,v8]),mg=new Qw([...uP.tags,tye,uye,Xx,Jx,qye,kye,Bye,Kye,zye,Yye]),Zye=mg.withTags({...Xx,resolve:a((r,e,t)=>{let n=Xx.resolve(r,e,t);return n===Et?E8.resolve(r,e,t):n},"resolve")},{...Jx,resolve:a((r,e,t)=>{let n=Jx.resolve(r,e,t);return n===Et?v8.resolve(r,e,t):n},"resolve")}),_4e=Hw("tag:yaml.org,2002:map",{create:a(()=>new Map,"create"),addPair:a((r,e,t)=>(r.set(e,t),""),"addPair"),has:a((r,e)=>r.has(e),"has"),keys:a(r=>r.keys(),"keys"),get:a((r,e)=>r.get(e),"get"),identify:a(r=>r instanceof Map||Yw(r),"identify"),represent:a(r=>{if(r instanceof Map)return r;let e=new Map,t=r;for(let n of Object.keys(t))e.set(n,t[n]);return e},"represent")});a(a8,"normalizeKey");b4e=Hw("tag:yaml.org,2002:map",{create:a(()=>({}),"create"),identify:Yw,represent:a(r=>{let e=new Map;for(let t of Object.keys(r))e.set(t,r[t]);return e},"represent"),addPair:a((r,e,t)=>{let n=a8(e);return n===null?"nested arrays are not supported inside keys":(n==="__proto__"?Object.defineProperty(r,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[n]=t,"")},"addPair"),has:a((r,e)=>{let t=a8(e);return t!==null&&Object.prototype.hasOwnProperty.call(r,t)},"has"),keys:a(r=>Object.keys(r),"keys"),get:a((r,e)=>{let t=String(e);return Object.prototype.hasOwnProperty.call(r,t)?r[t]:null},"get")}),e0e={maxLength:79,indent:1,linesBefore:3,linesAfter:2};a(Wx,"getLine");a(Kx,"padStart");a(t0e,"makeSnippet");a(c8,"formatError");sl=class A8 extends Error{static{a(this,"YAMLException")}reason;mark;constructor(e,t){super(),this.name="YAMLException",this.reason=e,this.mark=t,this.message=c8(this,!1),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}toString(e){return`${this.name}: ${c8(this,e)}`}static throwAt(e,t,n,i=""){let s=0,o=0;for(let l=0;l<t;l++){let u=e.charCodeAt(l);u===10?(s++,o=l+1):u===13&&(s++,e.charCodeAt(l+1)===10&&l++,o=l+1)}let c={name:i,buffer:e,position:t,line:s,column:t-o};throw c.snippet=t0e(c),new A8(n,c)}},Rr={DOCUMENT:1,SEQUENCE:2,MAPPING:3,SCALAR:4,ALIAS:5,POP:6},Ke={PLAIN:1,SINGLE_QUOTED:2,DOUBLE_QUOTED:3,LITERAL_BLOCK:4,FOLDED_BLOCK:5},Gi={BLOCK:1,FLOW:2},es={CLIP:1,STRIP:2,KEEP:3},r0e=-1;a(l8,"simpleEscapeSequence");I8=new Array(256),R8=new Array(256);for(let r=0;r<256;r++)I8[r]=l8(r)?1:0,R8[r]=l8(r);a(n0e,"charFromCodepoint");a(i0e,"fromHexCode$1");a(s0e,"escapedHexLen$1");a(qw,"skipFoldedBreaks");a(fP,"foldedBreaks");a(o0e,"getPlainValue");a(a0e,"getSingleQuotedValue");a(c0e,"getDoubleQuotedValue");a(u8,"getBlockValue");a(l0e,"getScalarValue");u0e=Object.assign(Object.create(null),{"!":"!","!!":"tag:yaml.org,2002:"});a(zx,"tagPercentEncode");a(C8,"tagNameFull");a(O8,"tagNameShort");cp=-1,f0e="tag:yaml.org,2002:merge",dP={filename:"",schema:ku,json:!1,maxTotalMergeKeys:1e4,maxAliases:-1};a(d0e,"eventPosition$1");a(Ln,"throwError$1");a(x8,"finalizeCollection");a(p0e,"constructScalar");a(f8,"collectionTagName");a(P8,"isMappingTag");a(d8,"chargeMergeWork");a(p8,"mergeKeys");a(h0e,"mergeSource");a(m0e,"addMappingValue");a(Hx,"addValue");a(Yx,"storeAnchor");a(g0e,"constructFromEvents");It=-1,F8=Object.prototype.hasOwnProperty,fp=1,eP=2,L8=3,Ww=4,y0e=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,_0e=/[,\[\]{}]/,D8=/^(?:!|!!|![0-9A-Za-z-]+!)$/,tP=String.raw`(?:%[0-9A-Fa-f]{2}|[0-9A-Za-z\-#;/?:@&=+$,_.!~*'()\[\]])`,N8=String.raw`(?:%[0-9A-Fa-f]{2}|[0-9A-Za-z\-#;/?:@&=+$.~*'()_])`,b0e=new RegExp(`^(?:${tP})*$`),S0e=new RegExp(`^(?:${N8})+$`),w0e=new RegExp(`^(?:!(?:${tP})*|${N8}(?:${tP})*)$`),pP={filename:"",maxDepth:100};a(E0e,"addDocumentEvent");a(k8,"addSequenceEvent");a(rP,"addMappingEvent");a(h8,"insertFlowPairMappingEvent");a(pp,"addScalarEvent");a(v0e,"addAliasEvent");a(lp,"addPopEvent");a(_i,"addEmptyScalarEvent");a(m8,"emptyProperties");a(up,"snapshotState");a(Fu,"restoreState");a(Ge,"throwError");a(ln,"isEol");a(Du,"isWhiteSpace");a(no,"isWsOrEol");a(ec,"isWsOrEolOrEnd");a(Nu,"isFlowIndicator");a(T0e,"fromDecimalCode");a(A0e,"fromHexCode");a(I0e,"escapedHexLen");a(R0e,"isSimpleEscape");a(Kw,"consumeLineBreak");a(Xn,"skipSeparationSpace");a(dp,"testDocumentSeparator");a(M8,"skipByteOrderMark");a(hP,"testDocumentBoundary");a(g8,"skipUntilLineEnd");a($8,"checkPrintable");a(C0e,"readTagProperty");a(O0e,"readAnchorProperty");a(x0e,"readAlias");a(nP,"readFlowScalarBreak");a(P0e,"readSingleQuotedScalar");a(F0e,"readDoubleQuotedScalar");a(L0e,"readBlockScalar");a(D0e,"canStartPlainScalar");a(N0e,"readPlainScalar");a(dg,"skipFlowSeparationSpace");a(k0e,"readFlowCollection");a(y8,"readBlockSequence");a(Qx,"readBlockMapping");a(Lu,"parseNode");a(M0e,"readDirective");a($0e,"readDocument");a(j0e,"parseEvents");B0e={...pP,...dP};a(U0e,"loadDocuments");a(ol,"load");Pu=Symbol("INVALID");a(V0e,"buildRepresentTypes");a(G0e,"matchTag");a(hg,"build");a(q0e,"jsToAst");W0e=Symbol("visit:break"),j8=Symbol("visit:skip");a(Gw,"visitNode");a(_8,"visit");a(Xw,"hasBit");b8={applyQuoteFlowKeysOption:K0e,doubleQuoteForInvisibles:z0e,doubleQuoteWhitespaceOnly:H0e,applyForceQuotesOption:Y0e,tryLongOrMultilineAsBlock:Q0e,quoteInvalidPlain:X0e,fallbackToDoubleQuoted:J0e};a(B8,"_preferredQuotedStyle");a(K0e,"applyQuoteFlowKeysOption");a(z0e,"doubleQuoteForInvisibles");a(H0e,"doubleQuoteWhitespaceOnly");a(Y0e,"applyForceQuotesOption");a(Q0e,"tryLongOrMultilineAsBlock");a(X0e,"quoteInvalidPlain");a(J0e,"fallbackToDoubleQuoted");a(pg,"setBit");Z0e="[\\x09\\x0A\\x0D\\x20-\\x7E\\x85\\xA0-\\uD7FF\\uE000-\\uFFFD\\u{10000}-\\u{10FFFF}]",e_e="[\\n\\r]",t_e="\\uFEFF",mP="[ \\t]",U8=`(?:(?!(?:${e_e}|${t_e}))${Z0e})`,Jw=`(?:(?!${mP})${U8})`,V8="[\\x09\\x20-\\uD7FF\\uE000-\\uFFFF\\u{10000}-\\u{10FFFF}]",G8="[-?:,\\[\\]{}#&*!|>'\"%@`]",r_e="[,\\[\\]{}]",iP=Jw,sP=`(?:(?!${r_e})${Jw})`,n_e=`(?:(?:(?!${G8})${Jw})|[?:-](?=${iP}))`,i_e=`(?:(?:(?!${G8})${Jw})|[?:-](?=${sP}))`,q8=`(?:(?:(?![:#])${iP})|:(?=${iP}))#*`,W8=`(?:(?:(?![:#])${sP})|:(?=${sP}))#*`,K8=`(?:${mP}*${q8})*`,z8=`(?:${mP}*${W8})*`,H8=`${n_e}#*${K8}`,Y8=`${i_e}#*${z8}`,s_e=H8,o_e=Y8,a_e=`\\n+${q8}${K8}`,c_e=`\\n+${W8}${z8}`,l_e=`${H8}(?:${a_e})*`,u_e=`${Y8}(?:${c_e})*`,f_e=new RegExp(`^(?:${l_e})$`,"u"),d_e=new RegExp(`^(?:${u_e})$`,"u"),p_e=new RegExp(`^(?:${s_e})$`,"u"),h_e=new RegExp(`^(?:${o_e})$`,"u"),m_e=new RegExp(`^(?:${V8})*$`,"u"),g_e=new RegExp(`^(?:${V8}|\\n)*$`,"u"),y_e=new RegExp(`^(?:${U8}|\\n)*$`,"u"),__e=/^(?:---|\.\.\.)(?=$|[ \t\n\r])/,gP=/^(?:---|\.\.\.)(?=$|[ \t\n\r])/m;a(b_e,"canUsePlain");a(S_e,"canUseSingleQuoted");a(w_e,"canUseBlock");a(E_e,"detectAllowedStyles");a(v_e,"renderScalar");a(T_e,"renderPlain");a(A_e,"renderSingleQuoted");a(I_e,"renderLiteralBlock");a(R_e,"renderFoldedBlock");a(C_e,"renderDoubleQuoted");a(Q8,"encodeFlowBreaks");a(X8,"indentString");a(O_e,"needIndentIndicator");a(J8,"blockHeader");a(Z8,"dropEndingNewline");a(oP,"isMoreIndented");a(S8,"foldLine");a(x_e,"foldBlockScalar");P_e=/["\\\x00-\x1F\x7F-\xA0\u2028\u2029\uD800-\uDFFF\uFEFF\uFFFE\uFFFF]/gu;a(F_e,"escapeCharacter");a(L_e,"escapeString");zw=10,yP={indent:2,seqNoIndent:!1,seqInlineFirst:!0,lineWidth:80,flowBracketPadding:!1,flowSkipCommaSpace:!1,flowSkipColonSpace:!1,quoteFlowKeys:!1,quoteStyle:"single",forceQuotes:!1,scalarStyleRules:Object.keys(b8).map(r=>Reflect.get(b8,r)),tagBeforeAnchor:!1};a(D_e,"nodeTagShort");a(N_e,"createPresenterState");a(aP,"generateNextLine");a(k_e,"scalarLayout");a(M_e,"writeFlowSequence");a(w8,"writeBlockSequence");a($_e,"writeFlowMapping");a(j_e,"writeBlockMapping");a(cP,"cannotBeCompact");a(tc,"writeNode");a(B_e,"rootStartsOwnLine");a(U_e,"writeDocumentDirectives");a(V_e,"present");G_e={...yP,schema:Zye,skipInvalid:!1,noRefs:!1,flowLevel:-1,sortKeys:!1,transform:a(()=>{},"transform")};a(q_e,"defaultCompareFn");a(hp,"dump");S4e=Rr.DOCUMENT,w4e=Rr.SEQUENCE,E4e=Rr.MAPPING,v4e=Rr.SCALAR,T4e=Rr.ALIAS,A4e=Rr.POP,I4e=Ke.PLAIN,R4e=Ke.SINGLE_QUOTED,C4e=Ke.DOUBLE_QUOTED,O4e=Ke.LITERAL_BLOCK,x4e=Ke.FOLDED_BLOCK,P4e=Gi.BLOCK,F4e=Gi.FLOW,L4e=es.CLIP,D4e=es.STRIP,N4e=es.KEEP});var _P,e7,W_e,t7=Be(()=>{_P=a((r,e,t)=>{let n=r instanceof RegExp?e7(r,t):r,i=e instanceof RegExp?e7(e,t):e,s=n!==null&&i!=null&&W_e(n,i,t);return s&&{start:s[0],end:s[1],pre:t.slice(0,s[0]),body:t.slice(s[0]+n.length,s[1]),post:t.slice(s[1]+i.length)}},"balanced"),e7=a((r,e)=>{let t=e.match(r);return t?t[0]:null},"maybeMatch"),W_e=a((r,e,t)=>{let n,i,s,o,c,l=t.indexOf(r),u=t.indexOf(e,l+1),f=l;if(l>=0&&u>0){if(r===e)return[l,u];for(n=[],s=t.length;f>=0&&!c;){if(f===l)n.push(f),l=t.indexOf(r,f+1);else if(n.length===1){let d=n.pop();d!==void 0&&(c=[d,u])}else i=n.pop(),i!==void 0&&i<s&&(s=i,o=u),u=t.indexOf(e,f+1);f=l<u&&l>=0?l:u}n.length&&o!==void 0&&(c=[s,o])}return c},"range")});function bP(r){return isNaN(r)?r.charCodeAt(0):parseInt(r,10)}function obe(r){return r.replace(X_e,r7).replace(J_e,n7).replace(Z_e,EP).replace(ebe,i7).replace(tbe,s7)}function abe(r){return r.replace(K_e,"\\").replace(z_e,"{").replace(H_e,"}").replace(Y_e,",").replace(Q_e,".")}function SP(r,e){for(let t=0;t<e.length;t++)r.push(e[t])}function cbe(r){let e=[],t="";for(;;){let n=_P("{","}",r);if(!n){let l=r.split(",");return l[0]=t+l[0],SP(e,l),e}let{pre:i,body:s,post:o}=n,c=i.split(",");if(c[0]=t+c[0],c[c.length-1]+="{"+s+"}",!o.length)return SP(e,c),e;t=c.pop(),SP(e,c),r=o}}function o7(r,e={}){if(!r)return[];let{max:t=rbe,maxLength:n=nbe,maxDepth:i=ibe,maxRewrites:s=sbe}=e;return r.slice(0,2)==="{}"&&(r="\\{\\}"+r.slice(2)),wP(obe(r),t,n,i,0,s,!0).map(abe)}function lbe(r){return"{"+r+"}"}function ube(r){return/^-?0\d/.test(r)}function fbe(r,e){return r<=e}function dbe(r,e){return r>=e}function yg(r,e,t,n,i,s){let o=[],c=0;for(let l=0;l<r.length;l++)for(let u=0;u<t.length;u++){if(o.length>=n)return o;let f=r[l]+e+t[u];if(!(s&&!f)){if(c+f.length>i)return o;o.push(f),c+=f.length}}return o}function pbe(r,e,t,n){let i=r.split(/\.\./),s=[];if(i[0]===void 0||i[1]===void 0)return s;let o=bP(i[0]),c=bP(i[1]),l=Math.max(i[0].length,i[1].length),u=i.length===3&&i[2]!==void 0?Math.max(Math.abs(bP(i[2])),1):1,f=fbe;c<o&&(u*=-1,f=dbe);let p=i.some(ube),h=0;for(let g=o;f(g,c)&&s.length<t;g+=u){let m;if(e)m=String.fromCharCode(g),m==="\\"&&(m="");else if(m=String(g),p){let _=l-m.length;if(_>0){let b=new Array(_+1).join("0");g<0?m="-"+b+m.slice(1):m=b+m}}if(h+m.length>n)break;s.push(m),h+=m.length}return s}function wP(r,e,t,n,i,s,o){if(i>n)return[r];let c=[""],l=0,u=!1,f=!0;for(;;){let d=_P("{","}",r);if(!d)return yg(c,r,[""],e,t,u);let p=d.pre;if(/\$$/.test(p)){if(c=yg(c,p+"{"+d.body+"}",[""],e,t,u&&!d.post.length),f=!1,!d.post.length)break;r=d.post;continue}let h=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(d.body),g=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(d.body),m=h||g,_=d.body.indexOf(",")>=0;if(!m&&!_){if(l<s&&d.post.match(/,(?!,).*\}/)){l++,r=d.pre+"{"+d.body+EP+d.post,o=!0;continue}return yg(c,p+"{"+d.body+"}"+d.post,[""],e,t,u)}f&&(u=o&&!m,f=!1);let b;if(m)b=pbe(d.body,g,e,t);else{let w=cbe(d.body);if(w.length===1&&w[0]!==void 0&&(w=wP(w[0],e,t,n,i+1,s,!1).map(lbe),w.length===1)){if(c=yg(c,p+w[0],[""],e,t,u&&!d.post.length),!d.post.length)break;r=d.post;continue}let v=u&&!d.post.length&&!p;for(let S=0;v&&S<c.length;S++)c[S]&&(v=!1);b=[];let E=0;e:for(let S=0;S<w.length;S++){let R=wP(w[S],e,t,n,i+1,s,!1);for(let C=0;C<R.length;C++){let P=R[C];if(!(v&&!P)){if(b.length>=e||E+P.length>t)break e;b.push(P),E+=P.length}}}}if(c=yg(c,p,b,e,t,u&&!d.post.length),!d.post.length)break;r=d.post}return c}var r7,n7,EP,i7,s7,K_e,z_e,H_e,Y_e,Q_e,X_e,J_e,Z_e,ebe,tbe,rbe,nbe,ibe,sbe,a7=Be(()=>{t7();r7="\0SLASH"+Math.random()+"\0",n7="\0OPEN"+Math.random()+"\0",EP="\0CLOSE"+Math.random()+"\0",i7="\0COMMA"+Math.random()+"\0",s7="\0PERIOD"+Math.random()+"\0",K_e=new RegExp(r7,"g"),z_e=new RegExp(n7,"g"),H_e=new RegExp(EP,"g"),Y_e=new RegExp(i7,"g"),Q_e=new RegExp(s7,"g"),X_e=/\\\\/g,J_e=/\\{/g,Z_e=/\\}/g,ebe=/\\,/g,tbe=/\\\./g,rbe=1e5,nbe=4e6,ibe=1e3,sbe=1e3;a(bP,"numeric");a(obe,"escapeBraces");a(abe,"unescapeBraces");a(SP,"pushAll");a(cbe,"parseCommaParts");a(o7,"expand");a(lbe,"embrace");a(ube,"isPadded");a(fbe,"lte");a(dbe,"gte");a(yg,"combine");a(pbe,"expandSequence");a(wP,"expand_")});var _g,c7=Be(()=>{_g=a(r=>{if(typeof r!="string")throw new TypeError("invalid pattern");if(r.length>65536)throw new TypeError("pattern is too long")},"assertValidPattern")});var hbe,bg,mbe,l7,u7,f7=Be(()=>{hbe={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},bg=a(r=>r.replace(/[[\]\\-]/g,"\\$&"),"braceEscape"),mbe=a(r=>r.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regexpEscape"),l7=a(r=>r.join(""),"rangesToString"),u7=a((r,e)=>{let t=e;if(r.charAt(t)!=="[")throw new Error("not in a brace expression");let n=[],i=[],s=t+1,o=!1,c=!1,l=!1,u=!1,f=t,d="";e:for(;s<r.length;){let m=r.charAt(s);if((m==="!"||m==="^")&&s===t+1){u=!0,s++;continue}if(m==="]"&&o&&!l){f=s+1;break}if(o=!0,m==="\\"&&!l){l=!0,s++;continue}if(m==="["&&!l){for(let[_,[b,w,v]]of Object.entries(hbe))if(r.startsWith(_,s)){if(d)return["$.",!1,r.length-t,!0];s+=_.length,v?i.push(b):n.push(b),c=c||w;continue e}}if(l=!1,d){m>d?n.push(bg(d)+"-"+bg(m)):m===d&&n.push(bg(m)),d="",s++;continue}if(r.startsWith("-]",s+1)){n.push(bg(m+"-")),s+=2;continue}if(r.startsWith("-",s+1)){d=m,s+=2;continue}n.push(bg(m)),s++}if(f<s)return["",!1,0,!1];if(!n.length&&!i.length)return["$.",!1,r.length-t,!0];if(i.length===0&&n.length===1&&/^\\?.$/.test(n[0])&&!u){let m=n[0].length===2?n[0].slice(-1):n[0];return[mbe(m),!1,f-t,!1]}let p="["+(u?"^":"")+l7(n)+"]",h="["+(u?"":"^")+l7(i)+"]";return[n.length&&i.length?"("+p+"|"+h+")":n.length?p:h,c,f-t,!0]},"parseClass")});var io,eE=Be(()=>{io=a((r,{windowsPathsNoEscape:e=!1,magicalBraces:t=!0}={})=>t?e?r.replace(/\[([^/\\])\]/g,"$1"):r.replace(/((?!\\).|^)\[([^/\\])\]/g,"$1$2").replace(/\\([^/])/g,"$1"):e?r.replace(/\[([^/\\{}])\]/g,"$1"):r.replace(/((?!\\).|^)\[([^/\\{}])\]/g,"$1$2").replace(/\\([^/{}])/g,"$1"),"unescape")});var qi,gbe,vP,d7,ybe,_be,bbe,p7,Sbe,tE,wbe,Ebe,vbe,Tbe,TP,h7,m7,Abe,Mu,AP=Be(()=>{f7();eE();gbe=new Set(["!","?","+","*","@"]),vP=a(r=>gbe.has(r),"isExtglobType"),d7=a(r=>vP(r.type),"isExtglobAST"),ybe=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),_be=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),bbe=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),p7=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),Sbe="(?!(?:^|/)\\.\\.?(?:$|/))",tE="(?!\\.)",wbe=new Set(["[","."]),Ebe=new Set(["..","."]),vbe=new Set("().*{}+?[]^$\\!"),Tbe=a(r=>r.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),TP="[^/]",h7=TP+"*?",m7=TP+"+?",Abe=0,Mu=class{static{a(this,"AST")}type;#t;#r;#n=!1;#e=[];#i;#a;#p;#u=!1;#c;#f;#l=!1;id=++Abe;get depth(){return(this.#i?.depth??-1)+1}[Symbol.for("nodejs.util.inspect.custom")](){return{"@@type":"AST",id:this.id,type:this.type,root:this.#t.id,parent:this.#i?.id,depth:this.depth,partsLength:this.#e.length,parts:this.#e}}constructor(e,t,n={}){this.type=e,e&&(this.#r=!0),this.#i=t,this.#t=this.#i?this.#i.#t:this,this.#c=this.#t===this?n:this.#t.#c,this.#p=this.#t===this?[]:this.#t.#p,e==="!"&&!this.#t.#u&&this.#p.push(this),this.#a=this.#i?this.#i.#e.length:0}get hasMagic(){if(this.#r!==void 0)return this.#r;for(let e of this.#e)if(typeof e!="string"&&(e.type||e.hasMagic))return this.#r=!0;return this.#r}toString(){return this.#f!==void 0?this.#f:this.type?this.#f=this.type+"("+this.#e.map(e=>String(e)).join("|")+")":this.#f=this.#e.map(e=>String(e)).join("")}#d(){if(this!==this.#t)throw new Error("should only call on root");if(this.#u)return this;this.toString(),this.#u=!0;let e;for(;e=this.#p.pop();){if(e.type!=="!")continue;let t=e,n=t.#i;for(;n;){for(let i=t.#a+1;!n.type&&i<n.#e.length;i++)for(let s of e.#e){if(typeof s=="string")throw new Error("string part in extglob AST??");s.copyIn(n.#e[i])}t=n,n=t.#i}}return this}push(...e){for(let t of e)if(t!==""){if(typeof t!="string"&&!(t instanceof qi&&t.#i===this))throw new Error("invalid part: "+t);this.#e.push(t)}}toJSON(){let e=this.type===null?this.#e.slice().map(t=>typeof t=="string"?t:t.toJSON()):[this.type,...this.#e.map(t=>t.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#t||this.#t.#u&&this.#i?.type==="!")&&e.push({}),e}isStart(){if(this.#t===this)return!0;if(!this.#i?.isStart())return!1;if(this.#a===0)return!0;let e=this.#i;for(let t=0;t<this.#a;t++){let n=e.#e[t];if(!(n instanceof qi&&n.type==="!"))return!1}return!0}isEnd(){if(this.#t===this||this.#i?.type==="!")return!0;if(!this.#i?.isEnd())return!1;if(!this.type)return this.#i?.isEnd();let e=this.#i?this.#i.#e.length:0;return this.#a===e-1}copyIn(e){typeof e=="string"?this.push(e):this.push(e.clone(this))}clone(e){let t=new qi(this.type,e);for(let n of this.#e)t.copyIn(n);return t}static#o(e,t,n,i,s){let o=i.maxExtglobRecursion??2,c=!1,l=!1,u=-1,f=!1;if(t.type===null){let m=n,_="";for(;m<e.length;){let b=e.charAt(m++);if(c||b==="\\"){c=!c,_+=b;continue}if(l){m===u+1?(b==="^"||b==="!")&&(f=!0):b==="]"&&!(m===u+2&&f)&&(l=!1),_+=b;continue}else if(b==="["){l=!0,u=m,f=!1,_+=b;continue}if(!i.noext&&vP(b)&&e.charAt(m)==="("&&s<=o){t.push(_),_="";let v=new qi(b,t);m=qi.#o(e,v,m,i,s+1),t.push(v);continue}_+=b}return t.push(_),m}let d=n+1,p=new qi(null,t),h=[],g="";for(;d<e.length;){let m=e.charAt(d++);if(c||m==="\\"){c=!c,g+=m;continue}if(l){d===u+1?(m==="^"||m==="!")&&(f=!0):m==="]"&&!(d===u+2&&f)&&(l=!1),g+=m;continue}else if(m==="["){l=!0,u=d,f=!1,g+=m;continue}if(!i.noext&&vP(m)&&e.charAt(d)==="("&&(s<=o||t&&t.#b(m))){let b=t&&t.#b(m)?0:1;p.push(g),g="";let w=new qi(m,p);p.push(w),d=qi.#o(e,w,d,i,s+b);continue}if(m==="|"){p.push(g),g="",h.push(p),p=new qi(null,t);continue}if(m===")")return g===""&&t.#e.length===0&&(t.#l=!0),p.push(g),g="",t.push(...h,p),d;g+=m}return t.type=null,t.#r=void 0,t.#e=[e.substring(n-1)],d}#g(e){return this.#E(e,_be)}#E(e,t=ybe){if(!e||typeof e!="object"||e.type!==null||e.#e.length!==1||this.type===null)return!1;let n=e.#e[0];return!n||typeof n!="object"||n.type===null?!1:this.#b(n.type,t)}#b(e,t=bbe){return!!t.get(this.type)?.includes(e)}#S(e,t){let n=e.#e[0],i=new qi(null,n,this.options);i.#e.push(""),n.push(i),this.#A(e,t)}#A(e,t){let n=e.#e[0];this.#e.splice(t,1,...n.#e);for(let i of n.#e)typeof i=="object"&&(i.#i=this);this.#f=void 0}#y(e){return!!p7.get(this.type)?.has(e)}#v(e){if(!e||typeof e!="object"||e.type!==null||e.#e.length!==1||this.type===null||this.#e.length!==1)return!1;let t=e.#e[0];return!t||typeof t!="object"||t.type===null?!1:this.#y(t.type)}#T(e){let t=p7.get(this.type),n=e.#e[0],i=t?.get(n.type);if(!i)return!1;this.#e=n.#e;for(let s of this.#e)typeof s=="object"&&(s.#i=this);this.type=i,this.#f=void 0,this.#l=!1}static fromGlob(e,t={}){let n=new qi(null,void 0,t);return qi.#o(e,n,0,t,0),n}toMMPattern(){if(this!==this.#t)return this.#t.toMMPattern();let e=this.toString(),[t,n,i,s]=this.toRegExpSource();if(!(i||this.#r||this.#c.nocase&&!this.#c.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return n;let c=(this.#c.nocase?"i":"")+(s?"u":"");return Object.assign(new RegExp(`^${t}$`,c),{_src:t,_glob:e})}get options(){return this.#c}toRegExpSource(e){let t=e??!!this.#c.dot;if(this.#t===this&&(this.#m(),this.#d()),!d7(this)){let l=this.isStart()&&this.isEnd()&&!this.#e.some(h=>typeof h!="string"),u=this.#e.map(h=>{let[g,m,_,b]=typeof h=="string"?qi.#w(h,this.#r,l):h.toRegExpSource(e);return this.#r=this.#r||_,this.#n=this.#n||b,g}).join(""),f="";if(this.isStart()&&typeof this.#e[0]=="string"&&!(this.#e.length===1&&Ebe.has(this.#e[0]))){let g=wbe,m=t&&g.has(u.charAt(0))||u.startsWith("\\.")&&g.has(u.charAt(2))||u.startsWith("\\.\\.")&&g.has(u.charAt(4)),_=!t&&!e&&g.has(u.charAt(0));f=m?Sbe:_?tE:""}let d="";return this.isEnd()&&this.#t.#u&&this.#i?.type==="!"&&(d="(?:$|\\/)"),[f+u+d,io(u),this.#r=!!this.#r,this.#n]}let n=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#_(t);if(this.isStart()&&this.isEnd()&&!s&&this.type!=="!"){let l=this.toString(),u=this;return u.#e=[l],u.type=null,u.#r=void 0,[l,io(this.toString()),!1,!1]}let o=!n||e||t||!tE?"":this.#_(!0);o===s&&(o=""),o&&(s=`(?:${s})(?:${o})*?`);let c="";if(this.type==="!"&&this.#l)c=(this.isStart()&&!t?tE:"")+m7;else{let l=this.type==="!"?"))"+(this.isStart()&&!t&&!e?tE:"")+h7+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;c=i+s+l}return[c,io(s),this.#r=!!this.#r,this.#n]}#m(){if(d7(this)){let e=0,t=!1;do{t=!0;for(let n=0;n<this.#e.length;n++){let i=this.#e[n];typeof i=="object"&&(i.#m(),this.#E(i)?(t=!1,this.#A(i,n)):this.#g(i)?(t=!1,this.#S(i,n)):this.#v(i)&&(t=!1,this.#T(i)))}}while(!t&&++e<10)}else for(let e of this.#e)typeof e=="object"&&e.#m();this.#f=void 0}#_(e){return this.#e.map(t=>{if(typeof t=="string")throw new Error("string type in extglob ast??");let[n,i,s,o]=t.toRegExpSource(e);return this.#n=this.#n||o,n}).filter(t=>!(this.isStart()&&this.isEnd())||!!t).join("|")}static#w(e,t,n=!1){let i=!1,s="",o=!1,c=!1;for(let l=0;l<e.length;l++){let u=e.charAt(l);if(i){i=!1,s+=(vbe.has(u)?"\\":"")+u;continue}if(u==="*"){if(c)continue;c=!0,s+=n&&/^[*]+$/.test(e)?m7:h7,t=!0;continue}else c=!1;if(u==="\\"){l===e.length-1?s+="\\\\":i=!0;continue}if(u==="["){let[f,d,p,h]=u7(e,l);if(p){s+=f,o=o||d,l+=p-1,t=t||h;continue}}if(u==="?"){s+=TP,t=!0;continue}s+=Tbe(u)}return[s,io(e),!!t,o]}};qi=Mu});var mp,IP=Be(()=>{mp=a((r,{windowsPathsNoEscape:e=!1,magicalBraces:t=!1}={})=>t?e?r.replace(/[?*()[\]{}]/g,"[$&]"):r.replace(/[?*()[\]\\{}]/g,"\\$&"):e?r.replace(/[?*()[\]]/g,"[$&]"):r.replace(/[?*()[\]\\]/g,"\\$&"),"escape")});var bi,Ibe,Rbe,Cbe,Obe,xbe,Pbe,Fbe,Lbe,Dbe,Nbe,kbe,Mbe,$be,jbe,Bbe,Ube,Vbe,Gbe,_7,b7,S7,g7,qbe,Fr,Wbe,Kbe,zbe,Hbe,Ybe,Es,Qbe,w7,Xbe,Jbe,y7,Zbe,ts,al=Be(()=>{a7();c7();AP();IP();eE();AP();IP();eE();bi=a((r,e,t={})=>(_g(e),!t.nocomment&&e.charAt(0)==="#"?!1:new ts(e,t).match(r)),"minimatch"),Ibe=/^\*+([^+@!?*[(]*)$/,Rbe=a(r=>e=>!e.startsWith(".")&&e.endsWith(r),"starDotExtTest"),Cbe=a(r=>e=>e.endsWith(r),"starDotExtTestDot"),Obe=a(r=>(r=r.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(r)),"starDotExtTestNocase"),xbe=a(r=>(r=r.toLowerCase(),e=>e.toLowerCase().endsWith(r)),"starDotExtTestNocaseDot"),Pbe=/^\*+\.\*+$/,Fbe=a(r=>!r.startsWith(".")&&r.includes("."),"starDotStarTest"),Lbe=a(r=>r!=="."&&r!==".."&&r.includes("."),"starDotStarTestDot"),Dbe=/^\.\*+$/,Nbe=a(r=>r!=="."&&r!==".."&&r.startsWith("."),"dotStarTest"),kbe=/^\*+$/,Mbe=a(r=>r.length!==0&&!r.startsWith("."),"starTest"),$be=a(r=>r.length!==0&&r!=="."&&r!=="..","starTestDot"),jbe=/^\?+([^+@!?*[(]*)?$/,Bbe=a(([r,e=""])=>{let t=_7([r]);return e?(e=e.toLowerCase(),n=>t(n)&&n.toLowerCase().endsWith(e)):t},"qmarksTestNocase"),Ube=a(([r,e=""])=>{let t=b7([r]);return e?(e=e.toLowerCase(),n=>t(n)&&n.toLowerCase().endsWith(e)):t},"qmarksTestNocaseDot"),Vbe=a(([r,e=""])=>{let t=b7([r]);return e?n=>t(n)&&n.endsWith(e):t},"qmarksTestDot"),Gbe=a(([r,e=""])=>{let t=_7([r]);return e?n=>t(n)&&n.endsWith(e):t},"qmarksTest"),_7=a(([r])=>{let e=r.length;return t=>t.length===e&&!t.startsWith(".")},"qmarksTestNoExt"),b7=a(([r])=>{let e=r.length;return t=>t.length===e&&t!=="."&&t!==".."},"qmarksTestNoExtDot"),S7=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",g7={win32:{sep:"\\"},posix:{sep:"/"}},qbe=S7==="win32"?g7.win32.sep:g7.posix.sep;bi.sep=qbe;Fr=Symbol("globstar **");bi.GLOBSTAR=Fr;Wbe="[^/]",Kbe=Wbe+"*?",zbe="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",Hbe="(?:(?!(?:\\/|^)\\.).)*?",Ybe=a((r,e={})=>t=>bi(t,r,e),"filter");bi.filter=Ybe;Es=a((r,e={})=>Object.assign({},r,e),"ext"),Qbe=a(r=>{if(!r||typeof r!="object"||!Object.keys(r).length)return bi;let e=bi;return Object.assign(a((n,i,s={})=>e(n,i,Es(r,s)),"m"),{Minimatch:class extends e.Minimatch{static{a(this,"Minimatch")}constructor(i,s={}){super(i,Es(r,s))}static defaults(i){return e.defaults(Es(r,i)).Minimatch}},AST:class extends e.AST{static{a(this,"AST")}constructor(i,s,o={}){super(i,s,Es(r,o))}static fromGlob(i,s={}){return e.AST.fromGlob(i,Es(r,s))}},unescape:a((n,i={})=>e.unescape(n,Es(r,i)),"unescape"),escape:a((n,i={})=>e.escape(n,Es(r,i)),"escape"),filter:a((n,i={})=>e.filter(n,Es(r,i)),"filter"),defaults:a(n=>e.defaults(Es(r,n)),"defaults"),makeRe:a((n,i={})=>e.makeRe(n,Es(r,i)),"makeRe"),braceExpand:a((n,i={})=>e.braceExpand(n,Es(r,i)),"braceExpand"),match:a((n,i,s={})=>e.match(n,i,Es(r,s)),"match"),sep:e.sep,GLOBSTAR:Fr})},"defaults");bi.defaults=Qbe;w7=a((r,e={})=>(_g(r),e.nobrace||!/\{(?:(?!\{).)*\}/.test(r)?[r]:o7(r,{max:e.braceExpandMax})),"braceExpand");bi.braceExpand=w7;Xbe=a((r,e={})=>new ts(r,e).makeRe(),"makeRe");bi.makeRe=Xbe;Jbe=a((r,e,t={})=>{let n=new ts(e,t);return r=r.filter(i=>n.match(i)),n.options.nonull&&!r.length&&r.push(e),r},"match");bi.match=Jbe;y7=/[?*]|[+@!]\(.*?\)|\[|\]/,Zbe=a(r=>r.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),ts=class{static{a(this,"Minimatch")}options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,t={}){_g(e),t=t||{},this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion??200,this.pattern=e,this.platform=t.platform||S7,this.isWindows=this.platform==="win32";let n="allowWindowsEscape";this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t[n]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!t.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!t.nonegate,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=t.windowsNoMagicRoot!==void 0?t.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let t of e)if(typeof t!="string")return!0;return!1}debug(...e){}make(){let e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)==="#"){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],t.debug&&(this.debug=(...s)=>console.error(...s)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(s=>this.slashSplit(s));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let i=this.globParts.map((s,o,c)=>{if(this.isWindows&&this.windowsNoMagicRoot){let l=s[0]===""&&s[1]===""&&(s[2]==="?"||!y7.test(s[2]))&&!y7.test(s[3]),u=/^[a-z]:/i.test(s[0]);if(l)return[...s.slice(0,4),...s.slice(4).map(f=>this.parse(f))];if(u)return[s[0],...s.slice(1).map(f=>this.parse(f))]}return s.map(l=>this.parse(l))});if(this.debug(this.pattern,i),this.set=i.filter(s=>s.indexOf(!1)===-1),this.isWindows)for(let s=0;s<this.set.length;s++){let o=this.set[s];o[0]===""&&o[1]===""&&this.globParts[s][2]==="?"&&typeof o[3]=="string"&&/^[a-z]:$/i.test(o[3])&&(o[2]="?")}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let n of e)for(let i=0;i<n.length;i++)n[i]==="**"&&(n[i]="*");let{optimizationLevel:t=1}=this.options;return t>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):t>=1?e=this.levelOneOptimize(e):e=this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(t=>{let n=-1;for(;(n=t.indexOf("**",n+1))!==-1;){let i=n;for(;t[i+1]==="**";)i++;i!==n&&t.splice(n,i-n)}return t})}levelOneOptimize(e){return e.map(t=>(t=t.reduce((n,i)=>{let s=n[n.length-1];return i==="**"&&s==="**"?n:i===".."&&s&&s!==".."&&s!=="."&&s!=="**"?(n.pop(),n):(n.push(i),n)},[]),t.length===0?[""]:t))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let t=!1;do{if(t=!1,!this.preserveMultipleSlashes){for(let i=1;i<e.length-1;i++){let s=e[i];i===1&&s===""&&e[0]===""||(s==="."||s==="")&&(t=!0,e.splice(i,1),i--)}e[0]==="."&&e.length===2&&(e[1]==="."||e[1]==="")&&(t=!0,e.pop())}let n=0;for(;(n=e.indexOf("..",n+1))!==-1;){let i=e[n-1];i&&i!=="."&&i!==".."&&i!=="**"&&!(this.isWindows&&/^[a-z]:$/i.test(i))&&(t=!0,e.splice(n-1,2),n-=2)}}while(t);return e.length===0?[""]:e}firstPhasePreProcess(e){let t=!1;do{t=!1;for(let n of e){let i=-1;for(;(i=n.indexOf("**",i+1))!==-1;){let o=i;for(;n[o+1]==="**";)o++;o>i&&n.splice(i+1,o-i);let c=n[i+1],l=n[i+2],u=n[i+3];if(c!==".."||!l||l==="."||l===".."||!u||u==="."||u==="..")continue;t=!0,n.splice(i,1);let f=n.slice(0);f[i]="**",e.push(f),i--}if(!this.preserveMultipleSlashes){for(let o=1;o<n.length-1;o++){let c=n[o];o===1&&c===""&&n[0]===""||(c==="."||c==="")&&(t=!0,n.splice(o,1),o--)}n[0]==="."&&n.length===2&&(n[1]==="."||n[1]==="")&&(t=!0,n.pop())}let s=0;for(;(s=n.indexOf("..",s+1))!==-1;){let o=n[s-1];if(o&&o!=="."&&o!==".."&&o!=="**"){t=!0;let l=s===1&&n[s+1]==="**"?["."]:[];n.splice(s-1,2,...l),n.length===0&&n.push(""),s-=2}}}}while(t);return e}secondPhasePreProcess(e){for(let t=0;t<e.length-1;t++)for(let n=t+1;n<e.length;n++){let i=this.partsMatch(e[t],e[n],!this.preserveMultipleSlashes);if(i){e[t]=[],e[n]=i;break}}return e.filter(t=>t.length)}partsMatch(e,t,n=!1){let i=0,s=0,o=[],c="";for(;i<e.length&&s<t.length;)if(e[i]===t[s])o.push(c==="b"?t[s]:e[i]),i++,s++;else if(n&&e[i]==="**"&&t[s]===e[i+1])o.push(e[i]),i++;else if(n&&t[s]==="**"&&e[i]===t[s+1])o.push(t[s]),s++;else if(e[i]==="*"&&t[s]&&(this.options.dot||!t[s].startsWith("."))&&t[s]!=="**"){if(c==="b")return!1;c="a",o.push(e[i]),i++,s++}else if(t[s]==="*"&&e[i]&&(this.options.dot||!e[i].startsWith("."))&&e[i]!=="**"){if(c==="a")return!1;c="b",o.push(t[s]),i++,s++}else return!1;return e.length===t.length&&o}parseNegate(){if(this.nonegate)return;let e=this.pattern,t=!1,n=0;for(let i=0;i<e.length&&e.charAt(i)==="!";i++)t=!t,n++;n&&(this.pattern=e.slice(n)),this.negate=t}matchOne(e,t,n=!1){let i=0,s=0;if(this.isWindows){let c=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),l=!c&&e[0]===""&&e[1]===""&&e[2]==="?"&&/^[a-z]:$/i.test(e[3]),u=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),f=!u&&t[0]===""&&t[1]===""&&t[2]==="?"&&typeof t[3]=="string"&&/^[a-z]:$/i.test(t[3]),d=l?3:c?0:void 0,p=f?3:u?0:void 0;if(typeof d=="number"&&typeof p=="number"){let[h,g]=[e[d],t[p]];h.toLowerCase()===g.toLowerCase()&&(t[p]=h,s=p,i=d)}}let{optimizationLevel:o=1}=this.options;return o>=2&&(e=this.levelTwoFileOptimize(e)),t.includes(Fr)?this.#t(e,t,n,i,s):this.#n(e,t,n,i,s)}#t(e,t,n,i,s){let o=t.indexOf(Fr,s),c=t.lastIndexOf(Fr),[l,u,f]=n?[t.slice(s,o),t.slice(o+1),[]]:[t.slice(s,o),t.slice(o+1,c),t.slice(c+1)];if(l.length){let w=e.slice(i,i+l.length);if(!this.#n(w,l,n,0,0))return!1;i+=l.length,s+=l.length}let d=0;if(f.length){if(f.length+i>e.length)return!1;let w=e.length-f.length;if(this.#n(e,f,n,w,0))d=f.length;else{if(e[e.length-1]!==""||i+f.length===e.length||(w--,!this.#n(e,f,n,w,0)))return!1;d=f.length+1}}if(!u.length){let w=!!d;for(let v=i;v<e.length-d;v++){let E=String(e[v]);if(w=!0,E==="."||E===".."||!this.options.dot&&E.startsWith("."))return!1}return n||w}let p=[[[],0]],h=p[0],g=0,m=[0];for(let w of u)w===Fr?(m.push(g),h=[[],0],p.push(h)):(h[0].push(w),g++);let _=p.length-1,b=e.length-d;for(let w of p)w[1]=b-(m[_--]+w[0].length);return!!this.#r(e,p,i,0,n,0,!!d)}#r(e,t,n,i,s,o,c){let l=t[i];if(!l){for(let d=n;d<e.length;d++){c=!0;let p=e[d];if(p==="."||p===".."||!this.options.dot&&p.startsWith("."))return!1}return c}let[u,f]=l;for(;n<=f;){if(this.#n(e.slice(0,n+u.length),u,s,n,0)&&o<this.maxGlobstarRecursion){let h=this.#r(e,t,n+u.length,i+1,s,o+1,c);if(h!==!1)return h}let p=e[n];if(p==="."||p===".."||!this.options.dot&&p.startsWith("."))return!1;n++}return s||null}#n(e,t,n,i,s){let o,c,l,u;for(o=i,c=s,u=e.length,l=t.length;o<u&&c<l;o++,c++){this.debug("matchOne loop");let f=t[c],d=e[o];if(this.debug(t,f,d),f===!1||f===Fr)return!1;let p;if(typeof f=="string"?(p=d===f,this.debug("string match",f,d,p)):(p=f.test(d),this.debug("pattern match",f,d,p)),!p)return!1}if(o===u&&c===l)return!0;if(o===u)return n;if(c===l)return o===u-1&&e[o]==="";throw new Error("wtf?")}braceExpand(){return w7(this.pattern,this.options)}parse(e){_g(e);let t=this.options;if(e==="**")return Fr;if(e==="")return"";let n,i=null;(n=e.match(kbe))?i=t.dot?$be:Mbe:(n=e.match(Ibe))?i=(t.nocase?t.dot?xbe:Obe:t.dot?Cbe:Rbe)(n[1]):(n=e.match(jbe))?i=(t.nocase?t.dot?Ube:Bbe:t.dot?Vbe:Gbe)(n):(n=e.match(Pbe))?i=t.dot?Lbe:Fbe:(n=e.match(Dbe))&&(i=Nbe);let s=Mu.fromGlob(e,this.options).toMMPattern();return i&&typeof s=="object"&&Reflect.defineProperty(s,"test",{value:i}),s}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let t=this.options,n=t.noglobstar?Kbe:t.dot?zbe:Hbe,i=new Set(t.nocase?["i"]:[]),s=e.map(l=>{let u=l.map(d=>{if(d instanceof RegExp)for(let p of d.flags.split(""))i.add(p);return typeof d=="string"?Zbe(d):d===Fr?Fr:d._src});u.forEach((d,p)=>{let h=u[p+1],g=u[p-1];d!==Fr||g===Fr||(g===void 0?h!==void 0&&h!==Fr?u[p+1]="(?:\\/|"+n+"\\/)?"+h:u[p]=n:h===void 0?u[p-1]=g+"(?:\\/|\\/"+n+")?":h!==Fr&&(u[p-1]=g+"(?:\\/|\\/"+n+"\\/)"+h,u[p+1]=Fr))});let f=u.filter(d=>d!==Fr);if(this.partial&&f.length>=1){let d=[];for(let p=1;p<=f.length;p++)d.push(f.slice(0,p).join("/"));return"(?:"+d.join("|")+")"}return f.join("/")}).join("|"),[o,c]=e.length>1?["(?:",")"]:["",""];s="^"+o+s+c+"$",this.partial&&(s="^(?:\\/|"+o+s.slice(1,-1)+c+")$"),this.negate&&(s="^(?!"+s+").+$");try{this.regexp=new RegExp(s,[...i].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split("/"):this.isWindows&&/^\/\/[^/]+/.test(e)?["",...e.split(/\/+/)]:e.split(/\/+/)}match(e,t=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return e==="";if(e==="/"&&t)return!0;let n=this.options;this.isWindows&&(e=e.split("\\").join("/"));let i=this.slashSplit(e);this.debug(this.pattern,"split",i);let s=this.set;this.debug(this.pattern,"set",s);let o=i[i.length-1];if(!o)for(let c=i.length-2;!o&&c>=0;c--)o=i[c];for(let c of s){let l=i;if(n.matchBase&&c.length===1&&(l=[o]),this.matchOne(l,c,t))return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}static defaults(e){return bi.defaults(e).Minimatch}};bi.AST=Mu;bi.Minimatch=ts;bi.escape=mp;bi.unescape=io});var nE,Dn,Sg,eSe,RP,v7,E7,tSe,rSe,cl,T7,rE,nSe,Eg,I7=Be(()=>{nE=require("node:diagnostics_channel"),Dn=(0,nE.channel)("lru-cache:metrics"),Sg=(0,nE.tracingChannel)("lru-cache"),eSe=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,RP=a(()=>Dn.hasSubscribers||Sg.hasSubscribers,"R"),v7=new Set,E7=typeof process=="object"&&process?process:{},tSe=a((r,e,t,n)=>{typeof E7.emitWarning=="function"?E7.emitWarning(r,e,t,n):console.error(`[${t}] ${e}: ${r}`)},"k"),rSe=a(r=>!v7.has(r),"H"),cl=a(r=>!!r&&r===Math.floor(r)&&r>0&&isFinite(r),"T"),T7=a(r=>cl(r)?r<=Math.pow(2,8)?Uint8Array:r<=Math.pow(2,16)?Uint16Array:r<=Math.pow(2,32)?Uint32Array:r<=Number.MAX_SAFE_INTEGER?rE:null:null,"j"),rE=class extends Array{static{a(this,"O")}constructor(r){super(r),this.fill(0)}},nSe=class wg{static{a(this,"d")}heap;length;static#t=!1;static create(e){let t=T7(e);if(!t)return[];wg.#t=!0;let n=new wg(e,t);return wg.#t=!1,n}constructor(e,t){if(!wg.#t)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},Eg=class A7{static{a(this,"d")}#t;#r;#n;#e;#i;#a;#p;#u;get perf(){return this.#u}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;backgroundFetchSize;#c;#f;#l;#d;#o;#g;#E;#b;#S;#A;#y;#v;#T;#m;#_;#w;#R;#s;#O;static unsafeExposeInternals(e){return{starts:e.#T,ttls:e.#m,autopurgeTimers:e.#_,sizes:e.#v,keyMap:e.#l,keyList:e.#d,valList:e.#o,next:e.#g,prev:e.#E,get head(){return e.#b},get tail(){return e.#S},free:e.#A,isBackgroundFetch:a(t=>e.#h(t),"isBackgroundFetch"),backgroundFetch:a((t,n,i,s)=>e.#M(t,n,i,s),"backgroundFetch"),moveToTail:a(t=>e.#H(t),"moveToTail"),indexes:a(t=>e.#P(t),"indexes"),rindexes:a(t=>e.#F(t),"rindexes"),isStale:a(t=>e.#I(t),"isStale")}}get max(){return this.#t}get maxSize(){return this.#r}get calculatedSize(){return this.#f}get size(){return this.#c}get fetchMethod(){return this.#a}get memoMethod(){return this.#p}get dispose(){return this.#n}get onInsert(){return this.#e}get disposeAfter(){return this.#i}constructor(e){let{max:t=0,ttl:n,ttlResolution:i=1,ttlAutopurge:s,updateAgeOnGet:o,updateAgeOnHas:c,allowStale:l,dispose:u,onInsert:f,disposeAfter:d,noDisposeOnSet:p,noUpdateTTL:h,maxSize:g=0,maxEntrySize:m=0,sizeCalculation:_,fetchMethod:b,memoMethod:w,noDeleteOnFetchRejection:v,noDeleteOnStaleGet:E,allowStaleOnFetchRejection:S,allowStaleOnFetchAbort:R,ignoreFetchAbort:C,backgroundFetchSize:P=1,perf:D}=e;if(this.backgroundFetchSize=P,D!==void 0&&typeof D?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(this.#u=D??eSe,t!==0&&!cl(t))throw new TypeError("max option must be a nonnegative integer");let F=t?T7(t):Array;if(!F)throw new Error("invalid max value: "+t);if(this.#t=t,this.#r=g,this.maxEntrySize=m||this.#r,this.sizeCalculation=_,this.sizeCalculation){if(!this.#r&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(w!==void 0&&typeof w!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#p=w,b!==void 0&&typeof b!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#a=b,this.#R=!!b,this.#l=new Map,this.#d=Array.from({length:t}).fill(void 0),this.#o=Array.from({length:t}).fill(void 0),this.#g=new F(t),this.#E=new F(t),this.#b=0,this.#S=0,this.#A=nSe.create(t),this.#c=0,this.#f=0,typeof u=="function"&&(this.#n=u),typeof f=="function"&&(this.#e=f),typeof d=="function"?(this.#i=d,this.#y=[]):(this.#i=void 0,this.#y=void 0),this.#w=!!this.#n,this.#O=!!this.#e,this.#s=!!this.#i,this.noDisposeOnSet=!!p,this.noUpdateTTL=!!h,this.noDeleteOnFetchRejection=!!v,this.allowStaleOnFetchRejection=!!S,this.allowStaleOnFetchAbort=!!R,this.ignoreFetchAbort=!!C,this.maxEntrySize!==0){if(this.#r!==0&&!cl(this.#r))throw new TypeError("maxSize must be a positive integer if specified");if(!cl(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#q()}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!E,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!c,this.ttlResolution=cl(i)||i===0?i:1,this.ttlAutopurge=!!s,this.ttl=n||0,this.ttl){if(!cl(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#x()}if(this.#t===0&&this.ttl===0&&this.#r===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#t&&!this.#r){let $="LRU_CACHE_UNBOUNDED";rSe($)&&(v7.add($),tSe("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",$,A7))}}getRemainingTTL(e){return this.#l.has(e)?1/0:0}#x(){let e=new rE(this.#t),t=new rE(this.#t);this.#m=e,this.#T=t;let n=this.ttlAutopurge?Array.from({length:this.#t}):void 0;this.#_=n,this.#j=(l,u,f=this.#u.now())=>{t[l]=u!==0?f:0,e[l]=u,i(l,u)},this.#C=l=>{t[l]=e[l]!==0?this.#u.now():0,i(l,e[l])};let i=this.ttlAutopurge?(l,u)=>{if(n?.[l]&&(clearTimeout(n[l]),n[l]=void 0),u&&u!==0&&n){let f=setTimeout(()=>{this.#I(l)?(this.#$(this.#d[l],"expire"),n[l]=void 0):i(l,c(l))},u+1);f.unref&&f.unref(),n[l]=f}}:()=>{};this.#L=(l,u)=>{if(e[u]){let f=e[u],d=t[u];if(!f||!d)return;l.ttl=f,l.start=d,l.now=s||o();let p=l.now-d;l.remainingTTL=f-p}};let s=0,o=a(()=>{let l=this.#u.now();if(this.ttlResolution>0){s=l;let u=setTimeout(()=>s=0,this.ttlResolution);u.unref&&u.unref()}return l},"o");this.getRemainingTTL=l=>{let u=this.#l.get(l);return u===void 0?0:c(u)};let c=a(l=>{let u=e[l],f=t[l];if(!u||!f)return 1/0;let d=(s||o())-f;return u-d},"l");this.#I=l=>{let u=t[l],f=e[l];return!!f&&!!u&&(s||o())-u>f}}#C=a(()=>{},"#R");#L=a(()=>{},"#v");#j=a(()=>{},"#H");#I=a(()=>!1,"#p");#q(){let e=new rE(this.#t);this.#f=0,this.#v=e,this.#N=t=>{this.#f-=e[t],e[t]=0},this.#B=(t,n,i,s)=>{if(!cl(i)){if(this.#h(n))return this.backgroundFetchSize;if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(i=s(n,t),!cl(i))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.")}return i},this.#D=(t,n,i)=>{if(e[t]=n,this.#r){let s=this.#r-e[t];for(;this.#f>s;)this.#G(!0)}this.#f+=e[t],i&&(i.entrySize=n,i.totalCalculatedSize=this.#f)}}#N=a(e=>{},"#x");#D=a((e,t,n)=>{},"#j");#B=a((e,t,n,i)=>{if(n||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0},"#N");*#P({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#S;this.#U(t)&&((e||!this.#I(t))&&(yield t),t!==this.#b);)t=this.#E[t]}*#F({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#b;this.#U(t)&&((e||!this.#I(t))&&(yield t),t!==this.#S);)t=this.#g[t]}#U(e){return e!==void 0&&this.#l.get(this.#d[e])===e}*entries(){for(let e of this.#P())this.#o[e]!==void 0&&this.#d[e]!==void 0&&!this.#h(this.#o[e])&&(yield[this.#d[e],this.#o[e]])}*rentries(){for(let e of this.#F())this.#o[e]!==void 0&&this.#d[e]!==void 0&&!this.#h(this.#o[e])&&(yield[this.#d[e],this.#o[e]])}*keys(){for(let e of this.#P()){let t=this.#d[e];t!==void 0&&!this.#h(this.#o[e])&&(yield t)}}*rkeys(){for(let e of this.#F()){let t=this.#d[e];t!==void 0&&!this.#h(this.#o[e])&&(yield t)}}*values(){for(let e of this.#P())this.#o[e]!==void 0&&!this.#h(this.#o[e])&&(yield this.#o[e])}*rvalues(){for(let e of this.#F())this.#o[e]!==void 0&&!this.#h(this.#o[e])&&(yield this.#o[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(let n of this.#P()){let i=this.#o[n],s=this.#h(i)?i.__staleWhileFetching:i;if(s!==void 0&&e(s,this.#d[n],this))return this.#z(this.#d[n],t)}}forEach(e,t=this){for(let n of this.#P()){let i=this.#o[n],s=this.#h(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(t,s,this.#d[n],this)}}rforEach(e,t=this){for(let n of this.#F()){let i=this.#o[n],s=this.#h(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(t,s,this.#d[n],this)}}purgeStale(){let e=!1;for(let t of this.#F({allowStale:!0}))this.#I(t)&&(this.#$(this.#d[t],"expire"),e=!0);return e}info(e){let t=this.#l.get(e);if(t===void 0)return;let n=this.#o[t],i=this.#h(n)?n.__staleWhileFetching:n;if(i===void 0)return;let s={value:i};if(this.#m&&this.#T){let o=this.#m[t],c=this.#T[t];if(o&&c){let l=o-(this.#u.now()-c);s.ttl=l,s.start=Date.now()}}return this.#v&&(s.size=this.#v[t]),s}dump(){let e=[];for(let t of this.#P({allowStale:!0})){let n=this.#d[t],i=this.#o[t],s=this.#h(i)?i.__staleWhileFetching:i;if(s===void 0||n===void 0)continue;let o={value:s};if(this.#m&&this.#T){o.ttl=this.#m[t];let c=this.#u.now()-this.#T[t];o.start=Math.floor(Date.now()-c)}this.#v&&(o.size=this.#v[t]),e.unshift([n,o])}return e}load(e){this.clear();for(let[t,n]of e){if(n.start){let i=Date.now()-n.start;n.start=this.#u.now()-i}this.#k(t,n.value,n)}}set(e,t,n={}){let{status:i=Dn.hasSubscribers?{}:void 0}=n;n.status=i,i&&(i.op="set",i.key=e,t!==void 0&&(i.value=t),i.cache=this);let s=this.#k(e,t,n);return i&&Dn.hasSubscribers&&Dn.publish(i),s}#k(e,t,n,i){let{ttl:s=this.ttl,start:o,noDisposeOnSet:c=this.noDisposeOnSet,sizeCalculation:l=this.sizeCalculation,status:u}=n,f=this.#h(t);if(t===void 0)return u&&(u.set="deleted"),this.delete(e),this;let{noUpdateTTL:d=this.noUpdateTTL}=n;u&&!f&&(u.value=t);let p=this.#B(e,t,n.size||0,l,u);if(this.maxEntrySize&&p>this.maxEntrySize)return this.#$(e,"set"),u&&(u.set="miss",u.maxEntrySizeExceeded=!0),this;let h=this.#c===0?void 0:this.#l.get(e);if(h===void 0)h=this.#c===0?this.#S:this.#A.length!==0?this.#A.pop():this.#c===this.#t?this.#G(!1):this.#c,this.#d[h]=e,this.#o[h]=t,this.#l.set(e,h),this.#g[this.#S]=h,this.#E[h]=this.#S,this.#S=h,this.#c++,this.#D(h,p,u),u&&(u.set="add"),d=!1,this.#O&&!f&&this.#e?.(t,e,"add");else{this.#H(h);let g=this.#o[h];if(t!==g){if(!c)if(this.#h(g)){g!==i&&g.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:m}=g;m!==void 0&&m!==t&&(this.#w&&this.#n?.(m,e,"set"),this.#s&&this.#y?.push([m,e,"set"]))}else this.#w&&this.#n?.(g,e,"set"),this.#s&&this.#y?.push([g,e,"set"]);if(this.#N(h),this.#D(h,p,u),this.#o[h]=t,!f){let m=g&&this.#h(g)?g.__staleWhileFetching:g,_=m===void 0?"add":t!==m?"replace":"update";u&&(u.set=_,m!==void 0&&(u.oldValue=m)),this.#O&&this.onInsert?.(t,e,_)}}else f||(u&&(u.set="update"),this.#O&&this.onInsert?.(t,e,"update"))}if(s!==0&&!this.#m&&this.#x(),this.#m&&(d||this.#j(h,s,o),u&&this.#L(u,h)),!c&&this.#s&&this.#y){let g=this.#y,m;for(;m=g?.shift();)this.#i?.(...m)}return this}pop(){try{for(;this.#c;){let e=this.#o[this.#b];if(this.#G(!0),this.#h(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#s&&this.#y){let e=this.#y,t;for(;t=e?.shift();)this.#i?.(...t)}}}#G(e){let t=this.#b,n=this.#d[t],i=this.#o[t],s=this.#h(i);s&&i.__abortController.abort(new Error("evicted"));let o=s?i.__staleWhileFetching:i;return(this.#w||this.#s)&&o!==void 0&&(this.#w&&this.#n?.(o,n,"evict"),this.#s&&this.#y?.push([o,n,"evict"])),this.#N(t),this.#_?.[t]&&(clearTimeout(this.#_[t]),this.#_[t]=void 0),e&&(this.#d[t]=void 0,this.#o[t]=void 0,this.#A.push(t)),this.#c===1?(this.#b=this.#S=0,this.#A.length=0):this.#b=this.#g[t],this.#l.delete(n),this.#c--,t}has(e,t={}){let{status:n=Dn.hasSubscribers?{}:void 0}=t;t.status=n,n&&(n.op="has",n.key=e,n.cache=this);let i=this.#Y(e,t);return Dn.hasSubscribers&&Dn.publish(n),i}#Y(e,t={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:i}=t,s=this.#l.get(e);if(s!==void 0){let o=this.#o[s];if(this.#h(o)&&o.__staleWhileFetching===void 0)return!1;if(this.#I(s))i&&(i.has="stale",this.#L(i,s));else return n&&this.#C(s),i&&(i.has="hit",this.#L(i,s)),!0}else i&&(i.has="miss");return!1}peek(e,t={}){let{status:n=RP()?{}:void 0}=t;n&&(n.op="peek",n.key=e,n.cache=this),t.status=n;let i=this.#W(e,t);return Dn.hasSubscribers&&Dn.publish(n),i}#W(e,t){let{status:n,allowStale:i=this.allowStale}=t,s=this.#l.get(e);if(s===void 0||!i&&this.#I(s)){n&&(n.peek=s===void 0?"miss":"stale");return}let o=this.#o[s],c=this.#h(o)?o.__staleWhileFetching:o;return n&&(c!==void 0?(n.peek="hit",n.value=c):n.peek="miss"),c}#M(e,t,n,i){let s=t===void 0?void 0:this.#o[t];if(this.#h(s))return s;let o=new AbortController,{signal:c}=n;c?.addEventListener("abort",()=>o.abort(c.reason),{signal:o.signal});let l={signal:o.signal,options:n,context:i},u=a((m,_=!1)=>{let{aborted:b}=o.signal,w=n.ignoreFetchAbort&&m!==void 0,v=n.ignoreFetchAbort||!!(n.allowStaleOnFetchAbort&&m!==void 0);if(n.status&&(b&&!_?(n.status.fetchAborted=!0,n.status.fetchError=o.signal.reason,w&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),b&&!w&&!_)return d(o.signal.reason,v);let E=h,S=this.#o[t];return(S===h||S===void 0&&w&&_)&&(m===void 0?E.__staleWhileFetching!==void 0?this.#o[t]=E.__staleWhileFetching:this.#$(e,"fetch"):(n.status&&(n.status.fetchUpdated=!0),this.#k(e,m,l.options,E))),m},"r"),f=a(m=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=m),d(m,!1)),"c"),d=a((m,_)=>{let{aborted:b}=o.signal,w=b&&n.allowStaleOnFetchAbort,v=w||n.allowStaleOnFetchRejection,E=v||n.noDeleteOnFetchRejection,S=h;if(this.#o[t]===h&&(!E||!_&&S.__staleWhileFetching===void 0?this.#$(e,"fetch"):w||(this.#o[t]=S.__staleWhileFetching)),v)return n.status&&S.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),S.__staleWhileFetching;if(S.__returned===S)throw m},"m"),p=a((m,_)=>{let b=this.#a?.(e,s,l);o.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(m(void 0),n.allowStaleOnFetchAbort&&(m=a(w=>u(w,!0),"f")))}),b&&b instanceof Promise?b.then(w=>m(w===void 0?void 0:w),_):b!==void 0&&m(b)},"_");n.status&&(n.status.fetchDispatched=!0);let h=new Promise(p).then(u,f),g=Object.assign(h,{__abortController:o,__staleWhileFetching:s,__returned:void 0});return t===void 0?(this.#k(e,g,{...l.options,status:void 0}),t=this.#l.get(e)):this.#o[t]=g,g}#h(e){if(!this.#R)return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof AbortController}fetch(e,t={}){let n=Sg.hasSubscribers,{status:i=RP()?{}:void 0}=t;t.status=i,i&&t.context&&(i.context=t.context);let s=this.#K(e,t);return i&&n&&(i.trace=!0,Sg.tracePromise(()=>s,i).catch(()=>{})),s}async#K(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:c=this.noDisposeOnSet,size:l=0,sizeCalculation:u=this.sizeCalculation,noUpdateTTL:f=this.noUpdateTTL,noDeleteOnFetchRejection:d=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:p=this.allowStaleOnFetchRejection,ignoreFetchAbort:h=this.ignoreFetchAbort,allowStaleOnFetchAbort:g=this.allowStaleOnFetchAbort,context:m,forceRefresh:_=!1,status:b,signal:w}=t;if(b&&(b.op="fetch",b.key=e,_&&(b.forceRefresh=!0),b.cache=this),!this.#R)return b&&(b.fetch="get"),this.#z(e,{allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:s,status:b});let v={allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:s,ttl:o,noDisposeOnSet:c,size:l,sizeCalculation:u,noUpdateTTL:f,noDeleteOnFetchRejection:d,allowStaleOnFetchRejection:p,allowStaleOnFetchAbort:g,ignoreFetchAbort:h,status:b,signal:w},E=this.#l.get(e);if(E===void 0){b&&(b.fetch="miss");let S=this.#M(e,E,v,m);return S.__returned=S}else{let S=this.#o[E];if(this.#h(S)){let D=n&&S.__staleWhileFetching!==void 0;return b&&(b.fetch="inflight",D&&(b.returnedStale=!0)),D?S.__staleWhileFetching:S.__returned=S}let R=this.#I(E);if(!_&&!R)return b&&(b.fetch="hit"),this.#H(E),i&&this.#C(E),b&&this.#L(b,E),S;let C=this.#M(e,E,v,m),P=C.__staleWhileFetching!==void 0&&n;return b&&(b.fetch=R?"stale":"refresh",P&&R&&(b.returnedStale=!0)),P?C.__staleWhileFetching:C.__returned=C}}forceFetch(e,t={}){let n=Sg.hasSubscribers,{status:i=RP()?{}:void 0}=t;t.status=i,i&&t.context&&(i.context=t.context);let s=this.#V(e,t);return i&&n&&(i.trace=!0,Sg.tracePromise(()=>s,i).catch(()=>{})),s}async#V(e,t={}){let n=await this.#K(e,t);if(n===void 0)throw new Error("fetch() returned undefined");return n}memo(e,t={}){let{status:n=Dn.hasSubscribers?{}:void 0}=t;t.status=n,n&&(n.op="memo",n.key=e,t.context&&(n.context=t.context),n.cache=this);let i=this.#J(e,t);return n&&(n.value=i),Dn.hasSubscribers&&Dn.publish(n),i}#J(e,t={}){let n=this.#p;if(!n)throw new Error("no memoMethod provided to constructor");let{context:i,status:s,forceRefresh:o,...c}=t;s&&o&&(s.forceRefresh=!0);let l=this.#z(e,c),u=o||l===void 0;if(s&&(s.memo=u?"miss":"hit",u||(s.value=l)),!u)return l;let f=n(e,l,{options:c,context:i});return s&&(s.value=f),this.#k(e,f,c),f}get(e,t={}){let{status:n=Dn.hasSubscribers?{}:void 0}=t;t.status=n,n&&(n.op="get",n.key=e,n.cache=this);let i=this.#z(e,t);return n&&(i!==void 0&&(n.value=i),Dn.hasSubscribers&&Dn.publish(n)),i}#z(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,status:o}=t,c=this.#l.get(e);if(c===void 0){o&&(o.get="miss");return}let l=this.#o[c],u=this.#h(l);return o&&this.#L(o,c),this.#I(c)?u?(o&&(o.get="stale-fetching"),n&&l.__staleWhileFetching!==void 0?(o&&(o.returnedStale=!0),l.__staleWhileFetching):void 0):(s||this.#$(e,"expire"),o&&(o.get="stale"),n?(o&&(o.returnedStale=!0),l):void 0):(o&&(o.get=u?"fetching":"hit"),this.#H(c),i&&this.#C(c),u?l.__staleWhileFetching:l)}#Q(e,t){this.#E[t]=e,this.#g[e]=t}#H(e){e!==this.#S&&(e===this.#b?this.#b=this.#g[e]:this.#Q(this.#E[e],this.#g[e]),this.#Q(this.#S,e),this.#S=e)}delete(e){return this.#$(e,"delete")}#$(e,t){Dn.hasSubscribers&&Dn.publish({op:"delete",delete:t,key:e,cache:this});let n=!1;if(this.#c!==0){let i=this.#l.get(e);if(i!==void 0)if(this.#_?.[i]&&(clearTimeout(this.#_[i]),this.#_[i]=void 0),n=!0,this.#c===1)this.#X(t);else{this.#N(i);let s=this.#o[i];if(this.#h(s)?s.__abortController.abort(new Error("deleted")):(this.#w||this.#s)&&(this.#w&&this.#n?.(s,e,t),this.#s&&this.#y?.push([s,e,t])),this.#l.delete(e),this.#d[i]=void 0,this.#o[i]=void 0,i===this.#S)this.#S=this.#E[i];else if(i===this.#b)this.#b=this.#g[i];else{let o=this.#E[i];this.#g[o]=this.#g[i];let c=this.#g[i];this.#E[c]=this.#E[i]}this.#c--,this.#A.push(i)}}if(this.#s&&this.#y?.length){let i=this.#y,s;for(;s=i?.shift();)this.#i?.(...s)}return n}clear(){return this.#X("delete")}#X(e){for(let t of this.#F({allowStale:!0})){let n=this.#o[t];if(this.#h(n))n.__abortController.abort(new Error("deleted"));else{let i=this.#d[t];this.#w&&this.#n?.(n,i,e),this.#s&&this.#y?.push([n,i,e])}}if(this.#l.clear(),this.#o.fill(void 0),this.#d.fill(void 0),this.#m&&this.#T){this.#m.fill(0),this.#T.fill(0);for(let t of this.#_??[])t!==void 0&&clearTimeout(t);this.#_?.fill(void 0)}if(this.#v&&this.#v.fill(0),this.#b=0,this.#S=0,this.#A.length=0,this.#f=0,this.#c=0,this.#s&&this.#y){let t=this.#y,n;for(;n=t?.shift();)this.#i?.(...n)}}}});var uE,DP,P7,R7,iSe,sSe,oSe,rc,nc,ll,iE,vg,sE,C7,oE,O7,so,gp,un,Tg,yp,fn,Si,dn,CP,aE,Zn,Lr,OP,xP,x7,PP,Ko,FP,cE,Ag,$u,rs,Ig,aSe,cSe,lSe,uSe,lE,LP,fSe,dSe,ul,NP=Be(()=>{uE=require("node:events"),DP=Y(require("node:stream"),1),P7=require("node:string_decoder"),R7=typeof process=="object"&&process?process:{stdout:null,stderr:null},iSe=a(r=>!!r&&typeof r=="object"&&(r instanceof ul||r instanceof DP.default||sSe(r)||oSe(r)),"isStream"),sSe=a(r=>!!r&&typeof r=="object"&&r instanceof uE.EventEmitter&&typeof r.pipe=="function"&&r.pipe!==DP.default.Writable.prototype.pipe,"isReadable"),oSe=a(r=>!!r&&typeof r=="object"&&r instanceof uE.EventEmitter&&typeof r.write=="function"&&typeof r.end=="function","isWritable"),rc=Symbol("EOF"),nc=Symbol("maybeEmitEnd"),ll=Symbol("emittedEnd"),iE=Symbol("emittingEnd"),vg=Symbol("emittedError"),sE=Symbol("closed"),C7=Symbol("read"),oE=Symbol("flush"),O7=Symbol("flushChunk"),so=Symbol("encoding"),gp=Symbol("decoder"),un=Symbol("flowing"),Tg=Symbol("paused"),yp=Symbol("resume"),fn=Symbol("buffer"),Si=Symbol("pipes"),dn=Symbol("bufferLength"),CP=Symbol("bufferPush"),aE=Symbol("bufferShift"),Zn=Symbol("objectMode"),Lr=Symbol("destroyed"),OP=Symbol("error"),xP=Symbol("emitData"),x7=Symbol("emitEnd"),PP=Symbol("emitEnd2"),Ko=Symbol("async"),FP=Symbol("abort"),cE=Symbol("aborted"),Ag=Symbol("signal"),$u=Symbol("dataListeners"),rs=Symbol("discarded"),Ig=a(r=>Promise.resolve().then(r),"defer"),aSe=a(r=>r(),"nodefer"),cSe=a(r=>r==="end"||r==="finish"||r==="prefinish","isEndish"),lSe=a(r=>r instanceof ArrayBuffer||!!r&&typeof r=="object"&&r.constructor&&r.constructor.name==="ArrayBuffer"&&r.byteLength>=0,"isArrayBufferLike"),uSe=a(r=>!Buffer.isBuffer(r)&&ArrayBuffer.isView(r),"isArrayBufferView"),lE=class{static{a(this,"Pipe")}src;dest;opts;ondrain;constructor(e,t,n){this.src=e,this.dest=t,this.opts=n,this.ondrain=()=>e[yp](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},LP=class extends lE{static{a(this,"PipeProxyErrors")}unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,t,n){super(e,t,n),this.proxyErrors=i=>this.dest.emit("error",i),e.on("error",this.proxyErrors)}},fSe=a(r=>!!r.objectMode,"isObjectModeOptions"),dSe=a(r=>!r.objectMode&&!!r.encoding&&r.encoding!=="buffer","isEncodingOptions"),ul=class extends uE.EventEmitter{static{a(this,"Minipass")}[un]=!1;[Tg]=!1;[Si]=[];[fn]=[];[Zn];[so];[Ko];[gp];[rc]=!1;[ll]=!1;[iE]=!1;[sE]=!1;[vg]=null;[dn]=0;[Lr]=!1;[Ag];[cE]=!1;[$u]=0;[rs]=!1;writable=!0;readable=!0;constructor(...e){let t=e[0]||{};if(super(),t.objectMode&&typeof t.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");fSe(t)?(this[Zn]=!0,this[so]=null):dSe(t)?(this[so]=t.encoding,this[Zn]=!1):(this[Zn]=!1,this[so]=null),this[Ko]=!!t.async,this[gp]=this[so]?new P7.StringDecoder(this[so]):null,t&&t.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:a(()=>this[fn],"get")}),t&&t.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:a(()=>this[Si],"get")});let{signal:n}=t;n&&(this[Ag]=n,n.aborted?this[FP]():n.addEventListener("abort",()=>this[FP]()))}get bufferLength(){return this[dn]}get encoding(){return this[so]}set encoding(e){throw new Error("Encoding must be set at instantiation time")}setEncoding(e){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[Zn]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[Ko]}set async(e){this[Ko]=this[Ko]||!!e}[FP](){this[cE]=!0,this.emit("abort",this[Ag]?.reason),this.destroy(this[Ag]?.reason)}get aborted(){return this[cE]}set aborted(e){}write(e,t,n){if(this[cE])return!1;if(this[rc])throw new Error("write after end");if(this[Lr])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof t=="function"&&(n=t,t="utf8"),t||(t="utf8");let i=this[Ko]?Ig:aSe;if(!this[Zn]&&!Buffer.isBuffer(e)){if(uSe(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(lSe(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[Zn]?(this[un]&&this[dn]!==0&&this[oE](!0),this[un]?this.emit("data",e):this[CP](e),this[dn]!==0&&this.emit("readable"),n&&i(n),this[un]):e.length?(typeof e=="string"&&!(t===this[so]&&!this[gp]?.lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[so]&&(e=this[gp].write(e)),this[un]&&this[dn]!==0&&this[oE](!0),this[un]?this.emit("data",e):this[CP](e),this[dn]!==0&&this.emit("readable"),n&&i(n),this[un]):(this[dn]!==0&&this.emit("readable"),n&&i(n),this[un])}read(e){if(this[Lr])return null;if(this[rs]=!1,this[dn]===0||e===0||e&&e>this[dn])return this[nc](),null;this[Zn]&&(e=null),this[fn].length>1&&!this[Zn]&&(this[fn]=[this[so]?this[fn].join(""):Buffer.concat(this[fn],this[dn])]);let t=this[C7](e||null,this[fn][0]);return this[nc](),t}[C7](e,t){if(this[Zn])this[aE]();else{let n=t;e===n.length||e===null?this[aE]():typeof n=="string"?(this[fn][0]=n.slice(e),t=n.slice(0,e),this[dn]-=e):(this[fn][0]=n.subarray(e),t=n.subarray(0,e),this[dn]-=e)}return this.emit("data",t),!this[fn].length&&!this[rc]&&this.emit("drain"),t}end(e,t,n){return typeof e=="function"&&(n=e,e=void 0),typeof t=="function"&&(n=t,t="utf8"),e!==void 0&&this.write(e,t),n&&this.once("end",n),this[rc]=!0,this.writable=!1,(this[un]||!this[Tg])&&this[nc](),this}[yp](){this[Lr]||(!this[$u]&&!this[Si].length&&(this[rs]=!0),this[Tg]=!1,this[un]=!0,this.emit("resume"),this[fn].length?this[oE]():this[rc]?this[nc]():this.emit("drain"))}resume(){return this[yp]()}pause(){this[un]=!1,this[Tg]=!0,this[rs]=!1}get destroyed(){return this[Lr]}get flowing(){return this[un]}get paused(){return this[Tg]}[CP](e){this[Zn]?this[dn]+=1:this[dn]+=e.length,this[fn].push(e)}[aE](){return this[Zn]?this[dn]-=1:this[dn]-=this[fn][0].length,this[fn].shift()}[oE](e=!1){do;while(this[O7](this[aE]())&&this[fn].length);!e&&!this[fn].length&&!this[rc]&&this.emit("drain")}[O7](e){return this.emit("data",e),this[un]}pipe(e,t){if(this[Lr])return e;this[rs]=!1;let n=this[ll];return t=t||{},e===R7.stdout||e===R7.stderr?t.end=!1:t.end=t.end!==!1,t.proxyErrors=!!t.proxyErrors,n?t.end&&e.end():(this[Si].push(t.proxyErrors?new LP(this,e,t):new lE(this,e,t)),this[Ko]?Ig(()=>this[yp]()):this[yp]()),e}unpipe(e){let t=this[Si].find(n=>n.dest===e);t&&(this[Si].length===1?(this[un]&&this[$u]===0&&(this[un]=!1),this[Si]=[]):this[Si].splice(this[Si].indexOf(t),1),t.unpipe())}addListener(e,t){return this.on(e,t)}on(e,t){let n=super.on(e,t);if(e==="data")this[rs]=!1,this[$u]++,!this[Si].length&&!this[un]&&this[yp]();else if(e==="readable"&&this[dn]!==0)super.emit("readable");else if(cSe(e)&&this[ll])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[vg]){let i=t;this[Ko]?Ig(()=>i.call(this,this[vg])):i.call(this,this[vg])}return n}removeListener(e,t){return this.off(e,t)}off(e,t){let n=super.off(e,t);return e==="data"&&(this[$u]=this.listeners("data").length,this[$u]===0&&!this[rs]&&!this[Si].length&&(this[un]=!1)),n}removeAllListeners(e){let t=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[$u]=0,!this[rs]&&!this[Si].length&&(this[un]=!1)),t}get emittedEnd(){return this[ll]}[nc](){!this[iE]&&!this[ll]&&!this[Lr]&&this[fn].length===0&&this[rc]&&(this[iE]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[sE]&&this.emit("close"),this[iE]=!1)}emit(e,...t){let n=t[0];if(e!=="error"&&e!=="close"&&e!==Lr&&this[Lr])return!1;if(e==="data")return!this[Zn]&&!n?!1:this[Ko]?(Ig(()=>this[xP](n)),!0):this[xP](n);if(e==="end")return this[x7]();if(e==="close"){if(this[sE]=!0,!this[ll]&&!this[Lr])return!1;let s=super.emit("close");return this.removeAllListeners("close"),s}else if(e==="error"){this[vg]=n,super.emit(OP,n);let s=!this[Ag]||this.listeners("error").length?super.emit("error",n):!1;return this[nc](),s}else if(e==="resume"){let s=super.emit("resume");return this[nc](),s}else if(e==="finish"||e==="prefinish"){let s=super.emit(e);return this.removeAllListeners(e),s}let i=super.emit(e,...t);return this[nc](),i}[xP](e){for(let n of this[Si])n.dest.write(e)===!1&&this.pause();let t=this[rs]?!1:super.emit("data",e);return this[nc](),t}[x7](){return this[ll]?!1:(this[ll]=!0,this.readable=!1,this[Ko]?(Ig(()=>this[PP]()),!0):this[PP]())}[PP](){if(this[gp]){let t=this[gp].end();if(t){for(let n of this[Si])n.dest.write(t);this[rs]||super.emit("data",t)}}for(let t of this[Si])t.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[Zn]||(e.dataLength=0);let t=this.promise();return this.on("data",n=>{e.push(n),this[Zn]||(e.dataLength+=n.length)}),await t,e}async concat(){if(this[Zn])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[so]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,t)=>{this.on(Lr,()=>t(new Error("stream destroyed"))),this.on("error",n=>t(n)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[rs]=!1;let e=!1,t=a(async()=>(this.pause(),e=!0,{value:void 0,done:!0}),"stop");return{next:a(()=>{if(e)return t();let i=this.read();if(i!==null)return Promise.resolve({done:!1,value:i});if(this[rc])return t();let s,o,c=a(d=>{this.off("data",l),this.off("end",u),this.off(Lr,f),t(),o(d)},"onerr"),l=a(d=>{this.off("error",c),this.off("end",u),this.off(Lr,f),this.pause(),s({value:d,done:!!this[rc]})},"ondata"),u=a(()=>{this.off("error",c),this.off("data",l),this.off(Lr,f),t(),s({done:!0,value:void 0})},"onend"),f=a(()=>c(new Error("stream destroyed")),"ondestroy");return new Promise((d,p)=>{o=p,s=d,this.once(Lr,f),this.once("error",c),this.once("end",u),this.once("data",l)})},"next"),throw:t,return:t,[Symbol.asyncIterator](){return this},[Symbol.asyncDispose]:async()=>{}}}[Symbol.iterator](){this[rs]=!1;let e=!1,t=a(()=>(this.pause(),this.off(OP,t),this.off(Lr,t),this.off("end",t),e=!0,{done:!0,value:void 0}),"stop"),n=a(()=>{if(e)return t();let i=this.read();return i===null?t():{done:!1,value:i}},"next");return this.once("end",t),this.once(OP,t),this.once(Lr,t),{next:n,throw:t,return:t,[Symbol.iterator](){return this},[Symbol.dispose]:()=>{}}}destroy(e){if(this[Lr])return e?this.emit("error",e):this.emit(Lr),this;this[Lr]=!0,this[rs]=!0,this[fn].length=0,this[dn]=0;let t=this;return typeof t.close=="function"&&!this[sE]&&t.close(),e?this.emit("error",e):this.emit(Lr),this}static get isStream(){return iSe}}});var _p,k7,Ho,pSe,fl,hSe,Cg,M7,$7,mSe,gSe,Ts,j7,B7,zo,U7,V7,ju,G7,vs,Rg,kP,F7,Og,oo,fE,pE,L7,ySe,MP,D7,xg,N7,dE,hE,$P,q7,ei,mE,gE,yE,bp,Sp,Pg,bBe,W7,K7=Be(()=>{I7();_p=require("node:path"),k7=require("node:url"),Ho=require("fs"),pSe=Y(require("node:fs"),1),fl=require("node:fs/promises");NP();hSe=Ho.realpathSync.native,Cg={lstatSync:Ho.lstatSync,readdir:Ho.readdir,readdirSync:Ho.readdirSync,readlinkSync:Ho.readlinkSync,realpathSync:hSe,promises:{lstat:fl.lstat,readdir:fl.readdir,readlink:fl.readlink,realpath:fl.realpath}},M7=a(r=>!r||r===Cg||r===pSe?Cg:{...Cg,...r,promises:{...Cg.promises,...r.promises||{}}},"fsFromOption"),$7=/^\\\\\?\\([a-z]:)\\?$/i,mSe=a(r=>r.replace(/\//g,"\\").replace($7,"$1\\"),"uncToDrive"),gSe=/[\\\/]/,Ts=0,j7=1,B7=2,zo=4,U7=6,V7=8,ju=10,G7=12,vs=15,Rg=~vs,kP=16,F7=32,Og=64,oo=128,fE=256,pE=512,L7=Og|oo|pE,ySe=1023,MP=a(r=>r.isFile()?V7:r.isDirectory()?zo:r.isSymbolicLink()?ju:r.isCharacterDevice()?B7:r.isBlockDevice()?U7:r.isSocket()?G7:r.isFIFO()?j7:Ts,"entToType"),D7=new Eg({max:2**12}),xg=a(r=>{let e=D7.get(r);if(e)return e;let t=r.normalize("NFKD");return D7.set(r,t),t},"normalize"),N7=new Eg({max:2**12}),dE=a(r=>{let e=N7.get(r);if(e)return e;let t=xg(r.toLowerCase());return N7.set(r,t),t},"normalizeNocase"),hE=class extends Eg{static{a(this,"ResolveCache")}constructor(){super({max:256})}},$P=class extends Eg{static{a(this,"ChildrenCache")}constructor(e=16*1024){super({maxSize:e,sizeCalculation:a(t=>t.length+1,"sizeCalculation")})}},q7=Symbol("PathScurry setAsCwd"),ei=class{static{a(this,"PathBase")}name;root;roots;parent;nocase;isCWD=!1;#t;#r;get dev(){return this.#r}#n;get mode(){return this.#n}#e;get nlink(){return this.#e}#i;get uid(){return this.#i}#a;get gid(){return this.#a}#p;get rdev(){return this.#p}#u;get blksize(){return this.#u}#c;get ino(){return this.#c}#f;get size(){return this.#f}#l;get blocks(){return this.#l}#d;get atimeMs(){return this.#d}#o;get mtimeMs(){return this.#o}#g;get ctimeMs(){return this.#g}#E;get birthtimeMs(){return this.#E}#b;get atime(){return this.#b}#S;get mtime(){return this.#S}#A;get ctime(){return this.#A}#y;get birthtime(){return this.#y}#v;#T;#m;#_;#w;#R;#s;#O;#x;#C;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(e,t=Ts,n,i,s,o,c){this.name=e,this.#v=s?dE(e):xg(e),this.#s=t&ySe,this.nocase=s,this.roots=i,this.root=n||this,this.#O=o,this.#m=c.fullpath,this.#w=c.relative,this.#R=c.relativePosix,this.parent=c.parent,this.parent?this.#t=this.parent.#t:this.#t=M7(c.fs)}depth(){return this.#T!==void 0?this.#T:this.parent?this.#T=this.parent.depth()+1:this.#T=0}childrenCache(){return this.#O}resolve(e){if(!e)return this;let t=this.getRootString(e),i=e.substring(t.length).split(this.splitSep);return t?this.getRoot(t).#L(i):this.#L(i)}#L(e){let t=this;for(let n of e)t=t.child(n);return t}children(){let e=this.#O.get(this);if(e)return e;let t=Object.assign([],{provisional:0});return this.#O.set(this,t),this.#s&=~kP,t}child(e,t){if(e===""||e===".")return this;if(e==="..")return this.parent||this;let n=this.children(),i=this.nocase?dE(e):xg(e);for(let l of n)if(l.#v===i)return l;let s=this.parent?this.sep:"",o=this.#m?this.#m+s+e:void 0,c=this.newChild(e,Ts,{...t,parent:this,fullpath:o});return this.canReaddir()||(c.#s|=oo),n.push(c),c}relative(){if(this.isCWD)return"";if(this.#w!==void 0)return this.#w;let e=this.name,t=this.parent;if(!t)return this.#w=this.name;let n=t.relative();return n+(!n||!t.parent?"":this.sep)+e}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#R!==void 0)return this.#R;let e=this.name,t=this.parent;if(!t)return this.#R=this.fullpathPosix();let n=t.relativePosix();return n+(!n||!t.parent?"":"/")+e}fullpath(){if(this.#m!==void 0)return this.#m;let e=this.name,t=this.parent;if(!t)return this.#m=this.name;let i=t.fullpath()+(t.parent?this.sep:"")+e;return this.#m=i}fullpathPosix(){if(this.#_!==void 0)return this.#_;if(this.sep==="/")return this.#_=this.fullpath();if(!this.parent){let i=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(i)?this.#_=`//?/${i}`:this.#_=i}let e=this.parent,t=e.fullpathPosix(),n=t+(!t||!e.parent?"":"/")+this.name;return this.#_=n}isUnknown(){return(this.#s&vs)===Ts}isType(e){return this[`is${e}`]()}getType(){return this.isUnknown()?"Unknown":this.isDirectory()?"Directory":this.isFile()?"File":this.isSymbolicLink()?"SymbolicLink":this.isFIFO()?"FIFO":this.isCharacterDevice()?"CharacterDevice":this.isBlockDevice()?"BlockDevice":this.isSocket()?"Socket":"Unknown"}isFile(){return(this.#s&vs)===V7}isDirectory(){return(this.#s&vs)===zo}isCharacterDevice(){return(this.#s&vs)===B7}isBlockDevice(){return(this.#s&vs)===U7}isFIFO(){return(this.#s&vs)===j7}isSocket(){return(this.#s&vs)===G7}isSymbolicLink(){return(this.#s&ju)===ju}lstatCached(){return this.#s&F7?this:void 0}readlinkCached(){return this.#x}realpathCached(){return this.#C}readdirCached(){let e=this.children();return e.slice(0,e.provisional)}canReadlink(){if(this.#x)return!0;if(!this.parent)return!1;let e=this.#s&vs;return!(e!==Ts&&e!==ju||this.#s&fE||this.#s&oo)}calledReaddir(){return!!(this.#s&kP)}isENOENT(){return!!(this.#s&oo)}isNamed(e){return this.nocase?this.#v===dE(e):this.#v===xg(e)}async readlink(){let e=this.#x;if(e)return e;if(this.canReadlink()&&this.parent)try{let t=await this.#t.promises.readlink(this.fullpath()),n=(await this.parent.realpath())?.resolve(t);if(n)return this.#x=n}catch(t){this.#F(t.code);return}}readlinkSync(){let e=this.#x;if(e)return e;if(this.canReadlink()&&this.parent)try{let t=this.#t.readlinkSync(this.fullpath()),n=this.parent.realpathSync()?.resolve(t);if(n)return this.#x=n}catch(t){this.#F(t.code);return}}#j(e){this.#s|=kP;for(let t=e.provisional;t<e.length;t++){let n=e[t];n&&n.#I()}}#I(){this.#s&oo||(this.#s=(this.#s|oo)&Rg,this.#q())}#q(){let e=this.children();e.provisional=0;for(let t of e)t.#I()}#N(){this.#s|=pE,this.#D()}#D(){if(this.#s&Og)return;let e=this.#s;(e&vs)===zo&&(e&=Rg),this.#s=e|Og,this.#q()}#B(e=""){e==="ENOTDIR"||e==="EPERM"?this.#D():e==="ENOENT"?this.#I():this.children().provisional=0}#P(e=""){e==="ENOTDIR"?this.parent.#D():e==="ENOENT"&&this.#I()}#F(e=""){let t=this.#s;t|=fE,e==="ENOENT"&&(t|=oo),(e==="EINVAL"||e==="UNKNOWN")&&(t&=Rg),this.#s=t,e==="ENOTDIR"&&this.parent&&this.parent.#D()}#U(e,t){return this.#G(e,t)||this.#k(e,t)}#k(e,t){let n=MP(e),i=this.newChild(e.name,n,{parent:this}),s=i.#s&vs;return s!==zo&&s!==ju&&s!==Ts&&(i.#s|=Og),t.unshift(i),t.provisional++,i}#G(e,t){for(let n=t.provisional;n<t.length;n++){let i=t[n];if((this.nocase?dE(e.name):xg(e.name))===i.#v)return this.#Y(e,i,n,t)}}#Y(e,t,n,i){let s=t.name;return t.#s=t.#s&Rg|MP(e),s!==e.name&&(t.name=e.name),n!==i.provisional&&(n===i.length-1?i.pop():i.splice(n,1),i.unshift(t)),i.provisional++,t}async lstat(){if((this.#s&oo)===0)try{return this.#W(await this.#t.promises.lstat(this.fullpath())),this}catch(e){this.#P(e.code)}}lstatSync(){if((this.#s&oo)===0)try{return this.#W(this.#t.lstatSync(this.fullpath())),this}catch(e){this.#P(e.code)}}#W(e){let{atime:t,atimeMs:n,birthtime:i,birthtimeMs:s,blksize:o,blocks:c,ctime:l,ctimeMs:u,dev:f,gid:d,ino:p,mode:h,mtime:g,mtimeMs:m,nlink:_,rdev:b,size:w,uid:v}=e;this.#b=t,this.#d=n,this.#y=i,this.#E=s,this.#u=o,this.#l=c,this.#A=l,this.#g=u,this.#r=f,this.#a=d,this.#c=p,this.#n=h,this.#S=g,this.#o=m,this.#e=_,this.#p=b,this.#f=w,this.#i=v;let E=MP(e);this.#s=this.#s&Rg|E|F7,E!==Ts&&E!==zo&&E!==ju&&(this.#s|=Og)}#M=[];#h=!1;#K(e){this.#h=!1;let t=this.#M.slice();this.#M.length=0,t.forEach(n=>n(null,e))}readdirCB(e,t=!1){if(!this.canReaddir()){t?e(null,[]):queueMicrotask(()=>e(null,[]));return}let n=this.children();if(this.calledReaddir()){let s=n.slice(0,n.provisional);t?e(null,s):queueMicrotask(()=>e(null,s));return}if(this.#M.push(e),this.#h)return;this.#h=!0;let i=this.fullpath();this.#t.readdir(i,{withFileTypes:!0},(s,o)=>{if(s)this.#B(s.code),n.provisional=0;else{for(let c of o)this.#U(c,n);this.#j(n)}this.#K(n.slice(0,n.provisional))})}#V;async readdir(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let t=this.fullpath();if(this.#V)await this.#V;else{let n=a(()=>{},"resolve");this.#V=new Promise(i=>n=i);try{for(let i of await this.#t.promises.readdir(t,{withFileTypes:!0}))this.#U(i,e);this.#j(e)}catch(i){this.#B(i.code),e.provisional=0}this.#V=void 0,n()}return e.slice(0,e.provisional)}readdirSync(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let t=this.fullpath();try{for(let n of this.#t.readdirSync(t,{withFileTypes:!0}))this.#U(n,e);this.#j(e)}catch(n){this.#B(n.code),e.provisional=0}return e.slice(0,e.provisional)}canReaddir(){if(this.#s&L7)return!1;let e=vs&this.#s;return e===Ts||e===zo||e===ju}shouldWalk(e,t){return(this.#s&zo)===zo&&!(this.#s&L7)&&!e.has(this)&&(!t||t(this))}async realpath(){if(this.#C)return this.#C;if(!((pE|fE|oo)&this.#s))try{let e=await this.#t.promises.realpath(this.fullpath());return this.#C=this.resolve(e)}catch{this.#N()}}realpathSync(){if(this.#C)return this.#C;if(!((pE|fE|oo)&this.#s))try{let e=this.#t.realpathSync(this.fullpath());return this.#C=this.resolve(e)}catch{this.#N()}}[q7](e){if(e===this)return;e.isCWD=!1,this.isCWD=!0;let t=new Set([]),n=[],i=this;for(;i&&i.parent;)t.add(i),i.#w=n.join(this.sep),i.#R=n.join("/"),i=i.parent,n.push("..");for(i=e;i&&i.parent&&!t.has(i);)i.#w=void 0,i.#R=void 0,i=i.parent}},mE=class r extends ei{static{a(this,"PathWin32")}sep="\\";splitSep=gSe;constructor(e,t=Ts,n,i,s,o,c){super(e,t,n,i,s,o,c)}newChild(e,t=Ts,n={}){return new r(e,t,this.root,this.roots,this.nocase,this.childrenCache(),n)}getRootString(e){return _p.win32.parse(e).root}getRoot(e){if(e=mSe(e.toUpperCase()),e===this.root.name)return this.root;for(let[t,n]of Object.entries(this.roots))if(this.sameRoot(e,t))return this.roots[e]=n;return this.roots[e]=new bp(e,this).root}sameRoot(e,t=this.root.name){return e=e.toUpperCase().replace(/\//g,"\\").replace($7,"$1\\"),e===t}},gE=class r extends ei{static{a(this,"PathPosix")}splitSep="/";sep="/";constructor(e,t=Ts,n,i,s,o,c){super(e,t,n,i,s,o,c)}getRootString(e){return e.startsWith("/")?"/":""}getRoot(e){return this.root}newChild(e,t=Ts,n={}){return new r(e,t,this.root,this.roots,this.nocase,this.childrenCache(),n)}},yE=class{static{a(this,"PathScurryBase")}root;rootPath;roots;cwd;#t;#r;#n;nocase;#e;constructor(e=process.cwd(),t,n,{nocase:i,childrenCacheSize:s=16*1024,fs:o=Cg}={}){this.#e=M7(o),(e instanceof URL||e.startsWith("file://"))&&(e=(0,k7.fileURLToPath)(e));let c=t.resolve(e);this.roots=Object.create(null),this.rootPath=this.parseRootPath(c),this.#t=new hE,this.#r=new hE,this.#n=new $P(s);let l=c.substring(this.rootPath.length).split(n);if(l.length===1&&!l[0]&&l.pop(),i===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=i,this.root=this.newRoot(this.#e),this.roots[this.rootPath]=this.root;let u=this.root,f=l.length-1,d=t.sep,p=this.rootPath,h=!1;for(let g of l){let m=f--;u=u.child(g,{relative:new Array(m).fill("..").join(d),relativePosix:new Array(m).fill("..").join("/"),fullpath:p+=(h?"":d)+g}),h=!0}this.cwd=u}depth(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.depth()}childrenCache(){return this.#n}resolve(...e){let t="";for(let s=e.length-1;s>=0;s--){let o=e[s];if(!(!o||o===".")&&(t=t?`${o}/${t}`:o,this.isAbsolute(o)))break}let n=this.#t.get(t);if(n!==void 0)return n;let i=this.cwd.resolve(t).fullpath();return this.#t.set(t,i),i}resolvePosix(...e){let t="";for(let s=e.length-1;s>=0;s--){let o=e[s];if(!(!o||o===".")&&(t=t?`${o}/${t}`:o,this.isAbsolute(o)))break}let n=this.#r.get(t);if(n!==void 0)return n;let i=this.cwd.resolve(t).fullpathPosix();return this.#r.set(t,i),i}relative(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.relative()}relativePosix(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.relativePosix()}basename(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.name}dirname(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),(e.parent||e).fullpath()}async readdir(e=this.cwd,t={withFileTypes:!0}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof ei||(t=e,e=this.cwd);let{withFileTypes:n}=t;if(e.canReaddir()){let i=await e.readdir();return n?i:i.map(s=>s.name)}else return[]}readdirSync(e=this.cwd,t={withFileTypes:!0}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof ei||(t=e,e=this.cwd);let{withFileTypes:n=!0}=t;return e.canReaddir()?n?e.readdirSync():e.readdirSync().map(i=>i.name):[]}async lstat(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.lstat()}lstatSync(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.lstatSync()}async readlink(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof ei||(t=e.withFileTypes,e=this.cwd);let n=await e.readlink();return t?n:n?.fullpath()}readlinkSync(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof ei||(t=e.withFileTypes,e=this.cwd);let n=e.readlinkSync();return t?n:n?.fullpath()}async realpath(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof ei||(t=e.withFileTypes,e=this.cwd);let n=await e.realpath();return t?n:n?.fullpath()}realpathSync(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof ei||(t=e.withFileTypes,e=this.cwd);let n=e.realpathSync();return t?n:n?.fullpath()}async walk(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof ei||(t=e,e=this.cwd);let{withFileTypes:n=!0,follow:i=!1,filter:s,walkFilter:o}=t,c=[];(!s||s(e))&&c.push(n?e:e.fullpath());let l=new Set,u=a((d,p)=>{l.add(d),d.readdirCB((h,g)=>{if(h)return p(h);let m=g.length;if(!m)return p();let _=a(()=>{--m===0&&p()},"next");for(let b of g)(!s||s(b))&&c.push(n?b:b.fullpath()),i&&b.isSymbolicLink()?b.realpath().then(w=>w?.isUnknown()?w.lstat():w).then(w=>w?.shouldWalk(l,o)?u(w,_):_()):b.shouldWalk(l,o)?u(b,_):_()},!0)},"walk"),f=e;return new Promise((d,p)=>{u(f,h=>{if(h)return p(h);d(c)})})}walkSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof ei||(t=e,e=this.cwd);let{withFileTypes:n=!0,follow:i=!1,filter:s,walkFilter:o}=t,c=[];(!s||s(e))&&c.push(n?e:e.fullpath());let l=new Set([e]);for(let u of l){let f=u.readdirSync();for(let d of f){(!s||s(d))&&c.push(n?d:d.fullpath());let p=d;if(d.isSymbolicLink()){if(!(i&&(p=d.realpathSync())))continue;p.isUnknown()&&p.lstatSync()}p.shouldWalk(l,o)&&l.add(p)}}return c}[Symbol.asyncIterator](){return this.iterate()}iterate(e=this.cwd,t={}){return typeof e=="string"?e=this.cwd.resolve(e):e instanceof ei||(t=e,e=this.cwd),this.stream(e,t)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof ei||(t=e,e=this.cwd);let{withFileTypes:n=!0,follow:i=!1,filter:s,walkFilter:o}=t;(!s||s(e))&&(yield n?e:e.fullpath());let c=new Set([e]);for(let l of c){let u=l.readdirSync();for(let f of u){(!s||s(f))&&(yield n?f:f.fullpath());let d=f;if(f.isSymbolicLink()){if(!(i&&(d=f.realpathSync())))continue;d.isUnknown()&&d.lstatSync()}d.shouldWalk(c,o)&&c.add(d)}}}stream(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof ei||(t=e,e=this.cwd);let{withFileTypes:n=!0,follow:i=!1,filter:s,walkFilter:o}=t,c=new ul({objectMode:!0});(!s||s(e))&&c.write(n?e:e.fullpath());let l=new Set,u=[e],f=0,d=a(()=>{let p=!1;for(;!p;){let h=u.shift();if(!h){f===0&&c.end();return}f++,l.add(h);let g=a((_,b,w=!1)=>{if(_)return c.emit("error",_);if(i&&!w){let v=[];for(let E of b)E.isSymbolicLink()&&v.push(E.realpath().then(S=>S?.isUnknown()?S.lstat():S));if(v.length){Promise.all(v).then(()=>g(null,b,!0));return}}for(let v of b)v&&(!s||s(v))&&(c.write(n?v:v.fullpath())||(p=!0));f--;for(let v of b){let E=v.realpathCached()||v;E.shouldWalk(l,o)&&u.push(E)}p&&!c.flowing?c.once("drain",d):m||d()},"onReaddir"),m=!0;h.readdirCB(g,!0),m=!1}},"process");return d(),c}streamSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof ei||(t=e,e=this.cwd);let{withFileTypes:n=!0,follow:i=!1,filter:s,walkFilter:o}=t,c=new ul({objectMode:!0}),l=new Set;(!s||s(e))&&c.write(n?e:e.fullpath());let u=[e],f=0,d=a(()=>{let p=!1;for(;!p;){let h=u.shift();if(!h){f===0&&c.end();return}f++,l.add(h);let g=h.readdirSync();for(let m of g)(!s||s(m))&&(c.write(n?m:m.fullpath())||(p=!0));f--;for(let m of g){let _=m;if(m.isSymbolicLink()){if(!(i&&(_=m.realpathSync())))continue;_.isUnknown()&&_.lstatSync()}_.shouldWalk(l,o)&&u.push(_)}}p&&!c.flowing&&c.once("drain",d)},"process");return d(),c}chdir(e=this.cwd){let t=this.cwd;this.cwd=typeof e=="string"?this.cwd.resolve(e):e,this.cwd[q7](t)}},bp=class extends yE{static{a(this,"PathScurryWin32")}sep="\\";constructor(e=process.cwd(),t={}){let{nocase:n=!0}=t;super(e,_p.win32,"\\",{...t,nocase:n}),this.nocase=n;for(let i=this.cwd;i;i=i.parent)i.nocase=this.nocase}parseRootPath(e){return _p.win32.parse(e).root.toUpperCase()}newRoot(e){return new mE(this.rootPath,zo,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(e)}},Sp=class extends yE{static{a(this,"PathScurryPosix")}sep="/";constructor(e=process.cwd(),t={}){let{nocase:n=!1}=t;super(e,_p.posix,"/",{...t,nocase:n}),this.nocase=n}parseRootPath(e){return"/"}newRoot(e){return new gE(this.rootPath,zo,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")}},Pg=class extends Sp{static{a(this,"PathScurryDarwin")}constructor(e=process.cwd(),t={}){let{nocase:n=!0}=t;super(e,{...t,nocase:n})}},bBe=process.platform==="win32"?mE:gE,W7=process.platform==="win32"?bp:process.platform==="darwin"?Pg:Sp});var _Se,bSe,wp,jP=Be(()=>{al();_Se=a(r=>r.length>=1,"isPatternList"),bSe=a(r=>r.length>=1,"isGlobList"),wp=class r{static{a(this,"Pattern")}#t;#r;#n;length;#e;#i;#a;#p;#u;#c;#f=!0;constructor(e,t,n,i){if(!_Se(e))throw new TypeError("empty pattern list");if(!bSe(t))throw new TypeError("empty glob list");if(t.length!==e.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=e.length,n<0||n>=this.length)throw new TypeError("index out of range");if(this.#t=e,this.#r=t,this.#n=n,this.#e=i,this.#n===0){if(this.isUNC()){let[s,o,c,l,...u]=this.#t,[f,d,p,h,...g]=this.#r;u[0]===""&&(u.shift(),g.shift());let m=[s,o,c,l,""].join("/"),_=[f,d,p,h,""].join("/");this.#t=[m,...u],this.#r=[_,...g],this.length=this.#t.length}else if(this.isDrive()||this.isAbsolute()){let[s,...o]=this.#t,[c,...l]=this.#r;o[0]===""&&(o.shift(),l.shift());let u=s+"/",f=c+"/";this.#t=[u,...o],this.#r=[f,...l],this.length=this.#t.length}}}pattern(){return this.#t[this.#n]}isString(){return typeof this.#t[this.#n]=="string"}isGlobstar(){return this.#t[this.#n]===Fr}isRegExp(){return this.#t[this.#n]instanceof RegExp}globString(){return this.#a=this.#a||(this.#n===0?this.isAbsolute()?this.#r[0]+this.#r.slice(1).join("/"):this.#r.join("/"):this.#r.slice(this.#n).join("/"))}hasMore(){return this.length>this.#n+1}rest(){return this.#i!==void 0?this.#i:this.hasMore()?(this.#i=new r(this.#t,this.#r,this.#n+1,this.#e),this.#i.#c=this.#c,this.#i.#u=this.#u,this.#i.#p=this.#p,this.#i):this.#i=null}isUNC(){let e=this.#t;return this.#u!==void 0?this.#u:this.#u=this.#e==="win32"&&this.#n===0&&e[0]===""&&e[1]===""&&typeof e[2]=="string"&&!!e[2]&&typeof e[3]=="string"&&!!e[3]}isDrive(){let e=this.#t;return this.#p!==void 0?this.#p:this.#p=this.#e==="win32"&&this.#n===0&&this.length>1&&typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0])}isAbsolute(){let e=this.#t;return this.#c!==void 0?this.#c:this.#c=e[0]===""&&e.length>1||this.isDrive()||this.isUNC()}root(){let e=this.#t[0];return typeof e=="string"&&this.isAbsolute()&&this.#n===0?e:""}checkFollowGlobstar(){return!(this.#n===0||!this.isGlobstar()||!this.#f)}markFollowGlobstar(){return this.#n===0||!this.isGlobstar()||!this.#f?!1:(this.#f=!1,!0)}}});var SSe,Ep,BP=Be(()=>{al();jP();SSe=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Ep=class{static{a(this,"Ignore")}relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(e,{nobrace:t,nocase:n,noext:i,noglobstar:s,platform:o=SSe}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=o,this.mmopts={dot:!0,nobrace:t,nocase:n,noext:i,noglobstar:s,optimizationLevel:2,platform:o,nocomment:!0,nonegate:!0};for(let c of e)this.add(c)}add(e){let t=new ts(e,this.mmopts);for(let n=0;n<t.set.length;n++){let i=t.set[n],s=t.globParts[n];if(!i||!s)throw new Error("invalid pattern object");for(;i[0]==="."&&s[0]===".";)i.shift(),s.shift();let o=new wp(i,s,0,this.platform),c=new ts(o.globString(),this.mmopts),l=s[s.length-1]==="**",u=o.isAbsolute();u?this.absolute.push(c):this.relative.push(c),l&&(u?this.absoluteChildren.push(c):this.relativeChildren.push(c))}}ignored(e){let t=e.fullpath(),n=`${t}/`,i=e.relative()||".",s=`${i}/`;for(let o of this.relative)if(o.match(i)||o.match(s))return!0;for(let o of this.absolute)if(o.match(t)||o.match(n))return!0;return!1}childrenIgnored(e){let t=e.fullpath()+"/",n=(e.relative()||".")+"/";for(let i of this.relativeChildren)if(i.match(n))return!0;for(let i of this.absoluteChildren)if(i.match(t))return!0;return!1}}});var UP,VP,GP,Fg,z7=Be(()=>{al();UP=class r{static{a(this,"HasWalkedCache")}store;constructor(e=new Map){this.store=e}copy(){return new r(new Map(this.store))}hasWalked(e,t){return this.store.get(e.fullpath())?.has(t.globString())}storeWalked(e,t){let n=e.fullpath(),i=this.store.get(n);i?i.add(t.globString()):this.store.set(n,new Set([t.globString()]))}},VP=class{static{a(this,"MatchRecord")}store=new Map;add(e,t,n){let i=(t?2:0)|(n?1:0),s=this.store.get(e);this.store.set(e,s===void 0?i:i&s)}entries(){return[...this.store.entries()].map(([e,t])=>[e,!!(t&2),!!(t&1)])}},GP=class{static{a(this,"SubWalks")}store=new Map;add(e,t){if(!e.canReaddir())return;let n=this.store.get(e);n?n.find(i=>i.globString()===t.globString())||n.push(t):this.store.set(e,[t])}get(e){let t=this.store.get(e);if(!t)throw new Error("attempting to walk unknown path");return t}entries(){return this.keys().map(e=>[e,this.store.get(e)])}keys(){return[...this.store.keys()].filter(e=>e.canReaddir())}},Fg=class r{static{a(this,"Processor")}hasWalkedCache;matches=new VP;subwalks=new GP;patterns;follow;dot;opts;constructor(e,t){this.opts=e,this.follow=!!e.follow,this.dot=!!e.dot,this.hasWalkedCache=t?t.copy():new UP}processPatterns(e,t){this.patterns=t;let n=t.map(i=>[e,i]);for(let[i,s]of n){this.hasWalkedCache.storeWalked(i,s);let o=s.root(),c=s.isAbsolute()&&this.opts.absolute!==!1;if(o){i=i.resolve(o==="/"&&this.opts.root!==void 0?this.opts.root:o);let d=s.rest();if(d)s=d;else{this.matches.add(i,!0,!1);continue}}if(i.isENOENT())continue;let l,u,f=!1;for(;typeof(l=s.pattern())=="string"&&(u=s.rest());)i=i.resolve(l),s=u,f=!0;if(l=s.pattern(),u=s.rest(),f){if(this.hasWalkedCache.hasWalked(i,s))continue;this.hasWalkedCache.storeWalked(i,s)}if(typeof l=="string"){let d=l===".."||l===""||l===".";this.matches.add(i.resolve(l),c,d);continue}else if(l===Fr){(!i.isSymbolicLink()||this.follow||s.checkFollowGlobstar())&&this.subwalks.add(i,s);let d=u?.pattern(),p=u?.rest();if(!u||(d===""||d===".")&&!p)this.matches.add(i,c,d===""||d===".");else if(d===".."){let h=i.parent||i;p?this.hasWalkedCache.hasWalked(h,p)||this.subwalks.add(h,p):this.matches.add(h,c,!0)}}else l instanceof RegExp&&this.subwalks.add(i,s)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new r(this.opts,this.hasWalkedCache)}filterEntries(e,t){let n=this.subwalks.get(e),i=this.child();for(let s of t)for(let o of n){let c=o.isAbsolute(),l=o.pattern(),u=o.rest();l===Fr?i.testGlobstar(s,o,u,c):l instanceof RegExp?i.testRegExp(s,l,u,c):i.testString(s,l,u,c)}return i}testGlobstar(e,t,n,i){if((this.dot||!e.name.startsWith("."))&&(t.hasMore()||this.matches.add(e,i,!1),e.canReaddir()&&(this.follow||!e.isSymbolicLink()?this.subwalks.add(e,t):e.isSymbolicLink()&&(n&&t.checkFollowGlobstar()?this.subwalks.add(e,n):t.markFollowGlobstar()&&this.subwalks.add(e,t)))),n){let s=n.pattern();if(typeof s=="string"&&s!==".."&&s!==""&&s!==".")this.testString(e,s,n.rest(),i);else if(s===".."){let o=e.parent||e;this.subwalks.add(o,n)}else s instanceof RegExp&&this.testRegExp(e,s,n.rest(),i)}}testRegExp(e,t,n,i){t.test(e.name)&&(n?this.subwalks.add(e,n):this.matches.add(e,i,!1))}testString(e,t,n,i){e.isNamed(t)&&(n?this.subwalks.add(e,n):this.matches.add(e,i,!1))}}});var wSe,_E,Lg,Dg,H7=Be(()=>{NP();BP();z7();wSe=a((r,e)=>typeof r=="string"?new Ep([r],e):Array.isArray(r)?new Ep(r,e):r,"makeIgnore"),_E=class{static{a(this,"GlobUtil")}path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#t=[];#r;#n;signal;maxDepth;includeChildMatches;constructor(e,t,n){if(this.patterns=e,this.path=t,this.opts=n,this.#n=!n.posix&&n.platform==="win32"?"\\":"/",this.includeChildMatches=n.includeChildMatches!==!1,(n.ignore||!this.includeChildMatches)&&(this.#r=wSe(n.ignore??[],n),!this.includeChildMatches&&typeof this.#r.add!="function")){let i="cannot ignore child matches, ignore lacks add() method.";throw new Error(i)}this.maxDepth=n.maxDepth||1/0,n.signal&&(this.signal=n.signal,this.signal.addEventListener("abort",()=>{this.#t.length=0}))}#e(e){return this.seen.has(e)||!!this.#r?.ignored?.(e)}#i(e){return!!this.#r?.childrenIgnored?.(e)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let e;for(;!this.paused&&(e=this.#t.shift());)e()}onResume(e){this.signal?.aborted||(this.paused?this.#t.push(e):e())}async matchCheck(e,t){if(t&&this.opts.nodir)return;let n;if(this.opts.realpath){if(n=e.realpathCached()||await e.realpath(),!n)return;e=n}let s=e.isUnknown()||this.opts.stat?await e.lstat():e;if(this.opts.follow&&this.opts.nodir&&s?.isSymbolicLink()){let o=await s.realpath();o&&(o.isUnknown()||this.opts.stat)&&await o.lstat()}return this.matchCheckTest(s,t)}matchCheckTest(e,t){return e&&(this.maxDepth===1/0||e.depth()<=this.maxDepth)&&(!t||e.canReaddir())&&(!this.opts.nodir||!e.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!e.isSymbolicLink()||!e.realpathCached()?.isDirectory())&&!this.#e(e)?e:void 0}matchCheckSync(e,t){if(t&&this.opts.nodir)return;let n;if(this.opts.realpath){if(n=e.realpathCached()||e.realpathSync(),!n)return;e=n}let s=e.isUnknown()||this.opts.stat?e.lstatSync():e;if(this.opts.follow&&this.opts.nodir&&s?.isSymbolicLink()){let o=s.realpathSync();o&&(o?.isUnknown()||this.opts.stat)&&o.lstatSync()}return this.matchCheckTest(s,t)}matchFinish(e,t){if(this.#e(e))return;if(!this.includeChildMatches&&this.#r?.add){let s=`${e.relativePosix()}/**`;this.#r.add(s)}let n=this.opts.absolute===void 0?t:this.opts.absolute;this.seen.add(e);let i=this.opts.mark&&e.isDirectory()?this.#n:"";if(this.opts.withFileTypes)this.matchEmit(e);else if(n){let s=this.opts.posix?e.fullpathPosix():e.fullpath();this.matchEmit(s+i)}else{let s=this.opts.posix?e.relativePosix():e.relative(),o=this.opts.dotRelative&&!s.startsWith(".."+this.#n)?"."+this.#n:"";this.matchEmit(s?o+s+i:"."+i)}}async match(e,t,n){let i=await this.matchCheck(e,n);i&&this.matchFinish(i,t)}matchSync(e,t,n){let i=this.matchCheckSync(e,n);i&&this.matchFinish(i,t)}walkCB(e,t,n){this.signal?.aborted&&n(),this.walkCB2(e,t,new Fg(this.opts),n)}walkCB2(e,t,n,i){if(this.#i(e))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2(e,t,n,i));return}n.processPatterns(e,t);let s=1,o=a(()=>{--s===0&&i()},"next");for(let[c,l,u]of n.matches.entries())this.#e(c)||(s++,this.match(c,l,u).then(()=>o()));for(let c of n.subwalkTargets()){if(this.maxDepth!==1/0&&c.depth()>=this.maxDepth)continue;s++;let l=c.readdirCached();c.calledReaddir()?this.walkCB3(c,l,n,o):c.readdirCB((u,f)=>this.walkCB3(c,f,n,o),!0)}o()}walkCB3(e,t,n,i){n=n.filterEntries(e,t);let s=1,o=a(()=>{--s===0&&i()},"next");for(let[c,l,u]of n.matches.entries())this.#e(c)||(s++,this.match(c,l,u).then(()=>o()));for(let[c,l]of n.subwalks.entries())s++,this.walkCB2(c,l,n.child(),o);o()}walkCBSync(e,t,n){this.signal?.aborted&&n(),this.walkCB2Sync(e,t,new Fg(this.opts),n)}walkCB2Sync(e,t,n,i){if(this.#i(e))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2Sync(e,t,n,i));return}n.processPatterns(e,t);let s=1,o=a(()=>{--s===0&&i()},"next");for(let[c,l,u]of n.matches.entries())this.#e(c)||this.matchSync(c,l,u);for(let c of n.subwalkTargets()){if(this.maxDepth!==1/0&&c.depth()>=this.maxDepth)continue;s++;let l=c.readdirSync();this.walkCB3Sync(c,l,n,o)}o()}walkCB3Sync(e,t,n,i){n=n.filterEntries(e,t);let s=1,o=a(()=>{--s===0&&i()},"next");for(let[c,l,u]of n.matches.entries())this.#e(c)||this.matchSync(c,l,u);for(let[c,l]of n.subwalks.entries())s++,this.walkCB2Sync(c,l,n.child(),o);o()}},Lg=class extends _E{static{a(this,"GlobWalker")}matches=new Set;constructor(e,t,n){super(e,t,n)}matchEmit(e){this.matches.add(e)}async walk(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((e,t)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?t(this.signal.reason):e(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}},Dg=class extends _E{static{a(this,"GlobStream")}results;constructor(e,t,n){super(e,t,n),this.results=new ul({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(e){this.results.write(e),this.results.flowing||this.pause()}stream(){let e=this.path;return e.isUnknown()?e.lstat().then(()=>{this.walkCB(e,this.patterns,()=>this.results.end())}):this.walkCB(e,this.patterns,()=>this.results.end()),this.results}streamSync(){return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}}});var Y7,ESe,ao,qP=Be(()=>{al();Y7=require("node:url");K7();jP();H7();ESe=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",ao=class{static{a(this,"Glob")}absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(e,t){if(!t)throw new TypeError("glob options required");if(this.withFileTypes=!!t.withFileTypes,this.signal=t.signal,this.follow=!!t.follow,this.dot=!!t.dot,this.dotRelative=!!t.dotRelative,this.nodir=!!t.nodir,this.mark=!!t.mark,t.cwd?(t.cwd instanceof URL||t.cwd.startsWith("file://"))&&(t.cwd=(0,Y7.fileURLToPath)(t.cwd)):this.cwd="",this.cwd=t.cwd||"",this.root=t.root,this.magicalBraces=!!t.magicalBraces,this.nobrace=!!t.nobrace,this.noext=!!t.noext,this.realpath=!!t.realpath,this.absolute=t.absolute,this.includeChildMatches=t.includeChildMatches!==!1,this.noglobstar=!!t.noglobstar,this.matchBase=!!t.matchBase,this.maxDepth=typeof t.maxDepth=="number"?t.maxDepth:1/0,this.stat=!!t.stat,this.ignore=t.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof e=="string"&&(e=[e]),this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(e=e.map(l=>l.replace(/\\/g,"/"))),this.matchBase){if(t.noglobstar)throw new TypeError("base matching requires globstar");e=e.map(l=>l.includes("/")?l:`./**/${l}`)}if(this.pattern=e,this.platform=t.platform||ESe,this.opts={...t,platform:this.platform},t.scurry){if(this.scurry=t.scurry,t.nocase!==void 0&&t.nocase!==t.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let l=t.platform==="win32"?bp:t.platform==="darwin"?Pg:t.platform?Sp:W7;this.scurry=new l(this.cwd,{nocase:t.nocase,fs:t.fs})}this.nocase=this.scurry.nocase;let n=this.platform==="darwin"||this.platform==="win32",i={...t,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:n,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},s=this.pattern.map(l=>new ts(l,i)),[o,c]=s.reduce((l,u)=>(l[0].push(...u.set),l[1].push(...u.globParts),l),[[],[]]);this.patterns=o.map((l,u)=>{let f=c[u];if(!f)throw new Error("invalid pattern object");return new wp(l,f,0,this.platform)})}async walk(){return[...await new Lg(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()]}walkSync(){return[...new Lg(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()]}stream(){return new Dg(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new Dg(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}}});var WP,KP=Be(()=>{al();WP=a((r,e={})=>{Array.isArray(r)||(r=[r]);for(let t of r)if(new ts(t,e).hasMagic())return!0;return!1},"hasMagic")});function bE(r,e={}){return new ao(r,e).streamSync()}function X7(r,e={}){return new ao(r,e).stream()}function J7(r,e={}){return new ao(r,e).walkSync()}async function Q7(r,e={}){return new ao(r,e).walk()}function SE(r,e={}){return new ao(r,e).iterateSync()}function Z7(r,e={}){return new ao(r,e).iterate()}var vSe,TSe,ASe,ISe,RSe,vp,zP=Be(()=>{al();qP();KP();al();qP();KP();BP();a(bE,"globStreamSync");a(X7,"globStream");a(J7,"globSync");a(Q7,"glob_");a(SE,"globIterateSync");a(Z7,"globIterate");vSe=bE,TSe=Object.assign(X7,{sync:bE}),ASe=SE,ISe=Object.assign(Z7,{sync:SE}),RSe=Object.assign(J7,{stream:bE,iterate:SE}),vp=Object.assign(Q7,{glob:Q7,globSync:J7,sync:RSe,globStream:X7,stream:TSe,globStreamSync:bE,streamSync:vSe,globIterate:Z7,iterate:ISe,globIterateSync:SE,iterateSync:ASe,Glob:ao,hasMagic:WP,escape:mp,unescape:io});vp.glob=vp});async function tV(r,e,t,n={}){let{excludeRelPath:i}=n,s=Bu.default.join(r,"**/*.md"),o=await vp(s,{nodir:!0,ignore:[Bu.default.join(r,".obsidian/**"),Bu.default.join(r,".trash/**"),Bu.default.join(r,"**/.obsidian/**"),Bu.default.join(r,"**/.trash/**")]}),c={filesScanned:0,filesModified:0,replacements:0,modifiedFiles:[]};for(let l of o){let u=Bu.default.relative(r,l);if(i&&u===i)continue;c.filesScanned+=1;let f;try{f=await HP.default.readFile(l,"utf-8")}catch{continue}let{updated:d,replacements:p}=CSe(f,e,t);p>0&&(c.filesModified+=1,c.replacements+=p,c.modifiedFiles.push(u),await HP.default.writeFile(l,d,"utf-8"))}return c}function CSe(r,e,t){let n=r.split(/(^```[\s\S]*?^```)/m),i=0;for(let s=0;s<n.length;s++){if(s%2===1)continue;let o=n[s],c=OSe(o,e,t);i+=c.replacements,n[s]=c.updated}return{updated:n.join(""),replacements:i}}function OSe(r,e,t){let n=r.split(/(`[^`\n]*`)/),i=0;for(let s=0;s<n.length;s++){if(s%2===1)continue;let o=xSe(n[s],e,t);i+=o.replacements,n[s]=o.updated}return{updated:n.join(""),replacements:i}}function xSe(r,e,t){let n=/(?<!!)\[\[([^\[\]\n|#^]+)((?:[#^][^\[\]\n|]*)?)(?:\|[^\[\]\n]*)?\]\]/g,i=0;return{updated:r.replace(n,(o,c,l)=>c.trim()!==e?o:(i+=1,`[[${t}${l}]]`)),replacements:i}}var HP,Bu,rV=Be(()=>{"use strict";HP=Y(Wo()),Bu=Y(require("path"));zP();a(tV,"rewriteInboundWikilinks");a(CSe,"rewriteContent");a(OSe,"rewriteProseSegment");a(xSe,"replaceWikilinks")});function wE(r,e){let t=Lt.default.relative(e,r);return t===""||t!==".."&&!t.startsWith(`..${Lt.default.sep}`)&&!Lt.default.isAbsolute(t)}var ar,Lt,co,PSe,tr,lo=Be(()=>{"use strict";ar=Y(Wo()),Lt=Y(require("path"));gg();co=Y(Pe());rV();PSe=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;a(wE,"isWithinPath");tr=class{constructor(e){this.rootPath=e;this.uuidIndex=null;this.basenameIndex=null;this.aliasIndex=null}static{a(this,"FileSystemVaultAdapter")}async read(e){let t=this.resolvePath(e.path);if(!await ar.default.pathExists(t))throw new Error(`File not found: ${e.path}`);return ar.default.readFile(t,"utf-8")}async create(e,t){let n=this.resolvePath(e);if(await ar.default.pathExists(n))throw new Error(`File already exists: ${e}`);return await ar.default.ensureDir(Lt.default.dirname(n)),await ar.default.writeFile(n,t,"utf-8"),this.createFileObject(e)}async modify(e,t){let n=this.resolvePath(e.path);if(!await ar.default.pathExists(n))throw new Error(`File not found: ${e.path}`);await ar.default.writeFile(n,t,"utf-8")}async delete(e){let t=this.resolvePath(e.path);if(!await ar.default.pathExists(t))throw new Error(`File not found: ${e.path}`);await ar.default.remove(t)}async exists(e){let t=this.resolvePath(e);return ar.default.pathExists(t)}getAbstractFileByPath(e){let t=this.resolvePath(e);try{let n=ar.default.statSync(t);if(n.isFile())return this.createFileObject(e);if(n.isDirectory())return this.createFolderObject(e)}catch{return null}return null}getAllFiles(){let e=[];return this.walkDirectory(this.rootPath,t=>{if(t.endsWith(".md")){let n=Lt.default.relative(this.rootPath,t);e.push(this.createFileObject(n))}}),e}getFrontmatter(e){try{let t=ar.default.readFileSync(this.resolvePath(e.path),"utf-8");return this.extractFrontmatter(t)}catch{return null}}getFrontmatterParseFailure(e){let t;try{t=ar.default.readFileSync(this.resolvePath(e.path),"utf-8")}catch{return null}let n=(0,co.matchFrontmatterBlock)(t)?.body;if(n===void 0)return null;let i=/^[ \t]*(#.*)?\r?$/;if(!n.split(`
440
+ `)}return n}function q_e(r,e){let t=String(r),n=String(e);return t<n?-1:t>n?1:0}function hp(r,e={}){let t={...G_e,...e},n=q0e(r,t.schema,{noRefs:t.noRefs,skipInvalid:t.skipInvalid});if(t.flowLevel>=0&&_8(n,(i,s)=>{if(!(s.depth<t.flowLevel))return(i.kind==="sequence"||i.kind==="mapping")&&(i.style=Gi.FLOW),j8}),t.sortKeys){let i=t.sortKeys===!0?q_e:t.sortKeys;_8(n,s=>{s.kind==="mapping"&&s.items.sort((o,c)=>i(o.key.kind==="scalar"?o.key.value:"",c.key.kind==="scalar"?c.key.value:""))})}return t.transform(n),V_e(n,{...Z2(t,Object.keys(yP)),schema:t.schema})}var Et,Qge,Xge,Jge,Zge,eye,tye,rye,nye,iye,sye,oye,aye,cye,lye,uye,fye,dye,E8,mye,gye,bye,Sye,X2,vye,Tye,v8,Rye,Cye,Pye,Fye,Lye,J2,kye,Mye,Bye,Uye,Vye,qye,Wye,Kye,zye,Hye,Yye,Qw,uP,y4e,ku,mg,Zye,_4e,b4e,e0e,sl,Rr,Ke,Gi,es,r0e,I8,R8,u0e,cp,f0e,dP,It,F8,fp,eP,L8,Ww,y0e,_0e,D8,tP,N8,b0e,S0e,w0e,pP,B0e,Pu,W0e,j8,b8,Z0e,e_e,t_e,mP,U8,Jw,V8,G8,r_e,iP,sP,n_e,i_e,q8,W8,K8,z8,H8,Y8,s_e,o_e,a_e,c_e,l_e,u_e,f_e,d_e,p_e,h_e,m_e,g_e,y_e,__e,gP,P_e,zw,yP,G_e,S4e,w4e,E4e,v4e,T4e,A4e,I4e,R4e,C4e,O4e,x4e,P4e,F4e,L4e,D4e,N4e,gg=Be(()=>{Et=Symbol("NOT_RESOLVED");a(Jn,"defineScalarTag");a(lP,"defineSequenceTag");a(Hw,"defineMappingTag");Qge=Jn("tag:yaml.org,2002:str",{resolve:a(r=>r,"resolve"),identify:a(r=>typeof r=="string","identify")}),Xge=["","~","null","Null","NULL"],Jge=Jn("tag:yaml.org,2002:null",{implicit:!0,implicitFirstChars:["","~","n","N"],resolve:a(r=>Xge.indexOf(r)!==-1?null:Et,"resolve"),identify:a(r=>r===null,"identify"),represent:a(()=>"null","represent")}),Zge=Jn("tag:yaml.org,2002:null",{implicit:!0,implicitFirstChars:["n"],resolve:a((r,e)=>r==="null"||e&&r===""?null:Et,"resolve"),identify:a(r=>r===null,"identify"),represent:a(()=>"null","represent")}),eye=["","~","null","Null","NULL"],tye=Jn("tag:yaml.org,2002:null",{implicit:!0,implicitFirstChars:["","~","n","N"],resolve:a(r=>eye.indexOf(r)!==-1?null:Et,"resolve"),identify:a(r=>r===null,"identify"),represent:a(()=>"null","represent")}),rye=["true","True","TRUE"],nye=["false","False","FALSE"],iye=Jn("tag:yaml.org,2002:bool",{implicit:!0,implicitFirstChars:["t","T","f","F"],resolve:a(r=>rye.indexOf(r)!==-1?!0:nye.indexOf(r)!==-1?!1:Et,"resolve"),identify:a(r=>Object.prototype.toString.call(r)==="[object Boolean]","identify"),represent:a(r=>r?"true":"false","represent")}),sye=["true"],oye=["false"],aye=Jn("tag:yaml.org,2002:bool",{implicit:!0,implicitFirstChars:["t","f"],resolve:a(r=>sye.indexOf(r)!==-1?!0:oye.indexOf(r)!==-1?!1:Et,"resolve"),identify:a(r=>Object.prototype.toString.call(r)==="[object Boolean]","identify"),represent:a(r=>r?"true":"false","represent")}),cye=["true","True","TRUE","y","Y","yes","Yes","YES","on","On","ON"],lye=["false","False","FALSE","n","N","no","No","NO","off","Off","OFF"],uye=Jn("tag:yaml.org,2002:bool",{implicit:!0,implicitFirstChars:["y","Y","n","N","t","T","f","F","o","O"],resolve:a(r=>cye.indexOf(r)!==-1?!0:lye.indexOf(r)!==-1?!1:Et,"resolve"),identify:a(r=>Object.prototype.toString.call(r)==="[object Boolean]","identify"),represent:a(r=>r?"true":"false","represent")}),fye=new RegExp("^(?:0o[0-7]+|0x[0-9a-fA-F]+|[-+]?[0-9]+)$"),dye=new RegExp("^(?:[-+]?0b[0-1]+|[-+]?0o[0-7]+|[-+]?0x[0-9a-fA-F]+|[-+]?[0-9]+)$");a(pye,"parseYamlInteger$2");a(hye,"resolveYamlInteger$2");E8=Jn("tag:yaml.org,2002:int",{implicit:!0,implicitFirstChars:["-","+",..."0123456789"],resolve:hye,identify:a(r=>Number.isInteger(r)&&!Object.is(r,-0)&&r.toString(10).indexOf("e")<0,"identify"),represent:a(r=>r.toString(10),"represent")}),mye=new RegExp("^-?(?:0|[1-9][0-9]*)$"),gye=new RegExp("^(?:[-+]?0b[0-1]+|[-+]?0o[0-7]+|[-+]?0x[0-9a-fA-F]+|[-+]?[0-9]+)$");a(yye,"parseYamlInteger$1");a(_ye,"resolveYamlInteger$1");bye=Jn("tag:yaml.org,2002:int",{implicit:!0,implicitFirstChars:["-",..."0123456789"],resolve:_ye,identify:a(r=>Number.isInteger(r)&&!Object.is(r,-0)&&r.toString(10).indexOf("e")<0,"identify"),represent:a(r=>r.toString(10),"represent")}),Sye=new RegExp("^(?:[-+]?0b[0-1_]+|[-+]?0[0-7_]+|[-+]?0x[0-9a-fA-F_]+|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+|[-+]?(?:0|[1-9][0-9_]*))$");a(wye,"parseYamlInteger");a(Eye,"resolveYamlInteger");X2=Jn("tag:yaml.org,2002:int",{implicit:!0,implicitFirstChars:["-","+",..."0123456789"],resolve:Eye,identify:a(r=>Number.isInteger(r)&&!Object.is(r,-0)&&r.toString(10).indexOf("e")<0,"identify"),represent:a(r=>r.toString(10),"represent")}),vye=new RegExp("^(?:[-+]?[0-9]+(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|[-+]?\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),Tye=new RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");a(Aye,"resolveYamlFloat$2");a(Iye,"representYamlFloat$2");v8=Jn("tag:yaml.org,2002:float",{implicit:!0,implicitFirstChars:["-","+",".",..."0123456789"],resolve:Aye,identify:a(r=>typeof r=="number"&&(!Number.isInteger(r)||Object.is(r,-0)||r.toString(10).indexOf("e")>=0),"identify"),represent:Iye}),Rye=new RegExp("^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$"),Cye=new RegExp("^(?:[-+]?[0-9]+(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|[-+]?\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");a(Oye,"resolveYamlFloat$1");a(xye,"representYamlFloat$1");Pye=Jn("tag:yaml.org,2002:float",{implicit:!0,implicitFirstChars:["-",..."0123456789"],resolve:Oye,identify:a(r=>typeof r=="number"&&(!Number.isInteger(r)||Object.is(r,-0)||r.toString(10).indexOf("e")>=0),"identify"),represent:xye}),Fye=new RegExp("^(?:[-+]?(?:(?:[0-9][0-9_]*)?\\.[0-9_]*)(?:[eE][-+][0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),Lye=new RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");a(Dye,"resolveYamlFloat");a(Nye,"representYamlFloat");J2=Jn("tag:yaml.org,2002:float",{implicit:!0,implicitFirstChars:["-","+",".",..."0123456789"],resolve:Dye,identify:a(r=>typeof r=="number"&&(!Number.isInteger(r)||Object.is(r,-0)||r.toString(10).indexOf("e")>=0),"identify"),represent:Nye}),kye=Jn("tag:yaml.org,2002:merge",{implicit:!0,implicitFirstChars:["<"],resolve:a((r,e)=>r==="<<"||e&&r===""?"<<":Et,"resolve"),identify:a(()=>!1,"identify")}),Mye=/^[A-Za-z0-9+/]*={0,2}$/;a($ye,"resolveYamlBinary");a(jye,"representYamlBinary");Bye=Jn("tag:yaml.org,2002:binary",{resolve:$ye,identify:a(r=>Object.prototype.toString.call(r)==="[object Uint8Array]","identify"),represent:jye}),Uye=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),Vye=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");a(o8,"makeUtcDate");a(Gye,"resolveYamlTimestamp");qye=Jn("tag:yaml.org,2002:timestamp",{implicit:!0,implicitFirstChars:[..."0123456789"],resolve:Gye,identify:a(r=>r instanceof Date,"identify"),represent:a(r=>r.toISOString(),"represent")}),Wye=lP("tag:yaml.org,2002:seq",{create:a(()=>[],"create"),addItem:a((r,e)=>{r.push(e)},"addItem"),identify:Array.isArray});a(Yw,"isPlainObject");a(Z2,"pick");Kye=lP("tag:yaml.org,2002:omap",{create:a(()=>({list:[],seen:new Set}),"create"),addItem:a((r,e)=>{let t;if(e instanceof Map){if(e.size!==1)return"cannot resolve an ordered map item";t=e.keys().next().value}else if(Yw(e)){let n=Object.keys(e);if(n.length!==1)return"cannot resolve an ordered map item";t=n[0]}else return"cannot resolve an ordered map item";return r.seen.has(t)?"duplicate key in ordered map":(r.seen.add(t),r.list.push(e),"")},"addItem"),finalize:a(r=>r.list,"finalize"),identify:a(()=>!1,"identify")}),zye=lP("tag:yaml.org,2002:pairs",{create:a(()=>[],"create"),addItem:a((r,e)=>{if(e instanceof Map)return e.size!==1?"cannot resolve a pairs item":(r.push(e.entries().next().value),"");if(Object.prototype.toString.call(e)!=="[object Object]")return"cannot resolve a pairs item";let t=e,n=Object.keys(t);return n.length!==1?"cannot resolve a pairs item":(r.push([n[0],t[n[0]]]),"")},"addItem"),identify:a(()=>!1,"identify")}),Hye=Hw("tag:yaml.org,2002:map",{create:a(()=>({}),"create"),identify:Yw,represent:a(r=>{let e=new Map;for(let t of Object.keys(r))e.set(t,r[t]);return e},"represent"),addPair:a((r,e,t)=>{if(e!==null&&typeof e=="object")return"object-based map does not support complex keys";let n=String(e);return n==="__proto__"?Object.defineProperty(r,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[n]=t,""},"addPair"),has:a((r,e)=>e!==null&&typeof e=="object"?!1:Object.prototype.hasOwnProperty.call(r,String(e)),"has"),keys:a(r=>Object.keys(r),"keys"),get:a((r,e)=>{let t=String(e);return Object.prototype.hasOwnProperty.call(r,t)?r[t]:null},"get")}),Yye=Hw("tag:yaml.org,2002:set",{create:a(()=>new Set,"create"),identify:a(r=>r instanceof Set,"identify"),represent:a(r=>{let e=new Map;for(let t of r)e.set(t,null);return e},"represent"),addPair:a((r,e,t)=>t!==null?"cannot resolve a set item":(r.add(e),""),"addPair"),has:a((r,e)=>r.has(e),"has"),keys:a(r=>r.keys(),"keys"),get:a(()=>null,"get")});a(Qye,"createTagDefinitionMap");a(Xye,"createTagDefinitionListMap");a(Jye,"compileTags");Qw=class T8{static{a(this,"Schema")}tags;implicitScalarTags;implicitScalarByFirstChar;implicitScalarAnyFirstChar;defaultScalarTag;defaultSequenceTag;defaultMappingTag;exact;prefix;constructor(e){let t=Jye(e),n=[],i=Qye(),s=Xye();for(let f of t){if(f.nodeKind==="scalar"&&f.implicit){if(f.matchByTagPrefix)throw new Error("Implicit scalar tags cannot match by tag prefix");n.push(f)}switch(f.nodeKind){case"scalar":f.matchByTagPrefix?s.scalar.push(f):i.scalar[f.tagName]=f;break;case"sequence":f.matchByTagPrefix?s.sequence.push(f):i.sequence[f.tagName]=f;break;case"mapping":f.matchByTagPrefix?s.mapping.push(f):i.mapping[f.tagName]=f;break}}let o=n.filter(f=>f.implicitFirstChars===null),c=new Set;for(let f of n)if(f.implicitFirstChars!==null)for(let d of f.implicitFirstChars)c.add(d);let l=new Map;for(let f of c)l.set(f,n.filter(d=>d.implicitFirstChars===null||d.implicitFirstChars.indexOf(f)!==-1));let u=i.scalar["tag:yaml.org,2002:str"];if(!u)throw new Error("schema does not define the default scalar tag (tag:yaml.org,2002:str)");this.tags=t,this.implicitScalarTags=n,this.implicitScalarByFirstChar=l,this.implicitScalarAnyFirstChar=o,this.defaultScalarTag=u,this.defaultSequenceTag=i.sequence["tag:yaml.org,2002:seq"],this.defaultMappingTag=i.mapping["tag:yaml.org,2002:map"],this.exact=i,this.prefix=s}lookupScalarTag(e){let t=this.exact.scalar[e];if(t)return t;for(let n of this.prefix.scalar)if(e.startsWith(n.tagName))return n}lookupSequenceTag(e){let t=this.exact.sequence[e];if(t)return t;for(let n of this.prefix.sequence)if(e.startsWith(n.tagName))return n}lookupMappingTag(e){let t=this.exact.mapping[e];if(t)return t;for(let n of this.prefix.mapping)if(e.startsWith(n.tagName))return n}resolveImplicitScalarTag(e){let t=this.implicitScalarByFirstChar.get(e.charAt(0))??this.implicitScalarAnyFirstChar;for(let i of t){let s=i.resolve(e,!1,i.tagName);if(s!==Et)return{value:s,tag:i}}let n=this.defaultScalarTag;return{value:n.resolve(e,!1,n.tagName),tag:n}}withTags(...e){let t=[];for(let n of e)t=t.concat(n);return new T8([...this.tags,...t])}},uP=new Qw([Qge,Wye,Hye]),y4e=new Qw([...uP.tags,Zge,aye,bye,Pye]),ku=new Qw([...uP.tags,Jge,iye,E8,v8]),mg=new Qw([...uP.tags,tye,uye,X2,J2,qye,kye,Bye,Kye,zye,Yye]),Zye=mg.withTags({...X2,resolve:a((r,e,t)=>{let n=X2.resolve(r,e,t);return n===Et?E8.resolve(r,e,t):n},"resolve")},{...J2,resolve:a((r,e,t)=>{let n=J2.resolve(r,e,t);return n===Et?v8.resolve(r,e,t):n},"resolve")}),_4e=Hw("tag:yaml.org,2002:map",{create:a(()=>new Map,"create"),addPair:a((r,e,t)=>(r.set(e,t),""),"addPair"),has:a((r,e)=>r.has(e),"has"),keys:a(r=>r.keys(),"keys"),get:a((r,e)=>r.get(e),"get"),identify:a(r=>r instanceof Map||Yw(r),"identify"),represent:a(r=>{if(r instanceof Map)return r;let e=new Map,t=r;for(let n of Object.keys(t))e.set(n,t[n]);return e},"represent")});a(a8,"normalizeKey");b4e=Hw("tag:yaml.org,2002:map",{create:a(()=>({}),"create"),identify:Yw,represent:a(r=>{let e=new Map;for(let t of Object.keys(r))e.set(t,r[t]);return e},"represent"),addPair:a((r,e,t)=>{let n=a8(e);return n===null?"nested arrays are not supported inside keys":(n==="__proto__"?Object.defineProperty(r,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[n]=t,"")},"addPair"),has:a((r,e)=>{let t=a8(e);return t!==null&&Object.prototype.hasOwnProperty.call(r,t)},"has"),keys:a(r=>Object.keys(r),"keys"),get:a((r,e)=>{let t=String(e);return Object.prototype.hasOwnProperty.call(r,t)?r[t]:null},"get")}),e0e={maxLength:79,indent:1,linesBefore:3,linesAfter:2};a(W2,"getLine");a(K2,"padStart");a(t0e,"makeSnippet");a(c8,"formatError");sl=class A8 extends Error{static{a(this,"YAMLException")}reason;mark;constructor(e,t){super(),this.name="YAMLException",this.reason=e,this.mark=t,this.message=c8(this,!1),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}toString(e){return`${this.name}: ${c8(this,e)}`}static throwAt(e,t,n,i=""){let s=0,o=0;for(let l=0;l<t;l++){let u=e.charCodeAt(l);u===10?(s++,o=l+1):u===13&&(s++,e.charCodeAt(l+1)===10&&l++,o=l+1)}let c={name:i,buffer:e,position:t,line:s,column:t-o};throw c.snippet=t0e(c),new A8(n,c)}},Rr={DOCUMENT:1,SEQUENCE:2,MAPPING:3,SCALAR:4,ALIAS:5,POP:6},Ke={PLAIN:1,SINGLE_QUOTED:2,DOUBLE_QUOTED:3,LITERAL_BLOCK:4,FOLDED_BLOCK:5},Gi={BLOCK:1,FLOW:2},es={CLIP:1,STRIP:2,KEEP:3},r0e=-1;a(l8,"simpleEscapeSequence");I8=new Array(256),R8=new Array(256);for(let r=0;r<256;r++)I8[r]=l8(r)?1:0,R8[r]=l8(r);a(n0e,"charFromCodepoint");a(i0e,"fromHexCode$1");a(s0e,"escapedHexLen$1");a(qw,"skipFoldedBreaks");a(fP,"foldedBreaks");a(o0e,"getPlainValue");a(a0e,"getSingleQuotedValue");a(c0e,"getDoubleQuotedValue");a(u8,"getBlockValue");a(l0e,"getScalarValue");u0e=Object.assign(Object.create(null),{"!":"!","!!":"tag:yaml.org,2002:"});a(z2,"tagPercentEncode");a(C8,"tagNameFull");a(O8,"tagNameShort");cp=-1,f0e="tag:yaml.org,2002:merge",dP={filename:"",schema:ku,json:!1,maxTotalMergeKeys:1e4,maxAliases:-1};a(d0e,"eventPosition$1");a(Ln,"throwError$1");a(x8,"finalizeCollection");a(p0e,"constructScalar");a(f8,"collectionTagName");a(P8,"isMappingTag");a(d8,"chargeMergeWork");a(p8,"mergeKeys");a(h0e,"mergeSource");a(m0e,"addMappingValue");a(H2,"addValue");a(Y2,"storeAnchor");a(g0e,"constructFromEvents");It=-1,F8=Object.prototype.hasOwnProperty,fp=1,eP=2,L8=3,Ww=4,y0e=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,_0e=/[,\[\]{}]/,D8=/^(?:!|!!|![0-9A-Za-z-]+!)$/,tP=String.raw`(?:%[0-9A-Fa-f]{2}|[0-9A-Za-z\-#;/?:@&=+$,_.!~*'()\[\]])`,N8=String.raw`(?:%[0-9A-Fa-f]{2}|[0-9A-Za-z\-#;/?:@&=+$.~*'()_])`,b0e=new RegExp(`^(?:${tP})*$`),S0e=new RegExp(`^(?:${N8})+$`),w0e=new RegExp(`^(?:!(?:${tP})*|${N8}(?:${tP})*)$`),pP={filename:"",maxDepth:100};a(E0e,"addDocumentEvent");a(k8,"addSequenceEvent");a(rP,"addMappingEvent");a(h8,"insertFlowPairMappingEvent");a(pp,"addScalarEvent");a(v0e,"addAliasEvent");a(lp,"addPopEvent");a(_i,"addEmptyScalarEvent");a(m8,"emptyProperties");a(up,"snapshotState");a(Fu,"restoreState");a(Ge,"throwError");a(ln,"isEol");a(Du,"isWhiteSpace");a(no,"isWsOrEol");a(ec,"isWsOrEolOrEnd");a(Nu,"isFlowIndicator");a(T0e,"fromDecimalCode");a(A0e,"fromHexCode");a(I0e,"escapedHexLen");a(R0e,"isSimpleEscape");a(Kw,"consumeLineBreak");a(Xn,"skipSeparationSpace");a(dp,"testDocumentSeparator");a(M8,"skipByteOrderMark");a(hP,"testDocumentBoundary");a(g8,"skipUntilLineEnd");a($8,"checkPrintable");a(C0e,"readTagProperty");a(O0e,"readAnchorProperty");a(x0e,"readAlias");a(nP,"readFlowScalarBreak");a(P0e,"readSingleQuotedScalar");a(F0e,"readDoubleQuotedScalar");a(L0e,"readBlockScalar");a(D0e,"canStartPlainScalar");a(N0e,"readPlainScalar");a(dg,"skipFlowSeparationSpace");a(k0e,"readFlowCollection");a(y8,"readBlockSequence");a(Q2,"readBlockMapping");a(Lu,"parseNode");a(M0e,"readDirective");a($0e,"readDocument");a(j0e,"parseEvents");B0e={...pP,...dP};a(U0e,"loadDocuments");a(ol,"load");Pu=Symbol("INVALID");a(V0e,"buildRepresentTypes");a(G0e,"matchTag");a(hg,"build");a(q0e,"jsToAst");W0e=Symbol("visit:break"),j8=Symbol("visit:skip");a(Gw,"visitNode");a(_8,"visit");a(Xw,"hasBit");b8={applyQuoteFlowKeysOption:K0e,doubleQuoteForInvisibles:z0e,doubleQuoteWhitespaceOnly:H0e,applyForceQuotesOption:Y0e,tryLongOrMultilineAsBlock:Q0e,quoteInvalidPlain:X0e,fallbackToDoubleQuoted:J0e};a(B8,"_preferredQuotedStyle");a(K0e,"applyQuoteFlowKeysOption");a(z0e,"doubleQuoteForInvisibles");a(H0e,"doubleQuoteWhitespaceOnly");a(Y0e,"applyForceQuotesOption");a(Q0e,"tryLongOrMultilineAsBlock");a(X0e,"quoteInvalidPlain");a(J0e,"fallbackToDoubleQuoted");a(pg,"setBit");Z0e="[\\x09\\x0A\\x0D\\x20-\\x7E\\x85\\xA0-\\uD7FF\\uE000-\\uFFFD\\u{10000}-\\u{10FFFF}]",e_e="[\\n\\r]",t_e="\\uFEFF",mP="[ \\t]",U8=`(?:(?!(?:${e_e}|${t_e}))${Z0e})`,Jw=`(?:(?!${mP})${U8})`,V8="[\\x09\\x20-\\uD7FF\\uE000-\\uFFFF\\u{10000}-\\u{10FFFF}]",G8="[-?:,\\[\\]{}#&*!|>'\"%@`]",r_e="[,\\[\\]{}]",iP=Jw,sP=`(?:(?!${r_e})${Jw})`,n_e=`(?:(?:(?!${G8})${Jw})|[?:-](?=${iP}))`,i_e=`(?:(?:(?!${G8})${Jw})|[?:-](?=${sP}))`,q8=`(?:(?:(?![:#])${iP})|:(?=${iP}))#*`,W8=`(?:(?:(?![:#])${sP})|:(?=${sP}))#*`,K8=`(?:${mP}*${q8})*`,z8=`(?:${mP}*${W8})*`,H8=`${n_e}#*${K8}`,Y8=`${i_e}#*${z8}`,s_e=H8,o_e=Y8,a_e=`\\n+${q8}${K8}`,c_e=`\\n+${W8}${z8}`,l_e=`${H8}(?:${a_e})*`,u_e=`${Y8}(?:${c_e})*`,f_e=new RegExp(`^(?:${l_e})$`,"u"),d_e=new RegExp(`^(?:${u_e})$`,"u"),p_e=new RegExp(`^(?:${s_e})$`,"u"),h_e=new RegExp(`^(?:${o_e})$`,"u"),m_e=new RegExp(`^(?:${V8})*$`,"u"),g_e=new RegExp(`^(?:${V8}|\\n)*$`,"u"),y_e=new RegExp(`^(?:${U8}|\\n)*$`,"u"),__e=/^(?:---|\.\.\.)(?=$|[ \t\n\r])/,gP=/^(?:---|\.\.\.)(?=$|[ \t\n\r])/m;a(b_e,"canUsePlain");a(S_e,"canUseSingleQuoted");a(w_e,"canUseBlock");a(E_e,"detectAllowedStyles");a(v_e,"renderScalar");a(T_e,"renderPlain");a(A_e,"renderSingleQuoted");a(I_e,"renderLiteralBlock");a(R_e,"renderFoldedBlock");a(C_e,"renderDoubleQuoted");a(Q8,"encodeFlowBreaks");a(X8,"indentString");a(O_e,"needIndentIndicator");a(J8,"blockHeader");a(Z8,"dropEndingNewline");a(oP,"isMoreIndented");a(S8,"foldLine");a(x_e,"foldBlockScalar");P_e=/["\\\x00-\x1F\x7F-\xA0\u2028\u2029\uD800-\uDFFF\uFEFF\uFFFE\uFFFF]/gu;a(F_e,"escapeCharacter");a(L_e,"escapeString");zw=10,yP={indent:2,seqNoIndent:!1,seqInlineFirst:!0,lineWidth:80,flowBracketPadding:!1,flowSkipCommaSpace:!1,flowSkipColonSpace:!1,quoteFlowKeys:!1,quoteStyle:"single",forceQuotes:!1,scalarStyleRules:Object.keys(b8).map(r=>Reflect.get(b8,r)),tagBeforeAnchor:!1};a(D_e,"nodeTagShort");a(N_e,"createPresenterState");a(aP,"generateNextLine");a(k_e,"scalarLayout");a(M_e,"writeFlowSequence");a(w8,"writeBlockSequence");a($_e,"writeFlowMapping");a(j_e,"writeBlockMapping");a(cP,"cannotBeCompact");a(tc,"writeNode");a(B_e,"rootStartsOwnLine");a(U_e,"writeDocumentDirectives");a(V_e,"present");G_e={...yP,schema:Zye,skipInvalid:!1,noRefs:!1,flowLevel:-1,sortKeys:!1,transform:a(()=>{},"transform")};a(q_e,"defaultCompareFn");a(hp,"dump");S4e=Rr.DOCUMENT,w4e=Rr.SEQUENCE,E4e=Rr.MAPPING,v4e=Rr.SCALAR,T4e=Rr.ALIAS,A4e=Rr.POP,I4e=Ke.PLAIN,R4e=Ke.SINGLE_QUOTED,C4e=Ke.DOUBLE_QUOTED,O4e=Ke.LITERAL_BLOCK,x4e=Ke.FOLDED_BLOCK,P4e=Gi.BLOCK,F4e=Gi.FLOW,L4e=es.CLIP,D4e=es.STRIP,N4e=es.KEEP});var _P,e7,W_e,t7=Be(()=>{_P=a((r,e,t)=>{let n=r instanceof RegExp?e7(r,t):r,i=e instanceof RegExp?e7(e,t):e,s=n!==null&&i!=null&&W_e(n,i,t);return s&&{start:s[0],end:s[1],pre:t.slice(0,s[0]),body:t.slice(s[0]+n.length,s[1]),post:t.slice(s[1]+i.length)}},"balanced"),e7=a((r,e)=>{let t=e.match(r);return t?t[0]:null},"maybeMatch"),W_e=a((r,e,t)=>{let n,i,s,o,c,l=t.indexOf(r),u=t.indexOf(e,l+1),f=l;if(l>=0&&u>0){if(r===e)return[l,u];for(n=[],s=t.length;f>=0&&!c;){if(f===l)n.push(f),l=t.indexOf(r,f+1);else if(n.length===1){let d=n.pop();d!==void 0&&(c=[d,u])}else i=n.pop(),i!==void 0&&i<s&&(s=i,o=u),u=t.indexOf(e,f+1);f=l<u&&l>=0?l:u}n.length&&o!==void 0&&(c=[s,o])}return c},"range")});function bP(r){return isNaN(r)?r.charCodeAt(0):parseInt(r,10)}function obe(r){return r.replace(X_e,r7).replace(J_e,n7).replace(Z_e,EP).replace(ebe,i7).replace(tbe,s7)}function abe(r){return r.replace(K_e,"\\").replace(z_e,"{").replace(H_e,"}").replace(Y_e,",").replace(Q_e,".")}function SP(r,e){for(let t=0;t<e.length;t++)r.push(e[t])}function cbe(r){let e=[],t="";for(;;){let n=_P("{","}",r);if(!n){let l=r.split(",");return l[0]=t+l[0],SP(e,l),e}let{pre:i,body:s,post:o}=n,c=i.split(",");if(c[0]=t+c[0],c[c.length-1]+="{"+s+"}",!o.length)return SP(e,c),e;t=c.pop(),SP(e,c),r=o}}function o7(r,e={}){if(!r)return[];let{max:t=rbe,maxLength:n=nbe,maxDepth:i=ibe,maxRewrites:s=sbe}=e;return r.slice(0,2)==="{}"&&(r="\\{\\}"+r.slice(2)),wP(obe(r),t,n,i,0,s,!0).map(abe)}function lbe(r){return"{"+r+"}"}function ube(r){return/^-?0\d/.test(r)}function fbe(r,e){return r<=e}function dbe(r,e){return r>=e}function yg(r,e,t,n,i,s){let o=[],c=0;for(let l=0;l<r.length;l++)for(let u=0;u<t.length;u++){if(o.length>=n)return o;let f=r[l]+e+t[u];if(!(s&&!f)){if(c+f.length>i)return o;o.push(f),c+=f.length}}return o}function pbe(r,e,t,n){let i=r.split(/\.\./),s=[];if(i[0]===void 0||i[1]===void 0)return s;let o=bP(i[0]),c=bP(i[1]),l=Math.max(i[0].length,i[1].length),u=i.length===3&&i[2]!==void 0?Math.max(Math.abs(bP(i[2])),1):1,f=fbe;c<o&&(u*=-1,f=dbe);let p=i.some(ube),h=0;for(let g=o;f(g,c)&&s.length<t;g+=u){let m;if(e)m=String.fromCharCode(g),m==="\\"&&(m="");else if(m=String(g),p){let _=l-m.length;if(_>0){let b=new Array(_+1).join("0");g<0?m="-"+b+m.slice(1):m=b+m}}if(h+m.length>n)break;s.push(m),h+=m.length}return s}function wP(r,e,t,n,i,s,o){if(i>n)return[r];let c=[""],l=0,u=!1,f=!0;for(;;){let d=_P("{","}",r);if(!d)return yg(c,r,[""],e,t,u);let p=d.pre;if(/\$$/.test(p)){if(c=yg(c,p+"{"+d.body+"}",[""],e,t,u&&!d.post.length),f=!1,!d.post.length)break;r=d.post;continue}let h=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(d.body),g=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(d.body),m=h||g,_=d.body.indexOf(",")>=0;if(!m&&!_){if(l<s&&d.post.match(/,(?!,).*\}/)){l++,r=d.pre+"{"+d.body+EP+d.post,o=!0;continue}return yg(c,p+"{"+d.body+"}"+d.post,[""],e,t,u)}f&&(u=o&&!m,f=!1);let b;if(m)b=pbe(d.body,g,e,t);else{let w=cbe(d.body);if(w.length===1&&w[0]!==void 0&&(w=wP(w[0],e,t,n,i+1,s,!1).map(lbe),w.length===1)){if(c=yg(c,p+w[0],[""],e,t,u&&!d.post.length),!d.post.length)break;r=d.post;continue}let v=u&&!d.post.length&&!p;for(let S=0;v&&S<c.length;S++)c[S]&&(v=!1);b=[];let E=0;e:for(let S=0;S<w.length;S++){let R=wP(w[S],e,t,n,i+1,s,!1);for(let C=0;C<R.length;C++){let P=R[C];if(!(v&&!P)){if(b.length>=e||E+P.length>t)break e;b.push(P),E+=P.length}}}}if(c=yg(c,p,b,e,t,u&&!d.post.length),!d.post.length)break;r=d.post}return c}var r7,n7,EP,i7,s7,K_e,z_e,H_e,Y_e,Q_e,X_e,J_e,Z_e,ebe,tbe,rbe,nbe,ibe,sbe,a7=Be(()=>{t7();r7="\0SLASH"+Math.random()+"\0",n7="\0OPEN"+Math.random()+"\0",EP="\0CLOSE"+Math.random()+"\0",i7="\0COMMA"+Math.random()+"\0",s7="\0PERIOD"+Math.random()+"\0",K_e=new RegExp(r7,"g"),z_e=new RegExp(n7,"g"),H_e=new RegExp(EP,"g"),Y_e=new RegExp(i7,"g"),Q_e=new RegExp(s7,"g"),X_e=/\\\\/g,J_e=/\\{/g,Z_e=/\\}/g,ebe=/\\,/g,tbe=/\\\./g,rbe=1e5,nbe=4e6,ibe=1e3,sbe=1e3;a(bP,"numeric");a(obe,"escapeBraces");a(abe,"unescapeBraces");a(SP,"pushAll");a(cbe,"parseCommaParts");a(o7,"expand");a(lbe,"embrace");a(ube,"isPadded");a(fbe,"lte");a(dbe,"gte");a(yg,"combine");a(pbe,"expandSequence");a(wP,"expand_")});var _g,c7=Be(()=>{_g=a(r=>{if(typeof r!="string")throw new TypeError("invalid pattern");if(r.length>65536)throw new TypeError("pattern is too long")},"assertValidPattern")});var hbe,bg,mbe,l7,u7,f7=Be(()=>{hbe={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},bg=a(r=>r.replace(/[[\]\\-]/g,"\\$&"),"braceEscape"),mbe=a(r=>r.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regexpEscape"),l7=a(r=>r.join(""),"rangesToString"),u7=a((r,e)=>{let t=e;if(r.charAt(t)!=="[")throw new Error("not in a brace expression");let n=[],i=[],s=t+1,o=!1,c=!1,l=!1,u=!1,f=t,d="";e:for(;s<r.length;){let m=r.charAt(s);if((m==="!"||m==="^")&&s===t+1){u=!0,s++;continue}if(m==="]"&&o&&!l){f=s+1;break}if(o=!0,m==="\\"&&!l){l=!0,s++;continue}if(m==="["&&!l){for(let[_,[b,w,v]]of Object.entries(hbe))if(r.startsWith(_,s)){if(d)return["$.",!1,r.length-t,!0];s+=_.length,v?i.push(b):n.push(b),c=c||w;continue e}}if(l=!1,d){m>d?n.push(bg(d)+"-"+bg(m)):m===d&&n.push(bg(m)),d="",s++;continue}if(r.startsWith("-]",s+1)){n.push(bg(m+"-")),s+=2;continue}if(r.startsWith("-",s+1)){d=m,s+=2;continue}n.push(bg(m)),s++}if(f<s)return["",!1,0,!1];if(!n.length&&!i.length)return["$.",!1,r.length-t,!0];if(i.length===0&&n.length===1&&/^\\?.$/.test(n[0])&&!u){let m=n[0].length===2?n[0].slice(-1):n[0];return[mbe(m),!1,f-t,!1]}let p="["+(u?"^":"")+l7(n)+"]",h="["+(u?"":"^")+l7(i)+"]";return[n.length&&i.length?"("+p+"|"+h+")":n.length?p:h,c,f-t,!0]},"parseClass")});var io,eE=Be(()=>{io=a((r,{windowsPathsNoEscape:e=!1,magicalBraces:t=!0}={})=>t?e?r.replace(/\[([^/\\])\]/g,"$1"):r.replace(/((?!\\).|^)\[([^/\\])\]/g,"$1$2").replace(/\\([^/])/g,"$1"):e?r.replace(/\[([^/\\{}])\]/g,"$1"):r.replace(/((?!\\).|^)\[([^/\\{}])\]/g,"$1$2").replace(/\\([^/{}])/g,"$1"),"unescape")});var qi,gbe,vP,d7,ybe,_be,bbe,p7,Sbe,tE,wbe,Ebe,vbe,Tbe,TP,h7,m7,Abe,Mu,AP=Be(()=>{f7();eE();gbe=new Set(["!","?","+","*","@"]),vP=a(r=>gbe.has(r),"isExtglobType"),d7=a(r=>vP(r.type),"isExtglobAST"),ybe=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),_be=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),bbe=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),p7=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),Sbe="(?!(?:^|/)\\.\\.?(?:$|/))",tE="(?!\\.)",wbe=new Set(["[","."]),Ebe=new Set(["..","."]),vbe=new Set("().*{}+?[]^$\\!"),Tbe=a(r=>r.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),TP="[^/]",h7=TP+"*?",m7=TP+"+?",Abe=0,Mu=class{static{a(this,"AST")}type;#t;#r;#n=!1;#e=[];#i;#a;#p;#u=!1;#c;#f;#l=!1;id=++Abe;get depth(){return(this.#i?.depth??-1)+1}[Symbol.for("nodejs.util.inspect.custom")](){return{"@@type":"AST",id:this.id,type:this.type,root:this.#t.id,parent:this.#i?.id,depth:this.depth,partsLength:this.#e.length,parts:this.#e}}constructor(e,t,n={}){this.type=e,e&&(this.#r=!0),this.#i=t,this.#t=this.#i?this.#i.#t:this,this.#c=this.#t===this?n:this.#t.#c,this.#p=this.#t===this?[]:this.#t.#p,e==="!"&&!this.#t.#u&&this.#p.push(this),this.#a=this.#i?this.#i.#e.length:0}get hasMagic(){if(this.#r!==void 0)return this.#r;for(let e of this.#e)if(typeof e!="string"&&(e.type||e.hasMagic))return this.#r=!0;return this.#r}toString(){return this.#f!==void 0?this.#f:this.type?this.#f=this.type+"("+this.#e.map(e=>String(e)).join("|")+")":this.#f=this.#e.map(e=>String(e)).join("")}#d(){if(this!==this.#t)throw new Error("should only call on root");if(this.#u)return this;this.toString(),this.#u=!0;let e;for(;e=this.#p.pop();){if(e.type!=="!")continue;let t=e,n=t.#i;for(;n;){for(let i=t.#a+1;!n.type&&i<n.#e.length;i++)for(let s of e.#e){if(typeof s=="string")throw new Error("string part in extglob AST??");s.copyIn(n.#e[i])}t=n,n=t.#i}}return this}push(...e){for(let t of e)if(t!==""){if(typeof t!="string"&&!(t instanceof qi&&t.#i===this))throw new Error("invalid part: "+t);this.#e.push(t)}}toJSON(){let e=this.type===null?this.#e.slice().map(t=>typeof t=="string"?t:t.toJSON()):[this.type,...this.#e.map(t=>t.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#t||this.#t.#u&&this.#i?.type==="!")&&e.push({}),e}isStart(){if(this.#t===this)return!0;if(!this.#i?.isStart())return!1;if(this.#a===0)return!0;let e=this.#i;for(let t=0;t<this.#a;t++){let n=e.#e[t];if(!(n instanceof qi&&n.type==="!"))return!1}return!0}isEnd(){if(this.#t===this||this.#i?.type==="!")return!0;if(!this.#i?.isEnd())return!1;if(!this.type)return this.#i?.isEnd();let e=this.#i?this.#i.#e.length:0;return this.#a===e-1}copyIn(e){typeof e=="string"?this.push(e):this.push(e.clone(this))}clone(e){let t=new qi(this.type,e);for(let n of this.#e)t.copyIn(n);return t}static#o(e,t,n,i,s){let o=i.maxExtglobRecursion??2,c=!1,l=!1,u=-1,f=!1;if(t.type===null){let m=n,_="";for(;m<e.length;){let b=e.charAt(m++);if(c||b==="\\"){c=!c,_+=b;continue}if(l){m===u+1?(b==="^"||b==="!")&&(f=!0):b==="]"&&!(m===u+2&&f)&&(l=!1),_+=b;continue}else if(b==="["){l=!0,u=m,f=!1,_+=b;continue}if(!i.noext&&vP(b)&&e.charAt(m)==="("&&s<=o){t.push(_),_="";let v=new qi(b,t);m=qi.#o(e,v,m,i,s+1),t.push(v);continue}_+=b}return t.push(_),m}let d=n+1,p=new qi(null,t),h=[],g="";for(;d<e.length;){let m=e.charAt(d++);if(c||m==="\\"){c=!c,g+=m;continue}if(l){d===u+1?(m==="^"||m==="!")&&(f=!0):m==="]"&&!(d===u+2&&f)&&(l=!1),g+=m;continue}else if(m==="["){l=!0,u=d,f=!1,g+=m;continue}if(!i.noext&&vP(m)&&e.charAt(d)==="("&&(s<=o||t&&t.#b(m))){let b=t&&t.#b(m)?0:1;p.push(g),g="";let w=new qi(m,p);p.push(w),d=qi.#o(e,w,d,i,s+b);continue}if(m==="|"){p.push(g),g="",h.push(p),p=new qi(null,t);continue}if(m===")")return g===""&&t.#e.length===0&&(t.#l=!0),p.push(g),g="",t.push(...h,p),d;g+=m}return t.type=null,t.#r=void 0,t.#e=[e.substring(n-1)],d}#g(e){return this.#E(e,_be)}#E(e,t=ybe){if(!e||typeof e!="object"||e.type!==null||e.#e.length!==1||this.type===null)return!1;let n=e.#e[0];return!n||typeof n!="object"||n.type===null?!1:this.#b(n.type,t)}#b(e,t=bbe){return!!t.get(this.type)?.includes(e)}#S(e,t){let n=e.#e[0],i=new qi(null,n,this.options);i.#e.push(""),n.push(i),this.#A(e,t)}#A(e,t){let n=e.#e[0];this.#e.splice(t,1,...n.#e);for(let i of n.#e)typeof i=="object"&&(i.#i=this);this.#f=void 0}#y(e){return!!p7.get(this.type)?.has(e)}#v(e){if(!e||typeof e!="object"||e.type!==null||e.#e.length!==1||this.type===null||this.#e.length!==1)return!1;let t=e.#e[0];return!t||typeof t!="object"||t.type===null?!1:this.#y(t.type)}#T(e){let t=p7.get(this.type),n=e.#e[0],i=t?.get(n.type);if(!i)return!1;this.#e=n.#e;for(let s of this.#e)typeof s=="object"&&(s.#i=this);this.type=i,this.#f=void 0,this.#l=!1}static fromGlob(e,t={}){let n=new qi(null,void 0,t);return qi.#o(e,n,0,t,0),n}toMMPattern(){if(this!==this.#t)return this.#t.toMMPattern();let e=this.toString(),[t,n,i,s]=this.toRegExpSource();if(!(i||this.#r||this.#c.nocase&&!this.#c.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return n;let c=(this.#c.nocase?"i":"")+(s?"u":"");return Object.assign(new RegExp(`^${t}$`,c),{_src:t,_glob:e})}get options(){return this.#c}toRegExpSource(e){let t=e??!!this.#c.dot;if(this.#t===this&&(this.#m(),this.#d()),!d7(this)){let l=this.isStart()&&this.isEnd()&&!this.#e.some(h=>typeof h!="string"),u=this.#e.map(h=>{let[g,m,_,b]=typeof h=="string"?qi.#w(h,this.#r,l):h.toRegExpSource(e);return this.#r=this.#r||_,this.#n=this.#n||b,g}).join(""),f="";if(this.isStart()&&typeof this.#e[0]=="string"&&!(this.#e.length===1&&Ebe.has(this.#e[0]))){let g=wbe,m=t&&g.has(u.charAt(0))||u.startsWith("\\.")&&g.has(u.charAt(2))||u.startsWith("\\.\\.")&&g.has(u.charAt(4)),_=!t&&!e&&g.has(u.charAt(0));f=m?Sbe:_?tE:""}let d="";return this.isEnd()&&this.#t.#u&&this.#i?.type==="!"&&(d="(?:$|\\/)"),[f+u+d,io(u),this.#r=!!this.#r,this.#n]}let n=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#_(t);if(this.isStart()&&this.isEnd()&&!s&&this.type!=="!"){let l=this.toString(),u=this;return u.#e=[l],u.type=null,u.#r=void 0,[l,io(this.toString()),!1,!1]}let o=!n||e||t||!tE?"":this.#_(!0);o===s&&(o=""),o&&(s=`(?:${s})(?:${o})*?`);let c="";if(this.type==="!"&&this.#l)c=(this.isStart()&&!t?tE:"")+m7;else{let l=this.type==="!"?"))"+(this.isStart()&&!t&&!e?tE:"")+h7+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;c=i+s+l}return[c,io(s),this.#r=!!this.#r,this.#n]}#m(){if(d7(this)){let e=0,t=!1;do{t=!0;for(let n=0;n<this.#e.length;n++){let i=this.#e[n];typeof i=="object"&&(i.#m(),this.#E(i)?(t=!1,this.#A(i,n)):this.#g(i)?(t=!1,this.#S(i,n)):this.#v(i)&&(t=!1,this.#T(i)))}}while(!t&&++e<10)}else for(let e of this.#e)typeof e=="object"&&e.#m();this.#f=void 0}#_(e){return this.#e.map(t=>{if(typeof t=="string")throw new Error("string type in extglob ast??");let[n,i,s,o]=t.toRegExpSource(e);return this.#n=this.#n||o,n}).filter(t=>!(this.isStart()&&this.isEnd())||!!t).join("|")}static#w(e,t,n=!1){let i=!1,s="",o=!1,c=!1;for(let l=0;l<e.length;l++){let u=e.charAt(l);if(i){i=!1,s+=(vbe.has(u)?"\\":"")+u;continue}if(u==="*"){if(c)continue;c=!0,s+=n&&/^[*]+$/.test(e)?m7:h7,t=!0;continue}else c=!1;if(u==="\\"){l===e.length-1?s+="\\\\":i=!0;continue}if(u==="["){let[f,d,p,h]=u7(e,l);if(p){s+=f,o=o||d,l+=p-1,t=t||h;continue}}if(u==="?"){s+=TP,t=!0;continue}s+=Tbe(u)}return[s,io(e),!!t,o]}};qi=Mu});var mp,IP=Be(()=>{mp=a((r,{windowsPathsNoEscape:e=!1,magicalBraces:t=!1}={})=>t?e?r.replace(/[?*()[\]{}]/g,"[$&]"):r.replace(/[?*()[\]\\{}]/g,"\\$&"):e?r.replace(/[?*()[\]]/g,"[$&]"):r.replace(/[?*()[\]\\]/g,"\\$&"),"escape")});var bi,Ibe,Rbe,Cbe,Obe,xbe,Pbe,Fbe,Lbe,Dbe,Nbe,kbe,Mbe,$be,jbe,Bbe,Ube,Vbe,Gbe,_7,b7,S7,g7,qbe,Fr,Wbe,Kbe,zbe,Hbe,Ybe,Es,Qbe,w7,Xbe,Jbe,y7,Zbe,ts,al=Be(()=>{a7();c7();AP();IP();eE();AP();IP();eE();bi=a((r,e,t={})=>(_g(e),!t.nocomment&&e.charAt(0)==="#"?!1:new ts(e,t).match(r)),"minimatch"),Ibe=/^\*+([^+@!?*[(]*)$/,Rbe=a(r=>e=>!e.startsWith(".")&&e.endsWith(r),"starDotExtTest"),Cbe=a(r=>e=>e.endsWith(r),"starDotExtTestDot"),Obe=a(r=>(r=r.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(r)),"starDotExtTestNocase"),xbe=a(r=>(r=r.toLowerCase(),e=>e.toLowerCase().endsWith(r)),"starDotExtTestNocaseDot"),Pbe=/^\*+\.\*+$/,Fbe=a(r=>!r.startsWith(".")&&r.includes("."),"starDotStarTest"),Lbe=a(r=>r!=="."&&r!==".."&&r.includes("."),"starDotStarTestDot"),Dbe=/^\.\*+$/,Nbe=a(r=>r!=="."&&r!==".."&&r.startsWith("."),"dotStarTest"),kbe=/^\*+$/,Mbe=a(r=>r.length!==0&&!r.startsWith("."),"starTest"),$be=a(r=>r.length!==0&&r!=="."&&r!=="..","starTestDot"),jbe=/^\?+([^+@!?*[(]*)?$/,Bbe=a(([r,e=""])=>{let t=_7([r]);return e?(e=e.toLowerCase(),n=>t(n)&&n.toLowerCase().endsWith(e)):t},"qmarksTestNocase"),Ube=a(([r,e=""])=>{let t=b7([r]);return e?(e=e.toLowerCase(),n=>t(n)&&n.toLowerCase().endsWith(e)):t},"qmarksTestNocaseDot"),Vbe=a(([r,e=""])=>{let t=b7([r]);return e?n=>t(n)&&n.endsWith(e):t},"qmarksTestDot"),Gbe=a(([r,e=""])=>{let t=_7([r]);return e?n=>t(n)&&n.endsWith(e):t},"qmarksTest"),_7=a(([r])=>{let e=r.length;return t=>t.length===e&&!t.startsWith(".")},"qmarksTestNoExt"),b7=a(([r])=>{let e=r.length;return t=>t.length===e&&t!=="."&&t!==".."},"qmarksTestNoExtDot"),S7=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",g7={win32:{sep:"\\"},posix:{sep:"/"}},qbe=S7==="win32"?g7.win32.sep:g7.posix.sep;bi.sep=qbe;Fr=Symbol("globstar **");bi.GLOBSTAR=Fr;Wbe="[^/]",Kbe=Wbe+"*?",zbe="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",Hbe="(?:(?!(?:\\/|^)\\.).)*?",Ybe=a((r,e={})=>t=>bi(t,r,e),"filter");bi.filter=Ybe;Es=a((r,e={})=>Object.assign({},r,e),"ext"),Qbe=a(r=>{if(!r||typeof r!="object"||!Object.keys(r).length)return bi;let e=bi;return Object.assign(a((n,i,s={})=>e(n,i,Es(r,s)),"m"),{Minimatch:class extends e.Minimatch{static{a(this,"Minimatch")}constructor(i,s={}){super(i,Es(r,s))}static defaults(i){return e.defaults(Es(r,i)).Minimatch}},AST:class extends e.AST{static{a(this,"AST")}constructor(i,s,o={}){super(i,s,Es(r,o))}static fromGlob(i,s={}){return e.AST.fromGlob(i,Es(r,s))}},unescape:a((n,i={})=>e.unescape(n,Es(r,i)),"unescape"),escape:a((n,i={})=>e.escape(n,Es(r,i)),"escape"),filter:a((n,i={})=>e.filter(n,Es(r,i)),"filter"),defaults:a(n=>e.defaults(Es(r,n)),"defaults"),makeRe:a((n,i={})=>e.makeRe(n,Es(r,i)),"makeRe"),braceExpand:a((n,i={})=>e.braceExpand(n,Es(r,i)),"braceExpand"),match:a((n,i,s={})=>e.match(n,i,Es(r,s)),"match"),sep:e.sep,GLOBSTAR:Fr})},"defaults");bi.defaults=Qbe;w7=a((r,e={})=>(_g(r),e.nobrace||!/\{(?:(?!\{).)*\}/.test(r)?[r]:o7(r,{max:e.braceExpandMax})),"braceExpand");bi.braceExpand=w7;Xbe=a((r,e={})=>new ts(r,e).makeRe(),"makeRe");bi.makeRe=Xbe;Jbe=a((r,e,t={})=>{let n=new ts(e,t);return r=r.filter(i=>n.match(i)),n.options.nonull&&!r.length&&r.push(e),r},"match");bi.match=Jbe;y7=/[?*]|[+@!]\(.*?\)|\[|\]/,Zbe=a(r=>r.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),ts=class{static{a(this,"Minimatch")}options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,t={}){_g(e),t=t||{},this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion??200,this.pattern=e,this.platform=t.platform||S7,this.isWindows=this.platform==="win32";let n="allowWindowsEscape";this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t[n]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!t.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!t.nonegate,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=t.windowsNoMagicRoot!==void 0?t.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let t of e)if(typeof t!="string")return!0;return!1}debug(...e){}make(){let e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)==="#"){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],t.debug&&(this.debug=(...s)=>console.error(...s)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(s=>this.slashSplit(s));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let i=this.globParts.map((s,o,c)=>{if(this.isWindows&&this.windowsNoMagicRoot){let l=s[0]===""&&s[1]===""&&(s[2]==="?"||!y7.test(s[2]))&&!y7.test(s[3]),u=/^[a-z]:/i.test(s[0]);if(l)return[...s.slice(0,4),...s.slice(4).map(f=>this.parse(f))];if(u)return[s[0],...s.slice(1).map(f=>this.parse(f))]}return s.map(l=>this.parse(l))});if(this.debug(this.pattern,i),this.set=i.filter(s=>s.indexOf(!1)===-1),this.isWindows)for(let s=0;s<this.set.length;s++){let o=this.set[s];o[0]===""&&o[1]===""&&this.globParts[s][2]==="?"&&typeof o[3]=="string"&&/^[a-z]:$/i.test(o[3])&&(o[2]="?")}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let n of e)for(let i=0;i<n.length;i++)n[i]==="**"&&(n[i]="*");let{optimizationLevel:t=1}=this.options;return t>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):t>=1?e=this.levelOneOptimize(e):e=this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(t=>{let n=-1;for(;(n=t.indexOf("**",n+1))!==-1;){let i=n;for(;t[i+1]==="**";)i++;i!==n&&t.splice(n,i-n)}return t})}levelOneOptimize(e){return e.map(t=>(t=t.reduce((n,i)=>{let s=n[n.length-1];return i==="**"&&s==="**"?n:i===".."&&s&&s!==".."&&s!=="."&&s!=="**"?(n.pop(),n):(n.push(i),n)},[]),t.length===0?[""]:t))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let t=!1;do{if(t=!1,!this.preserveMultipleSlashes){for(let i=1;i<e.length-1;i++){let s=e[i];i===1&&s===""&&e[0]===""||(s==="."||s==="")&&(t=!0,e.splice(i,1),i--)}e[0]==="."&&e.length===2&&(e[1]==="."||e[1]==="")&&(t=!0,e.pop())}let n=0;for(;(n=e.indexOf("..",n+1))!==-1;){let i=e[n-1];i&&i!=="."&&i!==".."&&i!=="**"&&!(this.isWindows&&/^[a-z]:$/i.test(i))&&(t=!0,e.splice(n-1,2),n-=2)}}while(t);return e.length===0?[""]:e}firstPhasePreProcess(e){let t=!1;do{t=!1;for(let n of e){let i=-1;for(;(i=n.indexOf("**",i+1))!==-1;){let o=i;for(;n[o+1]==="**";)o++;o>i&&n.splice(i+1,o-i);let c=n[i+1],l=n[i+2],u=n[i+3];if(c!==".."||!l||l==="."||l===".."||!u||u==="."||u==="..")continue;t=!0,n.splice(i,1);let f=n.slice(0);f[i]="**",e.push(f),i--}if(!this.preserveMultipleSlashes){for(let o=1;o<n.length-1;o++){let c=n[o];o===1&&c===""&&n[0]===""||(c==="."||c==="")&&(t=!0,n.splice(o,1),o--)}n[0]==="."&&n.length===2&&(n[1]==="."||n[1]==="")&&(t=!0,n.pop())}let s=0;for(;(s=n.indexOf("..",s+1))!==-1;){let o=n[s-1];if(o&&o!=="."&&o!==".."&&o!=="**"){t=!0;let l=s===1&&n[s+1]==="**"?["."]:[];n.splice(s-1,2,...l),n.length===0&&n.push(""),s-=2}}}}while(t);return e}secondPhasePreProcess(e){for(let t=0;t<e.length-1;t++)for(let n=t+1;n<e.length;n++){let i=this.partsMatch(e[t],e[n],!this.preserveMultipleSlashes);if(i){e[t]=[],e[n]=i;break}}return e.filter(t=>t.length)}partsMatch(e,t,n=!1){let i=0,s=0,o=[],c="";for(;i<e.length&&s<t.length;)if(e[i]===t[s])o.push(c==="b"?t[s]:e[i]),i++,s++;else if(n&&e[i]==="**"&&t[s]===e[i+1])o.push(e[i]),i++;else if(n&&t[s]==="**"&&e[i]===t[s+1])o.push(t[s]),s++;else if(e[i]==="*"&&t[s]&&(this.options.dot||!t[s].startsWith("."))&&t[s]!=="**"){if(c==="b")return!1;c="a",o.push(e[i]),i++,s++}else if(t[s]==="*"&&e[i]&&(this.options.dot||!e[i].startsWith("."))&&e[i]!=="**"){if(c==="a")return!1;c="b",o.push(t[s]),i++,s++}else return!1;return e.length===t.length&&o}parseNegate(){if(this.nonegate)return;let e=this.pattern,t=!1,n=0;for(let i=0;i<e.length&&e.charAt(i)==="!";i++)t=!t,n++;n&&(this.pattern=e.slice(n)),this.negate=t}matchOne(e,t,n=!1){let i=0,s=0;if(this.isWindows){let c=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),l=!c&&e[0]===""&&e[1]===""&&e[2]==="?"&&/^[a-z]:$/i.test(e[3]),u=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),f=!u&&t[0]===""&&t[1]===""&&t[2]==="?"&&typeof t[3]=="string"&&/^[a-z]:$/i.test(t[3]),d=l?3:c?0:void 0,p=f?3:u?0:void 0;if(typeof d=="number"&&typeof p=="number"){let[h,g]=[e[d],t[p]];h.toLowerCase()===g.toLowerCase()&&(t[p]=h,s=p,i=d)}}let{optimizationLevel:o=1}=this.options;return o>=2&&(e=this.levelTwoFileOptimize(e)),t.includes(Fr)?this.#t(e,t,n,i,s):this.#n(e,t,n,i,s)}#t(e,t,n,i,s){let o=t.indexOf(Fr,s),c=t.lastIndexOf(Fr),[l,u,f]=n?[t.slice(s,o),t.slice(o+1),[]]:[t.slice(s,o),t.slice(o+1,c),t.slice(c+1)];if(l.length){let w=e.slice(i,i+l.length);if(!this.#n(w,l,n,0,0))return!1;i+=l.length,s+=l.length}let d=0;if(f.length){if(f.length+i>e.length)return!1;let w=e.length-f.length;if(this.#n(e,f,n,w,0))d=f.length;else{if(e[e.length-1]!==""||i+f.length===e.length||(w--,!this.#n(e,f,n,w,0)))return!1;d=f.length+1}}if(!u.length){let w=!!d;for(let v=i;v<e.length-d;v++){let E=String(e[v]);if(w=!0,E==="."||E===".."||!this.options.dot&&E.startsWith("."))return!1}return n||w}let p=[[[],0]],h=p[0],g=0,m=[0];for(let w of u)w===Fr?(m.push(g),h=[[],0],p.push(h)):(h[0].push(w),g++);let _=p.length-1,b=e.length-d;for(let w of p)w[1]=b-(m[_--]+w[0].length);return!!this.#r(e,p,i,0,n,0,!!d)}#r(e,t,n,i,s,o,c){let l=t[i];if(!l){for(let d=n;d<e.length;d++){c=!0;let p=e[d];if(p==="."||p===".."||!this.options.dot&&p.startsWith("."))return!1}return c}let[u,f]=l;for(;n<=f;){if(this.#n(e.slice(0,n+u.length),u,s,n,0)&&o<this.maxGlobstarRecursion){let h=this.#r(e,t,n+u.length,i+1,s,o+1,c);if(h!==!1)return h}let p=e[n];if(p==="."||p===".."||!this.options.dot&&p.startsWith("."))return!1;n++}return s||null}#n(e,t,n,i,s){let o,c,l,u;for(o=i,c=s,u=e.length,l=t.length;o<u&&c<l;o++,c++){this.debug("matchOne loop");let f=t[c],d=e[o];if(this.debug(t,f,d),f===!1||f===Fr)return!1;let p;if(typeof f=="string"?(p=d===f,this.debug("string match",f,d,p)):(p=f.test(d),this.debug("pattern match",f,d,p)),!p)return!1}if(o===u&&c===l)return!0;if(o===u)return n;if(c===l)return o===u-1&&e[o]==="";throw new Error("wtf?")}braceExpand(){return w7(this.pattern,this.options)}parse(e){_g(e);let t=this.options;if(e==="**")return Fr;if(e==="")return"";let n,i=null;(n=e.match(kbe))?i=t.dot?$be:Mbe:(n=e.match(Ibe))?i=(t.nocase?t.dot?xbe:Obe:t.dot?Cbe:Rbe)(n[1]):(n=e.match(jbe))?i=(t.nocase?t.dot?Ube:Bbe:t.dot?Vbe:Gbe)(n):(n=e.match(Pbe))?i=t.dot?Lbe:Fbe:(n=e.match(Dbe))&&(i=Nbe);let s=Mu.fromGlob(e,this.options).toMMPattern();return i&&typeof s=="object"&&Reflect.defineProperty(s,"test",{value:i}),s}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let t=this.options,n=t.noglobstar?Kbe:t.dot?zbe:Hbe,i=new Set(t.nocase?["i"]:[]),s=e.map(l=>{let u=l.map(d=>{if(d instanceof RegExp)for(let p of d.flags.split(""))i.add(p);return typeof d=="string"?Zbe(d):d===Fr?Fr:d._src});u.forEach((d,p)=>{let h=u[p+1],g=u[p-1];d!==Fr||g===Fr||(g===void 0?h!==void 0&&h!==Fr?u[p+1]="(?:\\/|"+n+"\\/)?"+h:u[p]=n:h===void 0?u[p-1]=g+"(?:\\/|\\/"+n+")?":h!==Fr&&(u[p-1]=g+"(?:\\/|\\/"+n+"\\/)"+h,u[p+1]=Fr))});let f=u.filter(d=>d!==Fr);if(this.partial&&f.length>=1){let d=[];for(let p=1;p<=f.length;p++)d.push(f.slice(0,p).join("/"));return"(?:"+d.join("|")+")"}return f.join("/")}).join("|"),[o,c]=e.length>1?["(?:",")"]:["",""];s="^"+o+s+c+"$",this.partial&&(s="^(?:\\/|"+o+s.slice(1,-1)+c+")$"),this.negate&&(s="^(?!"+s+").+$");try{this.regexp=new RegExp(s,[...i].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split("/"):this.isWindows&&/^\/\/[^/]+/.test(e)?["",...e.split(/\/+/)]:e.split(/\/+/)}match(e,t=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return e==="";if(e==="/"&&t)return!0;let n=this.options;this.isWindows&&(e=e.split("\\").join("/"));let i=this.slashSplit(e);this.debug(this.pattern,"split",i);let s=this.set;this.debug(this.pattern,"set",s);let o=i[i.length-1];if(!o)for(let c=i.length-2;!o&&c>=0;c--)o=i[c];for(let c of s){let l=i;if(n.matchBase&&c.length===1&&(l=[o]),this.matchOne(l,c,t))return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}static defaults(e){return bi.defaults(e).Minimatch}};bi.AST=Mu;bi.Minimatch=ts;bi.escape=mp;bi.unescape=io});var nE,Dn,Sg,eSe,RP,v7,E7,tSe,rSe,cl,T7,rE,nSe,Eg,I7=Be(()=>{nE=require("node:diagnostics_channel"),Dn=(0,nE.channel)("lru-cache:metrics"),Sg=(0,nE.tracingChannel)("lru-cache"),eSe=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,RP=a(()=>Dn.hasSubscribers||Sg.hasSubscribers,"R"),v7=new Set,E7=typeof process=="object"&&process?process:{},tSe=a((r,e,t,n)=>{typeof E7.emitWarning=="function"?E7.emitWarning(r,e,t,n):console.error(`[${t}] ${e}: ${r}`)},"k"),rSe=a(r=>!v7.has(r),"H"),cl=a(r=>!!r&&r===Math.floor(r)&&r>0&&isFinite(r),"T"),T7=a(r=>cl(r)?r<=Math.pow(2,8)?Uint8Array:r<=Math.pow(2,16)?Uint16Array:r<=Math.pow(2,32)?Uint32Array:r<=Number.MAX_SAFE_INTEGER?rE:null:null,"j"),rE=class extends Array{static{a(this,"O")}constructor(r){super(r),this.fill(0)}},nSe=class wg{static{a(this,"d")}heap;length;static#t=!1;static create(e){let t=T7(e);if(!t)return[];wg.#t=!0;let n=new wg(e,t);return wg.#t=!1,n}constructor(e,t){if(!wg.#t)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},Eg=class A7{static{a(this,"d")}#t;#r;#n;#e;#i;#a;#p;#u;get perf(){return this.#u}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;backgroundFetchSize;#c;#f;#l;#d;#o;#g;#E;#b;#S;#A;#y;#v;#T;#m;#_;#w;#R;#s;#O;static unsafeExposeInternals(e){return{starts:e.#T,ttls:e.#m,autopurgeTimers:e.#_,sizes:e.#v,keyMap:e.#l,keyList:e.#d,valList:e.#o,next:e.#g,prev:e.#E,get head(){return e.#b},get tail(){return e.#S},free:e.#A,isBackgroundFetch:a(t=>e.#h(t),"isBackgroundFetch"),backgroundFetch:a((t,n,i,s)=>e.#M(t,n,i,s),"backgroundFetch"),moveToTail:a(t=>e.#H(t),"moveToTail"),indexes:a(t=>e.#P(t),"indexes"),rindexes:a(t=>e.#F(t),"rindexes"),isStale:a(t=>e.#I(t),"isStale")}}get max(){return this.#t}get maxSize(){return this.#r}get calculatedSize(){return this.#f}get size(){return this.#c}get fetchMethod(){return this.#a}get memoMethod(){return this.#p}get dispose(){return this.#n}get onInsert(){return this.#e}get disposeAfter(){return this.#i}constructor(e){let{max:t=0,ttl:n,ttlResolution:i=1,ttlAutopurge:s,updateAgeOnGet:o,updateAgeOnHas:c,allowStale:l,dispose:u,onInsert:f,disposeAfter:d,noDisposeOnSet:p,noUpdateTTL:h,maxSize:g=0,maxEntrySize:m=0,sizeCalculation:_,fetchMethod:b,memoMethod:w,noDeleteOnFetchRejection:v,noDeleteOnStaleGet:E,allowStaleOnFetchRejection:S,allowStaleOnFetchAbort:R,ignoreFetchAbort:C,backgroundFetchSize:P=1,perf:D}=e;if(this.backgroundFetchSize=P,D!==void 0&&typeof D?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(this.#u=D??eSe,t!==0&&!cl(t))throw new TypeError("max option must be a nonnegative integer");let F=t?T7(t):Array;if(!F)throw new Error("invalid max value: "+t);if(this.#t=t,this.#r=g,this.maxEntrySize=m||this.#r,this.sizeCalculation=_,this.sizeCalculation){if(!this.#r&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(w!==void 0&&typeof w!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#p=w,b!==void 0&&typeof b!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#a=b,this.#R=!!b,this.#l=new Map,this.#d=Array.from({length:t}).fill(void 0),this.#o=Array.from({length:t}).fill(void 0),this.#g=new F(t),this.#E=new F(t),this.#b=0,this.#S=0,this.#A=nSe.create(t),this.#c=0,this.#f=0,typeof u=="function"&&(this.#n=u),typeof f=="function"&&(this.#e=f),typeof d=="function"?(this.#i=d,this.#y=[]):(this.#i=void 0,this.#y=void 0),this.#w=!!this.#n,this.#O=!!this.#e,this.#s=!!this.#i,this.noDisposeOnSet=!!p,this.noUpdateTTL=!!h,this.noDeleteOnFetchRejection=!!v,this.allowStaleOnFetchRejection=!!S,this.allowStaleOnFetchAbort=!!R,this.ignoreFetchAbort=!!C,this.maxEntrySize!==0){if(this.#r!==0&&!cl(this.#r))throw new TypeError("maxSize must be a positive integer if specified");if(!cl(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#q()}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!E,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!c,this.ttlResolution=cl(i)||i===0?i:1,this.ttlAutopurge=!!s,this.ttl=n||0,this.ttl){if(!cl(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#x()}if(this.#t===0&&this.ttl===0&&this.#r===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#t&&!this.#r){let $="LRU_CACHE_UNBOUNDED";rSe($)&&(v7.add($),tSe("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",$,A7))}}getRemainingTTL(e){return this.#l.has(e)?1/0:0}#x(){let e=new rE(this.#t),t=new rE(this.#t);this.#m=e,this.#T=t;let n=this.ttlAutopurge?Array.from({length:this.#t}):void 0;this.#_=n,this.#j=(l,u,f=this.#u.now())=>{t[l]=u!==0?f:0,e[l]=u,i(l,u)},this.#C=l=>{t[l]=e[l]!==0?this.#u.now():0,i(l,e[l])};let i=this.ttlAutopurge?(l,u)=>{if(n?.[l]&&(clearTimeout(n[l]),n[l]=void 0),u&&u!==0&&n){let f=setTimeout(()=>{this.#I(l)?(this.#$(this.#d[l],"expire"),n[l]=void 0):i(l,c(l))},u+1);f.unref&&f.unref(),n[l]=f}}:()=>{};this.#L=(l,u)=>{if(e[u]){let f=e[u],d=t[u];if(!f||!d)return;l.ttl=f,l.start=d,l.now=s||o();let p=l.now-d;l.remainingTTL=f-p}};let s=0,o=a(()=>{let l=this.#u.now();if(this.ttlResolution>0){s=l;let u=setTimeout(()=>s=0,this.ttlResolution);u.unref&&u.unref()}return l},"o");this.getRemainingTTL=l=>{let u=this.#l.get(l);return u===void 0?0:c(u)};let c=a(l=>{let u=e[l],f=t[l];if(!u||!f)return 1/0;let d=(s||o())-f;return u-d},"l");this.#I=l=>{let u=t[l],f=e[l];return!!f&&!!u&&(s||o())-u>f}}#C=a(()=>{},"#R");#L=a(()=>{},"#v");#j=a(()=>{},"#H");#I=a(()=>!1,"#p");#q(){let e=new rE(this.#t);this.#f=0,this.#v=e,this.#N=t=>{this.#f-=e[t],e[t]=0},this.#B=(t,n,i,s)=>{if(!cl(i)){if(this.#h(n))return this.backgroundFetchSize;if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(i=s(n,t),!cl(i))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.")}return i},this.#D=(t,n,i)=>{if(e[t]=n,this.#r){let s=this.#r-e[t];for(;this.#f>s;)this.#G(!0)}this.#f+=e[t],i&&(i.entrySize=n,i.totalCalculatedSize=this.#f)}}#N=a(e=>{},"#x");#D=a((e,t,n)=>{},"#j");#B=a((e,t,n,i)=>{if(n||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0},"#N");*#P({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#S;this.#U(t)&&((e||!this.#I(t))&&(yield t),t!==this.#b);)t=this.#E[t]}*#F({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#b;this.#U(t)&&((e||!this.#I(t))&&(yield t),t!==this.#S);)t=this.#g[t]}#U(e){return e!==void 0&&this.#l.get(this.#d[e])===e}*entries(){for(let e of this.#P())this.#o[e]!==void 0&&this.#d[e]!==void 0&&!this.#h(this.#o[e])&&(yield[this.#d[e],this.#o[e]])}*rentries(){for(let e of this.#F())this.#o[e]!==void 0&&this.#d[e]!==void 0&&!this.#h(this.#o[e])&&(yield[this.#d[e],this.#o[e]])}*keys(){for(let e of this.#P()){let t=this.#d[e];t!==void 0&&!this.#h(this.#o[e])&&(yield t)}}*rkeys(){for(let e of this.#F()){let t=this.#d[e];t!==void 0&&!this.#h(this.#o[e])&&(yield t)}}*values(){for(let e of this.#P())this.#o[e]!==void 0&&!this.#h(this.#o[e])&&(yield this.#o[e])}*rvalues(){for(let e of this.#F())this.#o[e]!==void 0&&!this.#h(this.#o[e])&&(yield this.#o[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(let n of this.#P()){let i=this.#o[n],s=this.#h(i)?i.__staleWhileFetching:i;if(s!==void 0&&e(s,this.#d[n],this))return this.#z(this.#d[n],t)}}forEach(e,t=this){for(let n of this.#P()){let i=this.#o[n],s=this.#h(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(t,s,this.#d[n],this)}}rforEach(e,t=this){for(let n of this.#F()){let i=this.#o[n],s=this.#h(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(t,s,this.#d[n],this)}}purgeStale(){let e=!1;for(let t of this.#F({allowStale:!0}))this.#I(t)&&(this.#$(this.#d[t],"expire"),e=!0);return e}info(e){let t=this.#l.get(e);if(t===void 0)return;let n=this.#o[t],i=this.#h(n)?n.__staleWhileFetching:n;if(i===void 0)return;let s={value:i};if(this.#m&&this.#T){let o=this.#m[t],c=this.#T[t];if(o&&c){let l=o-(this.#u.now()-c);s.ttl=l,s.start=Date.now()}}return this.#v&&(s.size=this.#v[t]),s}dump(){let e=[];for(let t of this.#P({allowStale:!0})){let n=this.#d[t],i=this.#o[t],s=this.#h(i)?i.__staleWhileFetching:i;if(s===void 0||n===void 0)continue;let o={value:s};if(this.#m&&this.#T){o.ttl=this.#m[t];let c=this.#u.now()-this.#T[t];o.start=Math.floor(Date.now()-c)}this.#v&&(o.size=this.#v[t]),e.unshift([n,o])}return e}load(e){this.clear();for(let[t,n]of e){if(n.start){let i=Date.now()-n.start;n.start=this.#u.now()-i}this.#k(t,n.value,n)}}set(e,t,n={}){let{status:i=Dn.hasSubscribers?{}:void 0}=n;n.status=i,i&&(i.op="set",i.key=e,t!==void 0&&(i.value=t),i.cache=this);let s=this.#k(e,t,n);return i&&Dn.hasSubscribers&&Dn.publish(i),s}#k(e,t,n,i){let{ttl:s=this.ttl,start:o,noDisposeOnSet:c=this.noDisposeOnSet,sizeCalculation:l=this.sizeCalculation,status:u}=n,f=this.#h(t);if(t===void 0)return u&&(u.set="deleted"),this.delete(e),this;let{noUpdateTTL:d=this.noUpdateTTL}=n;u&&!f&&(u.value=t);let p=this.#B(e,t,n.size||0,l,u);if(this.maxEntrySize&&p>this.maxEntrySize)return this.#$(e,"set"),u&&(u.set="miss",u.maxEntrySizeExceeded=!0),this;let h=this.#c===0?void 0:this.#l.get(e);if(h===void 0)h=this.#c===0?this.#S:this.#A.length!==0?this.#A.pop():this.#c===this.#t?this.#G(!1):this.#c,this.#d[h]=e,this.#o[h]=t,this.#l.set(e,h),this.#g[this.#S]=h,this.#E[h]=this.#S,this.#S=h,this.#c++,this.#D(h,p,u),u&&(u.set="add"),d=!1,this.#O&&!f&&this.#e?.(t,e,"add");else{this.#H(h);let g=this.#o[h];if(t!==g){if(!c)if(this.#h(g)){g!==i&&g.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:m}=g;m!==void 0&&m!==t&&(this.#w&&this.#n?.(m,e,"set"),this.#s&&this.#y?.push([m,e,"set"]))}else this.#w&&this.#n?.(g,e,"set"),this.#s&&this.#y?.push([g,e,"set"]);if(this.#N(h),this.#D(h,p,u),this.#o[h]=t,!f){let m=g&&this.#h(g)?g.__staleWhileFetching:g,_=m===void 0?"add":t!==m?"replace":"update";u&&(u.set=_,m!==void 0&&(u.oldValue=m)),this.#O&&this.onInsert?.(t,e,_)}}else f||(u&&(u.set="update"),this.#O&&this.onInsert?.(t,e,"update"))}if(s!==0&&!this.#m&&this.#x(),this.#m&&(d||this.#j(h,s,o),u&&this.#L(u,h)),!c&&this.#s&&this.#y){let g=this.#y,m;for(;m=g?.shift();)this.#i?.(...m)}return this}pop(){try{for(;this.#c;){let e=this.#o[this.#b];if(this.#G(!0),this.#h(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#s&&this.#y){let e=this.#y,t;for(;t=e?.shift();)this.#i?.(...t)}}}#G(e){let t=this.#b,n=this.#d[t],i=this.#o[t],s=this.#h(i);s&&i.__abortController.abort(new Error("evicted"));let o=s?i.__staleWhileFetching:i;return(this.#w||this.#s)&&o!==void 0&&(this.#w&&this.#n?.(o,n,"evict"),this.#s&&this.#y?.push([o,n,"evict"])),this.#N(t),this.#_?.[t]&&(clearTimeout(this.#_[t]),this.#_[t]=void 0),e&&(this.#d[t]=void 0,this.#o[t]=void 0,this.#A.push(t)),this.#c===1?(this.#b=this.#S=0,this.#A.length=0):this.#b=this.#g[t],this.#l.delete(n),this.#c--,t}has(e,t={}){let{status:n=Dn.hasSubscribers?{}:void 0}=t;t.status=n,n&&(n.op="has",n.key=e,n.cache=this);let i=this.#Y(e,t);return Dn.hasSubscribers&&Dn.publish(n),i}#Y(e,t={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:i}=t,s=this.#l.get(e);if(s!==void 0){let o=this.#o[s];if(this.#h(o)&&o.__staleWhileFetching===void 0)return!1;if(this.#I(s))i&&(i.has="stale",this.#L(i,s));else return n&&this.#C(s),i&&(i.has="hit",this.#L(i,s)),!0}else i&&(i.has="miss");return!1}peek(e,t={}){let{status:n=RP()?{}:void 0}=t;n&&(n.op="peek",n.key=e,n.cache=this),t.status=n;let i=this.#W(e,t);return Dn.hasSubscribers&&Dn.publish(n),i}#W(e,t){let{status:n,allowStale:i=this.allowStale}=t,s=this.#l.get(e);if(s===void 0||!i&&this.#I(s)){n&&(n.peek=s===void 0?"miss":"stale");return}let o=this.#o[s],c=this.#h(o)?o.__staleWhileFetching:o;return n&&(c!==void 0?(n.peek="hit",n.value=c):n.peek="miss"),c}#M(e,t,n,i){let s=t===void 0?void 0:this.#o[t];if(this.#h(s))return s;let o=new AbortController,{signal:c}=n;c?.addEventListener("abort",()=>o.abort(c.reason),{signal:o.signal});let l={signal:o.signal,options:n,context:i},u=a((m,_=!1)=>{let{aborted:b}=o.signal,w=n.ignoreFetchAbort&&m!==void 0,v=n.ignoreFetchAbort||!!(n.allowStaleOnFetchAbort&&m!==void 0);if(n.status&&(b&&!_?(n.status.fetchAborted=!0,n.status.fetchError=o.signal.reason,w&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),b&&!w&&!_)return d(o.signal.reason,v);let E=h,S=this.#o[t];return(S===h||S===void 0&&w&&_)&&(m===void 0?E.__staleWhileFetching!==void 0?this.#o[t]=E.__staleWhileFetching:this.#$(e,"fetch"):(n.status&&(n.status.fetchUpdated=!0),this.#k(e,m,l.options,E))),m},"r"),f=a(m=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=m),d(m,!1)),"c"),d=a((m,_)=>{let{aborted:b}=o.signal,w=b&&n.allowStaleOnFetchAbort,v=w||n.allowStaleOnFetchRejection,E=v||n.noDeleteOnFetchRejection,S=h;if(this.#o[t]===h&&(!E||!_&&S.__staleWhileFetching===void 0?this.#$(e,"fetch"):w||(this.#o[t]=S.__staleWhileFetching)),v)return n.status&&S.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),S.__staleWhileFetching;if(S.__returned===S)throw m},"m"),p=a((m,_)=>{let b=this.#a?.(e,s,l);o.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(m(void 0),n.allowStaleOnFetchAbort&&(m=a(w=>u(w,!0),"f")))}),b&&b instanceof Promise?b.then(w=>m(w===void 0?void 0:w),_):b!==void 0&&m(b)},"_");n.status&&(n.status.fetchDispatched=!0);let h=new Promise(p).then(u,f),g=Object.assign(h,{__abortController:o,__staleWhileFetching:s,__returned:void 0});return t===void 0?(this.#k(e,g,{...l.options,status:void 0}),t=this.#l.get(e)):this.#o[t]=g,g}#h(e){if(!this.#R)return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof AbortController}fetch(e,t={}){let n=Sg.hasSubscribers,{status:i=RP()?{}:void 0}=t;t.status=i,i&&t.context&&(i.context=t.context);let s=this.#K(e,t);return i&&n&&(i.trace=!0,Sg.tracePromise(()=>s,i).catch(()=>{})),s}async#K(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:c=this.noDisposeOnSet,size:l=0,sizeCalculation:u=this.sizeCalculation,noUpdateTTL:f=this.noUpdateTTL,noDeleteOnFetchRejection:d=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:p=this.allowStaleOnFetchRejection,ignoreFetchAbort:h=this.ignoreFetchAbort,allowStaleOnFetchAbort:g=this.allowStaleOnFetchAbort,context:m,forceRefresh:_=!1,status:b,signal:w}=t;if(b&&(b.op="fetch",b.key=e,_&&(b.forceRefresh=!0),b.cache=this),!this.#R)return b&&(b.fetch="get"),this.#z(e,{allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:s,status:b});let v={allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:s,ttl:o,noDisposeOnSet:c,size:l,sizeCalculation:u,noUpdateTTL:f,noDeleteOnFetchRejection:d,allowStaleOnFetchRejection:p,allowStaleOnFetchAbort:g,ignoreFetchAbort:h,status:b,signal:w},E=this.#l.get(e);if(E===void 0){b&&(b.fetch="miss");let S=this.#M(e,E,v,m);return S.__returned=S}else{let S=this.#o[E];if(this.#h(S)){let D=n&&S.__staleWhileFetching!==void 0;return b&&(b.fetch="inflight",D&&(b.returnedStale=!0)),D?S.__staleWhileFetching:S.__returned=S}let R=this.#I(E);if(!_&&!R)return b&&(b.fetch="hit"),this.#H(E),i&&this.#C(E),b&&this.#L(b,E),S;let C=this.#M(e,E,v,m),P=C.__staleWhileFetching!==void 0&&n;return b&&(b.fetch=R?"stale":"refresh",P&&R&&(b.returnedStale=!0)),P?C.__staleWhileFetching:C.__returned=C}}forceFetch(e,t={}){let n=Sg.hasSubscribers,{status:i=RP()?{}:void 0}=t;t.status=i,i&&t.context&&(i.context=t.context);let s=this.#V(e,t);return i&&n&&(i.trace=!0,Sg.tracePromise(()=>s,i).catch(()=>{})),s}async#V(e,t={}){let n=await this.#K(e,t);if(n===void 0)throw new Error("fetch() returned undefined");return n}memo(e,t={}){let{status:n=Dn.hasSubscribers?{}:void 0}=t;t.status=n,n&&(n.op="memo",n.key=e,t.context&&(n.context=t.context),n.cache=this);let i=this.#J(e,t);return n&&(n.value=i),Dn.hasSubscribers&&Dn.publish(n),i}#J(e,t={}){let n=this.#p;if(!n)throw new Error("no memoMethod provided to constructor");let{context:i,status:s,forceRefresh:o,...c}=t;s&&o&&(s.forceRefresh=!0);let l=this.#z(e,c),u=o||l===void 0;if(s&&(s.memo=u?"miss":"hit",u||(s.value=l)),!u)return l;let f=n(e,l,{options:c,context:i});return s&&(s.value=f),this.#k(e,f,c),f}get(e,t={}){let{status:n=Dn.hasSubscribers?{}:void 0}=t;t.status=n,n&&(n.op="get",n.key=e,n.cache=this);let i=this.#z(e,t);return n&&(i!==void 0&&(n.value=i),Dn.hasSubscribers&&Dn.publish(n)),i}#z(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,status:o}=t,c=this.#l.get(e);if(c===void 0){o&&(o.get="miss");return}let l=this.#o[c],u=this.#h(l);return o&&this.#L(o,c),this.#I(c)?u?(o&&(o.get="stale-fetching"),n&&l.__staleWhileFetching!==void 0?(o&&(o.returnedStale=!0),l.__staleWhileFetching):void 0):(s||this.#$(e,"expire"),o&&(o.get="stale"),n?(o&&(o.returnedStale=!0),l):void 0):(o&&(o.get=u?"fetching":"hit"),this.#H(c),i&&this.#C(c),u?l.__staleWhileFetching:l)}#Q(e,t){this.#E[t]=e,this.#g[e]=t}#H(e){e!==this.#S&&(e===this.#b?this.#b=this.#g[e]:this.#Q(this.#E[e],this.#g[e]),this.#Q(this.#S,e),this.#S=e)}delete(e){return this.#$(e,"delete")}#$(e,t){Dn.hasSubscribers&&Dn.publish({op:"delete",delete:t,key:e,cache:this});let n=!1;if(this.#c!==0){let i=this.#l.get(e);if(i!==void 0)if(this.#_?.[i]&&(clearTimeout(this.#_[i]),this.#_[i]=void 0),n=!0,this.#c===1)this.#X(t);else{this.#N(i);let s=this.#o[i];if(this.#h(s)?s.__abortController.abort(new Error("deleted")):(this.#w||this.#s)&&(this.#w&&this.#n?.(s,e,t),this.#s&&this.#y?.push([s,e,t])),this.#l.delete(e),this.#d[i]=void 0,this.#o[i]=void 0,i===this.#S)this.#S=this.#E[i];else if(i===this.#b)this.#b=this.#g[i];else{let o=this.#E[i];this.#g[o]=this.#g[i];let c=this.#g[i];this.#E[c]=this.#E[i]}this.#c--,this.#A.push(i)}}if(this.#s&&this.#y?.length){let i=this.#y,s;for(;s=i?.shift();)this.#i?.(...s)}return n}clear(){return this.#X("delete")}#X(e){for(let t of this.#F({allowStale:!0})){let n=this.#o[t];if(this.#h(n))n.__abortController.abort(new Error("deleted"));else{let i=this.#d[t];this.#w&&this.#n?.(n,i,e),this.#s&&this.#y?.push([n,i,e])}}if(this.#l.clear(),this.#o.fill(void 0),this.#d.fill(void 0),this.#m&&this.#T){this.#m.fill(0),this.#T.fill(0);for(let t of this.#_??[])t!==void 0&&clearTimeout(t);this.#_?.fill(void 0)}if(this.#v&&this.#v.fill(0),this.#b=0,this.#S=0,this.#A.length=0,this.#f=0,this.#c=0,this.#s&&this.#y){let t=this.#y,n;for(;n=t?.shift();)this.#i?.(...n)}}}});var uE,DP,P7,R7,iSe,sSe,oSe,rc,nc,ll,iE,vg,sE,C7,oE,O7,so,gp,un,Tg,yp,fn,Si,dn,CP,aE,Zn,Lr,OP,xP,x7,PP,Ko,FP,cE,Ag,$u,rs,Ig,aSe,cSe,lSe,uSe,lE,LP,fSe,dSe,ul,NP=Be(()=>{uE=require("node:events"),DP=Y(require("node:stream"),1),P7=require("node:string_decoder"),R7=typeof process=="object"&&process?process:{stdout:null,stderr:null},iSe=a(r=>!!r&&typeof r=="object"&&(r instanceof ul||r instanceof DP.default||sSe(r)||oSe(r)),"isStream"),sSe=a(r=>!!r&&typeof r=="object"&&r instanceof uE.EventEmitter&&typeof r.pipe=="function"&&r.pipe!==DP.default.Writable.prototype.pipe,"isReadable"),oSe=a(r=>!!r&&typeof r=="object"&&r instanceof uE.EventEmitter&&typeof r.write=="function"&&typeof r.end=="function","isWritable"),rc=Symbol("EOF"),nc=Symbol("maybeEmitEnd"),ll=Symbol("emittedEnd"),iE=Symbol("emittingEnd"),vg=Symbol("emittedError"),sE=Symbol("closed"),C7=Symbol("read"),oE=Symbol("flush"),O7=Symbol("flushChunk"),so=Symbol("encoding"),gp=Symbol("decoder"),un=Symbol("flowing"),Tg=Symbol("paused"),yp=Symbol("resume"),fn=Symbol("buffer"),Si=Symbol("pipes"),dn=Symbol("bufferLength"),CP=Symbol("bufferPush"),aE=Symbol("bufferShift"),Zn=Symbol("objectMode"),Lr=Symbol("destroyed"),OP=Symbol("error"),xP=Symbol("emitData"),x7=Symbol("emitEnd"),PP=Symbol("emitEnd2"),Ko=Symbol("async"),FP=Symbol("abort"),cE=Symbol("aborted"),Ag=Symbol("signal"),$u=Symbol("dataListeners"),rs=Symbol("discarded"),Ig=a(r=>Promise.resolve().then(r),"defer"),aSe=a(r=>r(),"nodefer"),cSe=a(r=>r==="end"||r==="finish"||r==="prefinish","isEndish"),lSe=a(r=>r instanceof ArrayBuffer||!!r&&typeof r=="object"&&r.constructor&&r.constructor.name==="ArrayBuffer"&&r.byteLength>=0,"isArrayBufferLike"),uSe=a(r=>!Buffer.isBuffer(r)&&ArrayBuffer.isView(r),"isArrayBufferView"),lE=class{static{a(this,"Pipe")}src;dest;opts;ondrain;constructor(e,t,n){this.src=e,this.dest=t,this.opts=n,this.ondrain=()=>e[yp](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},LP=class extends lE{static{a(this,"PipeProxyErrors")}unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,t,n){super(e,t,n),this.proxyErrors=i=>this.dest.emit("error",i),e.on("error",this.proxyErrors)}},fSe=a(r=>!!r.objectMode,"isObjectModeOptions"),dSe=a(r=>!r.objectMode&&!!r.encoding&&r.encoding!=="buffer","isEncodingOptions"),ul=class extends uE.EventEmitter{static{a(this,"Minipass")}[un]=!1;[Tg]=!1;[Si]=[];[fn]=[];[Zn];[so];[Ko];[gp];[rc]=!1;[ll]=!1;[iE]=!1;[sE]=!1;[vg]=null;[dn]=0;[Lr]=!1;[Ag];[cE]=!1;[$u]=0;[rs]=!1;writable=!0;readable=!0;constructor(...e){let t=e[0]||{};if(super(),t.objectMode&&typeof t.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");fSe(t)?(this[Zn]=!0,this[so]=null):dSe(t)?(this[so]=t.encoding,this[Zn]=!1):(this[Zn]=!1,this[so]=null),this[Ko]=!!t.async,this[gp]=this[so]?new P7.StringDecoder(this[so]):null,t&&t.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:a(()=>this[fn],"get")}),t&&t.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:a(()=>this[Si],"get")});let{signal:n}=t;n&&(this[Ag]=n,n.aborted?this[FP]():n.addEventListener("abort",()=>this[FP]()))}get bufferLength(){return this[dn]}get encoding(){return this[so]}set encoding(e){throw new Error("Encoding must be set at instantiation time")}setEncoding(e){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[Zn]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[Ko]}set async(e){this[Ko]=this[Ko]||!!e}[FP](){this[cE]=!0,this.emit("abort",this[Ag]?.reason),this.destroy(this[Ag]?.reason)}get aborted(){return this[cE]}set aborted(e){}write(e,t,n){if(this[cE])return!1;if(this[rc])throw new Error("write after end");if(this[Lr])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof t=="function"&&(n=t,t="utf8"),t||(t="utf8");let i=this[Ko]?Ig:aSe;if(!this[Zn]&&!Buffer.isBuffer(e)){if(uSe(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(lSe(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[Zn]?(this[un]&&this[dn]!==0&&this[oE](!0),this[un]?this.emit("data",e):this[CP](e),this[dn]!==0&&this.emit("readable"),n&&i(n),this[un]):e.length?(typeof e=="string"&&!(t===this[so]&&!this[gp]?.lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[so]&&(e=this[gp].write(e)),this[un]&&this[dn]!==0&&this[oE](!0),this[un]?this.emit("data",e):this[CP](e),this[dn]!==0&&this.emit("readable"),n&&i(n),this[un]):(this[dn]!==0&&this.emit("readable"),n&&i(n),this[un])}read(e){if(this[Lr])return null;if(this[rs]=!1,this[dn]===0||e===0||e&&e>this[dn])return this[nc](),null;this[Zn]&&(e=null),this[fn].length>1&&!this[Zn]&&(this[fn]=[this[so]?this[fn].join(""):Buffer.concat(this[fn],this[dn])]);let t=this[C7](e||null,this[fn][0]);return this[nc](),t}[C7](e,t){if(this[Zn])this[aE]();else{let n=t;e===n.length||e===null?this[aE]():typeof n=="string"?(this[fn][0]=n.slice(e),t=n.slice(0,e),this[dn]-=e):(this[fn][0]=n.subarray(e),t=n.subarray(0,e),this[dn]-=e)}return this.emit("data",t),!this[fn].length&&!this[rc]&&this.emit("drain"),t}end(e,t,n){return typeof e=="function"&&(n=e,e=void 0),typeof t=="function"&&(n=t,t="utf8"),e!==void 0&&this.write(e,t),n&&this.once("end",n),this[rc]=!0,this.writable=!1,(this[un]||!this[Tg])&&this[nc](),this}[yp](){this[Lr]||(!this[$u]&&!this[Si].length&&(this[rs]=!0),this[Tg]=!1,this[un]=!0,this.emit("resume"),this[fn].length?this[oE]():this[rc]?this[nc]():this.emit("drain"))}resume(){return this[yp]()}pause(){this[un]=!1,this[Tg]=!0,this[rs]=!1}get destroyed(){return this[Lr]}get flowing(){return this[un]}get paused(){return this[Tg]}[CP](e){this[Zn]?this[dn]+=1:this[dn]+=e.length,this[fn].push(e)}[aE](){return this[Zn]?this[dn]-=1:this[dn]-=this[fn][0].length,this[fn].shift()}[oE](e=!1){do;while(this[O7](this[aE]())&&this[fn].length);!e&&!this[fn].length&&!this[rc]&&this.emit("drain")}[O7](e){return this.emit("data",e),this[un]}pipe(e,t){if(this[Lr])return e;this[rs]=!1;let n=this[ll];return t=t||{},e===R7.stdout||e===R7.stderr?t.end=!1:t.end=t.end!==!1,t.proxyErrors=!!t.proxyErrors,n?t.end&&e.end():(this[Si].push(t.proxyErrors?new LP(this,e,t):new lE(this,e,t)),this[Ko]?Ig(()=>this[yp]()):this[yp]()),e}unpipe(e){let t=this[Si].find(n=>n.dest===e);t&&(this[Si].length===1?(this[un]&&this[$u]===0&&(this[un]=!1),this[Si]=[]):this[Si].splice(this[Si].indexOf(t),1),t.unpipe())}addListener(e,t){return this.on(e,t)}on(e,t){let n=super.on(e,t);if(e==="data")this[rs]=!1,this[$u]++,!this[Si].length&&!this[un]&&this[yp]();else if(e==="readable"&&this[dn]!==0)super.emit("readable");else if(cSe(e)&&this[ll])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[vg]){let i=t;this[Ko]?Ig(()=>i.call(this,this[vg])):i.call(this,this[vg])}return n}removeListener(e,t){return this.off(e,t)}off(e,t){let n=super.off(e,t);return e==="data"&&(this[$u]=this.listeners("data").length,this[$u]===0&&!this[rs]&&!this[Si].length&&(this[un]=!1)),n}removeAllListeners(e){let t=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[$u]=0,!this[rs]&&!this[Si].length&&(this[un]=!1)),t}get emittedEnd(){return this[ll]}[nc](){!this[iE]&&!this[ll]&&!this[Lr]&&this[fn].length===0&&this[rc]&&(this[iE]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[sE]&&this.emit("close"),this[iE]=!1)}emit(e,...t){let n=t[0];if(e!=="error"&&e!=="close"&&e!==Lr&&this[Lr])return!1;if(e==="data")return!this[Zn]&&!n?!1:this[Ko]?(Ig(()=>this[xP](n)),!0):this[xP](n);if(e==="end")return this[x7]();if(e==="close"){if(this[sE]=!0,!this[ll]&&!this[Lr])return!1;let s=super.emit("close");return this.removeAllListeners("close"),s}else if(e==="error"){this[vg]=n,super.emit(OP,n);let s=!this[Ag]||this.listeners("error").length?super.emit("error",n):!1;return this[nc](),s}else if(e==="resume"){let s=super.emit("resume");return this[nc](),s}else if(e==="finish"||e==="prefinish"){let s=super.emit(e);return this.removeAllListeners(e),s}let i=super.emit(e,...t);return this[nc](),i}[xP](e){for(let n of this[Si])n.dest.write(e)===!1&&this.pause();let t=this[rs]?!1:super.emit("data",e);return this[nc](),t}[x7](){return this[ll]?!1:(this[ll]=!0,this.readable=!1,this[Ko]?(Ig(()=>this[PP]()),!0):this[PP]())}[PP](){if(this[gp]){let t=this[gp].end();if(t){for(let n of this[Si])n.dest.write(t);this[rs]||super.emit("data",t)}}for(let t of this[Si])t.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[Zn]||(e.dataLength=0);let t=this.promise();return this.on("data",n=>{e.push(n),this[Zn]||(e.dataLength+=n.length)}),await t,e}async concat(){if(this[Zn])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[so]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,t)=>{this.on(Lr,()=>t(new Error("stream destroyed"))),this.on("error",n=>t(n)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[rs]=!1;let e=!1,t=a(async()=>(this.pause(),e=!0,{value:void 0,done:!0}),"stop");return{next:a(()=>{if(e)return t();let i=this.read();if(i!==null)return Promise.resolve({done:!1,value:i});if(this[rc])return t();let s,o,c=a(d=>{this.off("data",l),this.off("end",u),this.off(Lr,f),t(),o(d)},"onerr"),l=a(d=>{this.off("error",c),this.off("end",u),this.off(Lr,f),this.pause(),s({value:d,done:!!this[rc]})},"ondata"),u=a(()=>{this.off("error",c),this.off("data",l),this.off(Lr,f),t(),s({done:!0,value:void 0})},"onend"),f=a(()=>c(new Error("stream destroyed")),"ondestroy");return new Promise((d,p)=>{o=p,s=d,this.once(Lr,f),this.once("error",c),this.once("end",u),this.once("data",l)})},"next"),throw:t,return:t,[Symbol.asyncIterator](){return this},[Symbol.asyncDispose]:async()=>{}}}[Symbol.iterator](){this[rs]=!1;let e=!1,t=a(()=>(this.pause(),this.off(OP,t),this.off(Lr,t),this.off("end",t),e=!0,{done:!0,value:void 0}),"stop"),n=a(()=>{if(e)return t();let i=this.read();return i===null?t():{done:!1,value:i}},"next");return this.once("end",t),this.once(OP,t),this.once(Lr,t),{next:n,throw:t,return:t,[Symbol.iterator](){return this},[Symbol.dispose]:()=>{}}}destroy(e){if(this[Lr])return e?this.emit("error",e):this.emit(Lr),this;this[Lr]=!0,this[rs]=!0,this[fn].length=0,this[dn]=0;let t=this;return typeof t.close=="function"&&!this[sE]&&t.close(),e?this.emit("error",e):this.emit(Lr),this}static get isStream(){return iSe}}});var _p,k7,Ho,pSe,fl,hSe,Cg,M7,$7,mSe,gSe,Ts,j7,B7,zo,U7,V7,ju,G7,vs,Rg,kP,F7,Og,oo,fE,pE,L7,ySe,MP,D7,xg,N7,dE,hE,$P,q7,ei,mE,gE,yE,bp,Sp,Pg,bBe,W7,K7=Be(()=>{I7();_p=require("node:path"),k7=require("node:url"),Ho=require("fs"),pSe=Y(require("node:fs"),1),fl=require("node:fs/promises");NP();hSe=Ho.realpathSync.native,Cg={lstatSync:Ho.lstatSync,readdir:Ho.readdir,readdirSync:Ho.readdirSync,readlinkSync:Ho.readlinkSync,realpathSync:hSe,promises:{lstat:fl.lstat,readdir:fl.readdir,readlink:fl.readlink,realpath:fl.realpath}},M7=a(r=>!r||r===Cg||r===pSe?Cg:{...Cg,...r,promises:{...Cg.promises,...r.promises||{}}},"fsFromOption"),$7=/^\\\\\?\\([a-z]:)\\?$/i,mSe=a(r=>r.replace(/\//g,"\\").replace($7,"$1\\"),"uncToDrive"),gSe=/[\\\/]/,Ts=0,j7=1,B7=2,zo=4,U7=6,V7=8,ju=10,G7=12,vs=15,Rg=~vs,kP=16,F7=32,Og=64,oo=128,fE=256,pE=512,L7=Og|oo|pE,ySe=1023,MP=a(r=>r.isFile()?V7:r.isDirectory()?zo:r.isSymbolicLink()?ju:r.isCharacterDevice()?B7:r.isBlockDevice()?U7:r.isSocket()?G7:r.isFIFO()?j7:Ts,"entToType"),D7=new Eg({max:2**12}),xg=a(r=>{let e=D7.get(r);if(e)return e;let t=r.normalize("NFKD");return D7.set(r,t),t},"normalize"),N7=new Eg({max:2**12}),dE=a(r=>{let e=N7.get(r);if(e)return e;let t=xg(r.toLowerCase());return N7.set(r,t),t},"normalizeNocase"),hE=class extends Eg{static{a(this,"ResolveCache")}constructor(){super({max:256})}},$P=class extends Eg{static{a(this,"ChildrenCache")}constructor(e=16*1024){super({maxSize:e,sizeCalculation:a(t=>t.length+1,"sizeCalculation")})}},q7=Symbol("PathScurry setAsCwd"),ei=class{static{a(this,"PathBase")}name;root;roots;parent;nocase;isCWD=!1;#t;#r;get dev(){return this.#r}#n;get mode(){return this.#n}#e;get nlink(){return this.#e}#i;get uid(){return this.#i}#a;get gid(){return this.#a}#p;get rdev(){return this.#p}#u;get blksize(){return this.#u}#c;get ino(){return this.#c}#f;get size(){return this.#f}#l;get blocks(){return this.#l}#d;get atimeMs(){return this.#d}#o;get mtimeMs(){return this.#o}#g;get ctimeMs(){return this.#g}#E;get birthtimeMs(){return this.#E}#b;get atime(){return this.#b}#S;get mtime(){return this.#S}#A;get ctime(){return this.#A}#y;get birthtime(){return this.#y}#v;#T;#m;#_;#w;#R;#s;#O;#x;#C;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(e,t=Ts,n,i,s,o,c){this.name=e,this.#v=s?dE(e):xg(e),this.#s=t&ySe,this.nocase=s,this.roots=i,this.root=n||this,this.#O=o,this.#m=c.fullpath,this.#w=c.relative,this.#R=c.relativePosix,this.parent=c.parent,this.parent?this.#t=this.parent.#t:this.#t=M7(c.fs)}depth(){return this.#T!==void 0?this.#T:this.parent?this.#T=this.parent.depth()+1:this.#T=0}childrenCache(){return this.#O}resolve(e){if(!e)return this;let t=this.getRootString(e),i=e.substring(t.length).split(this.splitSep);return t?this.getRoot(t).#L(i):this.#L(i)}#L(e){let t=this;for(let n of e)t=t.child(n);return t}children(){let e=this.#O.get(this);if(e)return e;let t=Object.assign([],{provisional:0});return this.#O.set(this,t),this.#s&=~kP,t}child(e,t){if(e===""||e===".")return this;if(e==="..")return this.parent||this;let n=this.children(),i=this.nocase?dE(e):xg(e);for(let l of n)if(l.#v===i)return l;let s=this.parent?this.sep:"",o=this.#m?this.#m+s+e:void 0,c=this.newChild(e,Ts,{...t,parent:this,fullpath:o});return this.canReaddir()||(c.#s|=oo),n.push(c),c}relative(){if(this.isCWD)return"";if(this.#w!==void 0)return this.#w;let e=this.name,t=this.parent;if(!t)return this.#w=this.name;let n=t.relative();return n+(!n||!t.parent?"":this.sep)+e}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#R!==void 0)return this.#R;let e=this.name,t=this.parent;if(!t)return this.#R=this.fullpathPosix();let n=t.relativePosix();return n+(!n||!t.parent?"":"/")+e}fullpath(){if(this.#m!==void 0)return this.#m;let e=this.name,t=this.parent;if(!t)return this.#m=this.name;let i=t.fullpath()+(t.parent?this.sep:"")+e;return this.#m=i}fullpathPosix(){if(this.#_!==void 0)return this.#_;if(this.sep==="/")return this.#_=this.fullpath();if(!this.parent){let i=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(i)?this.#_=`//?/${i}`:this.#_=i}let e=this.parent,t=e.fullpathPosix(),n=t+(!t||!e.parent?"":"/")+this.name;return this.#_=n}isUnknown(){return(this.#s&vs)===Ts}isType(e){return this[`is${e}`]()}getType(){return this.isUnknown()?"Unknown":this.isDirectory()?"Directory":this.isFile()?"File":this.isSymbolicLink()?"SymbolicLink":this.isFIFO()?"FIFO":this.isCharacterDevice()?"CharacterDevice":this.isBlockDevice()?"BlockDevice":this.isSocket()?"Socket":"Unknown"}isFile(){return(this.#s&vs)===V7}isDirectory(){return(this.#s&vs)===zo}isCharacterDevice(){return(this.#s&vs)===B7}isBlockDevice(){return(this.#s&vs)===U7}isFIFO(){return(this.#s&vs)===j7}isSocket(){return(this.#s&vs)===G7}isSymbolicLink(){return(this.#s&ju)===ju}lstatCached(){return this.#s&F7?this:void 0}readlinkCached(){return this.#x}realpathCached(){return this.#C}readdirCached(){let e=this.children();return e.slice(0,e.provisional)}canReadlink(){if(this.#x)return!0;if(!this.parent)return!1;let e=this.#s&vs;return!(e!==Ts&&e!==ju||this.#s&fE||this.#s&oo)}calledReaddir(){return!!(this.#s&kP)}isENOENT(){return!!(this.#s&oo)}isNamed(e){return this.nocase?this.#v===dE(e):this.#v===xg(e)}async readlink(){let e=this.#x;if(e)return e;if(this.canReadlink()&&this.parent)try{let t=await this.#t.promises.readlink(this.fullpath()),n=(await this.parent.realpath())?.resolve(t);if(n)return this.#x=n}catch(t){this.#F(t.code);return}}readlinkSync(){let e=this.#x;if(e)return e;if(this.canReadlink()&&this.parent)try{let t=this.#t.readlinkSync(this.fullpath()),n=this.parent.realpathSync()?.resolve(t);if(n)return this.#x=n}catch(t){this.#F(t.code);return}}#j(e){this.#s|=kP;for(let t=e.provisional;t<e.length;t++){let n=e[t];n&&n.#I()}}#I(){this.#s&oo||(this.#s=(this.#s|oo)&Rg,this.#q())}#q(){let e=this.children();e.provisional=0;for(let t of e)t.#I()}#N(){this.#s|=pE,this.#D()}#D(){if(this.#s&Og)return;let e=this.#s;(e&vs)===zo&&(e&=Rg),this.#s=e|Og,this.#q()}#B(e=""){e==="ENOTDIR"||e==="EPERM"?this.#D():e==="ENOENT"?this.#I():this.children().provisional=0}#P(e=""){e==="ENOTDIR"?this.parent.#D():e==="ENOENT"&&this.#I()}#F(e=""){let t=this.#s;t|=fE,e==="ENOENT"&&(t|=oo),(e==="EINVAL"||e==="UNKNOWN")&&(t&=Rg),this.#s=t,e==="ENOTDIR"&&this.parent&&this.parent.#D()}#U(e,t){return this.#G(e,t)||this.#k(e,t)}#k(e,t){let n=MP(e),i=this.newChild(e.name,n,{parent:this}),s=i.#s&vs;return s!==zo&&s!==ju&&s!==Ts&&(i.#s|=Og),t.unshift(i),t.provisional++,i}#G(e,t){for(let n=t.provisional;n<t.length;n++){let i=t[n];if((this.nocase?dE(e.name):xg(e.name))===i.#v)return this.#Y(e,i,n,t)}}#Y(e,t,n,i){let s=t.name;return t.#s=t.#s&Rg|MP(e),s!==e.name&&(t.name=e.name),n!==i.provisional&&(n===i.length-1?i.pop():i.splice(n,1),i.unshift(t)),i.provisional++,t}async lstat(){if((this.#s&oo)===0)try{return this.#W(await this.#t.promises.lstat(this.fullpath())),this}catch(e){this.#P(e.code)}}lstatSync(){if((this.#s&oo)===0)try{return this.#W(this.#t.lstatSync(this.fullpath())),this}catch(e){this.#P(e.code)}}#W(e){let{atime:t,atimeMs:n,birthtime:i,birthtimeMs:s,blksize:o,blocks:c,ctime:l,ctimeMs:u,dev:f,gid:d,ino:p,mode:h,mtime:g,mtimeMs:m,nlink:_,rdev:b,size:w,uid:v}=e;this.#b=t,this.#d=n,this.#y=i,this.#E=s,this.#u=o,this.#l=c,this.#A=l,this.#g=u,this.#r=f,this.#a=d,this.#c=p,this.#n=h,this.#S=g,this.#o=m,this.#e=_,this.#p=b,this.#f=w,this.#i=v;let E=MP(e);this.#s=this.#s&Rg|E|F7,E!==Ts&&E!==zo&&E!==ju&&(this.#s|=Og)}#M=[];#h=!1;#K(e){this.#h=!1;let t=this.#M.slice();this.#M.length=0,t.forEach(n=>n(null,e))}readdirCB(e,t=!1){if(!this.canReaddir()){t?e(null,[]):queueMicrotask(()=>e(null,[]));return}let n=this.children();if(this.calledReaddir()){let s=n.slice(0,n.provisional);t?e(null,s):queueMicrotask(()=>e(null,s));return}if(this.#M.push(e),this.#h)return;this.#h=!0;let i=this.fullpath();this.#t.readdir(i,{withFileTypes:!0},(s,o)=>{if(s)this.#B(s.code),n.provisional=0;else{for(let c of o)this.#U(c,n);this.#j(n)}this.#K(n.slice(0,n.provisional))})}#V;async readdir(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let t=this.fullpath();if(this.#V)await this.#V;else{let n=a(()=>{},"resolve");this.#V=new Promise(i=>n=i);try{for(let i of await this.#t.promises.readdir(t,{withFileTypes:!0}))this.#U(i,e);this.#j(e)}catch(i){this.#B(i.code),e.provisional=0}this.#V=void 0,n()}return e.slice(0,e.provisional)}readdirSync(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let t=this.fullpath();try{for(let n of this.#t.readdirSync(t,{withFileTypes:!0}))this.#U(n,e);this.#j(e)}catch(n){this.#B(n.code),e.provisional=0}return e.slice(0,e.provisional)}canReaddir(){if(this.#s&L7)return!1;let e=vs&this.#s;return e===Ts||e===zo||e===ju}shouldWalk(e,t){return(this.#s&zo)===zo&&!(this.#s&L7)&&!e.has(this)&&(!t||t(this))}async realpath(){if(this.#C)return this.#C;if(!((pE|fE|oo)&this.#s))try{let e=await this.#t.promises.realpath(this.fullpath());return this.#C=this.resolve(e)}catch{this.#N()}}realpathSync(){if(this.#C)return this.#C;if(!((pE|fE|oo)&this.#s))try{let e=this.#t.realpathSync(this.fullpath());return this.#C=this.resolve(e)}catch{this.#N()}}[q7](e){if(e===this)return;e.isCWD=!1,this.isCWD=!0;let t=new Set([]),n=[],i=this;for(;i&&i.parent;)t.add(i),i.#w=n.join(this.sep),i.#R=n.join("/"),i=i.parent,n.push("..");for(i=e;i&&i.parent&&!t.has(i);)i.#w=void 0,i.#R=void 0,i=i.parent}},mE=class r extends ei{static{a(this,"PathWin32")}sep="\\";splitSep=gSe;constructor(e,t=Ts,n,i,s,o,c){super(e,t,n,i,s,o,c)}newChild(e,t=Ts,n={}){return new r(e,t,this.root,this.roots,this.nocase,this.childrenCache(),n)}getRootString(e){return _p.win32.parse(e).root}getRoot(e){if(e=mSe(e.toUpperCase()),e===this.root.name)return this.root;for(let[t,n]of Object.entries(this.roots))if(this.sameRoot(e,t))return this.roots[e]=n;return this.roots[e]=new bp(e,this).root}sameRoot(e,t=this.root.name){return e=e.toUpperCase().replace(/\//g,"\\").replace($7,"$1\\"),e===t}},gE=class r extends ei{static{a(this,"PathPosix")}splitSep="/";sep="/";constructor(e,t=Ts,n,i,s,o,c){super(e,t,n,i,s,o,c)}getRootString(e){return e.startsWith("/")?"/":""}getRoot(e){return this.root}newChild(e,t=Ts,n={}){return new r(e,t,this.root,this.roots,this.nocase,this.childrenCache(),n)}},yE=class{static{a(this,"PathScurryBase")}root;rootPath;roots;cwd;#t;#r;#n;nocase;#e;constructor(e=process.cwd(),t,n,{nocase:i,childrenCacheSize:s=16*1024,fs:o=Cg}={}){this.#e=M7(o),(e instanceof URL||e.startsWith("file://"))&&(e=(0,k7.fileURLToPath)(e));let c=t.resolve(e);this.roots=Object.create(null),this.rootPath=this.parseRootPath(c),this.#t=new hE,this.#r=new hE,this.#n=new $P(s);let l=c.substring(this.rootPath.length).split(n);if(l.length===1&&!l[0]&&l.pop(),i===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=i,this.root=this.newRoot(this.#e),this.roots[this.rootPath]=this.root;let u=this.root,f=l.length-1,d=t.sep,p=this.rootPath,h=!1;for(let g of l){let m=f--;u=u.child(g,{relative:new Array(m).fill("..").join(d),relativePosix:new Array(m).fill("..").join("/"),fullpath:p+=(h?"":d)+g}),h=!0}this.cwd=u}depth(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.depth()}childrenCache(){return this.#n}resolve(...e){let t="";for(let s=e.length-1;s>=0;s--){let o=e[s];if(!(!o||o===".")&&(t=t?`${o}/${t}`:o,this.isAbsolute(o)))break}let n=this.#t.get(t);if(n!==void 0)return n;let i=this.cwd.resolve(t).fullpath();return this.#t.set(t,i),i}resolvePosix(...e){let t="";for(let s=e.length-1;s>=0;s--){let o=e[s];if(!(!o||o===".")&&(t=t?`${o}/${t}`:o,this.isAbsolute(o)))break}let n=this.#r.get(t);if(n!==void 0)return n;let i=this.cwd.resolve(t).fullpathPosix();return this.#r.set(t,i),i}relative(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.relative()}relativePosix(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.relativePosix()}basename(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.name}dirname(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),(e.parent||e).fullpath()}async readdir(e=this.cwd,t={withFileTypes:!0}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof ei||(t=e,e=this.cwd);let{withFileTypes:n}=t;if(e.canReaddir()){let i=await e.readdir();return n?i:i.map(s=>s.name)}else return[]}readdirSync(e=this.cwd,t={withFileTypes:!0}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof ei||(t=e,e=this.cwd);let{withFileTypes:n=!0}=t;return e.canReaddir()?n?e.readdirSync():e.readdirSync().map(i=>i.name):[]}async lstat(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.lstat()}lstatSync(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.lstatSync()}async readlink(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof ei||(t=e.withFileTypes,e=this.cwd);let n=await e.readlink();return t?n:n?.fullpath()}readlinkSync(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof ei||(t=e.withFileTypes,e=this.cwd);let n=e.readlinkSync();return t?n:n?.fullpath()}async realpath(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof ei||(t=e.withFileTypes,e=this.cwd);let n=await e.realpath();return t?n:n?.fullpath()}realpathSync(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof ei||(t=e.withFileTypes,e=this.cwd);let n=e.realpathSync();return t?n:n?.fullpath()}async walk(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof ei||(t=e,e=this.cwd);let{withFileTypes:n=!0,follow:i=!1,filter:s,walkFilter:o}=t,c=[];(!s||s(e))&&c.push(n?e:e.fullpath());let l=new Set,u=a((d,p)=>{l.add(d),d.readdirCB((h,g)=>{if(h)return p(h);let m=g.length;if(!m)return p();let _=a(()=>{--m===0&&p()},"next");for(let b of g)(!s||s(b))&&c.push(n?b:b.fullpath()),i&&b.isSymbolicLink()?b.realpath().then(w=>w?.isUnknown()?w.lstat():w).then(w=>w?.shouldWalk(l,o)?u(w,_):_()):b.shouldWalk(l,o)?u(b,_):_()},!0)},"walk"),f=e;return new Promise((d,p)=>{u(f,h=>{if(h)return p(h);d(c)})})}walkSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof ei||(t=e,e=this.cwd);let{withFileTypes:n=!0,follow:i=!1,filter:s,walkFilter:o}=t,c=[];(!s||s(e))&&c.push(n?e:e.fullpath());let l=new Set([e]);for(let u of l){let f=u.readdirSync();for(let d of f){(!s||s(d))&&c.push(n?d:d.fullpath());let p=d;if(d.isSymbolicLink()){if(!(i&&(p=d.realpathSync())))continue;p.isUnknown()&&p.lstatSync()}p.shouldWalk(l,o)&&l.add(p)}}return c}[Symbol.asyncIterator](){return this.iterate()}iterate(e=this.cwd,t={}){return typeof e=="string"?e=this.cwd.resolve(e):e instanceof ei||(t=e,e=this.cwd),this.stream(e,t)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof ei||(t=e,e=this.cwd);let{withFileTypes:n=!0,follow:i=!1,filter:s,walkFilter:o}=t;(!s||s(e))&&(yield n?e:e.fullpath());let c=new Set([e]);for(let l of c){let u=l.readdirSync();for(let f of u){(!s||s(f))&&(yield n?f:f.fullpath());let d=f;if(f.isSymbolicLink()){if(!(i&&(d=f.realpathSync())))continue;d.isUnknown()&&d.lstatSync()}d.shouldWalk(c,o)&&c.add(d)}}}stream(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof ei||(t=e,e=this.cwd);let{withFileTypes:n=!0,follow:i=!1,filter:s,walkFilter:o}=t,c=new ul({objectMode:!0});(!s||s(e))&&c.write(n?e:e.fullpath());let l=new Set,u=[e],f=0,d=a(()=>{let p=!1;for(;!p;){let h=u.shift();if(!h){f===0&&c.end();return}f++,l.add(h);let g=a((_,b,w=!1)=>{if(_)return c.emit("error",_);if(i&&!w){let v=[];for(let E of b)E.isSymbolicLink()&&v.push(E.realpath().then(S=>S?.isUnknown()?S.lstat():S));if(v.length){Promise.all(v).then(()=>g(null,b,!0));return}}for(let v of b)v&&(!s||s(v))&&(c.write(n?v:v.fullpath())||(p=!0));f--;for(let v of b){let E=v.realpathCached()||v;E.shouldWalk(l,o)&&u.push(E)}p&&!c.flowing?c.once("drain",d):m||d()},"onReaddir"),m=!0;h.readdirCB(g,!0),m=!1}},"process");return d(),c}streamSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof ei||(t=e,e=this.cwd);let{withFileTypes:n=!0,follow:i=!1,filter:s,walkFilter:o}=t,c=new ul({objectMode:!0}),l=new Set;(!s||s(e))&&c.write(n?e:e.fullpath());let u=[e],f=0,d=a(()=>{let p=!1;for(;!p;){let h=u.shift();if(!h){f===0&&c.end();return}f++,l.add(h);let g=h.readdirSync();for(let m of g)(!s||s(m))&&(c.write(n?m:m.fullpath())||(p=!0));f--;for(let m of g){let _=m;if(m.isSymbolicLink()){if(!(i&&(_=m.realpathSync())))continue;_.isUnknown()&&_.lstatSync()}_.shouldWalk(l,o)&&u.push(_)}}p&&!c.flowing&&c.once("drain",d)},"process");return d(),c}chdir(e=this.cwd){let t=this.cwd;this.cwd=typeof e=="string"?this.cwd.resolve(e):e,this.cwd[q7](t)}},bp=class extends yE{static{a(this,"PathScurryWin32")}sep="\\";constructor(e=process.cwd(),t={}){let{nocase:n=!0}=t;super(e,_p.win32,"\\",{...t,nocase:n}),this.nocase=n;for(let i=this.cwd;i;i=i.parent)i.nocase=this.nocase}parseRootPath(e){return _p.win32.parse(e).root.toUpperCase()}newRoot(e){return new mE(this.rootPath,zo,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(e)}},Sp=class extends yE{static{a(this,"PathScurryPosix")}sep="/";constructor(e=process.cwd(),t={}){let{nocase:n=!1}=t;super(e,_p.posix,"/",{...t,nocase:n}),this.nocase=n}parseRootPath(e){return"/"}newRoot(e){return new gE(this.rootPath,zo,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")}},Pg=class extends Sp{static{a(this,"PathScurryDarwin")}constructor(e=process.cwd(),t={}){let{nocase:n=!0}=t;super(e,{...t,nocase:n})}},bBe=process.platform==="win32"?mE:gE,W7=process.platform==="win32"?bp:process.platform==="darwin"?Pg:Sp});var _Se,bSe,wp,jP=Be(()=>{al();_Se=a(r=>r.length>=1,"isPatternList"),bSe=a(r=>r.length>=1,"isGlobList"),wp=class r{static{a(this,"Pattern")}#t;#r;#n;length;#e;#i;#a;#p;#u;#c;#f=!0;constructor(e,t,n,i){if(!_Se(e))throw new TypeError("empty pattern list");if(!bSe(t))throw new TypeError("empty glob list");if(t.length!==e.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=e.length,n<0||n>=this.length)throw new TypeError("index out of range");if(this.#t=e,this.#r=t,this.#n=n,this.#e=i,this.#n===0){if(this.isUNC()){let[s,o,c,l,...u]=this.#t,[f,d,p,h,...g]=this.#r;u[0]===""&&(u.shift(),g.shift());let m=[s,o,c,l,""].join("/"),_=[f,d,p,h,""].join("/");this.#t=[m,...u],this.#r=[_,...g],this.length=this.#t.length}else if(this.isDrive()||this.isAbsolute()){let[s,...o]=this.#t,[c,...l]=this.#r;o[0]===""&&(o.shift(),l.shift());let u=s+"/",f=c+"/";this.#t=[u,...o],this.#r=[f,...l],this.length=this.#t.length}}}pattern(){return this.#t[this.#n]}isString(){return typeof this.#t[this.#n]=="string"}isGlobstar(){return this.#t[this.#n]===Fr}isRegExp(){return this.#t[this.#n]instanceof RegExp}globString(){return this.#a=this.#a||(this.#n===0?this.isAbsolute()?this.#r[0]+this.#r.slice(1).join("/"):this.#r.join("/"):this.#r.slice(this.#n).join("/"))}hasMore(){return this.length>this.#n+1}rest(){return this.#i!==void 0?this.#i:this.hasMore()?(this.#i=new r(this.#t,this.#r,this.#n+1,this.#e),this.#i.#c=this.#c,this.#i.#u=this.#u,this.#i.#p=this.#p,this.#i):this.#i=null}isUNC(){let e=this.#t;return this.#u!==void 0?this.#u:this.#u=this.#e==="win32"&&this.#n===0&&e[0]===""&&e[1]===""&&typeof e[2]=="string"&&!!e[2]&&typeof e[3]=="string"&&!!e[3]}isDrive(){let e=this.#t;return this.#p!==void 0?this.#p:this.#p=this.#e==="win32"&&this.#n===0&&this.length>1&&typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0])}isAbsolute(){let e=this.#t;return this.#c!==void 0?this.#c:this.#c=e[0]===""&&e.length>1||this.isDrive()||this.isUNC()}root(){let e=this.#t[0];return typeof e=="string"&&this.isAbsolute()&&this.#n===0?e:""}checkFollowGlobstar(){return!(this.#n===0||!this.isGlobstar()||!this.#f)}markFollowGlobstar(){return this.#n===0||!this.isGlobstar()||!this.#f?!1:(this.#f=!1,!0)}}});var SSe,Ep,BP=Be(()=>{al();jP();SSe=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Ep=class{static{a(this,"Ignore")}relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(e,{nobrace:t,nocase:n,noext:i,noglobstar:s,platform:o=SSe}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=o,this.mmopts={dot:!0,nobrace:t,nocase:n,noext:i,noglobstar:s,optimizationLevel:2,platform:o,nocomment:!0,nonegate:!0};for(let c of e)this.add(c)}add(e){let t=new ts(e,this.mmopts);for(let n=0;n<t.set.length;n++){let i=t.set[n],s=t.globParts[n];if(!i||!s)throw new Error("invalid pattern object");for(;i[0]==="."&&s[0]===".";)i.shift(),s.shift();let o=new wp(i,s,0,this.platform),c=new ts(o.globString(),this.mmopts),l=s[s.length-1]==="**",u=o.isAbsolute();u?this.absolute.push(c):this.relative.push(c),l&&(u?this.absoluteChildren.push(c):this.relativeChildren.push(c))}}ignored(e){let t=e.fullpath(),n=`${t}/`,i=e.relative()||".",s=`${i}/`;for(let o of this.relative)if(o.match(i)||o.match(s))return!0;for(let o of this.absolute)if(o.match(t)||o.match(n))return!0;return!1}childrenIgnored(e){let t=e.fullpath()+"/",n=(e.relative()||".")+"/";for(let i of this.relativeChildren)if(i.match(n))return!0;for(let i of this.absoluteChildren)if(i.match(t))return!0;return!1}}});var UP,VP,GP,Fg,z7=Be(()=>{al();UP=class r{static{a(this,"HasWalkedCache")}store;constructor(e=new Map){this.store=e}copy(){return new r(new Map(this.store))}hasWalked(e,t){return this.store.get(e.fullpath())?.has(t.globString())}storeWalked(e,t){let n=e.fullpath(),i=this.store.get(n);i?i.add(t.globString()):this.store.set(n,new Set([t.globString()]))}},VP=class{static{a(this,"MatchRecord")}store=new Map;add(e,t,n){let i=(t?2:0)|(n?1:0),s=this.store.get(e);this.store.set(e,s===void 0?i:i&s)}entries(){return[...this.store.entries()].map(([e,t])=>[e,!!(t&2),!!(t&1)])}},GP=class{static{a(this,"SubWalks")}store=new Map;add(e,t){if(!e.canReaddir())return;let n=this.store.get(e);n?n.find(i=>i.globString()===t.globString())||n.push(t):this.store.set(e,[t])}get(e){let t=this.store.get(e);if(!t)throw new Error("attempting to walk unknown path");return t}entries(){return this.keys().map(e=>[e,this.store.get(e)])}keys(){return[...this.store.keys()].filter(e=>e.canReaddir())}},Fg=class r{static{a(this,"Processor")}hasWalkedCache;matches=new VP;subwalks=new GP;patterns;follow;dot;opts;constructor(e,t){this.opts=e,this.follow=!!e.follow,this.dot=!!e.dot,this.hasWalkedCache=t?t.copy():new UP}processPatterns(e,t){this.patterns=t;let n=t.map(i=>[e,i]);for(let[i,s]of n){this.hasWalkedCache.storeWalked(i,s);let o=s.root(),c=s.isAbsolute()&&this.opts.absolute!==!1;if(o){i=i.resolve(o==="/"&&this.opts.root!==void 0?this.opts.root:o);let d=s.rest();if(d)s=d;else{this.matches.add(i,!0,!1);continue}}if(i.isENOENT())continue;let l,u,f=!1;for(;typeof(l=s.pattern())=="string"&&(u=s.rest());)i=i.resolve(l),s=u,f=!0;if(l=s.pattern(),u=s.rest(),f){if(this.hasWalkedCache.hasWalked(i,s))continue;this.hasWalkedCache.storeWalked(i,s)}if(typeof l=="string"){let d=l===".."||l===""||l===".";this.matches.add(i.resolve(l),c,d);continue}else if(l===Fr){(!i.isSymbolicLink()||this.follow||s.checkFollowGlobstar())&&this.subwalks.add(i,s);let d=u?.pattern(),p=u?.rest();if(!u||(d===""||d===".")&&!p)this.matches.add(i,c,d===""||d===".");else if(d===".."){let h=i.parent||i;p?this.hasWalkedCache.hasWalked(h,p)||this.subwalks.add(h,p):this.matches.add(h,c,!0)}}else l instanceof RegExp&&this.subwalks.add(i,s)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new r(this.opts,this.hasWalkedCache)}filterEntries(e,t){let n=this.subwalks.get(e),i=this.child();for(let s of t)for(let o of n){let c=o.isAbsolute(),l=o.pattern(),u=o.rest();l===Fr?i.testGlobstar(s,o,u,c):l instanceof RegExp?i.testRegExp(s,l,u,c):i.testString(s,l,u,c)}return i}testGlobstar(e,t,n,i){if((this.dot||!e.name.startsWith("."))&&(t.hasMore()||this.matches.add(e,i,!1),e.canReaddir()&&(this.follow||!e.isSymbolicLink()?this.subwalks.add(e,t):e.isSymbolicLink()&&(n&&t.checkFollowGlobstar()?this.subwalks.add(e,n):t.markFollowGlobstar()&&this.subwalks.add(e,t)))),n){let s=n.pattern();if(typeof s=="string"&&s!==".."&&s!==""&&s!==".")this.testString(e,s,n.rest(),i);else if(s===".."){let o=e.parent||e;this.subwalks.add(o,n)}else s instanceof RegExp&&this.testRegExp(e,s,n.rest(),i)}}testRegExp(e,t,n,i){t.test(e.name)&&(n?this.subwalks.add(e,n):this.matches.add(e,i,!1))}testString(e,t,n,i){e.isNamed(t)&&(n?this.subwalks.add(e,n):this.matches.add(e,i,!1))}}});var wSe,_E,Lg,Dg,H7=Be(()=>{NP();BP();z7();wSe=a((r,e)=>typeof r=="string"?new Ep([r],e):Array.isArray(r)?new Ep(r,e):r,"makeIgnore"),_E=class{static{a(this,"GlobUtil")}path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#t=[];#r;#n;signal;maxDepth;includeChildMatches;constructor(e,t,n){if(this.patterns=e,this.path=t,this.opts=n,this.#n=!n.posix&&n.platform==="win32"?"\\":"/",this.includeChildMatches=n.includeChildMatches!==!1,(n.ignore||!this.includeChildMatches)&&(this.#r=wSe(n.ignore??[],n),!this.includeChildMatches&&typeof this.#r.add!="function")){let i="cannot ignore child matches, ignore lacks add() method.";throw new Error(i)}this.maxDepth=n.maxDepth||1/0,n.signal&&(this.signal=n.signal,this.signal.addEventListener("abort",()=>{this.#t.length=0}))}#e(e){return this.seen.has(e)||!!this.#r?.ignored?.(e)}#i(e){return!!this.#r?.childrenIgnored?.(e)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let e;for(;!this.paused&&(e=this.#t.shift());)e()}onResume(e){this.signal?.aborted||(this.paused?this.#t.push(e):e())}async matchCheck(e,t){if(t&&this.opts.nodir)return;let n;if(this.opts.realpath){if(n=e.realpathCached()||await e.realpath(),!n)return;e=n}let s=e.isUnknown()||this.opts.stat?await e.lstat():e;if(this.opts.follow&&this.opts.nodir&&s?.isSymbolicLink()){let o=await s.realpath();o&&(o.isUnknown()||this.opts.stat)&&await o.lstat()}return this.matchCheckTest(s,t)}matchCheckTest(e,t){return e&&(this.maxDepth===1/0||e.depth()<=this.maxDepth)&&(!t||e.canReaddir())&&(!this.opts.nodir||!e.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!e.isSymbolicLink()||!e.realpathCached()?.isDirectory())&&!this.#e(e)?e:void 0}matchCheckSync(e,t){if(t&&this.opts.nodir)return;let n;if(this.opts.realpath){if(n=e.realpathCached()||e.realpathSync(),!n)return;e=n}let s=e.isUnknown()||this.opts.stat?e.lstatSync():e;if(this.opts.follow&&this.opts.nodir&&s?.isSymbolicLink()){let o=s.realpathSync();o&&(o?.isUnknown()||this.opts.stat)&&o.lstatSync()}return this.matchCheckTest(s,t)}matchFinish(e,t){if(this.#e(e))return;if(!this.includeChildMatches&&this.#r?.add){let s=`${e.relativePosix()}/**`;this.#r.add(s)}let n=this.opts.absolute===void 0?t:this.opts.absolute;this.seen.add(e);let i=this.opts.mark&&e.isDirectory()?this.#n:"";if(this.opts.withFileTypes)this.matchEmit(e);else if(n){let s=this.opts.posix?e.fullpathPosix():e.fullpath();this.matchEmit(s+i)}else{let s=this.opts.posix?e.relativePosix():e.relative(),o=this.opts.dotRelative&&!s.startsWith(".."+this.#n)?"."+this.#n:"";this.matchEmit(s?o+s+i:"."+i)}}async match(e,t,n){let i=await this.matchCheck(e,n);i&&this.matchFinish(i,t)}matchSync(e,t,n){let i=this.matchCheckSync(e,n);i&&this.matchFinish(i,t)}walkCB(e,t,n){this.signal?.aborted&&n(),this.walkCB2(e,t,new Fg(this.opts),n)}walkCB2(e,t,n,i){if(this.#i(e))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2(e,t,n,i));return}n.processPatterns(e,t);let s=1,o=a(()=>{--s===0&&i()},"next");for(let[c,l,u]of n.matches.entries())this.#e(c)||(s++,this.match(c,l,u).then(()=>o()));for(let c of n.subwalkTargets()){if(this.maxDepth!==1/0&&c.depth()>=this.maxDepth)continue;s++;let l=c.readdirCached();c.calledReaddir()?this.walkCB3(c,l,n,o):c.readdirCB((u,f)=>this.walkCB3(c,f,n,o),!0)}o()}walkCB3(e,t,n,i){n=n.filterEntries(e,t);let s=1,o=a(()=>{--s===0&&i()},"next");for(let[c,l,u]of n.matches.entries())this.#e(c)||(s++,this.match(c,l,u).then(()=>o()));for(let[c,l]of n.subwalks.entries())s++,this.walkCB2(c,l,n.child(),o);o()}walkCBSync(e,t,n){this.signal?.aborted&&n(),this.walkCB2Sync(e,t,new Fg(this.opts),n)}walkCB2Sync(e,t,n,i){if(this.#i(e))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2Sync(e,t,n,i));return}n.processPatterns(e,t);let s=1,o=a(()=>{--s===0&&i()},"next");for(let[c,l,u]of n.matches.entries())this.#e(c)||this.matchSync(c,l,u);for(let c of n.subwalkTargets()){if(this.maxDepth!==1/0&&c.depth()>=this.maxDepth)continue;s++;let l=c.readdirSync();this.walkCB3Sync(c,l,n,o)}o()}walkCB3Sync(e,t,n,i){n=n.filterEntries(e,t);let s=1,o=a(()=>{--s===0&&i()},"next");for(let[c,l,u]of n.matches.entries())this.#e(c)||this.matchSync(c,l,u);for(let[c,l]of n.subwalks.entries())s++,this.walkCB2Sync(c,l,n.child(),o);o()}},Lg=class extends _E{static{a(this,"GlobWalker")}matches=new Set;constructor(e,t,n){super(e,t,n)}matchEmit(e){this.matches.add(e)}async walk(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((e,t)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?t(this.signal.reason):e(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}},Dg=class extends _E{static{a(this,"GlobStream")}results;constructor(e,t,n){super(e,t,n),this.results=new ul({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(e){this.results.write(e),this.results.flowing||this.pause()}stream(){let e=this.path;return e.isUnknown()?e.lstat().then(()=>{this.walkCB(e,this.patterns,()=>this.results.end())}):this.walkCB(e,this.patterns,()=>this.results.end()),this.results}streamSync(){return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}}});var Y7,ESe,ao,qP=Be(()=>{al();Y7=require("node:url");K7();jP();H7();ESe=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",ao=class{static{a(this,"Glob")}absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(e,t){if(!t)throw new TypeError("glob options required");if(this.withFileTypes=!!t.withFileTypes,this.signal=t.signal,this.follow=!!t.follow,this.dot=!!t.dot,this.dotRelative=!!t.dotRelative,this.nodir=!!t.nodir,this.mark=!!t.mark,t.cwd?(t.cwd instanceof URL||t.cwd.startsWith("file://"))&&(t.cwd=(0,Y7.fileURLToPath)(t.cwd)):this.cwd="",this.cwd=t.cwd||"",this.root=t.root,this.magicalBraces=!!t.magicalBraces,this.nobrace=!!t.nobrace,this.noext=!!t.noext,this.realpath=!!t.realpath,this.absolute=t.absolute,this.includeChildMatches=t.includeChildMatches!==!1,this.noglobstar=!!t.noglobstar,this.matchBase=!!t.matchBase,this.maxDepth=typeof t.maxDepth=="number"?t.maxDepth:1/0,this.stat=!!t.stat,this.ignore=t.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof e=="string"&&(e=[e]),this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(e=e.map(l=>l.replace(/\\/g,"/"))),this.matchBase){if(t.noglobstar)throw new TypeError("base matching requires globstar");e=e.map(l=>l.includes("/")?l:`./**/${l}`)}if(this.pattern=e,this.platform=t.platform||ESe,this.opts={...t,platform:this.platform},t.scurry){if(this.scurry=t.scurry,t.nocase!==void 0&&t.nocase!==t.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let l=t.platform==="win32"?bp:t.platform==="darwin"?Pg:t.platform?Sp:W7;this.scurry=new l(this.cwd,{nocase:t.nocase,fs:t.fs})}this.nocase=this.scurry.nocase;let n=this.platform==="darwin"||this.platform==="win32",i={...t,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:n,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},s=this.pattern.map(l=>new ts(l,i)),[o,c]=s.reduce((l,u)=>(l[0].push(...u.set),l[1].push(...u.globParts),l),[[],[]]);this.patterns=o.map((l,u)=>{let f=c[u];if(!f)throw new Error("invalid pattern object");return new wp(l,f,0,this.platform)})}async walk(){return[...await new Lg(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()]}walkSync(){return[...new Lg(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()]}stream(){return new Dg(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new Dg(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}}});var WP,KP=Be(()=>{al();WP=a((r,e={})=>{Array.isArray(r)||(r=[r]);for(let t of r)if(new ts(t,e).hasMagic())return!0;return!1},"hasMagic")});function bE(r,e={}){return new ao(r,e).streamSync()}function X7(r,e={}){return new ao(r,e).stream()}function J7(r,e={}){return new ao(r,e).walkSync()}async function Q7(r,e={}){return new ao(r,e).walk()}function SE(r,e={}){return new ao(r,e).iterateSync()}function Z7(r,e={}){return new ao(r,e).iterate()}var vSe,TSe,ASe,ISe,RSe,vp,zP=Be(()=>{al();qP();KP();al();qP();KP();BP();a(bE,"globStreamSync");a(X7,"globStream");a(J7,"globSync");a(Q7,"glob_");a(SE,"globIterateSync");a(Z7,"globIterate");vSe=bE,TSe=Object.assign(X7,{sync:bE}),ASe=SE,ISe=Object.assign(Z7,{sync:SE}),RSe=Object.assign(J7,{stream:bE,iterate:SE}),vp=Object.assign(Q7,{glob:Q7,globSync:J7,sync:RSe,globStream:X7,stream:TSe,globStreamSync:bE,streamSync:vSe,globIterate:Z7,iterate:ISe,globIterateSync:SE,iterateSync:ASe,Glob:ao,hasMagic:WP,escape:mp,unescape:io});vp.glob=vp});async function tV(r,e,t,n={}){let{excludeRelPath:i}=n,s=Bu.default.join(r,"**/*.md"),o=await vp(s,{nodir:!0,ignore:[Bu.default.join(r,".obsidian/**"),Bu.default.join(r,".trash/**"),Bu.default.join(r,"**/.obsidian/**"),Bu.default.join(r,"**/.trash/**")]}),c={filesScanned:0,filesModified:0,replacements:0,modifiedFiles:[]};for(let l of o){let u=Bu.default.relative(r,l);if(i&&u===i)continue;c.filesScanned+=1;let f;try{f=await HP.default.readFile(l,"utf-8")}catch{continue}let{updated:d,replacements:p}=CSe(f,e,t);p>0&&(c.filesModified+=1,c.replacements+=p,c.modifiedFiles.push(u),await HP.default.writeFile(l,d,"utf-8"))}return c}function CSe(r,e,t){let n=r.split(/(^```[\s\S]*?^```)/m),i=0;for(let s=0;s<n.length;s++){if(s%2===1)continue;let o=n[s],c=OSe(o,e,t);i+=c.replacements,n[s]=c.updated}return{updated:n.join(""),replacements:i}}function OSe(r,e,t){let n=r.split(/(`[^`\n]*`)/),i=0;for(let s=0;s<n.length;s++){if(s%2===1)continue;let o=xSe(n[s],e,t);i+=o.replacements,n[s]=o.updated}return{updated:n.join(""),replacements:i}}function xSe(r,e,t){let n=/(?<!!)\[\[([^\[\]\n|#^]+)((?:[#^][^\[\]\n|]*)?)(?:\|[^\[\]\n]*)?\]\]/g,i=0;return{updated:r.replace(n,(o,c,l)=>c.trim()!==e?o:(i+=1,`[[${t}${l}]]`)),replacements:i}}var HP,Bu,rV=Be(()=>{"use strict";HP=Y(Wo()),Bu=Y(require("path"));zP();a(tV,"rewriteInboundWikilinks");a(CSe,"rewriteContent");a(OSe,"rewriteProseSegment");a(xSe,"replaceWikilinks")});function wE(r,e){let t=Lt.default.relative(e,r);return t===""||t!==".."&&!t.startsWith(`..${Lt.default.sep}`)&&!Lt.default.isAbsolute(t)}var ar,Lt,co,PSe,tr,lo=Be(()=>{"use strict";ar=Y(Wo()),Lt=Y(require("path"));gg();co=Y(Pe());rV();PSe=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;a(wE,"isWithinPath");tr=class{constructor(e){this.rootPath=e;this.uuidIndex=null;this.basenameIndex=null;this.aliasIndex=null}static{a(this,"FileSystemVaultAdapter")}async read(e){let t=this.resolvePath(e.path);if(!await ar.default.pathExists(t))throw new Error(`File not found: ${e.path}`);return ar.default.readFile(t,"utf-8")}async create(e,t){let n=this.resolvePath(e);if(await ar.default.pathExists(n))throw new Error(`File already exists: ${e}`);return await ar.default.ensureDir(Lt.default.dirname(n)),await ar.default.writeFile(n,t,"utf-8"),this.createFileObject(e)}async modify(e,t){let n=this.resolvePath(e.path);if(!await ar.default.pathExists(n))throw new Error(`File not found: ${e.path}`);await ar.default.writeFile(n,t,"utf-8")}async delete(e){let t=this.resolvePath(e.path);if(!await ar.default.pathExists(t))throw new Error(`File not found: ${e.path}`);await ar.default.remove(t)}async exists(e){let t=this.resolvePath(e);return ar.default.pathExists(t)}getAbstractFileByPath(e){let t=this.resolvePath(e);try{let n=ar.default.statSync(t);if(n.isFile())return this.createFileObject(e);if(n.isDirectory())return this.createFolderObject(e)}catch{return null}return null}getAllFiles(){let e=[];return this.walkDirectory(this.rootPath,t=>{if(t.endsWith(".md")){let n=Lt.default.relative(this.rootPath,t);e.push(this.createFileObject(n))}}),e}getFrontmatter(e){try{let t=ar.default.readFileSync(this.resolvePath(e.path),"utf-8");return this.extractFrontmatter(t)}catch{return null}}getFrontmatterParseFailure(e){let t;try{t=ar.default.readFileSync(this.resolvePath(e.path),"utf-8")}catch{return null}let n=(0,co.matchFrontmatterBlock)(t)?.body;if(n===void 0)return null;let i=/^[ \t]*(#.*)?\r?$/;if(!n.split(`
441
441
  `).some(o=>!i.test(o))||this.extractFrontmatter(t)!==null)return null;try{return ol(n,{schema:mg}),{reason:"frontmatter is not a mapping with string keys"}}catch(o){return{reason:o instanceof Error?o.message.split(`
442
442
  `)[0]:String(o)}}}async updateFrontmatter(e,t){let n=await this.read(e),i=this.extractFrontmatter(n),s=(0,co.matchFrontmatterBlock)(n)?.body;if(i===null&&s!==void 0&&s.trim()!=="")throw new Error(`updateFrontmatter: frontmatter of ${e.path} is not parseable \u2014 refusing to patch (re-serialising would overwrite the unreadable block)`);let o=i??{},c=t({...o});co.FrontmatterService.applyPatch(o,c);let l=this.replaceFrontmatter(n,o);await this.modify(e,l)}async rename(e,t){let n=this.resolvePath(e.path),i=this.resolvePath(t);if(!await ar.default.pathExists(n))throw new Error(`File not found: ${e.path}`);await ar.default.ensureDir(Lt.default.dirname(i)),await ar.default.move(n,i)}async createFolder(e){let t=this.resolvePath(e);await ar.default.ensureDir(t)}getFirstLinkpathDest(e,t,n){let i=e.split("|")[0].trim();if(!i)return null;if(PSe.test(i)){this.uuidIndex===null&&this.buildUuidIndex();let u=i.toLowerCase(),f=this.uuidIndex.get(u);return f?this.createFileObject(f):null}let s=Lt.default.dirname(this.resolvePath(t)),o;if(Lt.default.isAbsolute(i)?o=this.resolvePath(i):o=Lt.default.resolve(s,i),i.endsWith(".md")||(o+=".md"),ar.default.existsSync(o)){let u=Lt.default.relative(this.rootPath,o);return this.createFileObject(u)}(this.basenameIndex===null||this.aliasIndex===null)&&this.buildLinkpathIndex();let c=i.toLowerCase(),l=this.basenameIndex.get(c);if(l)return this.createFileObject(l);if(n?.allowAliasFallback!==!1){let u=this.aliasIndex.get(c);if(u)return this.createFileObject(u)}return null}buildLinkpathIndex(){this.basenameIndex=new Map,this.aliasIndex=new Map,this.walkDirectory(this.rootPath,e=>{if(!e.endsWith(".md"))return;let t=Lt.default.relative(this.rootPath,e),n=Lt.default.basename(e,".md").toLowerCase();this.basenameIndex.has(n)||this.basenameIndex.set(n,t);let i;try{i=ar.default.readFileSync(e,"utf-8")}catch{return}let s=this.extractFrontmatter(i);if(!s)return;let o=s.aliases,c=Array.isArray(o)?o:typeof o=="string"?[o]:[];for(let l of c){if(typeof l!="string")continue;let u=l.trim().toLowerCase();u&&(this.aliasIndex.has(u)||this.aliasIndex.set(u,t))}})}buildUuidIndex(){this.uuidIndex=new Map,this.walkDirectory(this.rootPath,e=>{if(e.endsWith(".md")){let n=Lt.default.basename(e,".md").match(/^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/i);if(n){let i=n[1].toLowerCase(),s=Lt.default.relative(this.rootPath,e);this.uuidIndex.set(i,s)}}})}async process(e,t){let n=await this.read(e),i=t(n);return await this.modify(e,i),i}getDefaultNewFileParent(){return{path:"",name:""}}async updateLinks(e,t,n){let i=Lt.default.basename(t,".md");await tV(this.rootPath,n,i,{excludeRelPath:e})}resolvePath(e){if(Lt.default.isAbsolute(e))return e;let t=this.rootPath.replace(/[/\\]+$/,""),n=Lt.default.sep+e;return n===t||n.startsWith(t+Lt.default.sep)?n:Lt.default.join(this.rootPath,e)}createFileObject(e){let t=Lt.default.basename(e),n=Lt.default.basename(e,Lt.default.extname(e)),i=Lt.default.dirname(e);return{path:e,basename:n,name:t,parent:i!=="."?this.createFolderObject(i):null}}createFolderObject(e){return{path:e,name:Lt.default.basename(e)}}extractFrontmatter(e){let t=(0,co.matchFrontmatterBlock)(e);return t?(0,co.parseYamlFrontmatterTolerant)(t.body):null}replaceFrontmatter(e,t){let i=`---
443
443
  ${hp(t,{lineWidth:-1,noRefs:!0,quoteStyle:"double"}).trim()}
@@ -583,7 +583,7 @@ Find the real UID: find '${n}' -name '${i}*.md'
583
583
  Or pass --skip-wikilink-validation to create the reference anyway.`),this.name="ClassRefNotFoundError"}},nv=class{constructor(e){this.fsAdapter=e;this.cache=new Map}static{a(this,"ClassResolverService")}async resolve(e,t){if(this.isUUID(t))return t;let n=await this.getOrBuildIndex(e),i=n.get(t);if(!i){let s=Array.from(n.keys()).filter(o=>!this.isUUID(o));throw new eL(t,s)}return i}async listClasses(e){let t=await this.getOrBuildIndex(e);return Array.from(t.keys())}async getOrBuildIndex(e){if(this.cache.has(e))return this.cache.get(e);let t=await this.buildIndex(e);return this.cache.set(e,t),t}async buildIndex(e){let t=new Map,n=await this.fsAdapter.getMarkdownFiles(),i=[],s=new Set;for(let o of n)try{let c=await this.fsAdapter.getFileMetadata(o),l=this.getBasename(o),u=c.exo__Asset_uid;!u&&this.isUUID(l)&&(u=l);let f=u?String(u):void 0,d=c.exo__Asset_label,p=typeof d=="string"?d:void 0,h=c.exo__Instance_class,g=h?(Array.isArray(h)?h:[h]).map(m=>String(m)):[];i.push({basename:l,uid:f,label:p,classValues:g}),f&&(p==="exo__Class"||p==="ims__Class")&&s.add(f)}catch{continue}for(let o of i)o.uid&&this.isClassDefinition(o.classValues,s)&&(o.basename&&t.set(o.basename,o.uid),o.label&&o.label!==o.basename&&t.set(o.label,o.uid));return t}isClassDefinition(e,t){return e.some(n=>{if(n.includes("ims__Class")||n.includes("exo__Class"))return!0;for(let i of t)if(i&&n.includes(i))return!0;return!1})}getBasename(e){let t=e.split("/");return t[t.length-1].replace(/\.md$/,"")}isUUID(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)}};var $G=Y(Pe());var Hg=class extends Error{static{a(this,"WikilinkNotFoundError")}constructor(e,t){let n=t?`|${t}`:"";super(`Wikilink [[${e}${n}]] \u2014 file not found in vault`),this.name="WikilinkNotFoundError"}},iv=class extends Error{static{a(this,"CreatedByRefNotFoundError")}constructor(e,t){let n=e.slice(0,8);super(`Creator [[${e}]] not found in vault (--created-by ${e}) \u2014 exo__Asset_createdBy would be a dangling reference.
584
584
  An identity UID is 36 characters; a partially-remembered one lands here.
585
585
  Find the real UID: find '${t}' -name '${n}*.md'
586
- Or pass --skip-wikilink-validation to create the reference anyway.`),this.name="CreatedByRefNotFoundError"}},ml=class{constructor(e,t={}){this.fsAdapter=e;this.pendingUids=t.pendingUids??new Set}static{a(this,"WikilinkValidator")}static{this.WIKILINK_PATTERN=/\[\[([^\]|]+)(?:\|[^\]]*)?]]/g}async validatePropertyValues(e){for(let[,t]of Object.entries(e)){let n=Array.isArray(t)?t:[t];for(let i of n)await this.validateValue(i)}}async validateValue(e){let t=this.extractWikilinks(e);for(let n of t)await this.validateWikilink(n.uuid,n.label)}async targetExists(e){try{return await this.validateWikilink(e),!0}catch(t){if(t instanceof Hg)return!1;throw t}}extractWikilinks(e){let t=[],n=/\[\[([^\]|]+)(?:\|([^\]]*))?\]\]/g,i;for(;(i=n.exec(e))!==null;){let s=i[1].trim();(0,$G.isPosixBracketExpression)(s)||t.push({uuid:s,label:i[2]?.trim()})}return t}async validateWikilink(e,t){if(!this.looksLikeUUID(e)){if(!await this.fsAdapter.findFileByLinkpath(e))throw new Hg(e,t);return}if(this.pendingUids.has(e.toLowerCase())||await this.fsAdapter.findFileByUidFilename(e))return;if(!await this.fsAdapter.findFileByUID(e))throw new Hg(e,t)}looksLikeUUID(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)}};Cx();Uu();function tve(r,e){return r.length===e.length&&r.every((t,n)=>t===e[n])}a(tve,"sameRange");var gl=class r{constructor(e,t={}){this.vaultPath=e;this.cache=null;this.reported=new Set;this.warn=t.warn??(()=>{}),this.readFileImpl=t.readFile,this.scanFilter=t.scanFilter}static{a(this,"PropertyNameValidator")}static{this.KEY_SHAPE=new RegExp(`^(${As})__.+$`)}static{this.PROPERTY_METACLASS_UIDS=["38277bfa-d7f9-4a75-b856-b23276ab0db3","9a1cf31c-9d41-4ef3-9023-584a8d087d16","ae56ca4c-b610-42a4-a25d-058c23673296"]}static{this.PROPERTY_METACLASS_LABELS=["exo__Property","exo__ObjectProperty","exo__DatatypeProperty"]}static{this.CLASS_METACLASS_UID="8619c4fc-64f1-4869-b17e-e34186cacca9"}static{this.CLASS_METACLASS_LABEL="exo__Class"}async validate(e){let{names:t,prefixes:n}=await this.collect();if(t.size!==0)for(let i of e){let s=r.KEY_SHAPE.exec(i);if(!s||t.has(i))continue;let o=s[1],c=n.has(o)?o:void 0,l=r.suggest(i,t,c);throw new rg(i,l)}}async isUnknownName(e){let{names:t}=await this.collect();return t.size===0||!r.KEY_SHAPE.test(e)?!1:!t.has(e)}async collect(){if(this.cache)return this.cache;let{readdir:e,readFile:t}=await import("fs/promises"),n=this.readFileImpl??t,i=this.scanFilter?await this.scanFilter():void 0,s=[],o=[],c=a(async h=>{let g;try{g=await e(h,{withFileTypes:!0})}catch{return}g.sort((m,_)=>m.name<_.name?-1:m.name>_.name?1:0);for(let m of g){let _=`${h}/${m.name}`;if(m.isDirectory())await c(_);else if(m.isFile()&&m.name.endsWith(".md")){if(i&&!i(_))continue;let b;try{b=await n(_,"utf-8")}catch{continue}r.scan(b,s,o)}}},"walk");await c(this.vaultPath);let l=r.buildPropertyMetaclassClosure(s),u=new Set,f=new Set,d=new Map,p=new Map;for(let h of o){if(!h.classRefs.some(_=>l.has(_)))continue;u.add(h.name);let g=r.KEY_SHAPE.exec(h.name);if(g&&f.add(g[1]),h.range.length===0)continue;let m=d.get(h.name);m===void 0?d.set(h.name,h.range):!tve(m,h.range)&&!p.has(h.name)&&p.set(h.name,`[PropertyNameValidator] property ${h.name} is declared more than once with different exo__Property_range (${m.join(", ")} vs ${h.range.join(", ")}) \u2014 the first def in path order wins`)}return this.cache={names:u,prefixes:f,ranges:d,conflicts:p},this.cache}report(e,t){if(this.reported.has(t))return;let n=e.get(t);n!==void 0&&(this.reported.add(t),this.warn(n))}async declaredRange(e){let{ranges:t,conflicts:n}=await this.collect();return this.report(n,e),t.get(e)}async declaredRanges(e){let{ranges:t,conflicts:n}=await this.collect();if(e!==void 0)for(let i of e)this.report(n,i);return t}static scan(e,t,n){let i=r.parseFrontmatter(e);if(!i)return;let s=r.asArray(i.exo__Instance_class).flatMap(l=>r.refHalves(l));if(s.length===0)return;let o=r.cleanLabel(i.exo__Asset_label);if(s.some(l=>r.isClassMetaclass(l))){let l=i.exo__Asset_uid,u=typeof l=="string"?l.trim():null,f=r.asArray(i.exo__Class_superClass).flatMap(d=>r.refHalves(d));t.push({uid:u,label:o,superRefs:f});return}if(o===null||!r.KEY_SHAPE.test(o))return;let c=r.asArray(i.exo__Property_range).map(l=>l.replace(/^["']|["']$/g,"").trim()).filter(l=>l.length>0);n.push({classRefs:s,name:o,range:c})}static buildPropertyMetaclassClosure(e){let t=new Set([...r.PROPERTY_METACLASS_UIDS,...r.PROPERTY_METACLASS_LABELS]),n=!0;for(;n;){n=!1;for(let i of e)i.uid!==null&&t.has(i.uid)||i.label!==null&&t.has(i.label)||i.superRefs.some(o=>t.has(o))&&(i.uid!==null&&t.add(i.uid),i.label!==null&&t.add(i.label),n=!0)}return t}static isClassMetaclass(e){return e===r.CLASS_METACLASS_UID||e===r.CLASS_METACLASS_LABEL}static refHalves(e){let t=String(e).replace(/^["']|["']$/g,"").trim(),n=/\[\[([^\]]+)\]\]/.exec(t);return(n?n[1]:t).split("|").map(s=>s.trim()).filter(s=>s.length>0)}static cleanLabel(e){if(typeof e!="string")return null;let t=e.replace(/^["']|["']$/g,"").trim();return t.length>0?t:null}static asArray(e){return Array.isArray(e)?e.map(String):typeof e=="string"?[e]:[]}static parseFrontmatter(e){let t=/^---\r?\n([\s\S]*?)\r?\n---/.exec(e);if(!t)return null;let n={},i=t[1].split(/\r?\n/),s=null,o=null;for(let c of i){let l=/^ {2}- (.*)$/.exec(c);if(l){s&&o&&o.push(l[1].trim());continue}s&&o&&(n[s]=o,s=null,o=null);let u=/^([^:]+):\s*(.*)$/.exec(c);if(!u)continue;let f=u[1].trim(),d=u[2].trim();d===""?(s=f,o=[]):n[f]=d}return s&&o&&(n[s]=o),n}static suggest(e,t,n){let i=n?[...t].filter(o=>o.startsWith(`${n}__`)):[...t],s=Math.max(3,Math.floor(e.length*.4));return i.map(o=>({name:o,distance:r.levenshtein(e,o)})).filter(o=>o.distance<=s).sort((o,c)=>o.distance-c.distance||o.name.localeCompare(c.name)).slice(0,3).map(o=>o.name)}static levenshtein(e,t){let n=e.length,i=t.length;if(n===0)return i;if(i===0)return n;let s=Array.from({length:i+1},(c,l)=>l),o=new Array(i+1);for(let c=1;c<=n;c++){o[0]=c;for(let l=1;l<=i;l++){let u=e[c-1]===t[l-1]?0:1;o[l]=Math.min(s[l]+1,o[l-1]+1,s[l-1]+u)}[s,o]=[o,s]}return s[i]}};var jG="ems__Effort",rve="ems__EffortStatus",sv=class{constructor(e){this.fsAdapter=e;this.statusUidCache=new Map}static{a(this,"EffortStatusResolver")}async isStatusBearing(e){let t=new Set,n=[e];for(;n.length>0;){let i=n.shift();if(i===void 0)break;if(t.has(i))continue;if(t.add(i),i===jG)return!0;let s=await this.resolveClassFile(i);if(!s)continue;let o;try{o=await this.fsAdapter.getFileMetadata(s)}catch{continue}if(o.exo__Asset_label===jG)return!0;let c=o.exo__Class_superClass,l=Array.isArray(c)?c:c!=null?[c]:[];for(let u of l){let f=ive(String(u));f&&!t.has(f)&&n.push(f)}}return!1}async resolveStatusUid(e){let t=nve(e),n=this.statusUidCache.get(t);if(n!==void 0)return n;let i=null,s=await this.fsAdapter.findFilesByMetadata({exo__Asset_label:t});for(let o of s)try{let c=await this.fsAdapter.getFileMetadata(o);if(c.exo__Asset_uid){i=String(c.exo__Asset_uid);break}}catch{continue}return this.statusUidCache.set(t,i),i}async resolveClassFile(e){if(sve(e))return this.fsAdapter.findFileByUidFilename(e);let t=await this.fsAdapter.findFilesByMetadata({exo__Asset_label:e});return t.length>0?t[0]:null}};function nve(r){let e=r.trim();if(e.startsWith("ems__"))return e;let t=e.charAt(0).toUpperCase()+e.slice(1);return`${rve}${t}`}a(nve,"toStatusEnumLabel");function ive(r){return r.trim().replace(/^["']|["']$/g,"").replace(/^\[\[|\]\]$/g,"").split("|")[0].trim()||null}a(ive,"extractRef");function sve(r){return/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(r)}a(sve,"isUuid");wt();var BG=!1;function Jo(){if(!BG){BG=!0;for(let r of[process.stdout,process.stderr])r.on("error",e=>{if(e.code!=="EPIPE")throw e})}}a(Jo,"guardStdioAgainstClosedReader");or();Ft();var Fp=require("fs"),tL=require("path"),ov=Y(Pe());function Lp(r){(0,ov.registerOrderSpecLoader)(()=>{let e=ove(r);for(let t of e){let n=ave(t);if(n)return n}return null})}a(Lp,"registerOrderSpecFromVault");function ove(r){return[(0,tL.join)(r,"assetspaces","exo")]}a(ove,"collectCandidateDirs");function ave(r){if(!(0,Fp.existsSync)(r))return null;let e;try{e=(0,Fp.readdirSync)(r)}catch{return null}for(let t of e){if(!t.endsWith(".md"))continue;let n=(0,tL.join)(r,t),i;try{i=(0,Fp.readFileSync)(n,"utf-8")}catch{continue}let s=cve(i);if(s&&/^exo__FrontmatterOrderSpec_default:\s*true\b/m.test(s))return{head:UG(s,"exo__FrontmatterOrderSpec_head"),tail:UG(s,"exo__FrontmatterOrderSpec_tail"),middleStrategy:lve(s,"exo__FrontmatterOrderSpec_middleStrategy")??"alphabetical"}}return null}a(ave,"scanDirForDefault");function cve(r){return(0,ov.frontmatterBlockBody)(r)}a(cve,"extractFrontmatter");function lve(r,e){let t=new RegExp(`^${VG(e)}:\\s*(.+)$`,"m"),n=r.match(t);return n?n[1].trim():null}a(lve,"extractScalar");function UG(r,e){let t=new RegExp(`^${VG(e)}:\\s*\\n((?: -.*\\r?\\n?)+)`,"m"),n=r.match(t);return n?n[1].split(`
586
+ Or pass --skip-wikilink-validation to create the reference anyway.`),this.name="CreatedByRefNotFoundError"}},ml=class{constructor(e,t={}){this.fsAdapter=e;this.pendingUids=t.pendingUids??new Set}static{a(this,"WikilinkValidator")}static{this.WIKILINK_PATTERN=/\[\[([^\]|]+)(?:\|[^\]]*)?]]/g}async validatePropertyValues(e){for(let[,t]of Object.entries(e)){let n=Array.isArray(t)?t:[t];for(let i of n)await this.validateValue(i)}}async validateValue(e){let t=this.extractWikilinks(e);for(let n of t)await this.validateWikilink(n.uuid,n.label)}async targetExists(e){try{return await this.validateWikilink(e),!0}catch(t){if(t instanceof Hg)return!1;throw t}}extractWikilinks(e){let t=[],n=/\[\[([^\]|]+)(?:\|([^\]]*))?\]\]/g,i;for(;(i=n.exec(e))!==null;){let s=i[1].trim();(0,$G.isPosixBracketExpression)(s)||t.push({uuid:s,label:i[2]?.trim()})}return t}async validateWikilink(e,t){if(!this.looksLikeUUID(e)){if(!await this.fsAdapter.findFileByLinkpath(e))throw new Hg(e,t);return}if(this.pendingUids.has(e.toLowerCase())||await this.fsAdapter.findFileByUidFilename(e))return;if(!await this.fsAdapter.findFileByUID(e))throw new Hg(e,t)}looksLikeUUID(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)}};C2();Uu();function tve(r,e){return r.length===e.length&&r.every((t,n)=>t===e[n])}a(tve,"sameRange");var gl=class r{constructor(e,t={}){this.vaultPath=e;this.cache=null;this.reported=new Set;this.warn=t.warn??(()=>{}),this.readFileImpl=t.readFile,this.scanFilter=t.scanFilter}static{a(this,"PropertyNameValidator")}static{this.KEY_SHAPE=new RegExp(`^(${As})__.+$`)}static{this.PROPERTY_METACLASS_UIDS=["38277bfa-d7f9-4a75-b856-b23276ab0db3","9a1cf31c-9d41-4ef3-9023-584a8d087d16","ae56ca4c-b610-42a4-a25d-058c23673296"]}static{this.PROPERTY_METACLASS_LABELS=["exo__Property","exo__ObjectProperty","exo__DatatypeProperty"]}static{this.CLASS_METACLASS_UID="8619c4fc-64f1-4869-b17e-e34186cacca9"}static{this.CLASS_METACLASS_LABEL="exo__Class"}async validate(e){let{names:t,prefixes:n}=await this.collect();if(t.size!==0)for(let i of e){let s=r.KEY_SHAPE.exec(i);if(!s||t.has(i))continue;let o=s[1],c=n.has(o)?o:void 0,l=r.suggest(i,t,c);throw new rg(i,l)}}async isUnknownName(e){let{names:t}=await this.collect();return t.size===0||!r.KEY_SHAPE.test(e)?!1:!t.has(e)}async collect(){if(this.cache)return this.cache;let{readdir:e,readFile:t}=await import("fs/promises"),n=this.readFileImpl??t,i=this.scanFilter?await this.scanFilter():void 0,s=[],o=[],c=a(async h=>{let g;try{g=await e(h,{withFileTypes:!0})}catch{return}g.sort((m,_)=>m.name<_.name?-1:m.name>_.name?1:0);for(let m of g){let _=`${h}/${m.name}`;if(m.isDirectory())await c(_);else if(m.isFile()&&m.name.endsWith(".md")){if(i&&!i(_))continue;let b;try{b=await n(_,"utf-8")}catch{continue}r.scan(b,s,o)}}},"walk");await c(this.vaultPath);let l=r.buildPropertyMetaclassClosure(s),u=new Set,f=new Set,d=new Map,p=new Map;for(let h of o){if(!h.classRefs.some(_=>l.has(_)))continue;u.add(h.name);let g=r.KEY_SHAPE.exec(h.name);if(g&&f.add(g[1]),h.range.length===0)continue;let m=d.get(h.name);m===void 0?d.set(h.name,h.range):!tve(m,h.range)&&!p.has(h.name)&&p.set(h.name,`[PropertyNameValidator] property ${h.name} is declared more than once with different exo__Property_range (${m.join(", ")} vs ${h.range.join(", ")}) \u2014 the first def in path order wins`)}return this.cache={names:u,prefixes:f,ranges:d,conflicts:p},this.cache}report(e,t){if(this.reported.has(t))return;let n=e.get(t);n!==void 0&&(this.reported.add(t),this.warn(n))}async declaredRange(e){let{ranges:t,conflicts:n}=await this.collect();return this.report(n,e),t.get(e)}async declaredRanges(e){let{ranges:t,conflicts:n}=await this.collect();if(e!==void 0)for(let i of e)this.report(n,i);return t}static scan(e,t,n){let i=r.parseFrontmatter(e);if(!i)return;let s=r.asArray(i.exo__Instance_class).flatMap(l=>r.refHalves(l));if(s.length===0)return;let o=r.cleanLabel(i.exo__Asset_label);if(s.some(l=>r.isClassMetaclass(l))){let l=i.exo__Asset_uid,u=typeof l=="string"?l.trim():null,f=r.asArray(i.exo__Class_superClass).flatMap(d=>r.refHalves(d));t.push({uid:u,label:o,superRefs:f});return}if(o===null||!r.KEY_SHAPE.test(o))return;let c=r.asArray(i.exo__Property_range).map(l=>l.replace(/^["']|["']$/g,"").trim()).filter(l=>l.length>0);n.push({classRefs:s,name:o,range:c})}static buildPropertyMetaclassClosure(e){let t=new Set([...r.PROPERTY_METACLASS_UIDS,...r.PROPERTY_METACLASS_LABELS]),n=!0;for(;n;){n=!1;for(let i of e)i.uid!==null&&t.has(i.uid)||i.label!==null&&t.has(i.label)||i.superRefs.some(o=>t.has(o))&&(i.uid!==null&&t.add(i.uid),i.label!==null&&t.add(i.label),n=!0)}return t}static isClassMetaclass(e){return e===r.CLASS_METACLASS_UID||e===r.CLASS_METACLASS_LABEL}static refHalves(e){let t=String(e).replace(/^["']|["']$/g,"").trim(),n=/\[\[([^\]]+)\]\]/.exec(t);return(n?n[1]:t).split("|").map(s=>s.trim()).filter(s=>s.length>0)}static cleanLabel(e){if(typeof e!="string")return null;let t=e.replace(/^["']|["']$/g,"").trim();return t.length>0?t:null}static asArray(e){return Array.isArray(e)?e.map(String):typeof e=="string"?[e]:[]}static parseFrontmatter(e){let t=/^---\r?\n([\s\S]*?)\r?\n---/.exec(e);if(!t)return null;let n={},i=t[1].split(/\r?\n/),s=null,o=null;for(let c of i){let l=/^ {2}- (.*)$/.exec(c);if(l){s&&o&&o.push(l[1].trim());continue}s&&o&&(n[s]=o,s=null,o=null);let u=/^([^:]+):\s*(.*)$/.exec(c);if(!u)continue;let f=u[1].trim(),d=u[2].trim();d===""?(s=f,o=[]):n[f]=d}return s&&o&&(n[s]=o),n}static suggest(e,t,n){let i=n?[...t].filter(o=>o.startsWith(`${n}__`)):[...t],s=Math.max(3,Math.floor(e.length*.4));return i.map(o=>({name:o,distance:r.levenshtein(e,o)})).filter(o=>o.distance<=s).sort((o,c)=>o.distance-c.distance||o.name.localeCompare(c.name)).slice(0,3).map(o=>o.name)}static levenshtein(e,t){let n=e.length,i=t.length;if(n===0)return i;if(i===0)return n;let s=Array.from({length:i+1},(c,l)=>l),o=new Array(i+1);for(let c=1;c<=n;c++){o[0]=c;for(let l=1;l<=i;l++){let u=e[c-1]===t[l-1]?0:1;o[l]=Math.min(s[l]+1,o[l-1]+1,s[l-1]+u)}[s,o]=[o,s]}return s[i]}};var jG="ems__Effort",rve="ems__EffortStatus",sv=class{constructor(e){this.fsAdapter=e;this.statusUidCache=new Map}static{a(this,"EffortStatusResolver")}async isStatusBearing(e){let t=new Set,n=[e];for(;n.length>0;){let i=n.shift();if(i===void 0)break;if(t.has(i))continue;if(t.add(i),i===jG)return!0;let s=await this.resolveClassFile(i);if(!s)continue;let o;try{o=await this.fsAdapter.getFileMetadata(s)}catch{continue}if(o.exo__Asset_label===jG)return!0;let c=o.exo__Class_superClass,l=Array.isArray(c)?c:c!=null?[c]:[];for(let u of l){let f=ive(String(u));f&&!t.has(f)&&n.push(f)}}return!1}async resolveStatusUid(e){let t=nve(e),n=this.statusUidCache.get(t);if(n!==void 0)return n;let i=null,s=await this.fsAdapter.findFilesByMetadata({exo__Asset_label:t});for(let o of s)try{let c=await this.fsAdapter.getFileMetadata(o);if(c.exo__Asset_uid){i=String(c.exo__Asset_uid);break}}catch{continue}return this.statusUidCache.set(t,i),i}async resolveClassFile(e){if(sve(e))return this.fsAdapter.findFileByUidFilename(e);let t=await this.fsAdapter.findFilesByMetadata({exo__Asset_label:e});return t.length>0?t[0]:null}};function nve(r){let e=r.trim();if(e.startsWith("ems__"))return e;let t=e.charAt(0).toUpperCase()+e.slice(1);return`${rve}${t}`}a(nve,"toStatusEnumLabel");function ive(r){return r.trim().replace(/^["']|["']$/g,"").replace(/^\[\[|\]\]$/g,"").split("|")[0].trim()||null}a(ive,"extractRef");function sve(r){return/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(r)}a(sve,"isUuid");wt();var BG=!1;function Jo(){if(!BG){BG=!0;for(let r of[process.stdout,process.stderr])r.on("error",e=>{if(e.code!=="EPIPE")throw e})}}a(Jo,"guardStdioAgainstClosedReader");or();Ft();var Fp=require("fs"),tL=require("path"),ov=Y(Pe());function Lp(r){(0,ov.registerOrderSpecLoader)(()=>{let e=ove(r);for(let t of e){let n=ave(t);if(n)return n}return null})}a(Lp,"registerOrderSpecFromVault");function ove(r){return[(0,tL.join)(r,"assetspaces","exo")]}a(ove,"collectCandidateDirs");function ave(r){if(!(0,Fp.existsSync)(r))return null;let e;try{e=(0,Fp.readdirSync)(r)}catch{return null}for(let t of e){if(!t.endsWith(".md"))continue;let n=(0,tL.join)(r,t),i;try{i=(0,Fp.readFileSync)(n,"utf-8")}catch{continue}let s=cve(i);if(s&&/^exo__FrontmatterOrderSpec_default:\s*true\b/m.test(s))return{head:UG(s,"exo__FrontmatterOrderSpec_head"),tail:UG(s,"exo__FrontmatterOrderSpec_tail"),middleStrategy:lve(s,"exo__FrontmatterOrderSpec_middleStrategy")??"alphabetical"}}return null}a(ave,"scanDirForDefault");function cve(r){return(0,ov.frontmatterBlockBody)(r)}a(cve,"extractFrontmatter");function lve(r,e){let t=new RegExp(`^${VG(e)}:\\s*(.+)$`,"m"),n=r.match(t);return n?n[1].trim():null}a(lve,"extractScalar");function UG(r,e){let t=new RegExp(`^${VG(e)}:\\s*\\n((?: -.*\\r?\\n?)+)`,"m"),n=r.match(t);return n?n[1].split(`
587
587
  `).map(i=>i.trim()).filter(i=>i.startsWith("- ")).map(i=>i.slice(2).trim()):[]}a(UG,"extractList");function VG(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}a(VG,"escapeRegex");var Dp=Y(require("path")),nL=Y(Pe());async function go(r,e,t){let n=e.endsWith(".md")?e:`${e}.md`;if(e.includes("/")&&await r.fileExists(n))return n;let i=Dp.default.dirname(t),s=i!=="."?`${i}/${n}`:n;if(await r.fileExists(s))return s;let c=await r.findFileByUID(e);return c||(await r.getMarkdownFiles()).find(f=>{let d=Dp.default.basename(f,".md"),p=Dp.default.basename(n,".md");return d===p})||null}a(go,"findReferencedFile");function iL(r){return r.replace(/\\/g,"/").replace(/^\.\//,"").replace(/\/$/,"")}a(iL,"normalizePath");async function GG(r,e){let t=(0,nL.extractAssetReference)(e);if(!t||t.startsWith("!"))return null;let n=await go(r,t,"");return sL(n)}a(GG,"resolveCoLocationFolder");function sL(r){if(!r)return null;let e=Dp.default.dirname(r);return e==="."?"":e}a(sL,"coLocationFolderFromPath");function rL(r){let e=r;for(;Array.isArray(e);){if(e.length===0)return null;e=e[0]}return(0,nL.extractAssetReference)(e)}a(rL,"wikilinkTarget");async function qG(r,e,t,n){let i={sameAnchor:new Map,anyAnchor:new Map},s=new Set;if(e&&s.add(e),t&&s.add(t),s.size===0)return i;let o=rL(n),c=await r.getMarkdownFiles(),l=new Map,u=new Map;for(let f of c){let d;try{d=await r.getFileMetadata(f)}catch{continue}let p=d.exo__Instance_class;if(!(Array.isArray(p)?p:[p]).some(b=>{let w=rL(b);return w!==null&&s.has(w)}))continue;let m=Dp.default.dirname(f),_=m==="."?"":m;u.set(_,(u.get(_)??0)+1),rL(d.exo__Asset_isDefinedBy)===o&&l.set(_,(l.get(_)??0)+1)}return{sameAnchor:l,anyAnchor:u}}a(qG,"scanClassNeighbours");function WG(r){if(r.size===0)return null;let e=null,t=-1,n=Array.from(r.entries()).sort((i,s)=>i[0]<s[0]?-1:i[0]>s[0]?1:0);for(let[i,s]of n)s>t&&(e=i,t=s);return e}a(WG,"pickCanonicalHome");var uve=/^exo__Asset_uid\s*:\s*"?([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})"?\s*$/,fve=/^exo__Asset_createdAt\s*:\s*"?(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:?\d{2})?)"?\s*$/,dve=/^[A-Za-z_][A-Za-z0-9_]*\s*:(?:\s|$)/,pve=/^(?:exo__Asset_uid|exo__Asset_createdAt)\s*:(?:\s|$)/;function KG(r,e=0){for(let t=e;t<r.length;t+=1)if(r[t].trim()!=="")return t;return-1}a(KG,"firstNonEmpty");function hve(r){let e=r.split(`
588
588
  `),t=KG(e);if(t<0)return;let n=e[t].replace(/\r$/,""),i=pve.test(n)?t:void 0;if(i===void 0){if(n.trim()!=="---")return;let o=KG(e,t+1);if(o<0||!dve.test(e[o].replace(/\r$/,"")))return}let s=[];for(let o=i??t+1;o<e.length&&e[o].replace(/\r$/,"").trim()!=="---";o+=1)s.push(e[o]);return s}a(hve,"leadingFrontmatterBlock");function mve(r){let e=hve(r);if(e)for(let t of e){let n=t.replace(/\r$/,"");if(uve.test(n)||fve.test(n))return n.trim()}}a(mve,"detectFrontmatterCopy");function av(r,e){let t=mve(r);if(t)throw new Error(`The body starts with a COPY of a frontmatter block (${t}). ${e} writes the body ONLY \u2014 the frontmatter is preserved (set-body) or built from --class/--property (create), so a leading frontmatter block would be stored as text and leave the asset carrying two blocks. Pass the body WITHOUT its frontmatter (a file sliced with 'sed -n "/^---$/,$p"' starts at the FIRST '---' \u2014 slice after the SECOND one instead). A template body whose uid/createdAt are placeholders is accepted.`)}a(av,"assertNoFrontmatterCopy");var cL=Y(Pe());pt();var lv=require("fs"),zG=require("path"),aL=Y(Pe());var gve=new Set(["templates","09 templates"]);function vi(r){return r.split("/").some(e=>gve.has(e.toLowerCase()))}a(vi,"isTemplatesPath");function is(r){return r.split("/").includes("node_modules")}a(is,"isNodeModulesPath");wt();Ft();var uv="829b9b3b-6fc3-4276-be6a-27d3398c012e",yve=5;function oL(r){return Array.isArray(r)?r.find(t=>typeof t=="string")??null:typeof r=="string"?r:null}a(oL,"firstString");function cv(r){let e=r==null?[]:Array.isArray(r)?r:[r],t=[];for(let n of e){let i=n;for(;Array.isArray(i);)i=i[0];let s=(0,aL.extractAssetReference)(i);s&&t.push(s)}return t}a(cv,"asRefList");var _ve=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;async function bve(r){let e=new Nn(r),t=await e.indexedAssets(),n=new Map,i=new Map,s=new Map,o=new Map,c=new Map,l=new Map;for(let b of t){if(is(b.path)||vi(b.path))continue;let w=oL(b.metadata.exo__Asset_uid);if(w){n.has(w)||n.set(w,b.metadata);let E=oL(b.metadata.exo__Asset_label);E&&!i.has(E)&&i.set(E,w)}let v=cv(b.metadata.exo__Instance_class);if(w&&v.includes(uv)){s.set(b.path,w);let E=oL(b.metadata.exo__Asset_label)??b.path;o.has(w)||o.set(w,E)}}let u=a(b=>_ve.test(b)?b:i.get(b)??null,"resolveClassRefToUid");for(let b of t){if(is(b.path)||vi(b.path))continue;let w=s.get(b.path);if(!w)continue;let v=cv(b.metadata.exo__Ontology_admits);if(v.length===0)continue;let E=new Set;for(let S of v){let R=u(S);R&&E.add(R)}E.size>0&&(c.set(w,E),l.set(w,[...E]))}let f=new Map,d=a(b=>{let w=f.get(b);if(w)return w;let v=new Set,E=[b];for(;E.length>0;){let S=E.shift();if(v.has(S))continue;v.add(S);let R=n.get(S);if(R)for(let C of cv(R.exo__Class_superClass)){let P=u(C);P&&!v.has(P)&&E.push(P)}}return f.set(b,v),v},"classClosure"),p=[],h={"no-isDefinedBy":0,"ontology-unresolvable":0,"ontology-no-admits":0,"no-instance-class":0,"unresolvable-class":0},g={"no-isDefinedBy":[],"ontology-unresolvable":[],"ontology-no-admits":[],"no-instance-class":[],"unresolvable-class":[]},m=0,_=a((b,w)=>{h[b]++,g[b].length<yve&&g[b].push(w)},"skip");for(let b of t){if(is(b.path)||vi(b.path))continue;let w=(0,aL.extractAssetReference)(b.metadata.exo__Asset_isDefinedBy);if(!w||w.startsWith("!")){_("no-isDefinedBy",b.path);continue}let v=await go(e,w,b.path),E=v?s.get(v):void 0;if(!E){_("ontology-unresolvable",b.path);continue}let S=c.get(E);if(!S){_("ontology-no-admits",b.path);continue}let R=cv(b.metadata.exo__Instance_class);if(R.length===0){_("no-instance-class",b.path);continue}let C=R.map(u).filter(D=>D!==null);if(C.length===0){_("unresolvable-class",b.path);continue}m++,C.some(D=>{for(let F of d(D))if(S.has(F))return!0;return!1})||p.push({path:b.path,ontologyUid:E,ontologyLabel:o.get(E)??E,classUids:C,admits:l.get(E)??[...S]})}return{vaultPath:r,totalFiles:t.length,ontologies:s.size,ontologiesWithAdmits:c.size,checked:m,violations:p,skips:h,skipExamples:g}}a(bve,"scanVaultForOntologyMembership");function HG(){return new pe("ontology-membership").description("Detect ontology-membership violations: any asset whose exo__Instance_class (or a superClass ancestor) is not in its isDefinedBy ontology's exo__Ontology_admits allow-list (subsumption-aware superClass walk, dual-IRI-safe, fail-open when no allow-list is declared, skip-accounted)").requiredOption("--vault <path>","Vault root directory").option("--output <type>","Response format: text|json","text").action(async r=>{let e=r.output??"text";fe.setFormat(e);try{let t=(0,zG.resolve)(r.vault);if(!(0,lv.existsSync)(t)||!(0,lv.statSync)(t).isDirectory())throw new Ne(t);let n=await bve(t),i=Object.values(n.skips).reduce((s,o)=>s+o,0);if(e==="json")console.log(JSON.stringify({vaultPath:n.vaultPath,totalFiles:n.totalFiles,ontologies:n.ontologies,ontologiesWithAdmits:n.ontologiesWithAdmits,checked:n.checked,violationCount:n.violations.length,violations:n.violations,skips:n.skips,skipTotal:i,skipExamples:n.skipExamples,clean:n.violations.length===0},null,2));else{if(n.violations.length===0)console.log(`OK ${t}: 0 ontology-membership violations (${n.checked} checked; ${n.ontologiesWithAdmits}/${n.ontologies} ontologies declare exo__Ontology_admits)`);else{console.error(`FAIL ${t}: ${n.violations.length} ontology-membership violation(s) (${n.checked} checked; ${n.ontologiesWithAdmits}/${n.ontologies} ontologies declare exo__Ontology_admits):`);for(let s of n.violations)console.error(` ${s.path}
589
589
  isDefinedBy=${s.ontologyUid} (${s.ontologyLabel}) instance_class=[${s.classUids.join(", ")}] not in admits=[${s.admits.join(", ")}]`)}console.error(`
@@ -717,7 +717,7 @@ Next steps:
717
717
  `).map(n=>n.trim()).filter(n=>n.length>0),t=e[e.length-1];if(t!==void 0)try{return JSON.parse(t)}catch{return}}a(NAe,"parseLastJsonLine");function KW(r,e){return e.filter(t=>{let n=r[t];return typeof n!="string"||n.trim().length===0})}a(KW,"missingStringFields");var Kv=class{constructor(e){this.deps=e}static{a(this,"McpServer")}async handle(e){if(typeof e!="object"||e===null||Array.isArray(e))return{jsonrpc:"2.0",id:null,error:{code:WW,message:"Invalid request: expected a JSON-RPC object"}};let t=e.id,n=t===void 0;if(typeof e.method!="string")return n?null:{jsonrpc:"2.0",id:t??null,error:{code:WW,message:"Invalid request: missing method"}};if(n)return null;let i=t??null;switch(e.method){case"initialize":return{jsonrpc:"2.0",id:i,result:{protocolVersion:LAe,capabilities:{tools:{}},serverInfo:{name:"exocortex",version:this.deps.version}}};case"ping":return{jsonrpc:"2.0",id:i,result:{}};case"tools/list":return{jsonrpc:"2.0",id:i,result:{tools:qW}};case"tools/call":return{jsonrpc:"2.0",id:i,result:await this.callTool(e.params??{})};default:return{jsonrpc:"2.0",id:i,error:{code:DAe,message:`Method not found: ${e.method}`}}}}async callTool(e){let t=e.name,n=e.arguments??{},i;if(t==="create_asset"){let c=KW(n,["vault","class","label"]);if(c.length>0)return Qp(`create_asset: missing required argument(s): ${c.join(", ")}`,!0);let l=UW(n);if(l!==null)return Qp(`create_asset: ${l}`,!0);i=VW(n)}else if(t==="create_effort"){let c=KW(n,["vault","command","target"]);if(c.length>0)return Qp(`create_effort: missing required argument(s): ${c.join(", ")}`,!0);i=GW(n)}else return Qp(`Unknown tool: ${String(t)}`,!0);let s=await this.deps.runCli(i);if(s.exitCode!==0){let c=s.stderr.trim()||s.stdout.trim()||"(no diagnostic output)";return Qp(`exocortex-cli exited ${s.exitCode}
718
718
  ${c}`,!0)}let o=NAe(s.stdout);return Qp(o===void 0?s.stdout.trim():JSON.stringify(o))}};var YW=require("child_process");var kAe=32*1024*1024;function QW(r){return e=>new Promise(t=>{(0,YW.execFile)(process.execPath,[r,...e],{maxBuffer:kAe},(n,i,s)=>{let o=0;if(n){let c=n.code;o=typeof c=="number"?c:1}t({stdout:i,stderr:s,exitCode:o})})})}a(QW,"createSelfCliRunner");async function MAe(r,e,t){let n=(0,XW.createInterface)({input:e,crlfDelay:1/0});for await(let i of n){let s=i.trim();if(s.length===0)continue;let o;try{o=JSON.parse(s)}catch{t(JSON.stringify({jsonrpc:"2.0",id:null,error:{code:zW,message:"Parse error: invalid JSON"}})+`
719
719
  `);continue}let c;try{c=await r.handle(o)}catch(l){c={jsonrpc:"2.0",id:typeof o?.id=="string"||typeof o?.id=="number"?o.id:null,error:{code:HW,message:`Internal error: ${l instanceof Error?l.message:String(l)}`}}}c!==null&&t(JSON.stringify(c)+`
720
- `)}}a(MAe,"runStdioServer");function JW(r){return new pe("mcp").description("Run an MCP (Model Context Protocol) stdio server exposing create_asset / create_effort tools backed by this CLI").option("--entry <path>","Path to the CLI entry script the tools invoke (defaults to this process's script)").action(async e=>{let t=e.entry??process.argv[1],n=new Kv({runCli:QW(t),version:r??"unknown"});await MAe(n,process.stdin,i=>process.stdout.write(i))})}a(JW,"mcpCommand");function zv(r){let e=new pe;return e.name("exocortex").description("CLI tool for Exocortex knowledge management system - SPARQL queries, task management, and more").version(r??"17.17.0"),e.addCommand(bq()),e.addCommand(Oq()),e.addCommand(XV()),e.addCommand(rG()),e.addCommand(vG()),e.addCommand(nG()),e.addCommand(cG()),e.addCommand(lG()),e.addCommand(PG()),e.addCommand(kG()),e.addCommand(nq()),e.addCommand(cq()),e.addCommand(dq()),e.addCommand(pq()),e.addCommand(hq()),e.addCommand(mq()),e.addCommand(gq()),e.addCommand(Zq()),e.addCommand(rW()),e.addCommand(OW()),e.addCommand(PW()),e.addCommand(DW()),e.addCommand(NW()),e.addCommand($W()),e.addCommand(_W()),e.addCommand(IW()),e.addCommand(jW()),e.addCommand(JW(r??"17.17.0")),e}a(zv,"createProgram");zv().parse();0&&(module.exports={createProgram});
720
+ `)}}a(MAe,"runStdioServer");function JW(r){return new pe("mcp").description("Run an MCP (Model Context Protocol) stdio server exposing create_asset / create_effort tools backed by this CLI").option("--entry <path>","Path to the CLI entry script the tools invoke (defaults to this process's script)").action(async e=>{let t=e.entry??process.argv[1],n=new Kv({runCli:QW(t),version:r??"unknown"});await MAe(n,process.stdin,i=>process.stdout.write(i))})}a(JW,"mcpCommand");function zv(r){let e=new pe;return e.name("exocortex").description("CLI tool for Exocortex knowledge management system - SPARQL queries, task management, and more").version(r??"17.17.1"),e.addCommand(bq()),e.addCommand(Oq()),e.addCommand(XV()),e.addCommand(rG()),e.addCommand(vG()),e.addCommand(nG()),e.addCommand(cG()),e.addCommand(lG()),e.addCommand(PG()),e.addCommand(kG()),e.addCommand(nq()),e.addCommand(cq()),e.addCommand(dq()),e.addCommand(pq()),e.addCommand(hq()),e.addCommand(mq()),e.addCommand(gq()),e.addCommand(Zq()),e.addCommand(rW()),e.addCommand(OW()),e.addCommand(PW()),e.addCommand(DW()),e.addCommand(NW()),e.addCommand($W()),e.addCommand(_W()),e.addCommand(IW()),e.addCommand(jW()),e.addCommand(JW(r??"17.17.1")),e}a(zv,"createProgram");zv().parse();0&&(module.exports={createProgram});
721
721
  /*! Bundled license information:
722
722
 
723
723
  reflect-metadata/Reflect.js: